18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2017 Priit Laes <plaes@plaes.org>.
48c2ecf20Sopenharmony_ci * Copyright (c) 2017 Maxime Ripard.
58c2ecf20Sopenharmony_ci * Copyright (c) 2017 Jonathan Liu.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/clk-provider.h>
98c2ecf20Sopenharmony_ci#include <linux/io.h>
108c2ecf20Sopenharmony_ci#include <linux/of_address.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include "ccu_common.h"
138c2ecf20Sopenharmony_ci#include "ccu_reset.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include "ccu_div.h"
168c2ecf20Sopenharmony_ci#include "ccu_gate.h"
178c2ecf20Sopenharmony_ci#include "ccu_mp.h"
188c2ecf20Sopenharmony_ci#include "ccu_mult.h"
198c2ecf20Sopenharmony_ci#include "ccu_nk.h"
208c2ecf20Sopenharmony_ci#include "ccu_nkm.h"
218c2ecf20Sopenharmony_ci#include "ccu_nkmp.h"
228c2ecf20Sopenharmony_ci#include "ccu_nm.h"
238c2ecf20Sopenharmony_ci#include "ccu_phase.h"
248c2ecf20Sopenharmony_ci#include "ccu_sdm.h"
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#include "ccu-sun4i-a10.h"
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_core_clk = {
298c2ecf20Sopenharmony_ci	.enable		= BIT(31),
308c2ecf20Sopenharmony_ci	.n		= _SUNXI_CCU_MULT_OFFSET(8, 5, 0),
318c2ecf20Sopenharmony_ci	.k		= _SUNXI_CCU_MULT(4, 2),
328c2ecf20Sopenharmony_ci	.m		= _SUNXI_CCU_DIV(0, 2),
338c2ecf20Sopenharmony_ci	.p		= _SUNXI_CCU_DIV(16, 2),
348c2ecf20Sopenharmony_ci	.common		= {
358c2ecf20Sopenharmony_ci		.reg		= 0x000,
368c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("pll-core",
378c2ecf20Sopenharmony_ci					      "hosc",
388c2ecf20Sopenharmony_ci					      &ccu_nkmp_ops,
398c2ecf20Sopenharmony_ci					      0),
408c2ecf20Sopenharmony_ci	},
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/*
448c2ecf20Sopenharmony_ci * The Audio PLL is supposed to have 4 outputs: 3 fixed factors from
458c2ecf20Sopenharmony_ci * the base (2x, 4x and 8x), and one variable divider (the one true
468c2ecf20Sopenharmony_ci * pll audio).
478c2ecf20Sopenharmony_ci *
488c2ecf20Sopenharmony_ci * With sigma-delta modulation for fractional-N on the audio PLL,
498c2ecf20Sopenharmony_ci * we have to use specific dividers. This means the variable divider
508c2ecf20Sopenharmony_ci * can no longer be used, as the audio codec requests the exact clock
518c2ecf20Sopenharmony_ci * rates we support through this mechanism. So we now hard code the
528c2ecf20Sopenharmony_ci * variable divider to 1. This means the clock rates will no longer
538c2ecf20Sopenharmony_ci * match the clock names.
548c2ecf20Sopenharmony_ci */
558c2ecf20Sopenharmony_ci#define SUN4I_PLL_AUDIO_REG	0x008
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cistatic struct ccu_sdm_setting pll_audio_sdm_table[] = {
588c2ecf20Sopenharmony_ci	{ .rate = 22579200, .pattern = 0xc0010d84, .m = 8, .n = 7 },
598c2ecf20Sopenharmony_ci	{ .rate = 24576000, .pattern = 0xc000ac02, .m = 14, .n = 14 },
608c2ecf20Sopenharmony_ci};
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_cistatic struct ccu_nm pll_audio_base_clk = {
638c2ecf20Sopenharmony_ci	.enable		= BIT(31),
648c2ecf20Sopenharmony_ci	.n		= _SUNXI_CCU_MULT_OFFSET(8, 7, 0),
658c2ecf20Sopenharmony_ci	.m		= _SUNXI_CCU_DIV_OFFSET(0, 5, 0),
668c2ecf20Sopenharmony_ci	.sdm		= _SUNXI_CCU_SDM(pll_audio_sdm_table, 0,
678c2ecf20Sopenharmony_ci					 0x00c, BIT(31)),
688c2ecf20Sopenharmony_ci	.common		= {
698c2ecf20Sopenharmony_ci		.reg		= 0x008,
708c2ecf20Sopenharmony_ci		.features	= CCU_FEATURE_SIGMA_DELTA_MOD,
718c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("pll-audio-base",
728c2ecf20Sopenharmony_ci					      "hosc",
738c2ecf20Sopenharmony_ci					      &ccu_nm_ops,
748c2ecf20Sopenharmony_ci					      0),
758c2ecf20Sopenharmony_ci	},
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci};
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_cistatic struct ccu_mult pll_video0_clk = {
808c2ecf20Sopenharmony_ci	.enable		= BIT(31),
818c2ecf20Sopenharmony_ci	.mult		= _SUNXI_CCU_MULT_OFFSET_MIN_MAX(0, 7, 0, 9, 127),
828c2ecf20Sopenharmony_ci	.frac		= _SUNXI_CCU_FRAC(BIT(15), BIT(14),
838c2ecf20Sopenharmony_ci					  270000000, 297000000),
848c2ecf20Sopenharmony_ci	.common		= {
858c2ecf20Sopenharmony_ci		.reg		= 0x010,
868c2ecf20Sopenharmony_ci		.features	= (CCU_FEATURE_FRACTIONAL |
878c2ecf20Sopenharmony_ci				   CCU_FEATURE_ALL_PREDIV),
888c2ecf20Sopenharmony_ci		.prediv		= 8,
898c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("pll-video0",
908c2ecf20Sopenharmony_ci					      "hosc",
918c2ecf20Sopenharmony_ci					      &ccu_mult_ops,
928c2ecf20Sopenharmony_ci					      0),
938c2ecf20Sopenharmony_ci	},
948c2ecf20Sopenharmony_ci};
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_ve_sun4i_clk = {
978c2ecf20Sopenharmony_ci	.enable		= BIT(31),
988c2ecf20Sopenharmony_ci	.n		= _SUNXI_CCU_MULT_OFFSET(8, 5, 0),
998c2ecf20Sopenharmony_ci	.k		= _SUNXI_CCU_MULT(4, 2),
1008c2ecf20Sopenharmony_ci	.m		= _SUNXI_CCU_DIV(0, 2),
1018c2ecf20Sopenharmony_ci	.p		= _SUNXI_CCU_DIV(16, 2),
1028c2ecf20Sopenharmony_ci	.common		= {
1038c2ecf20Sopenharmony_ci		.reg		= 0x018,
1048c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("pll-ve",
1058c2ecf20Sopenharmony_ci					      "hosc",
1068c2ecf20Sopenharmony_ci					      &ccu_nkmp_ops,
1078c2ecf20Sopenharmony_ci					      0),
1088c2ecf20Sopenharmony_ci	},
1098c2ecf20Sopenharmony_ci};
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_cistatic struct ccu_nk pll_ve_sun7i_clk = {
1128c2ecf20Sopenharmony_ci	.enable		= BIT(31),
1138c2ecf20Sopenharmony_ci	.n		= _SUNXI_CCU_MULT_OFFSET(8, 5, 0),
1148c2ecf20Sopenharmony_ci	.k		= _SUNXI_CCU_MULT(4, 2),
1158c2ecf20Sopenharmony_ci	.common		= {
1168c2ecf20Sopenharmony_ci		.reg		= 0x018,
1178c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("pll-ve",
1188c2ecf20Sopenharmony_ci					      "hosc",
1198c2ecf20Sopenharmony_ci					      &ccu_nk_ops,
1208c2ecf20Sopenharmony_ci					      0),
1218c2ecf20Sopenharmony_ci	},
1228c2ecf20Sopenharmony_ci};
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_cistatic struct ccu_nk pll_ddr_base_clk = {
1258c2ecf20Sopenharmony_ci	.enable		= BIT(31),
1268c2ecf20Sopenharmony_ci	.n		= _SUNXI_CCU_MULT_OFFSET(8, 5, 0),
1278c2ecf20Sopenharmony_ci	.k		= _SUNXI_CCU_MULT(4, 2),
1288c2ecf20Sopenharmony_ci	.common		= {
1298c2ecf20Sopenharmony_ci		.reg		= 0x020,
1308c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("pll-ddr-base",
1318c2ecf20Sopenharmony_ci					      "hosc",
1328c2ecf20Sopenharmony_ci					      &ccu_nk_ops,
1338c2ecf20Sopenharmony_ci					      0),
1348c2ecf20Sopenharmony_ci	},
1358c2ecf20Sopenharmony_ci};
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(pll_ddr_clk, "pll-ddr", "pll-ddr-base", 0x020, 0, 2,
1388c2ecf20Sopenharmony_ci		   CLK_IS_CRITICAL);
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_cistatic struct ccu_div pll_ddr_other_clk = {
1418c2ecf20Sopenharmony_ci	.div		= _SUNXI_CCU_DIV_FLAGS(16, 2, CLK_DIVIDER_POWER_OF_TWO),
1428c2ecf20Sopenharmony_ci	.common		= {
1438c2ecf20Sopenharmony_ci		.reg		= 0x020,
1448c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("pll-ddr-other", "pll-ddr-base",
1458c2ecf20Sopenharmony_ci					      &ccu_div_ops,
1468c2ecf20Sopenharmony_ci					      0),
1478c2ecf20Sopenharmony_ci	},
1488c2ecf20Sopenharmony_ci};
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_cistatic struct ccu_nk pll_periph_base_clk = {
1518c2ecf20Sopenharmony_ci	.enable		= BIT(31),
1528c2ecf20Sopenharmony_ci	.n		= _SUNXI_CCU_MULT_OFFSET(8, 5, 0),
1538c2ecf20Sopenharmony_ci	.k		= _SUNXI_CCU_MULT(4, 2),
1548c2ecf20Sopenharmony_ci	.common		= {
1558c2ecf20Sopenharmony_ci		.reg		= 0x028,
1568c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("pll-periph-base",
1578c2ecf20Sopenharmony_ci					      "hosc",
1588c2ecf20Sopenharmony_ci					      &ccu_nk_ops,
1598c2ecf20Sopenharmony_ci					      0),
1608c2ecf20Sopenharmony_ci	},
1618c2ecf20Sopenharmony_ci};
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_periph_clk, "pll-periph",
1648c2ecf20Sopenharmony_ci			   &pll_periph_base_clk.common.hw,
1658c2ecf20Sopenharmony_ci			   2, 1, CLK_SET_RATE_PARENT);
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/* Not documented on A10 */
1688c2ecf20Sopenharmony_cistatic struct ccu_div pll_periph_sata_clk = {
1698c2ecf20Sopenharmony_ci	.enable		= BIT(14),
1708c2ecf20Sopenharmony_ci	.div		= _SUNXI_CCU_DIV(0, 2),
1718c2ecf20Sopenharmony_ci	.fixed_post_div	= 6,
1728c2ecf20Sopenharmony_ci	.common		= {
1738c2ecf20Sopenharmony_ci		.reg		= 0x028,
1748c2ecf20Sopenharmony_ci		.features	= CCU_FEATURE_FIXED_POSTDIV,
1758c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("pll-periph-sata",
1768c2ecf20Sopenharmony_ci					      "pll-periph-base",
1778c2ecf20Sopenharmony_ci					      &ccu_div_ops, 0),
1788c2ecf20Sopenharmony_ci	},
1798c2ecf20Sopenharmony_ci};
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_cistatic struct ccu_mult pll_video1_clk = {
1828c2ecf20Sopenharmony_ci	.enable		= BIT(31),
1838c2ecf20Sopenharmony_ci	.mult		= _SUNXI_CCU_MULT_OFFSET_MIN_MAX(0, 7, 0, 9, 127),
1848c2ecf20Sopenharmony_ci	.frac		= _SUNXI_CCU_FRAC(BIT(15), BIT(14),
1858c2ecf20Sopenharmony_ci				  270000000, 297000000),
1868c2ecf20Sopenharmony_ci	.common		= {
1878c2ecf20Sopenharmony_ci		.reg		= 0x030,
1888c2ecf20Sopenharmony_ci		.features	= (CCU_FEATURE_FRACTIONAL |
1898c2ecf20Sopenharmony_ci				   CCU_FEATURE_ALL_PREDIV),
1908c2ecf20Sopenharmony_ci		.prediv		= 8,
1918c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("pll-video1",
1928c2ecf20Sopenharmony_ci					      "hosc",
1938c2ecf20Sopenharmony_ci					      &ccu_mult_ops,
1948c2ecf20Sopenharmony_ci					      0),
1958c2ecf20Sopenharmony_ci	},
1968c2ecf20Sopenharmony_ci};
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci/* Not present on A10 */
1998c2ecf20Sopenharmony_cistatic struct ccu_nk pll_gpu_clk = {
2008c2ecf20Sopenharmony_ci	.enable		= BIT(31),
2018c2ecf20Sopenharmony_ci	.n		= _SUNXI_CCU_MULT_OFFSET(8, 5, 0),
2028c2ecf20Sopenharmony_ci	.k		= _SUNXI_CCU_MULT(4, 2),
2038c2ecf20Sopenharmony_ci	.common		= {
2048c2ecf20Sopenharmony_ci		.reg		= 0x040,
2058c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("pll-gpu",
2068c2ecf20Sopenharmony_ci					      "hosc",
2078c2ecf20Sopenharmony_ci					      &ccu_nk_ops,
2088c2ecf20Sopenharmony_ci					      0),
2098c2ecf20Sopenharmony_ci	},
2108c2ecf20Sopenharmony_ci};
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(hosc_clk,	"hosc",	"osc24M", 0x050, BIT(0), 0);
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_cistatic const char *const cpu_parents[] = { "osc32k", "hosc",
2158c2ecf20Sopenharmony_ci					   "pll-core", "pll-periph" };
2168c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv cpu_predivs[] = {
2178c2ecf20Sopenharmony_ci	{ .index = 3, .div = 3, },
2188c2ecf20Sopenharmony_ci};
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci#define SUN4I_AHB_REG		0x054
2218c2ecf20Sopenharmony_cistatic struct ccu_mux cpu_clk = {
2228c2ecf20Sopenharmony_ci	.mux		= {
2238c2ecf20Sopenharmony_ci		.shift		= 16,
2248c2ecf20Sopenharmony_ci		.width		= 2,
2258c2ecf20Sopenharmony_ci		.fixed_predivs	= cpu_predivs,
2268c2ecf20Sopenharmony_ci		.n_predivs	= ARRAY_SIZE(cpu_predivs),
2278c2ecf20Sopenharmony_ci	},
2288c2ecf20Sopenharmony_ci	.common		= {
2298c2ecf20Sopenharmony_ci		.reg		= 0x054,
2308c2ecf20Sopenharmony_ci		.features	= CCU_FEATURE_FIXED_PREDIV,
2318c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT_PARENTS("cpu",
2328c2ecf20Sopenharmony_ci						      cpu_parents,
2338c2ecf20Sopenharmony_ci						      &ccu_mux_ops,
2348c2ecf20Sopenharmony_ci						      CLK_SET_RATE_PARENT | CLK_IS_CRITICAL),
2358c2ecf20Sopenharmony_ci	}
2368c2ecf20Sopenharmony_ci};
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(axi_clk, "axi", "cpu", 0x054, 0, 2, 0);
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_cistatic struct ccu_div ahb_sun4i_clk = {
2418c2ecf20Sopenharmony_ci	.div		= _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO),
2428c2ecf20Sopenharmony_ci	.common		= {
2438c2ecf20Sopenharmony_ci		.reg		= 0x054,
2448c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT("ahb", "axi", &ccu_div_ops, 0),
2458c2ecf20Sopenharmony_ci	},
2468c2ecf20Sopenharmony_ci};
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_cistatic const char *const ahb_sun7i_parents[] = { "axi", "pll-periph",
2498c2ecf20Sopenharmony_ci						 "pll-periph" };
2508c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv ahb_sun7i_predivs[] = {
2518c2ecf20Sopenharmony_ci	{ .index = 1, .div = 2, },
2528c2ecf20Sopenharmony_ci	{ /* Sentinel */ },
2538c2ecf20Sopenharmony_ci};
2548c2ecf20Sopenharmony_cistatic struct ccu_div ahb_sun7i_clk = {
2558c2ecf20Sopenharmony_ci	.div		= _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO),
2568c2ecf20Sopenharmony_ci	.mux		= {
2578c2ecf20Sopenharmony_ci		.shift		= 6,
2588c2ecf20Sopenharmony_ci		.width		= 2,
2598c2ecf20Sopenharmony_ci		.fixed_predivs	= ahb_sun7i_predivs,
2608c2ecf20Sopenharmony_ci		.n_predivs	= ARRAY_SIZE(ahb_sun7i_predivs),
2618c2ecf20Sopenharmony_ci	},
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci	.common		= {
2648c2ecf20Sopenharmony_ci		.reg		= 0x054,
2658c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT_PARENTS("ahb",
2668c2ecf20Sopenharmony_ci						      ahb_sun7i_parents,
2678c2ecf20Sopenharmony_ci						      &ccu_div_ops,
2688c2ecf20Sopenharmony_ci						      0),
2698c2ecf20Sopenharmony_ci	},
2708c2ecf20Sopenharmony_ci};
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_cistatic struct clk_div_table apb0_div_table[] = {
2738c2ecf20Sopenharmony_ci	{ .val = 0, .div = 2 },
2748c2ecf20Sopenharmony_ci	{ .val = 1, .div = 2 },
2758c2ecf20Sopenharmony_ci	{ .val = 2, .div = 4 },
2768c2ecf20Sopenharmony_ci	{ .val = 3, .div = 8 },
2778c2ecf20Sopenharmony_ci	{ /* Sentinel */ },
2788c2ecf20Sopenharmony_ci};
2798c2ecf20Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(apb0_clk, "apb0", "ahb",
2808c2ecf20Sopenharmony_ci			   0x054, 8, 2, apb0_div_table, 0);
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_cistatic const char *const apb1_parents[] = { "hosc", "pll-periph", "osc32k" };
2838c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb1_clk, "apb1", apb1_parents, 0x058,
2848c2ecf20Sopenharmony_ci			     0, 5,	/* M */
2858c2ecf20Sopenharmony_ci			     16, 2,	/* P */
2868c2ecf20Sopenharmony_ci			     24, 2,	/* mux */
2878c2ecf20Sopenharmony_ci			     0);
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci/* Not present on A20 */
2908c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(axi_dram_clk,	"axi-dram",	"ahb",
2918c2ecf20Sopenharmony_ci		      0x05c, BIT(31), 0);
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_otg_clk,	"ahb-otg",	"ahb",
2948c2ecf20Sopenharmony_ci		      0x060, BIT(0), 0);
2958c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ehci0_clk,	"ahb-ehci0",	"ahb",
2968c2ecf20Sopenharmony_ci		      0x060, BIT(1), 0);
2978c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ohci0_clk,	"ahb-ohci0",	"ahb",
2988c2ecf20Sopenharmony_ci		      0x060, BIT(2), 0);
2998c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ehci1_clk,	"ahb-ehci1",	"ahb",
3008c2ecf20Sopenharmony_ci		      0x060, BIT(3), 0);
3018c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ohci1_clk,	"ahb-ohci1",	"ahb",
3028c2ecf20Sopenharmony_ci		      0x060, BIT(4), 0);
3038c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ss_clk,	"ahb-ss",	"ahb",
3048c2ecf20Sopenharmony_ci		      0x060, BIT(5), 0);
3058c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_dma_clk,	"ahb-dma",	"ahb",
3068c2ecf20Sopenharmony_ci		      0x060, BIT(6), 0);
3078c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_bist_clk,	"ahb-bist",	"ahb",
3088c2ecf20Sopenharmony_ci		      0x060, BIT(7), 0);
3098c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_mmc0_clk,	"ahb-mmc0",	"ahb",
3108c2ecf20Sopenharmony_ci		      0x060, BIT(8), 0);
3118c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_mmc1_clk,	"ahb-mmc1",	"ahb",
3128c2ecf20Sopenharmony_ci		      0x060, BIT(9), 0);
3138c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_mmc2_clk,	"ahb-mmc2",	"ahb",
3148c2ecf20Sopenharmony_ci		      0x060, BIT(10), 0);
3158c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_mmc3_clk,	"ahb-mmc3",	"ahb",
3168c2ecf20Sopenharmony_ci		      0x060, BIT(11), 0);
3178c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ms_clk,	"ahb-ms",	"ahb",
3188c2ecf20Sopenharmony_ci		      0x060, BIT(12), 0);
3198c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_nand_clk,	"ahb-nand",	"ahb",
3208c2ecf20Sopenharmony_ci		      0x060, BIT(13), 0);
3218c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_sdram_clk,	"ahb-sdram",	"ahb",
3228c2ecf20Sopenharmony_ci		      0x060, BIT(14), CLK_IS_CRITICAL);
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ace_clk,	"ahb-ace",	"ahb",
3258c2ecf20Sopenharmony_ci		      0x060, BIT(16), 0);
3268c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_emac_clk,	"ahb-emac",	"ahb",
3278c2ecf20Sopenharmony_ci		      0x060, BIT(17), 0);
3288c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ts_clk,	"ahb-ts",	"ahb",
3298c2ecf20Sopenharmony_ci		      0x060, BIT(18), 0);
3308c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_spi0_clk,	"ahb-spi0",	"ahb",
3318c2ecf20Sopenharmony_ci		      0x060, BIT(20), 0);
3328c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_spi1_clk,	"ahb-spi1",	"ahb",
3338c2ecf20Sopenharmony_ci		      0x060, BIT(21), 0);
3348c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_spi2_clk,	"ahb-spi2",	"ahb",
3358c2ecf20Sopenharmony_ci		      0x060, BIT(22), 0);
3368c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_spi3_clk,	"ahb-spi3",	"ahb",
3378c2ecf20Sopenharmony_ci		      0x060, BIT(23), 0);
3388c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_pata_clk,	"ahb-pata",	"ahb",
3398c2ecf20Sopenharmony_ci		      0x060, BIT(24), 0);
3408c2ecf20Sopenharmony_ci/* Not documented on A20 */
3418c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_sata_clk,	"ahb-sata",	"ahb",
3428c2ecf20Sopenharmony_ci		      0x060, BIT(25), 0);
3438c2ecf20Sopenharmony_ci/* Not present on A20 */
3448c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_gps_clk,	"ahb-gps",	"ahb",
3458c2ecf20Sopenharmony_ci		      0x060, BIT(26), 0);
3468c2ecf20Sopenharmony_ci/* Not present on A10 */
3478c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_hstimer_clk,	"ahb-hstimer",	"ahb",
3488c2ecf20Sopenharmony_ci		      0x060, BIT(28), 0);
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ve_clk,	"ahb-ve",	"ahb",
3518c2ecf20Sopenharmony_ci		      0x064, BIT(0), 0);
3528c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_tvd_clk,	"ahb-tvd",	"ahb",
3538c2ecf20Sopenharmony_ci		      0x064, BIT(1), 0);
3548c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_tve0_clk,	"ahb-tve0",	"ahb",
3558c2ecf20Sopenharmony_ci		      0x064, BIT(2), 0);
3568c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_tve1_clk,	"ahb-tve1",	"ahb",
3578c2ecf20Sopenharmony_ci		      0x064, BIT(3), 0);
3588c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_lcd0_clk,	"ahb-lcd0",	"ahb",
3598c2ecf20Sopenharmony_ci		      0x064, BIT(4), 0);
3608c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_lcd1_clk,	"ahb-lcd1",	"ahb",
3618c2ecf20Sopenharmony_ci		      0x064, BIT(5), 0);
3628c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_csi0_clk,	"ahb-csi0",	"ahb",
3638c2ecf20Sopenharmony_ci		      0x064, BIT(8), 0);
3648c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_csi1_clk,	"ahb-csi1",	"ahb",
3658c2ecf20Sopenharmony_ci		      0x064, BIT(9), 0);
3668c2ecf20Sopenharmony_ci/* Not present on A10 */
3678c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_hdmi1_clk,	"ahb-hdmi1",	"ahb",
3688c2ecf20Sopenharmony_ci		      0x064, BIT(10), 0);
3698c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_hdmi0_clk,	"ahb-hdmi0",	"ahb",
3708c2ecf20Sopenharmony_ci		      0x064, BIT(11), 0);
3718c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_de_be0_clk,	"ahb-de-be0",	"ahb",
3728c2ecf20Sopenharmony_ci		      0x064, BIT(12), 0);
3738c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_de_be1_clk,	"ahb-de-be1",	"ahb",
3748c2ecf20Sopenharmony_ci		      0x064, BIT(13), 0);
3758c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_de_fe0_clk,	"ahb-de-fe0",	"ahb",
3768c2ecf20Sopenharmony_ci		      0x064, BIT(14), 0);
3778c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_de_fe1_clk,	"ahb-de-fe1",	"ahb",
3788c2ecf20Sopenharmony_ci		      0x064, BIT(15), 0);
3798c2ecf20Sopenharmony_ci/* Not present on A10 */
3808c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_gmac_clk,	"ahb-gmac",	"ahb",
3818c2ecf20Sopenharmony_ci		      0x064, BIT(17), 0);
3828c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_mp_clk,	"ahb-mp",	"ahb",
3838c2ecf20Sopenharmony_ci		      0x064, BIT(18), 0);
3848c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_gpu_clk,	"ahb-gpu",	"ahb",
3858c2ecf20Sopenharmony_ci		      0x064, BIT(20), 0);
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_codec_clk,	"apb0-codec",	"apb0",
3888c2ecf20Sopenharmony_ci		      0x068, BIT(0), 0);
3898c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_spdif_clk,	"apb0-spdif",	"apb0",
3908c2ecf20Sopenharmony_ci		      0x068, BIT(1), 0);
3918c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_ac97_clk,	"apb0-ac97",	"apb0",
3928c2ecf20Sopenharmony_ci		      0x068, BIT(2), 0);
3938c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_i2s0_clk,	"apb0-i2s0",	"apb0",
3948c2ecf20Sopenharmony_ci		      0x068, BIT(3), 0);
3958c2ecf20Sopenharmony_ci/* Not present on A10 */
3968c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_i2s1_clk,	"apb0-i2s1",	"apb0",
3978c2ecf20Sopenharmony_ci		      0x068, BIT(4), 0);
3988c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_pio_clk,	"apb0-pio",	"apb0",
3998c2ecf20Sopenharmony_ci		      0x068, BIT(5), 0);
4008c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_ir0_clk,	"apb0-ir0",	"apb0",
4018c2ecf20Sopenharmony_ci		      0x068, BIT(6), 0);
4028c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_ir1_clk,	"apb0-ir1",	"apb0",
4038c2ecf20Sopenharmony_ci		      0x068, BIT(7), 0);
4048c2ecf20Sopenharmony_ci/* Not present on A10 */
4058c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_i2s2_clk,	"apb0-i2s2",	"apb0",
4068c2ecf20Sopenharmony_ci		      0x068, BIT(8), 0);
4078c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_keypad_clk,	"apb0-keypad",	"apb0",
4088c2ecf20Sopenharmony_ci		      0x068, BIT(10), 0);
4098c2ecf20Sopenharmony_ci
4108c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_i2c0_clk,	"apb1-i2c0",	"apb1",
4118c2ecf20Sopenharmony_ci		      0x06c, BIT(0), 0);
4128c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_i2c1_clk,	"apb1-i2c1",	"apb1",
4138c2ecf20Sopenharmony_ci		      0x06c, BIT(1), 0);
4148c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_i2c2_clk,	"apb1-i2c2",	"apb1",
4158c2ecf20Sopenharmony_ci		      0x06c, BIT(2), 0);
4168c2ecf20Sopenharmony_ci/* Not present on A10 */
4178c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_i2c3_clk,	"apb1-i2c3",	"apb1",
4188c2ecf20Sopenharmony_ci		      0x06c, BIT(3), 0);
4198c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_can_clk,	"apb1-can",	"apb1",
4208c2ecf20Sopenharmony_ci		      0x06c, BIT(4), 0);
4218c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_scr_clk,	"apb1-scr",	"apb1",
4228c2ecf20Sopenharmony_ci		      0x06c, BIT(5), 0);
4238c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_ps20_clk,	"apb1-ps20",	"apb1",
4248c2ecf20Sopenharmony_ci		      0x06c, BIT(6), 0);
4258c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_ps21_clk,	"apb1-ps21",	"apb1",
4268c2ecf20Sopenharmony_ci		      0x06c, BIT(7), 0);
4278c2ecf20Sopenharmony_ci/* Not present on A10 */
4288c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_i2c4_clk,	"apb1-i2c4",	"apb1",
4298c2ecf20Sopenharmony_ci		      0x06c, BIT(15), 0);
4308c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart0_clk,	"apb1-uart0",	"apb1",
4318c2ecf20Sopenharmony_ci		      0x06c, BIT(16), 0);
4328c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart1_clk,	"apb1-uart1",	"apb1",
4338c2ecf20Sopenharmony_ci		      0x06c, BIT(17), 0);
4348c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart2_clk,	"apb1-uart2",	"apb1",
4358c2ecf20Sopenharmony_ci		      0x06c, BIT(18), 0);
4368c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart3_clk,	"apb1-uart3",	"apb1",
4378c2ecf20Sopenharmony_ci		      0x06c, BIT(19), 0);
4388c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart4_clk,	"apb1-uart4",	"apb1",
4398c2ecf20Sopenharmony_ci		      0x06c, BIT(20), 0);
4408c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart5_clk,	"apb1-uart5",	"apb1",
4418c2ecf20Sopenharmony_ci		      0x06c, BIT(21), 0);
4428c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart6_clk,	"apb1-uart6",	"apb1",
4438c2ecf20Sopenharmony_ci		      0x06c, BIT(22), 0);
4448c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart7_clk,	"apb1-uart7",	"apb1",
4458c2ecf20Sopenharmony_ci		      0x06c, BIT(23), 0);
4468c2ecf20Sopenharmony_ci
4478c2ecf20Sopenharmony_cistatic const char *const mod0_default_parents[] = { "hosc", "pll-periph",
4488c2ecf20Sopenharmony_ci						     "pll-ddr-other" };
4498c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand_clk, "nand", mod0_default_parents, 0x080,
4508c2ecf20Sopenharmony_ci				  0, 4,		/* M */
4518c2ecf20Sopenharmony_ci				  16, 2,	/* P */
4528c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
4538c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
4548c2ecf20Sopenharmony_ci				  0);
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_ci/* Undocumented on A10 */
4578c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ms_clk, "ms", mod0_default_parents, 0x084,
4588c2ecf20Sopenharmony_ci				  0, 4,		/* M */
4598c2ecf20Sopenharmony_ci				  16, 2,	/* P */
4608c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
4618c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
4628c2ecf20Sopenharmony_ci				  0);
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 0x088,
4658c2ecf20Sopenharmony_ci				  0, 4,		/* M */
4668c2ecf20Sopenharmony_ci				  16, 2,	/* P */
4678c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
4688c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
4698c2ecf20Sopenharmony_ci				  0);
4708c2ecf20Sopenharmony_ci
4718c2ecf20Sopenharmony_ci/* MMC output and sample clocks are not present on A10 */
4728c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_output_clk, "mmc0_output", "mmc0",
4738c2ecf20Sopenharmony_ci		       0x088, 8, 3, 0);
4748c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc0_sample_clk, "mmc0_sample", "mmc0",
4758c2ecf20Sopenharmony_ci		       0x088, 20, 3, 0);
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 0x08c,
4788c2ecf20Sopenharmony_ci				  0, 4,		/* M */
4798c2ecf20Sopenharmony_ci				  16, 2,	/* P */
4808c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
4818c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
4828c2ecf20Sopenharmony_ci				  0);
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_ci/* MMC output and sample clocks are not present on A10 */
4858c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1_output", "mmc1",
4868c2ecf20Sopenharmony_ci		       0x08c, 8, 3, 0);
4878c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1_sample", "mmc1",
4888c2ecf20Sopenharmony_ci		       0x08c, 20, 3, 0);
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 0x090,
4918c2ecf20Sopenharmony_ci				  0, 4,		/* M */
4928c2ecf20Sopenharmony_ci				  16, 2,	/* P */
4938c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
4948c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
4958c2ecf20Sopenharmony_ci				  0);
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci/* MMC output and sample clocks are not present on A10 */
4988c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_output_clk, "mmc2_output", "mmc2",
4998c2ecf20Sopenharmony_ci		       0x090, 8, 3, 0);
5008c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2_sample", "mmc2",
5018c2ecf20Sopenharmony_ci		       0x090, 20, 3, 0);
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc3_clk, "mmc3", mod0_default_parents, 0x094,
5048c2ecf20Sopenharmony_ci				  0, 4,		/* M */
5058c2ecf20Sopenharmony_ci				  16, 2,	/* P */
5068c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
5078c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
5088c2ecf20Sopenharmony_ci				  0);
5098c2ecf20Sopenharmony_ci
5108c2ecf20Sopenharmony_ci/* MMC output and sample clocks are not present on A10 */
5118c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc3_output_clk, "mmc3_output", "mmc3",
5128c2ecf20Sopenharmony_ci		       0x094, 8, 3, 0);
5138c2ecf20Sopenharmony_cistatic SUNXI_CCU_PHASE(mmc3_sample_clk, "mmc3_sample", "mmc3",
5148c2ecf20Sopenharmony_ci		       0x094, 20, 3, 0);
5158c2ecf20Sopenharmony_ci
5168c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ts_clk, "ts", mod0_default_parents, 0x098,
5178c2ecf20Sopenharmony_ci				  0, 4,		/* M */
5188c2ecf20Sopenharmony_ci				  16, 2,	/* P */
5198c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
5208c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
5218c2ecf20Sopenharmony_ci				  0);
5228c2ecf20Sopenharmony_ci
5238c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ss_clk, "ss", mod0_default_parents, 0x09c,
5248c2ecf20Sopenharmony_ci				  0, 4,		/* M */
5258c2ecf20Sopenharmony_ci				  16, 2,	/* P */
5268c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
5278c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
5288c2ecf20Sopenharmony_ci				  0);
5298c2ecf20Sopenharmony_ci
5308c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 0x0a0,
5318c2ecf20Sopenharmony_ci				  0, 4,		/* M */
5328c2ecf20Sopenharmony_ci				  16, 2,	/* P */
5338c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
5348c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
5358c2ecf20Sopenharmony_ci				  0);
5368c2ecf20Sopenharmony_ci
5378c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 0x0a4,
5388c2ecf20Sopenharmony_ci				  0, 4,		/* M */
5398c2ecf20Sopenharmony_ci				  16, 2,	/* P */
5408c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
5418c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
5428c2ecf20Sopenharmony_ci				  0);
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi2_clk, "spi2", mod0_default_parents, 0x0a8,
5458c2ecf20Sopenharmony_ci				  0, 4,		/* M */
5468c2ecf20Sopenharmony_ci				  16, 2,	/* P */
5478c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
5488c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
5498c2ecf20Sopenharmony_ci				  0);
5508c2ecf20Sopenharmony_ci
5518c2ecf20Sopenharmony_ci/* Undocumented on A10 */
5528c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(pata_clk, "pata", mod0_default_parents, 0x0ac,
5538c2ecf20Sopenharmony_ci				  0, 4,		/* M */
5548c2ecf20Sopenharmony_ci				  16, 2,	/* P */
5558c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
5568c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
5578c2ecf20Sopenharmony_ci				  0);
5588c2ecf20Sopenharmony_ci
5598c2ecf20Sopenharmony_ci/* TODO: Check whether A10 actually supports osc32k as 4th parent? */
5608c2ecf20Sopenharmony_cistatic const char *const ir_parents_sun4i[] = { "hosc", "pll-periph",
5618c2ecf20Sopenharmony_ci						"pll-ddr-other" };
5628c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ir0_sun4i_clk, "ir0", ir_parents_sun4i, 0x0b0,
5638c2ecf20Sopenharmony_ci				  0, 4,		/* M */
5648c2ecf20Sopenharmony_ci				  16, 2,	/* P */
5658c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
5668c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
5678c2ecf20Sopenharmony_ci				  0);
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ir1_sun4i_clk, "ir1", ir_parents_sun4i, 0x0b4,
5708c2ecf20Sopenharmony_ci				  0, 4,		/* M */
5718c2ecf20Sopenharmony_ci				  16, 2,	/* P */
5728c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
5738c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
5748c2ecf20Sopenharmony_ci				  0);
5758c2ecf20Sopenharmony_cistatic const char *const ir_parents_sun7i[] = { "hosc", "pll-periph",
5768c2ecf20Sopenharmony_ci						"pll-ddr-other", "osc32k" };
5778c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ir0_sun7i_clk, "ir0", ir_parents_sun7i, 0x0b0,
5788c2ecf20Sopenharmony_ci				  0, 4,		/* M */
5798c2ecf20Sopenharmony_ci				  16, 2,	/* P */
5808c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
5818c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
5828c2ecf20Sopenharmony_ci				  0);
5838c2ecf20Sopenharmony_ci
5848c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ir1_sun7i_clk, "ir1", ir_parents_sun7i, 0x0b4,
5858c2ecf20Sopenharmony_ci				  0, 4,		/* M */
5868c2ecf20Sopenharmony_ci				  16, 2,	/* P */
5878c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
5888c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
5898c2ecf20Sopenharmony_ci				  0);
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_cistatic const char *const audio_parents[] = { "pll-audio-8x", "pll-audio-4x",
5928c2ecf20Sopenharmony_ci					      "pll-audio-2x", "pll-audio" };
5938c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s0_clk, "i2s0", audio_parents,
5948c2ecf20Sopenharmony_ci			       0x0b8, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(ac97_clk, "ac97", audio_parents,
5978c2ecf20Sopenharmony_ci			       0x0bc, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci/* Undocumented on A10 */
6008c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(spdif_clk, "spdif", audio_parents,
6018c2ecf20Sopenharmony_ci			       0x0c0, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
6028c2ecf20Sopenharmony_ci
6038c2ecf20Sopenharmony_cistatic const char *const keypad_parents[] = { "hosc", "losc"};
6048c2ecf20Sopenharmony_cistatic const u8 keypad_table[] = { 0, 2 };
6058c2ecf20Sopenharmony_cistatic struct ccu_mp keypad_clk = {
6068c2ecf20Sopenharmony_ci	.enable		= BIT(31),
6078c2ecf20Sopenharmony_ci	.m		= _SUNXI_CCU_DIV(0, 5),
6088c2ecf20Sopenharmony_ci	.p		= _SUNXI_CCU_DIV(16, 2),
6098c2ecf20Sopenharmony_ci	.mux		= _SUNXI_CCU_MUX_TABLE(24, 2, keypad_table),
6108c2ecf20Sopenharmony_ci	.common		= {
6118c2ecf20Sopenharmony_ci		.reg		= 0x0c4,
6128c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT_PARENTS("keypad",
6138c2ecf20Sopenharmony_ci						      keypad_parents,
6148c2ecf20Sopenharmony_ci						      &ccu_mp_ops,
6158c2ecf20Sopenharmony_ci						      0),
6168c2ecf20Sopenharmony_ci	},
6178c2ecf20Sopenharmony_ci};
6188c2ecf20Sopenharmony_ci
6198c2ecf20Sopenharmony_ci/*
6208c2ecf20Sopenharmony_ci * SATA supports external clock as parent via BIT(24) and is probably an
6218c2ecf20Sopenharmony_ci * optional crystal or oscillator that can be connected to the
6228c2ecf20Sopenharmony_ci * SATA-CLKM / SATA-CLKP pins.
6238c2ecf20Sopenharmony_ci */
6248c2ecf20Sopenharmony_cistatic const char *const sata_parents[] = {"pll-periph-sata", "sata-ext"};
6258c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(sata_clk, "sata", sata_parents,
6268c2ecf20Sopenharmony_ci			       0x0c8, 24, 1, BIT(31), CLK_SET_RATE_PARENT);
6278c2ecf20Sopenharmony_ci
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci0_clk,	"usb-ohci0",	"pll-periph",
6308c2ecf20Sopenharmony_ci		      0x0cc, BIT(6), 0);
6318c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci1_clk,	"usb-ohci1",	"pll-periph",
6328c2ecf20Sopenharmony_ci		      0x0cc, BIT(7), 0);
6338c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy_clk,	"usb-phy",	"pll-periph",
6348c2ecf20Sopenharmony_ci		      0x0cc, BIT(8), 0);
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_ci/* TODO: GPS CLK 0x0d0 */
6378c2ecf20Sopenharmony_ci
6388c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi3_clk, "spi3", mod0_default_parents, 0x0d4,
6398c2ecf20Sopenharmony_ci				  0, 4,		/* M */
6408c2ecf20Sopenharmony_ci				  16, 2,	/* P */
6418c2ecf20Sopenharmony_ci				  24, 2,	/* mux */
6428c2ecf20Sopenharmony_ci				  BIT(31),	/* gate */
6438c2ecf20Sopenharmony_ci				  0);
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_ci/* Not present on A10 */
6468c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s1_clk, "i2s1", audio_parents,
6478c2ecf20Sopenharmony_ci			       0x0d8, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
6488c2ecf20Sopenharmony_ci
6498c2ecf20Sopenharmony_ci/* Not present on A10 */
6508c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s2_clk, "i2s2", audio_parents,
6518c2ecf20Sopenharmony_ci			       0x0dc, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ve_clk,	"dram-ve",	"pll-ddr",
6548c2ecf20Sopenharmony_ci		      0x100, BIT(0), 0);
6558c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_csi0_clk,	"dram-csi0",	"pll-ddr",
6568c2ecf20Sopenharmony_ci		      0x100, BIT(1), 0);
6578c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_csi1_clk,	"dram-csi1",	"pll-ddr",
6588c2ecf20Sopenharmony_ci		      0x100, BIT(2), 0);
6598c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ts_clk,	"dram-ts",	"pll-ddr",
6608c2ecf20Sopenharmony_ci		      0x100, BIT(3), 0);
6618c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_tvd_clk,	"dram-tvd",	"pll-ddr",
6628c2ecf20Sopenharmony_ci		      0x100, BIT(4), 0);
6638c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_tve0_clk,	"dram-tve0",	"pll-ddr",
6648c2ecf20Sopenharmony_ci		      0x100, BIT(5), 0);
6658c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_tve1_clk,	"dram-tve1",	"pll-ddr",
6668c2ecf20Sopenharmony_ci		      0x100, BIT(6), 0);
6678c2ecf20Sopenharmony_ci
6688c2ecf20Sopenharmony_ci/* Clock seems to be critical only on sun4i */
6698c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_out_clk,	"dram-out",	"pll-ddr",
6708c2ecf20Sopenharmony_ci		      0x100, BIT(15), CLK_IS_CRITICAL);
6718c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_de_fe1_clk,	"dram-de-fe1",	"pll-ddr",
6728c2ecf20Sopenharmony_ci		      0x100, BIT(24), 0);
6738c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_de_fe0_clk,	"dram-de-fe0",	"pll-ddr",
6748c2ecf20Sopenharmony_ci		      0x100, BIT(25), 0);
6758c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_de_be0_clk,	"dram-de-be0",	"pll-ddr",
6768c2ecf20Sopenharmony_ci		      0x100, BIT(26), 0);
6778c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_de_be1_clk,	"dram-de-be1",	"pll-ddr",
6788c2ecf20Sopenharmony_ci		      0x100, BIT(27), 0);
6798c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_mp_clk,	"dram-mp",	"pll-ddr",
6808c2ecf20Sopenharmony_ci		      0x100, BIT(28), 0);
6818c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ace_clk,	"dram-ace",	"pll-ddr",
6828c2ecf20Sopenharmony_ci		      0x100, BIT(29), 0);
6838c2ecf20Sopenharmony_ci
6848c2ecf20Sopenharmony_cistatic const char *const de_parents[] = { "pll-video0", "pll-video1",
6858c2ecf20Sopenharmony_ci					   "pll-ddr-other" };
6868c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_be0_clk, "de-be0", de_parents,
6878c2ecf20Sopenharmony_ci				 0x104, 0, 4, 24, 2, BIT(31), 0);
6888c2ecf20Sopenharmony_ci
6898c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_be1_clk, "de-be1", de_parents,
6908c2ecf20Sopenharmony_ci				 0x108, 0, 4, 24, 2, BIT(31), 0);
6918c2ecf20Sopenharmony_ci
6928c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_fe0_clk, "de-fe0", de_parents,
6938c2ecf20Sopenharmony_ci				 0x10c, 0, 4, 24, 2, BIT(31), 0);
6948c2ecf20Sopenharmony_ci
6958c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_fe1_clk, "de-fe1", de_parents,
6968c2ecf20Sopenharmony_ci				 0x110, 0, 4, 24, 2, BIT(31), 0);
6978c2ecf20Sopenharmony_ci
6988c2ecf20Sopenharmony_ci/* Undocumented on A10 */
6998c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_mp_clk, "de-mp", de_parents,
7008c2ecf20Sopenharmony_ci				 0x114, 0, 4, 24, 2, BIT(31), 0);
7018c2ecf20Sopenharmony_ci
7028c2ecf20Sopenharmony_cistatic const char *const disp_parents[] = { "pll-video0", "pll-video1",
7038c2ecf20Sopenharmony_ci					    "pll-video0-2x", "pll-video1-2x" };
7048c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(tcon0_ch0_clk, "tcon0-ch0-sclk", disp_parents,
7058c2ecf20Sopenharmony_ci			       0x118, 24, 2, BIT(31), CLK_SET_RATE_PARENT);
7068c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(tcon1_ch0_clk, "tcon1-ch0-sclk", disp_parents,
7078c2ecf20Sopenharmony_ci			       0x11c, 24, 2, BIT(31), CLK_SET_RATE_PARENT);
7088c2ecf20Sopenharmony_ci
7098c2ecf20Sopenharmony_cistatic const char *const csi_sclk_parents[] = { "pll-video0", "pll-ve",
7108c2ecf20Sopenharmony_ci						"pll-ddr-other", "pll-periph" };
7118c2ecf20Sopenharmony_ci
7128c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(csi_sclk_clk, "csi-sclk",
7138c2ecf20Sopenharmony_ci				 csi_sclk_parents,
7148c2ecf20Sopenharmony_ci				 0x120, 0, 4, 24, 2, BIT(31), 0);
7158c2ecf20Sopenharmony_ci
7168c2ecf20Sopenharmony_ci/* TVD clock setup for A10 */
7178c2ecf20Sopenharmony_cistatic const char *const tvd_parents[] = { "pll-video0", "pll-video1" };
7188c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(tvd_sun4i_clk, "tvd", tvd_parents,
7198c2ecf20Sopenharmony_ci			       0x128, 24, 1, BIT(31), 0);
7208c2ecf20Sopenharmony_ci
7218c2ecf20Sopenharmony_ci/* TVD clock setup for A20 */
7228c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(tvd_sclk2_sun7i_clk,
7238c2ecf20Sopenharmony_ci				  "tvd-sclk2", tvd_parents,
7248c2ecf20Sopenharmony_ci				  0x128,
7258c2ecf20Sopenharmony_ci				  0, 4,		/* M */
7268c2ecf20Sopenharmony_ci				  16, 4,	/* P */
7278c2ecf20Sopenharmony_ci				  8, 1,		/* mux */
7288c2ecf20Sopenharmony_ci				  BIT(15),	/* gate */
7298c2ecf20Sopenharmony_ci				  0);
7308c2ecf20Sopenharmony_ci
7318c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(tvd_sclk1_sun7i_clk, "tvd-sclk1", "tvd-sclk2",
7328c2ecf20Sopenharmony_ci			     0x128, 0, 4, BIT(31), 0);
7338c2ecf20Sopenharmony_ci
7348c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(tcon0_ch1_sclk2_clk, "tcon0-ch1-sclk2",
7358c2ecf20Sopenharmony_ci				 disp_parents,
7368c2ecf20Sopenharmony_ci				 0x12c, 0, 4, 24, 2, BIT(31),
7378c2ecf20Sopenharmony_ci				 CLK_SET_RATE_PARENT);
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(tcon0_ch1_clk,
7408c2ecf20Sopenharmony_ci			     "tcon0-ch1-sclk1", "tcon0-ch1-sclk2",
7418c2ecf20Sopenharmony_ci			     0x12c, 11, 1, BIT(15),
7428c2ecf20Sopenharmony_ci			     CLK_SET_RATE_PARENT);
7438c2ecf20Sopenharmony_ci
7448c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(tcon1_ch1_sclk2_clk, "tcon1-ch1-sclk2",
7458c2ecf20Sopenharmony_ci				 disp_parents,
7468c2ecf20Sopenharmony_ci				 0x130, 0, 4, 24, 2, BIT(31),
7478c2ecf20Sopenharmony_ci				 CLK_SET_RATE_PARENT);
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(tcon1_ch1_clk,
7508c2ecf20Sopenharmony_ci			     "tcon1-ch1-sclk1", "tcon1-ch1-sclk2",
7518c2ecf20Sopenharmony_ci			     0x130, 11, 1, BIT(15),
7528c2ecf20Sopenharmony_ci			     CLK_SET_RATE_PARENT);
7538c2ecf20Sopenharmony_ci
7548c2ecf20Sopenharmony_cistatic const char *const csi_parents[] = { "hosc", "pll-video0", "pll-video1",
7558c2ecf20Sopenharmony_ci					   "pll-video0-2x", "pll-video1-2x"};
7568c2ecf20Sopenharmony_cistatic const u8 csi_table[] = { 0, 1, 2, 5, 6};
7578c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi0_clk, "csi0",
7588c2ecf20Sopenharmony_ci				       csi_parents, csi_table,
7598c2ecf20Sopenharmony_ci				       0x134, 0, 5, 24, 3, BIT(31), 0);
7608c2ecf20Sopenharmony_ci
7618c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi1_clk, "csi1",
7628c2ecf20Sopenharmony_ci				       csi_parents, csi_table,
7638c2ecf20Sopenharmony_ci				       0x138, 0, 5, 24, 3, BIT(31), 0);
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve", 0x13c, 16, 8, BIT(31), 0);
7668c2ecf20Sopenharmony_ci
7678c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(codec_clk, "codec", "pll-audio",
7688c2ecf20Sopenharmony_ci		      0x140, BIT(31), CLK_SET_RATE_PARENT);
7698c2ecf20Sopenharmony_ci
7708c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk, "avs", "hosc", 0x144, BIT(31), 0);
7718c2ecf20Sopenharmony_ci
7728c2ecf20Sopenharmony_cistatic const char *const ace_parents[] = { "pll-ve", "pll-ddr-other" };
7738c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(ace_clk, "ace", ace_parents,
7748c2ecf20Sopenharmony_ci				 0x148, 0, 4, 24, 1, BIT(31), 0);
7758c2ecf20Sopenharmony_ci
7768c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", disp_parents,
7778c2ecf20Sopenharmony_ci				 0x150, 0, 4, 24, 2, BIT(31),
7788c2ecf20Sopenharmony_ci				 CLK_SET_RATE_PARENT);
7798c2ecf20Sopenharmony_ci
7808c2ecf20Sopenharmony_cistatic const char *const gpu_parents_sun4i[] = { "pll-video0", "pll-ve",
7818c2ecf20Sopenharmony_ci						 "pll-ddr-other",
7828c2ecf20Sopenharmony_ci						 "pll-video1" };
7838c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(gpu_sun4i_clk, "gpu", gpu_parents_sun4i,
7848c2ecf20Sopenharmony_ci				 0x154, 0, 4, 24, 2, BIT(31),
7858c2ecf20Sopenharmony_ci				 CLK_SET_RATE_PARENT);
7868c2ecf20Sopenharmony_ci
7878c2ecf20Sopenharmony_cistatic const char *const gpu_parents_sun7i[] = { "pll-video0", "pll-ve",
7888c2ecf20Sopenharmony_ci						 "pll-ddr-other", "pll-video1",
7898c2ecf20Sopenharmony_ci						 "pll-gpu" };
7908c2ecf20Sopenharmony_cistatic const u8 gpu_table_sun7i[] = { 0, 1, 2, 3, 4 };
7918c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(gpu_sun7i_clk, "gpu",
7928c2ecf20Sopenharmony_ci				       gpu_parents_sun7i, gpu_table_sun7i,
7938c2ecf20Sopenharmony_ci				       0x154, 0, 4, 24, 3, BIT(31),
7948c2ecf20Sopenharmony_ci				       CLK_SET_RATE_PARENT);
7958c2ecf20Sopenharmony_ci
7968c2ecf20Sopenharmony_cistatic const char *const mbus_sun4i_parents[] = { "hosc", "pll-periph",
7978c2ecf20Sopenharmony_ci						  "pll-ddr-other" };
7988c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mbus_sun4i_clk, "mbus", mbus_sun4i_parents,
7998c2ecf20Sopenharmony_ci				  0x15c, 0, 4, 16, 2, 24, 2, BIT(31),
8008c2ecf20Sopenharmony_ci				  0);
8018c2ecf20Sopenharmony_cistatic const char *const mbus_sun7i_parents[] = { "hosc", "pll-periph-base",
8028c2ecf20Sopenharmony_ci						  "pll-ddr-other" };
8038c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mbus_sun7i_clk, "mbus", mbus_sun7i_parents,
8048c2ecf20Sopenharmony_ci				  0x15c, 0, 4, 16, 2, 24, 2, BIT(31),
8058c2ecf20Sopenharmony_ci				  CLK_IS_CRITICAL);
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(hdmi1_slow_clk, "hdmi1-slow", "hosc", 0x178, BIT(31), 0);
8088c2ecf20Sopenharmony_ci
8098c2ecf20Sopenharmony_cistatic const char *const hdmi1_parents[] = { "pll-video0", "pll-video1" };
8108c2ecf20Sopenharmony_cistatic const u8 hdmi1_table[] = { 0, 1};
8118c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(hdmi1_clk, "hdmi1",
8128c2ecf20Sopenharmony_ci				       hdmi1_parents, hdmi1_table,
8138c2ecf20Sopenharmony_ci				       0x17c, 0, 4, 24, 2, BIT(31),
8148c2ecf20Sopenharmony_ci				       CLK_SET_RATE_PARENT);
8158c2ecf20Sopenharmony_ci
8168c2ecf20Sopenharmony_cistatic const char *const out_parents[] = { "hosc", "osc32k", "hosc" };
8178c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv clk_out_predivs[] = {
8188c2ecf20Sopenharmony_ci	{ .index = 0, .div = 750, },
8198c2ecf20Sopenharmony_ci};
8208c2ecf20Sopenharmony_ci
8218c2ecf20Sopenharmony_cistatic struct ccu_mp out_a_clk = {
8228c2ecf20Sopenharmony_ci	.enable		= BIT(31),
8238c2ecf20Sopenharmony_ci	.m		= _SUNXI_CCU_DIV(8, 5),
8248c2ecf20Sopenharmony_ci	.p		= _SUNXI_CCU_DIV(20, 2),
8258c2ecf20Sopenharmony_ci	.mux		= {
8268c2ecf20Sopenharmony_ci		.shift		= 24,
8278c2ecf20Sopenharmony_ci		.width		= 2,
8288c2ecf20Sopenharmony_ci		.fixed_predivs	= clk_out_predivs,
8298c2ecf20Sopenharmony_ci		.n_predivs	= ARRAY_SIZE(clk_out_predivs),
8308c2ecf20Sopenharmony_ci	},
8318c2ecf20Sopenharmony_ci	.common		= {
8328c2ecf20Sopenharmony_ci		.reg		= 0x1f0,
8338c2ecf20Sopenharmony_ci		.features	= CCU_FEATURE_FIXED_PREDIV,
8348c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT_PARENTS("out-a",
8358c2ecf20Sopenharmony_ci						      out_parents,
8368c2ecf20Sopenharmony_ci						      &ccu_mp_ops,
8378c2ecf20Sopenharmony_ci						      0),
8388c2ecf20Sopenharmony_ci	},
8398c2ecf20Sopenharmony_ci};
8408c2ecf20Sopenharmony_cistatic struct ccu_mp out_b_clk = {
8418c2ecf20Sopenharmony_ci	.enable		= BIT(31),
8428c2ecf20Sopenharmony_ci	.m		= _SUNXI_CCU_DIV(8, 5),
8438c2ecf20Sopenharmony_ci	.p		= _SUNXI_CCU_DIV(20, 2),
8448c2ecf20Sopenharmony_ci	.mux		= {
8458c2ecf20Sopenharmony_ci		.shift		= 24,
8468c2ecf20Sopenharmony_ci		.width		= 2,
8478c2ecf20Sopenharmony_ci		.fixed_predivs	= clk_out_predivs,
8488c2ecf20Sopenharmony_ci		.n_predivs	= ARRAY_SIZE(clk_out_predivs),
8498c2ecf20Sopenharmony_ci	},
8508c2ecf20Sopenharmony_ci	.common		= {
8518c2ecf20Sopenharmony_ci		.reg		= 0x1f4,
8528c2ecf20Sopenharmony_ci		.features	= CCU_FEATURE_FIXED_PREDIV,
8538c2ecf20Sopenharmony_ci		.hw.init	= CLK_HW_INIT_PARENTS("out-b",
8548c2ecf20Sopenharmony_ci						      out_parents,
8558c2ecf20Sopenharmony_ci						      &ccu_mp_ops,
8568c2ecf20Sopenharmony_ci						      0),
8578c2ecf20Sopenharmony_ci	},
8588c2ecf20Sopenharmony_ci};
8598c2ecf20Sopenharmony_ci
8608c2ecf20Sopenharmony_cistatic struct ccu_common *sun4i_sun7i_ccu_clks[] = {
8618c2ecf20Sopenharmony_ci	&hosc_clk.common,
8628c2ecf20Sopenharmony_ci	&pll_core_clk.common,
8638c2ecf20Sopenharmony_ci	&pll_audio_base_clk.common,
8648c2ecf20Sopenharmony_ci	&pll_video0_clk.common,
8658c2ecf20Sopenharmony_ci	&pll_ve_sun4i_clk.common,
8668c2ecf20Sopenharmony_ci	&pll_ve_sun7i_clk.common,
8678c2ecf20Sopenharmony_ci	&pll_ddr_base_clk.common,
8688c2ecf20Sopenharmony_ci	&pll_ddr_clk.common,
8698c2ecf20Sopenharmony_ci	&pll_ddr_other_clk.common,
8708c2ecf20Sopenharmony_ci	&pll_periph_base_clk.common,
8718c2ecf20Sopenharmony_ci	&pll_periph_sata_clk.common,
8728c2ecf20Sopenharmony_ci	&pll_video1_clk.common,
8738c2ecf20Sopenharmony_ci	&pll_gpu_clk.common,
8748c2ecf20Sopenharmony_ci	&cpu_clk.common,
8758c2ecf20Sopenharmony_ci	&axi_clk.common,
8768c2ecf20Sopenharmony_ci	&axi_dram_clk.common,
8778c2ecf20Sopenharmony_ci	&ahb_sun4i_clk.common,
8788c2ecf20Sopenharmony_ci	&ahb_sun7i_clk.common,
8798c2ecf20Sopenharmony_ci	&apb0_clk.common,
8808c2ecf20Sopenharmony_ci	&apb1_clk.common,
8818c2ecf20Sopenharmony_ci	&ahb_otg_clk.common,
8828c2ecf20Sopenharmony_ci	&ahb_ehci0_clk.common,
8838c2ecf20Sopenharmony_ci	&ahb_ohci0_clk.common,
8848c2ecf20Sopenharmony_ci	&ahb_ehci1_clk.common,
8858c2ecf20Sopenharmony_ci	&ahb_ohci1_clk.common,
8868c2ecf20Sopenharmony_ci	&ahb_ss_clk.common,
8878c2ecf20Sopenharmony_ci	&ahb_dma_clk.common,
8888c2ecf20Sopenharmony_ci	&ahb_bist_clk.common,
8898c2ecf20Sopenharmony_ci	&ahb_mmc0_clk.common,
8908c2ecf20Sopenharmony_ci	&ahb_mmc1_clk.common,
8918c2ecf20Sopenharmony_ci	&ahb_mmc2_clk.common,
8928c2ecf20Sopenharmony_ci	&ahb_mmc3_clk.common,
8938c2ecf20Sopenharmony_ci	&ahb_ms_clk.common,
8948c2ecf20Sopenharmony_ci	&ahb_nand_clk.common,
8958c2ecf20Sopenharmony_ci	&ahb_sdram_clk.common,
8968c2ecf20Sopenharmony_ci	&ahb_ace_clk.common,
8978c2ecf20Sopenharmony_ci	&ahb_emac_clk.common,
8988c2ecf20Sopenharmony_ci	&ahb_ts_clk.common,
8998c2ecf20Sopenharmony_ci	&ahb_spi0_clk.common,
9008c2ecf20Sopenharmony_ci	&ahb_spi1_clk.common,
9018c2ecf20Sopenharmony_ci	&ahb_spi2_clk.common,
9028c2ecf20Sopenharmony_ci	&ahb_spi3_clk.common,
9038c2ecf20Sopenharmony_ci	&ahb_pata_clk.common,
9048c2ecf20Sopenharmony_ci	&ahb_sata_clk.common,
9058c2ecf20Sopenharmony_ci	&ahb_gps_clk.common,
9068c2ecf20Sopenharmony_ci	&ahb_hstimer_clk.common,
9078c2ecf20Sopenharmony_ci	&ahb_ve_clk.common,
9088c2ecf20Sopenharmony_ci	&ahb_tvd_clk.common,
9098c2ecf20Sopenharmony_ci	&ahb_tve0_clk.common,
9108c2ecf20Sopenharmony_ci	&ahb_tve1_clk.common,
9118c2ecf20Sopenharmony_ci	&ahb_lcd0_clk.common,
9128c2ecf20Sopenharmony_ci	&ahb_lcd1_clk.common,
9138c2ecf20Sopenharmony_ci	&ahb_csi0_clk.common,
9148c2ecf20Sopenharmony_ci	&ahb_csi1_clk.common,
9158c2ecf20Sopenharmony_ci	&ahb_hdmi1_clk.common,
9168c2ecf20Sopenharmony_ci	&ahb_hdmi0_clk.common,
9178c2ecf20Sopenharmony_ci	&ahb_de_be0_clk.common,
9188c2ecf20Sopenharmony_ci	&ahb_de_be1_clk.common,
9198c2ecf20Sopenharmony_ci	&ahb_de_fe0_clk.common,
9208c2ecf20Sopenharmony_ci	&ahb_de_fe1_clk.common,
9218c2ecf20Sopenharmony_ci	&ahb_gmac_clk.common,
9228c2ecf20Sopenharmony_ci	&ahb_mp_clk.common,
9238c2ecf20Sopenharmony_ci	&ahb_gpu_clk.common,
9248c2ecf20Sopenharmony_ci	&apb0_codec_clk.common,
9258c2ecf20Sopenharmony_ci	&apb0_spdif_clk.common,
9268c2ecf20Sopenharmony_ci	&apb0_ac97_clk.common,
9278c2ecf20Sopenharmony_ci	&apb0_i2s0_clk.common,
9288c2ecf20Sopenharmony_ci	&apb0_i2s1_clk.common,
9298c2ecf20Sopenharmony_ci	&apb0_pio_clk.common,
9308c2ecf20Sopenharmony_ci	&apb0_ir0_clk.common,
9318c2ecf20Sopenharmony_ci	&apb0_ir1_clk.common,
9328c2ecf20Sopenharmony_ci	&apb0_i2s2_clk.common,
9338c2ecf20Sopenharmony_ci	&apb0_keypad_clk.common,
9348c2ecf20Sopenharmony_ci	&apb1_i2c0_clk.common,
9358c2ecf20Sopenharmony_ci	&apb1_i2c1_clk.common,
9368c2ecf20Sopenharmony_ci	&apb1_i2c2_clk.common,
9378c2ecf20Sopenharmony_ci	&apb1_i2c3_clk.common,
9388c2ecf20Sopenharmony_ci	&apb1_can_clk.common,
9398c2ecf20Sopenharmony_ci	&apb1_scr_clk.common,
9408c2ecf20Sopenharmony_ci	&apb1_ps20_clk.common,
9418c2ecf20Sopenharmony_ci	&apb1_ps21_clk.common,
9428c2ecf20Sopenharmony_ci	&apb1_i2c4_clk.common,
9438c2ecf20Sopenharmony_ci	&apb1_uart0_clk.common,
9448c2ecf20Sopenharmony_ci	&apb1_uart1_clk.common,
9458c2ecf20Sopenharmony_ci	&apb1_uart2_clk.common,
9468c2ecf20Sopenharmony_ci	&apb1_uart3_clk.common,
9478c2ecf20Sopenharmony_ci	&apb1_uart4_clk.common,
9488c2ecf20Sopenharmony_ci	&apb1_uart5_clk.common,
9498c2ecf20Sopenharmony_ci	&apb1_uart6_clk.common,
9508c2ecf20Sopenharmony_ci	&apb1_uart7_clk.common,
9518c2ecf20Sopenharmony_ci	&nand_clk.common,
9528c2ecf20Sopenharmony_ci	&ms_clk.common,
9538c2ecf20Sopenharmony_ci	&mmc0_clk.common,
9548c2ecf20Sopenharmony_ci	&mmc0_output_clk.common,
9558c2ecf20Sopenharmony_ci	&mmc0_sample_clk.common,
9568c2ecf20Sopenharmony_ci	&mmc1_clk.common,
9578c2ecf20Sopenharmony_ci	&mmc1_output_clk.common,
9588c2ecf20Sopenharmony_ci	&mmc1_sample_clk.common,
9598c2ecf20Sopenharmony_ci	&mmc2_clk.common,
9608c2ecf20Sopenharmony_ci	&mmc2_output_clk.common,
9618c2ecf20Sopenharmony_ci	&mmc2_sample_clk.common,
9628c2ecf20Sopenharmony_ci	&mmc3_clk.common,
9638c2ecf20Sopenharmony_ci	&mmc3_output_clk.common,
9648c2ecf20Sopenharmony_ci	&mmc3_sample_clk.common,
9658c2ecf20Sopenharmony_ci	&ts_clk.common,
9668c2ecf20Sopenharmony_ci	&ss_clk.common,
9678c2ecf20Sopenharmony_ci	&spi0_clk.common,
9688c2ecf20Sopenharmony_ci	&spi1_clk.common,
9698c2ecf20Sopenharmony_ci	&spi2_clk.common,
9708c2ecf20Sopenharmony_ci	&pata_clk.common,
9718c2ecf20Sopenharmony_ci	&ir0_sun4i_clk.common,
9728c2ecf20Sopenharmony_ci	&ir1_sun4i_clk.common,
9738c2ecf20Sopenharmony_ci	&ir0_sun7i_clk.common,
9748c2ecf20Sopenharmony_ci	&ir1_sun7i_clk.common,
9758c2ecf20Sopenharmony_ci	&i2s0_clk.common,
9768c2ecf20Sopenharmony_ci	&ac97_clk.common,
9778c2ecf20Sopenharmony_ci	&spdif_clk.common,
9788c2ecf20Sopenharmony_ci	&keypad_clk.common,
9798c2ecf20Sopenharmony_ci	&sata_clk.common,
9808c2ecf20Sopenharmony_ci	&usb_ohci0_clk.common,
9818c2ecf20Sopenharmony_ci	&usb_ohci1_clk.common,
9828c2ecf20Sopenharmony_ci	&usb_phy_clk.common,
9838c2ecf20Sopenharmony_ci	&spi3_clk.common,
9848c2ecf20Sopenharmony_ci	&i2s1_clk.common,
9858c2ecf20Sopenharmony_ci	&i2s2_clk.common,
9868c2ecf20Sopenharmony_ci	&dram_ve_clk.common,
9878c2ecf20Sopenharmony_ci	&dram_csi0_clk.common,
9888c2ecf20Sopenharmony_ci	&dram_csi1_clk.common,
9898c2ecf20Sopenharmony_ci	&dram_ts_clk.common,
9908c2ecf20Sopenharmony_ci	&dram_tvd_clk.common,
9918c2ecf20Sopenharmony_ci	&dram_tve0_clk.common,
9928c2ecf20Sopenharmony_ci	&dram_tve1_clk.common,
9938c2ecf20Sopenharmony_ci	&dram_out_clk.common,
9948c2ecf20Sopenharmony_ci	&dram_de_fe1_clk.common,
9958c2ecf20Sopenharmony_ci	&dram_de_fe0_clk.common,
9968c2ecf20Sopenharmony_ci	&dram_de_be0_clk.common,
9978c2ecf20Sopenharmony_ci	&dram_de_be1_clk.common,
9988c2ecf20Sopenharmony_ci	&dram_mp_clk.common,
9998c2ecf20Sopenharmony_ci	&dram_ace_clk.common,
10008c2ecf20Sopenharmony_ci	&de_be0_clk.common,
10018c2ecf20Sopenharmony_ci	&de_be1_clk.common,
10028c2ecf20Sopenharmony_ci	&de_fe0_clk.common,
10038c2ecf20Sopenharmony_ci	&de_fe1_clk.common,
10048c2ecf20Sopenharmony_ci	&de_mp_clk.common,
10058c2ecf20Sopenharmony_ci	&tcon0_ch0_clk.common,
10068c2ecf20Sopenharmony_ci	&tcon1_ch0_clk.common,
10078c2ecf20Sopenharmony_ci	&csi_sclk_clk.common,
10088c2ecf20Sopenharmony_ci	&tvd_sun4i_clk.common,
10098c2ecf20Sopenharmony_ci	&tvd_sclk1_sun7i_clk.common,
10108c2ecf20Sopenharmony_ci	&tvd_sclk2_sun7i_clk.common,
10118c2ecf20Sopenharmony_ci	&tcon0_ch1_sclk2_clk.common,
10128c2ecf20Sopenharmony_ci	&tcon0_ch1_clk.common,
10138c2ecf20Sopenharmony_ci	&tcon1_ch1_sclk2_clk.common,
10148c2ecf20Sopenharmony_ci	&tcon1_ch1_clk.common,
10158c2ecf20Sopenharmony_ci	&csi0_clk.common,
10168c2ecf20Sopenharmony_ci	&csi1_clk.common,
10178c2ecf20Sopenharmony_ci	&ve_clk.common,
10188c2ecf20Sopenharmony_ci	&codec_clk.common,
10198c2ecf20Sopenharmony_ci	&avs_clk.common,
10208c2ecf20Sopenharmony_ci	&ace_clk.common,
10218c2ecf20Sopenharmony_ci	&hdmi_clk.common,
10228c2ecf20Sopenharmony_ci	&gpu_sun4i_clk.common,
10238c2ecf20Sopenharmony_ci	&gpu_sun7i_clk.common,
10248c2ecf20Sopenharmony_ci	&mbus_sun4i_clk.common,
10258c2ecf20Sopenharmony_ci	&mbus_sun7i_clk.common,
10268c2ecf20Sopenharmony_ci	&hdmi1_slow_clk.common,
10278c2ecf20Sopenharmony_ci	&hdmi1_clk.common,
10288c2ecf20Sopenharmony_ci	&out_a_clk.common,
10298c2ecf20Sopenharmony_ci	&out_b_clk.common
10308c2ecf20Sopenharmony_ci};
10318c2ecf20Sopenharmony_ci
10328c2ecf20Sopenharmony_cistatic const struct clk_hw *clk_parent_pll_audio[] = {
10338c2ecf20Sopenharmony_ci	&pll_audio_base_clk.common.hw
10348c2ecf20Sopenharmony_ci};
10358c2ecf20Sopenharmony_ci
10368c2ecf20Sopenharmony_ci/* Post-divider for pll-audio is hardcoded to 1 */
10378c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio",
10388c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
10398c2ecf20Sopenharmony_ci			    1, 1, CLK_SET_RATE_PARENT);
10408c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x",
10418c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
10428c2ecf20Sopenharmony_ci			    2, 1, CLK_SET_RATE_PARENT);
10438c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x",
10448c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
10458c2ecf20Sopenharmony_ci			    1, 1, CLK_SET_RATE_PARENT);
10468c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x",
10478c2ecf20Sopenharmony_ci			    clk_parent_pll_audio,
10488c2ecf20Sopenharmony_ci			    1, 2, CLK_SET_RATE_PARENT);
10498c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_video0_2x_clk, "pll-video0-2x",
10508c2ecf20Sopenharmony_ci			   &pll_video0_clk.common.hw,
10518c2ecf20Sopenharmony_ci			   1, 2, CLK_SET_RATE_PARENT);
10528c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_video1_2x_clk, "pll-video1-2x",
10538c2ecf20Sopenharmony_ci			   &pll_video1_clk.common.hw,
10548c2ecf20Sopenharmony_ci			   1, 2, CLK_SET_RATE_PARENT);
10558c2ecf20Sopenharmony_ci
10568c2ecf20Sopenharmony_ci
10578c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun4i_a10_hw_clks = {
10588c2ecf20Sopenharmony_ci	.hws	= {
10598c2ecf20Sopenharmony_ci		[CLK_HOSC]		= &hosc_clk.common.hw,
10608c2ecf20Sopenharmony_ci		[CLK_PLL_CORE]		= &pll_core_clk.common.hw,
10618c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_BASE]	= &pll_audio_base_clk.common.hw,
10628c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO]		= &pll_audio_clk.hw,
10638c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_2X]	= &pll_audio_2x_clk.hw,
10648c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_4X]	= &pll_audio_4x_clk.hw,
10658c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_8X]	= &pll_audio_8x_clk.hw,
10668c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO0]	= &pll_video0_clk.common.hw,
10678c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO0_2X]	= &pll_video0_2x_clk.hw,
10688c2ecf20Sopenharmony_ci		[CLK_PLL_VE]		= &pll_ve_sun4i_clk.common.hw,
10698c2ecf20Sopenharmony_ci		[CLK_PLL_DDR_BASE]	= &pll_ddr_base_clk.common.hw,
10708c2ecf20Sopenharmony_ci		[CLK_PLL_DDR]		= &pll_ddr_clk.common.hw,
10718c2ecf20Sopenharmony_ci		[CLK_PLL_DDR_OTHER]	= &pll_ddr_other_clk.common.hw,
10728c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH_BASE]	= &pll_periph_base_clk.common.hw,
10738c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH]	= &pll_periph_clk.hw,
10748c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH_SATA]	= &pll_periph_sata_clk.common.hw,
10758c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO1]	= &pll_video1_clk.common.hw,
10768c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO1_2X]	= &pll_video1_2x_clk.hw,
10778c2ecf20Sopenharmony_ci		[CLK_CPU]		= &cpu_clk.common.hw,
10788c2ecf20Sopenharmony_ci		[CLK_AXI]		= &axi_clk.common.hw,
10798c2ecf20Sopenharmony_ci		[CLK_AXI_DRAM]		= &axi_dram_clk.common.hw,
10808c2ecf20Sopenharmony_ci		[CLK_AHB]		= &ahb_sun4i_clk.common.hw,
10818c2ecf20Sopenharmony_ci		[CLK_APB0]		= &apb0_clk.common.hw,
10828c2ecf20Sopenharmony_ci		[CLK_APB1]		= &apb1_clk.common.hw,
10838c2ecf20Sopenharmony_ci		[CLK_AHB_OTG]		= &ahb_otg_clk.common.hw,
10848c2ecf20Sopenharmony_ci		[CLK_AHB_EHCI0]		= &ahb_ehci0_clk.common.hw,
10858c2ecf20Sopenharmony_ci		[CLK_AHB_OHCI0]		= &ahb_ohci0_clk.common.hw,
10868c2ecf20Sopenharmony_ci		[CLK_AHB_EHCI1]		= &ahb_ehci1_clk.common.hw,
10878c2ecf20Sopenharmony_ci		[CLK_AHB_OHCI1]		= &ahb_ohci1_clk.common.hw,
10888c2ecf20Sopenharmony_ci		[CLK_AHB_SS]		= &ahb_ss_clk.common.hw,
10898c2ecf20Sopenharmony_ci		[CLK_AHB_DMA]		= &ahb_dma_clk.common.hw,
10908c2ecf20Sopenharmony_ci		[CLK_AHB_BIST]		= &ahb_bist_clk.common.hw,
10918c2ecf20Sopenharmony_ci		[CLK_AHB_MMC0]		= &ahb_mmc0_clk.common.hw,
10928c2ecf20Sopenharmony_ci		[CLK_AHB_MMC1]		= &ahb_mmc1_clk.common.hw,
10938c2ecf20Sopenharmony_ci		[CLK_AHB_MMC2]		= &ahb_mmc2_clk.common.hw,
10948c2ecf20Sopenharmony_ci		[CLK_AHB_MMC3]		= &ahb_mmc3_clk.common.hw,
10958c2ecf20Sopenharmony_ci		[CLK_AHB_MS]		= &ahb_ms_clk.common.hw,
10968c2ecf20Sopenharmony_ci		[CLK_AHB_NAND]		= &ahb_nand_clk.common.hw,
10978c2ecf20Sopenharmony_ci		[CLK_AHB_SDRAM]		= &ahb_sdram_clk.common.hw,
10988c2ecf20Sopenharmony_ci		[CLK_AHB_ACE]		= &ahb_ace_clk.common.hw,
10998c2ecf20Sopenharmony_ci		[CLK_AHB_EMAC]		= &ahb_emac_clk.common.hw,
11008c2ecf20Sopenharmony_ci		[CLK_AHB_TS]		= &ahb_ts_clk.common.hw,
11018c2ecf20Sopenharmony_ci		[CLK_AHB_SPI0]		= &ahb_spi0_clk.common.hw,
11028c2ecf20Sopenharmony_ci		[CLK_AHB_SPI1]		= &ahb_spi1_clk.common.hw,
11038c2ecf20Sopenharmony_ci		[CLK_AHB_SPI2]		= &ahb_spi2_clk.common.hw,
11048c2ecf20Sopenharmony_ci		[CLK_AHB_SPI3]		= &ahb_spi3_clk.common.hw,
11058c2ecf20Sopenharmony_ci		[CLK_AHB_PATA]		= &ahb_pata_clk.common.hw,
11068c2ecf20Sopenharmony_ci		[CLK_AHB_SATA]		= &ahb_sata_clk.common.hw,
11078c2ecf20Sopenharmony_ci		[CLK_AHB_GPS]		= &ahb_gps_clk.common.hw,
11088c2ecf20Sopenharmony_ci		[CLK_AHB_VE]		= &ahb_ve_clk.common.hw,
11098c2ecf20Sopenharmony_ci		[CLK_AHB_TVD]		= &ahb_tvd_clk.common.hw,
11108c2ecf20Sopenharmony_ci		[CLK_AHB_TVE0]		= &ahb_tve0_clk.common.hw,
11118c2ecf20Sopenharmony_ci		[CLK_AHB_TVE1]		= &ahb_tve1_clk.common.hw,
11128c2ecf20Sopenharmony_ci		[CLK_AHB_LCD0]		= &ahb_lcd0_clk.common.hw,
11138c2ecf20Sopenharmony_ci		[CLK_AHB_LCD1]		= &ahb_lcd1_clk.common.hw,
11148c2ecf20Sopenharmony_ci		[CLK_AHB_CSI0]		= &ahb_csi0_clk.common.hw,
11158c2ecf20Sopenharmony_ci		[CLK_AHB_CSI1]		= &ahb_csi1_clk.common.hw,
11168c2ecf20Sopenharmony_ci		[CLK_AHB_HDMI0]		= &ahb_hdmi0_clk.common.hw,
11178c2ecf20Sopenharmony_ci		[CLK_AHB_DE_BE0]	= &ahb_de_be0_clk.common.hw,
11188c2ecf20Sopenharmony_ci		[CLK_AHB_DE_BE1]	= &ahb_de_be1_clk.common.hw,
11198c2ecf20Sopenharmony_ci		[CLK_AHB_DE_FE0]	= &ahb_de_fe0_clk.common.hw,
11208c2ecf20Sopenharmony_ci		[CLK_AHB_DE_FE1]	= &ahb_de_fe1_clk.common.hw,
11218c2ecf20Sopenharmony_ci		[CLK_AHB_MP]		= &ahb_mp_clk.common.hw,
11228c2ecf20Sopenharmony_ci		[CLK_AHB_GPU]		= &ahb_gpu_clk.common.hw,
11238c2ecf20Sopenharmony_ci		[CLK_APB0_CODEC]	= &apb0_codec_clk.common.hw,
11248c2ecf20Sopenharmony_ci		[CLK_APB0_SPDIF]	= &apb0_spdif_clk.common.hw,
11258c2ecf20Sopenharmony_ci		[CLK_APB0_AC97]		= &apb0_ac97_clk.common.hw,
11268c2ecf20Sopenharmony_ci		[CLK_APB0_I2S0]		= &apb0_i2s0_clk.common.hw,
11278c2ecf20Sopenharmony_ci		[CLK_APB0_PIO]		= &apb0_pio_clk.common.hw,
11288c2ecf20Sopenharmony_ci		[CLK_APB0_IR0]		= &apb0_ir0_clk.common.hw,
11298c2ecf20Sopenharmony_ci		[CLK_APB0_IR1]		= &apb0_ir1_clk.common.hw,
11308c2ecf20Sopenharmony_ci		[CLK_APB0_KEYPAD]	= &apb0_keypad_clk.common.hw,
11318c2ecf20Sopenharmony_ci		[CLK_APB1_I2C0]		= &apb1_i2c0_clk.common.hw,
11328c2ecf20Sopenharmony_ci		[CLK_APB1_I2C1]		= &apb1_i2c1_clk.common.hw,
11338c2ecf20Sopenharmony_ci		[CLK_APB1_I2C2]		= &apb1_i2c2_clk.common.hw,
11348c2ecf20Sopenharmony_ci		[CLK_APB1_CAN]		= &apb1_can_clk.common.hw,
11358c2ecf20Sopenharmony_ci		[CLK_APB1_SCR]		= &apb1_scr_clk.common.hw,
11368c2ecf20Sopenharmony_ci		[CLK_APB1_PS20]		= &apb1_ps20_clk.common.hw,
11378c2ecf20Sopenharmony_ci		[CLK_APB1_PS21]		= &apb1_ps21_clk.common.hw,
11388c2ecf20Sopenharmony_ci		[CLK_APB1_UART0]	= &apb1_uart0_clk.common.hw,
11398c2ecf20Sopenharmony_ci		[CLK_APB1_UART1]	= &apb1_uart1_clk.common.hw,
11408c2ecf20Sopenharmony_ci		[CLK_APB1_UART2]	= &apb1_uart2_clk.common.hw,
11418c2ecf20Sopenharmony_ci		[CLK_APB1_UART3]	= &apb1_uart3_clk.common.hw,
11428c2ecf20Sopenharmony_ci		[CLK_APB1_UART4]	= &apb1_uart4_clk.common.hw,
11438c2ecf20Sopenharmony_ci		[CLK_APB1_UART5]	= &apb1_uart5_clk.common.hw,
11448c2ecf20Sopenharmony_ci		[CLK_APB1_UART6]	= &apb1_uart6_clk.common.hw,
11458c2ecf20Sopenharmony_ci		[CLK_APB1_UART7]	= &apb1_uart7_clk.common.hw,
11468c2ecf20Sopenharmony_ci		[CLK_NAND]		= &nand_clk.common.hw,
11478c2ecf20Sopenharmony_ci		[CLK_MS]		= &ms_clk.common.hw,
11488c2ecf20Sopenharmony_ci		[CLK_MMC0]		= &mmc0_clk.common.hw,
11498c2ecf20Sopenharmony_ci		[CLK_MMC1]		= &mmc1_clk.common.hw,
11508c2ecf20Sopenharmony_ci		[CLK_MMC2]		= &mmc2_clk.common.hw,
11518c2ecf20Sopenharmony_ci		[CLK_MMC3]		= &mmc3_clk.common.hw,
11528c2ecf20Sopenharmony_ci		[CLK_TS]		= &ts_clk.common.hw,
11538c2ecf20Sopenharmony_ci		[CLK_SS]		= &ss_clk.common.hw,
11548c2ecf20Sopenharmony_ci		[CLK_SPI0]		= &spi0_clk.common.hw,
11558c2ecf20Sopenharmony_ci		[CLK_SPI1]		= &spi1_clk.common.hw,
11568c2ecf20Sopenharmony_ci		[CLK_SPI2]		= &spi2_clk.common.hw,
11578c2ecf20Sopenharmony_ci		[CLK_PATA]		= &pata_clk.common.hw,
11588c2ecf20Sopenharmony_ci		[CLK_IR0]		= &ir0_sun4i_clk.common.hw,
11598c2ecf20Sopenharmony_ci		[CLK_IR1]		= &ir1_sun4i_clk.common.hw,
11608c2ecf20Sopenharmony_ci		[CLK_I2S0]		= &i2s0_clk.common.hw,
11618c2ecf20Sopenharmony_ci		[CLK_AC97]		= &ac97_clk.common.hw,
11628c2ecf20Sopenharmony_ci		[CLK_SPDIF]		= &spdif_clk.common.hw,
11638c2ecf20Sopenharmony_ci		[CLK_KEYPAD]		= &keypad_clk.common.hw,
11648c2ecf20Sopenharmony_ci		[CLK_SATA]		= &sata_clk.common.hw,
11658c2ecf20Sopenharmony_ci		[CLK_USB_OHCI0]		= &usb_ohci0_clk.common.hw,
11668c2ecf20Sopenharmony_ci		[CLK_USB_OHCI1]		= &usb_ohci1_clk.common.hw,
11678c2ecf20Sopenharmony_ci		[CLK_USB_PHY]		= &usb_phy_clk.common.hw,
11688c2ecf20Sopenharmony_ci		/* CLK_GPS is unimplemented */
11698c2ecf20Sopenharmony_ci		[CLK_SPI3]		= &spi3_clk.common.hw,
11708c2ecf20Sopenharmony_ci		[CLK_DRAM_VE]		= &dram_ve_clk.common.hw,
11718c2ecf20Sopenharmony_ci		[CLK_DRAM_CSI0]		= &dram_csi0_clk.common.hw,
11728c2ecf20Sopenharmony_ci		[CLK_DRAM_CSI1]		= &dram_csi1_clk.common.hw,
11738c2ecf20Sopenharmony_ci		[CLK_DRAM_TS]		= &dram_ts_clk.common.hw,
11748c2ecf20Sopenharmony_ci		[CLK_DRAM_TVD]		= &dram_tvd_clk.common.hw,
11758c2ecf20Sopenharmony_ci		[CLK_DRAM_TVE0]		= &dram_tve0_clk.common.hw,
11768c2ecf20Sopenharmony_ci		[CLK_DRAM_TVE1]		= &dram_tve1_clk.common.hw,
11778c2ecf20Sopenharmony_ci		[CLK_DRAM_OUT]		= &dram_out_clk.common.hw,
11788c2ecf20Sopenharmony_ci		[CLK_DRAM_DE_FE1]	= &dram_de_fe1_clk.common.hw,
11798c2ecf20Sopenharmony_ci		[CLK_DRAM_DE_FE0]	= &dram_de_fe0_clk.common.hw,
11808c2ecf20Sopenharmony_ci		[CLK_DRAM_DE_BE0]	= &dram_de_be0_clk.common.hw,
11818c2ecf20Sopenharmony_ci		[CLK_DRAM_DE_BE1]	= &dram_de_be1_clk.common.hw,
11828c2ecf20Sopenharmony_ci		[CLK_DRAM_MP]		= &dram_mp_clk.common.hw,
11838c2ecf20Sopenharmony_ci		[CLK_DRAM_ACE]		= &dram_ace_clk.common.hw,
11848c2ecf20Sopenharmony_ci		[CLK_DE_BE0]		= &de_be0_clk.common.hw,
11858c2ecf20Sopenharmony_ci		[CLK_DE_BE1]		= &de_be1_clk.common.hw,
11868c2ecf20Sopenharmony_ci		[CLK_DE_FE0]		= &de_fe0_clk.common.hw,
11878c2ecf20Sopenharmony_ci		[CLK_DE_FE1]		= &de_fe1_clk.common.hw,
11888c2ecf20Sopenharmony_ci		[CLK_DE_MP]		= &de_mp_clk.common.hw,
11898c2ecf20Sopenharmony_ci		[CLK_TCON0_CH0]		= &tcon0_ch0_clk.common.hw,
11908c2ecf20Sopenharmony_ci		[CLK_TCON1_CH0]		= &tcon1_ch0_clk.common.hw,
11918c2ecf20Sopenharmony_ci		[CLK_CSI_SCLK]		= &csi_sclk_clk.common.hw,
11928c2ecf20Sopenharmony_ci		[CLK_TVD]		= &tvd_sun4i_clk.common.hw,
11938c2ecf20Sopenharmony_ci		[CLK_TCON0_CH1_SCLK2]	= &tcon0_ch1_sclk2_clk.common.hw,
11948c2ecf20Sopenharmony_ci		[CLK_TCON0_CH1]		= &tcon0_ch1_clk.common.hw,
11958c2ecf20Sopenharmony_ci		[CLK_TCON1_CH1_SCLK2]	= &tcon1_ch1_sclk2_clk.common.hw,
11968c2ecf20Sopenharmony_ci		[CLK_TCON1_CH1]		= &tcon1_ch1_clk.common.hw,
11978c2ecf20Sopenharmony_ci		[CLK_CSI0]		= &csi0_clk.common.hw,
11988c2ecf20Sopenharmony_ci		[CLK_CSI1]		= &csi1_clk.common.hw,
11998c2ecf20Sopenharmony_ci		[CLK_VE]		= &ve_clk.common.hw,
12008c2ecf20Sopenharmony_ci		[CLK_CODEC]		= &codec_clk.common.hw,
12018c2ecf20Sopenharmony_ci		[CLK_AVS]		= &avs_clk.common.hw,
12028c2ecf20Sopenharmony_ci		[CLK_ACE]		= &ace_clk.common.hw,
12038c2ecf20Sopenharmony_ci		[CLK_HDMI]		= &hdmi_clk.common.hw,
12048c2ecf20Sopenharmony_ci		[CLK_GPU]		= &gpu_sun7i_clk.common.hw,
12058c2ecf20Sopenharmony_ci		[CLK_MBUS]		= &mbus_sun4i_clk.common.hw,
12068c2ecf20Sopenharmony_ci	},
12078c2ecf20Sopenharmony_ci	.num	= CLK_NUMBER_SUN4I,
12088c2ecf20Sopenharmony_ci};
12098c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun7i_a20_hw_clks = {
12108c2ecf20Sopenharmony_ci	.hws	= {
12118c2ecf20Sopenharmony_ci		[CLK_HOSC]		= &hosc_clk.common.hw,
12128c2ecf20Sopenharmony_ci		[CLK_PLL_CORE]		= &pll_core_clk.common.hw,
12138c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_BASE]	= &pll_audio_base_clk.common.hw,
12148c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO]		= &pll_audio_clk.hw,
12158c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_2X]	= &pll_audio_2x_clk.hw,
12168c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_4X]	= &pll_audio_4x_clk.hw,
12178c2ecf20Sopenharmony_ci		[CLK_PLL_AUDIO_8X]	= &pll_audio_8x_clk.hw,
12188c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO0]	= &pll_video0_clk.common.hw,
12198c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO0_2X]	= &pll_video0_2x_clk.hw,
12208c2ecf20Sopenharmony_ci		[CLK_PLL_VE]		= &pll_ve_sun7i_clk.common.hw,
12218c2ecf20Sopenharmony_ci		[CLK_PLL_DDR_BASE]	= &pll_ddr_base_clk.common.hw,
12228c2ecf20Sopenharmony_ci		[CLK_PLL_DDR]		= &pll_ddr_clk.common.hw,
12238c2ecf20Sopenharmony_ci		[CLK_PLL_DDR_OTHER]	= &pll_ddr_other_clk.common.hw,
12248c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH_BASE]	= &pll_periph_base_clk.common.hw,
12258c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH]	= &pll_periph_clk.hw,
12268c2ecf20Sopenharmony_ci		[CLK_PLL_PERIPH_SATA]	= &pll_periph_sata_clk.common.hw,
12278c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO1]	= &pll_video1_clk.common.hw,
12288c2ecf20Sopenharmony_ci		[CLK_PLL_VIDEO1_2X]	= &pll_video1_2x_clk.hw,
12298c2ecf20Sopenharmony_ci		[CLK_PLL_GPU]		= &pll_gpu_clk.common.hw,
12308c2ecf20Sopenharmony_ci		[CLK_CPU]		= &cpu_clk.common.hw,
12318c2ecf20Sopenharmony_ci		[CLK_AXI]		= &axi_clk.common.hw,
12328c2ecf20Sopenharmony_ci		[CLK_AHB]		= &ahb_sun7i_clk.common.hw,
12338c2ecf20Sopenharmony_ci		[CLK_APB0]		= &apb0_clk.common.hw,
12348c2ecf20Sopenharmony_ci		[CLK_APB1]		= &apb1_clk.common.hw,
12358c2ecf20Sopenharmony_ci		[CLK_AHB_OTG]		= &ahb_otg_clk.common.hw,
12368c2ecf20Sopenharmony_ci		[CLK_AHB_EHCI0]		= &ahb_ehci0_clk.common.hw,
12378c2ecf20Sopenharmony_ci		[CLK_AHB_OHCI0]		= &ahb_ohci0_clk.common.hw,
12388c2ecf20Sopenharmony_ci		[CLK_AHB_EHCI1]		= &ahb_ehci1_clk.common.hw,
12398c2ecf20Sopenharmony_ci		[CLK_AHB_OHCI1]		= &ahb_ohci1_clk.common.hw,
12408c2ecf20Sopenharmony_ci		[CLK_AHB_SS]		= &ahb_ss_clk.common.hw,
12418c2ecf20Sopenharmony_ci		[CLK_AHB_DMA]		= &ahb_dma_clk.common.hw,
12428c2ecf20Sopenharmony_ci		[CLK_AHB_BIST]		= &ahb_bist_clk.common.hw,
12438c2ecf20Sopenharmony_ci		[CLK_AHB_MMC0]		= &ahb_mmc0_clk.common.hw,
12448c2ecf20Sopenharmony_ci		[CLK_AHB_MMC1]		= &ahb_mmc1_clk.common.hw,
12458c2ecf20Sopenharmony_ci		[CLK_AHB_MMC2]		= &ahb_mmc2_clk.common.hw,
12468c2ecf20Sopenharmony_ci		[CLK_AHB_MMC3]		= &ahb_mmc3_clk.common.hw,
12478c2ecf20Sopenharmony_ci		[CLK_AHB_MS]		= &ahb_ms_clk.common.hw,
12488c2ecf20Sopenharmony_ci		[CLK_AHB_NAND]		= &ahb_nand_clk.common.hw,
12498c2ecf20Sopenharmony_ci		[CLK_AHB_SDRAM]		= &ahb_sdram_clk.common.hw,
12508c2ecf20Sopenharmony_ci		[CLK_AHB_ACE]		= &ahb_ace_clk.common.hw,
12518c2ecf20Sopenharmony_ci		[CLK_AHB_EMAC]		= &ahb_emac_clk.common.hw,
12528c2ecf20Sopenharmony_ci		[CLK_AHB_TS]		= &ahb_ts_clk.common.hw,
12538c2ecf20Sopenharmony_ci		[CLK_AHB_SPI0]		= &ahb_spi0_clk.common.hw,
12548c2ecf20Sopenharmony_ci		[CLK_AHB_SPI1]		= &ahb_spi1_clk.common.hw,
12558c2ecf20Sopenharmony_ci		[CLK_AHB_SPI2]		= &ahb_spi2_clk.common.hw,
12568c2ecf20Sopenharmony_ci		[CLK_AHB_SPI3]		= &ahb_spi3_clk.common.hw,
12578c2ecf20Sopenharmony_ci		[CLK_AHB_PATA]		= &ahb_pata_clk.common.hw,
12588c2ecf20Sopenharmony_ci		[CLK_AHB_SATA]		= &ahb_sata_clk.common.hw,
12598c2ecf20Sopenharmony_ci		[CLK_AHB_HSTIMER]	= &ahb_hstimer_clk.common.hw,
12608c2ecf20Sopenharmony_ci		[CLK_AHB_VE]		= &ahb_ve_clk.common.hw,
12618c2ecf20Sopenharmony_ci		[CLK_AHB_TVD]		= &ahb_tvd_clk.common.hw,
12628c2ecf20Sopenharmony_ci		[CLK_AHB_TVE0]		= &ahb_tve0_clk.common.hw,
12638c2ecf20Sopenharmony_ci		[CLK_AHB_TVE1]		= &ahb_tve1_clk.common.hw,
12648c2ecf20Sopenharmony_ci		[CLK_AHB_LCD0]		= &ahb_lcd0_clk.common.hw,
12658c2ecf20Sopenharmony_ci		[CLK_AHB_LCD1]		= &ahb_lcd1_clk.common.hw,
12668c2ecf20Sopenharmony_ci		[CLK_AHB_CSI0]		= &ahb_csi0_clk.common.hw,
12678c2ecf20Sopenharmony_ci		[CLK_AHB_CSI1]		= &ahb_csi1_clk.common.hw,
12688c2ecf20Sopenharmony_ci		[CLK_AHB_HDMI1]		= &ahb_hdmi1_clk.common.hw,
12698c2ecf20Sopenharmony_ci		[CLK_AHB_HDMI0]		= &ahb_hdmi0_clk.common.hw,
12708c2ecf20Sopenharmony_ci		[CLK_AHB_DE_BE0]	= &ahb_de_be0_clk.common.hw,
12718c2ecf20Sopenharmony_ci		[CLK_AHB_DE_BE1]	= &ahb_de_be1_clk.common.hw,
12728c2ecf20Sopenharmony_ci		[CLK_AHB_DE_FE0]	= &ahb_de_fe0_clk.common.hw,
12738c2ecf20Sopenharmony_ci		[CLK_AHB_DE_FE1]	= &ahb_de_fe1_clk.common.hw,
12748c2ecf20Sopenharmony_ci		[CLK_AHB_GMAC]		= &ahb_gmac_clk.common.hw,
12758c2ecf20Sopenharmony_ci		[CLK_AHB_MP]		= &ahb_mp_clk.common.hw,
12768c2ecf20Sopenharmony_ci		[CLK_AHB_GPU]		= &ahb_gpu_clk.common.hw,
12778c2ecf20Sopenharmony_ci		[CLK_APB0_CODEC]	= &apb0_codec_clk.common.hw,
12788c2ecf20Sopenharmony_ci		[CLK_APB0_SPDIF]	= &apb0_spdif_clk.common.hw,
12798c2ecf20Sopenharmony_ci		[CLK_APB0_AC97]		= &apb0_ac97_clk.common.hw,
12808c2ecf20Sopenharmony_ci		[CLK_APB0_I2S0]		= &apb0_i2s0_clk.common.hw,
12818c2ecf20Sopenharmony_ci		[CLK_APB0_I2S1]		= &apb0_i2s1_clk.common.hw,
12828c2ecf20Sopenharmony_ci		[CLK_APB0_PIO]		= &apb0_pio_clk.common.hw,
12838c2ecf20Sopenharmony_ci		[CLK_APB0_IR0]		= &apb0_ir0_clk.common.hw,
12848c2ecf20Sopenharmony_ci		[CLK_APB0_IR1]		= &apb0_ir1_clk.common.hw,
12858c2ecf20Sopenharmony_ci		[CLK_APB0_I2S2]		= &apb0_i2s2_clk.common.hw,
12868c2ecf20Sopenharmony_ci		[CLK_APB0_KEYPAD]	= &apb0_keypad_clk.common.hw,
12878c2ecf20Sopenharmony_ci		[CLK_APB1_I2C0]		= &apb1_i2c0_clk.common.hw,
12888c2ecf20Sopenharmony_ci		[CLK_APB1_I2C1]		= &apb1_i2c1_clk.common.hw,
12898c2ecf20Sopenharmony_ci		[CLK_APB1_I2C2]		= &apb1_i2c2_clk.common.hw,
12908c2ecf20Sopenharmony_ci		[CLK_APB1_I2C3]		= &apb1_i2c3_clk.common.hw,
12918c2ecf20Sopenharmony_ci		[CLK_APB1_CAN]		= &apb1_can_clk.common.hw,
12928c2ecf20Sopenharmony_ci		[CLK_APB1_SCR]		= &apb1_scr_clk.common.hw,
12938c2ecf20Sopenharmony_ci		[CLK_APB1_PS20]		= &apb1_ps20_clk.common.hw,
12948c2ecf20Sopenharmony_ci		[CLK_APB1_PS21]		= &apb1_ps21_clk.common.hw,
12958c2ecf20Sopenharmony_ci		[CLK_APB1_I2C4]		= &apb1_i2c4_clk.common.hw,
12968c2ecf20Sopenharmony_ci		[CLK_APB1_UART0]	= &apb1_uart0_clk.common.hw,
12978c2ecf20Sopenharmony_ci		[CLK_APB1_UART1]	= &apb1_uart1_clk.common.hw,
12988c2ecf20Sopenharmony_ci		[CLK_APB1_UART2]	= &apb1_uart2_clk.common.hw,
12998c2ecf20Sopenharmony_ci		[CLK_APB1_UART3]	= &apb1_uart3_clk.common.hw,
13008c2ecf20Sopenharmony_ci		[CLK_APB1_UART4]	= &apb1_uart4_clk.common.hw,
13018c2ecf20Sopenharmony_ci		[CLK_APB1_UART5]	= &apb1_uart5_clk.common.hw,
13028c2ecf20Sopenharmony_ci		[CLK_APB1_UART6]	= &apb1_uart6_clk.common.hw,
13038c2ecf20Sopenharmony_ci		[CLK_APB1_UART7]	= &apb1_uart7_clk.common.hw,
13048c2ecf20Sopenharmony_ci		[CLK_NAND]		= &nand_clk.common.hw,
13058c2ecf20Sopenharmony_ci		[CLK_MS]		= &ms_clk.common.hw,
13068c2ecf20Sopenharmony_ci		[CLK_MMC0]		= &mmc0_clk.common.hw,
13078c2ecf20Sopenharmony_ci		[CLK_MMC0_OUTPUT]	= &mmc0_output_clk.common.hw,
13088c2ecf20Sopenharmony_ci		[CLK_MMC0_SAMPLE]	= &mmc0_sample_clk.common.hw,
13098c2ecf20Sopenharmony_ci		[CLK_MMC1]		= &mmc1_clk.common.hw,
13108c2ecf20Sopenharmony_ci		[CLK_MMC1_OUTPUT]	= &mmc1_output_clk.common.hw,
13118c2ecf20Sopenharmony_ci		[CLK_MMC1_SAMPLE]	= &mmc1_sample_clk.common.hw,
13128c2ecf20Sopenharmony_ci		[CLK_MMC2]		= &mmc2_clk.common.hw,
13138c2ecf20Sopenharmony_ci		[CLK_MMC2_OUTPUT]	= &mmc2_output_clk.common.hw,
13148c2ecf20Sopenharmony_ci		[CLK_MMC2_SAMPLE]	= &mmc2_sample_clk.common.hw,
13158c2ecf20Sopenharmony_ci		[CLK_MMC3]		= &mmc3_clk.common.hw,
13168c2ecf20Sopenharmony_ci		[CLK_MMC3_OUTPUT]	= &mmc3_output_clk.common.hw,
13178c2ecf20Sopenharmony_ci		[CLK_MMC3_SAMPLE]	= &mmc3_sample_clk.common.hw,
13188c2ecf20Sopenharmony_ci		[CLK_TS]		= &ts_clk.common.hw,
13198c2ecf20Sopenharmony_ci		[CLK_SS]		= &ss_clk.common.hw,
13208c2ecf20Sopenharmony_ci		[CLK_SPI0]		= &spi0_clk.common.hw,
13218c2ecf20Sopenharmony_ci		[CLK_SPI1]		= &spi1_clk.common.hw,
13228c2ecf20Sopenharmony_ci		[CLK_SPI2]		= &spi2_clk.common.hw,
13238c2ecf20Sopenharmony_ci		[CLK_PATA]		= &pata_clk.common.hw,
13248c2ecf20Sopenharmony_ci		[CLK_IR0]		= &ir0_sun7i_clk.common.hw,
13258c2ecf20Sopenharmony_ci		[CLK_IR1]		= &ir1_sun7i_clk.common.hw,
13268c2ecf20Sopenharmony_ci		[CLK_I2S0]		= &i2s0_clk.common.hw,
13278c2ecf20Sopenharmony_ci		[CLK_AC97]		= &ac97_clk.common.hw,
13288c2ecf20Sopenharmony_ci		[CLK_SPDIF]		= &spdif_clk.common.hw,
13298c2ecf20Sopenharmony_ci		[CLK_KEYPAD]		= &keypad_clk.common.hw,
13308c2ecf20Sopenharmony_ci		[CLK_SATA]		= &sata_clk.common.hw,
13318c2ecf20Sopenharmony_ci		[CLK_USB_OHCI0]		= &usb_ohci0_clk.common.hw,
13328c2ecf20Sopenharmony_ci		[CLK_USB_OHCI1]		= &usb_ohci1_clk.common.hw,
13338c2ecf20Sopenharmony_ci		[CLK_USB_PHY]		= &usb_phy_clk.common.hw,
13348c2ecf20Sopenharmony_ci		/* CLK_GPS is unimplemented */
13358c2ecf20Sopenharmony_ci		[CLK_SPI3]		= &spi3_clk.common.hw,
13368c2ecf20Sopenharmony_ci		[CLK_I2S1]		= &i2s1_clk.common.hw,
13378c2ecf20Sopenharmony_ci		[CLK_I2S2]		= &i2s2_clk.common.hw,
13388c2ecf20Sopenharmony_ci		[CLK_DRAM_VE]		= &dram_ve_clk.common.hw,
13398c2ecf20Sopenharmony_ci		[CLK_DRAM_CSI0]		= &dram_csi0_clk.common.hw,
13408c2ecf20Sopenharmony_ci		[CLK_DRAM_CSI1]		= &dram_csi1_clk.common.hw,
13418c2ecf20Sopenharmony_ci		[CLK_DRAM_TS]		= &dram_ts_clk.common.hw,
13428c2ecf20Sopenharmony_ci		[CLK_DRAM_TVD]		= &dram_tvd_clk.common.hw,
13438c2ecf20Sopenharmony_ci		[CLK_DRAM_TVE0]		= &dram_tve0_clk.common.hw,
13448c2ecf20Sopenharmony_ci		[CLK_DRAM_TVE1]		= &dram_tve1_clk.common.hw,
13458c2ecf20Sopenharmony_ci		[CLK_DRAM_OUT]		= &dram_out_clk.common.hw,
13468c2ecf20Sopenharmony_ci		[CLK_DRAM_DE_FE1]	= &dram_de_fe1_clk.common.hw,
13478c2ecf20Sopenharmony_ci		[CLK_DRAM_DE_FE0]	= &dram_de_fe0_clk.common.hw,
13488c2ecf20Sopenharmony_ci		[CLK_DRAM_DE_BE0]	= &dram_de_be0_clk.common.hw,
13498c2ecf20Sopenharmony_ci		[CLK_DRAM_DE_BE1]	= &dram_de_be1_clk.common.hw,
13508c2ecf20Sopenharmony_ci		[CLK_DRAM_MP]		= &dram_mp_clk.common.hw,
13518c2ecf20Sopenharmony_ci		[CLK_DRAM_ACE]		= &dram_ace_clk.common.hw,
13528c2ecf20Sopenharmony_ci		[CLK_DE_BE0]		= &de_be0_clk.common.hw,
13538c2ecf20Sopenharmony_ci		[CLK_DE_BE1]		= &de_be1_clk.common.hw,
13548c2ecf20Sopenharmony_ci		[CLK_DE_FE0]		= &de_fe0_clk.common.hw,
13558c2ecf20Sopenharmony_ci		[CLK_DE_FE1]		= &de_fe1_clk.common.hw,
13568c2ecf20Sopenharmony_ci		[CLK_DE_MP]		= &de_mp_clk.common.hw,
13578c2ecf20Sopenharmony_ci		[CLK_TCON0_CH0]		= &tcon0_ch0_clk.common.hw,
13588c2ecf20Sopenharmony_ci		[CLK_TCON1_CH0]		= &tcon1_ch0_clk.common.hw,
13598c2ecf20Sopenharmony_ci		[CLK_CSI_SCLK]		= &csi_sclk_clk.common.hw,
13608c2ecf20Sopenharmony_ci		[CLK_TVD_SCLK2]		= &tvd_sclk2_sun7i_clk.common.hw,
13618c2ecf20Sopenharmony_ci		[CLK_TVD]		= &tvd_sclk1_sun7i_clk.common.hw,
13628c2ecf20Sopenharmony_ci		[CLK_TCON0_CH1_SCLK2]	= &tcon0_ch1_sclk2_clk.common.hw,
13638c2ecf20Sopenharmony_ci		[CLK_TCON0_CH1]		= &tcon0_ch1_clk.common.hw,
13648c2ecf20Sopenharmony_ci		[CLK_TCON1_CH1_SCLK2]	= &tcon1_ch1_sclk2_clk.common.hw,
13658c2ecf20Sopenharmony_ci		[CLK_TCON1_CH1]		= &tcon1_ch1_clk.common.hw,
13668c2ecf20Sopenharmony_ci		[CLK_CSI0]		= &csi0_clk.common.hw,
13678c2ecf20Sopenharmony_ci		[CLK_CSI1]		= &csi1_clk.common.hw,
13688c2ecf20Sopenharmony_ci		[CLK_VE]		= &ve_clk.common.hw,
13698c2ecf20Sopenharmony_ci		[CLK_CODEC]		= &codec_clk.common.hw,
13708c2ecf20Sopenharmony_ci		[CLK_AVS]		= &avs_clk.common.hw,
13718c2ecf20Sopenharmony_ci		[CLK_ACE]		= &ace_clk.common.hw,
13728c2ecf20Sopenharmony_ci		[CLK_HDMI]		= &hdmi_clk.common.hw,
13738c2ecf20Sopenharmony_ci		[CLK_GPU]		= &gpu_sun7i_clk.common.hw,
13748c2ecf20Sopenharmony_ci		[CLK_MBUS]		= &mbus_sun7i_clk.common.hw,
13758c2ecf20Sopenharmony_ci		[CLK_HDMI1_SLOW]	= &hdmi1_slow_clk.common.hw,
13768c2ecf20Sopenharmony_ci		[CLK_HDMI1]		= &hdmi1_clk.common.hw,
13778c2ecf20Sopenharmony_ci		[CLK_OUT_A]		= &out_a_clk.common.hw,
13788c2ecf20Sopenharmony_ci		[CLK_OUT_B]		= &out_b_clk.common.hw,
13798c2ecf20Sopenharmony_ci	},
13808c2ecf20Sopenharmony_ci	.num	= CLK_NUMBER_SUN7I,
13818c2ecf20Sopenharmony_ci};
13828c2ecf20Sopenharmony_ci
13838c2ecf20Sopenharmony_cistatic struct ccu_reset_map sunxi_a10_a20_ccu_resets[] = {
13848c2ecf20Sopenharmony_ci	[RST_USB_PHY0]		= { 0x0cc, BIT(0) },
13858c2ecf20Sopenharmony_ci	[RST_USB_PHY1]		= { 0x0cc, BIT(1) },
13868c2ecf20Sopenharmony_ci	[RST_USB_PHY2]		= { 0x0cc, BIT(2) },
13878c2ecf20Sopenharmony_ci	[RST_GPS]		= { 0x0d0, BIT(0) },
13888c2ecf20Sopenharmony_ci	[RST_DE_BE0]		= { 0x104, BIT(30) },
13898c2ecf20Sopenharmony_ci	[RST_DE_BE1]		= { 0x108, BIT(30) },
13908c2ecf20Sopenharmony_ci	[RST_DE_FE0]		= { 0x10c, BIT(30) },
13918c2ecf20Sopenharmony_ci	[RST_DE_FE1]		= { 0x110, BIT(30) },
13928c2ecf20Sopenharmony_ci	[RST_DE_MP]		= { 0x114, BIT(30) },
13938c2ecf20Sopenharmony_ci	[RST_TVE0]		= { 0x118, BIT(29) },
13948c2ecf20Sopenharmony_ci	[RST_TCON0]		= { 0x118, BIT(30) },
13958c2ecf20Sopenharmony_ci	[RST_TVE1]		= { 0x11c, BIT(29) },
13968c2ecf20Sopenharmony_ci	[RST_TCON1]		= { 0x11c, BIT(30) },
13978c2ecf20Sopenharmony_ci	[RST_CSI0]		= { 0x134, BIT(30) },
13988c2ecf20Sopenharmony_ci	[RST_CSI1]		= { 0x138, BIT(30) },
13998c2ecf20Sopenharmony_ci	[RST_VE]		= { 0x13c, BIT(0) },
14008c2ecf20Sopenharmony_ci	[RST_ACE]		= { 0x148, BIT(16) },
14018c2ecf20Sopenharmony_ci	[RST_LVDS]		= { 0x14c, BIT(0) },
14028c2ecf20Sopenharmony_ci	[RST_GPU]		= { 0x154, BIT(30) },
14038c2ecf20Sopenharmony_ci	[RST_HDMI_H]		= { 0x170, BIT(0) },
14048c2ecf20Sopenharmony_ci	[RST_HDMI_SYS]		= { 0x170, BIT(1) },
14058c2ecf20Sopenharmony_ci	[RST_HDMI_AUDIO_DMA]	= { 0x170, BIT(2) },
14068c2ecf20Sopenharmony_ci};
14078c2ecf20Sopenharmony_ci
14088c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun4i_a10_ccu_desc = {
14098c2ecf20Sopenharmony_ci	.ccu_clks	= sun4i_sun7i_ccu_clks,
14108c2ecf20Sopenharmony_ci	.num_ccu_clks	= ARRAY_SIZE(sun4i_sun7i_ccu_clks),
14118c2ecf20Sopenharmony_ci
14128c2ecf20Sopenharmony_ci	.hw_clks	= &sun4i_a10_hw_clks,
14138c2ecf20Sopenharmony_ci
14148c2ecf20Sopenharmony_ci	.resets		= sunxi_a10_a20_ccu_resets,
14158c2ecf20Sopenharmony_ci	.num_resets	= ARRAY_SIZE(sunxi_a10_a20_ccu_resets),
14168c2ecf20Sopenharmony_ci};
14178c2ecf20Sopenharmony_ci
14188c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun7i_a20_ccu_desc = {
14198c2ecf20Sopenharmony_ci	.ccu_clks	= sun4i_sun7i_ccu_clks,
14208c2ecf20Sopenharmony_ci	.num_ccu_clks	= ARRAY_SIZE(sun4i_sun7i_ccu_clks),
14218c2ecf20Sopenharmony_ci
14228c2ecf20Sopenharmony_ci	.hw_clks	= &sun7i_a20_hw_clks,
14238c2ecf20Sopenharmony_ci
14248c2ecf20Sopenharmony_ci	.resets		= sunxi_a10_a20_ccu_resets,
14258c2ecf20Sopenharmony_ci	.num_resets	= ARRAY_SIZE(sunxi_a10_a20_ccu_resets),
14268c2ecf20Sopenharmony_ci};
14278c2ecf20Sopenharmony_ci
14288c2ecf20Sopenharmony_cistatic void __init sun4i_ccu_init(struct device_node *node,
14298c2ecf20Sopenharmony_ci				  const struct sunxi_ccu_desc *desc)
14308c2ecf20Sopenharmony_ci{
14318c2ecf20Sopenharmony_ci	void __iomem *reg;
14328c2ecf20Sopenharmony_ci	u32 val;
14338c2ecf20Sopenharmony_ci
14348c2ecf20Sopenharmony_ci	reg = of_io_request_and_map(node, 0, of_node_full_name(node));
14358c2ecf20Sopenharmony_ci	if (IS_ERR(reg)) {
14368c2ecf20Sopenharmony_ci		pr_err("%s: Could not map the clock registers\n",
14378c2ecf20Sopenharmony_ci		       of_node_full_name(node));
14388c2ecf20Sopenharmony_ci		return;
14398c2ecf20Sopenharmony_ci	}
14408c2ecf20Sopenharmony_ci
14418c2ecf20Sopenharmony_ci	val = readl(reg + SUN4I_PLL_AUDIO_REG);
14428c2ecf20Sopenharmony_ci
14438c2ecf20Sopenharmony_ci	/*
14448c2ecf20Sopenharmony_ci	 * Force VCO and PLL bias current to lowest setting. Higher
14458c2ecf20Sopenharmony_ci	 * settings interfere with sigma-delta modulation and result
14468c2ecf20Sopenharmony_ci	 * in audible noise and distortions when using SPDIF or I2S.
14478c2ecf20Sopenharmony_ci	 */
14488c2ecf20Sopenharmony_ci	val &= ~GENMASK(25, 16);
14498c2ecf20Sopenharmony_ci
14508c2ecf20Sopenharmony_ci	/* Force the PLL-Audio-1x divider to 1 */
14518c2ecf20Sopenharmony_ci	val &= ~GENMASK(29, 26);
14528c2ecf20Sopenharmony_ci	writel(val | (1 << 26), reg + SUN4I_PLL_AUDIO_REG);
14538c2ecf20Sopenharmony_ci
14548c2ecf20Sopenharmony_ci	/*
14558c2ecf20Sopenharmony_ci	 * Use the peripheral PLL6 as the AHB parent, instead of CPU /
14568c2ecf20Sopenharmony_ci	 * AXI which have rate changes due to cpufreq.
14578c2ecf20Sopenharmony_ci	 *
14588c2ecf20Sopenharmony_ci	 * This is especially a big deal for the HS timer whose parent
14598c2ecf20Sopenharmony_ci	 * clock is AHB.
14608c2ecf20Sopenharmony_ci	 *
14618c2ecf20Sopenharmony_ci	 * NB! These bits are undocumented in A10 manual.
14628c2ecf20Sopenharmony_ci	 */
14638c2ecf20Sopenharmony_ci	val = readl(reg + SUN4I_AHB_REG);
14648c2ecf20Sopenharmony_ci	val &= ~GENMASK(7, 6);
14658c2ecf20Sopenharmony_ci	writel(val | (2 << 6), reg + SUN4I_AHB_REG);
14668c2ecf20Sopenharmony_ci
14678c2ecf20Sopenharmony_ci	sunxi_ccu_probe(node, reg, desc);
14688c2ecf20Sopenharmony_ci}
14698c2ecf20Sopenharmony_ci
14708c2ecf20Sopenharmony_cistatic void __init sun4i_a10_ccu_setup(struct device_node *node)
14718c2ecf20Sopenharmony_ci{
14728c2ecf20Sopenharmony_ci	sun4i_ccu_init(node, &sun4i_a10_ccu_desc);
14738c2ecf20Sopenharmony_ci}
14748c2ecf20Sopenharmony_ciCLK_OF_DECLARE(sun4i_a10_ccu, "allwinner,sun4i-a10-ccu",
14758c2ecf20Sopenharmony_ci	       sun4i_a10_ccu_setup);
14768c2ecf20Sopenharmony_ci
14778c2ecf20Sopenharmony_cistatic void __init sun7i_a20_ccu_setup(struct device_node *node)
14788c2ecf20Sopenharmony_ci{
14798c2ecf20Sopenharmony_ci	sun4i_ccu_init(node, &sun7i_a20_ccu_desc);
14808c2ecf20Sopenharmony_ci}
14818c2ecf20Sopenharmony_ciCLK_OF_DECLARE(sun7i_a20_ccu, "allwinner,sun7i-a20-ccu",
14828c2ecf20Sopenharmony_ci	       sun7i_a20_ccu_setup);
1483