xref: /openbmc/linux/drivers/clk/mediatek/clk-mt8192.c (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
1710573deSChun-Jie Chen // SPDX-License-Identifier: GPL-2.0-only
2710573deSChun-Jie Chen //
3710573deSChun-Jie Chen // Copyright (c) 2021 MediaTek Inc.
4710573deSChun-Jie Chen // Author: Chun-Jie Chen <chun-jie.chen@mediatek.com>
5710573deSChun-Jie Chen 
6710573deSChun-Jie Chen #include <linux/clk.h>
7710573deSChun-Jie Chen #include <linux/delay.h>
8710573deSChun-Jie Chen #include <linux/mfd/syscon.h>
9*a96cbb14SRob Herring #include <linux/mod_devicetable.h>
10710573deSChun-Jie Chen #include <linux/platform_device.h>
11710573deSChun-Jie Chen #include <linux/slab.h>
12710573deSChun-Jie Chen 
1339691fb6SChen-Yu Tsai #include "clk-gate.h"
14710573deSChun-Jie Chen #include "clk-mtk.h"
15710573deSChun-Jie Chen #include "clk-mux.h"
16710573deSChun-Jie Chen 
17710573deSChun-Jie Chen #include <dt-bindings/clock/mt8192-clk.h>
18a0bc8ae5SRex-BC Chen #include <dt-bindings/reset/mt8192-resets.h>
19710573deSChun-Jie Chen 
20710573deSChun-Jie Chen static DEFINE_SPINLOCK(mt8192_clk_lock);
21710573deSChun-Jie Chen 
22710573deSChun-Jie Chen static const struct mtk_fixed_clk top_fixed_clks[] = {
23710573deSChun-Jie Chen 	FIXED_CLK(CLK_TOP_ULPOSC, "ulposc", NULL, 260000000),
24710573deSChun-Jie Chen };
25710573deSChun-Jie Chen 
26710573deSChun-Jie Chen static const struct mtk_fixed_factor top_divs[] = {
27b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D3, "mainpll_d3", "mainpll", 1, 3, 0),
28b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D4, "mainpll_d4", "mainpll", 1, 4, 0),
29b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D4_D2, "mainpll_d4_d2", "mainpll_d4", 1, 2, 0),
30b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D4_D4, "mainpll_d4_d4", "mainpll_d4", 1, 4, 0),
31b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D4_D8, "mainpll_d4_d8", "mainpll_d4", 1, 8, 0),
32b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D4_D16, "mainpll_d4_d16", "mainpll_d4", 1, 16, 0),
33b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D5, "mainpll_d5", "mainpll", 1, 5, 0),
34b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D5_D2, "mainpll_d5_d2", "mainpll_d5", 1, 2, 0),
35b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D5_D4, "mainpll_d5_d4", "mainpll_d5", 1, 4, 0),
36b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D5_D8, "mainpll_d5_d8", "mainpll_d5", 1, 8, 0),
37b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D6, "mainpll_d6", "mainpll", 1, 6, 0),
38b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D6_D2, "mainpll_d6_d2", "mainpll_d6", 1, 2, 0),
39b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D6_D4, "mainpll_d6_d4", "mainpll_d6", 1, 4, 0),
40b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D7, "mainpll_d7", "mainpll", 1, 7, 0),
41b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D7_D2, "mainpll_d7_d2", "mainpll_d7", 1, 2, 0),
42b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D7_D4, "mainpll_d7_d4", "mainpll_d7", 1, 4, 0),
43b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_MAINPLL_D7_D8, "mainpll_d7_d8", "mainpll_d7", 1, 8, 0),
44b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D3, "univpll_d3", "univpll", 1, 3, 0),
45b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D4, "univpll_d4", "univpll", 1, 4, 0),
46b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D4_D2, "univpll_d4_d2", "univpll_d4", 1, 2, 0),
47b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D4_D4, "univpll_d4_d4", "univpll_d4", 1, 4, 0),
48b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D4_D8, "univpll_d4_d8", "univpll_d4", 1, 8, 0),
49b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5, "univpll_d5", "univpll", 1, 5, 0),
50b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5_D2, "univpll_d5_d2", "univpll_d5", 1, 2, 0),
51b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5_D4, "univpll_d5_d4", "univpll_d5", 1, 4, 0),
52b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5_D8, "univpll_d5_d8", "univpll_d5", 1, 8, 0),
53b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D6, "univpll_d6", "univpll", 1, 6, 0),
54b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D6_D2, "univpll_d6_d2", "univpll_d6", 1, 2, 0),
55b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D6_D4, "univpll_d6_d4", "univpll_d6", 1, 4, 0),
56b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D6_D8, "univpll_d6_d8", "univpll_d6", 1, 8, 0),
57b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D6_D16, "univpll_d6_d16", "univpll_d6", 1, 16, 0),
58b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_D7, "univpll_d7", "univpll", 1, 7, 0),
59710573deSChun-Jie Chen 	FACTOR(CLK_TOP_APLL1, "apll1_ck", "apll1", 1, 1),
60710573deSChun-Jie Chen 	FACTOR(CLK_TOP_APLL1_D2, "apll1_d2", "apll1", 1, 2),
61710573deSChun-Jie Chen 	FACTOR(CLK_TOP_APLL1_D4, "apll1_d4", "apll1", 1, 4),
62710573deSChun-Jie Chen 	FACTOR(CLK_TOP_APLL1_D8, "apll1_d8", "apll1", 1, 8),
63710573deSChun-Jie Chen 	FACTOR(CLK_TOP_APLL2, "apll2_ck", "apll2", 1, 1),
64710573deSChun-Jie Chen 	FACTOR(CLK_TOP_APLL2_D2, "apll2_d2", "apll2", 1, 2),
65710573deSChun-Jie Chen 	FACTOR(CLK_TOP_APLL2_D4, "apll2_d4", "apll2", 1, 4),
66710573deSChun-Jie Chen 	FACTOR(CLK_TOP_APLL2_D8, "apll2_d8", "apll2", 1, 8),
67710573deSChun-Jie Chen 	FACTOR(CLK_TOP_MMPLL_D4, "mmpll_d4", "mmpll", 1, 4),
68710573deSChun-Jie Chen 	FACTOR(CLK_TOP_MMPLL_D4_D2, "mmpll_d4_d2", "mmpll_d4", 1, 2),
69710573deSChun-Jie Chen 	FACTOR(CLK_TOP_MMPLL_D5, "mmpll_d5", "mmpll", 1, 5),
70710573deSChun-Jie Chen 	FACTOR(CLK_TOP_MMPLL_D5_D2, "mmpll_d5_d2", "mmpll_d5", 1, 2),
71710573deSChun-Jie Chen 	FACTOR(CLK_TOP_MMPLL_D6, "mmpll_d6", "mmpll", 1, 6),
72710573deSChun-Jie Chen 	FACTOR(CLK_TOP_MMPLL_D6_D2, "mmpll_d6_d2", "mmpll_d6", 1, 2),
73710573deSChun-Jie Chen 	FACTOR(CLK_TOP_MMPLL_D7, "mmpll_d7", "mmpll", 1, 7),
74710573deSChun-Jie Chen 	FACTOR(CLK_TOP_MMPLL_D9, "mmpll_d9", "mmpll", 1, 9),
75710573deSChun-Jie Chen 	FACTOR(CLK_TOP_APUPLL, "apupll_ck", "apupll", 1, 2),
76710573deSChun-Jie Chen 	FACTOR(CLK_TOP_NPUPLL, "npupll_ck", "npupll", 1, 1),
77710573deSChun-Jie Chen 	FACTOR(CLK_TOP_TVDPLL, "tvdpll_ck", "tvdpll", 1, 1),
78710573deSChun-Jie Chen 	FACTOR(CLK_TOP_TVDPLL_D2, "tvdpll_d2", "tvdpll", 1, 2),
79710573deSChun-Jie Chen 	FACTOR(CLK_TOP_TVDPLL_D4, "tvdpll_d4", "tvdpll", 1, 4),
80710573deSChun-Jie Chen 	FACTOR(CLK_TOP_TVDPLL_D8, "tvdpll_d8", "tvdpll", 1, 8),
81710573deSChun-Jie Chen 	FACTOR(CLK_TOP_TVDPLL_D16, "tvdpll_d16", "tvdpll", 1, 16),
82710573deSChun-Jie Chen 	FACTOR(CLK_TOP_MSDCPLL, "msdcpll_ck", "msdcpll", 1, 1),
83710573deSChun-Jie Chen 	FACTOR(CLK_TOP_MSDCPLL_D2, "msdcpll_d2", "msdcpll", 1, 2),
84710573deSChun-Jie Chen 	FACTOR(CLK_TOP_MSDCPLL_D4, "msdcpll_d4", "msdcpll", 1, 4),
85710573deSChun-Jie Chen 	FACTOR(CLK_TOP_OSC_D2, "osc_d2", "ulposc", 1, 2),
86710573deSChun-Jie Chen 	FACTOR(CLK_TOP_OSC_D4, "osc_d4", "ulposc", 1, 4),
87710573deSChun-Jie Chen 	FACTOR(CLK_TOP_OSC_D8, "osc_d8", "ulposc", 1, 8),
88710573deSChun-Jie Chen 	FACTOR(CLK_TOP_OSC_D10, "osc_d10", "ulposc", 1, 10),
89710573deSChun-Jie Chen 	FACTOR(CLK_TOP_OSC_D16, "osc_d16", "ulposc", 1, 16),
90710573deSChun-Jie Chen 	FACTOR(CLK_TOP_OSC_D20, "osc_d20", "ulposc", 1, 20),
913b5bc469SAngeloGioacchino Del Regno 	FACTOR(CLK_TOP_CSW_F26M_D2, "csw_f26m_d2", "clk26m", 1, 2),
92710573deSChun-Jie Chen 	FACTOR(CLK_TOP_ADSPPLL, "adsppll_ck", "adsppll", 1, 1),
93b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M, "univpll_192m", "univpll", 1, 13, 0),
94b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M_D2, "univpll_192m_d2", "univpll_192m", 1, 2, 0),
95b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M_D4, "univpll_192m_d4", "univpll_192m", 1, 4, 0),
96b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M_D8, "univpll_192m_d8", "univpll_192m", 1, 8, 0),
97b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M_D16, "univpll_192m_d16", "univpll_192m", 1, 16, 0),
98b5660328SAngeloGioacchino Del Regno 	FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M_D32, "univpll_192m_d32", "univpll_192m", 1, 32, 0),
99710573deSChun-Jie Chen };
100710573deSChun-Jie Chen 
101710573deSChun-Jie Chen static const char * const axi_parents[] = {
102710573deSChun-Jie Chen 	"clk26m",
103710573deSChun-Jie Chen 	"mainpll_d4_d4",
104710573deSChun-Jie Chen 	"mainpll_d7_d2",
105710573deSChun-Jie Chen 	"mainpll_d4_d2",
106710573deSChun-Jie Chen 	"mainpll_d5_d2",
107710573deSChun-Jie Chen 	"mainpll_d6_d2",
108710573deSChun-Jie Chen 	"osc_d4"
109710573deSChun-Jie Chen };
110710573deSChun-Jie Chen 
111710573deSChun-Jie Chen static const char * const spm_parents[] = {
112710573deSChun-Jie Chen 	"clk26m",
113710573deSChun-Jie Chen 	"osc_d10",
114710573deSChun-Jie Chen 	"mainpll_d7_d4",
115710573deSChun-Jie Chen 	"clk32k"
116710573deSChun-Jie Chen };
117710573deSChun-Jie Chen 
118710573deSChun-Jie Chen static const char * const scp_parents[] = {
119710573deSChun-Jie Chen 	"clk26m",
120710573deSChun-Jie Chen 	"univpll_d5",
121710573deSChun-Jie Chen 	"mainpll_d6_d2",
122710573deSChun-Jie Chen 	"mainpll_d6",
123710573deSChun-Jie Chen 	"univpll_d6",
124710573deSChun-Jie Chen 	"mainpll_d4_d2",
125710573deSChun-Jie Chen 	"mainpll_d5_d2",
126710573deSChun-Jie Chen 	"univpll_d4_d2"
127710573deSChun-Jie Chen };
128710573deSChun-Jie Chen 
129710573deSChun-Jie Chen static const char * const bus_aximem_parents[] = {
130710573deSChun-Jie Chen 	"clk26m",
131710573deSChun-Jie Chen 	"mainpll_d7_d2",
132710573deSChun-Jie Chen 	"mainpll_d4_d2",
133710573deSChun-Jie Chen 	"mainpll_d5_d2",
134710573deSChun-Jie Chen 	"mainpll_d6"
135710573deSChun-Jie Chen };
136710573deSChun-Jie Chen 
137710573deSChun-Jie Chen static const char * const disp_parents[] = {
138710573deSChun-Jie Chen 	"clk26m",
139710573deSChun-Jie Chen 	"univpll_d6_d2",
140710573deSChun-Jie Chen 	"mainpll_d5_d2",
141710573deSChun-Jie Chen 	"mmpll_d6_d2",
142710573deSChun-Jie Chen 	"univpll_d5_d2",
143710573deSChun-Jie Chen 	"univpll_d4_d2",
144710573deSChun-Jie Chen 	"mmpll_d7",
145710573deSChun-Jie Chen 	"univpll_d6",
146710573deSChun-Jie Chen 	"mainpll_d4",
147710573deSChun-Jie Chen 	"mmpll_d5_d2"
148710573deSChun-Jie Chen };
149710573deSChun-Jie Chen 
150710573deSChun-Jie Chen static const char * const mdp_parents[] = {
151710573deSChun-Jie Chen 	"clk26m",
152710573deSChun-Jie Chen 	"mainpll_d5_d2",
153710573deSChun-Jie Chen 	"mmpll_d6_d2",
154710573deSChun-Jie Chen 	"mainpll_d4_d2",
155710573deSChun-Jie Chen 	"mmpll_d4_d2",
156710573deSChun-Jie Chen 	"mainpll_d6",
157710573deSChun-Jie Chen 	"univpll_d6",
158710573deSChun-Jie Chen 	"mainpll_d4",
159710573deSChun-Jie Chen 	"tvdpll_ck",
160710573deSChun-Jie Chen 	"univpll_d4",
161710573deSChun-Jie Chen 	"mmpll_d5_d2"
162710573deSChun-Jie Chen };
163710573deSChun-Jie Chen 
16499f3a5e8SChen-Yu Tsai static const char * const img_parents[] = {
165710573deSChun-Jie Chen 	"clk26m",
166710573deSChun-Jie Chen 	"univpll_d4",
167710573deSChun-Jie Chen 	"tvdpll_ck",
168710573deSChun-Jie Chen 	"mainpll_d4",
169710573deSChun-Jie Chen 	"univpll_d5",
170710573deSChun-Jie Chen 	"mmpll_d6",
171710573deSChun-Jie Chen 	"univpll_d6",
172710573deSChun-Jie Chen 	"mainpll_d6",
173710573deSChun-Jie Chen 	"mmpll_d4_d2",
174710573deSChun-Jie Chen 	"mainpll_d4_d2",
175710573deSChun-Jie Chen 	"mmpll_d6_d2",
176710573deSChun-Jie Chen 	"mmpll_d5_d2"
177710573deSChun-Jie Chen };
178710573deSChun-Jie Chen 
179710573deSChun-Jie Chen static const char * const ipe_parents[] = {
180710573deSChun-Jie Chen 	"clk26m",
181710573deSChun-Jie Chen 	"mainpll_d4",
182710573deSChun-Jie Chen 	"mmpll_d6",
183710573deSChun-Jie Chen 	"univpll_d6",
184710573deSChun-Jie Chen 	"mainpll_d6",
185710573deSChun-Jie Chen 	"univpll_d4_d2",
186710573deSChun-Jie Chen 	"mainpll_d4_d2",
187710573deSChun-Jie Chen 	"mmpll_d6_d2",
188710573deSChun-Jie Chen 	"mmpll_d5_d2"
189710573deSChun-Jie Chen };
190710573deSChun-Jie Chen 
191710573deSChun-Jie Chen static const char * const dpe_parents[] = {
192710573deSChun-Jie Chen 	"clk26m",
193710573deSChun-Jie Chen 	"mainpll_d4",
194710573deSChun-Jie Chen 	"mmpll_d6",
195710573deSChun-Jie Chen 	"univpll_d6",
196710573deSChun-Jie Chen 	"mainpll_d6",
197710573deSChun-Jie Chen 	"univpll_d4_d2",
198710573deSChun-Jie Chen 	"univpll_d5_d2",
199710573deSChun-Jie Chen 	"mmpll_d6_d2"
200710573deSChun-Jie Chen };
201710573deSChun-Jie Chen 
202710573deSChun-Jie Chen static const char * const cam_parents[] = {
203710573deSChun-Jie Chen 	"clk26m",
204710573deSChun-Jie Chen 	"mainpll_d4",
205710573deSChun-Jie Chen 	"mmpll_d6",
206710573deSChun-Jie Chen 	"univpll_d4",
207710573deSChun-Jie Chen 	"univpll_d5",
208710573deSChun-Jie Chen 	"univpll_d6",
209710573deSChun-Jie Chen 	"mmpll_d7",
210710573deSChun-Jie Chen 	"univpll_d4_d2",
211710573deSChun-Jie Chen 	"mainpll_d4_d2",
212710573deSChun-Jie Chen 	"univpll_d6_d2"
213710573deSChun-Jie Chen };
214710573deSChun-Jie Chen 
215710573deSChun-Jie Chen static const char * const ccu_parents[] = {
216710573deSChun-Jie Chen 	"clk26m",
217710573deSChun-Jie Chen 	"mainpll_d4",
218710573deSChun-Jie Chen 	"mmpll_d6",
219710573deSChun-Jie Chen 	"mainpll_d6",
220710573deSChun-Jie Chen 	"mmpll_d7",
221710573deSChun-Jie Chen 	"univpll_d4_d2",
222710573deSChun-Jie Chen 	"mmpll_d6_d2",
223710573deSChun-Jie Chen 	"mmpll_d5_d2",
224710573deSChun-Jie Chen 	"univpll_d5",
225710573deSChun-Jie Chen 	"univpll_d6_d2"
226710573deSChun-Jie Chen };
227710573deSChun-Jie Chen 
228710573deSChun-Jie Chen static const char * const dsp7_parents[] = {
229710573deSChun-Jie Chen 	"clk26m",
230710573deSChun-Jie Chen 	"mainpll_d4_d2",
231710573deSChun-Jie Chen 	"mainpll_d6",
232710573deSChun-Jie Chen 	"mmpll_d6",
233710573deSChun-Jie Chen 	"univpll_d5",
234710573deSChun-Jie Chen 	"mmpll_d5",
235710573deSChun-Jie Chen 	"univpll_d4",
236710573deSChun-Jie Chen 	"mmpll_d4"
237710573deSChun-Jie Chen };
238710573deSChun-Jie Chen 
239710573deSChun-Jie Chen static const char * const mfg_ref_parents[] = {
240710573deSChun-Jie Chen 	"clk26m",
241710573deSChun-Jie Chen 	"clk26m",
242710573deSChun-Jie Chen 	"univpll_d6",
243710573deSChun-Jie Chen 	"mainpll_d5_d2"
244710573deSChun-Jie Chen };
245710573deSChun-Jie Chen 
246710573deSChun-Jie Chen static const char * const mfg_pll_parents[] = {
247710573deSChun-Jie Chen 	"mfg_ref_sel",
248710573deSChun-Jie Chen 	"mfgpll"
249710573deSChun-Jie Chen };
250710573deSChun-Jie Chen 
251710573deSChun-Jie Chen static const char * const camtg_parents[] = {
252710573deSChun-Jie Chen 	"clk26m",
253710573deSChun-Jie Chen 	"univpll_192m_d8",
254710573deSChun-Jie Chen 	"univpll_d6_d8",
255710573deSChun-Jie Chen 	"univpll_192m_d4",
256710573deSChun-Jie Chen 	"univpll_d6_d16",
257710573deSChun-Jie Chen 	"csw_f26m_d2",
258710573deSChun-Jie Chen 	"univpll_192m_d16",
259710573deSChun-Jie Chen 	"univpll_192m_d32"
260710573deSChun-Jie Chen };
261710573deSChun-Jie Chen 
262710573deSChun-Jie Chen static const char * const uart_parents[] = {
263710573deSChun-Jie Chen 	"clk26m",
264710573deSChun-Jie Chen 	"univpll_d6_d8"
265710573deSChun-Jie Chen };
266710573deSChun-Jie Chen 
267710573deSChun-Jie Chen static const char * const spi_parents[] = {
268710573deSChun-Jie Chen 	"clk26m",
269710573deSChun-Jie Chen 	"mainpll_d5_d4",
270710573deSChun-Jie Chen 	"mainpll_d6_d4",
271710573deSChun-Jie Chen 	"msdcpll_d4"
272710573deSChun-Jie Chen };
273710573deSChun-Jie Chen 
274710573deSChun-Jie Chen static const char * const msdc50_0_h_parents[] = {
275710573deSChun-Jie Chen 	"clk26m",
276710573deSChun-Jie Chen 	"mainpll_d4_d2",
277710573deSChun-Jie Chen 	"mainpll_d6_d2"
278710573deSChun-Jie Chen };
279710573deSChun-Jie Chen 
280710573deSChun-Jie Chen static const char * const msdc50_0_parents[] = {
281710573deSChun-Jie Chen 	"clk26m",
282710573deSChun-Jie Chen 	"msdcpll_ck",
283710573deSChun-Jie Chen 	"msdcpll_d2",
284710573deSChun-Jie Chen 	"univpll_d4_d4",
285710573deSChun-Jie Chen 	"mainpll_d6_d2",
286710573deSChun-Jie Chen 	"univpll_d4_d2"
287710573deSChun-Jie Chen };
288710573deSChun-Jie Chen 
28999f3a5e8SChen-Yu Tsai static const char * const msdc30_parents[] = {
290710573deSChun-Jie Chen 	"clk26m",
291710573deSChun-Jie Chen 	"univpll_d6_d2",
292710573deSChun-Jie Chen 	"mainpll_d6_d2",
293710573deSChun-Jie Chen 	"mainpll_d7_d2",
294710573deSChun-Jie Chen 	"msdcpll_d2"
295710573deSChun-Jie Chen };
296710573deSChun-Jie Chen 
297710573deSChun-Jie Chen static const char * const audio_parents[] = {
298710573deSChun-Jie Chen 	"clk26m",
299710573deSChun-Jie Chen 	"mainpll_d5_d8",
300710573deSChun-Jie Chen 	"mainpll_d7_d8",
301710573deSChun-Jie Chen 	"mainpll_d4_d16"
302710573deSChun-Jie Chen };
303710573deSChun-Jie Chen 
304710573deSChun-Jie Chen static const char * const aud_intbus_parents[] = {
305710573deSChun-Jie Chen 	"clk26m",
306710573deSChun-Jie Chen 	"mainpll_d4_d4",
307710573deSChun-Jie Chen 	"mainpll_d7_d4"
308710573deSChun-Jie Chen };
309710573deSChun-Jie Chen 
310710573deSChun-Jie Chen static const char * const pwrap_ulposc_parents[] = {
311710573deSChun-Jie Chen 	"osc_d10",
312710573deSChun-Jie Chen 	"clk26m",
313710573deSChun-Jie Chen 	"osc_d4",
314710573deSChun-Jie Chen 	"osc_d8",
315710573deSChun-Jie Chen 	"osc_d16"
316710573deSChun-Jie Chen };
317710573deSChun-Jie Chen 
318710573deSChun-Jie Chen static const char * const atb_parents[] = {
319710573deSChun-Jie Chen 	"clk26m",
320710573deSChun-Jie Chen 	"mainpll_d4_d2",
321710573deSChun-Jie Chen 	"mainpll_d5_d2"
322710573deSChun-Jie Chen };
323710573deSChun-Jie Chen 
324710573deSChun-Jie Chen static const char * const dpi_parents[] = {
325710573deSChun-Jie Chen 	"clk26m",
326710573deSChun-Jie Chen 	"tvdpll_d2",
327710573deSChun-Jie Chen 	"tvdpll_d4",
328710573deSChun-Jie Chen 	"tvdpll_d8",
329710573deSChun-Jie Chen 	"tvdpll_d16"
330710573deSChun-Jie Chen };
331710573deSChun-Jie Chen 
332710573deSChun-Jie Chen static const char * const scam_parents[] = {
333710573deSChun-Jie Chen 	"clk26m",
334710573deSChun-Jie Chen 	"mainpll_d5_d4"
335710573deSChun-Jie Chen };
336710573deSChun-Jie Chen 
337710573deSChun-Jie Chen static const char * const disp_pwm_parents[] = {
338710573deSChun-Jie Chen 	"clk26m",
339710573deSChun-Jie Chen 	"univpll_d6_d4",
340710573deSChun-Jie Chen 	"osc_d2",
341710573deSChun-Jie Chen 	"osc_d4",
342710573deSChun-Jie Chen 	"osc_d16"
343710573deSChun-Jie Chen };
344710573deSChun-Jie Chen 
345710573deSChun-Jie Chen static const char * const usb_top_parents[] = {
346710573deSChun-Jie Chen 	"clk26m",
347710573deSChun-Jie Chen 	"univpll_d5_d4",
348710573deSChun-Jie Chen 	"univpll_d6_d4",
349710573deSChun-Jie Chen 	"univpll_d5_d2"
350710573deSChun-Jie Chen };
351710573deSChun-Jie Chen 
352710573deSChun-Jie Chen static const char * const ssusb_xhci_parents[] = {
353710573deSChun-Jie Chen 	"clk26m",
354710573deSChun-Jie Chen 	"univpll_d5_d4",
355710573deSChun-Jie Chen 	"univpll_d6_d4",
356710573deSChun-Jie Chen 	"univpll_d5_d2"
357710573deSChun-Jie Chen };
358710573deSChun-Jie Chen 
359710573deSChun-Jie Chen static const char * const i2c_parents[] = {
360710573deSChun-Jie Chen 	"clk26m",
361710573deSChun-Jie Chen 	"mainpll_d4_d8",
362710573deSChun-Jie Chen 	"univpll_d5_d4"
363710573deSChun-Jie Chen };
364710573deSChun-Jie Chen 
365710573deSChun-Jie Chen static const char * const seninf_parents[] = {
366710573deSChun-Jie Chen 	"clk26m",
367710573deSChun-Jie Chen 	"univpll_d4_d4",
368710573deSChun-Jie Chen 	"univpll_d6_d2",
369710573deSChun-Jie Chen 	"univpll_d4_d2",
370710573deSChun-Jie Chen 	"univpll_d7",
371710573deSChun-Jie Chen 	"univpll_d6",
372710573deSChun-Jie Chen 	"mmpll_d6",
373710573deSChun-Jie Chen 	"univpll_d5"
374710573deSChun-Jie Chen };
375710573deSChun-Jie Chen 
376710573deSChun-Jie Chen static const char * const tl_parents[] = {
377710573deSChun-Jie Chen 	"clk26m",
378710573deSChun-Jie Chen 	"univpll_192m_d2",
379710573deSChun-Jie Chen 	"mainpll_d6_d4"
380710573deSChun-Jie Chen };
381710573deSChun-Jie Chen 
382710573deSChun-Jie Chen static const char * const dxcc_parents[] = {
383710573deSChun-Jie Chen 	"clk26m",
384710573deSChun-Jie Chen 	"mainpll_d4_d2",
385710573deSChun-Jie Chen 	"mainpll_d4_d4",
386710573deSChun-Jie Chen 	"mainpll_d4_d8"
387710573deSChun-Jie Chen };
388710573deSChun-Jie Chen 
389710573deSChun-Jie Chen static const char * const aud_engen1_parents[] = {
390710573deSChun-Jie Chen 	"clk26m",
391710573deSChun-Jie Chen 	"apll1_d2",
392710573deSChun-Jie Chen 	"apll1_d4",
393710573deSChun-Jie Chen 	"apll1_d8"
394710573deSChun-Jie Chen };
395710573deSChun-Jie Chen 
396710573deSChun-Jie Chen static const char * const aud_engen2_parents[] = {
397710573deSChun-Jie Chen 	"clk26m",
398710573deSChun-Jie Chen 	"apll2_d2",
399710573deSChun-Jie Chen 	"apll2_d4",
400710573deSChun-Jie Chen 	"apll2_d8"
401710573deSChun-Jie Chen };
402710573deSChun-Jie Chen 
403710573deSChun-Jie Chen static const char * const aes_ufsfde_parents[] = {
404710573deSChun-Jie Chen 	"clk26m",
405710573deSChun-Jie Chen 	"mainpll_d4",
406710573deSChun-Jie Chen 	"mainpll_d4_d2",
407710573deSChun-Jie Chen 	"mainpll_d6",
408710573deSChun-Jie Chen 	"mainpll_d4_d4",
409710573deSChun-Jie Chen 	"univpll_d4_d2",
410710573deSChun-Jie Chen 	"univpll_d6"
411710573deSChun-Jie Chen };
412710573deSChun-Jie Chen 
413710573deSChun-Jie Chen static const char * const ufs_parents[] = {
414710573deSChun-Jie Chen 	"clk26m",
415710573deSChun-Jie Chen 	"mainpll_d4_d4",
416710573deSChun-Jie Chen 	"mainpll_d4_d8",
417710573deSChun-Jie Chen 	"univpll_d4_d4",
418710573deSChun-Jie Chen 	"mainpll_d6_d2",
419710573deSChun-Jie Chen 	"mainpll_d5_d2",
420710573deSChun-Jie Chen 	"msdcpll_d2"
421710573deSChun-Jie Chen };
422710573deSChun-Jie Chen 
423710573deSChun-Jie Chen static const char * const aud_1_parents[] = {
424710573deSChun-Jie Chen 	"clk26m",
425710573deSChun-Jie Chen 	"apll1_ck"
426710573deSChun-Jie Chen };
427710573deSChun-Jie Chen 
428710573deSChun-Jie Chen static const char * const aud_2_parents[] = {
429710573deSChun-Jie Chen 	"clk26m",
430710573deSChun-Jie Chen 	"apll2_ck"
431710573deSChun-Jie Chen };
432710573deSChun-Jie Chen 
433710573deSChun-Jie Chen static const char * const adsp_parents[] = {
434710573deSChun-Jie Chen 	"clk26m",
435710573deSChun-Jie Chen 	"mainpll_d6",
436710573deSChun-Jie Chen 	"mainpll_d5_d2",
437710573deSChun-Jie Chen 	"univpll_d4_d4",
438710573deSChun-Jie Chen 	"univpll_d4",
439710573deSChun-Jie Chen 	"univpll_d6",
440710573deSChun-Jie Chen 	"ulposc",
441710573deSChun-Jie Chen 	"adsppll_ck"
442710573deSChun-Jie Chen };
443710573deSChun-Jie Chen 
444710573deSChun-Jie Chen static const char * const dpmaif_main_parents[] = {
445710573deSChun-Jie Chen 	"clk26m",
446710573deSChun-Jie Chen 	"univpll_d4_d4",
447710573deSChun-Jie Chen 	"mainpll_d6",
448710573deSChun-Jie Chen 	"mainpll_d4_d2",
449710573deSChun-Jie Chen 	"univpll_d4_d2"
450710573deSChun-Jie Chen };
451710573deSChun-Jie Chen 
452710573deSChun-Jie Chen static const char * const venc_parents[] = {
453710573deSChun-Jie Chen 	"clk26m",
454710573deSChun-Jie Chen 	"mmpll_d7",
455710573deSChun-Jie Chen 	"mainpll_d6",
456710573deSChun-Jie Chen 	"univpll_d4_d2",
457710573deSChun-Jie Chen 	"mainpll_d4_d2",
458710573deSChun-Jie Chen 	"univpll_d6",
459710573deSChun-Jie Chen 	"mmpll_d6",
460710573deSChun-Jie Chen 	"mainpll_d5_d2",
461710573deSChun-Jie Chen 	"mainpll_d6_d2",
462710573deSChun-Jie Chen 	"mmpll_d9",
463710573deSChun-Jie Chen 	"univpll_d4_d4",
464710573deSChun-Jie Chen 	"mainpll_d4",
465710573deSChun-Jie Chen 	"univpll_d4",
466710573deSChun-Jie Chen 	"univpll_d5",
467710573deSChun-Jie Chen 	"univpll_d5_d2",
468710573deSChun-Jie Chen 	"mainpll_d5"
469710573deSChun-Jie Chen };
470710573deSChun-Jie Chen 
471710573deSChun-Jie Chen static const char * const vdec_parents[] = {
472710573deSChun-Jie Chen 	"clk26m",
473710573deSChun-Jie Chen 	"univpll_192m_d2",
474710573deSChun-Jie Chen 	"univpll_d5_d4",
475710573deSChun-Jie Chen 	"mainpll_d5",
476710573deSChun-Jie Chen 	"mainpll_d5_d2",
477710573deSChun-Jie Chen 	"mmpll_d6_d2",
478710573deSChun-Jie Chen 	"univpll_d5_d2",
479710573deSChun-Jie Chen 	"mainpll_d4_d2",
480710573deSChun-Jie Chen 	"univpll_d4_d2",
481710573deSChun-Jie Chen 	"univpll_d7",
482710573deSChun-Jie Chen 	"mmpll_d7",
483710573deSChun-Jie Chen 	"mmpll_d6",
484710573deSChun-Jie Chen 	"univpll_d5",
485710573deSChun-Jie Chen 	"mainpll_d4",
486710573deSChun-Jie Chen 	"univpll_d4",
487710573deSChun-Jie Chen 	"univpll_d6"
488710573deSChun-Jie Chen };
489710573deSChun-Jie Chen 
490710573deSChun-Jie Chen static const char * const camtm_parents[] = {
491710573deSChun-Jie Chen 	"clk26m",
492710573deSChun-Jie Chen 	"univpll_d7",
493710573deSChun-Jie Chen 	"univpll_d6_d2",
494710573deSChun-Jie Chen 	"univpll_d4_d2"
495710573deSChun-Jie Chen };
496710573deSChun-Jie Chen 
497710573deSChun-Jie Chen static const char * const pwm_parents[] = {
498710573deSChun-Jie Chen 	"clk26m",
499710573deSChun-Jie Chen 	"univpll_d4_d8"
500710573deSChun-Jie Chen };
501710573deSChun-Jie Chen 
502710573deSChun-Jie Chen static const char * const audio_h_parents[] = {
503710573deSChun-Jie Chen 	"clk26m",
504710573deSChun-Jie Chen 	"univpll_d7",
505710573deSChun-Jie Chen 	"apll1_ck",
506710573deSChun-Jie Chen 	"apll2_ck"
507710573deSChun-Jie Chen };
508710573deSChun-Jie Chen 
509710573deSChun-Jie Chen static const char * const spmi_mst_parents[] = {
510710573deSChun-Jie Chen 	"clk26m",
511710573deSChun-Jie Chen 	"csw_f26m_d2",
512710573deSChun-Jie Chen 	"osc_d8",
513710573deSChun-Jie Chen 	"osc_d10",
514710573deSChun-Jie Chen 	"osc_d16",
515710573deSChun-Jie Chen 	"osc_d20",
516710573deSChun-Jie Chen 	"clk32k"
517710573deSChun-Jie Chen };
518710573deSChun-Jie Chen 
519710573deSChun-Jie Chen static const char * const aes_msdcfde_parents[] = {
520710573deSChun-Jie Chen 	"clk26m",
521710573deSChun-Jie Chen 	"mainpll_d4_d2",
522710573deSChun-Jie Chen 	"mainpll_d6",
523710573deSChun-Jie Chen 	"mainpll_d4_d4",
524710573deSChun-Jie Chen 	"univpll_d4_d2",
525710573deSChun-Jie Chen 	"univpll_d6"
526710573deSChun-Jie Chen };
527710573deSChun-Jie Chen 
528710573deSChun-Jie Chen static const char * const sflash_parents[] = {
529710573deSChun-Jie Chen 	"clk26m",
530710573deSChun-Jie Chen 	"mainpll_d7_d8",
531710573deSChun-Jie Chen 	"univpll_d6_d8",
532710573deSChun-Jie Chen 	"univpll_d5_d8"
533710573deSChun-Jie Chen };
534710573deSChun-Jie Chen 
53599f3a5e8SChen-Yu Tsai static const char * const apll_i2s_m_parents[] = {
536710573deSChun-Jie Chen 	"aud_1_sel",
537710573deSChun-Jie Chen 	"aud_2_sel"
538710573deSChun-Jie Chen };
539710573deSChun-Jie Chen 
540710573deSChun-Jie Chen /*
541710573deSChun-Jie Chen  * CRITICAL CLOCK:
542710573deSChun-Jie Chen  * axi_sel is the main bus clock of whole SOC.
543710573deSChun-Jie Chen  * spm_sel is the clock of the always-on co-processor.
544710573deSChun-Jie Chen  * bus_aximem_sel is clock of the bus that access emi.
545710573deSChun-Jie Chen  */
546710573deSChun-Jie Chen static const struct mtk_mux top_mtk_muxes[] = {
547710573deSChun-Jie Chen 	/* CLK_CFG_0 */
548710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_AXI_SEL, "axi_sel",
549710573deSChun-Jie Chen 				   axi_parents, 0x010, 0x014, 0x018, 0, 3, 7, 0x004, 0,
5501775790eSAngeloGioacchino Del Regno 				   CLK_IS_CRITICAL | CLK_SET_RATE_PARENT),
551710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SPM_SEL, "spm_sel",
552710573deSChun-Jie Chen 				   spm_parents, 0x010, 0x014, 0x018, 8, 2, 15, 0x004, 1,
5531775790eSAngeloGioacchino Del Regno 				   CLK_IS_CRITICAL | CLK_SET_RATE_PARENT),
554710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_SCP_SEL, "scp_sel",
555710573deSChun-Jie Chen 			     scp_parents, 0x010, 0x014, 0x018, 16, 3, 23, 0x004, 2),
556710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_BUS_AXIMEM_SEL, "bus_aximem_sel",
557710573deSChun-Jie Chen 				   bus_aximem_parents, 0x010, 0x014, 0x018, 24, 3, 31, 0x004, 3,
5581775790eSAngeloGioacchino Del Regno 				   CLK_IS_CRITICAL | CLK_SET_RATE_PARENT),
559710573deSChun-Jie Chen 	/* CLK_CFG_1 */
560710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_DISP_SEL, "disp_sel",
561710573deSChun-Jie Chen 			     disp_parents, 0x020, 0x024, 0x028, 0, 4, 7, 0x004, 4),
562710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_MDP_SEL, "mdp_sel",
563710573deSChun-Jie Chen 			     mdp_parents, 0x020, 0x024, 0x028, 8, 4, 15, 0x004, 5),
564710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_IMG1_SEL, "img1_sel",
56599f3a5e8SChen-Yu Tsai 			     img_parents, 0x020, 0x024, 0x028, 16, 4, 23, 0x004, 6),
566710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_IMG2_SEL, "img2_sel",
56799f3a5e8SChen-Yu Tsai 			     img_parents, 0x020, 0x024, 0x028, 24, 4, 31, 0x004, 7),
568710573deSChun-Jie Chen 	/* CLK_CFG_2 */
569710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_IPE_SEL, "ipe_sel",
570710573deSChun-Jie Chen 			     ipe_parents, 0x030, 0x034, 0x038, 0, 4, 7, 0x004, 8),
571710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_DPE_SEL, "dpe_sel",
572710573deSChun-Jie Chen 			     dpe_parents, 0x030, 0x034, 0x038, 8, 3, 15, 0x004, 9),
573710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_CAM_SEL, "cam_sel",
574710573deSChun-Jie Chen 			     cam_parents, 0x030, 0x034, 0x038, 16, 4, 23, 0x004, 10),
575710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_CCU_SEL, "ccu_sel",
576710573deSChun-Jie Chen 			     ccu_parents, 0x030, 0x034, 0x038, 24, 4, 31, 0x004, 11),
577710573deSChun-Jie Chen 	/* CLK_CFG_4 */
578710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_DSP7_SEL, "dsp7_sel",
579710573deSChun-Jie Chen 			     dsp7_parents, 0x050, 0x054, 0x058, 0, 3, 7, 0x004, 16),
580710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_MFG_REF_SEL, "mfg_ref_sel",
581710573deSChun-Jie Chen 			     mfg_ref_parents, 0x050, 0x054, 0x058, 16, 2, 23, 0x004, 18),
582710573deSChun-Jie Chen 	MUX_CLR_SET_UPD(CLK_TOP_MFG_PLL_SEL, "mfg_pll_sel",
583710573deSChun-Jie Chen 			mfg_pll_parents, 0x050, 0x054, 0x058, 18, 1, -1, -1),
584710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG_SEL, "camtg_sel",
585710573deSChun-Jie Chen 			     camtg_parents, 0x050, 0x054, 0x058, 24, 3, 31, 0x004, 19),
586710573deSChun-Jie Chen 	/* CLK_CFG_5 */
587710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG2_SEL, "camtg2_sel",
58899f3a5e8SChen-Yu Tsai 			     camtg_parents, 0x060, 0x064, 0x068, 0, 3, 7, 0x004, 20),
589710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG3_SEL, "camtg3_sel",
59099f3a5e8SChen-Yu Tsai 			     camtg_parents, 0x060, 0x064, 0x068, 8, 3, 15, 0x004, 21),
591710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG4_SEL, "camtg4_sel",
59299f3a5e8SChen-Yu Tsai 			     camtg_parents, 0x060, 0x064, 0x068, 16, 3, 23, 0x004, 22),
593710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG5_SEL, "camtg5_sel",
59499f3a5e8SChen-Yu Tsai 			     camtg_parents, 0x060, 0x064, 0x068, 24, 3, 31, 0x004, 23),
595710573deSChun-Jie Chen 	/* CLK_CFG_6 */
596710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG6_SEL, "camtg6_sel",
59799f3a5e8SChen-Yu Tsai 			     camtg_parents, 0x070, 0x074, 0x078, 0, 3, 7, 0x004, 24),
598710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_UART_SEL, "uart_sel",
599710573deSChun-Jie Chen 			     uart_parents, 0x070, 0x074, 0x078, 8, 1, 15, 0x004, 25),
600710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_SPI_SEL, "spi_sel",
601710573deSChun-Jie Chen 			     spi_parents, 0x070, 0x074, 0x078, 16, 2, 23, 0x004, 26),
602f235f6aeSAngeloGioacchino Del Regno 	MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_H_SEL, "msdc50_0_h_sel",
603f235f6aeSAngeloGioacchino Del Regno 				   msdc50_0_h_parents, 0x070, 0x074, 0x078, 24, 2,
604f235f6aeSAngeloGioacchino Del Regno 				   31, 0x004, 27, 0),
605710573deSChun-Jie Chen 	/* CLK_CFG_7 */
606f235f6aeSAngeloGioacchino Del Regno 	MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel",
607f235f6aeSAngeloGioacchino Del Regno 				   msdc50_0_parents, 0x080, 0x084, 0x088, 0, 3, 7, 0x004, 28, 0),
608f235f6aeSAngeloGioacchino Del Regno 	MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel",
609f235f6aeSAngeloGioacchino Del Regno 				   msdc30_parents, 0x080, 0x084, 0x088, 8, 3, 15, 0x004, 29, 0),
610f235f6aeSAngeloGioacchino Del Regno 	MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_2_SEL, "msdc30_2_sel",
611f235f6aeSAngeloGioacchino Del Regno 				   msdc30_parents, 0x080, 0x084, 0x088, 16, 3, 23, 0x004, 30, 0),
612710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_AUDIO_SEL, "audio_sel",
613710573deSChun-Jie Chen 			     audio_parents, 0x080, 0x084, 0x088, 24, 2, 31, 0x008, 0),
614710573deSChun-Jie Chen 	/* CLK_CFG_8 */
615710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_INTBUS_SEL, "aud_intbus_sel",
616710573deSChun-Jie Chen 			     aud_intbus_parents, 0x090, 0x094, 0x098, 0, 2, 7, 0x008, 1),
617710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_PWRAP_ULPOSC_SEL, "pwrap_ulposc_sel",
618710573deSChun-Jie Chen 			     pwrap_ulposc_parents, 0x090, 0x094, 0x098, 8, 3, 15, 0x008, 2),
619710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_ATB_SEL, "atb_sel",
620710573deSChun-Jie Chen 			     atb_parents, 0x090, 0x094, 0x098, 16, 2, 23, 0x008, 3),
621710573deSChun-Jie Chen 	/* CLK_CFG_9 */
622710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_DPI_SEL, "dpi_sel",
623710573deSChun-Jie Chen 			     dpi_parents, 0x0a0, 0x0a4, 0x0a8, 0, 3, 7, 0x008, 5),
624710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_SCAM_SEL, "scam_sel",
625710573deSChun-Jie Chen 			     scam_parents, 0x0a0, 0x0a4, 0x0a8, 8, 1, 15, 0x008, 6),
626710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_DISP_PWM_SEL, "disp_pwm_sel",
627710573deSChun-Jie Chen 			     disp_pwm_parents, 0x0a0, 0x0a4, 0x0a8, 16, 3, 23, 0x008, 7),
628710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_TOP_SEL, "usb_top_sel",
629710573deSChun-Jie Chen 			     usb_top_parents, 0x0a0, 0x0a4, 0x0a8, 24, 2, 31, 0x008, 8),
630710573deSChun-Jie Chen 	/* CLK_CFG_10 */
631710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_SSUSB_XHCI_SEL, "ssusb_xhci_sel",
632710573deSChun-Jie Chen 			     ssusb_xhci_parents, 0x0b0, 0x0b4, 0x0b8, 0, 2, 7, 0x008, 9),
633710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_I2C_SEL, "i2c_sel",
634710573deSChun-Jie Chen 			     i2c_parents, 0x0b0, 0x0b4, 0x0b8, 8, 2, 15, 0x008, 10),
635710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_SENINF_SEL, "seninf_sel",
636710573deSChun-Jie Chen 			     seninf_parents, 0x0b0, 0x0b4, 0x0b8, 16, 3, 23, 0x008, 11),
637710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_SENINF1_SEL, "seninf1_sel",
63899f3a5e8SChen-Yu Tsai 			     seninf_parents, 0x0b0, 0x0b4, 0x0b8, 24, 3, 31, 0x008, 12),
639710573deSChun-Jie Chen 	/* CLK_CFG_11 */
640710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_SENINF2_SEL, "seninf2_sel",
64199f3a5e8SChen-Yu Tsai 			     seninf_parents, 0x0c0, 0x0c4, 0x0c8, 0, 3, 7, 0x008, 13),
642710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_SENINF3_SEL, "seninf3_sel",
64399f3a5e8SChen-Yu Tsai 			     seninf_parents, 0x0c0, 0x0c4, 0x0c8, 8, 3, 15, 0x008, 14),
644710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_TL_SEL, "tl_sel",
645710573deSChun-Jie Chen 			     tl_parents, 0x0c0, 0x0c4, 0x0c8, 16, 2, 23, 0x008, 15),
646710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_DXCC_SEL, "dxcc_sel",
647710573deSChun-Jie Chen 			     dxcc_parents, 0x0c0, 0x0c4, 0x0c8, 24, 2, 31, 0x008, 16),
648710573deSChun-Jie Chen 	/* CLK_CFG_12 */
649710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_ENGEN1_SEL, "aud_engen1_sel",
650710573deSChun-Jie Chen 			     aud_engen1_parents, 0x0d0, 0x0d4, 0x0d8, 0, 2, 7, 0x008, 17),
651710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_ENGEN2_SEL, "aud_engen2_sel",
652710573deSChun-Jie Chen 			     aud_engen2_parents, 0x0d0, 0x0d4, 0x0d8, 8, 2, 15, 0x008, 18),
653710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_AES_UFSFDE_SEL, "aes_ufsfde_sel",
654710573deSChun-Jie Chen 			     aes_ufsfde_parents, 0x0d0, 0x0d4, 0x0d8, 16, 3, 23, 0x008, 19),
655710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_UFS_SEL, "ufs_sel",
656710573deSChun-Jie Chen 			     ufs_parents, 0x0d0, 0x0d4, 0x0d8, 24, 3, 31, 0x008, 20),
657710573deSChun-Jie Chen 	/* CLK_CFG_13 */
658710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_1_SEL, "aud_1_sel",
659710573deSChun-Jie Chen 			     aud_1_parents, 0x0e0, 0x0e4, 0x0e8, 0, 1, 7, 0x008, 21),
660710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_2_SEL, "aud_2_sel",
661710573deSChun-Jie Chen 			     aud_2_parents, 0x0e0, 0x0e4, 0x0e8, 8, 1, 15, 0x008, 22),
662710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_ADSP_SEL, "adsp_sel",
663710573deSChun-Jie Chen 			     adsp_parents, 0x0e0, 0x0e4, 0x0e8, 16, 3, 23, 0x008, 23),
664710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_DPMAIF_MAIN_SEL, "dpmaif_main_sel",
665710573deSChun-Jie Chen 			     dpmaif_main_parents, 0x0e0, 0x0e4, 0x0e8, 24, 3, 31, 0x008, 24),
666710573deSChun-Jie Chen 	/* CLK_CFG_14 */
667710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_VENC_SEL, "venc_sel",
668710573deSChun-Jie Chen 			     venc_parents, 0x0f0, 0x0f4, 0x0f8, 0, 4, 7, 0x008, 25),
669710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_VDEC_SEL, "vdec_sel",
670710573deSChun-Jie Chen 			     vdec_parents, 0x0f0, 0x0f4, 0x0f8, 8, 4, 15, 0x008, 26),
671710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTM_SEL, "camtm_sel",
672710573deSChun-Jie Chen 			     camtm_parents, 0x0f0, 0x0f4, 0x0f8, 16, 2, 23, 0x008, 27),
673710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_PWM_SEL, "pwm_sel",
674710573deSChun-Jie Chen 			     pwm_parents, 0x0f0, 0x0f4, 0x0f8, 24, 1, 31, 0x008, 28),
675710573deSChun-Jie Chen 	/* CLK_CFG_15 */
676710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_AUDIO_H_SEL, "audio_h_sel",
677710573deSChun-Jie Chen 			     audio_h_parents, 0x100, 0x104, 0x108, 0, 2, 7, 0x008, 29),
678710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_SPMI_MST_SEL, "spmi_mst_sel",
679710573deSChun-Jie Chen 			     spmi_mst_parents, 0x100, 0x104, 0x108, 8, 3, 15, 0x008, 30),
680710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_AES_MSDCFDE_SEL, "aes_msdcfde_sel",
681710573deSChun-Jie Chen 			     aes_msdcfde_parents, 0x100, 0x104, 0x108, 24, 3, 31, 0x00c, 1),
682710573deSChun-Jie Chen 	/* CLK_CFG_16 */
683710573deSChun-Jie Chen 	MUX_GATE_CLR_SET_UPD(CLK_TOP_SFLASH_SEL, "sflash_sel",
684710573deSChun-Jie Chen 			     sflash_parents, 0x110, 0x114, 0x118, 8, 2, 15, 0x00c, 3),
685710573deSChun-Jie Chen };
686710573deSChun-Jie Chen 
687710573deSChun-Jie Chen static struct mtk_composite top_muxes[] = {
688710573deSChun-Jie Chen 	/* CLK_AUDDIV_0 */
68999f3a5e8SChen-Yu Tsai 	MUX(CLK_TOP_APLL_I2S0_M_SEL, "apll_i2s0_m_sel", apll_i2s_m_parents, 0x320, 16, 1),
69099f3a5e8SChen-Yu Tsai 	MUX(CLK_TOP_APLL_I2S1_M_SEL, "apll_i2s1_m_sel", apll_i2s_m_parents, 0x320, 17, 1),
69199f3a5e8SChen-Yu Tsai 	MUX(CLK_TOP_APLL_I2S2_M_SEL, "apll_i2s2_m_sel", apll_i2s_m_parents, 0x320, 18, 1),
69299f3a5e8SChen-Yu Tsai 	MUX(CLK_TOP_APLL_I2S3_M_SEL, "apll_i2s3_m_sel", apll_i2s_m_parents, 0x320, 19, 1),
69399f3a5e8SChen-Yu Tsai 	MUX(CLK_TOP_APLL_I2S4_M_SEL, "apll_i2s4_m_sel", apll_i2s_m_parents, 0x320, 20, 1),
69499f3a5e8SChen-Yu Tsai 	MUX(CLK_TOP_APLL_I2S5_M_SEL, "apll_i2s5_m_sel", apll_i2s_m_parents, 0x320, 21, 1),
69599f3a5e8SChen-Yu Tsai 	MUX(CLK_TOP_APLL_I2S6_M_SEL, "apll_i2s6_m_sel", apll_i2s_m_parents, 0x320, 22, 1),
69699f3a5e8SChen-Yu Tsai 	MUX(CLK_TOP_APLL_I2S7_M_SEL, "apll_i2s7_m_sel", apll_i2s_m_parents, 0x320, 23, 1),
69799f3a5e8SChen-Yu Tsai 	MUX(CLK_TOP_APLL_I2S8_M_SEL, "apll_i2s8_m_sel", apll_i2s_m_parents, 0x320, 24, 1),
69899f3a5e8SChen-Yu Tsai 	MUX(CLK_TOP_APLL_I2S9_M_SEL, "apll_i2s9_m_sel", apll_i2s_m_parents, 0x320, 25, 1),
6998bc0ed9dSAngeloGioacchino Del Regno 	/* APLL_DIV */
700710573deSChun-Jie Chen 	DIV_GATE(CLK_TOP_APLL12_DIV0, "apll12_div0", "apll_i2s0_m_sel", 0x320, 0, 0x328, 8, 0),
701710573deSChun-Jie Chen 	DIV_GATE(CLK_TOP_APLL12_DIV1, "apll12_div1", "apll_i2s1_m_sel", 0x320, 1, 0x328, 8, 8),
702710573deSChun-Jie Chen 	DIV_GATE(CLK_TOP_APLL12_DIV2, "apll12_div2", "apll_i2s2_m_sel", 0x320, 2, 0x328, 8, 16),
703710573deSChun-Jie Chen 	DIV_GATE(CLK_TOP_APLL12_DIV3, "apll12_div3", "apll_i2s3_m_sel", 0x320, 3, 0x328, 8, 24),
704710573deSChun-Jie Chen 	DIV_GATE(CLK_TOP_APLL12_DIV4, "apll12_div4", "apll_i2s4_m_sel", 0x320, 4, 0x334, 8, 0),
705710573deSChun-Jie Chen 	DIV_GATE(CLK_TOP_APLL12_DIVB, "apll12_divb", "apll12_div4", 0x320, 5, 0x334, 8, 8),
706710573deSChun-Jie Chen 	DIV_GATE(CLK_TOP_APLL12_DIV5, "apll12_div5", "apll_i2s5_m_sel", 0x320, 6, 0x334, 8, 16),
707710573deSChun-Jie Chen 	DIV_GATE(CLK_TOP_APLL12_DIV6, "apll12_div6", "apll_i2s6_m_sel", 0x320, 7, 0x334, 8, 24),
708710573deSChun-Jie Chen 	DIV_GATE(CLK_TOP_APLL12_DIV7, "apll12_div7", "apll_i2s7_m_sel", 0x320, 8, 0x338, 8, 0),
709710573deSChun-Jie Chen 	DIV_GATE(CLK_TOP_APLL12_DIV8, "apll12_div8", "apll_i2s8_m_sel", 0x320, 9, 0x338, 8, 8),
710710573deSChun-Jie Chen 	DIV_GATE(CLK_TOP_APLL12_DIV9, "apll12_div9", "apll_i2s9_m_sel", 0x320, 10, 0x338, 8, 16),
711710573deSChun-Jie Chen };
712710573deSChun-Jie Chen 
713710573deSChun-Jie Chen static const struct mtk_gate_regs infra0_cg_regs = {
714710573deSChun-Jie Chen 	.set_ofs = 0x80,
715710573deSChun-Jie Chen 	.clr_ofs = 0x84,
716710573deSChun-Jie Chen 	.sta_ofs = 0x90,
717710573deSChun-Jie Chen };
718710573deSChun-Jie Chen 
719710573deSChun-Jie Chen static const struct mtk_gate_regs infra1_cg_regs = {
720710573deSChun-Jie Chen 	.set_ofs = 0x88,
721710573deSChun-Jie Chen 	.clr_ofs = 0x8c,
722710573deSChun-Jie Chen 	.sta_ofs = 0x94,
723710573deSChun-Jie Chen };
724710573deSChun-Jie Chen 
725710573deSChun-Jie Chen static const struct mtk_gate_regs infra2_cg_regs = {
726710573deSChun-Jie Chen 	.set_ofs = 0xa4,
727710573deSChun-Jie Chen 	.clr_ofs = 0xa8,
728710573deSChun-Jie Chen 	.sta_ofs = 0xac,
729710573deSChun-Jie Chen };
730710573deSChun-Jie Chen 
731710573deSChun-Jie Chen static const struct mtk_gate_regs infra3_cg_regs = {
732710573deSChun-Jie Chen 	.set_ofs = 0xc0,
733710573deSChun-Jie Chen 	.clr_ofs = 0xc4,
734710573deSChun-Jie Chen 	.sta_ofs = 0xc8,
735710573deSChun-Jie Chen };
736710573deSChun-Jie Chen 
737710573deSChun-Jie Chen static const struct mtk_gate_regs infra4_cg_regs = {
738710573deSChun-Jie Chen 	.set_ofs = 0xd0,
739710573deSChun-Jie Chen 	.clr_ofs = 0xd4,
740710573deSChun-Jie Chen 	.sta_ofs = 0xd8,
741710573deSChun-Jie Chen };
742710573deSChun-Jie Chen 
743710573deSChun-Jie Chen static const struct mtk_gate_regs infra5_cg_regs = {
744710573deSChun-Jie Chen 	.set_ofs = 0xe0,
745710573deSChun-Jie Chen 	.clr_ofs = 0xe4,
746710573deSChun-Jie Chen 	.sta_ofs = 0xe8,
747710573deSChun-Jie Chen };
748710573deSChun-Jie Chen 
749710573deSChun-Jie Chen #define GATE_INFRA0(_id, _name, _parent, _shift)	\
750710573deSChun-Jie Chen 	GATE_MTK(_id, _name, _parent, &infra0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
751710573deSChun-Jie Chen 
752710573deSChun-Jie Chen #define GATE_INFRA1_FLAGS(_id, _name, _parent, _shift, _flag)		\
753710573deSChun-Jie Chen 	GATE_MTK_FLAGS(_id, _name, _parent, &infra1_cg_regs, _shift,	\
754710573deSChun-Jie Chen 		&mtk_clk_gate_ops_setclr, _flag)
755710573deSChun-Jie Chen 
756710573deSChun-Jie Chen #define GATE_INFRA1(_id, _name, _parent, _shift)	\
757710573deSChun-Jie Chen 	GATE_INFRA1_FLAGS(_id, _name, _parent, _shift, 0)
758710573deSChun-Jie Chen 
759710573deSChun-Jie Chen #define GATE_INFRA2(_id, _name, _parent, _shift)	\
760710573deSChun-Jie Chen 	GATE_MTK(_id, _name, _parent, &infra2_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
761710573deSChun-Jie Chen 
762710573deSChun-Jie Chen #define GATE_INFRA3_FLAGS(_id, _name, _parent, _shift, _flag)		\
763710573deSChun-Jie Chen 	GATE_MTK_FLAGS(_id, _name, _parent, &infra3_cg_regs, _shift,	\
764710573deSChun-Jie Chen 		&mtk_clk_gate_ops_setclr, _flag)
765710573deSChun-Jie Chen 
766710573deSChun-Jie Chen #define GATE_INFRA3(_id, _name, _parent, _shift)	\
767710573deSChun-Jie Chen 	GATE_INFRA3_FLAGS(_id, _name, _parent, _shift, 0)
768710573deSChun-Jie Chen 
769710573deSChun-Jie Chen #define GATE_INFRA4(_id, _name, _parent, _shift)	\
770710573deSChun-Jie Chen 	GATE_MTK(_id, _name, _parent, &infra4_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
771710573deSChun-Jie Chen 
772710573deSChun-Jie Chen #define GATE_INFRA5_FLAGS(_id, _name, _parent, _shift, _flag)		\
773710573deSChun-Jie Chen 	GATE_MTK_FLAGS(_id, _name, _parent, &infra5_cg_regs, _shift,	\
774710573deSChun-Jie Chen 		&mtk_clk_gate_ops_setclr, _flag)
775710573deSChun-Jie Chen 
776710573deSChun-Jie Chen #define GATE_INFRA5(_id, _name, _parent, _shift)	\
777710573deSChun-Jie Chen 	GATE_INFRA5_FLAGS(_id, _name, _parent, _shift, 0)
778710573deSChun-Jie Chen 
779710573deSChun-Jie Chen /*
780710573deSChun-Jie Chen  * CRITICAL CLOCK:
781710573deSChun-Jie Chen  * infra_133m and infra_66m are main peripheral bus clocks of SOC.
782710573deSChun-Jie Chen  * infra_device_apc and infra_device_apc_sync are for device access permission control module.
783710573deSChun-Jie Chen  */
784710573deSChun-Jie Chen static const struct mtk_gate infra_clks[] = {
785710573deSChun-Jie Chen 	/* INFRA0 */
786710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_PMIC_TMR, "infra_pmic_tmr", "pwrap_ulposc_sel", 0),
787710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_PMIC_AP, "infra_pmic_ap", "pwrap_ulposc_sel", 1),
788710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_PMIC_MD, "infra_pmic_md", "pwrap_ulposc_sel", 2),
789710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_PMIC_CONN, "infra_pmic_conn", "pwrap_ulposc_sel", 3),
790710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_SCPSYS, "infra_scpsys", "scp_sel", 4),
791710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_SEJ, "infra_sej", "axi_sel", 5),
792710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_APXGPT, "infra_apxgpt", "axi_sel", 6),
793710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_GCE, "infra_gce", "axi_sel", 8),
794710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_GCE2, "infra_gce2", "axi_sel", 9),
795710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_THERM, "infra_therm", "axi_sel", 10),
796710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_I2C0, "infra_i2c0", "i2c_sel", 11),
797710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_AP_DMA_PSEUDO, "infra_ap_dma_pseudo", "axi_sel", 12),
798710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_I2C2, "infra_i2c2", "i2c_sel", 13),
799710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_I2C3, "infra_i2c3", "i2c_sel", 14),
800710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_PWM_H, "infra_pwm_h", "axi_sel", 15),
801710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_PWM1, "infra_pwm1", "pwm_sel", 16),
802710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_PWM2, "infra_pwm2", "pwm_sel", 17),
803710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_PWM3, "infra_pwm3", "pwm_sel", 18),
804710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_PWM4, "infra_pwm4", "pwm_sel", 19),
805710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_PWM, "infra_pwm", "pwm_sel", 21),
806710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_UART0, "infra_uart0", "uart_sel", 22),
807710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_UART1, "infra_uart1", "uart_sel", 23),
808710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_UART2, "infra_uart2", "uart_sel", 24),
809710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_UART3, "infra_uart3", "uart_sel", 25),
810710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_GCE_26M, "infra_gce_26m", "axi_sel", 27),
811710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_CQ_DMA_FPC, "infra_cq_dma_fpc", "axi_sel", 28),
812710573deSChun-Jie Chen 	GATE_INFRA0(CLK_INFRA_BTIF, "infra_btif", "axi_sel", 31),
813710573deSChun-Jie Chen 	/* INFRA1 */
814710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_SPI0, "infra_spi0", "spi_sel", 1),
815710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_MSDC0, "infra_msdc0", "msdc50_0_h_sel", 2),
816710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_MSDC1, "infra_msdc1", "msdc50_0_h_sel", 4),
817710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_MSDC2, "infra_msdc2", "msdc50_0_h_sel", 5),
818710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_MSDC0_SRC, "infra_msdc0_src", "msdc50_0_sel", 6),
819710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_GCPU, "infra_gcpu", "axi_sel", 8),
820710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_TRNG, "infra_trng", "axi_sel", 9),
821710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_AUXADC, "infra_auxadc", "clk26m", 10),
822710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_CPUM, "infra_cpum", "axi_sel", 11),
823710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_CCIF1_AP, "infra_ccif1_ap", "axi_sel", 12),
824710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_CCIF1_MD, "infra_ccif1_md", "axi_sel", 13),
825710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_AUXADC_MD, "infra_auxadc_md", "clk26m", 14),
826710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_PCIE_TL_26M, "infra_pcie_tl_26m", "axi_sel", 15),
827710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_MSDC1_SRC, "infra_msdc1_src", "msdc30_1_sel", 16),
828710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_MSDC2_SRC, "infra_msdc2_src", "msdc30_2_sel", 17),
829710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_PCIE_TL_96M, "infra_pcie_tl_96m", "tl_sel", 18),
830710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_PCIE_PL_P_250M, "infra_pcie_pl_p_250m", "axi_sel", 19),
831710573deSChun-Jie Chen 	GATE_INFRA1_FLAGS(CLK_INFRA_DEVICE_APC, "infra_device_apc", "axi_sel", 20, CLK_IS_CRITICAL),
832710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_CCIF_AP, "infra_ccif_ap", "axi_sel", 23),
833710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_DEBUGSYS, "infra_debugsys", "axi_sel", 24),
834710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_AUDIO, "infra_audio", "axi_sel", 25),
835710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_CCIF_MD, "infra_ccif_md", "axi_sel", 26),
836710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_DXCC_SEC_CORE, "infra_dxcc_sec_core", "dxcc_sel", 27),
837710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_DXCC_AO, "infra_dxcc_ao", "dxcc_sel", 28),
838710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_DBG_TRACE, "infra_dbg_trace", "axi_sel", 29),
839710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_DEVMPU_B, "infra_devmpu_b", "axi_sel", 30),
840710573deSChun-Jie Chen 	GATE_INFRA1(CLK_INFRA_DRAMC_F26M, "infra_dramc_f26m", "clk26m", 31),
841710573deSChun-Jie Chen 	/* INFRA2 */
842710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_IRTX, "infra_irtx", "clk26m", 0),
843710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_SSUSB, "infra_ssusb", "usb_top_sel", 1),
844710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_DISP_PWM, "infra_disp_pwm", "axi_sel", 2),
845710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_CLDMA_B, "infra_cldma_b", "axi_sel", 3),
846710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_AUDIO_26M_B, "infra_audio_26m_b", "clk26m", 4),
847710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_MODEM_TEMP_SHARE, "infra_modem_temp_share", "clk26m", 5),
848710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_SPI1, "infra_spi1", "spi_sel", 6),
849710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_I2C4, "infra_i2c4", "i2c_sel", 7),
850710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_SPI2, "infra_spi2", "spi_sel", 9),
851710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_SPI3, "infra_spi3", "spi_sel", 10),
852710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_UNIPRO_SYS, "infra_unipro_sys", "ufs_sel", 11),
853710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_UNIPRO_TICK, "infra_unipro_tick", "clk26m", 12),
854710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_UFS_MP_SAP_B, "infra_ufs_mp_sap_b", "clk26m", 13),
855710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_MD32_B, "infra_md32_b", "axi_sel", 14),
856710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_UNIPRO_MBIST, "infra_unipro_mbist", "axi_sel", 16),
857710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_I2C5, "infra_i2c5", "i2c_sel", 18),
858710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_I2C5_ARBITER, "infra_i2c5_arbiter", "i2c_sel", 19),
859710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_I2C5_IMM, "infra_i2c5_imm", "i2c_sel", 20),
860710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_I2C1_ARBITER, "infra_i2c1_arbiter", "i2c_sel", 21),
861710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_I2C1_IMM, "infra_i2c1_imm", "i2c_sel", 22),
862710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_I2C2_ARBITER, "infra_i2c2_arbiter", "i2c_sel", 23),
863710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_I2C2_IMM, "infra_i2c2_imm", "i2c_sel", 24),
864710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_SPI4, "infra_spi4", "spi_sel", 25),
865710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_SPI5, "infra_spi5", "spi_sel", 26),
866710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_CQ_DMA, "infra_cq_dma", "axi_sel", 27),
867710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_UFS, "infra_ufs", "ufs_sel", 28),
868710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_AES_UFSFDE, "infra_aes_ufsfde", "aes_ufsfde_sel", 29),
869710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_UFS_TICK, "infra_ufs_tick", "ufs_sel", 30),
870710573deSChun-Jie Chen 	GATE_INFRA2(CLK_INFRA_SSUSB_XHCI, "infra_ssusb_xhci", "ssusb_xhci_sel", 31),
871710573deSChun-Jie Chen 	/* INFRA3 */
872710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_MSDC0_SELF, "infra_msdc0_self", "msdc50_0_sel", 0),
873710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_MSDC1_SELF, "infra_msdc1_self", "msdc50_0_sel", 1),
874710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_MSDC2_SELF, "infra_msdc2_self", "msdc50_0_sel", 2),
875710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_UFS_AXI, "infra_ufs_axi", "axi_sel", 5),
876710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_I2C6, "infra_i2c6", "i2c_sel", 6),
877710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_AP_MSDC0, "infra_ap_msdc0", "msdc50_0_sel", 7),
878710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_MD_MSDC0, "infra_md_msdc0", "msdc50_0_sel", 8),
879710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_CCIF5_AP, "infra_ccif5_ap", "axi_sel", 9),
880710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_CCIF5_MD, "infra_ccif5_md", "axi_sel", 10),
881710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_PCIE_TOP_H_133M, "infra_pcie_top_h_133m", "axi_sel", 11),
882710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_FLASHIF_TOP_H_133M, "infra_flashif_top_h_133m", "axi_sel", 14),
883710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_PCIE_PERI_26M, "infra_pcie_peri_26m", "axi_sel", 15),
884710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_CCIF2_AP, "infra_ccif2_ap", "axi_sel", 16),
885710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_CCIF2_MD, "infra_ccif2_md", "axi_sel", 17),
886710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_CCIF3_AP, "infra_ccif3_ap", "axi_sel", 18),
887710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_CCIF3_MD, "infra_ccif3_md", "axi_sel", 19),
888710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_SEJ_F13M, "infra_sej_f13m", "clk26m", 20),
889710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_AES, "infra_aes", "axi_sel", 21),
890710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_I2C7, "infra_i2c7", "i2c_sel", 22),
891710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_I2C8, "infra_i2c8", "i2c_sel", 23),
892710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_FBIST2FPC, "infra_fbist2fpc", "msdc50_0_sel", 24),
893710573deSChun-Jie Chen 	GATE_INFRA3_FLAGS(CLK_INFRA_DEVICE_APC_SYNC, "infra_device_apc_sync", "axi_sel", 25,
894710573deSChun-Jie Chen 			  CLK_IS_CRITICAL),
895710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_DPMAIF_MAIN, "infra_dpmaif_main", "dpmaif_main_sel", 26),
896710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_PCIE_TL_32K, "infra_pcie_tl_32k", "axi_sel", 27),
897710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_CCIF4_AP, "infra_ccif4_ap", "axi_sel", 28),
898710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_CCIF4_MD, "infra_ccif4_md", "axi_sel", 29),
899710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_SPI6, "infra_spi6", "spi_sel", 30),
900710573deSChun-Jie Chen 	GATE_INFRA3(CLK_INFRA_SPI7, "infra_spi7", "spi_sel", 31),
901710573deSChun-Jie Chen 	/* INFRA4 */
902710573deSChun-Jie Chen 	GATE_INFRA4(CLK_INFRA_AP_DMA, "infra_ap_dma", "infra_ap_dma_pseudo", 31),
903710573deSChun-Jie Chen 	/* INFRA5 */
904710573deSChun-Jie Chen 	GATE_INFRA5_FLAGS(CLK_INFRA_133M, "infra_133m", "axi_sel", 0, CLK_IS_CRITICAL),
905710573deSChun-Jie Chen 	GATE_INFRA5_FLAGS(CLK_INFRA_66M, "infra_66m", "axi_sel", 1, CLK_IS_CRITICAL),
906710573deSChun-Jie Chen 	GATE_INFRA5(CLK_INFRA_66M_PERI_BUS, "infra_66m_peri_bus", "axi_sel", 2),
907710573deSChun-Jie Chen 	GATE_INFRA5(CLK_INFRA_FREE_DCM_133M, "infra_free_dcm_133m", "axi_sel", 3),
908710573deSChun-Jie Chen 	GATE_INFRA5(CLK_INFRA_FREE_DCM_66M, "infra_free_dcm_66m", "axi_sel", 4),
909710573deSChun-Jie Chen 	GATE_INFRA5(CLK_INFRA_PERI_BUS_DCM_133M, "infra_peri_bus_dcm_133m", "axi_sel", 5),
910710573deSChun-Jie Chen 	GATE_INFRA5(CLK_INFRA_PERI_BUS_DCM_66M, "infra_peri_bus_dcm_66m", "axi_sel", 6),
911710573deSChun-Jie Chen 	GATE_INFRA5(CLK_INFRA_FLASHIF_PERI_26M, "infra_flashif_peri_26m", "axi_sel", 30),
912710573deSChun-Jie Chen 	GATE_INFRA5(CLK_INFRA_FLASHIF_SFLASH, "infra_flashif_fsflash", "axi_sel", 31),
913710573deSChun-Jie Chen };
914710573deSChun-Jie Chen 
915710573deSChun-Jie Chen static const struct mtk_gate_regs peri_cg_regs = {
916710573deSChun-Jie Chen 	.set_ofs = 0x20c,
917710573deSChun-Jie Chen 	.clr_ofs = 0x20c,
918710573deSChun-Jie Chen 	.sta_ofs = 0x20c,
919710573deSChun-Jie Chen };
920710573deSChun-Jie Chen 
921710573deSChun-Jie Chen #define GATE_PERI(_id, _name, _parent, _shift)	\
922710573deSChun-Jie Chen 	GATE_MTK(_id, _name, _parent, &peri_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
923710573deSChun-Jie Chen 
924710573deSChun-Jie Chen static const struct mtk_gate peri_clks[] = {
925710573deSChun-Jie Chen 	GATE_PERI(CLK_PERI_PERIAXI, "peri_periaxi", "axi_sel", 31),
926710573deSChun-Jie Chen };
927710573deSChun-Jie Chen 
928710573deSChun-Jie Chen static const struct mtk_gate_regs top_cg_regs = {
929710573deSChun-Jie Chen 	.set_ofs = 0x150,
930710573deSChun-Jie Chen 	.clr_ofs = 0x150,
931710573deSChun-Jie Chen 	.sta_ofs = 0x150,
932710573deSChun-Jie Chen };
933710573deSChun-Jie Chen 
934710573deSChun-Jie Chen #define GATE_TOP(_id, _name, _parent, _shift)	\
935710573deSChun-Jie Chen 	GATE_MTK(_id, _name, _parent, &top_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
936710573deSChun-Jie Chen 
937710573deSChun-Jie Chen static const struct mtk_gate top_clks[] = {
938710573deSChun-Jie Chen 	GATE_TOP(CLK_TOP_SSUSB_TOP_REF, "ssusb_top_ref", "clk26m", 24),
939710573deSChun-Jie Chen 	GATE_TOP(CLK_TOP_SSUSB_PHY_REF, "ssusb_phy_ref", "clk26m", 25),
940710573deSChun-Jie Chen };
941710573deSChun-Jie Chen 
942a0bc8ae5SRex-BC Chen static u16 infra_ao_rst_ofs[] = {
943a0bc8ae5SRex-BC Chen 	INFRA_RST0_SET_OFFSET,
944a0bc8ae5SRex-BC Chen 	INFRA_RST1_SET_OFFSET,
945a0bc8ae5SRex-BC Chen 	INFRA_RST2_SET_OFFSET,
946a0bc8ae5SRex-BC Chen 	INFRA_RST3_SET_OFFSET,
947a0bc8ae5SRex-BC Chen 	INFRA_RST4_SET_OFFSET,
948a0bc8ae5SRex-BC Chen };
949a0bc8ae5SRex-BC Chen 
950a0bc8ae5SRex-BC Chen static u16 infra_ao_idx_map[] = {
951a0bc8ae5SRex-BC Chen 	[MT8192_INFRA_RST0_THERM_CTRL_SWRST] = 0 * RST_NR_PER_BANK + 0,
952a0bc8ae5SRex-BC Chen 	[MT8192_INFRA_RST2_PEXTP_PHY_SWRST] = 2 * RST_NR_PER_BANK + 15,
953a0bc8ae5SRex-BC Chen 	[MT8192_INFRA_RST3_THERM_CTRL_PTP_SWRST] = 3 * RST_NR_PER_BANK + 5,
954a0bc8ae5SRex-BC Chen 	[MT8192_INFRA_RST4_PCIE_TOP_SWRST] = 4 * RST_NR_PER_BANK + 1,
955a0bc8ae5SRex-BC Chen 	[MT8192_INFRA_RST4_THERM_CTRL_MCU_SWRST] = 4 * RST_NR_PER_BANK + 12,
956a0bc8ae5SRex-BC Chen };
957a0bc8ae5SRex-BC Chen 
958a0bc8ae5SRex-BC Chen static const struct mtk_clk_rst_desc clk_rst_desc = {
959a0bc8ae5SRex-BC Chen 	.version = MTK_RST_SET_CLR,
960a0bc8ae5SRex-BC Chen 	.rst_bank_ofs = infra_ao_rst_ofs,
961a0bc8ae5SRex-BC Chen 	.rst_bank_nr = ARRAY_SIZE(infra_ao_rst_ofs),
962a0bc8ae5SRex-BC Chen 	.rst_idx_map = infra_ao_idx_map,
963a0bc8ae5SRex-BC Chen 	.rst_idx_map_nr = ARRAY_SIZE(infra_ao_idx_map),
964a0bc8ae5SRex-BC Chen };
965a0bc8ae5SRex-BC Chen 
966116151bdSAngeloGioacchino Del Regno /* Register mux notifier for MFG mux */
clk_mt8192_reg_mfg_mux_notifier(struct device * dev,struct clk * clk)967116151bdSAngeloGioacchino Del Regno static int clk_mt8192_reg_mfg_mux_notifier(struct device *dev, struct clk *clk)
968116151bdSAngeloGioacchino Del Regno {
969116151bdSAngeloGioacchino Del Regno 	struct mtk_mux_nb *mfg_mux_nb;
970116151bdSAngeloGioacchino Del Regno 	int i;
971116151bdSAngeloGioacchino Del Regno 
972116151bdSAngeloGioacchino Del Regno 	mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb), GFP_KERNEL);
973116151bdSAngeloGioacchino Del Regno 	if (!mfg_mux_nb)
974116151bdSAngeloGioacchino Del Regno 		return -ENOMEM;
975116151bdSAngeloGioacchino Del Regno 
976116151bdSAngeloGioacchino Del Regno 	for (i = 0; i < ARRAY_SIZE(top_mtk_muxes); i++)
977116151bdSAngeloGioacchino Del Regno 		if (top_mtk_muxes[i].id == CLK_TOP_MFG_PLL_SEL)
978116151bdSAngeloGioacchino Del Regno 			break;
979116151bdSAngeloGioacchino Del Regno 	if (i == ARRAY_SIZE(top_mtk_muxes))
980116151bdSAngeloGioacchino Del Regno 		return -EINVAL;
981116151bdSAngeloGioacchino Del Regno 
982116151bdSAngeloGioacchino Del Regno 	mfg_mux_nb->ops = top_mtk_muxes[i].ops;
983116151bdSAngeloGioacchino Del Regno 	mfg_mux_nb->bypass_index = 0; /* Bypass to 26M crystal */
984116151bdSAngeloGioacchino Del Regno 
985116151bdSAngeloGioacchino Del Regno 	return devm_mtk_clk_mux_notifier_register(dev, clk, mfg_mux_nb);
986116151bdSAngeloGioacchino Del Regno }
987116151bdSAngeloGioacchino Del Regno 
9880f69a423SAngeloGioacchino Del Regno static const struct mtk_clk_desc infra_desc = {
9890f69a423SAngeloGioacchino Del Regno 	.clks = infra_clks,
9900f69a423SAngeloGioacchino Del Regno 	.num_clks = ARRAY_SIZE(infra_clks),
9910f69a423SAngeloGioacchino Del Regno 	.rst_desc = &clk_rst_desc,
9920f69a423SAngeloGioacchino Del Regno };
9930f69a423SAngeloGioacchino Del Regno 
9940f69a423SAngeloGioacchino Del Regno static const struct mtk_clk_desc peri_desc = {
9950f69a423SAngeloGioacchino Del Regno 	.clks = peri_clks,
9960f69a423SAngeloGioacchino Del Regno 	.num_clks = ARRAY_SIZE(peri_clks),
9970f69a423SAngeloGioacchino Del Regno };
9980f69a423SAngeloGioacchino Del Regno 
999e09eb9d2SAngeloGioacchino Del Regno static const struct mtk_clk_desc topck_desc = {
1000e09eb9d2SAngeloGioacchino Del Regno 	.fixed_clks = top_fixed_clks,
1001e09eb9d2SAngeloGioacchino Del Regno 	.num_fixed_clks = ARRAY_SIZE(top_fixed_clks),
1002e09eb9d2SAngeloGioacchino Del Regno 	.factor_clks = top_divs,
1003e09eb9d2SAngeloGioacchino Del Regno 	.num_factor_clks = ARRAY_SIZE(top_divs),
1004e09eb9d2SAngeloGioacchino Del Regno 	.mux_clks = top_mtk_muxes,
1005e09eb9d2SAngeloGioacchino Del Regno 	.num_mux_clks = ARRAY_SIZE(top_mtk_muxes),
1006e09eb9d2SAngeloGioacchino Del Regno 	.composite_clks = top_muxes,
1007e09eb9d2SAngeloGioacchino Del Regno 	.num_composite_clks = ARRAY_SIZE(top_muxes),
1008e09eb9d2SAngeloGioacchino Del Regno 	.clks = top_clks,
1009e09eb9d2SAngeloGioacchino Del Regno 	.num_clks = ARRAY_SIZE(top_clks),
1010e09eb9d2SAngeloGioacchino Del Regno 	.clk_lock = &mt8192_clk_lock,
1011e09eb9d2SAngeloGioacchino Del Regno 	.clk_notifier_func = clk_mt8192_reg_mfg_mux_notifier,
1012e09eb9d2SAngeloGioacchino Del Regno 	.mfg_clk_idx = CLK_TOP_MFG_PLL_SEL,
1013e09eb9d2SAngeloGioacchino Del Regno };
1014e09eb9d2SAngeloGioacchino Del Regno 
1015124294ffSAngeloGioacchino Del Regno static const struct of_device_id of_match_clk_mt8192[] = {
10160f69a423SAngeloGioacchino Del Regno 	{ .compatible = "mediatek,mt8192-infracfg", .data = &infra_desc },
10170f69a423SAngeloGioacchino Del Regno 	{ .compatible = "mediatek,mt8192-pericfg", .data = &peri_desc },
1018e09eb9d2SAngeloGioacchino Del Regno 	{ .compatible = "mediatek,mt8192-topckgen", .data = &topck_desc },
10190f69a423SAngeloGioacchino Del Regno 	{ /* sentinel */ }
10200f69a423SAngeloGioacchino Del Regno };
102165c9ad77SAngeloGioacchino Del Regno MODULE_DEVICE_TABLE(of, of_match_clk_mt8192);
10220f69a423SAngeloGioacchino Del Regno 
1023710573deSChun-Jie Chen static struct platform_driver clk_mt8192_drv = {
1024710573deSChun-Jie Chen 	.driver = {
1025710573deSChun-Jie Chen 		.name = "clk-mt8192",
1026710573deSChun-Jie Chen 		.of_match_table = of_match_clk_mt8192,
1027710573deSChun-Jie Chen 	},
1028124294ffSAngeloGioacchino Del Regno 	.probe = mtk_clk_simple_probe,
102961ca6ee7SUwe Kleine-König 	.remove_new = mtk_clk_simple_remove,
1030710573deSChun-Jie Chen };
1031124294ffSAngeloGioacchino Del Regno module_platform_driver(clk_mt8192_drv);
1032a451da86SAngeloGioacchino Del Regno MODULE_LICENSE("GPL");
1033