1 From 9cb47bf175645d15f97e6d964dd4a4f089275ef5 Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Tue, 13 Aug 2013 11:43:13 -0300
4 Subject: [PATCH 168/203] clocksource: armada-370-xp: Introduce new compatibles
6 The Armada XP SoC clocksource driver cannot work without the 25 MHz
7 fixed timer. Therefore it's appropriate to introduce a new compatible
8 string and use it to set the 25 MHz fixed timer.
10 The 'marvell,timer-25MHz' property will be marked as deprecated.
12 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
13 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
14 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
16 drivers/clocksource/time-armada-370-xp.c | 54 +++++++++++++++++++++++---------
17 1 file changed, 39 insertions(+), 15 deletions(-)
19 --- a/drivers/clocksource/time-armada-370-xp.c
20 +++ b/drivers/clocksource/time-armada-370-xp.c
23 * Timer 0 is used as free-running clocksource, while timer 1 is
24 * used as clock_event_device.
27 + * Clocksource driver for Armada 370 and Armada XP SoC.
28 + * This driver implements one compatible string for each SoC, given
29 + * each has its own characteristics:
31 + * * Armada 370 has no 25 MHz fixed timer.
33 + * * Armada XP cannot work properly without such 25 MHz fixed timer as
34 + * doing otherwise leads to using a clocksource whose frequency varies
35 + * when doing cpufreq frequency changes.
37 + * See Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt
40 #include <linux/init.h>
41 @@ -212,7 +225,7 @@ static struct local_timer_ops armada_370
42 .stop = armada_370_xp_timer_stop,
45 -static void __init armada_370_xp_timer_init(struct device_node *np)
46 +static void __init armada_370_xp_timer_common_init(struct device_node *np)
50 @@ -221,20 +234,10 @@ static void __init armada_370_xp_timer_i
52 local_base = of_iomap(np, 1);
54 - if (of_find_property(np, "marvell,timer-25Mhz", NULL)) {
55 - /* The fixed 25MHz timer is available so let's use it */
58 - timer_clk = 25000000;
60 - unsigned long rate = 0;
61 - struct clk *clk = of_clk_get(np, 0);
62 - WARN_ON(IS_ERR(clk));
63 - rate = clk_get_rate(clk);
64 - timer_clk = rate / TIMER_DIVIDER;
70 timer_ctrl_clrset(clr, set);
71 local_timer_ctrl_clrset(clr, set);
73 @@ -288,5 +291,26 @@ static void __init armada_370_xp_timer_i
77 -CLOCKSOURCE_OF_DECLARE(armada_370_xp, "marvell,armada-370-xp-timer",
78 - armada_370_xp_timer_init);
80 +static void __init armada_xp_timer_init(struct device_node *np)
82 + /* The fixed 25MHz timer is required, timer25Mhz is true by default */
83 + timer_clk = 25000000;
85 + armada_370_xp_timer_common_init(np);
87 +CLOCKSOURCE_OF_DECLARE(armada_xp, "marvell,armada-xp-timer",
88 + armada_xp_timer_init);
90 +static void __init armada_370_timer_init(struct device_node *np)
92 + struct clk *clk = of_clk_get(np, 0);
94 + WARN_ON(IS_ERR(clk));
95 + timer_clk = clk_get_rate(clk) / TIMER_DIVIDER;
98 + armada_370_xp_timer_common_init(np);
100 +CLOCKSOURCE_OF_DECLARE(armada_370, "marvell,armada-370-timer",
101 + armada_370_timer_init);