xref: /openbmc/linux/drivers/clk/meson/meson8b.c (revision 11c416e3)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2015 Endless Mobile, Inc.
4  * Author: Carlo Caione <carlo@endlessm.com>
5  *
6  * Copyright (c) 2016 BayLibre, Inc.
7  * Michael Turquette <mturquette@baylibre.com>
8  */
9 
10 #include <linux/clk.h>
11 #include <linux/clk-provider.h>
12 #include <linux/init.h>
13 #include <linux/mfd/syscon.h>
14 #include <linux/of_address.h>
15 #include <linux/reset-controller.h>
16 #include <linux/slab.h>
17 #include <linux/regmap.h>
18 
19 #include "meson8b.h"
20 #include "clk-regmap.h"
21 #include "clk-pll.h"
22 #include "clk-mpll.h"
23 
24 static DEFINE_SPINLOCK(meson_clk_lock);
25 
26 struct meson8b_clk_reset {
27 	struct reset_controller_dev reset;
28 	struct regmap *regmap;
29 };
30 
31 static const struct pll_params_table sys_pll_params_table[] = {
32 	PLL_PARAMS(50, 1),
33 	PLL_PARAMS(51, 1),
34 	PLL_PARAMS(52, 1),
35 	PLL_PARAMS(53, 1),
36 	PLL_PARAMS(54, 1),
37 	PLL_PARAMS(55, 1),
38 	PLL_PARAMS(56, 1),
39 	PLL_PARAMS(57, 1),
40 	PLL_PARAMS(58, 1),
41 	PLL_PARAMS(59, 1),
42 	PLL_PARAMS(60, 1),
43 	PLL_PARAMS(61, 1),
44 	PLL_PARAMS(62, 1),
45 	PLL_PARAMS(63, 1),
46 	PLL_PARAMS(64, 1),
47 	PLL_PARAMS(65, 1),
48 	PLL_PARAMS(66, 1),
49 	PLL_PARAMS(67, 1),
50 	PLL_PARAMS(68, 1),
51 	PLL_PARAMS(84, 1),
52 	{ /* sentinel */ },
53 };
54 
55 static struct clk_fixed_rate meson8b_xtal = {
56 	.fixed_rate = 24000000,
57 	.hw.init = &(struct clk_init_data){
58 		.name = "xtal",
59 		.num_parents = 0,
60 		.ops = &clk_fixed_rate_ops,
61 	},
62 };
63 
64 static struct clk_regmap meson8b_fixed_pll_dco = {
65 	.data = &(struct meson_clk_pll_data){
66 		.en = {
67 			.reg_off = HHI_MPLL_CNTL,
68 			.shift   = 30,
69 			.width   = 1,
70 		},
71 		.m = {
72 			.reg_off = HHI_MPLL_CNTL,
73 			.shift   = 0,
74 			.width   = 9,
75 		},
76 		.n = {
77 			.reg_off = HHI_MPLL_CNTL,
78 			.shift   = 9,
79 			.width   = 5,
80 		},
81 		.frac = {
82 			.reg_off = HHI_MPLL_CNTL2,
83 			.shift   = 0,
84 			.width   = 12,
85 		},
86 		.l = {
87 			.reg_off = HHI_MPLL_CNTL,
88 			.shift   = 31,
89 			.width   = 1,
90 		},
91 		.rst = {
92 			.reg_off = HHI_MPLL_CNTL,
93 			.shift   = 29,
94 			.width   = 1,
95 		},
96 	},
97 	.hw.init = &(struct clk_init_data){
98 		.name = "fixed_pll_dco",
99 		.ops = &meson_clk_pll_ro_ops,
100 		.parent_data = &(const struct clk_parent_data) {
101 			.fw_name = "xtal",
102 			.name = "xtal",
103 			.index = -1,
104 		},
105 		.num_parents = 1,
106 	},
107 };
108 
109 static struct clk_regmap meson8b_fixed_pll = {
110 	.data = &(struct clk_regmap_div_data){
111 		.offset = HHI_MPLL_CNTL,
112 		.shift = 16,
113 		.width = 2,
114 		.flags = CLK_DIVIDER_POWER_OF_TWO,
115 	},
116 	.hw.init = &(struct clk_init_data){
117 		.name = "fixed_pll",
118 		.ops = &clk_regmap_divider_ro_ops,
119 		.parent_hws = (const struct clk_hw *[]) {
120 			&meson8b_fixed_pll_dco.hw
121 		},
122 		.num_parents = 1,
123 		/*
124 		 * This clock won't ever change at runtime so
125 		 * CLK_SET_RATE_PARENT is not required
126 		 */
127 	},
128 };
129 
130 static struct clk_regmap meson8b_hdmi_pll_dco = {
131 	.data = &(struct meson_clk_pll_data){
132 		.en = {
133 			.reg_off = HHI_VID_PLL_CNTL,
134 			.shift   = 30,
135 			.width   = 1,
136 		},
137 		.m = {
138 			.reg_off = HHI_VID_PLL_CNTL,
139 			.shift   = 0,
140 			.width   = 9,
141 		},
142 		.n = {
143 			.reg_off = HHI_VID_PLL_CNTL,
144 			.shift   = 10,
145 			.width   = 5,
146 		},
147 		.frac = {
148 			.reg_off = HHI_VID_PLL_CNTL2,
149 			.shift   = 0,
150 			.width   = 12,
151 		},
152 		.l = {
153 			.reg_off = HHI_VID_PLL_CNTL,
154 			.shift   = 31,
155 			.width   = 1,
156 		},
157 		.rst = {
158 			.reg_off = HHI_VID_PLL_CNTL,
159 			.shift   = 29,
160 			.width   = 1,
161 		},
162 	},
163 	.hw.init = &(struct clk_init_data){
164 		/* sometimes also called "HPLL" or "HPLL PLL" */
165 		.name = "hdmi_pll_dco",
166 		.ops = &meson_clk_pll_ro_ops,
167 		.parent_data = &(const struct clk_parent_data) {
168 			.fw_name = "xtal",
169 			.name = "xtal",
170 			.index = -1,
171 		},
172 		.num_parents = 1,
173 	},
174 };
175 
176 static struct clk_regmap meson8b_hdmi_pll_lvds_out = {
177 	.data = &(struct clk_regmap_div_data){
178 		.offset = HHI_VID_PLL_CNTL,
179 		.shift = 16,
180 		.width = 2,
181 		.flags = CLK_DIVIDER_POWER_OF_TWO,
182 	},
183 	.hw.init = &(struct clk_init_data){
184 		.name = "hdmi_pll_lvds_out",
185 		.ops = &clk_regmap_divider_ro_ops,
186 		.parent_hws = (const struct clk_hw *[]) {
187 			&meson8b_hdmi_pll_dco.hw
188 		},
189 		.num_parents = 1,
190 		.flags = CLK_SET_RATE_PARENT,
191 	},
192 };
193 
194 static struct clk_regmap meson8b_hdmi_pll_hdmi_out = {
195 	.data = &(struct clk_regmap_div_data){
196 		.offset = HHI_VID_PLL_CNTL,
197 		.shift = 18,
198 		.width = 2,
199 		.flags = CLK_DIVIDER_POWER_OF_TWO,
200 	},
201 	.hw.init = &(struct clk_init_data){
202 		.name = "hdmi_pll_hdmi_out",
203 		.ops = &clk_regmap_divider_ro_ops,
204 		.parent_hws = (const struct clk_hw *[]) {
205 			&meson8b_hdmi_pll_dco.hw
206 		},
207 		.num_parents = 1,
208 		.flags = CLK_SET_RATE_PARENT,
209 	},
210 };
211 
212 static struct clk_regmap meson8b_sys_pll_dco = {
213 	.data = &(struct meson_clk_pll_data){
214 		.en = {
215 			.reg_off = HHI_SYS_PLL_CNTL,
216 			.shift   = 30,
217 			.width   = 1,
218 		},
219 		.m = {
220 			.reg_off = HHI_SYS_PLL_CNTL,
221 			.shift   = 0,
222 			.width   = 9,
223 		},
224 		.n = {
225 			.reg_off = HHI_SYS_PLL_CNTL,
226 			.shift   = 9,
227 			.width   = 5,
228 		},
229 		.l = {
230 			.reg_off = HHI_SYS_PLL_CNTL,
231 			.shift   = 31,
232 			.width   = 1,
233 		},
234 		.rst = {
235 			.reg_off = HHI_SYS_PLL_CNTL,
236 			.shift   = 29,
237 			.width   = 1,
238 		},
239 		.table = sys_pll_params_table,
240 	},
241 	.hw.init = &(struct clk_init_data){
242 		.name = "sys_pll_dco",
243 		.ops = &meson_clk_pll_ops,
244 		.parent_data = &(const struct clk_parent_data) {
245 			.fw_name = "xtal",
246 			.name = "xtal",
247 			.index = -1,
248 		},
249 		.num_parents = 1,
250 	},
251 };
252 
253 static struct clk_regmap meson8b_sys_pll = {
254 	.data = &(struct clk_regmap_div_data){
255 		.offset = HHI_SYS_PLL_CNTL,
256 		.shift = 16,
257 		.width = 2,
258 		.flags = CLK_DIVIDER_POWER_OF_TWO,
259 	},
260 	.hw.init = &(struct clk_init_data){
261 		.name = "sys_pll",
262 		.ops = &clk_regmap_divider_ops,
263 		.parent_hws = (const struct clk_hw *[]) {
264 			&meson8b_sys_pll_dco.hw
265 		},
266 		.num_parents = 1,
267 		.flags = CLK_SET_RATE_PARENT,
268 	},
269 };
270 
271 static struct clk_fixed_factor meson8b_fclk_div2_div = {
272 	.mult = 1,
273 	.div = 2,
274 	.hw.init = &(struct clk_init_data){
275 		.name = "fclk_div2_div",
276 		.ops = &clk_fixed_factor_ops,
277 		.parent_hws = (const struct clk_hw *[]) {
278 			&meson8b_fixed_pll.hw
279 		},
280 		.num_parents = 1,
281 	},
282 };
283 
284 static struct clk_regmap meson8b_fclk_div2 = {
285 	.data = &(struct clk_regmap_gate_data){
286 		.offset = HHI_MPLL_CNTL6,
287 		.bit_idx = 27,
288 	},
289 	.hw.init = &(struct clk_init_data){
290 		.name = "fclk_div2",
291 		.ops = &clk_regmap_gate_ops,
292 		.parent_hws = (const struct clk_hw *[]) {
293 			&meson8b_fclk_div2_div.hw
294 		},
295 		.num_parents = 1,
296 		/*
297 		 * FIXME: Ethernet with a RGMII PHYs is not working if
298 		 * fclk_div2 is disabled. it is currently unclear why this
299 		 * is. keep it enabled until the Ethernet driver knows how
300 		 * to manage this clock.
301 		 */
302 		.flags = CLK_IS_CRITICAL,
303 	},
304 };
305 
306 static struct clk_fixed_factor meson8b_fclk_div3_div = {
307 	.mult = 1,
308 	.div = 3,
309 	.hw.init = &(struct clk_init_data){
310 		.name = "fclk_div3_div",
311 		.ops = &clk_fixed_factor_ops,
312 		.parent_hws = (const struct clk_hw *[]) {
313 			&meson8b_fixed_pll.hw
314 		},
315 		.num_parents = 1,
316 	},
317 };
318 
319 static struct clk_regmap meson8b_fclk_div3 = {
320 	.data = &(struct clk_regmap_gate_data){
321 		.offset = HHI_MPLL_CNTL6,
322 		.bit_idx = 28,
323 	},
324 	.hw.init = &(struct clk_init_data){
325 		.name = "fclk_div3",
326 		.ops = &clk_regmap_gate_ops,
327 		.parent_hws = (const struct clk_hw *[]) {
328 			&meson8b_fclk_div3_div.hw
329 		},
330 		.num_parents = 1,
331 	},
332 };
333 
334 static struct clk_fixed_factor meson8b_fclk_div4_div = {
335 	.mult = 1,
336 	.div = 4,
337 	.hw.init = &(struct clk_init_data){
338 		.name = "fclk_div4_div",
339 		.ops = &clk_fixed_factor_ops,
340 		.parent_hws = (const struct clk_hw *[]) {
341 			&meson8b_fixed_pll.hw
342 		},
343 		.num_parents = 1,
344 	},
345 };
346 
347 static struct clk_regmap meson8b_fclk_div4 = {
348 	.data = &(struct clk_regmap_gate_data){
349 		.offset = HHI_MPLL_CNTL6,
350 		.bit_idx = 29,
351 	},
352 	.hw.init = &(struct clk_init_data){
353 		.name = "fclk_div4",
354 		.ops = &clk_regmap_gate_ops,
355 		.parent_hws = (const struct clk_hw *[]) {
356 			&meson8b_fclk_div4_div.hw
357 		},
358 		.num_parents = 1,
359 	},
360 };
361 
362 static struct clk_fixed_factor meson8b_fclk_div5_div = {
363 	.mult = 1,
364 	.div = 5,
365 	.hw.init = &(struct clk_init_data){
366 		.name = "fclk_div5_div",
367 		.ops = &clk_fixed_factor_ops,
368 		.parent_hws = (const struct clk_hw *[]) {
369 			&meson8b_fixed_pll.hw
370 		},
371 		.num_parents = 1,
372 	},
373 };
374 
375 static struct clk_regmap meson8b_fclk_div5 = {
376 	.data = &(struct clk_regmap_gate_data){
377 		.offset = HHI_MPLL_CNTL6,
378 		.bit_idx = 30,
379 	},
380 	.hw.init = &(struct clk_init_data){
381 		.name = "fclk_div5",
382 		.ops = &clk_regmap_gate_ops,
383 		.parent_hws = (const struct clk_hw *[]) {
384 			&meson8b_fclk_div5_div.hw
385 		},
386 		.num_parents = 1,
387 	},
388 };
389 
390 static struct clk_fixed_factor meson8b_fclk_div7_div = {
391 	.mult = 1,
392 	.div = 7,
393 	.hw.init = &(struct clk_init_data){
394 		.name = "fclk_div7_div",
395 		.ops = &clk_fixed_factor_ops,
396 		.parent_hws = (const struct clk_hw *[]) {
397 			&meson8b_fixed_pll.hw
398 		},
399 		.num_parents = 1,
400 	},
401 };
402 
403 static struct clk_regmap meson8b_fclk_div7 = {
404 	.data = &(struct clk_regmap_gate_data){
405 		.offset = HHI_MPLL_CNTL6,
406 		.bit_idx = 31,
407 	},
408 	.hw.init = &(struct clk_init_data){
409 		.name = "fclk_div7",
410 		.ops = &clk_regmap_gate_ops,
411 		.parent_hws = (const struct clk_hw *[]) {
412 			&meson8b_fclk_div7_div.hw
413 		},
414 		.num_parents = 1,
415 	},
416 };
417 
418 static struct clk_regmap meson8b_mpll_prediv = {
419 	.data = &(struct clk_regmap_div_data){
420 		.offset = HHI_MPLL_CNTL5,
421 		.shift = 12,
422 		.width = 1,
423 	},
424 	.hw.init = &(struct clk_init_data){
425 		.name = "mpll_prediv",
426 		.ops = &clk_regmap_divider_ro_ops,
427 		.parent_hws = (const struct clk_hw *[]) {
428 			&meson8b_fixed_pll.hw
429 		},
430 		.num_parents = 1,
431 	},
432 };
433 
434 static struct clk_regmap meson8b_mpll0_div = {
435 	.data = &(struct meson_clk_mpll_data){
436 		.sdm = {
437 			.reg_off = HHI_MPLL_CNTL7,
438 			.shift   = 0,
439 			.width   = 14,
440 		},
441 		.sdm_en = {
442 			.reg_off = HHI_MPLL_CNTL7,
443 			.shift   = 15,
444 			.width   = 1,
445 		},
446 		.n2 = {
447 			.reg_off = HHI_MPLL_CNTL7,
448 			.shift   = 16,
449 			.width   = 9,
450 		},
451 		.ssen = {
452 			.reg_off = HHI_MPLL_CNTL,
453 			.shift   = 25,
454 			.width   = 1,
455 		},
456 		.lock = &meson_clk_lock,
457 	},
458 	.hw.init = &(struct clk_init_data){
459 		.name = "mpll0_div",
460 		.ops = &meson_clk_mpll_ops,
461 		.parent_hws = (const struct clk_hw *[]) {
462 			&meson8b_mpll_prediv.hw
463 		},
464 		.num_parents = 1,
465 	},
466 };
467 
468 static struct clk_regmap meson8b_mpll0 = {
469 	.data = &(struct clk_regmap_gate_data){
470 		.offset = HHI_MPLL_CNTL7,
471 		.bit_idx = 14,
472 	},
473 	.hw.init = &(struct clk_init_data){
474 		.name = "mpll0",
475 		.ops = &clk_regmap_gate_ops,
476 		.parent_hws = (const struct clk_hw *[]) {
477 			&meson8b_mpll0_div.hw
478 		},
479 		.num_parents = 1,
480 		.flags = CLK_SET_RATE_PARENT,
481 	},
482 };
483 
484 static struct clk_regmap meson8b_mpll1_div = {
485 	.data = &(struct meson_clk_mpll_data){
486 		.sdm = {
487 			.reg_off = HHI_MPLL_CNTL8,
488 			.shift   = 0,
489 			.width   = 14,
490 		},
491 		.sdm_en = {
492 			.reg_off = HHI_MPLL_CNTL8,
493 			.shift   = 15,
494 			.width   = 1,
495 		},
496 		.n2 = {
497 			.reg_off = HHI_MPLL_CNTL8,
498 			.shift   = 16,
499 			.width   = 9,
500 		},
501 		.lock = &meson_clk_lock,
502 	},
503 	.hw.init = &(struct clk_init_data){
504 		.name = "mpll1_div",
505 		.ops = &meson_clk_mpll_ops,
506 		.parent_hws = (const struct clk_hw *[]) {
507 			&meson8b_mpll_prediv.hw
508 		},
509 		.num_parents = 1,
510 	},
511 };
512 
513 static struct clk_regmap meson8b_mpll1 = {
514 	.data = &(struct clk_regmap_gate_data){
515 		.offset = HHI_MPLL_CNTL8,
516 		.bit_idx = 14,
517 	},
518 	.hw.init = &(struct clk_init_data){
519 		.name = "mpll1",
520 		.ops = &clk_regmap_gate_ops,
521 		.parent_hws = (const struct clk_hw *[]) {
522 			&meson8b_mpll1_div.hw
523 		},
524 		.num_parents = 1,
525 		.flags = CLK_SET_RATE_PARENT,
526 	},
527 };
528 
529 static struct clk_regmap meson8b_mpll2_div = {
530 	.data = &(struct meson_clk_mpll_data){
531 		.sdm = {
532 			.reg_off = HHI_MPLL_CNTL9,
533 			.shift   = 0,
534 			.width   = 14,
535 		},
536 		.sdm_en = {
537 			.reg_off = HHI_MPLL_CNTL9,
538 			.shift   = 15,
539 			.width   = 1,
540 		},
541 		.n2 = {
542 			.reg_off = HHI_MPLL_CNTL9,
543 			.shift   = 16,
544 			.width   = 9,
545 		},
546 		.lock = &meson_clk_lock,
547 	},
548 	.hw.init = &(struct clk_init_data){
549 		.name = "mpll2_div",
550 		.ops = &meson_clk_mpll_ops,
551 		.parent_hws = (const struct clk_hw *[]) {
552 			&meson8b_mpll_prediv.hw
553 		},
554 		.num_parents = 1,
555 	},
556 };
557 
558 static struct clk_regmap meson8b_mpll2 = {
559 	.data = &(struct clk_regmap_gate_data){
560 		.offset = HHI_MPLL_CNTL9,
561 		.bit_idx = 14,
562 	},
563 	.hw.init = &(struct clk_init_data){
564 		.name = "mpll2",
565 		.ops = &clk_regmap_gate_ops,
566 		.parent_hws = (const struct clk_hw *[]) {
567 			&meson8b_mpll2_div.hw
568 		},
569 		.num_parents = 1,
570 		.flags = CLK_SET_RATE_PARENT,
571 	},
572 };
573 
574 static u32 mux_table_clk81[]	= { 6, 5, 7 };
575 static struct clk_regmap meson8b_mpeg_clk_sel = {
576 	.data = &(struct clk_regmap_mux_data){
577 		.offset = HHI_MPEG_CLK_CNTL,
578 		.mask = 0x7,
579 		.shift = 12,
580 		.table = mux_table_clk81,
581 	},
582 	.hw.init = &(struct clk_init_data){
583 		.name = "mpeg_clk_sel",
584 		.ops = &clk_regmap_mux_ro_ops,
585 		/*
586 		 * FIXME bits 14:12 selects from 8 possible parents:
587 		 * xtal, 1'b0 (wtf), fclk_div7, mpll_clkout1, mpll_clkout2,
588 		 * fclk_div4, fclk_div3, fclk_div5
589 		 */
590 		.parent_hws = (const struct clk_hw *[]) {
591 			&meson8b_fclk_div3.hw,
592 			&meson8b_fclk_div4.hw,
593 			&meson8b_fclk_div5.hw,
594 		},
595 		.num_parents = 3,
596 	},
597 };
598 
599 static struct clk_regmap meson8b_mpeg_clk_div = {
600 	.data = &(struct clk_regmap_div_data){
601 		.offset = HHI_MPEG_CLK_CNTL,
602 		.shift = 0,
603 		.width = 7,
604 	},
605 	.hw.init = &(struct clk_init_data){
606 		.name = "mpeg_clk_div",
607 		.ops = &clk_regmap_divider_ro_ops,
608 		.parent_hws = (const struct clk_hw *[]) {
609 			&meson8b_mpeg_clk_sel.hw
610 		},
611 		.num_parents = 1,
612 	},
613 };
614 
615 static struct clk_regmap meson8b_clk81 = {
616 	.data = &(struct clk_regmap_gate_data){
617 		.offset = HHI_MPEG_CLK_CNTL,
618 		.bit_idx = 7,
619 	},
620 	.hw.init = &(struct clk_init_data){
621 		.name = "clk81",
622 		.ops = &clk_regmap_gate_ops,
623 		.parent_hws = (const struct clk_hw *[]) {
624 			&meson8b_mpeg_clk_div.hw
625 		},
626 		.num_parents = 1,
627 		.flags = CLK_IS_CRITICAL,
628 	},
629 };
630 
631 static struct clk_regmap meson8b_cpu_in_sel = {
632 	.data = &(struct clk_regmap_mux_data){
633 		.offset = HHI_SYS_CPU_CLK_CNTL0,
634 		.mask = 0x1,
635 		.shift = 0,
636 	},
637 	.hw.init = &(struct clk_init_data){
638 		.name = "cpu_in_sel",
639 		.ops = &clk_regmap_mux_ops,
640 		.parent_data = (const struct clk_parent_data[]) {
641 			{ .fw_name = "xtal", .name = "xtal", .index = -1, },
642 			{ .hw = &meson8b_sys_pll.hw, },
643 		},
644 		.num_parents = 2,
645 		.flags = (CLK_SET_RATE_PARENT |
646 			  CLK_SET_RATE_NO_REPARENT),
647 	},
648 };
649 
650 static struct clk_fixed_factor meson8b_cpu_in_div2 = {
651 	.mult = 1,
652 	.div = 2,
653 	.hw.init = &(struct clk_init_data){
654 		.name = "cpu_in_div2",
655 		.ops = &clk_fixed_factor_ops,
656 		.parent_hws = (const struct clk_hw *[]) {
657 			&meson8b_cpu_in_sel.hw
658 		},
659 		.num_parents = 1,
660 		.flags = CLK_SET_RATE_PARENT,
661 	},
662 };
663 
664 static struct clk_fixed_factor meson8b_cpu_in_div3 = {
665 	.mult = 1,
666 	.div = 3,
667 	.hw.init = &(struct clk_init_data){
668 		.name = "cpu_in_div3",
669 		.ops = &clk_fixed_factor_ops,
670 		.parent_hws = (const struct clk_hw *[]) {
671 			&meson8b_cpu_in_sel.hw
672 		},
673 		.num_parents = 1,
674 		.flags = CLK_SET_RATE_PARENT,
675 	},
676 };
677 
678 static const struct clk_div_table cpu_scale_table[] = {
679 	{ .val = 1, .div = 4 },
680 	{ .val = 2, .div = 6 },
681 	{ .val = 3, .div = 8 },
682 	{ .val = 4, .div = 10 },
683 	{ .val = 5, .div = 12 },
684 	{ .val = 6, .div = 14 },
685 	{ .val = 7, .div = 16 },
686 	{ .val = 8, .div = 18 },
687 	{ /* sentinel */ },
688 };
689 
690 static struct clk_regmap meson8b_cpu_scale_div = {
691 	.data = &(struct clk_regmap_div_data){
692 		.offset =  HHI_SYS_CPU_CLK_CNTL1,
693 		.shift = 20,
694 		.width = 10,
695 		.table = cpu_scale_table,
696 		.flags = CLK_DIVIDER_ALLOW_ZERO,
697 	},
698 	.hw.init = &(struct clk_init_data){
699 		.name = "cpu_scale_div",
700 		.ops = &clk_regmap_divider_ops,
701 		.parent_hws = (const struct clk_hw *[]) {
702 			&meson8b_cpu_in_sel.hw
703 		},
704 		.num_parents = 1,
705 		.flags = CLK_SET_RATE_PARENT,
706 	},
707 };
708 
709 static u32 mux_table_cpu_scale_out_sel[] = { 0, 1, 3 };
710 static struct clk_regmap meson8b_cpu_scale_out_sel = {
711 	.data = &(struct clk_regmap_mux_data){
712 		.offset = HHI_SYS_CPU_CLK_CNTL0,
713 		.mask = 0x3,
714 		.shift = 2,
715 		.table = mux_table_cpu_scale_out_sel,
716 	},
717 	.hw.init = &(struct clk_init_data){
718 		.name = "cpu_scale_out_sel",
719 		.ops = &clk_regmap_mux_ops,
720 		/*
721 		 * NOTE: We are skipping the parent with value 0x2 (which is
722 		 * meson8b_cpu_in_div3) because it results in a duty cycle of
723 		 * 33% which makes the system unstable and can result in a
724 		 * lockup of the whole system.
725 		 */
726 		.parent_hws = (const struct clk_hw *[]) {
727 			&meson8b_cpu_in_sel.hw,
728 			&meson8b_cpu_in_div2.hw,
729 			&meson8b_cpu_scale_div.hw,
730 		},
731 		.num_parents = 3,
732 		.flags = CLK_SET_RATE_PARENT,
733 	},
734 };
735 
736 static struct clk_regmap meson8b_cpu_clk = {
737 	.data = &(struct clk_regmap_mux_data){
738 		.offset = HHI_SYS_CPU_CLK_CNTL0,
739 		.mask = 0x1,
740 		.shift = 7,
741 	},
742 	.hw.init = &(struct clk_init_data){
743 		.name = "cpu_clk",
744 		.ops = &clk_regmap_mux_ops,
745 		.parent_data = (const struct clk_parent_data[]) {
746 			{ .fw_name = "xtal", .name = "xtal", .index = -1, },
747 			{ .hw = &meson8b_cpu_scale_out_sel.hw, },
748 		},
749 		.num_parents = 2,
750 		.flags = (CLK_SET_RATE_PARENT |
751 			  CLK_SET_RATE_NO_REPARENT |
752 			  CLK_IS_CRITICAL),
753 	},
754 };
755 
756 static struct clk_regmap meson8b_nand_clk_sel = {
757 	.data = &(struct clk_regmap_mux_data){
758 		.offset = HHI_NAND_CLK_CNTL,
759 		.mask = 0x7,
760 		.shift = 9,
761 		.flags = CLK_MUX_ROUND_CLOSEST,
762 	},
763 	.hw.init = &(struct clk_init_data){
764 		.name = "nand_clk_sel",
765 		.ops = &clk_regmap_mux_ops,
766 		/* FIXME all other parents are unknown: */
767 		.parent_data = (const struct clk_parent_data[]) {
768 			{ .hw = &meson8b_fclk_div4.hw, },
769 			{ .hw = &meson8b_fclk_div3.hw, },
770 			{ .hw = &meson8b_fclk_div5.hw, },
771 			{ .hw = &meson8b_fclk_div7.hw, },
772 			{ .fw_name = "xtal", .name = "xtal", .index = -1, },
773 		},
774 		.num_parents = 5,
775 		.flags = CLK_SET_RATE_PARENT,
776 	},
777 };
778 
779 static struct clk_regmap meson8b_nand_clk_div = {
780 	.data = &(struct clk_regmap_div_data){
781 		.offset =  HHI_NAND_CLK_CNTL,
782 		.shift = 0,
783 		.width = 7,
784 		.flags = CLK_DIVIDER_ROUND_CLOSEST,
785 	},
786 	.hw.init = &(struct clk_init_data){
787 		.name = "nand_clk_div",
788 		.ops = &clk_regmap_divider_ops,
789 		.parent_hws = (const struct clk_hw *[]) {
790 			&meson8b_nand_clk_sel.hw
791 		},
792 		.num_parents = 1,
793 		.flags = CLK_SET_RATE_PARENT,
794 	},
795 };
796 
797 static struct clk_regmap meson8b_nand_clk_gate = {
798 	.data = &(struct clk_regmap_gate_data){
799 		.offset = HHI_NAND_CLK_CNTL,
800 		.bit_idx = 8,
801 	},
802 	.hw.init = &(struct clk_init_data){
803 		.name = "nand_clk_gate",
804 		.ops = &clk_regmap_gate_ops,
805 		.parent_hws = (const struct clk_hw *[]) {
806 			&meson8b_nand_clk_div.hw
807 		},
808 		.num_parents = 1,
809 		.flags = CLK_SET_RATE_PARENT,
810 	},
811 };
812 
813 static struct clk_fixed_factor meson8b_cpu_clk_div2 = {
814 	.mult = 1,
815 	.div = 2,
816 	.hw.init = &(struct clk_init_data){
817 		.name = "cpu_clk_div2",
818 		.ops = &clk_fixed_factor_ops,
819 		.parent_hws = (const struct clk_hw *[]) {
820 			&meson8b_cpu_clk.hw
821 		},
822 		.num_parents = 1,
823 	},
824 };
825 
826 static struct clk_fixed_factor meson8b_cpu_clk_div3 = {
827 	.mult = 1,
828 	.div = 3,
829 	.hw.init = &(struct clk_init_data){
830 		.name = "cpu_clk_div3",
831 		.ops = &clk_fixed_factor_ops,
832 		.parent_hws = (const struct clk_hw *[]) {
833 			&meson8b_cpu_clk.hw
834 		},
835 		.num_parents = 1,
836 	},
837 };
838 
839 static struct clk_fixed_factor meson8b_cpu_clk_div4 = {
840 	.mult = 1,
841 	.div = 4,
842 	.hw.init = &(struct clk_init_data){
843 		.name = "cpu_clk_div4",
844 		.ops = &clk_fixed_factor_ops,
845 		.parent_hws = (const struct clk_hw *[]) {
846 			&meson8b_cpu_clk.hw
847 		},
848 		.num_parents = 1,
849 	},
850 };
851 
852 static struct clk_fixed_factor meson8b_cpu_clk_div5 = {
853 	.mult = 1,
854 	.div = 5,
855 	.hw.init = &(struct clk_init_data){
856 		.name = "cpu_clk_div5",
857 		.ops = &clk_fixed_factor_ops,
858 		.parent_hws = (const struct clk_hw *[]) {
859 			&meson8b_cpu_clk.hw
860 		},
861 		.num_parents = 1,
862 	},
863 };
864 
865 static struct clk_fixed_factor meson8b_cpu_clk_div6 = {
866 	.mult = 1,
867 	.div = 6,
868 	.hw.init = &(struct clk_init_data){
869 		.name = "cpu_clk_div6",
870 		.ops = &clk_fixed_factor_ops,
871 		.parent_hws = (const struct clk_hw *[]) {
872 			&meson8b_cpu_clk.hw
873 		},
874 		.num_parents = 1,
875 	},
876 };
877 
878 static struct clk_fixed_factor meson8b_cpu_clk_div7 = {
879 	.mult = 1,
880 	.div = 7,
881 	.hw.init = &(struct clk_init_data){
882 		.name = "cpu_clk_div7",
883 		.ops = &clk_fixed_factor_ops,
884 		.parent_hws = (const struct clk_hw *[]) {
885 			&meson8b_cpu_clk.hw
886 		},
887 		.num_parents = 1,
888 	},
889 };
890 
891 static struct clk_fixed_factor meson8b_cpu_clk_div8 = {
892 	.mult = 1,
893 	.div = 8,
894 	.hw.init = &(struct clk_init_data){
895 		.name = "cpu_clk_div8",
896 		.ops = &clk_fixed_factor_ops,
897 		.parent_hws = (const struct clk_hw *[]) {
898 			&meson8b_cpu_clk.hw
899 		},
900 		.num_parents = 1,
901 	},
902 };
903 
904 static u32 mux_table_apb[] = { 1, 2, 3, 4, 5, 6, 7 };
905 static struct clk_regmap meson8b_apb_clk_sel = {
906 	.data = &(struct clk_regmap_mux_data){
907 		.offset = HHI_SYS_CPU_CLK_CNTL1,
908 		.mask = 0x7,
909 		.shift = 3,
910 		.table = mux_table_apb,
911 	},
912 	.hw.init = &(struct clk_init_data){
913 		.name = "apb_clk_sel",
914 		.ops = &clk_regmap_mux_ops,
915 		.parent_hws = (const struct clk_hw *[]) {
916 			&meson8b_cpu_clk_div2.hw,
917 			&meson8b_cpu_clk_div3.hw,
918 			&meson8b_cpu_clk_div4.hw,
919 			&meson8b_cpu_clk_div5.hw,
920 			&meson8b_cpu_clk_div6.hw,
921 			&meson8b_cpu_clk_div7.hw,
922 			&meson8b_cpu_clk_div8.hw,
923 		},
924 		.num_parents = 7,
925 	},
926 };
927 
928 static struct clk_regmap meson8b_apb_clk_gate = {
929 	.data = &(struct clk_regmap_gate_data){
930 		.offset = HHI_SYS_CPU_CLK_CNTL1,
931 		.bit_idx = 16,
932 		.flags = CLK_GATE_SET_TO_DISABLE,
933 	},
934 	.hw.init = &(struct clk_init_data){
935 		.name = "apb_clk_dis",
936 		.ops = &clk_regmap_gate_ro_ops,
937 		.parent_hws = (const struct clk_hw *[]) {
938 			&meson8b_apb_clk_sel.hw
939 		},
940 		.num_parents = 1,
941 		.flags = CLK_SET_RATE_PARENT,
942 	},
943 };
944 
945 static struct clk_regmap meson8b_periph_clk_sel = {
946 	.data = &(struct clk_regmap_mux_data){
947 		.offset = HHI_SYS_CPU_CLK_CNTL1,
948 		.mask = 0x7,
949 		.shift = 6,
950 	},
951 	.hw.init = &(struct clk_init_data){
952 		.name = "periph_clk_sel",
953 		.ops = &clk_regmap_mux_ops,
954 		.parent_hws = (const struct clk_hw *[]) {
955 			&meson8b_cpu_clk_div2.hw,
956 			&meson8b_cpu_clk_div3.hw,
957 			&meson8b_cpu_clk_div4.hw,
958 			&meson8b_cpu_clk_div5.hw,
959 			&meson8b_cpu_clk_div6.hw,
960 			&meson8b_cpu_clk_div7.hw,
961 			&meson8b_cpu_clk_div8.hw,
962 		},
963 		.num_parents = 7,
964 	},
965 };
966 
967 static struct clk_regmap meson8b_periph_clk_gate = {
968 	.data = &(struct clk_regmap_gate_data){
969 		.offset = HHI_SYS_CPU_CLK_CNTL1,
970 		.bit_idx = 17,
971 		.flags = CLK_GATE_SET_TO_DISABLE,
972 	},
973 	.hw.init = &(struct clk_init_data){
974 		.name = "periph_clk_dis",
975 		.ops = &clk_regmap_gate_ro_ops,
976 		.parent_hws = (const struct clk_hw *[]) {
977 			&meson8b_periph_clk_sel.hw
978 		},
979 		.num_parents = 1,
980 		.flags = CLK_SET_RATE_PARENT,
981 	},
982 };
983 
984 static u32 mux_table_axi[] = { 1, 2, 3, 4, 5, 6, 7 };
985 static struct clk_regmap meson8b_axi_clk_sel = {
986 	.data = &(struct clk_regmap_mux_data){
987 		.offset = HHI_SYS_CPU_CLK_CNTL1,
988 		.mask = 0x7,
989 		.shift = 9,
990 		.table = mux_table_axi,
991 	},
992 	.hw.init = &(struct clk_init_data){
993 		.name = "axi_clk_sel",
994 		.ops = &clk_regmap_mux_ops,
995 		.parent_hws = (const struct clk_hw *[]) {
996 			&meson8b_cpu_clk_div2.hw,
997 			&meson8b_cpu_clk_div3.hw,
998 			&meson8b_cpu_clk_div4.hw,
999 			&meson8b_cpu_clk_div5.hw,
1000 			&meson8b_cpu_clk_div6.hw,
1001 			&meson8b_cpu_clk_div7.hw,
1002 			&meson8b_cpu_clk_div8.hw,
1003 		},
1004 		.num_parents = 7,
1005 	},
1006 };
1007 
1008 static struct clk_regmap meson8b_axi_clk_gate = {
1009 	.data = &(struct clk_regmap_gate_data){
1010 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1011 		.bit_idx = 18,
1012 		.flags = CLK_GATE_SET_TO_DISABLE,
1013 	},
1014 	.hw.init = &(struct clk_init_data){
1015 		.name = "axi_clk_dis",
1016 		.ops = &clk_regmap_gate_ro_ops,
1017 		.parent_hws = (const struct clk_hw *[]) {
1018 			&meson8b_axi_clk_sel.hw
1019 		},
1020 		.num_parents = 1,
1021 		.flags = CLK_SET_RATE_PARENT,
1022 	},
1023 };
1024 
1025 static struct clk_regmap meson8b_l2_dram_clk_sel = {
1026 	.data = &(struct clk_regmap_mux_data){
1027 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1028 		.mask = 0x7,
1029 		.shift = 12,
1030 	},
1031 	.hw.init = &(struct clk_init_data){
1032 		.name = "l2_dram_clk_sel",
1033 		.ops = &clk_regmap_mux_ops,
1034 		.parent_hws = (const struct clk_hw *[]) {
1035 			&meson8b_cpu_clk_div2.hw,
1036 			&meson8b_cpu_clk_div3.hw,
1037 			&meson8b_cpu_clk_div4.hw,
1038 			&meson8b_cpu_clk_div5.hw,
1039 			&meson8b_cpu_clk_div6.hw,
1040 			&meson8b_cpu_clk_div7.hw,
1041 			&meson8b_cpu_clk_div8.hw,
1042 		},
1043 		.num_parents = 7,
1044 	},
1045 };
1046 
1047 static struct clk_regmap meson8b_l2_dram_clk_gate = {
1048 	.data = &(struct clk_regmap_gate_data){
1049 		.offset = HHI_SYS_CPU_CLK_CNTL1,
1050 		.bit_idx = 19,
1051 		.flags = CLK_GATE_SET_TO_DISABLE,
1052 	},
1053 	.hw.init = &(struct clk_init_data){
1054 		.name = "l2_dram_clk_dis",
1055 		.ops = &clk_regmap_gate_ro_ops,
1056 		.parent_hws = (const struct clk_hw *[]) {
1057 			&meson8b_l2_dram_clk_sel.hw
1058 		},
1059 		.num_parents = 1,
1060 		.flags = CLK_SET_RATE_PARENT,
1061 	},
1062 };
1063 
1064 static struct clk_regmap meson8b_vid_pll_in_sel = {
1065 	.data = &(struct clk_regmap_mux_data){
1066 		.offset = HHI_VID_DIVIDER_CNTL,
1067 		.mask = 0x1,
1068 		.shift = 15,
1069 	},
1070 	.hw.init = &(struct clk_init_data){
1071 		.name = "vid_pll_in_sel",
1072 		.ops = &clk_regmap_mux_ro_ops,
1073 		/*
1074 		 * TODO: depending on the SoC there is also a second parent:
1075 		 * Meson8: unknown
1076 		 * Meson8b: hdmi_pll_dco
1077 		 * Meson8m2: vid2_pll
1078 		 */
1079 		.parent_hws = (const struct clk_hw *[]) {
1080 			&meson8b_hdmi_pll_lvds_out.hw
1081 		},
1082 		.num_parents = 1,
1083 		.flags = CLK_SET_RATE_PARENT,
1084 	},
1085 };
1086 
1087 static struct clk_regmap meson8b_vid_pll_in_en = {
1088 	.data = &(struct clk_regmap_gate_data){
1089 		.offset = HHI_VID_DIVIDER_CNTL,
1090 		.bit_idx = 16,
1091 	},
1092 	.hw.init = &(struct clk_init_data){
1093 		.name = "vid_pll_in_en",
1094 		.ops = &clk_regmap_gate_ro_ops,
1095 		.parent_hws = (const struct clk_hw *[]) {
1096 			&meson8b_vid_pll_in_sel.hw
1097 		},
1098 		.num_parents = 1,
1099 		.flags = CLK_SET_RATE_PARENT,
1100 	},
1101 };
1102 
1103 static struct clk_regmap meson8b_vid_pll_pre_div = {
1104 	.data = &(struct clk_regmap_div_data){
1105 		.offset =  HHI_VID_DIVIDER_CNTL,
1106 		.shift = 4,
1107 		.width = 3,
1108 	},
1109 	.hw.init = &(struct clk_init_data){
1110 		.name = "vid_pll_pre_div",
1111 		.ops = &clk_regmap_divider_ro_ops,
1112 		.parent_hws = (const struct clk_hw *[]) {
1113 			&meson8b_vid_pll_in_en.hw
1114 		},
1115 		.num_parents = 1,
1116 		.flags = CLK_SET_RATE_PARENT,
1117 	},
1118 };
1119 
1120 static struct clk_regmap meson8b_vid_pll_post_div = {
1121 	.data = &(struct clk_regmap_div_data){
1122 		.offset =  HHI_VID_DIVIDER_CNTL,
1123 		.shift = 12,
1124 		.width = 3,
1125 	},
1126 	.hw.init = &(struct clk_init_data){
1127 		.name = "vid_pll_post_div",
1128 		.ops = &clk_regmap_divider_ro_ops,
1129 		.parent_hws = (const struct clk_hw *[]) {
1130 			&meson8b_vid_pll_pre_div.hw
1131 		},
1132 		.num_parents = 1,
1133 		.flags = CLK_SET_RATE_PARENT,
1134 	},
1135 };
1136 
1137 static struct clk_regmap meson8b_vid_pll = {
1138 	.data = &(struct clk_regmap_mux_data){
1139 		.offset = HHI_VID_DIVIDER_CNTL,
1140 		.mask = 0x3,
1141 		.shift = 8,
1142 	},
1143 	.hw.init = &(struct clk_init_data){
1144 		.name = "vid_pll",
1145 		.ops = &clk_regmap_mux_ro_ops,
1146 		/* TODO: parent 0x2 is vid_pll_pre_div_mult7_div2 */
1147 		.parent_hws = (const struct clk_hw *[]) {
1148 			&meson8b_vid_pll_pre_div.hw,
1149 			&meson8b_vid_pll_post_div.hw,
1150 		},
1151 		.num_parents = 2,
1152 		.flags = CLK_SET_RATE_PARENT,
1153 	},
1154 };
1155 
1156 static struct clk_regmap meson8b_vid_pll_final_div = {
1157 	.data = &(struct clk_regmap_div_data){
1158 		.offset =  HHI_VID_CLK_DIV,
1159 		.shift = 0,
1160 		.width = 8,
1161 	},
1162 	.hw.init = &(struct clk_init_data){
1163 		.name = "vid_pll_final_div",
1164 		.ops = &clk_regmap_divider_ro_ops,
1165 		.parent_hws = (const struct clk_hw *[]) {
1166 			&meson8b_vid_pll.hw
1167 		},
1168 		.num_parents = 1,
1169 		.flags = CLK_SET_RATE_PARENT,
1170 	},
1171 };
1172 
1173 static const struct clk_hw *meson8b_vclk_mux_parent_hws[] = {
1174 	&meson8b_vid_pll_final_div.hw,
1175 	&meson8b_fclk_div4.hw,
1176 	&meson8b_fclk_div3.hw,
1177 	&meson8b_fclk_div5.hw,
1178 	&meson8b_vid_pll_final_div.hw,
1179 	&meson8b_fclk_div7.hw,
1180 	&meson8b_mpll1.hw,
1181 };
1182 
1183 static struct clk_regmap meson8b_vclk_in_sel = {
1184 	.data = &(struct clk_regmap_mux_data){
1185 		.offset = HHI_VID_CLK_CNTL,
1186 		.mask = 0x7,
1187 		.shift = 16,
1188 	},
1189 	.hw.init = &(struct clk_init_data){
1190 		.name = "vclk_in_sel",
1191 		.ops = &clk_regmap_mux_ro_ops,
1192 		.parent_hws = meson8b_vclk_mux_parent_hws,
1193 		.num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws),
1194 		.flags = CLK_SET_RATE_PARENT,
1195 	},
1196 };
1197 
1198 static struct clk_regmap meson8b_vclk_in_en = {
1199 	.data = &(struct clk_regmap_gate_data){
1200 		.offset = HHI_VID_CLK_DIV,
1201 		.bit_idx = 16,
1202 	},
1203 	.hw.init = &(struct clk_init_data){
1204 		.name = "vclk_in_en",
1205 		.ops = &clk_regmap_gate_ro_ops,
1206 		.parent_hws = (const struct clk_hw *[]) {
1207 			&meson8b_vclk_in_sel.hw
1208 		},
1209 		.num_parents = 1,
1210 		.flags = CLK_SET_RATE_PARENT,
1211 	},
1212 };
1213 
1214 static struct clk_regmap meson8b_vclk_div1_gate = {
1215 	.data = &(struct clk_regmap_gate_data){
1216 		.offset = HHI_VID_CLK_CNTL,
1217 		.bit_idx = 0,
1218 	},
1219 	.hw.init = &(struct clk_init_data){
1220 		.name = "vclk_div1_en",
1221 		.ops = &clk_regmap_gate_ro_ops,
1222 		.parent_hws = (const struct clk_hw *[]) {
1223 			&meson8b_vclk_in_en.hw
1224 		},
1225 		.num_parents = 1,
1226 		.flags = CLK_SET_RATE_PARENT,
1227 	},
1228 };
1229 
1230 static struct clk_fixed_factor meson8b_vclk_div2_div = {
1231 	.mult = 1,
1232 	.div = 2,
1233 	.hw.init = &(struct clk_init_data){
1234 		.name = "vclk_div2",
1235 		.ops = &clk_fixed_factor_ops,
1236 		.parent_hws = (const struct clk_hw *[]) {
1237 			&meson8b_vclk_in_en.hw
1238 		},
1239 		.num_parents = 1,
1240 		.flags = CLK_SET_RATE_PARENT,
1241 	}
1242 };
1243 
1244 static struct clk_regmap meson8b_vclk_div2_div_gate = {
1245 	.data = &(struct clk_regmap_gate_data){
1246 		.offset = HHI_VID_CLK_CNTL,
1247 		.bit_idx = 1,
1248 	},
1249 	.hw.init = &(struct clk_init_data){
1250 		.name = "vclk_div2_en",
1251 		.ops = &clk_regmap_gate_ro_ops,
1252 		.parent_hws = (const struct clk_hw *[]) {
1253 			&meson8b_vclk_div2_div.hw
1254 		},
1255 		.num_parents = 1,
1256 		.flags = CLK_SET_RATE_PARENT,
1257 	},
1258 };
1259 
1260 static struct clk_fixed_factor meson8b_vclk_div4_div = {
1261 	.mult = 1,
1262 	.div = 4,
1263 	.hw.init = &(struct clk_init_data){
1264 		.name = "vclk_div4",
1265 		.ops = &clk_fixed_factor_ops,
1266 		.parent_hws = (const struct clk_hw *[]) {
1267 			&meson8b_vclk_in_en.hw
1268 		},
1269 		.num_parents = 1,
1270 		.flags = CLK_SET_RATE_PARENT,
1271 	}
1272 };
1273 
1274 static struct clk_regmap meson8b_vclk_div4_div_gate = {
1275 	.data = &(struct clk_regmap_gate_data){
1276 		.offset = HHI_VID_CLK_CNTL,
1277 		.bit_idx = 2,
1278 	},
1279 	.hw.init = &(struct clk_init_data){
1280 		.name = "vclk_div4_en",
1281 		.ops = &clk_regmap_gate_ro_ops,
1282 		.parent_hws = (const struct clk_hw *[]) {
1283 			&meson8b_vclk_div4_div.hw
1284 		},
1285 		.num_parents = 1,
1286 		.flags = CLK_SET_RATE_PARENT,
1287 	},
1288 };
1289 
1290 static struct clk_fixed_factor meson8b_vclk_div6_div = {
1291 	.mult = 1,
1292 	.div = 6,
1293 	.hw.init = &(struct clk_init_data){
1294 		.name = "vclk_div6",
1295 		.ops = &clk_fixed_factor_ops,
1296 		.parent_hws = (const struct clk_hw *[]) {
1297 			&meson8b_vclk_in_en.hw
1298 		},
1299 		.num_parents = 1,
1300 		.flags = CLK_SET_RATE_PARENT,
1301 	}
1302 };
1303 
1304 static struct clk_regmap meson8b_vclk_div6_div_gate = {
1305 	.data = &(struct clk_regmap_gate_data){
1306 		.offset = HHI_VID_CLK_CNTL,
1307 		.bit_idx = 3,
1308 	},
1309 	.hw.init = &(struct clk_init_data){
1310 		.name = "vclk_div6_en",
1311 		.ops = &clk_regmap_gate_ro_ops,
1312 		.parent_hws = (const struct clk_hw *[]) {
1313 			&meson8b_vclk_div6_div.hw
1314 		},
1315 		.num_parents = 1,
1316 		.flags = CLK_SET_RATE_PARENT,
1317 	},
1318 };
1319 
1320 static struct clk_fixed_factor meson8b_vclk_div12_div = {
1321 	.mult = 1,
1322 	.div = 12,
1323 	.hw.init = &(struct clk_init_data){
1324 		.name = "vclk_div12",
1325 		.ops = &clk_fixed_factor_ops,
1326 		.parent_hws = (const struct clk_hw *[]) {
1327 			&meson8b_vclk_in_en.hw
1328 		},
1329 		.num_parents = 1,
1330 		.flags = CLK_SET_RATE_PARENT,
1331 	}
1332 };
1333 
1334 static struct clk_regmap meson8b_vclk_div12_div_gate = {
1335 	.data = &(struct clk_regmap_gate_data){
1336 		.offset = HHI_VID_CLK_CNTL,
1337 		.bit_idx = 4,
1338 	},
1339 	.hw.init = &(struct clk_init_data){
1340 		.name = "vclk_div12_en",
1341 		.ops = &clk_regmap_gate_ro_ops,
1342 		.parent_hws = (const struct clk_hw *[]) {
1343 			&meson8b_vclk_div12_div.hw
1344 		},
1345 		.num_parents = 1,
1346 		.flags = CLK_SET_RATE_PARENT,
1347 	},
1348 };
1349 
1350 static struct clk_regmap meson8b_vclk2_in_sel = {
1351 	.data = &(struct clk_regmap_mux_data){
1352 		.offset = HHI_VIID_CLK_CNTL,
1353 		.mask = 0x7,
1354 		.shift = 16,
1355 	},
1356 	.hw.init = &(struct clk_init_data){
1357 		.name = "vclk2_in_sel",
1358 		.ops = &clk_regmap_mux_ro_ops,
1359 		.parent_hws = meson8b_vclk_mux_parent_hws,
1360 		.num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws),
1361 		.flags = CLK_SET_RATE_PARENT,
1362 	},
1363 };
1364 
1365 static struct clk_regmap meson8b_vclk2_clk_in_en = {
1366 	.data = &(struct clk_regmap_gate_data){
1367 		.offset = HHI_VIID_CLK_DIV,
1368 		.bit_idx = 16,
1369 	},
1370 	.hw.init = &(struct clk_init_data){
1371 		.name = "vclk2_in_en",
1372 		.ops = &clk_regmap_gate_ro_ops,
1373 		.parent_hws = (const struct clk_hw *[]) {
1374 			&meson8b_vclk2_in_sel.hw
1375 		},
1376 		.num_parents = 1,
1377 		.flags = CLK_SET_RATE_PARENT,
1378 	},
1379 };
1380 
1381 static struct clk_regmap meson8b_vclk2_div1_gate = {
1382 	.data = &(struct clk_regmap_gate_data){
1383 		.offset = HHI_VIID_CLK_DIV,
1384 		.bit_idx = 0,
1385 	},
1386 	.hw.init = &(struct clk_init_data){
1387 		.name = "vclk2_div1_en",
1388 		.ops = &clk_regmap_gate_ro_ops,
1389 		.parent_hws = (const struct clk_hw *[]) {
1390 			&meson8b_vclk2_clk_in_en.hw
1391 		},
1392 		.num_parents = 1,
1393 		.flags = CLK_SET_RATE_PARENT,
1394 	},
1395 };
1396 
1397 static struct clk_fixed_factor meson8b_vclk2_div2_div = {
1398 	.mult = 1,
1399 	.div = 2,
1400 	.hw.init = &(struct clk_init_data){
1401 		.name = "vclk2_div2",
1402 		.ops = &clk_fixed_factor_ops,
1403 		.parent_hws = (const struct clk_hw *[]) {
1404 			&meson8b_vclk2_clk_in_en.hw
1405 		},
1406 		.num_parents = 1,
1407 		.flags = CLK_SET_RATE_PARENT,
1408 	}
1409 };
1410 
1411 static struct clk_regmap meson8b_vclk2_div2_div_gate = {
1412 	.data = &(struct clk_regmap_gate_data){
1413 		.offset = HHI_VIID_CLK_DIV,
1414 		.bit_idx = 1,
1415 	},
1416 	.hw.init = &(struct clk_init_data){
1417 		.name = "vclk2_div2_en",
1418 		.ops = &clk_regmap_gate_ro_ops,
1419 		.parent_hws = (const struct clk_hw *[]) {
1420 			&meson8b_vclk2_div2_div.hw
1421 		},
1422 		.num_parents = 1,
1423 		.flags = CLK_SET_RATE_PARENT,
1424 	},
1425 };
1426 
1427 static struct clk_fixed_factor meson8b_vclk2_div4_div = {
1428 	.mult = 1,
1429 	.div = 4,
1430 	.hw.init = &(struct clk_init_data){
1431 		.name = "vclk2_div4",
1432 		.ops = &clk_fixed_factor_ops,
1433 		.parent_hws = (const struct clk_hw *[]) {
1434 			&meson8b_vclk2_clk_in_en.hw
1435 		},
1436 		.num_parents = 1,
1437 		.flags = CLK_SET_RATE_PARENT,
1438 	}
1439 };
1440 
1441 static struct clk_regmap meson8b_vclk2_div4_div_gate = {
1442 	.data = &(struct clk_regmap_gate_data){
1443 		.offset = HHI_VIID_CLK_DIV,
1444 		.bit_idx = 2,
1445 	},
1446 	.hw.init = &(struct clk_init_data){
1447 		.name = "vclk2_div4_en",
1448 		.ops = &clk_regmap_gate_ro_ops,
1449 		.parent_hws = (const struct clk_hw *[]) {
1450 			&meson8b_vclk2_div4_div.hw
1451 		},
1452 		.num_parents = 1,
1453 		.flags = CLK_SET_RATE_PARENT,
1454 	},
1455 };
1456 
1457 static struct clk_fixed_factor meson8b_vclk2_div6_div = {
1458 	.mult = 1,
1459 	.div = 6,
1460 	.hw.init = &(struct clk_init_data){
1461 		.name = "vclk2_div6",
1462 		.ops = &clk_fixed_factor_ops,
1463 		.parent_hws = (const struct clk_hw *[]) {
1464 			&meson8b_vclk2_clk_in_en.hw
1465 		},
1466 		.num_parents = 1,
1467 		.flags = CLK_SET_RATE_PARENT,
1468 	}
1469 };
1470 
1471 static struct clk_regmap meson8b_vclk2_div6_div_gate = {
1472 	.data = &(struct clk_regmap_gate_data){
1473 		.offset = HHI_VIID_CLK_DIV,
1474 		.bit_idx = 3,
1475 	},
1476 	.hw.init = &(struct clk_init_data){
1477 		.name = "vclk2_div6_en",
1478 		.ops = &clk_regmap_gate_ro_ops,
1479 		.parent_hws = (const struct clk_hw *[]) {
1480 			&meson8b_vclk2_div6_div.hw
1481 		},
1482 		.num_parents = 1,
1483 		.flags = CLK_SET_RATE_PARENT,
1484 	},
1485 };
1486 
1487 static struct clk_fixed_factor meson8b_vclk2_div12_div = {
1488 	.mult = 1,
1489 	.div = 12,
1490 	.hw.init = &(struct clk_init_data){
1491 		.name = "vclk2_div12",
1492 		.ops = &clk_fixed_factor_ops,
1493 		.parent_hws = (const struct clk_hw *[]) {
1494 			&meson8b_vclk2_clk_in_en.hw
1495 		},
1496 		.num_parents = 1,
1497 		.flags = CLK_SET_RATE_PARENT,
1498 	}
1499 };
1500 
1501 static struct clk_regmap meson8b_vclk2_div12_div_gate = {
1502 	.data = &(struct clk_regmap_gate_data){
1503 		.offset = HHI_VIID_CLK_DIV,
1504 		.bit_idx = 4,
1505 	},
1506 	.hw.init = &(struct clk_init_data){
1507 		.name = "vclk2_div12_en",
1508 		.ops = &clk_regmap_gate_ro_ops,
1509 		.parent_hws = (const struct clk_hw *[]) {
1510 			&meson8b_vclk2_div12_div.hw
1511 		},
1512 		.num_parents = 1,
1513 		.flags = CLK_SET_RATE_PARENT,
1514 	},
1515 };
1516 
1517 static const struct clk_hw *meson8b_vclk_enc_mux_parent_hws[] = {
1518 	&meson8b_vclk_div1_gate.hw,
1519 	&meson8b_vclk_div2_div_gate.hw,
1520 	&meson8b_vclk_div4_div_gate.hw,
1521 	&meson8b_vclk_div6_div_gate.hw,
1522 	&meson8b_vclk_div12_div_gate.hw,
1523 };
1524 
1525 static struct clk_regmap meson8b_cts_enct_sel = {
1526 	.data = &(struct clk_regmap_mux_data){
1527 		.offset = HHI_VID_CLK_DIV,
1528 		.mask = 0xf,
1529 		.shift = 20,
1530 	},
1531 	.hw.init = &(struct clk_init_data){
1532 		.name = "cts_enct_sel",
1533 		.ops = &clk_regmap_mux_ro_ops,
1534 		.parent_hws = meson8b_vclk_enc_mux_parent_hws,
1535 		.num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1536 		.flags = CLK_SET_RATE_PARENT,
1537 	},
1538 };
1539 
1540 static struct clk_regmap meson8b_cts_enct = {
1541 	.data = &(struct clk_regmap_gate_data){
1542 		.offset = HHI_VID_CLK_CNTL2,
1543 		.bit_idx = 1,
1544 	},
1545 	.hw.init = &(struct clk_init_data){
1546 		.name = "cts_enct",
1547 		.ops = &clk_regmap_gate_ro_ops,
1548 		.parent_hws = (const struct clk_hw *[]) {
1549 			&meson8b_cts_enct_sel.hw
1550 		},
1551 		.num_parents = 1,
1552 		.flags = CLK_SET_RATE_PARENT,
1553 	},
1554 };
1555 
1556 static struct clk_regmap meson8b_cts_encp_sel = {
1557 	.data = &(struct clk_regmap_mux_data){
1558 		.offset = HHI_VID_CLK_DIV,
1559 		.mask = 0xf,
1560 		.shift = 24,
1561 	},
1562 	.hw.init = &(struct clk_init_data){
1563 		.name = "cts_encp_sel",
1564 		.ops = &clk_regmap_mux_ro_ops,
1565 		.parent_hws = meson8b_vclk_enc_mux_parent_hws,
1566 		.num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1567 		.flags = CLK_SET_RATE_PARENT,
1568 	},
1569 };
1570 
1571 static struct clk_regmap meson8b_cts_encp = {
1572 	.data = &(struct clk_regmap_gate_data){
1573 		.offset = HHI_VID_CLK_CNTL2,
1574 		.bit_idx = 2,
1575 	},
1576 	.hw.init = &(struct clk_init_data){
1577 		.name = "cts_encp",
1578 		.ops = &clk_regmap_gate_ro_ops,
1579 		.parent_hws = (const struct clk_hw *[]) {
1580 			&meson8b_cts_encp_sel.hw
1581 		},
1582 		.num_parents = 1,
1583 		.flags = CLK_SET_RATE_PARENT,
1584 	},
1585 };
1586 
1587 static struct clk_regmap meson8b_cts_enci_sel = {
1588 	.data = &(struct clk_regmap_mux_data){
1589 		.offset = HHI_VID_CLK_DIV,
1590 		.mask = 0xf,
1591 		.shift = 28,
1592 	},
1593 	.hw.init = &(struct clk_init_data){
1594 		.name = "cts_enci_sel",
1595 		.ops = &clk_regmap_mux_ro_ops,
1596 		.parent_hws = meson8b_vclk_enc_mux_parent_hws,
1597 		.num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1598 		.flags = CLK_SET_RATE_PARENT,
1599 	},
1600 };
1601 
1602 static struct clk_regmap meson8b_cts_enci = {
1603 	.data = &(struct clk_regmap_gate_data){
1604 		.offset = HHI_VID_CLK_CNTL2,
1605 		.bit_idx = 0,
1606 	},
1607 	.hw.init = &(struct clk_init_data){
1608 		.name = "cts_enci",
1609 		.ops = &clk_regmap_gate_ro_ops,
1610 		.parent_hws = (const struct clk_hw *[]) {
1611 			&meson8b_cts_enci_sel.hw
1612 		},
1613 		.num_parents = 1,
1614 		.flags = CLK_SET_RATE_PARENT,
1615 	},
1616 };
1617 
1618 static struct clk_regmap meson8b_hdmi_tx_pixel_sel = {
1619 	.data = &(struct clk_regmap_mux_data){
1620 		.offset = HHI_HDMI_CLK_CNTL,
1621 		.mask = 0xf,
1622 		.shift = 16,
1623 	},
1624 	.hw.init = &(struct clk_init_data){
1625 		.name = "hdmi_tx_pixel_sel",
1626 		.ops = &clk_regmap_mux_ro_ops,
1627 		.parent_hws = meson8b_vclk_enc_mux_parent_hws,
1628 		.num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1629 		.flags = CLK_SET_RATE_PARENT,
1630 	},
1631 };
1632 
1633 static struct clk_regmap meson8b_hdmi_tx_pixel = {
1634 	.data = &(struct clk_regmap_gate_data){
1635 		.offset = HHI_VID_CLK_CNTL2,
1636 		.bit_idx = 5,
1637 	},
1638 	.hw.init = &(struct clk_init_data){
1639 		.name = "hdmi_tx_pixel",
1640 		.ops = &clk_regmap_gate_ro_ops,
1641 		.parent_hws = (const struct clk_hw *[]) {
1642 			&meson8b_hdmi_tx_pixel_sel.hw
1643 		},
1644 		.num_parents = 1,
1645 		.flags = CLK_SET_RATE_PARENT,
1646 	},
1647 };
1648 
1649 static const struct clk_hw *meson8b_vclk2_enc_mux_parent_hws[] = {
1650 	&meson8b_vclk2_div1_gate.hw,
1651 	&meson8b_vclk2_div2_div_gate.hw,
1652 	&meson8b_vclk2_div4_div_gate.hw,
1653 	&meson8b_vclk2_div6_div_gate.hw,
1654 	&meson8b_vclk2_div12_div_gate.hw,
1655 };
1656 
1657 static struct clk_regmap meson8b_cts_encl_sel = {
1658 	.data = &(struct clk_regmap_mux_data){
1659 		.offset = HHI_VIID_CLK_DIV,
1660 		.mask = 0xf,
1661 		.shift = 12,
1662 	},
1663 	.hw.init = &(struct clk_init_data){
1664 		.name = "cts_encl_sel",
1665 		.ops = &clk_regmap_mux_ro_ops,
1666 		.parent_hws = meson8b_vclk2_enc_mux_parent_hws,
1667 		.num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws),
1668 		.flags = CLK_SET_RATE_PARENT,
1669 	},
1670 };
1671 
1672 static struct clk_regmap meson8b_cts_encl = {
1673 	.data = &(struct clk_regmap_gate_data){
1674 		.offset = HHI_VID_CLK_CNTL2,
1675 		.bit_idx = 3,
1676 	},
1677 	.hw.init = &(struct clk_init_data){
1678 		.name = "cts_encl",
1679 		.ops = &clk_regmap_gate_ro_ops,
1680 		.parent_hws = (const struct clk_hw *[]) {
1681 			&meson8b_cts_encl_sel.hw
1682 		},
1683 		.num_parents = 1,
1684 		.flags = CLK_SET_RATE_PARENT,
1685 	},
1686 };
1687 
1688 static struct clk_regmap meson8b_cts_vdac0_sel = {
1689 	.data = &(struct clk_regmap_mux_data){
1690 		.offset = HHI_VIID_CLK_DIV,
1691 		.mask = 0xf,
1692 		.shift = 28,
1693 	},
1694 	.hw.init = &(struct clk_init_data){
1695 		.name = "cts_vdac0_sel",
1696 		.ops = &clk_regmap_mux_ro_ops,
1697 		.parent_hws = meson8b_vclk2_enc_mux_parent_hws,
1698 		.num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws),
1699 		.flags = CLK_SET_RATE_PARENT,
1700 	},
1701 };
1702 
1703 static struct clk_regmap meson8b_cts_vdac0 = {
1704 	.data = &(struct clk_regmap_gate_data){
1705 		.offset = HHI_VID_CLK_CNTL2,
1706 		.bit_idx = 4,
1707 	},
1708 	.hw.init = &(struct clk_init_data){
1709 		.name = "cts_vdac0",
1710 		.ops = &clk_regmap_gate_ro_ops,
1711 		.parent_hws = (const struct clk_hw *[]) {
1712 			&meson8b_cts_vdac0_sel.hw
1713 		},
1714 		.num_parents = 1,
1715 		.flags = CLK_SET_RATE_PARENT,
1716 	},
1717 };
1718 
1719 static struct clk_regmap meson8b_hdmi_sys_sel = {
1720 	.data = &(struct clk_regmap_mux_data){
1721 		.offset = HHI_HDMI_CLK_CNTL,
1722 		.mask = 0x3,
1723 		.shift = 9,
1724 		.flags = CLK_MUX_ROUND_CLOSEST,
1725 	},
1726 	.hw.init = &(struct clk_init_data){
1727 		.name = "hdmi_sys_sel",
1728 		.ops = &clk_regmap_mux_ops,
1729 		/* FIXME: all other parents are unknown */
1730 		.parent_data = &(const struct clk_parent_data) {
1731 			.fw_name = "xtal",
1732 			.name = "xtal",
1733 			.index = -1,
1734 		},
1735 		.num_parents = 1,
1736 		.flags = CLK_SET_RATE_NO_REPARENT,
1737 	},
1738 };
1739 
1740 static struct clk_regmap meson8b_hdmi_sys_div = {
1741 	.data = &(struct clk_regmap_div_data){
1742 		.offset = HHI_HDMI_CLK_CNTL,
1743 		.shift = 0,
1744 		.width = 7,
1745 	},
1746 	.hw.init = &(struct clk_init_data){
1747 		.name = "hdmi_sys_div",
1748 		.ops = &clk_regmap_divider_ops,
1749 		.parent_hws = (const struct clk_hw *[]) {
1750 			&meson8b_hdmi_sys_sel.hw
1751 		},
1752 		.num_parents = 1,
1753 		.flags = CLK_SET_RATE_PARENT,
1754 	},
1755 };
1756 
1757 static struct clk_regmap meson8b_hdmi_sys = {
1758 	.data = &(struct clk_regmap_gate_data){
1759 		.offset = HHI_HDMI_CLK_CNTL,
1760 		.bit_idx = 8,
1761 	},
1762 	.hw.init = &(struct clk_init_data) {
1763 		.name = "hdmi_sys",
1764 		.ops = &clk_regmap_gate_ops,
1765 		.parent_hws = (const struct clk_hw *[]) {
1766 			&meson8b_hdmi_sys_div.hw
1767 		},
1768 		.num_parents = 1,
1769 		.flags = CLK_SET_RATE_PARENT,
1770 	},
1771 };
1772 
1773 /*
1774  * The MALI IP is clocked by two identical clocks (mali_0 and mali_1)
1775  * muxed by a glitch-free switch on Meson8b and Meson8m2. The CCF can
1776  * actually manage this glitch-free mux because it does top-to-bottom
1777  * updates the each clock tree and switches to the "inactive" one when
1778  * CLK_SET_RATE_GATE is set.
1779  * Meson8 only has mali_0 and no glitch-free mux.
1780  */
1781 static const struct clk_parent_data meson8b_mali_0_1_parent_data[] = {
1782 	{ .fw_name = "xtal", .name = "xtal", .index = -1, },
1783 	{ .hw = &meson8b_mpll2.hw, },
1784 	{ .hw = &meson8b_mpll1.hw, },
1785 	{ .hw = &meson8b_fclk_div7.hw, },
1786 	{ .hw = &meson8b_fclk_div4.hw, },
1787 	{ .hw = &meson8b_fclk_div3.hw, },
1788 	{ .hw = &meson8b_fclk_div5.hw, },
1789 };
1790 
1791 static u32 meson8b_mali_0_1_mux_table[] = { 0, 2, 3, 4, 5, 6, 7 };
1792 
1793 static struct clk_regmap meson8b_mali_0_sel = {
1794 	.data = &(struct clk_regmap_mux_data){
1795 		.offset = HHI_MALI_CLK_CNTL,
1796 		.mask = 0x7,
1797 		.shift = 9,
1798 		.table = meson8b_mali_0_1_mux_table,
1799 	},
1800 	.hw.init = &(struct clk_init_data){
1801 		.name = "mali_0_sel",
1802 		.ops = &clk_regmap_mux_ops,
1803 		.parent_data = meson8b_mali_0_1_parent_data,
1804 		.num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_data),
1805 		/*
1806 		 * Don't propagate rate changes up because the only changeable
1807 		 * parents are mpll1 and mpll2 but we need those for audio and
1808 		 * RGMII (Ethernet). We don't want to change the audio or
1809 		 * Ethernet clocks when setting the GPU frequency.
1810 		 */
1811 		.flags = 0,
1812 	},
1813 };
1814 
1815 static struct clk_regmap meson8b_mali_0_div = {
1816 	.data = &(struct clk_regmap_div_data){
1817 		.offset = HHI_MALI_CLK_CNTL,
1818 		.shift = 0,
1819 		.width = 7,
1820 	},
1821 	.hw.init = &(struct clk_init_data){
1822 		.name = "mali_0_div",
1823 		.ops = &clk_regmap_divider_ops,
1824 		.parent_hws = (const struct clk_hw *[]) {
1825 			&meson8b_mali_0_sel.hw
1826 		},
1827 		.num_parents = 1,
1828 		.flags = CLK_SET_RATE_PARENT,
1829 	},
1830 };
1831 
1832 static struct clk_regmap meson8b_mali_0 = {
1833 	.data = &(struct clk_regmap_gate_data){
1834 		.offset = HHI_MALI_CLK_CNTL,
1835 		.bit_idx = 8,
1836 	},
1837 	.hw.init = &(struct clk_init_data){
1838 		.name = "mali_0",
1839 		.ops = &clk_regmap_gate_ops,
1840 		.parent_hws = (const struct clk_hw *[]) {
1841 			&meson8b_mali_0_div.hw
1842 		},
1843 		.num_parents = 1,
1844 		.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
1845 	},
1846 };
1847 
1848 static struct clk_regmap meson8b_mali_1_sel = {
1849 	.data = &(struct clk_regmap_mux_data){
1850 		.offset = HHI_MALI_CLK_CNTL,
1851 		.mask = 0x7,
1852 		.shift = 25,
1853 		.table = meson8b_mali_0_1_mux_table,
1854 	},
1855 	.hw.init = &(struct clk_init_data){
1856 		.name = "mali_1_sel",
1857 		.ops = &clk_regmap_mux_ops,
1858 		.parent_data = meson8b_mali_0_1_parent_data,
1859 		.num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_data),
1860 		/*
1861 		 * Don't propagate rate changes up because the only changeable
1862 		 * parents are mpll1 and mpll2 but we need those for audio and
1863 		 * RGMII (Ethernet). We don't want to change the audio or
1864 		 * Ethernet clocks when setting the GPU frequency.
1865 		 */
1866 		.flags = 0,
1867 	},
1868 };
1869 
1870 static struct clk_regmap meson8b_mali_1_div = {
1871 	.data = &(struct clk_regmap_div_data){
1872 		.offset = HHI_MALI_CLK_CNTL,
1873 		.shift = 16,
1874 		.width = 7,
1875 	},
1876 	.hw.init = &(struct clk_init_data){
1877 		.name = "mali_1_div",
1878 		.ops = &clk_regmap_divider_ops,
1879 		.parent_hws = (const struct clk_hw *[]) {
1880 			&meson8b_mali_1_sel.hw
1881 		},
1882 		.num_parents = 1,
1883 		.flags = CLK_SET_RATE_PARENT,
1884 	},
1885 };
1886 
1887 static struct clk_regmap meson8b_mali_1 = {
1888 	.data = &(struct clk_regmap_gate_data){
1889 		.offset = HHI_MALI_CLK_CNTL,
1890 		.bit_idx = 24,
1891 	},
1892 	.hw.init = &(struct clk_init_data){
1893 		.name = "mali_1",
1894 		.ops = &clk_regmap_gate_ops,
1895 		.parent_hws = (const struct clk_hw *[]) {
1896 			&meson8b_mali_1_div.hw
1897 		},
1898 		.num_parents = 1,
1899 		.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
1900 	},
1901 };
1902 
1903 static struct clk_regmap meson8b_mali = {
1904 	.data = &(struct clk_regmap_mux_data){
1905 		.offset = HHI_MALI_CLK_CNTL,
1906 		.mask = 1,
1907 		.shift = 31,
1908 	},
1909 	.hw.init = &(struct clk_init_data){
1910 		.name = "mali",
1911 		.ops = &clk_regmap_mux_ops,
1912 		.parent_hws = (const struct clk_hw *[]) {
1913 			&meson8b_mali_0.hw,
1914 			&meson8b_mali_1.hw,
1915 		},
1916 		.num_parents = 2,
1917 		.flags = CLK_SET_RATE_PARENT,
1918 	},
1919 };
1920 
1921 static const struct reg_sequence meson8m2_gp_pll_init_regs[] = {
1922 	{ .reg = HHI_GP_PLL_CNTL2,	.def = 0x59c88000 },
1923 	{ .reg = HHI_GP_PLL_CNTL3,	.def = 0xca463823 },
1924 	{ .reg = HHI_GP_PLL_CNTL4,	.def = 0x0286a027 },
1925 	{ .reg = HHI_GP_PLL_CNTL5,	.def = 0x00003000 },
1926 };
1927 
1928 static const struct pll_params_table meson8m2_gp_pll_params_table[] = {
1929 	PLL_PARAMS(182, 3),
1930 	{ /* sentinel */ },
1931 };
1932 
1933 static struct clk_regmap meson8m2_gp_pll_dco = {
1934 	.data = &(struct meson_clk_pll_data){
1935 		.en = {
1936 			.reg_off = HHI_GP_PLL_CNTL,
1937 			.shift   = 30,
1938 			.width   = 1,
1939 		},
1940 		.m = {
1941 			.reg_off = HHI_GP_PLL_CNTL,
1942 			.shift   = 0,
1943 			.width   = 9,
1944 		},
1945 		.n = {
1946 			.reg_off = HHI_GP_PLL_CNTL,
1947 			.shift   = 9,
1948 			.width   = 5,
1949 		},
1950 		.l = {
1951 			.reg_off = HHI_GP_PLL_CNTL,
1952 			.shift   = 31,
1953 			.width   = 1,
1954 		},
1955 		.rst = {
1956 			.reg_off = HHI_GP_PLL_CNTL,
1957 			.shift   = 29,
1958 			.width   = 1,
1959 		},
1960 		.table = meson8m2_gp_pll_params_table,
1961 		.init_regs = meson8m2_gp_pll_init_regs,
1962 		.init_count = ARRAY_SIZE(meson8m2_gp_pll_init_regs),
1963 	},
1964 	.hw.init = &(struct clk_init_data){
1965 		.name = "gp_pll_dco",
1966 		.ops = &meson_clk_pll_ops,
1967 		.parent_data = &(const struct clk_parent_data) {
1968 			.fw_name = "xtal",
1969 			.name = "xtal",
1970 			.index = -1,
1971 		},
1972 		.num_parents = 1,
1973 	},
1974 };
1975 
1976 static struct clk_regmap meson8m2_gp_pll = {
1977 	.data = &(struct clk_regmap_div_data){
1978 		.offset = HHI_GP_PLL_CNTL,
1979 		.shift = 16,
1980 		.width = 2,
1981 		.flags = CLK_DIVIDER_POWER_OF_TWO,
1982 	},
1983 	.hw.init = &(struct clk_init_data){
1984 		.name = "gp_pll",
1985 		.ops = &clk_regmap_divider_ops,
1986 		.parent_hws = (const struct clk_hw *[]) {
1987 			&meson8m2_gp_pll_dco.hw
1988 		},
1989 		.num_parents = 1,
1990 		.flags = CLK_SET_RATE_PARENT,
1991 	},
1992 };
1993 
1994 static const struct clk_hw *meson8b_vpu_0_1_parent_hws[] = {
1995 	&meson8b_fclk_div4.hw,
1996 	&meson8b_fclk_div3.hw,
1997 	&meson8b_fclk_div5.hw,
1998 	&meson8b_fclk_div7.hw,
1999 };
2000 
2001 static const struct clk_hw *mmeson8m2_vpu_0_1_parent_hws[] = {
2002 	&meson8b_fclk_div4.hw,
2003 	&meson8b_fclk_div3.hw,
2004 	&meson8b_fclk_div5.hw,
2005 	&meson8m2_gp_pll.hw,
2006 };
2007 
2008 static struct clk_regmap meson8b_vpu_0_sel = {
2009 	.data = &(struct clk_regmap_mux_data){
2010 		.offset = HHI_VPU_CLK_CNTL,
2011 		.mask = 0x3,
2012 		.shift = 9,
2013 	},
2014 	.hw.init = &(struct clk_init_data){
2015 		.name = "vpu_0_sel",
2016 		.ops = &clk_regmap_mux_ops,
2017 		.parent_hws = meson8b_vpu_0_1_parent_hws,
2018 		.num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws),
2019 		.flags = CLK_SET_RATE_PARENT,
2020 	},
2021 };
2022 
2023 static struct clk_regmap meson8m2_vpu_0_sel = {
2024 	.data = &(struct clk_regmap_mux_data){
2025 		.offset = HHI_VPU_CLK_CNTL,
2026 		.mask = 0x3,
2027 		.shift = 9,
2028 	},
2029 	.hw.init = &(struct clk_init_data){
2030 		.name = "vpu_0_sel",
2031 		.ops = &clk_regmap_mux_ops,
2032 		.parent_hws = mmeson8m2_vpu_0_1_parent_hws,
2033 		.num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws),
2034 		.flags = CLK_SET_RATE_PARENT,
2035 	},
2036 };
2037 
2038 static struct clk_regmap meson8b_vpu_0_div = {
2039 	.data = &(struct clk_regmap_div_data){
2040 		.offset = HHI_VPU_CLK_CNTL,
2041 		.shift = 0,
2042 		.width = 7,
2043 	},
2044 	.hw.init = &(struct clk_init_data){
2045 		.name = "vpu_0_div",
2046 		.ops = &clk_regmap_divider_ops,
2047 		.parent_data = &(const struct clk_parent_data) {
2048 			/*
2049 			 * Note:
2050 			 * meson8b and meson8m2 have different vpu_0_sels (with
2051 			 * different struct clk_hw). We fallback to the global
2052 			 * naming string mechanism so vpu_0_div picks up the
2053 			 * appropriate one.
2054 			 */
2055 			.name = "vpu_0_sel",
2056 			.index = -1,
2057 		},
2058 		.num_parents = 1,
2059 		.flags = CLK_SET_RATE_PARENT,
2060 	},
2061 };
2062 
2063 static struct clk_regmap meson8b_vpu_0 = {
2064 	.data = &(struct clk_regmap_gate_data){
2065 		.offset = HHI_VPU_CLK_CNTL,
2066 		.bit_idx = 8,
2067 	},
2068 	.hw.init = &(struct clk_init_data) {
2069 		.name = "vpu_0",
2070 		.ops = &clk_regmap_gate_ops,
2071 		.parent_hws = (const struct clk_hw *[]) {
2072 			&meson8b_vpu_0_div.hw
2073 		},
2074 		.num_parents = 1,
2075 		.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
2076 	},
2077 };
2078 
2079 static struct clk_regmap meson8b_vpu_1_sel = {
2080 	.data = &(struct clk_regmap_mux_data){
2081 		.offset = HHI_VPU_CLK_CNTL,
2082 		.mask = 0x3,
2083 		.shift = 25,
2084 	},
2085 	.hw.init = &(struct clk_init_data){
2086 		.name = "vpu_1_sel",
2087 		.ops = &clk_regmap_mux_ops,
2088 		.parent_hws = meson8b_vpu_0_1_parent_hws,
2089 		.num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws),
2090 		.flags = CLK_SET_RATE_PARENT,
2091 	},
2092 };
2093 
2094 static struct clk_regmap meson8m2_vpu_1_sel = {
2095 	.data = &(struct clk_regmap_mux_data){
2096 		.offset = HHI_VPU_CLK_CNTL,
2097 		.mask = 0x3,
2098 		.shift = 25,
2099 	},
2100 	.hw.init = &(struct clk_init_data){
2101 		.name = "vpu_1_sel",
2102 		.ops = &clk_regmap_mux_ops,
2103 		.parent_hws = mmeson8m2_vpu_0_1_parent_hws,
2104 		.num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws),
2105 		.flags = CLK_SET_RATE_PARENT,
2106 	},
2107 };
2108 
2109 static struct clk_regmap meson8b_vpu_1_div = {
2110 	.data = &(struct clk_regmap_div_data){
2111 		.offset = HHI_VPU_CLK_CNTL,
2112 		.shift = 16,
2113 		.width = 7,
2114 	},
2115 	.hw.init = &(struct clk_init_data){
2116 		.name = "vpu_1_div",
2117 		.ops = &clk_regmap_divider_ops,
2118 		.parent_data = &(const struct clk_parent_data) {
2119 			/*
2120 			 * Note:
2121 			 * meson8b and meson8m2 have different vpu_1_sels (with
2122 			 * different struct clk_hw). We fallback to the global
2123 			 * naming string mechanism so vpu_1_div picks up the
2124 			 * appropriate one.
2125 			 */
2126 			.name = "vpu_1_sel",
2127 			.index = -1,
2128 		},
2129 		.num_parents = 1,
2130 		.flags = CLK_SET_RATE_PARENT,
2131 	},
2132 };
2133 
2134 static struct clk_regmap meson8b_vpu_1 = {
2135 	.data = &(struct clk_regmap_gate_data){
2136 		.offset = HHI_VPU_CLK_CNTL,
2137 		.bit_idx = 24,
2138 	},
2139 	.hw.init = &(struct clk_init_data) {
2140 		.name = "vpu_1",
2141 		.ops = &clk_regmap_gate_ops,
2142 		.parent_hws = (const struct clk_hw *[]) {
2143 			&meson8b_vpu_1_div.hw
2144 		},
2145 		.num_parents = 1,
2146 		.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
2147 	},
2148 };
2149 
2150 /*
2151  * The VPU clock has two two identical clock trees (vpu_0 and vpu_1)
2152  * muxed by a glitch-free switch on Meson8b and Meson8m2. The CCF can
2153  * actually manage this glitch-free mux because it does top-to-bottom
2154  * updates the each clock tree and switches to the "inactive" one when
2155  * CLK_SET_RATE_GATE is set.
2156  * Meson8 only has vpu_0 and no glitch-free mux.
2157  */
2158 static struct clk_regmap meson8b_vpu = {
2159 	.data = &(struct clk_regmap_mux_data){
2160 		.offset = HHI_VPU_CLK_CNTL,
2161 		.mask = 1,
2162 		.shift = 31,
2163 	},
2164 	.hw.init = &(struct clk_init_data){
2165 		.name = "vpu",
2166 		.ops = &clk_regmap_mux_ops,
2167 		.parent_hws = (const struct clk_hw *[]) {
2168 			&meson8b_vpu_0.hw,
2169 			&meson8b_vpu_1.hw,
2170 		},
2171 		.num_parents = 2,
2172 		.flags = CLK_SET_RATE_PARENT,
2173 	},
2174 };
2175 
2176 static const struct clk_hw *meson8b_vdec_parent_hws[] = {
2177 	&meson8b_fclk_div4.hw,
2178 	&meson8b_fclk_div3.hw,
2179 	&meson8b_fclk_div5.hw,
2180 	&meson8b_fclk_div7.hw,
2181 	&meson8b_mpll2.hw,
2182 	&meson8b_mpll1.hw,
2183 };
2184 
2185 static struct clk_regmap meson8b_vdec_1_sel = {
2186 	.data = &(struct clk_regmap_mux_data){
2187 		.offset = HHI_VDEC_CLK_CNTL,
2188 		.mask = 0x3,
2189 		.shift = 9,
2190 		.flags = CLK_MUX_ROUND_CLOSEST,
2191 	},
2192 	.hw.init = &(struct clk_init_data){
2193 		.name = "vdec_1_sel",
2194 		.ops = &clk_regmap_mux_ops,
2195 		.parent_hws = meson8b_vdec_parent_hws,
2196 		.num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2197 		.flags = CLK_SET_RATE_PARENT,
2198 	},
2199 };
2200 
2201 static struct clk_regmap meson8b_vdec_1_1_div = {
2202 	.data = &(struct clk_regmap_div_data){
2203 		.offset = HHI_VDEC_CLK_CNTL,
2204 		.shift = 0,
2205 		.width = 7,
2206 		.flags = CLK_DIVIDER_ROUND_CLOSEST,
2207 	},
2208 	.hw.init = &(struct clk_init_data){
2209 		.name = "vdec_1_1_div",
2210 		.ops = &clk_regmap_divider_ops,
2211 		.parent_hws = (const struct clk_hw *[]) {
2212 			&meson8b_vdec_1_sel.hw
2213 		},
2214 		.num_parents = 1,
2215 		.flags = CLK_SET_RATE_PARENT,
2216 	},
2217 };
2218 
2219 static struct clk_regmap meson8b_vdec_1_1 = {
2220 	.data = &(struct clk_regmap_gate_data){
2221 		.offset = HHI_VDEC_CLK_CNTL,
2222 		.bit_idx = 8,
2223 	},
2224 	.hw.init = &(struct clk_init_data) {
2225 		.name = "vdec_1_1",
2226 		.ops = &clk_regmap_gate_ops,
2227 		.parent_hws = (const struct clk_hw *[]) {
2228 			&meson8b_vdec_1_1_div.hw
2229 		},
2230 		.num_parents = 1,
2231 		.flags = CLK_SET_RATE_PARENT,
2232 	},
2233 };
2234 
2235 static struct clk_regmap meson8b_vdec_1_2_div = {
2236 	.data = &(struct clk_regmap_div_data){
2237 		.offset = HHI_VDEC3_CLK_CNTL,
2238 		.shift = 0,
2239 		.width = 7,
2240 		.flags = CLK_DIVIDER_ROUND_CLOSEST,
2241 	},
2242 	.hw.init = &(struct clk_init_data){
2243 		.name = "vdec_1_2_div",
2244 		.ops = &clk_regmap_divider_ops,
2245 		.parent_hws = (const struct clk_hw *[]) {
2246 			&meson8b_vdec_1_sel.hw
2247 		},
2248 		.num_parents = 1,
2249 		.flags = CLK_SET_RATE_PARENT,
2250 	},
2251 };
2252 
2253 static struct clk_regmap meson8b_vdec_1_2 = {
2254 	.data = &(struct clk_regmap_gate_data){
2255 		.offset = HHI_VDEC3_CLK_CNTL,
2256 		.bit_idx = 8,
2257 	},
2258 	.hw.init = &(struct clk_init_data) {
2259 		.name = "vdec_1_2",
2260 		.ops = &clk_regmap_gate_ops,
2261 		.parent_hws = (const struct clk_hw *[]) {
2262 			&meson8b_vdec_1_2_div.hw
2263 		},
2264 		.num_parents = 1,
2265 		.flags = CLK_SET_RATE_PARENT,
2266 	},
2267 };
2268 
2269 static struct clk_regmap meson8b_vdec_1 = {
2270 	.data = &(struct clk_regmap_mux_data){
2271 		.offset = HHI_VDEC3_CLK_CNTL,
2272 		.mask = 0x1,
2273 		.shift = 15,
2274 		.flags = CLK_MUX_ROUND_CLOSEST,
2275 	},
2276 	.hw.init = &(struct clk_init_data){
2277 		.name = "vdec_1",
2278 		.ops = &clk_regmap_mux_ops,
2279 		.parent_hws = (const struct clk_hw *[]) {
2280 			&meson8b_vdec_1_1.hw,
2281 			&meson8b_vdec_1_2.hw,
2282 		},
2283 		.num_parents = 2,
2284 		.flags = CLK_SET_RATE_PARENT,
2285 	},
2286 };
2287 
2288 static struct clk_regmap meson8b_vdec_hcodec_sel = {
2289 	.data = &(struct clk_regmap_mux_data){
2290 		.offset = HHI_VDEC_CLK_CNTL,
2291 		.mask = 0x3,
2292 		.shift = 25,
2293 		.flags = CLK_MUX_ROUND_CLOSEST,
2294 	},
2295 	.hw.init = &(struct clk_init_data){
2296 		.name = "vdec_hcodec_sel",
2297 		.ops = &clk_regmap_mux_ops,
2298 		.parent_hws = meson8b_vdec_parent_hws,
2299 		.num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2300 		.flags = CLK_SET_RATE_PARENT,
2301 	},
2302 };
2303 
2304 static struct clk_regmap meson8b_vdec_hcodec_div = {
2305 	.data = &(struct clk_regmap_div_data){
2306 		.offset = HHI_VDEC_CLK_CNTL,
2307 		.shift = 16,
2308 		.width = 7,
2309 		.flags = CLK_DIVIDER_ROUND_CLOSEST,
2310 	},
2311 	.hw.init = &(struct clk_init_data){
2312 		.name = "vdec_hcodec_div",
2313 		.ops = &clk_regmap_divider_ops,
2314 		.parent_hws = (const struct clk_hw *[]) {
2315 			&meson8b_vdec_hcodec_sel.hw
2316 		},
2317 		.num_parents = 1,
2318 		.flags = CLK_SET_RATE_PARENT,
2319 	},
2320 };
2321 
2322 static struct clk_regmap meson8b_vdec_hcodec = {
2323 	.data = &(struct clk_regmap_gate_data){
2324 		.offset = HHI_VDEC_CLK_CNTL,
2325 		.bit_idx = 24,
2326 	},
2327 	.hw.init = &(struct clk_init_data) {
2328 		.name = "vdec_hcodec",
2329 		.ops = &clk_regmap_gate_ops,
2330 		.parent_hws = (const struct clk_hw *[]) {
2331 			&meson8b_vdec_hcodec_div.hw
2332 		},
2333 		.num_parents = 1,
2334 		.flags = CLK_SET_RATE_PARENT,
2335 	},
2336 };
2337 
2338 static struct clk_regmap meson8b_vdec_2_sel = {
2339 	.data = &(struct clk_regmap_mux_data){
2340 		.offset = HHI_VDEC2_CLK_CNTL,
2341 		.mask = 0x3,
2342 		.shift = 9,
2343 		.flags = CLK_MUX_ROUND_CLOSEST,
2344 	},
2345 	.hw.init = &(struct clk_init_data){
2346 		.name = "vdec_2_sel",
2347 		.ops = &clk_regmap_mux_ops,
2348 		.parent_hws = meson8b_vdec_parent_hws,
2349 		.num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2350 		.flags = CLK_SET_RATE_PARENT,
2351 	},
2352 };
2353 
2354 static struct clk_regmap meson8b_vdec_2_div = {
2355 	.data = &(struct clk_regmap_div_data){
2356 		.offset = HHI_VDEC2_CLK_CNTL,
2357 		.shift = 0,
2358 		.width = 7,
2359 		.flags = CLK_DIVIDER_ROUND_CLOSEST,
2360 	},
2361 	.hw.init = &(struct clk_init_data){
2362 		.name = "vdec_2_div",
2363 		.ops = &clk_regmap_divider_ops,
2364 		.parent_hws = (const struct clk_hw *[]) {
2365 			&meson8b_vdec_2_sel.hw
2366 		},
2367 		.num_parents = 1,
2368 		.flags = CLK_SET_RATE_PARENT,
2369 	},
2370 };
2371 
2372 static struct clk_regmap meson8b_vdec_2 = {
2373 	.data = &(struct clk_regmap_gate_data){
2374 		.offset = HHI_VDEC2_CLK_CNTL,
2375 		.bit_idx = 8,
2376 	},
2377 	.hw.init = &(struct clk_init_data) {
2378 		.name = "vdec_2",
2379 		.ops = &clk_regmap_gate_ops,
2380 		.parent_hws = (const struct clk_hw *[]) {
2381 			&meson8b_vdec_2_div.hw
2382 		},
2383 		.num_parents = 1,
2384 		.flags = CLK_SET_RATE_PARENT,
2385 	},
2386 };
2387 
2388 static struct clk_regmap meson8b_vdec_hevc_sel = {
2389 	.data = &(struct clk_regmap_mux_data){
2390 		.offset = HHI_VDEC2_CLK_CNTL,
2391 		.mask = 0x3,
2392 		.shift = 25,
2393 		.flags = CLK_MUX_ROUND_CLOSEST,
2394 	},
2395 	.hw.init = &(struct clk_init_data){
2396 		.name = "vdec_hevc_sel",
2397 		.ops = &clk_regmap_mux_ops,
2398 		.parent_hws = meson8b_vdec_parent_hws,
2399 		.num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2400 		.flags = CLK_SET_RATE_PARENT,
2401 	},
2402 };
2403 
2404 static struct clk_regmap meson8b_vdec_hevc_div = {
2405 	.data = &(struct clk_regmap_div_data){
2406 		.offset = HHI_VDEC2_CLK_CNTL,
2407 		.shift = 16,
2408 		.width = 7,
2409 		.flags = CLK_DIVIDER_ROUND_CLOSEST,
2410 	},
2411 	.hw.init = &(struct clk_init_data){
2412 		.name = "vdec_hevc_div",
2413 		.ops = &clk_regmap_divider_ops,
2414 		.parent_hws = (const struct clk_hw *[]) {
2415 			&meson8b_vdec_hevc_sel.hw
2416 		},
2417 		.num_parents = 1,
2418 		.flags = CLK_SET_RATE_PARENT,
2419 	},
2420 };
2421 
2422 static struct clk_regmap meson8b_vdec_hevc_en = {
2423 	.data = &(struct clk_regmap_gate_data){
2424 		.offset = HHI_VDEC2_CLK_CNTL,
2425 		.bit_idx = 24,
2426 	},
2427 	.hw.init = &(struct clk_init_data) {
2428 		.name = "vdec_hevc_en",
2429 		.ops = &clk_regmap_gate_ops,
2430 		.parent_hws = (const struct clk_hw *[]) {
2431 			&meson8b_vdec_hevc_div.hw
2432 		},
2433 		.num_parents = 1,
2434 		.flags = CLK_SET_RATE_PARENT,
2435 	},
2436 };
2437 
2438 static struct clk_regmap meson8b_vdec_hevc = {
2439 	.data = &(struct clk_regmap_mux_data){
2440 		.offset = HHI_VDEC2_CLK_CNTL,
2441 		.mask = 0x1,
2442 		.shift = 31,
2443 		.flags = CLK_MUX_ROUND_CLOSEST,
2444 	},
2445 	.hw.init = &(struct clk_init_data){
2446 		.name = "vdec_hevc",
2447 		.ops = &clk_regmap_mux_ops,
2448 		/* TODO: The second parent is currently unknown */
2449 		.parent_hws = (const struct clk_hw *[]) {
2450 			&meson8b_vdec_hevc_en.hw
2451 		},
2452 		.num_parents = 1,
2453 		.flags = CLK_SET_RATE_PARENT,
2454 	},
2455 };
2456 
2457 /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */
2458 static const struct clk_hw *meson8b_cts_amclk_parent_hws[] = {
2459 	&meson8b_mpll0.hw,
2460 	&meson8b_mpll1.hw,
2461 	&meson8b_mpll2.hw
2462 };
2463 
2464 static u32 meson8b_cts_amclk_mux_table[] = { 1, 2, 3 };
2465 
2466 static struct clk_regmap meson8b_cts_amclk_sel = {
2467 	.data = &(struct clk_regmap_mux_data){
2468 		.offset = HHI_AUD_CLK_CNTL,
2469 		.mask = 0x3,
2470 		.shift = 9,
2471 		.table = meson8b_cts_amclk_mux_table,
2472 		.flags = CLK_MUX_ROUND_CLOSEST,
2473 	},
2474 	.hw.init = &(struct clk_init_data){
2475 		.name = "cts_amclk_sel",
2476 		.ops = &clk_regmap_mux_ops,
2477 		.parent_hws = meson8b_cts_amclk_parent_hws,
2478 		.num_parents = ARRAY_SIZE(meson8b_cts_amclk_parent_hws),
2479 	},
2480 };
2481 
2482 static struct clk_regmap meson8b_cts_amclk_div = {
2483 	.data = &(struct clk_regmap_div_data) {
2484 		.offset = HHI_AUD_CLK_CNTL,
2485 		.shift = 0,
2486 		.width = 8,
2487 		.flags = CLK_DIVIDER_ROUND_CLOSEST,
2488 	},
2489 	.hw.init = &(struct clk_init_data){
2490 		.name = "cts_amclk_div",
2491 		.ops = &clk_regmap_divider_ops,
2492 		.parent_hws = (const struct clk_hw *[]) {
2493 			&meson8b_cts_amclk_sel.hw
2494 		},
2495 		.num_parents = 1,
2496 		.flags = CLK_SET_RATE_PARENT,
2497 	},
2498 };
2499 
2500 static struct clk_regmap meson8b_cts_amclk = {
2501 	.data = &(struct clk_regmap_gate_data){
2502 		.offset = HHI_AUD_CLK_CNTL,
2503 		.bit_idx = 8,
2504 	},
2505 	.hw.init = &(struct clk_init_data){
2506 		.name = "cts_amclk",
2507 		.ops = &clk_regmap_gate_ops,
2508 		.parent_hws = (const struct clk_hw *[]) {
2509 			&meson8b_cts_amclk_div.hw
2510 		},
2511 		.num_parents = 1,
2512 		.flags = CLK_SET_RATE_PARENT,
2513 	},
2514 };
2515 
2516 /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */
2517 static const struct clk_hw *meson8b_cts_mclk_i958_parent_hws[] = {
2518 	&meson8b_mpll0.hw,
2519 	&meson8b_mpll1.hw,
2520 	&meson8b_mpll2.hw
2521 };
2522 
2523 static u32 meson8b_cts_mclk_i958_mux_table[] = { 1, 2, 3 };
2524 
2525 static struct clk_regmap meson8b_cts_mclk_i958_sel = {
2526 	.data = &(struct clk_regmap_mux_data){
2527 		.offset = HHI_AUD_CLK_CNTL2,
2528 		.mask = 0x3,
2529 		.shift = 25,
2530 		.table = meson8b_cts_mclk_i958_mux_table,
2531 		.flags = CLK_MUX_ROUND_CLOSEST,
2532 	},
2533 	.hw.init = &(struct clk_init_data) {
2534 		.name = "cts_mclk_i958_sel",
2535 		.ops = &clk_regmap_mux_ops,
2536 		.parent_hws = meson8b_cts_mclk_i958_parent_hws,
2537 		.num_parents = ARRAY_SIZE(meson8b_cts_mclk_i958_parent_hws),
2538 	},
2539 };
2540 
2541 static struct clk_regmap meson8b_cts_mclk_i958_div = {
2542 	.data = &(struct clk_regmap_div_data){
2543 		.offset = HHI_AUD_CLK_CNTL2,
2544 		.shift = 16,
2545 		.width = 8,
2546 		.flags = CLK_DIVIDER_ROUND_CLOSEST,
2547 	},
2548 	.hw.init = &(struct clk_init_data) {
2549 		.name = "cts_mclk_i958_div",
2550 		.ops = &clk_regmap_divider_ops,
2551 		.parent_hws = (const struct clk_hw *[]) {
2552 			&meson8b_cts_mclk_i958_sel.hw
2553 		},
2554 		.num_parents = 1,
2555 		.flags = CLK_SET_RATE_PARENT,
2556 	},
2557 };
2558 
2559 static struct clk_regmap meson8b_cts_mclk_i958 = {
2560 	.data = &(struct clk_regmap_gate_data){
2561 		.offset = HHI_AUD_CLK_CNTL2,
2562 		.bit_idx = 24,
2563 	},
2564 	.hw.init = &(struct clk_init_data){
2565 		.name = "cts_mclk_i958",
2566 		.ops = &clk_regmap_gate_ops,
2567 		.parent_hws = (const struct clk_hw *[]) {
2568 			&meson8b_cts_mclk_i958_div.hw
2569 		},
2570 		.num_parents = 1,
2571 		.flags = CLK_SET_RATE_PARENT,
2572 	},
2573 };
2574 
2575 static struct clk_regmap meson8b_cts_i958 = {
2576 	.data = &(struct clk_regmap_mux_data){
2577 		.offset = HHI_AUD_CLK_CNTL2,
2578 		.mask = 0x1,
2579 		.shift = 27,
2580 		},
2581 	.hw.init = &(struct clk_init_data){
2582 		.name = "cts_i958",
2583 		.ops = &clk_regmap_mux_ops,
2584 		.parent_hws = (const struct clk_hw *[]) {
2585 			&meson8b_cts_amclk.hw,
2586 			&meson8b_cts_mclk_i958.hw
2587 		},
2588 		.num_parents = 2,
2589 		/*
2590 		 * The parent is specific to origin of the audio data. Let the
2591 		 * consumer choose the appropriate parent.
2592 		 */
2593 		.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
2594 	},
2595 };
2596 
2597 #define MESON_GATE(_name, _reg, _bit) \
2598 	MESON_PCLK(_name, _reg, _bit, &meson8b_clk81.hw)
2599 
2600 /* Everything Else (EE) domain gates */
2601 
2602 static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0);
2603 static MESON_GATE(meson8b_dos, HHI_GCLK_MPEG0, 1);
2604 static MESON_GATE(meson8b_isa, HHI_GCLK_MPEG0, 5);
2605 static MESON_GATE(meson8b_pl301, HHI_GCLK_MPEG0, 6);
2606 static MESON_GATE(meson8b_periphs, HHI_GCLK_MPEG0, 7);
2607 static MESON_GATE(meson8b_spicc, HHI_GCLK_MPEG0, 8);
2608 static MESON_GATE(meson8b_i2c, HHI_GCLK_MPEG0, 9);
2609 static MESON_GATE(meson8b_sar_adc, HHI_GCLK_MPEG0, 10);
2610 static MESON_GATE(meson8b_smart_card, HHI_GCLK_MPEG0, 11);
2611 static MESON_GATE(meson8b_rng0, HHI_GCLK_MPEG0, 12);
2612 static MESON_GATE(meson8b_uart0, HHI_GCLK_MPEG0, 13);
2613 static MESON_GATE(meson8b_sdhc, HHI_GCLK_MPEG0, 14);
2614 static MESON_GATE(meson8b_stream, HHI_GCLK_MPEG0, 15);
2615 static MESON_GATE(meson8b_async_fifo, HHI_GCLK_MPEG0, 16);
2616 static MESON_GATE(meson8b_sdio, HHI_GCLK_MPEG0, 17);
2617 static MESON_GATE(meson8b_abuf, HHI_GCLK_MPEG0, 18);
2618 static MESON_GATE(meson8b_hiu_iface, HHI_GCLK_MPEG0, 19);
2619 static MESON_GATE(meson8b_assist_misc, HHI_GCLK_MPEG0, 23);
2620 static MESON_GATE(meson8b_spi, HHI_GCLK_MPEG0, 30);
2621 
2622 static MESON_GATE(meson8b_i2s_spdif, HHI_GCLK_MPEG1, 2);
2623 static MESON_GATE(meson8b_eth, HHI_GCLK_MPEG1, 3);
2624 static MESON_GATE(meson8b_demux, HHI_GCLK_MPEG1, 4);
2625 static MESON_GATE(meson8b_blkmv, HHI_GCLK_MPEG1, 14);
2626 static MESON_GATE(meson8b_aiu, HHI_GCLK_MPEG1, 15);
2627 static MESON_GATE(meson8b_uart1, HHI_GCLK_MPEG1, 16);
2628 static MESON_GATE(meson8b_g2d, HHI_GCLK_MPEG1, 20);
2629 static MESON_GATE(meson8b_usb0, HHI_GCLK_MPEG1, 21);
2630 static MESON_GATE(meson8b_usb1, HHI_GCLK_MPEG1, 22);
2631 static MESON_GATE(meson8b_reset, HHI_GCLK_MPEG1, 23);
2632 static MESON_GATE(meson8b_nand, HHI_GCLK_MPEG1, 24);
2633 static MESON_GATE(meson8b_dos_parser, HHI_GCLK_MPEG1, 25);
2634 static MESON_GATE(meson8b_usb, HHI_GCLK_MPEG1, 26);
2635 static MESON_GATE(meson8b_vdin1, HHI_GCLK_MPEG1, 28);
2636 static MESON_GATE(meson8b_ahb_arb0, HHI_GCLK_MPEG1, 29);
2637 static MESON_GATE(meson8b_efuse, HHI_GCLK_MPEG1, 30);
2638 static MESON_GATE(meson8b_boot_rom, HHI_GCLK_MPEG1, 31);
2639 
2640 static MESON_GATE(meson8b_ahb_data_bus, HHI_GCLK_MPEG2, 1);
2641 static MESON_GATE(meson8b_ahb_ctrl_bus, HHI_GCLK_MPEG2, 2);
2642 static MESON_GATE(meson8b_hdmi_intr_sync, HHI_GCLK_MPEG2, 3);
2643 static MESON_GATE(meson8b_hdmi_pclk, HHI_GCLK_MPEG2, 4);
2644 static MESON_GATE(meson8b_usb1_ddr_bridge, HHI_GCLK_MPEG2, 8);
2645 static MESON_GATE(meson8b_usb0_ddr_bridge, HHI_GCLK_MPEG2, 9);
2646 static MESON_GATE(meson8b_mmc_pclk, HHI_GCLK_MPEG2, 11);
2647 static MESON_GATE(meson8b_dvin, HHI_GCLK_MPEG2, 12);
2648 static MESON_GATE(meson8b_uart2, HHI_GCLK_MPEG2, 15);
2649 static MESON_GATE(meson8b_sana, HHI_GCLK_MPEG2, 22);
2650 static MESON_GATE(meson8b_vpu_intr, HHI_GCLK_MPEG2, 25);
2651 static MESON_GATE(meson8b_sec_ahb_ahb3_bridge, HHI_GCLK_MPEG2, 26);
2652 static MESON_GATE(meson8b_clk81_a9, HHI_GCLK_MPEG2, 29);
2653 
2654 static MESON_GATE(meson8b_vclk2_venci0, HHI_GCLK_OTHER, 1);
2655 static MESON_GATE(meson8b_vclk2_venci1, HHI_GCLK_OTHER, 2);
2656 static MESON_GATE(meson8b_vclk2_vencp0, HHI_GCLK_OTHER, 3);
2657 static MESON_GATE(meson8b_vclk2_vencp1, HHI_GCLK_OTHER, 4);
2658 static MESON_GATE(meson8b_gclk_venci_int, HHI_GCLK_OTHER, 8);
2659 static MESON_GATE(meson8b_gclk_vencp_int, HHI_GCLK_OTHER, 9);
2660 static MESON_GATE(meson8b_dac_clk, HHI_GCLK_OTHER, 10);
2661 static MESON_GATE(meson8b_aoclk_gate, HHI_GCLK_OTHER, 14);
2662 static MESON_GATE(meson8b_iec958_gate, HHI_GCLK_OTHER, 16);
2663 static MESON_GATE(meson8b_enc480p, HHI_GCLK_OTHER, 20);
2664 static MESON_GATE(meson8b_rng1, HHI_GCLK_OTHER, 21);
2665 static MESON_GATE(meson8b_gclk_vencl_int, HHI_GCLK_OTHER, 22);
2666 static MESON_GATE(meson8b_vclk2_venclmcc, HHI_GCLK_OTHER, 24);
2667 static MESON_GATE(meson8b_vclk2_vencl, HHI_GCLK_OTHER, 25);
2668 static MESON_GATE(meson8b_vclk2_other, HHI_GCLK_OTHER, 26);
2669 static MESON_GATE(meson8b_edp, HHI_GCLK_OTHER, 31);
2670 
2671 /* AIU gates */
2672 #define MESON_AIU_GLUE_GATE(_name, _reg, _bit) \
2673 	MESON_PCLK(_name, _reg, _bit, &meson8b_aiu_glue.hw)
2674 
2675 static MESON_PCLK(meson8b_aiu_glue, HHI_GCLK_MPEG1, 6, &meson8b_aiu.hw);
2676 static MESON_AIU_GLUE_GATE(meson8b_iec958, HHI_GCLK_MPEG1, 7);
2677 static MESON_AIU_GLUE_GATE(meson8b_i2s_out, HHI_GCLK_MPEG1, 8);
2678 static MESON_AIU_GLUE_GATE(meson8b_amclk, HHI_GCLK_MPEG1, 9);
2679 static MESON_AIU_GLUE_GATE(meson8b_aififo2, HHI_GCLK_MPEG1, 10);
2680 static MESON_AIU_GLUE_GATE(meson8b_mixer, HHI_GCLK_MPEG1, 11);
2681 static MESON_AIU_GLUE_GATE(meson8b_mixer_iface, HHI_GCLK_MPEG1, 12);
2682 static MESON_AIU_GLUE_GATE(meson8b_adc, HHI_GCLK_MPEG1, 13);
2683 
2684 /* Always On (AO) domain gates */
2685 
2686 static MESON_GATE(meson8b_ao_media_cpu, HHI_GCLK_AO, 0);
2687 static MESON_GATE(meson8b_ao_ahb_sram, HHI_GCLK_AO, 1);
2688 static MESON_GATE(meson8b_ao_ahb_bus, HHI_GCLK_AO, 2);
2689 static MESON_GATE(meson8b_ao_iface, HHI_GCLK_AO, 3);
2690 
2691 static struct clk_hw_onecell_data meson8_hw_onecell_data = {
2692 	.hws = {
2693 		[CLKID_XTAL] = &meson8b_xtal.hw,
2694 		[CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
2695 		[CLKID_PLL_VID] = &meson8b_vid_pll.hw,
2696 		[CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
2697 		[CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
2698 		[CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
2699 		[CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
2700 		[CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
2701 		[CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
2702 		[CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
2703 		[CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
2704 		[CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
2705 		[CLKID_CLK81] = &meson8b_clk81.hw,
2706 		[CLKID_DDR]		    = &meson8b_ddr.hw,
2707 		[CLKID_DOS]		    = &meson8b_dos.hw,
2708 		[CLKID_ISA]		    = &meson8b_isa.hw,
2709 		[CLKID_PL301]		    = &meson8b_pl301.hw,
2710 		[CLKID_PERIPHS]		    = &meson8b_periphs.hw,
2711 		[CLKID_SPICC]		    = &meson8b_spicc.hw,
2712 		[CLKID_I2C]		    = &meson8b_i2c.hw,
2713 		[CLKID_SAR_ADC]		    = &meson8b_sar_adc.hw,
2714 		[CLKID_SMART_CARD]	    = &meson8b_smart_card.hw,
2715 		[CLKID_RNG0]		    = &meson8b_rng0.hw,
2716 		[CLKID_UART0]		    = &meson8b_uart0.hw,
2717 		[CLKID_SDHC]		    = &meson8b_sdhc.hw,
2718 		[CLKID_STREAM]		    = &meson8b_stream.hw,
2719 		[CLKID_ASYNC_FIFO]	    = &meson8b_async_fifo.hw,
2720 		[CLKID_SDIO]		    = &meson8b_sdio.hw,
2721 		[CLKID_ABUF]		    = &meson8b_abuf.hw,
2722 		[CLKID_HIU_IFACE]	    = &meson8b_hiu_iface.hw,
2723 		[CLKID_ASSIST_MISC]	    = &meson8b_assist_misc.hw,
2724 		[CLKID_SPI]		    = &meson8b_spi.hw,
2725 		[CLKID_I2S_SPDIF]	    = &meson8b_i2s_spdif.hw,
2726 		[CLKID_ETH]		    = &meson8b_eth.hw,
2727 		[CLKID_DEMUX]		    = &meson8b_demux.hw,
2728 		[CLKID_AIU_GLUE]	    = &meson8b_aiu_glue.hw,
2729 		[CLKID_IEC958]		    = &meson8b_iec958.hw,
2730 		[CLKID_I2S_OUT]		    = &meson8b_i2s_out.hw,
2731 		[CLKID_AMCLK]		    = &meson8b_amclk.hw,
2732 		[CLKID_AIFIFO2]		    = &meson8b_aififo2.hw,
2733 		[CLKID_MIXER]		    = &meson8b_mixer.hw,
2734 		[CLKID_MIXER_IFACE]	    = &meson8b_mixer_iface.hw,
2735 		[CLKID_ADC]		    = &meson8b_adc.hw,
2736 		[CLKID_BLKMV]		    = &meson8b_blkmv.hw,
2737 		[CLKID_AIU]		    = &meson8b_aiu.hw,
2738 		[CLKID_UART1]		    = &meson8b_uart1.hw,
2739 		[CLKID_G2D]		    = &meson8b_g2d.hw,
2740 		[CLKID_USB0]		    = &meson8b_usb0.hw,
2741 		[CLKID_USB1]		    = &meson8b_usb1.hw,
2742 		[CLKID_RESET]		    = &meson8b_reset.hw,
2743 		[CLKID_NAND]		    = &meson8b_nand.hw,
2744 		[CLKID_DOS_PARSER]	    = &meson8b_dos_parser.hw,
2745 		[CLKID_USB]		    = &meson8b_usb.hw,
2746 		[CLKID_VDIN1]		    = &meson8b_vdin1.hw,
2747 		[CLKID_AHB_ARB0]	    = &meson8b_ahb_arb0.hw,
2748 		[CLKID_EFUSE]		    = &meson8b_efuse.hw,
2749 		[CLKID_BOOT_ROM]	    = &meson8b_boot_rom.hw,
2750 		[CLKID_AHB_DATA_BUS]	    = &meson8b_ahb_data_bus.hw,
2751 		[CLKID_AHB_CTRL_BUS]	    = &meson8b_ahb_ctrl_bus.hw,
2752 		[CLKID_HDMI_INTR_SYNC]	    = &meson8b_hdmi_intr_sync.hw,
2753 		[CLKID_HDMI_PCLK]	    = &meson8b_hdmi_pclk.hw,
2754 		[CLKID_USB1_DDR_BRIDGE]	    = &meson8b_usb1_ddr_bridge.hw,
2755 		[CLKID_USB0_DDR_BRIDGE]	    = &meson8b_usb0_ddr_bridge.hw,
2756 		[CLKID_MMC_PCLK]	    = &meson8b_mmc_pclk.hw,
2757 		[CLKID_DVIN]		    = &meson8b_dvin.hw,
2758 		[CLKID_UART2]		    = &meson8b_uart2.hw,
2759 		[CLKID_SANA]		    = &meson8b_sana.hw,
2760 		[CLKID_VPU_INTR]	    = &meson8b_vpu_intr.hw,
2761 		[CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
2762 		[CLKID_CLK81_A9]	    = &meson8b_clk81_a9.hw,
2763 		[CLKID_VCLK2_VENCI0]	    = &meson8b_vclk2_venci0.hw,
2764 		[CLKID_VCLK2_VENCI1]	    = &meson8b_vclk2_venci1.hw,
2765 		[CLKID_VCLK2_VENCP0]	    = &meson8b_vclk2_vencp0.hw,
2766 		[CLKID_VCLK2_VENCP1]	    = &meson8b_vclk2_vencp1.hw,
2767 		[CLKID_GCLK_VENCI_INT]	    = &meson8b_gclk_venci_int.hw,
2768 		[CLKID_GCLK_VENCP_INT]	    = &meson8b_gclk_vencp_int.hw,
2769 		[CLKID_DAC_CLK]		    = &meson8b_dac_clk.hw,
2770 		[CLKID_AOCLK_GATE]	    = &meson8b_aoclk_gate.hw,
2771 		[CLKID_IEC958_GATE]	    = &meson8b_iec958_gate.hw,
2772 		[CLKID_ENC480P]		    = &meson8b_enc480p.hw,
2773 		[CLKID_RNG1]		    = &meson8b_rng1.hw,
2774 		[CLKID_GCLK_VENCL_INT]	    = &meson8b_gclk_vencl_int.hw,
2775 		[CLKID_VCLK2_VENCLMCC]	    = &meson8b_vclk2_venclmcc.hw,
2776 		[CLKID_VCLK2_VENCL]	    = &meson8b_vclk2_vencl.hw,
2777 		[CLKID_VCLK2_OTHER]	    = &meson8b_vclk2_other.hw,
2778 		[CLKID_EDP]		    = &meson8b_edp.hw,
2779 		[CLKID_AO_MEDIA_CPU]	    = &meson8b_ao_media_cpu.hw,
2780 		[CLKID_AO_AHB_SRAM]	    = &meson8b_ao_ahb_sram.hw,
2781 		[CLKID_AO_AHB_BUS]	    = &meson8b_ao_ahb_bus.hw,
2782 		[CLKID_AO_IFACE]	    = &meson8b_ao_iface.hw,
2783 		[CLKID_MPLL0]		    = &meson8b_mpll0.hw,
2784 		[CLKID_MPLL1]		    = &meson8b_mpll1.hw,
2785 		[CLKID_MPLL2]		    = &meson8b_mpll2.hw,
2786 		[CLKID_MPLL0_DIV]	    = &meson8b_mpll0_div.hw,
2787 		[CLKID_MPLL1_DIV]	    = &meson8b_mpll1_div.hw,
2788 		[CLKID_MPLL2_DIV]	    = &meson8b_mpll2_div.hw,
2789 		[CLKID_CPU_IN_SEL]	    = &meson8b_cpu_in_sel.hw,
2790 		[CLKID_CPU_IN_DIV2]	    = &meson8b_cpu_in_div2.hw,
2791 		[CLKID_CPU_IN_DIV3]	    = &meson8b_cpu_in_div3.hw,
2792 		[CLKID_CPU_SCALE_DIV]	    = &meson8b_cpu_scale_div.hw,
2793 		[CLKID_CPU_SCALE_OUT_SEL]   = &meson8b_cpu_scale_out_sel.hw,
2794 		[CLKID_MPLL_PREDIV]	    = &meson8b_mpll_prediv.hw,
2795 		[CLKID_FCLK_DIV2_DIV]	    = &meson8b_fclk_div2_div.hw,
2796 		[CLKID_FCLK_DIV3_DIV]	    = &meson8b_fclk_div3_div.hw,
2797 		[CLKID_FCLK_DIV4_DIV]	    = &meson8b_fclk_div4_div.hw,
2798 		[CLKID_FCLK_DIV5_DIV]	    = &meson8b_fclk_div5_div.hw,
2799 		[CLKID_FCLK_DIV7_DIV]	    = &meson8b_fclk_div7_div.hw,
2800 		[CLKID_NAND_SEL]	    = &meson8b_nand_clk_sel.hw,
2801 		[CLKID_NAND_DIV]	    = &meson8b_nand_clk_div.hw,
2802 		[CLKID_NAND_CLK]	    = &meson8b_nand_clk_gate.hw,
2803 		[CLKID_PLL_FIXED_DCO]	    = &meson8b_fixed_pll_dco.hw,
2804 		[CLKID_HDMI_PLL_DCO]	    = &meson8b_hdmi_pll_dco.hw,
2805 		[CLKID_PLL_SYS_DCO]	    = &meson8b_sys_pll_dco.hw,
2806 		[CLKID_CPU_CLK_DIV2]	    = &meson8b_cpu_clk_div2.hw,
2807 		[CLKID_CPU_CLK_DIV3]	    = &meson8b_cpu_clk_div3.hw,
2808 		[CLKID_CPU_CLK_DIV4]	    = &meson8b_cpu_clk_div4.hw,
2809 		[CLKID_CPU_CLK_DIV5]	    = &meson8b_cpu_clk_div5.hw,
2810 		[CLKID_CPU_CLK_DIV6]	    = &meson8b_cpu_clk_div6.hw,
2811 		[CLKID_CPU_CLK_DIV7]	    = &meson8b_cpu_clk_div7.hw,
2812 		[CLKID_CPU_CLK_DIV8]	    = &meson8b_cpu_clk_div8.hw,
2813 		[CLKID_APB_SEL]		    = &meson8b_apb_clk_sel.hw,
2814 		[CLKID_APB]		    = &meson8b_apb_clk_gate.hw,
2815 		[CLKID_PERIPH_SEL]	    = &meson8b_periph_clk_sel.hw,
2816 		[CLKID_PERIPH]		    = &meson8b_periph_clk_gate.hw,
2817 		[CLKID_AXI_SEL]		    = &meson8b_axi_clk_sel.hw,
2818 		[CLKID_AXI]		    = &meson8b_axi_clk_gate.hw,
2819 		[CLKID_L2_DRAM_SEL]	    = &meson8b_l2_dram_clk_sel.hw,
2820 		[CLKID_L2_DRAM]		    = &meson8b_l2_dram_clk_gate.hw,
2821 		[CLKID_HDMI_PLL_LVDS_OUT]   = &meson8b_hdmi_pll_lvds_out.hw,
2822 		[CLKID_HDMI_PLL_HDMI_OUT]   = &meson8b_hdmi_pll_hdmi_out.hw,
2823 		[CLKID_VID_PLL_IN_SEL]	    = &meson8b_vid_pll_in_sel.hw,
2824 		[CLKID_VID_PLL_IN_EN]	    = &meson8b_vid_pll_in_en.hw,
2825 		[CLKID_VID_PLL_PRE_DIV]	    = &meson8b_vid_pll_pre_div.hw,
2826 		[CLKID_VID_PLL_POST_DIV]    = &meson8b_vid_pll_post_div.hw,
2827 		[CLKID_VID_PLL_FINAL_DIV]   = &meson8b_vid_pll_final_div.hw,
2828 		[CLKID_VCLK_IN_SEL]	    = &meson8b_vclk_in_sel.hw,
2829 		[CLKID_VCLK_IN_EN]	    = &meson8b_vclk_in_en.hw,
2830 		[CLKID_VCLK_DIV1]	    = &meson8b_vclk_div1_gate.hw,
2831 		[CLKID_VCLK_DIV2_DIV]	    = &meson8b_vclk_div2_div.hw,
2832 		[CLKID_VCLK_DIV2]	    = &meson8b_vclk_div2_div_gate.hw,
2833 		[CLKID_VCLK_DIV4_DIV]	    = &meson8b_vclk_div4_div.hw,
2834 		[CLKID_VCLK_DIV4]	    = &meson8b_vclk_div4_div_gate.hw,
2835 		[CLKID_VCLK_DIV6_DIV]	    = &meson8b_vclk_div6_div.hw,
2836 		[CLKID_VCLK_DIV6]	    = &meson8b_vclk_div6_div_gate.hw,
2837 		[CLKID_VCLK_DIV12_DIV]	    = &meson8b_vclk_div12_div.hw,
2838 		[CLKID_VCLK_DIV12]	    = &meson8b_vclk_div12_div_gate.hw,
2839 		[CLKID_VCLK2_IN_SEL]	    = &meson8b_vclk2_in_sel.hw,
2840 		[CLKID_VCLK2_IN_EN]	    = &meson8b_vclk2_clk_in_en.hw,
2841 		[CLKID_VCLK2_DIV1]	    = &meson8b_vclk2_div1_gate.hw,
2842 		[CLKID_VCLK2_DIV2_DIV]	    = &meson8b_vclk2_div2_div.hw,
2843 		[CLKID_VCLK2_DIV2]	    = &meson8b_vclk2_div2_div_gate.hw,
2844 		[CLKID_VCLK2_DIV4_DIV]	    = &meson8b_vclk2_div4_div.hw,
2845 		[CLKID_VCLK2_DIV4]	    = &meson8b_vclk2_div4_div_gate.hw,
2846 		[CLKID_VCLK2_DIV6_DIV]	    = &meson8b_vclk2_div6_div.hw,
2847 		[CLKID_VCLK2_DIV6]	    = &meson8b_vclk2_div6_div_gate.hw,
2848 		[CLKID_VCLK2_DIV12_DIV]	    = &meson8b_vclk2_div12_div.hw,
2849 		[CLKID_VCLK2_DIV12]	    = &meson8b_vclk2_div12_div_gate.hw,
2850 		[CLKID_CTS_ENCT_SEL]	    = &meson8b_cts_enct_sel.hw,
2851 		[CLKID_CTS_ENCT]	    = &meson8b_cts_enct.hw,
2852 		[CLKID_CTS_ENCP_SEL]	    = &meson8b_cts_encp_sel.hw,
2853 		[CLKID_CTS_ENCP]	    = &meson8b_cts_encp.hw,
2854 		[CLKID_CTS_ENCI_SEL]	    = &meson8b_cts_enci_sel.hw,
2855 		[CLKID_CTS_ENCI]	    = &meson8b_cts_enci.hw,
2856 		[CLKID_HDMI_TX_PIXEL_SEL]   = &meson8b_hdmi_tx_pixel_sel.hw,
2857 		[CLKID_HDMI_TX_PIXEL]	    = &meson8b_hdmi_tx_pixel.hw,
2858 		[CLKID_CTS_ENCL_SEL]	    = &meson8b_cts_encl_sel.hw,
2859 		[CLKID_CTS_ENCL]	    = &meson8b_cts_encl.hw,
2860 		[CLKID_CTS_VDAC0_SEL]	    = &meson8b_cts_vdac0_sel.hw,
2861 		[CLKID_CTS_VDAC0]	    = &meson8b_cts_vdac0.hw,
2862 		[CLKID_HDMI_SYS_SEL]	    = &meson8b_hdmi_sys_sel.hw,
2863 		[CLKID_HDMI_SYS_DIV]	    = &meson8b_hdmi_sys_div.hw,
2864 		[CLKID_HDMI_SYS]	    = &meson8b_hdmi_sys.hw,
2865 		[CLKID_MALI_0_SEL]	    = &meson8b_mali_0_sel.hw,
2866 		[CLKID_MALI_0_DIV]	    = &meson8b_mali_0_div.hw,
2867 		[CLKID_MALI]		    = &meson8b_mali_0.hw,
2868 		[CLKID_VPU_0_SEL]	    = &meson8b_vpu_0_sel.hw,
2869 		[CLKID_VPU_0_DIV]	    = &meson8b_vpu_0_div.hw,
2870 		[CLKID_VPU]		    = &meson8b_vpu_0.hw,
2871 		[CLKID_VDEC_1_SEL]	    = &meson8b_vdec_1_sel.hw,
2872 		[CLKID_VDEC_1_1_DIV]	    = &meson8b_vdec_1_1_div.hw,
2873 		[CLKID_VDEC_1]	   	    = &meson8b_vdec_1_1.hw,
2874 		[CLKID_VDEC_HCODEC_SEL]	    = &meson8b_vdec_hcodec_sel.hw,
2875 		[CLKID_VDEC_HCODEC_DIV]	    = &meson8b_vdec_hcodec_div.hw,
2876 		[CLKID_VDEC_HCODEC]	    = &meson8b_vdec_hcodec.hw,
2877 		[CLKID_VDEC_2_SEL]	    = &meson8b_vdec_2_sel.hw,
2878 		[CLKID_VDEC_2_DIV]	    = &meson8b_vdec_2_div.hw,
2879 		[CLKID_VDEC_2]	    	    = &meson8b_vdec_2.hw,
2880 		[CLKID_VDEC_HEVC_SEL]	    = &meson8b_vdec_hevc_sel.hw,
2881 		[CLKID_VDEC_HEVC_DIV]	    = &meson8b_vdec_hevc_div.hw,
2882 		[CLKID_VDEC_HEVC_EN]	    = &meson8b_vdec_hevc_en.hw,
2883 		[CLKID_VDEC_HEVC]	    = &meson8b_vdec_hevc.hw,
2884 		[CLKID_CTS_AMCLK_SEL]	    = &meson8b_cts_amclk_sel.hw,
2885 		[CLKID_CTS_AMCLK_DIV]	    = &meson8b_cts_amclk_div.hw,
2886 		[CLKID_CTS_AMCLK]	    = &meson8b_cts_amclk.hw,
2887 		[CLKID_CTS_MCLK_I958_SEL]   = &meson8b_cts_mclk_i958_sel.hw,
2888 		[CLKID_CTS_MCLK_I958_DIV]   = &meson8b_cts_mclk_i958_div.hw,
2889 		[CLKID_CTS_MCLK_I958]	    = &meson8b_cts_mclk_i958.hw,
2890 		[CLKID_CTS_I958]	    = &meson8b_cts_i958.hw,
2891 		[CLK_NR_CLKS]		    = NULL,
2892 	},
2893 	.num = CLK_NR_CLKS,
2894 };
2895 
2896 static struct clk_hw_onecell_data meson8b_hw_onecell_data = {
2897 	.hws = {
2898 		[CLKID_XTAL] = &meson8b_xtal.hw,
2899 		[CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
2900 		[CLKID_PLL_VID] = &meson8b_vid_pll.hw,
2901 		[CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
2902 		[CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
2903 		[CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
2904 		[CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
2905 		[CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
2906 		[CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
2907 		[CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
2908 		[CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
2909 		[CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
2910 		[CLKID_CLK81] = &meson8b_clk81.hw,
2911 		[CLKID_DDR]		    = &meson8b_ddr.hw,
2912 		[CLKID_DOS]		    = &meson8b_dos.hw,
2913 		[CLKID_ISA]		    = &meson8b_isa.hw,
2914 		[CLKID_PL301]		    = &meson8b_pl301.hw,
2915 		[CLKID_PERIPHS]		    = &meson8b_periphs.hw,
2916 		[CLKID_SPICC]		    = &meson8b_spicc.hw,
2917 		[CLKID_I2C]		    = &meson8b_i2c.hw,
2918 		[CLKID_SAR_ADC]		    = &meson8b_sar_adc.hw,
2919 		[CLKID_SMART_CARD]	    = &meson8b_smart_card.hw,
2920 		[CLKID_RNG0]		    = &meson8b_rng0.hw,
2921 		[CLKID_UART0]		    = &meson8b_uart0.hw,
2922 		[CLKID_SDHC]		    = &meson8b_sdhc.hw,
2923 		[CLKID_STREAM]		    = &meson8b_stream.hw,
2924 		[CLKID_ASYNC_FIFO]	    = &meson8b_async_fifo.hw,
2925 		[CLKID_SDIO]		    = &meson8b_sdio.hw,
2926 		[CLKID_ABUF]		    = &meson8b_abuf.hw,
2927 		[CLKID_HIU_IFACE]	    = &meson8b_hiu_iface.hw,
2928 		[CLKID_ASSIST_MISC]	    = &meson8b_assist_misc.hw,
2929 		[CLKID_SPI]		    = &meson8b_spi.hw,
2930 		[CLKID_I2S_SPDIF]	    = &meson8b_i2s_spdif.hw,
2931 		[CLKID_ETH]		    = &meson8b_eth.hw,
2932 		[CLKID_DEMUX]		    = &meson8b_demux.hw,
2933 		[CLKID_AIU_GLUE]	    = &meson8b_aiu_glue.hw,
2934 		[CLKID_IEC958]		    = &meson8b_iec958.hw,
2935 		[CLKID_I2S_OUT]		    = &meson8b_i2s_out.hw,
2936 		[CLKID_AMCLK]		    = &meson8b_amclk.hw,
2937 		[CLKID_AIFIFO2]		    = &meson8b_aififo2.hw,
2938 		[CLKID_MIXER]		    = &meson8b_mixer.hw,
2939 		[CLKID_MIXER_IFACE]	    = &meson8b_mixer_iface.hw,
2940 		[CLKID_ADC]		    = &meson8b_adc.hw,
2941 		[CLKID_BLKMV]		    = &meson8b_blkmv.hw,
2942 		[CLKID_AIU]		    = &meson8b_aiu.hw,
2943 		[CLKID_UART1]		    = &meson8b_uart1.hw,
2944 		[CLKID_G2D]		    = &meson8b_g2d.hw,
2945 		[CLKID_USB0]		    = &meson8b_usb0.hw,
2946 		[CLKID_USB1]		    = &meson8b_usb1.hw,
2947 		[CLKID_RESET]		    = &meson8b_reset.hw,
2948 		[CLKID_NAND]		    = &meson8b_nand.hw,
2949 		[CLKID_DOS_PARSER]	    = &meson8b_dos_parser.hw,
2950 		[CLKID_USB]		    = &meson8b_usb.hw,
2951 		[CLKID_VDIN1]		    = &meson8b_vdin1.hw,
2952 		[CLKID_AHB_ARB0]	    = &meson8b_ahb_arb0.hw,
2953 		[CLKID_EFUSE]		    = &meson8b_efuse.hw,
2954 		[CLKID_BOOT_ROM]	    = &meson8b_boot_rom.hw,
2955 		[CLKID_AHB_DATA_BUS]	    = &meson8b_ahb_data_bus.hw,
2956 		[CLKID_AHB_CTRL_BUS]	    = &meson8b_ahb_ctrl_bus.hw,
2957 		[CLKID_HDMI_INTR_SYNC]	    = &meson8b_hdmi_intr_sync.hw,
2958 		[CLKID_HDMI_PCLK]	    = &meson8b_hdmi_pclk.hw,
2959 		[CLKID_USB1_DDR_BRIDGE]	    = &meson8b_usb1_ddr_bridge.hw,
2960 		[CLKID_USB0_DDR_BRIDGE]	    = &meson8b_usb0_ddr_bridge.hw,
2961 		[CLKID_MMC_PCLK]	    = &meson8b_mmc_pclk.hw,
2962 		[CLKID_DVIN]		    = &meson8b_dvin.hw,
2963 		[CLKID_UART2]		    = &meson8b_uart2.hw,
2964 		[CLKID_SANA]		    = &meson8b_sana.hw,
2965 		[CLKID_VPU_INTR]	    = &meson8b_vpu_intr.hw,
2966 		[CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
2967 		[CLKID_CLK81_A9]	    = &meson8b_clk81_a9.hw,
2968 		[CLKID_VCLK2_VENCI0]	    = &meson8b_vclk2_venci0.hw,
2969 		[CLKID_VCLK2_VENCI1]	    = &meson8b_vclk2_venci1.hw,
2970 		[CLKID_VCLK2_VENCP0]	    = &meson8b_vclk2_vencp0.hw,
2971 		[CLKID_VCLK2_VENCP1]	    = &meson8b_vclk2_vencp1.hw,
2972 		[CLKID_GCLK_VENCI_INT]	    = &meson8b_gclk_venci_int.hw,
2973 		[CLKID_GCLK_VENCP_INT]	    = &meson8b_gclk_vencp_int.hw,
2974 		[CLKID_DAC_CLK]		    = &meson8b_dac_clk.hw,
2975 		[CLKID_AOCLK_GATE]	    = &meson8b_aoclk_gate.hw,
2976 		[CLKID_IEC958_GATE]	    = &meson8b_iec958_gate.hw,
2977 		[CLKID_ENC480P]		    = &meson8b_enc480p.hw,
2978 		[CLKID_RNG1]		    = &meson8b_rng1.hw,
2979 		[CLKID_GCLK_VENCL_INT]	    = &meson8b_gclk_vencl_int.hw,
2980 		[CLKID_VCLK2_VENCLMCC]	    = &meson8b_vclk2_venclmcc.hw,
2981 		[CLKID_VCLK2_VENCL]	    = &meson8b_vclk2_vencl.hw,
2982 		[CLKID_VCLK2_OTHER]	    = &meson8b_vclk2_other.hw,
2983 		[CLKID_EDP]		    = &meson8b_edp.hw,
2984 		[CLKID_AO_MEDIA_CPU]	    = &meson8b_ao_media_cpu.hw,
2985 		[CLKID_AO_AHB_SRAM]	    = &meson8b_ao_ahb_sram.hw,
2986 		[CLKID_AO_AHB_BUS]	    = &meson8b_ao_ahb_bus.hw,
2987 		[CLKID_AO_IFACE]	    = &meson8b_ao_iface.hw,
2988 		[CLKID_MPLL0]		    = &meson8b_mpll0.hw,
2989 		[CLKID_MPLL1]		    = &meson8b_mpll1.hw,
2990 		[CLKID_MPLL2]		    = &meson8b_mpll2.hw,
2991 		[CLKID_MPLL0_DIV]	    = &meson8b_mpll0_div.hw,
2992 		[CLKID_MPLL1_DIV]	    = &meson8b_mpll1_div.hw,
2993 		[CLKID_MPLL2_DIV]	    = &meson8b_mpll2_div.hw,
2994 		[CLKID_CPU_IN_SEL]	    = &meson8b_cpu_in_sel.hw,
2995 		[CLKID_CPU_IN_DIV2]	    = &meson8b_cpu_in_div2.hw,
2996 		[CLKID_CPU_IN_DIV3]	    = &meson8b_cpu_in_div3.hw,
2997 		[CLKID_CPU_SCALE_DIV]	    = &meson8b_cpu_scale_div.hw,
2998 		[CLKID_CPU_SCALE_OUT_SEL]   = &meson8b_cpu_scale_out_sel.hw,
2999 		[CLKID_MPLL_PREDIV]	    = &meson8b_mpll_prediv.hw,
3000 		[CLKID_FCLK_DIV2_DIV]	    = &meson8b_fclk_div2_div.hw,
3001 		[CLKID_FCLK_DIV3_DIV]	    = &meson8b_fclk_div3_div.hw,
3002 		[CLKID_FCLK_DIV4_DIV]	    = &meson8b_fclk_div4_div.hw,
3003 		[CLKID_FCLK_DIV5_DIV]	    = &meson8b_fclk_div5_div.hw,
3004 		[CLKID_FCLK_DIV7_DIV]	    = &meson8b_fclk_div7_div.hw,
3005 		[CLKID_NAND_SEL]	    = &meson8b_nand_clk_sel.hw,
3006 		[CLKID_NAND_DIV]	    = &meson8b_nand_clk_div.hw,
3007 		[CLKID_NAND_CLK]	    = &meson8b_nand_clk_gate.hw,
3008 		[CLKID_PLL_FIXED_DCO]	    = &meson8b_fixed_pll_dco.hw,
3009 		[CLKID_HDMI_PLL_DCO]	    = &meson8b_hdmi_pll_dco.hw,
3010 		[CLKID_PLL_SYS_DCO]	    = &meson8b_sys_pll_dco.hw,
3011 		[CLKID_CPU_CLK_DIV2]	    = &meson8b_cpu_clk_div2.hw,
3012 		[CLKID_CPU_CLK_DIV3]	    = &meson8b_cpu_clk_div3.hw,
3013 		[CLKID_CPU_CLK_DIV4]	    = &meson8b_cpu_clk_div4.hw,
3014 		[CLKID_CPU_CLK_DIV5]	    = &meson8b_cpu_clk_div5.hw,
3015 		[CLKID_CPU_CLK_DIV6]	    = &meson8b_cpu_clk_div6.hw,
3016 		[CLKID_CPU_CLK_DIV7]	    = &meson8b_cpu_clk_div7.hw,
3017 		[CLKID_CPU_CLK_DIV8]	    = &meson8b_cpu_clk_div8.hw,
3018 		[CLKID_APB_SEL]		    = &meson8b_apb_clk_sel.hw,
3019 		[CLKID_APB]		    = &meson8b_apb_clk_gate.hw,
3020 		[CLKID_PERIPH_SEL]	    = &meson8b_periph_clk_sel.hw,
3021 		[CLKID_PERIPH]		    = &meson8b_periph_clk_gate.hw,
3022 		[CLKID_AXI_SEL]		    = &meson8b_axi_clk_sel.hw,
3023 		[CLKID_AXI]		    = &meson8b_axi_clk_gate.hw,
3024 		[CLKID_L2_DRAM_SEL]	    = &meson8b_l2_dram_clk_sel.hw,
3025 		[CLKID_L2_DRAM]		    = &meson8b_l2_dram_clk_gate.hw,
3026 		[CLKID_HDMI_PLL_LVDS_OUT]   = &meson8b_hdmi_pll_lvds_out.hw,
3027 		[CLKID_HDMI_PLL_HDMI_OUT]   = &meson8b_hdmi_pll_hdmi_out.hw,
3028 		[CLKID_VID_PLL_IN_SEL]	    = &meson8b_vid_pll_in_sel.hw,
3029 		[CLKID_VID_PLL_IN_EN]	    = &meson8b_vid_pll_in_en.hw,
3030 		[CLKID_VID_PLL_PRE_DIV]	    = &meson8b_vid_pll_pre_div.hw,
3031 		[CLKID_VID_PLL_POST_DIV]    = &meson8b_vid_pll_post_div.hw,
3032 		[CLKID_VID_PLL_FINAL_DIV]   = &meson8b_vid_pll_final_div.hw,
3033 		[CLKID_VCLK_IN_SEL]	    = &meson8b_vclk_in_sel.hw,
3034 		[CLKID_VCLK_IN_EN]	    = &meson8b_vclk_in_en.hw,
3035 		[CLKID_VCLK_DIV1]	    = &meson8b_vclk_div1_gate.hw,
3036 		[CLKID_VCLK_DIV2_DIV]	    = &meson8b_vclk_div2_div.hw,
3037 		[CLKID_VCLK_DIV2]	    = &meson8b_vclk_div2_div_gate.hw,
3038 		[CLKID_VCLK_DIV4_DIV]	    = &meson8b_vclk_div4_div.hw,
3039 		[CLKID_VCLK_DIV4]	    = &meson8b_vclk_div4_div_gate.hw,
3040 		[CLKID_VCLK_DIV6_DIV]	    = &meson8b_vclk_div6_div.hw,
3041 		[CLKID_VCLK_DIV6]	    = &meson8b_vclk_div6_div_gate.hw,
3042 		[CLKID_VCLK_DIV12_DIV]	    = &meson8b_vclk_div12_div.hw,
3043 		[CLKID_VCLK_DIV12]	    = &meson8b_vclk_div12_div_gate.hw,
3044 		[CLKID_VCLK2_IN_SEL]	    = &meson8b_vclk2_in_sel.hw,
3045 		[CLKID_VCLK2_IN_EN]	    = &meson8b_vclk2_clk_in_en.hw,
3046 		[CLKID_VCLK2_DIV1]	    = &meson8b_vclk2_div1_gate.hw,
3047 		[CLKID_VCLK2_DIV2_DIV]	    = &meson8b_vclk2_div2_div.hw,
3048 		[CLKID_VCLK2_DIV2]	    = &meson8b_vclk2_div2_div_gate.hw,
3049 		[CLKID_VCLK2_DIV4_DIV]	    = &meson8b_vclk2_div4_div.hw,
3050 		[CLKID_VCLK2_DIV4]	    = &meson8b_vclk2_div4_div_gate.hw,
3051 		[CLKID_VCLK2_DIV6_DIV]	    = &meson8b_vclk2_div6_div.hw,
3052 		[CLKID_VCLK2_DIV6]	    = &meson8b_vclk2_div6_div_gate.hw,
3053 		[CLKID_VCLK2_DIV12_DIV]	    = &meson8b_vclk2_div12_div.hw,
3054 		[CLKID_VCLK2_DIV12]	    = &meson8b_vclk2_div12_div_gate.hw,
3055 		[CLKID_CTS_ENCT_SEL]	    = &meson8b_cts_enct_sel.hw,
3056 		[CLKID_CTS_ENCT]	    = &meson8b_cts_enct.hw,
3057 		[CLKID_CTS_ENCP_SEL]	    = &meson8b_cts_encp_sel.hw,
3058 		[CLKID_CTS_ENCP]	    = &meson8b_cts_encp.hw,
3059 		[CLKID_CTS_ENCI_SEL]	    = &meson8b_cts_enci_sel.hw,
3060 		[CLKID_CTS_ENCI]	    = &meson8b_cts_enci.hw,
3061 		[CLKID_HDMI_TX_PIXEL_SEL]   = &meson8b_hdmi_tx_pixel_sel.hw,
3062 		[CLKID_HDMI_TX_PIXEL]	    = &meson8b_hdmi_tx_pixel.hw,
3063 		[CLKID_CTS_ENCL_SEL]	    = &meson8b_cts_encl_sel.hw,
3064 		[CLKID_CTS_ENCL]	    = &meson8b_cts_encl.hw,
3065 		[CLKID_CTS_VDAC0_SEL]	    = &meson8b_cts_vdac0_sel.hw,
3066 		[CLKID_CTS_VDAC0]	    = &meson8b_cts_vdac0.hw,
3067 		[CLKID_HDMI_SYS_SEL]	    = &meson8b_hdmi_sys_sel.hw,
3068 		[CLKID_HDMI_SYS_DIV]	    = &meson8b_hdmi_sys_div.hw,
3069 		[CLKID_HDMI_SYS]	    = &meson8b_hdmi_sys.hw,
3070 		[CLKID_MALI_0_SEL]	    = &meson8b_mali_0_sel.hw,
3071 		[CLKID_MALI_0_DIV]	    = &meson8b_mali_0_div.hw,
3072 		[CLKID_MALI_0]		    = &meson8b_mali_0.hw,
3073 		[CLKID_MALI_1_SEL]	    = &meson8b_mali_1_sel.hw,
3074 		[CLKID_MALI_1_DIV]	    = &meson8b_mali_1_div.hw,
3075 		[CLKID_MALI_1]		    = &meson8b_mali_1.hw,
3076 		[CLKID_MALI]		    = &meson8b_mali.hw,
3077 		[CLKID_VPU_0_SEL]	    = &meson8b_vpu_0_sel.hw,
3078 		[CLKID_VPU_0_DIV]	    = &meson8b_vpu_0_div.hw,
3079 		[CLKID_VPU_0]		    = &meson8b_vpu_0.hw,
3080 		[CLKID_VPU_1_SEL]	    = &meson8b_vpu_1_sel.hw,
3081 		[CLKID_VPU_1_DIV]	    = &meson8b_vpu_1_div.hw,
3082 		[CLKID_VPU_1]		    = &meson8b_vpu_1.hw,
3083 		[CLKID_VPU]		    = &meson8b_vpu.hw,
3084 		[CLKID_VDEC_1_SEL]	    = &meson8b_vdec_1_sel.hw,
3085 		[CLKID_VDEC_1_1_DIV]	    = &meson8b_vdec_1_1_div.hw,
3086 		[CLKID_VDEC_1_1]	    = &meson8b_vdec_1_1.hw,
3087 		[CLKID_VDEC_1_2_DIV]	    = &meson8b_vdec_1_2_div.hw,
3088 		[CLKID_VDEC_1_2]	    = &meson8b_vdec_1_2.hw,
3089 		[CLKID_VDEC_1]	    	    = &meson8b_vdec_1.hw,
3090 		[CLKID_VDEC_HCODEC_SEL]	    = &meson8b_vdec_hcodec_sel.hw,
3091 		[CLKID_VDEC_HCODEC_DIV]	    = &meson8b_vdec_hcodec_div.hw,
3092 		[CLKID_VDEC_HCODEC]	    = &meson8b_vdec_hcodec.hw,
3093 		[CLKID_VDEC_2_SEL]	    = &meson8b_vdec_2_sel.hw,
3094 		[CLKID_VDEC_2_DIV]	    = &meson8b_vdec_2_div.hw,
3095 		[CLKID_VDEC_2]	    	    = &meson8b_vdec_2.hw,
3096 		[CLKID_VDEC_HEVC_SEL]	    = &meson8b_vdec_hevc_sel.hw,
3097 		[CLKID_VDEC_HEVC_DIV]	    = &meson8b_vdec_hevc_div.hw,
3098 		[CLKID_VDEC_HEVC_EN]	    = &meson8b_vdec_hevc_en.hw,
3099 		[CLKID_VDEC_HEVC]	    = &meson8b_vdec_hevc.hw,
3100 		[CLKID_CTS_AMCLK_SEL]	    = &meson8b_cts_amclk_sel.hw,
3101 		[CLKID_CTS_AMCLK_DIV]	    = &meson8b_cts_amclk_div.hw,
3102 		[CLKID_CTS_AMCLK]	    = &meson8b_cts_amclk.hw,
3103 		[CLKID_CTS_MCLK_I958_SEL]   = &meson8b_cts_mclk_i958_sel.hw,
3104 		[CLKID_CTS_MCLK_I958_DIV]   = &meson8b_cts_mclk_i958_div.hw,
3105 		[CLKID_CTS_MCLK_I958]	    = &meson8b_cts_mclk_i958.hw,
3106 		[CLKID_CTS_I958]	    = &meson8b_cts_i958.hw,
3107 		[CLK_NR_CLKS]		    = NULL,
3108 	},
3109 	.num = CLK_NR_CLKS,
3110 };
3111 
3112 static struct clk_hw_onecell_data meson8m2_hw_onecell_data = {
3113 	.hws = {
3114 		[CLKID_XTAL] = &meson8b_xtal.hw,
3115 		[CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
3116 		[CLKID_PLL_VID] = &meson8b_vid_pll.hw,
3117 		[CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
3118 		[CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
3119 		[CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
3120 		[CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
3121 		[CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
3122 		[CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
3123 		[CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
3124 		[CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
3125 		[CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
3126 		[CLKID_CLK81] = &meson8b_clk81.hw,
3127 		[CLKID_DDR]		    = &meson8b_ddr.hw,
3128 		[CLKID_DOS]		    = &meson8b_dos.hw,
3129 		[CLKID_ISA]		    = &meson8b_isa.hw,
3130 		[CLKID_PL301]		    = &meson8b_pl301.hw,
3131 		[CLKID_PERIPHS]		    = &meson8b_periphs.hw,
3132 		[CLKID_SPICC]		    = &meson8b_spicc.hw,
3133 		[CLKID_I2C]		    = &meson8b_i2c.hw,
3134 		[CLKID_SAR_ADC]		    = &meson8b_sar_adc.hw,
3135 		[CLKID_SMART_CARD]	    = &meson8b_smart_card.hw,
3136 		[CLKID_RNG0]		    = &meson8b_rng0.hw,
3137 		[CLKID_UART0]		    = &meson8b_uart0.hw,
3138 		[CLKID_SDHC]		    = &meson8b_sdhc.hw,
3139 		[CLKID_STREAM]		    = &meson8b_stream.hw,
3140 		[CLKID_ASYNC_FIFO]	    = &meson8b_async_fifo.hw,
3141 		[CLKID_SDIO]		    = &meson8b_sdio.hw,
3142 		[CLKID_ABUF]		    = &meson8b_abuf.hw,
3143 		[CLKID_HIU_IFACE]	    = &meson8b_hiu_iface.hw,
3144 		[CLKID_ASSIST_MISC]	    = &meson8b_assist_misc.hw,
3145 		[CLKID_SPI]		    = &meson8b_spi.hw,
3146 		[CLKID_I2S_SPDIF]	    = &meson8b_i2s_spdif.hw,
3147 		[CLKID_ETH]		    = &meson8b_eth.hw,
3148 		[CLKID_DEMUX]		    = &meson8b_demux.hw,
3149 		[CLKID_AIU_GLUE]	    = &meson8b_aiu_glue.hw,
3150 		[CLKID_IEC958]		    = &meson8b_iec958.hw,
3151 		[CLKID_I2S_OUT]		    = &meson8b_i2s_out.hw,
3152 		[CLKID_AMCLK]		    = &meson8b_amclk.hw,
3153 		[CLKID_AIFIFO2]		    = &meson8b_aififo2.hw,
3154 		[CLKID_MIXER]		    = &meson8b_mixer.hw,
3155 		[CLKID_MIXER_IFACE]	    = &meson8b_mixer_iface.hw,
3156 		[CLKID_ADC]		    = &meson8b_adc.hw,
3157 		[CLKID_BLKMV]		    = &meson8b_blkmv.hw,
3158 		[CLKID_AIU]		    = &meson8b_aiu.hw,
3159 		[CLKID_UART1]		    = &meson8b_uart1.hw,
3160 		[CLKID_G2D]		    = &meson8b_g2d.hw,
3161 		[CLKID_USB0]		    = &meson8b_usb0.hw,
3162 		[CLKID_USB1]		    = &meson8b_usb1.hw,
3163 		[CLKID_RESET]		    = &meson8b_reset.hw,
3164 		[CLKID_NAND]		    = &meson8b_nand.hw,
3165 		[CLKID_DOS_PARSER]	    = &meson8b_dos_parser.hw,
3166 		[CLKID_USB]		    = &meson8b_usb.hw,
3167 		[CLKID_VDIN1]		    = &meson8b_vdin1.hw,
3168 		[CLKID_AHB_ARB0]	    = &meson8b_ahb_arb0.hw,
3169 		[CLKID_EFUSE]		    = &meson8b_efuse.hw,
3170 		[CLKID_BOOT_ROM]	    = &meson8b_boot_rom.hw,
3171 		[CLKID_AHB_DATA_BUS]	    = &meson8b_ahb_data_bus.hw,
3172 		[CLKID_AHB_CTRL_BUS]	    = &meson8b_ahb_ctrl_bus.hw,
3173 		[CLKID_HDMI_INTR_SYNC]	    = &meson8b_hdmi_intr_sync.hw,
3174 		[CLKID_HDMI_PCLK]	    = &meson8b_hdmi_pclk.hw,
3175 		[CLKID_USB1_DDR_BRIDGE]	    = &meson8b_usb1_ddr_bridge.hw,
3176 		[CLKID_USB0_DDR_BRIDGE]	    = &meson8b_usb0_ddr_bridge.hw,
3177 		[CLKID_MMC_PCLK]	    = &meson8b_mmc_pclk.hw,
3178 		[CLKID_DVIN]		    = &meson8b_dvin.hw,
3179 		[CLKID_UART2]		    = &meson8b_uart2.hw,
3180 		[CLKID_SANA]		    = &meson8b_sana.hw,
3181 		[CLKID_VPU_INTR]	    = &meson8b_vpu_intr.hw,
3182 		[CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
3183 		[CLKID_CLK81_A9]	    = &meson8b_clk81_a9.hw,
3184 		[CLKID_VCLK2_VENCI0]	    = &meson8b_vclk2_venci0.hw,
3185 		[CLKID_VCLK2_VENCI1]	    = &meson8b_vclk2_venci1.hw,
3186 		[CLKID_VCLK2_VENCP0]	    = &meson8b_vclk2_vencp0.hw,
3187 		[CLKID_VCLK2_VENCP1]	    = &meson8b_vclk2_vencp1.hw,
3188 		[CLKID_GCLK_VENCI_INT]	    = &meson8b_gclk_venci_int.hw,
3189 		[CLKID_GCLK_VENCP_INT]	    = &meson8b_gclk_vencp_int.hw,
3190 		[CLKID_DAC_CLK]		    = &meson8b_dac_clk.hw,
3191 		[CLKID_AOCLK_GATE]	    = &meson8b_aoclk_gate.hw,
3192 		[CLKID_IEC958_GATE]	    = &meson8b_iec958_gate.hw,
3193 		[CLKID_ENC480P]		    = &meson8b_enc480p.hw,
3194 		[CLKID_RNG1]		    = &meson8b_rng1.hw,
3195 		[CLKID_GCLK_VENCL_INT]	    = &meson8b_gclk_vencl_int.hw,
3196 		[CLKID_VCLK2_VENCLMCC]	    = &meson8b_vclk2_venclmcc.hw,
3197 		[CLKID_VCLK2_VENCL]	    = &meson8b_vclk2_vencl.hw,
3198 		[CLKID_VCLK2_OTHER]	    = &meson8b_vclk2_other.hw,
3199 		[CLKID_EDP]		    = &meson8b_edp.hw,
3200 		[CLKID_AO_MEDIA_CPU]	    = &meson8b_ao_media_cpu.hw,
3201 		[CLKID_AO_AHB_SRAM]	    = &meson8b_ao_ahb_sram.hw,
3202 		[CLKID_AO_AHB_BUS]	    = &meson8b_ao_ahb_bus.hw,
3203 		[CLKID_AO_IFACE]	    = &meson8b_ao_iface.hw,
3204 		[CLKID_MPLL0]		    = &meson8b_mpll0.hw,
3205 		[CLKID_MPLL1]		    = &meson8b_mpll1.hw,
3206 		[CLKID_MPLL2]		    = &meson8b_mpll2.hw,
3207 		[CLKID_MPLL0_DIV]	    = &meson8b_mpll0_div.hw,
3208 		[CLKID_MPLL1_DIV]	    = &meson8b_mpll1_div.hw,
3209 		[CLKID_MPLL2_DIV]	    = &meson8b_mpll2_div.hw,
3210 		[CLKID_CPU_IN_SEL]	    = &meson8b_cpu_in_sel.hw,
3211 		[CLKID_CPU_IN_DIV2]	    = &meson8b_cpu_in_div2.hw,
3212 		[CLKID_CPU_IN_DIV3]	    = &meson8b_cpu_in_div3.hw,
3213 		[CLKID_CPU_SCALE_DIV]	    = &meson8b_cpu_scale_div.hw,
3214 		[CLKID_CPU_SCALE_OUT_SEL]   = &meson8b_cpu_scale_out_sel.hw,
3215 		[CLKID_MPLL_PREDIV]	    = &meson8b_mpll_prediv.hw,
3216 		[CLKID_FCLK_DIV2_DIV]	    = &meson8b_fclk_div2_div.hw,
3217 		[CLKID_FCLK_DIV3_DIV]	    = &meson8b_fclk_div3_div.hw,
3218 		[CLKID_FCLK_DIV4_DIV]	    = &meson8b_fclk_div4_div.hw,
3219 		[CLKID_FCLK_DIV5_DIV]	    = &meson8b_fclk_div5_div.hw,
3220 		[CLKID_FCLK_DIV7_DIV]	    = &meson8b_fclk_div7_div.hw,
3221 		[CLKID_NAND_SEL]	    = &meson8b_nand_clk_sel.hw,
3222 		[CLKID_NAND_DIV]	    = &meson8b_nand_clk_div.hw,
3223 		[CLKID_NAND_CLK]	    = &meson8b_nand_clk_gate.hw,
3224 		[CLKID_PLL_FIXED_DCO]	    = &meson8b_fixed_pll_dco.hw,
3225 		[CLKID_HDMI_PLL_DCO]	    = &meson8b_hdmi_pll_dco.hw,
3226 		[CLKID_PLL_SYS_DCO]	    = &meson8b_sys_pll_dco.hw,
3227 		[CLKID_CPU_CLK_DIV2]	    = &meson8b_cpu_clk_div2.hw,
3228 		[CLKID_CPU_CLK_DIV3]	    = &meson8b_cpu_clk_div3.hw,
3229 		[CLKID_CPU_CLK_DIV4]	    = &meson8b_cpu_clk_div4.hw,
3230 		[CLKID_CPU_CLK_DIV5]	    = &meson8b_cpu_clk_div5.hw,
3231 		[CLKID_CPU_CLK_DIV6]	    = &meson8b_cpu_clk_div6.hw,
3232 		[CLKID_CPU_CLK_DIV7]	    = &meson8b_cpu_clk_div7.hw,
3233 		[CLKID_CPU_CLK_DIV8]	    = &meson8b_cpu_clk_div8.hw,
3234 		[CLKID_APB_SEL]		    = &meson8b_apb_clk_sel.hw,
3235 		[CLKID_APB]		    = &meson8b_apb_clk_gate.hw,
3236 		[CLKID_PERIPH_SEL]	    = &meson8b_periph_clk_sel.hw,
3237 		[CLKID_PERIPH]		    = &meson8b_periph_clk_gate.hw,
3238 		[CLKID_AXI_SEL]		    = &meson8b_axi_clk_sel.hw,
3239 		[CLKID_AXI]		    = &meson8b_axi_clk_gate.hw,
3240 		[CLKID_L2_DRAM_SEL]	    = &meson8b_l2_dram_clk_sel.hw,
3241 		[CLKID_L2_DRAM]		    = &meson8b_l2_dram_clk_gate.hw,
3242 		[CLKID_HDMI_PLL_LVDS_OUT]   = &meson8b_hdmi_pll_lvds_out.hw,
3243 		[CLKID_HDMI_PLL_HDMI_OUT]   = &meson8b_hdmi_pll_hdmi_out.hw,
3244 		[CLKID_VID_PLL_IN_SEL]	    = &meson8b_vid_pll_in_sel.hw,
3245 		[CLKID_VID_PLL_IN_EN]	    = &meson8b_vid_pll_in_en.hw,
3246 		[CLKID_VID_PLL_PRE_DIV]	    = &meson8b_vid_pll_pre_div.hw,
3247 		[CLKID_VID_PLL_POST_DIV]    = &meson8b_vid_pll_post_div.hw,
3248 		[CLKID_VID_PLL_FINAL_DIV]   = &meson8b_vid_pll_final_div.hw,
3249 		[CLKID_VCLK_IN_SEL]	    = &meson8b_vclk_in_sel.hw,
3250 		[CLKID_VCLK_IN_EN]	    = &meson8b_vclk_in_en.hw,
3251 		[CLKID_VCLK_DIV1]	    = &meson8b_vclk_div1_gate.hw,
3252 		[CLKID_VCLK_DIV2_DIV]	    = &meson8b_vclk_div2_div.hw,
3253 		[CLKID_VCLK_DIV2]	    = &meson8b_vclk_div2_div_gate.hw,
3254 		[CLKID_VCLK_DIV4_DIV]	    = &meson8b_vclk_div4_div.hw,
3255 		[CLKID_VCLK_DIV4]	    = &meson8b_vclk_div4_div_gate.hw,
3256 		[CLKID_VCLK_DIV6_DIV]	    = &meson8b_vclk_div6_div.hw,
3257 		[CLKID_VCLK_DIV6]	    = &meson8b_vclk_div6_div_gate.hw,
3258 		[CLKID_VCLK_DIV12_DIV]	    = &meson8b_vclk_div12_div.hw,
3259 		[CLKID_VCLK_DIV12]	    = &meson8b_vclk_div12_div_gate.hw,
3260 		[CLKID_VCLK2_IN_SEL]	    = &meson8b_vclk2_in_sel.hw,
3261 		[CLKID_VCLK2_IN_EN]	    = &meson8b_vclk2_clk_in_en.hw,
3262 		[CLKID_VCLK2_DIV1]	    = &meson8b_vclk2_div1_gate.hw,
3263 		[CLKID_VCLK2_DIV2_DIV]	    = &meson8b_vclk2_div2_div.hw,
3264 		[CLKID_VCLK2_DIV2]	    = &meson8b_vclk2_div2_div_gate.hw,
3265 		[CLKID_VCLK2_DIV4_DIV]	    = &meson8b_vclk2_div4_div.hw,
3266 		[CLKID_VCLK2_DIV4]	    = &meson8b_vclk2_div4_div_gate.hw,
3267 		[CLKID_VCLK2_DIV6_DIV]	    = &meson8b_vclk2_div6_div.hw,
3268 		[CLKID_VCLK2_DIV6]	    = &meson8b_vclk2_div6_div_gate.hw,
3269 		[CLKID_VCLK2_DIV12_DIV]	    = &meson8b_vclk2_div12_div.hw,
3270 		[CLKID_VCLK2_DIV12]	    = &meson8b_vclk2_div12_div_gate.hw,
3271 		[CLKID_CTS_ENCT_SEL]	    = &meson8b_cts_enct_sel.hw,
3272 		[CLKID_CTS_ENCT]	    = &meson8b_cts_enct.hw,
3273 		[CLKID_CTS_ENCP_SEL]	    = &meson8b_cts_encp_sel.hw,
3274 		[CLKID_CTS_ENCP]	    = &meson8b_cts_encp.hw,
3275 		[CLKID_CTS_ENCI_SEL]	    = &meson8b_cts_enci_sel.hw,
3276 		[CLKID_CTS_ENCI]	    = &meson8b_cts_enci.hw,
3277 		[CLKID_HDMI_TX_PIXEL_SEL]   = &meson8b_hdmi_tx_pixel_sel.hw,
3278 		[CLKID_HDMI_TX_PIXEL]	    = &meson8b_hdmi_tx_pixel.hw,
3279 		[CLKID_CTS_ENCL_SEL]	    = &meson8b_cts_encl_sel.hw,
3280 		[CLKID_CTS_ENCL]	    = &meson8b_cts_encl.hw,
3281 		[CLKID_CTS_VDAC0_SEL]	    = &meson8b_cts_vdac0_sel.hw,
3282 		[CLKID_CTS_VDAC0]	    = &meson8b_cts_vdac0.hw,
3283 		[CLKID_HDMI_SYS_SEL]	    = &meson8b_hdmi_sys_sel.hw,
3284 		[CLKID_HDMI_SYS_DIV]	    = &meson8b_hdmi_sys_div.hw,
3285 		[CLKID_HDMI_SYS]	    = &meson8b_hdmi_sys.hw,
3286 		[CLKID_MALI_0_SEL]	    = &meson8b_mali_0_sel.hw,
3287 		[CLKID_MALI_0_DIV]	    = &meson8b_mali_0_div.hw,
3288 		[CLKID_MALI_0]		    = &meson8b_mali_0.hw,
3289 		[CLKID_MALI_1_SEL]	    = &meson8b_mali_1_sel.hw,
3290 		[CLKID_MALI_1_DIV]	    = &meson8b_mali_1_div.hw,
3291 		[CLKID_MALI_1]		    = &meson8b_mali_1.hw,
3292 		[CLKID_MALI]		    = &meson8b_mali.hw,
3293 		[CLKID_GP_PLL_DCO]	    = &meson8m2_gp_pll_dco.hw,
3294 		[CLKID_GP_PLL]		    = &meson8m2_gp_pll.hw,
3295 		[CLKID_VPU_0_SEL]	    = &meson8m2_vpu_0_sel.hw,
3296 		[CLKID_VPU_0_DIV]	    = &meson8b_vpu_0_div.hw,
3297 		[CLKID_VPU_0]		    = &meson8b_vpu_0.hw,
3298 		[CLKID_VPU_1_SEL]	    = &meson8m2_vpu_1_sel.hw,
3299 		[CLKID_VPU_1_DIV]	    = &meson8b_vpu_1_div.hw,
3300 		[CLKID_VPU_1]		    = &meson8b_vpu_1.hw,
3301 		[CLKID_VPU]		    = &meson8b_vpu.hw,
3302 		[CLKID_VDEC_1_SEL]	    = &meson8b_vdec_1_sel.hw,
3303 		[CLKID_VDEC_1_1_DIV]	    = &meson8b_vdec_1_1_div.hw,
3304 		[CLKID_VDEC_1_1]	    = &meson8b_vdec_1_1.hw,
3305 		[CLKID_VDEC_1_2_DIV]	    = &meson8b_vdec_1_2_div.hw,
3306 		[CLKID_VDEC_1_2]	    = &meson8b_vdec_1_2.hw,
3307 		[CLKID_VDEC_1]	    	    = &meson8b_vdec_1.hw,
3308 		[CLKID_VDEC_HCODEC_SEL]	    = &meson8b_vdec_hcodec_sel.hw,
3309 		[CLKID_VDEC_HCODEC_DIV]	    = &meson8b_vdec_hcodec_div.hw,
3310 		[CLKID_VDEC_HCODEC]	    = &meson8b_vdec_hcodec.hw,
3311 		[CLKID_VDEC_2_SEL]	    = &meson8b_vdec_2_sel.hw,
3312 		[CLKID_VDEC_2_DIV]	    = &meson8b_vdec_2_div.hw,
3313 		[CLKID_VDEC_2]	    	    = &meson8b_vdec_2.hw,
3314 		[CLKID_VDEC_HEVC_SEL]	    = &meson8b_vdec_hevc_sel.hw,
3315 		[CLKID_VDEC_HEVC_DIV]	    = &meson8b_vdec_hevc_div.hw,
3316 		[CLKID_VDEC_HEVC_EN]	    = &meson8b_vdec_hevc_en.hw,
3317 		[CLKID_VDEC_HEVC]	    = &meson8b_vdec_hevc.hw,
3318 		[CLKID_CTS_AMCLK_SEL]	    = &meson8b_cts_amclk_sel.hw,
3319 		[CLKID_CTS_AMCLK_DIV]	    = &meson8b_cts_amclk_div.hw,
3320 		[CLKID_CTS_AMCLK]	    = &meson8b_cts_amclk.hw,
3321 		[CLKID_CTS_MCLK_I958_SEL]   = &meson8b_cts_mclk_i958_sel.hw,
3322 		[CLKID_CTS_MCLK_I958_DIV]   = &meson8b_cts_mclk_i958_div.hw,
3323 		[CLKID_CTS_MCLK_I958]	    = &meson8b_cts_mclk_i958.hw,
3324 		[CLKID_CTS_I958]	    = &meson8b_cts_i958.hw,
3325 		[CLK_NR_CLKS]		    = NULL,
3326 	},
3327 	.num = CLK_NR_CLKS,
3328 };
3329 
3330 static struct clk_regmap *const meson8b_clk_regmaps[] = {
3331 	&meson8b_clk81,
3332 	&meson8b_ddr,
3333 	&meson8b_dos,
3334 	&meson8b_isa,
3335 	&meson8b_pl301,
3336 	&meson8b_periphs,
3337 	&meson8b_spicc,
3338 	&meson8b_i2c,
3339 	&meson8b_sar_adc,
3340 	&meson8b_smart_card,
3341 	&meson8b_rng0,
3342 	&meson8b_uart0,
3343 	&meson8b_sdhc,
3344 	&meson8b_stream,
3345 	&meson8b_async_fifo,
3346 	&meson8b_sdio,
3347 	&meson8b_abuf,
3348 	&meson8b_hiu_iface,
3349 	&meson8b_assist_misc,
3350 	&meson8b_spi,
3351 	&meson8b_i2s_spdif,
3352 	&meson8b_eth,
3353 	&meson8b_demux,
3354 	&meson8b_aiu_glue,
3355 	&meson8b_iec958,
3356 	&meson8b_i2s_out,
3357 	&meson8b_amclk,
3358 	&meson8b_aififo2,
3359 	&meson8b_mixer,
3360 	&meson8b_mixer_iface,
3361 	&meson8b_adc,
3362 	&meson8b_blkmv,
3363 	&meson8b_aiu,
3364 	&meson8b_uart1,
3365 	&meson8b_g2d,
3366 	&meson8b_usb0,
3367 	&meson8b_usb1,
3368 	&meson8b_reset,
3369 	&meson8b_nand,
3370 	&meson8b_dos_parser,
3371 	&meson8b_usb,
3372 	&meson8b_vdin1,
3373 	&meson8b_ahb_arb0,
3374 	&meson8b_efuse,
3375 	&meson8b_boot_rom,
3376 	&meson8b_ahb_data_bus,
3377 	&meson8b_ahb_ctrl_bus,
3378 	&meson8b_hdmi_intr_sync,
3379 	&meson8b_hdmi_pclk,
3380 	&meson8b_usb1_ddr_bridge,
3381 	&meson8b_usb0_ddr_bridge,
3382 	&meson8b_mmc_pclk,
3383 	&meson8b_dvin,
3384 	&meson8b_uart2,
3385 	&meson8b_sana,
3386 	&meson8b_vpu_intr,
3387 	&meson8b_sec_ahb_ahb3_bridge,
3388 	&meson8b_clk81_a9,
3389 	&meson8b_vclk2_venci0,
3390 	&meson8b_vclk2_venci1,
3391 	&meson8b_vclk2_vencp0,
3392 	&meson8b_vclk2_vencp1,
3393 	&meson8b_gclk_venci_int,
3394 	&meson8b_gclk_vencp_int,
3395 	&meson8b_dac_clk,
3396 	&meson8b_aoclk_gate,
3397 	&meson8b_iec958_gate,
3398 	&meson8b_enc480p,
3399 	&meson8b_rng1,
3400 	&meson8b_gclk_vencl_int,
3401 	&meson8b_vclk2_venclmcc,
3402 	&meson8b_vclk2_vencl,
3403 	&meson8b_vclk2_other,
3404 	&meson8b_edp,
3405 	&meson8b_ao_media_cpu,
3406 	&meson8b_ao_ahb_sram,
3407 	&meson8b_ao_ahb_bus,
3408 	&meson8b_ao_iface,
3409 	&meson8b_mpeg_clk_div,
3410 	&meson8b_mpeg_clk_sel,
3411 	&meson8b_mpll0,
3412 	&meson8b_mpll1,
3413 	&meson8b_mpll2,
3414 	&meson8b_mpll0_div,
3415 	&meson8b_mpll1_div,
3416 	&meson8b_mpll2_div,
3417 	&meson8b_fixed_pll,
3418 	&meson8b_sys_pll,
3419 	&meson8b_cpu_in_sel,
3420 	&meson8b_cpu_scale_div,
3421 	&meson8b_cpu_scale_out_sel,
3422 	&meson8b_cpu_clk,
3423 	&meson8b_mpll_prediv,
3424 	&meson8b_fclk_div2,
3425 	&meson8b_fclk_div3,
3426 	&meson8b_fclk_div4,
3427 	&meson8b_fclk_div5,
3428 	&meson8b_fclk_div7,
3429 	&meson8b_nand_clk_sel,
3430 	&meson8b_nand_clk_div,
3431 	&meson8b_nand_clk_gate,
3432 	&meson8b_fixed_pll_dco,
3433 	&meson8b_hdmi_pll_dco,
3434 	&meson8b_sys_pll_dco,
3435 	&meson8b_apb_clk_sel,
3436 	&meson8b_apb_clk_gate,
3437 	&meson8b_periph_clk_sel,
3438 	&meson8b_periph_clk_gate,
3439 	&meson8b_axi_clk_sel,
3440 	&meson8b_axi_clk_gate,
3441 	&meson8b_l2_dram_clk_sel,
3442 	&meson8b_l2_dram_clk_gate,
3443 	&meson8b_hdmi_pll_lvds_out,
3444 	&meson8b_hdmi_pll_hdmi_out,
3445 	&meson8b_vid_pll_in_sel,
3446 	&meson8b_vid_pll_in_en,
3447 	&meson8b_vid_pll_pre_div,
3448 	&meson8b_vid_pll_post_div,
3449 	&meson8b_vid_pll,
3450 	&meson8b_vid_pll_final_div,
3451 	&meson8b_vclk_in_sel,
3452 	&meson8b_vclk_in_en,
3453 	&meson8b_vclk_div1_gate,
3454 	&meson8b_vclk_div2_div_gate,
3455 	&meson8b_vclk_div4_div_gate,
3456 	&meson8b_vclk_div6_div_gate,
3457 	&meson8b_vclk_div12_div_gate,
3458 	&meson8b_vclk2_in_sel,
3459 	&meson8b_vclk2_clk_in_en,
3460 	&meson8b_vclk2_div1_gate,
3461 	&meson8b_vclk2_div2_div_gate,
3462 	&meson8b_vclk2_div4_div_gate,
3463 	&meson8b_vclk2_div6_div_gate,
3464 	&meson8b_vclk2_div12_div_gate,
3465 	&meson8b_cts_enct_sel,
3466 	&meson8b_cts_enct,
3467 	&meson8b_cts_encp_sel,
3468 	&meson8b_cts_encp,
3469 	&meson8b_cts_enci_sel,
3470 	&meson8b_cts_enci,
3471 	&meson8b_hdmi_tx_pixel_sel,
3472 	&meson8b_hdmi_tx_pixel,
3473 	&meson8b_cts_encl_sel,
3474 	&meson8b_cts_encl,
3475 	&meson8b_cts_vdac0_sel,
3476 	&meson8b_cts_vdac0,
3477 	&meson8b_hdmi_sys_sel,
3478 	&meson8b_hdmi_sys_div,
3479 	&meson8b_hdmi_sys,
3480 	&meson8b_mali_0_sel,
3481 	&meson8b_mali_0_div,
3482 	&meson8b_mali_0,
3483 	&meson8b_mali_1_sel,
3484 	&meson8b_mali_1_div,
3485 	&meson8b_mali_1,
3486 	&meson8b_mali,
3487 	&meson8m2_gp_pll_dco,
3488 	&meson8m2_gp_pll,
3489 	&meson8b_vpu_0_sel,
3490 	&meson8m2_vpu_0_sel,
3491 	&meson8b_vpu_0_div,
3492 	&meson8b_vpu_0,
3493 	&meson8b_vpu_1_sel,
3494 	&meson8m2_vpu_1_sel,
3495 	&meson8b_vpu_1_div,
3496 	&meson8b_vpu_1,
3497 	&meson8b_vpu,
3498 	&meson8b_vdec_1_sel,
3499 	&meson8b_vdec_1_1_div,
3500 	&meson8b_vdec_1_1,
3501 	&meson8b_vdec_1_2_div,
3502 	&meson8b_vdec_1_2,
3503 	&meson8b_vdec_1,
3504 	&meson8b_vdec_hcodec_sel,
3505 	&meson8b_vdec_hcodec_div,
3506 	&meson8b_vdec_hcodec,
3507 	&meson8b_vdec_2_sel,
3508 	&meson8b_vdec_2_div,
3509 	&meson8b_vdec_2,
3510 	&meson8b_vdec_hevc_sel,
3511 	&meson8b_vdec_hevc_div,
3512 	&meson8b_vdec_hevc_en,
3513 	&meson8b_vdec_hevc,
3514 	&meson8b_cts_amclk,
3515 	&meson8b_cts_amclk_sel,
3516 	&meson8b_cts_amclk_div,
3517 	&meson8b_cts_mclk_i958_sel,
3518 	&meson8b_cts_mclk_i958_div,
3519 	&meson8b_cts_mclk_i958,
3520 	&meson8b_cts_i958,
3521 };
3522 
3523 static const struct meson8b_clk_reset_line {
3524 	u32 reg;
3525 	u8 bit_idx;
3526 	bool active_low;
3527 } meson8b_clk_reset_bits[] = {
3528 	[CLKC_RESET_L2_CACHE_SOFT_RESET] = {
3529 		.reg = HHI_SYS_CPU_CLK_CNTL0,
3530 		.bit_idx = 30,
3531 		.active_low = false,
3532 	},
3533 	[CLKC_RESET_AXI_64_TO_128_BRIDGE_A5_SOFT_RESET] = {
3534 		.reg = HHI_SYS_CPU_CLK_CNTL0,
3535 		.bit_idx = 29,
3536 		.active_low = false,
3537 	},
3538 	[CLKC_RESET_SCU_SOFT_RESET] = {
3539 		.reg = HHI_SYS_CPU_CLK_CNTL0,
3540 		.bit_idx = 28,
3541 		.active_low = false,
3542 	},
3543 	[CLKC_RESET_CPU3_SOFT_RESET] = {
3544 		.reg = HHI_SYS_CPU_CLK_CNTL0,
3545 		.bit_idx = 27,
3546 		.active_low = false,
3547 	},
3548 	[CLKC_RESET_CPU2_SOFT_RESET] = {
3549 		.reg = HHI_SYS_CPU_CLK_CNTL0,
3550 		.bit_idx = 26,
3551 		.active_low = false,
3552 	},
3553 	[CLKC_RESET_CPU1_SOFT_RESET] = {
3554 		.reg = HHI_SYS_CPU_CLK_CNTL0,
3555 		.bit_idx = 25,
3556 		.active_low = false,
3557 	},
3558 	[CLKC_RESET_CPU0_SOFT_RESET] = {
3559 		.reg = HHI_SYS_CPU_CLK_CNTL0,
3560 		.bit_idx = 24,
3561 		.active_low = false,
3562 	},
3563 	[CLKC_RESET_A5_GLOBAL_RESET] = {
3564 		.reg = HHI_SYS_CPU_CLK_CNTL0,
3565 		.bit_idx = 18,
3566 		.active_low = false,
3567 	},
3568 	[CLKC_RESET_A5_AXI_SOFT_RESET] = {
3569 		.reg = HHI_SYS_CPU_CLK_CNTL0,
3570 		.bit_idx = 17,
3571 		.active_low = false,
3572 	},
3573 	[CLKC_RESET_A5_ABP_SOFT_RESET] = {
3574 		.reg = HHI_SYS_CPU_CLK_CNTL0,
3575 		.bit_idx = 16,
3576 		.active_low = false,
3577 	},
3578 	[CLKC_RESET_AXI_64_TO_128_BRIDGE_MMC_SOFT_RESET] = {
3579 		.reg = HHI_SYS_CPU_CLK_CNTL1,
3580 		.bit_idx = 30,
3581 		.active_low = false,
3582 	},
3583 	[CLKC_RESET_VID_CLK_CNTL_SOFT_RESET] = {
3584 		.reg = HHI_VID_CLK_CNTL,
3585 		.bit_idx = 15,
3586 		.active_low = false,
3587 	},
3588 	[CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST] = {
3589 		.reg = HHI_VID_DIVIDER_CNTL,
3590 		.bit_idx = 7,
3591 		.active_low = false,
3592 	},
3593 	[CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE] = {
3594 		.reg = HHI_VID_DIVIDER_CNTL,
3595 		.bit_idx = 3,
3596 		.active_low = false,
3597 	},
3598 	[CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST] = {
3599 		.reg = HHI_VID_DIVIDER_CNTL,
3600 		.bit_idx = 1,
3601 		.active_low = true,
3602 	},
3603 	[CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE] = {
3604 		.reg = HHI_VID_DIVIDER_CNTL,
3605 		.bit_idx = 0,
3606 		.active_low = true,
3607 	},
3608 };
3609 
3610 static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev,
3611 				    unsigned long id, bool assert)
3612 {
3613 	struct meson8b_clk_reset *meson8b_clk_reset =
3614 		container_of(rcdev, struct meson8b_clk_reset, reset);
3615 	const struct meson8b_clk_reset_line *reset;
3616 	unsigned int value = 0;
3617 	unsigned long flags;
3618 
3619 	if (id >= ARRAY_SIZE(meson8b_clk_reset_bits))
3620 		return -EINVAL;
3621 
3622 	reset = &meson8b_clk_reset_bits[id];
3623 
3624 	if (assert != reset->active_low)
3625 		value = BIT(reset->bit_idx);
3626 
3627 	spin_lock_irqsave(&meson_clk_lock, flags);
3628 
3629 	regmap_update_bits(meson8b_clk_reset->regmap, reset->reg,
3630 			   BIT(reset->bit_idx), value);
3631 
3632 	spin_unlock_irqrestore(&meson_clk_lock, flags);
3633 
3634 	return 0;
3635 }
3636 
3637 static int meson8b_clk_reset_assert(struct reset_controller_dev *rcdev,
3638 				     unsigned long id)
3639 {
3640 	return meson8b_clk_reset_update(rcdev, id, true);
3641 }
3642 
3643 static int meson8b_clk_reset_deassert(struct reset_controller_dev *rcdev,
3644 				       unsigned long id)
3645 {
3646 	return meson8b_clk_reset_update(rcdev, id, false);
3647 }
3648 
3649 static const struct reset_control_ops meson8b_clk_reset_ops = {
3650 	.assert = meson8b_clk_reset_assert,
3651 	.deassert = meson8b_clk_reset_deassert,
3652 };
3653 
3654 struct meson8b_nb_data {
3655 	struct notifier_block nb;
3656 	struct clk_hw *cpu_clk;
3657 };
3658 
3659 static int meson8b_cpu_clk_notifier_cb(struct notifier_block *nb,
3660 				       unsigned long event, void *data)
3661 {
3662 	struct meson8b_nb_data *nb_data =
3663 		container_of(nb, struct meson8b_nb_data, nb);
3664 	struct clk_hw *parent_clk;
3665 	int ret;
3666 
3667 	switch (event) {
3668 	case PRE_RATE_CHANGE:
3669 		/* xtal */
3670 		parent_clk = clk_hw_get_parent_by_index(nb_data->cpu_clk, 0);
3671 		break;
3672 
3673 	case POST_RATE_CHANGE:
3674 		/* cpu_scale_out_sel */
3675 		parent_clk = clk_hw_get_parent_by_index(nb_data->cpu_clk, 1);
3676 		break;
3677 
3678 	default:
3679 		return NOTIFY_DONE;
3680 	}
3681 
3682 	ret = clk_hw_set_parent(nb_data->cpu_clk, parent_clk);
3683 	if (ret)
3684 		return notifier_from_errno(ret);
3685 
3686 	udelay(100);
3687 
3688 	return NOTIFY_OK;
3689 }
3690 
3691 static struct meson8b_nb_data meson8b_cpu_nb_data = {
3692 	.nb.notifier_call = meson8b_cpu_clk_notifier_cb,
3693 };
3694 
3695 static const struct regmap_config clkc_regmap_config = {
3696 	.reg_bits       = 32,
3697 	.val_bits       = 32,
3698 	.reg_stride     = 4,
3699 };
3700 
3701 static void __init meson8b_clkc_init_common(struct device_node *np,
3702 			struct clk_hw_onecell_data *clk_hw_onecell_data)
3703 {
3704 	struct meson8b_clk_reset *rstc;
3705 	const char *notifier_clk_name;
3706 	struct clk *notifier_clk;
3707 	void __iomem *clk_base;
3708 	struct regmap *map;
3709 	int i, ret;
3710 
3711 	map = syscon_node_to_regmap(of_get_parent(np));
3712 	if (IS_ERR(map)) {
3713 		pr_info("failed to get HHI regmap - Trying obsolete regs\n");
3714 
3715 		/* Generic clocks, PLLs and some of the reset-bits */
3716 		clk_base = of_iomap(np, 1);
3717 		if (!clk_base) {
3718 			pr_err("%s: Unable to map clk base\n", __func__);
3719 			return;
3720 		}
3721 
3722 		map = regmap_init_mmio(NULL, clk_base, &clkc_regmap_config);
3723 		if (IS_ERR(map))
3724 			return;
3725 	}
3726 
3727 	rstc = kzalloc(sizeof(*rstc), GFP_KERNEL);
3728 	if (!rstc)
3729 		return;
3730 
3731 	/* Reset Controller */
3732 	rstc->regmap = map;
3733 	rstc->reset.ops = &meson8b_clk_reset_ops;
3734 	rstc->reset.nr_resets = ARRAY_SIZE(meson8b_clk_reset_bits);
3735 	rstc->reset.of_node = np;
3736 	ret = reset_controller_register(&rstc->reset);
3737 	if (ret) {
3738 		pr_err("%s: Failed to register clkc reset controller: %d\n",
3739 		       __func__, ret);
3740 		return;
3741 	}
3742 
3743 	/* Populate regmap for the regmap backed clocks */
3744 	for (i = 0; i < ARRAY_SIZE(meson8b_clk_regmaps); i++)
3745 		meson8b_clk_regmaps[i]->map = map;
3746 
3747 	/*
3748 	 * always skip CLKID_UNUSED and also skip XTAL if the .dtb provides the
3749 	 * XTAL clock as input.
3750 	 */
3751 	if (!IS_ERR(of_clk_get_by_name(np, "xtal")))
3752 		i = CLKID_PLL_FIXED;
3753 	else
3754 		i = CLKID_XTAL;
3755 
3756 	/* register all clks */
3757 	for (; i < CLK_NR_CLKS; i++) {
3758 		/* array might be sparse */
3759 		if (!clk_hw_onecell_data->hws[i])
3760 			continue;
3761 
3762 		ret = of_clk_hw_register(np, clk_hw_onecell_data->hws[i]);
3763 		if (ret)
3764 			return;
3765 	}
3766 
3767 	meson8b_cpu_nb_data.cpu_clk = clk_hw_onecell_data->hws[CLKID_CPUCLK];
3768 
3769 	/*
3770 	 * FIXME we shouldn't program the muxes in notifier handlers. The
3771 	 * tricky programming sequence will be handled by the forthcoming
3772 	 * coordinated clock rates mechanism once that feature is released.
3773 	 */
3774 	notifier_clk_name = clk_hw_get_name(&meson8b_cpu_scale_out_sel.hw);
3775 	notifier_clk = __clk_lookup(notifier_clk_name);
3776 	ret = clk_notifier_register(notifier_clk, &meson8b_cpu_nb_data.nb);
3777 	if (ret) {
3778 		pr_err("%s: failed to register the CPU clock notifier\n",
3779 		       __func__);
3780 		return;
3781 	}
3782 
3783 	ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get,
3784 				     clk_hw_onecell_data);
3785 	if (ret)
3786 		pr_err("%s: failed to register clock provider\n", __func__);
3787 }
3788 
3789 static void __init meson8_clkc_init(struct device_node *np)
3790 {
3791 	return meson8b_clkc_init_common(np, &meson8_hw_onecell_data);
3792 }
3793 
3794 static void __init meson8b_clkc_init(struct device_node *np)
3795 {
3796 	return meson8b_clkc_init_common(np, &meson8b_hw_onecell_data);
3797 }
3798 
3799 static void __init meson8m2_clkc_init(struct device_node *np)
3800 {
3801 	return meson8b_clkc_init_common(np, &meson8m2_hw_onecell_data);
3802 }
3803 
3804 CLK_OF_DECLARE_DRIVER(meson8_clkc, "amlogic,meson8-clkc",
3805 		      meson8_clkc_init);
3806 CLK_OF_DECLARE_DRIVER(meson8b_clkc, "amlogic,meson8b-clkc",
3807 		      meson8b_clkc_init);
3808 CLK_OF_DECLARE_DRIVER(meson8m2_clkc, "amlogic,meson8m2-clkc",
3809 		      meson8m2_clkc_init);
3810