xref: /linux/drivers/clk/sprd/sc9860-clk.c (revision a1c613ae4c322ddd58d5a8539dbfba2a0380a8c0)
1a6ae1a29SChunyan Zhang // SPDX-License-Identifier: GPL-2.0
2a6ae1a29SChunyan Zhang //
3a6ae1a29SChunyan Zhang // Spreatrum SC9860 clock driver
4a6ae1a29SChunyan Zhang //
5a6ae1a29SChunyan Zhang // Copyright (C) 2017 Spreadtrum, Inc.
6a6ae1a29SChunyan Zhang // Author: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
7a6ae1a29SChunyan Zhang 
8a6ae1a29SChunyan Zhang #include <linux/clk-provider.h>
9a6ae1a29SChunyan Zhang #include <linux/err.h>
10a6ae1a29SChunyan Zhang #include <linux/io.h>
11a6ae1a29SChunyan Zhang #include <linux/module.h>
12*a96cbb14SRob Herring #include <linux/of.h>
13a6ae1a29SChunyan Zhang #include <linux/platform_device.h>
14a6ae1a29SChunyan Zhang #include <linux/slab.h>
15a6ae1a29SChunyan Zhang 
16a6ae1a29SChunyan Zhang #include <dt-bindings/clock/sprd,sc9860-clk.h>
17a6ae1a29SChunyan Zhang 
18a6ae1a29SChunyan Zhang #include "common.h"
19a6ae1a29SChunyan Zhang #include "composite.h"
20a6ae1a29SChunyan Zhang #include "div.h"
21a6ae1a29SChunyan Zhang #include "gate.h"
22a6ae1a29SChunyan Zhang #include "mux.h"
23a6ae1a29SChunyan Zhang #include "pll.h"
24a6ae1a29SChunyan Zhang 
25a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(fac_4m,		"fac-4m",	"ext-26m",
26a6ae1a29SChunyan Zhang 			6, 1, 0);
27a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(fac_2m,		"fac-2m",	"ext-26m",
28a6ae1a29SChunyan Zhang 			13, 1, 0);
29a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(fac_1m,		"fac-1m",	"ext-26m",
30a6ae1a29SChunyan Zhang 			26, 1, 0);
31a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(fac_250k,	"fac-250k",	"ext-26m",
32a6ae1a29SChunyan Zhang 			104, 1, 0);
33a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(fac_rpll0_26m,	"rpll0-26m",	"ext-26m",
34a6ae1a29SChunyan Zhang 			1, 1, 0);
35a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(fac_rpll1_26m,	"rpll1-26m",	"ext-26m",
36a6ae1a29SChunyan Zhang 			1, 1, 0);
37a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(fac_rco_25m,	"rco-25m",	"ext-rc0-100m",
38a6ae1a29SChunyan Zhang 			4, 1, 0);
39a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(fac_rco_4m,	"rco-4m",	"ext-rc0-100m",
40a6ae1a29SChunyan Zhang 			25, 1, 0);
41a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(fac_rco_2m,	"rco-2m",	"ext-rc0-100m",
42a6ae1a29SChunyan Zhang 			50, 1, 0);
43a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(fac_3k2,	"fac-3k2",	"ext-32k",
44a6ae1a29SChunyan Zhang 			10, 1, 0);
45a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(fac_1k,		"fac-1k",	"ext-32k",
46a6ae1a29SChunyan Zhang 			32, 1, 0);
47a6ae1a29SChunyan Zhang 
48a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(mpll0_gate,	"mpll0-gate",	"ext-26m", 0xb0,
49a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
50a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(mpll1_gate,	"mpll1-gate",	"ext-26m", 0xb0,
51a6ae1a29SChunyan Zhang 		     0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
52a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dpll0_gate,	"dpll0-gate",	"ext-26m", 0xb4,
53a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
54a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dpll1_gate,	"dpll1-gate",	"ext-26m", 0xb4,
55a6ae1a29SChunyan Zhang 		     0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
56a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ltepll0_gate,	"ltepll0-gate",	"ext-26m", 0xb8,
57a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
58a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(twpll_gate,	"twpll-gate",	"ext-26m", 0xbc,
59a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
60a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ltepll1_gate,	"ltepll1-gate",	"ext-26m", 0x10c,
61a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
62a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(rpll0_gate,	"rpll0-gate",	"ext-26m", 0x16c,
63a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), 0, 0);
64a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(rpll1_gate,	"rpll1-gate",	"ext-26m", 0x16c,
65a6ae1a29SChunyan Zhang 		     0x1000, BIT(18), 0, 0);
66a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(cppll_gate,	"cppll-gate",	"ext-26m", 0x2b4,
67a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
68a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gpll_gate,	"gpll-gate",	"ext-26m", 0x32c,
69a6ae1a29SChunyan Zhang 		0x1000, BIT(0), CLK_IGNORE_UNUSED, CLK_GATE_SET_TO_DISABLE);
70a6ae1a29SChunyan Zhang 
71a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_pmu_gate_clks[] = {
72a6ae1a29SChunyan Zhang 	/* address base is 0x402b0000 */
73a6ae1a29SChunyan Zhang 	&mpll0_gate.common,
74a6ae1a29SChunyan Zhang 	&mpll1_gate.common,
75a6ae1a29SChunyan Zhang 	&dpll0_gate.common,
76a6ae1a29SChunyan Zhang 	&dpll1_gate.common,
77a6ae1a29SChunyan Zhang 	&ltepll0_gate.common,
78a6ae1a29SChunyan Zhang 	&twpll_gate.common,
79a6ae1a29SChunyan Zhang 	&ltepll1_gate.common,
80a6ae1a29SChunyan Zhang 	&rpll0_gate.common,
81a6ae1a29SChunyan Zhang 	&rpll1_gate.common,
82a6ae1a29SChunyan Zhang 	&cppll_gate.common,
83a6ae1a29SChunyan Zhang 	&gpll_gate.common,
84a6ae1a29SChunyan Zhang };
85a6ae1a29SChunyan Zhang 
86a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_pmu_gate_hws = {
87a6ae1a29SChunyan Zhang 	.hws	= {
88a6ae1a29SChunyan Zhang 		[CLK_FAC_4M]		= &fac_4m.hw,
89a6ae1a29SChunyan Zhang 		[CLK_FAC_2M]		= &fac_2m.hw,
90a6ae1a29SChunyan Zhang 		[CLK_FAC_1M]		= &fac_1m.hw,
91a6ae1a29SChunyan Zhang 		[CLK_FAC_250K]		= &fac_250k.hw,
92a6ae1a29SChunyan Zhang 		[CLK_FAC_RPLL0_26M]	= &fac_rpll0_26m.hw,
93a6ae1a29SChunyan Zhang 		[CLK_FAC_RPLL1_26M]	= &fac_rpll1_26m.hw,
94a6ae1a29SChunyan Zhang 		[CLK_FAC_RCO25M]	= &fac_rco_25m.hw,
95a6ae1a29SChunyan Zhang 		[CLK_FAC_RCO4M]		= &fac_rco_4m.hw,
96a6ae1a29SChunyan Zhang 		[CLK_FAC_RCO2M]		= &fac_rco_2m.hw,
97a6ae1a29SChunyan Zhang 		[CLK_FAC_3K2]		= &fac_3k2.hw,
98a6ae1a29SChunyan Zhang 		[CLK_FAC_1K]		= &fac_1k.hw,
99a6ae1a29SChunyan Zhang 		[CLK_MPLL0_GATE]	= &mpll0_gate.common.hw,
100a6ae1a29SChunyan Zhang 		[CLK_MPLL1_GATE]	= &mpll1_gate.common.hw,
101a6ae1a29SChunyan Zhang 		[CLK_DPLL0_GATE]	= &dpll0_gate.common.hw,
102a6ae1a29SChunyan Zhang 		[CLK_DPLL1_GATE]	= &dpll1_gate.common.hw,
103a6ae1a29SChunyan Zhang 		[CLK_LTEPLL0_GATE]	= &ltepll0_gate.common.hw,
104a6ae1a29SChunyan Zhang 		[CLK_TWPLL_GATE]	= &twpll_gate.common.hw,
105a6ae1a29SChunyan Zhang 		[CLK_LTEPLL1_GATE]	= &ltepll1_gate.common.hw,
106a6ae1a29SChunyan Zhang 		[CLK_RPLL0_GATE]	= &rpll0_gate.common.hw,
107a6ae1a29SChunyan Zhang 		[CLK_RPLL1_GATE]	= &rpll1_gate.common.hw,
108a6ae1a29SChunyan Zhang 		[CLK_CPPLL_GATE]	= &cppll_gate.common.hw,
109a6ae1a29SChunyan Zhang 		[CLK_GPLL_GATE]		= &gpll_gate.common.hw,
110a6ae1a29SChunyan Zhang 	},
111a6ae1a29SChunyan Zhang 	.num	= CLK_PMU_GATE_NUM,
112a6ae1a29SChunyan Zhang };
113a6ae1a29SChunyan Zhang 
114a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_pmu_gate_desc = {
115a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_pmu_gate_clks,
116a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_pmu_gate_clks),
117a6ae1a29SChunyan Zhang 	.hw_clks        = &sc9860_pmu_gate_hws,
118a6ae1a29SChunyan Zhang };
119a6ae1a29SChunyan Zhang 
120a6ae1a29SChunyan Zhang /* GPLL/LPLL/DPLL/RPLL/CPLL */
121a6ae1a29SChunyan Zhang static const u64 itable1[4] = {3, 780000000, 988000000, 1196000000};
122a6ae1a29SChunyan Zhang 
123a6ae1a29SChunyan Zhang /* TWPLL/MPLL0/MPLL1 */
124a6ae1a29SChunyan Zhang static const u64 itable2[4] = {3, 1638000000, 2080000000, 2600000000UL};
125a6ae1a29SChunyan Zhang 
126a6ae1a29SChunyan Zhang static const struct clk_bit_field f_mpll0[PLL_FACT_MAX] = {
127a6ae1a29SChunyan Zhang 	{ .shift = 20,	.width = 1 },	/* lock_done	*/
128a6ae1a29SChunyan Zhang 	{ .shift = 19,	.width = 1 },	/* div_s	*/
129a6ae1a29SChunyan Zhang 	{ .shift = 18,	.width = 1 },	/* mod_en	*/
130a6ae1a29SChunyan Zhang 	{ .shift = 17,	.width = 1 },	/* sdm_en	*/
131a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* refin	*/
132a6ae1a29SChunyan Zhang 	{ .shift = 11,	.width = 2 },	/* ibias	*/
133a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 7 },	/* n		*/
134a6ae1a29SChunyan Zhang 	{ .shift = 57,	.width = 7 },	/* nint		*/
135a6ae1a29SChunyan Zhang 	{ .shift = 32,	.width = 23},	/* kint		*/
136a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* prediv	*/
137a6ae1a29SChunyan Zhang 	{ .shift = 56,	.width = 1 },	/* postdiv	*/
138a6ae1a29SChunyan Zhang };
139a6ae1a29SChunyan Zhang static SPRD_PLL_WITH_ITABLE_K_FVCO(mpll0_clk, "mpll0", "mpll0-gate", 0x24,
140a6ae1a29SChunyan Zhang 				   2, itable2, f_mpll0, 200,
141a6ae1a29SChunyan Zhang 				   1000, 1000, 1, 1300000000);
142a6ae1a29SChunyan Zhang 
143a6ae1a29SChunyan Zhang static const struct clk_bit_field f_mpll1[PLL_FACT_MAX] = {
144a6ae1a29SChunyan Zhang 	{ .shift = 20,	.width = 1 },	/* lock_done	*/
145a6ae1a29SChunyan Zhang 	{ .shift = 19,	.width = 1 },	/* div_s	*/
146a6ae1a29SChunyan Zhang 	{ .shift = 18,	.width = 1 },	/* mod_en	*/
147a6ae1a29SChunyan Zhang 	{ .shift = 17,	.width = 1 },	/* sdm_en	*/
148a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* refin	*/
149a6ae1a29SChunyan Zhang 	{ .shift = 11,	.width = 2 },	/* ibias	*/
150a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 7 },	/* n		*/
151a6ae1a29SChunyan Zhang 	{ .shift = 57,	.width = 7 },	/* nint		*/
152a6ae1a29SChunyan Zhang 	{ .shift = 32,	.width = 23},	/* kint		*/
153a6ae1a29SChunyan Zhang 	{ .shift = 56,	.width = 1 },	/* prediv	*/
154a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* postdiv	*/
155a6ae1a29SChunyan Zhang };
156a6ae1a29SChunyan Zhang static SPRD_PLL_WITH_ITABLE_1K(mpll1_clk, "mpll1", "mpll1-gate", 0x2c,
157a6ae1a29SChunyan Zhang 			       2, itable2, f_mpll1, 200);
158a6ae1a29SChunyan Zhang 
159a6ae1a29SChunyan Zhang static const struct clk_bit_field f_dpll[PLL_FACT_MAX] = {
160a6ae1a29SChunyan Zhang 	{ .shift = 16,	.width = 1 },	/* lock_done	*/
161a6ae1a29SChunyan Zhang 	{ .shift = 15,	.width = 1 },	/* div_s	*/
162a6ae1a29SChunyan Zhang 	{ .shift = 14,	.width = 1 },	/* mod_en	*/
163a6ae1a29SChunyan Zhang 	{ .shift = 13,	.width = 1 },	/* sdm_en	*/
164a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* refin	*/
165a6ae1a29SChunyan Zhang 	{ .shift = 8,	.width = 2 },	/* ibias	*/
166a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 7 },	/* n		*/
167a6ae1a29SChunyan Zhang 	{ .shift = 57,	.width = 7 },	/* nint		*/
168a6ae1a29SChunyan Zhang 	{ .shift = 32,	.width = 23},	/* kint		*/
169a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* prediv	*/
170a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* postdiv	*/
171a6ae1a29SChunyan Zhang };
172a6ae1a29SChunyan Zhang static SPRD_PLL_WITH_ITABLE_1K(dpll0_clk, "dpll0", "dpll0-gate", 0x34,
173a6ae1a29SChunyan Zhang 			       2, itable1, f_dpll, 200);
174a6ae1a29SChunyan Zhang 
175a6ae1a29SChunyan Zhang static SPRD_PLL_WITH_ITABLE_1K(dpll1_clk, "dpll1", "dpll1-gate", 0x3c,
176a6ae1a29SChunyan Zhang 			       2, itable1, f_dpll, 200);
177a6ae1a29SChunyan Zhang 
178a6ae1a29SChunyan Zhang static const struct clk_bit_field f_rpll[PLL_FACT_MAX] = {
179a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 1 },	/* lock_done	*/
180a6ae1a29SChunyan Zhang 	{ .shift = 3,	.width = 1 },	/* div_s	*/
181a6ae1a29SChunyan Zhang 	{ .shift = 80,	.width = 1 },	/* mod_en	*/
182a6ae1a29SChunyan Zhang 	{ .shift = 81,	.width = 1 },	/* sdm_en	*/
183a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* refin	*/
184a6ae1a29SChunyan Zhang 	{ .shift = 14,	.width = 2 },	/* ibias	*/
185a6ae1a29SChunyan Zhang 	{ .shift = 16,	.width = 7 },	/* n		*/
186a6ae1a29SChunyan Zhang 	{ .shift = 4,	.width = 7 },	/* nint		*/
187a6ae1a29SChunyan Zhang 	{ .shift = 32,	.width = 23},	/* kint		*/
188a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* prediv	*/
189a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* postdiv	*/
190a6ae1a29SChunyan Zhang };
191a6ae1a29SChunyan Zhang static SPRD_PLL_WITH_ITABLE_1K(rpll0_clk, "rpll0", "rpll0-gate", 0x44,
192a6ae1a29SChunyan Zhang 			       3, itable1, f_rpll, 200);
193a6ae1a29SChunyan Zhang 
194a6ae1a29SChunyan Zhang static SPRD_PLL_WITH_ITABLE_1K(rpll1_clk, "rpll1", "rpll1-gate", 0x50,
195a6ae1a29SChunyan Zhang 			       3, itable1, f_rpll, 200);
196a6ae1a29SChunyan Zhang 
197a6ae1a29SChunyan Zhang static const struct clk_bit_field f_twpll[PLL_FACT_MAX] = {
198a6ae1a29SChunyan Zhang 	{ .shift = 21,	.width = 1 },	/* lock_done	*/
199a6ae1a29SChunyan Zhang 	{ .shift = 20,	.width = 1 },	/* div_s	*/
200a6ae1a29SChunyan Zhang 	{ .shift = 19,	.width = 1 },	/* mod_en	*/
201a6ae1a29SChunyan Zhang 	{ .shift = 18,	.width = 1 },	/* sdm_en	*/
202a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* refin	*/
203a6ae1a29SChunyan Zhang 	{ .shift = 13,	.width = 2 },	/* ibias	*/
204a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 7 },	/* n		*/
205a6ae1a29SChunyan Zhang 	{ .shift = 57,	.width = 7 },	/* nint		*/
206a6ae1a29SChunyan Zhang 	{ .shift = 32,	.width = 23},	/* kint		*/
207a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* prediv	*/
208a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* postdiv	*/
209a6ae1a29SChunyan Zhang };
210a6ae1a29SChunyan Zhang static SPRD_PLL_WITH_ITABLE_1K(twpll_clk, "twpll", "twpll-gate", 0x5c,
211a6ae1a29SChunyan Zhang 			       2, itable2, f_twpll, 200);
212a6ae1a29SChunyan Zhang 
213a6ae1a29SChunyan Zhang static const struct clk_bit_field f_ltepll[PLL_FACT_MAX] = {
214a6ae1a29SChunyan Zhang 	{ .shift = 31,	.width = 1 },	/* lock_done	*/
215a6ae1a29SChunyan Zhang 	{ .shift = 27,	.width = 1 },	/* div_s	*/
216a6ae1a29SChunyan Zhang 	{ .shift = 26,	.width = 1 },	/* mod_en	*/
217a6ae1a29SChunyan Zhang 	{ .shift = 25,	.width = 1 },	/* sdm_en	*/
218a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* refin	*/
219a6ae1a29SChunyan Zhang 	{ .shift = 20,	.width = 2 },	/* ibias	*/
220a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 7 },	/* n		*/
221a6ae1a29SChunyan Zhang 	{ .shift = 57,	.width = 7 },	/* nint		*/
222a6ae1a29SChunyan Zhang 	{ .shift = 32,	.width = 23},	/* kint		*/
223a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* prediv	*/
224a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* postdiv	*/
225a6ae1a29SChunyan Zhang };
226a6ae1a29SChunyan Zhang static SPRD_PLL_WITH_ITABLE_1K(ltepll0_clk, "ltepll0", "ltepll0-gate",
227a6ae1a29SChunyan Zhang 			       0x64, 2, itable1,
228a6ae1a29SChunyan Zhang 			       f_ltepll, 200);
229a6ae1a29SChunyan Zhang static SPRD_PLL_WITH_ITABLE_1K(ltepll1_clk, "ltepll1", "ltepll1-gate",
230a6ae1a29SChunyan Zhang 			       0x6c, 2, itable1,
231a6ae1a29SChunyan Zhang 			       f_ltepll, 200);
232a6ae1a29SChunyan Zhang 
233a6ae1a29SChunyan Zhang static const struct clk_bit_field f_gpll[PLL_FACT_MAX] = {
234a6ae1a29SChunyan Zhang 	{ .shift = 18,	.width = 1 },	/* lock_done	*/
235a6ae1a29SChunyan Zhang 	{ .shift = 15,	.width = 1 },	/* div_s	*/
236a6ae1a29SChunyan Zhang 	{ .shift = 14,	.width = 1 },	/* mod_en	*/
237a6ae1a29SChunyan Zhang 	{ .shift = 13,	.width = 1 },	/* sdm_en	*/
238a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* refin	*/
239a6ae1a29SChunyan Zhang 	{ .shift = 8,	.width = 2 },	/* ibias	*/
240a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 7 },	/* n		*/
241a6ae1a29SChunyan Zhang 	{ .shift = 57,	.width = 7 },	/* nint		*/
242a6ae1a29SChunyan Zhang 	{ .shift = 32,	.width = 23},	/* kint		*/
243a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* prediv	*/
244a6ae1a29SChunyan Zhang 	{ .shift = 17,	.width = 1 },	/* postdiv	*/
245a6ae1a29SChunyan Zhang };
246a6ae1a29SChunyan Zhang static SPRD_PLL_WITH_ITABLE_K_FVCO(gpll_clk, "gpll", "gpll-gate", 0x9c,
247a6ae1a29SChunyan Zhang 				   2, itable1, f_gpll, 200,
248a6ae1a29SChunyan Zhang 				   1000, 1000, 1, 600000000);
249a6ae1a29SChunyan Zhang 
250a6ae1a29SChunyan Zhang static const struct clk_bit_field f_cppll[PLL_FACT_MAX] = {
251a6ae1a29SChunyan Zhang 	{ .shift = 17,	.width = 1 },	/* lock_done	*/
252a6ae1a29SChunyan Zhang 	{ .shift = 15,	.width = 1 },	/* div_s	*/
253a6ae1a29SChunyan Zhang 	{ .shift = 14,	.width = 1 },	/* mod_en	*/
254a6ae1a29SChunyan Zhang 	{ .shift = 13,	.width = 1 },	/* sdm_en	*/
255a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* refin	*/
256a6ae1a29SChunyan Zhang 	{ .shift = 8,	.width = 2 },	/* ibias	*/
257a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 7 },	/* n		*/
258a6ae1a29SChunyan Zhang 	{ .shift = 57,	.width = 7 },	/* nint		*/
259a6ae1a29SChunyan Zhang 	{ .shift = 32,	.width = 23},	/* kint		*/
260a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* prediv	*/
261a6ae1a29SChunyan Zhang 	{ .shift = 0,	.width = 0 },	/* postdiv	*/
262a6ae1a29SChunyan Zhang };
263a6ae1a29SChunyan Zhang static SPRD_PLL_WITH_ITABLE_1K(cppll_clk, "cppll", "cppll-gate", 0xc4,
264a6ae1a29SChunyan Zhang 			       2, itable1, f_cppll, 200);
265a6ae1a29SChunyan Zhang 
266a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(gpll_42m5, "gpll-42m5", "gpll", 20, 1, 0);
267a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_768m, "twpll-768m", "twpll", 2, 1, 0);
268a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_384m, "twpll-384m", "twpll", 4, 1, 0);
269a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_192m, "twpll-192m", "twpll", 8, 1, 0);
270a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_96m, "twpll-96m", "twpll", 16, 1, 0);
271a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_48m, "twpll-48m", "twpll", 32, 1, 0);
272a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_24m, "twpll-24m", "twpll", 64, 1, 0);
273a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_12m, "twpll-12m", "twpll", 128, 1, 0);
274a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_512m, "twpll-512m", "twpll", 3, 1, 0);
275a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_256m, "twpll-256m", "twpll", 6, 1, 0);
276a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_128m, "twpll-128m", "twpll", 12, 1, 0);
277a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_64m, "twpll-64m", "twpll", 24, 1, 0);
278a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_307m2, "twpll-307m2", "twpll", 5, 1, 0);
279a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_153m6, "twpll-153m6", "twpll", 10, 1, 0);
280a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_76m8, "twpll-76m8", "twpll", 20, 1, 0);
281a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_51m2, "twpll-51m2", "twpll", 30, 1, 0);
282a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_38m4, "twpll-38m4", "twpll", 40, 1, 0);
283a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(twpll_19m2, "twpll-19m2", "twpll", 80, 1, 0);
284a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(l0_614m4, "l0-614m4", "ltepll0", 2, 1, 0);
285a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(l0_409m6, "l0-409m6", "ltepll0", 3, 1, 0);
286a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(l0_38m, "l0-38m", "ltepll0", 32, 1, 0);
287a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(l1_38m, "l1-38m", "ltepll1", 32, 1, 0);
288a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(rpll0_192m, "rpll0-192m", "rpll0", 6, 1, 0);
289a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(rpll0_96m, "rpll0-96m", "rpll0", 12, 1, 0);
290a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(rpll0_48m, "rpll0-48m", "rpll0", 24, 1, 0);
291a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(rpll1_468m, "rpll1-468m", "rpll1", 2, 1, 0);
292a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(rpll1_192m, "rpll1-192m", "rpll1", 6, 1, 0);
293a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(rpll1_96m, "rpll1-96m", "rpll1", 12, 1, 0);
294a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(rpll1_64m, "rpll1-64m", "rpll1", 18, 1, 0);
295a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(rpll1_48m, "rpll1-48m", "rpll1", 24, 1, 0);
296a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(dpll0_50m, "dpll0-50m", "dpll0", 16, 1, 0);
297a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(dpll1_50m, "dpll1-50m", "dpll1", 16, 1, 0);
298a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(cppll_50m, "cppll-50m", "cppll", 18, 1, 0);
299a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(m0_39m, "m0-39m", "mpll0", 32, 1, 0);
300a6ae1a29SChunyan Zhang static CLK_FIXED_FACTOR(m1_63m, "m1-63m", "mpll1", 32, 1, 0);
301a6ae1a29SChunyan Zhang 
302a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_pll_clks[] = {
303a6ae1a29SChunyan Zhang 	/* address base is 0x40400000 */
304a6ae1a29SChunyan Zhang 	&mpll0_clk.common,
305a6ae1a29SChunyan Zhang 	&mpll1_clk.common,
306a6ae1a29SChunyan Zhang 	&dpll0_clk.common,
307a6ae1a29SChunyan Zhang 	&dpll1_clk.common,
308a6ae1a29SChunyan Zhang 	&rpll0_clk.common,
309a6ae1a29SChunyan Zhang 	&rpll1_clk.common,
310a6ae1a29SChunyan Zhang 	&twpll_clk.common,
311a6ae1a29SChunyan Zhang 	&ltepll0_clk.common,
312a6ae1a29SChunyan Zhang 	&ltepll1_clk.common,
313a6ae1a29SChunyan Zhang 	&gpll_clk.common,
314a6ae1a29SChunyan Zhang 	&cppll_clk.common,
315a6ae1a29SChunyan Zhang };
316a6ae1a29SChunyan Zhang 
317a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_pll_hws = {
318a6ae1a29SChunyan Zhang 	.hws	= {
319a6ae1a29SChunyan Zhang 		[CLK_MPLL0]		= &mpll0_clk.common.hw,
320a6ae1a29SChunyan Zhang 		[CLK_MPLL1]		= &mpll1_clk.common.hw,
321a6ae1a29SChunyan Zhang 		[CLK_DPLL0]		= &dpll0_clk.common.hw,
322a6ae1a29SChunyan Zhang 		[CLK_DPLL1]		= &dpll1_clk.common.hw,
323a6ae1a29SChunyan Zhang 		[CLK_RPLL0]		= &rpll0_clk.common.hw,
324a6ae1a29SChunyan Zhang 		[CLK_RPLL1]		= &rpll1_clk.common.hw,
325a6ae1a29SChunyan Zhang 		[CLK_TWPLL]		= &twpll_clk.common.hw,
326a6ae1a29SChunyan Zhang 		[CLK_LTEPLL0]		= &ltepll0_clk.common.hw,
327a6ae1a29SChunyan Zhang 		[CLK_LTEPLL1]		= &ltepll1_clk.common.hw,
328a6ae1a29SChunyan Zhang 		[CLK_GPLL]		= &gpll_clk.common.hw,
329a6ae1a29SChunyan Zhang 		[CLK_CPPLL]		= &cppll_clk.common.hw,
330a6ae1a29SChunyan Zhang 		[CLK_GPLL_42M5]		= &gpll_42m5.hw,
331a6ae1a29SChunyan Zhang 		[CLK_TWPLL_768M]	= &twpll_768m.hw,
332a6ae1a29SChunyan Zhang 		[CLK_TWPLL_384M]	= &twpll_384m.hw,
333a6ae1a29SChunyan Zhang 		[CLK_TWPLL_192M]	= &twpll_192m.hw,
334a6ae1a29SChunyan Zhang 		[CLK_TWPLL_96M]		= &twpll_96m.hw,
335a6ae1a29SChunyan Zhang 		[CLK_TWPLL_48M]		= &twpll_48m.hw,
336a6ae1a29SChunyan Zhang 		[CLK_TWPLL_24M]		= &twpll_24m.hw,
337a6ae1a29SChunyan Zhang 		[CLK_TWPLL_12M]		= &twpll_12m.hw,
338a6ae1a29SChunyan Zhang 		[CLK_TWPLL_512M]	= &twpll_512m.hw,
339a6ae1a29SChunyan Zhang 		[CLK_TWPLL_256M]	= &twpll_256m.hw,
340a6ae1a29SChunyan Zhang 		[CLK_TWPLL_128M]	= &twpll_128m.hw,
341a6ae1a29SChunyan Zhang 		[CLK_TWPLL_64M]		= &twpll_64m.hw,
342a6ae1a29SChunyan Zhang 		[CLK_TWPLL_307M2]	= &twpll_307m2.hw,
343a6ae1a29SChunyan Zhang 		[CLK_TWPLL_153M6]	= &twpll_153m6.hw,
344a6ae1a29SChunyan Zhang 		[CLK_TWPLL_76M8]	= &twpll_76m8.hw,
345a6ae1a29SChunyan Zhang 		[CLK_TWPLL_51M2]	= &twpll_51m2.hw,
346a6ae1a29SChunyan Zhang 		[CLK_TWPLL_38M4]	= &twpll_38m4.hw,
347a6ae1a29SChunyan Zhang 		[CLK_TWPLL_19M2]	= &twpll_19m2.hw,
348a6ae1a29SChunyan Zhang 		[CLK_L0_614M4]		= &l0_614m4.hw,
349a6ae1a29SChunyan Zhang 		[CLK_L0_409M6]		= &l0_409m6.hw,
350a6ae1a29SChunyan Zhang 		[CLK_L0_38M]		= &l0_38m.hw,
351a6ae1a29SChunyan Zhang 		[CLK_L1_38M]		= &l1_38m.hw,
352a6ae1a29SChunyan Zhang 		[CLK_RPLL0_192M]	= &rpll0_192m.hw,
353a6ae1a29SChunyan Zhang 		[CLK_RPLL0_96M]		= &rpll0_96m.hw,
354a6ae1a29SChunyan Zhang 		[CLK_RPLL0_48M]		= &rpll0_48m.hw,
355a6ae1a29SChunyan Zhang 		[CLK_RPLL1_468M]	= &rpll1_468m.hw,
356a6ae1a29SChunyan Zhang 		[CLK_RPLL1_192M]	= &rpll1_192m.hw,
357a6ae1a29SChunyan Zhang 		[CLK_RPLL1_96M]		= &rpll1_96m.hw,
358a6ae1a29SChunyan Zhang 		[CLK_RPLL1_64M]		= &rpll1_64m.hw,
359a6ae1a29SChunyan Zhang 		[CLK_RPLL1_48M]		= &rpll1_48m.hw,
360a6ae1a29SChunyan Zhang 		[CLK_DPLL0_50M]		= &dpll0_50m.hw,
361a6ae1a29SChunyan Zhang 		[CLK_DPLL1_50M]		= &dpll1_50m.hw,
362a6ae1a29SChunyan Zhang 		[CLK_CPPLL_50M]		= &cppll_50m.hw,
363a6ae1a29SChunyan Zhang 		[CLK_M0_39M]		= &m0_39m.hw,
364a6ae1a29SChunyan Zhang 		[CLK_M1_63M]		= &m1_63m.hw,
365a6ae1a29SChunyan Zhang 	},
366a6ae1a29SChunyan Zhang 	.num	= CLK_PLL_NUM,
367a6ae1a29SChunyan Zhang };
368a6ae1a29SChunyan Zhang 
369a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_pll_desc = {
370a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_pll_clks,
371a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_pll_clks),
372a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_pll_hws,
373a6ae1a29SChunyan Zhang };
374a6ae1a29SChunyan Zhang 
375a6ae1a29SChunyan Zhang #define SC9860_MUX_FLAG	\
376a6ae1a29SChunyan Zhang 	(CLK_GET_RATE_NOCACHE | CLK_SET_RATE_NO_REPARENT)
377a6ae1a29SChunyan Zhang 
378a6ae1a29SChunyan Zhang static const char * const ap_apb_parents[] = { "ext-26m", "twpll-64m",
379a6ae1a29SChunyan Zhang 					       "twpll-96m", "twpll-128m" };
380a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(ap_apb, "ap-apb", ap_apb_parents,
381a6ae1a29SChunyan Zhang 		    0x20, 0, 1, SC9860_MUX_FLAG);
382a6ae1a29SChunyan Zhang 
383a6ae1a29SChunyan Zhang static const char * const ap_apb_usb3[] = { "ext-32k", "twpll-24m" };
384a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(ap_usb3, "ap-usb3", ap_apb_usb3,
385a6ae1a29SChunyan Zhang 		    0x2c, 0, 1, SC9860_MUX_FLAG);
386a6ae1a29SChunyan Zhang 
387a6ae1a29SChunyan Zhang static const char * const uart_parents[] = {	"ext-26m",	"twpll-48m",
388a6ae1a29SChunyan Zhang 						"twpll-51m2",	"twpll-96m" };
389a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(uart0_clk,	"uart0",	uart_parents, 0x30,
390a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
391a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(uart1_clk,	"uart1",	uart_parents, 0x34,
392a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
393a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(uart2_clk,	"uart2",	uart_parents, 0x38,
394a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
395a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(uart3_clk,	"uart3",	uart_parents, 0x3c,
396a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
397a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(uart4_clk,	"uart4",	uart_parents, 0x40,
398a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
399a6ae1a29SChunyan Zhang 
400a6ae1a29SChunyan Zhang static const char * const i2c_parents[] = { "ext-26m", "twpll-48m",
401a6ae1a29SChunyan Zhang 					    "twpll-51m2", "twpll-153m6" };
402a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(i2c0_clk,	"i2c0", i2c_parents, 0x44,
403a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
404a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(i2c1_clk,	"i2c1", i2c_parents, 0x48,
405a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
406a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(i2c2_clk,	"i2c2", i2c_parents, 0x4c,
407a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
408a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(i2c3_clk,	"i2c3", i2c_parents, 0x50,
409a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
410a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(i2c4_clk,	"i2c4", i2c_parents, 0x54,
411a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
412a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(i2c5_clk,	"i2c5", i2c_parents, 0x58,
413a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
414a6ae1a29SChunyan Zhang 
415a6ae1a29SChunyan Zhang static const char * const spi_parents[] = {	"ext-26m",	"twpll-128m",
416a6ae1a29SChunyan Zhang 						"twpll-153m6",	"twpll-192m" };
417a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(spi0_clk,	"spi0",	spi_parents, 0x5c,
418a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
419a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(spi1_clk,	"spi1",	spi_parents, 0x60,
420a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
421a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(spi2_clk,	"spi2",	spi_parents, 0x64,
422a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
423a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(spi3_clk,	"spi3",	spi_parents, 0x68,
424a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
425a6ae1a29SChunyan Zhang 
426a6ae1a29SChunyan Zhang static const char * const iis_parents[] = { "ext-26m",
427a6ae1a29SChunyan Zhang 					    "twpll-128m",
428a6ae1a29SChunyan Zhang 					    "twpll-153m6" };
429a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(iis0_clk,	"iis0",	iis_parents, 0x6c,
430a6ae1a29SChunyan Zhang 		     0, 2, 8, 6, 0);
431a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(iis1_clk,	"iis1",	iis_parents, 0x70,
432a6ae1a29SChunyan Zhang 		     0, 2, 8, 6, 0);
433a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(iis2_clk,	"iis2",	iis_parents, 0x74,
434a6ae1a29SChunyan Zhang 		     0, 2, 8, 6, 0);
435a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(iis3_clk,	"iis3",	iis_parents, 0x78,
436a6ae1a29SChunyan Zhang 		     0, 2, 8, 6, 0);
437a6ae1a29SChunyan Zhang 
438a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_ap_clks[] = {
439a6ae1a29SChunyan Zhang 	/* address base is 0x20000000 */
440a6ae1a29SChunyan Zhang 	&ap_apb.common,
441a6ae1a29SChunyan Zhang 	&ap_usb3.common,
442a6ae1a29SChunyan Zhang 	&uart0_clk.common,
443a6ae1a29SChunyan Zhang 	&uart1_clk.common,
444a6ae1a29SChunyan Zhang 	&uart2_clk.common,
445a6ae1a29SChunyan Zhang 	&uart3_clk.common,
446a6ae1a29SChunyan Zhang 	&uart4_clk.common,
447a6ae1a29SChunyan Zhang 	&i2c0_clk.common,
448a6ae1a29SChunyan Zhang 	&i2c1_clk.common,
449a6ae1a29SChunyan Zhang 	&i2c2_clk.common,
450a6ae1a29SChunyan Zhang 	&i2c3_clk.common,
451a6ae1a29SChunyan Zhang 	&i2c4_clk.common,
452a6ae1a29SChunyan Zhang 	&i2c5_clk.common,
453a6ae1a29SChunyan Zhang 	&spi0_clk.common,
454a6ae1a29SChunyan Zhang 	&spi1_clk.common,
455a6ae1a29SChunyan Zhang 	&spi2_clk.common,
456a6ae1a29SChunyan Zhang 	&spi3_clk.common,
457a6ae1a29SChunyan Zhang 	&iis0_clk.common,
458a6ae1a29SChunyan Zhang 	&iis1_clk.common,
459a6ae1a29SChunyan Zhang 	&iis2_clk.common,
460a6ae1a29SChunyan Zhang 	&iis3_clk.common,
461a6ae1a29SChunyan Zhang };
462a6ae1a29SChunyan Zhang 
463a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_ap_clk_hws = {
464a6ae1a29SChunyan Zhang 	.hws	= {
465a6ae1a29SChunyan Zhang 		[CLK_AP_APB]	= &ap_apb.common.hw,
466a6ae1a29SChunyan Zhang 		[CLK_AP_USB3]	= &ap_usb3.common.hw,
467a6ae1a29SChunyan Zhang 		[CLK_UART0]	= &uart0_clk.common.hw,
468a6ae1a29SChunyan Zhang 		[CLK_UART1]	= &uart1_clk.common.hw,
469a6ae1a29SChunyan Zhang 		[CLK_UART2]	= &uart2_clk.common.hw,
470a6ae1a29SChunyan Zhang 		[CLK_UART3]	= &uart3_clk.common.hw,
471a6ae1a29SChunyan Zhang 		[CLK_UART4]	= &uart4_clk.common.hw,
472a6ae1a29SChunyan Zhang 		[CLK_I2C0]	= &i2c0_clk.common.hw,
473a6ae1a29SChunyan Zhang 		[CLK_I2C1]	= &i2c1_clk.common.hw,
474a6ae1a29SChunyan Zhang 		[CLK_I2C2]	= &i2c2_clk.common.hw,
475a6ae1a29SChunyan Zhang 		[CLK_I2C3]	= &i2c3_clk.common.hw,
476a6ae1a29SChunyan Zhang 		[CLK_I2C4]	= &i2c4_clk.common.hw,
477a6ae1a29SChunyan Zhang 		[CLK_I2C5]	= &i2c5_clk.common.hw,
478a6ae1a29SChunyan Zhang 		[CLK_SPI0]	= &spi0_clk.common.hw,
479a6ae1a29SChunyan Zhang 		[CLK_SPI1]	= &spi1_clk.common.hw,
480a6ae1a29SChunyan Zhang 		[CLK_SPI2]	= &spi2_clk.common.hw,
481a6ae1a29SChunyan Zhang 		[CLK_SPI3]	= &spi3_clk.common.hw,
482a6ae1a29SChunyan Zhang 		[CLK_IIS0]	= &iis0_clk.common.hw,
483a6ae1a29SChunyan Zhang 		[CLK_IIS1]	= &iis1_clk.common.hw,
484a6ae1a29SChunyan Zhang 		[CLK_IIS2]	= &iis2_clk.common.hw,
485a6ae1a29SChunyan Zhang 		[CLK_IIS3]	= &iis3_clk.common.hw,
486a6ae1a29SChunyan Zhang 	},
487a6ae1a29SChunyan Zhang 	.num	= CLK_AP_CLK_NUM,
488a6ae1a29SChunyan Zhang };
489a6ae1a29SChunyan Zhang 
490a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_ap_clk_desc = {
491a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_ap_clks,
492a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_ap_clks),
493a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_ap_clk_hws,
494a6ae1a29SChunyan Zhang };
495a6ae1a29SChunyan Zhang 
496a6ae1a29SChunyan Zhang static const char * const aon_apb_parents[] = { "rco-25m",	"ext-26m",
497a6ae1a29SChunyan Zhang 						"ext-rco-100m",	"twpll-96m",
498a6ae1a29SChunyan Zhang 						"twpll-128m",
499a6ae1a29SChunyan Zhang 						"twpll-153m6" };
500a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(aon_apb, "aon-apb", aon_apb_parents, 0x230,
501a6ae1a29SChunyan Zhang 		     0, 3, 8, 2, 0);
502a6ae1a29SChunyan Zhang 
503a6ae1a29SChunyan Zhang static const char * const aux_parents[] = { "ext-32k",		"rpll0-26m",
504a6ae1a29SChunyan Zhang 					    "rpll1-26m",	"ext-26m",
505a6ae1a29SChunyan Zhang 					    "cppll-50m",	"rco-25m",
506a6ae1a29SChunyan Zhang 					    "dpll0-50m",	"dpll1-50m",
507a6ae1a29SChunyan Zhang 					    "gpll-42m5",	"twpll-48m",
508a6ae1a29SChunyan Zhang 					    "m0-39m",		"m1-63m",
509a6ae1a29SChunyan Zhang 					    "l0-38m",		"l1-38m" };
510a6ae1a29SChunyan Zhang 
511a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(aux0_clk,	"aux0",		aux_parents, 0x238,
512a6ae1a29SChunyan Zhang 		     0, 5, 8, 4, 0);
513a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(aux1_clk,	"aux1",		aux_parents, 0x23c,
514a6ae1a29SChunyan Zhang 		     0, 5, 8, 4, 0);
515a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(aux2_clk,	"aux2",		aux_parents, 0x240,
516a6ae1a29SChunyan Zhang 		     0, 5, 8, 4, 0);
517a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(probe_clk,	"probe",	aux_parents, 0x244,
518a6ae1a29SChunyan Zhang 		     0, 5, 8, 4, 0);
519a6ae1a29SChunyan Zhang 
520a6ae1a29SChunyan Zhang static const char * const sp_ahb_parents[] = {	"rco-4m",	"ext-26m",
521a6ae1a29SChunyan Zhang 						"ext-rco-100m",	"twpll-96m",
522a6ae1a29SChunyan Zhang 						"twpll-128m",
523a6ae1a29SChunyan Zhang 						"twpll-153m6" };
524a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(sp_ahb,	"sp-ahb",	sp_ahb_parents, 0x2d0,
525a6ae1a29SChunyan Zhang 		     0, 3, 8, 2, 0);
526a6ae1a29SChunyan Zhang 
527a6ae1a29SChunyan Zhang static const char * const cci_parents[] = {	"ext-26m",	"twpll-384m",
528a6ae1a29SChunyan Zhang 						"l0-614m4",	"twpll-768m" };
529a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(cci_clk,	"cci",		cci_parents, 0x300,
530a6ae1a29SChunyan Zhang 		     0, 2, 8, 2, 0);
531a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(gic_clk,	"gic",		cci_parents, 0x304,
532a6ae1a29SChunyan Zhang 		     0, 2, 8, 2, 0);
533a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(cssys_clk,	"cssys",	cci_parents, 0x310,
534a6ae1a29SChunyan Zhang 		     0, 2, 8, 2, 0);
535a6ae1a29SChunyan Zhang 
536a6ae1a29SChunyan Zhang static const char * const sdio_2x_parents[] = {	"fac-1m",	"ext-26m",
537a6ae1a29SChunyan Zhang 						"twpll-307m2",	"twpll-384m",
538a6ae1a29SChunyan Zhang 						"l0-409m6" };
539a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(sdio0_2x,	"sdio0-2x",	sdio_2x_parents, 0x328,
540a6ae1a29SChunyan Zhang 		     0, 3, 8, 4, 0);
541a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(sdio1_2x,	"sdio1-2x",	sdio_2x_parents, 0x330,
542a6ae1a29SChunyan Zhang 		     0, 3, 8, 4, 0);
543a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(sdio2_2x,	"sdio2-2x",	sdio_2x_parents, 0x338,
544a6ae1a29SChunyan Zhang 		     0, 3, 8, 4, 0);
545a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(emmc_2x,	"emmc-2x",	sdio_2x_parents, 0x340,
546a6ae1a29SChunyan Zhang 		     0, 3, 8, 4, 0);
547a6ae1a29SChunyan Zhang 
548a6ae1a29SChunyan Zhang static SPRD_DIV_CLK(sdio0_1x,	"sdio0-1x",	"sdio0-2x",	0x32c,
549a6ae1a29SChunyan Zhang 		    8, 1, 0);
550a6ae1a29SChunyan Zhang static SPRD_DIV_CLK(sdio1_1x,	"sdio1-1x",	"sdio1-2x",	0x334,
551a6ae1a29SChunyan Zhang 		    8, 1, 0);
552a6ae1a29SChunyan Zhang static SPRD_DIV_CLK(sdio2_1x,	"sdio2-1x",	"sdio2-2x",	0x33c,
553a6ae1a29SChunyan Zhang 		    8, 1, 0);
554a6ae1a29SChunyan Zhang static SPRD_DIV_CLK(emmc_1x,	"emmc-1x",	"emmc-2x",	0x344,
555a6ae1a29SChunyan Zhang 		    8, 1, 0);
556a6ae1a29SChunyan Zhang 
557a6ae1a29SChunyan Zhang static const char * const adi_parents[] = {	"rco-4m",	"ext-26m",
558a6ae1a29SChunyan Zhang 						"rco-25m",	"twpll-38m4",
559a6ae1a29SChunyan Zhang 						"twpll-51m2" };
560a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(adi_clk,	"adi",	adi_parents, 0x234,
561a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
562a6ae1a29SChunyan Zhang 
563a6ae1a29SChunyan Zhang static const char * const pwm_parents[] = {	"ext-32k",	"ext-26m",
564a6ae1a29SChunyan Zhang 						"rco-4m",	"rco-25m",
565a6ae1a29SChunyan Zhang 						"twpll-48m" };
566a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(pwm0_clk,	"pwm0",	pwm_parents, 0x248,
567a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
568a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(pwm1_clk,	"pwm1",	pwm_parents, 0x24c,
569a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
570a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(pwm2_clk,	"pwm2",	pwm_parents, 0x250,
571a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
572a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(pwm3_clk,	"pwm3",	pwm_parents, 0x254,
573a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
574a6ae1a29SChunyan Zhang 
575a6ae1a29SChunyan Zhang static const char * const efuse_parents[] = { "rco-25m", "ext-26m" };
576a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(efuse_clk, "efuse", efuse_parents, 0x258,
577a6ae1a29SChunyan Zhang 		    0, 1, SC9860_MUX_FLAG);
578a6ae1a29SChunyan Zhang 
579a6ae1a29SChunyan Zhang static const char * const cm3_uart_parents[] = { "rco-4m",	"ext-26m",
580a6ae1a29SChunyan Zhang 						 "rco-100m",	"twpll-48m",
581a6ae1a29SChunyan Zhang 						 "twpll-51m2",	"twpll-96m",
582a6ae1a29SChunyan Zhang 						 "twpll-128m" };
583a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(cm3_uart0, "cm3-uart0", cm3_uart_parents, 0x25c,
584a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
585a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(cm3_uart1, "cm3-uart1", cm3_uart_parents, 0x260,
586a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
587a6ae1a29SChunyan Zhang 
588a6ae1a29SChunyan Zhang static const char * const thm_parents[] = { "ext-32k", "fac-250k" };
589a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(thm_clk,	"thm",	thm_parents, 0x270,
590a6ae1a29SChunyan Zhang 		    0, 1, SC9860_MUX_FLAG);
591a6ae1a29SChunyan Zhang 
592a6ae1a29SChunyan Zhang static const char * const cm3_i2c_parents[] = {	"rco-4m",
593a6ae1a29SChunyan Zhang 						"ext-26m",
594a6ae1a29SChunyan Zhang 						"rco-100m",
595a6ae1a29SChunyan Zhang 						"twpll-48m",
596a6ae1a29SChunyan Zhang 						"twpll-51m2",
597a6ae1a29SChunyan Zhang 						"twpll-153m6" };
598a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(cm3_i2c0, "cm3-i2c0", cm3_i2c_parents, 0x274,
599a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
600a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(cm3_i2c1, "cm3-i2c1", cm3_i2c_parents, 0x278,
601a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
602a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(aon_i2c, "aon-i2c",	cm3_i2c_parents, 0x280,
603a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
604a6ae1a29SChunyan Zhang 
605a6ae1a29SChunyan Zhang static const char * const cm4_spi_parents[] = {	"ext-26m",	"twpll-96m",
606a6ae1a29SChunyan Zhang 						"rco-100m",	"twpll-128m",
607a6ae1a29SChunyan Zhang 						"twpll-153m6",	"twpll-192m" };
608a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(cm4_spi, "cm4-spi", cm4_spi_parents, 0x27c,
609a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
610a6ae1a29SChunyan Zhang 
611a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(avs_clk, "avs", uart_parents, 0x284,
612a6ae1a29SChunyan Zhang 		    0, 2, SC9860_MUX_FLAG);
613a6ae1a29SChunyan Zhang 
614a6ae1a29SChunyan Zhang static const char * const ca53_dap_parents[] = { "ext-26m",	"rco-4m",
615a6ae1a29SChunyan Zhang 						 "rco-100m",	"twpll-76m8",
616a6ae1a29SChunyan Zhang 						 "twpll-128m",	"twpll-153m6" };
617a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(ca53_dap, "ca53-dap", ca53_dap_parents, 0x288,
618a6ae1a29SChunyan Zhang 		    0, 3, SC9860_MUX_FLAG);
619a6ae1a29SChunyan Zhang 
620a6ae1a29SChunyan Zhang static const char * const ca53_ts_parents[] = {	"ext-32k", "ext-26m",
621a6ae1a29SChunyan Zhang 						"clk-twpll-128m",
622a6ae1a29SChunyan Zhang 						"clk-twpll-153m6" };
623a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(ca53_ts, "ca53-ts", ca53_ts_parents, 0x290,
624a6ae1a29SChunyan Zhang 		    0, 2, SC9860_MUX_FLAG);
625a6ae1a29SChunyan Zhang 
626a6ae1a29SChunyan Zhang static const char * const djtag_tck_parents[] = { "rco-4m", "ext-26m" };
627a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(djtag_tck, "djtag-tck", djtag_tck_parents, 0x2c8,
628a6ae1a29SChunyan Zhang 		    0, 1, SC9860_MUX_FLAG);
629a6ae1a29SChunyan Zhang 
630a6ae1a29SChunyan Zhang static const char * const pmu_parents[] = { "ext-32k", "rco-4m", "clk-4m" };
631a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(pmu_clk, "pmu", pmu_parents, 0x2e0,
632a6ae1a29SChunyan Zhang 		    0, 2, SC9860_MUX_FLAG);
633a6ae1a29SChunyan Zhang 
634a6ae1a29SChunyan Zhang static const char * const pmu_26m_parents[] = { "rco-25m", "ext-26m" };
635a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(pmu_26m, "pmu-26m", pmu_26m_parents, 0x2e4,
636a6ae1a29SChunyan Zhang 		    0, 1, SC9860_MUX_FLAG);
637a6ae1a29SChunyan Zhang 
638a6ae1a29SChunyan Zhang static const char * const debounce_parents[] = { "ext-32k", "rco-4m",
639a6ae1a29SChunyan Zhang 						 "rco-25m", "ext-26m" };
640a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(debounce_clk, "debounce", debounce_parents, 0x2e8,
641a6ae1a29SChunyan Zhang 		    0, 2, SC9860_MUX_FLAG);
642a6ae1a29SChunyan Zhang 
643a6ae1a29SChunyan Zhang static const char * const otg2_ref_parents[] = { "twpll-12m", "twpll-24m" };
644a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(otg2_ref, "otg2-ref", otg2_ref_parents, 0x2f4,
645a6ae1a29SChunyan Zhang 		    0, 1, SC9860_MUX_FLAG);
646a6ae1a29SChunyan Zhang 
647a6ae1a29SChunyan Zhang static const char * const usb3_ref_parents[] = { "twpll-24m", "twpll-19m2",
648a6ae1a29SChunyan Zhang 						 "twpll-48m" };
649a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(usb3_ref, "usb3-ref", usb3_ref_parents, 0x2f8,
650a6ae1a29SChunyan Zhang 		    0, 2, SC9860_MUX_FLAG);
651a6ae1a29SChunyan Zhang 
652a6ae1a29SChunyan Zhang static const char * const ap_axi_parents[] = { "ext-26m", "twpll-76m8",
653a6ae1a29SChunyan Zhang 					       "twpll-128m", "twpll-256m" };
654a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(ap_axi, "ap-axi", ap_axi_parents, 0x324,
655a6ae1a29SChunyan Zhang 		    0, 2, SC9860_MUX_FLAG);
656a6ae1a29SChunyan Zhang 
657a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_aon_prediv[] = {
658a6ae1a29SChunyan Zhang 	/* address base is 0x402d0000 */
659a6ae1a29SChunyan Zhang 	&aon_apb.common,
660a6ae1a29SChunyan Zhang 	&aux0_clk.common,
661a6ae1a29SChunyan Zhang 	&aux1_clk.common,
662a6ae1a29SChunyan Zhang 	&aux2_clk.common,
663a6ae1a29SChunyan Zhang 	&probe_clk.common,
664a6ae1a29SChunyan Zhang 	&sp_ahb.common,
665a6ae1a29SChunyan Zhang 	&cci_clk.common,
666a6ae1a29SChunyan Zhang 	&gic_clk.common,
667a6ae1a29SChunyan Zhang 	&cssys_clk.common,
668a6ae1a29SChunyan Zhang 	&sdio0_2x.common,
669a6ae1a29SChunyan Zhang 	&sdio1_2x.common,
670a6ae1a29SChunyan Zhang 	&sdio2_2x.common,
671a6ae1a29SChunyan Zhang 	&emmc_2x.common,
672a6ae1a29SChunyan Zhang 	&sdio0_1x.common,
673a6ae1a29SChunyan Zhang 	&sdio1_1x.common,
674a6ae1a29SChunyan Zhang 	&sdio2_1x.common,
675a6ae1a29SChunyan Zhang 	&emmc_1x.common,
676a6ae1a29SChunyan Zhang 	&adi_clk.common,
677a6ae1a29SChunyan Zhang 	&pwm0_clk.common,
678a6ae1a29SChunyan Zhang 	&pwm1_clk.common,
679a6ae1a29SChunyan Zhang 	&pwm2_clk.common,
680a6ae1a29SChunyan Zhang 	&pwm3_clk.common,
681a6ae1a29SChunyan Zhang 	&efuse_clk.common,
682a6ae1a29SChunyan Zhang 	&cm3_uart0.common,
683a6ae1a29SChunyan Zhang 	&cm3_uart1.common,
684a6ae1a29SChunyan Zhang 	&thm_clk.common,
685a6ae1a29SChunyan Zhang 	&cm3_i2c0.common,
686a6ae1a29SChunyan Zhang 	&cm3_i2c1.common,
687a6ae1a29SChunyan Zhang 	&cm4_spi.common,
688a6ae1a29SChunyan Zhang 	&aon_i2c.common,
689a6ae1a29SChunyan Zhang 	&avs_clk.common,
690a6ae1a29SChunyan Zhang 	&ca53_dap.common,
691a6ae1a29SChunyan Zhang 	&ca53_ts.common,
692a6ae1a29SChunyan Zhang 	&djtag_tck.common,
693a6ae1a29SChunyan Zhang 	&pmu_clk.common,
694a6ae1a29SChunyan Zhang 	&pmu_26m.common,
695a6ae1a29SChunyan Zhang 	&debounce_clk.common,
696a6ae1a29SChunyan Zhang 	&otg2_ref.common,
697a6ae1a29SChunyan Zhang 	&usb3_ref.common,
698a6ae1a29SChunyan Zhang 	&ap_axi.common,
699a6ae1a29SChunyan Zhang };
700a6ae1a29SChunyan Zhang 
701a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_aon_prediv_hws = {
702a6ae1a29SChunyan Zhang 	.hws	= {
703a6ae1a29SChunyan Zhang 		[CLK_AON_APB]		= &aon_apb.common.hw,
704a6ae1a29SChunyan Zhang 		[CLK_AUX0]		= &aux0_clk.common.hw,
705a6ae1a29SChunyan Zhang 		[CLK_AUX1]		= &aux1_clk.common.hw,
706a6ae1a29SChunyan Zhang 		[CLK_AUX2]		= &aux2_clk.common.hw,
707a6ae1a29SChunyan Zhang 		[CLK_PROBE]		= &probe_clk.common.hw,
708a6ae1a29SChunyan Zhang 		[CLK_SP_AHB]		= &sp_ahb.common.hw,
709a6ae1a29SChunyan Zhang 		[CLK_CCI]		= &cci_clk.common.hw,
710a6ae1a29SChunyan Zhang 		[CLK_GIC]		= &gic_clk.common.hw,
711a6ae1a29SChunyan Zhang 		[CLK_CSSYS]		= &cssys_clk.common.hw,
712a6ae1a29SChunyan Zhang 		[CLK_SDIO0_2X]		= &sdio0_2x.common.hw,
713a6ae1a29SChunyan Zhang 		[CLK_SDIO1_2X]		= &sdio1_2x.common.hw,
714a6ae1a29SChunyan Zhang 		[CLK_SDIO2_2X]		= &sdio2_2x.common.hw,
715a6ae1a29SChunyan Zhang 		[CLK_EMMC_2X]		= &emmc_2x.common.hw,
716a6ae1a29SChunyan Zhang 		[CLK_SDIO0_1X]		= &sdio0_1x.common.hw,
717a6ae1a29SChunyan Zhang 		[CLK_SDIO1_1X]		= &sdio1_1x.common.hw,
718a6ae1a29SChunyan Zhang 		[CLK_SDIO2_1X]		= &sdio2_1x.common.hw,
719a6ae1a29SChunyan Zhang 		[CLK_EMMC_1X]		= &emmc_1x.common.hw,
720a6ae1a29SChunyan Zhang 		[CLK_ADI]		= &adi_clk.common.hw,
721a6ae1a29SChunyan Zhang 		[CLK_PWM0]		= &pwm0_clk.common.hw,
722a6ae1a29SChunyan Zhang 		[CLK_PWM1]		= &pwm1_clk.common.hw,
723a6ae1a29SChunyan Zhang 		[CLK_PWM2]		= &pwm2_clk.common.hw,
724a6ae1a29SChunyan Zhang 		[CLK_PWM3]		= &pwm3_clk.common.hw,
725a6ae1a29SChunyan Zhang 		[CLK_EFUSE]		= &efuse_clk.common.hw,
726a6ae1a29SChunyan Zhang 		[CLK_CM3_UART0]		= &cm3_uart0.common.hw,
727a6ae1a29SChunyan Zhang 		[CLK_CM3_UART1]		= &cm3_uart1.common.hw,
728a6ae1a29SChunyan Zhang 		[CLK_THM]		= &thm_clk.common.hw,
729a6ae1a29SChunyan Zhang 		[CLK_CM3_I2C0]		= &cm3_i2c0.common.hw,
730a6ae1a29SChunyan Zhang 		[CLK_CM3_I2C1]		= &cm3_i2c1.common.hw,
731a6ae1a29SChunyan Zhang 		[CLK_CM4_SPI]		= &cm4_spi.common.hw,
732a6ae1a29SChunyan Zhang 		[CLK_AON_I2C]		= &aon_i2c.common.hw,
733a6ae1a29SChunyan Zhang 		[CLK_AVS]		= &avs_clk.common.hw,
734a6ae1a29SChunyan Zhang 		[CLK_CA53_DAP]		= &ca53_dap.common.hw,
735a6ae1a29SChunyan Zhang 		[CLK_CA53_TS]		= &ca53_ts.common.hw,
736a6ae1a29SChunyan Zhang 		[CLK_DJTAG_TCK]		= &djtag_tck.common.hw,
737a6ae1a29SChunyan Zhang 		[CLK_PMU]		= &pmu_clk.common.hw,
738a6ae1a29SChunyan Zhang 		[CLK_PMU_26M]		= &pmu_26m.common.hw,
739a6ae1a29SChunyan Zhang 		[CLK_DEBOUNCE]		= &debounce_clk.common.hw,
740a6ae1a29SChunyan Zhang 		[CLK_OTG2_REF]		= &otg2_ref.common.hw,
741a6ae1a29SChunyan Zhang 		[CLK_USB3_REF]		= &usb3_ref.common.hw,
742a6ae1a29SChunyan Zhang 		[CLK_AP_AXI]		= &ap_axi.common.hw,
743a6ae1a29SChunyan Zhang 	},
744a6ae1a29SChunyan Zhang 	.num	= CLK_AON_PREDIV_NUM,
745a6ae1a29SChunyan Zhang };
746a6ae1a29SChunyan Zhang 
747a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_aon_prediv_desc = {
748a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_aon_prediv,
749a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_aon_prediv),
750a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_aon_prediv_hws,
751a6ae1a29SChunyan Zhang };
752a6ae1a29SChunyan Zhang 
753a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(usb3_eb,		"usb3-eb",	"ap-axi", 0x0,
754a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
755a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(usb3_suspend,	"usb3-suspend", "ap-axi", 0x0,
756a6ae1a29SChunyan Zhang 		     0x1000, BIT(3), CLK_IGNORE_UNUSED, 0);
757a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(usb3_ref_eb,	"usb3-ref-eb",	"ap-axi", 0x0,
758a6ae1a29SChunyan Zhang 		     0x1000, BIT(4), CLK_IGNORE_UNUSED, 0);
759a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dma_eb,		"dma-eb",	"ap-axi", 0x0,
760a6ae1a29SChunyan Zhang 		     0x1000, BIT(5), CLK_IGNORE_UNUSED, 0);
761a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(sdio0_eb,		"sdio0-eb",	"ap-axi", 0x0,
762a6ae1a29SChunyan Zhang 		     0x1000, BIT(7), CLK_IGNORE_UNUSED, 0);
763a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(sdio1_eb,		"sdio1-eb",	"ap-axi", 0x0,
764a6ae1a29SChunyan Zhang 		     0x1000, BIT(8), CLK_IGNORE_UNUSED, 0);
765a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(sdio2_eb,		"sdio2-eb",	"ap-axi", 0x0,
766a6ae1a29SChunyan Zhang 		     0x1000, BIT(9), CLK_IGNORE_UNUSED, 0);
767a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(emmc_eb,		"emmc-eb",	"ap-axi", 0x0,
768a6ae1a29SChunyan Zhang 		     0x1000, BIT(10), CLK_IGNORE_UNUSED, 0);
769a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(rom_eb,		"rom-eb",	"ap-axi", 0x0,
770a6ae1a29SChunyan Zhang 		     0x1000, BIT(12), CLK_IGNORE_UNUSED, 0);
771a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(busmon_eb,		"busmon-eb",	"ap-axi", 0x0,
772a6ae1a29SChunyan Zhang 		     0x1000, BIT(13), CLK_IGNORE_UNUSED, 0);
773a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(cc63s_eb,		"cc63s-eb",	"ap-axi", 0x0,
774a6ae1a29SChunyan Zhang 		     0x1000, BIT(22), CLK_IGNORE_UNUSED, 0);
775a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(cc63p_eb,		"cc63p-eb",	"ap-axi", 0x0,
776a6ae1a29SChunyan Zhang 		     0x1000, BIT(23), CLK_IGNORE_UNUSED, 0);
777a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ce0_eb,		"ce0-eb",	"ap-axi", 0x0,
778a6ae1a29SChunyan Zhang 		     0x1000, BIT(24), CLK_IGNORE_UNUSED, 0);
779a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ce1_eb,		"ce1-eb",	"ap-axi", 0x0,
780a6ae1a29SChunyan Zhang 		     0x1000, BIT(25), CLK_IGNORE_UNUSED, 0);
781a6ae1a29SChunyan Zhang 
782a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_apahb_gate[] = {
783a6ae1a29SChunyan Zhang 	/* address base is 0x20210000 */
784a6ae1a29SChunyan Zhang 	&usb3_eb.common,
785a6ae1a29SChunyan Zhang 	&usb3_suspend.common,
786a6ae1a29SChunyan Zhang 	&usb3_ref_eb.common,
787a6ae1a29SChunyan Zhang 	&dma_eb.common,
788a6ae1a29SChunyan Zhang 	&sdio0_eb.common,
789a6ae1a29SChunyan Zhang 	&sdio1_eb.common,
790a6ae1a29SChunyan Zhang 	&sdio2_eb.common,
791a6ae1a29SChunyan Zhang 	&emmc_eb.common,
792a6ae1a29SChunyan Zhang 	&rom_eb.common,
793a6ae1a29SChunyan Zhang 	&busmon_eb.common,
794a6ae1a29SChunyan Zhang 	&cc63s_eb.common,
795a6ae1a29SChunyan Zhang 	&cc63p_eb.common,
796a6ae1a29SChunyan Zhang 	&ce0_eb.common,
797a6ae1a29SChunyan Zhang 	&ce1_eb.common,
798a6ae1a29SChunyan Zhang };
799a6ae1a29SChunyan Zhang 
800a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_apahb_gate_hws = {
801a6ae1a29SChunyan Zhang 	.hws	= {
802a6ae1a29SChunyan Zhang 		[CLK_USB3_EB]		= &usb3_eb.common.hw,
803a6ae1a29SChunyan Zhang 		[CLK_USB3_SUSPEND_EB]	= &usb3_suspend.common.hw,
804a6ae1a29SChunyan Zhang 		[CLK_USB3_REF_EB]	= &usb3_ref_eb.common.hw,
805a6ae1a29SChunyan Zhang 		[CLK_DMA_EB]		= &dma_eb.common.hw,
806a6ae1a29SChunyan Zhang 		[CLK_SDIO0_EB]		= &sdio0_eb.common.hw,
807a6ae1a29SChunyan Zhang 		[CLK_SDIO1_EB]		= &sdio1_eb.common.hw,
808a6ae1a29SChunyan Zhang 		[CLK_SDIO2_EB]		= &sdio2_eb.common.hw,
809a6ae1a29SChunyan Zhang 		[CLK_EMMC_EB]		= &emmc_eb.common.hw,
810a6ae1a29SChunyan Zhang 		[CLK_ROM_EB]		= &rom_eb.common.hw,
811a6ae1a29SChunyan Zhang 		[CLK_BUSMON_EB]		= &busmon_eb.common.hw,
812a6ae1a29SChunyan Zhang 		[CLK_CC63S_EB]		= &cc63s_eb.common.hw,
813a6ae1a29SChunyan Zhang 		[CLK_CC63P_EB]		= &cc63p_eb.common.hw,
814a6ae1a29SChunyan Zhang 		[CLK_CE0_EB]		= &ce0_eb.common.hw,
815a6ae1a29SChunyan Zhang 		[CLK_CE1_EB]		= &ce1_eb.common.hw,
816a6ae1a29SChunyan Zhang 	},
817a6ae1a29SChunyan Zhang 	.num	= CLK_APAHB_GATE_NUM,
818a6ae1a29SChunyan Zhang };
819a6ae1a29SChunyan Zhang 
820a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_apahb_gate_desc = {
821a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_apahb_gate,
822a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_apahb_gate),
823a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_apahb_gate_hws,
824a6ae1a29SChunyan Zhang };
825a6ae1a29SChunyan Zhang 
826a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(avs_lit_eb,	"avs-lit-eb",	"aon-apb", 0x0,
827a6ae1a29SChunyan Zhang 		     0x1000, BIT(0), CLK_IGNORE_UNUSED, 0);
828a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(avs_big_eb,	"avs-big-eb",	"aon-apb", 0x0,
829a6ae1a29SChunyan Zhang 		     0x1000, BIT(1), CLK_IGNORE_UNUSED, 0);
830a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ap_intc5_eb,	"ap-intc5-eb",	"aon-apb", 0x0,
831a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
832a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gpio_eb,		"gpio-eb",	"aon-apb", 0x0,
833a6ae1a29SChunyan Zhang 		     0x1000, BIT(3), CLK_IGNORE_UNUSED, 0);
834a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(pwm0_eb,		"pwm0-eb",	"aon-apb", 0x0,
835a6ae1a29SChunyan Zhang 		     0x1000, BIT(4), CLK_IGNORE_UNUSED, 0);
836a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(pwm1_eb,		"pwm1-eb",	"aon-apb", 0x0,
837a6ae1a29SChunyan Zhang 		     0x1000, BIT(5), CLK_IGNORE_UNUSED, 0);
838a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(pwm2_eb,		"pwm2-eb",	"aon-apb", 0x0,
839a6ae1a29SChunyan Zhang 		     0x1000, BIT(6), CLK_IGNORE_UNUSED, 0);
840a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(pwm3_eb,		"pwm3-eb",	"aon-apb", 0x0,
841a6ae1a29SChunyan Zhang 		     0x1000, BIT(7), CLK_IGNORE_UNUSED, 0);
842a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(kpd_eb,		"kpd-eb",	"aon-apb", 0x0,
843a6ae1a29SChunyan Zhang 		     0x1000, BIT(8), CLK_IGNORE_UNUSED, 0);
844a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(aon_sys_eb,	"aon-sys-eb",	"aon-apb", 0x0,
845a6ae1a29SChunyan Zhang 		     0x1000, BIT(9), CLK_IGNORE_UNUSED, 0);
846a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ap_sys_eb,	"ap-sys-eb",	"aon-apb", 0x0,
847a6ae1a29SChunyan Zhang 		     0x1000, BIT(10), CLK_IGNORE_UNUSED, 0);
848a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(aon_tmr_eb,	"aon-tmr-eb",	"aon-apb", 0x0,
849a6ae1a29SChunyan Zhang 		     0x1000, BIT(11), CLK_IGNORE_UNUSED, 0);
850a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ap_tmr0_eb,	"ap-tmr0-eb",	"aon-apb", 0x0,
851a6ae1a29SChunyan Zhang 		     0x1000, BIT(12), CLK_IGNORE_UNUSED, 0);
852a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(efuse_eb,	"efuse-eb",	"aon-apb", 0x0,
853a6ae1a29SChunyan Zhang 		     0x1000, BIT(13), CLK_IGNORE_UNUSED, 0);
854a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(eic_eb,		"eic-eb",	"aon-apb", 0x0,
855a6ae1a29SChunyan Zhang 		     0x1000, BIT(14), CLK_IGNORE_UNUSED, 0);
856a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(pub1_reg_eb,	"pub1-reg-eb",	"aon-apb", 0x0,
857a6ae1a29SChunyan Zhang 		     0x1000, BIT(15), CLK_IGNORE_UNUSED, 0);
858a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(adi_eb,		"adi-eb",	"aon-apb", 0x0,
859a6ae1a29SChunyan Zhang 		     0x1000, BIT(16), CLK_IGNORE_UNUSED, 0);
860a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ap_intc0_eb,	"ap-intc0-eb",	"aon-apb", 0x0,
861a6ae1a29SChunyan Zhang 		     0x1000, BIT(17), CLK_IGNORE_UNUSED, 0);
862a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ap_intc1_eb,	"ap-intc1-eb",	"aon-apb", 0x0,
863a6ae1a29SChunyan Zhang 		     0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
864a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ap_intc2_eb,	"ap-intc2-eb",	"aon-apb", 0x0,
865a6ae1a29SChunyan Zhang 		     0x1000, BIT(19), CLK_IGNORE_UNUSED, 0);
866a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ap_intc3_eb,	"ap-intc3-eb",	"aon-apb", 0x0,
867a6ae1a29SChunyan Zhang 		     0x1000, BIT(20), CLK_IGNORE_UNUSED, 0);
868a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ap_intc4_eb,	"ap-intc4-eb",	"aon-apb", 0x0,
869a6ae1a29SChunyan Zhang 		     0x1000, BIT(21), CLK_IGNORE_UNUSED, 0);
870a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(splk_eb,		"splk-eb",	"aon-apb", 0x0,
871a6ae1a29SChunyan Zhang 		     0x1000, BIT(22), CLK_IGNORE_UNUSED, 0);
872a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(mspi_eb,		"mspi-eb",	"aon-apb", 0x0,
873a6ae1a29SChunyan Zhang 		     0x1000, BIT(23), CLK_IGNORE_UNUSED, 0);
874a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(pub0_reg_eb,	"pub0-reg-eb",	"aon-apb", 0x0,
875a6ae1a29SChunyan Zhang 		     0x1000, BIT(24), CLK_IGNORE_UNUSED, 0);
876a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(pin_eb,		"pin-eb",	"aon-apb", 0x0,
877a6ae1a29SChunyan Zhang 		     0x1000, BIT(25), CLK_IGNORE_UNUSED, 0);
878a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(aon_ckg_eb,	"aon-ckg-eb",	"aon-apb", 0x0,
879a6ae1a29SChunyan Zhang 		     0x1000, BIT(26), CLK_IGNORE_UNUSED, 0);
880a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gpu_eb,		"gpu-eb",	"aon-apb", 0x0,
881a6ae1a29SChunyan Zhang 		     0x1000, BIT(27), CLK_IGNORE_UNUSED, 0);
882a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(apcpu_ts0_eb,	"apcpu-ts0-eb",	"aon-apb", 0x0,
883a6ae1a29SChunyan Zhang 		     0x1000, BIT(28), CLK_IGNORE_UNUSED, 0);
884a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(apcpu_ts1_eb,	"apcpu-ts1-eb",	"aon-apb", 0x0,
885a6ae1a29SChunyan Zhang 		     0x1000, BIT(29), CLK_IGNORE_UNUSED, 0);
886a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dap_eb,		"dap-eb",	"aon-apb", 0x0,
887a6ae1a29SChunyan Zhang 		     0x1000, BIT(30), CLK_IGNORE_UNUSED, 0);
888a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(i2c_eb,		"i2c-eb",	"aon-apb", 0x0,
889a6ae1a29SChunyan Zhang 		     0x1000, BIT(31), CLK_IGNORE_UNUSED, 0);
890a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(pmu_eb,		"pmu-eb",	"aon-apb", 0x4,
891a6ae1a29SChunyan Zhang 		     0x1000, BIT(0), CLK_IGNORE_UNUSED, 0);
892a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(thm_eb,		"thm-eb",	"aon-apb", 0x4,
893a6ae1a29SChunyan Zhang 		     0x1000, BIT(1), CLK_IGNORE_UNUSED, 0);
894a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(aux0_eb,		"aux0-eb",	"aon-apb", 0x4,
895a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
896a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(aux1_eb,		"aux1-eb",	"aon-apb", 0x4,
897a6ae1a29SChunyan Zhang 		     0x1000, BIT(3), CLK_IGNORE_UNUSED, 0);
898a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(aux2_eb,		"aux2-eb",	"aon-apb", 0x4,
899a6ae1a29SChunyan Zhang 		     0x1000, BIT(4), CLK_IGNORE_UNUSED, 0);
900a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(probe_eb,		"probe-eb",	"aon-apb", 0x4,
901a6ae1a29SChunyan Zhang 		     0x1000, BIT(5), CLK_IGNORE_UNUSED, 0);
902a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gpu0_avs_eb,	"gpu0-avs-eb",	"aon-apb", 0x4,
903a6ae1a29SChunyan Zhang 		     0x1000, BIT(6), CLK_IGNORE_UNUSED, 0);
904a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gpu1_avs_eb,	"gpu1-avs-eb",	"aon-apb", 0x4,
905a6ae1a29SChunyan Zhang 		     0x1000, BIT(7), CLK_IGNORE_UNUSED, 0);
906a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(apcpu_wdg_eb,	"apcpu-wdg-eb",	"aon-apb", 0x4,
907a6ae1a29SChunyan Zhang 		     0x1000, BIT(8), CLK_IGNORE_UNUSED, 0);
908a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ap_tmr1_eb,	"ap-tmr1-eb",	"aon-apb", 0x4,
909a6ae1a29SChunyan Zhang 		     0x1000, BIT(9), CLK_IGNORE_UNUSED, 0);
910a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ap_tmr2_eb,	"ap-tmr2-eb",	"aon-apb", 0x4,
911a6ae1a29SChunyan Zhang 		     0x1000, BIT(10), CLK_IGNORE_UNUSED, 0);
912a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(disp_emc_eb,	"disp-emc-eb",	"aon-apb", 0x4,
913a6ae1a29SChunyan Zhang 		     0x1000, BIT(11), CLK_IGNORE_UNUSED, 0);
914a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(zip_emc_eb,	"zip-emc-eb",	"aon-apb", 0x4,
915a6ae1a29SChunyan Zhang 		     0x1000, BIT(12), CLK_IGNORE_UNUSED, 0);
916a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gsp_emc_eb,	"gsp-emc-eb",	"aon-apb", 0x4,
917a6ae1a29SChunyan Zhang 		     0x1000, BIT(13), CLK_IGNORE_UNUSED, 0);
918a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(osc_aon_eb,	"osc-aon-eb",	"aon-apb", 0x4,
919a6ae1a29SChunyan Zhang 		     0x1000, BIT(14), CLK_IGNORE_UNUSED, 0);
920a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(lvds_trx_eb,	"lvds-trx-eb",	"aon-apb", 0x4,
921a6ae1a29SChunyan Zhang 		     0x1000, BIT(15), CLK_IGNORE_UNUSED, 0);
922a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(lvds_tcxo_eb,	"lvds-tcxo-eb",	"aon-apb", 0x4,
923a6ae1a29SChunyan Zhang 		     0x1000, BIT(16), CLK_IGNORE_UNUSED, 0);
924a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(mdar_eb,		"mdar-eb",	"aon-apb", 0x4,
925a6ae1a29SChunyan Zhang 		     0x1000, BIT(17), CLK_IGNORE_UNUSED, 0);
926a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(rtc4m0_cal_eb, "rtc4m0-cal-eb",	"aon-apb", 0x4,
927a6ae1a29SChunyan Zhang 		     0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
928a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(rct100m_cal_eb, "rct100m-cal-eb",	"aon-apb", 0x4,
929a6ae1a29SChunyan Zhang 		     0x1000, BIT(19), CLK_IGNORE_UNUSED, 0);
930a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(djtag_eb,		"djtag-eb",	"aon-apb", 0x4,
931a6ae1a29SChunyan Zhang 		     0x1000, BIT(20), CLK_IGNORE_UNUSED, 0);
932a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(mbox_eb,		"mbox-eb",	"aon-apb", 0x4,
933a6ae1a29SChunyan Zhang 		     0x1000, BIT(21), CLK_IGNORE_UNUSED, 0);
934a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(aon_dma_eb,	"aon-dma-eb",	"aon-apb", 0x4,
935a6ae1a29SChunyan Zhang 		     0x1000, BIT(22), CLK_IGNORE_UNUSED, 0);
936a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dbg_emc_eb,	"dbg-emc-eb",	"aon-apb", 0x4,
937a6ae1a29SChunyan Zhang 		     0x1000, BIT(23), CLK_IGNORE_UNUSED, 0);
938a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(lvds_pll_div_en, "lvds-pll-div-en", "aon-apb", 0x4,
939a6ae1a29SChunyan Zhang 		     0x1000, BIT(24), CLK_IGNORE_UNUSED, 0);
940a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(def_eb,		"def-eb",	"aon-apb", 0x4,
941a6ae1a29SChunyan Zhang 		     0x1000, BIT(25), CLK_IGNORE_UNUSED, 0);
942a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(aon_apb_rsv0,	"aon-apb-rsv0",	"aon-apb", 0x4,
943a6ae1a29SChunyan Zhang 		     0x1000, BIT(26), CLK_IGNORE_UNUSED, 0);
944a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(orp_jtag_eb,	"orp-jtag-eb",	"aon-apb", 0x4,
945a6ae1a29SChunyan Zhang 		     0x1000, BIT(27), CLK_IGNORE_UNUSED, 0);
946a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(vsp_eb,		"vsp-eb",	"aon-apb", 0x4,
947a6ae1a29SChunyan Zhang 		     0x1000, BIT(28), CLK_IGNORE_UNUSED, 0);
948a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(cam_eb,		"cam-eb",	"aon-apb", 0x4,
949a6ae1a29SChunyan Zhang 		     0x1000, BIT(29), CLK_IGNORE_UNUSED, 0);
950a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(disp_eb,		"disp-eb",	"aon-apb", 0x4,
951a6ae1a29SChunyan Zhang 		     0x1000, BIT(30), CLK_IGNORE_UNUSED, 0);
952a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dbg_axi_if_eb, "dbg-axi-if-eb",	"aon-apb", 0x4,
953a6ae1a29SChunyan Zhang 		     0x1000, BIT(31), CLK_IGNORE_UNUSED, 0);
954a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(sdio0_2x_en,	"sdio0-2x-en",	"aon-apb", 0x13c,
955a6ae1a29SChunyan Zhang 			       0x1000, BIT(2), 0, 0);
956a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(sdio1_2x_en,	"sdio1-2x-en",	"aon-apb", 0x13c,
957a6ae1a29SChunyan Zhang 			       0x1000, BIT(4), 0, 0);
958a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(sdio2_2x_en,	"sdio2-2x-en",	"aon-apb", 0x13c,
959a6ae1a29SChunyan Zhang 			       0x1000, BIT(6), 0, 0);
960a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(emmc_2x_en,	"emmc-2x-en",	"aon-apb", 0x13c,
961a6ae1a29SChunyan Zhang 			       0x1000, BIT(9), 0, 0);
962b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(arch_rtc_eb, "arch-rtc-eb",	"aon-apb", 0x10,
963b3316a67SChunyan Zhang 		     0x1000, BIT(0), CLK_IGNORE_UNUSED, 0);
964b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(kpb_rtc_eb, "kpb-rtc-eb",	"aon-apb", 0x10,
965b3316a67SChunyan Zhang 		     0x1000, BIT(1), CLK_IGNORE_UNUSED, 0);
966b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(aon_syst_rtc_eb, "aon-syst-rtc-eb",	"aon-apb", 0x10,
967b3316a67SChunyan Zhang 		     0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
968b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(ap_syst_rtc_eb, "ap-syst-rtc-eb",	"aon-apb", 0x10,
969b3316a67SChunyan Zhang 		     0x1000, BIT(3), CLK_IGNORE_UNUSED, 0);
970b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(aon_tmr_rtc_eb, "aon-tmr-rtc-eb",	"aon-apb", 0x10,
971b3316a67SChunyan Zhang 		     0x1000, BIT(4), CLK_IGNORE_UNUSED, 0);
972b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(ap_tmr0_rtc_eb, "ap-tmr0-rtc-eb",	"aon-apb", 0x10,
973b3316a67SChunyan Zhang 		     0x1000, BIT(5), CLK_IGNORE_UNUSED, 0);
974b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(eic_rtc_eb, "eic-rtc-eb",	"aon-apb", 0x10,
975b3316a67SChunyan Zhang 		     0x1000, BIT(6), CLK_IGNORE_UNUSED, 0);
976b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(eic_rtcdv5_eb, "eic-rtcdv5-eb",	"aon-apb", 0x10,
977b3316a67SChunyan Zhang 		     0x1000, BIT(7), CLK_IGNORE_UNUSED, 0);
978b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(ap_wdg_rtc_eb, "ap-wdg-rtc-eb",	"aon-apb", 0x10,
979b3316a67SChunyan Zhang 		     0x1000, BIT(9), CLK_IGNORE_UNUSED, 0);
980b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(ap_tmr1_rtc_eb, "ap-tmr1-rtc-eb",	"aon-apb", 0x10,
981b3316a67SChunyan Zhang 		     0x1000, BIT(15), CLK_IGNORE_UNUSED, 0);
982b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(ap_tmr2_rtc_eb, "ap-tmr2-rtc-eb",	"aon-apb", 0x10,
983b3316a67SChunyan Zhang 		     0x1000, BIT(16), CLK_IGNORE_UNUSED, 0);
984b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(dcxo_tmr_rtc_eb, "dcxo-tmr-rtc-eb",	"aon-apb", 0x10,
985b3316a67SChunyan Zhang 		     0x1000, BIT(17), CLK_IGNORE_UNUSED, 0);
986b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(bb_cal_rtc_eb, "bb-cal-rtc-eb",	"aon-apb", 0x10,
987b3316a67SChunyan Zhang 		     0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
988b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(avs_big_rtc_eb, "avs-big-rtc-eb",	"aon-apb", 0x10,
989b3316a67SChunyan Zhang 		     0x1000, BIT(20), CLK_IGNORE_UNUSED, 0);
990b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(avs_lit_rtc_eb, "avs-lit-rtc-eb",	"aon-apb", 0x10,
991b3316a67SChunyan Zhang 		     0x1000, BIT(21), CLK_IGNORE_UNUSED, 0);
992b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(avs_gpu0_rtc_eb, "avs-gpu0-rtc-eb",	"aon-apb", 0x10,
993b3316a67SChunyan Zhang 		     0x1000, BIT(22), CLK_IGNORE_UNUSED, 0);
994b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(avs_gpu1_rtc_eb, "avs-gpu1-rtc-eb",	"aon-apb", 0x10,
995b3316a67SChunyan Zhang 		     0x1000, BIT(23), CLK_IGNORE_UNUSED, 0);
996b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(gpu_ts_eb, "gpu-ts-eb",	"aon-apb", 0x10,
997b3316a67SChunyan Zhang 		     0x1000, BIT(24), CLK_IGNORE_UNUSED, 0);
998b3316a67SChunyan Zhang static SPRD_SC_GATE_CLK(rtcdv10_eb, "rtcdv10-eb",	"aon-apb", 0x10,
999b3316a67SChunyan Zhang 		     0x1000, BIT(27), CLK_IGNORE_UNUSED, 0);
1000a6ae1a29SChunyan Zhang 
1001a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_aon_gate[] = {
1002a6ae1a29SChunyan Zhang 	/* address base is 0x402e0000 */
1003a6ae1a29SChunyan Zhang 	&avs_lit_eb.common,
1004a6ae1a29SChunyan Zhang 	&avs_big_eb.common,
1005a6ae1a29SChunyan Zhang 	&ap_intc5_eb.common,
1006a6ae1a29SChunyan Zhang 	&gpio_eb.common,
1007a6ae1a29SChunyan Zhang 	&pwm0_eb.common,
1008a6ae1a29SChunyan Zhang 	&pwm1_eb.common,
1009a6ae1a29SChunyan Zhang 	&pwm2_eb.common,
1010a6ae1a29SChunyan Zhang 	&pwm3_eb.common,
1011a6ae1a29SChunyan Zhang 	&kpd_eb.common,
1012a6ae1a29SChunyan Zhang 	&aon_sys_eb.common,
1013a6ae1a29SChunyan Zhang 	&ap_sys_eb.common,
1014a6ae1a29SChunyan Zhang 	&aon_tmr_eb.common,
1015a6ae1a29SChunyan Zhang 	&ap_tmr0_eb.common,
1016a6ae1a29SChunyan Zhang 	&efuse_eb.common,
1017a6ae1a29SChunyan Zhang 	&eic_eb.common,
1018a6ae1a29SChunyan Zhang 	&pub1_reg_eb.common,
1019a6ae1a29SChunyan Zhang 	&adi_eb.common,
1020a6ae1a29SChunyan Zhang 	&ap_intc0_eb.common,
1021a6ae1a29SChunyan Zhang 	&ap_intc1_eb.common,
1022a6ae1a29SChunyan Zhang 	&ap_intc2_eb.common,
1023a6ae1a29SChunyan Zhang 	&ap_intc3_eb.common,
1024a6ae1a29SChunyan Zhang 	&ap_intc4_eb.common,
1025a6ae1a29SChunyan Zhang 	&splk_eb.common,
1026a6ae1a29SChunyan Zhang 	&mspi_eb.common,
1027a6ae1a29SChunyan Zhang 	&pub0_reg_eb.common,
1028a6ae1a29SChunyan Zhang 	&pin_eb.common,
1029a6ae1a29SChunyan Zhang 	&aon_ckg_eb.common,
1030a6ae1a29SChunyan Zhang 	&gpu_eb.common,
1031a6ae1a29SChunyan Zhang 	&apcpu_ts0_eb.common,
1032a6ae1a29SChunyan Zhang 	&apcpu_ts1_eb.common,
1033a6ae1a29SChunyan Zhang 	&dap_eb.common,
1034a6ae1a29SChunyan Zhang 	&i2c_eb.common,
1035a6ae1a29SChunyan Zhang 	&pmu_eb.common,
1036a6ae1a29SChunyan Zhang 	&thm_eb.common,
1037a6ae1a29SChunyan Zhang 	&aux0_eb.common,
1038a6ae1a29SChunyan Zhang 	&aux1_eb.common,
1039a6ae1a29SChunyan Zhang 	&aux2_eb.common,
1040a6ae1a29SChunyan Zhang 	&probe_eb.common,
1041a6ae1a29SChunyan Zhang 	&gpu0_avs_eb.common,
1042a6ae1a29SChunyan Zhang 	&gpu1_avs_eb.common,
1043a6ae1a29SChunyan Zhang 	&apcpu_wdg_eb.common,
1044a6ae1a29SChunyan Zhang 	&ap_tmr1_eb.common,
1045a6ae1a29SChunyan Zhang 	&ap_tmr2_eb.common,
1046a6ae1a29SChunyan Zhang 	&disp_emc_eb.common,
1047a6ae1a29SChunyan Zhang 	&zip_emc_eb.common,
1048a6ae1a29SChunyan Zhang 	&gsp_emc_eb.common,
1049a6ae1a29SChunyan Zhang 	&osc_aon_eb.common,
1050a6ae1a29SChunyan Zhang 	&lvds_trx_eb.common,
1051a6ae1a29SChunyan Zhang 	&lvds_tcxo_eb.common,
1052a6ae1a29SChunyan Zhang 	&mdar_eb.common,
1053a6ae1a29SChunyan Zhang 	&rtc4m0_cal_eb.common,
1054a6ae1a29SChunyan Zhang 	&rct100m_cal_eb.common,
1055a6ae1a29SChunyan Zhang 	&djtag_eb.common,
1056a6ae1a29SChunyan Zhang 	&mbox_eb.common,
1057a6ae1a29SChunyan Zhang 	&aon_dma_eb.common,
1058a6ae1a29SChunyan Zhang 	&dbg_emc_eb.common,
1059a6ae1a29SChunyan Zhang 	&lvds_pll_div_en.common,
1060a6ae1a29SChunyan Zhang 	&def_eb.common,
1061a6ae1a29SChunyan Zhang 	&aon_apb_rsv0.common,
1062a6ae1a29SChunyan Zhang 	&orp_jtag_eb.common,
1063a6ae1a29SChunyan Zhang 	&vsp_eb.common,
1064a6ae1a29SChunyan Zhang 	&cam_eb.common,
1065a6ae1a29SChunyan Zhang 	&disp_eb.common,
1066a6ae1a29SChunyan Zhang 	&dbg_axi_if_eb.common,
1067a6ae1a29SChunyan Zhang 	&sdio0_2x_en.common,
1068a6ae1a29SChunyan Zhang 	&sdio1_2x_en.common,
1069a6ae1a29SChunyan Zhang 	&sdio2_2x_en.common,
1070a6ae1a29SChunyan Zhang 	&emmc_2x_en.common,
1071b3316a67SChunyan Zhang 	&arch_rtc_eb.common,
1072b3316a67SChunyan Zhang 	&kpb_rtc_eb.common,
1073b3316a67SChunyan Zhang 	&aon_syst_rtc_eb.common,
1074b3316a67SChunyan Zhang 	&ap_syst_rtc_eb.common,
1075b3316a67SChunyan Zhang 	&aon_tmr_rtc_eb.common,
1076b3316a67SChunyan Zhang 	&ap_tmr0_rtc_eb.common,
1077b3316a67SChunyan Zhang 	&eic_rtc_eb.common,
1078b3316a67SChunyan Zhang 	&eic_rtcdv5_eb.common,
1079b3316a67SChunyan Zhang 	&ap_wdg_rtc_eb.common,
1080b3316a67SChunyan Zhang 	&ap_tmr1_rtc_eb.common,
1081b3316a67SChunyan Zhang 	&ap_tmr2_rtc_eb.common,
1082b3316a67SChunyan Zhang 	&dcxo_tmr_rtc_eb.common,
1083b3316a67SChunyan Zhang 	&bb_cal_rtc_eb.common,
1084b3316a67SChunyan Zhang 	&avs_big_rtc_eb.common,
1085b3316a67SChunyan Zhang 	&avs_lit_rtc_eb.common,
1086b3316a67SChunyan Zhang 	&avs_gpu0_rtc_eb.common,
1087b3316a67SChunyan Zhang 	&avs_gpu1_rtc_eb.common,
1088b3316a67SChunyan Zhang 	&gpu_ts_eb.common,
1089b3316a67SChunyan Zhang 	&rtcdv10_eb.common,
1090a6ae1a29SChunyan Zhang };
1091a6ae1a29SChunyan Zhang 
1092a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_aon_gate_hws = {
1093a6ae1a29SChunyan Zhang 	.hws	= {
1094a6ae1a29SChunyan Zhang 		[CLK_AVS_LIT_EB]	= &avs_lit_eb.common.hw,
1095a6ae1a29SChunyan Zhang 		[CLK_AVS_BIG_EB]	= &avs_big_eb.common.hw,
1096a6ae1a29SChunyan Zhang 		[CLK_AP_INTC5_EB]	= &ap_intc5_eb.common.hw,
1097a6ae1a29SChunyan Zhang 		[CLK_GPIO_EB]		= &gpio_eb.common.hw,
1098a6ae1a29SChunyan Zhang 		[CLK_PWM0_EB]		= &pwm0_eb.common.hw,
1099a6ae1a29SChunyan Zhang 		[CLK_PWM1_EB]		= &pwm1_eb.common.hw,
1100a6ae1a29SChunyan Zhang 		[CLK_PWM2_EB]		= &pwm2_eb.common.hw,
1101a6ae1a29SChunyan Zhang 		[CLK_PWM3_EB]		= &pwm3_eb.common.hw,
1102a6ae1a29SChunyan Zhang 		[CLK_KPD_EB]		= &kpd_eb.common.hw,
1103a6ae1a29SChunyan Zhang 		[CLK_AON_SYS_EB]	= &aon_sys_eb.common.hw,
1104a6ae1a29SChunyan Zhang 		[CLK_AP_SYS_EB]		= &ap_sys_eb.common.hw,
1105a6ae1a29SChunyan Zhang 		[CLK_AON_TMR_EB]	= &aon_tmr_eb.common.hw,
1106a6ae1a29SChunyan Zhang 		[CLK_AP_TMR0_EB]	= &ap_tmr0_eb.common.hw,
1107a6ae1a29SChunyan Zhang 		[CLK_EFUSE_EB]		= &efuse_eb.common.hw,
1108a6ae1a29SChunyan Zhang 		[CLK_EIC_EB]		= &eic_eb.common.hw,
1109a6ae1a29SChunyan Zhang 		[CLK_PUB1_REG_EB]	= &pub1_reg_eb.common.hw,
1110a6ae1a29SChunyan Zhang 		[CLK_ADI_EB]		= &adi_eb.common.hw,
1111a6ae1a29SChunyan Zhang 		[CLK_AP_INTC0_EB]	= &ap_intc0_eb.common.hw,
1112a6ae1a29SChunyan Zhang 		[CLK_AP_INTC1_EB]	= &ap_intc1_eb.common.hw,
1113a6ae1a29SChunyan Zhang 		[CLK_AP_INTC2_EB]	= &ap_intc2_eb.common.hw,
1114a6ae1a29SChunyan Zhang 		[CLK_AP_INTC3_EB]	= &ap_intc3_eb.common.hw,
1115a6ae1a29SChunyan Zhang 		[CLK_AP_INTC4_EB]	= &ap_intc4_eb.common.hw,
1116a6ae1a29SChunyan Zhang 		[CLK_SPLK_EB]		= &splk_eb.common.hw,
1117a6ae1a29SChunyan Zhang 		[CLK_MSPI_EB]		= &mspi_eb.common.hw,
1118a6ae1a29SChunyan Zhang 		[CLK_PUB0_REG_EB]	= &pub0_reg_eb.common.hw,
1119a6ae1a29SChunyan Zhang 		[CLK_PIN_EB]		= &pin_eb.common.hw,
1120a6ae1a29SChunyan Zhang 		[CLK_AON_CKG_EB]	= &aon_ckg_eb.common.hw,
1121a6ae1a29SChunyan Zhang 		[CLK_GPU_EB]		= &gpu_eb.common.hw,
1122a6ae1a29SChunyan Zhang 		[CLK_APCPU_TS0_EB]	= &apcpu_ts0_eb.common.hw,
1123a6ae1a29SChunyan Zhang 		[CLK_APCPU_TS1_EB]	= &apcpu_ts1_eb.common.hw,
1124a6ae1a29SChunyan Zhang 		[CLK_DAP_EB]		= &dap_eb.common.hw,
1125a6ae1a29SChunyan Zhang 		[CLK_I2C_EB]		= &i2c_eb.common.hw,
1126a6ae1a29SChunyan Zhang 		[CLK_PMU_EB]		= &pmu_eb.common.hw,
1127a6ae1a29SChunyan Zhang 		[CLK_THM_EB]		= &thm_eb.common.hw,
1128a6ae1a29SChunyan Zhang 		[CLK_AUX0_EB]		= &aux0_eb.common.hw,
1129a6ae1a29SChunyan Zhang 		[CLK_AUX1_EB]		= &aux1_eb.common.hw,
1130a6ae1a29SChunyan Zhang 		[CLK_AUX2_EB]		= &aux2_eb.common.hw,
1131a6ae1a29SChunyan Zhang 		[CLK_PROBE_EB]		= &probe_eb.common.hw,
1132a6ae1a29SChunyan Zhang 		[CLK_GPU0_AVS_EB]	= &gpu0_avs_eb.common.hw,
1133a6ae1a29SChunyan Zhang 		[CLK_GPU1_AVS_EB]	= &gpu1_avs_eb.common.hw,
1134a6ae1a29SChunyan Zhang 		[CLK_APCPU_WDG_EB]	= &apcpu_wdg_eb.common.hw,
1135a6ae1a29SChunyan Zhang 		[CLK_AP_TMR1_EB]	= &ap_tmr1_eb.common.hw,
1136a6ae1a29SChunyan Zhang 		[CLK_AP_TMR2_EB]	= &ap_tmr2_eb.common.hw,
1137a6ae1a29SChunyan Zhang 		[CLK_DISP_EMC_EB]	= &disp_emc_eb.common.hw,
1138a6ae1a29SChunyan Zhang 		[CLK_ZIP_EMC_EB]	= &zip_emc_eb.common.hw,
1139a6ae1a29SChunyan Zhang 		[CLK_GSP_EMC_EB]	= &gsp_emc_eb.common.hw,
1140a6ae1a29SChunyan Zhang 		[CLK_OSC_AON_EB]	= &osc_aon_eb.common.hw,
1141a6ae1a29SChunyan Zhang 		[CLK_LVDS_TRX_EB]	= &lvds_trx_eb.common.hw,
1142a6ae1a29SChunyan Zhang 		[CLK_LVDS_TCXO_EB]	= &lvds_tcxo_eb.common.hw,
1143a6ae1a29SChunyan Zhang 		[CLK_MDAR_EB]		= &mdar_eb.common.hw,
1144a6ae1a29SChunyan Zhang 		[CLK_RTC4M0_CAL_EB]	= &rtc4m0_cal_eb.common.hw,
1145a6ae1a29SChunyan Zhang 		[CLK_RCT100M_CAL_EB]	= &rct100m_cal_eb.common.hw,
1146a6ae1a29SChunyan Zhang 		[CLK_DJTAG_EB]		= &djtag_eb.common.hw,
1147a6ae1a29SChunyan Zhang 		[CLK_MBOX_EB]		= &mbox_eb.common.hw,
1148a6ae1a29SChunyan Zhang 		[CLK_AON_DMA_EB]	= &aon_dma_eb.common.hw,
1149a6ae1a29SChunyan Zhang 		[CLK_DBG_EMC_EB]	= &dbg_emc_eb.common.hw,
1150a6ae1a29SChunyan Zhang 		[CLK_LVDS_PLL_DIV_EN]	= &lvds_pll_div_en.common.hw,
1151a6ae1a29SChunyan Zhang 		[CLK_DEF_EB]		= &def_eb.common.hw,
1152a6ae1a29SChunyan Zhang 		[CLK_AON_APB_RSV0]	= &aon_apb_rsv0.common.hw,
1153a6ae1a29SChunyan Zhang 		[CLK_ORP_JTAG_EB]	= &orp_jtag_eb.common.hw,
1154a6ae1a29SChunyan Zhang 		[CLK_VSP_EB]		= &vsp_eb.common.hw,
1155a6ae1a29SChunyan Zhang 		[CLK_CAM_EB]		= &cam_eb.common.hw,
1156a6ae1a29SChunyan Zhang 		[CLK_DISP_EB]		= &disp_eb.common.hw,
1157a6ae1a29SChunyan Zhang 		[CLK_DBG_AXI_IF_EB]	= &dbg_axi_if_eb.common.hw,
1158a6ae1a29SChunyan Zhang 		[CLK_SDIO0_2X_EN]	= &sdio0_2x_en.common.hw,
1159a6ae1a29SChunyan Zhang 		[CLK_SDIO1_2X_EN]	= &sdio1_2x_en.common.hw,
1160a6ae1a29SChunyan Zhang 		[CLK_SDIO2_2X_EN]	= &sdio2_2x_en.common.hw,
1161a6ae1a29SChunyan Zhang 		[CLK_EMMC_2X_EN]	= &emmc_2x_en.common.hw,
1162b3316a67SChunyan Zhang 		[CLK_ARCH_RTC_EB]	= &arch_rtc_eb.common.hw,
1163b3316a67SChunyan Zhang 		[CLK_KPB_RTC_EB]	= &kpb_rtc_eb.common.hw,
1164b3316a67SChunyan Zhang 		[CLK_AON_SYST_RTC_EB]	= &aon_syst_rtc_eb.common.hw,
1165b3316a67SChunyan Zhang 		[CLK_AP_SYST_RTC_EB]	= &ap_syst_rtc_eb.common.hw,
1166b3316a67SChunyan Zhang 		[CLK_AON_TMR_RTC_EB]	= &aon_tmr_rtc_eb.common.hw,
1167b3316a67SChunyan Zhang 		[CLK_AP_TMR0_RTC_EB]	= &ap_tmr0_rtc_eb.common.hw,
1168b3316a67SChunyan Zhang 		[CLK_EIC_RTC_EB]	= &eic_rtc_eb.common.hw,
1169b3316a67SChunyan Zhang 		[CLK_EIC_RTCDV5_EB]	= &eic_rtcdv5_eb.common.hw,
1170b3316a67SChunyan Zhang 		[CLK_AP_WDG_RTC_EB]	= &ap_wdg_rtc_eb.common.hw,
1171b3316a67SChunyan Zhang 		[CLK_AP_TMR1_RTC_EB]	= &ap_tmr1_rtc_eb.common.hw,
1172b3316a67SChunyan Zhang 		[CLK_AP_TMR2_RTC_EB]	= &ap_tmr2_rtc_eb.common.hw,
1173b3316a67SChunyan Zhang 		[CLK_DCXO_TMR_RTC_EB]	= &dcxo_tmr_rtc_eb.common.hw,
1174b3316a67SChunyan Zhang 		[CLK_BB_CAL_RTC_EB]	= &bb_cal_rtc_eb.common.hw,
1175b3316a67SChunyan Zhang 		[CLK_AVS_BIG_RTC_EB]	= &avs_big_rtc_eb.common.hw,
1176b3316a67SChunyan Zhang 		[CLK_AVS_LIT_RTC_EB]	= &avs_lit_rtc_eb.common.hw,
1177b3316a67SChunyan Zhang 		[CLK_AVS_GPU0_RTC_EB]	= &avs_gpu0_rtc_eb.common.hw,
1178b3316a67SChunyan Zhang 		[CLK_AVS_GPU1_RTC_EB]	= &avs_gpu1_rtc_eb.common.hw,
1179b3316a67SChunyan Zhang 		[CLK_GPU_TS_EB]		= &gpu_ts_eb.common.hw,
1180b3316a67SChunyan Zhang 		[CLK_RTCDV10_EB]	= &rtcdv10_eb.common.hw,
1181a6ae1a29SChunyan Zhang 	},
1182a6ae1a29SChunyan Zhang 	.num	= CLK_AON_GATE_NUM,
1183a6ae1a29SChunyan Zhang };
1184a6ae1a29SChunyan Zhang 
1185a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_aon_gate_desc = {
1186a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_aon_gate,
1187a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_aon_gate),
1188a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_aon_gate_hws,
1189a6ae1a29SChunyan Zhang };
1190a6ae1a29SChunyan Zhang 
1191a6ae1a29SChunyan Zhang static const u8 mcu_table[] = { 0, 1, 2, 3, 4, 8 };
1192a6ae1a29SChunyan Zhang static const char * const lit_mcu_parents[] = {	"ext-26m",	"twpll-512m",
1193a6ae1a29SChunyan Zhang 						"twpll-768m",	"ltepll0",
1194a6ae1a29SChunyan Zhang 						"twpll",	"mpll0" };
1195a6ae1a29SChunyan Zhang static SPRD_COMP_CLK_TABLE(lit_mcu, "lit-mcu", lit_mcu_parents, 0x20,
1196a6ae1a29SChunyan Zhang 			   mcu_table, 0, 4, 4, 3, 0);
1197a6ae1a29SChunyan Zhang 
1198a6ae1a29SChunyan Zhang static const char * const big_mcu_parents[] = {	"ext-26m",	"twpll-512m",
1199a6ae1a29SChunyan Zhang 						"twpll-768m",	"ltepll0",
1200a6ae1a29SChunyan Zhang 						"twpll",	"mpll1" };
1201a6ae1a29SChunyan Zhang static SPRD_COMP_CLK_TABLE(big_mcu, "big-mcu", big_mcu_parents, 0x24,
1202a6ae1a29SChunyan Zhang 			   mcu_table, 0, 4, 4, 3, 0);
1203a6ae1a29SChunyan Zhang 
1204a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_aonsecure_clk[] = {
1205a6ae1a29SChunyan Zhang 	/* address base is 0x40880000 */
1206a6ae1a29SChunyan Zhang 	&lit_mcu.common,
1207a6ae1a29SChunyan Zhang 	&big_mcu.common,
1208a6ae1a29SChunyan Zhang };
1209a6ae1a29SChunyan Zhang 
1210a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_aonsecure_clk_hws = {
1211a6ae1a29SChunyan Zhang 	.hws	= {
1212a6ae1a29SChunyan Zhang 		[CLK_LIT_MCU]		= &lit_mcu.common.hw,
1213a6ae1a29SChunyan Zhang 		[CLK_BIG_MCU]		= &big_mcu.common.hw,
1214a6ae1a29SChunyan Zhang 	},
1215a6ae1a29SChunyan Zhang 	.num	= CLK_AONSECURE_NUM,
1216a6ae1a29SChunyan Zhang };
1217a6ae1a29SChunyan Zhang 
1218a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_aonsecure_clk_desc = {
1219a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_aonsecure_clk,
1220a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_aonsecure_clk),
1221a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_aonsecure_clk_hws,
1222a6ae1a29SChunyan Zhang };
1223a6ae1a29SChunyan Zhang 
1224a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_iis0_eb,	"agcp-iis0-eb",		"aon-apb",
1225a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(0), 0, 0);
1226a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_iis1_eb,	"agcp-iis1-eb",		"aon-apb",
1227a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(1), 0, 0);
1228a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_iis2_eb,	"agcp-iis2-eb",		"aon-apb",
1229a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(2), 0, 0);
1230a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_iis3_eb,	"agcp-iis3-eb",		"aon-apb",
1231a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(3), 0, 0);
1232a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_uart_eb,	"agcp-uart-eb",		"aon-apb",
1233a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(4), 0, 0);
1234a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_dmacp_eb,	"agcp-dmacp-eb",	"aon-apb",
1235a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(5), 0, 0);
1236a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_dmaap_eb,	"agcp-dmaap-eb",	"aon-apb",
1237a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(6), 0, 0);
1238a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_arc48k_eb,	"agcp-arc48k-eb",	"aon-apb",
1239a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(10), 0, 0);
1240a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_src44p1k_eb, "agcp-src44p1k-eb",	"aon-apb",
1241a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(11), 0, 0);
1242a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_mcdt_eb,	"agcp-mcdt-eb",		"aon-apb",
1243a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(12), 0, 0);
1244a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_vbcifd_eb,	"agcp-vbcifd-eb",	"aon-apb",
1245a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(13), 0, 0);
1246a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_vbc_eb,	"agcp-vbc-eb",		"aon-apb",
1247a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(14), 0, 0);
1248a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_spinlock_eb, "agcp-spinlock-eb",	"aon-apb",
1249a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(15), 0, 0);
1250a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_icu_eb,	"agcp-icu-eb",		"aon-apb",
1251a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(16), CLK_IGNORE_UNUSED, 0);
1252a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_ap_ashb_eb, "agcp-ap-ashb-eb",	"aon-apb",
1253a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(17), 0, 0);
1254a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_cp_ashb_eb, "agcp-cp-ashb-eb",	"aon-apb",
1255a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(18), 0, 0);
1256a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_aud_eb,	"agcp-aud-eb",		"aon-apb",
1257a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(19), 0, 0);
1258a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(agcp_audif_eb,	"agcp-audif-eb",	"aon-apb",
1259a6ae1a29SChunyan Zhang 		     0x0, 0x100, BIT(20), 0, 0);
1260a6ae1a29SChunyan Zhang 
1261a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_agcp_gate[] = {
1262a6ae1a29SChunyan Zhang 	/* address base is 0x415e0000 */
1263a6ae1a29SChunyan Zhang 	&agcp_iis0_eb.common,
1264a6ae1a29SChunyan Zhang 	&agcp_iis1_eb.common,
1265a6ae1a29SChunyan Zhang 	&agcp_iis2_eb.common,
1266a6ae1a29SChunyan Zhang 	&agcp_iis3_eb.common,
1267a6ae1a29SChunyan Zhang 	&agcp_uart_eb.common,
1268a6ae1a29SChunyan Zhang 	&agcp_dmacp_eb.common,
1269a6ae1a29SChunyan Zhang 	&agcp_dmaap_eb.common,
1270a6ae1a29SChunyan Zhang 	&agcp_arc48k_eb.common,
1271a6ae1a29SChunyan Zhang 	&agcp_src44p1k_eb.common,
1272a6ae1a29SChunyan Zhang 	&agcp_mcdt_eb.common,
1273a6ae1a29SChunyan Zhang 	&agcp_vbcifd_eb.common,
1274a6ae1a29SChunyan Zhang 	&agcp_vbc_eb.common,
1275a6ae1a29SChunyan Zhang 	&agcp_spinlock_eb.common,
1276a6ae1a29SChunyan Zhang 	&agcp_icu_eb.common,
1277a6ae1a29SChunyan Zhang 	&agcp_ap_ashb_eb.common,
1278a6ae1a29SChunyan Zhang 	&agcp_cp_ashb_eb.common,
1279a6ae1a29SChunyan Zhang 	&agcp_aud_eb.common,
1280a6ae1a29SChunyan Zhang 	&agcp_audif_eb.common,
1281a6ae1a29SChunyan Zhang };
1282a6ae1a29SChunyan Zhang 
1283a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_agcp_gate_hws = {
1284a6ae1a29SChunyan Zhang 	.hws	= {
1285a6ae1a29SChunyan Zhang 		[CLK_AGCP_IIS0_EB]	= &agcp_iis0_eb.common.hw,
1286a6ae1a29SChunyan Zhang 		[CLK_AGCP_IIS1_EB]	= &agcp_iis1_eb.common.hw,
1287a6ae1a29SChunyan Zhang 		[CLK_AGCP_IIS2_EB]	= &agcp_iis2_eb.common.hw,
1288a6ae1a29SChunyan Zhang 		[CLK_AGCP_IIS3_EB]	= &agcp_iis3_eb.common.hw,
1289a6ae1a29SChunyan Zhang 		[CLK_AGCP_UART_EB]	= &agcp_uart_eb.common.hw,
1290a6ae1a29SChunyan Zhang 		[CLK_AGCP_DMACP_EB]	= &agcp_dmacp_eb.common.hw,
1291a6ae1a29SChunyan Zhang 		[CLK_AGCP_DMAAP_EB]	= &agcp_dmaap_eb.common.hw,
1292a6ae1a29SChunyan Zhang 		[CLK_AGCP_ARC48K_EB]	= &agcp_arc48k_eb.common.hw,
1293a6ae1a29SChunyan Zhang 		[CLK_AGCP_SRC44P1K_EB]	= &agcp_src44p1k_eb.common.hw,
1294a6ae1a29SChunyan Zhang 		[CLK_AGCP_MCDT_EB]	= &agcp_mcdt_eb.common.hw,
1295a6ae1a29SChunyan Zhang 		[CLK_AGCP_VBCIFD_EB]	= &agcp_vbcifd_eb.common.hw,
1296a6ae1a29SChunyan Zhang 		[CLK_AGCP_VBC_EB]	= &agcp_vbc_eb.common.hw,
1297a6ae1a29SChunyan Zhang 		[CLK_AGCP_SPINLOCK_EB]	= &agcp_spinlock_eb.common.hw,
1298a6ae1a29SChunyan Zhang 		[CLK_AGCP_ICU_EB]	= &agcp_icu_eb.common.hw,
1299a6ae1a29SChunyan Zhang 		[CLK_AGCP_AP_ASHB_EB]	= &agcp_ap_ashb_eb.common.hw,
1300a6ae1a29SChunyan Zhang 		[CLK_AGCP_CP_ASHB_EB]	= &agcp_cp_ashb_eb.common.hw,
1301a6ae1a29SChunyan Zhang 		[CLK_AGCP_AUD_EB]	= &agcp_aud_eb.common.hw,
1302a6ae1a29SChunyan Zhang 		[CLK_AGCP_AUDIF_EB]	= &agcp_audif_eb.common.hw,
1303a6ae1a29SChunyan Zhang 	},
1304a6ae1a29SChunyan Zhang 	.num	= CLK_AGCP_GATE_NUM,
1305a6ae1a29SChunyan Zhang };
1306a6ae1a29SChunyan Zhang 
1307a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_agcp_gate_desc = {
1308a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_agcp_gate,
1309a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_agcp_gate),
1310a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_agcp_gate_hws,
1311a6ae1a29SChunyan Zhang };
1312a6ae1a29SChunyan Zhang 
1313a6ae1a29SChunyan Zhang static const char * const gpu_parents[] = { "twpll-512m",
1314a6ae1a29SChunyan Zhang 					    "twpll-768m",
1315a6ae1a29SChunyan Zhang 					    "gpll" };
1316a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(gpu_clk,	"gpu",	gpu_parents, 0x20,
1317a6ae1a29SChunyan Zhang 		     0, 2, 8, 4, 0);
1318a6ae1a29SChunyan Zhang 
1319a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_gpu_clk[] = {
1320a6ae1a29SChunyan Zhang 	/* address base is 0x60200000 */
1321a6ae1a29SChunyan Zhang 	&gpu_clk.common,
1322a6ae1a29SChunyan Zhang };
1323a6ae1a29SChunyan Zhang 
1324a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_gpu_clk_hws = {
1325a6ae1a29SChunyan Zhang 	.hws	= {
1326a6ae1a29SChunyan Zhang 		[CLK_GPU]	= &gpu_clk.common.hw,
1327a6ae1a29SChunyan Zhang 	},
1328a6ae1a29SChunyan Zhang 	.num	= CLK_GPU_NUM,
1329a6ae1a29SChunyan Zhang };
1330a6ae1a29SChunyan Zhang 
1331a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_gpu_clk_desc = {
1332a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_gpu_clk,
1333a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_gpu_clk),
1334a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_gpu_clk_hws,
1335a6ae1a29SChunyan Zhang };
1336a6ae1a29SChunyan Zhang 
1337a6ae1a29SChunyan Zhang static const char * const ahb_parents[] = { "ext-26m", "twpll-96m",
1338a6ae1a29SChunyan Zhang 					    "twpll-128m", "twpll-153m6" };
1339a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(ahb_vsp, "ahb-vsp", ahb_parents, 0x20,
1340a6ae1a29SChunyan Zhang 		    0, 2, SC9860_MUX_FLAG);
1341a6ae1a29SChunyan Zhang 
1342a6ae1a29SChunyan Zhang static const char * const vsp_parents[] = {	"twpll-76m8",	"twpll-128m",
1343a6ae1a29SChunyan Zhang 						"twpll-256m",	"twpll-307m2",
1344a6ae1a29SChunyan Zhang 						"twpll-384m" };
1345a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(vsp_clk, "vsp", vsp_parents, 0x24, 0, 3, 8, 2, 0);
1346a6ae1a29SChunyan Zhang 
1347a6ae1a29SChunyan Zhang static const char * const dispc_parents[] = {	"twpll-76m8",	"twpll-128m",
1348a6ae1a29SChunyan Zhang 						"twpll-256m",	"twpll-307m2" };
1349a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(vsp_enc, "vsp-enc", dispc_parents, 0x28, 0, 2, 8, 2, 0);
1350a6ae1a29SChunyan Zhang 
1351a6ae1a29SChunyan Zhang static const char * const vpp_parents[] = { "twpll-96m", "twpll-153m6",
1352a6ae1a29SChunyan Zhang 					    "twpll-192m", "twpll-256m" };
1353a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(vpp_clk, "vpp", vpp_parents, 0x2c,
1354a6ae1a29SChunyan Zhang 		    0, 2, SC9860_MUX_FLAG);
1355a6ae1a29SChunyan Zhang static const char * const vsp_26m_parents[] = { "ext-26m" };
1356a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(vsp_26m, "vsp-26m", vsp_26m_parents, 0x30,
1357a6ae1a29SChunyan Zhang 		    0, 1, SC9860_MUX_FLAG);
1358a6ae1a29SChunyan Zhang 
1359a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_vsp_clk[] = {
1360a6ae1a29SChunyan Zhang 	/* address base is 0x61000000 */
1361a6ae1a29SChunyan Zhang 	&ahb_vsp.common,
1362a6ae1a29SChunyan Zhang 	&vsp_clk.common,
1363a6ae1a29SChunyan Zhang 	&vsp_enc.common,
1364a6ae1a29SChunyan Zhang 	&vpp_clk.common,
1365a6ae1a29SChunyan Zhang 	&vsp_26m.common,
1366a6ae1a29SChunyan Zhang };
1367a6ae1a29SChunyan Zhang 
1368a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_vsp_clk_hws = {
1369a6ae1a29SChunyan Zhang 	.hws	= {
1370a6ae1a29SChunyan Zhang 		[CLK_AHB_VSP]	= &ahb_vsp.common.hw,
1371a6ae1a29SChunyan Zhang 		[CLK_VSP]	= &vsp_clk.common.hw,
1372a6ae1a29SChunyan Zhang 		[CLK_VSP_ENC]	= &vsp_enc.common.hw,
1373a6ae1a29SChunyan Zhang 		[CLK_VPP]	= &vpp_clk.common.hw,
1374a6ae1a29SChunyan Zhang 		[CLK_VSP_26M]	= &vsp_26m.common.hw,
1375a6ae1a29SChunyan Zhang 	},
1376a6ae1a29SChunyan Zhang 	.num	= CLK_VSP_NUM,
1377a6ae1a29SChunyan Zhang };
1378a6ae1a29SChunyan Zhang 
1379a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_vsp_clk_desc = {
1380a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_vsp_clk,
1381a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_vsp_clk),
1382a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_vsp_clk_hws,
1383a6ae1a29SChunyan Zhang };
1384a6ae1a29SChunyan Zhang 
1385a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(vsp_dec_eb,	"vsp-dec-eb",	"ahb-vsp", 0x0,
1386a6ae1a29SChunyan Zhang 		     0x1000, BIT(0), 0, 0);
1387a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(vsp_ckg_eb,	"vsp-ckg-eb",	"ahb-vsp", 0x0,
1388a6ae1a29SChunyan Zhang 		     0x1000, BIT(1), 0, 0);
1389a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(vsp_mmu_eb,	"vsp-mmu-eb",	"ahb-vsp", 0x0,
1390a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), 0, 0);
1391a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(vsp_enc_eb,	"vsp-enc-eb",	"ahb-vsp", 0x0,
1392a6ae1a29SChunyan Zhang 		     0x1000, BIT(3), 0, 0);
1393a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(vpp_eb,		"vpp-eb",	"ahb-vsp", 0x0,
1394a6ae1a29SChunyan Zhang 		     0x1000, BIT(4), 0, 0);
1395a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(vsp_26m_eb,	"vsp-26m-eb",	"ahb-vsp", 0x0,
1396a6ae1a29SChunyan Zhang 		     0x1000, BIT(5), 0, 0);
1397a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(vsp_axi_gate,	"vsp-axi-gate",	"ahb-vsp", 0x8,
1398a6ae1a29SChunyan Zhang 		     BIT(0), 0, 0);
1399a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(vsp_enc_gate,	"vsp-enc-gate",	"ahb-vsp", 0x8,
1400a6ae1a29SChunyan Zhang 		     BIT(1), 0, 0);
1401a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(vpp_axi_gate,	"vpp-axi-gate",	"ahb-vsp", 0x8,
1402a6ae1a29SChunyan Zhang 		     BIT(2), 0, 0);
1403a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(vsp_bm_gate,	"vsp-bm-gate",	"ahb-vsp", 0x8,
1404a6ae1a29SChunyan Zhang 		     BIT(8), 0, 0);
1405a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(vsp_enc_bm_gate, "vsp-enc-bm-gate", "ahb-vsp", 0x8,
1406a6ae1a29SChunyan Zhang 		     BIT(9), 0, 0);
1407a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(vpp_bm_gate,	"vpp-bm-gate",	"ahb-vsp", 0x8,
1408a6ae1a29SChunyan Zhang 		     BIT(10), 0, 0);
1409a6ae1a29SChunyan Zhang 
1410a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_vsp_gate[] = {
1411a6ae1a29SChunyan Zhang 	/* address base is 0x61100000 */
1412a6ae1a29SChunyan Zhang 	&vsp_dec_eb.common,
1413a6ae1a29SChunyan Zhang 	&vsp_ckg_eb.common,
1414a6ae1a29SChunyan Zhang 	&vsp_mmu_eb.common,
1415a6ae1a29SChunyan Zhang 	&vsp_enc_eb.common,
1416a6ae1a29SChunyan Zhang 	&vpp_eb.common,
1417a6ae1a29SChunyan Zhang 	&vsp_26m_eb.common,
1418a6ae1a29SChunyan Zhang 	&vsp_axi_gate.common,
1419a6ae1a29SChunyan Zhang 	&vsp_enc_gate.common,
1420a6ae1a29SChunyan Zhang 	&vpp_axi_gate.common,
1421a6ae1a29SChunyan Zhang 	&vsp_bm_gate.common,
1422a6ae1a29SChunyan Zhang 	&vsp_enc_bm_gate.common,
1423a6ae1a29SChunyan Zhang 	&vpp_bm_gate.common,
1424a6ae1a29SChunyan Zhang };
1425a6ae1a29SChunyan Zhang 
1426a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_vsp_gate_hws = {
1427a6ae1a29SChunyan Zhang 	.hws	= {
1428a6ae1a29SChunyan Zhang 		[CLK_VSP_DEC_EB]	= &vsp_dec_eb.common.hw,
1429a6ae1a29SChunyan Zhang 		[CLK_VSP_CKG_EB]	= &vsp_ckg_eb.common.hw,
1430a6ae1a29SChunyan Zhang 		[CLK_VSP_MMU_EB]	= &vsp_mmu_eb.common.hw,
1431a6ae1a29SChunyan Zhang 		[CLK_VSP_ENC_EB]	= &vsp_enc_eb.common.hw,
1432a6ae1a29SChunyan Zhang 		[CLK_VPP_EB]		= &vpp_eb.common.hw,
1433a6ae1a29SChunyan Zhang 		[CLK_VSP_26M_EB]	= &vsp_26m_eb.common.hw,
1434a6ae1a29SChunyan Zhang 		[CLK_VSP_AXI_GATE]	= &vsp_axi_gate.common.hw,
1435a6ae1a29SChunyan Zhang 		[CLK_VSP_ENC_GATE]	= &vsp_enc_gate.common.hw,
1436a6ae1a29SChunyan Zhang 		[CLK_VPP_AXI_GATE]	= &vpp_axi_gate.common.hw,
1437a6ae1a29SChunyan Zhang 		[CLK_VSP_BM_GATE]	= &vsp_bm_gate.common.hw,
1438a6ae1a29SChunyan Zhang 		[CLK_VSP_ENC_BM_GATE]	= &vsp_enc_bm_gate.common.hw,
1439a6ae1a29SChunyan Zhang 		[CLK_VPP_BM_GATE]	= &vpp_bm_gate.common.hw,
1440a6ae1a29SChunyan Zhang 	},
1441a6ae1a29SChunyan Zhang 	.num	= CLK_VSP_GATE_NUM,
1442a6ae1a29SChunyan Zhang };
1443a6ae1a29SChunyan Zhang 
1444a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_vsp_gate_desc = {
1445a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_vsp_gate,
1446a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_vsp_gate),
1447a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_vsp_gate_hws,
1448a6ae1a29SChunyan Zhang };
1449a6ae1a29SChunyan Zhang 
1450a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(ahb_cam, "ahb-cam", ahb_parents, 0x20,
1451a6ae1a29SChunyan Zhang 		    0, 2, SC9860_MUX_FLAG);
1452a6ae1a29SChunyan Zhang static const char * const sensor_parents[] = {	"ext-26m",	"twpll-48m",
1453a6ae1a29SChunyan Zhang 						"twpll-76m8",	"twpll-96m" };
1454a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(sensor0_clk, "sensor0", sensor_parents, 0x24,
1455a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
1456a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(sensor1_clk, "sensor1", sensor_parents, 0x28,
1457a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
1458a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(sensor2_clk, "sensor2", sensor_parents, 0x2c,
1459a6ae1a29SChunyan Zhang 		     0, 2, 8, 3, 0);
1460a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(mipi_csi0_eb, "mipi-csi0-eb", "ahb-cam", 0x4c,
1461a6ae1a29SChunyan Zhang 		     BIT(16), 0, 0);
1462a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(mipi_csi1_eb, "mipi-csi1-eb", "ahb-cam", 0x50,
1463a6ae1a29SChunyan Zhang 		     BIT(16), 0, 0);
1464a6ae1a29SChunyan Zhang 
1465a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_cam_clk[] = {
1466a6ae1a29SChunyan Zhang 	/* address base is 0x62000000 */
1467a6ae1a29SChunyan Zhang 	&ahb_cam.common,
1468a6ae1a29SChunyan Zhang 	&sensor0_clk.common,
1469a6ae1a29SChunyan Zhang 	&sensor1_clk.common,
1470a6ae1a29SChunyan Zhang 	&sensor2_clk.common,
1471a6ae1a29SChunyan Zhang 	&mipi_csi0_eb.common,
1472a6ae1a29SChunyan Zhang 	&mipi_csi1_eb.common,
1473a6ae1a29SChunyan Zhang };
1474a6ae1a29SChunyan Zhang 
1475a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_cam_clk_hws = {
1476a6ae1a29SChunyan Zhang 	.hws	= {
1477a6ae1a29SChunyan Zhang 		[CLK_AHB_CAM]		= &ahb_cam.common.hw,
1478a6ae1a29SChunyan Zhang 		[CLK_SENSOR0]		= &sensor0_clk.common.hw,
1479a6ae1a29SChunyan Zhang 		[CLK_SENSOR1]		= &sensor1_clk.common.hw,
1480a6ae1a29SChunyan Zhang 		[CLK_SENSOR2]		= &sensor2_clk.common.hw,
1481a6ae1a29SChunyan Zhang 		[CLK_MIPI_CSI0_EB]	= &mipi_csi0_eb.common.hw,
1482a6ae1a29SChunyan Zhang 		[CLK_MIPI_CSI1_EB]	= &mipi_csi1_eb.common.hw,
1483a6ae1a29SChunyan Zhang 	},
1484a6ae1a29SChunyan Zhang 	.num	= CLK_CAM_NUM,
1485a6ae1a29SChunyan Zhang };
1486a6ae1a29SChunyan Zhang 
1487a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_cam_clk_desc = {
1488a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_cam_clk,
1489a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_cam_clk),
1490a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_cam_clk_hws,
1491a6ae1a29SChunyan Zhang };
1492a6ae1a29SChunyan Zhang 
1493a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dcam0_eb,		"dcam0-eb",	"ahb-cam", 0x0,
1494a6ae1a29SChunyan Zhang 		     0x1000, BIT(0), 0, 0);
1495a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dcam1_eb,		"dcam1-eb",	"ahb-cam", 0x0,
1496a6ae1a29SChunyan Zhang 		     0x1000, BIT(1), 0, 0);
1497a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(isp0_eb,		"isp0-eb",	"ahb-cam", 0x0,
1498a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), 0, 0);
1499a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(csi0_eb,		"csi0-eb",	"ahb-cam", 0x0,
1500a6ae1a29SChunyan Zhang 		     0x1000, BIT(3), 0, 0);
1501a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(csi1_eb,		"csi1-eb",	"ahb-cam", 0x0,
1502a6ae1a29SChunyan Zhang 		     0x1000, BIT(4), 0, 0);
1503a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(jpg0_eb,		"jpg0-eb",	"ahb-cam", 0x0,
1504a6ae1a29SChunyan Zhang 		     0x1000, BIT(5), 0, 0);
1505a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(jpg1_eb,		"jpg1-eb",	"ahb-cam", 0x0,
1506a6ae1a29SChunyan Zhang 		     0x1000, BIT(6), 0, 0);
1507a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(cam_ckg_eb,	"cam-ckg-eb",	"ahb-cam", 0x0,
1508a6ae1a29SChunyan Zhang 		     0x1000, BIT(7), 0, 0);
1509a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(cam_mmu_eb,	"cam-mmu-eb",	"ahb-cam", 0x0,
1510a6ae1a29SChunyan Zhang 		     0x1000, BIT(8), 0, 0);
1511a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(isp1_eb,		"isp1-eb",	"ahb-cam", 0x0,
1512a6ae1a29SChunyan Zhang 		     0x1000, BIT(9), 0, 0);
1513a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(cpp_eb,		"cpp-eb",	"ahb-cam", 0x0,
1514a6ae1a29SChunyan Zhang 		     0x1000, BIT(10), 0, 0);
1515a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(mmu_pf_eb,		"mmu-pf-eb",	"ahb-cam", 0x0,
1516a6ae1a29SChunyan Zhang 		     0x1000, BIT(11), 0, 0);
1517a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(isp2_eb,		"isp2-eb",	"ahb-cam", 0x0,
1518a6ae1a29SChunyan Zhang 		     0x1000, BIT(12), 0, 0);
1519a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dcam2isp_if_eb, "dcam2isp-if-eb",	"ahb-cam", 0x0,
1520a6ae1a29SChunyan Zhang 		     0x1000, BIT(13), 0, 0);
1521a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(isp2dcam_if_eb, "isp2dcam-if-eb",	"ahb-cam", 0x0,
1522a6ae1a29SChunyan Zhang 		     0x1000, BIT(14), 0, 0);
1523a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(isp_lclk_eb,	"isp-lclk-eb",	"ahb-cam", 0x0,
1524a6ae1a29SChunyan Zhang 		     0x1000, BIT(15), 0, 0);
1525a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(isp_iclk_eb,	"isp-iclk-eb",	"ahb-cam", 0x0,
1526a6ae1a29SChunyan Zhang 		     0x1000, BIT(16), 0, 0);
1527a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(isp_mclk_eb,	"isp-mclk-eb",	"ahb-cam", 0x0,
1528a6ae1a29SChunyan Zhang 		     0x1000, BIT(17), 0, 0);
1529a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(isp_pclk_eb,	"isp-pclk-eb",	"ahb-cam", 0x0,
1530a6ae1a29SChunyan Zhang 		     0x1000, BIT(18), 0, 0);
1531a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(isp_isp2dcam_eb, "isp-isp2dcam-eb", "ahb-cam", 0x0,
1532a6ae1a29SChunyan Zhang 		     0x1000, BIT(19), 0, 0);
1533a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dcam0_if_eb,	"dcam0-if-eb",	"ahb-cam", 0x0,
1534a6ae1a29SChunyan Zhang 		     0x1000, BIT(20), 0, 0);
1535a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(clk26m_if_eb,	"clk26m-if-eb",	"ahb-cam", 0x0,
1536a6ae1a29SChunyan Zhang 		     0x1000, BIT(21), 0, 0);
1537a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(cphy0_gate, "cphy0-gate", "ahb-cam", 0x8,
1538a6ae1a29SChunyan Zhang 		     BIT(0), 0, 0);
1539a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(mipi_csi0_gate, "mipi-csi0-gate", "ahb-cam", 0x8,
1540a6ae1a29SChunyan Zhang 		     BIT(1), 0, 0);
1541a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(cphy1_gate,	"cphy1-gate",	"ahb-cam", 0x8,
1542a6ae1a29SChunyan Zhang 		     BIT(2), 0, 0);
1543a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(mipi_csi1,		"mipi-csi1",	"ahb-cam", 0x8,
1544a6ae1a29SChunyan Zhang 		     BIT(3), 0, 0);
1545a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(dcam0_axi_gate,	"dcam0-axi-gate", "ahb-cam", 0x8,
1546a6ae1a29SChunyan Zhang 		     BIT(4), 0, 0);
1547a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(dcam1_axi_gate,	"dcam1-axi-gate", "ahb-cam", 0x8,
1548a6ae1a29SChunyan Zhang 		     BIT(5), 0, 0);
1549a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(sensor0_gate,	"sensor0-gate",	"ahb-cam", 0x8,
1550a6ae1a29SChunyan Zhang 		     BIT(6), 0, 0);
1551a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(sensor1_gate,	"sensor1-gate",	"ahb-cam", 0x8,
1552a6ae1a29SChunyan Zhang 		     BIT(7), 0, 0);
1553a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(jpg0_axi_gate,	"jpg0-axi-gate", "ahb-cam", 0x8,
1554a6ae1a29SChunyan Zhang 		     BIT(8), 0, 0);
1555a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(gpg1_axi_gate,	"gpg1-axi-gate", "ahb-cam", 0x8,
1556a6ae1a29SChunyan Zhang 		     BIT(9), 0, 0);
1557a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(isp0_axi_gate,	"isp0-axi-gate", "ahb-cam", 0x8,
1558a6ae1a29SChunyan Zhang 		     BIT(10), 0, 0);
1559a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(isp1_axi_gate,	"isp1-axi-gate", "ahb-cam", 0x8,
1560a6ae1a29SChunyan Zhang 		     BIT(11), 0, 0);
1561a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(isp2_axi_gate,	"isp2-axi-gate", "ahb-cam", 0x8,
1562a6ae1a29SChunyan Zhang 		     BIT(12), 0, 0);
1563a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(cpp_axi_gate,	"cpp-axi-gate",	"ahb-cam", 0x8,
1564a6ae1a29SChunyan Zhang 		     BIT(13), 0, 0);
1565a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(d0_if_axi_gate,	"d0-if-axi-gate", "ahb-cam", 0x8,
1566a6ae1a29SChunyan Zhang 		     BIT(14), 0, 0);
1567a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(d2i_if_axi_gate, "d2i-if-axi-gate", "ahb-cam", 0x8,
1568a6ae1a29SChunyan Zhang 		     BIT(15), 0, 0);
1569a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(i2d_if_axi_gate, "i2d-if-axi-gate", "ahb-cam", 0x8,
1570a6ae1a29SChunyan Zhang 		     BIT(16), 0, 0);
1571a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(spare_axi_gate, "spare-axi-gate",	"ahb-cam", 0x8,
1572a6ae1a29SChunyan Zhang 		     BIT(17), 0, 0);
1573a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(sensor2_gate, "sensor2-gate",	"ahb-cam", 0x8,
1574a6ae1a29SChunyan Zhang 		     BIT(18), 0, 0);
1575a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(d0if_in_d_en, "d0if-in-d-en", "ahb-cam", 0x28,
1576a6ae1a29SChunyan Zhang 		     0x1000, BIT(0), 0, 0);
1577a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(d1if_in_d_en, "d1if-in-d-en", "ahb-cam", 0x28,
1578a6ae1a29SChunyan Zhang 		     0x1000, BIT(1), 0, 0);
1579a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(d0if_in_d2i_en, "d0if-in-d2i-en", "ahb-cam", 0x28,
1580a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), 0, 0);
1581a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(d1if_in_d2i_en, "d1if-in-d2i-en",	"ahb-cam", 0x28,
1582a6ae1a29SChunyan Zhang 		     0x1000, BIT(3), 0, 0);
1583a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ia_in_d2i_en, "ia-in-d2i-en",	"ahb-cam", 0x28,
1584a6ae1a29SChunyan Zhang 		     0x1000, BIT(4), 0, 0);
1585a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ib_in_d2i_en,	"ib-in-d2i-en",	"ahb-cam", 0x28,
1586a6ae1a29SChunyan Zhang 		     0x1000, BIT(5), 0, 0);
1587a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ic_in_d2i_en,	"ic-in-d2i-en",	"ahb-cam", 0x28,
1588a6ae1a29SChunyan Zhang 		     0x1000, BIT(6), 0, 0);
1589a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ia_in_i_en,	"ia-in-i-en",	"ahb-cam", 0x28,
1590a6ae1a29SChunyan Zhang 		     0x1000, BIT(7), 0, 0);
1591a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ib_in_i_en,	"ib-in-i-en",	"ahb-cam", 0x28,
1592a6ae1a29SChunyan Zhang 		     0x1000, BIT(8), 0, 0);
1593a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ic_in_i_en,	"ic-in-i-en",	"ahb-cam", 0x28,
1594a6ae1a29SChunyan Zhang 		     0x1000, BIT(9), 0, 0);
1595a6ae1a29SChunyan Zhang 
1596a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_cam_gate[] = {
1597a6ae1a29SChunyan Zhang 	/* address base is 0x62100000 */
1598a6ae1a29SChunyan Zhang 	&dcam0_eb.common,
1599a6ae1a29SChunyan Zhang 	&dcam1_eb.common,
1600a6ae1a29SChunyan Zhang 	&isp0_eb.common,
1601a6ae1a29SChunyan Zhang 	&csi0_eb.common,
1602a6ae1a29SChunyan Zhang 	&csi1_eb.common,
1603a6ae1a29SChunyan Zhang 	&jpg0_eb.common,
1604a6ae1a29SChunyan Zhang 	&jpg1_eb.common,
1605a6ae1a29SChunyan Zhang 	&cam_ckg_eb.common,
1606a6ae1a29SChunyan Zhang 	&cam_mmu_eb.common,
1607a6ae1a29SChunyan Zhang 	&isp1_eb.common,
1608a6ae1a29SChunyan Zhang 	&cpp_eb.common,
1609a6ae1a29SChunyan Zhang 	&mmu_pf_eb.common,
1610a6ae1a29SChunyan Zhang 	&isp2_eb.common,
1611a6ae1a29SChunyan Zhang 	&dcam2isp_if_eb.common,
1612a6ae1a29SChunyan Zhang 	&isp2dcam_if_eb.common,
1613a6ae1a29SChunyan Zhang 	&isp_lclk_eb.common,
1614a6ae1a29SChunyan Zhang 	&isp_iclk_eb.common,
1615a6ae1a29SChunyan Zhang 	&isp_mclk_eb.common,
1616a6ae1a29SChunyan Zhang 	&isp_pclk_eb.common,
1617a6ae1a29SChunyan Zhang 	&isp_isp2dcam_eb.common,
1618a6ae1a29SChunyan Zhang 	&dcam0_if_eb.common,
1619a6ae1a29SChunyan Zhang 	&clk26m_if_eb.common,
1620a6ae1a29SChunyan Zhang 	&cphy0_gate.common,
1621a6ae1a29SChunyan Zhang 	&mipi_csi0_gate.common,
1622a6ae1a29SChunyan Zhang 	&cphy1_gate.common,
1623a6ae1a29SChunyan Zhang 	&mipi_csi1.common,
1624a6ae1a29SChunyan Zhang 	&dcam0_axi_gate.common,
1625a6ae1a29SChunyan Zhang 	&dcam1_axi_gate.common,
1626a6ae1a29SChunyan Zhang 	&sensor0_gate.common,
1627a6ae1a29SChunyan Zhang 	&sensor1_gate.common,
1628a6ae1a29SChunyan Zhang 	&jpg0_axi_gate.common,
1629a6ae1a29SChunyan Zhang 	&gpg1_axi_gate.common,
1630a6ae1a29SChunyan Zhang 	&isp0_axi_gate.common,
1631a6ae1a29SChunyan Zhang 	&isp1_axi_gate.common,
1632a6ae1a29SChunyan Zhang 	&isp2_axi_gate.common,
1633a6ae1a29SChunyan Zhang 	&cpp_axi_gate.common,
1634a6ae1a29SChunyan Zhang 	&d0_if_axi_gate.common,
1635a6ae1a29SChunyan Zhang 	&d2i_if_axi_gate.common,
1636a6ae1a29SChunyan Zhang 	&i2d_if_axi_gate.common,
1637a6ae1a29SChunyan Zhang 	&spare_axi_gate.common,
1638a6ae1a29SChunyan Zhang 	&sensor2_gate.common,
1639a6ae1a29SChunyan Zhang 	&d0if_in_d_en.common,
1640a6ae1a29SChunyan Zhang 	&d1if_in_d_en.common,
1641a6ae1a29SChunyan Zhang 	&d0if_in_d2i_en.common,
1642a6ae1a29SChunyan Zhang 	&d1if_in_d2i_en.common,
1643a6ae1a29SChunyan Zhang 	&ia_in_d2i_en.common,
1644a6ae1a29SChunyan Zhang 	&ib_in_d2i_en.common,
1645a6ae1a29SChunyan Zhang 	&ic_in_d2i_en.common,
1646a6ae1a29SChunyan Zhang 	&ia_in_i_en.common,
1647a6ae1a29SChunyan Zhang 	&ib_in_i_en.common,
1648a6ae1a29SChunyan Zhang 	&ic_in_i_en.common,
1649a6ae1a29SChunyan Zhang };
1650a6ae1a29SChunyan Zhang 
1651a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_cam_gate_hws = {
1652a6ae1a29SChunyan Zhang 	.hws	= {
1653a6ae1a29SChunyan Zhang 		[CLK_DCAM0_EB]		= &dcam0_eb.common.hw,
1654a6ae1a29SChunyan Zhang 		[CLK_DCAM1_EB]		= &dcam1_eb.common.hw,
1655a6ae1a29SChunyan Zhang 		[CLK_ISP0_EB]		= &isp0_eb.common.hw,
1656a6ae1a29SChunyan Zhang 		[CLK_CSI0_EB]		= &csi0_eb.common.hw,
1657a6ae1a29SChunyan Zhang 		[CLK_CSI1_EB]		= &csi1_eb.common.hw,
1658a6ae1a29SChunyan Zhang 		[CLK_JPG0_EB]		= &jpg0_eb.common.hw,
1659a6ae1a29SChunyan Zhang 		[CLK_JPG1_EB]		= &jpg1_eb.common.hw,
1660a6ae1a29SChunyan Zhang 		[CLK_CAM_CKG_EB]	= &cam_ckg_eb.common.hw,
1661a6ae1a29SChunyan Zhang 		[CLK_CAM_MMU_EB]	= &cam_mmu_eb.common.hw,
1662a6ae1a29SChunyan Zhang 		[CLK_ISP1_EB]		= &isp1_eb.common.hw,
1663a6ae1a29SChunyan Zhang 		[CLK_CPP_EB]		= &cpp_eb.common.hw,
1664a6ae1a29SChunyan Zhang 		[CLK_MMU_PF_EB]		= &mmu_pf_eb.common.hw,
1665a6ae1a29SChunyan Zhang 		[CLK_ISP2_EB]		= &isp2_eb.common.hw,
1666a6ae1a29SChunyan Zhang 		[CLK_DCAM2ISP_IF_EB]	= &dcam2isp_if_eb.common.hw,
1667a6ae1a29SChunyan Zhang 		[CLK_ISP2DCAM_IF_EB]	= &isp2dcam_if_eb.common.hw,
1668a6ae1a29SChunyan Zhang 		[CLK_ISP_LCLK_EB]	= &isp_lclk_eb.common.hw,
1669a6ae1a29SChunyan Zhang 		[CLK_ISP_ICLK_EB]	= &isp_iclk_eb.common.hw,
1670a6ae1a29SChunyan Zhang 		[CLK_ISP_MCLK_EB]	= &isp_mclk_eb.common.hw,
1671a6ae1a29SChunyan Zhang 		[CLK_ISP_PCLK_EB]	= &isp_pclk_eb.common.hw,
1672a6ae1a29SChunyan Zhang 		[CLK_ISP_ISP2DCAM_EB]	= &isp_isp2dcam_eb.common.hw,
1673a6ae1a29SChunyan Zhang 		[CLK_DCAM0_IF_EB]	= &dcam0_if_eb.common.hw,
1674a6ae1a29SChunyan Zhang 		[CLK_CLK26M_IF_EB]	= &clk26m_if_eb.common.hw,
1675a6ae1a29SChunyan Zhang 		[CLK_CPHY0_GATE]	= &cphy0_gate.common.hw,
1676a6ae1a29SChunyan Zhang 		[CLK_MIPI_CSI0_GATE]	= &mipi_csi0_gate.common.hw,
1677a6ae1a29SChunyan Zhang 		[CLK_CPHY1_GATE]	= &cphy1_gate.common.hw,
1678a6ae1a29SChunyan Zhang 		[CLK_MIPI_CSI1]		= &mipi_csi1.common.hw,
1679a6ae1a29SChunyan Zhang 		[CLK_DCAM0_AXI_GATE]	= &dcam0_axi_gate.common.hw,
1680a6ae1a29SChunyan Zhang 		[CLK_DCAM1_AXI_GATE]	= &dcam1_axi_gate.common.hw,
1681a6ae1a29SChunyan Zhang 		[CLK_SENSOR0_GATE]	= &sensor0_gate.common.hw,
1682a6ae1a29SChunyan Zhang 		[CLK_SENSOR1_GATE]	= &sensor1_gate.common.hw,
1683a6ae1a29SChunyan Zhang 		[CLK_JPG0_AXI_GATE]	= &jpg0_axi_gate.common.hw,
1684a6ae1a29SChunyan Zhang 		[CLK_GPG1_AXI_GATE]	= &gpg1_axi_gate.common.hw,
1685a6ae1a29SChunyan Zhang 		[CLK_ISP0_AXI_GATE]	= &isp0_axi_gate.common.hw,
1686a6ae1a29SChunyan Zhang 		[CLK_ISP1_AXI_GATE]	= &isp1_axi_gate.common.hw,
1687a6ae1a29SChunyan Zhang 		[CLK_ISP2_AXI_GATE]	= &isp2_axi_gate.common.hw,
1688a6ae1a29SChunyan Zhang 		[CLK_CPP_AXI_GATE]	= &cpp_axi_gate.common.hw,
1689a6ae1a29SChunyan Zhang 		[CLK_D0_IF_AXI_GATE]	= &d0_if_axi_gate.common.hw,
1690a6ae1a29SChunyan Zhang 		[CLK_D2I_IF_AXI_GATE]	= &d2i_if_axi_gate.common.hw,
1691a6ae1a29SChunyan Zhang 		[CLK_I2D_IF_AXI_GATE]	= &i2d_if_axi_gate.common.hw,
1692a6ae1a29SChunyan Zhang 		[CLK_SPARE_AXI_GATE]	= &spare_axi_gate.common.hw,
1693a6ae1a29SChunyan Zhang 		[CLK_SENSOR2_GATE]	= &sensor2_gate.common.hw,
1694a6ae1a29SChunyan Zhang 		[CLK_D0IF_IN_D_EN]	= &d0if_in_d_en.common.hw,
1695a6ae1a29SChunyan Zhang 		[CLK_D1IF_IN_D_EN]	= &d1if_in_d_en.common.hw,
1696a6ae1a29SChunyan Zhang 		[CLK_D0IF_IN_D2I_EN]	= &d0if_in_d2i_en.common.hw,
1697a6ae1a29SChunyan Zhang 		[CLK_D1IF_IN_D2I_EN]	= &d1if_in_d2i_en.common.hw,
1698a6ae1a29SChunyan Zhang 		[CLK_IA_IN_D2I_EN]	= &ia_in_d2i_en.common.hw,
1699a6ae1a29SChunyan Zhang 		[CLK_IB_IN_D2I_EN]	= &ib_in_d2i_en.common.hw,
1700a6ae1a29SChunyan Zhang 		[CLK_IC_IN_D2I_EN]	= &ic_in_d2i_en.common.hw,
1701a6ae1a29SChunyan Zhang 		[CLK_IA_IN_I_EN]	= &ia_in_i_en.common.hw,
1702a6ae1a29SChunyan Zhang 		[CLK_IB_IN_I_EN]	= &ib_in_i_en.common.hw,
1703a6ae1a29SChunyan Zhang 		[CLK_IC_IN_I_EN]	= &ic_in_i_en.common.hw,
1704a6ae1a29SChunyan Zhang 	},
1705a6ae1a29SChunyan Zhang 	.num	= CLK_CAM_GATE_NUM,
1706a6ae1a29SChunyan Zhang };
1707a6ae1a29SChunyan Zhang 
1708a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_cam_gate_desc = {
1709a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_cam_gate,
1710a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_cam_gate),
1711a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_cam_gate_hws,
1712a6ae1a29SChunyan Zhang };
1713a6ae1a29SChunyan Zhang 
1714a6ae1a29SChunyan Zhang static SPRD_MUX_CLK(ahb_disp, "ahb-disp", ahb_parents, 0x20,
1715a6ae1a29SChunyan Zhang 		    0, 2, SC9860_MUX_FLAG);
1716a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(dispc0_dpi, "dispc0-dpi", dispc_parents,	0x34,
1717a6ae1a29SChunyan Zhang 		     0, 2, 8, 2, 0);
1718a6ae1a29SChunyan Zhang static SPRD_COMP_CLK(dispc1_dpi, "dispc1-dpi", dispc_parents,	0x40,
1719a6ae1a29SChunyan Zhang 		     0, 2, 8, 2, 0);
1720a6ae1a29SChunyan Zhang 
1721a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_disp_clk[] = {
1722a6ae1a29SChunyan Zhang 	/* address base is 0x63000000 */
1723a6ae1a29SChunyan Zhang 	&ahb_disp.common,
1724a6ae1a29SChunyan Zhang 	&dispc0_dpi.common,
1725a6ae1a29SChunyan Zhang 	&dispc1_dpi.common,
1726a6ae1a29SChunyan Zhang };
1727a6ae1a29SChunyan Zhang 
1728a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_disp_clk_hws = {
1729a6ae1a29SChunyan Zhang 	.hws	= {
1730a6ae1a29SChunyan Zhang 		[CLK_AHB_DISP]		= &ahb_disp.common.hw,
1731a6ae1a29SChunyan Zhang 		[CLK_DISPC0_DPI]	= &dispc0_dpi.common.hw,
1732a6ae1a29SChunyan Zhang 		[CLK_DISPC1_DPI]	= &dispc1_dpi.common.hw,
1733a6ae1a29SChunyan Zhang 	},
1734a6ae1a29SChunyan Zhang 	.num	= CLK_DISP_NUM,
1735a6ae1a29SChunyan Zhang };
1736a6ae1a29SChunyan Zhang 
1737a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_disp_clk_desc = {
1738a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_disp_clk,
1739a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_disp_clk),
1740a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_disp_clk_hws,
1741a6ae1a29SChunyan Zhang };
1742a6ae1a29SChunyan Zhang 
1743a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dispc0_eb,	"dispc0-eb",	"ahb-disp", 0x0,
1744a6ae1a29SChunyan Zhang 		     0x1000, BIT(0), 0, 0);
1745a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dispc1_eb,	"dispc1-eb",	"ahb-disp", 0x0,
1746a6ae1a29SChunyan Zhang 		     0x1000, BIT(1), 0, 0);
1747a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dispc_mmu_eb,	"dispc-mmu-eb",	"ahb-disp", 0x0,
1748a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), 0, 0);
1749a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gsp0_eb,		"gsp0-eb",	"ahb-disp", 0x0,
1750a6ae1a29SChunyan Zhang 		     0x1000, BIT(3), 0, 0);
1751a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gsp1_eb,		"gsp1-eb",	"ahb-disp", 0x0,
1752a6ae1a29SChunyan Zhang 		     0x1000, BIT(4), 0, 0);
1753a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gsp0_mmu_eb,	"gsp0-mmu-eb",	"ahb-disp", 0x0,
1754a6ae1a29SChunyan Zhang 		     0x1000, BIT(5), 0, 0);
1755a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gsp1_mmu_eb,	"gsp1-mmu-eb",	"ahb-disp", 0x0,
1756a6ae1a29SChunyan Zhang 		     0x1000, BIT(6), 0, 0);
1757a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dsi0_eb,		"dsi0-eb",	"ahb-disp", 0x0,
1758a6ae1a29SChunyan Zhang 		     0x1000, BIT(7), 0, 0);
1759a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dsi1_eb,		"dsi1-eb",	"ahb-disp", 0x0,
1760a6ae1a29SChunyan Zhang 		     0x1000, BIT(8), 0, 0);
1761a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(disp_ckg_eb,	"disp-ckg-eb",	"ahb-disp", 0x0,
1762a6ae1a29SChunyan Zhang 		     0x1000, BIT(9), 0, 0);
1763a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(disp_gpu_eb,	"disp-gpu-eb",	"ahb-disp", 0x0,
1764a6ae1a29SChunyan Zhang 		     0x1000, BIT(10), 0, 0);
1765a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gpu_mtx_eb,	"gpu-mtx-eb",	"ahb-disp", 0x0,
1766a6ae1a29SChunyan Zhang 		     0x1000, BIT(13), 0, 0);
1767a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(gsp_mtx_eb,	"gsp-mtx-eb",	"ahb-disp", 0x0,
1768a6ae1a29SChunyan Zhang 		     0x1000, BIT(14), 0, 0);
1769a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(tmc_mtx_eb,	"tmc-mtx-eb",	"ahb-disp", 0x0,
1770a6ae1a29SChunyan Zhang 		     0x1000, BIT(15), 0, 0);
1771a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(dispc_mtx_eb,	"dispc-mtx-eb",	"ahb-disp", 0x0,
1772a6ae1a29SChunyan Zhang 		     0x1000, BIT(16), 0, 0);
1773a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(dphy0_gate,	"dphy0-gate",	"ahb-disp", 0x8,
1774a6ae1a29SChunyan Zhang 		     BIT(0), 0, 0);
1775a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(dphy1_gate,	"dphy1-gate",	"ahb-disp", 0x8,
1776a6ae1a29SChunyan Zhang 		     BIT(1), 0, 0);
1777a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(gsp0_a_gate,	"gsp0-a-gate",	"ahb-disp", 0x8,
1778a6ae1a29SChunyan Zhang 		     BIT(2), 0, 0);
1779a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(gsp1_a_gate,	"gsp1-a-gate",	"ahb-disp", 0x8,
1780a6ae1a29SChunyan Zhang 		     BIT(3), 0, 0);
1781a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(gsp0_f_gate,	"gsp0-f-gate",	"ahb-disp", 0x8,
1782a6ae1a29SChunyan Zhang 		     BIT(4), 0, 0);
1783a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(gsp1_f_gate,	"gsp1-f-gate",	"ahb-disp", 0x8,
1784a6ae1a29SChunyan Zhang 		     BIT(5), 0, 0);
1785a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(d_mtx_f_gate,	"d-mtx-f-gate",	"ahb-disp", 0x8,
1786a6ae1a29SChunyan Zhang 		     BIT(6), 0, 0);
1787a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(d_mtx_a_gate,	"d-mtx-a-gate",	"ahb-disp", 0x8,
1788a6ae1a29SChunyan Zhang 		     BIT(7), 0, 0);
1789a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(d_noc_f_gate,	"d-noc-f-gate",	"ahb-disp", 0x8,
1790a6ae1a29SChunyan Zhang 		     BIT(8), 0, 0);
1791a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(d_noc_a_gate,	"d-noc-a-gate",	"ahb-disp", 0x8,
1792a6ae1a29SChunyan Zhang 		     BIT(9), 0, 0);
1793a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(gsp_mtx_f_gate, "gsp-mtx-f-gate", "ahb-disp",  0x8,
1794a6ae1a29SChunyan Zhang 		     BIT(10), 0, 0);
1795a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(gsp_mtx_a_gate, "gsp-mtx-a-gate", "ahb-disp",  0x8,
1796a6ae1a29SChunyan Zhang 		     BIT(11), 0, 0);
1797a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(gsp_noc_f_gate, "gsp-noc-f-gate", "ahb-disp",  0x8,
1798a6ae1a29SChunyan Zhang 		     BIT(12), 0, 0);
1799a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(gsp_noc_a_gate, "gsp-noc-a-gate", "ahb-disp",  0x8,
1800a6ae1a29SChunyan Zhang 		     BIT(13), 0, 0);
1801a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(dispm0idle_gate, "dispm0idle-gate", "ahb-disp", 0x8,
1802a6ae1a29SChunyan Zhang 		     BIT(14), 0, 0);
1803a6ae1a29SChunyan Zhang static SPRD_GATE_CLK(gspm0idle_gate, "gspm0idle-gate", "ahb-disp",  0x8,
1804a6ae1a29SChunyan Zhang 		     BIT(15), 0, 0);
1805a6ae1a29SChunyan Zhang 
1806a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_disp_gate[] = {
1807a6ae1a29SChunyan Zhang 	/* address base is 0x63100000 */
1808a6ae1a29SChunyan Zhang 	&dispc0_eb.common,
1809a6ae1a29SChunyan Zhang 	&dispc1_eb.common,
1810a6ae1a29SChunyan Zhang 	&dispc_mmu_eb.common,
1811a6ae1a29SChunyan Zhang 	&gsp0_eb.common,
1812a6ae1a29SChunyan Zhang 	&gsp1_eb.common,
1813a6ae1a29SChunyan Zhang 	&gsp0_mmu_eb.common,
1814a6ae1a29SChunyan Zhang 	&gsp1_mmu_eb.common,
1815a6ae1a29SChunyan Zhang 	&dsi0_eb.common,
1816a6ae1a29SChunyan Zhang 	&dsi1_eb.common,
1817a6ae1a29SChunyan Zhang 	&disp_ckg_eb.common,
1818a6ae1a29SChunyan Zhang 	&disp_gpu_eb.common,
1819a6ae1a29SChunyan Zhang 	&gpu_mtx_eb.common,
1820a6ae1a29SChunyan Zhang 	&gsp_mtx_eb.common,
1821a6ae1a29SChunyan Zhang 	&tmc_mtx_eb.common,
1822a6ae1a29SChunyan Zhang 	&dispc_mtx_eb.common,
1823a6ae1a29SChunyan Zhang 	&dphy0_gate.common,
1824a6ae1a29SChunyan Zhang 	&dphy1_gate.common,
1825a6ae1a29SChunyan Zhang 	&gsp0_a_gate.common,
1826a6ae1a29SChunyan Zhang 	&gsp1_a_gate.common,
1827a6ae1a29SChunyan Zhang 	&gsp0_f_gate.common,
1828a6ae1a29SChunyan Zhang 	&gsp1_f_gate.common,
1829a6ae1a29SChunyan Zhang 	&d_mtx_f_gate.common,
1830a6ae1a29SChunyan Zhang 	&d_mtx_a_gate.common,
1831a6ae1a29SChunyan Zhang 	&d_noc_f_gate.common,
1832a6ae1a29SChunyan Zhang 	&d_noc_a_gate.common,
1833a6ae1a29SChunyan Zhang 	&gsp_mtx_f_gate.common,
1834a6ae1a29SChunyan Zhang 	&gsp_mtx_a_gate.common,
1835a6ae1a29SChunyan Zhang 	&gsp_noc_f_gate.common,
1836a6ae1a29SChunyan Zhang 	&gsp_noc_a_gate.common,
1837a6ae1a29SChunyan Zhang 	&dispm0idle_gate.common,
1838a6ae1a29SChunyan Zhang 	&gspm0idle_gate.common,
1839a6ae1a29SChunyan Zhang };
1840a6ae1a29SChunyan Zhang 
1841a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_disp_gate_hws = {
1842a6ae1a29SChunyan Zhang 	.hws	= {
1843a6ae1a29SChunyan Zhang 		[CLK_DISPC0_EB]		= &dispc0_eb.common.hw,
1844a6ae1a29SChunyan Zhang 		[CLK_DISPC1_EB]		= &dispc1_eb.common.hw,
1845a6ae1a29SChunyan Zhang 		[CLK_DISPC_MMU_EB]	= &dispc_mmu_eb.common.hw,
1846a6ae1a29SChunyan Zhang 		[CLK_GSP0_EB]		= &gsp0_eb.common.hw,
1847a6ae1a29SChunyan Zhang 		[CLK_GSP1_EB]		= &gsp1_eb.common.hw,
1848a6ae1a29SChunyan Zhang 		[CLK_GSP0_MMU_EB]	= &gsp0_mmu_eb.common.hw,
1849a6ae1a29SChunyan Zhang 		[CLK_GSP1_MMU_EB]	= &gsp1_mmu_eb.common.hw,
1850a6ae1a29SChunyan Zhang 		[CLK_DSI0_EB]		= &dsi0_eb.common.hw,
1851a6ae1a29SChunyan Zhang 		[CLK_DSI1_EB]		= &dsi1_eb.common.hw,
1852a6ae1a29SChunyan Zhang 		[CLK_DISP_CKG_EB]	= &disp_ckg_eb.common.hw,
1853a6ae1a29SChunyan Zhang 		[CLK_DISP_GPU_EB]	= &disp_gpu_eb.common.hw,
1854a6ae1a29SChunyan Zhang 		[CLK_GPU_MTX_EB]	= &gpu_mtx_eb.common.hw,
1855a6ae1a29SChunyan Zhang 		[CLK_GSP_MTX_EB]	= &gsp_mtx_eb.common.hw,
1856a6ae1a29SChunyan Zhang 		[CLK_TMC_MTX_EB]	= &tmc_mtx_eb.common.hw,
1857a6ae1a29SChunyan Zhang 		[CLK_DISPC_MTX_EB]	= &dispc_mtx_eb.common.hw,
1858a6ae1a29SChunyan Zhang 		[CLK_DPHY0_GATE]	= &dphy0_gate.common.hw,
1859a6ae1a29SChunyan Zhang 		[CLK_DPHY1_GATE]	= &dphy1_gate.common.hw,
1860a6ae1a29SChunyan Zhang 		[CLK_GSP0_A_GATE]	= &gsp0_a_gate.common.hw,
1861a6ae1a29SChunyan Zhang 		[CLK_GSP1_A_GATE]	= &gsp1_a_gate.common.hw,
1862a6ae1a29SChunyan Zhang 		[CLK_GSP0_F_GATE]	= &gsp0_f_gate.common.hw,
1863a6ae1a29SChunyan Zhang 		[CLK_GSP1_F_GATE]	= &gsp1_f_gate.common.hw,
1864a6ae1a29SChunyan Zhang 		[CLK_D_MTX_F_GATE]	= &d_mtx_f_gate.common.hw,
1865a6ae1a29SChunyan Zhang 		[CLK_D_MTX_A_GATE]	= &d_mtx_a_gate.common.hw,
1866a6ae1a29SChunyan Zhang 		[CLK_D_NOC_F_GATE]	= &d_noc_f_gate.common.hw,
1867a6ae1a29SChunyan Zhang 		[CLK_D_NOC_A_GATE]	= &d_noc_a_gate.common.hw,
1868a6ae1a29SChunyan Zhang 		[CLK_GSP_MTX_F_GATE]	= &gsp_mtx_f_gate.common.hw,
1869a6ae1a29SChunyan Zhang 		[CLK_GSP_MTX_A_GATE]	= &gsp_mtx_a_gate.common.hw,
1870a6ae1a29SChunyan Zhang 		[CLK_GSP_NOC_F_GATE]	= &gsp_noc_f_gate.common.hw,
1871a6ae1a29SChunyan Zhang 		[CLK_GSP_NOC_A_GATE]	= &gsp_noc_a_gate.common.hw,
1872a6ae1a29SChunyan Zhang 		[CLK_DISPM0IDLE_GATE]	= &dispm0idle_gate.common.hw,
1873a6ae1a29SChunyan Zhang 		[CLK_GSPM0IDLE_GATE]	= &gspm0idle_gate.common.hw,
1874a6ae1a29SChunyan Zhang 	},
1875a6ae1a29SChunyan Zhang 	.num	= CLK_DISP_GATE_NUM,
1876a6ae1a29SChunyan Zhang };
1877a6ae1a29SChunyan Zhang 
1878a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_disp_gate_desc = {
1879a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_disp_gate,
1880a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_disp_gate),
1881a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_disp_gate_hws,
1882a6ae1a29SChunyan Zhang };
1883a6ae1a29SChunyan Zhang 
1884a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(sim0_eb,	"sim0-eb",	"ap-apb", 0x0,
1885a6ae1a29SChunyan Zhang 		     0x1000, BIT(0), CLK_IGNORE_UNUSED, 0);
1886a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(iis0_eb,	"iis0-eb",	"ap-apb", 0x0,
1887a6ae1a29SChunyan Zhang 		     0x1000, BIT(1), CLK_IGNORE_UNUSED, 0);
1888a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(iis1_eb,	"iis1-eb",	"ap-apb", 0x0,
1889a6ae1a29SChunyan Zhang 		     0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
1890a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(iis2_eb,	"iis2-eb",	"ap-apb", 0x0,
1891a6ae1a29SChunyan Zhang 		     0x1000, BIT(3), CLK_IGNORE_UNUSED, 0);
1892a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(iis3_eb,	"iis3-eb",	"ap-apb", 0x0,
1893a6ae1a29SChunyan Zhang 		     0x1000, BIT(4), CLK_IGNORE_UNUSED, 0);
1894a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(spi0_eb,	"spi0-eb",	"ap-apb", 0x0,
1895a6ae1a29SChunyan Zhang 		     0x1000, BIT(5), CLK_IGNORE_UNUSED, 0);
1896a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(spi1_eb,	"spi1-eb",	"ap-apb", 0x0,
1897a6ae1a29SChunyan Zhang 		     0x1000, BIT(6), CLK_IGNORE_UNUSED, 0);
1898a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(spi2_eb,	"spi2-eb",	"ap-apb", 0x0,
1899a6ae1a29SChunyan Zhang 		     0x1000, BIT(7), CLK_IGNORE_UNUSED, 0);
1900a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(i2c0_eb,	"i2c0-eb",	"ap-apb", 0x0,
1901a6ae1a29SChunyan Zhang 		     0x1000, BIT(8), CLK_IGNORE_UNUSED, 0);
1902a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(i2c1_eb,	"i2c1-eb",	"ap-apb", 0x0,
1903a6ae1a29SChunyan Zhang 		     0x1000, BIT(9), CLK_IGNORE_UNUSED, 0);
1904a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(i2c2_eb,	"i2c2-eb",	"ap-apb", 0x0,
1905a6ae1a29SChunyan Zhang 		     0x1000, BIT(10), CLK_IGNORE_UNUSED, 0);
1906a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(i2c3_eb,	"i2c3-eb",	"ap-apb", 0x0,
1907a6ae1a29SChunyan Zhang 		     0x1000, BIT(11), CLK_IGNORE_UNUSED, 0);
1908a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(i2c4_eb,	"i2c4-eb",	"ap-apb", 0x0,
1909a6ae1a29SChunyan Zhang 		     0x1000, BIT(12), CLK_IGNORE_UNUSED, 0);
1910a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(i2c5_eb,	"i2c5-eb",	"ap-apb", 0x0,
1911a6ae1a29SChunyan Zhang 		     0x1000, BIT(13), CLK_IGNORE_UNUSED, 0);
1912a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(uart0_eb,	"uart0-eb",	"ap-apb", 0x0,
1913a6ae1a29SChunyan Zhang 		     0x1000, BIT(14), CLK_IGNORE_UNUSED, 0);
1914a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(uart1_eb,	"uart1-eb",	"ap-apb", 0x0,
1915a6ae1a29SChunyan Zhang 		     0x1000, BIT(15), CLK_IGNORE_UNUSED, 0);
1916a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(uart2_eb,	"uart2-eb",	"ap-apb", 0x0,
1917a6ae1a29SChunyan Zhang 		     0x1000, BIT(16), CLK_IGNORE_UNUSED, 0);
1918a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(uart3_eb,	"uart3-eb",	"ap-apb", 0x0,
1919a6ae1a29SChunyan Zhang 		     0x1000, BIT(17), CLK_IGNORE_UNUSED, 0);
1920a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(uart4_eb,	"uart4-eb",	"ap-apb", 0x0,
1921a6ae1a29SChunyan Zhang 		     0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
1922a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(ap_ckg_eb,	"ap-ckg-eb",	"ap-apb", 0x0,
1923a6ae1a29SChunyan Zhang 		     0x1000, BIT(19), CLK_IGNORE_UNUSED, 0);
1924a6ae1a29SChunyan Zhang static SPRD_SC_GATE_CLK(spi3_eb,	"spi3-eb",	"ap-apb", 0x0,
1925a6ae1a29SChunyan Zhang 		     0x1000, BIT(20), CLK_IGNORE_UNUSED, 0);
1926a6ae1a29SChunyan Zhang 
1927a6ae1a29SChunyan Zhang static struct sprd_clk_common *sc9860_apapb_gate[] = {
1928a6ae1a29SChunyan Zhang 	/* address base is 0x70b00000 */
1929a6ae1a29SChunyan Zhang 	&sim0_eb.common,
1930a6ae1a29SChunyan Zhang 	&iis0_eb.common,
1931a6ae1a29SChunyan Zhang 	&iis1_eb.common,
1932a6ae1a29SChunyan Zhang 	&iis2_eb.common,
1933a6ae1a29SChunyan Zhang 	&iis3_eb.common,
1934a6ae1a29SChunyan Zhang 	&spi0_eb.common,
1935a6ae1a29SChunyan Zhang 	&spi1_eb.common,
1936a6ae1a29SChunyan Zhang 	&spi2_eb.common,
1937a6ae1a29SChunyan Zhang 	&i2c0_eb.common,
1938a6ae1a29SChunyan Zhang 	&i2c1_eb.common,
1939a6ae1a29SChunyan Zhang 	&i2c2_eb.common,
1940a6ae1a29SChunyan Zhang 	&i2c3_eb.common,
1941a6ae1a29SChunyan Zhang 	&i2c4_eb.common,
1942a6ae1a29SChunyan Zhang 	&i2c5_eb.common,
1943a6ae1a29SChunyan Zhang 	&uart0_eb.common,
1944a6ae1a29SChunyan Zhang 	&uart1_eb.common,
1945a6ae1a29SChunyan Zhang 	&uart2_eb.common,
1946a6ae1a29SChunyan Zhang 	&uart3_eb.common,
1947a6ae1a29SChunyan Zhang 	&uart4_eb.common,
1948a6ae1a29SChunyan Zhang 	&ap_ckg_eb.common,
1949a6ae1a29SChunyan Zhang 	&spi3_eb.common,
1950a6ae1a29SChunyan Zhang };
1951a6ae1a29SChunyan Zhang 
1952a6ae1a29SChunyan Zhang static struct clk_hw_onecell_data sc9860_apapb_gate_hws = {
1953a6ae1a29SChunyan Zhang 	.hws	= {
1954a6ae1a29SChunyan Zhang 		[CLK_SIM0_EB]		= &sim0_eb.common.hw,
1955a6ae1a29SChunyan Zhang 		[CLK_IIS0_EB]		= &iis0_eb.common.hw,
1956a6ae1a29SChunyan Zhang 		[CLK_IIS1_EB]		= &iis1_eb.common.hw,
1957a6ae1a29SChunyan Zhang 		[CLK_IIS2_EB]		= &iis2_eb.common.hw,
1958a6ae1a29SChunyan Zhang 		[CLK_IIS3_EB]		= &iis3_eb.common.hw,
1959a6ae1a29SChunyan Zhang 		[CLK_SPI0_EB]		= &spi0_eb.common.hw,
1960a6ae1a29SChunyan Zhang 		[CLK_SPI1_EB]		= &spi1_eb.common.hw,
1961a6ae1a29SChunyan Zhang 		[CLK_SPI2_EB]		= &spi2_eb.common.hw,
1962a6ae1a29SChunyan Zhang 		[CLK_I2C0_EB]		= &i2c0_eb.common.hw,
1963a6ae1a29SChunyan Zhang 		[CLK_I2C1_EB]		= &i2c1_eb.common.hw,
1964a6ae1a29SChunyan Zhang 		[CLK_I2C2_EB]		= &i2c2_eb.common.hw,
1965a6ae1a29SChunyan Zhang 		[CLK_I2C3_EB]		= &i2c3_eb.common.hw,
1966a6ae1a29SChunyan Zhang 		[CLK_I2C4_EB]		= &i2c4_eb.common.hw,
1967a6ae1a29SChunyan Zhang 		[CLK_I2C5_EB]		= &i2c5_eb.common.hw,
1968a6ae1a29SChunyan Zhang 		[CLK_UART0_EB]		= &uart0_eb.common.hw,
1969a6ae1a29SChunyan Zhang 		[CLK_UART1_EB]		= &uart1_eb.common.hw,
1970a6ae1a29SChunyan Zhang 		[CLK_UART2_EB]		= &uart2_eb.common.hw,
1971a6ae1a29SChunyan Zhang 		[CLK_UART3_EB]		= &uart3_eb.common.hw,
1972a6ae1a29SChunyan Zhang 		[CLK_UART4_EB]		= &uart4_eb.common.hw,
1973a6ae1a29SChunyan Zhang 		[CLK_AP_CKG_EB]		= &ap_ckg_eb.common.hw,
1974a6ae1a29SChunyan Zhang 		[CLK_SPI3_EB]		= &spi3_eb.common.hw,
1975a6ae1a29SChunyan Zhang 	},
1976a6ae1a29SChunyan Zhang 	.num	= CLK_APAPB_GATE_NUM,
1977a6ae1a29SChunyan Zhang };
1978a6ae1a29SChunyan Zhang 
1979a6ae1a29SChunyan Zhang static const struct sprd_clk_desc sc9860_apapb_gate_desc = {
1980a6ae1a29SChunyan Zhang 	.clk_clks	= sc9860_apapb_gate,
1981a6ae1a29SChunyan Zhang 	.num_clk_clks	= ARRAY_SIZE(sc9860_apapb_gate),
1982a6ae1a29SChunyan Zhang 	.hw_clks	= &sc9860_apapb_gate_hws,
1983a6ae1a29SChunyan Zhang };
1984a6ae1a29SChunyan Zhang 
1985a6ae1a29SChunyan Zhang static const struct of_device_id sprd_sc9860_clk_ids[] = {
1986a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-pmu-gate",		/* 0x402b */
1987a6ae1a29SChunyan Zhang 	  .data = &sc9860_pmu_gate_desc },
1988a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-pll",		/* 0x4040 */
1989a6ae1a29SChunyan Zhang 	  .data = &sc9860_pll_desc },
1990a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-ap-clk",		/* 0x2000 */
1991a6ae1a29SChunyan Zhang 	  .data = &sc9860_ap_clk_desc },
1992a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-aon-prediv",	/* 0x402d */
1993a6ae1a29SChunyan Zhang 	  .data = &sc9860_aon_prediv_desc },
1994a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-apahb-gate",	/* 0x2021 */
1995a6ae1a29SChunyan Zhang 	  .data = &sc9860_apahb_gate_desc },
1996a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-aon-gate",		/* 0x402e */
1997a6ae1a29SChunyan Zhang 	  .data = &sc9860_aon_gate_desc },
1998a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-aonsecure-clk",	/* 0x4088 */
1999a6ae1a29SChunyan Zhang 	  .data = &sc9860_aonsecure_clk_desc },
2000a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-agcp-gate",	/* 0x415e */
2001a6ae1a29SChunyan Zhang 	  .data = &sc9860_agcp_gate_desc },
2002a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-gpu-clk",		/* 0x6020 */
2003a6ae1a29SChunyan Zhang 	  .data = &sc9860_gpu_clk_desc },
2004a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-vsp-clk",		/* 0x6100 */
2005a6ae1a29SChunyan Zhang 	  .data = &sc9860_vsp_clk_desc },
2006a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-vsp-gate",		/* 0x6110 */
2007a6ae1a29SChunyan Zhang 	  .data = &sc9860_vsp_gate_desc },
2008a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-cam-clk",		/* 0x6200 */
2009a6ae1a29SChunyan Zhang 	  .data = &sc9860_cam_clk_desc },
2010a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-cam-gate",		/* 0x6210 */
2011a6ae1a29SChunyan Zhang 	  .data = &sc9860_cam_gate_desc },
2012a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-disp-clk",		/* 0x6300 */
2013a6ae1a29SChunyan Zhang 	  .data = &sc9860_disp_clk_desc },
2014a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-disp-gate",	/* 0x6310 */
2015a6ae1a29SChunyan Zhang 	  .data = &sc9860_disp_gate_desc },
2016a6ae1a29SChunyan Zhang 	{ .compatible = "sprd,sc9860-apapb-gate",	/* 0x70b0 */
2017a6ae1a29SChunyan Zhang 	  .data = &sc9860_apapb_gate_desc },
2018a6ae1a29SChunyan Zhang 	{ }
2019a6ae1a29SChunyan Zhang };
2020a6ae1a29SChunyan Zhang MODULE_DEVICE_TABLE(of, sprd_sc9860_clk_ids);
2021a6ae1a29SChunyan Zhang 
sc9860_clk_probe(struct platform_device * pdev)2022a6ae1a29SChunyan Zhang static int sc9860_clk_probe(struct platform_device *pdev)
2023a6ae1a29SChunyan Zhang {
2024a6ae1a29SChunyan Zhang 	const struct of_device_id *match;
2025a6ae1a29SChunyan Zhang 	const struct sprd_clk_desc *desc;
2026c974c48dSChunyan Zhang 	int ret;
2027a6ae1a29SChunyan Zhang 
2028a6ae1a29SChunyan Zhang 	match = of_match_node(sprd_sc9860_clk_ids, pdev->dev.of_node);
2029a6ae1a29SChunyan Zhang 	if (!match) {
2030a6ae1a29SChunyan Zhang 		pr_err("%s: of_match_node() failed", __func__);
2031a6ae1a29SChunyan Zhang 		return -ENODEV;
2032a6ae1a29SChunyan Zhang 	}
2033a6ae1a29SChunyan Zhang 
2034a6ae1a29SChunyan Zhang 	desc = match->data;
2035c974c48dSChunyan Zhang 	ret = sprd_clk_regmap_init(pdev, desc);
2036c974c48dSChunyan Zhang 	if (ret)
2037c974c48dSChunyan Zhang 		return ret;
2038a6ae1a29SChunyan Zhang 
2039a6ae1a29SChunyan Zhang 	return sprd_clk_probe(&pdev->dev, desc->hw_clks);
2040a6ae1a29SChunyan Zhang }
2041a6ae1a29SChunyan Zhang 
2042a6ae1a29SChunyan Zhang static struct platform_driver sc9860_clk_driver = {
2043a6ae1a29SChunyan Zhang 	.probe	= sc9860_clk_probe,
2044a6ae1a29SChunyan Zhang 	.driver	= {
2045a6ae1a29SChunyan Zhang 		.name	= "sc9860-clk",
2046a6ae1a29SChunyan Zhang 		.of_match_table	= sprd_sc9860_clk_ids,
2047a6ae1a29SChunyan Zhang 	},
2048a6ae1a29SChunyan Zhang };
2049a6ae1a29SChunyan Zhang module_platform_driver(sc9860_clk_driver);
2050a6ae1a29SChunyan Zhang 
2051a6ae1a29SChunyan Zhang MODULE_DESCRIPTION("Spreadtrum SC9860 Clock Driver");
2052a6ae1a29SChunyan Zhang MODULE_LICENSE("GPL v2");
2053a6ae1a29SChunyan Zhang MODULE_ALIAS("platform:sc9860-clk");
2054