RTC failure in January (was: New significant speedups coming to FreeRunner)

Andy Poling andy at realbig.com
Sun Jan 24 08:05:42 CET 2010


On Mon, 18 Jan 2010, Neil Jerram wrote:
> One more possible issue with this kernel.  The boot messages always say
>
> [21474539.530000] pcf50633-rtc pcf50633-rtc: hctosys: unable to read
> the hardware clock

I'm seeing this on my build from a recent git pull as well.  It also has the
unpleasant side effect of also failing to set the time on resume so the clock
seems to lose time during any suspend.  :-(

I finally looked into it, and this is the problem (with RTC debugging
enabled):

[21474537.860000] pcf50606-rtc pcf50606-rtc: PCF_TIME: 24.00.10 06:26:41
[21474537.860000] pcf50606-rtc pcf50606-rtc: RTC_TIME: 24.4294967295.110 6:26:41
[21474537.860000] pcf50606-rtc pcf50606-rtc: hctosys: unable to read the hardware clock

That month fails rtc_valid_tm(), leading to the EINVAL.

The commit/fix Werner made last April seems to be not interacting well with
the zero-based month count in the pcf50606 RTC (set, in my case, by an old
kernel I booted at some point in January):

diff --git a/drivers/rtc/rtc-pcf50606.c b/drivers/rtc/rtc-pcf50606.c
index e059093..434cfc1 100644 (file)

--- a/drivers/rtc/rtc-pcf50606.c
+++ b/drivers/rtc/rtc-pcf50606.c
@@ -70,7 +70,7 @@ static void pcf2rtc_time(struct rtc_time *rtc, struct pcf50606_time *pcf)
         rtc->tm_hour = bcd2bin(pcf->time[PCF50606_TI_HOUR]);
         rtc->tm_wday = bcd2bin(pcf->time[PCF50606_TI_WKDAY]);
         rtc->tm_mday = bcd2bin(pcf->time[PCF50606_TI_DAY]);
-       rtc->tm_mon = bcd2bin(pcf->time[PCF50606_TI_MONTH]);
+       rtc->tm_mon = bcd2bin(pcf->time[PCF50606_TI_MONTH]) - 1;
         rtc->tm_year = bcd2bin(pcf->time[PCF50606_TI_YEAR]) + 100;
  }

Since hwclock does a read before a write of the RTC, we can't fix this as
easily as one might think.  I guess in another 7 days it will be working
again. :-)

I was able to escape the catch-22 by booting an old kernel, setting the RTC to
a date in February 2010 with hwclock and then booting the new kernel again.

-Andy

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so. - Mark Twain



More information about the community mailing list