xref: /linux/drivers/clk/thead/clk-th1520-ap.c (revision ab93e0dd72c37d378dd936f031ffb83ff2bd87ce)
1ae81b69fSDrew Fustini // SPDX-License-Identifier: GPL-2.0
2ae81b69fSDrew Fustini /*
3ae81b69fSDrew Fustini  * Copyright (C) 2023 Jisheng Zhang <jszhang@kernel.org>
4ae81b69fSDrew Fustini  * Copyright (C) 2023 Vivo Communication Technology Co. Ltd.
5ae81b69fSDrew Fustini  *  Authors: Yangtao Li <frank.li@vivo.com>
6ae81b69fSDrew Fustini  */
7ae81b69fSDrew Fustini 
8ae81b69fSDrew Fustini #include <dt-bindings/clock/thead,th1520-clk-ap.h>
9ae81b69fSDrew Fustini #include <linux/bitfield.h>
10ae81b69fSDrew Fustini #include <linux/clk-provider.h>
11ae81b69fSDrew Fustini #include <linux/device.h>
12ae81b69fSDrew Fustini #include <linux/module.h>
13ae81b69fSDrew Fustini #include <linux/platform_device.h>
14ae81b69fSDrew Fustini #include <linux/regmap.h>
15ae81b69fSDrew Fustini 
16ae81b69fSDrew Fustini #define TH1520_PLL_POSTDIV2	GENMASK(26, 24)
17ae81b69fSDrew Fustini #define TH1520_PLL_POSTDIV1	GENMASK(22, 20)
18ae81b69fSDrew Fustini #define TH1520_PLL_FBDIV	GENMASK(19, 8)
19ae81b69fSDrew Fustini #define TH1520_PLL_REFDIV	GENMASK(5, 0)
20ae81b69fSDrew Fustini #define TH1520_PLL_BYPASS	BIT(30)
21ae81b69fSDrew Fustini #define TH1520_PLL_DSMPD	BIT(24)
22ae81b69fSDrew Fustini #define TH1520_PLL_FRAC		GENMASK(23, 0)
23ae81b69fSDrew Fustini #define TH1520_PLL_FRAC_BITS    24
24ae81b69fSDrew Fustini 
25ae81b69fSDrew Fustini struct ccu_internal {
26ae81b69fSDrew Fustini 	u8	shift;
27ae81b69fSDrew Fustini 	u8	width;
28ae81b69fSDrew Fustini };
29ae81b69fSDrew Fustini 
30ae81b69fSDrew Fustini struct ccu_div_internal {
31ae81b69fSDrew Fustini 	u8	shift;
32ae81b69fSDrew Fustini 	u8	width;
33ae81b69fSDrew Fustini 	u32	flags;
34ae81b69fSDrew Fustini };
35ae81b69fSDrew Fustini 
36ae81b69fSDrew Fustini struct ccu_common {
37ae81b69fSDrew Fustini 	int		clkid;
38ae81b69fSDrew Fustini 	struct regmap	*map;
39ae81b69fSDrew Fustini 	u16		cfg0;
40ae81b69fSDrew Fustini 	u16		cfg1;
41ae81b69fSDrew Fustini 	struct clk_hw	hw;
42ae81b69fSDrew Fustini };
43ae81b69fSDrew Fustini 
44ae81b69fSDrew Fustini struct ccu_mux {
45ae81b69fSDrew Fustini 	int			clkid;
46ae81b69fSDrew Fustini 	u32			reg;
47ae81b69fSDrew Fustini 	struct clk_mux		mux;
48ae81b69fSDrew Fustini };
49ae81b69fSDrew Fustini 
50ae81b69fSDrew Fustini struct ccu_gate {
51ae81b69fSDrew Fustini 	u32			enable;
52ae81b69fSDrew Fustini 	struct ccu_common	common;
53ae81b69fSDrew Fustini };
54ae81b69fSDrew Fustini 
55ae81b69fSDrew Fustini struct ccu_div {
56ae81b69fSDrew Fustini 	u32			enable;
57ae81b69fSDrew Fustini 	struct ccu_div_internal	div;
58ae81b69fSDrew Fustini 	struct ccu_internal	mux;
59ae81b69fSDrew Fustini 	struct ccu_common	common;
60ae81b69fSDrew Fustini };
61ae81b69fSDrew Fustini 
62ae81b69fSDrew Fustini struct ccu_pll {
63ae81b69fSDrew Fustini 	struct ccu_common	common;
64ae81b69fSDrew Fustini };
65ae81b69fSDrew Fustini 
66ae81b69fSDrew Fustini #define TH_CCU_ARG(_shift, _width)					\
67ae81b69fSDrew Fustini 	{								\
68ae81b69fSDrew Fustini 		.shift	= _shift,					\
69ae81b69fSDrew Fustini 		.width	= _width,					\
70ae81b69fSDrew Fustini 	}
71ae81b69fSDrew Fustini 
72ae81b69fSDrew Fustini #define TH_CCU_DIV_FLAGS(_shift, _width, _flags)			\
73ae81b69fSDrew Fustini 	{								\
74ae81b69fSDrew Fustini 		.shift	= _shift,					\
75ae81b69fSDrew Fustini 		.width	= _width,					\
76ae81b69fSDrew Fustini 		.flags	= _flags,					\
77ae81b69fSDrew Fustini 	}
78ae81b69fSDrew Fustini 
79ae81b69fSDrew Fustini #define TH_CCU_MUX(_name, _parents, _shift, _width)			\
80ae81b69fSDrew Fustini 	{								\
81ae81b69fSDrew Fustini 		.mask		= GENMASK(_width - 1, 0),		\
82ae81b69fSDrew Fustini 		.shift		= _shift,				\
83ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA(		\
84ae81b69fSDrew Fustini 					_name,				\
85ae81b69fSDrew Fustini 					_parents,			\
86ae81b69fSDrew Fustini 					&clk_mux_ops,			\
87ae81b69fSDrew Fustini 					0),				\
88ae81b69fSDrew Fustini 	}
89ae81b69fSDrew Fustini 
90ae81b69fSDrew Fustini #define CCU_GATE(_clkid, _struct, _name, _parent, _reg, _gate, _flags)	\
91ae81b69fSDrew Fustini 	struct ccu_gate _struct = {					\
92ae81b69fSDrew Fustini 		.enable	= _gate,					\
93ae81b69fSDrew Fustini 		.common	= {						\
94ae81b69fSDrew Fustini 			.clkid		= _clkid,			\
95ae81b69fSDrew Fustini 			.cfg0		= _reg,				\
96ae81b69fSDrew Fustini 			.hw.init	= CLK_HW_INIT_PARENTS_DATA(	\
97ae81b69fSDrew Fustini 						_name,			\
98ae81b69fSDrew Fustini 						_parent,		\
99ae81b69fSDrew Fustini 						&clk_gate_ops,		\
100ae81b69fSDrew Fustini 						_flags),		\
101ae81b69fSDrew Fustini 		}							\
102ae81b69fSDrew Fustini 	}
103ae81b69fSDrew Fustini 
hw_to_ccu_common(struct clk_hw * hw)104ae81b69fSDrew Fustini static inline struct ccu_common *hw_to_ccu_common(struct clk_hw *hw)
105ae81b69fSDrew Fustini {
106ae81b69fSDrew Fustini 	return container_of(hw, struct ccu_common, hw);
107ae81b69fSDrew Fustini }
108ae81b69fSDrew Fustini 
hw_to_ccu_pll(struct clk_hw * hw)109ae81b69fSDrew Fustini static inline struct ccu_pll *hw_to_ccu_pll(struct clk_hw *hw)
110ae81b69fSDrew Fustini {
111ae81b69fSDrew Fustini 	struct ccu_common *common = hw_to_ccu_common(hw);
112ae81b69fSDrew Fustini 
113ae81b69fSDrew Fustini 	return container_of(common, struct ccu_pll, common);
114ae81b69fSDrew Fustini }
115ae81b69fSDrew Fustini 
hw_to_ccu_div(struct clk_hw * hw)116ae81b69fSDrew Fustini static inline struct ccu_div *hw_to_ccu_div(struct clk_hw *hw)
117ae81b69fSDrew Fustini {
118ae81b69fSDrew Fustini 	struct ccu_common *common = hw_to_ccu_common(hw);
119ae81b69fSDrew Fustini 
120ae81b69fSDrew Fustini 	return container_of(common, struct ccu_div, common);
121ae81b69fSDrew Fustini }
122ae81b69fSDrew Fustini 
hw_to_ccu_gate(struct clk_hw * hw)123ae81b69fSDrew Fustini static inline struct ccu_gate *hw_to_ccu_gate(struct clk_hw *hw)
124ae81b69fSDrew Fustini {
125ae81b69fSDrew Fustini 	struct ccu_common *common = hw_to_ccu_common(hw);
126ae81b69fSDrew Fustini 
127ae81b69fSDrew Fustini 	return container_of(common, struct ccu_gate, common);
128ae81b69fSDrew Fustini }
129ae81b69fSDrew Fustini 
ccu_get_parent_helper(struct ccu_common * common,struct ccu_internal * mux)130ae81b69fSDrew Fustini static u8 ccu_get_parent_helper(struct ccu_common *common,
131ae81b69fSDrew Fustini 				struct ccu_internal *mux)
132ae81b69fSDrew Fustini {
133ae81b69fSDrew Fustini 	unsigned int val;
134ae81b69fSDrew Fustini 	u8 parent;
135ae81b69fSDrew Fustini 
136ae81b69fSDrew Fustini 	regmap_read(common->map, common->cfg0, &val);
137ae81b69fSDrew Fustini 	parent = val >> mux->shift;
138ae81b69fSDrew Fustini 	parent &= GENMASK(mux->width - 1, 0);
139ae81b69fSDrew Fustini 
140ae81b69fSDrew Fustini 	return parent;
141ae81b69fSDrew Fustini }
142ae81b69fSDrew Fustini 
ccu_set_parent_helper(struct ccu_common * common,struct ccu_internal * mux,u8 index)143ae81b69fSDrew Fustini static int ccu_set_parent_helper(struct ccu_common *common,
144ae81b69fSDrew Fustini 				 struct ccu_internal *mux,
145ae81b69fSDrew Fustini 				 u8 index)
146ae81b69fSDrew Fustini {
147ae81b69fSDrew Fustini 	return regmap_update_bits(common->map, common->cfg0,
148ae81b69fSDrew Fustini 			GENMASK(mux->width - 1, 0) << mux->shift,
149ae81b69fSDrew Fustini 			index << mux->shift);
150ae81b69fSDrew Fustini }
151ae81b69fSDrew Fustini 
ccu_disable_helper(struct ccu_common * common,u32 gate)152ae81b69fSDrew Fustini static void ccu_disable_helper(struct ccu_common *common, u32 gate)
153ae81b69fSDrew Fustini {
154ae81b69fSDrew Fustini 	if (!gate)
155ae81b69fSDrew Fustini 		return;
156ae81b69fSDrew Fustini 	regmap_update_bits(common->map, common->cfg0,
157ae81b69fSDrew Fustini 			   gate, ~gate);
158ae81b69fSDrew Fustini }
159ae81b69fSDrew Fustini 
ccu_enable_helper(struct ccu_common * common,u32 gate)160ae81b69fSDrew Fustini static int ccu_enable_helper(struct ccu_common *common, u32 gate)
161ae81b69fSDrew Fustini {
162ae81b69fSDrew Fustini 	unsigned int val;
163ae81b69fSDrew Fustini 	int ret;
164ae81b69fSDrew Fustini 
165ae81b69fSDrew Fustini 	if (!gate)
166ae81b69fSDrew Fustini 		return 0;
167ae81b69fSDrew Fustini 
168ae81b69fSDrew Fustini 	ret = regmap_update_bits(common->map, common->cfg0, gate, gate);
169ae81b69fSDrew Fustini 	regmap_read(common->map, common->cfg0, &val);
170ae81b69fSDrew Fustini 	return ret;
171ae81b69fSDrew Fustini }
172ae81b69fSDrew Fustini 
ccu_is_enabled_helper(struct ccu_common * common,u32 gate)173ae81b69fSDrew Fustini static int ccu_is_enabled_helper(struct ccu_common *common, u32 gate)
174ae81b69fSDrew Fustini {
175ae81b69fSDrew Fustini 	unsigned int val;
176ae81b69fSDrew Fustini 
177ae81b69fSDrew Fustini 	if (!gate)
178ae81b69fSDrew Fustini 		return true;
179ae81b69fSDrew Fustini 
180ae81b69fSDrew Fustini 	regmap_read(common->map, common->cfg0, &val);
181ae81b69fSDrew Fustini 	return val & gate;
182ae81b69fSDrew Fustini }
183ae81b69fSDrew Fustini 
ccu_div_recalc_rate(struct clk_hw * hw,unsigned long parent_rate)184ae81b69fSDrew Fustini static unsigned long ccu_div_recalc_rate(struct clk_hw *hw,
185ae81b69fSDrew Fustini 					 unsigned long parent_rate)
186ae81b69fSDrew Fustini {
187ae81b69fSDrew Fustini 	struct ccu_div *cd = hw_to_ccu_div(hw);
188ae81b69fSDrew Fustini 	unsigned long rate;
189ae81b69fSDrew Fustini 	unsigned int val;
190ae81b69fSDrew Fustini 
191ae81b69fSDrew Fustini 	regmap_read(cd->common.map, cd->common.cfg0, &val);
192ae81b69fSDrew Fustini 	val = val >> cd->div.shift;
193ae81b69fSDrew Fustini 	val &= GENMASK(cd->div.width - 1, 0);
194ae81b69fSDrew Fustini 	rate = divider_recalc_rate(hw, parent_rate, val, NULL,
195ae81b69fSDrew Fustini 				   cd->div.flags, cd->div.width);
196ae81b69fSDrew Fustini 
197ae81b69fSDrew Fustini 	return rate;
198ae81b69fSDrew Fustini }
199ae81b69fSDrew Fustini 
ccu_div_get_parent(struct clk_hw * hw)200ae81b69fSDrew Fustini static u8 ccu_div_get_parent(struct clk_hw *hw)
201ae81b69fSDrew Fustini {
202ae81b69fSDrew Fustini 	struct ccu_div *cd = hw_to_ccu_div(hw);
203ae81b69fSDrew Fustini 
204ae81b69fSDrew Fustini 	return ccu_get_parent_helper(&cd->common, &cd->mux);
205ae81b69fSDrew Fustini }
206ae81b69fSDrew Fustini 
ccu_div_set_parent(struct clk_hw * hw,u8 index)207ae81b69fSDrew Fustini static int ccu_div_set_parent(struct clk_hw *hw, u8 index)
208ae81b69fSDrew Fustini {
209ae81b69fSDrew Fustini 	struct ccu_div *cd = hw_to_ccu_div(hw);
210ae81b69fSDrew Fustini 
211ae81b69fSDrew Fustini 	return ccu_set_parent_helper(&cd->common, &cd->mux, index);
212ae81b69fSDrew Fustini }
213ae81b69fSDrew Fustini 
ccu_div_disable(struct clk_hw * hw)214ae81b69fSDrew Fustini static void ccu_div_disable(struct clk_hw *hw)
215ae81b69fSDrew Fustini {
216ae81b69fSDrew Fustini 	struct ccu_div *cd = hw_to_ccu_div(hw);
217ae81b69fSDrew Fustini 
218ae81b69fSDrew Fustini 	ccu_disable_helper(&cd->common, cd->enable);
219ae81b69fSDrew Fustini }
220ae81b69fSDrew Fustini 
ccu_div_enable(struct clk_hw * hw)221ae81b69fSDrew Fustini static int ccu_div_enable(struct clk_hw *hw)
222ae81b69fSDrew Fustini {
223ae81b69fSDrew Fustini 	struct ccu_div *cd = hw_to_ccu_div(hw);
224ae81b69fSDrew Fustini 
225ae81b69fSDrew Fustini 	return ccu_enable_helper(&cd->common, cd->enable);
226ae81b69fSDrew Fustini }
227ae81b69fSDrew Fustini 
ccu_div_is_enabled(struct clk_hw * hw)228ae81b69fSDrew Fustini static int ccu_div_is_enabled(struct clk_hw *hw)
229ae81b69fSDrew Fustini {
230ae81b69fSDrew Fustini 	struct ccu_div *cd = hw_to_ccu_div(hw);
231ae81b69fSDrew Fustini 
232ae81b69fSDrew Fustini 	return ccu_is_enabled_helper(&cd->common, cd->enable);
233ae81b69fSDrew Fustini }
234ae81b69fSDrew Fustini 
235ae81b69fSDrew Fustini static const struct clk_ops ccu_div_ops = {
236ae81b69fSDrew Fustini 	.disable	= ccu_div_disable,
237ae81b69fSDrew Fustini 	.enable		= ccu_div_enable,
238ae81b69fSDrew Fustini 	.is_enabled	= ccu_div_is_enabled,
239ae81b69fSDrew Fustini 	.get_parent	= ccu_div_get_parent,
240ae81b69fSDrew Fustini 	.set_parent	= ccu_div_set_parent,
241ae81b69fSDrew Fustini 	.recalc_rate	= ccu_div_recalc_rate,
242ae81b69fSDrew Fustini 	.determine_rate	= clk_hw_determine_rate_no_reparent,
243ae81b69fSDrew Fustini };
244ae81b69fSDrew Fustini 
th1520_pll_vco_recalc_rate(struct clk_hw * hw,unsigned long parent_rate)245ae81b69fSDrew Fustini static unsigned long th1520_pll_vco_recalc_rate(struct clk_hw *hw,
246ae81b69fSDrew Fustini 						unsigned long parent_rate)
247ae81b69fSDrew Fustini {
248ae81b69fSDrew Fustini 	struct ccu_pll *pll = hw_to_ccu_pll(hw);
249ae81b69fSDrew Fustini 	unsigned long div, mul, frac;
250ae81b69fSDrew Fustini 	unsigned int cfg0, cfg1;
251ae81b69fSDrew Fustini 	u64 rate = parent_rate;
252ae81b69fSDrew Fustini 
253ae81b69fSDrew Fustini 	regmap_read(pll->common.map, pll->common.cfg0, &cfg0);
254ae81b69fSDrew Fustini 	regmap_read(pll->common.map, pll->common.cfg1, &cfg1);
255ae81b69fSDrew Fustini 
256ae81b69fSDrew Fustini 	mul = FIELD_GET(TH1520_PLL_FBDIV, cfg0);
257ae81b69fSDrew Fustini 	div = FIELD_GET(TH1520_PLL_REFDIV, cfg0);
258ae81b69fSDrew Fustini 	if (!(cfg1 & TH1520_PLL_DSMPD)) {
259ae81b69fSDrew Fustini 		mul <<= TH1520_PLL_FRAC_BITS;
260ae81b69fSDrew Fustini 		frac = FIELD_GET(TH1520_PLL_FRAC, cfg1);
261ae81b69fSDrew Fustini 		mul += frac;
262ae81b69fSDrew Fustini 		div <<= TH1520_PLL_FRAC_BITS;
263ae81b69fSDrew Fustini 	}
264ae81b69fSDrew Fustini 	rate = parent_rate * mul;
265ae81b69fSDrew Fustini 	rate = rate / div;
266ae81b69fSDrew Fustini 	return rate;
267ae81b69fSDrew Fustini }
268ae81b69fSDrew Fustini 
th1520_pll_postdiv_recalc_rate(struct clk_hw * hw,unsigned long parent_rate)269ae81b69fSDrew Fustini static unsigned long th1520_pll_postdiv_recalc_rate(struct clk_hw *hw,
270ae81b69fSDrew Fustini 						    unsigned long parent_rate)
271ae81b69fSDrew Fustini {
272ae81b69fSDrew Fustini 	struct ccu_pll *pll = hw_to_ccu_pll(hw);
273ae81b69fSDrew Fustini 	unsigned long div, rate = parent_rate;
274ae81b69fSDrew Fustini 	unsigned int cfg0, cfg1;
275ae81b69fSDrew Fustini 
276ae81b69fSDrew Fustini 	regmap_read(pll->common.map, pll->common.cfg0, &cfg0);
277ae81b69fSDrew Fustini 	regmap_read(pll->common.map, pll->common.cfg1, &cfg1);
278ae81b69fSDrew Fustini 
279ae81b69fSDrew Fustini 	if (cfg1 & TH1520_PLL_BYPASS)
280ae81b69fSDrew Fustini 		return rate;
281ae81b69fSDrew Fustini 
282ae81b69fSDrew Fustini 	div = FIELD_GET(TH1520_PLL_POSTDIV1, cfg0) *
283ae81b69fSDrew Fustini 	      FIELD_GET(TH1520_PLL_POSTDIV2, cfg0);
284ae81b69fSDrew Fustini 
285ae81b69fSDrew Fustini 	rate = rate / div;
286ae81b69fSDrew Fustini 
287ae81b69fSDrew Fustini 	return rate;
288ae81b69fSDrew Fustini }
289ae81b69fSDrew Fustini 
ccu_pll_recalc_rate(struct clk_hw * hw,unsigned long parent_rate)290ae81b69fSDrew Fustini static unsigned long ccu_pll_recalc_rate(struct clk_hw *hw,
291ae81b69fSDrew Fustini 					 unsigned long parent_rate)
292ae81b69fSDrew Fustini {
293ae81b69fSDrew Fustini 	unsigned long rate = parent_rate;
294ae81b69fSDrew Fustini 
295ae81b69fSDrew Fustini 	rate = th1520_pll_vco_recalc_rate(hw, rate);
296ae81b69fSDrew Fustini 	rate = th1520_pll_postdiv_recalc_rate(hw, rate);
297ae81b69fSDrew Fustini 
298ae81b69fSDrew Fustini 	return rate;
299ae81b69fSDrew Fustini }
300ae81b69fSDrew Fustini 
301ae81b69fSDrew Fustini static const struct clk_ops clk_pll_ops = {
302ae81b69fSDrew Fustini 	.recalc_rate	= ccu_pll_recalc_rate,
303ae81b69fSDrew Fustini };
304ae81b69fSDrew Fustini 
305ae81b69fSDrew Fustini static const struct clk_parent_data osc_24m_clk[] = {
306ae81b69fSDrew Fustini 	{ .index = 0 }
307ae81b69fSDrew Fustini };
308ae81b69fSDrew Fustini 
309ae81b69fSDrew Fustini static struct ccu_pll cpu_pll0_clk = {
310ae81b69fSDrew Fustini 	.common		= {
311ae81b69fSDrew Fustini 		.clkid		= CLK_CPU_PLL0,
312ae81b69fSDrew Fustini 		.cfg0		= 0x000,
313ae81b69fSDrew Fustini 		.cfg1		= 0x004,
314ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA("cpu-pll0",
315ae81b69fSDrew Fustini 					      osc_24m_clk,
316ae81b69fSDrew Fustini 					      &clk_pll_ops,
317ae81b69fSDrew Fustini 					      0),
318ae81b69fSDrew Fustini 	},
319ae81b69fSDrew Fustini };
320ae81b69fSDrew Fustini 
321ae81b69fSDrew Fustini static struct ccu_pll cpu_pll1_clk = {
322ae81b69fSDrew Fustini 	.common		= {
323ae81b69fSDrew Fustini 		.clkid		= CLK_CPU_PLL1,
324ae81b69fSDrew Fustini 		.cfg0		= 0x010,
325ae81b69fSDrew Fustini 		.cfg1		= 0x014,
326ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA("cpu-pll1",
327ae81b69fSDrew Fustini 					      osc_24m_clk,
328ae81b69fSDrew Fustini 					      &clk_pll_ops,
329ae81b69fSDrew Fustini 					      0),
330ae81b69fSDrew Fustini 	},
331ae81b69fSDrew Fustini };
332ae81b69fSDrew Fustini 
333ae81b69fSDrew Fustini static struct ccu_pll gmac_pll_clk = {
334ae81b69fSDrew Fustini 	.common		= {
335ae81b69fSDrew Fustini 		.clkid		= CLK_GMAC_PLL,
336ae81b69fSDrew Fustini 		.cfg0		= 0x020,
337ae81b69fSDrew Fustini 		.cfg1		= 0x024,
338ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA("gmac-pll",
339ae81b69fSDrew Fustini 					      osc_24m_clk,
340ae81b69fSDrew Fustini 					      &clk_pll_ops,
341ae81b69fSDrew Fustini 					      0),
342ae81b69fSDrew Fustini 	},
343ae81b69fSDrew Fustini };
344ae81b69fSDrew Fustini 
345ae81b69fSDrew Fustini static const struct clk_hw *gmac_pll_clk_parent[] = {
346ae81b69fSDrew Fustini 	&gmac_pll_clk.common.hw
347ae81b69fSDrew Fustini };
348ae81b69fSDrew Fustini 
349ae81b69fSDrew Fustini static const struct clk_parent_data gmac_pll_clk_pd[] = {
350ae81b69fSDrew Fustini 	{ .hw = &gmac_pll_clk.common.hw }
351ae81b69fSDrew Fustini };
352ae81b69fSDrew Fustini 
353ae81b69fSDrew Fustini static struct ccu_pll video_pll_clk = {
354ae81b69fSDrew Fustini 	.common		= {
355ae81b69fSDrew Fustini 		.clkid		= CLK_VIDEO_PLL,
356ae81b69fSDrew Fustini 		.cfg0		= 0x030,
357ae81b69fSDrew Fustini 		.cfg1		= 0x034,
358ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA("video-pll",
359ae81b69fSDrew Fustini 					      osc_24m_clk,
360ae81b69fSDrew Fustini 					      &clk_pll_ops,
361ae81b69fSDrew Fustini 					      0),
362ae81b69fSDrew Fustini 	},
363ae81b69fSDrew Fustini };
364ae81b69fSDrew Fustini 
365ae81b69fSDrew Fustini static const struct clk_hw *video_pll_clk_parent[] = {
366ae81b69fSDrew Fustini 	&video_pll_clk.common.hw
367ae81b69fSDrew Fustini };
368ae81b69fSDrew Fustini 
369ae81b69fSDrew Fustini static const struct clk_parent_data video_pll_clk_pd[] = {
370ae81b69fSDrew Fustini 	{ .hw = &video_pll_clk.common.hw }
371ae81b69fSDrew Fustini };
372ae81b69fSDrew Fustini 
373ae81b69fSDrew Fustini static struct ccu_pll dpu0_pll_clk = {
374ae81b69fSDrew Fustini 	.common		= {
375ae81b69fSDrew Fustini 		.clkid		= CLK_DPU0_PLL,
376ae81b69fSDrew Fustini 		.cfg0		= 0x040,
377ae81b69fSDrew Fustini 		.cfg1		= 0x044,
378ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA("dpu0-pll",
379ae81b69fSDrew Fustini 					      osc_24m_clk,
380ae81b69fSDrew Fustini 					      &clk_pll_ops,
381ae81b69fSDrew Fustini 					      0),
382ae81b69fSDrew Fustini 	},
383ae81b69fSDrew Fustini };
384ae81b69fSDrew Fustini 
385ae81b69fSDrew Fustini static const struct clk_hw *dpu0_pll_clk_parent[] = {
386ae81b69fSDrew Fustini 	&dpu0_pll_clk.common.hw
387ae81b69fSDrew Fustini };
388ae81b69fSDrew Fustini 
389ae81b69fSDrew Fustini static struct ccu_pll dpu1_pll_clk = {
390ae81b69fSDrew Fustini 	.common		= {
391ae81b69fSDrew Fustini 		.clkid		= CLK_DPU1_PLL,
392ae81b69fSDrew Fustini 		.cfg0		= 0x050,
393ae81b69fSDrew Fustini 		.cfg1		= 0x054,
394ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA("dpu1-pll",
395ae81b69fSDrew Fustini 					      osc_24m_clk,
396ae81b69fSDrew Fustini 					      &clk_pll_ops,
397ae81b69fSDrew Fustini 					      0),
398ae81b69fSDrew Fustini 	},
399ae81b69fSDrew Fustini };
400ae81b69fSDrew Fustini 
401ae81b69fSDrew Fustini static const struct clk_hw *dpu1_pll_clk_parent[] = {
402ae81b69fSDrew Fustini 	&dpu1_pll_clk.common.hw
403ae81b69fSDrew Fustini };
404ae81b69fSDrew Fustini 
405ae81b69fSDrew Fustini static struct ccu_pll tee_pll_clk = {
406ae81b69fSDrew Fustini 	.common		= {
407ae81b69fSDrew Fustini 		.clkid		= CLK_TEE_PLL,
408ae81b69fSDrew Fustini 		.cfg0		= 0x060,
409ae81b69fSDrew Fustini 		.cfg1		= 0x064,
410ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA("tee-pll",
411ae81b69fSDrew Fustini 					      osc_24m_clk,
412ae81b69fSDrew Fustini 					      &clk_pll_ops,
413ae81b69fSDrew Fustini 					      0),
414ae81b69fSDrew Fustini 	},
415ae81b69fSDrew Fustini };
416ae81b69fSDrew Fustini 
417ae81b69fSDrew Fustini static const struct clk_parent_data c910_i0_parents[] = {
418ae81b69fSDrew Fustini 	{ .hw = &cpu_pll0_clk.common.hw },
419ae81b69fSDrew Fustini 	{ .index = 0 }
420ae81b69fSDrew Fustini };
421ae81b69fSDrew Fustini 
422ae81b69fSDrew Fustini static struct ccu_mux c910_i0_clk = {
423ae81b69fSDrew Fustini 	.clkid	= CLK_C910_I0,
424ae81b69fSDrew Fustini 	.reg	= 0x100,
425ae81b69fSDrew Fustini 	.mux	= TH_CCU_MUX("c910-i0", c910_i0_parents, 1, 1),
426ae81b69fSDrew Fustini };
427ae81b69fSDrew Fustini 
428ae81b69fSDrew Fustini static const struct clk_parent_data c910_parents[] = {
429ae81b69fSDrew Fustini 	{ .hw = &c910_i0_clk.mux.hw },
430ae81b69fSDrew Fustini 	{ .hw = &cpu_pll1_clk.common.hw }
431ae81b69fSDrew Fustini };
432ae81b69fSDrew Fustini 
433ae81b69fSDrew Fustini static struct ccu_mux c910_clk = {
434ae81b69fSDrew Fustini 	.clkid	= CLK_C910,
435ae81b69fSDrew Fustini 	.reg	= 0x100,
436ae81b69fSDrew Fustini 	.mux	= TH_CCU_MUX("c910", c910_parents, 0, 1),
437ae81b69fSDrew Fustini };
438ae81b69fSDrew Fustini 
439ae81b69fSDrew Fustini static const struct clk_parent_data ahb2_cpusys_parents[] = {
440ae81b69fSDrew Fustini 	{ .hw = &gmac_pll_clk.common.hw },
441ae81b69fSDrew Fustini 	{ .index = 0 }
442ae81b69fSDrew Fustini };
443ae81b69fSDrew Fustini 
444ae81b69fSDrew Fustini static struct ccu_div ahb2_cpusys_hclk = {
445ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 3, CLK_DIVIDER_ONE_BASED),
446ae81b69fSDrew Fustini 	.mux		= TH_CCU_ARG(5, 1),
447ae81b69fSDrew Fustini 	.common		= {
448ae81b69fSDrew Fustini 		.clkid          = CLK_AHB2_CPUSYS_HCLK,
449ae81b69fSDrew Fustini 		.cfg0		= 0x120,
450ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA("ahb2-cpusys-hclk",
451ae81b69fSDrew Fustini 						      ahb2_cpusys_parents,
452ae81b69fSDrew Fustini 						      &ccu_div_ops,
453ae81b69fSDrew Fustini 						      0),
454ae81b69fSDrew Fustini 	},
455ae81b69fSDrew Fustini };
456ae81b69fSDrew Fustini 
457ae81b69fSDrew Fustini static const struct clk_parent_data ahb2_cpusys_hclk_pd[] = {
458ae81b69fSDrew Fustini 	{ .hw = &ahb2_cpusys_hclk.common.hw }
459ae81b69fSDrew Fustini };
460ae81b69fSDrew Fustini 
461ae81b69fSDrew Fustini static const struct clk_hw *ahb2_cpusys_hclk_parent[] = {
462ae81b69fSDrew Fustini 	&ahb2_cpusys_hclk.common.hw,
463ae81b69fSDrew Fustini };
464ae81b69fSDrew Fustini 
465ae81b69fSDrew Fustini static struct ccu_div apb3_cpusys_pclk = {
466ae81b69fSDrew Fustini 	.div		= TH_CCU_ARG(0, 3),
467ae81b69fSDrew Fustini 	.common		= {
468ae81b69fSDrew Fustini 		.clkid          = CLK_APB3_CPUSYS_PCLK,
469ae81b69fSDrew Fustini 		.cfg0		= 0x130,
470ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("apb3-cpusys-pclk",
471ae81b69fSDrew Fustini 							   ahb2_cpusys_hclk_parent,
472ae81b69fSDrew Fustini 							   &ccu_div_ops,
473ae81b69fSDrew Fustini 							   0),
474ae81b69fSDrew Fustini 	},
475ae81b69fSDrew Fustini };
476ae81b69fSDrew Fustini 
477ae81b69fSDrew Fustini static const struct clk_parent_data apb3_cpusys_pclk_pd[] = {
478ae81b69fSDrew Fustini 	{ .hw = &apb3_cpusys_pclk.common.hw }
479ae81b69fSDrew Fustini };
480ae81b69fSDrew Fustini 
481ae81b69fSDrew Fustini static struct ccu_div axi4_cpusys2_aclk = {
482ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 3, CLK_DIVIDER_ONE_BASED),
483ae81b69fSDrew Fustini 	.common		= {
484ae81b69fSDrew Fustini 		.clkid          = CLK_AXI4_CPUSYS2_ACLK,
485ae81b69fSDrew Fustini 		.cfg0		= 0x134,
486ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("axi4-cpusys2-aclk",
487ae81b69fSDrew Fustini 					      gmac_pll_clk_parent,
488ae81b69fSDrew Fustini 					      &ccu_div_ops,
489ae81b69fSDrew Fustini 					      0),
490ae81b69fSDrew Fustini 	},
491ae81b69fSDrew Fustini };
492ae81b69fSDrew Fustini 
493ae81b69fSDrew Fustini static const struct clk_parent_data axi4_cpusys2_aclk_pd[] = {
494ae81b69fSDrew Fustini 	{ .hw = &axi4_cpusys2_aclk.common.hw }
495ae81b69fSDrew Fustini };
496ae81b69fSDrew Fustini 
497ae81b69fSDrew Fustini static const struct clk_parent_data axi_parents[] = {
498ae81b69fSDrew Fustini 	{ .hw = &video_pll_clk.common.hw },
499ae81b69fSDrew Fustini 	{ .index = 0 }
500ae81b69fSDrew Fustini };
501ae81b69fSDrew Fustini 
502ae81b69fSDrew Fustini static struct ccu_div axi_aclk = {
503ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 4, CLK_DIVIDER_ONE_BASED),
504ae81b69fSDrew Fustini 	.mux		= TH_CCU_ARG(5, 1),
505ae81b69fSDrew Fustini 	.common		= {
506ae81b69fSDrew Fustini 		.clkid          = CLK_AXI_ACLK,
507ae81b69fSDrew Fustini 		.cfg0		= 0x138,
508ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA("axi-aclk",
509ae81b69fSDrew Fustini 						      axi_parents,
510ae81b69fSDrew Fustini 						      &ccu_div_ops,
511ae81b69fSDrew Fustini 						      0),
512ae81b69fSDrew Fustini 	},
513ae81b69fSDrew Fustini };
514ae81b69fSDrew Fustini 
515ae81b69fSDrew Fustini static const struct clk_parent_data axi_aclk_pd[] = {
516ae81b69fSDrew Fustini 	{ .hw = &axi_aclk.common.hw }
517ae81b69fSDrew Fustini };
518ae81b69fSDrew Fustini 
519ae81b69fSDrew Fustini static const struct clk_parent_data perisys_ahb_hclk_parents[] = {
520ae81b69fSDrew Fustini 	{ .hw = &gmac_pll_clk.common.hw },
521ae81b69fSDrew Fustini 	{ .index = 0 },
522ae81b69fSDrew Fustini };
523ae81b69fSDrew Fustini 
524ae81b69fSDrew Fustini static struct ccu_div perisys_ahb_hclk = {
525ae81b69fSDrew Fustini 	.enable		= BIT(6),
526ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 4, CLK_DIVIDER_ONE_BASED),
527ae81b69fSDrew Fustini 	.mux		= TH_CCU_ARG(5, 1),
528ae81b69fSDrew Fustini 	.common		= {
529ae81b69fSDrew Fustini 		.clkid          = CLK_PERI_AHB_HCLK,
530ae81b69fSDrew Fustini 		.cfg0		= 0x140,
531ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA("perisys-ahb-hclk",
532ae81b69fSDrew Fustini 						      perisys_ahb_hclk_parents,
533ae81b69fSDrew Fustini 						      &ccu_div_ops,
534ae81b69fSDrew Fustini 						      0),
535ae81b69fSDrew Fustini 	},
536ae81b69fSDrew Fustini };
537ae81b69fSDrew Fustini 
538ae81b69fSDrew Fustini static const struct clk_parent_data perisys_ahb_hclk_pd[] = {
539ae81b69fSDrew Fustini 	{ .hw = &perisys_ahb_hclk.common.hw }
540ae81b69fSDrew Fustini };
541ae81b69fSDrew Fustini 
542ae81b69fSDrew Fustini static const struct clk_hw *perisys_ahb_hclk_parent[] = {
543ae81b69fSDrew Fustini 	&perisys_ahb_hclk.common.hw
544ae81b69fSDrew Fustini };
545ae81b69fSDrew Fustini 
546ae81b69fSDrew Fustini static struct ccu_div perisys_apb_pclk = {
547ae81b69fSDrew Fustini 	.div		= TH_CCU_ARG(0, 3),
548ae81b69fSDrew Fustini 	.common		= {
549ae81b69fSDrew Fustini 		.clkid          = CLK_PERI_APB_PCLK,
550ae81b69fSDrew Fustini 		.cfg0		= 0x150,
551ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("perisys-apb-pclk",
552ae81b69fSDrew Fustini 					      perisys_ahb_hclk_parent,
553ae81b69fSDrew Fustini 					      &ccu_div_ops,
554ae81b69fSDrew Fustini 					      0),
555ae81b69fSDrew Fustini 	},
556ae81b69fSDrew Fustini };
557ae81b69fSDrew Fustini 
558ae81b69fSDrew Fustini static const struct clk_parent_data perisys_apb_pclk_pd[] = {
559ae81b69fSDrew Fustini 	{ .hw = &perisys_apb_pclk.common.hw }
560ae81b69fSDrew Fustini };
561ae81b69fSDrew Fustini 
562ae81b69fSDrew Fustini static struct ccu_div peri2sys_apb_pclk = {
563ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(4, 3, CLK_DIVIDER_ONE_BASED),
564ae81b69fSDrew Fustini 	.common		= {
565ae81b69fSDrew Fustini 		.clkid          = CLK_PERI2APB_PCLK,
566ae81b69fSDrew Fustini 		.cfg0		= 0x150,
567ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("peri2sys-apb-pclk",
568ae81b69fSDrew Fustini 					      gmac_pll_clk_parent,
569ae81b69fSDrew Fustini 					      &ccu_div_ops,
570ae81b69fSDrew Fustini 					      0),
571ae81b69fSDrew Fustini 	},
572ae81b69fSDrew Fustini };
573ae81b69fSDrew Fustini 
574ae81b69fSDrew Fustini static const struct clk_parent_data peri2sys_apb_pclk_pd[] = {
575ae81b69fSDrew Fustini 	{ .hw = &peri2sys_apb_pclk.common.hw }
576ae81b69fSDrew Fustini };
577ae81b69fSDrew Fustini 
578ae81b69fSDrew Fustini static struct clk_fixed_factor osc12m_clk = {
579ae81b69fSDrew Fustini 	.div		= 2,
580ae81b69fSDrew Fustini 	.mult		= 1,
581ae81b69fSDrew Fustini 	.hw.init	= CLK_HW_INIT_PARENTS_DATA("osc_12m",
582ae81b69fSDrew Fustini 						   osc_24m_clk,
583ae81b69fSDrew Fustini 						   &clk_fixed_factor_ops,
584ae81b69fSDrew Fustini 						   0),
585ae81b69fSDrew Fustini };
586ae81b69fSDrew Fustini 
587ae81b69fSDrew Fustini static const char * const out_parents[] = { "osc_24m", "osc_12m" };
588ae81b69fSDrew Fustini 
589ae81b69fSDrew Fustini static struct ccu_div out1_clk = {
590ae81b69fSDrew Fustini 	.enable		= BIT(5),
591ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 3, CLK_DIVIDER_ONE_BASED),
592ae81b69fSDrew Fustini 	.mux		= TH_CCU_ARG(4, 1),
593ae81b69fSDrew Fustini 	.common		= {
594ae81b69fSDrew Fustini 		.clkid          = CLK_OUT1,
595ae81b69fSDrew Fustini 		.cfg0		= 0x1b4,
596ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS("out1",
597ae81b69fSDrew Fustini 						      out_parents,
598ae81b69fSDrew Fustini 						      &ccu_div_ops,
599ae81b69fSDrew Fustini 						      0),
600ae81b69fSDrew Fustini 	},
601ae81b69fSDrew Fustini };
602ae81b69fSDrew Fustini 
603ae81b69fSDrew Fustini static struct ccu_div out2_clk = {
604ae81b69fSDrew Fustini 	.enable		= BIT(5),
605ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 3, CLK_DIVIDER_ONE_BASED),
606ae81b69fSDrew Fustini 	.mux		= TH_CCU_ARG(4, 1),
607ae81b69fSDrew Fustini 	.common		= {
608ae81b69fSDrew Fustini 		.clkid          = CLK_OUT2,
609ae81b69fSDrew Fustini 		.cfg0		= 0x1b8,
610ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS("out2",
611ae81b69fSDrew Fustini 						      out_parents,
612ae81b69fSDrew Fustini 						      &ccu_div_ops,
613ae81b69fSDrew Fustini 						      0),
614ae81b69fSDrew Fustini 	},
615ae81b69fSDrew Fustini };
616ae81b69fSDrew Fustini 
617ae81b69fSDrew Fustini static struct ccu_div out3_clk = {
618ae81b69fSDrew Fustini 	.enable		= BIT(5),
619ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 3, CLK_DIVIDER_ONE_BASED),
620ae81b69fSDrew Fustini 	.mux		= TH_CCU_ARG(4, 1),
621ae81b69fSDrew Fustini 	.common		= {
622ae81b69fSDrew Fustini 		.clkid          = CLK_OUT3,
623ae81b69fSDrew Fustini 		.cfg0		= 0x1bc,
624ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS("out3",
625ae81b69fSDrew Fustini 						      out_parents,
626ae81b69fSDrew Fustini 						      &ccu_div_ops,
627ae81b69fSDrew Fustini 						      0),
628ae81b69fSDrew Fustini 	},
629ae81b69fSDrew Fustini };
630ae81b69fSDrew Fustini 
631ae81b69fSDrew Fustini static struct ccu_div out4_clk = {
632ae81b69fSDrew Fustini 	.enable		= BIT(5),
633ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 3, CLK_DIVIDER_ONE_BASED),
634ae81b69fSDrew Fustini 	.mux		= TH_CCU_ARG(4, 1),
635ae81b69fSDrew Fustini 	.common		= {
636ae81b69fSDrew Fustini 		.clkid          = CLK_OUT4,
637ae81b69fSDrew Fustini 		.cfg0		= 0x1c0,
638ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS("out4",
639ae81b69fSDrew Fustini 						      out_parents,
640ae81b69fSDrew Fustini 						      &ccu_div_ops,
641ae81b69fSDrew Fustini 						      0),
642ae81b69fSDrew Fustini 	},
643ae81b69fSDrew Fustini };
644ae81b69fSDrew Fustini 
645ae81b69fSDrew Fustini static const struct clk_parent_data apb_parents[] = {
646ae81b69fSDrew Fustini 	{ .hw = &gmac_pll_clk.common.hw },
647ae81b69fSDrew Fustini 	{ .index = 0 },
648ae81b69fSDrew Fustini };
649ae81b69fSDrew Fustini 
650ae81b69fSDrew Fustini static struct ccu_div apb_pclk = {
651ae81b69fSDrew Fustini 	.enable		= BIT(5),
652ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 4, CLK_DIVIDER_ONE_BASED),
653ae81b69fSDrew Fustini 	.mux		= TH_CCU_ARG(7, 1),
654ae81b69fSDrew Fustini 	.common		= {
655ae81b69fSDrew Fustini 		.clkid          = CLK_APB_PCLK,
656ae81b69fSDrew Fustini 		.cfg0		= 0x1c4,
657ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_DATA("apb-pclk",
658ae81b69fSDrew Fustini 						      apb_parents,
659ae81b69fSDrew Fustini 						      &ccu_div_ops,
660037705e9SDrew Fustini 						      CLK_IGNORE_UNUSED),
661ae81b69fSDrew Fustini 	},
662ae81b69fSDrew Fustini };
663ae81b69fSDrew Fustini 
664ae81b69fSDrew Fustini static const struct clk_hw *npu_parents[] = {
665ae81b69fSDrew Fustini 	&gmac_pll_clk.common.hw,
666ae81b69fSDrew Fustini 	&video_pll_clk.common.hw
667ae81b69fSDrew Fustini };
668ae81b69fSDrew Fustini 
669ae81b69fSDrew Fustini static struct ccu_div npu_clk = {
670ae81b69fSDrew Fustini 	.enable		= BIT(4),
671ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 3, CLK_DIVIDER_ONE_BASED),
672ae81b69fSDrew Fustini 	.mux		= TH_CCU_ARG(6, 1),
673ae81b69fSDrew Fustini 	.common		= {
674ae81b69fSDrew Fustini 		.clkid          = CLK_NPU,
675ae81b69fSDrew Fustini 		.cfg0		= 0x1c8,
676ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("npu",
677ae81b69fSDrew Fustini 						      npu_parents,
678ae81b69fSDrew Fustini 						      &ccu_div_ops,
679ae81b69fSDrew Fustini 						      0),
680ae81b69fSDrew Fustini 	},
681ae81b69fSDrew Fustini };
682ae81b69fSDrew Fustini 
683ae81b69fSDrew Fustini static struct ccu_div vi_clk = {
684ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(16, 4, CLK_DIVIDER_ONE_BASED),
685ae81b69fSDrew Fustini 	.common		= {
686ae81b69fSDrew Fustini 		.clkid          = CLK_VI,
687ae81b69fSDrew Fustini 		.cfg0		= 0x1d0,
688ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("vi",
689ae81b69fSDrew Fustini 					      video_pll_clk_parent,
690ae81b69fSDrew Fustini 					      &ccu_div_ops,
691ae81b69fSDrew Fustini 					      0),
692ae81b69fSDrew Fustini 	},
693ae81b69fSDrew Fustini };
694ae81b69fSDrew Fustini 
695ae81b69fSDrew Fustini static struct ccu_div vi_ahb_clk = {
696ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 4, CLK_DIVIDER_ONE_BASED),
697ae81b69fSDrew Fustini 	.common		= {
698ae81b69fSDrew Fustini 		.clkid          = CLK_VI_AHB,
699ae81b69fSDrew Fustini 		.cfg0		= 0x1d0,
700ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("vi-ahb",
701ae81b69fSDrew Fustini 					      video_pll_clk_parent,
702ae81b69fSDrew Fustini 					      &ccu_div_ops,
703ae81b69fSDrew Fustini 					      0),
704ae81b69fSDrew Fustini 	},
705ae81b69fSDrew Fustini };
706ae81b69fSDrew Fustini 
707ae81b69fSDrew Fustini static struct ccu_div vo_axi_clk = {
708ae81b69fSDrew Fustini 	.enable		= BIT(5),
709ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 4, CLK_DIVIDER_ONE_BASED),
710ae81b69fSDrew Fustini 	.common		= {
711ae81b69fSDrew Fustini 		.clkid          = CLK_VO_AXI,
712ae81b69fSDrew Fustini 		.cfg0		= 0x1dc,
713ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("vo-axi",
714ae81b69fSDrew Fustini 					      video_pll_clk_parent,
715ae81b69fSDrew Fustini 					      &ccu_div_ops,
716ae81b69fSDrew Fustini 					      0),
717ae81b69fSDrew Fustini 	},
718ae81b69fSDrew Fustini };
719ae81b69fSDrew Fustini 
720ae81b69fSDrew Fustini static struct ccu_div vp_apb_clk = {
721ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 3, CLK_DIVIDER_ONE_BASED),
722ae81b69fSDrew Fustini 	.common		= {
723ae81b69fSDrew Fustini 		.clkid          = CLK_VP_APB,
724ae81b69fSDrew Fustini 		.cfg0		= 0x1e0,
725ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("vp-apb",
726ae81b69fSDrew Fustini 					      gmac_pll_clk_parent,
727ae81b69fSDrew Fustini 					      &ccu_div_ops,
728ae81b69fSDrew Fustini 					      0),
729ae81b69fSDrew Fustini 	},
730ae81b69fSDrew Fustini };
731ae81b69fSDrew Fustini 
732ae81b69fSDrew Fustini static struct ccu_div vp_axi_clk = {
733ae81b69fSDrew Fustini 	.enable		= BIT(15),
734ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(8, 4, CLK_DIVIDER_ONE_BASED),
735ae81b69fSDrew Fustini 	.common		= {
736ae81b69fSDrew Fustini 		.clkid          = CLK_VP_AXI,
737ae81b69fSDrew Fustini 		.cfg0		= 0x1e0,
738ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("vp-axi",
739ae81b69fSDrew Fustini 					      video_pll_clk_parent,
740ae81b69fSDrew Fustini 					      &ccu_div_ops,
74139a33965SDrew Fustini 					      CLK_IGNORE_UNUSED),
742ae81b69fSDrew Fustini 	},
743ae81b69fSDrew Fustini };
744ae81b69fSDrew Fustini 
745ae81b69fSDrew Fustini static struct ccu_div venc_clk = {
746ae81b69fSDrew Fustini 	.enable		= BIT(5),
747ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 3, CLK_DIVIDER_ONE_BASED),
748ae81b69fSDrew Fustini 	.common		= {
749ae81b69fSDrew Fustini 		.clkid          = CLK_VENC,
750ae81b69fSDrew Fustini 		.cfg0		= 0x1e4,
751ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("venc",
752ae81b69fSDrew Fustini 					      gmac_pll_clk_parent,
753ae81b69fSDrew Fustini 					      &ccu_div_ops,
754ae81b69fSDrew Fustini 					      0),
755ae81b69fSDrew Fustini 	},
756ae81b69fSDrew Fustini };
757ae81b69fSDrew Fustini 
758ae81b69fSDrew Fustini static struct ccu_div dpu0_clk = {
759ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 8, CLK_DIVIDER_ONE_BASED),
760ae81b69fSDrew Fustini 	.common		= {
761ae81b69fSDrew Fustini 		.clkid          = CLK_DPU0,
762ae81b69fSDrew Fustini 		.cfg0		= 0x1e8,
763ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("dpu0",
764ae81b69fSDrew Fustini 					      dpu0_pll_clk_parent,
765ae81b69fSDrew Fustini 					      &ccu_div_ops,
766ae81b69fSDrew Fustini 					      0),
767ae81b69fSDrew Fustini 	},
768ae81b69fSDrew Fustini };
769ae81b69fSDrew Fustini 
770ae81b69fSDrew Fustini static struct ccu_div dpu1_clk = {
771ae81b69fSDrew Fustini 	.div		= TH_CCU_DIV_FLAGS(0, 8, CLK_DIVIDER_ONE_BASED),
772ae81b69fSDrew Fustini 	.common		= {
773ae81b69fSDrew Fustini 		.clkid          = CLK_DPU1,
774ae81b69fSDrew Fustini 		.cfg0		= 0x1ec,
775ae81b69fSDrew Fustini 		.hw.init	= CLK_HW_INIT_PARENTS_HW("dpu1",
776ae81b69fSDrew Fustini 					      dpu1_pll_clk_parent,
777ae81b69fSDrew Fustini 					      &ccu_div_ops,
778ae81b69fSDrew Fustini 					      0),
779ae81b69fSDrew Fustini 	},
780ae81b69fSDrew Fustini };
781ae81b69fSDrew Fustini 
782f4bf0b90SMaksim Kiselev static CLK_FIXED_FACTOR_HW(emmc_sdio_ref_clk, "emmc-sdio-ref",
783f4bf0b90SMaksim Kiselev 			   &video_pll_clk.common.hw, 4, 1, 0);
784f4bf0b90SMaksim Kiselev 
785f4bf0b90SMaksim Kiselev static const struct clk_parent_data emmc_sdio_ref_clk_pd[] = {
786f4bf0b90SMaksim Kiselev 	{ .hw = &emmc_sdio_ref_clk.hw },
787f4bf0b90SMaksim Kiselev };
788f4bf0b90SMaksim Kiselev 
789ae81b69fSDrew Fustini static CCU_GATE(CLK_BROM, brom_clk, "brom", ahb2_cpusys_hclk_pd, 0x100, BIT(4), 0);
790ae81b69fSDrew Fustini static CCU_GATE(CLK_BMU, bmu_clk, "bmu", axi4_cpusys2_aclk_pd, 0x100, BIT(5), 0);
791ae81b69fSDrew Fustini static CCU_GATE(CLK_AON2CPU_A2X, aon2cpu_a2x_clk, "aon2cpu-a2x", axi4_cpusys2_aclk_pd,
792ae81b69fSDrew Fustini 		0x134, BIT(8), 0);
793ae81b69fSDrew Fustini static CCU_GATE(CLK_X2X_CPUSYS, x2x_cpusys_clk, "x2x-cpusys", axi4_cpusys2_aclk_pd,
794ae81b69fSDrew Fustini 		0x134, BIT(7), 0);
795ae81b69fSDrew Fustini static CCU_GATE(CLK_CPU2AON_X2H, cpu2aon_x2h_clk, "cpu2aon-x2h", axi_aclk_pd,
796ae81b69fSDrew Fustini 		0x138, BIT(8), CLK_IGNORE_UNUSED);
797037705e9SDrew Fustini static CCU_GATE(CLK_CPU2PERI_X2H, cpu2peri_x2h_clk, "cpu2peri-x2h", axi4_cpusys2_aclk_pd,
798ae81b69fSDrew Fustini 		0x140, BIT(9), CLK_IGNORE_UNUSED);
799ae81b69fSDrew Fustini static CCU_GATE(CLK_PERISYS_APB1_HCLK, perisys_apb1_hclk, "perisys-apb1-hclk", perisys_ahb_hclk_pd,
800ae81b69fSDrew Fustini 		0x150, BIT(9), CLK_IGNORE_UNUSED);
801037705e9SDrew Fustini static CCU_GATE(CLK_PERISYS_APB2_HCLK, perisys_apb2_hclk, "perisys-apb2-hclk", perisys_ahb_hclk_pd,
802ae81b69fSDrew Fustini 		0x150, BIT(10), CLK_IGNORE_UNUSED);
803037705e9SDrew Fustini static CCU_GATE(CLK_PERISYS_APB3_HCLK, perisys_apb3_hclk, "perisys-apb3-hclk", perisys_ahb_hclk_pd,
804ae81b69fSDrew Fustini 		0x150, BIT(11), CLK_IGNORE_UNUSED);
805ae81b69fSDrew Fustini static CCU_GATE(CLK_PERISYS_APB4_HCLK, perisys_apb4_hclk, "perisys-apb4-hclk", perisys_ahb_hclk_pd,
806ae81b69fSDrew Fustini 		0x150, BIT(12), 0);
807ae81b69fSDrew Fustini static CCU_GATE(CLK_NPU_AXI, npu_axi_clk, "npu-axi", axi_aclk_pd, 0x1c8, BIT(5), 0);
808f4bf0b90SMaksim Kiselev static CCU_GATE(CLK_CPU2VP, cpu2vp_clk, "cpu2vp", axi_aclk_pd, 0x1e0, BIT(13), 0);
809ae81b69fSDrew Fustini static CCU_GATE(CLK_EMMC_SDIO, emmc_sdio_clk, "emmc-sdio", emmc_sdio_ref_clk_pd, 0x204, BIT(30), 0);
810ae81b69fSDrew Fustini static CCU_GATE(CLK_GMAC1, gmac1_clk, "gmac1", gmac_pll_clk_pd, 0x204, BIT(26), 0);
811ae81b69fSDrew Fustini static CCU_GATE(CLK_PADCTRL1, padctrl1_clk, "padctrl1", perisys_apb_pclk_pd, 0x204, BIT(24), 0);
812ae81b69fSDrew Fustini static CCU_GATE(CLK_DSMART, dsmart_clk, "dsmart", perisys_apb_pclk_pd, 0x204, BIT(23), 0);
813ae81b69fSDrew Fustini static CCU_GATE(CLK_PADCTRL0, padctrl0_clk, "padctrl0", perisys_apb_pclk_pd, 0x204, BIT(22), 0);
814ae81b69fSDrew Fustini static CCU_GATE(CLK_GMAC_AXI, gmac_axi_clk, "gmac-axi", axi4_cpusys2_aclk_pd, 0x204, BIT(21), 0);
815ae81b69fSDrew Fustini static CCU_GATE(CLK_GPIO3, gpio3_clk, "gpio3-clk", peri2sys_apb_pclk_pd, 0x204, BIT(20), 0);
816ae81b69fSDrew Fustini static CCU_GATE(CLK_GMAC0, gmac0_clk, "gmac0", gmac_pll_clk_pd, 0x204, BIT(19), 0);
817ae81b69fSDrew Fustini static CCU_GATE(CLK_PWM, pwm_clk, "pwm", perisys_apb_pclk_pd, 0x204, BIT(18), 0);
818ae81b69fSDrew Fustini static CCU_GATE(CLK_QSPI0, qspi0_clk, "qspi0", video_pll_clk_pd, 0x204, BIT(17), 0);
819ae81b69fSDrew Fustini static CCU_GATE(CLK_QSPI1, qspi1_clk, "qspi1", video_pll_clk_pd, 0x204, BIT(16), 0);
820ae81b69fSDrew Fustini static CCU_GATE(CLK_SPI, spi_clk, "spi", video_pll_clk_pd, 0x204, BIT(15), 0);
821ae81b69fSDrew Fustini static CCU_GATE(CLK_UART0_PCLK, uart0_pclk, "uart0-pclk", perisys_apb_pclk_pd, 0x204, BIT(14), 0);
822ae81b69fSDrew Fustini static CCU_GATE(CLK_UART1_PCLK, uart1_pclk, "uart1-pclk", perisys_apb_pclk_pd, 0x204, BIT(13), 0);
823ae81b69fSDrew Fustini static CCU_GATE(CLK_UART2_PCLK, uart2_pclk, "uart2-pclk", perisys_apb_pclk_pd, 0x204, BIT(12), 0);
824ae81b69fSDrew Fustini static CCU_GATE(CLK_UART3_PCLK, uart3_pclk, "uart3-pclk", perisys_apb_pclk_pd, 0x204, BIT(11), 0);
825ae81b69fSDrew Fustini static CCU_GATE(CLK_UART4_PCLK, uart4_pclk, "uart4-pclk", perisys_apb_pclk_pd, 0x204, BIT(10), 0);
826ae81b69fSDrew Fustini static CCU_GATE(CLK_UART5_PCLK, uart5_pclk, "uart5-pclk", perisys_apb_pclk_pd, 0x204, BIT(9), 0);
827ae81b69fSDrew Fustini static CCU_GATE(CLK_GPIO0, gpio0_clk, "gpio0-clk", perisys_apb_pclk_pd, 0x204, BIT(8), 0);
828ae81b69fSDrew Fustini static CCU_GATE(CLK_GPIO1, gpio1_clk, "gpio1-clk", perisys_apb_pclk_pd, 0x204, BIT(7), 0);
829ae81b69fSDrew Fustini static CCU_GATE(CLK_GPIO2, gpio2_clk, "gpio2-clk", peri2sys_apb_pclk_pd, 0x204, BIT(6), 0);
830ae81b69fSDrew Fustini static CCU_GATE(CLK_I2C0, i2c0_clk, "i2c0", perisys_apb_pclk_pd, 0x204, BIT(5), 0);
831ae81b69fSDrew Fustini static CCU_GATE(CLK_I2C1, i2c1_clk, "i2c1", perisys_apb_pclk_pd, 0x204, BIT(4), 0);
832ae81b69fSDrew Fustini static CCU_GATE(CLK_I2C2, i2c2_clk, "i2c2", perisys_apb_pclk_pd, 0x204, BIT(3), 0);
833ae81b69fSDrew Fustini static CCU_GATE(CLK_I2C3, i2c3_clk, "i2c3", perisys_apb_pclk_pd, 0x204, BIT(2), 0);
834ae81b69fSDrew Fustini static CCU_GATE(CLK_I2C4, i2c4_clk, "i2c4", perisys_apb_pclk_pd, 0x204, BIT(1), 0);
835ae81b69fSDrew Fustini static CCU_GATE(CLK_I2C5, i2c5_clk, "i2c5", perisys_apb_pclk_pd, 0x204, BIT(0), 0);
836ae81b69fSDrew Fustini static CCU_GATE(CLK_SPINLOCK, spinlock_clk, "spinlock", ahb2_cpusys_hclk_pd, 0x208, BIT(10), 0);
837ae81b69fSDrew Fustini static CCU_GATE(CLK_DMA, dma_clk, "dma", axi4_cpusys2_aclk_pd, 0x208, BIT(8), 0);
838ae81b69fSDrew Fustini static CCU_GATE(CLK_MBOX0, mbox0_clk, "mbox0", apb3_cpusys_pclk_pd, 0x208, BIT(7), 0);
839ae81b69fSDrew Fustini static CCU_GATE(CLK_MBOX1, mbox1_clk, "mbox1", apb3_cpusys_pclk_pd, 0x208, BIT(6), 0);
840ae81b69fSDrew Fustini static CCU_GATE(CLK_MBOX2, mbox2_clk, "mbox2", apb3_cpusys_pclk_pd, 0x208, BIT(5), 0);
841ae81b69fSDrew Fustini static CCU_GATE(CLK_MBOX3, mbox3_clk, "mbox3", apb3_cpusys_pclk_pd, 0x208, BIT(4), 0);
842ae81b69fSDrew Fustini static CCU_GATE(CLK_WDT0, wdt0_clk, "wdt0", apb3_cpusys_pclk_pd, 0x208, BIT(3), 0);
843ae81b69fSDrew Fustini static CCU_GATE(CLK_WDT1, wdt1_clk, "wdt1", apb3_cpusys_pclk_pd, 0x208, BIT(2), 0);
844ae81b69fSDrew Fustini static CCU_GATE(CLK_TIMER0, timer0_clk, "timer0", apb3_cpusys_pclk_pd, 0x208, BIT(1), 0);
845ae81b69fSDrew Fustini static CCU_GATE(CLK_TIMER1, timer1_clk, "timer1", apb3_cpusys_pclk_pd, 0x208, BIT(0), 0);
846ae81b69fSDrew Fustini static CCU_GATE(CLK_SRAM0, sram0_clk, "sram0", axi_aclk_pd, 0x20c, BIT(4), 0);
847ae81b69fSDrew Fustini static CCU_GATE(CLK_SRAM1, sram1_clk, "sram1", axi_aclk_pd, 0x20c, BIT(3), 0);
848ae81b69fSDrew Fustini static CCU_GATE(CLK_SRAM2, sram2_clk, "sram2", axi_aclk_pd, 0x20c, BIT(2), 0);
849ae81b69fSDrew Fustini static CCU_GATE(CLK_SRAM3, sram3_clk, "sram3", axi_aclk_pd, 0x20c, BIT(1), 0);
850*50d4b157SMichal Wilczynski 
851*50d4b157SMichal Wilczynski static CCU_GATE(CLK_AXI4_VO_ACLK, axi4_vo_aclk, "axi4-vo-aclk",
852*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(0), 0);
853*50d4b157SMichal Wilczynski static CCU_GATE(CLK_GPU_CORE, gpu_core_clk, "gpu-core-clk", video_pll_clk_pd,
854*50d4b157SMichal Wilczynski 		0x0, BIT(3), 0);
855*50d4b157SMichal Wilczynski static CCU_GATE(CLK_GPU_CFG_ACLK, gpu_cfg_aclk, "gpu-cfg-aclk",
856*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(4), 0);
857*50d4b157SMichal Wilczynski static CCU_GATE(CLK_DPU_PIXELCLK0, dpu0_pixelclk, "dpu0-pixelclk",
858*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(5), 0);
859*50d4b157SMichal Wilczynski static CCU_GATE(CLK_DPU_PIXELCLK1, dpu1_pixelclk, "dpu1-pixelclk",
860*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(6), 0);
861*50d4b157SMichal Wilczynski static CCU_GATE(CLK_DPU_HCLK, dpu_hclk, "dpu-hclk", video_pll_clk_pd, 0x0,
862*50d4b157SMichal Wilczynski 		BIT(7), 0);
863*50d4b157SMichal Wilczynski static CCU_GATE(CLK_DPU_ACLK, dpu_aclk, "dpu-aclk", video_pll_clk_pd, 0x0,
864*50d4b157SMichal Wilczynski 		BIT(8), 0);
865*50d4b157SMichal Wilczynski static CCU_GATE(CLK_DPU_CCLK, dpu_cclk, "dpu-cclk", video_pll_clk_pd, 0x0,
866*50d4b157SMichal Wilczynski 		BIT(9), 0);
867*50d4b157SMichal Wilczynski static CCU_GATE(CLK_HDMI_SFR, hdmi_sfr_clk, "hdmi-sfr-clk", video_pll_clk_pd,
868*50d4b157SMichal Wilczynski 		0x0, BIT(10), 0);
869*50d4b157SMichal Wilczynski static CCU_GATE(CLK_HDMI_PCLK, hdmi_pclk, "hdmi-pclk", video_pll_clk_pd, 0x0,
870*50d4b157SMichal Wilczynski 		BIT(11), 0);
871*50d4b157SMichal Wilczynski static CCU_GATE(CLK_HDMI_CEC, hdmi_cec_clk, "hdmi-cec-clk", video_pll_clk_pd,
872*50d4b157SMichal Wilczynski 		0x0, BIT(12), 0);
873*50d4b157SMichal Wilczynski static CCU_GATE(CLK_MIPI_DSI0_PCLK, mipi_dsi0_pclk, "mipi-dsi0-pclk",
874*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(13), 0);
875*50d4b157SMichal Wilczynski static CCU_GATE(CLK_MIPI_DSI1_PCLK, mipi_dsi1_pclk, "mipi-dsi1-pclk",
876*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(14), 0);
877*50d4b157SMichal Wilczynski static CCU_GATE(CLK_MIPI_DSI0_CFG, mipi_dsi0_cfg_clk, "mipi-dsi0-cfg-clk",
878*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(15), 0);
879*50d4b157SMichal Wilczynski static CCU_GATE(CLK_MIPI_DSI1_CFG, mipi_dsi1_cfg_clk, "mipi-dsi1-cfg-clk",
880*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(16), 0);
881*50d4b157SMichal Wilczynski static CCU_GATE(CLK_MIPI_DSI0_REFCLK, mipi_dsi0_refclk, "mipi-dsi0-refclk",
882*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(17), 0);
883*50d4b157SMichal Wilczynski static CCU_GATE(CLK_MIPI_DSI1_REFCLK, mipi_dsi1_refclk, "mipi-dsi1-refclk",
884*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(18), 0);
885*50d4b157SMichal Wilczynski static CCU_GATE(CLK_HDMI_I2S, hdmi_i2s_clk, "hdmi-i2s-clk", video_pll_clk_pd,
886*50d4b157SMichal Wilczynski 		0x0, BIT(19), 0);
887*50d4b157SMichal Wilczynski static CCU_GATE(CLK_X2H_DPU1_ACLK, x2h_dpu1_aclk, "x2h-dpu1-aclk",
888*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(20), 0);
889*50d4b157SMichal Wilczynski static CCU_GATE(CLK_X2H_DPU_ACLK, x2h_dpu_aclk, "x2h-dpu-aclk",
890*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(21), 0);
891*50d4b157SMichal Wilczynski static CCU_GATE(CLK_AXI4_VO_PCLK, axi4_vo_pclk, "axi4-vo-pclk",
892*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(22), 0);
893*50d4b157SMichal Wilczynski static CCU_GATE(CLK_IOPMP_VOSYS_DPU_PCLK, iopmp_vosys_dpu_pclk,
894*50d4b157SMichal Wilczynski 		"iopmp-vosys-dpu-pclk", video_pll_clk_pd, 0x0, BIT(23), 0);
895*50d4b157SMichal Wilczynski static CCU_GATE(CLK_IOPMP_VOSYS_DPU1_PCLK, iopmp_vosys_dpu1_pclk,
896*50d4b157SMichal Wilczynski 		"iopmp-vosys-dpu1-pclk", video_pll_clk_pd, 0x0, BIT(24), 0);
897*50d4b157SMichal Wilczynski static CCU_GATE(CLK_IOPMP_VOSYS_GPU_PCLK, iopmp_vosys_gpu_pclk,
898*50d4b157SMichal Wilczynski 		"iopmp-vosys-gpu-pclk", video_pll_clk_pd, 0x0, BIT(25), 0);
899*50d4b157SMichal Wilczynski static CCU_GATE(CLK_IOPMP_DPU1_ACLK, iopmp_dpu1_aclk, "iopmp-dpu1-aclk",
900*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(27), 0);
901*50d4b157SMichal Wilczynski static CCU_GATE(CLK_IOPMP_DPU_ACLK, iopmp_dpu_aclk, "iopmp-dpu-aclk",
902*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(28), 0);
903*50d4b157SMichal Wilczynski static CCU_GATE(CLK_IOPMP_GPU_ACLK, iopmp_gpu_aclk, "iopmp-gpu-aclk",
904*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(29), 0);
905*50d4b157SMichal Wilczynski static CCU_GATE(CLK_MIPIDSI0_PIXCLK, mipi_dsi0_pixclk, "mipi-dsi0-pixclk",
906*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(30), 0);
907*50d4b157SMichal Wilczynski static CCU_GATE(CLK_MIPIDSI1_PIXCLK, mipi_dsi1_pixclk, "mipi-dsi1-pixclk",
908*50d4b157SMichal Wilczynski 		video_pll_clk_pd, 0x0, BIT(31), 0);
909*50d4b157SMichal Wilczynski static CCU_GATE(CLK_HDMI_PIXCLK, hdmi_pixclk, "hdmi-pixclk", video_pll_clk_pd,
910*50d4b157SMichal Wilczynski 		0x4, BIT(0), 0);
911ae81b69fSDrew Fustini 
912ae81b69fSDrew Fustini static CLK_FIXED_FACTOR_HW(gmac_pll_clk_100m, "gmac-pll-clk-100m",
913ae81b69fSDrew Fustini 			   &gmac_pll_clk.common.hw, 10, 1, 0);
914ae81b69fSDrew Fustini 
915ae81b69fSDrew Fustini static const struct clk_parent_data uart_sclk_parents[] = {
916ae81b69fSDrew Fustini 	{ .hw = &gmac_pll_clk_100m.hw },
917ae81b69fSDrew Fustini 	{ .index = 0 },
918ae81b69fSDrew Fustini };
919ae81b69fSDrew Fustini 
920ae81b69fSDrew Fustini static struct ccu_mux uart_sclk = {
921ae81b69fSDrew Fustini 	.clkid	= CLK_UART_SCLK,
922ae81b69fSDrew Fustini 	.reg	= 0x210,
923ae81b69fSDrew Fustini 	.mux	= TH_CCU_MUX("uart-sclk", uart_sclk_parents, 0, 1),
924ae81b69fSDrew Fustini };
925ae81b69fSDrew Fustini 
926ae81b69fSDrew Fustini static struct ccu_common *th1520_pll_clks[] = {
927ae81b69fSDrew Fustini 	&cpu_pll0_clk.common,
928ae81b69fSDrew Fustini 	&cpu_pll1_clk.common,
929ae81b69fSDrew Fustini 	&gmac_pll_clk.common,
930ae81b69fSDrew Fustini 	&video_pll_clk.common,
931ae81b69fSDrew Fustini 	&dpu0_pll_clk.common,
932ae81b69fSDrew Fustini 	&dpu1_pll_clk.common,
933ae81b69fSDrew Fustini 	&tee_pll_clk.common,
934ae81b69fSDrew Fustini };
935ae81b69fSDrew Fustini 
936ae81b69fSDrew Fustini static struct ccu_common *th1520_div_clks[] = {
937ae81b69fSDrew Fustini 	&ahb2_cpusys_hclk.common,
938ae81b69fSDrew Fustini 	&apb3_cpusys_pclk.common,
939ae81b69fSDrew Fustini 	&axi4_cpusys2_aclk.common,
940ae81b69fSDrew Fustini 	&perisys_ahb_hclk.common,
941ae81b69fSDrew Fustini 	&perisys_apb_pclk.common,
942ae81b69fSDrew Fustini 	&axi_aclk.common,
943ae81b69fSDrew Fustini 	&peri2sys_apb_pclk.common,
944ae81b69fSDrew Fustini 	&out1_clk.common,
945ae81b69fSDrew Fustini 	&out2_clk.common,
946ae81b69fSDrew Fustini 	&out3_clk.common,
947ae81b69fSDrew Fustini 	&out4_clk.common,
948ae81b69fSDrew Fustini 	&apb_pclk.common,
949ae81b69fSDrew Fustini 	&npu_clk.common,
950ae81b69fSDrew Fustini 	&vi_clk.common,
951ae81b69fSDrew Fustini 	&vi_ahb_clk.common,
952ae81b69fSDrew Fustini 	&vo_axi_clk.common,
953ae81b69fSDrew Fustini 	&vp_apb_clk.common,
954ae81b69fSDrew Fustini 	&vp_axi_clk.common,
955ae81b69fSDrew Fustini 	&venc_clk.common,
956ae81b69fSDrew Fustini 	&dpu0_clk.common,
957ae81b69fSDrew Fustini 	&dpu1_clk.common,
958ae81b69fSDrew Fustini };
959ae81b69fSDrew Fustini 
960ae81b69fSDrew Fustini static struct ccu_mux *th1520_mux_clks[] = {
961ae81b69fSDrew Fustini 	&c910_i0_clk,
962ae81b69fSDrew Fustini 	&c910_clk,
963ae81b69fSDrew Fustini 	&uart_sclk,
964ae81b69fSDrew Fustini };
965ae81b69fSDrew Fustini 
966ae81b69fSDrew Fustini static struct ccu_common *th1520_gate_clks[] = {
967ae81b69fSDrew Fustini 	&emmc_sdio_clk.common,
968ae81b69fSDrew Fustini 	&aon2cpu_a2x_clk.common,
969ae81b69fSDrew Fustini 	&x2x_cpusys_clk.common,
970ae81b69fSDrew Fustini 	&brom_clk.common,
971ae81b69fSDrew Fustini 	&bmu_clk.common,
972ae81b69fSDrew Fustini 	&cpu2aon_x2h_clk.common,
973ae81b69fSDrew Fustini 	&cpu2peri_x2h_clk.common,
974ae81b69fSDrew Fustini 	&cpu2vp_clk.common,
975ae81b69fSDrew Fustini 	&perisys_apb1_hclk.common,
976ae81b69fSDrew Fustini 	&perisys_apb2_hclk.common,
977ae81b69fSDrew Fustini 	&perisys_apb3_hclk.common,
978ae81b69fSDrew Fustini 	&perisys_apb4_hclk.common,
9793a43cd19SDrew Fustini 	&npu_axi_clk.common,
980ae81b69fSDrew Fustini 	&gmac1_clk.common,
981ae81b69fSDrew Fustini 	&padctrl1_clk.common,
982ae81b69fSDrew Fustini 	&dsmart_clk.common,
983ae81b69fSDrew Fustini 	&padctrl0_clk.common,
984ae81b69fSDrew Fustini 	&gmac_axi_clk.common,
985ae81b69fSDrew Fustini 	&gpio3_clk.common,
986ae81b69fSDrew Fustini 	&gmac0_clk.common,
987ae81b69fSDrew Fustini 	&pwm_clk.common,
988ae81b69fSDrew Fustini 	&qspi0_clk.common,
989ae81b69fSDrew Fustini 	&qspi1_clk.common,
990ae81b69fSDrew Fustini 	&spi_clk.common,
991ae81b69fSDrew Fustini 	&uart0_pclk.common,
992ae81b69fSDrew Fustini 	&uart1_pclk.common,
993ae81b69fSDrew Fustini 	&uart2_pclk.common,
994ae81b69fSDrew Fustini 	&uart3_pclk.common,
995ae81b69fSDrew Fustini 	&uart4_pclk.common,
996ae81b69fSDrew Fustini 	&uart5_pclk.common,
997ae81b69fSDrew Fustini 	&gpio0_clk.common,
998ae81b69fSDrew Fustini 	&gpio1_clk.common,
999ae81b69fSDrew Fustini 	&gpio2_clk.common,
1000ae81b69fSDrew Fustini 	&i2c0_clk.common,
1001ae81b69fSDrew Fustini 	&i2c1_clk.common,
1002ae81b69fSDrew Fustini 	&i2c2_clk.common,
1003ae81b69fSDrew Fustini 	&i2c3_clk.common,
1004ae81b69fSDrew Fustini 	&i2c4_clk.common,
1005ae81b69fSDrew Fustini 	&i2c5_clk.common,
1006ae81b69fSDrew Fustini 	&spinlock_clk.common,
1007ae81b69fSDrew Fustini 	&dma_clk.common,
1008ae81b69fSDrew Fustini 	&mbox0_clk.common,
1009ae81b69fSDrew Fustini 	&mbox1_clk.common,
1010ae81b69fSDrew Fustini 	&mbox2_clk.common,
1011ae81b69fSDrew Fustini 	&mbox3_clk.common,
1012ae81b69fSDrew Fustini 	&wdt0_clk.common,
1013ae81b69fSDrew Fustini 	&wdt1_clk.common,
1014ae81b69fSDrew Fustini 	&timer0_clk.common,
1015ae81b69fSDrew Fustini 	&timer1_clk.common,
1016ae81b69fSDrew Fustini 	&sram0_clk.common,
1017ae81b69fSDrew Fustini 	&sram1_clk.common,
1018ae81b69fSDrew Fustini 	&sram2_clk.common,
1019ae81b69fSDrew Fustini 	&sram3_clk.common,
1020ae81b69fSDrew Fustini };
1021ae81b69fSDrew Fustini 
1022ae81b69fSDrew Fustini static struct ccu_common *th1520_vo_gate_clks[] = {
1023ae81b69fSDrew Fustini 	&axi4_vo_aclk.common,
1024ae81b69fSDrew Fustini 	&gpu_core_clk.common,
1025ae81b69fSDrew Fustini 	&gpu_cfg_aclk.common,
1026ae81b69fSDrew Fustini 	&dpu0_pixelclk.common,
1027*50d4b157SMichal Wilczynski 	&dpu1_pixelclk.common,
1028*50d4b157SMichal Wilczynski 	&dpu_hclk.common,
1029*50d4b157SMichal Wilczynski 	&dpu_aclk.common,
1030*50d4b157SMichal Wilczynski 	&dpu_cclk.common,
1031*50d4b157SMichal Wilczynski 	&hdmi_sfr_clk.common,
1032*50d4b157SMichal Wilczynski 	&hdmi_pclk.common,
1033*50d4b157SMichal Wilczynski 	&hdmi_cec_clk.common,
1034*50d4b157SMichal Wilczynski 	&mipi_dsi0_pclk.common,
1035*50d4b157SMichal Wilczynski 	&mipi_dsi1_pclk.common,
1036*50d4b157SMichal Wilczynski 	&mipi_dsi0_cfg_clk.common,
1037*50d4b157SMichal Wilczynski 	&mipi_dsi1_cfg_clk.common,
1038*50d4b157SMichal Wilczynski 	&mipi_dsi0_refclk.common,
1039*50d4b157SMichal Wilczynski 	&mipi_dsi1_refclk.common,
1040*50d4b157SMichal Wilczynski 	&hdmi_i2s_clk.common,
1041*50d4b157SMichal Wilczynski 	&x2h_dpu1_aclk.common,
1042*50d4b157SMichal Wilczynski 	&x2h_dpu_aclk.common,
1043*50d4b157SMichal Wilczynski 	&axi4_vo_pclk.common,
1044*50d4b157SMichal Wilczynski 	&iopmp_vosys_dpu_pclk.common,
1045*50d4b157SMichal Wilczynski 	&iopmp_vosys_dpu1_pclk.common,
1046*50d4b157SMichal Wilczynski 	&iopmp_vosys_gpu_pclk.common,
1047*50d4b157SMichal Wilczynski 	&iopmp_dpu1_aclk.common,
1048*50d4b157SMichal Wilczynski 	&iopmp_dpu_aclk.common,
1049*50d4b157SMichal Wilczynski 	&iopmp_gpu_aclk.common,
1050*50d4b157SMichal Wilczynski 	&mipi_dsi0_pixclk.common,
1051*50d4b157SMichal Wilczynski 	&mipi_dsi1_pixclk.common,
1052*50d4b157SMichal Wilczynski 	&hdmi_pixclk.common
1053*50d4b157SMichal Wilczynski };
1054*50d4b157SMichal Wilczynski 
1055*50d4b157SMichal Wilczynski static const struct regmap_config th1520_clk_regmap_config = {
1056*50d4b157SMichal Wilczynski 	.reg_bits = 32,
1057*50d4b157SMichal Wilczynski 	.val_bits = 32,
1058*50d4b157SMichal Wilczynski 	.reg_stride = 4,
1059ae81b69fSDrew Fustini 	.fast_io = true,
1060ae81b69fSDrew Fustini };
1061ae81b69fSDrew Fustini 
1062ae81b69fSDrew Fustini struct th1520_plat_data {
1063ae81b69fSDrew Fustini 	struct ccu_common **th1520_pll_clks;
1064ae81b69fSDrew Fustini 	struct ccu_common **th1520_div_clks;
1065ae81b69fSDrew Fustini 	struct ccu_mux	  **th1520_mux_clks;
1066ae81b69fSDrew Fustini 	struct ccu_common **th1520_gate_clks;
1067*50d4b157SMichal Wilczynski 
1068*50d4b157SMichal Wilczynski 	int nr_clks;
1069*50d4b157SMichal Wilczynski 	int nr_pll_clks;
1070*50d4b157SMichal Wilczynski 	int nr_div_clks;
1071*50d4b157SMichal Wilczynski 	int nr_mux_clks;
1072*50d4b157SMichal Wilczynski 	int nr_gate_clks;
1073*50d4b157SMichal Wilczynski };
1074*50d4b157SMichal Wilczynski 
1075*50d4b157SMichal Wilczynski static const struct th1520_plat_data th1520_ap_platdata = {
1076*50d4b157SMichal Wilczynski 	.th1520_pll_clks = th1520_pll_clks,
1077*50d4b157SMichal Wilczynski 	.th1520_div_clks = th1520_div_clks,
1078*50d4b157SMichal Wilczynski 	.th1520_mux_clks = th1520_mux_clks,
1079*50d4b157SMichal Wilczynski 	.th1520_gate_clks = th1520_gate_clks,
1080*50d4b157SMichal Wilczynski 
1081*50d4b157SMichal Wilczynski 	.nr_clks = CLK_UART_SCLK + 1,
1082*50d4b157SMichal Wilczynski 
1083*50d4b157SMichal Wilczynski 	.nr_pll_clks = ARRAY_SIZE(th1520_pll_clks),
1084*50d4b157SMichal Wilczynski 	.nr_div_clks = ARRAY_SIZE(th1520_div_clks),
1085*50d4b157SMichal Wilczynski 	.nr_mux_clks = ARRAY_SIZE(th1520_mux_clks),
1086*50d4b157SMichal Wilczynski 	.nr_gate_clks = ARRAY_SIZE(th1520_gate_clks),
1087*50d4b157SMichal Wilczynski };
1088*50d4b157SMichal Wilczynski 
1089*50d4b157SMichal Wilczynski static const struct th1520_plat_data th1520_vo_platdata = {
1090*50d4b157SMichal Wilczynski 	.th1520_gate_clks = th1520_vo_gate_clks,
1091*50d4b157SMichal Wilczynski 
1092*50d4b157SMichal Wilczynski 	.nr_clks = CLK_HDMI_PIXCLK + 1,
1093*50d4b157SMichal Wilczynski 
1094*50d4b157SMichal Wilczynski 	.nr_gate_clks = ARRAY_SIZE(th1520_vo_gate_clks),
1095*50d4b157SMichal Wilczynski };
1096*50d4b157SMichal Wilczynski 
th1520_clk_probe(struct platform_device * pdev)1097*50d4b157SMichal Wilczynski static int th1520_clk_probe(struct platform_device *pdev)
1098*50d4b157SMichal Wilczynski {
1099*50d4b157SMichal Wilczynski 	const struct th1520_plat_data *plat_data;
1100*50d4b157SMichal Wilczynski 	struct device *dev = &pdev->dev;
1101*50d4b157SMichal Wilczynski 	struct clk_hw_onecell_data *priv;
1102ae81b69fSDrew Fustini 
1103ae81b69fSDrew Fustini 	struct regmap *map;
1104*50d4b157SMichal Wilczynski 	void __iomem *base;
1105ae81b69fSDrew Fustini 	struct clk_hw *hw;
1106ae81b69fSDrew Fustini 	int ret, i;
1107ae81b69fSDrew Fustini 
1108ae81b69fSDrew Fustini 	plat_data = device_get_match_data(&pdev->dev);
1109ae81b69fSDrew Fustini 	if (!plat_data)
1110ae81b69fSDrew Fustini 		return dev_err_probe(&pdev->dev, -ENODEV,
1111ae81b69fSDrew Fustini 				     "No device match data found\n");
1112ae81b69fSDrew Fustini 
1113*50d4b157SMichal Wilczynski 	priv = devm_kzalloc(dev, struct_size(priv, hws, plat_data->nr_clks), GFP_KERNEL);
1114*50d4b157SMichal Wilczynski 	if (!priv)
1115*50d4b157SMichal Wilczynski 		return -ENOMEM;
1116*50d4b157SMichal Wilczynski 
1117*50d4b157SMichal Wilczynski 	priv->num = plat_data->nr_clks;
1118*50d4b157SMichal Wilczynski 
1119ae81b69fSDrew Fustini 	base = devm_platform_ioremap_resource(pdev, 0);
1120ae81b69fSDrew Fustini 	if (IS_ERR(base))
1121ae81b69fSDrew Fustini 		return PTR_ERR(base);
1122*50d4b157SMichal Wilczynski 
1123ae81b69fSDrew Fustini 	map = devm_regmap_init_mmio(dev, base, &th1520_clk_regmap_config);
1124ae81b69fSDrew Fustini 	if (IS_ERR(map))
1125ae81b69fSDrew Fustini 		return PTR_ERR(map);
1126ae81b69fSDrew Fustini 
1127ae81b69fSDrew Fustini 	for (i = 0; i < plat_data->nr_pll_clks; i++) {
1128ae81b69fSDrew Fustini 		struct ccu_pll *cp = hw_to_ccu_pll(&plat_data->th1520_pll_clks[i]->hw);
1129ae81b69fSDrew Fustini 
1130ae81b69fSDrew Fustini 		plat_data->th1520_pll_clks[i]->map = map;
1131ae81b69fSDrew Fustini 
1132*50d4b157SMichal Wilczynski 		ret = devm_clk_hw_register(dev, &plat_data->th1520_pll_clks[i]->hw);
1133*50d4b157SMichal Wilczynski 		if (ret)
1134ae81b69fSDrew Fustini 			return ret;
1135*50d4b157SMichal Wilczynski 
1136ae81b69fSDrew Fustini 		priv->hws[cp->common.clkid] = &cp->common.hw;
1137*50d4b157SMichal Wilczynski 	}
1138ae81b69fSDrew Fustini 
1139ae81b69fSDrew Fustini 	for (i = 0; i < plat_data->nr_div_clks; i++) {
1140ae81b69fSDrew Fustini 		struct ccu_div *cd = hw_to_ccu_div(&plat_data->th1520_div_clks[i]->hw);
1141ae81b69fSDrew Fustini 
1142ae81b69fSDrew Fustini 		plat_data->th1520_div_clks[i]->map = map;
1143ae81b69fSDrew Fustini 
1144*50d4b157SMichal Wilczynski 		ret = devm_clk_hw_register(dev, &plat_data->th1520_div_clks[i]->hw);
1145*50d4b157SMichal Wilczynski 		if (ret)
1146ae81b69fSDrew Fustini 			return ret;
1147*50d4b157SMichal Wilczynski 
1148ae81b69fSDrew Fustini 		priv->hws[cd->common.clkid] = &cd->common.hw;
1149*50d4b157SMichal Wilczynski 	}
1150ae81b69fSDrew Fustini 
1151ae81b69fSDrew Fustini 	for (i = 0; i < plat_data->nr_mux_clks; i++) {
1152ae81b69fSDrew Fustini 		struct ccu_mux *cm = plat_data->th1520_mux_clks[i];
1153ae81b69fSDrew Fustini 
1154ae81b69fSDrew Fustini 		cm->mux.reg = base + cm->reg;
1155ae81b69fSDrew Fustini 
1156*50d4b157SMichal Wilczynski 		ret = devm_clk_hw_register(dev, &cm->mux.hw);
1157*50d4b157SMichal Wilczynski 		if (ret)
1158ae81b69fSDrew Fustini 			return ret;
1159ae81b69fSDrew Fustini 
1160*50d4b157SMichal Wilczynski 		priv->hws[cm->clkid] = &cm->mux.hw;
1161ae81b69fSDrew Fustini 	}
1162ae81b69fSDrew Fustini 
1163ae81b69fSDrew Fustini 	for (i = 0; i < plat_data->nr_gate_clks; i++) {
1164ae81b69fSDrew Fustini 		struct ccu_gate *cg = hw_to_ccu_gate(&plat_data->th1520_gate_clks[i]->hw);
1165ae81b69fSDrew Fustini 
1166ae81b69fSDrew Fustini 		plat_data->th1520_gate_clks[i]->map = map;
1167ae81b69fSDrew Fustini 
1168ae81b69fSDrew Fustini 		hw = devm_clk_hw_register_gate_parent_data(dev,
1169ae81b69fSDrew Fustini 							   cg->common.hw.init->name,
1170ae81b69fSDrew Fustini 							   cg->common.hw.init->parent_data,
1171ae81b69fSDrew Fustini 							   cg->common.hw.init->flags,
1172ae81b69fSDrew Fustini 							   base + cg->common.cfg0,
1173ae81b69fSDrew Fustini 							   ffs(cg->enable) - 1, 0, NULL);
1174ae81b69fSDrew Fustini 		if (IS_ERR(hw))
1175ae81b69fSDrew Fustini 			return PTR_ERR(hw);
1176*50d4b157SMichal Wilczynski 
1177*50d4b157SMichal Wilczynski 		priv->hws[cg->common.clkid] = hw;
1178ae81b69fSDrew Fustini 	}
1179*50d4b157SMichal Wilczynski 
1180ae81b69fSDrew Fustini 	if (plat_data == &th1520_ap_platdata) {
1181ae81b69fSDrew Fustini 		ret = devm_clk_hw_register(dev, &osc12m_clk.hw);
1182ae81b69fSDrew Fustini 		if (ret)
1183ae81b69fSDrew Fustini 			return ret;
1184a826e53fSDrew Fustini 		priv->hws[CLK_OSC12M] = &osc12m_clk.hw;
1185a826e53fSDrew Fustini 
1186ae81b69fSDrew Fustini 		ret = devm_clk_hw_register(dev, &gmac_pll_clk_100m.hw);
1187ae81b69fSDrew Fustini 		if (ret)
1188ae81b69fSDrew Fustini 			return ret;
1189ae81b69fSDrew Fustini 		priv->hws[CLK_PLL_GMAC_100M] = &gmac_pll_clk_100m.hw;
1190ae81b69fSDrew Fustini 
1191ae81b69fSDrew Fustini 		ret = devm_clk_hw_register(dev, &emmc_sdio_ref_clk.hw);
1192ae81b69fSDrew Fustini 		if (ret)
1193*50d4b157SMichal Wilczynski 			return ret;
1194ae81b69fSDrew Fustini 	}
1195ae81b69fSDrew Fustini 
1196ae81b69fSDrew Fustini 	ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, priv);
1197ae81b69fSDrew Fustini 	if (ret)
1198ae81b69fSDrew Fustini 		return ret;
1199ae81b69fSDrew Fustini 
1200ae81b69fSDrew Fustini 	return 0;
1201ae81b69fSDrew Fustini }
1202ae81b69fSDrew Fustini 
1203ae81b69fSDrew Fustini static const struct of_device_id th1520_clk_match[] = {
1204f4bf0b90SMaksim Kiselev 	{
1205f4bf0b90SMaksim Kiselev 		.compatible = "thead,th1520-clk-ap",
1206f4bf0b90SMaksim Kiselev 		.data = &th1520_ap_platdata,
1207*50d4b157SMichal Wilczynski 	},
1208f4bf0b90SMaksim Kiselev 	{
1209ae81b69fSDrew Fustini 		.compatible = "thead,th1520-clk-vo",
1210ae81b69fSDrew Fustini 		.data = &th1520_vo_platdata,
1211ae81b69fSDrew Fustini 	},
1212ae81b69fSDrew Fustini 	{ /* sentinel */ },
1213ae81b69fSDrew Fustini };
1214ae81b69fSDrew Fustini MODULE_DEVICE_TABLE(of, th1520_clk_match);
1215ae81b69fSDrew Fustini 
1216ae81b69fSDrew Fustini static struct platform_driver th1520_clk_driver = {
1217ae81b69fSDrew Fustini 	.probe		= th1520_clk_probe,
1218ae81b69fSDrew Fustini 	.driver		= {
1219*50d4b157SMichal Wilczynski 		.name	= "th1520-clk",
1220*50d4b157SMichal Wilczynski 		.of_match_table = th1520_clk_match,
1221*50d4b157SMichal Wilczynski 	},
1222*50d4b157SMichal Wilczynski };
1223*50d4b157SMichal Wilczynski module_platform_driver(th1520_clk_driver);
1224ae81b69fSDrew Fustini 
1225ae81b69fSDrew Fustini MODULE_DESCRIPTION("T-HEAD TH1520 AP Clock driver");
1226ae81b69fSDrew Fustini MODULE_AUTHOR("Yangtao Li <frank.li@vivo.com>");
1227ae81b69fSDrew Fustini MODULE_AUTHOR("Jisheng Zhang <jszhang@kernel.org>");
1228ae81b69fSDrew Fustini MODULE_LICENSE("GPL");
1229ae81b69fSDrew Fustini