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 <linux/clk.h> 762306a36Sopenharmony_ci#include <linux/delay.h> 862306a36Sopenharmony_ci#include <linux/mfd/syscon.h> 962306a36Sopenharmony_ci#include <linux/mod_devicetable.h> 1062306a36Sopenharmony_ci#include <linux/platform_device.h> 1162306a36Sopenharmony_ci#include <linux/slab.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include "clk-gate.h" 1462306a36Sopenharmony_ci#include "clk-mtk.h" 1562306a36Sopenharmony_ci#include "clk-mux.h" 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#include <dt-bindings/clock/mt8192-clk.h> 1862306a36Sopenharmony_ci#include <dt-bindings/reset/mt8192-resets.h> 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_cistatic DEFINE_SPINLOCK(mt8192_clk_lock); 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_cistatic const struct mtk_fixed_clk top_fixed_clks[] = { 2362306a36Sopenharmony_ci FIXED_CLK(CLK_TOP_ULPOSC, "ulposc", NULL, 260000000), 2462306a36Sopenharmony_ci}; 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_cistatic const struct mtk_fixed_factor top_divs[] = { 2762306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D3, "mainpll_d3", "mainpll", 1, 3, 0), 2862306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D4, "mainpll_d4", "mainpll", 1, 4, 0), 2962306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D4_D2, "mainpll_d4_d2", "mainpll_d4", 1, 2, 0), 3062306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D4_D4, "mainpll_d4_d4", "mainpll_d4", 1, 4, 0), 3162306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D4_D8, "mainpll_d4_d8", "mainpll_d4", 1, 8, 0), 3262306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D4_D16, "mainpll_d4_d16", "mainpll_d4", 1, 16, 0), 3362306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D5, "mainpll_d5", "mainpll", 1, 5, 0), 3462306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D5_D2, "mainpll_d5_d2", "mainpll_d5", 1, 2, 0), 3562306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D5_D4, "mainpll_d5_d4", "mainpll_d5", 1, 4, 0), 3662306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D5_D8, "mainpll_d5_d8", "mainpll_d5", 1, 8, 0), 3762306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D6, "mainpll_d6", "mainpll", 1, 6, 0), 3862306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D6_D2, "mainpll_d6_d2", "mainpll_d6", 1, 2, 0), 3962306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D6_D4, "mainpll_d6_d4", "mainpll_d6", 1, 4, 0), 4062306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D7, "mainpll_d7", "mainpll", 1, 7, 0), 4162306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D7_D2, "mainpll_d7_d2", "mainpll_d7", 1, 2, 0), 4262306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D7_D4, "mainpll_d7_d4", "mainpll_d7", 1, 4, 0), 4362306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_MAINPLL_D7_D8, "mainpll_d7_d8", "mainpll_d7", 1, 8, 0), 4462306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D3, "univpll_d3", "univpll", 1, 3, 0), 4562306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D4, "univpll_d4", "univpll", 1, 4, 0), 4662306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D4_D2, "univpll_d4_d2", "univpll_d4", 1, 2, 0), 4762306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D4_D4, "univpll_d4_d4", "univpll_d4", 1, 4, 0), 4862306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D4_D8, "univpll_d4_d8", "univpll_d4", 1, 8, 0), 4962306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5, "univpll_d5", "univpll", 1, 5, 0), 5062306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5_D2, "univpll_d5_d2", "univpll_d5", 1, 2, 0), 5162306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5_D4, "univpll_d5_d4", "univpll_d5", 1, 4, 0), 5262306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5_D8, "univpll_d5_d8", "univpll_d5", 1, 8, 0), 5362306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D6, "univpll_d6", "univpll", 1, 6, 0), 5462306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D6_D2, "univpll_d6_d2", "univpll_d6", 1, 2, 0), 5562306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D6_D4, "univpll_d6_d4", "univpll_d6", 1, 4, 0), 5662306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D6_D8, "univpll_d6_d8", "univpll_d6", 1, 8, 0), 5762306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D6_D16, "univpll_d6_d16", "univpll_d6", 1, 16, 0), 5862306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D7, "univpll_d7", "univpll", 1, 7, 0), 5962306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL1, "apll1_ck", "apll1", 1, 1), 6062306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL1_D2, "apll1_d2", "apll1", 1, 2), 6162306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL1_D4, "apll1_d4", "apll1", 1, 4), 6262306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL1_D8, "apll1_d8", "apll1", 1, 8), 6362306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL2, "apll2_ck", "apll2", 1, 1), 6462306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL2_D2, "apll2_d2", "apll2", 1, 2), 6562306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL2_D4, "apll2_d4", "apll2", 1, 4), 6662306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL2_D8, "apll2_d8", "apll2", 1, 8), 6762306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D4, "mmpll_d4", "mmpll", 1, 4), 6862306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D4_D2, "mmpll_d4_d2", "mmpll_d4", 1, 2), 6962306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D5, "mmpll_d5", "mmpll", 1, 5), 7062306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D5_D2, "mmpll_d5_d2", "mmpll_d5", 1, 2), 7162306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D6, "mmpll_d6", "mmpll", 1, 6), 7262306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D6_D2, "mmpll_d6_d2", "mmpll_d6", 1, 2), 7362306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D7, "mmpll_d7", "mmpll", 1, 7), 7462306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D9, "mmpll_d9", "mmpll", 1, 9), 7562306a36Sopenharmony_ci FACTOR(CLK_TOP_APUPLL, "apupll_ck", "apupll", 1, 2), 7662306a36Sopenharmony_ci FACTOR(CLK_TOP_NPUPLL, "npupll_ck", "npupll", 1, 1), 7762306a36Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL, "tvdpll_ck", "tvdpll", 1, 1), 7862306a36Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D2, "tvdpll_d2", "tvdpll", 1, 2), 7962306a36Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D4, "tvdpll_d4", "tvdpll", 1, 4), 8062306a36Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D8, "tvdpll_d8", "tvdpll", 1, 8), 8162306a36Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D16, "tvdpll_d16", "tvdpll", 1, 16), 8262306a36Sopenharmony_ci FACTOR(CLK_TOP_MSDCPLL, "msdcpll_ck", "msdcpll", 1, 1), 8362306a36Sopenharmony_ci FACTOR(CLK_TOP_MSDCPLL_D2, "msdcpll_d2", "msdcpll", 1, 2), 8462306a36Sopenharmony_ci FACTOR(CLK_TOP_MSDCPLL_D4, "msdcpll_d4", "msdcpll", 1, 4), 8562306a36Sopenharmony_ci FACTOR(CLK_TOP_OSC_D2, "osc_d2", "ulposc", 1, 2), 8662306a36Sopenharmony_ci FACTOR(CLK_TOP_OSC_D4, "osc_d4", "ulposc", 1, 4), 8762306a36Sopenharmony_ci FACTOR(CLK_TOP_OSC_D8, "osc_d8", "ulposc", 1, 8), 8862306a36Sopenharmony_ci FACTOR(CLK_TOP_OSC_D10, "osc_d10", "ulposc", 1, 10), 8962306a36Sopenharmony_ci FACTOR(CLK_TOP_OSC_D16, "osc_d16", "ulposc", 1, 16), 9062306a36Sopenharmony_ci FACTOR(CLK_TOP_OSC_D20, "osc_d20", "ulposc", 1, 20), 9162306a36Sopenharmony_ci FACTOR(CLK_TOP_CSW_F26M_D2, "csw_f26m_d2", "clk26m", 1, 2), 9262306a36Sopenharmony_ci FACTOR(CLK_TOP_ADSPPLL, "adsppll_ck", "adsppll", 1, 1), 9362306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M, "univpll_192m", "univpll", 1, 13, 0), 9462306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M_D2, "univpll_192m_d2", "univpll_192m", 1, 2, 0), 9562306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M_D4, "univpll_192m_d4", "univpll_192m", 1, 4, 0), 9662306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M_D8, "univpll_192m_d8", "univpll_192m", 1, 8, 0), 9762306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M_D16, "univpll_192m_d16", "univpll_192m", 1, 16, 0), 9862306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M_D32, "univpll_192m_d32", "univpll_192m", 1, 32, 0), 9962306a36Sopenharmony_ci}; 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_cistatic const char * const axi_parents[] = { 10262306a36Sopenharmony_ci "clk26m", 10362306a36Sopenharmony_ci "mainpll_d4_d4", 10462306a36Sopenharmony_ci "mainpll_d7_d2", 10562306a36Sopenharmony_ci "mainpll_d4_d2", 10662306a36Sopenharmony_ci "mainpll_d5_d2", 10762306a36Sopenharmony_ci "mainpll_d6_d2", 10862306a36Sopenharmony_ci "osc_d4" 10962306a36Sopenharmony_ci}; 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_cistatic const char * const spm_parents[] = { 11262306a36Sopenharmony_ci "clk26m", 11362306a36Sopenharmony_ci "osc_d10", 11462306a36Sopenharmony_ci "mainpll_d7_d4", 11562306a36Sopenharmony_ci "clk32k" 11662306a36Sopenharmony_ci}; 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_cistatic const char * const scp_parents[] = { 11962306a36Sopenharmony_ci "clk26m", 12062306a36Sopenharmony_ci "univpll_d5", 12162306a36Sopenharmony_ci "mainpll_d6_d2", 12262306a36Sopenharmony_ci "mainpll_d6", 12362306a36Sopenharmony_ci "univpll_d6", 12462306a36Sopenharmony_ci "mainpll_d4_d2", 12562306a36Sopenharmony_ci "mainpll_d5_d2", 12662306a36Sopenharmony_ci "univpll_d4_d2" 12762306a36Sopenharmony_ci}; 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_cistatic const char * const bus_aximem_parents[] = { 13062306a36Sopenharmony_ci "clk26m", 13162306a36Sopenharmony_ci "mainpll_d7_d2", 13262306a36Sopenharmony_ci "mainpll_d4_d2", 13362306a36Sopenharmony_ci "mainpll_d5_d2", 13462306a36Sopenharmony_ci "mainpll_d6" 13562306a36Sopenharmony_ci}; 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_cistatic const char * const disp_parents[] = { 13862306a36Sopenharmony_ci "clk26m", 13962306a36Sopenharmony_ci "univpll_d6_d2", 14062306a36Sopenharmony_ci "mainpll_d5_d2", 14162306a36Sopenharmony_ci "mmpll_d6_d2", 14262306a36Sopenharmony_ci "univpll_d5_d2", 14362306a36Sopenharmony_ci "univpll_d4_d2", 14462306a36Sopenharmony_ci "mmpll_d7", 14562306a36Sopenharmony_ci "univpll_d6", 14662306a36Sopenharmony_ci "mainpll_d4", 14762306a36Sopenharmony_ci "mmpll_d5_d2" 14862306a36Sopenharmony_ci}; 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_cistatic const char * const mdp_parents[] = { 15162306a36Sopenharmony_ci "clk26m", 15262306a36Sopenharmony_ci "mainpll_d5_d2", 15362306a36Sopenharmony_ci "mmpll_d6_d2", 15462306a36Sopenharmony_ci "mainpll_d4_d2", 15562306a36Sopenharmony_ci "mmpll_d4_d2", 15662306a36Sopenharmony_ci "mainpll_d6", 15762306a36Sopenharmony_ci "univpll_d6", 15862306a36Sopenharmony_ci "mainpll_d4", 15962306a36Sopenharmony_ci "tvdpll_ck", 16062306a36Sopenharmony_ci "univpll_d4", 16162306a36Sopenharmony_ci "mmpll_d5_d2" 16262306a36Sopenharmony_ci}; 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_cistatic const char * const img_parents[] = { 16562306a36Sopenharmony_ci "clk26m", 16662306a36Sopenharmony_ci "univpll_d4", 16762306a36Sopenharmony_ci "tvdpll_ck", 16862306a36Sopenharmony_ci "mainpll_d4", 16962306a36Sopenharmony_ci "univpll_d5", 17062306a36Sopenharmony_ci "mmpll_d6", 17162306a36Sopenharmony_ci "univpll_d6", 17262306a36Sopenharmony_ci "mainpll_d6", 17362306a36Sopenharmony_ci "mmpll_d4_d2", 17462306a36Sopenharmony_ci "mainpll_d4_d2", 17562306a36Sopenharmony_ci "mmpll_d6_d2", 17662306a36Sopenharmony_ci "mmpll_d5_d2" 17762306a36Sopenharmony_ci}; 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_cistatic const char * const ipe_parents[] = { 18062306a36Sopenharmony_ci "clk26m", 18162306a36Sopenharmony_ci "mainpll_d4", 18262306a36Sopenharmony_ci "mmpll_d6", 18362306a36Sopenharmony_ci "univpll_d6", 18462306a36Sopenharmony_ci "mainpll_d6", 18562306a36Sopenharmony_ci "univpll_d4_d2", 18662306a36Sopenharmony_ci "mainpll_d4_d2", 18762306a36Sopenharmony_ci "mmpll_d6_d2", 18862306a36Sopenharmony_ci "mmpll_d5_d2" 18962306a36Sopenharmony_ci}; 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_cistatic const char * const dpe_parents[] = { 19262306a36Sopenharmony_ci "clk26m", 19362306a36Sopenharmony_ci "mainpll_d4", 19462306a36Sopenharmony_ci "mmpll_d6", 19562306a36Sopenharmony_ci "univpll_d6", 19662306a36Sopenharmony_ci "mainpll_d6", 19762306a36Sopenharmony_ci "univpll_d4_d2", 19862306a36Sopenharmony_ci "univpll_d5_d2", 19962306a36Sopenharmony_ci "mmpll_d6_d2" 20062306a36Sopenharmony_ci}; 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_cistatic const char * const cam_parents[] = { 20362306a36Sopenharmony_ci "clk26m", 20462306a36Sopenharmony_ci "mainpll_d4", 20562306a36Sopenharmony_ci "mmpll_d6", 20662306a36Sopenharmony_ci "univpll_d4", 20762306a36Sopenharmony_ci "univpll_d5", 20862306a36Sopenharmony_ci "univpll_d6", 20962306a36Sopenharmony_ci "mmpll_d7", 21062306a36Sopenharmony_ci "univpll_d4_d2", 21162306a36Sopenharmony_ci "mainpll_d4_d2", 21262306a36Sopenharmony_ci "univpll_d6_d2" 21362306a36Sopenharmony_ci}; 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_cistatic const char * const ccu_parents[] = { 21662306a36Sopenharmony_ci "clk26m", 21762306a36Sopenharmony_ci "mainpll_d4", 21862306a36Sopenharmony_ci "mmpll_d6", 21962306a36Sopenharmony_ci "mainpll_d6", 22062306a36Sopenharmony_ci "mmpll_d7", 22162306a36Sopenharmony_ci "univpll_d4_d2", 22262306a36Sopenharmony_ci "mmpll_d6_d2", 22362306a36Sopenharmony_ci "mmpll_d5_d2", 22462306a36Sopenharmony_ci "univpll_d5", 22562306a36Sopenharmony_ci "univpll_d6_d2" 22662306a36Sopenharmony_ci}; 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_cistatic const char * const dsp7_parents[] = { 22962306a36Sopenharmony_ci "clk26m", 23062306a36Sopenharmony_ci "mainpll_d4_d2", 23162306a36Sopenharmony_ci "mainpll_d6", 23262306a36Sopenharmony_ci "mmpll_d6", 23362306a36Sopenharmony_ci "univpll_d5", 23462306a36Sopenharmony_ci "mmpll_d5", 23562306a36Sopenharmony_ci "univpll_d4", 23662306a36Sopenharmony_ci "mmpll_d4" 23762306a36Sopenharmony_ci}; 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_cistatic const char * const mfg_ref_parents[] = { 24062306a36Sopenharmony_ci "clk26m", 24162306a36Sopenharmony_ci "clk26m", 24262306a36Sopenharmony_ci "univpll_d6", 24362306a36Sopenharmony_ci "mainpll_d5_d2" 24462306a36Sopenharmony_ci}; 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_cistatic const char * const mfg_pll_parents[] = { 24762306a36Sopenharmony_ci "mfg_ref_sel", 24862306a36Sopenharmony_ci "mfgpll" 24962306a36Sopenharmony_ci}; 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_cistatic const char * const camtg_parents[] = { 25262306a36Sopenharmony_ci "clk26m", 25362306a36Sopenharmony_ci "univpll_192m_d8", 25462306a36Sopenharmony_ci "univpll_d6_d8", 25562306a36Sopenharmony_ci "univpll_192m_d4", 25662306a36Sopenharmony_ci "univpll_d6_d16", 25762306a36Sopenharmony_ci "csw_f26m_d2", 25862306a36Sopenharmony_ci "univpll_192m_d16", 25962306a36Sopenharmony_ci "univpll_192m_d32" 26062306a36Sopenharmony_ci}; 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_cistatic const char * const uart_parents[] = { 26362306a36Sopenharmony_ci "clk26m", 26462306a36Sopenharmony_ci "univpll_d6_d8" 26562306a36Sopenharmony_ci}; 26662306a36Sopenharmony_ci 26762306a36Sopenharmony_cistatic const char * const spi_parents[] = { 26862306a36Sopenharmony_ci "clk26m", 26962306a36Sopenharmony_ci "mainpll_d5_d4", 27062306a36Sopenharmony_ci "mainpll_d6_d4", 27162306a36Sopenharmony_ci "msdcpll_d4" 27262306a36Sopenharmony_ci}; 27362306a36Sopenharmony_ci 27462306a36Sopenharmony_cistatic const char * const msdc50_0_h_parents[] = { 27562306a36Sopenharmony_ci "clk26m", 27662306a36Sopenharmony_ci "mainpll_d4_d2", 27762306a36Sopenharmony_ci "mainpll_d6_d2" 27862306a36Sopenharmony_ci}; 27962306a36Sopenharmony_ci 28062306a36Sopenharmony_cistatic const char * const msdc50_0_parents[] = { 28162306a36Sopenharmony_ci "clk26m", 28262306a36Sopenharmony_ci "msdcpll_ck", 28362306a36Sopenharmony_ci "msdcpll_d2", 28462306a36Sopenharmony_ci "univpll_d4_d4", 28562306a36Sopenharmony_ci "mainpll_d6_d2", 28662306a36Sopenharmony_ci "univpll_d4_d2" 28762306a36Sopenharmony_ci}; 28862306a36Sopenharmony_ci 28962306a36Sopenharmony_cistatic const char * const msdc30_parents[] = { 29062306a36Sopenharmony_ci "clk26m", 29162306a36Sopenharmony_ci "univpll_d6_d2", 29262306a36Sopenharmony_ci "mainpll_d6_d2", 29362306a36Sopenharmony_ci "mainpll_d7_d2", 29462306a36Sopenharmony_ci "msdcpll_d2" 29562306a36Sopenharmony_ci}; 29662306a36Sopenharmony_ci 29762306a36Sopenharmony_cistatic const char * const audio_parents[] = { 29862306a36Sopenharmony_ci "clk26m", 29962306a36Sopenharmony_ci "mainpll_d5_d8", 30062306a36Sopenharmony_ci "mainpll_d7_d8", 30162306a36Sopenharmony_ci "mainpll_d4_d16" 30262306a36Sopenharmony_ci}; 30362306a36Sopenharmony_ci 30462306a36Sopenharmony_cistatic const char * const aud_intbus_parents[] = { 30562306a36Sopenharmony_ci "clk26m", 30662306a36Sopenharmony_ci "mainpll_d4_d4", 30762306a36Sopenharmony_ci "mainpll_d7_d4" 30862306a36Sopenharmony_ci}; 30962306a36Sopenharmony_ci 31062306a36Sopenharmony_cistatic const char * const pwrap_ulposc_parents[] = { 31162306a36Sopenharmony_ci "osc_d10", 31262306a36Sopenharmony_ci "clk26m", 31362306a36Sopenharmony_ci "osc_d4", 31462306a36Sopenharmony_ci "osc_d8", 31562306a36Sopenharmony_ci "osc_d16" 31662306a36Sopenharmony_ci}; 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_cistatic const char * const atb_parents[] = { 31962306a36Sopenharmony_ci "clk26m", 32062306a36Sopenharmony_ci "mainpll_d4_d2", 32162306a36Sopenharmony_ci "mainpll_d5_d2" 32262306a36Sopenharmony_ci}; 32362306a36Sopenharmony_ci 32462306a36Sopenharmony_cistatic const char * const dpi_parents[] = { 32562306a36Sopenharmony_ci "clk26m", 32662306a36Sopenharmony_ci "tvdpll_d2", 32762306a36Sopenharmony_ci "tvdpll_d4", 32862306a36Sopenharmony_ci "tvdpll_d8", 32962306a36Sopenharmony_ci "tvdpll_d16" 33062306a36Sopenharmony_ci}; 33162306a36Sopenharmony_ci 33262306a36Sopenharmony_cistatic const char * const scam_parents[] = { 33362306a36Sopenharmony_ci "clk26m", 33462306a36Sopenharmony_ci "mainpll_d5_d4" 33562306a36Sopenharmony_ci}; 33662306a36Sopenharmony_ci 33762306a36Sopenharmony_cistatic const char * const disp_pwm_parents[] = { 33862306a36Sopenharmony_ci "clk26m", 33962306a36Sopenharmony_ci "univpll_d6_d4", 34062306a36Sopenharmony_ci "osc_d2", 34162306a36Sopenharmony_ci "osc_d4", 34262306a36Sopenharmony_ci "osc_d16" 34362306a36Sopenharmony_ci}; 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_cistatic const char * const usb_top_parents[] = { 34662306a36Sopenharmony_ci "clk26m", 34762306a36Sopenharmony_ci "univpll_d5_d4", 34862306a36Sopenharmony_ci "univpll_d6_d4", 34962306a36Sopenharmony_ci "univpll_d5_d2" 35062306a36Sopenharmony_ci}; 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_cistatic const char * const ssusb_xhci_parents[] = { 35362306a36Sopenharmony_ci "clk26m", 35462306a36Sopenharmony_ci "univpll_d5_d4", 35562306a36Sopenharmony_ci "univpll_d6_d4", 35662306a36Sopenharmony_ci "univpll_d5_d2" 35762306a36Sopenharmony_ci}; 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_cistatic const char * const i2c_parents[] = { 36062306a36Sopenharmony_ci "clk26m", 36162306a36Sopenharmony_ci "mainpll_d4_d8", 36262306a36Sopenharmony_ci "univpll_d5_d4" 36362306a36Sopenharmony_ci}; 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_cistatic const char * const seninf_parents[] = { 36662306a36Sopenharmony_ci "clk26m", 36762306a36Sopenharmony_ci "univpll_d4_d4", 36862306a36Sopenharmony_ci "univpll_d6_d2", 36962306a36Sopenharmony_ci "univpll_d4_d2", 37062306a36Sopenharmony_ci "univpll_d7", 37162306a36Sopenharmony_ci "univpll_d6", 37262306a36Sopenharmony_ci "mmpll_d6", 37362306a36Sopenharmony_ci "univpll_d5" 37462306a36Sopenharmony_ci}; 37562306a36Sopenharmony_ci 37662306a36Sopenharmony_cistatic const char * const tl_parents[] = { 37762306a36Sopenharmony_ci "clk26m", 37862306a36Sopenharmony_ci "univpll_192m_d2", 37962306a36Sopenharmony_ci "mainpll_d6_d4" 38062306a36Sopenharmony_ci}; 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_cistatic const char * const dxcc_parents[] = { 38362306a36Sopenharmony_ci "clk26m", 38462306a36Sopenharmony_ci "mainpll_d4_d2", 38562306a36Sopenharmony_ci "mainpll_d4_d4", 38662306a36Sopenharmony_ci "mainpll_d4_d8" 38762306a36Sopenharmony_ci}; 38862306a36Sopenharmony_ci 38962306a36Sopenharmony_cistatic const char * const aud_engen1_parents[] = { 39062306a36Sopenharmony_ci "clk26m", 39162306a36Sopenharmony_ci "apll1_d2", 39262306a36Sopenharmony_ci "apll1_d4", 39362306a36Sopenharmony_ci "apll1_d8" 39462306a36Sopenharmony_ci}; 39562306a36Sopenharmony_ci 39662306a36Sopenharmony_cistatic const char * const aud_engen2_parents[] = { 39762306a36Sopenharmony_ci "clk26m", 39862306a36Sopenharmony_ci "apll2_d2", 39962306a36Sopenharmony_ci "apll2_d4", 40062306a36Sopenharmony_ci "apll2_d8" 40162306a36Sopenharmony_ci}; 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_cistatic const char * const aes_ufsfde_parents[] = { 40462306a36Sopenharmony_ci "clk26m", 40562306a36Sopenharmony_ci "mainpll_d4", 40662306a36Sopenharmony_ci "mainpll_d4_d2", 40762306a36Sopenharmony_ci "mainpll_d6", 40862306a36Sopenharmony_ci "mainpll_d4_d4", 40962306a36Sopenharmony_ci "univpll_d4_d2", 41062306a36Sopenharmony_ci "univpll_d6" 41162306a36Sopenharmony_ci}; 41262306a36Sopenharmony_ci 41362306a36Sopenharmony_cistatic const char * const ufs_parents[] = { 41462306a36Sopenharmony_ci "clk26m", 41562306a36Sopenharmony_ci "mainpll_d4_d4", 41662306a36Sopenharmony_ci "mainpll_d4_d8", 41762306a36Sopenharmony_ci "univpll_d4_d4", 41862306a36Sopenharmony_ci "mainpll_d6_d2", 41962306a36Sopenharmony_ci "mainpll_d5_d2", 42062306a36Sopenharmony_ci "msdcpll_d2" 42162306a36Sopenharmony_ci}; 42262306a36Sopenharmony_ci 42362306a36Sopenharmony_cistatic const char * const aud_1_parents[] = { 42462306a36Sopenharmony_ci "clk26m", 42562306a36Sopenharmony_ci "apll1_ck" 42662306a36Sopenharmony_ci}; 42762306a36Sopenharmony_ci 42862306a36Sopenharmony_cistatic const char * const aud_2_parents[] = { 42962306a36Sopenharmony_ci "clk26m", 43062306a36Sopenharmony_ci "apll2_ck" 43162306a36Sopenharmony_ci}; 43262306a36Sopenharmony_ci 43362306a36Sopenharmony_cistatic const char * const adsp_parents[] = { 43462306a36Sopenharmony_ci "clk26m", 43562306a36Sopenharmony_ci "mainpll_d6", 43662306a36Sopenharmony_ci "mainpll_d5_d2", 43762306a36Sopenharmony_ci "univpll_d4_d4", 43862306a36Sopenharmony_ci "univpll_d4", 43962306a36Sopenharmony_ci "univpll_d6", 44062306a36Sopenharmony_ci "ulposc", 44162306a36Sopenharmony_ci "adsppll_ck" 44262306a36Sopenharmony_ci}; 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_cistatic const char * const dpmaif_main_parents[] = { 44562306a36Sopenharmony_ci "clk26m", 44662306a36Sopenharmony_ci "univpll_d4_d4", 44762306a36Sopenharmony_ci "mainpll_d6", 44862306a36Sopenharmony_ci "mainpll_d4_d2", 44962306a36Sopenharmony_ci "univpll_d4_d2" 45062306a36Sopenharmony_ci}; 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_cistatic const char * const venc_parents[] = { 45362306a36Sopenharmony_ci "clk26m", 45462306a36Sopenharmony_ci "mmpll_d7", 45562306a36Sopenharmony_ci "mainpll_d6", 45662306a36Sopenharmony_ci "univpll_d4_d2", 45762306a36Sopenharmony_ci "mainpll_d4_d2", 45862306a36Sopenharmony_ci "univpll_d6", 45962306a36Sopenharmony_ci "mmpll_d6", 46062306a36Sopenharmony_ci "mainpll_d5_d2", 46162306a36Sopenharmony_ci "mainpll_d6_d2", 46262306a36Sopenharmony_ci "mmpll_d9", 46362306a36Sopenharmony_ci "univpll_d4_d4", 46462306a36Sopenharmony_ci "mainpll_d4", 46562306a36Sopenharmony_ci "univpll_d4", 46662306a36Sopenharmony_ci "univpll_d5", 46762306a36Sopenharmony_ci "univpll_d5_d2", 46862306a36Sopenharmony_ci "mainpll_d5" 46962306a36Sopenharmony_ci}; 47062306a36Sopenharmony_ci 47162306a36Sopenharmony_cistatic const char * const vdec_parents[] = { 47262306a36Sopenharmony_ci "clk26m", 47362306a36Sopenharmony_ci "univpll_192m_d2", 47462306a36Sopenharmony_ci "univpll_d5_d4", 47562306a36Sopenharmony_ci "mainpll_d5", 47662306a36Sopenharmony_ci "mainpll_d5_d2", 47762306a36Sopenharmony_ci "mmpll_d6_d2", 47862306a36Sopenharmony_ci "univpll_d5_d2", 47962306a36Sopenharmony_ci "mainpll_d4_d2", 48062306a36Sopenharmony_ci "univpll_d4_d2", 48162306a36Sopenharmony_ci "univpll_d7", 48262306a36Sopenharmony_ci "mmpll_d7", 48362306a36Sopenharmony_ci "mmpll_d6", 48462306a36Sopenharmony_ci "univpll_d5", 48562306a36Sopenharmony_ci "mainpll_d4", 48662306a36Sopenharmony_ci "univpll_d4", 48762306a36Sopenharmony_ci "univpll_d6" 48862306a36Sopenharmony_ci}; 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_cistatic const char * const camtm_parents[] = { 49162306a36Sopenharmony_ci "clk26m", 49262306a36Sopenharmony_ci "univpll_d7", 49362306a36Sopenharmony_ci "univpll_d6_d2", 49462306a36Sopenharmony_ci "univpll_d4_d2" 49562306a36Sopenharmony_ci}; 49662306a36Sopenharmony_ci 49762306a36Sopenharmony_cistatic const char * const pwm_parents[] = { 49862306a36Sopenharmony_ci "clk26m", 49962306a36Sopenharmony_ci "univpll_d4_d8" 50062306a36Sopenharmony_ci}; 50162306a36Sopenharmony_ci 50262306a36Sopenharmony_cistatic const char * const audio_h_parents[] = { 50362306a36Sopenharmony_ci "clk26m", 50462306a36Sopenharmony_ci "univpll_d7", 50562306a36Sopenharmony_ci "apll1_ck", 50662306a36Sopenharmony_ci "apll2_ck" 50762306a36Sopenharmony_ci}; 50862306a36Sopenharmony_ci 50962306a36Sopenharmony_cistatic const char * const spmi_mst_parents[] = { 51062306a36Sopenharmony_ci "clk26m", 51162306a36Sopenharmony_ci "csw_f26m_d2", 51262306a36Sopenharmony_ci "osc_d8", 51362306a36Sopenharmony_ci "osc_d10", 51462306a36Sopenharmony_ci "osc_d16", 51562306a36Sopenharmony_ci "osc_d20", 51662306a36Sopenharmony_ci "clk32k" 51762306a36Sopenharmony_ci}; 51862306a36Sopenharmony_ci 51962306a36Sopenharmony_cistatic const char * const aes_msdcfde_parents[] = { 52062306a36Sopenharmony_ci "clk26m", 52162306a36Sopenharmony_ci "mainpll_d4_d2", 52262306a36Sopenharmony_ci "mainpll_d6", 52362306a36Sopenharmony_ci "mainpll_d4_d4", 52462306a36Sopenharmony_ci "univpll_d4_d2", 52562306a36Sopenharmony_ci "univpll_d6" 52662306a36Sopenharmony_ci}; 52762306a36Sopenharmony_ci 52862306a36Sopenharmony_cistatic const char * const sflash_parents[] = { 52962306a36Sopenharmony_ci "clk26m", 53062306a36Sopenharmony_ci "mainpll_d7_d8", 53162306a36Sopenharmony_ci "univpll_d6_d8", 53262306a36Sopenharmony_ci "univpll_d5_d8" 53362306a36Sopenharmony_ci}; 53462306a36Sopenharmony_ci 53562306a36Sopenharmony_cistatic const char * const apll_i2s_m_parents[] = { 53662306a36Sopenharmony_ci "aud_1_sel", 53762306a36Sopenharmony_ci "aud_2_sel" 53862306a36Sopenharmony_ci}; 53962306a36Sopenharmony_ci 54062306a36Sopenharmony_ci/* 54162306a36Sopenharmony_ci * CRITICAL CLOCK: 54262306a36Sopenharmony_ci * axi_sel is the main bus clock of whole SOC. 54362306a36Sopenharmony_ci * spm_sel is the clock of the always-on co-processor. 54462306a36Sopenharmony_ci * bus_aximem_sel is clock of the bus that access emi. 54562306a36Sopenharmony_ci */ 54662306a36Sopenharmony_cistatic const struct mtk_mux top_mtk_muxes[] = { 54762306a36Sopenharmony_ci /* CLK_CFG_0 */ 54862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_AXI_SEL, "axi_sel", 54962306a36Sopenharmony_ci axi_parents, 0x010, 0x014, 0x018, 0, 3, 7, 0x004, 0, 55062306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 55162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SPM_SEL, "spm_sel", 55262306a36Sopenharmony_ci spm_parents, 0x010, 0x014, 0x018, 8, 2, 15, 0x004, 1, 55362306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 55462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SCP_SEL, "scp_sel", 55562306a36Sopenharmony_ci scp_parents, 0x010, 0x014, 0x018, 16, 3, 23, 0x004, 2), 55662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_BUS_AXIMEM_SEL, "bus_aximem_sel", 55762306a36Sopenharmony_ci bus_aximem_parents, 0x010, 0x014, 0x018, 24, 3, 31, 0x004, 3, 55862306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 55962306a36Sopenharmony_ci /* CLK_CFG_1 */ 56062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_DISP_SEL, "disp_sel", 56162306a36Sopenharmony_ci disp_parents, 0x020, 0x024, 0x028, 0, 4, 7, 0x004, 4), 56262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MDP_SEL, "mdp_sel", 56362306a36Sopenharmony_ci mdp_parents, 0x020, 0x024, 0x028, 8, 4, 15, 0x004, 5), 56462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_IMG1_SEL, "img1_sel", 56562306a36Sopenharmony_ci img_parents, 0x020, 0x024, 0x028, 16, 4, 23, 0x004, 6), 56662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_IMG2_SEL, "img2_sel", 56762306a36Sopenharmony_ci img_parents, 0x020, 0x024, 0x028, 24, 4, 31, 0x004, 7), 56862306a36Sopenharmony_ci /* CLK_CFG_2 */ 56962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_IPE_SEL, "ipe_sel", 57062306a36Sopenharmony_ci ipe_parents, 0x030, 0x034, 0x038, 0, 4, 7, 0x004, 8), 57162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_DPE_SEL, "dpe_sel", 57262306a36Sopenharmony_ci dpe_parents, 0x030, 0x034, 0x038, 8, 3, 15, 0x004, 9), 57362306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_CAM_SEL, "cam_sel", 57462306a36Sopenharmony_ci cam_parents, 0x030, 0x034, 0x038, 16, 4, 23, 0x004, 10), 57562306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_CCU_SEL, "ccu_sel", 57662306a36Sopenharmony_ci ccu_parents, 0x030, 0x034, 0x038, 24, 4, 31, 0x004, 11), 57762306a36Sopenharmony_ci /* CLK_CFG_4 */ 57862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_DSP7_SEL, "dsp7_sel", 57962306a36Sopenharmony_ci dsp7_parents, 0x050, 0x054, 0x058, 0, 3, 7, 0x004, 16), 58062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MFG_REF_SEL, "mfg_ref_sel", 58162306a36Sopenharmony_ci mfg_ref_parents, 0x050, 0x054, 0x058, 16, 2, 23, 0x004, 18), 58262306a36Sopenharmony_ci MUX_CLR_SET_UPD(CLK_TOP_MFG_PLL_SEL, "mfg_pll_sel", 58362306a36Sopenharmony_ci mfg_pll_parents, 0x050, 0x054, 0x058, 18, 1, -1, -1), 58462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG_SEL, "camtg_sel", 58562306a36Sopenharmony_ci camtg_parents, 0x050, 0x054, 0x058, 24, 3, 31, 0x004, 19), 58662306a36Sopenharmony_ci /* CLK_CFG_5 */ 58762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG2_SEL, "camtg2_sel", 58862306a36Sopenharmony_ci camtg_parents, 0x060, 0x064, 0x068, 0, 3, 7, 0x004, 20), 58962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG3_SEL, "camtg3_sel", 59062306a36Sopenharmony_ci camtg_parents, 0x060, 0x064, 0x068, 8, 3, 15, 0x004, 21), 59162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG4_SEL, "camtg4_sel", 59262306a36Sopenharmony_ci camtg_parents, 0x060, 0x064, 0x068, 16, 3, 23, 0x004, 22), 59362306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG5_SEL, "camtg5_sel", 59462306a36Sopenharmony_ci camtg_parents, 0x060, 0x064, 0x068, 24, 3, 31, 0x004, 23), 59562306a36Sopenharmony_ci /* CLK_CFG_6 */ 59662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG6_SEL, "camtg6_sel", 59762306a36Sopenharmony_ci camtg_parents, 0x070, 0x074, 0x078, 0, 3, 7, 0x004, 24), 59862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_UART_SEL, "uart_sel", 59962306a36Sopenharmony_ci uart_parents, 0x070, 0x074, 0x078, 8, 1, 15, 0x004, 25), 60062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SPI_SEL, "spi_sel", 60162306a36Sopenharmony_ci spi_parents, 0x070, 0x074, 0x078, 16, 2, 23, 0x004, 26), 60262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_H_SEL, "msdc50_0_h_sel", 60362306a36Sopenharmony_ci msdc50_0_h_parents, 0x070, 0x074, 0x078, 24, 2, 60462306a36Sopenharmony_ci 31, 0x004, 27, 0), 60562306a36Sopenharmony_ci /* CLK_CFG_7 */ 60662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel", 60762306a36Sopenharmony_ci msdc50_0_parents, 0x080, 0x084, 0x088, 0, 3, 7, 0x004, 28, 0), 60862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel", 60962306a36Sopenharmony_ci msdc30_parents, 0x080, 0x084, 0x088, 8, 3, 15, 0x004, 29, 0), 61062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_2_SEL, "msdc30_2_sel", 61162306a36Sopenharmony_ci msdc30_parents, 0x080, 0x084, 0x088, 16, 3, 23, 0x004, 30, 0), 61262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_AUDIO_SEL, "audio_sel", 61362306a36Sopenharmony_ci audio_parents, 0x080, 0x084, 0x088, 24, 2, 31, 0x008, 0), 61462306a36Sopenharmony_ci /* CLK_CFG_8 */ 61562306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_INTBUS_SEL, "aud_intbus_sel", 61662306a36Sopenharmony_ci aud_intbus_parents, 0x090, 0x094, 0x098, 0, 2, 7, 0x008, 1), 61762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_PWRAP_ULPOSC_SEL, "pwrap_ulposc_sel", 61862306a36Sopenharmony_ci pwrap_ulposc_parents, 0x090, 0x094, 0x098, 8, 3, 15, 0x008, 2), 61962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_ATB_SEL, "atb_sel", 62062306a36Sopenharmony_ci atb_parents, 0x090, 0x094, 0x098, 16, 2, 23, 0x008, 3), 62162306a36Sopenharmony_ci /* CLK_CFG_9 */ 62262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_DPI_SEL, "dpi_sel", 62362306a36Sopenharmony_ci dpi_parents, 0x0a0, 0x0a4, 0x0a8, 0, 3, 7, 0x008, 5), 62462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SCAM_SEL, "scam_sel", 62562306a36Sopenharmony_ci scam_parents, 0x0a0, 0x0a4, 0x0a8, 8, 1, 15, 0x008, 6), 62662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_DISP_PWM_SEL, "disp_pwm_sel", 62762306a36Sopenharmony_ci disp_pwm_parents, 0x0a0, 0x0a4, 0x0a8, 16, 3, 23, 0x008, 7), 62862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_USB_TOP_SEL, "usb_top_sel", 62962306a36Sopenharmony_ci usb_top_parents, 0x0a0, 0x0a4, 0x0a8, 24, 2, 31, 0x008, 8), 63062306a36Sopenharmony_ci /* CLK_CFG_10 */ 63162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SSUSB_XHCI_SEL, "ssusb_xhci_sel", 63262306a36Sopenharmony_ci ssusb_xhci_parents, 0x0b0, 0x0b4, 0x0b8, 0, 2, 7, 0x008, 9), 63362306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_I2C_SEL, "i2c_sel", 63462306a36Sopenharmony_ci i2c_parents, 0x0b0, 0x0b4, 0x0b8, 8, 2, 15, 0x008, 10), 63562306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SENINF_SEL, "seninf_sel", 63662306a36Sopenharmony_ci seninf_parents, 0x0b0, 0x0b4, 0x0b8, 16, 3, 23, 0x008, 11), 63762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SENINF1_SEL, "seninf1_sel", 63862306a36Sopenharmony_ci seninf_parents, 0x0b0, 0x0b4, 0x0b8, 24, 3, 31, 0x008, 12), 63962306a36Sopenharmony_ci /* CLK_CFG_11 */ 64062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SENINF2_SEL, "seninf2_sel", 64162306a36Sopenharmony_ci seninf_parents, 0x0c0, 0x0c4, 0x0c8, 0, 3, 7, 0x008, 13), 64262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SENINF3_SEL, "seninf3_sel", 64362306a36Sopenharmony_ci seninf_parents, 0x0c0, 0x0c4, 0x0c8, 8, 3, 15, 0x008, 14), 64462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_TL_SEL, "tl_sel", 64562306a36Sopenharmony_ci tl_parents, 0x0c0, 0x0c4, 0x0c8, 16, 2, 23, 0x008, 15), 64662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_DXCC_SEL, "dxcc_sel", 64762306a36Sopenharmony_ci dxcc_parents, 0x0c0, 0x0c4, 0x0c8, 24, 2, 31, 0x008, 16), 64862306a36Sopenharmony_ci /* CLK_CFG_12 */ 64962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_ENGEN1_SEL, "aud_engen1_sel", 65062306a36Sopenharmony_ci aud_engen1_parents, 0x0d0, 0x0d4, 0x0d8, 0, 2, 7, 0x008, 17), 65162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_ENGEN2_SEL, "aud_engen2_sel", 65262306a36Sopenharmony_ci aud_engen2_parents, 0x0d0, 0x0d4, 0x0d8, 8, 2, 15, 0x008, 18), 65362306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_AES_UFSFDE_SEL, "aes_ufsfde_sel", 65462306a36Sopenharmony_ci aes_ufsfde_parents, 0x0d0, 0x0d4, 0x0d8, 16, 3, 23, 0x008, 19), 65562306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_UFS_SEL, "ufs_sel", 65662306a36Sopenharmony_ci ufs_parents, 0x0d0, 0x0d4, 0x0d8, 24, 3, 31, 0x008, 20), 65762306a36Sopenharmony_ci /* CLK_CFG_13 */ 65862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_1_SEL, "aud_1_sel", 65962306a36Sopenharmony_ci aud_1_parents, 0x0e0, 0x0e4, 0x0e8, 0, 1, 7, 0x008, 21), 66062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_2_SEL, "aud_2_sel", 66162306a36Sopenharmony_ci aud_2_parents, 0x0e0, 0x0e4, 0x0e8, 8, 1, 15, 0x008, 22), 66262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_ADSP_SEL, "adsp_sel", 66362306a36Sopenharmony_ci adsp_parents, 0x0e0, 0x0e4, 0x0e8, 16, 3, 23, 0x008, 23), 66462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_DPMAIF_MAIN_SEL, "dpmaif_main_sel", 66562306a36Sopenharmony_ci dpmaif_main_parents, 0x0e0, 0x0e4, 0x0e8, 24, 3, 31, 0x008, 24), 66662306a36Sopenharmony_ci /* CLK_CFG_14 */ 66762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_VENC_SEL, "venc_sel", 66862306a36Sopenharmony_ci venc_parents, 0x0f0, 0x0f4, 0x0f8, 0, 4, 7, 0x008, 25), 66962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_VDEC_SEL, "vdec_sel", 67062306a36Sopenharmony_ci vdec_parents, 0x0f0, 0x0f4, 0x0f8, 8, 4, 15, 0x008, 26), 67162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTM_SEL, "camtm_sel", 67262306a36Sopenharmony_ci camtm_parents, 0x0f0, 0x0f4, 0x0f8, 16, 2, 23, 0x008, 27), 67362306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_PWM_SEL, "pwm_sel", 67462306a36Sopenharmony_ci pwm_parents, 0x0f0, 0x0f4, 0x0f8, 24, 1, 31, 0x008, 28), 67562306a36Sopenharmony_ci /* CLK_CFG_15 */ 67662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_AUDIO_H_SEL, "audio_h_sel", 67762306a36Sopenharmony_ci audio_h_parents, 0x100, 0x104, 0x108, 0, 2, 7, 0x008, 29), 67862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SPMI_MST_SEL, "spmi_mst_sel", 67962306a36Sopenharmony_ci spmi_mst_parents, 0x100, 0x104, 0x108, 8, 3, 15, 0x008, 30), 68062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_AES_MSDCFDE_SEL, "aes_msdcfde_sel", 68162306a36Sopenharmony_ci aes_msdcfde_parents, 0x100, 0x104, 0x108, 24, 3, 31, 0x00c, 1), 68262306a36Sopenharmony_ci /* CLK_CFG_16 */ 68362306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_SFLASH_SEL, "sflash_sel", 68462306a36Sopenharmony_ci sflash_parents, 0x110, 0x114, 0x118, 8, 2, 15, 0x00c, 3), 68562306a36Sopenharmony_ci}; 68662306a36Sopenharmony_ci 68762306a36Sopenharmony_cistatic struct mtk_composite top_muxes[] = { 68862306a36Sopenharmony_ci /* CLK_AUDDIV_0 */ 68962306a36Sopenharmony_ci MUX(CLK_TOP_APLL_I2S0_M_SEL, "apll_i2s0_m_sel", apll_i2s_m_parents, 0x320, 16, 1), 69062306a36Sopenharmony_ci MUX(CLK_TOP_APLL_I2S1_M_SEL, "apll_i2s1_m_sel", apll_i2s_m_parents, 0x320, 17, 1), 69162306a36Sopenharmony_ci MUX(CLK_TOP_APLL_I2S2_M_SEL, "apll_i2s2_m_sel", apll_i2s_m_parents, 0x320, 18, 1), 69262306a36Sopenharmony_ci MUX(CLK_TOP_APLL_I2S3_M_SEL, "apll_i2s3_m_sel", apll_i2s_m_parents, 0x320, 19, 1), 69362306a36Sopenharmony_ci MUX(CLK_TOP_APLL_I2S4_M_SEL, "apll_i2s4_m_sel", apll_i2s_m_parents, 0x320, 20, 1), 69462306a36Sopenharmony_ci MUX(CLK_TOP_APLL_I2S5_M_SEL, "apll_i2s5_m_sel", apll_i2s_m_parents, 0x320, 21, 1), 69562306a36Sopenharmony_ci MUX(CLK_TOP_APLL_I2S6_M_SEL, "apll_i2s6_m_sel", apll_i2s_m_parents, 0x320, 22, 1), 69662306a36Sopenharmony_ci MUX(CLK_TOP_APLL_I2S7_M_SEL, "apll_i2s7_m_sel", apll_i2s_m_parents, 0x320, 23, 1), 69762306a36Sopenharmony_ci MUX(CLK_TOP_APLL_I2S8_M_SEL, "apll_i2s8_m_sel", apll_i2s_m_parents, 0x320, 24, 1), 69862306a36Sopenharmony_ci MUX(CLK_TOP_APLL_I2S9_M_SEL, "apll_i2s9_m_sel", apll_i2s_m_parents, 0x320, 25, 1), 69962306a36Sopenharmony_ci /* APLL_DIV */ 70062306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV0, "apll12_div0", "apll_i2s0_m_sel", 0x320, 0, 0x328, 8, 0), 70162306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV1, "apll12_div1", "apll_i2s1_m_sel", 0x320, 1, 0x328, 8, 8), 70262306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV2, "apll12_div2", "apll_i2s2_m_sel", 0x320, 2, 0x328, 8, 16), 70362306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV3, "apll12_div3", "apll_i2s3_m_sel", 0x320, 3, 0x328, 8, 24), 70462306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV4, "apll12_div4", "apll_i2s4_m_sel", 0x320, 4, 0x334, 8, 0), 70562306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIVB, "apll12_divb", "apll12_div4", 0x320, 5, 0x334, 8, 8), 70662306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV5, "apll12_div5", "apll_i2s5_m_sel", 0x320, 6, 0x334, 8, 16), 70762306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV6, "apll12_div6", "apll_i2s6_m_sel", 0x320, 7, 0x334, 8, 24), 70862306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV7, "apll12_div7", "apll_i2s7_m_sel", 0x320, 8, 0x338, 8, 0), 70962306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV8, "apll12_div8", "apll_i2s8_m_sel", 0x320, 9, 0x338, 8, 8), 71062306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV9, "apll12_div9", "apll_i2s9_m_sel", 0x320, 10, 0x338, 8, 16), 71162306a36Sopenharmony_ci}; 71262306a36Sopenharmony_ci 71362306a36Sopenharmony_cistatic const struct mtk_gate_regs infra0_cg_regs = { 71462306a36Sopenharmony_ci .set_ofs = 0x80, 71562306a36Sopenharmony_ci .clr_ofs = 0x84, 71662306a36Sopenharmony_ci .sta_ofs = 0x90, 71762306a36Sopenharmony_ci}; 71862306a36Sopenharmony_ci 71962306a36Sopenharmony_cistatic const struct mtk_gate_regs infra1_cg_regs = { 72062306a36Sopenharmony_ci .set_ofs = 0x88, 72162306a36Sopenharmony_ci .clr_ofs = 0x8c, 72262306a36Sopenharmony_ci .sta_ofs = 0x94, 72362306a36Sopenharmony_ci}; 72462306a36Sopenharmony_ci 72562306a36Sopenharmony_cistatic const struct mtk_gate_regs infra2_cg_regs = { 72662306a36Sopenharmony_ci .set_ofs = 0xa4, 72762306a36Sopenharmony_ci .clr_ofs = 0xa8, 72862306a36Sopenharmony_ci .sta_ofs = 0xac, 72962306a36Sopenharmony_ci}; 73062306a36Sopenharmony_ci 73162306a36Sopenharmony_cistatic const struct mtk_gate_regs infra3_cg_regs = { 73262306a36Sopenharmony_ci .set_ofs = 0xc0, 73362306a36Sopenharmony_ci .clr_ofs = 0xc4, 73462306a36Sopenharmony_ci .sta_ofs = 0xc8, 73562306a36Sopenharmony_ci}; 73662306a36Sopenharmony_ci 73762306a36Sopenharmony_cistatic const struct mtk_gate_regs infra4_cg_regs = { 73862306a36Sopenharmony_ci .set_ofs = 0xd0, 73962306a36Sopenharmony_ci .clr_ofs = 0xd4, 74062306a36Sopenharmony_ci .sta_ofs = 0xd8, 74162306a36Sopenharmony_ci}; 74262306a36Sopenharmony_ci 74362306a36Sopenharmony_cistatic const struct mtk_gate_regs infra5_cg_regs = { 74462306a36Sopenharmony_ci .set_ofs = 0xe0, 74562306a36Sopenharmony_ci .clr_ofs = 0xe4, 74662306a36Sopenharmony_ci .sta_ofs = 0xe8, 74762306a36Sopenharmony_ci}; 74862306a36Sopenharmony_ci 74962306a36Sopenharmony_ci#define GATE_INFRA0(_id, _name, _parent, _shift) \ 75062306a36Sopenharmony_ci GATE_MTK(_id, _name, _parent, &infra0_cg_regs, _shift, &mtk_clk_gate_ops_setclr) 75162306a36Sopenharmony_ci 75262306a36Sopenharmony_ci#define GATE_INFRA1_FLAGS(_id, _name, _parent, _shift, _flag) \ 75362306a36Sopenharmony_ci GATE_MTK_FLAGS(_id, _name, _parent, &infra1_cg_regs, _shift, \ 75462306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr, _flag) 75562306a36Sopenharmony_ci 75662306a36Sopenharmony_ci#define GATE_INFRA1(_id, _name, _parent, _shift) \ 75762306a36Sopenharmony_ci GATE_INFRA1_FLAGS(_id, _name, _parent, _shift, 0) 75862306a36Sopenharmony_ci 75962306a36Sopenharmony_ci#define GATE_INFRA2(_id, _name, _parent, _shift) \ 76062306a36Sopenharmony_ci GATE_MTK(_id, _name, _parent, &infra2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) 76162306a36Sopenharmony_ci 76262306a36Sopenharmony_ci#define GATE_INFRA3_FLAGS(_id, _name, _parent, _shift, _flag) \ 76362306a36Sopenharmony_ci GATE_MTK_FLAGS(_id, _name, _parent, &infra3_cg_regs, _shift, \ 76462306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr, _flag) 76562306a36Sopenharmony_ci 76662306a36Sopenharmony_ci#define GATE_INFRA3(_id, _name, _parent, _shift) \ 76762306a36Sopenharmony_ci GATE_INFRA3_FLAGS(_id, _name, _parent, _shift, 0) 76862306a36Sopenharmony_ci 76962306a36Sopenharmony_ci#define GATE_INFRA4(_id, _name, _parent, _shift) \ 77062306a36Sopenharmony_ci GATE_MTK(_id, _name, _parent, &infra4_cg_regs, _shift, &mtk_clk_gate_ops_setclr) 77162306a36Sopenharmony_ci 77262306a36Sopenharmony_ci#define GATE_INFRA5_FLAGS(_id, _name, _parent, _shift, _flag) \ 77362306a36Sopenharmony_ci GATE_MTK_FLAGS(_id, _name, _parent, &infra5_cg_regs, _shift, \ 77462306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr, _flag) 77562306a36Sopenharmony_ci 77662306a36Sopenharmony_ci#define GATE_INFRA5(_id, _name, _parent, _shift) \ 77762306a36Sopenharmony_ci GATE_INFRA5_FLAGS(_id, _name, _parent, _shift, 0) 77862306a36Sopenharmony_ci 77962306a36Sopenharmony_ci/* 78062306a36Sopenharmony_ci * CRITICAL CLOCK: 78162306a36Sopenharmony_ci * infra_133m and infra_66m are main peripheral bus clocks of SOC. 78262306a36Sopenharmony_ci * infra_device_apc and infra_device_apc_sync are for device access permission control module. 78362306a36Sopenharmony_ci */ 78462306a36Sopenharmony_cistatic const struct mtk_gate infra_clks[] = { 78562306a36Sopenharmony_ci /* INFRA0 */ 78662306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PMIC_TMR, "infra_pmic_tmr", "pwrap_ulposc_sel", 0), 78762306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PMIC_AP, "infra_pmic_ap", "pwrap_ulposc_sel", 1), 78862306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PMIC_MD, "infra_pmic_md", "pwrap_ulposc_sel", 2), 78962306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PMIC_CONN, "infra_pmic_conn", "pwrap_ulposc_sel", 3), 79062306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_SCPSYS, "infra_scpsys", "scp_sel", 4), 79162306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_SEJ, "infra_sej", "axi_sel", 5), 79262306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_APXGPT, "infra_apxgpt", "axi_sel", 6), 79362306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_GCE, "infra_gce", "axi_sel", 8), 79462306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_GCE2, "infra_gce2", "axi_sel", 9), 79562306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_THERM, "infra_therm", "axi_sel", 10), 79662306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_I2C0, "infra_i2c0", "i2c_sel", 11), 79762306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_AP_DMA_PSEUDO, "infra_ap_dma_pseudo", "axi_sel", 12), 79862306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_I2C2, "infra_i2c2", "i2c_sel", 13), 79962306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_I2C3, "infra_i2c3", "i2c_sel", 14), 80062306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM_H, "infra_pwm_h", "axi_sel", 15), 80162306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM1, "infra_pwm1", "pwm_sel", 16), 80262306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM2, "infra_pwm2", "pwm_sel", 17), 80362306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM3, "infra_pwm3", "pwm_sel", 18), 80462306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM4, "infra_pwm4", "pwm_sel", 19), 80562306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM, "infra_pwm", "pwm_sel", 21), 80662306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_UART0, "infra_uart0", "uart_sel", 22), 80762306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_UART1, "infra_uart1", "uart_sel", 23), 80862306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_UART2, "infra_uart2", "uart_sel", 24), 80962306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_UART3, "infra_uart3", "uart_sel", 25), 81062306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_GCE_26M, "infra_gce_26m", "axi_sel", 27), 81162306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_CQ_DMA_FPC, "infra_cq_dma_fpc", "axi_sel", 28), 81262306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_BTIF, "infra_btif", "axi_sel", 31), 81362306a36Sopenharmony_ci /* INFRA1 */ 81462306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_SPI0, "infra_spi0", "spi_sel", 1), 81562306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC0, "infra_msdc0", "msdc50_0_h_sel", 2), 81662306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC1, "infra_msdc1", "msdc50_0_h_sel", 4), 81762306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC2, "infra_msdc2", "msdc50_0_h_sel", 5), 81862306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC0_SRC, "infra_msdc0_src", "msdc50_0_sel", 6), 81962306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_GCPU, "infra_gcpu", "axi_sel", 8), 82062306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_TRNG, "infra_trng", "axi_sel", 9), 82162306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_AUXADC, "infra_auxadc", "clk26m", 10), 82262306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_CPUM, "infra_cpum", "axi_sel", 11), 82362306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_CCIF1_AP, "infra_ccif1_ap", "axi_sel", 12), 82462306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_CCIF1_MD, "infra_ccif1_md", "axi_sel", 13), 82562306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_AUXADC_MD, "infra_auxadc_md", "clk26m", 14), 82662306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_PCIE_TL_26M, "infra_pcie_tl_26m", "axi_sel", 15), 82762306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC1_SRC, "infra_msdc1_src", "msdc30_1_sel", 16), 82862306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC2_SRC, "infra_msdc2_src", "msdc30_2_sel", 17), 82962306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_PCIE_TL_96M, "infra_pcie_tl_96m", "tl_sel", 18), 83062306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_PCIE_PL_P_250M, "infra_pcie_pl_p_250m", "axi_sel", 19), 83162306a36Sopenharmony_ci GATE_INFRA1_FLAGS(CLK_INFRA_DEVICE_APC, "infra_device_apc", "axi_sel", 20, CLK_IS_CRITICAL), 83262306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_CCIF_AP, "infra_ccif_ap", "axi_sel", 23), 83362306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DEBUGSYS, "infra_debugsys", "axi_sel", 24), 83462306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_AUDIO, "infra_audio", "axi_sel", 25), 83562306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_CCIF_MD, "infra_ccif_md", "axi_sel", 26), 83662306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DXCC_SEC_CORE, "infra_dxcc_sec_core", "dxcc_sel", 27), 83762306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DXCC_AO, "infra_dxcc_ao", "dxcc_sel", 28), 83862306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DBG_TRACE, "infra_dbg_trace", "axi_sel", 29), 83962306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DEVMPU_B, "infra_devmpu_b", "axi_sel", 30), 84062306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DRAMC_F26M, "infra_dramc_f26m", "clk26m", 31), 84162306a36Sopenharmony_ci /* INFRA2 */ 84262306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_IRTX, "infra_irtx", "clk26m", 0), 84362306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SSUSB, "infra_ssusb", "usb_top_sel", 1), 84462306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_DISP_PWM, "infra_disp_pwm", "axi_sel", 2), 84562306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_CLDMA_B, "infra_cldma_b", "axi_sel", 3), 84662306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_AUDIO_26M_B, "infra_audio_26m_b", "clk26m", 4), 84762306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_MODEM_TEMP_SHARE, "infra_modem_temp_share", "clk26m", 5), 84862306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SPI1, "infra_spi1", "spi_sel", 6), 84962306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C4, "infra_i2c4", "i2c_sel", 7), 85062306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SPI2, "infra_spi2", "spi_sel", 9), 85162306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SPI3, "infra_spi3", "spi_sel", 10), 85262306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UNIPRO_SYS, "infra_unipro_sys", "ufs_sel", 11), 85362306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UNIPRO_TICK, "infra_unipro_tick", "clk26m", 12), 85462306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UFS_MP_SAP_B, "infra_ufs_mp_sap_b", "clk26m", 13), 85562306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_MD32_B, "infra_md32_b", "axi_sel", 14), 85662306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UNIPRO_MBIST, "infra_unipro_mbist", "axi_sel", 16), 85762306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C5, "infra_i2c5", "i2c_sel", 18), 85862306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C5_ARBITER, "infra_i2c5_arbiter", "i2c_sel", 19), 85962306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C5_IMM, "infra_i2c5_imm", "i2c_sel", 20), 86062306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C1_ARBITER, "infra_i2c1_arbiter", "i2c_sel", 21), 86162306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C1_IMM, "infra_i2c1_imm", "i2c_sel", 22), 86262306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C2_ARBITER, "infra_i2c2_arbiter", "i2c_sel", 23), 86362306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C2_IMM, "infra_i2c2_imm", "i2c_sel", 24), 86462306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SPI4, "infra_spi4", "spi_sel", 25), 86562306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SPI5, "infra_spi5", "spi_sel", 26), 86662306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_CQ_DMA, "infra_cq_dma", "axi_sel", 27), 86762306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UFS, "infra_ufs", "ufs_sel", 28), 86862306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_AES_UFSFDE, "infra_aes_ufsfde", "aes_ufsfde_sel", 29), 86962306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UFS_TICK, "infra_ufs_tick", "ufs_sel", 30), 87062306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SSUSB_XHCI, "infra_ssusb_xhci", "ssusb_xhci_sel", 31), 87162306a36Sopenharmony_ci /* INFRA3 */ 87262306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_MSDC0_SELF, "infra_msdc0_self", "msdc50_0_sel", 0), 87362306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_MSDC1_SELF, "infra_msdc1_self", "msdc50_0_sel", 1), 87462306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_MSDC2_SELF, "infra_msdc2_self", "msdc50_0_sel", 2), 87562306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_UFS_AXI, "infra_ufs_axi", "axi_sel", 5), 87662306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_I2C6, "infra_i2c6", "i2c_sel", 6), 87762306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_AP_MSDC0, "infra_ap_msdc0", "msdc50_0_sel", 7), 87862306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_MD_MSDC0, "infra_md_msdc0", "msdc50_0_sel", 8), 87962306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF5_AP, "infra_ccif5_ap", "axi_sel", 9), 88062306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF5_MD, "infra_ccif5_md", "axi_sel", 10), 88162306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_PCIE_TOP_H_133M, "infra_pcie_top_h_133m", "axi_sel", 11), 88262306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_FLASHIF_TOP_H_133M, "infra_flashif_top_h_133m", "axi_sel", 14), 88362306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_PCIE_PERI_26M, "infra_pcie_peri_26m", "axi_sel", 15), 88462306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF2_AP, "infra_ccif2_ap", "axi_sel", 16), 88562306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF2_MD, "infra_ccif2_md", "axi_sel", 17), 88662306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF3_AP, "infra_ccif3_ap", "axi_sel", 18), 88762306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF3_MD, "infra_ccif3_md", "axi_sel", 19), 88862306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_SEJ_F13M, "infra_sej_f13m", "clk26m", 20), 88962306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_AES, "infra_aes", "axi_sel", 21), 89062306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_I2C7, "infra_i2c7", "i2c_sel", 22), 89162306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_I2C8, "infra_i2c8", "i2c_sel", 23), 89262306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_FBIST2FPC, "infra_fbist2fpc", "msdc50_0_sel", 24), 89362306a36Sopenharmony_ci GATE_INFRA3_FLAGS(CLK_INFRA_DEVICE_APC_SYNC, "infra_device_apc_sync", "axi_sel", 25, 89462306a36Sopenharmony_ci CLK_IS_CRITICAL), 89562306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_DPMAIF_MAIN, "infra_dpmaif_main", "dpmaif_main_sel", 26), 89662306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_PCIE_TL_32K, "infra_pcie_tl_32k", "axi_sel", 27), 89762306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF4_AP, "infra_ccif4_ap", "axi_sel", 28), 89862306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF4_MD, "infra_ccif4_md", "axi_sel", 29), 89962306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_SPI6, "infra_spi6", "spi_sel", 30), 90062306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_SPI7, "infra_spi7", "spi_sel", 31), 90162306a36Sopenharmony_ci /* INFRA4 */ 90262306a36Sopenharmony_ci GATE_INFRA4(CLK_INFRA_AP_DMA, "infra_ap_dma", "infra_ap_dma_pseudo", 31), 90362306a36Sopenharmony_ci /* INFRA5 */ 90462306a36Sopenharmony_ci GATE_INFRA5_FLAGS(CLK_INFRA_133M, "infra_133m", "axi_sel", 0, CLK_IS_CRITICAL), 90562306a36Sopenharmony_ci GATE_INFRA5_FLAGS(CLK_INFRA_66M, "infra_66m", "axi_sel", 1, CLK_IS_CRITICAL), 90662306a36Sopenharmony_ci GATE_INFRA5(CLK_INFRA_66M_PERI_BUS, "infra_66m_peri_bus", "axi_sel", 2), 90762306a36Sopenharmony_ci GATE_INFRA5(CLK_INFRA_FREE_DCM_133M, "infra_free_dcm_133m", "axi_sel", 3), 90862306a36Sopenharmony_ci GATE_INFRA5(CLK_INFRA_FREE_DCM_66M, "infra_free_dcm_66m", "axi_sel", 4), 90962306a36Sopenharmony_ci GATE_INFRA5(CLK_INFRA_PERI_BUS_DCM_133M, "infra_peri_bus_dcm_133m", "axi_sel", 5), 91062306a36Sopenharmony_ci GATE_INFRA5(CLK_INFRA_PERI_BUS_DCM_66M, "infra_peri_bus_dcm_66m", "axi_sel", 6), 91162306a36Sopenharmony_ci GATE_INFRA5(CLK_INFRA_FLASHIF_PERI_26M, "infra_flashif_peri_26m", "axi_sel", 30), 91262306a36Sopenharmony_ci GATE_INFRA5(CLK_INFRA_FLASHIF_SFLASH, "infra_flashif_fsflash", "axi_sel", 31), 91362306a36Sopenharmony_ci}; 91462306a36Sopenharmony_ci 91562306a36Sopenharmony_cistatic const struct mtk_gate_regs peri_cg_regs = { 91662306a36Sopenharmony_ci .set_ofs = 0x20c, 91762306a36Sopenharmony_ci .clr_ofs = 0x20c, 91862306a36Sopenharmony_ci .sta_ofs = 0x20c, 91962306a36Sopenharmony_ci}; 92062306a36Sopenharmony_ci 92162306a36Sopenharmony_ci#define GATE_PERI(_id, _name, _parent, _shift) \ 92262306a36Sopenharmony_ci GATE_MTK(_id, _name, _parent, &peri_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv) 92362306a36Sopenharmony_ci 92462306a36Sopenharmony_cistatic const struct mtk_gate peri_clks[] = { 92562306a36Sopenharmony_ci GATE_PERI(CLK_PERI_PERIAXI, "peri_periaxi", "axi_sel", 31), 92662306a36Sopenharmony_ci}; 92762306a36Sopenharmony_ci 92862306a36Sopenharmony_cistatic const struct mtk_gate_regs top_cg_regs = { 92962306a36Sopenharmony_ci .set_ofs = 0x150, 93062306a36Sopenharmony_ci .clr_ofs = 0x150, 93162306a36Sopenharmony_ci .sta_ofs = 0x150, 93262306a36Sopenharmony_ci}; 93362306a36Sopenharmony_ci 93462306a36Sopenharmony_ci#define GATE_TOP(_id, _name, _parent, _shift) \ 93562306a36Sopenharmony_ci GATE_MTK(_id, _name, _parent, &top_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv) 93662306a36Sopenharmony_ci 93762306a36Sopenharmony_cistatic const struct mtk_gate top_clks[] = { 93862306a36Sopenharmony_ci GATE_TOP(CLK_TOP_SSUSB_TOP_REF, "ssusb_top_ref", "clk26m", 24), 93962306a36Sopenharmony_ci GATE_TOP(CLK_TOP_SSUSB_PHY_REF, "ssusb_phy_ref", "clk26m", 25), 94062306a36Sopenharmony_ci}; 94162306a36Sopenharmony_ci 94262306a36Sopenharmony_cistatic u16 infra_ao_rst_ofs[] = { 94362306a36Sopenharmony_ci INFRA_RST0_SET_OFFSET, 94462306a36Sopenharmony_ci INFRA_RST1_SET_OFFSET, 94562306a36Sopenharmony_ci INFRA_RST2_SET_OFFSET, 94662306a36Sopenharmony_ci INFRA_RST3_SET_OFFSET, 94762306a36Sopenharmony_ci INFRA_RST4_SET_OFFSET, 94862306a36Sopenharmony_ci}; 94962306a36Sopenharmony_ci 95062306a36Sopenharmony_cistatic u16 infra_ao_idx_map[] = { 95162306a36Sopenharmony_ci [MT8192_INFRA_RST0_THERM_CTRL_SWRST] = 0 * RST_NR_PER_BANK + 0, 95262306a36Sopenharmony_ci [MT8192_INFRA_RST2_PEXTP_PHY_SWRST] = 2 * RST_NR_PER_BANK + 15, 95362306a36Sopenharmony_ci [MT8192_INFRA_RST3_THERM_CTRL_PTP_SWRST] = 3 * RST_NR_PER_BANK + 5, 95462306a36Sopenharmony_ci [MT8192_INFRA_RST4_PCIE_TOP_SWRST] = 4 * RST_NR_PER_BANK + 1, 95562306a36Sopenharmony_ci [MT8192_INFRA_RST4_THERM_CTRL_MCU_SWRST] = 4 * RST_NR_PER_BANK + 12, 95662306a36Sopenharmony_ci}; 95762306a36Sopenharmony_ci 95862306a36Sopenharmony_cistatic const struct mtk_clk_rst_desc clk_rst_desc = { 95962306a36Sopenharmony_ci .version = MTK_RST_SET_CLR, 96062306a36Sopenharmony_ci .rst_bank_ofs = infra_ao_rst_ofs, 96162306a36Sopenharmony_ci .rst_bank_nr = ARRAY_SIZE(infra_ao_rst_ofs), 96262306a36Sopenharmony_ci .rst_idx_map = infra_ao_idx_map, 96362306a36Sopenharmony_ci .rst_idx_map_nr = ARRAY_SIZE(infra_ao_idx_map), 96462306a36Sopenharmony_ci}; 96562306a36Sopenharmony_ci 96662306a36Sopenharmony_ci/* Register mux notifier for MFG mux */ 96762306a36Sopenharmony_cistatic int clk_mt8192_reg_mfg_mux_notifier(struct device *dev, struct clk *clk) 96862306a36Sopenharmony_ci{ 96962306a36Sopenharmony_ci struct mtk_mux_nb *mfg_mux_nb; 97062306a36Sopenharmony_ci int i; 97162306a36Sopenharmony_ci 97262306a36Sopenharmony_ci mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb), GFP_KERNEL); 97362306a36Sopenharmony_ci if (!mfg_mux_nb) 97462306a36Sopenharmony_ci return -ENOMEM; 97562306a36Sopenharmony_ci 97662306a36Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(top_mtk_muxes); i++) 97762306a36Sopenharmony_ci if (top_mtk_muxes[i].id == CLK_TOP_MFG_PLL_SEL) 97862306a36Sopenharmony_ci break; 97962306a36Sopenharmony_ci if (i == ARRAY_SIZE(top_mtk_muxes)) 98062306a36Sopenharmony_ci return -EINVAL; 98162306a36Sopenharmony_ci 98262306a36Sopenharmony_ci mfg_mux_nb->ops = top_mtk_muxes[i].ops; 98362306a36Sopenharmony_ci mfg_mux_nb->bypass_index = 0; /* Bypass to 26M crystal */ 98462306a36Sopenharmony_ci 98562306a36Sopenharmony_ci return devm_mtk_clk_mux_notifier_register(dev, clk, mfg_mux_nb); 98662306a36Sopenharmony_ci} 98762306a36Sopenharmony_ci 98862306a36Sopenharmony_cistatic const struct mtk_clk_desc infra_desc = { 98962306a36Sopenharmony_ci .clks = infra_clks, 99062306a36Sopenharmony_ci .num_clks = ARRAY_SIZE(infra_clks), 99162306a36Sopenharmony_ci .rst_desc = &clk_rst_desc, 99262306a36Sopenharmony_ci}; 99362306a36Sopenharmony_ci 99462306a36Sopenharmony_cistatic const struct mtk_clk_desc peri_desc = { 99562306a36Sopenharmony_ci .clks = peri_clks, 99662306a36Sopenharmony_ci .num_clks = ARRAY_SIZE(peri_clks), 99762306a36Sopenharmony_ci}; 99862306a36Sopenharmony_ci 99962306a36Sopenharmony_cistatic const struct mtk_clk_desc topck_desc = { 100062306a36Sopenharmony_ci .fixed_clks = top_fixed_clks, 100162306a36Sopenharmony_ci .num_fixed_clks = ARRAY_SIZE(top_fixed_clks), 100262306a36Sopenharmony_ci .factor_clks = top_divs, 100362306a36Sopenharmony_ci .num_factor_clks = ARRAY_SIZE(top_divs), 100462306a36Sopenharmony_ci .mux_clks = top_mtk_muxes, 100562306a36Sopenharmony_ci .num_mux_clks = ARRAY_SIZE(top_mtk_muxes), 100662306a36Sopenharmony_ci .composite_clks = top_muxes, 100762306a36Sopenharmony_ci .num_composite_clks = ARRAY_SIZE(top_muxes), 100862306a36Sopenharmony_ci .clks = top_clks, 100962306a36Sopenharmony_ci .num_clks = ARRAY_SIZE(top_clks), 101062306a36Sopenharmony_ci .clk_lock = &mt8192_clk_lock, 101162306a36Sopenharmony_ci .clk_notifier_func = clk_mt8192_reg_mfg_mux_notifier, 101262306a36Sopenharmony_ci .mfg_clk_idx = CLK_TOP_MFG_PLL_SEL, 101362306a36Sopenharmony_ci}; 101462306a36Sopenharmony_ci 101562306a36Sopenharmony_cistatic const struct of_device_id of_match_clk_mt8192[] = { 101662306a36Sopenharmony_ci { .compatible = "mediatek,mt8192-infracfg", .data = &infra_desc }, 101762306a36Sopenharmony_ci { .compatible = "mediatek,mt8192-pericfg", .data = &peri_desc }, 101862306a36Sopenharmony_ci { .compatible = "mediatek,mt8192-topckgen", .data = &topck_desc }, 101962306a36Sopenharmony_ci { /* sentinel */ } 102062306a36Sopenharmony_ci}; 102162306a36Sopenharmony_ciMODULE_DEVICE_TABLE(of, of_match_clk_mt8192); 102262306a36Sopenharmony_ci 102362306a36Sopenharmony_cistatic struct platform_driver clk_mt8192_drv = { 102462306a36Sopenharmony_ci .driver = { 102562306a36Sopenharmony_ci .name = "clk-mt8192", 102662306a36Sopenharmony_ci .of_match_table = of_match_clk_mt8192, 102762306a36Sopenharmony_ci }, 102862306a36Sopenharmony_ci .probe = mtk_clk_simple_probe, 102962306a36Sopenharmony_ci .remove_new = mtk_clk_simple_remove, 103062306a36Sopenharmony_ci}; 103162306a36Sopenharmony_cimodule_platform_driver(clk_mt8192_drv); 103262306a36Sopenharmony_ciMODULE_LICENSE("GPL"); 1033