diff options
author | Ezequiel Garcia <ezequiel.garcia@free-electrons.com> | 2013-08-13 10:43:13 -0400 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2013-09-02 15:44:03 -0400 |
commit | 7cd6392c9bf5da6986103fcf5ca1b6fd0489d9b4 (patch) | |
tree | eb37885afb39733b3101cb3876e125a0f35d05f9 | |
parent | 573145f08c2b92c45498468afbbba909f6ce6135 (diff) |
clocksource: armada-370-xp: Introduce new compatibles
The Armada XP SoC clocksource driver cannot work without the 25 MHz
fixed timer. Therefore it's appropriate to introduce a new compatible
string and use it to set the 25 MHz fixed timer.
The 'marvell,timer-25MHz' property will be marked as deprecated.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
-rw-r--r-- | drivers/clocksource/time-armada-370-xp.c | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c index 1e4b523f27c1..86a354cca215 100644 --- a/drivers/clocksource/time-armada-370-xp.c +++ b/drivers/clocksource/time-armada-370-xp.c | |||
@@ -13,6 +13,19 @@ | |||
13 | * | 13 | * |
14 | * Timer 0 is used as free-running clocksource, while timer 1 is | 14 | * Timer 0 is used as free-running clocksource, while timer 1 is |
15 | * used as clock_event_device. | 15 | * used as clock_event_device. |
16 | * | ||
17 | * --- | ||
18 | * Clocksource driver for Armada 370 and Armada XP SoC. | ||
19 | * This driver implements one compatible string for each SoC, given | ||
20 | * each has its own characteristics: | ||
21 | * | ||
22 | * * Armada 370 has no 25 MHz fixed timer. | ||
23 | * | ||
24 | * * Armada XP cannot work properly without such 25 MHz fixed timer as | ||
25 | * doing otherwise leads to using a clocksource whose frequency varies | ||
26 | * when doing cpufreq frequency changes. | ||
27 | * | ||
28 | * See Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt | ||
16 | */ | 29 | */ |
17 | 30 | ||
18 | #include <linux/init.h> | 31 | #include <linux/init.h> |
@@ -212,7 +225,7 @@ static struct local_timer_ops armada_370_xp_local_timer_ops = { | |||
212 | .stop = armada_370_xp_timer_stop, | 225 | .stop = armada_370_xp_timer_stop, |
213 | }; | 226 | }; |
214 | 227 | ||
215 | static void __init armada_370_xp_timer_init(struct device_node *np) | 228 | static void __init armada_370_xp_timer_common_init(struct device_node *np) |
216 | { | 229 | { |
217 | u32 clr = 0, set = 0; | 230 | u32 clr = 0, set = 0; |
218 | int res; | 231 | int res; |
@@ -221,20 +234,10 @@ static void __init armada_370_xp_timer_init(struct device_node *np) | |||
221 | WARN_ON(!timer_base); | 234 | WARN_ON(!timer_base); |
222 | local_base = of_iomap(np, 1); | 235 | local_base = of_iomap(np, 1); |
223 | 236 | ||
224 | if (of_find_property(np, "marvell,timer-25Mhz", NULL)) { | 237 | if (timer25Mhz) |
225 | /* The fixed 25MHz timer is available so let's use it */ | ||
226 | set = TIMER0_25MHZ; | 238 | set = TIMER0_25MHZ; |
227 | timer_clk = 25000000; | 239 | else |
228 | } else { | ||
229 | unsigned long rate = 0; | ||
230 | struct clk *clk = of_clk_get(np, 0); | ||
231 | WARN_ON(IS_ERR(clk)); | ||
232 | rate = clk_get_rate(clk); | ||
233 | timer_clk = rate / TIMER_DIVIDER; | ||
234 | |||
235 | clr = TIMER0_25MHZ; | 240 | clr = TIMER0_25MHZ; |
236 | timer25Mhz = false; | ||
237 | } | ||
238 | timer_ctrl_clrset(clr, set); | 241 | timer_ctrl_clrset(clr, set); |
239 | local_timer_ctrl_clrset(clr, set); | 242 | local_timer_ctrl_clrset(clr, set); |
240 | 243 | ||
@@ -288,5 +291,26 @@ static void __init armada_370_xp_timer_init(struct device_node *np) | |||
288 | #endif | 291 | #endif |
289 | } | 292 | } |
290 | } | 293 | } |
291 | CLOCKSOURCE_OF_DECLARE(armada_370_xp, "marvell,armada-370-xp-timer", | 294 | |
292 | armada_370_xp_timer_init); | 295 | static void __init armada_xp_timer_init(struct device_node *np) |
296 | { | ||
297 | /* The fixed 25MHz timer is required, timer25Mhz is true by default */ | ||
298 | timer_clk = 25000000; | ||
299 | |||
300 | armada_370_xp_timer_common_init(np); | ||
301 | } | ||
302 | CLOCKSOURCE_OF_DECLARE(armada_xp, "marvell,armada-xp-timer", | ||
303 | armada_xp_timer_init); | ||
304 | |||
305 | static void __init armada_370_timer_init(struct device_node *np) | ||
306 | { | ||
307 | struct clk *clk = of_clk_get(np, 0); | ||
308 | |||
309 | WARN_ON(IS_ERR(clk)); | ||
310 | timer_clk = clk_get_rate(clk) / TIMER_DIVIDER; | ||
311 | timer25Mhz = false; | ||
312 | |||
313 | armada_370_xp_timer_common_init(np); | ||
314 | } | ||
315 | CLOCKSOURCE_OF_DECLARE(armada_370, "marvell,armada-370-timer", | ||
316 | armada_370_timer_init); | ||