blob: 23b9787612a8bc1fbc8e721e705d1cf238c9026e [file] [log] [blame]
Sam Shih72ab6032020-01-10 16:30:29 +08001// 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
Sam Shih72ab6032020-01-10 16:30:29 +08009#include <dm.h>
Simon Glassf7ae49f2020-05-10 11:40:05 -060010#include <log.h>
Sam Shih72ab6032020-01-10 16:30:29 +080011#include <asm/arch-mediatek/reset.h>
12#include <asm/io.h>
13#include <dt-bindings/clock/mt7622-clk.h>
Simon Glasscd93d622020-05-10 11:40:13 -060014#include <linux/bitops.h>
Sam Shih72ab6032020-01-10 16:30:29 +080015
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
48static 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
Christian Marangi6dfa9912024-08-03 10:43:22 +020069static const struct mtk_gate_regs apmixed_cg_regs = {
70 .set_ofs = 0x8,
71 .clr_ofs = 0x8,
72 .sta_ofs = 0x8,
73};
74
75#define GATE_APMIXED(_id, _parent, _shift) { \
76 .id = _id, \
77 .parent = _parent, \
78 .regs = &apmixed_cg_regs, \
79 .shift = _shift, \
80 .flags = CLK_GATE_NO_SETCLR_INV, \
81 }
82
83static const struct mtk_gate apmixed_cgs[] = {
84 GATE_APMIXED(CLK_APMIXED_MAIN_CORE_EN, CLK_APMIXED_MAINPLL, 5),
85};
86
Sam Shih72ab6032020-01-10 16:30:29 +080087/* topckgen */
88#define FACTOR0(_id, _parent, _mult, _div) \
89 FACTOR(_id, _parent, _mult, _div, CLK_PARENT_APMIXED)
90
91#define FACTOR1(_id, _parent, _mult, _div) \
92 FACTOR(_id, _parent, _mult, _div, CLK_PARENT_TOPCKGEN)
93
94#define FACTOR2(_id, _parent, _mult, _div) \
95 FACTOR(_id, _parent, _mult, _div, 0)
96
97static const struct mtk_fixed_clk top_fixed_clks[] = {
98 FIXED_CLK(CLK_TOP_TO_U2_PHY, CLK_XTAL, 31250000),
99 FIXED_CLK(CLK_TOP_TO_U2_PHY_1P, CLK_XTAL, 31250000),
100 FIXED_CLK(CLK_TOP_PCIE0_PIPE_EN, CLK_XTAL, 125000000),
101 FIXED_CLK(CLK_TOP_PCIE1_PIPE_EN, CLK_XTAL, 125000000),
102 FIXED_CLK(CLK_TOP_SSUSB_TX250M, CLK_XTAL, 250000000),
103 FIXED_CLK(CLK_TOP_SSUSB_EQ_RX250M, CLK_XTAL, 250000000),
104 FIXED_CLK(CLK_TOP_SSUSB_CDR_REF, CLK_XTAL, 33333333),
105 FIXED_CLK(CLK_TOP_SSUSB_CDR_FB, CLK_XTAL, 50000000),
106 FIXED_CLK(CLK_TOP_SATA_ASIC, CLK_XTAL, 50000000),
107 FIXED_CLK(CLK_TOP_SATA_RBC, CLK_XTAL, 50000000),
108};
109
110static const struct mtk_fixed_factor top_fixed_divs[] = {
111 FACTOR0(CLK_TOP_TO_USB3_SYS, CLK_APMIXED_ETH1PLL, 1, 4),
112 FACTOR0(CLK_TOP_P1_1MHZ, CLK_APMIXED_ETH1PLL, 1, 500),
113 FACTOR0(CLK_TOP_4MHZ, CLK_APMIXED_ETH1PLL, 1, 125),
114 FACTOR0(CLK_TOP_P0_1MHZ, CLK_APMIXED_ETH1PLL, 1, 500),
115 FACTOR1(CLK_TOP_TXCLK_SRC_PRE, CLK_TOP_SGMIIPLL_D2, 1, 1),
116 FACTOR2(CLK_TOP_RTC, CLK_XTAL, 1, 1024),
117 FACTOR2(CLK_TOP_MEMPLL, CLK_XTAL, 32, 1),
118 FACTOR1(CLK_TOP_DMPLL, CLK_TOP_MEMPLL, 1, 1),
119 FACTOR0(CLK_TOP_SYSPLL_D2, CLK_APMIXED_MAINPLL, 1, 2),
120 FACTOR0(CLK_TOP_SYSPLL1_D2, CLK_APMIXED_MAINPLL, 1, 4),
121 FACTOR0(CLK_TOP_SYSPLL1_D4, CLK_APMIXED_MAINPLL, 1, 8),
122 FACTOR0(CLK_TOP_SYSPLL1_D8, CLK_APMIXED_MAINPLL, 1, 16),
123 FACTOR0(CLK_TOP_SYSPLL2_D4, CLK_APMIXED_MAINPLL, 1, 12),
124 FACTOR0(CLK_TOP_SYSPLL2_D8, CLK_APMIXED_MAINPLL, 1, 24),
125 FACTOR0(CLK_TOP_SYSPLL_D5, CLK_APMIXED_MAINPLL, 1, 5),
126 FACTOR0(CLK_TOP_SYSPLL3_D2, CLK_APMIXED_MAINPLL, 1, 10),
127 FACTOR0(CLK_TOP_SYSPLL3_D4, CLK_APMIXED_MAINPLL, 1, 20),
128 FACTOR0(CLK_TOP_SYSPLL4_D2, CLK_APMIXED_MAINPLL, 1, 14),
129 FACTOR0(CLK_TOP_SYSPLL4_D4, CLK_APMIXED_MAINPLL, 1, 28),
130 FACTOR0(CLK_TOP_SYSPLL4_D16, CLK_APMIXED_MAINPLL, 1, 112),
131 FACTOR0(CLK_TOP_UNIVPLL, CLK_APMIXED_UNIV2PLL, 1, 2),
132 FACTOR0(CLK_TOP_UNIVPLL_D2, CLK_TOP_UNIVPLL, 1, 2),
133 FACTOR1(CLK_TOP_UNIVPLL1_D2, CLK_TOP_UNIVPLL, 1, 4),
134 FACTOR1(CLK_TOP_UNIVPLL1_D4, CLK_TOP_UNIVPLL, 1, 8),
135 FACTOR1(CLK_TOP_UNIVPLL1_D8, CLK_TOP_UNIVPLL, 1, 16),
136 FACTOR1(CLK_TOP_UNIVPLL1_D16, CLK_TOP_UNIVPLL, 1, 32),
137 FACTOR1(CLK_TOP_UNIVPLL2_D2, CLK_TOP_UNIVPLL, 1, 6),
138 FACTOR1(CLK_TOP_UNIVPLL2_D4, CLK_TOP_UNIVPLL, 1, 12),
139 FACTOR1(CLK_TOP_UNIVPLL2_D8, CLK_TOP_UNIVPLL, 1, 24),
140 FACTOR1(CLK_TOP_UNIVPLL2_D16, CLK_TOP_UNIVPLL, 1, 48),
141 FACTOR1(CLK_TOP_UNIVPLL_D5, CLK_TOP_UNIVPLL, 1, 5),
142 FACTOR1(CLK_TOP_UNIVPLL3_D2, CLK_TOP_UNIVPLL, 1, 10),
143 FACTOR1(CLK_TOP_UNIVPLL3_D4, CLK_TOP_UNIVPLL, 1, 20),
144 FACTOR1(CLK_TOP_UNIVPLL3_D16, CLK_TOP_UNIVPLL, 1, 80),
145 FACTOR1(CLK_TOP_UNIVPLL_D7, CLK_TOP_UNIVPLL, 1, 7),
146 FACTOR1(CLK_TOP_UNIVPLL_D80_D4, CLK_TOP_UNIVPLL, 1, 320),
147 FACTOR1(CLK_TOP_UNIV48M, CLK_TOP_UNIVPLL, 1, 25),
148 FACTOR0(CLK_TOP_SGMIIPLL, CLK_APMIXED_SGMIPLL, 1, 1),
149 FACTOR0(CLK_TOP_SGMIIPLL_D2, CLK_APMIXED_SGMIPLL, 1, 2),
150 FACTOR0(CLK_TOP_AUD1PLL, CLK_APMIXED_AUD1PLL, 1, 1),
151 FACTOR0(CLK_TOP_AUD2PLL, CLK_APMIXED_AUD2PLL, 1, 1),
152 FACTOR1(CLK_TOP_AUD_I2S2_MCK, CLK_TOP_I2S2_MCK_SEL, 1, 2),
153 FACTOR1(CLK_TOP_TO_USB3_REF, CLK_TOP_UNIVPLL2_D4, 1, 4),
154 FACTOR1(CLK_TOP_PCIE1_MAC_EN, CLK_TOP_UNIVPLL1_D4, 1, 1),
155 FACTOR1(CLK_TOP_PCIE0_MAC_EN, CLK_TOP_UNIVPLL1_D4, 1, 1),
156 FACTOR0(CLK_TOP_ETH_500M, CLK_APMIXED_ETH1PLL, 1, 1),
157};
158
159static const int axi_parents[] = {
160 CLK_XTAL,
161 CLK_TOP_SYSPLL1_D2,
162 CLK_TOP_SYSPLL_D5,
163 CLK_TOP_SYSPLL1_D4,
164 CLK_TOP_UNIVPLL_D5,
165 CLK_TOP_UNIVPLL2_D2,
166 CLK_TOP_UNIVPLL_D7
167};
168
169static const int mem_parents[] = {
170 CLK_XTAL,
171 CLK_TOP_DMPLL
172};
173
174static const int ddrphycfg_parents[] = {
175 CLK_XTAL,
176 CLK_TOP_SYSPLL1_D8
177};
178
179static const int eth_parents[] = {
180 CLK_XTAL,
181 CLK_TOP_SYSPLL1_D2,
182 CLK_TOP_UNIVPLL1_D2,
183 CLK_TOP_SYSPLL1_D4,
184 CLK_TOP_UNIVPLL_D5,
185 -1,
186 CLK_TOP_UNIVPLL_D7
187};
188
189static const int pwm_parents[] = {
190 CLK_XTAL,
191 CLK_TOP_UNIVPLL2_D4
192};
193
194static const int f10m_ref_parents[] = {
195 CLK_XTAL,
196 CLK_TOP_SYSPLL4_D16
197};
198
199static const int nfi_infra_parents[] = {
200 CLK_XTAL,
201 CLK_XTAL,
202 CLK_XTAL,
203 CLK_XTAL,
204 CLK_XTAL,
205 CLK_XTAL,
206 CLK_XTAL,
207 CLK_XTAL,
208 CLK_TOP_UNIVPLL2_D8,
209 CLK_TOP_SYSPLL1_D8,
210 CLK_TOP_UNIVPLL1_D8,
211 CLK_TOP_SYSPLL4_D2,
212 CLK_TOP_UNIVPLL2_D4,
213 CLK_TOP_UNIVPLL3_D2,
214 CLK_TOP_SYSPLL1_D4
215};
216
217static const int flash_parents[] = {
218 CLK_XTAL,
219 CLK_TOP_UNIVPLL_D80_D4,
220 CLK_TOP_SYSPLL2_D8,
221 CLK_TOP_SYSPLL3_D4,
222 CLK_TOP_UNIVPLL3_D4,
223 CLK_TOP_UNIVPLL1_D8,
224 CLK_TOP_SYSPLL2_D4,
225 CLK_TOP_UNIVPLL2_D4
226};
227
228static const int uart_parents[] = {
229 CLK_XTAL,
230 CLK_TOP_UNIVPLL2_D8
231};
232
233static const int spi0_parents[] = {
234 CLK_XTAL,
235 CLK_TOP_SYSPLL3_D2,
236 CLK_XTAL,
237 CLK_TOP_SYSPLL2_D4,
238 CLK_TOP_SYSPLL4_D2,
239 CLK_TOP_UNIVPLL2_D4,
240 CLK_TOP_UNIVPLL1_D8,
241 CLK_XTAL
242};
243
244static const int spi1_parents[] = {
245 CLK_XTAL,
246 CLK_TOP_SYSPLL3_D2,
247 CLK_XTAL,
248 CLK_TOP_SYSPLL4_D4,
249 CLK_TOP_SYSPLL4_D2,
250 CLK_TOP_UNIVPLL2_D4,
251 CLK_TOP_UNIVPLL1_D8,
252 CLK_XTAL
253};
254
255static const int msdc30_0_parents[] = {
256 CLK_XTAL,
257 CLK_TOP_UNIVPLL2_D16,
258 CLK_TOP_UNIV48M
259};
260
261static const int a1sys_hp_parents[] = {
262 CLK_XTAL,
263 CLK_TOP_AUD1PLL,
264 CLK_TOP_AUD2PLL,
265 CLK_XTAL
266};
267
268static const int intdir_parents[] = {
269 CLK_XTAL,
270 CLK_TOP_SYSPLL1_D2,
271 CLK_TOP_UNIVPLL_D2,
272 CLK_TOP_SGMIIPLL
273};
274
275static const int aud_intbus_parents[] = {
276 CLK_XTAL,
277 CLK_TOP_SYSPLL1_D4,
278 CLK_TOP_SYSPLL4_D2,
279 CLK_TOP_SYSPLL3_D2
280};
281
282static const int pmicspi_parents[] = {
283 CLK_XTAL,
284 -1,
285 -1,
286 -1,
287 -1,
288 CLK_TOP_UNIVPLL2_D16
289};
290
291static const int atb_parents[] = {
292 CLK_XTAL,
293 CLK_TOP_SYSPLL1_D2,
294 CLK_TOP_SYSPLL_D5
295};
296
297static const int audio_parents[] = {
298 CLK_XTAL,
299 CLK_TOP_SYSPLL3_D4,
300 CLK_TOP_SYSPLL4_D4,
301 CLK_TOP_UNIVPLL1_D16
302};
303
304static const int usb20_parents[] = {
305 CLK_XTAL,
306 CLK_TOP_UNIVPLL3_D4,
307 CLK_TOP_SYSPLL1_D8,
308 CLK_XTAL
309};
310
311static const int aud1_parents[] = {
312 CLK_XTAL,
313 CLK_TOP_AUD1PLL
314};
315
316static const int asm_l_parents[] = {
317 CLK_XTAL,
318 CLK_TOP_SYSPLL_D5,
319 CLK_TOP_UNIVPLL2_D2,
320 CLK_TOP_UNIVPLL2_D4
321};
322
323static const int apll1_ck_parents[] = {
324 CLK_TOP_AUD1_SEL,
325 CLK_TOP_AUD2_SEL
326};
327
328static const struct mtk_composite top_muxes[] = {
329 /* CLK_CFG_0 */
330 MUX_GATE(CLK_TOP_AXI_SEL, axi_parents, 0x40, 0, 3, 7),
331 MUX_GATE(CLK_TOP_MEM_SEL, mem_parents, 0x40, 8, 1, 15),
332 MUX_GATE(CLK_TOP_DDRPHYCFG_SEL, ddrphycfg_parents, 0x40, 16, 1, 23),
333 MUX_GATE(CLK_TOP_ETH_SEL, eth_parents, 0x40, 24, 3, 31),
334
335 /* CLK_CFG_1 */
336 MUX_GATE(CLK_TOP_PWM_SEL, pwm_parents, 0x50, 0, 2, 7),
337 MUX_GATE(CLK_TOP_F10M_REF_SEL, f10m_ref_parents, 0x50, 8, 1, 15),
338 MUX_GATE(CLK_TOP_NFI_INFRA_SEL, nfi_infra_parents, 0x50, 16, 4, 23),
339 MUX_GATE(CLK_TOP_FLASH_SEL, flash_parents, 0x50, 24, 3, 31),
340
341 /* CLK_CFG_2 */
342 MUX_GATE(CLK_TOP_UART_SEL, uart_parents, 0x60, 0, 1, 7),
343 MUX_GATE(CLK_TOP_SPI0_SEL, spi0_parents, 0x60, 8, 3, 15),
344 MUX_GATE(CLK_TOP_SPI1_SEL, spi1_parents, 0x60, 16, 3, 23),
345 MUX_GATE(CLK_TOP_MSDC50_0_SEL, uart_parents, 0x60, 24, 3, 31),
346
347 /* CLK_CFG_3 */
348 MUX_GATE(CLK_TOP_MSDC30_0_SEL, msdc30_0_parents, 0x70, 0, 3, 7),
349 MUX_GATE(CLK_TOP_MSDC30_1_SEL, msdc30_0_parents, 0x70, 8, 3, 15),
350 MUX_GATE(CLK_TOP_A1SYS_HP_SEL, a1sys_hp_parents, 0x70, 16, 3, 23),
351 MUX_GATE(CLK_TOP_A2SYS_HP_SEL, a1sys_hp_parents, 0x70, 24, 3, 31),
352
353 /* CLK_CFG_4 */
354 MUX_GATE(CLK_TOP_INTDIR_SEL, intdir_parents, 0x80, 0, 2, 7),
355 MUX_GATE(CLK_TOP_AUD_INTBUS_SEL, aud_intbus_parents, 0x80, 8, 2, 15),
356 MUX_GATE(CLK_TOP_PMICSPI_SEL, pmicspi_parents, 0x80, 16, 3, 23),
357 MUX_GATE(CLK_TOP_SCP_SEL, ddrphycfg_parents, 0x80, 24, 2, 31),
358
359 /* CLK_CFG_5 */
360 MUX_GATE(CLK_TOP_ATB_SEL, atb_parents, 0x90, 0, 2, 7),
361 MUX_GATE_FLAGS(CLK_TOP_HIF_SEL, eth_parents, 0x90, 8, 3, 15,
362 CLK_DOMAIN_SCPSYS),
363 MUX_GATE(CLK_TOP_AUDIO_SEL, audio_parents, 0x90, 16, 2, 23),
364 MUX_GATE(CLK_TOP_U2_SEL, usb20_parents, 0x90, 24, 2, 31),
365
366 /* CLK_CFG_6 */
367 MUX_GATE(CLK_TOP_AUD1_SEL, aud1_parents, 0xA0, 0, 1, 7),
368 MUX_GATE(CLK_TOP_AUD2_SEL, aud1_parents, 0xA0, 8, 1, 15),
369 MUX_GATE(CLK_TOP_IRRX_SEL, f10m_ref_parents, 0xA0, 16, 1, 23),
370 MUX_GATE(CLK_TOP_IRTX_SEL, f10m_ref_parents, 0xA0, 24, 1, 31),
371
372 /* CLK_CFG_7 */
373 MUX_GATE(CLK_TOP_ASM_L_SEL, asm_l_parents, 0xB0, 0, 2, 7),
374 MUX_GATE(CLK_TOP_ASM_M_SEL, asm_l_parents, 0xB0, 8, 2, 15),
375 MUX_GATE(CLK_TOP_ASM_H_SEL, asm_l_parents, 0xB0, 16, 2, 23),
376
377 /* CLK_AUDDIV_0 */
378 MUX(CLK_TOP_APLL1_SEL, apll1_ck_parents, 0x120, 6, 1),
379 MUX(CLK_TOP_APLL2_SEL, apll1_ck_parents, 0x120, 7, 1),
380 MUX(CLK_TOP_I2S0_MCK_SEL, apll1_ck_parents, 0x120, 8, 1),
381 MUX(CLK_TOP_I2S1_MCK_SEL, apll1_ck_parents, 0x120, 9, 1),
382 MUX(CLK_TOP_I2S2_MCK_SEL, apll1_ck_parents, 0x120, 10, 1),
383 MUX(CLK_TOP_I2S3_MCK_SEL, apll1_ck_parents, 0x120, 161, 1),
384};
385
386/* infracfg */
Christian Marangia942c0c2024-08-03 10:43:23 +0200387#define APMIXED_PARENT(_id) PARENT(_id, CLK_PARENT_APMIXED)
388#define XTAL_PARENT(_id) PARENT(_id, CLK_PARENT_XTAL)
389
390static const struct mtk_parent infra_mux1_parents[] = {
391 XTAL_PARENT(CLK_XTAL),
392 APMIXED_PARENT(CLK_APMIXED_MAINPLL),
393 APMIXED_PARENT(CLK_APMIXED_MAIN_CORE_EN),
394 APMIXED_PARENT(CLK_APMIXED_MAINPLL),
395};
396
397static const struct mtk_composite infra_muxes[] = {
398 MUX_MIXED(CLK_INFRA_MUX1_SEL, infra_mux1_parents, 0x000, 2, 2),
399};
400
Sam Shih72ab6032020-01-10 16:30:29 +0800401static const struct mtk_gate_regs infra_cg_regs = {
402 .set_ofs = 0x40,
403 .clr_ofs = 0x44,
404 .sta_ofs = 0x48,
405};
406
407#define GATE_INFRA(_id, _parent, _shift) { \
408 .id = _id, \
409 .parent = _parent, \
410 .regs = &infra_cg_regs, \
411 .shift = _shift, \
412 .flags = CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN, \
413 }
414
415static const struct mtk_gate infra_cgs[] = {
416 GATE_INFRA(CLK_INFRA_DBGCLK_PD, CLK_TOP_AXI_SEL, 0),
Sam Shih72ab6032020-01-10 16:30:29 +0800417 GATE_INFRA(CLK_INFRA_AUDIO_PD, CLK_TOP_AUD_INTBUS_SEL, 5),
418 GATE_INFRA(CLK_INFRA_IRRX_PD, CLK_TOP_IRRX_SEL, 16),
419 GATE_INFRA(CLK_INFRA_APXGPT_PD, CLK_TOP_F10M_REF_SEL, 18),
420 GATE_INFRA(CLK_INFRA_PMIC_PD, CLK_TOP_PMICSPI_SEL, 22),
Christian Marangi72461382024-08-03 10:43:21 +0200421 GATE_INFRA(CLK_INFRA_TRNG, CLK_TOP_AXI_SEL, 2),
Sam Shih72ab6032020-01-10 16:30:29 +0800422};
423
424/* pericfg */
Christian Marangi105c7882024-08-03 10:43:25 +0200425static const int peribus_ck_parents[] = {
426 CLK_TOP_SYSPLL1_D8,
427 CLK_TOP_SYSPLL1_D4,
428};
429
430#define PERI_MUX(_id, _parents, _reg, _shift, _width) \
431 MUX_FLAGS(_id, _parents, _reg, _shift, _width, CLK_PARENT_TOPCKGEN)
432
433static const struct mtk_composite peri_muxes[] = {
434 PERI_MUX(CLK_PERIBUS_SEL, peribus_ck_parents, 0x05c, 0, 1),
435};
436
Sam Shih72ab6032020-01-10 16:30:29 +0800437static const struct mtk_gate_regs peri0_cg_regs = {
438 .set_ofs = 0x8,
439 .clr_ofs = 0x10,
440 .sta_ofs = 0x18,
441};
442
443static const struct mtk_gate_regs peri1_cg_regs = {
444 .set_ofs = 0xC,
445 .clr_ofs = 0x14,
446 .sta_ofs = 0x1C,
447};
448
Christian Marangic7978fd2024-08-03 10:43:19 +0200449#define GATE_PERI0_FLAGS(_id, _parent, _shift, _flags) { \
Sam Shih72ab6032020-01-10 16:30:29 +0800450 .id = _id, \
451 .parent = _parent, \
452 .regs = &peri0_cg_regs, \
453 .shift = _shift, \
Christian Marangic7978fd2024-08-03 10:43:19 +0200454 .flags = _flags, \
Sam Shih72ab6032020-01-10 16:30:29 +0800455 }
Christian Marangic7978fd2024-08-03 10:43:19 +0200456#define GATE_PERI0(_id, _parent, _shift) \
457 GATE_PERI0_FLAGS(_id, _parent, _shift, CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN)
458#define GATE_PERI0_XTAL(_id, _parent, _shift) \
459 GATE_PERI0_FLAGS(_id, _parent, _shift, CLK_GATE_SETCLR | CLK_PARENT_XTAL)
Sam Shih72ab6032020-01-10 16:30:29 +0800460
461#define GATE_PERI1(_id, _parent, _shift) { \
462 .id = _id, \
463 .parent = _parent, \
464 .regs = &peri1_cg_regs, \
465 .shift = _shift, \
466 .flags = CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN, \
467 }
468
469static const struct mtk_gate peri_cgs[] = {
470 /* PERI0 */
471 GATE_PERI0(CLK_PERI_THERM_PD, CLK_TOP_AXI_SEL, 1),
Christian Marangic7978fd2024-08-03 10:43:19 +0200472 GATE_PERI0_XTAL(CLK_PERI_PWM1_PD, CLK_XTAL, 2),
473 GATE_PERI0_XTAL(CLK_PERI_PWM2_PD, CLK_XTAL, 3),
474 GATE_PERI0_XTAL(CLK_PERI_PWM3_PD, CLK_XTAL, 4),
475 GATE_PERI0_XTAL(CLK_PERI_PWM4_PD, CLK_XTAL, 5),
476 GATE_PERI0_XTAL(CLK_PERI_PWM5_PD, CLK_XTAL, 6),
477 GATE_PERI0_XTAL(CLK_PERI_PWM6_PD, CLK_XTAL, 7),
478 GATE_PERI0_XTAL(CLK_PERI_PWM7_PD, CLK_XTAL, 8),
479 GATE_PERI0_XTAL(CLK_PERI_PWM_PD, CLK_XTAL, 9),
Sam Shih72ab6032020-01-10 16:30:29 +0800480 GATE_PERI0(CLK_PERI_AP_DMA_PD, CLK_TOP_AXI_SEL, 12),
481 GATE_PERI0(CLK_PERI_MSDC30_0_PD, CLK_TOP_MSDC30_0_SEL, 13),
482 GATE_PERI0(CLK_PERI_MSDC30_1_PD, CLK_TOP_MSDC30_1_SEL, 14),
483 GATE_PERI0(CLK_PERI_UART0_PD, CLK_TOP_AXI_SEL, 17),
484 GATE_PERI0(CLK_PERI_UART1_PD, CLK_TOP_AXI_SEL, 18),
485 GATE_PERI0(CLK_PERI_UART2_PD, CLK_TOP_AXI_SEL, 19),
486 GATE_PERI0(CLK_PERI_UART3_PD, CLK_TOP_AXI_SEL, 20),
Christian Marangia7764932024-08-03 10:43:24 +0200487 GATE_PERI0(CLK_PERI_UART4_PD, CLK_TOP_AXI_SEL, 21),
Sam Shih72ab6032020-01-10 16:30:29 +0800488 GATE_PERI0(CLK_PERI_BTIF_PD, CLK_TOP_AXI_SEL, 22),
489 GATE_PERI0(CLK_PERI_I2C0_PD, CLK_TOP_AXI_SEL, 23),
490 GATE_PERI0(CLK_PERI_I2C1_PD, CLK_TOP_AXI_SEL, 24),
491 GATE_PERI0(CLK_PERI_I2C2_PD, CLK_TOP_AXI_SEL, 25),
492 GATE_PERI0(CLK_PERI_SPI1_PD, CLK_TOP_SPI1_SEL, 26),
Christian Marangic7978fd2024-08-03 10:43:19 +0200493 GATE_PERI0_XTAL(CLK_PERI_AUXADC_PD, CLK_XTAL, 27),
Sam Shih72ab6032020-01-10 16:30:29 +0800494 GATE_PERI0(CLK_PERI_SPI0_PD, CLK_TOP_SPI0_SEL, 28),
495 GATE_PERI0(CLK_PERI_SNFI_PD, CLK_TOP_NFI_INFRA_SEL, 29),
496 GATE_PERI0(CLK_PERI_NFI_PD, CLK_TOP_AXI_SEL, 30),
497 GATE_PERI1(CLK_PERI_NFIECC_PD, CLK_TOP_AXI_SEL, 31),
498
499 /* PERI1 */
500 GATE_PERI1(CLK_PERI_FLASH_PD, CLK_TOP_FLASH_SEL, 1),
501 GATE_PERI1(CLK_PERI_IRTX_PD, CLK_TOP_IRTX_SEL, 2),
502};
503
Chuanjia Liuc5bfe692020-08-10 16:17:08 +0800504/* pciesys */
505static const struct mtk_gate_regs pcie_cg_regs = {
506 .set_ofs = 0x30,
507 .clr_ofs = 0x30,
508 .sta_ofs = 0x30,
509};
510
511#define GATE_PCIE(_id, _parent, _shift) { \
512 .id = _id, \
513 .parent = _parent, \
514 .regs = &pcie_cg_regs, \
515 .shift = _shift, \
516 .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \
517 }
518
519static const struct mtk_gate pcie_cgs[] = {
520 GATE_PCIE(CLK_PCIE_P1_AUX_EN, CLK_TOP_P1_1MHZ, 12),
521 GATE_PCIE(CLK_PCIE_P1_OBFF_EN, CLK_TOP_4MHZ, 13),
522 GATE_PCIE(CLK_PCIE_P1_AHB_EN, CLK_TOP_AXI_SEL, 14),
523 GATE_PCIE(CLK_PCIE_P1_AXI_EN, CLK_TOP_HIF_SEL, 15),
524 GATE_PCIE(CLK_PCIE_P1_MAC_EN, CLK_TOP_PCIE1_MAC_EN, 16),
525 GATE_PCIE(CLK_PCIE_P1_PIPE_EN, CLK_TOP_PCIE1_PIPE_EN, 17),
526 GATE_PCIE(CLK_PCIE_P0_AUX_EN, CLK_TOP_P0_1MHZ, 18),
527 GATE_PCIE(CLK_PCIE_P0_OBFF_EN, CLK_TOP_4MHZ, 19),
528 GATE_PCIE(CLK_PCIE_P0_AHB_EN, CLK_TOP_AXI_SEL, 20),
529 GATE_PCIE(CLK_PCIE_P0_AXI_EN, CLK_TOP_HIF_SEL, 21),
530 GATE_PCIE(CLK_PCIE_P0_MAC_EN, CLK_TOP_PCIE0_MAC_EN, 22),
531 GATE_PCIE(CLK_PCIE_P0_PIPE_EN, CLK_TOP_PCIE0_PIPE_EN, 23),
532 GATE_PCIE(CLK_SATA_AHB_EN, CLK_TOP_AXI_SEL, 26),
533 GATE_PCIE(CLK_SATA_AXI_EN, CLK_TOP_HIF_SEL, 27),
534 GATE_PCIE(CLK_SATA_ASIC_EN, CLK_TOP_SATA_ASIC, 28),
535 GATE_PCIE(CLK_SATA_RBC_EN, CLK_TOP_SATA_RBC, 29),
536 GATE_PCIE(CLK_SATA_PM_EN, CLK_TOP_UNIVPLL2_D4, 30),
537};
538
Sam Shih72ab6032020-01-10 16:30:29 +0800539/* ethsys */
540static const struct mtk_gate_regs eth_cg_regs = {
541 .sta_ofs = 0x30,
542};
543
544#define GATE_ETH(_id, _parent, _shift) { \
545 .id = _id, \
546 .parent = _parent, \
547 .regs = &eth_cg_regs, \
548 .shift = _shift, \
549 .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \
550 }
551
552static const struct mtk_gate eth_cgs[] = {
553 GATE_ETH(CLK_ETH_HSDMA_EN, CLK_TOP_ETH_SEL, 5),
554 GATE_ETH(CLK_ETH_ESW_EN, CLK_TOP_ETH_500M, 6),
555 GATE_ETH(CLK_ETH_GP2_EN, CLK_TOP_TXCLK_SRC_PRE, 7),
556 GATE_ETH(CLK_ETH_GP1_EN, CLK_TOP_TXCLK_SRC_PRE, 8),
557 GATE_ETH(CLK_ETH_GP0_EN, CLK_TOP_TXCLK_SRC_PRE, 9),
558};
559
560static const struct mtk_gate_regs sgmii_cg_regs = {
561 .sta_ofs = 0xE4,
562};
563
564#define GATE_SGMII(_id, _parent, _shift) { \
565 .id = _id, \
566 .parent = _parent, \
567 .regs = &sgmii_cg_regs, \
568 .shift = _shift, \
569 .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \
570}
571
Frank Wunderlich9f25aa12020-08-20 16:37:55 +0200572static const struct mtk_gate_regs ssusb_cg_regs = {
573 .set_ofs = 0x30,
574 .clr_ofs = 0x30,
575 .sta_ofs = 0x30,
576};
577
578#define GATE_SSUSB(_id, _parent, _shift) { \
579 .id = _id, \
580 .parent = _parent, \
581 .regs = &ssusb_cg_regs, \
582 .shift = _shift, \
583 .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \
584}
585
Sam Shih72ab6032020-01-10 16:30:29 +0800586static const struct mtk_gate sgmii_cgs[] = {
587 GATE_SGMII(CLK_SGMII_TX250M_EN, CLK_TOP_SSUSB_TX250M, 2),
588 GATE_SGMII(CLK_SGMII_RX250M_EN, CLK_TOP_SSUSB_EQ_RX250M, 3),
589 GATE_SGMII(CLK_SGMII_CDR_REF, CLK_TOP_SSUSB_CDR_REF, 4),
590 GATE_SGMII(CLK_SGMII_CDR_FB, CLK_TOP_SSUSB_CDR_FB, 5),
591};
592
Frank Wunderlich9f25aa12020-08-20 16:37:55 +0200593static const struct mtk_gate ssusb_cgs[] = {
594 GATE_SSUSB(CLK_SSUSB_U2_PHY_1P_EN, CLK_TOP_TO_U2_PHY_1P, 0),
595 GATE_SSUSB(CLK_SSUSB_U2_PHY_EN, CLK_TOP_TO_U2_PHY, 1),
596 GATE_SSUSB(CLK_SSUSB_REF_EN, CLK_TOP_TO_USB3_REF, 5),
597 GATE_SSUSB(CLK_SSUSB_SYS_EN, CLK_TOP_TO_USB3_SYS, 6),
598 GATE_SSUSB(CLK_SSUSB_MCU_EN, CLK_TOP_AXI_SEL, 7),
599 GATE_SSUSB(CLK_SSUSB_DMA_EN, CLK_TOP_HIF_SEL, 8),
600};
601
Christian Marangi6dfa9912024-08-03 10:43:22 +0200602static const struct mtk_clk_tree mt7622_apmixed_clk_tree = {
603 .xtal2_rate = 25 * MHZ,
604 .plls = apmixed_plls,
605 .gates_offs = CLK_APMIXED_MAIN_CORE_EN,
606 .gates = apmixed_cgs,
607};
608
Christian Marangia942c0c2024-08-03 10:43:23 +0200609static const struct mtk_clk_tree mt7622_infra_clk_tree = {
610 .xtal_rate = 25 * MHZ,
611 .muxes_offs = CLK_INFRA_MUX1_SEL,
612 .gates_offs = CLK_INFRA_DBGCLK_PD,
613 .muxes = infra_muxes,
614 .gates = infra_cgs,
615};
616
Christian Marangi105c7882024-08-03 10:43:25 +0200617static const struct mtk_clk_tree mt7622_peri_clk_tree = {
618 .xtal_rate = 25 * MHZ,
619 .muxes_offs = CLK_PERIBUS_SEL,
620 .gates_offs = CLK_PERI_THERM_PD,
621 .muxes = peri_muxes,
622 .gates = peri_cgs,
623};
624
Sam Shih72ab6032020-01-10 16:30:29 +0800625static const struct mtk_clk_tree mt7622_clk_tree = {
626 .xtal_rate = 25 * MHZ,
Sam Shih72ab6032020-01-10 16:30:29 +0800627 .fdivs_offs = CLK_TOP_TO_USB3_SYS,
628 .muxes_offs = CLK_TOP_AXI_SEL,
Sam Shih72ab6032020-01-10 16:30:29 +0800629 .fclks = top_fixed_clks,
630 .fdivs = top_fixed_divs,
631 .muxes = top_muxes,
632};
633
634static int mt7622_mcucfg_probe(struct udevice *dev)
635{
636 void __iomem *base;
637
638 base = dev_read_addr_ptr(dev);
639 if (!base)
640 return -ENOENT;
641
642 clrsetbits_le32(base + MCU_AXI_DIV, AXI_DIV_MSK,
643 AXI_DIV_SEL(0x12));
644 clrsetbits_le32(base + MCU_BUS_MUX, MCU_BUS_MSK,
645 MCU_BUS_SEL(0x1));
646
647 return 0;
648}
649
650static int mt7622_apmixedsys_probe(struct udevice *dev)
651{
652 struct mtk_clk_priv *priv = dev_get_priv(dev);
653 int ret;
654
Christian Marangi6dfa9912024-08-03 10:43:22 +0200655 ret = mtk_common_clk_init(dev, &mt7622_apmixed_clk_tree);
Sam Shih72ab6032020-01-10 16:30:29 +0800656 if (ret)
657 return ret;
658
659 /* reduce clock square disable time */
660 // writel(0x501, priv->base + MT7622_CLKSQ_STB_CON0);
661 writel(0x98940501, priv->base + MT7622_CLKSQ_STB_CON0);
662
663 /* extend pwr/iso control timing to 1us */
664 writel(0x80008, priv->base + MT7622_PLL_ISO_CON0);
665
666 return 0;
667}
668
669static int mt7622_topckgen_probe(struct udevice *dev)
670{
671 return mtk_common_clk_init(dev, &mt7622_clk_tree);
672}
673
674static int mt7622_infracfg_probe(struct udevice *dev)
675{
Christian Marangia942c0c2024-08-03 10:43:23 +0200676 return mtk_common_clk_infrasys_init(dev, &mt7622_infra_clk_tree);
Sam Shih72ab6032020-01-10 16:30:29 +0800677}
678
679static int mt7622_pericfg_probe(struct udevice *dev)
680{
Christian Marangi105c7882024-08-03 10:43:25 +0200681 return mtk_common_clk_infrasys_init(dev, &mt7622_peri_clk_tree);
Sam Shih72ab6032020-01-10 16:30:29 +0800682}
683
Chuanjia Liuc5bfe692020-08-10 16:17:08 +0800684static int mt7622_pciesys_probe(struct udevice *dev)
685{
686 return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, pcie_cgs);
687}
688
Frank Wunderlichfee276e2020-08-13 10:20:46 +0200689static int mt7622_pciesys_bind(struct udevice *dev)
690{
691 int ret = 0;
692
693 if (IS_ENABLED(CONFIG_RESET_MEDIATEK)) {
Frank Wunderlichfee276e2020-08-13 10:20:46 +0200694 ret = mediatek_reset_bind(dev, ETHSYS_HIFSYS_RST_CTRL_OFS, 1);
695 if (ret)
696 debug("Warning: failed to bind reset controller\n");
697 }
698
699 return ret;
700}
701
Sam Shih72ab6032020-01-10 16:30:29 +0800702static int mt7622_ethsys_probe(struct udevice *dev)
703{
704 return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, eth_cgs);
705}
706
707static int mt7622_ethsys_bind(struct udevice *dev)
708{
709 int ret = 0;
710
711#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
712 ret = mediatek_reset_bind(dev, ETHSYS_HIFSYS_RST_CTRL_OFS, 1);
713 if (ret)
714 debug("Warning: failed to bind reset controller\n");
715#endif
716
717 return ret;
718}
719
720static int mt7622_sgmiisys_probe(struct udevice *dev)
721{
722 return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, sgmii_cgs);
723}
724
Frank Wunderlich9f25aa12020-08-20 16:37:55 +0200725static int mt7622_ssusbsys_probe(struct udevice *dev)
726{
727 return mtk_common_clk_gate_init(dev, &mt7622_clk_tree, ssusb_cgs);
728}
729
Sam Shih72ab6032020-01-10 16:30:29 +0800730static const struct udevice_id mt7622_apmixed_compat[] = {
731 { .compatible = "mediatek,mt7622-apmixedsys" },
732 { }
733};
734
735static const struct udevice_id mt7622_topckgen_compat[] = {
736 { .compatible = "mediatek,mt7622-topckgen" },
737 { }
738};
739
740static const struct udevice_id mt7622_infracfg_compat[] = {
741 { .compatible = "mediatek,mt7622-infracfg", },
742 { }
743};
744
745static const struct udevice_id mt7622_pericfg_compat[] = {
746 { .compatible = "mediatek,mt7622-pericfg", },
747 { }
748};
749
Chuanjia Liuc5bfe692020-08-10 16:17:08 +0800750static const struct udevice_id mt7622_pciesys_compat[] = {
751 { .compatible = "mediatek,mt7622-pciesys", },
752 { }
753};
754
Sam Shih72ab6032020-01-10 16:30:29 +0800755static const struct udevice_id mt7622_ethsys_compat[] = {
756 { .compatible = "mediatek,mt7622-ethsys", },
757 { }
758};
759
760static const struct udevice_id mt7622_sgmiisys_compat[] = {
761 { .compatible = "mediatek,mt7622-sgmiisys", },
762 { }
763};
764
765static const struct udevice_id mt7622_mcucfg_compat[] = {
766 { .compatible = "mediatek,mt7622-mcucfg" },
767 { }
768};
769
Frank Wunderlich9f25aa12020-08-20 16:37:55 +0200770static const struct udevice_id mt7622_ssusbsys_compat[] = {
771 { .compatible = "mediatek,mt7622-ssusbsys" },
772 { }
773};
774
Sam Shih72ab6032020-01-10 16:30:29 +0800775U_BOOT_DRIVER(mtk_mcucfg) = {
776 .name = "mt7622-mcucfg",
777 .id = UCLASS_SYSCON,
778 .of_match = mt7622_mcucfg_compat,
779 .probe = mt7622_mcucfg_probe,
780 .flags = DM_FLAG_PRE_RELOC,
781};
782
783U_BOOT_DRIVER(mtk_clk_apmixedsys) = {
784 .name = "mt7622-clock-apmixedsys",
785 .id = UCLASS_CLK,
786 .of_match = mt7622_apmixed_compat,
787 .probe = mt7622_apmixedsys_probe,
Simon Glass41575d82020-12-03 16:55:17 -0700788 .priv_auto = sizeof(struct mtk_clk_priv),
Sam Shih72ab6032020-01-10 16:30:29 +0800789 .ops = &mtk_clk_apmixedsys_ops,
790 .flags = DM_FLAG_PRE_RELOC,
791};
792
793U_BOOT_DRIVER(mtk_clk_topckgen) = {
794 .name = "mt7622-clock-topckgen",
795 .id = UCLASS_CLK,
796 .of_match = mt7622_topckgen_compat,
797 .probe = mt7622_topckgen_probe,
Simon Glass41575d82020-12-03 16:55:17 -0700798 .priv_auto = sizeof(struct mtk_clk_priv),
Sam Shih72ab6032020-01-10 16:30:29 +0800799 .ops = &mtk_clk_topckgen_ops,
800 .flags = DM_FLAG_PRE_RELOC,
801};
802
803U_BOOT_DRIVER(mtk_clk_infracfg) = {
804 .name = "mt7622-clock-infracfg",
805 .id = UCLASS_CLK,
806 .of_match = mt7622_infracfg_compat,
807 .probe = mt7622_infracfg_probe,
Simon Glass41575d82020-12-03 16:55:17 -0700808 .priv_auto = sizeof(struct mtk_cg_priv),
Sam Shih72ab6032020-01-10 16:30:29 +0800809 .ops = &mtk_clk_gate_ops,
810 .flags = DM_FLAG_PRE_RELOC,
811};
812
813U_BOOT_DRIVER(mtk_clk_pericfg) = {
814 .name = "mt7622-clock-pericfg",
815 .id = UCLASS_CLK,
816 .of_match = mt7622_pericfg_compat,
817 .probe = mt7622_pericfg_probe,
Simon Glass41575d82020-12-03 16:55:17 -0700818 .priv_auto = sizeof(struct mtk_cg_priv),
Sam Shih72ab6032020-01-10 16:30:29 +0800819 .ops = &mtk_clk_gate_ops,
820 .flags = DM_FLAG_PRE_RELOC,
821};
822
Chuanjia Liuc5bfe692020-08-10 16:17:08 +0800823U_BOOT_DRIVER(mtk_clk_pciesys) = {
824 .name = "mt7622-clock-pciesys",
825 .id = UCLASS_CLK,
826 .of_match = mt7622_pciesys_compat,
827 .probe = mt7622_pciesys_probe,
Frank Wunderlichfee276e2020-08-13 10:20:46 +0200828 .bind = mt7622_pciesys_bind,
Simon Glass41575d82020-12-03 16:55:17 -0700829 .priv_auto = sizeof(struct mtk_cg_priv),
Chuanjia Liuc5bfe692020-08-10 16:17:08 +0800830 .ops = &mtk_clk_gate_ops,
831};
832
Sam Shih72ab6032020-01-10 16:30:29 +0800833U_BOOT_DRIVER(mtk_clk_ethsys) = {
834 .name = "mt7622-clock-ethsys",
835 .id = UCLASS_CLK,
836 .of_match = mt7622_ethsys_compat,
837 .probe = mt7622_ethsys_probe,
838 .bind = mt7622_ethsys_bind,
Simon Glass41575d82020-12-03 16:55:17 -0700839 .priv_auto = sizeof(struct mtk_cg_priv),
Sam Shih72ab6032020-01-10 16:30:29 +0800840 .ops = &mtk_clk_gate_ops,
841};
842
843U_BOOT_DRIVER(mtk_clk_sgmiisys) = {
844 .name = "mt7622-clock-sgmiisys",
845 .id = UCLASS_CLK,
846 .of_match = mt7622_sgmiisys_compat,
847 .probe = mt7622_sgmiisys_probe,
Simon Glass41575d82020-12-03 16:55:17 -0700848 .priv_auto = sizeof(struct mtk_cg_priv),
Sam Shih72ab6032020-01-10 16:30:29 +0800849 .ops = &mtk_clk_gate_ops,
850};
Frank Wunderlich9f25aa12020-08-20 16:37:55 +0200851
852U_BOOT_DRIVER(mtk_clk_ssusbsys) = {
853 .name = "mt7622-clock-ssusbsys",
854 .id = UCLASS_CLK,
855 .of_match = mt7622_ssusbsys_compat,
856 .probe = mt7622_ssusbsys_probe,
Simon Glass41575d82020-12-03 16:55:17 -0700857 .priv_auto = sizeof(struct mtk_cg_priv),
Frank Wunderlich9f25aa12020-08-20 16:37:55 +0200858 .ops = &mtk_clk_gate_ops,
859};