diff options
Diffstat (limited to 'arch/blackfin')
-rw-r--r-- | arch/blackfin/Kconfig | 10 | ||||
-rw-r--r-- | arch/blackfin/kernel/time.c | 63 |
2 files changed, 8 insertions, 65 deletions
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index 9a01d445eca8..e51988237d3b 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -229,7 +229,7 @@ endchoice | |||
229 | 229 | ||
230 | config SMP | 230 | config SMP |
231 | depends on BF561 | 231 | depends on BF561 |
232 | select GENERIC_TIME | 232 | select GENERIC_CLOCKEVENTS |
233 | bool "Symmetric multi-processing support" | 233 | bool "Symmetric multi-processing support" |
234 | ---help--- | 234 | ---help--- |
235 | This enables support for systems with more than one CPU, | 235 | This enables support for systems with more than one CPU, |
@@ -613,12 +613,10 @@ comment "Kernel Timer/Scheduler" | |||
613 | source kernel/Kconfig.hz | 613 | source kernel/Kconfig.hz |
614 | 614 | ||
615 | config GENERIC_TIME | 615 | config GENERIC_TIME |
616 | bool "Generic time" | 616 | def_bool y |
617 | default y | ||
618 | 617 | ||
619 | config GENERIC_CLOCKEVENTS | 618 | config GENERIC_CLOCKEVENTS |
620 | bool "Generic clock events" | 619 | bool "Generic clock events" |
621 | depends on GENERIC_TIME | ||
622 | default y | 620 | default y |
623 | 621 | ||
624 | choice | 622 | choice |
@@ -653,6 +651,10 @@ config GPTMR0_CLOCKSOURCE | |||
653 | depends on GENERIC_CLOCKEVENTS | 651 | depends on GENERIC_CLOCKEVENTS |
654 | depends on !TICKSOURCE_GPTMR0 | 652 | depends on !TICKSOURCE_GPTMR0 |
655 | 653 | ||
654 | config ARCH_USES_GETTIMEOFFSET | ||
655 | depends on !GENERIC_CLOCKEVENTS | ||
656 | def_bool y | ||
657 | |||
656 | source kernel/time/Kconfig | 658 | source kernel/time/Kconfig |
657 | 659 | ||
658 | comment "Misc" | 660 | comment "Misc" |
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c index adb54aa7d7c8..e5069fe6861e 100644 --- a/arch/blackfin/kernel/time.c +++ b/arch/blackfin/kernel/time.c | |||
@@ -81,11 +81,11 @@ time_sched_init(irqreturn_t(*timer_routine) (int, void *)) | |||
81 | #endif | 81 | #endif |
82 | } | 82 | } |
83 | 83 | ||
84 | #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET | ||
84 | /* | 85 | /* |
85 | * Should return useconds since last timer tick | 86 | * Should return useconds since last timer tick |
86 | */ | 87 | */ |
87 | #ifndef CONFIG_GENERIC_TIME | 88 | u32 arch_gettimeoffset(void) |
88 | static unsigned long gettimeoffset(void) | ||
89 | { | 89 | { |
90 | unsigned long offset; | 90 | unsigned long offset; |
91 | unsigned long clocks_per_jiffy; | 91 | unsigned long clocks_per_jiffy; |
@@ -184,65 +184,6 @@ void __init time_init(void) | |||
184 | time_sched_init(timer_interrupt); | 184 | time_sched_init(timer_interrupt); |
185 | } | 185 | } |
186 | 186 | ||
187 | #ifndef CONFIG_GENERIC_TIME | ||
188 | void do_gettimeofday(struct timeval *tv) | ||
189 | { | ||
190 | unsigned long flags; | ||
191 | unsigned long seq; | ||
192 | unsigned long usec, sec; | ||
193 | |||
194 | do { | ||
195 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | ||
196 | usec = gettimeoffset(); | ||
197 | sec = xtime.tv_sec; | ||
198 | usec += (xtime.tv_nsec / NSEC_PER_USEC); | ||
199 | } | ||
200 | while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | ||
201 | |||
202 | while (usec >= USEC_PER_SEC) { | ||
203 | usec -= USEC_PER_SEC; | ||
204 | sec++; | ||
205 | } | ||
206 | |||
207 | tv->tv_sec = sec; | ||
208 | tv->tv_usec = usec; | ||
209 | } | ||
210 | EXPORT_SYMBOL(do_gettimeofday); | ||
211 | |||
212 | int do_settimeofday(struct timespec *tv) | ||
213 | { | ||
214 | time_t wtm_sec, sec = tv->tv_sec; | ||
215 | long wtm_nsec, nsec = tv->tv_nsec; | ||
216 | |||
217 | if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) | ||
218 | return -EINVAL; | ||
219 | |||
220 | write_seqlock_irq(&xtime_lock); | ||
221 | /* | ||
222 | * This is revolting. We need to set the xtime.tv_usec | ||
223 | * correctly. However, the value in this location is | ||
224 | * is value at the last tick. | ||
225 | * Discover what correction gettimeofday | ||
226 | * would have done, and then undo it! | ||
227 | */ | ||
228 | nsec -= (gettimeoffset() * NSEC_PER_USEC); | ||
229 | |||
230 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | ||
231 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | ||
232 | |||
233 | set_normalized_timespec(&xtime, sec, nsec); | ||
234 | set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); | ||
235 | |||
236 | ntp_clear(); | ||
237 | |||
238 | write_sequnlock_irq(&xtime_lock); | ||
239 | clock_was_set(); | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | EXPORT_SYMBOL(do_settimeofday); | ||
244 | #endif /* !CONFIG_GENERIC_TIME */ | ||
245 | |||
246 | /* | 187 | /* |
247 | * Scheduler clock - returns current time in nanosec units. | 188 | * Scheduler clock - returns current time in nanosec units. |
248 | */ | 189 | */ |