18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com> 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 78c2ecf20Sopenharmony_ci#include <linux/io.h> 88c2ecf20Sopenharmony_ci#include <linux/module.h> 98c2ecf20Sopenharmony_ci#include <linux/of_address.h> 108c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include "ccu_common.h" 138c2ecf20Sopenharmony_ci#include "ccu_reset.h" 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include "ccu_div.h" 168c2ecf20Sopenharmony_ci#include "ccu_gate.h" 178c2ecf20Sopenharmony_ci#include "ccu_mp.h" 188c2ecf20Sopenharmony_ci#include "ccu_mult.h" 198c2ecf20Sopenharmony_ci#include "ccu_nk.h" 208c2ecf20Sopenharmony_ci#include "ccu_nkm.h" 218c2ecf20Sopenharmony_ci#include "ccu_nkmp.h" 228c2ecf20Sopenharmony_ci#include "ccu_nm.h" 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#include "ccu-sun50i-a100.h" 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_SDM_ENABLE BIT(24) 278c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_OUTPUT_ENABLE BIT(27) 288c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_LOCK BIT(28) 298c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_LOCK_ENABLE BIT(29) 308c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_ENABLE BIT(31) 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_PERIPH1_PATTERN0 0xd1303333 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/* 358c2ecf20Sopenharmony_ci * The CPU PLL is actually NP clock, with P being /1, /2 or /4. However 368c2ecf20Sopenharmony_ci * P should only be used for output frequencies lower than 288 MHz. 378c2ecf20Sopenharmony_ci * 388c2ecf20Sopenharmony_ci * For now we can just model it as a multiplier clock, and force P to /1. 398c2ecf20Sopenharmony_ci * 408c2ecf20Sopenharmony_ci * The M factor is present in the register's description, but not in the 418c2ecf20Sopenharmony_ci * frequency formula, and it's documented as "M is only used for backdoor 428c2ecf20Sopenharmony_ci * testing", so it's not modelled and then force to 0. 438c2ecf20Sopenharmony_ci */ 448c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_CPUX_REG 0x000 458c2ecf20Sopenharmony_cistatic struct ccu_mult pll_cpux_clk = { 468c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 478c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 488c2ecf20Sopenharmony_ci .mult = _SUNXI_CCU_MULT_MIN(8, 8, 12), 498c2ecf20Sopenharmony_ci .common = { 508c2ecf20Sopenharmony_ci .reg = 0x000, 518c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-cpux", "dcxo24M", 528c2ecf20Sopenharmony_ci &ccu_mult_ops, 538c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 548c2ecf20Sopenharmony_ci }, 558c2ecf20Sopenharmony_ci}; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* Some PLLs are input * N / div1 / P. Model them as NKMP with no K */ 588c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_DDR0_REG 0x010 598c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_ddr0_clk = { 608c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 618c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 628c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 638c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 648c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 658c2ecf20Sopenharmony_ci .common = { 668c2ecf20Sopenharmony_ci .reg = 0x010, 678c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ddr0", "dcxo24M", 688c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 698c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE | 708c2ecf20Sopenharmony_ci CLK_IS_CRITICAL), 718c2ecf20Sopenharmony_ci }, 728c2ecf20Sopenharmony_ci}; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_PERIPH0_REG 0x020 758c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_periph0_clk = { 768c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 778c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 788c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 798c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 808c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 818c2ecf20Sopenharmony_ci .fixed_post_div = 2, 828c2ecf20Sopenharmony_ci .common = { 838c2ecf20Sopenharmony_ci .reg = 0x020, 848c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV, 858c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-periph0", "dcxo24M", 868c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 878c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 888c2ecf20Sopenharmony_ci }, 898c2ecf20Sopenharmony_ci}; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_PERIPH1_REG 0x028 928c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_periph1_clk = { 938c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 948c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 958c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 968c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 978c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 988c2ecf20Sopenharmony_ci .fixed_post_div = 2, 998c2ecf20Sopenharmony_ci .common = { 1008c2ecf20Sopenharmony_ci .reg = 0x028, 1018c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV, 1028c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-periph1", "dcxo24M", 1038c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1048c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1058c2ecf20Sopenharmony_ci }, 1068c2ecf20Sopenharmony_ci}; 1078c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_PERIPH1_PATTERN0_REG 0x128 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_GPU_REG 0x030 1108c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_gpu_clk = { 1118c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 1128c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 1138c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1148c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 1158c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 1168c2ecf20Sopenharmony_ci .common = { 1178c2ecf20Sopenharmony_ci .reg = 0x030, 1188c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-gpu", "dcxo24M", 1198c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1208c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1218c2ecf20Sopenharmony_ci }, 1228c2ecf20Sopenharmony_ci}; 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci/* 1258c2ecf20Sopenharmony_ci * For Video PLLs, the output divider is described as "used for testing" 1268c2ecf20Sopenharmony_ci * in the user manual. So it's not modelled and forced to 0. 1278c2ecf20Sopenharmony_ci */ 1288c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_VIDEO0_REG 0x040 1298c2ecf20Sopenharmony_cistatic struct ccu_nm pll_video0_clk = { 1308c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 1318c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 1328c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1338c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 1348c2ecf20Sopenharmony_ci .fixed_post_div = 4, 1358c2ecf20Sopenharmony_ci .common = { 1368c2ecf20Sopenharmony_ci .reg = 0x040, 1378c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV, 1388c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video0", "dcxo24M", 1398c2ecf20Sopenharmony_ci &ccu_nm_ops, 1408c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1418c2ecf20Sopenharmony_ci }, 1428c2ecf20Sopenharmony_ci}; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_VIDEO1_REG 0x048 1458c2ecf20Sopenharmony_cistatic struct ccu_nm pll_video1_clk = { 1468c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 1478c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 1488c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1498c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 1508c2ecf20Sopenharmony_ci .fixed_post_div = 4, 1518c2ecf20Sopenharmony_ci .common = { 1528c2ecf20Sopenharmony_ci .reg = 0x048, 1538c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV, 1548c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video1", "dcxo24M", 1558c2ecf20Sopenharmony_ci &ccu_nm_ops, 1568c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1578c2ecf20Sopenharmony_ci }, 1588c2ecf20Sopenharmony_ci}; 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_VIDEO2_REG 0x050 1618c2ecf20Sopenharmony_cistatic struct ccu_nm pll_video2_clk = { 1628c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 1638c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 1648c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1658c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 1668c2ecf20Sopenharmony_ci .fixed_post_div = 4, 1678c2ecf20Sopenharmony_ci .common = { 1688c2ecf20Sopenharmony_ci .reg = 0x050, 1698c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV, 1708c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video2", "dcxo24M", 1718c2ecf20Sopenharmony_ci &ccu_nm_ops, 1728c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1738c2ecf20Sopenharmony_ci }, 1748c2ecf20Sopenharmony_ci}; 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_VE_REG 0x058 1778c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_ve_clk = { 1788c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 1798c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 1808c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1818c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 1828c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 1838c2ecf20Sopenharmony_ci .common = { 1848c2ecf20Sopenharmony_ci .reg = 0x058, 1858c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ve", "dcxo24M", 1868c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1878c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1888c2ecf20Sopenharmony_ci }, 1898c2ecf20Sopenharmony_ci}; 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci/* 1928c2ecf20Sopenharmony_ci * The COM PLL has m0 dividers in addition to the usual N, M 1938c2ecf20Sopenharmony_ci * factors. Since we only need 1 frequencies from this PLL: 45.1584 MHz, 1948c2ecf20Sopenharmony_ci * ignore it for now. 1958c2ecf20Sopenharmony_ci */ 1968c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_COM_REG 0x060 1978c2ecf20Sopenharmony_cistatic struct ccu_sdm_setting pll_com_sdm_table[] = { 1988c2ecf20Sopenharmony_ci { .rate = 451584000, .pattern = 0xc0014396, .m = 2, .n = 37 }, 1998c2ecf20Sopenharmony_ci}; 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_cistatic struct ccu_nm pll_com_clk = { 2028c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 2038c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 2048c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 2058c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(0, 1), 2068c2ecf20Sopenharmony_ci .sdm = _SUNXI_CCU_SDM(pll_com_sdm_table, BIT(24), 2078c2ecf20Sopenharmony_ci 0x160, BIT(31)), 2088c2ecf20Sopenharmony_ci .common = { 2098c2ecf20Sopenharmony_ci .reg = 0x060, 2108c2ecf20Sopenharmony_ci .features = CCU_FEATURE_SIGMA_DELTA_MOD, 2118c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-com", "dcxo24M", 2128c2ecf20Sopenharmony_ci &ccu_nm_ops, 2138c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 2148c2ecf20Sopenharmony_ci }, 2158c2ecf20Sopenharmony_ci}; 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_VIDEO3_REG 0x068 2188c2ecf20Sopenharmony_cistatic struct ccu_nm pll_video3_clk = { 2198c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 2208c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 2218c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 2228c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 2238c2ecf20Sopenharmony_ci .fixed_post_div = 4, 2248c2ecf20Sopenharmony_ci .common = { 2258c2ecf20Sopenharmony_ci .reg = 0x068, 2268c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV, 2278c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video3", "dcxo24M", 2288c2ecf20Sopenharmony_ci &ccu_nm_ops, 2298c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 2308c2ecf20Sopenharmony_ci }, 2318c2ecf20Sopenharmony_ci}; 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci/* 2348c2ecf20Sopenharmony_ci * The Audio PLL has m0, m1 dividers in addition to the usual N, M 2358c2ecf20Sopenharmony_ci * factors. Since we only need 4 frequencies from this PLL: 22.5792 MHz, 2368c2ecf20Sopenharmony_ci * 24.576 MHz, 90.3168MHz and 98.304MHz ignore them for now. 2378c2ecf20Sopenharmony_ci * Enforce the default for them, which is m0 = 1, m1 = 0. 2388c2ecf20Sopenharmony_ci */ 2398c2ecf20Sopenharmony_ci#define SUN50I_A100_PLL_AUDIO_REG 0x078 2408c2ecf20Sopenharmony_cistatic struct ccu_sdm_setting pll_audio_sdm_table[] = { 2418c2ecf20Sopenharmony_ci { .rate = 45158400, .pattern = 0xc001bcd3, .m = 18, .n = 33 }, 2428c2ecf20Sopenharmony_ci { .rate = 49152000, .pattern = 0xc001eb85, .m = 20, .n = 40 }, 2438c2ecf20Sopenharmony_ci { .rate = 180633600, .pattern = 0xc001288d, .m = 3, .n = 22 }, 2448c2ecf20Sopenharmony_ci { .rate = 196608000, .pattern = 0xc001eb85, .m = 5, .n = 40 }, 2458c2ecf20Sopenharmony_ci}; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_cistatic struct ccu_nm pll_audio_clk = { 2488c2ecf20Sopenharmony_ci .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 2498c2ecf20Sopenharmony_ci .lock = SUN50I_A100_PLL_LOCK, 2508c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 2518c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 6), 2528c2ecf20Sopenharmony_ci .fixed_post_div = 2, 2538c2ecf20Sopenharmony_ci .sdm = _SUNXI_CCU_SDM(pll_audio_sdm_table, BIT(24), 2548c2ecf20Sopenharmony_ci 0x178, BIT(31)), 2558c2ecf20Sopenharmony_ci .common = { 2568c2ecf20Sopenharmony_ci .reg = 0x078, 2578c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV | 2588c2ecf20Sopenharmony_ci CCU_FEATURE_SIGMA_DELTA_MOD, 2598c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-audio", "dcxo24M", 2608c2ecf20Sopenharmony_ci &ccu_nm_ops, 2618c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 2628c2ecf20Sopenharmony_ci }, 2638c2ecf20Sopenharmony_ci}; 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_cistatic const char * const cpux_parents[] = { "dcxo24M", "osc32k", 2668c2ecf20Sopenharmony_ci "iosc", "pll-cpux", 2678c2ecf20Sopenharmony_ci "pll-periph0" }; 2688c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX(cpux_clk, "cpux", cpux_parents, 2698c2ecf20Sopenharmony_ci 0x500, 24, 3, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 2708c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x500, 0, 2, 0); 2718c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(cpux_apb_clk, "cpux-apb", "cpux", 0x500, 8, 2, 0); 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_cistatic const char * const psi_ahb1_ahb2_parents[] = { "dcxo24M", "osc32k", 2748c2ecf20Sopenharmony_ci "iosc", "pll-periph0", 2758c2ecf20Sopenharmony_ci "pll-periph0-2x" }; 2768c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(psi_ahb1_ahb2_clk, "psi-ahb1-ahb2", 2778c2ecf20Sopenharmony_ci psi_ahb1_ahb2_parents, 0x510, 2788c2ecf20Sopenharmony_ci 0, 2, /* M */ 2798c2ecf20Sopenharmony_ci 8, 2, /* P */ 2808c2ecf20Sopenharmony_ci 24, 3, /* mux */ 2818c2ecf20Sopenharmony_ci 0); 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_cistatic const char * const ahb3_apb1_apb2_parents[] = { "dcxo24M", "osc32k", 2848c2ecf20Sopenharmony_ci "psi-ahb1-ahb2", 2858c2ecf20Sopenharmony_ci "pll-periph0", 2868c2ecf20Sopenharmony_ci "pll-periph0-2x" }; 2878c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(ahb3_clk, "ahb3", ahb3_apb1_apb2_parents, 0x51c, 2888c2ecf20Sopenharmony_ci 0, 2, /* M */ 2898c2ecf20Sopenharmony_ci 8, 2, /* P */ 2908c2ecf20Sopenharmony_ci 24, 3, /* mux */ 2918c2ecf20Sopenharmony_ci 0); 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb1_clk, "apb1", ahb3_apb1_apb2_parents, 0x520, 2948c2ecf20Sopenharmony_ci 0, 2, /* M */ 2958c2ecf20Sopenharmony_ci 8, 2, /* P */ 2968c2ecf20Sopenharmony_ci 24, 3, /* mux */ 2978c2ecf20Sopenharmony_ci 0); 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", ahb3_apb1_apb2_parents, 0x524, 3008c2ecf20Sopenharmony_ci 0, 2, /* M */ 3018c2ecf20Sopenharmony_ci 8, 2, /* P */ 3028c2ecf20Sopenharmony_ci 24, 3, /* mux */ 3038c2ecf20Sopenharmony_ci 0); 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_cistatic const char * const mbus_parents[] = { "dcxo24M", "pll-ddr0", 3068c2ecf20Sopenharmony_ci "pll-periph0", 3078c2ecf20Sopenharmony_ci "pll-periph0-2x" }; 3088c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents, 0x540, 3098c2ecf20Sopenharmony_ci 0, 3, /* M */ 3108c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3118c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3128c2ecf20Sopenharmony_ci CLK_IS_CRITICAL); 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_cistatic const char * const de_parents[] = { "pll-com", "pll-periph0-2x" }; 3158c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de0", de_parents, 0x600, 3168c2ecf20Sopenharmony_ci 0, 4, /* M */ 3178c2ecf20Sopenharmony_ci 24, 1, /* mux */ 3188c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3198c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_de_clk, "bus-de", "psi-ahb1-ahb2", 3228c2ecf20Sopenharmony_ci 0x60c, BIT(0), 0); 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_cistatic const char * const g2d_parents[] = { "pll-com", "pll-periph0-2x", 3258c2ecf20Sopenharmony_ci "pll-video0-2x", "pll-video1-2x", 3268c2ecf20Sopenharmony_ci "pll-video2-2x"}; 3278c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(g2d_clk, "g2d", 3288c2ecf20Sopenharmony_ci g2d_parents, 3298c2ecf20Sopenharmony_ci 0x630, 3308c2ecf20Sopenharmony_ci 0, 4, /* M */ 3318c2ecf20Sopenharmony_ci 24, 3, /* mux */ 3328c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3338c2ecf20Sopenharmony_ci 0); 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_g2d_clk, "bus-g2d", "psi-ahb1-ahb2", 3368c2ecf20Sopenharmony_ci 0x63c, BIT(0), 0); 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_cistatic const char * const gpu_parents[] = { "pll-gpu" }; 3398c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(gpu_clk, "gpu", gpu_parents, 0x670, 3408c2ecf20Sopenharmony_ci 0, 2, /* M */ 3418c2ecf20Sopenharmony_ci 24, 1, /* mux */ 3428c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3438c2ecf20Sopenharmony_ci 0); 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gpu_clk, "bus-gpu", "psi-ahb1-ahb2", 3468c2ecf20Sopenharmony_ci 0x67c, BIT(0), 0); 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_cistatic const char * const ce_parents[] = { "dcxo24M", "pll-periph0-2x" }; 3498c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ce_clk, "ce", ce_parents, 0x680, 3508c2ecf20Sopenharmony_ci 0, 4, /* M */ 3518c2ecf20Sopenharmony_ci 8, 2, /* P */ 3528c2ecf20Sopenharmony_ci 24, 1, /* mux */ 3538c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3548c2ecf20Sopenharmony_ci 0); 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ce_clk, "bus-ce", "psi-ahb1-ahb2", 3578c2ecf20Sopenharmony_ci 0x68c, BIT(0), 0); 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_cistatic const char * const ve_parents[] = { "pll-ve" }; 3608c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(ve_clk, "ve", ve_parents, 0x690, 3618c2ecf20Sopenharmony_ci 0, 3, /* M */ 3628c2ecf20Sopenharmony_ci 24, 1, /* mux */ 3638c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3648c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "psi-ahb1-ahb2", 3678c2ecf20Sopenharmony_ci 0x69c, BIT(0), 0); 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "psi-ahb1-ahb2", 3708c2ecf20Sopenharmony_ci 0x70c, BIT(0), 0); 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_msgbox_clk, "bus-msgbox", "psi-ahb1-ahb2", 3738c2ecf20Sopenharmony_ci 0x71c, BIT(0), 0); 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spinlock_clk, "bus-spinlock", "psi-ahb1-ahb2", 3768c2ecf20Sopenharmony_ci 0x72c, BIT(0), 0); 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "psi-ahb1-ahb2", 3798c2ecf20Sopenharmony_ci 0x73c, BIT(0), 0); 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk, "avs", "dcxo24M", 0x740, BIT(31), 0); 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dbg_clk, "bus-dbg", "psi-ahb1-ahb2", 3848c2ecf20Sopenharmony_ci 0x78c, BIT(0), 0); 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_psi_clk, "bus-psi", "psi-ahb1-ahb2", 3878c2ecf20Sopenharmony_ci 0x79c, BIT(0), 0); 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_pwm_clk, "bus-pwm", "apb1", 0x7ac, BIT(0), 0); 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_iommu_clk, "bus-iommu", "apb1", 0x7bc, BIT(0), 0); 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_dma_clk, "mbus-dma", "mbus", 3948c2ecf20Sopenharmony_ci 0x804, BIT(0), 0); 3958c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_ve_clk, "mbus-ve", "mbus", 3968c2ecf20Sopenharmony_ci 0x804, BIT(1), 0); 3978c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_ce_clk, "mbus-ce", "mbus", 3988c2ecf20Sopenharmony_ci 0x804, BIT(2), 0); 3998c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_nand_clk, "mbus-nand", "mbus", 4008c2ecf20Sopenharmony_ci 0x804, BIT(5), 0); 4018c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_csi_clk, "mbus-csi", "mbus", 4028c2ecf20Sopenharmony_ci 0x804, BIT(8), 0); 4038c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_isp_clk, "mbus-isp", "mbus", 4048c2ecf20Sopenharmony_ci 0x804, BIT(9), 0); 4058c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_g2d_clk, "mbus-g2d", "mbus", 4068c2ecf20Sopenharmony_ci 0x804, BIT(10), 0); 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dram_clk, "bus-dram", "psi-ahb1-ahb2", 4098c2ecf20Sopenharmony_ci 0x80c, BIT(0), CLK_IS_CRITICAL); 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_cistatic const char * const nand_spi_parents[] = { "dcxo24M", 4128c2ecf20Sopenharmony_ci "pll-periph0", 4138c2ecf20Sopenharmony_ci "pll-periph1", 4148c2ecf20Sopenharmony_ci "pll-periph0-2x", 4158c2ecf20Sopenharmony_ci "pll-periph1-2x" }; 4168c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand0_clk, "nand0", nand_spi_parents, 0x810, 4178c2ecf20Sopenharmony_ci 0, 4, /* M */ 4188c2ecf20Sopenharmony_ci 8, 2, /* P */ 4198c2ecf20Sopenharmony_ci 24, 3, /* mux */ 4208c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4218c2ecf20Sopenharmony_ci 0); 4228c2ecf20Sopenharmony_ci 4238c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand1_clk, "nand1", nand_spi_parents, 0x814, 4248c2ecf20Sopenharmony_ci 0, 4, /* M */ 4258c2ecf20Sopenharmony_ci 8, 2, /* P */ 4268c2ecf20Sopenharmony_ci 24, 3, /* mux */ 4278c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4288c2ecf20Sopenharmony_ci 0); 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_nand_clk, "bus-nand", "ahb3", 0x82c, BIT(0), 0); 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_cistatic const char * const mmc_parents[] = { "dcxo24M", "pll-periph0-2x", 4338c2ecf20Sopenharmony_ci "pll-periph1-2x" }; 4348c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc0_clk, "mmc0", mmc_parents, 0x830, 4358c2ecf20Sopenharmony_ci 0, 4, /* M */ 4368c2ecf20Sopenharmony_ci 8, 2, /* P */ 4378c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4388c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4398c2ecf20Sopenharmony_ci 2, /* post-div */ 4408c2ecf20Sopenharmony_ci CLK_SET_RATE_NO_REPARENT); 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc1_clk, "mmc1", mmc_parents, 0x834, 4438c2ecf20Sopenharmony_ci 0, 4, /* M */ 4448c2ecf20Sopenharmony_ci 8, 2, /* P */ 4458c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4468c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4478c2ecf20Sopenharmony_ci 2, /* post-div */ 4488c2ecf20Sopenharmony_ci CLK_SET_RATE_NO_REPARENT); 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc2_clk, "mmc2", mmc_parents, 0x838, 4518c2ecf20Sopenharmony_ci 0, 4, /* M */ 4528c2ecf20Sopenharmony_ci 8, 2, /* P */ 4538c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4548c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4558c2ecf20Sopenharmony_ci 2, /* post-div */ 4568c2ecf20Sopenharmony_ci CLK_SET_RATE_NO_REPARENT); 4578c2ecf20Sopenharmony_ci 4588c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb3", 0x84c, BIT(0), 0); 4598c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb3", 0x84c, BIT(1), 0); 4608c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc2_clk, "bus-mmc2", "ahb3", 0x84c, BIT(2), 0); 4618c2ecf20Sopenharmony_ci 4628c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb2", 0x90c, BIT(0), 0); 4638c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb2", 0x90c, BIT(1), 0); 4648c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb2", 0x90c, BIT(2), 0); 4658c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb2", 0x90c, BIT(3), 0); 4668c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart4_clk, "bus-uart4", "apb2", 0x90c, BIT(4), 0); 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb2", 0x91c, BIT(0), 0); 4698c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb2", 0x91c, BIT(1), 0); 4708c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb2", 0x91c, BIT(2), 0); 4718c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c3_clk, "bus-i2c3", "apb2", 0x91c, BIT(3), 0); 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", nand_spi_parents, 0x940, 4748c2ecf20Sopenharmony_ci 0, 4, /* M */ 4758c2ecf20Sopenharmony_ci 8, 2, /* P */ 4768c2ecf20Sopenharmony_ci 24, 3, /* mux */ 4778c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4788c2ecf20Sopenharmony_ci 0); 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", nand_spi_parents, 0x944, 4818c2ecf20Sopenharmony_ci 0, 4, /* M */ 4828c2ecf20Sopenharmony_ci 8, 2, /* P */ 4838c2ecf20Sopenharmony_ci 24, 3, /* mux */ 4848c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4858c2ecf20Sopenharmony_ci 0); 4868c2ecf20Sopenharmony_ci 4878c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi2_clk, "spi2", nand_spi_parents, 0x948, 4888c2ecf20Sopenharmony_ci 0, 4, /* M */ 4898c2ecf20Sopenharmony_ci 8, 2, /* P */ 4908c2ecf20Sopenharmony_ci 24, 3, /* mux */ 4918c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4928c2ecf20Sopenharmony_ci 0); 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb3", 0x96c, BIT(0), 0); 4958c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi1_clk, "bus-spi1", "ahb3", 0x96c, BIT(1), 0); 4968c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi2_clk, "bus-spi2", "ahb3", 0x96c, BIT(2), 0); 4978c2ecf20Sopenharmony_ci 4988c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(emac_25m_clk, "emac-25m", "ahb3", 0x970, 4998c2ecf20Sopenharmony_ci BIT(31) | BIT(30), 0); 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_emac_clk, "bus-emac", "ahb3", 0x97c, BIT(0), 0); 5028c2ecf20Sopenharmony_ci 5038c2ecf20Sopenharmony_cistatic const char * const ir_parents[] = { "osc32k", "iosc", 5048c2ecf20Sopenharmony_ci "pll-periph0", "pll-periph1" }; 5058c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ir_rx_clk, "ir-rx", ir_parents, 0x990, 5068c2ecf20Sopenharmony_ci 0, 4, /* M */ 5078c2ecf20Sopenharmony_ci 8, 2, /* P */ 5088c2ecf20Sopenharmony_ci 24, 3, /* mux */ 5098c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5108c2ecf20Sopenharmony_ci 0); 5118c2ecf20Sopenharmony_ci 5128c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ir_rx_clk, "bus-ir-rx", "ahb3", 0x99c, BIT(0), 0); 5138c2ecf20Sopenharmony_ci 5148c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ir_tx_clk, "ir-tx", ir_parents, 0x9c0, 5158c2ecf20Sopenharmony_ci 0, 4, /* M */ 5168c2ecf20Sopenharmony_ci 8, 2, /* P */ 5178c2ecf20Sopenharmony_ci 24, 3, /* mux */ 5188c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5198c2ecf20Sopenharmony_ci 0); 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ir_tx_clk, "bus-ir-tx", "apb1", 0x9cc, BIT(0), 0); 5228c2ecf20Sopenharmony_ci 5238c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gpadc_clk, "bus-gpadc", "apb1", 0x9ec, BIT(0), 0); 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ths_clk, "bus-ths", "apb1", 0x9fc, BIT(0), 0); 5268c2ecf20Sopenharmony_ci 5278c2ecf20Sopenharmony_cistatic const char * const audio_parents[] = { "pll-audio", "pll-com-audio" }; 5288c2ecf20Sopenharmony_cistatic struct ccu_div i2s0_clk = { 5298c2ecf20Sopenharmony_ci .enable = BIT(31), 5308c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5318c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5328c2ecf20Sopenharmony_ci .common = { 5338c2ecf20Sopenharmony_ci .reg = 0xa10, 5348c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("i2s0", 5358c2ecf20Sopenharmony_ci audio_parents, 5368c2ecf20Sopenharmony_ci &ccu_div_ops, 5378c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT), 5388c2ecf20Sopenharmony_ci }, 5398c2ecf20Sopenharmony_ci}; 5408c2ecf20Sopenharmony_ci 5418c2ecf20Sopenharmony_cistatic struct ccu_div i2s1_clk = { 5428c2ecf20Sopenharmony_ci .enable = BIT(31), 5438c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5448c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5458c2ecf20Sopenharmony_ci .common = { 5468c2ecf20Sopenharmony_ci .reg = 0xa14, 5478c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("i2s1", 5488c2ecf20Sopenharmony_ci audio_parents, 5498c2ecf20Sopenharmony_ci &ccu_div_ops, 5508c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT), 5518c2ecf20Sopenharmony_ci }, 5528c2ecf20Sopenharmony_ci}; 5538c2ecf20Sopenharmony_ci 5548c2ecf20Sopenharmony_cistatic struct ccu_div i2s2_clk = { 5558c2ecf20Sopenharmony_ci .enable = BIT(31), 5568c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5578c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5588c2ecf20Sopenharmony_ci .common = { 5598c2ecf20Sopenharmony_ci .reg = 0xa18, 5608c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("i2s2", 5618c2ecf20Sopenharmony_ci audio_parents, 5628c2ecf20Sopenharmony_ci &ccu_div_ops, 5638c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT), 5648c2ecf20Sopenharmony_ci }, 5658c2ecf20Sopenharmony_ci}; 5668c2ecf20Sopenharmony_ci 5678c2ecf20Sopenharmony_cistatic struct ccu_div i2s3_clk = { 5688c2ecf20Sopenharmony_ci .enable = BIT(31), 5698c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5708c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5718c2ecf20Sopenharmony_ci .common = { 5728c2ecf20Sopenharmony_ci .reg = 0xa1c, 5738c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("i2s3", 5748c2ecf20Sopenharmony_ci audio_parents, 5758c2ecf20Sopenharmony_ci &ccu_div_ops, 5768c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT), 5778c2ecf20Sopenharmony_ci }, 5788c2ecf20Sopenharmony_ci}; 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s0_clk, "bus-i2s0", "apb1", 0xa20, BIT(0), 0); 5818c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s1_clk, "bus-i2s1", "apb1", 0xa20, BIT(1), 0); 5828c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s2_clk, "bus-i2s2", "apb1", 0xa20, BIT(2), 0); 5838c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s3_clk, "bus-i2s3", "apb1", 0xa20, BIT(3), 0); 5848c2ecf20Sopenharmony_ci 5858c2ecf20Sopenharmony_cistatic struct ccu_div spdif_clk = { 5868c2ecf20Sopenharmony_ci .enable = BIT(31), 5878c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5888c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5898c2ecf20Sopenharmony_ci .common = { 5908c2ecf20Sopenharmony_ci .reg = 0xa24, 5918c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("spdif", 5928c2ecf20Sopenharmony_ci audio_parents, 5938c2ecf20Sopenharmony_ci &ccu_div_ops, 5948c2ecf20Sopenharmony_ci 0), 5958c2ecf20Sopenharmony_ci }, 5968c2ecf20Sopenharmony_ci}; 5978c2ecf20Sopenharmony_ci 5988c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spdif_clk, "bus-spdif", "apb1", 0xa2c, BIT(0), 0); 5998c2ecf20Sopenharmony_ci 6008c2ecf20Sopenharmony_cistatic struct ccu_div dmic_clk = { 6018c2ecf20Sopenharmony_ci .enable = BIT(31), 6028c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 6038c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 6048c2ecf20Sopenharmony_ci .common = { 6058c2ecf20Sopenharmony_ci .reg = 0xa40, 6068c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("dmic", 6078c2ecf20Sopenharmony_ci audio_parents, 6088c2ecf20Sopenharmony_ci &ccu_div_ops, 6098c2ecf20Sopenharmony_ci 0), 6108c2ecf20Sopenharmony_ci }, 6118c2ecf20Sopenharmony_ci}; 6128c2ecf20Sopenharmony_ci 6138c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dmic_clk, "bus-dmic", "apb1", 0xa4c, BIT(0), 0); 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(audio_codec_dac_clk, "audio-codec-dac", 6168c2ecf20Sopenharmony_ci audio_parents, 0xa50, 6178c2ecf20Sopenharmony_ci 0, 4, /* M */ 6188c2ecf20Sopenharmony_ci 24, 2, /* mux */ 6198c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6208c2ecf20Sopenharmony_ci 0); 6218c2ecf20Sopenharmony_ci 6228c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(audio_codec_adc_clk, "audio-codec-adc", 6238c2ecf20Sopenharmony_ci audio_parents, 0xa54, 6248c2ecf20Sopenharmony_ci 0, 4, /* M */ 6258c2ecf20Sopenharmony_ci 24, 2, /* mux */ 6268c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6278c2ecf20Sopenharmony_ci 0); 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(audio_codec_4x_clk, "audio-codec-4x", 6308c2ecf20Sopenharmony_ci audio_parents, 0xa58, 6318c2ecf20Sopenharmony_ci 0, 4, /* M */ 6328c2ecf20Sopenharmony_ci 24, 2, /* mux */ 6338c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6348c2ecf20Sopenharmony_ci 0); 6358c2ecf20Sopenharmony_ci 6368c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_audio_codec_clk, "bus-audio-codec", "apb1", 0xa5c, 6378c2ecf20Sopenharmony_ci BIT(0), 0); 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_ci/* 6408c2ecf20Sopenharmony_ci * There are OHCI 12M clock source selection bits for 2 USB 2.0 ports. 6418c2ecf20Sopenharmony_ci * We will force them to 0 (12M divided from 48M). 6428c2ecf20Sopenharmony_ci */ 6438c2ecf20Sopenharmony_ci#define SUN50I_A100_USB0_CLK_REG 0xa70 6448c2ecf20Sopenharmony_ci#define SUN50I_A100_USB1_CLK_REG 0xa74 6458c2ecf20Sopenharmony_ci 6468c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc12M", 0xa70, BIT(31), 0); 6478c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "dcxo24M", 0xa70, BIT(29), 0); 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci1_clk, "usb-ohci1", "osc12M", 0xa74, BIT(31), 0); 6508c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "dcxo24M", 0xa74, BIT(29), 0); 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci0_clk, "bus-ohci0", "ahb3", 0xa8c, BIT(0), 0); 6538c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci1_clk, "bus-ohci1", "ahb3", 0xa8c, BIT(1), 0); 6548c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci0_clk, "bus-ehci0", "ahb3", 0xa8c, BIT(4), 0); 6558c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci1_clk, "bus-ehci1", "ahb3", 0xa8c, BIT(5), 0); 6568c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb3", 0xa8c, BIT(8), 0); 6578c2ecf20Sopenharmony_ci 6588c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_lradc_clk, "bus-lradc", "ahb3", 0xa9c, BIT(0), 0); 6598c2ecf20Sopenharmony_ci 6608c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dpss_top0_clk, "bus-dpss-top0", "ahb3", 6618c2ecf20Sopenharmony_ci 0xabc, BIT(0), 0); 6628c2ecf20Sopenharmony_ci 6638c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dpss_top1_clk, "bus-dpss-top1", "ahb3", 6648c2ecf20Sopenharmony_ci 0xacc, BIT(0), 0); 6658c2ecf20Sopenharmony_ci 6668c2ecf20Sopenharmony_cistatic const char * const mipi_dsi_parents[] = { "dcxo24M", "pll-periph0-2x", 6678c2ecf20Sopenharmony_ci "pll-periph0" }; 6688c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mipi_dsi_clk, "mipi-dsi", 6698c2ecf20Sopenharmony_ci mipi_dsi_parents, 6708c2ecf20Sopenharmony_ci 0xb24, 6718c2ecf20Sopenharmony_ci 0, 4, /* M */ 6728c2ecf20Sopenharmony_ci 24, 2, /* mux */ 6738c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6748c2ecf20Sopenharmony_ci 0); 6758c2ecf20Sopenharmony_ci 6768c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mipi_dsi_clk, "bus-mipi-dsi", "ahb3", 6778c2ecf20Sopenharmony_ci 0xb4c, BIT(0), 0); 6788c2ecf20Sopenharmony_ci 6798c2ecf20Sopenharmony_cistatic const char * const tcon_lcd_parents[] = { "pll-video0-4x", 6808c2ecf20Sopenharmony_ci "pll-video1-4x", 6818c2ecf20Sopenharmony_ci "pll-video2-4x", 6828c2ecf20Sopenharmony_ci "pll-video3-4x", 6838c2ecf20Sopenharmony_ci "pll-periph0-2x" }; 6848c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(tcon_lcd_clk, "tcon-lcd0", 6858c2ecf20Sopenharmony_ci tcon_lcd_parents, 0xb60, 6868c2ecf20Sopenharmony_ci 0, 4, /* M */ 6878c2ecf20Sopenharmony_ci 8, 2, /* P */ 6888c2ecf20Sopenharmony_ci 24, 3, /* mux */ 6898c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6908c2ecf20Sopenharmony_ci 0); 6918c2ecf20Sopenharmony_ci 6928c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tcon_lcd_clk, "bus-tcon-lcd0", "ahb3", 6938c2ecf20Sopenharmony_ci 0xb7c, BIT(0), 0); 6948c2ecf20Sopenharmony_ci 6958c2ecf20Sopenharmony_cistatic const char * const ledc_parents[] = { "dcxo24M", 6968c2ecf20Sopenharmony_ci "pll-periph0" }; 6978c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ledc_clk, "ledc", 6988c2ecf20Sopenharmony_ci ledc_parents, 0xbf0, 6998c2ecf20Sopenharmony_ci 0, 4, /* M */ 7008c2ecf20Sopenharmony_ci 8, 2, /* P */ 7018c2ecf20Sopenharmony_ci 24, 3, /* mux */ 7028c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7038c2ecf20Sopenharmony_ci 0); 7048c2ecf20Sopenharmony_ci 7058c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ledc_clk, "bus-ledc", "ahb3", 0xbfc, BIT(0), 0); 7068c2ecf20Sopenharmony_ci 7078c2ecf20Sopenharmony_cistatic const char * const csi_top_parents[] = { "pll-periph0-2x", 7088c2ecf20Sopenharmony_ci "pll-video0-2x", 7098c2ecf20Sopenharmony_ci "pll-video1-2x", 7108c2ecf20Sopenharmony_ci "pll-video2-2x", 7118c2ecf20Sopenharmony_ci "pll-video3-2x" }; 7128c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi_top_clk, "csi-top", 7138c2ecf20Sopenharmony_ci csi_top_parents, 0xc04, 7148c2ecf20Sopenharmony_ci 0, 4, /* M */ 7158c2ecf20Sopenharmony_ci 24, 3, /* mux */ 7168c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7178c2ecf20Sopenharmony_ci 0); 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_cistatic const char * const csi0_mclk_parents[] = { "dcxo24M", "pll-video2", 7208c2ecf20Sopenharmony_ci "pll-video3", "pll-video0", 7218c2ecf20Sopenharmony_ci "pll-video1" }; 7228c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi0_mclk_clk, "csi0-mclk", 7238c2ecf20Sopenharmony_ci csi0_mclk_parents, 0xc08, 7248c2ecf20Sopenharmony_ci 0, 5, /* M */ 7258c2ecf20Sopenharmony_ci 24, 3, /* mux */ 7268c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7278c2ecf20Sopenharmony_ci 0); 7288c2ecf20Sopenharmony_ci 7298c2ecf20Sopenharmony_cistatic const char * const csi1_mclk_parents[] = { "dcxo24M", "pll-video3", 7308c2ecf20Sopenharmony_ci "pll-video0", "pll-video1", 7318c2ecf20Sopenharmony_ci "pll-video2" }; 7328c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi1_mclk_clk, "csi1-mclk", 7338c2ecf20Sopenharmony_ci csi1_mclk_parents, 0xc0c, 7348c2ecf20Sopenharmony_ci 0, 5, /* M */ 7358c2ecf20Sopenharmony_ci 24, 3, /* mux */ 7368c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7378c2ecf20Sopenharmony_ci 0); 7388c2ecf20Sopenharmony_ci 7398c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_csi_clk, "bus-csi", "ahb3", 0xc1c, BIT(0), 0); 7408c2ecf20Sopenharmony_ci 7418c2ecf20Sopenharmony_cistatic const char * const csi_isp_parents[] = { "pll-periph0-2x", 7428c2ecf20Sopenharmony_ci "pll-video0-2x", 7438c2ecf20Sopenharmony_ci "pll-video1-2x", 7448c2ecf20Sopenharmony_ci "pll-video2-2x", 7458c2ecf20Sopenharmony_ci "pll-video3-2x" }; 7468c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi_isp_clk, "csi-isp", 7478c2ecf20Sopenharmony_ci csi_isp_parents, 0xc20, 7488c2ecf20Sopenharmony_ci 0, 5, /* M */ 7498c2ecf20Sopenharmony_ci 24, 3, /* mux */ 7508c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7518c2ecf20Sopenharmony_ci 0); 7528c2ecf20Sopenharmony_ci 7538c2ecf20Sopenharmony_ci/* Fixed factor clocks */ 7548c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_FW_NAME(osc12M_clk, "osc12M", "hosc", 2, 1, 0); 7558c2ecf20Sopenharmony_ci 7568c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_com_audio_clk, "pll-com-audio", 7578c2ecf20Sopenharmony_ci &pll_com_clk.common.hw, 7588c2ecf20Sopenharmony_ci 5, 1, CLK_SET_RATE_PARENT); 7598c2ecf20Sopenharmony_ci 7608c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_periph0_2x_clk, "pll-periph0-2x", 7618c2ecf20Sopenharmony_ci &pll_periph0_clk.common.hw, 7628c2ecf20Sopenharmony_ci 1, 2, 0); 7638c2ecf20Sopenharmony_ci 7648c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_periph1_2x_clk, "pll-periph1-2x", 7658c2ecf20Sopenharmony_ci &pll_periph1_clk.common.hw, 7668c2ecf20Sopenharmony_ci 1, 2, 0); 7678c2ecf20Sopenharmony_ci 7688c2ecf20Sopenharmony_cistatic const struct clk_hw *pll_video0_parents[] = { 7698c2ecf20Sopenharmony_ci &pll_video0_clk.common.hw 7708c2ecf20Sopenharmony_ci}; 7718c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_video0_4x_clk, "pll-video0-4x", 7728c2ecf20Sopenharmony_ci pll_video0_parents, 7738c2ecf20Sopenharmony_ci 1, 4, CLK_SET_RATE_PARENT); 7748c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_video0_2x_clk, "pll-video0-2x", 7758c2ecf20Sopenharmony_ci pll_video0_parents, 7768c2ecf20Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 7778c2ecf20Sopenharmony_ci 7788c2ecf20Sopenharmony_cistatic const struct clk_hw *pll_video1_parents[] = { 7798c2ecf20Sopenharmony_ci &pll_video1_clk.common.hw 7808c2ecf20Sopenharmony_ci}; 7818c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_video1_4x_clk, "pll-video1-4x", 7828c2ecf20Sopenharmony_ci pll_video1_parents, 7838c2ecf20Sopenharmony_ci 1, 4, CLK_SET_RATE_PARENT); 7848c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_video1_2x_clk, "pll-video1-2x", 7858c2ecf20Sopenharmony_ci pll_video1_parents, 7868c2ecf20Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 7878c2ecf20Sopenharmony_ci 7888c2ecf20Sopenharmony_cistatic const struct clk_hw *pll_video2_parents[] = { 7898c2ecf20Sopenharmony_ci &pll_video2_clk.common.hw 7908c2ecf20Sopenharmony_ci}; 7918c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_video2_4x_clk, "pll-video2-4x", 7928c2ecf20Sopenharmony_ci pll_video2_parents, 7938c2ecf20Sopenharmony_ci 1, 4, CLK_SET_RATE_PARENT); 7948c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_video2_2x_clk, "pll-video2-2x", 7958c2ecf20Sopenharmony_ci pll_video2_parents, 7968c2ecf20Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 7978c2ecf20Sopenharmony_ci 7988c2ecf20Sopenharmony_cistatic const struct clk_hw *pll_video3_parents[] = { 7998c2ecf20Sopenharmony_ci &pll_video3_clk.common.hw 8008c2ecf20Sopenharmony_ci}; 8018c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_video3_4x_clk, "pll-video3-4x", 8028c2ecf20Sopenharmony_ci pll_video3_parents, 8038c2ecf20Sopenharmony_ci 1, 4, CLK_SET_RATE_PARENT); 8048c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_video3_2x_clk, "pll-video3-2x", 8058c2ecf20Sopenharmony_ci pll_video3_parents, 8068c2ecf20Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 8078c2ecf20Sopenharmony_ci 8088c2ecf20Sopenharmony_cistatic struct ccu_common *sun50i_a100_ccu_clks[] = { 8098c2ecf20Sopenharmony_ci &pll_cpux_clk.common, 8108c2ecf20Sopenharmony_ci &pll_ddr0_clk.common, 8118c2ecf20Sopenharmony_ci &pll_periph0_clk.common, 8128c2ecf20Sopenharmony_ci &pll_periph1_clk.common, 8138c2ecf20Sopenharmony_ci &pll_gpu_clk.common, 8148c2ecf20Sopenharmony_ci &pll_video0_clk.common, 8158c2ecf20Sopenharmony_ci &pll_video1_clk.common, 8168c2ecf20Sopenharmony_ci &pll_video2_clk.common, 8178c2ecf20Sopenharmony_ci &pll_video3_clk.common, 8188c2ecf20Sopenharmony_ci &pll_ve_clk.common, 8198c2ecf20Sopenharmony_ci &pll_com_clk.common, 8208c2ecf20Sopenharmony_ci &pll_audio_clk.common, 8218c2ecf20Sopenharmony_ci &cpux_clk.common, 8228c2ecf20Sopenharmony_ci &axi_clk.common, 8238c2ecf20Sopenharmony_ci &cpux_apb_clk.common, 8248c2ecf20Sopenharmony_ci &psi_ahb1_ahb2_clk.common, 8258c2ecf20Sopenharmony_ci &ahb3_clk.common, 8268c2ecf20Sopenharmony_ci &apb1_clk.common, 8278c2ecf20Sopenharmony_ci &apb2_clk.common, 8288c2ecf20Sopenharmony_ci &mbus_clk.common, 8298c2ecf20Sopenharmony_ci &de_clk.common, 8308c2ecf20Sopenharmony_ci &bus_de_clk.common, 8318c2ecf20Sopenharmony_ci &g2d_clk.common, 8328c2ecf20Sopenharmony_ci &bus_g2d_clk.common, 8338c2ecf20Sopenharmony_ci &gpu_clk.common, 8348c2ecf20Sopenharmony_ci &bus_gpu_clk.common, 8358c2ecf20Sopenharmony_ci &ce_clk.common, 8368c2ecf20Sopenharmony_ci &bus_ce_clk.common, 8378c2ecf20Sopenharmony_ci &ve_clk.common, 8388c2ecf20Sopenharmony_ci &bus_ve_clk.common, 8398c2ecf20Sopenharmony_ci &bus_dma_clk.common, 8408c2ecf20Sopenharmony_ci &bus_msgbox_clk.common, 8418c2ecf20Sopenharmony_ci &bus_spinlock_clk.common, 8428c2ecf20Sopenharmony_ci &bus_hstimer_clk.common, 8438c2ecf20Sopenharmony_ci &avs_clk.common, 8448c2ecf20Sopenharmony_ci &bus_dbg_clk.common, 8458c2ecf20Sopenharmony_ci &bus_psi_clk.common, 8468c2ecf20Sopenharmony_ci &bus_pwm_clk.common, 8478c2ecf20Sopenharmony_ci &bus_iommu_clk.common, 8488c2ecf20Sopenharmony_ci &mbus_dma_clk.common, 8498c2ecf20Sopenharmony_ci &mbus_ve_clk.common, 8508c2ecf20Sopenharmony_ci &mbus_ce_clk.common, 8518c2ecf20Sopenharmony_ci &mbus_nand_clk.common, 8528c2ecf20Sopenharmony_ci &mbus_csi_clk.common, 8538c2ecf20Sopenharmony_ci &mbus_isp_clk.common, 8548c2ecf20Sopenharmony_ci &mbus_g2d_clk.common, 8558c2ecf20Sopenharmony_ci &bus_dram_clk.common, 8568c2ecf20Sopenharmony_ci &nand0_clk.common, 8578c2ecf20Sopenharmony_ci &nand1_clk.common, 8588c2ecf20Sopenharmony_ci &bus_nand_clk.common, 8598c2ecf20Sopenharmony_ci &mmc0_clk.common, 8608c2ecf20Sopenharmony_ci &mmc1_clk.common, 8618c2ecf20Sopenharmony_ci &mmc2_clk.common, 8628c2ecf20Sopenharmony_ci &bus_mmc0_clk.common, 8638c2ecf20Sopenharmony_ci &bus_mmc1_clk.common, 8648c2ecf20Sopenharmony_ci &bus_mmc2_clk.common, 8658c2ecf20Sopenharmony_ci &bus_uart0_clk.common, 8668c2ecf20Sopenharmony_ci &bus_uart1_clk.common, 8678c2ecf20Sopenharmony_ci &bus_uart2_clk.common, 8688c2ecf20Sopenharmony_ci &bus_uart3_clk.common, 8698c2ecf20Sopenharmony_ci &bus_uart4_clk.common, 8708c2ecf20Sopenharmony_ci &bus_i2c0_clk.common, 8718c2ecf20Sopenharmony_ci &bus_i2c1_clk.common, 8728c2ecf20Sopenharmony_ci &bus_i2c2_clk.common, 8738c2ecf20Sopenharmony_ci &bus_i2c3_clk.common, 8748c2ecf20Sopenharmony_ci &spi0_clk.common, 8758c2ecf20Sopenharmony_ci &spi1_clk.common, 8768c2ecf20Sopenharmony_ci &spi2_clk.common, 8778c2ecf20Sopenharmony_ci &bus_spi0_clk.common, 8788c2ecf20Sopenharmony_ci &bus_spi1_clk.common, 8798c2ecf20Sopenharmony_ci &bus_spi2_clk.common, 8808c2ecf20Sopenharmony_ci &emac_25m_clk.common, 8818c2ecf20Sopenharmony_ci &bus_emac_clk.common, 8828c2ecf20Sopenharmony_ci &ir_rx_clk.common, 8838c2ecf20Sopenharmony_ci &bus_ir_rx_clk.common, 8848c2ecf20Sopenharmony_ci &ir_tx_clk.common, 8858c2ecf20Sopenharmony_ci &bus_ir_tx_clk.common, 8868c2ecf20Sopenharmony_ci &bus_gpadc_clk.common, 8878c2ecf20Sopenharmony_ci &bus_ths_clk.common, 8888c2ecf20Sopenharmony_ci &i2s0_clk.common, 8898c2ecf20Sopenharmony_ci &i2s1_clk.common, 8908c2ecf20Sopenharmony_ci &i2s2_clk.common, 8918c2ecf20Sopenharmony_ci &i2s3_clk.common, 8928c2ecf20Sopenharmony_ci &bus_i2s0_clk.common, 8938c2ecf20Sopenharmony_ci &bus_i2s1_clk.common, 8948c2ecf20Sopenharmony_ci &bus_i2s2_clk.common, 8958c2ecf20Sopenharmony_ci &bus_i2s3_clk.common, 8968c2ecf20Sopenharmony_ci &spdif_clk.common, 8978c2ecf20Sopenharmony_ci &bus_spdif_clk.common, 8988c2ecf20Sopenharmony_ci &dmic_clk.common, 8998c2ecf20Sopenharmony_ci &bus_dmic_clk.common, 9008c2ecf20Sopenharmony_ci &audio_codec_dac_clk.common, 9018c2ecf20Sopenharmony_ci &audio_codec_adc_clk.common, 9028c2ecf20Sopenharmony_ci &audio_codec_4x_clk.common, 9038c2ecf20Sopenharmony_ci &bus_audio_codec_clk.common, 9048c2ecf20Sopenharmony_ci &usb_ohci0_clk.common, 9058c2ecf20Sopenharmony_ci &usb_phy0_clk.common, 9068c2ecf20Sopenharmony_ci &usb_ohci1_clk.common, 9078c2ecf20Sopenharmony_ci &usb_phy1_clk.common, 9088c2ecf20Sopenharmony_ci &bus_ohci0_clk.common, 9098c2ecf20Sopenharmony_ci &bus_ohci1_clk.common, 9108c2ecf20Sopenharmony_ci &bus_ehci0_clk.common, 9118c2ecf20Sopenharmony_ci &bus_ehci1_clk.common, 9128c2ecf20Sopenharmony_ci &bus_otg_clk.common, 9138c2ecf20Sopenharmony_ci &bus_lradc_clk.common, 9148c2ecf20Sopenharmony_ci &bus_dpss_top0_clk.common, 9158c2ecf20Sopenharmony_ci &bus_dpss_top1_clk.common, 9168c2ecf20Sopenharmony_ci &mipi_dsi_clk.common, 9178c2ecf20Sopenharmony_ci &bus_mipi_dsi_clk.common, 9188c2ecf20Sopenharmony_ci &tcon_lcd_clk.common, 9198c2ecf20Sopenharmony_ci &bus_tcon_lcd_clk.common, 9208c2ecf20Sopenharmony_ci &ledc_clk.common, 9218c2ecf20Sopenharmony_ci &bus_ledc_clk.common, 9228c2ecf20Sopenharmony_ci &csi_top_clk.common, 9238c2ecf20Sopenharmony_ci &csi0_mclk_clk.common, 9248c2ecf20Sopenharmony_ci &csi1_mclk_clk.common, 9258c2ecf20Sopenharmony_ci &bus_csi_clk.common, 9268c2ecf20Sopenharmony_ci &csi_isp_clk.common, 9278c2ecf20Sopenharmony_ci}; 9288c2ecf20Sopenharmony_ci 9298c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun50i_a100_hw_clks = { 9308c2ecf20Sopenharmony_ci .hws = { 9318c2ecf20Sopenharmony_ci [CLK_OSC12M] = &osc12M_clk.hw, 9328c2ecf20Sopenharmony_ci [CLK_PLL_CPUX] = &pll_cpux_clk.common.hw, 9338c2ecf20Sopenharmony_ci [CLK_PLL_DDR0] = &pll_ddr0_clk.common.hw, 9348c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw, 9358c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw, 9368c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw, 9378c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH1_2X] = &pll_periph1_2x_clk.hw, 9388c2ecf20Sopenharmony_ci [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 9398c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 9408c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0_2X] = &pll_video0_2x_clk.hw, 9418c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0_4X] = &pll_video0_4x_clk.hw, 9428c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 9438c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1_2X] = &pll_video1_2x_clk.hw, 9448c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1_4X] = &pll_video1_4x_clk.hw, 9458c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO2] = &pll_video2_clk.common.hw, 9468c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO2_2X] = &pll_video2_2x_clk.hw, 9478c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO2_4X] = &pll_video2_4x_clk.hw, 9488c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO3] = &pll_video3_clk.common.hw, 9498c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO3_2X] = &pll_video3_2x_clk.hw, 9508c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO3_4X] = &pll_video3_4x_clk.hw, 9518c2ecf20Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 9528c2ecf20Sopenharmony_ci [CLK_PLL_COM] = &pll_com_clk.common.hw, 9538c2ecf20Sopenharmony_ci [CLK_PLL_COM_AUDIO] = &pll_com_audio_clk.hw, 9548c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.common.hw, 9558c2ecf20Sopenharmony_ci [CLK_CPUX] = &cpux_clk.common.hw, 9568c2ecf20Sopenharmony_ci [CLK_AXI] = &axi_clk.common.hw, 9578c2ecf20Sopenharmony_ci [CLK_CPUX_APB] = &cpux_apb_clk.common.hw, 9588c2ecf20Sopenharmony_ci [CLK_PSI_AHB1_AHB2] = &psi_ahb1_ahb2_clk.common.hw, 9598c2ecf20Sopenharmony_ci [CLK_AHB3] = &ahb3_clk.common.hw, 9608c2ecf20Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 9618c2ecf20Sopenharmony_ci [CLK_APB2] = &apb2_clk.common.hw, 9628c2ecf20Sopenharmony_ci [CLK_MBUS] = &mbus_clk.common.hw, 9638c2ecf20Sopenharmony_ci [CLK_DE] = &de_clk.common.hw, 9648c2ecf20Sopenharmony_ci [CLK_BUS_DE] = &bus_de_clk.common.hw, 9658c2ecf20Sopenharmony_ci [CLK_G2D] = &g2d_clk.common.hw, 9668c2ecf20Sopenharmony_ci [CLK_BUS_G2D] = &bus_g2d_clk.common.hw, 9678c2ecf20Sopenharmony_ci [CLK_GPU] = &gpu_clk.common.hw, 9688c2ecf20Sopenharmony_ci [CLK_BUS_GPU] = &bus_gpu_clk.common.hw, 9698c2ecf20Sopenharmony_ci [CLK_CE] = &ce_clk.common.hw, 9708c2ecf20Sopenharmony_ci [CLK_BUS_CE] = &bus_ce_clk.common.hw, 9718c2ecf20Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 9728c2ecf20Sopenharmony_ci [CLK_BUS_VE] = &bus_ve_clk.common.hw, 9738c2ecf20Sopenharmony_ci [CLK_BUS_DMA] = &bus_dma_clk.common.hw, 9748c2ecf20Sopenharmony_ci [CLK_BUS_MSGBOX] = &bus_msgbox_clk.common.hw, 9758c2ecf20Sopenharmony_ci [CLK_BUS_SPINLOCK] = &bus_spinlock_clk.common.hw, 9768c2ecf20Sopenharmony_ci [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw, 9778c2ecf20Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 9788c2ecf20Sopenharmony_ci [CLK_BUS_DBG] = &bus_dbg_clk.common.hw, 9798c2ecf20Sopenharmony_ci [CLK_BUS_PSI] = &bus_psi_clk.common.hw, 9808c2ecf20Sopenharmony_ci [CLK_BUS_PWM] = &bus_pwm_clk.common.hw, 9818c2ecf20Sopenharmony_ci [CLK_BUS_IOMMU] = &bus_iommu_clk.common.hw, 9828c2ecf20Sopenharmony_ci [CLK_MBUS_DMA] = &mbus_dma_clk.common.hw, 9838c2ecf20Sopenharmony_ci [CLK_MBUS_VE] = &mbus_ve_clk.common.hw, 9848c2ecf20Sopenharmony_ci [CLK_MBUS_CE] = &mbus_ce_clk.common.hw, 9858c2ecf20Sopenharmony_ci [CLK_MBUS_NAND] = &mbus_nand_clk.common.hw, 9868c2ecf20Sopenharmony_ci [CLK_MBUS_CSI] = &mbus_csi_clk.common.hw, 9878c2ecf20Sopenharmony_ci [CLK_MBUS_ISP] = &mbus_isp_clk.common.hw, 9888c2ecf20Sopenharmony_ci [CLK_MBUS_G2D] = &mbus_g2d_clk.common.hw, 9898c2ecf20Sopenharmony_ci [CLK_BUS_DRAM] = &bus_dram_clk.common.hw, 9908c2ecf20Sopenharmony_ci [CLK_NAND0] = &nand0_clk.common.hw, 9918c2ecf20Sopenharmony_ci [CLK_NAND1] = &nand1_clk.common.hw, 9928c2ecf20Sopenharmony_ci [CLK_BUS_NAND] = &bus_nand_clk.common.hw, 9938c2ecf20Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 9948c2ecf20Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 9958c2ecf20Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 9968c2ecf20Sopenharmony_ci [CLK_BUS_MMC0] = &bus_mmc0_clk.common.hw, 9978c2ecf20Sopenharmony_ci [CLK_BUS_MMC1] = &bus_mmc1_clk.common.hw, 9988c2ecf20Sopenharmony_ci [CLK_BUS_MMC2] = &bus_mmc2_clk.common.hw, 9998c2ecf20Sopenharmony_ci [CLK_BUS_UART0] = &bus_uart0_clk.common.hw, 10008c2ecf20Sopenharmony_ci [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 10018c2ecf20Sopenharmony_ci [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 10028c2ecf20Sopenharmony_ci [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 10038c2ecf20Sopenharmony_ci [CLK_BUS_UART4] = &bus_uart4_clk.common.hw, 10048c2ecf20Sopenharmony_ci [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw, 10058c2ecf20Sopenharmony_ci [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw, 10068c2ecf20Sopenharmony_ci [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw, 10078c2ecf20Sopenharmony_ci [CLK_BUS_I2C3] = &bus_i2c3_clk.common.hw, 10088c2ecf20Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 10098c2ecf20Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 10108c2ecf20Sopenharmony_ci [CLK_SPI2] = &spi2_clk.common.hw, 10118c2ecf20Sopenharmony_ci [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw, 10128c2ecf20Sopenharmony_ci [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw, 10138c2ecf20Sopenharmony_ci [CLK_BUS_SPI2] = &bus_spi2_clk.common.hw, 10148c2ecf20Sopenharmony_ci [CLK_EMAC_25M] = &emac_25m_clk.common.hw, 10158c2ecf20Sopenharmony_ci [CLK_BUS_EMAC] = &bus_emac_clk.common.hw, 10168c2ecf20Sopenharmony_ci [CLK_IR_RX] = &ir_rx_clk.common.hw, 10178c2ecf20Sopenharmony_ci [CLK_BUS_IR_RX] = &bus_ir_rx_clk.common.hw, 10188c2ecf20Sopenharmony_ci [CLK_IR_TX] = &ir_tx_clk.common.hw, 10198c2ecf20Sopenharmony_ci [CLK_BUS_IR_TX] = &bus_ir_tx_clk.common.hw, 10208c2ecf20Sopenharmony_ci [CLK_BUS_GPADC] = &bus_gpadc_clk.common.hw, 10218c2ecf20Sopenharmony_ci [CLK_BUS_THS] = &bus_ths_clk.common.hw, 10228c2ecf20Sopenharmony_ci [CLK_I2S0] = &i2s0_clk.common.hw, 10238c2ecf20Sopenharmony_ci [CLK_I2S1] = &i2s1_clk.common.hw, 10248c2ecf20Sopenharmony_ci [CLK_I2S2] = &i2s2_clk.common.hw, 10258c2ecf20Sopenharmony_ci [CLK_I2S3] = &i2s3_clk.common.hw, 10268c2ecf20Sopenharmony_ci [CLK_BUS_I2S0] = &bus_i2s0_clk.common.hw, 10278c2ecf20Sopenharmony_ci [CLK_BUS_I2S1] = &bus_i2s1_clk.common.hw, 10288c2ecf20Sopenharmony_ci [CLK_BUS_I2S2] = &bus_i2s2_clk.common.hw, 10298c2ecf20Sopenharmony_ci [CLK_BUS_I2S3] = &bus_i2s3_clk.common.hw, 10308c2ecf20Sopenharmony_ci [CLK_SPDIF] = &spdif_clk.common.hw, 10318c2ecf20Sopenharmony_ci [CLK_BUS_SPDIF] = &bus_spdif_clk.common.hw, 10328c2ecf20Sopenharmony_ci [CLK_DMIC] = &dmic_clk.common.hw, 10338c2ecf20Sopenharmony_ci [CLK_BUS_DMIC] = &bus_dmic_clk.common.hw, 10348c2ecf20Sopenharmony_ci [CLK_AUDIO_DAC] = &audio_codec_dac_clk.common.hw, 10358c2ecf20Sopenharmony_ci [CLK_AUDIO_ADC] = &audio_codec_adc_clk.common.hw, 10368c2ecf20Sopenharmony_ci [CLK_AUDIO_4X] = &audio_codec_4x_clk.common.hw, 10378c2ecf20Sopenharmony_ci [CLK_BUS_AUDIO_CODEC] = &bus_audio_codec_clk.common.hw, 10388c2ecf20Sopenharmony_ci [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw, 10398c2ecf20Sopenharmony_ci [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 10408c2ecf20Sopenharmony_ci [CLK_USB_OHCI1] = &usb_ohci1_clk.common.hw, 10418c2ecf20Sopenharmony_ci [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 10428c2ecf20Sopenharmony_ci [CLK_BUS_OHCI0] = &bus_ohci0_clk.common.hw, 10438c2ecf20Sopenharmony_ci [CLK_BUS_OHCI1] = &bus_ohci1_clk.common.hw, 10448c2ecf20Sopenharmony_ci [CLK_BUS_EHCI0] = &bus_ehci0_clk.common.hw, 10458c2ecf20Sopenharmony_ci [CLK_BUS_EHCI1] = &bus_ehci1_clk.common.hw, 10468c2ecf20Sopenharmony_ci [CLK_BUS_OTG] = &bus_otg_clk.common.hw, 10478c2ecf20Sopenharmony_ci [CLK_BUS_LRADC] = &bus_lradc_clk.common.hw, 10488c2ecf20Sopenharmony_ci [CLK_BUS_DPSS_TOP0] = &bus_dpss_top0_clk.common.hw, 10498c2ecf20Sopenharmony_ci [CLK_BUS_DPSS_TOP1] = &bus_dpss_top1_clk.common.hw, 10508c2ecf20Sopenharmony_ci [CLK_MIPI_DSI] = &mipi_dsi_clk.common.hw, 10518c2ecf20Sopenharmony_ci [CLK_BUS_MIPI_DSI] = &bus_mipi_dsi_clk.common.hw, 10528c2ecf20Sopenharmony_ci [CLK_TCON_LCD] = &tcon_lcd_clk.common.hw, 10538c2ecf20Sopenharmony_ci [CLK_BUS_TCON_LCD] = &bus_tcon_lcd_clk.common.hw, 10548c2ecf20Sopenharmony_ci [CLK_LEDC] = &ledc_clk.common.hw, 10558c2ecf20Sopenharmony_ci [CLK_BUS_LEDC] = &bus_ledc_clk.common.hw, 10568c2ecf20Sopenharmony_ci [CLK_CSI_TOP] = &csi_top_clk.common.hw, 10578c2ecf20Sopenharmony_ci [CLK_CSI0_MCLK] = &csi0_mclk_clk.common.hw, 10588c2ecf20Sopenharmony_ci [CLK_CSI1_MCLK] = &csi1_mclk_clk.common.hw, 10598c2ecf20Sopenharmony_ci [CLK_BUS_CSI] = &bus_csi_clk.common.hw, 10608c2ecf20Sopenharmony_ci [CLK_CSI_ISP] = &csi_isp_clk.common.hw, 10618c2ecf20Sopenharmony_ci }, 10628c2ecf20Sopenharmony_ci .num = CLK_NUMBER, 10638c2ecf20Sopenharmony_ci}; 10648c2ecf20Sopenharmony_ci 10658c2ecf20Sopenharmony_cistatic struct ccu_reset_map sun50i_a100_ccu_resets[] = { 10668c2ecf20Sopenharmony_ci [RST_MBUS] = { 0x540, BIT(30) }, 10678c2ecf20Sopenharmony_ci 10688c2ecf20Sopenharmony_ci [RST_BUS_DE] = { 0x60c, BIT(16) }, 10698c2ecf20Sopenharmony_ci [RST_BUS_G2D] = { 0x63c, BIT(16) }, 10708c2ecf20Sopenharmony_ci [RST_BUS_GPU] = { 0x67c, BIT(16) }, 10718c2ecf20Sopenharmony_ci [RST_BUS_CE] = { 0x68c, BIT(16) }, 10728c2ecf20Sopenharmony_ci [RST_BUS_VE] = { 0x69c, BIT(16) }, 10738c2ecf20Sopenharmony_ci [RST_BUS_DMA] = { 0x70c, BIT(16) }, 10748c2ecf20Sopenharmony_ci [RST_BUS_MSGBOX] = { 0x71c, BIT(16) }, 10758c2ecf20Sopenharmony_ci [RST_BUS_SPINLOCK] = { 0x72c, BIT(16) }, 10768c2ecf20Sopenharmony_ci [RST_BUS_HSTIMER] = { 0x73c, BIT(16) }, 10778c2ecf20Sopenharmony_ci [RST_BUS_DBG] = { 0x78c, BIT(16) }, 10788c2ecf20Sopenharmony_ci [RST_BUS_PSI] = { 0x79c, BIT(16) }, 10798c2ecf20Sopenharmony_ci [RST_BUS_PWM] = { 0x7ac, BIT(16) }, 10808c2ecf20Sopenharmony_ci [RST_BUS_DRAM] = { 0x80c, BIT(16) }, 10818c2ecf20Sopenharmony_ci [RST_BUS_NAND] = { 0x82c, BIT(16) }, 10828c2ecf20Sopenharmony_ci [RST_BUS_MMC0] = { 0x84c, BIT(16) }, 10838c2ecf20Sopenharmony_ci [RST_BUS_MMC1] = { 0x84c, BIT(17) }, 10848c2ecf20Sopenharmony_ci [RST_BUS_MMC2] = { 0x84c, BIT(18) }, 10858c2ecf20Sopenharmony_ci [RST_BUS_UART0] = { 0x90c, BIT(16) }, 10868c2ecf20Sopenharmony_ci [RST_BUS_UART1] = { 0x90c, BIT(17) }, 10878c2ecf20Sopenharmony_ci [RST_BUS_UART2] = { 0x90c, BIT(18) }, 10888c2ecf20Sopenharmony_ci [RST_BUS_UART3] = { 0x90c, BIT(19) }, 10898c2ecf20Sopenharmony_ci [RST_BUS_UART4] = { 0x90c, BIT(20) }, 10908c2ecf20Sopenharmony_ci [RST_BUS_I2C0] = { 0x91c, BIT(16) }, 10918c2ecf20Sopenharmony_ci [RST_BUS_I2C1] = { 0x91c, BIT(17) }, 10928c2ecf20Sopenharmony_ci [RST_BUS_I2C2] = { 0x91c, BIT(18) }, 10938c2ecf20Sopenharmony_ci [RST_BUS_I2C3] = { 0x91c, BIT(19) }, 10948c2ecf20Sopenharmony_ci [RST_BUS_SPI0] = { 0x96c, BIT(16) }, 10958c2ecf20Sopenharmony_ci [RST_BUS_SPI1] = { 0x96c, BIT(17) }, 10968c2ecf20Sopenharmony_ci [RST_BUS_SPI2] = { 0x96c, BIT(18) }, 10978c2ecf20Sopenharmony_ci [RST_BUS_EMAC] = { 0x97c, BIT(16) }, 10988c2ecf20Sopenharmony_ci [RST_BUS_IR_RX] = { 0x99c, BIT(16) }, 10998c2ecf20Sopenharmony_ci [RST_BUS_IR_TX] = { 0x9cc, BIT(16) }, 11008c2ecf20Sopenharmony_ci [RST_BUS_GPADC] = { 0x9ec, BIT(16) }, 11018c2ecf20Sopenharmony_ci [RST_BUS_THS] = { 0x9fc, BIT(16) }, 11028c2ecf20Sopenharmony_ci [RST_BUS_I2S0] = { 0xa20, BIT(16) }, 11038c2ecf20Sopenharmony_ci [RST_BUS_I2S1] = { 0xa20, BIT(17) }, 11048c2ecf20Sopenharmony_ci [RST_BUS_I2S2] = { 0xa20, BIT(18) }, 11058c2ecf20Sopenharmony_ci [RST_BUS_I2S3] = { 0xa20, BIT(19) }, 11068c2ecf20Sopenharmony_ci [RST_BUS_SPDIF] = { 0xa2c, BIT(16) }, 11078c2ecf20Sopenharmony_ci [RST_BUS_DMIC] = { 0xa4c, BIT(16) }, 11088c2ecf20Sopenharmony_ci [RST_BUS_AUDIO_CODEC] = { 0xa5c, BIT(16) }, 11098c2ecf20Sopenharmony_ci 11108c2ecf20Sopenharmony_ci [RST_USB_PHY0] = { 0xa70, BIT(30) }, 11118c2ecf20Sopenharmony_ci [RST_USB_PHY1] = { 0xa74, BIT(30) }, 11128c2ecf20Sopenharmony_ci 11138c2ecf20Sopenharmony_ci [RST_BUS_OHCI0] = { 0xa8c, BIT(16) }, 11148c2ecf20Sopenharmony_ci [RST_BUS_OHCI1] = { 0xa8c, BIT(17) }, 11158c2ecf20Sopenharmony_ci [RST_BUS_EHCI0] = { 0xa8c, BIT(20) }, 11168c2ecf20Sopenharmony_ci [RST_BUS_EHCI1] = { 0xa8c, BIT(21) }, 11178c2ecf20Sopenharmony_ci [RST_BUS_OTG] = { 0xa8c, BIT(24) }, 11188c2ecf20Sopenharmony_ci 11198c2ecf20Sopenharmony_ci [RST_BUS_LRADC] = { 0xa9c, BIT(16) }, 11208c2ecf20Sopenharmony_ci [RST_BUS_DPSS_TOP0] = { 0xabc, BIT(16) }, 11218c2ecf20Sopenharmony_ci [RST_BUS_DPSS_TOP1] = { 0xacc, BIT(16) }, 11228c2ecf20Sopenharmony_ci [RST_BUS_MIPI_DSI] = { 0xb4c, BIT(16) }, 11238c2ecf20Sopenharmony_ci [RST_BUS_TCON_LCD] = { 0xb7c, BIT(16) }, 11248c2ecf20Sopenharmony_ci [RST_BUS_LVDS] = { 0xbac, BIT(16) }, 11258c2ecf20Sopenharmony_ci [RST_BUS_LEDC] = { 0xbfc, BIT(16) }, 11268c2ecf20Sopenharmony_ci [RST_BUS_CSI] = { 0xc1c, BIT(16) }, 11278c2ecf20Sopenharmony_ci [RST_BUS_CSI_ISP] = { 0xc2c, BIT(16) }, 11288c2ecf20Sopenharmony_ci}; 11298c2ecf20Sopenharmony_ci 11308c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun50i_a100_ccu_desc = { 11318c2ecf20Sopenharmony_ci .ccu_clks = sun50i_a100_ccu_clks, 11328c2ecf20Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun50i_a100_ccu_clks), 11338c2ecf20Sopenharmony_ci 11348c2ecf20Sopenharmony_ci .hw_clks = &sun50i_a100_hw_clks, 11358c2ecf20Sopenharmony_ci 11368c2ecf20Sopenharmony_ci .resets = sun50i_a100_ccu_resets, 11378c2ecf20Sopenharmony_ci .num_resets = ARRAY_SIZE(sun50i_a100_ccu_resets), 11388c2ecf20Sopenharmony_ci}; 11398c2ecf20Sopenharmony_ci 11408c2ecf20Sopenharmony_cistatic const u32 sun50i_a100_pll_regs[] = { 11418c2ecf20Sopenharmony_ci SUN50I_A100_PLL_CPUX_REG, 11428c2ecf20Sopenharmony_ci SUN50I_A100_PLL_DDR0_REG, 11438c2ecf20Sopenharmony_ci SUN50I_A100_PLL_PERIPH0_REG, 11448c2ecf20Sopenharmony_ci SUN50I_A100_PLL_PERIPH1_REG, 11458c2ecf20Sopenharmony_ci SUN50I_A100_PLL_GPU_REG, 11468c2ecf20Sopenharmony_ci SUN50I_A100_PLL_VIDEO0_REG, 11478c2ecf20Sopenharmony_ci SUN50I_A100_PLL_VIDEO1_REG, 11488c2ecf20Sopenharmony_ci SUN50I_A100_PLL_VIDEO2_REG, 11498c2ecf20Sopenharmony_ci SUN50I_A100_PLL_VIDEO3_REG, 11508c2ecf20Sopenharmony_ci SUN50I_A100_PLL_VE_REG, 11518c2ecf20Sopenharmony_ci SUN50I_A100_PLL_COM_REG, 11528c2ecf20Sopenharmony_ci SUN50I_A100_PLL_AUDIO_REG, 11538c2ecf20Sopenharmony_ci}; 11548c2ecf20Sopenharmony_ci 11558c2ecf20Sopenharmony_cistatic const u32 sun50i_a100_pll_video_regs[] = { 11568c2ecf20Sopenharmony_ci SUN50I_A100_PLL_VIDEO0_REG, 11578c2ecf20Sopenharmony_ci SUN50I_A100_PLL_VIDEO1_REG, 11588c2ecf20Sopenharmony_ci SUN50I_A100_PLL_VIDEO2_REG, 11598c2ecf20Sopenharmony_ci SUN50I_A100_PLL_VIDEO3_REG, 11608c2ecf20Sopenharmony_ci}; 11618c2ecf20Sopenharmony_ci 11628c2ecf20Sopenharmony_cistatic const u32 sun50i_a100_usb2_clk_regs[] = { 11638c2ecf20Sopenharmony_ci SUN50I_A100_USB0_CLK_REG, 11648c2ecf20Sopenharmony_ci SUN50I_A100_USB1_CLK_REG, 11658c2ecf20Sopenharmony_ci}; 11668c2ecf20Sopenharmony_ci 11678c2ecf20Sopenharmony_cistatic struct ccu_pll_nb sun50i_a100_pll_cpu_nb = { 11688c2ecf20Sopenharmony_ci .common = &pll_cpux_clk.common, 11698c2ecf20Sopenharmony_ci /* copy from pll_cpux_clk */ 11708c2ecf20Sopenharmony_ci .enable = BIT(27), 11718c2ecf20Sopenharmony_ci .lock = BIT(28), 11728c2ecf20Sopenharmony_ci}; 11738c2ecf20Sopenharmony_ci 11748c2ecf20Sopenharmony_cistatic struct ccu_mux_nb sun50i_a100_cpu_nb = { 11758c2ecf20Sopenharmony_ci .common = &cpux_clk.common, 11768c2ecf20Sopenharmony_ci .cm = &cpux_clk.mux, 11778c2ecf20Sopenharmony_ci .delay_us = 1, 11788c2ecf20Sopenharmony_ci .bypass_index = 4, /* index of pll periph0 */ 11798c2ecf20Sopenharmony_ci}; 11808c2ecf20Sopenharmony_ci 11818c2ecf20Sopenharmony_cistatic int sun50i_a100_ccu_probe(struct platform_device *pdev) 11828c2ecf20Sopenharmony_ci{ 11838c2ecf20Sopenharmony_ci void __iomem *reg; 11848c2ecf20Sopenharmony_ci u32 val; 11858c2ecf20Sopenharmony_ci int i, ret; 11868c2ecf20Sopenharmony_ci 11878c2ecf20Sopenharmony_ci reg = devm_platform_ioremap_resource(pdev, 0); 11888c2ecf20Sopenharmony_ci if (IS_ERR(reg)) 11898c2ecf20Sopenharmony_ci return PTR_ERR(reg); 11908c2ecf20Sopenharmony_ci 11918c2ecf20Sopenharmony_ci /* 11928c2ecf20Sopenharmony_ci * Enable lock and enable bits on all PLLs. 11938c2ecf20Sopenharmony_ci * 11948c2ecf20Sopenharmony_ci * Due to the current design, multiple PLLs share one power switch, 11958c2ecf20Sopenharmony_ci * so switching PLL is easy to cause stability problems. 11968c2ecf20Sopenharmony_ci * When initializing, we enable them by default. When disable, 11978c2ecf20Sopenharmony_ci * we only turn off the output of PLL. 11988c2ecf20Sopenharmony_ci */ 11998c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(sun50i_a100_pll_regs); i++) { 12008c2ecf20Sopenharmony_ci val = readl(reg + sun50i_a100_pll_regs[i]); 12018c2ecf20Sopenharmony_ci val |= SUN50I_A100_PLL_LOCK_ENABLE | SUN50I_A100_PLL_ENABLE; 12028c2ecf20Sopenharmony_ci writel(val, reg + sun50i_a100_pll_regs[i]); 12038c2ecf20Sopenharmony_ci } 12048c2ecf20Sopenharmony_ci 12058c2ecf20Sopenharmony_ci /* 12068c2ecf20Sopenharmony_ci * In order to pass the EMI certification, the SDM function of 12078c2ecf20Sopenharmony_ci * the peripheral 1 bus is enabled, and the frequency is still 12088c2ecf20Sopenharmony_ci * calculated using the previous division factor. 12098c2ecf20Sopenharmony_ci */ 12108c2ecf20Sopenharmony_ci writel(SUN50I_A100_PLL_PERIPH1_PATTERN0, 12118c2ecf20Sopenharmony_ci reg + SUN50I_A100_PLL_PERIPH1_PATTERN0_REG); 12128c2ecf20Sopenharmony_ci 12138c2ecf20Sopenharmony_ci val = readl(reg + SUN50I_A100_PLL_PERIPH1_REG); 12148c2ecf20Sopenharmony_ci val |= SUN50I_A100_PLL_SDM_ENABLE; 12158c2ecf20Sopenharmony_ci writel(val, reg + SUN50I_A100_PLL_PERIPH1_REG); 12168c2ecf20Sopenharmony_ci 12178c2ecf20Sopenharmony_ci /* 12188c2ecf20Sopenharmony_ci * Force the output divider of video PLLs to 0. 12198c2ecf20Sopenharmony_ci * 12208c2ecf20Sopenharmony_ci * See the comment before pll-video0 definition for the reason. 12218c2ecf20Sopenharmony_ci */ 12228c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(sun50i_a100_pll_video_regs); i++) { 12238c2ecf20Sopenharmony_ci val = readl(reg + sun50i_a100_pll_video_regs[i]); 12248c2ecf20Sopenharmony_ci val &= ~BIT(0); 12258c2ecf20Sopenharmony_ci writel(val, reg + sun50i_a100_pll_video_regs[i]); 12268c2ecf20Sopenharmony_ci } 12278c2ecf20Sopenharmony_ci 12288c2ecf20Sopenharmony_ci /* 12298c2ecf20Sopenharmony_ci * Enforce m1 = 0, m0 = 1 for Audio PLL 12308c2ecf20Sopenharmony_ci * 12318c2ecf20Sopenharmony_ci * See the comment before pll-audio definition for the reason. 12328c2ecf20Sopenharmony_ci */ 12338c2ecf20Sopenharmony_ci val = readl(reg + SUN50I_A100_PLL_AUDIO_REG); 12348c2ecf20Sopenharmony_ci val &= ~BIT(1); 12358c2ecf20Sopenharmony_ci val |= BIT(0); 12368c2ecf20Sopenharmony_ci writel(val, reg + SUN50I_A100_PLL_AUDIO_REG); 12378c2ecf20Sopenharmony_ci 12388c2ecf20Sopenharmony_ci /* 12398c2ecf20Sopenharmony_ci * Force OHCI 12M clock sources to 00 (12MHz divided from 48MHz) 12408c2ecf20Sopenharmony_ci * 12418c2ecf20Sopenharmony_ci * This clock mux is still mysterious, and the code just enforces 12428c2ecf20Sopenharmony_ci * it to have a valid clock parent. 12438c2ecf20Sopenharmony_ci */ 12448c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(sun50i_a100_usb2_clk_regs); i++) { 12458c2ecf20Sopenharmony_ci val = readl(reg + sun50i_a100_usb2_clk_regs[i]); 12468c2ecf20Sopenharmony_ci val &= ~GENMASK(25, 24); 12478c2ecf20Sopenharmony_ci writel(val, reg + sun50i_a100_usb2_clk_regs[i]); 12488c2ecf20Sopenharmony_ci } 12498c2ecf20Sopenharmony_ci 12508c2ecf20Sopenharmony_ci ret = sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a100_ccu_desc); 12518c2ecf20Sopenharmony_ci if (ret) 12528c2ecf20Sopenharmony_ci return ret; 12538c2ecf20Sopenharmony_ci 12548c2ecf20Sopenharmony_ci /* Gate then ungate PLL CPU after any rate changes */ 12558c2ecf20Sopenharmony_ci ccu_pll_notifier_register(&sun50i_a100_pll_cpu_nb); 12568c2ecf20Sopenharmony_ci 12578c2ecf20Sopenharmony_ci /* Reparent CPU during PLL CPU rate changes */ 12588c2ecf20Sopenharmony_ci ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, 12598c2ecf20Sopenharmony_ci &sun50i_a100_cpu_nb); 12608c2ecf20Sopenharmony_ci 12618c2ecf20Sopenharmony_ci return 0; 12628c2ecf20Sopenharmony_ci} 12638c2ecf20Sopenharmony_ci 12648c2ecf20Sopenharmony_cistatic const struct of_device_id sun50i_a100_ccu_ids[] = { 12658c2ecf20Sopenharmony_ci { .compatible = "allwinner,sun50i-a100-ccu" }, 12668c2ecf20Sopenharmony_ci { } 12678c2ecf20Sopenharmony_ci}; 12688c2ecf20Sopenharmony_ci 12698c2ecf20Sopenharmony_cistatic struct platform_driver sun50i_a100_ccu_driver = { 12708c2ecf20Sopenharmony_ci .probe = sun50i_a100_ccu_probe, 12718c2ecf20Sopenharmony_ci .driver = { 12728c2ecf20Sopenharmony_ci .name = "sun50i-a100-ccu", 12738c2ecf20Sopenharmony_ci .of_match_table = sun50i_a100_ccu_ids, 12748c2ecf20Sopenharmony_ci }, 12758c2ecf20Sopenharmony_ci}; 12768c2ecf20Sopenharmony_cimodule_platform_driver(sun50i_a100_ccu_driver); 1277