summaryrefslogtreecommitdiff
path: root/arch/arm/mach-omap2/timer-gp.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2011-03-02 17:07:14 -0800
committerTony Lindgren <tony@atomide.com>2011-03-02 17:07:14 -0800
commit12d7d4e0ed8fecf7f74c89483b55b300be6e5901 (patch)
treef573761ac752ff04ec445e23aef50adadda49790 /arch/arm/mach-omap2/timer-gp.c
parentaca6ad073ea820776bf5bdb87cf82eace35042c8 (diff)
parent790ab7e92bec24aee3939b300d36b99ab2e3f3ca (diff)
Merge branch 'devel-cleanup' into omap-for-linus
Conflicts: arch/arm/mach-omap2/timer-gp.c
Diffstat (limited to 'arch/arm/mach-omap2/timer-gp.c')
-rw-r--r--arch/arm/mach-omap2/timer-gp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index fb8d656e4d0a..3b9cf85f4bb9 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -39,6 +39,7 @@
#include <asm/mach/time.h>
#include <plat/dmtimer.h>
#include <asm/localtimer.h>
+#include <asm/sched_clock.h>
#include <plat/common.h>
#include <plat/omap_hwmod.h>
@@ -195,6 +196,7 @@ static void __init omap2_gp_clocksource_init(void)
/*
* clocksource
*/
+static DEFINE_CLOCK_DATA(cd);
static struct omap_dm_timer *gpt_clocksource;
static cycle_t clocksource_read_cycles(struct clocksource *cs)
{
@@ -209,6 +211,15 @@ static struct clocksource clocksource_gpt = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static void notrace dmtimer_update_sched_clock(void)
+{
+ u32 cyc;
+
+ cyc = omap_dm_timer_read_counter(gpt_clocksource);
+
+ update_sched_clock(&cd, cyc, (u32)~0);
+}
+
/* Setup free-running counter for clocksource */
static void __init omap2_gp_clocksource_init(void)
{
@@ -229,6 +240,8 @@ static void __init omap2_gp_clocksource_init(void)
omap_dm_timer_set_load_start(gpt, 1, 0);
+ init_sched_clock(&cd, dmtimer_update_sched_clock, 32, tick_rate);
+
if (clocksource_register_hz(&clocksource_gpt, tick_rate))
printk(err2, clocksource_gpt.name);
}