162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2016 Chen-Yu Tsai. 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/platform_device.h> 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include "ccu_common.h" 1262306a36Sopenharmony_ci#include "ccu_reset.h" 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include "ccu_div.h" 1562306a36Sopenharmony_ci#include "ccu_gate.h" 1662306a36Sopenharmony_ci#include "ccu_mp.h" 1762306a36Sopenharmony_ci#include "ccu_nkmp.h" 1862306a36Sopenharmony_ci#include "ccu_nm.h" 1962306a36Sopenharmony_ci#include "ccu_phase.h" 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#include "ccu-sun9i-a80.h" 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#define CCU_SUN9I_LOCK_REG 0x09c 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* 2662306a36Sopenharmony_ci * The CPU PLLs are actually NP clocks, with P being /1 or /4. However 2762306a36Sopenharmony_ci * P should only be used for output frequencies lower than 228 MHz. 2862306a36Sopenharmony_ci * Neither mainline Linux, U-boot, nor the vendor BSPs use these. 2962306a36Sopenharmony_ci * 3062306a36Sopenharmony_ci * For now we can just model it as a multiplier clock, and force P to /1. 3162306a36Sopenharmony_ci */ 3262306a36Sopenharmony_ci#define SUN9I_A80_PLL_C0CPUX_REG 0x000 3362306a36Sopenharmony_ci#define SUN9I_A80_PLL_C1CPUX_REG 0x004 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_cistatic struct ccu_mult pll_c0cpux_clk = { 3662306a36Sopenharmony_ci .enable = BIT(31), 3762306a36Sopenharmony_ci .lock = BIT(0), 3862306a36Sopenharmony_ci .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 3962306a36Sopenharmony_ci .common = { 4062306a36Sopenharmony_ci .reg = SUN9I_A80_PLL_C0CPUX_REG, 4162306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 4262306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 4362306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-c0cpux", "osc24M", 4462306a36Sopenharmony_ci &ccu_mult_ops, 4562306a36Sopenharmony_ci CLK_SET_RATE_UNGATE), 4662306a36Sopenharmony_ci }, 4762306a36Sopenharmony_ci}; 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_cistatic struct ccu_mult pll_c1cpux_clk = { 5062306a36Sopenharmony_ci .enable = BIT(31), 5162306a36Sopenharmony_ci .lock = BIT(1), 5262306a36Sopenharmony_ci .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 5362306a36Sopenharmony_ci .common = { 5462306a36Sopenharmony_ci .reg = SUN9I_A80_PLL_C1CPUX_REG, 5562306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 5662306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 5762306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-c1cpux", "osc24M", 5862306a36Sopenharmony_ci &ccu_mult_ops, 5962306a36Sopenharmony_ci CLK_SET_RATE_UNGATE), 6062306a36Sopenharmony_ci }, 6162306a36Sopenharmony_ci}; 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci/* 6462306a36Sopenharmony_ci * The Audio PLL has d1, d2 dividers in addition to the usual N, M 6562306a36Sopenharmony_ci * factors. Since we only need 2 frequencies from this PLL: 22.5792 MHz 6662306a36Sopenharmony_ci * and 24.576 MHz, ignore them for now. Enforce d1 = 0 and d2 = 0. 6762306a36Sopenharmony_ci */ 6862306a36Sopenharmony_ci#define SUN9I_A80_PLL_AUDIO_REG 0x008 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_cistatic struct ccu_nm pll_audio_clk = { 7162306a36Sopenharmony_ci .enable = BIT(31), 7262306a36Sopenharmony_ci .lock = BIT(2), 7362306a36Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 7462306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV_OFFSET(0, 6, 0), 7562306a36Sopenharmony_ci .common = { 7662306a36Sopenharmony_ci .reg = 0x008, 7762306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 7862306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 7962306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-audio", "osc24M", 8062306a36Sopenharmony_ci &ccu_nm_ops, CLK_SET_RATE_UNGATE), 8162306a36Sopenharmony_ci }, 8262306a36Sopenharmony_ci}; 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci/* Some PLLs are input * N / div1 / div2. Model them as NKMP with no K */ 8562306a36Sopenharmony_cistatic struct ccu_nkmp pll_periph0_clk = { 8662306a36Sopenharmony_ci .enable = BIT(31), 8762306a36Sopenharmony_ci .lock = BIT(3), 8862306a36Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 8962306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 9062306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 9162306a36Sopenharmony_ci .common = { 9262306a36Sopenharmony_ci .reg = 0x00c, 9362306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 9462306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 9562306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-periph0", "osc24M", 9662306a36Sopenharmony_ci &ccu_nkmp_ops, 9762306a36Sopenharmony_ci CLK_SET_RATE_UNGATE), 9862306a36Sopenharmony_ci }, 9962306a36Sopenharmony_ci}; 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_cistatic struct ccu_nkmp pll_ve_clk = { 10262306a36Sopenharmony_ci .enable = BIT(31), 10362306a36Sopenharmony_ci .lock = BIT(4), 10462306a36Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 10562306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 10662306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 10762306a36Sopenharmony_ci .common = { 10862306a36Sopenharmony_ci .reg = 0x010, 10962306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 11062306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 11162306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ve", "osc24M", 11262306a36Sopenharmony_ci &ccu_nkmp_ops, 11362306a36Sopenharmony_ci CLK_SET_RATE_UNGATE), 11462306a36Sopenharmony_ci }, 11562306a36Sopenharmony_ci}; 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_cistatic struct ccu_nkmp pll_ddr_clk = { 11862306a36Sopenharmony_ci .enable = BIT(31), 11962306a36Sopenharmony_ci .lock = BIT(5), 12062306a36Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 12162306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 12262306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 12362306a36Sopenharmony_ci .common = { 12462306a36Sopenharmony_ci .reg = 0x014, 12562306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 12662306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 12762306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ddr", "osc24M", 12862306a36Sopenharmony_ci &ccu_nkmp_ops, 12962306a36Sopenharmony_ci CLK_SET_RATE_UNGATE), 13062306a36Sopenharmony_ci }, 13162306a36Sopenharmony_ci}; 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_cistatic struct ccu_nm pll_video0_clk = { 13462306a36Sopenharmony_ci .enable = BIT(31), 13562306a36Sopenharmony_ci .lock = BIT(6), 13662306a36Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 13762306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 13862306a36Sopenharmony_ci .common = { 13962306a36Sopenharmony_ci .reg = 0x018, 14062306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 14162306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 14262306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video0", "osc24M", 14362306a36Sopenharmony_ci &ccu_nm_ops, 14462306a36Sopenharmony_ci CLK_SET_RATE_UNGATE), 14562306a36Sopenharmony_ci }, 14662306a36Sopenharmony_ci}; 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_cistatic struct ccu_nkmp pll_video1_clk = { 14962306a36Sopenharmony_ci .enable = BIT(31), 15062306a36Sopenharmony_ci .lock = BIT(7), 15162306a36Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 15262306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 15362306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(0, 2), /* external divider p */ 15462306a36Sopenharmony_ci .common = { 15562306a36Sopenharmony_ci .reg = 0x01c, 15662306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 15762306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 15862306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video1", "osc24M", 15962306a36Sopenharmony_ci &ccu_nkmp_ops, 16062306a36Sopenharmony_ci CLK_SET_RATE_UNGATE), 16162306a36Sopenharmony_ci }, 16262306a36Sopenharmony_ci}; 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_cistatic struct ccu_nkmp pll_gpu_clk = { 16562306a36Sopenharmony_ci .enable = BIT(31), 16662306a36Sopenharmony_ci .lock = BIT(8), 16762306a36Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 16862306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 16962306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 17062306a36Sopenharmony_ci .common = { 17162306a36Sopenharmony_ci .reg = 0x020, 17262306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 17362306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 17462306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-gpu", "osc24M", 17562306a36Sopenharmony_ci &ccu_nkmp_ops, 17662306a36Sopenharmony_ci CLK_SET_RATE_UNGATE), 17762306a36Sopenharmony_ci }, 17862306a36Sopenharmony_ci}; 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_cistatic struct ccu_nkmp pll_de_clk = { 18162306a36Sopenharmony_ci .enable = BIT(31), 18262306a36Sopenharmony_ci .lock = BIT(9), 18362306a36Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 18462306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 18562306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 18662306a36Sopenharmony_ci .common = { 18762306a36Sopenharmony_ci .reg = 0x024, 18862306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 18962306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 19062306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-de", "osc24M", 19162306a36Sopenharmony_ci &ccu_nkmp_ops, 19262306a36Sopenharmony_ci CLK_SET_RATE_UNGATE), 19362306a36Sopenharmony_ci }, 19462306a36Sopenharmony_ci}; 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_cistatic struct ccu_nkmp pll_isp_clk = { 19762306a36Sopenharmony_ci .enable = BIT(31), 19862306a36Sopenharmony_ci .lock = BIT(10), 19962306a36Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 20062306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 20162306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 20262306a36Sopenharmony_ci .common = { 20362306a36Sopenharmony_ci .reg = 0x028, 20462306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 20562306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 20662306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-isp", "osc24M", 20762306a36Sopenharmony_ci &ccu_nkmp_ops, 20862306a36Sopenharmony_ci CLK_SET_RATE_UNGATE), 20962306a36Sopenharmony_ci }, 21062306a36Sopenharmony_ci}; 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_cistatic struct ccu_nkmp pll_periph1_clk = { 21362306a36Sopenharmony_ci .enable = BIT(31), 21462306a36Sopenharmony_ci .lock = BIT(11), 21562306a36Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 21662306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(16, 1), /* input divider */ 21762306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(18, 1), /* output divider */ 21862306a36Sopenharmony_ci .common = { 21962306a36Sopenharmony_ci .reg = 0x028, 22062306a36Sopenharmony_ci .lock_reg = CCU_SUN9I_LOCK_REG, 22162306a36Sopenharmony_ci .features = CCU_FEATURE_LOCK_REG, 22262306a36Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-periph1", "osc24M", 22362306a36Sopenharmony_ci &ccu_nkmp_ops, 22462306a36Sopenharmony_ci CLK_SET_RATE_UNGATE), 22562306a36Sopenharmony_ci }, 22662306a36Sopenharmony_ci}; 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_cistatic const char * const c0cpux_parents[] = { "osc24M", "pll-c0cpux" }; 22962306a36Sopenharmony_cistatic SUNXI_CCU_MUX(c0cpux_clk, "c0cpux", c0cpux_parents, 23062306a36Sopenharmony_ci 0x50, 0, 1, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_cistatic const char * const c1cpux_parents[] = { "osc24M", "pll-c1cpux" }; 23362306a36Sopenharmony_cistatic SUNXI_CCU_MUX(c1cpux_clk, "c1cpux", c1cpux_parents, 23462306a36Sopenharmony_ci 0x50, 8, 1, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 23562306a36Sopenharmony_ci 23662306a36Sopenharmony_cistatic struct clk_div_table axi_div_table[] = { 23762306a36Sopenharmony_ci { .val = 0, .div = 1 }, 23862306a36Sopenharmony_ci { .val = 1, .div = 2 }, 23962306a36Sopenharmony_ci { .val = 2, .div = 3 }, 24062306a36Sopenharmony_ci { .val = 3, .div = 4 }, 24162306a36Sopenharmony_ci { .val = 4, .div = 4 }, 24262306a36Sopenharmony_ci { .val = 5, .div = 4 }, 24362306a36Sopenharmony_ci { .val = 6, .div = 4 }, 24462306a36Sopenharmony_ci { .val = 7, .div = 4 }, 24562306a36Sopenharmony_ci { /* Sentinel */ }, 24662306a36Sopenharmony_ci}; 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_cistatic SUNXI_CCU_M(atb0_clk, "atb0", "c0cpux", 0x054, 8, 2, 0); 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(axi0_clk, "axi0", "c0cpux", 25162306a36Sopenharmony_ci 0x054, 0, 3, axi_div_table, 0); 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_cistatic SUNXI_CCU_M(atb1_clk, "atb1", "c1cpux", 0x058, 8, 2, 0); 25462306a36Sopenharmony_ci 25562306a36Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(axi1_clk, "axi1", "c1cpux", 25662306a36Sopenharmony_ci 0x058, 0, 3, axi_div_table, 0); 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_cistatic const char * const gtbus_parents[] = { "osc24M", "pll-periph0", 25962306a36Sopenharmony_ci "pll-periph1", "pll-periph1" }; 26062306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX(gtbus_clk, "gtbus", gtbus_parents, 26162306a36Sopenharmony_ci 0x05c, 0, 2, 24, 2, CLK_IS_CRITICAL); 26262306a36Sopenharmony_ci 26362306a36Sopenharmony_cistatic const char * const ahb_parents[] = { "gtbus", "pll-periph0", 26462306a36Sopenharmony_ci "pll-periph1", "pll-periph1" }; 26562306a36Sopenharmony_cistatic struct ccu_div ahb0_clk = { 26662306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 26762306a36Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 26862306a36Sopenharmony_ci .common = { 26962306a36Sopenharmony_ci .reg = 0x060, 27062306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb0", 27162306a36Sopenharmony_ci ahb_parents, 27262306a36Sopenharmony_ci &ccu_div_ops, 27362306a36Sopenharmony_ci 0), 27462306a36Sopenharmony_ci }, 27562306a36Sopenharmony_ci}; 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_cistatic struct ccu_div ahb1_clk = { 27862306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 27962306a36Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 28062306a36Sopenharmony_ci .common = { 28162306a36Sopenharmony_ci .reg = 0x064, 28262306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb1", 28362306a36Sopenharmony_ci ahb_parents, 28462306a36Sopenharmony_ci &ccu_div_ops, 28562306a36Sopenharmony_ci 0), 28662306a36Sopenharmony_ci }, 28762306a36Sopenharmony_ci}; 28862306a36Sopenharmony_ci 28962306a36Sopenharmony_cistatic struct ccu_div ahb2_clk = { 29062306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 29162306a36Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 29262306a36Sopenharmony_ci .common = { 29362306a36Sopenharmony_ci .reg = 0x068, 29462306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb2", 29562306a36Sopenharmony_ci ahb_parents, 29662306a36Sopenharmony_ci &ccu_div_ops, 29762306a36Sopenharmony_ci 0), 29862306a36Sopenharmony_ci }, 29962306a36Sopenharmony_ci}; 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_cistatic const char * const apb_parents[] = { "osc24M", "pll-periph0" }; 30262306a36Sopenharmony_ci 30362306a36Sopenharmony_cistatic struct ccu_div apb0_clk = { 30462306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 30562306a36Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 1), 30662306a36Sopenharmony_ci .common = { 30762306a36Sopenharmony_ci .reg = 0x070, 30862306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("apb0", 30962306a36Sopenharmony_ci apb_parents, 31062306a36Sopenharmony_ci &ccu_div_ops, 31162306a36Sopenharmony_ci 0), 31262306a36Sopenharmony_ci }, 31362306a36Sopenharmony_ci}; 31462306a36Sopenharmony_ci 31562306a36Sopenharmony_cistatic struct ccu_div apb1_clk = { 31662306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 31762306a36Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 1), 31862306a36Sopenharmony_ci .common = { 31962306a36Sopenharmony_ci .reg = 0x074, 32062306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("apb1", 32162306a36Sopenharmony_ci apb_parents, 32262306a36Sopenharmony_ci &ccu_div_ops, 32362306a36Sopenharmony_ci 0), 32462306a36Sopenharmony_ci }, 32562306a36Sopenharmony_ci}; 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_cistatic struct ccu_div cci400_clk = { 32862306a36Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 32962306a36Sopenharmony_ci .mux = _SUNXI_CCU_MUX(24, 2), 33062306a36Sopenharmony_ci .common = { 33162306a36Sopenharmony_ci .reg = 0x078, 33262306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("cci400", 33362306a36Sopenharmony_ci ahb_parents, 33462306a36Sopenharmony_ci &ccu_div_ops, 33562306a36Sopenharmony_ci CLK_IS_CRITICAL), 33662306a36Sopenharmony_ci }, 33762306a36Sopenharmony_ci}; 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(ats_clk, "ats", apb_parents, 34062306a36Sopenharmony_ci 0x080, 0, 3, 24, 2, BIT(31), 0); 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(trace_clk, "trace", apb_parents, 34362306a36Sopenharmony_ci 0x084, 0, 3, 24, 2, BIT(31), 0); 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_cistatic const char * const out_parents[] = { "osc24M", "osc32k", "osc24M" }; 34662306a36Sopenharmony_cistatic const struct ccu_mux_fixed_prediv out_prediv = { 34762306a36Sopenharmony_ci .index = 0, .div = 750 34862306a36Sopenharmony_ci}; 34962306a36Sopenharmony_ci 35062306a36Sopenharmony_cistatic struct ccu_mp out_a_clk = { 35162306a36Sopenharmony_ci .enable = BIT(31), 35262306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(8, 5), 35362306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(20, 2), 35462306a36Sopenharmony_ci .mux = { 35562306a36Sopenharmony_ci .shift = 24, 35662306a36Sopenharmony_ci .width = 4, 35762306a36Sopenharmony_ci .fixed_predivs = &out_prediv, 35862306a36Sopenharmony_ci .n_predivs = 1, 35962306a36Sopenharmony_ci }, 36062306a36Sopenharmony_ci .common = { 36162306a36Sopenharmony_ci .reg = 0x180, 36262306a36Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 36362306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("out-a", 36462306a36Sopenharmony_ci out_parents, 36562306a36Sopenharmony_ci &ccu_mp_ops, 36662306a36Sopenharmony_ci 0), 36762306a36Sopenharmony_ci }, 36862306a36Sopenharmony_ci}; 36962306a36Sopenharmony_ci 37062306a36Sopenharmony_cistatic struct ccu_mp out_b_clk = { 37162306a36Sopenharmony_ci .enable = BIT(31), 37262306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(8, 5), 37362306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(20, 2), 37462306a36Sopenharmony_ci .mux = { 37562306a36Sopenharmony_ci .shift = 24, 37662306a36Sopenharmony_ci .width = 4, 37762306a36Sopenharmony_ci .fixed_predivs = &out_prediv, 37862306a36Sopenharmony_ci .n_predivs = 1, 37962306a36Sopenharmony_ci }, 38062306a36Sopenharmony_ci .common = { 38162306a36Sopenharmony_ci .reg = 0x184, 38262306a36Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 38362306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("out-b", 38462306a36Sopenharmony_ci out_parents, 38562306a36Sopenharmony_ci &ccu_mp_ops, 38662306a36Sopenharmony_ci 0), 38762306a36Sopenharmony_ci }, 38862306a36Sopenharmony_ci}; 38962306a36Sopenharmony_ci 39062306a36Sopenharmony_cistatic const char * const mod0_default_parents[] = { "osc24M", "pll-periph0" }; 39162306a36Sopenharmony_ci 39262306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand0_0_clk, "nand0-0", mod0_default_parents, 39362306a36Sopenharmony_ci 0x400, 39462306a36Sopenharmony_ci 0, 4, /* M */ 39562306a36Sopenharmony_ci 16, 2, /* P */ 39662306a36Sopenharmony_ci 24, 4, /* mux */ 39762306a36Sopenharmony_ci BIT(31), /* gate */ 39862306a36Sopenharmony_ci 0); 39962306a36Sopenharmony_ci 40062306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand0_1_clk, "nand0-1", mod0_default_parents, 40162306a36Sopenharmony_ci 0x404, 40262306a36Sopenharmony_ci 0, 4, /* M */ 40362306a36Sopenharmony_ci 16, 2, /* P */ 40462306a36Sopenharmony_ci 24, 4, /* mux */ 40562306a36Sopenharmony_ci BIT(31), /* gate */ 40662306a36Sopenharmony_ci 0); 40762306a36Sopenharmony_ci 40862306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand1_0_clk, "nand1-0", mod0_default_parents, 40962306a36Sopenharmony_ci 0x408, 41062306a36Sopenharmony_ci 0, 4, /* M */ 41162306a36Sopenharmony_ci 16, 2, /* P */ 41262306a36Sopenharmony_ci 24, 4, /* mux */ 41362306a36Sopenharmony_ci BIT(31), /* gate */ 41462306a36Sopenharmony_ci 0); 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand1_1_clk, "nand1-1", mod0_default_parents, 41762306a36Sopenharmony_ci 0x40c, 41862306a36Sopenharmony_ci 0, 4, /* M */ 41962306a36Sopenharmony_ci 16, 2, /* P */ 42062306a36Sopenharmony_ci 24, 4, /* mux */ 42162306a36Sopenharmony_ci BIT(31), /* gate */ 42262306a36Sopenharmony_ci 0); 42362306a36Sopenharmony_ci 42462306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 42562306a36Sopenharmony_ci 0x410, 42662306a36Sopenharmony_ci 0, 4, /* M */ 42762306a36Sopenharmony_ci 16, 2, /* P */ 42862306a36Sopenharmony_ci 24, 4, /* mux */ 42962306a36Sopenharmony_ci BIT(31), /* gate */ 43062306a36Sopenharmony_ci 0); 43162306a36Sopenharmony_ci 43262306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_sample_clk, "mmc0-sample", "mmc0", 43362306a36Sopenharmony_ci 0x410, 20, 3, 0); 43462306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_output_clk, "mmc0-output", "mmc0", 43562306a36Sopenharmony_ci 0x410, 8, 3, 0); 43662306a36Sopenharmony_ci 43762306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 43862306a36Sopenharmony_ci 0x414, 43962306a36Sopenharmony_ci 0, 4, /* M */ 44062306a36Sopenharmony_ci 16, 2, /* P */ 44162306a36Sopenharmony_ci 24, 4, /* mux */ 44262306a36Sopenharmony_ci BIT(31), /* gate */ 44362306a36Sopenharmony_ci 0); 44462306a36Sopenharmony_ci 44562306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1-sample", "mmc1", 44662306a36Sopenharmony_ci 0x414, 20, 3, 0); 44762306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1-output", "mmc1", 44862306a36Sopenharmony_ci 0x414, 8, 3, 0); 44962306a36Sopenharmony_ci 45062306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 45162306a36Sopenharmony_ci 0x418, 45262306a36Sopenharmony_ci 0, 4, /* M */ 45362306a36Sopenharmony_ci 16, 2, /* P */ 45462306a36Sopenharmony_ci 24, 4, /* mux */ 45562306a36Sopenharmony_ci BIT(31), /* gate */ 45662306a36Sopenharmony_ci 0); 45762306a36Sopenharmony_ci 45862306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2-sample", "mmc2", 45962306a36Sopenharmony_ci 0x418, 20, 3, 0); 46062306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_output_clk, "mmc2-output", "mmc2", 46162306a36Sopenharmony_ci 0x418, 8, 3, 0); 46262306a36Sopenharmony_ci 46362306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc3_clk, "mmc3", mod0_default_parents, 46462306a36Sopenharmony_ci 0x41c, 46562306a36Sopenharmony_ci 0, 4, /* M */ 46662306a36Sopenharmony_ci 16, 2, /* P */ 46762306a36Sopenharmony_ci 24, 4, /* mux */ 46862306a36Sopenharmony_ci BIT(31), /* gate */ 46962306a36Sopenharmony_ci 0); 47062306a36Sopenharmony_ci 47162306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc3_sample_clk, "mmc3-sample", "mmc3", 47262306a36Sopenharmony_ci 0x41c, 20, 3, 0); 47362306a36Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc3_output_clk, "mmc3-output", "mmc3", 47462306a36Sopenharmony_ci 0x41c, 8, 3, 0); 47562306a36Sopenharmony_ci 47662306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ts_clk, "ts", mod0_default_parents, 47762306a36Sopenharmony_ci 0x428, 47862306a36Sopenharmony_ci 0, 4, /* M */ 47962306a36Sopenharmony_ci 16, 2, /* P */ 48062306a36Sopenharmony_ci 24, 4, /* mux */ 48162306a36Sopenharmony_ci BIT(31), /* gate */ 48262306a36Sopenharmony_ci 0); 48362306a36Sopenharmony_ci 48462306a36Sopenharmony_cistatic const char * const ss_parents[] = { "osc24M", "pll-periph", 48562306a36Sopenharmony_ci "pll-periph1" }; 48662306a36Sopenharmony_cistatic const u8 ss_table[] = { 0, 1, 13 }; 48762306a36Sopenharmony_cistatic struct ccu_mp ss_clk = { 48862306a36Sopenharmony_ci .enable = BIT(31), 48962306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(0, 4), 49062306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(16, 2), 49162306a36Sopenharmony_ci .mux = _SUNXI_CCU_MUX_TABLE(24, 4, ss_table), 49262306a36Sopenharmony_ci .common = { 49362306a36Sopenharmony_ci .reg = 0x42c, 49462306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ss", 49562306a36Sopenharmony_ci ss_parents, 49662306a36Sopenharmony_ci &ccu_mp_ops, 49762306a36Sopenharmony_ci 0), 49862306a36Sopenharmony_ci }, 49962306a36Sopenharmony_ci}; 50062306a36Sopenharmony_ci 50162306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 50262306a36Sopenharmony_ci 0x430, 50362306a36Sopenharmony_ci 0, 4, /* M */ 50462306a36Sopenharmony_ci 16, 2, /* P */ 50562306a36Sopenharmony_ci 24, 4, /* mux */ 50662306a36Sopenharmony_ci BIT(31), /* gate */ 50762306a36Sopenharmony_ci 0); 50862306a36Sopenharmony_ci 50962306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 51062306a36Sopenharmony_ci 0x434, 51162306a36Sopenharmony_ci 0, 4, /* M */ 51262306a36Sopenharmony_ci 16, 2, /* P */ 51362306a36Sopenharmony_ci 24, 4, /* mux */ 51462306a36Sopenharmony_ci BIT(31), /* gate */ 51562306a36Sopenharmony_ci 0); 51662306a36Sopenharmony_ci 51762306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi2_clk, "spi2", mod0_default_parents, 51862306a36Sopenharmony_ci 0x438, 51962306a36Sopenharmony_ci 0, 4, /* M */ 52062306a36Sopenharmony_ci 16, 2, /* P */ 52162306a36Sopenharmony_ci 24, 4, /* mux */ 52262306a36Sopenharmony_ci BIT(31), /* gate */ 52362306a36Sopenharmony_ci 0); 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi3_clk, "spi3", mod0_default_parents, 52662306a36Sopenharmony_ci 0x43c, 52762306a36Sopenharmony_ci 0, 4, /* M */ 52862306a36Sopenharmony_ci 16, 2, /* P */ 52962306a36Sopenharmony_ci 24, 4, /* mux */ 53062306a36Sopenharmony_ci BIT(31), /* gate */ 53162306a36Sopenharmony_ci 0); 53262306a36Sopenharmony_ci 53362306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(i2s0_clk, "i2s0", "pll-audio", 53462306a36Sopenharmony_ci 0x440, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 53562306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(i2s1_clk, "i2s1", "pll-audio", 53662306a36Sopenharmony_ci 0x444, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 53762306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(spdif_clk, "spdif", "pll-audio", 53862306a36Sopenharmony_ci 0x44c, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 53962306a36Sopenharmony_ci 54062306a36Sopenharmony_cistatic const char * const sdram_parents[] = { "pll-periph0", "pll-ddr" }; 54162306a36Sopenharmony_cistatic const u8 sdram_table[] = { 0, 3 }; 54262306a36Sopenharmony_ci 54362306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(sdram_clk, "sdram", 54462306a36Sopenharmony_ci sdram_parents, sdram_table, 54562306a36Sopenharmony_ci 0x484, 54662306a36Sopenharmony_ci 8, 4, /* M */ 54762306a36Sopenharmony_ci 12, 4, /* mux */ 54862306a36Sopenharmony_ci 0, /* no gate */ 54962306a36Sopenharmony_ci CLK_IS_CRITICAL); 55062306a36Sopenharmony_ci 55162306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(de_clk, "de", "pll-de", 0x490, 55262306a36Sopenharmony_ci 0, 4, BIT(31), CLK_SET_RATE_PARENT); 55362306a36Sopenharmony_ci 55462306a36Sopenharmony_cistatic SUNXI_CCU_GATE(edp_clk, "edp", "osc24M", 0x494, BIT(31), 0); 55562306a36Sopenharmony_ci 55662306a36Sopenharmony_cistatic const char * const mp_parents[] = { "pll-video1", "pll-gpu", "pll-de" }; 55762306a36Sopenharmony_cistatic const u8 mp_table[] = { 9, 10, 11 }; 55862306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(mp_clk, "mp", mp_parents, mp_table, 55962306a36Sopenharmony_ci 0x498, 56062306a36Sopenharmony_ci 0, 4, /* M */ 56162306a36Sopenharmony_ci 24, 4, /* mux */ 56262306a36Sopenharmony_ci BIT(31), /* gate */ 56362306a36Sopenharmony_ci 0); 56462306a36Sopenharmony_ci 56562306a36Sopenharmony_cistatic const char * const display_parents[] = { "pll-video0", "pll-video1" }; 56662306a36Sopenharmony_cistatic const u8 display_table[] = { 8, 9 }; 56762306a36Sopenharmony_ci 56862306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(lcd0_clk, "lcd0", 56962306a36Sopenharmony_ci display_parents, display_table, 57062306a36Sopenharmony_ci 0x49c, 57162306a36Sopenharmony_ci 0, 4, /* M */ 57262306a36Sopenharmony_ci 24, 4, /* mux */ 57362306a36Sopenharmony_ci BIT(31), /* gate */ 57462306a36Sopenharmony_ci CLK_SET_RATE_NO_REPARENT | 57562306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 57662306a36Sopenharmony_ci 57762306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(lcd1_clk, "lcd1", 57862306a36Sopenharmony_ci display_parents, display_table, 57962306a36Sopenharmony_ci 0x4a0, 58062306a36Sopenharmony_ci 0, 4, /* M */ 58162306a36Sopenharmony_ci 24, 4, /* mux */ 58262306a36Sopenharmony_ci BIT(31), /* gate */ 58362306a36Sopenharmony_ci CLK_SET_RATE_NO_REPARENT | 58462306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 58562306a36Sopenharmony_ci 58662306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(mipi_dsi0_clk, "mipi-dsi0", 58762306a36Sopenharmony_ci display_parents, display_table, 58862306a36Sopenharmony_ci 0x4a8, 58962306a36Sopenharmony_ci 0, 4, /* M */ 59062306a36Sopenharmony_ci 24, 4, /* mux */ 59162306a36Sopenharmony_ci BIT(31), /* gate */ 59262306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 59362306a36Sopenharmony_ci 59462306a36Sopenharmony_cistatic const char * const mipi_dsi1_parents[] = { "osc24M", "pll-video1" }; 59562306a36Sopenharmony_cistatic const u8 mipi_dsi1_table[] = { 0, 9 }; 59662306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(mipi_dsi1_clk, "mipi-dsi1", 59762306a36Sopenharmony_ci mipi_dsi1_parents, mipi_dsi1_table, 59862306a36Sopenharmony_ci 0x4ac, 59962306a36Sopenharmony_ci 0, 4, /* M */ 60062306a36Sopenharmony_ci 24, 4, /* mux */ 60162306a36Sopenharmony_ci BIT(31), /* gate */ 60262306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 60362306a36Sopenharmony_ci 60462306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(hdmi_clk, "hdmi", 60562306a36Sopenharmony_ci display_parents, display_table, 60662306a36Sopenharmony_ci 0x4b0, 60762306a36Sopenharmony_ci 0, 4, /* M */ 60862306a36Sopenharmony_ci 24, 4, /* mux */ 60962306a36Sopenharmony_ci BIT(31), /* gate */ 61062306a36Sopenharmony_ci CLK_SET_RATE_NO_REPARENT | 61162306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 61262306a36Sopenharmony_ci 61362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(hdmi_slow_clk, "hdmi-slow", "osc24M", 0x4b4, BIT(31), 0); 61462306a36Sopenharmony_ci 61562306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(mipi_csi_clk, "mipi-csi", "osc24M", 0x4bc, 61662306a36Sopenharmony_ci 0, 4, BIT(31), 0); 61762306a36Sopenharmony_ci 61862306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(csi_isp_clk, "csi-isp", "pll-isp", 0x4c0, 61962306a36Sopenharmony_ci 0, 4, BIT(31), CLK_SET_RATE_PARENT); 62062306a36Sopenharmony_ci 62162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(csi_misc_clk, "csi-misc", "osc24M", 0x4c0, BIT(16), 0); 62262306a36Sopenharmony_ci 62362306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi0_mclk_clk, "csi0-mclk", 62462306a36Sopenharmony_ci mipi_dsi1_parents, mipi_dsi1_table, 62562306a36Sopenharmony_ci 0x4c4, 62662306a36Sopenharmony_ci 0, 4, /* M */ 62762306a36Sopenharmony_ci 24, 4, /* mux */ 62862306a36Sopenharmony_ci BIT(31), /* gate */ 62962306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 63062306a36Sopenharmony_ci 63162306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi1_mclk_clk, "csi1-mclk", 63262306a36Sopenharmony_ci mipi_dsi1_parents, mipi_dsi1_table, 63362306a36Sopenharmony_ci 0x4c8, 63462306a36Sopenharmony_ci 0, 4, /* M */ 63562306a36Sopenharmony_ci 24, 4, /* mux */ 63662306a36Sopenharmony_ci BIT(31), /* gate */ 63762306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 63862306a36Sopenharmony_ci 63962306a36Sopenharmony_cistatic const char * const fd_parents[] = { "pll-periph0", "pll-isp" }; 64062306a36Sopenharmony_cistatic const u8 fd_table[] = { 1, 12 }; 64162306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(fd_clk, "fd", fd_parents, fd_table, 64262306a36Sopenharmony_ci 0x4cc, 64362306a36Sopenharmony_ci 0, 4, /* M */ 64462306a36Sopenharmony_ci 24, 4, /* mux */ 64562306a36Sopenharmony_ci BIT(31), /* gate */ 64662306a36Sopenharmony_ci 0); 64762306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve", 0x4d0, 64862306a36Sopenharmony_ci 16, 3, BIT(31), CLK_SET_RATE_PARENT); 64962306a36Sopenharmony_ci 65062306a36Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", 0x4d4, BIT(31), 0); 65162306a36Sopenharmony_ci 65262306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(gpu_core_clk, "gpu-core", "pll-gpu", 0x4f0, 65362306a36Sopenharmony_ci 0, 3, BIT(31), CLK_SET_RATE_PARENT); 65462306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(gpu_memory_clk, "gpu-memory", "pll-gpu", 0x4f4, 65562306a36Sopenharmony_ci 0, 3, BIT(31), CLK_SET_RATE_PARENT); 65662306a36Sopenharmony_ci 65762306a36Sopenharmony_cistatic const char * const gpu_axi_parents[] = { "pll-periph0", "pll-gpu" }; 65862306a36Sopenharmony_cistatic const u8 gpu_axi_table[] = { 1, 10 }; 65962306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(gpu_axi_clk, "gpu-axi", 66062306a36Sopenharmony_ci gpu_axi_parents, gpu_axi_table, 66162306a36Sopenharmony_ci 0x4f8, 66262306a36Sopenharmony_ci 0, 4, /* M */ 66362306a36Sopenharmony_ci 24, 4, /* mux */ 66462306a36Sopenharmony_ci BIT(31), /* gate */ 66562306a36Sopenharmony_ci CLK_SET_RATE_PARENT); 66662306a36Sopenharmony_ci 66762306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(sata_clk, "sata", "pll-periph0", 0x500, 66862306a36Sopenharmony_ci 0, 4, BIT(31), 0); 66962306a36Sopenharmony_ci 67062306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ac97_clk, "ac97", "pll-audio", 67162306a36Sopenharmony_ci 0x504, 0, 4, BIT(31), CLK_SET_RATE_PARENT); 67262306a36Sopenharmony_ci 67362306a36Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mipi_hsi_clk, "mipi-hsi", 67462306a36Sopenharmony_ci mod0_default_parents, 0x508, 67562306a36Sopenharmony_ci 0, 4, /* M */ 67662306a36Sopenharmony_ci 24, 4, /* mux */ 67762306a36Sopenharmony_ci BIT(31), /* gate */ 67862306a36Sopenharmony_ci 0); 67962306a36Sopenharmony_ci 68062306a36Sopenharmony_cistatic const char * const gpadc_parents[] = { "osc24M", "pll-audio", "osc32k" }; 68162306a36Sopenharmony_cistatic const u8 gpadc_table[] = { 0, 4, 7 }; 68262306a36Sopenharmony_cistatic struct ccu_mp gpadc_clk = { 68362306a36Sopenharmony_ci .enable = BIT(31), 68462306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(0, 4), 68562306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(16, 2), 68662306a36Sopenharmony_ci .mux = _SUNXI_CCU_MUX_TABLE(24, 4, gpadc_table), 68762306a36Sopenharmony_ci .common = { 68862306a36Sopenharmony_ci .reg = 0x50c, 68962306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("gpadc", 69062306a36Sopenharmony_ci gpadc_parents, 69162306a36Sopenharmony_ci &ccu_mp_ops, 69262306a36Sopenharmony_ci 0), 69362306a36Sopenharmony_ci }, 69462306a36Sopenharmony_ci}; 69562306a36Sopenharmony_ci 69662306a36Sopenharmony_cistatic const char * const cir_tx_parents[] = { "osc24M", "osc32k" }; 69762306a36Sopenharmony_cistatic const u8 cir_tx_table[] = { 0, 7 }; 69862306a36Sopenharmony_cistatic struct ccu_mp cir_tx_clk = { 69962306a36Sopenharmony_ci .enable = BIT(31), 70062306a36Sopenharmony_ci .m = _SUNXI_CCU_DIV(0, 4), 70162306a36Sopenharmony_ci .p = _SUNXI_CCU_DIV(16, 2), 70262306a36Sopenharmony_ci .mux = _SUNXI_CCU_MUX_TABLE(24, 4, cir_tx_table), 70362306a36Sopenharmony_ci .common = { 70462306a36Sopenharmony_ci .reg = 0x510, 70562306a36Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("cir-tx", 70662306a36Sopenharmony_ci cir_tx_parents, 70762306a36Sopenharmony_ci &ccu_mp_ops, 70862306a36Sopenharmony_ci 0), 70962306a36Sopenharmony_ci }, 71062306a36Sopenharmony_ci}; 71162306a36Sopenharmony_ci 71262306a36Sopenharmony_ci/* AHB0 bus gates */ 71362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_fd_clk, "bus-fd", "ahb0", 71462306a36Sopenharmony_ci 0x580, BIT(0), 0); 71562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "ahb0", 71662306a36Sopenharmony_ci 0x580, BIT(1), 0); 71762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gpu_ctrl_clk, "bus-gpu-ctrl", "ahb0", 71862306a36Sopenharmony_ci 0x580, BIT(3), 0); 71962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ss_clk, "bus-ss", "ahb0", 72062306a36Sopenharmony_ci 0x580, BIT(5), 0); 72162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc_clk, "bus-mmc", "ahb0", 72262306a36Sopenharmony_ci 0x580, BIT(8), 0); 72362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_nand0_clk, "bus-nand0", "ahb0", 72462306a36Sopenharmony_ci 0x580, BIT(12), 0); 72562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_nand1_clk, "bus-nand1", "ahb0", 72662306a36Sopenharmony_ci 0x580, BIT(13), 0); 72762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_sdram_clk, "bus-sdram", "ahb0", 72862306a36Sopenharmony_ci 0x580, BIT(14), 0); 72962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mipi_hsi_clk, "bus-mipi-hsi", "ahb0", 73062306a36Sopenharmony_ci 0x580, BIT(15), 0); 73162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_sata_clk, "bus-sata", "ahb0", 73262306a36Sopenharmony_ci 0x580, BIT(16), 0); 73362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ts_clk, "bus-ts", "ahb0", 73462306a36Sopenharmony_ci 0x580, BIT(18), 0); 73562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb0", 73662306a36Sopenharmony_ci 0x580, BIT(20), 0); 73762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi1_clk, "bus-spi1", "ahb0", 73862306a36Sopenharmony_ci 0x580, BIT(21), 0); 73962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi2_clk, "bus-spi2", "ahb0", 74062306a36Sopenharmony_ci 0x580, BIT(22), 0); 74162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi3_clk, "bus-spi3", "ahb0", 74262306a36Sopenharmony_ci 0x580, BIT(23), 0); 74362306a36Sopenharmony_ci 74462306a36Sopenharmony_ci/* AHB1 bus gates */ 74562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb1", 74662306a36Sopenharmony_ci 0x584, BIT(0), 0); 74762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_usb_clk, "bus-usb", "ahb1", 74862306a36Sopenharmony_ci 0x584, BIT(1), 0); 74962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gmac_clk, "bus-gmac", "ahb1", 75062306a36Sopenharmony_ci 0x584, BIT(17), 0); 75162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_msgbox_clk, "bus-msgbox", "ahb1", 75262306a36Sopenharmony_ci 0x584, BIT(21), 0); 75362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spinlock_clk, "bus-spinlock", "ahb1", 75462306a36Sopenharmony_ci 0x584, BIT(22), 0); 75562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "ahb1", 75662306a36Sopenharmony_ci 0x584, BIT(23), 0); 75762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "ahb1", 75862306a36Sopenharmony_ci 0x584, BIT(24), 0); 75962306a36Sopenharmony_ci 76062306a36Sopenharmony_ci/* AHB2 bus gates */ 76162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_lcd0_clk, "bus-lcd0", "ahb2", 76262306a36Sopenharmony_ci 0x588, BIT(0), 0); 76362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_lcd1_clk, "bus-lcd1", "ahb2", 76462306a36Sopenharmony_ci 0x588, BIT(1), 0); 76562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_edp_clk, "bus-edp", "ahb2", 76662306a36Sopenharmony_ci 0x588, BIT(2), 0); 76762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_csi_clk, "bus-csi", "ahb2", 76862306a36Sopenharmony_ci 0x588, BIT(4), 0); 76962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hdmi_clk, "bus-hdmi", "ahb2", 77062306a36Sopenharmony_ci 0x588, BIT(5), 0); 77162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_de_clk, "bus-de", "ahb2", 77262306a36Sopenharmony_ci 0x588, BIT(7), 0); 77362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mp_clk, "bus-mp", "ahb2", 77462306a36Sopenharmony_ci 0x588, BIT(8), 0); 77562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mipi_dsi_clk, "bus-mipi-dsi", "ahb2", 77662306a36Sopenharmony_ci 0x588, BIT(11), 0); 77762306a36Sopenharmony_ci 77862306a36Sopenharmony_ci/* APB0 bus gates */ 77962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spdif_clk, "bus-spdif", "apb0", 78062306a36Sopenharmony_ci 0x590, BIT(1), 0); 78162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_pio_clk, "bus-pio", "apb0", 78262306a36Sopenharmony_ci 0x590, BIT(5), 0); 78362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ac97_clk, "bus-ac97", "apb0", 78462306a36Sopenharmony_ci 0x590, BIT(11), 0); 78562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s0_clk, "bus-i2s0", "apb0", 78662306a36Sopenharmony_ci 0x590, BIT(12), 0); 78762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s1_clk, "bus-i2s1", "apb0", 78862306a36Sopenharmony_ci 0x590, BIT(13), 0); 78962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_lradc_clk, "bus-lradc", "apb0", 79062306a36Sopenharmony_ci 0x590, BIT(15), 0); 79162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gpadc_clk, "bus-gpadc", "apb0", 79262306a36Sopenharmony_ci 0x590, BIT(17), 0); 79362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_twd_clk, "bus-twd", "apb0", 79462306a36Sopenharmony_ci 0x590, BIT(18), 0); 79562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_cir_tx_clk, "bus-cir-tx", "apb0", 79662306a36Sopenharmony_ci 0x590, BIT(19), 0); 79762306a36Sopenharmony_ci 79862306a36Sopenharmony_ci/* APB1 bus gates */ 79962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb1", 80062306a36Sopenharmony_ci 0x594, BIT(0), 0); 80162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb1", 80262306a36Sopenharmony_ci 0x594, BIT(1), 0); 80362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb1", 80462306a36Sopenharmony_ci 0x594, BIT(2), 0); 80562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c3_clk, "bus-i2c3", "apb1", 80662306a36Sopenharmony_ci 0x594, BIT(3), 0); 80762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c4_clk, "bus-i2c4", "apb1", 80862306a36Sopenharmony_ci 0x594, BIT(4), 0); 80962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb1", 81062306a36Sopenharmony_ci 0x594, BIT(16), 0); 81162306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb1", 81262306a36Sopenharmony_ci 0x594, BIT(17), 0); 81362306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb1", 81462306a36Sopenharmony_ci 0x594, BIT(18), 0); 81562306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb1", 81662306a36Sopenharmony_ci 0x594, BIT(19), 0); 81762306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart4_clk, "bus-uart4", "apb1", 81862306a36Sopenharmony_ci 0x594, BIT(20), 0); 81962306a36Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart5_clk, "bus-uart5", "apb1", 82062306a36Sopenharmony_ci 0x594, BIT(21), 0); 82162306a36Sopenharmony_ci 82262306a36Sopenharmony_cistatic struct ccu_common *sun9i_a80_ccu_clks[] = { 82362306a36Sopenharmony_ci &pll_c0cpux_clk.common, 82462306a36Sopenharmony_ci &pll_c1cpux_clk.common, 82562306a36Sopenharmony_ci &pll_audio_clk.common, 82662306a36Sopenharmony_ci &pll_periph0_clk.common, 82762306a36Sopenharmony_ci &pll_ve_clk.common, 82862306a36Sopenharmony_ci &pll_ddr_clk.common, 82962306a36Sopenharmony_ci &pll_video0_clk.common, 83062306a36Sopenharmony_ci &pll_video1_clk.common, 83162306a36Sopenharmony_ci &pll_gpu_clk.common, 83262306a36Sopenharmony_ci &pll_de_clk.common, 83362306a36Sopenharmony_ci &pll_isp_clk.common, 83462306a36Sopenharmony_ci &pll_periph1_clk.common, 83562306a36Sopenharmony_ci &c0cpux_clk.common, 83662306a36Sopenharmony_ci &c1cpux_clk.common, 83762306a36Sopenharmony_ci &atb0_clk.common, 83862306a36Sopenharmony_ci &axi0_clk.common, 83962306a36Sopenharmony_ci &atb1_clk.common, 84062306a36Sopenharmony_ci &axi1_clk.common, 84162306a36Sopenharmony_ci >bus_clk.common, 84262306a36Sopenharmony_ci &ahb0_clk.common, 84362306a36Sopenharmony_ci &ahb1_clk.common, 84462306a36Sopenharmony_ci &ahb2_clk.common, 84562306a36Sopenharmony_ci &apb0_clk.common, 84662306a36Sopenharmony_ci &apb1_clk.common, 84762306a36Sopenharmony_ci &cci400_clk.common, 84862306a36Sopenharmony_ci &ats_clk.common, 84962306a36Sopenharmony_ci &trace_clk.common, 85062306a36Sopenharmony_ci 85162306a36Sopenharmony_ci &out_a_clk.common, 85262306a36Sopenharmony_ci &out_b_clk.common, 85362306a36Sopenharmony_ci 85462306a36Sopenharmony_ci /* module clocks */ 85562306a36Sopenharmony_ci &nand0_0_clk.common, 85662306a36Sopenharmony_ci &nand0_1_clk.common, 85762306a36Sopenharmony_ci &nand1_0_clk.common, 85862306a36Sopenharmony_ci &nand1_1_clk.common, 85962306a36Sopenharmony_ci &mmc0_clk.common, 86062306a36Sopenharmony_ci &mmc0_sample_clk.common, 86162306a36Sopenharmony_ci &mmc0_output_clk.common, 86262306a36Sopenharmony_ci &mmc1_clk.common, 86362306a36Sopenharmony_ci &mmc1_sample_clk.common, 86462306a36Sopenharmony_ci &mmc1_output_clk.common, 86562306a36Sopenharmony_ci &mmc2_clk.common, 86662306a36Sopenharmony_ci &mmc2_sample_clk.common, 86762306a36Sopenharmony_ci &mmc2_output_clk.common, 86862306a36Sopenharmony_ci &mmc3_clk.common, 86962306a36Sopenharmony_ci &mmc3_sample_clk.common, 87062306a36Sopenharmony_ci &mmc3_output_clk.common, 87162306a36Sopenharmony_ci &ts_clk.common, 87262306a36Sopenharmony_ci &ss_clk.common, 87362306a36Sopenharmony_ci &spi0_clk.common, 87462306a36Sopenharmony_ci &spi1_clk.common, 87562306a36Sopenharmony_ci &spi2_clk.common, 87662306a36Sopenharmony_ci &spi3_clk.common, 87762306a36Sopenharmony_ci &i2s0_clk.common, 87862306a36Sopenharmony_ci &i2s1_clk.common, 87962306a36Sopenharmony_ci &spdif_clk.common, 88062306a36Sopenharmony_ci &sdram_clk.common, 88162306a36Sopenharmony_ci &de_clk.common, 88262306a36Sopenharmony_ci &edp_clk.common, 88362306a36Sopenharmony_ci &mp_clk.common, 88462306a36Sopenharmony_ci &lcd0_clk.common, 88562306a36Sopenharmony_ci &lcd1_clk.common, 88662306a36Sopenharmony_ci &mipi_dsi0_clk.common, 88762306a36Sopenharmony_ci &mipi_dsi1_clk.common, 88862306a36Sopenharmony_ci &hdmi_clk.common, 88962306a36Sopenharmony_ci &hdmi_slow_clk.common, 89062306a36Sopenharmony_ci &mipi_csi_clk.common, 89162306a36Sopenharmony_ci &csi_isp_clk.common, 89262306a36Sopenharmony_ci &csi_misc_clk.common, 89362306a36Sopenharmony_ci &csi0_mclk_clk.common, 89462306a36Sopenharmony_ci &csi1_mclk_clk.common, 89562306a36Sopenharmony_ci &fd_clk.common, 89662306a36Sopenharmony_ci &ve_clk.common, 89762306a36Sopenharmony_ci &avs_clk.common, 89862306a36Sopenharmony_ci &gpu_core_clk.common, 89962306a36Sopenharmony_ci &gpu_memory_clk.common, 90062306a36Sopenharmony_ci &gpu_axi_clk.common, 90162306a36Sopenharmony_ci &sata_clk.common, 90262306a36Sopenharmony_ci &ac97_clk.common, 90362306a36Sopenharmony_ci &mipi_hsi_clk.common, 90462306a36Sopenharmony_ci &gpadc_clk.common, 90562306a36Sopenharmony_ci &cir_tx_clk.common, 90662306a36Sopenharmony_ci 90762306a36Sopenharmony_ci /* AHB0 bus gates */ 90862306a36Sopenharmony_ci &bus_fd_clk.common, 90962306a36Sopenharmony_ci &bus_ve_clk.common, 91062306a36Sopenharmony_ci &bus_gpu_ctrl_clk.common, 91162306a36Sopenharmony_ci &bus_ss_clk.common, 91262306a36Sopenharmony_ci &bus_mmc_clk.common, 91362306a36Sopenharmony_ci &bus_nand0_clk.common, 91462306a36Sopenharmony_ci &bus_nand1_clk.common, 91562306a36Sopenharmony_ci &bus_sdram_clk.common, 91662306a36Sopenharmony_ci &bus_mipi_hsi_clk.common, 91762306a36Sopenharmony_ci &bus_sata_clk.common, 91862306a36Sopenharmony_ci &bus_ts_clk.common, 91962306a36Sopenharmony_ci &bus_spi0_clk.common, 92062306a36Sopenharmony_ci &bus_spi1_clk.common, 92162306a36Sopenharmony_ci &bus_spi2_clk.common, 92262306a36Sopenharmony_ci &bus_spi3_clk.common, 92362306a36Sopenharmony_ci 92462306a36Sopenharmony_ci /* AHB1 bus gates */ 92562306a36Sopenharmony_ci &bus_otg_clk.common, 92662306a36Sopenharmony_ci &bus_usb_clk.common, 92762306a36Sopenharmony_ci &bus_gmac_clk.common, 92862306a36Sopenharmony_ci &bus_msgbox_clk.common, 92962306a36Sopenharmony_ci &bus_spinlock_clk.common, 93062306a36Sopenharmony_ci &bus_hstimer_clk.common, 93162306a36Sopenharmony_ci &bus_dma_clk.common, 93262306a36Sopenharmony_ci 93362306a36Sopenharmony_ci /* AHB2 bus gates */ 93462306a36Sopenharmony_ci &bus_lcd0_clk.common, 93562306a36Sopenharmony_ci &bus_lcd1_clk.common, 93662306a36Sopenharmony_ci &bus_edp_clk.common, 93762306a36Sopenharmony_ci &bus_csi_clk.common, 93862306a36Sopenharmony_ci &bus_hdmi_clk.common, 93962306a36Sopenharmony_ci &bus_de_clk.common, 94062306a36Sopenharmony_ci &bus_mp_clk.common, 94162306a36Sopenharmony_ci &bus_mipi_dsi_clk.common, 94262306a36Sopenharmony_ci 94362306a36Sopenharmony_ci /* APB0 bus gates */ 94462306a36Sopenharmony_ci &bus_spdif_clk.common, 94562306a36Sopenharmony_ci &bus_pio_clk.common, 94662306a36Sopenharmony_ci &bus_ac97_clk.common, 94762306a36Sopenharmony_ci &bus_i2s0_clk.common, 94862306a36Sopenharmony_ci &bus_i2s1_clk.common, 94962306a36Sopenharmony_ci &bus_lradc_clk.common, 95062306a36Sopenharmony_ci &bus_gpadc_clk.common, 95162306a36Sopenharmony_ci &bus_twd_clk.common, 95262306a36Sopenharmony_ci &bus_cir_tx_clk.common, 95362306a36Sopenharmony_ci 95462306a36Sopenharmony_ci /* APB1 bus gates */ 95562306a36Sopenharmony_ci &bus_i2c0_clk.common, 95662306a36Sopenharmony_ci &bus_i2c1_clk.common, 95762306a36Sopenharmony_ci &bus_i2c2_clk.common, 95862306a36Sopenharmony_ci &bus_i2c3_clk.common, 95962306a36Sopenharmony_ci &bus_i2c4_clk.common, 96062306a36Sopenharmony_ci &bus_uart0_clk.common, 96162306a36Sopenharmony_ci &bus_uart1_clk.common, 96262306a36Sopenharmony_ci &bus_uart2_clk.common, 96362306a36Sopenharmony_ci &bus_uart3_clk.common, 96462306a36Sopenharmony_ci &bus_uart4_clk.common, 96562306a36Sopenharmony_ci &bus_uart5_clk.common, 96662306a36Sopenharmony_ci}; 96762306a36Sopenharmony_ci 96862306a36Sopenharmony_cistatic struct clk_hw_onecell_data sun9i_a80_hw_clks = { 96962306a36Sopenharmony_ci .hws = { 97062306a36Sopenharmony_ci [CLK_PLL_C0CPUX] = &pll_c0cpux_clk.common.hw, 97162306a36Sopenharmony_ci [CLK_PLL_C1CPUX] = &pll_c1cpux_clk.common.hw, 97262306a36Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.common.hw, 97362306a36Sopenharmony_ci [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw, 97462306a36Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 97562306a36Sopenharmony_ci [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 97662306a36Sopenharmony_ci [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 97762306a36Sopenharmony_ci [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 97862306a36Sopenharmony_ci [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 97962306a36Sopenharmony_ci [CLK_PLL_DE] = &pll_de_clk.common.hw, 98062306a36Sopenharmony_ci [CLK_PLL_ISP] = &pll_isp_clk.common.hw, 98162306a36Sopenharmony_ci [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw, 98262306a36Sopenharmony_ci [CLK_C0CPUX] = &c0cpux_clk.common.hw, 98362306a36Sopenharmony_ci [CLK_C1CPUX] = &c1cpux_clk.common.hw, 98462306a36Sopenharmony_ci [CLK_ATB0] = &atb0_clk.common.hw, 98562306a36Sopenharmony_ci [CLK_AXI0] = &axi0_clk.common.hw, 98662306a36Sopenharmony_ci [CLK_ATB1] = &atb1_clk.common.hw, 98762306a36Sopenharmony_ci [CLK_AXI1] = &axi1_clk.common.hw, 98862306a36Sopenharmony_ci [CLK_GTBUS] = >bus_clk.common.hw, 98962306a36Sopenharmony_ci [CLK_AHB0] = &ahb0_clk.common.hw, 99062306a36Sopenharmony_ci [CLK_AHB1] = &ahb1_clk.common.hw, 99162306a36Sopenharmony_ci [CLK_AHB2] = &ahb2_clk.common.hw, 99262306a36Sopenharmony_ci [CLK_APB0] = &apb0_clk.common.hw, 99362306a36Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 99462306a36Sopenharmony_ci [CLK_CCI400] = &cci400_clk.common.hw, 99562306a36Sopenharmony_ci [CLK_ATS] = &ats_clk.common.hw, 99662306a36Sopenharmony_ci [CLK_TRACE] = &trace_clk.common.hw, 99762306a36Sopenharmony_ci 99862306a36Sopenharmony_ci [CLK_OUT_A] = &out_a_clk.common.hw, 99962306a36Sopenharmony_ci [CLK_OUT_B] = &out_b_clk.common.hw, 100062306a36Sopenharmony_ci 100162306a36Sopenharmony_ci [CLK_NAND0_0] = &nand0_0_clk.common.hw, 100262306a36Sopenharmony_ci [CLK_NAND0_1] = &nand0_1_clk.common.hw, 100362306a36Sopenharmony_ci [CLK_NAND1_0] = &nand1_0_clk.common.hw, 100462306a36Sopenharmony_ci [CLK_NAND1_1] = &nand1_1_clk.common.hw, 100562306a36Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 100662306a36Sopenharmony_ci [CLK_MMC0_SAMPLE] = &mmc0_sample_clk.common.hw, 100762306a36Sopenharmony_ci [CLK_MMC0_OUTPUT] = &mmc0_output_clk.common.hw, 100862306a36Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 100962306a36Sopenharmony_ci [CLK_MMC1_SAMPLE] = &mmc1_sample_clk.common.hw, 101062306a36Sopenharmony_ci [CLK_MMC1_OUTPUT] = &mmc1_output_clk.common.hw, 101162306a36Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 101262306a36Sopenharmony_ci [CLK_MMC2_SAMPLE] = &mmc2_sample_clk.common.hw, 101362306a36Sopenharmony_ci [CLK_MMC2_OUTPUT] = &mmc2_output_clk.common.hw, 101462306a36Sopenharmony_ci [CLK_MMC3] = &mmc3_clk.common.hw, 101562306a36Sopenharmony_ci [CLK_MMC3_SAMPLE] = &mmc3_sample_clk.common.hw, 101662306a36Sopenharmony_ci [CLK_MMC3_OUTPUT] = &mmc3_output_clk.common.hw, 101762306a36Sopenharmony_ci [CLK_TS] = &ts_clk.common.hw, 101862306a36Sopenharmony_ci [CLK_SS] = &ss_clk.common.hw, 101962306a36Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 102062306a36Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 102162306a36Sopenharmony_ci [CLK_SPI2] = &spi2_clk.common.hw, 102262306a36Sopenharmony_ci [CLK_SPI3] = &spi3_clk.common.hw, 102362306a36Sopenharmony_ci [CLK_I2S0] = &i2s0_clk.common.hw, 102462306a36Sopenharmony_ci [CLK_I2S1] = &i2s1_clk.common.hw, 102562306a36Sopenharmony_ci [CLK_SPDIF] = &spdif_clk.common.hw, 102662306a36Sopenharmony_ci [CLK_SDRAM] = &sdram_clk.common.hw, 102762306a36Sopenharmony_ci [CLK_DE] = &de_clk.common.hw, 102862306a36Sopenharmony_ci [CLK_EDP] = &edp_clk.common.hw, 102962306a36Sopenharmony_ci [CLK_MP] = &mp_clk.common.hw, 103062306a36Sopenharmony_ci [CLK_LCD0] = &lcd0_clk.common.hw, 103162306a36Sopenharmony_ci [CLK_LCD1] = &lcd1_clk.common.hw, 103262306a36Sopenharmony_ci [CLK_MIPI_DSI0] = &mipi_dsi0_clk.common.hw, 103362306a36Sopenharmony_ci [CLK_MIPI_DSI1] = &mipi_dsi1_clk.common.hw, 103462306a36Sopenharmony_ci [CLK_HDMI] = &hdmi_clk.common.hw, 103562306a36Sopenharmony_ci [CLK_HDMI_SLOW] = &hdmi_slow_clk.common.hw, 103662306a36Sopenharmony_ci [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw, 103762306a36Sopenharmony_ci [CLK_CSI_ISP] = &csi_isp_clk.common.hw, 103862306a36Sopenharmony_ci [CLK_CSI_MISC] = &csi_misc_clk.common.hw, 103962306a36Sopenharmony_ci [CLK_CSI0_MCLK] = &csi0_mclk_clk.common.hw, 104062306a36Sopenharmony_ci [CLK_CSI1_MCLK] = &csi1_mclk_clk.common.hw, 104162306a36Sopenharmony_ci [CLK_FD] = &fd_clk.common.hw, 104262306a36Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 104362306a36Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 104462306a36Sopenharmony_ci [CLK_GPU_CORE] = &gpu_core_clk.common.hw, 104562306a36Sopenharmony_ci [CLK_GPU_MEMORY] = &gpu_memory_clk.common.hw, 104662306a36Sopenharmony_ci [CLK_GPU_AXI] = &gpu_axi_clk.common.hw, 104762306a36Sopenharmony_ci [CLK_SATA] = &sata_clk.common.hw, 104862306a36Sopenharmony_ci [CLK_AC97] = &ac97_clk.common.hw, 104962306a36Sopenharmony_ci [CLK_MIPI_HSI] = &mipi_hsi_clk.common.hw, 105062306a36Sopenharmony_ci [CLK_GPADC] = &gpadc_clk.common.hw, 105162306a36Sopenharmony_ci [CLK_CIR_TX] = &cir_tx_clk.common.hw, 105262306a36Sopenharmony_ci 105362306a36Sopenharmony_ci [CLK_BUS_FD] = &bus_fd_clk.common.hw, 105462306a36Sopenharmony_ci [CLK_BUS_VE] = &bus_ve_clk.common.hw, 105562306a36Sopenharmony_ci [CLK_BUS_GPU_CTRL] = &bus_gpu_ctrl_clk.common.hw, 105662306a36Sopenharmony_ci [CLK_BUS_SS] = &bus_ss_clk.common.hw, 105762306a36Sopenharmony_ci [CLK_BUS_MMC] = &bus_mmc_clk.common.hw, 105862306a36Sopenharmony_ci [CLK_BUS_NAND0] = &bus_nand0_clk.common.hw, 105962306a36Sopenharmony_ci [CLK_BUS_NAND1] = &bus_nand1_clk.common.hw, 106062306a36Sopenharmony_ci [CLK_BUS_SDRAM] = &bus_sdram_clk.common.hw, 106162306a36Sopenharmony_ci [CLK_BUS_MIPI_HSI] = &bus_mipi_hsi_clk.common.hw, 106262306a36Sopenharmony_ci [CLK_BUS_SATA] = &bus_sata_clk.common.hw, 106362306a36Sopenharmony_ci [CLK_BUS_TS] = &bus_ts_clk.common.hw, 106462306a36Sopenharmony_ci [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw, 106562306a36Sopenharmony_ci [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw, 106662306a36Sopenharmony_ci [CLK_BUS_SPI2] = &bus_spi2_clk.common.hw, 106762306a36Sopenharmony_ci [CLK_BUS_SPI3] = &bus_spi3_clk.common.hw, 106862306a36Sopenharmony_ci 106962306a36Sopenharmony_ci [CLK_BUS_OTG] = &bus_otg_clk.common.hw, 107062306a36Sopenharmony_ci [CLK_BUS_USB] = &bus_usb_clk.common.hw, 107162306a36Sopenharmony_ci [CLK_BUS_GMAC] = &bus_gmac_clk.common.hw, 107262306a36Sopenharmony_ci [CLK_BUS_MSGBOX] = &bus_msgbox_clk.common.hw, 107362306a36Sopenharmony_ci [CLK_BUS_SPINLOCK] = &bus_spinlock_clk.common.hw, 107462306a36Sopenharmony_ci [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw, 107562306a36Sopenharmony_ci [CLK_BUS_DMA] = &bus_dma_clk.common.hw, 107662306a36Sopenharmony_ci 107762306a36Sopenharmony_ci [CLK_BUS_LCD0] = &bus_lcd0_clk.common.hw, 107862306a36Sopenharmony_ci [CLK_BUS_LCD1] = &bus_lcd1_clk.common.hw, 107962306a36Sopenharmony_ci [CLK_BUS_EDP] = &bus_edp_clk.common.hw, 108062306a36Sopenharmony_ci [CLK_BUS_CSI] = &bus_csi_clk.common.hw, 108162306a36Sopenharmony_ci [CLK_BUS_HDMI] = &bus_hdmi_clk.common.hw, 108262306a36Sopenharmony_ci [CLK_BUS_DE] = &bus_de_clk.common.hw, 108362306a36Sopenharmony_ci [CLK_BUS_MP] = &bus_mp_clk.common.hw, 108462306a36Sopenharmony_ci [CLK_BUS_MIPI_DSI] = &bus_mipi_dsi_clk.common.hw, 108562306a36Sopenharmony_ci 108662306a36Sopenharmony_ci [CLK_BUS_SPDIF] = &bus_spdif_clk.common.hw, 108762306a36Sopenharmony_ci [CLK_BUS_PIO] = &bus_pio_clk.common.hw, 108862306a36Sopenharmony_ci [CLK_BUS_AC97] = &bus_ac97_clk.common.hw, 108962306a36Sopenharmony_ci [CLK_BUS_I2S0] = &bus_i2s0_clk.common.hw, 109062306a36Sopenharmony_ci [CLK_BUS_I2S1] = &bus_i2s1_clk.common.hw, 109162306a36Sopenharmony_ci [CLK_BUS_LRADC] = &bus_lradc_clk.common.hw, 109262306a36Sopenharmony_ci [CLK_BUS_GPADC] = &bus_gpadc_clk.common.hw, 109362306a36Sopenharmony_ci [CLK_BUS_TWD] = &bus_twd_clk.common.hw, 109462306a36Sopenharmony_ci [CLK_BUS_CIR_TX] = &bus_cir_tx_clk.common.hw, 109562306a36Sopenharmony_ci 109662306a36Sopenharmony_ci [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw, 109762306a36Sopenharmony_ci [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw, 109862306a36Sopenharmony_ci [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw, 109962306a36Sopenharmony_ci [CLK_BUS_I2C3] = &bus_i2c3_clk.common.hw, 110062306a36Sopenharmony_ci [CLK_BUS_I2C4] = &bus_i2c4_clk.common.hw, 110162306a36Sopenharmony_ci [CLK_BUS_UART0] = &bus_uart0_clk.common.hw, 110262306a36Sopenharmony_ci [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 110362306a36Sopenharmony_ci [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 110462306a36Sopenharmony_ci [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 110562306a36Sopenharmony_ci [CLK_BUS_UART4] = &bus_uart4_clk.common.hw, 110662306a36Sopenharmony_ci [CLK_BUS_UART5] = &bus_uart5_clk.common.hw, 110762306a36Sopenharmony_ci }, 110862306a36Sopenharmony_ci .num = CLK_NUMBER, 110962306a36Sopenharmony_ci}; 111062306a36Sopenharmony_ci 111162306a36Sopenharmony_cistatic struct ccu_reset_map sun9i_a80_ccu_resets[] = { 111262306a36Sopenharmony_ci /* AHB0 reset controls */ 111362306a36Sopenharmony_ci [RST_BUS_FD] = { 0x5a0, BIT(0) }, 111462306a36Sopenharmony_ci [RST_BUS_VE] = { 0x5a0, BIT(1) }, 111562306a36Sopenharmony_ci [RST_BUS_GPU_CTRL] = { 0x5a0, BIT(3) }, 111662306a36Sopenharmony_ci [RST_BUS_SS] = { 0x5a0, BIT(5) }, 111762306a36Sopenharmony_ci [RST_BUS_MMC] = { 0x5a0, BIT(8) }, 111862306a36Sopenharmony_ci [RST_BUS_NAND0] = { 0x5a0, BIT(12) }, 111962306a36Sopenharmony_ci [RST_BUS_NAND1] = { 0x5a0, BIT(13) }, 112062306a36Sopenharmony_ci [RST_BUS_SDRAM] = { 0x5a0, BIT(14) }, 112162306a36Sopenharmony_ci [RST_BUS_SATA] = { 0x5a0, BIT(16) }, 112262306a36Sopenharmony_ci [RST_BUS_TS] = { 0x5a0, BIT(18) }, 112362306a36Sopenharmony_ci [RST_BUS_SPI0] = { 0x5a0, BIT(20) }, 112462306a36Sopenharmony_ci [RST_BUS_SPI1] = { 0x5a0, BIT(21) }, 112562306a36Sopenharmony_ci [RST_BUS_SPI2] = { 0x5a0, BIT(22) }, 112662306a36Sopenharmony_ci [RST_BUS_SPI3] = { 0x5a0, BIT(23) }, 112762306a36Sopenharmony_ci 112862306a36Sopenharmony_ci /* AHB1 reset controls */ 112962306a36Sopenharmony_ci [RST_BUS_OTG] = { 0x5a4, BIT(0) }, 113062306a36Sopenharmony_ci [RST_BUS_OTG_PHY] = { 0x5a4, BIT(1) }, 113162306a36Sopenharmony_ci [RST_BUS_MIPI_HSI] = { 0x5a4, BIT(9) }, 113262306a36Sopenharmony_ci [RST_BUS_GMAC] = { 0x5a4, BIT(17) }, 113362306a36Sopenharmony_ci [RST_BUS_MSGBOX] = { 0x5a4, BIT(21) }, 113462306a36Sopenharmony_ci [RST_BUS_SPINLOCK] = { 0x5a4, BIT(22) }, 113562306a36Sopenharmony_ci [RST_BUS_HSTIMER] = { 0x5a4, BIT(23) }, 113662306a36Sopenharmony_ci [RST_BUS_DMA] = { 0x5a4, BIT(24) }, 113762306a36Sopenharmony_ci 113862306a36Sopenharmony_ci /* AHB2 reset controls */ 113962306a36Sopenharmony_ci [RST_BUS_LCD0] = { 0x5a8, BIT(0) }, 114062306a36Sopenharmony_ci [RST_BUS_LCD1] = { 0x5a8, BIT(1) }, 114162306a36Sopenharmony_ci [RST_BUS_EDP] = { 0x5a8, BIT(2) }, 114262306a36Sopenharmony_ci [RST_BUS_LVDS] = { 0x5a8, BIT(3) }, 114362306a36Sopenharmony_ci [RST_BUS_CSI] = { 0x5a8, BIT(4) }, 114462306a36Sopenharmony_ci [RST_BUS_HDMI0] = { 0x5a8, BIT(5) }, 114562306a36Sopenharmony_ci [RST_BUS_HDMI1] = { 0x5a8, BIT(6) }, 114662306a36Sopenharmony_ci [RST_BUS_DE] = { 0x5a8, BIT(7) }, 114762306a36Sopenharmony_ci [RST_BUS_MP] = { 0x5a8, BIT(8) }, 114862306a36Sopenharmony_ci [RST_BUS_GPU] = { 0x5a8, BIT(9) }, 114962306a36Sopenharmony_ci [RST_BUS_MIPI_DSI] = { 0x5a8, BIT(11) }, 115062306a36Sopenharmony_ci 115162306a36Sopenharmony_ci /* APB0 reset controls */ 115262306a36Sopenharmony_ci [RST_BUS_SPDIF] = { 0x5b0, BIT(1) }, 115362306a36Sopenharmony_ci [RST_BUS_AC97] = { 0x5b0, BIT(11) }, 115462306a36Sopenharmony_ci [RST_BUS_I2S0] = { 0x5b0, BIT(12) }, 115562306a36Sopenharmony_ci [RST_BUS_I2S1] = { 0x5b0, BIT(13) }, 115662306a36Sopenharmony_ci [RST_BUS_LRADC] = { 0x5b0, BIT(15) }, 115762306a36Sopenharmony_ci [RST_BUS_GPADC] = { 0x5b0, BIT(17) }, 115862306a36Sopenharmony_ci [RST_BUS_CIR_TX] = { 0x5b0, BIT(19) }, 115962306a36Sopenharmony_ci 116062306a36Sopenharmony_ci /* APB1 reset controls */ 116162306a36Sopenharmony_ci [RST_BUS_I2C0] = { 0x5b4, BIT(0) }, 116262306a36Sopenharmony_ci [RST_BUS_I2C1] = { 0x5b4, BIT(1) }, 116362306a36Sopenharmony_ci [RST_BUS_I2C2] = { 0x5b4, BIT(2) }, 116462306a36Sopenharmony_ci [RST_BUS_I2C3] = { 0x5b4, BIT(3) }, 116562306a36Sopenharmony_ci [RST_BUS_I2C4] = { 0x5b4, BIT(4) }, 116662306a36Sopenharmony_ci [RST_BUS_UART0] = { 0x5b4, BIT(16) }, 116762306a36Sopenharmony_ci [RST_BUS_UART1] = { 0x5b4, BIT(17) }, 116862306a36Sopenharmony_ci [RST_BUS_UART2] = { 0x5b4, BIT(18) }, 116962306a36Sopenharmony_ci [RST_BUS_UART3] = { 0x5b4, BIT(19) }, 117062306a36Sopenharmony_ci [RST_BUS_UART4] = { 0x5b4, BIT(20) }, 117162306a36Sopenharmony_ci [RST_BUS_UART5] = { 0x5b4, BIT(21) }, 117262306a36Sopenharmony_ci}; 117362306a36Sopenharmony_ci 117462306a36Sopenharmony_cistatic const struct sunxi_ccu_desc sun9i_a80_ccu_desc = { 117562306a36Sopenharmony_ci .ccu_clks = sun9i_a80_ccu_clks, 117662306a36Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun9i_a80_ccu_clks), 117762306a36Sopenharmony_ci 117862306a36Sopenharmony_ci .hw_clks = &sun9i_a80_hw_clks, 117962306a36Sopenharmony_ci 118062306a36Sopenharmony_ci .resets = sun9i_a80_ccu_resets, 118162306a36Sopenharmony_ci .num_resets = ARRAY_SIZE(sun9i_a80_ccu_resets), 118262306a36Sopenharmony_ci}; 118362306a36Sopenharmony_ci 118462306a36Sopenharmony_ci#define SUN9I_A80_PLL_P_SHIFT 16 118562306a36Sopenharmony_ci#define SUN9I_A80_PLL_N_SHIFT 8 118662306a36Sopenharmony_ci#define SUN9I_A80_PLL_N_WIDTH 8 118762306a36Sopenharmony_ci 118862306a36Sopenharmony_cistatic void sun9i_a80_cpu_pll_fixup(void __iomem *reg) 118962306a36Sopenharmony_ci{ 119062306a36Sopenharmony_ci u32 val = readl(reg); 119162306a36Sopenharmony_ci 119262306a36Sopenharmony_ci /* bail out if P divider is not used */ 119362306a36Sopenharmony_ci if (!(val & BIT(SUN9I_A80_PLL_P_SHIFT))) 119462306a36Sopenharmony_ci return; 119562306a36Sopenharmony_ci 119662306a36Sopenharmony_ci /* 119762306a36Sopenharmony_ci * If P is used, output should be less than 288 MHz. When we 119862306a36Sopenharmony_ci * set P to 1, we should also decrease the multiplier so the 119962306a36Sopenharmony_ci * output doesn't go out of range, but not too much such that 120062306a36Sopenharmony_ci * the multiplier stays above 12, the minimal operation value. 120162306a36Sopenharmony_ci * 120262306a36Sopenharmony_ci * To keep it simple, set the multiplier to 17, the reset value. 120362306a36Sopenharmony_ci */ 120462306a36Sopenharmony_ci val &= ~GENMASK(SUN9I_A80_PLL_N_SHIFT + SUN9I_A80_PLL_N_WIDTH - 1, 120562306a36Sopenharmony_ci SUN9I_A80_PLL_N_SHIFT); 120662306a36Sopenharmony_ci val |= 17 << SUN9I_A80_PLL_N_SHIFT; 120762306a36Sopenharmony_ci 120862306a36Sopenharmony_ci /* And clear P */ 120962306a36Sopenharmony_ci val &= ~BIT(SUN9I_A80_PLL_P_SHIFT); 121062306a36Sopenharmony_ci 121162306a36Sopenharmony_ci writel(val, reg); 121262306a36Sopenharmony_ci} 121362306a36Sopenharmony_ci 121462306a36Sopenharmony_cistatic int sun9i_a80_ccu_probe(struct platform_device *pdev) 121562306a36Sopenharmony_ci{ 121662306a36Sopenharmony_ci void __iomem *reg; 121762306a36Sopenharmony_ci u32 val; 121862306a36Sopenharmony_ci 121962306a36Sopenharmony_ci reg = devm_platform_ioremap_resource(pdev, 0); 122062306a36Sopenharmony_ci if (IS_ERR(reg)) 122162306a36Sopenharmony_ci return PTR_ERR(reg); 122262306a36Sopenharmony_ci 122362306a36Sopenharmony_ci /* Enforce d1 = 0, d2 = 0 for Audio PLL */ 122462306a36Sopenharmony_ci val = readl(reg + SUN9I_A80_PLL_AUDIO_REG); 122562306a36Sopenharmony_ci val &= ~(BIT(16) | BIT(18)); 122662306a36Sopenharmony_ci writel(val, reg + SUN9I_A80_PLL_AUDIO_REG); 122762306a36Sopenharmony_ci 122862306a36Sopenharmony_ci /* Enforce P = 1 for both CPU cluster PLLs */ 122962306a36Sopenharmony_ci sun9i_a80_cpu_pll_fixup(reg + SUN9I_A80_PLL_C0CPUX_REG); 123062306a36Sopenharmony_ci sun9i_a80_cpu_pll_fixup(reg + SUN9I_A80_PLL_C1CPUX_REG); 123162306a36Sopenharmony_ci 123262306a36Sopenharmony_ci return devm_sunxi_ccu_probe(&pdev->dev, reg, &sun9i_a80_ccu_desc); 123362306a36Sopenharmony_ci} 123462306a36Sopenharmony_ci 123562306a36Sopenharmony_cistatic const struct of_device_id sun9i_a80_ccu_ids[] = { 123662306a36Sopenharmony_ci { .compatible = "allwinner,sun9i-a80-ccu" }, 123762306a36Sopenharmony_ci { } 123862306a36Sopenharmony_ci}; 123962306a36Sopenharmony_ci 124062306a36Sopenharmony_cistatic struct platform_driver sun9i_a80_ccu_driver = { 124162306a36Sopenharmony_ci .probe = sun9i_a80_ccu_probe, 124262306a36Sopenharmony_ci .driver = { 124362306a36Sopenharmony_ci .name = "sun9i-a80-ccu", 124462306a36Sopenharmony_ci .suppress_bind_attrs = true, 124562306a36Sopenharmony_ci .of_match_table = sun9i_a80_ccu_ids, 124662306a36Sopenharmony_ci }, 124762306a36Sopenharmony_ci}; 124862306a36Sopenharmony_cimodule_platform_driver(sun9i_a80_ccu_driver); 124962306a36Sopenharmony_ci 125062306a36Sopenharmony_ciMODULE_IMPORT_NS(SUNXI_CCU); 125162306a36Sopenharmony_ciMODULE_LICENSE("GPL"); 1252