162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_ci// 362306a36Sopenharmony_ci// Copyright (c) 2021 MediaTek Inc. 462306a36Sopenharmony_ci// Author: Chun-Jie Chen <chun-jie.chen@mediatek.com> 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#include "clk-gate.h" 762306a36Sopenharmony_ci#include "clk-mtk.h" 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <dt-bindings/clock/mt8195-clk.h> 1062306a36Sopenharmony_ci#include <dt-bindings/reset/mt8195-resets.h> 1162306a36Sopenharmony_ci#include <linux/clk-provider.h> 1262306a36Sopenharmony_ci#include <linux/platform_device.h> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_cistatic const struct mtk_gate_regs infra_ao0_cg_regs = { 1562306a36Sopenharmony_ci .set_ofs = 0x80, 1662306a36Sopenharmony_ci .clr_ofs = 0x84, 1762306a36Sopenharmony_ci .sta_ofs = 0x90, 1862306a36Sopenharmony_ci}; 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_cistatic const struct mtk_gate_regs infra_ao1_cg_regs = { 2162306a36Sopenharmony_ci .set_ofs = 0x88, 2262306a36Sopenharmony_ci .clr_ofs = 0x8c, 2362306a36Sopenharmony_ci .sta_ofs = 0x94, 2462306a36Sopenharmony_ci}; 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_cistatic const struct mtk_gate_regs infra_ao2_cg_regs = { 2762306a36Sopenharmony_ci .set_ofs = 0xa4, 2862306a36Sopenharmony_ci .clr_ofs = 0xa8, 2962306a36Sopenharmony_ci .sta_ofs = 0xac, 3062306a36Sopenharmony_ci}; 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_cistatic const struct mtk_gate_regs infra_ao3_cg_regs = { 3362306a36Sopenharmony_ci .set_ofs = 0xc0, 3462306a36Sopenharmony_ci .clr_ofs = 0xc4, 3562306a36Sopenharmony_ci .sta_ofs = 0xc8, 3662306a36Sopenharmony_ci}; 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_cistatic const struct mtk_gate_regs infra_ao4_cg_regs = { 3962306a36Sopenharmony_ci .set_ofs = 0xe0, 4062306a36Sopenharmony_ci .clr_ofs = 0xe4, 4162306a36Sopenharmony_ci .sta_ofs = 0xe8, 4262306a36Sopenharmony_ci}; 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#define GATE_INFRA_AO0_FLAGS(_id, _name, _parent, _shift, _flag) \ 4562306a36Sopenharmony_ci GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao0_cg_regs, _shift, \ 4662306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr, _flag) 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#define GATE_INFRA_AO0(_id, _name, _parent, _shift) \ 4962306a36Sopenharmony_ci GATE_INFRA_AO0_FLAGS(_id, _name, _parent, _shift, 0) 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci#define GATE_INFRA_AO1_FLAGS(_id, _name, _parent, _shift, _flag) \ 5262306a36Sopenharmony_ci GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao1_cg_regs, _shift, \ 5362306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr, _flag) 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci#define GATE_INFRA_AO1(_id, _name, _parent, _shift) \ 5662306a36Sopenharmony_ci GATE_INFRA_AO1_FLAGS(_id, _name, _parent, _shift, 0) 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci#define GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, _flag) \ 5962306a36Sopenharmony_ci GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao2_cg_regs, _shift, \ 6062306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr, _flag) 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci#define GATE_INFRA_AO2(_id, _name, _parent, _shift) \ 6362306a36Sopenharmony_ci GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, 0) 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci#define GATE_INFRA_AO3_FLAGS(_id, _name, _parent, _shift, _flag) \ 6662306a36Sopenharmony_ci GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao3_cg_regs, _shift, \ 6762306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr, _flag) 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci#define GATE_INFRA_AO3(_id, _name, _parent, _shift) \ 7062306a36Sopenharmony_ci GATE_INFRA_AO3_FLAGS(_id, _name, _parent, _shift, 0) 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci#define GATE_INFRA_AO4_FLAGS(_id, _name, _parent, _shift, _flag) \ 7362306a36Sopenharmony_ci GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao4_cg_regs, _shift, \ 7462306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr, _flag) 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci#define GATE_INFRA_AO4(_id, _name, _parent, _shift) \ 7762306a36Sopenharmony_ci GATE_INFRA_AO4_FLAGS(_id, _name, _parent, _shift, 0) 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_cistatic const struct mtk_gate infra_ao_clks[] = { 8062306a36Sopenharmony_ci /* INFRA_AO0 */ 8162306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_PMIC_TMR, "infra_ao_pmic_tmr", "top_pwrap_ulposc", 0), 8262306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_PMIC_AP, "infra_ao_pmic_ap", "top_pwrap_ulposc", 1), 8362306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_PMIC_MD, "infra_ao_pmic_md", "top_pwrap_ulposc", 2), 8462306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_PMIC_CONN, "infra_ao_pmic_conn", "top_pwrap_ulposc", 3), 8562306a36Sopenharmony_ci /* infra_ao_sej is main clock is for secure engine with JTAG support */ 8662306a36Sopenharmony_ci GATE_INFRA_AO0_FLAGS(CLK_INFRA_AO_SEJ, "infra_ao_sej", "top_axi", 5, CLK_IS_CRITICAL), 8762306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_APXGPT, "infra_ao_apxgpt", "top_axi", 6), 8862306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_GCE, "infra_ao_gce", "top_axi", 8), 8962306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_GCE2, "infra_ao_gce2", "top_axi", 9), 9062306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_THERM, "infra_ao_therm", "top_axi", 10), 9162306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_PWM_H, "infra_ao_pwm_h", "top_axi", 15), 9262306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_PWM1, "infra_ao_pwm1", "top_pwm", 16), 9362306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_PWM2, "infra_ao_pwm2", "top_pwm", 17), 9462306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_PWM3, "infra_ao_pwm3", "top_pwm", 18), 9562306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_PWM4, "infra_ao_pwm4", "top_pwm", 19), 9662306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_PWM, "infra_ao_pwm", "top_pwm", 21), 9762306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_UART0, "infra_ao_uart0", "top_uart", 22), 9862306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_UART1, "infra_ao_uart1", "top_uart", 23), 9962306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_UART2, "infra_ao_uart2", "top_uart", 24), 10062306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_UART3, "infra_ao_uart3", "top_uart", 25), 10162306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_UART4, "infra_ao_uart4", "top_uart", 26), 10262306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_GCE_26M, "infra_ao_gce_26m", "clk26m", 27), 10362306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_CQ_DMA_FPC, "infra_ao_cq_dma_fpc", "fpc", 28), 10462306a36Sopenharmony_ci GATE_INFRA_AO0(CLK_INFRA_AO_UART5, "infra_ao_uart5", "top_uart", 29), 10562306a36Sopenharmony_ci /* INFRA_AO1 */ 10662306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_HDMI_26M, "infra_ao_hdmi_26m", "clk26m", 0), 10762306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_SPI0, "infra_ao_spi0", "top_spi", 1), 10862306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_MSDC0, "infra_ao_msdc0", "top_msdc50_0_hclk", 2), 10962306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_MSDC1, "infra_ao_msdc1", "top_axi", 4), 11062306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_CG1_MSDC2, "infra_ao_cg1_msdc2", "top_axi", 5), 11162306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_MSDC0_SRC, "infra_ao_msdc0_src", "top_msdc50_0", 6), 11262306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_TRNG, "infra_ao_trng", "top_axi", 9), 11362306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_AUXADC, "infra_ao_auxadc", "clk26m", 10), 11462306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_CPUM, "infra_ao_cpum", "top_axi", 11), 11562306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_HDMI_32K, "infra_ao_hdmi_32k", "clk32k", 12), 11662306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_CEC_66M_H, "infra_ao_cec_66m_h", "top_axi", 13), 11762306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_IRRX, "infra_ao_irrx", "top_axi", 14), 11862306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_PCIE_TL_26M, "infra_ao_pcie_tl_26m", "clk26m", 15), 11962306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_MSDC1_SRC, "infra_ao_msdc1_src", "top_msdc30_1", 16), 12062306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_CEC_66M_B, "infra_ao_cec_66m_b", "top_axi", 17), 12162306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_PCIE_TL_96M, "infra_ao_pcie_tl_96m", "top_tl", 18), 12262306a36Sopenharmony_ci /* infra_ao_device_apc is for device access permission control module */ 12362306a36Sopenharmony_ci GATE_INFRA_AO1_FLAGS(CLK_INFRA_AO_DEVICE_APC, "infra_ao_device_apc", "top_axi", 20, 12462306a36Sopenharmony_ci CLK_IS_CRITICAL), 12562306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_ECC_66M_H, "infra_ao_ecc_66m_h", "top_axi", 23), 12662306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_DEBUGSYS, "infra_ao_debugsys", "top_axi", 24), 12762306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_AUDIO, "infra_ao_audio", "top_axi", 25), 12862306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_PCIE_TL_32K, "infra_ao_pcie_tl_32k", "clk32k", 26), 12962306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_DBG_TRACE, "infra_ao_dbg_trace", "top_axi", 29), 13062306a36Sopenharmony_ci GATE_INFRA_AO1(CLK_INFRA_AO_DRAMC_F26M, "infra_ao_dramc_f26m", "clk26m", 31), 13162306a36Sopenharmony_ci /* INFRA_AO2 */ 13262306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_IRTX, "infra_ao_irtx", "top_axi", 0), 13362306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_SSUSB, "infra_ao_ssusb", "top_usb_top", 1), 13462306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_DISP_PWM, "infra_ao_disp_pwm", "top_disp_pwm0", 2), 13562306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_CLDMA_B, "infra_ao_cldma_b", "top_axi", 3), 13662306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_AUDIO_26M_B, "infra_ao_audio_26m_b", "clk26m", 4), 13762306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_SPI1, "infra_ao_spi1", "top_spi", 6), 13862306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_SPI2, "infra_ao_spi2", "top_spi", 9), 13962306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_SPI3, "infra_ao_spi3", "top_spi", 10), 14062306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_UNIPRO_SYS, "infra_ao_unipro_sys", "top_ufs", 11), 14162306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_UNIPRO_TICK, "infra_ao_unipro_tick", "top_ufs_tick1us", 12), 14262306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_UFS_MP_SAP_B, "infra_ao_ufs_mp_sap_b", "top_ufs_mp_sap_cfg", 13), 14362306a36Sopenharmony_ci /* pwrmcu is used by ATF for platform PM: clocks must never be disabled by the kernel */ 14462306a36Sopenharmony_ci GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_PWRMCU, "infra_ao_pwrmcu", "top_pwrmcu", 15, 14562306a36Sopenharmony_ci CLK_IS_CRITICAL), 14662306a36Sopenharmony_ci GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_PWRMCU_BUS_H, "infra_ao_pwrmcu_bus_h", "top_axi", 17, 14762306a36Sopenharmony_ci CLK_IS_CRITICAL), 14862306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_APDMA_B, "infra_ao_apdma_b", "top_axi", 18), 14962306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_SPI4, "infra_ao_spi4", "top_spi", 25), 15062306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_SPI5, "infra_ao_spi5", "top_spi", 26), 15162306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_CQ_DMA, "infra_ao_cq_dma", "top_axi", 27), 15262306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_AES_UFSFDE, "infra_ao_aes_ufsfde", "top_ufs", 28), 15362306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_AES, "infra_ao_aes", "top_aes_ufsfde", 29), 15462306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_UFS_TICK, "infra_ao_ufs_tick", "top_ufs_tick1us", 30), 15562306a36Sopenharmony_ci GATE_INFRA_AO2(CLK_INFRA_AO_SSUSB_XHCI, "infra_ao_ssusb_xhci", "top_ssusb_xhci", 31), 15662306a36Sopenharmony_ci /* INFRA_AO3 */ 15762306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_MSDC0_SELF, "infra_ao_msdc0f", "top_msdc50_0", 0), 15862306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_MSDC1_SELF, "infra_ao_msdc1f", "top_msdc50_0", 1), 15962306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_MSDC2_SELF, "infra_ao_msdc2f", "top_msdc50_0", 2), 16062306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_I2S_DMA, "infra_ao_i2s_dma", "top_axi", 5), 16162306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_AP_MSDC0, "infra_ao_ap_msdc0", "top_msdc50_0", 7), 16262306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_MD_MSDC0, "infra_ao_md_msdc0", "top_msdc50_0", 8), 16362306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_CG3_MSDC2, "infra_ao_cg3_msdc2", "top_msdc30_2", 9), 16462306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_GCPU, "infra_ao_gcpu", "top_gcpu", 10), 16562306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_PCIE_PERI_26M, "infra_ao_pcie_peri_26m", "clk26m", 15), 16662306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_GCPU_66M_B, "infra_ao_gcpu_66m_b", "top_axi", 16), 16762306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_GCPU_133M_B, "infra_ao_gcpu_133m_b", "top_axi", 17), 16862306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_DISP_PWM1, "infra_ao_disp_pwm1", "top_disp_pwm1", 20), 16962306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_FBIST2FPC, "infra_ao_fbist2fpc", "top_msdc50_0", 24), 17062306a36Sopenharmony_ci /* infra_ao_device_apc_sync is for device access permission control module */ 17162306a36Sopenharmony_ci GATE_INFRA_AO3_FLAGS(CLK_INFRA_AO_DEVICE_APC_SYNC, "infra_ao_device_apc_sync", "top_axi", 25, 17262306a36Sopenharmony_ci CLK_IS_CRITICAL), 17362306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_PCIE_P1_PERI_26M, "infra_ao_pcie_p1_peri_26m", "clk26m", 26), 17462306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_SPIS0, "infra_ao_spis0", "top_spis", 28), 17562306a36Sopenharmony_ci GATE_INFRA_AO3(CLK_INFRA_AO_SPIS1, "infra_ao_spis1", "top_spis", 29), 17662306a36Sopenharmony_ci /* INFRA_AO4 */ 17762306a36Sopenharmony_ci /* infra_ao_133m_m_peri infra_ao_66m_m_peri are main clocks of peripheral */ 17862306a36Sopenharmony_ci GATE_INFRA_AO4_FLAGS(CLK_INFRA_AO_133M_M_PERI, "infra_ao_133m_m_peri", "top_axi", 0, 17962306a36Sopenharmony_ci CLK_IS_CRITICAL), 18062306a36Sopenharmony_ci GATE_INFRA_AO4_FLAGS(CLK_INFRA_AO_66M_M_PERI, "infra_ao_66m_m_peri", "top_axi", 1, 18162306a36Sopenharmony_ci CLK_IS_CRITICAL), 18262306a36Sopenharmony_ci GATE_INFRA_AO4(CLK_INFRA_AO_PCIE_PL_P_250M_P0, "infra_ao_pcie_pl_p_250m_p0", "pextp_pipe", 7), 18362306a36Sopenharmony_ci GATE_INFRA_AO4(CLK_INFRA_AO_PCIE_PL_P_250M_P1, "infra_ao_pcie_pl_p_250m_p1", 18462306a36Sopenharmony_ci "ssusb_u3phy_p1_p_p0", 8), 18562306a36Sopenharmony_ci GATE_INFRA_AO4(CLK_INFRA_AO_PCIE_P1_TL_96M, "infra_ao_pcie_p1_tl_96m", "top_tl_p1", 17), 18662306a36Sopenharmony_ci GATE_INFRA_AO4(CLK_INFRA_AO_AES_MSDCFDE_0P, "infra_ao_aes_msdcfde_0p", "top_aes_msdcfde", 18), 18762306a36Sopenharmony_ci GATE_INFRA_AO4(CLK_INFRA_AO_UFS_TX_SYMBOL, "infra_ao_ufs_tx_symbol", "ufs_tx_symbol", 22), 18862306a36Sopenharmony_ci GATE_INFRA_AO4(CLK_INFRA_AO_UFS_RX_SYMBOL, "infra_ao_ufs_rx_symbol", "ufs_rx_symbol", 23), 18962306a36Sopenharmony_ci GATE_INFRA_AO4(CLK_INFRA_AO_UFS_RX_SYMBOL1, "infra_ao_ufs_rx_symbol1", "ufs_rx_symbol1", 24), 19062306a36Sopenharmony_ci GATE_INFRA_AO4(CLK_INFRA_AO_PERI_UFS_MEM_SUB, "infra_ao_peri_ufs_mem_sub", "mem_466m", 31), 19162306a36Sopenharmony_ci}; 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_cistatic u16 infra_ao_rst_ofs[] = { 19462306a36Sopenharmony_ci INFRA_RST0_SET_OFFSET, 19562306a36Sopenharmony_ci INFRA_RST1_SET_OFFSET, 19662306a36Sopenharmony_ci INFRA_RST2_SET_OFFSET, 19762306a36Sopenharmony_ci INFRA_RST3_SET_OFFSET, 19862306a36Sopenharmony_ci INFRA_RST4_SET_OFFSET, 19962306a36Sopenharmony_ci}; 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_cistatic u16 infra_ao_idx_map[] = { 20262306a36Sopenharmony_ci [MT8195_INFRA_RST0_THERM_CTRL_SWRST] = 0 * RST_NR_PER_BANK + 0, 20362306a36Sopenharmony_ci [MT8195_INFRA_RST2_USBSIF_P1_SWRST] = 2 * RST_NR_PER_BANK + 18, 20462306a36Sopenharmony_ci [MT8195_INFRA_RST2_PCIE_P0_SWRST] = 2 * RST_NR_PER_BANK + 26, 20562306a36Sopenharmony_ci [MT8195_INFRA_RST2_PCIE_P1_SWRST] = 2 * RST_NR_PER_BANK + 27, 20662306a36Sopenharmony_ci [MT8195_INFRA_RST3_THERM_CTRL_PTP_SWRST] = 3 * RST_NR_PER_BANK + 5, 20762306a36Sopenharmony_ci [MT8195_INFRA_RST4_THERM_CTRL_MCU_SWRST] = 4 * RST_NR_PER_BANK + 10, 20862306a36Sopenharmony_ci}; 20962306a36Sopenharmony_ci 21062306a36Sopenharmony_cistatic struct mtk_clk_rst_desc infra_ao_rst_desc = { 21162306a36Sopenharmony_ci .version = MTK_RST_SET_CLR, 21262306a36Sopenharmony_ci .rst_bank_ofs = infra_ao_rst_ofs, 21362306a36Sopenharmony_ci .rst_bank_nr = ARRAY_SIZE(infra_ao_rst_ofs), 21462306a36Sopenharmony_ci .rst_idx_map = infra_ao_idx_map, 21562306a36Sopenharmony_ci .rst_idx_map_nr = ARRAY_SIZE(infra_ao_idx_map), 21662306a36Sopenharmony_ci}; 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_cistatic const struct mtk_clk_desc infra_ao_desc = { 21962306a36Sopenharmony_ci .clks = infra_ao_clks, 22062306a36Sopenharmony_ci .num_clks = ARRAY_SIZE(infra_ao_clks), 22162306a36Sopenharmony_ci .rst_desc = &infra_ao_rst_desc, 22262306a36Sopenharmony_ci}; 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_cistatic const struct of_device_id of_match_clk_mt8195_infra_ao[] = { 22562306a36Sopenharmony_ci { 22662306a36Sopenharmony_ci .compatible = "mediatek,mt8195-infracfg_ao", 22762306a36Sopenharmony_ci .data = &infra_ao_desc, 22862306a36Sopenharmony_ci }, { 22962306a36Sopenharmony_ci /* sentinel */ 23062306a36Sopenharmony_ci } 23162306a36Sopenharmony_ci}; 23262306a36Sopenharmony_ciMODULE_DEVICE_TABLE(of, of_match_clk_mt8195_infra_ao); 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_cistatic struct platform_driver clk_mt8195_infra_ao_drv = { 23562306a36Sopenharmony_ci .probe = mtk_clk_simple_probe, 23662306a36Sopenharmony_ci .remove_new = mtk_clk_simple_remove, 23762306a36Sopenharmony_ci .driver = { 23862306a36Sopenharmony_ci .name = "clk-mt8195-infra_ao", 23962306a36Sopenharmony_ci .of_match_table = of_match_clk_mt8195_infra_ao, 24062306a36Sopenharmony_ci }, 24162306a36Sopenharmony_ci}; 24262306a36Sopenharmony_cimodule_platform_driver(clk_mt8195_infra_ao_drv); 24362306a36Sopenharmony_ciMODULE_LICENSE("GPL"); 244