developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * MediaTek clock driver for MT7622 SoC |
| 4 | * |
| 5 | * Copyright (C) 2019 MediaTek Inc. |
| 6 | * Author: Ryder Lee <ryder.lee@mediatek.com> |
| 7 | */ |
| 8 | |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 9 | #include <dm.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 10 | #include <log.h> |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 11 | #include <asm/arch-mediatek/reset.h> |
| 12 | #include <asm/io.h> |
| 13 | #include <dt-bindings/clock/mt7622-clk.h> |
Simon Glass | 4dcacfc | 2020-05-10 11:40:13 -0600 | [diff] [blame] | 14 | #include <linux/bitops.h> |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 15 | |
| 16 | #include "clk-mtk.h" |
| 17 | |
| 18 | #define MT7622_CLKSQ_STB_CON0 0x20 |
| 19 | #define MT7622_PLL_ISO_CON0 0x2c |
| 20 | #define MT7622_PLL_FMAX (2500UL * MHZ) |
| 21 | #define MT7622_CON0_RST_BAR BIT(24) |
| 22 | |
| 23 | #define MCU_AXI_DIV 0x640 |
| 24 | #define AXI_DIV_MSK GENMASK(4, 0) |
| 25 | #define AXI_DIV_SEL(x) (x) |
| 26 | |
| 27 | #define MCU_BUS_MUX 0x7c0 |
| 28 | #define MCU_BUS_MSK GENMASK(10, 9) |
| 29 | #define MCU_BUS_SEL(x) ((x) << 9) |
| 30 | |
| 31 | /* apmixedsys */ |
| 32 | #define PLL(_id, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, _pd_reg, \ |
| 33 | _pd_shift, _pcw_reg, _pcw_shift) { \ |
| 34 | .id = _id, \ |
| 35 | .reg = _reg, \ |
| 36 | .pwr_reg = _pwr_reg, \ |
| 37 | .en_mask = _en_mask, \ |
| 38 | .rst_bar_mask = MT7622_CON0_RST_BAR, \ |
| 39 | .fmax = MT7622_PLL_FMAX, \ |
| 40 | .flags = _flags, \ |
| 41 | .pcwbits = _pcwbits, \ |
| 42 | .pd_reg = _pd_reg, \ |
| 43 | .pd_shift = _pd_shift, \ |
| 44 | .pcw_reg = _pcw_reg, \ |
| 45 | .pcw_shift = _pcw_shift, \ |
| 46 | } |
| 47 | |
| 48 | static const struct mtk_pll_data apmixed_plls[] = { |
| 49 | PLL(CLK_APMIXED_ARMPLL, 0x200, 0x20c, 0x1, 0, |
| 50 | 21, 0x204, 24, 0x204, 0), |
| 51 | PLL(CLK_APMIXED_MAINPLL, 0x210, 0x21c, 0x1, HAVE_RST_BAR, |
| 52 | 21, 0x214, 24, 0x214, 0), |
| 53 | PLL(CLK_APMIXED_UNIV2PLL, 0x220, 0x22c, 0x1, HAVE_RST_BAR, |
| 54 | 7, 0x224, 24, 0x224, 14), |
| 55 | PLL(CLK_APMIXED_ETH1PLL, 0x300, 0x310, 0x1, 0, |
| 56 | 21, 0x300, 1, 0x304, 0), |
| 57 | PLL(CLK_APMIXED_ETH2PLL, 0x314, 0x320, 0x1, 0, |
| 58 | 21, 0x314, 1, 0x318, 0), |
| 59 | PLL(CLK_APMIXED_AUD1PLL, 0x324, 0x330, 0x1, 0, |
| 60 | 31, 0x324, 1, 0x328, 0), |
| 61 | PLL(CLK_APMIXED_AUD2PLL, 0x334, 0x340, 0x1, 0, |
| 62 | 31, 0x334, 1, 0x338, 0), |
| 63 | PLL(CLK_APMIXED_TRGPLL, 0x344, 0x354, 0x1, 0, |
| 64 | 21, 0x344, 1, 0x348, 0), |
| 65 | PLL(CLK_APMIXED_SGMIPLL, 0x358, 0x368, 0x1, 0, |
| 66 | 21, 0x358, 1, 0x35c, 0), |
| 67 | }; |
| 68 | |
| 69 | /* topckgen */ |
| 70 | #define FACTOR0(_id, _parent, _mult, _div) \ |
| 71 | FACTOR(_id, _parent, _mult, _div, CLK_PARENT_APMIXED) |
| 72 | |
| 73 | #define FACTOR1(_id, _parent, _mult, _div) \ |
| 74 | FACTOR(_id, _parent, _mult, _div, CLK_PARENT_TOPCKGEN) |
| 75 | |
| 76 | #define FACTOR2(_id, _parent, _mult, _div) \ |
| 77 | FACTOR(_id, _parent, _mult, _div, 0) |
| 78 | |
| 79 | static const struct mtk_fixed_clk top_fixed_clks[] = { |
| 80 | FIXED_CLK(CLK_TOP_TO_U2_PHY, CLK_XTAL, 31250000), |
| 81 | FIXED_CLK(CLK_TOP_TO_U2_PHY_1P, CLK_XTAL, 31250000), |
| 82 | FIXED_CLK(CLK_TOP_PCIE0_PIPE_EN, CLK_XTAL, 125000000), |
| 83 | FIXED_CLK(CLK_TOP_PCIE1_PIPE_EN, CLK_XTAL, 125000000), |
| 84 | FIXED_CLK(CLK_TOP_SSUSB_TX250M, CLK_XTAL, 250000000), |
| 85 | FIXED_CLK(CLK_TOP_SSUSB_EQ_RX250M, CLK_XTAL, 250000000), |
| 86 | FIXED_CLK(CLK_TOP_SSUSB_CDR_REF, CLK_XTAL, 33333333), |
| 87 | FIXED_CLK(CLK_TOP_SSUSB_CDR_FB, CLK_XTAL, 50000000), |
| 88 | FIXED_CLK(CLK_TOP_SATA_ASIC, CLK_XTAL, 50000000), |
| 89 | FIXED_CLK(CLK_TOP_SATA_RBC, CLK_XTAL, 50000000), |
| 90 | }; |
| 91 | |
| 92 | static const struct mtk_fixed_factor top_fixed_divs[] = { |
| 93 | FACTOR0(CLK_TOP_TO_USB3_SYS, CLK_APMIXED_ETH1PLL, 1, 4), |
| 94 | FACTOR0(CLK_TOP_P1_1MHZ, CLK_APMIXED_ETH1PLL, 1, 500), |
| 95 | FACTOR0(CLK_TOP_4MHZ, CLK_APMIXED_ETH1PLL, 1, 125), |
| 96 | FACTOR0(CLK_TOP_P0_1MHZ, CLK_APMIXED_ETH1PLL, 1, 500), |
| 97 | FACTOR1(CLK_TOP_TXCLK_SRC_PRE, CLK_TOP_SGMIIPLL_D2, 1, 1), |
| 98 | FACTOR2(CLK_TOP_RTC, CLK_XTAL, 1, 1024), |
| 99 | FACTOR2(CLK_TOP_MEMPLL, CLK_XTAL, 32, 1), |
| 100 | FACTOR1(CLK_TOP_DMPLL, CLK_TOP_MEMPLL, 1, 1), |
| 101 | FACTOR0(CLK_TOP_SYSPLL_D2, CLK_APMIXED_MAINPLL, 1, 2), |
| 102 | FACTOR0(CLK_TOP_SYSPLL1_D2, CLK_APMIXED_MAINPLL, 1, 4), |
| 103 | FACTOR0(CLK_TOP_SYSPLL1_D4, CLK_APMIXED_MAINPLL, 1, 8), |
| 104 | FACTOR0(CLK_TOP_SYSPLL1_D8, CLK_APMIXED_MAINPLL, 1, 16), |
| 105 | FACTOR0(CLK_TOP_SYSPLL2_D4, CLK_APMIXED_MAINPLL, 1, 12), |
| 106 | FACTOR0(CLK_TOP_SYSPLL2_D8, CLK_APMIXED_MAINPLL, 1, 24), |
| 107 | FACTOR0(CLK_TOP_SYSPLL_D5, CLK_APMIXED_MAINPLL, 1, 5), |
| 108 | FACTOR0(CLK_TOP_SYSPLL3_D2, CLK_APMIXED_MAINPLL, 1, 10), |
| 109 | FACTOR0(CLK_TOP_SYSPLL3_D4, CLK_APMIXED_MAINPLL, 1, 20), |
| 110 | FACTOR0(CLK_TOP_SYSPLL4_D2, CLK_APMIXED_MAINPLL, 1, 14), |
| 111 | FACTOR0(CLK_TOP_SYSPLL4_D4, CLK_APMIXED_MAINPLL, 1, 28), |
| 112 | FACTOR0(CLK_TOP_SYSPLL4_D16, CLK_APMIXED_MAINPLL, 1, 112), |
| 113 | FACTOR0(CLK_TOP_UNIVPLL, CLK_APMIXED_UNIV2PLL, 1, 2), |
| 114 | FACTOR0(CLK_TOP_UNIVPLL_D2, CLK_TOP_UNIVPLL, 1, 2), |
| 115 | FACTOR1(CLK_TOP_UNIVPLL1_D2, CLK_TOP_UNIVPLL, 1, 4), |
| 116 | FACTOR1(CLK_TOP_UNIVPLL1_D4, CLK_TOP_UNIVPLL, 1, 8), |
| 117 | FACTOR1(CLK_TOP_UNIVPLL1_D8, CLK_TOP_UNIVPLL, 1, 16), |
| 118 | FACTOR1(CLK_TOP_UNIVPLL1_D16, CLK_TOP_UNIVPLL, 1, 32), |
| 119 | FACTOR1(CLK_TOP_UNIVPLL2_D2, CLK_TOP_UNIVPLL, 1, 6), |
| 120 | FACTOR1(CLK_TOP_UNIVPLL2_D4, CLK_TOP_UNIVPLL, 1, 12), |
| 121 | FACTOR1(CLK_TOP_UNIVPLL2_D8, CLK_TOP_UNIVPLL, 1, 24), |
| 122 | FACTOR1(CLK_TOP_UNIVPLL2_D16, CLK_TOP_UNIVPLL, 1, 48), |
| 123 | FACTOR1(CLK_TOP_UNIVPLL_D5, CLK_TOP_UNIVPLL, 1, 5), |
| 124 | FACTOR1(CLK_TOP_UNIVPLL3_D2, CLK_TOP_UNIVPLL, 1, 10), |
| 125 | FACTOR1(CLK_TOP_UNIVPLL3_D4, CLK_TOP_UNIVPLL, 1, 20), |
| 126 | FACTOR1(CLK_TOP_UNIVPLL3_D16, CLK_TOP_UNIVPLL, 1, 80), |
| 127 | FACTOR1(CLK_TOP_UNIVPLL_D7, CLK_TOP_UNIVPLL, 1, 7), |
| 128 | FACTOR1(CLK_TOP_UNIVPLL_D80_D4, CLK_TOP_UNIVPLL, 1, 320), |
| 129 | FACTOR1(CLK_TOP_UNIV48M, CLK_TOP_UNIVPLL, 1, 25), |
| 130 | FACTOR0(CLK_TOP_SGMIIPLL, CLK_APMIXED_SGMIPLL, 1, 1), |
| 131 | FACTOR0(CLK_TOP_SGMIIPLL_D2, CLK_APMIXED_SGMIPLL, 1, 2), |
| 132 | FACTOR0(CLK_TOP_AUD1PLL, CLK_APMIXED_AUD1PLL, 1, 1), |
| 133 | FACTOR0(CLK_TOP_AUD2PLL, CLK_APMIXED_AUD2PLL, 1, 1), |
| 134 | FACTOR1(CLK_TOP_AUD_I2S2_MCK, CLK_TOP_I2S2_MCK_SEL, 1, 2), |
| 135 | FACTOR1(CLK_TOP_TO_USB3_REF, CLK_TOP_UNIVPLL2_D4, 1, 4), |
| 136 | FACTOR1(CLK_TOP_PCIE1_MAC_EN, CLK_TOP_UNIVPLL1_D4, 1, 1), |
| 137 | FACTOR1(CLK_TOP_PCIE0_MAC_EN, CLK_TOP_UNIVPLL1_D4, 1, 1), |
| 138 | FACTOR0(CLK_TOP_ETH_500M, CLK_APMIXED_ETH1PLL, 1, 1), |
| 139 | }; |
| 140 | |
| 141 | static const int axi_parents[] = { |
| 142 | CLK_XTAL, |
| 143 | CLK_TOP_SYSPLL1_D2, |
| 144 | CLK_TOP_SYSPLL_D5, |
| 145 | CLK_TOP_SYSPLL1_D4, |
| 146 | CLK_TOP_UNIVPLL_D5, |
| 147 | CLK_TOP_UNIVPLL2_D2, |
| 148 | CLK_TOP_UNIVPLL_D7 |
| 149 | }; |
| 150 | |
| 151 | static const int mem_parents[] = { |
| 152 | CLK_XTAL, |
| 153 | CLK_TOP_DMPLL |
| 154 | }; |
| 155 | |
| 156 | static const int ddrphycfg_parents[] = { |
| 157 | CLK_XTAL, |
| 158 | CLK_TOP_SYSPLL1_D8 |
| 159 | }; |
| 160 | |
| 161 | static const int eth_parents[] = { |
| 162 | CLK_XTAL, |
| 163 | CLK_TOP_SYSPLL1_D2, |
| 164 | CLK_TOP_UNIVPLL1_D2, |
| 165 | CLK_TOP_SYSPLL1_D4, |
| 166 | CLK_TOP_UNIVPLL_D5, |
| 167 | -1, |
| 168 | CLK_TOP_UNIVPLL_D7 |
| 169 | }; |
| 170 | |
| 171 | static const int pwm_parents[] = { |
| 172 | CLK_XTAL, |
| 173 | CLK_TOP_UNIVPLL2_D4 |
| 174 | }; |
| 175 | |
| 176 | static const int f10m_ref_parents[] = { |
| 177 | CLK_XTAL, |
| 178 | CLK_TOP_SYSPLL4_D16 |
| 179 | }; |
| 180 | |
| 181 | static const int nfi_infra_parents[] = { |
| 182 | CLK_XTAL, |
| 183 | CLK_XTAL, |
| 184 | CLK_XTAL, |
| 185 | CLK_XTAL, |
| 186 | CLK_XTAL, |
| 187 | CLK_XTAL, |
| 188 | CLK_XTAL, |
| 189 | CLK_XTAL, |
| 190 | CLK_TOP_UNIVPLL2_D8, |
| 191 | CLK_TOP_SYSPLL1_D8, |
| 192 | CLK_TOP_UNIVPLL1_D8, |
| 193 | CLK_TOP_SYSPLL4_D2, |
| 194 | CLK_TOP_UNIVPLL2_D4, |
| 195 | CLK_TOP_UNIVPLL3_D2, |
| 196 | CLK_TOP_SYSPLL1_D4 |
| 197 | }; |
| 198 | |
| 199 | static const int flash_parents[] = { |
| 200 | CLK_XTAL, |
| 201 | CLK_TOP_UNIVPLL_D80_D4, |
| 202 | CLK_TOP_SYSPLL2_D8, |
| 203 | CLK_TOP_SYSPLL3_D4, |
| 204 | CLK_TOP_UNIVPLL3_D4, |
| 205 | CLK_TOP_UNIVPLL1_D8, |
| 206 | CLK_TOP_SYSPLL2_D4, |
| 207 | CLK_TOP_UNIVPLL2_D4 |
| 208 | }; |
| 209 | |
| 210 | static const int uart_parents[] = { |
| 211 | CLK_XTAL, |
| 212 | CLK_TOP_UNIVPLL2_D8 |
| 213 | }; |
| 214 | |
| 215 | static const int spi0_parents[] = { |
| 216 | CLK_XTAL, |
| 217 | CLK_TOP_SYSPLL3_D2, |
| 218 | CLK_XTAL, |
| 219 | CLK_TOP_SYSPLL2_D4, |
| 220 | CLK_TOP_SYSPLL4_D2, |
| 221 | CLK_TOP_UNIVPLL2_D4, |
| 222 | CLK_TOP_UNIVPLL1_D8, |
| 223 | CLK_XTAL |
| 224 | }; |
| 225 | |
| 226 | static const int spi1_parents[] = { |
| 227 | CLK_XTAL, |
| 228 | CLK_TOP_SYSPLL3_D2, |
| 229 | CLK_XTAL, |
| 230 | CLK_TOP_SYSPLL4_D4, |
| 231 | CLK_TOP_SYSPLL4_D2, |
| 232 | CLK_TOP_UNIVPLL2_D4, |
| 233 | CLK_TOP_UNIVPLL1_D8, |
| 234 | CLK_XTAL |
| 235 | }; |
| 236 | |
| 237 | static const int msdc30_0_parents[] = { |
| 238 | CLK_XTAL, |
| 239 | CLK_TOP_UNIVPLL2_D16, |
| 240 | CLK_TOP_UNIV48M |
| 241 | }; |
| 242 | |
| 243 | static const int a1sys_hp_parents[] = { |
| 244 | CLK_XTAL, |
| 245 | CLK_TOP_AUD1PLL, |
| 246 | CLK_TOP_AUD2PLL, |
| 247 | CLK_XTAL |
| 248 | }; |
| 249 | |
| 250 | static const int intdir_parents[] = { |
| 251 | CLK_XTAL, |
| 252 | CLK_TOP_SYSPLL1_D2, |
| 253 | CLK_TOP_UNIVPLL_D2, |
| 254 | CLK_TOP_SGMIIPLL |
| 255 | }; |
| 256 | |
| 257 | static const int aud_intbus_parents[] = { |
| 258 | CLK_XTAL, |
| 259 | CLK_TOP_SYSPLL1_D4, |
| 260 | CLK_TOP_SYSPLL4_D2, |
| 261 | CLK_TOP_SYSPLL3_D2 |
| 262 | }; |
| 263 | |
| 264 | static const int pmicspi_parents[] = { |
| 265 | CLK_XTAL, |
| 266 | -1, |
| 267 | -1, |
| 268 | -1, |
| 269 | -1, |
| 270 | CLK_TOP_UNIVPLL2_D16 |
| 271 | }; |
| 272 | |
| 273 | static const int atb_parents[] = { |
| 274 | CLK_XTAL, |
| 275 | CLK_TOP_SYSPLL1_D2, |
| 276 | CLK_TOP_SYSPLL_D5 |
| 277 | }; |
| 278 | |
| 279 | static const int audio_parents[] = { |
| 280 | CLK_XTAL, |
| 281 | CLK_TOP_SYSPLL3_D4, |
| 282 | CLK_TOP_SYSPLL4_D4, |
| 283 | CLK_TOP_UNIVPLL1_D16 |
| 284 | }; |
| 285 | |
| 286 | static const int usb20_parents[] = { |
| 287 | CLK_XTAL, |
| 288 | CLK_TOP_UNIVPLL3_D4, |
| 289 | CLK_TOP_SYSPLL1_D8, |
| 290 | CLK_XTAL |
| 291 | }; |
| 292 | |
| 293 | static const int aud1_parents[] = { |
| 294 | CLK_XTAL, |
| 295 | CLK_TOP_AUD1PLL |
| 296 | }; |
| 297 | |
| 298 | static const int asm_l_parents[] = { |
| 299 | CLK_XTAL, |
| 300 | CLK_TOP_SYSPLL_D5, |
| 301 | CLK_TOP_UNIVPLL2_D2, |
| 302 | CLK_TOP_UNIVPLL2_D4 |
| 303 | }; |
| 304 | |
| 305 | static const int apll1_ck_parents[] = { |
| 306 | CLK_TOP_AUD1_SEL, |
| 307 | CLK_TOP_AUD2_SEL |
| 308 | }; |
| 309 | |
| 310 | static const struct mtk_composite top_muxes[] = { |
| 311 | /* CLK_CFG_0 */ |
| 312 | MUX_GATE(CLK_TOP_AXI_SEL, axi_parents, 0x40, 0, 3, 7), |
| 313 | MUX_GATE(CLK_TOP_MEM_SEL, mem_parents, 0x40, 8, 1, 15), |
| 314 | MUX_GATE(CLK_TOP_DDRPHYCFG_SEL, ddrphycfg_parents, 0x40, 16, 1, 23), |
| 315 | MUX_GATE(CLK_TOP_ETH_SEL, eth_parents, 0x40, 24, 3, 31), |
| 316 | |
| 317 | /* CLK_CFG_1 */ |
| 318 | MUX_GATE(CLK_TOP_PWM_SEL, pwm_parents, 0x50, 0, 2, 7), |
| 319 | MUX_GATE(CLK_TOP_F10M_REF_SEL, f10m_ref_parents, 0x50, 8, 1, 15), |
| 320 | MUX_GATE(CLK_TOP_NFI_INFRA_SEL, nfi_infra_parents, 0x50, 16, 4, 23), |
| 321 | MUX_GATE(CLK_TOP_FLASH_SEL, flash_parents, 0x50, 24, 3, 31), |
| 322 | |
| 323 | /* CLK_CFG_2 */ |
| 324 | MUX_GATE(CLK_TOP_UART_SEL, uart_parents, 0x60, 0, 1, 7), |
| 325 | MUX_GATE(CLK_TOP_SPI0_SEL, spi0_parents, 0x60, 8, 3, 15), |
| 326 | MUX_GATE(CLK_TOP_SPI1_SEL, spi1_parents, 0x60, 16, 3, 23), |
| 327 | MUX_GATE(CLK_TOP_MSDC50_0_SEL, uart_parents, 0x60, 24, 3, 31), |
| 328 | |
| 329 | /* CLK_CFG_3 */ |
| 330 | MUX_GATE(CLK_TOP_MSDC30_0_SEL, msdc30_0_parents, 0x70, 0, 3, 7), |
| 331 | MUX_GATE(CLK_TOP_MSDC30_1_SEL, msdc30_0_parents, 0x70, 8, 3, 15), |
| 332 | MUX_GATE(CLK_TOP_A1SYS_HP_SEL, a1sys_hp_parents, 0x70, 16, 3, 23), |
| 333 | MUX_GATE(CLK_TOP_A2SYS_HP_SEL, a1sys_hp_parents, 0x70, 24, 3, 31), |
| 334 | |
| 335 | /* CLK_CFG_4 */ |
| 336 | MUX_GATE(CLK_TOP_INTDIR_SEL, intdir_parents, 0x80, 0, 2, 7), |
| 337 | MUX_GATE(CLK_TOP_AUD_INTBUS_SEL, aud_intbus_parents, 0x80, 8, 2, 15), |
| 338 | MUX_GATE(CLK_TOP_PMICSPI_SEL, pmicspi_parents, 0x80, 16, 3, 23), |
| 339 | MUX_GATE(CLK_TOP_SCP_SEL, ddrphycfg_parents, 0x80, 24, 2, 31), |
| 340 | |
| 341 | /* CLK_CFG_5 */ |
| 342 | MUX_GATE(CLK_TOP_ATB_SEL, atb_parents, 0x90, 0, 2, 7), |
| 343 | MUX_GATE_FLAGS(CLK_TOP_HIF_SEL, eth_parents, 0x90, 8, 3, 15, |
| 344 | CLK_DOMAIN_SCPSYS), |
| 345 | MUX_GATE(CLK_TOP_AUDIO_SEL, audio_parents, 0x90, 16, 2, 23), |
| 346 | MUX_GATE(CLK_TOP_U2_SEL, usb20_parents, 0x90, 24, 2, 31), |
| 347 | |
| 348 | /* CLK_CFG_6 */ |
| 349 | MUX_GATE(CLK_TOP_AUD1_SEL, aud1_parents, 0xA0, 0, 1, 7), |
| 350 | MUX_GATE(CLK_TOP_AUD2_SEL, aud1_parents, 0xA0, 8, 1, 15), |
| 351 | MUX_GATE(CLK_TOP_IRRX_SEL, f10m_ref_parents, 0xA0, 16, 1, 23), |
| 352 | MUX_GATE(CLK_TOP_IRTX_SEL, f10m_ref_parents, 0xA0, 24, 1, 31), |
| 353 | |
| 354 | /* CLK_CFG_7 */ |
| 355 | MUX_GATE(CLK_TOP_ASM_L_SEL, asm_l_parents, 0xB0, 0, 2, 7), |
| 356 | MUX_GATE(CLK_TOP_ASM_M_SEL, asm_l_parents, 0xB0, 8, 2, 15), |
| 357 | MUX_GATE(CLK_TOP_ASM_H_SEL, asm_l_parents, 0xB0, 16, 2, 23), |
| 358 | |
| 359 | /* CLK_AUDDIV_0 */ |
| 360 | MUX(CLK_TOP_APLL1_SEL, apll1_ck_parents, 0x120, 6, 1), |
| 361 | MUX(CLK_TOP_APLL2_SEL, apll1_ck_parents, 0x120, 7, 1), |
| 362 | MUX(CLK_TOP_I2S0_MCK_SEL, apll1_ck_parents, 0x120, 8, 1), |
| 363 | MUX(CLK_TOP_I2S1_MCK_SEL, apll1_ck_parents, 0x120, 9, 1), |
| 364 | MUX(CLK_TOP_I2S2_MCK_SEL, apll1_ck_parents, 0x120, 10, 1), |
| 365 | MUX(CLK_TOP_I2S3_MCK_SEL, apll1_ck_parents, 0x120, 161, 1), |
| 366 | }; |
| 367 | |
| 368 | /* infracfg */ |
| 369 | static const struct mtk_gate_regs infra_cg_regs = { |
| 370 | .set_ofs = 0x40, |
| 371 | .clr_ofs = 0x44, |
| 372 | .sta_ofs = 0x48, |
| 373 | }; |
| 374 | |
| 375 | #define GATE_INFRA(_id, _parent, _shift) { \ |
| 376 | .id = _id, \ |
| 377 | .parent = _parent, \ |
| 378 | .regs = &infra_cg_regs, \ |
| 379 | .shift = _shift, \ |
| 380 | .flags = CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN, \ |
| 381 | } |
| 382 | |
| 383 | static const struct mtk_gate infra_cgs[] = { |
| 384 | GATE_INFRA(CLK_INFRA_DBGCLK_PD, CLK_TOP_AXI_SEL, 0), |
| 385 | GATE_INFRA(CLK_INFRA_TRNG, CLK_TOP_AXI_SEL, 2), |
| 386 | GATE_INFRA(CLK_INFRA_AUDIO_PD, CLK_TOP_AUD_INTBUS_SEL, 5), |
| 387 | GATE_INFRA(CLK_INFRA_IRRX_PD, CLK_TOP_IRRX_SEL, 16), |
| 388 | GATE_INFRA(CLK_INFRA_APXGPT_PD, CLK_TOP_F10M_REF_SEL, 18), |
| 389 | GATE_INFRA(CLK_INFRA_PMIC_PD, CLK_TOP_PMICSPI_SEL, 22), |
| 390 | }; |
| 391 | |
| 392 | /* pericfg */ |
| 393 | static const struct mtk_gate_regs peri0_cg_regs = { |
| 394 | .set_ofs = 0x8, |
| 395 | .clr_ofs = 0x10, |
| 396 | .sta_ofs = 0x18, |
| 397 | }; |
| 398 | |
| 399 | static const struct mtk_gate_regs peri1_cg_regs = { |
| 400 | .set_ofs = 0xC, |
| 401 | .clr_ofs = 0x14, |
| 402 | .sta_ofs = 0x1C, |
| 403 | }; |
| 404 | |
| 405 | #define GATE_PERI0(_id, _parent, _shift) { \ |
| 406 | .id = _id, \ |
| 407 | .parent = _parent, \ |
| 408 | .regs = &peri0_cg_regs, \ |
| 409 | .shift = _shift, \ |
| 410 | .flags = CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN, \ |
| 411 | } |
| 412 | |
| 413 | #define GATE_PERI1(_id, _parent, _shift) { \ |
| 414 | .id = _id, \ |
| 415 | .parent = _parent, \ |
| 416 | .regs = &peri1_cg_regs, \ |
| 417 | .shift = _shift, \ |
| 418 | .flags = CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN, \ |
| 419 | } |
| 420 | |
| 421 | static const struct mtk_gate peri_cgs[] = { |
| 422 | /* PERI0 */ |
| 423 | GATE_PERI0(CLK_PERI_THERM_PD, CLK_TOP_AXI_SEL, 1), |
| 424 | GATE_PERI0(CLK_PERI_PWM1_PD, CLK_XTAL, 2), |
| 425 | GATE_PERI0(CLK_PERI_PWM2_PD, CLK_XTAL, 3), |
| 426 | GATE_PERI0(CLK_PERI_PWM3_PD, CLK_XTAL, 4), |
| 427 | GATE_PERI0(CLK_PERI_PWM4_PD, CLK_XTAL, 5), |
| 428 | GATE_PERI0(CLK_PERI_PWM5_PD, CLK_XTAL, 6), |
| 429 | GATE_PERI0(CLK_PERI_PWM6_PD, CLK_XTAL, 7), |
| 430 | GATE_PERI0(CLK_PERI_PWM7_PD, CLK_XTAL, 8), |
| 431 | GATE_PERI0(CLK_PERI_PWM_PD, CLK_XTAL, 9), |
| 432 | GATE_PERI0(CLK_PERI_AP_DMA_PD, CLK_TOP_AXI_SEL, 12), |
| 433 | GATE_PERI0(CLK_PERI_MSDC30_0_PD, CLK_TOP_MSDC30_0_SEL, 13), |
| 434 | GATE_PERI0(CLK_PERI_MSDC30_1_PD, CLK_TOP_MSDC30_1_SEL, 14), |
| 435 | GATE_PERI0(CLK_PERI_UART0_PD, CLK_TOP_AXI_SEL, 17), |
| 436 | GATE_PERI0(CLK_PERI_UART1_PD, CLK_TOP_AXI_SEL, 18), |
| 437 | GATE_PERI0(CLK_PERI_UART2_PD, CLK_TOP_AXI_SEL, 19), |
| 438 | GATE_PERI0(CLK_PERI_UART3_PD, CLK_TOP_AXI_SEL, 20), |
| 439 | GATE_PERI0(CLK_PERI_BTIF_PD, CLK_TOP_AXI_SEL, 22), |
| 440 | GATE_PERI0(CLK_PERI_I2C0_PD, CLK_TOP_AXI_SEL, 23), |
| 441 | GATE_PERI0(CLK_PERI_I2C1_PD, CLK_TOP_AXI_SEL, 24), |
| 442 | GATE_PERI0(CLK_PERI_I2C2_PD, CLK_TOP_AXI_SEL, 25), |
| 443 | GATE_PERI0(CLK_PERI_SPI1_PD, CLK_TOP_SPI1_SEL, 26), |
| 444 | GATE_PERI0(CLK_PERI_AUXADC_PD, CLK_XTAL, 27), |
| 445 | GATE_PERI0(CLK_PERI_SPI0_PD, CLK_TOP_SPI0_SEL, 28), |
| 446 | GATE_PERI0(CLK_PERI_SNFI_PD, CLK_TOP_NFI_INFRA_SEL, 29), |
| 447 | GATE_PERI0(CLK_PERI_NFI_PD, CLK_TOP_AXI_SEL, 30), |
| 448 | GATE_PERI1(CLK_PERI_NFIECC_PD, CLK_TOP_AXI_SEL, 31), |
| 449 | |
| 450 | /* PERI1 */ |
| 451 | GATE_PERI1(CLK_PERI_FLASH_PD, CLK_TOP_FLASH_SEL, 1), |
| 452 | GATE_PERI1(CLK_PERI_IRTX_PD, CLK_TOP_IRTX_SEL, 2), |
| 453 | }; |
| 454 | |
developer | 420e8bf | 2020-08-10 16:17:08 +0800 | [diff] [blame] | 455 | /* pciesys */ |
| 456 | static const struct mtk_gate_regs pcie_cg_regs = { |
| 457 | .set_ofs = 0x30, |
| 458 | .clr_ofs = 0x30, |
| 459 | .sta_ofs = 0x30, |
| 460 | }; |
| 461 | |
| 462 | #define GATE_PCIE(_id, _parent, _shift) { \ |
| 463 | .id = _id, \ |
| 464 | .parent = _parent, \ |
| 465 | .regs = &pcie_cg_regs, \ |
| 466 | .shift = _shift, \ |
| 467 | .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \ |
| 468 | } |
| 469 | |
| 470 | static const struct mtk_gate pcie_cgs[] = { |
| 471 | GATE_PCIE(CLK_PCIE_P1_AUX_EN, CLK_TOP_P1_1MHZ, 12), |
| 472 | GATE_PCIE(CLK_PCIE_P1_OBFF_EN, CLK_TOP_4MHZ, 13), |
| 473 | GATE_PCIE(CLK_PCIE_P1_AHB_EN, CLK_TOP_AXI_SEL, 14), |
| 474 | GATE_PCIE(CLK_PCIE_P1_AXI_EN, CLK_TOP_HIF_SEL, 15), |
| 475 | GATE_PCIE(CLK_PCIE_P1_MAC_EN, CLK_TOP_PCIE1_MAC_EN, 16), |
| 476 | GATE_PCIE(CLK_PCIE_P1_PIPE_EN, CLK_TOP_PCIE1_PIPE_EN, 17), |
| 477 | GATE_PCIE(CLK_PCIE_P0_AUX_EN, CLK_TOP_P0_1MHZ, 18), |
| 478 | GATE_PCIE(CLK_PCIE_P0_OBFF_EN, CLK_TOP_4MHZ, 19), |
| 479 | GATE_PCIE(CLK_PCIE_P0_AHB_EN, CLK_TOP_AXI_SEL, 20), |
| 480 | GATE_PCIE(CLK_PCIE_P0_AXI_EN, CLK_TOP_HIF_SEL, 21), |
| 481 | GATE_PCIE(CLK_PCIE_P0_MAC_EN, CLK_TOP_PCIE0_MAC_EN, 22), |
| 482 | GATE_PCIE(CLK_PCIE_P0_PIPE_EN, CLK_TOP_PCIE0_PIPE_EN, 23), |
| 483 | GATE_PCIE(CLK_SATA_AHB_EN, CLK_TOP_AXI_SEL, 26), |
| 484 | GATE_PCIE(CLK_SATA_AXI_EN, CLK_TOP_HIF_SEL, 27), |
| 485 | GATE_PCIE(CLK_SATA_ASIC_EN, CLK_TOP_SATA_ASIC, 28), |
| 486 | GATE_PCIE(CLK_SATA_RBC_EN, CLK_TOP_SATA_RBC, 29), |
| 487 | GATE_PCIE(CLK_SATA_PM_EN, CLK_TOP_UNIVPLL2_D4, 30), |
| 488 | }; |
| 489 | |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 490 | /* ethsys */ |
| 491 | static const struct mtk_gate_regs eth_cg_regs = { |
| 492 | .sta_ofs = 0x30, |
| 493 | }; |
| 494 | |
| 495 | #define GATE_ETH(_id, _parent, _shift) { \ |
| 496 | .id = _id, \ |
| 497 | .parent = _parent, \ |
| 498 | .regs = ð_cg_regs, \ |
| 499 | .shift = _shift, \ |
| 500 | .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \ |
| 501 | } |
| 502 | |
| 503 | static const struct mtk_gate eth_cgs[] = { |
| 504 | GATE_ETH(CLK_ETH_HSDMA_EN, CLK_TOP_ETH_SEL, 5), |
| 505 | GATE_ETH(CLK_ETH_ESW_EN, CLK_TOP_ETH_500M, 6), |
| 506 | GATE_ETH(CLK_ETH_GP2_EN, CLK_TOP_TXCLK_SRC_PRE, 7), |
| 507 | GATE_ETH(CLK_ETH_GP1_EN, CLK_TOP_TXCLK_SRC_PRE, 8), |
| 508 | GATE_ETH(CLK_ETH_GP0_EN, CLK_TOP_TXCLK_SRC_PRE, 9), |
| 509 | }; |
| 510 | |
| 511 | static const struct mtk_gate_regs sgmii_cg_regs = { |
| 512 | .sta_ofs = 0xE4, |
| 513 | }; |
| 514 | |
| 515 | #define GATE_SGMII(_id, _parent, _shift) { \ |
| 516 | .id = _id, \ |
| 517 | .parent = _parent, \ |
| 518 | .regs = &sgmii_cg_regs, \ |
| 519 | .shift = _shift, \ |
| 520 | .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \ |
| 521 | } |
| 522 | |
Frank Wunderlich | e51b57a | 2020-08-20 16:37:55 +0200 | [diff] [blame] | 523 | static const struct mtk_gate_regs ssusb_cg_regs = { |
| 524 | .set_ofs = 0x30, |
| 525 | .clr_ofs = 0x30, |
| 526 | .sta_ofs = 0x30, |
| 527 | }; |
| 528 | |
| 529 | #define GATE_SSUSB(_id, _parent, _shift) { \ |
| 530 | .id = _id, \ |
| 531 | .parent = _parent, \ |
| 532 | .regs = &ssusb_cg_regs, \ |
| 533 | .shift = _shift, \ |
| 534 | .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \ |
| 535 | } |
| 536 | |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 537 | static const struct mtk_gate sgmii_cgs[] = { |
| 538 | GATE_SGMII(CLK_SGMII_TX250M_EN, CLK_TOP_SSUSB_TX250M, 2), |
| 539 | GATE_SGMII(CLK_SGMII_RX250M_EN, CLK_TOP_SSUSB_EQ_RX250M, 3), |
| 540 | GATE_SGMII(CLK_SGMII_CDR_REF, CLK_TOP_SSUSB_CDR_REF, 4), |
| 541 | GATE_SGMII(CLK_SGMII_CDR_FB, CLK_TOP_SSUSB_CDR_FB, 5), |
| 542 | }; |
| 543 | |
Frank Wunderlich | e51b57a | 2020-08-20 16:37:55 +0200 | [diff] [blame] | 544 | static const struct mtk_gate ssusb_cgs[] = { |
| 545 | GATE_SSUSB(CLK_SSUSB_U2_PHY_1P_EN, CLK_TOP_TO_U2_PHY_1P, 0), |
| 546 | GATE_SSUSB(CLK_SSUSB_U2_PHY_EN, CLK_TOP_TO_U2_PHY, 1), |
| 547 | GATE_SSUSB(CLK_SSUSB_REF_EN, CLK_TOP_TO_USB3_REF, 5), |
| 548 | GATE_SSUSB(CLK_SSUSB_SYS_EN, CLK_TOP_TO_USB3_SYS, 6), |
| 549 | GATE_SSUSB(CLK_SSUSB_MCU_EN, CLK_TOP_AXI_SEL, 7), |
| 550 | GATE_SSUSB(CLK_SSUSB_DMA_EN, CLK_TOP_HIF_SEL, 8), |
| 551 | }; |
| 552 | |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 553 | static const struct mtk_clk_tree mt7622_clk_tree = { |
| 554 | .xtal_rate = 25 * MHZ, |
| 555 | .xtal2_rate = 25 * MHZ, |
| 556 | .fdivs_offs = CLK_TOP_TO_USB3_SYS, |
| 557 | .muxes_offs = CLK_TOP_AXI_SEL, |
| 558 | .plls = apmixed_plls, |
| 559 | .fclks = top_fixed_clks, |
| 560 | .fdivs = top_fixed_divs, |
| 561 | .muxes = top_muxes, |
| 562 | }; |
| 563 | |
| 564 | static int mt7622_mcucfg_probe(struct udevice *dev) |
| 565 | { |
| 566 | void __iomem *base; |
| 567 | |
| 568 | base = dev_read_addr_ptr(dev); |
| 569 | if (!base) |
| 570 | return -ENOENT; |
| 571 | |
| 572 | clrsetbits_le32(base + MCU_AXI_DIV, AXI_DIV_MSK, |
| 573 | AXI_DIV_SEL(0x12)); |
| 574 | clrsetbits_le32(base + MCU_BUS_MUX, MCU_BUS_MSK, |
| 575 | MCU_BUS_SEL(0x1)); |
| 576 | |
| 577 | return 0; |
| 578 | } |
| 579 | |
| 580 | static int mt7622_apmixedsys_probe(struct udevice *dev) |
| 581 | { |
| 582 | struct mtk_clk_priv *priv = dev_get_priv(dev); |
| 583 | int ret; |
| 584 | |
| 585 | ret = mtk_common_clk_init(dev, &mt7622_clk_tree); |
| 586 | if (ret) |
| 587 | return ret; |
| 588 | |
| 589 | /* reduce clock square disable time */ |
| 590 | // writel(0x501, priv->base + MT7622_CLKSQ_STB_CON0); |
| 591 | writel(0x98940501, priv->base + MT7622_CLKSQ_STB_CON0); |
| 592 | |
| 593 | /* extend pwr/iso control timing to 1us */ |
| 594 | writel(0x80008, priv->base + MT7622_PLL_ISO_CON0); |
| 595 | |
| 596 | return 0; |
| 597 | } |
| 598 | |
| 599 | static int mt7622_topckgen_probe(struct udevice *dev) |
| 600 | { |
| 601 | return mtk_common_clk_init(dev, &mt7622_clk_tree); |
| 602 | } |
| 603 | |
| 604 | static int mt7622_infracfg_probe(struct udevice *dev) |
| 605 | { |
| 606 | return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, infra_cgs); |
| 607 | } |
| 608 | |
| 609 | static int mt7622_pericfg_probe(struct udevice *dev) |
| 610 | { |
| 611 | return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, peri_cgs); |
| 612 | } |
| 613 | |
developer | 420e8bf | 2020-08-10 16:17:08 +0800 | [diff] [blame] | 614 | static int mt7622_pciesys_probe(struct udevice *dev) |
| 615 | { |
| 616 | return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, pcie_cgs); |
| 617 | } |
| 618 | |
Frank Wunderlich | 8bdcb39 | 2020-08-13 10:20:46 +0200 | [diff] [blame] | 619 | static int mt7622_pciesys_bind(struct udevice *dev) |
| 620 | { |
| 621 | int ret = 0; |
| 622 | |
| 623 | if (IS_ENABLED(CONFIG_RESET_MEDIATEK)) { |
Frank Wunderlich | 8bdcb39 | 2020-08-13 10:20:46 +0200 | [diff] [blame] | 624 | ret = mediatek_reset_bind(dev, ETHSYS_HIFSYS_RST_CTRL_OFS, 1); |
| 625 | if (ret) |
| 626 | debug("Warning: failed to bind reset controller\n"); |
| 627 | } |
| 628 | |
| 629 | return ret; |
| 630 | } |
| 631 | |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 632 | static int mt7622_ethsys_probe(struct udevice *dev) |
| 633 | { |
| 634 | return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, eth_cgs); |
| 635 | } |
| 636 | |
| 637 | static int mt7622_ethsys_bind(struct udevice *dev) |
| 638 | { |
| 639 | int ret = 0; |
| 640 | |
| 641 | #if CONFIG_IS_ENABLED(RESET_MEDIATEK) |
| 642 | ret = mediatek_reset_bind(dev, ETHSYS_HIFSYS_RST_CTRL_OFS, 1); |
| 643 | if (ret) |
| 644 | debug("Warning: failed to bind reset controller\n"); |
| 645 | #endif |
| 646 | |
| 647 | return ret; |
| 648 | } |
| 649 | |
| 650 | static int mt7622_sgmiisys_probe(struct udevice *dev) |
| 651 | { |
| 652 | return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, sgmii_cgs); |
| 653 | } |
| 654 | |
Frank Wunderlich | e51b57a | 2020-08-20 16:37:55 +0200 | [diff] [blame] | 655 | static int mt7622_ssusbsys_probe(struct udevice *dev) |
| 656 | { |
| 657 | return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, ssusb_cgs); |
| 658 | } |
| 659 | |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 660 | static const struct udevice_id mt7622_apmixed_compat[] = { |
| 661 | { .compatible = "mediatek,mt7622-apmixedsys" }, |
| 662 | { } |
| 663 | }; |
| 664 | |
| 665 | static const struct udevice_id mt7622_topckgen_compat[] = { |
| 666 | { .compatible = "mediatek,mt7622-topckgen" }, |
| 667 | { } |
| 668 | }; |
| 669 | |
| 670 | static const struct udevice_id mt7622_infracfg_compat[] = { |
| 671 | { .compatible = "mediatek,mt7622-infracfg", }, |
| 672 | { } |
| 673 | }; |
| 674 | |
| 675 | static const struct udevice_id mt7622_pericfg_compat[] = { |
| 676 | { .compatible = "mediatek,mt7622-pericfg", }, |
| 677 | { } |
| 678 | }; |
| 679 | |
developer | 420e8bf | 2020-08-10 16:17:08 +0800 | [diff] [blame] | 680 | static const struct udevice_id mt7622_pciesys_compat[] = { |
| 681 | { .compatible = "mediatek,mt7622-pciesys", }, |
| 682 | { } |
| 683 | }; |
| 684 | |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 685 | static const struct udevice_id mt7622_ethsys_compat[] = { |
| 686 | { .compatible = "mediatek,mt7622-ethsys", }, |
| 687 | { } |
| 688 | }; |
| 689 | |
| 690 | static const struct udevice_id mt7622_sgmiisys_compat[] = { |
| 691 | { .compatible = "mediatek,mt7622-sgmiisys", }, |
| 692 | { } |
| 693 | }; |
| 694 | |
| 695 | static const struct udevice_id mt7622_mcucfg_compat[] = { |
| 696 | { .compatible = "mediatek,mt7622-mcucfg" }, |
| 697 | { } |
| 698 | }; |
| 699 | |
Frank Wunderlich | e51b57a | 2020-08-20 16:37:55 +0200 | [diff] [blame] | 700 | static const struct udevice_id mt7622_ssusbsys_compat[] = { |
| 701 | { .compatible = "mediatek,mt7622-ssusbsys" }, |
| 702 | { } |
| 703 | }; |
| 704 | |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 705 | U_BOOT_DRIVER(mtk_mcucfg) = { |
| 706 | .name = "mt7622-mcucfg", |
| 707 | .id = UCLASS_SYSCON, |
| 708 | .of_match = mt7622_mcucfg_compat, |
| 709 | .probe = mt7622_mcucfg_probe, |
| 710 | .flags = DM_FLAG_PRE_RELOC, |
| 711 | }; |
| 712 | |
| 713 | U_BOOT_DRIVER(mtk_clk_apmixedsys) = { |
| 714 | .name = "mt7622-clock-apmixedsys", |
| 715 | .id = UCLASS_CLK, |
| 716 | .of_match = mt7622_apmixed_compat, |
| 717 | .probe = mt7622_apmixedsys_probe, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 718 | .priv_auto = sizeof(struct mtk_clk_priv), |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 719 | .ops = &mtk_clk_apmixedsys_ops, |
| 720 | .flags = DM_FLAG_PRE_RELOC, |
| 721 | }; |
| 722 | |
| 723 | U_BOOT_DRIVER(mtk_clk_topckgen) = { |
| 724 | .name = "mt7622-clock-topckgen", |
| 725 | .id = UCLASS_CLK, |
| 726 | .of_match = mt7622_topckgen_compat, |
| 727 | .probe = mt7622_topckgen_probe, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 728 | .priv_auto = sizeof(struct mtk_clk_priv), |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 729 | .ops = &mtk_clk_topckgen_ops, |
| 730 | .flags = DM_FLAG_PRE_RELOC, |
| 731 | }; |
| 732 | |
| 733 | U_BOOT_DRIVER(mtk_clk_infracfg) = { |
| 734 | .name = "mt7622-clock-infracfg", |
| 735 | .id = UCLASS_CLK, |
| 736 | .of_match = mt7622_infracfg_compat, |
| 737 | .probe = mt7622_infracfg_probe, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 738 | .priv_auto = sizeof(struct mtk_cg_priv), |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 739 | .ops = &mtk_clk_gate_ops, |
| 740 | .flags = DM_FLAG_PRE_RELOC, |
| 741 | }; |
| 742 | |
| 743 | U_BOOT_DRIVER(mtk_clk_pericfg) = { |
| 744 | .name = "mt7622-clock-pericfg", |
| 745 | .id = UCLASS_CLK, |
| 746 | .of_match = mt7622_pericfg_compat, |
| 747 | .probe = mt7622_pericfg_probe, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 748 | .priv_auto = sizeof(struct mtk_cg_priv), |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 749 | .ops = &mtk_clk_gate_ops, |
| 750 | .flags = DM_FLAG_PRE_RELOC, |
| 751 | }; |
| 752 | |
developer | 420e8bf | 2020-08-10 16:17:08 +0800 | [diff] [blame] | 753 | U_BOOT_DRIVER(mtk_clk_pciesys) = { |
| 754 | .name = "mt7622-clock-pciesys", |
| 755 | .id = UCLASS_CLK, |
| 756 | .of_match = mt7622_pciesys_compat, |
| 757 | .probe = mt7622_pciesys_probe, |
Frank Wunderlich | 8bdcb39 | 2020-08-13 10:20:46 +0200 | [diff] [blame] | 758 | .bind = mt7622_pciesys_bind, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 759 | .priv_auto = sizeof(struct mtk_cg_priv), |
developer | 420e8bf | 2020-08-10 16:17:08 +0800 | [diff] [blame] | 760 | .ops = &mtk_clk_gate_ops, |
| 761 | }; |
| 762 | |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 763 | U_BOOT_DRIVER(mtk_clk_ethsys) = { |
| 764 | .name = "mt7622-clock-ethsys", |
| 765 | .id = UCLASS_CLK, |
| 766 | .of_match = mt7622_ethsys_compat, |
| 767 | .probe = mt7622_ethsys_probe, |
| 768 | .bind = mt7622_ethsys_bind, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 769 | .priv_auto = sizeof(struct mtk_cg_priv), |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 770 | .ops = &mtk_clk_gate_ops, |
| 771 | }; |
| 772 | |
| 773 | U_BOOT_DRIVER(mtk_clk_sgmiisys) = { |
| 774 | .name = "mt7622-clock-sgmiisys", |
| 775 | .id = UCLASS_CLK, |
| 776 | .of_match = mt7622_sgmiisys_compat, |
| 777 | .probe = mt7622_sgmiisys_probe, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 778 | .priv_auto = sizeof(struct mtk_cg_priv), |
developer | dea5651 | 2020-01-10 16:30:29 +0800 | [diff] [blame] | 779 | .ops = &mtk_clk_gate_ops, |
| 780 | }; |
Frank Wunderlich | e51b57a | 2020-08-20 16:37:55 +0200 | [diff] [blame] | 781 | |
| 782 | U_BOOT_DRIVER(mtk_clk_ssusbsys) = { |
| 783 | .name = "mt7622-clock-ssusbsys", |
| 784 | .id = UCLASS_CLK, |
| 785 | .of_match = mt7622_ssusbsys_compat, |
| 786 | .probe = mt7622_ssusbsys_probe, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 787 | .priv_auto = sizeof(struct mtk_cg_priv), |
Frank Wunderlich | e51b57a | 2020-08-20 16:37:55 +0200 | [diff] [blame] | 788 | .ops = &mtk_clk_gate_ops, |
| 789 | }; |