Disclaimer: I'm working on a new project here, so I'm not 100% up-to-date on 
the system as a whole.

I've been tasked to find out why our RTC clock is not being updated after 
suynching with a NTP timesource.  In our previous release, the RTC seemed to be 
updated every 11 minutes via the timer_interrupt() ISR.  This no longer seems 
to be happening.  I have determined that timer_isr() is running, but 
ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) doesn't appear to ever 
get called.  There are five conditions that must be true for this to be called:

   1 - ppc_md.set_rtc_time

this is true.

   2 - ntp_synced()

this seems to become true as soon as I sync with my NTP timesource.

   3 - xtime.tv_sec - last_rtc_update >= 659

this seems to become true within a few secondws of syncing with my timesource

   4 - abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ

this seems to be true fairly often

   5 - jiffies - wall_jiffies == 1

This seems to be true fairly often.

My checks for these conditions are pretty crude.  If one is true, I go into an 
infinite loop, which eventually kicks off the watchdog timer and the card 
reboots.  Quick & dirty.

#1 #2, and #3 seem pretty obvious.  #1 checks for the presence of a time sync 
function, #2 checks to see if we have synchronized with an NTP server, and #3 
checks to see of that sync was at least 11 minutes ago.

#4 and #5 I don't understand so much.  I THINK #4 checks to see of we're close 
to a second or half-second boundry (I'm assuming this is becxause of a hardware 
limitation on the RTC.)  #5 I have no clue about.  It seems that wall_jiffies 
and jiffies are always the same.

My goal is simply to sync the RTC with the system clock, either periodically or 
at system shutdown (which is preferred.)  however, I don't have an RTC driver.  
Neither do I have hwclock on this system, so my first shot was getting the 
11-minute update working.  If this is the wrong way to go, I'm open to 
suggestions.

-- Robert King
   Sevis Systems, Inc.
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal
#####################################################################################
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

Reply via email to