diff options
author | Jan Weitzel <j.weitzel@phytec.de> | 2011-03-17 08:44:29 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-03-23 10:08:12 -0400 |
commit | 93b20e4fdbe1ddc4bef79d968cb1ba453324a499 (patch) | |
tree | 0bc9719659ea8bed908199944cbcc510355b2b57 | |
parent | 350ac9ddce074855030b88c9e8c016574d2e9097 (diff) |
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: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/plat-mxc/time.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c index 9f0c2610595e..0142e4b2e12e 100644 --- a/arch/arm/plat-mxc/time.c +++ b/arch/arm/plat-mxc/time.c | |||
@@ -105,6 +105,11 @@ static void gpt_irq_acknowledge(void) | |||
105 | __raw_writel(V2_TSTAT_OF1, timer_base + V2_TSTAT); | 105 | __raw_writel(V2_TSTAT_OF1, timer_base + V2_TSTAT); |
106 | } | 106 | } |
107 | 107 | ||
108 | static cycle_t dummy_get_cycles(struct clocksource *cs) | ||
109 | { | ||
110 | return 0; | ||
111 | } | ||
112 | |||
108 | static cycle_t mx1_2_get_cycles(struct clocksource *cs) | 113 | static cycle_t mx1_2_get_cycles(struct clocksource *cs) |
109 | { | 114 | { |
110 | return __raw_readl(timer_base + MX1_2_TCN); | 115 | return __raw_readl(timer_base + MX1_2_TCN); |
@@ -118,7 +123,7 @@ static cycle_t v2_get_cycles(struct clocksource *cs) | |||
118 | static struct clocksource clocksource_mxc = { | 123 | static struct clocksource clocksource_mxc = { |
119 | .name = "mxc_timer1", | 124 | .name = "mxc_timer1", |
120 | .rating = 200, | 125 | .rating = 200, |
121 | .read = mx1_2_get_cycles, | 126 | .read = dummy_get_cycles, |
122 | .mask = CLOCKSOURCE_MASK(32), | 127 | .mask = CLOCKSOURCE_MASK(32), |
123 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 128 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
124 | }; | 129 | }; |
@@ -129,6 +134,8 @@ static int __init mxc_clocksource_init(struct clk *timer_clk) | |||
129 | 134 | ||
130 | if (timer_is_v2()) | 135 | if (timer_is_v2()) |
131 | clocksource_mxc.read = v2_get_cycles; | 136 | clocksource_mxc.read = v2_get_cycles; |
137 | else | ||
138 | clocksource_mxc.read = mx1_2_get_cycles; | ||
132 | 139 | ||
133 | clocksource_register_hz(&clocksource_mxc, c); | 140 | clocksource_register_hz(&clocksource_mxc, c); |
134 | 141 | ||