On Friday, November 8, 2019, Rajath Shashidhara wrote: > > On 07-11-2019 07:33, Aleksandar Markovic wrote: > >> >> I did a quick Google search on datasheets of existing RTC >> implemtations, and the result is: >> >> DS1338: https://datasheets.maximintegrated.com/en/ds/DS1338-DS1338Z.pdf >> M41T80: https://www.st.com/resource/en/datasheet/m41t80.pdf >> M48T59: http://www.elektronikjk.pl/elementy_czynne/IC/M48T59V.pdf >> MC146818: https://www.nxp.com/docs/en/data-sheet/MC146818.pdf >> PL031: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0224c/ >> real_time_clock_pl031_r1p3_technical_reference_manual_DDI0224C.pdf >> TWL92230: https://datasheet.octopart.com/TWL92230C-Texas-Instruments- >> datasheet-150321.pdf >> Zynq RTC: https://www.xilinx.com/support/documentation/user_guides/ >> ug1085-zynq-ultrascale-trm.pdf >> (chapter 7) >> > > I have a few questions about this: > [a] Is there any particular reason that you picked DS3231 ? Linux kernel > has drivers for DS3232/34 only [1]. > Hi, Rajath. No, it doesn't. Linux kernel has a driver for DS3231. Take a closer look. But, in any case, you base your QEMU emulation on the *datasheet*. The OS drivers may be helpful, but they are not a reference you base your solution on. The drivers may be obsolete, incorrect, incomplete, or just plain wrong. Additionally, as QEMU, of course, supports emulation of systems running variety of OSs, the existence of the Linux kernel driver is not a necessary condition for QEMU implementation. QEMU emulates many systems that Linux never ran on, and could not be run at all. Sincerely, Aleksandar > > I did read the datasheets of both 3232 & 3231 and found that they are > quite similar except for the 236 bytes of SRAM support found only in 3232. > > [b] As per the datasheet, DS3231 has a built-in temperature sensor. > Temperature can be read from a dedicated register. There can be two > approaches to emulating this: (1) Return a constant temperature value on > every read (2) Throw a not-supported exception/warning. What is the qemu > convention for handling such features ? > > [c] DS3231 also has programmable square-wave output + 32 KHz output pin. > M41T80 chip also supports this feature. However, qemu does not support > emulation of these features [2]. Do I take the same approach ? > > Thanks! > Rajath Shashidhara > > References: > [1] https://elixir.bootlin.com/linux/v5.4-rc6/source/drivers/rtc > /rtc-ds3232.c > [2] https://git.qemu.org/?p=qemu.git;a=blob;f=hw/rtc/m41t80.c;h= > 914ecac8f4db418633d6daf92608cb50f6b89052;hb=HEAD >