diff options
author | Jamie Lentin <jm@lentin.co.uk> | 2016-05-19 17:38:23 -0400 |
---|---|---|
committer | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2016-09-21 05:49:09 -0400 |
commit | 57d0ee077af5621102b3d1a0a701150b56e9747c (patch) | |
tree | 46e24e132c414915474b3da300e575e13714ef47 | |
parent | 29b4817d4018df78086157ea3a55c1d9424a7cfc (diff) |
clk: mvebu: Add clk support for the orion5x SoC mv88f5181
Referring to the u-boot sources for the Netgear WNR854T, add support
for the mv88f5181.
[gregory.clement@free-electrons.com: fix commit title]
Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
-rw-r--r-- | Documentation/devicetree/bindings/clock/mvebu-core-clock.txt | 1 | ||||
-rw-r--r-- | drivers/clk/mvebu/orion.c | 70 |
2 files changed, 71 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/clock/mvebu-core-clock.txt b/Documentation/devicetree/bindings/clock/mvebu-core-clock.txt index 670c2af3e931..eb985a633d59 100644 --- a/Documentation/devicetree/bindings/clock/mvebu-core-clock.txt +++ b/Documentation/devicetree/bindings/clock/mvebu-core-clock.txt | |||
@@ -52,6 +52,7 @@ Required properties: | |||
52 | "marvell,dove-core-clock" - for Dove SoC core clocks | 52 | "marvell,dove-core-clock" - for Dove SoC core clocks |
53 | "marvell,kirkwood-core-clock" - for Kirkwood SoC (except mv88f6180) | 53 | "marvell,kirkwood-core-clock" - for Kirkwood SoC (except mv88f6180) |
54 | "marvell,mv88f6180-core-clock" - for Kirkwood MV88f6180 SoC | 54 | "marvell,mv88f6180-core-clock" - for Kirkwood MV88f6180 SoC |
55 | "marvell,mv88f5181-core-clock" - for Orion MV88F5181 SoC | ||
55 | "marvell,mv88f5182-core-clock" - for Orion MV88F5182 SoC | 56 | "marvell,mv88f5182-core-clock" - for Orion MV88F5182 SoC |
56 | "marvell,mv88f5281-core-clock" - for Orion MV88F5281 SoC | 57 | "marvell,mv88f5281-core-clock" - for Orion MV88F5281 SoC |
57 | "marvell,mv88f6183-core-clock" - for Orion MV88F6183 SoC | 58 | "marvell,mv88f6183-core-clock" - for Orion MV88F6183 SoC |
diff --git a/drivers/clk/mvebu/orion.c b/drivers/clk/mvebu/orion.c index fd129566c1ce..a6e5bee23385 100644 --- a/drivers/clk/mvebu/orion.c +++ b/drivers/clk/mvebu/orion.c | |||
@@ -21,6 +21,76 @@ static const struct coreclk_ratio orion_coreclk_ratios[] __initconst = { | |||
21 | }; | 21 | }; |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * Orion 5181 | ||
25 | */ | ||
26 | |||
27 | #define SAR_MV88F5181_TCLK_FREQ 8 | ||
28 | #define SAR_MV88F5181_TCLK_FREQ_MASK 0x3 | ||
29 | |||
30 | static u32 __init mv88f5181_get_tclk_freq(void __iomem *sar) | ||
31 | { | ||
32 | u32 opt = (readl(sar) >> SAR_MV88F5181_TCLK_FREQ) & | ||
33 | SAR_MV88F5181_TCLK_FREQ_MASK; | ||
34 | if (opt == 0) | ||
35 | return 133333333; | ||
36 | else if (opt == 1) | ||
37 | return 150000000; | ||
38 | else if (opt == 2) | ||
39 | return 166666667; | ||
40 | else | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | #define SAR_MV88F5181_CPU_FREQ 4 | ||
45 | #define SAR_MV88F5181_CPU_FREQ_MASK 0xf | ||
46 | |||
47 | static u32 __init mv88f5181_get_cpu_freq(void __iomem *sar) | ||
48 | { | ||
49 | u32 opt = (readl(sar) >> SAR_MV88F5181_CPU_FREQ) & | ||
50 | SAR_MV88F5181_CPU_FREQ_MASK; | ||
51 | if (opt == 0) | ||
52 | return 333333333; | ||
53 | else if (opt == 1 || opt == 2) | ||
54 | return 400000000; | ||
55 | else if (opt == 3) | ||
56 | return 500000000; | ||
57 | else | ||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static void __init mv88f5181_get_clk_ratio(void __iomem *sar, int id, | ||
62 | int *mult, int *div) | ||
63 | { | ||
64 | u32 opt = (readl(sar) >> SAR_MV88F5181_CPU_FREQ) & | ||
65 | SAR_MV88F5181_CPU_FREQ_MASK; | ||
66 | if (opt == 0 || opt == 1) { | ||
67 | *mult = 1; | ||
68 | *div = 2; | ||
69 | } else if (opt == 2 || opt == 3) { | ||
70 | *mult = 1; | ||
71 | *div = 3; | ||
72 | } else { | ||
73 | *mult = 0; | ||
74 | *div = 1; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | static const struct coreclk_soc_desc mv88f5181_coreclks = { | ||
79 | .get_tclk_freq = mv88f5181_get_tclk_freq, | ||
80 | .get_cpu_freq = mv88f5181_get_cpu_freq, | ||
81 | .get_clk_ratio = mv88f5181_get_clk_ratio, | ||
82 | .ratios = orion_coreclk_ratios, | ||
83 | .num_ratios = ARRAY_SIZE(orion_coreclk_ratios), | ||
84 | }; | ||
85 | |||
86 | static void __init mv88f5181_clk_init(struct device_node *np) | ||
87 | { | ||
88 | return mvebu_coreclk_setup(np, &mv88f5181_coreclks); | ||
89 | } | ||
90 | |||
91 | CLK_OF_DECLARE(mv88f5181_clk, "marvell,mv88f5181-core-clock", mv88f5181_clk_init); | ||
92 | |||
93 | /* | ||
24 | * Orion 5182 | 94 | * Orion 5182 |
25 | */ | 95 | */ |
26 | 96 | ||