18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2020 MediaTek Inc. 48c2ecf20Sopenharmony_ci * Copyright (c) 2020 BayLibre, SAS 58c2ecf20Sopenharmony_ci * Author: James Liao <jamesjj.liao@mediatek.com> 68c2ecf20Sopenharmony_ci * Fabien Parent <fparent@baylibre.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/delay.h> 108c2ecf20Sopenharmony_ci#include <linux/of.h> 118c2ecf20Sopenharmony_ci#include <linux/of_address.h> 128c2ecf20Sopenharmony_ci#include <linux/slab.h> 138c2ecf20Sopenharmony_ci#include <linux/mfd/syscon.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include "clk-mtk.h" 168c2ecf20Sopenharmony_ci#include "clk-gate.h" 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#include <dt-bindings/clock/mt8167-clk.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_cistatic DEFINE_SPINLOCK(mt8167_clk_lock); 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_cistatic const struct mtk_fixed_clk fixed_clks[] __initconst = { 238c2ecf20Sopenharmony_ci FIXED_CLK(CLK_TOP_CLK_NULL, "clk_null", NULL, 0), 248c2ecf20Sopenharmony_ci FIXED_CLK(CLK_TOP_I2S_INFRA_BCK, "i2s_infra_bck", "clk_null", 26000000), 258c2ecf20Sopenharmony_ci FIXED_CLK(CLK_TOP_MEMPLL, "mempll", "clk26m", 800000000), 268c2ecf20Sopenharmony_ci FIXED_CLK(CLK_TOP_DSI0_LNTC_DSICK, "dsi0_lntc_dsick", "clk26m", 75000000), 278c2ecf20Sopenharmony_ci FIXED_CLK(CLK_TOP_VPLL_DPIX, "vpll_dpix", "clk26m", 75000000), 288c2ecf20Sopenharmony_ci FIXED_CLK(CLK_TOP_LVDSTX_CLKDIG_CTS, "lvdstx_dig_cts", "clk26m", 52500000), 298c2ecf20Sopenharmony_ci}; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_cistatic const struct mtk_fixed_factor top_divs[] __initconst = { 328c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_DMPLL, "dmpll_ck", "mempll", 1, 1), 338c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D2, "mainpll_d2", "mainpll", 1, 2), 348c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D4, "mainpll_d4", "mainpll", 1, 4), 358c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D8, "mainpll_d8", "mainpll", 1, 8), 368c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D16, "mainpll_d16", "mainpll", 1, 16), 378c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D11, "mainpll_d11", "mainpll", 1, 11), 388c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D22, "mainpll_d22", "mainpll", 1, 22), 398c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D3, "mainpll_d3", "mainpll", 1, 3), 408c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D6, "mainpll_d6", "mainpll", 1, 6), 418c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D12, "mainpll_d12", "mainpll", 1, 12), 428c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D5, "mainpll_d5", "mainpll", 1, 5), 438c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D10, "mainpll_d10", "mainpll", 1, 10), 448c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D20, "mainpll_d20", "mainpll", 1, 20), 458c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D40, "mainpll_d40", "mainpll", 1, 40), 468c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D7, "mainpll_d7", "mainpll", 1, 7), 478c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MAINPLL_D14, "mainpll_d14", "mainpll", 1, 14), 488c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_UNIVPLL_D2, "univpll_d2", "univpll", 1, 2), 498c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_UNIVPLL_D4, "univpll_d4", "univpll", 1, 4), 508c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_UNIVPLL_D8, "univpll_d8", "univpll", 1, 8), 518c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_UNIVPLL_D16, "univpll_d16", "univpll", 1, 16), 528c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_UNIVPLL_D3, "univpll_d3", "univpll", 1, 3), 538c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_UNIVPLL_D6, "univpll_d6", "univpll", 1, 6), 548c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_UNIVPLL_D12, "univpll_d12", "univpll", 1, 12), 558c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_UNIVPLL_D24, "univpll_d24", "univpll", 1, 24), 568c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_UNIVPLL_D5, "univpll_d5", "univpll", 1, 5), 578c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_UNIVPLL_D20, "univpll_d20", "univpll", 1, 20), 588c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MMPLL380M, "mmpll380m", "mmpll", 1, 1), 598c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_D2, "mmpll_d2", "mmpll", 1, 2), 608c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MMPLL_200M, "mmpll_200m", "mmpll", 1, 3), 618c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_LVDSPLL, "lvdspll_ck", "lvdspll", 1, 1), 628c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_LVDSPLL_D2, "lvdspll_d2", "lvdspll", 1, 2), 638c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_LVDSPLL_D4, "lvdspll_d4", "lvdspll", 1, 4), 648c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_LVDSPLL_D8, "lvdspll_d8", "lvdspll", 1, 8), 658c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_USB_PHY48M, "usb_phy48m_ck", "univpll", 1, 26), 668c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_APLL1, "apll1_ck", "apll1", 1, 1), 678c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_APLL1_D2, "apll1_d2", "apll1_ck", 1, 2), 688c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_APLL1_D4, "apll1_d4", "rg_apll1_d2_en", 1, 2), 698c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_APLL1_D8, "apll1_d8", "rg_apll1_d4_en", 1, 2), 708c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_APLL2, "apll2_ck", "apll2", 1, 1), 718c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_APLL2_D2, "apll2_d2", "apll2_ck", 1, 2), 728c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_APLL2_D4, "apll2_d4", "rg_apll2_d2_en", 1, 2), 738c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_APLL2_D8, "apll2_d8", "rg_apll2_d4_en", 1, 2), 748c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_CLK26M, "clk26m_ck", "clk26m", 1, 1), 758c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_CLK26M_D2, "clk26m_d2", "clk26m", 1, 2), 768c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_MIPI_26M, "mipi_26m", "clk26m", 1, 1), 778c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL, "tvdpll_ck", "tvdpll", 1, 1), 788c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D2, "tvdpll_d2", "tvdpll_ck", 1, 2), 798c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D4, "tvdpll_d4", "tvdpll_ck", 1, 4), 808c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D8, "tvdpll_d8", "tvdpll_ck", 1, 8), 818c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_TVDPLL_D16, "tvdpll_d16", "tvdpll_ck", 1, 16), 828c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_AHB_INFRA_D2, "ahb_infra_d2", "ahb_infra_sel", 1, 2), 838c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_NFI1X, "nfi1x_ck", "nfi2x_pad_sel", 1, 2), 848c2ecf20Sopenharmony_ci FACTOR(CLK_TOP_ETH_D2, "eth_d2_ck", "eth_sel", 1, 2), 858c2ecf20Sopenharmony_ci}; 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cistatic const char * const uart0_parents[] __initconst = { 888c2ecf20Sopenharmony_ci "clk26m_ck", 898c2ecf20Sopenharmony_ci "univpll_d24" 908c2ecf20Sopenharmony_ci}; 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_cistatic const char * const gfmux_emi1x_parents[] __initconst = { 938c2ecf20Sopenharmony_ci "clk26m_ck", 948c2ecf20Sopenharmony_ci "dmpll_ck" 958c2ecf20Sopenharmony_ci}; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_cistatic const char * const emi_ddrphy_parents[] __initconst = { 988c2ecf20Sopenharmony_ci "gfmux_emi1x_sel", 998c2ecf20Sopenharmony_ci "gfmux_emi1x_sel" 1008c2ecf20Sopenharmony_ci}; 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_cistatic const char * const ahb_infra_parents[] __initconst = { 1038c2ecf20Sopenharmony_ci "clk_null", 1048c2ecf20Sopenharmony_ci "clk26m_ck", 1058c2ecf20Sopenharmony_ci "mainpll_d11", 1068c2ecf20Sopenharmony_ci "clk_null", 1078c2ecf20Sopenharmony_ci "mainpll_d12", 1088c2ecf20Sopenharmony_ci "clk_null", 1098c2ecf20Sopenharmony_ci "clk_null", 1108c2ecf20Sopenharmony_ci "clk_null", 1118c2ecf20Sopenharmony_ci "clk_null", 1128c2ecf20Sopenharmony_ci "clk_null", 1138c2ecf20Sopenharmony_ci "clk_null", 1148c2ecf20Sopenharmony_ci "clk_null", 1158c2ecf20Sopenharmony_ci "mainpll_d10" 1168c2ecf20Sopenharmony_ci}; 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_cistatic const char * const csw_mux_mfg_parents[] __initconst = { 1198c2ecf20Sopenharmony_ci "clk_null", 1208c2ecf20Sopenharmony_ci "clk_null", 1218c2ecf20Sopenharmony_ci "univpll_d3", 1228c2ecf20Sopenharmony_ci "univpll_d2", 1238c2ecf20Sopenharmony_ci "clk26m_ck", 1248c2ecf20Sopenharmony_ci "mainpll_d4", 1258c2ecf20Sopenharmony_ci "univpll_d24", 1268c2ecf20Sopenharmony_ci "mmpll380m" 1278c2ecf20Sopenharmony_ci}; 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_cistatic const char * const msdc0_parents[] __initconst = { 1308c2ecf20Sopenharmony_ci "clk26m_ck", 1318c2ecf20Sopenharmony_ci "univpll_d6", 1328c2ecf20Sopenharmony_ci "mainpll_d8", 1338c2ecf20Sopenharmony_ci "univpll_d8", 1348c2ecf20Sopenharmony_ci "mainpll_d16", 1358c2ecf20Sopenharmony_ci "mmpll_200m", 1368c2ecf20Sopenharmony_ci "mainpll_d12", 1378c2ecf20Sopenharmony_ci "mmpll_d2" 1388c2ecf20Sopenharmony_ci}; 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_cistatic const char * const camtg_mm_parents[] __initconst = { 1418c2ecf20Sopenharmony_ci "clk_null", 1428c2ecf20Sopenharmony_ci "clk26m_ck", 1438c2ecf20Sopenharmony_ci "usb_phy48m_ck", 1448c2ecf20Sopenharmony_ci "clk_null", 1458c2ecf20Sopenharmony_ci "univpll_d6" 1468c2ecf20Sopenharmony_ci}; 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_cistatic const char * const pwm_mm_parents[] __initconst = { 1498c2ecf20Sopenharmony_ci "clk26m_ck", 1508c2ecf20Sopenharmony_ci "univpll_d12" 1518c2ecf20Sopenharmony_ci}; 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_cistatic const char * const uart1_parents[] __initconst = { 1548c2ecf20Sopenharmony_ci "clk26m_ck", 1558c2ecf20Sopenharmony_ci "univpll_d24" 1568c2ecf20Sopenharmony_ci}; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_cistatic const char * const msdc1_parents[] __initconst = { 1598c2ecf20Sopenharmony_ci "clk26m_ck", 1608c2ecf20Sopenharmony_ci "univpll_d6", 1618c2ecf20Sopenharmony_ci "mainpll_d8", 1628c2ecf20Sopenharmony_ci "univpll_d8", 1638c2ecf20Sopenharmony_ci "mainpll_d16", 1648c2ecf20Sopenharmony_ci "mmpll_200m", 1658c2ecf20Sopenharmony_ci "mainpll_d12", 1668c2ecf20Sopenharmony_ci "mmpll_d2" 1678c2ecf20Sopenharmony_ci}; 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_cistatic const char * const spm_52m_parents[] __initconst = { 1708c2ecf20Sopenharmony_ci "clk26m_ck", 1718c2ecf20Sopenharmony_ci "univpll_d24" 1728c2ecf20Sopenharmony_ci}; 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_cistatic const char * const pmicspi_parents[] __initconst = { 1758c2ecf20Sopenharmony_ci "univpll_d20", 1768c2ecf20Sopenharmony_ci "usb_phy48m_ck", 1778c2ecf20Sopenharmony_ci "univpll_d16", 1788c2ecf20Sopenharmony_ci "clk26m_ck" 1798c2ecf20Sopenharmony_ci}; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_cistatic const char * const qaxi_aud26m_parents[] __initconst = { 1828c2ecf20Sopenharmony_ci "clk26m_ck", 1838c2ecf20Sopenharmony_ci "ahb_infra_sel" 1848c2ecf20Sopenharmony_ci}; 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_cistatic const char * const aud_intbus_parents[] __initconst = { 1878c2ecf20Sopenharmony_ci "clk_null", 1888c2ecf20Sopenharmony_ci "clk26m_ck", 1898c2ecf20Sopenharmony_ci "mainpll_d22", 1908c2ecf20Sopenharmony_ci "clk_null", 1918c2ecf20Sopenharmony_ci "mainpll_d11" 1928c2ecf20Sopenharmony_ci}; 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_cistatic const char * const nfi2x_pad_parents[] __initconst = { 1958c2ecf20Sopenharmony_ci "clk_null", 1968c2ecf20Sopenharmony_ci "clk_null", 1978c2ecf20Sopenharmony_ci "clk_null", 1988c2ecf20Sopenharmony_ci "clk_null", 1998c2ecf20Sopenharmony_ci "clk_null", 2008c2ecf20Sopenharmony_ci "clk_null", 2018c2ecf20Sopenharmony_ci "clk_null", 2028c2ecf20Sopenharmony_ci "clk_null", 2038c2ecf20Sopenharmony_ci "clk26m_ck", 2048c2ecf20Sopenharmony_ci "clk_null", 2058c2ecf20Sopenharmony_ci "clk_null", 2068c2ecf20Sopenharmony_ci "clk_null", 2078c2ecf20Sopenharmony_ci "clk_null", 2088c2ecf20Sopenharmony_ci "clk_null", 2098c2ecf20Sopenharmony_ci "clk_null", 2108c2ecf20Sopenharmony_ci "clk_null", 2118c2ecf20Sopenharmony_ci "clk_null", 2128c2ecf20Sopenharmony_ci "mainpll_d12", 2138c2ecf20Sopenharmony_ci "mainpll_d8", 2148c2ecf20Sopenharmony_ci "clk_null", 2158c2ecf20Sopenharmony_ci "mainpll_d6", 2168c2ecf20Sopenharmony_ci "clk_null", 2178c2ecf20Sopenharmony_ci "clk_null", 2188c2ecf20Sopenharmony_ci "clk_null", 2198c2ecf20Sopenharmony_ci "clk_null", 2208c2ecf20Sopenharmony_ci "clk_null", 2218c2ecf20Sopenharmony_ci "clk_null", 2228c2ecf20Sopenharmony_ci "clk_null", 2238c2ecf20Sopenharmony_ci "clk_null", 2248c2ecf20Sopenharmony_ci "clk_null", 2258c2ecf20Sopenharmony_ci "clk_null", 2268c2ecf20Sopenharmony_ci "clk_null", 2278c2ecf20Sopenharmony_ci "mainpll_d4", 2288c2ecf20Sopenharmony_ci "clk_null", 2298c2ecf20Sopenharmony_ci "clk_null", 2308c2ecf20Sopenharmony_ci "clk_null", 2318c2ecf20Sopenharmony_ci "clk_null", 2328c2ecf20Sopenharmony_ci "clk_null", 2338c2ecf20Sopenharmony_ci "clk_null", 2348c2ecf20Sopenharmony_ci "clk_null", 2358c2ecf20Sopenharmony_ci "clk_null", 2368c2ecf20Sopenharmony_ci "clk_null", 2378c2ecf20Sopenharmony_ci "clk_null", 2388c2ecf20Sopenharmony_ci "clk_null", 2398c2ecf20Sopenharmony_ci "clk_null", 2408c2ecf20Sopenharmony_ci "clk_null", 2418c2ecf20Sopenharmony_ci "clk_null", 2428c2ecf20Sopenharmony_ci "clk_null", 2438c2ecf20Sopenharmony_ci "clk_null", 2448c2ecf20Sopenharmony_ci "clk_null", 2458c2ecf20Sopenharmony_ci "clk_null", 2468c2ecf20Sopenharmony_ci "clk_null", 2478c2ecf20Sopenharmony_ci "clk_null", 2488c2ecf20Sopenharmony_ci "clk_null", 2498c2ecf20Sopenharmony_ci "clk_null", 2508c2ecf20Sopenharmony_ci "clk_null", 2518c2ecf20Sopenharmony_ci "clk_null", 2528c2ecf20Sopenharmony_ci "clk_null", 2538c2ecf20Sopenharmony_ci "clk_null", 2548c2ecf20Sopenharmony_ci "clk_null", 2558c2ecf20Sopenharmony_ci "clk_null", 2568c2ecf20Sopenharmony_ci "clk_null", 2578c2ecf20Sopenharmony_ci "clk_null", 2588c2ecf20Sopenharmony_ci "clk_null", 2598c2ecf20Sopenharmony_ci "clk_null", 2608c2ecf20Sopenharmony_ci "clk_null", 2618c2ecf20Sopenharmony_ci "clk_null", 2628c2ecf20Sopenharmony_ci "clk_null", 2638c2ecf20Sopenharmony_ci "clk_null", 2648c2ecf20Sopenharmony_ci "clk_null", 2658c2ecf20Sopenharmony_ci "clk_null", 2668c2ecf20Sopenharmony_ci "clk_null", 2678c2ecf20Sopenharmony_ci "clk_null", 2688c2ecf20Sopenharmony_ci "clk_null", 2698c2ecf20Sopenharmony_ci "clk_null", 2708c2ecf20Sopenharmony_ci "clk_null", 2718c2ecf20Sopenharmony_ci "clk_null", 2728c2ecf20Sopenharmony_ci "clk_null", 2738c2ecf20Sopenharmony_ci "clk_null", 2748c2ecf20Sopenharmony_ci "clk_null", 2758c2ecf20Sopenharmony_ci "clk_null", 2768c2ecf20Sopenharmony_ci "mainpll_d10", 2778c2ecf20Sopenharmony_ci "mainpll_d7", 2788c2ecf20Sopenharmony_ci "clk_null", 2798c2ecf20Sopenharmony_ci "mainpll_d5" 2808c2ecf20Sopenharmony_ci}; 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_cistatic const char * const nfi1x_pad_parents[] __initconst = { 2838c2ecf20Sopenharmony_ci "ahb_infra_sel", 2848c2ecf20Sopenharmony_ci "nfi1x_ck" 2858c2ecf20Sopenharmony_ci}; 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_cistatic const char * const mfg_mm_parents[] __initconst = { 2888c2ecf20Sopenharmony_ci "clk_null", 2898c2ecf20Sopenharmony_ci "clk_null", 2908c2ecf20Sopenharmony_ci "clk_null", 2918c2ecf20Sopenharmony_ci "clk_null", 2928c2ecf20Sopenharmony_ci "clk_null", 2938c2ecf20Sopenharmony_ci "clk_null", 2948c2ecf20Sopenharmony_ci "clk_null", 2958c2ecf20Sopenharmony_ci "clk_null", 2968c2ecf20Sopenharmony_ci "csw_mux_mfg_sel", 2978c2ecf20Sopenharmony_ci "clk_null", 2988c2ecf20Sopenharmony_ci "clk_null", 2998c2ecf20Sopenharmony_ci "clk_null", 3008c2ecf20Sopenharmony_ci "clk_null", 3018c2ecf20Sopenharmony_ci "clk_null", 3028c2ecf20Sopenharmony_ci "clk_null", 3038c2ecf20Sopenharmony_ci "clk_null", 3048c2ecf20Sopenharmony_ci "mainpll_d3", 3058c2ecf20Sopenharmony_ci "clk_null", 3068c2ecf20Sopenharmony_ci "clk_null", 3078c2ecf20Sopenharmony_ci "clk_null", 3088c2ecf20Sopenharmony_ci "clk_null", 3098c2ecf20Sopenharmony_ci "clk_null", 3108c2ecf20Sopenharmony_ci "clk_null", 3118c2ecf20Sopenharmony_ci "clk_null", 3128c2ecf20Sopenharmony_ci "clk_null", 3138c2ecf20Sopenharmony_ci "clk_null", 3148c2ecf20Sopenharmony_ci "clk_null", 3158c2ecf20Sopenharmony_ci "clk_null", 3168c2ecf20Sopenharmony_ci "clk_null", 3178c2ecf20Sopenharmony_ci "clk_null", 3188c2ecf20Sopenharmony_ci "clk_null", 3198c2ecf20Sopenharmony_ci "clk_null", 3208c2ecf20Sopenharmony_ci "clk_null", 3218c2ecf20Sopenharmony_ci "mainpll_d5", 3228c2ecf20Sopenharmony_ci "mainpll_d7", 3238c2ecf20Sopenharmony_ci "clk_null", 3248c2ecf20Sopenharmony_ci "mainpll_d14" 3258c2ecf20Sopenharmony_ci}; 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_cistatic const char * const ddrphycfg_parents[] __initconst = { 3288c2ecf20Sopenharmony_ci "clk26m_ck", 3298c2ecf20Sopenharmony_ci "mainpll_d16" 3308c2ecf20Sopenharmony_ci}; 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_cistatic const char * const smi_mm_parents[] __initconst = { 3338c2ecf20Sopenharmony_ci "clk26m_ck", 3348c2ecf20Sopenharmony_ci "clk_null", 3358c2ecf20Sopenharmony_ci "clk_null", 3368c2ecf20Sopenharmony_ci "clk_null", 3378c2ecf20Sopenharmony_ci "clk_null", 3388c2ecf20Sopenharmony_ci "clk_null", 3398c2ecf20Sopenharmony_ci "clk_null", 3408c2ecf20Sopenharmony_ci "clk_null", 3418c2ecf20Sopenharmony_ci "clk_null", 3428c2ecf20Sopenharmony_ci "univpll_d4", 3438c2ecf20Sopenharmony_ci "mainpll_d7", 3448c2ecf20Sopenharmony_ci "clk_null", 3458c2ecf20Sopenharmony_ci "mainpll_d14" 3468c2ecf20Sopenharmony_ci}; 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_cistatic const char * const usb_78m_parents[] __initconst = { 3498c2ecf20Sopenharmony_ci "clk_null", 3508c2ecf20Sopenharmony_ci "clk26m_ck", 3518c2ecf20Sopenharmony_ci "univpll_d16", 3528c2ecf20Sopenharmony_ci "clk_null", 3538c2ecf20Sopenharmony_ci "mainpll_d20" 3548c2ecf20Sopenharmony_ci}; 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_cistatic const char * const scam_mm_parents[] __initconst = { 3578c2ecf20Sopenharmony_ci "clk_null", 3588c2ecf20Sopenharmony_ci "clk26m_ck", 3598c2ecf20Sopenharmony_ci "mainpll_d14", 3608c2ecf20Sopenharmony_ci "clk_null", 3618c2ecf20Sopenharmony_ci "mainpll_d12" 3628c2ecf20Sopenharmony_ci}; 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_cistatic const char * const spinor_parents[] __initconst = { 3658c2ecf20Sopenharmony_ci "clk26m_d2", 3668c2ecf20Sopenharmony_ci "clk26m_ck", 3678c2ecf20Sopenharmony_ci "mainpll_d40", 3688c2ecf20Sopenharmony_ci "univpll_d24", 3698c2ecf20Sopenharmony_ci "univpll_d20", 3708c2ecf20Sopenharmony_ci "mainpll_d20", 3718c2ecf20Sopenharmony_ci "mainpll_d16", 3728c2ecf20Sopenharmony_ci "univpll_d12" 3738c2ecf20Sopenharmony_ci}; 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_cistatic const char * const msdc2_parents[] __initconst = { 3768c2ecf20Sopenharmony_ci "clk26m_ck", 3778c2ecf20Sopenharmony_ci "univpll_d6", 3788c2ecf20Sopenharmony_ci "mainpll_d8", 3798c2ecf20Sopenharmony_ci "univpll_d8", 3808c2ecf20Sopenharmony_ci "mainpll_d16", 3818c2ecf20Sopenharmony_ci "mmpll_200m", 3828c2ecf20Sopenharmony_ci "mainpll_d12", 3838c2ecf20Sopenharmony_ci "mmpll_d2" 3848c2ecf20Sopenharmony_ci}; 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_cistatic const char * const eth_parents[] __initconst = { 3878c2ecf20Sopenharmony_ci "clk26m_ck", 3888c2ecf20Sopenharmony_ci "mainpll_d40", 3898c2ecf20Sopenharmony_ci "univpll_d24", 3908c2ecf20Sopenharmony_ci "univpll_d20", 3918c2ecf20Sopenharmony_ci "mainpll_d20" 3928c2ecf20Sopenharmony_ci}; 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_cistatic const char * const vdec_mm_parents[] __initconst = { 3958c2ecf20Sopenharmony_ci "clk26m_ck", 3968c2ecf20Sopenharmony_ci "univpll_d4", 3978c2ecf20Sopenharmony_ci "mainpll_d4", 3988c2ecf20Sopenharmony_ci "univpll_d5", 3998c2ecf20Sopenharmony_ci "univpll_d6", 4008c2ecf20Sopenharmony_ci "mainpll_d6" 4018c2ecf20Sopenharmony_ci}; 4028c2ecf20Sopenharmony_ci 4038c2ecf20Sopenharmony_cistatic const char * const dpi0_mm_parents[] __initconst = { 4048c2ecf20Sopenharmony_ci "clk26m_ck", 4058c2ecf20Sopenharmony_ci "lvdspll_ck", 4068c2ecf20Sopenharmony_ci "lvdspll_d2", 4078c2ecf20Sopenharmony_ci "lvdspll_d4", 4088c2ecf20Sopenharmony_ci "lvdspll_d8" 4098c2ecf20Sopenharmony_ci}; 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_cistatic const char * const dpi1_mm_parents[] __initconst = { 4128c2ecf20Sopenharmony_ci "clk26m_ck", 4138c2ecf20Sopenharmony_ci "tvdpll_d2", 4148c2ecf20Sopenharmony_ci "tvdpll_d4", 4158c2ecf20Sopenharmony_ci "tvdpll_d8", 4168c2ecf20Sopenharmony_ci "tvdpll_d16" 4178c2ecf20Sopenharmony_ci}; 4188c2ecf20Sopenharmony_ci 4198c2ecf20Sopenharmony_cistatic const char * const axi_mfg_in_parents[] __initconst = { 4208c2ecf20Sopenharmony_ci "clk26m_ck", 4218c2ecf20Sopenharmony_ci "mainpll_d11", 4228c2ecf20Sopenharmony_ci "univpll_d24", 4238c2ecf20Sopenharmony_ci "mmpll380m" 4248c2ecf20Sopenharmony_ci}; 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_cistatic const char * const slow_mfg_parents[] __initconst = { 4278c2ecf20Sopenharmony_ci "clk26m_ck", 4288c2ecf20Sopenharmony_ci "univpll_d12", 4298c2ecf20Sopenharmony_ci "univpll_d24" 4308c2ecf20Sopenharmony_ci}; 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_cistatic const char * const aud1_parents[] __initconst = { 4338c2ecf20Sopenharmony_ci "clk26m_ck", 4348c2ecf20Sopenharmony_ci "apll1_ck" 4358c2ecf20Sopenharmony_ci}; 4368c2ecf20Sopenharmony_ci 4378c2ecf20Sopenharmony_cistatic const char * const aud2_parents[] __initconst = { 4388c2ecf20Sopenharmony_ci "clk26m_ck", 4398c2ecf20Sopenharmony_ci "apll2_ck" 4408c2ecf20Sopenharmony_ci}; 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_cistatic const char * const aud_engen1_parents[] __initconst = { 4438c2ecf20Sopenharmony_ci "clk26m_ck", 4448c2ecf20Sopenharmony_ci "rg_apll1_d2_en", 4458c2ecf20Sopenharmony_ci "rg_apll1_d4_en", 4468c2ecf20Sopenharmony_ci "rg_apll1_d8_en" 4478c2ecf20Sopenharmony_ci}; 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_cistatic const char * const aud_engen2_parents[] __initconst = { 4508c2ecf20Sopenharmony_ci "clk26m_ck", 4518c2ecf20Sopenharmony_ci "rg_apll2_d2_en", 4528c2ecf20Sopenharmony_ci "rg_apll2_d4_en", 4538c2ecf20Sopenharmony_ci "rg_apll2_d8_en" 4548c2ecf20Sopenharmony_ci}; 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_cistatic const char * const i2c_parents[] __initconst = { 4578c2ecf20Sopenharmony_ci "clk26m_ck", 4588c2ecf20Sopenharmony_ci "univpll_d20", 4598c2ecf20Sopenharmony_ci "univpll_d16", 4608c2ecf20Sopenharmony_ci "univpll_d12" 4618c2ecf20Sopenharmony_ci}; 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_cistatic const char * const aud_i2s0_m_parents[] __initconst = { 4648c2ecf20Sopenharmony_ci "rg_aud1", 4658c2ecf20Sopenharmony_ci "rg_aud2" 4668c2ecf20Sopenharmony_ci}; 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_cistatic const char * const pwm_parents[] __initconst = { 4698c2ecf20Sopenharmony_ci "clk26m_ck", 4708c2ecf20Sopenharmony_ci "univpll_d12" 4718c2ecf20Sopenharmony_ci}; 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_cistatic const char * const spi_parents[] __initconst = { 4748c2ecf20Sopenharmony_ci "clk26m_ck", 4758c2ecf20Sopenharmony_ci "univpll_d12", 4768c2ecf20Sopenharmony_ci "univpll_d8", 4778c2ecf20Sopenharmony_ci "univpll_d6" 4788c2ecf20Sopenharmony_ci}; 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_cistatic const char * const aud_spdifin_parents[] __initconst = { 4818c2ecf20Sopenharmony_ci "clk26m_ck", 4828c2ecf20Sopenharmony_ci "univpll_d2" 4838c2ecf20Sopenharmony_ci}; 4848c2ecf20Sopenharmony_ci 4858c2ecf20Sopenharmony_cistatic const char * const uart2_parents[] __initconst = { 4868c2ecf20Sopenharmony_ci "clk26m_ck", 4878c2ecf20Sopenharmony_ci "univpll_d24" 4888c2ecf20Sopenharmony_ci}; 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_cistatic const char * const bsi_parents[] __initconst = { 4918c2ecf20Sopenharmony_ci "clk26m_ck", 4928c2ecf20Sopenharmony_ci "mainpll_d10", 4938c2ecf20Sopenharmony_ci "mainpll_d12", 4948c2ecf20Sopenharmony_ci "mainpll_d20" 4958c2ecf20Sopenharmony_ci}; 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_cistatic const char * const dbg_atclk_parents[] __initconst = { 4988c2ecf20Sopenharmony_ci "clk_null", 4998c2ecf20Sopenharmony_ci "clk26m_ck", 5008c2ecf20Sopenharmony_ci "mainpll_d5", 5018c2ecf20Sopenharmony_ci "clk_null", 5028c2ecf20Sopenharmony_ci "univpll_d5" 5038c2ecf20Sopenharmony_ci}; 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_cistatic const char * const csw_nfiecc_parents[] __initconst = { 5068c2ecf20Sopenharmony_ci "clk_null", 5078c2ecf20Sopenharmony_ci "mainpll_d7", 5088c2ecf20Sopenharmony_ci "mainpll_d6", 5098c2ecf20Sopenharmony_ci "clk_null", 5108c2ecf20Sopenharmony_ci "mainpll_d5" 5118c2ecf20Sopenharmony_ci}; 5128c2ecf20Sopenharmony_ci 5138c2ecf20Sopenharmony_cistatic const char * const nfiecc_parents[] __initconst = { 5148c2ecf20Sopenharmony_ci "clk_null", 5158c2ecf20Sopenharmony_ci "nfi2x_pad_sel", 5168c2ecf20Sopenharmony_ci "mainpll_d4", 5178c2ecf20Sopenharmony_ci "clk_null", 5188c2ecf20Sopenharmony_ci "csw_nfiecc_sel" 5198c2ecf20Sopenharmony_ci}; 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_cistatic struct mtk_composite top_muxes[] __initdata = { 5228c2ecf20Sopenharmony_ci /* CLK_MUX_SEL0 */ 5238c2ecf20Sopenharmony_ci MUX(CLK_TOP_UART0_SEL, "uart0_sel", uart0_parents, 5248c2ecf20Sopenharmony_ci 0x000, 0, 1), 5258c2ecf20Sopenharmony_ci MUX(CLK_TOP_GFMUX_EMI1X_SEL, "gfmux_emi1x_sel", gfmux_emi1x_parents, 5268c2ecf20Sopenharmony_ci 0x000, 1, 1), 5278c2ecf20Sopenharmony_ci MUX(CLK_TOP_EMI_DDRPHY_SEL, "emi_ddrphy_sel", emi_ddrphy_parents, 5288c2ecf20Sopenharmony_ci 0x000, 2, 1), 5298c2ecf20Sopenharmony_ci MUX(CLK_TOP_AHB_INFRA_SEL, "ahb_infra_sel", ahb_infra_parents, 5308c2ecf20Sopenharmony_ci 0x000, 4, 4), 5318c2ecf20Sopenharmony_ci MUX(CLK_TOP_CSW_MUX_MFG_SEL, "csw_mux_mfg_sel", csw_mux_mfg_parents, 5328c2ecf20Sopenharmony_ci 0x000, 8, 3), 5338c2ecf20Sopenharmony_ci MUX(CLK_TOP_MSDC0_SEL, "msdc0_sel", msdc0_parents, 5348c2ecf20Sopenharmony_ci 0x000, 11, 3), 5358c2ecf20Sopenharmony_ci MUX(CLK_TOP_CAMTG_MM_SEL, "camtg_mm_sel", camtg_mm_parents, 5368c2ecf20Sopenharmony_ci 0x000, 15, 3), 5378c2ecf20Sopenharmony_ci MUX(CLK_TOP_PWM_MM_SEL, "pwm_mm_sel", pwm_mm_parents, 5388c2ecf20Sopenharmony_ci 0x000, 18, 1), 5398c2ecf20Sopenharmony_ci MUX(CLK_TOP_UART1_SEL, "uart1_sel", uart1_parents, 5408c2ecf20Sopenharmony_ci 0x000, 19, 1), 5418c2ecf20Sopenharmony_ci MUX(CLK_TOP_MSDC1_SEL, "msdc1_sel", msdc1_parents, 5428c2ecf20Sopenharmony_ci 0x000, 20, 3), 5438c2ecf20Sopenharmony_ci MUX(CLK_TOP_SPM_52M_SEL, "spm_52m_sel", spm_52m_parents, 5448c2ecf20Sopenharmony_ci 0x000, 23, 1), 5458c2ecf20Sopenharmony_ci MUX(CLK_TOP_PMICSPI_SEL, "pmicspi_sel", pmicspi_parents, 5468c2ecf20Sopenharmony_ci 0x000, 24, 2), 5478c2ecf20Sopenharmony_ci MUX(CLK_TOP_QAXI_AUD26M_SEL, "qaxi_aud26m_sel", qaxi_aud26m_parents, 5488c2ecf20Sopenharmony_ci 0x000, 26, 1), 5498c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD_INTBUS_SEL, "aud_intbus_sel", aud_intbus_parents, 5508c2ecf20Sopenharmony_ci 0x000, 27, 3), 5518c2ecf20Sopenharmony_ci /* CLK_MUX_SEL1 */ 5528c2ecf20Sopenharmony_ci MUX(CLK_TOP_NFI2X_PAD_SEL, "nfi2x_pad_sel", nfi2x_pad_parents, 5538c2ecf20Sopenharmony_ci 0x004, 0, 7), 5548c2ecf20Sopenharmony_ci MUX(CLK_TOP_NFI1X_PAD_SEL, "nfi1x_pad_sel", nfi1x_pad_parents, 5558c2ecf20Sopenharmony_ci 0x004, 7, 1), 5568c2ecf20Sopenharmony_ci MUX(CLK_TOP_MFG_MM_SEL, "mfg_mm_sel", mfg_mm_parents, 5578c2ecf20Sopenharmony_ci 0x004, 8, 6), 5588c2ecf20Sopenharmony_ci MUX(CLK_TOP_DDRPHYCFG_SEL, "ddrphycfg_sel", ddrphycfg_parents, 5598c2ecf20Sopenharmony_ci 0x004, 15, 1), 5608c2ecf20Sopenharmony_ci MUX(CLK_TOP_SMI_MM_SEL, "smi_mm_sel", smi_mm_parents, 5618c2ecf20Sopenharmony_ci 0x004, 16, 4), 5628c2ecf20Sopenharmony_ci MUX(CLK_TOP_USB_78M_SEL, "usb_78m_sel", usb_78m_parents, 5638c2ecf20Sopenharmony_ci 0x004, 20, 3), 5648c2ecf20Sopenharmony_ci MUX(CLK_TOP_SCAM_MM_SEL, "scam_mm_sel", scam_mm_parents, 5658c2ecf20Sopenharmony_ci 0x004, 23, 3), 5668c2ecf20Sopenharmony_ci /* CLK_MUX_SEL8 */ 5678c2ecf20Sopenharmony_ci MUX(CLK_TOP_SPINOR_SEL, "spinor_sel", spinor_parents, 5688c2ecf20Sopenharmony_ci 0x040, 0, 3), 5698c2ecf20Sopenharmony_ci MUX(CLK_TOP_MSDC2_SEL, "msdc2_sel", msdc2_parents, 5708c2ecf20Sopenharmony_ci 0x040, 3, 3), 5718c2ecf20Sopenharmony_ci MUX(CLK_TOP_ETH_SEL, "eth_sel", eth_parents, 5728c2ecf20Sopenharmony_ci 0x040, 6, 3), 5738c2ecf20Sopenharmony_ci MUX(CLK_TOP_VDEC_MM_SEL, "vdec_mm_sel", vdec_mm_parents, 5748c2ecf20Sopenharmony_ci 0x040, 9, 3), 5758c2ecf20Sopenharmony_ci MUX(CLK_TOP_DPI0_MM_SEL, "dpi0_mm_sel", dpi0_mm_parents, 5768c2ecf20Sopenharmony_ci 0x040, 12, 3), 5778c2ecf20Sopenharmony_ci MUX(CLK_TOP_DPI1_MM_SEL, "dpi1_mm_sel", dpi1_mm_parents, 5788c2ecf20Sopenharmony_ci 0x040, 15, 3), 5798c2ecf20Sopenharmony_ci MUX(CLK_TOP_AXI_MFG_IN_SEL, "axi_mfg_in_sel", axi_mfg_in_parents, 5808c2ecf20Sopenharmony_ci 0x040, 18, 2), 5818c2ecf20Sopenharmony_ci MUX(CLK_TOP_SLOW_MFG_SEL, "slow_mfg_sel", slow_mfg_parents, 5828c2ecf20Sopenharmony_ci 0x040, 20, 2), 5838c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD1_SEL, "aud1_sel", aud1_parents, 5848c2ecf20Sopenharmony_ci 0x040, 22, 1), 5858c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD2_SEL, "aud2_sel", aud2_parents, 5868c2ecf20Sopenharmony_ci 0x040, 23, 1), 5878c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD_ENGEN1_SEL, "aud_engen1_sel", aud_engen1_parents, 5888c2ecf20Sopenharmony_ci 0x040, 24, 2), 5898c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD_ENGEN2_SEL, "aud_engen2_sel", aud_engen2_parents, 5908c2ecf20Sopenharmony_ci 0x040, 26, 2), 5918c2ecf20Sopenharmony_ci MUX(CLK_TOP_I2C_SEL, "i2c_sel", i2c_parents, 5928c2ecf20Sopenharmony_ci 0x040, 28, 2), 5938c2ecf20Sopenharmony_ci /* CLK_SEL_9 */ 5948c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD_I2S0_M_SEL, "aud_i2s0_m_sel", aud_i2s0_m_parents, 5958c2ecf20Sopenharmony_ci 0x044, 12, 1), 5968c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD_I2S1_M_SEL, "aud_i2s1_m_sel", aud_i2s0_m_parents, 5978c2ecf20Sopenharmony_ci 0x044, 13, 1), 5988c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD_I2S2_M_SEL, "aud_i2s2_m_sel", aud_i2s0_m_parents, 5998c2ecf20Sopenharmony_ci 0x044, 14, 1), 6008c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD_I2S3_M_SEL, "aud_i2s3_m_sel", aud_i2s0_m_parents, 6018c2ecf20Sopenharmony_ci 0x044, 15, 1), 6028c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD_I2S4_M_SEL, "aud_i2s4_m_sel", aud_i2s0_m_parents, 6038c2ecf20Sopenharmony_ci 0x044, 16, 1), 6048c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD_I2S5_M_SEL, "aud_i2s5_m_sel", aud_i2s0_m_parents, 6058c2ecf20Sopenharmony_ci 0x044, 17, 1), 6068c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD_SPDIF_B_SEL, "aud_spdif_b_sel", aud_i2s0_m_parents, 6078c2ecf20Sopenharmony_ci 0x044, 18, 1), 6088c2ecf20Sopenharmony_ci /* CLK_MUX_SEL13 */ 6098c2ecf20Sopenharmony_ci MUX(CLK_TOP_PWM_SEL, "pwm_sel", pwm_parents, 6108c2ecf20Sopenharmony_ci 0x07c, 0, 1), 6118c2ecf20Sopenharmony_ci MUX(CLK_TOP_SPI_SEL, "spi_sel", spi_parents, 6128c2ecf20Sopenharmony_ci 0x07c, 1, 2), 6138c2ecf20Sopenharmony_ci MUX(CLK_TOP_AUD_SPDIFIN_SEL, "aud_spdifin_sel", aud_spdifin_parents, 6148c2ecf20Sopenharmony_ci 0x07c, 3, 1), 6158c2ecf20Sopenharmony_ci MUX(CLK_TOP_UART2_SEL, "uart2_sel", uart2_parents, 6168c2ecf20Sopenharmony_ci 0x07c, 4, 1), 6178c2ecf20Sopenharmony_ci MUX(CLK_TOP_BSI_SEL, "bsi_sel", bsi_parents, 6188c2ecf20Sopenharmony_ci 0x07c, 5, 2), 6198c2ecf20Sopenharmony_ci MUX(CLK_TOP_DBG_ATCLK_SEL, "dbg_atclk_sel", dbg_atclk_parents, 6208c2ecf20Sopenharmony_ci 0x07c, 7, 3), 6218c2ecf20Sopenharmony_ci MUX(CLK_TOP_CSW_NFIECC_SEL, "csw_nfiecc_sel", csw_nfiecc_parents, 6228c2ecf20Sopenharmony_ci 0x07c, 10, 3), 6238c2ecf20Sopenharmony_ci MUX(CLK_TOP_NFIECC_SEL, "nfiecc_sel", nfiecc_parents, 6248c2ecf20Sopenharmony_ci 0x07c, 13, 3), 6258c2ecf20Sopenharmony_ci}; 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_cistatic const char * const ifr_mux1_parents[] __initconst = { 6288c2ecf20Sopenharmony_ci "clk26m_ck", 6298c2ecf20Sopenharmony_ci "armpll", 6308c2ecf20Sopenharmony_ci "univpll", 6318c2ecf20Sopenharmony_ci "mainpll_d2" 6328c2ecf20Sopenharmony_ci}; 6338c2ecf20Sopenharmony_ci 6348c2ecf20Sopenharmony_cistatic const char * const ifr_eth_25m_parents[] __initconst = { 6358c2ecf20Sopenharmony_ci "eth_d2_ck", 6368c2ecf20Sopenharmony_ci "rg_eth" 6378c2ecf20Sopenharmony_ci}; 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_cistatic const char * const ifr_i2c0_parents[] __initconst = { 6408c2ecf20Sopenharmony_ci "ahb_infra_d2", 6418c2ecf20Sopenharmony_ci "rg_i2c" 6428c2ecf20Sopenharmony_ci}; 6438c2ecf20Sopenharmony_ci 6448c2ecf20Sopenharmony_cistatic const struct mtk_composite ifr_muxes[] __initconst = { 6458c2ecf20Sopenharmony_ci MUX(CLK_IFR_MUX1_SEL, "ifr_mux1_sel", ifr_mux1_parents, 0x000, 6468c2ecf20Sopenharmony_ci 2, 2), 6478c2ecf20Sopenharmony_ci MUX(CLK_IFR_ETH_25M_SEL, "ifr_eth_25m_sel", ifr_eth_25m_parents, 0x080, 6488c2ecf20Sopenharmony_ci 0, 1), 6498c2ecf20Sopenharmony_ci MUX(CLK_IFR_I2C0_SEL, "ifr_i2c0_sel", ifr_i2c0_parents, 0x080, 6508c2ecf20Sopenharmony_ci 1, 1), 6518c2ecf20Sopenharmony_ci MUX(CLK_IFR_I2C1_SEL, "ifr_i2c1_sel", ifr_i2c0_parents, 0x080, 6528c2ecf20Sopenharmony_ci 2, 1), 6538c2ecf20Sopenharmony_ci MUX(CLK_IFR_I2C2_SEL, "ifr_i2c2_sel", ifr_i2c0_parents, 0x080, 6548c2ecf20Sopenharmony_ci 3, 1), 6558c2ecf20Sopenharmony_ci}; 6568c2ecf20Sopenharmony_ci 6578c2ecf20Sopenharmony_ci#define DIV_ADJ(_id, _name, _parent, _reg, _shift, _width) { \ 6588c2ecf20Sopenharmony_ci .id = _id, \ 6598c2ecf20Sopenharmony_ci .name = _name, \ 6608c2ecf20Sopenharmony_ci .parent_name = _parent, \ 6618c2ecf20Sopenharmony_ci .div_reg = _reg, \ 6628c2ecf20Sopenharmony_ci .div_shift = _shift, \ 6638c2ecf20Sopenharmony_ci .div_width = _width, \ 6648c2ecf20Sopenharmony_ci} 6658c2ecf20Sopenharmony_ci 6668c2ecf20Sopenharmony_cistatic const struct mtk_clk_divider top_adj_divs[] = { 6678c2ecf20Sopenharmony_ci DIV_ADJ(CLK_TOP_APLL12_CK_DIV0, "apll12_ck_div0", "aud_i2s0_m_sel", 6688c2ecf20Sopenharmony_ci 0x0048, 0, 8), 6698c2ecf20Sopenharmony_ci DIV_ADJ(CLK_TOP_APLL12_CK_DIV1, "apll12_ck_div1", "aud_i2s1_m_sel", 6708c2ecf20Sopenharmony_ci 0x0048, 8, 8), 6718c2ecf20Sopenharmony_ci DIV_ADJ(CLK_TOP_APLL12_CK_DIV2, "apll12_ck_div2", "aud_i2s2_m_sel", 6728c2ecf20Sopenharmony_ci 0x0048, 16, 8), 6738c2ecf20Sopenharmony_ci DIV_ADJ(CLK_TOP_APLL12_CK_DIV3, "apll12_ck_div3", "aud_i2s3_m_sel", 6748c2ecf20Sopenharmony_ci 0x0048, 24, 8), 6758c2ecf20Sopenharmony_ci DIV_ADJ(CLK_TOP_APLL12_CK_DIV4, "apll12_ck_div4", "aud_i2s4_m_sel", 6768c2ecf20Sopenharmony_ci 0x004c, 0, 8), 6778c2ecf20Sopenharmony_ci DIV_ADJ(CLK_TOP_APLL12_CK_DIV4B, "apll12_ck_div4b", "apll12_div4", 6788c2ecf20Sopenharmony_ci 0x004c, 8, 8), 6798c2ecf20Sopenharmony_ci DIV_ADJ(CLK_TOP_APLL12_CK_DIV5, "apll12_ck_div5", "aud_i2s5_m_sel", 6808c2ecf20Sopenharmony_ci 0x004c, 16, 8), 6818c2ecf20Sopenharmony_ci DIV_ADJ(CLK_TOP_APLL12_CK_DIV5B, "apll12_ck_div5b", "apll12_div5", 6828c2ecf20Sopenharmony_ci 0x004c, 24, 8), 6838c2ecf20Sopenharmony_ci DIV_ADJ(CLK_TOP_APLL12_CK_DIV6, "apll12_ck_div6", "aud_spdif_b_sel", 6848c2ecf20Sopenharmony_ci 0x0078, 0, 8), 6858c2ecf20Sopenharmony_ci}; 6868c2ecf20Sopenharmony_ci 6878c2ecf20Sopenharmony_ci#define DIV_ADJ_FLAG(_id, _name, _parent, _reg, _shift, _width, _flag) { \ 6888c2ecf20Sopenharmony_ci .id = _id, \ 6898c2ecf20Sopenharmony_ci .name = _name, \ 6908c2ecf20Sopenharmony_ci .parent_name = _parent, \ 6918c2ecf20Sopenharmony_ci .div_reg = _reg, \ 6928c2ecf20Sopenharmony_ci .div_shift = _shift, \ 6938c2ecf20Sopenharmony_ci .div_width = _width, \ 6948c2ecf20Sopenharmony_ci .clk_divider_flags = _flag, \ 6958c2ecf20Sopenharmony_ci} 6968c2ecf20Sopenharmony_ci 6978c2ecf20Sopenharmony_cistatic const struct mtk_clk_divider apmixed_adj_divs[] = { 6988c2ecf20Sopenharmony_ci DIV_ADJ_FLAG(CLK_APMIXED_HDMI_REF, "hdmi_ref", "tvdpll", 6998c2ecf20Sopenharmony_ci 0x1c4, 24, 3, CLK_DIVIDER_POWER_OF_TWO), 7008c2ecf20Sopenharmony_ci}; 7018c2ecf20Sopenharmony_ci 7028c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs top0_cg_regs = { 7038c2ecf20Sopenharmony_ci .set_ofs = 0x50, 7048c2ecf20Sopenharmony_ci .clr_ofs = 0x80, 7058c2ecf20Sopenharmony_ci .sta_ofs = 0x20, 7068c2ecf20Sopenharmony_ci}; 7078c2ecf20Sopenharmony_ci 7088c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs top1_cg_regs = { 7098c2ecf20Sopenharmony_ci .set_ofs = 0x54, 7108c2ecf20Sopenharmony_ci .clr_ofs = 0x84, 7118c2ecf20Sopenharmony_ci .sta_ofs = 0x24, 7128c2ecf20Sopenharmony_ci}; 7138c2ecf20Sopenharmony_ci 7148c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs top2_cg_regs = { 7158c2ecf20Sopenharmony_ci .set_ofs = 0x6c, 7168c2ecf20Sopenharmony_ci .clr_ofs = 0x9c, 7178c2ecf20Sopenharmony_ci .sta_ofs = 0x3c, 7188c2ecf20Sopenharmony_ci}; 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs top3_cg_regs = { 7218c2ecf20Sopenharmony_ci .set_ofs = 0xa0, 7228c2ecf20Sopenharmony_ci .clr_ofs = 0xb0, 7238c2ecf20Sopenharmony_ci .sta_ofs = 0x70, 7248c2ecf20Sopenharmony_ci}; 7258c2ecf20Sopenharmony_ci 7268c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs top4_cg_regs = { 7278c2ecf20Sopenharmony_ci .set_ofs = 0xa4, 7288c2ecf20Sopenharmony_ci .clr_ofs = 0xb4, 7298c2ecf20Sopenharmony_ci .sta_ofs = 0x74, 7308c2ecf20Sopenharmony_ci}; 7318c2ecf20Sopenharmony_ci 7328c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs top5_cg_regs = { 7338c2ecf20Sopenharmony_ci .set_ofs = 0x44, 7348c2ecf20Sopenharmony_ci .clr_ofs = 0x44, 7358c2ecf20Sopenharmony_ci .sta_ofs = 0x44, 7368c2ecf20Sopenharmony_ci}; 7378c2ecf20Sopenharmony_ci 7388c2ecf20Sopenharmony_ci#define GATE_TOP0(_id, _name, _parent, _shift) { \ 7398c2ecf20Sopenharmony_ci .id = _id, \ 7408c2ecf20Sopenharmony_ci .name = _name, \ 7418c2ecf20Sopenharmony_ci .parent_name = _parent, \ 7428c2ecf20Sopenharmony_ci .regs = &top0_cg_regs, \ 7438c2ecf20Sopenharmony_ci .shift = _shift, \ 7448c2ecf20Sopenharmony_ci .ops = &mtk_clk_gate_ops_setclr, \ 7458c2ecf20Sopenharmony_ci } 7468c2ecf20Sopenharmony_ci 7478c2ecf20Sopenharmony_ci#define GATE_TOP0_I(_id, _name, _parent, _shift) { \ 7488c2ecf20Sopenharmony_ci .id = _id, \ 7498c2ecf20Sopenharmony_ci .name = _name, \ 7508c2ecf20Sopenharmony_ci .parent_name = _parent, \ 7518c2ecf20Sopenharmony_ci .regs = &top0_cg_regs, \ 7528c2ecf20Sopenharmony_ci .shift = _shift, \ 7538c2ecf20Sopenharmony_ci .ops = &mtk_clk_gate_ops_setclr_inv, \ 7548c2ecf20Sopenharmony_ci } 7558c2ecf20Sopenharmony_ci 7568c2ecf20Sopenharmony_ci#define GATE_TOP1(_id, _name, _parent, _shift) { \ 7578c2ecf20Sopenharmony_ci .id = _id, \ 7588c2ecf20Sopenharmony_ci .name = _name, \ 7598c2ecf20Sopenharmony_ci .parent_name = _parent, \ 7608c2ecf20Sopenharmony_ci .regs = &top1_cg_regs, \ 7618c2ecf20Sopenharmony_ci .shift = _shift, \ 7628c2ecf20Sopenharmony_ci .ops = &mtk_clk_gate_ops_setclr, \ 7638c2ecf20Sopenharmony_ci } 7648c2ecf20Sopenharmony_ci 7658c2ecf20Sopenharmony_ci#define GATE_TOP2(_id, _name, _parent, _shift) { \ 7668c2ecf20Sopenharmony_ci .id = _id, \ 7678c2ecf20Sopenharmony_ci .name = _name, \ 7688c2ecf20Sopenharmony_ci .parent_name = _parent, \ 7698c2ecf20Sopenharmony_ci .regs = &top2_cg_regs, \ 7708c2ecf20Sopenharmony_ci .shift = _shift, \ 7718c2ecf20Sopenharmony_ci .ops = &mtk_clk_gate_ops_setclr, \ 7728c2ecf20Sopenharmony_ci } 7738c2ecf20Sopenharmony_ci 7748c2ecf20Sopenharmony_ci#define GATE_TOP2_I(_id, _name, _parent, _shift) { \ 7758c2ecf20Sopenharmony_ci .id = _id, \ 7768c2ecf20Sopenharmony_ci .name = _name, \ 7778c2ecf20Sopenharmony_ci .parent_name = _parent, \ 7788c2ecf20Sopenharmony_ci .regs = &top2_cg_regs, \ 7798c2ecf20Sopenharmony_ci .shift = _shift, \ 7808c2ecf20Sopenharmony_ci .ops = &mtk_clk_gate_ops_setclr_inv, \ 7818c2ecf20Sopenharmony_ci } 7828c2ecf20Sopenharmony_ci 7838c2ecf20Sopenharmony_ci#define GATE_TOP3(_id, _name, _parent, _shift) { \ 7848c2ecf20Sopenharmony_ci .id = _id, \ 7858c2ecf20Sopenharmony_ci .name = _name, \ 7868c2ecf20Sopenharmony_ci .parent_name = _parent, \ 7878c2ecf20Sopenharmony_ci .regs = &top3_cg_regs, \ 7888c2ecf20Sopenharmony_ci .shift = _shift, \ 7898c2ecf20Sopenharmony_ci .ops = &mtk_clk_gate_ops_setclr, \ 7908c2ecf20Sopenharmony_ci } 7918c2ecf20Sopenharmony_ci 7928c2ecf20Sopenharmony_ci#define GATE_TOP4_I(_id, _name, _parent, _shift) { \ 7938c2ecf20Sopenharmony_ci .id = _id, \ 7948c2ecf20Sopenharmony_ci .name = _name, \ 7958c2ecf20Sopenharmony_ci .parent_name = _parent, \ 7968c2ecf20Sopenharmony_ci .regs = &top4_cg_regs, \ 7978c2ecf20Sopenharmony_ci .shift = _shift, \ 7988c2ecf20Sopenharmony_ci .ops = &mtk_clk_gate_ops_setclr_inv, \ 7998c2ecf20Sopenharmony_ci } 8008c2ecf20Sopenharmony_ci 8018c2ecf20Sopenharmony_ci#define GATE_TOP5(_id, _name, _parent, _shift) { \ 8028c2ecf20Sopenharmony_ci .id = _id, \ 8038c2ecf20Sopenharmony_ci .name = _name, \ 8048c2ecf20Sopenharmony_ci .parent_name = _parent, \ 8058c2ecf20Sopenharmony_ci .regs = &top5_cg_regs, \ 8068c2ecf20Sopenharmony_ci .shift = _shift, \ 8078c2ecf20Sopenharmony_ci .ops = &mtk_clk_gate_ops_no_setclr, \ 8088c2ecf20Sopenharmony_ci } 8098c2ecf20Sopenharmony_ci 8108c2ecf20Sopenharmony_cistatic const struct mtk_gate top_clks[] __initconst = { 8118c2ecf20Sopenharmony_ci /* TOP0 */ 8128c2ecf20Sopenharmony_ci GATE_TOP0(CLK_TOP_PWM_MM, "pwm_mm", "pwm_mm_sel", 0), 8138c2ecf20Sopenharmony_ci GATE_TOP0(CLK_TOP_CAM_MM, "cam_mm", "camtg_mm_sel", 1), 8148c2ecf20Sopenharmony_ci GATE_TOP0(CLK_TOP_MFG_MM, "mfg_mm", "mfg_mm_sel", 2), 8158c2ecf20Sopenharmony_ci GATE_TOP0(CLK_TOP_SPM_52M, "spm_52m", "spm_52m_sel", 3), 8168c2ecf20Sopenharmony_ci GATE_TOP0_I(CLK_TOP_MIPI_26M_DBG, "mipi_26m_dbg", "mipi_26m", 4), 8178c2ecf20Sopenharmony_ci GATE_TOP0(CLK_TOP_SCAM_MM, "scam_mm", "scam_mm_sel", 5), 8188c2ecf20Sopenharmony_ci GATE_TOP0(CLK_TOP_SMI_MM, "smi_mm", "smi_mm_sel", 9), 8198c2ecf20Sopenharmony_ci /* TOP1 */ 8208c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_THEM, "them", "ahb_infra_sel", 1), 8218c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_APDMA, "apdma", "ahb_infra_sel", 2), 8228c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_I2C0, "i2c0", "ifr_i2c0_sel", 3), 8238c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_I2C1, "i2c1", "ifr_i2c1_sel", 4), 8248c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_AUXADC1, "auxadc1", "ahb_infra_sel", 5), 8258c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_NFI, "nfi", "nfi1x_pad_sel", 6), 8268c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_NFIECC, "nfiecc", "rg_nfiecc", 7), 8278c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_DEBUGSYS, "debugsys", "rg_dbg_atclk", 8), 8288c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_PWM, "pwm", "ahb_infra_sel", 9), 8298c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_UART0, "uart0", "uart0_sel", 10), 8308c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_UART1, "uart1", "uart1_sel", 11), 8318c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_BTIF, "btif", "ahb_infra_sel", 12), 8328c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_USB, "usb", "usb_78m", 13), 8338c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_FLASHIF_26M, "flashif_26m", "clk26m_ck", 14), 8348c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_AUXADC2, "auxadc2", "ahb_infra_sel", 15), 8358c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_I2C2, "i2c2", "ifr_i2c2_sel", 16), 8368c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_MSDC0, "msdc0", "msdc0_sel", 17), 8378c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_MSDC1, "msdc1", "msdc1_sel", 18), 8388c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_NFI2X, "nfi2x", "nfi2x_pad_sel", 19), 8398c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_PMICWRAP_AP, "pwrap_ap", "clk26m_ck", 20), 8408c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_SEJ, "sej", "ahb_infra_sel", 21), 8418c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_MEMSLP_DLYER, "memslp_dlyer", "clk26m_ck", 22), 8428c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_SPI, "spi", "spi_sel", 23), 8438c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_APXGPT, "apxgpt", "clk26m_ck", 24), 8448c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_AUDIO, "audio", "clk26m_ck", 25), 8458c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_PMICWRAP_MD, "pwrap_md", "clk26m_ck", 27), 8468c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_PMICWRAP_CONN, "pwrap_conn", "clk26m_ck", 28), 8478c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_PMICWRAP_26M, "pwrap_26m", "clk26m_ck", 29), 8488c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_AUX_ADC, "aux_adc", "clk26m_ck", 30), 8498c2ecf20Sopenharmony_ci GATE_TOP1(CLK_TOP_AUX_TP, "aux_tp", "clk26m_ck", 31), 8508c2ecf20Sopenharmony_ci /* TOP2 */ 8518c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_MSDC2, "msdc2", "ahb_infra_sel", 0), 8528c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_RBIST, "rbist", "univpll_d12", 1), 8538c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_NFI_BUS, "nfi_bus", "ahb_infra_sel", 2), 8548c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_GCE, "gce", "ahb_infra_sel", 4), 8558c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_TRNG, "trng", "ahb_infra_sel", 5), 8568c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_SEJ_13M, "sej_13m", "clk26m_ck", 6), 8578c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_AES, "aes", "ahb_infra_sel", 7), 8588c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_PWM_B, "pwm_b", "rg_pwm_infra", 8), 8598c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_PWM1_FB, "pwm1_fb", "rg_pwm_infra", 9), 8608c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_PWM2_FB, "pwm2_fb", "rg_pwm_infra", 10), 8618c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_PWM3_FB, "pwm3_fb", "rg_pwm_infra", 11), 8628c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_PWM4_FB, "pwm4_fb", "rg_pwm_infra", 12), 8638c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_PWM5_FB, "pwm5_fb", "rg_pwm_infra", 13), 8648c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_USB_1P, "usb_1p", "usb_78m", 14), 8658c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_FLASHIF_FREERUN, "flashif_freerun", "ahb_infra_sel", 8668c2ecf20Sopenharmony_ci 15), 8678c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_26M_HDMI_SIFM, "hdmi_sifm_26m", "clk26m_ck", 16), 8688c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_26M_CEC, "cec_26m", "clk26m_ck", 17), 8698c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_32K_CEC, "cec_32k", "clk32k", 18), 8708c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_66M_ETH, "eth_66m", "ahb_infra_d2", 19), 8718c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_133M_ETH, "eth_133m", "ahb_infra_sel", 20), 8728c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_FETH_25M, "feth_25m", "ifr_eth_25m_sel", 21), 8738c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_FETH_50M, "feth_50m", "rg_eth", 22), 8748c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_FLASHIF_AXI, "flashif_axi", "ahb_infra_sel", 23), 8758c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_USBIF, "usbif", "ahb_infra_sel", 24), 8768c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_UART2, "uart2", "rg_uart2", 25), 8778c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_BSI, "bsi", "ahb_infra_sel", 26), 8788c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_GCPU_B, "gcpu_b", "ahb_infra_sel", 27), 8798c2ecf20Sopenharmony_ci GATE_TOP2_I(CLK_TOP_MSDC0_INFRA, "msdc0_infra", "msdc0", 28), 8808c2ecf20Sopenharmony_ci GATE_TOP2_I(CLK_TOP_MSDC1_INFRA, "msdc1_infra", "msdc1", 29), 8818c2ecf20Sopenharmony_ci GATE_TOP2_I(CLK_TOP_MSDC2_INFRA, "msdc2_infra", "rg_msdc2", 30), 8828c2ecf20Sopenharmony_ci GATE_TOP2(CLK_TOP_USB_78M, "usb_78m", "usb_78m_sel", 31), 8838c2ecf20Sopenharmony_ci /* TOP3 */ 8848c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_SPINOR, "rg_spinor", "spinor_sel", 0), 8858c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_MSDC2, "rg_msdc2", "msdc2_sel", 1), 8868c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_ETH, "rg_eth", "eth_sel", 2), 8878c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_VDEC, "rg_vdec", "vdec_mm_sel", 3), 8888c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_FDPI0, "rg_fdpi0", "dpi0_mm_sel", 4), 8898c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_FDPI1, "rg_fdpi1", "dpi1_mm_sel", 5), 8908c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_AXI_MFG, "rg_axi_mfg", "axi_mfg_in_sel", 6), 8918c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_SLOW_MFG, "rg_slow_mfg", "slow_mfg_sel", 7), 8928c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_AUD1, "rg_aud1", "aud1_sel", 8), 8938c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_AUD2, "rg_aud2", "aud2_sel", 9), 8948c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_AUD_ENGEN1, "rg_aud_engen1", "aud_engen1_sel", 10), 8958c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_AUD_ENGEN2, "rg_aud_engen2", "aud_engen2_sel", 11), 8968c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_I2C, "rg_i2c", "i2c_sel", 12), 8978c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_PWM_INFRA, "rg_pwm_infra", "pwm_sel", 13), 8988c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_AUD_SPDIF_IN, "rg_aud_spdif_in", "aud_spdifin_sel", 8998c2ecf20Sopenharmony_ci 14), 9008c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_UART2, "rg_uart2", "uart2_sel", 15), 9018c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_BSI, "rg_bsi", "bsi_sel", 16), 9028c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_DBG_ATCLK, "rg_dbg_atclk", "dbg_atclk_sel", 17), 9038c2ecf20Sopenharmony_ci GATE_TOP3(CLK_TOP_RG_NFIECC, "rg_nfiecc", "nfiecc_sel", 18), 9048c2ecf20Sopenharmony_ci /* TOP4 */ 9058c2ecf20Sopenharmony_ci GATE_TOP4_I(CLK_TOP_RG_APLL1_D2_EN, "rg_apll1_d2_en", "apll1_d2", 8), 9068c2ecf20Sopenharmony_ci GATE_TOP4_I(CLK_TOP_RG_APLL1_D4_EN, "rg_apll1_d4_en", "apll1_d4", 9), 9078c2ecf20Sopenharmony_ci GATE_TOP4_I(CLK_TOP_RG_APLL1_D8_EN, "rg_apll1_d8_en", "apll1_d8", 10), 9088c2ecf20Sopenharmony_ci GATE_TOP4_I(CLK_TOP_RG_APLL2_D2_EN, "rg_apll2_d2_en", "apll2_d2", 11), 9098c2ecf20Sopenharmony_ci GATE_TOP4_I(CLK_TOP_RG_APLL2_D4_EN, "rg_apll2_d4_en", "apll2_d4", 12), 9108c2ecf20Sopenharmony_ci GATE_TOP4_I(CLK_TOP_RG_APLL2_D8_EN, "rg_apll2_d8_en", "apll2_d8", 13), 9118c2ecf20Sopenharmony_ci /* TOP5 */ 9128c2ecf20Sopenharmony_ci GATE_TOP5(CLK_TOP_APLL12_DIV0, "apll12_div0", "apll12_ck_div0", 0), 9138c2ecf20Sopenharmony_ci GATE_TOP5(CLK_TOP_APLL12_DIV1, "apll12_div1", "apll12_ck_div1", 1), 9148c2ecf20Sopenharmony_ci GATE_TOP5(CLK_TOP_APLL12_DIV2, "apll12_div2", "apll12_ck_div2", 2), 9158c2ecf20Sopenharmony_ci GATE_TOP5(CLK_TOP_APLL12_DIV3, "apll12_div3", "apll12_ck_div3", 3), 9168c2ecf20Sopenharmony_ci GATE_TOP5(CLK_TOP_APLL12_DIV4, "apll12_div4", "apll12_ck_div4", 4), 9178c2ecf20Sopenharmony_ci GATE_TOP5(CLK_TOP_APLL12_DIV4B, "apll12_div4b", "apll12_ck_div4b", 5), 9188c2ecf20Sopenharmony_ci GATE_TOP5(CLK_TOP_APLL12_DIV5, "apll12_div5", "apll12_ck_div5", 6), 9198c2ecf20Sopenharmony_ci GATE_TOP5(CLK_TOP_APLL12_DIV5B, "apll12_div5b", "apll12_ck_div5b", 7), 9208c2ecf20Sopenharmony_ci GATE_TOP5(CLK_TOP_APLL12_DIV6, "apll12_div6", "apll12_ck_div6", 8), 9218c2ecf20Sopenharmony_ci}; 9228c2ecf20Sopenharmony_ci 9238c2ecf20Sopenharmony_cistatic void __init mtk_topckgen_init(struct device_node *node) 9248c2ecf20Sopenharmony_ci{ 9258c2ecf20Sopenharmony_ci struct clk_onecell_data *clk_data; 9268c2ecf20Sopenharmony_ci int r; 9278c2ecf20Sopenharmony_ci void __iomem *base; 9288c2ecf20Sopenharmony_ci 9298c2ecf20Sopenharmony_ci base = of_iomap(node, 0); 9308c2ecf20Sopenharmony_ci if (!base) { 9318c2ecf20Sopenharmony_ci pr_err("%s(): ioremap failed\n", __func__); 9328c2ecf20Sopenharmony_ci return; 9338c2ecf20Sopenharmony_ci } 9348c2ecf20Sopenharmony_ci 9358c2ecf20Sopenharmony_ci clk_data = mtk_alloc_clk_data(MT8167_CLK_TOP_NR_CLK); 9368c2ecf20Sopenharmony_ci 9378c2ecf20Sopenharmony_ci mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks), 9388c2ecf20Sopenharmony_ci clk_data); 9398c2ecf20Sopenharmony_ci mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks), clk_data); 9408c2ecf20Sopenharmony_ci 9418c2ecf20Sopenharmony_ci mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data); 9428c2ecf20Sopenharmony_ci mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base, 9438c2ecf20Sopenharmony_ci &mt8167_clk_lock, clk_data); 9448c2ecf20Sopenharmony_ci mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs), 9458c2ecf20Sopenharmony_ci base, &mt8167_clk_lock, clk_data); 9468c2ecf20Sopenharmony_ci 9478c2ecf20Sopenharmony_ci r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 9488c2ecf20Sopenharmony_ci if (r) 9498c2ecf20Sopenharmony_ci pr_err("%s(): could not register clock provider: %d\n", 9508c2ecf20Sopenharmony_ci __func__, r); 9518c2ecf20Sopenharmony_ci} 9528c2ecf20Sopenharmony_ciCLK_OF_DECLARE(mtk_topckgen, "mediatek,mt8167-topckgen", mtk_topckgen_init); 9538c2ecf20Sopenharmony_ci 9548c2ecf20Sopenharmony_cistatic void __init mtk_infracfg_init(struct device_node *node) 9558c2ecf20Sopenharmony_ci{ 9568c2ecf20Sopenharmony_ci struct clk_onecell_data *clk_data; 9578c2ecf20Sopenharmony_ci int r; 9588c2ecf20Sopenharmony_ci void __iomem *base; 9598c2ecf20Sopenharmony_ci 9608c2ecf20Sopenharmony_ci base = of_iomap(node, 0); 9618c2ecf20Sopenharmony_ci if (!base) { 9628c2ecf20Sopenharmony_ci pr_err("%s(): ioremap failed\n", __func__); 9638c2ecf20Sopenharmony_ci return; 9648c2ecf20Sopenharmony_ci } 9658c2ecf20Sopenharmony_ci 9668c2ecf20Sopenharmony_ci clk_data = mtk_alloc_clk_data(CLK_IFR_NR_CLK); 9678c2ecf20Sopenharmony_ci 9688c2ecf20Sopenharmony_ci mtk_clk_register_composites(ifr_muxes, ARRAY_SIZE(ifr_muxes), base, 9698c2ecf20Sopenharmony_ci &mt8167_clk_lock, clk_data); 9708c2ecf20Sopenharmony_ci 9718c2ecf20Sopenharmony_ci r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 9728c2ecf20Sopenharmony_ci if (r) 9738c2ecf20Sopenharmony_ci pr_err("%s(): could not register clock provider: %d\n", 9748c2ecf20Sopenharmony_ci __func__, r); 9758c2ecf20Sopenharmony_ci} 9768c2ecf20Sopenharmony_ciCLK_OF_DECLARE(mtk_infracfg, "mediatek,mt8167-infracfg", mtk_infracfg_init); 9778c2ecf20Sopenharmony_ci 9788c2ecf20Sopenharmony_ci#define MT8167_PLL_FMAX (2500UL * MHZ) 9798c2ecf20Sopenharmony_ci 9808c2ecf20Sopenharmony_ci#define CON0_MT8167_RST_BAR BIT(27) 9818c2ecf20Sopenharmony_ci 9828c2ecf20Sopenharmony_ci#define PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \ 9838c2ecf20Sopenharmony_ci _pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \ 9848c2ecf20Sopenharmony_ci _pcw_shift, _div_table) { \ 9858c2ecf20Sopenharmony_ci .id = _id, \ 9868c2ecf20Sopenharmony_ci .name = _name, \ 9878c2ecf20Sopenharmony_ci .reg = _reg, \ 9888c2ecf20Sopenharmony_ci .pwr_reg = _pwr_reg, \ 9898c2ecf20Sopenharmony_ci .en_mask = _en_mask, \ 9908c2ecf20Sopenharmony_ci .flags = _flags, \ 9918c2ecf20Sopenharmony_ci .rst_bar_mask = CON0_MT8167_RST_BAR, \ 9928c2ecf20Sopenharmony_ci .fmax = MT8167_PLL_FMAX, \ 9938c2ecf20Sopenharmony_ci .pcwbits = _pcwbits, \ 9948c2ecf20Sopenharmony_ci .pd_reg = _pd_reg, \ 9958c2ecf20Sopenharmony_ci .pd_shift = _pd_shift, \ 9968c2ecf20Sopenharmony_ci .tuner_reg = _tuner_reg, \ 9978c2ecf20Sopenharmony_ci .pcw_reg = _pcw_reg, \ 9988c2ecf20Sopenharmony_ci .pcw_shift = _pcw_shift, \ 9998c2ecf20Sopenharmony_ci .div_table = _div_table, \ 10008c2ecf20Sopenharmony_ci } 10018c2ecf20Sopenharmony_ci 10028c2ecf20Sopenharmony_ci#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \ 10038c2ecf20Sopenharmony_ci _pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \ 10048c2ecf20Sopenharmony_ci _pcw_shift) \ 10058c2ecf20Sopenharmony_ci PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \ 10068c2ecf20Sopenharmony_ci _pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift, \ 10078c2ecf20Sopenharmony_ci NULL) 10088c2ecf20Sopenharmony_ci 10098c2ecf20Sopenharmony_cistatic const struct mtk_pll_div_table mmpll_div_table[] = { 10108c2ecf20Sopenharmony_ci { .div = 0, .freq = MT8167_PLL_FMAX }, 10118c2ecf20Sopenharmony_ci { .div = 1, .freq = 1000000000 }, 10128c2ecf20Sopenharmony_ci { .div = 2, .freq = 604500000 }, 10138c2ecf20Sopenharmony_ci { .div = 3, .freq = 253500000 }, 10148c2ecf20Sopenharmony_ci { .div = 4, .freq = 126750000 }, 10158c2ecf20Sopenharmony_ci { } /* sentinel */ 10168c2ecf20Sopenharmony_ci}; 10178c2ecf20Sopenharmony_ci 10188c2ecf20Sopenharmony_cistatic const struct mtk_pll_data plls[] = { 10198c2ecf20Sopenharmony_ci PLL(CLK_APMIXED_ARMPLL, "armpll", 0x0100, 0x0110, 0x00000001, 0, 10208c2ecf20Sopenharmony_ci 21, 0x0104, 24, 0, 0x0104, 0), 10218c2ecf20Sopenharmony_ci PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x0120, 0x0130, 0x00000001, 10228c2ecf20Sopenharmony_ci HAVE_RST_BAR, 21, 0x0124, 24, 0, 0x0124, 0), 10238c2ecf20Sopenharmony_ci PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x0140, 0x0150, 0x30000001, 10248c2ecf20Sopenharmony_ci HAVE_RST_BAR, 7, 0x0144, 24, 0, 0x0144, 0), 10258c2ecf20Sopenharmony_ci PLL_B(CLK_APMIXED_MMPLL, "mmpll", 0x0160, 0x0170, 0x00000001, 0, 10268c2ecf20Sopenharmony_ci 21, 0x0164, 24, 0, 0x0164, 0, mmpll_div_table), 10278c2ecf20Sopenharmony_ci PLL(CLK_APMIXED_APLL1, "apll1", 0x0180, 0x0190, 0x00000001, 0, 10288c2ecf20Sopenharmony_ci 31, 0x0180, 1, 0x0194, 0x0184, 0), 10298c2ecf20Sopenharmony_ci PLL(CLK_APMIXED_APLL2, "apll2", 0x01A0, 0x01B0, 0x00000001, 0, 10308c2ecf20Sopenharmony_ci 31, 0x01A0, 1, 0x01B4, 0x01A4, 0), 10318c2ecf20Sopenharmony_ci PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x01C0, 0x01D0, 0x00000001, 0, 10328c2ecf20Sopenharmony_ci 21, 0x01C4, 24, 0, 0x01C4, 0), 10338c2ecf20Sopenharmony_ci PLL(CLK_APMIXED_LVDSPLL, "lvdspll", 0x01E0, 0x01F0, 0x00000001, 0, 10348c2ecf20Sopenharmony_ci 21, 0x01E4, 24, 0, 0x01E4, 0), 10358c2ecf20Sopenharmony_ci}; 10368c2ecf20Sopenharmony_ci 10378c2ecf20Sopenharmony_cistatic void __init mtk_apmixedsys_init(struct device_node *node) 10388c2ecf20Sopenharmony_ci{ 10398c2ecf20Sopenharmony_ci struct clk_onecell_data *clk_data; 10408c2ecf20Sopenharmony_ci void __iomem *base; 10418c2ecf20Sopenharmony_ci int r; 10428c2ecf20Sopenharmony_ci 10438c2ecf20Sopenharmony_ci base = of_iomap(node, 0); 10448c2ecf20Sopenharmony_ci if (!base) { 10458c2ecf20Sopenharmony_ci pr_err("%s(): ioremap failed\n", __func__); 10468c2ecf20Sopenharmony_ci return; 10478c2ecf20Sopenharmony_ci } 10488c2ecf20Sopenharmony_ci 10498c2ecf20Sopenharmony_ci clk_data = mtk_alloc_clk_data(MT8167_CLK_APMIXED_NR_CLK); 10508c2ecf20Sopenharmony_ci 10518c2ecf20Sopenharmony_ci mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); 10528c2ecf20Sopenharmony_ci mtk_clk_register_dividers(apmixed_adj_divs, ARRAY_SIZE(apmixed_adj_divs), 10538c2ecf20Sopenharmony_ci base, &mt8167_clk_lock, clk_data); 10548c2ecf20Sopenharmony_ci 10558c2ecf20Sopenharmony_ci r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 10568c2ecf20Sopenharmony_ci if (r) 10578c2ecf20Sopenharmony_ci pr_err("%s(): could not register clock provider: %d\n", 10588c2ecf20Sopenharmony_ci __func__, r); 10598c2ecf20Sopenharmony_ci 10608c2ecf20Sopenharmony_ci} 10618c2ecf20Sopenharmony_ciCLK_OF_DECLARE(mtk_apmixedsys, "mediatek,mt8167-apmixedsys", 10628c2ecf20Sopenharmony_ci mtk_apmixedsys_init); 1063