Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Gregory CLEMENT and committed by
Thomas Petazzoni
c4c34d60 f97d0d7a

+116 -1
+43
Documentation/devicetree/bindings/clock/mvebu-gated-clock.txt
··· 6 6 the corresponding clock gating control bit in HW to ease manual clock lookup 7 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 52 The following is a list of provided IDs for Dove: 10 53 ID Clock Peripheral 11 54 -----------------------------------
+73 -1
drivers/clk/mvebu/clk-gating-ctrl.c
··· 88 88 } 89 89 90 90 for (n = 0; n < ctrl->num_gates; n++) { 91 + u8 flags = 0; 91 92 const char *parent = 92 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 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 106 WARN_ON(IS_ERR(ctrl->gates[n])); 96 107 } 97 108 of_clk_add_provider(np, mvebu_clk_gating_get_src, ctrl); ··· 111 100 /* 112 101 * SoC specific clock gating control 113 102 */ 103 + 104 + #ifdef CONFIG_MACH_ARMADA_370 105 + static const struct mvebu_soc_descr __initconst armada_370_gating_descr[] = { 106 + { "audio", NULL, 0 }, 107 + { "pex0_en", NULL, 1 }, 108 + { "pex1_en", NULL, 2 }, 109 + { "ge1", NULL, 3 }, 110 + { "ge0", NULL, 4 }, 111 + { "pex0", NULL, 5 }, 112 + { "pex1", NULL, 9 }, 113 + { "sata0", NULL, 15 }, 114 + { "sdio", NULL, 17 }, 115 + { "tdm", NULL, 25 }, 116 + { "ddr", NULL, 28 }, 117 + { "sata1", NULL, 30 }, 118 + { } 119 + }; 120 + #endif 121 + 122 + #ifdef CONFIG_MACH_ARMADA_XP 123 + static const struct mvebu_soc_descr __initconst armada_xp_gating_descr[] = { 124 + { "audio", NULL, 0 }, 125 + { "ge3", NULL, 1 }, 126 + { "ge2", NULL, 2 }, 127 + { "ge1", NULL, 3 }, 128 + { "ge0", NULL, 4 }, 129 + { "pex0", NULL, 5 }, 130 + { "pex1", NULL, 6 }, 131 + { "pex2", NULL, 7 }, 132 + { "pex3", NULL, 8 }, 133 + { "bp", NULL, 13 }, 134 + { "sata0lnk", NULL, 14 }, 135 + { "sata0", "sata0lnk", 15 }, 136 + { "lcd", NULL, 16 }, 137 + { "sdio", NULL, 17 }, 138 + { "usb0", NULL, 18 }, 139 + { "usb1", NULL, 19 }, 140 + { "usb2", NULL, 20 }, 141 + { "xor0", NULL, 22 }, 142 + { "crypto", NULL, 23 }, 143 + { "tdm", NULL, 25 }, 144 + { "xor1", NULL, 28 }, 145 + { "sata1lnk", NULL, 29 }, 146 + { "sata1", "sata1lnk", 30 }, 147 + { } 148 + }; 149 + #endif 114 150 115 151 #ifdef CONFIG_ARCH_DOVE 116 152 static const struct mvebu_soc_descr __initconst dove_gating_descr[] = { ··· 205 147 #endif 206 148 207 149 static const __initdata struct of_device_id clk_gating_match[] = { 150 + #ifdef CONFIG_MACH_ARMADA_370 151 + { 152 + .compatible = "marvell,armada-370-gating-clock", 153 + .data = armada_370_gating_descr, 154 + }, 155 + #endif 156 + 157 + #ifdef CONFIG_MACH_ARMADA_XP 158 + { 159 + .compatible = "marvell,armada-xp-gating-clock", 160 + .data = armada_xp_gating_descr, 161 + }, 162 + #endif 163 + 208 164 #ifdef CONFIG_ARCH_DOVE 209 165 { 210 166 .compatible = "marvell,dove-gating-clock",