diff options
Diffstat (limited to 'arch/arm/mach-u300/timer.c')
-rw-r--r-- | arch/arm/mach-u300/timer.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c index 3fc4472719be..3ec58bd2d6e4 100644 --- a/arch/arm/mach-u300/timer.c +++ b/arch/arm/mach-u300/timer.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * Author: Linus Walleij <linus.walleij@stericsson.com> | 9 | * Author: Linus Walleij <linus.walleij@stericsson.com> |
10 | */ | 10 | */ |
11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
12 | #include <linux/sched.h> | ||
12 | #include <linux/time.h> | 13 | #include <linux/time.h> |
13 | #include <linux/timex.h> | 14 | #include <linux/timex.h> |
14 | #include <linux/clockchips.h> | 15 | #include <linux/clockchips.h> |
@@ -21,6 +22,7 @@ | |||
21 | #include <mach/hardware.h> | 22 | #include <mach/hardware.h> |
22 | 23 | ||
23 | /* Generic stuff */ | 24 | /* Generic stuff */ |
25 | #include <asm/sched_clock.h> | ||
24 | #include <asm/mach/map.h> | 26 | #include <asm/mach/map.h> |
25 | #include <asm/mach/time.h> | 27 | #include <asm/mach/time.h> |
26 | #include <asm/mach/irq.h> | 28 | #include <asm/mach/irq.h> |
@@ -352,12 +354,18 @@ static struct clocksource clocksource_u300_1mhz = { | |||
352 | * this wraps around for now, since it is just a relative time | 354 | * this wraps around for now, since it is just a relative time |
353 | * stamp. (Inspired by OMAP implementation.) | 355 | * stamp. (Inspired by OMAP implementation.) |
354 | */ | 356 | */ |
357 | static DEFINE_CLOCK_DATA(cd); | ||
358 | |||
355 | unsigned long long notrace sched_clock(void) | 359 | unsigned long long notrace sched_clock(void) |
356 | { | 360 | { |
357 | return clocksource_cyc2ns(clocksource_u300_1mhz.read( | 361 | u32 cyc = readl(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC); |
358 | &clocksource_u300_1mhz), | 362 | return cyc_to_sched_clock(&cd, cyc, (u32)~0); |
359 | clocksource_u300_1mhz.mult, | 363 | } |
360 | clocksource_u300_1mhz.shift); | 364 | |
365 | static void notrace u300_update_sched_clock(void) | ||
366 | { | ||
367 | u32 cyc = readl(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC); | ||
368 | update_sched_clock(&cd, cyc, (u32)~0); | ||
361 | } | 369 | } |
362 | 370 | ||
363 | 371 | ||
@@ -375,6 +383,8 @@ static void __init u300_timer_init(void) | |||
375 | clk_enable(clk); | 383 | clk_enable(clk); |
376 | rate = clk_get_rate(clk); | 384 | rate = clk_get_rate(clk); |
377 | 385 | ||
386 | init_sched_clock(&cd, u300_update_sched_clock, 32, rate); | ||
387 | |||
378 | /* | 388 | /* |
379 | * Disable the "OS" and "DD" timers - these are designed for Symbian! | 389 | * Disable the "OS" and "DD" timers - these are designed for Symbian! |
380 | * Example usage in cnh1601578 cpu subsystem pd_timer_app.c | 390 | * Example usage in cnh1601578 cpu subsystem pd_timer_app.c |
@@ -412,9 +422,7 @@ static void __init u300_timer_init(void) | |||
412 | writel(U300_TIMER_APP_EGPT2_TIMER_ENABLE, | 422 | writel(U300_TIMER_APP_EGPT2_TIMER_ENABLE, |
413 | U300_TIMER_APP_VBASE + U300_TIMER_APP_EGPT2); | 423 | U300_TIMER_APP_VBASE + U300_TIMER_APP_EGPT2); |
414 | 424 | ||
415 | clocksource_calc_mult_shift(&clocksource_u300_1mhz, | 425 | if (clocksource_register_hz(&clocksource_u300_1mhz, rate)) |
416 | rate, APPTIMER_MIN_RANGE); | ||
417 | if (clocksource_register(&clocksource_u300_1mhz)) | ||
418 | printk(KERN_ERR "timer: failed to initialize clock " | 426 | printk(KERN_ERR "timer: failed to initialize clock " |
419 | "source %s\n", clocksource_u300_1mhz.name); | 427 | "source %s\n", clocksource_u300_1mhz.name); |
420 | 428 | ||