diff options
Diffstat (limited to 'arch/arm/mach-davinci/time.c')
-rw-r--r-- | arch/arm/mach-davinci/time.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c index 0f21c36e65dd..e1969ce904dc 100644 --- a/arch/arm/mach-davinci/time.c +++ b/arch/arm/mach-davinci/time.c | |||
@@ -272,15 +272,35 @@ static cycle_t read_cycles(struct clocksource *cs) | |||
272 | return (cycles_t)timer32_read(t); | 272 | return (cycles_t)timer32_read(t); |
273 | } | 273 | } |
274 | 274 | ||
275 | /* | ||
276 | * Kernel assumes that sched_clock can be called early but may not have | ||
277 | * things ready yet. | ||
278 | */ | ||
279 | static cycle_t read_dummy(struct clocksource *cs) | ||
280 | { | ||
281 | return 0; | ||
282 | } | ||
283 | |||
284 | |||
275 | static struct clocksource clocksource_davinci = { | 285 | static struct clocksource clocksource_davinci = { |
276 | .rating = 300, | 286 | .rating = 300, |
277 | .read = read_cycles, | 287 | .read = read_dummy, |
278 | .mask = CLOCKSOURCE_MASK(32), | 288 | .mask = CLOCKSOURCE_MASK(32), |
279 | .shift = 24, | ||
280 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 289 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
281 | }; | 290 | }; |
282 | 291 | ||
283 | /* | 292 | /* |
293 | * Overwrite weak default sched_clock with something more precise | ||
294 | */ | ||
295 | unsigned long long notrace sched_clock(void) | ||
296 | { | ||
297 | const cycle_t cyc = clocksource_davinci.read(&clocksource_davinci); | ||
298 | |||
299 | return clocksource_cyc2ns(cyc, clocksource_davinci.mult, | ||
300 | clocksource_davinci.shift); | ||
301 | } | ||
302 | |||
303 | /* | ||
284 | * clockevent | 304 | * clockevent |
285 | */ | 305 | */ |
286 | static int davinci_set_next_event(unsigned long cycles, | 306 | static int davinci_set_next_event(unsigned long cycles, |
@@ -377,11 +397,10 @@ static void __init davinci_timer_init(void) | |||
377 | davinci_clock_tick_rate = clk_get_rate(timer_clk); | 397 | davinci_clock_tick_rate = clk_get_rate(timer_clk); |
378 | 398 | ||
379 | /* setup clocksource */ | 399 | /* setup clocksource */ |
400 | clocksource_davinci.read = read_cycles; | ||
380 | clocksource_davinci.name = id_to_name[clocksource_id]; | 401 | clocksource_davinci.name = id_to_name[clocksource_id]; |
381 | clocksource_davinci.mult = | 402 | if (clocksource_register_hz(&clocksource_davinci, |
382 | clocksource_khz2mult(davinci_clock_tick_rate/1000, | 403 | davinci_clock_tick_rate)) |
383 | clocksource_davinci.shift); | ||
384 | if (clocksource_register(&clocksource_davinci)) | ||
385 | printk(err, clocksource_davinci.name); | 404 | printk(err, clocksource_davinci.name); |
386 | 405 | ||
387 | /* setup clockevent */ | 406 | /* setup clockevent */ |