xref: /openbmc/linux/drivers/clk/meson/g12a.c (revision e553d2a5)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Amlogic Meson-G12A Clock Controller Driver
4  *
5  * Copyright (c) 2016 Baylibre SAS.
6  * Author: Michael Turquette <mturquette@baylibre.com>
7  *
8  * Copyright (c) 2018 Amlogic, inc.
9  * Author: Qiufang Dai <qiufang.dai@amlogic.com>
10  * Author: Jian Hu <jian.hu@amlogic.com>
11  */
12 
13 #include <linux/clk-provider.h>
14 #include <linux/init.h>
15 #include <linux/of_device.h>
16 #include <linux/platform_device.h>
17 #include <linux/clk.h>
18 
19 #include "clk-mpll.h"
20 #include "clk-pll.h"
21 #include "clk-regmap.h"
22 #include "clk-cpu-dyndiv.h"
23 #include "vid-pll-div.h"
24 #include "meson-eeclk.h"
25 #include "g12a.h"
26 
27 static DEFINE_SPINLOCK(meson_clk_lock);
28 
29 static struct clk_regmap g12a_fixed_pll_dco = {
30 	.data = &(struct meson_clk_pll_data){
31 		.en = {
32 			.reg_off = HHI_FIX_PLL_CNTL0,
33 			.shift   = 28,
34 			.width   = 1,
35 		},
36 		.m = {
37 			.reg_off = HHI_FIX_PLL_CNTL0,
38 			.shift   = 0,
39 			.width   = 8,
40 		},
41 		.n = {
42 			.reg_off = HHI_FIX_PLL_CNTL0,
43 			.shift   = 10,
44 			.width   = 5,
45 		},
46 		.frac = {
47 			.reg_off = HHI_FIX_PLL_CNTL1,
48 			.shift   = 0,
49 			.width   = 17,
50 		},
51 		.l = {
52 			.reg_off = HHI_FIX_PLL_CNTL0,
53 			.shift   = 31,
54 			.width   = 1,
55 		},
56 		.rst = {
57 			.reg_off = HHI_FIX_PLL_CNTL0,
58 			.shift   = 29,
59 			.width   = 1,
60 		},
61 	},
62 	.hw.init = &(struct clk_init_data){
63 		.name = "fixed_pll_dco",
64 		.ops = &meson_clk_pll_ro_ops,
65 		.parent_data = &(const struct clk_parent_data) {
66 			.fw_name = "xtal",
67 		},
68 		.num_parents = 1,
69 	},
70 };
71 
72 static struct clk_regmap g12a_fixed_pll = {
73 	.data = &(struct clk_regmap_div_data){
74 		.offset = HHI_FIX_PLL_CNTL0,
75 		.shift = 16,
76 		.width = 2,
77 		.flags = CLK_DIVIDER_POWER_OF_TWO,
78 	},
79 	.hw.init = &(struct clk_init_data){
80 		.name = "fixed_pll",
81 		.ops = &clk_regmap_divider_ro_ops,
82 		.parent_hws = (const struct clk_hw *[]) {
83 			&g12a_fixed_pll_dco.hw
84 		},
85 		.num_parents = 1,
86 		/*
87 		 * This clock won't ever change at runtime so
88 		 * CLK_SET_RATE_PARENT is not required
89 		 */
90 	},
91 };
92 
93 static const struct pll_mult_range g12a_sys_pll_mult_range = {
94 	.min = 128,
95 	.max = 250,
96 };
97 
98 static struct clk_regmap g12a_sys_pll_dco = {
99 	.data = &(struct meson_clk_pll_data){
100 		.en = {
101 			.reg_off = HHI_SYS_PLL_CNTL0,
102 			.shift   = 28,
103 			.width   = 1,
104 		},
105 		.m = {
106 			.reg_off = HHI_SYS_PLL_CNTL0,
107 			.shift   = 0,
108 			.width   = 8,
109 		},
110 		.n = {
111 			.reg_off = HHI_SYS_PLL_CNTL0,
112 			.shift   = 10,
113 			.width   = 5,
114 		},
115 		.l = {
116 			.reg_off = HHI_SYS_PLL_CNTL0,
117 			.shift   = 31,
118 			.width   = 1,
119 		},
120 		.rst = {
121 			.reg_off = HHI_SYS_PLL_CNTL0,
122 			.shift   = 29,
123 			.width   = 1,
124 		},
125 		.range = &g12a_sys_pll_mult_range,
126 	},
127 	.hw.init = &(struct clk_init_data){
128 		.name = "sys_pll_dco",
129 		.ops = &meson_clk_pll_ops,
130 		.parent_data = &(const struct clk_parent_data) {
131 			.fw_name = "xtal",
132 		},
133 		.num_parents = 1,
134 		/* This clock feeds the CPU, avoid disabling it */
135 		.flags = CLK_IS_CRITICAL,
136 	},
137 };
138 
139 static struct clk_regmap g12a_sys_pll = {
140 	.data = &(struct clk_regmap_div_data){
141 		.offset = HHI_SYS_PLL_CNTL0,
142 		.shift = 16,
143 		.width = 3,
144 		.flags = CLK_DIVIDER_POWER_OF_TWO,
145 	},
146 	.hw.init = &(struct clk_init_data){
147 		.name = "sys_pll",
148 		.ops = &clk_regmap_divider_ops,
149 		.parent_hws = (const struct clk_hw *[]) {
150 			&g12a_sys_pll_dco.hw
151 		},
152 		.num_parents = 1,
153 		.flags = CLK_SET_RATE_PARENT,
154 	},
155 };
156 
157 static struct clk_regmap g12b_sys1_pll_dco = {
158 	.data = &(struct meson_clk_pll_data){
159 		.en = {
160 			.reg_off = HHI_SYS1_PLL_CNTL0,
161 			.shift   = 28,
162 			.width   = 1,
163 		},
164 		.m = {
165 			.reg_off = HHI_SYS1_PLL_CNTL0,
166 			.shift   = 0,
167 			.width   = 8,
168 		},
169 		.n = {
170 			.reg_off = HHI_SYS1_PLL_CNTL0,
171 			.shift   = 10,
172 			.width   = 5,
173 		},
174 		.l = {
175 			.reg_off = HHI_SYS1_PLL_CNTL0,
176 			.shift   = 31,
177 			.width   = 1,
178 		},
179 		.rst = {
180 			.reg_off = HHI_SYS1_PLL_CNTL0,
181 			.shift   = 29,
182 			.width   = 1,
183 		},
184 		.range = &g12a_sys_pll_mult_range,
185 	},
186 	.hw.init = &(struct clk_init_data){
187 		.name = "sys1_pll_dco",
188 		.ops = &meson_clk_pll_ops,
189 		.parent_data = &(const struct clk_parent_data) {
190 			.fw_name = "xtal",
191 		},
192 		.num_parents = 1,
193 		/* This clock feeds the CPU, avoid disabling it */
194 		.flags = CLK_IS_CRITICAL,
195 	},
196 };
197 
198 static struct clk_regmap g12b_sys1_pll = {
199 	.data = &(struct clk_regmap_div_data){
200 		.offset = HHI_SYS1_PLL_CNTL0,
201 		.shift = 16,
202 		.width = 3,
203 		.flags = CLK_DIVIDER_POWER_OF_TWO,
204 	},
205 	.hw.init = &(struct clk_init_data){
206 		.name = "sys1_pll",
207 		.ops = &clk_regmap_divider_ops,
208 		.parent_hws = (const struct clk_hw *[]) {
209 			&g12b_sys1_pll_dco.hw
210 		},
211 		.num_parents = 1,
212 		.flags = CLK_SET_RATE_PARENT,
213 	},
214 };
215 
216 static struct clk_regmap g12a_sys_pll_div16_en = {
217 	.data = &(struct clk_regmap_gate_data){
218 		.offset = HHI_SYS_CPU_CLK_CNTL1,
219 		.bit_idx = 24,
220 	},
221 	.hw.init = &(struct clk_init_data) {
222 		.name = "sys_pll_div16_en",
223 		.ops = &clk_regmap_gate_ro_ops,
224 		.parent_hws = (const struct clk_hw *[]) { &g12a_sys_pll.hw },
225 		.num_parents = 1,
226 		/*
227 		 * This clock is used to debug the sys_pll range
228 		 * Linux should not change it at runtime
229 		 */
230 	},
231 };
232 
233 static struct clk_regmap g12b_sys1_pll_div16_en = {
234 	.data = &(struct clk_regmap_gate_data){
235 		.offset = HHI_SYS_CPUB_CLK_CNTL1,
236 		.bit_idx = 24,
237 	},
238 	.hw.init = &(struct clk_init_data) {
239 		.name = "sys1_pll_div16_en",
240 		.ops = &clk_regmap_gate_ro_ops,
241 		.parent_hws = (const struct clk_hw *[]) {
242 			&g12b_sys1_pll.hw
243 		},
244 		.num_parents = 1,
245 		/*
246 		 * This clock is used to debug the sys_pll range
247 		 * Linux should not change it at runtime
248 		 */
249 	},
250 };
251 
252 static struct clk_fixed_factor g12a_sys_pll_div16 = {
253 	.mult = 1,
254 	.div = 16,
255 	.hw.init = &(struct clk_init_data){
256 		.name = "sys_pll_div16",
257 		.ops = &clk_fixed_factor_ops,
258 		.parent_hws = (const struct clk_hw *[]) {
259 			&g12a_sys_pll_div16_en.hw
260 		},
261 		.num_parents = 1,
262 	},
263 };
264 
265 static struct clk_fixed_factor g12b_sys1_pll_div16 = {
266 	.mult = 1,
267 	.div = 16,
268 	.hw.init = &(struct clk_init_data){
269 		.name = "sys1_pll_div16",
270 		.ops = &clk_fixed_factor_ops,
271 		.parent_hws = (const struct clk_hw *[]) {
272 			&g12b_sys1_pll_div16_en.hw
273 		},
274 		.num_parents = 1,
275 	},
276 };
277 
278 static struct clk_fixed_factor g12a_fclk_div2_div = {
279 	.mult = 1,
280 	.div = 2,
281 	.hw.init = &(struct clk_init_data){
282 		.name = "fclk_div2_div",
283 		.ops = &clk_fixed_factor_ops,
284 		.parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
285 		.num_parents = 1,
286 	},
287 };
288 
289 static struct clk_regmap g12a_fclk_div2 = {
290 	.data = &(struct clk_regmap_gate_data){
291 		.offset = HHI_FIX_PLL_CNTL1,
292 		.bit_idx = 24,
293 	},
294 	.hw.init = &(struct clk_init_data){
295 		.name = "fclk_div2",
296 		.ops = &clk_regmap_gate_ops,
297 		.parent_hws = (const struct clk_hw *[]) {
298 			&g12a_fclk_div2_div.hw
299 		},
300 		.num_parents = 1,
301 	},
302 };
303 
304 static struct clk_fixed_factor g12a_fclk_div3_div = {
305 	.mult = 1,
306 	.div = 3,
307 	.hw.init = &(struct clk_init_data){
308 		.name = "fclk_div3_div",
309 		.ops = &clk_fixed_factor_ops,
310 		.parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
311 		.num_parents = 1,
312 	},
313 };
314 
315 static struct clk_regmap g12a_fclk_div3 = {
316 	.data = &(struct clk_regmap_gate_data){
317 		.offset = HHI_FIX_PLL_CNTL1,
318 		.bit_idx = 20,
319 	},
320 	.hw.init = &(struct clk_init_data){
321 		.name = "fclk_div3",
322 		.ops = &clk_regmap_gate_ops,
323 		.parent_hws = (const struct clk_hw *[]) {
324 			&g12a_fclk_div3_div.hw
325 		},
326 		.num_parents = 1,
327 		/*
328 		 * This clock is used by the resident firmware and is required
329 		 * by the platform to operate correctly.
330 		 * Until the following condition are met, we need this clock to
331 		 * be marked as critical:
332 		 * a) Mark the clock used by a firmware resource, if possible
333 		 * b) CCF has a clock hand-off mechanism to make the sure the
334 		 *    clock stays on until the proper driver comes along
335 		 */
336 		.flags = CLK_IS_CRITICAL,
337 	},
338 };
339 
340 /* Datasheet names this field as "premux0" */
341 static struct clk_regmap g12a_cpu_clk_premux0 = {
342 	.data = &(struct clk_regmap_mux_data){
343 		.offset = HHI_SYS_CPU_CLK_CNTL0,
344 		.mask = 0x3,
345 		.shift = 0,
346 	},
347 	.hw.init = &(struct clk_init_data){
348 		.name = "cpu_clk_dyn0_sel",
349 		.ops = &clk_regmap_mux_ops,
350 		.parent_data = (const struct clk_parent_data []) {
351 			{ .fw_name = "xtal", },
352 			{ .hw = &g12a_fclk_div2.hw },
353 			{ .hw = &g12a_fclk_div3.hw },
354 		},
355 		.num_parents = 3,
356 		/* This sub-tree is used a parking clock */
357 		.flags = CLK_SET_RATE_NO_REPARENT,
358 	},
359 };
360 
361 /* Datasheet names this field as "premux1" */
362 static struct clk_regmap g12a_cpu_clk_premux1 = {
363 	.data = &(struct clk_regmap_mux_data){
364 		.offset = HHI_SYS_CPU_CLK_CNTL0,
365 		.mask = 0x3,
366 		.shift = 16,
367 	},
368 	.hw.init = &(struct clk_init_data){
369 		.name = "cpu_clk_dyn1_sel",
370 		.ops = &clk_regmap_mux_ops,
371 		.parent_data = (const struct clk_parent_data []) {
372 			{ .fw_name = "xtal", },
373 			{ .hw = &g12a_fclk_div2.hw },
374 			{ .hw = &g12a_fclk_div3.hw },
375 		},
376 		.num_parents = 3,
377 		/* This sub-tree is used a parking clock */
378 		.flags = CLK_SET_RATE_NO_REPARENT
379 	},
380 };
381 
382 /* Datasheet names this field as "mux0_divn_tcnt" */
383 static struct clk_regmap g12a_cpu_clk_mux0_div = {
384 	.data = &(struct meson_clk_cpu_dyndiv_data){
385 		.div = {
386 			.reg_off = HHI_SYS_CPU_CLK_CNTL0,
387 			.shift = 4,
388 			.width = 6,
389 		},
390 		.dyn = {
391 			.reg_off = HHI_SYS_CPU_CLK_CNTL0,
392 			.shift = 26,
393 			.width = 1,
394 		},
395 	},
396 	.hw.init = &(struct clk_init_data){
397 		.name = "cpu_clk_dyn0_div",
398 		.ops = &meson_clk_cpu_dyndiv_ops,
399 		.parent_hws = (const struct clk_hw *[]) {
400 			&g12a_cpu_clk_premux0.hw
401 		},
402 		.num_parents = 1,
403 		.flags = CLK_SET_RATE_PARENT,
404 	},
405 };
406 
407 /* Datasheet names this field as "postmux0" */
408 static struct clk_regmap g12a_cpu_clk_postmux0 = {
409 	.data = &(struct clk_regmap_mux_data){
410 		.offset = HHI_SYS_CPU_CLK_CNTL0,
411 		.mask = 0x1,
412 		.shift = 2,
413 	},
414 	.hw.init = &(struct clk_init_data){
415 		.name = "cpu_clk_dyn0",
416 		.ops = &clk_regmap_mux_ops,
417 		.parent_hws = (const struct clk_hw *[]) {
418 			&g12a_cpu_clk_premux0.hw,
419 			&g12a_cpu_clk_mux0_div.hw,
420 		},
421 		.num_parents = 2,
422 		.flags = CLK_SET_RATE_PARENT,
423 	},
424 };
425 
426 /* Datasheet names this field as "Mux1_divn_tcnt" */
427 static struct clk_regmap g12a_cpu_clk_mux1_div = {
428 	.data = &(struct clk_regmap_div_data){
429 		.offset = HHI_SYS_CPU_CLK_CNTL0,
430 		.shift = 20,
431 		.width = 6,
432 	},
433 	.hw.init = &(struct clk_init_data){
434 		.name = "cpu_clk_dyn1_div",
435 		.ops = &clk_regmap_divider_ro_ops,
436 		.parent_hws = (const struct clk_hw *[]) {
437 			&g12a_cpu_clk_premux1.hw
438 		},
439 		.num_parents = 1,
440 	},
441 };
442 
443 /* Datasheet names this field as "postmux1" */
444 static struct clk_regmap g12a_cpu_clk_postmux1 = {
445 	.data = &(struct clk_regmap_mux_data){
446 		.offset = HHI_SYS_CPU_CLK_CNTL0,
447 		.mask = 0x1,
448 		.shift = 18,
449 	},
450 	.hw.init = &(struct clk_init_data){
451 		.name = "cpu_clk_dyn1",
452 		.ops = &clk_regmap_mux_ops,
453 		.parent_hws = (const struct clk_hw *[]) {
454 			&g12a_cpu_clk_premux1.hw,
455 			&g12a_cpu_clk_mux1_div.hw,
456 		},
457 		.num_parents = 2,
458 		/* This sub-tree is used a parking clock */
459 		.flags = CLK_SET_RATE_NO_REPARENT,
460 	},
461 };
462 
463 /* Datasheet names this field as "Final_dyn_mux_sel" */
464 static struct clk_regmap g12a_cpu_clk_dyn = {
465 	.data = &(struct clk_regmap_mux_data){
466 		.offset = HHI_SYS_CPU_CLK_CNTL0,
467 		.mask = 0x1,
468 		.shift = 10,
469 	},
470 	.hw.init = &(struct clk_init_data){
471 		.name = "cpu_clk_dyn",
472 		.ops = &clk_regmap_mux_ops,
473 		.parent_hws = (const struct clk_hw *[]) {
474 			&g12a_cpu_clk_postmux0.hw,
475 			&g12a_cpu_clk_postmux1.hw,
476 		},
477 		.num_parents = 2,
478 		.flags = CLK_SET_RATE_PARENT,
479 	},
480 };
481 
482 /* Datasheet names this field as "Final_mux_sel" */
483 static struct clk_regmap g12a_cpu_clk = {
484 	.data = &(struct clk_regmap_mux_data){
485 		.offset = HHI_SYS_CPU_CLK_CNTL0,
486 		.mask = 0x1,
487 		.shift = 11,
488 	},
489 	.hw.init = &(struct clk_init_data){
490 		.name = "cpu_clk",
491 		.ops = &clk_regmap_mux_ops,
492 		.parent_hws = (const struct clk_hw *[]) {
493 			&g12a_cpu_clk_dyn.hw,
494 			&g12a_sys_pll.hw,
495 		},
496 		.num_parents = 2,
497 		.flags = CLK_SET_RATE_PARENT,
498 	},
499 };
500 
501 /* Datasheet names this field as "Final_mux_sel" */
502 static struct clk_regmap g12b_cpu_clk = {
503 	.data = &(struct clk_regmap_mux_data){
504 		.offset = HHI_SYS_CPU_CLK_CNTL0,
505 		.mask = 0x1,
506 		.shift = 11,
507 	},
508 	.hw.init = &(struct clk_init_data){
509 		.name = "cpu_clk",
510 		.ops = &clk_regmap_mux_ops,
511 		.parent_hws = (const struct clk_hw *[]) {
512 			&g12a_cpu_clk_dyn.hw,
513 			&g12b_sys1_pll.hw
514 		},
515 		.num_parents = 2,
516 		.flags = CLK_SET_RATE_PARENT,
517 	},
518 };
519 
520 /* Datasheet names this field as "premux0" */
521 static struct clk_regmap g12b_cpub_clk_premux0 = {
522 	.data = &(struct clk_regmap_mux_data){
523 		.offset = HHI_SYS_CPUB_CLK_CNTL,
524 		.mask = 0x3,
525 		.shift = 0,
526 	},
527 	.hw.init = &(struct clk_init_data){
528 		.name = "cpub_clk_dyn0_sel",
529 		.ops = &clk_regmap_mux_ops,
530 		.parent_data = (const struct clk_parent_data []) {
531 			{ .fw_name = "xtal", },
532 			{ .hw = &g12a_fclk_div2.hw },
533 			{ .hw = &g12a_fclk_div3.hw },
534 		},
535 		.num_parents = 3,
536 	},
537 };
538 
539 /* Datasheet names this field as "mux0_divn_tcnt" */
540 static struct clk_regmap g12b_cpub_clk_mux0_div = {
541 	.data = &(struct meson_clk_cpu_dyndiv_data){
542 		.div = {
543 			.reg_off = HHI_SYS_CPUB_CLK_CNTL,
544 			.shift = 4,
545 			.width = 6,
546 		},
547 		.dyn = {
548 			.reg_off = HHI_SYS_CPUB_CLK_CNTL,
549 			.shift = 26,
550 			.width = 1,
551 		},
552 	},
553 	.hw.init = &(struct clk_init_data){
554 		.name = "cpub_clk_dyn0_div",
555 		.ops = &meson_clk_cpu_dyndiv_ops,
556 		.parent_hws = (const struct clk_hw *[]) {
557 			&g12b_cpub_clk_premux0.hw
558 		},
559 		.num_parents = 1,
560 		.flags = CLK_SET_RATE_PARENT,
561 	},
562 };
563 
564 /* Datasheet names this field as "postmux0" */
565 static struct clk_regmap g12b_cpub_clk_postmux0 = {
566 	.data = &(struct clk_regmap_mux_data){
567 		.offset = HHI_SYS_CPUB_CLK_CNTL,
568 		.mask = 0x1,
569 		.shift = 2,
570 	},
571 	.hw.init = &(struct clk_init_data){
572 		.name = "cpub_clk_dyn0",
573 		.ops = &clk_regmap_mux_ops,
574 		.parent_hws = (const struct clk_hw *[]) {
575 			&g12b_cpub_clk_premux0.hw,
576 			&g12b_cpub_clk_mux0_div.hw
577 		},
578 		.num_parents = 2,
579 		.flags = CLK_SET_RATE_PARENT,
580 	},
581 };
582 
583 /* Datasheet names this field as "premux1" */
584 static struct clk_regmap g12b_cpub_clk_premux1 = {
585 	.data = &(struct clk_regmap_mux_data){
586 		.offset = HHI_SYS_CPUB_CLK_CNTL,
587 		.mask = 0x3,
588 		.shift = 16,
589 	},
590 	.hw.init = &(struct clk_init_data){
591 		.name = "cpub_clk_dyn1_sel",
592 		.ops = &clk_regmap_mux_ops,
593 		.parent_data = (const struct clk_parent_data []) {
594 			{ .fw_name = "xtal", },
595 			{ .hw = &g12a_fclk_div2.hw },
596 			{ .hw = &g12a_fclk_div3.hw },
597 		},
598 		.num_parents = 3,
599 		/* This sub-tree is used a parking clock */
600 		.flags = CLK_SET_RATE_NO_REPARENT,
601 	},
602 };
603 
604 /* Datasheet names this field as "Mux1_divn_tcnt" */
605 static struct clk_regmap g12b_cpub_clk_mux1_div = {
606 	.data = &(struct clk_regmap_div_data){
607 		.offset = HHI_SYS_CPUB_CLK_CNTL,
608 		.shift = 20,
609 		.width = 6,
610 	},
611 	.hw.init = &(struct clk_init_data){
612 		.name = "cpub_clk_dyn1_div",
613 		.ops = &clk_regmap_divider_ro_ops,
614 		.parent_hws = (const struct clk_hw *[]) {
615 			&g12b_cpub_clk_premux1.hw
616 		},
617 		.num_parents = 1,
618 	},
619 };
620 
621 /* Datasheet names this field as "postmux1" */
622 static struct clk_regmap g12b_cpub_clk_postmux1 = {
623 	.data = &(struct clk_regmap_mux_data){
624 		.offset = HHI_SYS_CPUB_CLK_CNTL,
625 		.mask = 0x1,
626 		.shift = 18,
627 	},
628 	.hw.init = &(struct clk_init_data){
629 		.name = "cpub_clk_dyn1",
630 		.ops = &clk_regmap_mux_ops,
631 		.parent_hws = (const struct clk_hw *[]) {
632 			&g12b_cpub_clk_premux1.hw,
633 			&g12b_cpub_clk_mux1_div.hw
634 		},
635 		.num_parents = 2,
636 		/* This sub-tree is used a parking clock */
637 		.flags = CLK_SET_RATE_NO_REPARENT,
638 	},
639 };
640 
641 /* Datasheet names this field as "Final_dyn_mux_sel" */
642 static struct clk_regmap g12b_cpub_clk_dyn = {
643 	.data = &(struct clk_regmap_mux_data){
644 		.offset = HHI_SYS_CPUB_CLK_CNTL,
645 		.mask = 0x1,
646 		.shift = 10,
647 	},
648 	.hw.init = &(struct clk_init_data){
649 		.name = "cpub_clk_dyn",
650 		.ops = &clk_regmap_mux_ops,
651 		.parent_hws = (const struct clk_hw *[]) {
652 			&g12b_cpub_clk_postmux0.hw,
653 			&g12b_cpub_clk_postmux1.hw
654 		},
655 		.num_parents = 2,
656 		.flags = CLK_SET_RATE_PARENT,
657 	},
658 };
659 
660 /* Datasheet names this field as "Final_mux_sel" */
661 static struct clk_regmap g12b_cpub_clk = {
662 	.data = &(struct clk_regmap_mux_data){
663 		.offset = HHI_SYS_CPUB_CLK_CNTL,
664 		.mask = 0x1,
665 		.shift = 11,
666 	},
667 	.hw.init = &(struct clk_init_data){
668 		.name = "cpub_clk",
669 		.ops = &clk_regmap_mux_ops,
670 		.parent_hws = (const struct clk_hw *[]) {
671 			&g12b_cpub_clk_dyn.hw,
672 			&g12a_sys_pll.hw
673 		},
674 		.num_parents = 2,
675 		.flags = CLK_SET_RATE_PARENT,
676 	},
677 };
678 
679 static struct clk_regmap sm1_gp1_pll;
680 
681 /* Datasheet names this field as "premux0" */
682 static struct clk_regmap sm1_dsu_clk_premux0 = {
683 	.data = &(struct clk_regmap_mux_data){
684 		.offset = HHI_SYS_CPU_CLK_CNTL5,
685 		.mask = 0x3,
686 		.shift = 0,
687 	},
688 	.hw.init = &(struct clk_init_data){
689 		.name = "dsu_clk_dyn0_sel",
690 		.ops = &clk_regmap_mux_ro_ops,
691 		.parent_data = (const struct clk_parent_data []) {
692 			{ .fw_name = "xtal", },
693 			{ .hw = &g12a_fclk_div2.hw },
694 			{ .hw = &g12a_fclk_div3.hw },
695 			{ .hw = &sm1_gp1_pll.hw },
696 		},
697 		.num_parents = 4,
698 	},
699 };
700 
701 /* Datasheet names this field as "premux1" */
702 static struct clk_regmap sm1_dsu_clk_premux1 = {
703 	.data = &(struct clk_regmap_mux_data){
704 		.offset = HHI_SYS_CPU_CLK_CNTL5,
705 		.mask = 0x3,
706 		.shift = 16,
707 	},
708 	.hw.init = &(struct clk_init_data){
709 		.name = "dsu_clk_dyn1_sel",
710 		.ops = &clk_regmap_mux_ro_ops,
711 		.parent_data = (const struct clk_parent_data []) {
712 			{ .fw_name = "xtal", },
713 			{ .hw = &g12a_fclk_div2.hw },
714 			{ .hw = &g12a_fclk_div3.hw },
715 			{ .hw = &sm1_gp1_pll.hw },
716 		},
717 		.num_parents = 4,
718 	},
719 };
720 
721 /* Datasheet names this field as "Mux0_divn_tcnt" */
722 static struct clk_regmap sm1_dsu_clk_mux0_div = {
723 	.data = &(struct clk_regmap_div_data){
724 		.offset = HHI_SYS_CPU_CLK_CNTL5,
725 		.shift = 4,
726 		.width = 6,
727 	},
728 	.hw.init = &(struct clk_init_data){
729 		.name = "dsu_clk_dyn0_div",
730 		.ops = &clk_regmap_divider_ro_ops,
731 		.parent_hws = (const struct clk_hw *[]) {
732 			&sm1_dsu_clk_premux0.hw
733 		},
734 		.num_parents = 1,
735 	},
736 };
737 
738 /* Datasheet names this field as "postmux0" */
739 static struct clk_regmap sm1_dsu_clk_postmux0 = {
740 	.data = &(struct clk_regmap_mux_data){
741 		.offset = HHI_SYS_CPU_CLK_CNTL5,
742 		.mask = 0x1,
743 		.shift = 2,
744 	},
745 	.hw.init = &(struct clk_init_data){
746 		.name = "dsu_clk_dyn0",
747 		.ops = &clk_regmap_mux_ro_ops,
748 		.parent_hws = (const struct clk_hw *[]) {
749 			&sm1_dsu_clk_premux0.hw,
750 			&sm1_dsu_clk_mux0_div.hw,
751 		},
752 		.num_parents = 2,
753 	},
754 };
755 
756 /* Datasheet names this field as "Mux1_divn_tcnt" */
757 static struct clk_regmap sm1_dsu_clk_mux1_div = {
758 	.data = &(struct clk_regmap_div_data){
759 		.offset = HHI_SYS_CPU_CLK_CNTL5,
760 		.shift = 20,
761 		.width = 6,
762 	},
763 	.hw.init = &(struct clk_init_data){
764 		.name = "dsu_clk_dyn1_div",
765 		.ops = &clk_regmap_divider_ro_ops,
766 		.parent_hws = (const struct clk_hw *[]) {
767 			&sm1_dsu_clk_premux1.hw
768 		},
769 		.num_parents = 1,
770 	},
771 };
772 
773 /* Datasheet names this field as "postmux1" */
774 static struct clk_regmap sm1_dsu_clk_postmux1 = {
775 	.data = &(struct clk_regmap_mux_data){
776 		.offset = HHI_SYS_CPU_CLK_CNTL5,
777 		.mask = 0x1,
778 		.shift = 18,
779 	},
780 	.hw.init = &(struct clk_init_data){
781 		.name = "dsu_clk_dyn1",
782 		.ops = &clk_regmap_mux_ro_ops,
783 		.parent_hws = (const struct clk_hw *[]) {
784 			&sm1_dsu_clk_premux1.hw,
785 			&sm1_dsu_clk_mux1_div.hw,
786 		},
787 		.num_parents = 2,
788 	},
789 };
790 
791 /* Datasheet names this field as "Final_dyn_mux_sel" */
792 static struct clk_regmap sm1_dsu_clk_dyn = {
793 	.data = &(struct clk_regmap_mux_data){
794 		.offset = HHI_SYS_CPU_CLK_CNTL5,
795 		.mask = 0x1,
796 		.shift = 10,
797 	},
798 	.hw.init = &(struct clk_init_data){
799 		.name = "dsu_clk_dyn",
800 		.ops = &clk_regmap_mux_ro_ops,
801 		.parent_hws = (const struct clk_hw *[]) {
802 			&sm1_dsu_clk_postmux0.hw,
803 			&sm1_dsu_clk_postmux1.hw,
804 		},
805 		.num_parents = 2,
806 	},
807 };
808 
809 /* Datasheet names this field as "Final_mux_sel" */
810 static struct clk_regmap sm1_dsu_final_clk = {
811 	.data = &(struct clk_regmap_mux_data){
812 		.offset = HHI_SYS_CPU_CLK_CNTL5,
813 		.mask = 0x1,
814 		.shift = 11,
815 	},
816 	.hw.init = &(struct clk_init_data){
817 		.name = "dsu_clk_final",
818 		.ops = &clk_regmap_mux_ro_ops,
819 		.parent_hws = (const struct clk_hw *[]) {
820 			&sm1_dsu_clk_dyn.hw,
821 			&g12a_sys_pll.hw,
822 		},
823 		.num_parents = 2,
824 	},
825 };
826 
827 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 0 */
828 static struct clk_regmap sm1_cpu1_clk = {
829 	.data = &(struct clk_regmap_mux_data){
830 		.offset = HHI_SYS_CPU_CLK_CNTL6,
831 		.mask = 0x1,
832 		.shift = 24,
833 	},
834 	.hw.init = &(struct clk_init_data){
835 		.name = "cpu1_clk",
836 		.ops = &clk_regmap_mux_ro_ops,
837 		.parent_hws = (const struct clk_hw *[]) {
838 			&g12a_cpu_clk.hw,
839 			/* This CPU also have a dedicated clock tree */
840 		},
841 		.num_parents = 1,
842 	},
843 };
844 
845 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 1 */
846 static struct clk_regmap sm1_cpu2_clk = {
847 	.data = &(struct clk_regmap_mux_data){
848 		.offset = HHI_SYS_CPU_CLK_CNTL6,
849 		.mask = 0x1,
850 		.shift = 25,
851 	},
852 	.hw.init = &(struct clk_init_data){
853 		.name = "cpu2_clk",
854 		.ops = &clk_regmap_mux_ro_ops,
855 		.parent_hws = (const struct clk_hw *[]) {
856 			&g12a_cpu_clk.hw,
857 			/* This CPU also have a dedicated clock tree */
858 		},
859 		.num_parents = 1,
860 	},
861 };
862 
863 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 2 */
864 static struct clk_regmap sm1_cpu3_clk = {
865 	.data = &(struct clk_regmap_mux_data){
866 		.offset = HHI_SYS_CPU_CLK_CNTL6,
867 		.mask = 0x1,
868 		.shift = 26,
869 	},
870 	.hw.init = &(struct clk_init_data){
871 		.name = "cpu3_clk",
872 		.ops = &clk_regmap_mux_ro_ops,
873 		.parent_hws = (const struct clk_hw *[]) {
874 			&g12a_cpu_clk.hw,
875 			/* This CPU also have a dedicated clock tree */
876 		},
877 		.num_parents = 1,
878 	},
879 };
880 
881 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 4 */
882 static struct clk_regmap sm1_dsu_clk = {
883 	.data = &(struct clk_regmap_mux_data){
884 		.offset = HHI_SYS_CPU_CLK_CNTL6,
885 		.mask = 0x1,
886 		.shift = 27,
887 	},
888 	.hw.init = &(struct clk_init_data){
889 		.name = "dsu_clk",
890 		.ops = &clk_regmap_mux_ro_ops,
891 		.parent_hws = (const struct clk_hw *[]) {
892 			&g12a_cpu_clk.hw,
893 			&sm1_dsu_final_clk.hw,
894 		},
895 		.num_parents = 2,
896 	},
897 };
898 
899 static int g12a_cpu_clk_mux_notifier_cb(struct notifier_block *nb,
900 					unsigned long event, void *data)
901 {
902 	if (event == POST_RATE_CHANGE || event == PRE_RATE_CHANGE) {
903 		/* Wait for clock propagation before/after changing the mux */
904 		udelay(100);
905 		return NOTIFY_OK;
906 	}
907 
908 	return NOTIFY_DONE;
909 }
910 
911 static struct notifier_block g12a_cpu_clk_mux_nb = {
912 	.notifier_call = g12a_cpu_clk_mux_notifier_cb,
913 };
914 
915 struct g12a_cpu_clk_postmux_nb_data {
916 	struct notifier_block nb;
917 	struct clk_hw *xtal;
918 	struct clk_hw *cpu_clk_dyn;
919 	struct clk_hw *cpu_clk_postmux0;
920 	struct clk_hw *cpu_clk_postmux1;
921 	struct clk_hw *cpu_clk_premux1;
922 };
923 
924 static int g12a_cpu_clk_postmux_notifier_cb(struct notifier_block *nb,
925 					    unsigned long event, void *data)
926 {
927 	struct g12a_cpu_clk_postmux_nb_data *nb_data =
928 		container_of(nb, struct g12a_cpu_clk_postmux_nb_data, nb);
929 
930 	switch (event) {
931 	case PRE_RATE_CHANGE:
932 		/*
933 		 * This notifier means cpu_clk_postmux0 clock will be changed
934 		 * to feed cpu_clk, this is the current path :
935 		 * cpu_clk
936 		 *    \- cpu_clk_dyn
937 		 *          \- cpu_clk_postmux0
938 		 *                \- cpu_clk_muxX_div
939 		 *                      \- cpu_clk_premux0
940 		 *				\- fclk_div3 or fclk_div2
941 		 *		OR
942 		 *                \- cpu_clk_premux0
943 		 *			\- fclk_div3 or fclk_div2
944 		 */
945 
946 		/* Setup cpu_clk_premux1 to xtal */
947 		clk_hw_set_parent(nb_data->cpu_clk_premux1,
948 				  nb_data->xtal);
949 
950 		/* Setup cpu_clk_postmux1 to bypass divider */
951 		clk_hw_set_parent(nb_data->cpu_clk_postmux1,
952 				  nb_data->cpu_clk_premux1);
953 
954 		/* Switch to parking clk on cpu_clk_postmux1 */
955 		clk_hw_set_parent(nb_data->cpu_clk_dyn,
956 				  nb_data->cpu_clk_postmux1);
957 
958 		/*
959 		 * Now, cpu_clk is 24MHz in the current path :
960 		 * cpu_clk
961 		 *    \- cpu_clk_dyn
962 		 *          \- cpu_clk_postmux1
963 		 *                \- cpu_clk_premux1
964 		 *                      \- xtal
965 		 */
966 
967 		udelay(100);
968 
969 		return NOTIFY_OK;
970 
971 	case POST_RATE_CHANGE:
972 		/*
973 		 * The cpu_clk_postmux0 has ben updated, now switch back
974 		 * cpu_clk_dyn to cpu_clk_postmux0 and take the changes
975 		 * in account.
976 		 */
977 
978 		/* Configure cpu_clk_dyn back to cpu_clk_postmux0 */
979 		clk_hw_set_parent(nb_data->cpu_clk_dyn,
980 				  nb_data->cpu_clk_postmux0);
981 
982 		/*
983 		 * new path :
984 		 * cpu_clk
985 		 *    \- cpu_clk_dyn
986 		 *          \- cpu_clk_postmux0
987 		 *                \- cpu_clk_muxX_div
988 		 *                      \- cpu_clk_premux0
989 		 *				\- fclk_div3 or fclk_div2
990 		 *		OR
991 		 *                \- cpu_clk_premux0
992 		 *			\- fclk_div3 or fclk_div2
993 		 */
994 
995 		udelay(100);
996 
997 		return NOTIFY_OK;
998 
999 	default:
1000 		return NOTIFY_DONE;
1001 	}
1002 }
1003 
1004 static struct g12a_cpu_clk_postmux_nb_data g12a_cpu_clk_postmux0_nb_data = {
1005 	.cpu_clk_dyn = &g12a_cpu_clk_dyn.hw,
1006 	.cpu_clk_postmux0 = &g12a_cpu_clk_postmux0.hw,
1007 	.cpu_clk_postmux1 = &g12a_cpu_clk_postmux1.hw,
1008 	.cpu_clk_premux1 = &g12a_cpu_clk_premux1.hw,
1009 	.nb.notifier_call = g12a_cpu_clk_postmux_notifier_cb,
1010 };
1011 
1012 static struct g12a_cpu_clk_postmux_nb_data g12b_cpub_clk_postmux0_nb_data = {
1013 	.cpu_clk_dyn = &g12b_cpub_clk_dyn.hw,
1014 	.cpu_clk_postmux0 = &g12b_cpub_clk_postmux0.hw,
1015 	.cpu_clk_postmux1 = &g12b_cpub_clk_postmux1.hw,
1016 	.cpu_clk_premux1 = &g12b_cpub_clk_premux1.hw,
1017 	.nb.notifier_call = g12a_cpu_clk_postmux_notifier_cb,
1018 };
1019 
1020 struct g12a_sys_pll_nb_data {
1021 	struct notifier_block nb;
1022 	struct clk_hw *sys_pll;
1023 	struct clk_hw *cpu_clk;
1024 	struct clk_hw *cpu_clk_dyn;
1025 };
1026 
1027 static int g12a_sys_pll_notifier_cb(struct notifier_block *nb,
1028 				    unsigned long event, void *data)
1029 {
1030 	struct g12a_sys_pll_nb_data *nb_data =
1031 		container_of(nb, struct g12a_sys_pll_nb_data, nb);
1032 
1033 	switch (event) {
1034 	case PRE_RATE_CHANGE:
1035 		/*
1036 		 * This notifier means sys_pll clock will be changed
1037 		 * to feed cpu_clk, this the current path :
1038 		 * cpu_clk
1039 		 *    \- sys_pll
1040 		 *          \- sys_pll_dco
1041 		 */
1042 
1043 		/* Configure cpu_clk to use cpu_clk_dyn */
1044 		clk_hw_set_parent(nb_data->cpu_clk,
1045 				  nb_data->cpu_clk_dyn);
1046 
1047 		/*
1048 		 * Now, cpu_clk uses the dyn path
1049 		 * cpu_clk
1050 		 *    \- cpu_clk_dyn
1051 		 *          \- cpu_clk_dynX
1052 		 *                \- cpu_clk_dynX_sel
1053 		 *		     \- cpu_clk_dynX_div
1054 		 *                      \- xtal/fclk_div2/fclk_div3
1055 		 *                   \- xtal/fclk_div2/fclk_div3
1056 		 */
1057 
1058 		udelay(100);
1059 
1060 		return NOTIFY_OK;
1061 
1062 	case POST_RATE_CHANGE:
1063 		/*
1064 		 * The sys_pll has ben updated, now switch back cpu_clk to
1065 		 * sys_pll
1066 		 */
1067 
1068 		/* Configure cpu_clk to use sys_pll */
1069 		clk_hw_set_parent(nb_data->cpu_clk,
1070 				  nb_data->sys_pll);
1071 
1072 		udelay(100);
1073 
1074 		/* new path :
1075 		 * cpu_clk
1076 		 *    \- sys_pll
1077 		 *          \- sys_pll_dco
1078 		 */
1079 
1080 		return NOTIFY_OK;
1081 
1082 	default:
1083 		return NOTIFY_DONE;
1084 	}
1085 }
1086 
1087 static struct g12a_sys_pll_nb_data g12a_sys_pll_nb_data = {
1088 	.sys_pll = &g12a_sys_pll.hw,
1089 	.cpu_clk = &g12a_cpu_clk.hw,
1090 	.cpu_clk_dyn = &g12a_cpu_clk_dyn.hw,
1091 	.nb.notifier_call = g12a_sys_pll_notifier_cb,
1092 };
1093 
1094 /* G12B first CPU cluster uses sys1_pll */
1095 static struct g12a_sys_pll_nb_data g12b_cpu_clk_sys1_pll_nb_data = {
1096 	.sys_pll = &g12b_sys1_pll.hw,
1097 	.cpu_clk = &g12b_cpu_clk.hw,
1098 	.cpu_clk_dyn = &g12a_cpu_clk_dyn.hw,
1099 	.nb.notifier_call = g12a_sys_pll_notifier_cb,
1100 };
1101 
1102 /* G12B second CPU cluster uses sys_pll */
1103 static struct g12a_sys_pll_nb_data g12b_cpub_clk_sys_pll_nb_data = {
1104 	.sys_pll = &g12a_sys_pll.hw,
1105 	.cpu_clk = &g12b_cpub_clk.hw,
1106 	.cpu_clk_dyn = &g12b_cpub_clk_dyn.hw,
1107 	.nb.notifier_call = g12a_sys_pll_notifier_cb,
1108 };
1109 
1110 static struct clk_regmap g12a_cpu_clk_div16_en = {
1111 	.data = &(struct clk_regmap_gate_data){
1112 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1113 		.bit_idx = 1,
1114 	},
1115 	.hw.init = &(struct clk_init_data) {
1116 		.name = "cpu_clk_div16_en",
1117 		.ops = &clk_regmap_gate_ro_ops,
1118 		.parent_hws = (const struct clk_hw *[]) {
1119 			&g12a_cpu_clk.hw
1120 		},
1121 		.num_parents = 1,
1122 		/*
1123 		 * This clock is used to debug the cpu_clk range
1124 		 * Linux should not change it at runtime
1125 		 */
1126 	},
1127 };
1128 
1129 static struct clk_regmap g12b_cpub_clk_div16_en = {
1130 	.data = &(struct clk_regmap_gate_data){
1131 		.offset = HHI_SYS_CPUB_CLK_CNTL1,
1132 		.bit_idx = 1,
1133 	},
1134 	.hw.init = &(struct clk_init_data) {
1135 		.name = "cpub_clk_div16_en",
1136 		.ops = &clk_regmap_gate_ro_ops,
1137 		.parent_hws = (const struct clk_hw *[]) {
1138 			&g12b_cpub_clk.hw
1139 		},
1140 		.num_parents = 1,
1141 		/*
1142 		 * This clock is used to debug the cpu_clk range
1143 		 * Linux should not change it at runtime
1144 		 */
1145 	},
1146 };
1147 
1148 static struct clk_fixed_factor g12a_cpu_clk_div16 = {
1149 	.mult = 1,
1150 	.div = 16,
1151 	.hw.init = &(struct clk_init_data){
1152 		.name = "cpu_clk_div16",
1153 		.ops = &clk_fixed_factor_ops,
1154 		.parent_hws = (const struct clk_hw *[]) {
1155 			&g12a_cpu_clk_div16_en.hw
1156 		},
1157 		.num_parents = 1,
1158 	},
1159 };
1160 
1161 static struct clk_fixed_factor g12b_cpub_clk_div16 = {
1162 	.mult = 1,
1163 	.div = 16,
1164 	.hw.init = &(struct clk_init_data){
1165 		.name = "cpub_clk_div16",
1166 		.ops = &clk_fixed_factor_ops,
1167 		.parent_hws = (const struct clk_hw *[]) {
1168 			&g12b_cpub_clk_div16_en.hw
1169 		},
1170 		.num_parents = 1,
1171 	},
1172 };
1173 
1174 static struct clk_regmap g12a_cpu_clk_apb_div = {
1175 	.data = &(struct clk_regmap_div_data){
1176 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1177 		.shift = 3,
1178 		.width = 3,
1179 		.flags = CLK_DIVIDER_POWER_OF_TWO,
1180 	},
1181 	.hw.init = &(struct clk_init_data){
1182 		.name = "cpu_clk_apb_div",
1183 		.ops = &clk_regmap_divider_ro_ops,
1184 		.parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw },
1185 		.num_parents = 1,
1186 	},
1187 };
1188 
1189 static struct clk_regmap g12a_cpu_clk_apb = {
1190 	.data = &(struct clk_regmap_gate_data){
1191 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1192 		.bit_idx = 1,
1193 	},
1194 	.hw.init = &(struct clk_init_data) {
1195 		.name = "cpu_clk_apb",
1196 		.ops = &clk_regmap_gate_ro_ops,
1197 		.parent_hws = (const struct clk_hw *[]) {
1198 			&g12a_cpu_clk_apb_div.hw
1199 		},
1200 		.num_parents = 1,
1201 		/*
1202 		 * This clock is set by the ROM monitor code,
1203 		 * Linux should not change it at runtime
1204 		 */
1205 	},
1206 };
1207 
1208 static struct clk_regmap g12a_cpu_clk_atb_div = {
1209 	.data = &(struct clk_regmap_div_data){
1210 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1211 		.shift = 6,
1212 		.width = 3,
1213 		.flags = CLK_DIVIDER_POWER_OF_TWO,
1214 	},
1215 	.hw.init = &(struct clk_init_data){
1216 		.name = "cpu_clk_atb_div",
1217 		.ops = &clk_regmap_divider_ro_ops,
1218 		.parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw },
1219 		.num_parents = 1,
1220 	},
1221 };
1222 
1223 static struct clk_regmap g12a_cpu_clk_atb = {
1224 	.data = &(struct clk_regmap_gate_data){
1225 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1226 		.bit_idx = 17,
1227 	},
1228 	.hw.init = &(struct clk_init_data) {
1229 		.name = "cpu_clk_atb",
1230 		.ops = &clk_regmap_gate_ro_ops,
1231 		.parent_hws = (const struct clk_hw *[]) {
1232 			&g12a_cpu_clk_atb_div.hw
1233 		},
1234 		.num_parents = 1,
1235 		/*
1236 		 * This clock is set by the ROM monitor code,
1237 		 * Linux should not change it at runtime
1238 		 */
1239 	},
1240 };
1241 
1242 static struct clk_regmap g12a_cpu_clk_axi_div = {
1243 	.data = &(struct clk_regmap_div_data){
1244 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1245 		.shift = 9,
1246 		.width = 3,
1247 		.flags = CLK_DIVIDER_POWER_OF_TWO,
1248 	},
1249 	.hw.init = &(struct clk_init_data){
1250 		.name = "cpu_clk_axi_div",
1251 		.ops = &clk_regmap_divider_ro_ops,
1252 		.parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw },
1253 		.num_parents = 1,
1254 	},
1255 };
1256 
1257 static struct clk_regmap g12a_cpu_clk_axi = {
1258 	.data = &(struct clk_regmap_gate_data){
1259 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1260 		.bit_idx = 18,
1261 	},
1262 	.hw.init = &(struct clk_init_data) {
1263 		.name = "cpu_clk_axi",
1264 		.ops = &clk_regmap_gate_ro_ops,
1265 		.parent_hws = (const struct clk_hw *[]) {
1266 			&g12a_cpu_clk_axi_div.hw
1267 		},
1268 		.num_parents = 1,
1269 		/*
1270 		 * This clock is set by the ROM monitor code,
1271 		 * Linux should not change it at runtime
1272 		 */
1273 	},
1274 };
1275 
1276 static struct clk_regmap g12a_cpu_clk_trace_div = {
1277 	.data = &(struct clk_regmap_div_data){
1278 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1279 		.shift = 20,
1280 		.width = 3,
1281 		.flags = CLK_DIVIDER_POWER_OF_TWO,
1282 	},
1283 	.hw.init = &(struct clk_init_data){
1284 		.name = "cpu_clk_trace_div",
1285 		.ops = &clk_regmap_divider_ro_ops,
1286 		.parent_data = &(const struct clk_parent_data) {
1287 			/*
1288 			 * Note:
1289 			 * G12A and G12B have different cpu_clks (with
1290 			 * different struct clk_hw). We fallback to the global
1291 			 * naming string mechanism so cpu_clk_trace_div picks
1292 			 * up the appropriate one.
1293 			 */
1294 			.name = "cpu_clk",
1295 			.index = -1,
1296 		},
1297 		.num_parents = 1,
1298 	},
1299 };
1300 
1301 static struct clk_regmap g12a_cpu_clk_trace = {
1302 	.data = &(struct clk_regmap_gate_data){
1303 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1304 		.bit_idx = 23,
1305 	},
1306 	.hw.init = &(struct clk_init_data) {
1307 		.name = "cpu_clk_trace",
1308 		.ops = &clk_regmap_gate_ro_ops,
1309 		.parent_hws = (const struct clk_hw *[]) {
1310 			&g12a_cpu_clk_trace_div.hw
1311 		},
1312 		.num_parents = 1,
1313 		/*
1314 		 * This clock is set by the ROM monitor code,
1315 		 * Linux should not change it at runtime
1316 		 */
1317 	},
1318 };
1319 
1320 static struct clk_fixed_factor g12b_cpub_clk_div2 = {
1321 	.mult = 1,
1322 	.div = 2,
1323 	.hw.init = &(struct clk_init_data){
1324 		.name = "cpub_clk_div2",
1325 		.ops = &clk_fixed_factor_ops,
1326 		.parent_hws = (const struct clk_hw *[]) {
1327 			&g12b_cpub_clk.hw
1328 		},
1329 		.num_parents = 1,
1330 	},
1331 };
1332 
1333 static struct clk_fixed_factor g12b_cpub_clk_div3 = {
1334 	.mult = 1,
1335 	.div = 3,
1336 	.hw.init = &(struct clk_init_data){
1337 		.name = "cpub_clk_div3",
1338 		.ops = &clk_fixed_factor_ops,
1339 		.parent_hws = (const struct clk_hw *[]) {
1340 			&g12b_cpub_clk.hw
1341 		},
1342 		.num_parents = 1,
1343 	},
1344 };
1345 
1346 static struct clk_fixed_factor g12b_cpub_clk_div4 = {
1347 	.mult = 1,
1348 	.div = 4,
1349 	.hw.init = &(struct clk_init_data){
1350 		.name = "cpub_clk_div4",
1351 		.ops = &clk_fixed_factor_ops,
1352 		.parent_hws = (const struct clk_hw *[]) {
1353 			&g12b_cpub_clk.hw
1354 		},
1355 		.num_parents = 1,
1356 	},
1357 };
1358 
1359 static struct clk_fixed_factor g12b_cpub_clk_div5 = {
1360 	.mult = 1,
1361 	.div = 5,
1362 	.hw.init = &(struct clk_init_data){
1363 		.name = "cpub_clk_div5",
1364 		.ops = &clk_fixed_factor_ops,
1365 		.parent_hws = (const struct clk_hw *[]) {
1366 			&g12b_cpub_clk.hw
1367 		},
1368 		.num_parents = 1,
1369 	},
1370 };
1371 
1372 static struct clk_fixed_factor g12b_cpub_clk_div6 = {
1373 	.mult = 1,
1374 	.div = 6,
1375 	.hw.init = &(struct clk_init_data){
1376 		.name = "cpub_clk_div6",
1377 		.ops = &clk_fixed_factor_ops,
1378 		.parent_hws = (const struct clk_hw *[]) {
1379 			&g12b_cpub_clk.hw
1380 		},
1381 		.num_parents = 1,
1382 	},
1383 };
1384 
1385 static struct clk_fixed_factor g12b_cpub_clk_div7 = {
1386 	.mult = 1,
1387 	.div = 7,
1388 	.hw.init = &(struct clk_init_data){
1389 		.name = "cpub_clk_div7",
1390 		.ops = &clk_fixed_factor_ops,
1391 		.parent_hws = (const struct clk_hw *[]) {
1392 			&g12b_cpub_clk.hw
1393 		},
1394 		.num_parents = 1,
1395 	},
1396 };
1397 
1398 static struct clk_fixed_factor g12b_cpub_clk_div8 = {
1399 	.mult = 1,
1400 	.div = 8,
1401 	.hw.init = &(struct clk_init_data){
1402 		.name = "cpub_clk_div8",
1403 		.ops = &clk_fixed_factor_ops,
1404 		.parent_hws = (const struct clk_hw *[]) {
1405 			&g12b_cpub_clk.hw
1406 		},
1407 		.num_parents = 1,
1408 	},
1409 };
1410 
1411 static u32 mux_table_cpub[] = { 1, 2, 3, 4, 5, 6, 7 };
1412 static struct clk_regmap g12b_cpub_clk_apb_sel = {
1413 	.data = &(struct clk_regmap_mux_data){
1414 		.offset = HHI_SYS_CPUB_CLK_CNTL1,
1415 		.mask = 7,
1416 		.shift = 3,
1417 		.table = mux_table_cpub,
1418 	},
1419 	.hw.init = &(struct clk_init_data){
1420 		.name = "cpub_clk_apb_sel",
1421 		.ops = &clk_regmap_mux_ro_ops,
1422 		.parent_hws = (const struct clk_hw *[]) {
1423 			&g12b_cpub_clk_div2.hw,
1424 			&g12b_cpub_clk_div3.hw,
1425 			&g12b_cpub_clk_div4.hw,
1426 			&g12b_cpub_clk_div5.hw,
1427 			&g12b_cpub_clk_div6.hw,
1428 			&g12b_cpub_clk_div7.hw,
1429 			&g12b_cpub_clk_div8.hw
1430 		},
1431 		.num_parents = 7,
1432 	},
1433 };
1434 
1435 static struct clk_regmap g12b_cpub_clk_apb = {
1436 	.data = &(struct clk_regmap_gate_data){
1437 		.offset = HHI_SYS_CPUB_CLK_CNTL1,
1438 		.bit_idx = 16,
1439 		.flags = CLK_GATE_SET_TO_DISABLE,
1440 	},
1441 	.hw.init = &(struct clk_init_data) {
1442 		.name = "cpub_clk_apb",
1443 		.ops = &clk_regmap_gate_ro_ops,
1444 		.parent_hws = (const struct clk_hw *[]) {
1445 			&g12b_cpub_clk_apb_sel.hw
1446 		},
1447 		.num_parents = 1,
1448 		/*
1449 		 * This clock is set by the ROM monitor code,
1450 		 * Linux should not change it at runtime
1451 		 */
1452 	},
1453 };
1454 
1455 static struct clk_regmap g12b_cpub_clk_atb_sel = {
1456 	.data = &(struct clk_regmap_mux_data){
1457 		.offset = HHI_SYS_CPUB_CLK_CNTL1,
1458 		.mask = 7,
1459 		.shift = 6,
1460 		.table = mux_table_cpub,
1461 	},
1462 	.hw.init = &(struct clk_init_data){
1463 		.name = "cpub_clk_atb_sel",
1464 		.ops = &clk_regmap_mux_ro_ops,
1465 		.parent_hws = (const struct clk_hw *[]) {
1466 			&g12b_cpub_clk_div2.hw,
1467 			&g12b_cpub_clk_div3.hw,
1468 			&g12b_cpub_clk_div4.hw,
1469 			&g12b_cpub_clk_div5.hw,
1470 			&g12b_cpub_clk_div6.hw,
1471 			&g12b_cpub_clk_div7.hw,
1472 			&g12b_cpub_clk_div8.hw
1473 		},
1474 		.num_parents = 7,
1475 	},
1476 };
1477 
1478 static struct clk_regmap g12b_cpub_clk_atb = {
1479 	.data = &(struct clk_regmap_gate_data){
1480 		.offset = HHI_SYS_CPUB_CLK_CNTL1,
1481 		.bit_idx = 17,
1482 		.flags = CLK_GATE_SET_TO_DISABLE,
1483 	},
1484 	.hw.init = &(struct clk_init_data) {
1485 		.name = "cpub_clk_atb",
1486 		.ops = &clk_regmap_gate_ro_ops,
1487 		.parent_hws = (const struct clk_hw *[]) {
1488 			&g12b_cpub_clk_atb_sel.hw
1489 		},
1490 		.num_parents = 1,
1491 		/*
1492 		 * This clock is set by the ROM monitor code,
1493 		 * Linux should not change it at runtime
1494 		 */
1495 	},
1496 };
1497 
1498 static struct clk_regmap g12b_cpub_clk_axi_sel = {
1499 	.data = &(struct clk_regmap_mux_data){
1500 		.offset = HHI_SYS_CPUB_CLK_CNTL1,
1501 		.mask = 7,
1502 		.shift = 9,
1503 		.table = mux_table_cpub,
1504 	},
1505 	.hw.init = &(struct clk_init_data){
1506 		.name = "cpub_clk_axi_sel",
1507 		.ops = &clk_regmap_mux_ro_ops,
1508 		.parent_hws = (const struct clk_hw *[]) {
1509 			&g12b_cpub_clk_div2.hw,
1510 			&g12b_cpub_clk_div3.hw,
1511 			&g12b_cpub_clk_div4.hw,
1512 			&g12b_cpub_clk_div5.hw,
1513 			&g12b_cpub_clk_div6.hw,
1514 			&g12b_cpub_clk_div7.hw,
1515 			&g12b_cpub_clk_div8.hw
1516 		},
1517 		.num_parents = 7,
1518 	},
1519 };
1520 
1521 static struct clk_regmap g12b_cpub_clk_axi = {
1522 	.data = &(struct clk_regmap_gate_data){
1523 		.offset = HHI_SYS_CPUB_CLK_CNTL1,
1524 		.bit_idx = 18,
1525 		.flags = CLK_GATE_SET_TO_DISABLE,
1526 	},
1527 	.hw.init = &(struct clk_init_data) {
1528 		.name = "cpub_clk_axi",
1529 		.ops = &clk_regmap_gate_ro_ops,
1530 		.parent_hws = (const struct clk_hw *[]) {
1531 			&g12b_cpub_clk_axi_sel.hw
1532 		},
1533 		.num_parents = 1,
1534 		/*
1535 		 * This clock is set by the ROM monitor code,
1536 		 * Linux should not change it at runtime
1537 		 */
1538 	},
1539 };
1540 
1541 static struct clk_regmap g12b_cpub_clk_trace_sel = {
1542 	.data = &(struct clk_regmap_mux_data){
1543 		.offset = HHI_SYS_CPUB_CLK_CNTL1,
1544 		.mask = 7,
1545 		.shift = 20,
1546 		.table = mux_table_cpub,
1547 	},
1548 	.hw.init = &(struct clk_init_data){
1549 		.name = "cpub_clk_trace_sel",
1550 		.ops = &clk_regmap_mux_ro_ops,
1551 		.parent_hws = (const struct clk_hw *[]) {
1552 			&g12b_cpub_clk_div2.hw,
1553 			&g12b_cpub_clk_div3.hw,
1554 			&g12b_cpub_clk_div4.hw,
1555 			&g12b_cpub_clk_div5.hw,
1556 			&g12b_cpub_clk_div6.hw,
1557 			&g12b_cpub_clk_div7.hw,
1558 			&g12b_cpub_clk_div8.hw
1559 		},
1560 		.num_parents = 7,
1561 	},
1562 };
1563 
1564 static struct clk_regmap g12b_cpub_clk_trace = {
1565 	.data = &(struct clk_regmap_gate_data){
1566 		.offset = HHI_SYS_CPUB_CLK_CNTL1,
1567 		.bit_idx = 23,
1568 		.flags = CLK_GATE_SET_TO_DISABLE,
1569 	},
1570 	.hw.init = &(struct clk_init_data) {
1571 		.name = "cpub_clk_trace",
1572 		.ops = &clk_regmap_gate_ro_ops,
1573 		.parent_hws = (const struct clk_hw *[]) {
1574 			&g12b_cpub_clk_trace_sel.hw
1575 		},
1576 		.num_parents = 1,
1577 		/*
1578 		 * This clock is set by the ROM monitor code,
1579 		 * Linux should not change it at runtime
1580 		 */
1581 	},
1582 };
1583 
1584 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
1585 	.min = 55,
1586 	.max = 255,
1587 };
1588 
1589 /*
1590  * Internal gp0 pll emulation configuration parameters
1591  */
1592 static const struct reg_sequence g12a_gp0_init_regs[] = {
1593 	{ .reg = HHI_GP0_PLL_CNTL1,	.def = 0x00000000 },
1594 	{ .reg = HHI_GP0_PLL_CNTL2,	.def = 0x00000000 },
1595 	{ .reg = HHI_GP0_PLL_CNTL3,	.def = 0x48681c00 },
1596 	{ .reg = HHI_GP0_PLL_CNTL4,	.def = 0x33771290 },
1597 	{ .reg = HHI_GP0_PLL_CNTL5,	.def = 0x39272000 },
1598 	{ .reg = HHI_GP0_PLL_CNTL6,	.def = 0x56540000 },
1599 };
1600 
1601 static struct clk_regmap g12a_gp0_pll_dco = {
1602 	.data = &(struct meson_clk_pll_data){
1603 		.en = {
1604 			.reg_off = HHI_GP0_PLL_CNTL0,
1605 			.shift   = 28,
1606 			.width   = 1,
1607 		},
1608 		.m = {
1609 			.reg_off = HHI_GP0_PLL_CNTL0,
1610 			.shift   = 0,
1611 			.width   = 8,
1612 		},
1613 		.n = {
1614 			.reg_off = HHI_GP0_PLL_CNTL0,
1615 			.shift   = 10,
1616 			.width   = 5,
1617 		},
1618 		.frac = {
1619 			.reg_off = HHI_GP0_PLL_CNTL1,
1620 			.shift   = 0,
1621 			.width   = 17,
1622 		},
1623 		.l = {
1624 			.reg_off = HHI_GP0_PLL_CNTL0,
1625 			.shift   = 31,
1626 			.width   = 1,
1627 		},
1628 		.rst = {
1629 			.reg_off = HHI_GP0_PLL_CNTL0,
1630 			.shift   = 29,
1631 			.width   = 1,
1632 		},
1633 		.range = &g12a_gp0_pll_mult_range,
1634 		.init_regs = g12a_gp0_init_regs,
1635 		.init_count = ARRAY_SIZE(g12a_gp0_init_regs),
1636 	},
1637 	.hw.init = &(struct clk_init_data){
1638 		.name = "gp0_pll_dco",
1639 		.ops = &meson_clk_pll_ops,
1640 		.parent_data = &(const struct clk_parent_data) {
1641 			.fw_name = "xtal",
1642 		},
1643 		.num_parents = 1,
1644 	},
1645 };
1646 
1647 static struct clk_regmap g12a_gp0_pll = {
1648 	.data = &(struct clk_regmap_div_data){
1649 		.offset = HHI_GP0_PLL_CNTL0,
1650 		.shift = 16,
1651 		.width = 3,
1652 		.flags = (CLK_DIVIDER_POWER_OF_TWO |
1653 			  CLK_DIVIDER_ROUND_CLOSEST),
1654 	},
1655 	.hw.init = &(struct clk_init_data){
1656 		.name = "gp0_pll",
1657 		.ops = &clk_regmap_divider_ops,
1658 		.parent_hws = (const struct clk_hw *[]) {
1659 			&g12a_gp0_pll_dco.hw
1660 		},
1661 		.num_parents = 1,
1662 		.flags = CLK_SET_RATE_PARENT,
1663 	},
1664 };
1665 
1666 static struct clk_regmap sm1_gp1_pll_dco = {
1667 	.data = &(struct meson_clk_pll_data){
1668 		.en = {
1669 			.reg_off = HHI_GP1_PLL_CNTL0,
1670 			.shift   = 28,
1671 			.width   = 1,
1672 		},
1673 		.m = {
1674 			.reg_off = HHI_GP1_PLL_CNTL0,
1675 			.shift   = 0,
1676 			.width   = 8,
1677 		},
1678 		.n = {
1679 			.reg_off = HHI_GP1_PLL_CNTL0,
1680 			.shift   = 10,
1681 			.width   = 5,
1682 		},
1683 		.frac = {
1684 			.reg_off = HHI_GP1_PLL_CNTL1,
1685 			.shift   = 0,
1686 			.width   = 17,
1687 		},
1688 		.l = {
1689 			.reg_off = HHI_GP1_PLL_CNTL0,
1690 			.shift   = 31,
1691 			.width   = 1,
1692 		},
1693 		.rst = {
1694 			.reg_off = HHI_GP1_PLL_CNTL0,
1695 			.shift   = 29,
1696 			.width   = 1,
1697 		},
1698 	},
1699 	.hw.init = &(struct clk_init_data){
1700 		.name = "gp1_pll_dco",
1701 		.ops = &meson_clk_pll_ro_ops,
1702 		.parent_data = &(const struct clk_parent_data) {
1703 			.fw_name = "xtal",
1704 		},
1705 		.num_parents = 1,
1706 		/* This clock feeds the DSU, avoid disabling it */
1707 		.flags = CLK_IS_CRITICAL,
1708 	},
1709 };
1710 
1711 static struct clk_regmap sm1_gp1_pll = {
1712 	.data = &(struct clk_regmap_div_data){
1713 		.offset = HHI_GP1_PLL_CNTL0,
1714 		.shift = 16,
1715 		.width = 3,
1716 		.flags = (CLK_DIVIDER_POWER_OF_TWO |
1717 			  CLK_DIVIDER_ROUND_CLOSEST),
1718 	},
1719 	.hw.init = &(struct clk_init_data){
1720 		.name = "gp1_pll",
1721 		.ops = &clk_regmap_divider_ro_ops,
1722 		.parent_hws = (const struct clk_hw *[]) {
1723 			&sm1_gp1_pll_dco.hw
1724 		},
1725 		.num_parents = 1,
1726 	},
1727 };
1728 
1729 /*
1730  * Internal hifi pll emulation configuration parameters
1731  */
1732 static const struct reg_sequence g12a_hifi_init_regs[] = {
1733 	{ .reg = HHI_HIFI_PLL_CNTL1,	.def = 0x00000000 },
1734 	{ .reg = HHI_HIFI_PLL_CNTL2,	.def = 0x00000000 },
1735 	{ .reg = HHI_HIFI_PLL_CNTL3,	.def = 0x6a285c00 },
1736 	{ .reg = HHI_HIFI_PLL_CNTL4,	.def = 0x65771290 },
1737 	{ .reg = HHI_HIFI_PLL_CNTL5,	.def = 0x39272000 },
1738 	{ .reg = HHI_HIFI_PLL_CNTL6,	.def = 0x56540000 },
1739 };
1740 
1741 static struct clk_regmap g12a_hifi_pll_dco = {
1742 	.data = &(struct meson_clk_pll_data){
1743 		.en = {
1744 			.reg_off = HHI_HIFI_PLL_CNTL0,
1745 			.shift   = 28,
1746 			.width   = 1,
1747 		},
1748 		.m = {
1749 			.reg_off = HHI_HIFI_PLL_CNTL0,
1750 			.shift   = 0,
1751 			.width   = 8,
1752 		},
1753 		.n = {
1754 			.reg_off = HHI_HIFI_PLL_CNTL0,
1755 			.shift   = 10,
1756 			.width   = 5,
1757 		},
1758 		.frac = {
1759 			.reg_off = HHI_HIFI_PLL_CNTL1,
1760 			.shift   = 0,
1761 			.width   = 17,
1762 		},
1763 		.l = {
1764 			.reg_off = HHI_HIFI_PLL_CNTL0,
1765 			.shift   = 31,
1766 			.width   = 1,
1767 		},
1768 		.rst = {
1769 			.reg_off = HHI_HIFI_PLL_CNTL0,
1770 			.shift   = 29,
1771 			.width   = 1,
1772 		},
1773 		.range = &g12a_gp0_pll_mult_range,
1774 		.init_regs = g12a_hifi_init_regs,
1775 		.init_count = ARRAY_SIZE(g12a_hifi_init_regs),
1776 		.flags = CLK_MESON_PLL_ROUND_CLOSEST,
1777 	},
1778 	.hw.init = &(struct clk_init_data){
1779 		.name = "hifi_pll_dco",
1780 		.ops = &meson_clk_pll_ops,
1781 		.parent_data = &(const struct clk_parent_data) {
1782 			.fw_name = "xtal",
1783 		},
1784 		.num_parents = 1,
1785 	},
1786 };
1787 
1788 static struct clk_regmap g12a_hifi_pll = {
1789 	.data = &(struct clk_regmap_div_data){
1790 		.offset = HHI_HIFI_PLL_CNTL0,
1791 		.shift = 16,
1792 		.width = 2,
1793 		.flags = (CLK_DIVIDER_POWER_OF_TWO |
1794 			  CLK_DIVIDER_ROUND_CLOSEST),
1795 	},
1796 	.hw.init = &(struct clk_init_data){
1797 		.name = "hifi_pll",
1798 		.ops = &clk_regmap_divider_ops,
1799 		.parent_hws = (const struct clk_hw *[]) {
1800 			&g12a_hifi_pll_dco.hw
1801 		},
1802 		.num_parents = 1,
1803 		.flags = CLK_SET_RATE_PARENT,
1804 	},
1805 };
1806 
1807 /*
1808  * The Meson G12A PCIE PLL is fined tuned to deliver a very precise
1809  * 100MHz reference clock for the PCIe Analog PHY, and thus requires
1810  * a strict register sequence to enable the PLL.
1811  */
1812 static const struct reg_sequence g12a_pcie_pll_init_regs[] = {
1813 	{ .reg = HHI_PCIE_PLL_CNTL0,	.def = 0x20090496 },
1814 	{ .reg = HHI_PCIE_PLL_CNTL0,	.def = 0x30090496 },
1815 	{ .reg = HHI_PCIE_PLL_CNTL1,	.def = 0x00000000 },
1816 	{ .reg = HHI_PCIE_PLL_CNTL2,	.def = 0x00001100 },
1817 	{ .reg = HHI_PCIE_PLL_CNTL3,	.def = 0x10058e00 },
1818 	{ .reg = HHI_PCIE_PLL_CNTL4,	.def = 0x000100c0 },
1819 	{ .reg = HHI_PCIE_PLL_CNTL5,	.def = 0x68000048 },
1820 	{ .reg = HHI_PCIE_PLL_CNTL5,	.def = 0x68000068, .delay_us = 20 },
1821 	{ .reg = HHI_PCIE_PLL_CNTL4,	.def = 0x008100c0, .delay_us = 10 },
1822 	{ .reg = HHI_PCIE_PLL_CNTL0,	.def = 0x34090496 },
1823 	{ .reg = HHI_PCIE_PLL_CNTL0,	.def = 0x14090496, .delay_us = 10 },
1824 	{ .reg = HHI_PCIE_PLL_CNTL2,	.def = 0x00001000 },
1825 };
1826 
1827 /* Keep a single entry table for recalc/round_rate() ops */
1828 static const struct pll_params_table g12a_pcie_pll_table[] = {
1829 	PLL_PARAMS(150, 1),
1830 	{0, 0},
1831 };
1832 
1833 static struct clk_regmap g12a_pcie_pll_dco = {
1834 	.data = &(struct meson_clk_pll_data){
1835 		.en = {
1836 			.reg_off = HHI_PCIE_PLL_CNTL0,
1837 			.shift   = 28,
1838 			.width   = 1,
1839 		},
1840 		.m = {
1841 			.reg_off = HHI_PCIE_PLL_CNTL0,
1842 			.shift   = 0,
1843 			.width   = 8,
1844 		},
1845 		.n = {
1846 			.reg_off = HHI_PCIE_PLL_CNTL0,
1847 			.shift   = 10,
1848 			.width   = 5,
1849 		},
1850 		.frac = {
1851 			.reg_off = HHI_PCIE_PLL_CNTL1,
1852 			.shift   = 0,
1853 			.width   = 12,
1854 		},
1855 		.l = {
1856 			.reg_off = HHI_PCIE_PLL_CNTL0,
1857 			.shift   = 31,
1858 			.width   = 1,
1859 		},
1860 		.rst = {
1861 			.reg_off = HHI_PCIE_PLL_CNTL0,
1862 			.shift   = 29,
1863 			.width   = 1,
1864 		},
1865 		.table = g12a_pcie_pll_table,
1866 		.init_regs = g12a_pcie_pll_init_regs,
1867 		.init_count = ARRAY_SIZE(g12a_pcie_pll_init_regs),
1868 	},
1869 	.hw.init = &(struct clk_init_data){
1870 		.name = "pcie_pll_dco",
1871 		.ops = &meson_clk_pcie_pll_ops,
1872 		.parent_data = &(const struct clk_parent_data) {
1873 			.fw_name = "xtal",
1874 		},
1875 		.num_parents = 1,
1876 	},
1877 };
1878 
1879 static struct clk_fixed_factor g12a_pcie_pll_dco_div2 = {
1880 	.mult = 1,
1881 	.div = 2,
1882 	.hw.init = &(struct clk_init_data){
1883 		.name = "pcie_pll_dco_div2",
1884 		.ops = &clk_fixed_factor_ops,
1885 		.parent_hws = (const struct clk_hw *[]) {
1886 			&g12a_pcie_pll_dco.hw
1887 		},
1888 		.num_parents = 1,
1889 		.flags = CLK_SET_RATE_PARENT,
1890 	},
1891 };
1892 
1893 static struct clk_regmap g12a_pcie_pll_od = {
1894 	.data = &(struct clk_regmap_div_data){
1895 		.offset = HHI_PCIE_PLL_CNTL0,
1896 		.shift = 16,
1897 		.width = 5,
1898 		.flags = CLK_DIVIDER_ROUND_CLOSEST |
1899 			 CLK_DIVIDER_ONE_BASED |
1900 			 CLK_DIVIDER_ALLOW_ZERO,
1901 	},
1902 	.hw.init = &(struct clk_init_data){
1903 		.name = "pcie_pll_od",
1904 		.ops = &clk_regmap_divider_ops,
1905 		.parent_hws = (const struct clk_hw *[]) {
1906 			&g12a_pcie_pll_dco_div2.hw
1907 		},
1908 		.num_parents = 1,
1909 		.flags = CLK_SET_RATE_PARENT,
1910 	},
1911 };
1912 
1913 static struct clk_fixed_factor g12a_pcie_pll = {
1914 	.mult = 1,
1915 	.div = 2,
1916 	.hw.init = &(struct clk_init_data){
1917 		.name = "pcie_pll_pll",
1918 		.ops = &clk_fixed_factor_ops,
1919 		.parent_hws = (const struct clk_hw *[]) {
1920 			&g12a_pcie_pll_od.hw
1921 		},
1922 		.num_parents = 1,
1923 		.flags = CLK_SET_RATE_PARENT,
1924 	},
1925 };
1926 
1927 static struct clk_regmap g12a_hdmi_pll_dco = {
1928 	.data = &(struct meson_clk_pll_data){
1929 		.en = {
1930 			.reg_off = HHI_HDMI_PLL_CNTL0,
1931 			.shift   = 28,
1932 			.width   = 1,
1933 		},
1934 		.m = {
1935 			.reg_off = HHI_HDMI_PLL_CNTL0,
1936 			.shift   = 0,
1937 			.width   = 8,
1938 		},
1939 		.n = {
1940 			.reg_off = HHI_HDMI_PLL_CNTL0,
1941 			.shift   = 10,
1942 			.width   = 5,
1943 		},
1944 		.frac = {
1945 			.reg_off = HHI_HDMI_PLL_CNTL1,
1946 			.shift   = 0,
1947 			.width   = 16,
1948 		},
1949 		.l = {
1950 			.reg_off = HHI_HDMI_PLL_CNTL0,
1951 			.shift   = 30,
1952 			.width   = 1,
1953 		},
1954 		.rst = {
1955 			.reg_off = HHI_HDMI_PLL_CNTL0,
1956 			.shift   = 29,
1957 			.width   = 1,
1958 		},
1959 	},
1960 	.hw.init = &(struct clk_init_data){
1961 		.name = "hdmi_pll_dco",
1962 		.ops = &meson_clk_pll_ro_ops,
1963 		.parent_data = &(const struct clk_parent_data) {
1964 			.fw_name = "xtal",
1965 		},
1966 		.num_parents = 1,
1967 		/*
1968 		 * Display directly handle hdmi pll registers ATM, we need
1969 		 * NOCACHE to keep our view of the clock as accurate as possible
1970 		 */
1971 		.flags = CLK_GET_RATE_NOCACHE,
1972 	},
1973 };
1974 
1975 static struct clk_regmap g12a_hdmi_pll_od = {
1976 	.data = &(struct clk_regmap_div_data){
1977 		.offset = HHI_HDMI_PLL_CNTL0,
1978 		.shift = 16,
1979 		.width = 2,
1980 		.flags = CLK_DIVIDER_POWER_OF_TWO,
1981 	},
1982 	.hw.init = &(struct clk_init_data){
1983 		.name = "hdmi_pll_od",
1984 		.ops = &clk_regmap_divider_ro_ops,
1985 		.parent_hws = (const struct clk_hw *[]) {
1986 			&g12a_hdmi_pll_dco.hw
1987 		},
1988 		.num_parents = 1,
1989 		.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
1990 	},
1991 };
1992 
1993 static struct clk_regmap g12a_hdmi_pll_od2 = {
1994 	.data = &(struct clk_regmap_div_data){
1995 		.offset = HHI_HDMI_PLL_CNTL0,
1996 		.shift = 18,
1997 		.width = 2,
1998 		.flags = CLK_DIVIDER_POWER_OF_TWO,
1999 	},
2000 	.hw.init = &(struct clk_init_data){
2001 		.name = "hdmi_pll_od2",
2002 		.ops = &clk_regmap_divider_ro_ops,
2003 		.parent_hws = (const struct clk_hw *[]) {
2004 			&g12a_hdmi_pll_od.hw
2005 		},
2006 		.num_parents = 1,
2007 		.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
2008 	},
2009 };
2010 
2011 static struct clk_regmap g12a_hdmi_pll = {
2012 	.data = &(struct clk_regmap_div_data){
2013 		.offset = HHI_HDMI_PLL_CNTL0,
2014 		.shift = 20,
2015 		.width = 2,
2016 		.flags = CLK_DIVIDER_POWER_OF_TWO,
2017 	},
2018 	.hw.init = &(struct clk_init_data){
2019 		.name = "hdmi_pll",
2020 		.ops = &clk_regmap_divider_ro_ops,
2021 		.parent_hws = (const struct clk_hw *[]) {
2022 			&g12a_hdmi_pll_od2.hw
2023 		},
2024 		.num_parents = 1,
2025 		.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
2026 	},
2027 };
2028 
2029 static struct clk_fixed_factor g12a_fclk_div4_div = {
2030 	.mult = 1,
2031 	.div = 4,
2032 	.hw.init = &(struct clk_init_data){
2033 		.name = "fclk_div4_div",
2034 		.ops = &clk_fixed_factor_ops,
2035 		.parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
2036 		.num_parents = 1,
2037 	},
2038 };
2039 
2040 static struct clk_regmap g12a_fclk_div4 = {
2041 	.data = &(struct clk_regmap_gate_data){
2042 		.offset = HHI_FIX_PLL_CNTL1,
2043 		.bit_idx = 21,
2044 	},
2045 	.hw.init = &(struct clk_init_data){
2046 		.name = "fclk_div4",
2047 		.ops = &clk_regmap_gate_ops,
2048 		.parent_hws = (const struct clk_hw *[]) {
2049 			&g12a_fclk_div4_div.hw
2050 		},
2051 		.num_parents = 1,
2052 	},
2053 };
2054 
2055 static struct clk_fixed_factor g12a_fclk_div5_div = {
2056 	.mult = 1,
2057 	.div = 5,
2058 	.hw.init = &(struct clk_init_data){
2059 		.name = "fclk_div5_div",
2060 		.ops = &clk_fixed_factor_ops,
2061 		.parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
2062 		.num_parents = 1,
2063 	},
2064 };
2065 
2066 static struct clk_regmap g12a_fclk_div5 = {
2067 	.data = &(struct clk_regmap_gate_data){
2068 		.offset = HHI_FIX_PLL_CNTL1,
2069 		.bit_idx = 22,
2070 	},
2071 	.hw.init = &(struct clk_init_data){
2072 		.name = "fclk_div5",
2073 		.ops = &clk_regmap_gate_ops,
2074 		.parent_hws = (const struct clk_hw *[]) {
2075 			&g12a_fclk_div5_div.hw
2076 		},
2077 		.num_parents = 1,
2078 	},
2079 };
2080 
2081 static struct clk_fixed_factor g12a_fclk_div7_div = {
2082 	.mult = 1,
2083 	.div = 7,
2084 	.hw.init = &(struct clk_init_data){
2085 		.name = "fclk_div7_div",
2086 		.ops = &clk_fixed_factor_ops,
2087 		.parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
2088 		.num_parents = 1,
2089 	},
2090 };
2091 
2092 static struct clk_regmap g12a_fclk_div7 = {
2093 	.data = &(struct clk_regmap_gate_data){
2094 		.offset = HHI_FIX_PLL_CNTL1,
2095 		.bit_idx = 23,
2096 	},
2097 	.hw.init = &(struct clk_init_data){
2098 		.name = "fclk_div7",
2099 		.ops = &clk_regmap_gate_ops,
2100 		.parent_hws = (const struct clk_hw *[]) {
2101 			&g12a_fclk_div7_div.hw
2102 		},
2103 		.num_parents = 1,
2104 	},
2105 };
2106 
2107 static struct clk_fixed_factor g12a_fclk_div2p5_div = {
2108 	.mult = 1,
2109 	.div = 5,
2110 	.hw.init = &(struct clk_init_data){
2111 		.name = "fclk_div2p5_div",
2112 		.ops = &clk_fixed_factor_ops,
2113 		.parent_hws = (const struct clk_hw *[]) {
2114 			&g12a_fixed_pll_dco.hw
2115 		},
2116 		.num_parents = 1,
2117 	},
2118 };
2119 
2120 static struct clk_regmap g12a_fclk_div2p5 = {
2121 	.data = &(struct clk_regmap_gate_data){
2122 		.offset = HHI_FIX_PLL_CNTL1,
2123 		.bit_idx = 25,
2124 	},
2125 	.hw.init = &(struct clk_init_data){
2126 		.name = "fclk_div2p5",
2127 		.ops = &clk_regmap_gate_ops,
2128 		.parent_hws = (const struct clk_hw *[]) {
2129 			&g12a_fclk_div2p5_div.hw
2130 		},
2131 		.num_parents = 1,
2132 	},
2133 };
2134 
2135 static struct clk_fixed_factor g12a_mpll_50m_div = {
2136 	.mult = 1,
2137 	.div = 80,
2138 	.hw.init = &(struct clk_init_data){
2139 		.name = "mpll_50m_div",
2140 		.ops = &clk_fixed_factor_ops,
2141 		.parent_hws = (const struct clk_hw *[]) {
2142 			&g12a_fixed_pll_dco.hw
2143 		},
2144 		.num_parents = 1,
2145 	},
2146 };
2147 
2148 static struct clk_regmap g12a_mpll_50m = {
2149 	.data = &(struct clk_regmap_mux_data){
2150 		.offset = HHI_FIX_PLL_CNTL3,
2151 		.mask = 0x1,
2152 		.shift = 5,
2153 	},
2154 	.hw.init = &(struct clk_init_data){
2155 		.name = "mpll_50m",
2156 		.ops = &clk_regmap_mux_ro_ops,
2157 		.parent_data = (const struct clk_parent_data []) {
2158 			{ .fw_name = "xtal", },
2159 			{ .hw = &g12a_mpll_50m_div.hw },
2160 		},
2161 		.num_parents = 2,
2162 	},
2163 };
2164 
2165 static struct clk_fixed_factor g12a_mpll_prediv = {
2166 	.mult = 1,
2167 	.div = 2,
2168 	.hw.init = &(struct clk_init_data){
2169 		.name = "mpll_prediv",
2170 		.ops = &clk_fixed_factor_ops,
2171 		.parent_hws = (const struct clk_hw *[]) {
2172 			&g12a_fixed_pll_dco.hw
2173 		},
2174 		.num_parents = 1,
2175 	},
2176 };
2177 
2178 static const struct reg_sequence g12a_mpll0_init_regs[] = {
2179 	{ .reg = HHI_MPLL_CNTL2,	.def = 0x40000033 },
2180 };
2181 
2182 static struct clk_regmap g12a_mpll0_div = {
2183 	.data = &(struct meson_clk_mpll_data){
2184 		.sdm = {
2185 			.reg_off = HHI_MPLL_CNTL1,
2186 			.shift   = 0,
2187 			.width   = 14,
2188 		},
2189 		.sdm_en = {
2190 			.reg_off = HHI_MPLL_CNTL1,
2191 			.shift   = 30,
2192 			.width	 = 1,
2193 		},
2194 		.n2 = {
2195 			.reg_off = HHI_MPLL_CNTL1,
2196 			.shift   = 20,
2197 			.width   = 9,
2198 		},
2199 		.ssen = {
2200 			.reg_off = HHI_MPLL_CNTL1,
2201 			.shift   = 29,
2202 			.width	 = 1,
2203 		},
2204 		.lock = &meson_clk_lock,
2205 		.init_regs = g12a_mpll0_init_regs,
2206 		.init_count = ARRAY_SIZE(g12a_mpll0_init_regs),
2207 	},
2208 	.hw.init = &(struct clk_init_data){
2209 		.name = "mpll0_div",
2210 		.ops = &meson_clk_mpll_ops,
2211 		.parent_hws = (const struct clk_hw *[]) {
2212 			&g12a_mpll_prediv.hw
2213 		},
2214 		.num_parents = 1,
2215 	},
2216 };
2217 
2218 static struct clk_regmap g12a_mpll0 = {
2219 	.data = &(struct clk_regmap_gate_data){
2220 		.offset = HHI_MPLL_CNTL1,
2221 		.bit_idx = 31,
2222 	},
2223 	.hw.init = &(struct clk_init_data){
2224 		.name = "mpll0",
2225 		.ops = &clk_regmap_gate_ops,
2226 		.parent_hws = (const struct clk_hw *[]) { &g12a_mpll0_div.hw },
2227 		.num_parents = 1,
2228 		.flags = CLK_SET_RATE_PARENT,
2229 	},
2230 };
2231 
2232 static const struct reg_sequence g12a_mpll1_init_regs[] = {
2233 	{ .reg = HHI_MPLL_CNTL4,	.def = 0x40000033 },
2234 };
2235 
2236 static struct clk_regmap g12a_mpll1_div = {
2237 	.data = &(struct meson_clk_mpll_data){
2238 		.sdm = {
2239 			.reg_off = HHI_MPLL_CNTL3,
2240 			.shift   = 0,
2241 			.width   = 14,
2242 		},
2243 		.sdm_en = {
2244 			.reg_off = HHI_MPLL_CNTL3,
2245 			.shift   = 30,
2246 			.width	 = 1,
2247 		},
2248 		.n2 = {
2249 			.reg_off = HHI_MPLL_CNTL3,
2250 			.shift   = 20,
2251 			.width   = 9,
2252 		},
2253 		.ssen = {
2254 			.reg_off = HHI_MPLL_CNTL3,
2255 			.shift   = 29,
2256 			.width	 = 1,
2257 		},
2258 		.lock = &meson_clk_lock,
2259 		.init_regs = g12a_mpll1_init_regs,
2260 		.init_count = ARRAY_SIZE(g12a_mpll1_init_regs),
2261 	},
2262 	.hw.init = &(struct clk_init_data){
2263 		.name = "mpll1_div",
2264 		.ops = &meson_clk_mpll_ops,
2265 		.parent_hws = (const struct clk_hw *[]) {
2266 			&g12a_mpll_prediv.hw
2267 		},
2268 		.num_parents = 1,
2269 	},
2270 };
2271 
2272 static struct clk_regmap g12a_mpll1 = {
2273 	.data = &(struct clk_regmap_gate_data){
2274 		.offset = HHI_MPLL_CNTL3,
2275 		.bit_idx = 31,
2276 	},
2277 	.hw.init = &(struct clk_init_data){
2278 		.name = "mpll1",
2279 		.ops = &clk_regmap_gate_ops,
2280 		.parent_hws = (const struct clk_hw *[]) { &g12a_mpll1_div.hw },
2281 		.num_parents = 1,
2282 		.flags = CLK_SET_RATE_PARENT,
2283 	},
2284 };
2285 
2286 static const struct reg_sequence g12a_mpll2_init_regs[] = {
2287 	{ .reg = HHI_MPLL_CNTL6,	.def = 0x40000033 },
2288 };
2289 
2290 static struct clk_regmap g12a_mpll2_div = {
2291 	.data = &(struct meson_clk_mpll_data){
2292 		.sdm = {
2293 			.reg_off = HHI_MPLL_CNTL5,
2294 			.shift   = 0,
2295 			.width   = 14,
2296 		},
2297 		.sdm_en = {
2298 			.reg_off = HHI_MPLL_CNTL5,
2299 			.shift   = 30,
2300 			.width	 = 1,
2301 		},
2302 		.n2 = {
2303 			.reg_off = HHI_MPLL_CNTL5,
2304 			.shift   = 20,
2305 			.width   = 9,
2306 		},
2307 		.ssen = {
2308 			.reg_off = HHI_MPLL_CNTL5,
2309 			.shift   = 29,
2310 			.width	 = 1,
2311 		},
2312 		.lock = &meson_clk_lock,
2313 		.init_regs = g12a_mpll2_init_regs,
2314 		.init_count = ARRAY_SIZE(g12a_mpll2_init_regs),
2315 	},
2316 	.hw.init = &(struct clk_init_data){
2317 		.name = "mpll2_div",
2318 		.ops = &meson_clk_mpll_ops,
2319 		.parent_hws = (const struct clk_hw *[]) {
2320 			&g12a_mpll_prediv.hw
2321 		},
2322 		.num_parents = 1,
2323 	},
2324 };
2325 
2326 static struct clk_regmap g12a_mpll2 = {
2327 	.data = &(struct clk_regmap_gate_data){
2328 		.offset = HHI_MPLL_CNTL5,
2329 		.bit_idx = 31,
2330 	},
2331 	.hw.init = &(struct clk_init_data){
2332 		.name = "mpll2",
2333 		.ops = &clk_regmap_gate_ops,
2334 		.parent_hws = (const struct clk_hw *[]) { &g12a_mpll2_div.hw },
2335 		.num_parents = 1,
2336 		.flags = CLK_SET_RATE_PARENT,
2337 	},
2338 };
2339 
2340 static const struct reg_sequence g12a_mpll3_init_regs[] = {
2341 	{ .reg = HHI_MPLL_CNTL8,	.def = 0x40000033 },
2342 };
2343 
2344 static struct clk_regmap g12a_mpll3_div = {
2345 	.data = &(struct meson_clk_mpll_data){
2346 		.sdm = {
2347 			.reg_off = HHI_MPLL_CNTL7,
2348 			.shift   = 0,
2349 			.width   = 14,
2350 		},
2351 		.sdm_en = {
2352 			.reg_off = HHI_MPLL_CNTL7,
2353 			.shift   = 30,
2354 			.width	 = 1,
2355 		},
2356 		.n2 = {
2357 			.reg_off = HHI_MPLL_CNTL7,
2358 			.shift   = 20,
2359 			.width   = 9,
2360 		},
2361 		.ssen = {
2362 			.reg_off = HHI_MPLL_CNTL7,
2363 			.shift   = 29,
2364 			.width	 = 1,
2365 		},
2366 		.lock = &meson_clk_lock,
2367 		.init_regs = g12a_mpll3_init_regs,
2368 		.init_count = ARRAY_SIZE(g12a_mpll3_init_regs),
2369 	},
2370 	.hw.init = &(struct clk_init_data){
2371 		.name = "mpll3_div",
2372 		.ops = &meson_clk_mpll_ops,
2373 		.parent_hws = (const struct clk_hw *[]) {
2374 			&g12a_mpll_prediv.hw
2375 		},
2376 		.num_parents = 1,
2377 	},
2378 };
2379 
2380 static struct clk_regmap g12a_mpll3 = {
2381 	.data = &(struct clk_regmap_gate_data){
2382 		.offset = HHI_MPLL_CNTL7,
2383 		.bit_idx = 31,
2384 	},
2385 	.hw.init = &(struct clk_init_data){
2386 		.name = "mpll3",
2387 		.ops = &clk_regmap_gate_ops,
2388 		.parent_hws = (const struct clk_hw *[]) { &g12a_mpll3_div.hw },
2389 		.num_parents = 1,
2390 		.flags = CLK_SET_RATE_PARENT,
2391 	},
2392 };
2393 
2394 static u32 mux_table_clk81[]	= { 0, 2, 3, 4, 5, 6, 7 };
2395 static const struct clk_parent_data clk81_parent_data[] = {
2396 	{ .fw_name = "xtal", },
2397 	{ .hw = &g12a_fclk_div7.hw },
2398 	{ .hw = &g12a_mpll1.hw },
2399 	{ .hw = &g12a_mpll2.hw },
2400 	{ .hw = &g12a_fclk_div4.hw },
2401 	{ .hw = &g12a_fclk_div3.hw },
2402 	{ .hw = &g12a_fclk_div5.hw },
2403 };
2404 
2405 static struct clk_regmap g12a_mpeg_clk_sel = {
2406 	.data = &(struct clk_regmap_mux_data){
2407 		.offset = HHI_MPEG_CLK_CNTL,
2408 		.mask = 0x7,
2409 		.shift = 12,
2410 		.table = mux_table_clk81,
2411 	},
2412 	.hw.init = &(struct clk_init_data){
2413 		.name = "mpeg_clk_sel",
2414 		.ops = &clk_regmap_mux_ro_ops,
2415 		.parent_data = clk81_parent_data,
2416 		.num_parents = ARRAY_SIZE(clk81_parent_data),
2417 	},
2418 };
2419 
2420 static struct clk_regmap g12a_mpeg_clk_div = {
2421 	.data = &(struct clk_regmap_div_data){
2422 		.offset = HHI_MPEG_CLK_CNTL,
2423 		.shift = 0,
2424 		.width = 7,
2425 	},
2426 	.hw.init = &(struct clk_init_data){
2427 		.name = "mpeg_clk_div",
2428 		.ops = &clk_regmap_divider_ops,
2429 		.parent_hws = (const struct clk_hw *[]) {
2430 			&g12a_mpeg_clk_sel.hw
2431 		},
2432 		.num_parents = 1,
2433 		.flags = CLK_SET_RATE_PARENT,
2434 	},
2435 };
2436 
2437 static struct clk_regmap g12a_clk81 = {
2438 	.data = &(struct clk_regmap_gate_data){
2439 		.offset = HHI_MPEG_CLK_CNTL,
2440 		.bit_idx = 7,
2441 	},
2442 	.hw.init = &(struct clk_init_data){
2443 		.name = "clk81",
2444 		.ops = &clk_regmap_gate_ops,
2445 		.parent_hws = (const struct clk_hw *[]) {
2446 			&g12a_mpeg_clk_div.hw
2447 		},
2448 		.num_parents = 1,
2449 		.flags = (CLK_SET_RATE_PARENT | CLK_IS_CRITICAL),
2450 	},
2451 };
2452 
2453 static const struct clk_parent_data g12a_sd_emmc_clk0_parent_data[] = {
2454 	{ .fw_name = "xtal", },
2455 	{ .hw = &g12a_fclk_div2.hw },
2456 	{ .hw = &g12a_fclk_div3.hw },
2457 	{ .hw = &g12a_fclk_div5.hw },
2458 	{ .hw = &g12a_fclk_div7.hw },
2459 	/*
2460 	 * Following these parent clocks, we should also have had mpll2, mpll3
2461 	 * and gp0_pll but these clocks are too precious to be used here. All
2462 	 * the necessary rates for MMC and NAND operation can be acheived using
2463 	 * g12a_ee_core or fclk_div clocks
2464 	 */
2465 };
2466 
2467 /* SDIO clock */
2468 static struct clk_regmap g12a_sd_emmc_a_clk0_sel = {
2469 	.data = &(struct clk_regmap_mux_data){
2470 		.offset = HHI_SD_EMMC_CLK_CNTL,
2471 		.mask = 0x7,
2472 		.shift = 9,
2473 	},
2474 	.hw.init = &(struct clk_init_data) {
2475 		.name = "sd_emmc_a_clk0_sel",
2476 		.ops = &clk_regmap_mux_ops,
2477 		.parent_data = g12a_sd_emmc_clk0_parent_data,
2478 		.num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data),
2479 		.flags = CLK_SET_RATE_PARENT,
2480 	},
2481 };
2482 
2483 static struct clk_regmap g12a_sd_emmc_a_clk0_div = {
2484 	.data = &(struct clk_regmap_div_data){
2485 		.offset = HHI_SD_EMMC_CLK_CNTL,
2486 		.shift = 0,
2487 		.width = 7,
2488 	},
2489 	.hw.init = &(struct clk_init_data) {
2490 		.name = "sd_emmc_a_clk0_div",
2491 		.ops = &clk_regmap_divider_ops,
2492 		.parent_hws = (const struct clk_hw *[]) {
2493 			&g12a_sd_emmc_a_clk0_sel.hw
2494 		},
2495 		.num_parents = 1,
2496 		.flags = CLK_SET_RATE_PARENT,
2497 	},
2498 };
2499 
2500 static struct clk_regmap g12a_sd_emmc_a_clk0 = {
2501 	.data = &(struct clk_regmap_gate_data){
2502 		.offset = HHI_SD_EMMC_CLK_CNTL,
2503 		.bit_idx = 7,
2504 	},
2505 	.hw.init = &(struct clk_init_data){
2506 		.name = "sd_emmc_a_clk0",
2507 		.ops = &clk_regmap_gate_ops,
2508 		.parent_hws = (const struct clk_hw *[]) {
2509 			&g12a_sd_emmc_a_clk0_div.hw
2510 		},
2511 		.num_parents = 1,
2512 		.flags = CLK_SET_RATE_PARENT,
2513 	},
2514 };
2515 
2516 /* SDcard clock */
2517 static struct clk_regmap g12a_sd_emmc_b_clk0_sel = {
2518 	.data = &(struct clk_regmap_mux_data){
2519 		.offset = HHI_SD_EMMC_CLK_CNTL,
2520 		.mask = 0x7,
2521 		.shift = 25,
2522 	},
2523 	.hw.init = &(struct clk_init_data) {
2524 		.name = "sd_emmc_b_clk0_sel",
2525 		.ops = &clk_regmap_mux_ops,
2526 		.parent_data = g12a_sd_emmc_clk0_parent_data,
2527 		.num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data),
2528 		.flags = CLK_SET_RATE_PARENT,
2529 	},
2530 };
2531 
2532 static struct clk_regmap g12a_sd_emmc_b_clk0_div = {
2533 	.data = &(struct clk_regmap_div_data){
2534 		.offset = HHI_SD_EMMC_CLK_CNTL,
2535 		.shift = 16,
2536 		.width = 7,
2537 	},
2538 	.hw.init = &(struct clk_init_data) {
2539 		.name = "sd_emmc_b_clk0_div",
2540 		.ops = &clk_regmap_divider_ops,
2541 		.parent_hws = (const struct clk_hw *[]) {
2542 			&g12a_sd_emmc_b_clk0_sel.hw
2543 		},
2544 		.num_parents = 1,
2545 		.flags = CLK_SET_RATE_PARENT,
2546 	},
2547 };
2548 
2549 static struct clk_regmap g12a_sd_emmc_b_clk0 = {
2550 	.data = &(struct clk_regmap_gate_data){
2551 		.offset = HHI_SD_EMMC_CLK_CNTL,
2552 		.bit_idx = 23,
2553 	},
2554 	.hw.init = &(struct clk_init_data){
2555 		.name = "sd_emmc_b_clk0",
2556 		.ops = &clk_regmap_gate_ops,
2557 		.parent_hws = (const struct clk_hw *[]) {
2558 			&g12a_sd_emmc_b_clk0_div.hw
2559 		},
2560 		.num_parents = 1,
2561 		.flags = CLK_SET_RATE_PARENT,
2562 	},
2563 };
2564 
2565 /* EMMC/NAND clock */
2566 static struct clk_regmap g12a_sd_emmc_c_clk0_sel = {
2567 	.data = &(struct clk_regmap_mux_data){
2568 		.offset = HHI_NAND_CLK_CNTL,
2569 		.mask = 0x7,
2570 		.shift = 9,
2571 	},
2572 	.hw.init = &(struct clk_init_data) {
2573 		.name = "sd_emmc_c_clk0_sel",
2574 		.ops = &clk_regmap_mux_ops,
2575 		.parent_data = g12a_sd_emmc_clk0_parent_data,
2576 		.num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data),
2577 		.flags = CLK_SET_RATE_PARENT,
2578 	},
2579 };
2580 
2581 static struct clk_regmap g12a_sd_emmc_c_clk0_div = {
2582 	.data = &(struct clk_regmap_div_data){
2583 		.offset = HHI_NAND_CLK_CNTL,
2584 		.shift = 0,
2585 		.width = 7,
2586 	},
2587 	.hw.init = &(struct clk_init_data) {
2588 		.name = "sd_emmc_c_clk0_div",
2589 		.ops = &clk_regmap_divider_ops,
2590 		.parent_hws = (const struct clk_hw *[]) {
2591 			&g12a_sd_emmc_c_clk0_sel.hw
2592 		},
2593 		.num_parents = 1,
2594 		.flags = CLK_SET_RATE_PARENT,
2595 	},
2596 };
2597 
2598 static struct clk_regmap g12a_sd_emmc_c_clk0 = {
2599 	.data = &(struct clk_regmap_gate_data){
2600 		.offset = HHI_NAND_CLK_CNTL,
2601 		.bit_idx = 7,
2602 	},
2603 	.hw.init = &(struct clk_init_data){
2604 		.name = "sd_emmc_c_clk0",
2605 		.ops = &clk_regmap_gate_ops,
2606 		.parent_hws = (const struct clk_hw *[]) {
2607 			&g12a_sd_emmc_c_clk0_div.hw
2608 		},
2609 		.num_parents = 1,
2610 		.flags = CLK_SET_RATE_PARENT,
2611 	},
2612 };
2613 
2614 /* Video Clocks */
2615 
2616 static struct clk_regmap g12a_vid_pll_div = {
2617 	.data = &(struct meson_vid_pll_div_data){
2618 		.val = {
2619 			.reg_off = HHI_VID_PLL_CLK_DIV,
2620 			.shift   = 0,
2621 			.width   = 15,
2622 		},
2623 		.sel = {
2624 			.reg_off = HHI_VID_PLL_CLK_DIV,
2625 			.shift   = 16,
2626 			.width   = 2,
2627 		},
2628 	},
2629 	.hw.init = &(struct clk_init_data) {
2630 		.name = "vid_pll_div",
2631 		.ops = &meson_vid_pll_div_ro_ops,
2632 		.parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_pll.hw },
2633 		.num_parents = 1,
2634 		.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
2635 	},
2636 };
2637 
2638 static const struct clk_hw *g12a_vid_pll_parent_hws[] = {
2639 	&g12a_vid_pll_div.hw,
2640 	&g12a_hdmi_pll.hw,
2641 };
2642 
2643 static struct clk_regmap g12a_vid_pll_sel = {
2644 	.data = &(struct clk_regmap_mux_data){
2645 		.offset = HHI_VID_PLL_CLK_DIV,
2646 		.mask = 0x1,
2647 		.shift = 18,
2648 	},
2649 	.hw.init = &(struct clk_init_data){
2650 		.name = "vid_pll_sel",
2651 		.ops = &clk_regmap_mux_ops,
2652 		/*
2653 		 * bit 18 selects from 2 possible parents:
2654 		 * vid_pll_div or hdmi_pll
2655 		 */
2656 		.parent_hws = g12a_vid_pll_parent_hws,
2657 		.num_parents = ARRAY_SIZE(g12a_vid_pll_parent_hws),
2658 		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
2659 	},
2660 };
2661 
2662 static struct clk_regmap g12a_vid_pll = {
2663 	.data = &(struct clk_regmap_gate_data){
2664 		.offset = HHI_VID_PLL_CLK_DIV,
2665 		.bit_idx = 19,
2666 	},
2667 	.hw.init = &(struct clk_init_data) {
2668 		.name = "vid_pll",
2669 		.ops = &clk_regmap_gate_ops,
2670 		.parent_hws = (const struct clk_hw *[]) {
2671 			&g12a_vid_pll_sel.hw
2672 		},
2673 		.num_parents = 1,
2674 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
2675 	},
2676 };
2677 
2678 /* VPU Clock */
2679 
2680 static const struct clk_hw *g12a_vpu_parent_hws[] = {
2681 	&g12a_fclk_div3.hw,
2682 	&g12a_fclk_div4.hw,
2683 	&g12a_fclk_div5.hw,
2684 	&g12a_fclk_div7.hw,
2685 	&g12a_mpll1.hw,
2686 	&g12a_vid_pll.hw,
2687 	&g12a_hifi_pll.hw,
2688 	&g12a_gp0_pll.hw,
2689 };
2690 
2691 static struct clk_regmap g12a_vpu_0_sel = {
2692 	.data = &(struct clk_regmap_mux_data){
2693 		.offset = HHI_VPU_CLK_CNTL,
2694 		.mask = 0x7,
2695 		.shift = 9,
2696 	},
2697 	.hw.init = &(struct clk_init_data){
2698 		.name = "vpu_0_sel",
2699 		.ops = &clk_regmap_mux_ops,
2700 		.parent_hws = g12a_vpu_parent_hws,
2701 		.num_parents = ARRAY_SIZE(g12a_vpu_parent_hws),
2702 		.flags = CLK_SET_RATE_NO_REPARENT,
2703 	},
2704 };
2705 
2706 static struct clk_regmap g12a_vpu_0_div = {
2707 	.data = &(struct clk_regmap_div_data){
2708 		.offset = HHI_VPU_CLK_CNTL,
2709 		.shift = 0,
2710 		.width = 7,
2711 	},
2712 	.hw.init = &(struct clk_init_data){
2713 		.name = "vpu_0_div",
2714 		.ops = &clk_regmap_divider_ops,
2715 		.parent_hws = (const struct clk_hw *[]) { &g12a_vpu_0_sel.hw },
2716 		.num_parents = 1,
2717 		.flags = CLK_SET_RATE_PARENT,
2718 	},
2719 };
2720 
2721 static struct clk_regmap g12a_vpu_0 = {
2722 	.data = &(struct clk_regmap_gate_data){
2723 		.offset = HHI_VPU_CLK_CNTL,
2724 		.bit_idx = 8,
2725 	},
2726 	.hw.init = &(struct clk_init_data) {
2727 		.name = "vpu_0",
2728 		.ops = &clk_regmap_gate_ops,
2729 		.parent_hws = (const struct clk_hw *[]) { &g12a_vpu_0_div.hw },
2730 		.num_parents = 1,
2731 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
2732 	},
2733 };
2734 
2735 static struct clk_regmap g12a_vpu_1_sel = {
2736 	.data = &(struct clk_regmap_mux_data){
2737 		.offset = HHI_VPU_CLK_CNTL,
2738 		.mask = 0x7,
2739 		.shift = 25,
2740 	},
2741 	.hw.init = &(struct clk_init_data){
2742 		.name = "vpu_1_sel",
2743 		.ops = &clk_regmap_mux_ops,
2744 		.parent_hws = g12a_vpu_parent_hws,
2745 		.num_parents = ARRAY_SIZE(g12a_vpu_parent_hws),
2746 		.flags = CLK_SET_RATE_NO_REPARENT,
2747 	},
2748 };
2749 
2750 static struct clk_regmap g12a_vpu_1_div = {
2751 	.data = &(struct clk_regmap_div_data){
2752 		.offset = HHI_VPU_CLK_CNTL,
2753 		.shift = 16,
2754 		.width = 7,
2755 	},
2756 	.hw.init = &(struct clk_init_data){
2757 		.name = "vpu_1_div",
2758 		.ops = &clk_regmap_divider_ops,
2759 		.parent_hws = (const struct clk_hw *[]) { &g12a_vpu_1_sel.hw },
2760 		.num_parents = 1,
2761 		.flags = CLK_SET_RATE_PARENT,
2762 	},
2763 };
2764 
2765 static struct clk_regmap g12a_vpu_1 = {
2766 	.data = &(struct clk_regmap_gate_data){
2767 		.offset = HHI_VPU_CLK_CNTL,
2768 		.bit_idx = 24,
2769 	},
2770 	.hw.init = &(struct clk_init_data) {
2771 		.name = "vpu_1",
2772 		.ops = &clk_regmap_gate_ops,
2773 		.parent_hws = (const struct clk_hw *[]) { &g12a_vpu_1_div.hw },
2774 		.num_parents = 1,
2775 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
2776 	},
2777 };
2778 
2779 static struct clk_regmap g12a_vpu = {
2780 	.data = &(struct clk_regmap_mux_data){
2781 		.offset = HHI_VPU_CLK_CNTL,
2782 		.mask = 1,
2783 		.shift = 31,
2784 	},
2785 	.hw.init = &(struct clk_init_data){
2786 		.name = "vpu",
2787 		.ops = &clk_regmap_mux_ops,
2788 		/*
2789 		 * bit 31 selects from 2 possible parents:
2790 		 * vpu_0 or vpu_1
2791 		 */
2792 		.parent_hws = (const struct clk_hw *[]) {
2793 			&g12a_vpu_0.hw,
2794 			&g12a_vpu_1.hw,
2795 		},
2796 		.num_parents = 2,
2797 		.flags = CLK_SET_RATE_NO_REPARENT,
2798 	},
2799 };
2800 
2801 /* VDEC clocks */
2802 
2803 static const struct clk_hw *g12a_vdec_parent_hws[] = {
2804 	&g12a_fclk_div2p5.hw,
2805 	&g12a_fclk_div3.hw,
2806 	&g12a_fclk_div4.hw,
2807 	&g12a_fclk_div5.hw,
2808 	&g12a_fclk_div7.hw,
2809 	&g12a_hifi_pll.hw,
2810 	&g12a_gp0_pll.hw,
2811 };
2812 
2813 static struct clk_regmap g12a_vdec_1_sel = {
2814 	.data = &(struct clk_regmap_mux_data){
2815 		.offset = HHI_VDEC_CLK_CNTL,
2816 		.mask = 0x7,
2817 		.shift = 9,
2818 		.flags = CLK_MUX_ROUND_CLOSEST,
2819 	},
2820 	.hw.init = &(struct clk_init_data){
2821 		.name = "vdec_1_sel",
2822 		.ops = &clk_regmap_mux_ops,
2823 		.parent_hws = g12a_vdec_parent_hws,
2824 		.num_parents = ARRAY_SIZE(g12a_vdec_parent_hws),
2825 		.flags = CLK_SET_RATE_PARENT,
2826 	},
2827 };
2828 
2829 static struct clk_regmap g12a_vdec_1_div = {
2830 	.data = &(struct clk_regmap_div_data){
2831 		.offset = HHI_VDEC_CLK_CNTL,
2832 		.shift = 0,
2833 		.width = 7,
2834 		.flags = CLK_DIVIDER_ROUND_CLOSEST,
2835 	},
2836 	.hw.init = &(struct clk_init_data){
2837 		.name = "vdec_1_div",
2838 		.ops = &clk_regmap_divider_ops,
2839 		.parent_hws = (const struct clk_hw *[]) {
2840 			&g12a_vdec_1_sel.hw
2841 		},
2842 		.num_parents = 1,
2843 		.flags = CLK_SET_RATE_PARENT,
2844 	},
2845 };
2846 
2847 static struct clk_regmap g12a_vdec_1 = {
2848 	.data = &(struct clk_regmap_gate_data){
2849 		.offset = HHI_VDEC_CLK_CNTL,
2850 		.bit_idx = 8,
2851 	},
2852 	.hw.init = &(struct clk_init_data) {
2853 		.name = "vdec_1",
2854 		.ops = &clk_regmap_gate_ops,
2855 		.parent_hws = (const struct clk_hw *[]) {
2856 			&g12a_vdec_1_div.hw
2857 		},
2858 		.num_parents = 1,
2859 		.flags = CLK_SET_RATE_PARENT,
2860 	},
2861 };
2862 
2863 static struct clk_regmap g12a_vdec_hevcf_sel = {
2864 	.data = &(struct clk_regmap_mux_data){
2865 		.offset = HHI_VDEC2_CLK_CNTL,
2866 		.mask = 0x7,
2867 		.shift = 9,
2868 		.flags = CLK_MUX_ROUND_CLOSEST,
2869 	},
2870 	.hw.init = &(struct clk_init_data){
2871 		.name = "vdec_hevcf_sel",
2872 		.ops = &clk_regmap_mux_ops,
2873 		.parent_hws = g12a_vdec_parent_hws,
2874 		.num_parents = ARRAY_SIZE(g12a_vdec_parent_hws),
2875 		.flags = CLK_SET_RATE_PARENT,
2876 	},
2877 };
2878 
2879 static struct clk_regmap g12a_vdec_hevcf_div = {
2880 	.data = &(struct clk_regmap_div_data){
2881 		.offset = HHI_VDEC2_CLK_CNTL,
2882 		.shift = 0,
2883 		.width = 7,
2884 		.flags = CLK_DIVIDER_ROUND_CLOSEST,
2885 	},
2886 	.hw.init = &(struct clk_init_data){
2887 		.name = "vdec_hevcf_div",
2888 		.ops = &clk_regmap_divider_ops,
2889 		.parent_hws = (const struct clk_hw *[]) {
2890 			&g12a_vdec_hevcf_sel.hw
2891 		},
2892 		.num_parents = 1,
2893 		.flags = CLK_SET_RATE_PARENT,
2894 	},
2895 };
2896 
2897 static struct clk_regmap g12a_vdec_hevcf = {
2898 	.data = &(struct clk_regmap_gate_data){
2899 		.offset = HHI_VDEC2_CLK_CNTL,
2900 		.bit_idx = 8,
2901 	},
2902 	.hw.init = &(struct clk_init_data) {
2903 		.name = "vdec_hevcf",
2904 		.ops = &clk_regmap_gate_ops,
2905 		.parent_hws = (const struct clk_hw *[]) {
2906 			&g12a_vdec_hevcf_div.hw
2907 		},
2908 		.num_parents = 1,
2909 		.flags = CLK_SET_RATE_PARENT,
2910 	},
2911 };
2912 
2913 static struct clk_regmap g12a_vdec_hevc_sel = {
2914 	.data = &(struct clk_regmap_mux_data){
2915 		.offset = HHI_VDEC2_CLK_CNTL,
2916 		.mask = 0x7,
2917 		.shift = 25,
2918 		.flags = CLK_MUX_ROUND_CLOSEST,
2919 	},
2920 	.hw.init = &(struct clk_init_data){
2921 		.name = "vdec_hevc_sel",
2922 		.ops = &clk_regmap_mux_ops,
2923 		.parent_hws = g12a_vdec_parent_hws,
2924 		.num_parents = ARRAY_SIZE(g12a_vdec_parent_hws),
2925 		.flags = CLK_SET_RATE_PARENT,
2926 	},
2927 };
2928 
2929 static struct clk_regmap g12a_vdec_hevc_div = {
2930 	.data = &(struct clk_regmap_div_data){
2931 		.offset = HHI_VDEC2_CLK_CNTL,
2932 		.shift = 16,
2933 		.width = 7,
2934 		.flags = CLK_DIVIDER_ROUND_CLOSEST,
2935 	},
2936 	.hw.init = &(struct clk_init_data){
2937 		.name = "vdec_hevc_div",
2938 		.ops = &clk_regmap_divider_ops,
2939 		.parent_hws = (const struct clk_hw *[]) {
2940 			&g12a_vdec_hevc_sel.hw
2941 		},
2942 		.num_parents = 1,
2943 		.flags = CLK_SET_RATE_PARENT,
2944 	},
2945 };
2946 
2947 static struct clk_regmap g12a_vdec_hevc = {
2948 	.data = &(struct clk_regmap_gate_data){
2949 		.offset = HHI_VDEC2_CLK_CNTL,
2950 		.bit_idx = 24,
2951 	},
2952 	.hw.init = &(struct clk_init_data) {
2953 		.name = "vdec_hevc",
2954 		.ops = &clk_regmap_gate_ops,
2955 		.parent_hws = (const struct clk_hw *[]) {
2956 			&g12a_vdec_hevc_div.hw
2957 		},
2958 		.num_parents = 1,
2959 		.flags = CLK_SET_RATE_PARENT,
2960 	},
2961 };
2962 
2963 /* VAPB Clock */
2964 
2965 static const struct clk_hw *g12a_vapb_parent_hws[] = {
2966 	&g12a_fclk_div4.hw,
2967 	&g12a_fclk_div3.hw,
2968 	&g12a_fclk_div5.hw,
2969 	&g12a_fclk_div7.hw,
2970 	&g12a_mpll1.hw,
2971 	&g12a_vid_pll.hw,
2972 	&g12a_mpll2.hw,
2973 	&g12a_fclk_div2p5.hw,
2974 };
2975 
2976 static struct clk_regmap g12a_vapb_0_sel = {
2977 	.data = &(struct clk_regmap_mux_data){
2978 		.offset = HHI_VAPBCLK_CNTL,
2979 		.mask = 0x3,
2980 		.shift = 9,
2981 	},
2982 	.hw.init = &(struct clk_init_data){
2983 		.name = "vapb_0_sel",
2984 		.ops = &clk_regmap_mux_ops,
2985 		.parent_hws = g12a_vapb_parent_hws,
2986 		.num_parents = ARRAY_SIZE(g12a_vapb_parent_hws),
2987 		.flags = CLK_SET_RATE_NO_REPARENT,
2988 	},
2989 };
2990 
2991 static struct clk_regmap g12a_vapb_0_div = {
2992 	.data = &(struct clk_regmap_div_data){
2993 		.offset = HHI_VAPBCLK_CNTL,
2994 		.shift = 0,
2995 		.width = 7,
2996 	},
2997 	.hw.init = &(struct clk_init_data){
2998 		.name = "vapb_0_div",
2999 		.ops = &clk_regmap_divider_ops,
3000 		.parent_hws = (const struct clk_hw *[]) {
3001 			&g12a_vapb_0_sel.hw
3002 		},
3003 		.num_parents = 1,
3004 		.flags = CLK_SET_RATE_PARENT,
3005 	},
3006 };
3007 
3008 static struct clk_regmap g12a_vapb_0 = {
3009 	.data = &(struct clk_regmap_gate_data){
3010 		.offset = HHI_VAPBCLK_CNTL,
3011 		.bit_idx = 8,
3012 	},
3013 	.hw.init = &(struct clk_init_data) {
3014 		.name = "vapb_0",
3015 		.ops = &clk_regmap_gate_ops,
3016 		.parent_hws = (const struct clk_hw *[]) {
3017 			&g12a_vapb_0_div.hw
3018 		},
3019 		.num_parents = 1,
3020 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3021 	},
3022 };
3023 
3024 static struct clk_regmap g12a_vapb_1_sel = {
3025 	.data = &(struct clk_regmap_mux_data){
3026 		.offset = HHI_VAPBCLK_CNTL,
3027 		.mask = 0x3,
3028 		.shift = 25,
3029 	},
3030 	.hw.init = &(struct clk_init_data){
3031 		.name = "vapb_1_sel",
3032 		.ops = &clk_regmap_mux_ops,
3033 		.parent_hws = g12a_vapb_parent_hws,
3034 		.num_parents = ARRAY_SIZE(g12a_vapb_parent_hws),
3035 		.flags = CLK_SET_RATE_NO_REPARENT,
3036 	},
3037 };
3038 
3039 static struct clk_regmap g12a_vapb_1_div = {
3040 	.data = &(struct clk_regmap_div_data){
3041 		.offset = HHI_VAPBCLK_CNTL,
3042 		.shift = 16,
3043 		.width = 7,
3044 	},
3045 	.hw.init = &(struct clk_init_data){
3046 		.name = "vapb_1_div",
3047 		.ops = &clk_regmap_divider_ops,
3048 		.parent_hws = (const struct clk_hw *[]) {
3049 			&g12a_vapb_1_sel.hw
3050 		},
3051 		.num_parents = 1,
3052 		.flags = CLK_SET_RATE_PARENT,
3053 	},
3054 };
3055 
3056 static struct clk_regmap g12a_vapb_1 = {
3057 	.data = &(struct clk_regmap_gate_data){
3058 		.offset = HHI_VAPBCLK_CNTL,
3059 		.bit_idx = 24,
3060 	},
3061 	.hw.init = &(struct clk_init_data) {
3062 		.name = "vapb_1",
3063 		.ops = &clk_regmap_gate_ops,
3064 		.parent_hws = (const struct clk_hw *[]) {
3065 			&g12a_vapb_1_div.hw
3066 		},
3067 		.num_parents = 1,
3068 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3069 	},
3070 };
3071 
3072 static struct clk_regmap g12a_vapb_sel = {
3073 	.data = &(struct clk_regmap_mux_data){
3074 		.offset = HHI_VAPBCLK_CNTL,
3075 		.mask = 1,
3076 		.shift = 31,
3077 	},
3078 	.hw.init = &(struct clk_init_data){
3079 		.name = "vapb_sel",
3080 		.ops = &clk_regmap_mux_ops,
3081 		/*
3082 		 * bit 31 selects from 2 possible parents:
3083 		 * vapb_0 or vapb_1
3084 		 */
3085 		.parent_hws = (const struct clk_hw *[]) {
3086 			&g12a_vapb_0.hw,
3087 			&g12a_vapb_1.hw,
3088 		},
3089 		.num_parents = 2,
3090 		.flags = CLK_SET_RATE_NO_REPARENT,
3091 	},
3092 };
3093 
3094 static struct clk_regmap g12a_vapb = {
3095 	.data = &(struct clk_regmap_gate_data){
3096 		.offset = HHI_VAPBCLK_CNTL,
3097 		.bit_idx = 30,
3098 	},
3099 	.hw.init = &(struct clk_init_data) {
3100 		.name = "vapb",
3101 		.ops = &clk_regmap_gate_ops,
3102 		.parent_hws = (const struct clk_hw *[]) { &g12a_vapb_sel.hw },
3103 		.num_parents = 1,
3104 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3105 	},
3106 };
3107 
3108 static const struct clk_hw *g12a_vclk_parent_hws[] = {
3109 	&g12a_vid_pll.hw,
3110 	&g12a_gp0_pll.hw,
3111 	&g12a_hifi_pll.hw,
3112 	&g12a_mpll1.hw,
3113 	&g12a_fclk_div3.hw,
3114 	&g12a_fclk_div4.hw,
3115 	&g12a_fclk_div5.hw,
3116 	&g12a_fclk_div7.hw,
3117 };
3118 
3119 static struct clk_regmap g12a_vclk_sel = {
3120 	.data = &(struct clk_regmap_mux_data){
3121 		.offset = HHI_VID_CLK_CNTL,
3122 		.mask = 0x7,
3123 		.shift = 16,
3124 	},
3125 	.hw.init = &(struct clk_init_data){
3126 		.name = "vclk_sel",
3127 		.ops = &clk_regmap_mux_ops,
3128 		.parent_hws = g12a_vclk_parent_hws,
3129 		.num_parents = ARRAY_SIZE(g12a_vclk_parent_hws),
3130 		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3131 	},
3132 };
3133 
3134 static struct clk_regmap g12a_vclk2_sel = {
3135 	.data = &(struct clk_regmap_mux_data){
3136 		.offset = HHI_VIID_CLK_CNTL,
3137 		.mask = 0x7,
3138 		.shift = 16,
3139 	},
3140 	.hw.init = &(struct clk_init_data){
3141 		.name = "vclk2_sel",
3142 		.ops = &clk_regmap_mux_ops,
3143 		.parent_hws = g12a_vclk_parent_hws,
3144 		.num_parents = ARRAY_SIZE(g12a_vclk_parent_hws),
3145 		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3146 	},
3147 };
3148 
3149 static struct clk_regmap g12a_vclk_input = {
3150 	.data = &(struct clk_regmap_gate_data){
3151 		.offset = HHI_VID_CLK_DIV,
3152 		.bit_idx = 16,
3153 	},
3154 	.hw.init = &(struct clk_init_data) {
3155 		.name = "vclk_input",
3156 		.ops = &clk_regmap_gate_ops,
3157 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk_sel.hw },
3158 		.num_parents = 1,
3159 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3160 	},
3161 };
3162 
3163 static struct clk_regmap g12a_vclk2_input = {
3164 	.data = &(struct clk_regmap_gate_data){
3165 		.offset = HHI_VIID_CLK_DIV,
3166 		.bit_idx = 16,
3167 	},
3168 	.hw.init = &(struct clk_init_data) {
3169 		.name = "vclk2_input",
3170 		.ops = &clk_regmap_gate_ops,
3171 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk2_sel.hw },
3172 		.num_parents = 1,
3173 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3174 	},
3175 };
3176 
3177 static struct clk_regmap g12a_vclk_div = {
3178 	.data = &(struct clk_regmap_div_data){
3179 		.offset = HHI_VID_CLK_DIV,
3180 		.shift = 0,
3181 		.width = 8,
3182 	},
3183 	.hw.init = &(struct clk_init_data){
3184 		.name = "vclk_div",
3185 		.ops = &clk_regmap_divider_ops,
3186 		.parent_hws = (const struct clk_hw *[]) {
3187 			&g12a_vclk_input.hw
3188 		},
3189 		.num_parents = 1,
3190 		.flags = CLK_GET_RATE_NOCACHE,
3191 	},
3192 };
3193 
3194 static struct clk_regmap g12a_vclk2_div = {
3195 	.data = &(struct clk_regmap_div_data){
3196 		.offset = HHI_VIID_CLK_DIV,
3197 		.shift = 0,
3198 		.width = 8,
3199 	},
3200 	.hw.init = &(struct clk_init_data){
3201 		.name = "vclk2_div",
3202 		.ops = &clk_regmap_divider_ops,
3203 		.parent_hws = (const struct clk_hw *[]) {
3204 			&g12a_vclk2_input.hw
3205 		},
3206 		.num_parents = 1,
3207 		.flags = CLK_GET_RATE_NOCACHE,
3208 	},
3209 };
3210 
3211 static struct clk_regmap g12a_vclk = {
3212 	.data = &(struct clk_regmap_gate_data){
3213 		.offset = HHI_VID_CLK_CNTL,
3214 		.bit_idx = 19,
3215 	},
3216 	.hw.init = &(struct clk_init_data) {
3217 		.name = "vclk",
3218 		.ops = &clk_regmap_gate_ops,
3219 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk_div.hw },
3220 		.num_parents = 1,
3221 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3222 	},
3223 };
3224 
3225 static struct clk_regmap g12a_vclk2 = {
3226 	.data = &(struct clk_regmap_gate_data){
3227 		.offset = HHI_VIID_CLK_CNTL,
3228 		.bit_idx = 19,
3229 	},
3230 	.hw.init = &(struct clk_init_data) {
3231 		.name = "vclk2",
3232 		.ops = &clk_regmap_gate_ops,
3233 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk2_div.hw },
3234 		.num_parents = 1,
3235 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3236 	},
3237 };
3238 
3239 static struct clk_regmap g12a_vclk_div1 = {
3240 	.data = &(struct clk_regmap_gate_data){
3241 		.offset = HHI_VID_CLK_CNTL,
3242 		.bit_idx = 0,
3243 	},
3244 	.hw.init = &(struct clk_init_data) {
3245 		.name = "vclk_div1",
3246 		.ops = &clk_regmap_gate_ops,
3247 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3248 		.num_parents = 1,
3249 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3250 	},
3251 };
3252 
3253 static struct clk_regmap g12a_vclk_div2_en = {
3254 	.data = &(struct clk_regmap_gate_data){
3255 		.offset = HHI_VID_CLK_CNTL,
3256 		.bit_idx = 1,
3257 	},
3258 	.hw.init = &(struct clk_init_data) {
3259 		.name = "vclk_div2_en",
3260 		.ops = &clk_regmap_gate_ops,
3261 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3262 		.num_parents = 1,
3263 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3264 	},
3265 };
3266 
3267 static struct clk_regmap g12a_vclk_div4_en = {
3268 	.data = &(struct clk_regmap_gate_data){
3269 		.offset = HHI_VID_CLK_CNTL,
3270 		.bit_idx = 2,
3271 	},
3272 	.hw.init = &(struct clk_init_data) {
3273 		.name = "vclk_div4_en",
3274 		.ops = &clk_regmap_gate_ops,
3275 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3276 		.num_parents = 1,
3277 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3278 	},
3279 };
3280 
3281 static struct clk_regmap g12a_vclk_div6_en = {
3282 	.data = &(struct clk_regmap_gate_data){
3283 		.offset = HHI_VID_CLK_CNTL,
3284 		.bit_idx = 3,
3285 	},
3286 	.hw.init = &(struct clk_init_data) {
3287 		.name = "vclk_div6_en",
3288 		.ops = &clk_regmap_gate_ops,
3289 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3290 		.num_parents = 1,
3291 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3292 	},
3293 };
3294 
3295 static struct clk_regmap g12a_vclk_div12_en = {
3296 	.data = &(struct clk_regmap_gate_data){
3297 		.offset = HHI_VID_CLK_CNTL,
3298 		.bit_idx = 4,
3299 	},
3300 	.hw.init = &(struct clk_init_data) {
3301 		.name = "vclk_div12_en",
3302 		.ops = &clk_regmap_gate_ops,
3303 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3304 		.num_parents = 1,
3305 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3306 	},
3307 };
3308 
3309 static struct clk_regmap g12a_vclk2_div1 = {
3310 	.data = &(struct clk_regmap_gate_data){
3311 		.offset = HHI_VIID_CLK_CNTL,
3312 		.bit_idx = 0,
3313 	},
3314 	.hw.init = &(struct clk_init_data) {
3315 		.name = "vclk2_div1",
3316 		.ops = &clk_regmap_gate_ops,
3317 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3318 		.num_parents = 1,
3319 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3320 	},
3321 };
3322 
3323 static struct clk_regmap g12a_vclk2_div2_en = {
3324 	.data = &(struct clk_regmap_gate_data){
3325 		.offset = HHI_VIID_CLK_CNTL,
3326 		.bit_idx = 1,
3327 	},
3328 	.hw.init = &(struct clk_init_data) {
3329 		.name = "vclk2_div2_en",
3330 		.ops = &clk_regmap_gate_ops,
3331 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3332 		.num_parents = 1,
3333 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3334 	},
3335 };
3336 
3337 static struct clk_regmap g12a_vclk2_div4_en = {
3338 	.data = &(struct clk_regmap_gate_data){
3339 		.offset = HHI_VIID_CLK_CNTL,
3340 		.bit_idx = 2,
3341 	},
3342 	.hw.init = &(struct clk_init_data) {
3343 		.name = "vclk2_div4_en",
3344 		.ops = &clk_regmap_gate_ops,
3345 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3346 		.num_parents = 1,
3347 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3348 	},
3349 };
3350 
3351 static struct clk_regmap g12a_vclk2_div6_en = {
3352 	.data = &(struct clk_regmap_gate_data){
3353 		.offset = HHI_VIID_CLK_CNTL,
3354 		.bit_idx = 3,
3355 	},
3356 	.hw.init = &(struct clk_init_data) {
3357 		.name = "vclk2_div6_en",
3358 		.ops = &clk_regmap_gate_ops,
3359 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3360 		.num_parents = 1,
3361 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3362 	},
3363 };
3364 
3365 static struct clk_regmap g12a_vclk2_div12_en = {
3366 	.data = &(struct clk_regmap_gate_data){
3367 		.offset = HHI_VIID_CLK_CNTL,
3368 		.bit_idx = 4,
3369 	},
3370 	.hw.init = &(struct clk_init_data) {
3371 		.name = "vclk2_div12_en",
3372 		.ops = &clk_regmap_gate_ops,
3373 		.parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3374 		.num_parents = 1,
3375 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3376 	},
3377 };
3378 
3379 static struct clk_fixed_factor g12a_vclk_div2 = {
3380 	.mult = 1,
3381 	.div = 2,
3382 	.hw.init = &(struct clk_init_data){
3383 		.name = "vclk_div2",
3384 		.ops = &clk_fixed_factor_ops,
3385 		.parent_hws = (const struct clk_hw *[]) {
3386 			&g12a_vclk_div2_en.hw
3387 		},
3388 		.num_parents = 1,
3389 	},
3390 };
3391 
3392 static struct clk_fixed_factor g12a_vclk_div4 = {
3393 	.mult = 1,
3394 	.div = 4,
3395 	.hw.init = &(struct clk_init_data){
3396 		.name = "vclk_div4",
3397 		.ops = &clk_fixed_factor_ops,
3398 		.parent_hws = (const struct clk_hw *[]) {
3399 			&g12a_vclk_div4_en.hw
3400 		},
3401 		.num_parents = 1,
3402 	},
3403 };
3404 
3405 static struct clk_fixed_factor g12a_vclk_div6 = {
3406 	.mult = 1,
3407 	.div = 6,
3408 	.hw.init = &(struct clk_init_data){
3409 		.name = "vclk_div6",
3410 		.ops = &clk_fixed_factor_ops,
3411 		.parent_hws = (const struct clk_hw *[]) {
3412 			&g12a_vclk_div6_en.hw
3413 		},
3414 		.num_parents = 1,
3415 	},
3416 };
3417 
3418 static struct clk_fixed_factor g12a_vclk_div12 = {
3419 	.mult = 1,
3420 	.div = 12,
3421 	.hw.init = &(struct clk_init_data){
3422 		.name = "vclk_div12",
3423 		.ops = &clk_fixed_factor_ops,
3424 		.parent_hws = (const struct clk_hw *[]) {
3425 			&g12a_vclk_div12_en.hw
3426 		},
3427 		.num_parents = 1,
3428 	},
3429 };
3430 
3431 static struct clk_fixed_factor g12a_vclk2_div2 = {
3432 	.mult = 1,
3433 	.div = 2,
3434 	.hw.init = &(struct clk_init_data){
3435 		.name = "vclk2_div2",
3436 		.ops = &clk_fixed_factor_ops,
3437 		.parent_hws = (const struct clk_hw *[]) {
3438 			&g12a_vclk2_div2_en.hw
3439 		},
3440 		.num_parents = 1,
3441 	},
3442 };
3443 
3444 static struct clk_fixed_factor g12a_vclk2_div4 = {
3445 	.mult = 1,
3446 	.div = 4,
3447 	.hw.init = &(struct clk_init_data){
3448 		.name = "vclk2_div4",
3449 		.ops = &clk_fixed_factor_ops,
3450 		.parent_hws = (const struct clk_hw *[]) {
3451 			&g12a_vclk2_div4_en.hw
3452 		},
3453 		.num_parents = 1,
3454 	},
3455 };
3456 
3457 static struct clk_fixed_factor g12a_vclk2_div6 = {
3458 	.mult = 1,
3459 	.div = 6,
3460 	.hw.init = &(struct clk_init_data){
3461 		.name = "vclk2_div6",
3462 		.ops = &clk_fixed_factor_ops,
3463 		.parent_hws = (const struct clk_hw *[]) {
3464 			&g12a_vclk2_div6_en.hw
3465 		},
3466 		.num_parents = 1,
3467 	},
3468 };
3469 
3470 static struct clk_fixed_factor g12a_vclk2_div12 = {
3471 	.mult = 1,
3472 	.div = 12,
3473 	.hw.init = &(struct clk_init_data){
3474 		.name = "vclk2_div12",
3475 		.ops = &clk_fixed_factor_ops,
3476 		.parent_hws = (const struct clk_hw *[]) {
3477 			&g12a_vclk2_div12_en.hw
3478 		},
3479 		.num_parents = 1,
3480 	},
3481 };
3482 
3483 static u32 mux_table_cts_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 };
3484 static const struct clk_hw *g12a_cts_parent_hws[] = {
3485 	&g12a_vclk_div1.hw,
3486 	&g12a_vclk_div2.hw,
3487 	&g12a_vclk_div4.hw,
3488 	&g12a_vclk_div6.hw,
3489 	&g12a_vclk_div12.hw,
3490 	&g12a_vclk2_div1.hw,
3491 	&g12a_vclk2_div2.hw,
3492 	&g12a_vclk2_div4.hw,
3493 	&g12a_vclk2_div6.hw,
3494 	&g12a_vclk2_div12.hw,
3495 };
3496 
3497 static struct clk_regmap g12a_cts_enci_sel = {
3498 	.data = &(struct clk_regmap_mux_data){
3499 		.offset = HHI_VID_CLK_DIV,
3500 		.mask = 0xf,
3501 		.shift = 28,
3502 		.table = mux_table_cts_sel,
3503 	},
3504 	.hw.init = &(struct clk_init_data){
3505 		.name = "cts_enci_sel",
3506 		.ops = &clk_regmap_mux_ops,
3507 		.parent_hws = g12a_cts_parent_hws,
3508 		.num_parents = ARRAY_SIZE(g12a_cts_parent_hws),
3509 		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3510 	},
3511 };
3512 
3513 static struct clk_regmap g12a_cts_encp_sel = {
3514 	.data = &(struct clk_regmap_mux_data){
3515 		.offset = HHI_VID_CLK_DIV,
3516 		.mask = 0xf,
3517 		.shift = 20,
3518 		.table = mux_table_cts_sel,
3519 	},
3520 	.hw.init = &(struct clk_init_data){
3521 		.name = "cts_encp_sel",
3522 		.ops = &clk_regmap_mux_ops,
3523 		.parent_hws = g12a_cts_parent_hws,
3524 		.num_parents = ARRAY_SIZE(g12a_cts_parent_hws),
3525 		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3526 	},
3527 };
3528 
3529 static struct clk_regmap g12a_cts_vdac_sel = {
3530 	.data = &(struct clk_regmap_mux_data){
3531 		.offset = HHI_VIID_CLK_DIV,
3532 		.mask = 0xf,
3533 		.shift = 28,
3534 		.table = mux_table_cts_sel,
3535 	},
3536 	.hw.init = &(struct clk_init_data){
3537 		.name = "cts_vdac_sel",
3538 		.ops = &clk_regmap_mux_ops,
3539 		.parent_hws = g12a_cts_parent_hws,
3540 		.num_parents = ARRAY_SIZE(g12a_cts_parent_hws),
3541 		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3542 	},
3543 };
3544 
3545 /* TOFIX: add support for cts_tcon */
3546 static u32 mux_table_hdmi_tx_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 };
3547 static const struct clk_hw *g12a_cts_hdmi_tx_parent_hws[] = {
3548 	&g12a_vclk_div1.hw,
3549 	&g12a_vclk_div2.hw,
3550 	&g12a_vclk_div4.hw,
3551 	&g12a_vclk_div6.hw,
3552 	&g12a_vclk_div12.hw,
3553 	&g12a_vclk2_div1.hw,
3554 	&g12a_vclk2_div2.hw,
3555 	&g12a_vclk2_div4.hw,
3556 	&g12a_vclk2_div6.hw,
3557 	&g12a_vclk2_div12.hw,
3558 };
3559 
3560 static struct clk_regmap g12a_hdmi_tx_sel = {
3561 	.data = &(struct clk_regmap_mux_data){
3562 		.offset = HHI_HDMI_CLK_CNTL,
3563 		.mask = 0xf,
3564 		.shift = 16,
3565 		.table = mux_table_hdmi_tx_sel,
3566 	},
3567 	.hw.init = &(struct clk_init_data){
3568 		.name = "hdmi_tx_sel",
3569 		.ops = &clk_regmap_mux_ops,
3570 		.parent_hws = g12a_cts_hdmi_tx_parent_hws,
3571 		.num_parents = ARRAY_SIZE(g12a_cts_hdmi_tx_parent_hws),
3572 		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3573 	},
3574 };
3575 
3576 static struct clk_regmap g12a_cts_enci = {
3577 	.data = &(struct clk_regmap_gate_data){
3578 		.offset = HHI_VID_CLK_CNTL2,
3579 		.bit_idx = 0,
3580 	},
3581 	.hw.init = &(struct clk_init_data) {
3582 		.name = "cts_enci",
3583 		.ops = &clk_regmap_gate_ops,
3584 		.parent_hws = (const struct clk_hw *[]) {
3585 			&g12a_cts_enci_sel.hw
3586 		},
3587 		.num_parents = 1,
3588 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3589 	},
3590 };
3591 
3592 static struct clk_regmap g12a_cts_encp = {
3593 	.data = &(struct clk_regmap_gate_data){
3594 		.offset = HHI_VID_CLK_CNTL2,
3595 		.bit_idx = 2,
3596 	},
3597 	.hw.init = &(struct clk_init_data) {
3598 		.name = "cts_encp",
3599 		.ops = &clk_regmap_gate_ops,
3600 		.parent_hws = (const struct clk_hw *[]) {
3601 			&g12a_cts_encp_sel.hw
3602 		},
3603 		.num_parents = 1,
3604 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3605 	},
3606 };
3607 
3608 static struct clk_regmap g12a_cts_vdac = {
3609 	.data = &(struct clk_regmap_gate_data){
3610 		.offset = HHI_VID_CLK_CNTL2,
3611 		.bit_idx = 4,
3612 	},
3613 	.hw.init = &(struct clk_init_data) {
3614 		.name = "cts_vdac",
3615 		.ops = &clk_regmap_gate_ops,
3616 		.parent_hws = (const struct clk_hw *[]) {
3617 			&g12a_cts_vdac_sel.hw
3618 		},
3619 		.num_parents = 1,
3620 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3621 	},
3622 };
3623 
3624 static struct clk_regmap g12a_hdmi_tx = {
3625 	.data = &(struct clk_regmap_gate_data){
3626 		.offset = HHI_VID_CLK_CNTL2,
3627 		.bit_idx = 5,
3628 	},
3629 	.hw.init = &(struct clk_init_data) {
3630 		.name = "hdmi_tx",
3631 		.ops = &clk_regmap_gate_ops,
3632 		.parent_hws = (const struct clk_hw *[]) {
3633 			&g12a_hdmi_tx_sel.hw
3634 		},
3635 		.num_parents = 1,
3636 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3637 	},
3638 };
3639 
3640 /* HDMI Clocks */
3641 
3642 static const struct clk_parent_data g12a_hdmi_parent_data[] = {
3643 	{ .fw_name = "xtal", },
3644 	{ .hw = &g12a_fclk_div4.hw },
3645 	{ .hw = &g12a_fclk_div3.hw },
3646 	{ .hw = &g12a_fclk_div5.hw },
3647 };
3648 
3649 static struct clk_regmap g12a_hdmi_sel = {
3650 	.data = &(struct clk_regmap_mux_data){
3651 		.offset = HHI_HDMI_CLK_CNTL,
3652 		.mask = 0x3,
3653 		.shift = 9,
3654 		.flags = CLK_MUX_ROUND_CLOSEST,
3655 	},
3656 	.hw.init = &(struct clk_init_data){
3657 		.name = "hdmi_sel",
3658 		.ops = &clk_regmap_mux_ops,
3659 		.parent_data = g12a_hdmi_parent_data,
3660 		.num_parents = ARRAY_SIZE(g12a_hdmi_parent_data),
3661 		.flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3662 	},
3663 };
3664 
3665 static struct clk_regmap g12a_hdmi_div = {
3666 	.data = &(struct clk_regmap_div_data){
3667 		.offset = HHI_HDMI_CLK_CNTL,
3668 		.shift = 0,
3669 		.width = 7,
3670 	},
3671 	.hw.init = &(struct clk_init_data){
3672 		.name = "hdmi_div",
3673 		.ops = &clk_regmap_divider_ops,
3674 		.parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_sel.hw },
3675 		.num_parents = 1,
3676 		.flags = CLK_GET_RATE_NOCACHE,
3677 	},
3678 };
3679 
3680 static struct clk_regmap g12a_hdmi = {
3681 	.data = &(struct clk_regmap_gate_data){
3682 		.offset = HHI_HDMI_CLK_CNTL,
3683 		.bit_idx = 8,
3684 	},
3685 	.hw.init = &(struct clk_init_data) {
3686 		.name = "hdmi",
3687 		.ops = &clk_regmap_gate_ops,
3688 		.parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_div.hw },
3689 		.num_parents = 1,
3690 		.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3691 	},
3692 };
3693 
3694 /*
3695  * The MALI IP is clocked by two identical clocks (mali_0 and mali_1)
3696  * muxed by a glitch-free switch.
3697  */
3698 static const struct clk_parent_data g12a_mali_0_1_parent_data[] = {
3699 	{ .fw_name = "xtal", },
3700 	{ .hw = &g12a_gp0_pll.hw },
3701 	{ .hw = &g12a_hifi_pll.hw },
3702 	{ .hw = &g12a_fclk_div2p5.hw },
3703 	{ .hw = &g12a_fclk_div3.hw },
3704 	{ .hw = &g12a_fclk_div4.hw },
3705 	{ .hw = &g12a_fclk_div5.hw },
3706 	{ .hw = &g12a_fclk_div7.hw },
3707 };
3708 
3709 static struct clk_regmap g12a_mali_0_sel = {
3710 	.data = &(struct clk_regmap_mux_data){
3711 		.offset = HHI_MALI_CLK_CNTL,
3712 		.mask = 0x7,
3713 		.shift = 9,
3714 	},
3715 	.hw.init = &(struct clk_init_data){
3716 		.name = "mali_0_sel",
3717 		.ops = &clk_regmap_mux_ops,
3718 		.parent_data = g12a_mali_0_1_parent_data,
3719 		.num_parents = 8,
3720 		.flags = CLK_SET_RATE_NO_REPARENT,
3721 	},
3722 };
3723 
3724 static struct clk_regmap g12a_mali_0_div = {
3725 	.data = &(struct clk_regmap_div_data){
3726 		.offset = HHI_MALI_CLK_CNTL,
3727 		.shift = 0,
3728 		.width = 7,
3729 	},
3730 	.hw.init = &(struct clk_init_data){
3731 		.name = "mali_0_div",
3732 		.ops = &clk_regmap_divider_ops,
3733 		.parent_hws = (const struct clk_hw *[]) {
3734 			&g12a_mali_0_sel.hw
3735 		},
3736 		.num_parents = 1,
3737 		.flags = CLK_SET_RATE_NO_REPARENT,
3738 	},
3739 };
3740 
3741 static struct clk_regmap g12a_mali_0 = {
3742 	.data = &(struct clk_regmap_gate_data){
3743 		.offset = HHI_MALI_CLK_CNTL,
3744 		.bit_idx = 8,
3745 	},
3746 	.hw.init = &(struct clk_init_data){
3747 		.name = "mali_0",
3748 		.ops = &clk_regmap_gate_ops,
3749 		.parent_hws = (const struct clk_hw *[]) {
3750 			&g12a_mali_0_div.hw
3751 		},
3752 		.num_parents = 1,
3753 		.flags = CLK_SET_RATE_PARENT,
3754 	},
3755 };
3756 
3757 static struct clk_regmap g12a_mali_1_sel = {
3758 	.data = &(struct clk_regmap_mux_data){
3759 		.offset = HHI_MALI_CLK_CNTL,
3760 		.mask = 0x7,
3761 		.shift = 25,
3762 	},
3763 	.hw.init = &(struct clk_init_data){
3764 		.name = "mali_1_sel",
3765 		.ops = &clk_regmap_mux_ops,
3766 		.parent_data = g12a_mali_0_1_parent_data,
3767 		.num_parents = 8,
3768 		.flags = CLK_SET_RATE_NO_REPARENT,
3769 	},
3770 };
3771 
3772 static struct clk_regmap g12a_mali_1_div = {
3773 	.data = &(struct clk_regmap_div_data){
3774 		.offset = HHI_MALI_CLK_CNTL,
3775 		.shift = 16,
3776 		.width = 7,
3777 	},
3778 	.hw.init = &(struct clk_init_data){
3779 		.name = "mali_1_div",
3780 		.ops = &clk_regmap_divider_ops,
3781 		.parent_hws = (const struct clk_hw *[]) {
3782 			&g12a_mali_1_sel.hw
3783 		},
3784 		.num_parents = 1,
3785 		.flags = CLK_SET_RATE_NO_REPARENT,
3786 	},
3787 };
3788 
3789 static struct clk_regmap g12a_mali_1 = {
3790 	.data = &(struct clk_regmap_gate_data){
3791 		.offset = HHI_MALI_CLK_CNTL,
3792 		.bit_idx = 24,
3793 	},
3794 	.hw.init = &(struct clk_init_data){
3795 		.name = "mali_1",
3796 		.ops = &clk_regmap_gate_ops,
3797 		.parent_hws = (const struct clk_hw *[]) {
3798 			&g12a_mali_1_div.hw
3799 		},
3800 		.num_parents = 1,
3801 		.flags = CLK_SET_RATE_PARENT,
3802 	},
3803 };
3804 
3805 static const struct clk_hw *g12a_mali_parent_hws[] = {
3806 	&g12a_mali_0.hw,
3807 	&g12a_mali_1.hw,
3808 };
3809 
3810 static struct clk_regmap g12a_mali = {
3811 	.data = &(struct clk_regmap_mux_data){
3812 		.offset = HHI_MALI_CLK_CNTL,
3813 		.mask = 1,
3814 		.shift = 31,
3815 	},
3816 	.hw.init = &(struct clk_init_data){
3817 		.name = "mali",
3818 		.ops = &clk_regmap_mux_ops,
3819 		.parent_hws = g12a_mali_parent_hws,
3820 		.num_parents = 2,
3821 		.flags = CLK_SET_RATE_NO_REPARENT,
3822 	},
3823 };
3824 
3825 static struct clk_regmap g12a_ts_div = {
3826 	.data = &(struct clk_regmap_div_data){
3827 		.offset = HHI_TS_CLK_CNTL,
3828 		.shift = 0,
3829 		.width = 8,
3830 	},
3831 	.hw.init = &(struct clk_init_data){
3832 		.name = "ts_div",
3833 		.ops = &clk_regmap_divider_ro_ops,
3834 		.parent_data = &(const struct clk_parent_data) {
3835 			.fw_name = "xtal",
3836 		},
3837 		.num_parents = 1,
3838 	},
3839 };
3840 
3841 static struct clk_regmap g12a_ts = {
3842 	.data = &(struct clk_regmap_gate_data){
3843 		.offset = HHI_TS_CLK_CNTL,
3844 		.bit_idx = 8,
3845 	},
3846 	.hw.init = &(struct clk_init_data){
3847 		.name = "ts",
3848 		.ops = &clk_regmap_gate_ops,
3849 		.parent_hws = (const struct clk_hw *[]) {
3850 			&g12a_ts_div.hw
3851 		},
3852 		.num_parents = 1,
3853 	},
3854 };
3855 
3856 #define MESON_GATE(_name, _reg, _bit) \
3857 	MESON_PCLK(_name, _reg, _bit, &g12a_clk81.hw)
3858 
3859 #define MESON_GATE_RO(_name, _reg, _bit) \
3860 	MESON_PCLK_RO(_name, _reg, _bit, &g12a_clk81.hw)
3861 
3862 /* Everything Else (EE) domain gates */
3863 static MESON_GATE(g12a_ddr,			HHI_GCLK_MPEG0,	0);
3864 static MESON_GATE(g12a_dos,			HHI_GCLK_MPEG0,	1);
3865 static MESON_GATE(g12a_audio_locker,		HHI_GCLK_MPEG0,	2);
3866 static MESON_GATE(g12a_mipi_dsi_host,		HHI_GCLK_MPEG0,	3);
3867 static MESON_GATE(g12a_eth_phy,			HHI_GCLK_MPEG0,	4);
3868 static MESON_GATE(g12a_isa,			HHI_GCLK_MPEG0,	5);
3869 static MESON_GATE(g12a_pl301,			HHI_GCLK_MPEG0,	6);
3870 static MESON_GATE(g12a_periphs,			HHI_GCLK_MPEG0,	7);
3871 static MESON_GATE(g12a_spicc_0,			HHI_GCLK_MPEG0,	8);
3872 static MESON_GATE(g12a_i2c,			HHI_GCLK_MPEG0,	9);
3873 static MESON_GATE(g12a_sana,			HHI_GCLK_MPEG0,	10);
3874 static MESON_GATE(g12a_sd,			HHI_GCLK_MPEG0,	11);
3875 static MESON_GATE(g12a_rng0,			HHI_GCLK_MPEG0,	12);
3876 static MESON_GATE(g12a_uart0,			HHI_GCLK_MPEG0,	13);
3877 static MESON_GATE(g12a_spicc_1,			HHI_GCLK_MPEG0,	14);
3878 static MESON_GATE(g12a_hiu_reg,			HHI_GCLK_MPEG0,	19);
3879 static MESON_GATE(g12a_mipi_dsi_phy,		HHI_GCLK_MPEG0,	20);
3880 static MESON_GATE(g12a_assist_misc,		HHI_GCLK_MPEG0,	23);
3881 static MESON_GATE(g12a_emmc_a,			HHI_GCLK_MPEG0,	4);
3882 static MESON_GATE(g12a_emmc_b,			HHI_GCLK_MPEG0,	25);
3883 static MESON_GATE(g12a_emmc_c,			HHI_GCLK_MPEG0,	26);
3884 static MESON_GATE(g12a_audio_codec,		HHI_GCLK_MPEG0,	28);
3885 
3886 static MESON_GATE(g12a_audio,			HHI_GCLK_MPEG1,	0);
3887 static MESON_GATE(g12a_eth_core,		HHI_GCLK_MPEG1,	3);
3888 static MESON_GATE(g12a_demux,			HHI_GCLK_MPEG1,	4);
3889 static MESON_GATE(g12a_audio_ififo,		HHI_GCLK_MPEG1,	11);
3890 static MESON_GATE(g12a_adc,			HHI_GCLK_MPEG1,	13);
3891 static MESON_GATE(g12a_uart1,			HHI_GCLK_MPEG1,	16);
3892 static MESON_GATE(g12a_g2d,			HHI_GCLK_MPEG1,	20);
3893 static MESON_GATE(g12a_reset,			HHI_GCLK_MPEG1,	23);
3894 static MESON_GATE(g12a_pcie_comb,		HHI_GCLK_MPEG1,	24);
3895 static MESON_GATE(g12a_parser,			HHI_GCLK_MPEG1,	25);
3896 static MESON_GATE(g12a_usb_general,		HHI_GCLK_MPEG1,	26);
3897 static MESON_GATE(g12a_pcie_phy,		HHI_GCLK_MPEG1,	27);
3898 static MESON_GATE(g12a_ahb_arb0,		HHI_GCLK_MPEG1,	29);
3899 
3900 static MESON_GATE(g12a_ahb_data_bus,		HHI_GCLK_MPEG2,	1);
3901 static MESON_GATE(g12a_ahb_ctrl_bus,		HHI_GCLK_MPEG2,	2);
3902 static MESON_GATE(g12a_htx_hdcp22,		HHI_GCLK_MPEG2,	3);
3903 static MESON_GATE(g12a_htx_pclk,		HHI_GCLK_MPEG2,	4);
3904 static MESON_GATE(g12a_bt656,			HHI_GCLK_MPEG2,	6);
3905 static MESON_GATE(g12a_usb1_to_ddr,		HHI_GCLK_MPEG2,	8);
3906 static MESON_GATE(g12a_mmc_pclk,		HHI_GCLK_MPEG2,	11);
3907 static MESON_GATE(g12a_uart2,			HHI_GCLK_MPEG2,	15);
3908 static MESON_GATE(g12a_vpu_intr,		HHI_GCLK_MPEG2,	25);
3909 static MESON_GATE(g12a_gic,			HHI_GCLK_MPEG2,	30);
3910 
3911 static MESON_GATE(g12a_vclk2_venci0,		HHI_GCLK_OTHER,	1);
3912 static MESON_GATE(g12a_vclk2_venci1,		HHI_GCLK_OTHER,	2);
3913 static MESON_GATE(g12a_vclk2_vencp0,		HHI_GCLK_OTHER,	3);
3914 static MESON_GATE(g12a_vclk2_vencp1,		HHI_GCLK_OTHER,	4);
3915 static MESON_GATE(g12a_vclk2_venct0,		HHI_GCLK_OTHER,	5);
3916 static MESON_GATE(g12a_vclk2_venct1,		HHI_GCLK_OTHER,	6);
3917 static MESON_GATE(g12a_vclk2_other,		HHI_GCLK_OTHER,	7);
3918 static MESON_GATE(g12a_vclk2_enci,		HHI_GCLK_OTHER,	8);
3919 static MESON_GATE(g12a_vclk2_encp,		HHI_GCLK_OTHER,	9);
3920 static MESON_GATE(g12a_dac_clk,			HHI_GCLK_OTHER,	10);
3921 static MESON_GATE(g12a_aoclk_gate,		HHI_GCLK_OTHER,	14);
3922 static MESON_GATE(g12a_iec958_gate,		HHI_GCLK_OTHER,	16);
3923 static MESON_GATE(g12a_enc480p,			HHI_GCLK_OTHER,	20);
3924 static MESON_GATE(g12a_rng1,			HHI_GCLK_OTHER,	21);
3925 static MESON_GATE(g12a_vclk2_enct,		HHI_GCLK_OTHER,	22);
3926 static MESON_GATE(g12a_vclk2_encl,		HHI_GCLK_OTHER,	23);
3927 static MESON_GATE(g12a_vclk2_venclmmc,		HHI_GCLK_OTHER,	24);
3928 static MESON_GATE(g12a_vclk2_vencl,		HHI_GCLK_OTHER,	25);
3929 static MESON_GATE(g12a_vclk2_other1,		HHI_GCLK_OTHER,	26);
3930 
3931 static MESON_GATE_RO(g12a_dma,			HHI_GCLK_OTHER2, 0);
3932 static MESON_GATE_RO(g12a_efuse,		HHI_GCLK_OTHER2, 1);
3933 static MESON_GATE_RO(g12a_rom_boot,		HHI_GCLK_OTHER2, 2);
3934 static MESON_GATE_RO(g12a_reset_sec,		HHI_GCLK_OTHER2, 3);
3935 static MESON_GATE_RO(g12a_sec_ahb_apb3,		HHI_GCLK_OTHER2, 4);
3936 
3937 /* Array of all clocks provided by this provider */
3938 static struct clk_hw_onecell_data g12a_hw_onecell_data = {
3939 	.hws = {
3940 		[CLKID_SYS_PLL]			= &g12a_sys_pll.hw,
3941 		[CLKID_FIXED_PLL]		= &g12a_fixed_pll.hw,
3942 		[CLKID_FCLK_DIV2]		= &g12a_fclk_div2.hw,
3943 		[CLKID_FCLK_DIV3]		= &g12a_fclk_div3.hw,
3944 		[CLKID_FCLK_DIV4]		= &g12a_fclk_div4.hw,
3945 		[CLKID_FCLK_DIV5]		= &g12a_fclk_div5.hw,
3946 		[CLKID_FCLK_DIV7]		= &g12a_fclk_div7.hw,
3947 		[CLKID_FCLK_DIV2P5]		= &g12a_fclk_div2p5.hw,
3948 		[CLKID_GP0_PLL]			= &g12a_gp0_pll.hw,
3949 		[CLKID_MPEG_SEL]		= &g12a_mpeg_clk_sel.hw,
3950 		[CLKID_MPEG_DIV]		= &g12a_mpeg_clk_div.hw,
3951 		[CLKID_CLK81]			= &g12a_clk81.hw,
3952 		[CLKID_MPLL0]			= &g12a_mpll0.hw,
3953 		[CLKID_MPLL1]			= &g12a_mpll1.hw,
3954 		[CLKID_MPLL2]			= &g12a_mpll2.hw,
3955 		[CLKID_MPLL3]			= &g12a_mpll3.hw,
3956 		[CLKID_DDR]			= &g12a_ddr.hw,
3957 		[CLKID_DOS]			= &g12a_dos.hw,
3958 		[CLKID_AUDIO_LOCKER]		= &g12a_audio_locker.hw,
3959 		[CLKID_MIPI_DSI_HOST]		= &g12a_mipi_dsi_host.hw,
3960 		[CLKID_ETH_PHY]			= &g12a_eth_phy.hw,
3961 		[CLKID_ISA]			= &g12a_isa.hw,
3962 		[CLKID_PL301]			= &g12a_pl301.hw,
3963 		[CLKID_PERIPHS]			= &g12a_periphs.hw,
3964 		[CLKID_SPICC0]			= &g12a_spicc_0.hw,
3965 		[CLKID_I2C]			= &g12a_i2c.hw,
3966 		[CLKID_SANA]			= &g12a_sana.hw,
3967 		[CLKID_SD]			= &g12a_sd.hw,
3968 		[CLKID_RNG0]			= &g12a_rng0.hw,
3969 		[CLKID_UART0]			= &g12a_uart0.hw,
3970 		[CLKID_SPICC1]			= &g12a_spicc_1.hw,
3971 		[CLKID_HIU_IFACE]		= &g12a_hiu_reg.hw,
3972 		[CLKID_MIPI_DSI_PHY]		= &g12a_mipi_dsi_phy.hw,
3973 		[CLKID_ASSIST_MISC]		= &g12a_assist_misc.hw,
3974 		[CLKID_SD_EMMC_A]		= &g12a_emmc_a.hw,
3975 		[CLKID_SD_EMMC_B]		= &g12a_emmc_b.hw,
3976 		[CLKID_SD_EMMC_C]		= &g12a_emmc_c.hw,
3977 		[CLKID_AUDIO_CODEC]		= &g12a_audio_codec.hw,
3978 		[CLKID_AUDIO]			= &g12a_audio.hw,
3979 		[CLKID_ETH]			= &g12a_eth_core.hw,
3980 		[CLKID_DEMUX]			= &g12a_demux.hw,
3981 		[CLKID_AUDIO_IFIFO]		= &g12a_audio_ififo.hw,
3982 		[CLKID_ADC]			= &g12a_adc.hw,
3983 		[CLKID_UART1]			= &g12a_uart1.hw,
3984 		[CLKID_G2D]			= &g12a_g2d.hw,
3985 		[CLKID_RESET]			= &g12a_reset.hw,
3986 		[CLKID_PCIE_COMB]		= &g12a_pcie_comb.hw,
3987 		[CLKID_PARSER]			= &g12a_parser.hw,
3988 		[CLKID_USB]			= &g12a_usb_general.hw,
3989 		[CLKID_PCIE_PHY]		= &g12a_pcie_phy.hw,
3990 		[CLKID_AHB_ARB0]		= &g12a_ahb_arb0.hw,
3991 		[CLKID_AHB_DATA_BUS]		= &g12a_ahb_data_bus.hw,
3992 		[CLKID_AHB_CTRL_BUS]		= &g12a_ahb_ctrl_bus.hw,
3993 		[CLKID_HTX_HDCP22]		= &g12a_htx_hdcp22.hw,
3994 		[CLKID_HTX_PCLK]		= &g12a_htx_pclk.hw,
3995 		[CLKID_BT656]			= &g12a_bt656.hw,
3996 		[CLKID_USB1_DDR_BRIDGE]		= &g12a_usb1_to_ddr.hw,
3997 		[CLKID_MMC_PCLK]		= &g12a_mmc_pclk.hw,
3998 		[CLKID_UART2]			= &g12a_uart2.hw,
3999 		[CLKID_VPU_INTR]		= &g12a_vpu_intr.hw,
4000 		[CLKID_GIC]			= &g12a_gic.hw,
4001 		[CLKID_SD_EMMC_A_CLK0_SEL]	= &g12a_sd_emmc_a_clk0_sel.hw,
4002 		[CLKID_SD_EMMC_A_CLK0_DIV]	= &g12a_sd_emmc_a_clk0_div.hw,
4003 		[CLKID_SD_EMMC_A_CLK0]		= &g12a_sd_emmc_a_clk0.hw,
4004 		[CLKID_SD_EMMC_B_CLK0_SEL]	= &g12a_sd_emmc_b_clk0_sel.hw,
4005 		[CLKID_SD_EMMC_B_CLK0_DIV]	= &g12a_sd_emmc_b_clk0_div.hw,
4006 		[CLKID_SD_EMMC_B_CLK0]		= &g12a_sd_emmc_b_clk0.hw,
4007 		[CLKID_SD_EMMC_C_CLK0_SEL]	= &g12a_sd_emmc_c_clk0_sel.hw,
4008 		[CLKID_SD_EMMC_C_CLK0_DIV]	= &g12a_sd_emmc_c_clk0_div.hw,
4009 		[CLKID_SD_EMMC_C_CLK0]		= &g12a_sd_emmc_c_clk0.hw,
4010 		[CLKID_MPLL0_DIV]		= &g12a_mpll0_div.hw,
4011 		[CLKID_MPLL1_DIV]		= &g12a_mpll1_div.hw,
4012 		[CLKID_MPLL2_DIV]		= &g12a_mpll2_div.hw,
4013 		[CLKID_MPLL3_DIV]		= &g12a_mpll3_div.hw,
4014 		[CLKID_FCLK_DIV2_DIV]		= &g12a_fclk_div2_div.hw,
4015 		[CLKID_FCLK_DIV3_DIV]		= &g12a_fclk_div3_div.hw,
4016 		[CLKID_FCLK_DIV4_DIV]		= &g12a_fclk_div4_div.hw,
4017 		[CLKID_FCLK_DIV5_DIV]		= &g12a_fclk_div5_div.hw,
4018 		[CLKID_FCLK_DIV7_DIV]		= &g12a_fclk_div7_div.hw,
4019 		[CLKID_FCLK_DIV2P5_DIV]		= &g12a_fclk_div2p5_div.hw,
4020 		[CLKID_HIFI_PLL]		= &g12a_hifi_pll.hw,
4021 		[CLKID_VCLK2_VENCI0]		= &g12a_vclk2_venci0.hw,
4022 		[CLKID_VCLK2_VENCI1]		= &g12a_vclk2_venci1.hw,
4023 		[CLKID_VCLK2_VENCP0]		= &g12a_vclk2_vencp0.hw,
4024 		[CLKID_VCLK2_VENCP1]		= &g12a_vclk2_vencp1.hw,
4025 		[CLKID_VCLK2_VENCT0]		= &g12a_vclk2_venct0.hw,
4026 		[CLKID_VCLK2_VENCT1]		= &g12a_vclk2_venct1.hw,
4027 		[CLKID_VCLK2_OTHER]		= &g12a_vclk2_other.hw,
4028 		[CLKID_VCLK2_ENCI]		= &g12a_vclk2_enci.hw,
4029 		[CLKID_VCLK2_ENCP]		= &g12a_vclk2_encp.hw,
4030 		[CLKID_DAC_CLK]			= &g12a_dac_clk.hw,
4031 		[CLKID_AOCLK]			= &g12a_aoclk_gate.hw,
4032 		[CLKID_IEC958]			= &g12a_iec958_gate.hw,
4033 		[CLKID_ENC480P]			= &g12a_enc480p.hw,
4034 		[CLKID_RNG1]			= &g12a_rng1.hw,
4035 		[CLKID_VCLK2_ENCT]		= &g12a_vclk2_enct.hw,
4036 		[CLKID_VCLK2_ENCL]		= &g12a_vclk2_encl.hw,
4037 		[CLKID_VCLK2_VENCLMMC]		= &g12a_vclk2_venclmmc.hw,
4038 		[CLKID_VCLK2_VENCL]		= &g12a_vclk2_vencl.hw,
4039 		[CLKID_VCLK2_OTHER1]		= &g12a_vclk2_other1.hw,
4040 		[CLKID_FIXED_PLL_DCO]		= &g12a_fixed_pll_dco.hw,
4041 		[CLKID_SYS_PLL_DCO]		= &g12a_sys_pll_dco.hw,
4042 		[CLKID_GP0_PLL_DCO]		= &g12a_gp0_pll_dco.hw,
4043 		[CLKID_HIFI_PLL_DCO]		= &g12a_hifi_pll_dco.hw,
4044 		[CLKID_DMA]			= &g12a_dma.hw,
4045 		[CLKID_EFUSE]			= &g12a_efuse.hw,
4046 		[CLKID_ROM_BOOT]		= &g12a_rom_boot.hw,
4047 		[CLKID_RESET_SEC]		= &g12a_reset_sec.hw,
4048 		[CLKID_SEC_AHB_APB3]		= &g12a_sec_ahb_apb3.hw,
4049 		[CLKID_MPLL_PREDIV]		= &g12a_mpll_prediv.hw,
4050 		[CLKID_VPU_0_SEL]		= &g12a_vpu_0_sel.hw,
4051 		[CLKID_VPU_0_DIV]		= &g12a_vpu_0_div.hw,
4052 		[CLKID_VPU_0]			= &g12a_vpu_0.hw,
4053 		[CLKID_VPU_1_SEL]		= &g12a_vpu_1_sel.hw,
4054 		[CLKID_VPU_1_DIV]		= &g12a_vpu_1_div.hw,
4055 		[CLKID_VPU_1]			= &g12a_vpu_1.hw,
4056 		[CLKID_VPU]			= &g12a_vpu.hw,
4057 		[CLKID_VAPB_0_SEL]		= &g12a_vapb_0_sel.hw,
4058 		[CLKID_VAPB_0_DIV]		= &g12a_vapb_0_div.hw,
4059 		[CLKID_VAPB_0]			= &g12a_vapb_0.hw,
4060 		[CLKID_VAPB_1_SEL]		= &g12a_vapb_1_sel.hw,
4061 		[CLKID_VAPB_1_DIV]		= &g12a_vapb_1_div.hw,
4062 		[CLKID_VAPB_1]			= &g12a_vapb_1.hw,
4063 		[CLKID_VAPB_SEL]		= &g12a_vapb_sel.hw,
4064 		[CLKID_VAPB]			= &g12a_vapb.hw,
4065 		[CLKID_HDMI_PLL_DCO]		= &g12a_hdmi_pll_dco.hw,
4066 		[CLKID_HDMI_PLL_OD]		= &g12a_hdmi_pll_od.hw,
4067 		[CLKID_HDMI_PLL_OD2]		= &g12a_hdmi_pll_od2.hw,
4068 		[CLKID_HDMI_PLL]		= &g12a_hdmi_pll.hw,
4069 		[CLKID_VID_PLL]			= &g12a_vid_pll_div.hw,
4070 		[CLKID_VID_PLL_SEL]		= &g12a_vid_pll_sel.hw,
4071 		[CLKID_VID_PLL_DIV]		= &g12a_vid_pll.hw,
4072 		[CLKID_VCLK_SEL]		= &g12a_vclk_sel.hw,
4073 		[CLKID_VCLK2_SEL]		= &g12a_vclk2_sel.hw,
4074 		[CLKID_VCLK_INPUT]		= &g12a_vclk_input.hw,
4075 		[CLKID_VCLK2_INPUT]		= &g12a_vclk2_input.hw,
4076 		[CLKID_VCLK_DIV]		= &g12a_vclk_div.hw,
4077 		[CLKID_VCLK2_DIV]		= &g12a_vclk2_div.hw,
4078 		[CLKID_VCLK]			= &g12a_vclk.hw,
4079 		[CLKID_VCLK2]			= &g12a_vclk2.hw,
4080 		[CLKID_VCLK_DIV1]		= &g12a_vclk_div1.hw,
4081 		[CLKID_VCLK_DIV2_EN]		= &g12a_vclk_div2_en.hw,
4082 		[CLKID_VCLK_DIV4_EN]		= &g12a_vclk_div4_en.hw,
4083 		[CLKID_VCLK_DIV6_EN]		= &g12a_vclk_div6_en.hw,
4084 		[CLKID_VCLK_DIV12_EN]		= &g12a_vclk_div12_en.hw,
4085 		[CLKID_VCLK2_DIV1]		= &g12a_vclk2_div1.hw,
4086 		[CLKID_VCLK2_DIV2_EN]		= &g12a_vclk2_div2_en.hw,
4087 		[CLKID_VCLK2_DIV4_EN]		= &g12a_vclk2_div4_en.hw,
4088 		[CLKID_VCLK2_DIV6_EN]		= &g12a_vclk2_div6_en.hw,
4089 		[CLKID_VCLK2_DIV12_EN]		= &g12a_vclk2_div12_en.hw,
4090 		[CLKID_VCLK_DIV2]		= &g12a_vclk_div2.hw,
4091 		[CLKID_VCLK_DIV4]		= &g12a_vclk_div4.hw,
4092 		[CLKID_VCLK_DIV6]		= &g12a_vclk_div6.hw,
4093 		[CLKID_VCLK_DIV12]		= &g12a_vclk_div12.hw,
4094 		[CLKID_VCLK2_DIV2]		= &g12a_vclk2_div2.hw,
4095 		[CLKID_VCLK2_DIV4]		= &g12a_vclk2_div4.hw,
4096 		[CLKID_VCLK2_DIV6]		= &g12a_vclk2_div6.hw,
4097 		[CLKID_VCLK2_DIV12]		= &g12a_vclk2_div12.hw,
4098 		[CLKID_CTS_ENCI_SEL]		= &g12a_cts_enci_sel.hw,
4099 		[CLKID_CTS_ENCP_SEL]		= &g12a_cts_encp_sel.hw,
4100 		[CLKID_CTS_VDAC_SEL]		= &g12a_cts_vdac_sel.hw,
4101 		[CLKID_HDMI_TX_SEL]		= &g12a_hdmi_tx_sel.hw,
4102 		[CLKID_CTS_ENCI]		= &g12a_cts_enci.hw,
4103 		[CLKID_CTS_ENCP]		= &g12a_cts_encp.hw,
4104 		[CLKID_CTS_VDAC]		= &g12a_cts_vdac.hw,
4105 		[CLKID_HDMI_TX]			= &g12a_hdmi_tx.hw,
4106 		[CLKID_HDMI_SEL]		= &g12a_hdmi_sel.hw,
4107 		[CLKID_HDMI_DIV]		= &g12a_hdmi_div.hw,
4108 		[CLKID_HDMI]			= &g12a_hdmi.hw,
4109 		[CLKID_MALI_0_SEL]		= &g12a_mali_0_sel.hw,
4110 		[CLKID_MALI_0_DIV]		= &g12a_mali_0_div.hw,
4111 		[CLKID_MALI_0]			= &g12a_mali_0.hw,
4112 		[CLKID_MALI_1_SEL]		= &g12a_mali_1_sel.hw,
4113 		[CLKID_MALI_1_DIV]		= &g12a_mali_1_div.hw,
4114 		[CLKID_MALI_1]			= &g12a_mali_1.hw,
4115 		[CLKID_MALI]			= &g12a_mali.hw,
4116 		[CLKID_MPLL_50M_DIV]		= &g12a_mpll_50m_div.hw,
4117 		[CLKID_MPLL_50M]		= &g12a_mpll_50m.hw,
4118 		[CLKID_SYS_PLL_DIV16_EN]	= &g12a_sys_pll_div16_en.hw,
4119 		[CLKID_SYS_PLL_DIV16]		= &g12a_sys_pll_div16.hw,
4120 		[CLKID_CPU_CLK_DYN0_SEL]	= &g12a_cpu_clk_premux0.hw,
4121 		[CLKID_CPU_CLK_DYN0_DIV]	= &g12a_cpu_clk_mux0_div.hw,
4122 		[CLKID_CPU_CLK_DYN0]		= &g12a_cpu_clk_postmux0.hw,
4123 		[CLKID_CPU_CLK_DYN1_SEL]	= &g12a_cpu_clk_premux1.hw,
4124 		[CLKID_CPU_CLK_DYN1_DIV]	= &g12a_cpu_clk_mux1_div.hw,
4125 		[CLKID_CPU_CLK_DYN1]		= &g12a_cpu_clk_postmux1.hw,
4126 		[CLKID_CPU_CLK_DYN]		= &g12a_cpu_clk_dyn.hw,
4127 		[CLKID_CPU_CLK]			= &g12a_cpu_clk.hw,
4128 		[CLKID_CPU_CLK_DIV16_EN]	= &g12a_cpu_clk_div16_en.hw,
4129 		[CLKID_CPU_CLK_DIV16]		= &g12a_cpu_clk_div16.hw,
4130 		[CLKID_CPU_CLK_APB_DIV]		= &g12a_cpu_clk_apb_div.hw,
4131 		[CLKID_CPU_CLK_APB]		= &g12a_cpu_clk_apb.hw,
4132 		[CLKID_CPU_CLK_ATB_DIV]		= &g12a_cpu_clk_atb_div.hw,
4133 		[CLKID_CPU_CLK_ATB]		= &g12a_cpu_clk_atb.hw,
4134 		[CLKID_CPU_CLK_AXI_DIV]		= &g12a_cpu_clk_axi_div.hw,
4135 		[CLKID_CPU_CLK_AXI]		= &g12a_cpu_clk_axi.hw,
4136 		[CLKID_CPU_CLK_TRACE_DIV]	= &g12a_cpu_clk_trace_div.hw,
4137 		[CLKID_CPU_CLK_TRACE]		= &g12a_cpu_clk_trace.hw,
4138 		[CLKID_PCIE_PLL_DCO]		= &g12a_pcie_pll_dco.hw,
4139 		[CLKID_PCIE_PLL_DCO_DIV2]	= &g12a_pcie_pll_dco_div2.hw,
4140 		[CLKID_PCIE_PLL_OD]		= &g12a_pcie_pll_od.hw,
4141 		[CLKID_PCIE_PLL]		= &g12a_pcie_pll.hw,
4142 		[CLKID_VDEC_1_SEL]		= &g12a_vdec_1_sel.hw,
4143 		[CLKID_VDEC_1_DIV]		= &g12a_vdec_1_div.hw,
4144 		[CLKID_VDEC_1]			= &g12a_vdec_1.hw,
4145 		[CLKID_VDEC_HEVC_SEL]		= &g12a_vdec_hevc_sel.hw,
4146 		[CLKID_VDEC_HEVC_DIV]		= &g12a_vdec_hevc_div.hw,
4147 		[CLKID_VDEC_HEVC]		= &g12a_vdec_hevc.hw,
4148 		[CLKID_VDEC_HEVCF_SEL]		= &g12a_vdec_hevcf_sel.hw,
4149 		[CLKID_VDEC_HEVCF_DIV]		= &g12a_vdec_hevcf_div.hw,
4150 		[CLKID_VDEC_HEVCF]		= &g12a_vdec_hevcf.hw,
4151 		[CLKID_TS_DIV]			= &g12a_ts_div.hw,
4152 		[CLKID_TS]			= &g12a_ts.hw,
4153 		[NR_CLKS]			= NULL,
4154 	},
4155 	.num = NR_CLKS,
4156 };
4157 
4158 static struct clk_hw_onecell_data g12b_hw_onecell_data = {
4159 	.hws = {
4160 		[CLKID_SYS_PLL]			= &g12a_sys_pll.hw,
4161 		[CLKID_FIXED_PLL]		= &g12a_fixed_pll.hw,
4162 		[CLKID_FCLK_DIV2]		= &g12a_fclk_div2.hw,
4163 		[CLKID_FCLK_DIV3]		= &g12a_fclk_div3.hw,
4164 		[CLKID_FCLK_DIV4]		= &g12a_fclk_div4.hw,
4165 		[CLKID_FCLK_DIV5]		= &g12a_fclk_div5.hw,
4166 		[CLKID_FCLK_DIV7]		= &g12a_fclk_div7.hw,
4167 		[CLKID_FCLK_DIV2P5]		= &g12a_fclk_div2p5.hw,
4168 		[CLKID_GP0_PLL]			= &g12a_gp0_pll.hw,
4169 		[CLKID_MPEG_SEL]		= &g12a_mpeg_clk_sel.hw,
4170 		[CLKID_MPEG_DIV]		= &g12a_mpeg_clk_div.hw,
4171 		[CLKID_CLK81]			= &g12a_clk81.hw,
4172 		[CLKID_MPLL0]			= &g12a_mpll0.hw,
4173 		[CLKID_MPLL1]			= &g12a_mpll1.hw,
4174 		[CLKID_MPLL2]			= &g12a_mpll2.hw,
4175 		[CLKID_MPLL3]			= &g12a_mpll3.hw,
4176 		[CLKID_DDR]			= &g12a_ddr.hw,
4177 		[CLKID_DOS]			= &g12a_dos.hw,
4178 		[CLKID_AUDIO_LOCKER]		= &g12a_audio_locker.hw,
4179 		[CLKID_MIPI_DSI_HOST]		= &g12a_mipi_dsi_host.hw,
4180 		[CLKID_ETH_PHY]			= &g12a_eth_phy.hw,
4181 		[CLKID_ISA]			= &g12a_isa.hw,
4182 		[CLKID_PL301]			= &g12a_pl301.hw,
4183 		[CLKID_PERIPHS]			= &g12a_periphs.hw,
4184 		[CLKID_SPICC0]			= &g12a_spicc_0.hw,
4185 		[CLKID_I2C]			= &g12a_i2c.hw,
4186 		[CLKID_SANA]			= &g12a_sana.hw,
4187 		[CLKID_SD]			= &g12a_sd.hw,
4188 		[CLKID_RNG0]			= &g12a_rng0.hw,
4189 		[CLKID_UART0]			= &g12a_uart0.hw,
4190 		[CLKID_SPICC1]			= &g12a_spicc_1.hw,
4191 		[CLKID_HIU_IFACE]		= &g12a_hiu_reg.hw,
4192 		[CLKID_MIPI_DSI_PHY]		= &g12a_mipi_dsi_phy.hw,
4193 		[CLKID_ASSIST_MISC]		= &g12a_assist_misc.hw,
4194 		[CLKID_SD_EMMC_A]		= &g12a_emmc_a.hw,
4195 		[CLKID_SD_EMMC_B]		= &g12a_emmc_b.hw,
4196 		[CLKID_SD_EMMC_C]		= &g12a_emmc_c.hw,
4197 		[CLKID_AUDIO_CODEC]		= &g12a_audio_codec.hw,
4198 		[CLKID_AUDIO]			= &g12a_audio.hw,
4199 		[CLKID_ETH]			= &g12a_eth_core.hw,
4200 		[CLKID_DEMUX]			= &g12a_demux.hw,
4201 		[CLKID_AUDIO_IFIFO]		= &g12a_audio_ififo.hw,
4202 		[CLKID_ADC]			= &g12a_adc.hw,
4203 		[CLKID_UART1]			= &g12a_uart1.hw,
4204 		[CLKID_G2D]			= &g12a_g2d.hw,
4205 		[CLKID_RESET]			= &g12a_reset.hw,
4206 		[CLKID_PCIE_COMB]		= &g12a_pcie_comb.hw,
4207 		[CLKID_PARSER]			= &g12a_parser.hw,
4208 		[CLKID_USB]			= &g12a_usb_general.hw,
4209 		[CLKID_PCIE_PHY]		= &g12a_pcie_phy.hw,
4210 		[CLKID_AHB_ARB0]		= &g12a_ahb_arb0.hw,
4211 		[CLKID_AHB_DATA_BUS]		= &g12a_ahb_data_bus.hw,
4212 		[CLKID_AHB_CTRL_BUS]		= &g12a_ahb_ctrl_bus.hw,
4213 		[CLKID_HTX_HDCP22]		= &g12a_htx_hdcp22.hw,
4214 		[CLKID_HTX_PCLK]		= &g12a_htx_pclk.hw,
4215 		[CLKID_BT656]			= &g12a_bt656.hw,
4216 		[CLKID_USB1_DDR_BRIDGE]		= &g12a_usb1_to_ddr.hw,
4217 		[CLKID_MMC_PCLK]		= &g12a_mmc_pclk.hw,
4218 		[CLKID_UART2]			= &g12a_uart2.hw,
4219 		[CLKID_VPU_INTR]		= &g12a_vpu_intr.hw,
4220 		[CLKID_GIC]			= &g12a_gic.hw,
4221 		[CLKID_SD_EMMC_A_CLK0_SEL]	= &g12a_sd_emmc_a_clk0_sel.hw,
4222 		[CLKID_SD_EMMC_A_CLK0_DIV]	= &g12a_sd_emmc_a_clk0_div.hw,
4223 		[CLKID_SD_EMMC_A_CLK0]		= &g12a_sd_emmc_a_clk0.hw,
4224 		[CLKID_SD_EMMC_B_CLK0_SEL]	= &g12a_sd_emmc_b_clk0_sel.hw,
4225 		[CLKID_SD_EMMC_B_CLK0_DIV]	= &g12a_sd_emmc_b_clk0_div.hw,
4226 		[CLKID_SD_EMMC_B_CLK0]		= &g12a_sd_emmc_b_clk0.hw,
4227 		[CLKID_SD_EMMC_C_CLK0_SEL]	= &g12a_sd_emmc_c_clk0_sel.hw,
4228 		[CLKID_SD_EMMC_C_CLK0_DIV]	= &g12a_sd_emmc_c_clk0_div.hw,
4229 		[CLKID_SD_EMMC_C_CLK0]		= &g12a_sd_emmc_c_clk0.hw,
4230 		[CLKID_MPLL0_DIV]		= &g12a_mpll0_div.hw,
4231 		[CLKID_MPLL1_DIV]		= &g12a_mpll1_div.hw,
4232 		[CLKID_MPLL2_DIV]		= &g12a_mpll2_div.hw,
4233 		[CLKID_MPLL3_DIV]		= &g12a_mpll3_div.hw,
4234 		[CLKID_FCLK_DIV2_DIV]		= &g12a_fclk_div2_div.hw,
4235 		[CLKID_FCLK_DIV3_DIV]		= &g12a_fclk_div3_div.hw,
4236 		[CLKID_FCLK_DIV4_DIV]		= &g12a_fclk_div4_div.hw,
4237 		[CLKID_FCLK_DIV5_DIV]		= &g12a_fclk_div5_div.hw,
4238 		[CLKID_FCLK_DIV7_DIV]		= &g12a_fclk_div7_div.hw,
4239 		[CLKID_FCLK_DIV2P5_DIV]		= &g12a_fclk_div2p5_div.hw,
4240 		[CLKID_HIFI_PLL]		= &g12a_hifi_pll.hw,
4241 		[CLKID_VCLK2_VENCI0]		= &g12a_vclk2_venci0.hw,
4242 		[CLKID_VCLK2_VENCI1]		= &g12a_vclk2_venci1.hw,
4243 		[CLKID_VCLK2_VENCP0]		= &g12a_vclk2_vencp0.hw,
4244 		[CLKID_VCLK2_VENCP1]		= &g12a_vclk2_vencp1.hw,
4245 		[CLKID_VCLK2_VENCT0]		= &g12a_vclk2_venct0.hw,
4246 		[CLKID_VCLK2_VENCT1]		= &g12a_vclk2_venct1.hw,
4247 		[CLKID_VCLK2_OTHER]		= &g12a_vclk2_other.hw,
4248 		[CLKID_VCLK2_ENCI]		= &g12a_vclk2_enci.hw,
4249 		[CLKID_VCLK2_ENCP]		= &g12a_vclk2_encp.hw,
4250 		[CLKID_DAC_CLK]			= &g12a_dac_clk.hw,
4251 		[CLKID_AOCLK]			= &g12a_aoclk_gate.hw,
4252 		[CLKID_IEC958]			= &g12a_iec958_gate.hw,
4253 		[CLKID_ENC480P]			= &g12a_enc480p.hw,
4254 		[CLKID_RNG1]			= &g12a_rng1.hw,
4255 		[CLKID_VCLK2_ENCT]		= &g12a_vclk2_enct.hw,
4256 		[CLKID_VCLK2_ENCL]		= &g12a_vclk2_encl.hw,
4257 		[CLKID_VCLK2_VENCLMMC]		= &g12a_vclk2_venclmmc.hw,
4258 		[CLKID_VCLK2_VENCL]		= &g12a_vclk2_vencl.hw,
4259 		[CLKID_VCLK2_OTHER1]		= &g12a_vclk2_other1.hw,
4260 		[CLKID_FIXED_PLL_DCO]		= &g12a_fixed_pll_dco.hw,
4261 		[CLKID_SYS_PLL_DCO]		= &g12a_sys_pll_dco.hw,
4262 		[CLKID_GP0_PLL_DCO]		= &g12a_gp0_pll_dco.hw,
4263 		[CLKID_HIFI_PLL_DCO]		= &g12a_hifi_pll_dco.hw,
4264 		[CLKID_DMA]			= &g12a_dma.hw,
4265 		[CLKID_EFUSE]			= &g12a_efuse.hw,
4266 		[CLKID_ROM_BOOT]		= &g12a_rom_boot.hw,
4267 		[CLKID_RESET_SEC]		= &g12a_reset_sec.hw,
4268 		[CLKID_SEC_AHB_APB3]		= &g12a_sec_ahb_apb3.hw,
4269 		[CLKID_MPLL_PREDIV]		= &g12a_mpll_prediv.hw,
4270 		[CLKID_VPU_0_SEL]		= &g12a_vpu_0_sel.hw,
4271 		[CLKID_VPU_0_DIV]		= &g12a_vpu_0_div.hw,
4272 		[CLKID_VPU_0]			= &g12a_vpu_0.hw,
4273 		[CLKID_VPU_1_SEL]		= &g12a_vpu_1_sel.hw,
4274 		[CLKID_VPU_1_DIV]		= &g12a_vpu_1_div.hw,
4275 		[CLKID_VPU_1]			= &g12a_vpu_1.hw,
4276 		[CLKID_VPU]			= &g12a_vpu.hw,
4277 		[CLKID_VAPB_0_SEL]		= &g12a_vapb_0_sel.hw,
4278 		[CLKID_VAPB_0_DIV]		= &g12a_vapb_0_div.hw,
4279 		[CLKID_VAPB_0]			= &g12a_vapb_0.hw,
4280 		[CLKID_VAPB_1_SEL]		= &g12a_vapb_1_sel.hw,
4281 		[CLKID_VAPB_1_DIV]		= &g12a_vapb_1_div.hw,
4282 		[CLKID_VAPB_1]			= &g12a_vapb_1.hw,
4283 		[CLKID_VAPB_SEL]		= &g12a_vapb_sel.hw,
4284 		[CLKID_VAPB]			= &g12a_vapb.hw,
4285 		[CLKID_HDMI_PLL_DCO]		= &g12a_hdmi_pll_dco.hw,
4286 		[CLKID_HDMI_PLL_OD]		= &g12a_hdmi_pll_od.hw,
4287 		[CLKID_HDMI_PLL_OD2]		= &g12a_hdmi_pll_od2.hw,
4288 		[CLKID_HDMI_PLL]		= &g12a_hdmi_pll.hw,
4289 		[CLKID_VID_PLL]			= &g12a_vid_pll_div.hw,
4290 		[CLKID_VID_PLL_SEL]		= &g12a_vid_pll_sel.hw,
4291 		[CLKID_VID_PLL_DIV]		= &g12a_vid_pll.hw,
4292 		[CLKID_VCLK_SEL]		= &g12a_vclk_sel.hw,
4293 		[CLKID_VCLK2_SEL]		= &g12a_vclk2_sel.hw,
4294 		[CLKID_VCLK_INPUT]		= &g12a_vclk_input.hw,
4295 		[CLKID_VCLK2_INPUT]		= &g12a_vclk2_input.hw,
4296 		[CLKID_VCLK_DIV]		= &g12a_vclk_div.hw,
4297 		[CLKID_VCLK2_DIV]		= &g12a_vclk2_div.hw,
4298 		[CLKID_VCLK]			= &g12a_vclk.hw,
4299 		[CLKID_VCLK2]			= &g12a_vclk2.hw,
4300 		[CLKID_VCLK_DIV1]		= &g12a_vclk_div1.hw,
4301 		[CLKID_VCLK_DIV2_EN]		= &g12a_vclk_div2_en.hw,
4302 		[CLKID_VCLK_DIV4_EN]		= &g12a_vclk_div4_en.hw,
4303 		[CLKID_VCLK_DIV6_EN]		= &g12a_vclk_div6_en.hw,
4304 		[CLKID_VCLK_DIV12_EN]		= &g12a_vclk_div12_en.hw,
4305 		[CLKID_VCLK2_DIV1]		= &g12a_vclk2_div1.hw,
4306 		[CLKID_VCLK2_DIV2_EN]		= &g12a_vclk2_div2_en.hw,
4307 		[CLKID_VCLK2_DIV4_EN]		= &g12a_vclk2_div4_en.hw,
4308 		[CLKID_VCLK2_DIV6_EN]		= &g12a_vclk2_div6_en.hw,
4309 		[CLKID_VCLK2_DIV12_EN]		= &g12a_vclk2_div12_en.hw,
4310 		[CLKID_VCLK_DIV2]		= &g12a_vclk_div2.hw,
4311 		[CLKID_VCLK_DIV4]		= &g12a_vclk_div4.hw,
4312 		[CLKID_VCLK_DIV6]		= &g12a_vclk_div6.hw,
4313 		[CLKID_VCLK_DIV12]		= &g12a_vclk_div12.hw,
4314 		[CLKID_VCLK2_DIV2]		= &g12a_vclk2_div2.hw,
4315 		[CLKID_VCLK2_DIV4]		= &g12a_vclk2_div4.hw,
4316 		[CLKID_VCLK2_DIV6]		= &g12a_vclk2_div6.hw,
4317 		[CLKID_VCLK2_DIV12]		= &g12a_vclk2_div12.hw,
4318 		[CLKID_CTS_ENCI_SEL]		= &g12a_cts_enci_sel.hw,
4319 		[CLKID_CTS_ENCP_SEL]		= &g12a_cts_encp_sel.hw,
4320 		[CLKID_CTS_VDAC_SEL]		= &g12a_cts_vdac_sel.hw,
4321 		[CLKID_HDMI_TX_SEL]		= &g12a_hdmi_tx_sel.hw,
4322 		[CLKID_CTS_ENCI]		= &g12a_cts_enci.hw,
4323 		[CLKID_CTS_ENCP]		= &g12a_cts_encp.hw,
4324 		[CLKID_CTS_VDAC]		= &g12a_cts_vdac.hw,
4325 		[CLKID_HDMI_TX]			= &g12a_hdmi_tx.hw,
4326 		[CLKID_HDMI_SEL]		= &g12a_hdmi_sel.hw,
4327 		[CLKID_HDMI_DIV]		= &g12a_hdmi_div.hw,
4328 		[CLKID_HDMI]			= &g12a_hdmi.hw,
4329 		[CLKID_MALI_0_SEL]		= &g12a_mali_0_sel.hw,
4330 		[CLKID_MALI_0_DIV]		= &g12a_mali_0_div.hw,
4331 		[CLKID_MALI_0]			= &g12a_mali_0.hw,
4332 		[CLKID_MALI_1_SEL]		= &g12a_mali_1_sel.hw,
4333 		[CLKID_MALI_1_DIV]		= &g12a_mali_1_div.hw,
4334 		[CLKID_MALI_1]			= &g12a_mali_1.hw,
4335 		[CLKID_MALI]			= &g12a_mali.hw,
4336 		[CLKID_MPLL_50M_DIV]		= &g12a_mpll_50m_div.hw,
4337 		[CLKID_MPLL_50M]		= &g12a_mpll_50m.hw,
4338 		[CLKID_SYS_PLL_DIV16_EN]	= &g12a_sys_pll_div16_en.hw,
4339 		[CLKID_SYS_PLL_DIV16]		= &g12a_sys_pll_div16.hw,
4340 		[CLKID_CPU_CLK_DYN0_SEL]	= &g12a_cpu_clk_premux0.hw,
4341 		[CLKID_CPU_CLK_DYN0_DIV]	= &g12a_cpu_clk_mux0_div.hw,
4342 		[CLKID_CPU_CLK_DYN0]		= &g12a_cpu_clk_postmux0.hw,
4343 		[CLKID_CPU_CLK_DYN1_SEL]	= &g12a_cpu_clk_premux1.hw,
4344 		[CLKID_CPU_CLK_DYN1_DIV]	= &g12a_cpu_clk_mux1_div.hw,
4345 		[CLKID_CPU_CLK_DYN1]		= &g12a_cpu_clk_postmux1.hw,
4346 		[CLKID_CPU_CLK_DYN]		= &g12a_cpu_clk_dyn.hw,
4347 		[CLKID_CPU_CLK]			= &g12b_cpu_clk.hw,
4348 		[CLKID_CPU_CLK_DIV16_EN]	= &g12a_cpu_clk_div16_en.hw,
4349 		[CLKID_CPU_CLK_DIV16]		= &g12a_cpu_clk_div16.hw,
4350 		[CLKID_CPU_CLK_APB_DIV]		= &g12a_cpu_clk_apb_div.hw,
4351 		[CLKID_CPU_CLK_APB]		= &g12a_cpu_clk_apb.hw,
4352 		[CLKID_CPU_CLK_ATB_DIV]		= &g12a_cpu_clk_atb_div.hw,
4353 		[CLKID_CPU_CLK_ATB]		= &g12a_cpu_clk_atb.hw,
4354 		[CLKID_CPU_CLK_AXI_DIV]		= &g12a_cpu_clk_axi_div.hw,
4355 		[CLKID_CPU_CLK_AXI]		= &g12a_cpu_clk_axi.hw,
4356 		[CLKID_CPU_CLK_TRACE_DIV]	= &g12a_cpu_clk_trace_div.hw,
4357 		[CLKID_CPU_CLK_TRACE]		= &g12a_cpu_clk_trace.hw,
4358 		[CLKID_PCIE_PLL_DCO]		= &g12a_pcie_pll_dco.hw,
4359 		[CLKID_PCIE_PLL_DCO_DIV2]	= &g12a_pcie_pll_dco_div2.hw,
4360 		[CLKID_PCIE_PLL_OD]		= &g12a_pcie_pll_od.hw,
4361 		[CLKID_PCIE_PLL]		= &g12a_pcie_pll.hw,
4362 		[CLKID_VDEC_1_SEL]		= &g12a_vdec_1_sel.hw,
4363 		[CLKID_VDEC_1_DIV]		= &g12a_vdec_1_div.hw,
4364 		[CLKID_VDEC_1]			= &g12a_vdec_1.hw,
4365 		[CLKID_VDEC_HEVC_SEL]		= &g12a_vdec_hevc_sel.hw,
4366 		[CLKID_VDEC_HEVC_DIV]		= &g12a_vdec_hevc_div.hw,
4367 		[CLKID_VDEC_HEVC]		= &g12a_vdec_hevc.hw,
4368 		[CLKID_VDEC_HEVCF_SEL]		= &g12a_vdec_hevcf_sel.hw,
4369 		[CLKID_VDEC_HEVCF_DIV]		= &g12a_vdec_hevcf_div.hw,
4370 		[CLKID_VDEC_HEVCF]		= &g12a_vdec_hevcf.hw,
4371 		[CLKID_TS_DIV]			= &g12a_ts_div.hw,
4372 		[CLKID_TS]			= &g12a_ts.hw,
4373 		[CLKID_SYS1_PLL_DCO]		= &g12b_sys1_pll_dco.hw,
4374 		[CLKID_SYS1_PLL]		= &g12b_sys1_pll.hw,
4375 		[CLKID_SYS1_PLL_DIV16_EN]	= &g12b_sys1_pll_div16_en.hw,
4376 		[CLKID_SYS1_PLL_DIV16]		= &g12b_sys1_pll_div16.hw,
4377 		[CLKID_CPUB_CLK_DYN0_SEL]	= &g12b_cpub_clk_premux0.hw,
4378 		[CLKID_CPUB_CLK_DYN0_DIV]	= &g12b_cpub_clk_mux0_div.hw,
4379 		[CLKID_CPUB_CLK_DYN0]		= &g12b_cpub_clk_postmux0.hw,
4380 		[CLKID_CPUB_CLK_DYN1_SEL]	= &g12b_cpub_clk_premux1.hw,
4381 		[CLKID_CPUB_CLK_DYN1_DIV]	= &g12b_cpub_clk_mux1_div.hw,
4382 		[CLKID_CPUB_CLK_DYN1]		= &g12b_cpub_clk_postmux1.hw,
4383 		[CLKID_CPUB_CLK_DYN]		= &g12b_cpub_clk_dyn.hw,
4384 		[CLKID_CPUB_CLK]		= &g12b_cpub_clk.hw,
4385 		[CLKID_CPUB_CLK_DIV16_EN]	= &g12b_cpub_clk_div16_en.hw,
4386 		[CLKID_CPUB_CLK_DIV16]		= &g12b_cpub_clk_div16.hw,
4387 		[CLKID_CPUB_CLK_DIV2]		= &g12b_cpub_clk_div2.hw,
4388 		[CLKID_CPUB_CLK_DIV3]		= &g12b_cpub_clk_div3.hw,
4389 		[CLKID_CPUB_CLK_DIV4]		= &g12b_cpub_clk_div4.hw,
4390 		[CLKID_CPUB_CLK_DIV5]		= &g12b_cpub_clk_div5.hw,
4391 		[CLKID_CPUB_CLK_DIV6]		= &g12b_cpub_clk_div6.hw,
4392 		[CLKID_CPUB_CLK_DIV7]		= &g12b_cpub_clk_div7.hw,
4393 		[CLKID_CPUB_CLK_DIV8]		= &g12b_cpub_clk_div8.hw,
4394 		[CLKID_CPUB_CLK_APB_SEL]	= &g12b_cpub_clk_apb_sel.hw,
4395 		[CLKID_CPUB_CLK_APB]		= &g12b_cpub_clk_apb.hw,
4396 		[CLKID_CPUB_CLK_ATB_SEL]	= &g12b_cpub_clk_atb_sel.hw,
4397 		[CLKID_CPUB_CLK_ATB]		= &g12b_cpub_clk_atb.hw,
4398 		[CLKID_CPUB_CLK_AXI_SEL]	= &g12b_cpub_clk_axi_sel.hw,
4399 		[CLKID_CPUB_CLK_AXI]		= &g12b_cpub_clk_axi.hw,
4400 		[CLKID_CPUB_CLK_TRACE_SEL]	= &g12b_cpub_clk_trace_sel.hw,
4401 		[CLKID_CPUB_CLK_TRACE]		= &g12b_cpub_clk_trace.hw,
4402 		[NR_CLKS]			= NULL,
4403 	},
4404 	.num = NR_CLKS,
4405 };
4406 
4407 static struct clk_hw_onecell_data sm1_hw_onecell_data = {
4408 	.hws = {
4409 		[CLKID_SYS_PLL]			= &g12a_sys_pll.hw,
4410 		[CLKID_FIXED_PLL]		= &g12a_fixed_pll.hw,
4411 		[CLKID_FCLK_DIV2]		= &g12a_fclk_div2.hw,
4412 		[CLKID_FCLK_DIV3]		= &g12a_fclk_div3.hw,
4413 		[CLKID_FCLK_DIV4]		= &g12a_fclk_div4.hw,
4414 		[CLKID_FCLK_DIV5]		= &g12a_fclk_div5.hw,
4415 		[CLKID_FCLK_DIV7]		= &g12a_fclk_div7.hw,
4416 		[CLKID_FCLK_DIV2P5]		= &g12a_fclk_div2p5.hw,
4417 		[CLKID_GP0_PLL]			= &g12a_gp0_pll.hw,
4418 		[CLKID_MPEG_SEL]		= &g12a_mpeg_clk_sel.hw,
4419 		[CLKID_MPEG_DIV]		= &g12a_mpeg_clk_div.hw,
4420 		[CLKID_CLK81]			= &g12a_clk81.hw,
4421 		[CLKID_MPLL0]			= &g12a_mpll0.hw,
4422 		[CLKID_MPLL1]			= &g12a_mpll1.hw,
4423 		[CLKID_MPLL2]			= &g12a_mpll2.hw,
4424 		[CLKID_MPLL3]			= &g12a_mpll3.hw,
4425 		[CLKID_DDR]			= &g12a_ddr.hw,
4426 		[CLKID_DOS]			= &g12a_dos.hw,
4427 		[CLKID_AUDIO_LOCKER]		= &g12a_audio_locker.hw,
4428 		[CLKID_MIPI_DSI_HOST]		= &g12a_mipi_dsi_host.hw,
4429 		[CLKID_ETH_PHY]			= &g12a_eth_phy.hw,
4430 		[CLKID_ISA]			= &g12a_isa.hw,
4431 		[CLKID_PL301]			= &g12a_pl301.hw,
4432 		[CLKID_PERIPHS]			= &g12a_periphs.hw,
4433 		[CLKID_SPICC0]			= &g12a_spicc_0.hw,
4434 		[CLKID_I2C]			= &g12a_i2c.hw,
4435 		[CLKID_SANA]			= &g12a_sana.hw,
4436 		[CLKID_SD]			= &g12a_sd.hw,
4437 		[CLKID_RNG0]			= &g12a_rng0.hw,
4438 		[CLKID_UART0]			= &g12a_uart0.hw,
4439 		[CLKID_SPICC1]			= &g12a_spicc_1.hw,
4440 		[CLKID_HIU_IFACE]		= &g12a_hiu_reg.hw,
4441 		[CLKID_MIPI_DSI_PHY]		= &g12a_mipi_dsi_phy.hw,
4442 		[CLKID_ASSIST_MISC]		= &g12a_assist_misc.hw,
4443 		[CLKID_SD_EMMC_A]		= &g12a_emmc_a.hw,
4444 		[CLKID_SD_EMMC_B]		= &g12a_emmc_b.hw,
4445 		[CLKID_SD_EMMC_C]		= &g12a_emmc_c.hw,
4446 		[CLKID_AUDIO_CODEC]		= &g12a_audio_codec.hw,
4447 		[CLKID_AUDIO]			= &g12a_audio.hw,
4448 		[CLKID_ETH]			= &g12a_eth_core.hw,
4449 		[CLKID_DEMUX]			= &g12a_demux.hw,
4450 		[CLKID_AUDIO_IFIFO]		= &g12a_audio_ififo.hw,
4451 		[CLKID_ADC]			= &g12a_adc.hw,
4452 		[CLKID_UART1]			= &g12a_uart1.hw,
4453 		[CLKID_G2D]			= &g12a_g2d.hw,
4454 		[CLKID_RESET]			= &g12a_reset.hw,
4455 		[CLKID_PCIE_COMB]		= &g12a_pcie_comb.hw,
4456 		[CLKID_PARSER]			= &g12a_parser.hw,
4457 		[CLKID_USB]			= &g12a_usb_general.hw,
4458 		[CLKID_PCIE_PHY]		= &g12a_pcie_phy.hw,
4459 		[CLKID_AHB_ARB0]		= &g12a_ahb_arb0.hw,
4460 		[CLKID_AHB_DATA_BUS]		= &g12a_ahb_data_bus.hw,
4461 		[CLKID_AHB_CTRL_BUS]		= &g12a_ahb_ctrl_bus.hw,
4462 		[CLKID_HTX_HDCP22]		= &g12a_htx_hdcp22.hw,
4463 		[CLKID_HTX_PCLK]		= &g12a_htx_pclk.hw,
4464 		[CLKID_BT656]			= &g12a_bt656.hw,
4465 		[CLKID_USB1_DDR_BRIDGE]		= &g12a_usb1_to_ddr.hw,
4466 		[CLKID_MMC_PCLK]		= &g12a_mmc_pclk.hw,
4467 		[CLKID_UART2]			= &g12a_uart2.hw,
4468 		[CLKID_VPU_INTR]		= &g12a_vpu_intr.hw,
4469 		[CLKID_GIC]			= &g12a_gic.hw,
4470 		[CLKID_SD_EMMC_A_CLK0_SEL]	= &g12a_sd_emmc_a_clk0_sel.hw,
4471 		[CLKID_SD_EMMC_A_CLK0_DIV]	= &g12a_sd_emmc_a_clk0_div.hw,
4472 		[CLKID_SD_EMMC_A_CLK0]		= &g12a_sd_emmc_a_clk0.hw,
4473 		[CLKID_SD_EMMC_B_CLK0_SEL]	= &g12a_sd_emmc_b_clk0_sel.hw,
4474 		[CLKID_SD_EMMC_B_CLK0_DIV]	= &g12a_sd_emmc_b_clk0_div.hw,
4475 		[CLKID_SD_EMMC_B_CLK0]		= &g12a_sd_emmc_b_clk0.hw,
4476 		[CLKID_SD_EMMC_C_CLK0_SEL]	= &g12a_sd_emmc_c_clk0_sel.hw,
4477 		[CLKID_SD_EMMC_C_CLK0_DIV]	= &g12a_sd_emmc_c_clk0_div.hw,
4478 		[CLKID_SD_EMMC_C_CLK0]		= &g12a_sd_emmc_c_clk0.hw,
4479 		[CLKID_MPLL0_DIV]		= &g12a_mpll0_div.hw,
4480 		[CLKID_MPLL1_DIV]		= &g12a_mpll1_div.hw,
4481 		[CLKID_MPLL2_DIV]		= &g12a_mpll2_div.hw,
4482 		[CLKID_MPLL3_DIV]		= &g12a_mpll3_div.hw,
4483 		[CLKID_FCLK_DIV2_DIV]		= &g12a_fclk_div2_div.hw,
4484 		[CLKID_FCLK_DIV3_DIV]		= &g12a_fclk_div3_div.hw,
4485 		[CLKID_FCLK_DIV4_DIV]		= &g12a_fclk_div4_div.hw,
4486 		[CLKID_FCLK_DIV5_DIV]		= &g12a_fclk_div5_div.hw,
4487 		[CLKID_FCLK_DIV7_DIV]		= &g12a_fclk_div7_div.hw,
4488 		[CLKID_FCLK_DIV2P5_DIV]		= &g12a_fclk_div2p5_div.hw,
4489 		[CLKID_HIFI_PLL]		= &g12a_hifi_pll.hw,
4490 		[CLKID_VCLK2_VENCI0]		= &g12a_vclk2_venci0.hw,
4491 		[CLKID_VCLK2_VENCI1]		= &g12a_vclk2_venci1.hw,
4492 		[CLKID_VCLK2_VENCP0]		= &g12a_vclk2_vencp0.hw,
4493 		[CLKID_VCLK2_VENCP1]		= &g12a_vclk2_vencp1.hw,
4494 		[CLKID_VCLK2_VENCT0]		= &g12a_vclk2_venct0.hw,
4495 		[CLKID_VCLK2_VENCT1]		= &g12a_vclk2_venct1.hw,
4496 		[CLKID_VCLK2_OTHER]		= &g12a_vclk2_other.hw,
4497 		[CLKID_VCLK2_ENCI]		= &g12a_vclk2_enci.hw,
4498 		[CLKID_VCLK2_ENCP]		= &g12a_vclk2_encp.hw,
4499 		[CLKID_DAC_CLK]			= &g12a_dac_clk.hw,
4500 		[CLKID_AOCLK]			= &g12a_aoclk_gate.hw,
4501 		[CLKID_IEC958]			= &g12a_iec958_gate.hw,
4502 		[CLKID_ENC480P]			= &g12a_enc480p.hw,
4503 		[CLKID_RNG1]			= &g12a_rng1.hw,
4504 		[CLKID_VCLK2_ENCT]		= &g12a_vclk2_enct.hw,
4505 		[CLKID_VCLK2_ENCL]		= &g12a_vclk2_encl.hw,
4506 		[CLKID_VCLK2_VENCLMMC]		= &g12a_vclk2_venclmmc.hw,
4507 		[CLKID_VCLK2_VENCL]		= &g12a_vclk2_vencl.hw,
4508 		[CLKID_VCLK2_OTHER1]		= &g12a_vclk2_other1.hw,
4509 		[CLKID_FIXED_PLL_DCO]		= &g12a_fixed_pll_dco.hw,
4510 		[CLKID_SYS_PLL_DCO]		= &g12a_sys_pll_dco.hw,
4511 		[CLKID_GP0_PLL_DCO]		= &g12a_gp0_pll_dco.hw,
4512 		[CLKID_HIFI_PLL_DCO]		= &g12a_hifi_pll_dco.hw,
4513 		[CLKID_DMA]			= &g12a_dma.hw,
4514 		[CLKID_EFUSE]			= &g12a_efuse.hw,
4515 		[CLKID_ROM_BOOT]		= &g12a_rom_boot.hw,
4516 		[CLKID_RESET_SEC]		= &g12a_reset_sec.hw,
4517 		[CLKID_SEC_AHB_APB3]		= &g12a_sec_ahb_apb3.hw,
4518 		[CLKID_MPLL_PREDIV]		= &g12a_mpll_prediv.hw,
4519 		[CLKID_VPU_0_SEL]		= &g12a_vpu_0_sel.hw,
4520 		[CLKID_VPU_0_DIV]		= &g12a_vpu_0_div.hw,
4521 		[CLKID_VPU_0]			= &g12a_vpu_0.hw,
4522 		[CLKID_VPU_1_SEL]		= &g12a_vpu_1_sel.hw,
4523 		[CLKID_VPU_1_DIV]		= &g12a_vpu_1_div.hw,
4524 		[CLKID_VPU_1]			= &g12a_vpu_1.hw,
4525 		[CLKID_VPU]			= &g12a_vpu.hw,
4526 		[CLKID_VAPB_0_SEL]		= &g12a_vapb_0_sel.hw,
4527 		[CLKID_VAPB_0_DIV]		= &g12a_vapb_0_div.hw,
4528 		[CLKID_VAPB_0]			= &g12a_vapb_0.hw,
4529 		[CLKID_VAPB_1_SEL]		= &g12a_vapb_1_sel.hw,
4530 		[CLKID_VAPB_1_DIV]		= &g12a_vapb_1_div.hw,
4531 		[CLKID_VAPB_1]			= &g12a_vapb_1.hw,
4532 		[CLKID_VAPB_SEL]		= &g12a_vapb_sel.hw,
4533 		[CLKID_VAPB]			= &g12a_vapb.hw,
4534 		[CLKID_HDMI_PLL_DCO]		= &g12a_hdmi_pll_dco.hw,
4535 		[CLKID_HDMI_PLL_OD]		= &g12a_hdmi_pll_od.hw,
4536 		[CLKID_HDMI_PLL_OD2]		= &g12a_hdmi_pll_od2.hw,
4537 		[CLKID_HDMI_PLL]		= &g12a_hdmi_pll.hw,
4538 		[CLKID_VID_PLL]			= &g12a_vid_pll_div.hw,
4539 		[CLKID_VID_PLL_SEL]		= &g12a_vid_pll_sel.hw,
4540 		[CLKID_VID_PLL_DIV]		= &g12a_vid_pll.hw,
4541 		[CLKID_VCLK_SEL]		= &g12a_vclk_sel.hw,
4542 		[CLKID_VCLK2_SEL]		= &g12a_vclk2_sel.hw,
4543 		[CLKID_VCLK_INPUT]		= &g12a_vclk_input.hw,
4544 		[CLKID_VCLK2_INPUT]		= &g12a_vclk2_input.hw,
4545 		[CLKID_VCLK_DIV]		= &g12a_vclk_div.hw,
4546 		[CLKID_VCLK2_DIV]		= &g12a_vclk2_div.hw,
4547 		[CLKID_VCLK]			= &g12a_vclk.hw,
4548 		[CLKID_VCLK2]			= &g12a_vclk2.hw,
4549 		[CLKID_VCLK_DIV1]		= &g12a_vclk_div1.hw,
4550 		[CLKID_VCLK_DIV2_EN]		= &g12a_vclk_div2_en.hw,
4551 		[CLKID_VCLK_DIV4_EN]		= &g12a_vclk_div4_en.hw,
4552 		[CLKID_VCLK_DIV6_EN]		= &g12a_vclk_div6_en.hw,
4553 		[CLKID_VCLK_DIV12_EN]		= &g12a_vclk_div12_en.hw,
4554 		[CLKID_VCLK2_DIV1]		= &g12a_vclk2_div1.hw,
4555 		[CLKID_VCLK2_DIV2_EN]		= &g12a_vclk2_div2_en.hw,
4556 		[CLKID_VCLK2_DIV4_EN]		= &g12a_vclk2_div4_en.hw,
4557 		[CLKID_VCLK2_DIV6_EN]		= &g12a_vclk2_div6_en.hw,
4558 		[CLKID_VCLK2_DIV12_EN]		= &g12a_vclk2_div12_en.hw,
4559 		[CLKID_VCLK_DIV2]		= &g12a_vclk_div2.hw,
4560 		[CLKID_VCLK_DIV4]		= &g12a_vclk_div4.hw,
4561 		[CLKID_VCLK_DIV6]		= &g12a_vclk_div6.hw,
4562 		[CLKID_VCLK_DIV12]		= &g12a_vclk_div12.hw,
4563 		[CLKID_VCLK2_DIV2]		= &g12a_vclk2_div2.hw,
4564 		[CLKID_VCLK2_DIV4]		= &g12a_vclk2_div4.hw,
4565 		[CLKID_VCLK2_DIV6]		= &g12a_vclk2_div6.hw,
4566 		[CLKID_VCLK2_DIV12]		= &g12a_vclk2_div12.hw,
4567 		[CLKID_CTS_ENCI_SEL]		= &g12a_cts_enci_sel.hw,
4568 		[CLKID_CTS_ENCP_SEL]		= &g12a_cts_encp_sel.hw,
4569 		[CLKID_CTS_VDAC_SEL]		= &g12a_cts_vdac_sel.hw,
4570 		[CLKID_HDMI_TX_SEL]		= &g12a_hdmi_tx_sel.hw,
4571 		[CLKID_CTS_ENCI]		= &g12a_cts_enci.hw,
4572 		[CLKID_CTS_ENCP]		= &g12a_cts_encp.hw,
4573 		[CLKID_CTS_VDAC]		= &g12a_cts_vdac.hw,
4574 		[CLKID_HDMI_TX]			= &g12a_hdmi_tx.hw,
4575 		[CLKID_HDMI_SEL]		= &g12a_hdmi_sel.hw,
4576 		[CLKID_HDMI_DIV]		= &g12a_hdmi_div.hw,
4577 		[CLKID_HDMI]			= &g12a_hdmi.hw,
4578 		[CLKID_MALI_0_SEL]		= &g12a_mali_0_sel.hw,
4579 		[CLKID_MALI_0_DIV]		= &g12a_mali_0_div.hw,
4580 		[CLKID_MALI_0]			= &g12a_mali_0.hw,
4581 		[CLKID_MALI_1_SEL]		= &g12a_mali_1_sel.hw,
4582 		[CLKID_MALI_1_DIV]		= &g12a_mali_1_div.hw,
4583 		[CLKID_MALI_1]			= &g12a_mali_1.hw,
4584 		[CLKID_MALI]			= &g12a_mali.hw,
4585 		[CLKID_MPLL_50M_DIV]		= &g12a_mpll_50m_div.hw,
4586 		[CLKID_MPLL_50M]		= &g12a_mpll_50m.hw,
4587 		[CLKID_SYS_PLL_DIV16_EN]	= &g12a_sys_pll_div16_en.hw,
4588 		[CLKID_SYS_PLL_DIV16]		= &g12a_sys_pll_div16.hw,
4589 		[CLKID_CPU_CLK_DYN0_SEL]	= &g12a_cpu_clk_premux0.hw,
4590 		[CLKID_CPU_CLK_DYN0_DIV]	= &g12a_cpu_clk_mux0_div.hw,
4591 		[CLKID_CPU_CLK_DYN0]		= &g12a_cpu_clk_postmux0.hw,
4592 		[CLKID_CPU_CLK_DYN1_SEL]	= &g12a_cpu_clk_premux1.hw,
4593 		[CLKID_CPU_CLK_DYN1_DIV]	= &g12a_cpu_clk_mux1_div.hw,
4594 		[CLKID_CPU_CLK_DYN1]		= &g12a_cpu_clk_postmux1.hw,
4595 		[CLKID_CPU_CLK_DYN]		= &g12a_cpu_clk_dyn.hw,
4596 		[CLKID_CPU_CLK]			= &g12a_cpu_clk.hw,
4597 		[CLKID_CPU_CLK_DIV16_EN]	= &g12a_cpu_clk_div16_en.hw,
4598 		[CLKID_CPU_CLK_DIV16]		= &g12a_cpu_clk_div16.hw,
4599 		[CLKID_CPU_CLK_APB_DIV]		= &g12a_cpu_clk_apb_div.hw,
4600 		[CLKID_CPU_CLK_APB]		= &g12a_cpu_clk_apb.hw,
4601 		[CLKID_CPU_CLK_ATB_DIV]		= &g12a_cpu_clk_atb_div.hw,
4602 		[CLKID_CPU_CLK_ATB]		= &g12a_cpu_clk_atb.hw,
4603 		[CLKID_CPU_CLK_AXI_DIV]		= &g12a_cpu_clk_axi_div.hw,
4604 		[CLKID_CPU_CLK_AXI]		= &g12a_cpu_clk_axi.hw,
4605 		[CLKID_CPU_CLK_TRACE_DIV]	= &g12a_cpu_clk_trace_div.hw,
4606 		[CLKID_CPU_CLK_TRACE]		= &g12a_cpu_clk_trace.hw,
4607 		[CLKID_PCIE_PLL_DCO]		= &g12a_pcie_pll_dco.hw,
4608 		[CLKID_PCIE_PLL_DCO_DIV2]	= &g12a_pcie_pll_dco_div2.hw,
4609 		[CLKID_PCIE_PLL_OD]		= &g12a_pcie_pll_od.hw,
4610 		[CLKID_PCIE_PLL]		= &g12a_pcie_pll.hw,
4611 		[CLKID_VDEC_1_SEL]		= &g12a_vdec_1_sel.hw,
4612 		[CLKID_VDEC_1_DIV]		= &g12a_vdec_1_div.hw,
4613 		[CLKID_VDEC_1]			= &g12a_vdec_1.hw,
4614 		[CLKID_VDEC_HEVC_SEL]		= &g12a_vdec_hevc_sel.hw,
4615 		[CLKID_VDEC_HEVC_DIV]		= &g12a_vdec_hevc_div.hw,
4616 		[CLKID_VDEC_HEVC]		= &g12a_vdec_hevc.hw,
4617 		[CLKID_VDEC_HEVCF_SEL]		= &g12a_vdec_hevcf_sel.hw,
4618 		[CLKID_VDEC_HEVCF_DIV]		= &g12a_vdec_hevcf_div.hw,
4619 		[CLKID_VDEC_HEVCF]		= &g12a_vdec_hevcf.hw,
4620 		[CLKID_TS_DIV]			= &g12a_ts_div.hw,
4621 		[CLKID_TS]			= &g12a_ts.hw,
4622 		[CLKID_GP1_PLL_DCO]		= &sm1_gp1_pll_dco.hw,
4623 		[CLKID_GP1_PLL]			= &sm1_gp1_pll.hw,
4624 		[CLKID_DSU_CLK_DYN0_SEL]	= &sm1_dsu_clk_premux0.hw,
4625 		[CLKID_DSU_CLK_DYN0_DIV]	= &sm1_dsu_clk_premux1.hw,
4626 		[CLKID_DSU_CLK_DYN0]		= &sm1_dsu_clk_mux0_div.hw,
4627 		[CLKID_DSU_CLK_DYN1_SEL]	= &sm1_dsu_clk_postmux0.hw,
4628 		[CLKID_DSU_CLK_DYN1_DIV]	= &sm1_dsu_clk_mux1_div.hw,
4629 		[CLKID_DSU_CLK_DYN1]		= &sm1_dsu_clk_postmux1.hw,
4630 		[CLKID_DSU_CLK_DYN]		= &sm1_dsu_clk_dyn.hw,
4631 		[CLKID_DSU_CLK_FINAL]		= &sm1_dsu_final_clk.hw,
4632 		[CLKID_DSU_CLK]			= &sm1_dsu_clk.hw,
4633 		[CLKID_CPU1_CLK]		= &sm1_cpu1_clk.hw,
4634 		[CLKID_CPU2_CLK]		= &sm1_cpu2_clk.hw,
4635 		[CLKID_CPU3_CLK]		= &sm1_cpu3_clk.hw,
4636 		[NR_CLKS]			= NULL,
4637 	},
4638 	.num = NR_CLKS,
4639 };
4640 
4641 /* Convenience table to populate regmap in .probe */
4642 static struct clk_regmap *const g12a_clk_regmaps[] = {
4643 	&g12a_clk81,
4644 	&g12a_dos,
4645 	&g12a_ddr,
4646 	&g12a_audio_locker,
4647 	&g12a_mipi_dsi_host,
4648 	&g12a_eth_phy,
4649 	&g12a_isa,
4650 	&g12a_pl301,
4651 	&g12a_periphs,
4652 	&g12a_spicc_0,
4653 	&g12a_i2c,
4654 	&g12a_sana,
4655 	&g12a_sd,
4656 	&g12a_rng0,
4657 	&g12a_uart0,
4658 	&g12a_spicc_1,
4659 	&g12a_hiu_reg,
4660 	&g12a_mipi_dsi_phy,
4661 	&g12a_assist_misc,
4662 	&g12a_emmc_a,
4663 	&g12a_emmc_b,
4664 	&g12a_emmc_c,
4665 	&g12a_audio_codec,
4666 	&g12a_audio,
4667 	&g12a_eth_core,
4668 	&g12a_demux,
4669 	&g12a_audio_ififo,
4670 	&g12a_adc,
4671 	&g12a_uart1,
4672 	&g12a_g2d,
4673 	&g12a_reset,
4674 	&g12a_pcie_comb,
4675 	&g12a_parser,
4676 	&g12a_usb_general,
4677 	&g12a_pcie_phy,
4678 	&g12a_ahb_arb0,
4679 	&g12a_ahb_data_bus,
4680 	&g12a_ahb_ctrl_bus,
4681 	&g12a_htx_hdcp22,
4682 	&g12a_htx_pclk,
4683 	&g12a_bt656,
4684 	&g12a_usb1_to_ddr,
4685 	&g12a_mmc_pclk,
4686 	&g12a_vpu_intr,
4687 	&g12a_gic,
4688 	&g12a_sd_emmc_a_clk0,
4689 	&g12a_sd_emmc_b_clk0,
4690 	&g12a_sd_emmc_c_clk0,
4691 	&g12a_mpeg_clk_div,
4692 	&g12a_sd_emmc_a_clk0_div,
4693 	&g12a_sd_emmc_b_clk0_div,
4694 	&g12a_sd_emmc_c_clk0_div,
4695 	&g12a_mpeg_clk_sel,
4696 	&g12a_sd_emmc_a_clk0_sel,
4697 	&g12a_sd_emmc_b_clk0_sel,
4698 	&g12a_sd_emmc_c_clk0_sel,
4699 	&g12a_mpll0,
4700 	&g12a_mpll1,
4701 	&g12a_mpll2,
4702 	&g12a_mpll3,
4703 	&g12a_mpll0_div,
4704 	&g12a_mpll1_div,
4705 	&g12a_mpll2_div,
4706 	&g12a_mpll3_div,
4707 	&g12a_fixed_pll,
4708 	&g12a_sys_pll,
4709 	&g12a_gp0_pll,
4710 	&g12a_hifi_pll,
4711 	&g12a_vclk2_venci0,
4712 	&g12a_vclk2_venci1,
4713 	&g12a_vclk2_vencp0,
4714 	&g12a_vclk2_vencp1,
4715 	&g12a_vclk2_venct0,
4716 	&g12a_vclk2_venct1,
4717 	&g12a_vclk2_other,
4718 	&g12a_vclk2_enci,
4719 	&g12a_vclk2_encp,
4720 	&g12a_dac_clk,
4721 	&g12a_aoclk_gate,
4722 	&g12a_iec958_gate,
4723 	&g12a_enc480p,
4724 	&g12a_rng1,
4725 	&g12a_vclk2_enct,
4726 	&g12a_vclk2_encl,
4727 	&g12a_vclk2_venclmmc,
4728 	&g12a_vclk2_vencl,
4729 	&g12a_vclk2_other1,
4730 	&g12a_fixed_pll_dco,
4731 	&g12a_sys_pll_dco,
4732 	&g12a_gp0_pll_dco,
4733 	&g12a_hifi_pll_dco,
4734 	&g12a_fclk_div2,
4735 	&g12a_fclk_div3,
4736 	&g12a_fclk_div4,
4737 	&g12a_fclk_div5,
4738 	&g12a_fclk_div7,
4739 	&g12a_fclk_div2p5,
4740 	&g12a_dma,
4741 	&g12a_efuse,
4742 	&g12a_rom_boot,
4743 	&g12a_reset_sec,
4744 	&g12a_sec_ahb_apb3,
4745 	&g12a_vpu_0_sel,
4746 	&g12a_vpu_0_div,
4747 	&g12a_vpu_0,
4748 	&g12a_vpu_1_sel,
4749 	&g12a_vpu_1_div,
4750 	&g12a_vpu_1,
4751 	&g12a_vpu,
4752 	&g12a_vapb_0_sel,
4753 	&g12a_vapb_0_div,
4754 	&g12a_vapb_0,
4755 	&g12a_vapb_1_sel,
4756 	&g12a_vapb_1_div,
4757 	&g12a_vapb_1,
4758 	&g12a_vapb_sel,
4759 	&g12a_vapb,
4760 	&g12a_hdmi_pll_dco,
4761 	&g12a_hdmi_pll_od,
4762 	&g12a_hdmi_pll_od2,
4763 	&g12a_hdmi_pll,
4764 	&g12a_vid_pll_div,
4765 	&g12a_vid_pll_sel,
4766 	&g12a_vid_pll,
4767 	&g12a_vclk_sel,
4768 	&g12a_vclk2_sel,
4769 	&g12a_vclk_input,
4770 	&g12a_vclk2_input,
4771 	&g12a_vclk_div,
4772 	&g12a_vclk2_div,
4773 	&g12a_vclk,
4774 	&g12a_vclk2,
4775 	&g12a_vclk_div1,
4776 	&g12a_vclk_div2_en,
4777 	&g12a_vclk_div4_en,
4778 	&g12a_vclk_div6_en,
4779 	&g12a_vclk_div12_en,
4780 	&g12a_vclk2_div1,
4781 	&g12a_vclk2_div2_en,
4782 	&g12a_vclk2_div4_en,
4783 	&g12a_vclk2_div6_en,
4784 	&g12a_vclk2_div12_en,
4785 	&g12a_cts_enci_sel,
4786 	&g12a_cts_encp_sel,
4787 	&g12a_cts_vdac_sel,
4788 	&g12a_hdmi_tx_sel,
4789 	&g12a_cts_enci,
4790 	&g12a_cts_encp,
4791 	&g12a_cts_vdac,
4792 	&g12a_hdmi_tx,
4793 	&g12a_hdmi_sel,
4794 	&g12a_hdmi_div,
4795 	&g12a_hdmi,
4796 	&g12a_mali_0_sel,
4797 	&g12a_mali_0_div,
4798 	&g12a_mali_0,
4799 	&g12a_mali_1_sel,
4800 	&g12a_mali_1_div,
4801 	&g12a_mali_1,
4802 	&g12a_mali,
4803 	&g12a_mpll_50m,
4804 	&g12a_sys_pll_div16_en,
4805 	&g12a_cpu_clk_premux0,
4806 	&g12a_cpu_clk_mux0_div,
4807 	&g12a_cpu_clk_postmux0,
4808 	&g12a_cpu_clk_premux1,
4809 	&g12a_cpu_clk_mux1_div,
4810 	&g12a_cpu_clk_postmux1,
4811 	&g12a_cpu_clk_dyn,
4812 	&g12a_cpu_clk,
4813 	&g12a_cpu_clk_div16_en,
4814 	&g12a_cpu_clk_apb_div,
4815 	&g12a_cpu_clk_apb,
4816 	&g12a_cpu_clk_atb_div,
4817 	&g12a_cpu_clk_atb,
4818 	&g12a_cpu_clk_axi_div,
4819 	&g12a_cpu_clk_axi,
4820 	&g12a_cpu_clk_trace_div,
4821 	&g12a_cpu_clk_trace,
4822 	&g12a_pcie_pll_od,
4823 	&g12a_pcie_pll_dco,
4824 	&g12a_vdec_1_sel,
4825 	&g12a_vdec_1_div,
4826 	&g12a_vdec_1,
4827 	&g12a_vdec_hevc_sel,
4828 	&g12a_vdec_hevc_div,
4829 	&g12a_vdec_hevc,
4830 	&g12a_vdec_hevcf_sel,
4831 	&g12a_vdec_hevcf_div,
4832 	&g12a_vdec_hevcf,
4833 	&g12a_ts_div,
4834 	&g12a_ts,
4835 	&g12b_cpu_clk,
4836 	&g12b_sys1_pll_dco,
4837 	&g12b_sys1_pll,
4838 	&g12b_sys1_pll_div16_en,
4839 	&g12b_cpub_clk_premux0,
4840 	&g12b_cpub_clk_mux0_div,
4841 	&g12b_cpub_clk_postmux0,
4842 	&g12b_cpub_clk_premux1,
4843 	&g12b_cpub_clk_mux1_div,
4844 	&g12b_cpub_clk_postmux1,
4845 	&g12b_cpub_clk_dyn,
4846 	&g12b_cpub_clk,
4847 	&g12b_cpub_clk_div16_en,
4848 	&g12b_cpub_clk_apb_sel,
4849 	&g12b_cpub_clk_apb,
4850 	&g12b_cpub_clk_atb_sel,
4851 	&g12b_cpub_clk_atb,
4852 	&g12b_cpub_clk_axi_sel,
4853 	&g12b_cpub_clk_axi,
4854 	&g12b_cpub_clk_trace_sel,
4855 	&g12b_cpub_clk_trace,
4856 	&sm1_gp1_pll_dco,
4857 	&sm1_gp1_pll,
4858 	&sm1_dsu_clk_premux0,
4859 	&sm1_dsu_clk_premux1,
4860 	&sm1_dsu_clk_mux0_div,
4861 	&sm1_dsu_clk_postmux0,
4862 	&sm1_dsu_clk_mux1_div,
4863 	&sm1_dsu_clk_postmux1,
4864 	&sm1_dsu_clk_dyn,
4865 	&sm1_dsu_final_clk,
4866 	&sm1_dsu_clk,
4867 	&sm1_cpu1_clk,
4868 	&sm1_cpu2_clk,
4869 	&sm1_cpu3_clk,
4870 };
4871 
4872 static const struct reg_sequence g12a_init_regs[] = {
4873 	{ .reg = HHI_MPLL_CNTL0,	.def = 0x00000543 },
4874 };
4875 
4876 static int meson_g12a_dvfs_setup_common(struct platform_device *pdev,
4877 					struct clk_hw **hws)
4878 {
4879 	const char *notifier_clk_name;
4880 	struct clk *notifier_clk;
4881 	struct clk_hw *xtal;
4882 	int ret;
4883 
4884 	xtal = clk_hw_get_parent_by_index(hws[CLKID_CPU_CLK_DYN1_SEL], 0);
4885 
4886 	/* Setup clock notifier for cpu_clk_postmux0 */
4887 	g12a_cpu_clk_postmux0_nb_data.xtal = xtal;
4888 	notifier_clk_name = clk_hw_get_name(&g12a_cpu_clk_postmux0.hw);
4889 	notifier_clk = __clk_lookup(notifier_clk_name);
4890 	ret = clk_notifier_register(notifier_clk,
4891 				    &g12a_cpu_clk_postmux0_nb_data.nb);
4892 	if (ret) {
4893 		dev_err(&pdev->dev, "failed to register the cpu_clk_postmux0 notifier\n");
4894 		return ret;
4895 	}
4896 
4897 	/* Setup clock notifier for cpu_clk_dyn mux */
4898 	notifier_clk_name = clk_hw_get_name(&g12a_cpu_clk_dyn.hw);
4899 	notifier_clk = __clk_lookup(notifier_clk_name);
4900 	ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb);
4901 	if (ret) {
4902 		dev_err(&pdev->dev, "failed to register the cpu_clk_dyn notifier\n");
4903 		return ret;
4904 	}
4905 
4906 	return 0;
4907 }
4908 
4909 static int meson_g12b_dvfs_setup(struct platform_device *pdev)
4910 {
4911 	struct clk_hw **hws = g12b_hw_onecell_data.hws;
4912 	const char *notifier_clk_name;
4913 	struct clk *notifier_clk;
4914 	struct clk_hw *xtal;
4915 	int ret;
4916 
4917 	ret = meson_g12a_dvfs_setup_common(pdev, hws);
4918 	if (ret)
4919 		return ret;
4920 
4921 	xtal = clk_hw_get_parent_by_index(hws[CLKID_CPU_CLK_DYN1_SEL], 0);
4922 
4923 	/* Setup clock notifier for cpu_clk mux */
4924 	notifier_clk_name = clk_hw_get_name(&g12b_cpu_clk.hw);
4925 	notifier_clk = __clk_lookup(notifier_clk_name);
4926 	ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb);
4927 	if (ret) {
4928 		dev_err(&pdev->dev, "failed to register the cpu_clk notifier\n");
4929 		return ret;
4930 	}
4931 
4932 	/* Setup clock notifier for sys1_pll */
4933 	notifier_clk_name = clk_hw_get_name(&g12b_sys1_pll.hw);
4934 	notifier_clk = __clk_lookup(notifier_clk_name);
4935 	ret = clk_notifier_register(notifier_clk,
4936 				    &g12b_cpu_clk_sys1_pll_nb_data.nb);
4937 	if (ret) {
4938 		dev_err(&pdev->dev, "failed to register the sys1_pll notifier\n");
4939 		return ret;
4940 	}
4941 
4942 	/* Add notifiers for the second CPU cluster */
4943 
4944 	/* Setup clock notifier for cpub_clk_postmux0 */
4945 	g12b_cpub_clk_postmux0_nb_data.xtal = xtal;
4946 	notifier_clk_name = clk_hw_get_name(&g12b_cpub_clk_postmux0.hw);
4947 	notifier_clk = __clk_lookup(notifier_clk_name);
4948 	ret = clk_notifier_register(notifier_clk,
4949 				    &g12b_cpub_clk_postmux0_nb_data.nb);
4950 	if (ret) {
4951 		dev_err(&pdev->dev, "failed to register the cpub_clk_postmux0 notifier\n");
4952 		return ret;
4953 	}
4954 
4955 	/* Setup clock notifier for cpub_clk_dyn mux */
4956 	notifier_clk_name = clk_hw_get_name(&g12b_cpub_clk_dyn.hw);
4957 	notifier_clk = __clk_lookup(notifier_clk_name);
4958 	ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb);
4959 	if (ret) {
4960 		dev_err(&pdev->dev, "failed to register the cpub_clk_dyn notifier\n");
4961 		return ret;
4962 	}
4963 
4964 	/* Setup clock notifier for cpub_clk mux */
4965 	notifier_clk_name = clk_hw_get_name(&g12b_cpub_clk.hw);
4966 	notifier_clk = __clk_lookup(notifier_clk_name);
4967 	ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb);
4968 	if (ret) {
4969 		dev_err(&pdev->dev, "failed to register the cpub_clk notifier\n");
4970 		return ret;
4971 	}
4972 
4973 	/* Setup clock notifier for sys_pll */
4974 	notifier_clk_name = clk_hw_get_name(&g12a_sys_pll.hw);
4975 	notifier_clk = __clk_lookup(notifier_clk_name);
4976 	ret = clk_notifier_register(notifier_clk,
4977 				    &g12b_cpub_clk_sys_pll_nb_data.nb);
4978 	if (ret) {
4979 		dev_err(&pdev->dev, "failed to register the sys_pll notifier\n");
4980 		return ret;
4981 	}
4982 
4983 	return 0;
4984 }
4985 
4986 static int meson_g12a_dvfs_setup(struct platform_device *pdev)
4987 {
4988 	struct clk_hw **hws = g12a_hw_onecell_data.hws;
4989 	const char *notifier_clk_name;
4990 	struct clk *notifier_clk;
4991 	int ret;
4992 
4993 	ret = meson_g12a_dvfs_setup_common(pdev, hws);
4994 	if (ret)
4995 		return ret;
4996 
4997 	/* Setup clock notifier for cpu_clk mux */
4998 	notifier_clk_name = clk_hw_get_name(&g12a_cpu_clk.hw);
4999 	notifier_clk = __clk_lookup(notifier_clk_name);
5000 	ret = clk_notifier_register(notifier_clk, &g12a_cpu_clk_mux_nb);
5001 	if (ret) {
5002 		dev_err(&pdev->dev, "failed to register the cpu_clk notifier\n");
5003 		return ret;
5004 	}
5005 
5006 	/* Setup clock notifier for sys_pll */
5007 	notifier_clk_name = clk_hw_get_name(&g12a_sys_pll.hw);
5008 	notifier_clk = __clk_lookup(notifier_clk_name);
5009 	ret = clk_notifier_register(notifier_clk, &g12a_sys_pll_nb_data.nb);
5010 	if (ret) {
5011 		dev_err(&pdev->dev, "failed to register the sys_pll notifier\n");
5012 		return ret;
5013 	}
5014 
5015 	return 0;
5016 }
5017 
5018 struct meson_g12a_data {
5019 	const struct meson_eeclkc_data eeclkc_data;
5020 	int (*dvfs_setup)(struct platform_device *pdev);
5021 };
5022 
5023 static int meson_g12a_probe(struct platform_device *pdev)
5024 {
5025 	const struct meson_eeclkc_data *eeclkc_data;
5026 	const struct meson_g12a_data *g12a_data;
5027 	int ret;
5028 
5029 	eeclkc_data = of_device_get_match_data(&pdev->dev);
5030 	if (!eeclkc_data)
5031 		return -EINVAL;
5032 
5033 	ret = meson_eeclkc_probe(pdev);
5034 	if (ret)
5035 		return ret;
5036 
5037 	g12a_data = container_of(eeclkc_data, struct meson_g12a_data,
5038 				 eeclkc_data);
5039 
5040 	if (g12a_data->dvfs_setup)
5041 		return g12a_data->dvfs_setup(pdev);
5042 
5043 	return 0;
5044 }
5045 
5046 static const struct meson_g12a_data g12a_clkc_data = {
5047 	.eeclkc_data = {
5048 		.regmap_clks = g12a_clk_regmaps,
5049 		.regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps),
5050 		.hw_onecell_data = &g12a_hw_onecell_data,
5051 		.init_regs = g12a_init_regs,
5052 		.init_count = ARRAY_SIZE(g12a_init_regs),
5053 	},
5054 	.dvfs_setup = meson_g12a_dvfs_setup,
5055 };
5056 
5057 static const struct meson_g12a_data g12b_clkc_data = {
5058 	.eeclkc_data = {
5059 		.regmap_clks = g12a_clk_regmaps,
5060 		.regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps),
5061 		.hw_onecell_data = &g12b_hw_onecell_data,
5062 	},
5063 	.dvfs_setup = meson_g12b_dvfs_setup,
5064 };
5065 
5066 static const struct meson_g12a_data sm1_clkc_data = {
5067 	.eeclkc_data = {
5068 		.regmap_clks = g12a_clk_regmaps,
5069 		.regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps),
5070 		.hw_onecell_data = &sm1_hw_onecell_data,
5071 	},
5072 	.dvfs_setup = meson_g12a_dvfs_setup,
5073 };
5074 
5075 static const struct of_device_id clkc_match_table[] = {
5076 	{
5077 		.compatible = "amlogic,g12a-clkc",
5078 		.data = &g12a_clkc_data.eeclkc_data
5079 	},
5080 	{
5081 		.compatible = "amlogic,g12b-clkc",
5082 		.data = &g12b_clkc_data.eeclkc_data
5083 	},
5084 	{
5085 		.compatible = "amlogic,sm1-clkc",
5086 		.data = &sm1_clkc_data.eeclkc_data
5087 	},
5088 	{}
5089 };
5090 
5091 static struct platform_driver g12a_driver = {
5092 	.probe		= meson_g12a_probe,
5093 	.driver		= {
5094 		.name	= "g12a-clkc",
5095 		.of_match_table = clkc_match_table,
5096 	},
5097 };
5098 
5099 builtin_platform_driver(g12a_driver);
5100