aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v10/kernel/time.c
diff options
context:
space:
mode:
authorJohn Stultz <johnstul@us.ibm.com>2010-03-03 22:57:28 -0500
committerThomas Gleixner <tglx@linutronix.de>2010-03-12 19:14:13 -0500
commit8eff8a5c1d3a1de7a2d173e0effc6cc9bcbb5177 (patch)
tree3dddecd637815a6cd26e717e6af4ce9373086e14 /arch/cris/arch-v10/kernel/time.c
parentffbcad49e79cd82428010b44a87401446ea7f370 (diff)
cris: Convert cris to use read/update_persistent_clock
This patch converts the cris architecture to use the generic read_persistent_clock and update_persistent_clock interfaces, reducing the amount of arch specific code we have to maintain, and allowing for further cleanups in the future. I have not built or tested this patch, so help from arch maintainers would be appreciated. Signed-off-by: John Stultz <johnstul@us.ibm.com> Cc: Mikael Starvik <starvik@axis.com> Cc: Jesper Nilsson <jesper.nilsson@axis.com> Cc: Andrew Morton <akpm@linux-foundation.org> LKML-Reference: <1267675049-12337-14-git-send-email-johnstul@us.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/cris/arch-v10/kernel/time.c')
-rw-r--r--arch/cris/arch-v10/kernel/time.c37
1 files changed, 2 insertions, 35 deletions
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 31ca1418d5a..30adae594ae 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
29extern void update_xtime_from_cmos(void);
30extern int set_rtc_mmss(unsigned long nowtime); 29extern int set_rtc_mmss(unsigned long nowtime);
31extern int have_rtc; 30extern 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 */
192static 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