18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2017 Chen-Yu Tsai. All rights reserved. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 78c2ecf20Sopenharmony_ci#include <linux/io.h> 88c2ecf20Sopenharmony_ci#include <linux/of_address.h> 98c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include "ccu_common.h" 128c2ecf20Sopenharmony_ci#include "ccu_reset.h" 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include "ccu_div.h" 158c2ecf20Sopenharmony_ci#include "ccu_gate.h" 168c2ecf20Sopenharmony_ci#include "ccu_mp.h" 178c2ecf20Sopenharmony_ci#include "ccu_mux.h" 188c2ecf20Sopenharmony_ci#include "ccu_nkmp.h" 198c2ecf20Sopenharmony_ci#include "ccu_nm.h" 208c2ecf20Sopenharmony_ci#include "ccu_phase.h" 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#include "ccu-sun8i-a83t.h" 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define CCU_SUN8I_A83T_LOCK_REG 0x20c 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* 278c2ecf20Sopenharmony_ci * The CPU PLLs are actually NP clocks, with P being /1 or /4. However 288c2ecf20Sopenharmony_ci * P should only be used for output frequencies lower than 228 MHz. 298c2ecf20Sopenharmony_ci * Neither mainline Linux, U-boot, nor the vendor BSPs use these. 308c2ecf20Sopenharmony_ci * 318c2ecf20Sopenharmony_ci * For now we can just model it as a multiplier clock, and force P to /1. 328c2ecf20Sopenharmony_ci */ 338c2ecf20Sopenharmony_ci#define SUN8I_A83T_PLL_C0CPUX_REG 0x000 348c2ecf20Sopenharmony_ci#define SUN8I_A83T_PLL_C1CPUX_REG 0x004 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistatic struct ccu_mult pll_c0cpux_clk = { 378c2ecf20Sopenharmony_ci .enable = BIT(31), 388c2ecf20Sopenharmony_ci .lock = BIT(0), 398c2ecf20Sopenharmony_ci .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 408c2ecf20Sopenharmony_ci .common = { 418c2ecf20Sopenharmony_ci .reg = SUN8I_A83T_PLL_C0CPUX_REG, 428c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN8I_A83T_LOCK_REG, 438c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 448c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-c0cpux", "osc24M", 458c2ecf20Sopenharmony_ci &ccu_mult_ops, 468c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 478c2ecf20Sopenharmony_ci }, 488c2ecf20Sopenharmony_ci}; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_cistatic struct ccu_mult pll_c1cpux_clk = { 518c2ecf20Sopenharmony_ci .enable = BIT(31), 528c2ecf20Sopenharmony_ci .lock = BIT(1), 538c2ecf20Sopenharmony_ci .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 548c2ecf20Sopenharmony_ci .common = { 558c2ecf20Sopenharmony_ci .reg = SUN8I_A83T_PLL_C1CPUX_REG, 568c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN8I_A83T_LOCK_REG, 578c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 588c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-c1cpux", "osc24M", 598c2ecf20Sopenharmony_ci &ccu_mult_ops, 608c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 618c2ecf20Sopenharmony_ci }, 628c2ecf20Sopenharmony_ci}; 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* 658c2ecf20Sopenharmony_ci * The Audio PLL has d1, d2 dividers in addition to the usual N, M 668c2ecf20Sopenharmony_ci * factors. Since we only need 2 frequencies from this PLL: 22.5792 MHz 678c2ecf20Sopenharmony_ci * and 24.576 MHz, ignore them for now. Enforce the default for them, 688c2ecf20Sopenharmony_ci * which is d1 = 0, d2 = 1. 698c2ecf20Sopenharmony_ci */ 708c2ecf20Sopenharmony_ci#define SUN8I_A83T_PLL_AUDIO_REG 0x008 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* clock rates doubled for post divider */ 738c2ecf20Sopenharmony_cistatic struct ccu_sdm_setting pll_audio_sdm_table[] = { 748c2ecf20Sopenharmony_ci { .rate = 45158400, .pattern = 0xc00121ff, .m = 29, .n = 54 }, 758c2ecf20Sopenharmony_ci { .rate = 49152000, .pattern = 0xc000e147, .m = 30, .n = 61 }, 768c2ecf20Sopenharmony_ci}; 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_cistatic struct ccu_nm pll_audio_clk = { 798c2ecf20Sopenharmony_ci .enable = BIT(31), 808c2ecf20Sopenharmony_ci .lock = BIT(2), 818c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 828c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(0, 6), 838c2ecf20Sopenharmony_ci .fixed_post_div = 2, 848c2ecf20Sopenharmony_ci .sdm = _SUNXI_CCU_SDM(pll_audio_sdm_table, BIT(24), 858c2ecf20Sopenharmony_ci 0x284, BIT(31)), 868c2ecf20Sopenharmony_ci .common = { 878c2ecf20Sopenharmony_ci .reg = SUN8I_A83T_PLL_AUDIO_REG, 888c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN8I_A83T_LOCK_REG, 898c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG | 908c2ecf20Sopenharmony_ci CCU_FEATURE_FIXED_POSTDIV | 918c2ecf20Sopenharmony_ci CCU_FEATURE_SIGMA_DELTA_MOD, 928c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-audio", "osc24M", 938c2ecf20Sopenharmony_ci &ccu_nm_ops, CLK_SET_RATE_UNGATE), 948c2ecf20Sopenharmony_ci }, 958c2ecf20Sopenharmony_ci}; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci/* Some PLLs are input * N / div1 / P. Model them as NKMP with no K */ 988c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_video0_clk = { 998c2ecf20Sopenharmony_ci .enable = BIT(31), 1008c2ecf20Sopenharmony_ci .lock = BIT(3), 1018c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1028c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1038c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 2), /* output divider */ 1048c2ecf20Sopenharmony_ci .max_rate = 3000000000UL, 1058c2ecf20Sopenharmony_ci .common = { 1068c2ecf20Sopenharmony_ci .reg = 0x010, 1078c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN8I_A83T_LOCK_REG, 1088c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1098c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video0", "osc24M", 1108c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1118c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1128c2ecf20Sopenharmony_ci }, 1138c2ecf20Sopenharmony_ci}; 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_ve_clk = { 1168c2ecf20Sopenharmony_ci .enable = BIT(31), 1178c2ecf20Sopenharmony_ci .lock = BIT(4), 1188c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1198c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1208c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 1218c2ecf20Sopenharmony_ci .common = { 1228c2ecf20Sopenharmony_ci .reg = 0x018, 1238c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN8I_A83T_LOCK_REG, 1248c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1258c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ve", "osc24M", 1268c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1278c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1288c2ecf20Sopenharmony_ci }, 1298c2ecf20Sopenharmony_ci}; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_ddr_clk = { 1328c2ecf20Sopenharmony_ci .enable = BIT(31), 1338c2ecf20Sopenharmony_ci .lock = BIT(5), 1348c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1358c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1368c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 1378c2ecf20Sopenharmony_ci .common = { 1388c2ecf20Sopenharmony_ci .reg = 0x020, 1398c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN8I_A83T_LOCK_REG, 1408c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1418c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ddr", "osc24M", 1428c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1438c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1448c2ecf20Sopenharmony_ci }, 1458c2ecf20Sopenharmony_ci}; 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_periph_clk = { 1488c2ecf20Sopenharmony_ci .enable = BIT(31), 1498c2ecf20Sopenharmony_ci .lock = BIT(6), 1508c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1518c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1528c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 1538c2ecf20Sopenharmony_ci .common = { 1548c2ecf20Sopenharmony_ci .reg = 0x028, 1558c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN8I_A83T_LOCK_REG, 1568c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1578c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-periph", "osc24M", 1588c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1598c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1608c2ecf20Sopenharmony_ci }, 1618c2ecf20Sopenharmony_ci}; 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_gpu_clk = { 1648c2ecf20Sopenharmony_ci .enable = BIT(31), 1658c2ecf20Sopenharmony_ci .lock = BIT(7), 1668c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1678c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1688c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 1698c2ecf20Sopenharmony_ci .common = { 1708c2ecf20Sopenharmony_ci .reg = 0x038, 1718c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN8I_A83T_LOCK_REG, 1728c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1738c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-gpu", "osc24M", 1748c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1758c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1768c2ecf20Sopenharmony_ci }, 1778c2ecf20Sopenharmony_ci}; 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_hsic_clk = { 1808c2ecf20Sopenharmony_ci .enable = BIT(31), 1818c2ecf20Sopenharmony_ci .lock = BIT(8), 1828c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1838c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1848c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 1858c2ecf20Sopenharmony_ci .common = { 1868c2ecf20Sopenharmony_ci .reg = 0x044, 1878c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN8I_A83T_LOCK_REG, 1888c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1898c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-hsic", "osc24M", 1908c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1918c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1928c2ecf20Sopenharmony_ci }, 1938c2ecf20Sopenharmony_ci}; 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_de_clk = { 1968c2ecf20Sopenharmony_ci .enable = BIT(31), 1978c2ecf20Sopenharmony_ci .lock = BIT(9), 1988c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1998c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 2008c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 2018c2ecf20Sopenharmony_ci .common = { 2028c2ecf20Sopenharmony_ci .reg = 0x048, 2038c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN8I_A83T_LOCK_REG, 2048c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 2058c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-de", "osc24M", 2068c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 2078c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 2088c2ecf20Sopenharmony_ci }, 2098c2ecf20Sopenharmony_ci}; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_video1_clk = { 2128c2ecf20Sopenharmony_ci .enable = BIT(31), 2138c2ecf20Sopenharmony_ci .lock = BIT(10), 2148c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 2158c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 2168c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 2), /* external divider p */ 2178c2ecf20Sopenharmony_ci .max_rate = 3000000000UL, 2188c2ecf20Sopenharmony_ci .common = { 2198c2ecf20Sopenharmony_ci .reg = 0x04c, 2208c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN8I_A83T_LOCK_REG, 2218c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 2228c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video1", "osc24M", 2238c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 2248c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 2258c2ecf20Sopenharmony_ci }, 2268c2ecf20Sopenharmony_ci}; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_cistatic const char * const c0cpux_parents[] = { "osc24M", "pll-c0cpux" }; 2298c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX(c0cpux_clk, "c0cpux", c0cpux_parents, 2308c2ecf20Sopenharmony_ci 0x50, 12, 1, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_cistatic const char * const c1cpux_parents[] = { "osc24M", "pll-c1cpux" }; 2338c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX(c1cpux_clk, "c1cpux", c1cpux_parents, 2348c2ecf20Sopenharmony_ci 0x50, 28, 1, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(axi0_clk, "axi0", "c0cpux", 0x050, 0, 2, 0); 2378c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(axi1_clk, "axi1", "c1cpux", 0x050, 16, 2, 0); 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_cistatic const char * const ahb1_parents[] = { "osc16M-d512", "osc24M", 2408c2ecf20Sopenharmony_ci "pll-periph", 2418c2ecf20Sopenharmony_ci "pll-periph" }; 2428c2ecf20Sopenharmony_cistatic const struct ccu_mux_var_prediv ahb1_predivs[] = { 2438c2ecf20Sopenharmony_ci { .index = 2, .shift = 6, .width = 2 }, 2448c2ecf20Sopenharmony_ci { .index = 3, .shift = 6, .width = 2 }, 2458c2ecf20Sopenharmony_ci}; 2468c2ecf20Sopenharmony_cistatic struct ccu_div ahb1_clk = { 2478c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO), 2488c2ecf20Sopenharmony_ci .mux = { 2498c2ecf20Sopenharmony_ci .shift = 12, 2508c2ecf20Sopenharmony_ci .width = 2, 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci .var_predivs = ahb1_predivs, 2538c2ecf20Sopenharmony_ci .n_var_predivs = ARRAY_SIZE(ahb1_predivs), 2548c2ecf20Sopenharmony_ci }, 2558c2ecf20Sopenharmony_ci .common = { 2568c2ecf20Sopenharmony_ci .reg = 0x054, 2578c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb1", 2588c2ecf20Sopenharmony_ci ahb1_parents, 2598c2ecf20Sopenharmony_ci &ccu_div_ops, 2608c2ecf20Sopenharmony_ci 0), 2618c2ecf20Sopenharmony_ci }, 2628c2ecf20Sopenharmony_ci}; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(apb1_clk, "apb1", "ahb1", 0x054, 8, 2, 0); 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_cistatic const char * const apb2_parents[] = { "osc16M-d512", "osc24M", 2678c2ecf20Sopenharmony_ci "pll-periph", "pll-periph" }; 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", apb2_parents, 0x058, 2708c2ecf20Sopenharmony_ci 0, 5, /* M */ 2718c2ecf20Sopenharmony_ci 16, 2, /* P */ 2728c2ecf20Sopenharmony_ci 24, 2, /* mux */ 2738c2ecf20Sopenharmony_ci 0); 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_cistatic const char * const ahb2_parents[] = { "ahb1", "pll-periph" }; 2768c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv ahb2_prediv = { 2778c2ecf20Sopenharmony_ci .index = 1, .div = 2 2788c2ecf20Sopenharmony_ci}; 2798c2ecf20Sopenharmony_cistatic struct ccu_mux ahb2_clk = { 2808c2ecf20Sopenharmony_ci .mux = { 2818c2ecf20Sopenharmony_ci .shift = 0, 2828c2ecf20Sopenharmony_ci .width = 2, 2838c2ecf20Sopenharmony_ci .fixed_predivs = &ahb2_prediv, 2848c2ecf20Sopenharmony_ci .n_predivs = 1, 2858c2ecf20Sopenharmony_ci }, 2868c2ecf20Sopenharmony_ci .common = { 2878c2ecf20Sopenharmony_ci .reg = 0x05c, 2888c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb2", 2898c2ecf20Sopenharmony_ci ahb2_parents, 2908c2ecf20Sopenharmony_ci &ccu_mux_ops, 2918c2ecf20Sopenharmony_ci 0), 2928c2ecf20Sopenharmony_ci }, 2938c2ecf20Sopenharmony_ci}; 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mipi_dsi_clk, "bus-mipi-dsi", "ahb1", 2968c2ecf20Sopenharmony_ci 0x060, BIT(1), 0); 2978c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ss_clk, "bus-ss", "ahb1", 2988c2ecf20Sopenharmony_ci 0x060, BIT(5), 0); 2998c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "ahb1", 3008c2ecf20Sopenharmony_ci 0x060, BIT(6), 0); 3018c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb1", 3028c2ecf20Sopenharmony_ci 0x060, BIT(8), 0); 3038c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb1", 3048c2ecf20Sopenharmony_ci 0x060, BIT(9), 0); 3058c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc2_clk, "bus-mmc2", "ahb1", 3068c2ecf20Sopenharmony_ci 0x060, BIT(10), 0); 3078c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_nand_clk, "bus-nand", "ahb1", 3088c2ecf20Sopenharmony_ci 0x060, BIT(13), 0); 3098c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dram_clk, "bus-dram", "ahb1", 3108c2ecf20Sopenharmony_ci 0x060, BIT(14), 0); 3118c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_emac_clk, "bus-emac", "ahb2", 3128c2ecf20Sopenharmony_ci 0x060, BIT(17), 0); 3138c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "ahb1", 3148c2ecf20Sopenharmony_ci 0x060, BIT(19), 0); 3158c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb1", 3168c2ecf20Sopenharmony_ci 0x060, BIT(20), 0); 3178c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi1_clk, "bus-spi1", "ahb1", 3188c2ecf20Sopenharmony_ci 0x060, BIT(21), 0); 3198c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb1", 3208c2ecf20Sopenharmony_ci 0x060, BIT(24), 0); 3218c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci0_clk, "bus-ehci0", "ahb2", 3228c2ecf20Sopenharmony_ci 0x060, BIT(26), 0); 3238c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci1_clk, "bus-ehci1", "ahb2", 3248c2ecf20Sopenharmony_ci 0x060, BIT(27), 0); 3258c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci0_clk, "bus-ohci0", "ahb2", 3268c2ecf20Sopenharmony_ci 0x060, BIT(29), 0); 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "ahb1", 3298c2ecf20Sopenharmony_ci 0x064, BIT(0), 0); 3308c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tcon0_clk, "bus-tcon0", "ahb1", 3318c2ecf20Sopenharmony_ci 0x064, BIT(4), 0); 3328c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tcon1_clk, "bus-tcon1", "ahb1", 3338c2ecf20Sopenharmony_ci 0x064, BIT(5), 0); 3348c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_csi_clk, "bus-csi", "ahb1", 3358c2ecf20Sopenharmony_ci 0x064, BIT(8), 0); 3368c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hdmi_clk, "bus-hdmi", "ahb1", 3378c2ecf20Sopenharmony_ci 0x064, BIT(11), 0); 3388c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_de_clk, "bus-de", "ahb1", 3398c2ecf20Sopenharmony_ci 0x064, BIT(12), 0); 3408c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gpu_clk, "bus-gpu", "ahb1", 3418c2ecf20Sopenharmony_ci 0x064, BIT(20), 0); 3428c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_msgbox_clk, "bus-msgbox", "ahb1", 3438c2ecf20Sopenharmony_ci 0x064, BIT(21), 0); 3448c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spinlock_clk, "bus-spinlock", "ahb1", 3458c2ecf20Sopenharmony_ci 0x064, BIT(22), 0); 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spdif_clk, "bus-spdif", "apb1", 3488c2ecf20Sopenharmony_ci 0x068, BIT(1), 0); 3498c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_pio_clk, "bus-pio", "apb1", 3508c2ecf20Sopenharmony_ci 0x068, BIT(5), 0); 3518c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s0_clk, "bus-i2s0", "apb1", 3528c2ecf20Sopenharmony_ci 0x068, BIT(12), 0); 3538c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s1_clk, "bus-i2s1", "apb1", 3548c2ecf20Sopenharmony_ci 0x068, BIT(13), 0); 3558c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s2_clk, "bus-i2s2", "apb1", 3568c2ecf20Sopenharmony_ci 0x068, BIT(14), 0); 3578c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tdm_clk, "bus-tdm", "apb1", 3588c2ecf20Sopenharmony_ci 0x068, BIT(15), 0); 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb2", 3618c2ecf20Sopenharmony_ci 0x06c, BIT(0), 0); 3628c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb2", 3638c2ecf20Sopenharmony_ci 0x06c, BIT(1), 0); 3648c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb2", 3658c2ecf20Sopenharmony_ci 0x06c, BIT(2), 0); 3668c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb2", 3678c2ecf20Sopenharmony_ci 0x06c, BIT(16), 0); 3688c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb2", 3698c2ecf20Sopenharmony_ci 0x06c, BIT(17), 0); 3708c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb2", 3718c2ecf20Sopenharmony_ci 0x06c, BIT(18), 0); 3728c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb2", 3738c2ecf20Sopenharmony_ci 0x06c, BIT(19), 0); 3748c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart4_clk, "bus-uart4", "apb2", 3758c2ecf20Sopenharmony_ci 0x06c, BIT(20), 0); 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_cistatic const char * const cci400_parents[] = { "osc24M", "pll-periph", 3788c2ecf20Sopenharmony_ci "pll-hsic" }; 3798c2ecf20Sopenharmony_cistatic struct ccu_div cci400_clk = { 3808c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, 0), 3818c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 3828c2ecf20Sopenharmony_ci .common = { 3838c2ecf20Sopenharmony_ci .reg = 0x078, 3848c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("cci400", 3858c2ecf20Sopenharmony_ci cci400_parents, 3868c2ecf20Sopenharmony_ci &ccu_div_ops, 3878c2ecf20Sopenharmony_ci CLK_IS_CRITICAL), 3888c2ecf20Sopenharmony_ci }, 3898c2ecf20Sopenharmony_ci}; 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_cistatic const char * const mod0_default_parents[] = { "osc24M", "pll-periph" }; 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand_clk, "nand", mod0_default_parents, 3948c2ecf20Sopenharmony_ci 0x080, 3958c2ecf20Sopenharmony_ci 0, 4, /* M */ 3968c2ecf20Sopenharmony_ci 16, 2, /* P */ 3978c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3988c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3998c2ecf20Sopenharmony_ci 0); 4008c2ecf20Sopenharmony_ci 4018c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 4028c2ecf20Sopenharmony_ci 0x088, 4038c2ecf20Sopenharmony_ci 0, 4, /* M */ 4048c2ecf20Sopenharmony_ci 16, 2, /* P */ 4058c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4068c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4078c2ecf20Sopenharmony_ci 0); 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_sample_clk, "mmc0-sample", "mmc0", 4108c2ecf20Sopenharmony_ci 0x088, 20, 3, 0); 4118c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_output_clk, "mmc0-output", "mmc0", 4128c2ecf20Sopenharmony_ci 0x088, 8, 3, 0); 4138c2ecf20Sopenharmony_ci 4148c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 4158c2ecf20Sopenharmony_ci 0x08c, 4168c2ecf20Sopenharmony_ci 0, 4, /* M */ 4178c2ecf20Sopenharmony_ci 16, 2, /* P */ 4188c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4198c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4208c2ecf20Sopenharmony_ci 0); 4218c2ecf20Sopenharmony_ci 4228c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1-sample", "mmc1", 4238c2ecf20Sopenharmony_ci 0x08c, 20, 3, 0); 4248c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1-output", "mmc1", 4258c2ecf20Sopenharmony_ci 0x08c, 8, 3, 0); 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_MMC_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 4288c2ecf20Sopenharmony_ci 0x090, 0); 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2-sample", "mmc2", 4318c2ecf20Sopenharmony_ci 0x090, 20, 3, 0); 4328c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_output_clk, "mmc2-output", "mmc2", 4338c2ecf20Sopenharmony_ci 0x090, 8, 3, 0); 4348c2ecf20Sopenharmony_ci 4358c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ss_clk, "ss", mod0_default_parents, 4368c2ecf20Sopenharmony_ci 0x09c, 4378c2ecf20Sopenharmony_ci 0, 4, /* M */ 4388c2ecf20Sopenharmony_ci 16, 2, /* P */ 4398c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4408c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4418c2ecf20Sopenharmony_ci 0); 4428c2ecf20Sopenharmony_ci 4438c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 4448c2ecf20Sopenharmony_ci 0x0a0, 4458c2ecf20Sopenharmony_ci 0, 4, /* M */ 4468c2ecf20Sopenharmony_ci 16, 2, /* P */ 4478c2ecf20Sopenharmony_ci 24, 4, /* mux */ 4488c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4498c2ecf20Sopenharmony_ci 0); 4508c2ecf20Sopenharmony_ci 4518c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 4528c2ecf20Sopenharmony_ci 0x0a4, 4538c2ecf20Sopenharmony_ci 0, 4, /* M */ 4548c2ecf20Sopenharmony_ci 16, 2, /* P */ 4558c2ecf20Sopenharmony_ci 24, 4, /* mux */ 4568c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4578c2ecf20Sopenharmony_ci 0); 4588c2ecf20Sopenharmony_ci 4598c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(i2s0_clk, "i2s0", "pll-audio", 4608c2ecf20Sopenharmony_ci 0x0b0, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 4618c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(i2s1_clk, "i2s1", "pll-audio", 4628c2ecf20Sopenharmony_ci 0x0b4, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 4638c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(i2s2_clk, "i2s2", "pll-audio", 4648c2ecf20Sopenharmony_ci 0x0b8, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 4658c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(tdm_clk, "tdm", "pll-audio", 4668c2ecf20Sopenharmony_ci 0x0bc, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 4678c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(spdif_clk, "spdif", "pll-audio", 4688c2ecf20Sopenharmony_ci 0x0c0, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 4698c2ecf20Sopenharmony_ci 4708c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M", 4718c2ecf20Sopenharmony_ci 0x0cc, BIT(8), 0); 4728c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "osc24M", 4738c2ecf20Sopenharmony_ci 0x0cc, BIT(9), 0); 4748c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_hsic_clk, "usb-hsic", "pll-hsic", 4758c2ecf20Sopenharmony_ci 0x0cc, BIT(10), 0); 4768c2ecf20Sopenharmony_cistatic struct ccu_gate usb_hsic_12m_clk = { 4778c2ecf20Sopenharmony_ci .enable = BIT(11), 4788c2ecf20Sopenharmony_ci .common = { 4798c2ecf20Sopenharmony_ci .reg = 0x0cc, 4808c2ecf20Sopenharmony_ci .prediv = 2, 4818c2ecf20Sopenharmony_ci .features = CCU_FEATURE_ALL_PREDIV, 4828c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("usb-hsic-12m", "osc24M", 4838c2ecf20Sopenharmony_ci &ccu_gate_ops, 0), 4848c2ecf20Sopenharmony_ci } 4858c2ecf20Sopenharmony_ci}; 4868c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc24M", 4878c2ecf20Sopenharmony_ci 0x0cc, BIT(16), 0); 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci/* TODO divider has minimum of 2 */ 4908c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(dram_clk, "dram", "pll-ddr", 0x0f4, 0, 4, CLK_IS_CRITICAL); 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ve_clk, "dram-ve", "dram", 4938c2ecf20Sopenharmony_ci 0x100, BIT(0), 0); 4948c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_csi_clk, "dram-csi", "dram", 4958c2ecf20Sopenharmony_ci 0x100, BIT(1), 0); 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_cistatic const char * const tcon0_parents[] = { "pll-video0" }; 4988c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(tcon0_clk, "tcon0", tcon0_parents, 4998c2ecf20Sopenharmony_ci 0x118, 24, 3, BIT(31), CLK_SET_RATE_PARENT); 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_cistatic const char * const tcon1_parents[] = { "pll-video1" }; 5028c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(tcon1_clk, "tcon1", tcon1_parents, 5038c2ecf20Sopenharmony_ci 0x11c, 0, 4, 24, 2, BIT(31), CLK_SET_RATE_PARENT); 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(csi_misc_clk, "csi-misc", "osc24M", 0x130, BIT(16), 0); 5068c2ecf20Sopenharmony_ci 5078c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mipi_csi_clk, "mipi-csi", "osc24M", 0x130, BIT(31), 0); 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_cistatic const char * const csi_mclk_parents[] = { "pll-video0", "pll-de", 5108c2ecf20Sopenharmony_ci "osc24M" }; 5118c2ecf20Sopenharmony_cistatic const u8 csi_mclk_table[] = { 0, 3, 5 }; 5128c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi_mclk_clk, "csi-mclk", 5138c2ecf20Sopenharmony_ci csi_mclk_parents, csi_mclk_table, 5148c2ecf20Sopenharmony_ci 0x134, 5158c2ecf20Sopenharmony_ci 0, 5, /* M */ 5168c2ecf20Sopenharmony_ci 8, 3, /* mux */ 5178c2ecf20Sopenharmony_ci BIT(15), /* gate */ 5188c2ecf20Sopenharmony_ci 0); 5198c2ecf20Sopenharmony_ci 5208c2ecf20Sopenharmony_cistatic const char * const csi_sclk_parents[] = { "pll-periph", "pll-ve" }; 5218c2ecf20Sopenharmony_cistatic const u8 csi_sclk_table[] = { 0, 5 }; 5228c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi_sclk_clk, "csi-sclk", 5238c2ecf20Sopenharmony_ci csi_sclk_parents, csi_sclk_table, 5248c2ecf20Sopenharmony_ci 0x134, 5258c2ecf20Sopenharmony_ci 16, 4, /* M */ 5268c2ecf20Sopenharmony_ci 24, 3, /* mux */ 5278c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5288c2ecf20Sopenharmony_ci 0); 5298c2ecf20Sopenharmony_ci 5308c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve", 0x13c, 5318c2ecf20Sopenharmony_ci 16, 3, BIT(31), CLK_SET_RATE_PARENT); 5328c2ecf20Sopenharmony_ci 5338c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", 0x144, BIT(31), 0); 5348c2ecf20Sopenharmony_ci 5358c2ecf20Sopenharmony_cistatic const char * const hdmi_parents[] = { "pll-video1" }; 5368c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", hdmi_parents, 5378c2ecf20Sopenharmony_ci 0x150, 5388c2ecf20Sopenharmony_ci 0, 4, /* M */ 5398c2ecf20Sopenharmony_ci 24, 2, /* mux */ 5408c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5418c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(hdmi_slow_clk, "hdmi-slow", "osc24M", 0x154, BIT(31), 0); 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_cistatic const char * const mbus_parents[] = { "osc24M", "pll-periph", 5468c2ecf20Sopenharmony_ci "pll-ddr" }; 5478c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents, 5488c2ecf20Sopenharmony_ci 0x15c, 5498c2ecf20Sopenharmony_ci 0, 3, /* M */ 5508c2ecf20Sopenharmony_ci 24, 2, /* mux */ 5518c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5528c2ecf20Sopenharmony_ci CLK_IS_CRITICAL); 5538c2ecf20Sopenharmony_ci 5548c2ecf20Sopenharmony_cistatic const char * const mipi_dsi0_parents[] = { "pll-video0" }; 5558c2ecf20Sopenharmony_cistatic const u8 mipi_dsi0_table[] = { 8 }; 5568c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(mipi_dsi0_clk, "mipi-dsi0", 5578c2ecf20Sopenharmony_ci mipi_dsi0_parents, mipi_dsi0_table, 5588c2ecf20Sopenharmony_ci 0x168, 5598c2ecf20Sopenharmony_ci 0, 4, /* M */ 5608c2ecf20Sopenharmony_ci 24, 4, /* mux */ 5618c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5628c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 5638c2ecf20Sopenharmony_ci 5648c2ecf20Sopenharmony_cistatic const char * const mipi_dsi1_parents[] = { "osc24M", "pll-video0" }; 5658c2ecf20Sopenharmony_cistatic const u8 mipi_dsi1_table[] = { 0, 9 }; 5668c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(mipi_dsi1_clk, "mipi-dsi1", 5678c2ecf20Sopenharmony_ci mipi_dsi1_parents, mipi_dsi1_table, 5688c2ecf20Sopenharmony_ci 0x16c, 5698c2ecf20Sopenharmony_ci 0, 4, /* M */ 5708c2ecf20Sopenharmony_ci 24, 4, /* mux */ 5718c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5728c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 5738c2ecf20Sopenharmony_ci 5748c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(gpu_core_clk, "gpu-core", "pll-gpu", 0x1a0, 5758c2ecf20Sopenharmony_ci 0, 3, BIT(31), CLK_SET_RATE_PARENT); 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_cistatic const char * const gpu_memory_parents[] = { "pll-gpu", "pll-ddr" }; 5788c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(gpu_memory_clk, "gpu-memory", 5798c2ecf20Sopenharmony_ci gpu_memory_parents, 5808c2ecf20Sopenharmony_ci 0x1a4, 5818c2ecf20Sopenharmony_ci 0, 3, /* M */ 5828c2ecf20Sopenharmony_ci 24, 1, /* mux */ 5838c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5848c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 5858c2ecf20Sopenharmony_ci 5868c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(gpu_hyd_clk, "gpu-hyd", "pll-gpu", 0x1a8, 5878c2ecf20Sopenharmony_ci 0, 3, BIT(31), CLK_SET_RATE_PARENT); 5888c2ecf20Sopenharmony_ci 5898c2ecf20Sopenharmony_cistatic struct ccu_common *sun8i_a83t_ccu_clks[] = { 5908c2ecf20Sopenharmony_ci &pll_c0cpux_clk.common, 5918c2ecf20Sopenharmony_ci &pll_c1cpux_clk.common, 5928c2ecf20Sopenharmony_ci &pll_audio_clk.common, 5938c2ecf20Sopenharmony_ci &pll_video0_clk.common, 5948c2ecf20Sopenharmony_ci &pll_ve_clk.common, 5958c2ecf20Sopenharmony_ci &pll_ddr_clk.common, 5968c2ecf20Sopenharmony_ci &pll_periph_clk.common, 5978c2ecf20Sopenharmony_ci &pll_gpu_clk.common, 5988c2ecf20Sopenharmony_ci &pll_hsic_clk.common, 5998c2ecf20Sopenharmony_ci &pll_de_clk.common, 6008c2ecf20Sopenharmony_ci &pll_video1_clk.common, 6018c2ecf20Sopenharmony_ci &c0cpux_clk.common, 6028c2ecf20Sopenharmony_ci &c1cpux_clk.common, 6038c2ecf20Sopenharmony_ci &axi0_clk.common, 6048c2ecf20Sopenharmony_ci &axi1_clk.common, 6058c2ecf20Sopenharmony_ci &ahb1_clk.common, 6068c2ecf20Sopenharmony_ci &ahb2_clk.common, 6078c2ecf20Sopenharmony_ci &apb1_clk.common, 6088c2ecf20Sopenharmony_ci &apb2_clk.common, 6098c2ecf20Sopenharmony_ci &bus_mipi_dsi_clk.common, 6108c2ecf20Sopenharmony_ci &bus_ss_clk.common, 6118c2ecf20Sopenharmony_ci &bus_dma_clk.common, 6128c2ecf20Sopenharmony_ci &bus_mmc0_clk.common, 6138c2ecf20Sopenharmony_ci &bus_mmc1_clk.common, 6148c2ecf20Sopenharmony_ci &bus_mmc2_clk.common, 6158c2ecf20Sopenharmony_ci &bus_nand_clk.common, 6168c2ecf20Sopenharmony_ci &bus_dram_clk.common, 6178c2ecf20Sopenharmony_ci &bus_emac_clk.common, 6188c2ecf20Sopenharmony_ci &bus_hstimer_clk.common, 6198c2ecf20Sopenharmony_ci &bus_spi0_clk.common, 6208c2ecf20Sopenharmony_ci &bus_spi1_clk.common, 6218c2ecf20Sopenharmony_ci &bus_otg_clk.common, 6228c2ecf20Sopenharmony_ci &bus_ehci0_clk.common, 6238c2ecf20Sopenharmony_ci &bus_ehci1_clk.common, 6248c2ecf20Sopenharmony_ci &bus_ohci0_clk.common, 6258c2ecf20Sopenharmony_ci &bus_ve_clk.common, 6268c2ecf20Sopenharmony_ci &bus_tcon0_clk.common, 6278c2ecf20Sopenharmony_ci &bus_tcon1_clk.common, 6288c2ecf20Sopenharmony_ci &bus_csi_clk.common, 6298c2ecf20Sopenharmony_ci &bus_hdmi_clk.common, 6308c2ecf20Sopenharmony_ci &bus_de_clk.common, 6318c2ecf20Sopenharmony_ci &bus_gpu_clk.common, 6328c2ecf20Sopenharmony_ci &bus_msgbox_clk.common, 6338c2ecf20Sopenharmony_ci &bus_spinlock_clk.common, 6348c2ecf20Sopenharmony_ci &bus_spdif_clk.common, 6358c2ecf20Sopenharmony_ci &bus_pio_clk.common, 6368c2ecf20Sopenharmony_ci &bus_i2s0_clk.common, 6378c2ecf20Sopenharmony_ci &bus_i2s1_clk.common, 6388c2ecf20Sopenharmony_ci &bus_i2s2_clk.common, 6398c2ecf20Sopenharmony_ci &bus_tdm_clk.common, 6408c2ecf20Sopenharmony_ci &bus_i2c0_clk.common, 6418c2ecf20Sopenharmony_ci &bus_i2c1_clk.common, 6428c2ecf20Sopenharmony_ci &bus_i2c2_clk.common, 6438c2ecf20Sopenharmony_ci &bus_uart0_clk.common, 6448c2ecf20Sopenharmony_ci &bus_uart1_clk.common, 6458c2ecf20Sopenharmony_ci &bus_uart2_clk.common, 6468c2ecf20Sopenharmony_ci &bus_uart3_clk.common, 6478c2ecf20Sopenharmony_ci &bus_uart4_clk.common, 6488c2ecf20Sopenharmony_ci &cci400_clk.common, 6498c2ecf20Sopenharmony_ci &nand_clk.common, 6508c2ecf20Sopenharmony_ci &mmc0_clk.common, 6518c2ecf20Sopenharmony_ci &mmc0_sample_clk.common, 6528c2ecf20Sopenharmony_ci &mmc0_output_clk.common, 6538c2ecf20Sopenharmony_ci &mmc1_clk.common, 6548c2ecf20Sopenharmony_ci &mmc1_sample_clk.common, 6558c2ecf20Sopenharmony_ci &mmc1_output_clk.common, 6568c2ecf20Sopenharmony_ci &mmc2_clk.common, 6578c2ecf20Sopenharmony_ci &mmc2_sample_clk.common, 6588c2ecf20Sopenharmony_ci &mmc2_output_clk.common, 6598c2ecf20Sopenharmony_ci &ss_clk.common, 6608c2ecf20Sopenharmony_ci &spi0_clk.common, 6618c2ecf20Sopenharmony_ci &spi1_clk.common, 6628c2ecf20Sopenharmony_ci &i2s0_clk.common, 6638c2ecf20Sopenharmony_ci &i2s1_clk.common, 6648c2ecf20Sopenharmony_ci &i2s2_clk.common, 6658c2ecf20Sopenharmony_ci &tdm_clk.common, 6668c2ecf20Sopenharmony_ci &spdif_clk.common, 6678c2ecf20Sopenharmony_ci &usb_phy0_clk.common, 6688c2ecf20Sopenharmony_ci &usb_phy1_clk.common, 6698c2ecf20Sopenharmony_ci &usb_hsic_clk.common, 6708c2ecf20Sopenharmony_ci &usb_hsic_12m_clk.common, 6718c2ecf20Sopenharmony_ci &usb_ohci0_clk.common, 6728c2ecf20Sopenharmony_ci &dram_clk.common, 6738c2ecf20Sopenharmony_ci &dram_ve_clk.common, 6748c2ecf20Sopenharmony_ci &dram_csi_clk.common, 6758c2ecf20Sopenharmony_ci &tcon0_clk.common, 6768c2ecf20Sopenharmony_ci &tcon1_clk.common, 6778c2ecf20Sopenharmony_ci &csi_misc_clk.common, 6788c2ecf20Sopenharmony_ci &mipi_csi_clk.common, 6798c2ecf20Sopenharmony_ci &csi_mclk_clk.common, 6808c2ecf20Sopenharmony_ci &csi_sclk_clk.common, 6818c2ecf20Sopenharmony_ci &ve_clk.common, 6828c2ecf20Sopenharmony_ci &avs_clk.common, 6838c2ecf20Sopenharmony_ci &hdmi_clk.common, 6848c2ecf20Sopenharmony_ci &hdmi_slow_clk.common, 6858c2ecf20Sopenharmony_ci &mbus_clk.common, 6868c2ecf20Sopenharmony_ci &mipi_dsi0_clk.common, 6878c2ecf20Sopenharmony_ci &mipi_dsi1_clk.common, 6888c2ecf20Sopenharmony_ci &gpu_core_clk.common, 6898c2ecf20Sopenharmony_ci &gpu_memory_clk.common, 6908c2ecf20Sopenharmony_ci &gpu_hyd_clk.common, 6918c2ecf20Sopenharmony_ci}; 6928c2ecf20Sopenharmony_ci 6938c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun8i_a83t_hw_clks = { 6948c2ecf20Sopenharmony_ci .hws = { 6958c2ecf20Sopenharmony_ci [CLK_PLL_C0CPUX] = &pll_c0cpux_clk.common.hw, 6968c2ecf20Sopenharmony_ci [CLK_PLL_C1CPUX] = &pll_c1cpux_clk.common.hw, 6978c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.common.hw, 6988c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 6998c2ecf20Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 7008c2ecf20Sopenharmony_ci [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 7018c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH] = &pll_periph_clk.common.hw, 7028c2ecf20Sopenharmony_ci [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 7038c2ecf20Sopenharmony_ci [CLK_PLL_HSIC] = &pll_hsic_clk.common.hw, 7048c2ecf20Sopenharmony_ci [CLK_PLL_DE] = &pll_de_clk.common.hw, 7058c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 7068c2ecf20Sopenharmony_ci [CLK_C0CPUX] = &c0cpux_clk.common.hw, 7078c2ecf20Sopenharmony_ci [CLK_C1CPUX] = &c1cpux_clk.common.hw, 7088c2ecf20Sopenharmony_ci [CLK_AXI0] = &axi0_clk.common.hw, 7098c2ecf20Sopenharmony_ci [CLK_AXI1] = &axi1_clk.common.hw, 7108c2ecf20Sopenharmony_ci [CLK_AHB1] = &ahb1_clk.common.hw, 7118c2ecf20Sopenharmony_ci [CLK_AHB2] = &ahb2_clk.common.hw, 7128c2ecf20Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 7138c2ecf20Sopenharmony_ci [CLK_APB2] = &apb2_clk.common.hw, 7148c2ecf20Sopenharmony_ci [CLK_BUS_MIPI_DSI] = &bus_mipi_dsi_clk.common.hw, 7158c2ecf20Sopenharmony_ci [CLK_BUS_SS] = &bus_ss_clk.common.hw, 7168c2ecf20Sopenharmony_ci [CLK_BUS_DMA] = &bus_dma_clk.common.hw, 7178c2ecf20Sopenharmony_ci [CLK_BUS_MMC0] = &bus_mmc0_clk.common.hw, 7188c2ecf20Sopenharmony_ci [CLK_BUS_MMC1] = &bus_mmc1_clk.common.hw, 7198c2ecf20Sopenharmony_ci [CLK_BUS_MMC2] = &bus_mmc2_clk.common.hw, 7208c2ecf20Sopenharmony_ci [CLK_BUS_NAND] = &bus_nand_clk.common.hw, 7218c2ecf20Sopenharmony_ci [CLK_BUS_DRAM] = &bus_dram_clk.common.hw, 7228c2ecf20Sopenharmony_ci [CLK_BUS_EMAC] = &bus_emac_clk.common.hw, 7238c2ecf20Sopenharmony_ci [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw, 7248c2ecf20Sopenharmony_ci [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw, 7258c2ecf20Sopenharmony_ci [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw, 7268c2ecf20Sopenharmony_ci [CLK_BUS_OTG] = &bus_otg_clk.common.hw, 7278c2ecf20Sopenharmony_ci [CLK_BUS_EHCI0] = &bus_ehci0_clk.common.hw, 7288c2ecf20Sopenharmony_ci [CLK_BUS_EHCI1] = &bus_ehci1_clk.common.hw, 7298c2ecf20Sopenharmony_ci [CLK_BUS_OHCI0] = &bus_ohci0_clk.common.hw, 7308c2ecf20Sopenharmony_ci [CLK_BUS_VE] = &bus_ve_clk.common.hw, 7318c2ecf20Sopenharmony_ci [CLK_BUS_TCON0] = &bus_tcon0_clk.common.hw, 7328c2ecf20Sopenharmony_ci [CLK_BUS_TCON1] = &bus_tcon1_clk.common.hw, 7338c2ecf20Sopenharmony_ci [CLK_BUS_CSI] = &bus_csi_clk.common.hw, 7348c2ecf20Sopenharmony_ci [CLK_BUS_HDMI] = &bus_hdmi_clk.common.hw, 7358c2ecf20Sopenharmony_ci [CLK_BUS_DE] = &bus_de_clk.common.hw, 7368c2ecf20Sopenharmony_ci [CLK_BUS_GPU] = &bus_gpu_clk.common.hw, 7378c2ecf20Sopenharmony_ci [CLK_BUS_MSGBOX] = &bus_msgbox_clk.common.hw, 7388c2ecf20Sopenharmony_ci [CLK_BUS_SPINLOCK] = &bus_spinlock_clk.common.hw, 7398c2ecf20Sopenharmony_ci [CLK_BUS_SPDIF] = &bus_spdif_clk.common.hw, 7408c2ecf20Sopenharmony_ci [CLK_BUS_PIO] = &bus_pio_clk.common.hw, 7418c2ecf20Sopenharmony_ci [CLK_BUS_I2S0] = &bus_i2s0_clk.common.hw, 7428c2ecf20Sopenharmony_ci [CLK_BUS_I2S1] = &bus_i2s1_clk.common.hw, 7438c2ecf20Sopenharmony_ci [CLK_BUS_I2S2] = &bus_i2s2_clk.common.hw, 7448c2ecf20Sopenharmony_ci [CLK_BUS_TDM] = &bus_tdm_clk.common.hw, 7458c2ecf20Sopenharmony_ci [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw, 7468c2ecf20Sopenharmony_ci [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw, 7478c2ecf20Sopenharmony_ci [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw, 7488c2ecf20Sopenharmony_ci [CLK_BUS_UART0] = &bus_uart0_clk.common.hw, 7498c2ecf20Sopenharmony_ci [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 7508c2ecf20Sopenharmony_ci [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 7518c2ecf20Sopenharmony_ci [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 7528c2ecf20Sopenharmony_ci [CLK_BUS_UART4] = &bus_uart4_clk.common.hw, 7538c2ecf20Sopenharmony_ci [CLK_CCI400] = &cci400_clk.common.hw, 7548c2ecf20Sopenharmony_ci [CLK_NAND] = &nand_clk.common.hw, 7558c2ecf20Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 7568c2ecf20Sopenharmony_ci [CLK_MMC0_SAMPLE] = &mmc0_sample_clk.common.hw, 7578c2ecf20Sopenharmony_ci [CLK_MMC0_OUTPUT] = &mmc0_output_clk.common.hw, 7588c2ecf20Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 7598c2ecf20Sopenharmony_ci [CLK_MMC1_SAMPLE] = &mmc1_sample_clk.common.hw, 7608c2ecf20Sopenharmony_ci [CLK_MMC1_OUTPUT] = &mmc1_output_clk.common.hw, 7618c2ecf20Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 7628c2ecf20Sopenharmony_ci [CLK_MMC2_SAMPLE] = &mmc2_sample_clk.common.hw, 7638c2ecf20Sopenharmony_ci [CLK_MMC2_OUTPUT] = &mmc2_output_clk.common.hw, 7648c2ecf20Sopenharmony_ci [CLK_SS] = &ss_clk.common.hw, 7658c2ecf20Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 7668c2ecf20Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 7678c2ecf20Sopenharmony_ci [CLK_I2S0] = &i2s0_clk.common.hw, 7688c2ecf20Sopenharmony_ci [CLK_I2S1] = &i2s1_clk.common.hw, 7698c2ecf20Sopenharmony_ci [CLK_I2S2] = &i2s2_clk.common.hw, 7708c2ecf20Sopenharmony_ci [CLK_TDM] = &tdm_clk.common.hw, 7718c2ecf20Sopenharmony_ci [CLK_SPDIF] = &spdif_clk.common.hw, 7728c2ecf20Sopenharmony_ci [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 7738c2ecf20Sopenharmony_ci [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 7748c2ecf20Sopenharmony_ci [CLK_USB_HSIC] = &usb_hsic_clk.common.hw, 7758c2ecf20Sopenharmony_ci [CLK_USB_HSIC_12M] = &usb_hsic_12m_clk.common.hw, 7768c2ecf20Sopenharmony_ci [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw, 7778c2ecf20Sopenharmony_ci [CLK_DRAM] = &dram_clk.common.hw, 7788c2ecf20Sopenharmony_ci [CLK_DRAM_VE] = &dram_ve_clk.common.hw, 7798c2ecf20Sopenharmony_ci [CLK_DRAM_CSI] = &dram_csi_clk.common.hw, 7808c2ecf20Sopenharmony_ci [CLK_TCON0] = &tcon0_clk.common.hw, 7818c2ecf20Sopenharmony_ci [CLK_TCON1] = &tcon1_clk.common.hw, 7828c2ecf20Sopenharmony_ci [CLK_CSI_MISC] = &csi_misc_clk.common.hw, 7838c2ecf20Sopenharmony_ci [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw, 7848c2ecf20Sopenharmony_ci [CLK_CSI_MCLK] = &csi_mclk_clk.common.hw, 7858c2ecf20Sopenharmony_ci [CLK_CSI_SCLK] = &csi_sclk_clk.common.hw, 7868c2ecf20Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 7878c2ecf20Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 7888c2ecf20Sopenharmony_ci [CLK_HDMI] = &hdmi_clk.common.hw, 7898c2ecf20Sopenharmony_ci [CLK_HDMI_SLOW] = &hdmi_slow_clk.common.hw, 7908c2ecf20Sopenharmony_ci [CLK_MBUS] = &mbus_clk.common.hw, 7918c2ecf20Sopenharmony_ci [CLK_MIPI_DSI0] = &mipi_dsi0_clk.common.hw, 7928c2ecf20Sopenharmony_ci [CLK_MIPI_DSI1] = &mipi_dsi1_clk.common.hw, 7938c2ecf20Sopenharmony_ci [CLK_GPU_CORE] = &gpu_core_clk.common.hw, 7948c2ecf20Sopenharmony_ci [CLK_GPU_MEMORY] = &gpu_memory_clk.common.hw, 7958c2ecf20Sopenharmony_ci [CLK_GPU_HYD] = &gpu_hyd_clk.common.hw, 7968c2ecf20Sopenharmony_ci }, 7978c2ecf20Sopenharmony_ci .num = CLK_NUMBER, 7988c2ecf20Sopenharmony_ci}; 7998c2ecf20Sopenharmony_ci 8008c2ecf20Sopenharmony_cistatic struct ccu_reset_map sun8i_a83t_ccu_resets[] = { 8018c2ecf20Sopenharmony_ci [RST_USB_PHY0] = { 0x0cc, BIT(0) }, 8028c2ecf20Sopenharmony_ci [RST_USB_PHY1] = { 0x0cc, BIT(1) }, 8038c2ecf20Sopenharmony_ci [RST_USB_HSIC] = { 0x0cc, BIT(2) }, 8048c2ecf20Sopenharmony_ci [RST_DRAM] = { 0x0f4, BIT(31) }, 8058c2ecf20Sopenharmony_ci [RST_MBUS] = { 0x0fc, BIT(31) }, 8068c2ecf20Sopenharmony_ci [RST_BUS_MIPI_DSI] = { 0x2c0, BIT(1) }, 8078c2ecf20Sopenharmony_ci [RST_BUS_SS] = { 0x2c0, BIT(5) }, 8088c2ecf20Sopenharmony_ci [RST_BUS_DMA] = { 0x2c0, BIT(6) }, 8098c2ecf20Sopenharmony_ci [RST_BUS_MMC0] = { 0x2c0, BIT(8) }, 8108c2ecf20Sopenharmony_ci [RST_BUS_MMC1] = { 0x2c0, BIT(9) }, 8118c2ecf20Sopenharmony_ci [RST_BUS_MMC2] = { 0x2c0, BIT(10) }, 8128c2ecf20Sopenharmony_ci [RST_BUS_NAND] = { 0x2c0, BIT(13) }, 8138c2ecf20Sopenharmony_ci [RST_BUS_DRAM] = { 0x2c0, BIT(14) }, 8148c2ecf20Sopenharmony_ci [RST_BUS_EMAC] = { 0x2c0, BIT(17) }, 8158c2ecf20Sopenharmony_ci [RST_BUS_HSTIMER] = { 0x2c0, BIT(19) }, 8168c2ecf20Sopenharmony_ci [RST_BUS_SPI0] = { 0x2c0, BIT(20) }, 8178c2ecf20Sopenharmony_ci [RST_BUS_SPI1] = { 0x2c0, BIT(21) }, 8188c2ecf20Sopenharmony_ci [RST_BUS_OTG] = { 0x2c0, BIT(24) }, 8198c2ecf20Sopenharmony_ci [RST_BUS_EHCI0] = { 0x2c0, BIT(26) }, 8208c2ecf20Sopenharmony_ci [RST_BUS_EHCI1] = { 0x2c0, BIT(27) }, 8218c2ecf20Sopenharmony_ci [RST_BUS_OHCI0] = { 0x2c0, BIT(29) }, 8228c2ecf20Sopenharmony_ci [RST_BUS_VE] = { 0x2c4, BIT(0) }, 8238c2ecf20Sopenharmony_ci [RST_BUS_TCON0] = { 0x2c4, BIT(4) }, 8248c2ecf20Sopenharmony_ci [RST_BUS_TCON1] = { 0x2c4, BIT(5) }, 8258c2ecf20Sopenharmony_ci [RST_BUS_CSI] = { 0x2c4, BIT(8) }, 8268c2ecf20Sopenharmony_ci [RST_BUS_HDMI0] = { 0x2c4, BIT(10) }, 8278c2ecf20Sopenharmony_ci [RST_BUS_HDMI1] = { 0x2c4, BIT(11) }, 8288c2ecf20Sopenharmony_ci [RST_BUS_DE] = { 0x2c4, BIT(12) }, 8298c2ecf20Sopenharmony_ci [RST_BUS_GPU] = { 0x2c4, BIT(20) }, 8308c2ecf20Sopenharmony_ci [RST_BUS_MSGBOX] = { 0x2c4, BIT(21) }, 8318c2ecf20Sopenharmony_ci [RST_BUS_SPINLOCK] = { 0x2c4, BIT(22) }, 8328c2ecf20Sopenharmony_ci [RST_BUS_LVDS] = { 0x2c8, BIT(0) }, 8338c2ecf20Sopenharmony_ci [RST_BUS_SPDIF] = { 0x2d0, BIT(1) }, 8348c2ecf20Sopenharmony_ci [RST_BUS_I2S0] = { 0x2d0, BIT(12) }, 8358c2ecf20Sopenharmony_ci [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, 8368c2ecf20Sopenharmony_ci [RST_BUS_I2S2] = { 0x2d0, BIT(14) }, 8378c2ecf20Sopenharmony_ci [RST_BUS_TDM] = { 0x2d0, BIT(15) }, 8388c2ecf20Sopenharmony_ci [RST_BUS_I2C0] = { 0x2d8, BIT(0) }, 8398c2ecf20Sopenharmony_ci [RST_BUS_I2C1] = { 0x2d8, BIT(1) }, 8408c2ecf20Sopenharmony_ci [RST_BUS_I2C2] = { 0x2d8, BIT(2) }, 8418c2ecf20Sopenharmony_ci [RST_BUS_UART0] = { 0x2d8, BIT(16) }, 8428c2ecf20Sopenharmony_ci [RST_BUS_UART1] = { 0x2d8, BIT(17) }, 8438c2ecf20Sopenharmony_ci [RST_BUS_UART2] = { 0x2d8, BIT(18) }, 8448c2ecf20Sopenharmony_ci [RST_BUS_UART3] = { 0x2d8, BIT(19) }, 8458c2ecf20Sopenharmony_ci [RST_BUS_UART4] = { 0x2d8, BIT(20) }, 8468c2ecf20Sopenharmony_ci}; 8478c2ecf20Sopenharmony_ci 8488c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun8i_a83t_ccu_desc = { 8498c2ecf20Sopenharmony_ci .ccu_clks = sun8i_a83t_ccu_clks, 8508c2ecf20Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun8i_a83t_ccu_clks), 8518c2ecf20Sopenharmony_ci 8528c2ecf20Sopenharmony_ci .hw_clks = &sun8i_a83t_hw_clks, 8538c2ecf20Sopenharmony_ci 8548c2ecf20Sopenharmony_ci .resets = sun8i_a83t_ccu_resets, 8558c2ecf20Sopenharmony_ci .num_resets = ARRAY_SIZE(sun8i_a83t_ccu_resets), 8568c2ecf20Sopenharmony_ci}; 8578c2ecf20Sopenharmony_ci 8588c2ecf20Sopenharmony_ci#define SUN8I_A83T_PLL_P_SHIFT 16 8598c2ecf20Sopenharmony_ci#define SUN8I_A83T_PLL_N_SHIFT 8 8608c2ecf20Sopenharmony_ci#define SUN8I_A83T_PLL_N_WIDTH 8 8618c2ecf20Sopenharmony_ci 8628c2ecf20Sopenharmony_cistatic void sun8i_a83t_cpu_pll_fixup(void __iomem *reg) 8638c2ecf20Sopenharmony_ci{ 8648c2ecf20Sopenharmony_ci u32 val = readl(reg); 8658c2ecf20Sopenharmony_ci 8668c2ecf20Sopenharmony_ci /* bail out if P divider is not used */ 8678c2ecf20Sopenharmony_ci if (!(val & BIT(SUN8I_A83T_PLL_P_SHIFT))) 8688c2ecf20Sopenharmony_ci return; 8698c2ecf20Sopenharmony_ci 8708c2ecf20Sopenharmony_ci /* 8718c2ecf20Sopenharmony_ci * If P is used, output should be less than 288 MHz. When we 8728c2ecf20Sopenharmony_ci * set P to 1, we should also decrease the multiplier so the 8738c2ecf20Sopenharmony_ci * output doesn't go out of range, but not too much such that 8748c2ecf20Sopenharmony_ci * the multiplier stays above 12, the minimal operation value. 8758c2ecf20Sopenharmony_ci * 8768c2ecf20Sopenharmony_ci * To keep it simple, set the multiplier to 17, the reset value. 8778c2ecf20Sopenharmony_ci */ 8788c2ecf20Sopenharmony_ci val &= ~GENMASK(SUN8I_A83T_PLL_N_SHIFT + SUN8I_A83T_PLL_N_WIDTH - 1, 8798c2ecf20Sopenharmony_ci SUN8I_A83T_PLL_N_SHIFT); 8808c2ecf20Sopenharmony_ci val |= 17 << SUN8I_A83T_PLL_N_SHIFT; 8818c2ecf20Sopenharmony_ci 8828c2ecf20Sopenharmony_ci /* And clear P */ 8838c2ecf20Sopenharmony_ci val &= ~BIT(SUN8I_A83T_PLL_P_SHIFT); 8848c2ecf20Sopenharmony_ci 8858c2ecf20Sopenharmony_ci writel(val, reg); 8868c2ecf20Sopenharmony_ci} 8878c2ecf20Sopenharmony_ci 8888c2ecf20Sopenharmony_cistatic int sun8i_a83t_ccu_probe(struct platform_device *pdev) 8898c2ecf20Sopenharmony_ci{ 8908c2ecf20Sopenharmony_ci struct resource *res; 8918c2ecf20Sopenharmony_ci void __iomem *reg; 8928c2ecf20Sopenharmony_ci u32 val; 8938c2ecf20Sopenharmony_ci 8948c2ecf20Sopenharmony_ci res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 8958c2ecf20Sopenharmony_ci reg = devm_ioremap_resource(&pdev->dev, res); 8968c2ecf20Sopenharmony_ci if (IS_ERR(reg)) 8978c2ecf20Sopenharmony_ci return PTR_ERR(reg); 8988c2ecf20Sopenharmony_ci 8998c2ecf20Sopenharmony_ci /* Enforce d1 = 0, d2 = 1 for Audio PLL */ 9008c2ecf20Sopenharmony_ci val = readl(reg + SUN8I_A83T_PLL_AUDIO_REG); 9018c2ecf20Sopenharmony_ci val &= ~BIT(16); 9028c2ecf20Sopenharmony_ci val |= BIT(18); 9038c2ecf20Sopenharmony_ci writel(val, reg + SUN8I_A83T_PLL_AUDIO_REG); 9048c2ecf20Sopenharmony_ci 9058c2ecf20Sopenharmony_ci /* Enforce P = 1 for both CPU cluster PLLs */ 9068c2ecf20Sopenharmony_ci sun8i_a83t_cpu_pll_fixup(reg + SUN8I_A83T_PLL_C0CPUX_REG); 9078c2ecf20Sopenharmony_ci sun8i_a83t_cpu_pll_fixup(reg + SUN8I_A83T_PLL_C1CPUX_REG); 9088c2ecf20Sopenharmony_ci 9098c2ecf20Sopenharmony_ci return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun8i_a83t_ccu_desc); 9108c2ecf20Sopenharmony_ci} 9118c2ecf20Sopenharmony_ci 9128c2ecf20Sopenharmony_cistatic const struct of_device_id sun8i_a83t_ccu_ids[] = { 9138c2ecf20Sopenharmony_ci { .compatible = "allwinner,sun8i-a83t-ccu" }, 9148c2ecf20Sopenharmony_ci { } 9158c2ecf20Sopenharmony_ci}; 9168c2ecf20Sopenharmony_ci 9178c2ecf20Sopenharmony_cistatic struct platform_driver sun8i_a83t_ccu_driver = { 9188c2ecf20Sopenharmony_ci .probe = sun8i_a83t_ccu_probe, 9198c2ecf20Sopenharmony_ci .driver = { 9208c2ecf20Sopenharmony_ci .name = "sun8i-a83t-ccu", 9218c2ecf20Sopenharmony_ci .of_match_table = sun8i_a83t_ccu_ids, 9228c2ecf20Sopenharmony_ci }, 9238c2ecf20Sopenharmony_ci}; 9248c2ecf20Sopenharmony_cibuiltin_platform_driver(sun8i_a83t_ccu_driver); 925