18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2016 Chen-Yu Tsai 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Chen-Yu Tsai <wens@csie.org> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Based on ccu-sun8i-h3.c by Maxime Ripard. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 118c2ecf20Sopenharmony_ci#include <linux/io.h> 128c2ecf20Sopenharmony_ci#include <linux/of_address.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include "ccu_common.h" 158c2ecf20Sopenharmony_ci#include "ccu_reset.h" 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include "ccu_div.h" 188c2ecf20Sopenharmony_ci#include "ccu_gate.h" 198c2ecf20Sopenharmony_ci#include "ccu_mp.h" 208c2ecf20Sopenharmony_ci#include "ccu_mult.h" 218c2ecf20Sopenharmony_ci#include "ccu_mux.h" 228c2ecf20Sopenharmony_ci#include "ccu_nk.h" 238c2ecf20Sopenharmony_ci#include "ccu_nkm.h" 248c2ecf20Sopenharmony_ci#include "ccu_nkmp.h" 258c2ecf20Sopenharmony_ci#include "ccu_nm.h" 268c2ecf20Sopenharmony_ci#include "ccu_phase.h" 278c2ecf20Sopenharmony_ci#include "ccu_sdm.h" 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#include "ccu-sun6i-a31.h" 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_cistatic SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_cpu_clk, "pll-cpu", 328c2ecf20Sopenharmony_ci "osc24M", 0x000, 338c2ecf20Sopenharmony_ci 8, 5, /* N */ 348c2ecf20Sopenharmony_ci 4, 2, /* K */ 358c2ecf20Sopenharmony_ci 0, 2, /* M */ 368c2ecf20Sopenharmony_ci BIT(31), /* gate */ 378c2ecf20Sopenharmony_ci BIT(28), /* lock */ 388c2ecf20Sopenharmony_ci 0); 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci/* 418c2ecf20Sopenharmony_ci * The Audio PLL is supposed to have 4 outputs: 3 fixed factors from 428c2ecf20Sopenharmony_ci * the base (2x, 4x and 8x), and one variable divider (the one true 438c2ecf20Sopenharmony_ci * pll audio). 448c2ecf20Sopenharmony_ci * 458c2ecf20Sopenharmony_ci * With sigma-delta modulation for fractional-N on the audio PLL, 468c2ecf20Sopenharmony_ci * we have to use specific dividers. This means the variable divider 478c2ecf20Sopenharmony_ci * can no longer be used, as the audio codec requests the exact clock 488c2ecf20Sopenharmony_ci * rates we support through this mechanism. So we now hard code the 498c2ecf20Sopenharmony_ci * variable divider to 1. This means the clock rates will no longer 508c2ecf20Sopenharmony_ci * match the clock names. 518c2ecf20Sopenharmony_ci */ 528c2ecf20Sopenharmony_ci#define SUN6I_A31_PLL_AUDIO_REG 0x008 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_cistatic struct ccu_sdm_setting pll_audio_sdm_table[] = { 558c2ecf20Sopenharmony_ci { .rate = 22579200, .pattern = 0xc0010d84, .m = 8, .n = 7 }, 568c2ecf20Sopenharmony_ci { .rate = 24576000, .pattern = 0xc000ac02, .m = 14, .n = 14 }, 578c2ecf20Sopenharmony_ci}; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", 608c2ecf20Sopenharmony_ci "osc24M", 0x008, 618c2ecf20Sopenharmony_ci 8, 7, /* N */ 628c2ecf20Sopenharmony_ci 0, 5, /* M */ 638c2ecf20Sopenharmony_ci pll_audio_sdm_table, BIT(24), 648c2ecf20Sopenharmony_ci 0x284, BIT(31), 658c2ecf20Sopenharmony_ci BIT(31), /* gate */ 668c2ecf20Sopenharmony_ci BIT(28), /* lock */ 678c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video0_clk, "pll-video0", 708c2ecf20Sopenharmony_ci "osc24M", 0x010, 718c2ecf20Sopenharmony_ci 8, 7, /* N */ 728c2ecf20Sopenharmony_ci 0, 4, /* M */ 738c2ecf20Sopenharmony_ci BIT(24), /* frac enable */ 748c2ecf20Sopenharmony_ci BIT(25), /* frac select */ 758c2ecf20Sopenharmony_ci 270000000, /* frac rate 0 */ 768c2ecf20Sopenharmony_ci 297000000, /* frac rate 1 */ 778c2ecf20Sopenharmony_ci BIT(31), /* gate */ 788c2ecf20Sopenharmony_ci BIT(28), /* lock */ 798c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", 828c2ecf20Sopenharmony_ci "osc24M", 0x018, 838c2ecf20Sopenharmony_ci 8, 7, /* N */ 848c2ecf20Sopenharmony_ci 0, 4, /* M */ 858c2ecf20Sopenharmony_ci BIT(24), /* frac enable */ 868c2ecf20Sopenharmony_ci BIT(25), /* frac select */ 878c2ecf20Sopenharmony_ci 270000000, /* frac rate 0 */ 888c2ecf20Sopenharmony_ci 297000000, /* frac rate 1 */ 898c2ecf20Sopenharmony_ci BIT(31), /* gate */ 908c2ecf20Sopenharmony_ci BIT(28), /* lock */ 918c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_cistatic SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr_clk, "pll-ddr", 948c2ecf20Sopenharmony_ci "osc24M", 0x020, 958c2ecf20Sopenharmony_ci 8, 5, /* N */ 968c2ecf20Sopenharmony_ci 4, 2, /* K */ 978c2ecf20Sopenharmony_ci 0, 2, /* M */ 988c2ecf20Sopenharmony_ci BIT(31), /* gate */ 998c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1008c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_cistatic SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph_clk, "pll-periph", 1038c2ecf20Sopenharmony_ci "osc24M", 0x028, 1048c2ecf20Sopenharmony_ci 8, 5, /* N */ 1058c2ecf20Sopenharmony_ci 4, 2, /* K */ 1068c2ecf20Sopenharmony_ci BIT(31), /* gate */ 1078c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1088c2ecf20Sopenharmony_ci 2, /* post-div */ 1098c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video1_clk, "pll-video1", 1128c2ecf20Sopenharmony_ci "osc24M", 0x030, 1138c2ecf20Sopenharmony_ci 8, 7, /* N */ 1148c2ecf20Sopenharmony_ci 0, 4, /* M */ 1158c2ecf20Sopenharmony_ci BIT(24), /* frac enable */ 1168c2ecf20Sopenharmony_ci BIT(25), /* frac select */ 1178c2ecf20Sopenharmony_ci 270000000, /* frac rate 0 */ 1188c2ecf20Sopenharmony_ci 297000000, /* frac rate 1 */ 1198c2ecf20Sopenharmony_ci BIT(31), /* gate */ 1208c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1218c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_gpu_clk, "pll-gpu", 1248c2ecf20Sopenharmony_ci "osc24M", 0x038, 1258c2ecf20Sopenharmony_ci 8, 7, /* N */ 1268c2ecf20Sopenharmony_ci 0, 4, /* M */ 1278c2ecf20Sopenharmony_ci BIT(24), /* frac enable */ 1288c2ecf20Sopenharmony_ci BIT(25), /* frac select */ 1298c2ecf20Sopenharmony_ci 270000000, /* frac rate 0 */ 1308c2ecf20Sopenharmony_ci 297000000, /* frac rate 1 */ 1318c2ecf20Sopenharmony_ci BIT(31), /* gate */ 1328c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1338c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci/* 1368c2ecf20Sopenharmony_ci * The MIPI PLL has 2 modes: "MIPI" and "HDMI". 1378c2ecf20Sopenharmony_ci * 1388c2ecf20Sopenharmony_ci * The MIPI mode is a standard NKM-style clock. The HDMI mode is an 1398c2ecf20Sopenharmony_ci * integer / fractional clock with switchable multipliers and dividers. 1408c2ecf20Sopenharmony_ci * This is not supported here. We hardcode the PLL to MIPI mode. 1418c2ecf20Sopenharmony_ci */ 1428c2ecf20Sopenharmony_ci#define SUN6I_A31_PLL_MIPI_REG 0x040 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_cistatic const char * const pll_mipi_parents[] = { "pll-video0", "pll-video1" }; 1458c2ecf20Sopenharmony_cistatic SUNXI_CCU_NKM_WITH_MUX_GATE_LOCK(pll_mipi_clk, "pll-mipi", 1468c2ecf20Sopenharmony_ci pll_mipi_parents, 0x040, 1478c2ecf20Sopenharmony_ci 8, 4, /* N */ 1488c2ecf20Sopenharmony_ci 4, 2, /* K */ 1498c2ecf20Sopenharmony_ci 0, 4, /* M */ 1508c2ecf20Sopenharmony_ci 21, 0, /* mux */ 1518c2ecf20Sopenharmony_ci BIT(31) | BIT(23) | BIT(22), /* gate */ 1528c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1538c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll9_clk, "pll9", 1568c2ecf20Sopenharmony_ci "osc24M", 0x044, 1578c2ecf20Sopenharmony_ci 8, 7, /* N */ 1588c2ecf20Sopenharmony_ci 0, 4, /* M */ 1598c2ecf20Sopenharmony_ci BIT(24), /* frac enable */ 1608c2ecf20Sopenharmony_ci BIT(25), /* frac select */ 1618c2ecf20Sopenharmony_ci 270000000, /* frac rate 0 */ 1628c2ecf20Sopenharmony_ci 297000000, /* frac rate 1 */ 1638c2ecf20Sopenharmony_ci BIT(31), /* gate */ 1648c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1658c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll10_clk, "pll10", 1688c2ecf20Sopenharmony_ci "osc24M", 0x048, 1698c2ecf20Sopenharmony_ci 8, 7, /* N */ 1708c2ecf20Sopenharmony_ci 0, 4, /* M */ 1718c2ecf20Sopenharmony_ci BIT(24), /* frac enable */ 1728c2ecf20Sopenharmony_ci BIT(25), /* frac select */ 1738c2ecf20Sopenharmony_ci 270000000, /* frac rate 0 */ 1748c2ecf20Sopenharmony_ci 297000000, /* frac rate 1 */ 1758c2ecf20Sopenharmony_ci BIT(31), /* gate */ 1768c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1778c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_cistatic const char * const cpux_parents[] = { "osc32k", "osc24M", 1808c2ecf20Sopenharmony_ci "pll-cpu", "pll-cpu" }; 1818c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX(cpu_clk, "cpu", cpux_parents, 1828c2ecf20Sopenharmony_ci 0x050, 16, 2, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_cistatic struct clk_div_table axi_div_table[] = { 1858c2ecf20Sopenharmony_ci { .val = 0, .div = 1 }, 1868c2ecf20Sopenharmony_ci { .val = 1, .div = 2 }, 1878c2ecf20Sopenharmony_ci { .val = 2, .div = 3 }, 1888c2ecf20Sopenharmony_ci { .val = 3, .div = 4 }, 1898c2ecf20Sopenharmony_ci { .val = 4, .div = 4 }, 1908c2ecf20Sopenharmony_ci { .val = 5, .div = 4 }, 1918c2ecf20Sopenharmony_ci { .val = 6, .div = 4 }, 1928c2ecf20Sopenharmony_ci { .val = 7, .div = 4 }, 1938c2ecf20Sopenharmony_ci { /* Sentinel */ }, 1948c2ecf20Sopenharmony_ci}; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(axi_clk, "axi", "cpu", 1978c2ecf20Sopenharmony_ci 0x050, 0, 3, axi_div_table, 0); 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci#define SUN6I_A31_AHB1_REG 0x054 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_cistatic const char * const ahb1_parents[] = { "osc32k", "osc24M", 2028c2ecf20Sopenharmony_ci "axi", "pll-periph" }; 2038c2ecf20Sopenharmony_cistatic const struct ccu_mux_var_prediv ahb1_predivs[] = { 2048c2ecf20Sopenharmony_ci { .index = 3, .shift = 6, .width = 2 }, 2058c2ecf20Sopenharmony_ci}; 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_cistatic struct ccu_div ahb1_clk = { 2088c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO), 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci .mux = { 2118c2ecf20Sopenharmony_ci .shift = 12, 2128c2ecf20Sopenharmony_ci .width = 2, 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci .var_predivs = ahb1_predivs, 2158c2ecf20Sopenharmony_ci .n_var_predivs = ARRAY_SIZE(ahb1_predivs), 2168c2ecf20Sopenharmony_ci }, 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci .common = { 2198c2ecf20Sopenharmony_ci .reg = 0x054, 2208c2ecf20Sopenharmony_ci .features = CCU_FEATURE_VARIABLE_PREDIV, 2218c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb1", 2228c2ecf20Sopenharmony_ci ahb1_parents, 2238c2ecf20Sopenharmony_ci &ccu_div_ops, 2248c2ecf20Sopenharmony_ci 0), 2258c2ecf20Sopenharmony_ci }, 2268c2ecf20Sopenharmony_ci}; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_cistatic struct clk_div_table apb1_div_table[] = { 2298c2ecf20Sopenharmony_ci { .val = 0, .div = 2 }, 2308c2ecf20Sopenharmony_ci { .val = 1, .div = 2 }, 2318c2ecf20Sopenharmony_ci { .val = 2, .div = 4 }, 2328c2ecf20Sopenharmony_ci { .val = 3, .div = 8 }, 2338c2ecf20Sopenharmony_ci { /* Sentinel */ }, 2348c2ecf20Sopenharmony_ci}; 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(apb1_clk, "apb1", "ahb1", 2378c2ecf20Sopenharmony_ci 0x054, 8, 2, apb1_div_table, 0); 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_cistatic const char * const apb2_parents[] = { "osc32k", "osc24M", 2408c2ecf20Sopenharmony_ci "pll-periph", "pll-periph" }; 2418c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", apb2_parents, 0x058, 2428c2ecf20Sopenharmony_ci 0, 5, /* M */ 2438c2ecf20Sopenharmony_ci 16, 2, /* P */ 2448c2ecf20Sopenharmony_ci 24, 2, /* mux */ 2458c2ecf20Sopenharmony_ci 0); 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mipidsi_clk, "ahb1-mipidsi", "ahb1", 2488c2ecf20Sopenharmony_ci 0x060, BIT(1), 0); 2498c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ss_clk, "ahb1-ss", "ahb1", 2508c2ecf20Sopenharmony_ci 0x060, BIT(5), 0); 2518c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_dma_clk, "ahb1-dma", "ahb1", 2528c2ecf20Sopenharmony_ci 0x060, BIT(6), 0); 2538c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mmc0_clk, "ahb1-mmc0", "ahb1", 2548c2ecf20Sopenharmony_ci 0x060, BIT(8), 0); 2558c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mmc1_clk, "ahb1-mmc1", "ahb1", 2568c2ecf20Sopenharmony_ci 0x060, BIT(9), 0); 2578c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mmc2_clk, "ahb1-mmc2", "ahb1", 2588c2ecf20Sopenharmony_ci 0x060, BIT(10), 0); 2598c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mmc3_clk, "ahb1-mmc3", "ahb1", 2608c2ecf20Sopenharmony_ci 0x060, BIT(11), 0); 2618c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_nand1_clk, "ahb1-nand1", "ahb1", 2628c2ecf20Sopenharmony_ci 0x060, BIT(12), 0); 2638c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_nand0_clk, "ahb1-nand0", "ahb1", 2648c2ecf20Sopenharmony_ci 0x060, BIT(13), 0); 2658c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_sdram_clk, "ahb1-sdram", "ahb1", 2668c2ecf20Sopenharmony_ci 0x060, BIT(14), 0); 2678c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_emac_clk, "ahb1-emac", "ahb1", 2688c2ecf20Sopenharmony_ci 0x060, BIT(17), 0); 2698c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ts_clk, "ahb1-ts", "ahb1", 2708c2ecf20Sopenharmony_ci 0x060, BIT(18), 0); 2718c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_hstimer_clk, "ahb1-hstimer", "ahb1", 2728c2ecf20Sopenharmony_ci 0x060, BIT(19), 0); 2738c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_spi0_clk, "ahb1-spi0", "ahb1", 2748c2ecf20Sopenharmony_ci 0x060, BIT(20), 0); 2758c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_spi1_clk, "ahb1-spi1", "ahb1", 2768c2ecf20Sopenharmony_ci 0x060, BIT(21), 0); 2778c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_spi2_clk, "ahb1-spi2", "ahb1", 2788c2ecf20Sopenharmony_ci 0x060, BIT(22), 0); 2798c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_spi3_clk, "ahb1-spi3", "ahb1", 2808c2ecf20Sopenharmony_ci 0x060, BIT(23), 0); 2818c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_otg_clk, "ahb1-otg", "ahb1", 2828c2ecf20Sopenharmony_ci 0x060, BIT(24), 0); 2838c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ehci0_clk, "ahb1-ehci0", "ahb1", 2848c2ecf20Sopenharmony_ci 0x060, BIT(26), 0); 2858c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ehci1_clk, "ahb1-ehci1", "ahb1", 2868c2ecf20Sopenharmony_ci 0x060, BIT(27), 0); 2878c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ohci0_clk, "ahb1-ohci0", "ahb1", 2888c2ecf20Sopenharmony_ci 0x060, BIT(29), 0); 2898c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ohci1_clk, "ahb1-ohci1", "ahb1", 2908c2ecf20Sopenharmony_ci 0x060, BIT(30), 0); 2918c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ohci2_clk, "ahb1-ohci2", "ahb1", 2928c2ecf20Sopenharmony_ci 0x060, BIT(31), 0); 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ve_clk, "ahb1-ve", "ahb1", 2958c2ecf20Sopenharmony_ci 0x064, BIT(0), 0); 2968c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_lcd0_clk, "ahb1-lcd0", "ahb1", 2978c2ecf20Sopenharmony_ci 0x064, BIT(4), 0); 2988c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_lcd1_clk, "ahb1-lcd1", "ahb1", 2998c2ecf20Sopenharmony_ci 0x064, BIT(5), 0); 3008c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_csi_clk, "ahb1-csi", "ahb1", 3018c2ecf20Sopenharmony_ci 0x064, BIT(8), 0); 3028c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_hdmi_clk, "ahb1-hdmi", "ahb1", 3038c2ecf20Sopenharmony_ci 0x064, BIT(11), 0); 3048c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_be0_clk, "ahb1-be0", "ahb1", 3058c2ecf20Sopenharmony_ci 0x064, BIT(12), 0); 3068c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_be1_clk, "ahb1-be1", "ahb1", 3078c2ecf20Sopenharmony_ci 0x064, BIT(13), 0); 3088c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_fe0_clk, "ahb1-fe0", "ahb1", 3098c2ecf20Sopenharmony_ci 0x064, BIT(14), 0); 3108c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_fe1_clk, "ahb1-fe1", "ahb1", 3118c2ecf20Sopenharmony_ci 0x064, BIT(15), 0); 3128c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mp_clk, "ahb1-mp", "ahb1", 3138c2ecf20Sopenharmony_ci 0x064, BIT(18), 0); 3148c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_gpu_clk, "ahb1-gpu", "ahb1", 3158c2ecf20Sopenharmony_ci 0x064, BIT(20), 0); 3168c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_deu0_clk, "ahb1-deu0", "ahb1", 3178c2ecf20Sopenharmony_ci 0x064, BIT(23), 0); 3188c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_deu1_clk, "ahb1-deu1", "ahb1", 3198c2ecf20Sopenharmony_ci 0x064, BIT(24), 0); 3208c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_drc0_clk, "ahb1-drc0", "ahb1", 3218c2ecf20Sopenharmony_ci 0x064, BIT(25), 0); 3228c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_drc1_clk, "ahb1-drc1", "ahb1", 3238c2ecf20Sopenharmony_ci 0x064, BIT(26), 0); 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_codec_clk, "apb1-codec", "apb1", 3268c2ecf20Sopenharmony_ci 0x068, BIT(0), 0); 3278c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_spdif_clk, "apb1-spdif", "apb1", 3288c2ecf20Sopenharmony_ci 0x068, BIT(1), 0); 3298c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_digital_mic_clk, "apb1-digital-mic", "apb1", 3308c2ecf20Sopenharmony_ci 0x068, BIT(4), 0); 3318c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_pio_clk, "apb1-pio", "apb1", 3328c2ecf20Sopenharmony_ci 0x068, BIT(5), 0); 3338c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_daudio0_clk, "apb1-daudio0", "apb1", 3348c2ecf20Sopenharmony_ci 0x068, BIT(12), 0); 3358c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_daudio1_clk, "apb1-daudio1", "apb1", 3368c2ecf20Sopenharmony_ci 0x068, BIT(13), 0); 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_i2c0_clk, "apb2-i2c0", "apb2", 3398c2ecf20Sopenharmony_ci 0x06c, BIT(0), 0); 3408c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_i2c1_clk, "apb2-i2c1", "apb2", 3418c2ecf20Sopenharmony_ci 0x06c, BIT(1), 0); 3428c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_i2c2_clk, "apb2-i2c2", "apb2", 3438c2ecf20Sopenharmony_ci 0x06c, BIT(2), 0); 3448c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_i2c3_clk, "apb2-i2c3", "apb2", 3458c2ecf20Sopenharmony_ci 0x06c, BIT(3), 0); 3468c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart0_clk, "apb2-uart0", "apb2", 3478c2ecf20Sopenharmony_ci 0x06c, BIT(16), 0); 3488c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart1_clk, "apb2-uart1", "apb2", 3498c2ecf20Sopenharmony_ci 0x06c, BIT(17), 0); 3508c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart2_clk, "apb2-uart2", "apb2", 3518c2ecf20Sopenharmony_ci 0x06c, BIT(18), 0); 3528c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart3_clk, "apb2-uart3", "apb2", 3538c2ecf20Sopenharmony_ci 0x06c, BIT(19), 0); 3548c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart4_clk, "apb2-uart4", "apb2", 3558c2ecf20Sopenharmony_ci 0x06c, BIT(20), 0); 3568c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart5_clk, "apb2-uart5", "apb2", 3578c2ecf20Sopenharmony_ci 0x06c, BIT(21), 0); 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_cistatic const char * const mod0_default_parents[] = { "osc24M", "pll-periph" }; 3608c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand0_clk, "nand0", mod0_default_parents, 3618c2ecf20Sopenharmony_ci 0x080, 3628c2ecf20Sopenharmony_ci 0, 4, /* M */ 3638c2ecf20Sopenharmony_ci 16, 2, /* P */ 3648c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3658c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3668c2ecf20Sopenharmony_ci 0); 3678c2ecf20Sopenharmony_ci 3688c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand1_clk, "nand1", mod0_default_parents, 3698c2ecf20Sopenharmony_ci 0x084, 3708c2ecf20Sopenharmony_ci 0, 4, /* M */ 3718c2ecf20Sopenharmony_ci 16, 2, /* P */ 3728c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3738c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3748c2ecf20Sopenharmony_ci 0); 3758c2ecf20Sopenharmony_ci 3768c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 3778c2ecf20Sopenharmony_ci 0x088, 3788c2ecf20Sopenharmony_ci 0, 4, /* M */ 3798c2ecf20Sopenharmony_ci 16, 2, /* P */ 3808c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3818c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3828c2ecf20Sopenharmony_ci 0); 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_sample_clk, "mmc0_sample", "mmc0", 3858c2ecf20Sopenharmony_ci 0x088, 20, 3, 0); 3868c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_output_clk, "mmc0_output", "mmc0", 3878c2ecf20Sopenharmony_ci 0x088, 8, 3, 0); 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 3908c2ecf20Sopenharmony_ci 0x08c, 3918c2ecf20Sopenharmony_ci 0, 4, /* M */ 3928c2ecf20Sopenharmony_ci 16, 2, /* P */ 3938c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3948c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3958c2ecf20Sopenharmony_ci 0); 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1_sample", "mmc1", 3988c2ecf20Sopenharmony_ci 0x08c, 20, 3, 0); 3998c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1_output", "mmc1", 4008c2ecf20Sopenharmony_ci 0x08c, 8, 3, 0); 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 4038c2ecf20Sopenharmony_ci 0x090, 4048c2ecf20Sopenharmony_ci 0, 4, /* M */ 4058c2ecf20Sopenharmony_ci 16, 2, /* P */ 4068c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4078c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4088c2ecf20Sopenharmony_ci 0); 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2_sample", "mmc2", 4118c2ecf20Sopenharmony_ci 0x090, 20, 3, 0); 4128c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_output_clk, "mmc2_output", "mmc2", 4138c2ecf20Sopenharmony_ci 0x090, 8, 3, 0); 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc3_clk, "mmc3", mod0_default_parents, 4168c2ecf20Sopenharmony_ci 0x094, 4178c2ecf20Sopenharmony_ci 0, 4, /* M */ 4188c2ecf20Sopenharmony_ci 16, 2, /* P */ 4198c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4208c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4218c2ecf20Sopenharmony_ci 0); 4228c2ecf20Sopenharmony_ci 4238c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc3_sample_clk, "mmc3_sample", "mmc3", 4248c2ecf20Sopenharmony_ci 0x094, 20, 3, 0); 4258c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc3_output_clk, "mmc3_output", "mmc3", 4268c2ecf20Sopenharmony_ci 0x094, 8, 3, 0); 4278c2ecf20Sopenharmony_ci 4288c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ts_clk, "ts", mod0_default_parents, 0x098, 4298c2ecf20Sopenharmony_ci 0, 4, /* M */ 4308c2ecf20Sopenharmony_ci 16, 2, /* P */ 4318c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4328c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4338c2ecf20Sopenharmony_ci 0); 4348c2ecf20Sopenharmony_ci 4358c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ss_clk, "ss", mod0_default_parents, 0x09c, 4368c2ecf20Sopenharmony_ci 0, 4, /* M */ 4378c2ecf20Sopenharmony_ci 16, 2, /* P */ 4388c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4398c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4408c2ecf20Sopenharmony_ci 0); 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 0x0a0, 4438c2ecf20Sopenharmony_ci 0, 4, /* M */ 4448c2ecf20Sopenharmony_ci 16, 2, /* P */ 4458c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4468c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4478c2ecf20Sopenharmony_ci 0); 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 0x0a4, 4508c2ecf20Sopenharmony_ci 0, 4, /* M */ 4518c2ecf20Sopenharmony_ci 16, 2, /* P */ 4528c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4538c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4548c2ecf20Sopenharmony_ci 0); 4558c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi2_clk, "spi2", mod0_default_parents, 0x0a8, 4568c2ecf20Sopenharmony_ci 0, 4, /* M */ 4578c2ecf20Sopenharmony_ci 16, 2, /* P */ 4588c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4598c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4608c2ecf20Sopenharmony_ci 0); 4618c2ecf20Sopenharmony_ci 4628c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi3_clk, "spi3", mod0_default_parents, 0x0ac, 4638c2ecf20Sopenharmony_ci 0, 4, /* M */ 4648c2ecf20Sopenharmony_ci 16, 2, /* P */ 4658c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4668c2ecf20Sopenharmony_ci BIT(31), /* gate */ 4678c2ecf20Sopenharmony_ci 0); 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_cistatic const char * const daudio_parents[] = { "pll-audio-8x", "pll-audio-4x", 4708c2ecf20Sopenharmony_ci "pll-audio-2x", "pll-audio" }; 4718c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(daudio0_clk, "daudio0", daudio_parents, 4728c2ecf20Sopenharmony_ci 0x0b0, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 4738c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(daudio1_clk, "daudio1", daudio_parents, 4748c2ecf20Sopenharmony_ci 0x0b4, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(spdif_clk, "spdif", daudio_parents, 4778c2ecf20Sopenharmony_ci 0x0c0, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 4788c2ecf20Sopenharmony_ci 4798c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M", 4808c2ecf20Sopenharmony_ci 0x0cc, BIT(8), 0); 4818c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "osc24M", 4828c2ecf20Sopenharmony_ci 0x0cc, BIT(9), 0); 4838c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy2_clk, "usb-phy2", "osc24M", 4848c2ecf20Sopenharmony_ci 0x0cc, BIT(10), 0); 4858c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc24M", 4868c2ecf20Sopenharmony_ci 0x0cc, BIT(16), 0); 4878c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci1_clk, "usb-ohci1", "osc24M", 4888c2ecf20Sopenharmony_ci 0x0cc, BIT(17), 0); 4898c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci2_clk, "usb-ohci2", "osc24M", 4908c2ecf20Sopenharmony_ci 0x0cc, BIT(18), 0); 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_ci/* TODO emac clk not supported yet */ 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_cistatic const char * const dram_parents[] = { "pll-ddr", "pll-periph" }; 4958c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mdfs_clk, "mdfs", dram_parents, 0x0f0, 4968c2ecf20Sopenharmony_ci 0, 4, /* M */ 4978c2ecf20Sopenharmony_ci 16, 2, /* P */ 4988c2ecf20Sopenharmony_ci 24, 2, /* mux */ 4998c2ecf20Sopenharmony_ci BIT(31), /* gate */ 5008c2ecf20Sopenharmony_ci CLK_IS_CRITICAL); 5018c2ecf20Sopenharmony_ci 5028c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX(sdram0_clk, "sdram0", dram_parents, 5038c2ecf20Sopenharmony_ci 0x0f4, 0, 4, 4, 1, CLK_IS_CRITICAL); 5048c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX(sdram1_clk, "sdram1", dram_parents, 5058c2ecf20Sopenharmony_ci 0x0f4, 8, 4, 12, 1, CLK_IS_CRITICAL); 5068c2ecf20Sopenharmony_ci 5078c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ve_clk, "dram-ve", "mdfs", 5088c2ecf20Sopenharmony_ci 0x100, BIT(0), 0); 5098c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_csi_isp_clk, "dram-csi-isp", "mdfs", 5108c2ecf20Sopenharmony_ci 0x100, BIT(1), 0); 5118c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ts_clk, "dram-ts", "mdfs", 5128c2ecf20Sopenharmony_ci 0x100, BIT(3), 0); 5138c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_drc0_clk, "dram-drc0", "mdfs", 5148c2ecf20Sopenharmony_ci 0x100, BIT(16), 0); 5158c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_drc1_clk, "dram-drc1", "mdfs", 5168c2ecf20Sopenharmony_ci 0x100, BIT(17), 0); 5178c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_deu0_clk, "dram-deu0", "mdfs", 5188c2ecf20Sopenharmony_ci 0x100, BIT(18), 0); 5198c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_deu1_clk, "dram-deu1", "mdfs", 5208c2ecf20Sopenharmony_ci 0x100, BIT(19), 0); 5218c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_fe0_clk, "dram-fe0", "mdfs", 5228c2ecf20Sopenharmony_ci 0x100, BIT(24), 0); 5238c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_fe1_clk, "dram-fe1", "mdfs", 5248c2ecf20Sopenharmony_ci 0x100, BIT(25), 0); 5258c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_be0_clk, "dram-be0", "mdfs", 5268c2ecf20Sopenharmony_ci 0x100, BIT(26), 0); 5278c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_be1_clk, "dram-be1", "mdfs", 5288c2ecf20Sopenharmony_ci 0x100, BIT(27), 0); 5298c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_mp_clk, "dram-mp", "mdfs", 5308c2ecf20Sopenharmony_ci 0x100, BIT(28), 0); 5318c2ecf20Sopenharmony_ci 5328c2ecf20Sopenharmony_cistatic const char * const de_parents[] = { "pll-video0", "pll-video1", 5338c2ecf20Sopenharmony_ci "pll-periph-2x", "pll-gpu", 5348c2ecf20Sopenharmony_ci "pll9", "pll10" }; 5358c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(be0_clk, "be0", de_parents, 5368c2ecf20Sopenharmony_ci 0x104, 0, 4, 24, 3, BIT(31), 0); 5378c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(be1_clk, "be1", de_parents, 5388c2ecf20Sopenharmony_ci 0x108, 0, 4, 24, 3, BIT(31), 0); 5398c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(fe0_clk, "fe0", de_parents, 5408c2ecf20Sopenharmony_ci 0x10c, 0, 4, 24, 3, BIT(31), 0); 5418c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(fe1_clk, "fe1", de_parents, 5428c2ecf20Sopenharmony_ci 0x110, 0, 4, 24, 3, BIT(31), 0); 5438c2ecf20Sopenharmony_ci 5448c2ecf20Sopenharmony_cistatic const char * const mp_parents[] = { "pll-video0", "pll-video1", 5458c2ecf20Sopenharmony_ci "pll9", "pll10" }; 5468c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mp_clk, "mp", mp_parents, 5478c2ecf20Sopenharmony_ci 0x114, 0, 4, 24, 3, BIT(31), 0); 5488c2ecf20Sopenharmony_ci 5498c2ecf20Sopenharmony_cistatic const char * const lcd_ch0_parents[] = { "pll-video0", "pll-video1", 5508c2ecf20Sopenharmony_ci "pll-video0-2x", 5518c2ecf20Sopenharmony_ci "pll-video1-2x", "pll-mipi" }; 5528c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(lcd0_ch0_clk, "lcd0-ch0", lcd_ch0_parents, 5538c2ecf20Sopenharmony_ci 0x118, 24, 2, BIT(31), CLK_SET_RATE_PARENT); 5548c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(lcd1_ch0_clk, "lcd1-ch0", lcd_ch0_parents, 5558c2ecf20Sopenharmony_ci 0x11c, 24, 2, BIT(31), CLK_SET_RATE_PARENT); 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_cistatic const char * const lcd_ch1_parents[] = { "pll-video0", "pll-video1", 5588c2ecf20Sopenharmony_ci "pll-video0-2x", 5598c2ecf20Sopenharmony_ci "pll-video1-2x" }; 5608c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(lcd0_ch1_clk, "lcd0-ch1", lcd_ch1_parents, 5618c2ecf20Sopenharmony_ci 0x12c, 0, 4, 24, 3, BIT(31), 5628c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 5638c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(lcd1_ch1_clk, "lcd1-ch1", lcd_ch1_parents, 5648c2ecf20Sopenharmony_ci 0x130, 0, 4, 24, 3, BIT(31), 5658c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 5668c2ecf20Sopenharmony_ci 5678c2ecf20Sopenharmony_cistatic const char * const csi_sclk_parents[] = { "pll-video0", "pll-video1", 5688c2ecf20Sopenharmony_ci "pll9", "pll10", "pll-mipi", 5698c2ecf20Sopenharmony_ci "pll-ve" }; 5708c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi0_sclk_clk, "csi0-sclk", csi_sclk_parents, 5718c2ecf20Sopenharmony_ci 0x134, 16, 4, 24, 3, BIT(31), 0); 5728c2ecf20Sopenharmony_ci 5738c2ecf20Sopenharmony_cistatic const char * const csi_mclk_parents[] = { "pll-video0", "pll-video1", 5748c2ecf20Sopenharmony_ci "osc24M" }; 5758c2ecf20Sopenharmony_cistatic const u8 csi_mclk_table[] = { 0, 1, 5 }; 5768c2ecf20Sopenharmony_cistatic struct ccu_div csi0_mclk_clk = { 5778c2ecf20Sopenharmony_ci .enable = BIT(15), 5788c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV(0, 4), 5798c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX_TABLE(8, 3, csi_mclk_table), 5808c2ecf20Sopenharmony_ci .common = { 5818c2ecf20Sopenharmony_ci .reg = 0x134, 5828c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("csi0-mclk", 5838c2ecf20Sopenharmony_ci csi_mclk_parents, 5848c2ecf20Sopenharmony_ci &ccu_div_ops, 5858c2ecf20Sopenharmony_ci 0), 5868c2ecf20Sopenharmony_ci }, 5878c2ecf20Sopenharmony_ci}; 5888c2ecf20Sopenharmony_ci 5898c2ecf20Sopenharmony_cistatic struct ccu_div csi1_mclk_clk = { 5908c2ecf20Sopenharmony_ci .enable = BIT(15), 5918c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV(0, 4), 5928c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX_TABLE(8, 3, csi_mclk_table), 5938c2ecf20Sopenharmony_ci .common = { 5948c2ecf20Sopenharmony_ci .reg = 0x138, 5958c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("csi1-mclk", 5968c2ecf20Sopenharmony_ci csi_mclk_parents, 5978c2ecf20Sopenharmony_ci &ccu_div_ops, 5988c2ecf20Sopenharmony_ci 0), 5998c2ecf20Sopenharmony_ci }, 6008c2ecf20Sopenharmony_ci}; 6018c2ecf20Sopenharmony_ci 6028c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve", 6038c2ecf20Sopenharmony_ci 0x13c, 16, 3, BIT(31), 0); 6048c2ecf20Sopenharmony_ci 6058c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(codec_clk, "codec", "pll-audio", 6068c2ecf20Sopenharmony_ci 0x140, BIT(31), CLK_SET_RATE_PARENT); 6078c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", 6088c2ecf20Sopenharmony_ci 0x144, BIT(31), 0); 6098c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(digital_mic_clk, "digital-mic", "pll-audio", 6108c2ecf20Sopenharmony_ci 0x148, BIT(31), CLK_SET_RATE_PARENT); 6118c2ecf20Sopenharmony_ci 6128c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", lcd_ch1_parents, 6138c2ecf20Sopenharmony_ci 0x150, 0, 4, 24, 2, BIT(31), 6148c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 6158c2ecf20Sopenharmony_ci 6168c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(hdmi_ddc_clk, "ddc", "osc24M", 0x150, BIT(30), 0); 6178c2ecf20Sopenharmony_ci 6188c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ps_clk, "ps", "lcd1-ch1", 0x140, BIT(31), 0); 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_cistatic const char * const mbus_parents[] = { "osc24M", "pll-periph", 6218c2ecf20Sopenharmony_ci "pll-ddr" }; 6228c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mbus0_clk, "mbus0", mbus_parents, 0x15c, 6238c2ecf20Sopenharmony_ci 0, 3, /* M */ 6248c2ecf20Sopenharmony_ci 16, 2, /* P */ 6258c2ecf20Sopenharmony_ci 24, 2, /* mux */ 6268c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6278c2ecf20Sopenharmony_ci CLK_IS_CRITICAL); 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mbus1_clk, "mbus1", mbus_parents, 0x160, 6308c2ecf20Sopenharmony_ci 0, 3, /* M */ 6318c2ecf20Sopenharmony_ci 16, 2, /* P */ 6328c2ecf20Sopenharmony_ci 24, 2, /* mux */ 6338c2ecf20Sopenharmony_ci BIT(31), /* gate */ 6348c2ecf20Sopenharmony_ci CLK_IS_CRITICAL); 6358c2ecf20Sopenharmony_ci 6368c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mipi_dsi_clk, "mipi-dsi", lcd_ch1_parents, 6378c2ecf20Sopenharmony_ci 0x168, 16, 3, 24, 2, BIT(31), 6388c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 6398c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mipi_dsi_dphy_clk, "mipi-dsi-dphy", 6408c2ecf20Sopenharmony_ci lcd_ch1_parents, 0x168, 0, 3, 8, 2, 6418c2ecf20Sopenharmony_ci BIT(15), CLK_SET_RATE_PARENT); 6428c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mipi_csi_dphy_clk, "mipi-csi-dphy", 6438c2ecf20Sopenharmony_ci lcd_ch1_parents, 0x16c, 0, 3, 8, 2, 6448c2ecf20Sopenharmony_ci BIT(15), 0); 6458c2ecf20Sopenharmony_ci 6468c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(iep_drc0_clk, "iep-drc0", de_parents, 6478c2ecf20Sopenharmony_ci 0x180, 0, 3, 24, 2, BIT(31), 0); 6488c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(iep_drc1_clk, "iep-drc1", de_parents, 6498c2ecf20Sopenharmony_ci 0x184, 0, 3, 24, 2, BIT(31), 0); 6508c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(iep_deu0_clk, "iep-deu0", de_parents, 6518c2ecf20Sopenharmony_ci 0x188, 0, 3, 24, 2, BIT(31), 0); 6528c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(iep_deu1_clk, "iep-deu1", de_parents, 6538c2ecf20Sopenharmony_ci 0x18c, 0, 3, 24, 2, BIT(31), 0); 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_cistatic const char * const gpu_parents[] = { "pll-gpu", "pll-periph-2x", 6568c2ecf20Sopenharmony_ci "pll-video0", "pll-video1", 6578c2ecf20Sopenharmony_ci "pll9", "pll10" }; 6588c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv gpu_predivs[] = { 6598c2ecf20Sopenharmony_ci { .index = 1, .div = 3, }, 6608c2ecf20Sopenharmony_ci}; 6618c2ecf20Sopenharmony_ci 6628c2ecf20Sopenharmony_cistatic struct ccu_div gpu_core_clk = { 6638c2ecf20Sopenharmony_ci .enable = BIT(31), 6648c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV(0, 3), 6658c2ecf20Sopenharmony_ci .mux = { 6668c2ecf20Sopenharmony_ci .shift = 24, 6678c2ecf20Sopenharmony_ci .width = 3, 6688c2ecf20Sopenharmony_ci .fixed_predivs = gpu_predivs, 6698c2ecf20Sopenharmony_ci .n_predivs = ARRAY_SIZE(gpu_predivs), 6708c2ecf20Sopenharmony_ci }, 6718c2ecf20Sopenharmony_ci .common = { 6728c2ecf20Sopenharmony_ci .reg = 0x1a0, 6738c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 6748c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("gpu-core", 6758c2ecf20Sopenharmony_ci gpu_parents, 6768c2ecf20Sopenharmony_ci &ccu_div_ops, 6778c2ecf20Sopenharmony_ci 0), 6788c2ecf20Sopenharmony_ci }, 6798c2ecf20Sopenharmony_ci}; 6808c2ecf20Sopenharmony_ci 6818c2ecf20Sopenharmony_cistatic struct ccu_div gpu_memory_clk = { 6828c2ecf20Sopenharmony_ci .enable = BIT(31), 6838c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV(0, 3), 6848c2ecf20Sopenharmony_ci .mux = { 6858c2ecf20Sopenharmony_ci .shift = 24, 6868c2ecf20Sopenharmony_ci .width = 3, 6878c2ecf20Sopenharmony_ci .fixed_predivs = gpu_predivs, 6888c2ecf20Sopenharmony_ci .n_predivs = ARRAY_SIZE(gpu_predivs), 6898c2ecf20Sopenharmony_ci }, 6908c2ecf20Sopenharmony_ci .common = { 6918c2ecf20Sopenharmony_ci .reg = 0x1a4, 6928c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 6938c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("gpu-memory", 6948c2ecf20Sopenharmony_ci gpu_parents, 6958c2ecf20Sopenharmony_ci &ccu_div_ops, 6968c2ecf20Sopenharmony_ci 0), 6978c2ecf20Sopenharmony_ci }, 6988c2ecf20Sopenharmony_ci}; 6998c2ecf20Sopenharmony_ci 7008c2ecf20Sopenharmony_cistatic struct ccu_div gpu_hyd_clk = { 7018c2ecf20Sopenharmony_ci .enable = BIT(31), 7028c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV(0, 3), 7038c2ecf20Sopenharmony_ci .mux = { 7048c2ecf20Sopenharmony_ci .shift = 24, 7058c2ecf20Sopenharmony_ci .width = 3, 7068c2ecf20Sopenharmony_ci .fixed_predivs = gpu_predivs, 7078c2ecf20Sopenharmony_ci .n_predivs = ARRAY_SIZE(gpu_predivs), 7088c2ecf20Sopenharmony_ci }, 7098c2ecf20Sopenharmony_ci .common = { 7108c2ecf20Sopenharmony_ci .reg = 0x1a8, 7118c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 7128c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("gpu-hyd", 7138c2ecf20Sopenharmony_ci gpu_parents, 7148c2ecf20Sopenharmony_ci &ccu_div_ops, 7158c2ecf20Sopenharmony_ci 0), 7168c2ecf20Sopenharmony_ci }, 7178c2ecf20Sopenharmony_ci}; 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(ats_clk, "ats", mod0_default_parents, 0x1b0, 7208c2ecf20Sopenharmony_ci 0, 3, /* M */ 7218c2ecf20Sopenharmony_ci 24, 2, /* mux */ 7228c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7238c2ecf20Sopenharmony_ci 0); 7248c2ecf20Sopenharmony_ci 7258c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(trace_clk, "trace", mod0_default_parents, 7268c2ecf20Sopenharmony_ci 0x1b0, 7278c2ecf20Sopenharmony_ci 0, 3, /* M */ 7288c2ecf20Sopenharmony_ci 24, 2, /* mux */ 7298c2ecf20Sopenharmony_ci BIT(31), /* gate */ 7308c2ecf20Sopenharmony_ci 0); 7318c2ecf20Sopenharmony_ci 7328c2ecf20Sopenharmony_cistatic const char * const clk_out_parents[] = { "osc24M", "osc32k", "osc24M", 7338c2ecf20Sopenharmony_ci "axi", "ahb1" }; 7348c2ecf20Sopenharmony_cistatic const u8 clk_out_table[] = { 0, 1, 2, 11, 13 }; 7358c2ecf20Sopenharmony_ci 7368c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv clk_out_predivs[] = { 7378c2ecf20Sopenharmony_ci { .index = 0, .div = 750, }, 7388c2ecf20Sopenharmony_ci { .index = 3, .div = 4, }, 7398c2ecf20Sopenharmony_ci { .index = 4, .div = 4, }, 7408c2ecf20Sopenharmony_ci}; 7418c2ecf20Sopenharmony_ci 7428c2ecf20Sopenharmony_cistatic struct ccu_mp out_a_clk = { 7438c2ecf20Sopenharmony_ci .enable = BIT(31), 7448c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(8, 5), 7458c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(20, 2), 7468c2ecf20Sopenharmony_ci .mux = { 7478c2ecf20Sopenharmony_ci .shift = 24, 7488c2ecf20Sopenharmony_ci .width = 4, 7498c2ecf20Sopenharmony_ci .table = clk_out_table, 7508c2ecf20Sopenharmony_ci .fixed_predivs = clk_out_predivs, 7518c2ecf20Sopenharmony_ci .n_predivs = ARRAY_SIZE(clk_out_predivs), 7528c2ecf20Sopenharmony_ci }, 7538c2ecf20Sopenharmony_ci .common = { 7548c2ecf20Sopenharmony_ci .reg = 0x300, 7558c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 7568c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("out-a", 7578c2ecf20Sopenharmony_ci clk_out_parents, 7588c2ecf20Sopenharmony_ci &ccu_mp_ops, 7598c2ecf20Sopenharmony_ci 0), 7608c2ecf20Sopenharmony_ci }, 7618c2ecf20Sopenharmony_ci}; 7628c2ecf20Sopenharmony_ci 7638c2ecf20Sopenharmony_cistatic struct ccu_mp out_b_clk = { 7648c2ecf20Sopenharmony_ci .enable = BIT(31), 7658c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(8, 5), 7668c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(20, 2), 7678c2ecf20Sopenharmony_ci .mux = { 7688c2ecf20Sopenharmony_ci .shift = 24, 7698c2ecf20Sopenharmony_ci .width = 4, 7708c2ecf20Sopenharmony_ci .table = clk_out_table, 7718c2ecf20Sopenharmony_ci .fixed_predivs = clk_out_predivs, 7728c2ecf20Sopenharmony_ci .n_predivs = ARRAY_SIZE(clk_out_predivs), 7738c2ecf20Sopenharmony_ci }, 7748c2ecf20Sopenharmony_ci .common = { 7758c2ecf20Sopenharmony_ci .reg = 0x304, 7768c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 7778c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("out-b", 7788c2ecf20Sopenharmony_ci clk_out_parents, 7798c2ecf20Sopenharmony_ci &ccu_mp_ops, 7808c2ecf20Sopenharmony_ci 0), 7818c2ecf20Sopenharmony_ci }, 7828c2ecf20Sopenharmony_ci}; 7838c2ecf20Sopenharmony_ci 7848c2ecf20Sopenharmony_cistatic struct ccu_mp out_c_clk = { 7858c2ecf20Sopenharmony_ci .enable = BIT(31), 7868c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(8, 5), 7878c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(20, 2), 7888c2ecf20Sopenharmony_ci .mux = { 7898c2ecf20Sopenharmony_ci .shift = 24, 7908c2ecf20Sopenharmony_ci .width = 4, 7918c2ecf20Sopenharmony_ci .table = clk_out_table, 7928c2ecf20Sopenharmony_ci .fixed_predivs = clk_out_predivs, 7938c2ecf20Sopenharmony_ci .n_predivs = ARRAY_SIZE(clk_out_predivs), 7948c2ecf20Sopenharmony_ci }, 7958c2ecf20Sopenharmony_ci .common = { 7968c2ecf20Sopenharmony_ci .reg = 0x308, 7978c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 7988c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("out-c", 7998c2ecf20Sopenharmony_ci clk_out_parents, 8008c2ecf20Sopenharmony_ci &ccu_mp_ops, 8018c2ecf20Sopenharmony_ci 0), 8028c2ecf20Sopenharmony_ci }, 8038c2ecf20Sopenharmony_ci}; 8048c2ecf20Sopenharmony_ci 8058c2ecf20Sopenharmony_cistatic struct ccu_common *sun6i_a31_ccu_clks[] = { 8068c2ecf20Sopenharmony_ci &pll_cpu_clk.common, 8078c2ecf20Sopenharmony_ci &pll_audio_base_clk.common, 8088c2ecf20Sopenharmony_ci &pll_video0_clk.common, 8098c2ecf20Sopenharmony_ci &pll_ve_clk.common, 8108c2ecf20Sopenharmony_ci &pll_ddr_clk.common, 8118c2ecf20Sopenharmony_ci &pll_periph_clk.common, 8128c2ecf20Sopenharmony_ci &pll_video1_clk.common, 8138c2ecf20Sopenharmony_ci &pll_gpu_clk.common, 8148c2ecf20Sopenharmony_ci &pll_mipi_clk.common, 8158c2ecf20Sopenharmony_ci &pll9_clk.common, 8168c2ecf20Sopenharmony_ci &pll10_clk.common, 8178c2ecf20Sopenharmony_ci &cpu_clk.common, 8188c2ecf20Sopenharmony_ci &axi_clk.common, 8198c2ecf20Sopenharmony_ci &ahb1_clk.common, 8208c2ecf20Sopenharmony_ci &apb1_clk.common, 8218c2ecf20Sopenharmony_ci &apb2_clk.common, 8228c2ecf20Sopenharmony_ci &ahb1_mipidsi_clk.common, 8238c2ecf20Sopenharmony_ci &ahb1_ss_clk.common, 8248c2ecf20Sopenharmony_ci &ahb1_dma_clk.common, 8258c2ecf20Sopenharmony_ci &ahb1_mmc0_clk.common, 8268c2ecf20Sopenharmony_ci &ahb1_mmc1_clk.common, 8278c2ecf20Sopenharmony_ci &ahb1_mmc2_clk.common, 8288c2ecf20Sopenharmony_ci &ahb1_mmc3_clk.common, 8298c2ecf20Sopenharmony_ci &ahb1_nand1_clk.common, 8308c2ecf20Sopenharmony_ci &ahb1_nand0_clk.common, 8318c2ecf20Sopenharmony_ci &ahb1_sdram_clk.common, 8328c2ecf20Sopenharmony_ci &ahb1_emac_clk.common, 8338c2ecf20Sopenharmony_ci &ahb1_ts_clk.common, 8348c2ecf20Sopenharmony_ci &ahb1_hstimer_clk.common, 8358c2ecf20Sopenharmony_ci &ahb1_spi0_clk.common, 8368c2ecf20Sopenharmony_ci &ahb1_spi1_clk.common, 8378c2ecf20Sopenharmony_ci &ahb1_spi2_clk.common, 8388c2ecf20Sopenharmony_ci &ahb1_spi3_clk.common, 8398c2ecf20Sopenharmony_ci &ahb1_otg_clk.common, 8408c2ecf20Sopenharmony_ci &ahb1_ehci0_clk.common, 8418c2ecf20Sopenharmony_ci &ahb1_ehci1_clk.common, 8428c2ecf20Sopenharmony_ci &ahb1_ohci0_clk.common, 8438c2ecf20Sopenharmony_ci &ahb1_ohci1_clk.common, 8448c2ecf20Sopenharmony_ci &ahb1_ohci2_clk.common, 8458c2ecf20Sopenharmony_ci &ahb1_ve_clk.common, 8468c2ecf20Sopenharmony_ci &ahb1_lcd0_clk.common, 8478c2ecf20Sopenharmony_ci &ahb1_lcd1_clk.common, 8488c2ecf20Sopenharmony_ci &ahb1_csi_clk.common, 8498c2ecf20Sopenharmony_ci &ahb1_hdmi_clk.common, 8508c2ecf20Sopenharmony_ci &ahb1_be0_clk.common, 8518c2ecf20Sopenharmony_ci &ahb1_be1_clk.common, 8528c2ecf20Sopenharmony_ci &ahb1_fe0_clk.common, 8538c2ecf20Sopenharmony_ci &ahb1_fe1_clk.common, 8548c2ecf20Sopenharmony_ci &ahb1_mp_clk.common, 8558c2ecf20Sopenharmony_ci &ahb1_gpu_clk.common, 8568c2ecf20Sopenharmony_ci &ahb1_deu0_clk.common, 8578c2ecf20Sopenharmony_ci &ahb1_deu1_clk.common, 8588c2ecf20Sopenharmony_ci &ahb1_drc0_clk.common, 8598c2ecf20Sopenharmony_ci &ahb1_drc1_clk.common, 8608c2ecf20Sopenharmony_ci &apb1_codec_clk.common, 8618c2ecf20Sopenharmony_ci &apb1_spdif_clk.common, 8628c2ecf20Sopenharmony_ci &apb1_digital_mic_clk.common, 8638c2ecf20Sopenharmony_ci &apb1_pio_clk.common, 8648c2ecf20Sopenharmony_ci &apb1_daudio0_clk.common, 8658c2ecf20Sopenharmony_ci &apb1_daudio1_clk.common, 8668c2ecf20Sopenharmony_ci &apb2_i2c0_clk.common, 8678c2ecf20Sopenharmony_ci &apb2_i2c1_clk.common, 8688c2ecf20Sopenharmony_ci &apb2_i2c2_clk.common, 8698c2ecf20Sopenharmony_ci &apb2_i2c3_clk.common, 8708c2ecf20Sopenharmony_ci &apb2_uart0_clk.common, 8718c2ecf20Sopenharmony_ci &apb2_uart1_clk.common, 8728c2ecf20Sopenharmony_ci &apb2_uart2_clk.common, 8738c2ecf20Sopenharmony_ci &apb2_uart3_clk.common, 8748c2ecf20Sopenharmony_ci &apb2_uart4_clk.common, 8758c2ecf20Sopenharmony_ci &apb2_uart5_clk.common, 8768c2ecf20Sopenharmony_ci &nand0_clk.common, 8778c2ecf20Sopenharmony_ci &nand1_clk.common, 8788c2ecf20Sopenharmony_ci &mmc0_clk.common, 8798c2ecf20Sopenharmony_ci &mmc0_sample_clk.common, 8808c2ecf20Sopenharmony_ci &mmc0_output_clk.common, 8818c2ecf20Sopenharmony_ci &mmc1_clk.common, 8828c2ecf20Sopenharmony_ci &mmc1_sample_clk.common, 8838c2ecf20Sopenharmony_ci &mmc1_output_clk.common, 8848c2ecf20Sopenharmony_ci &mmc2_clk.common, 8858c2ecf20Sopenharmony_ci &mmc2_sample_clk.common, 8868c2ecf20Sopenharmony_ci &mmc2_output_clk.common, 8878c2ecf20Sopenharmony_ci &mmc3_clk.common, 8888c2ecf20Sopenharmony_ci &mmc3_sample_clk.common, 8898c2ecf20Sopenharmony_ci &mmc3_output_clk.common, 8908c2ecf20Sopenharmony_ci &ts_clk.common, 8918c2ecf20Sopenharmony_ci &ss_clk.common, 8928c2ecf20Sopenharmony_ci &spi0_clk.common, 8938c2ecf20Sopenharmony_ci &spi1_clk.common, 8948c2ecf20Sopenharmony_ci &spi2_clk.common, 8958c2ecf20Sopenharmony_ci &spi3_clk.common, 8968c2ecf20Sopenharmony_ci &daudio0_clk.common, 8978c2ecf20Sopenharmony_ci &daudio1_clk.common, 8988c2ecf20Sopenharmony_ci &spdif_clk.common, 8998c2ecf20Sopenharmony_ci &usb_phy0_clk.common, 9008c2ecf20Sopenharmony_ci &usb_phy1_clk.common, 9018c2ecf20Sopenharmony_ci &usb_phy2_clk.common, 9028c2ecf20Sopenharmony_ci &usb_ohci0_clk.common, 9038c2ecf20Sopenharmony_ci &usb_ohci1_clk.common, 9048c2ecf20Sopenharmony_ci &usb_ohci2_clk.common, 9058c2ecf20Sopenharmony_ci &mdfs_clk.common, 9068c2ecf20Sopenharmony_ci &sdram0_clk.common, 9078c2ecf20Sopenharmony_ci &sdram1_clk.common, 9088c2ecf20Sopenharmony_ci &dram_ve_clk.common, 9098c2ecf20Sopenharmony_ci &dram_csi_isp_clk.common, 9108c2ecf20Sopenharmony_ci &dram_ts_clk.common, 9118c2ecf20Sopenharmony_ci &dram_drc0_clk.common, 9128c2ecf20Sopenharmony_ci &dram_drc1_clk.common, 9138c2ecf20Sopenharmony_ci &dram_deu0_clk.common, 9148c2ecf20Sopenharmony_ci &dram_deu1_clk.common, 9158c2ecf20Sopenharmony_ci &dram_fe0_clk.common, 9168c2ecf20Sopenharmony_ci &dram_fe1_clk.common, 9178c2ecf20Sopenharmony_ci &dram_be0_clk.common, 9188c2ecf20Sopenharmony_ci &dram_be1_clk.common, 9198c2ecf20Sopenharmony_ci &dram_mp_clk.common, 9208c2ecf20Sopenharmony_ci &be0_clk.common, 9218c2ecf20Sopenharmony_ci &be1_clk.common, 9228c2ecf20Sopenharmony_ci &fe0_clk.common, 9238c2ecf20Sopenharmony_ci &fe1_clk.common, 9248c2ecf20Sopenharmony_ci &mp_clk.common, 9258c2ecf20Sopenharmony_ci &lcd0_ch0_clk.common, 9268c2ecf20Sopenharmony_ci &lcd1_ch0_clk.common, 9278c2ecf20Sopenharmony_ci &lcd0_ch1_clk.common, 9288c2ecf20Sopenharmony_ci &lcd1_ch1_clk.common, 9298c2ecf20Sopenharmony_ci &csi0_sclk_clk.common, 9308c2ecf20Sopenharmony_ci &csi0_mclk_clk.common, 9318c2ecf20Sopenharmony_ci &csi1_mclk_clk.common, 9328c2ecf20Sopenharmony_ci &ve_clk.common, 9338c2ecf20Sopenharmony_ci &codec_clk.common, 9348c2ecf20Sopenharmony_ci &avs_clk.common, 9358c2ecf20Sopenharmony_ci &digital_mic_clk.common, 9368c2ecf20Sopenharmony_ci &hdmi_clk.common, 9378c2ecf20Sopenharmony_ci &hdmi_ddc_clk.common, 9388c2ecf20Sopenharmony_ci &ps_clk.common, 9398c2ecf20Sopenharmony_ci &mbus0_clk.common, 9408c2ecf20Sopenharmony_ci &mbus1_clk.common, 9418c2ecf20Sopenharmony_ci &mipi_dsi_clk.common, 9428c2ecf20Sopenharmony_ci &mipi_dsi_dphy_clk.common, 9438c2ecf20Sopenharmony_ci &mipi_csi_dphy_clk.common, 9448c2ecf20Sopenharmony_ci &iep_drc0_clk.common, 9458c2ecf20Sopenharmony_ci &iep_drc1_clk.common, 9468c2ecf20Sopenharmony_ci &iep_deu0_clk.common, 9478c2ecf20Sopenharmony_ci &iep_deu1_clk.common, 9488c2ecf20Sopenharmony_ci &gpu_core_clk.common, 9498c2ecf20Sopenharmony_ci &gpu_memory_clk.common, 9508c2ecf20Sopenharmony_ci &gpu_hyd_clk.common, 9518c2ecf20Sopenharmony_ci &ats_clk.common, 9528c2ecf20Sopenharmony_ci &trace_clk.common, 9538c2ecf20Sopenharmony_ci &out_a_clk.common, 9548c2ecf20Sopenharmony_ci &out_b_clk.common, 9558c2ecf20Sopenharmony_ci &out_c_clk.common, 9568c2ecf20Sopenharmony_ci}; 9578c2ecf20Sopenharmony_ci 9588c2ecf20Sopenharmony_cistatic const struct clk_hw *clk_parent_pll_audio[] = { 9598c2ecf20Sopenharmony_ci &pll_audio_base_clk.common.hw 9608c2ecf20Sopenharmony_ci}; 9618c2ecf20Sopenharmony_ci 9628c2ecf20Sopenharmony_ci/* We hardcode the divider to 1 for now */ 9638c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 9648c2ecf20Sopenharmony_ci clk_parent_pll_audio, 9658c2ecf20Sopenharmony_ci 1, 1, CLK_SET_RATE_PARENT); 9668c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 9678c2ecf20Sopenharmony_ci clk_parent_pll_audio, 9688c2ecf20Sopenharmony_ci 2, 1, CLK_SET_RATE_PARENT); 9698c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 9708c2ecf20Sopenharmony_ci clk_parent_pll_audio, 9718c2ecf20Sopenharmony_ci 1, 1, CLK_SET_RATE_PARENT); 9728c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 9738c2ecf20Sopenharmony_ci clk_parent_pll_audio, 9748c2ecf20Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 9758c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_periph_2x_clk, "pll-periph-2x", 9768c2ecf20Sopenharmony_ci &pll_periph_clk.common.hw, 9778c2ecf20Sopenharmony_ci 1, 2, 0); 9788c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_video0_2x_clk, "pll-video0-2x", 9798c2ecf20Sopenharmony_ci &pll_video0_clk.common.hw, 9808c2ecf20Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 9818c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_video1_2x_clk, "pll-video1-2x", 9828c2ecf20Sopenharmony_ci &pll_video1_clk.common.hw, 9838c2ecf20Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 9848c2ecf20Sopenharmony_ci 9858c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun6i_a31_hw_clks = { 9868c2ecf20Sopenharmony_ci .hws = { 9878c2ecf20Sopenharmony_ci [CLK_PLL_CPU] = &pll_cpu_clk.common.hw, 9888c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, 9898c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.hw, 9908c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, 9918c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, 9928c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, 9938c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 9948c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0_2X] = &pll_video0_2x_clk.hw, 9958c2ecf20Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 9968c2ecf20Sopenharmony_ci [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 9978c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH] = &pll_periph_clk.common.hw, 9988c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH_2X] = &pll_periph_2x_clk.hw, 9998c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 10008c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1_2X] = &pll_video1_2x_clk.hw, 10018c2ecf20Sopenharmony_ci [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 10028c2ecf20Sopenharmony_ci [CLK_PLL_MIPI] = &pll_mipi_clk.common.hw, 10038c2ecf20Sopenharmony_ci [CLK_PLL9] = &pll9_clk.common.hw, 10048c2ecf20Sopenharmony_ci [CLK_PLL10] = &pll10_clk.common.hw, 10058c2ecf20Sopenharmony_ci [CLK_CPU] = &cpu_clk.common.hw, 10068c2ecf20Sopenharmony_ci [CLK_AXI] = &axi_clk.common.hw, 10078c2ecf20Sopenharmony_ci [CLK_AHB1] = &ahb1_clk.common.hw, 10088c2ecf20Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 10098c2ecf20Sopenharmony_ci [CLK_APB2] = &apb2_clk.common.hw, 10108c2ecf20Sopenharmony_ci [CLK_AHB1_MIPIDSI] = &ahb1_mipidsi_clk.common.hw, 10118c2ecf20Sopenharmony_ci [CLK_AHB1_SS] = &ahb1_ss_clk.common.hw, 10128c2ecf20Sopenharmony_ci [CLK_AHB1_DMA] = &ahb1_dma_clk.common.hw, 10138c2ecf20Sopenharmony_ci [CLK_AHB1_MMC0] = &ahb1_mmc0_clk.common.hw, 10148c2ecf20Sopenharmony_ci [CLK_AHB1_MMC1] = &ahb1_mmc1_clk.common.hw, 10158c2ecf20Sopenharmony_ci [CLK_AHB1_MMC2] = &ahb1_mmc2_clk.common.hw, 10168c2ecf20Sopenharmony_ci [CLK_AHB1_MMC3] = &ahb1_mmc3_clk.common.hw, 10178c2ecf20Sopenharmony_ci [CLK_AHB1_NAND1] = &ahb1_nand1_clk.common.hw, 10188c2ecf20Sopenharmony_ci [CLK_AHB1_NAND0] = &ahb1_nand0_clk.common.hw, 10198c2ecf20Sopenharmony_ci [CLK_AHB1_SDRAM] = &ahb1_sdram_clk.common.hw, 10208c2ecf20Sopenharmony_ci [CLK_AHB1_EMAC] = &ahb1_emac_clk.common.hw, 10218c2ecf20Sopenharmony_ci [CLK_AHB1_TS] = &ahb1_ts_clk.common.hw, 10228c2ecf20Sopenharmony_ci [CLK_AHB1_HSTIMER] = &ahb1_hstimer_clk.common.hw, 10238c2ecf20Sopenharmony_ci [CLK_AHB1_SPI0] = &ahb1_spi0_clk.common.hw, 10248c2ecf20Sopenharmony_ci [CLK_AHB1_SPI1] = &ahb1_spi1_clk.common.hw, 10258c2ecf20Sopenharmony_ci [CLK_AHB1_SPI2] = &ahb1_spi2_clk.common.hw, 10268c2ecf20Sopenharmony_ci [CLK_AHB1_SPI3] = &ahb1_spi3_clk.common.hw, 10278c2ecf20Sopenharmony_ci [CLK_AHB1_OTG] = &ahb1_otg_clk.common.hw, 10288c2ecf20Sopenharmony_ci [CLK_AHB1_EHCI0] = &ahb1_ehci0_clk.common.hw, 10298c2ecf20Sopenharmony_ci [CLK_AHB1_EHCI1] = &ahb1_ehci1_clk.common.hw, 10308c2ecf20Sopenharmony_ci [CLK_AHB1_OHCI0] = &ahb1_ohci0_clk.common.hw, 10318c2ecf20Sopenharmony_ci [CLK_AHB1_OHCI1] = &ahb1_ohci1_clk.common.hw, 10328c2ecf20Sopenharmony_ci [CLK_AHB1_OHCI2] = &ahb1_ohci2_clk.common.hw, 10338c2ecf20Sopenharmony_ci [CLK_AHB1_VE] = &ahb1_ve_clk.common.hw, 10348c2ecf20Sopenharmony_ci [CLK_AHB1_LCD0] = &ahb1_lcd0_clk.common.hw, 10358c2ecf20Sopenharmony_ci [CLK_AHB1_LCD1] = &ahb1_lcd1_clk.common.hw, 10368c2ecf20Sopenharmony_ci [CLK_AHB1_CSI] = &ahb1_csi_clk.common.hw, 10378c2ecf20Sopenharmony_ci [CLK_AHB1_HDMI] = &ahb1_hdmi_clk.common.hw, 10388c2ecf20Sopenharmony_ci [CLK_AHB1_BE0] = &ahb1_be0_clk.common.hw, 10398c2ecf20Sopenharmony_ci [CLK_AHB1_BE1] = &ahb1_be1_clk.common.hw, 10408c2ecf20Sopenharmony_ci [CLK_AHB1_FE0] = &ahb1_fe0_clk.common.hw, 10418c2ecf20Sopenharmony_ci [CLK_AHB1_FE1] = &ahb1_fe1_clk.common.hw, 10428c2ecf20Sopenharmony_ci [CLK_AHB1_MP] = &ahb1_mp_clk.common.hw, 10438c2ecf20Sopenharmony_ci [CLK_AHB1_GPU] = &ahb1_gpu_clk.common.hw, 10448c2ecf20Sopenharmony_ci [CLK_AHB1_DEU0] = &ahb1_deu0_clk.common.hw, 10458c2ecf20Sopenharmony_ci [CLK_AHB1_DEU1] = &ahb1_deu1_clk.common.hw, 10468c2ecf20Sopenharmony_ci [CLK_AHB1_DRC0] = &ahb1_drc0_clk.common.hw, 10478c2ecf20Sopenharmony_ci [CLK_AHB1_DRC1] = &ahb1_drc1_clk.common.hw, 10488c2ecf20Sopenharmony_ci [CLK_APB1_CODEC] = &apb1_codec_clk.common.hw, 10498c2ecf20Sopenharmony_ci [CLK_APB1_SPDIF] = &apb1_spdif_clk.common.hw, 10508c2ecf20Sopenharmony_ci [CLK_APB1_DIGITAL_MIC] = &apb1_digital_mic_clk.common.hw, 10518c2ecf20Sopenharmony_ci [CLK_APB1_PIO] = &apb1_pio_clk.common.hw, 10528c2ecf20Sopenharmony_ci [CLK_APB1_DAUDIO0] = &apb1_daudio0_clk.common.hw, 10538c2ecf20Sopenharmony_ci [CLK_APB1_DAUDIO1] = &apb1_daudio1_clk.common.hw, 10548c2ecf20Sopenharmony_ci [CLK_APB2_I2C0] = &apb2_i2c0_clk.common.hw, 10558c2ecf20Sopenharmony_ci [CLK_APB2_I2C1] = &apb2_i2c1_clk.common.hw, 10568c2ecf20Sopenharmony_ci [CLK_APB2_I2C2] = &apb2_i2c2_clk.common.hw, 10578c2ecf20Sopenharmony_ci [CLK_APB2_I2C3] = &apb2_i2c3_clk.common.hw, 10588c2ecf20Sopenharmony_ci [CLK_APB2_UART0] = &apb2_uart0_clk.common.hw, 10598c2ecf20Sopenharmony_ci [CLK_APB2_UART1] = &apb2_uart1_clk.common.hw, 10608c2ecf20Sopenharmony_ci [CLK_APB2_UART2] = &apb2_uart2_clk.common.hw, 10618c2ecf20Sopenharmony_ci [CLK_APB2_UART3] = &apb2_uart3_clk.common.hw, 10628c2ecf20Sopenharmony_ci [CLK_APB2_UART4] = &apb2_uart4_clk.common.hw, 10638c2ecf20Sopenharmony_ci [CLK_APB2_UART5] = &apb2_uart5_clk.common.hw, 10648c2ecf20Sopenharmony_ci [CLK_NAND0] = &nand0_clk.common.hw, 10658c2ecf20Sopenharmony_ci [CLK_NAND1] = &nand1_clk.common.hw, 10668c2ecf20Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 10678c2ecf20Sopenharmony_ci [CLK_MMC0_SAMPLE] = &mmc0_sample_clk.common.hw, 10688c2ecf20Sopenharmony_ci [CLK_MMC0_OUTPUT] = &mmc0_output_clk.common.hw, 10698c2ecf20Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 10708c2ecf20Sopenharmony_ci [CLK_MMC1_SAMPLE] = &mmc1_sample_clk.common.hw, 10718c2ecf20Sopenharmony_ci [CLK_MMC1_OUTPUT] = &mmc1_output_clk.common.hw, 10728c2ecf20Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 10738c2ecf20Sopenharmony_ci [CLK_MMC2_SAMPLE] = &mmc2_sample_clk.common.hw, 10748c2ecf20Sopenharmony_ci [CLK_MMC2_OUTPUT] = &mmc2_output_clk.common.hw, 10758c2ecf20Sopenharmony_ci [CLK_MMC3] = &mmc3_clk.common.hw, 10768c2ecf20Sopenharmony_ci [CLK_MMC3_SAMPLE] = &mmc3_sample_clk.common.hw, 10778c2ecf20Sopenharmony_ci [CLK_MMC3_OUTPUT] = &mmc3_output_clk.common.hw, 10788c2ecf20Sopenharmony_ci [CLK_TS] = &ts_clk.common.hw, 10798c2ecf20Sopenharmony_ci [CLK_SS] = &ss_clk.common.hw, 10808c2ecf20Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 10818c2ecf20Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 10828c2ecf20Sopenharmony_ci [CLK_SPI2] = &spi2_clk.common.hw, 10838c2ecf20Sopenharmony_ci [CLK_SPI3] = &spi3_clk.common.hw, 10848c2ecf20Sopenharmony_ci [CLK_DAUDIO0] = &daudio0_clk.common.hw, 10858c2ecf20Sopenharmony_ci [CLK_DAUDIO1] = &daudio1_clk.common.hw, 10868c2ecf20Sopenharmony_ci [CLK_SPDIF] = &spdif_clk.common.hw, 10878c2ecf20Sopenharmony_ci [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 10888c2ecf20Sopenharmony_ci [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 10898c2ecf20Sopenharmony_ci [CLK_USB_PHY2] = &usb_phy2_clk.common.hw, 10908c2ecf20Sopenharmony_ci [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw, 10918c2ecf20Sopenharmony_ci [CLK_USB_OHCI1] = &usb_ohci1_clk.common.hw, 10928c2ecf20Sopenharmony_ci [CLK_USB_OHCI2] = &usb_ohci2_clk.common.hw, 10938c2ecf20Sopenharmony_ci [CLK_MDFS] = &mdfs_clk.common.hw, 10948c2ecf20Sopenharmony_ci [CLK_SDRAM0] = &sdram0_clk.common.hw, 10958c2ecf20Sopenharmony_ci [CLK_SDRAM1] = &sdram1_clk.common.hw, 10968c2ecf20Sopenharmony_ci [CLK_DRAM_VE] = &dram_ve_clk.common.hw, 10978c2ecf20Sopenharmony_ci [CLK_DRAM_CSI_ISP] = &dram_csi_isp_clk.common.hw, 10988c2ecf20Sopenharmony_ci [CLK_DRAM_TS] = &dram_ts_clk.common.hw, 10998c2ecf20Sopenharmony_ci [CLK_DRAM_DRC0] = &dram_drc0_clk.common.hw, 11008c2ecf20Sopenharmony_ci [CLK_DRAM_DRC1] = &dram_drc1_clk.common.hw, 11018c2ecf20Sopenharmony_ci [CLK_DRAM_DEU0] = &dram_deu0_clk.common.hw, 11028c2ecf20Sopenharmony_ci [CLK_DRAM_DEU1] = &dram_deu1_clk.common.hw, 11038c2ecf20Sopenharmony_ci [CLK_DRAM_FE0] = &dram_fe0_clk.common.hw, 11048c2ecf20Sopenharmony_ci [CLK_DRAM_FE1] = &dram_fe1_clk.common.hw, 11058c2ecf20Sopenharmony_ci [CLK_DRAM_BE0] = &dram_be0_clk.common.hw, 11068c2ecf20Sopenharmony_ci [CLK_DRAM_BE1] = &dram_be1_clk.common.hw, 11078c2ecf20Sopenharmony_ci [CLK_DRAM_MP] = &dram_mp_clk.common.hw, 11088c2ecf20Sopenharmony_ci [CLK_BE0] = &be0_clk.common.hw, 11098c2ecf20Sopenharmony_ci [CLK_BE1] = &be1_clk.common.hw, 11108c2ecf20Sopenharmony_ci [CLK_FE0] = &fe0_clk.common.hw, 11118c2ecf20Sopenharmony_ci [CLK_FE1] = &fe1_clk.common.hw, 11128c2ecf20Sopenharmony_ci [CLK_MP] = &mp_clk.common.hw, 11138c2ecf20Sopenharmony_ci [CLK_LCD0_CH0] = &lcd0_ch0_clk.common.hw, 11148c2ecf20Sopenharmony_ci [CLK_LCD1_CH0] = &lcd1_ch0_clk.common.hw, 11158c2ecf20Sopenharmony_ci [CLK_LCD0_CH1] = &lcd0_ch1_clk.common.hw, 11168c2ecf20Sopenharmony_ci [CLK_LCD1_CH1] = &lcd1_ch1_clk.common.hw, 11178c2ecf20Sopenharmony_ci [CLK_CSI0_SCLK] = &csi0_sclk_clk.common.hw, 11188c2ecf20Sopenharmony_ci [CLK_CSI0_MCLK] = &csi0_mclk_clk.common.hw, 11198c2ecf20Sopenharmony_ci [CLK_CSI1_MCLK] = &csi1_mclk_clk.common.hw, 11208c2ecf20Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 11218c2ecf20Sopenharmony_ci [CLK_CODEC] = &codec_clk.common.hw, 11228c2ecf20Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 11238c2ecf20Sopenharmony_ci [CLK_DIGITAL_MIC] = &digital_mic_clk.common.hw, 11248c2ecf20Sopenharmony_ci [CLK_HDMI] = &hdmi_clk.common.hw, 11258c2ecf20Sopenharmony_ci [CLK_HDMI_DDC] = &hdmi_ddc_clk.common.hw, 11268c2ecf20Sopenharmony_ci [CLK_PS] = &ps_clk.common.hw, 11278c2ecf20Sopenharmony_ci [CLK_MBUS0] = &mbus0_clk.common.hw, 11288c2ecf20Sopenharmony_ci [CLK_MBUS1] = &mbus1_clk.common.hw, 11298c2ecf20Sopenharmony_ci [CLK_MIPI_DSI] = &mipi_dsi_clk.common.hw, 11308c2ecf20Sopenharmony_ci [CLK_MIPI_DSI_DPHY] = &mipi_dsi_dphy_clk.common.hw, 11318c2ecf20Sopenharmony_ci [CLK_MIPI_CSI_DPHY] = &mipi_csi_dphy_clk.common.hw, 11328c2ecf20Sopenharmony_ci [CLK_IEP_DRC0] = &iep_drc0_clk.common.hw, 11338c2ecf20Sopenharmony_ci [CLK_IEP_DRC1] = &iep_drc1_clk.common.hw, 11348c2ecf20Sopenharmony_ci [CLK_IEP_DEU0] = &iep_deu0_clk.common.hw, 11358c2ecf20Sopenharmony_ci [CLK_IEP_DEU1] = &iep_deu1_clk.common.hw, 11368c2ecf20Sopenharmony_ci [CLK_GPU_CORE] = &gpu_core_clk.common.hw, 11378c2ecf20Sopenharmony_ci [CLK_GPU_MEMORY] = &gpu_memory_clk.common.hw, 11388c2ecf20Sopenharmony_ci [CLK_GPU_HYD] = &gpu_hyd_clk.common.hw, 11398c2ecf20Sopenharmony_ci [CLK_ATS] = &ats_clk.common.hw, 11408c2ecf20Sopenharmony_ci [CLK_TRACE] = &trace_clk.common.hw, 11418c2ecf20Sopenharmony_ci [CLK_OUT_A] = &out_a_clk.common.hw, 11428c2ecf20Sopenharmony_ci [CLK_OUT_B] = &out_b_clk.common.hw, 11438c2ecf20Sopenharmony_ci [CLK_OUT_C] = &out_c_clk.common.hw, 11448c2ecf20Sopenharmony_ci }, 11458c2ecf20Sopenharmony_ci .num = CLK_NUMBER, 11468c2ecf20Sopenharmony_ci}; 11478c2ecf20Sopenharmony_ci 11488c2ecf20Sopenharmony_cistatic struct ccu_reset_map sun6i_a31_ccu_resets[] = { 11498c2ecf20Sopenharmony_ci [RST_USB_PHY0] = { 0x0cc, BIT(0) }, 11508c2ecf20Sopenharmony_ci [RST_USB_PHY1] = { 0x0cc, BIT(1) }, 11518c2ecf20Sopenharmony_ci [RST_USB_PHY2] = { 0x0cc, BIT(2) }, 11528c2ecf20Sopenharmony_ci 11538c2ecf20Sopenharmony_ci [RST_AHB1_MIPI_DSI] = { 0x2c0, BIT(1) }, 11548c2ecf20Sopenharmony_ci [RST_AHB1_SS] = { 0x2c0, BIT(5) }, 11558c2ecf20Sopenharmony_ci [RST_AHB1_DMA] = { 0x2c0, BIT(6) }, 11568c2ecf20Sopenharmony_ci [RST_AHB1_MMC0] = { 0x2c0, BIT(8) }, 11578c2ecf20Sopenharmony_ci [RST_AHB1_MMC1] = { 0x2c0, BIT(9) }, 11588c2ecf20Sopenharmony_ci [RST_AHB1_MMC2] = { 0x2c0, BIT(10) }, 11598c2ecf20Sopenharmony_ci [RST_AHB1_MMC3] = { 0x2c0, BIT(11) }, 11608c2ecf20Sopenharmony_ci [RST_AHB1_NAND1] = { 0x2c0, BIT(12) }, 11618c2ecf20Sopenharmony_ci [RST_AHB1_NAND0] = { 0x2c0, BIT(13) }, 11628c2ecf20Sopenharmony_ci [RST_AHB1_SDRAM] = { 0x2c0, BIT(14) }, 11638c2ecf20Sopenharmony_ci [RST_AHB1_EMAC] = { 0x2c0, BIT(17) }, 11648c2ecf20Sopenharmony_ci [RST_AHB1_TS] = { 0x2c0, BIT(18) }, 11658c2ecf20Sopenharmony_ci [RST_AHB1_HSTIMER] = { 0x2c0, BIT(19) }, 11668c2ecf20Sopenharmony_ci [RST_AHB1_SPI0] = { 0x2c0, BIT(20) }, 11678c2ecf20Sopenharmony_ci [RST_AHB1_SPI1] = { 0x2c0, BIT(21) }, 11688c2ecf20Sopenharmony_ci [RST_AHB1_SPI2] = { 0x2c0, BIT(22) }, 11698c2ecf20Sopenharmony_ci [RST_AHB1_SPI3] = { 0x2c0, BIT(23) }, 11708c2ecf20Sopenharmony_ci [RST_AHB1_OTG] = { 0x2c0, BIT(24) }, 11718c2ecf20Sopenharmony_ci [RST_AHB1_EHCI0] = { 0x2c0, BIT(26) }, 11728c2ecf20Sopenharmony_ci [RST_AHB1_EHCI1] = { 0x2c0, BIT(27) }, 11738c2ecf20Sopenharmony_ci [RST_AHB1_OHCI0] = { 0x2c0, BIT(29) }, 11748c2ecf20Sopenharmony_ci [RST_AHB1_OHCI1] = { 0x2c0, BIT(30) }, 11758c2ecf20Sopenharmony_ci [RST_AHB1_OHCI2] = { 0x2c0, BIT(31) }, 11768c2ecf20Sopenharmony_ci 11778c2ecf20Sopenharmony_ci [RST_AHB1_VE] = { 0x2c4, BIT(0) }, 11788c2ecf20Sopenharmony_ci [RST_AHB1_LCD0] = { 0x2c4, BIT(4) }, 11798c2ecf20Sopenharmony_ci [RST_AHB1_LCD1] = { 0x2c4, BIT(5) }, 11808c2ecf20Sopenharmony_ci [RST_AHB1_CSI] = { 0x2c4, BIT(8) }, 11818c2ecf20Sopenharmony_ci [RST_AHB1_HDMI] = { 0x2c4, BIT(11) }, 11828c2ecf20Sopenharmony_ci [RST_AHB1_BE0] = { 0x2c4, BIT(12) }, 11838c2ecf20Sopenharmony_ci [RST_AHB1_BE1] = { 0x2c4, BIT(13) }, 11848c2ecf20Sopenharmony_ci [RST_AHB1_FE0] = { 0x2c4, BIT(14) }, 11858c2ecf20Sopenharmony_ci [RST_AHB1_FE1] = { 0x2c4, BIT(15) }, 11868c2ecf20Sopenharmony_ci [RST_AHB1_MP] = { 0x2c4, BIT(18) }, 11878c2ecf20Sopenharmony_ci [RST_AHB1_GPU] = { 0x2c4, BIT(20) }, 11888c2ecf20Sopenharmony_ci [RST_AHB1_DEU0] = { 0x2c4, BIT(23) }, 11898c2ecf20Sopenharmony_ci [RST_AHB1_DEU1] = { 0x2c4, BIT(24) }, 11908c2ecf20Sopenharmony_ci [RST_AHB1_DRC0] = { 0x2c4, BIT(25) }, 11918c2ecf20Sopenharmony_ci [RST_AHB1_DRC1] = { 0x2c4, BIT(26) }, 11928c2ecf20Sopenharmony_ci [RST_AHB1_LVDS] = { 0x2c8, BIT(0) }, 11938c2ecf20Sopenharmony_ci 11948c2ecf20Sopenharmony_ci [RST_APB1_CODEC] = { 0x2d0, BIT(0) }, 11958c2ecf20Sopenharmony_ci [RST_APB1_SPDIF] = { 0x2d0, BIT(1) }, 11968c2ecf20Sopenharmony_ci [RST_APB1_DIGITAL_MIC] = { 0x2d0, BIT(4) }, 11978c2ecf20Sopenharmony_ci [RST_APB1_DAUDIO0] = { 0x2d0, BIT(12) }, 11988c2ecf20Sopenharmony_ci [RST_APB1_DAUDIO1] = { 0x2d0, BIT(13) }, 11998c2ecf20Sopenharmony_ci 12008c2ecf20Sopenharmony_ci [RST_APB2_I2C0] = { 0x2d8, BIT(0) }, 12018c2ecf20Sopenharmony_ci [RST_APB2_I2C1] = { 0x2d8, BIT(1) }, 12028c2ecf20Sopenharmony_ci [RST_APB2_I2C2] = { 0x2d8, BIT(2) }, 12038c2ecf20Sopenharmony_ci [RST_APB2_I2C3] = { 0x2d8, BIT(3) }, 12048c2ecf20Sopenharmony_ci [RST_APB2_UART0] = { 0x2d8, BIT(16) }, 12058c2ecf20Sopenharmony_ci [RST_APB2_UART1] = { 0x2d8, BIT(17) }, 12068c2ecf20Sopenharmony_ci [RST_APB2_UART2] = { 0x2d8, BIT(18) }, 12078c2ecf20Sopenharmony_ci [RST_APB2_UART3] = { 0x2d8, BIT(19) }, 12088c2ecf20Sopenharmony_ci [RST_APB2_UART4] = { 0x2d8, BIT(20) }, 12098c2ecf20Sopenharmony_ci [RST_APB2_UART5] = { 0x2d8, BIT(21) }, 12108c2ecf20Sopenharmony_ci}; 12118c2ecf20Sopenharmony_ci 12128c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun6i_a31_ccu_desc = { 12138c2ecf20Sopenharmony_ci .ccu_clks = sun6i_a31_ccu_clks, 12148c2ecf20Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun6i_a31_ccu_clks), 12158c2ecf20Sopenharmony_ci 12168c2ecf20Sopenharmony_ci .hw_clks = &sun6i_a31_hw_clks, 12178c2ecf20Sopenharmony_ci 12188c2ecf20Sopenharmony_ci .resets = sun6i_a31_ccu_resets, 12198c2ecf20Sopenharmony_ci .num_resets = ARRAY_SIZE(sun6i_a31_ccu_resets), 12208c2ecf20Sopenharmony_ci}; 12218c2ecf20Sopenharmony_ci 12228c2ecf20Sopenharmony_cistatic struct ccu_mux_nb sun6i_a31_cpu_nb = { 12238c2ecf20Sopenharmony_ci .common = &cpu_clk.common, 12248c2ecf20Sopenharmony_ci .cm = &cpu_clk.mux, 12258c2ecf20Sopenharmony_ci .delay_us = 1, /* > 8 clock cycles at 24 MHz */ 12268c2ecf20Sopenharmony_ci .bypass_index = 1, /* index of 24 MHz oscillator */ 12278c2ecf20Sopenharmony_ci}; 12288c2ecf20Sopenharmony_ci 12298c2ecf20Sopenharmony_cistatic void __init sun6i_a31_ccu_setup(struct device_node *node) 12308c2ecf20Sopenharmony_ci{ 12318c2ecf20Sopenharmony_ci void __iomem *reg; 12328c2ecf20Sopenharmony_ci u32 val; 12338c2ecf20Sopenharmony_ci 12348c2ecf20Sopenharmony_ci reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 12358c2ecf20Sopenharmony_ci if (IS_ERR(reg)) { 12368c2ecf20Sopenharmony_ci pr_err("%pOF: Could not map the clock registers\n", node); 12378c2ecf20Sopenharmony_ci return; 12388c2ecf20Sopenharmony_ci } 12398c2ecf20Sopenharmony_ci 12408c2ecf20Sopenharmony_ci /* Force the PLL-Audio-1x divider to 1 */ 12418c2ecf20Sopenharmony_ci val = readl(reg + SUN6I_A31_PLL_AUDIO_REG); 12428c2ecf20Sopenharmony_ci val &= ~GENMASK(19, 16); 12438c2ecf20Sopenharmony_ci writel(val | (0 << 16), reg + SUN6I_A31_PLL_AUDIO_REG); 12448c2ecf20Sopenharmony_ci 12458c2ecf20Sopenharmony_ci /* Force PLL-MIPI to MIPI mode */ 12468c2ecf20Sopenharmony_ci val = readl(reg + SUN6I_A31_PLL_MIPI_REG); 12478c2ecf20Sopenharmony_ci val &= BIT(16); 12488c2ecf20Sopenharmony_ci writel(val, reg + SUN6I_A31_PLL_MIPI_REG); 12498c2ecf20Sopenharmony_ci 12508c2ecf20Sopenharmony_ci /* Force AHB1 to PLL6 / 3 */ 12518c2ecf20Sopenharmony_ci val = readl(reg + SUN6I_A31_AHB1_REG); 12528c2ecf20Sopenharmony_ci /* set PLL6 pre-div = 3 */ 12538c2ecf20Sopenharmony_ci val &= ~GENMASK(7, 6); 12548c2ecf20Sopenharmony_ci val |= 0x2 << 6; 12558c2ecf20Sopenharmony_ci /* select PLL6 / pre-div */ 12568c2ecf20Sopenharmony_ci val &= ~GENMASK(13, 12); 12578c2ecf20Sopenharmony_ci val |= 0x3 << 12; 12588c2ecf20Sopenharmony_ci writel(val, reg + SUN6I_A31_AHB1_REG); 12598c2ecf20Sopenharmony_ci 12608c2ecf20Sopenharmony_ci sunxi_ccu_probe(node, reg, &sun6i_a31_ccu_desc); 12618c2ecf20Sopenharmony_ci 12628c2ecf20Sopenharmony_ci ccu_mux_notifier_register(pll_cpu_clk.common.hw.clk, 12638c2ecf20Sopenharmony_ci &sun6i_a31_cpu_nb); 12648c2ecf20Sopenharmony_ci} 12658c2ecf20Sopenharmony_ciCLK_OF_DECLARE(sun6i_a31_ccu, "allwinner,sun6i-a31-ccu", 12668c2ecf20Sopenharmony_ci sun6i_a31_ccu_setup); 1267