18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2016 Icenowy Zheng <icenowy@aosc.xyz>
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Based on ccu-sun8i-h3.c, which is:
68c2ecf20Sopenharmony_ci * Copyright (c) 2016 Maxime Ripard. All rights reserved.
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/clk-provider.h>
108c2ecf20Sopenharmony_ci#include <linux/io.h>
118c2ecf20Sopenharmony_ci#include <linux/of_address.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include "ccu_common.h"
148c2ecf20Sopenharmony_ci#include "ccu_reset.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include "ccu_div.h"
178c2ecf20Sopenharmony_ci#include "ccu_gate.h"
188c2ecf20Sopenharmony_ci#include "ccu_mp.h"
198c2ecf20Sopenharmony_ci#include "ccu_mult.h"
208c2ecf20Sopenharmony_ci#include "ccu_nk.h"
218c2ecf20Sopenharmony_ci#include "ccu_nkm.h"
228c2ecf20Sopenharmony_ci#include "ccu_nkmp.h"
238c2ecf20Sopenharmony_ci#include "ccu_nm.h"
248c2ecf20Sopenharmony_ci#include "ccu_phase.h"
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#include "ccu-sun8i-v3s.h"
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistatic SUNXI_CCU_NKMP_WITH_GATE_LOCK(pll_cpu_clk, "pll-cpu",
298c2ecf20Sopenharmony_ci				     "osc24M", 0x000,
308c2ecf20Sopenharmony_ci				     8, 5,	/* N */
318c2ecf20Sopenharmony_ci				     4, 2,	/* K */
328c2ecf20Sopenharmony_ci				     0, 2,	/* M */
338c2ecf20Sopenharmony_ci				     16, 2,	/* P */
348c2ecf20Sopenharmony_ci				     BIT(31),	/* gate */
358c2ecf20Sopenharmony_ci				     BIT(28),	/* lock */
368c2ecf20Sopenharmony_ci				     0);
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/*
398c2ecf20Sopenharmony_ci * The Audio PLL is supposed to have 4 outputs: 3 fixed factors from
408c2ecf20Sopenharmony_ci * the base (2x, 4x and 8x), and one variable divider (the one true
418c2ecf20Sopenharmony_ci * pll audio).
428c2ecf20Sopenharmony_ci *
438c2ecf20Sopenharmony_ci * We don't have any need for the variable divider for now, so we just
448c2ecf20Sopenharmony_ci * hardcode it to match with the clock names
458c2ecf20Sopenharmony_ci */
468c2ecf20Sopenharmony_ci#define SUN8I_V3S_PLL_AUDIO_REG	0x008
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_GATE_LOCK(pll_audio_base_clk, "pll-audio-base",
498c2ecf20Sopenharmony_ci				   "osc24M", 0x008,
508c2ecf20Sopenharmony_ci				   8, 7,	/* N */
518c2ecf20Sopenharmony_ci				   0, 5,	/* M */
528c2ecf20Sopenharmony_ci				   BIT(31),	/* gate */
538c2ecf20Sopenharmony_ci				   BIT(28),	/* lock */
548c2ecf20Sopenharmony_ci				   0);
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video_clk, "pll-video",
578c2ecf20Sopenharmony_ci					"osc24M", 0x0010,
588c2ecf20Sopenharmony_ci					8, 7,		/* N */
598c2ecf20Sopenharmony_ci					0, 4,		/* M */
608c2ecf20Sopenharmony_ci					BIT(24),	/* frac enable */
618c2ecf20Sopenharmony_ci					BIT(25),	/* frac select */
628c2ecf20Sopenharmony_ci					270000000,	/* frac rate 0 */
638c2ecf20Sopenharmony_ci					297000000,	/* frac rate 1 */
648c2ecf20Sopenharmony_ci					BIT(31),	/* gate */
658c2ecf20Sopenharmony_ci					BIT(28),	/* lock */
668c2ecf20Sopenharmony_ci					0);
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve",
698c2ecf20Sopenharmony_ci					"osc24M", 0x0018,
708c2ecf20Sopenharmony_ci					8, 7,		/* N */
718c2ecf20Sopenharmony_ci					0, 4,		/* M */
728c2ecf20Sopenharmony_ci					BIT(24),	/* frac enable */
738c2ecf20Sopenharmony_ci					BIT(25),	/* frac select */
748c2ecf20Sopenharmony_ci					270000000,	/* frac rate 0 */
758c2ecf20Sopenharmony_ci					297000000,	/* frac rate 1 */
768c2ecf20Sopenharmony_ci					BIT(31),	/* gate */
778c2ecf20Sopenharmony_ci					BIT(28),	/* lock */
788c2ecf20Sopenharmony_ci					0);
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_cistatic SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr0_clk, "pll-ddr0",
818c2ecf20Sopenharmony_ci				    "osc24M", 0x020,
828c2ecf20Sopenharmony_ci				    8, 5,	/* N */
838c2ecf20Sopenharmony_ci				    4, 2,	/* K */
848c2ecf20Sopenharmony_ci				    0, 2,	/* M */
858c2ecf20Sopenharmony_ci				    BIT(31),	/* gate */
868c2ecf20Sopenharmony_ci				    BIT(28),	/* lock */
878c2ecf20Sopenharmony_ci				    0);
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_cistatic SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph0_clk, "pll-periph0",
908c2ecf20Sopenharmony_ci					   "osc24M", 0x028,
918c2ecf20Sopenharmony_ci					   8, 5,	/* N */
928c2ecf20Sopenharmony_ci					   4, 2,	/* K */
938c2ecf20Sopenharmony_ci					   BIT(31),	/* gate */
948c2ecf20Sopenharmony_ci					   BIT(28),	/* lock */
958c2ecf20Sopenharmony_ci					   2,		/* post-div */
968c2ecf20Sopenharmony_ci					   0);
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_isp_clk, "pll-isp",
998c2ecf20Sopenharmony_ci					"osc24M", 0x002c,
1008c2ecf20Sopenharmony_ci					8, 7,		/* N */
1018c2ecf20Sopenharmony_ci					0, 4,		/* M */
1028c2ecf20Sopenharmony_ci					BIT(24),	/* frac enable */
1038c2ecf20Sopenharmony_ci					BIT(25),	/* frac select */
1048c2ecf20Sopenharmony_ci					270000000,	/* frac rate 0 */
1058c2ecf20Sopenharmony_ci					297000000,	/* frac rate 1 */
1068c2ecf20Sopenharmony_ci					BIT(31),	/* gate */
1078c2ecf20Sopenharmony_ci					BIT(28),	/* lock */
1088c2ecf20Sopenharmony_ci					0);
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_cistatic SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph1_clk, "pll-periph1",
1118c2ecf20Sopenharmony_ci					   "osc24M", 0x044,
1128c2ecf20Sopenharmony_ci					   8, 5,	/* N */
1138c2ecf20Sopenharmony_ci					   4, 2,	/* K */
1148c2ecf20Sopenharmony_ci					   BIT(31),	/* gate */
1158c2ecf20Sopenharmony_ci					   BIT(28),	/* lock */
1168c2ecf20Sopenharmony_ci					   2,		/* post-div */
1178c2ecf20Sopenharmony_ci					   0);
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_GATE_LOCK(pll_ddr1_clk, "pll-ddr1",
1208c2ecf20Sopenharmony_ci				   "osc24M", 0x04c,
1218c2ecf20Sopenharmony_ci				   8, 7,	/* N */
1228c2ecf20Sopenharmony_ci				   0, 2,	/* M */
1238c2ecf20Sopenharmony_ci				   BIT(31),	/* gate */
1248c2ecf20Sopenharmony_ci				   BIT(28),	/* lock */
1258c2ecf20Sopenharmony_ci				   0);
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_cistatic const char * const cpu_parents[] = { "osc32k", "osc24M",
1288c2ecf20Sopenharmony_ci					     "pll-cpu", "pll-cpu" };
1298c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX(cpu_clk, "cpu", cpu_parents,
1308c2ecf20Sopenharmony_ci		     0x050, 16, 2, CLK_IS_CRITICAL);
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(axi_clk, "axi", "cpu", 0x050, 0, 2, 0);
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_cistatic const char * const ahb1_parents[] = { "osc32k", "osc24M",
1358c2ecf20Sopenharmony_ci					     "axi", "pll-periph0" };
1368c2ecf20Sopenharmony_cistatic const struct ccu_mux_var_prediv ahb1_predivs[] = {
1378c2ecf20Sopenharmony_ci	{ .index = 3, .shift = 6, .width = 2 },
1388c2ecf20Sopenharmony_ci};
1398c2ecf20Sopenharmony_cistatic struct ccu_div ahb1_clk = {
1408c2ecf20Sopenharmony_ci	.div		= _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO),
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci	.mux		= {
1438c2ecf20Sopenharmony_ci		.shift	= 12,
1448c2ecf20Sopenharmony_ci		.width	= 2,
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci		.var_predivs	= ahb1_predivs,
1478c2ecf20Sopenharmony_ci		.n_var_predivs	= ARRAY_SIZE(ahb1_predivs),
1488c2ecf20Sopenharmony_ci	},
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci	.common		= {
1518c2ecf20Sopenharmony_ci		.reg		= 0x054,
1528c2ecf20Sopenharmony_ci		.features	= CCU_FEATURE_VARIABLE_PREDIV,
1538c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT_PARENTS("ahb1",
1548c2ecf20Sopenharmony_ci						      ahb1_parents,
1558c2ecf20Sopenharmony_ci						      &ccu_div_ops,
1568c2ecf20Sopenharmony_ci						      0),
1578c2ecf20Sopenharmony_ci	},
1588c2ecf20Sopenharmony_ci};
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_cistatic struct clk_div_table apb1_div_table[] = {
1618c2ecf20Sopenharmony_ci	{ .val = 0, .div = 2 },
1628c2ecf20Sopenharmony_ci	{ .val = 1, .div = 2 },
1638c2ecf20Sopenharmony_ci	{ .val = 2, .div = 4 },
1648c2ecf20Sopenharmony_ci	{ .val = 3, .div = 8 },
1658c2ecf20Sopenharmony_ci	{ /* Sentinel */ },
1668c2ecf20Sopenharmony_ci};
1678c2ecf20Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(apb1_clk, "apb1", "ahb1",
1688c2ecf20Sopenharmony_ci			   0x054, 8, 2, apb1_div_table, 0);
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_cistatic const char * const apb2_parents[] = { "osc32k", "osc24M",
1718c2ecf20Sopenharmony_ci					     "pll-periph0", "pll-periph0" };
1728c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", apb2_parents, 0x058,
1738c2ecf20Sopenharmony_ci			     0, 5,	/* M */
1748c2ecf20Sopenharmony_ci			     16, 2,	/* P */
1758c2ecf20Sopenharmony_ci			     24, 2,	/* mux */
1768c2ecf20Sopenharmony_ci			     0);
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_cistatic const char * const ahb2_parents[] = { "ahb1", "pll-periph0" };
1798c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv ahb2_fixed_predivs[] = {
1808c2ecf20Sopenharmony_ci	{ .index = 1, .div = 2 },
1818c2ecf20Sopenharmony_ci};
1828c2ecf20Sopenharmony_cistatic struct ccu_mux ahb2_clk = {
1838c2ecf20Sopenharmony_ci	.mux		= {
1848c2ecf20Sopenharmony_ci		.shift	= 0,
1858c2ecf20Sopenharmony_ci		.width	= 1,
1868c2ecf20Sopenharmony_ci		.fixed_predivs	= ahb2_fixed_predivs,
1878c2ecf20Sopenharmony_ci		.n_predivs	= ARRAY_SIZE(ahb2_fixed_predivs),
1888c2ecf20Sopenharmony_ci	},
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci	.common		= {
1918c2ecf20Sopenharmony_ci		.reg		= 0x05c,
1928c2ecf20Sopenharmony_ci		.features	= CCU_FEATURE_FIXED_PREDIV,
1938c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT_PARENTS("ahb2",
1948c2ecf20Sopenharmony_ci						      ahb2_parents,
1958c2ecf20Sopenharmony_ci						      &ccu_mux_ops,
1968c2ecf20Sopenharmony_ci						      0),
1978c2ecf20Sopenharmony_ci	},
1988c2ecf20Sopenharmony_ci};
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ce_clk,	"bus-ce",	"ahb1",
2018c2ecf20Sopenharmony_ci		      0x060, BIT(5), 0);
2028c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dma_clk,	"bus-dma",	"ahb1",
2038c2ecf20Sopenharmony_ci		      0x060, BIT(6), 0);
2048c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc0_clk,	"bus-mmc0",	"ahb1",
2058c2ecf20Sopenharmony_ci		      0x060, BIT(8), 0);
2068c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc1_clk,	"bus-mmc1",	"ahb1",
2078c2ecf20Sopenharmony_ci		      0x060, BIT(9), 0);
2088c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc2_clk,	"bus-mmc2",	"ahb1",
2098c2ecf20Sopenharmony_ci		      0x060, BIT(10), 0);
2108c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dram_clk,	"bus-dram",	"ahb1",
2118c2ecf20Sopenharmony_ci		      0x060, BIT(14), 0);
2128c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_emac_clk,	"bus-emac",	"ahb2",
2138c2ecf20Sopenharmony_ci		      0x060, BIT(17), 0);
2148c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hstimer_clk,	"bus-hstimer",	"ahb1",
2158c2ecf20Sopenharmony_ci		      0x060, BIT(19), 0);
2168c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi0_clk,	"bus-spi0",	"ahb1",
2178c2ecf20Sopenharmony_ci		      0x060, BIT(20), 0);
2188c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_otg_clk,	"bus-otg",	"ahb1",
2198c2ecf20Sopenharmony_ci		      0x060, BIT(24), 0);
2208c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci0_clk,	"bus-ehci0",	"ahb1",
2218c2ecf20Sopenharmony_ci		      0x060, BIT(26), 0);
2228c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci0_clk,	"bus-ohci0",	"ahb1",
2238c2ecf20Sopenharmony_ci		      0x060, BIT(29), 0);
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ve_clk,	"bus-ve",	"ahb1",
2268c2ecf20Sopenharmony_ci		      0x064, BIT(0), 0);
2278c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tcon0_clk,	"bus-tcon0",	"ahb1",
2288c2ecf20Sopenharmony_ci		      0x064, BIT(4), 0);
2298c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_csi_clk,	"bus-csi",	"ahb1",
2308c2ecf20Sopenharmony_ci		      0x064, BIT(8), 0);
2318c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_de_clk,	"bus-de",	"ahb1",
2328c2ecf20Sopenharmony_ci		      0x064, BIT(12), 0);
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_codec_clk,	"bus-codec",	"apb1",
2358c2ecf20Sopenharmony_ci		      0x068, BIT(0), 0);
2368c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_pio_clk,	"bus-pio",	"apb1",
2378c2ecf20Sopenharmony_ci		      0x068, BIT(5), 0);
2388c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s0_clk,	"bus-i2s0",	"apb1",
2398c2ecf20Sopenharmony_ci		      0x068, BIT(12), 0);
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c0_clk,	"bus-i2c0",	"apb2",
2428c2ecf20Sopenharmony_ci		      0x06c, BIT(0), 0);
2438c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c1_clk,	"bus-i2c1",	"apb2",
2448c2ecf20Sopenharmony_ci		      0x06c, BIT(1), 0);
2458c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart0_clk,	"bus-uart0",	"apb2",
2468c2ecf20Sopenharmony_ci		      0x06c, BIT(16), 0);
2478c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart1_clk,	"bus-uart1",	"apb2",
2488c2ecf20Sopenharmony_ci		      0x06c, BIT(17), 0);
2498c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart2_clk,	"bus-uart2",	"apb2",
2508c2ecf20Sopenharmony_ci		      0x06c, BIT(18), 0);
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ephy_clk,	"bus-ephy",	"ahb1",
2538c2ecf20Sopenharmony_ci		      0x070, BIT(0), 0);
2548c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dbg_clk,	"bus-dbg",	"ahb1",
2558c2ecf20Sopenharmony_ci		      0x070, BIT(7), 0);
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_cistatic const char * const mod0_default_parents[] = { "osc24M", "pll-periph0",
2588c2ecf20Sopenharmony_ci						     "pll-periph1" };
2598c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 0x088,
2608c2ecf20Sopenharmony_ci				  0, 4,		/* M */
2618c2ecf20Sopenharmony_ci				  16, 2,	/* P */
2628c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
2638c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
2648c2ecf20Sopenharmony_ci				  0);
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_sample_clk, "mmc0_sample", "mmc0",
2678c2ecf20Sopenharmony_ci		       0x088, 20, 3, 0);
2688c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_output_clk, "mmc0_output", "mmc0",
2698c2ecf20Sopenharmony_ci		       0x088, 8, 3, 0);
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 0x08c,
2728c2ecf20Sopenharmony_ci				  0, 4,		/* M */
2738c2ecf20Sopenharmony_ci				  16, 2,	/* P */
2748c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
2758c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
2768c2ecf20Sopenharmony_ci				  0);
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1_sample", "mmc1",
2798c2ecf20Sopenharmony_ci		       0x08c, 20, 3, 0);
2808c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1_output", "mmc1",
2818c2ecf20Sopenharmony_ci		       0x08c, 8, 3, 0);
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 0x090,
2848c2ecf20Sopenharmony_ci				  0, 4,		/* M */
2858c2ecf20Sopenharmony_ci				  16, 2,	/* P */
2868c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
2878c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
2888c2ecf20Sopenharmony_ci				  0);
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2_sample", "mmc2",
2918c2ecf20Sopenharmony_ci		       0x090, 20, 3, 0);
2928c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_output_clk, "mmc2_output", "mmc2",
2938c2ecf20Sopenharmony_ci		       0x090, 8, 3, 0);
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_cistatic const char * const ce_parents[] = { "osc24M", "pll-periph0", };
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ce_clk, "ce", ce_parents, 0x09c,
2988c2ecf20Sopenharmony_ci				  0, 4,		/* M */
2998c2ecf20Sopenharmony_ci				  16, 2,	/* P */
3008c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
3018c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
3028c2ecf20Sopenharmony_ci				  0);
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 0x0a0,
3058c2ecf20Sopenharmony_ci				  0, 4,		/* M */
3068c2ecf20Sopenharmony_ci				  16, 2,	/* P */
3078c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
3088c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
3098c2ecf20Sopenharmony_ci				  0);
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_cistatic const char * const i2s_parents[] = { "pll-audio-8x", "pll-audio-4x",
3128c2ecf20Sopenharmony_ci					    "pll-audio-2x", "pll-audio" };
3138c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s0_clk, "i2s0", i2s_parents,
3148c2ecf20Sopenharmony_ci			       0x0b0, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy0_clk,	"usb-phy0",	"osc24M",
3178c2ecf20Sopenharmony_ci		      0x0cc, BIT(8), 0);
3188c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci0_clk,	"usb-ohci0",	"osc24M",
3198c2ecf20Sopenharmony_ci		      0x0cc, BIT(16), 0);
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_cistatic const char * const dram_parents[] = { "pll-ddr0", "pll-ddr1",
3228c2ecf20Sopenharmony_ci					     "pll-periph0-2x" };
3238c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX(dram_clk, "dram", dram_parents,
3248c2ecf20Sopenharmony_ci			    0x0f4, 0, 4, 20, 2, CLK_IS_CRITICAL);
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ve_clk,	"dram-ve",	"dram",
3278c2ecf20Sopenharmony_ci		      0x100, BIT(0), 0);
3288c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_csi_clk,	"dram-csi",	"dram",
3298c2ecf20Sopenharmony_ci		      0x100, BIT(1), 0);
3308c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ehci_clk,	"dram-ehci",	"dram",
3318c2ecf20Sopenharmony_ci		      0x100, BIT(17), 0);
3328c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ohci_clk,	"dram-ohci",	"dram",
3338c2ecf20Sopenharmony_ci		      0x100, BIT(18), 0);
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_cistatic const char * const de_parents[] = { "pll-video", "pll-periph0" };
3368c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents,
3378c2ecf20Sopenharmony_ci				 0x104, 0, 4, 24, 2, BIT(31),
3388c2ecf20Sopenharmony_ci				 CLK_SET_RATE_PARENT);
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_cistatic const char * const tcon_parents[] = { "pll-video" };
3418c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(tcon_clk, "tcon", tcon_parents,
3428c2ecf20Sopenharmony_ci				 0x118, 0, 4, 24, 3, BIT(31), 0);
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(csi_misc_clk,	"csi-misc",	"osc24M",
3458c2ecf20Sopenharmony_ci		      0x130, BIT(31), 0);
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_cistatic const char * const csi_mclk_parents[] = { "osc24M", "pll-video",
3488c2ecf20Sopenharmony_ci						 "pll-periph0", "pll-periph1" };
3498c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi0_mclk_clk, "csi0-mclk", csi_mclk_parents,
3508c2ecf20Sopenharmony_ci				 0x130, 0, 5, 8, 3, BIT(15), 0);
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_cistatic const char * const csi1_sclk_parents[] = { "pll-video", "pll-isp" };
3538c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi1_sclk_clk, "csi-sclk", csi1_sclk_parents,
3548c2ecf20Sopenharmony_ci				 0x134, 16, 4, 24, 3, BIT(31), 0);
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi1_mclk_clk, "csi-mclk", csi_mclk_parents,
3578c2ecf20Sopenharmony_ci				 0x134, 0, 5, 8, 3, BIT(15), 0);
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve",
3608c2ecf20Sopenharmony_ci			     0x13c, 16, 3, BIT(31), 0);
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ac_dig_clk,	"ac-dig",	"pll-audio",
3638c2ecf20Sopenharmony_ci		      0x140, BIT(31), CLK_SET_RATE_PARENT);
3648c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk,		"avs",		"osc24M",
3658c2ecf20Sopenharmony_ci		      0x144, BIT(31), 0);
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_cistatic const char * const mbus_parents[] = { "osc24M", "pll-periph0-2x",
3688c2ecf20Sopenharmony_ci					     "pll-ddr" };
3698c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents,
3708c2ecf20Sopenharmony_ci				 0x15c, 0, 3, 24, 2, BIT(31), CLK_IS_CRITICAL);
3718c2ecf20Sopenharmony_ci
3728c2ecf20Sopenharmony_cistatic const char * const mipi_csi_parents[] = { "pll-video", "pll-periph0",
3738c2ecf20Sopenharmony_ci						 "pll-isp" };
3748c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mipi_csi_clk, "mipi-csi", mipi_csi_parents,
3758c2ecf20Sopenharmony_ci			     0x16c, 0, 3, 24, 2, BIT(31), 0);
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_cistatic struct ccu_common *sun8i_v3s_ccu_clks[] = {
3788c2ecf20Sopenharmony_ci	&pll_cpu_clk.common,
3798c2ecf20Sopenharmony_ci	&pll_audio_base_clk.common,
3808c2ecf20Sopenharmony_ci	&pll_video_clk.common,
3818c2ecf20Sopenharmony_ci	&pll_ve_clk.common,
3828c2ecf20Sopenharmony_ci	&pll_ddr0_clk.common,
3838c2ecf20Sopenharmony_ci	&pll_periph0_clk.common,
3848c2ecf20Sopenharmony_ci	&pll_isp_clk.common,
3858c2ecf20Sopenharmony_ci	&pll_periph1_clk.common,
3868c2ecf20Sopenharmony_ci	&pll_ddr1_clk.common,
3878c2ecf20Sopenharmony_ci	&cpu_clk.common,
3888c2ecf20Sopenharmony_ci	&axi_clk.common,
3898c2ecf20Sopenharmony_ci	&ahb1_clk.common,
3908c2ecf20Sopenharmony_ci	&apb1_clk.common,
3918c2ecf20Sopenharmony_ci	&apb2_clk.common,
3928c2ecf20Sopenharmony_ci	&ahb2_clk.common,
3938c2ecf20Sopenharmony_ci	&bus_ce_clk.common,
3948c2ecf20Sopenharmony_ci	&bus_dma_clk.common,
3958c2ecf20Sopenharmony_ci	&bus_mmc0_clk.common,
3968c2ecf20Sopenharmony_ci	&bus_mmc1_clk.common,
3978c2ecf20Sopenharmony_ci	&bus_mmc2_clk.common,
3988c2ecf20Sopenharmony_ci	&bus_dram_clk.common,
3998c2ecf20Sopenharmony_ci	&bus_emac_clk.common,
4008c2ecf20Sopenharmony_ci	&bus_hstimer_clk.common,
4018c2ecf20Sopenharmony_ci	&bus_spi0_clk.common,
4028c2ecf20Sopenharmony_ci	&bus_otg_clk.common,
4038c2ecf20Sopenharmony_ci	&bus_ehci0_clk.common,
4048c2ecf20Sopenharmony_ci	&bus_ohci0_clk.common,
4058c2ecf20Sopenharmony_ci	&bus_ve_clk.common,
4068c2ecf20Sopenharmony_ci	&bus_tcon0_clk.common,
4078c2ecf20Sopenharmony_ci	&bus_csi_clk.common,
4088c2ecf20Sopenharmony_ci	&bus_de_clk.common,
4098c2ecf20Sopenharmony_ci	&bus_codec_clk.common,
4108c2ecf20Sopenharmony_ci	&bus_pio_clk.common,
4118c2ecf20Sopenharmony_ci	&bus_i2c0_clk.common,
4128c2ecf20Sopenharmony_ci	&bus_i2c1_clk.common,
4138c2ecf20Sopenharmony_ci	&bus_uart0_clk.common,
4148c2ecf20Sopenharmony_ci	&bus_uart1_clk.common,
4158c2ecf20Sopenharmony_ci	&bus_uart2_clk.common,
4168c2ecf20Sopenharmony_ci	&bus_ephy_clk.common,
4178c2ecf20Sopenharmony_ci	&bus_dbg_clk.common,
4188c2ecf20Sopenharmony_ci	&mmc0_clk.common,
4198c2ecf20Sopenharmony_ci	&mmc0_sample_clk.common,
4208c2ecf20Sopenharmony_ci	&mmc0_output_clk.common,
4218c2ecf20Sopenharmony_ci	&mmc1_clk.common,
4228c2ecf20Sopenharmony_ci	&mmc1_sample_clk.common,
4238c2ecf20Sopenharmony_ci	&mmc1_output_clk.common,
4248c2ecf20Sopenharmony_ci	&mmc2_clk.common,
4258c2ecf20Sopenharmony_ci	&mmc2_sample_clk.common,
4268c2ecf20Sopenharmony_ci	&mmc2_output_clk.common,
4278c2ecf20Sopenharmony_ci	&ce_clk.common,
4288c2ecf20Sopenharmony_ci	&spi0_clk.common,
4298c2ecf20Sopenharmony_ci	&usb_phy0_clk.common,
4308c2ecf20Sopenharmony_ci	&usb_ohci0_clk.common,
4318c2ecf20Sopenharmony_ci	&dram_clk.common,
4328c2ecf20Sopenharmony_ci	&dram_ve_clk.common,
4338c2ecf20Sopenharmony_ci	&dram_csi_clk.common,
4348c2ecf20Sopenharmony_ci	&dram_ohci_clk.common,
4358c2ecf20Sopenharmony_ci	&dram_ehci_clk.common,
4368c2ecf20Sopenharmony_ci	&de_clk.common,
4378c2ecf20Sopenharmony_ci	&tcon_clk.common,
4388c2ecf20Sopenharmony_ci	&csi_misc_clk.common,
4398c2ecf20Sopenharmony_ci	&csi0_mclk_clk.common,
4408c2ecf20Sopenharmony_ci	&csi1_sclk_clk.common,
4418c2ecf20Sopenharmony_ci	&csi1_mclk_clk.common,
4428c2ecf20Sopenharmony_ci	&ve_clk.common,
4438c2ecf20Sopenharmony_ci	&ac_dig_clk.common,
4448c2ecf20Sopenharmony_ci	&avs_clk.common,
4458c2ecf20Sopenharmony_ci	&mbus_clk.common,
4468c2ecf20Sopenharmony_ci	&mipi_csi_clk.common,
4478c2ecf20Sopenharmony_ci};
4488c2ecf20Sopenharmony_ci
4498c2ecf20Sopenharmony_cistatic const struct clk_hw *clk_parent_pll_audio[] = {
4508c2ecf20Sopenharmony_ci	&pll_audio_base_clk.common.hw
4518c2ecf20Sopenharmony_ci};
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_cistatic struct ccu_common *sun8i_v3_ccu_clks[] = {
4548c2ecf20Sopenharmony_ci	&pll_cpu_clk.common,
4558c2ecf20Sopenharmony_ci	&pll_audio_base_clk.common,
4568c2ecf20Sopenharmony_ci	&pll_video_clk.common,
4578c2ecf20Sopenharmony_ci	&pll_ve_clk.common,
4588c2ecf20Sopenharmony_ci	&pll_ddr0_clk.common,
4598c2ecf20Sopenharmony_ci	&pll_periph0_clk.common,
4608c2ecf20Sopenharmony_ci	&pll_isp_clk.common,
4618c2ecf20Sopenharmony_ci	&pll_periph1_clk.common,
4628c2ecf20Sopenharmony_ci	&pll_ddr1_clk.common,
4638c2ecf20Sopenharmony_ci	&cpu_clk.common,
4648c2ecf20Sopenharmony_ci	&axi_clk.common,
4658c2ecf20Sopenharmony_ci	&ahb1_clk.common,
4668c2ecf20Sopenharmony_ci	&apb1_clk.common,
4678c2ecf20Sopenharmony_ci	&apb2_clk.common,
4688c2ecf20Sopenharmony_ci	&ahb2_clk.common,
4698c2ecf20Sopenharmony_ci	&bus_ce_clk.common,
4708c2ecf20Sopenharmony_ci	&bus_dma_clk.common,
4718c2ecf20Sopenharmony_ci	&bus_mmc0_clk.common,
4728c2ecf20Sopenharmony_ci	&bus_mmc1_clk.common,
4738c2ecf20Sopenharmony_ci	&bus_mmc2_clk.common,
4748c2ecf20Sopenharmony_ci	&bus_dram_clk.common,
4758c2ecf20Sopenharmony_ci	&bus_emac_clk.common,
4768c2ecf20Sopenharmony_ci	&bus_hstimer_clk.common,
4778c2ecf20Sopenharmony_ci	&bus_spi0_clk.common,
4788c2ecf20Sopenharmony_ci	&bus_otg_clk.common,
4798c2ecf20Sopenharmony_ci	&bus_ehci0_clk.common,
4808c2ecf20Sopenharmony_ci	&bus_ohci0_clk.common,
4818c2ecf20Sopenharmony_ci	&bus_ve_clk.common,
4828c2ecf20Sopenharmony_ci	&bus_tcon0_clk.common,
4838c2ecf20Sopenharmony_ci	&bus_csi_clk.common,
4848c2ecf20Sopenharmony_ci	&bus_de_clk.common,
4858c2ecf20Sopenharmony_ci	&bus_codec_clk.common,
4868c2ecf20Sopenharmony_ci	&bus_pio_clk.common,
4878c2ecf20Sopenharmony_ci	&bus_i2s0_clk.common,
4888c2ecf20Sopenharmony_ci	&bus_i2c0_clk.common,
4898c2ecf20Sopenharmony_ci	&bus_i2c1_clk.common,
4908c2ecf20Sopenharmony_ci	&bus_uart0_clk.common,
4918c2ecf20Sopenharmony_ci	&bus_uart1_clk.common,
4928c2ecf20Sopenharmony_ci	&bus_uart2_clk.common,
4938c2ecf20Sopenharmony_ci	&bus_ephy_clk.common,
4948c2ecf20Sopenharmony_ci	&bus_dbg_clk.common,
4958c2ecf20Sopenharmony_ci	&mmc0_clk.common,
4968c2ecf20Sopenharmony_ci	&mmc0_sample_clk.common,
4978c2ecf20Sopenharmony_ci	&mmc0_output_clk.common,
4988c2ecf20Sopenharmony_ci	&mmc1_clk.common,
4998c2ecf20Sopenharmony_ci	&mmc1_sample_clk.common,
5008c2ecf20Sopenharmony_ci	&mmc1_output_clk.common,
5018c2ecf20Sopenharmony_ci	&mmc2_clk.common,
5028c2ecf20Sopenharmony_ci	&mmc2_sample_clk.common,
5038c2ecf20Sopenharmony_ci	&mmc2_output_clk.common,
5048c2ecf20Sopenharmony_ci	&ce_clk.common,
5058c2ecf20Sopenharmony_ci	&spi0_clk.common,
5068c2ecf20Sopenharmony_ci	&i2s0_clk.common,
5078c2ecf20Sopenharmony_ci	&usb_phy0_clk.common,
5088c2ecf20Sopenharmony_ci	&usb_ohci0_clk.common,
5098c2ecf20Sopenharmony_ci	&dram_clk.common,
5108c2ecf20Sopenharmony_ci	&dram_ve_clk.common,
5118c2ecf20Sopenharmony_ci	&dram_csi_clk.common,
5128c2ecf20Sopenharmony_ci	&dram_ohci_clk.common,
5138c2ecf20Sopenharmony_ci	&dram_ehci_clk.common,
5148c2ecf20Sopenharmony_ci	&de_clk.common,
5158c2ecf20Sopenharmony_ci	&tcon_clk.common,
5168c2ecf20Sopenharmony_ci	&csi_misc_clk.common,
5178c2ecf20Sopenharmony_ci	&csi0_mclk_clk.common,
5188c2ecf20Sopenharmony_ci	&csi1_sclk_clk.common,
5198c2ecf20Sopenharmony_ci	&csi1_mclk_clk.common,
5208c2ecf20Sopenharmony_ci	&ve_clk.common,
5218c2ecf20Sopenharmony_ci	&ac_dig_clk.common,
5228c2ecf20Sopenharmony_ci	&avs_clk.common,
5238c2ecf20Sopenharmony_ci	&mbus_clk.common,
5248c2ecf20Sopenharmony_ci	&mipi_csi_clk.common,
5258c2ecf20Sopenharmony_ci};
5268c2ecf20Sopenharmony_ci
5278c2ecf20Sopenharmony_ci/* We hardcode the divider to 4 for now */
5288c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio",
5298c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
5308c2ecf20Sopenharmony_ci			    4, 1, CLK_SET_RATE_PARENT);
5318c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x",
5328c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
5338c2ecf20Sopenharmony_ci			    2, 1, CLK_SET_RATE_PARENT);
5348c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x",
5358c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
5368c2ecf20Sopenharmony_ci			    1, 1, CLK_SET_RATE_PARENT);
5378c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x",
5388c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
5398c2ecf20Sopenharmony_ci			    1, 2, CLK_SET_RATE_PARENT);
5408c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_periph0_2x_clk, "pll-periph0-2x",
5418c2ecf20Sopenharmony_ci			   &pll_periph0_clk.common.hw,
5428c2ecf20Sopenharmony_ci			   1, 2, 0);
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun8i_v3s_hw_clks = {
5458c2ecf20Sopenharmony_ci	.hws	= {
5468c2ecf20Sopenharmony_ci		[CLK_PLL_CPU]		= &pll_cpu_clk.common.hw,
5478c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_BASE]	= &pll_audio_base_clk.common.hw,
5488c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO]		= &pll_audio_clk.hw,
5498c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_2X]	= &pll_audio_2x_clk.hw,
5508c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_4X]	= &pll_audio_4x_clk.hw,
5518c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_8X]	= &pll_audio_8x_clk.hw,
5528c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO]		= &pll_video_clk.common.hw,
5538c2ecf20Sopenharmony_ci		[CLK_PLL_VE]		= &pll_ve_clk.common.hw,
5548c2ecf20Sopenharmony_ci		[CLK_PLL_DDR0]		= &pll_ddr0_clk.common.hw,
5558c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH0]	= &pll_periph0_clk.common.hw,
5568c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH0_2X]	= &pll_periph0_2x_clk.hw,
5578c2ecf20Sopenharmony_ci		[CLK_PLL_ISP]		= &pll_isp_clk.common.hw,
5588c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH1]	= &pll_periph1_clk.common.hw,
5598c2ecf20Sopenharmony_ci		[CLK_PLL_DDR1]		= &pll_ddr1_clk.common.hw,
5608c2ecf20Sopenharmony_ci		[CLK_CPU]		= &cpu_clk.common.hw,
5618c2ecf20Sopenharmony_ci		[CLK_AXI]		= &axi_clk.common.hw,
5628c2ecf20Sopenharmony_ci		[CLK_AHB1]		= &ahb1_clk.common.hw,
5638c2ecf20Sopenharmony_ci		[CLK_APB1]		= &apb1_clk.common.hw,
5648c2ecf20Sopenharmony_ci		[CLK_APB2]		= &apb2_clk.common.hw,
5658c2ecf20Sopenharmony_ci		[CLK_AHB2]		= &ahb2_clk.common.hw,
5668c2ecf20Sopenharmony_ci		[CLK_BUS_CE]		= &bus_ce_clk.common.hw,
5678c2ecf20Sopenharmony_ci		[CLK_BUS_DMA]		= &bus_dma_clk.common.hw,
5688c2ecf20Sopenharmony_ci		[CLK_BUS_MMC0]		= &bus_mmc0_clk.common.hw,
5698c2ecf20Sopenharmony_ci		[CLK_BUS_MMC1]		= &bus_mmc1_clk.common.hw,
5708c2ecf20Sopenharmony_ci		[CLK_BUS_MMC2]		= &bus_mmc2_clk.common.hw,
5718c2ecf20Sopenharmony_ci		[CLK_BUS_DRAM]		= &bus_dram_clk.common.hw,
5728c2ecf20Sopenharmony_ci		[CLK_BUS_EMAC]		= &bus_emac_clk.common.hw,
5738c2ecf20Sopenharmony_ci		[CLK_BUS_HSTIMER]	= &bus_hstimer_clk.common.hw,
5748c2ecf20Sopenharmony_ci		[CLK_BUS_SPI0]		= &bus_spi0_clk.common.hw,
5758c2ecf20Sopenharmony_ci		[CLK_BUS_OTG]		= &bus_otg_clk.common.hw,
5768c2ecf20Sopenharmony_ci		[CLK_BUS_EHCI0]		= &bus_ehci0_clk.common.hw,
5778c2ecf20Sopenharmony_ci		[CLK_BUS_OHCI0]		= &bus_ohci0_clk.common.hw,
5788c2ecf20Sopenharmony_ci		[CLK_BUS_VE]		= &bus_ve_clk.common.hw,
5798c2ecf20Sopenharmony_ci		[CLK_BUS_TCON0]		= &bus_tcon0_clk.common.hw,
5808c2ecf20Sopenharmony_ci		[CLK_BUS_CSI]		= &bus_csi_clk.common.hw,
5818c2ecf20Sopenharmony_ci		[CLK_BUS_DE]		= &bus_de_clk.common.hw,
5828c2ecf20Sopenharmony_ci		[CLK_BUS_CODEC]		= &bus_codec_clk.common.hw,
5838c2ecf20Sopenharmony_ci		[CLK_BUS_PIO]		= &bus_pio_clk.common.hw,
5848c2ecf20Sopenharmony_ci		[CLK_BUS_I2C0]		= &bus_i2c0_clk.common.hw,
5858c2ecf20Sopenharmony_ci		[CLK_BUS_I2C1]		= &bus_i2c1_clk.common.hw,
5868c2ecf20Sopenharmony_ci		[CLK_BUS_UART0]		= &bus_uart0_clk.common.hw,
5878c2ecf20Sopenharmony_ci		[CLK_BUS_UART1]		= &bus_uart1_clk.common.hw,
5888c2ecf20Sopenharmony_ci		[CLK_BUS_UART2]		= &bus_uart2_clk.common.hw,
5898c2ecf20Sopenharmony_ci		[CLK_BUS_EPHY]		= &bus_ephy_clk.common.hw,
5908c2ecf20Sopenharmony_ci		[CLK_BUS_DBG]		= &bus_dbg_clk.common.hw,
5918c2ecf20Sopenharmony_ci		[CLK_MMC0]		= &mmc0_clk.common.hw,
5928c2ecf20Sopenharmony_ci		[CLK_MMC0_SAMPLE]	= &mmc0_sample_clk.common.hw,
5938c2ecf20Sopenharmony_ci		[CLK_MMC0_OUTPUT]	= &mmc0_output_clk.common.hw,
5948c2ecf20Sopenharmony_ci		[CLK_MMC1]		= &mmc1_clk.common.hw,
5958c2ecf20Sopenharmony_ci		[CLK_MMC1_SAMPLE]	= &mmc1_sample_clk.common.hw,
5968c2ecf20Sopenharmony_ci		[CLK_MMC1_OUTPUT]	= &mmc1_output_clk.common.hw,
5978c2ecf20Sopenharmony_ci		[CLK_MMC2]		= &mmc2_clk.common.hw,
5988c2ecf20Sopenharmony_ci		[CLK_MMC2_SAMPLE]	= &mmc2_sample_clk.common.hw,
5998c2ecf20Sopenharmony_ci		[CLK_MMC2_OUTPUT]	= &mmc2_output_clk.common.hw,
6008c2ecf20Sopenharmony_ci		[CLK_CE]		= &ce_clk.common.hw,
6018c2ecf20Sopenharmony_ci		[CLK_SPI0]		= &spi0_clk.common.hw,
6028c2ecf20Sopenharmony_ci		[CLK_USB_PHY0]		= &usb_phy0_clk.common.hw,
6038c2ecf20Sopenharmony_ci		[CLK_USB_OHCI0]		= &usb_ohci0_clk.common.hw,
6048c2ecf20Sopenharmony_ci		[CLK_DRAM]		= &dram_clk.common.hw,
6058c2ecf20Sopenharmony_ci		[CLK_DRAM_VE]		= &dram_ve_clk.common.hw,
6068c2ecf20Sopenharmony_ci		[CLK_DRAM_CSI]		= &dram_csi_clk.common.hw,
6078c2ecf20Sopenharmony_ci		[CLK_DRAM_EHCI]		= &dram_ehci_clk.common.hw,
6088c2ecf20Sopenharmony_ci		[CLK_DRAM_OHCI]		= &dram_ohci_clk.common.hw,
6098c2ecf20Sopenharmony_ci		[CLK_DE]		= &de_clk.common.hw,
6108c2ecf20Sopenharmony_ci		[CLK_TCON0]		= &tcon_clk.common.hw,
6118c2ecf20Sopenharmony_ci		[CLK_CSI_MISC]		= &csi_misc_clk.common.hw,
6128c2ecf20Sopenharmony_ci		[CLK_CSI0_MCLK]		= &csi0_mclk_clk.common.hw,
6138c2ecf20Sopenharmony_ci		[CLK_CSI1_SCLK]		= &csi1_sclk_clk.common.hw,
6148c2ecf20Sopenharmony_ci		[CLK_CSI1_MCLK]		= &csi1_mclk_clk.common.hw,
6158c2ecf20Sopenharmony_ci		[CLK_VE]		= &ve_clk.common.hw,
6168c2ecf20Sopenharmony_ci		[CLK_AC_DIG]		= &ac_dig_clk.common.hw,
6178c2ecf20Sopenharmony_ci		[CLK_AVS]		= &avs_clk.common.hw,
6188c2ecf20Sopenharmony_ci		[CLK_MBUS]		= &mbus_clk.common.hw,
6198c2ecf20Sopenharmony_ci		[CLK_MIPI_CSI]		= &mipi_csi_clk.common.hw,
6208c2ecf20Sopenharmony_ci	},
6218c2ecf20Sopenharmony_ci	.num	= CLK_PLL_DDR1 + 1,
6228c2ecf20Sopenharmony_ci};
6238c2ecf20Sopenharmony_ci
6248c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun8i_v3_hw_clks = {
6258c2ecf20Sopenharmony_ci	.hws	= {
6268c2ecf20Sopenharmony_ci		[CLK_PLL_CPU]		= &pll_cpu_clk.common.hw,
6278c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_BASE]	= &pll_audio_base_clk.common.hw,
6288c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO]		= &pll_audio_clk.hw,
6298c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_2X]	= &pll_audio_2x_clk.hw,
6308c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_4X]	= &pll_audio_4x_clk.hw,
6318c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_8X]	= &pll_audio_8x_clk.hw,
6328c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO]		= &pll_video_clk.common.hw,
6338c2ecf20Sopenharmony_ci		[CLK_PLL_VE]		= &pll_ve_clk.common.hw,
6348c2ecf20Sopenharmony_ci		[CLK_PLL_DDR0]		= &pll_ddr0_clk.common.hw,
6358c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH0]	= &pll_periph0_clk.common.hw,
6368c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH0_2X]	= &pll_periph0_2x_clk.hw,
6378c2ecf20Sopenharmony_ci		[CLK_PLL_ISP]		= &pll_isp_clk.common.hw,
6388c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH1]	= &pll_periph1_clk.common.hw,
6398c2ecf20Sopenharmony_ci		[CLK_PLL_DDR1]		= &pll_ddr1_clk.common.hw,
6408c2ecf20Sopenharmony_ci		[CLK_CPU]		= &cpu_clk.common.hw,
6418c2ecf20Sopenharmony_ci		[CLK_AXI]		= &axi_clk.common.hw,
6428c2ecf20Sopenharmony_ci		[CLK_AHB1]		= &ahb1_clk.common.hw,
6438c2ecf20Sopenharmony_ci		[CLK_APB1]		= &apb1_clk.common.hw,
6448c2ecf20Sopenharmony_ci		[CLK_APB2]		= &apb2_clk.common.hw,
6458c2ecf20Sopenharmony_ci		[CLK_AHB2]		= &ahb2_clk.common.hw,
6468c2ecf20Sopenharmony_ci		[CLK_BUS_CE]		= &bus_ce_clk.common.hw,
6478c2ecf20Sopenharmony_ci		[CLK_BUS_DMA]		= &bus_dma_clk.common.hw,
6488c2ecf20Sopenharmony_ci		[CLK_BUS_MMC0]		= &bus_mmc0_clk.common.hw,
6498c2ecf20Sopenharmony_ci		[CLK_BUS_MMC1]		= &bus_mmc1_clk.common.hw,
6508c2ecf20Sopenharmony_ci		[CLK_BUS_MMC2]		= &bus_mmc2_clk.common.hw,
6518c2ecf20Sopenharmony_ci		[CLK_BUS_DRAM]		= &bus_dram_clk.common.hw,
6528c2ecf20Sopenharmony_ci		[CLK_BUS_EMAC]		= &bus_emac_clk.common.hw,
6538c2ecf20Sopenharmony_ci		[CLK_BUS_HSTIMER]	= &bus_hstimer_clk.common.hw,
6548c2ecf20Sopenharmony_ci		[CLK_BUS_SPI0]		= &bus_spi0_clk.common.hw,
6558c2ecf20Sopenharmony_ci		[CLK_BUS_OTG]		= &bus_otg_clk.common.hw,
6568c2ecf20Sopenharmony_ci		[CLK_BUS_EHCI0]		= &bus_ehci0_clk.common.hw,
6578c2ecf20Sopenharmony_ci		[CLK_BUS_OHCI0]		= &bus_ohci0_clk.common.hw,
6588c2ecf20Sopenharmony_ci		[CLK_BUS_VE]		= &bus_ve_clk.common.hw,
6598c2ecf20Sopenharmony_ci		[CLK_BUS_TCON0]		= &bus_tcon0_clk.common.hw,
6608c2ecf20Sopenharmony_ci		[CLK_BUS_CSI]		= &bus_csi_clk.common.hw,
6618c2ecf20Sopenharmony_ci		[CLK_BUS_DE]		= &bus_de_clk.common.hw,
6628c2ecf20Sopenharmony_ci		[CLK_BUS_CODEC]		= &bus_codec_clk.common.hw,
6638c2ecf20Sopenharmony_ci		[CLK_BUS_PIO]		= &bus_pio_clk.common.hw,
6648c2ecf20Sopenharmony_ci		[CLK_BUS_I2S0]		= &bus_i2s0_clk.common.hw,
6658c2ecf20Sopenharmony_ci		[CLK_BUS_I2C0]		= &bus_i2c0_clk.common.hw,
6668c2ecf20Sopenharmony_ci		[CLK_BUS_I2C1]		= &bus_i2c1_clk.common.hw,
6678c2ecf20Sopenharmony_ci		[CLK_BUS_UART0]		= &bus_uart0_clk.common.hw,
6688c2ecf20Sopenharmony_ci		[CLK_BUS_UART1]		= &bus_uart1_clk.common.hw,
6698c2ecf20Sopenharmony_ci		[CLK_BUS_UART2]		= &bus_uart2_clk.common.hw,
6708c2ecf20Sopenharmony_ci		[CLK_BUS_EPHY]		= &bus_ephy_clk.common.hw,
6718c2ecf20Sopenharmony_ci		[CLK_BUS_DBG]		= &bus_dbg_clk.common.hw,
6728c2ecf20Sopenharmony_ci		[CLK_MMC0]		= &mmc0_clk.common.hw,
6738c2ecf20Sopenharmony_ci		[CLK_MMC0_SAMPLE]	= &mmc0_sample_clk.common.hw,
6748c2ecf20Sopenharmony_ci		[CLK_MMC0_OUTPUT]	= &mmc0_output_clk.common.hw,
6758c2ecf20Sopenharmony_ci		[CLK_MMC1]		= &mmc1_clk.common.hw,
6768c2ecf20Sopenharmony_ci		[CLK_MMC1_SAMPLE]	= &mmc1_sample_clk.common.hw,
6778c2ecf20Sopenharmony_ci		[CLK_MMC1_OUTPUT]	= &mmc1_output_clk.common.hw,
6788c2ecf20Sopenharmony_ci		[CLK_MMC2]		= &mmc2_clk.common.hw,
6798c2ecf20Sopenharmony_ci		[CLK_MMC2_SAMPLE]	= &mmc2_sample_clk.common.hw,
6808c2ecf20Sopenharmony_ci		[CLK_MMC2_OUTPUT]	= &mmc2_output_clk.common.hw,
6818c2ecf20Sopenharmony_ci		[CLK_CE]		= &ce_clk.common.hw,
6828c2ecf20Sopenharmony_ci		[CLK_SPI0]		= &spi0_clk.common.hw,
6838c2ecf20Sopenharmony_ci		[CLK_I2S0]		= &i2s0_clk.common.hw,
6848c2ecf20Sopenharmony_ci		[CLK_USB_PHY0]		= &usb_phy0_clk.common.hw,
6858c2ecf20Sopenharmony_ci		[CLK_USB_OHCI0]		= &usb_ohci0_clk.common.hw,
6868c2ecf20Sopenharmony_ci		[CLK_DRAM]		= &dram_clk.common.hw,
6878c2ecf20Sopenharmony_ci		[CLK_DRAM_VE]		= &dram_ve_clk.common.hw,
6888c2ecf20Sopenharmony_ci		[CLK_DRAM_CSI]		= &dram_csi_clk.common.hw,
6898c2ecf20Sopenharmony_ci		[CLK_DRAM_EHCI]		= &dram_ehci_clk.common.hw,
6908c2ecf20Sopenharmony_ci		[CLK_DRAM_OHCI]		= &dram_ohci_clk.common.hw,
6918c2ecf20Sopenharmony_ci		[CLK_DE]		= &de_clk.common.hw,
6928c2ecf20Sopenharmony_ci		[CLK_TCON0]		= &tcon_clk.common.hw,
6938c2ecf20Sopenharmony_ci		[CLK_CSI_MISC]		= &csi_misc_clk.common.hw,
6948c2ecf20Sopenharmony_ci		[CLK_CSI0_MCLK]		= &csi0_mclk_clk.common.hw,
6958c2ecf20Sopenharmony_ci		[CLK_CSI1_SCLK]		= &csi1_sclk_clk.common.hw,
6968c2ecf20Sopenharmony_ci		[CLK_CSI1_MCLK]		= &csi1_mclk_clk.common.hw,
6978c2ecf20Sopenharmony_ci		[CLK_VE]		= &ve_clk.common.hw,
6988c2ecf20Sopenharmony_ci		[CLK_AC_DIG]		= &ac_dig_clk.common.hw,
6998c2ecf20Sopenharmony_ci		[CLK_AVS]		= &avs_clk.common.hw,
7008c2ecf20Sopenharmony_ci		[CLK_MBUS]		= &mbus_clk.common.hw,
7018c2ecf20Sopenharmony_ci		[CLK_MIPI_CSI]		= &mipi_csi_clk.common.hw,
7028c2ecf20Sopenharmony_ci	},
7038c2ecf20Sopenharmony_ci	.num	= CLK_I2S0 + 1,
7048c2ecf20Sopenharmony_ci};
7058c2ecf20Sopenharmony_ci
7068c2ecf20Sopenharmony_cistatic struct ccu_reset_map sun8i_v3s_ccu_resets[] = {
7078c2ecf20Sopenharmony_ci	[RST_USB_PHY0]		=  { 0x0cc, BIT(0) },
7088c2ecf20Sopenharmony_ci
7098c2ecf20Sopenharmony_ci	[RST_MBUS]		=  { 0x0fc, BIT(31) },
7108c2ecf20Sopenharmony_ci
7118c2ecf20Sopenharmony_ci	[RST_BUS_CE]		=  { 0x2c0, BIT(5) },
7128c2ecf20Sopenharmony_ci	[RST_BUS_DMA]		=  { 0x2c0, BIT(6) },
7138c2ecf20Sopenharmony_ci	[RST_BUS_MMC0]		=  { 0x2c0, BIT(8) },
7148c2ecf20Sopenharmony_ci	[RST_BUS_MMC1]		=  { 0x2c0, BIT(9) },
7158c2ecf20Sopenharmony_ci	[RST_BUS_MMC2]		=  { 0x2c0, BIT(10) },
7168c2ecf20Sopenharmony_ci	[RST_BUS_DRAM]		=  { 0x2c0, BIT(14) },
7178c2ecf20Sopenharmony_ci	[RST_BUS_EMAC]		=  { 0x2c0, BIT(17) },
7188c2ecf20Sopenharmony_ci	[RST_BUS_HSTIMER]	=  { 0x2c0, BIT(19) },
7198c2ecf20Sopenharmony_ci	[RST_BUS_SPI0]		=  { 0x2c0, BIT(20) },
7208c2ecf20Sopenharmony_ci	[RST_BUS_OTG]		=  { 0x2c0, BIT(24) },
7218c2ecf20Sopenharmony_ci	[RST_BUS_EHCI0]		=  { 0x2c0, BIT(26) },
7228c2ecf20Sopenharmony_ci	[RST_BUS_OHCI0]		=  { 0x2c0, BIT(29) },
7238c2ecf20Sopenharmony_ci
7248c2ecf20Sopenharmony_ci	[RST_BUS_VE]		=  { 0x2c4, BIT(0) },
7258c2ecf20Sopenharmony_ci	[RST_BUS_TCON0]		=  { 0x2c4, BIT(4) },
7268c2ecf20Sopenharmony_ci	[RST_BUS_CSI]		=  { 0x2c4, BIT(8) },
7278c2ecf20Sopenharmony_ci	[RST_BUS_DE]		=  { 0x2c4, BIT(12) },
7288c2ecf20Sopenharmony_ci	[RST_BUS_DBG]		=  { 0x2c4, BIT(31) },
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_ci	[RST_BUS_EPHY]		=  { 0x2c8, BIT(2) },
7318c2ecf20Sopenharmony_ci
7328c2ecf20Sopenharmony_ci	[RST_BUS_CODEC]		=  { 0x2d0, BIT(0) },
7338c2ecf20Sopenharmony_ci
7348c2ecf20Sopenharmony_ci	[RST_BUS_I2C0]		=  { 0x2d8, BIT(0) },
7358c2ecf20Sopenharmony_ci	[RST_BUS_I2C1]		=  { 0x2d8, BIT(1) },
7368c2ecf20Sopenharmony_ci	[RST_BUS_UART0]		=  { 0x2d8, BIT(16) },
7378c2ecf20Sopenharmony_ci	[RST_BUS_UART1]		=  { 0x2d8, BIT(17) },
7388c2ecf20Sopenharmony_ci	[RST_BUS_UART2]		=  { 0x2d8, BIT(18) },
7398c2ecf20Sopenharmony_ci};
7408c2ecf20Sopenharmony_ci
7418c2ecf20Sopenharmony_cistatic struct ccu_reset_map sun8i_v3_ccu_resets[] = {
7428c2ecf20Sopenharmony_ci	[RST_USB_PHY0]		=  { 0x0cc, BIT(0) },
7438c2ecf20Sopenharmony_ci
7448c2ecf20Sopenharmony_ci	[RST_MBUS]		=  { 0x0fc, BIT(31) },
7458c2ecf20Sopenharmony_ci
7468c2ecf20Sopenharmony_ci	[RST_BUS_CE]		=  { 0x2c0, BIT(5) },
7478c2ecf20Sopenharmony_ci	[RST_BUS_DMA]		=  { 0x2c0, BIT(6) },
7488c2ecf20Sopenharmony_ci	[RST_BUS_MMC0]		=  { 0x2c0, BIT(8) },
7498c2ecf20Sopenharmony_ci	[RST_BUS_MMC1]		=  { 0x2c0, BIT(9) },
7508c2ecf20Sopenharmony_ci	[RST_BUS_MMC2]		=  { 0x2c0, BIT(10) },
7518c2ecf20Sopenharmony_ci	[RST_BUS_DRAM]		=  { 0x2c0, BIT(14) },
7528c2ecf20Sopenharmony_ci	[RST_BUS_EMAC]		=  { 0x2c0, BIT(17) },
7538c2ecf20Sopenharmony_ci	[RST_BUS_HSTIMER]	=  { 0x2c0, BIT(19) },
7548c2ecf20Sopenharmony_ci	[RST_BUS_SPI0]		=  { 0x2c0, BIT(20) },
7558c2ecf20Sopenharmony_ci	[RST_BUS_OTG]		=  { 0x2c0, BIT(24) },
7568c2ecf20Sopenharmony_ci	[RST_BUS_EHCI0]		=  { 0x2c0, BIT(26) },
7578c2ecf20Sopenharmony_ci	[RST_BUS_OHCI0]		=  { 0x2c0, BIT(29) },
7588c2ecf20Sopenharmony_ci
7598c2ecf20Sopenharmony_ci	[RST_BUS_VE]		=  { 0x2c4, BIT(0) },
7608c2ecf20Sopenharmony_ci	[RST_BUS_TCON0]		=  { 0x2c4, BIT(4) },
7618c2ecf20Sopenharmony_ci	[RST_BUS_CSI]		=  { 0x2c4, BIT(8) },
7628c2ecf20Sopenharmony_ci	[RST_BUS_DE]		=  { 0x2c4, BIT(12) },
7638c2ecf20Sopenharmony_ci	[RST_BUS_DBG]		=  { 0x2c4, BIT(31) },
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_ci	[RST_BUS_EPHY]		=  { 0x2c8, BIT(2) },
7668c2ecf20Sopenharmony_ci
7678c2ecf20Sopenharmony_ci	[RST_BUS_CODEC]		=  { 0x2d0, BIT(0) },
7688c2ecf20Sopenharmony_ci	[RST_BUS_I2S0]		=  { 0x2d0, BIT(12) },
7698c2ecf20Sopenharmony_ci
7708c2ecf20Sopenharmony_ci	[RST_BUS_I2C0]		=  { 0x2d8, BIT(0) },
7718c2ecf20Sopenharmony_ci	[RST_BUS_I2C1]		=  { 0x2d8, BIT(1) },
7728c2ecf20Sopenharmony_ci	[RST_BUS_UART0]		=  { 0x2d8, BIT(16) },
7738c2ecf20Sopenharmony_ci	[RST_BUS_UART1]		=  { 0x2d8, BIT(17) },
7748c2ecf20Sopenharmony_ci	[RST_BUS_UART2]		=  { 0x2d8, BIT(18) },
7758c2ecf20Sopenharmony_ci};
7768c2ecf20Sopenharmony_ci
7778c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun8i_v3s_ccu_desc = {
7788c2ecf20Sopenharmony_ci	.ccu_clks	= sun8i_v3s_ccu_clks,
7798c2ecf20Sopenharmony_ci	.num_ccu_clks	= ARRAY_SIZE(sun8i_v3s_ccu_clks),
7808c2ecf20Sopenharmony_ci
7818c2ecf20Sopenharmony_ci	.hw_clks	= &sun8i_v3s_hw_clks,
7828c2ecf20Sopenharmony_ci
7838c2ecf20Sopenharmony_ci	.resets		= sun8i_v3s_ccu_resets,
7848c2ecf20Sopenharmony_ci	.num_resets	= ARRAY_SIZE(sun8i_v3s_ccu_resets),
7858c2ecf20Sopenharmony_ci};
7868c2ecf20Sopenharmony_ci
7878c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun8i_v3_ccu_desc = {
7888c2ecf20Sopenharmony_ci	.ccu_clks	= sun8i_v3_ccu_clks,
7898c2ecf20Sopenharmony_ci	.num_ccu_clks	= ARRAY_SIZE(sun8i_v3_ccu_clks),
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ci	.hw_clks	= &sun8i_v3_hw_clks,
7928c2ecf20Sopenharmony_ci
7938c2ecf20Sopenharmony_ci	.resets		= sun8i_v3_ccu_resets,
7948c2ecf20Sopenharmony_ci	.num_resets	= ARRAY_SIZE(sun8i_v3_ccu_resets),
7958c2ecf20Sopenharmony_ci};
7968c2ecf20Sopenharmony_ci
7978c2ecf20Sopenharmony_cistatic void __init sun8i_v3_v3s_ccu_init(struct device_node *node,
7988c2ecf20Sopenharmony_ci					 const struct sunxi_ccu_desc *ccu_desc)
7998c2ecf20Sopenharmony_ci{
8008c2ecf20Sopenharmony_ci	void __iomem *reg;
8018c2ecf20Sopenharmony_ci	u32 val;
8028c2ecf20Sopenharmony_ci
8038c2ecf20Sopenharmony_ci	reg = of_io_request_and_map(node, 0, of_node_full_name(node));
8048c2ecf20Sopenharmony_ci	if (IS_ERR(reg)) {
8058c2ecf20Sopenharmony_ci		pr_err("%pOF: Could not map the clock registers\n", node);
8068c2ecf20Sopenharmony_ci		return;
8078c2ecf20Sopenharmony_ci	}
8088c2ecf20Sopenharmony_ci
8098c2ecf20Sopenharmony_ci	/* Force the PLL-Audio-1x divider to 4 */
8108c2ecf20Sopenharmony_ci	val = readl(reg + SUN8I_V3S_PLL_AUDIO_REG);
8118c2ecf20Sopenharmony_ci	val &= ~GENMASK(19, 16);
8128c2ecf20Sopenharmony_ci	writel(val | (3 << 16), reg + SUN8I_V3S_PLL_AUDIO_REG);
8138c2ecf20Sopenharmony_ci
8148c2ecf20Sopenharmony_ci	sunxi_ccu_probe(node, reg, ccu_desc);
8158c2ecf20Sopenharmony_ci}
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_cistatic void __init sun8i_v3s_ccu_setup(struct device_node *node)
8188c2ecf20Sopenharmony_ci{
8198c2ecf20Sopenharmony_ci	sun8i_v3_v3s_ccu_init(node, &sun8i_v3s_ccu_desc);
8208c2ecf20Sopenharmony_ci}
8218c2ecf20Sopenharmony_ci
8228c2ecf20Sopenharmony_cistatic void __init sun8i_v3_ccu_setup(struct device_node *node)
8238c2ecf20Sopenharmony_ci{
8248c2ecf20Sopenharmony_ci	sun8i_v3_v3s_ccu_init(node, &sun8i_v3_ccu_desc);
8258c2ecf20Sopenharmony_ci}
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_ciCLK_OF_DECLARE(sun8i_v3s_ccu, "allwinner,sun8i-v3s-ccu",
8288c2ecf20Sopenharmony_ci	       sun8i_v3s_ccu_setup);
8298c2ecf20Sopenharmony_ci
8308c2ecf20Sopenharmony_ciCLK_OF_DECLARE(sun8i_v3_ccu, "allwinner,sun8i-v3-ccu",
8318c2ecf20Sopenharmony_ci	       sun8i_v3_ccu_setup);
832