aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory CLEMENT <gregory.clement@free-electrons.com>2012-11-17 09:22:29 -0500
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2012-11-20 08:44:00 -0500
commitc4c34d608482b48c1c007fecea5a7a5c65168fa2 (patch)
tree3da57b6fd49826983b81f8a34d9eb9d49c4e169a
parentf97d0d7aa8f8cec29a24d65afa12a777c6d2a2f1 (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.txt43
-rw-r--r--drivers/clk/mvebu/clk-gating-ctrl.c74
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
6the corresponding clock gating control bit in HW to ease manual clock lookup 6the corresponding clock gating control bit in HW to ease manual clock lookup
7in datasheet. 7in datasheet.
8 8
9The following is a list of provided IDs for Armada 370:
10ID Clock Peripheral
11-----------------------------------
120 Audio AC97 Cntrl
131 pex0_en PCIe 0 Clock out
142 pex1_en PCIe 1 Clock out
153 ge1 Gigabit Ethernet 1
164 ge0 Gigabit Ethernet 0
175 pex0 PCIe Cntrl 0
189 pex1 PCIe Cntrl 1
1915 sata0 SATA Host 0
2017 sdio SDHCI Host
2125 tdm Time Division Mplx
2228 ddr DDR Cntrl
2330 sata1 SATA Host 0
24
25The following is a list of provided IDs for Armada XP:
26ID Clock Peripheral
27-----------------------------------
280 audio Audio Cntrl
291 ge3 Gigabit Ethernet 3
302 ge2 Gigabit Ethernet 2
313 ge1 Gigabit Ethernet 1
324 ge0 Gigabit Ethernet 0
335 pex0 PCIe Cntrl 0
346 pex1 PCIe Cntrl 1
357 pex2 PCIe Cntrl 2
368 pex3 PCIe Cntrl 3
3713 bp
3814 sata0lnk
3915 sata0 SATA Host 0
4016 lcd LCD Cntrl
4117 sdio SDHCI Host
4218 usb0 USB Host 0
4319 usb1 USB Host 1
4420 usb2 USB Host 2
4522 xor0 XOR DMA 0
4623 crypto CESA engine
4725 tdm Time Division Mplx
4828 xor1 XOR DMA 1
4929 sata1lnk
5030 sata1 SATA Host 0
51
9The following is a list of provided IDs for Dove: 52The following is a list of provided IDs for Dove:
10ID Clock Peripheral 53ID 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
116static 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
134static 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
105static const struct mvebu_soc_descr __initconst dove_gating_descr[] = { 163static 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
149static const __initdata struct of_device_id clk_gating_match[] = { 207static 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",