162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2016 Maxime Ripard. All rights reserved. 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#include <linux/clk-provider.h> 762306a36Sopenharmony_ci#include <linux/io.h> 862306a36Sopenharmony_ci#include <linux/module.h> 962306a36Sopenharmony_ci#include <linux/of.h> 1062306a36Sopenharmony_ci#include <linux/platform_device.h> 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include "ccu_common.h" 1362306a36Sopenharmony_ci#include "ccu_reset.h" 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#include "ccu_div.h" 1662306a36Sopenharmony_ci#include "ccu_gate.h" 1762306a36Sopenharmony_ci#include "ccu_mp.h" 1862306a36Sopenharmony_ci#include "ccu_mult.h" 1962306a36Sopenharmony_ci#include "ccu_nk.h" 2062306a36Sopenharmony_ci#include "ccu_nkm.h" 2162306a36Sopenharmony_ci#include "ccu_nkmp.h" 2262306a36Sopenharmony_ci#include "ccu_nm.h" 2362306a36Sopenharmony_ci#include "ccu_phase.h" 2462306a36Sopenharmony_ci#include "ccu_sdm.h" 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#include "ccu-sun8i-h3.h" 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_cistatic SUNXI_CCU_NKMP_WITH_GATE_LOCK(pll_cpux_clk, "pll-cpux", 2962306a36Sopenharmony_ci "osc24M", 0x000, 3062306a36Sopenharmony_ci 8, 5, /* N */ 3162306a36Sopenharmony_ci 4, 2, /* K */ 3262306a36Sopenharmony_ci 0, 2, /* M */ 3362306a36Sopenharmony_ci 16, 2, /* P */ 3462306a36Sopenharmony_ci BIT(31), /* gate */ 3562306a36Sopenharmony_ci BIT(28), /* lock */ 3662306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci/* 3962306a36Sopenharmony_ci * The Audio PLL is supposed to have 4 outputs: 3 fixed factors from 4062306a36Sopenharmony_ci * the base (2x, 4x and 8x), and one variable divider (the one true 4162306a36Sopenharmony_ci * pll audio). 4262306a36Sopenharmony_ci * 4362306a36Sopenharmony_ci * With sigma-delta modulation for fractional-N on the audio PLL, 4462306a36Sopenharmony_ci * we have to use specific dividers. This means the variable divider 4562306a36Sopenharmony_ci * can no longer be used, as the audio codec requests the exact clock 4662306a36Sopenharmony_ci * rates we support through this mechanism. So we now hard code the 4762306a36Sopenharmony_ci * variable divider to 1. This means the clock rates will no longer 4862306a36Sopenharmony_ci * match the clock names. 4962306a36Sopenharmony_ci */ 5062306a36Sopenharmony_ci#define SUN8I_H3_PLL_AUDIO_REG 0x008 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_cistatic struct ccu_sdm_setting pll_audio_sdm_table[] = { 5362306a36Sopenharmony_ci { .rate = 22579200, .pattern = 0xc0010d84, .m = 8, .n = 7 }, 5462306a36Sopenharmony_ci { .rate = 24576000, .pattern = 0xc000ac02, .m = 14, .n = 14 }, 5562306a36Sopenharmony_ci}; 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", 5862306a36Sopenharmony_ci "osc24M", 0x008, 5962306a36Sopenharmony_ci 8, 7, /* N */ 6062306a36Sopenharmony_ci 0, 5, /* M */ 6162306a36Sopenharmony_ci pll_audio_sdm_table, BIT(24), 6262306a36Sopenharmony_ci 0x284, BIT(31), 6362306a36Sopenharmony_ci BIT(31), /* gate */ 6462306a36Sopenharmony_ci BIT(28), /* lock */ 6562306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX(pll_video_clk, "pll-video", 6862306a36Sopenharmony_ci "osc24M", 0x0010, 6962306a36Sopenharmony_ci 192000000, /* Minimum rate */ 7062306a36Sopenharmony_ci 912000000, /* Maximum rate */ 7162306a36Sopenharmony_ci 8, 7, /* N */ 7262306a36Sopenharmony_ci 0, 4, /* M */ 7362306a36Sopenharmony_ci BIT(24), /* frac enable */ 7462306a36Sopenharmony_ci BIT(25), /* frac select */ 7562306a36Sopenharmony_ci 270000000, /* frac rate 0 */ 7662306a36Sopenharmony_ci 297000000, /* frac rate 1 */ 7762306a36Sopenharmony_ci BIT(31), /* gate */ 7862306a36Sopenharmony_ci BIT(28), /* lock */ 7962306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", 8262306a36Sopenharmony_ci "osc24M", 0x0018, 8362306a36Sopenharmony_ci 8, 7, /* N */ 8462306a36Sopenharmony_ci 0, 4, /* M */ 8562306a36Sopenharmony_ci BIT(24), /* frac enable */ 8662306a36Sopenharmony_ci BIT(25), /* frac select */ 8762306a36Sopenharmony_ci 270000000, /* frac rate 0 */ 8862306a36Sopenharmony_ci 297000000, /* frac rate 1 */ 8962306a36Sopenharmony_ci BIT(31), /* gate */ 9062306a36Sopenharmony_ci BIT(28), /* lock */ 9162306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_cistatic SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr_clk, "pll-ddr", 9462306a36Sopenharmony_ci "osc24M", 0x020, 9562306a36Sopenharmony_ci 8, 5, /* N */ 9662306a36Sopenharmony_ci 4, 2, /* K */ 9762306a36Sopenharmony_ci 0, 2, /* M */ 9862306a36Sopenharmony_ci BIT(31), /* gate */ 9962306a36Sopenharmony_ci BIT(28), /* lock */ 10062306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_cistatic SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph0_clk, "pll-periph0", 10362306a36Sopenharmony_ci "osc24M", 0x028, 10462306a36Sopenharmony_ci 8, 5, /* N */ 10562306a36Sopenharmony_ci 4, 2, /* K */ 10662306a36Sopenharmony_ci BIT(31), /* gate */ 10762306a36Sopenharmony_ci BIT(28), /* lock */ 10862306a36Sopenharmony_ci 2, /* post-div */ 10962306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_gpu_clk, "pll-gpu", 11262306a36Sopenharmony_ci "osc24M", 0x0038, 11362306a36Sopenharmony_ci 8, 7, /* N */ 11462306a36Sopenharmony_ci 0, 4, /* M */ 11562306a36Sopenharmony_ci BIT(24), /* frac enable */ 11662306a36Sopenharmony_ci BIT(25), /* frac select */ 11762306a36Sopenharmony_ci 270000000, /* frac rate 0 */ 11862306a36Sopenharmony_ci 297000000, /* frac rate 1 */ 11962306a36Sopenharmony_ci BIT(31), /* gate */ 12062306a36Sopenharmony_ci BIT(28), /* lock */ 12162306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_cistatic SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph1_clk, "pll-periph1", 12462306a36Sopenharmony_ci "osc24M", 0x044, 12562306a36Sopenharmony_ci 8, 5, /* N */ 12662306a36Sopenharmony_ci 4, 2, /* K */ 12762306a36Sopenharmony_ci BIT(31), /* gate */ 12862306a36Sopenharmony_ci BIT(28), /* lock */ 12962306a36Sopenharmony_ci 2, /* post-div */ 13062306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_de_clk, "pll-de", 13362306a36Sopenharmony_ci "osc24M", 0x0048, 13462306a36Sopenharmony_ci 8, 7, /* N */ 13562306a36Sopenharmony_ci 0, 4, /* M */ 13662306a36Sopenharmony_ci BIT(24), /* frac enable */ 13762306a36Sopenharmony_ci BIT(25), /* frac select */ 13862306a36Sopenharmony_ci 270000000, /* frac rate 0 */ 13962306a36Sopenharmony_ci 297000000, /* frac rate 1 */ 14062306a36Sopenharmony_ci BIT(31), /* gate */ 14162306a36Sopenharmony_ci BIT(28), /* lock */ 14262306a36Sopenharmony_ci CLK_SET_RATE_UNGATE); 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_cistatic const char * const cpux_parents[] = { "osc32k", "osc24M", 14562306a36Sopenharmony_ci "pll-cpux" , "pll-cpux" }; 14662306a36Sopenharmony_cistatic SUNXI_CCU_MUX(cpux_clk, "cpux", cpux_parents, 14762306a36Sopenharmony_ci 0x050, 16, 2, CLK_IS_CRITICAL | CLK_SET_RATE_PARENT); 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_cistatic SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x050, 0, 2, 0); 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_cistatic const char * const ahb1_parents[] = { "osc32k", "osc24M", 15262306a36Sopenharmony_ci "axi" , "pll-periph0" }; 15362306a36Sopenharmony_cistatic const struct ccu_mux_var_prediv ahb1_predivs[] = { 15462306a36Sopenharmony_ci { .index = 3, .shift = 6, .width = 2 }, 15562306a36Sopenharmony_ci}; 15662306a36Sopenharmony_cistatic struct ccu_div ahb1_clk = { 15762306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO), 15862306a36Sopenharmony_ci 15962306a36Sopenharmony_ci .mux = { 16062306a36Sopenharmony_ci .shift = 12, 16162306a36Sopenharmony_ci .width = 2, 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci .var_predivs = ahb1_predivs, 16462306a36Sopenharmony_ci .n_var_predivs = ARRAY_SIZE(ahb1_predivs), 16562306a36Sopenharmony_ci }, 16662306a36Sopenharmony_ci 16762306a36Sopenharmony_ci .common = { 16862306a36Sopenharmony_ci .reg = 0x054, 16962306a36Sopenharmony_ci .features = CCU_FEATURE_VARIABLE_PREDIV, 17062306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb1", 17162306a36Sopenharmony_ci ahb1_parents, 17262306a36Sopenharmony_ci &ccu_div_ops, 17362306a36Sopenharmony_ci 0), 17462306a36Sopenharmony_ci }, 17562306a36Sopenharmony_ci}; 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_cistatic struct clk_div_table apb1_div_table[] = { 17862306a36Sopenharmony_ci { .val = 0, .div = 2 }, 17962306a36Sopenharmony_ci { .val = 1, .div = 2 }, 18062306a36Sopenharmony_ci { .val = 2, .div = 4 }, 18162306a36Sopenharmony_ci { .val = 3, .div = 8 }, 18262306a36Sopenharmony_ci { /* Sentinel */ }, 18362306a36Sopenharmony_ci}; 18462306a36Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(apb1_clk, "apb1", "ahb1", 18562306a36Sopenharmony_ci 0x054, 8, 2, apb1_div_table, 0); 18662306a36Sopenharmony_ci 18762306a36Sopenharmony_cistatic const char * const apb2_parents[] = { "osc32k", "osc24M", 18862306a36Sopenharmony_ci "pll-periph0" , "pll-periph0" }; 18962306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", apb2_parents, 0x058, 19062306a36Sopenharmony_ci 0, 5, /* M */ 19162306a36Sopenharmony_ci 16, 2, /* P */ 19262306a36Sopenharmony_ci 24, 2, /* mux */ 19362306a36Sopenharmony_ci 0); 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_cistatic const char * const ahb2_parents[] = { "ahb1" , "pll-periph0" }; 19662306a36Sopenharmony_cistatic const struct ccu_mux_fixed_prediv ahb2_fixed_predivs[] = { 19762306a36Sopenharmony_ci { .index = 1, .div = 2 }, 19862306a36Sopenharmony_ci}; 19962306a36Sopenharmony_cistatic struct ccu_mux ahb2_clk = { 20062306a36Sopenharmony_ci .mux = { 20162306a36Sopenharmony_ci .shift = 0, 20262306a36Sopenharmony_ci .width = 1, 20362306a36Sopenharmony_ci .fixed_predivs = ahb2_fixed_predivs, 20462306a36Sopenharmony_ci .n_predivs = ARRAY_SIZE(ahb2_fixed_predivs), 20562306a36Sopenharmony_ci }, 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci .common = { 20862306a36Sopenharmony_ci .reg = 0x05c, 20962306a36Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 21062306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb2", 21162306a36Sopenharmony_ci ahb2_parents, 21262306a36Sopenharmony_ci &ccu_mux_ops, 21362306a36Sopenharmony_ci 0), 21462306a36Sopenharmony_ci }, 21562306a36Sopenharmony_ci}; 21662306a36Sopenharmony_ci 21762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ce_clk, "bus-ce", "ahb1", 21862306a36Sopenharmony_ci 0x060, BIT(5), 0); 21962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "ahb1", 22062306a36Sopenharmony_ci 0x060, BIT(6), 0); 22162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb1", 22262306a36Sopenharmony_ci 0x060, BIT(8), 0); 22362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb1", 22462306a36Sopenharmony_ci 0x060, BIT(9), 0); 22562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc2_clk, "bus-mmc2", "ahb1", 22662306a36Sopenharmony_ci 0x060, BIT(10), 0); 22762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_nand_clk, "bus-nand", "ahb1", 22862306a36Sopenharmony_ci 0x060, BIT(13), 0); 22962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dram_clk, "bus-dram", "ahb1", 23062306a36Sopenharmony_ci 0x060, BIT(14), 0); 23162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_emac_clk, "bus-emac", "ahb2", 23262306a36Sopenharmony_ci 0x060, BIT(17), 0); 23362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ts_clk, "bus-ts", "ahb1", 23462306a36Sopenharmony_ci 0x060, BIT(18), 0); 23562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "ahb1", 23662306a36Sopenharmony_ci 0x060, BIT(19), 0); 23762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb1", 23862306a36Sopenharmony_ci 0x060, BIT(20), 0); 23962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi1_clk, "bus-spi1", "ahb1", 24062306a36Sopenharmony_ci 0x060, BIT(21), 0); 24162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb1", 24262306a36Sopenharmony_ci 0x060, BIT(23), 0); 24362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci0_clk, "bus-ehci0", "ahb1", 24462306a36Sopenharmony_ci 0x060, BIT(24), 0); 24562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci1_clk, "bus-ehci1", "ahb2", 24662306a36Sopenharmony_ci 0x060, BIT(25), 0); 24762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci2_clk, "bus-ehci2", "ahb2", 24862306a36Sopenharmony_ci 0x060, BIT(26), 0); 24962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci3_clk, "bus-ehci3", "ahb2", 25062306a36Sopenharmony_ci 0x060, BIT(27), 0); 25162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci0_clk, "bus-ohci0", "ahb1", 25262306a36Sopenharmony_ci 0x060, BIT(28), 0); 25362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci1_clk, "bus-ohci1", "ahb2", 25462306a36Sopenharmony_ci 0x060, BIT(29), 0); 25562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci2_clk, "bus-ohci2", "ahb2", 25662306a36Sopenharmony_ci 0x060, BIT(30), 0); 25762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci3_clk, "bus-ohci3", "ahb2", 25862306a36Sopenharmony_ci 0x060, BIT(31), 0); 25962306a36Sopenharmony_ci 26062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "ahb1", 26162306a36Sopenharmony_ci 0x064, BIT(0), 0); 26262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tcon0_clk, "bus-tcon0", "ahb1", 26362306a36Sopenharmony_ci 0x064, BIT(3), 0); 26462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tcon1_clk, "bus-tcon1", "ahb1", 26562306a36Sopenharmony_ci 0x064, BIT(4), 0); 26662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_deinterlace_clk, "bus-deinterlace", "ahb1", 26762306a36Sopenharmony_ci 0x064, BIT(5), 0); 26862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_csi_clk, "bus-csi", "ahb1", 26962306a36Sopenharmony_ci 0x064, BIT(8), 0); 27062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tve_clk, "bus-tve", "ahb1", 27162306a36Sopenharmony_ci 0x064, BIT(9), 0); 27262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hdmi_clk, "bus-hdmi", "ahb1", 27362306a36Sopenharmony_ci 0x064, BIT(11), 0); 27462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_de_clk, "bus-de", "ahb1", 27562306a36Sopenharmony_ci 0x064, BIT(12), 0); 27662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gpu_clk, "bus-gpu", "ahb1", 27762306a36Sopenharmony_ci 0x064, BIT(20), 0); 27862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_msgbox_clk, "bus-msgbox", "ahb1", 27962306a36Sopenharmony_ci 0x064, BIT(21), 0); 28062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spinlock_clk, "bus-spinlock", "ahb1", 28162306a36Sopenharmony_ci 0x064, BIT(22), 0); 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_codec_clk, "bus-codec", "apb1", 28462306a36Sopenharmony_ci 0x068, BIT(0), 0); 28562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spdif_clk, "bus-spdif", "apb1", 28662306a36Sopenharmony_ci 0x068, BIT(1), 0); 28762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_pio_clk, "bus-pio", "apb1", 28862306a36Sopenharmony_ci 0x068, BIT(5), 0); 28962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ths_clk, "bus-ths", "apb1", 29062306a36Sopenharmony_ci 0x068, BIT(8), 0); 29162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s0_clk, "bus-i2s0", "apb1", 29262306a36Sopenharmony_ci 0x068, BIT(12), 0); 29362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s1_clk, "bus-i2s1", "apb1", 29462306a36Sopenharmony_ci 0x068, BIT(13), 0); 29562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s2_clk, "bus-i2s2", "apb1", 29662306a36Sopenharmony_ci 0x068, BIT(14), 0); 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb2", 29962306a36Sopenharmony_ci 0x06c, BIT(0), 0); 30062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb2", 30162306a36Sopenharmony_ci 0x06c, BIT(1), 0); 30262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb2", 30362306a36Sopenharmony_ci 0x06c, BIT(2), 0); 30462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb2", 30562306a36Sopenharmony_ci 0x06c, BIT(16), 0); 30662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb2", 30762306a36Sopenharmony_ci 0x06c, BIT(17), 0); 30862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb2", 30962306a36Sopenharmony_ci 0x06c, BIT(18), 0); 31062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb2", 31162306a36Sopenharmony_ci 0x06c, BIT(19), 0); 31262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_scr0_clk, "bus-scr0", "apb2", 31362306a36Sopenharmony_ci 0x06c, BIT(20), 0); 31462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_scr1_clk, "bus-scr1", "apb2", 31562306a36Sopenharmony_ci 0x06c, BIT(21), 0); 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ephy_clk, "bus-ephy", "ahb1", 31862306a36Sopenharmony_ci 0x070, BIT(0), 0); 31962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dbg_clk, "bus-dbg", "ahb1", 32062306a36Sopenharmony_ci 0x070, BIT(7), 0); 32162306a36Sopenharmony_ci 32262306a36Sopenharmony_cistatic struct clk_div_table ths_div_table[] = { 32362306a36Sopenharmony_ci { .val = 0, .div = 1 }, 32462306a36Sopenharmony_ci { .val = 1, .div = 2 }, 32562306a36Sopenharmony_ci { .val = 2, .div = 4 }, 32662306a36Sopenharmony_ci { .val = 3, .div = 6 }, 32762306a36Sopenharmony_ci { /* Sentinel */ }, 32862306a36Sopenharmony_ci}; 32962306a36Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE_WITH_GATE(ths_clk, "ths", "osc24M", 33062306a36Sopenharmony_ci 0x074, 0, 2, ths_div_table, BIT(31), 0); 33162306a36Sopenharmony_ci 33262306a36Sopenharmony_cistatic const char * const mod0_default_parents[] = { "osc24M", "pll-periph0", 33362306a36Sopenharmony_ci "pll-periph1" }; 33462306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand_clk, "nand", mod0_default_parents, 0x080, 33562306a36Sopenharmony_ci 0, 4, /* M */ 33662306a36Sopenharmony_ci 16, 2, /* P */ 33762306a36Sopenharmony_ci 24, 2, /* mux */ 33862306a36Sopenharmony_ci BIT(31), /* gate */ 33962306a36Sopenharmony_ci 0); 34062306a36Sopenharmony_ci 34162306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 0x088, 34262306a36Sopenharmony_ci 0, 4, /* M */ 34362306a36Sopenharmony_ci 16, 2, /* P */ 34462306a36Sopenharmony_ci 24, 2, /* mux */ 34562306a36Sopenharmony_ci BIT(31), /* gate */ 34662306a36Sopenharmony_ci 0); 34762306a36Sopenharmony_ci 34862306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_sample_clk, "mmc0_sample", "mmc0", 34962306a36Sopenharmony_ci 0x088, 20, 3, 0); 35062306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_output_clk, "mmc0_output", "mmc0", 35162306a36Sopenharmony_ci 0x088, 8, 3, 0); 35262306a36Sopenharmony_ci 35362306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 0x08c, 35462306a36Sopenharmony_ci 0, 4, /* M */ 35562306a36Sopenharmony_ci 16, 2, /* P */ 35662306a36Sopenharmony_ci 24, 2, /* mux */ 35762306a36Sopenharmony_ci BIT(31), /* gate */ 35862306a36Sopenharmony_ci 0); 35962306a36Sopenharmony_ci 36062306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1_sample", "mmc1", 36162306a36Sopenharmony_ci 0x08c, 20, 3, 0); 36262306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1_output", "mmc1", 36362306a36Sopenharmony_ci 0x08c, 8, 3, 0); 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 0x090, 36662306a36Sopenharmony_ci 0, 4, /* M */ 36762306a36Sopenharmony_ci 16, 2, /* P */ 36862306a36Sopenharmony_ci 24, 2, /* mux */ 36962306a36Sopenharmony_ci BIT(31), /* gate */ 37062306a36Sopenharmony_ci 0); 37162306a36Sopenharmony_ci 37262306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2_sample", "mmc2", 37362306a36Sopenharmony_ci 0x090, 20, 3, 0); 37462306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_output_clk, "mmc2_output", "mmc2", 37562306a36Sopenharmony_ci 0x090, 8, 3, 0); 37662306a36Sopenharmony_ci 37762306a36Sopenharmony_cistatic const char * const ts_parents[] = { "osc24M", "pll-periph0", }; 37862306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ts_clk, "ts", ts_parents, 0x098, 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_MP_WITH_MUX_GATE(ce_clk, "ce", mod0_default_parents, 0x09c, 38662306a36Sopenharmony_ci 0, 4, /* M */ 38762306a36Sopenharmony_ci 16, 2, /* P */ 38862306a36Sopenharmony_ci 24, 2, /* mux */ 38962306a36Sopenharmony_ci BIT(31), /* gate */ 39062306a36Sopenharmony_ci 0); 39162306a36Sopenharmony_ci 39262306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 0x0a0, 39362306a36Sopenharmony_ci 0, 4, /* M */ 39462306a36Sopenharmony_ci 16, 2, /* P */ 39562306a36Sopenharmony_ci 24, 2, /* mux */ 39662306a36Sopenharmony_ci BIT(31), /* gate */ 39762306a36Sopenharmony_ci 0); 39862306a36Sopenharmony_ci 39962306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 0x0a4, 40062306a36Sopenharmony_ci 0, 4, /* M */ 40162306a36Sopenharmony_ci 16, 2, /* P */ 40262306a36Sopenharmony_ci 24, 2, /* mux */ 40362306a36Sopenharmony_ci BIT(31), /* gate */ 40462306a36Sopenharmony_ci 0); 40562306a36Sopenharmony_ci 40662306a36Sopenharmony_cistatic const char * const i2s_parents[] = { "pll-audio-8x", "pll-audio-4x", 40762306a36Sopenharmony_ci "pll-audio-2x", "pll-audio" }; 40862306a36Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s0_clk, "i2s0", i2s_parents, 40962306a36Sopenharmony_ci 0x0b0, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 41062306a36Sopenharmony_ci 41162306a36Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s1_clk, "i2s1", i2s_parents, 41262306a36Sopenharmony_ci 0x0b4, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 41362306a36Sopenharmony_ci 41462306a36Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s2_clk, "i2s2", i2s_parents, 41562306a36Sopenharmony_ci 0x0b8, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 41662306a36Sopenharmony_ci 41762306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(spdif_clk, "spdif", "pll-audio", 41862306a36Sopenharmony_ci 0x0c0, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 41962306a36Sopenharmony_ci 42062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M", 42162306a36Sopenharmony_ci 0x0cc, BIT(8), 0); 42262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "osc24M", 42362306a36Sopenharmony_ci 0x0cc, BIT(9), 0); 42462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy2_clk, "usb-phy2", "osc24M", 42562306a36Sopenharmony_ci 0x0cc, BIT(10), 0); 42662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy3_clk, "usb-phy3", "osc24M", 42762306a36Sopenharmony_ci 0x0cc, BIT(11), 0); 42862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc24M", 42962306a36Sopenharmony_ci 0x0cc, BIT(16), 0); 43062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci1_clk, "usb-ohci1", "osc24M", 43162306a36Sopenharmony_ci 0x0cc, BIT(17), 0); 43262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci2_clk, "usb-ohci2", "osc24M", 43362306a36Sopenharmony_ci 0x0cc, BIT(18), 0); 43462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci3_clk, "usb-ohci3", "osc24M", 43562306a36Sopenharmony_ci 0x0cc, BIT(19), 0); 43662306a36Sopenharmony_ci 43762306a36Sopenharmony_ci/* H3 has broken MDFS hardware, so the mux/divider cannot be changed. */ 43862306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(h3_dram_clk, "dram", 43962306a36Sopenharmony_ci &pll_ddr_clk.common.hw, 44062306a36Sopenharmony_ci 1, 1, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 44162306a36Sopenharmony_ci 44262306a36Sopenharmony_cistatic const char * const h5_dram_parents[] = { "pll-ddr", "pll-periph0-2x" }; 44362306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX(h5_dram_clk, "dram", h5_dram_parents, 44462306a36Sopenharmony_ci 0x0f4, 0, 4, 20, 2, CLK_IS_CRITICAL); 44562306a36Sopenharmony_ci 44662306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ve_clk, "dram-ve", "dram", 44762306a36Sopenharmony_ci 0x100, BIT(0), 0); 44862306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_csi_clk, "dram-csi", "dram", 44962306a36Sopenharmony_ci 0x100, BIT(1), 0); 45062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_deinterlace_clk, "dram-deinterlace", "dram", 45162306a36Sopenharmony_ci 0x100, BIT(2), 0); 45262306a36Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ts_clk, "dram-ts", "dram", 45362306a36Sopenharmony_ci 0x100, BIT(3), 0); 45462306a36Sopenharmony_ci 45562306a36Sopenharmony_cistatic const char * const de_parents[] = { "pll-periph0-2x", "pll-de" }; 45662306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents, 45762306a36Sopenharmony_ci 0x104, 0, 4, 24, 3, BIT(31), 45862306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 45962306a36Sopenharmony_ci 46062306a36Sopenharmony_cistatic const char * const tcon_parents[] = { "pll-video" }; 46162306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(tcon_clk, "tcon", tcon_parents, 46262306a36Sopenharmony_ci 0x118, 0, 4, 24, 3, BIT(31), 46362306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 46462306a36Sopenharmony_ci 46562306a36Sopenharmony_cistatic const char * const tve_parents[] = { "pll-de", "pll-periph1" }; 46662306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(tve_clk, "tve", tve_parents, 46762306a36Sopenharmony_ci 0x120, 0, 4, 24, 3, BIT(31), 0); 46862306a36Sopenharmony_ci 46962306a36Sopenharmony_cistatic const char * const deinterlace_parents[] = { "pll-periph0", "pll-periph1" }; 47062306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(deinterlace_clk, "deinterlace", deinterlace_parents, 47162306a36Sopenharmony_ci 0x124, 0, 4, 24, 3, BIT(31), 0); 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(csi_misc_clk, "csi-misc", "osc24M", 47462306a36Sopenharmony_ci 0x130, BIT(31), 0); 47562306a36Sopenharmony_ci 47662306a36Sopenharmony_cistatic const char * const csi_sclk_parents[] = { "pll-periph0", "pll-periph1" }; 47762306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi_sclk_clk, "csi-sclk", csi_sclk_parents, 47862306a36Sopenharmony_ci 0x134, 16, 4, 24, 3, BIT(31), 0); 47962306a36Sopenharmony_ci 48062306a36Sopenharmony_cistatic const char * const csi_mclk_parents[] = { "osc24M", "pll-video", "pll-periph1" }; 48162306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi_mclk_clk, "csi-mclk", csi_mclk_parents, 48262306a36Sopenharmony_ci 0x134, 0, 5, 8, 3, BIT(15), 0); 48362306a36Sopenharmony_ci 48462306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve", 48562306a36Sopenharmony_ci 0x13c, 16, 3, BIT(31), CLK_SET_RATE_PARENT); 48662306a36Sopenharmony_ci 48762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(ac_dig_clk, "ac-dig", "pll-audio", 48862306a36Sopenharmony_ci 0x140, BIT(31), CLK_SET_RATE_PARENT); 48962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", 49062306a36Sopenharmony_ci 0x144, BIT(31), 0); 49162306a36Sopenharmony_ci 49262306a36Sopenharmony_cistatic const char * const hdmi_parents[] = { "pll-video" }; 49362306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", hdmi_parents, 49462306a36Sopenharmony_ci 0x150, 0, 4, 24, 2, BIT(31), 49562306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 49662306a36Sopenharmony_ci 49762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(hdmi_ddc_clk, "hdmi-ddc", "osc24M", 49862306a36Sopenharmony_ci 0x154, BIT(31), 0); 49962306a36Sopenharmony_ci 50062306a36Sopenharmony_cistatic const char * const mbus_parents[] = { "osc24M", "pll-periph0-2x", "pll-ddr" }; 50162306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents, 50262306a36Sopenharmony_ci 0x15c, 0, 3, 24, 2, BIT(31), CLK_IS_CRITICAL); 50362306a36Sopenharmony_ci 50462306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(gpu_clk, "gpu", "pll-gpu", 50562306a36Sopenharmony_ci 0x1a0, 0, 3, BIT(31), CLK_SET_RATE_PARENT); 50662306a36Sopenharmony_ci 50762306a36Sopenharmony_cistatic struct ccu_common *sun8i_h3_ccu_clks[] = { 50862306a36Sopenharmony_ci &pll_cpux_clk.common, 50962306a36Sopenharmony_ci &pll_audio_base_clk.common, 51062306a36Sopenharmony_ci &pll_video_clk.common, 51162306a36Sopenharmony_ci &pll_ve_clk.common, 51262306a36Sopenharmony_ci &pll_ddr_clk.common, 51362306a36Sopenharmony_ci &pll_periph0_clk.common, 51462306a36Sopenharmony_ci &pll_gpu_clk.common, 51562306a36Sopenharmony_ci &pll_periph1_clk.common, 51662306a36Sopenharmony_ci &pll_de_clk.common, 51762306a36Sopenharmony_ci &cpux_clk.common, 51862306a36Sopenharmony_ci &axi_clk.common, 51962306a36Sopenharmony_ci &ahb1_clk.common, 52062306a36Sopenharmony_ci &apb1_clk.common, 52162306a36Sopenharmony_ci &apb2_clk.common, 52262306a36Sopenharmony_ci &ahb2_clk.common, 52362306a36Sopenharmony_ci &bus_ce_clk.common, 52462306a36Sopenharmony_ci &bus_dma_clk.common, 52562306a36Sopenharmony_ci &bus_mmc0_clk.common, 52662306a36Sopenharmony_ci &bus_mmc1_clk.common, 52762306a36Sopenharmony_ci &bus_mmc2_clk.common, 52862306a36Sopenharmony_ci &bus_nand_clk.common, 52962306a36Sopenharmony_ci &bus_dram_clk.common, 53062306a36Sopenharmony_ci &bus_emac_clk.common, 53162306a36Sopenharmony_ci &bus_ts_clk.common, 53262306a36Sopenharmony_ci &bus_hstimer_clk.common, 53362306a36Sopenharmony_ci &bus_spi0_clk.common, 53462306a36Sopenharmony_ci &bus_spi1_clk.common, 53562306a36Sopenharmony_ci &bus_otg_clk.common, 53662306a36Sopenharmony_ci &bus_ehci0_clk.common, 53762306a36Sopenharmony_ci &bus_ehci1_clk.common, 53862306a36Sopenharmony_ci &bus_ehci2_clk.common, 53962306a36Sopenharmony_ci &bus_ehci3_clk.common, 54062306a36Sopenharmony_ci &bus_ohci0_clk.common, 54162306a36Sopenharmony_ci &bus_ohci1_clk.common, 54262306a36Sopenharmony_ci &bus_ohci2_clk.common, 54362306a36Sopenharmony_ci &bus_ohci3_clk.common, 54462306a36Sopenharmony_ci &bus_ve_clk.common, 54562306a36Sopenharmony_ci &bus_tcon0_clk.common, 54662306a36Sopenharmony_ci &bus_tcon1_clk.common, 54762306a36Sopenharmony_ci &bus_deinterlace_clk.common, 54862306a36Sopenharmony_ci &bus_csi_clk.common, 54962306a36Sopenharmony_ci &bus_tve_clk.common, 55062306a36Sopenharmony_ci &bus_hdmi_clk.common, 55162306a36Sopenharmony_ci &bus_de_clk.common, 55262306a36Sopenharmony_ci &bus_gpu_clk.common, 55362306a36Sopenharmony_ci &bus_msgbox_clk.common, 55462306a36Sopenharmony_ci &bus_spinlock_clk.common, 55562306a36Sopenharmony_ci &bus_codec_clk.common, 55662306a36Sopenharmony_ci &bus_spdif_clk.common, 55762306a36Sopenharmony_ci &bus_pio_clk.common, 55862306a36Sopenharmony_ci &bus_ths_clk.common, 55962306a36Sopenharmony_ci &bus_i2s0_clk.common, 56062306a36Sopenharmony_ci &bus_i2s1_clk.common, 56162306a36Sopenharmony_ci &bus_i2s2_clk.common, 56262306a36Sopenharmony_ci &bus_i2c0_clk.common, 56362306a36Sopenharmony_ci &bus_i2c1_clk.common, 56462306a36Sopenharmony_ci &bus_i2c2_clk.common, 56562306a36Sopenharmony_ci &bus_uart0_clk.common, 56662306a36Sopenharmony_ci &bus_uart1_clk.common, 56762306a36Sopenharmony_ci &bus_uart2_clk.common, 56862306a36Sopenharmony_ci &bus_uart3_clk.common, 56962306a36Sopenharmony_ci &bus_scr0_clk.common, 57062306a36Sopenharmony_ci &bus_scr1_clk.common, 57162306a36Sopenharmony_ci &bus_ephy_clk.common, 57262306a36Sopenharmony_ci &bus_dbg_clk.common, 57362306a36Sopenharmony_ci &ths_clk.common, 57462306a36Sopenharmony_ci &nand_clk.common, 57562306a36Sopenharmony_ci &mmc0_clk.common, 57662306a36Sopenharmony_ci &mmc0_sample_clk.common, 57762306a36Sopenharmony_ci &mmc0_output_clk.common, 57862306a36Sopenharmony_ci &mmc1_clk.common, 57962306a36Sopenharmony_ci &mmc1_sample_clk.common, 58062306a36Sopenharmony_ci &mmc1_output_clk.common, 58162306a36Sopenharmony_ci &mmc2_clk.common, 58262306a36Sopenharmony_ci &mmc2_sample_clk.common, 58362306a36Sopenharmony_ci &mmc2_output_clk.common, 58462306a36Sopenharmony_ci &ts_clk.common, 58562306a36Sopenharmony_ci &ce_clk.common, 58662306a36Sopenharmony_ci &spi0_clk.common, 58762306a36Sopenharmony_ci &spi1_clk.common, 58862306a36Sopenharmony_ci &i2s0_clk.common, 58962306a36Sopenharmony_ci &i2s1_clk.common, 59062306a36Sopenharmony_ci &i2s2_clk.common, 59162306a36Sopenharmony_ci &spdif_clk.common, 59262306a36Sopenharmony_ci &usb_phy0_clk.common, 59362306a36Sopenharmony_ci &usb_phy1_clk.common, 59462306a36Sopenharmony_ci &usb_phy2_clk.common, 59562306a36Sopenharmony_ci &usb_phy3_clk.common, 59662306a36Sopenharmony_ci &usb_ohci0_clk.common, 59762306a36Sopenharmony_ci &usb_ohci1_clk.common, 59862306a36Sopenharmony_ci &usb_ohci2_clk.common, 59962306a36Sopenharmony_ci &usb_ohci3_clk.common, 60062306a36Sopenharmony_ci &h5_dram_clk.common, 60162306a36Sopenharmony_ci &dram_ve_clk.common, 60262306a36Sopenharmony_ci &dram_csi_clk.common, 60362306a36Sopenharmony_ci &dram_deinterlace_clk.common, 60462306a36Sopenharmony_ci &dram_ts_clk.common, 60562306a36Sopenharmony_ci &de_clk.common, 60662306a36Sopenharmony_ci &tcon_clk.common, 60762306a36Sopenharmony_ci &tve_clk.common, 60862306a36Sopenharmony_ci &deinterlace_clk.common, 60962306a36Sopenharmony_ci &csi_misc_clk.common, 61062306a36Sopenharmony_ci &csi_sclk_clk.common, 61162306a36Sopenharmony_ci &csi_mclk_clk.common, 61262306a36Sopenharmony_ci &ve_clk.common, 61362306a36Sopenharmony_ci &ac_dig_clk.common, 61462306a36Sopenharmony_ci &avs_clk.common, 61562306a36Sopenharmony_ci &hdmi_clk.common, 61662306a36Sopenharmony_ci &hdmi_ddc_clk.common, 61762306a36Sopenharmony_ci &mbus_clk.common, 61862306a36Sopenharmony_ci &gpu_clk.common, 61962306a36Sopenharmony_ci}; 62062306a36Sopenharmony_ci 62162306a36Sopenharmony_cistatic const struct clk_hw *clk_parent_pll_audio[] = { 62262306a36Sopenharmony_ci &pll_audio_base_clk.common.hw 62362306a36Sopenharmony_ci}; 62462306a36Sopenharmony_ci 62562306a36Sopenharmony_ci/* We hardcode the divider to 1 for now */ 62662306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 62762306a36Sopenharmony_ci clk_parent_pll_audio, 62862306a36Sopenharmony_ci 1, 1, CLK_SET_RATE_PARENT); 62962306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 63062306a36Sopenharmony_ci clk_parent_pll_audio, 63162306a36Sopenharmony_ci 2, 1, CLK_SET_RATE_PARENT); 63262306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 63362306a36Sopenharmony_ci clk_parent_pll_audio, 63462306a36Sopenharmony_ci 1, 1, CLK_SET_RATE_PARENT); 63562306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 63662306a36Sopenharmony_ci clk_parent_pll_audio, 63762306a36Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 63862306a36Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_periph0_2x_clk, "pll-periph0-2x", 63962306a36Sopenharmony_ci &pll_periph0_clk.common.hw, 64062306a36Sopenharmony_ci 1, 2, 0); 64162306a36Sopenharmony_ci 64262306a36Sopenharmony_cistatic struct clk_hw_onecell_data sun8i_h3_hw_clks = { 64362306a36Sopenharmony_ci .hws = { 64462306a36Sopenharmony_ci [CLK_PLL_CPUX] = &pll_cpux_clk.common.hw, 64562306a36Sopenharmony_ci [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, 64662306a36Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.hw, 64762306a36Sopenharmony_ci [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, 64862306a36Sopenharmony_ci [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, 64962306a36Sopenharmony_ci [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, 65062306a36Sopenharmony_ci [CLK_PLL_VIDEO] = &pll_video_clk.common.hw, 65162306a36Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 65262306a36Sopenharmony_ci [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 65362306a36Sopenharmony_ci [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw, 65462306a36Sopenharmony_ci [CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw, 65562306a36Sopenharmony_ci [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 65662306a36Sopenharmony_ci [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw, 65762306a36Sopenharmony_ci [CLK_PLL_DE] = &pll_de_clk.common.hw, 65862306a36Sopenharmony_ci [CLK_CPUX] = &cpux_clk.common.hw, 65962306a36Sopenharmony_ci [CLK_AXI] = &axi_clk.common.hw, 66062306a36Sopenharmony_ci [CLK_AHB1] = &ahb1_clk.common.hw, 66162306a36Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 66262306a36Sopenharmony_ci [CLK_APB2] = &apb2_clk.common.hw, 66362306a36Sopenharmony_ci [CLK_AHB2] = &ahb2_clk.common.hw, 66462306a36Sopenharmony_ci [CLK_BUS_CE] = &bus_ce_clk.common.hw, 66562306a36Sopenharmony_ci [CLK_BUS_DMA] = &bus_dma_clk.common.hw, 66662306a36Sopenharmony_ci [CLK_BUS_MMC0] = &bus_mmc0_clk.common.hw, 66762306a36Sopenharmony_ci [CLK_BUS_MMC1] = &bus_mmc1_clk.common.hw, 66862306a36Sopenharmony_ci [CLK_BUS_MMC2] = &bus_mmc2_clk.common.hw, 66962306a36Sopenharmony_ci [CLK_BUS_NAND] = &bus_nand_clk.common.hw, 67062306a36Sopenharmony_ci [CLK_BUS_DRAM] = &bus_dram_clk.common.hw, 67162306a36Sopenharmony_ci [CLK_BUS_EMAC] = &bus_emac_clk.common.hw, 67262306a36Sopenharmony_ci [CLK_BUS_TS] = &bus_ts_clk.common.hw, 67362306a36Sopenharmony_ci [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw, 67462306a36Sopenharmony_ci [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw, 67562306a36Sopenharmony_ci [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw, 67662306a36Sopenharmony_ci [CLK_BUS_OTG] = &bus_otg_clk.common.hw, 67762306a36Sopenharmony_ci [CLK_BUS_EHCI0] = &bus_ehci0_clk.common.hw, 67862306a36Sopenharmony_ci [CLK_BUS_EHCI1] = &bus_ehci1_clk.common.hw, 67962306a36Sopenharmony_ci [CLK_BUS_EHCI2] = &bus_ehci2_clk.common.hw, 68062306a36Sopenharmony_ci [CLK_BUS_EHCI3] = &bus_ehci3_clk.common.hw, 68162306a36Sopenharmony_ci [CLK_BUS_OHCI0] = &bus_ohci0_clk.common.hw, 68262306a36Sopenharmony_ci [CLK_BUS_OHCI1] = &bus_ohci1_clk.common.hw, 68362306a36Sopenharmony_ci [CLK_BUS_OHCI2] = &bus_ohci2_clk.common.hw, 68462306a36Sopenharmony_ci [CLK_BUS_OHCI3] = &bus_ohci3_clk.common.hw, 68562306a36Sopenharmony_ci [CLK_BUS_VE] = &bus_ve_clk.common.hw, 68662306a36Sopenharmony_ci [CLK_BUS_TCON0] = &bus_tcon0_clk.common.hw, 68762306a36Sopenharmony_ci [CLK_BUS_TCON1] = &bus_tcon1_clk.common.hw, 68862306a36Sopenharmony_ci [CLK_BUS_DEINTERLACE] = &bus_deinterlace_clk.common.hw, 68962306a36Sopenharmony_ci [CLK_BUS_CSI] = &bus_csi_clk.common.hw, 69062306a36Sopenharmony_ci [CLK_BUS_TVE] = &bus_tve_clk.common.hw, 69162306a36Sopenharmony_ci [CLK_BUS_HDMI] = &bus_hdmi_clk.common.hw, 69262306a36Sopenharmony_ci [CLK_BUS_DE] = &bus_de_clk.common.hw, 69362306a36Sopenharmony_ci [CLK_BUS_GPU] = &bus_gpu_clk.common.hw, 69462306a36Sopenharmony_ci [CLK_BUS_MSGBOX] = &bus_msgbox_clk.common.hw, 69562306a36Sopenharmony_ci [CLK_BUS_SPINLOCK] = &bus_spinlock_clk.common.hw, 69662306a36Sopenharmony_ci [CLK_BUS_CODEC] = &bus_codec_clk.common.hw, 69762306a36Sopenharmony_ci [CLK_BUS_SPDIF] = &bus_spdif_clk.common.hw, 69862306a36Sopenharmony_ci [CLK_BUS_PIO] = &bus_pio_clk.common.hw, 69962306a36Sopenharmony_ci [CLK_BUS_THS] = &bus_ths_clk.common.hw, 70062306a36Sopenharmony_ci [CLK_BUS_I2S0] = &bus_i2s0_clk.common.hw, 70162306a36Sopenharmony_ci [CLK_BUS_I2S1] = &bus_i2s1_clk.common.hw, 70262306a36Sopenharmony_ci [CLK_BUS_I2S2] = &bus_i2s2_clk.common.hw, 70362306a36Sopenharmony_ci [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw, 70462306a36Sopenharmony_ci [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw, 70562306a36Sopenharmony_ci [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw, 70662306a36Sopenharmony_ci [CLK_BUS_UART0] = &bus_uart0_clk.common.hw, 70762306a36Sopenharmony_ci [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 70862306a36Sopenharmony_ci [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 70962306a36Sopenharmony_ci [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 71062306a36Sopenharmony_ci [CLK_BUS_SCR0] = &bus_scr0_clk.common.hw, 71162306a36Sopenharmony_ci [CLK_BUS_EPHY] = &bus_ephy_clk.common.hw, 71262306a36Sopenharmony_ci [CLK_BUS_DBG] = &bus_dbg_clk.common.hw, 71362306a36Sopenharmony_ci [CLK_THS] = &ths_clk.common.hw, 71462306a36Sopenharmony_ci [CLK_NAND] = &nand_clk.common.hw, 71562306a36Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 71662306a36Sopenharmony_ci [CLK_MMC0_SAMPLE] = &mmc0_sample_clk.common.hw, 71762306a36Sopenharmony_ci [CLK_MMC0_OUTPUT] = &mmc0_output_clk.common.hw, 71862306a36Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 71962306a36Sopenharmony_ci [CLK_MMC1_SAMPLE] = &mmc1_sample_clk.common.hw, 72062306a36Sopenharmony_ci [CLK_MMC1_OUTPUT] = &mmc1_output_clk.common.hw, 72162306a36Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 72262306a36Sopenharmony_ci [CLK_MMC2_SAMPLE] = &mmc2_sample_clk.common.hw, 72362306a36Sopenharmony_ci [CLK_MMC2_OUTPUT] = &mmc2_output_clk.common.hw, 72462306a36Sopenharmony_ci [CLK_TS] = &ts_clk.common.hw, 72562306a36Sopenharmony_ci [CLK_CE] = &ce_clk.common.hw, 72662306a36Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 72762306a36Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 72862306a36Sopenharmony_ci [CLK_I2S0] = &i2s0_clk.common.hw, 72962306a36Sopenharmony_ci [CLK_I2S1] = &i2s1_clk.common.hw, 73062306a36Sopenharmony_ci [CLK_I2S2] = &i2s2_clk.common.hw, 73162306a36Sopenharmony_ci [CLK_SPDIF] = &spdif_clk.common.hw, 73262306a36Sopenharmony_ci [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 73362306a36Sopenharmony_ci [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 73462306a36Sopenharmony_ci [CLK_USB_PHY2] = &usb_phy2_clk.common.hw, 73562306a36Sopenharmony_ci [CLK_USB_PHY3] = &usb_phy3_clk.common.hw, 73662306a36Sopenharmony_ci [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw, 73762306a36Sopenharmony_ci [CLK_USB_OHCI1] = &usb_ohci1_clk.common.hw, 73862306a36Sopenharmony_ci [CLK_USB_OHCI2] = &usb_ohci2_clk.common.hw, 73962306a36Sopenharmony_ci [CLK_USB_OHCI3] = &usb_ohci3_clk.common.hw, 74062306a36Sopenharmony_ci [CLK_DRAM] = &h3_dram_clk.hw, 74162306a36Sopenharmony_ci [CLK_DRAM_VE] = &dram_ve_clk.common.hw, 74262306a36Sopenharmony_ci [CLK_DRAM_CSI] = &dram_csi_clk.common.hw, 74362306a36Sopenharmony_ci [CLK_DRAM_DEINTERLACE] = &dram_deinterlace_clk.common.hw, 74462306a36Sopenharmony_ci [CLK_DRAM_TS] = &dram_ts_clk.common.hw, 74562306a36Sopenharmony_ci [CLK_DE] = &de_clk.common.hw, 74662306a36Sopenharmony_ci [CLK_TCON0] = &tcon_clk.common.hw, 74762306a36Sopenharmony_ci [CLK_TVE] = &tve_clk.common.hw, 74862306a36Sopenharmony_ci [CLK_DEINTERLACE] = &deinterlace_clk.common.hw, 74962306a36Sopenharmony_ci [CLK_CSI_MISC] = &csi_misc_clk.common.hw, 75062306a36Sopenharmony_ci [CLK_CSI_SCLK] = &csi_sclk_clk.common.hw, 75162306a36Sopenharmony_ci [CLK_CSI_MCLK] = &csi_mclk_clk.common.hw, 75262306a36Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 75362306a36Sopenharmony_ci [CLK_AC_DIG] = &ac_dig_clk.common.hw, 75462306a36Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 75562306a36Sopenharmony_ci [CLK_HDMI] = &hdmi_clk.common.hw, 75662306a36Sopenharmony_ci [CLK_HDMI_DDC] = &hdmi_ddc_clk.common.hw, 75762306a36Sopenharmony_ci [CLK_MBUS] = &mbus_clk.common.hw, 75862306a36Sopenharmony_ci [CLK_GPU] = &gpu_clk.common.hw, 75962306a36Sopenharmony_ci }, 76062306a36Sopenharmony_ci .num = CLK_NUMBER_H3, 76162306a36Sopenharmony_ci}; 76262306a36Sopenharmony_ci 76362306a36Sopenharmony_cistatic struct clk_hw_onecell_data sun50i_h5_hw_clks = { 76462306a36Sopenharmony_ci .hws = { 76562306a36Sopenharmony_ci [CLK_PLL_CPUX] = &pll_cpux_clk.common.hw, 76662306a36Sopenharmony_ci [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, 76762306a36Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.hw, 76862306a36Sopenharmony_ci [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, 76962306a36Sopenharmony_ci [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, 77062306a36Sopenharmony_ci [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, 77162306a36Sopenharmony_ci [CLK_PLL_VIDEO] = &pll_video_clk.common.hw, 77262306a36Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 77362306a36Sopenharmony_ci [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 77462306a36Sopenharmony_ci [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw, 77562306a36Sopenharmony_ci [CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw, 77662306a36Sopenharmony_ci [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 77762306a36Sopenharmony_ci [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw, 77862306a36Sopenharmony_ci [CLK_PLL_DE] = &pll_de_clk.common.hw, 77962306a36Sopenharmony_ci [CLK_CPUX] = &cpux_clk.common.hw, 78062306a36Sopenharmony_ci [CLK_AXI] = &axi_clk.common.hw, 78162306a36Sopenharmony_ci [CLK_AHB1] = &ahb1_clk.common.hw, 78262306a36Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 78362306a36Sopenharmony_ci [CLK_APB2] = &apb2_clk.common.hw, 78462306a36Sopenharmony_ci [CLK_AHB2] = &ahb2_clk.common.hw, 78562306a36Sopenharmony_ci [CLK_BUS_CE] = &bus_ce_clk.common.hw, 78662306a36Sopenharmony_ci [CLK_BUS_DMA] = &bus_dma_clk.common.hw, 78762306a36Sopenharmony_ci [CLK_BUS_MMC0] = &bus_mmc0_clk.common.hw, 78862306a36Sopenharmony_ci [CLK_BUS_MMC1] = &bus_mmc1_clk.common.hw, 78962306a36Sopenharmony_ci [CLK_BUS_MMC2] = &bus_mmc2_clk.common.hw, 79062306a36Sopenharmony_ci [CLK_BUS_NAND] = &bus_nand_clk.common.hw, 79162306a36Sopenharmony_ci [CLK_BUS_DRAM] = &bus_dram_clk.common.hw, 79262306a36Sopenharmony_ci [CLK_BUS_EMAC] = &bus_emac_clk.common.hw, 79362306a36Sopenharmony_ci [CLK_BUS_TS] = &bus_ts_clk.common.hw, 79462306a36Sopenharmony_ci [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw, 79562306a36Sopenharmony_ci [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw, 79662306a36Sopenharmony_ci [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw, 79762306a36Sopenharmony_ci [CLK_BUS_OTG] = &bus_otg_clk.common.hw, 79862306a36Sopenharmony_ci [CLK_BUS_EHCI0] = &bus_ehci0_clk.common.hw, 79962306a36Sopenharmony_ci [CLK_BUS_EHCI1] = &bus_ehci1_clk.common.hw, 80062306a36Sopenharmony_ci [CLK_BUS_EHCI2] = &bus_ehci2_clk.common.hw, 80162306a36Sopenharmony_ci [CLK_BUS_EHCI3] = &bus_ehci3_clk.common.hw, 80262306a36Sopenharmony_ci [CLK_BUS_OHCI0] = &bus_ohci0_clk.common.hw, 80362306a36Sopenharmony_ci [CLK_BUS_OHCI1] = &bus_ohci1_clk.common.hw, 80462306a36Sopenharmony_ci [CLK_BUS_OHCI2] = &bus_ohci2_clk.common.hw, 80562306a36Sopenharmony_ci [CLK_BUS_OHCI3] = &bus_ohci3_clk.common.hw, 80662306a36Sopenharmony_ci [CLK_BUS_VE] = &bus_ve_clk.common.hw, 80762306a36Sopenharmony_ci [CLK_BUS_TCON0] = &bus_tcon0_clk.common.hw, 80862306a36Sopenharmony_ci [CLK_BUS_TCON1] = &bus_tcon1_clk.common.hw, 80962306a36Sopenharmony_ci [CLK_BUS_DEINTERLACE] = &bus_deinterlace_clk.common.hw, 81062306a36Sopenharmony_ci [CLK_BUS_CSI] = &bus_csi_clk.common.hw, 81162306a36Sopenharmony_ci [CLK_BUS_TVE] = &bus_tve_clk.common.hw, 81262306a36Sopenharmony_ci [CLK_BUS_HDMI] = &bus_hdmi_clk.common.hw, 81362306a36Sopenharmony_ci [CLK_BUS_DE] = &bus_de_clk.common.hw, 81462306a36Sopenharmony_ci [CLK_BUS_GPU] = &bus_gpu_clk.common.hw, 81562306a36Sopenharmony_ci [CLK_BUS_MSGBOX] = &bus_msgbox_clk.common.hw, 81662306a36Sopenharmony_ci [CLK_BUS_SPINLOCK] = &bus_spinlock_clk.common.hw, 81762306a36Sopenharmony_ci [CLK_BUS_CODEC] = &bus_codec_clk.common.hw, 81862306a36Sopenharmony_ci [CLK_BUS_SPDIF] = &bus_spdif_clk.common.hw, 81962306a36Sopenharmony_ci [CLK_BUS_PIO] = &bus_pio_clk.common.hw, 82062306a36Sopenharmony_ci [CLK_BUS_THS] = &bus_ths_clk.common.hw, 82162306a36Sopenharmony_ci [CLK_BUS_I2S0] = &bus_i2s0_clk.common.hw, 82262306a36Sopenharmony_ci [CLK_BUS_I2S1] = &bus_i2s1_clk.common.hw, 82362306a36Sopenharmony_ci [CLK_BUS_I2S2] = &bus_i2s2_clk.common.hw, 82462306a36Sopenharmony_ci [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw, 82562306a36Sopenharmony_ci [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw, 82662306a36Sopenharmony_ci [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw, 82762306a36Sopenharmony_ci [CLK_BUS_UART0] = &bus_uart0_clk.common.hw, 82862306a36Sopenharmony_ci [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 82962306a36Sopenharmony_ci [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 83062306a36Sopenharmony_ci [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 83162306a36Sopenharmony_ci [CLK_BUS_SCR0] = &bus_scr0_clk.common.hw, 83262306a36Sopenharmony_ci [CLK_BUS_SCR1] = &bus_scr1_clk.common.hw, 83362306a36Sopenharmony_ci [CLK_BUS_EPHY] = &bus_ephy_clk.common.hw, 83462306a36Sopenharmony_ci [CLK_BUS_DBG] = &bus_dbg_clk.common.hw, 83562306a36Sopenharmony_ci [CLK_THS] = &ths_clk.common.hw, 83662306a36Sopenharmony_ci [CLK_NAND] = &nand_clk.common.hw, 83762306a36Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 83862306a36Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 83962306a36Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 84062306a36Sopenharmony_ci [CLK_TS] = &ts_clk.common.hw, 84162306a36Sopenharmony_ci [CLK_CE] = &ce_clk.common.hw, 84262306a36Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 84362306a36Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 84462306a36Sopenharmony_ci [CLK_I2S0] = &i2s0_clk.common.hw, 84562306a36Sopenharmony_ci [CLK_I2S1] = &i2s1_clk.common.hw, 84662306a36Sopenharmony_ci [CLK_I2S2] = &i2s2_clk.common.hw, 84762306a36Sopenharmony_ci [CLK_SPDIF] = &spdif_clk.common.hw, 84862306a36Sopenharmony_ci [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 84962306a36Sopenharmony_ci [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 85062306a36Sopenharmony_ci [CLK_USB_PHY2] = &usb_phy2_clk.common.hw, 85162306a36Sopenharmony_ci [CLK_USB_PHY3] = &usb_phy3_clk.common.hw, 85262306a36Sopenharmony_ci [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw, 85362306a36Sopenharmony_ci [CLK_USB_OHCI1] = &usb_ohci1_clk.common.hw, 85462306a36Sopenharmony_ci [CLK_USB_OHCI2] = &usb_ohci2_clk.common.hw, 85562306a36Sopenharmony_ci [CLK_USB_OHCI3] = &usb_ohci3_clk.common.hw, 85662306a36Sopenharmony_ci [CLK_DRAM] = &h5_dram_clk.common.hw, 85762306a36Sopenharmony_ci [CLK_DRAM_VE] = &dram_ve_clk.common.hw, 85862306a36Sopenharmony_ci [CLK_DRAM_CSI] = &dram_csi_clk.common.hw, 85962306a36Sopenharmony_ci [CLK_DRAM_DEINTERLACE] = &dram_deinterlace_clk.common.hw, 86062306a36Sopenharmony_ci [CLK_DRAM_TS] = &dram_ts_clk.common.hw, 86162306a36Sopenharmony_ci [CLK_DE] = &de_clk.common.hw, 86262306a36Sopenharmony_ci [CLK_TCON0] = &tcon_clk.common.hw, 86362306a36Sopenharmony_ci [CLK_TVE] = &tve_clk.common.hw, 86462306a36Sopenharmony_ci [CLK_DEINTERLACE] = &deinterlace_clk.common.hw, 86562306a36Sopenharmony_ci [CLK_CSI_MISC] = &csi_misc_clk.common.hw, 86662306a36Sopenharmony_ci [CLK_CSI_SCLK] = &csi_sclk_clk.common.hw, 86762306a36Sopenharmony_ci [CLK_CSI_MCLK] = &csi_mclk_clk.common.hw, 86862306a36Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 86962306a36Sopenharmony_ci [CLK_AC_DIG] = &ac_dig_clk.common.hw, 87062306a36Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 87162306a36Sopenharmony_ci [CLK_HDMI] = &hdmi_clk.common.hw, 87262306a36Sopenharmony_ci [CLK_HDMI_DDC] = &hdmi_ddc_clk.common.hw, 87362306a36Sopenharmony_ci [CLK_MBUS] = &mbus_clk.common.hw, 87462306a36Sopenharmony_ci [CLK_GPU] = &gpu_clk.common.hw, 87562306a36Sopenharmony_ci }, 87662306a36Sopenharmony_ci .num = CLK_NUMBER_H5, 87762306a36Sopenharmony_ci}; 87862306a36Sopenharmony_ci 87962306a36Sopenharmony_cistatic struct ccu_reset_map sun8i_h3_ccu_resets[] = { 88062306a36Sopenharmony_ci [RST_USB_PHY0] = { 0x0cc, BIT(0) }, 88162306a36Sopenharmony_ci [RST_USB_PHY1] = { 0x0cc, BIT(1) }, 88262306a36Sopenharmony_ci [RST_USB_PHY2] = { 0x0cc, BIT(2) }, 88362306a36Sopenharmony_ci [RST_USB_PHY3] = { 0x0cc, BIT(3) }, 88462306a36Sopenharmony_ci 88562306a36Sopenharmony_ci [RST_MBUS] = { 0x0fc, BIT(31) }, 88662306a36Sopenharmony_ci 88762306a36Sopenharmony_ci [RST_BUS_CE] = { 0x2c0, BIT(5) }, 88862306a36Sopenharmony_ci [RST_BUS_DMA] = { 0x2c0, BIT(6) }, 88962306a36Sopenharmony_ci [RST_BUS_MMC0] = { 0x2c0, BIT(8) }, 89062306a36Sopenharmony_ci [RST_BUS_MMC1] = { 0x2c0, BIT(9) }, 89162306a36Sopenharmony_ci [RST_BUS_MMC2] = { 0x2c0, BIT(10) }, 89262306a36Sopenharmony_ci [RST_BUS_NAND] = { 0x2c0, BIT(13) }, 89362306a36Sopenharmony_ci [RST_BUS_DRAM] = { 0x2c0, BIT(14) }, 89462306a36Sopenharmony_ci [RST_BUS_EMAC] = { 0x2c0, BIT(17) }, 89562306a36Sopenharmony_ci [RST_BUS_TS] = { 0x2c0, BIT(18) }, 89662306a36Sopenharmony_ci [RST_BUS_HSTIMER] = { 0x2c0, BIT(19) }, 89762306a36Sopenharmony_ci [RST_BUS_SPI0] = { 0x2c0, BIT(20) }, 89862306a36Sopenharmony_ci [RST_BUS_SPI1] = { 0x2c0, BIT(21) }, 89962306a36Sopenharmony_ci [RST_BUS_OTG] = { 0x2c0, BIT(23) }, 90062306a36Sopenharmony_ci [RST_BUS_EHCI0] = { 0x2c0, BIT(24) }, 90162306a36Sopenharmony_ci [RST_BUS_EHCI1] = { 0x2c0, BIT(25) }, 90262306a36Sopenharmony_ci [RST_BUS_EHCI2] = { 0x2c0, BIT(26) }, 90362306a36Sopenharmony_ci [RST_BUS_EHCI3] = { 0x2c0, BIT(27) }, 90462306a36Sopenharmony_ci [RST_BUS_OHCI0] = { 0x2c0, BIT(28) }, 90562306a36Sopenharmony_ci [RST_BUS_OHCI1] = { 0x2c0, BIT(29) }, 90662306a36Sopenharmony_ci [RST_BUS_OHCI2] = { 0x2c0, BIT(30) }, 90762306a36Sopenharmony_ci [RST_BUS_OHCI3] = { 0x2c0, BIT(31) }, 90862306a36Sopenharmony_ci 90962306a36Sopenharmony_ci [RST_BUS_VE] = { 0x2c4, BIT(0) }, 91062306a36Sopenharmony_ci [RST_BUS_TCON0] = { 0x2c4, BIT(3) }, 91162306a36Sopenharmony_ci [RST_BUS_TCON1] = { 0x2c4, BIT(4) }, 91262306a36Sopenharmony_ci [RST_BUS_DEINTERLACE] = { 0x2c4, BIT(5) }, 91362306a36Sopenharmony_ci [RST_BUS_CSI] = { 0x2c4, BIT(8) }, 91462306a36Sopenharmony_ci [RST_BUS_TVE] = { 0x2c4, BIT(9) }, 91562306a36Sopenharmony_ci [RST_BUS_HDMI0] = { 0x2c4, BIT(10) }, 91662306a36Sopenharmony_ci [RST_BUS_HDMI1] = { 0x2c4, BIT(11) }, 91762306a36Sopenharmony_ci [RST_BUS_DE] = { 0x2c4, BIT(12) }, 91862306a36Sopenharmony_ci [RST_BUS_GPU] = { 0x2c4, BIT(20) }, 91962306a36Sopenharmony_ci [RST_BUS_MSGBOX] = { 0x2c4, BIT(21) }, 92062306a36Sopenharmony_ci [RST_BUS_SPINLOCK] = { 0x2c4, BIT(22) }, 92162306a36Sopenharmony_ci [RST_BUS_DBG] = { 0x2c4, BIT(31) }, 92262306a36Sopenharmony_ci 92362306a36Sopenharmony_ci [RST_BUS_EPHY] = { 0x2c8, BIT(2) }, 92462306a36Sopenharmony_ci 92562306a36Sopenharmony_ci [RST_BUS_CODEC] = { 0x2d0, BIT(0) }, 92662306a36Sopenharmony_ci [RST_BUS_SPDIF] = { 0x2d0, BIT(1) }, 92762306a36Sopenharmony_ci [RST_BUS_THS] = { 0x2d0, BIT(8) }, 92862306a36Sopenharmony_ci [RST_BUS_I2S0] = { 0x2d0, BIT(12) }, 92962306a36Sopenharmony_ci [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, 93062306a36Sopenharmony_ci [RST_BUS_I2S2] = { 0x2d0, BIT(14) }, 93162306a36Sopenharmony_ci 93262306a36Sopenharmony_ci [RST_BUS_I2C0] = { 0x2d8, BIT(0) }, 93362306a36Sopenharmony_ci [RST_BUS_I2C1] = { 0x2d8, BIT(1) }, 93462306a36Sopenharmony_ci [RST_BUS_I2C2] = { 0x2d8, BIT(2) }, 93562306a36Sopenharmony_ci [RST_BUS_UART0] = { 0x2d8, BIT(16) }, 93662306a36Sopenharmony_ci [RST_BUS_UART1] = { 0x2d8, BIT(17) }, 93762306a36Sopenharmony_ci [RST_BUS_UART2] = { 0x2d8, BIT(18) }, 93862306a36Sopenharmony_ci [RST_BUS_UART3] = { 0x2d8, BIT(19) }, 93962306a36Sopenharmony_ci [RST_BUS_SCR0] = { 0x2d8, BIT(20) }, 94062306a36Sopenharmony_ci}; 94162306a36Sopenharmony_ci 94262306a36Sopenharmony_cistatic struct ccu_reset_map sun50i_h5_ccu_resets[] = { 94362306a36Sopenharmony_ci [RST_USB_PHY0] = { 0x0cc, BIT(0) }, 94462306a36Sopenharmony_ci [RST_USB_PHY1] = { 0x0cc, BIT(1) }, 94562306a36Sopenharmony_ci [RST_USB_PHY2] = { 0x0cc, BIT(2) }, 94662306a36Sopenharmony_ci [RST_USB_PHY3] = { 0x0cc, BIT(3) }, 94762306a36Sopenharmony_ci 94862306a36Sopenharmony_ci [RST_MBUS] = { 0x0fc, BIT(31) }, 94962306a36Sopenharmony_ci 95062306a36Sopenharmony_ci [RST_BUS_CE] = { 0x2c0, BIT(5) }, 95162306a36Sopenharmony_ci [RST_BUS_DMA] = { 0x2c0, BIT(6) }, 95262306a36Sopenharmony_ci [RST_BUS_MMC0] = { 0x2c0, BIT(8) }, 95362306a36Sopenharmony_ci [RST_BUS_MMC1] = { 0x2c0, BIT(9) }, 95462306a36Sopenharmony_ci [RST_BUS_MMC2] = { 0x2c0, BIT(10) }, 95562306a36Sopenharmony_ci [RST_BUS_NAND] = { 0x2c0, BIT(13) }, 95662306a36Sopenharmony_ci [RST_BUS_DRAM] = { 0x2c0, BIT(14) }, 95762306a36Sopenharmony_ci [RST_BUS_EMAC] = { 0x2c0, BIT(17) }, 95862306a36Sopenharmony_ci [RST_BUS_TS] = { 0x2c0, BIT(18) }, 95962306a36Sopenharmony_ci [RST_BUS_HSTIMER] = { 0x2c0, BIT(19) }, 96062306a36Sopenharmony_ci [RST_BUS_SPI0] = { 0x2c0, BIT(20) }, 96162306a36Sopenharmony_ci [RST_BUS_SPI1] = { 0x2c0, BIT(21) }, 96262306a36Sopenharmony_ci [RST_BUS_OTG] = { 0x2c0, BIT(23) }, 96362306a36Sopenharmony_ci [RST_BUS_EHCI0] = { 0x2c0, BIT(24) }, 96462306a36Sopenharmony_ci [RST_BUS_EHCI1] = { 0x2c0, BIT(25) }, 96562306a36Sopenharmony_ci [RST_BUS_EHCI2] = { 0x2c0, BIT(26) }, 96662306a36Sopenharmony_ci [RST_BUS_EHCI3] = { 0x2c0, BIT(27) }, 96762306a36Sopenharmony_ci [RST_BUS_OHCI0] = { 0x2c0, BIT(28) }, 96862306a36Sopenharmony_ci [RST_BUS_OHCI1] = { 0x2c0, BIT(29) }, 96962306a36Sopenharmony_ci [RST_BUS_OHCI2] = { 0x2c0, BIT(30) }, 97062306a36Sopenharmony_ci [RST_BUS_OHCI3] = { 0x2c0, BIT(31) }, 97162306a36Sopenharmony_ci 97262306a36Sopenharmony_ci [RST_BUS_VE] = { 0x2c4, BIT(0) }, 97362306a36Sopenharmony_ci [RST_BUS_TCON0] = { 0x2c4, BIT(3) }, 97462306a36Sopenharmony_ci [RST_BUS_TCON1] = { 0x2c4, BIT(4) }, 97562306a36Sopenharmony_ci [RST_BUS_DEINTERLACE] = { 0x2c4, BIT(5) }, 97662306a36Sopenharmony_ci [RST_BUS_CSI] = { 0x2c4, BIT(8) }, 97762306a36Sopenharmony_ci [RST_BUS_TVE] = { 0x2c4, BIT(9) }, 97862306a36Sopenharmony_ci [RST_BUS_HDMI0] = { 0x2c4, BIT(10) }, 97962306a36Sopenharmony_ci [RST_BUS_HDMI1] = { 0x2c4, BIT(11) }, 98062306a36Sopenharmony_ci [RST_BUS_DE] = { 0x2c4, BIT(12) }, 98162306a36Sopenharmony_ci [RST_BUS_GPU] = { 0x2c4, BIT(20) }, 98262306a36Sopenharmony_ci [RST_BUS_MSGBOX] = { 0x2c4, BIT(21) }, 98362306a36Sopenharmony_ci [RST_BUS_SPINLOCK] = { 0x2c4, BIT(22) }, 98462306a36Sopenharmony_ci [RST_BUS_DBG] = { 0x2c4, BIT(31) }, 98562306a36Sopenharmony_ci 98662306a36Sopenharmony_ci [RST_BUS_EPHY] = { 0x2c8, BIT(2) }, 98762306a36Sopenharmony_ci 98862306a36Sopenharmony_ci [RST_BUS_CODEC] = { 0x2d0, BIT(0) }, 98962306a36Sopenharmony_ci [RST_BUS_SPDIF] = { 0x2d0, BIT(1) }, 99062306a36Sopenharmony_ci [RST_BUS_THS] = { 0x2d0, BIT(8) }, 99162306a36Sopenharmony_ci [RST_BUS_I2S0] = { 0x2d0, BIT(12) }, 99262306a36Sopenharmony_ci [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, 99362306a36Sopenharmony_ci [RST_BUS_I2S2] = { 0x2d0, BIT(14) }, 99462306a36Sopenharmony_ci 99562306a36Sopenharmony_ci [RST_BUS_I2C0] = { 0x2d8, BIT(0) }, 99662306a36Sopenharmony_ci [RST_BUS_I2C1] = { 0x2d8, BIT(1) }, 99762306a36Sopenharmony_ci [RST_BUS_I2C2] = { 0x2d8, BIT(2) }, 99862306a36Sopenharmony_ci [RST_BUS_UART0] = { 0x2d8, BIT(16) }, 99962306a36Sopenharmony_ci [RST_BUS_UART1] = { 0x2d8, BIT(17) }, 100062306a36Sopenharmony_ci [RST_BUS_UART2] = { 0x2d8, BIT(18) }, 100162306a36Sopenharmony_ci [RST_BUS_UART3] = { 0x2d8, BIT(19) }, 100262306a36Sopenharmony_ci [RST_BUS_SCR0] = { 0x2d8, BIT(20) }, 100362306a36Sopenharmony_ci [RST_BUS_SCR1] = { 0x2d8, BIT(20) }, 100462306a36Sopenharmony_ci}; 100562306a36Sopenharmony_ci 100662306a36Sopenharmony_cistatic const struct sunxi_ccu_desc sun8i_h3_ccu_desc = { 100762306a36Sopenharmony_ci .ccu_clks = sun8i_h3_ccu_clks, 100862306a36Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun8i_h3_ccu_clks), 100962306a36Sopenharmony_ci 101062306a36Sopenharmony_ci .hw_clks = &sun8i_h3_hw_clks, 101162306a36Sopenharmony_ci 101262306a36Sopenharmony_ci .resets = sun8i_h3_ccu_resets, 101362306a36Sopenharmony_ci .num_resets = ARRAY_SIZE(sun8i_h3_ccu_resets), 101462306a36Sopenharmony_ci}; 101562306a36Sopenharmony_ci 101662306a36Sopenharmony_cistatic const struct sunxi_ccu_desc sun50i_h5_ccu_desc = { 101762306a36Sopenharmony_ci .ccu_clks = sun8i_h3_ccu_clks, 101862306a36Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun8i_h3_ccu_clks), 101962306a36Sopenharmony_ci 102062306a36Sopenharmony_ci .hw_clks = &sun50i_h5_hw_clks, 102162306a36Sopenharmony_ci 102262306a36Sopenharmony_ci .resets = sun50i_h5_ccu_resets, 102362306a36Sopenharmony_ci .num_resets = ARRAY_SIZE(sun50i_h5_ccu_resets), 102462306a36Sopenharmony_ci}; 102562306a36Sopenharmony_ci 102662306a36Sopenharmony_cistatic struct ccu_pll_nb sun8i_h3_pll_cpu_nb = { 102762306a36Sopenharmony_ci .common = &pll_cpux_clk.common, 102862306a36Sopenharmony_ci /* copy from pll_cpux_clk */ 102962306a36Sopenharmony_ci .enable = BIT(31), 103062306a36Sopenharmony_ci .lock = BIT(28), 103162306a36Sopenharmony_ci}; 103262306a36Sopenharmony_ci 103362306a36Sopenharmony_cistatic struct ccu_mux_nb sun8i_h3_cpu_nb = { 103462306a36Sopenharmony_ci .common = &cpux_clk.common, 103562306a36Sopenharmony_ci .cm = &cpux_clk.mux, 103662306a36Sopenharmony_ci .delay_us = 1, /* > 8 clock cycles at 24 MHz */ 103762306a36Sopenharmony_ci .bypass_index = 1, /* index of 24 MHz oscillator */ 103862306a36Sopenharmony_ci}; 103962306a36Sopenharmony_ci 104062306a36Sopenharmony_cistatic int sun8i_h3_ccu_probe(struct platform_device *pdev) 104162306a36Sopenharmony_ci{ 104262306a36Sopenharmony_ci const struct sunxi_ccu_desc *desc; 104362306a36Sopenharmony_ci void __iomem *reg; 104462306a36Sopenharmony_ci int ret; 104562306a36Sopenharmony_ci u32 val; 104662306a36Sopenharmony_ci 104762306a36Sopenharmony_ci desc = of_device_get_match_data(&pdev->dev); 104862306a36Sopenharmony_ci if (!desc) 104962306a36Sopenharmony_ci return -EINVAL; 105062306a36Sopenharmony_ci 105162306a36Sopenharmony_ci reg = devm_platform_ioremap_resource(pdev, 0); 105262306a36Sopenharmony_ci if (IS_ERR(reg)) 105362306a36Sopenharmony_ci return PTR_ERR(reg); 105462306a36Sopenharmony_ci 105562306a36Sopenharmony_ci /* Force the PLL-Audio-1x divider to 1 */ 105662306a36Sopenharmony_ci val = readl(reg + SUN8I_H3_PLL_AUDIO_REG); 105762306a36Sopenharmony_ci val &= ~GENMASK(19, 16); 105862306a36Sopenharmony_ci writel(val | (0 << 16), reg + SUN8I_H3_PLL_AUDIO_REG); 105962306a36Sopenharmony_ci 106062306a36Sopenharmony_ci ret = devm_sunxi_ccu_probe(&pdev->dev, reg, desc); 106162306a36Sopenharmony_ci if (ret) 106262306a36Sopenharmony_ci return ret; 106362306a36Sopenharmony_ci 106462306a36Sopenharmony_ci /* Gate then ungate PLL CPU after any rate changes */ 106562306a36Sopenharmony_ci ccu_pll_notifier_register(&sun8i_h3_pll_cpu_nb); 106662306a36Sopenharmony_ci 106762306a36Sopenharmony_ci /* Reparent CPU during PLL CPU rate changes */ 106862306a36Sopenharmony_ci ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, 106962306a36Sopenharmony_ci &sun8i_h3_cpu_nb); 107062306a36Sopenharmony_ci 107162306a36Sopenharmony_ci return 0; 107262306a36Sopenharmony_ci} 107362306a36Sopenharmony_ci 107462306a36Sopenharmony_cistatic const struct of_device_id sun8i_h3_ccu_ids[] = { 107562306a36Sopenharmony_ci { 107662306a36Sopenharmony_ci .compatible = "allwinner,sun8i-h3-ccu", 107762306a36Sopenharmony_ci .data = &sun8i_h3_ccu_desc, 107862306a36Sopenharmony_ci }, 107962306a36Sopenharmony_ci { 108062306a36Sopenharmony_ci .compatible = "allwinner,sun50i-h5-ccu", 108162306a36Sopenharmony_ci .data = &sun50i_h5_ccu_desc, 108262306a36Sopenharmony_ci }, 108362306a36Sopenharmony_ci { } 108462306a36Sopenharmony_ci}; 108562306a36Sopenharmony_ci 108662306a36Sopenharmony_cistatic struct platform_driver sun8i_h3_ccu_driver = { 108762306a36Sopenharmony_ci .probe = sun8i_h3_ccu_probe, 108862306a36Sopenharmony_ci .driver = { 108962306a36Sopenharmony_ci .name = "sun8i-h3-ccu", 109062306a36Sopenharmony_ci .suppress_bind_attrs = true, 109162306a36Sopenharmony_ci .of_match_table = sun8i_h3_ccu_ids, 109262306a36Sopenharmony_ci }, 109362306a36Sopenharmony_ci}; 109462306a36Sopenharmony_cimodule_platform_driver(sun8i_h3_ccu_driver); 109562306a36Sopenharmony_ci 109662306a36Sopenharmony_ciMODULE_IMPORT_NS(SUNXI_CCU); 109762306a36Sopenharmony_ciMODULE_LICENSE("GPL"); 1098