18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2016 Maxime Ripard. All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#include <linux/clk-provider.h>
78c2ecf20Sopenharmony_ci#include <linux/io.h>
88c2ecf20Sopenharmony_ci#include <linux/of_address.h>
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include "ccu_common.h"
118c2ecf20Sopenharmony_ci#include "ccu_reset.h"
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include "ccu_div.h"
148c2ecf20Sopenharmony_ci#include "ccu_gate.h"
158c2ecf20Sopenharmony_ci#include "ccu_mp.h"
168c2ecf20Sopenharmony_ci#include "ccu_mult.h"
178c2ecf20Sopenharmony_ci#include "ccu_nk.h"
188c2ecf20Sopenharmony_ci#include "ccu_nkm.h"
198c2ecf20Sopenharmony_ci#include "ccu_nkmp.h"
208c2ecf20Sopenharmony_ci#include "ccu_nm.h"
218c2ecf20Sopenharmony_ci#include "ccu_phase.h"
228c2ecf20Sopenharmony_ci#include "ccu_sdm.h"
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include "ccu-sun8i-h3.h"
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cistatic SUNXI_CCU_NKMP_WITH_GATE_LOCK(pll_cpux_clk, "pll-cpux",
278c2ecf20Sopenharmony_ci				     "osc24M", 0x000,
288c2ecf20Sopenharmony_ci				     8, 5,	/* N */
298c2ecf20Sopenharmony_ci				     4, 2,	/* K */
308c2ecf20Sopenharmony_ci				     0, 2,	/* M */
318c2ecf20Sopenharmony_ci				     16, 2,	/* P */
328c2ecf20Sopenharmony_ci				     BIT(31),	/* gate */
338c2ecf20Sopenharmony_ci				     BIT(28),	/* lock */
348c2ecf20Sopenharmony_ci				     CLK_SET_RATE_UNGATE);
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/*
378c2ecf20Sopenharmony_ci * The Audio PLL is supposed to have 4 outputs: 3 fixed factors from
388c2ecf20Sopenharmony_ci * the base (2x, 4x and 8x), and one variable divider (the one true
398c2ecf20Sopenharmony_ci * pll audio).
408c2ecf20Sopenharmony_ci *
418c2ecf20Sopenharmony_ci * With sigma-delta modulation for fractional-N on the audio PLL,
428c2ecf20Sopenharmony_ci * we have to use specific dividers. This means the variable divider
438c2ecf20Sopenharmony_ci * can no longer be used, as the audio codec requests the exact clock
448c2ecf20Sopenharmony_ci * rates we support through this mechanism. So we now hard code the
458c2ecf20Sopenharmony_ci * variable divider to 1. This means the clock rates will no longer
468c2ecf20Sopenharmony_ci * match the clock names.
478c2ecf20Sopenharmony_ci */
488c2ecf20Sopenharmony_ci#define SUN8I_H3_PLL_AUDIO_REG	0x008
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_cistatic struct ccu_sdm_setting pll_audio_sdm_table[] = {
518c2ecf20Sopenharmony_ci	{ .rate = 22579200, .pattern = 0xc0010d84, .m = 8, .n = 7 },
528c2ecf20Sopenharmony_ci	{ .rate = 24576000, .pattern = 0xc000ac02, .m = 14, .n = 14 },
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base",
568c2ecf20Sopenharmony_ci				       "osc24M", 0x008,
578c2ecf20Sopenharmony_ci				       8, 7,	/* N */
588c2ecf20Sopenharmony_ci				       0, 5,	/* M */
598c2ecf20Sopenharmony_ci				       pll_audio_sdm_table, BIT(24),
608c2ecf20Sopenharmony_ci				       0x284, BIT(31),
618c2ecf20Sopenharmony_ci				       BIT(31),	/* gate */
628c2ecf20Sopenharmony_ci				       BIT(28),	/* lock */
638c2ecf20Sopenharmony_ci				       CLK_SET_RATE_UNGATE);
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX(pll_video_clk, "pll-video",
668c2ecf20Sopenharmony_ci						"osc24M", 0x0010,
678c2ecf20Sopenharmony_ci						192000000, /* Minimum rate */
688c2ecf20Sopenharmony_ci						912000000, /* Maximum rate */
698c2ecf20Sopenharmony_ci						8, 7,      /* N */
708c2ecf20Sopenharmony_ci						0, 4,	   /* M */
718c2ecf20Sopenharmony_ci						BIT(24),   /* frac enable */
728c2ecf20Sopenharmony_ci						BIT(25),   /* frac select */
738c2ecf20Sopenharmony_ci						270000000, /* frac rate 0 */
748c2ecf20Sopenharmony_ci						297000000, /* frac rate 1 */
758c2ecf20Sopenharmony_ci						BIT(31),   /* gate */
768c2ecf20Sopenharmony_ci						BIT(28),   /* lock */
778c2ecf20Sopenharmony_ci						CLK_SET_RATE_UNGATE);
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve",
808c2ecf20Sopenharmony_ci					"osc24M", 0x0018,
818c2ecf20Sopenharmony_ci					8, 7,		/* N */
828c2ecf20Sopenharmony_ci					0, 4,		/* M */
838c2ecf20Sopenharmony_ci					BIT(24),	/* frac enable */
848c2ecf20Sopenharmony_ci					BIT(25),	/* frac select */
858c2ecf20Sopenharmony_ci					270000000,	/* frac rate 0 */
868c2ecf20Sopenharmony_ci					297000000,	/* frac rate 1 */
878c2ecf20Sopenharmony_ci					BIT(31),	/* gate */
888c2ecf20Sopenharmony_ci					BIT(28),	/* lock */
898c2ecf20Sopenharmony_ci					CLK_SET_RATE_UNGATE);
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_cistatic SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr_clk, "pll-ddr",
928c2ecf20Sopenharmony_ci				    "osc24M", 0x020,
938c2ecf20Sopenharmony_ci				    8, 5,	/* N */
948c2ecf20Sopenharmony_ci				    4, 2,	/* K */
958c2ecf20Sopenharmony_ci				    0, 2,	/* M */
968c2ecf20Sopenharmony_ci				    BIT(31),	/* gate */
978c2ecf20Sopenharmony_ci				    BIT(28),	/* lock */
988c2ecf20Sopenharmony_ci				    CLK_SET_RATE_UNGATE);
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_cistatic SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph0_clk, "pll-periph0",
1018c2ecf20Sopenharmony_ci					   "osc24M", 0x028,
1028c2ecf20Sopenharmony_ci					   8, 5,	/* N */
1038c2ecf20Sopenharmony_ci					   4, 2,	/* K */
1048c2ecf20Sopenharmony_ci					   BIT(31),	/* gate */
1058c2ecf20Sopenharmony_ci					   BIT(28),	/* lock */
1068c2ecf20Sopenharmony_ci					   2,		/* post-div */
1078c2ecf20Sopenharmony_ci					   CLK_SET_RATE_UNGATE);
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_gpu_clk, "pll-gpu",
1108c2ecf20Sopenharmony_ci					"osc24M", 0x0038,
1118c2ecf20Sopenharmony_ci					8, 7,		/* N */
1128c2ecf20Sopenharmony_ci					0, 4,		/* M */
1138c2ecf20Sopenharmony_ci					BIT(24),	/* frac enable */
1148c2ecf20Sopenharmony_ci					BIT(25),	/* frac select */
1158c2ecf20Sopenharmony_ci					270000000,	/* frac rate 0 */
1168c2ecf20Sopenharmony_ci					297000000,	/* frac rate 1 */
1178c2ecf20Sopenharmony_ci					BIT(31),	/* gate */
1188c2ecf20Sopenharmony_ci					BIT(28),	/* lock */
1198c2ecf20Sopenharmony_ci					CLK_SET_RATE_UNGATE);
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_cistatic SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph1_clk, "pll-periph1",
1228c2ecf20Sopenharmony_ci					   "osc24M", 0x044,
1238c2ecf20Sopenharmony_ci					   8, 5,	/* N */
1248c2ecf20Sopenharmony_ci					   4, 2,	/* K */
1258c2ecf20Sopenharmony_ci					   BIT(31),	/* gate */
1268c2ecf20Sopenharmony_ci					   BIT(28),	/* lock */
1278c2ecf20Sopenharmony_ci					   2,		/* post-div */
1288c2ecf20Sopenharmony_ci					   CLK_SET_RATE_UNGATE);
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_cistatic SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_de_clk, "pll-de",
1318c2ecf20Sopenharmony_ci					"osc24M", 0x0048,
1328c2ecf20Sopenharmony_ci					8, 7,		/* N */
1338c2ecf20Sopenharmony_ci					0, 4,		/* M */
1348c2ecf20Sopenharmony_ci					BIT(24),	/* frac enable */
1358c2ecf20Sopenharmony_ci					BIT(25),	/* frac select */
1368c2ecf20Sopenharmony_ci					270000000,	/* frac rate 0 */
1378c2ecf20Sopenharmony_ci					297000000,	/* frac rate 1 */
1388c2ecf20Sopenharmony_ci					BIT(31),	/* gate */
1398c2ecf20Sopenharmony_ci					BIT(28),	/* lock */
1408c2ecf20Sopenharmony_ci					CLK_SET_RATE_UNGATE);
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_cistatic const char * const cpux_parents[] = { "osc32k", "osc24M",
1438c2ecf20Sopenharmony_ci					     "pll-cpux" , "pll-cpux" };
1448c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX(cpux_clk, "cpux", cpux_parents,
1458c2ecf20Sopenharmony_ci		     0x050, 16, 2, CLK_IS_CRITICAL | CLK_SET_RATE_PARENT);
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x050, 0, 2, 0);
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_cistatic const char * const ahb1_parents[] = { "osc32k", "osc24M",
1508c2ecf20Sopenharmony_ci					     "axi" , "pll-periph0" };
1518c2ecf20Sopenharmony_cistatic const struct ccu_mux_var_prediv ahb1_predivs[] = {
1528c2ecf20Sopenharmony_ci	{ .index = 3, .shift = 6, .width = 2 },
1538c2ecf20Sopenharmony_ci};
1548c2ecf20Sopenharmony_cistatic struct ccu_div ahb1_clk = {
1558c2ecf20Sopenharmony_ci	.div		= _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO),
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci	.mux		= {
1588c2ecf20Sopenharmony_ci		.shift	= 12,
1598c2ecf20Sopenharmony_ci		.width	= 2,
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci		.var_predivs	= ahb1_predivs,
1628c2ecf20Sopenharmony_ci		.n_var_predivs	= ARRAY_SIZE(ahb1_predivs),
1638c2ecf20Sopenharmony_ci	},
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci	.common		= {
1668c2ecf20Sopenharmony_ci		.reg		= 0x054,
1678c2ecf20Sopenharmony_ci		.features	= CCU_FEATURE_VARIABLE_PREDIV,
1688c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT_PARENTS("ahb1",
1698c2ecf20Sopenharmony_ci						      ahb1_parents,
1708c2ecf20Sopenharmony_ci						      &ccu_div_ops,
1718c2ecf20Sopenharmony_ci						      0),
1728c2ecf20Sopenharmony_ci	},
1738c2ecf20Sopenharmony_ci};
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_cistatic struct clk_div_table apb1_div_table[] = {
1768c2ecf20Sopenharmony_ci	{ .val = 0, .div = 2 },
1778c2ecf20Sopenharmony_ci	{ .val = 1, .div = 2 },
1788c2ecf20Sopenharmony_ci	{ .val = 2, .div = 4 },
1798c2ecf20Sopenharmony_ci	{ .val = 3, .div = 8 },
1808c2ecf20Sopenharmony_ci	{ /* Sentinel */ },
1818c2ecf20Sopenharmony_ci};
1828c2ecf20Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(apb1_clk, "apb1", "ahb1",
1838c2ecf20Sopenharmony_ci			   0x054, 8, 2, apb1_div_table, 0);
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_cistatic const char * const apb2_parents[] = { "osc32k", "osc24M",
1868c2ecf20Sopenharmony_ci					     "pll-periph0" , "pll-periph0" };
1878c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", apb2_parents, 0x058,
1888c2ecf20Sopenharmony_ci			     0, 5,	/* M */
1898c2ecf20Sopenharmony_ci			     16, 2,	/* P */
1908c2ecf20Sopenharmony_ci			     24, 2,	/* mux */
1918c2ecf20Sopenharmony_ci			     0);
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_cistatic const char * const ahb2_parents[] = { "ahb1" , "pll-periph0" };
1948c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv ahb2_fixed_predivs[] = {
1958c2ecf20Sopenharmony_ci	{ .index = 1, .div = 2 },
1968c2ecf20Sopenharmony_ci};
1978c2ecf20Sopenharmony_cistatic struct ccu_mux ahb2_clk = {
1988c2ecf20Sopenharmony_ci	.mux		= {
1998c2ecf20Sopenharmony_ci		.shift	= 0,
2008c2ecf20Sopenharmony_ci		.width	= 1,
2018c2ecf20Sopenharmony_ci		.fixed_predivs	= ahb2_fixed_predivs,
2028c2ecf20Sopenharmony_ci		.n_predivs	= ARRAY_SIZE(ahb2_fixed_predivs),
2038c2ecf20Sopenharmony_ci	},
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci	.common		= {
2068c2ecf20Sopenharmony_ci		.reg		= 0x05c,
2078c2ecf20Sopenharmony_ci		.features	= CCU_FEATURE_FIXED_PREDIV,
2088c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT_PARENTS("ahb2",
2098c2ecf20Sopenharmony_ci						      ahb2_parents,
2108c2ecf20Sopenharmony_ci						      &ccu_mux_ops,
2118c2ecf20Sopenharmony_ci						      0),
2128c2ecf20Sopenharmony_ci	},
2138c2ecf20Sopenharmony_ci};
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ce_clk,	"bus-ce",	"ahb1",
2168c2ecf20Sopenharmony_ci		      0x060, BIT(5), 0);
2178c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dma_clk,	"bus-dma",	"ahb1",
2188c2ecf20Sopenharmony_ci		      0x060, BIT(6), 0);
2198c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc0_clk,	"bus-mmc0",	"ahb1",
2208c2ecf20Sopenharmony_ci		      0x060, BIT(8), 0);
2218c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc1_clk,	"bus-mmc1",	"ahb1",
2228c2ecf20Sopenharmony_ci		      0x060, BIT(9), 0);
2238c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_mmc2_clk,	"bus-mmc2",	"ahb1",
2248c2ecf20Sopenharmony_ci		      0x060, BIT(10), 0);
2258c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_nand_clk,	"bus-nand",	"ahb1",
2268c2ecf20Sopenharmony_ci		      0x060, BIT(13), 0);
2278c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dram_clk,	"bus-dram",	"ahb1",
2288c2ecf20Sopenharmony_ci		      0x060, BIT(14), 0);
2298c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_emac_clk,	"bus-emac",	"ahb2",
2308c2ecf20Sopenharmony_ci		      0x060, BIT(17), 0);
2318c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ts_clk,	"bus-ts",	"ahb1",
2328c2ecf20Sopenharmony_ci		      0x060, BIT(18), 0);
2338c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hstimer_clk,	"bus-hstimer",	"ahb1",
2348c2ecf20Sopenharmony_ci		      0x060, BIT(19), 0);
2358c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi0_clk,	"bus-spi0",	"ahb1",
2368c2ecf20Sopenharmony_ci		      0x060, BIT(20), 0);
2378c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spi1_clk,	"bus-spi1",	"ahb1",
2388c2ecf20Sopenharmony_ci		      0x060, BIT(21), 0);
2398c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_otg_clk,	"bus-otg",	"ahb1",
2408c2ecf20Sopenharmony_ci		      0x060, BIT(23), 0);
2418c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci0_clk,	"bus-ehci0",	"ahb1",
2428c2ecf20Sopenharmony_ci		      0x060, BIT(24), 0);
2438c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci1_clk,	"bus-ehci1",	"ahb2",
2448c2ecf20Sopenharmony_ci		      0x060, BIT(25), 0);
2458c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci2_clk,	"bus-ehci2",	"ahb2",
2468c2ecf20Sopenharmony_ci		      0x060, BIT(26), 0);
2478c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ehci3_clk,	"bus-ehci3",	"ahb2",
2488c2ecf20Sopenharmony_ci		      0x060, BIT(27), 0);
2498c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci0_clk,	"bus-ohci0",	"ahb1",
2508c2ecf20Sopenharmony_ci		      0x060, BIT(28), 0);
2518c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci1_clk,	"bus-ohci1",	"ahb2",
2528c2ecf20Sopenharmony_ci		      0x060, BIT(29), 0);
2538c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci2_clk,	"bus-ohci2",	"ahb2",
2548c2ecf20Sopenharmony_ci		      0x060, BIT(30), 0);
2558c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ohci3_clk,	"bus-ohci3",	"ahb2",
2568c2ecf20Sopenharmony_ci		      0x060, BIT(31), 0);
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ve_clk,	"bus-ve",	"ahb1",
2598c2ecf20Sopenharmony_ci		      0x064, BIT(0), 0);
2608c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tcon0_clk,	"bus-tcon0",	"ahb1",
2618c2ecf20Sopenharmony_ci		      0x064, BIT(3), 0);
2628c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tcon1_clk,	"bus-tcon1",	"ahb1",
2638c2ecf20Sopenharmony_ci		      0x064, BIT(4), 0);
2648c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_deinterlace_clk,	"bus-deinterlace",	"ahb1",
2658c2ecf20Sopenharmony_ci		      0x064, BIT(5), 0);
2668c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_csi_clk,	"bus-csi",	"ahb1",
2678c2ecf20Sopenharmony_ci		      0x064, BIT(8), 0);
2688c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_tve_clk,	"bus-tve",	"ahb1",
2698c2ecf20Sopenharmony_ci		      0x064, BIT(9), 0);
2708c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_hdmi_clk,	"bus-hdmi",	"ahb1",
2718c2ecf20Sopenharmony_ci		      0x064, BIT(11), 0);
2728c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_de_clk,	"bus-de",	"ahb1",
2738c2ecf20Sopenharmony_ci		      0x064, BIT(12), 0);
2748c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_gpu_clk,	"bus-gpu",	"ahb1",
2758c2ecf20Sopenharmony_ci		      0x064, BIT(20), 0);
2768c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_msgbox_clk,	"bus-msgbox",	"ahb1",
2778c2ecf20Sopenharmony_ci		      0x064, BIT(21), 0);
2788c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spinlock_clk,	"bus-spinlock",	"ahb1",
2798c2ecf20Sopenharmony_ci		      0x064, BIT(22), 0);
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_codec_clk,	"bus-codec",	"apb1",
2828c2ecf20Sopenharmony_ci		      0x068, BIT(0), 0);
2838c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_spdif_clk,	"bus-spdif",	"apb1",
2848c2ecf20Sopenharmony_ci		      0x068, BIT(1), 0);
2858c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_pio_clk,	"bus-pio",	"apb1",
2868c2ecf20Sopenharmony_ci		      0x068, BIT(5), 0);
2878c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ths_clk,	"bus-ths",	"apb1",
2888c2ecf20Sopenharmony_ci		      0x068, BIT(8), 0);
2898c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s0_clk,	"bus-i2s0",	"apb1",
2908c2ecf20Sopenharmony_ci		      0x068, BIT(12), 0);
2918c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s1_clk,	"bus-i2s1",	"apb1",
2928c2ecf20Sopenharmony_ci		      0x068, BIT(13), 0);
2938c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2s2_clk,	"bus-i2s2",	"apb1",
2948c2ecf20Sopenharmony_ci		      0x068, BIT(14), 0);
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c0_clk,	"bus-i2c0",	"apb2",
2978c2ecf20Sopenharmony_ci		      0x06c, BIT(0), 0);
2988c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c1_clk,	"bus-i2c1",	"apb2",
2998c2ecf20Sopenharmony_ci		      0x06c, BIT(1), 0);
3008c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_i2c2_clk,	"bus-i2c2",	"apb2",
3018c2ecf20Sopenharmony_ci		      0x06c, BIT(2), 0);
3028c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart0_clk,	"bus-uart0",	"apb2",
3038c2ecf20Sopenharmony_ci		      0x06c, BIT(16), 0);
3048c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart1_clk,	"bus-uart1",	"apb2",
3058c2ecf20Sopenharmony_ci		      0x06c, BIT(17), 0);
3068c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart2_clk,	"bus-uart2",	"apb2",
3078c2ecf20Sopenharmony_ci		      0x06c, BIT(18), 0);
3088c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_uart3_clk,	"bus-uart3",	"apb2",
3098c2ecf20Sopenharmony_ci		      0x06c, BIT(19), 0);
3108c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_scr0_clk,	"bus-scr0",	"apb2",
3118c2ecf20Sopenharmony_ci		      0x06c, BIT(20), 0);
3128c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_scr1_clk,	"bus-scr1",	"apb2",
3138c2ecf20Sopenharmony_ci		      0x06c, BIT(21), 0);
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_ephy_clk,	"bus-ephy",	"ahb1",
3168c2ecf20Sopenharmony_ci		      0x070, BIT(0), 0);
3178c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(bus_dbg_clk,	"bus-dbg",	"ahb1",
3188c2ecf20Sopenharmony_ci		      0x070, BIT(7), 0);
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_cistatic struct clk_div_table ths_div_table[] = {
3218c2ecf20Sopenharmony_ci	{ .val = 0, .div = 1 },
3228c2ecf20Sopenharmony_ci	{ .val = 1, .div = 2 },
3238c2ecf20Sopenharmony_ci	{ .val = 2, .div = 4 },
3248c2ecf20Sopenharmony_ci	{ .val = 3, .div = 6 },
3258c2ecf20Sopenharmony_ci	{ /* Sentinel */ },
3268c2ecf20Sopenharmony_ci};
3278c2ecf20Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE_WITH_GATE(ths_clk, "ths", "osc24M",
3288c2ecf20Sopenharmony_ci				     0x074, 0, 2, ths_div_table, BIT(31), 0);
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_cistatic const char * const mod0_default_parents[] = { "osc24M", "pll-periph0",
3318c2ecf20Sopenharmony_ci						     "pll-periph1" };
3328c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand_clk, "nand", mod0_default_parents, 0x080,
3338c2ecf20Sopenharmony_ci				  0, 4,		/* M */
3348c2ecf20Sopenharmony_ci				  16, 2,	/* P */
3358c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
3368c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
3378c2ecf20Sopenharmony_ci				  0);
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 0x088,
3408c2ecf20Sopenharmony_ci				  0, 4,		/* M */
3418c2ecf20Sopenharmony_ci				  16, 2,	/* P */
3428c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
3438c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
3448c2ecf20Sopenharmony_ci				  0);
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_sample_clk, "mmc0_sample", "mmc0",
3478c2ecf20Sopenharmony_ci		       0x088, 20, 3, 0);
3488c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_output_clk, "mmc0_output", "mmc0",
3498c2ecf20Sopenharmony_ci		       0x088, 8, 3, 0);
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 0x08c,
3528c2ecf20Sopenharmony_ci				  0, 4,		/* M */
3538c2ecf20Sopenharmony_ci				  16, 2,	/* P */
3548c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
3558c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
3568c2ecf20Sopenharmony_ci				  0);
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1_sample", "mmc1",
3598c2ecf20Sopenharmony_ci		       0x08c, 20, 3, 0);
3608c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1_output", "mmc1",
3618c2ecf20Sopenharmony_ci		       0x08c, 8, 3, 0);
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 0x090,
3648c2ecf20Sopenharmony_ci				  0, 4,		/* M */
3658c2ecf20Sopenharmony_ci				  16, 2,	/* P */
3668c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
3678c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
3688c2ecf20Sopenharmony_ci				  0);
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2_sample", "mmc2",
3718c2ecf20Sopenharmony_ci		       0x090, 20, 3, 0);
3728c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_output_clk, "mmc2_output", "mmc2",
3738c2ecf20Sopenharmony_ci		       0x090, 8, 3, 0);
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_cistatic const char * const ts_parents[] = { "osc24M", "pll-periph0", };
3768c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ts_clk, "ts", ts_parents, 0x098,
3778c2ecf20Sopenharmony_ci				  0, 4,		/* M */
3788c2ecf20Sopenharmony_ci				  16, 2,	/* P */
3798c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
3808c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
3818c2ecf20Sopenharmony_ci				  0);
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ce_clk, "ce", mod0_default_parents, 0x09c,
3848c2ecf20Sopenharmony_ci				  0, 4,		/* M */
3858c2ecf20Sopenharmony_ci				  16, 2,	/* P */
3868c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
3878c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
3888c2ecf20Sopenharmony_ci				  0);
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 0x0a0,
3918c2ecf20Sopenharmony_ci				  0, 4,		/* M */
3928c2ecf20Sopenharmony_ci				  16, 2,	/* P */
3938c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
3948c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
3958c2ecf20Sopenharmony_ci				  0);
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 0x0a4,
3988c2ecf20Sopenharmony_ci				  0, 4,		/* M */
3998c2ecf20Sopenharmony_ci				  16, 2,	/* P */
4008c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
4018c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
4028c2ecf20Sopenharmony_ci				  0);
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_cistatic const char * const i2s_parents[] = { "pll-audio-8x", "pll-audio-4x",
4058c2ecf20Sopenharmony_ci					    "pll-audio-2x", "pll-audio" };
4068c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s0_clk, "i2s0", i2s_parents,
4078c2ecf20Sopenharmony_ci			       0x0b0, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s1_clk, "i2s1", i2s_parents,
4108c2ecf20Sopenharmony_ci			       0x0b4, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s2_clk, "i2s2", i2s_parents,
4138c2ecf20Sopenharmony_ci			       0x0b8, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(spdif_clk, "spdif", "pll-audio",
4168c2ecf20Sopenharmony_ci			     0x0c0, 0, 4, BIT(31), CLK_SET_RATE_PARENT);
4178c2ecf20Sopenharmony_ci
4188c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy0_clk,	"usb-phy0",	"osc24M",
4198c2ecf20Sopenharmony_ci		      0x0cc, BIT(8), 0);
4208c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy1_clk,	"usb-phy1",	"osc24M",
4218c2ecf20Sopenharmony_ci		      0x0cc, BIT(9), 0);
4228c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy2_clk,	"usb-phy2",	"osc24M",
4238c2ecf20Sopenharmony_ci		      0x0cc, BIT(10), 0);
4248c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy3_clk,	"usb-phy3",	"osc24M",
4258c2ecf20Sopenharmony_ci		      0x0cc, BIT(11), 0);
4268c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci0_clk,	"usb-ohci0",	"osc24M",
4278c2ecf20Sopenharmony_ci		      0x0cc, BIT(16), 0);
4288c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci1_clk,	"usb-ohci1",	"osc24M",
4298c2ecf20Sopenharmony_ci		      0x0cc, BIT(17), 0);
4308c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci2_clk,	"usb-ohci2",	"osc24M",
4318c2ecf20Sopenharmony_ci		      0x0cc, BIT(18), 0);
4328c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci3_clk,	"usb-ohci3",	"osc24M",
4338c2ecf20Sopenharmony_ci		      0x0cc, BIT(19), 0);
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_cistatic const char * const dram_parents[] = { "pll-ddr", "pll-periph0-2x" };
4368c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX(dram_clk, "dram", dram_parents,
4378c2ecf20Sopenharmony_ci			    0x0f4, 0, 4, 20, 2, CLK_IS_CRITICAL);
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ve_clk,	"dram-ve",	"dram",
4408c2ecf20Sopenharmony_ci		      0x100, BIT(0), 0);
4418c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_csi_clk,	"dram-csi",	"dram",
4428c2ecf20Sopenharmony_ci		      0x100, BIT(1), 0);
4438c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_deinterlace_clk,	"dram-deinterlace",	"dram",
4448c2ecf20Sopenharmony_ci		      0x100, BIT(2), 0);
4458c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ts_clk,	"dram-ts",	"dram",
4468c2ecf20Sopenharmony_ci		      0x100, BIT(3), 0);
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_cistatic const char * const de_parents[] = { "pll-periph0-2x", "pll-de" };
4498c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents,
4508c2ecf20Sopenharmony_ci				 0x104, 0, 4, 24, 3, BIT(31),
4518c2ecf20Sopenharmony_ci				 CLK_SET_RATE_PARENT);
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_cistatic const char * const tcon_parents[] = { "pll-video" };
4548c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(tcon_clk, "tcon", tcon_parents,
4558c2ecf20Sopenharmony_ci				 0x118, 0, 4, 24, 3, BIT(31),
4568c2ecf20Sopenharmony_ci				 CLK_SET_RATE_PARENT);
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_cistatic const char * const tve_parents[] = { "pll-de", "pll-periph1" };
4598c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(tve_clk, "tve", tve_parents,
4608c2ecf20Sopenharmony_ci				 0x120, 0, 4, 24, 3, BIT(31), 0);
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_cistatic const char * const deinterlace_parents[] = { "pll-periph0", "pll-periph1" };
4638c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(deinterlace_clk, "deinterlace", deinterlace_parents,
4648c2ecf20Sopenharmony_ci				 0x124, 0, 4, 24, 3, BIT(31), 0);
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(csi_misc_clk,	"csi-misc",	"osc24M",
4678c2ecf20Sopenharmony_ci		      0x130, BIT(31), 0);
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_cistatic const char * const csi_sclk_parents[] = { "pll-periph0", "pll-periph1" };
4708c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi_sclk_clk, "csi-sclk", csi_sclk_parents,
4718c2ecf20Sopenharmony_ci				 0x134, 16, 4, 24, 3, BIT(31), 0);
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_cistatic const char * const csi_mclk_parents[] = { "osc24M", "pll-video", "pll-periph1" };
4748c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi_mclk_clk, "csi-mclk", csi_mclk_parents,
4758c2ecf20Sopenharmony_ci				 0x134, 0, 5, 8, 3, BIT(15), 0);
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve",
4788c2ecf20Sopenharmony_ci			     0x13c, 16, 3, BIT(31), CLK_SET_RATE_PARENT);
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ac_dig_clk,	"ac-dig",	"pll-audio",
4818c2ecf20Sopenharmony_ci		      0x140, BIT(31), CLK_SET_RATE_PARENT);
4828c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk,		"avs",		"osc24M",
4838c2ecf20Sopenharmony_ci		      0x144, BIT(31), 0);
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_cistatic const char * const hdmi_parents[] = { "pll-video" };
4868c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", hdmi_parents,
4878c2ecf20Sopenharmony_ci				 0x150, 0, 4, 24, 2, BIT(31),
4888c2ecf20Sopenharmony_ci				 CLK_SET_RATE_PARENT);
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(hdmi_ddc_clk,	"hdmi-ddc",	"osc24M",
4918c2ecf20Sopenharmony_ci		      0x154, BIT(31), 0);
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_cistatic const char * const mbus_parents[] = { "osc24M", "pll-periph0-2x", "pll-ddr" };
4948c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents,
4958c2ecf20Sopenharmony_ci				 0x15c, 0, 3, 24, 2, BIT(31), CLK_IS_CRITICAL);
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(gpu_clk, "gpu", "pll-gpu",
4988c2ecf20Sopenharmony_ci			     0x1a0, 0, 3, BIT(31), CLK_SET_RATE_PARENT);
4998c2ecf20Sopenharmony_ci
5008c2ecf20Sopenharmony_cistatic struct ccu_common *sun8i_h3_ccu_clks[] = {
5018c2ecf20Sopenharmony_ci	&pll_cpux_clk.common,
5028c2ecf20Sopenharmony_ci	&pll_audio_base_clk.common,
5038c2ecf20Sopenharmony_ci	&pll_video_clk.common,
5048c2ecf20Sopenharmony_ci	&pll_ve_clk.common,
5058c2ecf20Sopenharmony_ci	&pll_ddr_clk.common,
5068c2ecf20Sopenharmony_ci	&pll_periph0_clk.common,
5078c2ecf20Sopenharmony_ci	&pll_gpu_clk.common,
5088c2ecf20Sopenharmony_ci	&pll_periph1_clk.common,
5098c2ecf20Sopenharmony_ci	&pll_de_clk.common,
5108c2ecf20Sopenharmony_ci	&cpux_clk.common,
5118c2ecf20Sopenharmony_ci	&axi_clk.common,
5128c2ecf20Sopenharmony_ci	&ahb1_clk.common,
5138c2ecf20Sopenharmony_ci	&apb1_clk.common,
5148c2ecf20Sopenharmony_ci	&apb2_clk.common,
5158c2ecf20Sopenharmony_ci	&ahb2_clk.common,
5168c2ecf20Sopenharmony_ci	&bus_ce_clk.common,
5178c2ecf20Sopenharmony_ci	&bus_dma_clk.common,
5188c2ecf20Sopenharmony_ci	&bus_mmc0_clk.common,
5198c2ecf20Sopenharmony_ci	&bus_mmc1_clk.common,
5208c2ecf20Sopenharmony_ci	&bus_mmc2_clk.common,
5218c2ecf20Sopenharmony_ci	&bus_nand_clk.common,
5228c2ecf20Sopenharmony_ci	&bus_dram_clk.common,
5238c2ecf20Sopenharmony_ci	&bus_emac_clk.common,
5248c2ecf20Sopenharmony_ci	&bus_ts_clk.common,
5258c2ecf20Sopenharmony_ci	&bus_hstimer_clk.common,
5268c2ecf20Sopenharmony_ci	&bus_spi0_clk.common,
5278c2ecf20Sopenharmony_ci	&bus_spi1_clk.common,
5288c2ecf20Sopenharmony_ci	&bus_otg_clk.common,
5298c2ecf20Sopenharmony_ci	&bus_ehci0_clk.common,
5308c2ecf20Sopenharmony_ci	&bus_ehci1_clk.common,
5318c2ecf20Sopenharmony_ci	&bus_ehci2_clk.common,
5328c2ecf20Sopenharmony_ci	&bus_ehci3_clk.common,
5338c2ecf20Sopenharmony_ci	&bus_ohci0_clk.common,
5348c2ecf20Sopenharmony_ci	&bus_ohci1_clk.common,
5358c2ecf20Sopenharmony_ci	&bus_ohci2_clk.common,
5368c2ecf20Sopenharmony_ci	&bus_ohci3_clk.common,
5378c2ecf20Sopenharmony_ci	&bus_ve_clk.common,
5388c2ecf20Sopenharmony_ci	&bus_tcon0_clk.common,
5398c2ecf20Sopenharmony_ci	&bus_tcon1_clk.common,
5408c2ecf20Sopenharmony_ci	&bus_deinterlace_clk.common,
5418c2ecf20Sopenharmony_ci	&bus_csi_clk.common,
5428c2ecf20Sopenharmony_ci	&bus_tve_clk.common,
5438c2ecf20Sopenharmony_ci	&bus_hdmi_clk.common,
5448c2ecf20Sopenharmony_ci	&bus_de_clk.common,
5458c2ecf20Sopenharmony_ci	&bus_gpu_clk.common,
5468c2ecf20Sopenharmony_ci	&bus_msgbox_clk.common,
5478c2ecf20Sopenharmony_ci	&bus_spinlock_clk.common,
5488c2ecf20Sopenharmony_ci	&bus_codec_clk.common,
5498c2ecf20Sopenharmony_ci	&bus_spdif_clk.common,
5508c2ecf20Sopenharmony_ci	&bus_pio_clk.common,
5518c2ecf20Sopenharmony_ci	&bus_ths_clk.common,
5528c2ecf20Sopenharmony_ci	&bus_i2s0_clk.common,
5538c2ecf20Sopenharmony_ci	&bus_i2s1_clk.common,
5548c2ecf20Sopenharmony_ci	&bus_i2s2_clk.common,
5558c2ecf20Sopenharmony_ci	&bus_i2c0_clk.common,
5568c2ecf20Sopenharmony_ci	&bus_i2c1_clk.common,
5578c2ecf20Sopenharmony_ci	&bus_i2c2_clk.common,
5588c2ecf20Sopenharmony_ci	&bus_uart0_clk.common,
5598c2ecf20Sopenharmony_ci	&bus_uart1_clk.common,
5608c2ecf20Sopenharmony_ci	&bus_uart2_clk.common,
5618c2ecf20Sopenharmony_ci	&bus_uart3_clk.common,
5628c2ecf20Sopenharmony_ci	&bus_scr0_clk.common,
5638c2ecf20Sopenharmony_ci	&bus_ephy_clk.common,
5648c2ecf20Sopenharmony_ci	&bus_dbg_clk.common,
5658c2ecf20Sopenharmony_ci	&ths_clk.common,
5668c2ecf20Sopenharmony_ci	&nand_clk.common,
5678c2ecf20Sopenharmony_ci	&mmc0_clk.common,
5688c2ecf20Sopenharmony_ci	&mmc0_sample_clk.common,
5698c2ecf20Sopenharmony_ci	&mmc0_output_clk.common,
5708c2ecf20Sopenharmony_ci	&mmc1_clk.common,
5718c2ecf20Sopenharmony_ci	&mmc1_sample_clk.common,
5728c2ecf20Sopenharmony_ci	&mmc1_output_clk.common,
5738c2ecf20Sopenharmony_ci	&mmc2_clk.common,
5748c2ecf20Sopenharmony_ci	&mmc2_sample_clk.common,
5758c2ecf20Sopenharmony_ci	&mmc2_output_clk.common,
5768c2ecf20Sopenharmony_ci	&ts_clk.common,
5778c2ecf20Sopenharmony_ci	&ce_clk.common,
5788c2ecf20Sopenharmony_ci	&spi0_clk.common,
5798c2ecf20Sopenharmony_ci	&spi1_clk.common,
5808c2ecf20Sopenharmony_ci	&i2s0_clk.common,
5818c2ecf20Sopenharmony_ci	&i2s1_clk.common,
5828c2ecf20Sopenharmony_ci	&i2s2_clk.common,
5838c2ecf20Sopenharmony_ci	&spdif_clk.common,
5848c2ecf20Sopenharmony_ci	&usb_phy0_clk.common,
5858c2ecf20Sopenharmony_ci	&usb_phy1_clk.common,
5868c2ecf20Sopenharmony_ci	&usb_phy2_clk.common,
5878c2ecf20Sopenharmony_ci	&usb_phy3_clk.common,
5888c2ecf20Sopenharmony_ci	&usb_ohci0_clk.common,
5898c2ecf20Sopenharmony_ci	&usb_ohci1_clk.common,
5908c2ecf20Sopenharmony_ci	&usb_ohci2_clk.common,
5918c2ecf20Sopenharmony_ci	&usb_ohci3_clk.common,
5928c2ecf20Sopenharmony_ci	&dram_clk.common,
5938c2ecf20Sopenharmony_ci	&dram_ve_clk.common,
5948c2ecf20Sopenharmony_ci	&dram_csi_clk.common,
5958c2ecf20Sopenharmony_ci	&dram_deinterlace_clk.common,
5968c2ecf20Sopenharmony_ci	&dram_ts_clk.common,
5978c2ecf20Sopenharmony_ci	&de_clk.common,
5988c2ecf20Sopenharmony_ci	&tcon_clk.common,
5998c2ecf20Sopenharmony_ci	&tve_clk.common,
6008c2ecf20Sopenharmony_ci	&deinterlace_clk.common,
6018c2ecf20Sopenharmony_ci	&csi_misc_clk.common,
6028c2ecf20Sopenharmony_ci	&csi_sclk_clk.common,
6038c2ecf20Sopenharmony_ci	&csi_mclk_clk.common,
6048c2ecf20Sopenharmony_ci	&ve_clk.common,
6058c2ecf20Sopenharmony_ci	&ac_dig_clk.common,
6068c2ecf20Sopenharmony_ci	&avs_clk.common,
6078c2ecf20Sopenharmony_ci	&hdmi_clk.common,
6088c2ecf20Sopenharmony_ci	&hdmi_ddc_clk.common,
6098c2ecf20Sopenharmony_ci	&mbus_clk.common,
6108c2ecf20Sopenharmony_ci	&gpu_clk.common,
6118c2ecf20Sopenharmony_ci};
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_cistatic struct ccu_common *sun50i_h5_ccu_clks[] = {
6148c2ecf20Sopenharmony_ci	&pll_cpux_clk.common,
6158c2ecf20Sopenharmony_ci	&pll_audio_base_clk.common,
6168c2ecf20Sopenharmony_ci	&pll_video_clk.common,
6178c2ecf20Sopenharmony_ci	&pll_ve_clk.common,
6188c2ecf20Sopenharmony_ci	&pll_ddr_clk.common,
6198c2ecf20Sopenharmony_ci	&pll_periph0_clk.common,
6208c2ecf20Sopenharmony_ci	&pll_gpu_clk.common,
6218c2ecf20Sopenharmony_ci	&pll_periph1_clk.common,
6228c2ecf20Sopenharmony_ci	&pll_de_clk.common,
6238c2ecf20Sopenharmony_ci	&cpux_clk.common,
6248c2ecf20Sopenharmony_ci	&axi_clk.common,
6258c2ecf20Sopenharmony_ci	&ahb1_clk.common,
6268c2ecf20Sopenharmony_ci	&apb1_clk.common,
6278c2ecf20Sopenharmony_ci	&apb2_clk.common,
6288c2ecf20Sopenharmony_ci	&ahb2_clk.common,
6298c2ecf20Sopenharmony_ci	&bus_ce_clk.common,
6308c2ecf20Sopenharmony_ci	&bus_dma_clk.common,
6318c2ecf20Sopenharmony_ci	&bus_mmc0_clk.common,
6328c2ecf20Sopenharmony_ci	&bus_mmc1_clk.common,
6338c2ecf20Sopenharmony_ci	&bus_mmc2_clk.common,
6348c2ecf20Sopenharmony_ci	&bus_nand_clk.common,
6358c2ecf20Sopenharmony_ci	&bus_dram_clk.common,
6368c2ecf20Sopenharmony_ci	&bus_emac_clk.common,
6378c2ecf20Sopenharmony_ci	&bus_ts_clk.common,
6388c2ecf20Sopenharmony_ci	&bus_hstimer_clk.common,
6398c2ecf20Sopenharmony_ci	&bus_spi0_clk.common,
6408c2ecf20Sopenharmony_ci	&bus_spi1_clk.common,
6418c2ecf20Sopenharmony_ci	&bus_otg_clk.common,
6428c2ecf20Sopenharmony_ci	&bus_ehci0_clk.common,
6438c2ecf20Sopenharmony_ci	&bus_ehci1_clk.common,
6448c2ecf20Sopenharmony_ci	&bus_ehci2_clk.common,
6458c2ecf20Sopenharmony_ci	&bus_ehci3_clk.common,
6468c2ecf20Sopenharmony_ci	&bus_ohci0_clk.common,
6478c2ecf20Sopenharmony_ci	&bus_ohci1_clk.common,
6488c2ecf20Sopenharmony_ci	&bus_ohci2_clk.common,
6498c2ecf20Sopenharmony_ci	&bus_ohci3_clk.common,
6508c2ecf20Sopenharmony_ci	&bus_ve_clk.common,
6518c2ecf20Sopenharmony_ci	&bus_tcon0_clk.common,
6528c2ecf20Sopenharmony_ci	&bus_tcon1_clk.common,
6538c2ecf20Sopenharmony_ci	&bus_deinterlace_clk.common,
6548c2ecf20Sopenharmony_ci	&bus_csi_clk.common,
6558c2ecf20Sopenharmony_ci	&bus_tve_clk.common,
6568c2ecf20Sopenharmony_ci	&bus_hdmi_clk.common,
6578c2ecf20Sopenharmony_ci	&bus_de_clk.common,
6588c2ecf20Sopenharmony_ci	&bus_gpu_clk.common,
6598c2ecf20Sopenharmony_ci	&bus_msgbox_clk.common,
6608c2ecf20Sopenharmony_ci	&bus_spinlock_clk.common,
6618c2ecf20Sopenharmony_ci	&bus_codec_clk.common,
6628c2ecf20Sopenharmony_ci	&bus_spdif_clk.common,
6638c2ecf20Sopenharmony_ci	&bus_pio_clk.common,
6648c2ecf20Sopenharmony_ci	&bus_ths_clk.common,
6658c2ecf20Sopenharmony_ci	&bus_i2s0_clk.common,
6668c2ecf20Sopenharmony_ci	&bus_i2s1_clk.common,
6678c2ecf20Sopenharmony_ci	&bus_i2s2_clk.common,
6688c2ecf20Sopenharmony_ci	&bus_i2c0_clk.common,
6698c2ecf20Sopenharmony_ci	&bus_i2c1_clk.common,
6708c2ecf20Sopenharmony_ci	&bus_i2c2_clk.common,
6718c2ecf20Sopenharmony_ci	&bus_uart0_clk.common,
6728c2ecf20Sopenharmony_ci	&bus_uart1_clk.common,
6738c2ecf20Sopenharmony_ci	&bus_uart2_clk.common,
6748c2ecf20Sopenharmony_ci	&bus_uart3_clk.common,
6758c2ecf20Sopenharmony_ci	&bus_scr0_clk.common,
6768c2ecf20Sopenharmony_ci	&bus_scr1_clk.common,
6778c2ecf20Sopenharmony_ci	&bus_ephy_clk.common,
6788c2ecf20Sopenharmony_ci	&bus_dbg_clk.common,
6798c2ecf20Sopenharmony_ci	&ths_clk.common,
6808c2ecf20Sopenharmony_ci	&nand_clk.common,
6818c2ecf20Sopenharmony_ci	&mmc0_clk.common,
6828c2ecf20Sopenharmony_ci	&mmc1_clk.common,
6838c2ecf20Sopenharmony_ci	&mmc2_clk.common,
6848c2ecf20Sopenharmony_ci	&ts_clk.common,
6858c2ecf20Sopenharmony_ci	&ce_clk.common,
6868c2ecf20Sopenharmony_ci	&spi0_clk.common,
6878c2ecf20Sopenharmony_ci	&spi1_clk.common,
6888c2ecf20Sopenharmony_ci	&i2s0_clk.common,
6898c2ecf20Sopenharmony_ci	&i2s1_clk.common,
6908c2ecf20Sopenharmony_ci	&i2s2_clk.common,
6918c2ecf20Sopenharmony_ci	&spdif_clk.common,
6928c2ecf20Sopenharmony_ci	&usb_phy0_clk.common,
6938c2ecf20Sopenharmony_ci	&usb_phy1_clk.common,
6948c2ecf20Sopenharmony_ci	&usb_phy2_clk.common,
6958c2ecf20Sopenharmony_ci	&usb_phy3_clk.common,
6968c2ecf20Sopenharmony_ci	&usb_ohci0_clk.common,
6978c2ecf20Sopenharmony_ci	&usb_ohci1_clk.common,
6988c2ecf20Sopenharmony_ci	&usb_ohci2_clk.common,
6998c2ecf20Sopenharmony_ci	&usb_ohci3_clk.common,
7008c2ecf20Sopenharmony_ci	&dram_clk.common,
7018c2ecf20Sopenharmony_ci	&dram_ve_clk.common,
7028c2ecf20Sopenharmony_ci	&dram_csi_clk.common,
7038c2ecf20Sopenharmony_ci	&dram_deinterlace_clk.common,
7048c2ecf20Sopenharmony_ci	&dram_ts_clk.common,
7058c2ecf20Sopenharmony_ci	&de_clk.common,
7068c2ecf20Sopenharmony_ci	&tcon_clk.common,
7078c2ecf20Sopenharmony_ci	&tve_clk.common,
7088c2ecf20Sopenharmony_ci	&deinterlace_clk.common,
7098c2ecf20Sopenharmony_ci	&csi_misc_clk.common,
7108c2ecf20Sopenharmony_ci	&csi_sclk_clk.common,
7118c2ecf20Sopenharmony_ci	&csi_mclk_clk.common,
7128c2ecf20Sopenharmony_ci	&ve_clk.common,
7138c2ecf20Sopenharmony_ci	&ac_dig_clk.common,
7148c2ecf20Sopenharmony_ci	&avs_clk.common,
7158c2ecf20Sopenharmony_ci	&hdmi_clk.common,
7168c2ecf20Sopenharmony_ci	&hdmi_ddc_clk.common,
7178c2ecf20Sopenharmony_ci	&mbus_clk.common,
7188c2ecf20Sopenharmony_ci	&gpu_clk.common,
7198c2ecf20Sopenharmony_ci};
7208c2ecf20Sopenharmony_ci
7218c2ecf20Sopenharmony_cistatic const struct clk_hw *clk_parent_pll_audio[] = {
7228c2ecf20Sopenharmony_ci	&pll_audio_base_clk.common.hw
7238c2ecf20Sopenharmony_ci};
7248c2ecf20Sopenharmony_ci
7258c2ecf20Sopenharmony_ci/* We hardcode the divider to 1 for now */
7268c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio",
7278c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
7288c2ecf20Sopenharmony_ci			    1, 1, CLK_SET_RATE_PARENT);
7298c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x",
7308c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
7318c2ecf20Sopenharmony_ci			    2, 1, CLK_SET_RATE_PARENT);
7328c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x",
7338c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
7348c2ecf20Sopenharmony_ci			    1, 1, CLK_SET_RATE_PARENT);
7358c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x",
7368c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
7378c2ecf20Sopenharmony_ci			    1, 2, CLK_SET_RATE_PARENT);
7388c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_periph0_2x_clk, "pll-periph0-2x",
7398c2ecf20Sopenharmony_ci			   &pll_periph0_clk.common.hw,
7408c2ecf20Sopenharmony_ci			   1, 2, 0);
7418c2ecf20Sopenharmony_ci
7428c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun8i_h3_hw_clks = {
7438c2ecf20Sopenharmony_ci	.hws	= {
7448c2ecf20Sopenharmony_ci		[CLK_PLL_CPUX]		= &pll_cpux_clk.common.hw,
7458c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_BASE]	= &pll_audio_base_clk.common.hw,
7468c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO]		= &pll_audio_clk.hw,
7478c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_2X]	= &pll_audio_2x_clk.hw,
7488c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_4X]	= &pll_audio_4x_clk.hw,
7498c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_8X]	= &pll_audio_8x_clk.hw,
7508c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO]		= &pll_video_clk.common.hw,
7518c2ecf20Sopenharmony_ci		[CLK_PLL_VE]		= &pll_ve_clk.common.hw,
7528c2ecf20Sopenharmony_ci		[CLK_PLL_DDR]		= &pll_ddr_clk.common.hw,
7538c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH0]	= &pll_periph0_clk.common.hw,
7548c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH0_2X]	= &pll_periph0_2x_clk.hw,
7558c2ecf20Sopenharmony_ci		[CLK_PLL_GPU]		= &pll_gpu_clk.common.hw,
7568c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH1]	= &pll_periph1_clk.common.hw,
7578c2ecf20Sopenharmony_ci		[CLK_PLL_DE]		= &pll_de_clk.common.hw,
7588c2ecf20Sopenharmony_ci		[CLK_CPUX]		= &cpux_clk.common.hw,
7598c2ecf20Sopenharmony_ci		[CLK_AXI]		= &axi_clk.common.hw,
7608c2ecf20Sopenharmony_ci		[CLK_AHB1]		= &ahb1_clk.common.hw,
7618c2ecf20Sopenharmony_ci		[CLK_APB1]		= &apb1_clk.common.hw,
7628c2ecf20Sopenharmony_ci		[CLK_APB2]		= &apb2_clk.common.hw,
7638c2ecf20Sopenharmony_ci		[CLK_AHB2]		= &ahb2_clk.common.hw,
7648c2ecf20Sopenharmony_ci		[CLK_BUS_CE]		= &bus_ce_clk.common.hw,
7658c2ecf20Sopenharmony_ci		[CLK_BUS_DMA]		= &bus_dma_clk.common.hw,
7668c2ecf20Sopenharmony_ci		[CLK_BUS_MMC0]		= &bus_mmc0_clk.common.hw,
7678c2ecf20Sopenharmony_ci		[CLK_BUS_MMC1]		= &bus_mmc1_clk.common.hw,
7688c2ecf20Sopenharmony_ci		[CLK_BUS_MMC2]		= &bus_mmc2_clk.common.hw,
7698c2ecf20Sopenharmony_ci		[CLK_BUS_NAND]		= &bus_nand_clk.common.hw,
7708c2ecf20Sopenharmony_ci		[CLK_BUS_DRAM]		= &bus_dram_clk.common.hw,
7718c2ecf20Sopenharmony_ci		[CLK_BUS_EMAC]		= &bus_emac_clk.common.hw,
7728c2ecf20Sopenharmony_ci		[CLK_BUS_TS]		= &bus_ts_clk.common.hw,
7738c2ecf20Sopenharmony_ci		[CLK_BUS_HSTIMER]	= &bus_hstimer_clk.common.hw,
7748c2ecf20Sopenharmony_ci		[CLK_BUS_SPI0]		= &bus_spi0_clk.common.hw,
7758c2ecf20Sopenharmony_ci		[CLK_BUS_SPI1]		= &bus_spi1_clk.common.hw,
7768c2ecf20Sopenharmony_ci		[CLK_BUS_OTG]		= &bus_otg_clk.common.hw,
7778c2ecf20Sopenharmony_ci		[CLK_BUS_EHCI0]		= &bus_ehci0_clk.common.hw,
7788c2ecf20Sopenharmony_ci		[CLK_BUS_EHCI1]		= &bus_ehci1_clk.common.hw,
7798c2ecf20Sopenharmony_ci		[CLK_BUS_EHCI2]		= &bus_ehci2_clk.common.hw,
7808c2ecf20Sopenharmony_ci		[CLK_BUS_EHCI3]		= &bus_ehci3_clk.common.hw,
7818c2ecf20Sopenharmony_ci		[CLK_BUS_OHCI0]		= &bus_ohci0_clk.common.hw,
7828c2ecf20Sopenharmony_ci		[CLK_BUS_OHCI1]		= &bus_ohci1_clk.common.hw,
7838c2ecf20Sopenharmony_ci		[CLK_BUS_OHCI2]		= &bus_ohci2_clk.common.hw,
7848c2ecf20Sopenharmony_ci		[CLK_BUS_OHCI3]		= &bus_ohci3_clk.common.hw,
7858c2ecf20Sopenharmony_ci		[CLK_BUS_VE]		= &bus_ve_clk.common.hw,
7868c2ecf20Sopenharmony_ci		[CLK_BUS_TCON0]		= &bus_tcon0_clk.common.hw,
7878c2ecf20Sopenharmony_ci		[CLK_BUS_TCON1]		= &bus_tcon1_clk.common.hw,
7888c2ecf20Sopenharmony_ci		[CLK_BUS_DEINTERLACE]	= &bus_deinterlace_clk.common.hw,
7898c2ecf20Sopenharmony_ci		[CLK_BUS_CSI]		= &bus_csi_clk.common.hw,
7908c2ecf20Sopenharmony_ci		[CLK_BUS_TVE]		= &bus_tve_clk.common.hw,
7918c2ecf20Sopenharmony_ci		[CLK_BUS_HDMI]		= &bus_hdmi_clk.common.hw,
7928c2ecf20Sopenharmony_ci		[CLK_BUS_DE]		= &bus_de_clk.common.hw,
7938c2ecf20Sopenharmony_ci		[CLK_BUS_GPU]		= &bus_gpu_clk.common.hw,
7948c2ecf20Sopenharmony_ci		[CLK_BUS_MSGBOX]	= &bus_msgbox_clk.common.hw,
7958c2ecf20Sopenharmony_ci		[CLK_BUS_SPINLOCK]	= &bus_spinlock_clk.common.hw,
7968c2ecf20Sopenharmony_ci		[CLK_BUS_CODEC]		= &bus_codec_clk.common.hw,
7978c2ecf20Sopenharmony_ci		[CLK_BUS_SPDIF]		= &bus_spdif_clk.common.hw,
7988c2ecf20Sopenharmony_ci		[CLK_BUS_PIO]		= &bus_pio_clk.common.hw,
7998c2ecf20Sopenharmony_ci		[CLK_BUS_THS]		= &bus_ths_clk.common.hw,
8008c2ecf20Sopenharmony_ci		[CLK_BUS_I2S0]		= &bus_i2s0_clk.common.hw,
8018c2ecf20Sopenharmony_ci		[CLK_BUS_I2S1]		= &bus_i2s1_clk.common.hw,
8028c2ecf20Sopenharmony_ci		[CLK_BUS_I2S2]		= &bus_i2s2_clk.common.hw,
8038c2ecf20Sopenharmony_ci		[CLK_BUS_I2C0]		= &bus_i2c0_clk.common.hw,
8048c2ecf20Sopenharmony_ci		[CLK_BUS_I2C1]		= &bus_i2c1_clk.common.hw,
8058c2ecf20Sopenharmony_ci		[CLK_BUS_I2C2]		= &bus_i2c2_clk.common.hw,
8068c2ecf20Sopenharmony_ci		[CLK_BUS_UART0]		= &bus_uart0_clk.common.hw,
8078c2ecf20Sopenharmony_ci		[CLK_BUS_UART1]		= &bus_uart1_clk.common.hw,
8088c2ecf20Sopenharmony_ci		[CLK_BUS_UART2]		= &bus_uart2_clk.common.hw,
8098c2ecf20Sopenharmony_ci		[CLK_BUS_UART3]		= &bus_uart3_clk.common.hw,
8108c2ecf20Sopenharmony_ci		[CLK_BUS_SCR0]		= &bus_scr0_clk.common.hw,
8118c2ecf20Sopenharmony_ci		[CLK_BUS_EPHY]		= &bus_ephy_clk.common.hw,
8128c2ecf20Sopenharmony_ci		[CLK_BUS_DBG]		= &bus_dbg_clk.common.hw,
8138c2ecf20Sopenharmony_ci		[CLK_THS]		= &ths_clk.common.hw,
8148c2ecf20Sopenharmony_ci		[CLK_NAND]		= &nand_clk.common.hw,
8158c2ecf20Sopenharmony_ci		[CLK_MMC0]		= &mmc0_clk.common.hw,
8168c2ecf20Sopenharmony_ci		[CLK_MMC0_SAMPLE]	= &mmc0_sample_clk.common.hw,
8178c2ecf20Sopenharmony_ci		[CLK_MMC0_OUTPUT]	= &mmc0_output_clk.common.hw,
8188c2ecf20Sopenharmony_ci		[CLK_MMC1]		= &mmc1_clk.common.hw,
8198c2ecf20Sopenharmony_ci		[CLK_MMC1_SAMPLE]	= &mmc1_sample_clk.common.hw,
8208c2ecf20Sopenharmony_ci		[CLK_MMC1_OUTPUT]	= &mmc1_output_clk.common.hw,
8218c2ecf20Sopenharmony_ci		[CLK_MMC2]		= &mmc2_clk.common.hw,
8228c2ecf20Sopenharmony_ci		[CLK_MMC2_SAMPLE]	= &mmc2_sample_clk.common.hw,
8238c2ecf20Sopenharmony_ci		[CLK_MMC2_OUTPUT]	= &mmc2_output_clk.common.hw,
8248c2ecf20Sopenharmony_ci		[CLK_TS]		= &ts_clk.common.hw,
8258c2ecf20Sopenharmony_ci		[CLK_CE]		= &ce_clk.common.hw,
8268c2ecf20Sopenharmony_ci		[CLK_SPI0]		= &spi0_clk.common.hw,
8278c2ecf20Sopenharmony_ci		[CLK_SPI1]		= &spi1_clk.common.hw,
8288c2ecf20Sopenharmony_ci		[CLK_I2S0]		= &i2s0_clk.common.hw,
8298c2ecf20Sopenharmony_ci		[CLK_I2S1]		= &i2s1_clk.common.hw,
8308c2ecf20Sopenharmony_ci		[CLK_I2S2]		= &i2s2_clk.common.hw,
8318c2ecf20Sopenharmony_ci		[CLK_SPDIF]		= &spdif_clk.common.hw,
8328c2ecf20Sopenharmony_ci		[CLK_USB_PHY0]		= &usb_phy0_clk.common.hw,
8338c2ecf20Sopenharmony_ci		[CLK_USB_PHY1]		= &usb_phy1_clk.common.hw,
8348c2ecf20Sopenharmony_ci		[CLK_USB_PHY2]		= &usb_phy2_clk.common.hw,
8358c2ecf20Sopenharmony_ci		[CLK_USB_PHY3]		= &usb_phy3_clk.common.hw,
8368c2ecf20Sopenharmony_ci		[CLK_USB_OHCI0]		= &usb_ohci0_clk.common.hw,
8378c2ecf20Sopenharmony_ci		[CLK_USB_OHCI1]		= &usb_ohci1_clk.common.hw,
8388c2ecf20Sopenharmony_ci		[CLK_USB_OHCI2]		= &usb_ohci2_clk.common.hw,
8398c2ecf20Sopenharmony_ci		[CLK_USB_OHCI3]		= &usb_ohci3_clk.common.hw,
8408c2ecf20Sopenharmony_ci		[CLK_DRAM]		= &dram_clk.common.hw,
8418c2ecf20Sopenharmony_ci		[CLK_DRAM_VE]		= &dram_ve_clk.common.hw,
8428c2ecf20Sopenharmony_ci		[CLK_DRAM_CSI]		= &dram_csi_clk.common.hw,
8438c2ecf20Sopenharmony_ci		[CLK_DRAM_DEINTERLACE]	= &dram_deinterlace_clk.common.hw,
8448c2ecf20Sopenharmony_ci		[CLK_DRAM_TS]		= &dram_ts_clk.common.hw,
8458c2ecf20Sopenharmony_ci		[CLK_DE]		= &de_clk.common.hw,
8468c2ecf20Sopenharmony_ci		[CLK_TCON0]		= &tcon_clk.common.hw,
8478c2ecf20Sopenharmony_ci		[CLK_TVE]		= &tve_clk.common.hw,
8488c2ecf20Sopenharmony_ci		[CLK_DEINTERLACE]	= &deinterlace_clk.common.hw,
8498c2ecf20Sopenharmony_ci		[CLK_CSI_MISC]		= &csi_misc_clk.common.hw,
8508c2ecf20Sopenharmony_ci		[CLK_CSI_SCLK]		= &csi_sclk_clk.common.hw,
8518c2ecf20Sopenharmony_ci		[CLK_CSI_MCLK]		= &csi_mclk_clk.common.hw,
8528c2ecf20Sopenharmony_ci		[CLK_VE]		= &ve_clk.common.hw,
8538c2ecf20Sopenharmony_ci		[CLK_AC_DIG]		= &ac_dig_clk.common.hw,
8548c2ecf20Sopenharmony_ci		[CLK_AVS]		= &avs_clk.common.hw,
8558c2ecf20Sopenharmony_ci		[CLK_HDMI]		= &hdmi_clk.common.hw,
8568c2ecf20Sopenharmony_ci		[CLK_HDMI_DDC]		= &hdmi_ddc_clk.common.hw,
8578c2ecf20Sopenharmony_ci		[CLK_MBUS]		= &mbus_clk.common.hw,
8588c2ecf20Sopenharmony_ci		[CLK_GPU]		= &gpu_clk.common.hw,
8598c2ecf20Sopenharmony_ci	},
8608c2ecf20Sopenharmony_ci	.num	= CLK_NUMBER_H3,
8618c2ecf20Sopenharmony_ci};
8628c2ecf20Sopenharmony_ci
8638c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun50i_h5_hw_clks = {
8648c2ecf20Sopenharmony_ci	.hws	= {
8658c2ecf20Sopenharmony_ci		[CLK_PLL_CPUX]		= &pll_cpux_clk.common.hw,
8668c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_BASE]	= &pll_audio_base_clk.common.hw,
8678c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO]		= &pll_audio_clk.hw,
8688c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_2X]	= &pll_audio_2x_clk.hw,
8698c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_4X]	= &pll_audio_4x_clk.hw,
8708c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_8X]	= &pll_audio_8x_clk.hw,
8718c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO]		= &pll_video_clk.common.hw,
8728c2ecf20Sopenharmony_ci		[CLK_PLL_VE]		= &pll_ve_clk.common.hw,
8738c2ecf20Sopenharmony_ci		[CLK_PLL_DDR]		= &pll_ddr_clk.common.hw,
8748c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH0]	= &pll_periph0_clk.common.hw,
8758c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH0_2X]	= &pll_periph0_2x_clk.hw,
8768c2ecf20Sopenharmony_ci		[CLK_PLL_GPU]		= &pll_gpu_clk.common.hw,
8778c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH1]	= &pll_periph1_clk.common.hw,
8788c2ecf20Sopenharmony_ci		[CLK_PLL_DE]		= &pll_de_clk.common.hw,
8798c2ecf20Sopenharmony_ci		[CLK_CPUX]		= &cpux_clk.common.hw,
8808c2ecf20Sopenharmony_ci		[CLK_AXI]		= &axi_clk.common.hw,
8818c2ecf20Sopenharmony_ci		[CLK_AHB1]		= &ahb1_clk.common.hw,
8828c2ecf20Sopenharmony_ci		[CLK_APB1]		= &apb1_clk.common.hw,
8838c2ecf20Sopenharmony_ci		[CLK_APB2]		= &apb2_clk.common.hw,
8848c2ecf20Sopenharmony_ci		[CLK_AHB2]		= &ahb2_clk.common.hw,
8858c2ecf20Sopenharmony_ci		[CLK_BUS_CE]		= &bus_ce_clk.common.hw,
8868c2ecf20Sopenharmony_ci		[CLK_BUS_DMA]		= &bus_dma_clk.common.hw,
8878c2ecf20Sopenharmony_ci		[CLK_BUS_MMC0]		= &bus_mmc0_clk.common.hw,
8888c2ecf20Sopenharmony_ci		[CLK_BUS_MMC1]		= &bus_mmc1_clk.common.hw,
8898c2ecf20Sopenharmony_ci		[CLK_BUS_MMC2]		= &bus_mmc2_clk.common.hw,
8908c2ecf20Sopenharmony_ci		[CLK_BUS_NAND]		= &bus_nand_clk.common.hw,
8918c2ecf20Sopenharmony_ci		[CLK_BUS_DRAM]		= &bus_dram_clk.common.hw,
8928c2ecf20Sopenharmony_ci		[CLK_BUS_EMAC]		= &bus_emac_clk.common.hw,
8938c2ecf20Sopenharmony_ci		[CLK_BUS_TS]		= &bus_ts_clk.common.hw,
8948c2ecf20Sopenharmony_ci		[CLK_BUS_HSTIMER]	= &bus_hstimer_clk.common.hw,
8958c2ecf20Sopenharmony_ci		[CLK_BUS_SPI0]		= &bus_spi0_clk.common.hw,
8968c2ecf20Sopenharmony_ci		[CLK_BUS_SPI1]		= &bus_spi1_clk.common.hw,
8978c2ecf20Sopenharmony_ci		[CLK_BUS_OTG]		= &bus_otg_clk.common.hw,
8988c2ecf20Sopenharmony_ci		[CLK_BUS_EHCI0]		= &bus_ehci0_clk.common.hw,
8998c2ecf20Sopenharmony_ci		[CLK_BUS_EHCI1]		= &bus_ehci1_clk.common.hw,
9008c2ecf20Sopenharmony_ci		[CLK_BUS_EHCI2]		= &bus_ehci2_clk.common.hw,
9018c2ecf20Sopenharmony_ci		[CLK_BUS_EHCI3]		= &bus_ehci3_clk.common.hw,
9028c2ecf20Sopenharmony_ci		[CLK_BUS_OHCI0]		= &bus_ohci0_clk.common.hw,
9038c2ecf20Sopenharmony_ci		[CLK_BUS_OHCI1]		= &bus_ohci1_clk.common.hw,
9048c2ecf20Sopenharmony_ci		[CLK_BUS_OHCI2]		= &bus_ohci2_clk.common.hw,
9058c2ecf20Sopenharmony_ci		[CLK_BUS_OHCI3]		= &bus_ohci3_clk.common.hw,
9068c2ecf20Sopenharmony_ci		[CLK_BUS_VE]		= &bus_ve_clk.common.hw,
9078c2ecf20Sopenharmony_ci		[CLK_BUS_TCON0]		= &bus_tcon0_clk.common.hw,
9088c2ecf20Sopenharmony_ci		[CLK_BUS_TCON1]		= &bus_tcon1_clk.common.hw,
9098c2ecf20Sopenharmony_ci		[CLK_BUS_DEINTERLACE]	= &bus_deinterlace_clk.common.hw,
9108c2ecf20Sopenharmony_ci		[CLK_BUS_CSI]		= &bus_csi_clk.common.hw,
9118c2ecf20Sopenharmony_ci		[CLK_BUS_TVE]		= &bus_tve_clk.common.hw,
9128c2ecf20Sopenharmony_ci		[CLK_BUS_HDMI]		= &bus_hdmi_clk.common.hw,
9138c2ecf20Sopenharmony_ci		[CLK_BUS_DE]		= &bus_de_clk.common.hw,
9148c2ecf20Sopenharmony_ci		[CLK_BUS_GPU]		= &bus_gpu_clk.common.hw,
9158c2ecf20Sopenharmony_ci		[CLK_BUS_MSGBOX]	= &bus_msgbox_clk.common.hw,
9168c2ecf20Sopenharmony_ci		[CLK_BUS_SPINLOCK]	= &bus_spinlock_clk.common.hw,
9178c2ecf20Sopenharmony_ci		[CLK_BUS_CODEC]		= &bus_codec_clk.common.hw,
9188c2ecf20Sopenharmony_ci		[CLK_BUS_SPDIF]		= &bus_spdif_clk.common.hw,
9198c2ecf20Sopenharmony_ci		[CLK_BUS_PIO]		= &bus_pio_clk.common.hw,
9208c2ecf20Sopenharmony_ci		[CLK_BUS_THS]		= &bus_ths_clk.common.hw,
9218c2ecf20Sopenharmony_ci		[CLK_BUS_I2S0]		= &bus_i2s0_clk.common.hw,
9228c2ecf20Sopenharmony_ci		[CLK_BUS_I2S1]		= &bus_i2s1_clk.common.hw,
9238c2ecf20Sopenharmony_ci		[CLK_BUS_I2S2]		= &bus_i2s2_clk.common.hw,
9248c2ecf20Sopenharmony_ci		[CLK_BUS_I2C0]		= &bus_i2c0_clk.common.hw,
9258c2ecf20Sopenharmony_ci		[CLK_BUS_I2C1]		= &bus_i2c1_clk.common.hw,
9268c2ecf20Sopenharmony_ci		[CLK_BUS_I2C2]		= &bus_i2c2_clk.common.hw,
9278c2ecf20Sopenharmony_ci		[CLK_BUS_UART0]		= &bus_uart0_clk.common.hw,
9288c2ecf20Sopenharmony_ci		[CLK_BUS_UART1]		= &bus_uart1_clk.common.hw,
9298c2ecf20Sopenharmony_ci		[CLK_BUS_UART2]		= &bus_uart2_clk.common.hw,
9308c2ecf20Sopenharmony_ci		[CLK_BUS_UART3]		= &bus_uart3_clk.common.hw,
9318c2ecf20Sopenharmony_ci		[CLK_BUS_SCR0]		= &bus_scr0_clk.common.hw,
9328c2ecf20Sopenharmony_ci		[CLK_BUS_SCR1]		= &bus_scr1_clk.common.hw,
9338c2ecf20Sopenharmony_ci		[CLK_BUS_EPHY]		= &bus_ephy_clk.common.hw,
9348c2ecf20Sopenharmony_ci		[CLK_BUS_DBG]		= &bus_dbg_clk.common.hw,
9358c2ecf20Sopenharmony_ci		[CLK_THS]		= &ths_clk.common.hw,
9368c2ecf20Sopenharmony_ci		[CLK_NAND]		= &nand_clk.common.hw,
9378c2ecf20Sopenharmony_ci		[CLK_MMC0]		= &mmc0_clk.common.hw,
9388c2ecf20Sopenharmony_ci		[CLK_MMC1]		= &mmc1_clk.common.hw,
9398c2ecf20Sopenharmony_ci		[CLK_MMC2]		= &mmc2_clk.common.hw,
9408c2ecf20Sopenharmony_ci		[CLK_TS]		= &ts_clk.common.hw,
9418c2ecf20Sopenharmony_ci		[CLK_CE]		= &ce_clk.common.hw,
9428c2ecf20Sopenharmony_ci		[CLK_SPI0]		= &spi0_clk.common.hw,
9438c2ecf20Sopenharmony_ci		[CLK_SPI1]		= &spi1_clk.common.hw,
9448c2ecf20Sopenharmony_ci		[CLK_I2S0]		= &i2s0_clk.common.hw,
9458c2ecf20Sopenharmony_ci		[CLK_I2S1]		= &i2s1_clk.common.hw,
9468c2ecf20Sopenharmony_ci		[CLK_I2S2]		= &i2s2_clk.common.hw,
9478c2ecf20Sopenharmony_ci		[CLK_SPDIF]		= &spdif_clk.common.hw,
9488c2ecf20Sopenharmony_ci		[CLK_USB_PHY0]		= &usb_phy0_clk.common.hw,
9498c2ecf20Sopenharmony_ci		[CLK_USB_PHY1]		= &usb_phy1_clk.common.hw,
9508c2ecf20Sopenharmony_ci		[CLK_USB_PHY2]		= &usb_phy2_clk.common.hw,
9518c2ecf20Sopenharmony_ci		[CLK_USB_PHY3]		= &usb_phy3_clk.common.hw,
9528c2ecf20Sopenharmony_ci		[CLK_USB_OHCI0]		= &usb_ohci0_clk.common.hw,
9538c2ecf20Sopenharmony_ci		[CLK_USB_OHCI1]		= &usb_ohci1_clk.common.hw,
9548c2ecf20Sopenharmony_ci		[CLK_USB_OHCI2]		= &usb_ohci2_clk.common.hw,
9558c2ecf20Sopenharmony_ci		[CLK_USB_OHCI3]		= &usb_ohci3_clk.common.hw,
9568c2ecf20Sopenharmony_ci		[CLK_DRAM]		= &dram_clk.common.hw,
9578c2ecf20Sopenharmony_ci		[CLK_DRAM_VE]		= &dram_ve_clk.common.hw,
9588c2ecf20Sopenharmony_ci		[CLK_DRAM_CSI]		= &dram_csi_clk.common.hw,
9598c2ecf20Sopenharmony_ci		[CLK_DRAM_DEINTERLACE]	= &dram_deinterlace_clk.common.hw,
9608c2ecf20Sopenharmony_ci		[CLK_DRAM_TS]		= &dram_ts_clk.common.hw,
9618c2ecf20Sopenharmony_ci		[CLK_DE]		= &de_clk.common.hw,
9628c2ecf20Sopenharmony_ci		[CLK_TCON0]		= &tcon_clk.common.hw,
9638c2ecf20Sopenharmony_ci		[CLK_TVE]		= &tve_clk.common.hw,
9648c2ecf20Sopenharmony_ci		[CLK_DEINTERLACE]	= &deinterlace_clk.common.hw,
9658c2ecf20Sopenharmony_ci		[CLK_CSI_MISC]		= &csi_misc_clk.common.hw,
9668c2ecf20Sopenharmony_ci		[CLK_CSI_SCLK]		= &csi_sclk_clk.common.hw,
9678c2ecf20Sopenharmony_ci		[CLK_CSI_MCLK]		= &csi_mclk_clk.common.hw,
9688c2ecf20Sopenharmony_ci		[CLK_VE]		= &ve_clk.common.hw,
9698c2ecf20Sopenharmony_ci		[CLK_AC_DIG]		= &ac_dig_clk.common.hw,
9708c2ecf20Sopenharmony_ci		[CLK_AVS]		= &avs_clk.common.hw,
9718c2ecf20Sopenharmony_ci		[CLK_HDMI]		= &hdmi_clk.common.hw,
9728c2ecf20Sopenharmony_ci		[CLK_HDMI_DDC]		= &hdmi_ddc_clk.common.hw,
9738c2ecf20Sopenharmony_ci		[CLK_MBUS]		= &mbus_clk.common.hw,
9748c2ecf20Sopenharmony_ci		[CLK_GPU]		= &gpu_clk.common.hw,
9758c2ecf20Sopenharmony_ci	},
9768c2ecf20Sopenharmony_ci	.num	= CLK_NUMBER_H5,
9778c2ecf20Sopenharmony_ci};
9788c2ecf20Sopenharmony_ci
9798c2ecf20Sopenharmony_cistatic struct ccu_reset_map sun8i_h3_ccu_resets[] = {
9808c2ecf20Sopenharmony_ci	[RST_USB_PHY0]		=  { 0x0cc, BIT(0) },
9818c2ecf20Sopenharmony_ci	[RST_USB_PHY1]		=  { 0x0cc, BIT(1) },
9828c2ecf20Sopenharmony_ci	[RST_USB_PHY2]		=  { 0x0cc, BIT(2) },
9838c2ecf20Sopenharmony_ci	[RST_USB_PHY3]		=  { 0x0cc, BIT(3) },
9848c2ecf20Sopenharmony_ci
9858c2ecf20Sopenharmony_ci	[RST_MBUS]		=  { 0x0fc, BIT(31) },
9868c2ecf20Sopenharmony_ci
9878c2ecf20Sopenharmony_ci	[RST_BUS_CE]		=  { 0x2c0, BIT(5) },
9888c2ecf20Sopenharmony_ci	[RST_BUS_DMA]		=  { 0x2c0, BIT(6) },
9898c2ecf20Sopenharmony_ci	[RST_BUS_MMC0]		=  { 0x2c0, BIT(8) },
9908c2ecf20Sopenharmony_ci	[RST_BUS_MMC1]		=  { 0x2c0, BIT(9) },
9918c2ecf20Sopenharmony_ci	[RST_BUS_MMC2]		=  { 0x2c0, BIT(10) },
9928c2ecf20Sopenharmony_ci	[RST_BUS_NAND]		=  { 0x2c0, BIT(13) },
9938c2ecf20Sopenharmony_ci	[RST_BUS_DRAM]		=  { 0x2c0, BIT(14) },
9948c2ecf20Sopenharmony_ci	[RST_BUS_EMAC]		=  { 0x2c0, BIT(17) },
9958c2ecf20Sopenharmony_ci	[RST_BUS_TS]		=  { 0x2c0, BIT(18) },
9968c2ecf20Sopenharmony_ci	[RST_BUS_HSTIMER]	=  { 0x2c0, BIT(19) },
9978c2ecf20Sopenharmony_ci	[RST_BUS_SPI0]		=  { 0x2c0, BIT(20) },
9988c2ecf20Sopenharmony_ci	[RST_BUS_SPI1]		=  { 0x2c0, BIT(21) },
9998c2ecf20Sopenharmony_ci	[RST_BUS_OTG]		=  { 0x2c0, BIT(23) },
10008c2ecf20Sopenharmony_ci	[RST_BUS_EHCI0]		=  { 0x2c0, BIT(24) },
10018c2ecf20Sopenharmony_ci	[RST_BUS_EHCI1]		=  { 0x2c0, BIT(25) },
10028c2ecf20Sopenharmony_ci	[RST_BUS_EHCI2]		=  { 0x2c0, BIT(26) },
10038c2ecf20Sopenharmony_ci	[RST_BUS_EHCI3]		=  { 0x2c0, BIT(27) },
10048c2ecf20Sopenharmony_ci	[RST_BUS_OHCI0]		=  { 0x2c0, BIT(28) },
10058c2ecf20Sopenharmony_ci	[RST_BUS_OHCI1]		=  { 0x2c0, BIT(29) },
10068c2ecf20Sopenharmony_ci	[RST_BUS_OHCI2]		=  { 0x2c0, BIT(30) },
10078c2ecf20Sopenharmony_ci	[RST_BUS_OHCI3]		=  { 0x2c0, BIT(31) },
10088c2ecf20Sopenharmony_ci
10098c2ecf20Sopenharmony_ci	[RST_BUS_VE]		=  { 0x2c4, BIT(0) },
10108c2ecf20Sopenharmony_ci	[RST_BUS_TCON0]		=  { 0x2c4, BIT(3) },
10118c2ecf20Sopenharmony_ci	[RST_BUS_TCON1]		=  { 0x2c4, BIT(4) },
10128c2ecf20Sopenharmony_ci	[RST_BUS_DEINTERLACE]	=  { 0x2c4, BIT(5) },
10138c2ecf20Sopenharmony_ci	[RST_BUS_CSI]		=  { 0x2c4, BIT(8) },
10148c2ecf20Sopenharmony_ci	[RST_BUS_TVE]		=  { 0x2c4, BIT(9) },
10158c2ecf20Sopenharmony_ci	[RST_BUS_HDMI0]		=  { 0x2c4, BIT(10) },
10168c2ecf20Sopenharmony_ci	[RST_BUS_HDMI1]		=  { 0x2c4, BIT(11) },
10178c2ecf20Sopenharmony_ci	[RST_BUS_DE]		=  { 0x2c4, BIT(12) },
10188c2ecf20Sopenharmony_ci	[RST_BUS_GPU]		=  { 0x2c4, BIT(20) },
10198c2ecf20Sopenharmony_ci	[RST_BUS_MSGBOX]	=  { 0x2c4, BIT(21) },
10208c2ecf20Sopenharmony_ci	[RST_BUS_SPINLOCK]	=  { 0x2c4, BIT(22) },
10218c2ecf20Sopenharmony_ci	[RST_BUS_DBG]		=  { 0x2c4, BIT(31) },
10228c2ecf20Sopenharmony_ci
10238c2ecf20Sopenharmony_ci	[RST_BUS_EPHY]		=  { 0x2c8, BIT(2) },
10248c2ecf20Sopenharmony_ci
10258c2ecf20Sopenharmony_ci	[RST_BUS_CODEC]		=  { 0x2d0, BIT(0) },
10268c2ecf20Sopenharmony_ci	[RST_BUS_SPDIF]		=  { 0x2d0, BIT(1) },
10278c2ecf20Sopenharmony_ci	[RST_BUS_THS]		=  { 0x2d0, BIT(8) },
10288c2ecf20Sopenharmony_ci	[RST_BUS_I2S0]		=  { 0x2d0, BIT(12) },
10298c2ecf20Sopenharmony_ci	[RST_BUS_I2S1]		=  { 0x2d0, BIT(13) },
10308c2ecf20Sopenharmony_ci	[RST_BUS_I2S2]		=  { 0x2d0, BIT(14) },
10318c2ecf20Sopenharmony_ci
10328c2ecf20Sopenharmony_ci	[RST_BUS_I2C0]		=  { 0x2d8, BIT(0) },
10338c2ecf20Sopenharmony_ci	[RST_BUS_I2C1]		=  { 0x2d8, BIT(1) },
10348c2ecf20Sopenharmony_ci	[RST_BUS_I2C2]		=  { 0x2d8, BIT(2) },
10358c2ecf20Sopenharmony_ci	[RST_BUS_UART0]		=  { 0x2d8, BIT(16) },
10368c2ecf20Sopenharmony_ci	[RST_BUS_UART1]		=  { 0x2d8, BIT(17) },
10378c2ecf20Sopenharmony_ci	[RST_BUS_UART2]		=  { 0x2d8, BIT(18) },
10388c2ecf20Sopenharmony_ci	[RST_BUS_UART3]		=  { 0x2d8, BIT(19) },
10398c2ecf20Sopenharmony_ci	[RST_BUS_SCR0]		=  { 0x2d8, BIT(20) },
10408c2ecf20Sopenharmony_ci};
10418c2ecf20Sopenharmony_ci
10428c2ecf20Sopenharmony_cistatic struct ccu_reset_map sun50i_h5_ccu_resets[] = {
10438c2ecf20Sopenharmony_ci	[RST_USB_PHY0]		=  { 0x0cc, BIT(0) },
10448c2ecf20Sopenharmony_ci	[RST_USB_PHY1]		=  { 0x0cc, BIT(1) },
10458c2ecf20Sopenharmony_ci	[RST_USB_PHY2]		=  { 0x0cc, BIT(2) },
10468c2ecf20Sopenharmony_ci	[RST_USB_PHY3]		=  { 0x0cc, BIT(3) },
10478c2ecf20Sopenharmony_ci
10488c2ecf20Sopenharmony_ci	[RST_MBUS]		=  { 0x0fc, BIT(31) },
10498c2ecf20Sopenharmony_ci
10508c2ecf20Sopenharmony_ci	[RST_BUS_CE]		=  { 0x2c0, BIT(5) },
10518c2ecf20Sopenharmony_ci	[RST_BUS_DMA]		=  { 0x2c0, BIT(6) },
10528c2ecf20Sopenharmony_ci	[RST_BUS_MMC0]		=  { 0x2c0, BIT(8) },
10538c2ecf20Sopenharmony_ci	[RST_BUS_MMC1]		=  { 0x2c0, BIT(9) },
10548c2ecf20Sopenharmony_ci	[RST_BUS_MMC2]		=  { 0x2c0, BIT(10) },
10558c2ecf20Sopenharmony_ci	[RST_BUS_NAND]		=  { 0x2c0, BIT(13) },
10568c2ecf20Sopenharmony_ci	[RST_BUS_DRAM]		=  { 0x2c0, BIT(14) },
10578c2ecf20Sopenharmony_ci	[RST_BUS_EMAC]		=  { 0x2c0, BIT(17) },
10588c2ecf20Sopenharmony_ci	[RST_BUS_TS]		=  { 0x2c0, BIT(18) },
10598c2ecf20Sopenharmony_ci	[RST_BUS_HSTIMER]	=  { 0x2c0, BIT(19) },
10608c2ecf20Sopenharmony_ci	[RST_BUS_SPI0]		=  { 0x2c0, BIT(20) },
10618c2ecf20Sopenharmony_ci	[RST_BUS_SPI1]		=  { 0x2c0, BIT(21) },
10628c2ecf20Sopenharmony_ci	[RST_BUS_OTG]		=  { 0x2c0, BIT(23) },
10638c2ecf20Sopenharmony_ci	[RST_BUS_EHCI0]		=  { 0x2c0, BIT(24) },
10648c2ecf20Sopenharmony_ci	[RST_BUS_EHCI1]		=  { 0x2c0, BIT(25) },
10658c2ecf20Sopenharmony_ci	[RST_BUS_EHCI2]		=  { 0x2c0, BIT(26) },
10668c2ecf20Sopenharmony_ci	[RST_BUS_EHCI3]		=  { 0x2c0, BIT(27) },
10678c2ecf20Sopenharmony_ci	[RST_BUS_OHCI0]		=  { 0x2c0, BIT(28) },
10688c2ecf20Sopenharmony_ci	[RST_BUS_OHCI1]		=  { 0x2c0, BIT(29) },
10698c2ecf20Sopenharmony_ci	[RST_BUS_OHCI2]		=  { 0x2c0, BIT(30) },
10708c2ecf20Sopenharmony_ci	[RST_BUS_OHCI3]		=  { 0x2c0, BIT(31) },
10718c2ecf20Sopenharmony_ci
10728c2ecf20Sopenharmony_ci	[RST_BUS_VE]		=  { 0x2c4, BIT(0) },
10738c2ecf20Sopenharmony_ci	[RST_BUS_TCON0]		=  { 0x2c4, BIT(3) },
10748c2ecf20Sopenharmony_ci	[RST_BUS_TCON1]		=  { 0x2c4, BIT(4) },
10758c2ecf20Sopenharmony_ci	[RST_BUS_DEINTERLACE]	=  { 0x2c4, BIT(5) },
10768c2ecf20Sopenharmony_ci	[RST_BUS_CSI]		=  { 0x2c4, BIT(8) },
10778c2ecf20Sopenharmony_ci	[RST_BUS_TVE]		=  { 0x2c4, BIT(9) },
10788c2ecf20Sopenharmony_ci	[RST_BUS_HDMI0]		=  { 0x2c4, BIT(10) },
10798c2ecf20Sopenharmony_ci	[RST_BUS_HDMI1]		=  { 0x2c4, BIT(11) },
10808c2ecf20Sopenharmony_ci	[RST_BUS_DE]		=  { 0x2c4, BIT(12) },
10818c2ecf20Sopenharmony_ci	[RST_BUS_GPU]		=  { 0x2c4, BIT(20) },
10828c2ecf20Sopenharmony_ci	[RST_BUS_MSGBOX]	=  { 0x2c4, BIT(21) },
10838c2ecf20Sopenharmony_ci	[RST_BUS_SPINLOCK]	=  { 0x2c4, BIT(22) },
10848c2ecf20Sopenharmony_ci	[RST_BUS_DBG]		=  { 0x2c4, BIT(31) },
10858c2ecf20Sopenharmony_ci
10868c2ecf20Sopenharmony_ci	[RST_BUS_EPHY]		=  { 0x2c8, BIT(2) },
10878c2ecf20Sopenharmony_ci
10888c2ecf20Sopenharmony_ci	[RST_BUS_CODEC]		=  { 0x2d0, BIT(0) },
10898c2ecf20Sopenharmony_ci	[RST_BUS_SPDIF]		=  { 0x2d0, BIT(1) },
10908c2ecf20Sopenharmony_ci	[RST_BUS_THS]		=  { 0x2d0, BIT(8) },
10918c2ecf20Sopenharmony_ci	[RST_BUS_I2S0]		=  { 0x2d0, BIT(12) },
10928c2ecf20Sopenharmony_ci	[RST_BUS_I2S1]		=  { 0x2d0, BIT(13) },
10938c2ecf20Sopenharmony_ci	[RST_BUS_I2S2]		=  { 0x2d0, BIT(14) },
10948c2ecf20Sopenharmony_ci
10958c2ecf20Sopenharmony_ci	[RST_BUS_I2C0]		=  { 0x2d8, BIT(0) },
10968c2ecf20Sopenharmony_ci	[RST_BUS_I2C1]		=  { 0x2d8, BIT(1) },
10978c2ecf20Sopenharmony_ci	[RST_BUS_I2C2]		=  { 0x2d8, BIT(2) },
10988c2ecf20Sopenharmony_ci	[RST_BUS_UART0]		=  { 0x2d8, BIT(16) },
10998c2ecf20Sopenharmony_ci	[RST_BUS_UART1]		=  { 0x2d8, BIT(17) },
11008c2ecf20Sopenharmony_ci	[RST_BUS_UART2]		=  { 0x2d8, BIT(18) },
11018c2ecf20Sopenharmony_ci	[RST_BUS_UART3]		=  { 0x2d8, BIT(19) },
11028c2ecf20Sopenharmony_ci	[RST_BUS_SCR0]		=  { 0x2d8, BIT(20) },
11038c2ecf20Sopenharmony_ci	[RST_BUS_SCR1]		=  { 0x2d8, BIT(20) },
11048c2ecf20Sopenharmony_ci};
11058c2ecf20Sopenharmony_ci
11068c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun8i_h3_ccu_desc = {
11078c2ecf20Sopenharmony_ci	.ccu_clks	= sun8i_h3_ccu_clks,
11088c2ecf20Sopenharmony_ci	.num_ccu_clks	= ARRAY_SIZE(sun8i_h3_ccu_clks),
11098c2ecf20Sopenharmony_ci
11108c2ecf20Sopenharmony_ci	.hw_clks	= &sun8i_h3_hw_clks,
11118c2ecf20Sopenharmony_ci
11128c2ecf20Sopenharmony_ci	.resets		= sun8i_h3_ccu_resets,
11138c2ecf20Sopenharmony_ci	.num_resets	= ARRAY_SIZE(sun8i_h3_ccu_resets),
11148c2ecf20Sopenharmony_ci};
11158c2ecf20Sopenharmony_ci
11168c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun50i_h5_ccu_desc = {
11178c2ecf20Sopenharmony_ci	.ccu_clks	= sun50i_h5_ccu_clks,
11188c2ecf20Sopenharmony_ci	.num_ccu_clks	= ARRAY_SIZE(sun50i_h5_ccu_clks),
11198c2ecf20Sopenharmony_ci
11208c2ecf20Sopenharmony_ci	.hw_clks	= &sun50i_h5_hw_clks,
11218c2ecf20Sopenharmony_ci
11228c2ecf20Sopenharmony_ci	.resets		= sun50i_h5_ccu_resets,
11238c2ecf20Sopenharmony_ci	.num_resets	= ARRAY_SIZE(sun50i_h5_ccu_resets),
11248c2ecf20Sopenharmony_ci};
11258c2ecf20Sopenharmony_ci
11268c2ecf20Sopenharmony_cistatic struct ccu_pll_nb sun8i_h3_pll_cpu_nb = {
11278c2ecf20Sopenharmony_ci	.common	= &pll_cpux_clk.common,
11288c2ecf20Sopenharmony_ci	/* copy from pll_cpux_clk */
11298c2ecf20Sopenharmony_ci	.enable	= BIT(31),
11308c2ecf20Sopenharmony_ci	.lock	= BIT(28),
11318c2ecf20Sopenharmony_ci};
11328c2ecf20Sopenharmony_ci
11338c2ecf20Sopenharmony_cistatic struct ccu_mux_nb sun8i_h3_cpu_nb = {
11348c2ecf20Sopenharmony_ci	.common		= &cpux_clk.common,
11358c2ecf20Sopenharmony_ci	.cm		= &cpux_clk.mux,
11368c2ecf20Sopenharmony_ci	.delay_us	= 1, /* > 8 clock cycles at 24 MHz */
11378c2ecf20Sopenharmony_ci	.bypass_index	= 1, /* index of 24 MHz oscillator */
11388c2ecf20Sopenharmony_ci};
11398c2ecf20Sopenharmony_ci
11408c2ecf20Sopenharmony_cistatic void __init sunxi_h3_h5_ccu_init(struct device_node *node,
11418c2ecf20Sopenharmony_ci					const struct sunxi_ccu_desc *desc)
11428c2ecf20Sopenharmony_ci{
11438c2ecf20Sopenharmony_ci	void __iomem *reg;
11448c2ecf20Sopenharmony_ci	u32 val;
11458c2ecf20Sopenharmony_ci
11468c2ecf20Sopenharmony_ci	reg = of_io_request_and_map(node, 0, of_node_full_name(node));
11478c2ecf20Sopenharmony_ci	if (IS_ERR(reg)) {
11488c2ecf20Sopenharmony_ci		pr_err("%pOF: Could not map the clock registers\n", node);
11498c2ecf20Sopenharmony_ci		return;
11508c2ecf20Sopenharmony_ci	}
11518c2ecf20Sopenharmony_ci
11528c2ecf20Sopenharmony_ci	/* Force the PLL-Audio-1x divider to 1 */
11538c2ecf20Sopenharmony_ci	val = readl(reg + SUN8I_H3_PLL_AUDIO_REG);
11548c2ecf20Sopenharmony_ci	val &= ~GENMASK(19, 16);
11558c2ecf20Sopenharmony_ci	writel(val | (0 << 16), reg + SUN8I_H3_PLL_AUDIO_REG);
11568c2ecf20Sopenharmony_ci
11578c2ecf20Sopenharmony_ci	sunxi_ccu_probe(node, reg, desc);
11588c2ecf20Sopenharmony_ci
11598c2ecf20Sopenharmony_ci	/* Gate then ungate PLL CPU after any rate changes */
11608c2ecf20Sopenharmony_ci	ccu_pll_notifier_register(&sun8i_h3_pll_cpu_nb);
11618c2ecf20Sopenharmony_ci
11628c2ecf20Sopenharmony_ci	/* Reparent CPU during PLL CPU rate changes */
11638c2ecf20Sopenharmony_ci	ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
11648c2ecf20Sopenharmony_ci				  &sun8i_h3_cpu_nb);
11658c2ecf20Sopenharmony_ci}
11668c2ecf20Sopenharmony_ci
11678c2ecf20Sopenharmony_cistatic void __init sun8i_h3_ccu_setup(struct device_node *node)
11688c2ecf20Sopenharmony_ci{
11698c2ecf20Sopenharmony_ci	sunxi_h3_h5_ccu_init(node, &sun8i_h3_ccu_desc);
11708c2ecf20Sopenharmony_ci}
11718c2ecf20Sopenharmony_ciCLK_OF_DECLARE(sun8i_h3_ccu, "allwinner,sun8i-h3-ccu",
11728c2ecf20Sopenharmony_ci	       sun8i_h3_ccu_setup);
11738c2ecf20Sopenharmony_ci
11748c2ecf20Sopenharmony_cistatic void __init sun50i_h5_ccu_setup(struct device_node *node)
11758c2ecf20Sopenharmony_ci{
11768c2ecf20Sopenharmony_ci	sunxi_h3_h5_ccu_init(node, &sun50i_h5_ccu_desc);
11778c2ecf20Sopenharmony_ci}
11788c2ecf20Sopenharmony_ciCLK_OF_DECLARE(sun50i_h5_ccu, "allwinner,sun50i-h5-ccu",
11798c2ecf20Sopenharmony_ci	       sun50i_h5_ccu_setup);
1180