18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2017 Icenowy Zheng <icenowy@aosc.io> 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_mult.h" 188c2ecf20Sopenharmony_ci#include "ccu_nk.h" 198c2ecf20Sopenharmony_ci#include "ccu_nkm.h" 208c2ecf20Sopenharmony_ci#include "ccu_nkmp.h" 218c2ecf20Sopenharmony_ci#include "ccu_nm.h" 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#include "ccu-sun50i-h6.h" 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci/* 268c2ecf20Sopenharmony_ci * The CPU PLL is actually NP clock, with P being /1, /2 or /4. However 278c2ecf20Sopenharmony_ci * P should only be used for output frequencies lower than 288 MHz. 288c2ecf20Sopenharmony_ci * 298c2ecf20Sopenharmony_ci * For now we can just model it as a multiplier clock, and force P to /1. 308c2ecf20Sopenharmony_ci * 318c2ecf20Sopenharmony_ci * The M factor is present in the register's description, but not in the 328c2ecf20Sopenharmony_ci * frequency formula, and it's documented as "M is only used for backdoor 338c2ecf20Sopenharmony_ci * testing", so it's not modelled and then force to 0. 348c2ecf20Sopenharmony_ci */ 358c2ecf20Sopenharmony_ci#define SUN50I_H6_PLL_CPUX_REG 0x000 368c2ecf20Sopenharmony_cistatic struct ccu_mult pll_cpux_clk = { 378c2ecf20Sopenharmony_ci .enable = BIT(31), 388c2ecf20Sopenharmony_ci .lock = BIT(28), 398c2ecf20Sopenharmony_ci .mult = _SUNXI_CCU_MULT_MIN(8, 8, 12), 408c2ecf20Sopenharmony_ci .common = { 418c2ecf20Sopenharmony_ci .reg = 0x000, 428c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-cpux", "osc24M", 438c2ecf20Sopenharmony_ci &ccu_mult_ops, 448c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 458c2ecf20Sopenharmony_ci }, 468c2ecf20Sopenharmony_ci}; 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/* Some PLLs are input * N / div1 / P. Model them as NKMP with no K */ 498c2ecf20Sopenharmony_ci#define SUN50I_H6_PLL_DDR0_REG 0x010 508c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_ddr0_clk = { 518c2ecf20Sopenharmony_ci .enable = BIT(31), 528c2ecf20Sopenharmony_ci .lock = BIT(28), 538c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 548c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 558c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 568c2ecf20Sopenharmony_ci .common = { 578c2ecf20Sopenharmony_ci .reg = 0x010, 588c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ddr0", "osc24M", 598c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 608c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 618c2ecf20Sopenharmony_ci }, 628c2ecf20Sopenharmony_ci}; 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define SUN50I_H6_PLL_PERIPH0_REG 0x020 658c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_periph0_clk = { 668c2ecf20Sopenharmony_ci .enable = BIT(31), 678c2ecf20Sopenharmony_ci .lock = BIT(28), 688c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 698c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 708c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 718c2ecf20Sopenharmony_ci .fixed_post_div = 4, 728c2ecf20Sopenharmony_ci .common = { 738c2ecf20Sopenharmony_ci .reg = 0x020, 748c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV, 758c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-periph0", "osc24M", 768c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 778c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 788c2ecf20Sopenharmony_ci }, 798c2ecf20Sopenharmony_ci}; 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#define SUN50I_H6_PLL_PERIPH1_REG 0x028 828c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_periph1_clk = { 838c2ecf20Sopenharmony_ci .enable = BIT(31), 848c2ecf20Sopenharmony_ci .lock = BIT(28), 858c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 868c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 878c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 888c2ecf20Sopenharmony_ci .fixed_post_div = 4, 898c2ecf20Sopenharmony_ci .common = { 908c2ecf20Sopenharmony_ci .reg = 0x028, 918c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV, 928c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-periph1", "osc24M", 938c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 948c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 958c2ecf20Sopenharmony_ci }, 968c2ecf20Sopenharmony_ci}; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci#define SUN50I_H6_PLL_GPU_REG 0x030 998c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_gpu_clk = { 1008c2ecf20Sopenharmony_ci .enable = BIT(31), 1018c2ecf20Sopenharmony_ci .lock = BIT(28), 1028c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1038c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 1048c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 1058c2ecf20Sopenharmony_ci .common = { 1068c2ecf20Sopenharmony_ci .reg = 0x030, 1078c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-gpu", "osc24M", 1088c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1098c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1108c2ecf20Sopenharmony_ci }, 1118c2ecf20Sopenharmony_ci}; 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci/* 1148c2ecf20Sopenharmony_ci * For Video PLLs, the output divider is described as "used for testing" 1158c2ecf20Sopenharmony_ci * in the user manual. So it's not modelled and forced to 0. 1168c2ecf20Sopenharmony_ci */ 1178c2ecf20Sopenharmony_ci#define SUN50I_H6_PLL_VIDEO0_REG 0x040 1188c2ecf20Sopenharmony_cistatic struct ccu_nm pll_video0_clk = { 1198c2ecf20Sopenharmony_ci .enable = BIT(31), 1208c2ecf20Sopenharmony_ci .lock = BIT(28), 1218c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1228c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 1238c2ecf20Sopenharmony_ci .fixed_post_div = 4, 1248c2ecf20Sopenharmony_ci .min_rate = 288000000, 1258c2ecf20Sopenharmony_ci .max_rate = 2400000000UL, 1268c2ecf20Sopenharmony_ci .common = { 1278c2ecf20Sopenharmony_ci .reg = 0x040, 1288c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV, 1298c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video0", "osc24M", 1308c2ecf20Sopenharmony_ci &ccu_nm_ops, 1318c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1328c2ecf20Sopenharmony_ci }, 1338c2ecf20Sopenharmony_ci}; 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci#define SUN50I_H6_PLL_VIDEO1_REG 0x048 1368c2ecf20Sopenharmony_cistatic struct ccu_nm pll_video1_clk = { 1378c2ecf20Sopenharmony_ci .enable = BIT(31), 1388c2ecf20Sopenharmony_ci .lock = BIT(28), 1398c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1408c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 1418c2ecf20Sopenharmony_ci .fixed_post_div = 4, 1428c2ecf20Sopenharmony_ci .min_rate = 288000000, 1438c2ecf20Sopenharmony_ci .max_rate = 2400000000UL, 1448c2ecf20Sopenharmony_ci .common = { 1458c2ecf20Sopenharmony_ci .reg = 0x048, 1468c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV, 1478c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video1", "osc24M", 1488c2ecf20Sopenharmony_ci &ccu_nm_ops, 1498c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1508c2ecf20Sopenharmony_ci }, 1518c2ecf20Sopenharmony_ci}; 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci#define SUN50I_H6_PLL_VE_REG 0x058 1548c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_ve_clk = { 1558c2ecf20Sopenharmony_ci .enable = BIT(31), 1568c2ecf20Sopenharmony_ci .lock = BIT(28), 1578c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1588c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 1598c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 1608c2ecf20Sopenharmony_ci .common = { 1618c2ecf20Sopenharmony_ci .reg = 0x058, 1628c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ve", "osc24M", 1638c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1648c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1658c2ecf20Sopenharmony_ci }, 1668c2ecf20Sopenharmony_ci}; 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci#define SUN50I_H6_PLL_DE_REG 0x060 1698c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_de_clk = { 1708c2ecf20Sopenharmony_ci .enable = BIT(31), 1718c2ecf20Sopenharmony_ci .lock = BIT(28), 1728c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1738c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 1748c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 1758c2ecf20Sopenharmony_ci .common = { 1768c2ecf20Sopenharmony_ci .reg = 0x060, 1778c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-de", "osc24M", 1788c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1798c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1808c2ecf20Sopenharmony_ci }, 1818c2ecf20Sopenharmony_ci}; 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci#define SUN50I_H6_PLL_HSIC_REG 0x070 1848c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_hsic_clk = { 1858c2ecf20Sopenharmony_ci .enable = BIT(31), 1868c2ecf20Sopenharmony_ci .lock = BIT(28), 1878c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 1888c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 1898c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 1908c2ecf20Sopenharmony_ci .common = { 1918c2ecf20Sopenharmony_ci .reg = 0x070, 1928c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-hsic", "osc24M", 1938c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1948c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1958c2ecf20Sopenharmony_ci }, 1968c2ecf20Sopenharmony_ci}; 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci/* 1998c2ecf20Sopenharmony_ci * The Audio PLL is supposed to have 3 outputs: 2 fixed factors from 2008c2ecf20Sopenharmony_ci * the base (2x and 4x), and one variable divider (the one true pll audio). 2018c2ecf20Sopenharmony_ci * 2028c2ecf20Sopenharmony_ci * We don't have any need for the variable divider for now, so we just 2038c2ecf20Sopenharmony_ci * hardcode it to match with the clock names. 2048c2ecf20Sopenharmony_ci */ 2058c2ecf20Sopenharmony_ci#define SUN50I_H6_PLL_AUDIO_REG 0x078 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_cistatic struct ccu_sdm_setting pll_audio_sdm_table[] = { 2088c2ecf20Sopenharmony_ci { .rate = 541900800, .pattern = 0xc001288d, .m = 1, .n = 22 }, 2098c2ecf20Sopenharmony_ci { .rate = 589824000, .pattern = 0xc00126e9, .m = 1, .n = 24 }, 2108c2ecf20Sopenharmony_ci}; 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_cistatic struct ccu_nm pll_audio_base_clk = { 2138c2ecf20Sopenharmony_ci .enable = BIT(31), 2148c2ecf20Sopenharmony_ci .lock = BIT(28), 2158c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 2168c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 2178c2ecf20Sopenharmony_ci .sdm = _SUNXI_CCU_SDM(pll_audio_sdm_table, 2188c2ecf20Sopenharmony_ci BIT(24), 0x178, BIT(31)), 2198c2ecf20Sopenharmony_ci .common = { 2208c2ecf20Sopenharmony_ci .features = CCU_FEATURE_SIGMA_DELTA_MOD, 2218c2ecf20Sopenharmony_ci .reg = 0x078, 2228c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-audio-base", "osc24M", 2238c2ecf20Sopenharmony_ci &ccu_nm_ops, 2248c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 2258c2ecf20Sopenharmony_ci }, 2268c2ecf20Sopenharmony_ci}; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_cistatic const char * const cpux_parents[] = { "osc24M", "osc32k", 2298c2ecf20Sopenharmony_ci "iosc", "pll-cpux" }; 2308c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX(cpux_clk, "cpux", cpux_parents, 2318c2ecf20Sopenharmony_ci 0x500, 24, 2, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 2328c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x500, 0, 2, 0); 2338c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(cpux_apb_clk, "cpux-apb", "cpux", 0x500, 8, 2, 0); 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_cistatic const char * const psi_ahb1_ahb2_parents[] = { "osc24M", "osc32k", 2368c2ecf20Sopenharmony_ci "iosc", "pll-periph0" }; 2378c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(psi_ahb1_ahb2_clk, "psi-ahb1-ahb2", 2388c2ecf20Sopenharmony_ci psi_ahb1_ahb2_parents, 2398c2ecf20Sopenharmony_ci 0x510, 2408c2ecf20Sopenharmony_ci 0, 2, /* M */ 2418c2ecf20Sopenharmony_ci 8, 2, /* P */ 2428c2ecf20Sopenharmony_ci 24, 2, /* mux */ 2438c2ecf20Sopenharmony_ci 0); 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_cistatic const char * const ahb3_apb1_apb2_parents[] = { "osc24M", "osc32k", 2468c2ecf20Sopenharmony_ci "psi-ahb1-ahb2", 2478c2ecf20Sopenharmony_ci "pll-periph0" }; 2488c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(ahb3_clk, "ahb3", ahb3_apb1_apb2_parents, 0x51c, 2498c2ecf20Sopenharmony_ci 0, 2, /* M */ 2508c2ecf20Sopenharmony_ci 8, 2, /* P */ 2518c2ecf20Sopenharmony_ci 24, 2, /* mux */ 2528c2ecf20Sopenharmony_ci 0); 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb1_clk, "apb1", ahb3_apb1_apb2_parents, 0x520, 2558c2ecf20Sopenharmony_ci 0, 2, /* M */ 2568c2ecf20Sopenharmony_ci 8, 2, /* P */ 2578c2ecf20Sopenharmony_ci 24, 2, /* mux */ 2588c2ecf20Sopenharmony_ci 0); 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", ahb3_apb1_apb2_parents, 0x524, 2618c2ecf20Sopenharmony_ci 0, 2, /* M */ 2628c2ecf20Sopenharmony_ci 8, 2, /* P */ 2638c2ecf20Sopenharmony_ci 24, 2, /* mux */ 2648c2ecf20Sopenharmony_ci 0); 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_cistatic const char * const mbus_parents[] = { "osc24M", "pll-periph0-2x", 2678c2ecf20Sopenharmony_ci "pll-ddr0", "pll-periph0-4x" }; 2688c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents, 0x540, 2698c2ecf20Sopenharmony_ci 0, 3, /* M */ 2708c2ecf20Sopenharmony_ci 24, 2, /* mux */ 2718c2ecf20Sopenharmony_ci BIT(31), /* gate */ 2728c2ecf20Sopenharmony_ci CLK_IS_CRITICAL); 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_cistatic const char * const de_parents[] = { "pll-de", "pll-periph0-2x" }; 2758c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents, 0x600, 2768c2ecf20Sopenharmony_ci 0, 4, /* M */ 2778c2ecf20Sopenharmony_ci 24, 1, /* mux */ 2788c2ecf20Sopenharmony_ci BIT(31), /* gate */ 2798c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_de_clk, "bus-de", "psi-ahb1-ahb2", 2828c2ecf20Sopenharmony_ci 0x60c, BIT(0), 0); 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_cistatic const char * const deinterlace_parents[] = { "pll-periph0", 2858c2ecf20Sopenharmony_ci "pll-periph1" }; 2868c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(deinterlace_clk, "deinterlace", 2878c2ecf20Sopenharmony_ci deinterlace_parents, 2888c2ecf20Sopenharmony_ci 0x620, 2898c2ecf20Sopenharmony_ci 0, 4, /* M */ 2908c2ecf20Sopenharmony_ci 24, 1, /* mux */ 2918c2ecf20Sopenharmony_ci BIT(31), /* gate */ 2928c2ecf20Sopenharmony_ci 0); 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_deinterlace_clk, "bus-deinterlace", "psi-ahb1-ahb2", 2958c2ecf20Sopenharmony_ci 0x62c, BIT(0), 0); 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_cistatic const char * const gpu_parents[] = { "pll-gpu" }; 2988c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(gpu_clk, "gpu", gpu_parents, 0x670, 2998c2ecf20Sopenharmony_ci 0, 3, /* M */ 3008c2ecf20Sopenharmony_ci 24, 1, /* mux */ 3018c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3028c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gpu_clk, "bus-gpu", "psi-ahb1-ahb2", 3058c2ecf20Sopenharmony_ci 0x67c, BIT(0), 0); 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci/* Also applies to EMCE */ 3088c2ecf20Sopenharmony_cistatic const char * const ce_parents[] = { "osc24M", "pll-periph0-2x" }; 3098c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ce_clk, "ce", ce_parents, 0x680, 3108c2ecf20Sopenharmony_ci 0, 4, /* M */ 3118c2ecf20Sopenharmony_ci 8, 2, /* N */ 3128c2ecf20Sopenharmony_ci 24, 1, /* mux */ 3138c2ecf20Sopenharmony_ci BIT(31),/* gate */ 3148c2ecf20Sopenharmony_ci 0); 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ce_clk, "bus-ce", "psi-ahb1-ahb2", 3178c2ecf20Sopenharmony_ci 0x68c, BIT(0), 0); 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_cistatic const char * const ve_parents[] = { "pll-ve" }; 3208c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(ve_clk, "ve", ve_parents, 0x690, 3218c2ecf20Sopenharmony_ci 0, 3, /* M */ 3228c2ecf20Sopenharmony_ci 24, 1, /* mux */ 3238c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3248c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "psi-ahb1-ahb2", 3278c2ecf20Sopenharmony_ci 0x69c, BIT(0), 0); 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(emce_clk, "emce", ce_parents, 0x6b0, 3308c2ecf20Sopenharmony_ci 0, 4, /* M */ 3318c2ecf20Sopenharmony_ci 8, 2, /* N */ 3328c2ecf20Sopenharmony_ci 24, 1, /* mux */ 3338c2ecf20Sopenharmony_ci BIT(31),/* gate */ 3348c2ecf20Sopenharmony_ci 0); 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_emce_clk, "bus-emce", "psi-ahb1-ahb2", 3378c2ecf20Sopenharmony_ci 0x6bc, BIT(0), 0); 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_cistatic const char * const vp9_parents[] = { "pll-ve", "pll-periph0-2x" }; 3408c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(vp9_clk, "vp9", vp9_parents, 0x6c0, 3418c2ecf20Sopenharmony_ci 0, 3, /* M */ 3428c2ecf20Sopenharmony_ci 24, 1, /* mux */ 3438c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3448c2ecf20Sopenharmony_ci 0); 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_vp9_clk, "bus-vp9", "psi-ahb1-ahb2", 3478c2ecf20Sopenharmony_ci 0x6cc, BIT(0), 0); 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "psi-ahb1-ahb2", 3508c2ecf20Sopenharmony_ci 0x70c, BIT(0), 0); 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_msgbox_clk, "bus-msgbox", "psi-ahb1-ahb2", 3538c2ecf20Sopenharmony_ci 0x71c, BIT(0), 0); 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spinlock_clk, "bus-spinlock", "psi-ahb1-ahb2", 3568c2ecf20Sopenharmony_ci 0x72c, BIT(0), 0); 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "psi-ahb1-ahb2", 3598c2ecf20Sopenharmony_ci 0x73c, BIT(0), 0); 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", 0x740, BIT(31), 0); 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dbg_clk, "bus-dbg", "psi-ahb1-ahb2", 3648c2ecf20Sopenharmony_ci 0x78c, BIT(0), 0); 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_psi_clk, "bus-psi", "psi-ahb1-ahb2", 3678c2ecf20Sopenharmony_ci 0x79c, BIT(0), 0); 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_pwm_clk, "bus-pwm", "apb1", 0x7ac, BIT(0), 0); 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_iommu_clk, "bus-iommu", "apb1", 0x7bc, BIT(0), 0); 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_cistatic const char * const dram_parents[] = { "pll-ddr0" }; 3748c2ecf20Sopenharmony_cistatic struct ccu_div dram_clk = { 3758c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV(0, 2), 3768c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 3778c2ecf20Sopenharmony_ci .common = { 3788c2ecf20Sopenharmony_ci .reg = 0x800, 3798c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("dram", 3808c2ecf20Sopenharmony_ci dram_parents, 3818c2ecf20Sopenharmony_ci &ccu_div_ops, 3828c2ecf20Sopenharmony_ci CLK_IS_CRITICAL), 3838c2ecf20Sopenharmony_ci }, 3848c2ecf20Sopenharmony_ci}; 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_dma_clk, "mbus-dma", "mbus", 3878c2ecf20Sopenharmony_ci 0x804, BIT(0), 0); 3888c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_ve_clk, "mbus-ve", "mbus", 3898c2ecf20Sopenharmony_ci 0x804, BIT(1), 0); 3908c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_ce_clk, "mbus-ce", "mbus", 3918c2ecf20Sopenharmony_ci 0x804, BIT(2), 0); 3928c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_ts_clk, "mbus-ts", "mbus", 3938c2ecf20Sopenharmony_ci 0x804, BIT(3), 0); 3948c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_nand_clk, "mbus-nand", "mbus", 3958c2ecf20Sopenharmony_ci 0x804, BIT(5), 0); 3968c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_csi_clk, "mbus-csi", "mbus", 3978c2ecf20Sopenharmony_ci 0x804, BIT(8), 0); 3988c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(mbus_deinterlace_clk, "mbus-deinterlace", "mbus", 3998c2ecf20Sopenharmony_ci 0x804, BIT(11), 0); 4008c2ecf20Sopenharmony_ci 4018c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dram_clk, "bus-dram", "psi-ahb1-ahb2", 4028c2ecf20Sopenharmony_ci 0x80c, BIT(0), CLK_IS_CRITICAL); 4038c2ecf20Sopenharmony_ci 4048c2ecf20Sopenharmony_cistatic const char * const nand_spi_parents[] = { "osc24M", "pll-periph0", 4058c2ecf20Sopenharmony_ci "pll-periph1", "pll-periph0-2x", 4068c2ecf20Sopenharmony_ci "pll-periph1-2x" }; 4078c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand0_clk, "nand0", nand_spi_parents, 0x810, 4088c2ecf20Sopenharmony_ci 0, 4, /* M */ 4098c2ecf20Sopenharmony_ci 8, 2, /* N */ 4108c2ecf20Sopenharmony_ci 24, 3, /* mux */ 4118c2ecf20Sopenharmony_ci BIT(31),/* gate */ 4128c2ecf20Sopenharmony_ci 0); 4138c2ecf20Sopenharmony_ci 4148c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand1_clk, "nand1", nand_spi_parents, 0x814, 4158c2ecf20Sopenharmony_ci 0, 4, /* M */ 4168c2ecf20Sopenharmony_ci 8, 2, /* N */ 4178c2ecf20Sopenharmony_ci 24, 3, /* mux */ 4188c2ecf20Sopenharmony_ci BIT(31),/* gate */ 4198c2ecf20Sopenharmony_ci 0); 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_nand_clk, "bus-nand", "ahb3", 0x82c, BIT(0), 0); 4228c2ecf20Sopenharmony_ci 4238c2ecf20Sopenharmony_cistatic const char * const mmc_parents[] = { "osc24M", "pll-periph0-2x", 4248c2ecf20Sopenharmony_ci "pll-periph1-2x" }; 4258c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc0_clk, "mmc0", mmc_parents, 0x830, 4268c2ecf20Sopenharmony_ci 0, 4, /* M */ 4278c2ecf20Sopenharmony_ci 8, 2, /* N */ 4288c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4298c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4308c2ecf20Sopenharmony_ci 2, /* post-div */ 4318c2ecf20Sopenharmony_ci 0); 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc1_clk, "mmc1", mmc_parents, 0x834, 4348c2ecf20Sopenharmony_ci 0, 4, /* M */ 4358c2ecf20Sopenharmony_ci 8, 2, /* N */ 4368c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4378c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4388c2ecf20Sopenharmony_ci 2, /* post-div */ 4398c2ecf20Sopenharmony_ci 0); 4408c2ecf20Sopenharmony_ci 4418c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc2_clk, "mmc2", mmc_parents, 0x838, 4428c2ecf20Sopenharmony_ci 0, 4, /* M */ 4438c2ecf20Sopenharmony_ci 8, 2, /* N */ 4448c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4458c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4468c2ecf20Sopenharmony_ci 2, /* post-div */ 4478c2ecf20Sopenharmony_ci 0); 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb3", 0x84c, BIT(0), 0); 4508c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb3", 0x84c, BIT(1), 0); 4518c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc2_clk, "bus-mmc2", "ahb3", 0x84c, BIT(2), 0); 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb2", 0x90c, BIT(0), 0); 4548c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb2", 0x90c, BIT(1), 0); 4558c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb2", 0x90c, BIT(2), 0); 4568c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb2", 0x90c, BIT(3), 0); 4578c2ecf20Sopenharmony_ci 4588c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb2", 0x91c, BIT(0), 0); 4598c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb2", 0x91c, BIT(1), 0); 4608c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb2", 0x91c, BIT(2), 0); 4618c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c3_clk, "bus-i2c3", "apb2", 0x91c, BIT(3), 0); 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_scr0_clk, "bus-scr0", "apb2", 0x93c, BIT(0), 0); 4648c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_scr1_clk, "bus-scr1", "apb2", 0x93c, BIT(1), 0); 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", nand_spi_parents, 0x940, 4678c2ecf20Sopenharmony_ci 0, 4, /* M */ 4688c2ecf20Sopenharmony_ci 8, 2, /* N */ 4698c2ecf20Sopenharmony_ci 24, 3, /* mux */ 4708c2ecf20Sopenharmony_ci BIT(31),/* gate */ 4718c2ecf20Sopenharmony_ci 0); 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", nand_spi_parents, 0x944, 4748c2ecf20Sopenharmony_ci 0, 4, /* M */ 4758c2ecf20Sopenharmony_ci 8, 2, /* N */ 4768c2ecf20Sopenharmony_ci 24, 3, /* mux */ 4778c2ecf20Sopenharmony_ci BIT(31),/* gate */ 4788c2ecf20Sopenharmony_ci 0); 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb3", 0x96c, BIT(0), 0); 4818c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi1_clk, "bus-spi1", "ahb3", 0x96c, BIT(1), 0); 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_emac_clk, "bus-emac", "ahb3", 0x97c, BIT(0), 0); 4848c2ecf20Sopenharmony_ci 4858c2ecf20Sopenharmony_cistatic const char * const ts_parents[] = { "osc24M", "pll-periph0" }; 4868c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ts_clk, "ts", ts_parents, 0x9b0, 4878c2ecf20Sopenharmony_ci 0, 4, /* M */ 4888c2ecf20Sopenharmony_ci 8, 2, /* N */ 4898c2ecf20Sopenharmony_ci 24, 1, /* mux */ 4908c2ecf20Sopenharmony_ci BIT(31),/* gate */ 4918c2ecf20Sopenharmony_ci 0); 4928c2ecf20Sopenharmony_ci 4938c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ts_clk, "bus-ts", "ahb3", 0x9bc, BIT(0), 0); 4948c2ecf20Sopenharmony_ci 4958c2ecf20Sopenharmony_cistatic const char * const ir_tx_parents[] = { "osc32k", "osc24M" }; 4968c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ir_tx_clk, "ir-tx", ir_tx_parents, 0x9c0, 4978c2ecf20Sopenharmony_ci 0, 4, /* M */ 4988c2ecf20Sopenharmony_ci 8, 2, /* N */ 4998c2ecf20Sopenharmony_ci 24, 1, /* mux */ 5008c2ecf20Sopenharmony_ci BIT(31),/* gate */ 5018c2ecf20Sopenharmony_ci 0); 5028c2ecf20Sopenharmony_ci 5038c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ir_tx_clk, "bus-ir-tx", "apb1", 0x9cc, BIT(0), 0); 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ths_clk, "bus-ths", "apb1", 0x9fc, BIT(0), 0); 5068c2ecf20Sopenharmony_ci 5078c2ecf20Sopenharmony_cistatic const char * const audio_parents[] = { "pll-audio", "pll-audio-2x", "pll-audio-4x" }; 5088c2ecf20Sopenharmony_cistatic struct ccu_div i2s3_clk = { 5098c2ecf20Sopenharmony_ci .enable = BIT(31), 5108c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5118c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5128c2ecf20Sopenharmony_ci .common = { 5138c2ecf20Sopenharmony_ci .reg = 0xa0c, 5148c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("i2s3", 5158c2ecf20Sopenharmony_ci audio_parents, 5168c2ecf20Sopenharmony_ci &ccu_div_ops, 5178c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT), 5188c2ecf20Sopenharmony_ci }, 5198c2ecf20Sopenharmony_ci}; 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_cistatic struct ccu_div i2s0_clk = { 5228c2ecf20Sopenharmony_ci .enable = BIT(31), 5238c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5248c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5258c2ecf20Sopenharmony_ci .common = { 5268c2ecf20Sopenharmony_ci .reg = 0xa10, 5278c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("i2s0", 5288c2ecf20Sopenharmony_ci audio_parents, 5298c2ecf20Sopenharmony_ci &ccu_div_ops, 5308c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT), 5318c2ecf20Sopenharmony_ci }, 5328c2ecf20Sopenharmony_ci}; 5338c2ecf20Sopenharmony_ci 5348c2ecf20Sopenharmony_cistatic struct ccu_div i2s1_clk = { 5358c2ecf20Sopenharmony_ci .enable = BIT(31), 5368c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5378c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5388c2ecf20Sopenharmony_ci .common = { 5398c2ecf20Sopenharmony_ci .reg = 0xa14, 5408c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("i2s1", 5418c2ecf20Sopenharmony_ci audio_parents, 5428c2ecf20Sopenharmony_ci &ccu_div_ops, 5438c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT), 5448c2ecf20Sopenharmony_ci }, 5458c2ecf20Sopenharmony_ci}; 5468c2ecf20Sopenharmony_ci 5478c2ecf20Sopenharmony_cistatic struct ccu_div i2s2_clk = { 5488c2ecf20Sopenharmony_ci .enable = BIT(31), 5498c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5508c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5518c2ecf20Sopenharmony_ci .common = { 5528c2ecf20Sopenharmony_ci .reg = 0xa18, 5538c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("i2s2", 5548c2ecf20Sopenharmony_ci audio_parents, 5558c2ecf20Sopenharmony_ci &ccu_div_ops, 5568c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT), 5578c2ecf20Sopenharmony_ci }, 5588c2ecf20Sopenharmony_ci}; 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s0_clk, "bus-i2s0", "apb1", 0xa1c, BIT(0), 0); 5618c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s1_clk, "bus-i2s1", "apb1", 0xa1c, BIT(1), 0); 5628c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s2_clk, "bus-i2s2", "apb1", 0xa1c, BIT(2), 0); 5638c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s3_clk, "bus-i2s3", "apb1", 0xa1c, BIT(3), 0); 5648c2ecf20Sopenharmony_ci 5658c2ecf20Sopenharmony_cistatic struct ccu_div spdif_clk = { 5668c2ecf20Sopenharmony_ci .enable = BIT(31), 5678c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5688c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5698c2ecf20Sopenharmony_ci .common = { 5708c2ecf20Sopenharmony_ci .reg = 0xa20, 5718c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("spdif", 5728c2ecf20Sopenharmony_ci audio_parents, 5738c2ecf20Sopenharmony_ci &ccu_div_ops, 5748c2ecf20Sopenharmony_ci 0), 5758c2ecf20Sopenharmony_ci }, 5768c2ecf20Sopenharmony_ci}; 5778c2ecf20Sopenharmony_ci 5788c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spdif_clk, "bus-spdif", "apb1", 0xa2c, BIT(0), 0); 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_cistatic struct ccu_div dmic_clk = { 5818c2ecf20Sopenharmony_ci .enable = BIT(31), 5828c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5838c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5848c2ecf20Sopenharmony_ci .common = { 5858c2ecf20Sopenharmony_ci .reg = 0xa40, 5868c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("dmic", 5878c2ecf20Sopenharmony_ci audio_parents, 5888c2ecf20Sopenharmony_ci &ccu_div_ops, 5898c2ecf20Sopenharmony_ci 0), 5908c2ecf20Sopenharmony_ci }, 5918c2ecf20Sopenharmony_ci}; 5928c2ecf20Sopenharmony_ci 5938c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dmic_clk, "bus-dmic", "apb1", 0xa4c, BIT(0), 0); 5948c2ecf20Sopenharmony_ci 5958c2ecf20Sopenharmony_cistatic struct ccu_div audio_hub_clk = { 5968c2ecf20Sopenharmony_ci .enable = BIT(31), 5978c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 5988c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 5998c2ecf20Sopenharmony_ci .common = { 6008c2ecf20Sopenharmony_ci .reg = 0xa60, 6018c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("audio-hub", 6028c2ecf20Sopenharmony_ci audio_parents, 6038c2ecf20Sopenharmony_ci &ccu_div_ops, 6048c2ecf20Sopenharmony_ci 0), 6058c2ecf20Sopenharmony_ci }, 6068c2ecf20Sopenharmony_ci}; 6078c2ecf20Sopenharmony_ci 6088c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_audio_hub_clk, "bus-audio-hub", "apb1", 0xa6c, BIT(0), 0); 6098c2ecf20Sopenharmony_ci 6108c2ecf20Sopenharmony_ci/* 6118c2ecf20Sopenharmony_ci * There are OHCI 12M clock source selection bits for 2 USB 2.0 ports. 6128c2ecf20Sopenharmony_ci * We will force them to 0 (12M divided from 48M). 6138c2ecf20Sopenharmony_ci */ 6148c2ecf20Sopenharmony_ci#define SUN50I_H6_USB0_CLK_REG 0xa70 6158c2ecf20Sopenharmony_ci#define SUN50I_H6_USB3_CLK_REG 0xa7c 6168c2ecf20Sopenharmony_ci 6178c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc12M", 0xa70, BIT(31), 0); 6188c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M", 0xa70, BIT(29), 0); 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "osc24M", 0xa74, BIT(29), 0); 6218c2ecf20Sopenharmony_ci 6228c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci3_clk, "usb-ohci3", "osc12M", 0xa7c, BIT(31), 0); 6238c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy3_clk, "usb-phy3", "osc12M", 0xa7c, BIT(29), 0); 6248c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_hsic_12m_clk, "usb-hsic-12M", "osc12M", 0xa7c, BIT(27), 0); 6258c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_hsic_clk, "usb-hsic", "pll-hsic", 0xa7c, BIT(26), 0); 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci0_clk, "bus-ohci0", "ahb3", 0xa8c, BIT(0), 0); 6288c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci3_clk, "bus-ohci3", "ahb3", 0xa8c, BIT(3), 0); 6298c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci0_clk, "bus-ehci0", "ahb3", 0xa8c, BIT(4), 0); 6308c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_xhci_clk, "bus-xhci", "ahb3", 0xa8c, BIT(5), 0); 6318c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci3_clk, "bus-ehci3", "ahb3", 0xa8c, BIT(7), 0); 6328c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb3", 0xa8c, BIT(8), 0); 6338c2ecf20Sopenharmony_ci 6348c2ecf20Sopenharmony_cistatic struct clk_fixed_factor pll_periph0_4x_clk; 6358c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pcie_ref_100m_clk, "pcie-ref-100M", 6368c2ecf20Sopenharmony_ci &pll_periph0_4x_clk.hw, 24, 1, 0); 6378c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(pcie_ref_clk, "pcie-ref", "pcie-ref-100M", 6388c2ecf20Sopenharmony_ci 0xab0, BIT(31), 0); 6398c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(pcie_ref_out_clk, "pcie-ref-out", "pcie-ref", 6408c2ecf20Sopenharmony_ci 0xab0, BIT(30), 0); 6418c2ecf20Sopenharmony_ci 6428c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(pcie_maxi_clk, "pcie-maxi", 6438c2ecf20Sopenharmony_ci "pll-periph0", 0xab4, 6448c2ecf20Sopenharmony_ci 0, 4, /* M */ 6458c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6468c2ecf20Sopenharmony_ci 0); 6478c2ecf20Sopenharmony_ci 6488c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(pcie_aux_clk, "pcie-aux", "osc24M", 0xab8, 6498c2ecf20Sopenharmony_ci 0, 5, /* M */ 6508c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6518c2ecf20Sopenharmony_ci 0); 6528c2ecf20Sopenharmony_ci 6538c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_pcie_clk, "bus-pcie", "psi-ahb1-ahb2", 6548c2ecf20Sopenharmony_ci 0xabc, BIT(0), 0); 6558c2ecf20Sopenharmony_ci 6568c2ecf20Sopenharmony_cistatic const char * const hdmi_parents[] = { "pll-video0", "pll-video1", 6578c2ecf20Sopenharmony_ci "pll-video1-4x" }; 6588c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", hdmi_parents, 0xb00, 6598c2ecf20Sopenharmony_ci 0, 4, /* M */ 6608c2ecf20Sopenharmony_ci 24, 2, /* mux */ 6618c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6628c2ecf20Sopenharmony_ci 0); 6638c2ecf20Sopenharmony_ci 6648c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(hdmi_slow_clk, "hdmi-slow", "osc24M", 0xb04, BIT(31), 0); 6658c2ecf20Sopenharmony_ci 6668c2ecf20Sopenharmony_cistatic const char * const hdmi_cec_parents[] = { "osc32k", "pll-periph0-2x" }; 6678c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv hdmi_cec_predivs[] = { 6688c2ecf20Sopenharmony_ci { .index = 1, .div = 36621 }, 6698c2ecf20Sopenharmony_ci}; 6708c2ecf20Sopenharmony_ci 6718c2ecf20Sopenharmony_ci#define SUN50I_H6_HDMI_CEC_CLK_REG 0xb10 6728c2ecf20Sopenharmony_cistatic struct ccu_mux hdmi_cec_clk = { 6738c2ecf20Sopenharmony_ci .enable = BIT(31), 6748c2ecf20Sopenharmony_ci 6758c2ecf20Sopenharmony_ci .mux = { 6768c2ecf20Sopenharmony_ci .shift = 24, 6778c2ecf20Sopenharmony_ci .width = 2, 6788c2ecf20Sopenharmony_ci 6798c2ecf20Sopenharmony_ci .fixed_predivs = hdmi_cec_predivs, 6808c2ecf20Sopenharmony_ci .n_predivs = ARRAY_SIZE(hdmi_cec_predivs), 6818c2ecf20Sopenharmony_ci }, 6828c2ecf20Sopenharmony_ci 6838c2ecf20Sopenharmony_ci .common = { 6848c2ecf20Sopenharmony_ci .reg = 0xb10, 6858c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 6868c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("hdmi-cec", 6878c2ecf20Sopenharmony_ci hdmi_cec_parents, 6888c2ecf20Sopenharmony_ci &ccu_mux_ops, 6898c2ecf20Sopenharmony_ci 0), 6908c2ecf20Sopenharmony_ci }, 6918c2ecf20Sopenharmony_ci}; 6928c2ecf20Sopenharmony_ci 6938c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hdmi_clk, "bus-hdmi", "ahb3", 0xb1c, BIT(0), 0); 6948c2ecf20Sopenharmony_ci 6958c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tcon_top_clk, "bus-tcon-top", "ahb3", 6968c2ecf20Sopenharmony_ci 0xb5c, BIT(0), 0); 6978c2ecf20Sopenharmony_ci 6988c2ecf20Sopenharmony_cistatic const char * const tcon_lcd0_parents[] = { "pll-video0", 6998c2ecf20Sopenharmony_ci "pll-video0-4x", 7008c2ecf20Sopenharmony_ci "pll-video1" }; 7018c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(tcon_lcd0_clk, "tcon-lcd0", 7028c2ecf20Sopenharmony_ci tcon_lcd0_parents, 0xb60, 7038c2ecf20Sopenharmony_ci 24, 3, /* mux */ 7048c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7058c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 7068c2ecf20Sopenharmony_ci 7078c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tcon_lcd0_clk, "bus-tcon-lcd0", "ahb3", 7088c2ecf20Sopenharmony_ci 0xb7c, BIT(0), 0); 7098c2ecf20Sopenharmony_ci 7108c2ecf20Sopenharmony_cistatic const char * const tcon_tv0_parents[] = { "pll-video0", 7118c2ecf20Sopenharmony_ci "pll-video0-4x", 7128c2ecf20Sopenharmony_ci "pll-video1", 7138c2ecf20Sopenharmony_ci "pll-video1-4x" }; 7148c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(tcon_tv0_clk, "tcon-tv0", 7158c2ecf20Sopenharmony_ci tcon_tv0_parents, 0xb80, 7168c2ecf20Sopenharmony_ci 0, 4, /* M */ 7178c2ecf20Sopenharmony_ci 8, 2, /* P */ 7188c2ecf20Sopenharmony_ci 24, 3, /* mux */ 7198c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7208c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 7218c2ecf20Sopenharmony_ci 7228c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tcon_tv0_clk, "bus-tcon-tv0", "ahb3", 7238c2ecf20Sopenharmony_ci 0xb9c, BIT(0), 0); 7248c2ecf20Sopenharmony_ci 7258c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(csi_cci_clk, "csi-cci", "osc24M", 0xc00, BIT(0), 0); 7268c2ecf20Sopenharmony_ci 7278c2ecf20Sopenharmony_cistatic const char * const csi_top_parents[] = { "pll-video0", "pll-ve", 7288c2ecf20Sopenharmony_ci "pll-periph0" }; 7298c2ecf20Sopenharmony_cistatic const u8 csi_top_table[] = { 0, 2, 3 }; 7308c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi_top_clk, "csi-top", 7318c2ecf20Sopenharmony_ci csi_top_parents, csi_top_table, 0xc04, 7328c2ecf20Sopenharmony_ci 0, 4, /* M */ 7338c2ecf20Sopenharmony_ci 24, 3, /* mux */ 7348c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7358c2ecf20Sopenharmony_ci 0); 7368c2ecf20Sopenharmony_ci 7378c2ecf20Sopenharmony_cistatic const char * const csi_mclk_parents[] = { "osc24M", "pll-video0", 7388c2ecf20Sopenharmony_ci "pll-periph0", "pll-periph1" }; 7398c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi_mclk_clk, "csi-mclk", 7408c2ecf20Sopenharmony_ci csi_mclk_parents, 0xc08, 7418c2ecf20Sopenharmony_ci 0, 5, /* M */ 7428c2ecf20Sopenharmony_ci 24, 3, /* mux */ 7438c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7448c2ecf20Sopenharmony_ci 0); 7458c2ecf20Sopenharmony_ci 7468c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_csi_clk, "bus-csi", "ahb3", 0xc2c, BIT(0), 0); 7478c2ecf20Sopenharmony_ci 7488c2ecf20Sopenharmony_cistatic const char * const hdcp_parents[] = { "pll-periph0", "pll-periph1" }; 7498c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(hdcp_clk, "hdcp", hdcp_parents, 0xc40, 7508c2ecf20Sopenharmony_ci 0, 4, /* M */ 7518c2ecf20Sopenharmony_ci 24, 2, /* mux */ 7528c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7538c2ecf20Sopenharmony_ci 0); 7548c2ecf20Sopenharmony_ci 7558c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hdcp_clk, "bus-hdcp", "ahb3", 0xc4c, BIT(0), 0); 7568c2ecf20Sopenharmony_ci 7578c2ecf20Sopenharmony_ci/* Fixed factor clocks */ 7588c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_FW_NAME(osc12M_clk, "osc12M", "hosc", 2, 1, 0); 7598c2ecf20Sopenharmony_ci 7608c2ecf20Sopenharmony_cistatic const struct clk_hw *clk_parent_pll_audio[] = { 7618c2ecf20Sopenharmony_ci &pll_audio_base_clk.common.hw 7628c2ecf20Sopenharmony_ci}; 7638c2ecf20Sopenharmony_ci 7648c2ecf20Sopenharmony_ci/* 7658c2ecf20Sopenharmony_ci * The divider of pll-audio is fixed to 24 for now, so 24576000 and 22579200 7668c2ecf20Sopenharmony_ci * rates can be set exactly in conjunction with sigma-delta modulation. 7678c2ecf20Sopenharmony_ci */ 7688c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 7698c2ecf20Sopenharmony_ci clk_parent_pll_audio, 7708c2ecf20Sopenharmony_ci 24, 1, CLK_SET_RATE_PARENT); 7718c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 7728c2ecf20Sopenharmony_ci clk_parent_pll_audio, 7738c2ecf20Sopenharmony_ci 4, 1, CLK_SET_RATE_PARENT); 7748c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 7758c2ecf20Sopenharmony_ci clk_parent_pll_audio, 7768c2ecf20Sopenharmony_ci 2, 1, CLK_SET_RATE_PARENT); 7778c2ecf20Sopenharmony_ci 7788c2ecf20Sopenharmony_cistatic const struct clk_hw *pll_periph0_parents[] = { 7798c2ecf20Sopenharmony_ci &pll_periph0_clk.common.hw 7808c2ecf20Sopenharmony_ci}; 7818c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_periph0_4x_clk, "pll-periph0-4x", 7828c2ecf20Sopenharmony_ci pll_periph0_parents, 7838c2ecf20Sopenharmony_ci 1, 4, 0); 7848c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_periph0_2x_clk, "pll-periph0-2x", 7858c2ecf20Sopenharmony_ci pll_periph0_parents, 7868c2ecf20Sopenharmony_ci 1, 2, 0); 7878c2ecf20Sopenharmony_ci 7888c2ecf20Sopenharmony_cistatic const struct clk_hw *pll_periph1_parents[] = { 7898c2ecf20Sopenharmony_ci &pll_periph1_clk.common.hw 7908c2ecf20Sopenharmony_ci}; 7918c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_periph1_4x_clk, "pll-periph1-4x", 7928c2ecf20Sopenharmony_ci pll_periph1_parents, 7938c2ecf20Sopenharmony_ci 1, 4, 0); 7948c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_periph1_2x_clk, "pll-periph1-2x", 7958c2ecf20Sopenharmony_ci pll_periph1_parents, 7968c2ecf20Sopenharmony_ci 1, 2, 0); 7978c2ecf20Sopenharmony_ci 7988c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_video0_4x_clk, "pll-video0-4x", 7998c2ecf20Sopenharmony_ci &pll_video0_clk.common.hw, 8008c2ecf20Sopenharmony_ci 1, 4, CLK_SET_RATE_PARENT); 8018c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_video1_4x_clk, "pll-video1-4x", 8028c2ecf20Sopenharmony_ci &pll_video1_clk.common.hw, 8038c2ecf20Sopenharmony_ci 1, 4, CLK_SET_RATE_PARENT); 8048c2ecf20Sopenharmony_ci 8058c2ecf20Sopenharmony_cistatic struct ccu_common *sun50i_h6_ccu_clks[] = { 8068c2ecf20Sopenharmony_ci &pll_cpux_clk.common, 8078c2ecf20Sopenharmony_ci &pll_ddr0_clk.common, 8088c2ecf20Sopenharmony_ci &pll_periph0_clk.common, 8098c2ecf20Sopenharmony_ci &pll_periph1_clk.common, 8108c2ecf20Sopenharmony_ci &pll_gpu_clk.common, 8118c2ecf20Sopenharmony_ci &pll_video0_clk.common, 8128c2ecf20Sopenharmony_ci &pll_video1_clk.common, 8138c2ecf20Sopenharmony_ci &pll_ve_clk.common, 8148c2ecf20Sopenharmony_ci &pll_de_clk.common, 8158c2ecf20Sopenharmony_ci &pll_hsic_clk.common, 8168c2ecf20Sopenharmony_ci &pll_audio_base_clk.common, 8178c2ecf20Sopenharmony_ci &cpux_clk.common, 8188c2ecf20Sopenharmony_ci &axi_clk.common, 8198c2ecf20Sopenharmony_ci &cpux_apb_clk.common, 8208c2ecf20Sopenharmony_ci &psi_ahb1_ahb2_clk.common, 8218c2ecf20Sopenharmony_ci &ahb3_clk.common, 8228c2ecf20Sopenharmony_ci &apb1_clk.common, 8238c2ecf20Sopenharmony_ci &apb2_clk.common, 8248c2ecf20Sopenharmony_ci &mbus_clk.common, 8258c2ecf20Sopenharmony_ci &de_clk.common, 8268c2ecf20Sopenharmony_ci &bus_de_clk.common, 8278c2ecf20Sopenharmony_ci &deinterlace_clk.common, 8288c2ecf20Sopenharmony_ci &bus_deinterlace_clk.common, 8298c2ecf20Sopenharmony_ci &gpu_clk.common, 8308c2ecf20Sopenharmony_ci &bus_gpu_clk.common, 8318c2ecf20Sopenharmony_ci &ce_clk.common, 8328c2ecf20Sopenharmony_ci &bus_ce_clk.common, 8338c2ecf20Sopenharmony_ci &ve_clk.common, 8348c2ecf20Sopenharmony_ci &bus_ve_clk.common, 8358c2ecf20Sopenharmony_ci &emce_clk.common, 8368c2ecf20Sopenharmony_ci &bus_emce_clk.common, 8378c2ecf20Sopenharmony_ci &vp9_clk.common, 8388c2ecf20Sopenharmony_ci &bus_vp9_clk.common, 8398c2ecf20Sopenharmony_ci &bus_dma_clk.common, 8408c2ecf20Sopenharmony_ci &bus_msgbox_clk.common, 8418c2ecf20Sopenharmony_ci &bus_spinlock_clk.common, 8428c2ecf20Sopenharmony_ci &bus_hstimer_clk.common, 8438c2ecf20Sopenharmony_ci &avs_clk.common, 8448c2ecf20Sopenharmony_ci &bus_dbg_clk.common, 8458c2ecf20Sopenharmony_ci &bus_psi_clk.common, 8468c2ecf20Sopenharmony_ci &bus_pwm_clk.common, 8478c2ecf20Sopenharmony_ci &bus_iommu_clk.common, 8488c2ecf20Sopenharmony_ci &dram_clk.common, 8498c2ecf20Sopenharmony_ci &mbus_dma_clk.common, 8508c2ecf20Sopenharmony_ci &mbus_ve_clk.common, 8518c2ecf20Sopenharmony_ci &mbus_ce_clk.common, 8528c2ecf20Sopenharmony_ci &mbus_ts_clk.common, 8538c2ecf20Sopenharmony_ci &mbus_nand_clk.common, 8548c2ecf20Sopenharmony_ci &mbus_csi_clk.common, 8558c2ecf20Sopenharmony_ci &mbus_deinterlace_clk.common, 8568c2ecf20Sopenharmony_ci &bus_dram_clk.common, 8578c2ecf20Sopenharmony_ci &nand0_clk.common, 8588c2ecf20Sopenharmony_ci &nand1_clk.common, 8598c2ecf20Sopenharmony_ci &bus_nand_clk.common, 8608c2ecf20Sopenharmony_ci &mmc0_clk.common, 8618c2ecf20Sopenharmony_ci &mmc1_clk.common, 8628c2ecf20Sopenharmony_ci &mmc2_clk.common, 8638c2ecf20Sopenharmony_ci &bus_mmc0_clk.common, 8648c2ecf20Sopenharmony_ci &bus_mmc1_clk.common, 8658c2ecf20Sopenharmony_ci &bus_mmc2_clk.common, 8668c2ecf20Sopenharmony_ci &bus_uart0_clk.common, 8678c2ecf20Sopenharmony_ci &bus_uart1_clk.common, 8688c2ecf20Sopenharmony_ci &bus_uart2_clk.common, 8698c2ecf20Sopenharmony_ci &bus_uart3_clk.common, 8708c2ecf20Sopenharmony_ci &bus_i2c0_clk.common, 8718c2ecf20Sopenharmony_ci &bus_i2c1_clk.common, 8728c2ecf20Sopenharmony_ci &bus_i2c2_clk.common, 8738c2ecf20Sopenharmony_ci &bus_i2c3_clk.common, 8748c2ecf20Sopenharmony_ci &bus_scr0_clk.common, 8758c2ecf20Sopenharmony_ci &bus_scr1_clk.common, 8768c2ecf20Sopenharmony_ci &spi0_clk.common, 8778c2ecf20Sopenharmony_ci &spi1_clk.common, 8788c2ecf20Sopenharmony_ci &bus_spi0_clk.common, 8798c2ecf20Sopenharmony_ci &bus_spi1_clk.common, 8808c2ecf20Sopenharmony_ci &bus_emac_clk.common, 8818c2ecf20Sopenharmony_ci &ts_clk.common, 8828c2ecf20Sopenharmony_ci &bus_ts_clk.common, 8838c2ecf20Sopenharmony_ci &ir_tx_clk.common, 8848c2ecf20Sopenharmony_ci &bus_ir_tx_clk.common, 8858c2ecf20Sopenharmony_ci &bus_ths_clk.common, 8868c2ecf20Sopenharmony_ci &i2s3_clk.common, 8878c2ecf20Sopenharmony_ci &i2s0_clk.common, 8888c2ecf20Sopenharmony_ci &i2s1_clk.common, 8898c2ecf20Sopenharmony_ci &i2s2_clk.common, 8908c2ecf20Sopenharmony_ci &bus_i2s0_clk.common, 8918c2ecf20Sopenharmony_ci &bus_i2s1_clk.common, 8928c2ecf20Sopenharmony_ci &bus_i2s2_clk.common, 8938c2ecf20Sopenharmony_ci &bus_i2s3_clk.common, 8948c2ecf20Sopenharmony_ci &spdif_clk.common, 8958c2ecf20Sopenharmony_ci &bus_spdif_clk.common, 8968c2ecf20Sopenharmony_ci &dmic_clk.common, 8978c2ecf20Sopenharmony_ci &bus_dmic_clk.common, 8988c2ecf20Sopenharmony_ci &audio_hub_clk.common, 8998c2ecf20Sopenharmony_ci &bus_audio_hub_clk.common, 9008c2ecf20Sopenharmony_ci &usb_ohci0_clk.common, 9018c2ecf20Sopenharmony_ci &usb_phy0_clk.common, 9028c2ecf20Sopenharmony_ci &usb_phy1_clk.common, 9038c2ecf20Sopenharmony_ci &usb_ohci3_clk.common, 9048c2ecf20Sopenharmony_ci &usb_phy3_clk.common, 9058c2ecf20Sopenharmony_ci &usb_hsic_12m_clk.common, 9068c2ecf20Sopenharmony_ci &usb_hsic_clk.common, 9078c2ecf20Sopenharmony_ci &bus_ohci0_clk.common, 9088c2ecf20Sopenharmony_ci &bus_ohci3_clk.common, 9098c2ecf20Sopenharmony_ci &bus_ehci0_clk.common, 9108c2ecf20Sopenharmony_ci &bus_xhci_clk.common, 9118c2ecf20Sopenharmony_ci &bus_ehci3_clk.common, 9128c2ecf20Sopenharmony_ci &bus_otg_clk.common, 9138c2ecf20Sopenharmony_ci &pcie_ref_clk.common, 9148c2ecf20Sopenharmony_ci &pcie_ref_out_clk.common, 9158c2ecf20Sopenharmony_ci &pcie_maxi_clk.common, 9168c2ecf20Sopenharmony_ci &pcie_aux_clk.common, 9178c2ecf20Sopenharmony_ci &bus_pcie_clk.common, 9188c2ecf20Sopenharmony_ci &hdmi_clk.common, 9198c2ecf20Sopenharmony_ci &hdmi_slow_clk.common, 9208c2ecf20Sopenharmony_ci &hdmi_cec_clk.common, 9218c2ecf20Sopenharmony_ci &bus_hdmi_clk.common, 9228c2ecf20Sopenharmony_ci &bus_tcon_top_clk.common, 9238c2ecf20Sopenharmony_ci &tcon_lcd0_clk.common, 9248c2ecf20Sopenharmony_ci &bus_tcon_lcd0_clk.common, 9258c2ecf20Sopenharmony_ci &tcon_tv0_clk.common, 9268c2ecf20Sopenharmony_ci &bus_tcon_tv0_clk.common, 9278c2ecf20Sopenharmony_ci &csi_cci_clk.common, 9288c2ecf20Sopenharmony_ci &csi_top_clk.common, 9298c2ecf20Sopenharmony_ci &csi_mclk_clk.common, 9308c2ecf20Sopenharmony_ci &bus_csi_clk.common, 9318c2ecf20Sopenharmony_ci &hdcp_clk.common, 9328c2ecf20Sopenharmony_ci &bus_hdcp_clk.common, 9338c2ecf20Sopenharmony_ci}; 9348c2ecf20Sopenharmony_ci 9358c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun50i_h6_hw_clks = { 9368c2ecf20Sopenharmony_ci .hws = { 9378c2ecf20Sopenharmony_ci [CLK_OSC12M] = &osc12M_clk.hw, 9388c2ecf20Sopenharmony_ci [CLK_PLL_CPUX] = &pll_cpux_clk.common.hw, 9398c2ecf20Sopenharmony_ci [CLK_PLL_DDR0] = &pll_ddr0_clk.common.hw, 9408c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw, 9418c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw, 9428c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH0_4X] = &pll_periph0_4x_clk.hw, 9438c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw, 9448c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH1_2X] = &pll_periph1_2x_clk.hw, 9458c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH1_4X] = &pll_periph1_4x_clk.hw, 9468c2ecf20Sopenharmony_ci [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 9478c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 9488c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0_4X] = &pll_video0_4x_clk.hw, 9498c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 9508c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1_4X] = &pll_video1_4x_clk.hw, 9518c2ecf20Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 9528c2ecf20Sopenharmony_ci [CLK_PLL_DE] = &pll_de_clk.common.hw, 9538c2ecf20Sopenharmony_ci [CLK_PLL_HSIC] = &pll_hsic_clk.common.hw, 9548c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, 9558c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.hw, 9568c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, 9578c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, 9588c2ecf20Sopenharmony_ci [CLK_CPUX] = &cpux_clk.common.hw, 9598c2ecf20Sopenharmony_ci [CLK_AXI] = &axi_clk.common.hw, 9608c2ecf20Sopenharmony_ci [CLK_CPUX_APB] = &cpux_apb_clk.common.hw, 9618c2ecf20Sopenharmony_ci [CLK_PSI_AHB1_AHB2] = &psi_ahb1_ahb2_clk.common.hw, 9628c2ecf20Sopenharmony_ci [CLK_AHB3] = &ahb3_clk.common.hw, 9638c2ecf20Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 9648c2ecf20Sopenharmony_ci [CLK_APB2] = &apb2_clk.common.hw, 9658c2ecf20Sopenharmony_ci [CLK_MBUS] = &mbus_clk.common.hw, 9668c2ecf20Sopenharmony_ci [CLK_DE] = &de_clk.common.hw, 9678c2ecf20Sopenharmony_ci [CLK_BUS_DE] = &bus_de_clk.common.hw, 9688c2ecf20Sopenharmony_ci [CLK_DEINTERLACE] = &deinterlace_clk.common.hw, 9698c2ecf20Sopenharmony_ci [CLK_BUS_DEINTERLACE] = &bus_deinterlace_clk.common.hw, 9708c2ecf20Sopenharmony_ci [CLK_GPU] = &gpu_clk.common.hw, 9718c2ecf20Sopenharmony_ci [CLK_BUS_GPU] = &bus_gpu_clk.common.hw, 9728c2ecf20Sopenharmony_ci [CLK_CE] = &ce_clk.common.hw, 9738c2ecf20Sopenharmony_ci [CLK_BUS_CE] = &bus_ce_clk.common.hw, 9748c2ecf20Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 9758c2ecf20Sopenharmony_ci [CLK_BUS_VE] = &bus_ve_clk.common.hw, 9768c2ecf20Sopenharmony_ci [CLK_EMCE] = &emce_clk.common.hw, 9778c2ecf20Sopenharmony_ci [CLK_BUS_EMCE] = &bus_emce_clk.common.hw, 9788c2ecf20Sopenharmony_ci [CLK_VP9] = &vp9_clk.common.hw, 9798c2ecf20Sopenharmony_ci [CLK_BUS_VP9] = &bus_vp9_clk.common.hw, 9808c2ecf20Sopenharmony_ci [CLK_BUS_DMA] = &bus_dma_clk.common.hw, 9818c2ecf20Sopenharmony_ci [CLK_BUS_MSGBOX] = &bus_msgbox_clk.common.hw, 9828c2ecf20Sopenharmony_ci [CLK_BUS_SPINLOCK] = &bus_spinlock_clk.common.hw, 9838c2ecf20Sopenharmony_ci [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw, 9848c2ecf20Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 9858c2ecf20Sopenharmony_ci [CLK_BUS_DBG] = &bus_dbg_clk.common.hw, 9868c2ecf20Sopenharmony_ci [CLK_BUS_PSI] = &bus_psi_clk.common.hw, 9878c2ecf20Sopenharmony_ci [CLK_BUS_PWM] = &bus_pwm_clk.common.hw, 9888c2ecf20Sopenharmony_ci [CLK_BUS_IOMMU] = &bus_iommu_clk.common.hw, 9898c2ecf20Sopenharmony_ci [CLK_DRAM] = &dram_clk.common.hw, 9908c2ecf20Sopenharmony_ci [CLK_MBUS_DMA] = &mbus_dma_clk.common.hw, 9918c2ecf20Sopenharmony_ci [CLK_MBUS_VE] = &mbus_ve_clk.common.hw, 9928c2ecf20Sopenharmony_ci [CLK_MBUS_CE] = &mbus_ce_clk.common.hw, 9938c2ecf20Sopenharmony_ci [CLK_MBUS_TS] = &mbus_ts_clk.common.hw, 9948c2ecf20Sopenharmony_ci [CLK_MBUS_NAND] = &mbus_nand_clk.common.hw, 9958c2ecf20Sopenharmony_ci [CLK_MBUS_CSI] = &mbus_csi_clk.common.hw, 9968c2ecf20Sopenharmony_ci [CLK_MBUS_DEINTERLACE] = &mbus_deinterlace_clk.common.hw, 9978c2ecf20Sopenharmony_ci [CLK_BUS_DRAM] = &bus_dram_clk.common.hw, 9988c2ecf20Sopenharmony_ci [CLK_NAND0] = &nand0_clk.common.hw, 9998c2ecf20Sopenharmony_ci [CLK_NAND1] = &nand1_clk.common.hw, 10008c2ecf20Sopenharmony_ci [CLK_BUS_NAND] = &bus_nand_clk.common.hw, 10018c2ecf20Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 10028c2ecf20Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 10038c2ecf20Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 10048c2ecf20Sopenharmony_ci [CLK_BUS_MMC0] = &bus_mmc0_clk.common.hw, 10058c2ecf20Sopenharmony_ci [CLK_BUS_MMC1] = &bus_mmc1_clk.common.hw, 10068c2ecf20Sopenharmony_ci [CLK_BUS_MMC2] = &bus_mmc2_clk.common.hw, 10078c2ecf20Sopenharmony_ci [CLK_BUS_UART0] = &bus_uart0_clk.common.hw, 10088c2ecf20Sopenharmony_ci [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 10098c2ecf20Sopenharmony_ci [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 10108c2ecf20Sopenharmony_ci [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 10118c2ecf20Sopenharmony_ci [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw, 10128c2ecf20Sopenharmony_ci [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw, 10138c2ecf20Sopenharmony_ci [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw, 10148c2ecf20Sopenharmony_ci [CLK_BUS_I2C3] = &bus_i2c3_clk.common.hw, 10158c2ecf20Sopenharmony_ci [CLK_BUS_SCR0] = &bus_scr0_clk.common.hw, 10168c2ecf20Sopenharmony_ci [CLK_BUS_SCR1] = &bus_scr1_clk.common.hw, 10178c2ecf20Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 10188c2ecf20Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 10198c2ecf20Sopenharmony_ci [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw, 10208c2ecf20Sopenharmony_ci [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw, 10218c2ecf20Sopenharmony_ci [CLK_BUS_EMAC] = &bus_emac_clk.common.hw, 10228c2ecf20Sopenharmony_ci [CLK_TS] = &ts_clk.common.hw, 10238c2ecf20Sopenharmony_ci [CLK_BUS_TS] = &bus_ts_clk.common.hw, 10248c2ecf20Sopenharmony_ci [CLK_IR_TX] = &ir_tx_clk.common.hw, 10258c2ecf20Sopenharmony_ci [CLK_BUS_IR_TX] = &bus_ir_tx_clk.common.hw, 10268c2ecf20Sopenharmony_ci [CLK_BUS_THS] = &bus_ths_clk.common.hw, 10278c2ecf20Sopenharmony_ci [CLK_I2S3] = &i2s3_clk.common.hw, 10288c2ecf20Sopenharmony_ci [CLK_I2S0] = &i2s0_clk.common.hw, 10298c2ecf20Sopenharmony_ci [CLK_I2S1] = &i2s1_clk.common.hw, 10308c2ecf20Sopenharmony_ci [CLK_I2S2] = &i2s2_clk.common.hw, 10318c2ecf20Sopenharmony_ci [CLK_BUS_I2S0] = &bus_i2s0_clk.common.hw, 10328c2ecf20Sopenharmony_ci [CLK_BUS_I2S1] = &bus_i2s1_clk.common.hw, 10338c2ecf20Sopenharmony_ci [CLK_BUS_I2S2] = &bus_i2s2_clk.common.hw, 10348c2ecf20Sopenharmony_ci [CLK_BUS_I2S3] = &bus_i2s3_clk.common.hw, 10358c2ecf20Sopenharmony_ci [CLK_SPDIF] = &spdif_clk.common.hw, 10368c2ecf20Sopenharmony_ci [CLK_BUS_SPDIF] = &bus_spdif_clk.common.hw, 10378c2ecf20Sopenharmony_ci [CLK_DMIC] = &dmic_clk.common.hw, 10388c2ecf20Sopenharmony_ci [CLK_BUS_DMIC] = &bus_dmic_clk.common.hw, 10398c2ecf20Sopenharmony_ci [CLK_AUDIO_HUB] = &audio_hub_clk.common.hw, 10408c2ecf20Sopenharmony_ci [CLK_BUS_AUDIO_HUB] = &bus_audio_hub_clk.common.hw, 10418c2ecf20Sopenharmony_ci [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw, 10428c2ecf20Sopenharmony_ci [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 10438c2ecf20Sopenharmony_ci [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 10448c2ecf20Sopenharmony_ci [CLK_USB_OHCI3] = &usb_ohci3_clk.common.hw, 10458c2ecf20Sopenharmony_ci [CLK_USB_PHY3] = &usb_phy3_clk.common.hw, 10468c2ecf20Sopenharmony_ci [CLK_USB_HSIC_12M] = &usb_hsic_12m_clk.common.hw, 10478c2ecf20Sopenharmony_ci [CLK_USB_HSIC] = &usb_hsic_clk.common.hw, 10488c2ecf20Sopenharmony_ci [CLK_BUS_OHCI0] = &bus_ohci0_clk.common.hw, 10498c2ecf20Sopenharmony_ci [CLK_BUS_OHCI3] = &bus_ohci3_clk.common.hw, 10508c2ecf20Sopenharmony_ci [CLK_BUS_EHCI0] = &bus_ehci0_clk.common.hw, 10518c2ecf20Sopenharmony_ci [CLK_BUS_XHCI] = &bus_xhci_clk.common.hw, 10528c2ecf20Sopenharmony_ci [CLK_BUS_EHCI3] = &bus_ehci3_clk.common.hw, 10538c2ecf20Sopenharmony_ci [CLK_BUS_OTG] = &bus_otg_clk.common.hw, 10548c2ecf20Sopenharmony_ci [CLK_PCIE_REF_100M] = &pcie_ref_100m_clk.hw, 10558c2ecf20Sopenharmony_ci [CLK_PCIE_REF] = &pcie_ref_clk.common.hw, 10568c2ecf20Sopenharmony_ci [CLK_PCIE_REF_OUT] = &pcie_ref_out_clk.common.hw, 10578c2ecf20Sopenharmony_ci [CLK_PCIE_MAXI] = &pcie_maxi_clk.common.hw, 10588c2ecf20Sopenharmony_ci [CLK_PCIE_AUX] = &pcie_aux_clk.common.hw, 10598c2ecf20Sopenharmony_ci [CLK_BUS_PCIE] = &bus_pcie_clk.common.hw, 10608c2ecf20Sopenharmony_ci [CLK_HDMI] = &hdmi_clk.common.hw, 10618c2ecf20Sopenharmony_ci [CLK_HDMI_SLOW] = &hdmi_slow_clk.common.hw, 10628c2ecf20Sopenharmony_ci [CLK_HDMI_CEC] = &hdmi_cec_clk.common.hw, 10638c2ecf20Sopenharmony_ci [CLK_BUS_HDMI] = &bus_hdmi_clk.common.hw, 10648c2ecf20Sopenharmony_ci [CLK_BUS_TCON_TOP] = &bus_tcon_top_clk.common.hw, 10658c2ecf20Sopenharmony_ci [CLK_TCON_LCD0] = &tcon_lcd0_clk.common.hw, 10668c2ecf20Sopenharmony_ci [CLK_BUS_TCON_LCD0] = &bus_tcon_lcd0_clk.common.hw, 10678c2ecf20Sopenharmony_ci [CLK_TCON_TV0] = &tcon_tv0_clk.common.hw, 10688c2ecf20Sopenharmony_ci [CLK_BUS_TCON_TV0] = &bus_tcon_tv0_clk.common.hw, 10698c2ecf20Sopenharmony_ci [CLK_CSI_CCI] = &csi_cci_clk.common.hw, 10708c2ecf20Sopenharmony_ci [CLK_CSI_TOP] = &csi_top_clk.common.hw, 10718c2ecf20Sopenharmony_ci [CLK_CSI_MCLK] = &csi_mclk_clk.common.hw, 10728c2ecf20Sopenharmony_ci [CLK_BUS_CSI] = &bus_csi_clk.common.hw, 10738c2ecf20Sopenharmony_ci [CLK_HDCP] = &hdcp_clk.common.hw, 10748c2ecf20Sopenharmony_ci [CLK_BUS_HDCP] = &bus_hdcp_clk.common.hw, 10758c2ecf20Sopenharmony_ci }, 10768c2ecf20Sopenharmony_ci .num = CLK_NUMBER, 10778c2ecf20Sopenharmony_ci}; 10788c2ecf20Sopenharmony_ci 10798c2ecf20Sopenharmony_cistatic struct ccu_reset_map sun50i_h6_ccu_resets[] = { 10808c2ecf20Sopenharmony_ci [RST_MBUS] = { 0x540, BIT(30) }, 10818c2ecf20Sopenharmony_ci 10828c2ecf20Sopenharmony_ci [RST_BUS_DE] = { 0x60c, BIT(16) }, 10838c2ecf20Sopenharmony_ci [RST_BUS_DEINTERLACE] = { 0x62c, BIT(16) }, 10848c2ecf20Sopenharmony_ci [RST_BUS_GPU] = { 0x67c, BIT(16) }, 10858c2ecf20Sopenharmony_ci [RST_BUS_CE] = { 0x68c, BIT(16) }, 10868c2ecf20Sopenharmony_ci [RST_BUS_VE] = { 0x69c, BIT(16) }, 10878c2ecf20Sopenharmony_ci [RST_BUS_EMCE] = { 0x6bc, BIT(16) }, 10888c2ecf20Sopenharmony_ci [RST_BUS_VP9] = { 0x6cc, BIT(16) }, 10898c2ecf20Sopenharmony_ci [RST_BUS_DMA] = { 0x70c, BIT(16) }, 10908c2ecf20Sopenharmony_ci [RST_BUS_MSGBOX] = { 0x71c, BIT(16) }, 10918c2ecf20Sopenharmony_ci [RST_BUS_SPINLOCK] = { 0x72c, BIT(16) }, 10928c2ecf20Sopenharmony_ci [RST_BUS_HSTIMER] = { 0x73c, BIT(16) }, 10938c2ecf20Sopenharmony_ci [RST_BUS_DBG] = { 0x78c, BIT(16) }, 10948c2ecf20Sopenharmony_ci [RST_BUS_PSI] = { 0x79c, BIT(16) }, 10958c2ecf20Sopenharmony_ci [RST_BUS_PWM] = { 0x7ac, BIT(16) }, 10968c2ecf20Sopenharmony_ci [RST_BUS_IOMMU] = { 0x7bc, BIT(16) }, 10978c2ecf20Sopenharmony_ci [RST_BUS_DRAM] = { 0x80c, BIT(16) }, 10988c2ecf20Sopenharmony_ci [RST_BUS_NAND] = { 0x82c, BIT(16) }, 10998c2ecf20Sopenharmony_ci [RST_BUS_MMC0] = { 0x84c, BIT(16) }, 11008c2ecf20Sopenharmony_ci [RST_BUS_MMC1] = { 0x84c, BIT(17) }, 11018c2ecf20Sopenharmony_ci [RST_BUS_MMC2] = { 0x84c, BIT(18) }, 11028c2ecf20Sopenharmony_ci [RST_BUS_UART0] = { 0x90c, BIT(16) }, 11038c2ecf20Sopenharmony_ci [RST_BUS_UART1] = { 0x90c, BIT(17) }, 11048c2ecf20Sopenharmony_ci [RST_BUS_UART2] = { 0x90c, BIT(18) }, 11058c2ecf20Sopenharmony_ci [RST_BUS_UART3] = { 0x90c, BIT(19) }, 11068c2ecf20Sopenharmony_ci [RST_BUS_I2C0] = { 0x91c, BIT(16) }, 11078c2ecf20Sopenharmony_ci [RST_BUS_I2C1] = { 0x91c, BIT(17) }, 11088c2ecf20Sopenharmony_ci [RST_BUS_I2C2] = { 0x91c, BIT(18) }, 11098c2ecf20Sopenharmony_ci [RST_BUS_I2C3] = { 0x91c, BIT(19) }, 11108c2ecf20Sopenharmony_ci [RST_BUS_SCR0] = { 0x93c, BIT(16) }, 11118c2ecf20Sopenharmony_ci [RST_BUS_SCR1] = { 0x93c, BIT(17) }, 11128c2ecf20Sopenharmony_ci [RST_BUS_SPI0] = { 0x96c, BIT(16) }, 11138c2ecf20Sopenharmony_ci [RST_BUS_SPI1] = { 0x96c, BIT(17) }, 11148c2ecf20Sopenharmony_ci [RST_BUS_EMAC] = { 0x97c, BIT(16) }, 11158c2ecf20Sopenharmony_ci [RST_BUS_TS] = { 0x9bc, BIT(16) }, 11168c2ecf20Sopenharmony_ci [RST_BUS_IR_TX] = { 0x9cc, BIT(16) }, 11178c2ecf20Sopenharmony_ci [RST_BUS_THS] = { 0x9fc, BIT(16) }, 11188c2ecf20Sopenharmony_ci [RST_BUS_I2S0] = { 0xa1c, BIT(16) }, 11198c2ecf20Sopenharmony_ci [RST_BUS_I2S1] = { 0xa1c, BIT(17) }, 11208c2ecf20Sopenharmony_ci [RST_BUS_I2S2] = { 0xa1c, BIT(18) }, 11218c2ecf20Sopenharmony_ci [RST_BUS_I2S3] = { 0xa1c, BIT(19) }, 11228c2ecf20Sopenharmony_ci [RST_BUS_SPDIF] = { 0xa2c, BIT(16) }, 11238c2ecf20Sopenharmony_ci [RST_BUS_DMIC] = { 0xa4c, BIT(16) }, 11248c2ecf20Sopenharmony_ci [RST_BUS_AUDIO_HUB] = { 0xa6c, BIT(16) }, 11258c2ecf20Sopenharmony_ci 11268c2ecf20Sopenharmony_ci [RST_USB_PHY0] = { 0xa70, BIT(30) }, 11278c2ecf20Sopenharmony_ci [RST_USB_PHY1] = { 0xa74, BIT(30) }, 11288c2ecf20Sopenharmony_ci [RST_USB_PHY3] = { 0xa7c, BIT(30) }, 11298c2ecf20Sopenharmony_ci [RST_USB_HSIC] = { 0xa7c, BIT(28) }, 11308c2ecf20Sopenharmony_ci 11318c2ecf20Sopenharmony_ci [RST_BUS_OHCI0] = { 0xa8c, BIT(16) }, 11328c2ecf20Sopenharmony_ci [RST_BUS_OHCI3] = { 0xa8c, BIT(19) }, 11338c2ecf20Sopenharmony_ci [RST_BUS_EHCI0] = { 0xa8c, BIT(20) }, 11348c2ecf20Sopenharmony_ci [RST_BUS_XHCI] = { 0xa8c, BIT(21) }, 11358c2ecf20Sopenharmony_ci [RST_BUS_EHCI3] = { 0xa8c, BIT(23) }, 11368c2ecf20Sopenharmony_ci [RST_BUS_OTG] = { 0xa8c, BIT(24) }, 11378c2ecf20Sopenharmony_ci [RST_BUS_PCIE] = { 0xabc, BIT(16) }, 11388c2ecf20Sopenharmony_ci 11398c2ecf20Sopenharmony_ci [RST_PCIE_POWERUP] = { 0xabc, BIT(17) }, 11408c2ecf20Sopenharmony_ci 11418c2ecf20Sopenharmony_ci [RST_BUS_HDMI] = { 0xb1c, BIT(16) }, 11428c2ecf20Sopenharmony_ci [RST_BUS_HDMI_SUB] = { 0xb1c, BIT(17) }, 11438c2ecf20Sopenharmony_ci [RST_BUS_TCON_TOP] = { 0xb5c, BIT(16) }, 11448c2ecf20Sopenharmony_ci [RST_BUS_TCON_LCD0] = { 0xb7c, BIT(16) }, 11458c2ecf20Sopenharmony_ci [RST_BUS_TCON_TV0] = { 0xb9c, BIT(16) }, 11468c2ecf20Sopenharmony_ci [RST_BUS_CSI] = { 0xc2c, BIT(16) }, 11478c2ecf20Sopenharmony_ci [RST_BUS_HDCP] = { 0xc4c, BIT(16) }, 11488c2ecf20Sopenharmony_ci}; 11498c2ecf20Sopenharmony_ci 11508c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun50i_h6_ccu_desc = { 11518c2ecf20Sopenharmony_ci .ccu_clks = sun50i_h6_ccu_clks, 11528c2ecf20Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun50i_h6_ccu_clks), 11538c2ecf20Sopenharmony_ci 11548c2ecf20Sopenharmony_ci .hw_clks = &sun50i_h6_hw_clks, 11558c2ecf20Sopenharmony_ci 11568c2ecf20Sopenharmony_ci .resets = sun50i_h6_ccu_resets, 11578c2ecf20Sopenharmony_ci .num_resets = ARRAY_SIZE(sun50i_h6_ccu_resets), 11588c2ecf20Sopenharmony_ci}; 11598c2ecf20Sopenharmony_ci 11608c2ecf20Sopenharmony_cistatic const u32 pll_regs[] = { 11618c2ecf20Sopenharmony_ci SUN50I_H6_PLL_CPUX_REG, 11628c2ecf20Sopenharmony_ci SUN50I_H6_PLL_DDR0_REG, 11638c2ecf20Sopenharmony_ci SUN50I_H6_PLL_PERIPH0_REG, 11648c2ecf20Sopenharmony_ci SUN50I_H6_PLL_PERIPH1_REG, 11658c2ecf20Sopenharmony_ci SUN50I_H6_PLL_GPU_REG, 11668c2ecf20Sopenharmony_ci SUN50I_H6_PLL_VIDEO0_REG, 11678c2ecf20Sopenharmony_ci SUN50I_H6_PLL_VIDEO1_REG, 11688c2ecf20Sopenharmony_ci SUN50I_H6_PLL_VE_REG, 11698c2ecf20Sopenharmony_ci SUN50I_H6_PLL_DE_REG, 11708c2ecf20Sopenharmony_ci SUN50I_H6_PLL_HSIC_REG, 11718c2ecf20Sopenharmony_ci SUN50I_H6_PLL_AUDIO_REG, 11728c2ecf20Sopenharmony_ci}; 11738c2ecf20Sopenharmony_ci 11748c2ecf20Sopenharmony_cistatic const u32 pll_video_regs[] = { 11758c2ecf20Sopenharmony_ci SUN50I_H6_PLL_VIDEO0_REG, 11768c2ecf20Sopenharmony_ci SUN50I_H6_PLL_VIDEO1_REG, 11778c2ecf20Sopenharmony_ci}; 11788c2ecf20Sopenharmony_ci 11798c2ecf20Sopenharmony_cistatic const u32 usb2_clk_regs[] = { 11808c2ecf20Sopenharmony_ci SUN50I_H6_USB0_CLK_REG, 11818c2ecf20Sopenharmony_ci SUN50I_H6_USB3_CLK_REG, 11828c2ecf20Sopenharmony_ci}; 11838c2ecf20Sopenharmony_ci 11848c2ecf20Sopenharmony_cistatic int sun50i_h6_ccu_probe(struct platform_device *pdev) 11858c2ecf20Sopenharmony_ci{ 11868c2ecf20Sopenharmony_ci struct resource *res; 11878c2ecf20Sopenharmony_ci void __iomem *reg; 11888c2ecf20Sopenharmony_ci u32 val; 11898c2ecf20Sopenharmony_ci int i; 11908c2ecf20Sopenharmony_ci 11918c2ecf20Sopenharmony_ci res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 11928c2ecf20Sopenharmony_ci reg = devm_ioremap_resource(&pdev->dev, res); 11938c2ecf20Sopenharmony_ci if (IS_ERR(reg)) 11948c2ecf20Sopenharmony_ci return PTR_ERR(reg); 11958c2ecf20Sopenharmony_ci 11968c2ecf20Sopenharmony_ci /* Enable the lock bits on all PLLs */ 11978c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(pll_regs); i++) { 11988c2ecf20Sopenharmony_ci val = readl(reg + pll_regs[i]); 11998c2ecf20Sopenharmony_ci val |= BIT(29); 12008c2ecf20Sopenharmony_ci writel(val, reg + pll_regs[i]); 12018c2ecf20Sopenharmony_ci } 12028c2ecf20Sopenharmony_ci 12038c2ecf20Sopenharmony_ci /* 12048c2ecf20Sopenharmony_ci * Force the output divider of video PLLs to 0. 12058c2ecf20Sopenharmony_ci * 12068c2ecf20Sopenharmony_ci * See the comment before pll-video0 definition for the reason. 12078c2ecf20Sopenharmony_ci */ 12088c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(pll_video_regs); i++) { 12098c2ecf20Sopenharmony_ci val = readl(reg + pll_video_regs[i]); 12108c2ecf20Sopenharmony_ci val &= ~BIT(0); 12118c2ecf20Sopenharmony_ci writel(val, reg + pll_video_regs[i]); 12128c2ecf20Sopenharmony_ci } 12138c2ecf20Sopenharmony_ci 12148c2ecf20Sopenharmony_ci /* 12158c2ecf20Sopenharmony_ci * Force OHCI 12M clock sources to 00 (12MHz divided from 48MHz) 12168c2ecf20Sopenharmony_ci * 12178c2ecf20Sopenharmony_ci * This clock mux is still mysterious, and the code just enforces 12188c2ecf20Sopenharmony_ci * it to have a valid clock parent. 12198c2ecf20Sopenharmony_ci */ 12208c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(usb2_clk_regs); i++) { 12218c2ecf20Sopenharmony_ci val = readl(reg + usb2_clk_regs[i]); 12228c2ecf20Sopenharmony_ci val &= ~GENMASK(25, 24); 12238c2ecf20Sopenharmony_ci writel (val, reg + usb2_clk_regs[i]); 12248c2ecf20Sopenharmony_ci } 12258c2ecf20Sopenharmony_ci 12268c2ecf20Sopenharmony_ci /* 12278c2ecf20Sopenharmony_ci * Force the post-divider of pll-audio to 12 and the output divider 12288c2ecf20Sopenharmony_ci * of it to 2, so 24576000 and 22579200 rates can be set exactly. 12298c2ecf20Sopenharmony_ci */ 12308c2ecf20Sopenharmony_ci val = readl(reg + SUN50I_H6_PLL_AUDIO_REG); 12318c2ecf20Sopenharmony_ci val &= ~(GENMASK(21, 16) | BIT(0)); 12328c2ecf20Sopenharmony_ci writel(val | (11 << 16) | BIT(0), reg + SUN50I_H6_PLL_AUDIO_REG); 12338c2ecf20Sopenharmony_ci 12348c2ecf20Sopenharmony_ci /* 12358c2ecf20Sopenharmony_ci * First clock parent (osc32K) is unusable for CEC. But since there 12368c2ecf20Sopenharmony_ci * is no good way to force parent switch (both run with same frequency), 12378c2ecf20Sopenharmony_ci * just set second clock parent here. 12388c2ecf20Sopenharmony_ci */ 12398c2ecf20Sopenharmony_ci val = readl(reg + SUN50I_H6_HDMI_CEC_CLK_REG); 12408c2ecf20Sopenharmony_ci val |= BIT(24); 12418c2ecf20Sopenharmony_ci writel(val, reg + SUN50I_H6_HDMI_CEC_CLK_REG); 12428c2ecf20Sopenharmony_ci 12438c2ecf20Sopenharmony_ci return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_h6_ccu_desc); 12448c2ecf20Sopenharmony_ci} 12458c2ecf20Sopenharmony_ci 12468c2ecf20Sopenharmony_cistatic const struct of_device_id sun50i_h6_ccu_ids[] = { 12478c2ecf20Sopenharmony_ci { .compatible = "allwinner,sun50i-h6-ccu" }, 12488c2ecf20Sopenharmony_ci { } 12498c2ecf20Sopenharmony_ci}; 12508c2ecf20Sopenharmony_ci 12518c2ecf20Sopenharmony_cistatic struct platform_driver sun50i_h6_ccu_driver = { 12528c2ecf20Sopenharmony_ci .probe = sun50i_h6_ccu_probe, 12538c2ecf20Sopenharmony_ci .driver = { 12548c2ecf20Sopenharmony_ci .name = "sun50i-h6-ccu", 12558c2ecf20Sopenharmony_ci .of_match_table = sun50i_h6_ccu_ids, 12568c2ecf20Sopenharmony_ci }, 12578c2ecf20Sopenharmony_ci}; 12588c2ecf20Sopenharmony_cibuiltin_platform_driver(sun50i_h6_ccu_driver); 1259