Skip to contentSkip to conversation

IP22 RTC bug on 64bit 2.6 kernels ?

DISCUSSION Julien BLACHE 1 participant 2 messages Jul 8, 2006 MIPS

lore
Share & tools
lore
#0 lore raw

Hi,

For some time now, my IP22 was booting in a "back to the future" mode, somewhere between 1983 and 1987 (usually, 1985). Interestingly enough, only the year comes out wrong, everything else is perfectly OK.

This is not the RTC chip at fault, as everything else stored in the NVRAM is OK too. I was prepared to order a new RTC chip, until...

Until I remembered that it all started with the new 64bit 2.6 kernels built by Martin Michlmayr in Debian. Indeed, rebooting into a 32bit 2.4.27 the problem goes away.

Using the 2.6 kernel (2.6.17), hwclock -w/hwclock -r will not give the same year twice in a row, which is quite fun and unexpected. I couldn't find a logic of some kind in the values read from the RTC; the year went as far as 1972 and as close as 2007 :)

So, it looks like there is a bug in this area with (at least) 64bit 2.6 kernels. Is there any known bug ? Anything I can do to help track the problem down ?

Thanks,

JB.

Signature · 4 lines
 Julien BLACHE - Debian & GNU/Linux Developer - <[email protected]> 
 
 Public key available on <http://www.jblache.org> - KeyID: F5D6 5169 
 GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169 
#1 lore raw

Julien BLACHE <[email protected]> wrote:

Hi,

Quoted 3 lines

So, it looks like there is a bug in this area with (at least) 64bit 2.6 kernels. Is there any known bug ? Anything I can do to help track the problem down ?

Ok, it's brown paper bag time for someone :-)

This patch fixes a typo in arch/mips/sgi-ip22/ip22-time.c, leading to the incorrect year being set into the RTC chip.

mips/sgi-ip22/ip22-time.c renamed from mips/sgi-ip22/ip22-time.c.orig +1 -1
@@ -76,7 +76,7 @@
 	save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff;
 	hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE;
 
-	hpc3c0->rtcregs[RTC_YEAR] = BIN2BCD(tm.tm_sec);
+	hpc3c0->rtcregs[RTC_YEAR] = BIN2BCD(tm.tm_year);
 	hpc3c0->rtcregs[RTC_MONTH] = BIN2BCD(tm.tm_mon);
 	hpc3c0->rtcregs[RTC_DATE] = BIN2BCD(tm.tm_mday);
 	hpc3c0->rtcregs[RTC_HOURS] = BIN2BCD(tm.tm_hour);

Thanks,

JB.

Signature · 4 lines
 Julien BLACHE - Debian & GNU/Linux Developer - <[email protected]> 
 
 Public key available on <http://www.jblache.org> - KeyID: F5D6 5169 
 GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169