Skip to content

Commit f5ff0a2

Browse files
committed
[MIPS] Use generic NTP code for all MIPS platforms
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 4680576 commit f5ff0a2

3 files changed

Lines changed: 8 additions & 38 deletions

File tree

‎arch/mips/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,10 @@ config GENERIC_TIME
670670
bool
671671
default y
672672

673+
config GENERIC_CMOS_UPDATE
674+
bool
675+
default y
676+
673677
config SCHED_NO_NO_OMIT_FRAME_POINTER
674678
bool
675679
default y

‎arch/mips/kernel/time.c‎

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ unsigned long (*rtc_mips_get_time)(void) = null_rtc_get_time;
6767
int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time;
6868
int (*rtc_mips_set_mmss)(unsigned long);
6969

70+
int update_persistent_clock(struct timespec now)
71+
{
72+
return rtc_mips_set_mmss(now.tv_sec);
73+
}
7074

7175
/* how many counter cycles in a jiffy */
7276
static unsigned long cycles_per_jiffy __read_mostly;
@@ -125,9 +129,6 @@ static void __init c0_hpt_timer_init(void)
125129
int (*mips_timer_state)(void);
126130
void (*mips_timer_ack)(void);
127131

128-
/* last time when xtime and rtc are sync'ed up */
129-
static long last_rtc_update;
130-
131132
/*
132133
* local_timer_interrupt() does profiling and process accounting
133134
* on a per-CPU basis.
@@ -159,23 +160,6 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
159160
*/
160161
do_timer(1);
161162

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-
179163
write_sequnlock(&xtime_lock);
180164

181165
/*

‎arch/mips/sgi-ip27/ip27-timer.c‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#define TICK_SIZE (tick_nsec / 1000)
4141

4242
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 */
4443

4544
#if 0
4645
static int set_rtc_mmss(unsigned long nowtime)
@@ -113,23 +112,6 @@ void ip27_rt_timer_interrupt(void)
113112

114113
update_process_times(user_mode(get_irq_regs()));
115114

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-
133115
write_sequnlock(&xtime_lock);
134116
irq_exit();
135117
}

0 commit comments

Comments
 (0)