diff options
author | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2012-11-17 09:22:29 -0500 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2012-11-20 08:44:00 -0500 |
commit | c4c34d608482b48c1c007fecea5a7a5c65168fa2 (patch) | |
tree | 3da57b6fd49826983b81f8a34d9eb9d49c4e169a | |
parent | f97d0d7aa8f8cec29a24d65afa12a777c6d2a2f1 (diff) |
clk: mvebu: armada 370/XP add clock gating control provider for DT
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r-- | Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt | 43 | ||||
-rw-r--r-- | drivers/clk/mvebu/clk-gating-ctrl.c | 74 |
2 files changed, 116 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt b/Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt index 4ad8ccd15e67..7337005ef5e1 100644 --- a/Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt +++ b/Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt | |||
@@ -6,6 +6,49 @@ the clock ID in its "clocks" phandle cell. The clock ID is directly mapped to | |||
6 | the corresponding clock gating control bit in HW to ease manual clock lookup | 6 | the corresponding clock gating control bit in HW to ease manual clock lookup |
7 | in datasheet. | 7 | in datasheet. |
8 | 8 | ||
9 | The following is a list of provided IDs for Armada 370: | ||
10 | ID Clock Peripheral | ||
11 | ----------------------------------- | ||
12 | 0 Audio AC97 Cntrl | ||
13 | 1 pex0_en PCIe 0 Clock out | ||
14 | 2 pex1_en PCIe 1 Clock out | ||
15 | 3 ge1 Gigabit Ethernet 1 | ||
16 | 4 ge0 Gigabit Ethernet 0 | ||
17 | 5 pex0 PCIe Cntrl 0 | ||
18 | 9 pex1 PCIe Cntrl 1 | ||
19 | 15 sata0 SATA Host 0 | ||
20 | 17 sdio SDHCI Host | ||
21 | 25 tdm Time Division Mplx | ||
22 | 28 ddr DDR Cntrl | ||
23 | 30 sata1 SATA Host 0 | ||
24 | |||
25 | The following is a list of provided IDs for Armada XP: | ||
26 | ID Clock Peripheral | ||
27 | ----------------------------------- | ||
28 | 0 audio Audio Cntrl | ||
29 | 1 ge3 Gigabit Ethernet 3 | ||
30 | 2 ge2 Gigabit Ethernet 2 | ||
31 | 3 ge1 Gigabit Ethernet 1 | ||
32 | 4 ge0 Gigabit Ethernet 0 | ||
33 | 5 pex0 PCIe Cntrl 0 | ||
34 | 6 pex1 PCIe Cntrl 1 | ||
35 | 7 pex2 PCIe Cntrl 2 | ||
36 | 8 pex3 PCIe Cntrl 3 | ||
37 | 13 bp | ||
38 | 14 sata0lnk | ||
39 | 15 sata0 SATA Host 0 | ||
40 | 16 lcd LCD Cntrl | ||
41 | 17 sdio SDHCI Host | ||
42 | 18 usb0 USB Host 0 | ||
43 | 19 usb1 USB Host 1 | ||
44 | 20 usb2 USB Host 2 | ||
45 | 22 xor0 XOR DMA 0 | ||
46 | 23 crypto CESA engine | ||
47 | 25 tdm Time Division Mplx | ||
48 | 28 xor1 XOR DMA 1 | ||
49 | 29 sata1lnk | ||
50 | 30 sata1 SATA Host 0 | ||
51 | |||
9 | The following is a list of provided IDs for Dove: | 52 | The following is a list of provided IDs for Dove: |
10 | ID Clock Peripheral | 53 | ID Clock Peripheral |
11 | ----------------------------------- | 54 | ----------------------------------- |
diff --git a/drivers/clk/mvebu/clk-gating-ctrl.c b/drivers/clk/mvebu/clk-gating-ctrl.c index fa69f87c5797..c6d3c263b070 100644 --- a/drivers/clk/mvebu/clk-gating-ctrl.c +++ b/drivers/clk/mvebu/clk-gating-ctrl.c | |||
@@ -88,10 +88,21 @@ static void __init mvebu_clk_gating_setup( | |||
88 | } | 88 | } |
89 | 89 | ||
90 | for (n = 0; n < ctrl->num_gates; n++) { | 90 | for (n = 0; n < ctrl->num_gates; n++) { |
91 | u8 flags = 0; | ||
91 | const char *parent = | 92 | const char *parent = |
92 | (descr[n].parent) ? descr[n].parent : default_parent; | 93 | (descr[n].parent) ? descr[n].parent : default_parent; |
94 | |||
95 | /* | ||
96 | * On Armada 370, the DDR clock is a special case: it | ||
97 | * isn't taken by any driver, but should anyway be | ||
98 | * kept enabled, so we mark it as IGNORE_UNUSED for | ||
99 | * now. | ||
100 | */ | ||
101 | if (!strcmp(descr[n].name, "ddr")) | ||
102 | flags |= CLK_IGNORE_UNUSED; | ||
103 | |||
93 | ctrl->gates[n] = clk_register_gate(NULL, descr[n].name, parent, | 104 | ctrl->gates[n] = clk_register_gate(NULL, descr[n].name, parent, |
94 | 0, base, descr[n].bit_idx, 0, &ctrl->lock); | 105 | flags, base, descr[n].bit_idx, 0, &ctrl->lock); |
95 | WARN_ON(IS_ERR(ctrl->gates[n])); | 106 | WARN_ON(IS_ERR(ctrl->gates[n])); |
96 | } | 107 | } |
97 | of_clk_add_provider(np, mvebu_clk_gating_get_src, ctrl); | 108 | of_clk_add_provider(np, mvebu_clk_gating_get_src, ctrl); |
@@ -101,6 +112,53 @@ static void __init mvebu_clk_gating_setup( | |||
101 | * SoC specific clock gating control | 112 | * SoC specific clock gating control |
102 | */ | 113 | */ |
103 | 114 | ||
115 | #ifdef CONFIG_MACH_ARMADA_370 | ||
116 | static const struct mvebu_soc_descr __initconst armada_370_gating_descr[] = { | ||
117 | { "audio", NULL, 0 }, | ||
118 | { "pex0_en", NULL, 1 }, | ||
119 | { "pex1_en", NULL, 2 }, | ||
120 | { "ge1", NULL, 3 }, | ||
121 | { "ge0", NULL, 4 }, | ||
122 | { "pex0", NULL, 5 }, | ||
123 | { "pex1", NULL, 9 }, | ||
124 | { "sata0", NULL, 15 }, | ||
125 | { "sdio", NULL, 17 }, | ||
126 | { "tdm", NULL, 25 }, | ||
127 | { "ddr", NULL, 28 }, | ||
128 | { "sata1", NULL, 30 }, | ||
129 | { } | ||
130 | }; | ||
131 | #endif | ||
132 | |||
133 | #ifdef CONFIG_MACH_ARMADA_XP | ||
134 | static const struct mvebu_soc_descr __initconst armada_xp_gating_descr[] = { | ||
135 | { "audio", NULL, 0 }, | ||
136 | { "ge3", NULL, 1 }, | ||
137 | { "ge2", NULL, 2 }, | ||
138 | { "ge1", NULL, 3 }, | ||
139 | { "ge0", NULL, 4 }, | ||
140 | { "pex0", NULL, 5 }, | ||
141 | { "pex1", NULL, 6 }, | ||
142 | { "pex2", NULL, 7 }, | ||
143 | { "pex3", NULL, 8 }, | ||
144 | { "bp", NULL, 13 }, | ||
145 | { "sata0lnk", NULL, 14 }, | ||
146 | { "sata0", "sata0lnk", 15 }, | ||
147 | { "lcd", NULL, 16 }, | ||
148 | { "sdio", NULL, 17 }, | ||
149 | { "usb0", NULL, 18 }, | ||
150 | { "usb1", NULL, 19 }, | ||
151 | { "usb2", NULL, 20 }, | ||
152 | { "xor0", NULL, 22 }, | ||
153 | { "crypto", NULL, 23 }, | ||
154 | { "tdm", NULL, 25 }, | ||
155 | { "xor1", NULL, 28 }, | ||
156 | { "sata1lnk", NULL, 29 }, | ||
157 | { "sata1", "sata1lnk", 30 }, | ||
158 | { } | ||
159 | }; | ||
160 | #endif | ||
161 | |||
104 | #ifdef CONFIG_ARCH_DOVE | 162 | #ifdef CONFIG_ARCH_DOVE |
105 | static const struct mvebu_soc_descr __initconst dove_gating_descr[] = { | 163 | static const struct mvebu_soc_descr __initconst dove_gating_descr[] = { |
106 | { "usb0", NULL, 0 }, | 164 | { "usb0", NULL, 0 }, |
@@ -147,6 +205,20 @@ static const struct mvebu_soc_descr __initconst kirkwood_gating_descr[] = { | |||
147 | #endif | 205 | #endif |
148 | 206 | ||
149 | static const __initdata struct of_device_id clk_gating_match[] = { | 207 | static const __initdata struct of_device_id clk_gating_match[] = { |
208 | #ifdef CONFIG_MACH_ARMADA_370 | ||
209 | { | ||
210 | .compatible = "marvell,armada-370-gating-clock", | ||
211 | .data = armada_370_gating_descr, | ||
212 | }, | ||
213 | #endif | ||
214 | |||
215 | #ifdef CONFIG_MACH_ARMADA_XP | ||
216 | { | ||
217 | .compatible = "marvell,armada-xp-gating-clock", | ||
218 | .data = armada_xp_gating_descr, | ||
219 | }, | ||
220 | #endif | ||
221 | |||
150 | #ifdef CONFIG_ARCH_DOVE | 222 | #ifdef CONFIG_ARCH_DOVE |
151 | { | 223 | { |
152 | .compatible = "marvell,dove-gating-clock", | 224 | .compatible = "marvell,dove-gating-clock", |