Commit c124befc authored by Jan Weitzel's avatar Jan Weitzel Committed by Sascha Hauer

ARM: mxc: Add sched_clock to mxc platform

Add sched_clock using cyc_to_sched_clock and update_sched_clock
with HAVE_SCHED_CLOCK
tested on iMX27 and iMX35
Signed-off-by: default avatarJan Weitzel <j.weitzel@phytec.de>
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 93b20e4f
...@@ -362,6 +362,7 @@ config ARCH_MXC ...@@ -362,6 +362,7 @@ config ARCH_MXC
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select CLKDEV_LOOKUP select CLKDEV_LOOKUP
select HAVE_SCHED_CLOCK
help help
Support for Freescale MXC/iMX-based family of processors Support for Freescale MXC/iMX-based family of processors
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/sched_clock.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <mach/common.h> #include <mach/common.h>
...@@ -128,6 +129,20 @@ static struct clocksource clocksource_mxc = { ...@@ -128,6 +129,20 @@ static struct clocksource clocksource_mxc = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
static DEFINE_CLOCK_DATA(cd);
unsigned long long notrace sched_clock(void)
{
cycle_t cyc = clocksource_mxc.read(&clocksource_mxc);
return cyc_to_sched_clock(&cd, cyc, (u32)~0);
}
static void notrace mxc_update_sched_clock(void)
{
cycle_t cyc = clocksource_mxc.read(&clocksource_mxc);
update_sched_clock(&cd, cyc, (u32)~0);
}
static int __init mxc_clocksource_init(struct clk *timer_clk) static int __init mxc_clocksource_init(struct clk *timer_clk)
{ {
unsigned int c = clk_get_rate(timer_clk); unsigned int c = clk_get_rate(timer_clk);
...@@ -137,6 +152,7 @@ static int __init mxc_clocksource_init(struct clk *timer_clk) ...@@ -137,6 +152,7 @@ static int __init mxc_clocksource_init(struct clk *timer_clk)
else else
clocksource_mxc.read = mx1_2_get_cycles; clocksource_mxc.read = mx1_2_get_cycles;
init_sched_clock(&cd, mxc_update_sched_clock, 32, c);
clocksource_register_hz(&clocksource_mxc, c); clocksource_register_hz(&clocksource_mxc, c);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment