18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2016 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_nkmp.h" 188c2ecf20Sopenharmony_ci#include "ccu_nm.h" 198c2ecf20Sopenharmony_ci#include "ccu_phase.h" 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#include "ccu-sun9i-a80.h" 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define CCU_SUN9I_LOCK_REG 0x09c 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci/* 268c2ecf20Sopenharmony_ci * The CPU PLLs are actually NP clocks, with P being /1 or /4. However 278c2ecf20Sopenharmony_ci * P should only be used for output frequencies lower than 228 MHz. 288c2ecf20Sopenharmony_ci * Neither mainline Linux, U-boot, nor the vendor BSPs use these. 298c2ecf20Sopenharmony_ci * 308c2ecf20Sopenharmony_ci * For now we can just model it as a multiplier clock, and force P to /1. 318c2ecf20Sopenharmony_ci */ 328c2ecf20Sopenharmony_ci#define SUN9I_A80_PLL_C0CPUX_REG 0x000 338c2ecf20Sopenharmony_ci#define SUN9I_A80_PLL_C1CPUX_REG 0x004 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistatic struct ccu_mult pll_c0cpux_clk = { 368c2ecf20Sopenharmony_ci .enable = BIT(31), 378c2ecf20Sopenharmony_ci .lock = BIT(0), 388c2ecf20Sopenharmony_ci .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 398c2ecf20Sopenharmony_ci .common = { 408c2ecf20Sopenharmony_ci .reg = SUN9I_A80_PLL_C0CPUX_REG, 418c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 428c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 438c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-c0cpux", "osc24M", 448c2ecf20Sopenharmony_ci &ccu_mult_ops, 458c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 468c2ecf20Sopenharmony_ci }, 478c2ecf20Sopenharmony_ci}; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_cistatic struct ccu_mult pll_c1cpux_clk = { 508c2ecf20Sopenharmony_ci .enable = BIT(31), 518c2ecf20Sopenharmony_ci .lock = BIT(1), 528c2ecf20Sopenharmony_ci .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 538c2ecf20Sopenharmony_ci .common = { 548c2ecf20Sopenharmony_ci .reg = SUN9I_A80_PLL_C1CPUX_REG, 558c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 568c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 578c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-c1cpux", "osc24M", 588c2ecf20Sopenharmony_ci &ccu_mult_ops, 598c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 608c2ecf20Sopenharmony_ci }, 618c2ecf20Sopenharmony_ci}; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* 648c2ecf20Sopenharmony_ci * The Audio PLL has d1, d2 dividers in addition to the usual N, M 658c2ecf20Sopenharmony_ci * factors. Since we only need 2 frequencies from this PLL: 22.5792 MHz 668c2ecf20Sopenharmony_ci * and 24.576 MHz, ignore them for now. Enforce d1 = 0 and d2 = 0. 678c2ecf20Sopenharmony_ci */ 688c2ecf20Sopenharmony_ci#define SUN9I_A80_PLL_AUDIO_REG 0x008 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cistatic struct ccu_nm pll_audio_clk = { 718c2ecf20Sopenharmony_ci .enable = BIT(31), 728c2ecf20Sopenharmony_ci .lock = BIT(2), 738c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 748c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV_OFFSET(0, 6, 0), 758c2ecf20Sopenharmony_ci .common = { 768c2ecf20Sopenharmony_ci .reg = 0x008, 778c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 788c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 798c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-audio", "osc24M", 808c2ecf20Sopenharmony_ci &ccu_nm_ops, CLK_SET_RATE_UNGATE), 818c2ecf20Sopenharmony_ci }, 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/* Some PLLs are input * N / div1 / div2. Model them as NKMP with no K */ 858c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_periph0_clk = { 868c2ecf20Sopenharmony_ci .enable = BIT(31), 878c2ecf20Sopenharmony_ci .lock = BIT(3), 888c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 898c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 908c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 918c2ecf20Sopenharmony_ci .common = { 928c2ecf20Sopenharmony_ci .reg = 0x00c, 938c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 948c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 958c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-periph0", "osc24M", 968c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 978c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 988c2ecf20Sopenharmony_ci }, 998c2ecf20Sopenharmony_ci}; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_ve_clk = { 1028c2ecf20Sopenharmony_ci .enable = BIT(31), 1038c2ecf20Sopenharmony_ci .lock = BIT(4), 1048c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1058c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1068c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 1078c2ecf20Sopenharmony_ci .common = { 1088c2ecf20Sopenharmony_ci .reg = 0x010, 1098c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 1108c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1118c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ve", "osc24M", 1128c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1138c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1148c2ecf20Sopenharmony_ci }, 1158c2ecf20Sopenharmony_ci}; 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_ddr_clk = { 1188c2ecf20Sopenharmony_ci .enable = BIT(31), 1198c2ecf20Sopenharmony_ci .lock = BIT(5), 1208c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1218c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1228c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 1238c2ecf20Sopenharmony_ci .common = { 1248c2ecf20Sopenharmony_ci .reg = 0x014, 1258c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 1268c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1278c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ddr", "osc24M", 1288c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1298c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1308c2ecf20Sopenharmony_ci }, 1318c2ecf20Sopenharmony_ci}; 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_cistatic struct ccu_nm pll_video0_clk = { 1348c2ecf20Sopenharmony_ci .enable = BIT(31), 1358c2ecf20Sopenharmony_ci .lock = BIT(6), 1368c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1378c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1388c2ecf20Sopenharmony_ci .common = { 1398c2ecf20Sopenharmony_ci .reg = 0x018, 1408c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 1418c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1428c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video0", "osc24M", 1438c2ecf20Sopenharmony_ci &ccu_nm_ops, 1448c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1458c2ecf20Sopenharmony_ci }, 1468c2ecf20Sopenharmony_ci}; 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_video1_clk = { 1498c2ecf20Sopenharmony_ci .enable = BIT(31), 1508c2ecf20Sopenharmony_ci .lock = BIT(7), 1518c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1528c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1538c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 2), /* external divider p */ 1548c2ecf20Sopenharmony_ci .common = { 1558c2ecf20Sopenharmony_ci .reg = 0x01c, 1568c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 1578c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1588c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video1", "osc24M", 1598c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1608c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1618c2ecf20Sopenharmony_ci }, 1628c2ecf20Sopenharmony_ci}; 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_gpu_clk = { 1658c2ecf20Sopenharmony_ci .enable = BIT(31), 1668c2ecf20Sopenharmony_ci .lock = BIT(8), 1678c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1688c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1698c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 1708c2ecf20Sopenharmony_ci .common = { 1718c2ecf20Sopenharmony_ci .reg = 0x020, 1728c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 1738c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1748c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-gpu", "osc24M", 1758c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1768c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1778c2ecf20Sopenharmony_ci }, 1788c2ecf20Sopenharmony_ci}; 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_de_clk = { 1818c2ecf20Sopenharmony_ci .enable = BIT(31), 1828c2ecf20Sopenharmony_ci .lock = BIT(9), 1838c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 1848c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 1858c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 1868c2ecf20Sopenharmony_ci .common = { 1878c2ecf20Sopenharmony_ci .reg = 0x024, 1888c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 1898c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 1908c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-de", "osc24M", 1918c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1928c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1938c2ecf20Sopenharmony_ci }, 1948c2ecf20Sopenharmony_ci}; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_isp_clk = { 1978c2ecf20Sopenharmony_ci .enable = BIT(31), 1988c2ecf20Sopenharmony_ci .lock = BIT(10), 1998c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 2008c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 2018c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 2028c2ecf20Sopenharmony_ci .common = { 2038c2ecf20Sopenharmony_ci .reg = 0x028, 2048c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 2058c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 2068c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-isp", "osc24M", 2078c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 2088c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 2098c2ecf20Sopenharmony_ci }, 2108c2ecf20Sopenharmony_ci}; 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_periph1_clk = { 2138c2ecf20Sopenharmony_ci .enable = BIT(31), 2148c2ecf20Sopenharmony_ci .lock = BIT(11), 2158c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 2168c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 2178c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 2188c2ecf20Sopenharmony_ci .common = { 2198c2ecf20Sopenharmony_ci .reg = 0x028, 2208c2ecf20Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 2218c2ecf20Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 2228c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-periph1", "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, 0, 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, 8, 1, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_cistatic struct clk_div_table axi_div_table[] = { 2378c2ecf20Sopenharmony_ci { .val = 0, .div = 1 }, 2388c2ecf20Sopenharmony_ci { .val = 1, .div = 2 }, 2398c2ecf20Sopenharmony_ci { .val = 2, .div = 3 }, 2408c2ecf20Sopenharmony_ci { .val = 3, .div = 4 }, 2418c2ecf20Sopenharmony_ci { .val = 4, .div = 4 }, 2428c2ecf20Sopenharmony_ci { .val = 5, .div = 4 }, 2438c2ecf20Sopenharmony_ci { .val = 6, .div = 4 }, 2448c2ecf20Sopenharmony_ci { .val = 7, .div = 4 }, 2458c2ecf20Sopenharmony_ci { /* Sentinel */ }, 2468c2ecf20Sopenharmony_ci}; 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(atb0_clk, "atb0", "c0cpux", 0x054, 8, 2, 0); 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(axi0_clk, "axi0", "c0cpux", 2518c2ecf20Sopenharmony_ci 0x054, 0, 3, axi_div_table, 0); 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(atb1_clk, "atb1", "c1cpux", 0x058, 8, 2, 0); 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(axi1_clk, "axi1", "c1cpux", 2568c2ecf20Sopenharmony_ci 0x058, 0, 3, axi_div_table, 0); 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_cistatic const char * const gtbus_parents[] = { "osc24M", "pll-periph0", 2598c2ecf20Sopenharmony_ci "pll-periph1", "pll-periph1" }; 2608c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX(gtbus_clk, "gtbus", gtbus_parents, 2618c2ecf20Sopenharmony_ci 0x05c, 0, 2, 24, 2, CLK_IS_CRITICAL); 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_cistatic const char * const ahb_parents[] = { "gtbus", "pll-periph0", 2648c2ecf20Sopenharmony_ci "pll-periph1", "pll-periph1" }; 2658c2ecf20Sopenharmony_cistatic struct ccu_div ahb0_clk = { 2668c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 2678c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 2688c2ecf20Sopenharmony_ci .common = { 2698c2ecf20Sopenharmony_ci .reg = 0x060, 2708c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb0", 2718c2ecf20Sopenharmony_ci ahb_parents, 2728c2ecf20Sopenharmony_ci &ccu_div_ops, 2738c2ecf20Sopenharmony_ci 0), 2748c2ecf20Sopenharmony_ci }, 2758c2ecf20Sopenharmony_ci}; 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_cistatic struct ccu_div ahb1_clk = { 2788c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 2798c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 2808c2ecf20Sopenharmony_ci .common = { 2818c2ecf20Sopenharmony_ci .reg = 0x064, 2828c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb1", 2838c2ecf20Sopenharmony_ci ahb_parents, 2848c2ecf20Sopenharmony_ci &ccu_div_ops, 2858c2ecf20Sopenharmony_ci 0), 2868c2ecf20Sopenharmony_ci }, 2878c2ecf20Sopenharmony_ci}; 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_cistatic struct ccu_div ahb2_clk = { 2908c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 2918c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 2928c2ecf20Sopenharmony_ci .common = { 2938c2ecf20Sopenharmony_ci .reg = 0x068, 2948c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb2", 2958c2ecf20Sopenharmony_ci ahb_parents, 2968c2ecf20Sopenharmony_ci &ccu_div_ops, 2978c2ecf20Sopenharmony_ci 0), 2988c2ecf20Sopenharmony_ci }, 2998c2ecf20Sopenharmony_ci}; 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_cistatic const char * const apb_parents[] = { "osc24M", "pll-periph0" }; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_cistatic struct ccu_div apb0_clk = { 3048c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 3058c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 1), 3068c2ecf20Sopenharmony_ci .common = { 3078c2ecf20Sopenharmony_ci .reg = 0x070, 3088c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("apb0", 3098c2ecf20Sopenharmony_ci apb_parents, 3108c2ecf20Sopenharmony_ci &ccu_div_ops, 3118c2ecf20Sopenharmony_ci 0), 3128c2ecf20Sopenharmony_ci }, 3138c2ecf20Sopenharmony_ci}; 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_cistatic struct ccu_div apb1_clk = { 3168c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 3178c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 1), 3188c2ecf20Sopenharmony_ci .common = { 3198c2ecf20Sopenharmony_ci .reg = 0x074, 3208c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("apb1", 3218c2ecf20Sopenharmony_ci apb_parents, 3228c2ecf20Sopenharmony_ci &ccu_div_ops, 3238c2ecf20Sopenharmony_ci 0), 3248c2ecf20Sopenharmony_ci }, 3258c2ecf20Sopenharmony_ci}; 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_cistatic struct ccu_div cci400_clk = { 3288c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 3298c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 3308c2ecf20Sopenharmony_ci .common = { 3318c2ecf20Sopenharmony_ci .reg = 0x078, 3328c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("cci400", 3338c2ecf20Sopenharmony_ci ahb_parents, 3348c2ecf20Sopenharmony_ci &ccu_div_ops, 3358c2ecf20Sopenharmony_ci CLK_IS_CRITICAL), 3368c2ecf20Sopenharmony_ci }, 3378c2ecf20Sopenharmony_ci}; 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(ats_clk, "ats", apb_parents, 3408c2ecf20Sopenharmony_ci 0x080, 0, 3, 24, 2, BIT(31), 0); 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(trace_clk, "trace", apb_parents, 3438c2ecf20Sopenharmony_ci 0x084, 0, 3, 24, 2, BIT(31), 0); 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_cistatic const char * const out_parents[] = { "osc24M", "osc32k", "osc24M" }; 3468c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv out_prediv = { 3478c2ecf20Sopenharmony_ci .index = 0, .div = 750 3488c2ecf20Sopenharmony_ci}; 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_cistatic struct ccu_mp out_a_clk = { 3518c2ecf20Sopenharmony_ci .enable = BIT(31), 3528c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(8, 5), 3538c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(20, 2), 3548c2ecf20Sopenharmony_ci .mux = { 3558c2ecf20Sopenharmony_ci .shift = 24, 3568c2ecf20Sopenharmony_ci .width = 4, 3578c2ecf20Sopenharmony_ci .fixed_predivs = &out_prediv, 3588c2ecf20Sopenharmony_ci .n_predivs = 1, 3598c2ecf20Sopenharmony_ci }, 3608c2ecf20Sopenharmony_ci .common = { 3618c2ecf20Sopenharmony_ci .reg = 0x180, 3628c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 3638c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("out-a", 3648c2ecf20Sopenharmony_ci out_parents, 3658c2ecf20Sopenharmony_ci &ccu_mp_ops, 3668c2ecf20Sopenharmony_ci 0), 3678c2ecf20Sopenharmony_ci }, 3688c2ecf20Sopenharmony_ci}; 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_cistatic struct ccu_mp out_b_clk = { 3718c2ecf20Sopenharmony_ci .enable = BIT(31), 3728c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(8, 5), 3738c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(20, 2), 3748c2ecf20Sopenharmony_ci .mux = { 3758c2ecf20Sopenharmony_ci .shift = 24, 3768c2ecf20Sopenharmony_ci .width = 4, 3778c2ecf20Sopenharmony_ci .fixed_predivs = &out_prediv, 3788c2ecf20Sopenharmony_ci .n_predivs = 1, 3798c2ecf20Sopenharmony_ci }, 3808c2ecf20Sopenharmony_ci .common = { 3818c2ecf20Sopenharmony_ci .reg = 0x184, 3828c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 3838c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("out-b", 3848c2ecf20Sopenharmony_ci out_parents, 3858c2ecf20Sopenharmony_ci &ccu_mp_ops, 3868c2ecf20Sopenharmony_ci 0), 3878c2ecf20Sopenharmony_ci }, 3888c2ecf20Sopenharmony_ci}; 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_cistatic const char * const mod0_default_parents[] = { "osc24M", "pll-periph0" }; 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand0_0_clk, "nand0-0", mod0_default_parents, 3938c2ecf20Sopenharmony_ci 0x400, 3948c2ecf20Sopenharmony_ci 0, 4, /* M */ 3958c2ecf20Sopenharmony_ci 16, 2, /* P */ 3968c2ecf20Sopenharmony_ci 24, 4, /* mux */ 3978c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3988c2ecf20Sopenharmony_ci 0); 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand0_1_clk, "nand0-1", mod0_default_parents, 4018c2ecf20Sopenharmony_ci 0x404, 4028c2ecf20Sopenharmony_ci 0, 4, /* M */ 4038c2ecf20Sopenharmony_ci 16, 2, /* P */ 4048c2ecf20Sopenharmony_ci 24, 4, /* mux */ 4058c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4068c2ecf20Sopenharmony_ci 0); 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand1_0_clk, "nand1-0", mod0_default_parents, 4098c2ecf20Sopenharmony_ci 0x408, 4108c2ecf20Sopenharmony_ci 0, 4, /* M */ 4118c2ecf20Sopenharmony_ci 16, 2, /* P */ 4128c2ecf20Sopenharmony_ci 24, 4, /* mux */ 4138c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4148c2ecf20Sopenharmony_ci 0); 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand1_1_clk, "nand1-1", mod0_default_parents, 4178c2ecf20Sopenharmony_ci 0x40c, 4188c2ecf20Sopenharmony_ci 0, 4, /* M */ 4198c2ecf20Sopenharmony_ci 16, 2, /* P */ 4208c2ecf20Sopenharmony_ci 24, 4, /* mux */ 4218c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4228c2ecf20Sopenharmony_ci 0); 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 4258c2ecf20Sopenharmony_ci 0x410, 4268c2ecf20Sopenharmony_ci 0, 4, /* M */ 4278c2ecf20Sopenharmony_ci 16, 2, /* P */ 4288c2ecf20Sopenharmony_ci 24, 4, /* mux */ 4298c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4308c2ecf20Sopenharmony_ci 0); 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_sample_clk, "mmc0-sample", "mmc0", 4338c2ecf20Sopenharmony_ci 0x410, 20, 3, 0); 4348c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_output_clk, "mmc0-output", "mmc0", 4358c2ecf20Sopenharmony_ci 0x410, 8, 3, 0); 4368c2ecf20Sopenharmony_ci 4378c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 4388c2ecf20Sopenharmony_ci 0x414, 4398c2ecf20Sopenharmony_ci 0, 4, /* M */ 4408c2ecf20Sopenharmony_ci 16, 2, /* P */ 4418c2ecf20Sopenharmony_ci 24, 4, /* mux */ 4428c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4438c2ecf20Sopenharmony_ci 0); 4448c2ecf20Sopenharmony_ci 4458c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1-sample", "mmc1", 4468c2ecf20Sopenharmony_ci 0x414, 20, 3, 0); 4478c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1-output", "mmc1", 4488c2ecf20Sopenharmony_ci 0x414, 8, 3, 0); 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 4518c2ecf20Sopenharmony_ci 0x418, 4528c2ecf20Sopenharmony_ci 0, 4, /* M */ 4538c2ecf20Sopenharmony_ci 16, 2, /* P */ 4548c2ecf20Sopenharmony_ci 24, 4, /* mux */ 4558c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4568c2ecf20Sopenharmony_ci 0); 4578c2ecf20Sopenharmony_ci 4588c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2-sample", "mmc2", 4598c2ecf20Sopenharmony_ci 0x418, 20, 3, 0); 4608c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_output_clk, "mmc2-output", "mmc2", 4618c2ecf20Sopenharmony_ci 0x418, 8, 3, 0); 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc3_clk, "mmc3", mod0_default_parents, 4648c2ecf20Sopenharmony_ci 0x41c, 4658c2ecf20Sopenharmony_ci 0, 4, /* M */ 4668c2ecf20Sopenharmony_ci 16, 2, /* P */ 4678c2ecf20Sopenharmony_ci 24, 4, /* mux */ 4688c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4698c2ecf20Sopenharmony_ci 0); 4708c2ecf20Sopenharmony_ci 4718c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc3_sample_clk, "mmc3-sample", "mmc3", 4728c2ecf20Sopenharmony_ci 0x41c, 20, 3, 0); 4738c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc3_output_clk, "mmc3-output", "mmc3", 4748c2ecf20Sopenharmony_ci 0x41c, 8, 3, 0); 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ts_clk, "ts", mod0_default_parents, 4778c2ecf20Sopenharmony_ci 0x428, 4788c2ecf20Sopenharmony_ci 0, 4, /* M */ 4798c2ecf20Sopenharmony_ci 16, 2, /* P */ 4808c2ecf20Sopenharmony_ci 24, 4, /* mux */ 4818c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4828c2ecf20Sopenharmony_ci 0); 4838c2ecf20Sopenharmony_ci 4848c2ecf20Sopenharmony_cistatic const char * const ss_parents[] = { "osc24M", "pll-periph", 4858c2ecf20Sopenharmony_ci "pll-periph1" }; 4868c2ecf20Sopenharmony_cistatic const u8 ss_table[] = { 0, 1, 13 }; 4878c2ecf20Sopenharmony_cistatic struct ccu_mp ss_clk = { 4888c2ecf20Sopenharmony_ci .enable = BIT(31), 4898c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(0, 4), 4908c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(16, 2), 4918c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX_TABLE(24, 4, ss_table), 4928c2ecf20Sopenharmony_ci .common = { 4938c2ecf20Sopenharmony_ci .reg = 0x42c, 4948c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ss", 4958c2ecf20Sopenharmony_ci ss_parents, 4968c2ecf20Sopenharmony_ci &ccu_mp_ops, 4978c2ecf20Sopenharmony_ci 0), 4988c2ecf20Sopenharmony_ci }, 4998c2ecf20Sopenharmony_ci}; 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 5028c2ecf20Sopenharmony_ci 0x430, 5038c2ecf20Sopenharmony_ci 0, 4, /* M */ 5048c2ecf20Sopenharmony_ci 16, 2, /* P */ 5058c2ecf20Sopenharmony_ci 24, 4, /* mux */ 5068c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5078c2ecf20Sopenharmony_ci 0); 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 5108c2ecf20Sopenharmony_ci 0x434, 5118c2ecf20Sopenharmony_ci 0, 4, /* M */ 5128c2ecf20Sopenharmony_ci 16, 2, /* P */ 5138c2ecf20Sopenharmony_ci 24, 4, /* mux */ 5148c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5158c2ecf20Sopenharmony_ci 0); 5168c2ecf20Sopenharmony_ci 5178c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi2_clk, "spi2", mod0_default_parents, 5188c2ecf20Sopenharmony_ci 0x438, 5198c2ecf20Sopenharmony_ci 0, 4, /* M */ 5208c2ecf20Sopenharmony_ci 16, 2, /* P */ 5218c2ecf20Sopenharmony_ci 24, 4, /* mux */ 5228c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5238c2ecf20Sopenharmony_ci 0); 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi3_clk, "spi3", mod0_default_parents, 5268c2ecf20Sopenharmony_ci 0x43c, 5278c2ecf20Sopenharmony_ci 0, 4, /* M */ 5288c2ecf20Sopenharmony_ci 16, 2, /* P */ 5298c2ecf20Sopenharmony_ci 24, 4, /* mux */ 5308c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5318c2ecf20Sopenharmony_ci 0); 5328c2ecf20Sopenharmony_ci 5338c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(i2s0_clk, "i2s0", "pll-audio", 5348c2ecf20Sopenharmony_ci 0x440, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 5358c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(i2s1_clk, "i2s1", "pll-audio", 5368c2ecf20Sopenharmony_ci 0x444, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 5378c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(spdif_clk, "spdif", "pll-audio", 5388c2ecf20Sopenharmony_ci 0x44c, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 5398c2ecf20Sopenharmony_ci 5408c2ecf20Sopenharmony_cistatic const char * const sdram_parents[] = { "pll-periph0", "pll-ddr" }; 5418c2ecf20Sopenharmony_cistatic const u8 sdram_table[] = { 0, 3 }; 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(sdram_clk, "sdram", 5448c2ecf20Sopenharmony_ci sdram_parents, sdram_table, 5458c2ecf20Sopenharmony_ci 0x484, 5468c2ecf20Sopenharmony_ci 8, 4, /* M */ 5478c2ecf20Sopenharmony_ci 12, 4, /* mux */ 5488c2ecf20Sopenharmony_ci 0, /* no gate */ 5498c2ecf20Sopenharmony_ci CLK_IS_CRITICAL); 5508c2ecf20Sopenharmony_ci 5518c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(de_clk, "de", "pll-de", 0x490, 5528c2ecf20Sopenharmony_ci 0, 4, BIT(31), CLK_SET_RATE_PARENT); 5538c2ecf20Sopenharmony_ci 5548c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(edp_clk, "edp", "osc24M", 0x494, BIT(31), 0); 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_cistatic const char * const mp_parents[] = { "pll-video1", "pll-gpu", "pll-de" }; 5578c2ecf20Sopenharmony_cistatic const u8 mp_table[] = { 9, 10, 11 }; 5588c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(mp_clk, "mp", mp_parents, mp_table, 5598c2ecf20Sopenharmony_ci 0x498, 5608c2ecf20Sopenharmony_ci 0, 4, /* M */ 5618c2ecf20Sopenharmony_ci 24, 4, /* mux */ 5628c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5638c2ecf20Sopenharmony_ci 0); 5648c2ecf20Sopenharmony_ci 5658c2ecf20Sopenharmony_cistatic const char * const display_parents[] = { "pll-video0", "pll-video1" }; 5668c2ecf20Sopenharmony_cistatic const u8 display_table[] = { 8, 9 }; 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(lcd0_clk, "lcd0", 5698c2ecf20Sopenharmony_ci display_parents, display_table, 5708c2ecf20Sopenharmony_ci 0x49c, 5718c2ecf20Sopenharmony_ci 0, 4, /* M */ 5728c2ecf20Sopenharmony_ci 24, 4, /* mux */ 5738c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5748c2ecf20Sopenharmony_ci CLK_SET_RATE_NO_REPARENT | 5758c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(lcd1_clk, "lcd1", 5788c2ecf20Sopenharmony_ci display_parents, display_table, 5798c2ecf20Sopenharmony_ci 0x4a0, 5808c2ecf20Sopenharmony_ci 0, 4, /* M */ 5818c2ecf20Sopenharmony_ci 24, 4, /* mux */ 5828c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5838c2ecf20Sopenharmony_ci CLK_SET_RATE_NO_REPARENT | 5848c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 5858c2ecf20Sopenharmony_ci 5868c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(mipi_dsi0_clk, "mipi-dsi0", 5878c2ecf20Sopenharmony_ci display_parents, display_table, 5888c2ecf20Sopenharmony_ci 0x4a8, 5898c2ecf20Sopenharmony_ci 0, 4, /* M */ 5908c2ecf20Sopenharmony_ci 24, 4, /* mux */ 5918c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5928c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 5938c2ecf20Sopenharmony_ci 5948c2ecf20Sopenharmony_cistatic const char * const mipi_dsi1_parents[] = { "osc24M", "pll-video1" }; 5958c2ecf20Sopenharmony_cistatic const u8 mipi_dsi1_table[] = { 0, 9 }; 5968c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(mipi_dsi1_clk, "mipi-dsi1", 5978c2ecf20Sopenharmony_ci mipi_dsi1_parents, mipi_dsi1_table, 5988c2ecf20Sopenharmony_ci 0x4ac, 5998c2ecf20Sopenharmony_ci 0, 4, /* M */ 6008c2ecf20Sopenharmony_ci 24, 4, /* mux */ 6018c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6028c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 6038c2ecf20Sopenharmony_ci 6048c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(hdmi_clk, "hdmi", 6058c2ecf20Sopenharmony_ci display_parents, display_table, 6068c2ecf20Sopenharmony_ci 0x4b0, 6078c2ecf20Sopenharmony_ci 0, 4, /* M */ 6088c2ecf20Sopenharmony_ci 24, 4, /* mux */ 6098c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6108c2ecf20Sopenharmony_ci CLK_SET_RATE_NO_REPARENT | 6118c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 6128c2ecf20Sopenharmony_ci 6138c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(hdmi_slow_clk, "hdmi-slow", "osc24M", 0x4b4, BIT(31), 0); 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(mipi_csi_clk, "mipi-csi", "osc24M", 0x4bc, 6168c2ecf20Sopenharmony_ci 0, 4, BIT(31), 0); 6178c2ecf20Sopenharmony_ci 6188c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(csi_isp_clk, "csi-isp", "pll-isp", 0x4c0, 6198c2ecf20Sopenharmony_ci 0, 4, BIT(31), CLK_SET_RATE_PARENT); 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(csi_misc_clk, "csi-misc", "osc24M", 0x4c0, BIT(16), 0); 6228c2ecf20Sopenharmony_ci 6238c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi0_mclk_clk, "csi0-mclk", 6248c2ecf20Sopenharmony_ci mipi_dsi1_parents, mipi_dsi1_table, 6258c2ecf20Sopenharmony_ci 0x4c4, 6268c2ecf20Sopenharmony_ci 0, 4, /* M */ 6278c2ecf20Sopenharmony_ci 24, 4, /* mux */ 6288c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6298c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 6308c2ecf20Sopenharmony_ci 6318c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi1_mclk_clk, "csi1-mclk", 6328c2ecf20Sopenharmony_ci mipi_dsi1_parents, mipi_dsi1_table, 6338c2ecf20Sopenharmony_ci 0x4c8, 6348c2ecf20Sopenharmony_ci 0, 4, /* M */ 6358c2ecf20Sopenharmony_ci 24, 4, /* mux */ 6368c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6378c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_cistatic const char * const fd_parents[] = { "pll-periph0", "pll-isp" }; 6408c2ecf20Sopenharmony_cistatic const u8 fd_table[] = { 1, 12 }; 6418c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(fd_clk, "fd", fd_parents, fd_table, 6428c2ecf20Sopenharmony_ci 0x4cc, 6438c2ecf20Sopenharmony_ci 0, 4, /* M */ 6448c2ecf20Sopenharmony_ci 24, 4, /* mux */ 6458c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6468c2ecf20Sopenharmony_ci 0); 6478c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve", 0x4d0, 6488c2ecf20Sopenharmony_ci 16, 3, BIT(31), CLK_SET_RATE_PARENT); 6498c2ecf20Sopenharmony_ci 6508c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", 0x4d4, BIT(31), 0); 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(gpu_core_clk, "gpu-core", "pll-gpu", 0x4f0, 6538c2ecf20Sopenharmony_ci 0, 3, BIT(31), CLK_SET_RATE_PARENT); 6548c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(gpu_memory_clk, "gpu-memory", "pll-gpu", 0x4f4, 6558c2ecf20Sopenharmony_ci 0, 3, BIT(31), CLK_SET_RATE_PARENT); 6568c2ecf20Sopenharmony_ci 6578c2ecf20Sopenharmony_cistatic const char * const gpu_axi_parents[] = { "pll-periph0", "pll-gpu" }; 6588c2ecf20Sopenharmony_cistatic const u8 gpu_axi_table[] = { 1, 10 }; 6598c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(gpu_axi_clk, "gpu-axi", 6608c2ecf20Sopenharmony_ci gpu_axi_parents, gpu_axi_table, 6618c2ecf20Sopenharmony_ci 0x4f8, 6628c2ecf20Sopenharmony_ci 0, 4, /* M */ 6638c2ecf20Sopenharmony_ci 24, 4, /* mux */ 6648c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6658c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 6668c2ecf20Sopenharmony_ci 6678c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(sata_clk, "sata", "pll-periph0", 0x500, 6688c2ecf20Sopenharmony_ci 0, 4, BIT(31), 0); 6698c2ecf20Sopenharmony_ci 6708c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ac97_clk, "ac97", "pll-audio", 6718c2ecf20Sopenharmony_ci 0x504, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 6728c2ecf20Sopenharmony_ci 6738c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mipi_hsi_clk, "mipi-hsi", 6748c2ecf20Sopenharmony_ci mod0_default_parents, 0x508, 6758c2ecf20Sopenharmony_ci 0, 4, /* M */ 6768c2ecf20Sopenharmony_ci 24, 4, /* mux */ 6778c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6788c2ecf20Sopenharmony_ci 0); 6798c2ecf20Sopenharmony_ci 6808c2ecf20Sopenharmony_cistatic const char * const gpadc_parents[] = { "osc24M", "pll-audio", "osc32k" }; 6818c2ecf20Sopenharmony_cistatic const u8 gpadc_table[] = { 0, 4, 7 }; 6828c2ecf20Sopenharmony_cistatic struct ccu_mp gpadc_clk = { 6838c2ecf20Sopenharmony_ci .enable = BIT(31), 6848c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(0, 4), 6858c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(16, 2), 6868c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX_TABLE(24, 4, gpadc_table), 6878c2ecf20Sopenharmony_ci .common = { 6888c2ecf20Sopenharmony_ci .reg = 0x50c, 6898c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("gpadc", 6908c2ecf20Sopenharmony_ci gpadc_parents, 6918c2ecf20Sopenharmony_ci &ccu_mp_ops, 6928c2ecf20Sopenharmony_ci 0), 6938c2ecf20Sopenharmony_ci }, 6948c2ecf20Sopenharmony_ci}; 6958c2ecf20Sopenharmony_ci 6968c2ecf20Sopenharmony_cistatic const char * const cir_tx_parents[] = { "osc24M", "osc32k" }; 6978c2ecf20Sopenharmony_cistatic const u8 cir_tx_table[] = { 0, 7 }; 6988c2ecf20Sopenharmony_cistatic struct ccu_mp cir_tx_clk = { 6998c2ecf20Sopenharmony_ci .enable = BIT(31), 7008c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(0, 4), 7018c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(16, 2), 7028c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX_TABLE(24, 4, cir_tx_table), 7038c2ecf20Sopenharmony_ci .common = { 7048c2ecf20Sopenharmony_ci .reg = 0x510, 7058c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("cir-tx", 7068c2ecf20Sopenharmony_ci cir_tx_parents, 7078c2ecf20Sopenharmony_ci &ccu_mp_ops, 7088c2ecf20Sopenharmony_ci 0), 7098c2ecf20Sopenharmony_ci }, 7108c2ecf20Sopenharmony_ci}; 7118c2ecf20Sopenharmony_ci 7128c2ecf20Sopenharmony_ci/* AHB0 bus gates */ 7138c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_fd_clk, "bus-fd", "ahb0", 7148c2ecf20Sopenharmony_ci 0x580, BIT(0), 0); 7158c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "ahb0", 7168c2ecf20Sopenharmony_ci 0x580, BIT(1), 0); 7178c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gpu_ctrl_clk, "bus-gpu-ctrl", "ahb0", 7188c2ecf20Sopenharmony_ci 0x580, BIT(3), 0); 7198c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ss_clk, "bus-ss", "ahb0", 7208c2ecf20Sopenharmony_ci 0x580, BIT(5), 0); 7218c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc_clk, "bus-mmc", "ahb0", 7228c2ecf20Sopenharmony_ci 0x580, BIT(8), 0); 7238c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_nand0_clk, "bus-nand0", "ahb0", 7248c2ecf20Sopenharmony_ci 0x580, BIT(12), 0); 7258c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_nand1_clk, "bus-nand1", "ahb0", 7268c2ecf20Sopenharmony_ci 0x580, BIT(13), 0); 7278c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_sdram_clk, "bus-sdram", "ahb0", 7288c2ecf20Sopenharmony_ci 0x580, BIT(14), 0); 7298c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mipi_hsi_clk, "bus-mipi-hsi", "ahb0", 7308c2ecf20Sopenharmony_ci 0x580, BIT(15), 0); 7318c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_sata_clk, "bus-sata", "ahb0", 7328c2ecf20Sopenharmony_ci 0x580, BIT(16), 0); 7338c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ts_clk, "bus-ts", "ahb0", 7348c2ecf20Sopenharmony_ci 0x580, BIT(18), 0); 7358c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb0", 7368c2ecf20Sopenharmony_ci 0x580, BIT(20), 0); 7378c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi1_clk, "bus-spi1", "ahb0", 7388c2ecf20Sopenharmony_ci 0x580, BIT(21), 0); 7398c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi2_clk, "bus-spi2", "ahb0", 7408c2ecf20Sopenharmony_ci 0x580, BIT(22), 0); 7418c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi3_clk, "bus-spi3", "ahb0", 7428c2ecf20Sopenharmony_ci 0x580, BIT(23), 0); 7438c2ecf20Sopenharmony_ci 7448c2ecf20Sopenharmony_ci/* AHB1 bus gates */ 7458c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb1", 7468c2ecf20Sopenharmony_ci 0x584, BIT(0), 0); 7478c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_usb_clk, "bus-usb", "ahb1", 7488c2ecf20Sopenharmony_ci 0x584, BIT(1), 0); 7498c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gmac_clk, "bus-gmac", "ahb1", 7508c2ecf20Sopenharmony_ci 0x584, BIT(17), 0); 7518c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_msgbox_clk, "bus-msgbox", "ahb1", 7528c2ecf20Sopenharmony_ci 0x584, BIT(21), 0); 7538c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spinlock_clk, "bus-spinlock", "ahb1", 7548c2ecf20Sopenharmony_ci 0x584, BIT(22), 0); 7558c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "ahb1", 7568c2ecf20Sopenharmony_ci 0x584, BIT(23), 0); 7578c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "ahb1", 7588c2ecf20Sopenharmony_ci 0x584, BIT(24), 0); 7598c2ecf20Sopenharmony_ci 7608c2ecf20Sopenharmony_ci/* AHB2 bus gates */ 7618c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_lcd0_clk, "bus-lcd0", "ahb2", 7628c2ecf20Sopenharmony_ci 0x588, BIT(0), 0); 7638c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_lcd1_clk, "bus-lcd1", "ahb2", 7648c2ecf20Sopenharmony_ci 0x588, BIT(1), 0); 7658c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_edp_clk, "bus-edp", "ahb2", 7668c2ecf20Sopenharmony_ci 0x588, BIT(2), 0); 7678c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_csi_clk, "bus-csi", "ahb2", 7688c2ecf20Sopenharmony_ci 0x588, BIT(4), 0); 7698c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hdmi_clk, "bus-hdmi", "ahb2", 7708c2ecf20Sopenharmony_ci 0x588, BIT(5), 0); 7718c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_de_clk, "bus-de", "ahb2", 7728c2ecf20Sopenharmony_ci 0x588, BIT(7), 0); 7738c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mp_clk, "bus-mp", "ahb2", 7748c2ecf20Sopenharmony_ci 0x588, BIT(8), 0); 7758c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mipi_dsi_clk, "bus-mipi-dsi", "ahb2", 7768c2ecf20Sopenharmony_ci 0x588, BIT(11), 0); 7778c2ecf20Sopenharmony_ci 7788c2ecf20Sopenharmony_ci/* APB0 bus gates */ 7798c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spdif_clk, "bus-spdif", "apb0", 7808c2ecf20Sopenharmony_ci 0x590, BIT(1), 0); 7818c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_pio_clk, "bus-pio", "apb0", 7828c2ecf20Sopenharmony_ci 0x590, BIT(5), 0); 7838c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ac97_clk, "bus-ac97", "apb0", 7848c2ecf20Sopenharmony_ci 0x590, BIT(11), 0); 7858c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s0_clk, "bus-i2s0", "apb0", 7868c2ecf20Sopenharmony_ci 0x590, BIT(12), 0); 7878c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s1_clk, "bus-i2s1", "apb0", 7888c2ecf20Sopenharmony_ci 0x590, BIT(13), 0); 7898c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_lradc_clk, "bus-lradc", "apb0", 7908c2ecf20Sopenharmony_ci 0x590, BIT(15), 0); 7918c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gpadc_clk, "bus-gpadc", "apb0", 7928c2ecf20Sopenharmony_ci 0x590, BIT(17), 0); 7938c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_twd_clk, "bus-twd", "apb0", 7948c2ecf20Sopenharmony_ci 0x590, BIT(18), 0); 7958c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_cir_tx_clk, "bus-cir-tx", "apb0", 7968c2ecf20Sopenharmony_ci 0x590, BIT(19), 0); 7978c2ecf20Sopenharmony_ci 7988c2ecf20Sopenharmony_ci/* APB1 bus gates */ 7998c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb1", 8008c2ecf20Sopenharmony_ci 0x594, BIT(0), 0); 8018c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb1", 8028c2ecf20Sopenharmony_ci 0x594, BIT(1), 0); 8038c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb1", 8048c2ecf20Sopenharmony_ci 0x594, BIT(2), 0); 8058c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c3_clk, "bus-i2c3", "apb1", 8068c2ecf20Sopenharmony_ci 0x594, BIT(3), 0); 8078c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c4_clk, "bus-i2c4", "apb1", 8088c2ecf20Sopenharmony_ci 0x594, BIT(4), 0); 8098c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb1", 8108c2ecf20Sopenharmony_ci 0x594, BIT(16), 0); 8118c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb1", 8128c2ecf20Sopenharmony_ci 0x594, BIT(17), 0); 8138c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb1", 8148c2ecf20Sopenharmony_ci 0x594, BIT(18), 0); 8158c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb1", 8168c2ecf20Sopenharmony_ci 0x594, BIT(19), 0); 8178c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart4_clk, "bus-uart4", "apb1", 8188c2ecf20Sopenharmony_ci 0x594, BIT(20), 0); 8198c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart5_clk, "bus-uart5", "apb1", 8208c2ecf20Sopenharmony_ci 0x594, BIT(21), 0); 8218c2ecf20Sopenharmony_ci 8228c2ecf20Sopenharmony_cistatic struct ccu_common *sun9i_a80_ccu_clks[] = { 8238c2ecf20Sopenharmony_ci &pll_c0cpux_clk.common, 8248c2ecf20Sopenharmony_ci &pll_c1cpux_clk.common, 8258c2ecf20Sopenharmony_ci &pll_audio_clk.common, 8268c2ecf20Sopenharmony_ci &pll_periph0_clk.common, 8278c2ecf20Sopenharmony_ci &pll_ve_clk.common, 8288c2ecf20Sopenharmony_ci &pll_ddr_clk.common, 8298c2ecf20Sopenharmony_ci &pll_video0_clk.common, 8308c2ecf20Sopenharmony_ci &pll_video1_clk.common, 8318c2ecf20Sopenharmony_ci &pll_gpu_clk.common, 8328c2ecf20Sopenharmony_ci &pll_de_clk.common, 8338c2ecf20Sopenharmony_ci &pll_isp_clk.common, 8348c2ecf20Sopenharmony_ci &pll_periph1_clk.common, 8358c2ecf20Sopenharmony_ci &c0cpux_clk.common, 8368c2ecf20Sopenharmony_ci &c1cpux_clk.common, 8378c2ecf20Sopenharmony_ci &atb0_clk.common, 8388c2ecf20Sopenharmony_ci &axi0_clk.common, 8398c2ecf20Sopenharmony_ci &atb1_clk.common, 8408c2ecf20Sopenharmony_ci &axi1_clk.common, 8418c2ecf20Sopenharmony_ci >bus_clk.common, 8428c2ecf20Sopenharmony_ci &ahb0_clk.common, 8438c2ecf20Sopenharmony_ci &ahb1_clk.common, 8448c2ecf20Sopenharmony_ci &ahb2_clk.common, 8458c2ecf20Sopenharmony_ci &apb0_clk.common, 8468c2ecf20Sopenharmony_ci &apb1_clk.common, 8478c2ecf20Sopenharmony_ci &cci400_clk.common, 8488c2ecf20Sopenharmony_ci &ats_clk.common, 8498c2ecf20Sopenharmony_ci &trace_clk.common, 8508c2ecf20Sopenharmony_ci 8518c2ecf20Sopenharmony_ci &out_a_clk.common, 8528c2ecf20Sopenharmony_ci &out_b_clk.common, 8538c2ecf20Sopenharmony_ci 8548c2ecf20Sopenharmony_ci /* module clocks */ 8558c2ecf20Sopenharmony_ci &nand0_0_clk.common, 8568c2ecf20Sopenharmony_ci &nand0_1_clk.common, 8578c2ecf20Sopenharmony_ci &nand1_0_clk.common, 8588c2ecf20Sopenharmony_ci &nand1_1_clk.common, 8598c2ecf20Sopenharmony_ci &mmc0_clk.common, 8608c2ecf20Sopenharmony_ci &mmc0_sample_clk.common, 8618c2ecf20Sopenharmony_ci &mmc0_output_clk.common, 8628c2ecf20Sopenharmony_ci &mmc1_clk.common, 8638c2ecf20Sopenharmony_ci &mmc1_sample_clk.common, 8648c2ecf20Sopenharmony_ci &mmc1_output_clk.common, 8658c2ecf20Sopenharmony_ci &mmc2_clk.common, 8668c2ecf20Sopenharmony_ci &mmc2_sample_clk.common, 8678c2ecf20Sopenharmony_ci &mmc2_output_clk.common, 8688c2ecf20Sopenharmony_ci &mmc3_clk.common, 8698c2ecf20Sopenharmony_ci &mmc3_sample_clk.common, 8708c2ecf20Sopenharmony_ci &mmc3_output_clk.common, 8718c2ecf20Sopenharmony_ci &ts_clk.common, 8728c2ecf20Sopenharmony_ci &ss_clk.common, 8738c2ecf20Sopenharmony_ci &spi0_clk.common, 8748c2ecf20Sopenharmony_ci &spi1_clk.common, 8758c2ecf20Sopenharmony_ci &spi2_clk.common, 8768c2ecf20Sopenharmony_ci &spi3_clk.common, 8778c2ecf20Sopenharmony_ci &i2s0_clk.common, 8788c2ecf20Sopenharmony_ci &i2s1_clk.common, 8798c2ecf20Sopenharmony_ci &spdif_clk.common, 8808c2ecf20Sopenharmony_ci &sdram_clk.common, 8818c2ecf20Sopenharmony_ci &de_clk.common, 8828c2ecf20Sopenharmony_ci &edp_clk.common, 8838c2ecf20Sopenharmony_ci &mp_clk.common, 8848c2ecf20Sopenharmony_ci &lcd0_clk.common, 8858c2ecf20Sopenharmony_ci &lcd1_clk.common, 8868c2ecf20Sopenharmony_ci &mipi_dsi0_clk.common, 8878c2ecf20Sopenharmony_ci &mipi_dsi1_clk.common, 8888c2ecf20Sopenharmony_ci &hdmi_clk.common, 8898c2ecf20Sopenharmony_ci &hdmi_slow_clk.common, 8908c2ecf20Sopenharmony_ci &mipi_csi_clk.common, 8918c2ecf20Sopenharmony_ci &csi_isp_clk.common, 8928c2ecf20Sopenharmony_ci &csi_misc_clk.common, 8938c2ecf20Sopenharmony_ci &csi0_mclk_clk.common, 8948c2ecf20Sopenharmony_ci &csi1_mclk_clk.common, 8958c2ecf20Sopenharmony_ci &fd_clk.common, 8968c2ecf20Sopenharmony_ci &ve_clk.common, 8978c2ecf20Sopenharmony_ci &avs_clk.common, 8988c2ecf20Sopenharmony_ci &gpu_core_clk.common, 8998c2ecf20Sopenharmony_ci &gpu_memory_clk.common, 9008c2ecf20Sopenharmony_ci &gpu_axi_clk.common, 9018c2ecf20Sopenharmony_ci &sata_clk.common, 9028c2ecf20Sopenharmony_ci &ac97_clk.common, 9038c2ecf20Sopenharmony_ci &mipi_hsi_clk.common, 9048c2ecf20Sopenharmony_ci &gpadc_clk.common, 9058c2ecf20Sopenharmony_ci &cir_tx_clk.common, 9068c2ecf20Sopenharmony_ci 9078c2ecf20Sopenharmony_ci /* AHB0 bus gates */ 9088c2ecf20Sopenharmony_ci &bus_fd_clk.common, 9098c2ecf20Sopenharmony_ci &bus_ve_clk.common, 9108c2ecf20Sopenharmony_ci &bus_gpu_ctrl_clk.common, 9118c2ecf20Sopenharmony_ci &bus_ss_clk.common, 9128c2ecf20Sopenharmony_ci &bus_mmc_clk.common, 9138c2ecf20Sopenharmony_ci &bus_nand0_clk.common, 9148c2ecf20Sopenharmony_ci &bus_nand1_clk.common, 9158c2ecf20Sopenharmony_ci &bus_sdram_clk.common, 9168c2ecf20Sopenharmony_ci &bus_mipi_hsi_clk.common, 9178c2ecf20Sopenharmony_ci &bus_sata_clk.common, 9188c2ecf20Sopenharmony_ci &bus_ts_clk.common, 9198c2ecf20Sopenharmony_ci &bus_spi0_clk.common, 9208c2ecf20Sopenharmony_ci &bus_spi1_clk.common, 9218c2ecf20Sopenharmony_ci &bus_spi2_clk.common, 9228c2ecf20Sopenharmony_ci &bus_spi3_clk.common, 9238c2ecf20Sopenharmony_ci 9248c2ecf20Sopenharmony_ci /* AHB1 bus gates */ 9258c2ecf20Sopenharmony_ci &bus_otg_clk.common, 9268c2ecf20Sopenharmony_ci &bus_usb_clk.common, 9278c2ecf20Sopenharmony_ci &bus_gmac_clk.common, 9288c2ecf20Sopenharmony_ci &bus_msgbox_clk.common, 9298c2ecf20Sopenharmony_ci &bus_spinlock_clk.common, 9308c2ecf20Sopenharmony_ci &bus_hstimer_clk.common, 9318c2ecf20Sopenharmony_ci &bus_dma_clk.common, 9328c2ecf20Sopenharmony_ci 9338c2ecf20Sopenharmony_ci /* AHB2 bus gates */ 9348c2ecf20Sopenharmony_ci &bus_lcd0_clk.common, 9358c2ecf20Sopenharmony_ci &bus_lcd1_clk.common, 9368c2ecf20Sopenharmony_ci &bus_edp_clk.common, 9378c2ecf20Sopenharmony_ci &bus_csi_clk.common, 9388c2ecf20Sopenharmony_ci &bus_hdmi_clk.common, 9398c2ecf20Sopenharmony_ci &bus_de_clk.common, 9408c2ecf20Sopenharmony_ci &bus_mp_clk.common, 9418c2ecf20Sopenharmony_ci &bus_mipi_dsi_clk.common, 9428c2ecf20Sopenharmony_ci 9438c2ecf20Sopenharmony_ci /* APB0 bus gates */ 9448c2ecf20Sopenharmony_ci &bus_spdif_clk.common, 9458c2ecf20Sopenharmony_ci &bus_pio_clk.common, 9468c2ecf20Sopenharmony_ci &bus_ac97_clk.common, 9478c2ecf20Sopenharmony_ci &bus_i2s0_clk.common, 9488c2ecf20Sopenharmony_ci &bus_i2s1_clk.common, 9498c2ecf20Sopenharmony_ci &bus_lradc_clk.common, 9508c2ecf20Sopenharmony_ci &bus_gpadc_clk.common, 9518c2ecf20Sopenharmony_ci &bus_twd_clk.common, 9528c2ecf20Sopenharmony_ci &bus_cir_tx_clk.common, 9538c2ecf20Sopenharmony_ci 9548c2ecf20Sopenharmony_ci /* APB1 bus gates */ 9558c2ecf20Sopenharmony_ci &bus_i2c0_clk.common, 9568c2ecf20Sopenharmony_ci &bus_i2c1_clk.common, 9578c2ecf20Sopenharmony_ci &bus_i2c2_clk.common, 9588c2ecf20Sopenharmony_ci &bus_i2c3_clk.common, 9598c2ecf20Sopenharmony_ci &bus_i2c4_clk.common, 9608c2ecf20Sopenharmony_ci &bus_uart0_clk.common, 9618c2ecf20Sopenharmony_ci &bus_uart1_clk.common, 9628c2ecf20Sopenharmony_ci &bus_uart2_clk.common, 9638c2ecf20Sopenharmony_ci &bus_uart3_clk.common, 9648c2ecf20Sopenharmony_ci &bus_uart4_clk.common, 9658c2ecf20Sopenharmony_ci &bus_uart5_clk.common, 9668c2ecf20Sopenharmony_ci}; 9678c2ecf20Sopenharmony_ci 9688c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun9i_a80_hw_clks = { 9698c2ecf20Sopenharmony_ci .hws = { 9708c2ecf20Sopenharmony_ci [CLK_PLL_C0CPUX] = &pll_c0cpux_clk.common.hw, 9718c2ecf20Sopenharmony_ci [CLK_PLL_C1CPUX] = &pll_c1cpux_clk.common.hw, 9728c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.common.hw, 9738c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw, 9748c2ecf20Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 9758c2ecf20Sopenharmony_ci [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 9768c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 9778c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 9788c2ecf20Sopenharmony_ci [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 9798c2ecf20Sopenharmony_ci [CLK_PLL_DE] = &pll_de_clk.common.hw, 9808c2ecf20Sopenharmony_ci [CLK_PLL_ISP] = &pll_isp_clk.common.hw, 9818c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw, 9828c2ecf20Sopenharmony_ci [CLK_C0CPUX] = &c0cpux_clk.common.hw, 9838c2ecf20Sopenharmony_ci [CLK_C1CPUX] = &c1cpux_clk.common.hw, 9848c2ecf20Sopenharmony_ci [CLK_ATB0] = &atb0_clk.common.hw, 9858c2ecf20Sopenharmony_ci [CLK_AXI0] = &axi0_clk.common.hw, 9868c2ecf20Sopenharmony_ci [CLK_ATB1] = &atb1_clk.common.hw, 9878c2ecf20Sopenharmony_ci [CLK_AXI1] = &axi1_clk.common.hw, 9888c2ecf20Sopenharmony_ci [CLK_GTBUS] = >bus_clk.common.hw, 9898c2ecf20Sopenharmony_ci [CLK_AHB0] = &ahb0_clk.common.hw, 9908c2ecf20Sopenharmony_ci [CLK_AHB1] = &ahb1_clk.common.hw, 9918c2ecf20Sopenharmony_ci [CLK_AHB2] = &ahb2_clk.common.hw, 9928c2ecf20Sopenharmony_ci [CLK_APB0] = &apb0_clk.common.hw, 9938c2ecf20Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 9948c2ecf20Sopenharmony_ci [CLK_CCI400] = &cci400_clk.common.hw, 9958c2ecf20Sopenharmony_ci [CLK_ATS] = &ats_clk.common.hw, 9968c2ecf20Sopenharmony_ci [CLK_TRACE] = &trace_clk.common.hw, 9978c2ecf20Sopenharmony_ci 9988c2ecf20Sopenharmony_ci [CLK_OUT_A] = &out_a_clk.common.hw, 9998c2ecf20Sopenharmony_ci [CLK_OUT_B] = &out_b_clk.common.hw, 10008c2ecf20Sopenharmony_ci 10018c2ecf20Sopenharmony_ci [CLK_NAND0_0] = &nand0_0_clk.common.hw, 10028c2ecf20Sopenharmony_ci [CLK_NAND0_1] = &nand0_1_clk.common.hw, 10038c2ecf20Sopenharmony_ci [CLK_NAND1_0] = &nand1_0_clk.common.hw, 10048c2ecf20Sopenharmony_ci [CLK_NAND1_1] = &nand1_1_clk.common.hw, 10058c2ecf20Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 10068c2ecf20Sopenharmony_ci [CLK_MMC0_SAMPLE] = &mmc0_sample_clk.common.hw, 10078c2ecf20Sopenharmony_ci [CLK_MMC0_OUTPUT] = &mmc0_output_clk.common.hw, 10088c2ecf20Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 10098c2ecf20Sopenharmony_ci [CLK_MMC1_SAMPLE] = &mmc1_sample_clk.common.hw, 10108c2ecf20Sopenharmony_ci [CLK_MMC1_OUTPUT] = &mmc1_output_clk.common.hw, 10118c2ecf20Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 10128c2ecf20Sopenharmony_ci [CLK_MMC2_SAMPLE] = &mmc2_sample_clk.common.hw, 10138c2ecf20Sopenharmony_ci [CLK_MMC2_OUTPUT] = &mmc2_output_clk.common.hw, 10148c2ecf20Sopenharmony_ci [CLK_MMC3] = &mmc3_clk.common.hw, 10158c2ecf20Sopenharmony_ci [CLK_MMC3_SAMPLE] = &mmc3_sample_clk.common.hw, 10168c2ecf20Sopenharmony_ci [CLK_MMC3_OUTPUT] = &mmc3_output_clk.common.hw, 10178c2ecf20Sopenharmony_ci [CLK_TS] = &ts_clk.common.hw, 10188c2ecf20Sopenharmony_ci [CLK_SS] = &ss_clk.common.hw, 10198c2ecf20Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 10208c2ecf20Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 10218c2ecf20Sopenharmony_ci [CLK_SPI2] = &spi2_clk.common.hw, 10228c2ecf20Sopenharmony_ci [CLK_SPI3] = &spi3_clk.common.hw, 10238c2ecf20Sopenharmony_ci [CLK_I2S0] = &i2s0_clk.common.hw, 10248c2ecf20Sopenharmony_ci [CLK_I2S1] = &i2s1_clk.common.hw, 10258c2ecf20Sopenharmony_ci [CLK_SPDIF] = &spdif_clk.common.hw, 10268c2ecf20Sopenharmony_ci [CLK_SDRAM] = &sdram_clk.common.hw, 10278c2ecf20Sopenharmony_ci [CLK_DE] = &de_clk.common.hw, 10288c2ecf20Sopenharmony_ci [CLK_EDP] = &edp_clk.common.hw, 10298c2ecf20Sopenharmony_ci [CLK_MP] = &mp_clk.common.hw, 10308c2ecf20Sopenharmony_ci [CLK_LCD0] = &lcd0_clk.common.hw, 10318c2ecf20Sopenharmony_ci [CLK_LCD1] = &lcd1_clk.common.hw, 10328c2ecf20Sopenharmony_ci [CLK_MIPI_DSI0] = &mipi_dsi0_clk.common.hw, 10338c2ecf20Sopenharmony_ci [CLK_MIPI_DSI1] = &mipi_dsi1_clk.common.hw, 10348c2ecf20Sopenharmony_ci [CLK_HDMI] = &hdmi_clk.common.hw, 10358c2ecf20Sopenharmony_ci [CLK_HDMI_SLOW] = &hdmi_slow_clk.common.hw, 10368c2ecf20Sopenharmony_ci [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw, 10378c2ecf20Sopenharmony_ci [CLK_CSI_ISP] = &csi_isp_clk.common.hw, 10388c2ecf20Sopenharmony_ci [CLK_CSI_MISC] = &csi_misc_clk.common.hw, 10398c2ecf20Sopenharmony_ci [CLK_CSI0_MCLK] = &csi0_mclk_clk.common.hw, 10408c2ecf20Sopenharmony_ci [CLK_CSI1_MCLK] = &csi1_mclk_clk.common.hw, 10418c2ecf20Sopenharmony_ci [CLK_FD] = &fd_clk.common.hw, 10428c2ecf20Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 10438c2ecf20Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 10448c2ecf20Sopenharmony_ci [CLK_GPU_CORE] = &gpu_core_clk.common.hw, 10458c2ecf20Sopenharmony_ci [CLK_GPU_MEMORY] = &gpu_memory_clk.common.hw, 10468c2ecf20Sopenharmony_ci [CLK_GPU_AXI] = &gpu_axi_clk.common.hw, 10478c2ecf20Sopenharmony_ci [CLK_SATA] = &sata_clk.common.hw, 10488c2ecf20Sopenharmony_ci [CLK_AC97] = &ac97_clk.common.hw, 10498c2ecf20Sopenharmony_ci [CLK_MIPI_HSI] = &mipi_hsi_clk.common.hw, 10508c2ecf20Sopenharmony_ci [CLK_GPADC] = &gpadc_clk.common.hw, 10518c2ecf20Sopenharmony_ci [CLK_CIR_TX] = &cir_tx_clk.common.hw, 10528c2ecf20Sopenharmony_ci 10538c2ecf20Sopenharmony_ci [CLK_BUS_FD] = &bus_fd_clk.common.hw, 10548c2ecf20Sopenharmony_ci [CLK_BUS_VE] = &bus_ve_clk.common.hw, 10558c2ecf20Sopenharmony_ci [CLK_BUS_GPU_CTRL] = &bus_gpu_ctrl_clk.common.hw, 10568c2ecf20Sopenharmony_ci [CLK_BUS_SS] = &bus_ss_clk.common.hw, 10578c2ecf20Sopenharmony_ci [CLK_BUS_MMC] = &bus_mmc_clk.common.hw, 10588c2ecf20Sopenharmony_ci [CLK_BUS_NAND0] = &bus_nand0_clk.common.hw, 10598c2ecf20Sopenharmony_ci [CLK_BUS_NAND1] = &bus_nand1_clk.common.hw, 10608c2ecf20Sopenharmony_ci [CLK_BUS_SDRAM] = &bus_sdram_clk.common.hw, 10618c2ecf20Sopenharmony_ci [CLK_BUS_MIPI_HSI] = &bus_mipi_hsi_clk.common.hw, 10628c2ecf20Sopenharmony_ci [CLK_BUS_SATA] = &bus_sata_clk.common.hw, 10638c2ecf20Sopenharmony_ci [CLK_BUS_TS] = &bus_ts_clk.common.hw, 10648c2ecf20Sopenharmony_ci [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw, 10658c2ecf20Sopenharmony_ci [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw, 10668c2ecf20Sopenharmony_ci [CLK_BUS_SPI2] = &bus_spi2_clk.common.hw, 10678c2ecf20Sopenharmony_ci [CLK_BUS_SPI3] = &bus_spi3_clk.common.hw, 10688c2ecf20Sopenharmony_ci 10698c2ecf20Sopenharmony_ci [CLK_BUS_OTG] = &bus_otg_clk.common.hw, 10708c2ecf20Sopenharmony_ci [CLK_BUS_USB] = &bus_usb_clk.common.hw, 10718c2ecf20Sopenharmony_ci [CLK_BUS_GMAC] = &bus_gmac_clk.common.hw, 10728c2ecf20Sopenharmony_ci [CLK_BUS_MSGBOX] = &bus_msgbox_clk.common.hw, 10738c2ecf20Sopenharmony_ci [CLK_BUS_SPINLOCK] = &bus_spinlock_clk.common.hw, 10748c2ecf20Sopenharmony_ci [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw, 10758c2ecf20Sopenharmony_ci [CLK_BUS_DMA] = &bus_dma_clk.common.hw, 10768c2ecf20Sopenharmony_ci 10778c2ecf20Sopenharmony_ci [CLK_BUS_LCD0] = &bus_lcd0_clk.common.hw, 10788c2ecf20Sopenharmony_ci [CLK_BUS_LCD1] = &bus_lcd1_clk.common.hw, 10798c2ecf20Sopenharmony_ci [CLK_BUS_EDP] = &bus_edp_clk.common.hw, 10808c2ecf20Sopenharmony_ci [CLK_BUS_CSI] = &bus_csi_clk.common.hw, 10818c2ecf20Sopenharmony_ci [CLK_BUS_HDMI] = &bus_hdmi_clk.common.hw, 10828c2ecf20Sopenharmony_ci [CLK_BUS_DE] = &bus_de_clk.common.hw, 10838c2ecf20Sopenharmony_ci [CLK_BUS_MP] = &bus_mp_clk.common.hw, 10848c2ecf20Sopenharmony_ci [CLK_BUS_MIPI_DSI] = &bus_mipi_dsi_clk.common.hw, 10858c2ecf20Sopenharmony_ci 10868c2ecf20Sopenharmony_ci [CLK_BUS_SPDIF] = &bus_spdif_clk.common.hw, 10878c2ecf20Sopenharmony_ci [CLK_BUS_PIO] = &bus_pio_clk.common.hw, 10888c2ecf20Sopenharmony_ci [CLK_BUS_AC97] = &bus_ac97_clk.common.hw, 10898c2ecf20Sopenharmony_ci [CLK_BUS_I2S0] = &bus_i2s0_clk.common.hw, 10908c2ecf20Sopenharmony_ci [CLK_BUS_I2S1] = &bus_i2s1_clk.common.hw, 10918c2ecf20Sopenharmony_ci [CLK_BUS_LRADC] = &bus_lradc_clk.common.hw, 10928c2ecf20Sopenharmony_ci [CLK_BUS_GPADC] = &bus_gpadc_clk.common.hw, 10938c2ecf20Sopenharmony_ci [CLK_BUS_TWD] = &bus_twd_clk.common.hw, 10948c2ecf20Sopenharmony_ci [CLK_BUS_CIR_TX] = &bus_cir_tx_clk.common.hw, 10958c2ecf20Sopenharmony_ci 10968c2ecf20Sopenharmony_ci [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw, 10978c2ecf20Sopenharmony_ci [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw, 10988c2ecf20Sopenharmony_ci [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw, 10998c2ecf20Sopenharmony_ci [CLK_BUS_I2C3] = &bus_i2c3_clk.common.hw, 11008c2ecf20Sopenharmony_ci [CLK_BUS_I2C4] = &bus_i2c4_clk.common.hw, 11018c2ecf20Sopenharmony_ci [CLK_BUS_UART0] = &bus_uart0_clk.common.hw, 11028c2ecf20Sopenharmony_ci [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 11038c2ecf20Sopenharmony_ci [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 11048c2ecf20Sopenharmony_ci [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 11058c2ecf20Sopenharmony_ci [CLK_BUS_UART4] = &bus_uart4_clk.common.hw, 11068c2ecf20Sopenharmony_ci [CLK_BUS_UART5] = &bus_uart5_clk.common.hw, 11078c2ecf20Sopenharmony_ci }, 11088c2ecf20Sopenharmony_ci .num = CLK_NUMBER, 11098c2ecf20Sopenharmony_ci}; 11108c2ecf20Sopenharmony_ci 11118c2ecf20Sopenharmony_cistatic struct ccu_reset_map sun9i_a80_ccu_resets[] = { 11128c2ecf20Sopenharmony_ci /* AHB0 reset controls */ 11138c2ecf20Sopenharmony_ci [RST_BUS_FD] = { 0x5a0, BIT(0) }, 11148c2ecf20Sopenharmony_ci [RST_BUS_VE] = { 0x5a0, BIT(1) }, 11158c2ecf20Sopenharmony_ci [RST_BUS_GPU_CTRL] = { 0x5a0, BIT(3) }, 11168c2ecf20Sopenharmony_ci [RST_BUS_SS] = { 0x5a0, BIT(5) }, 11178c2ecf20Sopenharmony_ci [RST_BUS_MMC] = { 0x5a0, BIT(8) }, 11188c2ecf20Sopenharmony_ci [RST_BUS_NAND0] = { 0x5a0, BIT(12) }, 11198c2ecf20Sopenharmony_ci [RST_BUS_NAND1] = { 0x5a0, BIT(13) }, 11208c2ecf20Sopenharmony_ci [RST_BUS_SDRAM] = { 0x5a0, BIT(14) }, 11218c2ecf20Sopenharmony_ci [RST_BUS_SATA] = { 0x5a0, BIT(16) }, 11228c2ecf20Sopenharmony_ci [RST_BUS_TS] = { 0x5a0, BIT(18) }, 11238c2ecf20Sopenharmony_ci [RST_BUS_SPI0] = { 0x5a0, BIT(20) }, 11248c2ecf20Sopenharmony_ci [RST_BUS_SPI1] = { 0x5a0, BIT(21) }, 11258c2ecf20Sopenharmony_ci [RST_BUS_SPI2] = { 0x5a0, BIT(22) }, 11268c2ecf20Sopenharmony_ci [RST_BUS_SPI3] = { 0x5a0, BIT(23) }, 11278c2ecf20Sopenharmony_ci 11288c2ecf20Sopenharmony_ci /* AHB1 reset controls */ 11298c2ecf20Sopenharmony_ci [RST_BUS_OTG] = { 0x5a4, BIT(0) }, 11308c2ecf20Sopenharmony_ci [RST_BUS_OTG_PHY] = { 0x5a4, BIT(1) }, 11318c2ecf20Sopenharmony_ci [RST_BUS_MIPI_HSI] = { 0x5a4, BIT(9) }, 11328c2ecf20Sopenharmony_ci [RST_BUS_GMAC] = { 0x5a4, BIT(17) }, 11338c2ecf20Sopenharmony_ci [RST_BUS_MSGBOX] = { 0x5a4, BIT(21) }, 11348c2ecf20Sopenharmony_ci [RST_BUS_SPINLOCK] = { 0x5a4, BIT(22) }, 11358c2ecf20Sopenharmony_ci [RST_BUS_HSTIMER] = { 0x5a4, BIT(23) }, 11368c2ecf20Sopenharmony_ci [RST_BUS_DMA] = { 0x5a4, BIT(24) }, 11378c2ecf20Sopenharmony_ci 11388c2ecf20Sopenharmony_ci /* AHB2 reset controls */ 11398c2ecf20Sopenharmony_ci [RST_BUS_LCD0] = { 0x5a8, BIT(0) }, 11408c2ecf20Sopenharmony_ci [RST_BUS_LCD1] = { 0x5a8, BIT(1) }, 11418c2ecf20Sopenharmony_ci [RST_BUS_EDP] = { 0x5a8, BIT(2) }, 11428c2ecf20Sopenharmony_ci [RST_BUS_LVDS] = { 0x5a8, BIT(3) }, 11438c2ecf20Sopenharmony_ci [RST_BUS_CSI] = { 0x5a8, BIT(4) }, 11448c2ecf20Sopenharmony_ci [RST_BUS_HDMI0] = { 0x5a8, BIT(5) }, 11458c2ecf20Sopenharmony_ci [RST_BUS_HDMI1] = { 0x5a8, BIT(6) }, 11468c2ecf20Sopenharmony_ci [RST_BUS_DE] = { 0x5a8, BIT(7) }, 11478c2ecf20Sopenharmony_ci [RST_BUS_MP] = { 0x5a8, BIT(8) }, 11488c2ecf20Sopenharmony_ci [RST_BUS_GPU] = { 0x5a8, BIT(9) }, 11498c2ecf20Sopenharmony_ci [RST_BUS_MIPI_DSI] = { 0x5a8, BIT(11) }, 11508c2ecf20Sopenharmony_ci 11518c2ecf20Sopenharmony_ci /* APB0 reset controls */ 11528c2ecf20Sopenharmony_ci [RST_BUS_SPDIF] = { 0x5b0, BIT(1) }, 11538c2ecf20Sopenharmony_ci [RST_BUS_AC97] = { 0x5b0, BIT(11) }, 11548c2ecf20Sopenharmony_ci [RST_BUS_I2S0] = { 0x5b0, BIT(12) }, 11558c2ecf20Sopenharmony_ci [RST_BUS_I2S1] = { 0x5b0, BIT(13) }, 11568c2ecf20Sopenharmony_ci [RST_BUS_LRADC] = { 0x5b0, BIT(15) }, 11578c2ecf20Sopenharmony_ci [RST_BUS_GPADC] = { 0x5b0, BIT(17) }, 11588c2ecf20Sopenharmony_ci [RST_BUS_CIR_TX] = { 0x5b0, BIT(19) }, 11598c2ecf20Sopenharmony_ci 11608c2ecf20Sopenharmony_ci /* APB1 reset controls */ 11618c2ecf20Sopenharmony_ci [RST_BUS_I2C0] = { 0x5b4, BIT(0) }, 11628c2ecf20Sopenharmony_ci [RST_BUS_I2C1] = { 0x5b4, BIT(1) }, 11638c2ecf20Sopenharmony_ci [RST_BUS_I2C2] = { 0x5b4, BIT(2) }, 11648c2ecf20Sopenharmony_ci [RST_BUS_I2C3] = { 0x5b4, BIT(3) }, 11658c2ecf20Sopenharmony_ci [RST_BUS_I2C4] = { 0x5b4, BIT(4) }, 11668c2ecf20Sopenharmony_ci [RST_BUS_UART0] = { 0x5b4, BIT(16) }, 11678c2ecf20Sopenharmony_ci [RST_BUS_UART1] = { 0x5b4, BIT(17) }, 11688c2ecf20Sopenharmony_ci [RST_BUS_UART2] = { 0x5b4, BIT(18) }, 11698c2ecf20Sopenharmony_ci [RST_BUS_UART3] = { 0x5b4, BIT(19) }, 11708c2ecf20Sopenharmony_ci [RST_BUS_UART4] = { 0x5b4, BIT(20) }, 11718c2ecf20Sopenharmony_ci [RST_BUS_UART5] = { 0x5b4, BIT(21) }, 11728c2ecf20Sopenharmony_ci}; 11738c2ecf20Sopenharmony_ci 11748c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun9i_a80_ccu_desc = { 11758c2ecf20Sopenharmony_ci .ccu_clks = sun9i_a80_ccu_clks, 11768c2ecf20Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun9i_a80_ccu_clks), 11778c2ecf20Sopenharmony_ci 11788c2ecf20Sopenharmony_ci .hw_clks = &sun9i_a80_hw_clks, 11798c2ecf20Sopenharmony_ci 11808c2ecf20Sopenharmony_ci .resets = sun9i_a80_ccu_resets, 11818c2ecf20Sopenharmony_ci .num_resets = ARRAY_SIZE(sun9i_a80_ccu_resets), 11828c2ecf20Sopenharmony_ci}; 11838c2ecf20Sopenharmony_ci 11848c2ecf20Sopenharmony_ci#define SUN9I_A80_PLL_P_SHIFT 16 11858c2ecf20Sopenharmony_ci#define SUN9I_A80_PLL_N_SHIFT 8 11868c2ecf20Sopenharmony_ci#define SUN9I_A80_PLL_N_WIDTH 8 11878c2ecf20Sopenharmony_ci 11888c2ecf20Sopenharmony_cistatic void sun9i_a80_cpu_pll_fixup(void __iomem *reg) 11898c2ecf20Sopenharmony_ci{ 11908c2ecf20Sopenharmony_ci u32 val = readl(reg); 11918c2ecf20Sopenharmony_ci 11928c2ecf20Sopenharmony_ci /* bail out if P divider is not used */ 11938c2ecf20Sopenharmony_ci if (!(val & BIT(SUN9I_A80_PLL_P_SHIFT))) 11948c2ecf20Sopenharmony_ci return; 11958c2ecf20Sopenharmony_ci 11968c2ecf20Sopenharmony_ci /* 11978c2ecf20Sopenharmony_ci * If P is used, output should be less than 288 MHz. When we 11988c2ecf20Sopenharmony_ci * set P to 1, we should also decrease the multiplier so the 11998c2ecf20Sopenharmony_ci * output doesn't go out of range, but not too much such that 12008c2ecf20Sopenharmony_ci * the multiplier stays above 12, the minimal operation value. 12018c2ecf20Sopenharmony_ci * 12028c2ecf20Sopenharmony_ci * To keep it simple, set the multiplier to 17, the reset value. 12038c2ecf20Sopenharmony_ci */ 12048c2ecf20Sopenharmony_ci val &= ~GENMASK(SUN9I_A80_PLL_N_SHIFT + SUN9I_A80_PLL_N_WIDTH - 1, 12058c2ecf20Sopenharmony_ci SUN9I_A80_PLL_N_SHIFT); 12068c2ecf20Sopenharmony_ci val |= 17 << SUN9I_A80_PLL_N_SHIFT; 12078c2ecf20Sopenharmony_ci 12088c2ecf20Sopenharmony_ci /* And clear P */ 12098c2ecf20Sopenharmony_ci val &= ~BIT(SUN9I_A80_PLL_P_SHIFT); 12108c2ecf20Sopenharmony_ci 12118c2ecf20Sopenharmony_ci writel(val, reg); 12128c2ecf20Sopenharmony_ci} 12138c2ecf20Sopenharmony_ci 12148c2ecf20Sopenharmony_cistatic int sun9i_a80_ccu_probe(struct platform_device *pdev) 12158c2ecf20Sopenharmony_ci{ 12168c2ecf20Sopenharmony_ci struct resource *res; 12178c2ecf20Sopenharmony_ci void __iomem *reg; 12188c2ecf20Sopenharmony_ci u32 val; 12198c2ecf20Sopenharmony_ci 12208c2ecf20Sopenharmony_ci res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 12218c2ecf20Sopenharmony_ci reg = devm_ioremap_resource(&pdev->dev, res); 12228c2ecf20Sopenharmony_ci if (IS_ERR(reg)) 12238c2ecf20Sopenharmony_ci return PTR_ERR(reg); 12248c2ecf20Sopenharmony_ci 12258c2ecf20Sopenharmony_ci /* Enforce d1 = 0, d2 = 0 for Audio PLL */ 12268c2ecf20Sopenharmony_ci val = readl(reg + SUN9I_A80_PLL_AUDIO_REG); 12278c2ecf20Sopenharmony_ci val &= ~(BIT(16) | BIT(18)); 12288c2ecf20Sopenharmony_ci writel(val, reg + SUN9I_A80_PLL_AUDIO_REG); 12298c2ecf20Sopenharmony_ci 12308c2ecf20Sopenharmony_ci /* Enforce P = 1 for both CPU cluster PLLs */ 12318c2ecf20Sopenharmony_ci sun9i_a80_cpu_pll_fixup(reg + SUN9I_A80_PLL_C0CPUX_REG); 12328c2ecf20Sopenharmony_ci sun9i_a80_cpu_pll_fixup(reg + SUN9I_A80_PLL_C1CPUX_REG); 12338c2ecf20Sopenharmony_ci 12348c2ecf20Sopenharmony_ci return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun9i_a80_ccu_desc); 12358c2ecf20Sopenharmony_ci} 12368c2ecf20Sopenharmony_ci 12378c2ecf20Sopenharmony_cistatic const struct of_device_id sun9i_a80_ccu_ids[] = { 12388c2ecf20Sopenharmony_ci { .compatible = "allwinner,sun9i-a80-ccu" }, 12398c2ecf20Sopenharmony_ci { } 12408c2ecf20Sopenharmony_ci}; 12418c2ecf20Sopenharmony_ci 12428c2ecf20Sopenharmony_cistatic struct platform_driver sun9i_a80_ccu_driver = { 12438c2ecf20Sopenharmony_ci .probe = sun9i_a80_ccu_probe, 12448c2ecf20Sopenharmony_ci .driver = { 12458c2ecf20Sopenharmony_ci .name = "sun9i-a80-ccu", 12468c2ecf20Sopenharmony_ci .of_match_table = sun9i_a80_ccu_ids, 12478c2ecf20Sopenharmony_ci }, 12488c2ecf20Sopenharmony_ci}; 12498c2ecf20Sopenharmony_cibuiltin_platform_driver(sun9i_a80_ccu_driver); 1250