162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci// 362306a36Sopenharmony_ci// Copyright (c) 2018 MediaTek Inc. 462306a36Sopenharmony_ci// Author: Weiyi Lu <weiyi.lu@mediatek.com> 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#include <linux/delay.h> 762306a36Sopenharmony_ci#include <linux/mfd/syscon.h> 862306a36Sopenharmony_ci#include <linux/mod_devicetable.h> 962306a36Sopenharmony_ci#include <linux/platform_device.h> 1062306a36Sopenharmony_ci#include <linux/slab.h> 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include "clk-gate.h" 1362306a36Sopenharmony_ci#include "clk-mtk.h" 1462306a36Sopenharmony_ci#include "clk-mux.h" 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#include <dt-bindings/clock/mt8183-clk.h> 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_cistatic DEFINE_SPINLOCK(mt8183_clk_lock); 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_cistatic const struct mtk_fixed_clk top_fixed_clks[] = { 2162306a36Sopenharmony_ci FIXED_CLK(CLK_TOP_CLK26M, "f_f26m_ck", "clk26m", 26000000), 2262306a36Sopenharmony_ci FIXED_CLK(CLK_TOP_ULPOSC, "osc", NULL, 250000), 2362306a36Sopenharmony_ci FIXED_CLK(CLK_TOP_UNIVP_192M, "univpll_192m", "univpll", 192000000), 2462306a36Sopenharmony_ci}; 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/* 2762306a36Sopenharmony_ci * To retain compatibility with older devicetrees, we keep CLK_TOP_CLK13M 2862306a36Sopenharmony_ci * valid, but renamed from "clk13m" (defined as fixed clock in the new 2962306a36Sopenharmony_ci * devicetrees) to "clk26m_d2", satisfying the older clock assignments. 3062306a36Sopenharmony_ci * This means that on new devicetrees "clk26m_d2" is unused. 3162306a36Sopenharmony_ci */ 3262306a36Sopenharmony_cistatic const struct mtk_fixed_factor top_divs[] = { 3362306a36Sopenharmony_ci FACTOR(CLK_TOP_CLK13M, "clk26m_d2", "clk26m", 1, 2), 3462306a36Sopenharmony_ci FACTOR(CLK_TOP_F26M_CK_D2, "csw_f26m_ck_d2", "clk26m", 1, 2), 3562306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_CK, "syspll_ck", "mainpll", 1, 1, 0), 3662306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D2, "syspll_d2", "syspll_ck", 1, 2, 0), 3762306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D2_D2, "syspll_d2_d2", "syspll_d2", 1, 2, 0), 3862306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D2_D4, "syspll_d2_d4", "syspll_d2", 1, 4, 0), 3962306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D2_D8, "syspll_d2_d8", "syspll_d2", 1, 8, 0), 4062306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D2_D16, "syspll_d2_d16", "syspll_d2", 1, 16, 0), 4162306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D3, "syspll_d3", "mainpll", 1, 3, 0), 4262306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D3_D2, "syspll_d3_d2", "syspll_d3", 1, 2, 0), 4362306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D3_D4, "syspll_d3_d4", "syspll_d3", 1, 4, 0), 4462306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D3_D8, "syspll_d3_d8", "syspll_d3", 1, 8, 0), 4562306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D5, "syspll_d5", "mainpll", 1, 5, 0), 4662306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D5_D2, "syspll_d5_d2", "syspll_d5", 1, 2, 0), 4762306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D5_D4, "syspll_d5_d4", "syspll_d5", 1, 4, 0), 4862306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D7, "syspll_d7", "mainpll", 1, 7, 0), 4962306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D7_D2, "syspll_d7_d2", "syspll_d7", 1, 2, 0), 5062306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_SYSPLL_D7_D4, "syspll_d7_d4", "syspll_d7", 1, 4, 0), 5162306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_CK, "univpll_ck", "univpll", 1, 1, 0), 5262306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D2, "univpll_d2", "univpll_ck", 1, 2, 0), 5362306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D2_D2, "univpll_d2_d2", "univpll_d2", 1, 2, 0), 5462306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D2_D4, "univpll_d2_d4", "univpll_d2", 1, 4, 0), 5562306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D2_D8, "univpll_d2_d8", "univpll_d2", 1, 8, 0), 5662306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D3, "univpll_d3", "univpll", 1, 3, 0), 5762306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D3_D2, "univpll_d3_d2", "univpll_d3", 1, 2, 0), 5862306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D3_D4, "univpll_d3_d4", "univpll_d3", 1, 4, 0), 5962306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D3_D8, "univpll_d3_d8", "univpll_d3", 1, 8, 0), 6062306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5, "univpll_d5", "univpll", 1, 5, 0), 6162306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5_D2, "univpll_d5_d2", "univpll_d5", 1, 2, 0), 6262306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5_D4, "univpll_d5_d4", "univpll_d5", 1, 4, 0), 6362306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D5_D8, "univpll_d5_d8", "univpll_d5", 1, 8, 0), 6462306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D7, "univpll_d7", "univpll", 1, 7, 0), 6562306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVP_192M_CK, "univ_192m_ck", "univpll_192m", 1, 1, 0), 6662306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVP_192M_D2, "univ_192m_d2", "univ_192m_ck", 1, 2, 0), 6762306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVP_192M_D4, "univ_192m_d4", "univ_192m_ck", 1, 4, 0), 6862306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVP_192M_D8, "univ_192m_d8", "univ_192m_ck", 1, 8, 0), 6962306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVP_192M_D16, "univ_192m_d16", "univ_192m_ck", 1, 16, 0), 7062306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVP_192M_D32, "univ_192m_d32", "univ_192m_ck", 1, 32, 0), 7162306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL1_CK, "apll1_ck", "apll1", 1, 1), 7262306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL1_D2, "apll1_d2", "apll1", 1, 2), 7362306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL1_D4, "apll1_d4", "apll1", 1, 4), 7462306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL1_D8, "apll1_d8", "apll1", 1, 8), 7562306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL2_CK, "apll2_ck", "apll2", 1, 1), 7662306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL2_D2, "apll2_d2", "apll2", 1, 2), 7762306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL2_D4, "apll2_d4", "apll2", 1, 4), 7862306a36Sopenharmony_ci FACTOR(CLK_TOP_APLL2_D8, "apll2_d8", "apll2", 1, 8), 7962306a36Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_CK, "tvdpll_ck", "tvdpll", 1, 1), 8062306a36Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D2, "tvdpll_d2", "tvdpll_ck", 1, 2), 8162306a36Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D4, "tvdpll_d4", "tvdpll", 1, 4), 8262306a36Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D8, "tvdpll_d8", "tvdpll", 1, 8), 8362306a36Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D16, "tvdpll_d16", "tvdpll", 1, 16), 8462306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_CK, "mmpll_ck", "mmpll", 1, 1), 8562306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D4, "mmpll_d4", "mmpll", 1, 4), 8662306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D4_D2, "mmpll_d4_d2", "mmpll_d4", 1, 2), 8762306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D4_D4, "mmpll_d4_d4", "mmpll_d4", 1, 4), 8862306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D5, "mmpll_d5", "mmpll", 1, 5), 8962306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D5_D2, "mmpll_d5_d2", "mmpll_d5", 1, 2), 9062306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D5_D4, "mmpll_d5_d4", "mmpll_d5", 1, 4), 9162306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D6, "mmpll_d6", "mmpll", 1, 6), 9262306a36Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D7, "mmpll_d7", "mmpll", 1, 7), 9362306a36Sopenharmony_ci FACTOR(CLK_TOP_MFGPLL_CK, "mfgpll_ck", "mfgpll", 1, 1), 9462306a36Sopenharmony_ci FACTOR(CLK_TOP_MSDCPLL_CK, "msdcpll_ck", "msdcpll", 1, 1), 9562306a36Sopenharmony_ci FACTOR(CLK_TOP_MSDCPLL_D2, "msdcpll_d2", "msdcpll", 1, 2), 9662306a36Sopenharmony_ci FACTOR(CLK_TOP_MSDCPLL_D4, "msdcpll_d4", "msdcpll", 1, 4), 9762306a36Sopenharmony_ci FACTOR(CLK_TOP_MSDCPLL_D8, "msdcpll_d8", "msdcpll", 1, 8), 9862306a36Sopenharmony_ci FACTOR(CLK_TOP_MSDCPLL_D16, "msdcpll_d16", "msdcpll", 1, 16), 9962306a36Sopenharmony_ci FACTOR(CLK_TOP_AD_OSC_CK, "ad_osc_ck", "osc", 1, 1), 10062306a36Sopenharmony_ci FACTOR(CLK_TOP_OSC_D2, "osc_d2", "osc", 1, 2), 10162306a36Sopenharmony_ci FACTOR(CLK_TOP_OSC_D4, "osc_d4", "osc", 1, 4), 10262306a36Sopenharmony_ci FACTOR(CLK_TOP_OSC_D8, "osc_d8", "osc", 1, 8), 10362306a36Sopenharmony_ci FACTOR(CLK_TOP_OSC_D16, "osc_d16", "osc", 1, 16), 10462306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL, "univpll", "univ2pll", 1, 2, 0), 10562306a36Sopenharmony_ci FACTOR_FLAGS(CLK_TOP_UNIVPLL_D3_D16, "univpll_d3_d16", "univpll_d3", 1, 16, 0), 10662306a36Sopenharmony_ci}; 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_cistatic const char * const axi_parents[] = { 10962306a36Sopenharmony_ci "clk26m", 11062306a36Sopenharmony_ci "syspll_d2_d4", 11162306a36Sopenharmony_ci "syspll_d7", 11262306a36Sopenharmony_ci "osc_d4" 11362306a36Sopenharmony_ci}; 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_cistatic const char * const mm_parents[] = { 11662306a36Sopenharmony_ci "clk26m", 11762306a36Sopenharmony_ci "mmpll_d7", 11862306a36Sopenharmony_ci "syspll_d3", 11962306a36Sopenharmony_ci "univpll_d2_d2", 12062306a36Sopenharmony_ci "syspll_d2_d2", 12162306a36Sopenharmony_ci "syspll_d3_d2" 12262306a36Sopenharmony_ci}; 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_cistatic const char * const img_parents[] = { 12562306a36Sopenharmony_ci "clk26m", 12662306a36Sopenharmony_ci "mmpll_d6", 12762306a36Sopenharmony_ci "univpll_d3", 12862306a36Sopenharmony_ci "syspll_d3", 12962306a36Sopenharmony_ci "univpll_d2_d2", 13062306a36Sopenharmony_ci "syspll_d2_d2", 13162306a36Sopenharmony_ci "univpll_d3_d2", 13262306a36Sopenharmony_ci "syspll_d3_d2" 13362306a36Sopenharmony_ci}; 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_cistatic const char * const cam_parents[] = { 13662306a36Sopenharmony_ci "clk26m", 13762306a36Sopenharmony_ci "syspll_d2", 13862306a36Sopenharmony_ci "mmpll_d6", 13962306a36Sopenharmony_ci "syspll_d3", 14062306a36Sopenharmony_ci "mmpll_d7", 14162306a36Sopenharmony_ci "univpll_d3", 14262306a36Sopenharmony_ci "univpll_d2_d2", 14362306a36Sopenharmony_ci "syspll_d2_d2", 14462306a36Sopenharmony_ci "syspll_d3_d2", 14562306a36Sopenharmony_ci "univpll_d3_d2" 14662306a36Sopenharmony_ci}; 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_cistatic const char * const dsp_parents[] = { 14962306a36Sopenharmony_ci "clk26m", 15062306a36Sopenharmony_ci "mmpll_d6", 15162306a36Sopenharmony_ci "mmpll_d7", 15262306a36Sopenharmony_ci "univpll_d3", 15362306a36Sopenharmony_ci "syspll_d3", 15462306a36Sopenharmony_ci "univpll_d2_d2", 15562306a36Sopenharmony_ci "syspll_d2_d2", 15662306a36Sopenharmony_ci "univpll_d3_d2", 15762306a36Sopenharmony_ci "syspll_d3_d2" 15862306a36Sopenharmony_ci}; 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_cistatic const char * const dsp1_parents[] = { 16162306a36Sopenharmony_ci "clk26m", 16262306a36Sopenharmony_ci "mmpll_d6", 16362306a36Sopenharmony_ci "mmpll_d7", 16462306a36Sopenharmony_ci "univpll_d3", 16562306a36Sopenharmony_ci "syspll_d3", 16662306a36Sopenharmony_ci "univpll_d2_d2", 16762306a36Sopenharmony_ci "syspll_d2_d2", 16862306a36Sopenharmony_ci "univpll_d3_d2", 16962306a36Sopenharmony_ci "syspll_d3_d2" 17062306a36Sopenharmony_ci}; 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_cistatic const char * const dsp2_parents[] = { 17362306a36Sopenharmony_ci "clk26m", 17462306a36Sopenharmony_ci "mmpll_d6", 17562306a36Sopenharmony_ci "mmpll_d7", 17662306a36Sopenharmony_ci "univpll_d3", 17762306a36Sopenharmony_ci "syspll_d3", 17862306a36Sopenharmony_ci "univpll_d2_d2", 17962306a36Sopenharmony_ci "syspll_d2_d2", 18062306a36Sopenharmony_ci "univpll_d3_d2", 18162306a36Sopenharmony_ci "syspll_d3_d2" 18262306a36Sopenharmony_ci}; 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_cistatic const char * const ipu_if_parents[] = { 18562306a36Sopenharmony_ci "clk26m", 18662306a36Sopenharmony_ci "mmpll_d6", 18762306a36Sopenharmony_ci "mmpll_d7", 18862306a36Sopenharmony_ci "univpll_d3", 18962306a36Sopenharmony_ci "syspll_d3", 19062306a36Sopenharmony_ci "univpll_d2_d2", 19162306a36Sopenharmony_ci "syspll_d2_d2", 19262306a36Sopenharmony_ci "univpll_d3_d2", 19362306a36Sopenharmony_ci "syspll_d3_d2" 19462306a36Sopenharmony_ci}; 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_cistatic const char * const mfg_parents[] = { 19762306a36Sopenharmony_ci "clk26m", 19862306a36Sopenharmony_ci "mfgpll_ck", 19962306a36Sopenharmony_ci "univpll_d3", 20062306a36Sopenharmony_ci "syspll_d3" 20162306a36Sopenharmony_ci}; 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_cistatic const char * const f52m_mfg_parents[] = { 20462306a36Sopenharmony_ci "clk26m", 20562306a36Sopenharmony_ci "univpll_d3_d2", 20662306a36Sopenharmony_ci "univpll_d3_d4", 20762306a36Sopenharmony_ci "univpll_d3_d8" 20862306a36Sopenharmony_ci}; 20962306a36Sopenharmony_ci 21062306a36Sopenharmony_cistatic const char * const camtg_parents[] = { 21162306a36Sopenharmony_ci "clk26m", 21262306a36Sopenharmony_ci "univ_192m_d8", 21362306a36Sopenharmony_ci "univpll_d3_d8", 21462306a36Sopenharmony_ci "univ_192m_d4", 21562306a36Sopenharmony_ci "univpll_d3_d16", 21662306a36Sopenharmony_ci "csw_f26m_ck_d2", 21762306a36Sopenharmony_ci "univ_192m_d16", 21862306a36Sopenharmony_ci "univ_192m_d32" 21962306a36Sopenharmony_ci}; 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_cistatic const char * const camtg2_parents[] = { 22262306a36Sopenharmony_ci "clk26m", 22362306a36Sopenharmony_ci "univ_192m_d8", 22462306a36Sopenharmony_ci "univpll_d3_d8", 22562306a36Sopenharmony_ci "univ_192m_d4", 22662306a36Sopenharmony_ci "univpll_d3_d16", 22762306a36Sopenharmony_ci "csw_f26m_ck_d2", 22862306a36Sopenharmony_ci "univ_192m_d16", 22962306a36Sopenharmony_ci "univ_192m_d32" 23062306a36Sopenharmony_ci}; 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_cistatic const char * const camtg3_parents[] = { 23362306a36Sopenharmony_ci "clk26m", 23462306a36Sopenharmony_ci "univ_192m_d8", 23562306a36Sopenharmony_ci "univpll_d3_d8", 23662306a36Sopenharmony_ci "univ_192m_d4", 23762306a36Sopenharmony_ci "univpll_d3_d16", 23862306a36Sopenharmony_ci "csw_f26m_ck_d2", 23962306a36Sopenharmony_ci "univ_192m_d16", 24062306a36Sopenharmony_ci "univ_192m_d32" 24162306a36Sopenharmony_ci}; 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_cistatic const char * const camtg4_parents[] = { 24462306a36Sopenharmony_ci "clk26m", 24562306a36Sopenharmony_ci "univ_192m_d8", 24662306a36Sopenharmony_ci "univpll_d3_d8", 24762306a36Sopenharmony_ci "univ_192m_d4", 24862306a36Sopenharmony_ci "univpll_d3_d16", 24962306a36Sopenharmony_ci "csw_f26m_ck_d2", 25062306a36Sopenharmony_ci "univ_192m_d16", 25162306a36Sopenharmony_ci "univ_192m_d32" 25262306a36Sopenharmony_ci}; 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_cistatic const char * const uart_parents[] = { 25562306a36Sopenharmony_ci "clk26m", 25662306a36Sopenharmony_ci "univpll_d3_d8" 25762306a36Sopenharmony_ci}; 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_cistatic const char * const spi_parents[] = { 26062306a36Sopenharmony_ci "clk26m", 26162306a36Sopenharmony_ci "syspll_d5_d2", 26262306a36Sopenharmony_ci "syspll_d3_d4", 26362306a36Sopenharmony_ci "msdcpll_d4" 26462306a36Sopenharmony_ci}; 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_cistatic const char * const msdc50_hclk_parents[] = { 26762306a36Sopenharmony_ci "clk26m", 26862306a36Sopenharmony_ci "syspll_d2_d2", 26962306a36Sopenharmony_ci "syspll_d3_d2" 27062306a36Sopenharmony_ci}; 27162306a36Sopenharmony_ci 27262306a36Sopenharmony_cistatic const char * const msdc50_0_parents[] = { 27362306a36Sopenharmony_ci "clk26m", 27462306a36Sopenharmony_ci "msdcpll_ck", 27562306a36Sopenharmony_ci "msdcpll_d2", 27662306a36Sopenharmony_ci "univpll_d2_d4", 27762306a36Sopenharmony_ci "syspll_d3_d2", 27862306a36Sopenharmony_ci "univpll_d2_d2" 27962306a36Sopenharmony_ci}; 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_cistatic const char * const msdc30_1_parents[] = { 28262306a36Sopenharmony_ci "clk26m", 28362306a36Sopenharmony_ci "univpll_d3_d2", 28462306a36Sopenharmony_ci "syspll_d3_d2", 28562306a36Sopenharmony_ci "syspll_d7", 28662306a36Sopenharmony_ci "msdcpll_d2" 28762306a36Sopenharmony_ci}; 28862306a36Sopenharmony_ci 28962306a36Sopenharmony_cistatic const char * const msdc30_2_parents[] = { 29062306a36Sopenharmony_ci "clk26m", 29162306a36Sopenharmony_ci "univpll_d3_d2", 29262306a36Sopenharmony_ci "syspll_d3_d2", 29362306a36Sopenharmony_ci "syspll_d7", 29462306a36Sopenharmony_ci "msdcpll_d2" 29562306a36Sopenharmony_ci}; 29662306a36Sopenharmony_ci 29762306a36Sopenharmony_cistatic const char * const audio_parents[] = { 29862306a36Sopenharmony_ci "clk26m", 29962306a36Sopenharmony_ci "syspll_d5_d4", 30062306a36Sopenharmony_ci "syspll_d7_d4", 30162306a36Sopenharmony_ci "syspll_d2_d16" 30262306a36Sopenharmony_ci}; 30362306a36Sopenharmony_ci 30462306a36Sopenharmony_cistatic const char * const aud_intbus_parents[] = { 30562306a36Sopenharmony_ci "clk26m", 30662306a36Sopenharmony_ci "syspll_d2_d4", 30762306a36Sopenharmony_ci "syspll_d7_d2" 30862306a36Sopenharmony_ci}; 30962306a36Sopenharmony_ci 31062306a36Sopenharmony_cistatic const char * const pmicspi_parents[] = { 31162306a36Sopenharmony_ci "clk26m", 31262306a36Sopenharmony_ci "syspll_d2_d8", 31362306a36Sopenharmony_ci "osc_d8" 31462306a36Sopenharmony_ci}; 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_cistatic const char * const fpwrap_ulposc_parents[] = { 31762306a36Sopenharmony_ci "clk26m", 31862306a36Sopenharmony_ci "osc_d16", 31962306a36Sopenharmony_ci "osc_d4", 32062306a36Sopenharmony_ci "osc_d8" 32162306a36Sopenharmony_ci}; 32262306a36Sopenharmony_ci 32362306a36Sopenharmony_cistatic const char * const atb_parents[] = { 32462306a36Sopenharmony_ci "clk26m", 32562306a36Sopenharmony_ci "syspll_d2_d2", 32662306a36Sopenharmony_ci "syspll_d5" 32762306a36Sopenharmony_ci}; 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_cistatic const char * const sspm_parents[] = { 33062306a36Sopenharmony_ci "clk26m", 33162306a36Sopenharmony_ci "univpll_d2_d4", 33262306a36Sopenharmony_ci "syspll_d2_d2", 33362306a36Sopenharmony_ci "univpll_d2_d2", 33462306a36Sopenharmony_ci "syspll_d3" 33562306a36Sopenharmony_ci}; 33662306a36Sopenharmony_ci 33762306a36Sopenharmony_cistatic const char * const dpi0_parents[] = { 33862306a36Sopenharmony_ci "clk26m", 33962306a36Sopenharmony_ci "tvdpll_d2", 34062306a36Sopenharmony_ci "tvdpll_d4", 34162306a36Sopenharmony_ci "tvdpll_d8", 34262306a36Sopenharmony_ci "tvdpll_d16", 34362306a36Sopenharmony_ci "univpll_d5_d2", 34462306a36Sopenharmony_ci "univpll_d3_d4", 34562306a36Sopenharmony_ci "syspll_d3_d4", 34662306a36Sopenharmony_ci "univpll_d3_d8" 34762306a36Sopenharmony_ci}; 34862306a36Sopenharmony_ci 34962306a36Sopenharmony_cistatic const char * const scam_parents[] = { 35062306a36Sopenharmony_ci "clk26m", 35162306a36Sopenharmony_ci "syspll_d5_d2" 35262306a36Sopenharmony_ci}; 35362306a36Sopenharmony_ci 35462306a36Sopenharmony_cistatic const char * const disppwm_parents[] = { 35562306a36Sopenharmony_ci "clk26m", 35662306a36Sopenharmony_ci "univpll_d3_d4", 35762306a36Sopenharmony_ci "osc_d2", 35862306a36Sopenharmony_ci "osc_d4", 35962306a36Sopenharmony_ci "osc_d16" 36062306a36Sopenharmony_ci}; 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_cistatic const char * const usb_top_parents[] = { 36362306a36Sopenharmony_ci "clk26m", 36462306a36Sopenharmony_ci "univpll_d5_d4", 36562306a36Sopenharmony_ci "univpll_d3_d4", 36662306a36Sopenharmony_ci "univpll_d5_d2" 36762306a36Sopenharmony_ci}; 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci 37062306a36Sopenharmony_cistatic const char * const ssusb_top_xhci_parents[] = { 37162306a36Sopenharmony_ci "clk26m", 37262306a36Sopenharmony_ci "univpll_d5_d4", 37362306a36Sopenharmony_ci "univpll_d3_d4", 37462306a36Sopenharmony_ci "univpll_d5_d2" 37562306a36Sopenharmony_ci}; 37662306a36Sopenharmony_ci 37762306a36Sopenharmony_cistatic const char * const spm_parents[] = { 37862306a36Sopenharmony_ci "clk26m", 37962306a36Sopenharmony_ci "syspll_d2_d8" 38062306a36Sopenharmony_ci}; 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_cistatic const char * const i2c_parents[] = { 38362306a36Sopenharmony_ci "clk26m", 38462306a36Sopenharmony_ci "syspll_d2_d8", 38562306a36Sopenharmony_ci "univpll_d5_d2" 38662306a36Sopenharmony_ci}; 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_cistatic const char * const scp_parents[] = { 38962306a36Sopenharmony_ci "clk26m", 39062306a36Sopenharmony_ci "univpll_d2_d8", 39162306a36Sopenharmony_ci "syspll_d5", 39262306a36Sopenharmony_ci "syspll_d2_d2", 39362306a36Sopenharmony_ci "univpll_d2_d2", 39462306a36Sopenharmony_ci "syspll_d3", 39562306a36Sopenharmony_ci "univpll_d3" 39662306a36Sopenharmony_ci}; 39762306a36Sopenharmony_ci 39862306a36Sopenharmony_cistatic const char * const seninf_parents[] = { 39962306a36Sopenharmony_ci "clk26m", 40062306a36Sopenharmony_ci "univpll_d2_d2", 40162306a36Sopenharmony_ci "univpll_d3_d2", 40262306a36Sopenharmony_ci "univpll_d2_d4" 40362306a36Sopenharmony_ci}; 40462306a36Sopenharmony_ci 40562306a36Sopenharmony_cistatic const char * const dxcc_parents[] = { 40662306a36Sopenharmony_ci "clk26m", 40762306a36Sopenharmony_ci "syspll_d2_d2", 40862306a36Sopenharmony_ci "syspll_d2_d4", 40962306a36Sopenharmony_ci "syspll_d2_d8" 41062306a36Sopenharmony_ci}; 41162306a36Sopenharmony_ci 41262306a36Sopenharmony_cistatic const char * const aud_engen1_parents[] = { 41362306a36Sopenharmony_ci "clk26m", 41462306a36Sopenharmony_ci "apll1_d2", 41562306a36Sopenharmony_ci "apll1_d4", 41662306a36Sopenharmony_ci "apll1_d8" 41762306a36Sopenharmony_ci}; 41862306a36Sopenharmony_ci 41962306a36Sopenharmony_cistatic const char * const aud_engen2_parents[] = { 42062306a36Sopenharmony_ci "clk26m", 42162306a36Sopenharmony_ci "apll2_d2", 42262306a36Sopenharmony_ci "apll2_d4", 42362306a36Sopenharmony_ci "apll2_d8" 42462306a36Sopenharmony_ci}; 42562306a36Sopenharmony_ci 42662306a36Sopenharmony_cistatic const char * const faes_ufsfde_parents[] = { 42762306a36Sopenharmony_ci "clk26m", 42862306a36Sopenharmony_ci "syspll_d2", 42962306a36Sopenharmony_ci "syspll_d2_d2", 43062306a36Sopenharmony_ci "syspll_d3", 43162306a36Sopenharmony_ci "syspll_d2_d4", 43262306a36Sopenharmony_ci "univpll_d3" 43362306a36Sopenharmony_ci}; 43462306a36Sopenharmony_ci 43562306a36Sopenharmony_cistatic const char * const fufs_parents[] = { 43662306a36Sopenharmony_ci "clk26m", 43762306a36Sopenharmony_ci "syspll_d2_d4", 43862306a36Sopenharmony_ci "syspll_d2_d8", 43962306a36Sopenharmony_ci "syspll_d2_d16" 44062306a36Sopenharmony_ci}; 44162306a36Sopenharmony_ci 44262306a36Sopenharmony_cistatic const char * const aud_1_parents[] = { 44362306a36Sopenharmony_ci "clk26m", 44462306a36Sopenharmony_ci "apll1_ck" 44562306a36Sopenharmony_ci}; 44662306a36Sopenharmony_ci 44762306a36Sopenharmony_cistatic const char * const aud_2_parents[] = { 44862306a36Sopenharmony_ci "clk26m", 44962306a36Sopenharmony_ci "apll2_ck" 45062306a36Sopenharmony_ci}; 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_ci/* 45362306a36Sopenharmony_ci * CRITICAL CLOCK: 45462306a36Sopenharmony_ci * axi_sel is the main bus clock of whole SOC. 45562306a36Sopenharmony_ci * spm_sel is the clock of the always-on co-processor. 45662306a36Sopenharmony_ci */ 45762306a36Sopenharmony_cistatic const struct mtk_mux top_muxes[] = { 45862306a36Sopenharmony_ci /* CLK_CFG_0 */ 45962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_AXI, "axi_sel", 46062306a36Sopenharmony_ci axi_parents, 0x40, 0x44, 0x48, 0, 2, 7, 0x004, 0, 46162306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 46262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_MM, "mm_sel", 46362306a36Sopenharmony_ci mm_parents, 0x40, 0x44, 0x48, 8, 3, 15, 0x004, 1), 46462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_IMG, "img_sel", 46562306a36Sopenharmony_ci img_parents, 0x40, 0x44, 0x48, 16, 3, 23, 0x004, 2), 46662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_CAM, "cam_sel", 46762306a36Sopenharmony_ci cam_parents, 0x40, 0x44, 0x48, 24, 4, 31, 0x004, 3), 46862306a36Sopenharmony_ci /* CLK_CFG_1 */ 46962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_DSP, "dsp_sel", 47062306a36Sopenharmony_ci dsp_parents, 0x50, 0x54, 0x58, 0, 4, 7, 0x004, 4), 47162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_DSP1, "dsp1_sel", 47262306a36Sopenharmony_ci dsp1_parents, 0x50, 0x54, 0x58, 8, 4, 15, 0x004, 5), 47362306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_DSP2, "dsp2_sel", 47462306a36Sopenharmony_ci dsp2_parents, 0x50, 0x54, 0x58, 16, 4, 23, 0x004, 6), 47562306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_IPU_IF, "ipu_if_sel", 47662306a36Sopenharmony_ci ipu_if_parents, 0x50, 0x54, 0x58, 24, 4, 31, 0x004, 7), 47762306a36Sopenharmony_ci /* CLK_CFG_2 */ 47862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_MFG, "mfg_sel", 47962306a36Sopenharmony_ci mfg_parents, 0x60, 0x64, 0x68, 0, 2, 7, 0x004, 8), 48062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_F52M_MFG, "f52m_mfg_sel", 48162306a36Sopenharmony_ci f52m_mfg_parents, 0x60, 0x64, 0x68, 8, 2, 15, 0x004, 9), 48262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_CAMTG, "camtg_sel", 48362306a36Sopenharmony_ci camtg_parents, 0x60, 0x64, 0x68, 16, 3, 23, 0x004, 10), 48462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_CAMTG2, "camtg2_sel", 48562306a36Sopenharmony_ci camtg2_parents, 0x60, 0x64, 0x68, 24, 3, 31, 0x004, 11), 48662306a36Sopenharmony_ci /* CLK_CFG_3 */ 48762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_CAMTG3, "camtg3_sel", 48862306a36Sopenharmony_ci camtg3_parents, 0x70, 0x74, 0x78, 0, 3, 7, 0x004, 12), 48962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_CAMTG4, "camtg4_sel", 49062306a36Sopenharmony_ci camtg4_parents, 0x70, 0x74, 0x78, 8, 3, 15, 0x004, 13), 49162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_UART, "uart_sel", 49262306a36Sopenharmony_ci uart_parents, 0x70, 0x74, 0x78, 16, 1, 23, 0x004, 14), 49362306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_SPI, "spi_sel", 49462306a36Sopenharmony_ci spi_parents, 0x70, 0x74, 0x78, 24, 2, 31, 0x004, 15), 49562306a36Sopenharmony_ci /* CLK_CFG_4 */ 49662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_MSDC50_0_HCLK, "msdc50_hclk_sel", 49762306a36Sopenharmony_ci msdc50_hclk_parents, 0x80, 0x84, 0x88, 0, 2, 7, 0x004, 16, 0), 49862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_MSDC50_0, "msdc50_0_sel", 49962306a36Sopenharmony_ci msdc50_0_parents, 0x80, 0x84, 0x88, 8, 3, 15, 0x004, 17, 0), 50062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_MSDC30_1, "msdc30_1_sel", 50162306a36Sopenharmony_ci msdc30_1_parents, 0x80, 0x84, 0x88, 16, 3, 23, 0x004, 18, 0), 50262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_MSDC30_2, "msdc30_2_sel", 50362306a36Sopenharmony_ci msdc30_2_parents, 0x80, 0x84, 0x88, 24, 3, 31, 0x004, 19, 0), 50462306a36Sopenharmony_ci /* CLK_CFG_5 */ 50562306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_AUDIO, "audio_sel", 50662306a36Sopenharmony_ci audio_parents, 0x90, 0x94, 0x98, 0, 2, 7, 0x004, 20), 50762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_AUD_INTBUS, "aud_intbus_sel", 50862306a36Sopenharmony_ci aud_intbus_parents, 0x90, 0x94, 0x98, 8, 2, 15, 0x004, 21), 50962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_PMICSPI, "pmicspi_sel", 51062306a36Sopenharmony_ci pmicspi_parents, 0x90, 0x94, 0x98, 16, 2, 23, 0x004, 22), 51162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_FPWRAP_ULPOSC, "fpwrap_ulposc_sel", 51262306a36Sopenharmony_ci fpwrap_ulposc_parents, 0x90, 0x94, 0x98, 24, 2, 31, 0x004, 23), 51362306a36Sopenharmony_ci /* CLK_CFG_6 */ 51462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_ATB, "atb_sel", 51562306a36Sopenharmony_ci atb_parents, 0xa0, 0xa4, 0xa8, 0, 2, 7, 0x004, 24), 51662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_SSPM, "sspm_sel", 51762306a36Sopenharmony_ci sspm_parents, 0xa0, 0xa4, 0xa8, 8, 3, 15, 0x004, 25, 51862306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 51962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_DPI0, "dpi0_sel", 52062306a36Sopenharmony_ci dpi0_parents, 0xa0, 0xa4, 0xa8, 16, 4, 23, 0x004, 26), 52162306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_SCAM, "scam_sel", 52262306a36Sopenharmony_ci scam_parents, 0xa0, 0xa4, 0xa8, 24, 1, 31, 0x004, 27), 52362306a36Sopenharmony_ci /* CLK_CFG_7 */ 52462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_DISP_PWM, "disppwm_sel", 52562306a36Sopenharmony_ci disppwm_parents, 0xb0, 0xb4, 0xb8, 0, 3, 7, 0x004, 28), 52662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_USB_TOP, "usb_top_sel", 52762306a36Sopenharmony_ci usb_top_parents, 0xb0, 0xb4, 0xb8, 8, 2, 15, 0x004, 29), 52862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_SSUSB_TOP_XHCI, "ssusb_top_xhci_sel", 52962306a36Sopenharmony_ci ssusb_top_xhci_parents, 0xb0, 0xb4, 0xb8, 16, 2, 23, 0x004, 30), 53062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_SPM, "spm_sel", 53162306a36Sopenharmony_ci spm_parents, 0xb0, 0xb4, 0xb8, 24, 1, 31, 0x008, 0, 53262306a36Sopenharmony_ci CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 53362306a36Sopenharmony_ci /* CLK_CFG_8 */ 53462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_I2C, "i2c_sel", 53562306a36Sopenharmony_ci i2c_parents, 0xc0, 0xc4, 0xc8, 0, 2, 7, 0x008, 1), 53662306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_SCP, "scp_sel", 53762306a36Sopenharmony_ci scp_parents, 0xc0, 0xc4, 0xc8, 8, 3, 15, 0x008, 2), 53862306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_SENINF, "seninf_sel", 53962306a36Sopenharmony_ci seninf_parents, 0xc0, 0xc4, 0xc8, 16, 2, 23, 0x008, 3), 54062306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_DXCC, "dxcc_sel", 54162306a36Sopenharmony_ci dxcc_parents, 0xc0, 0xc4, 0xc8, 24, 2, 31, 0x008, 4), 54262306a36Sopenharmony_ci /* CLK_CFG_9 */ 54362306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_AUD_ENG1, "aud_eng1_sel", 54462306a36Sopenharmony_ci aud_engen1_parents, 0xd0, 0xd4, 0xd8, 0, 2, 7, 0x008, 5), 54562306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_AUD_ENG2, "aud_eng2_sel", 54662306a36Sopenharmony_ci aud_engen2_parents, 0xd0, 0xd4, 0xd8, 8, 2, 15, 0x008, 6), 54762306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_FAES_UFSFDE, "faes_ufsfde_sel", 54862306a36Sopenharmony_ci faes_ufsfde_parents, 0xd0, 0xd4, 0xd8, 16, 3, 23, 0x008, 7), 54962306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_FUFS, "fufs_sel", 55062306a36Sopenharmony_ci fufs_parents, 0xd0, 0xd4, 0xd8, 24, 2, 31, 0x008, 8), 55162306a36Sopenharmony_ci /* CLK_CFG_10 */ 55262306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_AUD_1, "aud_1_sel", 55362306a36Sopenharmony_ci aud_1_parents, 0xe0, 0xe4, 0xe8, 0, 1, 7, 0x008, 9), 55462306a36Sopenharmony_ci MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_AUD_2, "aud_2_sel", 55562306a36Sopenharmony_ci aud_2_parents, 0xe0, 0xe4, 0xe8, 8, 1, 15, 0x008, 10), 55662306a36Sopenharmony_ci}; 55762306a36Sopenharmony_ci 55862306a36Sopenharmony_cistatic const char * const apll_i2s0_parents[] = { 55962306a36Sopenharmony_ci "aud_1_sel", 56062306a36Sopenharmony_ci "aud_2_sel" 56162306a36Sopenharmony_ci}; 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_cistatic const char * const apll_i2s1_parents[] = { 56462306a36Sopenharmony_ci "aud_1_sel", 56562306a36Sopenharmony_ci "aud_2_sel" 56662306a36Sopenharmony_ci}; 56762306a36Sopenharmony_ci 56862306a36Sopenharmony_cistatic const char * const apll_i2s2_parents[] = { 56962306a36Sopenharmony_ci "aud_1_sel", 57062306a36Sopenharmony_ci "aud_2_sel" 57162306a36Sopenharmony_ci}; 57262306a36Sopenharmony_ci 57362306a36Sopenharmony_cistatic const char * const apll_i2s3_parents[] = { 57462306a36Sopenharmony_ci "aud_1_sel", 57562306a36Sopenharmony_ci "aud_2_sel" 57662306a36Sopenharmony_ci}; 57762306a36Sopenharmony_ci 57862306a36Sopenharmony_cistatic const char * const apll_i2s4_parents[] = { 57962306a36Sopenharmony_ci "aud_1_sel", 58062306a36Sopenharmony_ci "aud_2_sel" 58162306a36Sopenharmony_ci}; 58262306a36Sopenharmony_ci 58362306a36Sopenharmony_cistatic const char * const apll_i2s5_parents[] = { 58462306a36Sopenharmony_ci "aud_1_sel", 58562306a36Sopenharmony_ci "aud_2_sel" 58662306a36Sopenharmony_ci}; 58762306a36Sopenharmony_ci 58862306a36Sopenharmony_cistatic const char * const mcu_mp0_parents[] = { 58962306a36Sopenharmony_ci "clk26m", 59062306a36Sopenharmony_ci "armpll_ll", 59162306a36Sopenharmony_ci "armpll_div_pll1", 59262306a36Sopenharmony_ci "armpll_div_pll2" 59362306a36Sopenharmony_ci}; 59462306a36Sopenharmony_ci 59562306a36Sopenharmony_cistatic const char * const mcu_mp2_parents[] = { 59662306a36Sopenharmony_ci "clk26m", 59762306a36Sopenharmony_ci "armpll_l", 59862306a36Sopenharmony_ci "armpll_div_pll1", 59962306a36Sopenharmony_ci "armpll_div_pll2" 60062306a36Sopenharmony_ci}; 60162306a36Sopenharmony_ci 60262306a36Sopenharmony_cistatic const char * const mcu_bus_parents[] = { 60362306a36Sopenharmony_ci "clk26m", 60462306a36Sopenharmony_ci "ccipll", 60562306a36Sopenharmony_ci "armpll_div_pll1", 60662306a36Sopenharmony_ci "armpll_div_pll2" 60762306a36Sopenharmony_ci}; 60862306a36Sopenharmony_ci 60962306a36Sopenharmony_cistatic struct mtk_composite mcu_muxes[] = { 61062306a36Sopenharmony_ci /* mp0_pll_divider_cfg */ 61162306a36Sopenharmony_ci MUX(CLK_MCU_MP0_SEL, "mcu_mp0_sel", mcu_mp0_parents, 0x7A0, 9, 2), 61262306a36Sopenharmony_ci /* mp2_pll_divider_cfg */ 61362306a36Sopenharmony_ci MUX(CLK_MCU_MP2_SEL, "mcu_mp2_sel", mcu_mp2_parents, 0x7A8, 9, 2), 61462306a36Sopenharmony_ci /* bus_pll_divider_cfg */ 61562306a36Sopenharmony_ci MUX(CLK_MCU_BUS_SEL, "mcu_bus_sel", mcu_bus_parents, 0x7C0, 9, 2), 61662306a36Sopenharmony_ci}; 61762306a36Sopenharmony_ci 61862306a36Sopenharmony_cistatic struct mtk_composite top_aud_comp[] = { 61962306a36Sopenharmony_ci MUX(CLK_TOP_MUX_APLL_I2S0, "apll_i2s0_sel", apll_i2s0_parents, 0x320, 8, 1), 62062306a36Sopenharmony_ci MUX(CLK_TOP_MUX_APLL_I2S1, "apll_i2s1_sel", apll_i2s1_parents, 0x320, 9, 1), 62162306a36Sopenharmony_ci MUX(CLK_TOP_MUX_APLL_I2S2, "apll_i2s2_sel", apll_i2s2_parents, 0x320, 10, 1), 62262306a36Sopenharmony_ci MUX(CLK_TOP_MUX_APLL_I2S3, "apll_i2s3_sel", apll_i2s3_parents, 0x320, 11, 1), 62362306a36Sopenharmony_ci MUX(CLK_TOP_MUX_APLL_I2S4, "apll_i2s4_sel", apll_i2s4_parents, 0x320, 12, 1), 62462306a36Sopenharmony_ci MUX(CLK_TOP_MUX_APLL_I2S5, "apll_i2s5_sel", apll_i2s5_parents, 0x328, 20, 1), 62562306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV0, "apll12_div0", "apll_i2s0_sel", 0x320, 2, 0x324, 8, 0), 62662306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV1, "apll12_div1", "apll_i2s1_sel", 0x320, 3, 0x324, 8, 8), 62762306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV2, "apll12_div2", "apll_i2s2_sel", 0x320, 4, 0x324, 8, 16), 62862306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV3, "apll12_div3", "apll_i2s3_sel", 0x320, 5, 0x324, 8, 24), 62962306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIV4, "apll12_div4", "apll_i2s4_sel", 0x320, 6, 0x328, 8, 0), 63062306a36Sopenharmony_ci DIV_GATE(CLK_TOP_APLL12_DIVB, "apll12_divb", "apll12_div4", 0x320, 7, 0x328, 8, 8), 63162306a36Sopenharmony_ci}; 63262306a36Sopenharmony_ci 63362306a36Sopenharmony_cistatic const struct mtk_gate_regs top_cg_regs = { 63462306a36Sopenharmony_ci .set_ofs = 0x104, 63562306a36Sopenharmony_ci .clr_ofs = 0x104, 63662306a36Sopenharmony_ci .sta_ofs = 0x104, 63762306a36Sopenharmony_ci}; 63862306a36Sopenharmony_ci 63962306a36Sopenharmony_ci#define GATE_TOP(_id, _name, _parent, _shift) \ 64062306a36Sopenharmony_ci GATE_MTK(_id, _name, _parent, &top_cg_regs, _shift, \ 64162306a36Sopenharmony_ci &mtk_clk_gate_ops_no_setclr_inv) 64262306a36Sopenharmony_ci 64362306a36Sopenharmony_cistatic const struct mtk_gate top_clks[] = { 64462306a36Sopenharmony_ci /* TOP */ 64562306a36Sopenharmony_ci GATE_TOP(CLK_TOP_ARMPLL_DIV_PLL1, "armpll_div_pll1", "mainpll", 4), 64662306a36Sopenharmony_ci GATE_TOP(CLK_TOP_ARMPLL_DIV_PLL2, "armpll_div_pll2", "univpll", 5), 64762306a36Sopenharmony_ci}; 64862306a36Sopenharmony_ci 64962306a36Sopenharmony_cistatic const struct mtk_gate_regs infra0_cg_regs = { 65062306a36Sopenharmony_ci .set_ofs = 0x80, 65162306a36Sopenharmony_ci .clr_ofs = 0x84, 65262306a36Sopenharmony_ci .sta_ofs = 0x90, 65362306a36Sopenharmony_ci}; 65462306a36Sopenharmony_ci 65562306a36Sopenharmony_cistatic const struct mtk_gate_regs infra1_cg_regs = { 65662306a36Sopenharmony_ci .set_ofs = 0x88, 65762306a36Sopenharmony_ci .clr_ofs = 0x8c, 65862306a36Sopenharmony_ci .sta_ofs = 0x94, 65962306a36Sopenharmony_ci}; 66062306a36Sopenharmony_ci 66162306a36Sopenharmony_cistatic const struct mtk_gate_regs infra2_cg_regs = { 66262306a36Sopenharmony_ci .set_ofs = 0xa4, 66362306a36Sopenharmony_ci .clr_ofs = 0xa8, 66462306a36Sopenharmony_ci .sta_ofs = 0xac, 66562306a36Sopenharmony_ci}; 66662306a36Sopenharmony_ci 66762306a36Sopenharmony_cistatic const struct mtk_gate_regs infra3_cg_regs = { 66862306a36Sopenharmony_ci .set_ofs = 0xc0, 66962306a36Sopenharmony_ci .clr_ofs = 0xc4, 67062306a36Sopenharmony_ci .sta_ofs = 0xc8, 67162306a36Sopenharmony_ci}; 67262306a36Sopenharmony_ci 67362306a36Sopenharmony_ci#define GATE_INFRA0(_id, _name, _parent, _shift) \ 67462306a36Sopenharmony_ci GATE_MTK(_id, _name, _parent, &infra0_cg_regs, _shift, \ 67562306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr) 67662306a36Sopenharmony_ci 67762306a36Sopenharmony_ci#define GATE_INFRA1(_id, _name, _parent, _shift) \ 67862306a36Sopenharmony_ci GATE_MTK(_id, _name, _parent, &infra1_cg_regs, _shift, \ 67962306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr) 68062306a36Sopenharmony_ci 68162306a36Sopenharmony_ci#define GATE_INFRA2(_id, _name, _parent, _shift) \ 68262306a36Sopenharmony_ci GATE_MTK(_id, _name, _parent, &infra2_cg_regs, _shift, \ 68362306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr) 68462306a36Sopenharmony_ci 68562306a36Sopenharmony_ci#define GATE_INFRA2_FLAGS(_id, _name, _parent, _shift, _flag) \ 68662306a36Sopenharmony_ci GATE_MTK_FLAGS(_id, _name, _parent, &infra2_cg_regs, \ 68762306a36Sopenharmony_ci _shift, &mtk_clk_gate_ops_setclr, _flag) 68862306a36Sopenharmony_ci 68962306a36Sopenharmony_ci#define GATE_INFRA3(_id, _name, _parent, _shift) \ 69062306a36Sopenharmony_ci GATE_MTK(_id, _name, _parent, &infra3_cg_regs, _shift, \ 69162306a36Sopenharmony_ci &mtk_clk_gate_ops_setclr) 69262306a36Sopenharmony_ci 69362306a36Sopenharmony_ci#define GATE_INFRA3_FLAGS(_id, _name, _parent, _shift, _flag) \ 69462306a36Sopenharmony_ci GATE_MTK_FLAGS(_id, _name, _parent, &infra3_cg_regs, \ 69562306a36Sopenharmony_ci _shift, &mtk_clk_gate_ops_setclr, _flag) 69662306a36Sopenharmony_ci 69762306a36Sopenharmony_cistatic const struct mtk_gate infra_clks[] = { 69862306a36Sopenharmony_ci /* INFRA0 */ 69962306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PMIC_TMR, "infra_pmic_tmr", "axi_sel", 0), 70062306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PMIC_AP, "infra_pmic_ap", "axi_sel", 1), 70162306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PMIC_MD, "infra_pmic_md", "axi_sel", 2), 70262306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PMIC_CONN, "infra_pmic_conn", "axi_sel", 3), 70362306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_SCPSYS, "infra_scp", "scp_sel", 4), 70462306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_SEJ, "infra_sej", "f_f26m_ck", 5), 70562306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_APXGPT, "infra_apxgpt", "axi_sel", 6), 70662306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_ICUSB, "infra_icusb", "axi_sel", 8), 70762306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_GCE, "infra_gce", "axi_sel", 9), 70862306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_THERM, "infra_therm", "axi_sel", 10), 70962306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_I2C0, "infra_i2c0", "i2c_sel", 11), 71062306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_I2C1, "infra_i2c1", "i2c_sel", 12), 71162306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_I2C2, "infra_i2c2", "i2c_sel", 13), 71262306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_I2C3, "infra_i2c3", "i2c_sel", 14), 71362306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM_HCLK, "infra_pwm_hclk", "axi_sel", 15), 71462306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM1, "infra_pwm1", "i2c_sel", 16), 71562306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM2, "infra_pwm2", "i2c_sel", 17), 71662306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM3, "infra_pwm3", "i2c_sel", 18), 71762306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM4, "infra_pwm4", "i2c_sel", 19), 71862306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_PWM, "infra_pwm", "i2c_sel", 21), 71962306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_UART0, "infra_uart0", "uart_sel", 22), 72062306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_UART1, "infra_uart1", "uart_sel", 23), 72162306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_UART2, "infra_uart2", "uart_sel", 24), 72262306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_UART3, "infra_uart3", "uart_sel", 25), 72362306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_GCE_26M, "infra_gce_26m", "axi_sel", 27), 72462306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_CQ_DMA_FPC, "infra_cqdma_fpc", "axi_sel", 28), 72562306a36Sopenharmony_ci GATE_INFRA0(CLK_INFRA_BTIF, "infra_btif", "axi_sel", 31), 72662306a36Sopenharmony_ci /* INFRA1 */ 72762306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_SPI0, "infra_spi0", "spi_sel", 1), 72862306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC0, "infra_msdc0", "msdc50_hclk_sel", 2), 72962306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC1, "infra_msdc1", "axi_sel", 4), 73062306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC2, "infra_msdc2", "axi_sel", 5), 73162306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC0_SCK, "infra_msdc0_sck", "msdc50_0_sel", 6), 73262306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DVFSRC, "infra_dvfsrc", "f_f26m_ck", 7), 73362306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_GCPU, "infra_gcpu", "axi_sel", 8), 73462306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_TRNG, "infra_trng", "axi_sel", 9), 73562306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_AUXADC, "infra_auxadc", "f_f26m_ck", 10), 73662306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_CPUM, "infra_cpum", "axi_sel", 11), 73762306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_CCIF1_AP, "infra_ccif1_ap", "axi_sel", 12), 73862306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_CCIF1_MD, "infra_ccif1_md", "axi_sel", 13), 73962306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_AUXADC_MD, "infra_auxadc_md", "f_f26m_ck", 14), 74062306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC1_SCK, "infra_msdc1_sck", "msdc30_1_sel", 16), 74162306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_MSDC2_SCK, "infra_msdc2_sck", "msdc30_2_sel", 17), 74262306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_AP_DMA, "infra_apdma", "axi_sel", 18), 74362306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_XIU, "infra_xiu", "axi_sel", 19), 74462306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DEVICE_APC, "infra_device_apc", "axi_sel", 20), 74562306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_CCIF_AP, "infra_ccif_ap", "axi_sel", 23), 74662306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DEBUGSYS, "infra_debugsys", "axi_sel", 24), 74762306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_AUDIO, "infra_audio", "axi_sel", 25), 74862306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_CCIF_MD, "infra_ccif_md", "axi_sel", 26), 74962306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DXCC_SEC_CORE, "infra_dxcc_sec_core", "dxcc_sel", 27), 75062306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DXCC_AO, "infra_dxcc_ao", "dxcc_sel", 28), 75162306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DEVMPU_BCLK, "infra_devmpu_bclk", "axi_sel", 30), 75262306a36Sopenharmony_ci GATE_INFRA1(CLK_INFRA_DRAMC_F26M, "infra_dramc_f26m", "f_f26m_ck", 31), 75362306a36Sopenharmony_ci /* INFRA2 */ 75462306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_IRTX, "infra_irtx", "f_f26m_ck", 0), 75562306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_USB, "infra_usb", "usb_top_sel", 1), 75662306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_DISP_PWM, "infra_disppwm", "axi_sel", 2), 75762306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_CLDMA_BCLK, "infra_cldma_bclk", "axi_sel", 3), 75862306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_AUDIO_26M_BCLK, "infra_audio_26m_bclk", "f_f26m_ck", 4), 75962306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SPI1, "infra_spi1", "spi_sel", 6), 76062306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C4, "infra_i2c4", "i2c_sel", 7), 76162306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_MODEM_TEMP_SHARE, "infra_md_tmp_share", "f_f26m_ck", 8), 76262306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SPI2, "infra_spi2", "spi_sel", 9), 76362306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SPI3, "infra_spi3", "spi_sel", 10), 76462306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UNIPRO_SCK, "infra_unipro_sck", "ssusb_top_xhci_sel", 11), 76562306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UNIPRO_TICK, "infra_unipro_tick", "fufs_sel", 12), 76662306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UFS_MP_SAP_BCLK, "infra_ufs_mp_sap_bck", "fufs_sel", 13), 76762306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_MD32_BCLK, "infra_md32_bclk", "axi_sel", 14), 76862306a36Sopenharmony_ci /* infra_sspm is main clock in co-processor, should not be closed in Linux. */ 76962306a36Sopenharmony_ci GATE_INFRA2_FLAGS(CLK_INFRA_SSPM, "infra_sspm", "sspm_sel", 15, CLK_IS_CRITICAL), 77062306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UNIPRO_MBIST, "infra_unipro_mbist", "axi_sel", 16), 77162306a36Sopenharmony_ci /* infra_sspm_bus_hclk is main clock in co-processor, should not be closed in Linux. */ 77262306a36Sopenharmony_ci GATE_INFRA2_FLAGS(CLK_INFRA_SSPM_BUS_HCLK, "infra_sspm_bus_hclk", "axi_sel", 17, CLK_IS_CRITICAL), 77362306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C5, "infra_i2c5", "i2c_sel", 18), 77462306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C5_ARBITER, "infra_i2c5_arbiter", "i2c_sel", 19), 77562306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C5_IMM, "infra_i2c5_imm", "i2c_sel", 20), 77662306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C1_ARBITER, "infra_i2c1_arbiter", "i2c_sel", 21), 77762306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C1_IMM, "infra_i2c1_imm", "i2c_sel", 22), 77862306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C2_ARBITER, "infra_i2c2_arbiter", "i2c_sel", 23), 77962306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_I2C2_IMM, "infra_i2c2_imm", "i2c_sel", 24), 78062306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SPI4, "infra_spi4", "spi_sel", 25), 78162306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_SPI5, "infra_spi5", "spi_sel", 26), 78262306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_CQ_DMA, "infra_cqdma", "axi_sel", 27), 78362306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UFS, "infra_ufs", "fufs_sel", 28), 78462306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_AES_UFSFDE, "infra_aes_ufsfde", "faes_ufsfde_sel", 29), 78562306a36Sopenharmony_ci GATE_INFRA2(CLK_INFRA_UFS_TICK, "infra_ufs_tick", "fufs_sel", 30), 78662306a36Sopenharmony_ci /* INFRA3 */ 78762306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_MSDC0_SELF, "infra_msdc0_self", "msdc50_0_sel", 0), 78862306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_MSDC1_SELF, "infra_msdc1_self", "msdc50_0_sel", 1), 78962306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_MSDC2_SELF, "infra_msdc2_self", "msdc50_0_sel", 2), 79062306a36Sopenharmony_ci /* infra_sspm_26m_self is main clock in co-processor, should not be closed in Linux. */ 79162306a36Sopenharmony_ci GATE_INFRA3_FLAGS(CLK_INFRA_SSPM_26M_SELF, "infra_sspm_26m_self", "f_f26m_ck", 3, CLK_IS_CRITICAL), 79262306a36Sopenharmony_ci /* infra_sspm_32k_self is main clock in co-processor, should not be closed in Linux. */ 79362306a36Sopenharmony_ci GATE_INFRA3_FLAGS(CLK_INFRA_SSPM_32K_SELF, "infra_sspm_32k_self", "clk32k", 4, CLK_IS_CRITICAL), 79462306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_UFS_AXI, "infra_ufs_axi", "axi_sel", 5), 79562306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_I2C6, "infra_i2c6", "i2c_sel", 6), 79662306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_AP_MSDC0, "infra_ap_msdc0", "msdc50_hclk_sel", 7), 79762306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_MD_MSDC0, "infra_md_msdc0", "msdc50_hclk_sel", 8), 79862306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF2_AP, "infra_ccif2_ap", "axi_sel", 16), 79962306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF2_MD, "infra_ccif2_md", "axi_sel", 17), 80062306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF3_AP, "infra_ccif3_ap", "axi_sel", 18), 80162306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_CCIF3_MD, "infra_ccif3_md", "axi_sel", 19), 80262306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_SEJ_F13M, "infra_sej_f13m", "f_f26m_ck", 20), 80362306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_AES_BCLK, "infra_aes_bclk", "axi_sel", 21), 80462306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_I2C7, "infra_i2c7", "i2c_sel", 22), 80562306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_I2C8, "infra_i2c8", "i2c_sel", 23), 80662306a36Sopenharmony_ci GATE_INFRA3(CLK_INFRA_FBIST2FPC, "infra_fbist2fpc", "msdc50_0_sel", 24), 80762306a36Sopenharmony_ci}; 80862306a36Sopenharmony_ci 80962306a36Sopenharmony_cistatic const struct mtk_gate_regs peri_cg_regs = { 81062306a36Sopenharmony_ci .set_ofs = 0x20c, 81162306a36Sopenharmony_ci .clr_ofs = 0x20c, 81262306a36Sopenharmony_ci .sta_ofs = 0x20c, 81362306a36Sopenharmony_ci}; 81462306a36Sopenharmony_ci 81562306a36Sopenharmony_ci#define GATE_PERI(_id, _name, _parent, _shift) \ 81662306a36Sopenharmony_ci GATE_MTK(_id, _name, _parent, &peri_cg_regs, _shift, \ 81762306a36Sopenharmony_ci &mtk_clk_gate_ops_no_setclr_inv) 81862306a36Sopenharmony_ci 81962306a36Sopenharmony_cistatic const struct mtk_gate peri_clks[] = { 82062306a36Sopenharmony_ci GATE_PERI(CLK_PERI_AXI, "peri_axi", "axi_sel", 31), 82162306a36Sopenharmony_ci}; 82262306a36Sopenharmony_ci 82362306a36Sopenharmony_cistatic u16 infra_rst_ofs[] = { 82462306a36Sopenharmony_ci INFRA_RST0_SET_OFFSET, 82562306a36Sopenharmony_ci INFRA_RST1_SET_OFFSET, 82662306a36Sopenharmony_ci INFRA_RST2_SET_OFFSET, 82762306a36Sopenharmony_ci INFRA_RST3_SET_OFFSET, 82862306a36Sopenharmony_ci}; 82962306a36Sopenharmony_ci 83062306a36Sopenharmony_cistatic const struct mtk_clk_rst_desc clk_rst_desc = { 83162306a36Sopenharmony_ci .version = MTK_RST_SET_CLR, 83262306a36Sopenharmony_ci .rst_bank_ofs = infra_rst_ofs, 83362306a36Sopenharmony_ci .rst_bank_nr = ARRAY_SIZE(infra_rst_ofs), 83462306a36Sopenharmony_ci}; 83562306a36Sopenharmony_ci 83662306a36Sopenharmony_ci/* Register mux notifier for MFG mux */ 83762306a36Sopenharmony_cistatic int clk_mt8183_reg_mfg_mux_notifier(struct device *dev, struct clk *clk) 83862306a36Sopenharmony_ci{ 83962306a36Sopenharmony_ci struct mtk_mux_nb *mfg_mux_nb; 84062306a36Sopenharmony_ci int i; 84162306a36Sopenharmony_ci 84262306a36Sopenharmony_ci mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb), GFP_KERNEL); 84362306a36Sopenharmony_ci if (!mfg_mux_nb) 84462306a36Sopenharmony_ci return -ENOMEM; 84562306a36Sopenharmony_ci 84662306a36Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(top_muxes); i++) 84762306a36Sopenharmony_ci if (top_muxes[i].id == CLK_TOP_MUX_MFG) 84862306a36Sopenharmony_ci break; 84962306a36Sopenharmony_ci if (i == ARRAY_SIZE(top_muxes)) 85062306a36Sopenharmony_ci return -EINVAL; 85162306a36Sopenharmony_ci 85262306a36Sopenharmony_ci mfg_mux_nb->ops = top_muxes[i].ops; 85362306a36Sopenharmony_ci mfg_mux_nb->bypass_index = 0; /* Bypass to 26M crystal */ 85462306a36Sopenharmony_ci 85562306a36Sopenharmony_ci return devm_mtk_clk_mux_notifier_register(dev, clk, mfg_mux_nb); 85662306a36Sopenharmony_ci} 85762306a36Sopenharmony_ci 85862306a36Sopenharmony_cistatic const struct mtk_clk_desc infra_desc = { 85962306a36Sopenharmony_ci .clks = infra_clks, 86062306a36Sopenharmony_ci .num_clks = ARRAY_SIZE(infra_clks), 86162306a36Sopenharmony_ci .rst_desc = &clk_rst_desc, 86262306a36Sopenharmony_ci}; 86362306a36Sopenharmony_ci 86462306a36Sopenharmony_cistatic const struct mtk_clk_desc mcu_desc = { 86562306a36Sopenharmony_ci .composite_clks = mcu_muxes, 86662306a36Sopenharmony_ci .num_composite_clks = ARRAY_SIZE(mcu_muxes), 86762306a36Sopenharmony_ci .clk_lock = &mt8183_clk_lock, 86862306a36Sopenharmony_ci}; 86962306a36Sopenharmony_ci 87062306a36Sopenharmony_cistatic const struct mtk_clk_desc peri_desc = { 87162306a36Sopenharmony_ci .clks = peri_clks, 87262306a36Sopenharmony_ci .num_clks = ARRAY_SIZE(peri_clks), 87362306a36Sopenharmony_ci}; 87462306a36Sopenharmony_ci 87562306a36Sopenharmony_cistatic const struct mtk_clk_desc topck_desc = { 87662306a36Sopenharmony_ci .fixed_clks = top_fixed_clks, 87762306a36Sopenharmony_ci .num_fixed_clks = ARRAY_SIZE(top_fixed_clks), 87862306a36Sopenharmony_ci .factor_clks = top_divs, 87962306a36Sopenharmony_ci .num_factor_clks = ARRAY_SIZE(top_divs), 88062306a36Sopenharmony_ci .mux_clks = top_muxes, 88162306a36Sopenharmony_ci .num_mux_clks = ARRAY_SIZE(top_muxes), 88262306a36Sopenharmony_ci .composite_clks = top_aud_comp, 88362306a36Sopenharmony_ci .num_composite_clks = ARRAY_SIZE(top_aud_comp), 88462306a36Sopenharmony_ci .clks = top_clks, 88562306a36Sopenharmony_ci .num_clks = ARRAY_SIZE(top_clks), 88662306a36Sopenharmony_ci .clk_lock = &mt8183_clk_lock, 88762306a36Sopenharmony_ci .clk_notifier_func = clk_mt8183_reg_mfg_mux_notifier, 88862306a36Sopenharmony_ci .mfg_clk_idx = CLK_TOP_MUX_MFG, 88962306a36Sopenharmony_ci}; 89062306a36Sopenharmony_ci 89162306a36Sopenharmony_cistatic const struct of_device_id of_match_clk_mt8183[] = { 89262306a36Sopenharmony_ci { .compatible = "mediatek,mt8183-infracfg", .data = &infra_desc }, 89362306a36Sopenharmony_ci { .compatible = "mediatek,mt8183-mcucfg", .data = &mcu_desc }, 89462306a36Sopenharmony_ci { .compatible = "mediatek,mt8183-pericfg", .data = &peri_desc, }, 89562306a36Sopenharmony_ci { .compatible = "mediatek,mt8183-topckgen", .data = &topck_desc }, 89662306a36Sopenharmony_ci { /* sentinel */ } 89762306a36Sopenharmony_ci}; 89862306a36Sopenharmony_ciMODULE_DEVICE_TABLE(of, of_match_clk_mt8183); 89962306a36Sopenharmony_ci 90062306a36Sopenharmony_cistatic struct platform_driver clk_mt8183_drv = { 90162306a36Sopenharmony_ci .probe = mtk_clk_simple_probe, 90262306a36Sopenharmony_ci .remove_new = mtk_clk_simple_remove, 90362306a36Sopenharmony_ci .driver = { 90462306a36Sopenharmony_ci .name = "clk-mt8183", 90562306a36Sopenharmony_ci .of_match_table = of_match_clk_mt8183, 90662306a36Sopenharmony_ci }, 90762306a36Sopenharmony_ci}; 90862306a36Sopenharmony_cimodule_platform_driver(clk_mt8183_drv) 90962306a36Sopenharmony_ciMODULE_LICENSE("GPL"); 910