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 /arch/cris | |
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
Diffstat (limited to 'arch/cris')
-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 |
4 files changed, 18 insertions, 82 deletions
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 |