aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>2014-11-04 08:21:33 -0500
committerDaniel Lezcano <daniel.lezcano@linaro.org>2014-11-26 07:51:08 -0500
commit4a22d9c93af1f2b2c40354c4bc59fd007f33f05e (patch)
tree490a796cf43f6e08c474ff71df8023a47603f2ec
parent8067042ad9543b410b7dc355ec312c2b61979eec (diff)
clocksource: armada-370-xp: Use the reference clock on A375 SoC
The 25 MHz reference clock has better stability so its use is preferred over the core clock. This commit takes advantage of the already introduced Armada 375 devicetree compatible string and adds a new timer initialization. If available, the timer will use the reference clock (named as 'fixed'). Otherwise, it falls back to the previous behavior. Acked-by: Jason Cooper <jason@lakedaemon.net> Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Acked-by: Wim Van Sebroeck <wim@iguana.be> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt9
-rw-r--r--drivers/clocksource/time-armada-370-xp.c28
2 files changed, 34 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt b/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt
index f455182b1086..e9c78ce880e6 100644
--- a/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt
+++ b/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt
@@ -2,8 +2,10 @@ Marvell Armada 370 and Armada XP Timers
2--------------------------------------- 2---------------------------------------
3 3
4Required properties: 4Required properties:
5- compatible: Should be either "marvell,armada-370-timer" or 5- compatible: Should be one of the following
6 "marvell,armada-xp-timer" as appropriate. 6 "marvell,armada-370-timer",
7 "marvell,armada-375-timer",
8 "marvell,armada-xp-timer".
7- interrupts: Should contain the list of Global Timer interrupts and 9- interrupts: Should contain the list of Global Timer interrupts and
8 then local timer interrupts 10 then local timer interrupts
9- reg: Should contain location and length for timers register. First 11- reg: Should contain location and length for timers register. First
@@ -13,7 +15,8 @@ Required properties:
13Clocks required for compatible = "marvell,armada-370-timer": 15Clocks required for compatible = "marvell,armada-370-timer":
14- clocks : Must contain a single entry describing the clock input 16- clocks : Must contain a single entry describing the clock input
15 17
16Clocks required for compatible = "marvell,armada-xp-timer": 18Clocks required for compatibles = "marvell,armada-xp-timer",
19 "marvell,armada-375-timer":
17- clocks : Must contain an entry for each entry in clock-names. 20- clocks : Must contain an entry for each entry in clock-names.
18- clock-names : Must include the following entries: 21- clock-names : Must include the following entries:
19 "nbclk" (L2/coherency fabric clock), 22 "nbclk" (L2/coherency fabric clock),
diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
index d8555f9edc50..3a0704b0d739 100644
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -301,6 +301,34 @@ static void __init armada_xp_timer_init(struct device_node *np)
301CLOCKSOURCE_OF_DECLARE(armada_xp, "marvell,armada-xp-timer", 301CLOCKSOURCE_OF_DECLARE(armada_xp, "marvell,armada-xp-timer",
302 armada_xp_timer_init); 302 armada_xp_timer_init);
303 303
304static void __init armada_375_timer_init(struct device_node *np)
305{
306 struct clk *clk;
307
308 clk = of_clk_get_by_name(np, "fixed");
309 if (!IS_ERR(clk)) {
310 clk_prepare_enable(clk);
311 timer_clk = clk_get_rate(clk);
312 } else {
313
314 /*
315 * This fallback is required in order to retain proper
316 * devicetree backwards compatibility.
317 */
318 clk = of_clk_get(np, 0);
319
320 /* Must have at least a clock */
321 BUG_ON(IS_ERR(clk));
322 clk_prepare_enable(clk);
323 timer_clk = clk_get_rate(clk) / TIMER_DIVIDER;
324 timer25Mhz = false;
325 }
326
327 armada_370_xp_timer_common_init(np);
328}
329CLOCKSOURCE_OF_DECLARE(armada_375, "marvell,armada-375-timer",
330 armada_375_timer_init);
331
304static void __init armada_370_timer_init(struct device_node *np) 332static void __init armada_370_timer_init(struct device_node *np)
305{ 333{
306 struct clk *clk = of_clk_get(np, 0); 334 struct clk *clk = of_clk_get(np, 0);