Problem syncing RTC (DS1340) with system time

Processor: MPC8245 Kernel version: 2.6.14 RTC: DS1340 Driver used: rtc-ds1307.c - ported from some newer version (2.6.17 or something) of the standard kernel.

problem faced: RTC time is not syncd to the system time or vice versa. In arch/ppc/platforms/our_plat.c I am setting ppc_md.get_rtc_time and ppc_md.set_rtc_time. ppc_md.calibrate_decr is also set. The ppc_md.time_init has not been set. It seems that as part of time_init, I should be enabling the time base. In 83xx the TBEN is in a register called SPCR, however for 824x it is a signal (input line) to the CPU. Does that mean changing the hardware so that the pin is asserted by default?

In another way or trying to get RTC and system clock to be synced, I was using hctosys.c in drivers/rtc/ for the same purpose. In this case, the RTC's time was read at boot and then written to the system clock at boot. However, immediately after writing to system time, the time used to get changed to some other random value.

The RTC driver works fine - which means - I can write to the RTC (thru the sysfs) and can read it back from the RTC and the values that I write are available even on subsequent reboots.

So what is the missing piece to sync the system clock and the RTC? Is there any other processor dependent stuff that should be done that I am missing or doing wrong? Or is there something on the lines of hctosys.c that I should be doing? Please guide.

Thanks, Aniket.

Reply to
aniket.d
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.