diff options
-rw-r--r-- | arch/mips/Kconfig | 4 | ||||
-rw-r--r-- | arch/mips/dec/time.c | 2 | ||||
-rw-r--r-- | arch/mips/kernel/time.c | 74 |
3 files changed, 4 insertions, 76 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 9fe90507e6c7..bfab055ad7cc 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -803,6 +803,10 @@ config GENERIC_CALIBRATE_DELAY | |||
803 | bool | 803 | bool |
804 | default y | 804 | default y |
805 | 805 | ||
806 | config GENERIC_TIME | ||
807 | bool | ||
808 | default y | ||
809 | |||
806 | config SCHED_NO_NO_OMIT_FRAME_POINTER | 810 | config SCHED_NO_NO_OMIT_FRAME_POINTER |
807 | bool | 811 | bool |
808 | default y | 812 | default y |
diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c index 57294740c2dd..4cf0c06e2414 100644 --- a/arch/mips/dec/time.c +++ b/arch/mips/dec/time.c | |||
@@ -184,8 +184,6 @@ void __init dec_time_init(void) | |||
184 | CMOS_WRITE(RTC_REF_CLCK_32KHZ | (16 - __ffs(HZ)), RTC_REG_A); | 184 | CMOS_WRITE(RTC_REF_CLCK_32KHZ | (16 - __ffs(HZ)), RTC_REG_A); |
185 | } | 185 | } |
186 | 186 | ||
187 | EXPORT_SYMBOL(do_settimeofday); | ||
188 | |||
189 | void __init plat_timer_setup(struct irqaction *irq) | 187 | void __init plat_timer_setup(struct irqaction *irq) |
190 | { | 188 | { |
191 | setup_irq(dec_interrupt[DEC_IRQ_RTC], irq); | 189 | setup_irq(dec_interrupt[DEC_IRQ_RTC], irq); |
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c index 845c7e55505d..a8340802f2d7 100644 --- a/arch/mips/kernel/time.c +++ b/arch/mips/kernel/time.c | |||
@@ -149,80 +149,6 @@ void (*mips_timer_ack)(void); | |||
149 | unsigned int (*mips_hpt_read)(void); | 149 | unsigned int (*mips_hpt_read)(void); |
150 | void (*mips_hpt_init)(unsigned int); | 150 | void (*mips_hpt_init)(unsigned int); |
151 | 151 | ||
152 | |||
153 | /* | ||
154 | * This version of gettimeofday has microsecond resolution and better than | ||
155 | * microsecond precision on fast machines with cycle counter. | ||
156 | */ | ||
157 | void do_gettimeofday(struct timeval *tv) | ||
158 | { | ||
159 | unsigned long seq; | ||
160 | unsigned long usec, sec; | ||
161 | unsigned long max_ntp_tick; | ||
162 | |||
163 | do { | ||
164 | seq = read_seqbegin(&xtime_lock); | ||
165 | |||
166 | usec = do_gettimeoffset(); | ||
167 | |||
168 | /* | ||
169 | * If time_adjust is negative then NTP is slowing the clock | ||
170 | * so make sure not to go into next possible interval. | ||
171 | * Better to lose some accuracy than have time go backwards.. | ||
172 | */ | ||
173 | if (unlikely(time_adjust < 0)) { | ||
174 | max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj; | ||
175 | usec = min(usec, max_ntp_tick); | ||
176 | } | ||
177 | |||
178 | sec = xtime.tv_sec; | ||
179 | usec += (xtime.tv_nsec / 1000); | ||
180 | |||
181 | } while (read_seqretry(&xtime_lock, seq)); | ||
182 | |||
183 | while (usec >= 1000000) { | ||
184 | usec -= 1000000; | ||
185 | sec++; | ||
186 | } | ||
187 | |||
188 | tv->tv_sec = sec; | ||
189 | tv->tv_usec = usec; | ||
190 | } | ||
191 | |||
192 | EXPORT_SYMBOL(do_gettimeofday); | ||
193 | |||
194 | int do_settimeofday(struct timespec *tv) | ||
195 | { | ||
196 | time_t wtm_sec, sec = tv->tv_sec; | ||
197 | long wtm_nsec, nsec = tv->tv_nsec; | ||
198 | |||
199 | if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) | ||
200 | return -EINVAL; | ||
201 | |||
202 | write_seqlock_irq(&xtime_lock); | ||
203 | |||
204 | /* | ||
205 | * This is revolting. We need to set "xtime" correctly. However, | ||
206 | * the value in this location is the value at the most recent update | ||
207 | * of wall time. Discover what correction gettimeofday() would have | ||
208 | * made, and then undo it! | ||
209 | */ | ||
210 | nsec -= do_gettimeoffset() * NSEC_PER_USEC; | ||
211 | |||
212 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | ||
213 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | ||
214 | |||
215 | set_normalized_timespec(&xtime, sec, nsec); | ||
216 | set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); | ||
217 | |||
218 | ntp_clear(); | ||
219 | write_sequnlock_irq(&xtime_lock); | ||
220 | clock_was_set(); | ||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | EXPORT_SYMBOL(do_settimeofday); | ||
225 | |||
226 | /* | 152 | /* |
227 | * Gettimeoffset routines. These routines returns the time duration | 153 | * Gettimeoffset routines. These routines returns the time duration |
228 | * since last timer interrupt in usecs. | 154 | * since last timer interrupt in usecs. |