18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2016 Rockchip Electronics Co. Ltd.
48c2ecf20Sopenharmony_ci * Author: Elaine <zhangqing@rock-chips.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <linux/clk-provider.h>
88c2ecf20Sopenharmony_ci#include <linux/io.h>
98c2ecf20Sopenharmony_ci#include <linux/of.h>
108c2ecf20Sopenharmony_ci#include <linux/of_address.h>
118c2ecf20Sopenharmony_ci#include <linux/syscore_ops.h>
128c2ecf20Sopenharmony_ci#include <dt-bindings/clock/rk3328-cru.h>
138c2ecf20Sopenharmony_ci#include "clk.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define RK3328_GRF_SOC_CON4		0x410
168c2ecf20Sopenharmony_ci#define RK3328_GRF_SOC_STATUS0		0x480
178c2ecf20Sopenharmony_ci#define RK3328_GRF_MAC_CON1		0x904
188c2ecf20Sopenharmony_ci#define RK3328_GRF_MAC_CON2		0x908
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cienum rk3328_plls {
218c2ecf20Sopenharmony_ci	apll, dpll, cpll, gpll, npll,
228c2ecf20Sopenharmony_ci};
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistatic struct rockchip_pll_rate_table rk3328_pll_rates[] = {
258c2ecf20Sopenharmony_ci	/* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */
268c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1608000000, 1, 67, 1, 1, 1, 0),
278c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1584000000, 1, 66, 1, 1, 1, 0),
288c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1560000000, 1, 65, 1, 1, 1, 0),
298c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1536000000, 1, 64, 1, 1, 1, 0),
308c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1512000000, 1, 63, 1, 1, 1, 0),
318c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1488000000, 1, 62, 1, 1, 1, 0),
328c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1464000000, 1, 61, 1, 1, 1, 0),
338c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1440000000, 1, 60, 1, 1, 1, 0),
348c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1416000000, 1, 59, 1, 1, 1, 0),
358c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1392000000, 1, 58, 1, 1, 1, 0),
368c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1368000000, 1, 57, 1, 1, 1, 0),
378c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1344000000, 1, 56, 1, 1, 1, 0),
388c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1320000000, 1, 55, 1, 1, 1, 0),
398c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1296000000, 1, 54, 1, 1, 1, 0),
408c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1272000000, 1, 53, 1, 1, 1, 0),
418c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1248000000, 1, 52, 1, 1, 1, 0),
428c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1200000000, 1, 50, 1, 1, 1, 0),
438c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1188000000, 2, 99, 1, 1, 1, 0),
448c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1104000000, 1, 46, 1, 1, 1, 0),
458c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1100000000, 12, 550, 1, 1, 1, 0),
468c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1008000000, 1, 84, 2, 1, 1, 0),
478c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1000000000, 6, 500, 2, 1, 1, 0),
488c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(984000000, 1, 82, 2, 1, 1, 0),
498c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(960000000, 1, 80, 2, 1, 1, 0),
508c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(936000000, 1, 78, 2, 1, 1, 0),
518c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(912000000, 1, 76, 2, 1, 1, 0),
528c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(900000000, 4, 300, 2, 1, 1, 0),
538c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(888000000, 1, 74, 2, 1, 1, 0),
548c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(864000000, 1, 72, 2, 1, 1, 0),
558c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(840000000, 1, 70, 2, 1, 1, 0),
568c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(816000000, 1, 68, 2, 1, 1, 0),
578c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(800000000, 6, 400, 2, 1, 1, 0),
588c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(700000000, 6, 350, 2, 1, 1, 0),
598c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(696000000, 1, 58, 2, 1, 1, 0),
608c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(600000000, 1, 75, 3, 1, 1, 0),
618c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(594000000, 2, 99, 2, 1, 1, 0),
628c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(504000000, 1, 63, 3, 1, 1, 0),
638c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(500000000, 6, 250, 2, 1, 1, 0),
648c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(408000000, 1, 68, 2, 2, 1, 0),
658c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(312000000, 1, 52, 2, 2, 1, 0),
668c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(216000000, 1, 72, 4, 2, 1, 0),
678c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(96000000, 1, 64, 4, 4, 1, 0),
688c2ecf20Sopenharmony_ci	{ /* sentinel */ },
698c2ecf20Sopenharmony_ci};
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistatic struct rockchip_pll_rate_table rk3328_pll_frac_rates[] = {
728c2ecf20Sopenharmony_ci	/* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */
738c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(1016064000, 3, 127, 1, 1, 0, 134218),
748c2ecf20Sopenharmony_ci	/* vco = 1016064000 */
758c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(983040000, 24, 983, 1, 1, 0, 671089),
768c2ecf20Sopenharmony_ci	/* vco = 983040000 */
778c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(491520000, 24, 983, 2, 1, 0, 671089),
788c2ecf20Sopenharmony_ci	/* vco = 983040000 */
798c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(61440000, 6, 215, 7, 2, 0, 671089),
808c2ecf20Sopenharmony_ci	/* vco = 860156000 */
818c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(56448000, 12, 451, 4, 4, 0, 9797895),
828c2ecf20Sopenharmony_ci	/* vco = 903168000 */
838c2ecf20Sopenharmony_ci	RK3036_PLL_RATE(40960000, 12, 409, 4, 5, 0, 10066330),
848c2ecf20Sopenharmony_ci	/* vco = 819200000 */
858c2ecf20Sopenharmony_ci	{ /* sentinel */ },
868c2ecf20Sopenharmony_ci};
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#define RK3328_DIV_ACLKM_MASK		0x7
898c2ecf20Sopenharmony_ci#define RK3328_DIV_ACLKM_SHIFT		4
908c2ecf20Sopenharmony_ci#define RK3328_DIV_PCLK_DBG_MASK	0xf
918c2ecf20Sopenharmony_ci#define RK3328_DIV_PCLK_DBG_SHIFT	0
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define RK3328_CLKSEL1(_aclk_core, _pclk_dbg)				\
948c2ecf20Sopenharmony_ci{									\
958c2ecf20Sopenharmony_ci	.reg = RK3328_CLKSEL_CON(1),					\
968c2ecf20Sopenharmony_ci	.val = HIWORD_UPDATE(_aclk_core, RK3328_DIV_ACLKM_MASK,		\
978c2ecf20Sopenharmony_ci			     RK3328_DIV_ACLKM_SHIFT) |			\
988c2ecf20Sopenharmony_ci	       HIWORD_UPDATE(_pclk_dbg, RK3328_DIV_PCLK_DBG_MASK,	\
998c2ecf20Sopenharmony_ci			     RK3328_DIV_PCLK_DBG_SHIFT),		\
1008c2ecf20Sopenharmony_ci}
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci#define RK3328_CPUCLK_RATE(_prate, _aclk_core, _pclk_dbg)		\
1038c2ecf20Sopenharmony_ci{									\
1048c2ecf20Sopenharmony_ci	.prate = _prate,						\
1058c2ecf20Sopenharmony_ci	.divs = {							\
1068c2ecf20Sopenharmony_ci		RK3328_CLKSEL1(_aclk_core, _pclk_dbg),			\
1078c2ecf20Sopenharmony_ci	},								\
1088c2ecf20Sopenharmony_ci}
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_cistatic struct rockchip_cpuclk_rate_table rk3328_cpuclk_rates[] __initdata = {
1118c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(1800000000, 1, 7),
1128c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(1704000000, 1, 7),
1138c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(1608000000, 1, 7),
1148c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(1512000000, 1, 7),
1158c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(1488000000, 1, 5),
1168c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(1416000000, 1, 5),
1178c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(1392000000, 1, 5),
1188c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(1296000000, 1, 5),
1198c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(1200000000, 1, 5),
1208c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(1104000000, 1, 5),
1218c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(1008000000, 1, 5),
1228c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(912000000, 1, 5),
1238c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(816000000, 1, 3),
1248c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(696000000, 1, 3),
1258c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(600000000, 1, 3),
1268c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(408000000, 1, 1),
1278c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(312000000, 1, 1),
1288c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(216000000,  1, 1),
1298c2ecf20Sopenharmony_ci	RK3328_CPUCLK_RATE(96000000, 1, 1),
1308c2ecf20Sopenharmony_ci};
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_cistatic const struct rockchip_cpuclk_reg_data rk3328_cpuclk_data = {
1338c2ecf20Sopenharmony_ci	.core_reg = RK3328_CLKSEL_CON(0),
1348c2ecf20Sopenharmony_ci	.div_core_shift = 0,
1358c2ecf20Sopenharmony_ci	.div_core_mask = 0x1f,
1368c2ecf20Sopenharmony_ci	.mux_core_alt = 1,
1378c2ecf20Sopenharmony_ci	.mux_core_main = 3,
1388c2ecf20Sopenharmony_ci	.mux_core_shift = 6,
1398c2ecf20Sopenharmony_ci	.mux_core_mask = 0x3,
1408c2ecf20Sopenharmony_ci};
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ciPNAME(mux_pll_p)		= { "xin24m" };
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ciPNAME(mux_2plls_p)		= { "cpll", "gpll" };
1458c2ecf20Sopenharmony_ciPNAME(mux_gpll_cpll_p)		= { "gpll", "cpll" };
1468c2ecf20Sopenharmony_ciPNAME(mux_cpll_gpll_apll_p)	= { "cpll", "gpll", "apll" };
1478c2ecf20Sopenharmony_ciPNAME(mux_2plls_xin24m_p)	= { "cpll", "gpll", "xin24m" };
1488c2ecf20Sopenharmony_ciPNAME(mux_2plls_hdmiphy_p)	= { "cpll", "gpll",
1498c2ecf20Sopenharmony_ci				    "dummy_hdmiphy" };
1508c2ecf20Sopenharmony_ciPNAME(mux_4plls_p)		= { "cpll", "gpll",
1518c2ecf20Sopenharmony_ci				    "dummy_hdmiphy",
1528c2ecf20Sopenharmony_ci				    "usb480m" };
1538c2ecf20Sopenharmony_ciPNAME(mux_2plls_u480m_p)	= { "cpll", "gpll",
1548c2ecf20Sopenharmony_ci				    "usb480m" };
1558c2ecf20Sopenharmony_ciPNAME(mux_2plls_24m_u480m_p)	= { "cpll", "gpll",
1568c2ecf20Sopenharmony_ci				     "xin24m", "usb480m" };
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ciPNAME(mux_ddrphy_p)		= { "dpll", "apll", "cpll" };
1598c2ecf20Sopenharmony_ciPNAME(mux_armclk_p)		= { "apll_core",
1608c2ecf20Sopenharmony_ci				    "gpll_core",
1618c2ecf20Sopenharmony_ci				    "dpll_core",
1628c2ecf20Sopenharmony_ci				    "npll_core"};
1638c2ecf20Sopenharmony_ciPNAME(mux_hdmiphy_p)		= { "hdmi_phy", "xin24m" };
1648c2ecf20Sopenharmony_ciPNAME(mux_usb480m_p)		= { "usb480m_phy",
1658c2ecf20Sopenharmony_ci				    "xin24m" };
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ciPNAME(mux_i2s0_p)		= { "clk_i2s0_div",
1688c2ecf20Sopenharmony_ci				    "clk_i2s0_frac",
1698c2ecf20Sopenharmony_ci				    "xin12m",
1708c2ecf20Sopenharmony_ci				    "xin12m" };
1718c2ecf20Sopenharmony_ciPNAME(mux_i2s1_p)		= { "clk_i2s1_div",
1728c2ecf20Sopenharmony_ci				    "clk_i2s1_frac",
1738c2ecf20Sopenharmony_ci				    "clkin_i2s1",
1748c2ecf20Sopenharmony_ci				    "xin12m" };
1758c2ecf20Sopenharmony_ciPNAME(mux_i2s2_p)		= { "clk_i2s2_div",
1768c2ecf20Sopenharmony_ci				    "clk_i2s2_frac",
1778c2ecf20Sopenharmony_ci				    "clkin_i2s2",
1788c2ecf20Sopenharmony_ci				    "xin12m" };
1798c2ecf20Sopenharmony_ciPNAME(mux_i2s1out_p)		= { "clk_i2s1", "xin12m"};
1808c2ecf20Sopenharmony_ciPNAME(mux_i2s2out_p)		= { "clk_i2s2", "xin12m" };
1818c2ecf20Sopenharmony_ciPNAME(mux_spdif_p)		= { "clk_spdif_div",
1828c2ecf20Sopenharmony_ci				    "clk_spdif_frac",
1838c2ecf20Sopenharmony_ci				    "xin12m",
1848c2ecf20Sopenharmony_ci				    "xin12m" };
1858c2ecf20Sopenharmony_ciPNAME(mux_uart0_p)		= { "clk_uart0_div",
1868c2ecf20Sopenharmony_ci				    "clk_uart0_frac",
1878c2ecf20Sopenharmony_ci				    "xin24m" };
1888c2ecf20Sopenharmony_ciPNAME(mux_uart1_p)		= { "clk_uart1_div",
1898c2ecf20Sopenharmony_ci				    "clk_uart1_frac",
1908c2ecf20Sopenharmony_ci				    "xin24m" };
1918c2ecf20Sopenharmony_ciPNAME(mux_uart2_p)		= { "clk_uart2_div",
1928c2ecf20Sopenharmony_ci				    "clk_uart2_frac",
1938c2ecf20Sopenharmony_ci				    "xin24m" };
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ciPNAME(mux_sclk_cif_p)		= { "clk_cif_src",
1968c2ecf20Sopenharmony_ci				    "xin24m" };
1978c2ecf20Sopenharmony_ciPNAME(mux_dclk_lcdc_p)		= { "hdmiphy",
1988c2ecf20Sopenharmony_ci				    "dclk_lcdc_src" };
1998c2ecf20Sopenharmony_ciPNAME(mux_aclk_peri_pre_p)	= { "cpll_peri",
2008c2ecf20Sopenharmony_ci				    "gpll_peri",
2018c2ecf20Sopenharmony_ci				    "hdmiphy_peri" };
2028c2ecf20Sopenharmony_ciPNAME(mux_ref_usb3otg_src_p)	= { "xin24m",
2038c2ecf20Sopenharmony_ci				    "clk_usb3otg_ref" };
2048c2ecf20Sopenharmony_ciPNAME(mux_xin24m_32k_p)		= { "xin24m",
2058c2ecf20Sopenharmony_ci				    "clk_rtc32k" };
2068c2ecf20Sopenharmony_ciPNAME(mux_mac2io_src_p)		= { "clk_mac2io_src",
2078c2ecf20Sopenharmony_ci				    "gmac_clkin" };
2088c2ecf20Sopenharmony_ciPNAME(mux_mac2phy_src_p)	= { "clk_mac2phy_src",
2098c2ecf20Sopenharmony_ci				    "phy_50m_out" };
2108c2ecf20Sopenharmony_ciPNAME(mux_mac2io_ext_p)		= { "clk_mac2io",
2118c2ecf20Sopenharmony_ci				    "gmac_clkin" };
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_cistatic struct rockchip_pll_clock rk3328_pll_clks[] __initdata = {
2148c2ecf20Sopenharmony_ci	[apll] = PLL(pll_rk3328, PLL_APLL, "apll", mux_pll_p,
2158c2ecf20Sopenharmony_ci		     0, RK3328_PLL_CON(0),
2168c2ecf20Sopenharmony_ci		     RK3328_MODE_CON, 0, 4, 0, rk3328_pll_frac_rates),
2178c2ecf20Sopenharmony_ci	[dpll] = PLL(pll_rk3328, PLL_DPLL, "dpll", mux_pll_p,
2188c2ecf20Sopenharmony_ci		     0, RK3328_PLL_CON(8),
2198c2ecf20Sopenharmony_ci		     RK3328_MODE_CON, 4, 3, 0, NULL),
2208c2ecf20Sopenharmony_ci	[cpll] = PLL(pll_rk3328, PLL_CPLL, "cpll", mux_pll_p,
2218c2ecf20Sopenharmony_ci		     0, RK3328_PLL_CON(16),
2228c2ecf20Sopenharmony_ci		     RK3328_MODE_CON, 8, 2, 0, rk3328_pll_rates),
2238c2ecf20Sopenharmony_ci	[gpll] = PLL(pll_rk3328, PLL_GPLL, "gpll", mux_pll_p,
2248c2ecf20Sopenharmony_ci		     0, RK3328_PLL_CON(24),
2258c2ecf20Sopenharmony_ci		     RK3328_MODE_CON, 12, 1, 0, rk3328_pll_frac_rates),
2268c2ecf20Sopenharmony_ci	[npll] = PLL(pll_rk3328, PLL_NPLL, "npll", mux_pll_p,
2278c2ecf20Sopenharmony_ci		     0, RK3328_PLL_CON(40),
2288c2ecf20Sopenharmony_ci		     RK3328_MODE_CON, 1, 0, 0, rk3328_pll_rates),
2298c2ecf20Sopenharmony_ci};
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci#define MFLAGS CLK_MUX_HIWORD_MASK
2328c2ecf20Sopenharmony_ci#define DFLAGS CLK_DIVIDER_HIWORD_MASK
2338c2ecf20Sopenharmony_ci#define GFLAGS (CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE)
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_cistatic struct rockchip_clk_branch rk3328_i2s0_fracmux __initdata =
2368c2ecf20Sopenharmony_ci	MUX(0, "i2s0_pre", mux_i2s0_p, CLK_SET_RATE_PARENT,
2378c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(6), 8, 2, MFLAGS);
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_cistatic struct rockchip_clk_branch rk3328_i2s1_fracmux __initdata =
2408c2ecf20Sopenharmony_ci	MUX(0, "i2s1_pre", mux_i2s1_p, CLK_SET_RATE_PARENT,
2418c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(8), 8, 2, MFLAGS);
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_cistatic struct rockchip_clk_branch rk3328_i2s2_fracmux __initdata =
2448c2ecf20Sopenharmony_ci	MUX(0, "i2s2_pre", mux_i2s2_p, CLK_SET_RATE_PARENT,
2458c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(10), 8, 2, MFLAGS);
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_cistatic struct rockchip_clk_branch rk3328_spdif_fracmux __initdata =
2488c2ecf20Sopenharmony_ci	MUX(SCLK_SPDIF, "sclk_spdif", mux_spdif_p, CLK_SET_RATE_PARENT,
2498c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(12), 8, 2, MFLAGS);
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_cistatic struct rockchip_clk_branch rk3328_uart0_fracmux __initdata =
2528c2ecf20Sopenharmony_ci	MUX(SCLK_UART0, "sclk_uart0", mux_uart0_p, CLK_SET_RATE_PARENT,
2538c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(14), 8, 2, MFLAGS);
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_cistatic struct rockchip_clk_branch rk3328_uart1_fracmux __initdata =
2568c2ecf20Sopenharmony_ci	MUX(SCLK_UART1, "sclk_uart1", mux_uart1_p, CLK_SET_RATE_PARENT,
2578c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(16), 8, 2, MFLAGS);
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_cistatic struct rockchip_clk_branch rk3328_uart2_fracmux __initdata =
2608c2ecf20Sopenharmony_ci	MUX(SCLK_UART2, "sclk_uart2", mux_uart2_p, CLK_SET_RATE_PARENT,
2618c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(18), 8, 2, MFLAGS);
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_cistatic struct rockchip_clk_branch rk3328_clk_branches[] __initdata = {
2648c2ecf20Sopenharmony_ci	/*
2658c2ecf20Sopenharmony_ci	 * Clock-Architecture Diagram 1
2668c2ecf20Sopenharmony_ci	 */
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci	DIV(0, "clk_24m", "xin24m", CLK_IGNORE_UNUSED,
2698c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(2), 8, 5, DFLAGS),
2708c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_RTC32K, "clk_rtc32k", mux_2plls_xin24m_p, 0,
2718c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(38), 14, 2, MFLAGS, 0, 14, DFLAGS,
2728c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(0), 11, GFLAGS),
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci	/* PD_MISC */
2758c2ecf20Sopenharmony_ci	MUX(HDMIPHY, "hdmiphy", mux_hdmiphy_p, CLK_SET_RATE_PARENT,
2768c2ecf20Sopenharmony_ci			RK3328_MISC_CON, 13, 1, MFLAGS),
2778c2ecf20Sopenharmony_ci	MUX(USB480M, "usb480m", mux_usb480m_p, CLK_SET_RATE_PARENT,
2788c2ecf20Sopenharmony_ci			RK3328_MISC_CON, 15, 1, MFLAGS),
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci	/*
2818c2ecf20Sopenharmony_ci	 * Clock-Architecture Diagram 2
2828c2ecf20Sopenharmony_ci	 */
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci	/* PD_CORE */
2858c2ecf20Sopenharmony_ci	GATE(0, "apll_core", "apll", CLK_IGNORE_UNUSED,
2868c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(0), 0, GFLAGS),
2878c2ecf20Sopenharmony_ci	GATE(0, "gpll_core", "gpll", CLK_IGNORE_UNUSED,
2888c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(0), 2, GFLAGS),
2898c2ecf20Sopenharmony_ci	GATE(0, "dpll_core", "dpll", CLK_IGNORE_UNUSED,
2908c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(0), 1, GFLAGS),
2918c2ecf20Sopenharmony_ci	GATE(0, "npll_core", "npll", CLK_IGNORE_UNUSED,
2928c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(0), 12, GFLAGS),
2938c2ecf20Sopenharmony_ci	COMPOSITE_NOMUX(0, "pclk_dbg", "armclk", CLK_IGNORE_UNUSED,
2948c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(1), 0, 4, DFLAGS | CLK_DIVIDER_READ_ONLY,
2958c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(7), 0, GFLAGS),
2968c2ecf20Sopenharmony_ci	COMPOSITE_NOMUX(0, "aclk_core", "armclk", CLK_IGNORE_UNUSED,
2978c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(1), 4, 3, DFLAGS | CLK_DIVIDER_READ_ONLY,
2988c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(7), 1, GFLAGS),
2998c2ecf20Sopenharmony_ci	GATE(0, "aclk_core_niu", "aclk_core", 0,
3008c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(13), 0, GFLAGS),
3018c2ecf20Sopenharmony_ci	GATE(0, "aclk_gic400", "aclk_core", CLK_IGNORE_UNUSED,
3028c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(13), 1, GFLAGS),
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci	GATE(0, "clk_jtag", "jtag_clkin", CLK_IGNORE_UNUSED,
3058c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(7), 2, GFLAGS),
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci	/* PD_GPU */
3088c2ecf20Sopenharmony_ci	COMPOSITE(0, "aclk_gpu_pre", mux_4plls_p, 0,
3098c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(44), 6, 2, MFLAGS, 0, 5, DFLAGS,
3108c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(6), 6, GFLAGS),
3118c2ecf20Sopenharmony_ci	GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_pre", CLK_SET_RATE_PARENT,
3128c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(14), 0, GFLAGS),
3138c2ecf20Sopenharmony_ci	GATE(0, "aclk_gpu_niu", "aclk_gpu_pre", 0,
3148c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(14), 1, GFLAGS),
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci	/* PD_DDR */
3178c2ecf20Sopenharmony_ci	COMPOSITE(0, "clk_ddr", mux_ddrphy_p, CLK_IGNORE_UNUSED,
3188c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(3), 8, 2, MFLAGS, 0, 3, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
3198c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(0), 4, GFLAGS),
3208c2ecf20Sopenharmony_ci	GATE(0, "clk_ddrmsch", "clk_ddr", CLK_IGNORE_UNUSED,
3218c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(18), 6, GFLAGS),
3228c2ecf20Sopenharmony_ci	GATE(0, "clk_ddrupctl", "clk_ddr", CLK_IGNORE_UNUSED,
3238c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(18), 5, GFLAGS),
3248c2ecf20Sopenharmony_ci	GATE(0, "aclk_ddrupctl", "clk_ddr", CLK_IGNORE_UNUSED,
3258c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(18), 4, GFLAGS),
3268c2ecf20Sopenharmony_ci	GATE(0, "clk_ddrmon", "xin24m", CLK_IGNORE_UNUSED,
3278c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(0), 6, GFLAGS),
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci	COMPOSITE(PCLK_DDR, "pclk_ddr", mux_2plls_hdmiphy_p, 0,
3308c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(4), 13, 2, MFLAGS, 8, 3, DFLAGS,
3318c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(7), 4, GFLAGS),
3328c2ecf20Sopenharmony_ci	GATE(0, "pclk_ddrupctl", "pclk_ddr", CLK_IGNORE_UNUSED,
3338c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(18), 1, GFLAGS),
3348c2ecf20Sopenharmony_ci	GATE(0, "pclk_ddr_msch", "pclk_ddr", CLK_IGNORE_UNUSED,
3358c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(18), 2, GFLAGS),
3368c2ecf20Sopenharmony_ci	GATE(0, "pclk_ddr_mon", "pclk_ddr", CLK_IGNORE_UNUSED,
3378c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(18), 3, GFLAGS),
3388c2ecf20Sopenharmony_ci	GATE(0, "pclk_ddrstdby", "pclk_ddr", CLK_IGNORE_UNUSED,
3398c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(18), 7, GFLAGS),
3408c2ecf20Sopenharmony_ci	GATE(0, "pclk_ddr_grf", "pclk_ddr", CLK_IGNORE_UNUSED,
3418c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(18), 9, GFLAGS),
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci	/*
3448c2ecf20Sopenharmony_ci	 * Clock-Architecture Diagram 3
3458c2ecf20Sopenharmony_ci	 */
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci	/* PD_BUS */
3488c2ecf20Sopenharmony_ci	COMPOSITE(ACLK_BUS_PRE, "aclk_bus_pre", mux_2plls_hdmiphy_p, 0,
3498c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(0), 13, 2, MFLAGS, 8, 5, DFLAGS,
3508c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(8), 0, GFLAGS),
3518c2ecf20Sopenharmony_ci	COMPOSITE_NOMUX(HCLK_BUS_PRE, "hclk_bus_pre", "aclk_bus_pre", 0,
3528c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(1), 8, 2, DFLAGS,
3538c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(8), 1, GFLAGS),
3548c2ecf20Sopenharmony_ci	COMPOSITE_NOMUX(PCLK_BUS_PRE, "pclk_bus_pre", "aclk_bus_pre", 0,
3558c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(1), 12, 3, DFLAGS,
3568c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(8), 2, GFLAGS),
3578c2ecf20Sopenharmony_ci	GATE(0, "pclk_bus", "pclk_bus_pre", 0,
3588c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(8), 3, GFLAGS),
3598c2ecf20Sopenharmony_ci	GATE(0, "pclk_phy_pre", "pclk_bus_pre", 0,
3608c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(8), 4, GFLAGS),
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_TSP, "clk_tsp", mux_2plls_p, 0,
3638c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(21), 15, 1, MFLAGS, 8, 5, DFLAGS,
3648c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 5, GFLAGS),
3658c2ecf20Sopenharmony_ci	GATE(0, "clk_hsadc_tsp", "ext_gpio3a2", 0,
3668c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(17), 13, GFLAGS),
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci	/* PD_I2S */
3698c2ecf20Sopenharmony_ci	COMPOSITE(0, "clk_i2s0_div", mux_2plls_p, 0,
3708c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(6), 15, 1, MFLAGS, 0, 7, DFLAGS,
3718c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 1, GFLAGS),
3728c2ecf20Sopenharmony_ci	COMPOSITE_FRACMUX(0, "clk_i2s0_frac", "clk_i2s0_div", CLK_SET_RATE_PARENT,
3738c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(7), 0,
3748c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 2, GFLAGS,
3758c2ecf20Sopenharmony_ci			&rk3328_i2s0_fracmux),
3768c2ecf20Sopenharmony_ci	GATE(SCLK_I2S0, "clk_i2s0", "i2s0_pre", CLK_SET_RATE_PARENT,
3778c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 3, GFLAGS),
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci	COMPOSITE(0, "clk_i2s1_div", mux_2plls_p, 0,
3808c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(8), 15, 1, MFLAGS, 0, 7, DFLAGS,
3818c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 4, GFLAGS),
3828c2ecf20Sopenharmony_ci	COMPOSITE_FRACMUX(0, "clk_i2s1_frac", "clk_i2s1_div", CLK_SET_RATE_PARENT,
3838c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(9), 0,
3848c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 5, GFLAGS,
3858c2ecf20Sopenharmony_ci			&rk3328_i2s1_fracmux),
3868c2ecf20Sopenharmony_ci	GATE(SCLK_I2S1, "clk_i2s1", "i2s1_pre", CLK_SET_RATE_PARENT,
3878c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 6, GFLAGS),
3888c2ecf20Sopenharmony_ci	COMPOSITE_NODIV(SCLK_I2S1_OUT, "i2s1_out", mux_i2s1out_p, 0,
3898c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(8), 12, 1, MFLAGS,
3908c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 7, GFLAGS),
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci	COMPOSITE(0, "clk_i2s2_div", mux_2plls_p, 0,
3938c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(10), 15, 1, MFLAGS, 0, 7, DFLAGS,
3948c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 8, GFLAGS),
3958c2ecf20Sopenharmony_ci	COMPOSITE_FRACMUX(0, "clk_i2s2_frac", "clk_i2s2_div", CLK_SET_RATE_PARENT,
3968c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(11), 0,
3978c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 9, GFLAGS,
3988c2ecf20Sopenharmony_ci			&rk3328_i2s2_fracmux),
3998c2ecf20Sopenharmony_ci	GATE(SCLK_I2S2, "clk_i2s2", "i2s2_pre", CLK_SET_RATE_PARENT,
4008c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 10, GFLAGS),
4018c2ecf20Sopenharmony_ci	COMPOSITE_NODIV(SCLK_I2S2_OUT, "i2s2_out", mux_i2s2out_p, 0,
4028c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(10), 12, 1, MFLAGS,
4038c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 11, GFLAGS),
4048c2ecf20Sopenharmony_ci
4058c2ecf20Sopenharmony_ci	COMPOSITE(0, "clk_spdif_div", mux_2plls_p, 0,
4068c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(12), 15, 1, MFLAGS, 0, 7, DFLAGS,
4078c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 12, GFLAGS),
4088c2ecf20Sopenharmony_ci	COMPOSITE_FRACMUX(0, "clk_spdif_frac", "clk_spdif_div", CLK_SET_RATE_PARENT,
4098c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(13), 0,
4108c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 13, GFLAGS,
4118c2ecf20Sopenharmony_ci			&rk3328_spdif_fracmux),
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_ci	/* PD_UART */
4148c2ecf20Sopenharmony_ci	COMPOSITE(0, "clk_uart0_div", mux_2plls_u480m_p, 0,
4158c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(14), 12, 2, MFLAGS, 0, 7, DFLAGS,
4168c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 14, GFLAGS),
4178c2ecf20Sopenharmony_ci	COMPOSITE(0, "clk_uart1_div", mux_2plls_u480m_p, 0,
4188c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(16), 12, 2, MFLAGS, 0, 7, DFLAGS,
4198c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 0, GFLAGS),
4208c2ecf20Sopenharmony_ci	COMPOSITE(0, "clk_uart2_div", mux_2plls_u480m_p, 0,
4218c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(18), 12, 2, MFLAGS, 0, 7, DFLAGS,
4228c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 2, GFLAGS),
4238c2ecf20Sopenharmony_ci	COMPOSITE_FRACMUX(0, "clk_uart0_frac", "clk_uart0_div", CLK_SET_RATE_PARENT,
4248c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(15), 0,
4258c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(1), 15, GFLAGS,
4268c2ecf20Sopenharmony_ci			&rk3328_uart0_fracmux),
4278c2ecf20Sopenharmony_ci	COMPOSITE_FRACMUX(0, "clk_uart1_frac", "clk_uart1_div", CLK_SET_RATE_PARENT,
4288c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(17), 0,
4298c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 1, GFLAGS,
4308c2ecf20Sopenharmony_ci			&rk3328_uart1_fracmux),
4318c2ecf20Sopenharmony_ci	COMPOSITE_FRACMUX(0, "clk_uart2_frac", "clk_uart2_div", CLK_SET_RATE_PARENT,
4328c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(19), 0,
4338c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 3, GFLAGS,
4348c2ecf20Sopenharmony_ci			&rk3328_uart2_fracmux),
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci	/*
4378c2ecf20Sopenharmony_ci	 * Clock-Architecture Diagram 4
4388c2ecf20Sopenharmony_ci	 */
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_I2C0, "clk_i2c0", mux_2plls_p, 0,
4418c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(34), 7, 1, MFLAGS, 0, 7, DFLAGS,
4428c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 9, GFLAGS),
4438c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_I2C1, "clk_i2c1", mux_2plls_p, 0,
4448c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(34), 15, 1, MFLAGS, 8, 7, DFLAGS,
4458c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 10, GFLAGS),
4468c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_I2C2, "clk_i2c2", mux_2plls_p, 0,
4478c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(35), 7, 1, MFLAGS, 0, 7, DFLAGS,
4488c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 11, GFLAGS),
4498c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_I2C3, "clk_i2c3", mux_2plls_p, 0,
4508c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(35), 15, 1, MFLAGS, 8, 7, DFLAGS,
4518c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 12, GFLAGS),
4528c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_CRYPTO, "clk_crypto", mux_2plls_p, 0,
4538c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(20), 7, 1, MFLAGS, 0, 5, DFLAGS,
4548c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 4, GFLAGS),
4558c2ecf20Sopenharmony_ci	COMPOSITE_NOMUX(SCLK_TSADC, "clk_tsadc", "clk_24m", 0,
4568c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(22), 0, 10, DFLAGS,
4578c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 6, GFLAGS),
4588c2ecf20Sopenharmony_ci	COMPOSITE_NOMUX(SCLK_SARADC, "clk_saradc", "clk_24m", 0,
4598c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(23), 0, 10, DFLAGS,
4608c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 14, GFLAGS),
4618c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_SPI, "clk_spi", mux_2plls_p, 0,
4628c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(24), 7, 1, MFLAGS, 0, 7, DFLAGS,
4638c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 7, GFLAGS),
4648c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_PWM, "clk_pwm", mux_2plls_p, 0,
4658c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(24), 15, 1, MFLAGS, 8, 7, DFLAGS,
4668c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 8, GFLAGS),
4678c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_OTP, "clk_otp", mux_2plls_xin24m_p, 0,
4688c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(4), 6, 2, MFLAGS, 0, 6, DFLAGS,
4698c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(3), 8, GFLAGS),
4708c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_EFUSE, "clk_efuse", mux_2plls_xin24m_p, 0,
4718c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(5), 14, 2, MFLAGS, 8, 5, DFLAGS,
4728c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 13, GFLAGS),
4738c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_PDM, "clk_pdm", mux_cpll_gpll_apll_p, CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT,
4748c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(20), 14, 2, MFLAGS, 8, 5, DFLAGS,
4758c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(2), 15, GFLAGS),
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ci	GATE(SCLK_TIMER0, "sclk_timer0", "xin24m", 0,
4788c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(8), 5, GFLAGS),
4798c2ecf20Sopenharmony_ci	GATE(SCLK_TIMER1, "sclk_timer1", "xin24m", 0,
4808c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(8), 6, GFLAGS),
4818c2ecf20Sopenharmony_ci	GATE(SCLK_TIMER2, "sclk_timer2", "xin24m", 0,
4828c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(8), 7, GFLAGS),
4838c2ecf20Sopenharmony_ci	GATE(SCLK_TIMER3, "sclk_timer3", "xin24m", 0,
4848c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(8), 8, GFLAGS),
4858c2ecf20Sopenharmony_ci	GATE(SCLK_TIMER4, "sclk_timer4", "xin24m", 0,
4868c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(8), 9, GFLAGS),
4878c2ecf20Sopenharmony_ci	GATE(SCLK_TIMER5, "sclk_timer5", "xin24m", 0,
4888c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(8), 10, GFLAGS),
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_WIFI, "clk_wifi", mux_2plls_u480m_p, 0,
4918c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(52), 6, 2, MFLAGS, 0, 6, DFLAGS,
4928c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(0), 10, GFLAGS),
4938c2ecf20Sopenharmony_ci
4948c2ecf20Sopenharmony_ci	/*
4958c2ecf20Sopenharmony_ci	 * Clock-Architecture Diagram 5
4968c2ecf20Sopenharmony_ci	 */
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_ci	/* PD_VIDEO */
4998c2ecf20Sopenharmony_ci	COMPOSITE(ACLK_RKVDEC_PRE, "aclk_rkvdec_pre", mux_4plls_p, 0,
5008c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(48), 6, 2, MFLAGS, 0, 5, DFLAGS,
5018c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(6), 0, GFLAGS),
5028c2ecf20Sopenharmony_ci	FACTOR_GATE(HCLK_RKVDEC_PRE, "hclk_rkvdec_pre", "aclk_rkvdec_pre", 0, 1, 4,
5038c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(11), 0, GFLAGS),
5048c2ecf20Sopenharmony_ci	GATE(ACLK_RKVDEC, "aclk_rkvdec", "aclk_rkvdec_pre", CLK_SET_RATE_PARENT,
5058c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(24), 0, GFLAGS),
5068c2ecf20Sopenharmony_ci	GATE(HCLK_RKVDEC, "hclk_rkvdec", "hclk_rkvdec_pre", CLK_SET_RATE_PARENT,
5078c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(24), 1, GFLAGS),
5088c2ecf20Sopenharmony_ci	GATE(0, "aclk_rkvdec_niu", "aclk_rkvdec_pre", 0,
5098c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(24), 2, GFLAGS),
5108c2ecf20Sopenharmony_ci	GATE(0, "hclk_rkvdec_niu", "hclk_rkvdec_pre", 0,
5118c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(24), 3, GFLAGS),
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_VDEC_CABAC, "sclk_vdec_cabac", mux_4plls_p, 0,
5148c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(48), 14, 2, MFLAGS, 8, 5, DFLAGS,
5158c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(6), 1, GFLAGS),
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_VDEC_CORE, "sclk_vdec_core", mux_4plls_p, 0,
5188c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(49), 6, 2, MFLAGS, 0, 5, DFLAGS,
5198c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(6), 2, GFLAGS),
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci	COMPOSITE(ACLK_VPU_PRE, "aclk_vpu_pre", mux_4plls_p, 0,
5228c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(50), 6, 2, MFLAGS, 0, 5, DFLAGS,
5238c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(6), 5, GFLAGS),
5248c2ecf20Sopenharmony_ci	FACTOR_GATE(HCLK_VPU_PRE, "hclk_vpu_pre", "aclk_vpu_pre", 0, 1, 4,
5258c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(11), 8, GFLAGS),
5268c2ecf20Sopenharmony_ci	GATE(ACLK_VPU, "aclk_vpu", "aclk_vpu_pre", CLK_SET_RATE_PARENT,
5278c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(23), 0, GFLAGS),
5288c2ecf20Sopenharmony_ci	GATE(HCLK_VPU, "hclk_vpu", "hclk_vpu_pre", CLK_SET_RATE_PARENT,
5298c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(23), 1, GFLAGS),
5308c2ecf20Sopenharmony_ci	GATE(0, "aclk_vpu_niu", "aclk_vpu_pre", 0,
5318c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(23), 2, GFLAGS),
5328c2ecf20Sopenharmony_ci	GATE(0, "hclk_vpu_niu", "hclk_vpu_pre", 0,
5338c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(23), 3, GFLAGS),
5348c2ecf20Sopenharmony_ci
5358c2ecf20Sopenharmony_ci	COMPOSITE(ACLK_RKVENC, "aclk_rkvenc", mux_4plls_p, 0,
5368c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(51), 6, 2, MFLAGS, 0, 5, DFLAGS,
5378c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(6), 3, GFLAGS),
5388c2ecf20Sopenharmony_ci	FACTOR_GATE(HCLK_RKVENC, "hclk_rkvenc", "aclk_rkvenc", 0, 1, 4,
5398c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(11), 4, GFLAGS),
5408c2ecf20Sopenharmony_ci	GATE(0, "aclk_rkvenc_niu", "aclk_rkvenc", 0,
5418c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(25), 0, GFLAGS),
5428c2ecf20Sopenharmony_ci	GATE(0, "hclk_rkvenc_niu", "hclk_rkvenc", 0,
5438c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(25), 1, GFLAGS),
5448c2ecf20Sopenharmony_ci	GATE(ACLK_H265, "aclk_h265", "aclk_rkvenc", 0,
5458c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(25), 2, GFLAGS),
5468c2ecf20Sopenharmony_ci	GATE(PCLK_H265, "pclk_h265", "hclk_rkvenc", 0,
5478c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(25), 3, GFLAGS),
5488c2ecf20Sopenharmony_ci	GATE(ACLK_H264, "aclk_h264", "aclk_rkvenc", 0,
5498c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(25), 4, GFLAGS),
5508c2ecf20Sopenharmony_ci	GATE(HCLK_H264, "hclk_h264", "hclk_rkvenc", 0,
5518c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(25), 5, GFLAGS),
5528c2ecf20Sopenharmony_ci	GATE(ACLK_AXISRAM, "aclk_axisram", "aclk_rkvenc", CLK_IGNORE_UNUSED,
5538c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(25), 6, GFLAGS),
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_VENC_CORE, "sclk_venc_core", mux_4plls_p, 0,
5568c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(51), 14, 2, MFLAGS, 8, 5, DFLAGS,
5578c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(6), 4, GFLAGS),
5588c2ecf20Sopenharmony_ci
5598c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_VENC_DSP, "sclk_venc_dsp", mux_4plls_p, 0,
5608c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(52), 14, 2, MFLAGS, 8, 5, DFLAGS,
5618c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(6), 7, GFLAGS),
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ci	/*
5648c2ecf20Sopenharmony_ci	 * Clock-Architecture Diagram 6
5658c2ecf20Sopenharmony_ci	 */
5668c2ecf20Sopenharmony_ci
5678c2ecf20Sopenharmony_ci	/* PD_VIO */
5688c2ecf20Sopenharmony_ci	COMPOSITE(ACLK_VIO_PRE, "aclk_vio_pre", mux_4plls_p, 0,
5698c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(37), 6, 2, MFLAGS, 0, 5, DFLAGS,
5708c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(5), 2, GFLAGS),
5718c2ecf20Sopenharmony_ci	DIV(HCLK_VIO_PRE, "hclk_vio_pre", "aclk_vio_pre", 0,
5728c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(37), 8, 5, DFLAGS),
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ci	COMPOSITE(ACLK_RGA_PRE, "aclk_rga_pre", mux_4plls_p, 0,
5758c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(36), 14, 2, MFLAGS, 8, 5, DFLAGS,
5768c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(5), 0, GFLAGS),
5778c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_RGA, "clk_rga", mux_4plls_p, 0,
5788c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(36), 6, 2, MFLAGS, 0, 5, DFLAGS,
5798c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(5), 1, GFLAGS),
5808c2ecf20Sopenharmony_ci	COMPOSITE(ACLK_VOP_PRE, "aclk_vop_pre", mux_4plls_p, 0,
5818c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(39), 6, 2, MFLAGS, 0, 5, DFLAGS,
5828c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(5), 5, GFLAGS),
5838c2ecf20Sopenharmony_ci	GATE(SCLK_HDMI_SFC, "sclk_hdmi_sfc", "xin24m", 0,
5848c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(5), 4, GFLAGS),
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci	COMPOSITE_NODIV(0, "clk_cif_src", mux_2plls_p, 0,
5878c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(42), 7, 1, MFLAGS,
5888c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(5), 3, GFLAGS),
5898c2ecf20Sopenharmony_ci	COMPOSITE_NOGATE(SCLK_CIF_OUT, "clk_cif_out", mux_sclk_cif_p, CLK_SET_RATE_PARENT,
5908c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(42), 5, 1, MFLAGS, 0, 5, DFLAGS),
5918c2ecf20Sopenharmony_ci
5928c2ecf20Sopenharmony_ci	COMPOSITE(DCLK_LCDC_SRC, "dclk_lcdc_src", mux_gpll_cpll_p, 0,
5938c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(40), 0, 1, MFLAGS, 8, 8, DFLAGS,
5948c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(5), 6, GFLAGS),
5958c2ecf20Sopenharmony_ci	DIV(DCLK_HDMIPHY, "dclk_hdmiphy", "dclk_lcdc_src", 0,
5968c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(40), 3, 3, DFLAGS),
5978c2ecf20Sopenharmony_ci	MUX(DCLK_LCDC, "dclk_lcdc", mux_dclk_lcdc_p,  CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
5988c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(40), 1, 1, MFLAGS),
5998c2ecf20Sopenharmony_ci
6008c2ecf20Sopenharmony_ci	/*
6018c2ecf20Sopenharmony_ci	 * Clock-Architecture Diagram 7
6028c2ecf20Sopenharmony_ci	 */
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci	/* PD_PERI */
6058c2ecf20Sopenharmony_ci	GATE(0, "gpll_peri", "gpll", CLK_IGNORE_UNUSED,
6068c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(4), 0, GFLAGS),
6078c2ecf20Sopenharmony_ci	GATE(0, "cpll_peri", "cpll", CLK_IGNORE_UNUSED,
6088c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(4), 1, GFLAGS),
6098c2ecf20Sopenharmony_ci	GATE(0, "hdmiphy_peri", "hdmiphy", CLK_IGNORE_UNUSED,
6108c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(4), 2, GFLAGS),
6118c2ecf20Sopenharmony_ci	COMPOSITE_NOGATE(ACLK_PERI_PRE, "aclk_peri_pre", mux_aclk_peri_pre_p, 0,
6128c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(28), 6, 2, MFLAGS, 0, 5, DFLAGS),
6138c2ecf20Sopenharmony_ci	COMPOSITE_NOMUX(PCLK_PERI, "pclk_peri", "aclk_peri_pre", CLK_IGNORE_UNUSED,
6148c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(29), 0, 2, DFLAGS,
6158c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(10), 2, GFLAGS),
6168c2ecf20Sopenharmony_ci	COMPOSITE_NOMUX(HCLK_PERI, "hclk_peri", "aclk_peri_pre", CLK_IGNORE_UNUSED,
6178c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(29), 4, 3, DFLAGS,
6188c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(10), 1, GFLAGS),
6198c2ecf20Sopenharmony_ci	GATE(ACLK_PERI, "aclk_peri", "aclk_peri_pre", CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT,
6208c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(10), 0, GFLAGS),
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_SDMMC, "clk_sdmmc", mux_2plls_24m_u480m_p, 0,
6238c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(30), 8, 2, MFLAGS, 0, 8, DFLAGS,
6248c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(4), 3, GFLAGS),
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_SDIO, "clk_sdio", mux_2plls_24m_u480m_p, 0,
6278c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(31), 8, 2, MFLAGS, 0, 8, DFLAGS,
6288c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(4), 4, GFLAGS),
6298c2ecf20Sopenharmony_ci
6308c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_EMMC, "clk_emmc", mux_2plls_24m_u480m_p, 0,
6318c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(32), 8, 2, MFLAGS, 0, 8, DFLAGS,
6328c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(4), 5, GFLAGS),
6338c2ecf20Sopenharmony_ci
6348c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_SDMMC_EXT, "clk_sdmmc_ext", mux_2plls_24m_u480m_p, 0,
6358c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(43), 8, 2, MFLAGS, 0, 8, DFLAGS,
6368c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(4), 10, GFLAGS),
6378c2ecf20Sopenharmony_ci
6388c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_REF_USB3OTG_SRC, "clk_ref_usb3otg_src", mux_2plls_p, 0,
6398c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(45), 7, 1, MFLAGS, 0, 7, DFLAGS,
6408c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(4), 9, GFLAGS),
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_ci	MUX(SCLK_REF_USB3OTG, "clk_ref_usb3otg", mux_ref_usb3otg_src_p, CLK_SET_RATE_PARENT,
6438c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(45), 8, 1, MFLAGS),
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_ci	GATE(SCLK_USB3OTG_REF, "clk_usb3otg_ref", "xin24m", 0,
6468c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(4), 7, GFLAGS),
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_USB3OTG_SUSPEND, "clk_usb3otg_suspend", mux_xin24m_32k_p, 0,
6498c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(33), 15, 1, MFLAGS, 0, 10, DFLAGS,
6508c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(4), 8, GFLAGS),
6518c2ecf20Sopenharmony_ci
6528c2ecf20Sopenharmony_ci	/*
6538c2ecf20Sopenharmony_ci	 * Clock-Architecture Diagram 8
6548c2ecf20Sopenharmony_ci	 */
6558c2ecf20Sopenharmony_ci
6568c2ecf20Sopenharmony_ci	/* PD_GMAC */
6578c2ecf20Sopenharmony_ci	COMPOSITE(ACLK_GMAC, "aclk_gmac", mux_2plls_hdmiphy_p, 0,
6588c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(25), 6, 2, MFLAGS, 0, 5, DFLAGS,
6598c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(3), 2, GFLAGS),
6608c2ecf20Sopenharmony_ci	COMPOSITE_NOMUX(PCLK_GMAC, "pclk_gmac", "aclk_gmac", 0,
6618c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(25), 8, 3, DFLAGS,
6628c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(9), 0, GFLAGS),
6638c2ecf20Sopenharmony_ci
6648c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_MAC2IO_SRC, "clk_mac2io_src", mux_2plls_p, 0,
6658c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(27), 7, 1, MFLAGS, 0, 5, DFLAGS,
6668c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(3), 1, GFLAGS),
6678c2ecf20Sopenharmony_ci	GATE(SCLK_MAC2IO_REF, "clk_mac2io_ref", "clk_mac2io", 0,
6688c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(9), 7, GFLAGS),
6698c2ecf20Sopenharmony_ci	GATE(SCLK_MAC2IO_RX, "clk_mac2io_rx", "clk_mac2io", 0,
6708c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(9), 4, GFLAGS),
6718c2ecf20Sopenharmony_ci	GATE(SCLK_MAC2IO_TX, "clk_mac2io_tx", "clk_mac2io", 0,
6728c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(9), 5, GFLAGS),
6738c2ecf20Sopenharmony_ci	GATE(SCLK_MAC2IO_REFOUT, "clk_mac2io_refout", "clk_mac2io", 0,
6748c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(9), 6, GFLAGS),
6758c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_MAC2IO_OUT, "clk_mac2io_out", mux_2plls_p, 0,
6768c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(27), 15, 1, MFLAGS, 8, 5, DFLAGS,
6778c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(3), 5, GFLAGS),
6788c2ecf20Sopenharmony_ci	MUXGRF(SCLK_MAC2IO, "clk_mac2io", mux_mac2io_src_p, CLK_SET_RATE_NO_REPARENT,
6798c2ecf20Sopenharmony_ci			RK3328_GRF_MAC_CON1, 10, 1, MFLAGS),
6808c2ecf20Sopenharmony_ci	MUXGRF(SCLK_MAC2IO_EXT, "clk_mac2io_ext", mux_mac2io_ext_p, CLK_SET_RATE_NO_REPARENT,
6818c2ecf20Sopenharmony_ci			RK3328_GRF_SOC_CON4, 14, 1, MFLAGS),
6828c2ecf20Sopenharmony_ci
6838c2ecf20Sopenharmony_ci	COMPOSITE(SCLK_MAC2PHY_SRC, "clk_mac2phy_src", mux_2plls_p, 0,
6848c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(26), 7, 1, MFLAGS, 0, 5, DFLAGS,
6858c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(3), 0, GFLAGS),
6868c2ecf20Sopenharmony_ci	GATE(SCLK_MAC2PHY_REF, "clk_mac2phy_ref", "clk_mac2phy", 0,
6878c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(9), 3, GFLAGS),
6888c2ecf20Sopenharmony_ci	GATE(SCLK_MAC2PHY_RXTX, "clk_mac2phy_rxtx", "clk_mac2phy", 0,
6898c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(9), 1, GFLAGS),
6908c2ecf20Sopenharmony_ci	COMPOSITE_NOMUX(SCLK_MAC2PHY_OUT, "clk_mac2phy_out", "clk_mac2phy", 0,
6918c2ecf20Sopenharmony_ci			RK3328_CLKSEL_CON(26), 8, 2, DFLAGS,
6928c2ecf20Sopenharmony_ci			RK3328_CLKGATE_CON(9), 2, GFLAGS),
6938c2ecf20Sopenharmony_ci	MUXGRF(SCLK_MAC2PHY, "clk_mac2phy", mux_mac2phy_src_p, CLK_SET_RATE_NO_REPARENT,
6948c2ecf20Sopenharmony_ci			RK3328_GRF_MAC_CON2, 10, 1, MFLAGS),
6958c2ecf20Sopenharmony_ci
6968c2ecf20Sopenharmony_ci	FACTOR(0, "xin12m", "xin24m", 0, 1, 2),
6978c2ecf20Sopenharmony_ci
6988c2ecf20Sopenharmony_ci	/*
6998c2ecf20Sopenharmony_ci	 * Clock-Architecture Diagram 9
7008c2ecf20Sopenharmony_ci	 */
7018c2ecf20Sopenharmony_ci
7028c2ecf20Sopenharmony_ci	/* PD_VOP */
7038c2ecf20Sopenharmony_ci	GATE(ACLK_RGA, "aclk_rga", "aclk_rga_pre", 0, RK3328_CLKGATE_CON(21), 10, GFLAGS),
7048c2ecf20Sopenharmony_ci	GATE(0, "aclk_rga_niu", "aclk_rga_pre", 0, RK3328_CLKGATE_CON(22), 3, GFLAGS),
7058c2ecf20Sopenharmony_ci	GATE(ACLK_VOP, "aclk_vop", "aclk_vop_pre", 0, RK3328_CLKGATE_CON(21), 2, GFLAGS),
7068c2ecf20Sopenharmony_ci	GATE(0, "aclk_vop_niu", "aclk_vop_pre", 0, RK3328_CLKGATE_CON(21), 4, GFLAGS),
7078c2ecf20Sopenharmony_ci
7088c2ecf20Sopenharmony_ci	GATE(ACLK_IEP, "aclk_iep", "aclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 6, GFLAGS),
7098c2ecf20Sopenharmony_ci	GATE(ACLK_CIF, "aclk_cif", "aclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 8, GFLAGS),
7108c2ecf20Sopenharmony_ci	GATE(ACLK_HDCP, "aclk_hdcp", "aclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 15, GFLAGS),
7118c2ecf20Sopenharmony_ci	GATE(0, "aclk_vio_niu", "aclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 2, GFLAGS),
7128c2ecf20Sopenharmony_ci
7138c2ecf20Sopenharmony_ci	GATE(HCLK_VOP, "hclk_vop", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 3, GFLAGS),
7148c2ecf20Sopenharmony_ci	GATE(0, "hclk_vop_niu", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 5, GFLAGS),
7158c2ecf20Sopenharmony_ci	GATE(HCLK_IEP, "hclk_iep", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 7, GFLAGS),
7168c2ecf20Sopenharmony_ci	GATE(HCLK_CIF, "hclk_cif", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 9, GFLAGS),
7178c2ecf20Sopenharmony_ci	GATE(HCLK_RGA, "hclk_rga", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 11, GFLAGS),
7188c2ecf20Sopenharmony_ci	GATE(0, "hclk_ahb1tom", "hclk_vio_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(21), 12, GFLAGS),
7198c2ecf20Sopenharmony_ci	GATE(0, "pclk_vio_h2p", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 13, GFLAGS),
7208c2ecf20Sopenharmony_ci	GATE(0, "hclk_vio_h2p", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 14, GFLAGS),
7218c2ecf20Sopenharmony_ci	GATE(HCLK_HDCP, "hclk_hdcp", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 0, GFLAGS),
7228c2ecf20Sopenharmony_ci	GATE(0, "hclk_vio_niu", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 1, GFLAGS),
7238c2ecf20Sopenharmony_ci	GATE(PCLK_HDMI, "pclk_hdmi", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 4, GFLAGS),
7248c2ecf20Sopenharmony_ci	GATE(PCLK_HDCP, "pclk_hdcp", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 5, GFLAGS),
7258c2ecf20Sopenharmony_ci
7268c2ecf20Sopenharmony_ci	/* PD_PERI */
7278c2ecf20Sopenharmony_ci	GATE(0, "aclk_peri_noc", "aclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 11, GFLAGS),
7288c2ecf20Sopenharmony_ci	GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0, RK3328_CLKGATE_CON(19), 14, GFLAGS),
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_ci	GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 0, GFLAGS),
7318c2ecf20Sopenharmony_ci	GATE(HCLK_SDIO, "hclk_sdio", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 1, GFLAGS),
7328c2ecf20Sopenharmony_ci	GATE(HCLK_EMMC, "hclk_emmc", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 2, GFLAGS),
7338c2ecf20Sopenharmony_ci	GATE(HCLK_SDMMC_EXT, "hclk_sdmmc_ext", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 15, GFLAGS),
7348c2ecf20Sopenharmony_ci	GATE(HCLK_HOST0, "hclk_host0", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 6, GFLAGS),
7358c2ecf20Sopenharmony_ci	GATE(HCLK_HOST0_ARB, "hclk_host0_arb", "hclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 7, GFLAGS),
7368c2ecf20Sopenharmony_ci	GATE(HCLK_OTG, "hclk_otg", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 8, GFLAGS),
7378c2ecf20Sopenharmony_ci	GATE(HCLK_OTG_PMU, "hclk_otg_pmu", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 9, GFLAGS),
7388c2ecf20Sopenharmony_ci	GATE(0, "hclk_peri_niu", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 12, GFLAGS),
7398c2ecf20Sopenharmony_ci	GATE(0, "pclk_peri_niu", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 13, GFLAGS),
7408c2ecf20Sopenharmony_ci
7418c2ecf20Sopenharmony_ci	/* PD_GMAC */
7428c2ecf20Sopenharmony_ci	GATE(ACLK_MAC2PHY, "aclk_mac2phy", "aclk_gmac", 0, RK3328_CLKGATE_CON(26), 0, GFLAGS),
7438c2ecf20Sopenharmony_ci	GATE(ACLK_MAC2IO, "aclk_mac2io", "aclk_gmac", 0, RK3328_CLKGATE_CON(26), 2, GFLAGS),
7448c2ecf20Sopenharmony_ci	GATE(0, "aclk_gmac_niu", "aclk_gmac", 0, RK3328_CLKGATE_CON(26), 4, GFLAGS),
7458c2ecf20Sopenharmony_ci	GATE(PCLK_MAC2PHY, "pclk_mac2phy", "pclk_gmac", 0, RK3328_CLKGATE_CON(26), 1, GFLAGS),
7468c2ecf20Sopenharmony_ci	GATE(PCLK_MAC2IO, "pclk_mac2io", "pclk_gmac", 0, RK3328_CLKGATE_CON(26), 3, GFLAGS),
7478c2ecf20Sopenharmony_ci	GATE(0, "pclk_gmac_niu", "pclk_gmac", 0, RK3328_CLKGATE_CON(26), 5, GFLAGS),
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci	/* PD_BUS */
7508c2ecf20Sopenharmony_ci	GATE(0, "aclk_bus_niu", "aclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 12, GFLAGS),
7518c2ecf20Sopenharmony_ci	GATE(ACLK_DCF, "aclk_dcf", "aclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 11, GFLAGS),
7528c2ecf20Sopenharmony_ci	GATE(ACLK_TSP, "aclk_tsp", "aclk_bus_pre", 0, RK3328_CLKGATE_CON(17), 12, GFLAGS),
7538c2ecf20Sopenharmony_ci	GATE(0, "aclk_intmem", "aclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 0, GFLAGS),
7548c2ecf20Sopenharmony_ci	GATE(ACLK_DMAC, "aclk_dmac_bus", "aclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 1, GFLAGS),
7558c2ecf20Sopenharmony_ci
7568c2ecf20Sopenharmony_ci	GATE(0, "hclk_rom", "hclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 2, GFLAGS),
7578c2ecf20Sopenharmony_ci	GATE(HCLK_I2S0_8CH, "hclk_i2s0_8ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 3, GFLAGS),
7588c2ecf20Sopenharmony_ci	GATE(HCLK_I2S1_8CH, "hclk_i2s1_8ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 4, GFLAGS),
7598c2ecf20Sopenharmony_ci	GATE(HCLK_I2S2_2CH, "hclk_i2s2_2ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 5, GFLAGS),
7608c2ecf20Sopenharmony_ci	GATE(HCLK_SPDIF_8CH, "hclk_spdif_8ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 6, GFLAGS),
7618c2ecf20Sopenharmony_ci	GATE(HCLK_TSP, "hclk_tsp", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(17), 11, GFLAGS),
7628c2ecf20Sopenharmony_ci	GATE(HCLK_CRYPTO_MST, "hclk_crypto_mst", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 7, GFLAGS),
7638c2ecf20Sopenharmony_ci	GATE(HCLK_CRYPTO_SLV, "hclk_crypto_slv", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 8, GFLAGS),
7648c2ecf20Sopenharmony_ci	GATE(0, "hclk_bus_niu", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 13, GFLAGS),
7658c2ecf20Sopenharmony_ci	GATE(HCLK_PDM, "hclk_pdm", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(28), 0, GFLAGS),
7668c2ecf20Sopenharmony_ci
7678c2ecf20Sopenharmony_ci	GATE(0, "pclk_bus_niu", "pclk_bus", 0, RK3328_CLKGATE_CON(15), 14, GFLAGS),
7688c2ecf20Sopenharmony_ci	GATE(0, "pclk_efuse", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 9, GFLAGS),
7698c2ecf20Sopenharmony_ci	GATE(0, "pclk_otp", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(28), 4, GFLAGS),
7708c2ecf20Sopenharmony_ci	GATE(PCLK_I2C0, "pclk_i2c0", "pclk_bus", 0, RK3328_CLKGATE_CON(15), 10, GFLAGS),
7718c2ecf20Sopenharmony_ci	GATE(PCLK_I2C1, "pclk_i2c1", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 0, GFLAGS),
7728c2ecf20Sopenharmony_ci	GATE(PCLK_I2C2, "pclk_i2c2", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 1, GFLAGS),
7738c2ecf20Sopenharmony_ci	GATE(PCLK_I2C3, "pclk_i2c3", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 2, GFLAGS),
7748c2ecf20Sopenharmony_ci	GATE(PCLK_TIMER, "pclk_timer0", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 3, GFLAGS),
7758c2ecf20Sopenharmony_ci	GATE(0, "pclk_stimer", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 4, GFLAGS),
7768c2ecf20Sopenharmony_ci	GATE(PCLK_SPI, "pclk_spi", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 5, GFLAGS),
7778c2ecf20Sopenharmony_ci	GATE(PCLK_PWM, "pclk_rk_pwm", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 6, GFLAGS),
7788c2ecf20Sopenharmony_ci	GATE(PCLK_GPIO0, "pclk_gpio0", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 7, GFLAGS),
7798c2ecf20Sopenharmony_ci	GATE(PCLK_GPIO1, "pclk_gpio1", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 8, GFLAGS),
7808c2ecf20Sopenharmony_ci	GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 9, GFLAGS),
7818c2ecf20Sopenharmony_ci	GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 10, GFLAGS),
7828c2ecf20Sopenharmony_ci	GATE(PCLK_UART0, "pclk_uart0", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 11, GFLAGS),
7838c2ecf20Sopenharmony_ci	GATE(PCLK_UART1, "pclk_uart1", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 12, GFLAGS),
7848c2ecf20Sopenharmony_ci	GATE(PCLK_UART2, "pclk_uart2", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 13, GFLAGS),
7858c2ecf20Sopenharmony_ci	GATE(PCLK_TSADC, "pclk_tsadc", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 14, GFLAGS),
7868c2ecf20Sopenharmony_ci	GATE(PCLK_DCF, "pclk_dcf", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 15, GFLAGS),
7878c2ecf20Sopenharmony_ci	GATE(PCLK_GRF, "pclk_grf", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 0, GFLAGS),
7888c2ecf20Sopenharmony_ci	GATE(0, "pclk_cru", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 4, GFLAGS),
7898c2ecf20Sopenharmony_ci	GATE(0, "pclk_sgrf", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 6, GFLAGS),
7908c2ecf20Sopenharmony_ci	GATE(0, "pclk_sim", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 10, GFLAGS),
7918c2ecf20Sopenharmony_ci	GATE(PCLK_SARADC, "pclk_saradc", "pclk_bus", 0, RK3328_CLKGATE_CON(17), 15, GFLAGS),
7928c2ecf20Sopenharmony_ci	GATE(0, "pclk_pmu", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(28), 3, GFLAGS),
7938c2ecf20Sopenharmony_ci
7948c2ecf20Sopenharmony_ci	/* Watchdog pclk is controlled from the secure GRF */
7958c2ecf20Sopenharmony_ci	SGRF_GATE(PCLK_WDT, "pclk_wdt", "pclk_bus"),
7968c2ecf20Sopenharmony_ci
7978c2ecf20Sopenharmony_ci	GATE(PCLK_USB3PHY_OTG, "pclk_usb3phy_otg", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(28), 1, GFLAGS),
7988c2ecf20Sopenharmony_ci	GATE(PCLK_USB3PHY_PIPE, "pclk_usb3phy_pipe", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(28), 2, GFLAGS),
7998c2ecf20Sopenharmony_ci	GATE(PCLK_USB3_GRF, "pclk_usb3_grf", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 2, GFLAGS),
8008c2ecf20Sopenharmony_ci	GATE(PCLK_USB2_GRF, "pclk_usb2_grf", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 14, GFLAGS),
8018c2ecf20Sopenharmony_ci	GATE(0, "pclk_ddrphy", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 13, GFLAGS),
8028c2ecf20Sopenharmony_ci	GATE(PCLK_ACODECPHY, "pclk_acodecphy", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(17), 5, GFLAGS),
8038c2ecf20Sopenharmony_ci	GATE(PCLK_HDMIPHY, "pclk_hdmiphy", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 7, GFLAGS),
8048c2ecf20Sopenharmony_ci	GATE(0, "pclk_vdacphy", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 8, GFLAGS),
8058c2ecf20Sopenharmony_ci	GATE(0, "pclk_phy_niu", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(15), 15, GFLAGS),
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_ci	/* PD_MMC */
8088c2ecf20Sopenharmony_ci	MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "clk_sdmmc",
8098c2ecf20Sopenharmony_ci	    RK3328_SDMMC_CON0, 1),
8108c2ecf20Sopenharmony_ci	MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "clk_sdmmc",
8118c2ecf20Sopenharmony_ci	    RK3328_SDMMC_CON1, 1),
8128c2ecf20Sopenharmony_ci
8138c2ecf20Sopenharmony_ci	MMC(SCLK_SDIO_DRV, "sdio_drv", "clk_sdio",
8148c2ecf20Sopenharmony_ci	    RK3328_SDIO_CON0, 1),
8158c2ecf20Sopenharmony_ci	MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "clk_sdio",
8168c2ecf20Sopenharmony_ci	    RK3328_SDIO_CON1, 1),
8178c2ecf20Sopenharmony_ci
8188c2ecf20Sopenharmony_ci	MMC(SCLK_EMMC_DRV, "emmc_drv", "clk_emmc",
8198c2ecf20Sopenharmony_ci	    RK3328_EMMC_CON0, 1),
8208c2ecf20Sopenharmony_ci	MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "clk_emmc",
8218c2ecf20Sopenharmony_ci	    RK3328_EMMC_CON1, 1),
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_ci	MMC(SCLK_SDMMC_EXT_DRV, "sdmmc_ext_drv", "clk_sdmmc_ext",
8248c2ecf20Sopenharmony_ci	    RK3328_SDMMC_EXT_CON0, 1),
8258c2ecf20Sopenharmony_ci	MMC(SCLK_SDMMC_EXT_SAMPLE, "sdmmc_ext_sample", "clk_sdmmc_ext",
8268c2ecf20Sopenharmony_ci	    RK3328_SDMMC_EXT_CON1, 1),
8278c2ecf20Sopenharmony_ci};
8288c2ecf20Sopenharmony_ci
8298c2ecf20Sopenharmony_cistatic const char *const rk3328_critical_clocks[] __initconst = {
8308c2ecf20Sopenharmony_ci	"aclk_bus",
8318c2ecf20Sopenharmony_ci	"aclk_bus_niu",
8328c2ecf20Sopenharmony_ci	"pclk_bus",
8338c2ecf20Sopenharmony_ci	"pclk_bus_niu",
8348c2ecf20Sopenharmony_ci	"hclk_bus",
8358c2ecf20Sopenharmony_ci	"hclk_bus_niu",
8368c2ecf20Sopenharmony_ci	"aclk_peri",
8378c2ecf20Sopenharmony_ci	"hclk_peri",
8388c2ecf20Sopenharmony_ci	"hclk_peri_niu",
8398c2ecf20Sopenharmony_ci	"pclk_peri",
8408c2ecf20Sopenharmony_ci	"pclk_peri_niu",
8418c2ecf20Sopenharmony_ci	"pclk_dbg",
8428c2ecf20Sopenharmony_ci	"aclk_core_niu",
8438c2ecf20Sopenharmony_ci	"aclk_gic400",
8448c2ecf20Sopenharmony_ci	"aclk_intmem",
8458c2ecf20Sopenharmony_ci	"hclk_rom",
8468c2ecf20Sopenharmony_ci	"pclk_grf",
8478c2ecf20Sopenharmony_ci	"pclk_cru",
8488c2ecf20Sopenharmony_ci	"pclk_sgrf",
8498c2ecf20Sopenharmony_ci	"pclk_timer0",
8508c2ecf20Sopenharmony_ci	"clk_timer0",
8518c2ecf20Sopenharmony_ci	"pclk_ddr_msch",
8528c2ecf20Sopenharmony_ci	"pclk_ddr_mon",
8538c2ecf20Sopenharmony_ci	"pclk_ddr_grf",
8548c2ecf20Sopenharmony_ci	"clk_ddrupctl",
8558c2ecf20Sopenharmony_ci	"clk_ddrmsch",
8568c2ecf20Sopenharmony_ci	"hclk_ahb1tom",
8578c2ecf20Sopenharmony_ci	"clk_jtag",
8588c2ecf20Sopenharmony_ci	"pclk_ddrphy",
8598c2ecf20Sopenharmony_ci	"pclk_pmu",
8608c2ecf20Sopenharmony_ci	"hclk_otg_pmu",
8618c2ecf20Sopenharmony_ci	"aclk_rga_niu",
8628c2ecf20Sopenharmony_ci	"pclk_vio_h2p",
8638c2ecf20Sopenharmony_ci	"hclk_vio_h2p",
8648c2ecf20Sopenharmony_ci	"aclk_vio_niu",
8658c2ecf20Sopenharmony_ci	"hclk_vio_niu",
8668c2ecf20Sopenharmony_ci	"aclk_vop_niu",
8678c2ecf20Sopenharmony_ci	"hclk_vop_niu",
8688c2ecf20Sopenharmony_ci	"aclk_gpu_niu",
8698c2ecf20Sopenharmony_ci	"aclk_rkvdec_niu",
8708c2ecf20Sopenharmony_ci	"hclk_rkvdec_niu",
8718c2ecf20Sopenharmony_ci	"aclk_vpu_niu",
8728c2ecf20Sopenharmony_ci	"hclk_vpu_niu",
8738c2ecf20Sopenharmony_ci	"aclk_rkvenc_niu",
8748c2ecf20Sopenharmony_ci	"hclk_rkvenc_niu",
8758c2ecf20Sopenharmony_ci	"aclk_gmac_niu",
8768c2ecf20Sopenharmony_ci	"pclk_gmac_niu",
8778c2ecf20Sopenharmony_ci	"pclk_phy_niu",
8788c2ecf20Sopenharmony_ci};
8798c2ecf20Sopenharmony_ci
8808c2ecf20Sopenharmony_cistatic void __init rk3328_clk_init(struct device_node *np)
8818c2ecf20Sopenharmony_ci{
8828c2ecf20Sopenharmony_ci	struct rockchip_clk_provider *ctx;
8838c2ecf20Sopenharmony_ci	void __iomem *reg_base;
8848c2ecf20Sopenharmony_ci
8858c2ecf20Sopenharmony_ci	reg_base = of_iomap(np, 0);
8868c2ecf20Sopenharmony_ci	if (!reg_base) {
8878c2ecf20Sopenharmony_ci		pr_err("%s: could not map cru region\n", __func__);
8888c2ecf20Sopenharmony_ci		return;
8898c2ecf20Sopenharmony_ci	}
8908c2ecf20Sopenharmony_ci
8918c2ecf20Sopenharmony_ci	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
8928c2ecf20Sopenharmony_ci	if (IS_ERR(ctx)) {
8938c2ecf20Sopenharmony_ci		pr_err("%s: rockchip clk init failed\n", __func__);
8948c2ecf20Sopenharmony_ci		iounmap(reg_base);
8958c2ecf20Sopenharmony_ci		return;
8968c2ecf20Sopenharmony_ci	}
8978c2ecf20Sopenharmony_ci
8988c2ecf20Sopenharmony_ci	rockchip_clk_register_plls(ctx, rk3328_pll_clks,
8998c2ecf20Sopenharmony_ci				   ARRAY_SIZE(rk3328_pll_clks),
9008c2ecf20Sopenharmony_ci				   RK3328_GRF_SOC_STATUS0);
9018c2ecf20Sopenharmony_ci	rockchip_clk_register_branches(ctx, rk3328_clk_branches,
9028c2ecf20Sopenharmony_ci				       ARRAY_SIZE(rk3328_clk_branches));
9038c2ecf20Sopenharmony_ci	rockchip_clk_protect_critical(rk3328_critical_clocks,
9048c2ecf20Sopenharmony_ci				      ARRAY_SIZE(rk3328_critical_clocks));
9058c2ecf20Sopenharmony_ci
9068c2ecf20Sopenharmony_ci	rockchip_clk_register_armclk(ctx, ARMCLK, "armclk",
9078c2ecf20Sopenharmony_ci				     mux_armclk_p, ARRAY_SIZE(mux_armclk_p),
9088c2ecf20Sopenharmony_ci				     &rk3328_cpuclk_data, rk3328_cpuclk_rates,
9098c2ecf20Sopenharmony_ci				     ARRAY_SIZE(rk3328_cpuclk_rates));
9108c2ecf20Sopenharmony_ci
9118c2ecf20Sopenharmony_ci	rockchip_register_softrst(np, 12, reg_base + RK3328_SOFTRST_CON(0),
9128c2ecf20Sopenharmony_ci				  ROCKCHIP_SOFTRST_HIWORD_MASK);
9138c2ecf20Sopenharmony_ci
9148c2ecf20Sopenharmony_ci	rockchip_register_restart_notifier(ctx, RK3328_GLB_SRST_FST, NULL);
9158c2ecf20Sopenharmony_ci
9168c2ecf20Sopenharmony_ci	rockchip_clk_of_add_provider(np, ctx);
9178c2ecf20Sopenharmony_ci}
9188c2ecf20Sopenharmony_ciCLK_OF_DECLARE(rk3328_cru, "rockchip,rk3328-cru", rk3328_clk_init);
919