Re: [PATCH] reinstate mac rtc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm confident the date/time is passed by bootinfo OK, but it then
'disappears'.

Yep, nothing is done with mac_bi_data.boottime, except for printing it
to the kernel log.

I'm pretty sure it was still OK in the 2.2 series - I'm unsure on when it
broke: 2.4 or 2.6?

It seems to be removed in early 2.5 (2.4 has it, my oldest 2.5 is 2.5.5
and that one doesn't have it anymore):

OK, how's that for using the bootinfo passed time in case we don't know how to 
read the RTC?

--- linux-2.6.28-rc1-geert/arch/m68k/mac/misc.c
+++ linux-2.6.28-rc1/arch/m68k/mac/misc.c
@@ -689,6 +689,8 @@
  * Read/write the hardware clock.
  */
 
+static int mac_fakertc_initdone;
+
 int mac_hwclk(int op, struct rtc_time *t)
 {
 	unsigned long now;
@@ -710,7 +712,17 @@
 			now = cuda_read_time();
 			break;
 		default:
-			now = 0;
+			if (mac_fakertc_initdone)
+				now = get_seconds();
+			else {
+				unmktime(mac_bi_data.boottime, mac_bi_data.gmtbias * 60,
+					&t->tm_year, &t->tm_mon, &t->tm_mday,
+					&t->tm_hour, &t->tm_min, &t->tm_sec);
+				t->tm_mon += 1;
+				now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
+					t->tm_hour, t->tm_min, t->tm_sec);
+				mac_fakertc_initdone = 1;
+			}
 		}
 

The very first call to mac_hwclock should be made from timekeeping_init, hence 
the boottime should be passed to timekeeping_init now, which then sets the 
kernel wall time. Subsequent calls just use the kernel wall time. 

The unmktime/mktime combo may not actually be necessary here - setting 
now = boottime - gmtoffset*60 may do the same thing. 

Deserving of such a hackish approach, I've not tried to compile this. Test and 
improve, please. 

	Michael
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux