blob: d0b80f48b0a5e80a0f44b7d0a425fda24910149f [file] [log] [blame]
developerd1b1ffa2018-11-15 10:07:55 +08001// SPDX-License-Identifier: GPL-2.0
2/*
3 * MediaTek clock driver for MT7623 SoC
4 *
5 * Copyright (C) 2018 MediaTek Inc.
6 * Author: Ryder Lee <ryder.lee@mediatek.com>
7 */
8
developerd1b1ffa2018-11-15 10:07:55 +08009#include <dm.h>
Simon Glass0f2af882020-05-10 11:40:05 -060010#include <log.h>
developer02259452018-12-20 16:12:52 +080011#include <asm/arch-mediatek/reset.h>
developerd1b1ffa2018-11-15 10:07:55 +080012#include <asm/io.h>
13#include <dt-bindings/clock/mt7623-clk.h>
Simon Glass4dcacfc2020-05-10 11:40:13 -060014#include <linux/bitops.h>
developerd1b1ffa2018-11-15 10:07:55 +080015
16#include "clk-mtk.h"
17
18#define MT7623_CLKSQ_STB_CON0 0x18
19#define MT7623_PLL_ISO_CON0 0x24
20#define MT7623_PLL_FMAX (2000UL * MHZ)
21#define MT7623_CON0_RST_BAR BIT(27)
22
23#define MCU_AXI_DIV 0x60
24#define AXI_DIV_MSK GENMASK(4, 0)
25#define AXI_DIV_SEL(x) (x)
26
27/* apmixedsys */
Christian Marangib6ea6202024-08-02 15:45:04 +020028static const int pll_id_offs_map[] = {
29 [CLK_APMIXED_ARMPLL] = 0,
30 [CLK_APMIXED_MAINPLL] = 1,
31 [CLK_APMIXED_UNIVPLL] = 2,
32 [CLK_APMIXED_MMPLL] = 3,
33 [CLK_APMIXED_MSDCPLL] = 4,
34 [CLK_APMIXED_TVDPLL] = 5,
35 [CLK_APMIXED_AUD1PLL] = 6,
36 [CLK_APMIXED_TRGPLL] = 7,
37 [CLK_APMIXED_ETHPLL] = 8,
38 [CLK_APMIXED_VDECPLL] = 9,
39 [CLK_APMIXED_HADDS2PLL] = 10,
40 [CLK_APMIXED_AUD2PLL] = 11,
41 [CLK_APMIXED_TVD2PLL] = 12,
42};
43
developerd1b1ffa2018-11-15 10:07:55 +080044#define PLL(_id, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, _pd_reg, \
45 _pd_shift, _pcw_reg, _pcw_shift) { \
46 .id = _id, \
47 .reg = _reg, \
48 .pwr_reg = _pwr_reg, \
49 .en_mask = _en_mask, \
50 .rst_bar_mask = MT7623_CON0_RST_BAR, \
51 .fmax = MT7623_PLL_FMAX, \
52 .flags = _flags, \
53 .pcwbits = _pcwbits, \
54 .pd_reg = _pd_reg, \
55 .pd_shift = _pd_shift, \
56 .pcw_reg = _pcw_reg, \
57 .pcw_shift = _pcw_shift, \
58 }
59
60static const struct mtk_pll_data apmixed_plls[] = {
61 PLL(CLK_APMIXED_ARMPLL, 0x200, 0x20c, 0x80000001, 0,
62 21, 0x204, 24, 0x204, 0),
63 PLL(CLK_APMIXED_MAINPLL, 0x210, 0x21c, 0xf0000001, HAVE_RST_BAR,
64 21, 0x210, 4, 0x214, 0),
65 PLL(CLK_APMIXED_UNIVPLL, 0x220, 0x22c, 0xf3000001, HAVE_RST_BAR,
66 7, 0x220, 4, 0x224, 14),
67 PLL(CLK_APMIXED_MMPLL, 0x230, 0x23c, 0x00000001, 0,
68 21, 0x230, 4, 0x234, 0),
69 PLL(CLK_APMIXED_MSDCPLL, 0x240, 0x24c, 0x00000001, 0,
70 21, 0x240, 4, 0x244, 0),
71 PLL(CLK_APMIXED_TVDPLL, 0x250, 0x25c, 0x00000001, 0,
72 21, 0x250, 4, 0x254, 0),
73 PLL(CLK_APMIXED_AUD1PLL, 0x270, 0x27c, 0x00000001, 0,
74 31, 0x270, 4, 0x274, 0),
75 PLL(CLK_APMIXED_TRGPLL, 0x280, 0x28c, 0x00000001, 0,
76 31, 0x280, 4, 0x284, 0),
77 PLL(CLK_APMIXED_ETHPLL, 0x290, 0x29c, 0x00000001, 0,
78 31, 0x290, 4, 0x294, 0),
79 PLL(CLK_APMIXED_VDECPLL, 0x2a0, 0x2ac, 0x00000001, 0,
80 31, 0x2a0, 4, 0x2a4, 0),
81 PLL(CLK_APMIXED_HADDS2PLL, 0x2b0, 0x2bc, 0x00000001, 0,
82 31, 0x2b0, 4, 0x2b4, 0),
83 PLL(CLK_APMIXED_AUD2PLL, 0x2c0, 0x2cc, 0x00000001, 0,
84 31, 0x2c0, 4, 0x2c4, 0),
85 PLL(CLK_APMIXED_TVD2PLL, 0x2d0, 0x2dc, 0x00000001, 0,
86 21, 0x2d0, 4, 0x2d4, 0),
87};
88
89/* topckgen */
Christian Marangie80ebc82024-08-02 15:45:03 +020090
91/* Fixed CLK exposed upstream by the hdmi PHY driver */
92#define CLK_TOP_HDMITX_CLKDIG_CTS CLK_TOP_NR
93
94static const int top_id_offs_map[CLK_TOP_NR + 1] = {
95 /* Fixed CLK */
96 [CLK_TOP_DPI] = 0,
97 [CLK_TOP_DMPLL] = 1,
98 [CLK_TOP_VENCPLL] = 2,
99 [CLK_TOP_HDMI_0_PIX340M] = 3,
100 [CLK_TOP_HDMI_0_DEEP340M] = 4,
101 [CLK_TOP_HDMI_0_PLL340M] = 5,
102 [CLK_TOP_HADDS2_FB] = 6,
103 [CLK_TOP_WBG_DIG_416M] = 7,
104 [CLK_TOP_DSI0_LNTC_DSI] = 8,
105 [CLK_TOP_HDMI_SCL_RX] = 9,
106 [CLK_TOP_32K_EXTERNAL] = 10,
107 [CLK_TOP_HDMITX_CLKDIG_CTS] = 11,
108 [CLK_TOP_AUD_EXT1] = 12,
109 [CLK_TOP_AUD_EXT2] = 13,
110 [CLK_TOP_NFI1X_PAD] = 14,
111 /* Factor CLK */
112 [CLK_TOP_SYSPLL] = 15,
113 [CLK_TOP_SYSPLL_D2] = 16,
114 [CLK_TOP_SYSPLL_D3] = 17,
115 [CLK_TOP_SYSPLL_D5] = 18,
116 [CLK_TOP_SYSPLL_D7] = 19,
117 [CLK_TOP_SYSPLL1_D2] = 20,
118 [CLK_TOP_SYSPLL1_D4] = 21,
119 [CLK_TOP_SYSPLL1_D8] = 22,
120 [CLK_TOP_SYSPLL1_D16] = 23,
121 [CLK_TOP_SYSPLL2_D2] = 24,
122 [CLK_TOP_SYSPLL2_D4] = 25,
123 [CLK_TOP_SYSPLL2_D8] = 26,
124 [CLK_TOP_SYSPLL3_D2] = 27,
125 [CLK_TOP_SYSPLL3_D4] = 28,
126 [CLK_TOP_SYSPLL4_D2] = 29,
127 [CLK_TOP_SYSPLL4_D4] = 30,
128 [CLK_TOP_UNIVPLL] = 31,
129 [CLK_TOP_UNIVPLL_D2] = 32,
130 [CLK_TOP_UNIVPLL_D3] = 33,
131 [CLK_TOP_UNIVPLL_D5] = 34,
132 [CLK_TOP_UNIVPLL_D7] = 35,
133 [CLK_TOP_UNIVPLL_D26] = 36,
134 [CLK_TOP_UNIVPLL_D52] = 37,
135 [CLK_TOP_UNIVPLL_D108] = 38,
136 [CLK_TOP_USB_PHY48M] = 39,
137 [CLK_TOP_UNIVPLL1_D2] = 40,
138 [CLK_TOP_UNIVPLL1_D4] = 41,
139 [CLK_TOP_UNIVPLL1_D8] = 42,
140 [CLK_TOP_UNIVPLL2_D2] = 43,
141 [CLK_TOP_UNIVPLL2_D4] = 44,
142 [CLK_TOP_UNIVPLL2_D8] = 45,
143 [CLK_TOP_UNIVPLL2_D16] = 46,
144 [CLK_TOP_UNIVPLL2_D32] = 47,
145 [CLK_TOP_UNIVPLL3_D2] = 48,
146 [CLK_TOP_UNIVPLL3_D4] = 49,
147 [CLK_TOP_UNIVPLL3_D8] = 50,
148 [CLK_TOP_MSDCPLL] = 51,
149 [CLK_TOP_MSDCPLL_D2] = 52,
150 [CLK_TOP_MSDCPLL_D4] = 53,
151 [CLK_TOP_MSDCPLL_D8] = 54,
152 [CLK_TOP_MMPLL] = 55,
153 [CLK_TOP_MMPLL_D2] = 56,
154 [CLK_TOP_DMPLL_D2] = 57,
155 [CLK_TOP_DMPLL_D4] = 58,
156 [CLK_TOP_DMPLL_X2] = 59,
157 [CLK_TOP_TVDPLL] = 60,
158 [CLK_TOP_TVDPLL_D2] = 61,
159 [CLK_TOP_TVDPLL_D4] = 62,
160 [CLK_TOP_VDECPLL] = 63,
161 [CLK_TOP_TVD2PLL] = 64,
162 [CLK_TOP_TVD2PLL_D2] = 65,
163 [CLK_TOP_MIPIPLL] = 66,
164 [CLK_TOP_MIPIPLL_D2] = 67,
165 [CLK_TOP_MIPIPLL_D4] = 68,
166 [CLK_TOP_HDMIPLL] = 69,
167 [CLK_TOP_HDMIPLL_D2] = 70,
168 [CLK_TOP_HDMIPLL_D3] = 71,
169 [CLK_TOP_ARMPLL_1P3G] = 72,
170 [CLK_TOP_AUDPLL] = 73,
171 [CLK_TOP_AUDPLL_D4] = 74,
172 [CLK_TOP_AUDPLL_D8] = 75,
173 [CLK_TOP_AUDPLL_D16] = 76,
174 [CLK_TOP_AUDPLL_D24] = 77,
175 [CLK_TOP_AUD1PLL_98M] = 78,
176 [CLK_TOP_AUD2PLL_90M] = 79,
177 [CLK_TOP_HADDS2PLL_98M] = 80,
178 [CLK_TOP_HADDS2PLL_294M] = 81,
179 [CLK_TOP_ETHPLL_500M] = 82,
180 [CLK_TOP_CLK26M_D8] = 83,
181 [CLK_TOP_32K_INTERNAL] = 84,
182 [CLK_TOP_AXISEL_D4] = 85,
183 [CLK_TOP_8BDAC] = 86,
184 /* MUX CLK */
185 [CLK_TOP_AXI_SEL] = 87,
186 [CLK_TOP_MEM_SEL] = 88,
187 [CLK_TOP_DDRPHYCFG_SEL] = 89,
188 [CLK_TOP_MM_SEL] = 90,
189 [CLK_TOP_PWM_SEL] = 91,
190 [CLK_TOP_VDEC_SEL] = 92,
191 [CLK_TOP_MFG_SEL] = 93,
192 [CLK_TOP_CAMTG_SEL] = 94,
193 [CLK_TOP_UART_SEL] = 95,
194 [CLK_TOP_SPI0_SEL] = 96,
195 [CLK_TOP_USB20_SEL] = 97,
196 [CLK_TOP_MSDC30_0_SEL] = 98,
197 [CLK_TOP_MSDC30_1_SEL] = 99,
198 [CLK_TOP_MSDC30_2_SEL] = 100,
199 [CLK_TOP_AUDIO_SEL] = 101,
200 [CLK_TOP_AUDINTBUS_SEL] = 102,
201 [CLK_TOP_PMICSPI_SEL] = 103,
202 [CLK_TOP_SCP_SEL] = 104,
203 [CLK_TOP_DPI0_SEL] = 105,
204 [CLK_TOP_DPI1_SEL] = 106,
205 [CLK_TOP_TVE_SEL] = 107,
206 [CLK_TOP_HDMI_SEL] = 108,
207 [CLK_TOP_APLL_SEL] = 109,
208 [CLK_TOP_RTC_SEL] = 110,
209 [CLK_TOP_NFI2X_SEL] = 111,
210 [CLK_TOP_EMMC_HCLK_SEL] = 112,
211 [CLK_TOP_FLASH_SEL] = 113,
212 [CLK_TOP_DI_SEL] = 114,
213 [CLK_TOP_NR_SEL] = 115,
214 [CLK_TOP_OSD_SEL] = 116,
215 [CLK_TOP_HDMIRX_BIST_SEL] = 117,
216 [CLK_TOP_INTDIR_SEL] = 118,
217 [CLK_TOP_ASM_I_SEL] = 119,
218 [CLK_TOP_ASM_M_SEL] = 120,
219 [CLK_TOP_ASM_H_SEL] = 121,
220 [CLK_TOP_MS_CARD_SEL] = 122,
221 [CLK_TOP_ETHIF_SEL] = 123,
222 [CLK_TOP_HDMIRX26_24_SEL] = 124,
223 [CLK_TOP_MSDC30_3_SEL] = 125,
224 [CLK_TOP_CMSYS_SEL] = 126,
225 [CLK_TOP_SPI1_SEL] = 127,
226 [CLK_TOP_SPI2_SEL] = 128,
227 [CLK_TOP_8BDAC_SEL] = 129,
228 [CLK_TOP_AUD2DVD_SEL] = 130,
229 [CLK_TOP_PADMCLK_SEL] = 131,
230 [CLK_TOP_AUD_MUX1_SEL] = 132,
231 [CLK_TOP_AUD_MUX2_SEL] = 133,
232 [CLK_TOP_AUDPLL_MUX_SEL] = 134,
233 [CLK_TOP_AUD_K1_SRC_SEL] = 135,
234 [CLK_TOP_AUD_K2_SRC_SEL] = 136,
235 [CLK_TOP_AUD_K3_SRC_SEL] = 137,
236 [CLK_TOP_AUD_K4_SRC_SEL] = 138,
237 [CLK_TOP_AUD_K5_SRC_SEL] = 139,
238 [CLK_TOP_AUD_K6_SRC_SEL] = 140,
239 /* Misc CLK only used as parents */
240 [CLK_TOP_AUD_EXTCK1_DIV] = 141,
241 [CLK_TOP_AUD_EXTCK2_DIV] = 142,
242 [CLK_TOP_AUD_MUX1_DIV] = 143,
243 [CLK_TOP_AUD_MUX2_DIV] = 144,
244 [CLK_TOP_AUD_K1_SRC_DIV] = 145,
245 [CLK_TOP_AUD_K2_SRC_DIV] = 146,
246 [CLK_TOP_AUD_K3_SRC_DIV] = 147,
247 [CLK_TOP_AUD_K4_SRC_DIV] = 148,
248 [CLK_TOP_AUD_K5_SRC_DIV] = 149,
249 [CLK_TOP_AUD_K6_SRC_DIV] = 150,
250 [CLK_TOP_AUD_48K_TIMING] = 151,
251 [CLK_TOP_AUD_44K_TIMING] = 152,
252 [CLK_TOP_AUD_I2S1_MCLK] = 153,
253 [CLK_TOP_AUD_I2S2_MCLK] = 154,
254 [CLK_TOP_AUD_I2S3_MCLK] = 155,
255 [CLK_TOP_AUD_I2S4_MCLK] = 156,
256 [CLK_TOP_AUD_I2S5_MCLK] = 157,
257 [CLK_TOP_AUD_I2S6_MCLK] = 158,
258};
259
developerd1b1ffa2018-11-15 10:07:55 +0800260#define FACTOR0(_id, _parent, _mult, _div) \
261 FACTOR(_id, _parent, _mult, _div, CLK_PARENT_APMIXED)
262
263#define FACTOR1(_id, _parent, _mult, _div) \
264 FACTOR(_id, _parent, _mult, _div, CLK_PARENT_TOPCKGEN)
265
266#define FACTOR2(_id, _parent, _mult, _div) \
267 FACTOR(_id, _parent, _mult, _div, 0)
268
269static const struct mtk_fixed_clk top_fixed_clks[] = {
270 FIXED_CLK(CLK_TOP_DPI, CLK_XTAL, 108 * MHZ),
271 FIXED_CLK(CLK_TOP_DMPLL, CLK_XTAL, 400 * MHZ),
272 FIXED_CLK(CLK_TOP_VENCPLL, CLK_XTAL, 295.75 * MHZ),
273 FIXED_CLK(CLK_TOP_HDMI_0_PIX340M, CLK_XTAL, 340 * MHZ),
274 FIXED_CLK(CLK_TOP_HDMI_0_DEEP340M, CLK_XTAL, 340 * MHZ),
275 FIXED_CLK(CLK_TOP_HDMI_0_PLL340M, CLK_XTAL, 340 * MHZ),
276 FIXED_CLK(CLK_TOP_HADDS2_FB, CLK_XTAL, 27 * MHZ),
277 FIXED_CLK(CLK_TOP_WBG_DIG_416M, CLK_XTAL, 416 * MHZ),
278 FIXED_CLK(CLK_TOP_DSI0_LNTC_DSI, CLK_XTAL, 143 * MHZ),
279 FIXED_CLK(CLK_TOP_HDMI_SCL_RX, CLK_XTAL, 27 * MHZ),
280 FIXED_CLK(CLK_TOP_32K_EXTERNAL, CLK_XTAL, 32000),
281 FIXED_CLK(CLK_TOP_HDMITX_CLKDIG_CTS, CLK_XTAL, 300 * MHZ),
282 FIXED_CLK(CLK_TOP_AUD_EXT1, CLK_XTAL, 0),
283 FIXED_CLK(CLK_TOP_AUD_EXT2, CLK_XTAL, 0),
284 FIXED_CLK(CLK_TOP_NFI1X_PAD, CLK_XTAL, 0),
285};
286
287static const struct mtk_fixed_factor top_fixed_divs[] = {
288 FACTOR0(CLK_TOP_SYSPLL, CLK_APMIXED_MAINPLL, 1, 1),
289 FACTOR0(CLK_TOP_SYSPLL_D2, CLK_APMIXED_MAINPLL, 1, 2),
290 FACTOR0(CLK_TOP_SYSPLL_D3, CLK_APMIXED_MAINPLL, 1, 3),
291 FACTOR0(CLK_TOP_SYSPLL_D5, CLK_APMIXED_MAINPLL, 1, 5),
292 FACTOR0(CLK_TOP_SYSPLL_D7, CLK_APMIXED_MAINPLL, 1, 7),
293 FACTOR1(CLK_TOP_SYSPLL1_D2, CLK_TOP_SYSPLL_D2, 1, 2),
294 FACTOR1(CLK_TOP_SYSPLL1_D4, CLK_TOP_SYSPLL_D2, 1, 4),
295 FACTOR1(CLK_TOP_SYSPLL1_D8, CLK_TOP_SYSPLL_D2, 1, 8),
296 FACTOR1(CLK_TOP_SYSPLL1_D16, CLK_TOP_SYSPLL_D2, 1, 16),
297 FACTOR1(CLK_TOP_SYSPLL2_D2, CLK_TOP_SYSPLL_D3, 1, 2),
298 FACTOR1(CLK_TOP_SYSPLL2_D4, CLK_TOP_SYSPLL_D3, 1, 4),
299 FACTOR1(CLK_TOP_SYSPLL2_D8, CLK_TOP_SYSPLL_D3, 1, 8),
300 FACTOR1(CLK_TOP_SYSPLL3_D2, CLK_TOP_SYSPLL_D5, 1, 2),
301 FACTOR1(CLK_TOP_SYSPLL3_D4, CLK_TOP_SYSPLL_D5, 1, 4),
302 FACTOR1(CLK_TOP_SYSPLL4_D2, CLK_TOP_SYSPLL_D7, 1, 2),
303 FACTOR1(CLK_TOP_SYSPLL4_D4, CLK_TOP_SYSPLL_D7, 1, 4),
304
305 FACTOR0(CLK_TOP_UNIVPLL, CLK_APMIXED_UNIVPLL, 1, 1),
306 FACTOR0(CLK_TOP_UNIVPLL_D2, CLK_APMIXED_UNIVPLL, 1, 2),
307 FACTOR0(CLK_TOP_UNIVPLL_D3, CLK_APMIXED_UNIVPLL, 1, 3),
308 FACTOR0(CLK_TOP_UNIVPLL_D5, CLK_APMIXED_UNIVPLL, 1, 5),
309 FACTOR0(CLK_TOP_UNIVPLL_D7, CLK_APMIXED_UNIVPLL, 1, 7),
310 FACTOR0(CLK_TOP_UNIVPLL_D26, CLK_APMIXED_UNIVPLL, 1, 26),
311 FACTOR0(CLK_TOP_UNIVPLL_D52, CLK_APMIXED_UNIVPLL, 1, 52),
312 FACTOR0(CLK_TOP_UNIVPLL_D108, CLK_APMIXED_UNIVPLL, 1, 108),
313 FACTOR0(CLK_TOP_USB_PHY48M, CLK_APMIXED_UNIVPLL, 1, 26),
314 FACTOR1(CLK_TOP_UNIVPLL1_D2, CLK_TOP_UNIVPLL_D2, 1, 2),
315 FACTOR1(CLK_TOP_UNIVPLL1_D4, CLK_TOP_UNIVPLL_D2, 1, 4),
316 FACTOR1(CLK_TOP_UNIVPLL1_D8, CLK_TOP_UNIVPLL_D2, 1, 8),
317 FACTOR1(CLK_TOP_UNIVPLL2_D2, CLK_TOP_UNIVPLL_D3, 1, 2),
318 FACTOR1(CLK_TOP_UNIVPLL2_D4, CLK_TOP_UNIVPLL_D3, 1, 4),
319 FACTOR1(CLK_TOP_UNIVPLL2_D8, CLK_TOP_UNIVPLL_D3, 1, 8),
320 FACTOR1(CLK_TOP_UNIVPLL2_D16, CLK_TOP_UNIVPLL_D3, 1, 16),
321 FACTOR1(CLK_TOP_UNIVPLL2_D32, CLK_TOP_UNIVPLL_D3, 1, 32),
322 FACTOR1(CLK_TOP_UNIVPLL3_D2, CLK_TOP_UNIVPLL_D5, 1, 2),
323 FACTOR1(CLK_TOP_UNIVPLL3_D4, CLK_TOP_UNIVPLL_D5, 1, 4),
324 FACTOR1(CLK_TOP_UNIVPLL3_D8, CLK_TOP_UNIVPLL_D5, 1, 8),
325
326 FACTOR0(CLK_TOP_MSDCPLL, CLK_APMIXED_MSDCPLL, 1, 1),
327 FACTOR0(CLK_TOP_MSDCPLL_D2, CLK_APMIXED_MSDCPLL, 1, 2),
328 FACTOR0(CLK_TOP_MSDCPLL_D4, CLK_APMIXED_MSDCPLL, 1, 4),
329 FACTOR0(CLK_TOP_MSDCPLL_D8, CLK_APMIXED_MSDCPLL, 1, 8),
330
331 FACTOR0(CLK_TOP_MMPLL, CLK_APMIXED_MMPLL, 1, 1),
332 FACTOR0(CLK_TOP_MMPLL_D2, CLK_APMIXED_MMPLL, 1, 2),
333
334 FACTOR1(CLK_TOP_DMPLL_D2, CLK_TOP_DMPLL, 1, 2),
335 FACTOR1(CLK_TOP_DMPLL_D4, CLK_TOP_DMPLL, 1, 4),
336 FACTOR1(CLK_TOP_DMPLL_X2, CLK_TOP_DMPLL, 1, 1),
337
338 FACTOR0(CLK_TOP_TVDPLL, CLK_APMIXED_TVDPLL, 1, 1),
339 FACTOR0(CLK_TOP_TVDPLL_D2, CLK_APMIXED_TVDPLL, 1, 2),
340 FACTOR0(CLK_TOP_TVDPLL_D4, CLK_APMIXED_TVDPLL, 1, 4),
341
342 FACTOR0(CLK_TOP_VDECPLL, CLK_APMIXED_VDECPLL, 1, 1),
343 FACTOR0(CLK_TOP_TVD2PLL, CLK_APMIXED_TVD2PLL, 1, 1),
344 FACTOR0(CLK_TOP_TVD2PLL_D2, CLK_APMIXED_TVD2PLL, 1, 2),
345
346 FACTOR1(CLK_TOP_MIPIPLL, CLK_TOP_DPI, 1, 1),
347 FACTOR1(CLK_TOP_MIPIPLL_D2, CLK_TOP_DPI, 1, 2),
348 FACTOR1(CLK_TOP_MIPIPLL_D4, CLK_TOP_DPI, 1, 4),
349
350 FACTOR1(CLK_TOP_HDMIPLL, CLK_TOP_HDMITX_CLKDIG_CTS, 1, 1),
351 FACTOR1(CLK_TOP_HDMIPLL_D2, CLK_TOP_HDMITX_CLKDIG_CTS, 1, 2),
352 FACTOR1(CLK_TOP_HDMIPLL_D3, CLK_TOP_HDMITX_CLKDIG_CTS, 1, 3),
353
354 FACTOR0(CLK_TOP_ARMPLL_1P3G, CLK_APMIXED_ARMPLL, 1, 1),
355
356 FACTOR1(CLK_TOP_AUDPLL, CLK_TOP_AUDPLL_MUX_SEL, 1, 1),
357 FACTOR1(CLK_TOP_AUDPLL_D4, CLK_TOP_AUDPLL_MUX_SEL, 1, 4),
358 FACTOR1(CLK_TOP_AUDPLL_D8, CLK_TOP_AUDPLL_MUX_SEL, 1, 8),
359 FACTOR1(CLK_TOP_AUDPLL_D16, CLK_TOP_AUDPLL_MUX_SEL, 1, 16),
360 FACTOR1(CLK_TOP_AUDPLL_D24, CLK_TOP_AUDPLL_MUX_SEL, 1, 24),
361
362 FACTOR0(CLK_TOP_AUD1PLL_98M, CLK_APMIXED_AUD1PLL, 1, 3),
363 FACTOR0(CLK_TOP_AUD2PLL_90M, CLK_APMIXED_AUD2PLL, 1, 3),
364 FACTOR0(CLK_TOP_HADDS2PLL_98M, CLK_APMIXED_HADDS2PLL, 1, 3),
365 FACTOR0(CLK_TOP_HADDS2PLL_294M, CLK_APMIXED_HADDS2PLL, 1, 1),
366 FACTOR0(CLK_TOP_ETHPLL_500M, CLK_APMIXED_ETHPLL, 1, 1),
367 FACTOR2(CLK_TOP_CLK26M_D8, CLK_XTAL, 1, 8),
368 FACTOR2(CLK_TOP_32K_INTERNAL, CLK_XTAL, 1, 793),
369 FACTOR1(CLK_TOP_AXISEL_D4, CLK_TOP_AXI_SEL, 1, 4),
370 FACTOR1(CLK_TOP_8BDAC, CLK_TOP_UNIVPLL_D2, 1, 1),
371};
372
373static const int axi_parents[] = {
374 CLK_XTAL,
375 CLK_TOP_SYSPLL1_D2,
376 CLK_TOP_SYSPLL_D5,
377 CLK_TOP_SYSPLL1_D4,
378 CLK_TOP_UNIVPLL_D5,
379 CLK_TOP_UNIVPLL2_D2,
380 CLK_TOP_MMPLL_D2,
381 CLK_TOP_DMPLL_D2
382};
383
384static const int mem_parents[] = {
385 CLK_XTAL,
386 CLK_TOP_DMPLL
387};
388
389static const int ddrphycfg_parents[] = {
390 CLK_XTAL,
391 CLK_TOP_SYSPLL1_D8
392};
393
394static const int mm_parents[] = {
395 CLK_XTAL,
396 CLK_TOP_VENCPLL,
397 CLK_TOP_SYSPLL1_D2,
398 CLK_TOP_SYSPLL1_D4,
399 CLK_TOP_UNIVPLL_D5,
400 CLK_TOP_UNIVPLL1_D2,
401 CLK_TOP_UNIVPLL2_D2,
402 CLK_TOP_DMPLL
403};
404
405static const int pwm_parents[] = {
406 CLK_XTAL,
407 CLK_TOP_UNIVPLL2_D4,
408 CLK_TOP_UNIVPLL3_D2,
409 CLK_TOP_UNIVPLL1_D4
410};
411
412static const int vdec_parents[] = {
413 CLK_XTAL,
414 CLK_TOP_VDECPLL,
415 CLK_TOP_SYSPLL_D5,
416 CLK_TOP_SYSPLL1_D4,
417 CLK_TOP_UNIVPLL_D5,
418 CLK_TOP_UNIVPLL2_D2,
419 CLK_TOP_VENCPLL,
420 CLK_TOP_MSDCPLL_D2,
421 CLK_TOP_MMPLL_D2
422};
423
424static const int mfg_parents[] = {
425 CLK_XTAL,
426 CLK_TOP_MMPLL,
427 CLK_TOP_DMPLL_X2,
428 CLK_TOP_MSDCPLL,
429 CLK_XTAL,
430 CLK_TOP_SYSPLL_D3,
431 CLK_TOP_UNIVPLL_D3,
432 CLK_TOP_UNIVPLL1_D2
433};
434
435static const int camtg_parents[] = {
436 CLK_XTAL,
437 CLK_TOP_UNIVPLL_D26,
438 CLK_TOP_UNIVPLL2_D2,
439 CLK_TOP_SYSPLL3_D2,
440 CLK_TOP_SYSPLL3_D4,
441 CLK_TOP_MSDCPLL_D2,
442 CLK_TOP_MMPLL_D2
443};
444
445static const int uart_parents[] = {
446 CLK_XTAL,
447 CLK_TOP_UNIVPLL2_D8
448};
449
450static const int spi_parents[] = {
451 CLK_XTAL,
452 CLK_TOP_SYSPLL3_D2,
453 CLK_TOP_SYSPLL4_D2,
454 CLK_TOP_UNIVPLL2_D4,
455 CLK_TOP_UNIVPLL1_D8
456};
457
458static const int usb20_parents[] = {
459 CLK_XTAL,
460 CLK_TOP_UNIVPLL1_D8,
461 CLK_TOP_UNIVPLL3_D4
462};
463
464static const int msdc30_parents[] = {
465 CLK_XTAL,
466 CLK_TOP_MSDCPLL_D2,
467 CLK_TOP_SYSPLL2_D2,
468 CLK_TOP_SYSPLL1_D4,
469 CLK_TOP_UNIVPLL1_D4,
470 CLK_TOP_UNIVPLL2_D4,
471};
472
473static const int aud_intbus_parents[] = {
474 CLK_XTAL,
475 CLK_TOP_SYSPLL1_D4,
476 CLK_TOP_SYSPLL3_D2,
477 CLK_TOP_SYSPLL4_D2,
478 CLK_TOP_UNIVPLL3_D2,
479 CLK_TOP_UNIVPLL2_D4
480};
481
482static const int pmicspi_parents[] = {
483 CLK_XTAL,
484 CLK_TOP_SYSPLL1_D8,
485 CLK_TOP_SYSPLL2_D4,
486 CLK_TOP_SYSPLL4_D2,
487 CLK_TOP_SYSPLL3_D4,
488 CLK_TOP_SYSPLL2_D8,
489 CLK_TOP_SYSPLL1_D16,
490 CLK_TOP_UNIVPLL3_D4,
491 CLK_TOP_UNIVPLL_D26,
492 CLK_TOP_DMPLL_D2,
493 CLK_TOP_DMPLL_D4
494};
495
496static const int scp_parents[] = {
497 CLK_XTAL,
498 CLK_TOP_SYSPLL1_D8,
499 CLK_TOP_DMPLL_D2,
500 CLK_TOP_DMPLL_D4
501};
502
503static const int dpi0_tve_parents[] = {
504 CLK_XTAL,
505 CLK_TOP_MIPIPLL,
506 CLK_TOP_MIPIPLL_D2,
507 CLK_TOP_MIPIPLL_D4,
508 CLK_XTAL,
509 CLK_TOP_TVDPLL,
510 CLK_TOP_TVDPLL_D2,
511 CLK_TOP_TVDPLL_D4
512};
513
514static const int dpi1_parents[] = {
515 CLK_XTAL,
516 CLK_TOP_TVDPLL,
517 CLK_TOP_TVDPLL_D2,
518 CLK_TOP_TVDPLL_D4
519};
520
521static const int hdmi_parents[] = {
522 CLK_XTAL,
523 CLK_TOP_HDMIPLL,
524 CLK_TOP_HDMIPLL_D2,
525 CLK_TOP_HDMIPLL_D3
526};
527
528static const int apll_parents[] = {
529 CLK_XTAL,
530 CLK_TOP_AUDPLL,
531 CLK_TOP_AUDPLL_D4,
532 CLK_TOP_AUDPLL_D8,
533 CLK_TOP_AUDPLL_D16,
534 CLK_TOP_AUDPLL_D24,
535 CLK_XTAL,
536 CLK_XTAL
537};
538
539static const int rtc_parents[] = {
540 CLK_TOP_32K_INTERNAL,
541 CLK_TOP_32K_EXTERNAL,
542 CLK_XTAL,
543 CLK_TOP_UNIVPLL3_D8
544};
545
546static const int nfi2x_parents[] = {
547 CLK_XTAL,
548 CLK_TOP_SYSPLL2_D2,
549 CLK_TOP_SYSPLL_D7,
550 CLK_TOP_UNIVPLL3_D2,
551 CLK_TOP_SYSPLL2_D4,
552 CLK_TOP_UNIVPLL3_D4,
553 CLK_TOP_SYSPLL4_D4,
554 CLK_XTAL
555};
556
557static const int emmc_hclk_parents[] = {
558 CLK_XTAL,
559 CLK_TOP_SYSPLL1_D2,
560 CLK_TOP_SYSPLL1_D4,
561 CLK_TOP_SYSPLL2_D2
562};
563
564static const int flash_parents[] = {
565 CLK_TOP_CLK26M_D8,
566 CLK_XTAL,
567 CLK_TOP_SYSPLL2_D8,
568 CLK_TOP_SYSPLL3_D4,
569 CLK_TOP_UNIVPLL3_D4,
570 CLK_TOP_SYSPLL4_D2,
571 CLK_TOP_SYSPLL2_D4,
572 CLK_TOP_UNIVPLL2_D4
573};
574
575static const int di_parents[] = {
576 CLK_XTAL,
577 CLK_TOP_TVD2PLL,
578 CLK_TOP_TVD2PLL_D2,
579 CLK_XTAL
580};
581
582static const int nr_osd_parents[] = {
583 CLK_XTAL,
584 CLK_TOP_VENCPLL,
585 CLK_TOP_SYSPLL1_D2,
586 CLK_TOP_SYSPLL1_D4,
587 CLK_TOP_UNIVPLL_D5,
588 CLK_TOP_UNIVPLL1_D2,
589 CLK_TOP_UNIVPLL2_D2,
590 CLK_TOP_DMPLL
591};
592
593static const int hdmirx_bist_parents[] = {
594 CLK_XTAL,
595 CLK_TOP_SYSPLL_D3,
596 CLK_XTAL,
597 CLK_TOP_SYSPLL1_D16,
598 CLK_TOP_SYSPLL4_D2,
599 CLK_TOP_SYSPLL1_D4,
600 CLK_TOP_VENCPLL,
601 CLK_XTAL
602};
603
604static const int intdir_parents[] = {
605 CLK_XTAL,
606 CLK_TOP_MMPLL,
607 CLK_TOP_SYSPLL_D2,
608 CLK_TOP_UNIVPLL_D2
609};
610
611static const int asm_parents[] = {
612 CLK_XTAL,
613 CLK_TOP_UNIVPLL2_D4,
614 CLK_TOP_UNIVPLL2_D2,
615 CLK_TOP_SYSPLL_D5
616};
617
618static const int ms_card_parents[] = {
619 CLK_XTAL,
620 CLK_TOP_UNIVPLL3_D8,
621 CLK_TOP_SYSPLL4_D4
622};
623
624static const int ethif_parents[] = {
625 CLK_XTAL,
626 CLK_TOP_SYSPLL1_D2,
627 CLK_TOP_SYSPLL_D5,
628 CLK_TOP_SYSPLL1_D4,
629 CLK_TOP_UNIVPLL_D5,
630 CLK_TOP_UNIVPLL1_D2,
631 CLK_TOP_DMPLL,
632 CLK_TOP_DMPLL_D2
633};
634
635static const int hdmirx_parents[] = {
636 CLK_XTAL,
637 CLK_TOP_UNIVPLL_D52
638};
639
640static const int cmsys_parents[] = {
641 CLK_XTAL,
642 CLK_TOP_SYSPLL1_D2,
643 CLK_TOP_UNIVPLL1_D2,
644 CLK_TOP_UNIVPLL_D5,
645 CLK_TOP_SYSPLL_D5,
646 CLK_TOP_SYSPLL2_D2,
647 CLK_TOP_SYSPLL1_D4,
648 CLK_TOP_SYSPLL3_D2,
649 CLK_TOP_SYSPLL2_D4,
650 CLK_TOP_SYSPLL1_D8,
651 CLK_XTAL,
652 CLK_XTAL,
653 CLK_XTAL,
654 CLK_XTAL,
655 CLK_XTAL
656};
657
658static const int clk_8bdac_parents[] = {
659 CLK_TOP_32K_INTERNAL,
660 CLK_TOP_8BDAC,
661 CLK_XTAL,
662 CLK_XTAL
663};
664
665static const int aud2dvd_parents[] = {
666 CLK_TOP_AUD_48K_TIMING,
667 CLK_TOP_AUD_44K_TIMING
668};
669
670static const int padmclk_parents[] = {
671 CLK_XTAL,
672 CLK_TOP_UNIVPLL_D26,
673 CLK_TOP_UNIVPLL_D52,
674 CLK_TOP_UNIVPLL_D108,
675 CLK_TOP_UNIVPLL2_D8,
676 CLK_TOP_UNIVPLL2_D16,
677 CLK_TOP_UNIVPLL2_D32
678};
679
680static const int aud_mux_parents[] = {
681 CLK_XTAL,
682 CLK_TOP_AUD1PLL_98M,
683 CLK_TOP_AUD2PLL_90M,
684 CLK_TOP_HADDS2PLL_98M,
685 CLK_TOP_AUD_EXTCK1_DIV,
686 CLK_TOP_AUD_EXTCK2_DIV
687};
688
689static const int aud_src_parents[] = {
690 CLK_TOP_AUD_MUX1_SEL,
691 CLK_TOP_AUD_MUX2_SEL
692};
693
694static const struct mtk_composite top_muxes[] = {
695 MUX_GATE(CLK_TOP_AXI_SEL, axi_parents, 0x40, 0, 3, 7),
696 MUX_GATE(CLK_TOP_MEM_SEL, mem_parents, 0x40, 8, 1, 15),
697 MUX_GATE(CLK_TOP_DDRPHYCFG_SEL, ddrphycfg_parents, 0x40, 16, 1, 23),
698 MUX_GATE_FLAGS(CLK_TOP_MM_SEL, mm_parents, 0x40, 24, 3, 31,
699 CLK_DOMAIN_SCPSYS),
700
701 MUX_GATE(CLK_TOP_PWM_SEL, pwm_parents, 0x50, 0, 2, 7),
702 MUX_GATE(CLK_TOP_VDEC_SEL, vdec_parents, 0x50, 8, 4, 15),
703 MUX_GATE_FLAGS(CLK_TOP_MFG_SEL, mfg_parents, 0x50, 16, 3, 23,
704 CLK_DOMAIN_SCPSYS),
705 MUX_GATE(CLK_TOP_CAMTG_SEL, camtg_parents, 0x50, 24, 3, 31),
706
707 MUX_GATE(CLK_TOP_UART_SEL, uart_parents, 0x60, 0, 1, 7),
708 MUX_GATE(CLK_TOP_SPI0_SEL, spi_parents, 0x60, 8, 3, 15),
709 MUX_GATE(CLK_TOP_USB20_SEL, usb20_parents, 0x60, 16, 2, 23),
710 MUX_GATE(CLK_TOP_MSDC30_0_SEL, msdc30_parents, 0x60, 24, 3, 31),
711
712 MUX_GATE(CLK_TOP_MSDC30_1_SEL, msdc30_parents, 0x70, 0, 3, 7),
713 MUX_GATE(CLK_TOP_MSDC30_2_SEL, msdc30_parents, 0x70, 8, 3, 15),
714 MUX_GATE(CLK_TOP_AUDIO_SEL, msdc30_parents, 0x70, 16, 1, 23),
715 MUX_GATE(CLK_TOP_AUDINTBUS_SEL, aud_intbus_parents, 0x70, 24, 3, 31),
716
717 MUX_GATE(CLK_TOP_PMICSPI_SEL, pmicspi_parents, 0x80, 0, 4, 7),
718 MUX_GATE(CLK_TOP_SCP_SEL, scp_parents, 0x80, 8, 2, 15),
719 MUX_GATE(CLK_TOP_DPI0_SEL, dpi0_tve_parents, 0x80, 16, 3, 23),
720 MUX_GATE(CLK_TOP_DPI1_SEL, dpi1_parents, 0x80, 24, 2, 31),
721
722 MUX_GATE(CLK_TOP_TVE_SEL, dpi0_tve_parents, 0x90, 0, 3, 7),
723 MUX_GATE(CLK_TOP_HDMI_SEL, hdmi_parents, 0x90, 8, 2, 15),
724 MUX_GATE(CLK_TOP_APLL_SEL, apll_parents, 0x90, 16, 3, 23),
725
726 MUX_GATE(CLK_TOP_RTC_SEL, rtc_parents, 0xA0, 0, 2, 7),
727 MUX_GATE(CLK_TOP_NFI2X_SEL, nfi2x_parents, 0xA0, 8, 3, 15),
728 MUX_GATE(CLK_TOP_EMMC_HCLK_SEL, emmc_hclk_parents, 0xA0, 24, 2, 31),
729
730 MUX_GATE(CLK_TOP_FLASH_SEL, flash_parents, 0xB0, 0, 3, 7),
731 MUX_GATE(CLK_TOP_DI_SEL, di_parents, 0xB0, 8, 2, 15),
732 MUX_GATE(CLK_TOP_NR_SEL, nr_osd_parents, 0xB0, 16, 3, 23),
733 MUX_GATE(CLK_TOP_OSD_SEL, nr_osd_parents, 0xB0, 24, 3, 31),
734
735 MUX_GATE(CLK_TOP_HDMIRX_BIST_SEL, hdmirx_bist_parents, 0xC0, 0, 3, 7),
736 MUX_GATE(CLK_TOP_INTDIR_SEL, intdir_parents, 0xC0, 8, 2, 15),
737 MUX_GATE(CLK_TOP_ASM_I_SEL, asm_parents, 0xC0, 16, 2, 23),
738 MUX_GATE(CLK_TOP_ASM_M_SEL, asm_parents, 0xC0, 24, 3, 31),
739
740 MUX_GATE(CLK_TOP_ASM_H_SEL, asm_parents, 0xD0, 0, 2, 7),
741 MUX_GATE(CLK_TOP_MS_CARD_SEL, ms_card_parents, 0xD0, 16, 2, 23),
742 MUX_GATE_FLAGS(CLK_TOP_ETHIF_SEL, ethif_parents, 0xD0, 24, 3, 31,
743 CLK_DOMAIN_SCPSYS),
744
745 MUX_GATE(CLK_TOP_HDMIRX26_24_SEL, hdmirx_parents, 0xE0, 0, 1, 7),
746 MUX_GATE(CLK_TOP_MSDC30_3_SEL, msdc30_parents, 0xE0, 8, 3, 15),
747 MUX_GATE(CLK_TOP_CMSYS_SEL, cmsys_parents, 0xE0, 16, 4, 23),
748
749 MUX_GATE(CLK_TOP_SPI1_SEL, spi_parents, 0xE0, 24, 3, 31),
750 MUX_GATE(CLK_TOP_SPI2_SEL, spi_parents, 0xF0, 0, 3, 7),
751 MUX_GATE(CLK_TOP_8BDAC_SEL, clk_8bdac_parents, 0xF0, 8, 2, 15),
752 MUX_GATE(CLK_TOP_AUD2DVD_SEL, aud2dvd_parents, 0xF0, 16, 1, 23),
753
754 MUX(CLK_TOP_PADMCLK_SEL, padmclk_parents, 0x100, 0, 3),
755
756 MUX(CLK_TOP_AUD_MUX1_SEL, aud_mux_parents, 0x12c, 0, 3),
757 MUX(CLK_TOP_AUD_MUX2_SEL, aud_mux_parents, 0x12c, 3, 3),
758 MUX(CLK_TOP_AUDPLL_MUX_SEL, aud_mux_parents, 0x12c, 6, 3),
759
760 MUX_GATE(CLK_TOP_AUD_K1_SRC_SEL, aud_src_parents, 0x12c, 15, 1, 23),
761 MUX_GATE(CLK_TOP_AUD_K2_SRC_SEL, aud_src_parents, 0x12c, 16, 1, 24),
762 MUX_GATE(CLK_TOP_AUD_K3_SRC_SEL, aud_src_parents, 0x12c, 17, 1, 25),
763 MUX_GATE(CLK_TOP_AUD_K4_SRC_SEL, aud_src_parents, 0x12c, 18, 1, 26),
764 MUX_GATE(CLK_TOP_AUD_K5_SRC_SEL, aud_src_parents, 0x12c, 19, 1, 27),
765 MUX_GATE(CLK_TOP_AUD_K6_SRC_SEL, aud_src_parents, 0x12c, 20, 1, 28),
766};
767
768/* infracfg */
769static const struct mtk_gate_regs infra_cg_regs = {
770 .set_ofs = 0x40,
771 .clr_ofs = 0x44,
772 .sta_ofs = 0x48,
773};
774
Christian Marangi87b96c32024-08-02 15:45:01 +0200775#define GATE_INFRA_FLAGS(_id, _parent, _shift, _flags) { \
developerd1b1ffa2018-11-15 10:07:55 +0800776 .id = _id, \
777 .parent = _parent, \
778 .regs = &infra_cg_regs, \
779 .shift = _shift, \
Christian Marangi87b96c32024-08-02 15:45:01 +0200780 .flags = _flags, \
developerd1b1ffa2018-11-15 10:07:55 +0800781 }
Christian Marangi87b96c32024-08-02 15:45:01 +0200782#define GATE_INFRA(_id, _parent, _shift) \
783 GATE_INFRA_FLAGS(_id, _parent, _shift, CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN)
784#define GATE_INFRA_XTAL(_id, _parent, _shift) \
785 GATE_INFRA_FLAGS(_id, _parent, _shift, CLK_GATE_SETCLR | CLK_PARENT_XTAL)
786
developerd1b1ffa2018-11-15 10:07:55 +0800787
788static const struct mtk_gate infra_cgs[] = {
789 GATE_INFRA(CLK_INFRA_DBG, CLK_TOP_AXI_SEL, 0),
790 GATE_INFRA(CLK_INFRA_SMI, CLK_TOP_MM_SEL, 1),
791 GATE_INFRA(CLK_INFRA_QAXI_CM4, CLK_TOP_AXI_SEL, 2),
792 GATE_INFRA(CLK_INFRA_AUD_SPLIN_B, CLK_TOP_HADDS2PLL_294M, 4),
Christian Marangi87b96c32024-08-02 15:45:01 +0200793 GATE_INFRA_XTAL(CLK_INFRA_AUDIO, CLK_XTAL, 5),
794 GATE_INFRA_XTAL(CLK_INFRA_EFUSE, CLK_XTAL, 6),
developerd1b1ffa2018-11-15 10:07:55 +0800795 GATE_INFRA(CLK_INFRA_L2C_SRAM, CLK_TOP_MM_SEL, 7),
796 GATE_INFRA(CLK_INFRA_M4U, CLK_TOP_MEM_SEL, 8),
797 GATE_INFRA(CLK_INFRA_CONNMCU, CLK_TOP_WBG_DIG_416M, 12),
798 GATE_INFRA(CLK_INFRA_TRNG, CLK_TOP_AXI_SEL, 13),
799 GATE_INFRA(CLK_INFRA_RAMBUFIF, CLK_TOP_MEM_SEL, 14),
800 GATE_INFRA(CLK_INFRA_CPUM, CLK_TOP_MEM_SEL, 15),
801 GATE_INFRA(CLK_INFRA_KP, CLK_TOP_AXI_SEL, 16),
802 GATE_INFRA(CLK_INFRA_CEC, CLK_TOP_RTC_SEL, 18),
803 GATE_INFRA(CLK_INFRA_IRRX, CLK_TOP_AXI_SEL, 19),
804 GATE_INFRA(CLK_INFRA_PMICSPI, CLK_TOP_PMICSPI_SEL, 22),
805 GATE_INFRA(CLK_INFRA_PMICWRAP, CLK_TOP_AXI_SEL, 23),
806 GATE_INFRA(CLK_INFRA_DDCCI, CLK_TOP_AXI_SEL, 24),
807};
808
809/* pericfg */
Christian Marangi7f9cceb2024-08-02 15:45:05 +0200810static const int peri_id_offs_map[] = {
811 /* MUX CLK */
812 [CLK_PERI_UART0_SEL] = 1,
813 [CLK_PERI_UART1_SEL] = 2,
814 [CLK_PERI_UART2_SEL] = 3,
815 [CLK_PERI_UART3_SEL] = 4,
816 /* GATE CLK */
817 [CLK_PERI_NFI] = 5,
818 [CLK_PERI_THERM] = 6,
819 [CLK_PERI_PWM1] = 7,
820 [CLK_PERI_PWM2] = 8,
821 [CLK_PERI_PWM3] = 9,
822 [CLK_PERI_PWM4] = 10,
823 [CLK_PERI_PWM5] = 11,
824 [CLK_PERI_PWM6] = 12,
825 [CLK_PERI_PWM7] = 13,
826 [CLK_PERI_PWM] = 14,
827 [CLK_PERI_USB0] = 15,
828 [CLK_PERI_USB1] = 16,
829 [CLK_PERI_AP_DMA] = 17,
830 [CLK_PERI_MSDC30_0] = 18,
831 [CLK_PERI_MSDC30_1] = 19,
832 [CLK_PERI_MSDC30_2] = 20,
833 [CLK_PERI_MSDC30_3] = 21,
834 [CLK_PERI_MSDC50_3] = 22,
835 [CLK_PERI_NLI] = 23,
836 [CLK_PERI_UART0] = 24,
837 [CLK_PERI_UART1] = 25,
838 [CLK_PERI_UART2] = 26,
839 [CLK_PERI_UART3] = 27,
840 [CLK_PERI_BTIF] = 28,
841 [CLK_PERI_I2C0] = 29,
842 [CLK_PERI_I2C1] = 30,
843 [CLK_PERI_I2C2] = 31,
844 [CLK_PERI_I2C3] = 32,
845 [CLK_PERI_AUXADC] = 33,
846 [CLK_PERI_SPI0] = 34,
847 [CLK_PERI_ETH] = 35,
848 [CLK_PERI_USB0_MCU] = 36,
849 [CLK_PERI_USB1_MCU] = 37,
850 [CLK_PERI_USB_SLV] = 38,
851 [CLK_PERI_GCPU] = 39,
852 [CLK_PERI_NFI_ECC] = 40,
853 [CLK_PERI_NFI_PAD] = 41,
854 [CLK_PERI_FLASH] = 42,
855 [CLK_PERI_HOST89_INT] = 43,
856 [CLK_PERI_HOST89_SPI] = 44,
857 [CLK_PERI_HOST89_DVD] = 45,
858 [CLK_PERI_SPI1] = 46,
859 [CLK_PERI_SPI2] = 47,
860 [CLK_PERI_FCI] = 48,
861};
862
863#define TOP_PARENT(_id) PARENT(_id, CLK_PARENT_TOPCKGEN)
864#define XTAL_PARENT(_id) PARENT(_id, CLK_PARENT_XTAL)
865
866static const struct mtk_parent uart_ck_sel_parents[] = {
867 XTAL_PARENT(CLK_XTAL),
868 TOP_PARENT(CLK_TOP_UART_SEL),
869};
870
871static const struct mtk_composite peri_muxes[] = {
872 MUX_MIXED(CLK_PERI_UART0_SEL, uart_ck_sel_parents, 0x40C, 0, 1),
873 MUX_MIXED(CLK_PERI_UART1_SEL, uart_ck_sel_parents, 0x40C, 1, 1),
874 MUX_MIXED(CLK_PERI_UART2_SEL, uart_ck_sel_parents, 0x40C, 2, 1),
875 MUX_MIXED(CLK_PERI_UART3_SEL, uart_ck_sel_parents, 0x40C, 3, 1),
876};
877
developerd1b1ffa2018-11-15 10:07:55 +0800878static const struct mtk_gate_regs peri0_cg_regs = {
879 .set_ofs = 0x8,
880 .clr_ofs = 0x10,
881 .sta_ofs = 0x18,
882};
883
884static const struct mtk_gate_regs peri1_cg_regs = {
885 .set_ofs = 0xC,
886 .clr_ofs = 0x14,
887 .sta_ofs = 0x1C,
888};
889
Christian Marangi87b96c32024-08-02 15:45:01 +0200890#define GATE_PERI0_FLAGS(_id, _parent, _shift, _flags) { \
developerd1b1ffa2018-11-15 10:07:55 +0800891 .id = _id, \
892 .parent = _parent, \
893 .regs = &peri0_cg_regs, \
894 .shift = _shift, \
Christian Marangi87b96c32024-08-02 15:45:01 +0200895 .flags = _flags, \
developerd1b1ffa2018-11-15 10:07:55 +0800896 }
Christian Marangi87b96c32024-08-02 15:45:01 +0200897#define GATE_PERI0(_id, _parent, _shift) \
898 GATE_PERI0_FLAGS(_id, _parent, _shift, CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN)
899#define GATE_PERI0_XTAL(_id, _parent, _shift) \
900 GATE_PERI0_FLAGS(_id, _parent, _shift, CLK_GATE_SETCLR | CLK_PARENT_XTAL)
developerd1b1ffa2018-11-15 10:07:55 +0800901
902#define GATE_PERI1(_id, _parent, _shift) { \
903 .id = _id, \
904 .parent = _parent, \
905 .regs = &peri1_cg_regs, \
906 .shift = _shift, \
907 .flags = CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN, \
908 }
909
910static const struct mtk_gate peri_cgs[] = {
911 GATE_PERI0(CLK_PERI_NFI, CLK_TOP_NFI2X_SEL, 0),
912 GATE_PERI0(CLK_PERI_THERM, CLK_TOP_AXI_SEL, 1),
913 GATE_PERI0(CLK_PERI_PWM1, CLK_TOP_AXISEL_D4, 2),
914 GATE_PERI0(CLK_PERI_PWM2, CLK_TOP_AXISEL_D4, 3),
915 GATE_PERI0(CLK_PERI_PWM3, CLK_TOP_AXISEL_D4, 4),
916 GATE_PERI0(CLK_PERI_PWM4, CLK_TOP_AXISEL_D4, 5),
917 GATE_PERI0(CLK_PERI_PWM5, CLK_TOP_AXISEL_D4, 6),
918 GATE_PERI0(CLK_PERI_PWM6, CLK_TOP_AXISEL_D4, 7),
919 GATE_PERI0(CLK_PERI_PWM7, CLK_TOP_AXISEL_D4, 8),
920 GATE_PERI0(CLK_PERI_PWM, CLK_TOP_AXI_SEL, 9),
921 GATE_PERI0(CLK_PERI_USB0, CLK_TOP_USB20_SEL, 10),
922 GATE_PERI0(CLK_PERI_USB1, CLK_TOP_USB20_SEL, 11),
923 GATE_PERI0(CLK_PERI_AP_DMA, CLK_TOP_AXI_SEL, 12),
924 GATE_PERI0(CLK_PERI_MSDC30_0, CLK_TOP_MSDC30_0_SEL, 13),
925 GATE_PERI0(CLK_PERI_MSDC30_1, CLK_TOP_MSDC30_1_SEL, 14),
926 GATE_PERI0(CLK_PERI_MSDC30_2, CLK_TOP_MSDC30_2_SEL, 15),
927 GATE_PERI0(CLK_PERI_MSDC30_3, CLK_TOP_MSDC30_3_SEL, 16),
928 GATE_PERI0(CLK_PERI_MSDC50_3, CLK_TOP_EMMC_HCLK_SEL, 17),
929 GATE_PERI0(CLK_PERI_NLI, CLK_TOP_AXI_SEL, 18),
930 GATE_PERI0(CLK_PERI_UART0, CLK_TOP_AXI_SEL, 19),
931 GATE_PERI0(CLK_PERI_UART1, CLK_TOP_AXI_SEL, 20),
932 GATE_PERI0(CLK_PERI_UART2, CLK_TOP_AXI_SEL, 21),
933 GATE_PERI0(CLK_PERI_UART3, CLK_TOP_AXI_SEL, 22),
934 GATE_PERI0(CLK_PERI_BTIF, CLK_TOP_AXI_SEL, 23),
935 GATE_PERI0(CLK_PERI_I2C0, CLK_TOP_AXI_SEL, 24),
936 GATE_PERI0(CLK_PERI_I2C1, CLK_TOP_AXI_SEL, 25),
937 GATE_PERI0(CLK_PERI_I2C2, CLK_TOP_AXI_SEL, 26),
Christian Marangi87b96c32024-08-02 15:45:01 +0200938 GATE_PERI0_XTAL(CLK_PERI_I2C3, CLK_XTAL, 27),
939 GATE_PERI0_XTAL(CLK_PERI_AUXADC, CLK_XTAL, 28),
developerd1b1ffa2018-11-15 10:07:55 +0800940 GATE_PERI0(CLK_PERI_SPI0, CLK_TOP_SPI0_SEL, 29),
Christian Marangi87b96c32024-08-02 15:45:01 +0200941 GATE_PERI0_XTAL(CLK_PERI_ETH, CLK_XTAL, 30),
developerd1b1ffa2018-11-15 10:07:55 +0800942 GATE_PERI0(CLK_PERI_USB0_MCU, CLK_TOP_AXI_SEL, 31),
943
944 GATE_PERI1(CLK_PERI_USB1_MCU, CLK_TOP_AXI_SEL, 0),
945 GATE_PERI1(CLK_PERI_USB_SLV, CLK_TOP_AXI_SEL, 1),
946 GATE_PERI1(CLK_PERI_GCPU, CLK_TOP_AXI_SEL, 2),
947 GATE_PERI1(CLK_PERI_NFI_ECC, CLK_TOP_NFI1X_PAD, 3),
948 GATE_PERI1(CLK_PERI_NFI_PAD, CLK_TOP_NFI1X_PAD, 4),
949 GATE_PERI1(CLK_PERI_FLASH, CLK_TOP_NFI2X_SEL, 5),
950 GATE_PERI1(CLK_PERI_HOST89_INT, CLK_TOP_AXI_SEL, 6),
951 GATE_PERI1(CLK_PERI_HOST89_SPI, CLK_TOP_SPI0_SEL, 7),
952 GATE_PERI1(CLK_PERI_HOST89_DVD, CLK_TOP_AUD2DVD_SEL, 8),
953 GATE_PERI1(CLK_PERI_SPI1, CLK_TOP_SPI1_SEL, 9),
954 GATE_PERI1(CLK_PERI_SPI2, CLK_TOP_SPI2_SEL, 10),
955 GATE_PERI1(CLK_PERI_FCI, CLK_TOP_MS_CARD_SEL, 11),
956};
957
developera588d152019-07-29 22:17:48 +0800958/* ethsys and hifsys */
959static const struct mtk_gate_regs eth_hif_cg_regs = {
developerd1b1ffa2018-11-15 10:07:55 +0800960 .sta_ofs = 0x30,
961};
962
developera588d152019-07-29 22:17:48 +0800963#define GATE_ETH_HIF(_id, _parent, _shift, _flag) { \
developerd1b1ffa2018-11-15 10:07:55 +0800964 .id = _id, \
965 .parent = _parent, \
developera588d152019-07-29 22:17:48 +0800966 .regs = &eth_hif_cg_regs, \
developerd1b1ffa2018-11-15 10:07:55 +0800967 .shift = _shift, \
968 .flags = CLK_GATE_NO_SETCLR_INV | (_flag), \
969 }
970
developera588d152019-07-29 22:17:48 +0800971#define GATE_ETH_HIF0(_id, _parent, _shift) \
972 GATE_ETH_HIF(_id, _parent, _shift, CLK_PARENT_APMIXED)
developerd1b1ffa2018-11-15 10:07:55 +0800973
developera588d152019-07-29 22:17:48 +0800974#define GATE_ETH_HIF1(_id, _parent, _shift) \
975 GATE_ETH_HIF(_id, _parent, _shift, CLK_PARENT_TOPCKGEN)
developerd1b1ffa2018-11-15 10:07:55 +0800976
977static const struct mtk_gate eth_cgs[] = {
developera588d152019-07-29 22:17:48 +0800978 GATE_ETH_HIF1(CLK_ETHSYS_HSDMA, CLK_TOP_ETHIF_SEL, 5),
979 GATE_ETH_HIF1(CLK_ETHSYS_ESW, CLK_TOP_ETHPLL_500M, 6),
980 GATE_ETH_HIF0(CLK_ETHSYS_GP2, CLK_APMIXED_TRGPLL, 7),
981 GATE_ETH_HIF1(CLK_ETHSYS_GP1, CLK_TOP_ETHPLL_500M, 8),
982 GATE_ETH_HIF1(CLK_ETHSYS_PCM, CLK_TOP_ETHIF_SEL, 11),
983 GATE_ETH_HIF1(CLK_ETHSYS_GDMA, CLK_TOP_ETHIF_SEL, 14),
984 GATE_ETH_HIF1(CLK_ETHSYS_I2S, CLK_TOP_ETHIF_SEL, 17),
985 GATE_ETH_HIF1(CLK_ETHSYS_CRYPTO, CLK_TOP_ETHIF_SEL, 29),
developerd1b1ffa2018-11-15 10:07:55 +0800986};
987
developera588d152019-07-29 22:17:48 +0800988static const struct mtk_gate hif_cgs[] = {
989 GATE_ETH_HIF1(CLK_HIFSYS_USB0PHY, CLK_TOP_ETHPLL_500M, 21),
990 GATE_ETH_HIF1(CLK_HIFSYS_USB1PHY, CLK_TOP_ETHPLL_500M, 22),
991 GATE_ETH_HIF1(CLK_HIFSYS_PCIE0, CLK_TOP_ETHPLL_500M, 24),
992 GATE_ETH_HIF1(CLK_HIFSYS_PCIE1, CLK_TOP_ETHPLL_500M, 25),
993 GATE_ETH_HIF1(CLK_HIFSYS_PCIE2, CLK_TOP_ETHPLL_500M, 26),
994};
995
Christian Marangi326ab202024-08-02 15:45:02 +0200996static const struct mtk_clk_tree mt7623_apmixedsys_clk_tree = {
developerd1b1ffa2018-11-15 10:07:55 +0800997 .xtal2_rate = 26 * MHZ,
Christian Marangib6ea6202024-08-02 15:45:04 +0200998 .id_offs_map = pll_id_offs_map,
Christian Marangi326ab202024-08-02 15:45:02 +0200999 .plls = apmixed_plls,
1000};
1001
1002static const struct mtk_clk_tree mt7623_topckgen_clk_tree = {
1003 .xtal_rate = 26 * MHZ,
Christian Marangie80ebc82024-08-02 15:45:03 +02001004 .id_offs_map = top_id_offs_map,
1005 .fdivs_offs = top_id_offs_map[CLK_TOP_SYSPLL],
1006 .muxes_offs = top_id_offs_map[CLK_TOP_AXI_SEL],
developerd1b1ffa2018-11-15 10:07:55 +08001007 .fclks = top_fixed_clks,
1008 .fdivs = top_fixed_divs,
1009 .muxes = top_muxes,
1010};
1011
1012static int mt7623_mcucfg_probe(struct udevice *dev)
1013{
1014 void __iomem *base;
1015
1016 base = dev_read_addr_ptr(dev);
1017 if (!base)
1018 return -ENOENT;
1019
1020 clrsetbits_le32(base + MCU_AXI_DIV, AXI_DIV_MSK,
1021 AXI_DIV_SEL(0x12));
1022
1023 return 0;
1024}
1025
1026static int mt7623_apmixedsys_probe(struct udevice *dev)
1027{
1028 struct mtk_clk_priv *priv = dev_get_priv(dev);
1029 int ret;
1030
Christian Marangi326ab202024-08-02 15:45:02 +02001031 ret = mtk_common_clk_init(dev, &mt7623_apmixedsys_clk_tree);
developerd1b1ffa2018-11-15 10:07:55 +08001032 if (ret)
1033 return ret;
1034
1035 /* reduce clock square disable time */
1036 writel(0x50001, priv->base + MT7623_CLKSQ_STB_CON0);
1037 /* extend control timing to 1us */
1038 writel(0x888, priv->base + MT7623_PLL_ISO_CON0);
1039
1040 return 0;
1041}
1042
1043static int mt7623_topckgen_probe(struct udevice *dev)
1044{
Christian Marangi326ab202024-08-02 15:45:02 +02001045 return mtk_common_clk_init(dev, &mt7623_topckgen_clk_tree);
developerd1b1ffa2018-11-15 10:07:55 +08001046}
1047
Christian Marangie80ebc82024-08-02 15:45:03 +02001048static const struct mtk_clk_tree mt7623_clk_gate_tree = {
1049 /* Each CLK ID for gates clock starts at index 1 */
1050 .gates_offs = 1,
Christian Marangi7f9cceb2024-08-02 15:45:05 +02001051 .xtal_rate = 26 * MHZ,
Christian Marangie80ebc82024-08-02 15:45:03 +02001052};
1053
developerd1b1ffa2018-11-15 10:07:55 +08001054static int mt7623_infracfg_probe(struct udevice *dev)
1055{
Christian Marangie80ebc82024-08-02 15:45:03 +02001056 return mtk_common_clk_gate_init(dev, &mt7623_clk_gate_tree,
Christian Marangi326ab202024-08-02 15:45:02 +02001057 infra_cgs);
developerd1b1ffa2018-11-15 10:07:55 +08001058}
1059
Christian Marangi7f9cceb2024-08-02 15:45:05 +02001060static const struct mtk_clk_tree mt7623_clk_peri_tree = {
1061 .id_offs_map = peri_id_offs_map,
1062 .muxes_offs = peri_id_offs_map[CLK_PERI_UART0_SEL],
1063 .gates_offs = peri_id_offs_map[CLK_PERI_NFI],
1064 .muxes = peri_muxes,
1065 .gates = peri_cgs,
1066 .xtal_rate = 26 * MHZ,
1067};
1068
developerd1b1ffa2018-11-15 10:07:55 +08001069static int mt7623_pericfg_probe(struct udevice *dev)
1070{
Christian Marangi7f9cceb2024-08-02 15:45:05 +02001071 return mtk_common_clk_infrasys_init(dev, &mt7623_clk_peri_tree);
developerd1b1ffa2018-11-15 10:07:55 +08001072}
1073
developera588d152019-07-29 22:17:48 +08001074static int mt7623_hifsys_probe(struct udevice *dev)
1075{
Christian Marangie80ebc82024-08-02 15:45:03 +02001076 return mtk_common_clk_gate_init(dev, &mt7623_clk_gate_tree,
Christian Marangi326ab202024-08-02 15:45:02 +02001077 hif_cgs);
developera588d152019-07-29 22:17:48 +08001078}
1079
developerd1b1ffa2018-11-15 10:07:55 +08001080static int mt7623_ethsys_probe(struct udevice *dev)
1081{
Christian Marangie80ebc82024-08-02 15:45:03 +02001082 return mtk_common_clk_gate_init(dev, &mt7623_clk_gate_tree,
Christian Marangi326ab202024-08-02 15:45:02 +02001083 eth_cgs);
developerd1b1ffa2018-11-15 10:07:55 +08001084}
1085
developera588d152019-07-29 22:17:48 +08001086static int mt7623_ethsys_hifsys_bind(struct udevice *dev)
developer02259452018-12-20 16:12:52 +08001087{
1088 int ret = 0;
1089
1090#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
developera588d152019-07-29 22:17:48 +08001091 ret = mediatek_reset_bind(dev, ETHSYS_HIFSYS_RST_CTRL_OFS, 1);
developer02259452018-12-20 16:12:52 +08001092 if (ret)
developera588d152019-07-29 22:17:48 +08001093 debug("Warning: failed to bind reset controller\n");
developer02259452018-12-20 16:12:52 +08001094#endif
1095
1096 return ret;
1097}
1098
developerd1b1ffa2018-11-15 10:07:55 +08001099static const struct udevice_id mt7623_apmixed_compat[] = {
1100 { .compatible = "mediatek,mt7623-apmixedsys" },
1101 { }
1102};
1103
1104static const struct udevice_id mt7623_topckgen_compat[] = {
1105 { .compatible = "mediatek,mt7623-topckgen" },
1106 { }
1107};
1108
1109static const struct udevice_id mt7623_infracfg_compat[] = {
1110 { .compatible = "mediatek,mt7623-infracfg", },
1111 { }
1112};
1113
1114static const struct udevice_id mt7623_pericfg_compat[] = {
1115 { .compatible = "mediatek,mt7623-pericfg", },
1116 { }
1117};
1118
1119static const struct udevice_id mt7623_ethsys_compat[] = {
1120 { .compatible = "mediatek,mt7623-ethsys" },
1121 { }
1122};
1123
developera588d152019-07-29 22:17:48 +08001124static const struct udevice_id mt7623_hifsys_compat[] = {
1125 { .compatible = "mediatek,mt7623-hifsys" },
1126 { }
1127};
1128
developerd1b1ffa2018-11-15 10:07:55 +08001129static const struct udevice_id mt7623_mcucfg_compat[] = {
1130 { .compatible = "mediatek,mt7623-mcucfg" },
1131 { }
1132};
1133
1134U_BOOT_DRIVER(mtk_mcucfg) = {
1135 .name = "mt7623-mcucfg",
1136 .id = UCLASS_SYSCON,
1137 .of_match = mt7623_mcucfg_compat,
1138 .probe = mt7623_mcucfg_probe,
1139 .flags = DM_FLAG_PRE_RELOC,
1140};
1141
1142U_BOOT_DRIVER(mtk_clk_apmixedsys) = {
1143 .name = "mt7623-clock-apmixedsys",
1144 .id = UCLASS_CLK,
1145 .of_match = mt7623_apmixed_compat,
1146 .probe = mt7623_apmixedsys_probe,
Simon Glass8a2b47f2020-12-03 16:55:17 -07001147 .priv_auto = sizeof(struct mtk_clk_priv),
developerd1b1ffa2018-11-15 10:07:55 +08001148 .ops = &mtk_clk_apmixedsys_ops,
1149 .flags = DM_FLAG_PRE_RELOC,
1150};
1151
1152U_BOOT_DRIVER(mtk_clk_topckgen) = {
1153 .name = "mt7623-clock-topckgen",
1154 .id = UCLASS_CLK,
1155 .of_match = mt7623_topckgen_compat,
1156 .probe = mt7623_topckgen_probe,
Simon Glass8a2b47f2020-12-03 16:55:17 -07001157 .priv_auto = sizeof(struct mtk_clk_priv),
developerd1b1ffa2018-11-15 10:07:55 +08001158 .ops = &mtk_clk_topckgen_ops,
1159 .flags = DM_FLAG_PRE_RELOC,
1160};
1161
1162U_BOOT_DRIVER(mtk_clk_infracfg) = {
1163 .name = "mt7623-infracfg",
1164 .id = UCLASS_CLK,
1165 .of_match = mt7623_infracfg_compat,
1166 .probe = mt7623_infracfg_probe,
Simon Glass8a2b47f2020-12-03 16:55:17 -07001167 .priv_auto = sizeof(struct mtk_cg_priv),
developerd1b1ffa2018-11-15 10:07:55 +08001168 .ops = &mtk_clk_gate_ops,
1169 .flags = DM_FLAG_PRE_RELOC,
1170};
1171
1172U_BOOT_DRIVER(mtk_clk_pericfg) = {
1173 .name = "mt7623-pericfg",
1174 .id = UCLASS_CLK,
1175 .of_match = mt7623_pericfg_compat,
1176 .probe = mt7623_pericfg_probe,
Simon Glass8a2b47f2020-12-03 16:55:17 -07001177 .priv_auto = sizeof(struct mtk_cg_priv),
Christian Marangi7f9cceb2024-08-02 15:45:05 +02001178 .ops = &mtk_clk_infrasys_ops,
developerd1b1ffa2018-11-15 10:07:55 +08001179 .flags = DM_FLAG_PRE_RELOC,
1180};
1181
developera588d152019-07-29 22:17:48 +08001182U_BOOT_DRIVER(mtk_clk_hifsys) = {
1183 .name = "mt7623-clock-hifsys",
1184 .id = UCLASS_CLK,
1185 .of_match = mt7623_hifsys_compat,
1186 .probe = mt7623_hifsys_probe,
1187 .bind = mt7623_ethsys_hifsys_bind,
Simon Glass8a2b47f2020-12-03 16:55:17 -07001188 .priv_auto = sizeof(struct mtk_cg_priv),
developera588d152019-07-29 22:17:48 +08001189 .ops = &mtk_clk_gate_ops,
1190};
1191
developerd1b1ffa2018-11-15 10:07:55 +08001192U_BOOT_DRIVER(mtk_clk_ethsys) = {
1193 .name = "mt7623-clock-ethsys",
1194 .id = UCLASS_CLK,
1195 .of_match = mt7623_ethsys_compat,
1196 .probe = mt7623_ethsys_probe,
developera588d152019-07-29 22:17:48 +08001197 .bind = mt7623_ethsys_hifsys_bind,
Simon Glass8a2b47f2020-12-03 16:55:17 -07001198 .priv_auto = sizeof(struct mtk_cg_priv),
developerd1b1ffa2018-11-15 10:07:55 +08001199 .ops = &mtk_clk_gate_ops,
1200};