diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-08-13 10:26:12 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-10-11 18:46:08 -0400 |
commit | f5ff0a280201c9cbfb6e9eb4bafdb465c2269ed3 (patch) | |
tree | ed056a42ec6c7330765fd3ce45c78815c76c2d34 /arch/mips | |
parent | 4680576edecb640f64936bd9b92add0a56027b61 (diff) |
[MIPS] Use generic NTP code for all MIPS platforms
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/Kconfig | 4 | ||||
-rw-r--r-- | arch/mips/kernel/time.c | 24 | ||||
-rw-r--r-- | arch/mips/sgi-ip27/ip27-timer.c | 18 |
3 files changed, 8 insertions, 38 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 371434dd744c..c024113ce280 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -670,6 +670,10 @@ config GENERIC_TIME | |||
670 | bool | 670 | bool |
671 | default y | 671 | default y |
672 | 672 | ||
673 | config GENERIC_CMOS_UPDATE | ||
674 | bool | ||
675 | default y | ||
676 | |||
673 | config SCHED_NO_NO_OMIT_FRAME_POINTER | 677 | config SCHED_NO_NO_OMIT_FRAME_POINTER |
674 | bool | 678 | bool |
675 | default y | 679 | default y |
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; | |||
67 | int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time; | 67 | int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time; |
68 | int (*rtc_mips_set_mmss)(unsigned long); | 68 | int (*rtc_mips_set_mmss)(unsigned long); |
69 | 69 | ||
70 | int 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 */ |
72 | static unsigned long cycles_per_jiffy __read_mostly; | 76 | static unsigned long cycles_per_jiffy __read_mostly; |
@@ -125,9 +129,6 @@ static void __init c0_hpt_timer_init(void) | |||
125 | int (*mips_timer_state)(void); | 129 | int (*mips_timer_state)(void); |
126 | void (*mips_timer_ack)(void); | 130 | void (*mips_timer_ack)(void); |
127 | 131 | ||
128 | /* last time when xtime and rtc are sync'ed up */ | ||
129 | static 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 | /* |
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c index 8c3c78c63ccd..31346162e9fa 100644 --- a/arch/mips/sgi-ip27/ip27-timer.c +++ b/arch/mips/sgi-ip27/ip27-timer.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #define TICK_SIZE (tick_nsec / 1000) | 40 | #define TICK_SIZE (tick_nsec / 1000) |
41 | 41 | ||
42 | static unsigned long ct_cur[NR_CPUS]; /* What counter should be at next timer irq */ | 42 | static unsigned long ct_cur[NR_CPUS]; /* What counter should be at next timer irq */ |
43 | static long last_rtc_update; /* Last time the rtc clock got updated */ | ||
44 | 43 | ||
45 | #if 0 | 44 | #if 0 |
46 | static int set_rtc_mmss(unsigned long nowtime) | 45 | static int set_rtc_mmss(unsigned long nowtime) |
@@ -113,23 +112,6 @@ again: | |||
113 | 112 | ||
114 | update_process_times(user_mode(get_irq_regs())); | 113 | update_process_times(user_mode(get_irq_regs())); |
115 | 114 | ||
116 | /* | ||
117 | * If we have an externally synchronized Linux clock, then update | ||
118 | * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | ||
119 | * called as close as possible to when a second starts. | ||
120 | */ | ||
121 | if (ntp_synced() && | ||
122 | xtime.tv_sec > last_rtc_update + 660 && | ||
123 | (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && | ||
124 | (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { | ||
125 | if (rtc_mips_set_time(xtime.tv_sec) == 0) { | ||
126 | last_rtc_update = xtime.tv_sec; | ||
127 | } else { | ||
128 | last_rtc_update = xtime.tv_sec - 600; | ||
129 | /* do it again in 60 s */ | ||
130 | } | ||
131 | } | ||
132 | |||
133 | write_sequnlock(&xtime_lock); | 115 | write_sequnlock(&xtime_lock); |
134 | irq_exit(); | 116 | irq_exit(); |
135 | } | 117 | } |