Re: RTC failure in January (was: New significant speedups coming to FreeRunner)
On 23 February 2010 23:19, Sebastian Reichel wrote: > > I just tried the patch and it seems to work. It will be included in the > next Debian kernel. OK, cool, thanks. (Wow, my first ever kernel patch!) Neil ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: RTC failure in January (was: New significant speedups coming to FreeRunner)
On Tue, Feb 23, 2010 at 10:40:26PM +, Neil Jerram wrote: > On 23 February 2010 18:18, Sebastian Reichel wrote: > > > > Hi, > > > > what happened with this patch? My FR ran out of power, which > > resulted in a reset RTC. Now I can't set it back to current time, > > because of hwclock's read. > > I wasn't able to test it myself, because I don't have a > cross-compilation setup, and I never heard of anyone else trying it > either. > > For me, the problem was actually "solved" by trying out SHR-T briefly > - while still in January. Then when I switched back to Debian, the > RTC was fine again. I remember thinking that I understood this at the > time, but right now I can't remember the detailed explanation. > > In fact, if switching temporarily to another distro/kernel works for > you (and for anyone else), that's probably better than having cruft > like this patch in your ongoing kernel. I just tried the patch and it seems to work. It will be included in the next Debian kernel. -- Sebastian signature.asc Description: Digital signature ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: RTC failure in January (was: New significant speedups coming to FreeRunner)
On 23 February 2010 18:18, Sebastian Reichel wrote: > > Hi, > > what happened with this patch? My FR ran out of power, which > resulted in a reset RTC. Now I can't set it back to current time, > because of hwclock's read. I wasn't able to test it myself, because I don't have a cross-compilation setup, and I never heard of anyone else trying it either. For me, the problem was actually "solved" by trying out SHR-T briefly - while still in January. Then when I switched back to Debian, the RTC was fine again. I remember thinking that I understood this at the time, but right now I can't remember the detailed explanation. In fact, if switching temporarily to another distro/kernel works for you (and for anyone else), that's probably better than having cruft like this patch in your ongoing kernel. Regards, Neil ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: RTC failure in January (was: New significant speedups coming to FreeRunner)
On Sun, Jan 24, 2010 at 06:04:02PM +, Neil Jerram wrote: > 2010/1/24 Andy Poling : > > > > 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 Hi, what happened with this patch? My FR ran out of power, which resulted in a reset RTC. Now I can't set it back to current time, because of hwclock's read. -- Sebastian signature.asc Description: Digital signature ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: RTC failure in January (was: New significant speedups coming to FreeRunner)
2010/1/24 Andy Poling : > > 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 Date: Sun, 24 Jan 2010 15:23:52 + 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
RTC failure in January (was: New significant speedups coming to FreeRunner)
On Mon, 18 Jan 2010, Neil Jerram wrote: > One more possible issue with this kernel. The boot messages always say > > [21474539.53] 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.86] pcf50606-rtc pcf50606-rtc: PCF_TIME: 24.00.10 06:26:41 [21474537.86] pcf50606-rtc pcf50606-rtc: RTC_TIME: 24.4294967295.110 6:26:41 [21474537.86] 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 ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community