aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/time.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-08-13 10:26:12 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-10-11 18:46:08 -0400
commitf5ff0a280201c9cbfb6e9eb4bafdb465c2269ed3 (patch)
treeed056a42ec6c7330765fd3ce45c78815c76c2d34 /arch/mips/kernel/time.c
parent4680576edecb640f64936bd9b92add0a56027b61 (diff)
[MIPS] Use generic NTP code for all MIPS platforms
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/time.c')
-rw-r--r--arch/mips/kernel/time.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 9a5596bf8571..628a8ba6da57 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -67,6 +67,10 @@ unsigned long (*rtc_mips_get_time)(void) = null_rtc_get_time;
67int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time; 67int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time;
68int (*rtc_mips_set_mmss)(unsigned long); 68int (*rtc_mips_set_mmss)(unsigned long);
69 69
70int update_persistent_clock(struct timespec now)
71{
72 return rtc_mips_set_mmss(now.tv_sec);
73}
70 74
71/* how many counter cycles in a jiffy */ 75/* how many counter cycles in a jiffy */
72static unsigned long cycles_per_jiffy __read_mostly; 76static unsigned long cycles_per_jiffy __read_mostly;
@@ -125,9 +129,6 @@ static void __init c0_hpt_timer_init(void)
125int (*mips_timer_state)(void); 129int (*mips_timer_state)(void);
126void (*mips_timer_ack)(void); 130void (*mips_timer_ack)(void);
127 131
128/* last time when xtime and rtc are sync'ed up */
129static long last_rtc_update;
130
131/* 132/*
132 * local_timer_interrupt() does profiling and process accounting 133 * local_timer_interrupt() does profiling and process accounting
133 * on a per-CPU basis. 134 * on a per-CPU basis.
@@ -159,23 +160,6 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
159 */ 160 */
160 do_timer(1); 161 do_timer(1);
161 162
162 /*
163 * If we have an externally synchronized Linux clock, then update
164 * CMOS clock accordingly every ~11 minutes. rtc_mips_set_time() has to be
165 * called as close as possible to 500 ms before the new second starts.
166 */
167 if (ntp_synced() &&
168 xtime.tv_sec > last_rtc_update + 660 &&
169 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
170 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
171 if (rtc_mips_set_mmss(xtime.tv_sec) == 0) {
172 last_rtc_update = xtime.tv_sec;
173 } else {
174 /* do it again in 60 s */
175 last_rtc_update = xtime.tv_sec - 600;
176 }
177 }
178
179 write_sequnlock(&xtime_lock); 163 write_sequnlock(&xtime_lock);
180 164
181 /* 165 /*