xref: /linux/drivers/clk/rockchip/clk-rv1126.c (revision a1c613ae4c322ddd58d5a8539dbfba2a0380a8c0)
12408ab5aSJagan Teki // SPDX-License-Identifier: GPL-2.0
22408ab5aSJagan Teki /*
32408ab5aSJagan Teki  * Copyright (c) 2019 Rockchip Electronics Co. Ltd.
42408ab5aSJagan Teki  * Author: Finley Xiao <finley.xiao@rock-chips.com>
52408ab5aSJagan Teki  */
62408ab5aSJagan Teki 
72408ab5aSJagan Teki #include <linux/clk-provider.h>
82408ab5aSJagan Teki #include <linux/module.h>
92408ab5aSJagan Teki #include <linux/of.h>
102408ab5aSJagan Teki #include <linux/of_address.h>
11a96cbb14SRob Herring #include <linux/platform_device.h>
122408ab5aSJagan Teki #include <linux/syscore_ops.h>
132408ab5aSJagan Teki #include <dt-bindings/clock/rockchip,rv1126-cru.h>
142408ab5aSJagan Teki #include "clk.h"
152408ab5aSJagan Teki 
162408ab5aSJagan Teki #define RV1126_GMAC_CON			0x460
172408ab5aSJagan Teki #define RV1126_GRF_IOFUNC_CON1		0x10264
182408ab5aSJagan Teki #define RV1126_GRF_SOC_STATUS0		0x10
192408ab5aSJagan Teki 
202408ab5aSJagan Teki #define RV1126_FRAC_MAX_PRATE		1200000000
212408ab5aSJagan Teki #define RV1126_CSIOUT_FRAC_MAX_PRATE	300000000
222408ab5aSJagan Teki 
232408ab5aSJagan Teki enum rv1126_pmu_plls {
242408ab5aSJagan Teki 	gpll,
252408ab5aSJagan Teki };
262408ab5aSJagan Teki 
272408ab5aSJagan Teki enum rv1126_plls {
282408ab5aSJagan Teki 	apll, dpll, cpll, hpll,
292408ab5aSJagan Teki };
302408ab5aSJagan Teki 
312408ab5aSJagan Teki static struct rockchip_pll_rate_table rv1126_pll_rates[] = {
322408ab5aSJagan Teki 	/* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */
332408ab5aSJagan Teki 	RK3036_PLL_RATE(1608000000, 1, 67, 1, 1, 1, 0),
342408ab5aSJagan Teki 	RK3036_PLL_RATE(1600000000, 3, 200, 1, 1, 1, 0),
352408ab5aSJagan Teki 	RK3036_PLL_RATE(1584000000, 1, 132, 2, 1, 1, 0),
362408ab5aSJagan Teki 	RK3036_PLL_RATE(1560000000, 1, 130, 2, 1, 1, 0),
372408ab5aSJagan Teki 	RK3036_PLL_RATE(1536000000, 1, 128, 2, 1, 1, 0),
382408ab5aSJagan Teki 	RK3036_PLL_RATE(1512000000, 1, 126, 2, 1, 1, 0),
392408ab5aSJagan Teki 	RK3036_PLL_RATE(1488000000, 1, 124, 2, 1, 1, 0),
402408ab5aSJagan Teki 	RK3036_PLL_RATE(1464000000, 1, 122, 2, 1, 1, 0),
412408ab5aSJagan Teki 	RK3036_PLL_RATE(1440000000, 1, 120, 2, 1, 1, 0),
422408ab5aSJagan Teki 	RK3036_PLL_RATE(1416000000, 1, 118, 2, 1, 1, 0),
432408ab5aSJagan Teki 	RK3036_PLL_RATE(1400000000, 3, 350, 2, 1, 1, 0),
442408ab5aSJagan Teki 	RK3036_PLL_RATE(1392000000, 1, 116, 2, 1, 1, 0),
452408ab5aSJagan Teki 	RK3036_PLL_RATE(1368000000, 1, 114, 2, 1, 1, 0),
462408ab5aSJagan Teki 	RK3036_PLL_RATE(1344000000, 1, 112, 2, 1, 1, 0),
472408ab5aSJagan Teki 	RK3036_PLL_RATE(1320000000, 1, 110, 2, 1, 1, 0),
482408ab5aSJagan Teki 	RK3036_PLL_RATE(1296000000, 1, 108, 2, 1, 1, 0),
492408ab5aSJagan Teki 	RK3036_PLL_RATE(1272000000, 1, 106, 2, 1, 1, 0),
502408ab5aSJagan Teki 	RK3036_PLL_RATE(1248000000, 1, 104, 2, 1, 1, 0),
512408ab5aSJagan Teki 	RK3036_PLL_RATE(1200000000, 1, 100, 2, 1, 1, 0),
522408ab5aSJagan Teki 	RK3036_PLL_RATE(1188000000, 1, 99, 2, 1, 1, 0),
532408ab5aSJagan Teki 	RK3036_PLL_RATE(1104000000, 1, 92, 2, 1, 1, 0),
542408ab5aSJagan Teki 	RK3036_PLL_RATE(1100000000, 3, 275, 2, 1, 1, 0),
552408ab5aSJagan Teki 	RK3036_PLL_RATE(1008000000, 1, 84, 2, 1, 1, 0),
562408ab5aSJagan Teki 	RK3036_PLL_RATE(1000000000, 3, 250, 2, 1, 1, 0),
572408ab5aSJagan Teki 	RK3036_PLL_RATE(984000000, 1, 82, 2, 1, 1, 0),
582408ab5aSJagan Teki 	RK3036_PLL_RATE(960000000, 1, 80, 2, 1, 1, 0),
592408ab5aSJagan Teki 	RK3036_PLL_RATE(936000000, 1, 78, 2, 1, 1, 0),
602408ab5aSJagan Teki 	RK3036_PLL_RATE(912000000, 1, 76, 2, 1, 1, 0),
612408ab5aSJagan Teki 	RK3036_PLL_RATE(900000000, 1, 75, 2, 1, 1, 0),
622408ab5aSJagan Teki 	RK3036_PLL_RATE(888000000, 1, 74, 2, 1, 1, 0),
632408ab5aSJagan Teki 	RK3036_PLL_RATE(864000000, 1, 72, 2, 1, 1, 0),
642408ab5aSJagan Teki 	RK3036_PLL_RATE(840000000, 1, 70, 2, 1, 1, 0),
652408ab5aSJagan Teki 	RK3036_PLL_RATE(816000000, 1, 68, 2, 1, 1, 0),
662408ab5aSJagan Teki 	RK3036_PLL_RATE(800000000, 3, 200, 2, 1, 1, 0),
672408ab5aSJagan Teki 	RK3036_PLL_RATE(700000000, 3, 350, 4, 1, 1, 0),
682408ab5aSJagan Teki 	RK3036_PLL_RATE(696000000, 1, 116, 4, 1, 1, 0),
692408ab5aSJagan Teki 	RK3036_PLL_RATE(624000000, 1, 104, 4, 1, 1, 0),
702408ab5aSJagan Teki 	RK3036_PLL_RATE(600000000, 1, 100, 4, 1, 1, 0),
712408ab5aSJagan Teki 	RK3036_PLL_RATE(594000000, 1, 99, 4, 1, 1, 0),
722408ab5aSJagan Teki 	RK3036_PLL_RATE(504000000, 1, 84, 4, 1, 1, 0),
732408ab5aSJagan Teki 	RK3036_PLL_RATE(500000000, 1, 125, 6, 1, 1, 0),
742408ab5aSJagan Teki 	RK3036_PLL_RATE(408000000, 1, 68, 2, 2, 1, 0),
752408ab5aSJagan Teki 	RK3036_PLL_RATE(312000000, 1, 78, 6, 1, 1, 0),
762408ab5aSJagan Teki 	RK3036_PLL_RATE(216000000, 1, 72, 4, 2, 1, 0),
772408ab5aSJagan Teki 	RK3036_PLL_RATE(96000000, 1, 96, 6, 4, 1, 0),
782408ab5aSJagan Teki 	{ /* sentinel */ },
792408ab5aSJagan Teki };
802408ab5aSJagan Teki 
812408ab5aSJagan Teki #define RV1126_DIV_ACLK_CORE_MASK	0xf
822408ab5aSJagan Teki #define RV1126_DIV_ACLK_CORE_SHIFT	4
832408ab5aSJagan Teki #define RV1126_DIV_PCLK_DBG_MASK	0x7
842408ab5aSJagan Teki #define RV1126_DIV_PCLK_DBG_SHIFT	0
852408ab5aSJagan Teki 
862408ab5aSJagan Teki #define RV1126_CLKSEL1(_aclk_core, _pclk_dbg)				\
872408ab5aSJagan Teki {									\
882408ab5aSJagan Teki 	.reg = RV1126_CLKSEL_CON(1),					\
892408ab5aSJagan Teki 	.val = HIWORD_UPDATE(_aclk_core, RV1126_DIV_ACLK_CORE_MASK,	\
902408ab5aSJagan Teki 			     RV1126_DIV_ACLK_CORE_SHIFT) |		\
912408ab5aSJagan Teki 	       HIWORD_UPDATE(_pclk_dbg, RV1126_DIV_PCLK_DBG_MASK,	\
922408ab5aSJagan Teki 			     RV1126_DIV_PCLK_DBG_SHIFT),		\
932408ab5aSJagan Teki }
942408ab5aSJagan Teki 
952408ab5aSJagan Teki #define RV1126_CPUCLK_RATE(_prate, _aclk_core, _pclk_dbg)		\
962408ab5aSJagan Teki {									\
972408ab5aSJagan Teki 	.prate = _prate,						\
982408ab5aSJagan Teki 	.divs = {							\
992408ab5aSJagan Teki 		RV1126_CLKSEL1(_aclk_core, _pclk_dbg),			\
1002408ab5aSJagan Teki 	},								\
1012408ab5aSJagan Teki }
1022408ab5aSJagan Teki 
1032408ab5aSJagan Teki static struct rockchip_cpuclk_rate_table rv1126_cpuclk_rates[] __initdata = {
1042408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1608000000, 1, 7),
1052408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1584000000, 1, 7),
1062408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1560000000, 1, 7),
1072408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1536000000, 1, 7),
1082408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1512000000, 1, 7),
1092408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1488000000, 1, 5),
1102408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1464000000, 1, 5),
1112408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1440000000, 1, 5),
1122408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1416000000, 1, 5),
1132408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1392000000, 1, 5),
1142408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1368000000, 1, 5),
1152408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1344000000, 1, 5),
1162408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1320000000, 1, 5),
1172408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1296000000, 1, 5),
1182408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1272000000, 1, 5),
1192408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1248000000, 1, 5),
1202408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1224000000, 1, 5),
1212408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1200000000, 1, 5),
1222408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1104000000, 1, 5),
1232408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(1008000000, 1, 5),
1242408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(912000000, 1, 5),
1252408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(816000000, 1, 3),
1262408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(696000000, 1, 3),
1272408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(600000000, 1, 3),
1282408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(408000000, 1, 1),
1292408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(312000000, 1, 1),
1302408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(216000000,  1, 1),
1312408ab5aSJagan Teki 	RV1126_CPUCLK_RATE(96000000, 1, 1),
1322408ab5aSJagan Teki };
1332408ab5aSJagan Teki 
1342408ab5aSJagan Teki static const struct rockchip_cpuclk_reg_data rv1126_cpuclk_data = {
1352408ab5aSJagan Teki 	.core_reg[0] = RV1126_CLKSEL_CON(0),
1362408ab5aSJagan Teki 	.div_core_shift[0] = 0,
1372408ab5aSJagan Teki 	.div_core_mask[0] = 0x1f,
1382408ab5aSJagan Teki 	.num_cores = 1,
1392408ab5aSJagan Teki 	.mux_core_alt = 0,
1402408ab5aSJagan Teki 	.mux_core_main = 2,
1412408ab5aSJagan Teki 	.mux_core_shift = 6,
1422408ab5aSJagan Teki 	.mux_core_mask = 0x3,
1432408ab5aSJagan Teki };
1442408ab5aSJagan Teki 
1452408ab5aSJagan Teki PNAME(mux_pll_p)			= { "xin24m" };
1462408ab5aSJagan Teki PNAME(mux_rtc32k_p)			= { "clk_pmupvtm_divout", "xin32k", "clk_osc0_div32k" };
1472408ab5aSJagan Teki PNAME(mux_wifi_p)			= { "clk_wifi_osc0", "clk_wifi_div" };
1482408ab5aSJagan Teki PNAME(mux_gpll_usb480m_cpll_xin24m_p)	= { "gpll", "usb480m", "cpll", "xin24m" };
1492408ab5aSJagan Teki PNAME(mux_uart1_p)			= { "sclk_uart1_div", "sclk_uart1_fracdiv", "xin24m" };
1502408ab5aSJagan Teki PNAME(mux_xin24m_gpll_p)		= { "xin24m", "gpll" };
1512408ab5aSJagan Teki PNAME(mux_gpll_xin24m_p)		= { "gpll", "xin24m" };
1522408ab5aSJagan Teki PNAME(mux_xin24m_32k_p)			= { "xin24m", "clk_rtc32k" };
1532408ab5aSJagan Teki PNAME(mux_usbphy_otg_ref_p)		= { "clk_ref12m", "xin_osc0_div2_usbphyref_otg" };
1542408ab5aSJagan Teki PNAME(mux_usbphy_host_ref_p)		= { "clk_ref12m", "xin_osc0_div2_usbphyref_host" };
1552408ab5aSJagan Teki PNAME(mux_mipidsiphy_ref_p)		= { "clk_ref24m", "xin_osc0_mipiphyref" };
1562408ab5aSJagan Teki PNAME(mux_usb480m_p)			= { "xin24m", "usb480m_phy", "clk_rtc32k" };
1572408ab5aSJagan Teki PNAME(mux_armclk_p)			= { "gpll", "cpll", "apll" };
1582408ab5aSJagan Teki PNAME(mux_gpll_cpll_dpll_p)		= { "gpll", "cpll", "dummy_dpll" };
1592408ab5aSJagan Teki PNAME(mux_gpll_cpll_p)			= { "gpll", "cpll" };
1602408ab5aSJagan Teki PNAME(mux_hclk_pclk_pdbus_p)		= { "gpll", "dummy_cpll" };
1612408ab5aSJagan Teki PNAME(mux_gpll_cpll_usb480m_xin24m_p)	= { "gpll", "cpll", "usb480m", "xin24m" };
1622408ab5aSJagan Teki PNAME(mux_uart0_p)			= { "sclk_uart0_div", "sclk_uart0_frac", "xin24m" };
1632408ab5aSJagan Teki PNAME(mux_uart2_p)			= { "sclk_uart2_div", "sclk_uart2_frac", "xin24m" };
1642408ab5aSJagan Teki PNAME(mux_uart3_p)			= { "sclk_uart3_div", "sclk_uart3_frac", "xin24m" };
1652408ab5aSJagan Teki PNAME(mux_uart4_p)			= { "sclk_uart4_div", "sclk_uart4_frac", "xin24m" };
1662408ab5aSJagan Teki PNAME(mux_uart5_p)			= { "sclk_uart5_div", "sclk_uart5_frac", "xin24m" };
1672408ab5aSJagan Teki PNAME(mux_cpll_gpll_p)			= { "cpll", "gpll" };
1682408ab5aSJagan Teki PNAME(mux_i2s0_tx_p)			= { "mclk_i2s0_tx_div", "mclk_i2s0_tx_fracdiv", "i2s0_mclkin", "xin12m" };
1692408ab5aSJagan Teki PNAME(mux_i2s0_rx_p)			= { "mclk_i2s0_rx_div", "mclk_i2s0_rx_fracdiv", "i2s0_mclkin", "xin12m" };
1702408ab5aSJagan Teki PNAME(mux_i2s0_tx_out2io_p)		= { "mclk_i2s0_tx", "xin12m" };
1712408ab5aSJagan Teki PNAME(mux_i2s0_rx_out2io_p)		= { "mclk_i2s0_rx", "xin12m" };
1722408ab5aSJagan Teki PNAME(mux_i2s1_p)			= { "mclk_i2s1_div", "mclk_i2s1_fracdiv", "i2s1_mclkin", "xin12m" };
1732408ab5aSJagan Teki PNAME(mux_i2s1_out2io_p)		= { "mclk_i2s1", "xin12m" };
1742408ab5aSJagan Teki PNAME(mux_i2s2_p)			= { "mclk_i2s2_div", "mclk_i2s2_fracdiv", "i2s2_mclkin", "xin12m" };
1752408ab5aSJagan Teki PNAME(mux_i2s2_out2io_p)		= { "mclk_i2s2", "xin12m" };
1762408ab5aSJagan Teki PNAME(mux_gpll_cpll_xin24m_p)		= { "gpll", "cpll", "xin24m" };
1772408ab5aSJagan Teki PNAME(mux_audpwm_p)			= { "sclk_audpwm_div", "sclk_audpwm_fracdiv", "xin24m" };
178*5c7a71fdSJagan Teki PNAME(mux_dclk_vop_p)			= { "dclk_vop_div", "dclk_vop_fracdiv", "xin24m" };
1792408ab5aSJagan Teki PNAME(mux_usb480m_gpll_p)		= { "usb480m", "gpll" };
1802408ab5aSJagan Teki PNAME(clk_gmac_src_m0_p)		= { "clk_gmac_div", "clk_gmac_rgmii_m0" };
1812408ab5aSJagan Teki PNAME(clk_gmac_src_m1_p)		= { "clk_gmac_div", "clk_gmac_rgmii_m1" };
1822408ab5aSJagan Teki PNAME(mux_clk_gmac_src_p)		= { "clk_gmac_src_m0", "clk_gmac_src_m1" };
1832408ab5aSJagan Teki PNAME(mux_rgmii_clk_p)			= { "clk_gmac_tx_div50", "clk_gmac_tx_div5", "clk_gmac_tx_src", "clk_gmac_tx_src"};
1842408ab5aSJagan Teki PNAME(mux_rmii_clk_p)			= { "clk_gmac_rx_div20", "clk_gmac_rx_div2" };
1852408ab5aSJagan Teki PNAME(mux_gmac_tx_rx_p)			= { "rgmii_mode_clk", "rmii_mode_clk" };
1862408ab5aSJagan Teki PNAME(mux_dpll_gpll_p)			= { "dpll", "gpll" };
1872408ab5aSJagan Teki 
1882408ab5aSJagan Teki static u32 rgmii_mux_idx[]		= { 2, 3, 0, 1 };
1892408ab5aSJagan Teki 
1902408ab5aSJagan Teki static struct rockchip_pll_clock rv1126_pmu_pll_clks[] __initdata = {
1912408ab5aSJagan Teki 	[gpll] = PLL(pll_rk3328, PLL_GPLL, "gpll",  mux_pll_p,
1922408ab5aSJagan Teki 		     0, RV1126_PMU_PLL_CON(0),
1932408ab5aSJagan Teki 		     RV1126_PMU_MODE, 0, 3, 0, rv1126_pll_rates),
1942408ab5aSJagan Teki };
1952408ab5aSJagan Teki 
1962408ab5aSJagan Teki static struct rockchip_pll_clock rv1126_pll_clks[] __initdata = {
1972408ab5aSJagan Teki 	[apll] = PLL(pll_rk3328, PLL_APLL, "apll", mux_pll_p,
1982408ab5aSJagan Teki 		     0, RV1126_PLL_CON(0),
1992408ab5aSJagan Teki 		     RV1126_MODE_CON, 0, 0, 0, rv1126_pll_rates),
2002408ab5aSJagan Teki 	[dpll] = PLL(pll_rk3328, PLL_DPLL, "dpll", mux_pll_p,
2012408ab5aSJagan Teki 		     0, RV1126_PLL_CON(8),
2022408ab5aSJagan Teki 		     RV1126_MODE_CON, 2, 1, 0, NULL),
2032408ab5aSJagan Teki 	[cpll] = PLL(pll_rk3328, PLL_CPLL, "cpll", mux_pll_p,
2042408ab5aSJagan Teki 		     0, RV1126_PLL_CON(16),
2052408ab5aSJagan Teki 		     RV1126_MODE_CON, 4, 2, 0, rv1126_pll_rates),
2062408ab5aSJagan Teki 	[hpll] = PLL(pll_rk3328, PLL_HPLL, "hpll", mux_pll_p,
2072408ab5aSJagan Teki 		     0, RV1126_PLL_CON(24),
2082408ab5aSJagan Teki 		     RV1126_MODE_CON, 6, 4, 0, rv1126_pll_rates),
2092408ab5aSJagan Teki };
2102408ab5aSJagan Teki 
2112408ab5aSJagan Teki #define MFLAGS CLK_MUX_HIWORD_MASK
2122408ab5aSJagan Teki #define DFLAGS CLK_DIVIDER_HIWORD_MASK
2132408ab5aSJagan Teki #define GFLAGS (CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE)
2142408ab5aSJagan Teki 
2152408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_rtc32k_fracmux __initdata =
2162408ab5aSJagan Teki 	MUX(CLK_RTC32K, "clk_rtc32k", mux_rtc32k_p, CLK_SET_RATE_PARENT,
2172408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(0), 7, 2, MFLAGS);
2182408ab5aSJagan Teki 
2192408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_uart1_fracmux __initdata =
2202408ab5aSJagan Teki 	MUX(SCLK_UART1_MUX, "sclk_uart1_mux", mux_uart1_p, CLK_SET_RATE_PARENT,
2212408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(4), 10, 2, MFLAGS);
2222408ab5aSJagan Teki 
2232408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_uart0_fracmux __initdata =
2242408ab5aSJagan Teki 	MUX(SCLK_UART0_MUX, "sclk_uart0_mux", mux_uart0_p, CLK_SET_RATE_PARENT,
2252408ab5aSJagan Teki 			RV1126_CLKSEL_CON(10), 10, 2, MFLAGS);
2262408ab5aSJagan Teki 
2272408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_uart2_fracmux __initdata =
2282408ab5aSJagan Teki 	MUX(SCLK_UART2_MUX, "sclk_uart2_mux", mux_uart2_p, CLK_SET_RATE_PARENT,
2292408ab5aSJagan Teki 			RV1126_CLKSEL_CON(12), 10, 2, MFLAGS);
2302408ab5aSJagan Teki 
2312408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_uart3_fracmux __initdata =
2322408ab5aSJagan Teki 	MUX(SCLK_UART3_MUX, "sclk_uart3_mux", mux_uart3_p, CLK_SET_RATE_PARENT,
2332408ab5aSJagan Teki 			RV1126_CLKSEL_CON(14), 10, 2, MFLAGS);
2342408ab5aSJagan Teki 
2352408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_uart4_fracmux __initdata =
2362408ab5aSJagan Teki 	MUX(SCLK_UART4_MUX, "sclk_uart4_mux", mux_uart4_p, CLK_SET_RATE_PARENT,
2372408ab5aSJagan Teki 			RV1126_CLKSEL_CON(16), 10, 2, MFLAGS);
2382408ab5aSJagan Teki 
2392408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_uart5_fracmux __initdata =
2402408ab5aSJagan Teki 	MUX(SCLK_UART5_MUX, "sclk_uart5_mux", mux_uart5_p, CLK_SET_RATE_PARENT,
2412408ab5aSJagan Teki 			RV1126_CLKSEL_CON(18), 10, 2, MFLAGS);
2422408ab5aSJagan Teki 
2432408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_i2s0_tx_fracmux __initdata =
2442408ab5aSJagan Teki 	MUX(MCLK_I2S0_TX_MUX, "mclk_i2s0_tx_mux", mux_i2s0_tx_p, CLK_SET_RATE_PARENT,
2452408ab5aSJagan Teki 			RV1126_CLKSEL_CON(30), 0, 2, MFLAGS);
2462408ab5aSJagan Teki 
2472408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_i2s0_rx_fracmux __initdata =
2482408ab5aSJagan Teki 	MUX(MCLK_I2S0_RX_MUX, "mclk_i2s0_rx_mux", mux_i2s0_rx_p, CLK_SET_RATE_PARENT,
2492408ab5aSJagan Teki 			RV1126_CLKSEL_CON(30), 2, 2, MFLAGS);
2502408ab5aSJagan Teki 
2512408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_i2s1_fracmux __initdata =
2522408ab5aSJagan Teki 	MUX(MCLK_I2S1_MUX, "mclk_i2s1_mux", mux_i2s1_p, CLK_SET_RATE_PARENT,
2532408ab5aSJagan Teki 			RV1126_CLKSEL_CON(31), 8, 2, MFLAGS);
2542408ab5aSJagan Teki 
2552408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_i2s2_fracmux __initdata =
2562408ab5aSJagan Teki 	MUX(MCLK_I2S2_MUX, "mclk_i2s2_mux", mux_i2s2_p, CLK_SET_RATE_PARENT,
2572408ab5aSJagan Teki 			RV1126_CLKSEL_CON(33), 8, 2, MFLAGS);
2582408ab5aSJagan Teki 
2592408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_audpwm_fracmux __initdata =
2602408ab5aSJagan Teki 	MUX(SCLK_AUDPWM_MUX, "mclk_audpwm_mux", mux_audpwm_p, CLK_SET_RATE_PARENT,
2612408ab5aSJagan Teki 			RV1126_CLKSEL_CON(36), 8, 2, MFLAGS);
2622408ab5aSJagan Teki 
263*5c7a71fdSJagan Teki static struct rockchip_clk_branch rv1126_dclk_vop_fracmux __initdata =
264*5c7a71fdSJagan Teki 	MUX(DCLK_VOP_MUX, "dclk_vop_mux", mux_dclk_vop_p, CLK_SET_RATE_PARENT,
265*5c7a71fdSJagan Teki 	    RV1126_CLKSEL_CON(47), 10, 2, MFLAGS);
266*5c7a71fdSJagan Teki 
2672408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_clk_pmu_branches[] __initdata = {
2682408ab5aSJagan Teki 	/*
2692408ab5aSJagan Teki 	 * Clock-Architecture Diagram 2
2702408ab5aSJagan Teki 	 */
2712408ab5aSJagan Teki 	/* PD_PMU */
2722408ab5aSJagan Teki 	COMPOSITE_NOMUX(PCLK_PDPMU, "pclk_pdpmu", "gpll", CLK_IGNORE_UNUSED,
2732408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(1), 0, 5, DFLAGS,
2742408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 0, GFLAGS),
2752408ab5aSJagan Teki 
2762408ab5aSJagan Teki 	COMPOSITE_FRACMUX(CLK_OSC0_DIV32K, "clk_osc0_div32k", "xin24m", CLK_IGNORE_UNUSED,
2772408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(13), 0,
2782408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(2), 9, GFLAGS,
2792408ab5aSJagan Teki 			&rv1126_rtc32k_fracmux),
2802408ab5aSJagan Teki 
2812408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_WIFI_DIV, "clk_wifi_div", "gpll", 0,
2822408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(12), 0, 6, DFLAGS,
2832408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(2), 10, GFLAGS),
2842408ab5aSJagan Teki 	GATE(CLK_WIFI_OSC0, "clk_wifi_osc0", "xin24m", 0,
2852408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(2), 11, GFLAGS),
2862408ab5aSJagan Teki 	MUX(CLK_WIFI, "clk_wifi", mux_wifi_p, CLK_SET_RATE_PARENT,
2872408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(12), 8, 1, MFLAGS),
2882408ab5aSJagan Teki 
2892408ab5aSJagan Teki 	GATE(PCLK_PMU, "pclk_pmu", "pclk_pdpmu", CLK_IGNORE_UNUSED,
2902408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 1, GFLAGS),
2912408ab5aSJagan Teki 
2922408ab5aSJagan Teki 	GATE(PCLK_UART1, "pclk_uart1", "pclk_pdpmu", 0,
2932408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 11, GFLAGS),
2942408ab5aSJagan Teki 	COMPOSITE(SCLK_UART1_DIV, "sclk_uart1_div", mux_gpll_usb480m_cpll_xin24m_p, 0,
2952408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(4), 8, 2, MFLAGS, 0, 7, DFLAGS,
2962408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 12, GFLAGS),
2972408ab5aSJagan Teki 	COMPOSITE_FRACMUX(SCLK_UART1_FRACDIV, "sclk_uart1_fracdiv", "sclk_uart1_div",
2982408ab5aSJagan Teki 			CLK_SET_RATE_PARENT,
2992408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(5), 0,
3002408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 13, GFLAGS,
3012408ab5aSJagan Teki 			&rv1126_uart1_fracmux),
3022408ab5aSJagan Teki 	GATE(SCLK_UART1, "sclk_uart1", "sclk_uart1_mux", 0,
3032408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 14, GFLAGS),
3042408ab5aSJagan Teki 
3052408ab5aSJagan Teki 	GATE(PCLK_I2C0, "pclk_i2c0", "pclk_pdpmu", 0,
3062408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 5, GFLAGS),
3072408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_I2C0, "clk_i2c0", "gpll", 0,
3082408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(2), 0, 7, DFLAGS,
3092408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 6, GFLAGS),
3102408ab5aSJagan Teki 	GATE(PCLK_I2C2, "pclk_i2c2", "pclk_pdpmu", 0,
3112408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 9, GFLAGS),
3122408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_I2C2, "clk_i2c2", "gpll", 0,
3132408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(3), 0, 7, DFLAGS,
3142408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 10, GFLAGS),
3152408ab5aSJagan Teki 
3162408ab5aSJagan Teki 	GATE(CLK_CAPTURE_PWM0, "clk_capture_pwm0", "xin24m", 0,
3172408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 2, GFLAGS),
3182408ab5aSJagan Teki 	GATE(PCLK_PWM0, "pclk_pwm0", "pclk_pdpmu", 0,
3192408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 0, GFLAGS),
3202408ab5aSJagan Teki 	COMPOSITE(CLK_PWM0, "clk_pwm0", mux_xin24m_gpll_p, 0,
3212408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(6), 7, 1, MFLAGS, 0, 7, DFLAGS,
3222408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 1, GFLAGS),
3232408ab5aSJagan Teki 	GATE(CLK_CAPTURE_PWM1, "clk_capture_pwm1", "xin24m", 0,
3242408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 5, GFLAGS),
3252408ab5aSJagan Teki 	GATE(PCLK_PWM1, "pclk_pwm1", "pclk_pdpmu", 0,
3262408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 3, GFLAGS),
3272408ab5aSJagan Teki 	COMPOSITE(CLK_PWM1, "clk_pwm1", mux_xin24m_gpll_p, 0,
3282408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(6), 15, 1, MFLAGS, 8, 7, DFLAGS,
3292408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 4, GFLAGS),
3302408ab5aSJagan Teki 
3312408ab5aSJagan Teki 	GATE(PCLK_SPI0, "pclk_spi0", "pclk_pdpmu", 0,
3322408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 11, GFLAGS),
3332408ab5aSJagan Teki 	COMPOSITE(CLK_SPI0, "clk_spi0", mux_gpll_xin24m_p, 0,
3342408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(9), 7, 1, MFLAGS, 0, 7, DFLAGS,
3352408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 12, GFLAGS),
3362408ab5aSJagan Teki 
3372408ab5aSJagan Teki 	GATE(PCLK_GPIO0, "pclk_gpio0", "pclk_pdpmu", 0,
3382408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 9, GFLAGS),
3392408ab5aSJagan Teki 	COMPOSITE_NODIV(DBCLK_GPIO0, "dbclk_gpio0", mux_xin24m_32k_p, 0,
3402408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(8), 15, 1, MFLAGS,
3412408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 10, GFLAGS),
3422408ab5aSJagan Teki 
3432408ab5aSJagan Teki 	GATE(PCLK_PMUPVTM, "pclk_pmupvtm", "pclk_pdpmu", 0,
3442408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(2), 6, GFLAGS),
3452408ab5aSJagan Teki 	GATE(CLK_PMUPVTM, "clk_pmupvtm", "xin24m", 0,
3462408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(2), 5, GFLAGS),
3472408ab5aSJagan Teki 	GATE(CLK_CORE_PMUPVTM, "clk_core_pmupvtm", "xin24m", 0,
3482408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(2), 7, GFLAGS),
3492408ab5aSJagan Teki 
3502408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_REF12M, "clk_ref12m", "gpll", 0,
3512408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(7), 8, 7, DFLAGS,
3522408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 15, GFLAGS),
3532408ab5aSJagan Teki 	GATE(0, "xin_osc0_usbphyref_otg", "xin24m", 0,
3542408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 6, GFLAGS),
3552408ab5aSJagan Teki 	GATE(0, "xin_osc0_usbphyref_host", "xin24m", 0,
3562408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 7, GFLAGS),
3572408ab5aSJagan Teki 	FACTOR(0, "xin_osc0_div2_usbphyref_otg", "xin_osc0_usbphyref_otg", 0, 1, 2),
3582408ab5aSJagan Teki 	FACTOR(0, "xin_osc0_div2_usbphyref_host", "xin_osc0_usbphyref_host", 0, 1, 2),
3592408ab5aSJagan Teki 	MUX(CLK_USBPHY_OTG_REF, "clk_usbphy_otg_ref", mux_usbphy_otg_ref_p, CLK_SET_RATE_PARENT,
3602408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(7), 6, 1, MFLAGS),
3612408ab5aSJagan Teki 	MUX(CLK_USBPHY_HOST_REF, "clk_usbphy_host_ref", mux_usbphy_host_ref_p, CLK_SET_RATE_PARENT,
3622408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(7), 7, 1, MFLAGS),
3632408ab5aSJagan Teki 
3642408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_REF24M, "clk_ref24m", "gpll", 0,
3652408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(7), 0, 6, DFLAGS,
3662408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 14, GFLAGS),
3672408ab5aSJagan Teki 	GATE(0, "xin_osc0_mipiphyref", "xin24m", 0,
3682408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 8, GFLAGS),
3692408ab5aSJagan Teki 	MUX(CLK_MIPIDSIPHY_REF, "clk_mipidsiphy_ref", mux_mipidsiphy_ref_p, CLK_SET_RATE_PARENT,
3702408ab5aSJagan Teki 			RV1126_PMU_CLKSEL_CON(7), 15, 1, MFLAGS),
3712408ab5aSJagan Teki 
3722408ab5aSJagan Teki 	GATE(CLK_PMU, "clk_pmu", "xin24m", CLK_IGNORE_UNUSED,
3732408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 15, GFLAGS),
3742408ab5aSJagan Teki 
3752408ab5aSJagan Teki 	GATE(PCLK_PMUSGRF, "pclk_pmusgrf", "pclk_pdpmu", CLK_IGNORE_UNUSED,
3762408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 4, GFLAGS),
3772408ab5aSJagan Teki 	GATE(PCLK_PMUGRF, "pclk_pmugrf", "pclk_pdpmu", CLK_IGNORE_UNUSED,
3782408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(1), 13, GFLAGS),
3792408ab5aSJagan Teki 	GATE(PCLK_PMUCRU, "pclk_pmucru", "pclk_pdpmu", CLK_IGNORE_UNUSED,
3802408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(2), 4, GFLAGS),
3812408ab5aSJagan Teki 	GATE(PCLK_CHIPVEROTP, "pclk_chipverotp", "pclk_pdpmu", CLK_IGNORE_UNUSED,
3822408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(2), 0, GFLAGS),
3832408ab5aSJagan Teki 	GATE(PCLK_PDPMU_NIU, "pclk_pdpmu_niu", "pclk_pdpmu", CLK_IGNORE_UNUSED,
3842408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 2, GFLAGS),
3852408ab5aSJagan Teki 
3862408ab5aSJagan Teki 	GATE(PCLK_SCRKEYGEN, "pclk_scrkeygen", "pclk_pdpmu", 0,
3872408ab5aSJagan Teki 			RV1126_PMU_CLKGATE_CON(0), 7, GFLAGS),
3882408ab5aSJagan Teki };
3892408ab5aSJagan Teki 
3902408ab5aSJagan Teki static struct rockchip_clk_branch rv1126_clk_branches[] __initdata = {
3912408ab5aSJagan Teki 	/*
3922408ab5aSJagan Teki 	 * Clock-Architecture Diagram 1
3932408ab5aSJagan Teki 	 */
3942408ab5aSJagan Teki 	MUX(USB480M, "usb480m", mux_usb480m_p, CLK_SET_RATE_PARENT,
3952408ab5aSJagan Teki 			RV1126_MODE_CON, 10, 2, MFLAGS),
3962408ab5aSJagan Teki 	FACTOR(0, "xin12m", "xin24m", 0, 1, 2),
3972408ab5aSJagan Teki 
3982408ab5aSJagan Teki 	/*
3992408ab5aSJagan Teki 	 * Clock-Architecture Diagram 3
4002408ab5aSJagan Teki 	 */
4012408ab5aSJagan Teki 	/* PD_CORE */
4022408ab5aSJagan Teki 	COMPOSITE_NOMUX(0, "pclk_dbg", "armclk", CLK_IGNORE_UNUSED,
4032408ab5aSJagan Teki 			RV1126_CLKSEL_CON(1), 0, 3, DFLAGS | CLK_DIVIDER_READ_ONLY,
4042408ab5aSJagan Teki 			RV1126_CLKGATE_CON(0), 6, GFLAGS),
4052408ab5aSJagan Teki 	GATE(CLK_CORE_CPUPVTM, "clk_core_cpupvtm", "armclk", 0,
4062408ab5aSJagan Teki 			RV1126_CLKGATE_CON(0), 12, GFLAGS),
4072408ab5aSJagan Teki 	GATE(PCLK_CPUPVTM, "pclk_cpupvtm", "pclk_dbg", 0,
4082408ab5aSJagan Teki 			RV1126_CLKGATE_CON(0), 10, GFLAGS),
4092408ab5aSJagan Teki 	GATE(CLK_CPUPVTM, "clk_cpupvtm", "xin24m", 0,
4102408ab5aSJagan Teki 			RV1126_CLKGATE_CON(0), 11, GFLAGS),
4112408ab5aSJagan Teki 	COMPOSITE_NOMUX(HCLK_PDCORE_NIU, "hclk_pdcore_niu", "gpll", CLK_IGNORE_UNUSED,
4122408ab5aSJagan Teki 			RV1126_CLKSEL_CON(0), 8, 5, DFLAGS,
4132408ab5aSJagan Teki 			RV1126_CLKGATE_CON(0), 8, GFLAGS),
4142408ab5aSJagan Teki 
4152408ab5aSJagan Teki 	/*
4162408ab5aSJagan Teki 	 * Clock-Architecture Diagram 4
4172408ab5aSJagan Teki 	 */
4182408ab5aSJagan Teki 	/* PD_BUS */
4192408ab5aSJagan Teki 	COMPOSITE(0, "aclk_pdbus_pre", mux_gpll_cpll_dpll_p, CLK_IGNORE_UNUSED,
4202408ab5aSJagan Teki 			RV1126_CLKSEL_CON(2), 6, 2, MFLAGS, 0, 5, DFLAGS,
4212408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 0, GFLAGS),
4222408ab5aSJagan Teki 	GATE(ACLK_PDBUS, "aclk_pdbus", "aclk_pdbus_pre", CLK_IGNORE_UNUSED,
4232408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 11, GFLAGS),
4242408ab5aSJagan Teki 	COMPOSITE(0, "hclk_pdbus_pre", mux_hclk_pclk_pdbus_p, CLK_IGNORE_UNUSED,
4252408ab5aSJagan Teki 			RV1126_CLKSEL_CON(2), 15, 1, MFLAGS, 8, 5, DFLAGS,
4262408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 1, GFLAGS),
4272408ab5aSJagan Teki 	GATE(HCLK_PDBUS, "hclk_pdbus", "hclk_pdbus_pre", CLK_IGNORE_UNUSED,
4282408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 12, GFLAGS),
4292408ab5aSJagan Teki 	COMPOSITE(0, "pclk_pdbus_pre", mux_hclk_pclk_pdbus_p, CLK_IGNORE_UNUSED,
4302408ab5aSJagan Teki 			RV1126_CLKSEL_CON(3), 7, 1, MFLAGS, 0, 5, DFLAGS,
4312408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 2, GFLAGS),
4322408ab5aSJagan Teki 	GATE(PCLK_PDBUS, "pclk_pdbus", "pclk_pdbus_pre", CLK_IGNORE_UNUSED,
4332408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 13, GFLAGS),
4342408ab5aSJagan Teki 	/* aclk_dmac is controlled by sgrf_clkgat_con. */
4352408ab5aSJagan Teki 	SGRF_GATE(ACLK_DMAC, "aclk_dmac", "hclk_pdbus"),
4362408ab5aSJagan Teki 	GATE(ACLK_DCF, "aclk_dcf", "hclk_pdbus", CLK_IGNORE_UNUSED,
4372408ab5aSJagan Teki 			RV1126_CLKGATE_CON(3), 6, GFLAGS),
4382408ab5aSJagan Teki 	GATE(PCLK_DCF, "pclk_dcf", "pclk_pdbus", CLK_IGNORE_UNUSED,
4392408ab5aSJagan Teki 			RV1126_CLKGATE_CON(3), 7, GFLAGS),
4402408ab5aSJagan Teki 	GATE(PCLK_WDT, "pclk_wdt", "pclk_pdbus", 0,
4412408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 14, GFLAGS),
4422408ab5aSJagan Teki 	GATE(PCLK_MAILBOX, "pclk_mailbox", "pclk_pdbus", 0,
4432408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 10, GFLAGS),
4442408ab5aSJagan Teki 
4452408ab5aSJagan Teki 	COMPOSITE(CLK_SCR1, "clk_scr1", mux_gpll_cpll_p, 0,
4462408ab5aSJagan Teki 			RV1126_CLKSEL_CON(3), 15, 1, MFLAGS, 8, 5, DFLAGS,
4472408ab5aSJagan Teki 			RV1126_CLKGATE_CON(4), 7, GFLAGS),
4482408ab5aSJagan Teki 	GATE(0, "clk_scr1_niu", "clk_scr1", CLK_IGNORE_UNUSED,
4492408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 14, GFLAGS),
4502408ab5aSJagan Teki 	GATE(CLK_SCR1_CORE, "clk_scr1_core", "clk_scr1", 0,
4512408ab5aSJagan Teki 			RV1126_CLKGATE_CON(4), 8, GFLAGS),
4522408ab5aSJagan Teki 	GATE(CLK_SCR1_RTC, "clk_scr1_rtc", "xin24m", 0,
4532408ab5aSJagan Teki 			RV1126_CLKGATE_CON(4), 9, GFLAGS),
4542408ab5aSJagan Teki 	GATE(CLK_SCR1_JTAG, "clk_scr1_jtag", "clk_scr1_jtag_io", 0,
4552408ab5aSJagan Teki 			RV1126_CLKGATE_CON(4), 10, GFLAGS),
4562408ab5aSJagan Teki 
4572408ab5aSJagan Teki 	GATE(PCLK_UART0, "pclk_uart0", "pclk_pdbus", 0,
4582408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 0, GFLAGS),
4592408ab5aSJagan Teki 	COMPOSITE(SCLK_UART0_DIV, "sclk_uart0_div", mux_gpll_cpll_usb480m_xin24m_p, 0,
4602408ab5aSJagan Teki 			RV1126_CLKSEL_CON(10), 8, 2, MFLAGS, 0, 7, DFLAGS,
4612408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 1, GFLAGS),
4622408ab5aSJagan Teki 	COMPOSITE_FRACMUX(SCLK_UART0_FRAC, "sclk_uart0_frac", "sclk_uart0_div", CLK_SET_RATE_PARENT,
4632408ab5aSJagan Teki 			RV1126_CLKSEL_CON(11), 0,
4642408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 2, GFLAGS,
4652408ab5aSJagan Teki 			&rv1126_uart0_fracmux),
4662408ab5aSJagan Teki 	GATE(SCLK_UART0, "sclk_uart0", "sclk_uart0_mux", 0,
4672408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 3, GFLAGS),
4682408ab5aSJagan Teki 	GATE(PCLK_UART2, "pclk_uart2", "pclk_pdbus", 0,
4692408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 4, GFLAGS),
4702408ab5aSJagan Teki 	COMPOSITE(SCLK_UART2_DIV, "sclk_uart2_div", mux_gpll_cpll_usb480m_xin24m_p, 0,
4712408ab5aSJagan Teki 			RV1126_CLKSEL_CON(12), 8, 2, MFLAGS, 0, 7, DFLAGS,
4722408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 5, GFLAGS),
4732408ab5aSJagan Teki 	COMPOSITE_FRACMUX(SCLK_UART2_FRAC, "sclk_uart2_frac", "sclk_uart2_div", CLK_SET_RATE_PARENT,
4742408ab5aSJagan Teki 			RV1126_CLKSEL_CON(13), 0,
4752408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 6, GFLAGS,
4762408ab5aSJagan Teki 			&rv1126_uart2_fracmux),
4772408ab5aSJagan Teki 	GATE(SCLK_UART2, "sclk_uart2", "sclk_uart2_mux", 0,
4782408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 7, GFLAGS),
4792408ab5aSJagan Teki 	GATE(PCLK_UART3, "pclk_uart3", "pclk_pdbus", 0,
4802408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 8, GFLAGS),
4812408ab5aSJagan Teki 	COMPOSITE(SCLK_UART3_DIV, "sclk_uart3_div", mux_gpll_cpll_usb480m_xin24m_p, 0,
4822408ab5aSJagan Teki 			RV1126_CLKSEL_CON(14), 8, 2, MFLAGS, 0, 7, DFLAGS,
4832408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 9, GFLAGS),
4842408ab5aSJagan Teki 	COMPOSITE_FRACMUX(SCLK_UART3_FRAC, "sclk_uart3_frac", "sclk_uart3_div", CLK_SET_RATE_PARENT,
4852408ab5aSJagan Teki 			RV1126_CLKSEL_CON(15), 0,
4862408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 10, GFLAGS,
4872408ab5aSJagan Teki 			&rv1126_uart3_fracmux),
4882408ab5aSJagan Teki 	GATE(SCLK_UART3, "sclk_uart3", "sclk_uart3_mux", 0,
4892408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 11, GFLAGS),
4902408ab5aSJagan Teki 	GATE(PCLK_UART4, "pclk_uart4", "pclk_pdbus", 0,
4912408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 12, GFLAGS),
4922408ab5aSJagan Teki 	COMPOSITE(SCLK_UART4_DIV, "sclk_uart4_div", mux_gpll_cpll_usb480m_xin24m_p, 0,
4932408ab5aSJagan Teki 			RV1126_CLKSEL_CON(16), 8, 2, MFLAGS, 0, 7,
4942408ab5aSJagan Teki 			DFLAGS, RV1126_CLKGATE_CON(5), 13, GFLAGS),
4952408ab5aSJagan Teki 	COMPOSITE_FRACMUX(SCLK_UART4_FRAC, "sclk_uart4_frac", "sclk_uart4_div", CLK_SET_RATE_PARENT,
4962408ab5aSJagan Teki 			RV1126_CLKSEL_CON(17), 0,
4972408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 14, GFLAGS,
4982408ab5aSJagan Teki 			&rv1126_uart4_fracmux),
4992408ab5aSJagan Teki 	GATE(SCLK_UART4, "sclk_uart4", "sclk_uart4_mux", 0,
5002408ab5aSJagan Teki 			RV1126_CLKGATE_CON(5), 15, GFLAGS),
5012408ab5aSJagan Teki 	GATE(PCLK_UART5, "pclk_uart5", "pclk_pdbus", 0,
5022408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 0, GFLAGS),
5032408ab5aSJagan Teki 	COMPOSITE(SCLK_UART5_DIV, "sclk_uart5_div", mux_gpll_cpll_usb480m_xin24m_p, 0,
5042408ab5aSJagan Teki 			RV1126_CLKSEL_CON(18), 8, 2, MFLAGS, 0, 7,
5052408ab5aSJagan Teki 			DFLAGS, RV1126_CLKGATE_CON(6), 1, GFLAGS),
5062408ab5aSJagan Teki 	COMPOSITE_FRACMUX(SCLK_UART5_FRAC, "sclk_uart5_frac", "sclk_uart5_div", CLK_SET_RATE_PARENT,
5072408ab5aSJagan Teki 			RV1126_CLKSEL_CON(19), 0,
5082408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 2, GFLAGS,
5092408ab5aSJagan Teki 			&rv1126_uart5_fracmux),
5102408ab5aSJagan Teki 	GATE(SCLK_UART5, "sclk_uart5", "sclk_uart5_mux", 0,
5112408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 3, GFLAGS),
5122408ab5aSJagan Teki 
5132408ab5aSJagan Teki 	GATE(PCLK_I2C1, "pclk_i2c1", "pclk_pdbus", 0,
5142408ab5aSJagan Teki 			RV1126_CLKGATE_CON(3), 10, GFLAGS),
5152408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_I2C1, "clk_i2c1", "gpll", 0,
5162408ab5aSJagan Teki 			RV1126_CLKSEL_CON(5), 0, 7, DFLAGS,
5172408ab5aSJagan Teki 			RV1126_CLKGATE_CON(3), 11, GFLAGS),
5182408ab5aSJagan Teki 	GATE(PCLK_I2C3, "pclk_i2c3", "pclk_pdbus", 0,
5192408ab5aSJagan Teki 			RV1126_CLKGATE_CON(3), 12, GFLAGS),
5202408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_I2C3, "clk_i2c3", "gpll", 0,
5212408ab5aSJagan Teki 			RV1126_CLKSEL_CON(5), 8, 7, DFLAGS,
5222408ab5aSJagan Teki 			RV1126_CLKGATE_CON(3), 13, GFLAGS),
5232408ab5aSJagan Teki 	GATE(PCLK_I2C4, "pclk_i2c4", "pclk_pdbus", 0,
5242408ab5aSJagan Teki 			RV1126_CLKGATE_CON(3), 14, GFLAGS),
5252408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_I2C4, "clk_i2c4", "gpll", 0,
5262408ab5aSJagan Teki 			RV1126_CLKSEL_CON(6), 0, 7, DFLAGS,
5272408ab5aSJagan Teki 			RV1126_CLKGATE_CON(3), 15, GFLAGS),
5282408ab5aSJagan Teki 	GATE(PCLK_I2C5, "pclk_i2c5", "pclk_pdbus", 0,
5292408ab5aSJagan Teki 			RV1126_CLKGATE_CON(4), 0, GFLAGS),
5302408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_I2C5, "clk_i2c5", "gpll", 0,
5312408ab5aSJagan Teki 			RV1126_CLKSEL_CON(6), 8, 7, DFLAGS,
5322408ab5aSJagan Teki 			RV1126_CLKGATE_CON(4), 1, GFLAGS),
5332408ab5aSJagan Teki 
5342408ab5aSJagan Teki 	GATE(PCLK_SPI1, "pclk_spi1", "pclk_pdbus", 0,
5352408ab5aSJagan Teki 			RV1126_CLKGATE_CON(4), 2, GFLAGS),
5362408ab5aSJagan Teki 	COMPOSITE(CLK_SPI1, "clk_spi1", mux_gpll_xin24m_p, 0,
5372408ab5aSJagan Teki 			RV1126_CLKSEL_CON(8), 7, 1, MFLAGS, 0, 7, DFLAGS,
5382408ab5aSJagan Teki 			RV1126_CLKGATE_CON(4), 3, GFLAGS),
5392408ab5aSJagan Teki 
5402408ab5aSJagan Teki 	GATE(CLK_CAPTURE_PWM2, "clk_capture_pwm2", "xin24m", 0,
5412408ab5aSJagan Teki 			RV1126_CLKGATE_CON(4), 6, GFLAGS),
5422408ab5aSJagan Teki 	GATE(PCLK_PWM2, "pclk_pwm2", "pclk_pdbus", 0,
5432408ab5aSJagan Teki 			RV1126_CLKGATE_CON(4), 4, GFLAGS),
5442408ab5aSJagan Teki 	COMPOSITE(CLK_PWM2, "clk_pwm2", mux_xin24m_gpll_p, 0,
5452408ab5aSJagan Teki 			RV1126_CLKSEL_CON(9), 15, 1, MFLAGS, 8, 7, DFLAGS,
5462408ab5aSJagan Teki 			RV1126_CLKGATE_CON(4), 5, GFLAGS),
5472408ab5aSJagan Teki 
5482408ab5aSJagan Teki 	GATE(PCLK_GPIO1, "pclk_gpio1", "pclk_pdbus", 0,
5492408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 0, GFLAGS),
5502408ab5aSJagan Teki 	COMPOSITE_NODIV(DBCLK_GPIO1, "dbclk_gpio1", mux_xin24m_32k_p, 0,
5512408ab5aSJagan Teki 			RV1126_CLKSEL_CON(21), 15, 1, MFLAGS,
5522408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 1, GFLAGS),
5532408ab5aSJagan Teki 	GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_pdbus", 0,
5542408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 2, GFLAGS),
5552408ab5aSJagan Teki 	COMPOSITE_NODIV(DBCLK_GPIO2, "dbclk_gpio2", mux_xin24m_32k_p, 0,
5562408ab5aSJagan Teki 			RV1126_CLKSEL_CON(22), 15, 1, MFLAGS,
5572408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 3, GFLAGS),
5582408ab5aSJagan Teki 	GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_pdbus", 0,
5592408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 4, GFLAGS),
5602408ab5aSJagan Teki 	COMPOSITE_NODIV(DBCLK_GPIO3, "dbclk_gpio3", mux_xin24m_32k_p, 0,
5612408ab5aSJagan Teki 			RV1126_CLKSEL_CON(23), 15, 1, MFLAGS,
5622408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 5, GFLAGS),
5632408ab5aSJagan Teki 	GATE(PCLK_GPIO4, "pclk_gpio4", "pclk_pdbus", 0,
5642408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 6, GFLAGS),
5652408ab5aSJagan Teki 	COMPOSITE_NODIV(DBCLK_GPIO4, "dbclk_gpio4", mux_xin24m_32k_p, 0,
5662408ab5aSJagan Teki 			RV1126_CLKSEL_CON(24), 15, 1, MFLAGS,
5672408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 7, GFLAGS),
5682408ab5aSJagan Teki 
5692408ab5aSJagan Teki 	GATE(PCLK_SARADC, "pclk_saradc", "pclk_pdbus", 0,
5702408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 4, GFLAGS),
5712408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_SARADC, "clk_saradc", "xin24m", 0,
5722408ab5aSJagan Teki 			RV1126_CLKSEL_CON(20), 0, 11, DFLAGS,
5732408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 5, GFLAGS),
5742408ab5aSJagan Teki 
5752408ab5aSJagan Teki 	GATE(PCLK_TIMER, "pclk_timer", "pclk_pdbus", 0,
5762408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 7, GFLAGS),
5772408ab5aSJagan Teki 	GATE(CLK_TIMER0, "clk_timer0", "xin24m", 0,
5782408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 8, GFLAGS),
5792408ab5aSJagan Teki 	GATE(CLK_TIMER1, "clk_timer1", "xin24m", 0,
5802408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 9, GFLAGS),
5812408ab5aSJagan Teki 	GATE(CLK_TIMER2, "clk_timer2", "xin24m", 0,
5822408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 10, GFLAGS),
5832408ab5aSJagan Teki 	GATE(CLK_TIMER3, "clk_timer3", "xin24m", 0,
5842408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 11, GFLAGS),
5852408ab5aSJagan Teki 	GATE(CLK_TIMER4, "clk_timer4", "xin24m", 0,
5862408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 12, GFLAGS),
5872408ab5aSJagan Teki 	GATE(CLK_TIMER5, "clk_timer5", "xin24m", 0,
5882408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 13, GFLAGS),
5892408ab5aSJagan Teki 
5902408ab5aSJagan Teki 	GATE(ACLK_SPINLOCK, "aclk_spinlock", "hclk_pdbus", 0,
5912408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 6, GFLAGS),
5922408ab5aSJagan Teki 
5932408ab5aSJagan Teki 	GATE(ACLK_DECOM, "aclk_decom", "aclk_pdbus", 0,
5942408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 11, GFLAGS),
5952408ab5aSJagan Teki 	GATE(PCLK_DECOM, "pclk_decom", "pclk_pdbus", 0,
5962408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 12, GFLAGS),
5972408ab5aSJagan Teki 	COMPOSITE(DCLK_DECOM, "dclk_decom", mux_gpll_cpll_p, 0,
5982408ab5aSJagan Teki 			RV1126_CLKSEL_CON(25), 15, 1, MFLAGS, 8, 7, DFLAGS,
5992408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 13, GFLAGS),
6002408ab5aSJagan Teki 
6012408ab5aSJagan Teki 	GATE(PCLK_CAN, "pclk_can", "pclk_pdbus", 0,
6022408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 8, GFLAGS),
6032408ab5aSJagan Teki 	COMPOSITE(CLK_CAN, "clk_can", mux_gpll_xin24m_p, 0,
6042408ab5aSJagan Teki 			RV1126_CLKSEL_CON(25), 7, 1, MFLAGS, 0, 7, DFLAGS,
6052408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 9, GFLAGS),
6062408ab5aSJagan Teki 	/* pclk_otp and clk_otp are controlled by sgrf_clkgat_con. */
6072408ab5aSJagan Teki 	SGRF_GATE(CLK_OTP, "clk_otp", "xin24m"),
6082408ab5aSJagan Teki 	SGRF_GATE(PCLK_OTP, "pclk_otp", "pclk_pdbus"),
6092408ab5aSJagan Teki 
6102408ab5aSJagan Teki 	GATE(PCLK_NPU_TSADC, "pclk_npu_tsadc", "pclk_pdbus", 0,
6112408ab5aSJagan Teki 			RV1126_CLKGATE_CON(24), 3, GFLAGS),
6122408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_NPU_TSADC, "clk_npu_tsadc", "xin24m", 0,
6132408ab5aSJagan Teki 			RV1126_CLKSEL_CON(71), 0, 11, DFLAGS,
6142408ab5aSJagan Teki 			RV1126_CLKGATE_CON(24), 4, GFLAGS),
6152408ab5aSJagan Teki 	GATE(CLK_NPU_TSADCPHY, "clk_npu_tsadcphy", "clk_npu_tsadc", 0,
6162408ab5aSJagan Teki 			RV1126_CLKGATE_CON(24), 5, GFLAGS),
6172408ab5aSJagan Teki 	GATE(PCLK_CPU_TSADC, "pclk_cpu_tsadc", "pclk_pdbus", 0,
6182408ab5aSJagan Teki 			RV1126_CLKGATE_CON(24), 0, GFLAGS),
6192408ab5aSJagan Teki 	COMPOSITE_NOMUX(CLK_CPU_TSADC, "clk_cpu_tsadc", "xin24m", 0,
6202408ab5aSJagan Teki 			RV1126_CLKSEL_CON(70), 0, 11, DFLAGS,
6212408ab5aSJagan Teki 			RV1126_CLKGATE_CON(24), 1, GFLAGS),
6222408ab5aSJagan Teki 	GATE(CLK_CPU_TSADCPHY, "clk_cpu_tsadcphy", "clk_cpu_tsadc", 0,
6232408ab5aSJagan Teki 			RV1126_CLKGATE_CON(24), 2, GFLAGS),
6242408ab5aSJagan Teki 
6252408ab5aSJagan Teki 	/*
6262408ab5aSJagan Teki 	 * Clock-Architecture Diagram 6
6272408ab5aSJagan Teki 	 */
6282408ab5aSJagan Teki 	/* PD_AUDIO */
6292408ab5aSJagan Teki 	COMPOSITE_NOMUX(HCLK_PDAUDIO, "hclk_pdaudio", "gpll", 0,
6302408ab5aSJagan Teki 			RV1126_CLKSEL_CON(26), 0, 5, DFLAGS,
6312408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 0, GFLAGS),
6322408ab5aSJagan Teki 
6332408ab5aSJagan Teki 	GATE(HCLK_I2S0, "hclk_i2s0", "hclk_pdaudio", 0,
6342408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 4, GFLAGS),
6352408ab5aSJagan Teki 	COMPOSITE(MCLK_I2S0_TX_DIV, "mclk_i2s0_tx_div", mux_cpll_gpll_p, 0,
6362408ab5aSJagan Teki 			RV1126_CLKSEL_CON(27), 7, 1, MFLAGS, 0, 7, DFLAGS,
6372408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 5, GFLAGS),
6382408ab5aSJagan Teki 	COMPOSITE_FRACMUX(MCLK_I2S0_TX_FRACDIV, "mclk_i2s0_tx_fracdiv", "mclk_i2s0_tx_div",
6392408ab5aSJagan Teki 			CLK_SET_RATE_PARENT,
6402408ab5aSJagan Teki 			RV1126_CLKSEL_CON(28), 0,
6412408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 6, GFLAGS,
6422408ab5aSJagan Teki 			&rv1126_i2s0_tx_fracmux),
6432408ab5aSJagan Teki 	GATE(MCLK_I2S0_TX, "mclk_i2s0_tx", "mclk_i2s0_tx_mux", 0,
6442408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 9, GFLAGS),
6452408ab5aSJagan Teki 	COMPOSITE(MCLK_I2S0_RX_DIV, "mclk_i2s0_rx_div", mux_cpll_gpll_p, 0,
6462408ab5aSJagan Teki 			RV1126_CLKSEL_CON(27), 15, 1, MFLAGS, 8, 7, DFLAGS,
6472408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 7, GFLAGS),
6482408ab5aSJagan Teki 	COMPOSITE_FRACMUX(MCLK_I2S0_RX_FRACDIV, "mclk_i2s0_rx_fracdiv", "mclk_i2s0_rx_div",
6492408ab5aSJagan Teki 			CLK_SET_RATE_PARENT,
6502408ab5aSJagan Teki 			RV1126_CLKSEL_CON(29), 0,
6512408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 8, GFLAGS,
6522408ab5aSJagan Teki 			&rv1126_i2s0_rx_fracmux),
6532408ab5aSJagan Teki 	GATE(MCLK_I2S0_RX, "mclk_i2s0_rx", "mclk_i2s0_rx_mux", 0,
6542408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 10, GFLAGS),
6552408ab5aSJagan Teki 	COMPOSITE_NODIV(MCLK_I2S0_TX_OUT2IO, "mclk_i2s0_tx_out2io", mux_i2s0_tx_out2io_p, 0,
6562408ab5aSJagan Teki 			RV1126_CLKSEL_CON(30), 6, 1, MFLAGS,
6572408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 13, GFLAGS),
6582408ab5aSJagan Teki 	COMPOSITE_NODIV(MCLK_I2S0_RX_OUT2IO, "mclk_i2s0_rx_out2io", mux_i2s0_rx_out2io_p, 0,
6592408ab5aSJagan Teki 			RV1126_CLKSEL_CON(30), 8, 1, MFLAGS,
6602408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 14, GFLAGS),
6612408ab5aSJagan Teki 
6622408ab5aSJagan Teki 	GATE(HCLK_I2S1, "hclk_i2s1", "hclk_pdaudio", 0,
6632408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 0, GFLAGS),
6642408ab5aSJagan Teki 	COMPOSITE(MCLK_I2S1_DIV, "mclk_i2s1_div", mux_cpll_gpll_p, 0,
6652408ab5aSJagan Teki 			RV1126_CLKSEL_CON(31), 7, 1, MFLAGS, 0, 7, DFLAGS,
6662408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 1, GFLAGS),
6672408ab5aSJagan Teki 	COMPOSITE_FRACMUX(MCLK_I2S1_FRACDIV, "mclk_i2s1_fracdiv", "mclk_i2s1_div",
6682408ab5aSJagan Teki 			CLK_SET_RATE_PARENT,
6692408ab5aSJagan Teki 			RV1126_CLKSEL_CON(32), 0,
6702408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 2, GFLAGS,
6712408ab5aSJagan Teki 			&rv1126_i2s1_fracmux),
6722408ab5aSJagan Teki 	GATE(MCLK_I2S1, "mclk_i2s1", "mclk_i2s1_mux", 0,
6732408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 3, GFLAGS),
6742408ab5aSJagan Teki 	COMPOSITE_NODIV(MCLK_I2S1_OUT2IO, "mclk_i2s1_out2io", mux_i2s1_out2io_p, 0,
6752408ab5aSJagan Teki 			RV1126_CLKSEL_CON(31), 12, 1, MFLAGS,
6762408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 4, GFLAGS),
6772408ab5aSJagan Teki 	GATE(HCLK_I2S2, "hclk_i2s2", "hclk_pdaudio", 0,
6782408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 5, GFLAGS),
6792408ab5aSJagan Teki 	COMPOSITE(MCLK_I2S2_DIV, "mclk_i2s2_div", mux_cpll_gpll_p, 0,
6802408ab5aSJagan Teki 			RV1126_CLKSEL_CON(33), 7, 1, MFLAGS, 0, 7, DFLAGS,
6812408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 6, GFLAGS),
6822408ab5aSJagan Teki 	COMPOSITE_FRACMUX(MCLK_I2S2_FRACDIV, "mclk_i2s2_fracdiv", "mclk_i2s2_div",
6832408ab5aSJagan Teki 			CLK_SET_RATE_PARENT,
6842408ab5aSJagan Teki 			RV1126_CLKSEL_CON(34), 0,
6852408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 7, GFLAGS,
6862408ab5aSJagan Teki 			&rv1126_i2s2_fracmux),
6872408ab5aSJagan Teki 	GATE(MCLK_I2S2, "mclk_i2s2", "mclk_i2s2_mux", 0,
6882408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 8, GFLAGS),
6892408ab5aSJagan Teki 	COMPOSITE_NODIV(MCLK_I2S2_OUT2IO, "mclk_i2s2_out2io", mux_i2s2_out2io_p, 0,
6902408ab5aSJagan Teki 			RV1126_CLKSEL_CON(33), 10, 1, MFLAGS,
6912408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 9, GFLAGS),
6922408ab5aSJagan Teki 
6932408ab5aSJagan Teki 	GATE(HCLK_PDM, "hclk_pdm", "hclk_pdaudio", 0,
6942408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 10, GFLAGS),
6952408ab5aSJagan Teki 	COMPOSITE(MCLK_PDM, "mclk_pdm", mux_gpll_cpll_xin24m_p, 0,
6962408ab5aSJagan Teki 			RV1126_CLKSEL_CON(35), 8, 2, MFLAGS, 0, 7, DFLAGS,
6972408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 11, GFLAGS),
6982408ab5aSJagan Teki 
6992408ab5aSJagan Teki 	GATE(HCLK_AUDPWM, "hclk_audpwm", "hclk_pdaudio", 0,
7002408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 12, GFLAGS),
7012408ab5aSJagan Teki 	COMPOSITE(SCLK_ADUPWM_DIV, "sclk_audpwm_div", mux_gpll_cpll_p, 0,
7022408ab5aSJagan Teki 			RV1126_CLKSEL_CON(36), 7, 1, MFLAGS, 0, 7, DFLAGS,
7032408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 13, GFLAGS),
7042408ab5aSJagan Teki 	COMPOSITE_FRACMUX(SCLK_AUDPWM_FRACDIV, "sclk_audpwm_fracdiv", "sclk_audpwm_div",
7052408ab5aSJagan Teki 			CLK_SET_RATE_PARENT,
7062408ab5aSJagan Teki 			RV1126_CLKSEL_CON(37), 0,
7072408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 14, GFLAGS,
7082408ab5aSJagan Teki 			&rv1126_audpwm_fracmux),
7092408ab5aSJagan Teki 	GATE(SCLK_AUDPWM, "sclk_audpwm", "mclk_audpwm_mux", 0,
7102408ab5aSJagan Teki 			RV1126_CLKGATE_CON(10), 15, GFLAGS),
7112408ab5aSJagan Teki 
7122408ab5aSJagan Teki 	GATE(PCLK_ACDCDIG, "pclk_acdcdig", "hclk_pdaudio", 0,
7132408ab5aSJagan Teki 			RV1126_CLKGATE_CON(11), 0, GFLAGS),
7142408ab5aSJagan Teki 	GATE(CLK_ACDCDIG_ADC, "clk_acdcdig_adc", "mclk_i2s0_rx", 0,
7152408ab5aSJagan Teki 			RV1126_CLKGATE_CON(11), 2, GFLAGS),
7162408ab5aSJagan Teki 	GATE(CLK_ACDCDIG_DAC, "clk_acdcdig_dac", "mclk_i2s0_tx", 0,
7172408ab5aSJagan Teki 			RV1126_CLKGATE_CON(11), 3, GFLAGS),
7182408ab5aSJagan Teki 	COMPOSITE(CLK_ACDCDIG_I2C, "clk_acdcdig_i2c", mux_gpll_xin24m_p, 0,
7192408ab5aSJagan Teki 			RV1126_CLKSEL_CON(72), 8, 1, MFLAGS, 0, 7, DFLAGS,
7202408ab5aSJagan Teki 			RV1126_CLKGATE_CON(11), 1, GFLAGS),
7212408ab5aSJagan Teki 
7222408ab5aSJagan Teki 	/*
723*5c7a71fdSJagan Teki 	 * Clock-Architecture Diagram 9
724*5c7a71fdSJagan Teki 	 */
725*5c7a71fdSJagan Teki 	/* PD_VO */
726*5c7a71fdSJagan Teki 	COMPOSITE(ACLK_PDVO, "aclk_pdvo", mux_gpll_cpll_p, 0,
727*5c7a71fdSJagan Teki 		  RV1126_CLKSEL_CON(45), 7, 1, MFLAGS, 0, 5, DFLAGS,
728*5c7a71fdSJagan Teki 		  RV1126_CLKGATE_CON(14), 0, GFLAGS),
729*5c7a71fdSJagan Teki 	COMPOSITE_NOMUX(HCLK_PDVO, "hclk_pdvo", "aclk_pdvo", 0,
730*5c7a71fdSJagan Teki 			RV1126_CLKSEL_CON(45), 8, 5, DFLAGS,
731*5c7a71fdSJagan Teki 			RV1126_CLKGATE_CON(14), 1, GFLAGS),
732*5c7a71fdSJagan Teki 	COMPOSITE_NOMUX(PCLK_PDVO, "pclk_pdvo", "aclk_pdvo", 0,
733*5c7a71fdSJagan Teki 			RV1126_CLKSEL_CON(46), 8, 5, DFLAGS,
734*5c7a71fdSJagan Teki 			RV1126_CLKGATE_CON(14), 2, GFLAGS),
735*5c7a71fdSJagan Teki 	GATE(ACLK_RGA, "aclk_rga", "aclk_pdvo", 0,
736*5c7a71fdSJagan Teki 	     RV1126_CLKGATE_CON(14), 6, GFLAGS),
737*5c7a71fdSJagan Teki 	GATE(HCLK_RGA, "hclk_rga", "hclk_pdvo", 0,
738*5c7a71fdSJagan Teki 	     RV1126_CLKGATE_CON(14), 7, GFLAGS),
739*5c7a71fdSJagan Teki 	COMPOSITE(CLK_RGA_CORE, "clk_rga_core", mux_gpll_cpll_p, 0,
740*5c7a71fdSJagan Teki 		  RV1126_CLKSEL_CON(46), 7, 1, MFLAGS, 0, 5, DFLAGS,
741*5c7a71fdSJagan Teki 		  RV1126_CLKGATE_CON(14), 8, GFLAGS),
742*5c7a71fdSJagan Teki 	GATE(ACLK_VOP, "aclk_vop", "aclk_pdvo", 0,
743*5c7a71fdSJagan Teki 	     RV1126_CLKGATE_CON(14), 9, GFLAGS),
744*5c7a71fdSJagan Teki 	GATE(HCLK_VOP, "hclk_vop", "hclk_pdvo", 0,
745*5c7a71fdSJagan Teki 	     RV1126_CLKGATE_CON(14), 10, GFLAGS),
746*5c7a71fdSJagan Teki 	COMPOSITE(DCLK_VOP_DIV, "dclk_vop_div", mux_gpll_cpll_p, 0,
747*5c7a71fdSJagan Teki 		  RV1126_CLKSEL_CON(47), 8, 1, MFLAGS, 0, 8, DFLAGS,
748*5c7a71fdSJagan Teki 		  RV1126_CLKGATE_CON(14), 11, GFLAGS),
749*5c7a71fdSJagan Teki 	COMPOSITE_FRACMUX(DCLK_VOP_FRACDIV, "dclk_vop_fracdiv", "dclk_vop_div",
750*5c7a71fdSJagan Teki 			  CLK_SET_RATE_PARENT, RV1126_CLKSEL_CON(48), 0,
751*5c7a71fdSJagan Teki 			  RV1126_CLKGATE_CON(14), 12, GFLAGS,
752*5c7a71fdSJagan Teki 			  &rv1126_dclk_vop_fracmux),
753*5c7a71fdSJagan Teki 	GATE(DCLK_VOP, "dclk_vop", "dclk_vop_mux", 0,
754*5c7a71fdSJagan Teki 	     RV1126_CLKGATE_CON(14), 13, GFLAGS),
755*5c7a71fdSJagan Teki 	GATE(PCLK_DSIHOST, "pclk_dsihost", "pclk_pdvo", 0,
756*5c7a71fdSJagan Teki 	     RV1126_CLKGATE_CON(14), 14, GFLAGS),
757*5c7a71fdSJagan Teki 	GATE(ACLK_IEP, "aclk_iep", "aclk_pdvo", 0,
758*5c7a71fdSJagan Teki 	     RV1126_CLKGATE_CON(12), 7, GFLAGS),
759*5c7a71fdSJagan Teki 	GATE(HCLK_IEP, "hclk_iep", "hclk_pdvo", 0,
760*5c7a71fdSJagan Teki 	     RV1126_CLKGATE_CON(12), 8, GFLAGS),
761*5c7a71fdSJagan Teki 	COMPOSITE(CLK_IEP_CORE, "clk_iep_core", mux_gpll_cpll_p, 0,
762*5c7a71fdSJagan Teki 		  RV1126_CLKSEL_CON(54), 7, 1, MFLAGS, 0, 5, DFLAGS,
763*5c7a71fdSJagan Teki 		  RV1126_CLKGATE_CON(12), 9, GFLAGS),
764*5c7a71fdSJagan Teki 
765*5c7a71fdSJagan Teki 	/*
7662408ab5aSJagan Teki 	 * Clock-Architecture Diagram 12
7672408ab5aSJagan Teki 	 */
7682408ab5aSJagan Teki 	/* PD_PHP */
7692408ab5aSJagan Teki 	COMPOSITE(ACLK_PDPHP, "aclk_pdphp", mux_gpll_cpll_p, CLK_IGNORE_UNUSED,
7702408ab5aSJagan Teki 			RV1126_CLKSEL_CON(53), 7, 1, MFLAGS, 0, 5, DFLAGS,
7712408ab5aSJagan Teki 			RV1126_CLKGATE_CON(17), 0, GFLAGS),
7722408ab5aSJagan Teki 	COMPOSITE_NOMUX(HCLK_PDPHP, "hclk_pdphp", "gpll", CLK_IGNORE_UNUSED,
7732408ab5aSJagan Teki 			RV1126_CLKSEL_CON(53), 8, 5, DFLAGS,
7742408ab5aSJagan Teki 			RV1126_CLKGATE_CON(17), 1, GFLAGS),
7752408ab5aSJagan Teki 	/* PD_SDCARD */
7762408ab5aSJagan Teki 	GATE(HCLK_PDSDMMC, "hclk_pdsdmmc", "hclk_pdphp", 0,
7772408ab5aSJagan Teki 			RV1126_CLKGATE_CON(17), 6, GFLAGS),
7782408ab5aSJagan Teki 	GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_pdsdmmc", 0,
7792408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 4, GFLAGS),
7802408ab5aSJagan Teki 	COMPOSITE(CLK_SDMMC, "clk_sdmmc", mux_gpll_cpll_xin24m_p, 0,
7812408ab5aSJagan Teki 			RV1126_CLKSEL_CON(55), 14, 2, MFLAGS, 0, 8,
7822408ab5aSJagan Teki 			DFLAGS, RV1126_CLKGATE_CON(18), 5, GFLAGS),
7832408ab5aSJagan Teki 	MMC(SCLK_SDMMC_DRV,     "sdmmc_drv",    "clk_sdmmc", RV1126_SDMMC_CON0, 1),
7842408ab5aSJagan Teki 	MMC(SCLK_SDMMC_SAMPLE,  "sdmmc_sample", "clk_sdmmc", RV1126_SDMMC_CON1, 1),
7852408ab5aSJagan Teki 
7862408ab5aSJagan Teki 	/* PD_SDIO */
7872408ab5aSJagan Teki 	GATE(HCLK_PDSDIO, "hclk_pdsdio", "hclk_pdphp", 0,
7882408ab5aSJagan Teki 			RV1126_CLKGATE_CON(17), 8, GFLAGS),
7892408ab5aSJagan Teki 	GATE(HCLK_SDIO, "hclk_sdio", "hclk_pdsdio", 0,
7902408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 6, GFLAGS),
7912408ab5aSJagan Teki 	COMPOSITE(CLK_SDIO, "clk_sdio", mux_gpll_cpll_xin24m_p, 0,
7922408ab5aSJagan Teki 			RV1126_CLKSEL_CON(56), 14, 2, MFLAGS, 0, 8, DFLAGS,
7932408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 7, GFLAGS),
7942408ab5aSJagan Teki 	MMC(SCLK_SDIO_DRV, "sdio_drv", "clk_sdio", RV1126_SDIO_CON0, 1),
7952408ab5aSJagan Teki 	MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "clk_sdio", RV1126_SDIO_CON1, 1),
7962408ab5aSJagan Teki 
7972408ab5aSJagan Teki 	/* PD_NVM */
7982408ab5aSJagan Teki 	GATE(HCLK_PDNVM, "hclk_pdnvm", "hclk_pdphp", 0,
7992408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 1, GFLAGS),
8002408ab5aSJagan Teki 	GATE(HCLK_EMMC, "hclk_emmc", "hclk_pdnvm", 0,
8012408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 8, GFLAGS),
8022408ab5aSJagan Teki 	COMPOSITE(CLK_EMMC, "clk_emmc", mux_gpll_cpll_xin24m_p, 0,
8032408ab5aSJagan Teki 			RV1126_CLKSEL_CON(57), 14, 2, MFLAGS, 0, 8, DFLAGS,
8042408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 9, GFLAGS),
8052408ab5aSJagan Teki 	GATE(HCLK_NANDC, "hclk_nandc", "hclk_pdnvm", 0,
8062408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 13, GFLAGS),
8072408ab5aSJagan Teki 	COMPOSITE(CLK_NANDC, "clk_nandc", mux_gpll_cpll_p, 0,
8082408ab5aSJagan Teki 			RV1126_CLKSEL_CON(59), 15, 1, MFLAGS, 0, 8, DFLAGS,
8092408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 14, GFLAGS),
8102408ab5aSJagan Teki 	GATE(HCLK_SFC, "hclk_sfc", "hclk_pdnvm", 0,
8112408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 10, GFLAGS),
8122408ab5aSJagan Teki 	GATE(HCLK_SFCXIP, "hclk_sfcxip", "hclk_pdnvm", 0,
8132408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 11, GFLAGS),
8142408ab5aSJagan Teki 	COMPOSITE(SCLK_SFC, "sclk_sfc", mux_cpll_gpll_p, 0,
8152408ab5aSJagan Teki 			RV1126_CLKSEL_CON(58), 15, 1, MFLAGS, 0, 8, DFLAGS,
8162408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 12, GFLAGS),
8172408ab5aSJagan Teki 	MMC(SCLK_EMMC_DRV, "emmc_drv", "clk_emmc", RV1126_EMMC_CON0, 1),
8182408ab5aSJagan Teki 	MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "clk_emmc", RV1126_EMMC_CON1, 1),
8192408ab5aSJagan Teki 
8202408ab5aSJagan Teki 	/* PD_USB */
8212408ab5aSJagan Teki 	GATE(ACLK_PDUSB, "aclk_pdusb", "aclk_pdphp", 0,
8222408ab5aSJagan Teki 			RV1126_CLKGATE_CON(19), 0, GFLAGS),
8232408ab5aSJagan Teki 	GATE(HCLK_PDUSB, "hclk_pdusb", "hclk_pdphp", 0,
8242408ab5aSJagan Teki 			RV1126_CLKGATE_CON(19), 1, GFLAGS),
8252408ab5aSJagan Teki 	GATE(HCLK_USBHOST, "hclk_usbhost", "hclk_pdusb", 0,
8262408ab5aSJagan Teki 			RV1126_CLKGATE_CON(19), 4, GFLAGS),
8272408ab5aSJagan Teki 	GATE(HCLK_USBHOST_ARB, "hclk_usbhost_arb", "hclk_pdusb", 0,
8282408ab5aSJagan Teki 			RV1126_CLKGATE_CON(19), 5, GFLAGS),
8292408ab5aSJagan Teki 	COMPOSITE(CLK_USBHOST_UTMI_OHCI, "clk_usbhost_utmi_ohci", mux_usb480m_gpll_p, 0,
8302408ab5aSJagan Teki 			RV1126_CLKSEL_CON(61), 7, 1, MFLAGS, 0, 5, DFLAGS,
8312408ab5aSJagan Teki 			RV1126_CLKGATE_CON(19), 6, GFLAGS),
8322408ab5aSJagan Teki 	GATE(ACLK_USBOTG, "aclk_usbotg", "aclk_pdusb", 0,
8332408ab5aSJagan Teki 			RV1126_CLKGATE_CON(19), 7, GFLAGS),
8342408ab5aSJagan Teki 	GATE(CLK_USBOTG_REF, "clk_usbotg_ref", "xin24m", 0,
8352408ab5aSJagan Teki 			RV1126_CLKGATE_CON(19), 8, GFLAGS),
8362408ab5aSJagan Teki 	/* PD_GMAC */
8372408ab5aSJagan Teki 	GATE(ACLK_PDGMAC, "aclk_pdgmac", "aclk_pdphp", 0,
8382408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 0, GFLAGS),
8392408ab5aSJagan Teki 	COMPOSITE_NOMUX(PCLK_PDGMAC, "pclk_pdgmac", "aclk_pdgmac", 0,
8402408ab5aSJagan Teki 			RV1126_CLKSEL_CON(63), 8, 5, DFLAGS,
8412408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 1, GFLAGS),
8422408ab5aSJagan Teki 	GATE(ACLK_GMAC, "aclk_gmac", "aclk_pdgmac", 0,
8432408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 4, GFLAGS),
8442408ab5aSJagan Teki 	GATE(PCLK_GMAC, "pclk_gmac", "pclk_pdgmac", 0,
8452408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 5, GFLAGS),
8462408ab5aSJagan Teki 
8472408ab5aSJagan Teki 	COMPOSITE(CLK_GMAC_DIV, "clk_gmac_div", mux_cpll_gpll_p, 0,
8482408ab5aSJagan Teki 			RV1126_CLKSEL_CON(63), 7, 1, MFLAGS, 0, 5, DFLAGS,
8492408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 6, GFLAGS),
8502408ab5aSJagan Teki 	GATE(CLK_GMAC_RGMII_M0, "clk_gmac_rgmii_m0", "clk_gmac_rgmii_clkin_m0", 0,
8512408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 12, GFLAGS),
8522408ab5aSJagan Teki 	MUX(CLK_GMAC_SRC_M0, "clk_gmac_src_m0", clk_gmac_src_m0_p, CLK_SET_RATE_PARENT,
8532408ab5aSJagan Teki 			RV1126_GMAC_CON, 0, 1, MFLAGS),
8542408ab5aSJagan Teki 	GATE(CLK_GMAC_RGMII_M1, "clk_gmac_rgmii_m1", "clk_gmac_rgmii_clkin_m1", 0,
8552408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 13, GFLAGS),
8562408ab5aSJagan Teki 	MUX(CLK_GMAC_SRC_M1, "clk_gmac_src_m1", clk_gmac_src_m1_p, CLK_SET_RATE_PARENT,
8572408ab5aSJagan Teki 			RV1126_GMAC_CON, 5, 1, MFLAGS),
8582408ab5aSJagan Teki 	MUXGRF(CLK_GMAC_SRC, "clk_gmac_src", mux_clk_gmac_src_p, CLK_SET_RATE_PARENT |
8592408ab5aSJagan Teki 			CLK_SET_RATE_NO_REPARENT,
8602408ab5aSJagan Teki 			RV1126_GRF_IOFUNC_CON1, 12, 1, MFLAGS),
8612408ab5aSJagan Teki 
8622408ab5aSJagan Teki 	GATE(CLK_GMAC_REF, "clk_gmac_ref", "clk_gmac_src", 0,
8632408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 7, GFLAGS),
8642408ab5aSJagan Teki 
8652408ab5aSJagan Teki 	GATE(CLK_GMAC_TX_SRC, "clk_gmac_tx_src", "clk_gmac_src", 0,
8662408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 9, GFLAGS),
8672408ab5aSJagan Teki 	FACTOR(CLK_GMAC_TX_DIV5, "clk_gmac_tx_div5", "clk_gmac_tx_src", 0, 1, 5),
8682408ab5aSJagan Teki 	FACTOR(CLK_GMAC_TX_DIV50, "clk_gmac_tx_div50", "clk_gmac_tx_src", 0, 1, 50),
8692408ab5aSJagan Teki 	MUXTBL(RGMII_MODE_CLK, "rgmii_mode_clk", mux_rgmii_clk_p, CLK_SET_RATE_PARENT,
8702408ab5aSJagan Teki 			RV1126_GMAC_CON, 2, 2, MFLAGS, rgmii_mux_idx),
8712408ab5aSJagan Teki 	GATE(CLK_GMAC_RX_SRC, "clk_gmac_rx_src", "clk_gmac_src", 0,
8722408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 8, GFLAGS),
8732408ab5aSJagan Teki 	FACTOR(CLK_GMAC_RX_DIV2, "clk_gmac_rx_div2", "clk_gmac_rx_src", 0, 1, 2),
8742408ab5aSJagan Teki 	FACTOR(CLK_GMAC_RX_DIV20, "clk_gmac_rx_div20", "clk_gmac_rx_src", 0, 1, 20),
8752408ab5aSJagan Teki 	MUX(RMII_MODE_CLK, "rmii_mode_clk", mux_rmii_clk_p, CLK_SET_RATE_PARENT,
8762408ab5aSJagan Teki 			RV1126_GMAC_CON, 1, 1, MFLAGS),
8772408ab5aSJagan Teki 	MUX(CLK_GMAC_TX_RX, "clk_gmac_tx_rx", mux_gmac_tx_rx_p, CLK_SET_RATE_PARENT |
8782408ab5aSJagan Teki 			CLK_SET_RATE_NO_REPARENT,
8792408ab5aSJagan Teki 			RV1126_GMAC_CON, 4, 1, MFLAGS),
8802408ab5aSJagan Teki 
8812408ab5aSJagan Teki 	GATE(CLK_GMAC_PTPREF, "clk_gmac_ptpref", "xin24m", 0,
8822408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 10, GFLAGS),
8832408ab5aSJagan Teki 	COMPOSITE(CLK_GMAC_ETHERNET_OUT, "clk_gmac_ethernet_out2io", mux_cpll_gpll_p, 0,
8842408ab5aSJagan Teki 			RV1126_CLKSEL_CON(61), 15, 1, MFLAGS, 8, 5, DFLAGS,
8852408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 11, GFLAGS),
8862408ab5aSJagan Teki 
8872408ab5aSJagan Teki 	/*
8882408ab5aSJagan Teki 	 * Clock-Architecture Diagram 15
8892408ab5aSJagan Teki 	 */
8902408ab5aSJagan Teki 	GATE(PCLK_PDTOP, "pclk_pdtop", "pclk_pdbus", CLK_IGNORE_UNUSED,
8912408ab5aSJagan Teki 			RV1126_CLKGATE_CON(23), 8, GFLAGS),
8922408ab5aSJagan Teki 	GATE(PCLK_DSIPHY, "pclk_dsiphy", "pclk_pdtop", 0,
8932408ab5aSJagan Teki 			RV1126_CLKGATE_CON(23), 4, GFLAGS),
8942408ab5aSJagan Teki 	GATE(PCLK_CSIPHY0, "pclk_csiphy0", "pclk_pdtop", 0,
8952408ab5aSJagan Teki 			RV1126_CLKGATE_CON(23), 2, GFLAGS),
8962408ab5aSJagan Teki 	GATE(PCLK_CSIPHY1, "pclk_csiphy1", "pclk_pdtop", 0,
8972408ab5aSJagan Teki 			RV1126_CLKGATE_CON(23), 3, GFLAGS),
8982408ab5aSJagan Teki 	GATE(PCLK_USBPHY_HOST, "pclk_usbphy_host", "pclk_pdtop", 0,
8992408ab5aSJagan Teki 			RV1126_CLKGATE_CON(19), 13, GFLAGS),
9002408ab5aSJagan Teki 	GATE(PCLK_USBPHY_OTG, "pclk_usbphy_otg", "pclk_pdtop", 0,
9012408ab5aSJagan Teki 			RV1126_CLKGATE_CON(19), 12, GFLAGS),
9022408ab5aSJagan Teki 
9032408ab5aSJagan Teki 	/*
9042408ab5aSJagan Teki 	 * Clock-Architecture Diagram 3
9052408ab5aSJagan Teki 	 */
9062408ab5aSJagan Teki 	/* PD_CORE */
9072408ab5aSJagan Teki 	COMPOSITE_NOMUX(0, "aclk_core", "armclk", CLK_IGNORE_UNUSED,
9082408ab5aSJagan Teki 			RV1126_CLKSEL_CON(1), 4, 4, DFLAGS | CLK_DIVIDER_READ_ONLY,
9092408ab5aSJagan Teki 			RV1126_CLKGATE_CON(0), 2, GFLAGS),
9102408ab5aSJagan Teki 	GATE(0, "pclk_dbg_daplite", "pclk_dbg", CLK_IGNORE_UNUSED,
9112408ab5aSJagan Teki 			RV1126_CLKGATE_CON(0), 5, GFLAGS),
9122408ab5aSJagan Teki 	GATE(0, "clk_a7_jtag", "clk_jtag_ori", CLK_IGNORE_UNUSED,
9132408ab5aSJagan Teki 			RV1126_CLKGATE_CON(0), 9, GFLAGS),
9142408ab5aSJagan Teki 	GATE(0, "aclk_core_niu", "aclk_core", CLK_IGNORE_UNUSED,
9152408ab5aSJagan Teki 			RV1126_CLKGATE_CON(0), 3, GFLAGS),
9162408ab5aSJagan Teki 	GATE(0, "pclk_dbg_niu", "pclk_dbg", CLK_IGNORE_UNUSED,
9172408ab5aSJagan Teki 			RV1126_CLKGATE_CON(0), 4, GFLAGS),
9182408ab5aSJagan Teki 	/*
9192408ab5aSJagan Teki 	 * Clock-Architecture Diagram 4
9202408ab5aSJagan Teki 	 */
9212408ab5aSJagan Teki 	/* PD_BUS */
9222408ab5aSJagan Teki 	GATE(0, "aclk_pdbus_hold_niu1", "aclk_pdbus", CLK_IGNORE_UNUSED,
9232408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 10, GFLAGS),
9242408ab5aSJagan Teki 	GATE(0, "aclk_pdbus_niu1", "aclk_pdbus", CLK_IGNORE_UNUSED,
9252408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 3, GFLAGS),
9262408ab5aSJagan Teki 	GATE(0, "hclk_pdbus_niu1", "hclk_pdbus", CLK_IGNORE_UNUSED,
9272408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 4, GFLAGS),
9282408ab5aSJagan Teki 	GATE(0, "pclk_pdbus_niu1", "pclk_pdbus", CLK_IGNORE_UNUSED,
9292408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 5, GFLAGS),
9302408ab5aSJagan Teki 	GATE(0, "aclk_pdbus_niu2", "aclk_pdbus", CLK_IGNORE_UNUSED,
9312408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 6, GFLAGS),
9322408ab5aSJagan Teki 	GATE(0, "hclk_pdbus_niu2", "hclk_pdbus", CLK_IGNORE_UNUSED,
9332408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 7, GFLAGS),
9342408ab5aSJagan Teki 	GATE(0, "aclk_pdbus_niu3", "aclk_pdbus", CLK_IGNORE_UNUSED,
9352408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 8, GFLAGS),
9362408ab5aSJagan Teki 	GATE(0, "hclk_pdbus_niu3", "hclk_pdbus", CLK_IGNORE_UNUSED,
9372408ab5aSJagan Teki 			RV1126_CLKGATE_CON(2), 9, GFLAGS),
9382408ab5aSJagan Teki 	GATE(0, "pclk_grf", "pclk_pdbus", CLK_IGNORE_UNUSED,
9392408ab5aSJagan Teki 			RV1126_CLKGATE_CON(6), 15, GFLAGS),
9402408ab5aSJagan Teki 	GATE(0, "pclk_sgrf", "pclk_pdbus", CLK_IGNORE_UNUSED,
9412408ab5aSJagan Teki 			RV1126_CLKGATE_CON(8), 4, GFLAGS),
9422408ab5aSJagan Teki 	GATE(0, "aclk_sysram", "hclk_pdbus", CLK_IGNORE_UNUSED,
9432408ab5aSJagan Teki 			RV1126_CLKGATE_CON(3), 9, GFLAGS),
9442408ab5aSJagan Teki 	GATE(0, "pclk_intmux", "pclk_pdbus", CLK_IGNORE_UNUSED,
9452408ab5aSJagan Teki 			RV1126_CLKGATE_CON(7), 14, GFLAGS),
9462408ab5aSJagan Teki 
9472408ab5aSJagan Teki 	/*
9482408ab5aSJagan Teki 	 * Clock-Architecture Diagram 6
9492408ab5aSJagan Teki 	 */
9502408ab5aSJagan Teki 	/* PD_AUDIO */
9512408ab5aSJagan Teki 	GATE(0, "hclk_pdaudio_niu", "hclk_pdaudio", CLK_IGNORE_UNUSED,
9522408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 2, GFLAGS),
9532408ab5aSJagan Teki 	GATE(0, "pclk_pdaudio_niu", "hclk_pdaudio", CLK_IGNORE_UNUSED,
9542408ab5aSJagan Teki 			RV1126_CLKGATE_CON(9), 3, GFLAGS),
9552408ab5aSJagan Teki 
9562408ab5aSJagan Teki 	/*
957*5c7a71fdSJagan Teki 	 * Clock-Architecture Diagram 9
958*5c7a71fdSJagan Teki 	 */
959*5c7a71fdSJagan Teki 	/* PD_VO */
960*5c7a71fdSJagan Teki 	GATE(0, "aclk_pdvo_niu", "aclk_pdvo", CLK_IGNORE_UNUSED,
961*5c7a71fdSJagan Teki 	     RV1126_CLKGATE_CON(14), 3, GFLAGS),
962*5c7a71fdSJagan Teki 	GATE(0, "hclk_pdvo_niu", "hclk_pdvo", CLK_IGNORE_UNUSED,
963*5c7a71fdSJagan Teki 	     RV1126_CLKGATE_CON(14), 4, GFLAGS),
964*5c7a71fdSJagan Teki 	GATE(0, "pclk_pdvo_niu", "pclk_pdvo", CLK_IGNORE_UNUSED,
965*5c7a71fdSJagan Teki 	     RV1126_CLKGATE_CON(14), 5, GFLAGS),
966*5c7a71fdSJagan Teki 
967*5c7a71fdSJagan Teki 	/*
9682408ab5aSJagan Teki 	 * Clock-Architecture Diagram 12
9692408ab5aSJagan Teki 	 */
9702408ab5aSJagan Teki 	/* PD_PHP */
9712408ab5aSJagan Teki 	GATE(0, "aclk_pdphpmid", "aclk_pdphp", CLK_IGNORE_UNUSED,
9722408ab5aSJagan Teki 			RV1126_CLKGATE_CON(17), 2, GFLAGS),
9732408ab5aSJagan Teki 	GATE(0, "hclk_pdphpmid", "hclk_pdphp", CLK_IGNORE_UNUSED,
9742408ab5aSJagan Teki 			RV1126_CLKGATE_CON(17), 3, GFLAGS),
9752408ab5aSJagan Teki 	GATE(0, "aclk_pdphpmid_niu", "aclk_pdphpmid", CLK_IGNORE_UNUSED,
9762408ab5aSJagan Teki 			RV1126_CLKGATE_CON(17), 4, GFLAGS),
9772408ab5aSJagan Teki 	GATE(0, "hclk_pdphpmid_niu", "hclk_pdphpmid", CLK_IGNORE_UNUSED,
9782408ab5aSJagan Teki 			RV1126_CLKGATE_CON(17), 5, GFLAGS),
9792408ab5aSJagan Teki 
9802408ab5aSJagan Teki 	/* PD_SDCARD */
9812408ab5aSJagan Teki 	GATE(0, "hclk_pdsdmmc_niu", "hclk_pdsdmmc", CLK_IGNORE_UNUSED,
9822408ab5aSJagan Teki 			RV1126_CLKGATE_CON(17), 7, GFLAGS),
9832408ab5aSJagan Teki 
9842408ab5aSJagan Teki 	/* PD_SDIO */
9852408ab5aSJagan Teki 	GATE(0, "hclk_pdsdio_niu", "hclk_pdsdio", CLK_IGNORE_UNUSED,
9862408ab5aSJagan Teki 			RV1126_CLKGATE_CON(17), 9, GFLAGS),
9872408ab5aSJagan Teki 
9882408ab5aSJagan Teki 	/* PD_NVM */
9892408ab5aSJagan Teki 	GATE(0, "hclk_pdnvm_niu", "hclk_pdnvm", CLK_IGNORE_UNUSED,
9902408ab5aSJagan Teki 			RV1126_CLKGATE_CON(18), 3, GFLAGS),
9912408ab5aSJagan Teki 
9922408ab5aSJagan Teki 	/* PD_USB */
9932408ab5aSJagan Teki 	GATE(0, "aclk_pdusb_niu", "aclk_pdusb", CLK_IGNORE_UNUSED,
9942408ab5aSJagan Teki 			RV1126_CLKGATE_CON(19), 2, GFLAGS),
9952408ab5aSJagan Teki 	GATE(0, "hclk_pdusb_niu", "hclk_pdusb", CLK_IGNORE_UNUSED,
9962408ab5aSJagan Teki 			RV1126_CLKGATE_CON(19), 3, GFLAGS),
9972408ab5aSJagan Teki 
9982408ab5aSJagan Teki 	/* PD_GMAC */
9992408ab5aSJagan Teki 	GATE(0, "aclk_pdgmac_niu", "aclk_pdgmac", CLK_IGNORE_UNUSED,
10002408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 2, GFLAGS),
10012408ab5aSJagan Teki 	GATE(0, "pclk_pdgmac_niu", "pclk_pdgmac", CLK_IGNORE_UNUSED,
10022408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 3, GFLAGS),
10032408ab5aSJagan Teki 
10042408ab5aSJagan Teki 	/*
10052408ab5aSJagan Teki 	 * Clock-Architecture Diagram 13
10062408ab5aSJagan Teki 	 */
10072408ab5aSJagan Teki 	/* PD_DDR */
10082408ab5aSJagan Teki 	COMPOSITE_NOMUX(0, "pclk_pdddr_pre", "gpll", CLK_IGNORE_UNUSED,
10092408ab5aSJagan Teki 			RV1126_CLKSEL_CON(64), 0, 5, DFLAGS,
10102408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 0, GFLAGS),
10112408ab5aSJagan Teki 	GATE(PCLK_PDDDR, "pclk_pdddr", "pclk_pdddr_pre", CLK_IGNORE_UNUSED,
10122408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 15, GFLAGS),
10132408ab5aSJagan Teki 	GATE(0, "pclk_ddr_msch", "pclk_pdddr", CLK_IGNORE_UNUSED,
10142408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 6, GFLAGS),
10152408ab5aSJagan Teki 	COMPOSITE_NOGATE(SCLK_DDRCLK, "sclk_ddrc", mux_dpll_gpll_p, CLK_IGNORE_UNUSED,
10162408ab5aSJagan Teki 			 RV1126_CLKSEL_CON(64), 15, 1, MFLAGS, 8, 5, DFLAGS |
10172408ab5aSJagan Teki 			 CLK_DIVIDER_POWER_OF_TWO),
10182408ab5aSJagan Teki 	COMPOSITE(CLK_DDRPHY, "clk_ddrphy", mux_dpll_gpll_p, CLK_IGNORE_UNUSED,
10192408ab5aSJagan Teki 			RV1126_CLKSEL_CON(64), 15, 1, MFLAGS, 8, 5, DFLAGS,
10202408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 8, GFLAGS),
10212408ab5aSJagan Teki 	GATE(0, "clk1x_phy", "clk_ddrphy", CLK_IGNORE_UNUSED,
10222408ab5aSJagan Teki 			RV1126_CLKGATE_CON(23), 1, GFLAGS),
10232408ab5aSJagan Teki 	GATE(0, "clk_ddr_msch", "clk_ddrphy", CLK_IGNORE_UNUSED,
10242408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 10, GFLAGS),
10252408ab5aSJagan Teki 	GATE(0, "pclk_ddr_dfictl", "pclk_pdddr", CLK_IGNORE_UNUSED,
10262408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 2, GFLAGS),
10272408ab5aSJagan Teki 	GATE(0, "clk_ddr_dfictl", "clk_ddrphy", CLK_IGNORE_UNUSED,
10282408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 13, GFLAGS),
10292408ab5aSJagan Teki 	GATE(0, "pclk_ddr_standby", "pclk_pdddr", CLK_IGNORE_UNUSED,
10302408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 4, GFLAGS),
10312408ab5aSJagan Teki 	GATE(0, "clk_ddr_standby", "clk_ddrphy", CLK_IGNORE_UNUSED,
10322408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 14, GFLAGS),
10332408ab5aSJagan Teki 	GATE(0, "aclk_ddr_split", "clk_ddrphy", CLK_IGNORE_UNUSED,
10342408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 9, GFLAGS),
10352408ab5aSJagan Teki 	GATE(0, "pclk_ddr_grf", "pclk_pdddr", CLK_IGNORE_UNUSED,
10362408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 5, GFLAGS),
10372408ab5aSJagan Teki 	GATE(PCLK_DDR_MON, "pclk_ddr_mon", "pclk_pdddr", CLK_IGNORE_UNUSED,
10382408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 3, GFLAGS),
10392408ab5aSJagan Teki 	GATE(CLK_DDR_MON, "clk_ddr_mon", "clk_ddrphy", CLK_IGNORE_UNUSED,
10402408ab5aSJagan Teki 			RV1126_CLKGATE_CON(20), 15, GFLAGS),
10412408ab5aSJagan Teki 	GATE(TMCLK_DDR_MON, "tmclk_ddr_mon", "xin24m", CLK_IGNORE_UNUSED,
10422408ab5aSJagan Teki 			RV1126_CLKGATE_CON(21), 7, GFLAGS),
10432408ab5aSJagan Teki 
10442408ab5aSJagan Teki 	/*
10452408ab5aSJagan Teki 	 * Clock-Architecture Diagram 15
10462408ab5aSJagan Teki 	 */
10472408ab5aSJagan Teki 	GATE(0, "pclk_topniu", "pclk_pdtop", CLK_IGNORE_UNUSED,
10482408ab5aSJagan Teki 			RV1126_CLKGATE_CON(23), 9, GFLAGS),
10492408ab5aSJagan Teki 	GATE(PCLK_TOPCRU, "pclk_topcru", "pclk_pdtop", CLK_IGNORE_UNUSED,
10502408ab5aSJagan Teki 			RV1126_CLKGATE_CON(23), 10, GFLAGS),
10512408ab5aSJagan Teki 	GATE(PCLK_TOPGRF, "pclk_topgrf", "pclk_pdtop", CLK_IGNORE_UNUSED,
10522408ab5aSJagan Teki 			RV1126_CLKGATE_CON(23), 11, GFLAGS),
10532408ab5aSJagan Teki 	GATE(PCLK_CPUEMADET, "pclk_cpuemadet", "pclk_pdtop", CLK_IGNORE_UNUSED,
10542408ab5aSJagan Teki 			RV1126_CLKGATE_CON(23), 12, GFLAGS),
10552408ab5aSJagan Teki 	GATE(PCLK_DDRPHY, "pclk_ddrphy", "pclk_pdtop", CLK_IGNORE_UNUSED,
10562408ab5aSJagan Teki 			RV1126_CLKGATE_CON(23), 0, GFLAGS),
10572408ab5aSJagan Teki };
10582408ab5aSJagan Teki 
10592408ab5aSJagan Teki static const char *const rv1126_cru_critical_clocks[] __initconst = {
10602408ab5aSJagan Teki 	"gpll",
10612408ab5aSJagan Teki 	"cpll",
10622408ab5aSJagan Teki 	"hpll",
10632408ab5aSJagan Teki 	"armclk",
10642408ab5aSJagan Teki 	"pclk_dbg",
10652408ab5aSJagan Teki 	"pclk_pdpmu",
10662408ab5aSJagan Teki 	"aclk_pdbus",
10672408ab5aSJagan Teki 	"hclk_pdbus",
10682408ab5aSJagan Teki 	"pclk_pdbus",
10692408ab5aSJagan Teki 	"aclk_pdphp",
10702408ab5aSJagan Teki 	"hclk_pdphp",
10712408ab5aSJagan Teki 	"clk_ddrphy",
10722408ab5aSJagan Teki 	"pclk_pdddr",
10732408ab5aSJagan Teki 	"pclk_pdtop",
10742408ab5aSJagan Teki 	"clk_usbhost_utmi_ohci",
10752408ab5aSJagan Teki 	"aclk_pdjpeg_niu",
10762408ab5aSJagan Teki 	"hclk_pdjpeg_niu",
10772408ab5aSJagan Teki 	"aclk_pdvdec_niu",
10782408ab5aSJagan Teki 	"hclk_pdvdec_niu",
10792408ab5aSJagan Teki };
10802408ab5aSJagan Teki 
rv1126_pmu_clk_init(struct device_node * np)10812408ab5aSJagan Teki static void __init rv1126_pmu_clk_init(struct device_node *np)
10822408ab5aSJagan Teki {
10832408ab5aSJagan Teki 	struct rockchip_clk_provider *ctx;
10842408ab5aSJagan Teki 	void __iomem *reg_base;
10852408ab5aSJagan Teki 
10862408ab5aSJagan Teki 	reg_base = of_iomap(np, 0);
10872408ab5aSJagan Teki 	if (!reg_base) {
10882408ab5aSJagan Teki 		pr_err("%s: could not map cru pmu region\n", __func__);
10892408ab5aSJagan Teki 		return;
10902408ab5aSJagan Teki 	}
10912408ab5aSJagan Teki 
10922408ab5aSJagan Teki 	ctx = rockchip_clk_init(np, reg_base, CLKPMU_NR_CLKS);
10932408ab5aSJagan Teki 	if (IS_ERR(ctx)) {
10942408ab5aSJagan Teki 		pr_err("%s: rockchip pmu clk init failed\n", __func__);
10952408ab5aSJagan Teki 		return;
10962408ab5aSJagan Teki 	}
10972408ab5aSJagan Teki 
10982408ab5aSJagan Teki 	rockchip_clk_register_plls(ctx, rv1126_pmu_pll_clks,
10992408ab5aSJagan Teki 				   ARRAY_SIZE(rv1126_pmu_pll_clks),
11002408ab5aSJagan Teki 				   RV1126_GRF_SOC_STATUS0);
11012408ab5aSJagan Teki 
11022408ab5aSJagan Teki 	rockchip_clk_register_branches(ctx, rv1126_clk_pmu_branches,
11032408ab5aSJagan Teki 				       ARRAY_SIZE(rv1126_clk_pmu_branches));
11042408ab5aSJagan Teki 
11052408ab5aSJagan Teki 	rockchip_register_softrst(np, 2, reg_base + RV1126_PMU_SOFTRST_CON(0),
11062408ab5aSJagan Teki 				  ROCKCHIP_SOFTRST_HIWORD_MASK);
11072408ab5aSJagan Teki 
11082408ab5aSJagan Teki 	rockchip_clk_of_add_provider(np, ctx);
11092408ab5aSJagan Teki }
11102408ab5aSJagan Teki 
rv1126_clk_init(struct device_node * np)11112408ab5aSJagan Teki static void __init rv1126_clk_init(struct device_node *np)
11122408ab5aSJagan Teki {
11132408ab5aSJagan Teki 	struct rockchip_clk_provider *ctx;
11142408ab5aSJagan Teki 	void __iomem *reg_base;
11152408ab5aSJagan Teki 
11162408ab5aSJagan Teki 	reg_base = of_iomap(np, 0);
11172408ab5aSJagan Teki 	if (!reg_base) {
11182408ab5aSJagan Teki 		pr_err("%s: could not map cru region\n", __func__);
11192408ab5aSJagan Teki 		return;
11202408ab5aSJagan Teki 	}
11212408ab5aSJagan Teki 
11222408ab5aSJagan Teki 	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
11232408ab5aSJagan Teki 	if (IS_ERR(ctx)) {
11242408ab5aSJagan Teki 		pr_err("%s: rockchip clk init failed\n", __func__);
11252408ab5aSJagan Teki 		iounmap(reg_base);
11262408ab5aSJagan Teki 		return;
11272408ab5aSJagan Teki 	}
11282408ab5aSJagan Teki 
11292408ab5aSJagan Teki 	rockchip_clk_register_plls(ctx, rv1126_pll_clks,
11302408ab5aSJagan Teki 				   ARRAY_SIZE(rv1126_pll_clks),
11312408ab5aSJagan Teki 				   RV1126_GRF_SOC_STATUS0);
11322408ab5aSJagan Teki 
11332408ab5aSJagan Teki 	rockchip_clk_register_armclk(ctx, ARMCLK, "armclk",
11342408ab5aSJagan Teki 				     mux_armclk_p, ARRAY_SIZE(mux_armclk_p),
11352408ab5aSJagan Teki 				     &rv1126_cpuclk_data, rv1126_cpuclk_rates,
11362408ab5aSJagan Teki 				     ARRAY_SIZE(rv1126_cpuclk_rates));
11372408ab5aSJagan Teki 
11382408ab5aSJagan Teki 	rockchip_clk_register_branches(ctx, rv1126_clk_branches,
11392408ab5aSJagan Teki 				       ARRAY_SIZE(rv1126_clk_branches));
11402408ab5aSJagan Teki 
11412408ab5aSJagan Teki 	rockchip_register_softrst(np, 15, reg_base + RV1126_SOFTRST_CON(0),
11422408ab5aSJagan Teki 				  ROCKCHIP_SOFTRST_HIWORD_MASK);
11432408ab5aSJagan Teki 
11442408ab5aSJagan Teki 	rockchip_register_restart_notifier(ctx, RV1126_GLB_SRST_FST, NULL);
11452408ab5aSJagan Teki 
11462408ab5aSJagan Teki 	rockchip_clk_protect_critical(rv1126_cru_critical_clocks,
11472408ab5aSJagan Teki 				      ARRAY_SIZE(rv1126_cru_critical_clocks));
11482408ab5aSJagan Teki 
11492408ab5aSJagan Teki 	rockchip_clk_of_add_provider(np, ctx);
11502408ab5aSJagan Teki }
11512408ab5aSJagan Teki 
11522408ab5aSJagan Teki struct clk_rv1126_inits {
11532408ab5aSJagan Teki 	void (*inits)(struct device_node *np);
11542408ab5aSJagan Teki };
11552408ab5aSJagan Teki 
11562408ab5aSJagan Teki static const struct clk_rv1126_inits clk_rv1126_pmucru_init = {
11572408ab5aSJagan Teki 	.inits = rv1126_pmu_clk_init,
11582408ab5aSJagan Teki };
11592408ab5aSJagan Teki 
11602408ab5aSJagan Teki static const struct clk_rv1126_inits clk_rv1126_cru_init = {
11612408ab5aSJagan Teki 	.inits = rv1126_clk_init,
11622408ab5aSJagan Teki };
11632408ab5aSJagan Teki 
11642408ab5aSJagan Teki static const struct of_device_id clk_rv1126_match_table[] = {
11652408ab5aSJagan Teki 	{
11662408ab5aSJagan Teki 		.compatible = "rockchip,rv1126-cru",
11672408ab5aSJagan Teki 		.data = &clk_rv1126_cru_init,
11682408ab5aSJagan Teki 	},  {
11692408ab5aSJagan Teki 		.compatible = "rockchip,rv1126-pmucru",
11702408ab5aSJagan Teki 		.data = &clk_rv1126_pmucru_init,
11712408ab5aSJagan Teki 	},
11722408ab5aSJagan Teki 	{ }
11732408ab5aSJagan Teki };
11742408ab5aSJagan Teki 
clk_rv1126_probe(struct platform_device * pdev)11752408ab5aSJagan Teki static int __init clk_rv1126_probe(struct platform_device *pdev)
11762408ab5aSJagan Teki {
11772408ab5aSJagan Teki 	struct device_node *np = pdev->dev.of_node;
11782408ab5aSJagan Teki 	const struct clk_rv1126_inits *init_data;
11792408ab5aSJagan Teki 
11802408ab5aSJagan Teki 	init_data = (struct clk_rv1126_inits *)of_device_get_match_data(&pdev->dev);
11812408ab5aSJagan Teki 	if (!init_data)
11822408ab5aSJagan Teki 		return -EINVAL;
11832408ab5aSJagan Teki 
11842408ab5aSJagan Teki 	if (init_data->inits)
11852408ab5aSJagan Teki 		init_data->inits(np);
11862408ab5aSJagan Teki 
11872408ab5aSJagan Teki 	return 0;
11882408ab5aSJagan Teki }
11892408ab5aSJagan Teki 
11902408ab5aSJagan Teki static struct platform_driver clk_rv1126_driver = {
11912408ab5aSJagan Teki 	.driver		= {
11922408ab5aSJagan Teki 		.name	= "clk-rv1126",
11932408ab5aSJagan Teki 		.of_match_table = clk_rv1126_match_table,
11942408ab5aSJagan Teki 		.suppress_bind_attrs = true,
11952408ab5aSJagan Teki 	},
11962408ab5aSJagan Teki };
11972408ab5aSJagan Teki builtin_platform_driver_probe(clk_rv1126_driver, clk_rv1126_probe);
1198