powerpc: Merge machdep.h

A few things change for consistency between ppc32 and ppc64:
idle functions return void; *_get_boot_time functions return
unsigned long (i.e. time_t) rather than filling in a struct rtc_time
(since that's useful to the callers and easier for pmac to
generate); *_get_rtc_time and *_set_rtc_time functions take
a struct rtc_time; irq_canonicalize is gone; nvram_sync returns
void.

Signed-off-by: Paul Mackerras <paulus@samba.org>
diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
index 81f5251..0a9ba70 100644
--- a/arch/powerpc/platforms/powermac/pmac.h
+++ b/arch/powerpc/platforms/powermac/pmac.h
@@ -10,9 +10,12 @@
  * pmac_* files. Mostly for use by pmac_setup
  */
 
+struct rtc_time;
+
 extern long pmac_time_init(void);
-extern unsigned long pmac_get_rtc_time(void);
-extern int pmac_set_rtc_time(unsigned long nowtime);
+extern unsigned long pmac_get_boot_time(void);
+extern void pmac_get_rtc_time(struct rtc_time *);
+extern int pmac_set_rtc_time(struct rtc_time *);
 extern void pmac_read_rtc_time(void);
 extern void pmac_calibrate_decr(void);
 extern void pmac_pcibios_fixup(void);
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 7eb0c34..b6414e7 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -562,7 +562,6 @@
 	ppc_md.setup_arch     = pmac_setup_arch;
 	ppc_md.show_cpuinfo   = pmac_show_cpuinfo;
 	ppc_md.show_percpuinfo = pmac_show_percpuinfo;
-	ppc_md.irq_canonicalize = NULL;
 	ppc_md.init_IRQ       = pmac_pic_init;
 	ppc_md.get_irq        = pmac_get_irq; /* Changed later on ... */
 
@@ -578,6 +577,7 @@
 	ppc_md.time_init      = pmac_time_init;
 	ppc_md.set_rtc_time   = pmac_set_rtc_time;
 	ppc_md.get_rtc_time   = pmac_get_rtc_time;
+	ppc_md.get_boot_time  = pmac_get_boot_time;
 	ppc_md.calibrate_decr = pmac_calibrate_decr;
 
 	ppc_md.feature_call   = pmac_do_feature_call;
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
index edb9fcc..3ee6d8a 100644
--- a/arch/powerpc/platforms/powermac/time.c
+++ b/arch/powerpc/platforms/powermac/time.c
@@ -77,8 +77,7 @@
 #endif
 }
 
-unsigned long
-pmac_get_rtc_time(void)
+unsigned long pmac_get_boot_time(void)
 {
 #if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU)
 	struct adb_request req;
@@ -118,20 +117,33 @@
 	return 0;
 }
 
-int
-pmac_set_rtc_time(unsigned long nowtime)
+void pmac_get_rtc_time(struct rtc_time *tm)
 {
+	unsigned long now;
+
+	now = pmac_get_boot_time();
+	to_tm(now, tm);
+	tm->tm_year -= 1900;
+	tm->tm_mon -= 1;		/* month is 0-based */
+}
+
+int pmac_set_rtc_time(struct rtc_time *tm)
+{
+	unsigned long nowtime;
 #if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU)
 	struct adb_request req;
 #endif
 
+	nowtime = mktime(tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
+			 tm->tm_hour, tm->tm_min, tm->tm_sec);
 	nowtime += RTC_OFFSET;
 
 	switch (sys_ctrler) {
 #ifdef CONFIG_ADB_CUDA
 	case SYS_CTRLER_CUDA:
 		if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
-				 nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
+				 nowtime >> 24, nowtime >> 16, nowtime >> 8,
+				 nowtime) < 0)
 			return 0;
 		while (!req.complete)
 			cuda_poll();
@@ -221,7 +233,7 @@
 	case PBOOK_SLEEP_NOW:
 		do {
 			seq = read_seqbegin_irqsave(&xtime_lock, flags);
-			time_diff = xtime.tv_sec - pmac_get_rtc_time();
+			time_diff = xtime.tv_sec - pmac_get_boot_time();
 		} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
 		break;
 	case PBOOK_WAKE: