162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2016 Chen-Yu Tsai 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Chen-Yu Tsai <wens@csie.org> 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Based on ccu-sun8i-h3.c by Maxime Ripard. 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#include <linux/clk-provider.h> 1162306a36Sopenharmony_ci#include <linux/io.h> 1262306a36Sopenharmony_ci#include <linux/module.h> 1362306a36Sopenharmony_ci#include <linux/platform_device.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#include "ccu_common.h" 1662306a36Sopenharmony_ci#include "ccu_reset.h" 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#include "ccu_div.h" 1962306a36Sopenharmony_ci#include "ccu_gate.h" 2062306a36Sopenharmony_ci#include "ccu_mp.h" 2162306a36Sopenharmony_ci#include "ccu_mult.h" 2262306a36Sopenharmony_ci#include "ccu_mux.h" 2362306a36Sopenharmony_ci#include "ccu_nk.h" 2462306a36Sopenharmony_ci#include "ccu_nkm.h" 2562306a36Sopenharmony_ci#include "ccu_nkmp.h" 2662306a36Sopenharmony_ci#include "ccu_nm.h" 2762306a36Sopenharmony_ci#include "ccu_phase.h" 2862306a36Sopenharmony_ci#include "ccu_sdm.h" 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#include "ccu-sun6i-a31.h" 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_cistatic SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_cpu_clk, "pll-cpu", 3362306a36Sopenharmony_ci "osc24M", 0x000, 3462306a36Sopenharmony_ci 8, 5, /* N */ 3562306a36Sopenharmony_ci 4, 2, /* K */ 3662306a36Sopenharmony_ci 0, 2, /* M */ 3762306a36Sopenharmony_ci BIT(31), /* gate */ 3862306a36Sopenharmony_ci BIT(28), /* lock */ 3962306a36Sopenharmony_ci 0); 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci/* 4262306a36Sopenharmony_ci * The Audio PLL is supposed to have 4 outputs: 3 fixed factors from 4362306a36Sopenharmony_ci * the base (2x, 4x and 8x), and one variable divider (the one true 4462306a36Sopenharmony_ci * pll audio). 4562306a36Sopenharmony_ci * 4662306a36Sopenharmony_ci * With sigma-delta modulation for fractional-N on the audio PLL, 4762306a36Sopenharmony_ci * we have to use specific dividers. This means the variable divider 4862306a36Sopenharmony_ci * can no longer be used, as the audio codec requests the exact clock 4962306a36Sopenharmony_ci * rates we support through this mechanism. So we now hard code the 5062306a36Sopenharmony_ci * variable divider to 1. This means the clock rates will no longer 5162306a36Sopenharmony_ci * match the clock names. 5262306a36Sopenharmony_ci */ 5362306a36Sopenharmony_ci#define SUN6I_A31_PLL_AUDIO_REG 0x008 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_cistatic struct ccu_sdm_setting pll_audio_sdm_table[] = { 5662306a36Sopenharmony_ci { .rate = 22579200, .pattern = 0xc0010d84, .m = 8, .n = 7 }, 5762306a36Sopenharmony_ci { .rate = 24576000, .pattern = 0xc000ac02, .m = 14, .n = 14 }, 5862306a36Sopenharmony_ci}; 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", 6162306a36Sopenharmony_ci "osc24M", 0x008, 6262306a36Sopenharmony_ci 8, 7, /* N */ 6362306a36Sopenharmony_ci 0, 5, /* M */ 6462306a36Sopenharmony_ci pll_audio_sdm_table, BIT(24), 6562306a36Sopenharmony_ci 0x284, BIT(31), 6662306a36Sopenharmony_ci BIT(31), /* gate */ 6762306a36Sopenharmony_ci BIT(28), /* lock */ 6862306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video0_clk, "pll-video0", 7162306a36Sopenharmony_ci "osc24M", 0x010, 7262306a36Sopenharmony_ci 8, 7, /* N */ 7362306a36Sopenharmony_ci 0, 4, /* M */ 7462306a36Sopenharmony_ci BIT(24), /* frac enable */ 7562306a36Sopenharmony_ci BIT(25), /* frac select */ 7662306a36Sopenharmony_ci 270000000, /* frac rate 0 */ 7762306a36Sopenharmony_ci 297000000, /* frac rate 1 */ 7862306a36Sopenharmony_ci BIT(31), /* gate */ 7962306a36Sopenharmony_ci BIT(28), /* lock */ 8062306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", 8362306a36Sopenharmony_ci "osc24M", 0x018, 8462306a36Sopenharmony_ci 8, 7, /* N */ 8562306a36Sopenharmony_ci 0, 4, /* M */ 8662306a36Sopenharmony_ci BIT(24), /* frac enable */ 8762306a36Sopenharmony_ci BIT(25), /* frac select */ 8862306a36Sopenharmony_ci 270000000, /* frac rate 0 */ 8962306a36Sopenharmony_ci 297000000, /* frac rate 1 */ 9062306a36Sopenharmony_ci BIT(31), /* gate */ 9162306a36Sopenharmony_ci BIT(28), /* lock */ 9262306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_cistatic SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr_clk, "pll-ddr", 9562306a36Sopenharmony_ci "osc24M", 0x020, 9662306a36Sopenharmony_ci 8, 5, /* N */ 9762306a36Sopenharmony_ci 4, 2, /* K */ 9862306a36Sopenharmony_ci 0, 2, /* M */ 9962306a36Sopenharmony_ci BIT(31), /* gate */ 10062306a36Sopenharmony_ci BIT(28), /* lock */ 10162306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_cistatic SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph_clk, "pll-periph", 10462306a36Sopenharmony_ci "osc24M", 0x028, 10562306a36Sopenharmony_ci 8, 5, /* N */ 10662306a36Sopenharmony_ci 4, 2, /* K */ 10762306a36Sopenharmony_ci BIT(31), /* gate */ 10862306a36Sopenharmony_ci BIT(28), /* lock */ 10962306a36Sopenharmony_ci 2, /* post-div */ 11062306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video1_clk, "pll-video1", 11362306a36Sopenharmony_ci "osc24M", 0x030, 11462306a36Sopenharmony_ci 8, 7, /* N */ 11562306a36Sopenharmony_ci 0, 4, /* M */ 11662306a36Sopenharmony_ci BIT(24), /* frac enable */ 11762306a36Sopenharmony_ci BIT(25), /* frac select */ 11862306a36Sopenharmony_ci 270000000, /* frac rate 0 */ 11962306a36Sopenharmony_ci 297000000, /* frac rate 1 */ 12062306a36Sopenharmony_ci BIT(31), /* gate */ 12162306a36Sopenharmony_ci BIT(28), /* lock */ 12262306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_gpu_clk, "pll-gpu", 12562306a36Sopenharmony_ci "osc24M", 0x038, 12662306a36Sopenharmony_ci 8, 7, /* N */ 12762306a36Sopenharmony_ci 0, 4, /* M */ 12862306a36Sopenharmony_ci BIT(24), /* frac enable */ 12962306a36Sopenharmony_ci BIT(25), /* frac select */ 13062306a36Sopenharmony_ci 270000000, /* frac rate 0 */ 13162306a36Sopenharmony_ci 297000000, /* frac rate 1 */ 13262306a36Sopenharmony_ci BIT(31), /* gate */ 13362306a36Sopenharmony_ci BIT(28), /* lock */ 13462306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci/* 13762306a36Sopenharmony_ci * The MIPI PLL has 2 modes: "MIPI" and "HDMI". 13862306a36Sopenharmony_ci * 13962306a36Sopenharmony_ci * The MIPI mode is a standard NKM-style clock. The HDMI mode is an 14062306a36Sopenharmony_ci * integer / fractional clock with switchable multipliers and dividers. 14162306a36Sopenharmony_ci * This is not supported here. We hardcode the PLL to MIPI mode. 14262306a36Sopenharmony_ci */ 14362306a36Sopenharmony_ci#define SUN6I_A31_PLL_MIPI_REG 0x040 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_cistatic const char * const pll_mipi_parents[] = { "pll-video0", "pll-video1" }; 14662306a36Sopenharmony_cistatic SUNXI_CCU_NKM_WITH_MUX_GATE_LOCK(pll_mipi_clk, "pll-mipi", 14762306a36Sopenharmony_ci pll_mipi_parents, 0x040, 14862306a36Sopenharmony_ci 8, 4, /* N */ 14962306a36Sopenharmony_ci 4, 2, /* K */ 15062306a36Sopenharmony_ci 0, 4, /* M */ 15162306a36Sopenharmony_ci 21, 0, /* mux */ 15262306a36Sopenharmony_ci BIT(31) | BIT(23) | BIT(22), /* gate */ 15362306a36Sopenharmony_ci BIT(28), /* lock */ 15462306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll9_clk, "pll9", 15762306a36Sopenharmony_ci "osc24M", 0x044, 15862306a36Sopenharmony_ci 8, 7, /* N */ 15962306a36Sopenharmony_ci 0, 4, /* M */ 16062306a36Sopenharmony_ci BIT(24), /* frac enable */ 16162306a36Sopenharmony_ci BIT(25), /* frac select */ 16262306a36Sopenharmony_ci 270000000, /* frac rate 0 */ 16362306a36Sopenharmony_ci 297000000, /* frac rate 1 */ 16462306a36Sopenharmony_ci BIT(31), /* gate */ 16562306a36Sopenharmony_ci BIT(28), /* lock */ 16662306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll10_clk, "pll10", 16962306a36Sopenharmony_ci "osc24M", 0x048, 17062306a36Sopenharmony_ci 8, 7, /* N */ 17162306a36Sopenharmony_ci 0, 4, /* M */ 17262306a36Sopenharmony_ci BIT(24), /* frac enable */ 17362306a36Sopenharmony_ci BIT(25), /* frac select */ 17462306a36Sopenharmony_ci 270000000, /* frac rate 0 */ 17562306a36Sopenharmony_ci 297000000, /* frac rate 1 */ 17662306a36Sopenharmony_ci BIT(31), /* gate */ 17762306a36Sopenharmony_ci BIT(28), /* lock */ 17862306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_cistatic const char * const cpux_parents[] = { "osc32k", "osc24M", 18162306a36Sopenharmony_ci "pll-cpu", "pll-cpu" }; 18262306a36Sopenharmony_cistatic SUNXI_CCU_MUX(cpu_clk, "cpu", cpux_parents, 18362306a36Sopenharmony_ci 0x050, 16, 2, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_cistatic struct clk_div_table axi_div_table[] = { 18662306a36Sopenharmony_ci { .val = 0, .div = 1 }, 18762306a36Sopenharmony_ci { .val = 1, .div = 2 }, 18862306a36Sopenharmony_ci { .val = 2, .div = 3 }, 18962306a36Sopenharmony_ci { .val = 3, .div = 4 }, 19062306a36Sopenharmony_ci { .val = 4, .div = 4 }, 19162306a36Sopenharmony_ci { .val = 5, .div = 4 }, 19262306a36Sopenharmony_ci { .val = 6, .div = 4 }, 19362306a36Sopenharmony_ci { .val = 7, .div = 4 }, 19462306a36Sopenharmony_ci { /* Sentinel */ }, 19562306a36Sopenharmony_ci}; 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(axi_clk, "axi", "cpu", 19862306a36Sopenharmony_ci 0x050, 0, 3, axi_div_table, 0); 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci#define SUN6I_A31_AHB1_REG 0x054 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_cistatic const char * const ahb1_parents[] = { "osc32k", "osc24M", 20362306a36Sopenharmony_ci "axi", "pll-periph" }; 20462306a36Sopenharmony_cistatic const struct ccu_mux_var_prediv ahb1_predivs[] = { 20562306a36Sopenharmony_ci { .index = 3, .shift = 6, .width = 2 }, 20662306a36Sopenharmony_ci}; 20762306a36Sopenharmony_ci 20862306a36Sopenharmony_cistatic struct ccu_div ahb1_clk = { 20962306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO), 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci .mux = { 21262306a36Sopenharmony_ci .shift = 12, 21362306a36Sopenharmony_ci .width = 2, 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci .var_predivs = ahb1_predivs, 21662306a36Sopenharmony_ci .n_var_predivs = ARRAY_SIZE(ahb1_predivs), 21762306a36Sopenharmony_ci }, 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci .common = { 22062306a36Sopenharmony_ci .reg = 0x054, 22162306a36Sopenharmony_ci .features = CCU_FEATURE_VARIABLE_PREDIV, 22262306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb1", 22362306a36Sopenharmony_ci ahb1_parents, 22462306a36Sopenharmony_ci &ccu_div_ops, 22562306a36Sopenharmony_ci 0), 22662306a36Sopenharmony_ci }, 22762306a36Sopenharmony_ci}; 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_cistatic struct clk_div_table apb1_div_table[] = { 23062306a36Sopenharmony_ci { .val = 0, .div = 2 }, 23162306a36Sopenharmony_ci { .val = 1, .div = 2 }, 23262306a36Sopenharmony_ci { .val = 2, .div = 4 }, 23362306a36Sopenharmony_ci { .val = 3, .div = 8 }, 23462306a36Sopenharmony_ci { /* Sentinel */ }, 23562306a36Sopenharmony_ci}; 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(apb1_clk, "apb1", "ahb1", 23862306a36Sopenharmony_ci 0x054, 8, 2, apb1_div_table, 0); 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_cistatic const char * const apb2_parents[] = { "osc32k", "osc24M", 24162306a36Sopenharmony_ci "pll-periph", "pll-periph" }; 24262306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", apb2_parents, 0x058, 24362306a36Sopenharmony_ci 0, 5, /* M */ 24462306a36Sopenharmony_ci 16, 2, /* P */ 24562306a36Sopenharmony_ci 24, 2, /* mux */ 24662306a36Sopenharmony_ci 0); 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mipidsi_clk, "ahb1-mipidsi", "ahb1", 24962306a36Sopenharmony_ci 0x060, BIT(1), 0); 25062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ss_clk, "ahb1-ss", "ahb1", 25162306a36Sopenharmony_ci 0x060, BIT(5), 0); 25262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_dma_clk, "ahb1-dma", "ahb1", 25362306a36Sopenharmony_ci 0x060, BIT(6), 0); 25462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mmc0_clk, "ahb1-mmc0", "ahb1", 25562306a36Sopenharmony_ci 0x060, BIT(8), 0); 25662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mmc1_clk, "ahb1-mmc1", "ahb1", 25762306a36Sopenharmony_ci 0x060, BIT(9), 0); 25862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mmc2_clk, "ahb1-mmc2", "ahb1", 25962306a36Sopenharmony_ci 0x060, BIT(10), 0); 26062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mmc3_clk, "ahb1-mmc3", "ahb1", 26162306a36Sopenharmony_ci 0x060, BIT(11), 0); 26262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_nand1_clk, "ahb1-nand1", "ahb1", 26362306a36Sopenharmony_ci 0x060, BIT(12), 0); 26462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_nand0_clk, "ahb1-nand0", "ahb1", 26562306a36Sopenharmony_ci 0x060, BIT(13), 0); 26662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_sdram_clk, "ahb1-sdram", "ahb1", 26762306a36Sopenharmony_ci 0x060, BIT(14), 0); 26862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_emac_clk, "ahb1-emac", "ahb1", 26962306a36Sopenharmony_ci 0x060, BIT(17), 0); 27062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ts_clk, "ahb1-ts", "ahb1", 27162306a36Sopenharmony_ci 0x060, BIT(18), 0); 27262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_hstimer_clk, "ahb1-hstimer", "ahb1", 27362306a36Sopenharmony_ci 0x060, BIT(19), 0); 27462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_spi0_clk, "ahb1-spi0", "ahb1", 27562306a36Sopenharmony_ci 0x060, BIT(20), 0); 27662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_spi1_clk, "ahb1-spi1", "ahb1", 27762306a36Sopenharmony_ci 0x060, BIT(21), 0); 27862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_spi2_clk, "ahb1-spi2", "ahb1", 27962306a36Sopenharmony_ci 0x060, BIT(22), 0); 28062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_spi3_clk, "ahb1-spi3", "ahb1", 28162306a36Sopenharmony_ci 0x060, BIT(23), 0); 28262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_otg_clk, "ahb1-otg", "ahb1", 28362306a36Sopenharmony_ci 0x060, BIT(24), 0); 28462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ehci0_clk, "ahb1-ehci0", "ahb1", 28562306a36Sopenharmony_ci 0x060, BIT(26), 0); 28662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ehci1_clk, "ahb1-ehci1", "ahb1", 28762306a36Sopenharmony_ci 0x060, BIT(27), 0); 28862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ohci0_clk, "ahb1-ohci0", "ahb1", 28962306a36Sopenharmony_ci 0x060, BIT(29), 0); 29062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ohci1_clk, "ahb1-ohci1", "ahb1", 29162306a36Sopenharmony_ci 0x060, BIT(30), 0); 29262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ohci2_clk, "ahb1-ohci2", "ahb1", 29362306a36Sopenharmony_ci 0x060, BIT(31), 0); 29462306a36Sopenharmony_ci 29562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_ve_clk, "ahb1-ve", "ahb1", 29662306a36Sopenharmony_ci 0x064, BIT(0), 0); 29762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_lcd0_clk, "ahb1-lcd0", "ahb1", 29862306a36Sopenharmony_ci 0x064, BIT(4), 0); 29962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_lcd1_clk, "ahb1-lcd1", "ahb1", 30062306a36Sopenharmony_ci 0x064, BIT(5), 0); 30162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_csi_clk, "ahb1-csi", "ahb1", 30262306a36Sopenharmony_ci 0x064, BIT(8), 0); 30362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_hdmi_clk, "ahb1-hdmi", "ahb1", 30462306a36Sopenharmony_ci 0x064, BIT(11), 0); 30562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_be0_clk, "ahb1-be0", "ahb1", 30662306a36Sopenharmony_ci 0x064, BIT(12), 0); 30762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_be1_clk, "ahb1-be1", "ahb1", 30862306a36Sopenharmony_ci 0x064, BIT(13), 0); 30962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_fe0_clk, "ahb1-fe0", "ahb1", 31062306a36Sopenharmony_ci 0x064, BIT(14), 0); 31162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_fe1_clk, "ahb1-fe1", "ahb1", 31262306a36Sopenharmony_ci 0x064, BIT(15), 0); 31362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_mp_clk, "ahb1-mp", "ahb1", 31462306a36Sopenharmony_ci 0x064, BIT(18), 0); 31562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_gpu_clk, "ahb1-gpu", "ahb1", 31662306a36Sopenharmony_ci 0x064, BIT(20), 0); 31762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_deu0_clk, "ahb1-deu0", "ahb1", 31862306a36Sopenharmony_ci 0x064, BIT(23), 0); 31962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_deu1_clk, "ahb1-deu1", "ahb1", 32062306a36Sopenharmony_ci 0x064, BIT(24), 0); 32162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_drc0_clk, "ahb1-drc0", "ahb1", 32262306a36Sopenharmony_ci 0x064, BIT(25), 0); 32362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ahb1_drc1_clk, "ahb1-drc1", "ahb1", 32462306a36Sopenharmony_ci 0x064, BIT(26), 0); 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_codec_clk, "apb1-codec", "apb1", 32762306a36Sopenharmony_ci 0x068, BIT(0), 0); 32862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_spdif_clk, "apb1-spdif", "apb1", 32962306a36Sopenharmony_ci 0x068, BIT(1), 0); 33062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_digital_mic_clk, "apb1-digital-mic", "apb1", 33162306a36Sopenharmony_ci 0x068, BIT(4), 0); 33262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_pio_clk, "apb1-pio", "apb1", 33362306a36Sopenharmony_ci 0x068, BIT(5), 0); 33462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_daudio0_clk, "apb1-daudio0", "apb1", 33562306a36Sopenharmony_ci 0x068, BIT(12), 0); 33662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_daudio1_clk, "apb1-daudio1", "apb1", 33762306a36Sopenharmony_ci 0x068, BIT(13), 0); 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_i2c0_clk, "apb2-i2c0", "apb2", 34062306a36Sopenharmony_ci 0x06c, BIT(0), 0); 34162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_i2c1_clk, "apb2-i2c1", "apb2", 34262306a36Sopenharmony_ci 0x06c, BIT(1), 0); 34362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_i2c2_clk, "apb2-i2c2", "apb2", 34462306a36Sopenharmony_ci 0x06c, BIT(2), 0); 34562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_i2c3_clk, "apb2-i2c3", "apb2", 34662306a36Sopenharmony_ci 0x06c, BIT(3), 0); 34762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart0_clk, "apb2-uart0", "apb2", 34862306a36Sopenharmony_ci 0x06c, BIT(16), 0); 34962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart1_clk, "apb2-uart1", "apb2", 35062306a36Sopenharmony_ci 0x06c, BIT(17), 0); 35162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart2_clk, "apb2-uart2", "apb2", 35262306a36Sopenharmony_ci 0x06c, BIT(18), 0); 35362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart3_clk, "apb2-uart3", "apb2", 35462306a36Sopenharmony_ci 0x06c, BIT(19), 0); 35562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart4_clk, "apb2-uart4", "apb2", 35662306a36Sopenharmony_ci 0x06c, BIT(20), 0); 35762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(apb2_uart5_clk, "apb2-uart5", "apb2", 35862306a36Sopenharmony_ci 0x06c, BIT(21), 0); 35962306a36Sopenharmony_ci 36062306a36Sopenharmony_cistatic const char * const mod0_default_parents[] = { "osc24M", "pll-periph" }; 36162306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand0_clk, "nand0", mod0_default_parents, 36262306a36Sopenharmony_ci 0x080, 36362306a36Sopenharmony_ci 0, 4, /* M */ 36462306a36Sopenharmony_ci 16, 2, /* P */ 36562306a36Sopenharmony_ci 24, 2, /* mux */ 36662306a36Sopenharmony_ci BIT(31), /* gate */ 36762306a36Sopenharmony_ci 0); 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand1_clk, "nand1", mod0_default_parents, 37062306a36Sopenharmony_ci 0x084, 37162306a36Sopenharmony_ci 0, 4, /* M */ 37262306a36Sopenharmony_ci 16, 2, /* P */ 37362306a36Sopenharmony_ci 24, 2, /* mux */ 37462306a36Sopenharmony_ci BIT(31), /* gate */ 37562306a36Sopenharmony_ci 0); 37662306a36Sopenharmony_ci 37762306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 37862306a36Sopenharmony_ci 0x088, 37962306a36Sopenharmony_ci 0, 4, /* M */ 38062306a36Sopenharmony_ci 16, 2, /* P */ 38162306a36Sopenharmony_ci 24, 2, /* mux */ 38262306a36Sopenharmony_ci BIT(31), /* gate */ 38362306a36Sopenharmony_ci 0); 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_sample_clk, "mmc0_sample", "mmc0", 38662306a36Sopenharmony_ci 0x088, 20, 3, 0); 38762306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_output_clk, "mmc0_output", "mmc0", 38862306a36Sopenharmony_ci 0x088, 8, 3, 0); 38962306a36Sopenharmony_ci 39062306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 39162306a36Sopenharmony_ci 0x08c, 39262306a36Sopenharmony_ci 0, 4, /* M */ 39362306a36Sopenharmony_ci 16, 2, /* P */ 39462306a36Sopenharmony_ci 24, 2, /* mux */ 39562306a36Sopenharmony_ci BIT(31), /* gate */ 39662306a36Sopenharmony_ci 0); 39762306a36Sopenharmony_ci 39862306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1_sample", "mmc1", 39962306a36Sopenharmony_ci 0x08c, 20, 3, 0); 40062306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1_output", "mmc1", 40162306a36Sopenharmony_ci 0x08c, 8, 3, 0); 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 40462306a36Sopenharmony_ci 0x090, 40562306a36Sopenharmony_ci 0, 4, /* M */ 40662306a36Sopenharmony_ci 16, 2, /* P */ 40762306a36Sopenharmony_ci 24, 2, /* mux */ 40862306a36Sopenharmony_ci BIT(31), /* gate */ 40962306a36Sopenharmony_ci 0); 41062306a36Sopenharmony_ci 41162306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2_sample", "mmc2", 41262306a36Sopenharmony_ci 0x090, 20, 3, 0); 41362306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_output_clk, "mmc2_output", "mmc2", 41462306a36Sopenharmony_ci 0x090, 8, 3, 0); 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc3_clk, "mmc3", mod0_default_parents, 41762306a36Sopenharmony_ci 0x094, 41862306a36Sopenharmony_ci 0, 4, /* M */ 41962306a36Sopenharmony_ci 16, 2, /* P */ 42062306a36Sopenharmony_ci 24, 2, /* mux */ 42162306a36Sopenharmony_ci BIT(31), /* gate */ 42262306a36Sopenharmony_ci 0); 42362306a36Sopenharmony_ci 42462306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc3_sample_clk, "mmc3_sample", "mmc3", 42562306a36Sopenharmony_ci 0x094, 20, 3, 0); 42662306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc3_output_clk, "mmc3_output", "mmc3", 42762306a36Sopenharmony_ci 0x094, 8, 3, 0); 42862306a36Sopenharmony_ci 42962306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ts_clk, "ts", mod0_default_parents, 0x098, 43062306a36Sopenharmony_ci 0, 4, /* M */ 43162306a36Sopenharmony_ci 16, 2, /* P */ 43262306a36Sopenharmony_ci 24, 2, /* mux */ 43362306a36Sopenharmony_ci BIT(31), /* gate */ 43462306a36Sopenharmony_ci 0); 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ss_clk, "ss", mod0_default_parents, 0x09c, 43762306a36Sopenharmony_ci 0, 4, /* M */ 43862306a36Sopenharmony_ci 16, 2, /* P */ 43962306a36Sopenharmony_ci 24, 2, /* mux */ 44062306a36Sopenharmony_ci BIT(31), /* gate */ 44162306a36Sopenharmony_ci 0); 44262306a36Sopenharmony_ci 44362306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 0x0a0, 44462306a36Sopenharmony_ci 0, 4, /* M */ 44562306a36Sopenharmony_ci 16, 2, /* P */ 44662306a36Sopenharmony_ci 24, 2, /* mux */ 44762306a36Sopenharmony_ci BIT(31), /* gate */ 44862306a36Sopenharmony_ci 0); 44962306a36Sopenharmony_ci 45062306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 0x0a4, 45162306a36Sopenharmony_ci 0, 4, /* M */ 45262306a36Sopenharmony_ci 16, 2, /* P */ 45362306a36Sopenharmony_ci 24, 2, /* mux */ 45462306a36Sopenharmony_ci BIT(31), /* gate */ 45562306a36Sopenharmony_ci 0); 45662306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi2_clk, "spi2", mod0_default_parents, 0x0a8, 45762306a36Sopenharmony_ci 0, 4, /* M */ 45862306a36Sopenharmony_ci 16, 2, /* P */ 45962306a36Sopenharmony_ci 24, 2, /* mux */ 46062306a36Sopenharmony_ci BIT(31), /* gate */ 46162306a36Sopenharmony_ci 0); 46262306a36Sopenharmony_ci 46362306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi3_clk, "spi3", mod0_default_parents, 0x0ac, 46462306a36Sopenharmony_ci 0, 4, /* M */ 46562306a36Sopenharmony_ci 16, 2, /* P */ 46662306a36Sopenharmony_ci 24, 2, /* mux */ 46762306a36Sopenharmony_ci BIT(31), /* gate */ 46862306a36Sopenharmony_ci 0); 46962306a36Sopenharmony_ci 47062306a36Sopenharmony_cistatic const char * const daudio_parents[] = { "pll-audio-8x", "pll-audio-4x", 47162306a36Sopenharmony_ci "pll-audio-2x", "pll-audio" }; 47262306a36Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(daudio0_clk, "daudio0", daudio_parents, 47362306a36Sopenharmony_ci 0x0b0, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 47462306a36Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(daudio1_clk, "daudio1", daudio_parents, 47562306a36Sopenharmony_ci 0x0b4, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 47662306a36Sopenharmony_ci 47762306a36Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(spdif_clk, "spdif", daudio_parents, 47862306a36Sopenharmony_ci 0x0c0, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 47962306a36Sopenharmony_ci 48062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M", 48162306a36Sopenharmony_ci 0x0cc, BIT(8), 0); 48262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "osc24M", 48362306a36Sopenharmony_ci 0x0cc, BIT(9), 0); 48462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy2_clk, "usb-phy2", "osc24M", 48562306a36Sopenharmony_ci 0x0cc, BIT(10), 0); 48662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc24M", 48762306a36Sopenharmony_ci 0x0cc, BIT(16), 0); 48862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci1_clk, "usb-ohci1", "osc24M", 48962306a36Sopenharmony_ci 0x0cc, BIT(17), 0); 49062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci2_clk, "usb-ohci2", "osc24M", 49162306a36Sopenharmony_ci 0x0cc, BIT(18), 0); 49262306a36Sopenharmony_ci 49362306a36Sopenharmony_ci/* TODO emac clk not supported yet */ 49462306a36Sopenharmony_ci 49562306a36Sopenharmony_cistatic const char * const dram_parents[] = { "pll-ddr", "pll-periph" }; 49662306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mdfs_clk, "mdfs", dram_parents, 0x0f0, 49762306a36Sopenharmony_ci 0, 4, /* M */ 49862306a36Sopenharmony_ci 16, 2, /* P */ 49962306a36Sopenharmony_ci 24, 2, /* mux */ 50062306a36Sopenharmony_ci BIT(31), /* gate */ 50162306a36Sopenharmony_ci CLK_IS_CRITICAL); 50262306a36Sopenharmony_ci 50362306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX(sdram0_clk, "sdram0", dram_parents, 50462306a36Sopenharmony_ci 0x0f4, 0, 4, 4, 1, CLK_IS_CRITICAL); 50562306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX(sdram1_clk, "sdram1", dram_parents, 50662306a36Sopenharmony_ci 0x0f4, 8, 4, 12, 1, CLK_IS_CRITICAL); 50762306a36Sopenharmony_ci 50862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ve_clk, "dram-ve", "mdfs", 50962306a36Sopenharmony_ci 0x100, BIT(0), 0); 51062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_csi_isp_clk, "dram-csi-isp", "mdfs", 51162306a36Sopenharmony_ci 0x100, BIT(1), 0); 51262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ts_clk, "dram-ts", "mdfs", 51362306a36Sopenharmony_ci 0x100, BIT(3), 0); 51462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_drc0_clk, "dram-drc0", "mdfs", 51562306a36Sopenharmony_ci 0x100, BIT(16), 0); 51662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_drc1_clk, "dram-drc1", "mdfs", 51762306a36Sopenharmony_ci 0x100, BIT(17), 0); 51862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_deu0_clk, "dram-deu0", "mdfs", 51962306a36Sopenharmony_ci 0x100, BIT(18), 0); 52062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_deu1_clk, "dram-deu1", "mdfs", 52162306a36Sopenharmony_ci 0x100, BIT(19), 0); 52262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_fe0_clk, "dram-fe0", "mdfs", 52362306a36Sopenharmony_ci 0x100, BIT(24), 0); 52462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_fe1_clk, "dram-fe1", "mdfs", 52562306a36Sopenharmony_ci 0x100, BIT(25), 0); 52662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_be0_clk, "dram-be0", "mdfs", 52762306a36Sopenharmony_ci 0x100, BIT(26), 0); 52862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_be1_clk, "dram-be1", "mdfs", 52962306a36Sopenharmony_ci 0x100, BIT(27), 0); 53062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_mp_clk, "dram-mp", "mdfs", 53162306a36Sopenharmony_ci 0x100, BIT(28), 0); 53262306a36Sopenharmony_ci 53362306a36Sopenharmony_cistatic const char * const de_parents[] = { "pll-video0", "pll-video1", 53462306a36Sopenharmony_ci "pll-periph-2x", "pll-gpu", 53562306a36Sopenharmony_ci "pll9", "pll10" }; 53662306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(be0_clk, "be0", de_parents, 53762306a36Sopenharmony_ci 0x104, 0, 4, 24, 3, BIT(31), 0); 53862306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(be1_clk, "be1", de_parents, 53962306a36Sopenharmony_ci 0x108, 0, 4, 24, 3, BIT(31), 0); 54062306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(fe0_clk, "fe0", de_parents, 54162306a36Sopenharmony_ci 0x10c, 0, 4, 24, 3, BIT(31), 0); 54262306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(fe1_clk, "fe1", de_parents, 54362306a36Sopenharmony_ci 0x110, 0, 4, 24, 3, BIT(31), 0); 54462306a36Sopenharmony_ci 54562306a36Sopenharmony_cistatic const char * const mp_parents[] = { "pll-video0", "pll-video1", 54662306a36Sopenharmony_ci "pll9", "pll10" }; 54762306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mp_clk, "mp", mp_parents, 54862306a36Sopenharmony_ci 0x114, 0, 4, 24, 3, BIT(31), 0); 54962306a36Sopenharmony_ci 55062306a36Sopenharmony_cistatic const char * const lcd_ch0_parents[] = { "pll-video0", "pll-video1", 55162306a36Sopenharmony_ci "pll-video0-2x", 55262306a36Sopenharmony_ci "pll-video1-2x", "pll-mipi" }; 55362306a36Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(lcd0_ch0_clk, "lcd0-ch0", lcd_ch0_parents, 55462306a36Sopenharmony_ci 0x118, 24, 2, BIT(31), CLK_SET_RATE_PARENT); 55562306a36Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(lcd1_ch0_clk, "lcd1-ch0", lcd_ch0_parents, 55662306a36Sopenharmony_ci 0x11c, 24, 2, BIT(31), CLK_SET_RATE_PARENT); 55762306a36Sopenharmony_ci 55862306a36Sopenharmony_cistatic const char * const lcd_ch1_parents[] = { "pll-video0", "pll-video1", 55962306a36Sopenharmony_ci "pll-video0-2x", 56062306a36Sopenharmony_ci "pll-video1-2x" }; 56162306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(lcd0_ch1_clk, "lcd0-ch1", lcd_ch1_parents, 56262306a36Sopenharmony_ci 0x12c, 0, 4, 24, 3, BIT(31), 56362306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 56462306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(lcd1_ch1_clk, "lcd1-ch1", lcd_ch1_parents, 56562306a36Sopenharmony_ci 0x130, 0, 4, 24, 3, BIT(31), 56662306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 56762306a36Sopenharmony_ci 56862306a36Sopenharmony_cistatic const char * const csi_sclk_parents[] = { "pll-video0", "pll-video1", 56962306a36Sopenharmony_ci "pll9", "pll10", "pll-mipi", 57062306a36Sopenharmony_ci "pll-ve" }; 57162306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi0_sclk_clk, "csi0-sclk", csi_sclk_parents, 57262306a36Sopenharmony_ci 0x134, 16, 4, 24, 3, BIT(31), 0); 57362306a36Sopenharmony_ci 57462306a36Sopenharmony_cistatic const char * const csi_mclk_parents[] = { "pll-video0", "pll-video1", 57562306a36Sopenharmony_ci "osc24M" }; 57662306a36Sopenharmony_cistatic const u8 csi_mclk_table[] = { 0, 1, 5 }; 57762306a36Sopenharmony_cistatic struct ccu_div csi0_mclk_clk = { 57862306a36Sopenharmony_ci .enable = BIT(15), 57962306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV(0, 4), 58062306a36Sopenharmony_ci .mux = _SUNXI_CCU_MUX_TABLE(8, 3, csi_mclk_table), 58162306a36Sopenharmony_ci .common = { 58262306a36Sopenharmony_ci .reg = 0x134, 58362306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("csi0-mclk", 58462306a36Sopenharmony_ci csi_mclk_parents, 58562306a36Sopenharmony_ci &ccu_div_ops, 58662306a36Sopenharmony_ci 0), 58762306a36Sopenharmony_ci }, 58862306a36Sopenharmony_ci}; 58962306a36Sopenharmony_ci 59062306a36Sopenharmony_cistatic struct ccu_div csi1_mclk_clk = { 59162306a36Sopenharmony_ci .enable = BIT(15), 59262306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV(0, 4), 59362306a36Sopenharmony_ci .mux = _SUNXI_CCU_MUX_TABLE(8, 3, csi_mclk_table), 59462306a36Sopenharmony_ci .common = { 59562306a36Sopenharmony_ci .reg = 0x138, 59662306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("csi1-mclk", 59762306a36Sopenharmony_ci csi_mclk_parents, 59862306a36Sopenharmony_ci &ccu_div_ops, 59962306a36Sopenharmony_ci 0), 60062306a36Sopenharmony_ci }, 60162306a36Sopenharmony_ci}; 60262306a36Sopenharmony_ci 60362306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve", 60462306a36Sopenharmony_ci 0x13c, 16, 3, BIT(31), 0); 60562306a36Sopenharmony_ci 60662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(codec_clk, "codec", "pll-audio", 60762306a36Sopenharmony_ci 0x140, BIT(31), CLK_SET_RATE_PARENT); 60862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", 60962306a36Sopenharmony_ci 0x144, BIT(31), 0); 61062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(digital_mic_clk, "digital-mic", "pll-audio", 61162306a36Sopenharmony_ci 0x148, BIT(31), CLK_SET_RATE_PARENT); 61262306a36Sopenharmony_ci 61362306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", lcd_ch1_parents, 61462306a36Sopenharmony_ci 0x150, 0, 4, 24, 2, BIT(31), 61562306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 61662306a36Sopenharmony_ci 61762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(hdmi_ddc_clk, "ddc", "osc24M", 0x150, BIT(30), 0); 61862306a36Sopenharmony_ci 61962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ps_clk, "ps", "lcd1-ch1", 0x140, BIT(31), 0); 62062306a36Sopenharmony_ci 62162306a36Sopenharmony_cistatic const char * const mbus_parents[] = { "osc24M", "pll-periph", 62262306a36Sopenharmony_ci "pll-ddr" }; 62362306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mbus0_clk, "mbus0", mbus_parents, 0x15c, 62462306a36Sopenharmony_ci 0, 3, /* M */ 62562306a36Sopenharmony_ci 16, 2, /* P */ 62662306a36Sopenharmony_ci 24, 2, /* mux */ 62762306a36Sopenharmony_ci BIT(31), /* gate */ 62862306a36Sopenharmony_ci CLK_IS_CRITICAL); 62962306a36Sopenharmony_ci 63062306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mbus1_clk, "mbus1", mbus_parents, 0x160, 63162306a36Sopenharmony_ci 0, 3, /* M */ 63262306a36Sopenharmony_ci 16, 2, /* P */ 63362306a36Sopenharmony_ci 24, 2, /* mux */ 63462306a36Sopenharmony_ci BIT(31), /* gate */ 63562306a36Sopenharmony_ci CLK_IS_CRITICAL); 63662306a36Sopenharmony_ci 63762306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mipi_dsi_clk, "mipi-dsi", lcd_ch1_parents, 63862306a36Sopenharmony_ci 0x168, 16, 3, 24, 2, BIT(31), 63962306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 64062306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mipi_dsi_dphy_clk, "mipi-dsi-dphy", 64162306a36Sopenharmony_ci lcd_ch1_parents, 0x168, 0, 3, 8, 2, 64262306a36Sopenharmony_ci BIT(15), CLK_SET_RATE_PARENT); 64362306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mipi_csi_dphy_clk, "mipi-csi-dphy", 64462306a36Sopenharmony_ci lcd_ch1_parents, 0x16c, 0, 3, 8, 2, 64562306a36Sopenharmony_ci BIT(15), 0); 64662306a36Sopenharmony_ci 64762306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(iep_drc0_clk, "iep-drc0", de_parents, 64862306a36Sopenharmony_ci 0x180, 0, 3, 24, 2, BIT(31), 0); 64962306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(iep_drc1_clk, "iep-drc1", de_parents, 65062306a36Sopenharmony_ci 0x184, 0, 3, 24, 2, BIT(31), 0); 65162306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(iep_deu0_clk, "iep-deu0", de_parents, 65262306a36Sopenharmony_ci 0x188, 0, 3, 24, 2, BIT(31), 0); 65362306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(iep_deu1_clk, "iep-deu1", de_parents, 65462306a36Sopenharmony_ci 0x18c, 0, 3, 24, 2, BIT(31), 0); 65562306a36Sopenharmony_ci 65662306a36Sopenharmony_cistatic const char * const gpu_parents[] = { "pll-gpu", "pll-periph-2x", 65762306a36Sopenharmony_ci "pll-video0", "pll-video1", 65862306a36Sopenharmony_ci "pll9", "pll10" }; 65962306a36Sopenharmony_cistatic const struct ccu_mux_fixed_prediv gpu_predivs[] = { 66062306a36Sopenharmony_ci { .index = 1, .div = 3, }, 66162306a36Sopenharmony_ci}; 66262306a36Sopenharmony_ci 66362306a36Sopenharmony_cistatic struct ccu_div gpu_core_clk = { 66462306a36Sopenharmony_ci .enable = BIT(31), 66562306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV(0, 3), 66662306a36Sopenharmony_ci .mux = { 66762306a36Sopenharmony_ci .shift = 24, 66862306a36Sopenharmony_ci .width = 3, 66962306a36Sopenharmony_ci .fixed_predivs = gpu_predivs, 67062306a36Sopenharmony_ci .n_predivs = ARRAY_SIZE(gpu_predivs), 67162306a36Sopenharmony_ci }, 67262306a36Sopenharmony_ci .common = { 67362306a36Sopenharmony_ci .reg = 0x1a0, 67462306a36Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 67562306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("gpu-core", 67662306a36Sopenharmony_ci gpu_parents, 67762306a36Sopenharmony_ci &ccu_div_ops, 67862306a36Sopenharmony_ci 0), 67962306a36Sopenharmony_ci }, 68062306a36Sopenharmony_ci}; 68162306a36Sopenharmony_ci 68262306a36Sopenharmony_cistatic struct ccu_div gpu_memory_clk = { 68362306a36Sopenharmony_ci .enable = BIT(31), 68462306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV(0, 3), 68562306a36Sopenharmony_ci .mux = { 68662306a36Sopenharmony_ci .shift = 24, 68762306a36Sopenharmony_ci .width = 3, 68862306a36Sopenharmony_ci .fixed_predivs = gpu_predivs, 68962306a36Sopenharmony_ci .n_predivs = ARRAY_SIZE(gpu_predivs), 69062306a36Sopenharmony_ci }, 69162306a36Sopenharmony_ci .common = { 69262306a36Sopenharmony_ci .reg = 0x1a4, 69362306a36Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 69462306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("gpu-memory", 69562306a36Sopenharmony_ci gpu_parents, 69662306a36Sopenharmony_ci &ccu_div_ops, 69762306a36Sopenharmony_ci 0), 69862306a36Sopenharmony_ci }, 69962306a36Sopenharmony_ci}; 70062306a36Sopenharmony_ci 70162306a36Sopenharmony_cistatic struct ccu_div gpu_hyd_clk = { 70262306a36Sopenharmony_ci .enable = BIT(31), 70362306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV(0, 3), 70462306a36Sopenharmony_ci .mux = { 70562306a36Sopenharmony_ci .shift = 24, 70662306a36Sopenharmony_ci .width = 3, 70762306a36Sopenharmony_ci .fixed_predivs = gpu_predivs, 70862306a36Sopenharmony_ci .n_predivs = ARRAY_SIZE(gpu_predivs), 70962306a36Sopenharmony_ci }, 71062306a36Sopenharmony_ci .common = { 71162306a36Sopenharmony_ci .reg = 0x1a8, 71262306a36Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 71362306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("gpu-hyd", 71462306a36Sopenharmony_ci gpu_parents, 71562306a36Sopenharmony_ci &ccu_div_ops, 71662306a36Sopenharmony_ci 0), 71762306a36Sopenharmony_ci }, 71862306a36Sopenharmony_ci}; 71962306a36Sopenharmony_ci 72062306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(ats_clk, "ats", mod0_default_parents, 0x1b0, 72162306a36Sopenharmony_ci 0, 3, /* M */ 72262306a36Sopenharmony_ci 24, 2, /* mux */ 72362306a36Sopenharmony_ci BIT(31), /* gate */ 72462306a36Sopenharmony_ci 0); 72562306a36Sopenharmony_ci 72662306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(trace_clk, "trace", mod0_default_parents, 72762306a36Sopenharmony_ci 0x1b0, 72862306a36Sopenharmony_ci 0, 3, /* M */ 72962306a36Sopenharmony_ci 24, 2, /* mux */ 73062306a36Sopenharmony_ci BIT(31), /* gate */ 73162306a36Sopenharmony_ci 0); 73262306a36Sopenharmony_ci 73362306a36Sopenharmony_cistatic const char * const clk_out_parents[] = { "osc24M", "osc32k", "osc24M", 73462306a36Sopenharmony_ci "axi", "ahb1" }; 73562306a36Sopenharmony_cistatic const u8 clk_out_table[] = { 0, 1, 2, 11, 13 }; 73662306a36Sopenharmony_ci 73762306a36Sopenharmony_cistatic const struct ccu_mux_fixed_prediv clk_out_predivs[] = { 73862306a36Sopenharmony_ci { .index = 0, .div = 750, }, 73962306a36Sopenharmony_ci { .index = 3, .div = 4, }, 74062306a36Sopenharmony_ci { .index = 4, .div = 4, }, 74162306a36Sopenharmony_ci}; 74262306a36Sopenharmony_ci 74362306a36Sopenharmony_cistatic struct ccu_mp out_a_clk = { 74462306a36Sopenharmony_ci .enable = BIT(31), 74562306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(8, 5), 74662306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(20, 2), 74762306a36Sopenharmony_ci .mux = { 74862306a36Sopenharmony_ci .shift = 24, 74962306a36Sopenharmony_ci .width = 4, 75062306a36Sopenharmony_ci .table = clk_out_table, 75162306a36Sopenharmony_ci .fixed_predivs = clk_out_predivs, 75262306a36Sopenharmony_ci .n_predivs = ARRAY_SIZE(clk_out_predivs), 75362306a36Sopenharmony_ci }, 75462306a36Sopenharmony_ci .common = { 75562306a36Sopenharmony_ci .reg = 0x300, 75662306a36Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 75762306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("out-a", 75862306a36Sopenharmony_ci clk_out_parents, 75962306a36Sopenharmony_ci &ccu_mp_ops, 76062306a36Sopenharmony_ci 0), 76162306a36Sopenharmony_ci }, 76262306a36Sopenharmony_ci}; 76362306a36Sopenharmony_ci 76462306a36Sopenharmony_cistatic struct ccu_mp out_b_clk = { 76562306a36Sopenharmony_ci .enable = BIT(31), 76662306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(8, 5), 76762306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(20, 2), 76862306a36Sopenharmony_ci .mux = { 76962306a36Sopenharmony_ci .shift = 24, 77062306a36Sopenharmony_ci .width = 4, 77162306a36Sopenharmony_ci .table = clk_out_table, 77262306a36Sopenharmony_ci .fixed_predivs = clk_out_predivs, 77362306a36Sopenharmony_ci .n_predivs = ARRAY_SIZE(clk_out_predivs), 77462306a36Sopenharmony_ci }, 77562306a36Sopenharmony_ci .common = { 77662306a36Sopenharmony_ci .reg = 0x304, 77762306a36Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 77862306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("out-b", 77962306a36Sopenharmony_ci clk_out_parents, 78062306a36Sopenharmony_ci &ccu_mp_ops, 78162306a36Sopenharmony_ci 0), 78262306a36Sopenharmony_ci }, 78362306a36Sopenharmony_ci}; 78462306a36Sopenharmony_ci 78562306a36Sopenharmony_cistatic struct ccu_mp out_c_clk = { 78662306a36Sopenharmony_ci .enable = BIT(31), 78762306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(8, 5), 78862306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(20, 2), 78962306a36Sopenharmony_ci .mux = { 79062306a36Sopenharmony_ci .shift = 24, 79162306a36Sopenharmony_ci .width = 4, 79262306a36Sopenharmony_ci .table = clk_out_table, 79362306a36Sopenharmony_ci .fixed_predivs = clk_out_predivs, 79462306a36Sopenharmony_ci .n_predivs = ARRAY_SIZE(clk_out_predivs), 79562306a36Sopenharmony_ci }, 79662306a36Sopenharmony_ci .common = { 79762306a36Sopenharmony_ci .reg = 0x308, 79862306a36Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 79962306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("out-c", 80062306a36Sopenharmony_ci clk_out_parents, 80162306a36Sopenharmony_ci &ccu_mp_ops, 80262306a36Sopenharmony_ci 0), 80362306a36Sopenharmony_ci }, 80462306a36Sopenharmony_ci}; 80562306a36Sopenharmony_ci 80662306a36Sopenharmony_cistatic struct ccu_common *sun6i_a31_ccu_clks[] = { 80762306a36Sopenharmony_ci &pll_cpu_clk.common, 80862306a36Sopenharmony_ci &pll_audio_base_clk.common, 80962306a36Sopenharmony_ci &pll_video0_clk.common, 81062306a36Sopenharmony_ci &pll_ve_clk.common, 81162306a36Sopenharmony_ci &pll_ddr_clk.common, 81262306a36Sopenharmony_ci &pll_periph_clk.common, 81362306a36Sopenharmony_ci &pll_video1_clk.common, 81462306a36Sopenharmony_ci &pll_gpu_clk.common, 81562306a36Sopenharmony_ci &pll_mipi_clk.common, 81662306a36Sopenharmony_ci &pll9_clk.common, 81762306a36Sopenharmony_ci &pll10_clk.common, 81862306a36Sopenharmony_ci &cpu_clk.common, 81962306a36Sopenharmony_ci &axi_clk.common, 82062306a36Sopenharmony_ci &ahb1_clk.common, 82162306a36Sopenharmony_ci &apb1_clk.common, 82262306a36Sopenharmony_ci &apb2_clk.common, 82362306a36Sopenharmony_ci &ahb1_mipidsi_clk.common, 82462306a36Sopenharmony_ci &ahb1_ss_clk.common, 82562306a36Sopenharmony_ci &ahb1_dma_clk.common, 82662306a36Sopenharmony_ci &ahb1_mmc0_clk.common, 82762306a36Sopenharmony_ci &ahb1_mmc1_clk.common, 82862306a36Sopenharmony_ci &ahb1_mmc2_clk.common, 82962306a36Sopenharmony_ci &ahb1_mmc3_clk.common, 83062306a36Sopenharmony_ci &ahb1_nand1_clk.common, 83162306a36Sopenharmony_ci &ahb1_nand0_clk.common, 83262306a36Sopenharmony_ci &ahb1_sdram_clk.common, 83362306a36Sopenharmony_ci &ahb1_emac_clk.common, 83462306a36Sopenharmony_ci &ahb1_ts_clk.common, 83562306a36Sopenharmony_ci &ahb1_hstimer_clk.common, 83662306a36Sopenharmony_ci &ahb1_spi0_clk.common, 83762306a36Sopenharmony_ci &ahb1_spi1_clk.common, 83862306a36Sopenharmony_ci &ahb1_spi2_clk.common, 83962306a36Sopenharmony_ci &ahb1_spi3_clk.common, 84062306a36Sopenharmony_ci &ahb1_otg_clk.common, 84162306a36Sopenharmony_ci &ahb1_ehci0_clk.common, 84262306a36Sopenharmony_ci &ahb1_ehci1_clk.common, 84362306a36Sopenharmony_ci &ahb1_ohci0_clk.common, 84462306a36Sopenharmony_ci &ahb1_ohci1_clk.common, 84562306a36Sopenharmony_ci &ahb1_ohci2_clk.common, 84662306a36Sopenharmony_ci &ahb1_ve_clk.common, 84762306a36Sopenharmony_ci &ahb1_lcd0_clk.common, 84862306a36Sopenharmony_ci &ahb1_lcd1_clk.common, 84962306a36Sopenharmony_ci &ahb1_csi_clk.common, 85062306a36Sopenharmony_ci &ahb1_hdmi_clk.common, 85162306a36Sopenharmony_ci &ahb1_be0_clk.common, 85262306a36Sopenharmony_ci &ahb1_be1_clk.common, 85362306a36Sopenharmony_ci &ahb1_fe0_clk.common, 85462306a36Sopenharmony_ci &ahb1_fe1_clk.common, 85562306a36Sopenharmony_ci &ahb1_mp_clk.common, 85662306a36Sopenharmony_ci &ahb1_gpu_clk.common, 85762306a36Sopenharmony_ci &ahb1_deu0_clk.common, 85862306a36Sopenharmony_ci &ahb1_deu1_clk.common, 85962306a36Sopenharmony_ci &ahb1_drc0_clk.common, 86062306a36Sopenharmony_ci &ahb1_drc1_clk.common, 86162306a36Sopenharmony_ci &apb1_codec_clk.common, 86262306a36Sopenharmony_ci &apb1_spdif_clk.common, 86362306a36Sopenharmony_ci &apb1_digital_mic_clk.common, 86462306a36Sopenharmony_ci &apb1_pio_clk.common, 86562306a36Sopenharmony_ci &apb1_daudio0_clk.common, 86662306a36Sopenharmony_ci &apb1_daudio1_clk.common, 86762306a36Sopenharmony_ci &apb2_i2c0_clk.common, 86862306a36Sopenharmony_ci &apb2_i2c1_clk.common, 86962306a36Sopenharmony_ci &apb2_i2c2_clk.common, 87062306a36Sopenharmony_ci &apb2_i2c3_clk.common, 87162306a36Sopenharmony_ci &apb2_uart0_clk.common, 87262306a36Sopenharmony_ci &apb2_uart1_clk.common, 87362306a36Sopenharmony_ci &apb2_uart2_clk.common, 87462306a36Sopenharmony_ci &apb2_uart3_clk.common, 87562306a36Sopenharmony_ci &apb2_uart4_clk.common, 87662306a36Sopenharmony_ci &apb2_uart5_clk.common, 87762306a36Sopenharmony_ci &nand0_clk.common, 87862306a36Sopenharmony_ci &nand1_clk.common, 87962306a36Sopenharmony_ci &mmc0_clk.common, 88062306a36Sopenharmony_ci &mmc0_sample_clk.common, 88162306a36Sopenharmony_ci &mmc0_output_clk.common, 88262306a36Sopenharmony_ci &mmc1_clk.common, 88362306a36Sopenharmony_ci &mmc1_sample_clk.common, 88462306a36Sopenharmony_ci &mmc1_output_clk.common, 88562306a36Sopenharmony_ci &mmc2_clk.common, 88662306a36Sopenharmony_ci &mmc2_sample_clk.common, 88762306a36Sopenharmony_ci &mmc2_output_clk.common, 88862306a36Sopenharmony_ci &mmc3_clk.common, 88962306a36Sopenharmony_ci &mmc3_sample_clk.common, 89062306a36Sopenharmony_ci &mmc3_output_clk.common, 89162306a36Sopenharmony_ci &ts_clk.common, 89262306a36Sopenharmony_ci &ss_clk.common, 89362306a36Sopenharmony_ci &spi0_clk.common, 89462306a36Sopenharmony_ci &spi1_clk.common, 89562306a36Sopenharmony_ci &spi2_clk.common, 89662306a36Sopenharmony_ci &spi3_clk.common, 89762306a36Sopenharmony_ci &daudio0_clk.common, 89862306a36Sopenharmony_ci &daudio1_clk.common, 89962306a36Sopenharmony_ci &spdif_clk.common, 90062306a36Sopenharmony_ci &usb_phy0_clk.common, 90162306a36Sopenharmony_ci &usb_phy1_clk.common, 90262306a36Sopenharmony_ci &usb_phy2_clk.common, 90362306a36Sopenharmony_ci &usb_ohci0_clk.common, 90462306a36Sopenharmony_ci &usb_ohci1_clk.common, 90562306a36Sopenharmony_ci &usb_ohci2_clk.common, 90662306a36Sopenharmony_ci &mdfs_clk.common, 90762306a36Sopenharmony_ci &sdram0_clk.common, 90862306a36Sopenharmony_ci &sdram1_clk.common, 90962306a36Sopenharmony_ci &dram_ve_clk.common, 91062306a36Sopenharmony_ci &dram_csi_isp_clk.common, 91162306a36Sopenharmony_ci &dram_ts_clk.common, 91262306a36Sopenharmony_ci &dram_drc0_clk.common, 91362306a36Sopenharmony_ci &dram_drc1_clk.common, 91462306a36Sopenharmony_ci &dram_deu0_clk.common, 91562306a36Sopenharmony_ci &dram_deu1_clk.common, 91662306a36Sopenharmony_ci &dram_fe0_clk.common, 91762306a36Sopenharmony_ci &dram_fe1_clk.common, 91862306a36Sopenharmony_ci &dram_be0_clk.common, 91962306a36Sopenharmony_ci &dram_be1_clk.common, 92062306a36Sopenharmony_ci &dram_mp_clk.common, 92162306a36Sopenharmony_ci &be0_clk.common, 92262306a36Sopenharmony_ci &be1_clk.common, 92362306a36Sopenharmony_ci &fe0_clk.common, 92462306a36Sopenharmony_ci &fe1_clk.common, 92562306a36Sopenharmony_ci &mp_clk.common, 92662306a36Sopenharmony_ci &lcd0_ch0_clk.common, 92762306a36Sopenharmony_ci &lcd1_ch0_clk.common, 92862306a36Sopenharmony_ci &lcd0_ch1_clk.common, 92962306a36Sopenharmony_ci &lcd1_ch1_clk.common, 93062306a36Sopenharmony_ci &csi0_sclk_clk.common, 93162306a36Sopenharmony_ci &csi0_mclk_clk.common, 93262306a36Sopenharmony_ci &csi1_mclk_clk.common, 93362306a36Sopenharmony_ci &ve_clk.common, 93462306a36Sopenharmony_ci &codec_clk.common, 93562306a36Sopenharmony_ci &avs_clk.common, 93662306a36Sopenharmony_ci &digital_mic_clk.common, 93762306a36Sopenharmony_ci &hdmi_clk.common, 93862306a36Sopenharmony_ci &hdmi_ddc_clk.common, 93962306a36Sopenharmony_ci &ps_clk.common, 94062306a36Sopenharmony_ci &mbus0_clk.common, 94162306a36Sopenharmony_ci &mbus1_clk.common, 94262306a36Sopenharmony_ci &mipi_dsi_clk.common, 94362306a36Sopenharmony_ci &mipi_dsi_dphy_clk.common, 94462306a36Sopenharmony_ci &mipi_csi_dphy_clk.common, 94562306a36Sopenharmony_ci &iep_drc0_clk.common, 94662306a36Sopenharmony_ci &iep_drc1_clk.common, 94762306a36Sopenharmony_ci &iep_deu0_clk.common, 94862306a36Sopenharmony_ci &iep_deu1_clk.common, 94962306a36Sopenharmony_ci &gpu_core_clk.common, 95062306a36Sopenharmony_ci &gpu_memory_clk.common, 95162306a36Sopenharmony_ci &gpu_hyd_clk.common, 95262306a36Sopenharmony_ci &ats_clk.common, 95362306a36Sopenharmony_ci &trace_clk.common, 95462306a36Sopenharmony_ci &out_a_clk.common, 95562306a36Sopenharmony_ci &out_b_clk.common, 95662306a36Sopenharmony_ci &out_c_clk.common, 95762306a36Sopenharmony_ci}; 95862306a36Sopenharmony_ci 95962306a36Sopenharmony_cistatic const struct clk_hw *clk_parent_pll_audio[] = { 96062306a36Sopenharmony_ci &pll_audio_base_clk.common.hw 96162306a36Sopenharmony_ci}; 96262306a36Sopenharmony_ci 96362306a36Sopenharmony_ci/* We hardcode the divider to 1 for now */ 96462306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 96562306a36Sopenharmony_ci clk_parent_pll_audio, 96662306a36Sopenharmony_ci 1, 1, CLK_SET_RATE_PARENT); 96762306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 96862306a36Sopenharmony_ci clk_parent_pll_audio, 96962306a36Sopenharmony_ci 2, 1, CLK_SET_RATE_PARENT); 97062306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 97162306a36Sopenharmony_ci clk_parent_pll_audio, 97262306a36Sopenharmony_ci 1, 1, CLK_SET_RATE_PARENT); 97362306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 97462306a36Sopenharmony_ci clk_parent_pll_audio, 97562306a36Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 97662306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_periph_2x_clk, "pll-periph-2x", 97762306a36Sopenharmony_ci &pll_periph_clk.common.hw, 97862306a36Sopenharmony_ci 1, 2, 0); 97962306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_video0_2x_clk, "pll-video0-2x", 98062306a36Sopenharmony_ci &pll_video0_clk.common.hw, 98162306a36Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 98262306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_video1_2x_clk, "pll-video1-2x", 98362306a36Sopenharmony_ci &pll_video1_clk.common.hw, 98462306a36Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 98562306a36Sopenharmony_ci 98662306a36Sopenharmony_cistatic struct clk_hw_onecell_data sun6i_a31_hw_clks = { 98762306a36Sopenharmony_ci .hws = { 98862306a36Sopenharmony_ci [CLK_PLL_CPU] = &pll_cpu_clk.common.hw, 98962306a36Sopenharmony_ci [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, 99062306a36Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.hw, 99162306a36Sopenharmony_ci [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, 99262306a36Sopenharmony_ci [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, 99362306a36Sopenharmony_ci [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, 99462306a36Sopenharmony_ci [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 99562306a36Sopenharmony_ci [CLK_PLL_VIDEO0_2X] = &pll_video0_2x_clk.hw, 99662306a36Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 99762306a36Sopenharmony_ci [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 99862306a36Sopenharmony_ci [CLK_PLL_PERIPH] = &pll_periph_clk.common.hw, 99962306a36Sopenharmony_ci [CLK_PLL_PERIPH_2X] = &pll_periph_2x_clk.hw, 100062306a36Sopenharmony_ci [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 100162306a36Sopenharmony_ci [CLK_PLL_VIDEO1_2X] = &pll_video1_2x_clk.hw, 100262306a36Sopenharmony_ci [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 100362306a36Sopenharmony_ci [CLK_PLL_MIPI] = &pll_mipi_clk.common.hw, 100462306a36Sopenharmony_ci [CLK_PLL9] = &pll9_clk.common.hw, 100562306a36Sopenharmony_ci [CLK_PLL10] = &pll10_clk.common.hw, 100662306a36Sopenharmony_ci [CLK_CPU] = &cpu_clk.common.hw, 100762306a36Sopenharmony_ci [CLK_AXI] = &axi_clk.common.hw, 100862306a36Sopenharmony_ci [CLK_AHB1] = &ahb1_clk.common.hw, 100962306a36Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 101062306a36Sopenharmony_ci [CLK_APB2] = &apb2_clk.common.hw, 101162306a36Sopenharmony_ci [CLK_AHB1_MIPIDSI] = &ahb1_mipidsi_clk.common.hw, 101262306a36Sopenharmony_ci [CLK_AHB1_SS] = &ahb1_ss_clk.common.hw, 101362306a36Sopenharmony_ci [CLK_AHB1_DMA] = &ahb1_dma_clk.common.hw, 101462306a36Sopenharmony_ci [CLK_AHB1_MMC0] = &ahb1_mmc0_clk.common.hw, 101562306a36Sopenharmony_ci [CLK_AHB1_MMC1] = &ahb1_mmc1_clk.common.hw, 101662306a36Sopenharmony_ci [CLK_AHB1_MMC2] = &ahb1_mmc2_clk.common.hw, 101762306a36Sopenharmony_ci [CLK_AHB1_MMC3] = &ahb1_mmc3_clk.common.hw, 101862306a36Sopenharmony_ci [CLK_AHB1_NAND1] = &ahb1_nand1_clk.common.hw, 101962306a36Sopenharmony_ci [CLK_AHB1_NAND0] = &ahb1_nand0_clk.common.hw, 102062306a36Sopenharmony_ci [CLK_AHB1_SDRAM] = &ahb1_sdram_clk.common.hw, 102162306a36Sopenharmony_ci [CLK_AHB1_EMAC] = &ahb1_emac_clk.common.hw, 102262306a36Sopenharmony_ci [CLK_AHB1_TS] = &ahb1_ts_clk.common.hw, 102362306a36Sopenharmony_ci [CLK_AHB1_HSTIMER] = &ahb1_hstimer_clk.common.hw, 102462306a36Sopenharmony_ci [CLK_AHB1_SPI0] = &ahb1_spi0_clk.common.hw, 102562306a36Sopenharmony_ci [CLK_AHB1_SPI1] = &ahb1_spi1_clk.common.hw, 102662306a36Sopenharmony_ci [CLK_AHB1_SPI2] = &ahb1_spi2_clk.common.hw, 102762306a36Sopenharmony_ci [CLK_AHB1_SPI3] = &ahb1_spi3_clk.common.hw, 102862306a36Sopenharmony_ci [CLK_AHB1_OTG] = &ahb1_otg_clk.common.hw, 102962306a36Sopenharmony_ci [CLK_AHB1_EHCI0] = &ahb1_ehci0_clk.common.hw, 103062306a36Sopenharmony_ci [CLK_AHB1_EHCI1] = &ahb1_ehci1_clk.common.hw, 103162306a36Sopenharmony_ci [CLK_AHB1_OHCI0] = &ahb1_ohci0_clk.common.hw, 103262306a36Sopenharmony_ci [CLK_AHB1_OHCI1] = &ahb1_ohci1_clk.common.hw, 103362306a36Sopenharmony_ci [CLK_AHB1_OHCI2] = &ahb1_ohci2_clk.common.hw, 103462306a36Sopenharmony_ci [CLK_AHB1_VE] = &ahb1_ve_clk.common.hw, 103562306a36Sopenharmony_ci [CLK_AHB1_LCD0] = &ahb1_lcd0_clk.common.hw, 103662306a36Sopenharmony_ci [CLK_AHB1_LCD1] = &ahb1_lcd1_clk.common.hw, 103762306a36Sopenharmony_ci [CLK_AHB1_CSI] = &ahb1_csi_clk.common.hw, 103862306a36Sopenharmony_ci [CLK_AHB1_HDMI] = &ahb1_hdmi_clk.common.hw, 103962306a36Sopenharmony_ci [CLK_AHB1_BE0] = &ahb1_be0_clk.common.hw, 104062306a36Sopenharmony_ci [CLK_AHB1_BE1] = &ahb1_be1_clk.common.hw, 104162306a36Sopenharmony_ci [CLK_AHB1_FE0] = &ahb1_fe0_clk.common.hw, 104262306a36Sopenharmony_ci [CLK_AHB1_FE1] = &ahb1_fe1_clk.common.hw, 104362306a36Sopenharmony_ci [CLK_AHB1_MP] = &ahb1_mp_clk.common.hw, 104462306a36Sopenharmony_ci [CLK_AHB1_GPU] = &ahb1_gpu_clk.common.hw, 104562306a36Sopenharmony_ci [CLK_AHB1_DEU0] = &ahb1_deu0_clk.common.hw, 104662306a36Sopenharmony_ci [CLK_AHB1_DEU1] = &ahb1_deu1_clk.common.hw, 104762306a36Sopenharmony_ci [CLK_AHB1_DRC0] = &ahb1_drc0_clk.common.hw, 104862306a36Sopenharmony_ci [CLK_AHB1_DRC1] = &ahb1_drc1_clk.common.hw, 104962306a36Sopenharmony_ci [CLK_APB1_CODEC] = &apb1_codec_clk.common.hw, 105062306a36Sopenharmony_ci [CLK_APB1_SPDIF] = &apb1_spdif_clk.common.hw, 105162306a36Sopenharmony_ci [CLK_APB1_DIGITAL_MIC] = &apb1_digital_mic_clk.common.hw, 105262306a36Sopenharmony_ci [CLK_APB1_PIO] = &apb1_pio_clk.common.hw, 105362306a36Sopenharmony_ci [CLK_APB1_DAUDIO0] = &apb1_daudio0_clk.common.hw, 105462306a36Sopenharmony_ci [CLK_APB1_DAUDIO1] = &apb1_daudio1_clk.common.hw, 105562306a36Sopenharmony_ci [CLK_APB2_I2C0] = &apb2_i2c0_clk.common.hw, 105662306a36Sopenharmony_ci [CLK_APB2_I2C1] = &apb2_i2c1_clk.common.hw, 105762306a36Sopenharmony_ci [CLK_APB2_I2C2] = &apb2_i2c2_clk.common.hw, 105862306a36Sopenharmony_ci [CLK_APB2_I2C3] = &apb2_i2c3_clk.common.hw, 105962306a36Sopenharmony_ci [CLK_APB2_UART0] = &apb2_uart0_clk.common.hw, 106062306a36Sopenharmony_ci [CLK_APB2_UART1] = &apb2_uart1_clk.common.hw, 106162306a36Sopenharmony_ci [CLK_APB2_UART2] = &apb2_uart2_clk.common.hw, 106262306a36Sopenharmony_ci [CLK_APB2_UART3] = &apb2_uart3_clk.common.hw, 106362306a36Sopenharmony_ci [CLK_APB2_UART4] = &apb2_uart4_clk.common.hw, 106462306a36Sopenharmony_ci [CLK_APB2_UART5] = &apb2_uart5_clk.common.hw, 106562306a36Sopenharmony_ci [CLK_NAND0] = &nand0_clk.common.hw, 106662306a36Sopenharmony_ci [CLK_NAND1] = &nand1_clk.common.hw, 106762306a36Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 106862306a36Sopenharmony_ci [CLK_MMC0_SAMPLE] = &mmc0_sample_clk.common.hw, 106962306a36Sopenharmony_ci [CLK_MMC0_OUTPUT] = &mmc0_output_clk.common.hw, 107062306a36Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 107162306a36Sopenharmony_ci [CLK_MMC1_SAMPLE] = &mmc1_sample_clk.common.hw, 107262306a36Sopenharmony_ci [CLK_MMC1_OUTPUT] = &mmc1_output_clk.common.hw, 107362306a36Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 107462306a36Sopenharmony_ci [CLK_MMC2_SAMPLE] = &mmc2_sample_clk.common.hw, 107562306a36Sopenharmony_ci [CLK_MMC2_OUTPUT] = &mmc2_output_clk.common.hw, 107662306a36Sopenharmony_ci [CLK_MMC3] = &mmc3_clk.common.hw, 107762306a36Sopenharmony_ci [CLK_MMC3_SAMPLE] = &mmc3_sample_clk.common.hw, 107862306a36Sopenharmony_ci [CLK_MMC3_OUTPUT] = &mmc3_output_clk.common.hw, 107962306a36Sopenharmony_ci [CLK_TS] = &ts_clk.common.hw, 108062306a36Sopenharmony_ci [CLK_SS] = &ss_clk.common.hw, 108162306a36Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 108262306a36Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 108362306a36Sopenharmony_ci [CLK_SPI2] = &spi2_clk.common.hw, 108462306a36Sopenharmony_ci [CLK_SPI3] = &spi3_clk.common.hw, 108562306a36Sopenharmony_ci [CLK_DAUDIO0] = &daudio0_clk.common.hw, 108662306a36Sopenharmony_ci [CLK_DAUDIO1] = &daudio1_clk.common.hw, 108762306a36Sopenharmony_ci [CLK_SPDIF] = &spdif_clk.common.hw, 108862306a36Sopenharmony_ci [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 108962306a36Sopenharmony_ci [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 109062306a36Sopenharmony_ci [CLK_USB_PHY2] = &usb_phy2_clk.common.hw, 109162306a36Sopenharmony_ci [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw, 109262306a36Sopenharmony_ci [CLK_USB_OHCI1] = &usb_ohci1_clk.common.hw, 109362306a36Sopenharmony_ci [CLK_USB_OHCI2] = &usb_ohci2_clk.common.hw, 109462306a36Sopenharmony_ci [CLK_MDFS] = &mdfs_clk.common.hw, 109562306a36Sopenharmony_ci [CLK_SDRAM0] = &sdram0_clk.common.hw, 109662306a36Sopenharmony_ci [CLK_SDRAM1] = &sdram1_clk.common.hw, 109762306a36Sopenharmony_ci [CLK_DRAM_VE] = &dram_ve_clk.common.hw, 109862306a36Sopenharmony_ci [CLK_DRAM_CSI_ISP] = &dram_csi_isp_clk.common.hw, 109962306a36Sopenharmony_ci [CLK_DRAM_TS] = &dram_ts_clk.common.hw, 110062306a36Sopenharmony_ci [CLK_DRAM_DRC0] = &dram_drc0_clk.common.hw, 110162306a36Sopenharmony_ci [CLK_DRAM_DRC1] = &dram_drc1_clk.common.hw, 110262306a36Sopenharmony_ci [CLK_DRAM_DEU0] = &dram_deu0_clk.common.hw, 110362306a36Sopenharmony_ci [CLK_DRAM_DEU1] = &dram_deu1_clk.common.hw, 110462306a36Sopenharmony_ci [CLK_DRAM_FE0] = &dram_fe0_clk.common.hw, 110562306a36Sopenharmony_ci [CLK_DRAM_FE1] = &dram_fe1_clk.common.hw, 110662306a36Sopenharmony_ci [CLK_DRAM_BE0] = &dram_be0_clk.common.hw, 110762306a36Sopenharmony_ci [CLK_DRAM_BE1] = &dram_be1_clk.common.hw, 110862306a36Sopenharmony_ci [CLK_DRAM_MP] = &dram_mp_clk.common.hw, 110962306a36Sopenharmony_ci [CLK_BE0] = &be0_clk.common.hw, 111062306a36Sopenharmony_ci [CLK_BE1] = &be1_clk.common.hw, 111162306a36Sopenharmony_ci [CLK_FE0] = &fe0_clk.common.hw, 111262306a36Sopenharmony_ci [CLK_FE1] = &fe1_clk.common.hw, 111362306a36Sopenharmony_ci [CLK_MP] = &mp_clk.common.hw, 111462306a36Sopenharmony_ci [CLK_LCD0_CH0] = &lcd0_ch0_clk.common.hw, 111562306a36Sopenharmony_ci [CLK_LCD1_CH0] = &lcd1_ch0_clk.common.hw, 111662306a36Sopenharmony_ci [CLK_LCD0_CH1] = &lcd0_ch1_clk.common.hw, 111762306a36Sopenharmony_ci [CLK_LCD1_CH1] = &lcd1_ch1_clk.common.hw, 111862306a36Sopenharmony_ci [CLK_CSI0_SCLK] = &csi0_sclk_clk.common.hw, 111962306a36Sopenharmony_ci [CLK_CSI0_MCLK] = &csi0_mclk_clk.common.hw, 112062306a36Sopenharmony_ci [CLK_CSI1_MCLK] = &csi1_mclk_clk.common.hw, 112162306a36Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 112262306a36Sopenharmony_ci [CLK_CODEC] = &codec_clk.common.hw, 112362306a36Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 112462306a36Sopenharmony_ci [CLK_DIGITAL_MIC] = &digital_mic_clk.common.hw, 112562306a36Sopenharmony_ci [CLK_HDMI] = &hdmi_clk.common.hw, 112662306a36Sopenharmony_ci [CLK_HDMI_DDC] = &hdmi_ddc_clk.common.hw, 112762306a36Sopenharmony_ci [CLK_PS] = &ps_clk.common.hw, 112862306a36Sopenharmony_ci [CLK_MBUS0] = &mbus0_clk.common.hw, 112962306a36Sopenharmony_ci [CLK_MBUS1] = &mbus1_clk.common.hw, 113062306a36Sopenharmony_ci [CLK_MIPI_DSI] = &mipi_dsi_clk.common.hw, 113162306a36Sopenharmony_ci [CLK_MIPI_DSI_DPHY] = &mipi_dsi_dphy_clk.common.hw, 113262306a36Sopenharmony_ci [CLK_MIPI_CSI_DPHY] = &mipi_csi_dphy_clk.common.hw, 113362306a36Sopenharmony_ci [CLK_IEP_DRC0] = &iep_drc0_clk.common.hw, 113462306a36Sopenharmony_ci [CLK_IEP_DRC1] = &iep_drc1_clk.common.hw, 113562306a36Sopenharmony_ci [CLK_IEP_DEU0] = &iep_deu0_clk.common.hw, 113662306a36Sopenharmony_ci [CLK_IEP_DEU1] = &iep_deu1_clk.common.hw, 113762306a36Sopenharmony_ci [CLK_GPU_CORE] = &gpu_core_clk.common.hw, 113862306a36Sopenharmony_ci [CLK_GPU_MEMORY] = &gpu_memory_clk.common.hw, 113962306a36Sopenharmony_ci [CLK_GPU_HYD] = &gpu_hyd_clk.common.hw, 114062306a36Sopenharmony_ci [CLK_ATS] = &ats_clk.common.hw, 114162306a36Sopenharmony_ci [CLK_TRACE] = &trace_clk.common.hw, 114262306a36Sopenharmony_ci [CLK_OUT_A] = &out_a_clk.common.hw, 114362306a36Sopenharmony_ci [CLK_OUT_B] = &out_b_clk.common.hw, 114462306a36Sopenharmony_ci [CLK_OUT_C] = &out_c_clk.common.hw, 114562306a36Sopenharmony_ci }, 114662306a36Sopenharmony_ci .num = CLK_NUMBER, 114762306a36Sopenharmony_ci}; 114862306a36Sopenharmony_ci 114962306a36Sopenharmony_cistatic struct ccu_reset_map sun6i_a31_ccu_resets[] = { 115062306a36Sopenharmony_ci [RST_USB_PHY0] = { 0x0cc, BIT(0) }, 115162306a36Sopenharmony_ci [RST_USB_PHY1] = { 0x0cc, BIT(1) }, 115262306a36Sopenharmony_ci [RST_USB_PHY2] = { 0x0cc, BIT(2) }, 115362306a36Sopenharmony_ci 115462306a36Sopenharmony_ci [RST_AHB1_MIPI_DSI] = { 0x2c0, BIT(1) }, 115562306a36Sopenharmony_ci [RST_AHB1_SS] = { 0x2c0, BIT(5) }, 115662306a36Sopenharmony_ci [RST_AHB1_DMA] = { 0x2c0, BIT(6) }, 115762306a36Sopenharmony_ci [RST_AHB1_MMC0] = { 0x2c0, BIT(8) }, 115862306a36Sopenharmony_ci [RST_AHB1_MMC1] = { 0x2c0, BIT(9) }, 115962306a36Sopenharmony_ci [RST_AHB1_MMC2] = { 0x2c0, BIT(10) }, 116062306a36Sopenharmony_ci [RST_AHB1_MMC3] = { 0x2c0, BIT(11) }, 116162306a36Sopenharmony_ci [RST_AHB1_NAND1] = { 0x2c0, BIT(12) }, 116262306a36Sopenharmony_ci [RST_AHB1_NAND0] = { 0x2c0, BIT(13) }, 116362306a36Sopenharmony_ci [RST_AHB1_SDRAM] = { 0x2c0, BIT(14) }, 116462306a36Sopenharmony_ci [RST_AHB1_EMAC] = { 0x2c0, BIT(17) }, 116562306a36Sopenharmony_ci [RST_AHB1_TS] = { 0x2c0, BIT(18) }, 116662306a36Sopenharmony_ci [RST_AHB1_HSTIMER] = { 0x2c0, BIT(19) }, 116762306a36Sopenharmony_ci [RST_AHB1_SPI0] = { 0x2c0, BIT(20) }, 116862306a36Sopenharmony_ci [RST_AHB1_SPI1] = { 0x2c0, BIT(21) }, 116962306a36Sopenharmony_ci [RST_AHB1_SPI2] = { 0x2c0, BIT(22) }, 117062306a36Sopenharmony_ci [RST_AHB1_SPI3] = { 0x2c0, BIT(23) }, 117162306a36Sopenharmony_ci [RST_AHB1_OTG] = { 0x2c0, BIT(24) }, 117262306a36Sopenharmony_ci [RST_AHB1_EHCI0] = { 0x2c0, BIT(26) }, 117362306a36Sopenharmony_ci [RST_AHB1_EHCI1] = { 0x2c0, BIT(27) }, 117462306a36Sopenharmony_ci [RST_AHB1_OHCI0] = { 0x2c0, BIT(29) }, 117562306a36Sopenharmony_ci [RST_AHB1_OHCI1] = { 0x2c0, BIT(30) }, 117662306a36Sopenharmony_ci [RST_AHB1_OHCI2] = { 0x2c0, BIT(31) }, 117762306a36Sopenharmony_ci 117862306a36Sopenharmony_ci [RST_AHB1_VE] = { 0x2c4, BIT(0) }, 117962306a36Sopenharmony_ci [RST_AHB1_LCD0] = { 0x2c4, BIT(4) }, 118062306a36Sopenharmony_ci [RST_AHB1_LCD1] = { 0x2c4, BIT(5) }, 118162306a36Sopenharmony_ci [RST_AHB1_CSI] = { 0x2c4, BIT(8) }, 118262306a36Sopenharmony_ci [RST_AHB1_HDMI] = { 0x2c4, BIT(11) }, 118362306a36Sopenharmony_ci [RST_AHB1_BE0] = { 0x2c4, BIT(12) }, 118462306a36Sopenharmony_ci [RST_AHB1_BE1] = { 0x2c4, BIT(13) }, 118562306a36Sopenharmony_ci [RST_AHB1_FE0] = { 0x2c4, BIT(14) }, 118662306a36Sopenharmony_ci [RST_AHB1_FE1] = { 0x2c4, BIT(15) }, 118762306a36Sopenharmony_ci [RST_AHB1_MP] = { 0x2c4, BIT(18) }, 118862306a36Sopenharmony_ci [RST_AHB1_GPU] = { 0x2c4, BIT(20) }, 118962306a36Sopenharmony_ci [RST_AHB1_DEU0] = { 0x2c4, BIT(23) }, 119062306a36Sopenharmony_ci [RST_AHB1_DEU1] = { 0x2c4, BIT(24) }, 119162306a36Sopenharmony_ci [RST_AHB1_DRC0] = { 0x2c4, BIT(25) }, 119262306a36Sopenharmony_ci [RST_AHB1_DRC1] = { 0x2c4, BIT(26) }, 119362306a36Sopenharmony_ci [RST_AHB1_LVDS] = { 0x2c8, BIT(0) }, 119462306a36Sopenharmony_ci 119562306a36Sopenharmony_ci [RST_APB1_CODEC] = { 0x2d0, BIT(0) }, 119662306a36Sopenharmony_ci [RST_APB1_SPDIF] = { 0x2d0, BIT(1) }, 119762306a36Sopenharmony_ci [RST_APB1_DIGITAL_MIC] = { 0x2d0, BIT(4) }, 119862306a36Sopenharmony_ci [RST_APB1_DAUDIO0] = { 0x2d0, BIT(12) }, 119962306a36Sopenharmony_ci [RST_APB1_DAUDIO1] = { 0x2d0, BIT(13) }, 120062306a36Sopenharmony_ci 120162306a36Sopenharmony_ci [RST_APB2_I2C0] = { 0x2d8, BIT(0) }, 120262306a36Sopenharmony_ci [RST_APB2_I2C1] = { 0x2d8, BIT(1) }, 120362306a36Sopenharmony_ci [RST_APB2_I2C2] = { 0x2d8, BIT(2) }, 120462306a36Sopenharmony_ci [RST_APB2_I2C3] = { 0x2d8, BIT(3) }, 120562306a36Sopenharmony_ci [RST_APB2_UART0] = { 0x2d8, BIT(16) }, 120662306a36Sopenharmony_ci [RST_APB2_UART1] = { 0x2d8, BIT(17) }, 120762306a36Sopenharmony_ci [RST_APB2_UART2] = { 0x2d8, BIT(18) }, 120862306a36Sopenharmony_ci [RST_APB2_UART3] = { 0x2d8, BIT(19) }, 120962306a36Sopenharmony_ci [RST_APB2_UART4] = { 0x2d8, BIT(20) }, 121062306a36Sopenharmony_ci [RST_APB2_UART5] = { 0x2d8, BIT(21) }, 121162306a36Sopenharmony_ci}; 121262306a36Sopenharmony_ci 121362306a36Sopenharmony_cistatic const struct sunxi_ccu_desc sun6i_a31_ccu_desc = { 121462306a36Sopenharmony_ci .ccu_clks = sun6i_a31_ccu_clks, 121562306a36Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun6i_a31_ccu_clks), 121662306a36Sopenharmony_ci 121762306a36Sopenharmony_ci .hw_clks = &sun6i_a31_hw_clks, 121862306a36Sopenharmony_ci 121962306a36Sopenharmony_ci .resets = sun6i_a31_ccu_resets, 122062306a36Sopenharmony_ci .num_resets = ARRAY_SIZE(sun6i_a31_ccu_resets), 122162306a36Sopenharmony_ci}; 122262306a36Sopenharmony_ci 122362306a36Sopenharmony_cistatic struct ccu_mux_nb sun6i_a31_cpu_nb = { 122462306a36Sopenharmony_ci .common = &cpu_clk.common, 122562306a36Sopenharmony_ci .cm = &cpu_clk.mux, 122662306a36Sopenharmony_ci .delay_us = 1, /* > 8 clock cycles at 24 MHz */ 122762306a36Sopenharmony_ci .bypass_index = 1, /* index of 24 MHz oscillator */ 122862306a36Sopenharmony_ci}; 122962306a36Sopenharmony_ci 123062306a36Sopenharmony_cistatic int sun6i_a31_ccu_probe(struct platform_device *pdev) 123162306a36Sopenharmony_ci{ 123262306a36Sopenharmony_ci void __iomem *reg; 123362306a36Sopenharmony_ci int ret; 123462306a36Sopenharmony_ci u32 val; 123562306a36Sopenharmony_ci 123662306a36Sopenharmony_ci reg = devm_platform_ioremap_resource(pdev, 0); 123762306a36Sopenharmony_ci if (IS_ERR(reg)) 123862306a36Sopenharmony_ci return PTR_ERR(reg); 123962306a36Sopenharmony_ci 124062306a36Sopenharmony_ci /* Force the PLL-Audio-1x divider to 1 */ 124162306a36Sopenharmony_ci val = readl(reg + SUN6I_A31_PLL_AUDIO_REG); 124262306a36Sopenharmony_ci val &= ~GENMASK(19, 16); 124362306a36Sopenharmony_ci writel(val | (0 << 16), reg + SUN6I_A31_PLL_AUDIO_REG); 124462306a36Sopenharmony_ci 124562306a36Sopenharmony_ci /* Force PLL-MIPI to MIPI mode */ 124662306a36Sopenharmony_ci val = readl(reg + SUN6I_A31_PLL_MIPI_REG); 124762306a36Sopenharmony_ci val &= BIT(16); 124862306a36Sopenharmony_ci writel(val, reg + SUN6I_A31_PLL_MIPI_REG); 124962306a36Sopenharmony_ci 125062306a36Sopenharmony_ci /* Force AHB1 to PLL6 / 3 */ 125162306a36Sopenharmony_ci val = readl(reg + SUN6I_A31_AHB1_REG); 125262306a36Sopenharmony_ci /* set PLL6 pre-div = 3 */ 125362306a36Sopenharmony_ci val &= ~GENMASK(7, 6); 125462306a36Sopenharmony_ci val |= 0x2 << 6; 125562306a36Sopenharmony_ci /* select PLL6 / pre-div */ 125662306a36Sopenharmony_ci val &= ~GENMASK(13, 12); 125762306a36Sopenharmony_ci val |= 0x3 << 12; 125862306a36Sopenharmony_ci writel(val, reg + SUN6I_A31_AHB1_REG); 125962306a36Sopenharmony_ci 126062306a36Sopenharmony_ci ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun6i_a31_ccu_desc); 126162306a36Sopenharmony_ci if (ret) 126262306a36Sopenharmony_ci return ret; 126362306a36Sopenharmony_ci 126462306a36Sopenharmony_ci ccu_mux_notifier_register(pll_cpu_clk.common.hw.clk, 126562306a36Sopenharmony_ci &sun6i_a31_cpu_nb); 126662306a36Sopenharmony_ci 126762306a36Sopenharmony_ci return 0; 126862306a36Sopenharmony_ci} 126962306a36Sopenharmony_ci 127062306a36Sopenharmony_cistatic const struct of_device_id sun6i_a31_ccu_ids[] = { 127162306a36Sopenharmony_ci { .compatible = "allwinner,sun6i-a31-ccu" }, 127262306a36Sopenharmony_ci { } 127362306a36Sopenharmony_ci}; 127462306a36Sopenharmony_ci 127562306a36Sopenharmony_cistatic struct platform_driver sun6i_a31_ccu_driver = { 127662306a36Sopenharmony_ci .probe = sun6i_a31_ccu_probe, 127762306a36Sopenharmony_ci .driver = { 127862306a36Sopenharmony_ci .name = "sun6i-a31-ccu", 127962306a36Sopenharmony_ci .suppress_bind_attrs = true, 128062306a36Sopenharmony_ci .of_match_table = sun6i_a31_ccu_ids, 128162306a36Sopenharmony_ci }, 128262306a36Sopenharmony_ci}; 128362306a36Sopenharmony_cimodule_platform_driver(sun6i_a31_ccu_driver); 128462306a36Sopenharmony_ci 128562306a36Sopenharmony_ciMODULE_IMPORT_NS(SUNXI_CCU); 128662306a36Sopenharmony_ciMODULE_LICENSE("GPL"); 1287