Commit 93b20e4f authored by Jan Weitzel's avatar Jan Weitzel Committed by Sascha Hauer

ARM: mxc: Add dummy_get_cycles to avoid access before init is done

this is needed to use get_cycles with sched_clock. Accessing timer
without enabled clk will result in crash
Signed-off-by: default avatarJan Weitzel <j.weitzel@phytec.de>
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 350ac9dd
...@@ -105,6 +105,11 @@ static void gpt_irq_acknowledge(void) ...@@ -105,6 +105,11 @@ static void gpt_irq_acknowledge(void)
__raw_writel(V2_TSTAT_OF1, timer_base + V2_TSTAT); __raw_writel(V2_TSTAT_OF1, timer_base + V2_TSTAT);
} }
static cycle_t dummy_get_cycles(struct clocksource *cs)
{
return 0;
}
static cycle_t mx1_2_get_cycles(struct clocksource *cs) static cycle_t mx1_2_get_cycles(struct clocksource *cs)
{ {
return __raw_readl(timer_base + MX1_2_TCN); return __raw_readl(timer_base + MX1_2_TCN);
...@@ -118,7 +123,7 @@ static cycle_t v2_get_cycles(struct clocksource *cs) ...@@ -118,7 +123,7 @@ static cycle_t v2_get_cycles(struct clocksource *cs)
static struct clocksource clocksource_mxc = { static struct clocksource clocksource_mxc = {
.name = "mxc_timer1", .name = "mxc_timer1",
.rating = 200, .rating = 200,
.read = mx1_2_get_cycles, .read = dummy_get_cycles,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
...@@ -129,6 +134,8 @@ static int __init mxc_clocksource_init(struct clk *timer_clk) ...@@ -129,6 +134,8 @@ static int __init mxc_clocksource_init(struct clk *timer_clk)
if (timer_is_v2()) if (timer_is_v2())
clocksource_mxc.read = v2_get_cycles; clocksource_mxc.read = v2_get_cycles;
else
clocksource_mxc.read = mx1_2_get_cycles;
clocksource_register_hz(&clocksource_mxc, c); clocksource_register_hz(&clocksource_mxc, c);
......
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