summaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc/time.c
diff options
context:
space:
mode:
authorJan Weitzel <j.weitzel@phytec.de>2011-03-17 13:44:29 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-03-23 15:08:12 +0100
commit93b20e4fdbe1ddc4bef79d968cb1ba453324a499 (patch)
tree0bc9719659ea8bed908199944cbcc510355b2b57 /arch/arm/plat-mxc/time.c
parent350ac9ddce074855030b88c9e8c016574d2e9097 (diff)
downloadlinux-93b20e4fdbe1ddc4bef79d968cb1ba453324a499.tar.gz
linux-93b20e4fdbe1ddc4bef79d968cb1ba453324a499.tar.bz2
linux-93b20e4fdbe1ddc4bef79d968cb1ba453324a499.zip
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>
Diffstat (limited to 'arch/arm/plat-mxc/time.c')
-rw-r--r--arch/arm/plat-mxc/time.c9
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)
__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)
{
return __raw_readl(timer_base + MX1_2_TCN);
@@ -118,7 +123,7 @@ static cycle_t v2_get_cycles(struct clocksource *cs)
static struct clocksource clocksource_mxc = {
.name = "mxc_timer1",
.rating = 200,
- .read = mx1_2_get_cycles,
+ .read = dummy_get_cycles,
.mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
@@ -129,6 +134,8 @@ static int __init mxc_clocksource_init(struct clk *timer_clk)
if (timer_is_v2())
clocksource_mxc.read = v2_get_cycles;
+ else
+ clocksource_mxc.read = mx1_2_get_cycles;
clocksource_register_hz(&clocksource_mxc, c);