On Saturday, November 9, 2019, Rajath Shashidhara <raja...@cs.utexas.edu> wrote:
> > > On 11/9/19 1:46 PM, Aleksandar Markovic wrote: > > > > > > > Hi, Rajath. > > > > No, it doesn't. Linux kernel has a driver for DS3231. Take a closer look. > > Kernel driver found here: > https://elixir.bootlin.com/linux/v5.4-rc6/source/drivers/rtc/rtc-ds3232.c > did register NVMEM of 236 bytes with the kernel. As long as this NVMEM > is never accessed, the same driver should work for both DS3231 and DS3232. > > Is there any other driver you are referring to ? Please let me know if I > missed something here. > > The official DS3231 driver is (hidden) in: https://elixir.bootlin.com/linux/v5.4-rc6/source/drivers/rtc/rtc-ds1307.c This driver actually supports around 15 RTC chips, and DS3231 among them. It contains fairly sophisticated "feature control" that enables it to support multiple RTC chips. > > > > 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. > > > > I was only looking at the Kernel drivers to setup a test framework. I > plan to test my implementation using a Raspi emulation with qemu, > configure it with a DS3231 device. After this, I should be able to use > ioctl() on /dev/rtc to test the functionality: > https://linux.die.net/man/4/rtc > > If you have a better approach to testing, do let me know. > > Your method sounds good to me. Hopefully it won't be too difficult to you to execute it. Best wishes, Aleksandar > Thanks, > Rajath Shashidhara >