diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-19 20:10:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-19 20:10:06 -0400 |
commit | 7d02093e29de9efc4a72d5e93baae9506969b789 (patch) | |
tree | a6fc2450132ae419934f6eb9d223baa338b7d782 | |
parent | 6e0b7b2c39b91b467270dd0bc383914f99e1fb28 (diff) | |
parent | e9ddbc075d95b2edf111247cdde16f33c31654a8 (diff) |
Merge branch 'timers-for-linus-cleanups' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-for-linus-cleanups' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
avr32: Fix typo in read_persistent_clock()
sparc: Convert sparc to use read/update_persistent_clock
cris: Convert cris to use read/update_persistent_clock
m68k: Convert m68k to use read/update_persistent_clock
m32r: Convert m32r to use read/update_peristent_clock
blackfin: Convert blackfin to use read/update_persistent_clock
ia64: Convert ia64 to use read/update_persistent_clock
avr32: Convert avr32 to use read/update_persistent_clock
h8300: Convert h8300 to use read/update_persistent_clock
frv: Convert frv to use read/update_persistent_clock
mn10300: Convert mn10300 to use read/update_persistent_clock
alpha: Convert alpha to use read/update_persistent_clock
xtensa: Fix unnecessary setting of xtime
time: Clean up direct xtime usage in xen
-rw-r--r-- | arch/alpha/Kconfig | 3 | ||||
-rw-r--r-- | arch/alpha/kernel/time.c | 101 | ||||
-rw-r--r-- | arch/avr32/kernel/time.c | 12 | ||||
-rw-r--r-- | arch/blackfin/kernel/time-ts.c | 13 | ||||
-rw-r--r-- | arch/blackfin/kernel/time.c | 39 | ||||
-rw-r--r-- | arch/cris/Kconfig | 3 | ||||
-rw-r--r-- | arch/cris/arch-v10/kernel/time.c | 37 | ||||
-rw-r--r-- | arch/cris/arch-v32/kernel/time.c | 40 | ||||
-rw-r--r-- | arch/cris/kernel/time.c | 20 | ||||
-rw-r--r-- | arch/frv/kernel/time.c | 34 | ||||
-rw-r--r-- | arch/h8300/kernel/time.c | 10 | ||||
-rw-r--r-- | arch/ia64/kernel/time.c | 12 | ||||
-rw-r--r-- | arch/m32r/kernel/time.c | 47 | ||||
-rw-r--r-- | arch/m68k/kernel/time.c | 11 | ||||
-rw-r--r-- | arch/mn10300/Kconfig | 3 | ||||
-rw-r--r-- | arch/mn10300/kernel/rtc.c | 27 | ||||
-rw-r--r-- | arch/mn10300/kernel/time.c | 4 | ||||
-rw-r--r-- | arch/sparc/Kconfig | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/time_32.c | 18 | ||||
-rw-r--r-- | arch/x86/xen/time.c | 6 | ||||
-rw-r--r-- | arch/xtensa/kernel/time.c | 5 |
21 files changed, 137 insertions, 310 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 75291fdd379f..b7193986cbf9 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -55,6 +55,9 @@ config ARCH_USES_GETTIMEOFFSET | |||
55 | bool | 55 | bool |
56 | default y | 56 | default y |
57 | 57 | ||
58 | config GENERIC_CMOS_UPDATE | ||
59 | def_bool y | ||
60 | |||
58 | config ZONE_DMA | 61 | config ZONE_DMA |
59 | bool | 62 | bool |
60 | default y | 63 | default y |
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c index 5d0826654c61..5465e932e568 100644 --- a/arch/alpha/kernel/time.c +++ b/arch/alpha/kernel/time.c | |||
@@ -75,8 +75,6 @@ static struct { | |||
75 | __u32 last_time; | 75 | __u32 last_time; |
76 | /* ticks/cycle * 2^48 */ | 76 | /* ticks/cycle * 2^48 */ |
77 | unsigned long scaled_ticks_per_cycle; | 77 | unsigned long scaled_ticks_per_cycle; |
78 | /* last time the CMOS clock got updated */ | ||
79 | time_t last_rtc_update; | ||
80 | /* partial unused tick */ | 78 | /* partial unused tick */ |
81 | unsigned long partial_tick; | 79 | unsigned long partial_tick; |
82 | } state; | 80 | } state; |
@@ -91,6 +89,52 @@ static inline __u32 rpcc(void) | |||
91 | return result; | 89 | return result; |
92 | } | 90 | } |
93 | 91 | ||
92 | int update_persistent_clock(struct timespec now) | ||
93 | { | ||
94 | return set_rtc_mmss(now.tv_sec); | ||
95 | } | ||
96 | |||
97 | void read_persistent_clock(struct timespec *ts) | ||
98 | { | ||
99 | unsigned int year, mon, day, hour, min, sec, epoch; | ||
100 | |||
101 | sec = CMOS_READ(RTC_SECONDS); | ||
102 | min = CMOS_READ(RTC_MINUTES); | ||
103 | hour = CMOS_READ(RTC_HOURS); | ||
104 | day = CMOS_READ(RTC_DAY_OF_MONTH); | ||
105 | mon = CMOS_READ(RTC_MONTH); | ||
106 | year = CMOS_READ(RTC_YEAR); | ||
107 | |||
108 | if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { | ||
109 | sec = bcd2bin(sec); | ||
110 | min = bcd2bin(min); | ||
111 | hour = bcd2bin(hour); | ||
112 | day = bcd2bin(day); | ||
113 | mon = bcd2bin(mon); | ||
114 | year = bcd2bin(year); | ||
115 | } | ||
116 | |||
117 | /* PC-like is standard; used for year >= 70 */ | ||
118 | epoch = 1900; | ||
119 | if (year < 20) | ||
120 | epoch = 2000; | ||
121 | else if (year >= 20 && year < 48) | ||
122 | /* NT epoch */ | ||
123 | epoch = 1980; | ||
124 | else if (year >= 48 && year < 70) | ||
125 | /* Digital UNIX epoch */ | ||
126 | epoch = 1952; | ||
127 | |||
128 | printk(KERN_INFO "Using epoch = %d\n", epoch); | ||
129 | |||
130 | if ((year += epoch) < 1970) | ||
131 | year += 100; | ||
132 | |||
133 | ts->tv_sec = mktime(year, mon, day, hour, min, sec); | ||
134 | } | ||
135 | |||
136 | |||
137 | |||
94 | /* | 138 | /* |
95 | * timer_interrupt() needs to keep up the real-time clock, | 139 | * timer_interrupt() needs to keep up the real-time clock, |
96 | * as well as call the "do_timer()" routine every clocktick | 140 | * as well as call the "do_timer()" routine every clocktick |
@@ -123,19 +167,6 @@ irqreturn_t timer_interrupt(int irq, void *dev) | |||
123 | if (nticks) | 167 | if (nticks) |
124 | do_timer(nticks); | 168 | do_timer(nticks); |
125 | 169 | ||
126 | /* | ||
127 | * If we have an externally synchronized Linux clock, then update | ||
128 | * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | ||
129 | * called as close as possible to 500 ms before the new second starts. | ||
130 | */ | ||
131 | if (ntp_synced() | ||
132 | && xtime.tv_sec > state.last_rtc_update + 660 | ||
133 | && xtime.tv_nsec >= 500000 - ((unsigned) TICK_SIZE) / 2 | ||
134 | && xtime.tv_nsec <= 500000 + ((unsigned) TICK_SIZE) / 2) { | ||
135 | int tmp = set_rtc_mmss(xtime.tv_sec); | ||
136 | state.last_rtc_update = xtime.tv_sec - (tmp ? 600 : 0); | ||
137 | } | ||
138 | |||
139 | write_sequnlock(&xtime_lock); | 170 | write_sequnlock(&xtime_lock); |
140 | 171 | ||
141 | #ifndef CONFIG_SMP | 172 | #ifndef CONFIG_SMP |
@@ -304,7 +335,7 @@ rpcc_after_update_in_progress(void) | |||
304 | void __init | 335 | void __init |
305 | time_init(void) | 336 | time_init(void) |
306 | { | 337 | { |
307 | unsigned int year, mon, day, hour, min, sec, cc1, cc2, epoch; | 338 | unsigned int cc1, cc2; |
308 | unsigned long cycle_freq, tolerance; | 339 | unsigned long cycle_freq, tolerance; |
309 | long diff; | 340 | long diff; |
310 | 341 | ||
@@ -348,43 +379,6 @@ time_init(void) | |||
348 | bogomips yet, but this is close on a 500Mhz box. */ | 379 | bogomips yet, but this is close on a 500Mhz box. */ |
349 | __delay(1000000); | 380 | __delay(1000000); |
350 | 381 | ||
351 | sec = CMOS_READ(RTC_SECONDS); | ||
352 | min = CMOS_READ(RTC_MINUTES); | ||
353 | hour = CMOS_READ(RTC_HOURS); | ||
354 | day = CMOS_READ(RTC_DAY_OF_MONTH); | ||
355 | mon = CMOS_READ(RTC_MONTH); | ||
356 | year = CMOS_READ(RTC_YEAR); | ||
357 | |||
358 | if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { | ||
359 | sec = bcd2bin(sec); | ||
360 | min = bcd2bin(min); | ||
361 | hour = bcd2bin(hour); | ||
362 | day = bcd2bin(day); | ||
363 | mon = bcd2bin(mon); | ||
364 | year = bcd2bin(year); | ||
365 | } | ||
366 | |||
367 | /* PC-like is standard; used for year >= 70 */ | ||
368 | epoch = 1900; | ||
369 | if (year < 20) | ||
370 | epoch = 2000; | ||
371 | else if (year >= 20 && year < 48) | ||
372 | /* NT epoch */ | ||
373 | epoch = 1980; | ||
374 | else if (year >= 48 && year < 70) | ||
375 | /* Digital UNIX epoch */ | ||
376 | epoch = 1952; | ||
377 | |||
378 | printk(KERN_INFO "Using epoch = %d\n", epoch); | ||
379 | |||
380 | if ((year += epoch) < 1970) | ||
381 | year += 100; | ||
382 | |||
383 | xtime.tv_sec = mktime(year, mon, day, hour, min, sec); | ||
384 | xtime.tv_nsec = 0; | ||
385 | |||
386 | wall_to_monotonic.tv_sec -= xtime.tv_sec; | ||
387 | wall_to_monotonic.tv_nsec = 0; | ||
388 | 382 | ||
389 | if (HZ > (1<<16)) { | 383 | if (HZ > (1<<16)) { |
390 | extern void __you_loose (void); | 384 | extern void __you_loose (void); |
@@ -394,7 +388,6 @@ time_init(void) | |||
394 | state.last_time = cc1; | 388 | state.last_time = cc1; |
395 | state.scaled_ticks_per_cycle | 389 | state.scaled_ticks_per_cycle |
396 | = ((unsigned long) HZ << FIX_SHIFT) / cycle_freq; | 390 | = ((unsigned long) HZ << FIX_SHIFT) / cycle_freq; |
397 | state.last_rtc_update = 0; | ||
398 | state.partial_tick = 0L; | 391 | state.partial_tick = 0L; |
399 | 392 | ||
400 | /* Startup the timer source. */ | 393 | /* Startup the timer source. */ |
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c index f27aa3b259fa..668ed2817e51 100644 --- a/arch/avr32/kernel/time.c +++ b/arch/avr32/kernel/time.c | |||
@@ -110,17 +110,17 @@ static struct clock_event_device comparator = { | |||
110 | .set_mode = comparator_mode, | 110 | .set_mode = comparator_mode, |
111 | }; | 111 | }; |
112 | 112 | ||
113 | void read_persistent_clock(struct timespec *ts) | ||
114 | { | ||
115 | ts->tv_sec = mktime(2007, 1, 1, 0, 0, 0); | ||
116 | ts->tv_nsec = 0; | ||
117 | } | ||
118 | |||
113 | void __init time_init(void) | 119 | void __init time_init(void) |
114 | { | 120 | { |
115 | unsigned long counter_hz; | 121 | unsigned long counter_hz; |
116 | int ret; | 122 | int ret; |
117 | 123 | ||
118 | xtime.tv_sec = mktime(2007, 1, 1, 0, 0, 0); | ||
119 | xtime.tv_nsec = 0; | ||
120 | |||
121 | set_normalized_timespec(&wall_to_monotonic, | ||
122 | -xtime.tv_sec, -xtime.tv_nsec); | ||
123 | |||
124 | /* figure rate for counter */ | 124 | /* figure rate for counter */ |
125 | counter_hz = clk_get_rate(boot_cpu_data.clk); | 125 | counter_hz = clk_get_rate(boot_cpu_data.clk); |
126 | counter.mult = clocksource_hz2mult(counter_hz, counter.shift); | 126 | counter.mult = clocksource_hz2mult(counter_hz, counter.shift); |
diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c index cb7a01d4f009..8c9a43daf80f 100644 --- a/arch/blackfin/kernel/time-ts.c +++ b/arch/blackfin/kernel/time-ts.c | |||
@@ -353,9 +353,15 @@ void bfin_coretmr_clockevent_init(void) | |||
353 | #endif /* CONFIG_TICKSOURCE_CORETMR */ | 353 | #endif /* CONFIG_TICKSOURCE_CORETMR */ |
354 | 354 | ||
355 | 355 | ||
356 | void __init time_init(void) | 356 | void read_persistent_clock(struct timespec *ts) |
357 | { | 357 | { |
358 | time_t secs_since_1970 = (365 * 37 + 9) * 24 * 60 * 60; /* 1 Jan 2007 */ | 358 | time_t secs_since_1970 = (365 * 37 + 9) * 24 * 60 * 60; /* 1 Jan 2007 */ |
359 | ts->tv_sec = secs_since_1970; | ||
360 | ts->tv_nsec = 0; | ||
361 | } | ||
362 | |||
363 | void __init time_init(void) | ||
364 | { | ||
359 | 365 | ||
360 | #ifdef CONFIG_RTC_DRV_BFIN | 366 | #ifdef CONFIG_RTC_DRV_BFIN |
361 | /* [#2663] hack to filter junk RTC values that would cause | 367 | /* [#2663] hack to filter junk RTC values that would cause |
@@ -368,11 +374,6 @@ void __init time_init(void) | |||
368 | } | 374 | } |
369 | #endif | 375 | #endif |
370 | 376 | ||
371 | /* Initialize xtime. From now on, xtime is updated with timer interrupts */ | ||
372 | xtime.tv_sec = secs_since_1970; | ||
373 | xtime.tv_nsec = 0; | ||
374 | set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); | ||
375 | |||
376 | bfin_cs_cycles_init(); | 377 | bfin_cs_cycles_init(); |
377 | bfin_cs_gptimer0_init(); | 378 | bfin_cs_gptimer0_init(); |
378 | 379 | ||
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c index 13c1ee3e6408..c9113619029f 100644 --- a/arch/blackfin/kernel/time.c +++ b/arch/blackfin/kernel/time.c | |||
@@ -112,11 +112,6 @@ u32 arch_gettimeoffset(void) | |||
112 | } | 112 | } |
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | static inline int set_rtc_mmss(unsigned long nowtime) | ||
116 | { | ||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | /* | 115 | /* |
121 | * timer_interrupt() needs to keep up the real-time clock, | 116 | * timer_interrupt() needs to keep up the real-time clock, |
122 | * as well as call the "do_timer()" routine every clocktick | 117 | * as well as call the "do_timer()" routine every clocktick |
@@ -126,29 +121,8 @@ __attribute__((l1_text)) | |||
126 | #endif | 121 | #endif |
127 | irqreturn_t timer_interrupt(int irq, void *dummy) | 122 | irqreturn_t timer_interrupt(int irq, void *dummy) |
128 | { | 123 | { |
129 | /* last time the cmos clock got updated */ | ||
130 | static long last_rtc_update; | ||
131 | |||
132 | write_seqlock(&xtime_lock); | 124 | write_seqlock(&xtime_lock); |
133 | do_timer(1); | 125 | do_timer(1); |
134 | |||
135 | /* | ||
136 | * If we have an externally synchronized Linux clock, then update | ||
137 | * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | ||
138 | * called as close as possible to 500 ms before the new second starts. | ||
139 | */ | ||
140 | if (ntp_synced() && | ||
141 | xtime.tv_sec > last_rtc_update + 660 && | ||
142 | (xtime.tv_nsec / NSEC_PER_USEC) >= | ||
143 | 500000 - ((unsigned)TICK_SIZE) / 2 | ||
144 | && (xtime.tv_nsec / NSEC_PER_USEC) <= | ||
145 | 500000 + ((unsigned)TICK_SIZE) / 2) { | ||
146 | if (set_rtc_mmss(xtime.tv_sec) == 0) | ||
147 | last_rtc_update = xtime.tv_sec; | ||
148 | else | ||
149 | /* Do it again in 60s. */ | ||
150 | last_rtc_update = xtime.tv_sec - 600; | ||
151 | } | ||
152 | write_sequnlock(&xtime_lock); | 126 | write_sequnlock(&xtime_lock); |
153 | 127 | ||
154 | #ifdef CONFIG_IPIPE | 128 | #ifdef CONFIG_IPIPE |
@@ -161,10 +135,15 @@ irqreturn_t timer_interrupt(int irq, void *dummy) | |||
161 | return IRQ_HANDLED; | 135 | return IRQ_HANDLED; |
162 | } | 136 | } |
163 | 137 | ||
164 | void __init time_init(void) | 138 | void read_persistent_clock(struct timespec *ts) |
165 | { | 139 | { |
166 | time_t secs_since_1970 = (365 * 37 + 9) * 24 * 60 * 60; /* 1 Jan 2007 */ | 140 | time_t secs_since_1970 = (365 * 37 + 9) * 24 * 60 * 60; /* 1 Jan 2007 */ |
141 | ts->tv_sec = secs_since_1970; | ||
142 | ts->tv_nsec = 0; | ||
143 | } | ||
167 | 144 | ||
145 | void __init time_init(void) | ||
146 | { | ||
168 | #ifdef CONFIG_RTC_DRV_BFIN | 147 | #ifdef CONFIG_RTC_DRV_BFIN |
169 | /* [#2663] hack to filter junk RTC values that would cause | 148 | /* [#2663] hack to filter junk RTC values that would cause |
170 | * userspace to have to deal with time values greater than | 149 | * userspace to have to deal with time values greater than |
@@ -176,11 +155,5 @@ void __init time_init(void) | |||
176 | } | 155 | } |
177 | #endif | 156 | #endif |
178 | 157 | ||
179 | /* Initialize xtime. From now on, xtime is updated with timer interrupts */ | ||
180 | xtime.tv_sec = secs_since_1970; | ||
181 | xtime.tv_nsec = 0; | ||
182 | |||
183 | wall_to_monotonic.tv_sec = -xtime.tv_sec; | ||
184 | |||
185 | time_sched_init(timer_interrupt); | 158 | time_sched_init(timer_interrupt); |
186 | } | 159 | } |
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index 059eac6abda1..e25bf4440b51 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig | |||
@@ -23,6 +23,9 @@ config RWSEM_XCHGADD_ALGORITHM | |||
23 | config GENERIC_TIME | 23 | config GENERIC_TIME |
24 | def_bool y | 24 | def_bool y |
25 | 25 | ||
26 | config GENERIC_CMOS_UPDATE | ||
27 | def_bool y | ||
28 | |||
26 | config ARCH_USES_GETTIMEOFFSET | 29 | config ARCH_USES_GETTIMEOFFSET |
27 | def_bool y | 30 | def_bool y |
28 | 31 | ||
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c index 31ca1418d5a7..30adae594aef 100644 --- a/arch/cris/arch-v10/kernel/time.c +++ b/arch/cris/arch-v10/kernel/time.c | |||
@@ -26,7 +26,6 @@ | |||
26 | /* it will make jiffies at 96 hz instead of 100 hz though */ | 26 | /* it will make jiffies at 96 hz instead of 100 hz though */ |
27 | #undef USE_CASCADE_TIMERS | 27 | #undef USE_CASCADE_TIMERS |
28 | 28 | ||
29 | extern void update_xtime_from_cmos(void); | ||
30 | extern int set_rtc_mmss(unsigned long nowtime); | 29 | extern int set_rtc_mmss(unsigned long nowtime); |
31 | extern int have_rtc; | 30 | extern int have_rtc; |
32 | 31 | ||
@@ -188,8 +187,6 @@ stop_watchdog(void) | |||
188 | #endif | 187 | #endif |
189 | } | 188 | } |
190 | 189 | ||
191 | /* last time the cmos clock got updated */ | ||
192 | static long last_rtc_update = 0; | ||
193 | 190 | ||
194 | /* | 191 | /* |
195 | * timer_interrupt() needs to keep up the real-time clock, | 192 | * timer_interrupt() needs to keep up the real-time clock, |
@@ -232,24 +229,6 @@ timer_interrupt(int irq, void *dev_id) | |||
232 | do_timer(1); | 229 | do_timer(1); |
233 | 230 | ||
234 | cris_do_profile(regs); /* Save profiling information */ | 231 | cris_do_profile(regs); /* Save profiling information */ |
235 | |||
236 | /* | ||
237 | * If we have an externally synchronized Linux clock, then update | ||
238 | * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | ||
239 | * called as close as possible to 500 ms before the new second starts. | ||
240 | * | ||
241 | * The division here is not time critical since it will run once in | ||
242 | * 11 minutes | ||
243 | */ | ||
244 | if (ntp_synced() && | ||
245 | xtime.tv_sec > last_rtc_update + 660 && | ||
246 | (xtime.tv_nsec / 1000) >= 500000 - (tick_nsec / 1000) / 2 && | ||
247 | (xtime.tv_nsec / 1000) <= 500000 + (tick_nsec / 1000) / 2) { | ||
248 | if (set_rtc_mmss(xtime.tv_sec) == 0) | ||
249 | last_rtc_update = xtime.tv_sec; | ||
250 | else | ||
251 | last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ | ||
252 | } | ||
253 | return IRQ_HANDLED; | 232 | return IRQ_HANDLED; |
254 | } | 233 | } |
255 | 234 | ||
@@ -274,22 +253,10 @@ time_init(void) | |||
274 | */ | 253 | */ |
275 | loops_per_usec = 50; | 254 | loops_per_usec = 50; |
276 | 255 | ||
277 | if(RTC_INIT() < 0) { | 256 | if(RTC_INIT() < 0) |
278 | /* no RTC, start at 1980 */ | ||
279 | xtime.tv_sec = 0; | ||
280 | xtime.tv_nsec = 0; | ||
281 | have_rtc = 0; | 257 | have_rtc = 0; |
282 | } else { | 258 | else |
283 | /* get the current time */ | ||
284 | have_rtc = 1; | 259 | have_rtc = 1; |
285 | update_xtime_from_cmos(); | ||
286 | } | ||
287 | |||
288 | /* | ||
289 | * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the | ||
290 | * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC). | ||
291 | */ | ||
292 | set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); | ||
293 | 260 | ||
294 | /* Setup the etrax timers | 261 | /* Setup the etrax timers |
295 | * Base frequency is 25000 hz, divider 250 -> 100 HZ | 262 | * Base frequency is 25000 hz, divider 250 -> 100 HZ |
diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c index b1920d8de403..1ee0e1010228 100644 --- a/arch/cris/arch-v32/kernel/time.c +++ b/arch/cris/arch-v32/kernel/time.c | |||
@@ -44,7 +44,6 @@ unsigned long timer_regs[NR_CPUS] = | |||
44 | #endif | 44 | #endif |
45 | }; | 45 | }; |
46 | 46 | ||
47 | extern void update_xtime_from_cmos(void); | ||
48 | extern int set_rtc_mmss(unsigned long nowtime); | 47 | extern int set_rtc_mmss(unsigned long nowtime); |
49 | extern int have_rtc; | 48 | extern int have_rtc; |
50 | 49 | ||
@@ -198,9 +197,6 @@ handle_watchdog_bite(struct pt_regs* regs) | |||
198 | #endif | 197 | #endif |
199 | } | 198 | } |
200 | 199 | ||
201 | /* Last time the cmos clock got updated. */ | ||
202 | static long last_rtc_update = 0; | ||
203 | |||
204 | /* | 200 | /* |
205 | * timer_interrupt() needs to keep up the real-time clock, | 201 | * timer_interrupt() needs to keep up the real-time clock, |
206 | * as well as call the "do_timer()" routine every clocktick. | 202 | * as well as call the "do_timer()" routine every clocktick. |
@@ -238,25 +234,6 @@ timer_interrupt(int irq, void *dev_id) | |||
238 | 234 | ||
239 | /* Call the real timer interrupt handler */ | 235 | /* Call the real timer interrupt handler */ |
240 | do_timer(1); | 236 | do_timer(1); |
241 | |||
242 | /* | ||
243 | * If we have an externally synchronized Linux clock, then update | ||
244 | * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | ||
245 | * called as close as possible to 500 ms before the new second starts. | ||
246 | * | ||
247 | * The division here is not time critical since it will run once in | ||
248 | * 11 minutes | ||
249 | */ | ||
250 | if ((time_status & STA_UNSYNC) == 0 && | ||
251 | xtime.tv_sec > last_rtc_update + 660 && | ||
252 | (xtime.tv_nsec / 1000) >= 500000 - (tick_nsec / 1000) / 2 && | ||
253 | (xtime.tv_nsec / 1000) <= 500000 + (tick_nsec / 1000) / 2) { | ||
254 | if (set_rtc_mmss(xtime.tv_sec) == 0) | ||
255 | last_rtc_update = xtime.tv_sec; | ||
256 | else | ||
257 | /* Do it again in 60 s */ | ||
258 | last_rtc_update = xtime.tv_sec - 600; | ||
259 | } | ||
260 | return IRQ_HANDLED; | 237 | return IRQ_HANDLED; |
261 | } | 238 | } |
262 | 239 | ||
@@ -309,23 +286,10 @@ time_init(void) | |||
309 | */ | 286 | */ |
310 | loops_per_usec = 50; | 287 | loops_per_usec = 50; |
311 | 288 | ||
312 | if(RTC_INIT() < 0) { | 289 | if(RTC_INIT() < 0) |
313 | /* No RTC, start at 1980 */ | ||
314 | xtime.tv_sec = 0; | ||
315 | xtime.tv_nsec = 0; | ||
316 | have_rtc = 0; | 290 | have_rtc = 0; |
317 | } else { | 291 | else |
318 | /* Get the current time */ | ||
319 | have_rtc = 1; | 292 | have_rtc = 1; |
320 | update_xtime_from_cmos(); | ||
321 | } | ||
322 | |||
323 | /* | ||
324 | * Initialize wall_to_monotonic such that adding it to | ||
325 | * xtime will yield zero, the tv_nsec field must be normalized | ||
326 | * (i.e., 0 <= nsec < NSEC_PER_SEC). | ||
327 | */ | ||
328 | set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); | ||
329 | 293 | ||
330 | /* Start CPU local timer. */ | 294 | /* Start CPU local timer. */ |
331 | cris_timer_init(); | 295 | cris_timer_init(); |
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c index a05dd31f3efb..c72730d20ef6 100644 --- a/arch/cris/kernel/time.c +++ b/arch/cris/kernel/time.c | |||
@@ -98,6 +98,8 @@ unsigned long | |||
98 | get_cmos_time(void) | 98 | get_cmos_time(void) |
99 | { | 99 | { |
100 | unsigned int year, mon, day, hour, min, sec; | 100 | unsigned int year, mon, day, hour, min, sec; |
101 | if(!have_rtc) | ||
102 | return 0; | ||
101 | 103 | ||
102 | sec = CMOS_READ(RTC_SECONDS); | 104 | sec = CMOS_READ(RTC_SECONDS); |
103 | min = CMOS_READ(RTC_MINUTES); | 105 | min = CMOS_READ(RTC_MINUTES); |
@@ -119,19 +121,19 @@ get_cmos_time(void) | |||
119 | return mktime(year, mon, day, hour, min, sec); | 121 | return mktime(year, mon, day, hour, min, sec); |
120 | } | 122 | } |
121 | 123 | ||
122 | /* update xtime from the CMOS settings. used when /dev/rtc gets a SET_TIME. | ||
123 | * TODO: this doesn't reset the fancy NTP phase stuff as do_settimeofday does. | ||
124 | */ | ||
125 | 124 | ||
126 | void | 125 | int update_persistent_clock(struct timespec now) |
127 | update_xtime_from_cmos(void) | ||
128 | { | 126 | { |
129 | if(have_rtc) { | 127 | return set_rtc_mmss(now.tv_sec); |
130 | xtime.tv_sec = get_cmos_time(); | ||
131 | xtime.tv_nsec = 0; | ||
132 | } | ||
133 | } | 128 | } |
134 | 129 | ||
130 | void read_persistent_clock(struct timespec *ts) | ||
131 | { | ||
132 | ts->tv_sec = get_cmos_time(); | ||
133 | ts->tv_nsec = 0; | ||
134 | } | ||
135 | |||
136 | |||
135 | extern void cris_profile_sample(struct pt_regs* regs); | 137 | extern void cris_profile_sample(struct pt_regs* regs); |
136 | 138 | ||
137 | void | 139 | void |
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c index fb0ce7577225..0ddbbae83cb2 100644 --- a/arch/frv/kernel/time.c +++ b/arch/frv/kernel/time.c | |||
@@ -48,20 +48,12 @@ static struct irqaction timer_irq = { | |||
48 | .name = "timer", | 48 | .name = "timer", |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static inline int set_rtc_mmss(unsigned long nowtime) | ||
52 | { | ||
53 | return -1; | ||
54 | } | ||
55 | |||
56 | /* | 51 | /* |
57 | * timer_interrupt() needs to keep up the real-time clock, | 52 | * timer_interrupt() needs to keep up the real-time clock, |
58 | * as well as call the "do_timer()" routine every clocktick | 53 | * as well as call the "do_timer()" routine every clocktick |
59 | */ | 54 | */ |
60 | static irqreturn_t timer_interrupt(int irq, void *dummy) | 55 | static irqreturn_t timer_interrupt(int irq, void *dummy) |
61 | { | 56 | { |
62 | /* last time the cmos clock got updated */ | ||
63 | static long last_rtc_update = 0; | ||
64 | |||
65 | profile_tick(CPU_PROFILING); | 57 | profile_tick(CPU_PROFILING); |
66 | /* | 58 | /* |
67 | * Here we are in the timer irq handler. We just have irqs locally | 59 | * Here we are in the timer irq handler. We just have irqs locally |
@@ -74,22 +66,6 @@ static irqreturn_t timer_interrupt(int irq, void *dummy) | |||
74 | 66 | ||
75 | do_timer(1); | 67 | do_timer(1); |
76 | 68 | ||
77 | /* | ||
78 | * If we have an externally synchronized Linux clock, then update | ||
79 | * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | ||
80 | * called as close as possible to 500 ms before the new second starts. | ||
81 | */ | ||
82 | if (ntp_synced() && | ||
83 | xtime.tv_sec > last_rtc_update + 660 && | ||
84 | (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && | ||
85 | (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2 | ||
86 | ) { | ||
87 | if (set_rtc_mmss(xtime.tv_sec) == 0) | ||
88 | last_rtc_update = xtime.tv_sec; | ||
89 | else | ||
90 | last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ | ||
91 | } | ||
92 | |||
93 | #ifdef CONFIG_HEARTBEAT | 69 | #ifdef CONFIG_HEARTBEAT |
94 | static unsigned short n; | 70 | static unsigned short n; |
95 | n++; | 71 | n++; |
@@ -119,7 +95,8 @@ void time_divisor_init(void) | |||
119 | __set_TCSR_DATA(0, base >> 8); | 95 | __set_TCSR_DATA(0, base >> 8); |
120 | } | 96 | } |
121 | 97 | ||
122 | void time_init(void) | 98 | |
99 | void read_persistent_clock(struct timespec *ts) | ||
123 | { | 100 | { |
124 | unsigned int year, mon, day, hour, min, sec; | 101 | unsigned int year, mon, day, hour, min, sec; |
125 | 102 | ||
@@ -135,9 +112,12 @@ void time_init(void) | |||
135 | 112 | ||
136 | if ((year += 1900) < 1970) | 113 | if ((year += 1900) < 1970) |
137 | year += 100; | 114 | year += 100; |
138 | xtime.tv_sec = mktime(year, mon, day, hour, min, sec); | 115 | ts->tv_sec = mktime(year, mon, day, hour, min, sec); |
139 | xtime.tv_nsec = 0; | 116 | ts->tv_nsec = 0; |
117 | } | ||
140 | 118 | ||
119 | void time_init(void) | ||
120 | { | ||
141 | /* install scheduling interrupt handler */ | 121 | /* install scheduling interrupt handler */ |
142 | setup_irq(IRQ_CPU_TIMER0, &timer_irq); | 122 | setup_irq(IRQ_CPU_TIMER0, &timer_irq); |
143 | 123 | ||
diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c index 7f2d6cfbb4b6..165005aff9df 100644 --- a/arch/h8300/kernel/time.c +++ b/arch/h8300/kernel/time.c | |||
@@ -41,7 +41,7 @@ void h8300_timer_tick(void) | |||
41 | update_process_times(user_mode(get_irq_regs())); | 41 | update_process_times(user_mode(get_irq_regs())); |
42 | } | 42 | } |
43 | 43 | ||
44 | void __init time_init(void) | 44 | void read_persistent_clock(struct timespec *ts) |
45 | { | 45 | { |
46 | unsigned int year, mon, day, hour, min, sec; | 46 | unsigned int year, mon, day, hour, min, sec; |
47 | 47 | ||
@@ -56,8 +56,12 @@ void __init time_init(void) | |||
56 | #endif | 56 | #endif |
57 | if ((year += 1900) < 1970) | 57 | if ((year += 1900) < 1970) |
58 | year += 100; | 58 | year += 100; |
59 | xtime.tv_sec = mktime(year, mon, day, hour, min, sec); | 59 | ts->tv_sec = mktime(year, mon, day, hour, min, sec); |
60 | xtime.tv_nsec = 0; | 60 | ts->tv_nsec = 0; |
61 | } | ||
62 | |||
63 | void __init time_init(void) | ||
64 | { | ||
61 | 65 | ||
62 | h8300_timer_setup(); | 66 | h8300_timer_setup(); |
63 | } | 67 | } |
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index 47a192781b0a..653b3c46ea82 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c | |||
@@ -430,18 +430,16 @@ static int __init rtc_init(void) | |||
430 | } | 430 | } |
431 | module_init(rtc_init); | 431 | module_init(rtc_init); |
432 | 432 | ||
433 | void read_persistent_clock(struct timespec *ts) | ||
434 | { | ||
435 | efi_gettimeofday(ts); | ||
436 | } | ||
437 | |||
433 | void __init | 438 | void __init |
434 | time_init (void) | 439 | time_init (void) |
435 | { | 440 | { |
436 | register_percpu_irq(IA64_TIMER_VECTOR, &timer_irqaction); | 441 | register_percpu_irq(IA64_TIMER_VECTOR, &timer_irqaction); |
437 | efi_gettimeofday(&xtime); | ||
438 | ia64_init_itm(); | 442 | ia64_init_itm(); |
439 | |||
440 | /* | ||
441 | * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the | ||
442 | * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC). | ||
443 | */ | ||
444 | set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); | ||
445 | } | 443 | } |
446 | 444 | ||
447 | /* | 445 | /* |
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c index 9cedcef11575..bda86820bffd 100644 --- a/arch/m32r/kernel/time.c +++ b/arch/m32r/kernel/time.c | |||
@@ -106,24 +106,6 @@ u32 arch_gettimeoffset(void) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | /* | 108 | /* |
109 | * In order to set the CMOS clock precisely, set_rtc_mmss has to be | ||
110 | * called 500 ms after the second nowtime has started, because when | ||
111 | * nowtime is written into the registers of the CMOS clock, it will | ||
112 | * jump to the next second precisely 500 ms later. Check the Motorola | ||
113 | * MC146818A or Dallas DS12887 data sheet for details. | ||
114 | * | ||
115 | * BUG: This routine does not handle hour overflow properly; it just | ||
116 | * sets the minutes. Usually you won't notice until after reboot! | ||
117 | */ | ||
118 | static inline int set_rtc_mmss(unsigned long nowtime) | ||
119 | { | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | /* last time the cmos clock got updated */ | ||
124 | static long last_rtc_update = 0; | ||
125 | |||
126 | /* | ||
127 | * timer_interrupt() needs to keep up the real-time clock, | 109 | * timer_interrupt() needs to keep up the real-time clock, |
128 | * as well as call the "do_timer()" routine every clocktick | 110 | * as well as call the "do_timer()" routine every clocktick |
129 | */ | 111 | */ |
@@ -138,23 +120,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id) | |||
138 | #ifndef CONFIG_SMP | 120 | #ifndef CONFIG_SMP |
139 | update_process_times(user_mode(get_irq_regs())); | 121 | update_process_times(user_mode(get_irq_regs())); |
140 | #endif | 122 | #endif |
141 | /* | ||
142 | * If we have an externally synchronized Linux clock, then update | ||
143 | * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | ||
144 | * called as close as possible to 500 ms before the new second starts. | ||
145 | */ | ||
146 | write_seqlock(&xtime_lock); | ||
147 | if (ntp_synced() | ||
148 | && xtime.tv_sec > last_rtc_update + 660 | ||
149 | && (xtime.tv_nsec / 1000) >= 500000 - ((unsigned)TICK_SIZE) / 2 | ||
150 | && (xtime.tv_nsec / 1000) <= 500000 + ((unsigned)TICK_SIZE) / 2) | ||
151 | { | ||
152 | if (set_rtc_mmss(xtime.tv_sec) == 0) | ||
153 | last_rtc_update = xtime.tv_sec; | ||
154 | else /* do it again in 60 s */ | ||
155 | last_rtc_update = xtime.tv_sec - 600; | ||
156 | } | ||
157 | write_sequnlock(&xtime_lock); | ||
158 | /* As we return to user mode fire off the other CPU schedulers.. | 123 | /* As we return to user mode fire off the other CPU schedulers.. |
159 | this is basically because we don't yet share IRQ's around. | 124 | this is basically because we don't yet share IRQ's around. |
160 | This message is rigged to be safe on the 386 - basically it's | 125 | This message is rigged to be safe on the 386 - basically it's |
@@ -174,7 +139,7 @@ static struct irqaction irq0 = { | |||
174 | .name = "MFT2", | 139 | .name = "MFT2", |
175 | }; | 140 | }; |
176 | 141 | ||
177 | void __init time_init(void) | 142 | void read_persistent_clock(struct timespec *ts) |
178 | { | 143 | { |
179 | unsigned int epoch, year, mon, day, hour, min, sec; | 144 | unsigned int epoch, year, mon, day, hour, min, sec; |
180 | 145 | ||
@@ -194,11 +159,13 @@ void __init time_init(void) | |||
194 | epoch = 1952; | 159 | epoch = 1952; |
195 | year += epoch; | 160 | year += epoch; |
196 | 161 | ||
197 | xtime.tv_sec = mktime(year, mon, day, hour, min, sec); | 162 | ts->tv_sec = mktime(year, mon, day, hour, min, sec); |
198 | xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); | 163 | ts->tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); |
199 | set_normalized_timespec(&wall_to_monotonic, | 164 | } |
200 | -xtime.tv_sec, -xtime.tv_nsec); | ||
201 | 165 | ||
166 | |||
167 | void __init time_init(void) | ||
168 | { | ||
202 | #if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \ | 169 | #if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \ |
203 | || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \ | 170 | || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \ |
204 | || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104) | 171 | || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104) |
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c index 17dc2a31a7ca..4926b3856c15 100644 --- a/arch/m68k/kernel/time.c +++ b/arch/m68k/kernel/time.c | |||
@@ -73,21 +73,24 @@ static irqreturn_t timer_interrupt(int irq, void *dummy) | |||
73 | return IRQ_HANDLED; | 73 | return IRQ_HANDLED; |
74 | } | 74 | } |
75 | 75 | ||
76 | void __init time_init(void) | 76 | void read_persistent_clock(struct timespec *ts) |
77 | { | 77 | { |
78 | struct rtc_time time; | 78 | struct rtc_time time; |
79 | ts->tv_sec = 0; | ||
80 | ts->tv_nsec = 0; | ||
79 | 81 | ||
80 | if (mach_hwclk) { | 82 | if (mach_hwclk) { |
81 | mach_hwclk(0, &time); | 83 | mach_hwclk(0, &time); |
82 | 84 | ||
83 | if ((time.tm_year += 1900) < 1970) | 85 | if ((time.tm_year += 1900) < 1970) |
84 | time.tm_year += 100; | 86 | time.tm_year += 100; |
85 | xtime.tv_sec = mktime(time.tm_year, time.tm_mon, time.tm_mday, | 87 | ts->tv_sec = mktime(time.tm_year, time.tm_mon, time.tm_mday, |
86 | time.tm_hour, time.tm_min, time.tm_sec); | 88 | time.tm_hour, time.tm_min, time.tm_sec); |
87 | xtime.tv_nsec = 0; | ||
88 | } | 89 | } |
89 | wall_to_monotonic.tv_sec = -xtime.tv_sec; | 90 | } |
90 | 91 | ||
92 | void __init time_init(void) | ||
93 | { | ||
91 | mach_sched_init(timer_interrupt); | 94 | mach_sched_init(timer_interrupt); |
92 | } | 95 | } |
93 | 96 | ||
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index 89faacad5d17..1c4565a9102b 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig | |||
@@ -37,6 +37,9 @@ config GENERIC_HARDIRQS_NO__DO_IRQ | |||
37 | config GENERIC_CALIBRATE_DELAY | 37 | config GENERIC_CALIBRATE_DELAY |
38 | def_bool y | 38 | def_bool y |
39 | 39 | ||
40 | config GENERIC_CMOS_UPDATE | ||
41 | def_bool y | ||
42 | |||
40 | config GENERIC_FIND_NEXT_BIT | 43 | config GENERIC_FIND_NEXT_BIT |
41 | def_bool y | 44 | def_bool y |
42 | 45 | ||
diff --git a/arch/mn10300/kernel/rtc.c b/arch/mn10300/kernel/rtc.c index 7978470b5749..815a933aafa8 100644 --- a/arch/mn10300/kernel/rtc.c +++ b/arch/mn10300/kernel/rtc.c | |||
@@ -26,17 +26,15 @@ static long last_rtc_update; | |||
26 | /* time for RTC to update itself in ioclks */ | 26 | /* time for RTC to update itself in ioclks */ |
27 | static unsigned long mn10300_rtc_update_period; | 27 | static unsigned long mn10300_rtc_update_period; |
28 | 28 | ||
29 | /* | 29 | void read_persistent_clock(struct timespec *ts) |
30 | * read the current RTC time | ||
31 | */ | ||
32 | unsigned long __init get_initial_rtc_time(void) | ||
33 | { | 30 | { |
34 | struct rtc_time tm; | 31 | struct rtc_time tm; |
35 | 32 | ||
36 | get_rtc_time(&tm); | 33 | get_rtc_time(&tm); |
37 | 34 | ||
38 | return mktime(tm.tm_year, tm.tm_mon, tm.tm_mday, | 35 | ts->tv_sec = mktime(tm.tm_year, tm.tm_mon, tm.tm_mday, |
39 | tm.tm_hour, tm.tm_min, tm.tm_sec); | 36 | tm.tm_hour, tm.tm_min, tm.tm_sec); |
37 | ts->tv_nsec = 0; | ||
40 | } | 38 | } |
41 | 39 | ||
42 | /* | 40 | /* |
@@ -110,24 +108,9 @@ static int set_rtc_mmss(unsigned long nowtime) | |||
110 | return retval; | 108 | return retval; |
111 | } | 109 | } |
112 | 110 | ||
113 | void check_rtc_time(void) | 111 | int update_persistent_clock(struct timespec now) |
114 | { | 112 | { |
115 | /* the RTC clock just finished ticking over again this second | 113 | return set_rtc_mms(now.tv_sec); |
116 | * - if we have an externally synchronized Linux clock, then update | ||
117 | * RTC clock accordingly every ~11 minutes. set_rtc_mmss() has to be | ||
118 | * called as close as possible to 500 ms before the new second starts. | ||
119 | */ | ||
120 | if ((time_status & STA_UNSYNC) == 0 && | ||
121 | xtime.tv_sec > last_rtc_update + 660 && | ||
122 | xtime.tv_nsec / 1000 >= 500000 - ((unsigned) TICK_SIZE) / 2 && | ||
123 | xtime.tv_nsec / 1000 <= 500000 + ((unsigned) TICK_SIZE) / 2 | ||
124 | ) { | ||
125 | if (set_rtc_mmss(xtime.tv_sec) == 0) | ||
126 | last_rtc_update = xtime.tv_sec; | ||
127 | else | ||
128 | /* do it again in 60s */ | ||
129 | last_rtc_update = xtime.tv_sec - 600; | ||
130 | } | ||
131 | } | 114 | } |
132 | 115 | ||
133 | /* | 116 | /* |
diff --git a/arch/mn10300/kernel/time.c b/arch/mn10300/kernel/time.c index 395caf01b909..8f7f6d22783d 100644 --- a/arch/mn10300/kernel/time.c +++ b/arch/mn10300/kernel/time.c | |||
@@ -111,7 +111,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id) | |||
111 | /* advance the kernel's time tracking system */ | 111 | /* advance the kernel's time tracking system */ |
112 | profile_tick(CPU_PROFILING); | 112 | profile_tick(CPU_PROFILING); |
113 | do_timer(1); | 113 | do_timer(1); |
114 | check_rtc_time(); | ||
115 | } | 114 | } |
116 | 115 | ||
117 | write_sequnlock(&xtime_lock); | 116 | write_sequnlock(&xtime_lock); |
@@ -139,9 +138,6 @@ void __init time_init(void) | |||
139 | " (calibrated against RTC)\n", | 138 | " (calibrated against RTC)\n", |
140 | MN10300_TSCCLK / 1000000, (MN10300_TSCCLK / 10000) % 100); | 139 | MN10300_TSCCLK / 1000000, (MN10300_TSCCLK / 10000) % 100); |
141 | 140 | ||
142 | xtime.tv_sec = get_initial_rtc_time(); | ||
143 | xtime.tv_nsec = 0; | ||
144 | |||
145 | mn10300_last_tsc = TMTSCBC; | 141 | mn10300_last_tsc = TMTSCBC; |
146 | 142 | ||
147 | /* use timer 0 & 1 cascaded to tick at as close to HZ as possible */ | 143 | /* use timer 0 & 1 cascaded to tick at as close to HZ as possible */ |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 9908d477ccd9..d6781ce687e2 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -75,7 +75,7 @@ config ARCH_USES_GETTIMEOFFSET | |||
75 | 75 | ||
76 | config GENERIC_CMOS_UPDATE | 76 | config GENERIC_CMOS_UPDATE |
77 | bool | 77 | bool |
78 | default y if SPARC64 | 78 | default y |
79 | 79 | ||
80 | config GENERIC_CLOCKEVENTS | 80 | config GENERIC_CLOCKEVENTS |
81 | bool | 81 | bool |
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c index 0d4c09b15efc..4453003032b5 100644 --- a/arch/sparc/kernel/time_32.c +++ b/arch/sparc/kernel/time_32.c | |||
@@ -78,6 +78,11 @@ __volatile__ unsigned int *master_l10_counter; | |||
78 | 78 | ||
79 | u32 (*do_arch_gettimeoffset)(void); | 79 | u32 (*do_arch_gettimeoffset)(void); |
80 | 80 | ||
81 | int update_persistent_clock(struct timespec now) | ||
82 | { | ||
83 | return set_rtc_mmss(now.tv_sec); | ||
84 | } | ||
85 | |||
81 | /* | 86 | /* |
82 | * timer_interrupt() needs to keep up the real-time clock, | 87 | * timer_interrupt() needs to keep up the real-time clock, |
83 | * as well as call the "do_timer()" routine every clocktick | 88 | * as well as call the "do_timer()" routine every clocktick |
@@ -87,9 +92,6 @@ u32 (*do_arch_gettimeoffset)(void); | |||
87 | 92 | ||
88 | static irqreturn_t timer_interrupt(int dummy, void *dev_id) | 93 | static irqreturn_t timer_interrupt(int dummy, void *dev_id) |
89 | { | 94 | { |
90 | /* last time the cmos clock got updated */ | ||
91 | static long last_rtc_update; | ||
92 | |||
93 | #ifndef CONFIG_SMP | 95 | #ifndef CONFIG_SMP |
94 | profile_tick(CPU_PROFILING); | 96 | profile_tick(CPU_PROFILING); |
95 | #endif | 97 | #endif |
@@ -101,16 +103,6 @@ static irqreturn_t timer_interrupt(int dummy, void *dev_id) | |||
101 | 103 | ||
102 | do_timer(1); | 104 | do_timer(1); |
103 | 105 | ||
104 | /* Determine when to update the Mostek clock. */ | ||
105 | if (ntp_synced() && | ||
106 | xtime.tv_sec > last_rtc_update + 660 && | ||
107 | (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && | ||
108 | (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { | ||
109 | if (set_rtc_mmss(xtime.tv_sec) == 0) | ||
110 | last_rtc_update = xtime.tv_sec; | ||
111 | else | ||
112 | last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ | ||
113 | } | ||
114 | write_sequnlock(&xtime_lock); | 106 | write_sequnlock(&xtime_lock); |
115 | 107 | ||
116 | #ifndef CONFIG_SMP | 108 | #ifndef CONFIG_SMP |
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 32764b8880b5..b3c6c59ed302 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c | |||
@@ -476,6 +476,7 @@ void xen_timer_resume(void) | |||
476 | __init void xen_time_init(void) | 476 | __init void xen_time_init(void) |
477 | { | 477 | { |
478 | int cpu = smp_processor_id(); | 478 | int cpu = smp_processor_id(); |
479 | struct timespec tp; | ||
479 | 480 | ||
480 | clocksource_register(&xen_clocksource); | 481 | clocksource_register(&xen_clocksource); |
481 | 482 | ||
@@ -487,9 +488,8 @@ __init void xen_time_init(void) | |||
487 | } | 488 | } |
488 | 489 | ||
489 | /* Set initial system time with full resolution */ | 490 | /* Set initial system time with full resolution */ |
490 | xen_read_wallclock(&xtime); | 491 | xen_read_wallclock(&tp); |
491 | set_normalized_timespec(&wall_to_monotonic, | 492 | do_settimeofday(&tp); |
492 | -xtime.tv_sec, -xtime.tv_nsec); | ||
493 | 493 | ||
494 | setup_force_cpu_cap(X86_FEATURE_TSC); | 494 | setup_force_cpu_cap(X86_FEATURE_TSC); |
495 | 495 | ||
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index 19f7df30937f..19df764f6399 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c | |||
@@ -60,11 +60,6 @@ static struct irqaction timer_irqaction = { | |||
60 | 60 | ||
61 | void __init time_init(void) | 61 | void __init time_init(void) |
62 | { | 62 | { |
63 | /* FIXME: xtime&wall_to_monotonic are set in timekeeping_init. */ | ||
64 | read_persistent_clock(&xtime); | ||
65 | set_normalized_timespec(&wall_to_monotonic, | ||
66 | -xtime.tv_sec, -xtime.tv_nsec); | ||
67 | |||
68 | #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT | 63 | #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT |
69 | printk("Calibrating CPU frequency "); | 64 | printk("Calibrating CPU frequency "); |
70 | platform_calibrate_ccount(); | 65 | platform_calibrate_ccount(); |