162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2021 MediaTek Inc. 462306a36Sopenharmony_ci * Author: Sam Shih <sam.shih@mediatek.com> 562306a36Sopenharmony_ci * Author: Wenzhen Yu <wenzhen.yu@mediatek.com> 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#include <linux/clk-provider.h> 962306a36Sopenharmony_ci#include <linux/mod_devicetable.h> 1062306a36Sopenharmony_ci#include <linux/platform_device.h> 1162306a36Sopenharmony_ci#include "clk-mtk.h" 1262306a36Sopenharmony_ci#include "clk-gate.h" 1362306a36Sopenharmony_ci#include "clk-mux.h" 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#include <dt-bindings/clock/mt7986-clk.h> 1662306a36Sopenharmony_ci#include <linux/clk.h> 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_cistatic DEFINE_SPINLOCK(mt7986_clk_lock); 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_cistatic const struct mtk_fixed_clk top_fixed_clks[] = { 2162306a36Sopenharmony_ci FIXED_CLK(CLK_TOP_XTAL, "top_xtal", "clkxtal", 40000000), 2262306a36Sopenharmony_ci FIXED_CLK(CLK_TOP_JTAG, "top_jtag", "clkxtal", 50000000), 2362306a36Sopenharmony_ci}; 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_cistatic const struct mtk_fixed_factor top_divs[] = { 2662306a36Sopenharmony_ci /* XTAL */ 2762306a36Sopenharmony_ci FACTOR(CLK_TOP_XTAL_D2, "top_xtal_d2", "top_xtal", 1, 2), 2862306a36Sopenharmony_ci FACTOR(CLK_TOP_RTC_32K, "top_rtc_32k", "top_xtal", 1, 1250), 2962306a36Sopenharmony_ci FACTOR(CLK_TOP_RTC_32P7K, "top_rtc_32p7k", "top_xtal", 1, 1220), 3062306a36Sopenharmony_ci /* MPLL */ 3162306a36Sopenharmony_ci FACTOR(CLK_TOP_MPLL_D2, "top_mpll_d2", "mpll", 1, 2), 3262306a36Sopenharmony_ci FACTOR(CLK_TOP_MPLL_D4, "top_mpll_d4", "mpll", 1, 4), 3362306a36Sopenharmony_ci FACTOR(CLK_TOP_MPLL_D8, "top_mpll_d8", "mpll", 1, 8), 3462306a36Sopenharmony_ci FACTOR(CLK_TOP_MPLL_D8_D2, "top_mpll_d8_d2", "mpll", 1, 16), 3562306a36Sopenharmony_ci FACTOR(CLK_TOP_MPLL_D3_D2, "top_mpll_d3_d2", "mpll", 1, 6), 3662306a36Sopenharmony_ci /* MMPLL */ 3762306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D2, "top_mmpll_d2", "mmpll", 1, 2), 3862306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D4, "top_mmpll_d4", "mmpll", 1, 4), 3962306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D8, "top_mmpll_d8", "mmpll", 1, 8), 4062306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D8_D2, "top_mmpll_d8_d2", "mmpll", 1, 16), 4162306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D3_D8, "top_mmpll_d3_d8", "mmpll", 1, 24), 4262306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_U2PHY, "top_mmpll_u2phy", "mmpll", 1, 30), 4362306a36Sopenharmony_ci /* APLL2 */ 4462306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL2_D4, "top_apll2_d4", "apll2", 1, 4), 4562306a36Sopenharmony_ci /* NET1PLL */ 4662306a36Sopenharmony_ci FACTOR(CLK_TOP_NET1PLL_D4, "top_net1pll_d4", "net1pll", 1, 4), 4762306a36Sopenharmony_ci FACTOR(CLK_TOP_NET1PLL_D5, "top_net1pll_d5", "net1pll", 1, 5), 4862306a36Sopenharmony_ci FACTOR(CLK_TOP_NET1PLL_D5_D2, "top_net1pll_d5_d2", "net1pll", 1, 10), 4962306a36Sopenharmony_ci FACTOR(CLK_TOP_NET1PLL_D5_D4, "top_net1pll_d5_d4", "net1pll", 1, 20), 5062306a36Sopenharmony_ci FACTOR(CLK_TOP_NET1PLL_D8_D2, "top_net1pll_d8_d2", "net1pll", 1, 16), 5162306a36Sopenharmony_ci FACTOR(CLK_TOP_NET1PLL_D8_D4, "top_net1pll_d8_d4", "net1pll", 1, 32), 5262306a36Sopenharmony_ci /* NET2PLL */ 5362306a36Sopenharmony_ci FACTOR(CLK_TOP_NET2PLL_D4, "top_net2pll_d4", "net2pll", 1, 4), 5462306a36Sopenharmony_ci FACTOR(CLK_TOP_NET2PLL_D4_D2, "top_net2pll_d4_d2", "net2pll", 1, 8), 5562306a36Sopenharmony_ci FACTOR(CLK_TOP_NET2PLL_D3_D2, "top_net2pll_d3_d2", "net2pll", 1, 2), 5662306a36Sopenharmony_ci /* WEDMCUPLL */ 5762306a36Sopenharmony_ci FACTOR(CLK_TOP_WEDMCUPLL_D5_D2, "top_wedmcupll_d5_d2", "wedmcupll", 1, 5862306a36Sopenharmony_ci 10), 5962306a36Sopenharmony_ci}; 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_cistatic const char *const nfi1x_parents[] __initconst = { "top_xtal", 6262306a36Sopenharmony_ci "top_mmpll_d8", 6362306a36Sopenharmony_ci "top_net1pll_d8_d2", 6462306a36Sopenharmony_ci "top_net2pll_d3_d2", 6562306a36Sopenharmony_ci "top_mpll_d4", 6662306a36Sopenharmony_ci "top_mmpll_d8_d2", 6762306a36Sopenharmony_ci "top_wedmcupll_d5_d2", 6862306a36Sopenharmony_ci "top_mpll_d8" }; 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_cistatic const char *const spinfi_parents[] __initconst = { 7162306a36Sopenharmony_ci "top_xtal_d2", "top_xtal", "top_net1pll_d5_d4", 7262306a36Sopenharmony_ci "top_mpll_d4", "top_mmpll_d8_d2", "top_wedmcupll_d5_d2", 7362306a36Sopenharmony_ci "top_mmpll_d3_d8", "top_mpll_d8" 7462306a36Sopenharmony_ci}; 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_cistatic const char *const spi_parents[] __initconst = { 7762306a36Sopenharmony_ci "top_xtal", "top_mpll_d2", "top_mmpll_d8", 7862306a36Sopenharmony_ci "top_net1pll_d8_d2", "top_net2pll_d3_d2", "top_net1pll_d5_d4", 7962306a36Sopenharmony_ci "top_mpll_d4", "top_wedmcupll_d5_d2" 8062306a36Sopenharmony_ci}; 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_cistatic const char *const uart_parents[] __initconst = { "top_xtal", 8362306a36Sopenharmony_ci "top_mpll_d8", 8462306a36Sopenharmony_ci "top_mpll_d8_d2" }; 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_cistatic const char *const pwm_parents[] __initconst = { 8762306a36Sopenharmony_ci "top_xtal", "top_net1pll_d8_d2", "top_net1pll_d5_d4", "top_mpll_d4" 8862306a36Sopenharmony_ci}; 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_cistatic const char *const i2c_parents[] __initconst = { 9162306a36Sopenharmony_ci "top_xtal", "top_net1pll_d5_d4", "top_mpll_d4", "top_net1pll_d8_d4" 9262306a36Sopenharmony_ci}; 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_cistatic const char *const pextp_tl_ck_parents[] __initconst = { 9562306a36Sopenharmony_ci "top_xtal", "top_net1pll_d5_d4", "top_net2pll_d4_d2", "top_rtc_32k" 9662306a36Sopenharmony_ci}; 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_cistatic const char *const emmc_250m_parents[] __initconst = { 9962306a36Sopenharmony_ci "top_xtal", "top_net1pll_d5_d2" 10062306a36Sopenharmony_ci}; 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_cistatic const char *const emmc_416m_parents[] __initconst = { "top_xtal", 10362306a36Sopenharmony_ci "mpll" }; 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_cistatic const char *const f_26m_adc_parents[] __initconst = { "top_xtal", 10662306a36Sopenharmony_ci "top_mpll_d8_d2" }; 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_cistatic const char *const dramc_md32_parents[] __initconst = { "top_xtal", 10962306a36Sopenharmony_ci "top_mpll_d2" }; 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_cistatic const char *const sysaxi_parents[] __initconst = { "top_xtal", 11262306a36Sopenharmony_ci "top_net1pll_d8_d2", 11362306a36Sopenharmony_ci "top_net2pll_d4" }; 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_cistatic const char *const sysapb_parents[] __initconst = { "top_xtal", 11662306a36Sopenharmony_ci "top_mpll_d3_d2", 11762306a36Sopenharmony_ci "top_net2pll_d4_d2" }; 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_cistatic const char *const arm_db_main_parents[] __initconst = { 12062306a36Sopenharmony_ci "top_xtal", "top_net2pll_d3_d2" 12162306a36Sopenharmony_ci}; 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_cistatic const char *const arm_db_jtsel_parents[] __initconst = { "top_jtag", 12462306a36Sopenharmony_ci "top_xtal" }; 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_cistatic const char *const netsys_parents[] __initconst = { "top_xtal", 12762306a36Sopenharmony_ci "top_mmpll_d4" }; 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_cistatic const char *const netsys_500m_parents[] __initconst = { 13062306a36Sopenharmony_ci "top_xtal", "top_net1pll_d5" 13162306a36Sopenharmony_ci}; 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_cistatic const char *const netsys_mcu_parents[] __initconst = { 13462306a36Sopenharmony_ci "top_xtal", "wedmcupll", "top_mmpll_d2", "top_net1pll_d4", 13562306a36Sopenharmony_ci "top_net1pll_d5" 13662306a36Sopenharmony_ci}; 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_cistatic const char *const netsys_2x_parents[] __initconst = { 13962306a36Sopenharmony_ci "top_xtal", "net2pll", "wedmcupll", "top_mmpll_d2" 14062306a36Sopenharmony_ci}; 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_cistatic const char *const sgm_325m_parents[] __initconst = { "top_xtal", 14362306a36Sopenharmony_ci "sgmpll" }; 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_cistatic const char *const sgm_reg_parents[] __initconst = { 14662306a36Sopenharmony_ci "top_xtal", "top_net1pll_d8_d4" 14762306a36Sopenharmony_ci}; 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_cistatic const char *const a1sys_parents[] __initconst = { "top_xtal", 15062306a36Sopenharmony_ci "top_apll2_d4" }; 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_cistatic const char *const conn_mcusys_parents[] __initconst = { "top_xtal", 15362306a36Sopenharmony_ci "top_mmpll_d2" }; 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_cistatic const char *const eip_b_parents[] __initconst = { "top_xtal", 15662306a36Sopenharmony_ci "net2pll" }; 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_cistatic const char *const aud_l_parents[] __initconst = { "top_xtal", "apll2", 15962306a36Sopenharmony_ci "top_mpll_d8_d2" }; 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_cistatic const char *const a_tuner_parents[] __initconst = { "top_xtal", 16262306a36Sopenharmony_ci "top_apll2_d4", 16362306a36Sopenharmony_ci "top_mpll_d8_d2" }; 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_cistatic const char *const u2u3_sys_parents[] __initconst = { 16662306a36Sopenharmony_ci "top_xtal", "top_net1pll_d5_d4" 16762306a36Sopenharmony_ci}; 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_cistatic const char *const da_u2_refsel_parents[] __initconst = { 17062306a36Sopenharmony_ci "top_xtal", "top_mmpll_u2phy" 17162306a36Sopenharmony_ci}; 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_cistatic const struct mtk_mux top_muxes[] = { 17462306a36Sopenharmony_ci /* CLK_CFG_0 */ 17562306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_NFI1X_SEL, "nfi1x_sel", nfi1x_parents, 17662306a36Sopenharmony_ci 0x000, 0x004, 0x008, 0, 3, 7, 0x1C0, 0), 17762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SPINFI_SEL, "spinfi_sel", spinfi_parents, 17862306a36Sopenharmony_ci 0x000, 0x004, 0x008, 8, 3, 15, 0x1C0, 1), 17962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SPI_SEL, "spi_sel", spi_parents, 0x000, 18062306a36Sopenharmony_ci 0x004, 0x008, 16, 3, 23, 0x1C0, 2), 18162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SPIM_MST_SEL, "spim_mst_sel", spi_parents, 18262306a36Sopenharmony_ci 0x000, 0x004, 0x008, 24, 3, 31, 0x1C0, 3), 18362306a36Sopenharmony_ci /* CLK_CFG_1 */ 18462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_UART_SEL, "uart_sel", uart_parents, 0x010, 18562306a36Sopenharmony_ci 0x014, 0x018, 0, 2, 7, 0x1C0, 4), 18662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_PWM_SEL, "pwm_sel", pwm_parents, 0x010, 18762306a36Sopenharmony_ci 0x014, 0x018, 8, 2, 15, 0x1C0, 5), 18862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_I2C_SEL, "i2c_sel", i2c_parents, 0x010, 18962306a36Sopenharmony_ci 0x014, 0x018, 16, 2, 23, 0x1C0, 6), 19062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_PEXTP_TL_SEL, "pextp_tl_ck_sel", 19162306a36Sopenharmony_ci pextp_tl_ck_parents, 0x010, 0x014, 0x018, 24, 2, 19262306a36Sopenharmony_ci 31, 0x1C0, 7), 19362306a36Sopenharmony_ci /* CLK_CFG_2 */ 19462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_EMMC_250M_SEL, "emmc_250m_sel", 19562306a36Sopenharmony_ci emmc_250m_parents, 0x020, 0x024, 0x028, 0, 1, 7, 19662306a36Sopenharmony_ci 0x1C0, 8, 0), 19762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_EMMC_416M_SEL, "emmc_416m_sel", 19862306a36Sopenharmony_ci emmc_416m_parents, 0x020, 0x024, 0x028, 8, 1, 15, 19962306a36Sopenharmony_ci 0x1C0, 9, 0), 20062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_F_26M_ADC_SEL, "f_26m_adc_sel", 20162306a36Sopenharmony_ci f_26m_adc_parents, 0x020, 0x024, 0x028, 16, 1, 23, 20262306a36Sopenharmony_ci 0x1C0, 10), 20362306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_DRAMC_SEL, "dramc_sel", 20462306a36Sopenharmony_ci f_26m_adc_parents, 0x020, 0x024, 0x028, 20562306a36Sopenharmony_ci 24, 1, 31, 0x1C0, 11, 20662306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 20762306a36Sopenharmony_ci /* CLK_CFG_3 */ 20862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_DRAMC_MD32_SEL, "dramc_md32_sel", 20962306a36Sopenharmony_ci dramc_md32_parents, 0x030, 0x034, 0x038, 21062306a36Sopenharmony_ci 0, 1, 7, 0x1C0, 12, 21162306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 21262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SYSAXI_SEL, "sysaxi_sel", 21362306a36Sopenharmony_ci sysaxi_parents, 0x030, 0x034, 0x038, 21462306a36Sopenharmony_ci 8, 2, 15, 0x1C0, 13, 21562306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 21662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SYSAPB_SEL, "sysapb_sel", 21762306a36Sopenharmony_ci sysapb_parents, 0x030, 0x034, 0x038, 21862306a36Sopenharmony_ci 16, 2, 23, 0x1C0, 14, 21962306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 22062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_ARM_DB_MAIN_SEL, "arm_db_main_sel", 22162306a36Sopenharmony_ci arm_db_main_parents, 0x030, 0x034, 0x038, 24, 1, 22262306a36Sopenharmony_ci 31, 0x1C0, 15), 22362306a36Sopenharmony_ci /* CLK_CFG_4 */ 22462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_ARM_DB_JTSEL, "arm_db_jtsel", 22562306a36Sopenharmony_ci arm_db_jtsel_parents, 0x040, 0x044, 0x048, 0, 1, 7, 22662306a36Sopenharmony_ci 0x1C0, 16), 22762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_SEL, "netsys_sel", netsys_parents, 22862306a36Sopenharmony_ci 0x040, 0x044, 0x048, 8, 1, 15, 0x1C0, 17), 22962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_500M_SEL, "netsys_500m_sel", 23062306a36Sopenharmony_ci netsys_500m_parents, 0x040, 0x044, 0x048, 16, 1, 23162306a36Sopenharmony_ci 23, 0x1C0, 18), 23262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_MCU_SEL, "netsys_mcu_sel", 23362306a36Sopenharmony_ci netsys_mcu_parents, 0x040, 0x044, 0x048, 24, 3, 31, 23462306a36Sopenharmony_ci 0x1C0, 19), 23562306a36Sopenharmony_ci /* CLK_CFG_5 */ 23662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_NETSYS_2X_SEL, "netsys_2x_sel", 23762306a36Sopenharmony_ci netsys_2x_parents, 0x050, 0x054, 0x058, 0, 2, 7, 23862306a36Sopenharmony_ci 0x1C0, 20), 23962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SGM_325M_SEL, "sgm_325m_sel", 24062306a36Sopenharmony_ci sgm_325m_parents, 0x050, 0x054, 0x058, 8, 1, 15, 24162306a36Sopenharmony_ci 0x1C0, 21), 24262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SGM_REG_SEL, "sgm_reg_sel", 24362306a36Sopenharmony_ci sgm_reg_parents, 0x050, 0x054, 0x058, 24462306a36Sopenharmony_ci 16, 1, 23, 0x1C0, 22, 24562306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 24662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_A1SYS_SEL, "a1sys_sel", a1sys_parents, 24762306a36Sopenharmony_ci 0x050, 0x054, 0x058, 24, 1, 31, 0x1C0, 23), 24862306a36Sopenharmony_ci /* CLK_CFG_6 */ 24962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_CONN_MCUSYS_SEL, "conn_mcusys_sel", 25062306a36Sopenharmony_ci conn_mcusys_parents, 0x060, 0x064, 0x068, 0, 1, 7, 25162306a36Sopenharmony_ci 0x1C0, 24), 25262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_EIP_B_SEL, "eip_b_sel", eip_b_parents, 25362306a36Sopenharmony_ci 0x060, 0x064, 0x068, 8, 1, 15, 0x1C0, 25), 25462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_PCIE_PHY_SEL, "pcie_phy_sel", 25562306a36Sopenharmony_ci f_26m_adc_parents, 0x060, 0x064, 0x068, 16, 1, 23, 25662306a36Sopenharmony_ci 0x1C0, 26), 25762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_USB3_PHY_SEL, "usb3_phy_sel", 25862306a36Sopenharmony_ci f_26m_adc_parents, 0x060, 0x064, 0x068, 24, 1, 31, 25962306a36Sopenharmony_ci 0x1C0, 27), 26062306a36Sopenharmony_ci /* CLK_CFG_7 */ 26162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_F26M_SEL, "csw_f26m_sel", 26262306a36Sopenharmony_ci f_26m_adc_parents, 0x070, 0x074, 0x078, 26362306a36Sopenharmony_ci 0, 1, 7, 0x1C0, 28, 26462306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 26562306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_L_SEL, "aud_l_sel", aud_l_parents, 26662306a36Sopenharmony_ci 0x070, 0x074, 0x078, 8, 2, 15, 0x1C0, 29), 26762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_A_TUNER_SEL, "a_tuner_sel", 26862306a36Sopenharmony_ci a_tuner_parents, 0x070, 0x074, 0x078, 16, 2, 23, 26962306a36Sopenharmony_ci 0x1C0, 30), 27062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_U2U3_SEL, "u2u3_sel", f_26m_adc_parents, 27162306a36Sopenharmony_ci 0x070, 0x074, 0x078, 24, 1, 31, 0x1C4, 0), 27262306a36Sopenharmony_ci /* CLK_CFG_8 */ 27362306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_U2U3_SYS_SEL, "u2u3_sys_sel", 27462306a36Sopenharmony_ci u2u3_sys_parents, 0x080, 0x084, 0x088, 0, 1, 7, 27562306a36Sopenharmony_ci 0x1C4, 1), 27662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_U2U3_XHCI_SEL, "u2u3_xhci_sel", 27762306a36Sopenharmony_ci u2u3_sys_parents, 0x080, 0x084, 0x088, 8, 1, 15, 27862306a36Sopenharmony_ci 0x1C4, 2), 27962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_DA_U2_REFSEL, "da_u2_refsel", 28062306a36Sopenharmony_ci da_u2_refsel_parents, 0x080, 0x084, 0x088, 16, 1, 28162306a36Sopenharmony_ci 23, 0x1C4, 3), 28262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_DA_U2_CK_1P_SEL, "da_u2_ck_1p_sel", 28362306a36Sopenharmony_ci da_u2_refsel_parents, 0x080, 0x084, 0x088, 24, 1, 28462306a36Sopenharmony_ci 31, 0x1C4, 4), 28562306a36Sopenharmony_ci /* CLK_CFG_9 */ 28662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_AP2CNN_HOST_SEL, "ap2cnn_host_sel", 28762306a36Sopenharmony_ci sgm_reg_parents, 0x090, 0x094, 0x098, 0, 1, 7, 28862306a36Sopenharmony_ci 0x1C4, 5), 28962306a36Sopenharmony_ci}; 29062306a36Sopenharmony_ci 29162306a36Sopenharmony_cistatic const struct mtk_clk_desc topck_desc = { 29262306a36Sopenharmony_ci .fixed_clks = top_fixed_clks, 29362306a36Sopenharmony_ci .num_fixed_clks = ARRAY_SIZE(top_fixed_clks), 29462306a36Sopenharmony_ci .factor_clks = top_divs, 29562306a36Sopenharmony_ci .num_factor_clks = ARRAY_SIZE(top_divs), 29662306a36Sopenharmony_ci .mux_clks = top_muxes, 29762306a36Sopenharmony_ci .num_mux_clks = ARRAY_SIZE(top_muxes), 29862306a36Sopenharmony_ci .clk_lock = &mt7986_clk_lock, 29962306a36Sopenharmony_ci}; 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_cistatic const struct of_device_id of_match_clk_mt7986_topckgen[] = { 30262306a36Sopenharmony_ci { .compatible = "mediatek,mt7986-topckgen", .data = &topck_desc }, 30362306a36Sopenharmony_ci { /* sentinel */ } 30462306a36Sopenharmony_ci}; 30562306a36Sopenharmony_ciMODULE_DEVICE_TABLE(of, of_match_clk_mt7986_topckgen); 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_cistatic struct platform_driver clk_mt7986_topckgen_drv = { 30862306a36Sopenharmony_ci .probe = mtk_clk_simple_probe, 30962306a36Sopenharmony_ci .remove_new = mtk_clk_simple_remove, 31062306a36Sopenharmony_ci .driver = { 31162306a36Sopenharmony_ci .name = "clk-mt7986-topckgen", 31262306a36Sopenharmony_ci .of_match_table = of_match_clk_mt7986_topckgen, 31362306a36Sopenharmony_ci }, 31462306a36Sopenharmony_ci}; 31562306a36Sopenharmony_cimodule_platform_driver(clk_mt7986_topckgen_drv); 31662306a36Sopenharmony_ciMODULE_LICENSE("GPL"); 317