Home Home > GIT Browse > openSUSE-15.1
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Weitzel <J.Weitzel@phytec.de>2011-04-04 19:42:02 +0200
committerThomas Gleixner <tglx@linutronix.de>2011-04-04 19:42:02 +0200
commit8a97f01ea89f6329ea41c48099df9d5ca1cd4eaf (patch)
tree750f2a05b90e24d82abb50e5504892d40ee50774
parenta5a2b75c0c11b5c8c6f9f87a4d43417f172345a8 (diff)
arm: mxc: Add sched_clock to mxc-platform
Add sched_clock using cyc_to_sched_clock and update_sched_clock with HAVE_SCHED_CLOCK. Signed-off-by: Jan Weitzel <J.Weitzel@phytec.de> Signed-off-by: Carsten Emde <cbe@osadl.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/plat-mxc/time.c18
2 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8d3ed313c9eb..54cf81037316 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -317,6 +317,7 @@ config ARCH_MXC
select GENERIC_GPIO
select ARCH_REQUIRE_GPIOLIB
select HAVE_CLK
+ select HAVE_SCHED_CLOCK
help
Support for Freescale MXC/iMX-based family of processors
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index cfa7437d04e1..ebcbc20f290d 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -26,6 +26,7 @@
#include <linux/clockchips.h>
#include <linux/clk.h>
+#include <asm/sched_clock.h>
#include <mach/hardware.h>
#include <asm/mach/time.h>
#include <mach/common.h>
@@ -119,6 +120,22 @@ static struct clocksource clocksource_mxc = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static DEFINE_CLOCK_DATA(cd);
+
+unsigned long long notrace sched_clock(void)
+{
+ cycle_t cyc = clocksource_mxc.read(NULL);
+
+ return cyc_to_sched_clock(&cd, cyc, (u32)~0);
+}
+
+static void notrace mxc_update_sched_clock(void)
+{
+ cycle_t cyc = clocksource_mxc.read(NULL);
+
+ update_sched_clock(&cd, cyc, (u32)~0);
+}
+
static int __init mxc_clocksource_init(struct clk *timer_clk)
{
unsigned int c = clk_get_rate(timer_clk);
@@ -130,6 +147,7 @@ static int __init mxc_clocksource_init(struct clk *timer_clk)
clocksource_mxc.mult = clocksource_hz2mult(c,
clocksource_mxc.shift);
+ init_sched_clock(&cd, mxc_update_sched_clock, 32, c);
clocksource_register(&clocksource_mxc);
return 0;