xref: /linux/drivers/clk/rockchip/clk-rk3399.c (revision 640332d1a089909df08bc9f3e42888a2019c66e2)
111551005SXing Zheng /*
211551005SXing Zheng  * Copyright (c) 2016 Rockchip Electronics Co. Ltd.
311551005SXing Zheng  * Author: Xing Zheng <zhengxing@rock-chips.com>
411551005SXing Zheng  *
511551005SXing Zheng  * This program is free software; you can redistribute it and/or modify
611551005SXing Zheng  * it under the terms of the GNU General Public License as published by
711551005SXing Zheng  * the Free Software Foundation; either version 2 of the License, or
811551005SXing Zheng  * (at your option) any later version.
911551005SXing Zheng  *
1011551005SXing Zheng  * This program is distributed in the hope that it will be useful,
1111551005SXing Zheng  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1211551005SXing Zheng  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1311551005SXing Zheng  * GNU General Public License for more details.
1411551005SXing Zheng  */
1511551005SXing Zheng 
1611551005SXing Zheng #include <linux/clk-provider.h>
1711551005SXing Zheng #include <linux/of.h>
1811551005SXing Zheng #include <linux/of_address.h>
1911551005SXing Zheng #include <linux/platform_device.h>
2011551005SXing Zheng #include <linux/regmap.h>
2111551005SXing Zheng #include <dt-bindings/clock/rk3399-cru.h>
2211551005SXing Zheng #include "clk.h"
2311551005SXing Zheng 
2411551005SXing Zheng enum rk3399_plls {
2511551005SXing Zheng 	lpll, bpll, dpll, cpll, gpll, npll, vpll,
2611551005SXing Zheng };
2711551005SXing Zheng 
2811551005SXing Zheng enum rk3399_pmu_plls {
2911551005SXing Zheng 	ppll,
3011551005SXing Zheng };
3111551005SXing Zheng 
3211551005SXing Zheng static struct rockchip_pll_rate_table rk3399_pll_rates[] = {
3311551005SXing Zheng 	/* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */
3411551005SXing Zheng 	RK3036_PLL_RATE(2208000000, 1, 92, 1, 1, 1, 0),
3511551005SXing Zheng 	RK3036_PLL_RATE(2184000000, 1, 91, 1, 1, 1, 0),
3611551005SXing Zheng 	RK3036_PLL_RATE(2160000000, 1, 90, 1, 1, 1, 0),
3711551005SXing Zheng 	RK3036_PLL_RATE(2136000000, 1, 89, 1, 1, 1, 0),
3811551005SXing Zheng 	RK3036_PLL_RATE(2112000000, 1, 88, 1, 1, 1, 0),
3911551005SXing Zheng 	RK3036_PLL_RATE(2088000000, 1, 87, 1, 1, 1, 0),
4011551005SXing Zheng 	RK3036_PLL_RATE(2064000000, 1, 86, 1, 1, 1, 0),
4111551005SXing Zheng 	RK3036_PLL_RATE(2040000000, 1, 85, 1, 1, 1, 0),
4211551005SXing Zheng 	RK3036_PLL_RATE(2016000000, 1, 84, 1, 1, 1, 0),
4311551005SXing Zheng 	RK3036_PLL_RATE(1992000000, 1, 83, 1, 1, 1, 0),
4411551005SXing Zheng 	RK3036_PLL_RATE(1968000000, 1, 82, 1, 1, 1, 0),
4511551005SXing Zheng 	RK3036_PLL_RATE(1944000000, 1, 81, 1, 1, 1, 0),
4611551005SXing Zheng 	RK3036_PLL_RATE(1920000000, 1, 80, 1, 1, 1, 0),
4711551005SXing Zheng 	RK3036_PLL_RATE(1896000000, 1, 79, 1, 1, 1, 0),
4811551005SXing Zheng 	RK3036_PLL_RATE(1872000000, 1, 78, 1, 1, 1, 0),
4911551005SXing Zheng 	RK3036_PLL_RATE(1848000000, 1, 77, 1, 1, 1, 0),
5011551005SXing Zheng 	RK3036_PLL_RATE(1824000000, 1, 76, 1, 1, 1, 0),
5111551005SXing Zheng 	RK3036_PLL_RATE(1800000000, 1, 75, 1, 1, 1, 0),
5211551005SXing Zheng 	RK3036_PLL_RATE(1776000000, 1, 74, 1, 1, 1, 0),
5311551005SXing Zheng 	RK3036_PLL_RATE(1752000000, 1, 73, 1, 1, 1, 0),
5411551005SXing Zheng 	RK3036_PLL_RATE(1728000000, 1, 72, 1, 1, 1, 0),
5511551005SXing Zheng 	RK3036_PLL_RATE(1704000000, 1, 71, 1, 1, 1, 0),
5611551005SXing Zheng 	RK3036_PLL_RATE(1680000000, 1, 70, 1, 1, 1, 0),
5711551005SXing Zheng 	RK3036_PLL_RATE(1656000000, 1, 69, 1, 1, 1, 0),
5811551005SXing Zheng 	RK3036_PLL_RATE(1632000000, 1, 68, 1, 1, 1, 0),
5911551005SXing Zheng 	RK3036_PLL_RATE(1608000000, 1, 67, 1, 1, 1, 0),
604ee3fd4aSDerek Basehore 	RK3036_PLL_RATE(1600000000, 3, 200, 1, 1, 1, 0),
6111551005SXing Zheng 	RK3036_PLL_RATE(1584000000, 1, 66, 1, 1, 1, 0),
6211551005SXing Zheng 	RK3036_PLL_RATE(1560000000, 1, 65, 1, 1, 1, 0),
6311551005SXing Zheng 	RK3036_PLL_RATE(1536000000, 1, 64, 1, 1, 1, 0),
6411551005SXing Zheng 	RK3036_PLL_RATE(1512000000, 1, 63, 1, 1, 1, 0),
6511551005SXing Zheng 	RK3036_PLL_RATE(1488000000, 1, 62, 1, 1, 1, 0),
6611551005SXing Zheng 	RK3036_PLL_RATE(1464000000, 1, 61, 1, 1, 1, 0),
6711551005SXing Zheng 	RK3036_PLL_RATE(1440000000, 1, 60, 1, 1, 1, 0),
6811551005SXing Zheng 	RK3036_PLL_RATE(1416000000, 1, 59, 1, 1, 1, 0),
6911551005SXing Zheng 	RK3036_PLL_RATE(1392000000, 1, 58, 1, 1, 1, 0),
7011551005SXing Zheng 	RK3036_PLL_RATE(1368000000, 1, 57, 1, 1, 1, 0),
7111551005SXing Zheng 	RK3036_PLL_RATE(1344000000, 1, 56, 1, 1, 1, 0),
7211551005SXing Zheng 	RK3036_PLL_RATE(1320000000, 1, 55, 1, 1, 1, 0),
7311551005SXing Zheng 	RK3036_PLL_RATE(1296000000, 1, 54, 1, 1, 1, 0),
7411551005SXing Zheng 	RK3036_PLL_RATE(1272000000, 1, 53, 1, 1, 1, 0),
7511551005SXing Zheng 	RK3036_PLL_RATE(1248000000, 1, 52, 1, 1, 1, 0),
7611551005SXing Zheng 	RK3036_PLL_RATE(1200000000, 1, 50, 1, 1, 1, 0),
7711551005SXing Zheng 	RK3036_PLL_RATE(1188000000, 2, 99, 1, 1, 1, 0),
7811551005SXing Zheng 	RK3036_PLL_RATE(1104000000, 1, 46, 1, 1, 1, 0),
7911551005SXing Zheng 	RK3036_PLL_RATE(1100000000, 12, 550, 1, 1, 1, 0),
8011551005SXing Zheng 	RK3036_PLL_RATE(1008000000, 1, 84, 2, 1, 1, 0),
811dfbec39SXing Zheng 	RK3036_PLL_RATE(1000000000, 1, 125, 3, 1, 1, 0),
8211551005SXing Zheng 	RK3036_PLL_RATE( 984000000, 1, 82, 2, 1, 1, 0),
8311551005SXing Zheng 	RK3036_PLL_RATE( 960000000, 1, 80, 2, 1, 1, 0),
8411551005SXing Zheng 	RK3036_PLL_RATE( 936000000, 1, 78, 2, 1, 1, 0),
8511551005SXing Zheng 	RK3036_PLL_RATE( 912000000, 1, 76, 2, 1, 1, 0),
8611551005SXing Zheng 	RK3036_PLL_RATE( 900000000, 4, 300, 2, 1, 1, 0),
8711551005SXing Zheng 	RK3036_PLL_RATE( 888000000, 1, 74, 2, 1, 1, 0),
8811551005SXing Zheng 	RK3036_PLL_RATE( 864000000, 1, 72, 2, 1, 1, 0),
8911551005SXing Zheng 	RK3036_PLL_RATE( 840000000, 1, 70, 2, 1, 1, 0),
9011551005SXing Zheng 	RK3036_PLL_RATE( 816000000, 1, 68, 2, 1, 1, 0),
911dfbec39SXing Zheng 	RK3036_PLL_RATE( 800000000, 1, 100, 3, 1, 1, 0),
9211551005SXing Zheng 	RK3036_PLL_RATE( 700000000, 6, 350, 2, 1, 1, 0),
9311551005SXing Zheng 	RK3036_PLL_RATE( 696000000, 1, 58, 2, 1, 1, 0),
9411551005SXing Zheng 	RK3036_PLL_RATE( 676000000, 3, 169, 2, 1, 1, 0),
9511551005SXing Zheng 	RK3036_PLL_RATE( 600000000, 1, 75, 3, 1, 1, 0),
96aa2897ceSXing Zheng 	RK3036_PLL_RATE( 594000000, 1, 99, 4, 1, 1, 0),
975c1c63f6SXing Zheng 	RK3036_PLL_RATE( 533250000, 8, 711, 4, 1, 1, 0),
9811551005SXing Zheng 	RK3036_PLL_RATE( 504000000, 1, 63, 3, 1, 1, 0),
9911551005SXing Zheng 	RK3036_PLL_RATE( 500000000, 6, 250, 2, 1, 1, 0),
10011551005SXing Zheng 	RK3036_PLL_RATE( 408000000, 1, 68, 2, 2, 1, 0),
10111551005SXing Zheng 	RK3036_PLL_RATE( 312000000, 1, 52, 2, 2, 1, 0),
102aa2897ceSXing Zheng 	RK3036_PLL_RATE( 297000000, 1, 99, 4, 2, 1, 0),
10311551005SXing Zheng 	RK3036_PLL_RATE( 216000000, 1, 72, 4, 2, 1, 0),
104aa2897ceSXing Zheng 	RK3036_PLL_RATE( 148500000, 1, 99, 4, 4, 1, 0),
105efc4204cSXing Zheng 	RK3036_PLL_RATE( 106500000, 1, 71, 4, 4, 1, 0),
10611551005SXing Zheng 	RK3036_PLL_RATE(  96000000, 1, 64, 4, 4, 1, 0),
107aa2897ceSXing Zheng 	RK3036_PLL_RATE(  74250000, 2, 99, 4, 4, 1, 0),
108efc4204cSXing Zheng 	RK3036_PLL_RATE(  65000000, 1, 65, 6, 4, 1, 0),
109aa2897ceSXing Zheng 	RK3036_PLL_RATE(  54000000, 1, 54, 6, 4, 1, 0),
110aa2897ceSXing Zheng 	RK3036_PLL_RATE(  27000000, 1, 27, 6, 4, 1, 0),
11111551005SXing Zheng 	{ /* sentinel */ },
11211551005SXing Zheng };
11311551005SXing Zheng 
11411551005SXing Zheng /* CRU parents */
11511551005SXing Zheng PNAME(mux_pll_p)				= { "xin24m", "xin32k" };
11611551005SXing Zheng 
11711551005SXing Zheng PNAME(mux_armclkl_p)				= { "clk_core_l_lpll_src",
11811551005SXing Zheng 						    "clk_core_l_bpll_src",
11911551005SXing Zheng 						    "clk_core_l_dpll_src",
12011551005SXing Zheng 						    "clk_core_l_gpll_src" };
12111551005SXing Zheng PNAME(mux_armclkb_p)				= { "clk_core_b_lpll_src",
12211551005SXing Zheng 						    "clk_core_b_bpll_src",
12311551005SXing Zheng 						    "clk_core_b_dpll_src",
12411551005SXing Zheng 						    "clk_core_b_gpll_src" };
125464b9eebSLin Huang PNAME(mux_ddrclk_p)				= { "clk_ddrc_lpll_src",
126464b9eebSLin Huang 						    "clk_ddrc_bpll_src",
127464b9eebSLin Huang 						    "clk_ddrc_dpll_src",
128464b9eebSLin Huang 						    "clk_ddrc_gpll_src" };
12911551005SXing Zheng PNAME(mux_aclk_cci_p)				= { "cpll_aclk_cci_src",
13011551005SXing Zheng 						    "gpll_aclk_cci_src",
13111551005SXing Zheng 						    "npll_aclk_cci_src",
13211551005SXing Zheng 						    "vpll_aclk_cci_src" };
133995d3fdeSHeiko Stuebner PNAME(mux_cci_trace_p)				= { "cpll_cci_trace",
134995d3fdeSHeiko Stuebner 						    "gpll_cci_trace" };
135995d3fdeSHeiko Stuebner PNAME(mux_cs_p)					= { "cpll_cs", "gpll_cs",
136995d3fdeSHeiko Stuebner 						    "npll_cs"};
137995d3fdeSHeiko Stuebner PNAME(mux_aclk_perihp_p)			= { "cpll_aclk_perihp_src",
138995d3fdeSHeiko Stuebner 						    "gpll_aclk_perihp_src" };
13911551005SXing Zheng 
14011551005SXing Zheng PNAME(mux_pll_src_cpll_gpll_p)			= { "cpll", "gpll" };
14111551005SXing Zheng PNAME(mux_pll_src_cpll_gpll_npll_p)		= { "cpll", "gpll", "npll" };
14211551005SXing Zheng PNAME(mux_pll_src_cpll_gpll_ppll_p)		= { "cpll", "gpll", "ppll" };
14311551005SXing Zheng PNAME(mux_pll_src_cpll_gpll_upll_p)		= { "cpll", "gpll", "upll" };
14411551005SXing Zheng PNAME(mux_pll_src_npll_cpll_gpll_p)		= { "npll", "cpll", "gpll" };
145995d3fdeSHeiko Stuebner PNAME(mux_pll_src_cpll_gpll_npll_ppll_p)	= { "cpll", "gpll", "npll",
146995d3fdeSHeiko Stuebner 						    "ppll" };
147995d3fdeSHeiko Stuebner PNAME(mux_pll_src_cpll_gpll_npll_24m_p)		= { "cpll", "gpll", "npll",
148995d3fdeSHeiko Stuebner 						    "xin24m" };
149995d3fdeSHeiko Stuebner PNAME(mux_pll_src_cpll_gpll_npll_usbphy480m_p)	= { "cpll", "gpll", "npll",
150995d3fdeSHeiko Stuebner 						    "clk_usbphy_480m" };
151995d3fdeSHeiko Stuebner PNAME(mux_pll_src_ppll_cpll_gpll_npll_p)	= { "ppll", "cpll", "gpll",
152995d3fdeSHeiko Stuebner 						    "npll", "upll" };
153995d3fdeSHeiko Stuebner PNAME(mux_pll_src_cpll_gpll_npll_upll_24m_p)	= { "cpll", "gpll", "npll",
154995d3fdeSHeiko Stuebner 						    "upll", "xin24m" };
155995d3fdeSHeiko Stuebner PNAME(mux_pll_src_cpll_gpll_npll_ppll_upll_24m_p) = { "cpll", "gpll", "npll",
156995d3fdeSHeiko Stuebner 						    "ppll", "upll", "xin24m" };
15711551005SXing Zheng 
15811551005SXing Zheng PNAME(mux_pll_src_vpll_cpll_gpll_p)		= { "vpll", "cpll", "gpll" };
159995d3fdeSHeiko Stuebner PNAME(mux_pll_src_vpll_cpll_gpll_npll_p)	= { "vpll", "cpll", "gpll",
160995d3fdeSHeiko Stuebner 						    "npll" };
161995d3fdeSHeiko Stuebner PNAME(mux_pll_src_vpll_cpll_gpll_24m_p)		= { "vpll", "cpll", "gpll",
162995d3fdeSHeiko Stuebner 						    "xin24m" };
16311551005SXing Zheng 
164995d3fdeSHeiko Stuebner PNAME(mux_dclk_vop0_p)			= { "dclk_vop0_div",
165995d3fdeSHeiko Stuebner 					    "dclk_vop0_frac" };
166995d3fdeSHeiko Stuebner PNAME(mux_dclk_vop1_p)			= { "dclk_vop1_div",
167995d3fdeSHeiko Stuebner 					    "dclk_vop1_frac" };
16811551005SXing Zheng 
169fd8bc829SXing Zheng PNAME(mux_clk_cif_p)			= { "clk_cifout_src", "xin24m" };
17011551005SXing Zheng 
17111551005SXing Zheng PNAME(mux_pll_src_24m_usbphy480m_p)	= { "xin24m", "clk_usbphy_480m" };
17211551005SXing Zheng PNAME(mux_pll_src_24m_pciephy_p)	= { "xin24m", "clk_pciephy_ref100m" };
173995d3fdeSHeiko Stuebner PNAME(mux_pll_src_24m_32k_cpll_gpll_p)	= { "xin24m", "xin32k",
174995d3fdeSHeiko Stuebner 					    "cpll", "gpll" };
175995d3fdeSHeiko Stuebner PNAME(mux_pciecore_cru_phy_p)		= { "clk_pcie_core_cru",
176995d3fdeSHeiko Stuebner 					    "clk_pcie_core_phy" };
17711551005SXing Zheng 
178995d3fdeSHeiko Stuebner PNAME(mux_aclk_emmc_p)			= { "cpll_aclk_emmc_src",
179995d3fdeSHeiko Stuebner 					    "gpll_aclk_emmc_src" };
18011551005SXing Zheng 
181995d3fdeSHeiko Stuebner PNAME(mux_aclk_perilp0_p)		= { "cpll_aclk_perilp0_src",
182995d3fdeSHeiko Stuebner 					    "gpll_aclk_perilp0_src" };
18311551005SXing Zheng 
184995d3fdeSHeiko Stuebner PNAME(mux_fclk_cm0s_p)			= { "cpll_fclk_cm0s_src",
185995d3fdeSHeiko Stuebner 					    "gpll_fclk_cm0s_src" };
18611551005SXing Zheng 
187995d3fdeSHeiko Stuebner PNAME(mux_hclk_perilp1_p)		= { "cpll_hclk_perilp1_src",
188995d3fdeSHeiko Stuebner 					    "gpll_hclk_perilp1_src" };
18911551005SXing Zheng 
19011551005SXing Zheng PNAME(mux_clk_testout1_p)		= { "clk_testout1_pll_src", "xin24m" };
19111551005SXing Zheng PNAME(mux_clk_testout2_p)		= { "clk_testout2_pll_src", "xin24m" };
19211551005SXing Zheng 
193995d3fdeSHeiko Stuebner PNAME(mux_usbphy_480m_p)		= { "clk_usbphy0_480m_src",
194995d3fdeSHeiko Stuebner 					    "clk_usbphy1_480m_src" };
195995d3fdeSHeiko Stuebner PNAME(mux_aclk_gmac_p)			= { "cpll_aclk_gmac_src",
196995d3fdeSHeiko Stuebner 					    "gpll_aclk_gmac_src" };
19711551005SXing Zheng PNAME(mux_rmii_p)			= { "clk_gmac", "clkin_gmac" };
19811551005SXing Zheng PNAME(mux_spdif_p)			= { "clk_spdif_div", "clk_spdif_frac",
19911551005SXing Zheng 					    "clkin_i2s", "xin12m" };
20011551005SXing Zheng PNAME(mux_i2s0_p)			= { "clk_i2s0_div", "clk_i2s0_frac",
20111551005SXing Zheng 					    "clkin_i2s", "xin12m" };
20211551005SXing Zheng PNAME(mux_i2s1_p)			= { "clk_i2s1_div", "clk_i2s1_frac",
20311551005SXing Zheng 					    "clkin_i2s", "xin12m" };
20411551005SXing Zheng PNAME(mux_i2s2_p)			= { "clk_i2s2_div", "clk_i2s2_frac",
20511551005SXing Zheng 					    "clkin_i2s", "xin12m" };
206995d3fdeSHeiko Stuebner PNAME(mux_i2sch_p)			= { "clk_i2s0", "clk_i2s1",
207995d3fdeSHeiko Stuebner 					    "clk_i2s2" };
20811551005SXing Zheng PNAME(mux_i2sout_p)			= { "clk_i2sout_src", "xin12m" };
20911551005SXing Zheng 
21011551005SXing Zheng PNAME(mux_uart0_p)	= { "clk_uart0_div", "clk_uart0_frac", "xin24m" };
21111551005SXing Zheng PNAME(mux_uart1_p)	= { "clk_uart1_div", "clk_uart1_frac", "xin24m" };
21211551005SXing Zheng PNAME(mux_uart2_p)	= { "clk_uart2_div", "clk_uart2_frac", "xin24m" };
21311551005SXing Zheng PNAME(mux_uart3_p)	= { "clk_uart3_div", "clk_uart3_frac", "xin24m" };
21411551005SXing Zheng 
21511551005SXing Zheng /* PMU CRU parents */
21611551005SXing Zheng PNAME(mux_ppll_24m_p)		= { "ppll", "xin24m" };
21711551005SXing Zheng PNAME(mux_24m_ppll_p)		= { "xin24m", "ppll" };
21811551005SXing Zheng PNAME(mux_fclk_cm0s_pmu_ppll_p)	= { "fclk_cm0s_pmu_ppll_src", "xin24m" };
21911551005SXing Zheng PNAME(mux_wifi_pmu_p)		= { "clk_wifi_div", "clk_wifi_frac" };
220995d3fdeSHeiko Stuebner PNAME(mux_uart4_pmu_p)		= { "clk_uart4_div", "clk_uart4_frac",
221995d3fdeSHeiko Stuebner 				    "xin24m" };
22211551005SXing Zheng PNAME(mux_clk_testout2_2io_p)	= { "clk_testout2", "clk_32k_suspend_pmu" };
22311551005SXing Zheng 
22411551005SXing Zheng static struct rockchip_pll_clock rk3399_pll_clks[] __initdata = {
22511551005SXing Zheng 	[lpll] = PLL(pll_rk3399, PLL_APLLL, "lpll", mux_pll_p, 0, RK3399_PLL_CON(0),
22611551005SXing Zheng 		     RK3399_PLL_CON(3), 8, 31, 0, rk3399_pll_rates),
22711551005SXing Zheng 	[bpll] = PLL(pll_rk3399, PLL_APLLB, "bpll", mux_pll_p, 0, RK3399_PLL_CON(8),
22811551005SXing Zheng 		     RK3399_PLL_CON(11), 8, 31, 0, rk3399_pll_rates),
22911551005SXing Zheng 	[dpll] = PLL(pll_rk3399, PLL_DPLL, "dpll", mux_pll_p, 0, RK3399_PLL_CON(16),
23011551005SXing Zheng 		     RK3399_PLL_CON(19), 8, 31, 0, NULL),
23111551005SXing Zheng 	[cpll] = PLL(pll_rk3399, PLL_CPLL, "cpll", mux_pll_p, 0, RK3399_PLL_CON(24),
23211551005SXing Zheng 		     RK3399_PLL_CON(27), 8, 31, ROCKCHIP_PLL_SYNC_RATE, rk3399_pll_rates),
23311551005SXing Zheng 	[gpll] = PLL(pll_rk3399, PLL_GPLL, "gpll", mux_pll_p, 0, RK3399_PLL_CON(32),
23411551005SXing Zheng 		     RK3399_PLL_CON(35), 8, 31, ROCKCHIP_PLL_SYNC_RATE, rk3399_pll_rates),
23511551005SXing Zheng 	[npll] = PLL(pll_rk3399, PLL_NPLL, "npll",  mux_pll_p, 0, RK3399_PLL_CON(40),
23611551005SXing Zheng 		     RK3399_PLL_CON(43), 8, 31, ROCKCHIP_PLL_SYNC_RATE, rk3399_pll_rates),
23711551005SXing Zheng 	[vpll] = PLL(pll_rk3399, PLL_VPLL, "vpll",  mux_pll_p, 0, RK3399_PLL_CON(48),
23811551005SXing Zheng 		     RK3399_PLL_CON(51), 8, 31, ROCKCHIP_PLL_SYNC_RATE, rk3399_pll_rates),
23911551005SXing Zheng };
24011551005SXing Zheng 
24111551005SXing Zheng static struct rockchip_pll_clock rk3399_pmu_pll_clks[] __initdata = {
24211551005SXing Zheng 	[ppll] = PLL(pll_rk3399, PLL_PPLL, "ppll",  mux_pll_p, 0, RK3399_PMU_PLL_CON(0),
24311551005SXing Zheng 		     RK3399_PMU_PLL_CON(3), 8, 31, ROCKCHIP_PLL_SYNC_RATE, rk3399_pll_rates),
24411551005SXing Zheng };
24511551005SXing Zheng 
24611551005SXing Zheng #define MFLAGS CLK_MUX_HIWORD_MASK
24711551005SXing Zheng #define DFLAGS CLK_DIVIDER_HIWORD_MASK
24811551005SXing Zheng #define GFLAGS (CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE)
24911551005SXing Zheng #define IFLAGS ROCKCHIP_INVERTER_HIWORD_MASK
25011551005SXing Zheng 
25111551005SXing Zheng static struct rockchip_clk_branch rk3399_spdif_fracmux __initdata =
25211551005SXing Zheng 	MUX(0, "clk_spdif_mux", mux_spdif_p, CLK_SET_RATE_PARENT,
25311551005SXing Zheng 			RK3399_CLKSEL_CON(32), 13, 2, MFLAGS);
25411551005SXing Zheng 
25511551005SXing Zheng static struct rockchip_clk_branch rk3399_i2s0_fracmux __initdata =
25611551005SXing Zheng 	MUX(0, "clk_i2s0_mux", mux_i2s0_p, CLK_SET_RATE_PARENT,
25711551005SXing Zheng 			RK3399_CLKSEL_CON(28), 8, 2, MFLAGS);
25811551005SXing Zheng 
25911551005SXing Zheng static struct rockchip_clk_branch rk3399_i2s1_fracmux __initdata =
26011551005SXing Zheng 	MUX(0, "clk_i2s1_mux", mux_i2s1_p, CLK_SET_RATE_PARENT,
26111551005SXing Zheng 			RK3399_CLKSEL_CON(29), 8, 2, MFLAGS);
26211551005SXing Zheng 
26311551005SXing Zheng static struct rockchip_clk_branch rk3399_i2s2_fracmux __initdata =
26411551005SXing Zheng 	MUX(0, "clk_i2s2_mux", mux_i2s2_p, CLK_SET_RATE_PARENT,
26511551005SXing Zheng 			RK3399_CLKSEL_CON(30), 8, 2, MFLAGS);
26611551005SXing Zheng 
26711551005SXing Zheng static struct rockchip_clk_branch rk3399_uart0_fracmux __initdata =
26811551005SXing Zheng 	MUX(SCLK_UART0, "clk_uart0", mux_uart0_p, CLK_SET_RATE_PARENT,
26911551005SXing Zheng 			RK3399_CLKSEL_CON(33), 8, 2, MFLAGS);
27011551005SXing Zheng 
27111551005SXing Zheng static struct rockchip_clk_branch rk3399_uart1_fracmux __initdata =
27211551005SXing Zheng 	MUX(SCLK_UART1, "clk_uart1", mux_uart1_p, CLK_SET_RATE_PARENT,
27311551005SXing Zheng 			RK3399_CLKSEL_CON(34), 8, 2, MFLAGS);
27411551005SXing Zheng 
27511551005SXing Zheng static struct rockchip_clk_branch rk3399_uart2_fracmux __initdata =
27611551005SXing Zheng 	MUX(SCLK_UART2, "clk_uart2", mux_uart2_p, CLK_SET_RATE_PARENT,
27711551005SXing Zheng 			RK3399_CLKSEL_CON(35), 8, 2, MFLAGS);
27811551005SXing Zheng 
27911551005SXing Zheng static struct rockchip_clk_branch rk3399_uart3_fracmux __initdata =
28011551005SXing Zheng 	MUX(SCLK_UART3, "clk_uart3", mux_uart3_p, CLK_SET_RATE_PARENT,
28111551005SXing Zheng 			RK3399_CLKSEL_CON(36), 8, 2, MFLAGS);
28211551005SXing Zheng 
28311551005SXing Zheng static struct rockchip_clk_branch rk3399_uart4_pmu_fracmux __initdata =
28411551005SXing Zheng 	MUX(SCLK_UART4_PMU, "clk_uart4_pmu", mux_uart4_pmu_p, CLK_SET_RATE_PARENT,
28511551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(5), 8, 2, MFLAGS);
28611551005SXing Zheng 
28711551005SXing Zheng static struct rockchip_clk_branch rk3399_dclk_vop0_fracmux __initdata =
28811551005SXing Zheng 	MUX(DCLK_VOP0, "dclk_vop0", mux_dclk_vop0_p, CLK_SET_RATE_PARENT,
28911551005SXing Zheng 			RK3399_CLKSEL_CON(49), 11, 1, MFLAGS);
29011551005SXing Zheng 
29111551005SXing Zheng static struct rockchip_clk_branch rk3399_dclk_vop1_fracmux __initdata =
29211551005SXing Zheng 	MUX(DCLK_VOP1, "dclk_vop1", mux_dclk_vop1_p, CLK_SET_RATE_PARENT,
29311551005SXing Zheng 			RK3399_CLKSEL_CON(50), 11, 1, MFLAGS);
29411551005SXing Zheng 
29511551005SXing Zheng static struct rockchip_clk_branch rk3399_pmuclk_wifi_fracmux __initdata =
29611551005SXing Zheng 	MUX(SCLK_WIFI_PMU, "clk_wifi_pmu", mux_wifi_pmu_p, CLK_SET_RATE_PARENT,
29711551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(1), 14, 1, MFLAGS);
29811551005SXing Zheng 
29911551005SXing Zheng static const struct rockchip_cpuclk_reg_data rk3399_cpuclkl_data = {
30011551005SXing Zheng 	.core_reg = RK3399_CLKSEL_CON(0),
30111551005SXing Zheng 	.div_core_shift = 0,
30211551005SXing Zheng 	.div_core_mask = 0x1f,
30311551005SXing Zheng 	.mux_core_alt = 3,
30411551005SXing Zheng 	.mux_core_main = 0,
30511551005SXing Zheng 	.mux_core_shift = 6,
30611551005SXing Zheng 	.mux_core_mask = 0x3,
30711551005SXing Zheng };
30811551005SXing Zheng 
30911551005SXing Zheng static const struct rockchip_cpuclk_reg_data rk3399_cpuclkb_data = {
31011551005SXing Zheng 	.core_reg = RK3399_CLKSEL_CON(2),
31111551005SXing Zheng 	.div_core_shift = 0,
31211551005SXing Zheng 	.div_core_mask = 0x1f,
31311551005SXing Zheng 	.mux_core_alt = 3,
31411551005SXing Zheng 	.mux_core_main = 1,
31511551005SXing Zheng 	.mux_core_shift = 6,
31611551005SXing Zheng 	.mux_core_mask = 0x3,
31711551005SXing Zheng };
31811551005SXing Zheng 
31911551005SXing Zheng #define RK3399_DIV_ACLKM_MASK		0x1f
32011551005SXing Zheng #define RK3399_DIV_ACLKM_SHIFT		8
32111551005SXing Zheng #define RK3399_DIV_ATCLK_MASK		0x1f
32211551005SXing Zheng #define RK3399_DIV_ATCLK_SHIFT		0
32311551005SXing Zheng #define RK3399_DIV_PCLK_DBG_MASK	0x1f
32411551005SXing Zheng #define RK3399_DIV_PCLK_DBG_SHIFT	8
32511551005SXing Zheng 
32611551005SXing Zheng #define RK3399_CLKSEL0(_offs, _aclkm)					\
32711551005SXing Zheng 	{								\
32811551005SXing Zheng 		.reg = RK3399_CLKSEL_CON(0 + _offs),			\
32911551005SXing Zheng 		.val = HIWORD_UPDATE(_aclkm, RK3399_DIV_ACLKM_MASK,	\
33011551005SXing Zheng 				RK3399_DIV_ACLKM_SHIFT),		\
33111551005SXing Zheng 	}
33211551005SXing Zheng #define RK3399_CLKSEL1(_offs, _atclk, _pdbg)				\
33311551005SXing Zheng 	{								\
33411551005SXing Zheng 		.reg = RK3399_CLKSEL_CON(1 + _offs),			\
33511551005SXing Zheng 		.val = HIWORD_UPDATE(_atclk, RK3399_DIV_ATCLK_MASK,	\
33611551005SXing Zheng 				RK3399_DIV_ATCLK_SHIFT) |		\
33711551005SXing Zheng 		       HIWORD_UPDATE(_pdbg, RK3399_DIV_PCLK_DBG_MASK,	\
33811551005SXing Zheng 				RK3399_DIV_PCLK_DBG_SHIFT),		\
33911551005SXing Zheng 	}
34011551005SXing Zheng 
34111551005SXing Zheng /* cluster_l: aclkm in clksel0, rest in clksel1 */
34211551005SXing Zheng #define RK3399_CPUCLKL_RATE(_prate, _aclkm, _atclk, _pdbg)		\
34311551005SXing Zheng 	{								\
34411551005SXing Zheng 		.prate = _prate##U,					\
34511551005SXing Zheng 		.divs = {						\
34611551005SXing Zheng 			RK3399_CLKSEL0(0, _aclkm),			\
34711551005SXing Zheng 			RK3399_CLKSEL1(0, _atclk, _pdbg),		\
34811551005SXing Zheng 		},							\
34911551005SXing Zheng 	}
35011551005SXing Zheng 
35111551005SXing Zheng /* cluster_b: aclkm in clksel2, rest in clksel3 */
35211551005SXing Zheng #define RK3399_CPUCLKB_RATE(_prate, _aclkm, _atclk, _pdbg)		\
35311551005SXing Zheng 	{								\
35411551005SXing Zheng 		.prate = _prate##U,					\
35511551005SXing Zheng 		.divs = {						\
35611551005SXing Zheng 			RK3399_CLKSEL0(2, _aclkm),			\
35711551005SXing Zheng 			RK3399_CLKSEL1(2, _atclk, _pdbg),		\
35811551005SXing Zheng 		},							\
35911551005SXing Zheng 	}
36011551005SXing Zheng 
36111551005SXing Zheng static struct rockchip_cpuclk_rate_table rk3399_cpuclkl_rates[] __initdata = {
36211551005SXing Zheng 	RK3399_CPUCLKL_RATE(1800000000, 1, 8, 8),
36311551005SXing Zheng 	RK3399_CPUCLKL_RATE(1704000000, 1, 8, 8),
36411551005SXing Zheng 	RK3399_CPUCLKL_RATE(1608000000, 1, 7, 7),
36511551005SXing Zheng 	RK3399_CPUCLKL_RATE(1512000000, 1, 7, 7),
36611551005SXing Zheng 	RK3399_CPUCLKL_RATE(1488000000, 1, 6, 6),
36711551005SXing Zheng 	RK3399_CPUCLKL_RATE(1416000000, 1, 6, 6),
36811551005SXing Zheng 	RK3399_CPUCLKL_RATE(1200000000, 1, 5, 5),
36911551005SXing Zheng 	RK3399_CPUCLKL_RATE(1008000000, 1, 5, 5),
37011551005SXing Zheng 	RK3399_CPUCLKL_RATE( 816000000, 1, 4, 4),
37111551005SXing Zheng 	RK3399_CPUCLKL_RATE( 696000000, 1, 3, 3),
37211551005SXing Zheng 	RK3399_CPUCLKL_RATE( 600000000, 1, 3, 3),
37311551005SXing Zheng 	RK3399_CPUCLKL_RATE( 408000000, 1, 2, 2),
37411551005SXing Zheng 	RK3399_CPUCLKL_RATE( 312000000, 1, 1, 1),
375aa2897ceSXing Zheng 	RK3399_CPUCLKL_RATE( 216000000, 1, 1, 1),
376aa2897ceSXing Zheng 	RK3399_CPUCLKL_RATE(  96000000, 1, 1, 1),
37711551005SXing Zheng };
37811551005SXing Zheng 
37911551005SXing Zheng static struct rockchip_cpuclk_rate_table rk3399_cpuclkb_rates[] __initdata = {
38011551005SXing Zheng 	RK3399_CPUCLKB_RATE(2208000000, 1, 11, 11),
38111551005SXing Zheng 	RK3399_CPUCLKB_RATE(2184000000, 1, 11, 11),
38211551005SXing Zheng 	RK3399_CPUCLKB_RATE(2088000000, 1, 10, 10),
38311551005SXing Zheng 	RK3399_CPUCLKB_RATE(2040000000, 1, 10, 10),
384fd75b345SShunqian Zheng 	RK3399_CPUCLKB_RATE(2016000000, 1, 9, 9),
38511551005SXing Zheng 	RK3399_CPUCLKB_RATE(1992000000, 1, 9, 9),
38611551005SXing Zheng 	RK3399_CPUCLKB_RATE(1896000000, 1, 9, 9),
38711551005SXing Zheng 	RK3399_CPUCLKB_RATE(1800000000, 1, 8, 8),
38811551005SXing Zheng 	RK3399_CPUCLKB_RATE(1704000000, 1, 8, 8),
38911551005SXing Zheng 	RK3399_CPUCLKB_RATE(1608000000, 1, 7, 7),
39011551005SXing Zheng 	RK3399_CPUCLKB_RATE(1512000000, 1, 7, 7),
39111551005SXing Zheng 	RK3399_CPUCLKB_RATE(1488000000, 1, 6, 6),
39211551005SXing Zheng 	RK3399_CPUCLKB_RATE(1416000000, 1, 6, 6),
39311551005SXing Zheng 	RK3399_CPUCLKB_RATE(1200000000, 1, 5, 5),
39411551005SXing Zheng 	RK3399_CPUCLKB_RATE(1008000000, 1, 5, 5),
39511551005SXing Zheng 	RK3399_CPUCLKB_RATE( 816000000, 1, 4, 4),
39611551005SXing Zheng 	RK3399_CPUCLKB_RATE( 696000000, 1, 3, 3),
39711551005SXing Zheng 	RK3399_CPUCLKB_RATE( 600000000, 1, 3, 3),
39811551005SXing Zheng 	RK3399_CPUCLKB_RATE( 408000000, 1, 2, 2),
39911551005SXing Zheng 	RK3399_CPUCLKB_RATE( 312000000, 1, 1, 1),
400aa2897ceSXing Zheng 	RK3399_CPUCLKB_RATE( 216000000, 1, 1, 1),
401aa2897ceSXing Zheng 	RK3399_CPUCLKB_RATE(  96000000, 1, 1, 1),
40211551005SXing Zheng };
40311551005SXing Zheng 
40411551005SXing Zheng static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {
40511551005SXing Zheng 	/*
40611551005SXing Zheng 	 * CRU Clock-Architecture
40711551005SXing Zheng 	 */
40811551005SXing Zheng 
40911551005SXing Zheng 	/* usbphy */
41011551005SXing Zheng 	GATE(SCLK_USB2PHY0_REF, "clk_usb2phy0_ref", "xin24m", CLK_IGNORE_UNUSED,
41111551005SXing Zheng 			RK3399_CLKGATE_CON(6), 5, GFLAGS),
41211551005SXing Zheng 	GATE(SCLK_USB2PHY1_REF, "clk_usb2phy1_ref", "xin24m", CLK_IGNORE_UNUSED,
41311551005SXing Zheng 			RK3399_CLKGATE_CON(6), 6, GFLAGS),
41411551005SXing Zheng 
415161baaeaSJianqun Xu 	GATE(0, "clk_usbphy0_480m_src", "clk_usbphy0_480m", 0,
41611551005SXing Zheng 			RK3399_CLKGATE_CON(13), 12, GFLAGS),
417161baaeaSJianqun Xu 	GATE(0, "clk_usbphy1_480m_src", "clk_usbphy1_480m", 0,
41811551005SXing Zheng 			RK3399_CLKGATE_CON(13), 12, GFLAGS),
419161baaeaSJianqun Xu 	MUX(0, "clk_usbphy_480m", mux_usbphy_480m_p, 0,
42011551005SXing Zheng 			RK3399_CLKSEL_CON(14), 6, 1, MFLAGS),
42111551005SXing Zheng 
42211551005SXing Zheng 	MUX(0, "upll", mux_pll_src_24m_usbphy480m_p, 0,
42311551005SXing Zheng 			RK3399_CLKSEL_CON(14), 15, 1, MFLAGS),
42411551005SXing Zheng 
42550961e83SXing Zheng 	COMPOSITE_NODIV(SCLK_HSICPHY, "clk_hsicphy", mux_pll_src_cpll_gpll_npll_usbphy480m_p, 0,
42611551005SXing Zheng 			RK3399_CLKSEL_CON(19), 0, 2, MFLAGS,
42711551005SXing Zheng 			RK3399_CLKGATE_CON(6), 4, GFLAGS),
42811551005SXing Zheng 
42950961e83SXing Zheng 	COMPOSITE(ACLK_USB3, "aclk_usb3", mux_pll_src_cpll_gpll_npll_p, 0,
43011551005SXing Zheng 			RK3399_CLKSEL_CON(39), 6, 2, MFLAGS, 0, 5, DFLAGS,
43111551005SXing Zheng 			RK3399_CLKGATE_CON(12), 0, GFLAGS),
43211551005SXing Zheng 	GATE(ACLK_USB3_NOC, "aclk_usb3_noc", "aclk_usb3", CLK_IGNORE_UNUSED,
43311551005SXing Zheng 			RK3399_CLKGATE_CON(30), 0, GFLAGS),
43450961e83SXing Zheng 	GATE(ACLK_USB3OTG0, "aclk_usb3otg0", "aclk_usb3", 0,
43511551005SXing Zheng 			RK3399_CLKGATE_CON(30), 1, GFLAGS),
43650961e83SXing Zheng 	GATE(ACLK_USB3OTG1, "aclk_usb3otg1", "aclk_usb3", 0,
43711551005SXing Zheng 			RK3399_CLKGATE_CON(30), 2, GFLAGS),
43850961e83SXing Zheng 	GATE(ACLK_USB3_RKSOC_AXI_PERF, "aclk_usb3_rksoc_axi_perf", "aclk_usb3", 0,
43911551005SXing Zheng 			RK3399_CLKGATE_CON(30), 3, GFLAGS),
44050961e83SXing Zheng 	GATE(ACLK_USB3_GRF, "aclk_usb3_grf", "aclk_usb3", 0,
44111551005SXing Zheng 			RK3399_CLKGATE_CON(30), 4, GFLAGS),
44211551005SXing Zheng 
44350961e83SXing Zheng 	GATE(SCLK_USB3OTG0_REF, "clk_usb3otg0_ref", "xin24m", 0,
44411551005SXing Zheng 			RK3399_CLKGATE_CON(12), 1, GFLAGS),
44550961e83SXing Zheng 	GATE(SCLK_USB3OTG1_REF, "clk_usb3otg1_ref", "xin24m", 0,
44611551005SXing Zheng 			RK3399_CLKGATE_CON(12), 2, GFLAGS),
44711551005SXing Zheng 
44850961e83SXing Zheng 	COMPOSITE(SCLK_USB3OTG0_SUSPEND, "clk_usb3otg0_suspend", mux_pll_p, 0,
44911551005SXing Zheng 			RK3399_CLKSEL_CON(40), 15, 1, MFLAGS, 0, 10, DFLAGS,
45011551005SXing Zheng 			RK3399_CLKGATE_CON(12), 3, GFLAGS),
45111551005SXing Zheng 
45250961e83SXing Zheng 	COMPOSITE(SCLK_USB3OTG1_SUSPEND, "clk_usb3otg1_suspend", mux_pll_p, 0,
45311551005SXing Zheng 			RK3399_CLKSEL_CON(41), 15, 1, MFLAGS, 0, 10, DFLAGS,
45411551005SXing Zheng 			RK3399_CLKGATE_CON(12), 4, GFLAGS),
45511551005SXing Zheng 
45650961e83SXing Zheng 	COMPOSITE(SCLK_UPHY0_TCPDPHY_REF, "clk_uphy0_tcpdphy_ref", mux_pll_p, 0,
45711551005SXing Zheng 			RK3399_CLKSEL_CON(64), 15, 1, MFLAGS, 8, 5, DFLAGS,
45811551005SXing Zheng 			RK3399_CLKGATE_CON(13), 4, GFLAGS),
45911551005SXing Zheng 
46050961e83SXing Zheng 	COMPOSITE(SCLK_UPHY0_TCPDCORE, "clk_uphy0_tcpdcore", mux_pll_src_24m_32k_cpll_gpll_p, 0,
46111551005SXing Zheng 			RK3399_CLKSEL_CON(64), 6, 2, MFLAGS, 0, 5, DFLAGS,
46211551005SXing Zheng 			RK3399_CLKGATE_CON(13), 5, GFLAGS),
46311551005SXing Zheng 
46450961e83SXing Zheng 	COMPOSITE(SCLK_UPHY1_TCPDPHY_REF, "clk_uphy1_tcpdphy_ref", mux_pll_p, 0,
46511551005SXing Zheng 			RK3399_CLKSEL_CON(65), 15, 1, MFLAGS, 8, 5, DFLAGS,
46611551005SXing Zheng 			RK3399_CLKGATE_CON(13), 6, GFLAGS),
46711551005SXing Zheng 
46850961e83SXing Zheng 	COMPOSITE(SCLK_UPHY1_TCPDCORE, "clk_uphy1_tcpdcore", mux_pll_src_24m_32k_cpll_gpll_p, 0,
46911551005SXing Zheng 			RK3399_CLKSEL_CON(65), 6, 2, MFLAGS, 0, 5, DFLAGS,
47011551005SXing Zheng 			RK3399_CLKGATE_CON(13), 7, GFLAGS),
47111551005SXing Zheng 
47211551005SXing Zheng 	/* little core */
47311551005SXing Zheng 	GATE(0, "clk_core_l_lpll_src", "lpll", CLK_IGNORE_UNUSED,
47411551005SXing Zheng 			RK3399_CLKGATE_CON(0), 0, GFLAGS),
47511551005SXing Zheng 	GATE(0, "clk_core_l_bpll_src", "bpll", CLK_IGNORE_UNUSED,
47611551005SXing Zheng 			RK3399_CLKGATE_CON(0), 1, GFLAGS),
47711551005SXing Zheng 	GATE(0, "clk_core_l_dpll_src", "dpll", CLK_IGNORE_UNUSED,
47811551005SXing Zheng 			RK3399_CLKGATE_CON(0), 2, GFLAGS),
47911551005SXing Zheng 	GATE(0, "clk_core_l_gpll_src", "gpll", CLK_IGNORE_UNUSED,
48011551005SXing Zheng 			RK3399_CLKGATE_CON(0), 3, GFLAGS),
48111551005SXing Zheng 
48211551005SXing Zheng 	COMPOSITE_NOMUX(0, "aclkm_core_l", "armclkl", CLK_IGNORE_UNUSED,
48311551005SXing Zheng 			RK3399_CLKSEL_CON(0), 8, 5, DFLAGS | CLK_DIVIDER_READ_ONLY,
48411551005SXing Zheng 			RK3399_CLKGATE_CON(0), 4, GFLAGS),
48511551005SXing Zheng 	COMPOSITE_NOMUX(0, "atclk_core_l", "armclkl", CLK_IGNORE_UNUSED,
48611551005SXing Zheng 			RK3399_CLKSEL_CON(1), 0, 5, DFLAGS | CLK_DIVIDER_READ_ONLY,
48711551005SXing Zheng 			RK3399_CLKGATE_CON(0), 5, GFLAGS),
48811551005SXing Zheng 	COMPOSITE_NOMUX(0, "pclk_dbg_core_l", "armclkl", CLK_IGNORE_UNUSED,
48911551005SXing Zheng 			RK3399_CLKSEL_CON(1), 8, 5, DFLAGS | CLK_DIVIDER_READ_ONLY,
49011551005SXing Zheng 			RK3399_CLKGATE_CON(0), 6, GFLAGS),
49111551005SXing Zheng 
49211551005SXing Zheng 	GATE(ACLK_CORE_ADB400_CORE_L_2_CCI500, "aclk_core_adb400_core_l_2_cci500", "aclkm_core_l", CLK_IGNORE_UNUSED,
49311551005SXing Zheng 			RK3399_CLKGATE_CON(14), 12, GFLAGS),
49411551005SXing Zheng 	GATE(ACLK_PERF_CORE_L, "aclk_perf_core_l", "aclkm_core_l", CLK_IGNORE_UNUSED,
49511551005SXing Zheng 			RK3399_CLKGATE_CON(14), 13, GFLAGS),
49611551005SXing Zheng 
49711551005SXing Zheng 	GATE(0, "clk_dbg_pd_core_l", "armclkl", CLK_IGNORE_UNUSED,
49811551005SXing Zheng 			RK3399_CLKGATE_CON(14), 9, GFLAGS),
49911551005SXing Zheng 	GATE(ACLK_GIC_ADB400_GIC_2_CORE_L, "aclk_core_adb400_gic_2_core_l", "armclkl", CLK_IGNORE_UNUSED,
50011551005SXing Zheng 			RK3399_CLKGATE_CON(14), 10, GFLAGS),
50111551005SXing Zheng 	GATE(ACLK_GIC_ADB400_CORE_L_2_GIC, "aclk_core_adb400_core_l_2_gic", "armclkl", CLK_IGNORE_UNUSED,
50211551005SXing Zheng 			RK3399_CLKGATE_CON(14), 11, GFLAGS),
503161baaeaSJianqun Xu 	GATE(SCLK_PVTM_CORE_L, "clk_pvtm_core_l", "xin24m", 0,
50411551005SXing Zheng 			RK3399_CLKGATE_CON(0), 7, GFLAGS),
50511551005SXing Zheng 
50611551005SXing Zheng 	/* big core */
50711551005SXing Zheng 	GATE(0, "clk_core_b_lpll_src", "lpll", CLK_IGNORE_UNUSED,
50811551005SXing Zheng 			RK3399_CLKGATE_CON(1), 0, GFLAGS),
50911551005SXing Zheng 	GATE(0, "clk_core_b_bpll_src", "bpll", CLK_IGNORE_UNUSED,
51011551005SXing Zheng 			RK3399_CLKGATE_CON(1), 1, GFLAGS),
51111551005SXing Zheng 	GATE(0, "clk_core_b_dpll_src", "dpll", CLK_IGNORE_UNUSED,
51211551005SXing Zheng 			RK3399_CLKGATE_CON(1), 2, GFLAGS),
51311551005SXing Zheng 	GATE(0, "clk_core_b_gpll_src", "gpll", CLK_IGNORE_UNUSED,
51411551005SXing Zheng 			RK3399_CLKGATE_CON(1), 3, GFLAGS),
51511551005SXing Zheng 
51611551005SXing Zheng 	COMPOSITE_NOMUX(0, "aclkm_core_b", "armclkb", CLK_IGNORE_UNUSED,
51711551005SXing Zheng 			RK3399_CLKSEL_CON(2), 8, 5, DFLAGS | CLK_DIVIDER_READ_ONLY,
51811551005SXing Zheng 			RK3399_CLKGATE_CON(1), 4, GFLAGS),
51911551005SXing Zheng 	COMPOSITE_NOMUX(0, "atclk_core_b", "armclkb", CLK_IGNORE_UNUSED,
52011551005SXing Zheng 			RK3399_CLKSEL_CON(3), 0, 5, DFLAGS | CLK_DIVIDER_READ_ONLY,
52111551005SXing Zheng 			RK3399_CLKGATE_CON(1), 5, GFLAGS),
52211551005SXing Zheng 	COMPOSITE_NOMUX(0, "pclk_dbg_core_b", "armclkb", CLK_IGNORE_UNUSED,
52311551005SXing Zheng 			RK3399_CLKSEL_CON(3), 8, 5, DFLAGS | CLK_DIVIDER_READ_ONLY,
52411551005SXing Zheng 			RK3399_CLKGATE_CON(1), 6, GFLAGS),
52511551005SXing Zheng 
52611551005SXing Zheng 	GATE(ACLK_CORE_ADB400_CORE_B_2_CCI500, "aclk_core_adb400_core_b_2_cci500", "aclkm_core_b", CLK_IGNORE_UNUSED,
52711551005SXing Zheng 			RK3399_CLKGATE_CON(14), 5, GFLAGS),
52811551005SXing Zheng 	GATE(ACLK_PERF_CORE_B, "aclk_perf_core_b", "aclkm_core_b", CLK_IGNORE_UNUSED,
52911551005SXing Zheng 			RK3399_CLKGATE_CON(14), 6, GFLAGS),
53011551005SXing Zheng 
53111551005SXing Zheng 	GATE(0, "clk_dbg_pd_core_b", "armclkb", CLK_IGNORE_UNUSED,
53211551005SXing Zheng 			RK3399_CLKGATE_CON(14), 1, GFLAGS),
53311551005SXing Zheng 	GATE(ACLK_GIC_ADB400_GIC_2_CORE_B, "aclk_core_adb400_gic_2_core_b", "armclkb", CLK_IGNORE_UNUSED,
53411551005SXing Zheng 			RK3399_CLKGATE_CON(14), 3, GFLAGS),
53511551005SXing Zheng 	GATE(ACLK_GIC_ADB400_CORE_B_2_GIC, "aclk_core_adb400_core_b_2_gic", "armclkb", CLK_IGNORE_UNUSED,
53611551005SXing Zheng 			RK3399_CLKGATE_CON(14), 4, GFLAGS),
53711551005SXing Zheng 
53811551005SXing Zheng 	DIV(0, "pclken_dbg_core_b", "pclk_dbg_core_b", CLK_IGNORE_UNUSED,
53911551005SXing Zheng 			RK3399_CLKSEL_CON(3), 13, 2, DFLAGS | CLK_DIVIDER_READ_ONLY),
54011551005SXing Zheng 
54111551005SXing Zheng 	GATE(0, "pclk_dbg_cxcs_pd_core_b", "pclk_dbg_core_b", CLK_IGNORE_UNUSED,
54211551005SXing Zheng 			RK3399_CLKGATE_CON(14), 2, GFLAGS),
54311551005SXing Zheng 
544161baaeaSJianqun Xu 	GATE(SCLK_PVTM_CORE_B, "clk_pvtm_core_b", "xin24m", 0,
54511551005SXing Zheng 			RK3399_CLKGATE_CON(1), 7, GFLAGS),
54611551005SXing Zheng 
54711551005SXing Zheng 	/* gmac */
54811551005SXing Zheng 	GATE(0, "cpll_aclk_gmac_src", "cpll", CLK_IGNORE_UNUSED,
54911551005SXing Zheng 			RK3399_CLKGATE_CON(6), 9, GFLAGS),
55011551005SXing Zheng 	GATE(0, "gpll_aclk_gmac_src", "gpll", CLK_IGNORE_UNUSED,
55111551005SXing Zheng 			RK3399_CLKGATE_CON(6), 8, GFLAGS),
55250961e83SXing Zheng 	COMPOSITE(0, "aclk_gmac_pre", mux_aclk_gmac_p, 0,
55311551005SXing Zheng 			RK3399_CLKSEL_CON(20), 7, 1, MFLAGS, 0, 5, DFLAGS,
55411551005SXing Zheng 			RK3399_CLKGATE_CON(6), 10, GFLAGS),
55511551005SXing Zheng 
55650961e83SXing Zheng 	GATE(ACLK_GMAC, "aclk_gmac", "aclk_gmac_pre", 0,
55711551005SXing Zheng 			RK3399_CLKGATE_CON(32), 0, GFLAGS),
55811551005SXing Zheng 	GATE(ACLK_GMAC_NOC, "aclk_gmac_noc", "aclk_gmac_pre", CLK_IGNORE_UNUSED,
55911551005SXing Zheng 			RK3399_CLKGATE_CON(32), 1, GFLAGS),
56050961e83SXing Zheng 	GATE(ACLK_PERF_GMAC, "aclk_perf_gmac", "aclk_gmac_pre", 0,
56111551005SXing Zheng 			RK3399_CLKGATE_CON(32), 4, GFLAGS),
56211551005SXing Zheng 
56311551005SXing Zheng 	COMPOSITE_NOMUX(0, "pclk_gmac_pre", "aclk_gmac_pre", 0,
56411551005SXing Zheng 			RK3399_CLKSEL_CON(19), 8, 3, DFLAGS,
56511551005SXing Zheng 			RK3399_CLKGATE_CON(6), 11, GFLAGS),
56650961e83SXing Zheng 	GATE(PCLK_GMAC, "pclk_gmac", "pclk_gmac_pre", 0,
56711551005SXing Zheng 			RK3399_CLKGATE_CON(32), 2, GFLAGS),
56811551005SXing Zheng 	GATE(PCLK_GMAC_NOC, "pclk_gmac_noc", "pclk_gmac_pre", CLK_IGNORE_UNUSED,
56911551005SXing Zheng 			RK3399_CLKGATE_CON(32), 3, GFLAGS),
57011551005SXing Zheng 
57150961e83SXing Zheng 	COMPOSITE(SCLK_MAC, "clk_gmac", mux_pll_src_cpll_gpll_npll_p, 0,
57211551005SXing Zheng 			RK3399_CLKSEL_CON(20), 14, 2, MFLAGS, 8, 5, DFLAGS,
57311551005SXing Zheng 			RK3399_CLKGATE_CON(5), 5, GFLAGS),
57411551005SXing Zheng 
5753f92a054SXing Zheng 	MUX(SCLK_RMII_SRC, "clk_rmii_src", mux_rmii_p, CLK_SET_RATE_PARENT,
57611551005SXing Zheng 			RK3399_CLKSEL_CON(19), 4, 1, MFLAGS),
57750961e83SXing Zheng 	GATE(SCLK_MACREF_OUT, "clk_mac_refout", "clk_rmii_src", 0,
57811551005SXing Zheng 			RK3399_CLKGATE_CON(5), 6, GFLAGS),
57950961e83SXing Zheng 	GATE(SCLK_MACREF, "clk_mac_ref", "clk_rmii_src", 0,
58011551005SXing Zheng 			RK3399_CLKGATE_CON(5), 7, GFLAGS),
58150961e83SXing Zheng 	GATE(SCLK_MAC_RX, "clk_rmii_rx", "clk_rmii_src", 0,
58211551005SXing Zheng 			RK3399_CLKGATE_CON(5), 8, GFLAGS),
58350961e83SXing Zheng 	GATE(SCLK_MAC_TX, "clk_rmii_tx", "clk_rmii_src", 0,
58411551005SXing Zheng 			RK3399_CLKGATE_CON(5), 9, GFLAGS),
58511551005SXing Zheng 
58611551005SXing Zheng 	/* spdif */
58750961e83SXing Zheng 	COMPOSITE(0, "clk_spdif_div", mux_pll_src_cpll_gpll_p, 0,
58811551005SXing Zheng 			RK3399_CLKSEL_CON(32), 7, 1, MFLAGS, 0, 7, DFLAGS,
58911551005SXing Zheng 			RK3399_CLKGATE_CON(8), 13, GFLAGS),
59029edeccbSDouglas Anderson 	COMPOSITE_FRACMUX(0, "clk_spdif_frac", "clk_spdif_div", 0,
59111551005SXing Zheng 			RK3399_CLKSEL_CON(99), 0,
59211551005SXing Zheng 			RK3399_CLKGATE_CON(8), 14, GFLAGS,
59311551005SXing Zheng 			&rk3399_spdif_fracmux),
59411551005SXing Zheng 	GATE(SCLK_SPDIF_8CH, "clk_spdif", "clk_spdif_mux", CLK_SET_RATE_PARENT,
59511551005SXing Zheng 			RK3399_CLKGATE_CON(8), 15, GFLAGS),
59611551005SXing Zheng 
59750961e83SXing Zheng 	COMPOSITE(SCLK_SPDIF_REC_DPTX, "clk_spdif_rec_dptx", mux_pll_src_cpll_gpll_p, 0,
5983770821fSXing Zheng 			RK3399_CLKSEL_CON(32), 15, 1, MFLAGS, 8, 5, DFLAGS,
59911551005SXing Zheng 			RK3399_CLKGATE_CON(10), 6, GFLAGS),
60011551005SXing Zheng 	/* i2s */
60150961e83SXing Zheng 	COMPOSITE(0, "clk_i2s0_div", mux_pll_src_cpll_gpll_p, 0,
60211551005SXing Zheng 			RK3399_CLKSEL_CON(28), 7, 1, MFLAGS, 0, 7, DFLAGS,
60311551005SXing Zheng 			RK3399_CLKGATE_CON(8), 3, GFLAGS),
60429edeccbSDouglas Anderson 	COMPOSITE_FRACMUX(0, "clk_i2s0_frac", "clk_i2s0_div", 0,
60511551005SXing Zheng 			RK3399_CLKSEL_CON(96), 0,
60611551005SXing Zheng 			RK3399_CLKGATE_CON(8), 4, GFLAGS,
60711551005SXing Zheng 			&rk3399_i2s0_fracmux),
60811551005SXing Zheng 	GATE(SCLK_I2S0_8CH, "clk_i2s0", "clk_i2s0_mux", CLK_SET_RATE_PARENT,
60911551005SXing Zheng 			RK3399_CLKGATE_CON(8), 5, GFLAGS),
61011551005SXing Zheng 
61150961e83SXing Zheng 	COMPOSITE(0, "clk_i2s1_div", mux_pll_src_cpll_gpll_p, 0,
61211551005SXing Zheng 			RK3399_CLKSEL_CON(29), 7, 1, MFLAGS, 0, 7, DFLAGS,
61311551005SXing Zheng 			RK3399_CLKGATE_CON(8), 6, GFLAGS),
61429edeccbSDouglas Anderson 	COMPOSITE_FRACMUX(0, "clk_i2s1_frac", "clk_i2s1_div", 0,
61511551005SXing Zheng 			RK3399_CLKSEL_CON(97), 0,
61611551005SXing Zheng 			RK3399_CLKGATE_CON(8), 7, GFLAGS,
61711551005SXing Zheng 			&rk3399_i2s1_fracmux),
61811551005SXing Zheng 	GATE(SCLK_I2S1_8CH, "clk_i2s1", "clk_i2s1_mux", CLK_SET_RATE_PARENT,
61911551005SXing Zheng 			RK3399_CLKGATE_CON(8), 8, GFLAGS),
62011551005SXing Zheng 
62150961e83SXing Zheng 	COMPOSITE(0, "clk_i2s2_div", mux_pll_src_cpll_gpll_p, 0,
62211551005SXing Zheng 			RK3399_CLKSEL_CON(30), 7, 1, MFLAGS, 0, 7, DFLAGS,
62311551005SXing Zheng 			RK3399_CLKGATE_CON(8), 9, GFLAGS),
62429edeccbSDouglas Anderson 	COMPOSITE_FRACMUX(0, "clk_i2s2_frac", "clk_i2s2_div", 0,
62511551005SXing Zheng 			RK3399_CLKSEL_CON(98), 0,
62611551005SXing Zheng 			RK3399_CLKGATE_CON(8), 10, GFLAGS,
62711551005SXing Zheng 			&rk3399_i2s2_fracmux),
62811551005SXing Zheng 	GATE(SCLK_I2S2_8CH, "clk_i2s2", "clk_i2s2_mux", CLK_SET_RATE_PARENT,
62911551005SXing Zheng 			RK3399_CLKGATE_CON(8), 11, GFLAGS),
63011551005SXing Zheng 
63111551005SXing Zheng 	MUX(0, "clk_i2sout_src", mux_i2sch_p, CLK_SET_RATE_PARENT,
63211551005SXing Zheng 			RK3399_CLKSEL_CON(31), 0, 2, MFLAGS),
63311551005SXing Zheng 	COMPOSITE_NODIV(SCLK_I2S_8CH_OUT, "clk_i2sout", mux_i2sout_p, CLK_SET_RATE_PARENT,
634a64ad008SAlberto Panizzo 			RK3399_CLKSEL_CON(31), 2, 1, MFLAGS,
63511551005SXing Zheng 			RK3399_CLKGATE_CON(8), 12, GFLAGS),
63611551005SXing Zheng 
63711551005SXing Zheng 	/* uart */
63811551005SXing Zheng 	MUX(0, "clk_uart0_src", mux_pll_src_cpll_gpll_upll_p, 0,
63911551005SXing Zheng 			RK3399_CLKSEL_CON(33), 12, 2, MFLAGS),
64011551005SXing Zheng 	COMPOSITE_NOMUX(0, "clk_uart0_div", "clk_uart0_src", 0,
64111551005SXing Zheng 			RK3399_CLKSEL_CON(33), 0, 7, DFLAGS,
64211551005SXing Zheng 			RK3399_CLKGATE_CON(9), 0, GFLAGS),
64329edeccbSDouglas Anderson 	COMPOSITE_FRACMUX(0, "clk_uart0_frac", "clk_uart0_div", 0,
64411551005SXing Zheng 			RK3399_CLKSEL_CON(100), 0,
64511551005SXing Zheng 			RK3399_CLKGATE_CON(9), 1, GFLAGS,
64611551005SXing Zheng 			&rk3399_uart0_fracmux),
64711551005SXing Zheng 
64811551005SXing Zheng 	MUX(0, "clk_uart_src", mux_pll_src_cpll_gpll_p, 0,
64911551005SXing Zheng 			RK3399_CLKSEL_CON(33), 15, 1, MFLAGS),
65011551005SXing Zheng 	COMPOSITE_NOMUX(0, "clk_uart1_div", "clk_uart_src", 0,
65111551005SXing Zheng 			RK3399_CLKSEL_CON(34), 0, 7, DFLAGS,
65211551005SXing Zheng 			RK3399_CLKGATE_CON(9), 2, GFLAGS),
65329edeccbSDouglas Anderson 	COMPOSITE_FRACMUX(0, "clk_uart1_frac", "clk_uart1_div", 0,
65411551005SXing Zheng 			RK3399_CLKSEL_CON(101), 0,
65511551005SXing Zheng 			RK3399_CLKGATE_CON(9), 3, GFLAGS,
65611551005SXing Zheng 			&rk3399_uart1_fracmux),
65711551005SXing Zheng 
65811551005SXing Zheng 	COMPOSITE_NOMUX(0, "clk_uart2_div", "clk_uart_src", 0,
65911551005SXing Zheng 			RK3399_CLKSEL_CON(35), 0, 7, DFLAGS,
66011551005SXing Zheng 			RK3399_CLKGATE_CON(9), 4, GFLAGS),
66129edeccbSDouglas Anderson 	COMPOSITE_FRACMUX(0, "clk_uart2_frac", "clk_uart2_div", 0,
66211551005SXing Zheng 			RK3399_CLKSEL_CON(102), 0,
66311551005SXing Zheng 			RK3399_CLKGATE_CON(9), 5, GFLAGS,
66411551005SXing Zheng 			&rk3399_uart2_fracmux),
66511551005SXing Zheng 
66611551005SXing Zheng 	COMPOSITE_NOMUX(0, "clk_uart3_div", "clk_uart_src", 0,
66711551005SXing Zheng 			RK3399_CLKSEL_CON(36), 0, 7, DFLAGS,
66811551005SXing Zheng 			RK3399_CLKGATE_CON(9), 6, GFLAGS),
66929edeccbSDouglas Anderson 	COMPOSITE_FRACMUX(0, "clk_uart3_frac", "clk_uart3_div", 0,
67011551005SXing Zheng 			RK3399_CLKSEL_CON(103), 0,
67111551005SXing Zheng 			RK3399_CLKGATE_CON(9), 7, GFLAGS,
67211551005SXing Zheng 			&rk3399_uart3_fracmux),
67311551005SXing Zheng 
6749dc486fdSLin Huang 	COMPOSITE(PCLK_DDR, "pclk_ddr", mux_pll_src_cpll_gpll_p, CLK_IGNORE_UNUSED,
67511551005SXing Zheng 			RK3399_CLKSEL_CON(6), 15, 1, MFLAGS, 8, 5, DFLAGS,
67611551005SXing Zheng 			RK3399_CLKGATE_CON(3), 4, GFLAGS),
67711551005SXing Zheng 
67811551005SXing Zheng 	GATE(PCLK_CENTER_MAIN_NOC, "pclk_center_main_noc", "pclk_ddr", CLK_IGNORE_UNUSED,
67911551005SXing Zheng 			RK3399_CLKGATE_CON(18), 10, GFLAGS),
680161baaeaSJianqun Xu 	GATE(PCLK_DDR_MON, "pclk_ddr_mon", "pclk_ddr", 0,
68111551005SXing Zheng 			RK3399_CLKGATE_CON(18), 12, GFLAGS),
68211551005SXing Zheng 	GATE(PCLK_CIC, "pclk_cic", "pclk_ddr", CLK_IGNORE_UNUSED,
68311551005SXing Zheng 			RK3399_CLKGATE_CON(18), 15, GFLAGS),
68411551005SXing Zheng 	GATE(PCLK_DDR_SGRF, "pclk_ddr_sgrf", "pclk_ddr", CLK_IGNORE_UNUSED,
68511551005SXing Zheng 			RK3399_CLKGATE_CON(19), 2, GFLAGS),
68611551005SXing Zheng 
687161baaeaSJianqun Xu 	GATE(SCLK_PVTM_DDR, "clk_pvtm_ddr", "xin24m", 0,
68811551005SXing Zheng 			RK3399_CLKGATE_CON(4), 11, GFLAGS),
689161baaeaSJianqun Xu 	GATE(SCLK_DFIMON0_TIMER, "clk_dfimon0_timer", "xin24m", 0,
69011551005SXing Zheng 			RK3399_CLKGATE_CON(3), 5, GFLAGS),
691161baaeaSJianqun Xu 	GATE(SCLK_DFIMON1_TIMER, "clk_dfimon1_timer", "xin24m", 0,
69211551005SXing Zheng 			RK3399_CLKGATE_CON(3), 6, GFLAGS),
69311551005SXing Zheng 
69411551005SXing Zheng 	/* cci */
69511551005SXing Zheng 	GATE(0, "cpll_aclk_cci_src", "cpll", CLK_IGNORE_UNUSED,
69611551005SXing Zheng 			RK3399_CLKGATE_CON(2), 0, GFLAGS),
69711551005SXing Zheng 	GATE(0, "gpll_aclk_cci_src", "gpll", CLK_IGNORE_UNUSED,
69811551005SXing Zheng 			RK3399_CLKGATE_CON(2), 1, GFLAGS),
69911551005SXing Zheng 	GATE(0, "npll_aclk_cci_src", "npll", CLK_IGNORE_UNUSED,
70011551005SXing Zheng 			RK3399_CLKGATE_CON(2), 2, GFLAGS),
70111551005SXing Zheng 	GATE(0, "vpll_aclk_cci_src", "vpll", CLK_IGNORE_UNUSED,
70211551005SXing Zheng 			RK3399_CLKGATE_CON(2), 3, GFLAGS),
70311551005SXing Zheng 
70411551005SXing Zheng 	COMPOSITE(0, "aclk_cci_pre", mux_aclk_cci_p, CLK_IGNORE_UNUSED,
70511551005SXing Zheng 			RK3399_CLKSEL_CON(5), 6, 2, MFLAGS, 0, 5, DFLAGS,
70611551005SXing Zheng 			RK3399_CLKGATE_CON(2), 4, GFLAGS),
70711551005SXing Zheng 
70811551005SXing Zheng 	GATE(ACLK_ADB400M_PD_CORE_L, "aclk_adb400m_pd_core_l", "aclk_cci_pre", CLK_IGNORE_UNUSED,
70911551005SXing Zheng 			RK3399_CLKGATE_CON(15), 0, GFLAGS),
71011551005SXing Zheng 	GATE(ACLK_ADB400M_PD_CORE_B, "aclk_adb400m_pd_core_b", "aclk_cci_pre", CLK_IGNORE_UNUSED,
71111551005SXing Zheng 			RK3399_CLKGATE_CON(15), 1, GFLAGS),
71211551005SXing Zheng 	GATE(ACLK_CCI, "aclk_cci", "aclk_cci_pre", CLK_IGNORE_UNUSED,
71311551005SXing Zheng 			RK3399_CLKGATE_CON(15), 2, GFLAGS),
71411551005SXing Zheng 	GATE(ACLK_CCI_NOC0, "aclk_cci_noc0", "aclk_cci_pre", CLK_IGNORE_UNUSED,
71511551005SXing Zheng 			RK3399_CLKGATE_CON(15), 3, GFLAGS),
71611551005SXing Zheng 	GATE(ACLK_CCI_NOC1, "aclk_cci_noc1", "aclk_cci_pre", CLK_IGNORE_UNUSED,
71711551005SXing Zheng 			RK3399_CLKGATE_CON(15), 4, GFLAGS),
71811551005SXing Zheng 	GATE(ACLK_CCI_GRF, "aclk_cci_grf", "aclk_cci_pre", CLK_IGNORE_UNUSED,
71911551005SXing Zheng 			RK3399_CLKGATE_CON(15), 7, GFLAGS),
72011551005SXing Zheng 
72111551005SXing Zheng 	GATE(0, "cpll_cci_trace", "cpll", CLK_IGNORE_UNUSED,
72211551005SXing Zheng 			RK3399_CLKGATE_CON(2), 5, GFLAGS),
72311551005SXing Zheng 	GATE(0, "gpll_cci_trace", "gpll", CLK_IGNORE_UNUSED,
72411551005SXing Zheng 			RK3399_CLKGATE_CON(2), 6, GFLAGS),
72511551005SXing Zheng 	COMPOSITE(SCLK_CCI_TRACE, "clk_cci_trace", mux_cci_trace_p, CLK_IGNORE_UNUSED,
72611551005SXing Zheng 			RK3399_CLKSEL_CON(5), 15, 2, MFLAGS, 8, 5, DFLAGS,
72711551005SXing Zheng 			RK3399_CLKGATE_CON(2), 7, GFLAGS),
72811551005SXing Zheng 
72911551005SXing Zheng 	GATE(0, "cpll_cs", "cpll", CLK_IGNORE_UNUSED,
73011551005SXing Zheng 			RK3399_CLKGATE_CON(2), 8, GFLAGS),
73111551005SXing Zheng 	GATE(0, "gpll_cs", "gpll", CLK_IGNORE_UNUSED,
73211551005SXing Zheng 			RK3399_CLKGATE_CON(2), 9, GFLAGS),
73311551005SXing Zheng 	GATE(0, "npll_cs", "npll", CLK_IGNORE_UNUSED,
73411551005SXing Zheng 			RK3399_CLKGATE_CON(2), 10, GFLAGS),
73511551005SXing Zheng 	COMPOSITE_NOGATE(0, "clk_cs", mux_cs_p, CLK_IGNORE_UNUSED,
73611551005SXing Zheng 			RK3399_CLKSEL_CON(4), 6, 2, MFLAGS, 0, 5, DFLAGS),
73711551005SXing Zheng 	GATE(0, "clk_dbg_cxcs", "clk_cs", CLK_IGNORE_UNUSED,
73811551005SXing Zheng 			RK3399_CLKGATE_CON(15), 5, GFLAGS),
73911551005SXing Zheng 	GATE(0, "clk_dbg_noc", "clk_cs", CLK_IGNORE_UNUSED,
74011551005SXing Zheng 			RK3399_CLKGATE_CON(15), 6, GFLAGS),
74111551005SXing Zheng 
74211551005SXing Zheng 	/* vcodec */
74311551005SXing Zheng 	COMPOSITE(0, "aclk_vcodec_pre", mux_pll_src_cpll_gpll_npll_ppll_p, 0,
74411551005SXing Zheng 			RK3399_CLKSEL_CON(7), 6, 2, MFLAGS, 0, 5, DFLAGS,
74511551005SXing Zheng 			RK3399_CLKGATE_CON(4), 0, GFLAGS),
74611551005SXing Zheng 	COMPOSITE_NOMUX(0, "hclk_vcodec_pre", "aclk_vcodec_pre", 0,
74711551005SXing Zheng 			RK3399_CLKSEL_CON(7), 8, 5, DFLAGS,
74811551005SXing Zheng 			RK3399_CLKGATE_CON(4), 1, GFLAGS),
74950961e83SXing Zheng 	GATE(HCLK_VCODEC, "hclk_vcodec", "hclk_vcodec_pre", 0,
75011551005SXing Zheng 			RK3399_CLKGATE_CON(17), 2, GFLAGS),
75111551005SXing Zheng 	GATE(0, "hclk_vcodec_noc", "hclk_vcodec_pre", CLK_IGNORE_UNUSED,
75211551005SXing Zheng 			RK3399_CLKGATE_CON(17), 3, GFLAGS),
75311551005SXing Zheng 
75450961e83SXing Zheng 	GATE(ACLK_VCODEC, "aclk_vcodec", "aclk_vcodec_pre", 0,
75511551005SXing Zheng 			RK3399_CLKGATE_CON(17), 0, GFLAGS),
75611551005SXing Zheng 	GATE(0, "aclk_vcodec_noc", "aclk_vcodec_pre", CLK_IGNORE_UNUSED,
75711551005SXing Zheng 			RK3399_CLKGATE_CON(17), 1, GFLAGS),
75811551005SXing Zheng 
75911551005SXing Zheng 	/* vdu */
76050961e83SXing Zheng 	COMPOSITE(SCLK_VDU_CORE, "clk_vdu_core", mux_pll_src_cpll_gpll_npll_p, 0,
76111551005SXing Zheng 			RK3399_CLKSEL_CON(9), 6, 2, MFLAGS, 0, 5, DFLAGS,
76211551005SXing Zheng 			RK3399_CLKGATE_CON(4), 4, GFLAGS),
76350961e83SXing Zheng 	COMPOSITE(SCLK_VDU_CA, "clk_vdu_ca", mux_pll_src_cpll_gpll_npll_p, 0,
76411551005SXing Zheng 			RK3399_CLKSEL_CON(9), 14, 2, MFLAGS, 8, 5, DFLAGS,
76511551005SXing Zheng 			RK3399_CLKGATE_CON(4), 5, GFLAGS),
76611551005SXing Zheng 
76711551005SXing Zheng 	COMPOSITE(0, "aclk_vdu_pre", mux_pll_src_cpll_gpll_npll_ppll_p, 0,
76811551005SXing Zheng 			RK3399_CLKSEL_CON(8), 6, 2, MFLAGS, 0, 5, DFLAGS,
76911551005SXing Zheng 			RK3399_CLKGATE_CON(4), 2, GFLAGS),
77011551005SXing Zheng 	COMPOSITE_NOMUX(0, "hclk_vdu_pre", "aclk_vdu_pre", 0,
77111551005SXing Zheng 			RK3399_CLKSEL_CON(8), 8, 5, DFLAGS,
77211551005SXing Zheng 			RK3399_CLKGATE_CON(4), 3, GFLAGS),
77350961e83SXing Zheng 	GATE(HCLK_VDU, "hclk_vdu", "hclk_vdu_pre", 0,
77411551005SXing Zheng 			RK3399_CLKGATE_CON(17), 10, GFLAGS),
77511551005SXing Zheng 	GATE(HCLK_VDU_NOC, "hclk_vdu_noc", "hclk_vdu_pre", CLK_IGNORE_UNUSED,
77611551005SXing Zheng 			RK3399_CLKGATE_CON(17), 11, GFLAGS),
77711551005SXing Zheng 
77850961e83SXing Zheng 	GATE(ACLK_VDU, "aclk_vdu", "aclk_vdu_pre", 0,
77911551005SXing Zheng 			RK3399_CLKGATE_CON(17), 8, GFLAGS),
78011551005SXing Zheng 	GATE(ACLK_VDU_NOC, "aclk_vdu_noc", "aclk_vdu_pre", CLK_IGNORE_UNUSED,
78111551005SXing Zheng 			RK3399_CLKGATE_CON(17), 9, GFLAGS),
78211551005SXing Zheng 
78311551005SXing Zheng 	/* iep */
78450961e83SXing Zheng 	COMPOSITE(0, "aclk_iep_pre", mux_pll_src_cpll_gpll_npll_ppll_p, 0,
78511551005SXing Zheng 			RK3399_CLKSEL_CON(10), 6, 2, MFLAGS, 0, 5, DFLAGS,
78611551005SXing Zheng 			RK3399_CLKGATE_CON(4), 6, GFLAGS),
78711551005SXing Zheng 	COMPOSITE_NOMUX(0, "hclk_iep_pre", "aclk_iep_pre", 0,
78811551005SXing Zheng 			RK3399_CLKSEL_CON(10), 8, 5, DFLAGS,
78911551005SXing Zheng 			RK3399_CLKGATE_CON(4), 7, GFLAGS),
79050961e83SXing Zheng 	GATE(HCLK_IEP, "hclk_iep", "hclk_iep_pre", 0,
79111551005SXing Zheng 			RK3399_CLKGATE_CON(16), 2, GFLAGS),
79211551005SXing Zheng 	GATE(HCLK_IEP_NOC, "hclk_iep_noc", "hclk_iep_pre", CLK_IGNORE_UNUSED,
79311551005SXing Zheng 			RK3399_CLKGATE_CON(16), 3, GFLAGS),
79411551005SXing Zheng 
79550961e83SXing Zheng 	GATE(ACLK_IEP, "aclk_iep", "aclk_iep_pre", 0,
79611551005SXing Zheng 			RK3399_CLKGATE_CON(16), 0, GFLAGS),
79711551005SXing Zheng 	GATE(ACLK_IEP_NOC, "aclk_iep_noc", "aclk_iep_pre", CLK_IGNORE_UNUSED,
79811551005SXing Zheng 			RK3399_CLKGATE_CON(16), 1, GFLAGS),
79911551005SXing Zheng 
80011551005SXing Zheng 	/* rga */
80150961e83SXing Zheng 	COMPOSITE(SCLK_RGA_CORE, "clk_rga_core", mux_pll_src_cpll_gpll_npll_ppll_p, 0,
80211551005SXing Zheng 			RK3399_CLKSEL_CON(12), 6, 2, MFLAGS, 0, 5, DFLAGS,
80311551005SXing Zheng 			RK3399_CLKGATE_CON(4), 10, GFLAGS),
80411551005SXing Zheng 
80550961e83SXing Zheng 	COMPOSITE(0, "aclk_rga_pre", mux_pll_src_cpll_gpll_npll_ppll_p, 0,
80611551005SXing Zheng 			RK3399_CLKSEL_CON(11), 6, 2, MFLAGS, 0, 5, DFLAGS,
80711551005SXing Zheng 			RK3399_CLKGATE_CON(4), 8, GFLAGS),
80811551005SXing Zheng 	COMPOSITE_NOMUX(0, "hclk_rga_pre", "aclk_rga_pre", 0,
80911551005SXing Zheng 			RK3399_CLKSEL_CON(11), 8, 5, DFLAGS,
81011551005SXing Zheng 			RK3399_CLKGATE_CON(4), 9, GFLAGS),
81150961e83SXing Zheng 	GATE(HCLK_RGA, "hclk_rga", "hclk_rga_pre", 0,
81211551005SXing Zheng 			RK3399_CLKGATE_CON(16), 10, GFLAGS),
81311551005SXing Zheng 	GATE(HCLK_RGA_NOC, "hclk_rga_noc", "hclk_rga_pre", CLK_IGNORE_UNUSED,
81411551005SXing Zheng 			RK3399_CLKGATE_CON(16), 11, GFLAGS),
81511551005SXing Zheng 
81650961e83SXing Zheng 	GATE(ACLK_RGA, "aclk_rga", "aclk_rga_pre", 0,
81711551005SXing Zheng 			RK3399_CLKGATE_CON(16), 8, GFLAGS),
81811551005SXing Zheng 	GATE(ACLK_RGA_NOC, "aclk_rga_noc", "aclk_rga_pre", CLK_IGNORE_UNUSED,
81911551005SXing Zheng 			RK3399_CLKGATE_CON(16), 9, GFLAGS),
82011551005SXing Zheng 
82111551005SXing Zheng 	/* center */
82211551005SXing Zheng 	COMPOSITE(0, "aclk_center", mux_pll_src_cpll_gpll_npll_p, CLK_IGNORE_UNUSED,
82311551005SXing Zheng 			RK3399_CLKSEL_CON(12), 14, 2, MFLAGS, 8, 5, DFLAGS,
82411551005SXing Zheng 			RK3399_CLKGATE_CON(3), 7, GFLAGS),
82511551005SXing Zheng 	GATE(ACLK_CENTER_MAIN_NOC, "aclk_center_main_noc", "aclk_center", CLK_IGNORE_UNUSED,
82611551005SXing Zheng 			RK3399_CLKGATE_CON(19), 0, GFLAGS),
82711551005SXing Zheng 	GATE(ACLK_CENTER_PERI_NOC, "aclk_center_peri_noc", "aclk_center", CLK_IGNORE_UNUSED,
82811551005SXing Zheng 			RK3399_CLKGATE_CON(19), 1, GFLAGS),
82911551005SXing Zheng 
83011551005SXing Zheng 	/* gpu */
83111551005SXing Zheng 	COMPOSITE(0, "aclk_gpu_pre", mux_pll_src_ppll_cpll_gpll_npll_p, CLK_IGNORE_UNUSED,
83211551005SXing Zheng 			RK3399_CLKSEL_CON(13), 5, 3, MFLAGS, 0, 5, DFLAGS,
83311551005SXing Zheng 			RK3399_CLKGATE_CON(13), 0, GFLAGS),
83450961e83SXing Zheng 	GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_pre", 0,
83511551005SXing Zheng 			RK3399_CLKGATE_CON(30), 8, GFLAGS),
83650961e83SXing Zheng 	GATE(ACLK_PERF_GPU, "aclk_perf_gpu", "aclk_gpu_pre", 0,
83711551005SXing Zheng 			RK3399_CLKGATE_CON(30), 10, GFLAGS),
83850961e83SXing Zheng 	GATE(ACLK_GPU_GRF, "aclk_gpu_grf", "aclk_gpu_pre", 0,
83911551005SXing Zheng 			RK3399_CLKGATE_CON(30), 11, GFLAGS),
84050961e83SXing Zheng 	GATE(SCLK_PVTM_GPU, "aclk_pvtm_gpu", "xin24m", 0,
84111551005SXing Zheng 			RK3399_CLKGATE_CON(13), 1, GFLAGS),
84211551005SXing Zheng 
84311551005SXing Zheng 	/* perihp */
8443bd14ae9SXing Zheng 	GATE(0, "cpll_aclk_perihp_src", "cpll", CLK_IGNORE_UNUSED,
84511551005SXing Zheng 			RK3399_CLKGATE_CON(5), 1, GFLAGS),
8464608d96fSXing Zheng 	GATE(0, "gpll_aclk_perihp_src", "gpll", CLK_IGNORE_UNUSED,
8474608d96fSXing Zheng 			RK3399_CLKGATE_CON(5), 0, GFLAGS),
84811551005SXing Zheng 	COMPOSITE(ACLK_PERIHP, "aclk_perihp", mux_aclk_perihp_p, CLK_IGNORE_UNUSED,
84911551005SXing Zheng 			RK3399_CLKSEL_CON(14), 7, 1, MFLAGS, 0, 5, DFLAGS,
85011551005SXing Zheng 			RK3399_CLKGATE_CON(5), 2, GFLAGS),
85111551005SXing Zheng 	COMPOSITE_NOMUX(HCLK_PERIHP, "hclk_perihp", "aclk_perihp", CLK_IGNORE_UNUSED,
85211551005SXing Zheng 			RK3399_CLKSEL_CON(14), 8, 2, DFLAGS,
85311551005SXing Zheng 			RK3399_CLKGATE_CON(5), 3, GFLAGS),
85411551005SXing Zheng 	COMPOSITE_NOMUX(PCLK_PERIHP, "pclk_perihp", "aclk_perihp", CLK_IGNORE_UNUSED,
85511551005SXing Zheng 			RK3399_CLKSEL_CON(14), 12, 2, DFLAGS,
85611551005SXing Zheng 			RK3399_CLKGATE_CON(5), 4, GFLAGS),
85711551005SXing Zheng 
8584f4e0491SElaine Zhang 	GATE(ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", 0,
85911551005SXing Zheng 			RK3399_CLKGATE_CON(20), 2, GFLAGS),
8604f4e0491SElaine Zhang 	GATE(ACLK_PCIE, "aclk_pcie", "aclk_perihp", 0,
86111551005SXing Zheng 			RK3399_CLKGATE_CON(20), 10, GFLAGS),
86211551005SXing Zheng 	GATE(0, "aclk_perihp_noc", "aclk_perihp", CLK_IGNORE_UNUSED,
86311551005SXing Zheng 			RK3399_CLKGATE_CON(20), 12, GFLAGS),
86411551005SXing Zheng 
86550961e83SXing Zheng 	GATE(HCLK_HOST0, "hclk_host0", "hclk_perihp", 0,
86611551005SXing Zheng 			RK3399_CLKGATE_CON(20), 5, GFLAGS),
86750961e83SXing Zheng 	GATE(HCLK_HOST0_ARB, "hclk_host0_arb", "hclk_perihp", 0,
86811551005SXing Zheng 			RK3399_CLKGATE_CON(20), 6, GFLAGS),
86950961e83SXing Zheng 	GATE(HCLK_HOST1, "hclk_host1", "hclk_perihp", 0,
87011551005SXing Zheng 			RK3399_CLKGATE_CON(20), 7, GFLAGS),
87150961e83SXing Zheng 	GATE(HCLK_HOST1_ARB, "hclk_host1_arb", "hclk_perihp", 0,
87211551005SXing Zheng 			RK3399_CLKGATE_CON(20), 8, GFLAGS),
87350961e83SXing Zheng 	GATE(HCLK_HSIC, "hclk_hsic", "hclk_perihp", 0,
87411551005SXing Zheng 			RK3399_CLKGATE_CON(20), 9, GFLAGS),
87511551005SXing Zheng 	GATE(0, "hclk_perihp_noc", "hclk_perihp", CLK_IGNORE_UNUSED,
87611551005SXing Zheng 			RK3399_CLKGATE_CON(20), 13, GFLAGS),
87711551005SXing Zheng 	GATE(0, "hclk_ahb1tom", "hclk_perihp", CLK_IGNORE_UNUSED,
87811551005SXing Zheng 			RK3399_CLKGATE_CON(20), 15, GFLAGS),
87911551005SXing Zheng 
88011551005SXing Zheng 	GATE(PCLK_PERIHP_GRF, "pclk_perihp_grf", "pclk_perihp", CLK_IGNORE_UNUSED,
88111551005SXing Zheng 			RK3399_CLKGATE_CON(20), 4, GFLAGS),
88250961e83SXing Zheng 	GATE(PCLK_PCIE, "pclk_pcie", "pclk_perihp", 0,
88311551005SXing Zheng 			RK3399_CLKGATE_CON(20), 11, GFLAGS),
88411551005SXing Zheng 	GATE(0, "pclk_perihp_noc", "pclk_perihp", CLK_IGNORE_UNUSED,
88511551005SXing Zheng 			RK3399_CLKGATE_CON(20), 14, GFLAGS),
88650961e83SXing Zheng 	GATE(PCLK_HSICPHY, "pclk_hsicphy", "pclk_perihp", 0,
88711551005SXing Zheng 			RK3399_CLKGATE_CON(31), 8, GFLAGS),
88811551005SXing Zheng 
88911551005SXing Zheng 	/* sdio & sdmmc */
8909dc486fdSLin Huang 	COMPOSITE(HCLK_SD, "hclk_sd", mux_pll_src_cpll_gpll_p, 0,
89111551005SXing Zheng 			RK3399_CLKSEL_CON(13), 15, 1, MFLAGS, 8, 5, DFLAGS,
89211551005SXing Zheng 			RK3399_CLKGATE_CON(12), 13, GFLAGS),
89350961e83SXing Zheng 	GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_sd", 0,
89411551005SXing Zheng 			RK3399_CLKGATE_CON(33), 8, GFLAGS),
89511551005SXing Zheng 	GATE(0, "hclk_sdmmc_noc", "hclk_sd", CLK_IGNORE_UNUSED,
89611551005SXing Zheng 			RK3399_CLKGATE_CON(33), 9, GFLAGS),
89711551005SXing Zheng 
89850961e83SXing Zheng 	COMPOSITE(SCLK_SDIO, "clk_sdio", mux_pll_src_cpll_gpll_npll_ppll_upll_24m_p, 0,
89911551005SXing Zheng 			RK3399_CLKSEL_CON(15), 8, 3, MFLAGS, 0, 7, DFLAGS,
90011551005SXing Zheng 			RK3399_CLKGATE_CON(6), 0, GFLAGS),
90111551005SXing Zheng 
90250961e83SXing Zheng 	COMPOSITE(SCLK_SDMMC, "clk_sdmmc", mux_pll_src_cpll_gpll_npll_ppll_upll_24m_p, 0,
90311551005SXing Zheng 			RK3399_CLKSEL_CON(16), 8, 3, MFLAGS, 0, 7, DFLAGS,
90411551005SXing Zheng 			RK3399_CLKGATE_CON(6), 1, GFLAGS),
90511551005SXing Zheng 
90684752e8dSDouglas Anderson 	MMC(SCLK_SDMMC_DRV,     "sdmmc_drv",    "clk_sdmmc", RK3399_SDMMC_CON0, 1),
90784752e8dSDouglas Anderson 	MMC(SCLK_SDMMC_SAMPLE,  "sdmmc_sample", "clk_sdmmc", RK3399_SDMMC_CON1, 1),
90811551005SXing Zheng 
90911551005SXing Zheng 	MMC(SCLK_SDIO_DRV,      "sdio_drv",    "clk_sdio",  RK3399_SDIO_CON0,  1),
91011551005SXing Zheng 	MMC(SCLK_SDIO_SAMPLE,   "sdio_sample", "clk_sdio",  RK3399_SDIO_CON1,  1),
91111551005SXing Zheng 
91211551005SXing Zheng 	/* pcie */
91350961e83SXing Zheng 	COMPOSITE(SCLK_PCIE_PM, "clk_pcie_pm", mux_pll_src_cpll_gpll_npll_24m_p, 0,
91411551005SXing Zheng 			RK3399_CLKSEL_CON(17), 8, 3, MFLAGS, 0, 7, DFLAGS,
91511551005SXing Zheng 			RK3399_CLKGATE_CON(6), 2, GFLAGS),
91611551005SXing Zheng 
91750961e83SXing Zheng 	COMPOSITE_NOMUX(SCLK_PCIEPHY_REF100M, "clk_pciephy_ref100m", "npll", 0,
91811551005SXing Zheng 			RK3399_CLKSEL_CON(18), 11, 5, DFLAGS,
91911551005SXing Zheng 			RK3399_CLKGATE_CON(12), 6, GFLAGS),
92011551005SXing Zheng 	MUX(SCLK_PCIEPHY_REF, "clk_pciephy_ref", mux_pll_src_24m_pciephy_p, CLK_SET_RATE_PARENT,
92111551005SXing Zheng 			RK3399_CLKSEL_CON(18), 10, 1, MFLAGS),
92211551005SXing Zheng 
92350961e83SXing Zheng 	COMPOSITE(0, "clk_pcie_core_cru", mux_pll_src_cpll_gpll_npll_p, 0,
92411551005SXing Zheng 			RK3399_CLKSEL_CON(18), 8, 2, MFLAGS, 0, 7, DFLAGS,
92511551005SXing Zheng 			RK3399_CLKGATE_CON(6), 3, GFLAGS),
92611551005SXing Zheng 	MUX(SCLK_PCIE_CORE, "clk_pcie_core", mux_pciecore_cru_phy_p, CLK_SET_RATE_PARENT,
92711551005SXing Zheng 			RK3399_CLKSEL_CON(18), 7, 1, MFLAGS),
92811551005SXing Zheng 
92911551005SXing Zheng 	/* emmc */
93050961e83SXing Zheng 	COMPOSITE(SCLK_EMMC, "clk_emmc", mux_pll_src_cpll_gpll_npll_upll_24m_p, 0,
93111551005SXing Zheng 			RK3399_CLKSEL_CON(22), 8, 3, MFLAGS, 0, 7, DFLAGS,
93211551005SXing Zheng 			RK3399_CLKGATE_CON(6), 14, GFLAGS),
93311551005SXing Zheng 
93411551005SXing Zheng 	GATE(0, "cpll_aclk_emmc_src", "cpll", CLK_IGNORE_UNUSED,
93511551005SXing Zheng 			RK3399_CLKGATE_CON(6), 13, GFLAGS),
93620c389e6SXing Zheng 	GATE(0, "gpll_aclk_emmc_src", "gpll", CLK_IGNORE_UNUSED,
93720c389e6SXing Zheng 			RK3399_CLKGATE_CON(6), 12, GFLAGS),
93811551005SXing Zheng 	COMPOSITE_NOGATE(ACLK_EMMC, "aclk_emmc", mux_aclk_emmc_p, CLK_IGNORE_UNUSED,
93911551005SXing Zheng 			RK3399_CLKSEL_CON(21), 7, 1, MFLAGS, 0, 5, DFLAGS),
94011551005SXing Zheng 	GATE(ACLK_EMMC_CORE, "aclk_emmccore", "aclk_emmc", CLK_IGNORE_UNUSED,
94111551005SXing Zheng 			RK3399_CLKGATE_CON(32), 8, GFLAGS),
94211551005SXing Zheng 	GATE(ACLK_EMMC_NOC, "aclk_emmc_noc", "aclk_emmc", CLK_IGNORE_UNUSED,
94311551005SXing Zheng 			RK3399_CLKGATE_CON(32), 9, GFLAGS),
94411551005SXing Zheng 	GATE(ACLK_EMMC_GRF, "aclk_emmcgrf", "aclk_emmc", CLK_IGNORE_UNUSED,
94511551005SXing Zheng 			RK3399_CLKGATE_CON(32), 10, GFLAGS),
94611551005SXing Zheng 
94711551005SXing Zheng 	/* perilp0 */
94811551005SXing Zheng 	GATE(0, "cpll_aclk_perilp0_src", "cpll", CLK_IGNORE_UNUSED,
94911551005SXing Zheng 			RK3399_CLKGATE_CON(7), 1, GFLAGS),
95011551005SXing Zheng 	GATE(0, "gpll_aclk_perilp0_src", "gpll", CLK_IGNORE_UNUSED,
95111551005SXing Zheng 			RK3399_CLKGATE_CON(7), 0, GFLAGS),
95211551005SXing Zheng 	COMPOSITE(ACLK_PERILP0, "aclk_perilp0", mux_aclk_perilp0_p, CLK_IGNORE_UNUSED,
95311551005SXing Zheng 			RK3399_CLKSEL_CON(23), 7, 1, MFLAGS, 0, 5, DFLAGS,
95411551005SXing Zheng 			RK3399_CLKGATE_CON(7), 2, GFLAGS),
95511551005SXing Zheng 	COMPOSITE_NOMUX(HCLK_PERILP0, "hclk_perilp0", "aclk_perilp0", CLK_IGNORE_UNUSED,
95611551005SXing Zheng 			RK3399_CLKSEL_CON(23), 8, 2, DFLAGS,
95711551005SXing Zheng 			RK3399_CLKGATE_CON(7), 3, GFLAGS),
95811551005SXing Zheng 	COMPOSITE_NOMUX(PCLK_PERILP0, "pclk_perilp0", "aclk_perilp0", 0,
95911551005SXing Zheng 			RK3399_CLKSEL_CON(23), 12, 3, DFLAGS,
96011551005SXing Zheng 			RK3399_CLKGATE_CON(7), 4, GFLAGS),
96111551005SXing Zheng 
96211551005SXing Zheng 	/* aclk_perilp0 gates */
96311551005SXing Zheng 	GATE(ACLK_INTMEM, "aclk_intmem", "aclk_perilp0", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(23), 0, GFLAGS),
96411551005SXing Zheng 	GATE(ACLK_TZMA, "aclk_tzma", "aclk_perilp0", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(23), 1, GFLAGS),
96511551005SXing Zheng 	GATE(SCLK_INTMEM0, "clk_intmem0", "aclk_perilp0", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(23), 2, GFLAGS),
96611551005SXing Zheng 	GATE(SCLK_INTMEM1, "clk_intmem1", "aclk_perilp0", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(23), 3, GFLAGS),
96711551005SXing Zheng 	GATE(SCLK_INTMEM2, "clk_intmem2", "aclk_perilp0", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(23), 4, GFLAGS),
96811551005SXing Zheng 	GATE(SCLK_INTMEM3, "clk_intmem3", "aclk_perilp0", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(23), 5, GFLAGS),
96911551005SXing Zheng 	GATE(SCLK_INTMEM4, "clk_intmem4", "aclk_perilp0", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(23), 6, GFLAGS),
97011551005SXing Zheng 	GATE(SCLK_INTMEM5, "clk_intmem5", "aclk_perilp0", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(23), 7, GFLAGS),
971161baaeaSJianqun Xu 	GATE(ACLK_DCF, "aclk_dcf", "aclk_perilp0", 0, RK3399_CLKGATE_CON(23), 8, GFLAGS),
97211551005SXing Zheng 	GATE(ACLK_DMAC0_PERILP, "aclk_dmac0_perilp", "aclk_perilp0", 0, RK3399_CLKGATE_CON(25), 5, GFLAGS),
97311551005SXing Zheng 	GATE(ACLK_DMAC1_PERILP, "aclk_dmac1_perilp", "aclk_perilp0", 0, RK3399_CLKGATE_CON(25), 6, GFLAGS),
97450961e83SXing Zheng 	GATE(ACLK_PERILP0_NOC, "aclk_perilp0_noc", "aclk_perilp0", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(25), 7, GFLAGS),
97511551005SXing Zheng 
97611551005SXing Zheng 	/* hclk_perilp0 gates */
97711551005SXing Zheng 	GATE(HCLK_ROM, "hclk_rom", "hclk_perilp0", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(24), 4, GFLAGS),
97850961e83SXing Zheng 	GATE(HCLK_M_CRYPTO0, "hclk_m_crypto0", "hclk_perilp0", 0, RK3399_CLKGATE_CON(24), 5, GFLAGS),
97950961e83SXing Zheng 	GATE(HCLK_S_CRYPTO0, "hclk_s_crypto0", "hclk_perilp0", 0, RK3399_CLKGATE_CON(24), 6, GFLAGS),
98050961e83SXing Zheng 	GATE(HCLK_M_CRYPTO1, "hclk_m_crypto1", "hclk_perilp0", 0, RK3399_CLKGATE_CON(24), 14, GFLAGS),
98150961e83SXing Zheng 	GATE(HCLK_S_CRYPTO1, "hclk_s_crypto1", "hclk_perilp0", 0, RK3399_CLKGATE_CON(24), 15, GFLAGS),
98211551005SXing Zheng 	GATE(HCLK_PERILP0_NOC, "hclk_perilp0_noc", "hclk_perilp0", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(25), 8, GFLAGS),
98311551005SXing Zheng 
98411551005SXing Zheng 	/* pclk_perilp0 gates */
985161baaeaSJianqun Xu 	GATE(PCLK_DCF, "pclk_dcf", "pclk_perilp0", 0, RK3399_CLKGATE_CON(23), 9, GFLAGS),
98611551005SXing Zheng 
98711551005SXing Zheng 	/* crypto */
98850961e83SXing Zheng 	COMPOSITE(SCLK_CRYPTO0, "clk_crypto0", mux_pll_src_cpll_gpll_ppll_p, 0,
98911551005SXing Zheng 			RK3399_CLKSEL_CON(24), 6, 2, MFLAGS, 0, 5, DFLAGS,
99011551005SXing Zheng 			RK3399_CLKGATE_CON(7), 7, GFLAGS),
99111551005SXing Zheng 
99250961e83SXing Zheng 	COMPOSITE(SCLK_CRYPTO1, "clk_crypto1", mux_pll_src_cpll_gpll_ppll_p, 0,
99311551005SXing Zheng 			RK3399_CLKSEL_CON(26), 6, 2, MFLAGS, 0, 5, DFLAGS,
99411551005SXing Zheng 			RK3399_CLKGATE_CON(7), 8, GFLAGS),
99511551005SXing Zheng 
99611551005SXing Zheng 	/* cm0s_perilp */
99750961e83SXing Zheng 	GATE(0, "cpll_fclk_cm0s_src", "cpll", 0,
99811551005SXing Zheng 			RK3399_CLKGATE_CON(7), 6, GFLAGS),
99950961e83SXing Zheng 	GATE(0, "gpll_fclk_cm0s_src", "gpll", 0,
100011551005SXing Zheng 			RK3399_CLKGATE_CON(7), 5, GFLAGS),
100150961e83SXing Zheng 	COMPOSITE(FCLK_CM0S, "fclk_cm0s", mux_fclk_cm0s_p, 0,
100211551005SXing Zheng 			RK3399_CLKSEL_CON(24), 15, 1, MFLAGS, 8, 5, DFLAGS,
100311551005SXing Zheng 			RK3399_CLKGATE_CON(7), 9, GFLAGS),
100411551005SXing Zheng 
100511551005SXing Zheng 	/* fclk_cm0s gates */
100650961e83SXing Zheng 	GATE(SCLK_M0_PERILP, "sclk_m0_perilp", "fclk_cm0s", 0, RK3399_CLKGATE_CON(24), 8, GFLAGS),
100750961e83SXing Zheng 	GATE(HCLK_M0_PERILP, "hclk_m0_perilp", "fclk_cm0s", 0, RK3399_CLKGATE_CON(24), 9, GFLAGS),
100850961e83SXing Zheng 	GATE(DCLK_M0_PERILP, "dclk_m0_perilp", "fclk_cm0s", 0, RK3399_CLKGATE_CON(24), 10, GFLAGS),
100950961e83SXing Zheng 	GATE(SCLK_M0_PERILP_DEC, "clk_m0_perilp_dec", "fclk_cm0s", 0, RK3399_CLKGATE_CON(24), 11, GFLAGS),
101011551005SXing Zheng 	GATE(HCLK_M0_PERILP_NOC, "hclk_m0_perilp_noc", "fclk_cm0s", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(25), 11, GFLAGS),
101111551005SXing Zheng 
101211551005SXing Zheng 	/* perilp1 */
101311551005SXing Zheng 	GATE(0, "cpll_hclk_perilp1_src", "cpll", CLK_IGNORE_UNUSED,
101411551005SXing Zheng 			RK3399_CLKGATE_CON(8), 1, GFLAGS),
101511551005SXing Zheng 	GATE(0, "gpll_hclk_perilp1_src", "gpll", CLK_IGNORE_UNUSED,
101611551005SXing Zheng 			RK3399_CLKGATE_CON(8), 0, GFLAGS),
101711551005SXing Zheng 	COMPOSITE_NOGATE(HCLK_PERILP1, "hclk_perilp1", mux_hclk_perilp1_p, CLK_IGNORE_UNUSED,
101811551005SXing Zheng 			RK3399_CLKSEL_CON(25), 7, 1, MFLAGS, 0, 5, DFLAGS),
101911551005SXing Zheng 	COMPOSITE_NOMUX(PCLK_PERILP1, "pclk_perilp1", "hclk_perilp1", CLK_IGNORE_UNUSED,
102011551005SXing Zheng 			RK3399_CLKSEL_CON(25), 8, 3, DFLAGS,
102111551005SXing Zheng 			RK3399_CLKGATE_CON(8), 2, GFLAGS),
102211551005SXing Zheng 
102311551005SXing Zheng 	/* hclk_perilp1 gates */
102411551005SXing Zheng 	GATE(0, "hclk_perilp1_noc", "hclk_perilp1", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(25), 9, GFLAGS),
102511551005SXing Zheng 	GATE(0, "hclk_sdio_noc", "hclk_perilp1", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(25), 12, GFLAGS),
102650961e83SXing Zheng 	GATE(HCLK_I2S0_8CH, "hclk_i2s0", "hclk_perilp1", 0, RK3399_CLKGATE_CON(34), 0, GFLAGS),
102750961e83SXing Zheng 	GATE(HCLK_I2S1_8CH, "hclk_i2s1", "hclk_perilp1", 0, RK3399_CLKGATE_CON(34), 1, GFLAGS),
102850961e83SXing Zheng 	GATE(HCLK_I2S2_8CH, "hclk_i2s2", "hclk_perilp1", 0, RK3399_CLKGATE_CON(34), 2, GFLAGS),
102950961e83SXing Zheng 	GATE(HCLK_SPDIF, "hclk_spdif", "hclk_perilp1", 0, RK3399_CLKGATE_CON(34), 3, GFLAGS),
103050961e83SXing Zheng 	GATE(HCLK_SDIO, "hclk_sdio", "hclk_perilp1", 0, RK3399_CLKGATE_CON(34), 4, GFLAGS),
103150961e83SXing Zheng 	GATE(PCLK_SPI5, "pclk_spi5", "hclk_perilp1", 0, RK3399_CLKGATE_CON(34), 5, GFLAGS),
103211551005SXing Zheng 	GATE(0, "hclk_sdioaudio_noc", "hclk_perilp1", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(34), 6, GFLAGS),
103311551005SXing Zheng 
103411551005SXing Zheng 	/* pclk_perilp1 gates */
103511551005SXing Zheng 	GATE(PCLK_UART0, "pclk_uart0", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 0, GFLAGS),
103611551005SXing Zheng 	GATE(PCLK_UART1, "pclk_uart1", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 1, GFLAGS),
103711551005SXing Zheng 	GATE(PCLK_UART2, "pclk_uart2", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 2, GFLAGS),
103811551005SXing Zheng 	GATE(PCLK_UART3, "pclk_uart3", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 3, GFLAGS),
103911551005SXing Zheng 	GATE(PCLK_I2C7, "pclk_rki2c7", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 5, GFLAGS),
104011551005SXing Zheng 	GATE(PCLK_I2C1, "pclk_rki2c1", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 6, GFLAGS),
104111551005SXing Zheng 	GATE(PCLK_I2C5, "pclk_rki2c5", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 7, GFLAGS),
104211551005SXing Zheng 	GATE(PCLK_I2C6, "pclk_rki2c6", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 8, GFLAGS),
104311551005SXing Zheng 	GATE(PCLK_I2C2, "pclk_rki2c2", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 9, GFLAGS),
104411551005SXing Zheng 	GATE(PCLK_I2C3, "pclk_rki2c3", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 10, GFLAGS),
104511551005SXing Zheng 	GATE(PCLK_MAILBOX0, "pclk_mailbox0", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 11, GFLAGS),
104611551005SXing Zheng 	GATE(PCLK_SARADC, "pclk_saradc", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 12, GFLAGS),
104711551005SXing Zheng 	GATE(PCLK_TSADC, "pclk_tsadc", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 13, GFLAGS),
104811551005SXing Zheng 	GATE(PCLK_EFUSE1024NS, "pclk_efuse1024ns", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 14, GFLAGS),
104911551005SXing Zheng 	GATE(PCLK_EFUSE1024S, "pclk_efuse1024s", "pclk_perilp1", 0, RK3399_CLKGATE_CON(22), 15, GFLAGS),
105011551005SXing Zheng 	GATE(PCLK_SPI0, "pclk_spi0", "pclk_perilp1", 0, RK3399_CLKGATE_CON(23), 10, GFLAGS),
105111551005SXing Zheng 	GATE(PCLK_SPI1, "pclk_spi1", "pclk_perilp1", 0, RK3399_CLKGATE_CON(23), 11, GFLAGS),
105211551005SXing Zheng 	GATE(PCLK_SPI2, "pclk_spi2", "pclk_perilp1", 0, RK3399_CLKGATE_CON(23), 12, GFLAGS),
105311551005SXing Zheng 	GATE(PCLK_SPI4, "pclk_spi4", "pclk_perilp1", 0, RK3399_CLKGATE_CON(23), 13, GFLAGS),
105411551005SXing Zheng 	GATE(PCLK_PERIHP_GRF, "pclk_perilp_sgrf", "pclk_perilp1", 0, RK3399_CLKGATE_CON(24), 13, GFLAGS),
105511551005SXing Zheng 	GATE(0, "pclk_perilp1_noc", "pclk_perilp1", 0, RK3399_CLKGATE_CON(25), 10, GFLAGS),
105611551005SXing Zheng 
105711551005SXing Zheng 	/* saradc */
105811551005SXing Zheng 	COMPOSITE_NOMUX(SCLK_SARADC, "clk_saradc", "xin24m", 0,
105911551005SXing Zheng 			RK3399_CLKSEL_CON(26), 8, 8, DFLAGS,
106011551005SXing Zheng 			RK3399_CLKGATE_CON(9), 11, GFLAGS),
106111551005SXing Zheng 
106211551005SXing Zheng 	/* tsadc */
106350961e83SXing Zheng 	COMPOSITE(SCLK_TSADC, "clk_tsadc", mux_pll_p, 0,
106411551005SXing Zheng 			RK3399_CLKSEL_CON(27), 15, 1, MFLAGS, 0, 10, DFLAGS,
106511551005SXing Zheng 			RK3399_CLKGATE_CON(9), 10, GFLAGS),
106611551005SXing Zheng 
106711551005SXing Zheng 	/* cif_testout */
106811551005SXing Zheng 	MUX(0, "clk_testout1_pll_src", mux_pll_src_cpll_gpll_npll_p, 0,
106911551005SXing Zheng 			RK3399_CLKSEL_CON(38), 6, 2, MFLAGS),
107025fb42b1SEddie Cai 	COMPOSITE(SCLK_TESTCLKOUT1, "clk_testout1", mux_clk_testout1_p, 0,
107111551005SXing Zheng 			RK3399_CLKSEL_CON(38), 5, 1, MFLAGS, 0, 5, DFLAGS,
107211551005SXing Zheng 			RK3399_CLKGATE_CON(13), 14, GFLAGS),
107311551005SXing Zheng 
107411551005SXing Zheng 	MUX(0, "clk_testout2_pll_src", mux_pll_src_cpll_gpll_npll_p, 0,
107511551005SXing Zheng 			RK3399_CLKSEL_CON(38), 14, 2, MFLAGS),
107625fb42b1SEddie Cai 	COMPOSITE(SCLK_TESTCLKOUT2, "clk_testout2", mux_clk_testout2_p, 0,
107711551005SXing Zheng 			RK3399_CLKSEL_CON(38), 13, 1, MFLAGS, 8, 5, DFLAGS,
107811551005SXing Zheng 			RK3399_CLKGATE_CON(13), 15, GFLAGS),
107911551005SXing Zheng 
108011551005SXing Zheng 	/* vio */
108111551005SXing Zheng 	COMPOSITE(ACLK_VIO, "aclk_vio", mux_pll_src_cpll_gpll_ppll_p, CLK_IGNORE_UNUSED,
108211551005SXing Zheng 			RK3399_CLKSEL_CON(42), 6, 2, MFLAGS, 0, 5, DFLAGS,
1083a3f457d9SChris Zhong 			RK3399_CLKGATE_CON(11), 0, GFLAGS),
108411551005SXing Zheng 	COMPOSITE_NOMUX(PCLK_VIO, "pclk_vio", "aclk_vio", 0,
108511551005SXing Zheng 			RK3399_CLKSEL_CON(43), 0, 5, DFLAGS,
108611551005SXing Zheng 			RK3399_CLKGATE_CON(11), 1, GFLAGS),
108711551005SXing Zheng 
108811551005SXing Zheng 	GATE(ACLK_VIO_NOC, "aclk_vio_noc", "aclk_vio", CLK_IGNORE_UNUSED,
108911551005SXing Zheng 			RK3399_CLKGATE_CON(29), 0, GFLAGS),
109011551005SXing Zheng 
109150961e83SXing Zheng 	GATE(PCLK_MIPI_DSI0, "pclk_mipi_dsi0", "pclk_vio", 0,
109211551005SXing Zheng 			RK3399_CLKGATE_CON(29), 1, GFLAGS),
109350961e83SXing Zheng 	GATE(PCLK_MIPI_DSI1, "pclk_mipi_dsi1", "pclk_vio", 0,
109411551005SXing Zheng 			RK3399_CLKGATE_CON(29), 2, GFLAGS),
109511551005SXing Zheng 	GATE(PCLK_VIO_GRF, "pclk_vio_grf", "pclk_vio", CLK_IGNORE_UNUSED,
109611551005SXing Zheng 			RK3399_CLKGATE_CON(29), 12, GFLAGS),
109711551005SXing Zheng 
109811551005SXing Zheng 	/* hdcp */
109950961e83SXing Zheng 	COMPOSITE(ACLK_HDCP, "aclk_hdcp", mux_pll_src_cpll_gpll_ppll_p, 0,
110011551005SXing Zheng 			RK3399_CLKSEL_CON(42), 14, 2, MFLAGS, 8, 5, DFLAGS,
110111551005SXing Zheng 			RK3399_CLKGATE_CON(11), 12, GFLAGS),
110250961e83SXing Zheng 	COMPOSITE_NOMUX(HCLK_HDCP, "hclk_hdcp", "aclk_hdcp", 0,
110311551005SXing Zheng 			RK3399_CLKSEL_CON(43), 5, 5, DFLAGS,
110411551005SXing Zheng 			RK3399_CLKGATE_CON(11), 3, GFLAGS),
110550961e83SXing Zheng 	COMPOSITE_NOMUX(PCLK_HDCP, "pclk_hdcp", "aclk_hdcp", 0,
110611551005SXing Zheng 			RK3399_CLKSEL_CON(43), 10, 5, DFLAGS,
110711551005SXing Zheng 			RK3399_CLKGATE_CON(11), 10, GFLAGS),
110811551005SXing Zheng 
110911551005SXing Zheng 	GATE(ACLK_HDCP_NOC, "aclk_hdcp_noc", "aclk_hdcp", CLK_IGNORE_UNUSED,
111011551005SXing Zheng 			RK3399_CLKGATE_CON(29), 4, GFLAGS),
111150961e83SXing Zheng 	GATE(ACLK_HDCP22, "aclk_hdcp22", "aclk_hdcp", 0,
111211551005SXing Zheng 			RK3399_CLKGATE_CON(29), 10, GFLAGS),
111311551005SXing Zheng 
111411551005SXing Zheng 	GATE(HCLK_HDCP_NOC, "hclk_hdcp_noc", "hclk_hdcp", CLK_IGNORE_UNUSED,
111511551005SXing Zheng 			RK3399_CLKGATE_CON(29), 5, GFLAGS),
111650961e83SXing Zheng 	GATE(HCLK_HDCP22, "hclk_hdcp22", "hclk_hdcp", 0,
111711551005SXing Zheng 			RK3399_CLKGATE_CON(29), 9, GFLAGS),
111811551005SXing Zheng 
111911551005SXing Zheng 	GATE(PCLK_HDCP_NOC, "pclk_hdcp_noc", "pclk_hdcp", CLK_IGNORE_UNUSED,
112011551005SXing Zheng 			RK3399_CLKGATE_CON(29), 3, GFLAGS),
112150961e83SXing Zheng 	GATE(PCLK_HDMI_CTRL, "pclk_hdmi_ctrl", "pclk_hdcp", 0,
112211551005SXing Zheng 			RK3399_CLKGATE_CON(29), 6, GFLAGS),
112350961e83SXing Zheng 	GATE(PCLK_DP_CTRL, "pclk_dp_ctrl", "pclk_hdcp", 0,
112411551005SXing Zheng 			RK3399_CLKGATE_CON(29), 7, GFLAGS),
112550961e83SXing Zheng 	GATE(PCLK_HDCP22, "pclk_hdcp22", "pclk_hdcp", 0,
112611551005SXing Zheng 			RK3399_CLKGATE_CON(29), 8, GFLAGS),
112750961e83SXing Zheng 	GATE(PCLK_GASKET, "pclk_gasket", "pclk_hdcp", 0,
112811551005SXing Zheng 			RK3399_CLKGATE_CON(29), 11, GFLAGS),
112911551005SXing Zheng 
113011551005SXing Zheng 	/* edp */
113150961e83SXing Zheng 	COMPOSITE(SCLK_DP_CORE, "clk_dp_core", mux_pll_src_npll_cpll_gpll_p, 0,
113211551005SXing Zheng 			RK3399_CLKSEL_CON(46), 6, 2, MFLAGS, 0, 5, DFLAGS,
113311551005SXing Zheng 			RK3399_CLKGATE_CON(11), 8, GFLAGS),
113411551005SXing Zheng 
113550961e83SXing Zheng 	COMPOSITE(PCLK_EDP, "pclk_edp", mux_pll_src_cpll_gpll_p, 0,
11363e1531dbSXing Zheng 			RK3399_CLKSEL_CON(44), 15, 1, MFLAGS, 8, 6, DFLAGS,
113711551005SXing Zheng 			RK3399_CLKGATE_CON(11), 11, GFLAGS),
113811551005SXing Zheng 	GATE(PCLK_EDP_NOC, "pclk_edp_noc", "pclk_edp", CLK_IGNORE_UNUSED,
113911551005SXing Zheng 			RK3399_CLKGATE_CON(32), 12, GFLAGS),
114050961e83SXing Zheng 	GATE(PCLK_EDP_CTRL, "pclk_edp_ctrl", "pclk_edp", 0,
114111551005SXing Zheng 			RK3399_CLKGATE_CON(32), 13, GFLAGS),
114211551005SXing Zheng 
114311551005SXing Zheng 	/* hdmi */
114450961e83SXing Zheng 	GATE(SCLK_HDMI_SFR, "clk_hdmi_sfr", "xin24m", 0,
114511551005SXing Zheng 			RK3399_CLKGATE_CON(11), 6, GFLAGS),
114611551005SXing Zheng 
114750961e83SXing Zheng 	COMPOSITE(SCLK_HDMI_CEC, "clk_hdmi_cec", mux_pll_p, 0,
114811551005SXing Zheng 			RK3399_CLKSEL_CON(45), 15, 1, MFLAGS, 0, 10, DFLAGS,
114911551005SXing Zheng 			RK3399_CLKGATE_CON(11), 7, GFLAGS),
115011551005SXing Zheng 
115111551005SXing Zheng 	/* vop0 */
115250961e83SXing Zheng 	COMPOSITE(ACLK_VOP0_PRE, "aclk_vop0_pre", mux_pll_src_vpll_cpll_gpll_npll_p, 0,
115311551005SXing Zheng 			RK3399_CLKSEL_CON(47), 6, 2, MFLAGS, 0, 5, DFLAGS,
115411551005SXing Zheng 			RK3399_CLKGATE_CON(10), 8, GFLAGS),
115511551005SXing Zheng 	COMPOSITE_NOMUX(0, "hclk_vop0_pre", "aclk_vop0_pre", 0,
115611551005SXing Zheng 			RK3399_CLKSEL_CON(47), 8, 5, DFLAGS,
115711551005SXing Zheng 			RK3399_CLKGATE_CON(10), 9, GFLAGS),
115811551005SXing Zheng 
115950961e83SXing Zheng 	GATE(ACLK_VOP0, "aclk_vop0", "aclk_vop0_pre", 0,
116011551005SXing Zheng 			RK3399_CLKGATE_CON(28), 3, GFLAGS),
116111551005SXing Zheng 	GATE(ACLK_VOP0_NOC, "aclk_vop0_noc", "aclk_vop0_pre", CLK_IGNORE_UNUSED,
116211551005SXing Zheng 			RK3399_CLKGATE_CON(28), 1, GFLAGS),
116311551005SXing Zheng 
116450961e83SXing Zheng 	GATE(HCLK_VOP0, "hclk_vop0", "hclk_vop0_pre", 0,
116511551005SXing Zheng 			RK3399_CLKGATE_CON(28), 2, GFLAGS),
116611551005SXing Zheng 	GATE(HCLK_VOP0_NOC, "hclk_vop0_noc", "hclk_vop0_pre", CLK_IGNORE_UNUSED,
116711551005SXing Zheng 			RK3399_CLKGATE_CON(28), 0, GFLAGS),
116811551005SXing Zheng 
116950961e83SXing Zheng 	COMPOSITE(DCLK_VOP0_DIV, "dclk_vop0_div", mux_pll_src_vpll_cpll_gpll_p, 0,
117011551005SXing Zheng 			RK3399_CLKSEL_CON(49), 8, 2, MFLAGS, 0, 8, DFLAGS,
117111551005SXing Zheng 			RK3399_CLKGATE_CON(10), 12, GFLAGS),
117211551005SXing Zheng 
11737b0f9e35SYakir Yang 	COMPOSITE_FRACMUX_NOGATE(DCLK_VOP0_FRAC, "dclk_vop0_frac", "dclk_vop0_div", 0,
117411551005SXing Zheng 			RK3399_CLKSEL_CON(106), 0,
117511551005SXing Zheng 			&rk3399_dclk_vop0_fracmux),
117611551005SXing Zheng 
117750961e83SXing Zheng 	COMPOSITE(SCLK_VOP0_PWM, "clk_vop0_pwm", mux_pll_src_vpll_cpll_gpll_24m_p, 0,
117811551005SXing Zheng 			RK3399_CLKSEL_CON(51), 6, 2, MFLAGS, 0, 5, DFLAGS,
117911551005SXing Zheng 			RK3399_CLKGATE_CON(10), 14, GFLAGS),
118011551005SXing Zheng 
118111551005SXing Zheng 	/* vop1 */
118250961e83SXing Zheng 	COMPOSITE(ACLK_VOP1_PRE, "aclk_vop1_pre", mux_pll_src_vpll_cpll_gpll_npll_p, 0,
118311551005SXing Zheng 			RK3399_CLKSEL_CON(48), 6, 2, MFLAGS, 0, 5, DFLAGS,
118411551005SXing Zheng 			RK3399_CLKGATE_CON(10), 10, GFLAGS),
118511551005SXing Zheng 	COMPOSITE_NOMUX(0, "hclk_vop1_pre", "aclk_vop1_pre", 0,
118611551005SXing Zheng 			RK3399_CLKSEL_CON(48), 8, 5, DFLAGS,
118711551005SXing Zheng 			RK3399_CLKGATE_CON(10), 11, GFLAGS),
118811551005SXing Zheng 
118950961e83SXing Zheng 	GATE(ACLK_VOP1, "aclk_vop1", "aclk_vop1_pre", 0,
119011551005SXing Zheng 			RK3399_CLKGATE_CON(28), 7, GFLAGS),
119111551005SXing Zheng 	GATE(ACLK_VOP1_NOC, "aclk_vop1_noc", "aclk_vop1_pre", CLK_IGNORE_UNUSED,
119211551005SXing Zheng 			RK3399_CLKGATE_CON(28), 5, GFLAGS),
119311551005SXing Zheng 
119450961e83SXing Zheng 	GATE(HCLK_VOP1, "hclk_vop1", "hclk_vop1_pre", 0,
119511551005SXing Zheng 			RK3399_CLKGATE_CON(28), 6, GFLAGS),
119611551005SXing Zheng 	GATE(HCLK_VOP1_NOC, "hclk_vop1_noc", "hclk_vop1_pre", CLK_IGNORE_UNUSED,
119711551005SXing Zheng 			RK3399_CLKGATE_CON(28), 4, GFLAGS),
119811551005SXing Zheng 
119950961e83SXing Zheng 	COMPOSITE(DCLK_VOP1_DIV, "dclk_vop1_div", mux_pll_src_vpll_cpll_gpll_p, 0,
120011551005SXing Zheng 			RK3399_CLKSEL_CON(50), 8, 2, MFLAGS, 0, 8, DFLAGS,
120111551005SXing Zheng 			RK3399_CLKGATE_CON(10), 13, GFLAGS),
120211551005SXing Zheng 
12037b0f9e35SYakir Yang 	COMPOSITE_FRACMUX_NOGATE(DCLK_VOP1_FRAC, "dclk_vop1_frac", "dclk_vop1_div", 0,
120411551005SXing Zheng 			RK3399_CLKSEL_CON(107), 0,
120511551005SXing Zheng 			&rk3399_dclk_vop1_fracmux),
120611551005SXing Zheng 
120711551005SXing Zheng 	COMPOSITE(SCLK_VOP1_PWM, "clk_vop1_pwm", mux_pll_src_vpll_cpll_gpll_24m_p, CLK_IGNORE_UNUSED,
120811551005SXing Zheng 			RK3399_CLKSEL_CON(52), 6, 2, MFLAGS, 0, 5, DFLAGS,
120911551005SXing Zheng 			RK3399_CLKGATE_CON(10), 15, GFLAGS),
121011551005SXing Zheng 
121111551005SXing Zheng 	/* isp */
121250961e83SXing Zheng 	COMPOSITE(ACLK_ISP0, "aclk_isp0", mux_pll_src_cpll_gpll_ppll_p, 0,
121311551005SXing Zheng 			RK3399_CLKSEL_CON(53), 6, 2, MFLAGS, 0, 5, DFLAGS,
121411551005SXing Zheng 			RK3399_CLKGATE_CON(12), 8, GFLAGS),
12153f92a054SXing Zheng 	COMPOSITE_NOMUX(HCLK_ISP0, "hclk_isp0", "aclk_isp0", 0,
121611551005SXing Zheng 			RK3399_CLKSEL_CON(53), 8, 5, DFLAGS,
121711551005SXing Zheng 			RK3399_CLKGATE_CON(12), 9, GFLAGS),
121811551005SXing Zheng 
121911551005SXing Zheng 	GATE(ACLK_ISP0_NOC, "aclk_isp0_noc", "aclk_isp0", CLK_IGNORE_UNUSED,
122011551005SXing Zheng 			RK3399_CLKGATE_CON(27), 1, GFLAGS),
122150961e83SXing Zheng 	GATE(ACLK_ISP0_WRAPPER, "aclk_isp0_wrapper", "aclk_isp0", 0,
122211551005SXing Zheng 			RK3399_CLKGATE_CON(27), 5, GFLAGS),
122350961e83SXing Zheng 	GATE(HCLK_ISP1_WRAPPER, "hclk_isp1_wrapper", "aclk_isp0", 0,
122411551005SXing Zheng 			RK3399_CLKGATE_CON(27), 7, GFLAGS),
122511551005SXing Zheng 
122611551005SXing Zheng 	GATE(HCLK_ISP0_NOC, "hclk_isp0_noc", "hclk_isp0", CLK_IGNORE_UNUSED,
122711551005SXing Zheng 			RK3399_CLKGATE_CON(27), 0, GFLAGS),
122850961e83SXing Zheng 	GATE(HCLK_ISP0_WRAPPER, "hclk_isp0_wrapper", "hclk_isp0", 0,
122911551005SXing Zheng 			RK3399_CLKGATE_CON(27), 4, GFLAGS),
123011551005SXing Zheng 
123150961e83SXing Zheng 	COMPOSITE(SCLK_ISP0, "clk_isp0", mux_pll_src_cpll_gpll_npll_p, 0,
123211551005SXing Zheng 			RK3399_CLKSEL_CON(55), 6, 2, MFLAGS, 0, 5, DFLAGS,
123311551005SXing Zheng 			RK3399_CLKGATE_CON(11), 4, GFLAGS),
123411551005SXing Zheng 
123550961e83SXing Zheng 	COMPOSITE(ACLK_ISP1, "aclk_isp1", mux_pll_src_cpll_gpll_ppll_p, 0,
123611551005SXing Zheng 			RK3399_CLKSEL_CON(54), 6, 2, MFLAGS, 0, 5, DFLAGS,
123711551005SXing Zheng 			RK3399_CLKGATE_CON(12), 10, GFLAGS),
12383f92a054SXing Zheng 	COMPOSITE_NOMUX(HCLK_ISP1, "hclk_isp1", "aclk_isp1", 0,
123911551005SXing Zheng 			RK3399_CLKSEL_CON(54), 8, 5, DFLAGS,
124011551005SXing Zheng 			RK3399_CLKGATE_CON(12), 11, GFLAGS),
124111551005SXing Zheng 
124211551005SXing Zheng 	GATE(ACLK_ISP1_NOC, "aclk_isp1_noc", "aclk_isp1", CLK_IGNORE_UNUSED,
124311551005SXing Zheng 			RK3399_CLKGATE_CON(27), 3, GFLAGS),
124411551005SXing Zheng 
124511551005SXing Zheng 	GATE(HCLK_ISP1_NOC, "hclk_isp1_noc", "hclk_isp1", CLK_IGNORE_UNUSED,
124611551005SXing Zheng 			RK3399_CLKGATE_CON(27), 2, GFLAGS),
124750961e83SXing Zheng 	GATE(ACLK_ISP1_WRAPPER, "aclk_isp1_wrapper", "hclk_isp1", 0,
124811551005SXing Zheng 			RK3399_CLKGATE_CON(27), 8, GFLAGS),
124911551005SXing Zheng 
125050961e83SXing Zheng 	COMPOSITE(SCLK_ISP1, "clk_isp1", mux_pll_src_cpll_gpll_npll_p, 0,
125111551005SXing Zheng 			RK3399_CLKSEL_CON(55), 14, 2, MFLAGS, 8, 5, DFLAGS,
125211551005SXing Zheng 			RK3399_CLKGATE_CON(11), 5, GFLAGS),
125311551005SXing Zheng 
125411551005SXing Zheng 	/*
125511551005SXing Zheng 	 * We use pclkin_cifinv by default GRF_SOC_CON20[9] (GSC20_9) setting in system,
125611551005SXing Zheng 	 * so we ignore the mux and make clocks nodes as following,
125711551005SXing Zheng 	 *
125811551005SXing Zheng 	 * pclkin_cifinv --|-------\
125911551005SXing Zheng 	 *                 |GSC20_9|-- pclkin_cifmux -- |G27_6| -- pclkin_isp1_wrapper
126011551005SXing Zheng 	 * pclkin_cif    --|-------/
126111551005SXing Zheng 	 */
126250961e83SXing Zheng 	GATE(PCLK_ISP1_WRAPPER, "pclkin_isp1_wrapper", "pclkin_cif", 0,
126311551005SXing Zheng 			RK3399_CLKGATE_CON(27), 6, GFLAGS),
126411551005SXing Zheng 
126511551005SXing Zheng 	/* cif */
1266fd8bc829SXing Zheng 	COMPOSITE_NODIV(0, "clk_cifout_src", mux_pll_src_cpll_gpll_npll_p, 0,
1267fd8bc829SXing Zheng 			RK3399_CLKSEL_CON(56), 6, 2, MFLAGS,
126811551005SXing Zheng 			RK3399_CLKGATE_CON(10), 7, GFLAGS),
1269fd8bc829SXing Zheng 
1270fd8bc829SXing Zheng 	COMPOSITE_NOGATE(SCLK_CIF_OUT, "clk_cifout", mux_clk_cif_p, 0,
1271fd8bc829SXing Zheng 			 RK3399_CLKSEL_CON(56), 5, 1, MFLAGS, 0, 5, DFLAGS),
127211551005SXing Zheng 
127311551005SXing Zheng 	/* gic */
127411551005SXing Zheng 	COMPOSITE(ACLK_GIC_PRE, "aclk_gic_pre", mux_pll_src_cpll_gpll_p, CLK_IGNORE_UNUSED,
127511551005SXing Zheng 			RK3399_CLKSEL_CON(56), 15, 1, MFLAGS, 8, 5, DFLAGS,
127611551005SXing Zheng 			RK3399_CLKGATE_CON(12), 12, GFLAGS),
127711551005SXing Zheng 
127811551005SXing Zheng 	GATE(ACLK_GIC, "aclk_gic", "aclk_gic_pre", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(33), 0, GFLAGS),
127911551005SXing Zheng 	GATE(ACLK_GIC_NOC, "aclk_gic_noc", "aclk_gic_pre", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(33), 1, GFLAGS),
128011551005SXing Zheng 	GATE(ACLK_GIC_ADB400_CORE_L_2_GIC, "aclk_gic_adb400_core_l_2_gic", "aclk_gic_pre", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(33), 2, GFLAGS),
128111551005SXing Zheng 	GATE(ACLK_GIC_ADB400_CORE_B_2_GIC, "aclk_gic_adb400_core_b_2_gic", "aclk_gic_pre", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(33), 3, GFLAGS),
128211551005SXing Zheng 	GATE(ACLK_GIC_ADB400_GIC_2_CORE_L, "aclk_gic_adb400_gic_2_core_l", "aclk_gic_pre", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(33), 4, GFLAGS),
128311551005SXing Zheng 	GATE(ACLK_GIC_ADB400_GIC_2_CORE_B, "aclk_gic_adb400_gic_2_core_b", "aclk_gic_pre", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(33), 5, GFLAGS),
128411551005SXing Zheng 
128511551005SXing Zheng 	/* alive */
128611551005SXing Zheng 	/* pclk_alive_gpll_src is controlled by PMUGRF_SOC_CON0[6] */
128711551005SXing Zheng 	DIV(PCLK_ALIVE, "pclk_alive", "gpll", 0,
128811551005SXing Zheng 			RK3399_CLKSEL_CON(57), 0, 5, DFLAGS),
128911551005SXing Zheng 
129011551005SXing Zheng 	GATE(PCLK_USBPHY_MUX_G, "pclk_usbphy_mux_g", "pclk_alive", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(21), 4, GFLAGS),
129111551005SXing Zheng 	GATE(PCLK_UPHY0_TCPHY_G, "pclk_uphy0_tcphy_g", "pclk_alive", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(21), 5, GFLAGS),
129211551005SXing Zheng 	GATE(PCLK_UPHY0_TCPD_G, "pclk_uphy0_tcpd_g", "pclk_alive", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(21), 6, GFLAGS),
129311551005SXing Zheng 	GATE(PCLK_UPHY1_TCPHY_G, "pclk_uphy1_tcphy_g", "pclk_alive", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(21), 8, GFLAGS),
129411551005SXing Zheng 	GATE(PCLK_UPHY1_TCPD_G, "pclk_uphy1_tcpd_g", "pclk_alive", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(21), 9, GFLAGS),
129511551005SXing Zheng 
129611551005SXing Zheng 	GATE(PCLK_GRF, "pclk_grf", "pclk_alive", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(31), 1, GFLAGS),
129711551005SXing Zheng 	GATE(PCLK_INTR_ARB, "pclk_intr_arb", "pclk_alive", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(31), 2, GFLAGS),
129850961e83SXing Zheng 	GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_alive", 0, RK3399_CLKGATE_CON(31), 3, GFLAGS),
129950961e83SXing Zheng 	GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_alive", 0, RK3399_CLKGATE_CON(31), 4, GFLAGS),
130050961e83SXing Zheng 	GATE(PCLK_GPIO4, "pclk_gpio4", "pclk_alive", 0, RK3399_CLKGATE_CON(31), 5, GFLAGS),
130150961e83SXing Zheng 	GATE(PCLK_TIMER0, "pclk_timer0", "pclk_alive", 0, RK3399_CLKGATE_CON(31), 6, GFLAGS),
130250961e83SXing Zheng 	GATE(PCLK_TIMER1, "pclk_timer1", "pclk_alive", 0, RK3399_CLKGATE_CON(31), 7, GFLAGS),
130311551005SXing Zheng 	GATE(PCLK_PMU_INTR_ARB, "pclk_pmu_intr_arb", "pclk_alive", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(31), 9, GFLAGS),
130411551005SXing Zheng 	GATE(PCLK_SGRF, "pclk_sgrf", "pclk_alive", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(31), 10, GFLAGS),
130511551005SXing Zheng 
130650961e83SXing Zheng 	GATE(SCLK_MIPIDPHY_REF, "clk_mipidphy_ref", "xin24m", 0, RK3399_CLKGATE_CON(11), 14, GFLAGS),
130711551005SXing Zheng 	GATE(SCLK_DPHY_PLL, "clk_dphy_pll", "clk_mipidphy_ref", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(21), 0, GFLAGS),
130811551005SXing Zheng 
130950961e83SXing Zheng 	GATE(SCLK_MIPIDPHY_CFG, "clk_mipidphy_cfg", "xin24m", 0, RK3399_CLKGATE_CON(11), 15, GFLAGS),
131011551005SXing Zheng 	GATE(SCLK_DPHY_TX0_CFG, "clk_dphy_tx0_cfg", "clk_mipidphy_cfg", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(21), 1, GFLAGS),
131111551005SXing Zheng 	GATE(SCLK_DPHY_TX1RX1_CFG, "clk_dphy_tx1rx1_cfg", "clk_mipidphy_cfg", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(21), 2, GFLAGS),
131211551005SXing Zheng 	GATE(SCLK_DPHY_RX0_CFG, "clk_dphy_rx0_cfg", "clk_mipidphy_cfg", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(21), 3, GFLAGS),
131311551005SXing Zheng 
131411551005SXing Zheng 	/* testout */
131511551005SXing Zheng 	MUX(0, "clk_test_pre", mux_pll_src_cpll_gpll_p, CLK_SET_RATE_PARENT,
131611551005SXing Zheng 			RK3399_CLKSEL_CON(58), 7, 1, MFLAGS),
131729edeccbSDouglas Anderson 	COMPOSITE_FRAC(0, "clk_test_frac", "clk_test_pre", 0,
131811551005SXing Zheng 			RK3399_CLKSEL_CON(105), 0,
131911551005SXing Zheng 			RK3399_CLKGATE_CON(13), 9, GFLAGS),
132011551005SXing Zheng 
132111551005SXing Zheng 	DIV(0, "clk_test_24m", "xin24m", 0,
132211551005SXing Zheng 			RK3399_CLKSEL_CON(57), 6, 10, DFLAGS),
132311551005SXing Zheng 
132411551005SXing Zheng 	/* spi */
132511551005SXing Zheng 	COMPOSITE(SCLK_SPI0, "clk_spi0", mux_pll_src_cpll_gpll_p, 0,
132611551005SXing Zheng 			RK3399_CLKSEL_CON(59), 7, 1, MFLAGS, 0, 7, DFLAGS,
132711551005SXing Zheng 			RK3399_CLKGATE_CON(9), 12, GFLAGS),
132811551005SXing Zheng 
132911551005SXing Zheng 	COMPOSITE(SCLK_SPI1, "clk_spi1", mux_pll_src_cpll_gpll_p, 0,
133011551005SXing Zheng 			RK3399_CLKSEL_CON(59), 15, 1, MFLAGS, 8, 7, DFLAGS,
133111551005SXing Zheng 			RK3399_CLKGATE_CON(9), 13, GFLAGS),
133211551005SXing Zheng 
133311551005SXing Zheng 	COMPOSITE(SCLK_SPI2, "clk_spi2", mux_pll_src_cpll_gpll_p, 0,
133411551005SXing Zheng 			RK3399_CLKSEL_CON(60), 7, 1, MFLAGS, 0, 7, DFLAGS,
133511551005SXing Zheng 			RK3399_CLKGATE_CON(9), 14, GFLAGS),
133611551005SXing Zheng 
133711551005SXing Zheng 	COMPOSITE(SCLK_SPI4, "clk_spi4", mux_pll_src_cpll_gpll_p, 0,
133811551005SXing Zheng 			RK3399_CLKSEL_CON(60), 15, 1, MFLAGS, 8, 7, DFLAGS,
133911551005SXing Zheng 			RK3399_CLKGATE_CON(9), 15, GFLAGS),
134011551005SXing Zheng 
134111551005SXing Zheng 	COMPOSITE(SCLK_SPI5, "clk_spi5", mux_pll_src_cpll_gpll_p, 0,
134211551005SXing Zheng 			RK3399_CLKSEL_CON(58), 15, 1, MFLAGS, 8, 7, DFLAGS,
134311551005SXing Zheng 			RK3399_CLKGATE_CON(13), 13, GFLAGS),
134411551005SXing Zheng 
134511551005SXing Zheng 	/* i2c */
134611551005SXing Zheng 	COMPOSITE(SCLK_I2C1, "clk_i2c1", mux_pll_src_cpll_gpll_p, 0,
134711551005SXing Zheng 			RK3399_CLKSEL_CON(61), 7, 1, MFLAGS, 0, 7, DFLAGS,
134811551005SXing Zheng 			RK3399_CLKGATE_CON(10), 0, GFLAGS),
134911551005SXing Zheng 
135011551005SXing Zheng 	COMPOSITE(SCLK_I2C2, "clk_i2c2", mux_pll_src_cpll_gpll_p, 0,
135111551005SXing Zheng 			RK3399_CLKSEL_CON(62), 7, 1, MFLAGS, 0, 7, DFLAGS,
135211551005SXing Zheng 			RK3399_CLKGATE_CON(10), 2, GFLAGS),
135311551005SXing Zheng 
135411551005SXing Zheng 	COMPOSITE(SCLK_I2C3, "clk_i2c3", mux_pll_src_cpll_gpll_p, 0,
135511551005SXing Zheng 			RK3399_CLKSEL_CON(63), 7, 1, MFLAGS, 0, 7, DFLAGS,
135611551005SXing Zheng 			RK3399_CLKGATE_CON(10), 4, GFLAGS),
135711551005SXing Zheng 
135811551005SXing Zheng 	COMPOSITE(SCLK_I2C5, "clk_i2c5", mux_pll_src_cpll_gpll_p, 0,
135911551005SXing Zheng 			RK3399_CLKSEL_CON(61), 15, 1, MFLAGS, 8, 7, DFLAGS,
136011551005SXing Zheng 			RK3399_CLKGATE_CON(10), 1, GFLAGS),
136111551005SXing Zheng 
136211551005SXing Zheng 	COMPOSITE(SCLK_I2C6, "clk_i2c6", mux_pll_src_cpll_gpll_p, 0,
136311551005SXing Zheng 			RK3399_CLKSEL_CON(62), 15, 1, MFLAGS, 8, 7, DFLAGS,
136411551005SXing Zheng 			RK3399_CLKGATE_CON(10), 3, GFLAGS),
136511551005SXing Zheng 
136611551005SXing Zheng 	COMPOSITE(SCLK_I2C7, "clk_i2c7", mux_pll_src_cpll_gpll_p, 0,
136711551005SXing Zheng 			RK3399_CLKSEL_CON(63), 15, 1, MFLAGS, 8, 7, DFLAGS,
136811551005SXing Zheng 			RK3399_CLKGATE_CON(10), 5, GFLAGS),
136911551005SXing Zheng 
137011551005SXing Zheng 	/* timer */
137150961e83SXing Zheng 	GATE(SCLK_TIMER00, "clk_timer00", "xin24m", 0, RK3399_CLKGATE_CON(26), 0, GFLAGS),
137250961e83SXing Zheng 	GATE(SCLK_TIMER01, "clk_timer01", "xin24m", 0, RK3399_CLKGATE_CON(26), 1, GFLAGS),
137350961e83SXing Zheng 	GATE(SCLK_TIMER02, "clk_timer02", "xin24m", 0, RK3399_CLKGATE_CON(26), 2, GFLAGS),
137450961e83SXing Zheng 	GATE(SCLK_TIMER03, "clk_timer03", "xin24m", 0, RK3399_CLKGATE_CON(26), 3, GFLAGS),
137550961e83SXing Zheng 	GATE(SCLK_TIMER04, "clk_timer04", "xin24m", 0, RK3399_CLKGATE_CON(26), 4, GFLAGS),
137650961e83SXing Zheng 	GATE(SCLK_TIMER05, "clk_timer05", "xin24m", 0, RK3399_CLKGATE_CON(26), 5, GFLAGS),
137750961e83SXing Zheng 	GATE(SCLK_TIMER06, "clk_timer06", "xin24m", 0, RK3399_CLKGATE_CON(26), 6, GFLAGS),
137850961e83SXing Zheng 	GATE(SCLK_TIMER07, "clk_timer07", "xin24m", 0, RK3399_CLKGATE_CON(26), 7, GFLAGS),
137950961e83SXing Zheng 	GATE(SCLK_TIMER08, "clk_timer08", "xin24m", 0, RK3399_CLKGATE_CON(26), 8, GFLAGS),
138050961e83SXing Zheng 	GATE(SCLK_TIMER09, "clk_timer09", "xin24m", 0, RK3399_CLKGATE_CON(26), 9, GFLAGS),
138150961e83SXing Zheng 	GATE(SCLK_TIMER10, "clk_timer10", "xin24m", 0, RK3399_CLKGATE_CON(26), 10, GFLAGS),
138250961e83SXing Zheng 	GATE(SCLK_TIMER11, "clk_timer11", "xin24m", 0, RK3399_CLKGATE_CON(26), 11, GFLAGS),
138311551005SXing Zheng 
138411551005SXing Zheng 	/* clk_test */
138511551005SXing Zheng 	/* clk_test_pre is controlled by CRU_MISC_CON[3] */
138611551005SXing Zheng 	COMPOSITE_NOMUX(0, "clk_test", "clk_test_pre", CLK_IGNORE_UNUSED,
13879c496033SJianqun Xu 			RK3399_CLKSEL_CON(58), 0, 5, DFLAGS,
13889c496033SJianqun Xu 			RK3399_CLKGATE_CON(13), 11, GFLAGS),
1389464b9eebSLin Huang 
1390464b9eebSLin Huang 	/* ddrc */
1391464b9eebSLin Huang 	GATE(0, "clk_ddrc_lpll_src", "lpll", 0, RK3399_CLKGATE_CON(3),
1392464b9eebSLin Huang 	     0, GFLAGS),
1393464b9eebSLin Huang 	GATE(0, "clk_ddrc_bpll_src", "bpll", 0, RK3399_CLKGATE_CON(3),
1394464b9eebSLin Huang 	     1, GFLAGS),
1395464b9eebSLin Huang 	GATE(0, "clk_ddrc_dpll_src", "dpll", 0, RK3399_CLKGATE_CON(3),
1396464b9eebSLin Huang 	     2, GFLAGS),
1397464b9eebSLin Huang 	GATE(0, "clk_ddrc_gpll_src", "gpll", 0, RK3399_CLKGATE_CON(3),
1398464b9eebSLin Huang 	     3, GFLAGS),
1399464b9eebSLin Huang 	COMPOSITE_DDRCLK(SCLK_DDRC, "sclk_ddrc", mux_ddrclk_p, 0,
1400464b9eebSLin Huang 		       RK3399_CLKSEL_CON(6), 4, 2, 0, 0, ROCKCHIP_DDRCLK_SIP),
140111551005SXing Zheng };
140211551005SXing Zheng 
140311551005SXing Zheng static struct rockchip_clk_branch rk3399_clk_pmu_branches[] __initdata = {
140411551005SXing Zheng 	/*
140511551005SXing Zheng 	 * PMU CRU Clock-Architecture
140611551005SXing Zheng 	 */
140711551005SXing Zheng 
140850961e83SXing Zheng 	GATE(0, "fclk_cm0s_pmu_ppll_src", "ppll", 0,
140911551005SXing Zheng 			RK3399_PMU_CLKGATE_CON(0), 1, GFLAGS),
141011551005SXing Zheng 
141150961e83SXing Zheng 	COMPOSITE_NOGATE(FCLK_CM0S_SRC_PMU, "fclk_cm0s_src_pmu", mux_fclk_cm0s_pmu_ppll_p, 0,
141211551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(0), 15, 1, MFLAGS, 8, 5, DFLAGS),
141311551005SXing Zheng 
141450961e83SXing Zheng 	COMPOSITE(SCLK_SPI3_PMU, "clk_spi3_pmu", mux_24m_ppll_p, 0,
141511551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(1), 7, 1, MFLAGS, 0, 7, DFLAGS,
141611551005SXing Zheng 			RK3399_PMU_CLKGATE_CON(0), 2, GFLAGS),
141711551005SXing Zheng 
141811551005SXing Zheng 	COMPOSITE(0, "clk_wifi_div", mux_ppll_24m_p, CLK_IGNORE_UNUSED,
141911551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(1), 13, 1, MFLAGS, 8, 5, DFLAGS,
142011551005SXing Zheng 			RK3399_PMU_CLKGATE_CON(0), 8, GFLAGS),
142111551005SXing Zheng 
142229edeccbSDouglas Anderson 	COMPOSITE_FRACMUX_NOGATE(0, "clk_wifi_frac", "clk_wifi_div", 0,
142311551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(7), 0,
142411551005SXing Zheng 			&rk3399_pmuclk_wifi_fracmux),
142511551005SXing Zheng 
142611551005SXing Zheng 	MUX(0, "clk_timer_src_pmu", mux_pll_p, CLK_IGNORE_UNUSED,
142711551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(1), 15, 1, MFLAGS),
142811551005SXing Zheng 
142911551005SXing Zheng 	COMPOSITE_NOMUX(SCLK_I2C0_PMU, "clk_i2c0_pmu", "ppll", 0,
143011551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(2), 0, 7, DFLAGS,
143111551005SXing Zheng 			RK3399_PMU_CLKGATE_CON(0), 9, GFLAGS),
143211551005SXing Zheng 
143311551005SXing Zheng 	COMPOSITE_NOMUX(SCLK_I2C4_PMU, "clk_i2c4_pmu", "ppll", 0,
143411551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(3), 0, 7, DFLAGS,
1435f3d40914SXing Zheng 			RK3399_PMU_CLKGATE_CON(0), 10, GFLAGS),
143611551005SXing Zheng 
143711551005SXing Zheng 	COMPOSITE_NOMUX(SCLK_I2C8_PMU, "clk_i2c8_pmu", "ppll", 0,
143811551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(2), 8, 7, DFLAGS,
1439f3d40914SXing Zheng 			RK3399_PMU_CLKGATE_CON(0), 11, GFLAGS),
144011551005SXing Zheng 
144111551005SXing Zheng 	DIV(0, "clk_32k_suspend_pmu", "xin24m", CLK_IGNORE_UNUSED,
144211551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(4), 0, 10, DFLAGS),
144311551005SXing Zheng 	MUX(0, "clk_testout_2io", mux_clk_testout2_2io_p, CLK_IGNORE_UNUSED,
144411551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(4), 15, 1, MFLAGS),
144511551005SXing Zheng 
144650961e83SXing Zheng 	COMPOSITE(0, "clk_uart4_div", mux_24m_ppll_p, 0,
144711551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(5), 10, 1, MFLAGS, 0, 7, DFLAGS,
144811551005SXing Zheng 			RK3399_PMU_CLKGATE_CON(0), 5, GFLAGS),
144911551005SXing Zheng 
145029edeccbSDouglas Anderson 	COMPOSITE_FRACMUX(0, "clk_uart4_frac", "clk_uart4_div", 0,
145111551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(6), 0,
145211551005SXing Zheng 			RK3399_PMU_CLKGATE_CON(0), 6, GFLAGS,
145311551005SXing Zheng 			&rk3399_uart4_pmu_fracmux),
145411551005SXing Zheng 
145511551005SXing Zheng 	DIV(PCLK_SRC_PMU, "pclk_pmu_src", "ppll", CLK_IGNORE_UNUSED,
145611551005SXing Zheng 			RK3399_PMU_CLKSEL_CON(0), 0, 5, DFLAGS),
145711551005SXing Zheng 
145811551005SXing Zheng 	/* pmu clock gates */
145950961e83SXing Zheng 	GATE(SCLK_TIMER12_PMU, "clk_timer0_pmu", "clk_timer_src_pmu", 0, RK3399_PMU_CLKGATE_CON(0), 3, GFLAGS),
146050961e83SXing Zheng 	GATE(SCLK_TIMER13_PMU, "clk_timer1_pmu", "clk_timer_src_pmu", 0, RK3399_PMU_CLKGATE_CON(0), 4, GFLAGS),
146111551005SXing Zheng 
146211551005SXing Zheng 	GATE(SCLK_PVTM_PMU, "clk_pvtm_pmu", "xin24m", CLK_IGNORE_UNUSED, RK3399_PMU_CLKGATE_CON(0), 7, GFLAGS),
146311551005SXing Zheng 
146411551005SXing Zheng 	GATE(PCLK_PMU, "pclk_pmu", "pclk_pmu_src", CLK_IGNORE_UNUSED, RK3399_PMU_CLKGATE_CON(1), 0, GFLAGS),
146511551005SXing Zheng 	GATE(PCLK_PMUGRF_PMU, "pclk_pmugrf_pmu", "pclk_pmu_src", CLK_IGNORE_UNUSED, RK3399_PMU_CLKGATE_CON(1), 1, GFLAGS),
146611551005SXing Zheng 	GATE(PCLK_INTMEM1_PMU, "pclk_intmem1_pmu", "pclk_pmu_src", CLK_IGNORE_UNUSED, RK3399_PMU_CLKGATE_CON(1), 2, GFLAGS),
146750961e83SXing Zheng 	GATE(PCLK_GPIO0_PMU, "pclk_gpio0_pmu", "pclk_pmu_src", 0, RK3399_PMU_CLKGATE_CON(1), 3, GFLAGS),
146850961e83SXing Zheng 	GATE(PCLK_GPIO1_PMU, "pclk_gpio1_pmu", "pclk_pmu_src", 0, RK3399_PMU_CLKGATE_CON(1), 4, GFLAGS),
146911551005SXing Zheng 	GATE(PCLK_SGRF_PMU, "pclk_sgrf_pmu", "pclk_pmu_src", CLK_IGNORE_UNUSED, RK3399_PMU_CLKGATE_CON(1), 5, GFLAGS),
147011551005SXing Zheng 	GATE(PCLK_NOC_PMU, "pclk_noc_pmu", "pclk_pmu_src", CLK_IGNORE_UNUSED, RK3399_PMU_CLKGATE_CON(1), 6, GFLAGS),
147150961e83SXing Zheng 	GATE(PCLK_I2C0_PMU, "pclk_i2c0_pmu", "pclk_pmu_src", 0, RK3399_PMU_CLKGATE_CON(1), 7, GFLAGS),
147250961e83SXing Zheng 	GATE(PCLK_I2C4_PMU, "pclk_i2c4_pmu", "pclk_pmu_src", 0, RK3399_PMU_CLKGATE_CON(1), 8, GFLAGS),
147350961e83SXing Zheng 	GATE(PCLK_I2C8_PMU, "pclk_i2c8_pmu", "pclk_pmu_src", 0, RK3399_PMU_CLKGATE_CON(1), 9, GFLAGS),
147450961e83SXing Zheng 	GATE(PCLK_RKPWM_PMU, "pclk_rkpwm_pmu", "pclk_pmu_src", 0, RK3399_PMU_CLKGATE_CON(1), 10, GFLAGS),
147550961e83SXing Zheng 	GATE(PCLK_SPI3_PMU, "pclk_spi3_pmu", "pclk_pmu_src", 0, RK3399_PMU_CLKGATE_CON(1), 11, GFLAGS),
147650961e83SXing Zheng 	GATE(PCLK_TIMER_PMU, "pclk_timer_pmu", "pclk_pmu_src", 0, RK3399_PMU_CLKGATE_CON(1), 12, GFLAGS),
147750961e83SXing Zheng 	GATE(PCLK_MAILBOX_PMU, "pclk_mailbox_pmu", "pclk_pmu_src", 0, RK3399_PMU_CLKGATE_CON(1), 13, GFLAGS),
147850961e83SXing Zheng 	GATE(PCLK_UART4_PMU, "pclk_uart4_pmu", "pclk_pmu_src", 0, RK3399_PMU_CLKGATE_CON(1), 14, GFLAGS),
147950961e83SXing Zheng 	GATE(PCLK_WDT_M0_PMU, "pclk_wdt_m0_pmu", "pclk_pmu_src", 0, RK3399_PMU_CLKGATE_CON(1), 15, GFLAGS),
148011551005SXing Zheng 
148160aadea5SDouglas Anderson 	GATE(FCLK_CM0S_PMU, "fclk_cm0s_pmu", "fclk_cm0s_src_pmu", CLK_IGNORE_UNUSED, RK3399_PMU_CLKGATE_CON(2), 0, GFLAGS),
148260aadea5SDouglas Anderson 	GATE(SCLK_CM0S_PMU, "sclk_cm0s_pmu", "fclk_cm0s_src_pmu", CLK_IGNORE_UNUSED, RK3399_PMU_CLKGATE_CON(2), 1, GFLAGS),
148360aadea5SDouglas Anderson 	GATE(HCLK_CM0S_PMU, "hclk_cm0s_pmu", "fclk_cm0s_src_pmu", CLK_IGNORE_UNUSED, RK3399_PMU_CLKGATE_CON(2), 2, GFLAGS),
148460aadea5SDouglas Anderson 	GATE(DCLK_CM0S_PMU, "dclk_cm0s_pmu", "fclk_cm0s_src_pmu", CLK_IGNORE_UNUSED, RK3399_PMU_CLKGATE_CON(2), 3, GFLAGS),
148511551005SXing Zheng 	GATE(HCLK_NOC_PMU, "hclk_noc_pmu", "fclk_cm0s_src_pmu", CLK_IGNORE_UNUSED, RK3399_PMU_CLKGATE_CON(2), 5, GFLAGS),
148611551005SXing Zheng };
148711551005SXing Zheng 
148811551005SXing Zheng static const char *const rk3399_cru_critical_clocks[] __initconst = {
148911551005SXing Zheng 	"aclk_cci_pre",
1490176df69cSBrian Norris 	"aclk_gic",
1491176df69cSBrian Norris 	"aclk_gic_noc",
149254479449SChris Zhong 	"aclk_hdcp_noc",
149354479449SChris Zhong 	"hclk_hdcp_noc",
149454479449SChris Zhong 	"pclk_hdcp_noc",
149511551005SXing Zheng 	"pclk_perilp0",
149611551005SXing Zheng 	"pclk_perilp0",
149711551005SXing Zheng 	"hclk_perilp0",
149811551005SXing Zheng 	"hclk_perilp0_noc",
149911551005SXing Zheng 	"pclk_perilp1",
150011551005SXing Zheng 	"pclk_perilp1_noc",
150111551005SXing Zheng 	"pclk_perihp",
150211551005SXing Zheng 	"pclk_perihp_noc",
150311551005SXing Zheng 	"hclk_perihp",
150411551005SXing Zheng 	"aclk_perihp",
150511551005SXing Zheng 	"aclk_perihp_noc",
150611551005SXing Zheng 	"aclk_perilp0",
150711551005SXing Zheng 	"aclk_perilp0_noc",
150811551005SXing Zheng 	"hclk_perilp1",
150911551005SXing Zheng 	"hclk_perilp1_noc",
151011551005SXing Zheng 	"aclk_dmac0_perilp",
1511a45f9d41SXing Zheng 	"aclk_emmc_noc",
151211551005SXing Zheng 	"gpll_hclk_perilp1_src",
151311551005SXing Zheng 	"gpll_aclk_perilp0_src",
151411551005SXing Zheng 	"gpll_aclk_perihp_src",
151554479449SChris Zhong 	"aclk_vio_noc",
1516464b9eebSLin Huang 
1517464b9eebSLin Huang 	/* ddrc */
1518464b9eebSLin Huang 	"sclk_ddrc"
151911551005SXing Zheng };
152011551005SXing Zheng 
152111551005SXing Zheng static const char *const rk3399_pmucru_critical_clocks[] __initconst = {
152211551005SXing Zheng 	"ppll",
152311551005SXing Zheng 	"pclk_pmu_src",
152411551005SXing Zheng 	"fclk_cm0s_src_pmu",
152511551005SXing Zheng 	"clk_timer_src_pmu",
1526*640332d1SLevin Du 	"pclk_rkpwm_pmu",
152711551005SXing Zheng };
152811551005SXing Zheng 
152911551005SXing Zheng static void __init rk3399_clk_init(struct device_node *np)
153011551005SXing Zheng {
153111551005SXing Zheng 	struct rockchip_clk_provider *ctx;
153211551005SXing Zheng 	void __iomem *reg_base;
153326e0ee1cSXing Zheng 	struct clk *clk;
153411551005SXing Zheng 
153511551005SXing Zheng 	reg_base = of_iomap(np, 0);
153611551005SXing Zheng 	if (!reg_base) {
153711551005SXing Zheng 		pr_err("%s: could not map cru region\n", __func__);
153811551005SXing Zheng 		return;
153911551005SXing Zheng 	}
154011551005SXing Zheng 
154111551005SXing Zheng 	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
154211551005SXing Zheng 	if (IS_ERR(ctx)) {
154311551005SXing Zheng 		pr_err("%s: rockchip clk init failed\n", __func__);
154462d0e71dSShawn Lin 		iounmap(reg_base);
154511551005SXing Zheng 		return;
154611551005SXing Zheng 	}
154711551005SXing Zheng 
154826e0ee1cSXing Zheng 	/* Watchdog pclk is controlled by RK3399 SECURE_GRF_SOC_CON3[8]. */
154926e0ee1cSXing Zheng 	clk = clk_register_fixed_factor(NULL, "pclk_wdt", "pclk_alive", 0, 1, 1);
155026e0ee1cSXing Zheng 	if (IS_ERR(clk))
155126e0ee1cSXing Zheng 		pr_warn("%s: could not register clock pclk_wdt: %ld\n",
155226e0ee1cSXing Zheng 			__func__, PTR_ERR(clk));
155326e0ee1cSXing Zheng 	else
155426e0ee1cSXing Zheng 		rockchip_clk_add_lookup(ctx, clk, PCLK_WDT);
155526e0ee1cSXing Zheng 
155611551005SXing Zheng 	rockchip_clk_register_plls(ctx, rk3399_pll_clks,
155711551005SXing Zheng 				   ARRAY_SIZE(rk3399_pll_clks), -1);
155811551005SXing Zheng 
155911551005SXing Zheng 	rockchip_clk_register_branches(ctx, rk3399_clk_branches,
156011551005SXing Zheng 				  ARRAY_SIZE(rk3399_clk_branches));
156111551005SXing Zheng 
156211551005SXing Zheng 	rockchip_clk_protect_critical(rk3399_cru_critical_clocks,
156311551005SXing Zheng 				      ARRAY_SIZE(rk3399_cru_critical_clocks));
156411551005SXing Zheng 
156511551005SXing Zheng 	rockchip_clk_register_armclk(ctx, ARMCLKL, "armclkl",
156611551005SXing Zheng 			mux_armclkl_p, ARRAY_SIZE(mux_armclkl_p),
156711551005SXing Zheng 			&rk3399_cpuclkl_data, rk3399_cpuclkl_rates,
156811551005SXing Zheng 			ARRAY_SIZE(rk3399_cpuclkl_rates));
156911551005SXing Zheng 
157011551005SXing Zheng 	rockchip_clk_register_armclk(ctx, ARMCLKB, "armclkb",
157111551005SXing Zheng 			mux_armclkb_p, ARRAY_SIZE(mux_armclkb_p),
157211551005SXing Zheng 			&rk3399_cpuclkb_data, rk3399_cpuclkb_rates,
157311551005SXing Zheng 			ARRAY_SIZE(rk3399_cpuclkb_rates));
157411551005SXing Zheng 
157511551005SXing Zheng 	rockchip_register_softrst(np, 21, reg_base + RK3399_SOFTRST_CON(0),
157611551005SXing Zheng 				  ROCKCHIP_SOFTRST_HIWORD_MASK);
157711551005SXing Zheng 
157811551005SXing Zheng 	rockchip_register_restart_notifier(ctx, RK3399_GLB_SRST_FST, NULL);
157911551005SXing Zheng 
158011551005SXing Zheng 	rockchip_clk_of_add_provider(np, ctx);
158111551005SXing Zheng }
158211551005SXing Zheng CLK_OF_DECLARE(rk3399_cru, "rockchip,rk3399-cru", rk3399_clk_init);
158311551005SXing Zheng 
158411551005SXing Zheng static void __init rk3399_pmu_clk_init(struct device_node *np)
158511551005SXing Zheng {
158611551005SXing Zheng 	struct rockchip_clk_provider *ctx;
158711551005SXing Zheng 	void __iomem *reg_base;
158811551005SXing Zheng 
158911551005SXing Zheng 	reg_base = of_iomap(np, 0);
159011551005SXing Zheng 	if (!reg_base) {
159111551005SXing Zheng 		pr_err("%s: could not map cru pmu region\n", __func__);
159211551005SXing Zheng 		return;
159311551005SXing Zheng 	}
159411551005SXing Zheng 
159511551005SXing Zheng 	ctx = rockchip_clk_init(np, reg_base, CLKPMU_NR_CLKS);
159611551005SXing Zheng 	if (IS_ERR(ctx)) {
159711551005SXing Zheng 		pr_err("%s: rockchip pmu clk init failed\n", __func__);
159862d0e71dSShawn Lin 		iounmap(reg_base);
159911551005SXing Zheng 		return;
160011551005SXing Zheng 	}
160111551005SXing Zheng 
160211551005SXing Zheng 	rockchip_clk_register_plls(ctx, rk3399_pmu_pll_clks,
160311551005SXing Zheng 				   ARRAY_SIZE(rk3399_pmu_pll_clks), -1);
160411551005SXing Zheng 
160511551005SXing Zheng 	rockchip_clk_register_branches(ctx, rk3399_clk_pmu_branches,
160611551005SXing Zheng 				  ARRAY_SIZE(rk3399_clk_pmu_branches));
160711551005SXing Zheng 
160811551005SXing Zheng 	rockchip_clk_protect_critical(rk3399_pmucru_critical_clocks,
160911551005SXing Zheng 				  ARRAY_SIZE(rk3399_pmucru_critical_clocks));
161011551005SXing Zheng 
161111551005SXing Zheng 	rockchip_register_softrst(np, 2, reg_base + RK3399_PMU_SOFTRST_CON(0),
161211551005SXing Zheng 				  ROCKCHIP_SOFTRST_HIWORD_MASK);
161311551005SXing Zheng 
161411551005SXing Zheng 	rockchip_clk_of_add_provider(np, ctx);
161511551005SXing Zheng }
161611551005SXing Zheng CLK_OF_DECLARE(rk3399_cru_pmu, "rockchip,rk3399-pmucru", rk3399_pmu_clk_init);
1617