1 // SPDX-License-Identifier: GPL-2.0+
3 * Amlogic Meson-G12A Clock Controller Driver
5 * Copyright (c) 2016 Baylibre SAS.
6 * Author: Michael Turquette <mturquette@baylibre.com>
8 * Copyright (c) 2018 Amlogic, inc.
9 * Author: Qiufang Dai <qiufang.dai@amlogic.com>
10 * Author: Jian Hu <jian.hu@amlogic.com>
13 #include <linux/clk-provider.h>
14 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/clk.h>
18 #include <linux/module.h>
22 #include "clk-regmap.h"
23 #include "clk-cpu-dyndiv.h"
24 #include "vid-pll-div.h"
25 #include "meson-eeclk.h"
28 #include <dt-bindings/clock/g12a-clkc.h>
30 static DEFINE_SPINLOCK(meson_clk_lock);
32 static struct clk_regmap g12a_fixed_pll_dco = {
33 .data = &(struct meson_clk_pll_data){
35 .reg_off = HHI_FIX_PLL_CNTL0,
40 .reg_off = HHI_FIX_PLL_CNTL0,
45 .reg_off = HHI_FIX_PLL_CNTL0,
50 .reg_off = HHI_FIX_PLL_CNTL1,
55 .reg_off = HHI_FIX_PLL_CNTL0,
60 .reg_off = HHI_FIX_PLL_CNTL0,
65 .hw.init = &(struct clk_init_data){
66 .name = "fixed_pll_dco",
67 .ops = &meson_clk_pll_ro_ops,
68 .parent_data = &(const struct clk_parent_data) {
75 static struct clk_regmap g12a_fixed_pll = {
76 .data = &(struct clk_regmap_div_data){
77 .offset = HHI_FIX_PLL_CNTL0,
80 .flags = CLK_DIVIDER_POWER_OF_TWO,
82 .hw.init = &(struct clk_init_data){
84 .ops = &clk_regmap_divider_ro_ops,
85 .parent_hws = (const struct clk_hw *[]) {
86 &g12a_fixed_pll_dco.hw
90 * This clock won't ever change at runtime so
91 * CLK_SET_RATE_PARENT is not required
96 static const struct pll_mult_range g12a_sys_pll_mult_range = {
101 static struct clk_regmap g12a_sys_pll_dco = {
102 .data = &(struct meson_clk_pll_data){
104 .reg_off = HHI_SYS_PLL_CNTL0,
109 .reg_off = HHI_SYS_PLL_CNTL0,
114 .reg_off = HHI_SYS_PLL_CNTL0,
119 .reg_off = HHI_SYS_PLL_CNTL0,
124 .reg_off = HHI_SYS_PLL_CNTL0,
128 .range = &g12a_sys_pll_mult_range,
130 .hw.init = &(struct clk_init_data){
131 .name = "sys_pll_dco",
132 .ops = &meson_clk_pll_ops,
133 .parent_data = &(const struct clk_parent_data) {
137 /* This clock feeds the CPU, avoid disabling it */
138 .flags = CLK_IS_CRITICAL,
142 static struct clk_regmap g12a_sys_pll = {
143 .data = &(struct clk_regmap_div_data){
144 .offset = HHI_SYS_PLL_CNTL0,
147 .flags = CLK_DIVIDER_POWER_OF_TWO,
149 .hw.init = &(struct clk_init_data){
151 .ops = &clk_regmap_divider_ops,
152 .parent_hws = (const struct clk_hw *[]) {
156 .flags = CLK_SET_RATE_PARENT,
160 static struct clk_regmap g12b_sys1_pll_dco = {
161 .data = &(struct meson_clk_pll_data){
163 .reg_off = HHI_SYS1_PLL_CNTL0,
168 .reg_off = HHI_SYS1_PLL_CNTL0,
173 .reg_off = HHI_SYS1_PLL_CNTL0,
178 .reg_off = HHI_SYS1_PLL_CNTL0,
183 .reg_off = HHI_SYS1_PLL_CNTL0,
187 .range = &g12a_sys_pll_mult_range,
189 .hw.init = &(struct clk_init_data){
190 .name = "sys1_pll_dco",
191 .ops = &meson_clk_pll_ops,
192 .parent_data = &(const struct clk_parent_data) {
196 /* This clock feeds the CPU, avoid disabling it */
197 .flags = CLK_IS_CRITICAL,
201 static struct clk_regmap g12b_sys1_pll = {
202 .data = &(struct clk_regmap_div_data){
203 .offset = HHI_SYS1_PLL_CNTL0,
206 .flags = CLK_DIVIDER_POWER_OF_TWO,
208 .hw.init = &(struct clk_init_data){
210 .ops = &clk_regmap_divider_ops,
211 .parent_hws = (const struct clk_hw *[]) {
212 &g12b_sys1_pll_dco.hw
215 .flags = CLK_SET_RATE_PARENT,
219 static struct clk_regmap g12a_sys_pll_div16_en = {
220 .data = &(struct clk_regmap_gate_data){
221 .offset = HHI_SYS_CPU_CLK_CNTL1,
224 .hw.init = &(struct clk_init_data) {
225 .name = "sys_pll_div16_en",
226 .ops = &clk_regmap_gate_ro_ops,
227 .parent_hws = (const struct clk_hw *[]) { &g12a_sys_pll.hw },
230 * This clock is used to debug the sys_pll range
231 * Linux should not change it at runtime
236 static struct clk_regmap g12b_sys1_pll_div16_en = {
237 .data = &(struct clk_regmap_gate_data){
238 .offset = HHI_SYS_CPUB_CLK_CNTL1,
241 .hw.init = &(struct clk_init_data) {
242 .name = "sys1_pll_div16_en",
243 .ops = &clk_regmap_gate_ro_ops,
244 .parent_hws = (const struct clk_hw *[]) {
249 * This clock is used to debug the sys_pll range
250 * Linux should not change it at runtime
255 static struct clk_fixed_factor g12a_sys_pll_div16 = {
258 .hw.init = &(struct clk_init_data){
259 .name = "sys_pll_div16",
260 .ops = &clk_fixed_factor_ops,
261 .parent_hws = (const struct clk_hw *[]) {
262 &g12a_sys_pll_div16_en.hw
268 static struct clk_fixed_factor g12b_sys1_pll_div16 = {
271 .hw.init = &(struct clk_init_data){
272 .name = "sys1_pll_div16",
273 .ops = &clk_fixed_factor_ops,
274 .parent_hws = (const struct clk_hw *[]) {
275 &g12b_sys1_pll_div16_en.hw
281 static struct clk_fixed_factor g12a_fclk_div2_div = {
284 .hw.init = &(struct clk_init_data){
285 .name = "fclk_div2_div",
286 .ops = &clk_fixed_factor_ops,
287 .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
292 static struct clk_regmap g12a_fclk_div2 = {
293 .data = &(struct clk_regmap_gate_data){
294 .offset = HHI_FIX_PLL_CNTL1,
297 .hw.init = &(struct clk_init_data){
299 .ops = &clk_regmap_gate_ops,
300 .parent_hws = (const struct clk_hw *[]) {
301 &g12a_fclk_div2_div.hw
305 * Similar to fclk_div3, it seems that this clock is used by
306 * the resident firmware and is required by the platform to
308 * Until the following condition are met, we need this clock to
309 * be marked as critical:
310 * a) Mark the clock used by a firmware resource, if possible
311 * b) CCF has a clock hand-off mechanism to make the sure the
312 * clock stays on until the proper driver comes along
314 .flags = CLK_IS_CRITICAL,
318 static struct clk_fixed_factor g12a_fclk_div3_div = {
321 .hw.init = &(struct clk_init_data){
322 .name = "fclk_div3_div",
323 .ops = &clk_fixed_factor_ops,
324 .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
329 static struct clk_regmap g12a_fclk_div3 = {
330 .data = &(struct clk_regmap_gate_data){
331 .offset = HHI_FIX_PLL_CNTL1,
334 .hw.init = &(struct clk_init_data){
336 .ops = &clk_regmap_gate_ops,
337 .parent_hws = (const struct clk_hw *[]) {
338 &g12a_fclk_div3_div.hw
342 * This clock is used by the resident firmware and is required
343 * by the platform to operate correctly.
344 * Until the following condition are met, we need this clock to
345 * be marked as critical:
346 * a) Mark the clock used by a firmware resource, if possible
347 * b) CCF has a clock hand-off mechanism to make the sure the
348 * clock stays on until the proper driver comes along
350 .flags = CLK_IS_CRITICAL,
354 /* Datasheet names this field as "premux0" */
355 static struct clk_regmap g12a_cpu_clk_premux0 = {
356 .data = &(struct clk_regmap_mux_data){
357 .offset = HHI_SYS_CPU_CLK_CNTL0,
360 .flags = CLK_MUX_ROUND_CLOSEST,
362 .hw.init = &(struct clk_init_data){
363 .name = "cpu_clk_dyn0_sel",
364 .ops = &clk_regmap_mux_ops,
365 .parent_data = (const struct clk_parent_data []) {
366 { .fw_name = "xtal", },
367 { .hw = &g12a_fclk_div2.hw },
368 { .hw = &g12a_fclk_div3.hw },
371 .flags = CLK_SET_RATE_PARENT,
375 /* Datasheet names this field as "premux1" */
376 static struct clk_regmap g12a_cpu_clk_premux1 = {
377 .data = &(struct clk_regmap_mux_data){
378 .offset = HHI_SYS_CPU_CLK_CNTL0,
382 .hw.init = &(struct clk_init_data){
383 .name = "cpu_clk_dyn1_sel",
384 .ops = &clk_regmap_mux_ops,
385 .parent_data = (const struct clk_parent_data []) {
386 { .fw_name = "xtal", },
387 { .hw = &g12a_fclk_div2.hw },
388 { .hw = &g12a_fclk_div3.hw },
391 /* This sub-tree is used a parking clock */
392 .flags = CLK_SET_RATE_NO_REPARENT
396 /* Datasheet names this field as "mux0_divn_tcnt" */
397 static struct clk_regmap g12a_cpu_clk_mux0_div = {
398 .data = &(struct meson_clk_cpu_dyndiv_data){
400 .reg_off = HHI_SYS_CPU_CLK_CNTL0,
405 .reg_off = HHI_SYS_CPU_CLK_CNTL0,
410 .hw.init = &(struct clk_init_data){
411 .name = "cpu_clk_dyn0_div",
412 .ops = &meson_clk_cpu_dyndiv_ops,
413 .parent_hws = (const struct clk_hw *[]) {
414 &g12a_cpu_clk_premux0.hw
417 .flags = CLK_SET_RATE_PARENT,
421 /* Datasheet names this field as "postmux0" */
422 static struct clk_regmap g12a_cpu_clk_postmux0 = {
423 .data = &(struct clk_regmap_mux_data){
424 .offset = HHI_SYS_CPU_CLK_CNTL0,
427 .flags = CLK_MUX_ROUND_CLOSEST,
429 .hw.init = &(struct clk_init_data){
430 .name = "cpu_clk_dyn0",
431 .ops = &clk_regmap_mux_ops,
432 .parent_hws = (const struct clk_hw *[]) {
433 &g12a_cpu_clk_premux0.hw,
434 &g12a_cpu_clk_mux0_div.hw,
437 .flags = CLK_SET_RATE_PARENT,
441 /* Datasheet names this field as "Mux1_divn_tcnt" */
442 static struct clk_regmap g12a_cpu_clk_mux1_div = {
443 .data = &(struct clk_regmap_div_data){
444 .offset = HHI_SYS_CPU_CLK_CNTL0,
448 .hw.init = &(struct clk_init_data){
449 .name = "cpu_clk_dyn1_div",
450 .ops = &clk_regmap_divider_ro_ops,
451 .parent_hws = (const struct clk_hw *[]) {
452 &g12a_cpu_clk_premux1.hw
458 /* Datasheet names this field as "postmux1" */
459 static struct clk_regmap g12a_cpu_clk_postmux1 = {
460 .data = &(struct clk_regmap_mux_data){
461 .offset = HHI_SYS_CPU_CLK_CNTL0,
465 .hw.init = &(struct clk_init_data){
466 .name = "cpu_clk_dyn1",
467 .ops = &clk_regmap_mux_ops,
468 .parent_hws = (const struct clk_hw *[]) {
469 &g12a_cpu_clk_premux1.hw,
470 &g12a_cpu_clk_mux1_div.hw,
473 /* This sub-tree is used a parking clock */
474 .flags = CLK_SET_RATE_NO_REPARENT,
478 /* Datasheet names this field as "Final_dyn_mux_sel" */
479 static struct clk_regmap g12a_cpu_clk_dyn = {
480 .data = &(struct clk_regmap_mux_data){
481 .offset = HHI_SYS_CPU_CLK_CNTL0,
484 .flags = CLK_MUX_ROUND_CLOSEST,
486 .hw.init = &(struct clk_init_data){
487 .name = "cpu_clk_dyn",
488 .ops = &clk_regmap_mux_ops,
489 .parent_hws = (const struct clk_hw *[]) {
490 &g12a_cpu_clk_postmux0.hw,
491 &g12a_cpu_clk_postmux1.hw,
494 .flags = CLK_SET_RATE_PARENT,
498 /* Datasheet names this field as "Final_mux_sel" */
499 static struct clk_regmap g12a_cpu_clk = {
500 .data = &(struct clk_regmap_mux_data){
501 .offset = HHI_SYS_CPU_CLK_CNTL0,
504 .flags = CLK_MUX_ROUND_CLOSEST,
506 .hw.init = &(struct clk_init_data){
508 .ops = &clk_regmap_mux_ops,
509 .parent_hws = (const struct clk_hw *[]) {
510 &g12a_cpu_clk_dyn.hw,
514 .flags = CLK_SET_RATE_PARENT,
518 /* Datasheet names this field as "Final_mux_sel" */
519 static struct clk_regmap g12b_cpu_clk = {
520 .data = &(struct clk_regmap_mux_data){
521 .offset = HHI_SYS_CPU_CLK_CNTL0,
524 .flags = CLK_MUX_ROUND_CLOSEST,
526 .hw.init = &(struct clk_init_data){
528 .ops = &clk_regmap_mux_ops,
529 .parent_hws = (const struct clk_hw *[]) {
530 &g12a_cpu_clk_dyn.hw,
534 .flags = CLK_SET_RATE_PARENT,
538 /* Datasheet names this field as "premux0" */
539 static struct clk_regmap g12b_cpub_clk_premux0 = {
540 .data = &(struct clk_regmap_mux_data){
541 .offset = HHI_SYS_CPUB_CLK_CNTL,
544 .flags = CLK_MUX_ROUND_CLOSEST,
546 .hw.init = &(struct clk_init_data){
547 .name = "cpub_clk_dyn0_sel",
548 .ops = &clk_regmap_mux_ops,
549 .parent_data = (const struct clk_parent_data []) {
550 { .fw_name = "xtal", },
551 { .hw = &g12a_fclk_div2.hw },
552 { .hw = &g12a_fclk_div3.hw },
555 .flags = CLK_SET_RATE_PARENT,
559 /* Datasheet names this field as "mux0_divn_tcnt" */
560 static struct clk_regmap g12b_cpub_clk_mux0_div = {
561 .data = &(struct meson_clk_cpu_dyndiv_data){
563 .reg_off = HHI_SYS_CPUB_CLK_CNTL,
568 .reg_off = HHI_SYS_CPUB_CLK_CNTL,
573 .hw.init = &(struct clk_init_data){
574 .name = "cpub_clk_dyn0_div",
575 .ops = &meson_clk_cpu_dyndiv_ops,
576 .parent_hws = (const struct clk_hw *[]) {
577 &g12b_cpub_clk_premux0.hw
580 .flags = CLK_SET_RATE_PARENT,
584 /* Datasheet names this field as "postmux0" */
585 static struct clk_regmap g12b_cpub_clk_postmux0 = {
586 .data = &(struct clk_regmap_mux_data){
587 .offset = HHI_SYS_CPUB_CLK_CNTL,
590 .flags = CLK_MUX_ROUND_CLOSEST,
592 .hw.init = &(struct clk_init_data){
593 .name = "cpub_clk_dyn0",
594 .ops = &clk_regmap_mux_ops,
595 .parent_hws = (const struct clk_hw *[]) {
596 &g12b_cpub_clk_premux0.hw,
597 &g12b_cpub_clk_mux0_div.hw
600 .flags = CLK_SET_RATE_PARENT,
604 /* Datasheet names this field as "premux1" */
605 static struct clk_regmap g12b_cpub_clk_premux1 = {
606 .data = &(struct clk_regmap_mux_data){
607 .offset = HHI_SYS_CPUB_CLK_CNTL,
611 .hw.init = &(struct clk_init_data){
612 .name = "cpub_clk_dyn1_sel",
613 .ops = &clk_regmap_mux_ops,
614 .parent_data = (const struct clk_parent_data []) {
615 { .fw_name = "xtal", },
616 { .hw = &g12a_fclk_div2.hw },
617 { .hw = &g12a_fclk_div3.hw },
620 /* This sub-tree is used a parking clock */
621 .flags = CLK_SET_RATE_NO_REPARENT,
625 /* Datasheet names this field as "Mux1_divn_tcnt" */
626 static struct clk_regmap g12b_cpub_clk_mux1_div = {
627 .data = &(struct clk_regmap_div_data){
628 .offset = HHI_SYS_CPUB_CLK_CNTL,
632 .hw.init = &(struct clk_init_data){
633 .name = "cpub_clk_dyn1_div",
634 .ops = &clk_regmap_divider_ro_ops,
635 .parent_hws = (const struct clk_hw *[]) {
636 &g12b_cpub_clk_premux1.hw
642 /* Datasheet names this field as "postmux1" */
643 static struct clk_regmap g12b_cpub_clk_postmux1 = {
644 .data = &(struct clk_regmap_mux_data){
645 .offset = HHI_SYS_CPUB_CLK_CNTL,
649 .hw.init = &(struct clk_init_data){
650 .name = "cpub_clk_dyn1",
651 .ops = &clk_regmap_mux_ops,
652 .parent_hws = (const struct clk_hw *[]) {
653 &g12b_cpub_clk_premux1.hw,
654 &g12b_cpub_clk_mux1_div.hw
657 /* This sub-tree is used a parking clock */
658 .flags = CLK_SET_RATE_NO_REPARENT,
662 /* Datasheet names this field as "Final_dyn_mux_sel" */
663 static struct clk_regmap g12b_cpub_clk_dyn = {
664 .data = &(struct clk_regmap_mux_data){
665 .offset = HHI_SYS_CPUB_CLK_CNTL,
668 .flags = CLK_MUX_ROUND_CLOSEST,
670 .hw.init = &(struct clk_init_data){
671 .name = "cpub_clk_dyn",
672 .ops = &clk_regmap_mux_ops,
673 .parent_hws = (const struct clk_hw *[]) {
674 &g12b_cpub_clk_postmux0.hw,
675 &g12b_cpub_clk_postmux1.hw
678 .flags = CLK_SET_RATE_PARENT,
682 /* Datasheet names this field as "Final_mux_sel" */
683 static struct clk_regmap g12b_cpub_clk = {
684 .data = &(struct clk_regmap_mux_data){
685 .offset = HHI_SYS_CPUB_CLK_CNTL,
688 .flags = CLK_MUX_ROUND_CLOSEST,
690 .hw.init = &(struct clk_init_data){
692 .ops = &clk_regmap_mux_ops,
693 .parent_hws = (const struct clk_hw *[]) {
694 &g12b_cpub_clk_dyn.hw,
698 .flags = CLK_SET_RATE_PARENT,
702 static struct clk_regmap sm1_gp1_pll;
704 /* Datasheet names this field as "premux0" */
705 static struct clk_regmap sm1_dsu_clk_premux0 = {
706 .data = &(struct clk_regmap_mux_data){
707 .offset = HHI_SYS_CPU_CLK_CNTL5,
711 .hw.init = &(struct clk_init_data){
712 .name = "dsu_clk_dyn0_sel",
713 .ops = &clk_regmap_mux_ro_ops,
714 .parent_data = (const struct clk_parent_data []) {
715 { .fw_name = "xtal", },
716 { .hw = &g12a_fclk_div2.hw },
717 { .hw = &g12a_fclk_div3.hw },
718 { .hw = &sm1_gp1_pll.hw },
724 /* Datasheet names this field as "premux1" */
725 static struct clk_regmap sm1_dsu_clk_premux1 = {
726 .data = &(struct clk_regmap_mux_data){
727 .offset = HHI_SYS_CPU_CLK_CNTL5,
731 .hw.init = &(struct clk_init_data){
732 .name = "dsu_clk_dyn1_sel",
733 .ops = &clk_regmap_mux_ro_ops,
734 .parent_data = (const struct clk_parent_data []) {
735 { .fw_name = "xtal", },
736 { .hw = &g12a_fclk_div2.hw },
737 { .hw = &g12a_fclk_div3.hw },
738 { .hw = &sm1_gp1_pll.hw },
744 /* Datasheet names this field as "Mux0_divn_tcnt" */
745 static struct clk_regmap sm1_dsu_clk_mux0_div = {
746 .data = &(struct clk_regmap_div_data){
747 .offset = HHI_SYS_CPU_CLK_CNTL5,
751 .hw.init = &(struct clk_init_data){
752 .name = "dsu_clk_dyn0_div",
753 .ops = &clk_regmap_divider_ro_ops,
754 .parent_hws = (const struct clk_hw *[]) {
755 &sm1_dsu_clk_premux0.hw
761 /* Datasheet names this field as "postmux0" */
762 static struct clk_regmap sm1_dsu_clk_postmux0 = {
763 .data = &(struct clk_regmap_mux_data){
764 .offset = HHI_SYS_CPU_CLK_CNTL5,
768 .hw.init = &(struct clk_init_data){
769 .name = "dsu_clk_dyn0",
770 .ops = &clk_regmap_mux_ro_ops,
771 .parent_hws = (const struct clk_hw *[]) {
772 &sm1_dsu_clk_premux0.hw,
773 &sm1_dsu_clk_mux0_div.hw,
779 /* Datasheet names this field as "Mux1_divn_tcnt" */
780 static struct clk_regmap sm1_dsu_clk_mux1_div = {
781 .data = &(struct clk_regmap_div_data){
782 .offset = HHI_SYS_CPU_CLK_CNTL5,
786 .hw.init = &(struct clk_init_data){
787 .name = "dsu_clk_dyn1_div",
788 .ops = &clk_regmap_divider_ro_ops,
789 .parent_hws = (const struct clk_hw *[]) {
790 &sm1_dsu_clk_premux1.hw
796 /* Datasheet names this field as "postmux1" */
797 static struct clk_regmap sm1_dsu_clk_postmux1 = {
798 .data = &(struct clk_regmap_mux_data){
799 .offset = HHI_SYS_CPU_CLK_CNTL5,
803 .hw.init = &(struct clk_init_data){
804 .name = "dsu_clk_dyn1",
805 .ops = &clk_regmap_mux_ro_ops,
806 .parent_hws = (const struct clk_hw *[]) {
807 &sm1_dsu_clk_premux1.hw,
808 &sm1_dsu_clk_mux1_div.hw,
814 /* Datasheet names this field as "Final_dyn_mux_sel" */
815 static struct clk_regmap sm1_dsu_clk_dyn = {
816 .data = &(struct clk_regmap_mux_data){
817 .offset = HHI_SYS_CPU_CLK_CNTL5,
821 .hw.init = &(struct clk_init_data){
822 .name = "dsu_clk_dyn",
823 .ops = &clk_regmap_mux_ro_ops,
824 .parent_hws = (const struct clk_hw *[]) {
825 &sm1_dsu_clk_postmux0.hw,
826 &sm1_dsu_clk_postmux1.hw,
832 /* Datasheet names this field as "Final_mux_sel" */
833 static struct clk_regmap sm1_dsu_final_clk = {
834 .data = &(struct clk_regmap_mux_data){
835 .offset = HHI_SYS_CPU_CLK_CNTL5,
839 .hw.init = &(struct clk_init_data){
840 .name = "dsu_clk_final",
841 .ops = &clk_regmap_mux_ro_ops,
842 .parent_hws = (const struct clk_hw *[]) {
850 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 0 */
851 static struct clk_regmap sm1_cpu1_clk = {
852 .data = &(struct clk_regmap_mux_data){
853 .offset = HHI_SYS_CPU_CLK_CNTL6,
857 .hw.init = &(struct clk_init_data){
859 .ops = &clk_regmap_mux_ro_ops,
860 .parent_hws = (const struct clk_hw *[]) {
862 /* This CPU also have a dedicated clock tree */
868 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 1 */
869 static struct clk_regmap sm1_cpu2_clk = {
870 .data = &(struct clk_regmap_mux_data){
871 .offset = HHI_SYS_CPU_CLK_CNTL6,
875 .hw.init = &(struct clk_init_data){
877 .ops = &clk_regmap_mux_ro_ops,
878 .parent_hws = (const struct clk_hw *[]) {
880 /* This CPU also have a dedicated clock tree */
886 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 2 */
887 static struct clk_regmap sm1_cpu3_clk = {
888 .data = &(struct clk_regmap_mux_data){
889 .offset = HHI_SYS_CPU_CLK_CNTL6,
893 .hw.init = &(struct clk_init_data){
895 .ops = &clk_regmap_mux_ro_ops,
896 .parent_hws = (const struct clk_hw *[]) {
898 /* This CPU also have a dedicated clock tree */
904 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 4 */
905 static struct clk_regmap sm1_dsu_clk = {
906 .data = &(struct clk_regmap_mux_data){
907 .offset = HHI_SYS_CPU_CLK_CNTL6,
911 .hw.init = &(struct clk_init_data){
913 .ops = &clk_regmap_mux_ro_ops,
914 .parent_hws = (const struct clk_hw *[]) {
916 &sm1_dsu_final_clk.hw,
922 static int g12a_cpu_clk_mux_notifier_cb(struct notifier_block *nb,
923 unsigned long event, void *data)
925 if (event == POST_RATE_CHANGE || event == PRE_RATE_CHANGE) {
926 /* Wait for clock propagation before/after changing the mux */
934 static struct notifier_block g12a_cpu_clk_mux_nb = {
935 .notifier_call = g12a_cpu_clk_mux_notifier_cb,
938 struct g12a_cpu_clk_postmux_nb_data {
939 struct notifier_block nb;
941 struct clk_hw *cpu_clk_dyn;
942 struct clk_hw *cpu_clk_postmux0;
943 struct clk_hw *cpu_clk_postmux1;
944 struct clk_hw *cpu_clk_premux1;
947 static int g12a_cpu_clk_postmux_notifier_cb(struct notifier_block *nb,
948 unsigned long event, void *data)
950 struct g12a_cpu_clk_postmux_nb_data *nb_data =
951 container_of(nb, struct g12a_cpu_clk_postmux_nb_data, nb);
954 case PRE_RATE_CHANGE:
956 * This notifier means cpu_clk_postmux0 clock will be changed
957 * to feed cpu_clk, this is the current path :
960 * \- cpu_clk_postmux0
961 * \- cpu_clk_muxX_div
963 * \- fclk_div3 or fclk_div2
966 * \- fclk_div3 or fclk_div2
969 /* Setup cpu_clk_premux1 to xtal */
970 clk_hw_set_parent(nb_data->cpu_clk_premux1,
973 /* Setup cpu_clk_postmux1 to bypass divider */
974 clk_hw_set_parent(nb_data->cpu_clk_postmux1,
975 nb_data->cpu_clk_premux1);
977 /* Switch to parking clk on cpu_clk_postmux1 */
978 clk_hw_set_parent(nb_data->cpu_clk_dyn,
979 nb_data->cpu_clk_postmux1);
982 * Now, cpu_clk is 24MHz in the current path :
985 * \- cpu_clk_postmux1
994 case POST_RATE_CHANGE:
996 * The cpu_clk_postmux0 has ben updated, now switch back
997 * cpu_clk_dyn to cpu_clk_postmux0 and take the changes
1001 /* Configure cpu_clk_dyn back to cpu_clk_postmux0 */
1002 clk_hw_set_parent(nb_data->cpu_clk_dyn,
1003 nb_data->cpu_clk_postmux0);
1009 * \- cpu_clk_postmux0
1010 * \- cpu_clk_muxX_div
1011 * \- cpu_clk_premux0
1012 * \- fclk_div3 or fclk_div2
1014 * \- cpu_clk_premux0
1015 * \- fclk_div3 or fclk_div2
1027 static struct g12a_cpu_clk_postmux_nb_data g12a_cpu_clk_postmux0_nb_data = {
1028 .cpu_clk_dyn = &g12a_cpu_clk_dyn.hw,
1029 .cpu_clk_postmux0 = &g12a_cpu_clk_postmux0.hw,
1030 .cpu_clk_postmux1 = &g12a_cpu_clk_postmux1.hw,
1031 .cpu_clk_premux1 = &g12a_cpu_clk_premux1.hw,
1032 .nb.notifier_call = g12a_cpu_clk_postmux_notifier_cb,
1035 static struct g12a_cpu_clk_postmux_nb_data g12b_cpub_clk_postmux0_nb_data = {
1036 .cpu_clk_dyn = &g12b_cpub_clk_dyn.hw,
1037 .cpu_clk_postmux0 = &g12b_cpub_clk_postmux0.hw,
1038 .cpu_clk_postmux1 = &g12b_cpub_clk_postmux1.hw,
1039 .cpu_clk_premux1 = &g12b_cpub_clk_premux1.hw,
1040 .nb.notifier_call = g12a_cpu_clk_postmux_notifier_cb,
1043 struct g12a_sys_pll_nb_data {
1044 struct notifier_block nb;
1045 struct clk_hw *sys_pll;
1046 struct clk_hw *cpu_clk;
1047 struct clk_hw *cpu_clk_dyn;
1050 static int g12a_sys_pll_notifier_cb(struct notifier_block *nb,
1051 unsigned long event, void *data)
1053 struct g12a_sys_pll_nb_data *nb_data =
1054 container_of(nb, struct g12a_sys_pll_nb_data, nb);
1057 case PRE_RATE_CHANGE:
1059 * This notifier means sys_pll clock will be changed
1060 * to feed cpu_clk, this the current path :
1066 /* Configure cpu_clk to use cpu_clk_dyn */
1067 clk_hw_set_parent(nb_data->cpu_clk,
1068 nb_data->cpu_clk_dyn);
1071 * Now, cpu_clk uses the dyn path
1075 * \- cpu_clk_dynX_sel
1076 * \- cpu_clk_dynX_div
1077 * \- xtal/fclk_div2/fclk_div3
1078 * \- xtal/fclk_div2/fclk_div3
1085 case POST_RATE_CHANGE:
1087 * The sys_pll has ben updated, now switch back cpu_clk to
1091 /* Configure cpu_clk to use sys_pll */
1092 clk_hw_set_parent(nb_data->cpu_clk,
1110 static struct g12a_sys_pll_nb_data g12a_sys_pll_nb_data = {
1111 .sys_pll = &g12a_sys_pll.hw,
1112 .cpu_clk = &g12a_cpu_clk.hw,
1113 .cpu_clk_dyn = &g12a_cpu_clk_dyn.hw,
1114 .nb.notifier_call = g12a_sys_pll_notifier_cb,
1117 /* G12B first CPU cluster uses sys1_pll */
1118 static struct g12a_sys_pll_nb_data g12b_cpu_clk_sys1_pll_nb_data = {
1119 .sys_pll = &g12b_sys1_pll.hw,
1120 .cpu_clk = &g12b_cpu_clk.hw,
1121 .cpu_clk_dyn = &g12a_cpu_clk_dyn.hw,
1122 .nb.notifier_call = g12a_sys_pll_notifier_cb,
1125 /* G12B second CPU cluster uses sys_pll */
1126 static struct g12a_sys_pll_nb_data g12b_cpub_clk_sys_pll_nb_data = {
1127 .sys_pll = &g12a_sys_pll.hw,
1128 .cpu_clk = &g12b_cpub_clk.hw,
1129 .cpu_clk_dyn = &g12b_cpub_clk_dyn.hw,
1130 .nb.notifier_call = g12a_sys_pll_notifier_cb,
1133 static struct clk_regmap g12a_cpu_clk_div16_en = {
1134 .data = &(struct clk_regmap_gate_data){
1135 .offset = HHI_SYS_CPU_CLK_CNTL1,
1138 .hw.init = &(struct clk_init_data) {
1139 .name = "cpu_clk_div16_en",
1140 .ops = &clk_regmap_gate_ro_ops,
1141 .parent_hws = (const struct clk_hw *[]) {
1146 * This clock is used to debug the cpu_clk range
1147 * Linux should not change it at runtime
1152 static struct clk_regmap g12b_cpub_clk_div16_en = {
1153 .data = &(struct clk_regmap_gate_data){
1154 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1157 .hw.init = &(struct clk_init_data) {
1158 .name = "cpub_clk_div16_en",
1159 .ops = &clk_regmap_gate_ro_ops,
1160 .parent_hws = (const struct clk_hw *[]) {
1165 * This clock is used to debug the cpu_clk range
1166 * Linux should not change it at runtime
1171 static struct clk_fixed_factor g12a_cpu_clk_div16 = {
1174 .hw.init = &(struct clk_init_data){
1175 .name = "cpu_clk_div16",
1176 .ops = &clk_fixed_factor_ops,
1177 .parent_hws = (const struct clk_hw *[]) {
1178 &g12a_cpu_clk_div16_en.hw
1184 static struct clk_fixed_factor g12b_cpub_clk_div16 = {
1187 .hw.init = &(struct clk_init_data){
1188 .name = "cpub_clk_div16",
1189 .ops = &clk_fixed_factor_ops,
1190 .parent_hws = (const struct clk_hw *[]) {
1191 &g12b_cpub_clk_div16_en.hw
1197 static struct clk_regmap g12a_cpu_clk_apb_div = {
1198 .data = &(struct clk_regmap_div_data){
1199 .offset = HHI_SYS_CPU_CLK_CNTL1,
1202 .flags = CLK_DIVIDER_POWER_OF_TWO,
1204 .hw.init = &(struct clk_init_data){
1205 .name = "cpu_clk_apb_div",
1206 .ops = &clk_regmap_divider_ro_ops,
1207 .parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw },
1212 static struct clk_regmap g12a_cpu_clk_apb = {
1213 .data = &(struct clk_regmap_gate_data){
1214 .offset = HHI_SYS_CPU_CLK_CNTL1,
1217 .hw.init = &(struct clk_init_data) {
1218 .name = "cpu_clk_apb",
1219 .ops = &clk_regmap_gate_ro_ops,
1220 .parent_hws = (const struct clk_hw *[]) {
1221 &g12a_cpu_clk_apb_div.hw
1225 * This clock is set by the ROM monitor code,
1226 * Linux should not change it at runtime
1231 static struct clk_regmap g12a_cpu_clk_atb_div = {
1232 .data = &(struct clk_regmap_div_data){
1233 .offset = HHI_SYS_CPU_CLK_CNTL1,
1236 .flags = CLK_DIVIDER_POWER_OF_TWO,
1238 .hw.init = &(struct clk_init_data){
1239 .name = "cpu_clk_atb_div",
1240 .ops = &clk_regmap_divider_ro_ops,
1241 .parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw },
1246 static struct clk_regmap g12a_cpu_clk_atb = {
1247 .data = &(struct clk_regmap_gate_data){
1248 .offset = HHI_SYS_CPU_CLK_CNTL1,
1251 .hw.init = &(struct clk_init_data) {
1252 .name = "cpu_clk_atb",
1253 .ops = &clk_regmap_gate_ro_ops,
1254 .parent_hws = (const struct clk_hw *[]) {
1255 &g12a_cpu_clk_atb_div.hw
1259 * This clock is set by the ROM monitor code,
1260 * Linux should not change it at runtime
1265 static struct clk_regmap g12a_cpu_clk_axi_div = {
1266 .data = &(struct clk_regmap_div_data){
1267 .offset = HHI_SYS_CPU_CLK_CNTL1,
1270 .flags = CLK_DIVIDER_POWER_OF_TWO,
1272 .hw.init = &(struct clk_init_data){
1273 .name = "cpu_clk_axi_div",
1274 .ops = &clk_regmap_divider_ro_ops,
1275 .parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw },
1280 static struct clk_regmap g12a_cpu_clk_axi = {
1281 .data = &(struct clk_regmap_gate_data){
1282 .offset = HHI_SYS_CPU_CLK_CNTL1,
1285 .hw.init = &(struct clk_init_data) {
1286 .name = "cpu_clk_axi",
1287 .ops = &clk_regmap_gate_ro_ops,
1288 .parent_hws = (const struct clk_hw *[]) {
1289 &g12a_cpu_clk_axi_div.hw
1293 * This clock is set by the ROM monitor code,
1294 * Linux should not change it at runtime
1299 static struct clk_regmap g12a_cpu_clk_trace_div = {
1300 .data = &(struct clk_regmap_div_data){
1301 .offset = HHI_SYS_CPU_CLK_CNTL1,
1304 .flags = CLK_DIVIDER_POWER_OF_TWO,
1306 .hw.init = &(struct clk_init_data){
1307 .name = "cpu_clk_trace_div",
1308 .ops = &clk_regmap_divider_ro_ops,
1309 .parent_data = &(const struct clk_parent_data) {
1312 * G12A and G12B have different cpu_clks (with
1313 * different struct clk_hw). We fallback to the global
1314 * naming string mechanism so cpu_clk_trace_div picks
1315 * up the appropriate one.
1324 static struct clk_regmap g12a_cpu_clk_trace = {
1325 .data = &(struct clk_regmap_gate_data){
1326 .offset = HHI_SYS_CPU_CLK_CNTL1,
1329 .hw.init = &(struct clk_init_data) {
1330 .name = "cpu_clk_trace",
1331 .ops = &clk_regmap_gate_ro_ops,
1332 .parent_hws = (const struct clk_hw *[]) {
1333 &g12a_cpu_clk_trace_div.hw
1337 * This clock is set by the ROM monitor code,
1338 * Linux should not change it at runtime
1343 static struct clk_fixed_factor g12b_cpub_clk_div2 = {
1346 .hw.init = &(struct clk_init_data){
1347 .name = "cpub_clk_div2",
1348 .ops = &clk_fixed_factor_ops,
1349 .parent_hws = (const struct clk_hw *[]) {
1356 static struct clk_fixed_factor g12b_cpub_clk_div3 = {
1359 .hw.init = &(struct clk_init_data){
1360 .name = "cpub_clk_div3",
1361 .ops = &clk_fixed_factor_ops,
1362 .parent_hws = (const struct clk_hw *[]) {
1369 static struct clk_fixed_factor g12b_cpub_clk_div4 = {
1372 .hw.init = &(struct clk_init_data){
1373 .name = "cpub_clk_div4",
1374 .ops = &clk_fixed_factor_ops,
1375 .parent_hws = (const struct clk_hw *[]) {
1382 static struct clk_fixed_factor g12b_cpub_clk_div5 = {
1385 .hw.init = &(struct clk_init_data){
1386 .name = "cpub_clk_div5",
1387 .ops = &clk_fixed_factor_ops,
1388 .parent_hws = (const struct clk_hw *[]) {
1395 static struct clk_fixed_factor g12b_cpub_clk_div6 = {
1398 .hw.init = &(struct clk_init_data){
1399 .name = "cpub_clk_div6",
1400 .ops = &clk_fixed_factor_ops,
1401 .parent_hws = (const struct clk_hw *[]) {
1408 static struct clk_fixed_factor g12b_cpub_clk_div7 = {
1411 .hw.init = &(struct clk_init_data){
1412 .name = "cpub_clk_div7",
1413 .ops = &clk_fixed_factor_ops,
1414 .parent_hws = (const struct clk_hw *[]) {
1421 static struct clk_fixed_factor g12b_cpub_clk_div8 = {
1424 .hw.init = &(struct clk_init_data){
1425 .name = "cpub_clk_div8",
1426 .ops = &clk_fixed_factor_ops,
1427 .parent_hws = (const struct clk_hw *[]) {
1434 static u32 mux_table_cpub[] = { 1, 2, 3, 4, 5, 6, 7 };
1435 static struct clk_regmap g12b_cpub_clk_apb_sel = {
1436 .data = &(struct clk_regmap_mux_data){
1437 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1440 .table = mux_table_cpub,
1442 .hw.init = &(struct clk_init_data){
1443 .name = "cpub_clk_apb_sel",
1444 .ops = &clk_regmap_mux_ro_ops,
1445 .parent_hws = (const struct clk_hw *[]) {
1446 &g12b_cpub_clk_div2.hw,
1447 &g12b_cpub_clk_div3.hw,
1448 &g12b_cpub_clk_div4.hw,
1449 &g12b_cpub_clk_div5.hw,
1450 &g12b_cpub_clk_div6.hw,
1451 &g12b_cpub_clk_div7.hw,
1452 &g12b_cpub_clk_div8.hw
1458 static struct clk_regmap g12b_cpub_clk_apb = {
1459 .data = &(struct clk_regmap_gate_data){
1460 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1462 .flags = CLK_GATE_SET_TO_DISABLE,
1464 .hw.init = &(struct clk_init_data) {
1465 .name = "cpub_clk_apb",
1466 .ops = &clk_regmap_gate_ro_ops,
1467 .parent_hws = (const struct clk_hw *[]) {
1468 &g12b_cpub_clk_apb_sel.hw
1472 * This clock is set by the ROM monitor code,
1473 * Linux should not change it at runtime
1478 static struct clk_regmap g12b_cpub_clk_atb_sel = {
1479 .data = &(struct clk_regmap_mux_data){
1480 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1483 .table = mux_table_cpub,
1485 .hw.init = &(struct clk_init_data){
1486 .name = "cpub_clk_atb_sel",
1487 .ops = &clk_regmap_mux_ro_ops,
1488 .parent_hws = (const struct clk_hw *[]) {
1489 &g12b_cpub_clk_div2.hw,
1490 &g12b_cpub_clk_div3.hw,
1491 &g12b_cpub_clk_div4.hw,
1492 &g12b_cpub_clk_div5.hw,
1493 &g12b_cpub_clk_div6.hw,
1494 &g12b_cpub_clk_div7.hw,
1495 &g12b_cpub_clk_div8.hw
1501 static struct clk_regmap g12b_cpub_clk_atb = {
1502 .data = &(struct clk_regmap_gate_data){
1503 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1505 .flags = CLK_GATE_SET_TO_DISABLE,
1507 .hw.init = &(struct clk_init_data) {
1508 .name = "cpub_clk_atb",
1509 .ops = &clk_regmap_gate_ro_ops,
1510 .parent_hws = (const struct clk_hw *[]) {
1511 &g12b_cpub_clk_atb_sel.hw
1515 * This clock is set by the ROM monitor code,
1516 * Linux should not change it at runtime
1521 static struct clk_regmap g12b_cpub_clk_axi_sel = {
1522 .data = &(struct clk_regmap_mux_data){
1523 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1526 .table = mux_table_cpub,
1528 .hw.init = &(struct clk_init_data){
1529 .name = "cpub_clk_axi_sel",
1530 .ops = &clk_regmap_mux_ro_ops,
1531 .parent_hws = (const struct clk_hw *[]) {
1532 &g12b_cpub_clk_div2.hw,
1533 &g12b_cpub_clk_div3.hw,
1534 &g12b_cpub_clk_div4.hw,
1535 &g12b_cpub_clk_div5.hw,
1536 &g12b_cpub_clk_div6.hw,
1537 &g12b_cpub_clk_div7.hw,
1538 &g12b_cpub_clk_div8.hw
1544 static struct clk_regmap g12b_cpub_clk_axi = {
1545 .data = &(struct clk_regmap_gate_data){
1546 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1548 .flags = CLK_GATE_SET_TO_DISABLE,
1550 .hw.init = &(struct clk_init_data) {
1551 .name = "cpub_clk_axi",
1552 .ops = &clk_regmap_gate_ro_ops,
1553 .parent_hws = (const struct clk_hw *[]) {
1554 &g12b_cpub_clk_axi_sel.hw
1558 * This clock is set by the ROM monitor code,
1559 * Linux should not change it at runtime
1564 static struct clk_regmap g12b_cpub_clk_trace_sel = {
1565 .data = &(struct clk_regmap_mux_data){
1566 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1569 .table = mux_table_cpub,
1571 .hw.init = &(struct clk_init_data){
1572 .name = "cpub_clk_trace_sel",
1573 .ops = &clk_regmap_mux_ro_ops,
1574 .parent_hws = (const struct clk_hw *[]) {
1575 &g12b_cpub_clk_div2.hw,
1576 &g12b_cpub_clk_div3.hw,
1577 &g12b_cpub_clk_div4.hw,
1578 &g12b_cpub_clk_div5.hw,
1579 &g12b_cpub_clk_div6.hw,
1580 &g12b_cpub_clk_div7.hw,
1581 &g12b_cpub_clk_div8.hw
1587 static struct clk_regmap g12b_cpub_clk_trace = {
1588 .data = &(struct clk_regmap_gate_data){
1589 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1591 .flags = CLK_GATE_SET_TO_DISABLE,
1593 .hw.init = &(struct clk_init_data) {
1594 .name = "cpub_clk_trace",
1595 .ops = &clk_regmap_gate_ro_ops,
1596 .parent_hws = (const struct clk_hw *[]) {
1597 &g12b_cpub_clk_trace_sel.hw
1601 * This clock is set by the ROM monitor code,
1602 * Linux should not change it at runtime
1607 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
1613 * Internal gp0 pll emulation configuration parameters
1615 static const struct reg_sequence g12a_gp0_init_regs[] = {
1616 { .reg = HHI_GP0_PLL_CNTL1, .def = 0x00000000 },
1617 { .reg = HHI_GP0_PLL_CNTL2, .def = 0x00000000 },
1618 { .reg = HHI_GP0_PLL_CNTL3, .def = 0x48681c00 },
1619 { .reg = HHI_GP0_PLL_CNTL4, .def = 0x33771290 },
1620 { .reg = HHI_GP0_PLL_CNTL5, .def = 0x39272000 },
1621 { .reg = HHI_GP0_PLL_CNTL6, .def = 0x56540000 },
1624 static struct clk_regmap g12a_gp0_pll_dco = {
1625 .data = &(struct meson_clk_pll_data){
1627 .reg_off = HHI_GP0_PLL_CNTL0,
1632 .reg_off = HHI_GP0_PLL_CNTL0,
1637 .reg_off = HHI_GP0_PLL_CNTL0,
1642 .reg_off = HHI_GP0_PLL_CNTL1,
1647 .reg_off = HHI_GP0_PLL_CNTL0,
1652 .reg_off = HHI_GP0_PLL_CNTL0,
1656 .range = &g12a_gp0_pll_mult_range,
1657 .init_regs = g12a_gp0_init_regs,
1658 .init_count = ARRAY_SIZE(g12a_gp0_init_regs),
1660 .hw.init = &(struct clk_init_data){
1661 .name = "gp0_pll_dco",
1662 .ops = &meson_clk_pll_ops,
1663 .parent_data = &(const struct clk_parent_data) {
1670 static struct clk_regmap g12a_gp0_pll = {
1671 .data = &(struct clk_regmap_div_data){
1672 .offset = HHI_GP0_PLL_CNTL0,
1675 .flags = (CLK_DIVIDER_POWER_OF_TWO |
1676 CLK_DIVIDER_ROUND_CLOSEST),
1678 .hw.init = &(struct clk_init_data){
1680 .ops = &clk_regmap_divider_ops,
1681 .parent_hws = (const struct clk_hw *[]) {
1682 &g12a_gp0_pll_dco.hw
1685 .flags = CLK_SET_RATE_PARENT,
1689 static struct clk_regmap sm1_gp1_pll_dco = {
1690 .data = &(struct meson_clk_pll_data){
1692 .reg_off = HHI_GP1_PLL_CNTL0,
1697 .reg_off = HHI_GP1_PLL_CNTL0,
1702 .reg_off = HHI_GP1_PLL_CNTL0,
1707 .reg_off = HHI_GP1_PLL_CNTL1,
1712 .reg_off = HHI_GP1_PLL_CNTL0,
1717 .reg_off = HHI_GP1_PLL_CNTL0,
1722 .hw.init = &(struct clk_init_data){
1723 .name = "gp1_pll_dco",
1724 .ops = &meson_clk_pll_ro_ops,
1725 .parent_data = &(const struct clk_parent_data) {
1729 /* This clock feeds the DSU, avoid disabling it */
1730 .flags = CLK_IS_CRITICAL,
1734 static struct clk_regmap sm1_gp1_pll = {
1735 .data = &(struct clk_regmap_div_data){
1736 .offset = HHI_GP1_PLL_CNTL0,
1739 .flags = (CLK_DIVIDER_POWER_OF_TWO |
1740 CLK_DIVIDER_ROUND_CLOSEST),
1742 .hw.init = &(struct clk_init_data){
1744 .ops = &clk_regmap_divider_ro_ops,
1745 .parent_hws = (const struct clk_hw *[]) {
1753 * Internal hifi pll emulation configuration parameters
1755 static const struct reg_sequence g12a_hifi_init_regs[] = {
1756 { .reg = HHI_HIFI_PLL_CNTL1, .def = 0x00000000 },
1757 { .reg = HHI_HIFI_PLL_CNTL2, .def = 0x00000000 },
1758 { .reg = HHI_HIFI_PLL_CNTL3, .def = 0x6a285c00 },
1759 { .reg = HHI_HIFI_PLL_CNTL4, .def = 0x65771290 },
1760 { .reg = HHI_HIFI_PLL_CNTL5, .def = 0x39272000 },
1761 { .reg = HHI_HIFI_PLL_CNTL6, .def = 0x56540000 },
1764 static struct clk_regmap g12a_hifi_pll_dco = {
1765 .data = &(struct meson_clk_pll_data){
1767 .reg_off = HHI_HIFI_PLL_CNTL0,
1772 .reg_off = HHI_HIFI_PLL_CNTL0,
1777 .reg_off = HHI_HIFI_PLL_CNTL0,
1782 .reg_off = HHI_HIFI_PLL_CNTL1,
1787 .reg_off = HHI_HIFI_PLL_CNTL0,
1792 .reg_off = HHI_HIFI_PLL_CNTL0,
1796 .range = &g12a_gp0_pll_mult_range,
1797 .init_regs = g12a_hifi_init_regs,
1798 .init_count = ARRAY_SIZE(g12a_hifi_init_regs),
1799 .flags = CLK_MESON_PLL_ROUND_CLOSEST,
1801 .hw.init = &(struct clk_init_data){
1802 .name = "hifi_pll_dco",
1803 .ops = &meson_clk_pll_ops,
1804 .parent_data = &(const struct clk_parent_data) {
1811 static struct clk_regmap g12a_hifi_pll = {
1812 .data = &(struct clk_regmap_div_data){
1813 .offset = HHI_HIFI_PLL_CNTL0,
1816 .flags = (CLK_DIVIDER_POWER_OF_TWO |
1817 CLK_DIVIDER_ROUND_CLOSEST),
1819 .hw.init = &(struct clk_init_data){
1821 .ops = &clk_regmap_divider_ops,
1822 .parent_hws = (const struct clk_hw *[]) {
1823 &g12a_hifi_pll_dco.hw
1826 .flags = CLK_SET_RATE_PARENT,
1831 * The Meson G12A PCIE PLL is fined tuned to deliver a very precise
1832 * 100MHz reference clock for the PCIe Analog PHY, and thus requires
1833 * a strict register sequence to enable the PLL.
1835 static const struct reg_sequence g12a_pcie_pll_init_regs[] = {
1836 { .reg = HHI_PCIE_PLL_CNTL0, .def = 0x20090496 },
1837 { .reg = HHI_PCIE_PLL_CNTL0, .def = 0x30090496 },
1838 { .reg = HHI_PCIE_PLL_CNTL1, .def = 0x00000000 },
1839 { .reg = HHI_PCIE_PLL_CNTL2, .def = 0x00001100 },
1840 { .reg = HHI_PCIE_PLL_CNTL3, .def = 0x10058e00 },
1841 { .reg = HHI_PCIE_PLL_CNTL4, .def = 0x000100c0 },
1842 { .reg = HHI_PCIE_PLL_CNTL5, .def = 0x68000048 },
1843 { .reg = HHI_PCIE_PLL_CNTL5, .def = 0x68000068, .delay_us = 20 },
1844 { .reg = HHI_PCIE_PLL_CNTL4, .def = 0x008100c0, .delay_us = 10 },
1845 { .reg = HHI_PCIE_PLL_CNTL0, .def = 0x34090496 },
1846 { .reg = HHI_PCIE_PLL_CNTL0, .def = 0x14090496, .delay_us = 10 },
1847 { .reg = HHI_PCIE_PLL_CNTL2, .def = 0x00001000 },
1850 /* Keep a single entry table for recalc/round_rate() ops */
1851 static const struct pll_params_table g12a_pcie_pll_table[] = {
1856 static struct clk_regmap g12a_pcie_pll_dco = {
1857 .data = &(struct meson_clk_pll_data){
1859 .reg_off = HHI_PCIE_PLL_CNTL0,
1864 .reg_off = HHI_PCIE_PLL_CNTL0,
1869 .reg_off = HHI_PCIE_PLL_CNTL0,
1874 .reg_off = HHI_PCIE_PLL_CNTL1,
1879 .reg_off = HHI_PCIE_PLL_CNTL0,
1884 .reg_off = HHI_PCIE_PLL_CNTL0,
1888 .table = g12a_pcie_pll_table,
1889 .init_regs = g12a_pcie_pll_init_regs,
1890 .init_count = ARRAY_SIZE(g12a_pcie_pll_init_regs),
1892 .hw.init = &(struct clk_init_data){
1893 .name = "pcie_pll_dco",
1894 .ops = &meson_clk_pcie_pll_ops,
1895 .parent_data = &(const struct clk_parent_data) {
1902 static struct clk_fixed_factor g12a_pcie_pll_dco_div2 = {
1905 .hw.init = &(struct clk_init_data){
1906 .name = "pcie_pll_dco_div2",
1907 .ops = &clk_fixed_factor_ops,
1908 .parent_hws = (const struct clk_hw *[]) {
1909 &g12a_pcie_pll_dco.hw
1912 .flags = CLK_SET_RATE_PARENT,
1916 static struct clk_regmap g12a_pcie_pll_od = {
1917 .data = &(struct clk_regmap_div_data){
1918 .offset = HHI_PCIE_PLL_CNTL0,
1921 .flags = CLK_DIVIDER_ROUND_CLOSEST |
1922 CLK_DIVIDER_ONE_BASED |
1923 CLK_DIVIDER_ALLOW_ZERO,
1925 .hw.init = &(struct clk_init_data){
1926 .name = "pcie_pll_od",
1927 .ops = &clk_regmap_divider_ops,
1928 .parent_hws = (const struct clk_hw *[]) {
1929 &g12a_pcie_pll_dco_div2.hw
1932 .flags = CLK_SET_RATE_PARENT,
1936 static struct clk_fixed_factor g12a_pcie_pll = {
1939 .hw.init = &(struct clk_init_data){
1940 .name = "pcie_pll_pll",
1941 .ops = &clk_fixed_factor_ops,
1942 .parent_hws = (const struct clk_hw *[]) {
1943 &g12a_pcie_pll_od.hw
1946 .flags = CLK_SET_RATE_PARENT,
1950 static struct clk_regmap g12a_hdmi_pll_dco = {
1951 .data = &(struct meson_clk_pll_data){
1953 .reg_off = HHI_HDMI_PLL_CNTL0,
1958 .reg_off = HHI_HDMI_PLL_CNTL0,
1963 .reg_off = HHI_HDMI_PLL_CNTL0,
1968 .reg_off = HHI_HDMI_PLL_CNTL1,
1973 .reg_off = HHI_HDMI_PLL_CNTL0,
1978 .reg_off = HHI_HDMI_PLL_CNTL0,
1983 .hw.init = &(struct clk_init_data){
1984 .name = "hdmi_pll_dco",
1985 .ops = &meson_clk_pll_ro_ops,
1986 .parent_data = &(const struct clk_parent_data) {
1991 * Display directly handle hdmi pll registers ATM, we need
1992 * NOCACHE to keep our view of the clock as accurate as possible
1994 .flags = CLK_GET_RATE_NOCACHE,
1998 static struct clk_regmap g12a_hdmi_pll_od = {
1999 .data = &(struct clk_regmap_div_data){
2000 .offset = HHI_HDMI_PLL_CNTL0,
2003 .flags = CLK_DIVIDER_POWER_OF_TWO,
2005 .hw.init = &(struct clk_init_data){
2006 .name = "hdmi_pll_od",
2007 .ops = &clk_regmap_divider_ro_ops,
2008 .parent_hws = (const struct clk_hw *[]) {
2009 &g12a_hdmi_pll_dco.hw
2012 .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
2016 static struct clk_regmap g12a_hdmi_pll_od2 = {
2017 .data = &(struct clk_regmap_div_data){
2018 .offset = HHI_HDMI_PLL_CNTL0,
2021 .flags = CLK_DIVIDER_POWER_OF_TWO,
2023 .hw.init = &(struct clk_init_data){
2024 .name = "hdmi_pll_od2",
2025 .ops = &clk_regmap_divider_ro_ops,
2026 .parent_hws = (const struct clk_hw *[]) {
2027 &g12a_hdmi_pll_od.hw
2030 .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
2034 static struct clk_regmap g12a_hdmi_pll = {
2035 .data = &(struct clk_regmap_div_data){
2036 .offset = HHI_HDMI_PLL_CNTL0,
2039 .flags = CLK_DIVIDER_POWER_OF_TWO,
2041 .hw.init = &(struct clk_init_data){
2043 .ops = &clk_regmap_divider_ro_ops,
2044 .parent_hws = (const struct clk_hw *[]) {
2045 &g12a_hdmi_pll_od2.hw
2048 .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
2052 static struct clk_fixed_factor g12a_fclk_div4_div = {
2055 .hw.init = &(struct clk_init_data){
2056 .name = "fclk_div4_div",
2057 .ops = &clk_fixed_factor_ops,
2058 .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
2063 static struct clk_regmap g12a_fclk_div4 = {
2064 .data = &(struct clk_regmap_gate_data){
2065 .offset = HHI_FIX_PLL_CNTL1,
2068 .hw.init = &(struct clk_init_data){
2069 .name = "fclk_div4",
2070 .ops = &clk_regmap_gate_ops,
2071 .parent_hws = (const struct clk_hw *[]) {
2072 &g12a_fclk_div4_div.hw
2078 static struct clk_fixed_factor g12a_fclk_div5_div = {
2081 .hw.init = &(struct clk_init_data){
2082 .name = "fclk_div5_div",
2083 .ops = &clk_fixed_factor_ops,
2084 .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
2089 static struct clk_regmap g12a_fclk_div5 = {
2090 .data = &(struct clk_regmap_gate_data){
2091 .offset = HHI_FIX_PLL_CNTL1,
2094 .hw.init = &(struct clk_init_data){
2095 .name = "fclk_div5",
2096 .ops = &clk_regmap_gate_ops,
2097 .parent_hws = (const struct clk_hw *[]) {
2098 &g12a_fclk_div5_div.hw
2104 static struct clk_fixed_factor g12a_fclk_div7_div = {
2107 .hw.init = &(struct clk_init_data){
2108 .name = "fclk_div7_div",
2109 .ops = &clk_fixed_factor_ops,
2110 .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
2115 static struct clk_regmap g12a_fclk_div7 = {
2116 .data = &(struct clk_regmap_gate_data){
2117 .offset = HHI_FIX_PLL_CNTL1,
2120 .hw.init = &(struct clk_init_data){
2121 .name = "fclk_div7",
2122 .ops = &clk_regmap_gate_ops,
2123 .parent_hws = (const struct clk_hw *[]) {
2124 &g12a_fclk_div7_div.hw
2130 static struct clk_fixed_factor g12a_fclk_div2p5_div = {
2133 .hw.init = &(struct clk_init_data){
2134 .name = "fclk_div2p5_div",
2135 .ops = &clk_fixed_factor_ops,
2136 .parent_hws = (const struct clk_hw *[]) {
2137 &g12a_fixed_pll_dco.hw
2143 static struct clk_regmap g12a_fclk_div2p5 = {
2144 .data = &(struct clk_regmap_gate_data){
2145 .offset = HHI_FIX_PLL_CNTL1,
2148 .hw.init = &(struct clk_init_data){
2149 .name = "fclk_div2p5",
2150 .ops = &clk_regmap_gate_ops,
2151 .parent_hws = (const struct clk_hw *[]) {
2152 &g12a_fclk_div2p5_div.hw
2158 static struct clk_fixed_factor g12a_mpll_50m_div = {
2161 .hw.init = &(struct clk_init_data){
2162 .name = "mpll_50m_div",
2163 .ops = &clk_fixed_factor_ops,
2164 .parent_hws = (const struct clk_hw *[]) {
2165 &g12a_fixed_pll_dco.hw
2171 static struct clk_regmap g12a_mpll_50m = {
2172 .data = &(struct clk_regmap_mux_data){
2173 .offset = HHI_FIX_PLL_CNTL3,
2177 .hw.init = &(struct clk_init_data){
2179 .ops = &clk_regmap_mux_ro_ops,
2180 .parent_data = (const struct clk_parent_data []) {
2181 { .fw_name = "xtal", },
2182 { .hw = &g12a_mpll_50m_div.hw },
2188 static struct clk_fixed_factor g12a_mpll_prediv = {
2191 .hw.init = &(struct clk_init_data){
2192 .name = "mpll_prediv",
2193 .ops = &clk_fixed_factor_ops,
2194 .parent_hws = (const struct clk_hw *[]) {
2195 &g12a_fixed_pll_dco.hw
2201 static const struct reg_sequence g12a_mpll0_init_regs[] = {
2202 { .reg = HHI_MPLL_CNTL2, .def = 0x40000033 },
2205 static struct clk_regmap g12a_mpll0_div = {
2206 .data = &(struct meson_clk_mpll_data){
2208 .reg_off = HHI_MPLL_CNTL1,
2213 .reg_off = HHI_MPLL_CNTL1,
2218 .reg_off = HHI_MPLL_CNTL1,
2223 .reg_off = HHI_MPLL_CNTL1,
2227 .lock = &meson_clk_lock,
2228 .init_regs = g12a_mpll0_init_regs,
2229 .init_count = ARRAY_SIZE(g12a_mpll0_init_regs),
2231 .hw.init = &(struct clk_init_data){
2232 .name = "mpll0_div",
2233 .ops = &meson_clk_mpll_ops,
2234 .parent_hws = (const struct clk_hw *[]) {
2235 &g12a_mpll_prediv.hw
2241 static struct clk_regmap g12a_mpll0 = {
2242 .data = &(struct clk_regmap_gate_data){
2243 .offset = HHI_MPLL_CNTL1,
2246 .hw.init = &(struct clk_init_data){
2248 .ops = &clk_regmap_gate_ops,
2249 .parent_hws = (const struct clk_hw *[]) { &g12a_mpll0_div.hw },
2251 .flags = CLK_SET_RATE_PARENT,
2255 static const struct reg_sequence g12a_mpll1_init_regs[] = {
2256 { .reg = HHI_MPLL_CNTL4, .def = 0x40000033 },
2259 static struct clk_regmap g12a_mpll1_div = {
2260 .data = &(struct meson_clk_mpll_data){
2262 .reg_off = HHI_MPLL_CNTL3,
2267 .reg_off = HHI_MPLL_CNTL3,
2272 .reg_off = HHI_MPLL_CNTL3,
2277 .reg_off = HHI_MPLL_CNTL3,
2281 .lock = &meson_clk_lock,
2282 .init_regs = g12a_mpll1_init_regs,
2283 .init_count = ARRAY_SIZE(g12a_mpll1_init_regs),
2285 .hw.init = &(struct clk_init_data){
2286 .name = "mpll1_div",
2287 .ops = &meson_clk_mpll_ops,
2288 .parent_hws = (const struct clk_hw *[]) {
2289 &g12a_mpll_prediv.hw
2295 static struct clk_regmap g12a_mpll1 = {
2296 .data = &(struct clk_regmap_gate_data){
2297 .offset = HHI_MPLL_CNTL3,
2300 .hw.init = &(struct clk_init_data){
2302 .ops = &clk_regmap_gate_ops,
2303 .parent_hws = (const struct clk_hw *[]) { &g12a_mpll1_div.hw },
2305 .flags = CLK_SET_RATE_PARENT,
2309 static const struct reg_sequence g12a_mpll2_init_regs[] = {
2310 { .reg = HHI_MPLL_CNTL6, .def = 0x40000033 },
2313 static struct clk_regmap g12a_mpll2_div = {
2314 .data = &(struct meson_clk_mpll_data){
2316 .reg_off = HHI_MPLL_CNTL5,
2321 .reg_off = HHI_MPLL_CNTL5,
2326 .reg_off = HHI_MPLL_CNTL5,
2331 .reg_off = HHI_MPLL_CNTL5,
2335 .lock = &meson_clk_lock,
2336 .init_regs = g12a_mpll2_init_regs,
2337 .init_count = ARRAY_SIZE(g12a_mpll2_init_regs),
2339 .hw.init = &(struct clk_init_data){
2340 .name = "mpll2_div",
2341 .ops = &meson_clk_mpll_ops,
2342 .parent_hws = (const struct clk_hw *[]) {
2343 &g12a_mpll_prediv.hw
2349 static struct clk_regmap g12a_mpll2 = {
2350 .data = &(struct clk_regmap_gate_data){
2351 .offset = HHI_MPLL_CNTL5,
2354 .hw.init = &(struct clk_init_data){
2356 .ops = &clk_regmap_gate_ops,
2357 .parent_hws = (const struct clk_hw *[]) { &g12a_mpll2_div.hw },
2359 .flags = CLK_SET_RATE_PARENT,
2363 static const struct reg_sequence g12a_mpll3_init_regs[] = {
2364 { .reg = HHI_MPLL_CNTL8, .def = 0x40000033 },
2367 static struct clk_regmap g12a_mpll3_div = {
2368 .data = &(struct meson_clk_mpll_data){
2370 .reg_off = HHI_MPLL_CNTL7,
2375 .reg_off = HHI_MPLL_CNTL7,
2380 .reg_off = HHI_MPLL_CNTL7,
2385 .reg_off = HHI_MPLL_CNTL7,
2389 .lock = &meson_clk_lock,
2390 .init_regs = g12a_mpll3_init_regs,
2391 .init_count = ARRAY_SIZE(g12a_mpll3_init_regs),
2393 .hw.init = &(struct clk_init_data){
2394 .name = "mpll3_div",
2395 .ops = &meson_clk_mpll_ops,
2396 .parent_hws = (const struct clk_hw *[]) {
2397 &g12a_mpll_prediv.hw
2403 static struct clk_regmap g12a_mpll3 = {
2404 .data = &(struct clk_regmap_gate_data){
2405 .offset = HHI_MPLL_CNTL7,
2408 .hw.init = &(struct clk_init_data){
2410 .ops = &clk_regmap_gate_ops,
2411 .parent_hws = (const struct clk_hw *[]) { &g12a_mpll3_div.hw },
2413 .flags = CLK_SET_RATE_PARENT,
2417 static u32 mux_table_clk81[] = { 0, 2, 3, 4, 5, 6, 7 };
2418 static const struct clk_parent_data clk81_parent_data[] = {
2419 { .fw_name = "xtal", },
2420 { .hw = &g12a_fclk_div7.hw },
2421 { .hw = &g12a_mpll1.hw },
2422 { .hw = &g12a_mpll2.hw },
2423 { .hw = &g12a_fclk_div4.hw },
2424 { .hw = &g12a_fclk_div3.hw },
2425 { .hw = &g12a_fclk_div5.hw },
2428 static struct clk_regmap g12a_mpeg_clk_sel = {
2429 .data = &(struct clk_regmap_mux_data){
2430 .offset = HHI_MPEG_CLK_CNTL,
2433 .table = mux_table_clk81,
2435 .hw.init = &(struct clk_init_data){
2436 .name = "mpeg_clk_sel",
2437 .ops = &clk_regmap_mux_ro_ops,
2438 .parent_data = clk81_parent_data,
2439 .num_parents = ARRAY_SIZE(clk81_parent_data),
2443 static struct clk_regmap g12a_mpeg_clk_div = {
2444 .data = &(struct clk_regmap_div_data){
2445 .offset = HHI_MPEG_CLK_CNTL,
2449 .hw.init = &(struct clk_init_data){
2450 .name = "mpeg_clk_div",
2451 .ops = &clk_regmap_divider_ops,
2452 .parent_hws = (const struct clk_hw *[]) {
2453 &g12a_mpeg_clk_sel.hw
2456 .flags = CLK_SET_RATE_PARENT,
2460 static struct clk_regmap g12a_clk81 = {
2461 .data = &(struct clk_regmap_gate_data){
2462 .offset = HHI_MPEG_CLK_CNTL,
2465 .hw.init = &(struct clk_init_data){
2467 .ops = &clk_regmap_gate_ops,
2468 .parent_hws = (const struct clk_hw *[]) {
2469 &g12a_mpeg_clk_div.hw
2472 .flags = (CLK_SET_RATE_PARENT | CLK_IS_CRITICAL),
2476 static const struct clk_parent_data g12a_sd_emmc_clk0_parent_data[] = {
2477 { .fw_name = "xtal", },
2478 { .hw = &g12a_fclk_div2.hw },
2479 { .hw = &g12a_fclk_div3.hw },
2480 { .hw = &g12a_fclk_div5.hw },
2481 { .hw = &g12a_fclk_div7.hw },
2483 * Following these parent clocks, we should also have had mpll2, mpll3
2484 * and gp0_pll but these clocks are too precious to be used here. All
2485 * the necessary rates for MMC and NAND operation can be acheived using
2486 * g12a_ee_core or fclk_div clocks
2491 static struct clk_regmap g12a_sd_emmc_a_clk0_sel = {
2492 .data = &(struct clk_regmap_mux_data){
2493 .offset = HHI_SD_EMMC_CLK_CNTL,
2497 .hw.init = &(struct clk_init_data) {
2498 .name = "sd_emmc_a_clk0_sel",
2499 .ops = &clk_regmap_mux_ops,
2500 .parent_data = g12a_sd_emmc_clk0_parent_data,
2501 .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data),
2502 .flags = CLK_SET_RATE_PARENT,
2506 static struct clk_regmap g12a_sd_emmc_a_clk0_div = {
2507 .data = &(struct clk_regmap_div_data){
2508 .offset = HHI_SD_EMMC_CLK_CNTL,
2512 .hw.init = &(struct clk_init_data) {
2513 .name = "sd_emmc_a_clk0_div",
2514 .ops = &clk_regmap_divider_ops,
2515 .parent_hws = (const struct clk_hw *[]) {
2516 &g12a_sd_emmc_a_clk0_sel.hw
2519 .flags = CLK_SET_RATE_PARENT,
2523 static struct clk_regmap g12a_sd_emmc_a_clk0 = {
2524 .data = &(struct clk_regmap_gate_data){
2525 .offset = HHI_SD_EMMC_CLK_CNTL,
2528 .hw.init = &(struct clk_init_data){
2529 .name = "sd_emmc_a_clk0",
2530 .ops = &clk_regmap_gate_ops,
2531 .parent_hws = (const struct clk_hw *[]) {
2532 &g12a_sd_emmc_a_clk0_div.hw
2535 .flags = CLK_SET_RATE_PARENT,
2540 static struct clk_regmap g12a_sd_emmc_b_clk0_sel = {
2541 .data = &(struct clk_regmap_mux_data){
2542 .offset = HHI_SD_EMMC_CLK_CNTL,
2546 .hw.init = &(struct clk_init_data) {
2547 .name = "sd_emmc_b_clk0_sel",
2548 .ops = &clk_regmap_mux_ops,
2549 .parent_data = g12a_sd_emmc_clk0_parent_data,
2550 .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data),
2551 .flags = CLK_SET_RATE_PARENT,
2555 static struct clk_regmap g12a_sd_emmc_b_clk0_div = {
2556 .data = &(struct clk_regmap_div_data){
2557 .offset = HHI_SD_EMMC_CLK_CNTL,
2561 .hw.init = &(struct clk_init_data) {
2562 .name = "sd_emmc_b_clk0_div",
2563 .ops = &clk_regmap_divider_ops,
2564 .parent_hws = (const struct clk_hw *[]) {
2565 &g12a_sd_emmc_b_clk0_sel.hw
2568 .flags = CLK_SET_RATE_PARENT,
2572 static struct clk_regmap g12a_sd_emmc_b_clk0 = {
2573 .data = &(struct clk_regmap_gate_data){
2574 .offset = HHI_SD_EMMC_CLK_CNTL,
2577 .hw.init = &(struct clk_init_data){
2578 .name = "sd_emmc_b_clk0",
2579 .ops = &clk_regmap_gate_ops,
2580 .parent_hws = (const struct clk_hw *[]) {
2581 &g12a_sd_emmc_b_clk0_div.hw
2584 .flags = CLK_SET_RATE_PARENT,
2588 /* EMMC/NAND clock */
2589 static struct clk_regmap g12a_sd_emmc_c_clk0_sel = {
2590 .data = &(struct clk_regmap_mux_data){
2591 .offset = HHI_NAND_CLK_CNTL,
2595 .hw.init = &(struct clk_init_data) {
2596 .name = "sd_emmc_c_clk0_sel",
2597 .ops = &clk_regmap_mux_ops,
2598 .parent_data = g12a_sd_emmc_clk0_parent_data,
2599 .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data),
2600 .flags = CLK_SET_RATE_PARENT,
2604 static struct clk_regmap g12a_sd_emmc_c_clk0_div = {
2605 .data = &(struct clk_regmap_div_data){
2606 .offset = HHI_NAND_CLK_CNTL,
2610 .hw.init = &(struct clk_init_data) {
2611 .name = "sd_emmc_c_clk0_div",
2612 .ops = &clk_regmap_divider_ops,
2613 .parent_hws = (const struct clk_hw *[]) {
2614 &g12a_sd_emmc_c_clk0_sel.hw
2617 .flags = CLK_SET_RATE_PARENT,
2621 static struct clk_regmap g12a_sd_emmc_c_clk0 = {
2622 .data = &(struct clk_regmap_gate_data){
2623 .offset = HHI_NAND_CLK_CNTL,
2626 .hw.init = &(struct clk_init_data){
2627 .name = "sd_emmc_c_clk0",
2628 .ops = &clk_regmap_gate_ops,
2629 .parent_hws = (const struct clk_hw *[]) {
2630 &g12a_sd_emmc_c_clk0_div.hw
2633 .flags = CLK_SET_RATE_PARENT,
2639 static struct clk_regmap g12a_vid_pll_div = {
2640 .data = &(struct meson_vid_pll_div_data){
2642 .reg_off = HHI_VID_PLL_CLK_DIV,
2647 .reg_off = HHI_VID_PLL_CLK_DIV,
2652 .hw.init = &(struct clk_init_data) {
2653 .name = "vid_pll_div",
2654 .ops = &meson_vid_pll_div_ro_ops,
2655 .parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_pll.hw },
2657 .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
2661 static const struct clk_hw *g12a_vid_pll_parent_hws[] = {
2662 &g12a_vid_pll_div.hw,
2666 static struct clk_regmap g12a_vid_pll_sel = {
2667 .data = &(struct clk_regmap_mux_data){
2668 .offset = HHI_VID_PLL_CLK_DIV,
2672 .hw.init = &(struct clk_init_data){
2673 .name = "vid_pll_sel",
2674 .ops = &clk_regmap_mux_ops,
2676 * bit 18 selects from 2 possible parents:
2677 * vid_pll_div or hdmi_pll
2679 .parent_hws = g12a_vid_pll_parent_hws,
2680 .num_parents = ARRAY_SIZE(g12a_vid_pll_parent_hws),
2681 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
2685 static struct clk_regmap g12a_vid_pll = {
2686 .data = &(struct clk_regmap_gate_data){
2687 .offset = HHI_VID_PLL_CLK_DIV,
2690 .hw.init = &(struct clk_init_data) {
2692 .ops = &clk_regmap_gate_ops,
2693 .parent_hws = (const struct clk_hw *[]) {
2694 &g12a_vid_pll_sel.hw
2697 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
2703 static const struct clk_hw *g12a_vpu_parent_hws[] = {
2714 static struct clk_regmap g12a_vpu_0_sel = {
2715 .data = &(struct clk_regmap_mux_data){
2716 .offset = HHI_VPU_CLK_CNTL,
2720 .hw.init = &(struct clk_init_data){
2721 .name = "vpu_0_sel",
2722 .ops = &clk_regmap_mux_ops,
2723 .parent_hws = g12a_vpu_parent_hws,
2724 .num_parents = ARRAY_SIZE(g12a_vpu_parent_hws),
2725 .flags = CLK_SET_RATE_NO_REPARENT,
2729 static struct clk_regmap g12a_vpu_0_div = {
2730 .data = &(struct clk_regmap_div_data){
2731 .offset = HHI_VPU_CLK_CNTL,
2735 .hw.init = &(struct clk_init_data){
2736 .name = "vpu_0_div",
2737 .ops = &clk_regmap_divider_ops,
2738 .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_0_sel.hw },
2740 .flags = CLK_SET_RATE_PARENT,
2744 static struct clk_regmap g12a_vpu_0 = {
2745 .data = &(struct clk_regmap_gate_data){
2746 .offset = HHI_VPU_CLK_CNTL,
2749 .hw.init = &(struct clk_init_data) {
2751 .ops = &clk_regmap_gate_ops,
2752 .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_0_div.hw },
2754 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
2758 static struct clk_regmap g12a_vpu_1_sel = {
2759 .data = &(struct clk_regmap_mux_data){
2760 .offset = HHI_VPU_CLK_CNTL,
2764 .hw.init = &(struct clk_init_data){
2765 .name = "vpu_1_sel",
2766 .ops = &clk_regmap_mux_ops,
2767 .parent_hws = g12a_vpu_parent_hws,
2768 .num_parents = ARRAY_SIZE(g12a_vpu_parent_hws),
2769 .flags = CLK_SET_RATE_NO_REPARENT,
2773 static struct clk_regmap g12a_vpu_1_div = {
2774 .data = &(struct clk_regmap_div_data){
2775 .offset = HHI_VPU_CLK_CNTL,
2779 .hw.init = &(struct clk_init_data){
2780 .name = "vpu_1_div",
2781 .ops = &clk_regmap_divider_ops,
2782 .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_1_sel.hw },
2784 .flags = CLK_SET_RATE_PARENT,
2788 static struct clk_regmap g12a_vpu_1 = {
2789 .data = &(struct clk_regmap_gate_data){
2790 .offset = HHI_VPU_CLK_CNTL,
2793 .hw.init = &(struct clk_init_data) {
2795 .ops = &clk_regmap_gate_ops,
2796 .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_1_div.hw },
2798 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
2802 static struct clk_regmap g12a_vpu = {
2803 .data = &(struct clk_regmap_mux_data){
2804 .offset = HHI_VPU_CLK_CNTL,
2808 .hw.init = &(struct clk_init_data){
2810 .ops = &clk_regmap_mux_ops,
2812 * bit 31 selects from 2 possible parents:
2815 .parent_hws = (const struct clk_hw *[]) {
2820 .flags = CLK_SET_RATE_NO_REPARENT,
2826 static const struct clk_hw *g12a_vdec_parent_hws[] = {
2827 &g12a_fclk_div2p5.hw,
2836 static struct clk_regmap g12a_vdec_1_sel = {
2837 .data = &(struct clk_regmap_mux_data){
2838 .offset = HHI_VDEC_CLK_CNTL,
2841 .flags = CLK_MUX_ROUND_CLOSEST,
2843 .hw.init = &(struct clk_init_data){
2844 .name = "vdec_1_sel",
2845 .ops = &clk_regmap_mux_ops,
2846 .parent_hws = g12a_vdec_parent_hws,
2847 .num_parents = ARRAY_SIZE(g12a_vdec_parent_hws),
2848 .flags = CLK_SET_RATE_PARENT,
2852 static struct clk_regmap g12a_vdec_1_div = {
2853 .data = &(struct clk_regmap_div_data){
2854 .offset = HHI_VDEC_CLK_CNTL,
2857 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2859 .hw.init = &(struct clk_init_data){
2860 .name = "vdec_1_div",
2861 .ops = &clk_regmap_divider_ops,
2862 .parent_hws = (const struct clk_hw *[]) {
2866 .flags = CLK_SET_RATE_PARENT,
2870 static struct clk_regmap g12a_vdec_1 = {
2871 .data = &(struct clk_regmap_gate_data){
2872 .offset = HHI_VDEC_CLK_CNTL,
2875 .hw.init = &(struct clk_init_data) {
2877 .ops = &clk_regmap_gate_ops,
2878 .parent_hws = (const struct clk_hw *[]) {
2882 .flags = CLK_SET_RATE_PARENT,
2886 static struct clk_regmap g12a_vdec_hevcf_sel = {
2887 .data = &(struct clk_regmap_mux_data){
2888 .offset = HHI_VDEC2_CLK_CNTL,
2891 .flags = CLK_MUX_ROUND_CLOSEST,
2893 .hw.init = &(struct clk_init_data){
2894 .name = "vdec_hevcf_sel",
2895 .ops = &clk_regmap_mux_ops,
2896 .parent_hws = g12a_vdec_parent_hws,
2897 .num_parents = ARRAY_SIZE(g12a_vdec_parent_hws),
2898 .flags = CLK_SET_RATE_PARENT,
2902 static struct clk_regmap g12a_vdec_hevcf_div = {
2903 .data = &(struct clk_regmap_div_data){
2904 .offset = HHI_VDEC2_CLK_CNTL,
2907 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2909 .hw.init = &(struct clk_init_data){
2910 .name = "vdec_hevcf_div",
2911 .ops = &clk_regmap_divider_ops,
2912 .parent_hws = (const struct clk_hw *[]) {
2913 &g12a_vdec_hevcf_sel.hw
2916 .flags = CLK_SET_RATE_PARENT,
2920 static struct clk_regmap g12a_vdec_hevcf = {
2921 .data = &(struct clk_regmap_gate_data){
2922 .offset = HHI_VDEC2_CLK_CNTL,
2925 .hw.init = &(struct clk_init_data) {
2926 .name = "vdec_hevcf",
2927 .ops = &clk_regmap_gate_ops,
2928 .parent_hws = (const struct clk_hw *[]) {
2929 &g12a_vdec_hevcf_div.hw
2932 .flags = CLK_SET_RATE_PARENT,
2936 static struct clk_regmap g12a_vdec_hevc_sel = {
2937 .data = &(struct clk_regmap_mux_data){
2938 .offset = HHI_VDEC2_CLK_CNTL,
2941 .flags = CLK_MUX_ROUND_CLOSEST,
2943 .hw.init = &(struct clk_init_data){
2944 .name = "vdec_hevc_sel",
2945 .ops = &clk_regmap_mux_ops,
2946 .parent_hws = g12a_vdec_parent_hws,
2947 .num_parents = ARRAY_SIZE(g12a_vdec_parent_hws),
2948 .flags = CLK_SET_RATE_PARENT,
2952 static struct clk_regmap g12a_vdec_hevc_div = {
2953 .data = &(struct clk_regmap_div_data){
2954 .offset = HHI_VDEC2_CLK_CNTL,
2957 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2959 .hw.init = &(struct clk_init_data){
2960 .name = "vdec_hevc_div",
2961 .ops = &clk_regmap_divider_ops,
2962 .parent_hws = (const struct clk_hw *[]) {
2963 &g12a_vdec_hevc_sel.hw
2966 .flags = CLK_SET_RATE_PARENT,
2970 static struct clk_regmap g12a_vdec_hevc = {
2971 .data = &(struct clk_regmap_gate_data){
2972 .offset = HHI_VDEC2_CLK_CNTL,
2975 .hw.init = &(struct clk_init_data) {
2976 .name = "vdec_hevc",
2977 .ops = &clk_regmap_gate_ops,
2978 .parent_hws = (const struct clk_hw *[]) {
2979 &g12a_vdec_hevc_div.hw
2982 .flags = CLK_SET_RATE_PARENT,
2988 static const struct clk_hw *g12a_vapb_parent_hws[] = {
2996 &g12a_fclk_div2p5.hw,
2999 static struct clk_regmap g12a_vapb_0_sel = {
3000 .data = &(struct clk_regmap_mux_data){
3001 .offset = HHI_VAPBCLK_CNTL,
3005 .hw.init = &(struct clk_init_data){
3006 .name = "vapb_0_sel",
3007 .ops = &clk_regmap_mux_ops,
3008 .parent_hws = g12a_vapb_parent_hws,
3009 .num_parents = ARRAY_SIZE(g12a_vapb_parent_hws),
3010 .flags = CLK_SET_RATE_NO_REPARENT,
3014 static struct clk_regmap g12a_vapb_0_div = {
3015 .data = &(struct clk_regmap_div_data){
3016 .offset = HHI_VAPBCLK_CNTL,
3020 .hw.init = &(struct clk_init_data){
3021 .name = "vapb_0_div",
3022 .ops = &clk_regmap_divider_ops,
3023 .parent_hws = (const struct clk_hw *[]) {
3027 .flags = CLK_SET_RATE_PARENT,
3031 static struct clk_regmap g12a_vapb_0 = {
3032 .data = &(struct clk_regmap_gate_data){
3033 .offset = HHI_VAPBCLK_CNTL,
3036 .hw.init = &(struct clk_init_data) {
3038 .ops = &clk_regmap_gate_ops,
3039 .parent_hws = (const struct clk_hw *[]) {
3043 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3047 static struct clk_regmap g12a_vapb_1_sel = {
3048 .data = &(struct clk_regmap_mux_data){
3049 .offset = HHI_VAPBCLK_CNTL,
3053 .hw.init = &(struct clk_init_data){
3054 .name = "vapb_1_sel",
3055 .ops = &clk_regmap_mux_ops,
3056 .parent_hws = g12a_vapb_parent_hws,
3057 .num_parents = ARRAY_SIZE(g12a_vapb_parent_hws),
3058 .flags = CLK_SET_RATE_NO_REPARENT,
3062 static struct clk_regmap g12a_vapb_1_div = {
3063 .data = &(struct clk_regmap_div_data){
3064 .offset = HHI_VAPBCLK_CNTL,
3068 .hw.init = &(struct clk_init_data){
3069 .name = "vapb_1_div",
3070 .ops = &clk_regmap_divider_ops,
3071 .parent_hws = (const struct clk_hw *[]) {
3075 .flags = CLK_SET_RATE_PARENT,
3079 static struct clk_regmap g12a_vapb_1 = {
3080 .data = &(struct clk_regmap_gate_data){
3081 .offset = HHI_VAPBCLK_CNTL,
3084 .hw.init = &(struct clk_init_data) {
3086 .ops = &clk_regmap_gate_ops,
3087 .parent_hws = (const struct clk_hw *[]) {
3091 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3095 static struct clk_regmap g12a_vapb_sel = {
3096 .data = &(struct clk_regmap_mux_data){
3097 .offset = HHI_VAPBCLK_CNTL,
3101 .hw.init = &(struct clk_init_data){
3103 .ops = &clk_regmap_mux_ops,
3105 * bit 31 selects from 2 possible parents:
3108 .parent_hws = (const struct clk_hw *[]) {
3113 .flags = CLK_SET_RATE_NO_REPARENT,
3117 static struct clk_regmap g12a_vapb = {
3118 .data = &(struct clk_regmap_gate_data){
3119 .offset = HHI_VAPBCLK_CNTL,
3122 .hw.init = &(struct clk_init_data) {
3124 .ops = &clk_regmap_gate_ops,
3125 .parent_hws = (const struct clk_hw *[]) { &g12a_vapb_sel.hw },
3127 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3131 static const struct clk_hw *g12a_vclk_parent_hws[] = {
3142 static struct clk_regmap g12a_vclk_sel = {
3143 .data = &(struct clk_regmap_mux_data){
3144 .offset = HHI_VID_CLK_CNTL,
3148 .hw.init = &(struct clk_init_data){
3150 .ops = &clk_regmap_mux_ops,
3151 .parent_hws = g12a_vclk_parent_hws,
3152 .num_parents = ARRAY_SIZE(g12a_vclk_parent_hws),
3153 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3157 static struct clk_regmap g12a_vclk2_sel = {
3158 .data = &(struct clk_regmap_mux_data){
3159 .offset = HHI_VIID_CLK_CNTL,
3163 .hw.init = &(struct clk_init_data){
3164 .name = "vclk2_sel",
3165 .ops = &clk_regmap_mux_ops,
3166 .parent_hws = g12a_vclk_parent_hws,
3167 .num_parents = ARRAY_SIZE(g12a_vclk_parent_hws),
3168 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3172 static struct clk_regmap g12a_vclk_input = {
3173 .data = &(struct clk_regmap_gate_data){
3174 .offset = HHI_VID_CLK_DIV,
3177 .hw.init = &(struct clk_init_data) {
3178 .name = "vclk_input",
3179 .ops = &clk_regmap_gate_ops,
3180 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk_sel.hw },
3182 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3186 static struct clk_regmap g12a_vclk2_input = {
3187 .data = &(struct clk_regmap_gate_data){
3188 .offset = HHI_VIID_CLK_DIV,
3191 .hw.init = &(struct clk_init_data) {
3192 .name = "vclk2_input",
3193 .ops = &clk_regmap_gate_ops,
3194 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2_sel.hw },
3196 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3200 static struct clk_regmap g12a_vclk_div = {
3201 .data = &(struct clk_regmap_div_data){
3202 .offset = HHI_VID_CLK_DIV,
3206 .hw.init = &(struct clk_init_data){
3208 .ops = &clk_regmap_divider_ops,
3209 .parent_hws = (const struct clk_hw *[]) {
3213 .flags = CLK_GET_RATE_NOCACHE,
3217 static struct clk_regmap g12a_vclk2_div = {
3218 .data = &(struct clk_regmap_div_data){
3219 .offset = HHI_VIID_CLK_DIV,
3223 .hw.init = &(struct clk_init_data){
3224 .name = "vclk2_div",
3225 .ops = &clk_regmap_divider_ops,
3226 .parent_hws = (const struct clk_hw *[]) {
3227 &g12a_vclk2_input.hw
3230 .flags = CLK_GET_RATE_NOCACHE,
3234 static struct clk_regmap g12a_vclk = {
3235 .data = &(struct clk_regmap_gate_data){
3236 .offset = HHI_VID_CLK_CNTL,
3239 .hw.init = &(struct clk_init_data) {
3241 .ops = &clk_regmap_gate_ops,
3242 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk_div.hw },
3244 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3248 static struct clk_regmap g12a_vclk2 = {
3249 .data = &(struct clk_regmap_gate_data){
3250 .offset = HHI_VIID_CLK_CNTL,
3253 .hw.init = &(struct clk_init_data) {
3255 .ops = &clk_regmap_gate_ops,
3256 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2_div.hw },
3258 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3262 static struct clk_regmap g12a_vclk_div1 = {
3263 .data = &(struct clk_regmap_gate_data){
3264 .offset = HHI_VID_CLK_CNTL,
3267 .hw.init = &(struct clk_init_data) {
3268 .name = "vclk_div1",
3269 .ops = &clk_regmap_gate_ops,
3270 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3272 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3276 static struct clk_regmap g12a_vclk_div2_en = {
3277 .data = &(struct clk_regmap_gate_data){
3278 .offset = HHI_VID_CLK_CNTL,
3281 .hw.init = &(struct clk_init_data) {
3282 .name = "vclk_div2_en",
3283 .ops = &clk_regmap_gate_ops,
3284 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3286 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3290 static struct clk_regmap g12a_vclk_div4_en = {
3291 .data = &(struct clk_regmap_gate_data){
3292 .offset = HHI_VID_CLK_CNTL,
3295 .hw.init = &(struct clk_init_data) {
3296 .name = "vclk_div4_en",
3297 .ops = &clk_regmap_gate_ops,
3298 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3300 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3304 static struct clk_regmap g12a_vclk_div6_en = {
3305 .data = &(struct clk_regmap_gate_data){
3306 .offset = HHI_VID_CLK_CNTL,
3309 .hw.init = &(struct clk_init_data) {
3310 .name = "vclk_div6_en",
3311 .ops = &clk_regmap_gate_ops,
3312 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3314 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3318 static struct clk_regmap g12a_vclk_div12_en = {
3319 .data = &(struct clk_regmap_gate_data){
3320 .offset = HHI_VID_CLK_CNTL,
3323 .hw.init = &(struct clk_init_data) {
3324 .name = "vclk_div12_en",
3325 .ops = &clk_regmap_gate_ops,
3326 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3328 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3332 static struct clk_regmap g12a_vclk2_div1 = {
3333 .data = &(struct clk_regmap_gate_data){
3334 .offset = HHI_VIID_CLK_CNTL,
3337 .hw.init = &(struct clk_init_data) {
3338 .name = "vclk2_div1",
3339 .ops = &clk_regmap_gate_ops,
3340 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3342 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3346 static struct clk_regmap g12a_vclk2_div2_en = {
3347 .data = &(struct clk_regmap_gate_data){
3348 .offset = HHI_VIID_CLK_CNTL,
3351 .hw.init = &(struct clk_init_data) {
3352 .name = "vclk2_div2_en",
3353 .ops = &clk_regmap_gate_ops,
3354 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3356 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3360 static struct clk_regmap g12a_vclk2_div4_en = {
3361 .data = &(struct clk_regmap_gate_data){
3362 .offset = HHI_VIID_CLK_CNTL,
3365 .hw.init = &(struct clk_init_data) {
3366 .name = "vclk2_div4_en",
3367 .ops = &clk_regmap_gate_ops,
3368 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3370 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3374 static struct clk_regmap g12a_vclk2_div6_en = {
3375 .data = &(struct clk_regmap_gate_data){
3376 .offset = HHI_VIID_CLK_CNTL,
3379 .hw.init = &(struct clk_init_data) {
3380 .name = "vclk2_div6_en",
3381 .ops = &clk_regmap_gate_ops,
3382 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3384 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3388 static struct clk_regmap g12a_vclk2_div12_en = {
3389 .data = &(struct clk_regmap_gate_data){
3390 .offset = HHI_VIID_CLK_CNTL,
3393 .hw.init = &(struct clk_init_data) {
3394 .name = "vclk2_div12_en",
3395 .ops = &clk_regmap_gate_ops,
3396 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3398 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3402 static struct clk_fixed_factor g12a_vclk_div2 = {
3405 .hw.init = &(struct clk_init_data){
3406 .name = "vclk_div2",
3407 .ops = &clk_fixed_factor_ops,
3408 .parent_hws = (const struct clk_hw *[]) {
3409 &g12a_vclk_div2_en.hw
3415 static struct clk_fixed_factor g12a_vclk_div4 = {
3418 .hw.init = &(struct clk_init_data){
3419 .name = "vclk_div4",
3420 .ops = &clk_fixed_factor_ops,
3421 .parent_hws = (const struct clk_hw *[]) {
3422 &g12a_vclk_div4_en.hw
3428 static struct clk_fixed_factor g12a_vclk_div6 = {
3431 .hw.init = &(struct clk_init_data){
3432 .name = "vclk_div6",
3433 .ops = &clk_fixed_factor_ops,
3434 .parent_hws = (const struct clk_hw *[]) {
3435 &g12a_vclk_div6_en.hw
3441 static struct clk_fixed_factor g12a_vclk_div12 = {
3444 .hw.init = &(struct clk_init_data){
3445 .name = "vclk_div12",
3446 .ops = &clk_fixed_factor_ops,
3447 .parent_hws = (const struct clk_hw *[]) {
3448 &g12a_vclk_div12_en.hw
3454 static struct clk_fixed_factor g12a_vclk2_div2 = {
3457 .hw.init = &(struct clk_init_data){
3458 .name = "vclk2_div2",
3459 .ops = &clk_fixed_factor_ops,
3460 .parent_hws = (const struct clk_hw *[]) {
3461 &g12a_vclk2_div2_en.hw
3467 static struct clk_fixed_factor g12a_vclk2_div4 = {
3470 .hw.init = &(struct clk_init_data){
3471 .name = "vclk2_div4",
3472 .ops = &clk_fixed_factor_ops,
3473 .parent_hws = (const struct clk_hw *[]) {
3474 &g12a_vclk2_div4_en.hw
3480 static struct clk_fixed_factor g12a_vclk2_div6 = {
3483 .hw.init = &(struct clk_init_data){
3484 .name = "vclk2_div6",
3485 .ops = &clk_fixed_factor_ops,
3486 .parent_hws = (const struct clk_hw *[]) {
3487 &g12a_vclk2_div6_en.hw
3493 static struct clk_fixed_factor g12a_vclk2_div12 = {
3496 .hw.init = &(struct clk_init_data){
3497 .name = "vclk2_div12",
3498 .ops = &clk_fixed_factor_ops,
3499 .parent_hws = (const struct clk_hw *[]) {
3500 &g12a_vclk2_div12_en.hw
3506 static u32 mux_table_cts_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 };
3507 static const struct clk_hw *g12a_cts_parent_hws[] = {
3512 &g12a_vclk_div12.hw,
3513 &g12a_vclk2_div1.hw,
3514 &g12a_vclk2_div2.hw,
3515 &g12a_vclk2_div4.hw,
3516 &g12a_vclk2_div6.hw,
3517 &g12a_vclk2_div12.hw,
3520 static struct clk_regmap g12a_cts_enci_sel = {
3521 .data = &(struct clk_regmap_mux_data){
3522 .offset = HHI_VID_CLK_DIV,
3525 .table = mux_table_cts_sel,
3527 .hw.init = &(struct clk_init_data){
3528 .name = "cts_enci_sel",
3529 .ops = &clk_regmap_mux_ops,
3530 .parent_hws = g12a_cts_parent_hws,
3531 .num_parents = ARRAY_SIZE(g12a_cts_parent_hws),
3532 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3536 static struct clk_regmap g12a_cts_encp_sel = {
3537 .data = &(struct clk_regmap_mux_data){
3538 .offset = HHI_VID_CLK_DIV,
3541 .table = mux_table_cts_sel,
3543 .hw.init = &(struct clk_init_data){
3544 .name = "cts_encp_sel",
3545 .ops = &clk_regmap_mux_ops,
3546 .parent_hws = g12a_cts_parent_hws,
3547 .num_parents = ARRAY_SIZE(g12a_cts_parent_hws),
3548 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3552 static struct clk_regmap g12a_cts_encl_sel = {
3553 .data = &(struct clk_regmap_mux_data){
3554 .offset = HHI_VIID_CLK_DIV,
3557 .table = mux_table_cts_sel,
3559 .hw.init = &(struct clk_init_data){
3560 .name = "cts_encl_sel",
3561 .ops = &clk_regmap_mux_ops,
3562 .parent_hws = g12a_cts_parent_hws,
3563 .num_parents = ARRAY_SIZE(g12a_cts_parent_hws),
3564 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3568 static struct clk_regmap g12a_cts_vdac_sel = {
3569 .data = &(struct clk_regmap_mux_data){
3570 .offset = HHI_VIID_CLK_DIV,
3573 .table = mux_table_cts_sel,
3575 .hw.init = &(struct clk_init_data){
3576 .name = "cts_vdac_sel",
3577 .ops = &clk_regmap_mux_ops,
3578 .parent_hws = g12a_cts_parent_hws,
3579 .num_parents = ARRAY_SIZE(g12a_cts_parent_hws),
3580 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3584 /* TOFIX: add support for cts_tcon */
3585 static u32 mux_table_hdmi_tx_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 };
3586 static const struct clk_hw *g12a_cts_hdmi_tx_parent_hws[] = {
3591 &g12a_vclk_div12.hw,
3592 &g12a_vclk2_div1.hw,
3593 &g12a_vclk2_div2.hw,
3594 &g12a_vclk2_div4.hw,
3595 &g12a_vclk2_div6.hw,
3596 &g12a_vclk2_div12.hw,
3599 static struct clk_regmap g12a_hdmi_tx_sel = {
3600 .data = &(struct clk_regmap_mux_data){
3601 .offset = HHI_HDMI_CLK_CNTL,
3604 .table = mux_table_hdmi_tx_sel,
3606 .hw.init = &(struct clk_init_data){
3607 .name = "hdmi_tx_sel",
3608 .ops = &clk_regmap_mux_ops,
3609 .parent_hws = g12a_cts_hdmi_tx_parent_hws,
3610 .num_parents = ARRAY_SIZE(g12a_cts_hdmi_tx_parent_hws),
3611 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3615 static struct clk_regmap g12a_cts_enci = {
3616 .data = &(struct clk_regmap_gate_data){
3617 .offset = HHI_VID_CLK_CNTL2,
3620 .hw.init = &(struct clk_init_data) {
3622 .ops = &clk_regmap_gate_ops,
3623 .parent_hws = (const struct clk_hw *[]) {
3624 &g12a_cts_enci_sel.hw
3627 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3631 static struct clk_regmap g12a_cts_encp = {
3632 .data = &(struct clk_regmap_gate_data){
3633 .offset = HHI_VID_CLK_CNTL2,
3636 .hw.init = &(struct clk_init_data) {
3638 .ops = &clk_regmap_gate_ops,
3639 .parent_hws = (const struct clk_hw *[]) {
3640 &g12a_cts_encp_sel.hw
3643 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3647 static struct clk_regmap g12a_cts_encl = {
3648 .data = &(struct clk_regmap_gate_data){
3649 .offset = HHI_VID_CLK_CNTL2,
3652 .hw.init = &(struct clk_init_data) {
3654 .ops = &clk_regmap_gate_ops,
3655 .parent_hws = (const struct clk_hw *[]) {
3656 &g12a_cts_encl_sel.hw
3659 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3663 static struct clk_regmap g12a_cts_vdac = {
3664 .data = &(struct clk_regmap_gate_data){
3665 .offset = HHI_VID_CLK_CNTL2,
3668 .hw.init = &(struct clk_init_data) {
3670 .ops = &clk_regmap_gate_ops,
3671 .parent_hws = (const struct clk_hw *[]) {
3672 &g12a_cts_vdac_sel.hw
3675 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3679 static struct clk_regmap g12a_hdmi_tx = {
3680 .data = &(struct clk_regmap_gate_data){
3681 .offset = HHI_VID_CLK_CNTL2,
3684 .hw.init = &(struct clk_init_data) {
3686 .ops = &clk_regmap_gate_ops,
3687 .parent_hws = (const struct clk_hw *[]) {
3688 &g12a_hdmi_tx_sel.hw
3691 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3695 /* MIPI DSI Host Clocks */
3697 static const struct clk_hw *g12a_mipi_dsi_pxclk_parent_hws[] = {
3703 &g12a_fclk_div2p5.hw,
3708 static struct clk_regmap g12a_mipi_dsi_pxclk_sel = {
3709 .data = &(struct clk_regmap_mux_data){
3710 .offset = HHI_MIPIDSI_PHY_CLK_CNTL,
3713 .flags = CLK_MUX_ROUND_CLOSEST,
3715 .hw.init = &(struct clk_init_data){
3716 .name = "mipi_dsi_pxclk_sel",
3717 .ops = &clk_regmap_mux_ops,
3718 .parent_hws = g12a_mipi_dsi_pxclk_parent_hws,
3719 .num_parents = ARRAY_SIZE(g12a_mipi_dsi_pxclk_parent_hws),
3720 .flags = CLK_SET_RATE_NO_REPARENT,
3724 static struct clk_regmap g12a_mipi_dsi_pxclk_div = {
3725 .data = &(struct clk_regmap_div_data){
3726 .offset = HHI_MIPIDSI_PHY_CLK_CNTL,
3730 .hw.init = &(struct clk_init_data){
3731 .name = "mipi_dsi_pxclk_div",
3732 .ops = &clk_regmap_divider_ops,
3733 .parent_hws = (const struct clk_hw *[]) {
3734 &g12a_mipi_dsi_pxclk_sel.hw
3737 .flags = CLK_SET_RATE_PARENT,
3741 static struct clk_regmap g12a_mipi_dsi_pxclk = {
3742 .data = &(struct clk_regmap_gate_data){
3743 .offset = HHI_MIPIDSI_PHY_CLK_CNTL,
3746 .hw.init = &(struct clk_init_data) {
3747 .name = "mipi_dsi_pxclk",
3748 .ops = &clk_regmap_gate_ops,
3749 .parent_hws = (const struct clk_hw *[]) {
3750 &g12a_mipi_dsi_pxclk_div.hw
3753 .flags = CLK_SET_RATE_PARENT,
3757 /* MIPI ISP Clocks */
3759 static const struct clk_parent_data g12b_mipi_isp_parent_data[] = {
3760 { .fw_name = "xtal", },
3761 { .hw = &g12a_gp0_pll.hw },
3762 { .hw = &g12a_hifi_pll.hw },
3763 { .hw = &g12a_fclk_div2p5.hw },
3764 { .hw = &g12a_fclk_div3.hw },
3765 { .hw = &g12a_fclk_div4.hw },
3766 { .hw = &g12a_fclk_div5.hw },
3767 { .hw = &g12a_fclk_div7.hw },
3770 static struct clk_regmap g12b_mipi_isp_sel = {
3771 .data = &(struct clk_regmap_mux_data){
3772 .offset = HHI_ISP_CLK_CNTL,
3776 .hw.init = &(struct clk_init_data){
3777 .name = "mipi_isp_sel",
3778 .ops = &clk_regmap_mux_ops,
3779 .parent_data = g12b_mipi_isp_parent_data,
3780 .num_parents = ARRAY_SIZE(g12b_mipi_isp_parent_data),
3784 static struct clk_regmap g12b_mipi_isp_div = {
3785 .data = &(struct clk_regmap_div_data){
3786 .offset = HHI_ISP_CLK_CNTL,
3790 .hw.init = &(struct clk_init_data){
3791 .name = "mipi_isp_div",
3792 .ops = &clk_regmap_divider_ops,
3793 .parent_hws = (const struct clk_hw *[]) {
3794 &g12b_mipi_isp_sel.hw
3797 .flags = CLK_SET_RATE_PARENT,
3801 static struct clk_regmap g12b_mipi_isp = {
3802 .data = &(struct clk_regmap_gate_data){
3803 .offset = HHI_ISP_CLK_CNTL,
3806 .hw.init = &(struct clk_init_data) {
3808 .ops = &clk_regmap_gate_ops,
3809 .parent_hws = (const struct clk_hw *[]) {
3810 &g12b_mipi_isp_div.hw
3813 .flags = CLK_SET_RATE_PARENT,
3819 static const struct clk_parent_data g12a_hdmi_parent_data[] = {
3820 { .fw_name = "xtal", },
3821 { .hw = &g12a_fclk_div4.hw },
3822 { .hw = &g12a_fclk_div3.hw },
3823 { .hw = &g12a_fclk_div5.hw },
3826 static struct clk_regmap g12a_hdmi_sel = {
3827 .data = &(struct clk_regmap_mux_data){
3828 .offset = HHI_HDMI_CLK_CNTL,
3831 .flags = CLK_MUX_ROUND_CLOSEST,
3833 .hw.init = &(struct clk_init_data){
3835 .ops = &clk_regmap_mux_ops,
3836 .parent_data = g12a_hdmi_parent_data,
3837 .num_parents = ARRAY_SIZE(g12a_hdmi_parent_data),
3838 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3842 static struct clk_regmap g12a_hdmi_div = {
3843 .data = &(struct clk_regmap_div_data){
3844 .offset = HHI_HDMI_CLK_CNTL,
3848 .hw.init = &(struct clk_init_data){
3850 .ops = &clk_regmap_divider_ops,
3851 .parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_sel.hw },
3853 .flags = CLK_GET_RATE_NOCACHE,
3857 static struct clk_regmap g12a_hdmi = {
3858 .data = &(struct clk_regmap_gate_data){
3859 .offset = HHI_HDMI_CLK_CNTL,
3862 .hw.init = &(struct clk_init_data) {
3864 .ops = &clk_regmap_gate_ops,
3865 .parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_div.hw },
3867 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3872 * The MALI IP is clocked by two identical clocks (mali_0 and mali_1)
3873 * muxed by a glitch-free switch. The CCF can manage this glitch-free
3874 * mux because it does top-to-bottom updates the each clock tree and
3875 * switches to the "inactive" one when CLK_SET_RATE_GATE is set.
3877 static const struct clk_parent_data g12a_mali_0_1_parent_data[] = {
3878 { .fw_name = "xtal", },
3879 { .hw = &g12a_gp0_pll.hw },
3880 { .hw = &g12a_hifi_pll.hw },
3881 { .hw = &g12a_fclk_div2p5.hw },
3882 { .hw = &g12a_fclk_div3.hw },
3883 { .hw = &g12a_fclk_div4.hw },
3884 { .hw = &g12a_fclk_div5.hw },
3885 { .hw = &g12a_fclk_div7.hw },
3888 static struct clk_regmap g12a_mali_0_sel = {
3889 .data = &(struct clk_regmap_mux_data){
3890 .offset = HHI_MALI_CLK_CNTL,
3894 .hw.init = &(struct clk_init_data){
3895 .name = "mali_0_sel",
3896 .ops = &clk_regmap_mux_ops,
3897 .parent_data = g12a_mali_0_1_parent_data,
3900 * Don't request the parent to change the rate because
3901 * all GPU frequencies can be derived from the fclk_*
3902 * clocks and one special GP0_PLL setting. This is
3903 * important because we need the MPLL clocks for audio.
3909 static struct clk_regmap g12a_mali_0_div = {
3910 .data = &(struct clk_regmap_div_data){
3911 .offset = HHI_MALI_CLK_CNTL,
3915 .hw.init = &(struct clk_init_data){
3916 .name = "mali_0_div",
3917 .ops = &clk_regmap_divider_ops,
3918 .parent_hws = (const struct clk_hw *[]) {
3922 .flags = CLK_SET_RATE_PARENT,
3926 static struct clk_regmap g12a_mali_0 = {
3927 .data = &(struct clk_regmap_gate_data){
3928 .offset = HHI_MALI_CLK_CNTL,
3931 .hw.init = &(struct clk_init_data){
3933 .ops = &clk_regmap_gate_ops,
3934 .parent_hws = (const struct clk_hw *[]) {
3938 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
3942 static struct clk_regmap g12a_mali_1_sel = {
3943 .data = &(struct clk_regmap_mux_data){
3944 .offset = HHI_MALI_CLK_CNTL,
3948 .hw.init = &(struct clk_init_data){
3949 .name = "mali_1_sel",
3950 .ops = &clk_regmap_mux_ops,
3951 .parent_data = g12a_mali_0_1_parent_data,
3954 * Don't request the parent to change the rate because
3955 * all GPU frequencies can be derived from the fclk_*
3956 * clocks and one special GP0_PLL setting. This is
3957 * important because we need the MPLL clocks for audio.
3963 static struct clk_regmap g12a_mali_1_div = {
3964 .data = &(struct clk_regmap_div_data){
3965 .offset = HHI_MALI_CLK_CNTL,
3969 .hw.init = &(struct clk_init_data){
3970 .name = "mali_1_div",
3971 .ops = &clk_regmap_divider_ops,
3972 .parent_hws = (const struct clk_hw *[]) {
3976 .flags = CLK_SET_RATE_PARENT,
3980 static struct clk_regmap g12a_mali_1 = {
3981 .data = &(struct clk_regmap_gate_data){
3982 .offset = HHI_MALI_CLK_CNTL,
3985 .hw.init = &(struct clk_init_data){
3987 .ops = &clk_regmap_gate_ops,
3988 .parent_hws = (const struct clk_hw *[]) {
3992 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
3996 static const struct clk_hw *g12a_mali_parent_hws[] = {
4001 static struct clk_regmap g12a_mali = {
4002 .data = &(struct clk_regmap_mux_data){
4003 .offset = HHI_MALI_CLK_CNTL,
4007 .hw.init = &(struct clk_init_data){
4009 .ops = &clk_regmap_mux_ops,
4010 .parent_hws = g12a_mali_parent_hws,
4012 .flags = CLK_SET_RATE_PARENT,
4016 static struct clk_regmap g12a_ts_div = {
4017 .data = &(struct clk_regmap_div_data){
4018 .offset = HHI_TS_CLK_CNTL,
4022 .hw.init = &(struct clk_init_data){
4024 .ops = &clk_regmap_divider_ro_ops,
4025 .parent_data = &(const struct clk_parent_data) {
4032 static struct clk_regmap g12a_ts = {
4033 .data = &(struct clk_regmap_gate_data){
4034 .offset = HHI_TS_CLK_CNTL,
4037 .hw.init = &(struct clk_init_data){
4039 .ops = &clk_regmap_gate_ops,
4040 .parent_hws = (const struct clk_hw *[]) {
4047 /* SPICC SCLK source clock */
4049 static const struct clk_parent_data spicc_sclk_parent_data[] = {
4050 { .fw_name = "xtal", },
4051 { .hw = &g12a_clk81.hw },
4052 { .hw = &g12a_fclk_div4.hw },
4053 { .hw = &g12a_fclk_div3.hw },
4054 { .hw = &g12a_fclk_div5.hw },
4055 { .hw = &g12a_fclk_div7.hw },
4058 static struct clk_regmap g12a_spicc0_sclk_sel = {
4059 .data = &(struct clk_regmap_mux_data){
4060 .offset = HHI_SPICC_CLK_CNTL,
4064 .hw.init = &(struct clk_init_data){
4065 .name = "spicc0_sclk_sel",
4066 .ops = &clk_regmap_mux_ops,
4067 .parent_data = spicc_sclk_parent_data,
4068 .num_parents = ARRAY_SIZE(spicc_sclk_parent_data),
4072 static struct clk_regmap g12a_spicc0_sclk_div = {
4073 .data = &(struct clk_regmap_div_data){
4074 .offset = HHI_SPICC_CLK_CNTL,
4078 .hw.init = &(struct clk_init_data){
4079 .name = "spicc0_sclk_div",
4080 .ops = &clk_regmap_divider_ops,
4081 .parent_hws = (const struct clk_hw *[]) {
4082 &g12a_spicc0_sclk_sel.hw
4085 .flags = CLK_SET_RATE_PARENT,
4089 static struct clk_regmap g12a_spicc0_sclk = {
4090 .data = &(struct clk_regmap_gate_data){
4091 .offset = HHI_SPICC_CLK_CNTL,
4094 .hw.init = &(struct clk_init_data){
4095 .name = "spicc0_sclk",
4096 .ops = &clk_regmap_gate_ops,
4097 .parent_hws = (const struct clk_hw *[]) {
4098 &g12a_spicc0_sclk_div.hw
4101 .flags = CLK_SET_RATE_PARENT,
4105 static struct clk_regmap g12a_spicc1_sclk_sel = {
4106 .data = &(struct clk_regmap_mux_data){
4107 .offset = HHI_SPICC_CLK_CNTL,
4111 .hw.init = &(struct clk_init_data){
4112 .name = "spicc1_sclk_sel",
4113 .ops = &clk_regmap_mux_ops,
4114 .parent_data = spicc_sclk_parent_data,
4115 .num_parents = ARRAY_SIZE(spicc_sclk_parent_data),
4119 static struct clk_regmap g12a_spicc1_sclk_div = {
4120 .data = &(struct clk_regmap_div_data){
4121 .offset = HHI_SPICC_CLK_CNTL,
4125 .hw.init = &(struct clk_init_data){
4126 .name = "spicc1_sclk_div",
4127 .ops = &clk_regmap_divider_ops,
4128 .parent_hws = (const struct clk_hw *[]) {
4129 &g12a_spicc1_sclk_sel.hw
4132 .flags = CLK_SET_RATE_PARENT,
4136 static struct clk_regmap g12a_spicc1_sclk = {
4137 .data = &(struct clk_regmap_gate_data){
4138 .offset = HHI_SPICC_CLK_CNTL,
4141 .hw.init = &(struct clk_init_data){
4142 .name = "spicc1_sclk",
4143 .ops = &clk_regmap_gate_ops,
4144 .parent_hws = (const struct clk_hw *[]) {
4145 &g12a_spicc1_sclk_div.hw
4148 .flags = CLK_SET_RATE_PARENT,
4152 /* Neural Network Accelerator source clock */
4154 static const struct clk_parent_data nna_clk_parent_data[] = {
4155 { .fw_name = "xtal", },
4156 { .hw = &g12a_gp0_pll.hw, },
4157 { .hw = &g12a_hifi_pll.hw, },
4158 { .hw = &g12a_fclk_div2p5.hw, },
4159 { .hw = &g12a_fclk_div3.hw, },
4160 { .hw = &g12a_fclk_div4.hw, },
4161 { .hw = &g12a_fclk_div5.hw, },
4162 { .hw = &g12a_fclk_div7.hw },
4165 static struct clk_regmap sm1_nna_axi_clk_sel = {
4166 .data = &(struct clk_regmap_mux_data){
4167 .offset = HHI_NNA_CLK_CNTL,
4171 .hw.init = &(struct clk_init_data){
4172 .name = "nna_axi_clk_sel",
4173 .ops = &clk_regmap_mux_ops,
4174 .parent_data = nna_clk_parent_data,
4175 .num_parents = ARRAY_SIZE(nna_clk_parent_data),
4179 static struct clk_regmap sm1_nna_axi_clk_div = {
4180 .data = &(struct clk_regmap_div_data){
4181 .offset = HHI_NNA_CLK_CNTL,
4185 .hw.init = &(struct clk_init_data){
4186 .name = "nna_axi_clk_div",
4187 .ops = &clk_regmap_divider_ops,
4188 .parent_hws = (const struct clk_hw *[]) {
4189 &sm1_nna_axi_clk_sel.hw
4192 .flags = CLK_SET_RATE_PARENT,
4196 static struct clk_regmap sm1_nna_axi_clk = {
4197 .data = &(struct clk_regmap_gate_data){
4198 .offset = HHI_NNA_CLK_CNTL,
4201 .hw.init = &(struct clk_init_data){
4202 .name = "nna_axi_clk",
4203 .ops = &clk_regmap_gate_ops,
4204 .parent_hws = (const struct clk_hw *[]) {
4205 &sm1_nna_axi_clk_div.hw
4208 .flags = CLK_SET_RATE_PARENT,
4212 static struct clk_regmap sm1_nna_core_clk_sel = {
4213 .data = &(struct clk_regmap_mux_data){
4214 .offset = HHI_NNA_CLK_CNTL,
4218 .hw.init = &(struct clk_init_data){
4219 .name = "nna_core_clk_sel",
4220 .ops = &clk_regmap_mux_ops,
4221 .parent_data = nna_clk_parent_data,
4222 .num_parents = ARRAY_SIZE(nna_clk_parent_data),
4226 static struct clk_regmap sm1_nna_core_clk_div = {
4227 .data = &(struct clk_regmap_div_data){
4228 .offset = HHI_NNA_CLK_CNTL,
4232 .hw.init = &(struct clk_init_data){
4233 .name = "nna_core_clk_div",
4234 .ops = &clk_regmap_divider_ops,
4235 .parent_hws = (const struct clk_hw *[]) {
4236 &sm1_nna_core_clk_sel.hw
4239 .flags = CLK_SET_RATE_PARENT,
4243 static struct clk_regmap sm1_nna_core_clk = {
4244 .data = &(struct clk_regmap_gate_data){
4245 .offset = HHI_NNA_CLK_CNTL,
4248 .hw.init = &(struct clk_init_data){
4249 .name = "nna_core_clk",
4250 .ops = &clk_regmap_gate_ops,
4251 .parent_hws = (const struct clk_hw *[]) {
4252 &sm1_nna_core_clk_div.hw
4255 .flags = CLK_SET_RATE_PARENT,
4259 #define MESON_GATE(_name, _reg, _bit) \
4260 MESON_PCLK(_name, _reg, _bit, &g12a_clk81.hw)
4262 #define MESON_GATE_RO(_name, _reg, _bit) \
4263 MESON_PCLK_RO(_name, _reg, _bit, &g12a_clk81.hw)
4265 /* Everything Else (EE) domain gates */
4266 static MESON_GATE(g12a_ddr, HHI_GCLK_MPEG0, 0);
4267 static MESON_GATE(g12a_dos, HHI_GCLK_MPEG0, 1);
4268 static MESON_GATE(g12a_audio_locker, HHI_GCLK_MPEG0, 2);
4269 static MESON_GATE(g12a_mipi_dsi_host, HHI_GCLK_MPEG0, 3);
4270 static MESON_GATE(g12a_eth_phy, HHI_GCLK_MPEG0, 4);
4271 static MESON_GATE(g12a_isa, HHI_GCLK_MPEG0, 5);
4272 static MESON_GATE(g12a_pl301, HHI_GCLK_MPEG0, 6);
4273 static MESON_GATE(g12a_periphs, HHI_GCLK_MPEG0, 7);
4274 static MESON_GATE(g12a_spicc_0, HHI_GCLK_MPEG0, 8);
4275 static MESON_GATE(g12a_i2c, HHI_GCLK_MPEG0, 9);
4276 static MESON_GATE(g12a_sana, HHI_GCLK_MPEG0, 10);
4277 static MESON_GATE(g12a_sd, HHI_GCLK_MPEG0, 11);
4278 static MESON_GATE(g12a_rng0, HHI_GCLK_MPEG0, 12);
4279 static MESON_GATE(g12a_uart0, HHI_GCLK_MPEG0, 13);
4280 static MESON_GATE(g12a_spicc_1, HHI_GCLK_MPEG0, 14);
4281 static MESON_GATE(g12a_hiu_reg, HHI_GCLK_MPEG0, 19);
4282 static MESON_GATE(g12a_mipi_dsi_phy, HHI_GCLK_MPEG0, 20);
4283 static MESON_GATE(g12a_assist_misc, HHI_GCLK_MPEG0, 23);
4284 static MESON_GATE(g12a_emmc_a, HHI_GCLK_MPEG0, 4);
4285 static MESON_GATE(g12a_emmc_b, HHI_GCLK_MPEG0, 25);
4286 static MESON_GATE(g12a_emmc_c, HHI_GCLK_MPEG0, 26);
4287 static MESON_GATE(g12a_audio_codec, HHI_GCLK_MPEG0, 28);
4289 static MESON_GATE(g12a_audio, HHI_GCLK_MPEG1, 0);
4290 static MESON_GATE(g12a_eth_core, HHI_GCLK_MPEG1, 3);
4291 static MESON_GATE(g12a_demux, HHI_GCLK_MPEG1, 4);
4292 static MESON_GATE(g12a_audio_ififo, HHI_GCLK_MPEG1, 11);
4293 static MESON_GATE(g12a_adc, HHI_GCLK_MPEG1, 13);
4294 static MESON_GATE(g12a_uart1, HHI_GCLK_MPEG1, 16);
4295 static MESON_GATE(g12a_g2d, HHI_GCLK_MPEG1, 20);
4296 static MESON_GATE(g12a_reset, HHI_GCLK_MPEG1, 23);
4297 static MESON_GATE(g12a_pcie_comb, HHI_GCLK_MPEG1, 24);
4298 static MESON_GATE(g12a_parser, HHI_GCLK_MPEG1, 25);
4299 static MESON_GATE(g12a_usb_general, HHI_GCLK_MPEG1, 26);
4300 static MESON_GATE(g12a_pcie_phy, HHI_GCLK_MPEG1, 27);
4301 static MESON_GATE(g12a_ahb_arb0, HHI_GCLK_MPEG1, 29);
4303 static MESON_GATE(g12a_ahb_data_bus, HHI_GCLK_MPEG2, 1);
4304 static MESON_GATE(g12a_ahb_ctrl_bus, HHI_GCLK_MPEG2, 2);
4305 static MESON_GATE(g12a_htx_hdcp22, HHI_GCLK_MPEG2, 3);
4306 static MESON_GATE(g12a_htx_pclk, HHI_GCLK_MPEG2, 4);
4307 static MESON_GATE(g12a_bt656, HHI_GCLK_MPEG2, 6);
4308 static MESON_GATE(g12a_usb1_to_ddr, HHI_GCLK_MPEG2, 8);
4309 static MESON_GATE(g12b_mipi_isp_gate, HHI_GCLK_MPEG2, 17);
4310 static MESON_GATE(g12a_mmc_pclk, HHI_GCLK_MPEG2, 11);
4311 static MESON_GATE(g12a_uart2, HHI_GCLK_MPEG2, 15);
4312 static MESON_GATE(g12a_vpu_intr, HHI_GCLK_MPEG2, 25);
4313 static MESON_GATE(g12b_csi_phy1, HHI_GCLK_MPEG2, 28);
4314 static MESON_GATE(g12b_csi_phy0, HHI_GCLK_MPEG2, 29);
4315 static MESON_GATE(g12a_gic, HHI_GCLK_MPEG2, 30);
4317 static MESON_GATE(g12a_vclk2_venci0, HHI_GCLK_OTHER, 1);
4318 static MESON_GATE(g12a_vclk2_venci1, HHI_GCLK_OTHER, 2);
4319 static MESON_GATE(g12a_vclk2_vencp0, HHI_GCLK_OTHER, 3);
4320 static MESON_GATE(g12a_vclk2_vencp1, HHI_GCLK_OTHER, 4);
4321 static MESON_GATE(g12a_vclk2_venct0, HHI_GCLK_OTHER, 5);
4322 static MESON_GATE(g12a_vclk2_venct1, HHI_GCLK_OTHER, 6);
4323 static MESON_GATE(g12a_vclk2_other, HHI_GCLK_OTHER, 7);
4324 static MESON_GATE(g12a_vclk2_enci, HHI_GCLK_OTHER, 8);
4325 static MESON_GATE(g12a_vclk2_encp, HHI_GCLK_OTHER, 9);
4326 static MESON_GATE(g12a_dac_clk, HHI_GCLK_OTHER, 10);
4327 static MESON_GATE(g12a_aoclk_gate, HHI_GCLK_OTHER, 14);
4328 static MESON_GATE(g12a_iec958_gate, HHI_GCLK_OTHER, 16);
4329 static MESON_GATE(g12a_enc480p, HHI_GCLK_OTHER, 20);
4330 static MESON_GATE(g12a_rng1, HHI_GCLK_OTHER, 21);
4331 static MESON_GATE(g12a_vclk2_enct, HHI_GCLK_OTHER, 22);
4332 static MESON_GATE(g12a_vclk2_encl, HHI_GCLK_OTHER, 23);
4333 static MESON_GATE(g12a_vclk2_venclmmc, HHI_GCLK_OTHER, 24);
4334 static MESON_GATE(g12a_vclk2_vencl, HHI_GCLK_OTHER, 25);
4335 static MESON_GATE(g12a_vclk2_other1, HHI_GCLK_OTHER, 26);
4337 static MESON_GATE_RO(g12a_dma, HHI_GCLK_OTHER2, 0);
4338 static MESON_GATE_RO(g12a_efuse, HHI_GCLK_OTHER2, 1);
4339 static MESON_GATE_RO(g12a_rom_boot, HHI_GCLK_OTHER2, 2);
4340 static MESON_GATE_RO(g12a_reset_sec, HHI_GCLK_OTHER2, 3);
4341 static MESON_GATE_RO(g12a_sec_ahb_apb3, HHI_GCLK_OTHER2, 4);
4343 /* Array of all clocks provided by this provider */
4344 static struct clk_hw *g12a_hw_clks[] = {
4345 [CLKID_SYS_PLL] = &g12a_sys_pll.hw,
4346 [CLKID_FIXED_PLL] = &g12a_fixed_pll.hw,
4347 [CLKID_FCLK_DIV2] = &g12a_fclk_div2.hw,
4348 [CLKID_FCLK_DIV3] = &g12a_fclk_div3.hw,
4349 [CLKID_FCLK_DIV4] = &g12a_fclk_div4.hw,
4350 [CLKID_FCLK_DIV5] = &g12a_fclk_div5.hw,
4351 [CLKID_FCLK_DIV7] = &g12a_fclk_div7.hw,
4352 [CLKID_FCLK_DIV2P5] = &g12a_fclk_div2p5.hw,
4353 [CLKID_GP0_PLL] = &g12a_gp0_pll.hw,
4354 [CLKID_MPEG_SEL] = &g12a_mpeg_clk_sel.hw,
4355 [CLKID_MPEG_DIV] = &g12a_mpeg_clk_div.hw,
4356 [CLKID_CLK81] = &g12a_clk81.hw,
4357 [CLKID_MPLL0] = &g12a_mpll0.hw,
4358 [CLKID_MPLL1] = &g12a_mpll1.hw,
4359 [CLKID_MPLL2] = &g12a_mpll2.hw,
4360 [CLKID_MPLL3] = &g12a_mpll3.hw,
4361 [CLKID_DDR] = &g12a_ddr.hw,
4362 [CLKID_DOS] = &g12a_dos.hw,
4363 [CLKID_AUDIO_LOCKER] = &g12a_audio_locker.hw,
4364 [CLKID_MIPI_DSI_HOST] = &g12a_mipi_dsi_host.hw,
4365 [CLKID_ETH_PHY] = &g12a_eth_phy.hw,
4366 [CLKID_ISA] = &g12a_isa.hw,
4367 [CLKID_PL301] = &g12a_pl301.hw,
4368 [CLKID_PERIPHS] = &g12a_periphs.hw,
4369 [CLKID_SPICC0] = &g12a_spicc_0.hw,
4370 [CLKID_I2C] = &g12a_i2c.hw,
4371 [CLKID_SANA] = &g12a_sana.hw,
4372 [CLKID_SD] = &g12a_sd.hw,
4373 [CLKID_RNG0] = &g12a_rng0.hw,
4374 [CLKID_UART0] = &g12a_uart0.hw,
4375 [CLKID_SPICC1] = &g12a_spicc_1.hw,
4376 [CLKID_HIU_IFACE] = &g12a_hiu_reg.hw,
4377 [CLKID_MIPI_DSI_PHY] = &g12a_mipi_dsi_phy.hw,
4378 [CLKID_ASSIST_MISC] = &g12a_assist_misc.hw,
4379 [CLKID_SD_EMMC_A] = &g12a_emmc_a.hw,
4380 [CLKID_SD_EMMC_B] = &g12a_emmc_b.hw,
4381 [CLKID_SD_EMMC_C] = &g12a_emmc_c.hw,
4382 [CLKID_AUDIO_CODEC] = &g12a_audio_codec.hw,
4383 [CLKID_AUDIO] = &g12a_audio.hw,
4384 [CLKID_ETH] = &g12a_eth_core.hw,
4385 [CLKID_DEMUX] = &g12a_demux.hw,
4386 [CLKID_AUDIO_IFIFO] = &g12a_audio_ififo.hw,
4387 [CLKID_ADC] = &g12a_adc.hw,
4388 [CLKID_UART1] = &g12a_uart1.hw,
4389 [CLKID_G2D] = &g12a_g2d.hw,
4390 [CLKID_RESET] = &g12a_reset.hw,
4391 [CLKID_PCIE_COMB] = &g12a_pcie_comb.hw,
4392 [CLKID_PARSER] = &g12a_parser.hw,
4393 [CLKID_USB] = &g12a_usb_general.hw,
4394 [CLKID_PCIE_PHY] = &g12a_pcie_phy.hw,
4395 [CLKID_AHB_ARB0] = &g12a_ahb_arb0.hw,
4396 [CLKID_AHB_DATA_BUS] = &g12a_ahb_data_bus.hw,
4397 [CLKID_AHB_CTRL_BUS] = &g12a_ahb_ctrl_bus.hw,
4398 [CLKID_HTX_HDCP22] = &g12a_htx_hdcp22.hw,
4399 [CLKID_HTX_PCLK] = &g12a_htx_pclk.hw,
4400 [CLKID_BT656] = &g12a_bt656.hw,
4401 [CLKID_USB1_DDR_BRIDGE] = &g12a_usb1_to_ddr.hw,
4402 [CLKID_MMC_PCLK] = &g12a_mmc_pclk.hw,
4403 [CLKID_UART2] = &g12a_uart2.hw,
4404 [CLKID_VPU_INTR] = &g12a_vpu_intr.hw,
4405 [CLKID_GIC] = &g12a_gic.hw,
4406 [CLKID_SD_EMMC_A_CLK0_SEL] = &g12a_sd_emmc_a_clk0_sel.hw,
4407 [CLKID_SD_EMMC_A_CLK0_DIV] = &g12a_sd_emmc_a_clk0_div.hw,
4408 [CLKID_SD_EMMC_A_CLK0] = &g12a_sd_emmc_a_clk0.hw,
4409 [CLKID_SD_EMMC_B_CLK0_SEL] = &g12a_sd_emmc_b_clk0_sel.hw,
4410 [CLKID_SD_EMMC_B_CLK0_DIV] = &g12a_sd_emmc_b_clk0_div.hw,
4411 [CLKID_SD_EMMC_B_CLK0] = &g12a_sd_emmc_b_clk0.hw,
4412 [CLKID_SD_EMMC_C_CLK0_SEL] = &g12a_sd_emmc_c_clk0_sel.hw,
4413 [CLKID_SD_EMMC_C_CLK0_DIV] = &g12a_sd_emmc_c_clk0_div.hw,
4414 [CLKID_SD_EMMC_C_CLK0] = &g12a_sd_emmc_c_clk0.hw,
4415 [CLKID_MPLL0_DIV] = &g12a_mpll0_div.hw,
4416 [CLKID_MPLL1_DIV] = &g12a_mpll1_div.hw,
4417 [CLKID_MPLL2_DIV] = &g12a_mpll2_div.hw,
4418 [CLKID_MPLL3_DIV] = &g12a_mpll3_div.hw,
4419 [CLKID_FCLK_DIV2_DIV] = &g12a_fclk_div2_div.hw,
4420 [CLKID_FCLK_DIV3_DIV] = &g12a_fclk_div3_div.hw,
4421 [CLKID_FCLK_DIV4_DIV] = &g12a_fclk_div4_div.hw,
4422 [CLKID_FCLK_DIV5_DIV] = &g12a_fclk_div5_div.hw,
4423 [CLKID_FCLK_DIV7_DIV] = &g12a_fclk_div7_div.hw,
4424 [CLKID_FCLK_DIV2P5_DIV] = &g12a_fclk_div2p5_div.hw,
4425 [CLKID_HIFI_PLL] = &g12a_hifi_pll.hw,
4426 [CLKID_VCLK2_VENCI0] = &g12a_vclk2_venci0.hw,
4427 [CLKID_VCLK2_VENCI1] = &g12a_vclk2_venci1.hw,
4428 [CLKID_VCLK2_VENCP0] = &g12a_vclk2_vencp0.hw,
4429 [CLKID_VCLK2_VENCP1] = &g12a_vclk2_vencp1.hw,
4430 [CLKID_VCLK2_VENCT0] = &g12a_vclk2_venct0.hw,
4431 [CLKID_VCLK2_VENCT1] = &g12a_vclk2_venct1.hw,
4432 [CLKID_VCLK2_OTHER] = &g12a_vclk2_other.hw,
4433 [CLKID_VCLK2_ENCI] = &g12a_vclk2_enci.hw,
4434 [CLKID_VCLK2_ENCP] = &g12a_vclk2_encp.hw,
4435 [CLKID_DAC_CLK] = &g12a_dac_clk.hw,
4436 [CLKID_AOCLK] = &g12a_aoclk_gate.hw,
4437 [CLKID_IEC958] = &g12a_iec958_gate.hw,
4438 [CLKID_ENC480P] = &g12a_enc480p.hw,
4439 [CLKID_RNG1] = &g12a_rng1.hw,
4440 [CLKID_VCLK2_ENCT] = &g12a_vclk2_enct.hw,
4441 [CLKID_VCLK2_ENCL] = &g12a_vclk2_encl.hw,
4442 [CLKID_VCLK2_VENCLMMC] = &g12a_vclk2_venclmmc.hw,
4443 [CLKID_VCLK2_VENCL] = &g12a_vclk2_vencl.hw,
4444 [CLKID_VCLK2_OTHER1] = &g12a_vclk2_other1.hw,
4445 [CLKID_FIXED_PLL_DCO] = &g12a_fixed_pll_dco.hw,
4446 [CLKID_SYS_PLL_DCO] = &g12a_sys_pll_dco.hw,
4447 [CLKID_GP0_PLL_DCO] = &g12a_gp0_pll_dco.hw,
4448 [CLKID_HIFI_PLL_DCO] = &g12a_hifi_pll_dco.hw,
4449 [CLKID_DMA] = &g12a_dma.hw,
4450 [CLKID_EFUSE] = &g12a_efuse.hw,
4451 [CLKID_ROM_BOOT] = &g12a_rom_boot.hw,
4452 [CLKID_RESET_SEC] = &g12a_reset_sec.hw,
4453 [CLKID_SEC_AHB_APB3] = &g12a_sec_ahb_apb3.hw,
4454 [CLKID_MPLL_PREDIV] = &g12a_mpll_prediv.hw,
4455 [CLKID_VPU_0_SEL] = &g12a_vpu_0_sel.hw,
4456 [CLKID_VPU_0_DIV] = &g12a_vpu_0_div.hw,
4457 [CLKID_VPU_0] = &g12a_vpu_0.hw,
4458 [CLKID_VPU_1_SEL] = &g12a_vpu_1_sel.hw,
4459 [CLKID_VPU_1_DIV] = &g12a_vpu_1_div.hw,
4460 [CLKID_VPU_1] = &g12a_vpu_1.hw,
4461 [CLKID_VPU] = &g12a_vpu.hw,
4462 [CLKID_VAPB_0_SEL] = &g12a_vapb_0_sel.hw,
4463 [CLKID_VAPB_0_DIV] = &g12a_vapb_0_div.hw,
4464 [CLKID_VAPB_0] = &g12a_vapb_0.hw,
4465 [CLKID_VAPB_1_SEL] = &g12a_vapb_1_sel.hw,
4466 [CLKID_VAPB_1_DIV] = &g12a_vapb_1_div.hw,
4467 [CLKID_VAPB_1] = &g12a_vapb_1.hw,
4468 [CLKID_VAPB_SEL] = &g12a_vapb_sel.hw,
4469 [CLKID_VAPB] = &g12a_vapb.hw,
4470 [CLKID_HDMI_PLL_DCO] = &g12a_hdmi_pll_dco.hw,
4471 [CLKID_HDMI_PLL_OD] = &g12a_hdmi_pll_od.hw,
4472 [CLKID_HDMI_PLL_OD2] = &g12a_hdmi_pll_od2.hw,
4473 [CLKID_HDMI_PLL] = &g12a_hdmi_pll.hw,
4474 [CLKID_VID_PLL] = &g12a_vid_pll_div.hw,
4475 [CLKID_VID_PLL_SEL] = &g12a_vid_pll_sel.hw,
4476 [CLKID_VID_PLL_DIV] = &g12a_vid_pll.hw,
4477 [CLKID_VCLK_SEL] = &g12a_vclk_sel.hw,
4478 [CLKID_VCLK2_SEL] = &g12a_vclk2_sel.hw,
4479 [CLKID_VCLK_INPUT] = &g12a_vclk_input.hw,
4480 [CLKID_VCLK2_INPUT] = &g12a_vclk2_input.hw,
4481 [CLKID_VCLK_DIV] = &g12a_vclk_div.hw,
4482 [CLKID_VCLK2_DIV] = &g12a_vclk2_div.hw,
4483 [CLKID_VCLK] = &g12a_vclk.hw,
4484 [CLKID_VCLK2] = &g12a_vclk2.hw,
4485 [CLKID_VCLK_DIV1] = &g12a_vclk_div1.hw,
4486 [CLKID_VCLK_DIV2_EN] = &g12a_vclk_div2_en.hw,
4487 [CLKID_VCLK_DIV4_EN] = &g12a_vclk_div4_en.hw,
4488 [CLKID_VCLK_DIV6_EN] = &g12a_vclk_div6_en.hw,
4489 [CLKID_VCLK_DIV12_EN] = &g12a_vclk_div12_en.hw,
4490 [CLKID_VCLK2_DIV1] = &g12a_vclk2_div1.hw,
4491 [CLKID_VCLK2_DIV2_EN] = &g12a_vclk2_div2_en.hw,
4492 [CLKID_VCLK2_DIV4_EN] = &g12a_vclk2_div4_en.hw,
4493 [CLKID_VCLK2_DIV6_EN] = &g12a_vclk2_div6_en.hw,
4494 [CLKID_VCLK2_DIV12_EN] = &g12a_vclk2_div12_en.hw,
4495 [CLKID_VCLK_DIV2] = &g12a_vclk_div2.hw,
4496 [CLKID_VCLK_DIV4] = &g12a_vclk_div4.hw,
4497 [CLKID_VCLK_DIV6] = &g12a_vclk_div6.hw,
4498 [CLKID_VCLK_DIV12] = &g12a_vclk_div12.hw,
4499 [CLKID_VCLK2_DIV2] = &g12a_vclk2_div2.hw,
4500 [CLKID_VCLK2_DIV4] = &g12a_vclk2_div4.hw,
4501 [CLKID_VCLK2_DIV6] = &g12a_vclk2_div6.hw,
4502 [CLKID_VCLK2_DIV12] = &g12a_vclk2_div12.hw,
4503 [CLKID_CTS_ENCI_SEL] = &g12a_cts_enci_sel.hw,
4504 [CLKID_CTS_ENCP_SEL] = &g12a_cts_encp_sel.hw,
4505 [CLKID_CTS_ENCL_SEL] = &g12a_cts_encl_sel.hw,
4506 [CLKID_CTS_VDAC_SEL] = &g12a_cts_vdac_sel.hw,
4507 [CLKID_HDMI_TX_SEL] = &g12a_hdmi_tx_sel.hw,
4508 [CLKID_CTS_ENCI] = &g12a_cts_enci.hw,
4509 [CLKID_CTS_ENCP] = &g12a_cts_encp.hw,
4510 [CLKID_CTS_ENCL] = &g12a_cts_encl.hw,
4511 [CLKID_CTS_VDAC] = &g12a_cts_vdac.hw,
4512 [CLKID_HDMI_TX] = &g12a_hdmi_tx.hw,
4513 [CLKID_HDMI_SEL] = &g12a_hdmi_sel.hw,
4514 [CLKID_HDMI_DIV] = &g12a_hdmi_div.hw,
4515 [CLKID_HDMI] = &g12a_hdmi.hw,
4516 [CLKID_MALI_0_SEL] = &g12a_mali_0_sel.hw,
4517 [CLKID_MALI_0_DIV] = &g12a_mali_0_div.hw,
4518 [CLKID_MALI_0] = &g12a_mali_0.hw,
4519 [CLKID_MALI_1_SEL] = &g12a_mali_1_sel.hw,
4520 [CLKID_MALI_1_DIV] = &g12a_mali_1_div.hw,
4521 [CLKID_MALI_1] = &g12a_mali_1.hw,
4522 [CLKID_MALI] = &g12a_mali.hw,
4523 [CLKID_MPLL_50M_DIV] = &g12a_mpll_50m_div.hw,
4524 [CLKID_MPLL_50M] = &g12a_mpll_50m.hw,
4525 [CLKID_SYS_PLL_DIV16_EN] = &g12a_sys_pll_div16_en.hw,
4526 [CLKID_SYS_PLL_DIV16] = &g12a_sys_pll_div16.hw,
4527 [CLKID_CPU_CLK_DYN0_SEL] = &g12a_cpu_clk_premux0.hw,
4528 [CLKID_CPU_CLK_DYN0_DIV] = &g12a_cpu_clk_mux0_div.hw,
4529 [CLKID_CPU_CLK_DYN0] = &g12a_cpu_clk_postmux0.hw,
4530 [CLKID_CPU_CLK_DYN1_SEL] = &g12a_cpu_clk_premux1.hw,
4531 [CLKID_CPU_CLK_DYN1_DIV] = &g12a_cpu_clk_mux1_div.hw,
4532 [CLKID_CPU_CLK_DYN1] = &g12a_cpu_clk_postmux1.hw,
4533 [CLKID_CPU_CLK_DYN] = &g12a_cpu_clk_dyn.hw,
4534 [CLKID_CPU_CLK] = &g12a_cpu_clk.hw,
4535 [CLKID_CPU_CLK_DIV16_EN] = &g12a_cpu_clk_div16_en.hw,
4536 [CLKID_CPU_CLK_DIV16] = &g12a_cpu_clk_div16.hw,
4537 [CLKID_CPU_CLK_APB_DIV] = &g12a_cpu_clk_apb_div.hw,
4538 [CLKID_CPU_CLK_APB] = &g12a_cpu_clk_apb.hw,
4539 [CLKID_CPU_CLK_ATB_DIV] = &g12a_cpu_clk_atb_div.hw,
4540 [CLKID_CPU_CLK_ATB] = &g12a_cpu_clk_atb.hw,
4541 [CLKID_CPU_CLK_AXI_DIV] = &g12a_cpu_clk_axi_div.hw,
4542 [CLKID_CPU_CLK_AXI] = &g12a_cpu_clk_axi.hw,
4543 [CLKID_CPU_CLK_TRACE_DIV] = &g12a_cpu_clk_trace_div.hw,
4544 [CLKID_CPU_CLK_TRACE] = &g12a_cpu_clk_trace.hw,
4545 [CLKID_PCIE_PLL_DCO] = &g12a_pcie_pll_dco.hw,
4546 [CLKID_PCIE_PLL_DCO_DIV2] = &g12a_pcie_pll_dco_div2.hw,
4547 [CLKID_PCIE_PLL_OD] = &g12a_pcie_pll_od.hw,
4548 [CLKID_PCIE_PLL] = &g12a_pcie_pll.hw,
4549 [CLKID_VDEC_1_SEL] = &g12a_vdec_1_sel.hw,
4550 [CLKID_VDEC_1_DIV] = &g12a_vdec_1_div.hw,
4551 [CLKID_VDEC_1] = &g12a_vdec_1.hw,
4552 [CLKID_VDEC_HEVC_SEL] = &g12a_vdec_hevc_sel.hw,
4553 [CLKID_VDEC_HEVC_DIV] = &g12a_vdec_hevc_div.hw,
4554 [CLKID_VDEC_HEVC] = &g12a_vdec_hevc.hw,
4555 [CLKID_VDEC_HEVCF_SEL] = &g12a_vdec_hevcf_sel.hw,
4556 [CLKID_VDEC_HEVCF_DIV] = &g12a_vdec_hevcf_div.hw,
4557 [CLKID_VDEC_HEVCF] = &g12a_vdec_hevcf.hw,
4558 [CLKID_TS_DIV] = &g12a_ts_div.hw,
4559 [CLKID_TS] = &g12a_ts.hw,
4560 [CLKID_SPICC0_SCLK_SEL] = &g12a_spicc0_sclk_sel.hw,
4561 [CLKID_SPICC0_SCLK_DIV] = &g12a_spicc0_sclk_div.hw,
4562 [CLKID_SPICC0_SCLK] = &g12a_spicc0_sclk.hw,
4563 [CLKID_SPICC1_SCLK_SEL] = &g12a_spicc1_sclk_sel.hw,
4564 [CLKID_SPICC1_SCLK_DIV] = &g12a_spicc1_sclk_div.hw,
4565 [CLKID_SPICC1_SCLK] = &g12a_spicc1_sclk.hw,
4566 [CLKID_MIPI_DSI_PXCLK_SEL] = &g12a_mipi_dsi_pxclk_sel.hw,
4567 [CLKID_MIPI_DSI_PXCLK_DIV] = &g12a_mipi_dsi_pxclk_div.hw,
4568 [CLKID_MIPI_DSI_PXCLK] = &g12a_mipi_dsi_pxclk.hw,
4571 static struct clk_hw *g12b_hw_clks[] = {
4572 [CLKID_SYS_PLL] = &g12a_sys_pll.hw,
4573 [CLKID_FIXED_PLL] = &g12a_fixed_pll.hw,
4574 [CLKID_FCLK_DIV2] = &g12a_fclk_div2.hw,
4575 [CLKID_FCLK_DIV3] = &g12a_fclk_div3.hw,
4576 [CLKID_FCLK_DIV4] = &g12a_fclk_div4.hw,
4577 [CLKID_FCLK_DIV5] = &g12a_fclk_div5.hw,
4578 [CLKID_FCLK_DIV7] = &g12a_fclk_div7.hw,
4579 [CLKID_FCLK_DIV2P5] = &g12a_fclk_div2p5.hw,
4580 [CLKID_GP0_PLL] = &g12a_gp0_pll.hw,
4581 [CLKID_MPEG_SEL] = &g12a_mpeg_clk_sel.hw,
4582 [CLKID_MPEG_DIV] = &g12a_mpeg_clk_div.hw,
4583 [CLKID_CLK81] = &g12a_clk81.hw,
4584 [CLKID_MPLL0] = &g12a_mpll0.hw,
4585 [CLKID_MPLL1] = &g12a_mpll1.hw,
4586 [CLKID_MPLL2] = &g12a_mpll2.hw,
4587 [CLKID_MPLL3] = &g12a_mpll3.hw,
4588 [CLKID_DDR] = &g12a_ddr.hw,
4589 [CLKID_DOS] = &g12a_dos.hw,
4590 [CLKID_AUDIO_LOCKER] = &g12a_audio_locker.hw,
4591 [CLKID_MIPI_DSI_HOST] = &g12a_mipi_dsi_host.hw,
4592 [CLKID_ETH_PHY] = &g12a_eth_phy.hw,
4593 [CLKID_ISA] = &g12a_isa.hw,
4594 [CLKID_PL301] = &g12a_pl301.hw,
4595 [CLKID_PERIPHS] = &g12a_periphs.hw,
4596 [CLKID_SPICC0] = &g12a_spicc_0.hw,
4597 [CLKID_I2C] = &g12a_i2c.hw,
4598 [CLKID_SANA] = &g12a_sana.hw,
4599 [CLKID_SD] = &g12a_sd.hw,
4600 [CLKID_RNG0] = &g12a_rng0.hw,
4601 [CLKID_UART0] = &g12a_uart0.hw,
4602 [CLKID_SPICC1] = &g12a_spicc_1.hw,
4603 [CLKID_HIU_IFACE] = &g12a_hiu_reg.hw,
4604 [CLKID_MIPI_DSI_PHY] = &g12a_mipi_dsi_phy.hw,
4605 [CLKID_ASSIST_MISC] = &g12a_assist_misc.hw,
4606 [CLKID_SD_EMMC_A] = &g12a_emmc_a.hw,
4607 [CLKID_SD_EMMC_B] = &g12a_emmc_b.hw,
4608 [CLKID_SD_EMMC_C] = &g12a_emmc_c.hw,
4609 [CLKID_AUDIO_CODEC] = &g12a_audio_codec.hw,
4610 [CLKID_AUDIO] = &g12a_audio.hw,
4611 [CLKID_ETH] = &g12a_eth_core.hw,
4612 [CLKID_DEMUX] = &g12a_demux.hw,
4613 [CLKID_AUDIO_IFIFO] = &g12a_audio_ififo.hw,
4614 [CLKID_ADC] = &g12a_adc.hw,
4615 [CLKID_UART1] = &g12a_uart1.hw,
4616 [CLKID_G2D] = &g12a_g2d.hw,
4617 [CLKID_RESET] = &g12a_reset.hw,
4618 [CLKID_PCIE_COMB] = &g12a_pcie_comb.hw,
4619 [CLKID_PARSER] = &g12a_parser.hw,
4620 [CLKID_USB] = &g12a_usb_general.hw,
4621 [CLKID_PCIE_PHY] = &g12a_pcie_phy.hw,
4622 [CLKID_AHB_ARB0] = &g12a_ahb_arb0.hw,
4623 [CLKID_AHB_DATA_BUS] = &g12a_ahb_data_bus.hw,
4624 [CLKID_AHB_CTRL_BUS] = &g12a_ahb_ctrl_bus.hw,
4625 [CLKID_HTX_HDCP22] = &g12a_htx_hdcp22.hw,
4626 [CLKID_HTX_PCLK] = &g12a_htx_pclk.hw,
4627 [CLKID_BT656] = &g12a_bt656.hw,
4628 [CLKID_USB1_DDR_BRIDGE] = &g12a_usb1_to_ddr.hw,
4629 [CLKID_MMC_PCLK] = &g12a_mmc_pclk.hw,
4630 [CLKID_UART2] = &g12a_uart2.hw,
4631 [CLKID_VPU_INTR] = &g12a_vpu_intr.hw,
4632 [CLKID_GIC] = &g12a_gic.hw,
4633 [CLKID_SD_EMMC_A_CLK0_SEL] = &g12a_sd_emmc_a_clk0_sel.hw,
4634 [CLKID_SD_EMMC_A_CLK0_DIV] = &g12a_sd_emmc_a_clk0_div.hw,
4635 [CLKID_SD_EMMC_A_CLK0] = &g12a_sd_emmc_a_clk0.hw,
4636 [CLKID_SD_EMMC_B_CLK0_SEL] = &g12a_sd_emmc_b_clk0_sel.hw,
4637 [CLKID_SD_EMMC_B_CLK0_DIV] = &g12a_sd_emmc_b_clk0_div.hw,
4638 [CLKID_SD_EMMC_B_CLK0] = &g12a_sd_emmc_b_clk0.hw,
4639 [CLKID_SD_EMMC_C_CLK0_SEL] = &g12a_sd_emmc_c_clk0_sel.hw,
4640 [CLKID_SD_EMMC_C_CLK0_DIV] = &g12a_sd_emmc_c_clk0_div.hw,
4641 [CLKID_SD_EMMC_C_CLK0] = &g12a_sd_emmc_c_clk0.hw,
4642 [CLKID_MPLL0_DIV] = &g12a_mpll0_div.hw,
4643 [CLKID_MPLL1_DIV] = &g12a_mpll1_div.hw,
4644 [CLKID_MPLL2_DIV] = &g12a_mpll2_div.hw,
4645 [CLKID_MPLL3_DIV] = &g12a_mpll3_div.hw,
4646 [CLKID_FCLK_DIV2_DIV] = &g12a_fclk_div2_div.hw,
4647 [CLKID_FCLK_DIV3_DIV] = &g12a_fclk_div3_div.hw,
4648 [CLKID_FCLK_DIV4_DIV] = &g12a_fclk_div4_div.hw,
4649 [CLKID_FCLK_DIV5_DIV] = &g12a_fclk_div5_div.hw,
4650 [CLKID_FCLK_DIV7_DIV] = &g12a_fclk_div7_div.hw,
4651 [CLKID_FCLK_DIV2P5_DIV] = &g12a_fclk_div2p5_div.hw,
4652 [CLKID_HIFI_PLL] = &g12a_hifi_pll.hw,
4653 [CLKID_VCLK2_VENCI0] = &g12a_vclk2_venci0.hw,
4654 [CLKID_VCLK2_VENCI1] = &g12a_vclk2_venci1.hw,
4655 [CLKID_VCLK2_VENCP0] = &g12a_vclk2_vencp0.hw,
4656 [CLKID_VCLK2_VENCP1] = &g12a_vclk2_vencp1.hw,
4657 [CLKID_VCLK2_VENCT0] = &g12a_vclk2_venct0.hw,
4658 [CLKID_VCLK2_VENCT1] = &g12a_vclk2_venct1.hw,
4659 [CLKID_VCLK2_OTHER] = &g12a_vclk2_other.hw,
4660 [CLKID_VCLK2_ENCI] = &g12a_vclk2_enci.hw,
4661 [CLKID_VCLK2_ENCP] = &g12a_vclk2_encp.hw,
4662 [CLKID_DAC_CLK] = &g12a_dac_clk.hw,
4663 [CLKID_AOCLK] = &g12a_aoclk_gate.hw,
4664 [CLKID_IEC958] = &g12a_iec958_gate.hw,
4665 [CLKID_ENC480P] = &g12a_enc480p.hw,
4666 [CLKID_RNG1] = &g12a_rng1.hw,
4667 [CLKID_VCLK2_ENCT] = &g12a_vclk2_enct.hw,
4668 [CLKID_VCLK2_ENCL] = &g12a_vclk2_encl.hw,
4669 [CLKID_VCLK2_VENCLMMC] = &g12a_vclk2_venclmmc.hw,
4670 [CLKID_VCLK2_VENCL] = &g12a_vclk2_vencl.hw,
4671 [CLKID_VCLK2_OTHER1] = &g12a_vclk2_other1.hw,
4672 [CLKID_FIXED_PLL_DCO] = &g12a_fixed_pll_dco.hw,
4673 [CLKID_SYS_PLL_DCO] = &g12a_sys_pll_dco.hw,
4674 [CLKID_GP0_PLL_DCO] = &g12a_gp0_pll_dco.hw,
4675 [CLKID_HIFI_PLL_DCO] = &g12a_hifi_pll_dco.hw,
4676 [CLKID_DMA] = &g12a_dma.hw,
4677 [CLKID_EFUSE] = &g12a_efuse.hw,
4678 [CLKID_ROM_BOOT] = &g12a_rom_boot.hw,
4679 [CLKID_RESET_SEC] = &g12a_reset_sec.hw,
4680 [CLKID_SEC_AHB_APB3] = &g12a_sec_ahb_apb3.hw,
4681 [CLKID_MPLL_PREDIV] = &g12a_mpll_prediv.hw,
4682 [CLKID_VPU_0_SEL] = &g12a_vpu_0_sel.hw,
4683 [CLKID_VPU_0_DIV] = &g12a_vpu_0_div.hw,
4684 [CLKID_VPU_0] = &g12a_vpu_0.hw,
4685 [CLKID_VPU_1_SEL] = &g12a_vpu_1_sel.hw,
4686 [CLKID_VPU_1_DIV] = &g12a_vpu_1_div.hw,
4687 [CLKID_VPU_1] = &g12a_vpu_1.hw,
4688 [CLKID_VPU] = &g12a_vpu.hw,
4689 [CLKID_VAPB_0_SEL] = &g12a_vapb_0_sel.hw,
4690 [CLKID_VAPB_0_DIV] = &g12a_vapb_0_div.hw,
4691 [CLKID_VAPB_0] = &g12a_vapb_0.hw,
4692 [CLKID_VAPB_1_SEL] = &g12a_vapb_1_sel.hw,
4693 [CLKID_VAPB_1_DIV] = &g12a_vapb_1_div.hw,
4694 [CLKID_VAPB_1] = &g12a_vapb_1.hw,
4695 [CLKID_VAPB_SEL] = &g12a_vapb_sel.hw,
4696 [CLKID_VAPB] = &g12a_vapb.hw,
4697 [CLKID_HDMI_PLL_DCO] = &g12a_hdmi_pll_dco.hw,
4698 [CLKID_HDMI_PLL_OD] = &g12a_hdmi_pll_od.hw,
4699 [CLKID_HDMI_PLL_OD2] = &g12a_hdmi_pll_od2.hw,
4700 [CLKID_HDMI_PLL] = &g12a_hdmi_pll.hw,
4701 [CLKID_VID_PLL] = &g12a_vid_pll_div.hw,
4702 [CLKID_VID_PLL_SEL] = &g12a_vid_pll_sel.hw,
4703 [CLKID_VID_PLL_DIV] = &g12a_vid_pll.hw,
4704 [CLKID_VCLK_SEL] = &g12a_vclk_sel.hw,
4705 [CLKID_VCLK2_SEL] = &g12a_vclk2_sel.hw,
4706 [CLKID_VCLK_INPUT] = &g12a_vclk_input.hw,
4707 [CLKID_VCLK2_INPUT] = &g12a_vclk2_input.hw,
4708 [CLKID_VCLK_DIV] = &g12a_vclk_div.hw,
4709 [CLKID_VCLK2_DIV] = &g12a_vclk2_div.hw,
4710 [CLKID_VCLK] = &g12a_vclk.hw,
4711 [CLKID_VCLK2] = &g12a_vclk2.hw,
4712 [CLKID_VCLK_DIV1] = &g12a_vclk_div1.hw,
4713 [CLKID_VCLK_DIV2_EN] = &g12a_vclk_div2_en.hw,
4714 [CLKID_VCLK_DIV4_EN] = &g12a_vclk_div4_en.hw,
4715 [CLKID_VCLK_DIV6_EN] = &g12a_vclk_div6_en.hw,
4716 [CLKID_VCLK_DIV12_EN] = &g12a_vclk_div12_en.hw,
4717 [CLKID_VCLK2_DIV1] = &g12a_vclk2_div1.hw,
4718 [CLKID_VCLK2_DIV2_EN] = &g12a_vclk2_div2_en.hw,
4719 [CLKID_VCLK2_DIV4_EN] = &g12a_vclk2_div4_en.hw,
4720 [CLKID_VCLK2_DIV6_EN] = &g12a_vclk2_div6_en.hw,
4721 [CLKID_VCLK2_DIV12_EN] = &g12a_vclk2_div12_en.hw,
4722 [CLKID_VCLK_DIV2] = &g12a_vclk_div2.hw,
4723 [CLKID_VCLK_DIV4] = &g12a_vclk_div4.hw,
4724 [CLKID_VCLK_DIV6] = &g12a_vclk_div6.hw,
4725 [CLKID_VCLK_DIV12] = &g12a_vclk_div12.hw,
4726 [CLKID_VCLK2_DIV2] = &g12a_vclk2_div2.hw,
4727 [CLKID_VCLK2_DIV4] = &g12a_vclk2_div4.hw,
4728 [CLKID_VCLK2_DIV6] = &g12a_vclk2_div6.hw,
4729 [CLKID_VCLK2_DIV12] = &g12a_vclk2_div12.hw,
4730 [CLKID_CTS_ENCI_SEL] = &g12a_cts_enci_sel.hw,
4731 [CLKID_CTS_ENCP_SEL] = &g12a_cts_encp_sel.hw,
4732 [CLKID_CTS_ENCL_SEL] = &g12a_cts_encl_sel.hw,
4733 [CLKID_CTS_VDAC_SEL] = &g12a_cts_vdac_sel.hw,
4734 [CLKID_HDMI_TX_SEL] = &g12a_hdmi_tx_sel.hw,
4735 [CLKID_CTS_ENCI] = &g12a_cts_enci.hw,
4736 [CLKID_CTS_ENCP] = &g12a_cts_encp.hw,
4737 [CLKID_CTS_ENCL] = &g12a_cts_encl.hw,
4738 [CLKID_CTS_VDAC] = &g12a_cts_vdac.hw,
4739 [CLKID_HDMI_TX] = &g12a_hdmi_tx.hw,
4740 [CLKID_HDMI_SEL] = &g12a_hdmi_sel.hw,
4741 [CLKID_HDMI_DIV] = &g12a_hdmi_div.hw,
4742 [CLKID_HDMI] = &g12a_hdmi.hw,
4743 [CLKID_MALI_0_SEL] = &g12a_mali_0_sel.hw,
4744 [CLKID_MALI_0_DIV] = &g12a_mali_0_div.hw,
4745 [CLKID_MALI_0] = &g12a_mali_0.hw,
4746 [CLKID_MALI_1_SEL] = &g12a_mali_1_sel.hw,
4747 [CLKID_MALI_1_DIV] = &g12a_mali_1_div.hw,
4748 [CLKID_MALI_1] = &g12a_mali_1.hw,
4749 [CLKID_MALI] = &g12a_mali.hw,
4750 [CLKID_MPLL_50M_DIV] = &g12a_mpll_50m_div.hw,
4751 [CLKID_MPLL_50M] = &g12a_mpll_50m.hw,
4752 [CLKID_SYS_PLL_DIV16_EN] = &g12a_sys_pll_div16_en.hw,
4753 [CLKID_SYS_PLL_DIV16] = &g12a_sys_pll_div16.hw,
4754 [CLKID_CPU_CLK_DYN0_SEL] = &g12a_cpu_clk_premux0.hw,
4755 [CLKID_CPU_CLK_DYN0_DIV] = &g12a_cpu_clk_mux0_div.hw,
4756 [CLKID_CPU_CLK_DYN0] = &g12a_cpu_clk_postmux0.hw,
4757 [CLKID_CPU_CLK_DYN1_SEL] = &g12a_cpu_clk_premux1.hw,
4758 [CLKID_CPU_CLK_DYN1_DIV] = &g12a_cpu_clk_mux1_div.hw,
4759 [CLKID_CPU_CLK_DYN1] = &g12a_cpu_clk_postmux1.hw,
4760 [CLKID_CPU_CLK_DYN] = &g12a_cpu_clk_dyn.hw,
4761 [CLKID_CPU_CLK] = &g12b_cpu_clk.hw,
4762 [CLKID_CPU_CLK_DIV16_EN] = &g12a_cpu_clk_div16_en.hw,
4763 [CLKID_CPU_CLK_DIV16] = &g12a_cpu_clk_div16.hw,
4764 [CLKID_CPU_CLK_APB_DIV] = &g12a_cpu_clk_apb_div.hw,
4765 [CLKID_CPU_CLK_APB] = &g12a_cpu_clk_apb.hw,
4766 [CLKID_CPU_CLK_ATB_DIV] = &g12a_cpu_clk_atb_div.hw,
4767 [CLKID_CPU_CLK_ATB] = &g12a_cpu_clk_atb.hw,
4768 [CLKID_CPU_CLK_AXI_DIV] = &g12a_cpu_clk_axi_div.hw,
4769 [CLKID_CPU_CLK_AXI] = &g12a_cpu_clk_axi.hw,
4770 [CLKID_CPU_CLK_TRACE_DIV] = &g12a_cpu_clk_trace_div.hw,
4771 [CLKID_CPU_CLK_TRACE] = &g12a_cpu_clk_trace.hw,
4772 [CLKID_PCIE_PLL_DCO] = &g12a_pcie_pll_dco.hw,
4773 [CLKID_PCIE_PLL_DCO_DIV2] = &g12a_pcie_pll_dco_div2.hw,
4774 [CLKID_PCIE_PLL_OD] = &g12a_pcie_pll_od.hw,
4775 [CLKID_PCIE_PLL] = &g12a_pcie_pll.hw,
4776 [CLKID_VDEC_1_SEL] = &g12a_vdec_1_sel.hw,
4777 [CLKID_VDEC_1_DIV] = &g12a_vdec_1_div.hw,
4778 [CLKID_VDEC_1] = &g12a_vdec_1.hw,
4779 [CLKID_VDEC_HEVC_SEL] = &g12a_vdec_hevc_sel.hw,
4780 [CLKID_VDEC_HEVC_DIV] = &g12a_vdec_hevc_div.hw,
4781 [CLKID_VDEC_HEVC] = &g12a_vdec_hevc.hw,
4782 [CLKID_VDEC_HEVCF_SEL] = &g12a_vdec_hevcf_sel.hw,
4783 [CLKID_VDEC_HEVCF_DIV] = &g12a_vdec_hevcf_div.hw,
4784 [CLKID_VDEC_HEVCF] = &g12a_vdec_hevcf.hw,
4785 [CLKID_TS_DIV] = &g12a_ts_div.hw,
4786 [CLKID_TS] = &g12a_ts.hw,
4787 [CLKID_SYS1_PLL_DCO] = &g12b_sys1_pll_dco.hw,
4788 [CLKID_SYS1_PLL] = &g12b_sys1_pll.hw,
4789 [CLKID_SYS1_PLL_DIV16_EN] = &g12b_sys1_pll_div16_en.hw,
4790 [CLKID_SYS1_PLL_DIV16] = &g12b_sys1_pll_div16.hw,
4791 [CLKID_CPUB_CLK_DYN0_SEL] = &g12b_cpub_clk_premux0.hw,
4792 [CLKID_CPUB_CLK_DYN0_DIV] = &g12b_cpub_clk_mux0_div.hw,
4793 [CLKID_CPUB_CLK_DYN0] = &g12b_cpub_clk_postmux0.hw,
4794 [CLKID_CPUB_CLK_DYN1_SEL] = &g12b_cpub_clk_premux1.hw,
4795 [CLKID_CPUB_CLK_DYN1_DIV] = &g12b_cpub_clk_mux1_div.hw,
4796 [CLKID_CPUB_CLK_DYN1] = &g12b_cpub_clk_postmux1.hw,
4797 [CLKID_CPUB_CLK_DYN] = &g12b_cpub_clk_dyn.hw,
4798 [CLKID_CPUB_CLK] = &g12b_cpub_clk.hw,
4799 [CLKID_CPUB_CLK_DIV16_EN] = &g12b_cpub_clk_div16_en.hw,
4800 [CLKID_CPUB_CLK_DIV16] = &g12b_cpub_clk_div16.hw,
4801 [CLKID_CPUB_CLK_DIV2] = &g12b_cpub_clk_div2.hw,
4802 [CLKID_CPUB_CLK_DIV3] = &g12b_cpub_clk_div3.hw,
4803 [CLKID_CPUB_CLK_DIV4] = &g12b_cpub_clk_div4.hw,
4804 [CLKID_CPUB_CLK_DIV5] = &g12b_cpub_clk_div5.hw,
4805 [CLKID_CPUB_CLK_DIV6] = &g12b_cpub_clk_div6.hw,
4806 [CLKID_CPUB_CLK_DIV7] = &g12b_cpub_clk_div7.hw,
4807 [CLKID_CPUB_CLK_DIV8] = &g12b_cpub_clk_div8.hw,
4808 [CLKID_CPUB_CLK_APB_SEL] = &g12b_cpub_clk_apb_sel.hw,
4809 [CLKID_CPUB_CLK_APB] = &g12b_cpub_clk_apb.hw,
4810 [CLKID_CPUB_CLK_ATB_SEL] = &g12b_cpub_clk_atb_sel.hw,
4811 [CLKID_CPUB_CLK_ATB] = &g12b_cpub_clk_atb.hw,
4812 [CLKID_CPUB_CLK_AXI_SEL] = &g12b_cpub_clk_axi_sel.hw,
4813 [CLKID_CPUB_CLK_AXI] = &g12b_cpub_clk_axi.hw,
4814 [CLKID_CPUB_CLK_TRACE_SEL] = &g12b_cpub_clk_trace_sel.hw,
4815 [CLKID_CPUB_CLK_TRACE] = &g12b_cpub_clk_trace.hw,
4816 [CLKID_SPICC0_SCLK_SEL] = &g12a_spicc0_sclk_sel.hw,
4817 [CLKID_SPICC0_SCLK_DIV] = &g12a_spicc0_sclk_div.hw,
4818 [CLKID_SPICC0_SCLK] = &g12a_spicc0_sclk.hw,
4819 [CLKID_SPICC1_SCLK_SEL] = &g12a_spicc1_sclk_sel.hw,
4820 [CLKID_SPICC1_SCLK_DIV] = &g12a_spicc1_sclk_div.hw,
4821 [CLKID_SPICC1_SCLK] = &g12a_spicc1_sclk.hw,
4822 [CLKID_NNA_AXI_CLK_SEL] = &sm1_nna_axi_clk_sel.hw,
4823 [CLKID_NNA_AXI_CLK_DIV] = &sm1_nna_axi_clk_div.hw,
4824 [CLKID_NNA_AXI_CLK] = &sm1_nna_axi_clk.hw,
4825 [CLKID_NNA_CORE_CLK_SEL] = &sm1_nna_core_clk_sel.hw,
4826 [CLKID_NNA_CORE_CLK_DIV] = &sm1_nna_core_clk_div.hw,
4827 [CLKID_NNA_CORE_CLK] = &sm1_nna_core_clk.hw,
4828 [CLKID_MIPI_DSI_PXCLK_SEL] = &g12a_mipi_dsi_pxclk_sel.hw,
4829 [CLKID_MIPI_DSI_PXCLK_DIV] = &g12a_mipi_dsi_pxclk_div.hw,
4830 [CLKID_MIPI_DSI_PXCLK] = &g12a_mipi_dsi_pxclk.hw,
4831 [CLKID_MIPI_ISP_SEL] = &g12b_mipi_isp_sel.hw,
4832 [CLKID_MIPI_ISP_DIV] = &g12b_mipi_isp_div.hw,
4833 [CLKID_MIPI_ISP] = &g12b_mipi_isp.hw,
4834 [CLKID_MIPI_ISP_GATE] = &g12b_mipi_isp_gate.hw,
4835 [CLKID_MIPI_ISP_CSI_PHY0] = &g12b_csi_phy0.hw,
4836 [CLKID_MIPI_ISP_CSI_PHY1] = &g12b_csi_phy1.hw,
4839 static struct clk_hw *sm1_hw_clks[] = {
4840 [CLKID_SYS_PLL] = &g12a_sys_pll.hw,
4841 [CLKID_FIXED_PLL] = &g12a_fixed_pll.hw,
4842 [CLKID_FCLK_DIV2] = &g12a_fclk_div2.hw,
4843 [CLKID_FCLK_DIV3] = &g12a_fclk_div3.hw,
4844 [CLKID_FCLK_DIV4] = &g12a_fclk_div4.hw,
4845 [CLKID_FCLK_DIV5] = &g12a_fclk_div5.hw,
4846 [CLKID_FCLK_DIV7] = &g12a_fclk_div7.hw,
4847 [CLKID_FCLK_DIV2P5] = &g12a_fclk_div2p5.hw,
4848 [CLKID_GP0_PLL] = &g12a_gp0_pll.hw,
4849 [CLKID_MPEG_SEL] = &g12a_mpeg_clk_sel.hw,
4850 [CLKID_MPEG_DIV] = &g12a_mpeg_clk_div.hw,
4851 [CLKID_CLK81] = &g12a_clk81.hw,
4852 [CLKID_MPLL0] = &g12a_mpll0.hw,
4853 [CLKID_MPLL1] = &g12a_mpll1.hw,
4854 [CLKID_MPLL2] = &g12a_mpll2.hw,
4855 [CLKID_MPLL3] = &g12a_mpll3.hw,
4856 [CLKID_DDR] = &g12a_ddr.hw,
4857 [CLKID_DOS] = &g12a_dos.hw,
4858 [CLKID_AUDIO_LOCKER] = &g12a_audio_locker.hw,
4859 [CLKID_MIPI_DSI_HOST] = &g12a_mipi_dsi_host.hw,
4860 [CLKID_ETH_PHY] = &g12a_eth_phy.hw,
4861 [CLKID_ISA] = &g12a_isa.hw,
4862 [CLKID_PL301] = &g12a_pl301.hw,
4863 [CLKID_PERIPHS] = &g12a_periphs.hw,
4864 [CLKID_SPICC0] = &g12a_spicc_0.hw,
4865 [CLKID_I2C] = &g12a_i2c.hw,
4866 [CLKID_SANA] = &g12a_sana.hw,
4867 [CLKID_SD] = &g12a_sd.hw,
4868 [CLKID_RNG0] = &g12a_rng0.hw,
4869 [CLKID_UART0] = &g12a_uart0.hw,
4870 [CLKID_SPICC1] = &g12a_spicc_1.hw,
4871 [CLKID_HIU_IFACE] = &g12a_hiu_reg.hw,
4872 [CLKID_MIPI_DSI_PHY] = &g12a_mipi_dsi_phy.hw,
4873 [CLKID_ASSIST_MISC] = &g12a_assist_misc.hw,
4874 [CLKID_SD_EMMC_A] = &g12a_emmc_a.hw,
4875 [CLKID_SD_EMMC_B] = &g12a_emmc_b.hw,
4876 [CLKID_SD_EMMC_C] = &g12a_emmc_c.hw,
4877 [CLKID_AUDIO_CODEC] = &g12a_audio_codec.hw,
4878 [CLKID_AUDIO] = &g12a_audio.hw,
4879 [CLKID_ETH] = &g12a_eth_core.hw,
4880 [CLKID_DEMUX] = &g12a_demux.hw,
4881 [CLKID_AUDIO_IFIFO] = &g12a_audio_ififo.hw,
4882 [CLKID_ADC] = &g12a_adc.hw,
4883 [CLKID_UART1] = &g12a_uart1.hw,
4884 [CLKID_G2D] = &g12a_g2d.hw,
4885 [CLKID_RESET] = &g12a_reset.hw,
4886 [CLKID_PCIE_COMB] = &g12a_pcie_comb.hw,
4887 [CLKID_PARSER] = &g12a_parser.hw,
4888 [CLKID_USB] = &g12a_usb_general.hw,
4889 [CLKID_PCIE_PHY] = &g12a_pcie_phy.hw,
4890 [CLKID_AHB_ARB0] = &g12a_ahb_arb0.hw,
4891 [CLKID_AHB_DATA_BUS] = &g12a_ahb_data_bus.hw,
4892 [CLKID_AHB_CTRL_BUS] = &g12a_ahb_ctrl_bus.hw,
4893 [CLKID_HTX_HDCP22] = &g12a_htx_hdcp22.hw,
4894 [CLKID_HTX_PCLK] = &g12a_htx_pclk.hw,
4895 [CLKID_BT656] = &g12a_bt656.hw,
4896 [CLKID_USB1_DDR_BRIDGE] = &g12a_usb1_to_ddr.hw,
4897 [CLKID_MMC_PCLK] = &g12a_mmc_pclk.hw,
4898 [CLKID_UART2] = &g12a_uart2.hw,
4899 [CLKID_VPU_INTR] = &g12a_vpu_intr.hw,
4900 [CLKID_GIC] = &g12a_gic.hw,
4901 [CLKID_SD_EMMC_A_CLK0_SEL] = &g12a_sd_emmc_a_clk0_sel.hw,
4902 [CLKID_SD_EMMC_A_CLK0_DIV] = &g12a_sd_emmc_a_clk0_div.hw,
4903 [CLKID_SD_EMMC_A_CLK0] = &g12a_sd_emmc_a_clk0.hw,
4904 [CLKID_SD_EMMC_B_CLK0_SEL] = &g12a_sd_emmc_b_clk0_sel.hw,
4905 [CLKID_SD_EMMC_B_CLK0_DIV] = &g12a_sd_emmc_b_clk0_div.hw,
4906 [CLKID_SD_EMMC_B_CLK0] = &g12a_sd_emmc_b_clk0.hw,
4907 [CLKID_SD_EMMC_C_CLK0_SEL] = &g12a_sd_emmc_c_clk0_sel.hw,
4908 [CLKID_SD_EMMC_C_CLK0_DIV] = &g12a_sd_emmc_c_clk0_div.hw,
4909 [CLKID_SD_EMMC_C_CLK0] = &g12a_sd_emmc_c_clk0.hw,
4910 [CLKID_MPLL0_DIV] = &g12a_mpll0_div.hw,
4911 [CLKID_MPLL1_DIV] = &g12a_mpll1_div.hw,
4912 [CLKID_MPLL2_DIV] = &g12a_mpll2_div.hw,
4913 [CLKID_MPLL3_DIV] = &g12a_mpll3_div.hw,
4914 [CLKID_FCLK_DIV2_DIV] = &g12a_fclk_div2_div.hw,
4915 [CLKID_FCLK_DIV3_DIV] = &g12a_fclk_div3_div.hw,
4916 [CLKID_FCLK_DIV4_DIV] = &g12a_fclk_div4_div.hw,
4917 [CLKID_FCLK_DIV5_DIV] = &g12a_fclk_div5_div.hw,
4918 [CLKID_FCLK_DIV7_DIV] = &g12a_fclk_div7_div.hw,
4919 [CLKID_FCLK_DIV2P5_DIV] = &g12a_fclk_div2p5_div.hw,
4920 [CLKID_HIFI_PLL] = &g12a_hifi_pll.hw,
4921 [CLKID_VCLK2_VENCI0] = &g12a_vclk2_venci0.hw,
4922 [CLKID_VCLK2_VENCI1] = &g12a_vclk2_venci1.hw,
4923 [CLKID_VCLK2_VENCP0] = &g12a_vclk2_vencp0.hw,
4924 [CLKID_VCLK2_VENCP1] = &g12a_vclk2_vencp1.hw,
4925 [CLKID_VCLK2_VENCT0] = &g12a_vclk2_venct0.hw,
4926 [CLKID_VCLK2_VENCT1] = &g12a_vclk2_venct1.hw,
4927 [CLKID_VCLK2_OTHER] = &g12a_vclk2_other.hw,
4928 [CLKID_VCLK2_ENCI] = &g12a_vclk2_enci.hw,
4929 [CLKID_VCLK2_ENCP] = &g12a_vclk2_encp.hw,
4930 [CLKID_DAC_CLK] = &g12a_dac_clk.hw,
4931 [CLKID_AOCLK] = &g12a_aoclk_gate.hw,
4932 [CLKID_IEC958] = &g12a_iec958_gate.hw,
4933 [CLKID_ENC480P] = &g12a_enc480p.hw,
4934 [CLKID_RNG1] = &g12a_rng1.hw,
4935 [CLKID_VCLK2_ENCT] = &g12a_vclk2_enct.hw,
4936 [CLKID_VCLK2_ENCL] = &g12a_vclk2_encl.hw,
4937 [CLKID_VCLK2_VENCLMMC] = &g12a_vclk2_venclmmc.hw,
4938 [CLKID_VCLK2_VENCL] = &g12a_vclk2_vencl.hw,
4939 [CLKID_VCLK2_OTHER1] = &g12a_vclk2_other1.hw,
4940 [CLKID_FIXED_PLL_DCO] = &g12a_fixed_pll_dco.hw,
4941 [CLKID_SYS_PLL_DCO] = &g12a_sys_pll_dco.hw,
4942 [CLKID_GP0_PLL_DCO] = &g12a_gp0_pll_dco.hw,
4943 [CLKID_HIFI_PLL_DCO] = &g12a_hifi_pll_dco.hw,
4944 [CLKID_DMA] = &g12a_dma.hw,
4945 [CLKID_EFUSE] = &g12a_efuse.hw,
4946 [CLKID_ROM_BOOT] = &g12a_rom_boot.hw,
4947 [CLKID_RESET_SEC] = &g12a_reset_sec.hw,
4948 [CLKID_SEC_AHB_APB3] = &g12a_sec_ahb_apb3.hw,
4949 [CLKID_MPLL_PREDIV] = &g12a_mpll_prediv.hw,
4950 [CLKID_VPU_0_SEL] = &g12a_vpu_0_sel.hw,
4951 [CLKID_VPU_0_DIV] = &g12a_vpu_0_div.hw,
4952 [CLKID_VPU_0] = &g12a_vpu_0.hw,
4953 [CLKID_VPU_1_SEL] = &g12a_vpu_1_sel.hw,
4954 [CLKID_VPU_1_DIV] = &g12a_vpu_1_div.hw,
4955 [CLKID_VPU_1] = &g12a_vpu_1.hw,
4956 [CLKID_VPU] = &g12a_vpu.hw,
4957 [CLKID_VAPB_0_SEL] = &g12a_vapb_0_sel.hw,
4958 [CLKID_VAPB_0_DIV] = &g12a_vapb_0_div.hw,
4959 [CLKID_VAPB_0] = &g12a_vapb_0.hw,
4960 [CLKID_VAPB_1_SEL] = &g12a_vapb_1_sel.hw,
4961 [CLKID_VAPB_1_DIV] = &g12a_vapb_1_div.hw,
4962 [CLKID_VAPB_1] = &g12a_vapb_1.hw,
4963 [CLKID_VAPB_SEL] = &g12a_vapb_sel.hw,
4964 [CLKID_VAPB] = &g12a_vapb.hw,
4965 [CLKID_HDMI_PLL_DCO] = &g12a_hdmi_pll_dco.hw,
4966 [CLKID_HDMI_PLL_OD] = &g12a_hdmi_pll_od.hw,
4967 [CLKID_HDMI_PLL_OD2] = &g12a_hdmi_pll_od2.hw,
4968 [CLKID_HDMI_PLL] = &g12a_hdmi_pll.hw,
4969 [CLKID_VID_PLL] = &g12a_vid_pll_div.hw,
4970 [CLKID_VID_PLL_SEL] = &g12a_vid_pll_sel.hw,
4971 [CLKID_VID_PLL_DIV] = &g12a_vid_pll.hw,
4972 [CLKID_VCLK_SEL] = &g12a_vclk_sel.hw,
4973 [CLKID_VCLK2_SEL] = &g12a_vclk2_sel.hw,
4974 [CLKID_VCLK_INPUT] = &g12a_vclk_input.hw,
4975 [CLKID_VCLK2_INPUT] = &g12a_vclk2_input.hw,
4976 [CLKID_VCLK_DIV] = &g12a_vclk_div.hw,
4977 [CLKID_VCLK2_DIV] = &g12a_vclk2_div.hw,
4978 [CLKID_VCLK] = &g12a_vclk.hw,
4979 [CLKID_VCLK2] = &g12a_vclk2.hw,
4980 [CLKID_VCLK_DIV1] = &g12a_vclk_div1.hw,
4981 [CLKID_VCLK_DIV2_EN] = &g12a_vclk_div2_en.hw,
4982 [CLKID_VCLK_DIV4_EN] = &g12a_vclk_div4_en.hw,
4983 [CLKID_VCLK_DIV6_EN] = &g12a_vclk_div6_en.hw,
4984 [CLKID_VCLK_DIV12_EN] = &g12a_vclk_div12_en.hw,
4985 [CLKID_VCLK2_DIV1] = &g12a_vclk2_div1.hw,
4986 [CLKID_VCLK2_DIV2_EN] = &g12a_vclk2_div2_en.hw,
4987 [CLKID_VCLK2_DIV4_EN] = &g12a_vclk2_div4_en.hw,
4988 [CLKID_VCLK2_DIV6_EN] = &g12a_vclk2_div6_en.hw,
4989 [CLKID_VCLK2_DIV12_EN] = &g12a_vclk2_div12_en.hw,
4990 [CLKID_VCLK_DIV2] = &g12a_vclk_div2.hw,
4991 [CLKID_VCLK_DIV4] = &g12a_vclk_div4.hw,
4992 [CLKID_VCLK_DIV6] = &g12a_vclk_div6.hw,
4993 [CLKID_VCLK_DIV12] = &g12a_vclk_div12.hw,
4994 [CLKID_VCLK2_DIV2] = &g12a_vclk2_div2.hw,
4995 [CLKID_VCLK2_DIV4] = &g12a_vclk2_div4.hw,
4996 [CLKID_VCLK2_DIV6] = &g12a_vclk2_div6.hw,
4997 [CLKID_VCLK2_DIV12] = &g12a_vclk2_div12.hw,
4998 [CLKID_CTS_ENCI_SEL] = &g12a_cts_enci_sel.hw,
4999 [CLKID_CTS_ENCP_SEL] = &g12a_cts_encp_sel.hw,
5000 [CLKID_CTS_ENCL_SEL] = &g12a_cts_encl_sel.hw,
5001 [CLKID_CTS_VDAC_SEL] = &g12a_cts_vdac_sel.hw,
5002 [CLKID_HDMI_TX_SEL] = &g12a_hdmi_tx_sel.hw,
5003 [CLKID_CTS_ENCI] = &g12a_cts_enci.hw,
5004 [CLKID_CTS_ENCP] = &g12a_cts_encp.hw,
5005 [CLKID_CTS_ENCL] = &g12a_cts_encl.hw,
5006 [CLKID_CTS_VDAC] = &g12a_cts_vdac.hw,
5007 [CLKID_HDMI_TX] = &g12a_hdmi_tx.hw,
5008 [CLKID_HDMI_SEL] = &g12a_hdmi_sel.hw,
5009 [CLKID_HDMI_DIV] = &g12a_hdmi_div.hw,
5010 [CLKID_HDMI] = &g12a_hdmi.hw,
5011 [CLKID_MALI_0_SEL] = &g12a_mali_0_sel.hw,
5012 [CLKID_MALI_0_DIV] = &g12a_mali_0_div.hw,
5013 [CLKID_MALI_0] = &g12a_mali_0.hw,
5014 [CLKID_MALI_1_SEL] = &g12a_mali_1_sel.hw,
5015 [CLKID_MALI_1_DIV] = &g12a_mali_1_div.hw,
5016 [CLKID_MALI_1] = &g12a_mali_1.hw,
5017 [CLKID_MALI] = &g12a_mali.hw,
5018 [CLKID_MPLL_50M_DIV] = &g12a_mpll_50m_div.hw,
5019 [CLKID_MPLL_50M] = &g12a_mpll_50m.hw,
5020 [CLKID_SYS_PLL_DIV16_EN] = &g12a_sys_pll_div16_en.hw,
5021 [CLKID_SYS_PLL_DIV16] = &g12a_sys_pll_div16.hw,
5022 [CLKID_CPU_CLK_DYN0_SEL] = &g12a_cpu_clk_premux0.hw,
5023 [CLKID_CPU_CLK_DYN0_DIV] = &g12a_cpu_clk_mux0_div.hw,
5024 [CLKID_CPU_CLK_DYN0] = &g12a_cpu_clk_postmux0.hw,
5025 [CLKID_CPU_CLK_DYN1_SEL] = &g12a_cpu_clk_premux1.hw,
5026 [CLKID_CPU_CLK_DYN1_DIV] = &g12a_cpu_clk_mux1_div.hw,
5027 [CLKID_CPU_CLK_DYN1] = &g12a_cpu_clk_postmux1.hw,
5028 [CLKID_CPU_CLK_DYN] = &g12a_cpu_clk_dyn.hw,
5029 [CLKID_CPU_CLK] = &g12a_cpu_clk.hw,
5030 [CLKID_CPU_CLK_DIV16_EN] = &g12a_cpu_clk_div16_en.hw,
5031 [CLKID_CPU_CLK_DIV16] = &g12a_cpu_clk_div16.hw,
5032 [CLKID_CPU_CLK_APB_DIV] = &g12a_cpu_clk_apb_div.hw,
5033 [CLKID_CPU_CLK_APB] = &g12a_cpu_clk_apb.hw,
5034 [CLKID_CPU_CLK_ATB_DIV] = &g12a_cpu_clk_atb_div.hw,
5035 [CLKID_CPU_CLK_ATB] = &g12a_cpu_clk_atb.hw,
5036 [CLKID_CPU_CLK_AXI_DIV] = &g12a_cpu_clk_axi_div.hw,
5037 [CLKID_CPU_CLK_AXI] = &g12a_cpu_clk_axi.hw,
5038 [CLKID_CPU_CLK_TRACE_DIV] = &g12a_cpu_clk_trace_div.hw,
5039 [CLKID_CPU_CLK_TRACE] = &g12a_cpu_clk_trace.hw,
5040 [CLKID_PCIE_PLL_DCO] = &g12a_pcie_pll_dco.hw,
5041 [CLKID_PCIE_PLL_DCO_DIV2] = &g12a_pcie_pll_dco_div2.hw,
5042 [CLKID_PCIE_PLL_OD] = &g12a_pcie_pll_od.hw,
5043 [CLKID_PCIE_PLL] = &g12a_pcie_pll.hw,
5044 [CLKID_VDEC_1_SEL] = &g12a_vdec_1_sel.hw,
5045 [CLKID_VDEC_1_DIV] = &g12a_vdec_1_div.hw,
5046 [CLKID_VDEC_1] = &g12a_vdec_1.hw,
5047 [CLKID_VDEC_HEVC_SEL] = &g12a_vdec_hevc_sel.hw,
5048 [CLKID_VDEC_HEVC_DIV] = &g12a_vdec_hevc_div.hw,
5049 [CLKID_VDEC_HEVC] = &g12a_vdec_hevc.hw,
5050 [CLKID_VDEC_HEVCF_SEL] = &g12a_vdec_hevcf_sel.hw,
5051 [CLKID_VDEC_HEVCF_DIV] = &g12a_vdec_hevcf_div.hw,
5052 [CLKID_VDEC_HEVCF] = &g12a_vdec_hevcf.hw,
5053 [CLKID_TS_DIV] = &g12a_ts_div.hw,
5054 [CLKID_TS] = &g12a_ts.hw,
5055 [CLKID_GP1_PLL_DCO] = &sm1_gp1_pll_dco.hw,
5056 [CLKID_GP1_PLL] = &sm1_gp1_pll.hw,
5057 [CLKID_DSU_CLK_DYN0_SEL] = &sm1_dsu_clk_premux0.hw,
5058 [CLKID_DSU_CLK_DYN0_DIV] = &sm1_dsu_clk_premux1.hw,
5059 [CLKID_DSU_CLK_DYN0] = &sm1_dsu_clk_mux0_div.hw,
5060 [CLKID_DSU_CLK_DYN1_SEL] = &sm1_dsu_clk_postmux0.hw,
5061 [CLKID_DSU_CLK_DYN1_DIV] = &sm1_dsu_clk_mux1_div.hw,
5062 [CLKID_DSU_CLK_DYN1] = &sm1_dsu_clk_postmux1.hw,
5063 [CLKID_DSU_CLK_DYN] = &sm1_dsu_clk_dyn.hw,
5064 [CLKID_DSU_CLK_FINAL] = &sm1_dsu_final_clk.hw,
5065 [CLKID_DSU_CLK] = &sm1_dsu_clk.hw,
5066 [CLKID_CPU1_CLK] = &sm1_cpu1_clk.hw,
5067 [CLKID_CPU2_CLK] = &sm1_cpu2_clk.hw,
5068 [CLKID_CPU3_CLK] = &sm1_cpu3_clk.hw,
5069 [CLKID_SPICC0_SCLK_SEL] = &g12a_spicc0_sclk_sel.hw,
5070 [CLKID_SPICC0_SCLK_DIV] = &g12a_spicc0_sclk_div.hw,
5071 [CLKID_SPICC0_SCLK] = &g12a_spicc0_sclk.hw,
5072 [CLKID_SPICC1_SCLK_SEL] = &g12a_spicc1_sclk_sel.hw,
5073 [CLKID_SPICC1_SCLK_DIV] = &g12a_spicc1_sclk_div.hw,
5074 [CLKID_SPICC1_SCLK] = &g12a_spicc1_sclk.hw,
5075 [CLKID_NNA_AXI_CLK_SEL] = &sm1_nna_axi_clk_sel.hw,
5076 [CLKID_NNA_AXI_CLK_DIV] = &sm1_nna_axi_clk_div.hw,
5077 [CLKID_NNA_AXI_CLK] = &sm1_nna_axi_clk.hw,
5078 [CLKID_NNA_CORE_CLK_SEL] = &sm1_nna_core_clk_sel.hw,
5079 [CLKID_NNA_CORE_CLK_DIV] = &sm1_nna_core_clk_div.hw,
5080 [CLKID_NNA_CORE_CLK] = &sm1_nna_core_clk.hw,
5081 [CLKID_MIPI_DSI_PXCLK_SEL] = &g12a_mipi_dsi_pxclk_sel.hw,
5082 [CLKID_MIPI_DSI_PXCLK_DIV] = &g12a_mipi_dsi_pxclk_div.hw,
5083 [CLKID_MIPI_DSI_PXCLK] = &g12a_mipi_dsi_pxclk.hw,
5086 /* Convenience table to populate regmap in .probe */
5087 static struct clk_regmap *const g12a_clk_regmaps[] = {
5092 &g12a_mipi_dsi_host,
5134 &g12a_sd_emmc_a_clk0,
5135 &g12a_sd_emmc_b_clk0,
5136 &g12a_sd_emmc_c_clk0,
5138 &g12a_sd_emmc_a_clk0_div,
5139 &g12a_sd_emmc_b_clk0_div,
5140 &g12a_sd_emmc_c_clk0_div,
5142 &g12a_sd_emmc_a_clk0_sel,
5143 &g12a_sd_emmc_b_clk0_sel,
5144 &g12a_sd_emmc_c_clk0_sel,
5173 &g12a_vclk2_venclmmc,
5176 &g12a_fixed_pll_dco,
5225 &g12a_vclk_div12_en,
5227 &g12a_vclk2_div2_en,
5228 &g12a_vclk2_div4_en,
5229 &g12a_vclk2_div6_en,
5230 &g12a_vclk2_div12_en,
5252 &g12a_sys_pll_div16_en,
5253 &g12a_cpu_clk_premux0,
5254 &g12a_cpu_clk_mux0_div,
5255 &g12a_cpu_clk_postmux0,
5256 &g12a_cpu_clk_premux1,
5257 &g12a_cpu_clk_mux1_div,
5258 &g12a_cpu_clk_postmux1,
5261 &g12a_cpu_clk_div16_en,
5262 &g12a_cpu_clk_apb_div,
5264 &g12a_cpu_clk_atb_div,
5266 &g12a_cpu_clk_axi_div,
5268 &g12a_cpu_clk_trace_div,
5269 &g12a_cpu_clk_trace,
5275 &g12a_vdec_hevc_sel,
5276 &g12a_vdec_hevc_div,
5278 &g12a_vdec_hevcf_sel,
5279 &g12a_vdec_hevcf_div,
5286 &g12b_sys1_pll_div16_en,
5287 &g12b_cpub_clk_premux0,
5288 &g12b_cpub_clk_mux0_div,
5289 &g12b_cpub_clk_postmux0,
5290 &g12b_cpub_clk_premux1,
5291 &g12b_cpub_clk_mux1_div,
5292 &g12b_cpub_clk_postmux1,
5295 &g12b_cpub_clk_div16_en,
5296 &g12b_cpub_clk_apb_sel,
5298 &g12b_cpub_clk_atb_sel,
5300 &g12b_cpub_clk_axi_sel,
5302 &g12b_cpub_clk_trace_sel,
5303 &g12b_cpub_clk_trace,
5306 &sm1_dsu_clk_premux0,
5307 &sm1_dsu_clk_premux1,
5308 &sm1_dsu_clk_mux0_div,
5309 &sm1_dsu_clk_postmux0,
5310 &sm1_dsu_clk_mux1_div,
5311 &sm1_dsu_clk_postmux1,
5318 &g12a_spicc0_sclk_sel,
5319 &g12a_spicc0_sclk_div,
5321 &g12a_spicc1_sclk_sel,
5322 &g12a_spicc1_sclk_div,
5324 &sm1_nna_axi_clk_sel,
5325 &sm1_nna_axi_clk_div,
5327 &sm1_nna_core_clk_sel,
5328 &sm1_nna_core_clk_div,
5330 &g12a_mipi_dsi_pxclk_sel,
5331 &g12a_mipi_dsi_pxclk_div,
5332 &g12a_mipi_dsi_pxclk,
5336 &g12b_mipi_isp_gate,
5341 static const struct reg_sequence g12a_init_regs[] = {
5342 { .reg = HHI_MPLL_CNTL0, .def = 0x00000543 },
5345 #define DVFS_CON_ID "dvfs"
5347 static int meson_g12a_dvfs_setup_common(struct device *dev,
5348 struct clk_hw **hws)
5350 struct clk *notifier_clk;
5351 struct clk_hw *xtal;
5354 xtal = clk_hw_get_parent_by_index(hws[CLKID_CPU_CLK_DYN1_SEL], 0);
5356 /* Setup clock notifier for cpu_clk_postmux0 */
5357 g12a_cpu_clk_postmux0_nb_data.xtal = xtal;
5358 notifier_clk = devm_clk_hw_get_clk(dev, &g12a_cpu_clk_postmux0.hw,
5360 ret = devm_clk_notifier_register(dev, notifier_clk,
5361 &g12a_cpu_clk_postmux0_nb_data.nb);
5363 dev_err(dev, "failed to register the cpu_clk_postmux0 notifier\n");
5367 /* Setup clock notifier for cpu_clk_dyn mux */
5368 notifier_clk = devm_clk_hw_get_clk(dev, &g12a_cpu_clk_dyn.hw,
5370 ret = devm_clk_notifier_register(dev, notifier_clk,
5371 &g12a_cpu_clk_mux_nb);
5373 dev_err(dev, "failed to register the cpu_clk_dyn notifier\n");
5380 static int meson_g12b_dvfs_setup(struct platform_device *pdev)
5382 struct clk_hw **hws = g12b_hw_clks;
5383 struct device *dev = &pdev->dev;
5384 struct clk *notifier_clk;
5385 struct clk_hw *xtal;
5388 ret = meson_g12a_dvfs_setup_common(dev, hws);
5392 xtal = clk_hw_get_parent_by_index(hws[CLKID_CPU_CLK_DYN1_SEL], 0);
5394 /* Setup clock notifier for cpu_clk mux */
5395 notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpu_clk.hw,
5397 ret = devm_clk_notifier_register(dev, notifier_clk,
5398 &g12a_cpu_clk_mux_nb);
5400 dev_err(dev, "failed to register the cpu_clk notifier\n");
5404 /* Setup clock notifier for sys1_pll */
5405 notifier_clk = devm_clk_hw_get_clk(dev, &g12b_sys1_pll.hw,
5407 ret = devm_clk_notifier_register(dev, notifier_clk,
5408 &g12b_cpu_clk_sys1_pll_nb_data.nb);
5410 dev_err(dev, "failed to register the sys1_pll notifier\n");
5414 /* Add notifiers for the second CPU cluster */
5416 /* Setup clock notifier for cpub_clk_postmux0 */
5417 g12b_cpub_clk_postmux0_nb_data.xtal = xtal;
5418 notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpub_clk_postmux0.hw,
5420 ret = devm_clk_notifier_register(dev, notifier_clk,
5421 &g12b_cpub_clk_postmux0_nb_data.nb);
5423 dev_err(dev, "failed to register the cpub_clk_postmux0 notifier\n");
5427 /* Setup clock notifier for cpub_clk_dyn mux */
5428 notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpub_clk_dyn.hw, "dvfs");
5429 ret = devm_clk_notifier_register(dev, notifier_clk,
5430 &g12a_cpu_clk_mux_nb);
5432 dev_err(dev, "failed to register the cpub_clk_dyn notifier\n");
5436 /* Setup clock notifier for cpub_clk mux */
5437 notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpub_clk.hw, DVFS_CON_ID);
5438 ret = devm_clk_notifier_register(dev, notifier_clk,
5439 &g12a_cpu_clk_mux_nb);
5441 dev_err(dev, "failed to register the cpub_clk notifier\n");
5445 /* Setup clock notifier for sys_pll */
5446 notifier_clk = devm_clk_hw_get_clk(dev, &g12a_sys_pll.hw, DVFS_CON_ID);
5447 ret = devm_clk_notifier_register(dev, notifier_clk,
5448 &g12b_cpub_clk_sys_pll_nb_data.nb);
5450 dev_err(dev, "failed to register the sys_pll notifier\n");
5457 static int meson_g12a_dvfs_setup(struct platform_device *pdev)
5459 struct clk_hw **hws = g12a_hw_clks;
5460 struct device *dev = &pdev->dev;
5461 struct clk *notifier_clk;
5464 ret = meson_g12a_dvfs_setup_common(dev, hws);
5468 /* Setup clock notifier for cpu_clk mux */
5469 notifier_clk = devm_clk_hw_get_clk(dev, &g12a_cpu_clk.hw, DVFS_CON_ID);
5470 ret = devm_clk_notifier_register(dev, notifier_clk,
5471 &g12a_cpu_clk_mux_nb);
5473 dev_err(dev, "failed to register the cpu_clk notifier\n");
5477 /* Setup clock notifier for sys_pll */
5478 notifier_clk = devm_clk_hw_get_clk(dev, &g12a_sys_pll.hw, DVFS_CON_ID);
5479 ret = devm_clk_notifier_register(dev, notifier_clk,
5480 &g12a_sys_pll_nb_data.nb);
5482 dev_err(dev, "failed to register the sys_pll notifier\n");
5489 struct meson_g12a_data {
5490 const struct meson_eeclkc_data eeclkc_data;
5491 int (*dvfs_setup)(struct platform_device *pdev);
5494 static int meson_g12a_probe(struct platform_device *pdev)
5496 const struct meson_eeclkc_data *eeclkc_data;
5497 const struct meson_g12a_data *g12a_data;
5500 eeclkc_data = of_device_get_match_data(&pdev->dev);
5504 ret = meson_eeclkc_probe(pdev);
5508 g12a_data = container_of(eeclkc_data, struct meson_g12a_data,
5511 if (g12a_data->dvfs_setup)
5512 return g12a_data->dvfs_setup(pdev);
5517 static const struct meson_g12a_data g12a_clkc_data = {
5519 .regmap_clks = g12a_clk_regmaps,
5520 .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps),
5522 .hws = g12a_hw_clks,
5523 .num = ARRAY_SIZE(g12a_hw_clks),
5525 .init_regs = g12a_init_regs,
5526 .init_count = ARRAY_SIZE(g12a_init_regs),
5528 .dvfs_setup = meson_g12a_dvfs_setup,
5531 static const struct meson_g12a_data g12b_clkc_data = {
5533 .regmap_clks = g12a_clk_regmaps,
5534 .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps),
5536 .hws = g12b_hw_clks,
5537 .num = ARRAY_SIZE(g12b_hw_clks),
5540 .dvfs_setup = meson_g12b_dvfs_setup,
5543 static const struct meson_g12a_data sm1_clkc_data = {
5545 .regmap_clks = g12a_clk_regmaps,
5546 .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps),
5549 .num = ARRAY_SIZE(sm1_hw_clks),
5552 .dvfs_setup = meson_g12a_dvfs_setup,
5555 static const struct of_device_id clkc_match_table[] = {
5557 .compatible = "amlogic,g12a-clkc",
5558 .data = &g12a_clkc_data.eeclkc_data
5561 .compatible = "amlogic,g12b-clkc",
5562 .data = &g12b_clkc_data.eeclkc_data
5565 .compatible = "amlogic,sm1-clkc",
5566 .data = &sm1_clkc_data.eeclkc_data
5570 MODULE_DEVICE_TABLE(of, clkc_match_table);
5572 static struct platform_driver g12a_driver = {
5573 .probe = meson_g12a_probe,
5575 .name = "g12a-clkc",
5576 .of_match_table = clkc_match_table,
5580 module_platform_driver(g12a_driver);
5581 MODULE_LICENSE("GPL v2");