aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-10-19 19:23:26 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-19 19:23:26 -0400
commitf2783c15007468c14972e2617db51e9affc7fad9 (patch)
tree6c8f57ee8e5cdaeb810a3ccf7f697576a7df7615 /arch/powerpc/platforms
parent03f88e9f7145b03fd0d855918d54a3bf5342ac5e (diff)
powerpc: Merge time.c and asm/time.h.
We now use the merged time.c for both 32-bit and 64-bit compilation with ARCH=powerpc, and for ARCH=ppc64, but not for ARCH=ppc32. This removes setup_default_decr (folds its function into time_init) and moves wakeup_decrementer into time.c. This also makes an asm-powerpc/rtc.h. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq.c9
-rw-r--r--arch/powerpc/platforms/powermac/time.c28
2 files changed, 18 insertions, 19 deletions
diff --git a/arch/powerpc/platforms/powermac/cpufreq.c b/arch/powerpc/platforms/powermac/cpufreq.c
index bcd9224f3f9..c47f8b69725 100644
--- a/arch/powerpc/platforms/powermac/cpufreq.c
+++ b/arch/powerpc/platforms/powermac/cpufreq.c
@@ -110,15 +110,6 @@ static inline void local_delay(unsigned long ms)
110 msleep(ms); 110 msleep(ms);
111} 111}
112 112
113static inline void wakeup_decrementer(void)
114{
115 set_dec(tb_ticks_per_jiffy);
116 /* No currently-supported powerbook has a 601,
117 * so use get_tbl, not native
118 */
119 last_jiffy_stamp(0) = tb_last_stamp = get_tbl();
120}
121
122#ifdef DEBUG_FREQ 113#ifdef DEBUG_FREQ
123static inline void debug_calc_bogomips(void) 114static inline void debug_calc_bogomips(void)
124{ 115{
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
index 3ee6d8aa14c..eb9969b52f9 100644
--- a/arch/powerpc/platforms/powermac/time.c
+++ b/arch/powerpc/platforms/powermac/time.c
@@ -6,6 +6,8 @@
6 * 6 *
7 * Paul Mackerras August 1996. 7 * Paul Mackerras August 1996.
8 * Copyright (C) 1996 Paul Mackerras. 8 * Copyright (C) 1996 Paul Mackerras.
9 * Copyright (C) 2003-2005 Benjamin Herrenschmidt.
10 *
9 */ 11 */
10#include <linux/config.h> 12#include <linux/config.h>
11#include <linux/errno.h> 13#include <linux/errno.h>
@@ -19,7 +21,9 @@
19#include <linux/adb.h> 21#include <linux/adb.h>
20#include <linux/cuda.h> 22#include <linux/cuda.h>
21#include <linux/pmu.h> 23#include <linux/pmu.h>
24#include <linux/interrupt.h>
22#include <linux/hardirq.h> 25#include <linux/hardirq.h>
26#include <linux/rtc.h>
23 27
24#include <asm/sections.h> 28#include <asm/sections.h>
25#include <asm/prom.h> 29#include <asm/prom.h>
@@ -30,6 +34,14 @@
30#include <asm/time.h> 34#include <asm/time.h>
31#include <asm/nvram.h> 35#include <asm/nvram.h>
32 36
37#undef DEBUG
38
39#ifdef DEBUG
40#define DBG(x...) printk(x)
41#else
42#define DBG(x...)
43#endif
44
33/* Apparently the RTC stores seconds since 1 Jan 1904 */ 45/* Apparently the RTC stores seconds since 1 Jan 1904 */
34#define RTC_OFFSET 2082844800 46#define RTC_OFFSET 2082844800
35 47
@@ -54,10 +66,7 @@
54/* Bits in IFR and IER */ 66/* Bits in IFR and IER */
55#define T1_INT 0x40 /* Timer 1 interrupt */ 67#define T1_INT 0x40 /* Timer 1 interrupt */
56 68
57extern struct timezone sys_tz; 69long __init pmac_time_init(void)
58
59long __init
60pmac_time_init(void)
61{ 70{
62#ifdef CONFIG_NVRAM 71#ifdef CONFIG_NVRAM
63 s32 delta = 0; 72 s32 delta = 0;
@@ -210,7 +219,7 @@ via_calibrate_decr(void)
210 tb_ticks_per_jiffy = (dstart - dend) / ((6 * HZ)/100); 219 tb_ticks_per_jiffy = (dstart - dend) / ((6 * HZ)/100);
211 tb_to_us = mulhwu_scale_factor(dstart - dend, 60000); 220 tb_to_us = mulhwu_scale_factor(dstart - dend, 60000);
212 221
213 printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n", 222 printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %lu (%u ticks)\n",
214 tb_ticks_per_jiffy, dstart - dend); 223 tb_ticks_per_jiffy, dstart - dend);
215 224
216 iounmap(via); 225 iounmap(via);
@@ -228,6 +237,7 @@ time_sleep_notify(struct pmu_sleep_notifier *self, int when)
228 static unsigned long time_diff; 237 static unsigned long time_diff;
229 unsigned long flags; 238 unsigned long flags;
230 unsigned long seq; 239 unsigned long seq;
240 struct timespec tv;
231 241
232 switch (when) { 242 switch (when) {
233 case PBOOK_SLEEP_NOW: 243 case PBOOK_SLEEP_NOW:
@@ -237,11 +247,9 @@ time_sleep_notify(struct pmu_sleep_notifier *self, int when)
237 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 247 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
238 break; 248 break;
239 case PBOOK_WAKE: 249 case PBOOK_WAKE:
240 write_seqlock_irqsave(&xtime_lock, flags); 250 tv.tv_sec = pmac_get_boot_time() + time_diff;
241 xtime.tv_sec = pmac_get_rtc_time() + time_diff; 251 tv.tv_nsec = 0;
242 xtime.tv_nsec = 0; 252 do_settimeofday(&tv);
243 last_rtc_update = xtime.tv_sec;
244 write_sequnlock_irqrestore(&xtime_lock, flags);
245 break; 253 break;
246 } 254 }
247 return PBOOK_SLEEP_OK; 255 return PBOOK_SLEEP_OK;