Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 2 | /* |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 3 | * |
John Crispin | 97b9210 | 2016-05-05 09:57:56 +0200 | [diff] [blame] | 4 | * Copyright (C) 2011-2012 John Crispin <john@phrozen.org> |
Hauke Mehrtens | cab7b83 | 2015-10-28 23:37:30 +0100 | [diff] [blame] | 5 | * Copyright (C) 2013-2015 Lantiq Beteiligungs-GmbH & Co.KG |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <linux/ioport.h> |
| 9 | #include <linux/export.h> |
| 10 | #include <linux/clkdev.h> |
Hauke Mehrtens | 758d244 | 2015-10-28 23:37:31 +0100 | [diff] [blame] | 11 | #include <linux/spinlock.h> |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 12 | #include <linux/of.h> |
| 13 | #include <linux/of_platform.h> |
| 14 | #include <linux/of_address.h> |
| 15 | |
| 16 | #include <lantiq_soc.h> |
| 17 | |
| 18 | #include "../clk.h" |
| 19 | #include "../prom.h" |
| 20 | |
Hauke Mehrtens | 758d244 | 2015-10-28 23:37:31 +0100 | [diff] [blame] | 21 | /* clock control register for legacy */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 22 | #define CGU_IFCCR 0x0018 |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 23 | #define CGU_IFCCR_VR9 0x0024 |
Hauke Mehrtens | 758d244 | 2015-10-28 23:37:31 +0100 | [diff] [blame] | 24 | /* system clock register for legacy */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 25 | #define CGU_SYS 0x0010 |
| 26 | /* pci control register */ |
| 27 | #define CGU_PCICR 0x0034 |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 28 | #define CGU_PCICR_VR9 0x0038 |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 29 | /* ephy configuration register */ |
| 30 | #define CGU_EPHY 0x10 |
Hauke Mehrtens | 758d244 | 2015-10-28 23:37:31 +0100 | [diff] [blame] | 31 | |
| 32 | /* Legacy PMU register for ar9, ase, danube */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 33 | /* power control register */ |
| 34 | #define PMU_PWDCR 0x1C |
| 35 | /* power status register */ |
| 36 | #define PMU_PWDSR 0x20 |
| 37 | /* power control register */ |
| 38 | #define PMU_PWDCR1 0x24 |
| 39 | /* power status register */ |
| 40 | #define PMU_PWDSR1 0x28 |
| 41 | /* power control register */ |
| 42 | #define PWDCR(x) ((x) ? (PMU_PWDCR1) : (PMU_PWDCR)) |
| 43 | /* power status register */ |
| 44 | #define PWDSR(x) ((x) ? (PMU_PWDSR1) : (PMU_PWDSR)) |
| 45 | |
Hauke Mehrtens | 758d244 | 2015-10-28 23:37:31 +0100 | [diff] [blame] | 46 | |
| 47 | /* PMU register for ar10 and grx390 */ |
| 48 | |
| 49 | /* First register set */ |
| 50 | #define PMU_CLK_SR 0x20 /* status */ |
| 51 | #define PMU_CLK_CR_A 0x24 /* Enable */ |
| 52 | #define PMU_CLK_CR_B 0x28 /* Disable */ |
| 53 | /* Second register set */ |
| 54 | #define PMU_CLK_SR1 0x30 /* status */ |
| 55 | #define PMU_CLK_CR1_A 0x34 /* Enable */ |
| 56 | #define PMU_CLK_CR1_B 0x38 /* Disable */ |
| 57 | /* Third register set */ |
| 58 | #define PMU_ANA_SR 0x40 /* status */ |
| 59 | #define PMU_ANA_CR_A 0x44 /* Enable */ |
| 60 | #define PMU_ANA_CR_B 0x48 /* Disable */ |
| 61 | |
| 62 | /* Status */ |
| 63 | static u32 pmu_clk_sr[] = { |
| 64 | PMU_CLK_SR, |
| 65 | PMU_CLK_SR1, |
| 66 | PMU_ANA_SR, |
| 67 | }; |
| 68 | |
| 69 | /* Enable */ |
| 70 | static u32 pmu_clk_cr_a[] = { |
| 71 | PMU_CLK_CR_A, |
| 72 | PMU_CLK_CR1_A, |
| 73 | PMU_ANA_CR_A, |
| 74 | }; |
| 75 | |
| 76 | /* Disable */ |
| 77 | static u32 pmu_clk_cr_b[] = { |
| 78 | PMU_CLK_CR_B, |
| 79 | PMU_CLK_CR1_B, |
| 80 | PMU_ANA_CR_B, |
| 81 | }; |
| 82 | |
| 83 | #define PWDCR_EN_XRX(x) (pmu_clk_cr_a[(x)]) |
| 84 | #define PWDCR_DIS_XRX(x) (pmu_clk_cr_b[(x)]) |
| 85 | #define PWDSR_XRX(x) (pmu_clk_sr[(x)]) |
| 86 | |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 87 | /* clock gates that we can en/disable */ |
| 88 | #define PMU_USB0_P BIT(0) |
Hauke Mehrtens | e182c98 | 2015-10-28 23:37:36 +0100 | [diff] [blame] | 89 | #define PMU_ASE_SDIO BIT(2) /* ASE special */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 90 | #define PMU_PCI BIT(4) |
John Crispin | 009d691 | 2012-04-19 16:23:14 +0200 | [diff] [blame] | 91 | #define PMU_DMA BIT(5) |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 92 | #define PMU_USB0 BIT(6) |
| 93 | #define PMU_ASC0 BIT(7) |
| 94 | #define PMU_EPHY BIT(7) /* ase */ |
Hauke Mehrtens | e182c98 | 2015-10-28 23:37:36 +0100 | [diff] [blame] | 95 | #define PMU_USIF BIT(7) /* from vr9 until grx390 */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 96 | #define PMU_SPI BIT(8) |
| 97 | #define PMU_DFE BIT(9) |
| 98 | #define PMU_EBU BIT(10) |
| 99 | #define PMU_STP BIT(11) |
John Crispin | 009d691 | 2012-04-19 16:23:14 +0200 | [diff] [blame] | 100 | #define PMU_GPT BIT(12) |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 101 | #define PMU_AHBS BIT(13) /* vr9 */ |
John Crispin | 009d691 | 2012-04-19 16:23:14 +0200 | [diff] [blame] | 102 | #define PMU_FPI BIT(14) |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 103 | #define PMU_AHBM BIT(15) |
Hauke Mehrtens | e182c98 | 2015-10-28 23:37:36 +0100 | [diff] [blame] | 104 | #define PMU_SDIO BIT(16) /* danube, ar9, vr9 */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 105 | #define PMU_ASC1 BIT(17) |
| 106 | #define PMU_PPE_QSB BIT(18) |
| 107 | #define PMU_PPE_SLL01 BIT(19) |
Hauke Mehrtens | e71f6d3 | 2015-10-28 23:37:41 +0100 | [diff] [blame] | 108 | #define PMU_DEU BIT(20) |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 109 | #define PMU_PPE_TC BIT(21) |
| 110 | #define PMU_PPE_EMA BIT(22) |
| 111 | #define PMU_PPE_DPLUM BIT(23) |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 112 | #define PMU_PPE_DP BIT(23) |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 113 | #define PMU_PPE_DPLUS BIT(24) |
| 114 | #define PMU_USB1_P BIT(26) |
Aleksander Jan Bajkowski | 58c9e24 | 2020-08-10 20:09:46 +0200 | [diff] [blame] | 115 | #define PMU_GPHY3 BIT(26) /* grx390 */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 116 | #define PMU_USB1 BIT(27) |
John Crispin | 009d691 | 2012-04-19 16:23:14 +0200 | [diff] [blame] | 117 | #define PMU_SWITCH BIT(28) |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 118 | #define PMU_PPE_TOP BIT(29) |
Aleksander Jan Bajkowski | 58c9e24 | 2020-08-10 20:09:46 +0200 | [diff] [blame] | 119 | #define PMU_GPHY0 BIT(29) /* ar10, xrx390 */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 120 | #define PMU_GPHY BIT(30) |
Aleksander Jan Bajkowski | 58c9e24 | 2020-08-10 20:09:46 +0200 | [diff] [blame] | 121 | #define PMU_GPHY1 BIT(30) /* ar10, xrx390 */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 122 | #define PMU_PCIE_CLK BIT(31) |
Aleksander Jan Bajkowski | 58c9e24 | 2020-08-10 20:09:46 +0200 | [diff] [blame] | 123 | #define PMU_GPHY2 BIT(31) /* ar10, xrx390 */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 124 | |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 125 | #define PMU1_PCIE_PHY BIT(0) /* vr9-specific,moved in ar10/grx390 */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 126 | #define PMU1_PCIE_CTL BIT(1) |
| 127 | #define PMU1_PCIE_PDI BIT(4) |
| 128 | #define PMU1_PCIE_MSI BIT(5) |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 129 | #define PMU1_CKE BIT(6) |
| 130 | #define PMU1_PCIE1_CTL BIT(17) |
| 131 | #define PMU1_PCIE1_PDI BIT(20) |
| 132 | #define PMU1_PCIE1_MSI BIT(21) |
| 133 | #define PMU1_PCIE2_CTL BIT(25) |
| 134 | #define PMU1_PCIE2_PDI BIT(26) |
| 135 | #define PMU1_PCIE2_MSI BIT(27) |
| 136 | |
| 137 | #define PMU_ANALOG_USB0_P BIT(0) |
| 138 | #define PMU_ANALOG_USB1_P BIT(1) |
| 139 | #define PMU_ANALOG_PCIE0_P BIT(8) |
| 140 | #define PMU_ANALOG_PCIE1_P BIT(9) |
| 141 | #define PMU_ANALOG_PCIE2_P BIT(10) |
| 142 | #define PMU_ANALOG_DSL_AFE BIT(16) |
| 143 | #define PMU_ANALOG_DCDC_2V5 BIT(17) |
| 144 | #define PMU_ANALOG_DCDC_1VX BIT(18) |
| 145 | #define PMU_ANALOG_DCDC_1V0 BIT(19) |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 146 | |
| 147 | #define pmu_w32(x, y) ltq_w32((x), pmu_membase + (y)) |
| 148 | #define pmu_r32(x) ltq_r32(pmu_membase + (x)) |
| 149 | |
| 150 | static void __iomem *pmu_membase; |
| 151 | void __iomem *ltq_cgu_membase; |
| 152 | void __iomem *ltq_ebu_membase; |
| 153 | |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 154 | static u32 ifccr = CGU_IFCCR; |
| 155 | static u32 pcicr = CGU_PCICR; |
| 156 | |
Hauke Mehrtens | cab7b83 | 2015-10-28 23:37:30 +0100 | [diff] [blame] | 157 | static DEFINE_SPINLOCK(g_pmu_lock); |
| 158 | |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 159 | /* legacy function kept alive to ease clkdev transition */ |
| 160 | void ltq_pmu_enable(unsigned int module) |
| 161 | { |
Hauke Mehrtens | cab7b83 | 2015-10-28 23:37:30 +0100 | [diff] [blame] | 162 | int retry = 1000000; |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 163 | |
Hauke Mehrtens | cab7b83 | 2015-10-28 23:37:30 +0100 | [diff] [blame] | 164 | spin_lock(&g_pmu_lock); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 165 | pmu_w32(pmu_r32(PMU_PWDCR) & ~module, PMU_PWDCR); |
Hauke Mehrtens | cab7b83 | 2015-10-28 23:37:30 +0100 | [diff] [blame] | 166 | do {} while (--retry && (pmu_r32(PMU_PWDSR) & module)); |
| 167 | spin_unlock(&g_pmu_lock); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 168 | |
Hauke Mehrtens | cab7b83 | 2015-10-28 23:37:30 +0100 | [diff] [blame] | 169 | if (!retry) |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 170 | panic("activating PMU module failed!"); |
| 171 | } |
| 172 | EXPORT_SYMBOL(ltq_pmu_enable); |
| 173 | |
| 174 | /* legacy function kept alive to ease clkdev transition */ |
| 175 | void ltq_pmu_disable(unsigned int module) |
| 176 | { |
Hauke Mehrtens | cab7b83 | 2015-10-28 23:37:30 +0100 | [diff] [blame] | 177 | int retry = 1000000; |
| 178 | |
| 179 | spin_lock(&g_pmu_lock); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 180 | pmu_w32(pmu_r32(PMU_PWDCR) | module, PMU_PWDCR); |
Hauke Mehrtens | cab7b83 | 2015-10-28 23:37:30 +0100 | [diff] [blame] | 181 | do {} while (--retry && (!(pmu_r32(PMU_PWDSR) & module))); |
| 182 | spin_unlock(&g_pmu_lock); |
| 183 | |
| 184 | if (!retry) |
| 185 | pr_warn("deactivating PMU module failed!"); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 186 | } |
| 187 | EXPORT_SYMBOL(ltq_pmu_disable); |
| 188 | |
| 189 | /* enable a hw clock */ |
| 190 | static int cgu_enable(struct clk *clk) |
| 191 | { |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 192 | ltq_cgu_w32(ltq_cgu_r32(ifccr) | clk->bits, ifccr); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 193 | return 0; |
| 194 | } |
| 195 | |
| 196 | /* disable a hw clock */ |
| 197 | static void cgu_disable(struct clk *clk) |
| 198 | { |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 199 | ltq_cgu_w32(ltq_cgu_r32(ifccr) & ~clk->bits, ifccr); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | /* enable a clock gate */ |
| 203 | static int pmu_enable(struct clk *clk) |
| 204 | { |
| 205 | int retry = 1000000; |
| 206 | |
Hauke Mehrtens | 758d244 | 2015-10-28 23:37:31 +0100 | [diff] [blame] | 207 | if (of_machine_is_compatible("lantiq,ar10") |
| 208 | || of_machine_is_compatible("lantiq,grx390")) { |
| 209 | pmu_w32(clk->bits, PWDCR_EN_XRX(clk->module)); |
| 210 | do {} while (--retry && |
| 211 | (!(pmu_r32(PWDSR_XRX(clk->module)) & clk->bits))); |
| 212 | |
| 213 | } else { |
| 214 | spin_lock(&g_pmu_lock); |
| 215 | pmu_w32(pmu_r32(PWDCR(clk->module)) & ~clk->bits, |
| 216 | PWDCR(clk->module)); |
| 217 | do {} while (--retry && |
| 218 | (pmu_r32(PWDSR(clk->module)) & clk->bits)); |
| 219 | spin_unlock(&g_pmu_lock); |
| 220 | } |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 221 | |
| 222 | if (!retry) |
Ralf Baechle | f7777dc | 2013-09-18 16:05:26 +0200 | [diff] [blame] | 223 | panic("activating PMU module failed!"); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 224 | |
| 225 | return 0; |
| 226 | } |
| 227 | |
| 228 | /* disable a clock gate */ |
| 229 | static void pmu_disable(struct clk *clk) |
| 230 | { |
Hauke Mehrtens | cab7b83 | 2015-10-28 23:37:30 +0100 | [diff] [blame] | 231 | int retry = 1000000; |
| 232 | |
Hauke Mehrtens | 758d244 | 2015-10-28 23:37:31 +0100 | [diff] [blame] | 233 | if (of_machine_is_compatible("lantiq,ar10") |
| 234 | || of_machine_is_compatible("lantiq,grx390")) { |
| 235 | pmu_w32(clk->bits, PWDCR_DIS_XRX(clk->module)); |
| 236 | do {} while (--retry && |
| 237 | (pmu_r32(PWDSR_XRX(clk->module)) & clk->bits)); |
| 238 | } else { |
| 239 | spin_lock(&g_pmu_lock); |
| 240 | pmu_w32(pmu_r32(PWDCR(clk->module)) | clk->bits, |
| 241 | PWDCR(clk->module)); |
| 242 | do {} while (--retry && |
| 243 | (!(pmu_r32(PWDSR(clk->module)) & clk->bits))); |
| 244 | spin_unlock(&g_pmu_lock); |
| 245 | } |
Hauke Mehrtens | cab7b83 | 2015-10-28 23:37:30 +0100 | [diff] [blame] | 246 | |
| 247 | if (!retry) |
| 248 | pr_warn("deactivating PMU module failed!"); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | /* the pci enable helper */ |
| 252 | static int pci_enable(struct clk *clk) |
| 253 | { |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 254 | unsigned int val = ltq_cgu_r32(ifccr); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 255 | /* set bus clock speed */ |
John Crispin | f40e1f9 | 2012-08-16 08:25:42 +0000 | [diff] [blame] | 256 | if (of_machine_is_compatible("lantiq,ar9") || |
| 257 | of_machine_is_compatible("lantiq,vr9")) { |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 258 | val &= ~0x1f00000; |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 259 | if (clk->rate == CLOCK_33M) |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 260 | val |= 0xe00000; |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 261 | else |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 262 | val |= 0x700000; /* 62.5M */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 263 | } else { |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 264 | val &= ~0xf00000; |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 265 | if (clk->rate == CLOCK_33M) |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 266 | val |= 0x800000; |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 267 | else |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 268 | val |= 0x400000; /* 62.5M */ |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 269 | } |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 270 | ltq_cgu_w32(val, ifccr); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 271 | pmu_enable(clk); |
| 272 | return 0; |
| 273 | } |
| 274 | |
| 275 | /* enable the external clock as a source */ |
| 276 | static int pci_ext_enable(struct clk *clk) |
| 277 | { |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 278 | ltq_cgu_w32(ltq_cgu_r32(ifccr) & ~(1 << 16), ifccr); |
| 279 | ltq_cgu_w32((1 << 30), pcicr); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 280 | return 0; |
| 281 | } |
| 282 | |
| 283 | /* disable the external clock as a source */ |
| 284 | static void pci_ext_disable(struct clk *clk) |
| 285 | { |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 286 | ltq_cgu_w32(ltq_cgu_r32(ifccr) | (1 << 16), ifccr); |
| 287 | ltq_cgu_w32((1 << 31) | (1 << 30), pcicr); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | /* enable a clockout source */ |
| 291 | static int clkout_enable(struct clk *clk) |
| 292 | { |
| 293 | int i; |
| 294 | |
| 295 | /* get the correct rate */ |
| 296 | for (i = 0; i < 4; i++) { |
| 297 | if (clk->rates[i] == clk->rate) { |
| 298 | int shift = 14 - (2 * clk->module); |
John Crispin | 98dbc57 | 2012-07-24 08:56:41 +0200 | [diff] [blame] | 299 | int enable = 7 - clk->module; |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 300 | unsigned int val = ltq_cgu_r32(ifccr); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 301 | |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 302 | val &= ~(3 << shift); |
| 303 | val |= i << shift; |
John Crispin | 98dbc57 | 2012-07-24 08:56:41 +0200 | [diff] [blame] | 304 | val |= enable; |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 305 | ltq_cgu_w32(val, ifccr); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 306 | return 0; |
| 307 | } |
| 308 | } |
| 309 | return -1; |
| 310 | } |
| 311 | |
| 312 | /* manage the clock gates via PMU */ |
Hauke Mehrtens | 95135bf | 2015-10-28 23:37:35 +0100 | [diff] [blame] | 313 | static void clkdev_add_pmu(const char *dev, const char *con, bool deactivate, |
| 314 | unsigned int module, unsigned int bits) |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 315 | { |
| 316 | struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL); |
| 317 | |
| 318 | clk->cl.dev_id = dev; |
| 319 | clk->cl.con_id = con; |
| 320 | clk->cl.clk = clk; |
| 321 | clk->enable = pmu_enable; |
| 322 | clk->disable = pmu_disable; |
| 323 | clk->module = module; |
| 324 | clk->bits = bits; |
Hauke Mehrtens | 95135bf | 2015-10-28 23:37:35 +0100 | [diff] [blame] | 325 | if (deactivate) { |
| 326 | /* |
| 327 | * Disable it during the initialization. Module should enable |
| 328 | * when used |
| 329 | */ |
| 330 | pmu_disable(clk); |
| 331 | } |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 332 | clkdev_add(&clk->cl); |
| 333 | } |
| 334 | |
| 335 | /* manage the clock generator */ |
| 336 | static void clkdev_add_cgu(const char *dev, const char *con, |
| 337 | unsigned int bits) |
| 338 | { |
| 339 | struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL); |
| 340 | |
| 341 | clk->cl.dev_id = dev; |
| 342 | clk->cl.con_id = con; |
| 343 | clk->cl.clk = clk; |
| 344 | clk->enable = cgu_enable; |
| 345 | clk->disable = cgu_disable; |
| 346 | clk->bits = bits; |
| 347 | clkdev_add(&clk->cl); |
| 348 | } |
| 349 | |
| 350 | /* pci needs its own enable function as the setup is a bit more complex */ |
| 351 | static unsigned long valid_pci_rates[] = {CLOCK_33M, CLOCK_62_5M, 0}; |
| 352 | |
| 353 | static void clkdev_add_pci(void) |
| 354 | { |
| 355 | struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL); |
| 356 | struct clk *clk_ext = kzalloc(sizeof(struct clk), GFP_KERNEL); |
| 357 | |
| 358 | /* main pci clock */ |
| 359 | clk->cl.dev_id = "17000000.pci"; |
| 360 | clk->cl.con_id = NULL; |
| 361 | clk->cl.clk = clk; |
| 362 | clk->rate = CLOCK_33M; |
| 363 | clk->rates = valid_pci_rates; |
| 364 | clk->enable = pci_enable; |
| 365 | clk->disable = pmu_disable; |
| 366 | clk->module = 0; |
| 367 | clk->bits = PMU_PCI; |
| 368 | clkdev_add(&clk->cl); |
| 369 | |
| 370 | /* use internal/external bus clock */ |
| 371 | clk_ext->cl.dev_id = "17000000.pci"; |
| 372 | clk_ext->cl.con_id = "external"; |
| 373 | clk_ext->cl.clk = clk_ext; |
| 374 | clk_ext->enable = pci_ext_enable; |
| 375 | clk_ext->disable = pci_ext_disable; |
| 376 | clkdev_add(&clk_ext->cl); |
| 377 | } |
| 378 | |
| 379 | /* xway socs can generate clocks on gpio pins */ |
| 380 | static unsigned long valid_clkout_rates[4][5] = { |
| 381 | {CLOCK_32_768K, CLOCK_1_536M, CLOCK_2_5M, CLOCK_12M, 0}, |
| 382 | {CLOCK_40M, CLOCK_12M, CLOCK_24M, CLOCK_48M, 0}, |
| 383 | {CLOCK_25M, CLOCK_40M, CLOCK_30M, CLOCK_60M, 0}, |
| 384 | {CLOCK_12M, CLOCK_50M, CLOCK_32_768K, CLOCK_25M, 0}, |
| 385 | }; |
| 386 | |
| 387 | static void clkdev_add_clkout(void) |
| 388 | { |
| 389 | int i; |
| 390 | |
| 391 | for (i = 0; i < 4; i++) { |
| 392 | struct clk *clk; |
| 393 | char *name; |
| 394 | |
| 395 | name = kzalloc(sizeof("clkout0"), GFP_KERNEL); |
| 396 | sprintf(name, "clkout%d", i); |
| 397 | |
| 398 | clk = kzalloc(sizeof(struct clk), GFP_KERNEL); |
| 399 | clk->cl.dev_id = "1f103000.cgu"; |
| 400 | clk->cl.con_id = name; |
| 401 | clk->cl.clk = clk; |
| 402 | clk->rate = 0; |
| 403 | clk->rates = valid_clkout_rates[i]; |
| 404 | clk->enable = clkout_enable; |
| 405 | clk->module = i; |
| 406 | clkdev_add(&clk->cl); |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | /* bring up all register ranges that we need for basic system control */ |
| 411 | void __init ltq_soc_init(void) |
| 412 | { |
| 413 | struct resource res_pmu, res_cgu, res_ebu; |
| 414 | struct device_node *np_pmu = |
| 415 | of_find_compatible_node(NULL, NULL, "lantiq,pmu-xway"); |
| 416 | struct device_node *np_cgu = |
| 417 | of_find_compatible_node(NULL, NULL, "lantiq,cgu-xway"); |
| 418 | struct device_node *np_ebu = |
| 419 | of_find_compatible_node(NULL, NULL, "lantiq,ebu-xway"); |
| 420 | |
| 421 | /* check if all the core register ranges are available */ |
| 422 | if (!np_pmu || !np_cgu || !np_ebu) |
John Crispin | 3d18c17 | 2013-01-19 08:54:23 +0000 | [diff] [blame] | 423 | panic("Failed to load core nodes from devicetree"); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 424 | |
| 425 | if (of_address_to_resource(np_pmu, 0, &res_pmu) || |
| 426 | of_address_to_resource(np_cgu, 0, &res_cgu) || |
| 427 | of_address_to_resource(np_ebu, 0, &res_ebu)) |
| 428 | panic("Failed to get core resources"); |
| 429 | |
Hauke Mehrtens | 6e80785 | 2015-10-28 23:37:44 +0100 | [diff] [blame] | 430 | if (!request_mem_region(res_pmu.start, resource_size(&res_pmu), |
| 431 | res_pmu.name) || |
| 432 | !request_mem_region(res_cgu.start, resource_size(&res_cgu), |
| 433 | res_cgu.name) || |
| 434 | !request_mem_region(res_ebu.start, resource_size(&res_ebu), |
| 435 | res_ebu.name)) |
Masanari Iida | 1a84db5 | 2014-08-29 23:37:33 +0900 | [diff] [blame] | 436 | pr_err("Failed to request core resources"); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 437 | |
Christoph Hellwig | 4bdc0d6 | 2020-01-06 09:43:50 +0100 | [diff] [blame] | 438 | pmu_membase = ioremap(res_pmu.start, resource_size(&res_pmu)); |
| 439 | ltq_cgu_membase = ioremap(res_cgu.start, |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 440 | resource_size(&res_cgu)); |
Christoph Hellwig | 4bdc0d6 | 2020-01-06 09:43:50 +0100 | [diff] [blame] | 441 | ltq_ebu_membase = ioremap(res_ebu.start, |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 442 | resource_size(&res_ebu)); |
| 443 | if (!pmu_membase || !ltq_cgu_membase || !ltq_ebu_membase) |
| 444 | panic("Failed to remap core resources"); |
| 445 | |
| 446 | /* make sure to unprotect the memory region where flash is located */ |
| 447 | ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_BUSCON0) & ~EBU_WRDIS, LTQ_EBU_BUSCON0); |
| 448 | |
| 449 | /* add our generic xway clocks */ |
Hauke Mehrtens | 95135bf | 2015-10-28 23:37:35 +0100 | [diff] [blame] | 450 | clkdev_add_pmu("10000000.fpi", NULL, 0, 0, PMU_FPI); |
Hauke Mehrtens | 95135bf | 2015-10-28 23:37:35 +0100 | [diff] [blame] | 451 | clkdev_add_pmu("1e100a00.gptu", NULL, 1, 0, PMU_GPT); |
| 452 | clkdev_add_pmu("1e100bb0.stp", NULL, 1, 0, PMU_STP); |
Martin Schiller | 44a374c | 2017-05-30 06:34:34 +0200 | [diff] [blame] | 453 | clkdev_add_pmu("1e100c00.serial", NULL, 0, 0, PMU_ASC1); |
Hauke Mehrtens | 95135bf | 2015-10-28 23:37:35 +0100 | [diff] [blame] | 454 | clkdev_add_pmu("1e104100.dma", NULL, 1, 0, PMU_DMA); |
| 455 | clkdev_add_pmu("1e100800.spi", NULL, 1, 0, PMU_SPI); |
| 456 | clkdev_add_pmu("1e105300.ebu", NULL, 0, 0, PMU_EBU); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 457 | clkdev_add_clkout(); |
| 458 | |
| 459 | /* add the soc dependent clocks */ |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 460 | if (of_machine_is_compatible("lantiq,vr9")) { |
| 461 | ifccr = CGU_IFCCR_VR9; |
| 462 | pcicr = CGU_PCICR_VR9; |
| 463 | } else { |
Hauke Mehrtens | 95135bf | 2015-10-28 23:37:35 +0100 | [diff] [blame] | 464 | clkdev_add_pmu("1e180000.etop", NULL, 1, 0, PMU_PPE); |
John Crispin | e29b72f | 2012-07-22 08:55:57 +0200 | [diff] [blame] | 465 | } |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 466 | |
Martin Schiller | 44a374c | 2017-05-30 06:34:34 +0200 | [diff] [blame] | 467 | if (!of_machine_is_compatible("lantiq,ase")) |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 468 | clkdev_add_pci(); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 469 | |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 470 | if (of_machine_is_compatible("lantiq,grx390") || |
| 471 | of_machine_is_compatible("lantiq,ar10")) { |
Aleksander Jan Bajkowski | 58c9e24 | 2020-08-10 20:09:46 +0200 | [diff] [blame] | 472 | clkdev_add_pmu("1e108000.switch", "gphy0", 0, 0, PMU_GPHY0); |
| 473 | clkdev_add_pmu("1e108000.switch", "gphy1", 0, 0, PMU_GPHY1); |
| 474 | clkdev_add_pmu("1e108000.switch", "gphy2", 0, 0, PMU_GPHY2); |
Hauke Mehrtens | dea54fb | 2017-08-20 00:18:21 +0200 | [diff] [blame] | 475 | clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 2, PMU_ANALOG_USB0_P); |
| 476 | clkdev_add_pmu("1f203034.usb2-phy", "phy", 1, 2, PMU_ANALOG_USB1_P); |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 477 | /* rc 0 */ |
Martin Blumenstingl | ed90302 | 2019-07-27 14:04:15 +0200 | [diff] [blame] | 478 | clkdev_add_pmu("1f106800.phy", "phy", 1, 2, PMU_ANALOG_PCIE0_P); |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 479 | clkdev_add_pmu("1d900000.pcie", "msi", 1, 1, PMU1_PCIE_MSI); |
Martin Blumenstingl | ed90302 | 2019-07-27 14:04:15 +0200 | [diff] [blame] | 480 | clkdev_add_pmu("1f106800.phy", "pdi", 1, 1, PMU1_PCIE_PDI); |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 481 | clkdev_add_pmu("1d900000.pcie", "ctl", 1, 1, PMU1_PCIE_CTL); |
| 482 | /* rc 1 */ |
Martin Blumenstingl | ed90302 | 2019-07-27 14:04:15 +0200 | [diff] [blame] | 483 | clkdev_add_pmu("1f700400.phy", "phy", 1, 2, PMU_ANALOG_PCIE1_P); |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 484 | clkdev_add_pmu("19000000.pcie", "msi", 1, 1, PMU1_PCIE1_MSI); |
Martin Blumenstingl | ed90302 | 2019-07-27 14:04:15 +0200 | [diff] [blame] | 485 | clkdev_add_pmu("1f700400.phy", "pdi", 1, 1, PMU1_PCIE1_PDI); |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 486 | clkdev_add_pmu("19000000.pcie", "ctl", 1, 1, PMU1_PCIE1_CTL); |
| 487 | } |
| 488 | |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 489 | if (of_machine_is_compatible("lantiq,ase")) { |
| 490 | if (ltq_cgu_r32(CGU_SYS) & (1 << 5)) |
John Crispin | 740c606e | 2013-01-19 08:54:24 +0000 | [diff] [blame] | 491 | clkdev_add_static(CLOCK_266M, CLOCK_133M, |
| 492 | CLOCK_133M, CLOCK_266M); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 493 | else |
John Crispin | 740c606e | 2013-01-19 08:54:24 +0000 | [diff] [blame] | 494 | clkdev_add_static(CLOCK_133M, CLOCK_133M, |
| 495 | CLOCK_133M, CLOCK_133M); |
Hauke Mehrtens | dea54fb | 2017-08-20 00:18:21 +0200 | [diff] [blame] | 496 | clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0); |
| 497 | clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P); |
Hauke Mehrtens | e182c98 | 2015-10-28 23:37:36 +0100 | [diff] [blame] | 498 | clkdev_add_pmu("1e180000.etop", "ppe", 1, 0, PMU_PPE); |
| 499 | clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY); |
Hauke Mehrtens | 95135bf | 2015-10-28 23:37:35 +0100 | [diff] [blame] | 500 | clkdev_add_pmu("1e180000.etop", "ephy", 1, 0, PMU_EPHY); |
Hauke Mehrtens | e182c98 | 2015-10-28 23:37:36 +0100 | [diff] [blame] | 501 | clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_ASE_SDIO); |
Hauke Mehrtens | a3a6853 | 2015-10-28 23:37:40 +0100 | [diff] [blame] | 502 | clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE); |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 503 | } else if (of_machine_is_compatible("lantiq,grx390")) { |
| 504 | clkdev_add_static(ltq_grx390_cpu_hz(), ltq_grx390_fpi_hz(), |
| 505 | ltq_grx390_fpi_hz(), ltq_grx390_pp32_hz()); |
Aleksander Jan Bajkowski | 58c9e24 | 2020-08-10 20:09:46 +0200 | [diff] [blame] | 506 | clkdev_add_pmu("1e108000.switch", "gphy3", 0, 0, PMU_GPHY3); |
Hauke Mehrtens | dea54fb | 2017-08-20 00:18:21 +0200 | [diff] [blame] | 507 | clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0); |
| 508 | clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1); |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 509 | /* rc 2 */ |
Martin Blumenstingl | ed90302 | 2019-07-27 14:04:15 +0200 | [diff] [blame] | 510 | clkdev_add_pmu("1f106a00.pcie", "phy", 1, 2, PMU_ANALOG_PCIE2_P); |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 511 | clkdev_add_pmu("1a800000.pcie", "msi", 1, 1, PMU1_PCIE2_MSI); |
Martin Blumenstingl | ed90302 | 2019-07-27 14:04:15 +0200 | [diff] [blame] | 512 | clkdev_add_pmu("1f106a00.pcie", "pdi", 1, 1, PMU1_PCIE2_PDI); |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 513 | clkdev_add_pmu("1a800000.pcie", "ctl", 1, 1, PMU1_PCIE2_CTL); |
Hauke Mehrtens | fe1a564 | 2018-09-09 22:16:45 +0200 | [diff] [blame] | 514 | clkdev_add_pmu("1e10b308.eth", NULL, 0, 0, PMU_SWITCH | PMU_PPE_DP); |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 515 | clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF); |
Hauke Mehrtens | e71f6d3 | 2015-10-28 23:37:41 +0100 | [diff] [blame] | 516 | clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU); |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 517 | } else if (of_machine_is_compatible("lantiq,ar10")) { |
| 518 | clkdev_add_static(ltq_ar10_cpu_hz(), ltq_ar10_fpi_hz(), |
| 519 | ltq_ar10_fpi_hz(), ltq_ar10_pp32_hz()); |
Hauke Mehrtens | dea54fb | 2017-08-20 00:18:21 +0200 | [diff] [blame] | 520 | clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0); |
| 521 | clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1); |
Hauke Mehrtens | fe1a564 | 2018-09-09 22:16:45 +0200 | [diff] [blame] | 522 | clkdev_add_pmu("1e10b308.eth", NULL, 0, 0, PMU_SWITCH | |
Hauke Mehrtens | d0b991e | 2015-10-28 23:37:37 +0100 | [diff] [blame] | 523 | PMU_PPE_DP | PMU_PPE_TC); |
| 524 | clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF); |
Hauke Mehrtens | e71f6d3 | 2015-10-28 23:37:41 +0100 | [diff] [blame] | 525 | clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU); |
Hauke Mehrtens | a3a6853 | 2015-10-28 23:37:40 +0100 | [diff] [blame] | 526 | clkdev_add_pmu("1e116000.mei", "afe", 1, 2, PMU_ANALOG_DSL_AFE); |
| 527 | clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 528 | } else if (of_machine_is_compatible("lantiq,vr9")) { |
| 529 | clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(), |
John Crispin | 740c606e | 2013-01-19 08:54:24 +0000 | [diff] [blame] | 530 | ltq_vr9_fpi_hz(), ltq_vr9_pp32_hz()); |
Hauke Mehrtens | dea54fb | 2017-08-20 00:18:21 +0200 | [diff] [blame] | 531 | clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P); |
| 532 | clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0 | PMU_AHBM); |
| 533 | clkdev_add_pmu("1f203034.usb2-phy", "phy", 1, 0, PMU_USB1_P); |
| 534 | clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1 | PMU_AHBM); |
Martin Blumenstingl | ed90302 | 2019-07-27 14:04:15 +0200 | [diff] [blame] | 535 | clkdev_add_pmu("1f106800.phy", "phy", 1, 1, PMU1_PCIE_PHY); |
Hauke Mehrtens | 95135bf | 2015-10-28 23:37:35 +0100 | [diff] [blame] | 536 | clkdev_add_pmu("1d900000.pcie", "bus", 1, 0, PMU_PCIE_CLK); |
| 537 | clkdev_add_pmu("1d900000.pcie", "msi", 1, 1, PMU1_PCIE_MSI); |
Martin Blumenstingl | ed90302 | 2019-07-27 14:04:15 +0200 | [diff] [blame] | 538 | clkdev_add_pmu("1f106800.phy", "pdi", 1, 1, PMU1_PCIE_PDI); |
Hauke Mehrtens | 95135bf | 2015-10-28 23:37:35 +0100 | [diff] [blame] | 539 | clkdev_add_pmu("1d900000.pcie", "ctl", 1, 1, PMU1_PCIE_CTL); |
Hauke Mehrtens | 5072d81 | 2015-10-28 23:37:42 +0100 | [diff] [blame] | 540 | clkdev_add_pmu(NULL, "ahb", 1, 0, PMU_AHBM | PMU_AHBS); |
Hauke Mehrtens | e182c98 | 2015-10-28 23:37:36 +0100 | [diff] [blame] | 541 | |
| 542 | clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF); |
Hauke Mehrtens | fe1a564 | 2018-09-09 22:16:45 +0200 | [diff] [blame] | 543 | clkdev_add_pmu("1e10b308.eth", NULL, 0, 0, |
John Crispin | f2bbe41 | 2012-11-09 13:34:18 +0100 | [diff] [blame] | 544 | PMU_SWITCH | PMU_PPE_DPLUS | PMU_PPE_DPLUM | |
| 545 | PMU_PPE_EMA | PMU_PPE_TC | PMU_PPE_SLL01 | |
| 546 | PMU_PPE_QSB | PMU_PPE_TOP); |
Martin Blumenstingl | 03e62fd | 2020-06-07 15:10:23 +0200 | [diff] [blame] | 547 | clkdev_add_pmu("1e108000.switch", "gphy0", 0, 0, PMU_GPHY); |
| 548 | clkdev_add_pmu("1e108000.switch", "gphy1", 0, 0, PMU_GPHY); |
Hauke Mehrtens | e182c98 | 2015-10-28 23:37:36 +0100 | [diff] [blame] | 549 | clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO); |
Hauke Mehrtens | e71f6d3 | 2015-10-28 23:37:41 +0100 | [diff] [blame] | 550 | clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU); |
Hauke Mehrtens | a3a6853 | 2015-10-28 23:37:40 +0100 | [diff] [blame] | 551 | clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 552 | } else if (of_machine_is_compatible("lantiq,ar9")) { |
| 553 | clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(), |
John Crispin | 740c606e | 2013-01-19 08:54:24 +0000 | [diff] [blame] | 554 | ltq_ar9_fpi_hz(), CLOCK_250M); |
Hauke Mehrtens | dea54fb | 2017-08-20 00:18:21 +0200 | [diff] [blame] | 555 | clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P); |
Mathias Kresin | 3223a5a | 2018-03-16 21:27:29 +0100 | [diff] [blame] | 556 | clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0 | PMU_AHBM); |
Hauke Mehrtens | dea54fb | 2017-08-20 00:18:21 +0200 | [diff] [blame] | 557 | clkdev_add_pmu("1f203034.usb2-phy", "phy", 1, 0, PMU_USB1_P); |
Mathias Kresin | 3223a5a | 2018-03-16 21:27:29 +0100 | [diff] [blame] | 558 | clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1 | PMU_AHBM); |
Hauke Mehrtens | 95135bf | 2015-10-28 23:37:35 +0100 | [diff] [blame] | 559 | clkdev_add_pmu("1e180000.etop", "switch", 1, 0, PMU_SWITCH); |
Hauke Mehrtens | e182c98 | 2015-10-28 23:37:36 +0100 | [diff] [blame] | 560 | clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO); |
Hauke Mehrtens | e71f6d3 | 2015-10-28 23:37:41 +0100 | [diff] [blame] | 561 | clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU); |
Hauke Mehrtens | a3a6853 | 2015-10-28 23:37:40 +0100 | [diff] [blame] | 562 | clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE); |
Hauke Mehrtens | 5072d81 | 2015-10-28 23:37:42 +0100 | [diff] [blame] | 563 | clkdev_add_pmu("1e100400.serial", NULL, 1, 0, PMU_ASC0); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 564 | } else { |
| 565 | clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(), |
John Crispin | 740c606e | 2013-01-19 08:54:24 +0000 | [diff] [blame] | 566 | ltq_danube_fpi_hz(), ltq_danube_pp32_hz()); |
Mathias Kresin | 3223a5a | 2018-03-16 21:27:29 +0100 | [diff] [blame] | 567 | clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0 | PMU_AHBM); |
Hauke Mehrtens | dea54fb | 2017-08-20 00:18:21 +0200 | [diff] [blame] | 568 | clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P); |
Hauke Mehrtens | e182c98 | 2015-10-28 23:37:36 +0100 | [diff] [blame] | 569 | clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO); |
Hauke Mehrtens | e71f6d3 | 2015-10-28 23:37:41 +0100 | [diff] [blame] | 570 | clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU); |
Hauke Mehrtens | a3a6853 | 2015-10-28 23:37:40 +0100 | [diff] [blame] | 571 | clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE); |
Hauke Mehrtens | 5072d81 | 2015-10-28 23:37:42 +0100 | [diff] [blame] | 572 | clkdev_add_pmu("1e100400.serial", NULL, 1, 0, PMU_ASC0); |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 573 | } |
John Crispin | 287e3f3 | 2012-04-17 15:53:19 +0200 | [diff] [blame] | 574 | } |