18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2016 Maxime Ripard. All rights reserved. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 78c2ecf20Sopenharmony_ci#include <linux/io.h> 88c2ecf20Sopenharmony_ci#include <linux/of_address.h> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include "ccu_common.h" 118c2ecf20Sopenharmony_ci#include "ccu_reset.h" 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include "ccu_div.h" 148c2ecf20Sopenharmony_ci#include "ccu_gate.h" 158c2ecf20Sopenharmony_ci#include "ccu_mp.h" 168c2ecf20Sopenharmony_ci#include "ccu_mult.h" 178c2ecf20Sopenharmony_ci#include "ccu_nk.h" 188c2ecf20Sopenharmony_ci#include "ccu_nkm.h" 198c2ecf20Sopenharmony_ci#include "ccu_nkmp.h" 208c2ecf20Sopenharmony_ci#include "ccu_nm.h" 218c2ecf20Sopenharmony_ci#include "ccu_phase.h" 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#include "ccu-sun8i-a23-a33.h" 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_cpux_clk = { 268c2ecf20Sopenharmony_ci .enable = BIT(31), 278c2ecf20Sopenharmony_ci .lock = BIT(28), 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT(8, 5), 308c2ecf20Sopenharmony_ci .k = _SUNXI_CCU_MULT(4, 2), 318c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(0, 2), 328c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV_MAX(16, 2, 4), 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci .common = { 358c2ecf20Sopenharmony_ci .reg = 0x000, 368c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-cpux", "osc24M", 378c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 388c2ecf20Sopenharmony_ci 0), 398c2ecf20Sopenharmony_ci }, 408c2ecf20Sopenharmony_ci}; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci/* 438c2ecf20Sopenharmony_ci * The Audio PLL is supposed to have 4 outputs: 3 fixed factors from 448c2ecf20Sopenharmony_ci * the base (2x, 4x and 8x), and one variable divider (the one true 458c2ecf20Sopenharmony_ci * pll audio). 468c2ecf20Sopenharmony_ci * 478c2ecf20Sopenharmony_ci * With sigma-delta modulation for fractional-N on the audio PLL, 488c2ecf20Sopenharmony_ci * we have to use specific dividers. This means the variable divider 498c2ecf20Sopenharmony_ci * can no longer be used, as the audio codec requests the exact clock 508c2ecf20Sopenharmony_ci * rates we support through this mechanism. So we now hard code the 518c2ecf20Sopenharmony_ci * variable divider to 1. This means the clock rates will no longer 528c2ecf20Sopenharmony_ci * match the clock names. 538c2ecf20Sopenharmony_ci */ 548c2ecf20Sopenharmony_ci#define SUN8I_A33_PLL_AUDIO_REG 0x008 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_cistatic struct ccu_sdm_setting pll_audio_sdm_table[] = { 578c2ecf20Sopenharmony_ci { .rate = 22579200, .pattern = 0xc0010d84, .m = 8, .n = 7 }, 588c2ecf20Sopenharmony_ci { .rate = 24576000, .pattern = 0xc000ac02, .m = 14, .n = 14 }, 598c2ecf20Sopenharmony_ci}; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", 628c2ecf20Sopenharmony_ci "osc24M", 0x008, 638c2ecf20Sopenharmony_ci 8, 7, /* N */ 648c2ecf20Sopenharmony_ci 0, 5, /* M */ 658c2ecf20Sopenharmony_ci pll_audio_sdm_table, BIT(24), 668c2ecf20Sopenharmony_ci 0x284, BIT(31), 678c2ecf20Sopenharmony_ci BIT(31), /* gate */ 688c2ecf20Sopenharmony_ci BIT(28), /* lock */ 698c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video_clk, "pll-video", 728c2ecf20Sopenharmony_ci "osc24M", 0x010, 738c2ecf20Sopenharmony_ci 8, 7, /* N */ 748c2ecf20Sopenharmony_ci 0, 4, /* M */ 758c2ecf20Sopenharmony_ci BIT(24), /* frac enable */ 768c2ecf20Sopenharmony_ci BIT(25), /* frac select */ 778c2ecf20Sopenharmony_ci 270000000, /* frac rate 0 */ 788c2ecf20Sopenharmony_ci 297000000, /* frac rate 1 */ 798c2ecf20Sopenharmony_ci BIT(31), /* gate */ 808c2ecf20Sopenharmony_ci BIT(28), /* lock */ 818c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", 848c2ecf20Sopenharmony_ci "osc24M", 0x018, 858c2ecf20Sopenharmony_ci 8, 7, /* N */ 868c2ecf20Sopenharmony_ci 0, 4, /* M */ 878c2ecf20Sopenharmony_ci BIT(24), /* frac enable */ 888c2ecf20Sopenharmony_ci BIT(25), /* frac select */ 898c2ecf20Sopenharmony_ci 270000000, /* frac rate 0 */ 908c2ecf20Sopenharmony_ci 297000000, /* frac rate 1 */ 918c2ecf20Sopenharmony_ci BIT(31), /* gate */ 928c2ecf20Sopenharmony_ci BIT(28), /* lock */ 938c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_cistatic SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr0_clk, "pll-ddr0", 968c2ecf20Sopenharmony_ci "osc24M", 0x020, 978c2ecf20Sopenharmony_ci 8, 5, /* N */ 988c2ecf20Sopenharmony_ci 4, 2, /* K */ 998c2ecf20Sopenharmony_ci 0, 2, /* M */ 1008c2ecf20Sopenharmony_ci BIT(31), /* gate */ 1018c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1028c2ecf20Sopenharmony_ci 0); 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_cistatic SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph_clk, "pll-periph", 1058c2ecf20Sopenharmony_ci "osc24M", 0x028, 1068c2ecf20Sopenharmony_ci 8, 5, /* N */ 1078c2ecf20Sopenharmony_ci 4, 2, /* K */ 1088c2ecf20Sopenharmony_ci BIT(31), /* gate */ 1098c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1108c2ecf20Sopenharmony_ci 2, /* post-div */ 1118c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_gpu_clk, "pll-gpu", 1148c2ecf20Sopenharmony_ci "osc24M", 0x038, 1158c2ecf20Sopenharmony_ci 8, 7, /* N */ 1168c2ecf20Sopenharmony_ci 0, 4, /* M */ 1178c2ecf20Sopenharmony_ci BIT(24), /* frac enable */ 1188c2ecf20Sopenharmony_ci BIT(25), /* frac select */ 1198c2ecf20Sopenharmony_ci 270000000, /* frac rate 0 */ 1208c2ecf20Sopenharmony_ci 297000000, /* frac rate 1 */ 1218c2ecf20Sopenharmony_ci BIT(31), /* gate */ 1228c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1238c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci/* 1268c2ecf20Sopenharmony_ci * The MIPI PLL has 2 modes: "MIPI" and "HDMI". 1278c2ecf20Sopenharmony_ci * 1288c2ecf20Sopenharmony_ci * The MIPI mode is a standard NKM-style clock. The HDMI mode is an 1298c2ecf20Sopenharmony_ci * integer / fractional clock with switchable multipliers and dividers. 1308c2ecf20Sopenharmony_ci * This is not supported here. We hardcode the PLL to MIPI mode. 1318c2ecf20Sopenharmony_ci */ 1328c2ecf20Sopenharmony_ci#define SUN8I_A33_PLL_MIPI_REG 0x040 1338c2ecf20Sopenharmony_cistatic SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_mipi_clk, "pll-mipi", 1348c2ecf20Sopenharmony_ci "pll-video", 0x040, 1358c2ecf20Sopenharmony_ci 8, 4, /* N */ 1368c2ecf20Sopenharmony_ci 4, 2, /* K */ 1378c2ecf20Sopenharmony_ci 0, 4, /* M */ 1388c2ecf20Sopenharmony_ci BIT(31) | BIT(23) | BIT(22), /* gate */ 1398c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1408c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_hsic_clk, "pll-hsic", 1438c2ecf20Sopenharmony_ci "osc24M", 0x044, 1448c2ecf20Sopenharmony_ci 8, 7, /* N */ 1458c2ecf20Sopenharmony_ci 0, 4, /* M */ 1468c2ecf20Sopenharmony_ci BIT(24), /* frac enable */ 1478c2ecf20Sopenharmony_ci BIT(25), /* frac select */ 1488c2ecf20Sopenharmony_ci 270000000, /* frac rate 0 */ 1498c2ecf20Sopenharmony_ci 297000000, /* frac rate 1 */ 1508c2ecf20Sopenharmony_ci BIT(31), /* gate */ 1518c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1528c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_de_clk, "pll-de", 1558c2ecf20Sopenharmony_ci "osc24M", 0x048, 1568c2ecf20Sopenharmony_ci 8, 7, /* N */ 1578c2ecf20Sopenharmony_ci 0, 4, /* M */ 1588c2ecf20Sopenharmony_ci BIT(24), /* frac enable */ 1598c2ecf20Sopenharmony_ci BIT(25), /* frac select */ 1608c2ecf20Sopenharmony_ci 270000000, /* frac rate 0 */ 1618c2ecf20Sopenharmony_ci 297000000, /* frac rate 1 */ 1628c2ecf20Sopenharmony_ci BIT(31), /* gate */ 1638c2ecf20Sopenharmony_ci BIT(28), /* lock */ 1648c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE); 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_cistatic struct ccu_mult pll_ddr1_clk = { 1678c2ecf20Sopenharmony_ci .enable = BIT(31), 1688c2ecf20Sopenharmony_ci .lock = BIT(28), 1698c2ecf20Sopenharmony_ci .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 6, 0, 12, 0), 1708c2ecf20Sopenharmony_ci .common = { 1718c2ecf20Sopenharmony_ci .reg = 0x04c, 1728c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ddr1", "osc24M", 1738c2ecf20Sopenharmony_ci &ccu_mult_ops, 1748c2ecf20Sopenharmony_ci CLK_SET_RATE_UNGATE), 1758c2ecf20Sopenharmony_ci }, 1768c2ecf20Sopenharmony_ci}; 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_cistatic const char * const cpux_parents[] = { "osc32k", "osc24M", 1798c2ecf20Sopenharmony_ci "pll-cpux" , "pll-cpux" }; 1808c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX(cpux_clk, "cpux", cpux_parents, 1818c2ecf20Sopenharmony_ci 0x050, 16, 2, CLK_IS_CRITICAL | CLK_SET_RATE_PARENT); 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x050, 0, 2, 0); 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_cistatic const char * const ahb1_parents[] = { "osc32k", "osc24M", 1868c2ecf20Sopenharmony_ci "axi" , "pll-periph" }; 1878c2ecf20Sopenharmony_cistatic const struct ccu_mux_var_prediv ahb1_predivs[] = { 1888c2ecf20Sopenharmony_ci { .index = 3, .shift = 6, .width = 2 }, 1898c2ecf20Sopenharmony_ci}; 1908c2ecf20Sopenharmony_cistatic struct ccu_div ahb1_clk = { 1918c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO), 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci .mux = { 1948c2ecf20Sopenharmony_ci .shift = 12, 1958c2ecf20Sopenharmony_ci .width = 2, 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci .var_predivs = ahb1_predivs, 1988c2ecf20Sopenharmony_ci .n_var_predivs = ARRAY_SIZE(ahb1_predivs), 1998c2ecf20Sopenharmony_ci }, 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci .common = { 2028c2ecf20Sopenharmony_ci .reg = 0x054, 2038c2ecf20Sopenharmony_ci .features = CCU_FEATURE_VARIABLE_PREDIV, 2048c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb1", 2058c2ecf20Sopenharmony_ci ahb1_parents, 2068c2ecf20Sopenharmony_ci &ccu_div_ops, 2078c2ecf20Sopenharmony_ci 0), 2088c2ecf20Sopenharmony_ci }, 2098c2ecf20Sopenharmony_ci}; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_cistatic struct clk_div_table apb1_div_table[] = { 2128c2ecf20Sopenharmony_ci { .val = 0, .div = 2 }, 2138c2ecf20Sopenharmony_ci { .val = 1, .div = 2 }, 2148c2ecf20Sopenharmony_ci { .val = 2, .div = 4 }, 2158c2ecf20Sopenharmony_ci { .val = 3, .div = 8 }, 2168c2ecf20Sopenharmony_ci { /* Sentinel */ }, 2178c2ecf20Sopenharmony_ci}; 2188c2ecf20Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(apb1_clk, "apb1", "ahb1", 2198c2ecf20Sopenharmony_ci 0x054, 8, 2, apb1_div_table, 0); 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_cistatic const char * const apb2_parents[] = { "osc32k", "osc24M", 2228c2ecf20Sopenharmony_ci "pll-periph" , "pll-periph" }; 2238c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", apb2_parents, 0x058, 2248c2ecf20Sopenharmony_ci 0, 5, /* M */ 2258c2ecf20Sopenharmony_ci 16, 2, /* P */ 2268c2ecf20Sopenharmony_ci 24, 2, /* mux */ 2278c2ecf20Sopenharmony_ci 0); 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mipi_dsi_clk, "bus-mipi-dsi", "ahb1", 2308c2ecf20Sopenharmony_ci 0x060, BIT(1), 0); 2318c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ss_clk, "bus-ss", "ahb1", 2328c2ecf20Sopenharmony_ci 0x060, BIT(5), 0); 2338c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "ahb1", 2348c2ecf20Sopenharmony_ci 0x060, BIT(6), 0); 2358c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb1", 2368c2ecf20Sopenharmony_ci 0x060, BIT(8), 0); 2378c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb1", 2388c2ecf20Sopenharmony_ci 0x060, BIT(9), 0); 2398c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc2_clk, "bus-mmc2", "ahb1", 2408c2ecf20Sopenharmony_ci 0x060, BIT(10), 0); 2418c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_nand_clk, "bus-nand", "ahb1", 2428c2ecf20Sopenharmony_ci 0x060, BIT(13), 0); 2438c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dram_clk, "bus-dram", "ahb1", 2448c2ecf20Sopenharmony_ci 0x060, BIT(14), 0); 2458c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "ahb1", 2468c2ecf20Sopenharmony_ci 0x060, BIT(19), 0); 2478c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb1", 2488c2ecf20Sopenharmony_ci 0x060, BIT(20), 0); 2498c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi1_clk, "bus-spi1", "ahb1", 2508c2ecf20Sopenharmony_ci 0x060, BIT(21), 0); 2518c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb1", 2528c2ecf20Sopenharmony_ci 0x060, BIT(24), 0); 2538c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci_clk, "bus-ehci", "ahb1", 2548c2ecf20Sopenharmony_ci 0x060, BIT(26), 0); 2558c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci_clk, "bus-ohci", "ahb1", 2568c2ecf20Sopenharmony_ci 0x060, BIT(29), 0); 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "ahb1", 2598c2ecf20Sopenharmony_ci 0x064, BIT(0), 0); 2608c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_lcd_clk, "bus-lcd", "ahb1", 2618c2ecf20Sopenharmony_ci 0x064, BIT(4), 0); 2628c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_csi_clk, "bus-csi", "ahb1", 2638c2ecf20Sopenharmony_ci 0x064, BIT(8), 0); 2648c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_de_be_clk, "bus-de-be", "ahb1", 2658c2ecf20Sopenharmony_ci 0x064, BIT(12), 0); 2668c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_de_fe_clk, "bus-de-fe", "ahb1", 2678c2ecf20Sopenharmony_ci 0x064, BIT(14), 0); 2688c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gpu_clk, "bus-gpu", "ahb1", 2698c2ecf20Sopenharmony_ci 0x064, BIT(20), 0); 2708c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_msgbox_clk, "bus-msgbox", "ahb1", 2718c2ecf20Sopenharmony_ci 0x064, BIT(21), 0); 2728c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spinlock_clk, "bus-spinlock", "ahb1", 2738c2ecf20Sopenharmony_ci 0x064, BIT(22), 0); 2748c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_drc_clk, "bus-drc", "ahb1", 2758c2ecf20Sopenharmony_ci 0x064, BIT(25), 0); 2768c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_sat_clk, "bus-sat", "ahb1", 2778c2ecf20Sopenharmony_ci 0x064, BIT(26), 0); 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_codec_clk, "bus-codec", "apb1", 2808c2ecf20Sopenharmony_ci 0x068, BIT(0), 0); 2818c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_pio_clk, "bus-pio", "apb1", 2828c2ecf20Sopenharmony_ci 0x068, BIT(5), 0); 2838c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s0_clk, "bus-i2s0", "apb1", 2848c2ecf20Sopenharmony_ci 0x068, BIT(12), 0); 2858c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s1_clk, "bus-i2s1", "apb1", 2868c2ecf20Sopenharmony_ci 0x068, BIT(13), 0); 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb2", 2898c2ecf20Sopenharmony_ci 0x06c, BIT(0), 0); 2908c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb2", 2918c2ecf20Sopenharmony_ci 0x06c, BIT(1), 0); 2928c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb2", 2938c2ecf20Sopenharmony_ci 0x06c, BIT(2), 0); 2948c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb2", 2958c2ecf20Sopenharmony_ci 0x06c, BIT(16), 0); 2968c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb2", 2978c2ecf20Sopenharmony_ci 0x06c, BIT(17), 0); 2988c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb2", 2998c2ecf20Sopenharmony_ci 0x06c, BIT(18), 0); 3008c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb2", 3018c2ecf20Sopenharmony_ci 0x06c, BIT(19), 0); 3028c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart4_clk, "bus-uart4", "apb2", 3038c2ecf20Sopenharmony_ci 0x06c, BIT(20), 0); 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_cistatic const char * const mod0_default_parents[] = { "osc24M", "pll-periph" }; 3068c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand_clk, "nand", mod0_default_parents, 0x080, 3078c2ecf20Sopenharmony_ci 0, 4, /* M */ 3088c2ecf20Sopenharmony_ci 16, 2, /* P */ 3098c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3108c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3118c2ecf20Sopenharmony_ci 0); 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 0x088, 3148c2ecf20Sopenharmony_ci 0, 4, /* M */ 3158c2ecf20Sopenharmony_ci 16, 2, /* P */ 3168c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3178c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3188c2ecf20Sopenharmony_ci 0); 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_sample_clk, "mmc0_sample", "mmc0", 3218c2ecf20Sopenharmony_ci 0x088, 20, 3, 0); 3228c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_output_clk, "mmc0_output", "mmc0", 3238c2ecf20Sopenharmony_ci 0x088, 8, 3, 0); 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 0x08c, 3268c2ecf20Sopenharmony_ci 0, 4, /* M */ 3278c2ecf20Sopenharmony_ci 16, 2, /* P */ 3288c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3298c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3308c2ecf20Sopenharmony_ci 0); 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1_sample", "mmc1", 3338c2ecf20Sopenharmony_ci 0x08c, 20, 3, 0); 3348c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1_output", "mmc1", 3358c2ecf20Sopenharmony_ci 0x08c, 8, 3, 0); 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 0x090, 3388c2ecf20Sopenharmony_ci 0, 4, /* M */ 3398c2ecf20Sopenharmony_ci 16, 2, /* P */ 3408c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3418c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3428c2ecf20Sopenharmony_ci 0); 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2_sample", "mmc2", 3458c2ecf20Sopenharmony_ci 0x090, 20, 3, 0); 3468c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_output_clk, "mmc2_output", "mmc2", 3478c2ecf20Sopenharmony_ci 0x090, 8, 3, 0); 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ss_clk, "ss", mod0_default_parents, 0x09c, 3508c2ecf20Sopenharmony_ci 0, 4, /* M */ 3518c2ecf20Sopenharmony_ci 16, 2, /* P */ 3528c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3538c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3548c2ecf20Sopenharmony_ci 0); 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 0x0a0, 3578c2ecf20Sopenharmony_ci 0, 4, /* M */ 3588c2ecf20Sopenharmony_ci 16, 2, /* P */ 3598c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3608c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3618c2ecf20Sopenharmony_ci 0); 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 0x0a4, 3648c2ecf20Sopenharmony_ci 0, 4, /* M */ 3658c2ecf20Sopenharmony_ci 16, 2, /* P */ 3668c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3678c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3688c2ecf20Sopenharmony_ci 0); 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_cistatic const char * const i2s_parents[] = { "pll-audio-8x", "pll-audio-4x", 3718c2ecf20Sopenharmony_ci "pll-audio-2x", "pll-audio" }; 3728c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s0_clk, "i2s0", i2s_parents, 3738c2ecf20Sopenharmony_ci 0x0b0, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s1_clk, "i2s1", i2s_parents, 3768c2ecf20Sopenharmony_ci 0x0b4, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci/* TODO: the parent for most of the USB clocks is not known */ 3798c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M", 3808c2ecf20Sopenharmony_ci 0x0cc, BIT(8), 0); 3818c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "osc24M", 3828c2ecf20Sopenharmony_ci 0x0cc, BIT(9), 0); 3838c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_hsic_clk, "usb-hsic", "pll-hsic", 3848c2ecf20Sopenharmony_ci 0x0cc, BIT(10), 0); 3858c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_hsic_12M_clk, "usb-hsic-12M", "osc24M", 3868c2ecf20Sopenharmony_ci 0x0cc, BIT(11), 0); 3878c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci_clk, "usb-ohci", "osc24M", 3888c2ecf20Sopenharmony_ci 0x0cc, BIT(16), 0); 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(dram_clk, "dram", "pll-ddr", 3918c2ecf20Sopenharmony_ci 0x0f4, 0, 4, CLK_IS_CRITICAL); 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_cistatic const char * const pll_ddr_parents[] = { "pll-ddr0", "pll-ddr1" }; 3948c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX(pll_ddr_clk, "pll-ddr", pll_ddr_parents, 3958c2ecf20Sopenharmony_ci 0x0f8, 16, 1, 0); 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ve_clk, "dram-ve", "dram", 3988c2ecf20Sopenharmony_ci 0x100, BIT(0), 0); 3998c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_csi_clk, "dram-csi", "dram", 4008c2ecf20Sopenharmony_ci 0x100, BIT(1), 0); 4018c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_drc_clk, "dram-drc", "dram", 4028c2ecf20Sopenharmony_ci 0x100, BIT(16), 0); 4038c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_de_fe_clk, "dram-de-fe", "dram", 4048c2ecf20Sopenharmony_ci 0x100, BIT(24), 0); 4058c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_de_be_clk, "dram-de-be", "dram", 4068c2ecf20Sopenharmony_ci 0x100, BIT(26), 0); 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_cistatic const char * const de_parents[] = { "pll-video", "pll-periph-2x", 4098c2ecf20Sopenharmony_ci "pll-gpu", "pll-de" }; 4108c2ecf20Sopenharmony_cistatic const u8 de_table[] = { 0, 2, 3, 5 }; 4118c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(de_be_clk, "de-be", 4128c2ecf20Sopenharmony_ci de_parents, de_table, 4138c2ecf20Sopenharmony_ci 0x104, 0, 4, 24, 3, BIT(31), 0); 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(de_fe_clk, "de-fe", 4168c2ecf20Sopenharmony_ci de_parents, de_table, 4178c2ecf20Sopenharmony_ci 0x10c, 0, 4, 24, 3, BIT(31), 0); 4188c2ecf20Sopenharmony_ci 4198c2ecf20Sopenharmony_cistatic const char * const lcd_ch0_parents[] = { "pll-video", "pll-video-2x", 4208c2ecf20Sopenharmony_ci "pll-mipi" }; 4218c2ecf20Sopenharmony_cistatic const u8 lcd_ch0_table[] = { 0, 2, 4 }; 4228c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_TABLE_WITH_GATE(lcd_ch0_clk, "lcd-ch0", 4238c2ecf20Sopenharmony_ci lcd_ch0_parents, lcd_ch0_table, 4248c2ecf20Sopenharmony_ci 0x118, 24, 3, BIT(31), 4258c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_cistatic const char * const lcd_ch1_parents[] = { "pll-video", "pll-video-2x" }; 4288c2ecf20Sopenharmony_cistatic const u8 lcd_ch1_table[] = { 0, 2 }; 4298c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(lcd_ch1_clk, "lcd-ch1", 4308c2ecf20Sopenharmony_ci lcd_ch1_parents, lcd_ch1_table, 4318c2ecf20Sopenharmony_ci 0x12c, 0, 4, 24, 2, BIT(31), 0); 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_cistatic const char * const csi_sclk_parents[] = { "pll-video", "pll-de", 4348c2ecf20Sopenharmony_ci "pll-mipi", "pll-ve" }; 4358c2ecf20Sopenharmony_cistatic const u8 csi_sclk_table[] = { 0, 3, 4, 5 }; 4368c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi_sclk_clk, "csi-sclk", 4378c2ecf20Sopenharmony_ci csi_sclk_parents, csi_sclk_table, 4388c2ecf20Sopenharmony_ci 0x134, 16, 4, 24, 3, BIT(31), 0); 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_cistatic const char * const csi_mclk_parents[] = { "pll-video", "pll-de", 4418c2ecf20Sopenharmony_ci "osc24M" }; 4428c2ecf20Sopenharmony_cistatic const u8 csi_mclk_table[] = { 0, 3, 5 }; 4438c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi_mclk_clk, "csi-mclk", 4448c2ecf20Sopenharmony_ci csi_mclk_parents, csi_mclk_table, 4458c2ecf20Sopenharmony_ci 0x134, 0, 5, 8, 3, BIT(15), 0); 4468c2ecf20Sopenharmony_ci 4478c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve", 4488c2ecf20Sopenharmony_ci 0x13c, 16, 3, BIT(31), CLK_SET_RATE_PARENT); 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ac_dig_clk, "ac-dig", "pll-audio", 4518c2ecf20Sopenharmony_ci 0x140, BIT(31), CLK_SET_RATE_PARENT); 4528c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ac_dig_4x_clk, "ac-dig-4x", "pll-audio-4x", 4538c2ecf20Sopenharmony_ci 0x140, BIT(30), CLK_SET_RATE_PARENT); 4548c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", 4558c2ecf20Sopenharmony_ci 0x144, BIT(31), 0); 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_cistatic const char * const mbus_parents[] = { "osc24M", "pll-periph-2x", 4588c2ecf20Sopenharmony_ci "pll-ddr0", "pll-ddr1" }; 4598c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents, 4608c2ecf20Sopenharmony_ci 0x15c, 0, 3, 24, 2, BIT(31), CLK_IS_CRITICAL); 4618c2ecf20Sopenharmony_ci 4628c2ecf20Sopenharmony_cistatic const char * const dsi_sclk_parents[] = { "pll-video", "pll-video-2x" }; 4638c2ecf20Sopenharmony_cistatic const u8 dsi_sclk_table[] = { 0, 2 }; 4648c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(dsi_sclk_clk, "dsi-sclk", 4658c2ecf20Sopenharmony_ci dsi_sclk_parents, dsi_sclk_table, 4668c2ecf20Sopenharmony_ci 0x168, 16, 4, 24, 2, BIT(31), 0); 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_cistatic const char * const dsi_dphy_parents[] = { "pll-video", "pll-periph" }; 4698c2ecf20Sopenharmony_cistatic const u8 dsi_dphy_table[] = { 0, 2 }; 4708c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(dsi_dphy_clk, "dsi-dphy", 4718c2ecf20Sopenharmony_ci dsi_dphy_parents, dsi_dphy_table, 4728c2ecf20Sopenharmony_ci 0x168, 0, 4, 8, 2, BIT(15), 0); 4738c2ecf20Sopenharmony_ci 4748c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(drc_clk, "drc", 4758c2ecf20Sopenharmony_ci de_parents, de_table, 4768c2ecf20Sopenharmony_ci 0x180, 0, 4, 24, 3, BIT(31), 0); 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(gpu_clk, "gpu", "pll-gpu", 4798c2ecf20Sopenharmony_ci 0x1a0, 0, 3, BIT(31), CLK_SET_RATE_PARENT); 4808c2ecf20Sopenharmony_ci 4818c2ecf20Sopenharmony_cistatic const char * const ats_parents[] = { "osc24M", "pll-periph" }; 4828c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(ats_clk, "ats", ats_parents, 4838c2ecf20Sopenharmony_ci 0x1b0, 0, 3, 24, 2, BIT(31), 0); 4848c2ecf20Sopenharmony_ci 4858c2ecf20Sopenharmony_cistatic struct ccu_common *sun8i_a33_ccu_clks[] = { 4868c2ecf20Sopenharmony_ci &pll_cpux_clk.common, 4878c2ecf20Sopenharmony_ci &pll_audio_base_clk.common, 4888c2ecf20Sopenharmony_ci &pll_video_clk.common, 4898c2ecf20Sopenharmony_ci &pll_ve_clk.common, 4908c2ecf20Sopenharmony_ci &pll_ddr0_clk.common, 4918c2ecf20Sopenharmony_ci &pll_periph_clk.common, 4928c2ecf20Sopenharmony_ci &pll_gpu_clk.common, 4938c2ecf20Sopenharmony_ci &pll_mipi_clk.common, 4948c2ecf20Sopenharmony_ci &pll_hsic_clk.common, 4958c2ecf20Sopenharmony_ci &pll_de_clk.common, 4968c2ecf20Sopenharmony_ci &pll_ddr1_clk.common, 4978c2ecf20Sopenharmony_ci &pll_ddr_clk.common, 4988c2ecf20Sopenharmony_ci &cpux_clk.common, 4998c2ecf20Sopenharmony_ci &axi_clk.common, 5008c2ecf20Sopenharmony_ci &ahb1_clk.common, 5018c2ecf20Sopenharmony_ci &apb1_clk.common, 5028c2ecf20Sopenharmony_ci &apb2_clk.common, 5038c2ecf20Sopenharmony_ci &bus_mipi_dsi_clk.common, 5048c2ecf20Sopenharmony_ci &bus_ss_clk.common, 5058c2ecf20Sopenharmony_ci &bus_dma_clk.common, 5068c2ecf20Sopenharmony_ci &bus_mmc0_clk.common, 5078c2ecf20Sopenharmony_ci &bus_mmc1_clk.common, 5088c2ecf20Sopenharmony_ci &bus_mmc2_clk.common, 5098c2ecf20Sopenharmony_ci &bus_nand_clk.common, 5108c2ecf20Sopenharmony_ci &bus_dram_clk.common, 5118c2ecf20Sopenharmony_ci &bus_hstimer_clk.common, 5128c2ecf20Sopenharmony_ci &bus_spi0_clk.common, 5138c2ecf20Sopenharmony_ci &bus_spi1_clk.common, 5148c2ecf20Sopenharmony_ci &bus_otg_clk.common, 5158c2ecf20Sopenharmony_ci &bus_ehci_clk.common, 5168c2ecf20Sopenharmony_ci &bus_ohci_clk.common, 5178c2ecf20Sopenharmony_ci &bus_ve_clk.common, 5188c2ecf20Sopenharmony_ci &bus_lcd_clk.common, 5198c2ecf20Sopenharmony_ci &bus_csi_clk.common, 5208c2ecf20Sopenharmony_ci &bus_de_fe_clk.common, 5218c2ecf20Sopenharmony_ci &bus_de_be_clk.common, 5228c2ecf20Sopenharmony_ci &bus_gpu_clk.common, 5238c2ecf20Sopenharmony_ci &bus_msgbox_clk.common, 5248c2ecf20Sopenharmony_ci &bus_spinlock_clk.common, 5258c2ecf20Sopenharmony_ci &bus_drc_clk.common, 5268c2ecf20Sopenharmony_ci &bus_sat_clk.common, 5278c2ecf20Sopenharmony_ci &bus_codec_clk.common, 5288c2ecf20Sopenharmony_ci &bus_pio_clk.common, 5298c2ecf20Sopenharmony_ci &bus_i2s0_clk.common, 5308c2ecf20Sopenharmony_ci &bus_i2s1_clk.common, 5318c2ecf20Sopenharmony_ci &bus_i2c0_clk.common, 5328c2ecf20Sopenharmony_ci &bus_i2c1_clk.common, 5338c2ecf20Sopenharmony_ci &bus_i2c2_clk.common, 5348c2ecf20Sopenharmony_ci &bus_uart0_clk.common, 5358c2ecf20Sopenharmony_ci &bus_uart1_clk.common, 5368c2ecf20Sopenharmony_ci &bus_uart2_clk.common, 5378c2ecf20Sopenharmony_ci &bus_uart3_clk.common, 5388c2ecf20Sopenharmony_ci &bus_uart4_clk.common, 5398c2ecf20Sopenharmony_ci &nand_clk.common, 5408c2ecf20Sopenharmony_ci &mmc0_clk.common, 5418c2ecf20Sopenharmony_ci &mmc0_sample_clk.common, 5428c2ecf20Sopenharmony_ci &mmc0_output_clk.common, 5438c2ecf20Sopenharmony_ci &mmc1_clk.common, 5448c2ecf20Sopenharmony_ci &mmc1_sample_clk.common, 5458c2ecf20Sopenharmony_ci &mmc1_output_clk.common, 5468c2ecf20Sopenharmony_ci &mmc2_clk.common, 5478c2ecf20Sopenharmony_ci &mmc2_sample_clk.common, 5488c2ecf20Sopenharmony_ci &mmc2_output_clk.common, 5498c2ecf20Sopenharmony_ci &ss_clk.common, 5508c2ecf20Sopenharmony_ci &spi0_clk.common, 5518c2ecf20Sopenharmony_ci &spi1_clk.common, 5528c2ecf20Sopenharmony_ci &i2s0_clk.common, 5538c2ecf20Sopenharmony_ci &i2s1_clk.common, 5548c2ecf20Sopenharmony_ci &usb_phy0_clk.common, 5558c2ecf20Sopenharmony_ci &usb_phy1_clk.common, 5568c2ecf20Sopenharmony_ci &usb_hsic_clk.common, 5578c2ecf20Sopenharmony_ci &usb_hsic_12M_clk.common, 5588c2ecf20Sopenharmony_ci &usb_ohci_clk.common, 5598c2ecf20Sopenharmony_ci &dram_clk.common, 5608c2ecf20Sopenharmony_ci &dram_ve_clk.common, 5618c2ecf20Sopenharmony_ci &dram_csi_clk.common, 5628c2ecf20Sopenharmony_ci &dram_drc_clk.common, 5638c2ecf20Sopenharmony_ci &dram_de_fe_clk.common, 5648c2ecf20Sopenharmony_ci &dram_de_be_clk.common, 5658c2ecf20Sopenharmony_ci &de_be_clk.common, 5668c2ecf20Sopenharmony_ci &de_fe_clk.common, 5678c2ecf20Sopenharmony_ci &lcd_ch0_clk.common, 5688c2ecf20Sopenharmony_ci &lcd_ch1_clk.common, 5698c2ecf20Sopenharmony_ci &csi_sclk_clk.common, 5708c2ecf20Sopenharmony_ci &csi_mclk_clk.common, 5718c2ecf20Sopenharmony_ci &ve_clk.common, 5728c2ecf20Sopenharmony_ci &ac_dig_clk.common, 5738c2ecf20Sopenharmony_ci &ac_dig_4x_clk.common, 5748c2ecf20Sopenharmony_ci &avs_clk.common, 5758c2ecf20Sopenharmony_ci &mbus_clk.common, 5768c2ecf20Sopenharmony_ci &dsi_sclk_clk.common, 5778c2ecf20Sopenharmony_ci &dsi_dphy_clk.common, 5788c2ecf20Sopenharmony_ci &drc_clk.common, 5798c2ecf20Sopenharmony_ci &gpu_clk.common, 5808c2ecf20Sopenharmony_ci &ats_clk.common, 5818c2ecf20Sopenharmony_ci}; 5828c2ecf20Sopenharmony_ci 5838c2ecf20Sopenharmony_cistatic const struct clk_hw *clk_parent_pll_audio[] = { 5848c2ecf20Sopenharmony_ci &pll_audio_base_clk.common.hw 5858c2ecf20Sopenharmony_ci}; 5868c2ecf20Sopenharmony_ci 5878c2ecf20Sopenharmony_ci/* We hardcode the divider to 1 for now */ 5888c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 5898c2ecf20Sopenharmony_ci clk_parent_pll_audio, 5908c2ecf20Sopenharmony_ci 1, 1, CLK_SET_RATE_PARENT); 5918c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 5928c2ecf20Sopenharmony_ci clk_parent_pll_audio, 5938c2ecf20Sopenharmony_ci 2, 1, CLK_SET_RATE_PARENT); 5948c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 5958c2ecf20Sopenharmony_ci clk_parent_pll_audio, 5968c2ecf20Sopenharmony_ci 1, 1, CLK_SET_RATE_PARENT); 5978c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 5988c2ecf20Sopenharmony_ci clk_parent_pll_audio, 5998c2ecf20Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 6008c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_periph_2x_clk, "pll-periph-2x", 6018c2ecf20Sopenharmony_ci &pll_periph_clk.common.hw, 6028c2ecf20Sopenharmony_ci 1, 2, 0); 6038c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_video_2x_clk, "pll-video-2x", 6048c2ecf20Sopenharmony_ci &pll_video_clk.common.hw, 6058c2ecf20Sopenharmony_ci 1, 2, 0); 6068c2ecf20Sopenharmony_ci 6078c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun8i_a33_hw_clks = { 6088c2ecf20Sopenharmony_ci .hws = { 6098c2ecf20Sopenharmony_ci [CLK_PLL_CPUX] = &pll_cpux_clk.common.hw, 6108c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, 6118c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.hw, 6128c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, 6138c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, 6148c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, 6158c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO] = &pll_video_clk.common.hw, 6168c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO_2X] = &pll_video_2x_clk.hw, 6178c2ecf20Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 6188c2ecf20Sopenharmony_ci [CLK_PLL_DDR0] = &pll_ddr0_clk.common.hw, 6198c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH] = &pll_periph_clk.common.hw, 6208c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH_2X] = &pll_periph_2x_clk.hw, 6218c2ecf20Sopenharmony_ci [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 6228c2ecf20Sopenharmony_ci [CLK_PLL_MIPI] = &pll_mipi_clk.common.hw, 6238c2ecf20Sopenharmony_ci [CLK_PLL_HSIC] = &pll_hsic_clk.common.hw, 6248c2ecf20Sopenharmony_ci [CLK_PLL_DE] = &pll_de_clk.common.hw, 6258c2ecf20Sopenharmony_ci [CLK_PLL_DDR1] = &pll_ddr1_clk.common.hw, 6268c2ecf20Sopenharmony_ci [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 6278c2ecf20Sopenharmony_ci [CLK_CPUX] = &cpux_clk.common.hw, 6288c2ecf20Sopenharmony_ci [CLK_AXI] = &axi_clk.common.hw, 6298c2ecf20Sopenharmony_ci [CLK_AHB1] = &ahb1_clk.common.hw, 6308c2ecf20Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 6318c2ecf20Sopenharmony_ci [CLK_APB2] = &apb2_clk.common.hw, 6328c2ecf20Sopenharmony_ci [CLK_BUS_MIPI_DSI] = &bus_mipi_dsi_clk.common.hw, 6338c2ecf20Sopenharmony_ci [CLK_BUS_SS] = &bus_ss_clk.common.hw, 6348c2ecf20Sopenharmony_ci [CLK_BUS_DMA] = &bus_dma_clk.common.hw, 6358c2ecf20Sopenharmony_ci [CLK_BUS_MMC0] = &bus_mmc0_clk.common.hw, 6368c2ecf20Sopenharmony_ci [CLK_BUS_MMC1] = &bus_mmc1_clk.common.hw, 6378c2ecf20Sopenharmony_ci [CLK_BUS_MMC2] = &bus_mmc2_clk.common.hw, 6388c2ecf20Sopenharmony_ci [CLK_BUS_NAND] = &bus_nand_clk.common.hw, 6398c2ecf20Sopenharmony_ci [CLK_BUS_DRAM] = &bus_dram_clk.common.hw, 6408c2ecf20Sopenharmony_ci [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw, 6418c2ecf20Sopenharmony_ci [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw, 6428c2ecf20Sopenharmony_ci [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw, 6438c2ecf20Sopenharmony_ci [CLK_BUS_OTG] = &bus_otg_clk.common.hw, 6448c2ecf20Sopenharmony_ci [CLK_BUS_EHCI] = &bus_ehci_clk.common.hw, 6458c2ecf20Sopenharmony_ci [CLK_BUS_OHCI] = &bus_ohci_clk.common.hw, 6468c2ecf20Sopenharmony_ci [CLK_BUS_VE] = &bus_ve_clk.common.hw, 6478c2ecf20Sopenharmony_ci [CLK_BUS_LCD] = &bus_lcd_clk.common.hw, 6488c2ecf20Sopenharmony_ci [CLK_BUS_CSI] = &bus_csi_clk.common.hw, 6498c2ecf20Sopenharmony_ci [CLK_BUS_DE_BE] = &bus_de_be_clk.common.hw, 6508c2ecf20Sopenharmony_ci [CLK_BUS_DE_FE] = &bus_de_fe_clk.common.hw, 6518c2ecf20Sopenharmony_ci [CLK_BUS_GPU] = &bus_gpu_clk.common.hw, 6528c2ecf20Sopenharmony_ci [CLK_BUS_MSGBOX] = &bus_msgbox_clk.common.hw, 6538c2ecf20Sopenharmony_ci [CLK_BUS_SPINLOCK] = &bus_spinlock_clk.common.hw, 6548c2ecf20Sopenharmony_ci [CLK_BUS_DRC] = &bus_drc_clk.common.hw, 6558c2ecf20Sopenharmony_ci [CLK_BUS_SAT] = &bus_sat_clk.common.hw, 6568c2ecf20Sopenharmony_ci [CLK_BUS_CODEC] = &bus_codec_clk.common.hw, 6578c2ecf20Sopenharmony_ci [CLK_BUS_PIO] = &bus_pio_clk.common.hw, 6588c2ecf20Sopenharmony_ci [CLK_BUS_I2S0] = &bus_i2s0_clk.common.hw, 6598c2ecf20Sopenharmony_ci [CLK_BUS_I2S1] = &bus_i2s1_clk.common.hw, 6608c2ecf20Sopenharmony_ci [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw, 6618c2ecf20Sopenharmony_ci [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw, 6628c2ecf20Sopenharmony_ci [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw, 6638c2ecf20Sopenharmony_ci [CLK_BUS_UART0] = &bus_uart0_clk.common.hw, 6648c2ecf20Sopenharmony_ci [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 6658c2ecf20Sopenharmony_ci [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 6668c2ecf20Sopenharmony_ci [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 6678c2ecf20Sopenharmony_ci [CLK_BUS_UART4] = &bus_uart4_clk.common.hw, 6688c2ecf20Sopenharmony_ci [CLK_NAND] = &nand_clk.common.hw, 6698c2ecf20Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 6708c2ecf20Sopenharmony_ci [CLK_MMC0_SAMPLE] = &mmc0_sample_clk.common.hw, 6718c2ecf20Sopenharmony_ci [CLK_MMC0_OUTPUT] = &mmc0_output_clk.common.hw, 6728c2ecf20Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 6738c2ecf20Sopenharmony_ci [CLK_MMC1_SAMPLE] = &mmc1_sample_clk.common.hw, 6748c2ecf20Sopenharmony_ci [CLK_MMC1_OUTPUT] = &mmc1_output_clk.common.hw, 6758c2ecf20Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 6768c2ecf20Sopenharmony_ci [CLK_MMC2_SAMPLE] = &mmc2_sample_clk.common.hw, 6778c2ecf20Sopenharmony_ci [CLK_MMC2_OUTPUT] = &mmc2_output_clk.common.hw, 6788c2ecf20Sopenharmony_ci [CLK_SS] = &ss_clk.common.hw, 6798c2ecf20Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 6808c2ecf20Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 6818c2ecf20Sopenharmony_ci [CLK_I2S0] = &i2s0_clk.common.hw, 6828c2ecf20Sopenharmony_ci [CLK_I2S1] = &i2s1_clk.common.hw, 6838c2ecf20Sopenharmony_ci [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 6848c2ecf20Sopenharmony_ci [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 6858c2ecf20Sopenharmony_ci [CLK_USB_HSIC] = &usb_hsic_clk.common.hw, 6868c2ecf20Sopenharmony_ci [CLK_USB_HSIC_12M] = &usb_hsic_12M_clk.common.hw, 6878c2ecf20Sopenharmony_ci [CLK_USB_OHCI] = &usb_ohci_clk.common.hw, 6888c2ecf20Sopenharmony_ci [CLK_DRAM] = &dram_clk.common.hw, 6898c2ecf20Sopenharmony_ci [CLK_DRAM_VE] = &dram_ve_clk.common.hw, 6908c2ecf20Sopenharmony_ci [CLK_DRAM_CSI] = &dram_csi_clk.common.hw, 6918c2ecf20Sopenharmony_ci [CLK_DRAM_DRC] = &dram_drc_clk.common.hw, 6928c2ecf20Sopenharmony_ci [CLK_DRAM_DE_FE] = &dram_de_fe_clk.common.hw, 6938c2ecf20Sopenharmony_ci [CLK_DRAM_DE_BE] = &dram_de_be_clk.common.hw, 6948c2ecf20Sopenharmony_ci [CLK_DE_BE] = &de_be_clk.common.hw, 6958c2ecf20Sopenharmony_ci [CLK_DE_FE] = &de_fe_clk.common.hw, 6968c2ecf20Sopenharmony_ci [CLK_LCD_CH0] = &lcd_ch0_clk.common.hw, 6978c2ecf20Sopenharmony_ci [CLK_LCD_CH1] = &lcd_ch1_clk.common.hw, 6988c2ecf20Sopenharmony_ci [CLK_CSI_SCLK] = &csi_sclk_clk.common.hw, 6998c2ecf20Sopenharmony_ci [CLK_CSI_MCLK] = &csi_mclk_clk.common.hw, 7008c2ecf20Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 7018c2ecf20Sopenharmony_ci [CLK_AC_DIG] = &ac_dig_clk.common.hw, 7028c2ecf20Sopenharmony_ci [CLK_AC_DIG_4X] = &ac_dig_4x_clk.common.hw, 7038c2ecf20Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 7048c2ecf20Sopenharmony_ci [CLK_MBUS] = &mbus_clk.common.hw, 7058c2ecf20Sopenharmony_ci [CLK_DSI_SCLK] = &dsi_sclk_clk.common.hw, 7068c2ecf20Sopenharmony_ci [CLK_DSI_DPHY] = &dsi_dphy_clk.common.hw, 7078c2ecf20Sopenharmony_ci [CLK_DRC] = &drc_clk.common.hw, 7088c2ecf20Sopenharmony_ci [CLK_GPU] = &gpu_clk.common.hw, 7098c2ecf20Sopenharmony_ci [CLK_ATS] = &ats_clk.common.hw, 7108c2ecf20Sopenharmony_ci }, 7118c2ecf20Sopenharmony_ci .num = CLK_NUMBER, 7128c2ecf20Sopenharmony_ci}; 7138c2ecf20Sopenharmony_ci 7148c2ecf20Sopenharmony_cistatic struct ccu_reset_map sun8i_a33_ccu_resets[] = { 7158c2ecf20Sopenharmony_ci [RST_USB_PHY0] = { 0x0cc, BIT(0) }, 7168c2ecf20Sopenharmony_ci [RST_USB_PHY1] = { 0x0cc, BIT(1) }, 7178c2ecf20Sopenharmony_ci [RST_USB_HSIC] = { 0x0cc, BIT(2) }, 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_ci [RST_MBUS] = { 0x0fc, BIT(31) }, 7208c2ecf20Sopenharmony_ci 7218c2ecf20Sopenharmony_ci [RST_BUS_MIPI_DSI] = { 0x2c0, BIT(1) }, 7228c2ecf20Sopenharmony_ci [RST_BUS_SS] = { 0x2c0, BIT(5) }, 7238c2ecf20Sopenharmony_ci [RST_BUS_DMA] = { 0x2c0, BIT(6) }, 7248c2ecf20Sopenharmony_ci [RST_BUS_MMC0] = { 0x2c0, BIT(8) }, 7258c2ecf20Sopenharmony_ci [RST_BUS_MMC1] = { 0x2c0, BIT(9) }, 7268c2ecf20Sopenharmony_ci [RST_BUS_MMC2] = { 0x2c0, BIT(10) }, 7278c2ecf20Sopenharmony_ci [RST_BUS_NAND] = { 0x2c0, BIT(13) }, 7288c2ecf20Sopenharmony_ci [RST_BUS_DRAM] = { 0x2c0, BIT(14) }, 7298c2ecf20Sopenharmony_ci [RST_BUS_HSTIMER] = { 0x2c0, BIT(19) }, 7308c2ecf20Sopenharmony_ci [RST_BUS_SPI0] = { 0x2c0, BIT(20) }, 7318c2ecf20Sopenharmony_ci [RST_BUS_SPI1] = { 0x2c0, BIT(21) }, 7328c2ecf20Sopenharmony_ci [RST_BUS_OTG] = { 0x2c0, BIT(24) }, 7338c2ecf20Sopenharmony_ci [RST_BUS_EHCI] = { 0x2c0, BIT(26) }, 7348c2ecf20Sopenharmony_ci [RST_BUS_OHCI] = { 0x2c0, BIT(29) }, 7358c2ecf20Sopenharmony_ci 7368c2ecf20Sopenharmony_ci [RST_BUS_VE] = { 0x2c4, BIT(0) }, 7378c2ecf20Sopenharmony_ci [RST_BUS_LCD] = { 0x2c4, BIT(4) }, 7388c2ecf20Sopenharmony_ci [RST_BUS_CSI] = { 0x2c4, BIT(8) }, 7398c2ecf20Sopenharmony_ci [RST_BUS_DE_BE] = { 0x2c4, BIT(12) }, 7408c2ecf20Sopenharmony_ci [RST_BUS_DE_FE] = { 0x2c4, BIT(14) }, 7418c2ecf20Sopenharmony_ci [RST_BUS_GPU] = { 0x2c4, BIT(20) }, 7428c2ecf20Sopenharmony_ci [RST_BUS_MSGBOX] = { 0x2c4, BIT(21) }, 7438c2ecf20Sopenharmony_ci [RST_BUS_SPINLOCK] = { 0x2c4, BIT(22) }, 7448c2ecf20Sopenharmony_ci [RST_BUS_DRC] = { 0x2c4, BIT(25) }, 7458c2ecf20Sopenharmony_ci [RST_BUS_SAT] = { 0x2c4, BIT(26) }, 7468c2ecf20Sopenharmony_ci 7478c2ecf20Sopenharmony_ci [RST_BUS_LVDS] = { 0x2c8, BIT(0) }, 7488c2ecf20Sopenharmony_ci 7498c2ecf20Sopenharmony_ci [RST_BUS_CODEC] = { 0x2d0, BIT(0) }, 7508c2ecf20Sopenharmony_ci [RST_BUS_I2S0] = { 0x2d0, BIT(12) }, 7518c2ecf20Sopenharmony_ci [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, 7528c2ecf20Sopenharmony_ci 7538c2ecf20Sopenharmony_ci [RST_BUS_I2C0] = { 0x2d8, BIT(0) }, 7548c2ecf20Sopenharmony_ci [RST_BUS_I2C1] = { 0x2d8, BIT(1) }, 7558c2ecf20Sopenharmony_ci [RST_BUS_I2C2] = { 0x2d8, BIT(2) }, 7568c2ecf20Sopenharmony_ci [RST_BUS_UART0] = { 0x2d8, BIT(16) }, 7578c2ecf20Sopenharmony_ci [RST_BUS_UART1] = { 0x2d8, BIT(17) }, 7588c2ecf20Sopenharmony_ci [RST_BUS_UART2] = { 0x2d8, BIT(18) }, 7598c2ecf20Sopenharmony_ci [RST_BUS_UART3] = { 0x2d8, BIT(19) }, 7608c2ecf20Sopenharmony_ci [RST_BUS_UART4] = { 0x2d8, BIT(20) }, 7618c2ecf20Sopenharmony_ci}; 7628c2ecf20Sopenharmony_ci 7638c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun8i_a33_ccu_desc = { 7648c2ecf20Sopenharmony_ci .ccu_clks = sun8i_a33_ccu_clks, 7658c2ecf20Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun8i_a33_ccu_clks), 7668c2ecf20Sopenharmony_ci 7678c2ecf20Sopenharmony_ci .hw_clks = &sun8i_a33_hw_clks, 7688c2ecf20Sopenharmony_ci 7698c2ecf20Sopenharmony_ci .resets = sun8i_a33_ccu_resets, 7708c2ecf20Sopenharmony_ci .num_resets = ARRAY_SIZE(sun8i_a33_ccu_resets), 7718c2ecf20Sopenharmony_ci}; 7728c2ecf20Sopenharmony_ci 7738c2ecf20Sopenharmony_cistatic struct ccu_pll_nb sun8i_a33_pll_cpu_nb = { 7748c2ecf20Sopenharmony_ci .common = &pll_cpux_clk.common, 7758c2ecf20Sopenharmony_ci /* copy from pll_cpux_clk */ 7768c2ecf20Sopenharmony_ci .enable = BIT(31), 7778c2ecf20Sopenharmony_ci .lock = BIT(28), 7788c2ecf20Sopenharmony_ci}; 7798c2ecf20Sopenharmony_ci 7808c2ecf20Sopenharmony_cistatic struct ccu_mux_nb sun8i_a33_cpu_nb = { 7818c2ecf20Sopenharmony_ci .common = &cpux_clk.common, 7828c2ecf20Sopenharmony_ci .cm = &cpux_clk.mux, 7838c2ecf20Sopenharmony_ci .delay_us = 1, /* > 8 clock cycles at 24 MHz */ 7848c2ecf20Sopenharmony_ci .bypass_index = 1, /* index of 24 MHz oscillator */ 7858c2ecf20Sopenharmony_ci}; 7868c2ecf20Sopenharmony_ci 7878c2ecf20Sopenharmony_cistatic void __init sun8i_a33_ccu_setup(struct device_node *node) 7888c2ecf20Sopenharmony_ci{ 7898c2ecf20Sopenharmony_ci void __iomem *reg; 7908c2ecf20Sopenharmony_ci u32 val; 7918c2ecf20Sopenharmony_ci 7928c2ecf20Sopenharmony_ci reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 7938c2ecf20Sopenharmony_ci if (IS_ERR(reg)) { 7948c2ecf20Sopenharmony_ci pr_err("%pOF: Could not map the clock registers\n", node); 7958c2ecf20Sopenharmony_ci return; 7968c2ecf20Sopenharmony_ci } 7978c2ecf20Sopenharmony_ci 7988c2ecf20Sopenharmony_ci /* Force the PLL-Audio-1x divider to 1 */ 7998c2ecf20Sopenharmony_ci val = readl(reg + SUN8I_A33_PLL_AUDIO_REG); 8008c2ecf20Sopenharmony_ci val &= ~GENMASK(19, 16); 8018c2ecf20Sopenharmony_ci writel(val | (0 << 16), reg + SUN8I_A33_PLL_AUDIO_REG); 8028c2ecf20Sopenharmony_ci 8038c2ecf20Sopenharmony_ci /* Force PLL-MIPI to MIPI mode */ 8048c2ecf20Sopenharmony_ci val = readl(reg + SUN8I_A33_PLL_MIPI_REG); 8058c2ecf20Sopenharmony_ci val &= ~BIT(16); 8068c2ecf20Sopenharmony_ci writel(val, reg + SUN8I_A33_PLL_MIPI_REG); 8078c2ecf20Sopenharmony_ci 8088c2ecf20Sopenharmony_ci sunxi_ccu_probe(node, reg, &sun8i_a33_ccu_desc); 8098c2ecf20Sopenharmony_ci 8108c2ecf20Sopenharmony_ci /* Gate then ungate PLL CPU after any rate changes */ 8118c2ecf20Sopenharmony_ci ccu_pll_notifier_register(&sun8i_a33_pll_cpu_nb); 8128c2ecf20Sopenharmony_ci 8138c2ecf20Sopenharmony_ci /* Reparent CPU during PLL CPU rate changes */ 8148c2ecf20Sopenharmony_ci ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, 8158c2ecf20Sopenharmony_ci &sun8i_a33_cpu_nb); 8168c2ecf20Sopenharmony_ci} 8178c2ecf20Sopenharmony_ciCLK_OF_DECLARE(sun8i_a33_ccu, "allwinner,sun8i-a33-ccu", 8188c2ecf20Sopenharmony_ci sun8i_a33_ccu_setup); 819