2010/1/24 Andy Poling <a...@realbig.com>: > > I finally looked into it, and this is the problem (with RTC debugging > enabled): [...]
Wow, what a fantastic bug! So, IIUC, it will only strike someone who upgraded in January from a kernel without Werner's change, to one with Werner's change - because the old kernel will have left a 0 value in pcf->time[PCF50606_TI_MONTH]. Amazing :-) Great investigation too. I'm really pleased that this is understood now and is going to be fixed. What about the attached patch to ease transition, and to get a working RTC before February? Regards, Neil
From aec6c6be9cadd54f432ffd2b65e8dce37fee78b4 Mon Sep 17 00:00:00 2001 From: Neil Jerram <neiljer...@googlemail.com> Date: Sun, 24 Jan 2010 15:23:52 +0000 Subject: [PATCH] Fix for failure to read RTC following kernel upgrade in January For explanation see http://lists.openmoko.org/pipermail/community/2010-January/059634.html Thanks to Andy Poling for the investigation. --- drivers/rtc/rtc-pcf50606.c | 4 +++- drivers/rtc/rtc-pcf50633.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-pcf50606.c b/drivers/rtc/rtc-pcf50606.c index 6bd93b0..6d4897c 100644 --- a/drivers/rtc/rtc-pcf50606.c +++ b/drivers/rtc/rtc-pcf50606.c @@ -71,7 +71,9 @@ 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]) - 1; + rtc->tm_mon = bcd2bin(pcf->time[PCF50606_TI_MONTH] + ? pcf->time[PCF50606_TI_MONTH] + : 1) - 1; rtc->tm_year = bcd2bin(pcf->time[PCF50606_TI_YEAR]) + 100; } diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c index 8669815..637a1d5 100644 --- a/drivers/rtc/rtc-pcf50633.c +++ b/drivers/rtc/rtc-pcf50633.c @@ -71,7 +71,9 @@ static void pcf2rtc_time(struct rtc_time *rtc, struct pcf50633_time *pcf) rtc->tm_hour = bcd2bin(pcf->time[PCF50633_TI_HOUR]); rtc->tm_wday = bcd2bin(pcf->time[PCF50633_TI_WKDAY]); rtc->tm_mday = bcd2bin(pcf->time[PCF50633_TI_DAY]); - rtc->tm_mon = bcd2bin(pcf->time[PCF50633_TI_MONTH]) - 1; + rtc->tm_mon = bcd2bin(pcf->time[PCF50633_TI_MONTH] + ? pcf->time[PCF50633_TI_MONTH] + : 1) - 1; rtc->tm_year = bcd2bin(pcf->time[PCF50633_TI_YEAR]) + 100; } -- 1.5.6.5
_______________________________________________ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community