aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-u300
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@stericsson.com>2009-09-17 13:10:50 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-09-18 22:09:02 +0100
commita2ca00ea9398265a26eabb358bba83c8b75c463d (patch)
treef361475375241dcaa7939ef493e4c23930f9f541 /arch/arm/mach-u300
parent6be2a0cacc1ed6899a53172e2e9b7a3587be0bea (diff)
ARM: 5704/1: U300 sched_clock implementation v2
This adds the long debated sched_clock() override for the weak in-kernel jiffybased sched_clock(). The implementation is more or less identical to the one used in arch/arm/plat-omap/common.c and at last attempt to merge this the merge was postponed at the request of Peter Zijlstra due to pending discussions regarding generalized clocksource-based sched_clock() implementations by adding a flag to the clocksource. However that discussion ended up with the generic code needing to be rewritten and Paul Mundt see no reason not to proceed with this for the time being as it can be easily converted once the generic code is in place. Cc: Peter Zijlstra <peterz@infradead.org> Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-u300')
-rw-r--r--arch/arm/mach-u300/timer.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
index cce53204880..26d26f5100f 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/arch/arm/mach-u300/timer.c
@@ -346,6 +346,21 @@ static struct clocksource clocksource_u300_1mhz = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+/*
+ * Override the global weak sched_clock symbol with this
+ * local implementation which uses the clocksource to get some
+ * better resolution when scheduling the kernel. We accept that
+ * this wraps around for now, since it is just a relative time
+ * stamp. (Inspired by OMAP implementation.)
+ */
+unsigned long long notrace sched_clock(void)
+{
+ return clocksource_cyc2ns(clocksource_u300_1mhz.read(
+ &clocksource_u300_1mhz),
+ clocksource_u300_1mhz.mult,
+ clocksource_u300_1mhz.shift);
+}
+
/*
* This sets up the system timers, clock source and clock event.