blob: 9612a62e56a70c9049644bcd7e58e33eb0372967 [file] [log] [blame]
Fabien Parent4b1c5152020-10-17 12:52:15 +02001// SPDX-License-Identifier: GPL-2.0
2/*
3 * MediaTek clock driver for MT8183 SoC
4 *
5 * Copyright (C) 2020 BayLibre, SAS
6 * Copyright (c) 2020 MediaTek Inc.
7 * Author: Fabien Parent <fparent@baylibre.com>
8 * Author: Weiyi Lu <weiyi.lu@mediatek.com>
9 */
10
Fabien Parent4b1c5152020-10-17 12:52:15 +020011#include <dm.h>
12#include <asm/io.h>
13#include <dt-bindings/clock/mt8183-clk.h>
14
15#include "clk-mtk.h"
16
17#define MT8183_PLL_FMAX (3800UL * MHZ)
18#define MT8183_PLL_FMIN (1500UL * MHZ)
19
20/* apmixedsys */
21#define PLL(_id, _reg, _pwr_reg, _en_mask, _flags, _rst_bar_mask, _pcwbits, \
22 _pcwibits, _pd_reg, _pd_shift, _pcw_reg, _pcw_shift) { \
23 .id = _id, \
24 .reg = _reg, \
25 .pwr_reg = _pwr_reg, \
26 .en_mask = _en_mask, \
27 .rst_bar_mask = _rst_bar_mask, \
28 .fmax = MT8183_PLL_FMAX, \
29 .fmin = MT8183_PLL_FMIN, \
30 .flags = _flags, \
31 .pcwbits = _pcwbits, \
32 .pcwibits = _pcwibits, \
33 .pd_reg = _pd_reg, \
34 .pd_shift = _pd_shift, \
35 .pcw_reg = _pcw_reg, \
36 .pcw_shift = _pcw_shift, \
37 }
38
39static const struct mtk_pll_data apmixed_plls[] = {
40 PLL(CLK_APMIXED_ARMPLL_LL, 0x0200, 0x020C, 0x00000001,
41 HAVE_RST_BAR, BIT(24), 22, 8, 0x0204, 24,
42 0x0204, 0),
43 PLL(CLK_APMIXED_ARMPLL_L, 0x0210, 0x021C, 0x00000001,
44 HAVE_RST_BAR, BIT(24), 22, 8, 0x0214, 24,
45 0x0214, 0),
46 PLL(CLK_APMIXED_CCIPLL, 0x0290, 0x029C, 0x00000001,
47 HAVE_RST_BAR, BIT(24), 22, 8, 0x0294, 24,
48 0x0294, 0),
49 PLL(CLK_APMIXED_MAINPLL, 0x0220, 0x022C, 0x00000001,
50 HAVE_RST_BAR, BIT(24), 22, 8, 0x0224, 24,
51 0x0224, 0),
52 PLL(CLK_APMIXED_UNIV2PLL, 0x0230, 0x023C, 0x00000001,
53 HAVE_RST_BAR, BIT(24), 22, 8, 0x0234, 24,
54 0x0234, 0),
55 PLL(CLK_APMIXED_MSDCPLL, 0x0250, 0x025C, 0x00000001,
56 0, 0, 22, 8, 0x0254, 24, 0x0254, 0),
57 PLL(CLK_APMIXED_MMPLL, 0x0270, 0x027C, 0x00000001,
58 HAVE_RST_BAR, BIT(23), 22, 8, 0x0274, 24,
59 0x0274, 0),
60 PLL(CLK_APMIXED_MFGPLL, 0x0240, 0x024C, 0x00000001,
61 0, 0, 22, 8, 0x0244, 24, 0x0244, 0),
62 PLL(CLK_APMIXED_TVDPLL, 0x0260, 0x026C, 0x00000001,
63 0, 0, 22, 8, 0x0264, 24, 0x0264, 0),
64 PLL(CLK_APMIXED_APLL1, 0x02A0, 0x02B0, 0x00000001,
65 0, 0, 32, 8, 0x02A0, 1, 0x02A4, 0),
66 PLL(CLK_APMIXED_APLL2, 0x02b4, 0x02c4, 0x00000001,
67 0, 0, 32, 8, 0x02B4, 1, 0x02B8, 0),
68};
69
70static const struct mtk_fixed_clk top_fixed_clks[] = {
71 FIXED_CLK(CLK_TOP_CLK26M, CLK_XTAL, 26000000),
72 FIXED_CLK(CLK_TOP_ULPOSC, CLK_XTAL, 250000),
73 FIXED_CLK(CLK_TOP_UNIVP_192M, CLK_TOP_UNIVPLL, 192000000),
74};
75
76static const struct mtk_fixed_factor top_fixed_divs[] = {
77 FACTOR(CLK_TOP_CLK13M, CLK_TOP_CLK26M, 1, 2, CLK_PARENT_TOPCKGEN),
78 FACTOR(CLK_TOP_F26M_CK_D2, CLK_TOP_CLK26M, 1, 2, CLK_PARENT_TOPCKGEN),
79 FACTOR(CLK_TOP_SYSPLL_CK, CLK_APMIXED_MAINPLL, 1,
80 1, CLK_PARENT_APMIXED),
81 FACTOR(CLK_TOP_SYSPLL_D2, CLK_TOP_SYSPLL_CK, 1,
82 2, CLK_PARENT_TOPCKGEN),
83 FACTOR(CLK_TOP_SYSPLL_D3, CLK_APMIXED_MAINPLL, 1,
84 3, CLK_PARENT_APMIXED),
85 FACTOR(CLK_TOP_SYSPLL_D5, CLK_APMIXED_MAINPLL, 1,
86 5, CLK_PARENT_APMIXED),
87 FACTOR(CLK_TOP_SYSPLL_D7, CLK_APMIXED_MAINPLL, 1,
88 7, CLK_PARENT_APMIXED),
89 FACTOR(CLK_TOP_SYSPLL_D2_D2, CLK_TOP_SYSPLL_D2, 1,
90 2, CLK_PARENT_TOPCKGEN),
91 FACTOR(CLK_TOP_SYSPLL_D2_D4, CLK_TOP_SYSPLL_D2, 1,
92 4, CLK_PARENT_TOPCKGEN),
93 FACTOR(CLK_TOP_SYSPLL_D2_D8, CLK_TOP_SYSPLL_D2, 1,
94 8, CLK_PARENT_TOPCKGEN),
95 FACTOR(CLK_TOP_SYSPLL_D2_D16, CLK_TOP_SYSPLL_D2, 1,
96 16, CLK_PARENT_TOPCKGEN),
97 FACTOR(CLK_TOP_SYSPLL_D3_D2, CLK_TOP_SYSPLL_D3, 1,
98 2, CLK_PARENT_TOPCKGEN),
99 FACTOR(CLK_TOP_SYSPLL_D3_D4, CLK_TOP_SYSPLL_D3, 1,
100 4, CLK_PARENT_TOPCKGEN),
101 FACTOR(CLK_TOP_SYSPLL_D3_D8, CLK_TOP_SYSPLL_D3, 1,
102 8, CLK_PARENT_TOPCKGEN),
103 FACTOR(CLK_TOP_SYSPLL_D5_D2, CLK_TOP_SYSPLL_D5, 1,
104 2, CLK_PARENT_TOPCKGEN),
105 FACTOR(CLK_TOP_SYSPLL_D5_D4, CLK_TOP_SYSPLL_D5, 1,
106 4, CLK_PARENT_TOPCKGEN),
107 FACTOR(CLK_TOP_SYSPLL_D7_D2, CLK_TOP_SYSPLL_D7, 1,
108 2, CLK_PARENT_TOPCKGEN),
109 FACTOR(CLK_TOP_SYSPLL_D7_D4, CLK_TOP_SYSPLL_D7, 1,
110 4, CLK_PARENT_TOPCKGEN),
111 FACTOR(CLK_TOP_UNIVPLL_CK, CLK_TOP_UNIVPLL, 1, 1, CLK_PARENT_TOPCKGEN),
112 FACTOR(CLK_TOP_UNIVPLL_D2, CLK_TOP_UNIVPLL_CK, 1,
113 2, CLK_PARENT_TOPCKGEN),
114 FACTOR(CLK_TOP_UNIVPLL_D3, CLK_TOP_UNIVPLL, 1, 3, CLK_PARENT_TOPCKGEN),
115 FACTOR(CLK_TOP_UNIVPLL_D5, CLK_TOP_UNIVPLL, 1, 5, CLK_PARENT_TOPCKGEN),
116 FACTOR(CLK_TOP_UNIVPLL_D7, CLK_TOP_UNIVPLL, 1, 7, CLK_PARENT_TOPCKGEN),
117 FACTOR(CLK_TOP_UNIVPLL_D2_D2, CLK_TOP_UNIVPLL_D2, 1,
118 2, CLK_PARENT_TOPCKGEN),
119 FACTOR(CLK_TOP_UNIVPLL_D2_D4, CLK_TOP_UNIVPLL_D2, 1,
120 4, CLK_PARENT_TOPCKGEN),
121 FACTOR(CLK_TOP_UNIVPLL_D2_D8, CLK_TOP_UNIVPLL_D2, 1,
122 8, CLK_PARENT_TOPCKGEN),
123 FACTOR(CLK_TOP_UNIVPLL_D3_D2, CLK_TOP_UNIVPLL_D3, 1,
124 2, CLK_PARENT_TOPCKGEN),
125 FACTOR(CLK_TOP_UNIVPLL_D3_D4, CLK_TOP_UNIVPLL_D3, 1,
126 4, CLK_PARENT_TOPCKGEN),
127 FACTOR(CLK_TOP_UNIVPLL_D3_D8, CLK_TOP_UNIVPLL_D3, 1,
128 8, CLK_PARENT_TOPCKGEN),
129 FACTOR(CLK_TOP_UNIVPLL_D5_D2, CLK_TOP_UNIVPLL_D5, 1,
130 2, CLK_PARENT_TOPCKGEN),
131 FACTOR(CLK_TOP_UNIVPLL_D5_D4, CLK_TOP_UNIVPLL_D5, 1,
132 4, CLK_PARENT_TOPCKGEN),
133 FACTOR(CLK_TOP_UNIVPLL_D5_D8, CLK_TOP_UNIVPLL_D5, 1,
134 8, CLK_PARENT_TOPCKGEN),
135 FACTOR(CLK_TOP_UNIVP_192M_CK, CLK_TOP_UNIVP_192M, 1, 1,
136 CLK_PARENT_TOPCKGEN),
137 FACTOR(CLK_TOP_UNIVP_192M_D2, CLK_TOP_UNIVP_192M_CK, 1,
138 2, CLK_PARENT_TOPCKGEN),
139 FACTOR(CLK_TOP_UNIVP_192M_D4, CLK_TOP_UNIVP_192M_CK, 1,
140 4, CLK_PARENT_TOPCKGEN),
141 FACTOR(CLK_TOP_UNIVP_192M_D8, CLK_TOP_UNIVP_192M_CK, 1,
142 8, CLK_PARENT_TOPCKGEN),
143 FACTOR(CLK_TOP_UNIVP_192M_D16, CLK_TOP_UNIVP_192M_CK, 1,
144 16, CLK_PARENT_TOPCKGEN),
145 FACTOR(CLK_TOP_UNIVP_192M_D32, CLK_TOP_UNIVP_192M_CK, 1,
146 32, CLK_PARENT_TOPCKGEN),
147 FACTOR(CLK_TOP_APLL1_CK, CLK_APMIXED_APLL1, 1, 1, CLK_PARENT_APMIXED),
148 FACTOR(CLK_TOP_APLL1_D2, CLK_APMIXED_APLL1, 1, 2, CLK_PARENT_APMIXED),
149 FACTOR(CLK_TOP_APLL1_D4, CLK_APMIXED_APLL1, 1, 4, CLK_PARENT_APMIXED),
150 FACTOR(CLK_TOP_APLL1_D8, CLK_APMIXED_APLL1, 1, 8, CLK_PARENT_APMIXED),
151 FACTOR(CLK_TOP_APLL2_CK, CLK_APMIXED_APLL2, 1, 1, CLK_PARENT_APMIXED),
152 FACTOR(CLK_TOP_APLL2_D2, CLK_APMIXED_APLL2, 1, 2, CLK_PARENT_APMIXED),
153 FACTOR(CLK_TOP_APLL2_D4, CLK_APMIXED_APLL2, 1, 4, CLK_PARENT_APMIXED),
154 FACTOR(CLK_TOP_APLL2_D8, CLK_APMIXED_APLL2, 1, 8, CLK_PARENT_APMIXED),
155 FACTOR(CLK_TOP_TVDPLL_CK, CLK_APMIXED_TVDPLL, 1, 1, CLK_PARENT_APMIXED),
156 FACTOR(CLK_TOP_TVDPLL_D2, CLK_TOP_TVDPLL_CK, 1, 2, CLK_PARENT_TOPCKGEN),
157 FACTOR(CLK_TOP_TVDPLL_D4, CLK_APMIXED_TVDPLL, 1, 4, CLK_PARENT_APMIXED),
158 FACTOR(CLK_TOP_TVDPLL_D8, CLK_APMIXED_TVDPLL, 1, 8, CLK_PARENT_APMIXED),
159 FACTOR(CLK_TOP_TVDPLL_D16, CLK_APMIXED_TVDPLL, 1,
160 16, CLK_PARENT_APMIXED),
161 FACTOR(CLK_TOP_MMPLL_CK, CLK_APMIXED_MMPLL, 1, 1, CLK_PARENT_APMIXED),
162 FACTOR(CLK_TOP_MMPLL_D4, CLK_APMIXED_MMPLL, 1, 4, CLK_PARENT_APMIXED),
163 FACTOR(CLK_TOP_MMPLL_D4_D2, CLK_TOP_MMPLL_D4, 1,
164 2, CLK_PARENT_TOPCKGEN),
165 FACTOR(CLK_TOP_MMPLL_D4_D4, CLK_TOP_MMPLL_D4, 1, 4, CLK_PARENT_TOPCKGEN),
166 FACTOR(CLK_TOP_MMPLL_D5, CLK_APMIXED_MMPLL, 1, 5, CLK_PARENT_APMIXED),
167 FACTOR(CLK_TOP_MMPLL_D5_D2, CLK_TOP_MMPLL_D5, 1,
168 2, CLK_PARENT_TOPCKGEN),
169 FACTOR(CLK_TOP_MMPLL_D5_D4, CLK_TOP_MMPLL_D5, 1,
170 4, CLK_PARENT_TOPCKGEN),
171 FACTOR(CLK_TOP_MMPLL_D6, CLK_APMIXED_MMPLL, 1, 6, CLK_PARENT_APMIXED),
172 FACTOR(CLK_TOP_MMPLL_D7, CLK_APMIXED_MMPLL, 1, 7, CLK_PARENT_APMIXED),
173 FACTOR(CLK_TOP_MFGPLL_CK, CLK_APMIXED_MFGPLL, 1, 1, CLK_PARENT_APMIXED),
174 FACTOR(CLK_TOP_MSDCPLL_CK, CLK_APMIXED_MSDCPLL, 1,
175 1, CLK_PARENT_APMIXED),
176 FACTOR(CLK_TOP_MSDCPLL_D2, CLK_APMIXED_MSDCPLL, 1,
177 2, CLK_PARENT_APMIXED),
178 FACTOR(CLK_TOP_MSDCPLL_D4, CLK_APMIXED_MSDCPLL, 1,
179 4, CLK_PARENT_APMIXED),
180 FACTOR(CLK_TOP_MSDCPLL_D8, CLK_APMIXED_MSDCPLL, 1,
181 8, CLK_PARENT_APMIXED),
182 FACTOR(CLK_TOP_MSDCPLL_D16, CLK_APMIXED_MSDCPLL, 1,
183 16, CLK_PARENT_APMIXED),
184 FACTOR(CLK_TOP_AD_OSC_CK, CLK_TOP_ULPOSC, 1, 1, CLK_PARENT_TOPCKGEN),
185 FACTOR(CLK_TOP_OSC_D2, CLK_TOP_ULPOSC, 1, 2, CLK_PARENT_TOPCKGEN),
186 FACTOR(CLK_TOP_OSC_D4, CLK_TOP_ULPOSC, 1, 4, CLK_PARENT_TOPCKGEN),
187 FACTOR(CLK_TOP_OSC_D8, CLK_TOP_ULPOSC, 1, 8, CLK_PARENT_TOPCKGEN),
188 FACTOR(CLK_TOP_OSC_D16, CLK_TOP_ULPOSC, 1, 16, CLK_PARENT_TOPCKGEN),
189 FACTOR(CLK_TOP_UNIVPLL, CLK_APMIXED_UNIV2PLL, 1, 2, CLK_PARENT_APMIXED),
190 FACTOR(CLK_TOP_UNIVPLL_D3_D16, CLK_TOP_UNIVPLL_D3, 1,
191 16, CLK_PARENT_TOPCKGEN),
192};
193
194static const int axi_parents[] = {
195 CLK_TOP_CLK26M,
196 CLK_TOP_SYSPLL_D2_D4,
197 CLK_TOP_SYSPLL_D7,
198 CLK_TOP_OSC_D4
199};
200
201static const int mm_parents[] = {
202 CLK_TOP_CLK26M,
203 CLK_TOP_MMPLL_D7,
204 CLK_TOP_SYSPLL_D3,
205 CLK_TOP_UNIVPLL_D2_D2,
206 CLK_TOP_SYSPLL_D2_D2,
207 CLK_TOP_SYSPLL_D3_D2
208};
209
210static const int img_parents[] = {
211 CLK_TOP_CLK26M,
212 CLK_TOP_MMPLL_D6,
213 CLK_TOP_UNIVPLL_D3,
214 CLK_TOP_SYSPLL_D3,
215 CLK_TOP_UNIVPLL_D2_D2,
216 CLK_TOP_SYSPLL_D2_D2,
217 CLK_TOP_UNIVPLL_D3_D2,
218 CLK_TOP_SYSPLL_D3_D2
219};
220
221static const int cam_parents[] = {
222 CLK_TOP_CLK26M,
223 CLK_TOP_SYSPLL_D2,
224 CLK_TOP_MMPLL_D6,
225 CLK_TOP_SYSPLL_D3,
226 CLK_TOP_MMPLL_D7,
227 CLK_TOP_UNIVPLL_D3,
228 CLK_TOP_UNIVPLL_D2_D2,
229 CLK_TOP_SYSPLL_D2_D2,
230 CLK_TOP_SYSPLL_D3_D2,
231 CLK_TOP_UNIVPLL_D3_D2
232};
233
234static const int dsp_parents[] = {
235 CLK_TOP_CLK26M,
236 CLK_TOP_MMPLL_D6,
237 CLK_TOP_MMPLL_D7,
238 CLK_TOP_UNIVPLL_D3,
239 CLK_TOP_SYSPLL_D3,
240 CLK_TOP_UNIVPLL_D2_D2,
241 CLK_TOP_SYSPLL_D2_D2,
242 CLK_TOP_UNIVPLL_D3_D2,
243 CLK_TOP_SYSPLL_D3_D2
244};
245
246static const int dsp1_parents[] = {
247 CLK_TOP_CLK26M,
248 CLK_TOP_MMPLL_D6,
249 CLK_TOP_MMPLL_D7,
250 CLK_TOP_UNIVPLL_D3,
251 CLK_TOP_SYSPLL_D3,
252 CLK_TOP_UNIVPLL_D2_D2,
253 CLK_TOP_SYSPLL_D2_D2,
254 CLK_TOP_UNIVPLL_D3_D2,
255 CLK_TOP_SYSPLL_D3_D2
256};
257
258static const int dsp2_parents[] = {
259 CLK_TOP_CLK26M,
260 CLK_TOP_MMPLL_D6,
261 CLK_TOP_MMPLL_D7,
262 CLK_TOP_UNIVPLL_D3,
263 CLK_TOP_SYSPLL_D3,
264 CLK_TOP_UNIVPLL_D2_D2,
265 CLK_TOP_SYSPLL_D2_D2,
266 CLK_TOP_UNIVPLL_D3_D2,
267 CLK_TOP_SYSPLL_D3_D2
268};
269
270static const int ipu_if_parents[] = {
271 CLK_TOP_CLK26M,
272 CLK_TOP_MMPLL_D6,
273 CLK_TOP_MMPLL_D7,
274 CLK_TOP_UNIVPLL_D3,
275 CLK_TOP_SYSPLL_D3,
276 CLK_TOP_UNIVPLL_D2_D2,
277 CLK_TOP_SYSPLL_D2_D2,
278 CLK_TOP_UNIVPLL_D3_D2,
279 CLK_TOP_SYSPLL_D3_D2
280};
281
282static const int mfg_parents[] = {
283 CLK_TOP_CLK26M,
284 CLK_TOP_MFGPLL_CK,
285 CLK_TOP_UNIVPLL_D3,
286 CLK_TOP_SYSPLL_D3
287};
288
289static const int f52m_mfg_parents[] = {
290 CLK_TOP_CLK26M,
291 CLK_TOP_UNIVPLL_D3_D2,
292 CLK_TOP_UNIVPLL_D3_D4,
293 CLK_TOP_UNIVPLL_D3_D8
294};
295
296static const int camtg_parents[] = {
297 CLK_TOP_CLK26M,
298 CLK_TOP_UNIVP_192M_D8,
299 CLK_TOP_UNIVPLL_D3_D8,
300 CLK_TOP_UNIVP_192M_D4,
301 CLK_TOP_UNIVPLL_D3_D16,
302 CLK_TOP_F26M_CK_D2,
303 CLK_TOP_UNIVP_192M_D16,
304 CLK_TOP_UNIVP_192M_D32
305};
306
307static const int camtg2_parents[] = {
308 CLK_TOP_CLK26M,
309 CLK_TOP_UNIVP_192M_D8,
310 CLK_TOP_UNIVPLL_D3_D8,
311 CLK_TOP_UNIVP_192M_D4,
312 CLK_TOP_UNIVPLL_D3_D16,
313 CLK_TOP_F26M_CK_D2,
314 CLK_TOP_UNIVP_192M_D16,
315 CLK_TOP_UNIVP_192M_D32
316};
317
318static const int camtg3_parents[] = {
319 CLK_TOP_CLK26M,
320 CLK_TOP_UNIVP_192M_D8,
321 CLK_TOP_UNIVPLL_D3_D8,
322 CLK_TOP_UNIVP_192M_D4,
323 CLK_TOP_UNIVPLL_D3_D16,
324 CLK_TOP_F26M_CK_D2,
325 CLK_TOP_UNIVP_192M_D16,
326 CLK_TOP_UNIVP_192M_D32
327};
328
329static const int camtg4_parents[] = {
330 CLK_TOP_CLK26M,
331 CLK_TOP_UNIVP_192M_D8,
332 CLK_TOP_UNIVPLL_D3_D8,
333 CLK_TOP_UNIVP_192M_D4,
334 CLK_TOP_UNIVPLL_D3_D16,
335 CLK_TOP_F26M_CK_D2,
336 CLK_TOP_UNIVP_192M_D16,
337 CLK_TOP_UNIVP_192M_D32
338};
339
340static const int uart_parents[] = {
341 CLK_TOP_CLK26M,
342 CLK_TOP_UNIVPLL_D3_D8
343};
344
345static const int spi_parents[] = {
346 CLK_TOP_CLK26M,
347 CLK_TOP_SYSPLL_D5_D2,
348 CLK_TOP_SYSPLL_D3_D4,
349 CLK_TOP_MSDCPLL_D4
350};
351
352static const int msdc50_hclk_parents[] = {
353 CLK_TOP_CLK26M,
354 CLK_TOP_SYSPLL_D2_D2,
355 CLK_TOP_SYSPLL_D3_D2
356};
357
358static const int msdc50_0_parents[] = {
359 CLK_TOP_CLK26M,
360 CLK_TOP_MSDCPLL_CK,
361 CLK_TOP_MSDCPLL_D2,
362 CLK_TOP_UNIVPLL_D2_D4,
363 CLK_TOP_SYSPLL_D3_D2,
364 CLK_TOP_UNIVPLL_D2_D2
365};
366
367static const int msdc30_1_parents[] = {
368 CLK_TOP_CLK26M,
369 CLK_TOP_UNIVPLL_D3_D2,
370 CLK_TOP_SYSPLL_D3_D2,
371 CLK_TOP_SYSPLL_D7,
372 CLK_TOP_MSDCPLL_D2
373};
374
375static const int msdc30_2_parents[] = {
376 CLK_TOP_CLK26M,
377 CLK_TOP_UNIVPLL_D3_D2,
378 CLK_TOP_SYSPLL_D3_D2,
379 CLK_TOP_SYSPLL_D7,
380 CLK_TOP_MSDCPLL_D2
381};
382
383static const int audio_parents[] = {
384 CLK_TOP_CLK26M,
385 CLK_TOP_SYSPLL_D5_D4,
386 CLK_TOP_SYSPLL_D7_D4,
387 CLK_TOP_SYSPLL_D2_D16
388};
389
390static const int aud_intbus_parents[] = {
391 CLK_TOP_CLK26M,
392 CLK_TOP_SYSPLL_D2_D4,
393 CLK_TOP_SYSPLL_D7_D2
394};
395
396static const int pmicspi_parents[] = {
397 CLK_TOP_CLK26M,
398 CLK_TOP_SYSPLL_D2_D8,
399 CLK_TOP_OSC_D8
400};
401
402static const int fpwrap_ulposc_parents[] = {
403 CLK_TOP_CLK26M,
404 CLK_TOP_OSC_D16,
405 CLK_TOP_OSC_D4,
406 CLK_TOP_OSC_D8
407};
408
409static const int atb_parents[] = {
410 CLK_TOP_CLK26M,
411 CLK_TOP_SYSPLL_D2_D2,
412 CLK_TOP_SYSPLL_D5
413};
414
415static const int sspm_parents[] = {
416 CLK_TOP_CLK26M,
417 CLK_TOP_UNIVPLL_D2_D4,
418 CLK_TOP_SYSPLL_D2_D2,
419 CLK_TOP_UNIVPLL_D2_D2,
420 CLK_TOP_SYSPLL_D3
421};
422
423static const int dpi0_parents[] = {
424 CLK_TOP_CLK26M,
425 CLK_TOP_TVDPLL_D2,
426 CLK_TOP_TVDPLL_D4,
427 CLK_TOP_TVDPLL_D8,
428 CLK_TOP_TVDPLL_D16,
429 CLK_TOP_UNIVPLL_D5_D2,
430 CLK_TOP_UNIVPLL_D3_D4,
431 CLK_TOP_SYSPLL_D3_D4,
432 CLK_TOP_UNIVPLL_D3_D8
433};
434
435static const int scam_parents[] = {
436 CLK_TOP_CLK26M,
437 CLK_TOP_SYSPLL_D5_D2
438};
439
440static const int disppwm_parents[] = {
441 CLK_TOP_CLK26M,
442 CLK_TOP_UNIVPLL_D3_D4,
443 CLK_TOP_OSC_D2,
444 CLK_TOP_OSC_D4,
445 CLK_TOP_OSC_D16
446};
447
448static const int usb_top_parents[] = {
449 CLK_TOP_CLK26M,
450 CLK_TOP_UNIVPLL_D5_D4,
451 CLK_TOP_UNIVPLL_D3_D4,
452 CLK_TOP_UNIVPLL_D5_D2
453};
454
455static const int ssusb_top_xhci_parents[] = {
456 CLK_TOP_CLK26M,
457 CLK_TOP_UNIVPLL_D5_D4,
458 CLK_TOP_UNIVPLL_D3_D4,
459 CLK_TOP_UNIVPLL_D5_D2
460};
461
462static const int spm_parents[] = {
463 CLK_TOP_CLK26M,
464 CLK_TOP_SYSPLL_D2_D8
465};
466
467static const int i2c_parents[] = {
468 CLK_TOP_CLK26M,
469 CLK_TOP_SYSPLL_D2_D8,
470 CLK_TOP_UNIVPLL_D5_D2
471};
472
473static const int scp_parents[] = {
474 CLK_TOP_CLK26M,
475 CLK_TOP_UNIVPLL_D2_D8,
476 CLK_TOP_SYSPLL_D5,
477 CLK_TOP_SYSPLL_D2_D2,
478 CLK_TOP_UNIVPLL_D2_D2,
479 CLK_TOP_SYSPLL_D3,
480 CLK_TOP_UNIVPLL_D3
481};
482
483static const int seninf_parents[] = {
484 CLK_TOP_CLK26M,
485 CLK_TOP_UNIVPLL_D2_D2,
486 CLK_TOP_UNIVPLL_D3_D2,
487 CLK_TOP_UNIVPLL_D2_D4
488};
489
490static const int dxcc_parents[] = {
491 CLK_TOP_CLK26M,
492 CLK_TOP_SYSPLL_D2_D2,
493 CLK_TOP_SYSPLL_D2_D4,
494 CLK_TOP_SYSPLL_D2_D8
495};
496
497static const int aud_engen1_parents[] = {
498 CLK_TOP_CLK26M,
499 CLK_TOP_APLL1_D2,
500 CLK_TOP_APLL1_D4,
501 CLK_TOP_APLL1_D8
502};
503
504static const int aud_engen2_parents[] = {
505 CLK_TOP_CLK26M,
506 CLK_TOP_APLL2_D2,
507 CLK_TOP_APLL2_D4,
508 CLK_TOP_APLL2_D8
509};
510
511static const int faes_ufsfde_parents[] = {
512 CLK_TOP_CLK26M,
513 CLK_TOP_SYSPLL_D2,
514 CLK_TOP_SYSPLL_D2_D2,
515 CLK_TOP_SYSPLL_D3,
516 CLK_TOP_SYSPLL_D2_D4,
517 CLK_TOP_UNIVPLL_D3
518};
519
520static const int fufs_parents[] = {
521 CLK_TOP_CLK26M,
522 CLK_TOP_SYSPLL_D2_D4,
523 CLK_TOP_SYSPLL_D2_D8,
524 CLK_TOP_SYSPLL_D2_D16
525};
526
527static const int aud_1_parents[] = {
528 CLK_TOP_CLK26M,
529 CLK_TOP_APLL1_CK
530};
531
532static const int aud_2_parents[] = {
533 CLK_TOP_CLK26M,
534 CLK_TOP_APLL2_CK
535};
536
537static const struct mtk_composite top_muxes[] = {
538 /* CLK_CFG_0 */
539 MUX(CLK_TOP_MUX_AXI, axi_parents, 0x40, 0, 2),
540 MUX(CLK_TOP_MUX_MM, mm_parents, 0x40, 8, 3),
541 MUX(CLK_TOP_MUX_IMG, img_parents, 0x40, 16, 3),
542 MUX(CLK_TOP_MUX_CAM, cam_parents, 0x40, 24, 4),
543 /* CLK_CFG_1 */
544 MUX(CLK_TOP_MUX_DSP, dsp_parents, 0x50, 0, 4),
545 MUX(CLK_TOP_MUX_DSP1, dsp1_parents, 0x50, 8, 4),
546 MUX(CLK_TOP_MUX_DSP2, dsp2_parents, 0x50, 16, 4),
547 MUX(CLK_TOP_MUX_IPU_IF, ipu_if_parents, 0x50, 24, 4),
548 /* CLK_CFG_2 */
549 MUX(CLK_TOP_MUX_MFG, mfg_parents, 0x60, 0, 2),
550 MUX(CLK_TOP_MUX_F52M_MFG, f52m_mfg_parents, 0x60, 8, 2),
551 MUX(CLK_TOP_MUX_CAMTG, camtg_parents, 0x60, 16, 3),
552 MUX(CLK_TOP_MUX_CAMTG2, camtg2_parents, 0x60, 24, 3),
553 /* CLK_CFG_3 */
554 MUX(CLK_TOP_MUX_CAMTG3, camtg3_parents, 0x70, 0, 3),
555 MUX(CLK_TOP_MUX_CAMTG4, camtg4_parents, 0x70, 8, 3),
556 MUX(CLK_TOP_MUX_UART, uart_parents, 0x70, 16, 1),
557 MUX(CLK_TOP_MUX_SPI, spi_parents, 0x70, 24, 2),
558 /* CLK_CFG_4 */
559 MUX(CLK_TOP_MUX_MSDC50_0_HCLK, msdc50_hclk_parents, 0x80, 0, 2),
560 MUX(CLK_TOP_MUX_MSDC50_0, msdc50_0_parents, 0x80, 8, 3),
561 MUX(CLK_TOP_MUX_MSDC30_1, msdc30_1_parents, 0x80, 16, 3),
562 MUX(CLK_TOP_MUX_MSDC30_2, msdc30_2_parents, 0x80, 24, 3),
563 /* CLK_CFG_5 */
564 MUX(CLK_TOP_MUX_AUDIO, audio_parents, 0x90, 0, 2),
565 MUX(CLK_TOP_MUX_AUD_INTBUS, aud_intbus_parents, 0x90, 8, 2),
566 MUX(CLK_TOP_MUX_PMICSPI, pmicspi_parents, 0x90, 16, 2),
567 MUX(CLK_TOP_MUX_FPWRAP_ULPOSC, fpwrap_ulposc_parents, 0x90, 24, 2),
568 /* CLK_CFG_6 */
569 MUX(CLK_TOP_MUX_ATB, atb_parents, 0xa0, 0, 2),
570 MUX(CLK_TOP_MUX_SSPM, sspm_parents, 0xa0, 8, 3),
571 MUX(CLK_TOP_MUX_DPI0, dpi0_parents, 0xa0, 16, 4),
572 MUX(CLK_TOP_MUX_SCAM, scam_parents, 0xa0, 24, 1),
573 /* CLK_CFG_7 */
574 MUX(CLK_TOP_MUX_DISP_PWM, disppwm_parents, 0xb0, 0, 3),
575 MUX(CLK_TOP_MUX_USB_TOP, usb_top_parents, 0xb0, 8, 2),
576 MUX(CLK_TOP_MUX_SSUSB_TOP_XHCI, ssusb_top_xhci_parents, 0xb0, 16, 2),
577 MUX(CLK_TOP_MUX_SPM, spm_parents, 0xb0, 24, 1),
578 /* CLK_CFG_8 */
579 MUX(CLK_TOP_MUX_I2C, i2c_parents, 0xc0, 0, 2),
580 MUX(CLK_TOP_MUX_SCP, scp_parents, 0xc0, 8, 3),
581 MUX(CLK_TOP_MUX_SENINF, seninf_parents, 0xc0, 16, 2),
582 MUX(CLK_TOP_MUX_DXCC, dxcc_parents, 0xc0, 24, 2),
583 /* CLK_CFG_9 */
584 MUX(CLK_TOP_MUX_AUD_ENG1, aud_engen1_parents, 0xd0, 0, 2),
585 MUX(CLK_TOP_MUX_AUD_ENG2, aud_engen2_parents, 0xd0, 8, 2),
586 MUX(CLK_TOP_MUX_FAES_UFSFDE, faes_ufsfde_parents, 0xd0, 16, 3),
587 MUX(CLK_TOP_MUX_FUFS, fufs_parents, 0xd0, 24, 2),
588 /* CLK_CFG_10 */
589 MUX(CLK_TOP_MUX_AUD_1, aud_1_parents, 0xe0, 0, 1),
590 MUX(CLK_TOP_MUX_AUD_2, aud_2_parents, 0xe0, 8, 1),
591};
592
593static const struct mtk_clk_tree mt8183_clk_tree = {
594 .xtal_rate = 26 * MHZ,
595 .xtal2_rate = 26 * MHZ,
596 .fdivs_offs = CLK_TOP_CLK13M,
597 .muxes_offs = CLK_TOP_MUX_AXI,
598 .plls = apmixed_plls,
599 .fclks = top_fixed_clks,
600 .fdivs = top_fixed_divs,
601 .muxes = top_muxes,
602};
603
604static const struct mtk_gate_regs infra0_cg_regs = {
605 .set_ofs = 0x80,
606 .clr_ofs = 0x84,
607 .sta_ofs = 0x90,
608};
609
610static const struct mtk_gate_regs infra1_cg_regs = {
611 .set_ofs = 0x88,
612 .clr_ofs = 0x8c,
613 .sta_ofs = 0x94,
614};
615
616static const struct mtk_gate_regs infra2_cg_regs = {
617 .set_ofs = 0xa4,
618 .clr_ofs = 0xa8,
619 .sta_ofs = 0xac,
620};
621
622static const struct mtk_gate_regs infra3_cg_regs = {
623 .set_ofs = 0xc0,
624 .clr_ofs = 0xc4,
625 .sta_ofs = 0xc8,
626};
627
628#define GATE_INFRA0(_id, _parent, _shift) { \
629 .id = _id, \
630 .parent = _parent, \
631 .regs = &infra0_cg_regs, \
632 .shift = _shift, \
633 .flags = CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN, \
634 }
635
636#define GATE_INFRA1(_id, _parent, _shift) { \
637 .id = _id, \
638 .parent = _parent, \
639 .regs = &infra1_cg_regs, \
640 .shift = _shift, \
641 .flags = CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN, \
642 }
643
644#define GATE_INFRA2(_id, _parent, _shift) { \
645 .id = _id, \
646 .parent = _parent, \
647 .regs = &infra2_cg_regs, \
648 .shift = _shift, \
649 .flags = CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN, \
650 }
651
652#define GATE_INFRA3(_id, _parent, _shift) { \
653 .id = _id, \
654 .parent = _parent, \
655 .regs = &infra3_cg_regs, \
656 .shift = _shift, \
657 .flags = CLK_GATE_SETCLR | CLK_PARENT_TOPCKGEN, \
658 }
659
660static const struct mtk_gate infra_clks[] = {
661 /* INFRA0 */
662 GATE_INFRA0(CLK_INFRA_PMIC_TMR, CLK_TOP_MUX_AXI, 0),
663 GATE_INFRA0(CLK_INFRA_PMIC_AP, CLK_TOP_MUX_AXI, 1),
664 GATE_INFRA0(CLK_INFRA_PMIC_MD, CLK_TOP_MUX_AXI, 2),
665 GATE_INFRA0(CLK_INFRA_PMIC_CONN, CLK_TOP_MUX_AXI, 3),
666 GATE_INFRA0(CLK_INFRA_SCPSYS, CLK_TOP_MUX_SCP, 4),
667 GATE_INFRA0(CLK_INFRA_SEJ, CLK_TOP_CLK26M, 5),
668 GATE_INFRA0(CLK_INFRA_APXGPT, CLK_TOP_MUX_AXI, 6),
669 GATE_INFRA0(CLK_INFRA_ICUSB, CLK_TOP_MUX_AXI, 8),
670 GATE_INFRA0(CLK_INFRA_GCE, CLK_TOP_MUX_AXI, 9),
671 GATE_INFRA0(CLK_INFRA_THERM, CLK_TOP_MUX_AXI, 10),
672 GATE_INFRA0(CLK_INFRA_I2C0, CLK_TOP_MUX_I2C, 11),
673 GATE_INFRA0(CLK_INFRA_I2C1, CLK_TOP_MUX_I2C, 12),
674 GATE_INFRA0(CLK_INFRA_I2C2, CLK_TOP_MUX_I2C, 13),
675 GATE_INFRA0(CLK_INFRA_I2C3, CLK_TOP_MUX_I2C, 14),
676 GATE_INFRA0(CLK_INFRA_PWM_HCLK, CLK_TOP_MUX_AXI, 15),
677 GATE_INFRA0(CLK_INFRA_PWM1, CLK_TOP_MUX_I2C, 16),
678 GATE_INFRA0(CLK_INFRA_PWM2, CLK_TOP_MUX_I2C, 17),
679 GATE_INFRA0(CLK_INFRA_PWM3, CLK_TOP_MUX_I2C, 18),
680 GATE_INFRA0(CLK_INFRA_PWM4, CLK_TOP_MUX_I2C, 19),
681 GATE_INFRA0(CLK_INFRA_PWM, CLK_TOP_MUX_I2C, 21),
682 GATE_INFRA0(CLK_INFRA_UART0, CLK_TOP_MUX_UART, 22),
683 GATE_INFRA0(CLK_INFRA_UART1, CLK_TOP_MUX_UART, 23),
684 GATE_INFRA0(CLK_INFRA_UART2, CLK_TOP_MUX_UART, 24),
685 GATE_INFRA0(CLK_INFRA_UART3, CLK_TOP_MUX_UART, 25),
686 GATE_INFRA0(CLK_INFRA_GCE_26M, CLK_TOP_MUX_AXI, 27),
687 GATE_INFRA0(CLK_INFRA_CQ_DMA_FPC, CLK_TOP_MUX_AXI, 28),
688 GATE_INFRA0(CLK_INFRA_BTIF, CLK_TOP_MUX_AXI, 31),
689 /* INFRA1 */
690 GATE_INFRA1(CLK_INFRA_SPI0, CLK_TOP_MUX_SPI, 1),
691 GATE_INFRA1(CLK_INFRA_MSDC0, CLK_TOP_MUX_MSDC50_0_HCLK, 2),
692 GATE_INFRA1(CLK_INFRA_MSDC1, CLK_TOP_MUX_AXI, 4),
693 GATE_INFRA1(CLK_INFRA_MSDC2, CLK_TOP_MUX_AXI, 5),
694 GATE_INFRA1(CLK_INFRA_MSDC0_SCK, CLK_TOP_MUX_MSDC50_0, 6),
695 GATE_INFRA1(CLK_INFRA_DVFSRC, CLK_TOP_CLK26M, 7),
696 GATE_INFRA1(CLK_INFRA_GCPU, CLK_TOP_MUX_AXI, 8),
697 GATE_INFRA1(CLK_INFRA_TRNG, CLK_TOP_MUX_AXI, 9),
698 GATE_INFRA1(CLK_INFRA_AUXADC, CLK_TOP_CLK26M, 10),
699 GATE_INFRA1(CLK_INFRA_CPUM, CLK_TOP_MUX_AXI, 11),
700 GATE_INFRA1(CLK_INFRA_CCIF1_AP, CLK_TOP_MUX_AXI, 12),
701 GATE_INFRA1(CLK_INFRA_CCIF1_MD, CLK_TOP_MUX_AXI, 13),
702 GATE_INFRA1(CLK_INFRA_AUXADC_MD, CLK_TOP_CLK26M, 14),
703 GATE_INFRA1(CLK_INFRA_MSDC1_SCK, CLK_TOP_MUX_MSDC30_1, 16),
704 GATE_INFRA1(CLK_INFRA_MSDC2_SCK, CLK_TOP_MUX_MSDC30_2, 17),
705 GATE_INFRA1(CLK_INFRA_AP_DMA, CLK_TOP_MUX_AXI, 18),
706 GATE_INFRA1(CLK_INFRA_XIU, CLK_TOP_MUX_AXI, 19),
707 GATE_INFRA1(CLK_INFRA_DEVICE_APC, CLK_TOP_MUX_AXI, 20),
708 GATE_INFRA1(CLK_INFRA_CCIF_AP, CLK_TOP_MUX_AXI, 23),
709 GATE_INFRA1(CLK_INFRA_DEBUGSYS, CLK_TOP_MUX_AXI, 24),
710 GATE_INFRA1(CLK_INFRA_AUDIO, CLK_TOP_MUX_AXI, 25),
711 GATE_INFRA1(CLK_INFRA_CCIF_MD, CLK_TOP_MUX_AXI, 26),
712 GATE_INFRA1(CLK_INFRA_DXCC_SEC_CORE, CLK_TOP_MUX_DXCC, 27),
713 GATE_INFRA1(CLK_INFRA_DXCC_AO, CLK_TOP_MUX_DXCC, 28),
714 GATE_INFRA1(CLK_INFRA_DEVMPU_BCLK, CLK_TOP_MUX_AXI, 30),
715 GATE_INFRA1(CLK_INFRA_DRAMC_F26M, CLK_TOP_CLK26M, 31),
716 /* INFRA2 */
717 GATE_INFRA2(CLK_INFRA_IRTX, CLK_TOP_CLK26M, 0),
718 GATE_INFRA2(CLK_INFRA_USB, CLK_TOP_MUX_USB_TOP, 1),
719 GATE_INFRA2(CLK_INFRA_DISP_PWM, CLK_TOP_MUX_AXI, 2),
720 GATE_INFRA2(CLK_INFRA_CLDMA_BCLK, CLK_TOP_MUX_AXI, 3),
721 GATE_INFRA2(CLK_INFRA_AUDIO_26M_BCLK, CLK_TOP_CLK26M, 4),
722 GATE_INFRA2(CLK_INFRA_SPI1, CLK_TOP_MUX_SPI, 6),
723 GATE_INFRA2(CLK_INFRA_I2C4, CLK_TOP_MUX_I2C, 7),
724 GATE_INFRA2(CLK_INFRA_MODEM_TEMP_SHARE, CLK_TOP_CLK26M, 8),
725 GATE_INFRA2(CLK_INFRA_SPI2, CLK_TOP_MUX_SPI, 9),
726 GATE_INFRA2(CLK_INFRA_SPI3, CLK_TOP_MUX_SPI, 10),
727 GATE_INFRA2(CLK_INFRA_UNIPRO_SCK, CLK_TOP_MUX_SSUSB_TOP_XHCI, 11),
728 GATE_INFRA2(CLK_INFRA_UNIPRO_TICK, CLK_TOP_MUX_FUFS, 12),
729 GATE_INFRA2(CLK_INFRA_UFS_MP_SAP_BCLK, CLK_TOP_MUX_FUFS, 13),
730 GATE_INFRA2(CLK_INFRA_MD32_BCLK, CLK_TOP_MUX_AXI, 14),
731 GATE_INFRA2(CLK_INFRA_UNIPRO_MBIST, CLK_TOP_MUX_AXI, 16),
732 GATE_INFRA2(CLK_INFRA_I2C5, CLK_TOP_MUX_I2C, 18),
733 GATE_INFRA2(CLK_INFRA_I2C5_ARBITER, CLK_TOP_MUX_I2C, 19),
734 GATE_INFRA2(CLK_INFRA_I2C5_IMM, CLK_TOP_MUX_I2C, 20),
735 GATE_INFRA2(CLK_INFRA_I2C1_ARBITER, CLK_TOP_MUX_I2C, 21),
736 GATE_INFRA2(CLK_INFRA_I2C1_IMM, CLK_TOP_MUX_I2C, 22),
737 GATE_INFRA2(CLK_INFRA_I2C2_ARBITER, CLK_TOP_MUX_I2C, 23),
738 GATE_INFRA2(CLK_INFRA_I2C2_IMM, CLK_TOP_MUX_I2C, 24),
739 GATE_INFRA2(CLK_INFRA_SPI4, CLK_TOP_MUX_SPI, 25),
740 GATE_INFRA2(CLK_INFRA_SPI5, CLK_TOP_MUX_SPI, 26),
741 GATE_INFRA2(CLK_INFRA_CQ_DMA, CLK_TOP_MUX_AXI, 27),
742 GATE_INFRA2(CLK_INFRA_UFS, CLK_TOP_MUX_FUFS, 28),
743 GATE_INFRA2(CLK_INFRA_AES_UFSFDE, CLK_TOP_MUX_FAES_UFSFDE, 29),
744 GATE_INFRA2(CLK_INFRA_UFS_TICK, CLK_TOP_MUX_FUFS, 30),
745 /* INFRA3 */
746 GATE_INFRA3(CLK_INFRA_MSDC0_SELF, CLK_TOP_MUX_MSDC50_0, 0),
747 GATE_INFRA3(CLK_INFRA_MSDC1_SELF, CLK_TOP_MUX_MSDC50_0, 1),
748 GATE_INFRA3(CLK_INFRA_MSDC2_SELF, CLK_TOP_MUX_MSDC50_0, 2),
749 GATE_INFRA3(CLK_INFRA_UFS_AXI, CLK_TOP_MUX_AXI, 5),
750 GATE_INFRA3(CLK_INFRA_I2C6, CLK_TOP_MUX_I2C, 6),
751 GATE_INFRA3(CLK_INFRA_AP_MSDC0, CLK_TOP_MUX_MSDC50_0_HCLK, 7),
752 GATE_INFRA3(CLK_INFRA_MD_MSDC0, CLK_TOP_MUX_MSDC50_0_HCLK, 8),
753 GATE_INFRA3(CLK_INFRA_CCIF2_AP, CLK_TOP_MUX_AXI, 16),
754 GATE_INFRA3(CLK_INFRA_CCIF2_MD, CLK_TOP_MUX_AXI, 17),
755 GATE_INFRA3(CLK_INFRA_CCIF3_AP, CLK_TOP_MUX_AXI, 18),
756 GATE_INFRA3(CLK_INFRA_CCIF3_MD, CLK_TOP_MUX_AXI, 19),
757 GATE_INFRA3(CLK_INFRA_SEJ_F13M, CLK_TOP_CLK26M, 20),
758 GATE_INFRA3(CLK_INFRA_AES_BCLK, CLK_TOP_MUX_AXI, 21),
759 GATE_INFRA3(CLK_INFRA_I2C7, CLK_TOP_MUX_I2C, 22),
760 GATE_INFRA3(CLK_INFRA_I2C8, CLK_TOP_MUX_I2C, 23),
761 GATE_INFRA3(CLK_INFRA_FBIST2FPC, CLK_TOP_MUX_MSDC50_0, 24),
762};
763
764static int mt8183_apmixedsys_probe(struct udevice *dev)
765{
766 return mtk_common_clk_init(dev, &mt8183_clk_tree);
767}
768
769static int mt8183_topckgen_probe(struct udevice *dev)
770{
771 return mtk_common_clk_init(dev, &mt8183_clk_tree);
772}
773
774static int mt8183_infracfg_probe(struct udevice *dev)
775{
776 return mtk_common_clk_gate_init(dev, &mt8183_clk_tree, infra_clks);
777}
778
779static const struct udevice_id mt8183_apmixed_compat[] = {
780 { .compatible = "mediatek,mt8183-apmixedsys", },
781 { }
782};
783
784static const struct udevice_id mt8183_topckgen_compat[] = {
785 { .compatible = "mediatek,mt8183-topckgen", },
786 { }
787};
788
789static const struct udevice_id mt8183_infracfg_compat[] = {
790 { .compatible = "mediatek,mt8183-infracfg", },
791 { }
792};
793
794U_BOOT_DRIVER(mtk_clk_apmixedsys) = {
795 .name = "mt8183-apmixedsys",
796 .id = UCLASS_CLK,
797 .of_match = mt8183_apmixed_compat,
798 .probe = mt8183_apmixedsys_probe,
799 .priv_auto = sizeof(struct mtk_clk_priv),
800 .ops = &mtk_clk_apmixedsys_ops,
801 .flags = DM_FLAG_PRE_RELOC,
802};
803
804U_BOOT_DRIVER(mtk_clk_topckgen) = {
805 .name = "mt8183-topckgen",
806 .id = UCLASS_CLK,
807 .of_match = mt8183_topckgen_compat,
808 .probe = mt8183_topckgen_probe,
809 .priv_auto = sizeof(struct mtk_clk_priv),
810 .ops = &mtk_clk_topckgen_ops,
811 .flags = DM_FLAG_PRE_RELOC,
812};
813
814U_BOOT_DRIVER(mtk_clk_infracfg) = {
815 .name = "mt8183-infracfg",
816 .id = UCLASS_CLK,
817 .of_match = mt8183_infracfg_compat,
818 .probe = mt8183_infracfg_probe,
819 .priv_auto = sizeof(struct mtk_clk_priv),
820 .ops = &mtk_clk_gate_ops,
821 .flags = DM_FLAG_PRE_RELOC,
822};