diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2014-04-17 05:06:45 -0400 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2014-04-22 07:56:50 -0400 |
commit | e50a00be5c420b4f28836dec281cdde4bed832a2 (patch) | |
tree | ced5d90749486cf68f9c7f8c5a35365d5c8125a1 /drivers/clocksource | |
parent | a5e11117856147bd35e740b36939f3a8a958e1e6 (diff) |
clocksource: sun5i: Add support for reset controller
The Allwinner A31 that uses this timer has the timer IP asserted in reset.
Add an optional reset property to the DT, and deassert the timer from reset if
it's there.
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/timer-sun5i.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c index deebcd6469fc..02268448dc85 100644 --- a/drivers/clocksource/timer-sun5i.c +++ b/drivers/clocksource/timer-sun5i.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
18 | #include <linux/irqreturn.h> | 18 | #include <linux/irqreturn.h> |
19 | #include <linux/reset.h> | ||
19 | #include <linux/sched_clock.h> | 20 | #include <linux/sched_clock.h> |
20 | #include <linux/of.h> | 21 | #include <linux/of.h> |
21 | #include <linux/of_address.h> | 22 | #include <linux/of_address.h> |
@@ -143,6 +144,7 @@ static u64 sun5i_timer_sched_read(void) | |||
143 | 144 | ||
144 | static void __init sun5i_timer_init(struct device_node *node) | 145 | static void __init sun5i_timer_init(struct device_node *node) |
145 | { | 146 | { |
147 | struct reset_control *rstc; | ||
146 | unsigned long rate; | 148 | unsigned long rate; |
147 | struct clk *clk; | 149 | struct clk *clk; |
148 | int ret, irq; | 150 | int ret, irq; |
@@ -162,6 +164,10 @@ static void __init sun5i_timer_init(struct device_node *node) | |||
162 | clk_prepare_enable(clk); | 164 | clk_prepare_enable(clk); |
163 | rate = clk_get_rate(clk); | 165 | rate = clk_get_rate(clk); |
164 | 166 | ||
167 | rstc = of_reset_control_get(node, NULL); | ||
168 | if (!IS_ERR(rstc)) | ||
169 | reset_control_deassert(rstc); | ||
170 | |||
165 | writel(~0, timer_base + TIMER_INTVAL_LO_REG(1)); | 171 | writel(~0, timer_base + TIMER_INTVAL_LO_REG(1)); |
166 | writel(TIMER_CTL_ENABLE | TIMER_CTL_RELOAD, | 172 | writel(TIMER_CTL_ENABLE | TIMER_CTL_RELOAD, |
167 | timer_base + TIMER_CTL_REG(1)); | 173 | timer_base + TIMER_CTL_REG(1)); |