[PATCH] omap: add sched_clock for omap1 based on MPU timer
From: Tim Bird
Date: Fri May 22 2009 - 15:47:55 EST
Define a higher-resolution sched_clock for OMAP
using the MPU timer, when it is configured on.
This produces better results from ftrace.
Signed-off-by: Tim Bird <tim.bird@xxxxxxxxxxx>
---
arch/arm/mach-omap1/time.c | 9 +++++++++
arch/arm/plat-omap/common.c | 2 ++
2 files changed, 11 insertions(+)
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -212,6 +212,15 @@ static struct clocksource clocksource_mp
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+unsigned long long notrace sched_clock(void)
+{
+ unsigned long long ret;
+
+ ret = (unsigned long long) ~omap_mpu_timer_read(1);
+ ret = (ret * clocksource_mpu.mult_orig) >> clocksource_mpu.shift;
+ return ret;
+}
+
static void __init omap_init_clocksource(unsigned long rate)
{
static char err[] __initdata = KERN_ERR
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -199,6 +199,7 @@ static struct clocksource clocksource_32
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+#ifndef CONFIG_OMAP_MPU_TIMER
/*
* Returns current time from boot in nsecs. It's OK for this to wrap
* around for now, as it's just a relative time stamp.
@@ -211,6 +212,7 @@ unsigned long long notrace sched_clock(v
ret = (ret * clocksource_32k.mult_orig) >> clocksource_32k.shift;
return ret;
}
+#endif
static int __init omap_init_clocksource_32k(void)
{
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/