aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-u300/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-u300/timer.c')
-rw-r--r--arch/arm/mach-u300/timer.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
index 6c68fe797903..3ec58bd2d6e4 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/arch/arm/mach-u300/timer.c
@@ -22,6 +22,7 @@
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23 23
24/* Generic stuff */ 24/* Generic stuff */
25#include <asm/sched_clock.h>
25#include <asm/mach/map.h> 26#include <asm/mach/map.h>
26#include <asm/mach/time.h> 27#include <asm/mach/time.h>
27#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
@@ -353,12 +354,18 @@ static struct clocksource clocksource_u300_1mhz = {
353 * 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
354 * stamp. (Inspired by OMAP implementation.) 355 * stamp. (Inspired by OMAP implementation.)
355 */ 356 */
357static DEFINE_CLOCK_DATA(cd);
358
356unsigned long long notrace sched_clock(void) 359unsigned long long notrace sched_clock(void)
357{ 360{
358 return clocksource_cyc2ns(clocksource_u300_1mhz.read( 361 u32 cyc = readl(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC);
359 &clocksource_u300_1mhz), 362 return cyc_to_sched_clock(&cd, cyc, (u32)~0);
360 clocksource_u300_1mhz.mult, 363}
361 clocksource_u300_1mhz.shift); 364
365static 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);
362} 369}
363 370
364 371
@@ -376,6 +383,8 @@ static void __init u300_timer_init(void)
376 clk_enable(clk); 383 clk_enable(clk);
377 rate = clk_get_rate(clk); 384 rate = clk_get_rate(clk);
378 385
386 init_sched_clock(&cd, u300_update_sched_clock, 32, rate);
387
379 /* 388 /*
380 * Disable the "OS" and "DD" timers - these are designed for Symbian! 389 * Disable the "OS" and "DD" timers - these are designed for Symbian!
381 * Example usage in cnh1601578 cpu subsystem pd_timer_app.c 390 * Example usage in cnh1601578 cpu subsystem pd_timer_app.c