xref: /openbmc/linux/drivers/clk/mediatek/clk-mt8188-infra_ao.c (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1*fce4c7a2SGarmin.Chang // SPDX-License-Identifier: GPL-2.0-only
2*fce4c7a2SGarmin.Chang /*
3*fce4c7a2SGarmin.Chang  * Copyright (c) 2022 MediaTek Inc.
4*fce4c7a2SGarmin.Chang  * Author: Garmin Chang <garmin.chang@mediatek.com>
5*fce4c7a2SGarmin.Chang  */
6*fce4c7a2SGarmin.Chang 
7*fce4c7a2SGarmin.Chang #include <dt-bindings/clock/mediatek,mt8188-clk.h>
8*fce4c7a2SGarmin.Chang #include <dt-bindings/reset/mt8188-resets.h>
9*fce4c7a2SGarmin.Chang #include <linux/clk-provider.h>
10*fce4c7a2SGarmin.Chang #include <linux/platform_device.h>
11*fce4c7a2SGarmin.Chang 
12*fce4c7a2SGarmin.Chang #include "clk-gate.h"
13*fce4c7a2SGarmin.Chang #include "clk-mtk.h"
14*fce4c7a2SGarmin.Chang 
15*fce4c7a2SGarmin.Chang static const struct mtk_gate_regs infra_ao0_cg_regs = {
16*fce4c7a2SGarmin.Chang 	.set_ofs = 0x80,
17*fce4c7a2SGarmin.Chang 	.clr_ofs = 0x84,
18*fce4c7a2SGarmin.Chang 	.sta_ofs = 0x90,
19*fce4c7a2SGarmin.Chang };
20*fce4c7a2SGarmin.Chang 
21*fce4c7a2SGarmin.Chang static const struct mtk_gate_regs infra_ao1_cg_regs = {
22*fce4c7a2SGarmin.Chang 	.set_ofs = 0x88,
23*fce4c7a2SGarmin.Chang 	.clr_ofs = 0x8c,
24*fce4c7a2SGarmin.Chang 	.sta_ofs = 0x94,
25*fce4c7a2SGarmin.Chang };
26*fce4c7a2SGarmin.Chang 
27*fce4c7a2SGarmin.Chang static const struct mtk_gate_regs infra_ao2_cg_regs = {
28*fce4c7a2SGarmin.Chang 	.set_ofs = 0xa4,
29*fce4c7a2SGarmin.Chang 	.clr_ofs = 0xa8,
30*fce4c7a2SGarmin.Chang 	.sta_ofs = 0xac,
31*fce4c7a2SGarmin.Chang };
32*fce4c7a2SGarmin.Chang 
33*fce4c7a2SGarmin.Chang static const struct mtk_gate_regs infra_ao3_cg_regs = {
34*fce4c7a2SGarmin.Chang 	.set_ofs = 0xc0,
35*fce4c7a2SGarmin.Chang 	.clr_ofs = 0xc4,
36*fce4c7a2SGarmin.Chang 	.sta_ofs = 0xc8,
37*fce4c7a2SGarmin.Chang };
38*fce4c7a2SGarmin.Chang 
39*fce4c7a2SGarmin.Chang static const struct mtk_gate_regs infra_ao4_cg_regs = {
40*fce4c7a2SGarmin.Chang 	.set_ofs = 0xe0,
41*fce4c7a2SGarmin.Chang 	.clr_ofs = 0xe4,
42*fce4c7a2SGarmin.Chang 	.sta_ofs = 0xe8,
43*fce4c7a2SGarmin.Chang };
44*fce4c7a2SGarmin.Chang 
45*fce4c7a2SGarmin.Chang #define GATE_INFRA_AO0_FLAGS(_id, _name, _parent, _shift, _flag)                \
46*fce4c7a2SGarmin.Chang 	GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao0_cg_regs, _shift, \
47*fce4c7a2SGarmin.Chang 		&mtk_clk_gate_ops_setclr, _flag)
48*fce4c7a2SGarmin.Chang 
49*fce4c7a2SGarmin.Chang #define GATE_INFRA_AO0(_id, _name, _parent, _shift)	\
50*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0_FLAGS(_id, _name, _parent, _shift, 0)
51*fce4c7a2SGarmin.Chang 
52*fce4c7a2SGarmin.Chang #define GATE_INFRA_AO1_FLAGS(_id, _name, _parent, _shift, _flag)		\
53*fce4c7a2SGarmin.Chang 	GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao1_cg_regs, _shift,	\
54*fce4c7a2SGarmin.Chang 		&mtk_clk_gate_ops_setclr, _flag)
55*fce4c7a2SGarmin.Chang 
56*fce4c7a2SGarmin.Chang #define GATE_INFRA_AO1(_id, _name, _parent, _shift)	\
57*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1_FLAGS(_id, _name, _parent, _shift, 0)
58*fce4c7a2SGarmin.Chang 
59*fce4c7a2SGarmin.Chang #define GATE_INFRA_AO2(_id, _name, _parent, _shift)			\
60*fce4c7a2SGarmin.Chang 	GATE_MTK(_id, _name, _parent, &infra_ao2_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
61*fce4c7a2SGarmin.Chang 
62*fce4c7a2SGarmin.Chang #define GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, _flag)		\
63*fce4c7a2SGarmin.Chang 	GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao2_cg_regs, _shift,	\
64*fce4c7a2SGarmin.Chang 		&mtk_clk_gate_ops_setclr, _flag)
65*fce4c7a2SGarmin.Chang 
66*fce4c7a2SGarmin.Chang #define GATE_INFRA_AO3_FLAGS(_id, _name, _parent, _shift, _flag)		\
67*fce4c7a2SGarmin.Chang 	GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao3_cg_regs, _shift,	\
68*fce4c7a2SGarmin.Chang 		&mtk_clk_gate_ops_setclr, _flag)
69*fce4c7a2SGarmin.Chang 
70*fce4c7a2SGarmin.Chang #define GATE_INFRA_AO3(_id, _name, _parent, _shift)	\
71*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3_FLAGS(_id, _name, _parent, _shift, 0)
72*fce4c7a2SGarmin.Chang 
73*fce4c7a2SGarmin.Chang #define GATE_INFRA_AO4_FLAGS(_id, _name, _parent, _shift, _flag)		\
74*fce4c7a2SGarmin.Chang 	GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao4_cg_regs, _shift,	\
75*fce4c7a2SGarmin.Chang 		&mtk_clk_gate_ops_setclr, _flag)
76*fce4c7a2SGarmin.Chang 
77*fce4c7a2SGarmin.Chang #define GATE_INFRA_AO4(_id, _name, _parent, _shift)	\
78*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO4_FLAGS(_id, _name, _parent, _shift, 0)
79*fce4c7a2SGarmin.Chang 
80*fce4c7a2SGarmin.Chang static const struct mtk_gate infra_ao_clks[] = {
81*fce4c7a2SGarmin.Chang 	/* INFRA_AO0 */
82*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_PMIC_TMR, "infra_ao_pmic_tmr", "top_pwrap_ulposc", 0),
83*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_PMIC_AP, "infra_ao_pmic_ap", "top_pwrap_ulposc", 1),
84*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_PMIC_MD, "infra_ao_pmic_md", "top_pwrap_ulposc", 2),
85*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_PMIC_CONN, "infra_ao_pmic_conn", "top_pwrap_ulposc", 3),
86*fce4c7a2SGarmin.Chang 	/* infra_ao_sej is main clock is for secure engine with JTAG support */
87*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0_FLAGS(CLK_INFRA_AO_SEJ, "infra_ao_sej", "top_axi", 5, CLK_IS_CRITICAL),
88*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_APXGPT, "infra_ao_apxgpt", "top_axi", 6),
89*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_GCE, "infra_ao_gce", "top_axi", 8),
90*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_GCE2, "infra_ao_gce2", "top_axi", 9),
91*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_THERM, "infra_ao_therm", "top_axi", 10),
92*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_PWM_HCLK, "infra_ao_pwm_h", "top_axi", 15),
93*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_PWM1, "infra_ao_pwm1", "top_pwm", 16),
94*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_PWM2, "infra_ao_pwm2", "top_pwm", 17),
95*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_PWM3, "infra_ao_pwm3", "top_pwm", 18),
96*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_PWM4, "infra_ao_pwm4", "top_pwm", 19),
97*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_PWM, "infra_ao_pwm", "top_pwm", 21),
98*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_UART0, "infra_ao_uart0", "top_uart", 22),
99*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_UART1, "infra_ao_uart1", "top_uart", 23),
100*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_UART2, "infra_ao_uart2", "top_uart", 24),
101*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_UART3, "infra_ao_uart3", "top_uart", 25),
102*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_UART4, "infra_ao_uart4", "top_uart", 26),
103*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_GCE_26M, "infra_ao_gce_26m", "clk26m", 27),
104*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_CQ_DMA_FPC, "infra_ao_dma", "pad_fpc_ck", 28),
105*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO0(CLK_INFRA_AO_UART5, "infra_ao_uart5", "top_uart", 29),
106*fce4c7a2SGarmin.Chang 	/* INFRA_AO1 */
107*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_HDMI_26M, "infra_ao_hdmi_26m", "clk26m", 0),
108*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_SPI0, "infra_ao_spi0", "top_spi", 1),
109*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_MSDC0, "infra_ao_msdc0", "top_msdc5hclk", 2),
110*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_MSDC1, "infra_ao_msdc1", "top_axi", 4),
111*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_MSDC2, "infra_ao_msdc2", "top_axi", 5),
112*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_MSDC0_SRC, "infra_ao_msdc0_clk", "top_msdc50_0", 6),
113*fce4c7a2SGarmin.Chang 	/* infra_ao_dvfsrc is for internal DVFS usage, should not be handled by Linux. */
114*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1_FLAGS(CLK_INFRA_AO_DVFSRC, "infra_ao_dvfsrc",
115*fce4c7a2SGarmin.Chang 			     "clk26m", 7, CLK_IS_CRITICAL),
116*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_TRNG, "infra_ao_trng", "top_axi", 9),
117*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_AUXADC, "infra_ao_auxadc", "clk26m", 10),
118*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_CPUM, "infra_ao_cpum", "top_axi", 11),
119*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_HDMI_32K, "infra_ao_hdmi_32k", "clk32k", 12),
120*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_CEC_66M_HCLK, "infra_ao_cec_66m_hclk", "top_axi", 13),
121*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_PCIE_TL_26M, "infra_ao_pcie_tl_26m", "clk26m", 15),
122*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_MSDC1_SRC, "infra_ao_msdc1_clk", "top_msdc30_1", 16),
123*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_CEC_66M_BCLK, "infra_ao_cec_66m_bclk", "top_axi", 17),
124*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_PCIE_TL_96M, "infra_ao_pcie_tl_96m", "top_tl", 18),
125*fce4c7a2SGarmin.Chang 	/* infra_ao_dapc is for device access permission control module */
126*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1_FLAGS(CLK_INFRA_AO_DEVICE_APC, "infra_ao_dapc",
127*fce4c7a2SGarmin.Chang 			     "top_axi", 20, CLK_IS_CRITICAL),
128*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_ECC_66M_HCLK, "infra_ao_ecc_66m_hclk", "top_axi", 23),
129*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_DEBUGSYS, "infra_ao_debugsys", "top_axi", 24),
130*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_AUDIO, "infra_ao_audio", "top_axi", 25),
131*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_PCIE_TL_32K, "infra_ao_pcie_tl_32k", "clk32k", 26),
132*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_DBG_TRACE, "infra_ao_dbg_trace", "top_axi", 29),
133*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO1(CLK_INFRA_AO_DRAMC_F26M, "infra_ao_dramc26", "clk26m", 31),
134*fce4c7a2SGarmin.Chang 	/* INFRA_AO2 */
135*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2(CLK_INFRA_AO_IRTX, "infra_ao_irtx", "top_axi", 0),
136*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2(CLK_INFRA_AO_DISP_PWM, "infra_ao_disp_pwm", "top_disp_pwm0", 2),
137*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2(CLK_INFRA_AO_CLDMA_BCLK, "infra_ao_cldmabclk", "top_axi", 3),
138*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2(CLK_INFRA_AO_AUDIO_26M_BCLK, "infra_ao_audio26m", "clk26m", 4),
139*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2(CLK_INFRA_AO_SPI1, "infra_ao_spi1", "top_spi", 6),
140*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2(CLK_INFRA_AO_SPI2, "infra_ao_spi2", "top_spi", 9),
141*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2(CLK_INFRA_AO_SPI3, "infra_ao_spi3", "top_spi", 10),
142*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_FSSPM, "infra_ao_fsspm",
143*fce4c7a2SGarmin.Chang 			     "top_sspm", 15, CLK_IS_CRITICAL),
144*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_SSPM_BUS_HCLK, "infra_ao_sspm_hclk",
145*fce4c7a2SGarmin.Chang 			     "top_axi", 17, CLK_IS_CRITICAL),
146*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2(CLK_INFRA_AO_APDMA_BCLK, "infra_ao_apdma_bclk", "top_axi", 18),
147*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2(CLK_INFRA_AO_SPI4, "infra_ao_spi4", "top_spi", 25),
148*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2(CLK_INFRA_AO_SPI5, "infra_ao_spi5", "top_spi", 26),
149*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO2(CLK_INFRA_AO_CQ_DMA, "infra_ao_cq_dma", "top_axi", 27),
150*fce4c7a2SGarmin.Chang 	/* INFRA_AO3 */
151*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_MSDC0_SELF, "infra_ao_msdc0sf", "top_msdc50_0", 0),
152*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_MSDC1_SELF, "infra_ao_msdc1sf", "top_msdc50_0", 1),
153*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_MSDC2_SELF, "infra_ao_msdc2sf", "top_msdc50_0", 2),
154*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_I2S_DMA, "infra_ao_i2s_dma", "top_axi", 5),
155*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_AP_MSDC0, "infra_ao_ap_msdc0", "top_msdc50_0", 7),
156*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_MD_MSDC0, "infra_ao_md_msdc0", "top_msdc50_0", 8),
157*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_MSDC30_2, "infra_ao_msdc30_2", "top_msdc30_2", 9),
158*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_GCPU, "infra_ao_gcpu", "top_gcpu", 10),
159*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_PCIE_PERI_26M, "infra_ao_pcie_peri_26m", "clk26m", 15),
160*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_GCPU_66M_BCLK, "infra_ao_gcpu_66m_bclk", "top_axi", 16),
161*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_GCPU_133M_BCLK, "infra_ao_gcpu_133m_bclk", "top_axi", 17),
162*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_DISP_PWM1, "infra_ao_disp_pwm1", "top_disp_pwm1", 20),
163*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_FBIST2FPC, "infra_ao_fbist2fpc", "top_msdc50_0", 24),
164*fce4c7a2SGarmin.Chang 	/* infra_ao_dapc_sync is for device access permission control module */
165*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3_FLAGS(CLK_INFRA_AO_DEVICE_APC_SYNC, "infra_ao_dapc_sync",
166*fce4c7a2SGarmin.Chang 			     "top_axi", 25, CLK_IS_CRITICAL),
167*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO3(CLK_INFRA_AO_PCIE_P1_PERI_26M, "infra_ao_pcie_p1_peri_26m", "clk26m", 26),
168*fce4c7a2SGarmin.Chang 	/* INFRA_AO4 */
169*fce4c7a2SGarmin.Chang 	/* infra_ao_133m_mclk_set/infra_ao_66m_mclk_set are main clocks of peripheral */
170*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO4_FLAGS(CLK_INFRA_AO_133M_MCLK_CK, "infra_ao_133m_mclk_set",
171*fce4c7a2SGarmin.Chang 			     "top_axi", 0, CLK_IS_CRITICAL),
172*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO4_FLAGS(CLK_INFRA_AO_66M_MCLK_CK, "infra_ao_66m_mclk_set",
173*fce4c7a2SGarmin.Chang 			     "top_axi", 1, CLK_IS_CRITICAL),
174*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO4(CLK_INFRA_AO_PCIE_PL_P_250M_P0, "infra_ao_pcie_pl_p_250m_p0",
175*fce4c7a2SGarmin.Chang 		       "pextp_pipe", 7),
176*fce4c7a2SGarmin.Chang 	GATE_INFRA_AO4(CLK_INFRA_AO_RG_AES_MSDCFDE_CK_0P,
177*fce4c7a2SGarmin.Chang 		       "infra_ao_aes_msdcfde_0p", "top_aes_msdcfde", 18),
178*fce4c7a2SGarmin.Chang };
179*fce4c7a2SGarmin.Chang 
180*fce4c7a2SGarmin.Chang static u16 infra_ao_rst_ofs[] = {
181*fce4c7a2SGarmin.Chang 	INFRA_RST0_SET_OFFSET,
182*fce4c7a2SGarmin.Chang 	INFRA_RST1_SET_OFFSET,
183*fce4c7a2SGarmin.Chang 	INFRA_RST2_SET_OFFSET,
184*fce4c7a2SGarmin.Chang 	INFRA_RST3_SET_OFFSET,
185*fce4c7a2SGarmin.Chang 	INFRA_RST4_SET_OFFSET,
186*fce4c7a2SGarmin.Chang };
187*fce4c7a2SGarmin.Chang 
188*fce4c7a2SGarmin.Chang static u16 infra_ao_idx_map[] = {
189*fce4c7a2SGarmin.Chang 	[MT8188_INFRA_RST1_THERMAL_MCU_RST] = 1 * RST_NR_PER_BANK + 2,
190*fce4c7a2SGarmin.Chang 	[MT8188_INFRA_RST1_THERMAL_CTRL_RST] = 1 * RST_NR_PER_BANK + 4,
191*fce4c7a2SGarmin.Chang 	[MT8188_INFRA_RST3_PTP_CTRL_RST] = 3 * RST_NR_PER_BANK + 5,
192*fce4c7a2SGarmin.Chang };
193*fce4c7a2SGarmin.Chang 
194*fce4c7a2SGarmin.Chang static const struct mtk_clk_rst_desc infra_ao_rst_desc = {
195*fce4c7a2SGarmin.Chang 	.version = MTK_RST_SET_CLR,
196*fce4c7a2SGarmin.Chang 	.rst_bank_ofs = infra_ao_rst_ofs,
197*fce4c7a2SGarmin.Chang 	.rst_bank_nr = ARRAY_SIZE(infra_ao_rst_ofs),
198*fce4c7a2SGarmin.Chang 	.rst_idx_map = infra_ao_idx_map,
199*fce4c7a2SGarmin.Chang 	.rst_idx_map_nr = ARRAY_SIZE(infra_ao_idx_map),
200 };
201 
202 static const struct mtk_clk_desc infra_ao_desc = {
203 	.clks = infra_ao_clks,
204 	.num_clks = ARRAY_SIZE(infra_ao_clks),
205 	.rst_desc = &infra_ao_rst_desc,
206 };
207 
208 static const struct of_device_id of_match_clk_mt8188_infra_ao[] = {
209 	{ .compatible = "mediatek,mt8188-infracfg-ao", .data = &infra_ao_desc },
210 	{ /* sentinel */ }
211 };
212 MODULE_DEVICE_TABLE(of, of_match_clk_mt8188_infra_ao);
213 
214 static struct platform_driver clk_mt8188_infra_ao_drv = {
215 	.probe = mtk_clk_simple_probe,
216 	.remove_new = mtk_clk_simple_remove,
217 	.driver = {
218 		.name = "clk-mt8188-infra_ao",
219 		.of_match_table = of_match_clk_mt8188_infra_ao,
220 	},
221 };
222 module_platform_driver(clk_mt8188_infra_ao_drv);
223 MODULE_LICENSE("GPL");
224