1 // SPDX-License-Identifier: GPL-2.0+
3 * Amlogic Meson-G12A Clock Controller Driver
5 * Copyright (c) 2016 Baylibre SAS.
8 * Copyright (c) 2018 Amlogic, inc.
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"
26 #include "meson-eeclk.h"
29 #include <dt-bindings/clock/g12a-clkc.h>
31 static DEFINE_SPINLOCK(meson_clk_lock);
33 static struct clk_regmap g12a_fixed_pll_dco = {
34 .data = &(struct meson_clk_pll_data){
36 .reg_off = HHI_FIX_PLL_CNTL0,
41 .reg_off = HHI_FIX_PLL_CNTL0,
46 .reg_off = HHI_FIX_PLL_CNTL0,
51 .reg_off = HHI_FIX_PLL_CNTL1,
56 .reg_off = HHI_FIX_PLL_CNTL0,
61 .reg_off = HHI_FIX_PLL_CNTL0,
66 .hw.init = &(struct clk_init_data){
67 .name = "fixed_pll_dco",
68 .ops = &meson_clk_pll_ro_ops,
69 .parent_data = &(const struct clk_parent_data) {
76 static struct clk_regmap g12a_fixed_pll = {
77 .data = &(struct clk_regmap_div_data){
78 .offset = HHI_FIX_PLL_CNTL0,
81 .flags = CLK_DIVIDER_POWER_OF_TWO,
83 .hw.init = &(struct clk_init_data){
85 .ops = &clk_regmap_divider_ro_ops,
86 .parent_hws = (const struct clk_hw *[]) {
87 &g12a_fixed_pll_dco.hw
91 * This clock won't ever change at runtime so
92 * CLK_SET_RATE_PARENT is not required
97 static const struct pll_mult_range g12a_sys_pll_mult_range = {
102 static struct clk_regmap g12a_sys_pll_dco = {
103 .data = &(struct meson_clk_pll_data){
105 .reg_off = HHI_SYS_PLL_CNTL0,
110 .reg_off = HHI_SYS_PLL_CNTL0,
115 .reg_off = HHI_SYS_PLL_CNTL0,
120 .reg_off = HHI_SYS_PLL_CNTL0,
125 .reg_off = HHI_SYS_PLL_CNTL0,
129 .range = &g12a_sys_pll_mult_range,
131 .hw.init = &(struct clk_init_data){
132 .name = "sys_pll_dco",
133 .ops = &meson_clk_pll_ops,
134 .parent_data = &(const struct clk_parent_data) {
138 /* This clock feeds the CPU, avoid disabling it */
139 .flags = CLK_IS_CRITICAL,
143 static struct clk_regmap g12a_sys_pll = {
144 .data = &(struct clk_regmap_div_data){
145 .offset = HHI_SYS_PLL_CNTL0,
148 .flags = CLK_DIVIDER_POWER_OF_TWO,
150 .hw.init = &(struct clk_init_data){
152 .ops = &clk_regmap_divider_ops,
153 .parent_hws = (const struct clk_hw *[]) {
157 .flags = CLK_SET_RATE_PARENT,
161 static struct clk_regmap g12b_sys1_pll_dco = {
162 .data = &(struct meson_clk_pll_data){
164 .reg_off = HHI_SYS1_PLL_CNTL0,
169 .reg_off = HHI_SYS1_PLL_CNTL0,
174 .reg_off = HHI_SYS1_PLL_CNTL0,
179 .reg_off = HHI_SYS1_PLL_CNTL0,
184 .reg_off = HHI_SYS1_PLL_CNTL0,
188 .range = &g12a_sys_pll_mult_range,
190 .hw.init = &(struct clk_init_data){
191 .name = "sys1_pll_dco",
192 .ops = &meson_clk_pll_ops,
193 .parent_data = &(const struct clk_parent_data) {
197 /* This clock feeds the CPU, avoid disabling it */
198 .flags = CLK_IS_CRITICAL,
202 static struct clk_regmap g12b_sys1_pll = {
203 .data = &(struct clk_regmap_div_data){
204 .offset = HHI_SYS1_PLL_CNTL0,
207 .flags = CLK_DIVIDER_POWER_OF_TWO,
209 .hw.init = &(struct clk_init_data){
211 .ops = &clk_regmap_divider_ops,
212 .parent_hws = (const struct clk_hw *[]) {
213 &g12b_sys1_pll_dco.hw
216 .flags = CLK_SET_RATE_PARENT,
220 static struct clk_regmap g12a_sys_pll_div16_en = {
221 .data = &(struct clk_regmap_gate_data){
222 .offset = HHI_SYS_CPU_CLK_CNTL1,
225 .hw.init = &(struct clk_init_data) {
226 .name = "sys_pll_div16_en",
227 .ops = &clk_regmap_gate_ro_ops,
228 .parent_hws = (const struct clk_hw *[]) { &g12a_sys_pll.hw },
231 * This clock is used to debug the sys_pll range
232 * Linux should not change it at runtime
237 static struct clk_regmap g12b_sys1_pll_div16_en = {
238 .data = &(struct clk_regmap_gate_data){
239 .offset = HHI_SYS_CPUB_CLK_CNTL1,
242 .hw.init = &(struct clk_init_data) {
243 .name = "sys1_pll_div16_en",
244 .ops = &clk_regmap_gate_ro_ops,
245 .parent_hws = (const struct clk_hw *[]) {
250 * This clock is used to debug the sys_pll range
251 * Linux should not change it at runtime
256 static struct clk_fixed_factor g12a_sys_pll_div16 = {
259 .hw.init = &(struct clk_init_data){
260 .name = "sys_pll_div16",
261 .ops = &clk_fixed_factor_ops,
262 .parent_hws = (const struct clk_hw *[]) {
263 &g12a_sys_pll_div16_en.hw
269 static struct clk_fixed_factor g12b_sys1_pll_div16 = {
272 .hw.init = &(struct clk_init_data){
273 .name = "sys1_pll_div16",
274 .ops = &clk_fixed_factor_ops,
275 .parent_hws = (const struct clk_hw *[]) {
276 &g12b_sys1_pll_div16_en.hw
282 static struct clk_fixed_factor g12a_fclk_div2_div = {
285 .hw.init = &(struct clk_init_data){
286 .name = "fclk_div2_div",
287 .ops = &clk_fixed_factor_ops,
288 .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
293 static struct clk_regmap g12a_fclk_div2 = {
294 .data = &(struct clk_regmap_gate_data){
295 .offset = HHI_FIX_PLL_CNTL1,
298 .hw.init = &(struct clk_init_data){
300 .ops = &clk_regmap_gate_ops,
301 .parent_hws = (const struct clk_hw *[]) {
302 &g12a_fclk_div2_div.hw
306 * Similar to fclk_div3, it seems that this clock is used by
307 * the resident firmware and is required by the platform to
309 * Until the following condition are met, we need this clock to
310 * be marked as critical:
311 * a) Mark the clock used by a firmware resource, if possible
312 * b) CCF has a clock hand-off mechanism to make the sure the
313 * clock stays on until the proper driver comes along
315 .flags = CLK_IS_CRITICAL,
319 static struct clk_fixed_factor g12a_fclk_div3_div = {
322 .hw.init = &(struct clk_init_data){
323 .name = "fclk_div3_div",
324 .ops = &clk_fixed_factor_ops,
325 .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
330 static struct clk_regmap g12a_fclk_div3 = {
331 .data = &(struct clk_regmap_gate_data){
332 .offset = HHI_FIX_PLL_CNTL1,
335 .hw.init = &(struct clk_init_data){
337 .ops = &clk_regmap_gate_ops,
338 .parent_hws = (const struct clk_hw *[]) {
339 &g12a_fclk_div3_div.hw
343 * This clock is used by the resident firmware and is required
344 * by the platform to operate correctly.
345 * Until the following condition are met, we need this clock to
346 * be marked as critical:
347 * a) Mark the clock used by a firmware resource, if possible
348 * b) CCF has a clock hand-off mechanism to make the sure the
349 * clock stays on until the proper driver comes along
351 .flags = CLK_IS_CRITICAL,
355 /* Datasheet names this field as "premux0" */
356 static struct clk_regmap g12a_cpu_clk_premux0 = {
357 .data = &(struct clk_regmap_mux_data){
358 .offset = HHI_SYS_CPU_CLK_CNTL0,
361 .flags = CLK_MUX_ROUND_CLOSEST,
363 .hw.init = &(struct clk_init_data){
364 .name = "cpu_clk_dyn0_sel",
365 .ops = &clk_regmap_mux_ops,
366 .parent_data = (const struct clk_parent_data []) {
367 { .fw_name = "xtal", },
368 { .hw = &g12a_fclk_div2.hw },
369 { .hw = &g12a_fclk_div3.hw },
372 .flags = CLK_SET_RATE_PARENT,
376 /* Datasheet names this field as "premux1" */
377 static struct clk_regmap g12a_cpu_clk_premux1 = {
378 .data = &(struct clk_regmap_mux_data){
379 .offset = HHI_SYS_CPU_CLK_CNTL0,
383 .hw.init = &(struct clk_init_data){
384 .name = "cpu_clk_dyn1_sel",
385 .ops = &clk_regmap_mux_ops,
386 .parent_data = (const struct clk_parent_data []) {
387 { .fw_name = "xtal", },
388 { .hw = &g12a_fclk_div2.hw },
389 { .hw = &g12a_fclk_div3.hw },
392 /* This sub-tree is used a parking clock */
393 .flags = CLK_SET_RATE_NO_REPARENT
397 /* Datasheet names this field as "mux0_divn_tcnt" */
398 static struct clk_regmap g12a_cpu_clk_mux0_div = {
399 .data = &(struct meson_clk_cpu_dyndiv_data){
401 .reg_off = HHI_SYS_CPU_CLK_CNTL0,
406 .reg_off = HHI_SYS_CPU_CLK_CNTL0,
411 .hw.init = &(struct clk_init_data){
412 .name = "cpu_clk_dyn0_div",
413 .ops = &meson_clk_cpu_dyndiv_ops,
414 .parent_hws = (const struct clk_hw *[]) {
415 &g12a_cpu_clk_premux0.hw
418 .flags = CLK_SET_RATE_PARENT,
422 /* Datasheet names this field as "postmux0" */
423 static struct clk_regmap g12a_cpu_clk_postmux0 = {
424 .data = &(struct clk_regmap_mux_data){
425 .offset = HHI_SYS_CPU_CLK_CNTL0,
428 .flags = CLK_MUX_ROUND_CLOSEST,
430 .hw.init = &(struct clk_init_data){
431 .name = "cpu_clk_dyn0",
432 .ops = &clk_regmap_mux_ops,
433 .parent_hws = (const struct clk_hw *[]) {
434 &g12a_cpu_clk_premux0.hw,
435 &g12a_cpu_clk_mux0_div.hw,
438 .flags = CLK_SET_RATE_PARENT,
442 /* Datasheet names this field as "Mux1_divn_tcnt" */
443 static struct clk_regmap g12a_cpu_clk_mux1_div = {
444 .data = &(struct clk_regmap_div_data){
445 .offset = HHI_SYS_CPU_CLK_CNTL0,
449 .hw.init = &(struct clk_init_data){
450 .name = "cpu_clk_dyn1_div",
451 .ops = &clk_regmap_divider_ro_ops,
452 .parent_hws = (const struct clk_hw *[]) {
453 &g12a_cpu_clk_premux1.hw
459 /* Datasheet names this field as "postmux1" */
460 static struct clk_regmap g12a_cpu_clk_postmux1 = {
461 .data = &(struct clk_regmap_mux_data){
462 .offset = HHI_SYS_CPU_CLK_CNTL0,
466 .hw.init = &(struct clk_init_data){
467 .name = "cpu_clk_dyn1",
468 .ops = &clk_regmap_mux_ops,
469 .parent_hws = (const struct clk_hw *[]) {
470 &g12a_cpu_clk_premux1.hw,
471 &g12a_cpu_clk_mux1_div.hw,
474 /* This sub-tree is used a parking clock */
475 .flags = CLK_SET_RATE_NO_REPARENT,
479 /* Datasheet names this field as "Final_dyn_mux_sel" */
480 static struct clk_regmap g12a_cpu_clk_dyn = {
481 .data = &(struct clk_regmap_mux_data){
482 .offset = HHI_SYS_CPU_CLK_CNTL0,
485 .flags = CLK_MUX_ROUND_CLOSEST,
487 .hw.init = &(struct clk_init_data){
488 .name = "cpu_clk_dyn",
489 .ops = &clk_regmap_mux_ops,
490 .parent_hws = (const struct clk_hw *[]) {
491 &g12a_cpu_clk_postmux0.hw,
492 &g12a_cpu_clk_postmux1.hw,
495 .flags = CLK_SET_RATE_PARENT,
499 /* Datasheet names this field as "Final_mux_sel" */
500 static struct clk_regmap g12a_cpu_clk = {
501 .data = &(struct clk_regmap_mux_data){
502 .offset = HHI_SYS_CPU_CLK_CNTL0,
505 .flags = CLK_MUX_ROUND_CLOSEST,
507 .hw.init = &(struct clk_init_data){
509 .ops = &clk_regmap_mux_ops,
510 .parent_hws = (const struct clk_hw *[]) {
511 &g12a_cpu_clk_dyn.hw,
515 .flags = CLK_SET_RATE_PARENT,
519 /* Datasheet names this field as "Final_mux_sel" */
520 static struct clk_regmap g12b_cpu_clk = {
521 .data = &(struct clk_regmap_mux_data){
522 .offset = HHI_SYS_CPU_CLK_CNTL0,
525 .flags = CLK_MUX_ROUND_CLOSEST,
527 .hw.init = &(struct clk_init_data){
529 .ops = &clk_regmap_mux_ops,
530 .parent_hws = (const struct clk_hw *[]) {
531 &g12a_cpu_clk_dyn.hw,
535 .flags = CLK_SET_RATE_PARENT,
539 /* Datasheet names this field as "premux0" */
540 static struct clk_regmap g12b_cpub_clk_premux0 = {
541 .data = &(struct clk_regmap_mux_data){
542 .offset = HHI_SYS_CPUB_CLK_CNTL,
545 .flags = CLK_MUX_ROUND_CLOSEST,
547 .hw.init = &(struct clk_init_data){
548 .name = "cpub_clk_dyn0_sel",
549 .ops = &clk_regmap_mux_ops,
550 .parent_data = (const struct clk_parent_data []) {
551 { .fw_name = "xtal", },
552 { .hw = &g12a_fclk_div2.hw },
553 { .hw = &g12a_fclk_div3.hw },
556 .flags = CLK_SET_RATE_PARENT,
560 /* Datasheet names this field as "mux0_divn_tcnt" */
561 static struct clk_regmap g12b_cpub_clk_mux0_div = {
562 .data = &(struct meson_clk_cpu_dyndiv_data){
564 .reg_off = HHI_SYS_CPUB_CLK_CNTL,
569 .reg_off = HHI_SYS_CPUB_CLK_CNTL,
574 .hw.init = &(struct clk_init_data){
575 .name = "cpub_clk_dyn0_div",
576 .ops = &meson_clk_cpu_dyndiv_ops,
577 .parent_hws = (const struct clk_hw *[]) {
578 &g12b_cpub_clk_premux0.hw
581 .flags = CLK_SET_RATE_PARENT,
585 /* Datasheet names this field as "postmux0" */
586 static struct clk_regmap g12b_cpub_clk_postmux0 = {
587 .data = &(struct clk_regmap_mux_data){
588 .offset = HHI_SYS_CPUB_CLK_CNTL,
591 .flags = CLK_MUX_ROUND_CLOSEST,
593 .hw.init = &(struct clk_init_data){
594 .name = "cpub_clk_dyn0",
595 .ops = &clk_regmap_mux_ops,
596 .parent_hws = (const struct clk_hw *[]) {
597 &g12b_cpub_clk_premux0.hw,
598 &g12b_cpub_clk_mux0_div.hw
601 .flags = CLK_SET_RATE_PARENT,
605 /* Datasheet names this field as "premux1" */
606 static struct clk_regmap g12b_cpub_clk_premux1 = {
607 .data = &(struct clk_regmap_mux_data){
608 .offset = HHI_SYS_CPUB_CLK_CNTL,
612 .hw.init = &(struct clk_init_data){
613 .name = "cpub_clk_dyn1_sel",
614 .ops = &clk_regmap_mux_ops,
615 .parent_data = (const struct clk_parent_data []) {
616 { .fw_name = "xtal", },
617 { .hw = &g12a_fclk_div2.hw },
618 { .hw = &g12a_fclk_div3.hw },
621 /* This sub-tree is used a parking clock */
622 .flags = CLK_SET_RATE_NO_REPARENT,
626 /* Datasheet names this field as "Mux1_divn_tcnt" */
627 static struct clk_regmap g12b_cpub_clk_mux1_div = {
628 .data = &(struct clk_regmap_div_data){
629 .offset = HHI_SYS_CPUB_CLK_CNTL,
633 .hw.init = &(struct clk_init_data){
634 .name = "cpub_clk_dyn1_div",
635 .ops = &clk_regmap_divider_ro_ops,
636 .parent_hws = (const struct clk_hw *[]) {
637 &g12b_cpub_clk_premux1.hw
643 /* Datasheet names this field as "postmux1" */
644 static struct clk_regmap g12b_cpub_clk_postmux1 = {
645 .data = &(struct clk_regmap_mux_data){
646 .offset = HHI_SYS_CPUB_CLK_CNTL,
650 .hw.init = &(struct clk_init_data){
651 .name = "cpub_clk_dyn1",
652 .ops = &clk_regmap_mux_ops,
653 .parent_hws = (const struct clk_hw *[]) {
654 &g12b_cpub_clk_premux1.hw,
655 &g12b_cpub_clk_mux1_div.hw
658 /* This sub-tree is used a parking clock */
659 .flags = CLK_SET_RATE_NO_REPARENT,
663 /* Datasheet names this field as "Final_dyn_mux_sel" */
664 static struct clk_regmap g12b_cpub_clk_dyn = {
665 .data = &(struct clk_regmap_mux_data){
666 .offset = HHI_SYS_CPUB_CLK_CNTL,
669 .flags = CLK_MUX_ROUND_CLOSEST,
671 .hw.init = &(struct clk_init_data){
672 .name = "cpub_clk_dyn",
673 .ops = &clk_regmap_mux_ops,
674 .parent_hws = (const struct clk_hw *[]) {
675 &g12b_cpub_clk_postmux0.hw,
676 &g12b_cpub_clk_postmux1.hw
679 .flags = CLK_SET_RATE_PARENT,
683 /* Datasheet names this field as "Final_mux_sel" */
684 static struct clk_regmap g12b_cpub_clk = {
685 .data = &(struct clk_regmap_mux_data){
686 .offset = HHI_SYS_CPUB_CLK_CNTL,
689 .flags = CLK_MUX_ROUND_CLOSEST,
691 .hw.init = &(struct clk_init_data){
693 .ops = &clk_regmap_mux_ops,
694 .parent_hws = (const struct clk_hw *[]) {
695 &g12b_cpub_clk_dyn.hw,
699 .flags = CLK_SET_RATE_PARENT,
703 static struct clk_regmap sm1_gp1_pll;
705 /* Datasheet names this field as "premux0" */
706 static struct clk_regmap sm1_dsu_clk_premux0 = {
707 .data = &(struct clk_regmap_mux_data){
708 .offset = HHI_SYS_CPU_CLK_CNTL5,
712 .hw.init = &(struct clk_init_data){
713 .name = "dsu_clk_dyn0_sel",
714 .ops = &clk_regmap_mux_ro_ops,
715 .parent_data = (const struct clk_parent_data []) {
716 { .fw_name = "xtal", },
717 { .hw = &g12a_fclk_div2.hw },
718 { .hw = &g12a_fclk_div3.hw },
719 { .hw = &sm1_gp1_pll.hw },
725 /* Datasheet names this field as "premux1" */
726 static struct clk_regmap sm1_dsu_clk_premux1 = {
727 .data = &(struct clk_regmap_mux_data){
728 .offset = HHI_SYS_CPU_CLK_CNTL5,
732 .hw.init = &(struct clk_init_data){
733 .name = "dsu_clk_dyn1_sel",
734 .ops = &clk_regmap_mux_ro_ops,
735 .parent_data = (const struct clk_parent_data []) {
736 { .fw_name = "xtal", },
737 { .hw = &g12a_fclk_div2.hw },
738 { .hw = &g12a_fclk_div3.hw },
739 { .hw = &sm1_gp1_pll.hw },
745 /* Datasheet names this field as "Mux0_divn_tcnt" */
746 static struct clk_regmap sm1_dsu_clk_mux0_div = {
747 .data = &(struct clk_regmap_div_data){
748 .offset = HHI_SYS_CPU_CLK_CNTL5,
752 .hw.init = &(struct clk_init_data){
753 .name = "dsu_clk_dyn0_div",
754 .ops = &clk_regmap_divider_ro_ops,
755 .parent_hws = (const struct clk_hw *[]) {
756 &sm1_dsu_clk_premux0.hw
762 /* Datasheet names this field as "postmux0" */
763 static struct clk_regmap sm1_dsu_clk_postmux0 = {
764 .data = &(struct clk_regmap_mux_data){
765 .offset = HHI_SYS_CPU_CLK_CNTL5,
769 .hw.init = &(struct clk_init_data){
770 .name = "dsu_clk_dyn0",
771 .ops = &clk_regmap_mux_ro_ops,
772 .parent_hws = (const struct clk_hw *[]) {
773 &sm1_dsu_clk_premux0.hw,
774 &sm1_dsu_clk_mux0_div.hw,
780 /* Datasheet names this field as "Mux1_divn_tcnt" */
781 static struct clk_regmap sm1_dsu_clk_mux1_div = {
782 .data = &(struct clk_regmap_div_data){
783 .offset = HHI_SYS_CPU_CLK_CNTL5,
787 .hw.init = &(struct clk_init_data){
788 .name = "dsu_clk_dyn1_div",
789 .ops = &clk_regmap_divider_ro_ops,
790 .parent_hws = (const struct clk_hw *[]) {
791 &sm1_dsu_clk_premux1.hw
797 /* Datasheet names this field as "postmux1" */
798 static struct clk_regmap sm1_dsu_clk_postmux1 = {
799 .data = &(struct clk_regmap_mux_data){
800 .offset = HHI_SYS_CPU_CLK_CNTL5,
804 .hw.init = &(struct clk_init_data){
805 .name = "dsu_clk_dyn1",
806 .ops = &clk_regmap_mux_ro_ops,
807 .parent_hws = (const struct clk_hw *[]) {
808 &sm1_dsu_clk_premux1.hw,
809 &sm1_dsu_clk_mux1_div.hw,
815 /* Datasheet names this field as "Final_dyn_mux_sel" */
816 static struct clk_regmap sm1_dsu_clk_dyn = {
817 .data = &(struct clk_regmap_mux_data){
818 .offset = HHI_SYS_CPU_CLK_CNTL5,
822 .hw.init = &(struct clk_init_data){
823 .name = "dsu_clk_dyn",
824 .ops = &clk_regmap_mux_ro_ops,
825 .parent_hws = (const struct clk_hw *[]) {
826 &sm1_dsu_clk_postmux0.hw,
827 &sm1_dsu_clk_postmux1.hw,
833 /* Datasheet names this field as "Final_mux_sel" */
834 static struct clk_regmap sm1_dsu_final_clk = {
835 .data = &(struct clk_regmap_mux_data){
836 .offset = HHI_SYS_CPU_CLK_CNTL5,
840 .hw.init = &(struct clk_init_data){
841 .name = "dsu_clk_final",
842 .ops = &clk_regmap_mux_ro_ops,
843 .parent_hws = (const struct clk_hw *[]) {
851 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 0 */
852 static struct clk_regmap sm1_cpu1_clk = {
853 .data = &(struct clk_regmap_mux_data){
854 .offset = HHI_SYS_CPU_CLK_CNTL6,
858 .hw.init = &(struct clk_init_data){
860 .ops = &clk_regmap_mux_ro_ops,
861 .parent_hws = (const struct clk_hw *[]) {
863 /* This CPU also have a dedicated clock tree */
869 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 1 */
870 static struct clk_regmap sm1_cpu2_clk = {
871 .data = &(struct clk_regmap_mux_data){
872 .offset = HHI_SYS_CPU_CLK_CNTL6,
876 .hw.init = &(struct clk_init_data){
878 .ops = &clk_regmap_mux_ro_ops,
879 .parent_hws = (const struct clk_hw *[]) {
881 /* This CPU also have a dedicated clock tree */
887 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 2 */
888 static struct clk_regmap sm1_cpu3_clk = {
889 .data = &(struct clk_regmap_mux_data){
890 .offset = HHI_SYS_CPU_CLK_CNTL6,
894 .hw.init = &(struct clk_init_data){
896 .ops = &clk_regmap_mux_ro_ops,
897 .parent_hws = (const struct clk_hw *[]) {
899 /* This CPU also have a dedicated clock tree */
905 /* Datasheet names this field as "Cpu_clk_sync_mux_sel" bit 4 */
906 static struct clk_regmap sm1_dsu_clk = {
907 .data = &(struct clk_regmap_mux_data){
908 .offset = HHI_SYS_CPU_CLK_CNTL6,
912 .hw.init = &(struct clk_init_data){
914 .ops = &clk_regmap_mux_ro_ops,
915 .parent_hws = (const struct clk_hw *[]) {
917 &sm1_dsu_final_clk.hw,
923 static int g12a_cpu_clk_mux_notifier_cb(struct notifier_block *nb,
924 unsigned long event, void *data)
926 if (event == POST_RATE_CHANGE || event == PRE_RATE_CHANGE) {
927 /* Wait for clock propagation before/after changing the mux */
935 static struct notifier_block g12a_cpu_clk_mux_nb = {
936 .notifier_call = g12a_cpu_clk_mux_notifier_cb,
939 struct g12a_cpu_clk_postmux_nb_data {
940 struct notifier_block nb;
942 struct clk_hw *cpu_clk_dyn;
943 struct clk_hw *cpu_clk_postmux0;
944 struct clk_hw *cpu_clk_postmux1;
945 struct clk_hw *cpu_clk_premux1;
948 static int g12a_cpu_clk_postmux_notifier_cb(struct notifier_block *nb,
949 unsigned long event, void *data)
951 struct g12a_cpu_clk_postmux_nb_data *nb_data =
952 container_of(nb, struct g12a_cpu_clk_postmux_nb_data, nb);
955 case PRE_RATE_CHANGE:
957 * This notifier means cpu_clk_postmux0 clock will be changed
958 * to feed cpu_clk, this is the current path :
961 * \- cpu_clk_postmux0
962 * \- cpu_clk_muxX_div
964 * \- fclk_div3 or fclk_div2
967 * \- fclk_div3 or fclk_div2
970 /* Setup cpu_clk_premux1 to xtal */
971 clk_hw_set_parent(nb_data->cpu_clk_premux1,
974 /* Setup cpu_clk_postmux1 to bypass divider */
975 clk_hw_set_parent(nb_data->cpu_clk_postmux1,
976 nb_data->cpu_clk_premux1);
978 /* Switch to parking clk on cpu_clk_postmux1 */
979 clk_hw_set_parent(nb_data->cpu_clk_dyn,
980 nb_data->cpu_clk_postmux1);
983 * Now, cpu_clk is 24MHz in the current path :
986 * \- cpu_clk_postmux1
995 case POST_RATE_CHANGE:
997 * The cpu_clk_postmux0 has ben updated, now switch back
998 * cpu_clk_dyn to cpu_clk_postmux0 and take the changes
1002 /* Configure cpu_clk_dyn back to cpu_clk_postmux0 */
1003 clk_hw_set_parent(nb_data->cpu_clk_dyn,
1004 nb_data->cpu_clk_postmux0);
1010 * \- cpu_clk_postmux0
1011 * \- cpu_clk_muxX_div
1012 * \- cpu_clk_premux0
1013 * \- fclk_div3 or fclk_div2
1015 * \- cpu_clk_premux0
1016 * \- fclk_div3 or fclk_div2
1028 static struct g12a_cpu_clk_postmux_nb_data g12a_cpu_clk_postmux0_nb_data = {
1029 .cpu_clk_dyn = &g12a_cpu_clk_dyn.hw,
1030 .cpu_clk_postmux0 = &g12a_cpu_clk_postmux0.hw,
1031 .cpu_clk_postmux1 = &g12a_cpu_clk_postmux1.hw,
1032 .cpu_clk_premux1 = &g12a_cpu_clk_premux1.hw,
1033 .nb.notifier_call = g12a_cpu_clk_postmux_notifier_cb,
1036 static struct g12a_cpu_clk_postmux_nb_data g12b_cpub_clk_postmux0_nb_data = {
1037 .cpu_clk_dyn = &g12b_cpub_clk_dyn.hw,
1038 .cpu_clk_postmux0 = &g12b_cpub_clk_postmux0.hw,
1039 .cpu_clk_postmux1 = &g12b_cpub_clk_postmux1.hw,
1040 .cpu_clk_premux1 = &g12b_cpub_clk_premux1.hw,
1041 .nb.notifier_call = g12a_cpu_clk_postmux_notifier_cb,
1044 struct g12a_sys_pll_nb_data {
1045 struct notifier_block nb;
1046 struct clk_hw *sys_pll;
1047 struct clk_hw *cpu_clk;
1048 struct clk_hw *cpu_clk_dyn;
1051 static int g12a_sys_pll_notifier_cb(struct notifier_block *nb,
1052 unsigned long event, void *data)
1054 struct g12a_sys_pll_nb_data *nb_data =
1055 container_of(nb, struct g12a_sys_pll_nb_data, nb);
1058 case PRE_RATE_CHANGE:
1060 * This notifier means sys_pll clock will be changed
1061 * to feed cpu_clk, this the current path :
1067 /* Configure cpu_clk to use cpu_clk_dyn */
1068 clk_hw_set_parent(nb_data->cpu_clk,
1069 nb_data->cpu_clk_dyn);
1072 * Now, cpu_clk uses the dyn path
1076 * \- cpu_clk_dynX_sel
1077 * \- cpu_clk_dynX_div
1078 * \- xtal/fclk_div2/fclk_div3
1079 * \- xtal/fclk_div2/fclk_div3
1086 case POST_RATE_CHANGE:
1088 * The sys_pll has ben updated, now switch back cpu_clk to
1092 /* Configure cpu_clk to use sys_pll */
1093 clk_hw_set_parent(nb_data->cpu_clk,
1111 static struct g12a_sys_pll_nb_data g12a_sys_pll_nb_data = {
1112 .sys_pll = &g12a_sys_pll.hw,
1113 .cpu_clk = &g12a_cpu_clk.hw,
1114 .cpu_clk_dyn = &g12a_cpu_clk_dyn.hw,
1115 .nb.notifier_call = g12a_sys_pll_notifier_cb,
1118 /* G12B first CPU cluster uses sys1_pll */
1119 static struct g12a_sys_pll_nb_data g12b_cpu_clk_sys1_pll_nb_data = {
1120 .sys_pll = &g12b_sys1_pll.hw,
1121 .cpu_clk = &g12b_cpu_clk.hw,
1122 .cpu_clk_dyn = &g12a_cpu_clk_dyn.hw,
1123 .nb.notifier_call = g12a_sys_pll_notifier_cb,
1126 /* G12B second CPU cluster uses sys_pll */
1127 static struct g12a_sys_pll_nb_data g12b_cpub_clk_sys_pll_nb_data = {
1128 .sys_pll = &g12a_sys_pll.hw,
1129 .cpu_clk = &g12b_cpub_clk.hw,
1130 .cpu_clk_dyn = &g12b_cpub_clk_dyn.hw,
1131 .nb.notifier_call = g12a_sys_pll_notifier_cb,
1134 static struct clk_regmap g12a_cpu_clk_div16_en = {
1135 .data = &(struct clk_regmap_gate_data){
1136 .offset = HHI_SYS_CPU_CLK_CNTL1,
1139 .hw.init = &(struct clk_init_data) {
1140 .name = "cpu_clk_div16_en",
1141 .ops = &clk_regmap_gate_ro_ops,
1142 .parent_hws = (const struct clk_hw *[]) {
1147 * This clock is used to debug the cpu_clk range
1148 * Linux should not change it at runtime
1153 static struct clk_regmap g12b_cpub_clk_div16_en = {
1154 .data = &(struct clk_regmap_gate_data){
1155 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1158 .hw.init = &(struct clk_init_data) {
1159 .name = "cpub_clk_div16_en",
1160 .ops = &clk_regmap_gate_ro_ops,
1161 .parent_hws = (const struct clk_hw *[]) {
1166 * This clock is used to debug the cpu_clk range
1167 * Linux should not change it at runtime
1172 static struct clk_fixed_factor g12a_cpu_clk_div16 = {
1175 .hw.init = &(struct clk_init_data){
1176 .name = "cpu_clk_div16",
1177 .ops = &clk_fixed_factor_ops,
1178 .parent_hws = (const struct clk_hw *[]) {
1179 &g12a_cpu_clk_div16_en.hw
1185 static struct clk_fixed_factor g12b_cpub_clk_div16 = {
1188 .hw.init = &(struct clk_init_data){
1189 .name = "cpub_clk_div16",
1190 .ops = &clk_fixed_factor_ops,
1191 .parent_hws = (const struct clk_hw *[]) {
1192 &g12b_cpub_clk_div16_en.hw
1198 static struct clk_regmap g12a_cpu_clk_apb_div = {
1199 .data = &(struct clk_regmap_div_data){
1200 .offset = HHI_SYS_CPU_CLK_CNTL1,
1203 .flags = CLK_DIVIDER_POWER_OF_TWO,
1205 .hw.init = &(struct clk_init_data){
1206 .name = "cpu_clk_apb_div",
1207 .ops = &clk_regmap_divider_ro_ops,
1208 .parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw },
1213 static struct clk_regmap g12a_cpu_clk_apb = {
1214 .data = &(struct clk_regmap_gate_data){
1215 .offset = HHI_SYS_CPU_CLK_CNTL1,
1218 .hw.init = &(struct clk_init_data) {
1219 .name = "cpu_clk_apb",
1220 .ops = &clk_regmap_gate_ro_ops,
1221 .parent_hws = (const struct clk_hw *[]) {
1222 &g12a_cpu_clk_apb_div.hw
1226 * This clock is set by the ROM monitor code,
1227 * Linux should not change it at runtime
1232 static struct clk_regmap g12a_cpu_clk_atb_div = {
1233 .data = &(struct clk_regmap_div_data){
1234 .offset = HHI_SYS_CPU_CLK_CNTL1,
1237 .flags = CLK_DIVIDER_POWER_OF_TWO,
1239 .hw.init = &(struct clk_init_data){
1240 .name = "cpu_clk_atb_div",
1241 .ops = &clk_regmap_divider_ro_ops,
1242 .parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw },
1247 static struct clk_regmap g12a_cpu_clk_atb = {
1248 .data = &(struct clk_regmap_gate_data){
1249 .offset = HHI_SYS_CPU_CLK_CNTL1,
1252 .hw.init = &(struct clk_init_data) {
1253 .name = "cpu_clk_atb",
1254 .ops = &clk_regmap_gate_ro_ops,
1255 .parent_hws = (const struct clk_hw *[]) {
1256 &g12a_cpu_clk_atb_div.hw
1260 * This clock is set by the ROM monitor code,
1261 * Linux should not change it at runtime
1266 static struct clk_regmap g12a_cpu_clk_axi_div = {
1267 .data = &(struct clk_regmap_div_data){
1268 .offset = HHI_SYS_CPU_CLK_CNTL1,
1271 .flags = CLK_DIVIDER_POWER_OF_TWO,
1273 .hw.init = &(struct clk_init_data){
1274 .name = "cpu_clk_axi_div",
1275 .ops = &clk_regmap_divider_ro_ops,
1276 .parent_hws = (const struct clk_hw *[]) { &g12a_cpu_clk.hw },
1281 static struct clk_regmap g12a_cpu_clk_axi = {
1282 .data = &(struct clk_regmap_gate_data){
1283 .offset = HHI_SYS_CPU_CLK_CNTL1,
1286 .hw.init = &(struct clk_init_data) {
1287 .name = "cpu_clk_axi",
1288 .ops = &clk_regmap_gate_ro_ops,
1289 .parent_hws = (const struct clk_hw *[]) {
1290 &g12a_cpu_clk_axi_div.hw
1294 * This clock is set by the ROM monitor code,
1295 * Linux should not change it at runtime
1300 static struct clk_regmap g12a_cpu_clk_trace_div = {
1301 .data = &(struct clk_regmap_div_data){
1302 .offset = HHI_SYS_CPU_CLK_CNTL1,
1305 .flags = CLK_DIVIDER_POWER_OF_TWO,
1307 .hw.init = &(struct clk_init_data){
1308 .name = "cpu_clk_trace_div",
1309 .ops = &clk_regmap_divider_ro_ops,
1310 .parent_data = &(const struct clk_parent_data) {
1313 * G12A and G12B have different cpu_clks (with
1314 * different struct clk_hw). We fallback to the global
1315 * naming string mechanism so cpu_clk_trace_div picks
1316 * up the appropriate one.
1325 static struct clk_regmap g12a_cpu_clk_trace = {
1326 .data = &(struct clk_regmap_gate_data){
1327 .offset = HHI_SYS_CPU_CLK_CNTL1,
1330 .hw.init = &(struct clk_init_data) {
1331 .name = "cpu_clk_trace",
1332 .ops = &clk_regmap_gate_ro_ops,
1333 .parent_hws = (const struct clk_hw *[]) {
1334 &g12a_cpu_clk_trace_div.hw
1338 * This clock is set by the ROM monitor code,
1339 * Linux should not change it at runtime
1344 static struct clk_fixed_factor g12b_cpub_clk_div2 = {
1347 .hw.init = &(struct clk_init_data){
1348 .name = "cpub_clk_div2",
1349 .ops = &clk_fixed_factor_ops,
1350 .parent_hws = (const struct clk_hw *[]) {
1357 static struct clk_fixed_factor g12b_cpub_clk_div3 = {
1360 .hw.init = &(struct clk_init_data){
1361 .name = "cpub_clk_div3",
1362 .ops = &clk_fixed_factor_ops,
1363 .parent_hws = (const struct clk_hw *[]) {
1370 static struct clk_fixed_factor g12b_cpub_clk_div4 = {
1373 .hw.init = &(struct clk_init_data){
1374 .name = "cpub_clk_div4",
1375 .ops = &clk_fixed_factor_ops,
1376 .parent_hws = (const struct clk_hw *[]) {
1383 static struct clk_fixed_factor g12b_cpub_clk_div5 = {
1386 .hw.init = &(struct clk_init_data){
1387 .name = "cpub_clk_div5",
1388 .ops = &clk_fixed_factor_ops,
1389 .parent_hws = (const struct clk_hw *[]) {
1396 static struct clk_fixed_factor g12b_cpub_clk_div6 = {
1399 .hw.init = &(struct clk_init_data){
1400 .name = "cpub_clk_div6",
1401 .ops = &clk_fixed_factor_ops,
1402 .parent_hws = (const struct clk_hw *[]) {
1409 static struct clk_fixed_factor g12b_cpub_clk_div7 = {
1412 .hw.init = &(struct clk_init_data){
1413 .name = "cpub_clk_div7",
1414 .ops = &clk_fixed_factor_ops,
1415 .parent_hws = (const struct clk_hw *[]) {
1422 static struct clk_fixed_factor g12b_cpub_clk_div8 = {
1425 .hw.init = &(struct clk_init_data){
1426 .name = "cpub_clk_div8",
1427 .ops = &clk_fixed_factor_ops,
1428 .parent_hws = (const struct clk_hw *[]) {
1435 static u32 mux_table_cpub[] = { 1, 2, 3, 4, 5, 6, 7 };
1436 static struct clk_regmap g12b_cpub_clk_apb_sel = {
1437 .data = &(struct clk_regmap_mux_data){
1438 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1441 .table = mux_table_cpub,
1443 .hw.init = &(struct clk_init_data){
1444 .name = "cpub_clk_apb_sel",
1445 .ops = &clk_regmap_mux_ro_ops,
1446 .parent_hws = (const struct clk_hw *[]) {
1447 &g12b_cpub_clk_div2.hw,
1448 &g12b_cpub_clk_div3.hw,
1449 &g12b_cpub_clk_div4.hw,
1450 &g12b_cpub_clk_div5.hw,
1451 &g12b_cpub_clk_div6.hw,
1452 &g12b_cpub_clk_div7.hw,
1453 &g12b_cpub_clk_div8.hw
1459 static struct clk_regmap g12b_cpub_clk_apb = {
1460 .data = &(struct clk_regmap_gate_data){
1461 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1463 .flags = CLK_GATE_SET_TO_DISABLE,
1465 .hw.init = &(struct clk_init_data) {
1466 .name = "cpub_clk_apb",
1467 .ops = &clk_regmap_gate_ro_ops,
1468 .parent_hws = (const struct clk_hw *[]) {
1469 &g12b_cpub_clk_apb_sel.hw
1473 * This clock is set by the ROM monitor code,
1474 * Linux should not change it at runtime
1479 static struct clk_regmap g12b_cpub_clk_atb_sel = {
1480 .data = &(struct clk_regmap_mux_data){
1481 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1484 .table = mux_table_cpub,
1486 .hw.init = &(struct clk_init_data){
1487 .name = "cpub_clk_atb_sel",
1488 .ops = &clk_regmap_mux_ro_ops,
1489 .parent_hws = (const struct clk_hw *[]) {
1490 &g12b_cpub_clk_div2.hw,
1491 &g12b_cpub_clk_div3.hw,
1492 &g12b_cpub_clk_div4.hw,
1493 &g12b_cpub_clk_div5.hw,
1494 &g12b_cpub_clk_div6.hw,
1495 &g12b_cpub_clk_div7.hw,
1496 &g12b_cpub_clk_div8.hw
1502 static struct clk_regmap g12b_cpub_clk_atb = {
1503 .data = &(struct clk_regmap_gate_data){
1504 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1506 .flags = CLK_GATE_SET_TO_DISABLE,
1508 .hw.init = &(struct clk_init_data) {
1509 .name = "cpub_clk_atb",
1510 .ops = &clk_regmap_gate_ro_ops,
1511 .parent_hws = (const struct clk_hw *[]) {
1512 &g12b_cpub_clk_atb_sel.hw
1516 * This clock is set by the ROM monitor code,
1517 * Linux should not change it at runtime
1522 static struct clk_regmap g12b_cpub_clk_axi_sel = {
1523 .data = &(struct clk_regmap_mux_data){
1524 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1527 .table = mux_table_cpub,
1529 .hw.init = &(struct clk_init_data){
1530 .name = "cpub_clk_axi_sel",
1531 .ops = &clk_regmap_mux_ro_ops,
1532 .parent_hws = (const struct clk_hw *[]) {
1533 &g12b_cpub_clk_div2.hw,
1534 &g12b_cpub_clk_div3.hw,
1535 &g12b_cpub_clk_div4.hw,
1536 &g12b_cpub_clk_div5.hw,
1537 &g12b_cpub_clk_div6.hw,
1538 &g12b_cpub_clk_div7.hw,
1539 &g12b_cpub_clk_div8.hw
1545 static struct clk_regmap g12b_cpub_clk_axi = {
1546 .data = &(struct clk_regmap_gate_data){
1547 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1549 .flags = CLK_GATE_SET_TO_DISABLE,
1551 .hw.init = &(struct clk_init_data) {
1552 .name = "cpub_clk_axi",
1553 .ops = &clk_regmap_gate_ro_ops,
1554 .parent_hws = (const struct clk_hw *[]) {
1555 &g12b_cpub_clk_axi_sel.hw
1559 * This clock is set by the ROM monitor code,
1560 * Linux should not change it at runtime
1565 static struct clk_regmap g12b_cpub_clk_trace_sel = {
1566 .data = &(struct clk_regmap_mux_data){
1567 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1570 .table = mux_table_cpub,
1572 .hw.init = &(struct clk_init_data){
1573 .name = "cpub_clk_trace_sel",
1574 .ops = &clk_regmap_mux_ro_ops,
1575 .parent_hws = (const struct clk_hw *[]) {
1576 &g12b_cpub_clk_div2.hw,
1577 &g12b_cpub_clk_div3.hw,
1578 &g12b_cpub_clk_div4.hw,
1579 &g12b_cpub_clk_div5.hw,
1580 &g12b_cpub_clk_div6.hw,
1581 &g12b_cpub_clk_div7.hw,
1582 &g12b_cpub_clk_div8.hw
1588 static struct clk_regmap g12b_cpub_clk_trace = {
1589 .data = &(struct clk_regmap_gate_data){
1590 .offset = HHI_SYS_CPUB_CLK_CNTL1,
1592 .flags = CLK_GATE_SET_TO_DISABLE,
1594 .hw.init = &(struct clk_init_data) {
1595 .name = "cpub_clk_trace",
1596 .ops = &clk_regmap_gate_ro_ops,
1597 .parent_hws = (const struct clk_hw *[]) {
1598 &g12b_cpub_clk_trace_sel.hw
1602 * This clock is set by the ROM monitor code,
1603 * Linux should not change it at runtime
1608 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
1614 * Internal gp0 pll emulation configuration parameters
1616 static const struct reg_sequence g12a_gp0_init_regs[] = {
1617 { .reg = HHI_GP0_PLL_CNTL1, .def = 0x00000000 },
1618 { .reg = HHI_GP0_PLL_CNTL2, .def = 0x00000000 },
1619 { .reg = HHI_GP0_PLL_CNTL3, .def = 0x48681c00 },
1620 { .reg = HHI_GP0_PLL_CNTL4, .def = 0x33771290 },
1621 { .reg = HHI_GP0_PLL_CNTL5, .def = 0x39272000 },
1622 { .reg = HHI_GP0_PLL_CNTL6, .def = 0x56540000 },
1625 static struct clk_regmap g12a_gp0_pll_dco = {
1626 .data = &(struct meson_clk_pll_data){
1628 .reg_off = HHI_GP0_PLL_CNTL0,
1633 .reg_off = HHI_GP0_PLL_CNTL0,
1638 .reg_off = HHI_GP0_PLL_CNTL0,
1643 .reg_off = HHI_GP0_PLL_CNTL1,
1648 .reg_off = HHI_GP0_PLL_CNTL0,
1653 .reg_off = HHI_GP0_PLL_CNTL0,
1657 .range = &g12a_gp0_pll_mult_range,
1658 .init_regs = g12a_gp0_init_regs,
1659 .init_count = ARRAY_SIZE(g12a_gp0_init_regs),
1661 .hw.init = &(struct clk_init_data){
1662 .name = "gp0_pll_dco",
1663 .ops = &meson_clk_pll_ops,
1664 .parent_data = &(const struct clk_parent_data) {
1671 static struct clk_regmap g12a_gp0_pll = {
1672 .data = &(struct clk_regmap_div_data){
1673 .offset = HHI_GP0_PLL_CNTL0,
1676 .flags = (CLK_DIVIDER_POWER_OF_TWO |
1677 CLK_DIVIDER_ROUND_CLOSEST),
1679 .hw.init = &(struct clk_init_data){
1681 .ops = &clk_regmap_divider_ops,
1682 .parent_hws = (const struct clk_hw *[]) {
1683 &g12a_gp0_pll_dco.hw
1686 .flags = CLK_SET_RATE_PARENT,
1690 static struct clk_regmap sm1_gp1_pll_dco = {
1691 .data = &(struct meson_clk_pll_data){
1693 .reg_off = HHI_GP1_PLL_CNTL0,
1698 .reg_off = HHI_GP1_PLL_CNTL0,
1703 .reg_off = HHI_GP1_PLL_CNTL0,
1708 .reg_off = HHI_GP1_PLL_CNTL1,
1713 .reg_off = HHI_GP1_PLL_CNTL0,
1718 .reg_off = HHI_GP1_PLL_CNTL0,
1723 .hw.init = &(struct clk_init_data){
1724 .name = "gp1_pll_dco",
1725 .ops = &meson_clk_pll_ro_ops,
1726 .parent_data = &(const struct clk_parent_data) {
1730 /* This clock feeds the DSU, avoid disabling it */
1731 .flags = CLK_IS_CRITICAL,
1735 static struct clk_regmap sm1_gp1_pll = {
1736 .data = &(struct clk_regmap_div_data){
1737 .offset = HHI_GP1_PLL_CNTL0,
1740 .flags = (CLK_DIVIDER_POWER_OF_TWO |
1741 CLK_DIVIDER_ROUND_CLOSEST),
1743 .hw.init = &(struct clk_init_data){
1745 .ops = &clk_regmap_divider_ro_ops,
1746 .parent_hws = (const struct clk_hw *[]) {
1754 * Internal hifi pll emulation configuration parameters
1756 static const struct reg_sequence g12a_hifi_init_regs[] = {
1757 { .reg = HHI_HIFI_PLL_CNTL1, .def = 0x00000000 },
1758 { .reg = HHI_HIFI_PLL_CNTL2, .def = 0x00000000 },
1759 { .reg = HHI_HIFI_PLL_CNTL3, .def = 0x6a285c00 },
1760 { .reg = HHI_HIFI_PLL_CNTL4, .def = 0x65771290 },
1761 { .reg = HHI_HIFI_PLL_CNTL5, .def = 0x39272000 },
1762 { .reg = HHI_HIFI_PLL_CNTL6, .def = 0x56540000 },
1765 static struct clk_regmap g12a_hifi_pll_dco = {
1766 .data = &(struct meson_clk_pll_data){
1768 .reg_off = HHI_HIFI_PLL_CNTL0,
1773 .reg_off = HHI_HIFI_PLL_CNTL0,
1778 .reg_off = HHI_HIFI_PLL_CNTL0,
1783 .reg_off = HHI_HIFI_PLL_CNTL1,
1788 .reg_off = HHI_HIFI_PLL_CNTL0,
1793 .reg_off = HHI_HIFI_PLL_CNTL0,
1797 .range = &g12a_gp0_pll_mult_range,
1798 .init_regs = g12a_hifi_init_regs,
1799 .init_count = ARRAY_SIZE(g12a_hifi_init_regs),
1800 .flags = CLK_MESON_PLL_ROUND_CLOSEST,
1802 .hw.init = &(struct clk_init_data){
1803 .name = "hifi_pll_dco",
1804 .ops = &meson_clk_pll_ops,
1805 .parent_data = &(const struct clk_parent_data) {
1812 static struct clk_regmap g12a_hifi_pll = {
1813 .data = &(struct clk_regmap_div_data){
1814 .offset = HHI_HIFI_PLL_CNTL0,
1817 .flags = (CLK_DIVIDER_POWER_OF_TWO |
1818 CLK_DIVIDER_ROUND_CLOSEST),
1820 .hw.init = &(struct clk_init_data){
1822 .ops = &clk_regmap_divider_ops,
1823 .parent_hws = (const struct clk_hw *[]) {
1824 &g12a_hifi_pll_dco.hw
1827 .flags = CLK_SET_RATE_PARENT,
1832 * The Meson G12A PCIE PLL is fined tuned to deliver a very precise
1833 * 100MHz reference clock for the PCIe Analog PHY, and thus requires
1834 * a strict register sequence to enable the PLL.
1836 static const struct reg_sequence g12a_pcie_pll_init_regs[] = {
1837 { .reg = HHI_PCIE_PLL_CNTL0, .def = 0x20090496 },
1838 { .reg = HHI_PCIE_PLL_CNTL0, .def = 0x30090496 },
1839 { .reg = HHI_PCIE_PLL_CNTL1, .def = 0x00000000 },
1840 { .reg = HHI_PCIE_PLL_CNTL2, .def = 0x00001100 },
1841 { .reg = HHI_PCIE_PLL_CNTL3, .def = 0x10058e00 },
1842 { .reg = HHI_PCIE_PLL_CNTL4, .def = 0x000100c0 },
1843 { .reg = HHI_PCIE_PLL_CNTL5, .def = 0x68000048 },
1844 { .reg = HHI_PCIE_PLL_CNTL5, .def = 0x68000068, .delay_us = 20 },
1845 { .reg = HHI_PCIE_PLL_CNTL4, .def = 0x008100c0, .delay_us = 10 },
1846 { .reg = HHI_PCIE_PLL_CNTL0, .def = 0x34090496 },
1847 { .reg = HHI_PCIE_PLL_CNTL0, .def = 0x14090496, .delay_us = 10 },
1848 { .reg = HHI_PCIE_PLL_CNTL2, .def = 0x00001000 },
1851 /* Keep a single entry table for recalc/round_rate() ops */
1852 static const struct pll_params_table g12a_pcie_pll_table[] = {
1857 static struct clk_regmap g12a_pcie_pll_dco = {
1858 .data = &(struct meson_clk_pll_data){
1860 .reg_off = HHI_PCIE_PLL_CNTL0,
1865 .reg_off = HHI_PCIE_PLL_CNTL0,
1870 .reg_off = HHI_PCIE_PLL_CNTL0,
1875 .reg_off = HHI_PCIE_PLL_CNTL1,
1880 .reg_off = HHI_PCIE_PLL_CNTL0,
1885 .reg_off = HHI_PCIE_PLL_CNTL0,
1889 .table = g12a_pcie_pll_table,
1890 .init_regs = g12a_pcie_pll_init_regs,
1891 .init_count = ARRAY_SIZE(g12a_pcie_pll_init_regs),
1893 .hw.init = &(struct clk_init_data){
1894 .name = "pcie_pll_dco",
1895 .ops = &meson_clk_pcie_pll_ops,
1896 .parent_data = &(const struct clk_parent_data) {
1903 static struct clk_fixed_factor g12a_pcie_pll_dco_div2 = {
1906 .hw.init = &(struct clk_init_data){
1907 .name = "pcie_pll_dco_div2",
1908 .ops = &clk_fixed_factor_ops,
1909 .parent_hws = (const struct clk_hw *[]) {
1910 &g12a_pcie_pll_dco.hw
1913 .flags = CLK_SET_RATE_PARENT,
1917 static struct clk_regmap g12a_pcie_pll_od = {
1918 .data = &(struct clk_regmap_div_data){
1919 .offset = HHI_PCIE_PLL_CNTL0,
1922 .flags = CLK_DIVIDER_ROUND_CLOSEST |
1923 CLK_DIVIDER_ONE_BASED |
1924 CLK_DIVIDER_ALLOW_ZERO,
1926 .hw.init = &(struct clk_init_data){
1927 .name = "pcie_pll_od",
1928 .ops = &clk_regmap_divider_ops,
1929 .parent_hws = (const struct clk_hw *[]) {
1930 &g12a_pcie_pll_dco_div2.hw
1933 .flags = CLK_SET_RATE_PARENT,
1937 static struct clk_fixed_factor g12a_pcie_pll = {
1940 .hw.init = &(struct clk_init_data){
1941 .name = "pcie_pll_pll",
1942 .ops = &clk_fixed_factor_ops,
1943 .parent_hws = (const struct clk_hw *[]) {
1944 &g12a_pcie_pll_od.hw
1947 .flags = CLK_SET_RATE_PARENT,
1951 static struct clk_regmap g12a_hdmi_pll_dco = {
1952 .data = &(struct meson_clk_pll_data){
1954 .reg_off = HHI_HDMI_PLL_CNTL0,
1959 .reg_off = HHI_HDMI_PLL_CNTL0,
1964 .reg_off = HHI_HDMI_PLL_CNTL0,
1969 .reg_off = HHI_HDMI_PLL_CNTL1,
1974 .reg_off = HHI_HDMI_PLL_CNTL0,
1979 .reg_off = HHI_HDMI_PLL_CNTL0,
1984 .hw.init = &(struct clk_init_data){
1985 .name = "hdmi_pll_dco",
1986 .ops = &meson_clk_pll_ro_ops,
1987 .parent_data = &(const struct clk_parent_data) {
1992 * Display directly handle hdmi pll registers ATM, we need
1993 * NOCACHE to keep our view of the clock as accurate as possible
1995 .flags = CLK_GET_RATE_NOCACHE,
1999 static struct clk_regmap g12a_hdmi_pll_od = {
2000 .data = &(struct clk_regmap_div_data){
2001 .offset = HHI_HDMI_PLL_CNTL0,
2004 .flags = CLK_DIVIDER_POWER_OF_TWO,
2006 .hw.init = &(struct clk_init_data){
2007 .name = "hdmi_pll_od",
2008 .ops = &clk_regmap_divider_ro_ops,
2009 .parent_hws = (const struct clk_hw *[]) {
2010 &g12a_hdmi_pll_dco.hw
2013 .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
2017 static struct clk_regmap g12a_hdmi_pll_od2 = {
2018 .data = &(struct clk_regmap_div_data){
2019 .offset = HHI_HDMI_PLL_CNTL0,
2022 .flags = CLK_DIVIDER_POWER_OF_TWO,
2024 .hw.init = &(struct clk_init_data){
2025 .name = "hdmi_pll_od2",
2026 .ops = &clk_regmap_divider_ro_ops,
2027 .parent_hws = (const struct clk_hw *[]) {
2028 &g12a_hdmi_pll_od.hw
2031 .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
2035 static struct clk_regmap g12a_hdmi_pll = {
2036 .data = &(struct clk_regmap_div_data){
2037 .offset = HHI_HDMI_PLL_CNTL0,
2040 .flags = CLK_DIVIDER_POWER_OF_TWO,
2042 .hw.init = &(struct clk_init_data){
2044 .ops = &clk_regmap_divider_ro_ops,
2045 .parent_hws = (const struct clk_hw *[]) {
2046 &g12a_hdmi_pll_od2.hw
2049 .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT,
2053 static struct clk_fixed_factor g12a_fclk_div4_div = {
2056 .hw.init = &(struct clk_init_data){
2057 .name = "fclk_div4_div",
2058 .ops = &clk_fixed_factor_ops,
2059 .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
2064 static struct clk_regmap g12a_fclk_div4 = {
2065 .data = &(struct clk_regmap_gate_data){
2066 .offset = HHI_FIX_PLL_CNTL1,
2069 .hw.init = &(struct clk_init_data){
2070 .name = "fclk_div4",
2071 .ops = &clk_regmap_gate_ops,
2072 .parent_hws = (const struct clk_hw *[]) {
2073 &g12a_fclk_div4_div.hw
2079 static struct clk_fixed_factor g12a_fclk_div5_div = {
2082 .hw.init = &(struct clk_init_data){
2083 .name = "fclk_div5_div",
2084 .ops = &clk_fixed_factor_ops,
2085 .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
2090 static struct clk_regmap g12a_fclk_div5 = {
2091 .data = &(struct clk_regmap_gate_data){
2092 .offset = HHI_FIX_PLL_CNTL1,
2095 .hw.init = &(struct clk_init_data){
2096 .name = "fclk_div5",
2097 .ops = &clk_regmap_gate_ops,
2098 .parent_hws = (const struct clk_hw *[]) {
2099 &g12a_fclk_div5_div.hw
2105 static struct clk_fixed_factor g12a_fclk_div7_div = {
2108 .hw.init = &(struct clk_init_data){
2109 .name = "fclk_div7_div",
2110 .ops = &clk_fixed_factor_ops,
2111 .parent_hws = (const struct clk_hw *[]) { &g12a_fixed_pll.hw },
2116 static struct clk_regmap g12a_fclk_div7 = {
2117 .data = &(struct clk_regmap_gate_data){
2118 .offset = HHI_FIX_PLL_CNTL1,
2121 .hw.init = &(struct clk_init_data){
2122 .name = "fclk_div7",
2123 .ops = &clk_regmap_gate_ops,
2124 .parent_hws = (const struct clk_hw *[]) {
2125 &g12a_fclk_div7_div.hw
2131 static struct clk_fixed_factor g12a_fclk_div2p5_div = {
2134 .hw.init = &(struct clk_init_data){
2135 .name = "fclk_div2p5_div",
2136 .ops = &clk_fixed_factor_ops,
2137 .parent_hws = (const struct clk_hw *[]) {
2138 &g12a_fixed_pll_dco.hw
2144 static struct clk_regmap g12a_fclk_div2p5 = {
2145 .data = &(struct clk_regmap_gate_data){
2146 .offset = HHI_FIX_PLL_CNTL1,
2149 .hw.init = &(struct clk_init_data){
2150 .name = "fclk_div2p5",
2151 .ops = &clk_regmap_gate_ops,
2152 .parent_hws = (const struct clk_hw *[]) {
2153 &g12a_fclk_div2p5_div.hw
2159 static struct clk_fixed_factor g12a_mpll_50m_div = {
2162 .hw.init = &(struct clk_init_data){
2163 .name = "mpll_50m_div",
2164 .ops = &clk_fixed_factor_ops,
2165 .parent_hws = (const struct clk_hw *[]) {
2166 &g12a_fixed_pll_dco.hw
2172 static struct clk_regmap g12a_mpll_50m = {
2173 .data = &(struct clk_regmap_mux_data){
2174 .offset = HHI_FIX_PLL_CNTL3,
2178 .hw.init = &(struct clk_init_data){
2180 .ops = &clk_regmap_mux_ro_ops,
2181 .parent_data = (const struct clk_parent_data []) {
2182 { .fw_name = "xtal", },
2183 { .hw = &g12a_mpll_50m_div.hw },
2189 static struct clk_fixed_factor g12a_mpll_prediv = {
2192 .hw.init = &(struct clk_init_data){
2193 .name = "mpll_prediv",
2194 .ops = &clk_fixed_factor_ops,
2195 .parent_hws = (const struct clk_hw *[]) {
2196 &g12a_fixed_pll_dco.hw
2202 static const struct reg_sequence g12a_mpll0_init_regs[] = {
2203 { .reg = HHI_MPLL_CNTL2, .def = 0x40000033 },
2206 static struct clk_regmap g12a_mpll0_div = {
2207 .data = &(struct meson_clk_mpll_data){
2209 .reg_off = HHI_MPLL_CNTL1,
2214 .reg_off = HHI_MPLL_CNTL1,
2219 .reg_off = HHI_MPLL_CNTL1,
2224 .reg_off = HHI_MPLL_CNTL1,
2228 .lock = &meson_clk_lock,
2229 .init_regs = g12a_mpll0_init_regs,
2230 .init_count = ARRAY_SIZE(g12a_mpll0_init_regs),
2232 .hw.init = &(struct clk_init_data){
2233 .name = "mpll0_div",
2234 .ops = &meson_clk_mpll_ops,
2235 .parent_hws = (const struct clk_hw *[]) {
2236 &g12a_mpll_prediv.hw
2242 static struct clk_regmap g12a_mpll0 = {
2243 .data = &(struct clk_regmap_gate_data){
2244 .offset = HHI_MPLL_CNTL1,
2247 .hw.init = &(struct clk_init_data){
2249 .ops = &clk_regmap_gate_ops,
2250 .parent_hws = (const struct clk_hw *[]) { &g12a_mpll0_div.hw },
2252 .flags = CLK_SET_RATE_PARENT,
2256 static const struct reg_sequence g12a_mpll1_init_regs[] = {
2257 { .reg = HHI_MPLL_CNTL4, .def = 0x40000033 },
2260 static struct clk_regmap g12a_mpll1_div = {
2261 .data = &(struct meson_clk_mpll_data){
2263 .reg_off = HHI_MPLL_CNTL3,
2268 .reg_off = HHI_MPLL_CNTL3,
2273 .reg_off = HHI_MPLL_CNTL3,
2278 .reg_off = HHI_MPLL_CNTL3,
2282 .lock = &meson_clk_lock,
2283 .init_regs = g12a_mpll1_init_regs,
2284 .init_count = ARRAY_SIZE(g12a_mpll1_init_regs),
2286 .hw.init = &(struct clk_init_data){
2287 .name = "mpll1_div",
2288 .ops = &meson_clk_mpll_ops,
2289 .parent_hws = (const struct clk_hw *[]) {
2290 &g12a_mpll_prediv.hw
2296 static struct clk_regmap g12a_mpll1 = {
2297 .data = &(struct clk_regmap_gate_data){
2298 .offset = HHI_MPLL_CNTL3,
2301 .hw.init = &(struct clk_init_data){
2303 .ops = &clk_regmap_gate_ops,
2304 .parent_hws = (const struct clk_hw *[]) { &g12a_mpll1_div.hw },
2306 .flags = CLK_SET_RATE_PARENT,
2310 static const struct reg_sequence g12a_mpll2_init_regs[] = {
2311 { .reg = HHI_MPLL_CNTL6, .def = 0x40000033 },
2314 static struct clk_regmap g12a_mpll2_div = {
2315 .data = &(struct meson_clk_mpll_data){
2317 .reg_off = HHI_MPLL_CNTL5,
2322 .reg_off = HHI_MPLL_CNTL5,
2327 .reg_off = HHI_MPLL_CNTL5,
2332 .reg_off = HHI_MPLL_CNTL5,
2336 .lock = &meson_clk_lock,
2337 .init_regs = g12a_mpll2_init_regs,
2338 .init_count = ARRAY_SIZE(g12a_mpll2_init_regs),
2340 .hw.init = &(struct clk_init_data){
2341 .name = "mpll2_div",
2342 .ops = &meson_clk_mpll_ops,
2343 .parent_hws = (const struct clk_hw *[]) {
2344 &g12a_mpll_prediv.hw
2350 static struct clk_regmap g12a_mpll2 = {
2351 .data = &(struct clk_regmap_gate_data){
2352 .offset = HHI_MPLL_CNTL5,
2355 .hw.init = &(struct clk_init_data){
2357 .ops = &clk_regmap_gate_ops,
2358 .parent_hws = (const struct clk_hw *[]) { &g12a_mpll2_div.hw },
2360 .flags = CLK_SET_RATE_PARENT,
2364 static const struct reg_sequence g12a_mpll3_init_regs[] = {
2365 { .reg = HHI_MPLL_CNTL8, .def = 0x40000033 },
2368 static struct clk_regmap g12a_mpll3_div = {
2369 .data = &(struct meson_clk_mpll_data){
2371 .reg_off = HHI_MPLL_CNTL7,
2376 .reg_off = HHI_MPLL_CNTL7,
2381 .reg_off = HHI_MPLL_CNTL7,
2386 .reg_off = HHI_MPLL_CNTL7,
2390 .lock = &meson_clk_lock,
2391 .init_regs = g12a_mpll3_init_regs,
2392 .init_count = ARRAY_SIZE(g12a_mpll3_init_regs),
2394 .hw.init = &(struct clk_init_data){
2395 .name = "mpll3_div",
2396 .ops = &meson_clk_mpll_ops,
2397 .parent_hws = (const struct clk_hw *[]) {
2398 &g12a_mpll_prediv.hw
2404 static struct clk_regmap g12a_mpll3 = {
2405 .data = &(struct clk_regmap_gate_data){
2406 .offset = HHI_MPLL_CNTL7,
2409 .hw.init = &(struct clk_init_data){
2411 .ops = &clk_regmap_gate_ops,
2412 .parent_hws = (const struct clk_hw *[]) { &g12a_mpll3_div.hw },
2414 .flags = CLK_SET_RATE_PARENT,
2418 static u32 mux_table_clk81[] = { 0, 2, 3, 4, 5, 6, 7 };
2419 static const struct clk_parent_data clk81_parent_data[] = {
2420 { .fw_name = "xtal", },
2421 { .hw = &g12a_fclk_div7.hw },
2422 { .hw = &g12a_mpll1.hw },
2423 { .hw = &g12a_mpll2.hw },
2424 { .hw = &g12a_fclk_div4.hw },
2425 { .hw = &g12a_fclk_div3.hw },
2426 { .hw = &g12a_fclk_div5.hw },
2429 static struct clk_regmap g12a_mpeg_clk_sel = {
2430 .data = &(struct clk_regmap_mux_data){
2431 .offset = HHI_MPEG_CLK_CNTL,
2434 .table = mux_table_clk81,
2436 .hw.init = &(struct clk_init_data){
2437 .name = "mpeg_clk_sel",
2438 .ops = &clk_regmap_mux_ro_ops,
2439 .parent_data = clk81_parent_data,
2440 .num_parents = ARRAY_SIZE(clk81_parent_data),
2444 static struct clk_regmap g12a_mpeg_clk_div = {
2445 .data = &(struct clk_regmap_div_data){
2446 .offset = HHI_MPEG_CLK_CNTL,
2450 .hw.init = &(struct clk_init_data){
2451 .name = "mpeg_clk_div",
2452 .ops = &clk_regmap_divider_ops,
2453 .parent_hws = (const struct clk_hw *[]) {
2454 &g12a_mpeg_clk_sel.hw
2457 .flags = CLK_SET_RATE_PARENT,
2461 static struct clk_regmap g12a_clk81 = {
2462 .data = &(struct clk_regmap_gate_data){
2463 .offset = HHI_MPEG_CLK_CNTL,
2466 .hw.init = &(struct clk_init_data){
2468 .ops = &clk_regmap_gate_ops,
2469 .parent_hws = (const struct clk_hw *[]) {
2470 &g12a_mpeg_clk_div.hw
2473 .flags = (CLK_SET_RATE_PARENT | CLK_IS_CRITICAL),
2477 static const struct clk_parent_data g12a_sd_emmc_clk0_parent_data[] = {
2478 { .fw_name = "xtal", },
2479 { .hw = &g12a_fclk_div2.hw },
2480 { .hw = &g12a_fclk_div3.hw },
2481 { .hw = &g12a_fclk_div5.hw },
2482 { .hw = &g12a_fclk_div7.hw },
2484 * Following these parent clocks, we should also have had mpll2, mpll3
2485 * and gp0_pll but these clocks are too precious to be used here. All
2486 * the necessary rates for MMC and NAND operation can be acheived using
2487 * g12a_ee_core or fclk_div clocks
2492 static struct clk_regmap g12a_sd_emmc_a_clk0_sel = {
2493 .data = &(struct clk_regmap_mux_data){
2494 .offset = HHI_SD_EMMC_CLK_CNTL,
2498 .hw.init = &(struct clk_init_data) {
2499 .name = "sd_emmc_a_clk0_sel",
2500 .ops = &clk_regmap_mux_ops,
2501 .parent_data = g12a_sd_emmc_clk0_parent_data,
2502 .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data),
2503 .flags = CLK_SET_RATE_PARENT,
2507 static struct clk_regmap g12a_sd_emmc_a_clk0_div = {
2508 .data = &(struct clk_regmap_div_data){
2509 .offset = HHI_SD_EMMC_CLK_CNTL,
2513 .hw.init = &(struct clk_init_data) {
2514 .name = "sd_emmc_a_clk0_div",
2515 .ops = &clk_regmap_divider_ops,
2516 .parent_hws = (const struct clk_hw *[]) {
2517 &g12a_sd_emmc_a_clk0_sel.hw
2520 .flags = CLK_SET_RATE_PARENT,
2524 static struct clk_regmap g12a_sd_emmc_a_clk0 = {
2525 .data = &(struct clk_regmap_gate_data){
2526 .offset = HHI_SD_EMMC_CLK_CNTL,
2529 .hw.init = &(struct clk_init_data){
2530 .name = "sd_emmc_a_clk0",
2531 .ops = &clk_regmap_gate_ops,
2532 .parent_hws = (const struct clk_hw *[]) {
2533 &g12a_sd_emmc_a_clk0_div.hw
2536 .flags = CLK_SET_RATE_PARENT,
2541 static struct clk_regmap g12a_sd_emmc_b_clk0_sel = {
2542 .data = &(struct clk_regmap_mux_data){
2543 .offset = HHI_SD_EMMC_CLK_CNTL,
2547 .hw.init = &(struct clk_init_data) {
2548 .name = "sd_emmc_b_clk0_sel",
2549 .ops = &clk_regmap_mux_ops,
2550 .parent_data = g12a_sd_emmc_clk0_parent_data,
2551 .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data),
2552 .flags = CLK_SET_RATE_PARENT,
2556 static struct clk_regmap g12a_sd_emmc_b_clk0_div = {
2557 .data = &(struct clk_regmap_div_data){
2558 .offset = HHI_SD_EMMC_CLK_CNTL,
2562 .hw.init = &(struct clk_init_data) {
2563 .name = "sd_emmc_b_clk0_div",
2564 .ops = &clk_regmap_divider_ops,
2565 .parent_hws = (const struct clk_hw *[]) {
2566 &g12a_sd_emmc_b_clk0_sel.hw
2569 .flags = CLK_SET_RATE_PARENT,
2573 static struct clk_regmap g12a_sd_emmc_b_clk0 = {
2574 .data = &(struct clk_regmap_gate_data){
2575 .offset = HHI_SD_EMMC_CLK_CNTL,
2578 .hw.init = &(struct clk_init_data){
2579 .name = "sd_emmc_b_clk0",
2580 .ops = &clk_regmap_gate_ops,
2581 .parent_hws = (const struct clk_hw *[]) {
2582 &g12a_sd_emmc_b_clk0_div.hw
2585 .flags = CLK_SET_RATE_PARENT,
2589 /* EMMC/NAND clock */
2590 static struct clk_regmap g12a_sd_emmc_c_clk0_sel = {
2591 .data = &(struct clk_regmap_mux_data){
2592 .offset = HHI_NAND_CLK_CNTL,
2596 .hw.init = &(struct clk_init_data) {
2597 .name = "sd_emmc_c_clk0_sel",
2598 .ops = &clk_regmap_mux_ops,
2599 .parent_data = g12a_sd_emmc_clk0_parent_data,
2600 .num_parents = ARRAY_SIZE(g12a_sd_emmc_clk0_parent_data),
2601 .flags = CLK_SET_RATE_PARENT,
2605 static struct clk_regmap g12a_sd_emmc_c_clk0_div = {
2606 .data = &(struct clk_regmap_div_data){
2607 .offset = HHI_NAND_CLK_CNTL,
2611 .hw.init = &(struct clk_init_data) {
2612 .name = "sd_emmc_c_clk0_div",
2613 .ops = &clk_regmap_divider_ops,
2614 .parent_hws = (const struct clk_hw *[]) {
2615 &g12a_sd_emmc_c_clk0_sel.hw
2618 .flags = CLK_SET_RATE_PARENT,
2622 static struct clk_regmap g12a_sd_emmc_c_clk0 = {
2623 .data = &(struct clk_regmap_gate_data){
2624 .offset = HHI_NAND_CLK_CNTL,
2627 .hw.init = &(struct clk_init_data){
2628 .name = "sd_emmc_c_clk0",
2629 .ops = &clk_regmap_gate_ops,
2630 .parent_hws = (const struct clk_hw *[]) {
2631 &g12a_sd_emmc_c_clk0_div.hw
2634 .flags = CLK_SET_RATE_PARENT,
2640 static struct clk_regmap g12a_vid_pll_div = {
2641 .data = &(struct meson_vid_pll_div_data){
2643 .reg_off = HHI_VID_PLL_CLK_DIV,
2648 .reg_off = HHI_VID_PLL_CLK_DIV,
2653 .hw.init = &(struct clk_init_data) {
2654 .name = "vid_pll_div",
2655 .ops = &meson_vid_pll_div_ro_ops,
2656 .parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_pll.hw },
2658 .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE,
2662 static const struct clk_hw *g12a_vid_pll_parent_hws[] = {
2663 &g12a_vid_pll_div.hw,
2667 static struct clk_regmap g12a_vid_pll_sel = {
2668 .data = &(struct clk_regmap_mux_data){
2669 .offset = HHI_VID_PLL_CLK_DIV,
2673 .hw.init = &(struct clk_init_data){
2674 .name = "vid_pll_sel",
2675 .ops = &clk_regmap_mux_ops,
2677 * bit 18 selects from 2 possible parents:
2678 * vid_pll_div or hdmi_pll
2680 .parent_hws = g12a_vid_pll_parent_hws,
2681 .num_parents = ARRAY_SIZE(g12a_vid_pll_parent_hws),
2682 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
2686 static struct clk_regmap g12a_vid_pll = {
2687 .data = &(struct clk_regmap_gate_data){
2688 .offset = HHI_VID_PLL_CLK_DIV,
2691 .hw.init = &(struct clk_init_data) {
2693 .ops = &clk_regmap_gate_ops,
2694 .parent_hws = (const struct clk_hw *[]) {
2695 &g12a_vid_pll_sel.hw
2698 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
2704 static const struct clk_hw *g12a_vpu_parent_hws[] = {
2715 static struct clk_regmap g12a_vpu_0_sel = {
2716 .data = &(struct clk_regmap_mux_data){
2717 .offset = HHI_VPU_CLK_CNTL,
2721 .hw.init = &(struct clk_init_data){
2722 .name = "vpu_0_sel",
2723 .ops = &clk_regmap_mux_ops,
2724 .parent_hws = g12a_vpu_parent_hws,
2725 .num_parents = ARRAY_SIZE(g12a_vpu_parent_hws),
2726 .flags = CLK_SET_RATE_NO_REPARENT,
2730 static struct clk_regmap g12a_vpu_0_div = {
2731 .data = &(struct clk_regmap_div_data){
2732 .offset = HHI_VPU_CLK_CNTL,
2736 .hw.init = &(struct clk_init_data){
2737 .name = "vpu_0_div",
2738 .ops = &clk_regmap_divider_ops,
2739 .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_0_sel.hw },
2741 .flags = CLK_SET_RATE_PARENT,
2745 static struct clk_regmap g12a_vpu_0 = {
2746 .data = &(struct clk_regmap_gate_data){
2747 .offset = HHI_VPU_CLK_CNTL,
2750 .hw.init = &(struct clk_init_data) {
2752 .ops = &clk_regmap_gate_ops,
2753 .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_0_div.hw },
2755 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
2759 static struct clk_regmap g12a_vpu_1_sel = {
2760 .data = &(struct clk_regmap_mux_data){
2761 .offset = HHI_VPU_CLK_CNTL,
2765 .hw.init = &(struct clk_init_data){
2766 .name = "vpu_1_sel",
2767 .ops = &clk_regmap_mux_ops,
2768 .parent_hws = g12a_vpu_parent_hws,
2769 .num_parents = ARRAY_SIZE(g12a_vpu_parent_hws),
2770 .flags = CLK_SET_RATE_NO_REPARENT,
2774 static struct clk_regmap g12a_vpu_1_div = {
2775 .data = &(struct clk_regmap_div_data){
2776 .offset = HHI_VPU_CLK_CNTL,
2780 .hw.init = &(struct clk_init_data){
2781 .name = "vpu_1_div",
2782 .ops = &clk_regmap_divider_ops,
2783 .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_1_sel.hw },
2785 .flags = CLK_SET_RATE_PARENT,
2789 static struct clk_regmap g12a_vpu_1 = {
2790 .data = &(struct clk_regmap_gate_data){
2791 .offset = HHI_VPU_CLK_CNTL,
2794 .hw.init = &(struct clk_init_data) {
2796 .ops = &clk_regmap_gate_ops,
2797 .parent_hws = (const struct clk_hw *[]) { &g12a_vpu_1_div.hw },
2799 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
2803 static struct clk_regmap g12a_vpu = {
2804 .data = &(struct clk_regmap_mux_data){
2805 .offset = HHI_VPU_CLK_CNTL,
2809 .hw.init = &(struct clk_init_data){
2811 .ops = &clk_regmap_mux_ops,
2813 * bit 31 selects from 2 possible parents:
2816 .parent_hws = (const struct clk_hw *[]) {
2821 .flags = CLK_SET_RATE_NO_REPARENT,
2827 static const struct clk_hw *g12a_vdec_parent_hws[] = {
2828 &g12a_fclk_div2p5.hw,
2837 static struct clk_regmap g12a_vdec_1_sel = {
2838 .data = &(struct clk_regmap_mux_data){
2839 .offset = HHI_VDEC_CLK_CNTL,
2842 .flags = CLK_MUX_ROUND_CLOSEST,
2844 .hw.init = &(struct clk_init_data){
2845 .name = "vdec_1_sel",
2846 .ops = &clk_regmap_mux_ops,
2847 .parent_hws = g12a_vdec_parent_hws,
2848 .num_parents = ARRAY_SIZE(g12a_vdec_parent_hws),
2849 .flags = CLK_SET_RATE_PARENT,
2853 static struct clk_regmap g12a_vdec_1_div = {
2854 .data = &(struct clk_regmap_div_data){
2855 .offset = HHI_VDEC_CLK_CNTL,
2858 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2860 .hw.init = &(struct clk_init_data){
2861 .name = "vdec_1_div",
2862 .ops = &clk_regmap_divider_ops,
2863 .parent_hws = (const struct clk_hw *[]) {
2867 .flags = CLK_SET_RATE_PARENT,
2871 static struct clk_regmap g12a_vdec_1 = {
2872 .data = &(struct clk_regmap_gate_data){
2873 .offset = HHI_VDEC_CLK_CNTL,
2876 .hw.init = &(struct clk_init_data) {
2878 .ops = &clk_regmap_gate_ops,
2879 .parent_hws = (const struct clk_hw *[]) {
2883 .flags = CLK_SET_RATE_PARENT,
2887 static struct clk_regmap g12a_vdec_hevcf_sel = {
2888 .data = &(struct clk_regmap_mux_data){
2889 .offset = HHI_VDEC2_CLK_CNTL,
2892 .flags = CLK_MUX_ROUND_CLOSEST,
2894 .hw.init = &(struct clk_init_data){
2895 .name = "vdec_hevcf_sel",
2896 .ops = &clk_regmap_mux_ops,
2897 .parent_hws = g12a_vdec_parent_hws,
2898 .num_parents = ARRAY_SIZE(g12a_vdec_parent_hws),
2899 .flags = CLK_SET_RATE_PARENT,
2903 static struct clk_regmap g12a_vdec_hevcf_div = {
2904 .data = &(struct clk_regmap_div_data){
2905 .offset = HHI_VDEC2_CLK_CNTL,
2908 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2910 .hw.init = &(struct clk_init_data){
2911 .name = "vdec_hevcf_div",
2912 .ops = &clk_regmap_divider_ops,
2913 .parent_hws = (const struct clk_hw *[]) {
2914 &g12a_vdec_hevcf_sel.hw
2917 .flags = CLK_SET_RATE_PARENT,
2921 static struct clk_regmap g12a_vdec_hevcf = {
2922 .data = &(struct clk_regmap_gate_data){
2923 .offset = HHI_VDEC2_CLK_CNTL,
2926 .hw.init = &(struct clk_init_data) {
2927 .name = "vdec_hevcf",
2928 .ops = &clk_regmap_gate_ops,
2929 .parent_hws = (const struct clk_hw *[]) {
2930 &g12a_vdec_hevcf_div.hw
2933 .flags = CLK_SET_RATE_PARENT,
2937 static struct clk_regmap g12a_vdec_hevc_sel = {
2938 .data = &(struct clk_regmap_mux_data){
2939 .offset = HHI_VDEC2_CLK_CNTL,
2942 .flags = CLK_MUX_ROUND_CLOSEST,
2944 .hw.init = &(struct clk_init_data){
2945 .name = "vdec_hevc_sel",
2946 .ops = &clk_regmap_mux_ops,
2947 .parent_hws = g12a_vdec_parent_hws,
2948 .num_parents = ARRAY_SIZE(g12a_vdec_parent_hws),
2949 .flags = CLK_SET_RATE_PARENT,
2953 static struct clk_regmap g12a_vdec_hevc_div = {
2954 .data = &(struct clk_regmap_div_data){
2955 .offset = HHI_VDEC2_CLK_CNTL,
2958 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2960 .hw.init = &(struct clk_init_data){
2961 .name = "vdec_hevc_div",
2962 .ops = &clk_regmap_divider_ops,
2963 .parent_hws = (const struct clk_hw *[]) {
2964 &g12a_vdec_hevc_sel.hw
2967 .flags = CLK_SET_RATE_PARENT,
2971 static struct clk_regmap g12a_vdec_hevc = {
2972 .data = &(struct clk_regmap_gate_data){
2973 .offset = HHI_VDEC2_CLK_CNTL,
2976 .hw.init = &(struct clk_init_data) {
2977 .name = "vdec_hevc",
2978 .ops = &clk_regmap_gate_ops,
2979 .parent_hws = (const struct clk_hw *[]) {
2980 &g12a_vdec_hevc_div.hw
2983 .flags = CLK_SET_RATE_PARENT,
2989 static const struct clk_hw *g12a_vapb_parent_hws[] = {
2997 &g12a_fclk_div2p5.hw,
3000 static struct clk_regmap g12a_vapb_0_sel = {
3001 .data = &(struct clk_regmap_mux_data){
3002 .offset = HHI_VAPBCLK_CNTL,
3006 .hw.init = &(struct clk_init_data){
3007 .name = "vapb_0_sel",
3008 .ops = &clk_regmap_mux_ops,
3009 .parent_hws = g12a_vapb_parent_hws,
3010 .num_parents = ARRAY_SIZE(g12a_vapb_parent_hws),
3011 .flags = CLK_SET_RATE_NO_REPARENT,
3015 static struct clk_regmap g12a_vapb_0_div = {
3016 .data = &(struct clk_regmap_div_data){
3017 .offset = HHI_VAPBCLK_CNTL,
3021 .hw.init = &(struct clk_init_data){
3022 .name = "vapb_0_div",
3023 .ops = &clk_regmap_divider_ops,
3024 .parent_hws = (const struct clk_hw *[]) {
3028 .flags = CLK_SET_RATE_PARENT,
3032 static struct clk_regmap g12a_vapb_0 = {
3033 .data = &(struct clk_regmap_gate_data){
3034 .offset = HHI_VAPBCLK_CNTL,
3037 .hw.init = &(struct clk_init_data) {
3039 .ops = &clk_regmap_gate_ops,
3040 .parent_hws = (const struct clk_hw *[]) {
3044 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3048 static struct clk_regmap g12a_vapb_1_sel = {
3049 .data = &(struct clk_regmap_mux_data){
3050 .offset = HHI_VAPBCLK_CNTL,
3054 .hw.init = &(struct clk_init_data){
3055 .name = "vapb_1_sel",
3056 .ops = &clk_regmap_mux_ops,
3057 .parent_hws = g12a_vapb_parent_hws,
3058 .num_parents = ARRAY_SIZE(g12a_vapb_parent_hws),
3059 .flags = CLK_SET_RATE_NO_REPARENT,
3063 static struct clk_regmap g12a_vapb_1_div = {
3064 .data = &(struct clk_regmap_div_data){
3065 .offset = HHI_VAPBCLK_CNTL,
3069 .hw.init = &(struct clk_init_data){
3070 .name = "vapb_1_div",
3071 .ops = &clk_regmap_divider_ops,
3072 .parent_hws = (const struct clk_hw *[]) {
3076 .flags = CLK_SET_RATE_PARENT,
3080 static struct clk_regmap g12a_vapb_1 = {
3081 .data = &(struct clk_regmap_gate_data){
3082 .offset = HHI_VAPBCLK_CNTL,
3085 .hw.init = &(struct clk_init_data) {
3087 .ops = &clk_regmap_gate_ops,
3088 .parent_hws = (const struct clk_hw *[]) {
3092 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3096 static struct clk_regmap g12a_vapb_sel = {
3097 .data = &(struct clk_regmap_mux_data){
3098 .offset = HHI_VAPBCLK_CNTL,
3102 .hw.init = &(struct clk_init_data){
3104 .ops = &clk_regmap_mux_ops,
3106 * bit 31 selects from 2 possible parents:
3109 .parent_hws = (const struct clk_hw *[]) {
3114 .flags = CLK_SET_RATE_NO_REPARENT,
3118 static struct clk_regmap g12a_vapb = {
3119 .data = &(struct clk_regmap_gate_data){
3120 .offset = HHI_VAPBCLK_CNTL,
3123 .hw.init = &(struct clk_init_data) {
3125 .ops = &clk_regmap_gate_ops,
3126 .parent_hws = (const struct clk_hw *[]) { &g12a_vapb_sel.hw },
3128 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3132 static const struct clk_hw *g12a_vclk_parent_hws[] = {
3143 static struct clk_regmap g12a_vclk_sel = {
3144 .data = &(struct clk_regmap_mux_data){
3145 .offset = HHI_VID_CLK_CNTL,
3149 .hw.init = &(struct clk_init_data){
3151 .ops = &clk_regmap_mux_ops,
3152 .parent_hws = g12a_vclk_parent_hws,
3153 .num_parents = ARRAY_SIZE(g12a_vclk_parent_hws),
3154 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3158 static struct clk_regmap g12a_vclk2_sel = {
3159 .data = &(struct clk_regmap_mux_data){
3160 .offset = HHI_VIID_CLK_CNTL,
3164 .hw.init = &(struct clk_init_data){
3165 .name = "vclk2_sel",
3166 .ops = &clk_regmap_mux_ops,
3167 .parent_hws = g12a_vclk_parent_hws,
3168 .num_parents = ARRAY_SIZE(g12a_vclk_parent_hws),
3169 .flags = CLK_SET_RATE_NO_REPARENT,
3173 static struct clk_regmap g12a_vclk_input = {
3174 .data = &(struct clk_regmap_gate_data){
3175 .offset = HHI_VID_CLK_DIV,
3178 .hw.init = &(struct clk_init_data) {
3179 .name = "vclk_input",
3180 .ops = &clk_regmap_gate_ops,
3181 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk_sel.hw },
3183 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3187 static struct clk_regmap g12a_vclk2_input = {
3188 .data = &(struct clk_regmap_gate_data){
3189 .offset = HHI_VIID_CLK_DIV,
3192 .hw.init = &(struct clk_init_data) {
3193 .name = "vclk2_input",
3194 .ops = &clk_regmap_gate_ops,
3195 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2_sel.hw },
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 meson_vclk_div_data){
3220 .reg_off = HHI_VIID_CLK_DIV,
3225 .reg_off = HHI_VIID_CLK_DIV,
3230 .reg_off = HHI_VIID_CLK_DIV,
3234 .flags = CLK_DIVIDER_ROUND_CLOSEST,
3236 .hw.init = &(struct clk_init_data){
3237 .name = "vclk2_div",
3238 .ops = &meson_vclk_div_ops,
3239 .parent_hws = (const struct clk_hw *[]) {
3240 &g12a_vclk2_input.hw
3243 .flags = CLK_SET_RATE_GATE,
3247 static struct clk_regmap g12a_vclk = {
3248 .data = &(struct clk_regmap_gate_data){
3249 .offset = HHI_VID_CLK_CNTL,
3252 .hw.init = &(struct clk_init_data) {
3254 .ops = &clk_regmap_gate_ops,
3255 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk_div.hw },
3257 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3261 static struct clk_regmap g12a_vclk2 = {
3262 .data = &(struct meson_vclk_gate_data){
3264 .reg_off = HHI_VIID_CLK_CNTL,
3269 .reg_off = HHI_VIID_CLK_CNTL,
3274 .hw.init = &(struct clk_init_data) {
3276 .ops = &meson_vclk_gate_ops,
3277 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2_div.hw },
3279 .flags = CLK_SET_RATE_PARENT,
3283 static struct clk_regmap g12a_vclk_div1 = {
3284 .data = &(struct clk_regmap_gate_data){
3285 .offset = HHI_VID_CLK_CNTL,
3288 .hw.init = &(struct clk_init_data) {
3289 .name = "vclk_div1",
3290 .ops = &clk_regmap_gate_ops,
3291 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3293 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3297 static struct clk_regmap g12a_vclk_div2_en = {
3298 .data = &(struct clk_regmap_gate_data){
3299 .offset = HHI_VID_CLK_CNTL,
3302 .hw.init = &(struct clk_init_data) {
3303 .name = "vclk_div2_en",
3304 .ops = &clk_regmap_gate_ops,
3305 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3307 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3311 static struct clk_regmap g12a_vclk_div4_en = {
3312 .data = &(struct clk_regmap_gate_data){
3313 .offset = HHI_VID_CLK_CNTL,
3316 .hw.init = &(struct clk_init_data) {
3317 .name = "vclk_div4_en",
3318 .ops = &clk_regmap_gate_ops,
3319 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3321 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3325 static struct clk_regmap g12a_vclk_div6_en = {
3326 .data = &(struct clk_regmap_gate_data){
3327 .offset = HHI_VID_CLK_CNTL,
3330 .hw.init = &(struct clk_init_data) {
3331 .name = "vclk_div6_en",
3332 .ops = &clk_regmap_gate_ops,
3333 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3335 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3339 static struct clk_regmap g12a_vclk_div12_en = {
3340 .data = &(struct clk_regmap_gate_data){
3341 .offset = HHI_VID_CLK_CNTL,
3344 .hw.init = &(struct clk_init_data) {
3345 .name = "vclk_div12_en",
3346 .ops = &clk_regmap_gate_ops,
3347 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk.hw },
3349 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3353 static struct clk_regmap g12a_vclk2_div1 = {
3354 .data = &(struct clk_regmap_gate_data){
3355 .offset = HHI_VIID_CLK_CNTL,
3358 .hw.init = &(struct clk_init_data) {
3359 .name = "vclk2_div1",
3360 .ops = &clk_regmap_gate_ops,
3361 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3363 .flags = CLK_SET_RATE_PARENT,
3367 static struct clk_regmap g12a_vclk2_div2_en = {
3368 .data = &(struct clk_regmap_gate_data){
3369 .offset = HHI_VIID_CLK_CNTL,
3372 .hw.init = &(struct clk_init_data) {
3373 .name = "vclk2_div2_en",
3374 .ops = &clk_regmap_gate_ops,
3375 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3377 .flags = CLK_SET_RATE_PARENT,
3381 static struct clk_regmap g12a_vclk2_div4_en = {
3382 .data = &(struct clk_regmap_gate_data){
3383 .offset = HHI_VIID_CLK_CNTL,
3386 .hw.init = &(struct clk_init_data) {
3387 .name = "vclk2_div4_en",
3388 .ops = &clk_regmap_gate_ops,
3389 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3391 .flags = CLK_SET_RATE_PARENT,
3395 static struct clk_regmap g12a_vclk2_div6_en = {
3396 .data = &(struct clk_regmap_gate_data){
3397 .offset = HHI_VIID_CLK_CNTL,
3400 .hw.init = &(struct clk_init_data) {
3401 .name = "vclk2_div6_en",
3402 .ops = &clk_regmap_gate_ops,
3403 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3405 .flags = CLK_SET_RATE_PARENT,
3409 static struct clk_regmap g12a_vclk2_div12_en = {
3410 .data = &(struct clk_regmap_gate_data){
3411 .offset = HHI_VIID_CLK_CNTL,
3414 .hw.init = &(struct clk_init_data) {
3415 .name = "vclk2_div12_en",
3416 .ops = &clk_regmap_gate_ops,
3417 .parent_hws = (const struct clk_hw *[]) { &g12a_vclk2.hw },
3419 .flags = CLK_SET_RATE_PARENT,
3423 static struct clk_fixed_factor g12a_vclk_div2 = {
3426 .hw.init = &(struct clk_init_data){
3427 .name = "vclk_div2",
3428 .ops = &clk_fixed_factor_ops,
3429 .parent_hws = (const struct clk_hw *[]) {
3430 &g12a_vclk_div2_en.hw
3436 static struct clk_fixed_factor g12a_vclk_div4 = {
3439 .hw.init = &(struct clk_init_data){
3440 .name = "vclk_div4",
3441 .ops = &clk_fixed_factor_ops,
3442 .parent_hws = (const struct clk_hw *[]) {
3443 &g12a_vclk_div4_en.hw
3449 static struct clk_fixed_factor g12a_vclk_div6 = {
3452 .hw.init = &(struct clk_init_data){
3453 .name = "vclk_div6",
3454 .ops = &clk_fixed_factor_ops,
3455 .parent_hws = (const struct clk_hw *[]) {
3456 &g12a_vclk_div6_en.hw
3462 static struct clk_fixed_factor g12a_vclk_div12 = {
3465 .hw.init = &(struct clk_init_data){
3466 .name = "vclk_div12",
3467 .ops = &clk_fixed_factor_ops,
3468 .parent_hws = (const struct clk_hw *[]) {
3469 &g12a_vclk_div12_en.hw
3475 static struct clk_fixed_factor g12a_vclk2_div2 = {
3478 .hw.init = &(struct clk_init_data){
3479 .name = "vclk2_div2",
3480 .ops = &clk_fixed_factor_ops,
3481 .parent_hws = (const struct clk_hw *[]) {
3482 &g12a_vclk2_div2_en.hw
3485 .flags = CLK_SET_RATE_PARENT,
3489 static struct clk_fixed_factor g12a_vclk2_div4 = {
3492 .hw.init = &(struct clk_init_data){
3493 .name = "vclk2_div4",
3494 .ops = &clk_fixed_factor_ops,
3495 .parent_hws = (const struct clk_hw *[]) {
3496 &g12a_vclk2_div4_en.hw
3499 .flags = CLK_SET_RATE_PARENT,
3503 static struct clk_fixed_factor g12a_vclk2_div6 = {
3506 .hw.init = &(struct clk_init_data){
3507 .name = "vclk2_div6",
3508 .ops = &clk_fixed_factor_ops,
3509 .parent_hws = (const struct clk_hw *[]) {
3510 &g12a_vclk2_div6_en.hw
3513 .flags = CLK_SET_RATE_PARENT,
3517 static struct clk_fixed_factor g12a_vclk2_div12 = {
3520 .hw.init = &(struct clk_init_data){
3521 .name = "vclk2_div12",
3522 .ops = &clk_fixed_factor_ops,
3523 .parent_hws = (const struct clk_hw *[]) {
3524 &g12a_vclk2_div12_en.hw
3527 .flags = CLK_SET_RATE_PARENT,
3531 static u32 mux_table_cts_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 };
3532 static const struct clk_hw *g12a_cts_parent_hws[] = {
3537 &g12a_vclk_div12.hw,
3538 &g12a_vclk2_div1.hw,
3539 &g12a_vclk2_div2.hw,
3540 &g12a_vclk2_div4.hw,
3541 &g12a_vclk2_div6.hw,
3542 &g12a_vclk2_div12.hw,
3545 static struct clk_regmap g12a_cts_enci_sel = {
3546 .data = &(struct clk_regmap_mux_data){
3547 .offset = HHI_VID_CLK_DIV,
3550 .table = mux_table_cts_sel,
3552 .hw.init = &(struct clk_init_data){
3553 .name = "cts_enci_sel",
3554 .ops = &clk_regmap_mux_ops,
3555 .parent_hws = g12a_cts_parent_hws,
3556 .num_parents = ARRAY_SIZE(g12a_cts_parent_hws),
3557 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3561 static struct clk_regmap g12a_cts_encp_sel = {
3562 .data = &(struct clk_regmap_mux_data){
3563 .offset = HHI_VID_CLK_DIV,
3566 .table = mux_table_cts_sel,
3568 .hw.init = &(struct clk_init_data){
3569 .name = "cts_encp_sel",
3570 .ops = &clk_regmap_mux_ops,
3571 .parent_hws = g12a_cts_parent_hws,
3572 .num_parents = ARRAY_SIZE(g12a_cts_parent_hws),
3573 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3577 static struct clk_regmap g12a_cts_encl_sel = {
3578 .data = &(struct clk_regmap_mux_data){
3579 .offset = HHI_VIID_CLK_DIV,
3582 .table = mux_table_cts_sel,
3584 .hw.init = &(struct clk_init_data){
3585 .name = "cts_encl_sel",
3586 .ops = &clk_regmap_mux_ops,
3587 .parent_hws = g12a_cts_parent_hws,
3588 .num_parents = ARRAY_SIZE(g12a_cts_parent_hws),
3589 .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
3593 static struct clk_regmap g12a_cts_vdac_sel = {
3594 .data = &(struct clk_regmap_mux_data){
3595 .offset = HHI_VIID_CLK_DIV,
3598 .table = mux_table_cts_sel,
3600 .hw.init = &(struct clk_init_data){
3601 .name = "cts_vdac_sel",
3602 .ops = &clk_regmap_mux_ops,
3603 .parent_hws = g12a_cts_parent_hws,
3604 .num_parents = ARRAY_SIZE(g12a_cts_parent_hws),
3605 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3609 /* TOFIX: add support for cts_tcon */
3610 static u32 mux_table_hdmi_tx_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 };
3611 static const struct clk_hw *g12a_cts_hdmi_tx_parent_hws[] = {
3616 &g12a_vclk_div12.hw,
3617 &g12a_vclk2_div1.hw,
3618 &g12a_vclk2_div2.hw,
3619 &g12a_vclk2_div4.hw,
3620 &g12a_vclk2_div6.hw,
3621 &g12a_vclk2_div12.hw,
3624 static struct clk_regmap g12a_hdmi_tx_sel = {
3625 .data = &(struct clk_regmap_mux_data){
3626 .offset = HHI_HDMI_CLK_CNTL,
3629 .table = mux_table_hdmi_tx_sel,
3631 .hw.init = &(struct clk_init_data){
3632 .name = "hdmi_tx_sel",
3633 .ops = &clk_regmap_mux_ops,
3634 .parent_hws = g12a_cts_hdmi_tx_parent_hws,
3635 .num_parents = ARRAY_SIZE(g12a_cts_hdmi_tx_parent_hws),
3636 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3640 static struct clk_regmap g12a_cts_enci = {
3641 .data = &(struct clk_regmap_gate_data){
3642 .offset = HHI_VID_CLK_CNTL2,
3645 .hw.init = &(struct clk_init_data) {
3647 .ops = &clk_regmap_gate_ops,
3648 .parent_hws = (const struct clk_hw *[]) {
3649 &g12a_cts_enci_sel.hw
3652 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3656 static struct clk_regmap g12a_cts_encp = {
3657 .data = &(struct clk_regmap_gate_data){
3658 .offset = HHI_VID_CLK_CNTL2,
3661 .hw.init = &(struct clk_init_data) {
3663 .ops = &clk_regmap_gate_ops,
3664 .parent_hws = (const struct clk_hw *[]) {
3665 &g12a_cts_encp_sel.hw
3668 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3672 static struct clk_regmap g12a_cts_encl = {
3673 .data = &(struct clk_regmap_gate_data){
3674 .offset = HHI_VID_CLK_CNTL2,
3677 .hw.init = &(struct clk_init_data) {
3679 .ops = &clk_regmap_gate_ops,
3680 .parent_hws = (const struct clk_hw *[]) {
3681 &g12a_cts_encl_sel.hw
3684 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3688 static struct clk_regmap g12a_cts_vdac = {
3689 .data = &(struct clk_regmap_gate_data){
3690 .offset = HHI_VID_CLK_CNTL2,
3693 .hw.init = &(struct clk_init_data) {
3695 .ops = &clk_regmap_gate_ops,
3696 .parent_hws = (const struct clk_hw *[]) {
3697 &g12a_cts_vdac_sel.hw
3700 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3704 static struct clk_regmap g12a_hdmi_tx = {
3705 .data = &(struct clk_regmap_gate_data){
3706 .offset = HHI_VID_CLK_CNTL2,
3709 .hw.init = &(struct clk_init_data) {
3711 .ops = &clk_regmap_gate_ops,
3712 .parent_hws = (const struct clk_hw *[]) {
3713 &g12a_hdmi_tx_sel.hw
3716 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3720 /* MIPI DSI Host Clocks */
3722 static const struct clk_hw *g12a_mipi_dsi_pxclk_parent_hws[] = {
3728 &g12a_fclk_div2p5.hw,
3733 static struct clk_regmap g12a_mipi_dsi_pxclk_sel = {
3734 .data = &(struct clk_regmap_mux_data){
3735 .offset = HHI_MIPIDSI_PHY_CLK_CNTL,
3738 .flags = CLK_MUX_ROUND_CLOSEST,
3740 .hw.init = &(struct clk_init_data){
3741 .name = "mipi_dsi_pxclk_sel",
3742 .ops = &clk_regmap_mux_ops,
3743 .parent_hws = g12a_mipi_dsi_pxclk_parent_hws,
3744 .num_parents = ARRAY_SIZE(g12a_mipi_dsi_pxclk_parent_hws),
3745 .flags = CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT,
3750 * FIXME: Force as bypass by forcing a single /1 table entry, and doensn't on boot value
3751 * when setting a clock whith this node in the clock path, but doesn't garantee the divider
3752 * is at /1 at boot until a rate is set.
3754 static const struct clk_div_table g12a_mipi_dsi_pxclk_div_table[] = {
3755 { .val = 0, .div = 1 },
3759 static struct clk_regmap g12a_mipi_dsi_pxclk_div = {
3760 .data = &(struct clk_regmap_div_data){
3761 .offset = HHI_MIPIDSI_PHY_CLK_CNTL,
3764 .table = g12a_mipi_dsi_pxclk_div_table,
3766 .hw.init = &(struct clk_init_data){
3767 .name = "mipi_dsi_pxclk_div",
3768 .ops = &clk_regmap_divider_ops,
3769 .parent_hws = (const struct clk_hw *[]) {
3770 &g12a_mipi_dsi_pxclk_sel.hw
3773 .flags = CLK_SET_RATE_PARENT,
3777 static struct clk_regmap g12a_mipi_dsi_pxclk = {
3778 .data = &(struct clk_regmap_gate_data){
3779 .offset = HHI_MIPIDSI_PHY_CLK_CNTL,
3782 .hw.init = &(struct clk_init_data) {
3783 .name = "mipi_dsi_pxclk",
3784 .ops = &clk_regmap_gate_ops,
3785 .parent_hws = (const struct clk_hw *[]) {
3786 &g12a_mipi_dsi_pxclk_div.hw
3789 .flags = CLK_SET_RATE_PARENT,
3793 /* MIPI ISP Clocks */
3795 static const struct clk_parent_data g12b_mipi_isp_parent_data[] = {
3796 { .fw_name = "xtal", },
3797 { .hw = &g12a_gp0_pll.hw },
3798 { .hw = &g12a_hifi_pll.hw },
3799 { .hw = &g12a_fclk_div2p5.hw },
3800 { .hw = &g12a_fclk_div3.hw },
3801 { .hw = &g12a_fclk_div4.hw },
3802 { .hw = &g12a_fclk_div5.hw },
3803 { .hw = &g12a_fclk_div7.hw },
3806 static struct clk_regmap g12b_mipi_isp_sel = {
3807 .data = &(struct clk_regmap_mux_data){
3808 .offset = HHI_ISP_CLK_CNTL,
3812 .hw.init = &(struct clk_init_data){
3813 .name = "mipi_isp_sel",
3814 .ops = &clk_regmap_mux_ops,
3815 .parent_data = g12b_mipi_isp_parent_data,
3816 .num_parents = ARRAY_SIZE(g12b_mipi_isp_parent_data),
3820 static struct clk_regmap g12b_mipi_isp_div = {
3821 .data = &(struct clk_regmap_div_data){
3822 .offset = HHI_ISP_CLK_CNTL,
3826 .hw.init = &(struct clk_init_data){
3827 .name = "mipi_isp_div",
3828 .ops = &clk_regmap_divider_ops,
3829 .parent_hws = (const struct clk_hw *[]) {
3830 &g12b_mipi_isp_sel.hw
3833 .flags = CLK_SET_RATE_PARENT,
3837 static struct clk_regmap g12b_mipi_isp = {
3838 .data = &(struct clk_regmap_gate_data){
3839 .offset = HHI_ISP_CLK_CNTL,
3842 .hw.init = &(struct clk_init_data) {
3844 .ops = &clk_regmap_gate_ops,
3845 .parent_hws = (const struct clk_hw *[]) {
3846 &g12b_mipi_isp_div.hw
3849 .flags = CLK_SET_RATE_PARENT,
3855 static const struct clk_parent_data g12a_hdmi_parent_data[] = {
3856 { .fw_name = "xtal", },
3857 { .hw = &g12a_fclk_div4.hw },
3858 { .hw = &g12a_fclk_div3.hw },
3859 { .hw = &g12a_fclk_div5.hw },
3862 static struct clk_regmap g12a_hdmi_sel = {
3863 .data = &(struct clk_regmap_mux_data){
3864 .offset = HHI_HDMI_CLK_CNTL,
3867 .flags = CLK_MUX_ROUND_CLOSEST,
3869 .hw.init = &(struct clk_init_data){
3871 .ops = &clk_regmap_mux_ops,
3872 .parent_data = g12a_hdmi_parent_data,
3873 .num_parents = ARRAY_SIZE(g12a_hdmi_parent_data),
3874 .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE,
3878 static struct clk_regmap g12a_hdmi_div = {
3879 .data = &(struct clk_regmap_div_data){
3880 .offset = HHI_HDMI_CLK_CNTL,
3884 .hw.init = &(struct clk_init_data){
3886 .ops = &clk_regmap_divider_ops,
3887 .parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_sel.hw },
3889 .flags = CLK_GET_RATE_NOCACHE,
3893 static struct clk_regmap g12a_hdmi = {
3894 .data = &(struct clk_regmap_gate_data){
3895 .offset = HHI_HDMI_CLK_CNTL,
3898 .hw.init = &(struct clk_init_data) {
3900 .ops = &clk_regmap_gate_ops,
3901 .parent_hws = (const struct clk_hw *[]) { &g12a_hdmi_div.hw },
3903 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
3908 * The MALI IP is clocked by two identical clocks (mali_0 and mali_1)
3909 * muxed by a glitch-free switch. The CCF can manage this glitch-free
3910 * mux because it does top-to-bottom updates the each clock tree and
3911 * switches to the "inactive" one when CLK_SET_RATE_GATE is set.
3913 static const struct clk_parent_data g12a_mali_0_1_parent_data[] = {
3914 { .fw_name = "xtal", },
3915 { .hw = &g12a_gp0_pll.hw },
3916 { .hw = &g12a_hifi_pll.hw },
3917 { .hw = &g12a_fclk_div2p5.hw },
3918 { .hw = &g12a_fclk_div3.hw },
3919 { .hw = &g12a_fclk_div4.hw },
3920 { .hw = &g12a_fclk_div5.hw },
3921 { .hw = &g12a_fclk_div7.hw },
3924 static struct clk_regmap g12a_mali_0_sel = {
3925 .data = &(struct clk_regmap_mux_data){
3926 .offset = HHI_MALI_CLK_CNTL,
3930 .hw.init = &(struct clk_init_data){
3931 .name = "mali_0_sel",
3932 .ops = &clk_regmap_mux_ops,
3933 .parent_data = g12a_mali_0_1_parent_data,
3936 * Don't request the parent to change the rate because
3937 * all GPU frequencies can be derived from the fclk_*
3938 * clocks and one special GP0_PLL setting. This is
3939 * important because we need the MPLL clocks for audio.
3945 static struct clk_regmap g12a_mali_0_div = {
3946 .data = &(struct clk_regmap_div_data){
3947 .offset = HHI_MALI_CLK_CNTL,
3951 .hw.init = &(struct clk_init_data){
3952 .name = "mali_0_div",
3953 .ops = &clk_regmap_divider_ops,
3954 .parent_hws = (const struct clk_hw *[]) {
3958 .flags = CLK_SET_RATE_PARENT,
3962 static struct clk_regmap g12a_mali_0 = {
3963 .data = &(struct clk_regmap_gate_data){
3964 .offset = HHI_MALI_CLK_CNTL,
3967 .hw.init = &(struct clk_init_data){
3969 .ops = &clk_regmap_gate_ops,
3970 .parent_hws = (const struct clk_hw *[]) {
3974 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
3978 static struct clk_regmap g12a_mali_1_sel = {
3979 .data = &(struct clk_regmap_mux_data){
3980 .offset = HHI_MALI_CLK_CNTL,
3984 .hw.init = &(struct clk_init_data){
3985 .name = "mali_1_sel",
3986 .ops = &clk_regmap_mux_ops,
3987 .parent_data = g12a_mali_0_1_parent_data,
3990 * Don't request the parent to change the rate because
3991 * all GPU frequencies can be derived from the fclk_*
3992 * clocks and one special GP0_PLL setting. This is
3993 * important because we need the MPLL clocks for audio.
3999 static struct clk_regmap g12a_mali_1_div = {
4000 .data = &(struct clk_regmap_div_data){
4001 .offset = HHI_MALI_CLK_CNTL,
4005 .hw.init = &(struct clk_init_data){
4006 .name = "mali_1_div",
4007 .ops = &clk_regmap_divider_ops,
4008 .parent_hws = (const struct clk_hw *[]) {
4012 .flags = CLK_SET_RATE_PARENT,
4016 static struct clk_regmap g12a_mali_1 = {
4017 .data = &(struct clk_regmap_gate_data){
4018 .offset = HHI_MALI_CLK_CNTL,
4021 .hw.init = &(struct clk_init_data){
4023 .ops = &clk_regmap_gate_ops,
4024 .parent_hws = (const struct clk_hw *[]) {
4028 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
4032 static const struct clk_hw *g12a_mali_parent_hws[] = {
4037 static struct clk_regmap g12a_mali = {
4038 .data = &(struct clk_regmap_mux_data){
4039 .offset = HHI_MALI_CLK_CNTL,
4043 .hw.init = &(struct clk_init_data){
4045 .ops = &clk_regmap_mux_ops,
4046 .parent_hws = g12a_mali_parent_hws,
4048 .flags = CLK_SET_RATE_PARENT,
4052 static struct clk_regmap g12a_ts_div = {
4053 .data = &(struct clk_regmap_div_data){
4054 .offset = HHI_TS_CLK_CNTL,
4058 .hw.init = &(struct clk_init_data){
4060 .ops = &clk_regmap_divider_ro_ops,
4061 .parent_data = &(const struct clk_parent_data) {
4068 static struct clk_regmap g12a_ts = {
4069 .data = &(struct clk_regmap_gate_data){
4070 .offset = HHI_TS_CLK_CNTL,
4073 .hw.init = &(struct clk_init_data){
4075 .ops = &clk_regmap_gate_ops,
4076 .parent_hws = (const struct clk_hw *[]) {
4083 /* SPICC SCLK source clock */
4085 static const struct clk_parent_data spicc_sclk_parent_data[] = {
4086 { .fw_name = "xtal", },
4087 { .hw = &g12a_clk81.hw },
4088 { .hw = &g12a_fclk_div4.hw },
4089 { .hw = &g12a_fclk_div3.hw },
4090 { .hw = &g12a_fclk_div5.hw },
4091 { .hw = &g12a_fclk_div7.hw },
4094 static struct clk_regmap g12a_spicc0_sclk_sel = {
4095 .data = &(struct clk_regmap_mux_data){
4096 .offset = HHI_SPICC_CLK_CNTL,
4100 .hw.init = &(struct clk_init_data){
4101 .name = "spicc0_sclk_sel",
4102 .ops = &clk_regmap_mux_ops,
4103 .parent_data = spicc_sclk_parent_data,
4104 .num_parents = ARRAY_SIZE(spicc_sclk_parent_data),
4108 static struct clk_regmap g12a_spicc0_sclk_div = {
4109 .data = &(struct clk_regmap_div_data){
4110 .offset = HHI_SPICC_CLK_CNTL,
4114 .hw.init = &(struct clk_init_data){
4115 .name = "spicc0_sclk_div",
4116 .ops = &clk_regmap_divider_ops,
4117 .parent_hws = (const struct clk_hw *[]) {
4118 &g12a_spicc0_sclk_sel.hw
4121 .flags = CLK_SET_RATE_PARENT,
4125 static struct clk_regmap g12a_spicc0_sclk = {
4126 .data = &(struct clk_regmap_gate_data){
4127 .offset = HHI_SPICC_CLK_CNTL,
4130 .hw.init = &(struct clk_init_data){
4131 .name = "spicc0_sclk",
4132 .ops = &clk_regmap_gate_ops,
4133 .parent_hws = (const struct clk_hw *[]) {
4134 &g12a_spicc0_sclk_div.hw
4137 .flags = CLK_SET_RATE_PARENT,
4141 static struct clk_regmap g12a_spicc1_sclk_sel = {
4142 .data = &(struct clk_regmap_mux_data){
4143 .offset = HHI_SPICC_CLK_CNTL,
4147 .hw.init = &(struct clk_init_data){
4148 .name = "spicc1_sclk_sel",
4149 .ops = &clk_regmap_mux_ops,
4150 .parent_data = spicc_sclk_parent_data,
4151 .num_parents = ARRAY_SIZE(spicc_sclk_parent_data),
4155 static struct clk_regmap g12a_spicc1_sclk_div = {
4156 .data = &(struct clk_regmap_div_data){
4157 .offset = HHI_SPICC_CLK_CNTL,
4161 .hw.init = &(struct clk_init_data){
4162 .name = "spicc1_sclk_div",
4163 .ops = &clk_regmap_divider_ops,
4164 .parent_hws = (const struct clk_hw *[]) {
4165 &g12a_spicc1_sclk_sel.hw
4168 .flags = CLK_SET_RATE_PARENT,
4172 static struct clk_regmap g12a_spicc1_sclk = {
4173 .data = &(struct clk_regmap_gate_data){
4174 .offset = HHI_SPICC_CLK_CNTL,
4177 .hw.init = &(struct clk_init_data){
4178 .name = "spicc1_sclk",
4179 .ops = &clk_regmap_gate_ops,
4180 .parent_hws = (const struct clk_hw *[]) {
4181 &g12a_spicc1_sclk_div.hw
4184 .flags = CLK_SET_RATE_PARENT,
4188 /* Neural Network Accelerator source clock */
4190 static const struct clk_parent_data nna_clk_parent_data[] = {
4191 { .fw_name = "xtal", },
4192 { .hw = &g12a_gp0_pll.hw, },
4193 { .hw = &g12a_hifi_pll.hw, },
4194 { .hw = &g12a_fclk_div2p5.hw, },
4195 { .hw = &g12a_fclk_div3.hw, },
4196 { .hw = &g12a_fclk_div4.hw, },
4197 { .hw = &g12a_fclk_div5.hw, },
4198 { .hw = &g12a_fclk_div7.hw },
4201 static struct clk_regmap sm1_nna_axi_clk_sel = {
4202 .data = &(struct clk_regmap_mux_data){
4203 .offset = HHI_NNA_CLK_CNTL,
4207 .hw.init = &(struct clk_init_data){
4208 .name = "nna_axi_clk_sel",
4209 .ops = &clk_regmap_mux_ops,
4210 .parent_data = nna_clk_parent_data,
4211 .num_parents = ARRAY_SIZE(nna_clk_parent_data),
4215 static struct clk_regmap sm1_nna_axi_clk_div = {
4216 .data = &(struct clk_regmap_div_data){
4217 .offset = HHI_NNA_CLK_CNTL,
4221 .hw.init = &(struct clk_init_data){
4222 .name = "nna_axi_clk_div",
4223 .ops = &clk_regmap_divider_ops,
4224 .parent_hws = (const struct clk_hw *[]) {
4225 &sm1_nna_axi_clk_sel.hw
4228 .flags = CLK_SET_RATE_PARENT,
4232 static struct clk_regmap sm1_nna_axi_clk = {
4233 .data = &(struct clk_regmap_gate_data){
4234 .offset = HHI_NNA_CLK_CNTL,
4237 .hw.init = &(struct clk_init_data){
4238 .name = "nna_axi_clk",
4239 .ops = &clk_regmap_gate_ops,
4240 .parent_hws = (const struct clk_hw *[]) {
4241 &sm1_nna_axi_clk_div.hw
4244 .flags = CLK_SET_RATE_PARENT,
4248 static struct clk_regmap sm1_nna_core_clk_sel = {
4249 .data = &(struct clk_regmap_mux_data){
4250 .offset = HHI_NNA_CLK_CNTL,
4254 .hw.init = &(struct clk_init_data){
4255 .name = "nna_core_clk_sel",
4256 .ops = &clk_regmap_mux_ops,
4257 .parent_data = nna_clk_parent_data,
4258 .num_parents = ARRAY_SIZE(nna_clk_parent_data),
4262 static struct clk_regmap sm1_nna_core_clk_div = {
4263 .data = &(struct clk_regmap_div_data){
4264 .offset = HHI_NNA_CLK_CNTL,
4268 .hw.init = &(struct clk_init_data){
4269 .name = "nna_core_clk_div",
4270 .ops = &clk_regmap_divider_ops,
4271 .parent_hws = (const struct clk_hw *[]) {
4272 &sm1_nna_core_clk_sel.hw
4275 .flags = CLK_SET_RATE_PARENT,
4279 static struct clk_regmap sm1_nna_core_clk = {
4280 .data = &(struct clk_regmap_gate_data){
4281 .offset = HHI_NNA_CLK_CNTL,
4284 .hw.init = &(struct clk_init_data){
4285 .name = "nna_core_clk",
4286 .ops = &clk_regmap_gate_ops,
4287 .parent_hws = (const struct clk_hw *[]) {
4288 &sm1_nna_core_clk_div.hw
4291 .flags = CLK_SET_RATE_PARENT,
4295 #define MESON_GATE(_name, _reg, _bit) \
4296 MESON_PCLK(_name, _reg, _bit, &g12a_clk81.hw)
4298 #define MESON_GATE_RO(_name, _reg, _bit) \
4299 MESON_PCLK_RO(_name, _reg, _bit, &g12a_clk81.hw)
4301 /* Everything Else (EE) domain gates */
4302 static MESON_GATE(g12a_ddr, HHI_GCLK_MPEG0, 0);
4303 static MESON_GATE(g12a_dos, HHI_GCLK_MPEG0, 1);
4304 static MESON_GATE(g12a_audio_locker, HHI_GCLK_MPEG0, 2);
4305 static MESON_GATE(g12a_mipi_dsi_host, HHI_GCLK_MPEG0, 3);
4306 static MESON_GATE(g12a_eth_phy, HHI_GCLK_MPEG0, 4);
4307 static MESON_GATE(g12a_isa, HHI_GCLK_MPEG0, 5);
4308 static MESON_GATE(g12a_pl301, HHI_GCLK_MPEG0, 6);
4309 static MESON_GATE(g12a_periphs, HHI_GCLK_MPEG0, 7);
4310 static MESON_GATE(g12a_spicc_0, HHI_GCLK_MPEG0, 8);
4311 static MESON_GATE(g12a_i2c, HHI_GCLK_MPEG0, 9);
4312 static MESON_GATE(g12a_sana, HHI_GCLK_MPEG0, 10);
4313 static MESON_GATE(g12a_sd, HHI_GCLK_MPEG0, 11);
4314 static MESON_GATE(g12a_rng0, HHI_GCLK_MPEG0, 12);
4315 static MESON_GATE(g12a_uart0, HHI_GCLK_MPEG0, 13);
4316 static MESON_GATE(g12a_spicc_1, HHI_GCLK_MPEG0, 14);
4317 static MESON_GATE(g12a_hiu_reg, HHI_GCLK_MPEG0, 19);
4318 static MESON_GATE(g12a_mipi_dsi_phy, HHI_GCLK_MPEG0, 20);
4319 static MESON_GATE(g12a_assist_misc, HHI_GCLK_MPEG0, 23);
4320 static MESON_GATE(g12a_emmc_a, HHI_GCLK_MPEG0, 4);
4321 static MESON_GATE(g12a_emmc_b, HHI_GCLK_MPEG0, 25);
4322 static MESON_GATE(g12a_emmc_c, HHI_GCLK_MPEG0, 26);
4323 static MESON_GATE(g12a_audio_codec, HHI_GCLK_MPEG0, 28);
4325 static MESON_GATE(g12a_audio, HHI_GCLK_MPEG1, 0);
4326 static MESON_GATE(g12a_eth_core, HHI_GCLK_MPEG1, 3);
4327 static MESON_GATE(g12a_demux, HHI_GCLK_MPEG1, 4);
4328 static MESON_GATE(g12a_audio_ififo, HHI_GCLK_MPEG1, 11);
4329 static MESON_GATE(g12a_adc, HHI_GCLK_MPEG1, 13);
4330 static MESON_GATE(g12a_uart1, HHI_GCLK_MPEG1, 16);
4331 static MESON_GATE(g12a_g2d, HHI_GCLK_MPEG1, 20);
4332 static MESON_GATE(g12a_reset, HHI_GCLK_MPEG1, 23);
4333 static MESON_GATE(g12a_pcie_comb, HHI_GCLK_MPEG1, 24);
4334 static MESON_GATE(g12a_parser, HHI_GCLK_MPEG1, 25);
4335 static MESON_GATE(g12a_usb_general, HHI_GCLK_MPEG1, 26);
4336 static MESON_GATE(g12a_pcie_phy, HHI_GCLK_MPEG1, 27);
4337 static MESON_GATE(g12a_ahb_arb0, HHI_GCLK_MPEG1, 29);
4339 static MESON_GATE(g12a_ahb_data_bus, HHI_GCLK_MPEG2, 1);
4340 static MESON_GATE(g12a_ahb_ctrl_bus, HHI_GCLK_MPEG2, 2);
4341 static MESON_GATE(g12a_htx_hdcp22, HHI_GCLK_MPEG2, 3);
4342 static MESON_GATE(g12a_htx_pclk, HHI_GCLK_MPEG2, 4);
4343 static MESON_GATE(g12a_bt656, HHI_GCLK_MPEG2, 6);
4344 static MESON_GATE(g12a_usb1_to_ddr, HHI_GCLK_MPEG2, 8);
4345 static MESON_GATE(g12b_mipi_isp_gate, HHI_GCLK_MPEG2, 17);
4346 static MESON_GATE(g12a_mmc_pclk, HHI_GCLK_MPEG2, 11);
4347 static MESON_GATE(g12a_uart2, HHI_GCLK_MPEG2, 15);
4348 static MESON_GATE(g12a_vpu_intr, HHI_GCLK_MPEG2, 25);
4349 static MESON_GATE(g12b_csi_phy1, HHI_GCLK_MPEG2, 28);
4350 static MESON_GATE(g12b_csi_phy0, HHI_GCLK_MPEG2, 29);
4351 static MESON_GATE(g12a_gic, HHI_GCLK_MPEG2, 30);
4353 static MESON_GATE(g12a_vclk2_venci0, HHI_GCLK_OTHER, 1);
4354 static MESON_GATE(g12a_vclk2_venci1, HHI_GCLK_OTHER, 2);
4355 static MESON_GATE(g12a_vclk2_vencp0, HHI_GCLK_OTHER, 3);
4356 static MESON_GATE(g12a_vclk2_vencp1, HHI_GCLK_OTHER, 4);
4357 static MESON_GATE(g12a_vclk2_venct0, HHI_GCLK_OTHER, 5);
4358 static MESON_GATE(g12a_vclk2_venct1, HHI_GCLK_OTHER, 6);
4359 static MESON_GATE(g12a_vclk2_other, HHI_GCLK_OTHER, 7);
4360 static MESON_GATE(g12a_vclk2_enci, HHI_GCLK_OTHER, 8);
4361 static MESON_GATE(g12a_vclk2_encp, HHI_GCLK_OTHER, 9);
4362 static MESON_GATE(g12a_dac_clk, HHI_GCLK_OTHER, 10);
4363 static MESON_GATE(g12a_aoclk_gate, HHI_GCLK_OTHER, 14);
4364 static MESON_GATE(g12a_iec958_gate, HHI_GCLK_OTHER, 16);
4365 static MESON_GATE(g12a_enc480p, HHI_GCLK_OTHER, 20);
4366 static MESON_GATE(g12a_rng1, HHI_GCLK_OTHER, 21);
4367 static MESON_GATE(g12a_vclk2_enct, HHI_GCLK_OTHER, 22);
4368 static MESON_GATE(g12a_vclk2_encl, HHI_GCLK_OTHER, 23);
4369 static MESON_GATE(g12a_vclk2_venclmmc, HHI_GCLK_OTHER, 24);
4370 static MESON_GATE(g12a_vclk2_vencl, HHI_GCLK_OTHER, 25);
4371 static MESON_GATE(g12a_vclk2_other1, HHI_GCLK_OTHER, 26);
4373 static MESON_GATE_RO(g12a_dma, HHI_GCLK_OTHER2, 0);
4374 static MESON_GATE_RO(g12a_efuse, HHI_GCLK_OTHER2, 1);
4375 static MESON_GATE_RO(g12a_rom_boot, HHI_GCLK_OTHER2, 2);
4376 static MESON_GATE_RO(g12a_reset_sec, HHI_GCLK_OTHER2, 3);
4377 static MESON_GATE_RO(g12a_sec_ahb_apb3, HHI_GCLK_OTHER2, 4);
4379 /* Array of all clocks provided by this provider */
4380 static struct clk_hw *g12a_hw_clks[] = {
4381 [CLKID_SYS_PLL] = &g12a_sys_pll.hw,
4382 [CLKID_FIXED_PLL] = &g12a_fixed_pll.hw,
4383 [CLKID_FCLK_DIV2] = &g12a_fclk_div2.hw,
4384 [CLKID_FCLK_DIV3] = &g12a_fclk_div3.hw,
4385 [CLKID_FCLK_DIV4] = &g12a_fclk_div4.hw,
4386 [CLKID_FCLK_DIV5] = &g12a_fclk_div5.hw,
4387 [CLKID_FCLK_DIV7] = &g12a_fclk_div7.hw,
4388 [CLKID_FCLK_DIV2P5] = &g12a_fclk_div2p5.hw,
4389 [CLKID_GP0_PLL] = &g12a_gp0_pll.hw,
4390 [CLKID_MPEG_SEL] = &g12a_mpeg_clk_sel.hw,
4391 [CLKID_MPEG_DIV] = &g12a_mpeg_clk_div.hw,
4392 [CLKID_CLK81] = &g12a_clk81.hw,
4393 [CLKID_MPLL0] = &g12a_mpll0.hw,
4394 [CLKID_MPLL1] = &g12a_mpll1.hw,
4395 [CLKID_MPLL2] = &g12a_mpll2.hw,
4396 [CLKID_MPLL3] = &g12a_mpll3.hw,
4397 [CLKID_DDR] = &g12a_ddr.hw,
4398 [CLKID_DOS] = &g12a_dos.hw,
4399 [CLKID_AUDIO_LOCKER] = &g12a_audio_locker.hw,
4400 [CLKID_MIPI_DSI_HOST] = &g12a_mipi_dsi_host.hw,
4401 [CLKID_ETH_PHY] = &g12a_eth_phy.hw,
4402 [CLKID_ISA] = &g12a_isa.hw,
4403 [CLKID_PL301] = &g12a_pl301.hw,
4404 [CLKID_PERIPHS] = &g12a_periphs.hw,
4405 [CLKID_SPICC0] = &g12a_spicc_0.hw,
4406 [CLKID_I2C] = &g12a_i2c.hw,
4407 [CLKID_SANA] = &g12a_sana.hw,
4408 [CLKID_SD] = &g12a_sd.hw,
4409 [CLKID_RNG0] = &g12a_rng0.hw,
4410 [CLKID_UART0] = &g12a_uart0.hw,
4411 [CLKID_SPICC1] = &g12a_spicc_1.hw,
4412 [CLKID_HIU_IFACE] = &g12a_hiu_reg.hw,
4413 [CLKID_MIPI_DSI_PHY] = &g12a_mipi_dsi_phy.hw,
4414 [CLKID_ASSIST_MISC] = &g12a_assist_misc.hw,
4415 [CLKID_SD_EMMC_A] = &g12a_emmc_a.hw,
4416 [CLKID_SD_EMMC_B] = &g12a_emmc_b.hw,
4417 [CLKID_SD_EMMC_C] = &g12a_emmc_c.hw,
4418 [CLKID_AUDIO_CODEC] = &g12a_audio_codec.hw,
4419 [CLKID_AUDIO] = &g12a_audio.hw,
4420 [CLKID_ETH] = &g12a_eth_core.hw,
4421 [CLKID_DEMUX] = &g12a_demux.hw,
4422 [CLKID_AUDIO_IFIFO] = &g12a_audio_ififo.hw,
4423 [CLKID_ADC] = &g12a_adc.hw,
4424 [CLKID_UART1] = &g12a_uart1.hw,
4425 [CLKID_G2D] = &g12a_g2d.hw,
4426 [CLKID_RESET] = &g12a_reset.hw,
4427 [CLKID_PCIE_COMB] = &g12a_pcie_comb.hw,
4428 [CLKID_PARSER] = &g12a_parser.hw,
4429 [CLKID_USB] = &g12a_usb_general.hw,
4430 [CLKID_PCIE_PHY] = &g12a_pcie_phy.hw,
4431 [CLKID_AHB_ARB0] = &g12a_ahb_arb0.hw,
4432 [CLKID_AHB_DATA_BUS] = &g12a_ahb_data_bus.hw,
4433 [CLKID_AHB_CTRL_BUS] = &g12a_ahb_ctrl_bus.hw,
4434 [CLKID_HTX_HDCP22] = &g12a_htx_hdcp22.hw,
4435 [CLKID_HTX_PCLK] = &g12a_htx_pclk.hw,
4436 [CLKID_BT656] = &g12a_bt656.hw,
4437 [CLKID_USB1_DDR_BRIDGE] = &g12a_usb1_to_ddr.hw,
4438 [CLKID_MMC_PCLK] = &g12a_mmc_pclk.hw,
4439 [CLKID_UART2] = &g12a_uart2.hw,
4440 [CLKID_VPU_INTR] = &g12a_vpu_intr.hw,
4441 [CLKID_GIC] = &g12a_gic.hw,
4442 [CLKID_SD_EMMC_A_CLK0_SEL] = &g12a_sd_emmc_a_clk0_sel.hw,
4443 [CLKID_SD_EMMC_A_CLK0_DIV] = &g12a_sd_emmc_a_clk0_div.hw,
4444 [CLKID_SD_EMMC_A_CLK0] = &g12a_sd_emmc_a_clk0.hw,
4445 [CLKID_SD_EMMC_B_CLK0_SEL] = &g12a_sd_emmc_b_clk0_sel.hw,
4446 [CLKID_SD_EMMC_B_CLK0_DIV] = &g12a_sd_emmc_b_clk0_div.hw,
4447 [CLKID_SD_EMMC_B_CLK0] = &g12a_sd_emmc_b_clk0.hw,
4448 [CLKID_SD_EMMC_C_CLK0_SEL] = &g12a_sd_emmc_c_clk0_sel.hw,
4449 [CLKID_SD_EMMC_C_CLK0_DIV] = &g12a_sd_emmc_c_clk0_div.hw,
4450 [CLKID_SD_EMMC_C_CLK0] = &g12a_sd_emmc_c_clk0.hw,
4451 [CLKID_MPLL0_DIV] = &g12a_mpll0_div.hw,
4452 [CLKID_MPLL1_DIV] = &g12a_mpll1_div.hw,
4453 [CLKID_MPLL2_DIV] = &g12a_mpll2_div.hw,
4454 [CLKID_MPLL3_DIV] = &g12a_mpll3_div.hw,
4455 [CLKID_FCLK_DIV2_DIV] = &g12a_fclk_div2_div.hw,
4456 [CLKID_FCLK_DIV3_DIV] = &g12a_fclk_div3_div.hw,
4457 [CLKID_FCLK_DIV4_DIV] = &g12a_fclk_div4_div.hw,
4458 [CLKID_FCLK_DIV5_DIV] = &g12a_fclk_div5_div.hw,
4459 [CLKID_FCLK_DIV7_DIV] = &g12a_fclk_div7_div.hw,
4460 [CLKID_FCLK_DIV2P5_DIV] = &g12a_fclk_div2p5_div.hw,
4461 [CLKID_HIFI_PLL] = &g12a_hifi_pll.hw,
4462 [CLKID_VCLK2_VENCI0] = &g12a_vclk2_venci0.hw,
4463 [CLKID_VCLK2_VENCI1] = &g12a_vclk2_venci1.hw,
4464 [CLKID_VCLK2_VENCP0] = &g12a_vclk2_vencp0.hw,
4465 [CLKID_VCLK2_VENCP1] = &g12a_vclk2_vencp1.hw,
4466 [CLKID_VCLK2_VENCT0] = &g12a_vclk2_venct0.hw,
4467 [CLKID_VCLK2_VENCT1] = &g12a_vclk2_venct1.hw,
4468 [CLKID_VCLK2_OTHER] = &g12a_vclk2_other.hw,
4469 [CLKID_VCLK2_ENCI] = &g12a_vclk2_enci.hw,
4470 [CLKID_VCLK2_ENCP] = &g12a_vclk2_encp.hw,
4471 [CLKID_DAC_CLK] = &g12a_dac_clk.hw,
4472 [CLKID_AOCLK] = &g12a_aoclk_gate.hw,
4473 [CLKID_IEC958] = &g12a_iec958_gate.hw,
4474 [CLKID_ENC480P] = &g12a_enc480p.hw,
4475 [CLKID_RNG1] = &g12a_rng1.hw,
4476 [CLKID_VCLK2_ENCT] = &g12a_vclk2_enct.hw,
4477 [CLKID_VCLK2_ENCL] = &g12a_vclk2_encl.hw,
4478 [CLKID_VCLK2_VENCLMMC] = &g12a_vclk2_venclmmc.hw,
4479 [CLKID_VCLK2_VENCL] = &g12a_vclk2_vencl.hw,
4480 [CLKID_VCLK2_OTHER1] = &g12a_vclk2_other1.hw,
4481 [CLKID_FIXED_PLL_DCO] = &g12a_fixed_pll_dco.hw,
4482 [CLKID_SYS_PLL_DCO] = &g12a_sys_pll_dco.hw,
4483 [CLKID_GP0_PLL_DCO] = &g12a_gp0_pll_dco.hw,
4484 [CLKID_HIFI_PLL_DCO] = &g12a_hifi_pll_dco.hw,
4485 [CLKID_DMA] = &g12a_dma.hw,
4486 [CLKID_EFUSE] = &g12a_efuse.hw,
4487 [CLKID_ROM_BOOT] = &g12a_rom_boot.hw,
4488 [CLKID_RESET_SEC] = &g12a_reset_sec.hw,
4489 [CLKID_SEC_AHB_APB3] = &g12a_sec_ahb_apb3.hw,
4490 [CLKID_MPLL_PREDIV] = &g12a_mpll_prediv.hw,
4491 [CLKID_VPU_0_SEL] = &g12a_vpu_0_sel.hw,
4492 [CLKID_VPU_0_DIV] = &g12a_vpu_0_div.hw,
4493 [CLKID_VPU_0] = &g12a_vpu_0.hw,
4494 [CLKID_VPU_1_SEL] = &g12a_vpu_1_sel.hw,
4495 [CLKID_VPU_1_DIV] = &g12a_vpu_1_div.hw,
4496 [CLKID_VPU_1] = &g12a_vpu_1.hw,
4497 [CLKID_VPU] = &g12a_vpu.hw,
4498 [CLKID_VAPB_0_SEL] = &g12a_vapb_0_sel.hw,
4499 [CLKID_VAPB_0_DIV] = &g12a_vapb_0_div.hw,
4500 [CLKID_VAPB_0] = &g12a_vapb_0.hw,
4501 [CLKID_VAPB_1_SEL] = &g12a_vapb_1_sel.hw,
4502 [CLKID_VAPB_1_DIV] = &g12a_vapb_1_div.hw,
4503 [CLKID_VAPB_1] = &g12a_vapb_1.hw,
4504 [CLKID_VAPB_SEL] = &g12a_vapb_sel.hw,
4505 [CLKID_VAPB] = &g12a_vapb.hw,
4506 [CLKID_HDMI_PLL_DCO] = &g12a_hdmi_pll_dco.hw,
4507 [CLKID_HDMI_PLL_OD] = &g12a_hdmi_pll_od.hw,
4508 [CLKID_HDMI_PLL_OD2] = &g12a_hdmi_pll_od2.hw,
4509 [CLKID_HDMI_PLL] = &g12a_hdmi_pll.hw,
4510 [CLKID_VID_PLL] = &g12a_vid_pll_div.hw,
4511 [CLKID_VID_PLL_SEL] = &g12a_vid_pll_sel.hw,
4512 [CLKID_VID_PLL_DIV] = &g12a_vid_pll.hw,
4513 [CLKID_VCLK_SEL] = &g12a_vclk_sel.hw,
4514 [CLKID_VCLK2_SEL] = &g12a_vclk2_sel.hw,
4515 [CLKID_VCLK_INPUT] = &g12a_vclk_input.hw,
4516 [CLKID_VCLK2_INPUT] = &g12a_vclk2_input.hw,
4517 [CLKID_VCLK_DIV] = &g12a_vclk_div.hw,
4518 [CLKID_VCLK2_DIV] = &g12a_vclk2_div.hw,
4519 [CLKID_VCLK] = &g12a_vclk.hw,
4520 [CLKID_VCLK2] = &g12a_vclk2.hw,
4521 [CLKID_VCLK_DIV1] = &g12a_vclk_div1.hw,
4522 [CLKID_VCLK_DIV2_EN] = &g12a_vclk_div2_en.hw,
4523 [CLKID_VCLK_DIV4_EN] = &g12a_vclk_div4_en.hw,
4524 [CLKID_VCLK_DIV6_EN] = &g12a_vclk_div6_en.hw,
4525 [CLKID_VCLK_DIV12_EN] = &g12a_vclk_div12_en.hw,
4526 [CLKID_VCLK2_DIV1] = &g12a_vclk2_div1.hw,
4527 [CLKID_VCLK2_DIV2_EN] = &g12a_vclk2_div2_en.hw,
4528 [CLKID_VCLK2_DIV4_EN] = &g12a_vclk2_div4_en.hw,
4529 [CLKID_VCLK2_DIV6_EN] = &g12a_vclk2_div6_en.hw,
4530 [CLKID_VCLK2_DIV12_EN] = &g12a_vclk2_div12_en.hw,
4531 [CLKID_VCLK_DIV2] = &g12a_vclk_div2.hw,
4532 [CLKID_VCLK_DIV4] = &g12a_vclk_div4.hw,
4533 [CLKID_VCLK_DIV6] = &g12a_vclk_div6.hw,
4534 [CLKID_VCLK_DIV12] = &g12a_vclk_div12.hw,
4535 [CLKID_VCLK2_DIV2] = &g12a_vclk2_div2.hw,
4536 [CLKID_VCLK2_DIV4] = &g12a_vclk2_div4.hw,
4537 [CLKID_VCLK2_DIV6] = &g12a_vclk2_div6.hw,
4538 [CLKID_VCLK2_DIV12] = &g12a_vclk2_div12.hw,
4539 [CLKID_CTS_ENCI_SEL] = &g12a_cts_enci_sel.hw,
4540 [CLKID_CTS_ENCP_SEL] = &g12a_cts_encp_sel.hw,
4541 [CLKID_CTS_ENCL_SEL] = &g12a_cts_encl_sel.hw,
4542 [CLKID_CTS_VDAC_SEL] = &g12a_cts_vdac_sel.hw,
4543 [CLKID_HDMI_TX_SEL] = &g12a_hdmi_tx_sel.hw,
4544 [CLKID_CTS_ENCI] = &g12a_cts_enci.hw,
4545 [CLKID_CTS_ENCP] = &g12a_cts_encp.hw,
4546 [CLKID_CTS_ENCL] = &g12a_cts_encl.hw,
4547 [CLKID_CTS_VDAC] = &g12a_cts_vdac.hw,
4548 [CLKID_HDMI_TX] = &g12a_hdmi_tx.hw,
4549 [CLKID_HDMI_SEL] = &g12a_hdmi_sel.hw,
4550 [CLKID_HDMI_DIV] = &g12a_hdmi_div.hw,
4551 [CLKID_HDMI] = &g12a_hdmi.hw,
4552 [CLKID_MALI_0_SEL] = &g12a_mali_0_sel.hw,
4553 [CLKID_MALI_0_DIV] = &g12a_mali_0_div.hw,
4554 [CLKID_MALI_0] = &g12a_mali_0.hw,
4555 [CLKID_MALI_1_SEL] = &g12a_mali_1_sel.hw,
4556 [CLKID_MALI_1_DIV] = &g12a_mali_1_div.hw,
4557 [CLKID_MALI_1] = &g12a_mali_1.hw,
4558 [CLKID_MALI] = &g12a_mali.hw,
4559 [CLKID_MPLL_50M_DIV] = &g12a_mpll_50m_div.hw,
4560 [CLKID_MPLL_50M] = &g12a_mpll_50m.hw,
4561 [CLKID_SYS_PLL_DIV16_EN] = &g12a_sys_pll_div16_en.hw,
4562 [CLKID_SYS_PLL_DIV16] = &g12a_sys_pll_div16.hw,
4563 [CLKID_CPU_CLK_DYN0_SEL] = &g12a_cpu_clk_premux0.hw,
4564 [CLKID_CPU_CLK_DYN0_DIV] = &g12a_cpu_clk_mux0_div.hw,
4565 [CLKID_CPU_CLK_DYN0] = &g12a_cpu_clk_postmux0.hw,
4566 [CLKID_CPU_CLK_DYN1_SEL] = &g12a_cpu_clk_premux1.hw,
4567 [CLKID_CPU_CLK_DYN1_DIV] = &g12a_cpu_clk_mux1_div.hw,
4568 [CLKID_CPU_CLK_DYN1] = &g12a_cpu_clk_postmux1.hw,
4569 [CLKID_CPU_CLK_DYN] = &g12a_cpu_clk_dyn.hw,
4570 [CLKID_CPU_CLK] = &g12a_cpu_clk.hw,
4571 [CLKID_CPU_CLK_DIV16_EN] = &g12a_cpu_clk_div16_en.hw,
4572 [CLKID_CPU_CLK_DIV16] = &g12a_cpu_clk_div16.hw,
4573 [CLKID_CPU_CLK_APB_DIV] = &g12a_cpu_clk_apb_div.hw,
4574 [CLKID_CPU_CLK_APB] = &g12a_cpu_clk_apb.hw,
4575 [CLKID_CPU_CLK_ATB_DIV] = &g12a_cpu_clk_atb_div.hw,
4576 [CLKID_CPU_CLK_ATB] = &g12a_cpu_clk_atb.hw,
4577 [CLKID_CPU_CLK_AXI_DIV] = &g12a_cpu_clk_axi_div.hw,
4578 [CLKID_CPU_CLK_AXI] = &g12a_cpu_clk_axi.hw,
4579 [CLKID_CPU_CLK_TRACE_DIV] = &g12a_cpu_clk_trace_div.hw,
4580 [CLKID_CPU_CLK_TRACE] = &g12a_cpu_clk_trace.hw,
4581 [CLKID_PCIE_PLL_DCO] = &g12a_pcie_pll_dco.hw,
4582 [CLKID_PCIE_PLL_DCO_DIV2] = &g12a_pcie_pll_dco_div2.hw,
4583 [CLKID_PCIE_PLL_OD] = &g12a_pcie_pll_od.hw,
4584 [CLKID_PCIE_PLL] = &g12a_pcie_pll.hw,
4585 [CLKID_VDEC_1_SEL] = &g12a_vdec_1_sel.hw,
4586 [CLKID_VDEC_1_DIV] = &g12a_vdec_1_div.hw,
4587 [CLKID_VDEC_1] = &g12a_vdec_1.hw,
4588 [CLKID_VDEC_HEVC_SEL] = &g12a_vdec_hevc_sel.hw,
4589 [CLKID_VDEC_HEVC_DIV] = &g12a_vdec_hevc_div.hw,
4590 [CLKID_VDEC_HEVC] = &g12a_vdec_hevc.hw,
4591 [CLKID_VDEC_HEVCF_SEL] = &g12a_vdec_hevcf_sel.hw,
4592 [CLKID_VDEC_HEVCF_DIV] = &g12a_vdec_hevcf_div.hw,
4593 [CLKID_VDEC_HEVCF] = &g12a_vdec_hevcf.hw,
4594 [CLKID_TS_DIV] = &g12a_ts_div.hw,
4595 [CLKID_TS] = &g12a_ts.hw,
4596 [CLKID_SPICC0_SCLK_SEL] = &g12a_spicc0_sclk_sel.hw,
4597 [CLKID_SPICC0_SCLK_DIV] = &g12a_spicc0_sclk_div.hw,
4598 [CLKID_SPICC0_SCLK] = &g12a_spicc0_sclk.hw,
4599 [CLKID_SPICC1_SCLK_SEL] = &g12a_spicc1_sclk_sel.hw,
4600 [CLKID_SPICC1_SCLK_DIV] = &g12a_spicc1_sclk_div.hw,
4601 [CLKID_SPICC1_SCLK] = &g12a_spicc1_sclk.hw,
4602 [CLKID_MIPI_DSI_PXCLK_SEL] = &g12a_mipi_dsi_pxclk_sel.hw,
4603 [CLKID_MIPI_DSI_PXCLK_DIV] = &g12a_mipi_dsi_pxclk_div.hw,
4604 [CLKID_MIPI_DSI_PXCLK] = &g12a_mipi_dsi_pxclk.hw,
4607 static struct clk_hw *g12b_hw_clks[] = {
4608 [CLKID_SYS_PLL] = &g12a_sys_pll.hw,
4609 [CLKID_FIXED_PLL] = &g12a_fixed_pll.hw,
4610 [CLKID_FCLK_DIV2] = &g12a_fclk_div2.hw,
4611 [CLKID_FCLK_DIV3] = &g12a_fclk_div3.hw,
4612 [CLKID_FCLK_DIV4] = &g12a_fclk_div4.hw,
4613 [CLKID_FCLK_DIV5] = &g12a_fclk_div5.hw,
4614 [CLKID_FCLK_DIV7] = &g12a_fclk_div7.hw,
4615 [CLKID_FCLK_DIV2P5] = &g12a_fclk_div2p5.hw,
4616 [CLKID_GP0_PLL] = &g12a_gp0_pll.hw,
4617 [CLKID_MPEG_SEL] = &g12a_mpeg_clk_sel.hw,
4618 [CLKID_MPEG_DIV] = &g12a_mpeg_clk_div.hw,
4619 [CLKID_CLK81] = &g12a_clk81.hw,
4620 [CLKID_MPLL0] = &g12a_mpll0.hw,
4621 [CLKID_MPLL1] = &g12a_mpll1.hw,
4622 [CLKID_MPLL2] = &g12a_mpll2.hw,
4623 [CLKID_MPLL3] = &g12a_mpll3.hw,
4624 [CLKID_DDR] = &g12a_ddr.hw,
4625 [CLKID_DOS] = &g12a_dos.hw,
4626 [CLKID_AUDIO_LOCKER] = &g12a_audio_locker.hw,
4627 [CLKID_MIPI_DSI_HOST] = &g12a_mipi_dsi_host.hw,
4628 [CLKID_ETH_PHY] = &g12a_eth_phy.hw,
4629 [CLKID_ISA] = &g12a_isa.hw,
4630 [CLKID_PL301] = &g12a_pl301.hw,
4631 [CLKID_PERIPHS] = &g12a_periphs.hw,
4632 [CLKID_SPICC0] = &g12a_spicc_0.hw,
4633 [CLKID_I2C] = &g12a_i2c.hw,
4634 [CLKID_SANA] = &g12a_sana.hw,
4635 [CLKID_SD] = &g12a_sd.hw,
4636 [CLKID_RNG0] = &g12a_rng0.hw,
4637 [CLKID_UART0] = &g12a_uart0.hw,
4638 [CLKID_SPICC1] = &g12a_spicc_1.hw,
4639 [CLKID_HIU_IFACE] = &g12a_hiu_reg.hw,
4640 [CLKID_MIPI_DSI_PHY] = &g12a_mipi_dsi_phy.hw,
4641 [CLKID_ASSIST_MISC] = &g12a_assist_misc.hw,
4642 [CLKID_SD_EMMC_A] = &g12a_emmc_a.hw,
4643 [CLKID_SD_EMMC_B] = &g12a_emmc_b.hw,
4644 [CLKID_SD_EMMC_C] = &g12a_emmc_c.hw,
4645 [CLKID_AUDIO_CODEC] = &g12a_audio_codec.hw,
4646 [CLKID_AUDIO] = &g12a_audio.hw,
4647 [CLKID_ETH] = &g12a_eth_core.hw,
4648 [CLKID_DEMUX] = &g12a_demux.hw,
4649 [CLKID_AUDIO_IFIFO] = &g12a_audio_ififo.hw,
4650 [CLKID_ADC] = &g12a_adc.hw,
4651 [CLKID_UART1] = &g12a_uart1.hw,
4652 [CLKID_G2D] = &g12a_g2d.hw,
4653 [CLKID_RESET] = &g12a_reset.hw,
4654 [CLKID_PCIE_COMB] = &g12a_pcie_comb.hw,
4655 [CLKID_PARSER] = &g12a_parser.hw,
4656 [CLKID_USB] = &g12a_usb_general.hw,
4657 [CLKID_PCIE_PHY] = &g12a_pcie_phy.hw,
4658 [CLKID_AHB_ARB0] = &g12a_ahb_arb0.hw,
4659 [CLKID_AHB_DATA_BUS] = &g12a_ahb_data_bus.hw,
4660 [CLKID_AHB_CTRL_BUS] = &g12a_ahb_ctrl_bus.hw,
4661 [CLKID_HTX_HDCP22] = &g12a_htx_hdcp22.hw,
4662 [CLKID_HTX_PCLK] = &g12a_htx_pclk.hw,
4663 [CLKID_BT656] = &g12a_bt656.hw,
4664 [CLKID_USB1_DDR_BRIDGE] = &g12a_usb1_to_ddr.hw,
4665 [CLKID_MMC_PCLK] = &g12a_mmc_pclk.hw,
4666 [CLKID_UART2] = &g12a_uart2.hw,
4667 [CLKID_VPU_INTR] = &g12a_vpu_intr.hw,
4668 [CLKID_GIC] = &g12a_gic.hw,
4669 [CLKID_SD_EMMC_A_CLK0_SEL] = &g12a_sd_emmc_a_clk0_sel.hw,
4670 [CLKID_SD_EMMC_A_CLK0_DIV] = &g12a_sd_emmc_a_clk0_div.hw,
4671 [CLKID_SD_EMMC_A_CLK0] = &g12a_sd_emmc_a_clk0.hw,
4672 [CLKID_SD_EMMC_B_CLK0_SEL] = &g12a_sd_emmc_b_clk0_sel.hw,
4673 [CLKID_SD_EMMC_B_CLK0_DIV] = &g12a_sd_emmc_b_clk0_div.hw,
4674 [CLKID_SD_EMMC_B_CLK0] = &g12a_sd_emmc_b_clk0.hw,
4675 [CLKID_SD_EMMC_C_CLK0_SEL] = &g12a_sd_emmc_c_clk0_sel.hw,
4676 [CLKID_SD_EMMC_C_CLK0_DIV] = &g12a_sd_emmc_c_clk0_div.hw,
4677 [CLKID_SD_EMMC_C_CLK0] = &g12a_sd_emmc_c_clk0.hw,
4678 [CLKID_MPLL0_DIV] = &g12a_mpll0_div.hw,
4679 [CLKID_MPLL1_DIV] = &g12a_mpll1_div.hw,
4680 [CLKID_MPLL2_DIV] = &g12a_mpll2_div.hw,
4681 [CLKID_MPLL3_DIV] = &g12a_mpll3_div.hw,
4682 [CLKID_FCLK_DIV2_DIV] = &g12a_fclk_div2_div.hw,
4683 [CLKID_FCLK_DIV3_DIV] = &g12a_fclk_div3_div.hw,
4684 [CLKID_FCLK_DIV4_DIV] = &g12a_fclk_div4_div.hw,
4685 [CLKID_FCLK_DIV5_DIV] = &g12a_fclk_div5_div.hw,
4686 [CLKID_FCLK_DIV7_DIV] = &g12a_fclk_div7_div.hw,
4687 [CLKID_FCLK_DIV2P5_DIV] = &g12a_fclk_div2p5_div.hw,
4688 [CLKID_HIFI_PLL] = &g12a_hifi_pll.hw,
4689 [CLKID_VCLK2_VENCI0] = &g12a_vclk2_venci0.hw,
4690 [CLKID_VCLK2_VENCI1] = &g12a_vclk2_venci1.hw,
4691 [CLKID_VCLK2_VENCP0] = &g12a_vclk2_vencp0.hw,
4692 [CLKID_VCLK2_VENCP1] = &g12a_vclk2_vencp1.hw,
4693 [CLKID_VCLK2_VENCT0] = &g12a_vclk2_venct0.hw,
4694 [CLKID_VCLK2_VENCT1] = &g12a_vclk2_venct1.hw,
4695 [CLKID_VCLK2_OTHER] = &g12a_vclk2_other.hw,
4696 [CLKID_VCLK2_ENCI] = &g12a_vclk2_enci.hw,
4697 [CLKID_VCLK2_ENCP] = &g12a_vclk2_encp.hw,
4698 [CLKID_DAC_CLK] = &g12a_dac_clk.hw,
4699 [CLKID_AOCLK] = &g12a_aoclk_gate.hw,
4700 [CLKID_IEC958] = &g12a_iec958_gate.hw,
4701 [CLKID_ENC480P] = &g12a_enc480p.hw,
4702 [CLKID_RNG1] = &g12a_rng1.hw,
4703 [CLKID_VCLK2_ENCT] = &g12a_vclk2_enct.hw,
4704 [CLKID_VCLK2_ENCL] = &g12a_vclk2_encl.hw,
4705 [CLKID_VCLK2_VENCLMMC] = &g12a_vclk2_venclmmc.hw,
4706 [CLKID_VCLK2_VENCL] = &g12a_vclk2_vencl.hw,
4707 [CLKID_VCLK2_OTHER1] = &g12a_vclk2_other1.hw,
4708 [CLKID_FIXED_PLL_DCO] = &g12a_fixed_pll_dco.hw,
4709 [CLKID_SYS_PLL_DCO] = &g12a_sys_pll_dco.hw,
4710 [CLKID_GP0_PLL_DCO] = &g12a_gp0_pll_dco.hw,
4711 [CLKID_HIFI_PLL_DCO] = &g12a_hifi_pll_dco.hw,
4712 [CLKID_DMA] = &g12a_dma.hw,
4713 [CLKID_EFUSE] = &g12a_efuse.hw,
4714 [CLKID_ROM_BOOT] = &g12a_rom_boot.hw,
4715 [CLKID_RESET_SEC] = &g12a_reset_sec.hw,
4716 [CLKID_SEC_AHB_APB3] = &g12a_sec_ahb_apb3.hw,
4717 [CLKID_MPLL_PREDIV] = &g12a_mpll_prediv.hw,
4718 [CLKID_VPU_0_SEL] = &g12a_vpu_0_sel.hw,
4719 [CLKID_VPU_0_DIV] = &g12a_vpu_0_div.hw,
4720 [CLKID_VPU_0] = &g12a_vpu_0.hw,
4721 [CLKID_VPU_1_SEL] = &g12a_vpu_1_sel.hw,
4722 [CLKID_VPU_1_DIV] = &g12a_vpu_1_div.hw,
4723 [CLKID_VPU_1] = &g12a_vpu_1.hw,
4724 [CLKID_VPU] = &g12a_vpu.hw,
4725 [CLKID_VAPB_0_SEL] = &g12a_vapb_0_sel.hw,
4726 [CLKID_VAPB_0_DIV] = &g12a_vapb_0_div.hw,
4727 [CLKID_VAPB_0] = &g12a_vapb_0.hw,
4728 [CLKID_VAPB_1_SEL] = &g12a_vapb_1_sel.hw,
4729 [CLKID_VAPB_1_DIV] = &g12a_vapb_1_div.hw,
4730 [CLKID_VAPB_1] = &g12a_vapb_1.hw,
4731 [CLKID_VAPB_SEL] = &g12a_vapb_sel.hw,
4732 [CLKID_VAPB] = &g12a_vapb.hw,
4733 [CLKID_HDMI_PLL_DCO] = &g12a_hdmi_pll_dco.hw,
4734 [CLKID_HDMI_PLL_OD] = &g12a_hdmi_pll_od.hw,
4735 [CLKID_HDMI_PLL_OD2] = &g12a_hdmi_pll_od2.hw,
4736 [CLKID_HDMI_PLL] = &g12a_hdmi_pll.hw,
4737 [CLKID_VID_PLL] = &g12a_vid_pll_div.hw,
4738 [CLKID_VID_PLL_SEL] = &g12a_vid_pll_sel.hw,
4739 [CLKID_VID_PLL_DIV] = &g12a_vid_pll.hw,
4740 [CLKID_VCLK_SEL] = &g12a_vclk_sel.hw,
4741 [CLKID_VCLK2_SEL] = &g12a_vclk2_sel.hw,
4742 [CLKID_VCLK_INPUT] = &g12a_vclk_input.hw,
4743 [CLKID_VCLK2_INPUT] = &g12a_vclk2_input.hw,
4744 [CLKID_VCLK_DIV] = &g12a_vclk_div.hw,
4745 [CLKID_VCLK2_DIV] = &g12a_vclk2_div.hw,
4746 [CLKID_VCLK] = &g12a_vclk.hw,
4747 [CLKID_VCLK2] = &g12a_vclk2.hw,
4748 [CLKID_VCLK_DIV1] = &g12a_vclk_div1.hw,
4749 [CLKID_VCLK_DIV2_EN] = &g12a_vclk_div2_en.hw,
4750 [CLKID_VCLK_DIV4_EN] = &g12a_vclk_div4_en.hw,
4751 [CLKID_VCLK_DIV6_EN] = &g12a_vclk_div6_en.hw,
4752 [CLKID_VCLK_DIV12_EN] = &g12a_vclk_div12_en.hw,
4753 [CLKID_VCLK2_DIV1] = &g12a_vclk2_div1.hw,
4754 [CLKID_VCLK2_DIV2_EN] = &g12a_vclk2_div2_en.hw,
4755 [CLKID_VCLK2_DIV4_EN] = &g12a_vclk2_div4_en.hw,
4756 [CLKID_VCLK2_DIV6_EN] = &g12a_vclk2_div6_en.hw,
4757 [CLKID_VCLK2_DIV12_EN] = &g12a_vclk2_div12_en.hw,
4758 [CLKID_VCLK_DIV2] = &g12a_vclk_div2.hw,
4759 [CLKID_VCLK_DIV4] = &g12a_vclk_div4.hw,
4760 [CLKID_VCLK_DIV6] = &g12a_vclk_div6.hw,
4761 [CLKID_VCLK_DIV12] = &g12a_vclk_div12.hw,
4762 [CLKID_VCLK2_DIV2] = &g12a_vclk2_div2.hw,
4763 [CLKID_VCLK2_DIV4] = &g12a_vclk2_div4.hw,
4764 [CLKID_VCLK2_DIV6] = &g12a_vclk2_div6.hw,
4765 [CLKID_VCLK2_DIV12] = &g12a_vclk2_div12.hw,
4766 [CLKID_CTS_ENCI_SEL] = &g12a_cts_enci_sel.hw,
4767 [CLKID_CTS_ENCP_SEL] = &g12a_cts_encp_sel.hw,
4768 [CLKID_CTS_ENCL_SEL] = &g12a_cts_encl_sel.hw,
4769 [CLKID_CTS_VDAC_SEL] = &g12a_cts_vdac_sel.hw,
4770 [CLKID_HDMI_TX_SEL] = &g12a_hdmi_tx_sel.hw,
4771 [CLKID_CTS_ENCI] = &g12a_cts_enci.hw,
4772 [CLKID_CTS_ENCP] = &g12a_cts_encp.hw,
4773 [CLKID_CTS_ENCL] = &g12a_cts_encl.hw,
4774 [CLKID_CTS_VDAC] = &g12a_cts_vdac.hw,
4775 [CLKID_HDMI_TX] = &g12a_hdmi_tx.hw,
4776 [CLKID_HDMI_SEL] = &g12a_hdmi_sel.hw,
4777 [CLKID_HDMI_DIV] = &g12a_hdmi_div.hw,
4778 [CLKID_HDMI] = &g12a_hdmi.hw,
4779 [CLKID_MALI_0_SEL] = &g12a_mali_0_sel.hw,
4780 [CLKID_MALI_0_DIV] = &g12a_mali_0_div.hw,
4781 [CLKID_MALI_0] = &g12a_mali_0.hw,
4782 [CLKID_MALI_1_SEL] = &g12a_mali_1_sel.hw,
4783 [CLKID_MALI_1_DIV] = &g12a_mali_1_div.hw,
4784 [CLKID_MALI_1] = &g12a_mali_1.hw,
4785 [CLKID_MALI] = &g12a_mali.hw,
4786 [CLKID_MPLL_50M_DIV] = &g12a_mpll_50m_div.hw,
4787 [CLKID_MPLL_50M] = &g12a_mpll_50m.hw,
4788 [CLKID_SYS_PLL_DIV16_EN] = &g12a_sys_pll_div16_en.hw,
4789 [CLKID_SYS_PLL_DIV16] = &g12a_sys_pll_div16.hw,
4790 [CLKID_CPU_CLK_DYN0_SEL] = &g12a_cpu_clk_premux0.hw,
4791 [CLKID_CPU_CLK_DYN0_DIV] = &g12a_cpu_clk_mux0_div.hw,
4792 [CLKID_CPU_CLK_DYN0] = &g12a_cpu_clk_postmux0.hw,
4793 [CLKID_CPU_CLK_DYN1_SEL] = &g12a_cpu_clk_premux1.hw,
4794 [CLKID_CPU_CLK_DYN1_DIV] = &g12a_cpu_clk_mux1_div.hw,
4795 [CLKID_CPU_CLK_DYN1] = &g12a_cpu_clk_postmux1.hw,
4796 [CLKID_CPU_CLK_DYN] = &g12a_cpu_clk_dyn.hw,
4797 [CLKID_CPU_CLK] = &g12b_cpu_clk.hw,
4798 [CLKID_CPU_CLK_DIV16_EN] = &g12a_cpu_clk_div16_en.hw,
4799 [CLKID_CPU_CLK_DIV16] = &g12a_cpu_clk_div16.hw,
4800 [CLKID_CPU_CLK_APB_DIV] = &g12a_cpu_clk_apb_div.hw,
4801 [CLKID_CPU_CLK_APB] = &g12a_cpu_clk_apb.hw,
4802 [CLKID_CPU_CLK_ATB_DIV] = &g12a_cpu_clk_atb_div.hw,
4803 [CLKID_CPU_CLK_ATB] = &g12a_cpu_clk_atb.hw,
4804 [CLKID_CPU_CLK_AXI_DIV] = &g12a_cpu_clk_axi_div.hw,
4805 [CLKID_CPU_CLK_AXI] = &g12a_cpu_clk_axi.hw,
4806 [CLKID_CPU_CLK_TRACE_DIV] = &g12a_cpu_clk_trace_div.hw,
4807 [CLKID_CPU_CLK_TRACE] = &g12a_cpu_clk_trace.hw,
4808 [CLKID_PCIE_PLL_DCO] = &g12a_pcie_pll_dco.hw,
4809 [CLKID_PCIE_PLL_DCO_DIV2] = &g12a_pcie_pll_dco_div2.hw,
4810 [CLKID_PCIE_PLL_OD] = &g12a_pcie_pll_od.hw,
4811 [CLKID_PCIE_PLL] = &g12a_pcie_pll.hw,
4812 [CLKID_VDEC_1_SEL] = &g12a_vdec_1_sel.hw,
4813 [CLKID_VDEC_1_DIV] = &g12a_vdec_1_div.hw,
4814 [CLKID_VDEC_1] = &g12a_vdec_1.hw,
4815 [CLKID_VDEC_HEVC_SEL] = &g12a_vdec_hevc_sel.hw,
4816 [CLKID_VDEC_HEVC_DIV] = &g12a_vdec_hevc_div.hw,
4817 [CLKID_VDEC_HEVC] = &g12a_vdec_hevc.hw,
4818 [CLKID_VDEC_HEVCF_SEL] = &g12a_vdec_hevcf_sel.hw,
4819 [CLKID_VDEC_HEVCF_DIV] = &g12a_vdec_hevcf_div.hw,
4820 [CLKID_VDEC_HEVCF] = &g12a_vdec_hevcf.hw,
4821 [CLKID_TS_DIV] = &g12a_ts_div.hw,
4822 [CLKID_TS] = &g12a_ts.hw,
4823 [CLKID_SYS1_PLL_DCO] = &g12b_sys1_pll_dco.hw,
4824 [CLKID_SYS1_PLL] = &g12b_sys1_pll.hw,
4825 [CLKID_SYS1_PLL_DIV16_EN] = &g12b_sys1_pll_div16_en.hw,
4826 [CLKID_SYS1_PLL_DIV16] = &g12b_sys1_pll_div16.hw,
4827 [CLKID_CPUB_CLK_DYN0_SEL] = &g12b_cpub_clk_premux0.hw,
4828 [CLKID_CPUB_CLK_DYN0_DIV] = &g12b_cpub_clk_mux0_div.hw,
4829 [CLKID_CPUB_CLK_DYN0] = &g12b_cpub_clk_postmux0.hw,
4830 [CLKID_CPUB_CLK_DYN1_SEL] = &g12b_cpub_clk_premux1.hw,
4831 [CLKID_CPUB_CLK_DYN1_DIV] = &g12b_cpub_clk_mux1_div.hw,
4832 [CLKID_CPUB_CLK_DYN1] = &g12b_cpub_clk_postmux1.hw,
4833 [CLKID_CPUB_CLK_DYN] = &g12b_cpub_clk_dyn.hw,
4834 [CLKID_CPUB_CLK] = &g12b_cpub_clk.hw,
4835 [CLKID_CPUB_CLK_DIV16_EN] = &g12b_cpub_clk_div16_en.hw,
4836 [CLKID_CPUB_CLK_DIV16] = &g12b_cpub_clk_div16.hw,
4837 [CLKID_CPUB_CLK_DIV2] = &g12b_cpub_clk_div2.hw,
4838 [CLKID_CPUB_CLK_DIV3] = &g12b_cpub_clk_div3.hw,
4839 [CLKID_CPUB_CLK_DIV4] = &g12b_cpub_clk_div4.hw,
4840 [CLKID_CPUB_CLK_DIV5] = &g12b_cpub_clk_div5.hw,
4841 [CLKID_CPUB_CLK_DIV6] = &g12b_cpub_clk_div6.hw,
4842 [CLKID_CPUB_CLK_DIV7] = &g12b_cpub_clk_div7.hw,
4843 [CLKID_CPUB_CLK_DIV8] = &g12b_cpub_clk_div8.hw,
4844 [CLKID_CPUB_CLK_APB_SEL] = &g12b_cpub_clk_apb_sel.hw,
4845 [CLKID_CPUB_CLK_APB] = &g12b_cpub_clk_apb.hw,
4846 [CLKID_CPUB_CLK_ATB_SEL] = &g12b_cpub_clk_atb_sel.hw,
4847 [CLKID_CPUB_CLK_ATB] = &g12b_cpub_clk_atb.hw,
4848 [CLKID_CPUB_CLK_AXI_SEL] = &g12b_cpub_clk_axi_sel.hw,
4849 [CLKID_CPUB_CLK_AXI] = &g12b_cpub_clk_axi.hw,
4850 [CLKID_CPUB_CLK_TRACE_SEL] = &g12b_cpub_clk_trace_sel.hw,
4851 [CLKID_CPUB_CLK_TRACE] = &g12b_cpub_clk_trace.hw,
4852 [CLKID_SPICC0_SCLK_SEL] = &g12a_spicc0_sclk_sel.hw,
4853 [CLKID_SPICC0_SCLK_DIV] = &g12a_spicc0_sclk_div.hw,
4854 [CLKID_SPICC0_SCLK] = &g12a_spicc0_sclk.hw,
4855 [CLKID_SPICC1_SCLK_SEL] = &g12a_spicc1_sclk_sel.hw,
4856 [CLKID_SPICC1_SCLK_DIV] = &g12a_spicc1_sclk_div.hw,
4857 [CLKID_SPICC1_SCLK] = &g12a_spicc1_sclk.hw,
4858 [CLKID_NNA_AXI_CLK_SEL] = &sm1_nna_axi_clk_sel.hw,
4859 [CLKID_NNA_AXI_CLK_DIV] = &sm1_nna_axi_clk_div.hw,
4860 [CLKID_NNA_AXI_CLK] = &sm1_nna_axi_clk.hw,
4861 [CLKID_NNA_CORE_CLK_SEL] = &sm1_nna_core_clk_sel.hw,
4862 [CLKID_NNA_CORE_CLK_DIV] = &sm1_nna_core_clk_div.hw,
4863 [CLKID_NNA_CORE_CLK] = &sm1_nna_core_clk.hw,
4864 [CLKID_MIPI_DSI_PXCLK_SEL] = &g12a_mipi_dsi_pxclk_sel.hw,
4865 [CLKID_MIPI_DSI_PXCLK_DIV] = &g12a_mipi_dsi_pxclk_div.hw,
4866 [CLKID_MIPI_DSI_PXCLK] = &g12a_mipi_dsi_pxclk.hw,
4867 [CLKID_MIPI_ISP_SEL] = &g12b_mipi_isp_sel.hw,
4868 [CLKID_MIPI_ISP_DIV] = &g12b_mipi_isp_div.hw,
4869 [CLKID_MIPI_ISP] = &g12b_mipi_isp.hw,
4870 [CLKID_MIPI_ISP_GATE] = &g12b_mipi_isp_gate.hw,
4871 [CLKID_MIPI_ISP_CSI_PHY0] = &g12b_csi_phy0.hw,
4872 [CLKID_MIPI_ISP_CSI_PHY1] = &g12b_csi_phy1.hw,
4875 static struct clk_hw *sm1_hw_clks[] = {
4876 [CLKID_SYS_PLL] = &g12a_sys_pll.hw,
4877 [CLKID_FIXED_PLL] = &g12a_fixed_pll.hw,
4878 [CLKID_FCLK_DIV2] = &g12a_fclk_div2.hw,
4879 [CLKID_FCLK_DIV3] = &g12a_fclk_div3.hw,
4880 [CLKID_FCLK_DIV4] = &g12a_fclk_div4.hw,
4881 [CLKID_FCLK_DIV5] = &g12a_fclk_div5.hw,
4882 [CLKID_FCLK_DIV7] = &g12a_fclk_div7.hw,
4883 [CLKID_FCLK_DIV2P5] = &g12a_fclk_div2p5.hw,
4884 [CLKID_GP0_PLL] = &g12a_gp0_pll.hw,
4885 [CLKID_MPEG_SEL] = &g12a_mpeg_clk_sel.hw,
4886 [CLKID_MPEG_DIV] = &g12a_mpeg_clk_div.hw,
4887 [CLKID_CLK81] = &g12a_clk81.hw,
4888 [CLKID_MPLL0] = &g12a_mpll0.hw,
4889 [CLKID_MPLL1] = &g12a_mpll1.hw,
4890 [CLKID_MPLL2] = &g12a_mpll2.hw,
4891 [CLKID_MPLL3] = &g12a_mpll3.hw,
4892 [CLKID_DDR] = &g12a_ddr.hw,
4893 [CLKID_DOS] = &g12a_dos.hw,
4894 [CLKID_AUDIO_LOCKER] = &g12a_audio_locker.hw,
4895 [CLKID_MIPI_DSI_HOST] = &g12a_mipi_dsi_host.hw,
4896 [CLKID_ETH_PHY] = &g12a_eth_phy.hw,
4897 [CLKID_ISA] = &g12a_isa.hw,
4898 [CLKID_PL301] = &g12a_pl301.hw,
4899 [CLKID_PERIPHS] = &g12a_periphs.hw,
4900 [CLKID_SPICC0] = &g12a_spicc_0.hw,
4901 [CLKID_I2C] = &g12a_i2c.hw,
4902 [CLKID_SANA] = &g12a_sana.hw,
4903 [CLKID_SD] = &g12a_sd.hw,
4904 [CLKID_RNG0] = &g12a_rng0.hw,
4905 [CLKID_UART0] = &g12a_uart0.hw,
4906 [CLKID_SPICC1] = &g12a_spicc_1.hw,
4907 [CLKID_HIU_IFACE] = &g12a_hiu_reg.hw,
4908 [CLKID_MIPI_DSI_PHY] = &g12a_mipi_dsi_phy.hw,
4909 [CLKID_ASSIST_MISC] = &g12a_assist_misc.hw,
4910 [CLKID_SD_EMMC_A] = &g12a_emmc_a.hw,
4911 [CLKID_SD_EMMC_B] = &g12a_emmc_b.hw,
4912 [CLKID_SD_EMMC_C] = &g12a_emmc_c.hw,
4913 [CLKID_AUDIO_CODEC] = &g12a_audio_codec.hw,
4914 [CLKID_AUDIO] = &g12a_audio.hw,
4915 [CLKID_ETH] = &g12a_eth_core.hw,
4916 [CLKID_DEMUX] = &g12a_demux.hw,
4917 [CLKID_AUDIO_IFIFO] = &g12a_audio_ififo.hw,
4918 [CLKID_ADC] = &g12a_adc.hw,
4919 [CLKID_UART1] = &g12a_uart1.hw,
4920 [CLKID_G2D] = &g12a_g2d.hw,
4921 [CLKID_RESET] = &g12a_reset.hw,
4922 [CLKID_PCIE_COMB] = &g12a_pcie_comb.hw,
4923 [CLKID_PARSER] = &g12a_parser.hw,
4924 [CLKID_USB] = &g12a_usb_general.hw,
4925 [CLKID_PCIE_PHY] = &g12a_pcie_phy.hw,
4926 [CLKID_AHB_ARB0] = &g12a_ahb_arb0.hw,
4927 [CLKID_AHB_DATA_BUS] = &g12a_ahb_data_bus.hw,
4928 [CLKID_AHB_CTRL_BUS] = &g12a_ahb_ctrl_bus.hw,
4929 [CLKID_HTX_HDCP22] = &g12a_htx_hdcp22.hw,
4930 [CLKID_HTX_PCLK] = &g12a_htx_pclk.hw,
4931 [CLKID_BT656] = &g12a_bt656.hw,
4932 [CLKID_USB1_DDR_BRIDGE] = &g12a_usb1_to_ddr.hw,
4933 [CLKID_MMC_PCLK] = &g12a_mmc_pclk.hw,
4934 [CLKID_UART2] = &g12a_uart2.hw,
4935 [CLKID_VPU_INTR] = &g12a_vpu_intr.hw,
4936 [CLKID_GIC] = &g12a_gic.hw,
4937 [CLKID_SD_EMMC_A_CLK0_SEL] = &g12a_sd_emmc_a_clk0_sel.hw,
4938 [CLKID_SD_EMMC_A_CLK0_DIV] = &g12a_sd_emmc_a_clk0_div.hw,
4939 [CLKID_SD_EMMC_A_CLK0] = &g12a_sd_emmc_a_clk0.hw,
4940 [CLKID_SD_EMMC_B_CLK0_SEL] = &g12a_sd_emmc_b_clk0_sel.hw,
4941 [CLKID_SD_EMMC_B_CLK0_DIV] = &g12a_sd_emmc_b_clk0_div.hw,
4942 [CLKID_SD_EMMC_B_CLK0] = &g12a_sd_emmc_b_clk0.hw,
4943 [CLKID_SD_EMMC_C_CLK0_SEL] = &g12a_sd_emmc_c_clk0_sel.hw,
4944 [CLKID_SD_EMMC_C_CLK0_DIV] = &g12a_sd_emmc_c_clk0_div.hw,
4945 [CLKID_SD_EMMC_C_CLK0] = &g12a_sd_emmc_c_clk0.hw,
4946 [CLKID_MPLL0_DIV] = &g12a_mpll0_div.hw,
4947 [CLKID_MPLL1_DIV] = &g12a_mpll1_div.hw,
4948 [CLKID_MPLL2_DIV] = &g12a_mpll2_div.hw,
4949 [CLKID_MPLL3_DIV] = &g12a_mpll3_div.hw,
4950 [CLKID_FCLK_DIV2_DIV] = &g12a_fclk_div2_div.hw,
4951 [CLKID_FCLK_DIV3_DIV] = &g12a_fclk_div3_div.hw,
4952 [CLKID_FCLK_DIV4_DIV] = &g12a_fclk_div4_div.hw,
4953 [CLKID_FCLK_DIV5_DIV] = &g12a_fclk_div5_div.hw,
4954 [CLKID_FCLK_DIV7_DIV] = &g12a_fclk_div7_div.hw,
4955 [CLKID_FCLK_DIV2P5_DIV] = &g12a_fclk_div2p5_div.hw,
4956 [CLKID_HIFI_PLL] = &g12a_hifi_pll.hw,
4957 [CLKID_VCLK2_VENCI0] = &g12a_vclk2_venci0.hw,
4958 [CLKID_VCLK2_VENCI1] = &g12a_vclk2_venci1.hw,
4959 [CLKID_VCLK2_VENCP0] = &g12a_vclk2_vencp0.hw,
4960 [CLKID_VCLK2_VENCP1] = &g12a_vclk2_vencp1.hw,
4961 [CLKID_VCLK2_VENCT0] = &g12a_vclk2_venct0.hw,
4962 [CLKID_VCLK2_VENCT1] = &g12a_vclk2_venct1.hw,
4963 [CLKID_VCLK2_OTHER] = &g12a_vclk2_other.hw,
4964 [CLKID_VCLK2_ENCI] = &g12a_vclk2_enci.hw,
4965 [CLKID_VCLK2_ENCP] = &g12a_vclk2_encp.hw,
4966 [CLKID_DAC_CLK] = &g12a_dac_clk.hw,
4967 [CLKID_AOCLK] = &g12a_aoclk_gate.hw,
4968 [CLKID_IEC958] = &g12a_iec958_gate.hw,
4969 [CLKID_ENC480P] = &g12a_enc480p.hw,
4970 [CLKID_RNG1] = &g12a_rng1.hw,
4971 [CLKID_VCLK2_ENCT] = &g12a_vclk2_enct.hw,
4972 [CLKID_VCLK2_ENCL] = &g12a_vclk2_encl.hw,
4973 [CLKID_VCLK2_VENCLMMC] = &g12a_vclk2_venclmmc.hw,
4974 [CLKID_VCLK2_VENCL] = &g12a_vclk2_vencl.hw,
4975 [CLKID_VCLK2_OTHER1] = &g12a_vclk2_other1.hw,
4976 [CLKID_FIXED_PLL_DCO] = &g12a_fixed_pll_dco.hw,
4977 [CLKID_SYS_PLL_DCO] = &g12a_sys_pll_dco.hw,
4978 [CLKID_GP0_PLL_DCO] = &g12a_gp0_pll_dco.hw,
4979 [CLKID_HIFI_PLL_DCO] = &g12a_hifi_pll_dco.hw,
4980 [CLKID_DMA] = &g12a_dma.hw,
4981 [CLKID_EFUSE] = &g12a_efuse.hw,
4982 [CLKID_ROM_BOOT] = &g12a_rom_boot.hw,
4983 [CLKID_RESET_SEC] = &g12a_reset_sec.hw,
4984 [CLKID_SEC_AHB_APB3] = &g12a_sec_ahb_apb3.hw,
4985 [CLKID_MPLL_PREDIV] = &g12a_mpll_prediv.hw,
4986 [CLKID_VPU_0_SEL] = &g12a_vpu_0_sel.hw,
4987 [CLKID_VPU_0_DIV] = &g12a_vpu_0_div.hw,
4988 [CLKID_VPU_0] = &g12a_vpu_0.hw,
4989 [CLKID_VPU_1_SEL] = &g12a_vpu_1_sel.hw,
4990 [CLKID_VPU_1_DIV] = &g12a_vpu_1_div.hw,
4991 [CLKID_VPU_1] = &g12a_vpu_1.hw,
4992 [CLKID_VPU] = &g12a_vpu.hw,
4993 [CLKID_VAPB_0_SEL] = &g12a_vapb_0_sel.hw,
4994 [CLKID_VAPB_0_DIV] = &g12a_vapb_0_div.hw,
4995 [CLKID_VAPB_0] = &g12a_vapb_0.hw,
4996 [CLKID_VAPB_1_SEL] = &g12a_vapb_1_sel.hw,
4997 [CLKID_VAPB_1_DIV] = &g12a_vapb_1_div.hw,
4998 [CLKID_VAPB_1] = &g12a_vapb_1.hw,
4999 [CLKID_VAPB_SEL] = &g12a_vapb_sel.hw,
5000 [CLKID_VAPB] = &g12a_vapb.hw,
5001 [CLKID_HDMI_PLL_DCO] = &g12a_hdmi_pll_dco.hw,
5002 [CLKID_HDMI_PLL_OD] = &g12a_hdmi_pll_od.hw,
5003 [CLKID_HDMI_PLL_OD2] = &g12a_hdmi_pll_od2.hw,
5004 [CLKID_HDMI_PLL] = &g12a_hdmi_pll.hw,
5005 [CLKID_VID_PLL] = &g12a_vid_pll_div.hw,
5006 [CLKID_VID_PLL_SEL] = &g12a_vid_pll_sel.hw,
5007 [CLKID_VID_PLL_DIV] = &g12a_vid_pll.hw,
5008 [CLKID_VCLK_SEL] = &g12a_vclk_sel.hw,
5009 [CLKID_VCLK2_SEL] = &g12a_vclk2_sel.hw,
5010 [CLKID_VCLK_INPUT] = &g12a_vclk_input.hw,
5011 [CLKID_VCLK2_INPUT] = &g12a_vclk2_input.hw,
5012 [CLKID_VCLK_DIV] = &g12a_vclk_div.hw,
5013 [CLKID_VCLK2_DIV] = &g12a_vclk2_div.hw,
5014 [CLKID_VCLK] = &g12a_vclk.hw,
5015 [CLKID_VCLK2] = &g12a_vclk2.hw,
5016 [CLKID_VCLK_DIV1] = &g12a_vclk_div1.hw,
5017 [CLKID_VCLK_DIV2_EN] = &g12a_vclk_div2_en.hw,
5018 [CLKID_VCLK_DIV4_EN] = &g12a_vclk_div4_en.hw,
5019 [CLKID_VCLK_DIV6_EN] = &g12a_vclk_div6_en.hw,
5020 [CLKID_VCLK_DIV12_EN] = &g12a_vclk_div12_en.hw,
5021 [CLKID_VCLK2_DIV1] = &g12a_vclk2_div1.hw,
5022 [CLKID_VCLK2_DIV2_EN] = &g12a_vclk2_div2_en.hw,
5023 [CLKID_VCLK2_DIV4_EN] = &g12a_vclk2_div4_en.hw,
5024 [CLKID_VCLK2_DIV6_EN] = &g12a_vclk2_div6_en.hw,
5025 [CLKID_VCLK2_DIV12_EN] = &g12a_vclk2_div12_en.hw,
5026 [CLKID_VCLK_DIV2] = &g12a_vclk_div2.hw,
5027 [CLKID_VCLK_DIV4] = &g12a_vclk_div4.hw,
5028 [CLKID_VCLK_DIV6] = &g12a_vclk_div6.hw,
5029 [CLKID_VCLK_DIV12] = &g12a_vclk_div12.hw,
5030 [CLKID_VCLK2_DIV2] = &g12a_vclk2_div2.hw,
5031 [CLKID_VCLK2_DIV4] = &g12a_vclk2_div4.hw,
5032 [CLKID_VCLK2_DIV6] = &g12a_vclk2_div6.hw,
5033 [CLKID_VCLK2_DIV12] = &g12a_vclk2_div12.hw,
5034 [CLKID_CTS_ENCI_SEL] = &g12a_cts_enci_sel.hw,
5035 [CLKID_CTS_ENCP_SEL] = &g12a_cts_encp_sel.hw,
5036 [CLKID_CTS_ENCL_SEL] = &g12a_cts_encl_sel.hw,
5037 [CLKID_CTS_VDAC_SEL] = &g12a_cts_vdac_sel.hw,
5038 [CLKID_HDMI_TX_SEL] = &g12a_hdmi_tx_sel.hw,
5039 [CLKID_CTS_ENCI] = &g12a_cts_enci.hw,
5040 [CLKID_CTS_ENCP] = &g12a_cts_encp.hw,
5041 [CLKID_CTS_ENCL] = &g12a_cts_encl.hw,
5042 [CLKID_CTS_VDAC] = &g12a_cts_vdac.hw,
5043 [CLKID_HDMI_TX] = &g12a_hdmi_tx.hw,
5044 [CLKID_HDMI_SEL] = &g12a_hdmi_sel.hw,
5045 [CLKID_HDMI_DIV] = &g12a_hdmi_div.hw,
5046 [CLKID_HDMI] = &g12a_hdmi.hw,
5047 [CLKID_MALI_0_SEL] = &g12a_mali_0_sel.hw,
5048 [CLKID_MALI_0_DIV] = &g12a_mali_0_div.hw,
5049 [CLKID_MALI_0] = &g12a_mali_0.hw,
5050 [CLKID_MALI_1_SEL] = &g12a_mali_1_sel.hw,
5051 [CLKID_MALI_1_DIV] = &g12a_mali_1_div.hw,
5052 [CLKID_MALI_1] = &g12a_mali_1.hw,
5053 [CLKID_MALI] = &g12a_mali.hw,
5054 [CLKID_MPLL_50M_DIV] = &g12a_mpll_50m_div.hw,
5055 [CLKID_MPLL_50M] = &g12a_mpll_50m.hw,
5056 [CLKID_SYS_PLL_DIV16_EN] = &g12a_sys_pll_div16_en.hw,
5057 [CLKID_SYS_PLL_DIV16] = &g12a_sys_pll_div16.hw,
5058 [CLKID_CPU_CLK_DYN0_SEL] = &g12a_cpu_clk_premux0.hw,
5059 [CLKID_CPU_CLK_DYN0_DIV] = &g12a_cpu_clk_mux0_div.hw,
5060 [CLKID_CPU_CLK_DYN0] = &g12a_cpu_clk_postmux0.hw,
5061 [CLKID_CPU_CLK_DYN1_SEL] = &g12a_cpu_clk_premux1.hw,
5062 [CLKID_CPU_CLK_DYN1_DIV] = &g12a_cpu_clk_mux1_div.hw,
5063 [CLKID_CPU_CLK_DYN1] = &g12a_cpu_clk_postmux1.hw,
5064 [CLKID_CPU_CLK_DYN] = &g12a_cpu_clk_dyn.hw,
5065 [CLKID_CPU_CLK] = &g12a_cpu_clk.hw,
5066 [CLKID_CPU_CLK_DIV16_EN] = &g12a_cpu_clk_div16_en.hw,
5067 [CLKID_CPU_CLK_DIV16] = &g12a_cpu_clk_div16.hw,
5068 [CLKID_CPU_CLK_APB_DIV] = &g12a_cpu_clk_apb_div.hw,
5069 [CLKID_CPU_CLK_APB] = &g12a_cpu_clk_apb.hw,
5070 [CLKID_CPU_CLK_ATB_DIV] = &g12a_cpu_clk_atb_div.hw,
5071 [CLKID_CPU_CLK_ATB] = &g12a_cpu_clk_atb.hw,
5072 [CLKID_CPU_CLK_AXI_DIV] = &g12a_cpu_clk_axi_div.hw,
5073 [CLKID_CPU_CLK_AXI] = &g12a_cpu_clk_axi.hw,
5074 [CLKID_CPU_CLK_TRACE_DIV] = &g12a_cpu_clk_trace_div.hw,
5075 [CLKID_CPU_CLK_TRACE] = &g12a_cpu_clk_trace.hw,
5076 [CLKID_PCIE_PLL_DCO] = &g12a_pcie_pll_dco.hw,
5077 [CLKID_PCIE_PLL_DCO_DIV2] = &g12a_pcie_pll_dco_div2.hw,
5078 [CLKID_PCIE_PLL_OD] = &g12a_pcie_pll_od.hw,
5079 [CLKID_PCIE_PLL] = &g12a_pcie_pll.hw,
5080 [CLKID_VDEC_1_SEL] = &g12a_vdec_1_sel.hw,
5081 [CLKID_VDEC_1_DIV] = &g12a_vdec_1_div.hw,
5082 [CLKID_VDEC_1] = &g12a_vdec_1.hw,
5083 [CLKID_VDEC_HEVC_SEL] = &g12a_vdec_hevc_sel.hw,
5084 [CLKID_VDEC_HEVC_DIV] = &g12a_vdec_hevc_div.hw,
5085 [CLKID_VDEC_HEVC] = &g12a_vdec_hevc.hw,
5086 [CLKID_VDEC_HEVCF_SEL] = &g12a_vdec_hevcf_sel.hw,
5087 [CLKID_VDEC_HEVCF_DIV] = &g12a_vdec_hevcf_div.hw,
5088 [CLKID_VDEC_HEVCF] = &g12a_vdec_hevcf.hw,
5089 [CLKID_TS_DIV] = &g12a_ts_div.hw,
5090 [CLKID_TS] = &g12a_ts.hw,
5091 [CLKID_GP1_PLL_DCO] = &sm1_gp1_pll_dco.hw,
5092 [CLKID_GP1_PLL] = &sm1_gp1_pll.hw,
5093 [CLKID_DSU_CLK_DYN0_SEL] = &sm1_dsu_clk_premux0.hw,
5094 [CLKID_DSU_CLK_DYN0_DIV] = &sm1_dsu_clk_premux1.hw,
5095 [CLKID_DSU_CLK_DYN0] = &sm1_dsu_clk_mux0_div.hw,
5096 [CLKID_DSU_CLK_DYN1_SEL] = &sm1_dsu_clk_postmux0.hw,
5097 [CLKID_DSU_CLK_DYN1_DIV] = &sm1_dsu_clk_mux1_div.hw,
5098 [CLKID_DSU_CLK_DYN1] = &sm1_dsu_clk_postmux1.hw,
5099 [CLKID_DSU_CLK_DYN] = &sm1_dsu_clk_dyn.hw,
5100 [CLKID_DSU_CLK_FINAL] = &sm1_dsu_final_clk.hw,
5101 [CLKID_DSU_CLK] = &sm1_dsu_clk.hw,
5102 [CLKID_CPU1_CLK] = &sm1_cpu1_clk.hw,
5103 [CLKID_CPU2_CLK] = &sm1_cpu2_clk.hw,
5104 [CLKID_CPU3_CLK] = &sm1_cpu3_clk.hw,
5105 [CLKID_SPICC0_SCLK_SEL] = &g12a_spicc0_sclk_sel.hw,
5106 [CLKID_SPICC0_SCLK_DIV] = &g12a_spicc0_sclk_div.hw,
5107 [CLKID_SPICC0_SCLK] = &g12a_spicc0_sclk.hw,
5108 [CLKID_SPICC1_SCLK_SEL] = &g12a_spicc1_sclk_sel.hw,
5109 [CLKID_SPICC1_SCLK_DIV] = &g12a_spicc1_sclk_div.hw,
5110 [CLKID_SPICC1_SCLK] = &g12a_spicc1_sclk.hw,
5111 [CLKID_NNA_AXI_CLK_SEL] = &sm1_nna_axi_clk_sel.hw,
5112 [CLKID_NNA_AXI_CLK_DIV] = &sm1_nna_axi_clk_div.hw,
5113 [CLKID_NNA_AXI_CLK] = &sm1_nna_axi_clk.hw,
5114 [CLKID_NNA_CORE_CLK_SEL] = &sm1_nna_core_clk_sel.hw,
5115 [CLKID_NNA_CORE_CLK_DIV] = &sm1_nna_core_clk_div.hw,
5116 [CLKID_NNA_CORE_CLK] = &sm1_nna_core_clk.hw,
5117 [CLKID_MIPI_DSI_PXCLK_SEL] = &g12a_mipi_dsi_pxclk_sel.hw,
5118 [CLKID_MIPI_DSI_PXCLK_DIV] = &g12a_mipi_dsi_pxclk_div.hw,
5119 [CLKID_MIPI_DSI_PXCLK] = &g12a_mipi_dsi_pxclk.hw,
5122 /* Convenience table to populate regmap in .probe */
5123 static struct clk_regmap *const g12a_clk_regmaps[] = {
5128 &g12a_mipi_dsi_host,
5170 &g12a_sd_emmc_a_clk0,
5171 &g12a_sd_emmc_b_clk0,
5172 &g12a_sd_emmc_c_clk0,
5174 &g12a_sd_emmc_a_clk0_div,
5175 &g12a_sd_emmc_b_clk0_div,
5176 &g12a_sd_emmc_c_clk0_div,
5178 &g12a_sd_emmc_a_clk0_sel,
5179 &g12a_sd_emmc_b_clk0_sel,
5180 &g12a_sd_emmc_c_clk0_sel,
5209 &g12a_vclk2_venclmmc,
5212 &g12a_fixed_pll_dco,
5261 &g12a_vclk_div12_en,
5263 &g12a_vclk2_div2_en,
5264 &g12a_vclk2_div4_en,
5265 &g12a_vclk2_div6_en,
5266 &g12a_vclk2_div12_en,
5288 &g12a_sys_pll_div16_en,
5289 &g12a_cpu_clk_premux0,
5290 &g12a_cpu_clk_mux0_div,
5291 &g12a_cpu_clk_postmux0,
5292 &g12a_cpu_clk_premux1,
5293 &g12a_cpu_clk_mux1_div,
5294 &g12a_cpu_clk_postmux1,
5297 &g12a_cpu_clk_div16_en,
5298 &g12a_cpu_clk_apb_div,
5300 &g12a_cpu_clk_atb_div,
5302 &g12a_cpu_clk_axi_div,
5304 &g12a_cpu_clk_trace_div,
5305 &g12a_cpu_clk_trace,
5311 &g12a_vdec_hevc_sel,
5312 &g12a_vdec_hevc_div,
5314 &g12a_vdec_hevcf_sel,
5315 &g12a_vdec_hevcf_div,
5322 &g12b_sys1_pll_div16_en,
5323 &g12b_cpub_clk_premux0,
5324 &g12b_cpub_clk_mux0_div,
5325 &g12b_cpub_clk_postmux0,
5326 &g12b_cpub_clk_premux1,
5327 &g12b_cpub_clk_mux1_div,
5328 &g12b_cpub_clk_postmux1,
5331 &g12b_cpub_clk_div16_en,
5332 &g12b_cpub_clk_apb_sel,
5334 &g12b_cpub_clk_atb_sel,
5336 &g12b_cpub_clk_axi_sel,
5338 &g12b_cpub_clk_trace_sel,
5339 &g12b_cpub_clk_trace,
5342 &sm1_dsu_clk_premux0,
5343 &sm1_dsu_clk_premux1,
5344 &sm1_dsu_clk_mux0_div,
5345 &sm1_dsu_clk_postmux0,
5346 &sm1_dsu_clk_mux1_div,
5347 &sm1_dsu_clk_postmux1,
5354 &g12a_spicc0_sclk_sel,
5355 &g12a_spicc0_sclk_div,
5357 &g12a_spicc1_sclk_sel,
5358 &g12a_spicc1_sclk_div,
5360 &sm1_nna_axi_clk_sel,
5361 &sm1_nna_axi_clk_div,
5363 &sm1_nna_core_clk_sel,
5364 &sm1_nna_core_clk_div,
5366 &g12a_mipi_dsi_pxclk_sel,
5367 &g12a_mipi_dsi_pxclk_div,
5368 &g12a_mipi_dsi_pxclk,
5372 &g12b_mipi_isp_gate,
5377 static const struct reg_sequence g12a_init_regs[] = {
5378 { .reg = HHI_MPLL_CNTL0, .def = 0x00000543 },
5381 #define DVFS_CON_ID "dvfs"
5383 static int meson_g12a_dvfs_setup_common(struct device *dev,
5384 struct clk_hw **hws)
5386 struct clk *notifier_clk;
5387 struct clk_hw *xtal;
5390 xtal = clk_hw_get_parent_by_index(hws[CLKID_CPU_CLK_DYN1_SEL], 0);
5392 /* Setup clock notifier for cpu_clk_postmux0 */
5393 g12a_cpu_clk_postmux0_nb_data.xtal = xtal;
5394 notifier_clk = devm_clk_hw_get_clk(dev, &g12a_cpu_clk_postmux0.hw,
5396 ret = devm_clk_notifier_register(dev, notifier_clk,
5397 &g12a_cpu_clk_postmux0_nb_data.nb);
5399 dev_err(dev, "failed to register the cpu_clk_postmux0 notifier\n");
5403 /* Setup clock notifier for cpu_clk_dyn mux */
5404 notifier_clk = devm_clk_hw_get_clk(dev, &g12a_cpu_clk_dyn.hw,
5406 ret = devm_clk_notifier_register(dev, notifier_clk,
5407 &g12a_cpu_clk_mux_nb);
5409 dev_err(dev, "failed to register the cpu_clk_dyn notifier\n");
5416 static int meson_g12b_dvfs_setup(struct platform_device *pdev)
5418 struct clk_hw **hws = g12b_hw_clks;
5419 struct device *dev = &pdev->dev;
5420 struct clk *notifier_clk;
5421 struct clk_hw *xtal;
5424 ret = meson_g12a_dvfs_setup_common(dev, hws);
5428 xtal = clk_hw_get_parent_by_index(hws[CLKID_CPU_CLK_DYN1_SEL], 0);
5430 /* Setup clock notifier for cpu_clk mux */
5431 notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpu_clk.hw,
5433 ret = devm_clk_notifier_register(dev, notifier_clk,
5434 &g12a_cpu_clk_mux_nb);
5436 dev_err(dev, "failed to register the cpu_clk notifier\n");
5440 /* Setup clock notifier for sys1_pll */
5441 notifier_clk = devm_clk_hw_get_clk(dev, &g12b_sys1_pll.hw,
5443 ret = devm_clk_notifier_register(dev, notifier_clk,
5444 &g12b_cpu_clk_sys1_pll_nb_data.nb);
5446 dev_err(dev, "failed to register the sys1_pll notifier\n");
5450 /* Add notifiers for the second CPU cluster */
5452 /* Setup clock notifier for cpub_clk_postmux0 */
5453 g12b_cpub_clk_postmux0_nb_data.xtal = xtal;
5454 notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpub_clk_postmux0.hw,
5456 ret = devm_clk_notifier_register(dev, notifier_clk,
5457 &g12b_cpub_clk_postmux0_nb_data.nb);
5459 dev_err(dev, "failed to register the cpub_clk_postmux0 notifier\n");
5463 /* Setup clock notifier for cpub_clk_dyn mux */
5464 notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpub_clk_dyn.hw, "dvfs");
5465 ret = devm_clk_notifier_register(dev, notifier_clk,
5466 &g12a_cpu_clk_mux_nb);
5468 dev_err(dev, "failed to register the cpub_clk_dyn notifier\n");
5472 /* Setup clock notifier for cpub_clk mux */
5473 notifier_clk = devm_clk_hw_get_clk(dev, &g12b_cpub_clk.hw, DVFS_CON_ID);
5474 ret = devm_clk_notifier_register(dev, notifier_clk,
5475 &g12a_cpu_clk_mux_nb);
5477 dev_err(dev, "failed to register the cpub_clk notifier\n");
5481 /* Setup clock notifier for sys_pll */
5482 notifier_clk = devm_clk_hw_get_clk(dev, &g12a_sys_pll.hw, DVFS_CON_ID);
5483 ret = devm_clk_notifier_register(dev, notifier_clk,
5484 &g12b_cpub_clk_sys_pll_nb_data.nb);
5486 dev_err(dev, "failed to register the sys_pll notifier\n");
5493 static int meson_g12a_dvfs_setup(struct platform_device *pdev)
5495 struct clk_hw **hws = g12a_hw_clks;
5496 struct device *dev = &pdev->dev;
5497 struct clk *notifier_clk;
5500 ret = meson_g12a_dvfs_setup_common(dev, hws);
5504 /* Setup clock notifier for cpu_clk mux */
5505 notifier_clk = devm_clk_hw_get_clk(dev, &g12a_cpu_clk.hw, DVFS_CON_ID);
5506 ret = devm_clk_notifier_register(dev, notifier_clk,
5507 &g12a_cpu_clk_mux_nb);
5509 dev_err(dev, "failed to register the cpu_clk notifier\n");
5513 /* Setup clock notifier for sys_pll */
5514 notifier_clk = devm_clk_hw_get_clk(dev, &g12a_sys_pll.hw, DVFS_CON_ID);
5515 ret = devm_clk_notifier_register(dev, notifier_clk,
5516 &g12a_sys_pll_nb_data.nb);
5518 dev_err(dev, "failed to register the sys_pll notifier\n");
5525 struct meson_g12a_data {
5526 const struct meson_eeclkc_data eeclkc_data;
5527 int (*dvfs_setup)(struct platform_device *pdev);
5530 static int meson_g12a_probe(struct platform_device *pdev)
5532 const struct meson_eeclkc_data *eeclkc_data;
5533 const struct meson_g12a_data *g12a_data;
5536 eeclkc_data = of_device_get_match_data(&pdev->dev);
5540 ret = meson_eeclkc_probe(pdev);
5544 g12a_data = container_of(eeclkc_data, struct meson_g12a_data,
5547 if (g12a_data->dvfs_setup)
5548 return g12a_data->dvfs_setup(pdev);
5553 static const struct meson_g12a_data g12a_clkc_data = {
5555 .regmap_clks = g12a_clk_regmaps,
5556 .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps),
5558 .hws = g12a_hw_clks,
5559 .num = ARRAY_SIZE(g12a_hw_clks),
5561 .init_regs = g12a_init_regs,
5562 .init_count = ARRAY_SIZE(g12a_init_regs),
5564 .dvfs_setup = meson_g12a_dvfs_setup,
5567 static const struct meson_g12a_data g12b_clkc_data = {
5569 .regmap_clks = g12a_clk_regmaps,
5570 .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps),
5572 .hws = g12b_hw_clks,
5573 .num = ARRAY_SIZE(g12b_hw_clks),
5576 .dvfs_setup = meson_g12b_dvfs_setup,
5579 static const struct meson_g12a_data sm1_clkc_data = {
5581 .regmap_clks = g12a_clk_regmaps,
5582 .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps),
5585 .num = ARRAY_SIZE(sm1_hw_clks),
5588 .dvfs_setup = meson_g12a_dvfs_setup,
5591 static const struct of_device_id clkc_match_table[] = {
5593 .compatible = "amlogic,g12a-clkc",
5594 .data = &g12a_clkc_data.eeclkc_data
5597 .compatible = "amlogic,g12b-clkc",
5598 .data = &g12b_clkc_data.eeclkc_data
5601 .compatible = "amlogic,sm1-clkc",
5602 .data = &sm1_clkc_data.eeclkc_data
5606 MODULE_DEVICE_TABLE(of, clkc_match_table);
5608 static struct platform_driver g12a_driver = {
5609 .probe = meson_g12a_probe,
5611 .name = "g12a-clkc",
5612 .of_match_table = clkc_match_table,
5615 module_platform_driver(g12a_driver);
5617 MODULE_DESCRIPTION("Amlogic G12/SM1 Main Clock Controller driver");
5618 MODULE_LICENSE("GPL");