aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2013-07-16 10:45:38 -0400
committerDaniel Lezcano <daniel.lezcano@linaro.org>2013-07-18 09:27:20 -0400
commita2c49e7b553a28f10ab34e5da538ed4a45a697a7 (patch)
treec7df1aea139b0f271641eb02886741d15e1e9cbc /drivers/clocksource
parentc2b852f77b0d4c71967b61848d666c7a25e17627 (diff)
clocksource: sun4i: Cleanup parent clock setup
The current bring-up code for the timer was overly complicated. The only thing we need is actually which clock we want to use as source and that's pretty much all. Let's keep it that way. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/sun4i_timer.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c
index 3217adc7457c..2fadb3ba59db 100644
--- a/drivers/clocksource/sun4i_timer.c
+++ b/drivers/clocksource/sun4i_timer.c
@@ -30,6 +30,9 @@
30#define TIMER_CTL_REG(val) (0x10 * val + 0x10) 30#define TIMER_CTL_REG(val) (0x10 * val + 0x10)
31#define TIMER_CTL_ENABLE BIT(0) 31#define TIMER_CTL_ENABLE BIT(0)
32#define TIMER_CTL_RELOAD BIT(1) 32#define TIMER_CTL_RELOAD BIT(1)
33#define TIMER_CTL_CLK_SRC(val) (((val) & 0x3) << 2)
34#define TIMER_CTL_CLK_SRC_OSC24M (1)
35#define TIMER_CTL_CLK_PRES(val) (((val) & 0x7) << 4)
33#define TIMER_CTL_ONESHOT BIT(7) 36#define TIMER_CTL_ONESHOT BIT(7)
34#define TIMER_INTVAL_REG(val) (0x10 * (val) + 0x14) 37#define TIMER_INTVAL_REG(val) (0x10 * (val) + 0x14)
35#define TIMER_CNTVAL_REG(val) (0x10 * (val) + 0x18) 38#define TIMER_CNTVAL_REG(val) (0x10 * (val) + 0x18)
@@ -168,16 +171,8 @@ static void __init sun4i_timer_init(struct device_node *node)
168 171
169 writel(rate / HZ, timer_base + TIMER_INTVAL_REG(0)); 172 writel(rate / HZ, timer_base + TIMER_INTVAL_REG(0));
170 173
171 /* set clock source to HOSC, 16 pre-division */ 174 writel(TIMER_CTL_CLK_SRC(TIMER_CTL_CLK_SRC_OSC24M) | TIMER_CTL_RELOAD,
172 val = readl(timer_base + TIMER_CTL_REG(0)); 175 timer_base + TIMER_CTL_REG(0));
173 val &= ~(0x07 << 4);
174 val &= ~(0x03 << 2);
175 val |= (4 << 4) | (1 << 2);
176 writel(val, timer_base + TIMER_CTL_REG(0));
177
178 /* set mode to auto reload */
179 val = readl(timer_base + TIMER_CTL_REG(0));
180 writel(val | TIMER_CTL_RELOAD, timer_base + TIMER_CTL_REG(0));
181 176
182 ret = setup_irq(irq, &sun4i_timer_irq); 177 ret = setup_irq(irq, &sun4i_timer_irq);
183 if (ret) 178 if (ret)