1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2015 Endless Mobile, Inc.
6 * Copyright (c) 2016 BayLibre, Inc.
10 #include <linux/clk.h>
11 #include <linux/clk-provider.h>
12 #include <linux/init.h>
13 #include <linux/mfd/syscon.h>
14 #include <linux/of_address.h>
15 #include <linux/reset-controller.h>
16 #include <linux/slab.h>
17 #include <linux/regmap.h>
20 #include "clk-regmap.h"
24 static DEFINE_SPINLOCK(meson_clk_lock);
26 struct meson8b_clk_reset {
27 struct reset_controller_dev reset;
28 struct regmap *regmap;
31 static const struct pll_params_table sys_pll_params_table[] = {
55 static struct clk_fixed_rate meson8b_xtal = {
56 .fixed_rate = 24000000,
57 .hw.init = &(struct clk_init_data){
60 .ops = &clk_fixed_rate_ops,
64 static struct clk_regmap meson8b_fixed_pll_dco = {
65 .data = &(struct meson_clk_pll_data){
67 .reg_off = HHI_MPLL_CNTL,
72 .reg_off = HHI_MPLL_CNTL,
77 .reg_off = HHI_MPLL_CNTL,
82 .reg_off = HHI_MPLL_CNTL2,
87 .reg_off = HHI_MPLL_CNTL,
92 .reg_off = HHI_MPLL_CNTL,
97 .hw.init = &(struct clk_init_data){
98 .name = "fixed_pll_dco",
99 .ops = &meson_clk_pll_ro_ops,
100 .parent_hws = (const struct clk_hw *[]) {
107 static struct clk_regmap meson8b_fixed_pll = {
108 .data = &(struct clk_regmap_div_data){
109 .offset = HHI_MPLL_CNTL,
112 .flags = CLK_DIVIDER_POWER_OF_TWO,
114 .hw.init = &(struct clk_init_data){
116 .ops = &clk_regmap_divider_ro_ops,
117 .parent_hws = (const struct clk_hw *[]) {
118 &meson8b_fixed_pll_dco.hw
122 * This clock won't ever change at runtime so
123 * CLK_SET_RATE_PARENT is not required
128 static struct clk_regmap meson8b_hdmi_pll_dco = {
129 .data = &(struct meson_clk_pll_data){
131 .reg_off = HHI_VID_PLL_CNTL,
136 .reg_off = HHI_VID_PLL_CNTL,
141 .reg_off = HHI_VID_PLL_CNTL,
146 .reg_off = HHI_VID_PLL_CNTL2,
151 .reg_off = HHI_VID_PLL_CNTL,
156 .reg_off = HHI_VID_PLL_CNTL,
161 .hw.init = &(struct clk_init_data){
162 /* sometimes also called "HPLL" or "HPLL PLL" */
163 .name = "hdmi_pll_dco",
164 .ops = &meson_clk_pll_ro_ops,
165 .parent_hws = (const struct clk_hw *[]) {
172 static struct clk_regmap meson8b_hdmi_pll_lvds_out = {
173 .data = &(struct clk_regmap_div_data){
174 .offset = HHI_VID_PLL_CNTL,
177 .flags = CLK_DIVIDER_POWER_OF_TWO,
179 .hw.init = &(struct clk_init_data){
180 .name = "hdmi_pll_lvds_out",
181 .ops = &clk_regmap_divider_ro_ops,
182 .parent_hws = (const struct clk_hw *[]) {
183 &meson8b_hdmi_pll_dco.hw
186 .flags = CLK_SET_RATE_PARENT,
190 static struct clk_regmap meson8b_hdmi_pll_hdmi_out = {
191 .data = &(struct clk_regmap_div_data){
192 .offset = HHI_VID_PLL_CNTL,
195 .flags = CLK_DIVIDER_POWER_OF_TWO,
197 .hw.init = &(struct clk_init_data){
198 .name = "hdmi_pll_hdmi_out",
199 .ops = &clk_regmap_divider_ro_ops,
200 .parent_hws = (const struct clk_hw *[]) {
201 &meson8b_hdmi_pll_dco.hw
204 .flags = CLK_SET_RATE_PARENT,
208 static struct clk_regmap meson8b_sys_pll_dco = {
209 .data = &(struct meson_clk_pll_data){
211 .reg_off = HHI_SYS_PLL_CNTL,
216 .reg_off = HHI_SYS_PLL_CNTL,
221 .reg_off = HHI_SYS_PLL_CNTL,
226 .reg_off = HHI_SYS_PLL_CNTL,
231 .reg_off = HHI_SYS_PLL_CNTL,
235 .table = sys_pll_params_table,
237 .hw.init = &(struct clk_init_data){
238 .name = "sys_pll_dco",
239 .ops = &meson_clk_pll_ops,
240 .parent_hws = (const struct clk_hw *[]) {
247 static struct clk_regmap meson8b_sys_pll = {
248 .data = &(struct clk_regmap_div_data){
249 .offset = HHI_SYS_PLL_CNTL,
252 .flags = CLK_DIVIDER_POWER_OF_TWO,
254 .hw.init = &(struct clk_init_data){
256 .ops = &clk_regmap_divider_ops,
257 .parent_hws = (const struct clk_hw *[]) {
258 &meson8b_sys_pll_dco.hw
261 .flags = CLK_SET_RATE_PARENT,
265 static struct clk_fixed_factor meson8b_fclk_div2_div = {
268 .hw.init = &(struct clk_init_data){
269 .name = "fclk_div2_div",
270 .ops = &clk_fixed_factor_ops,
271 .parent_hws = (const struct clk_hw *[]) {
272 &meson8b_fixed_pll.hw
278 static struct clk_regmap meson8b_fclk_div2 = {
279 .data = &(struct clk_regmap_gate_data){
280 .offset = HHI_MPLL_CNTL6,
283 .hw.init = &(struct clk_init_data){
285 .ops = &clk_regmap_gate_ops,
286 .parent_hws = (const struct clk_hw *[]) {
287 &meson8b_fclk_div2_div.hw
291 * FIXME: Ethernet with a RGMII PHYs is not working if
292 * fclk_div2 is disabled. it is currently unclear why this
293 * is. keep it enabled until the Ethernet driver knows how
294 * to manage this clock.
296 .flags = CLK_IS_CRITICAL,
300 static struct clk_fixed_factor meson8b_fclk_div3_div = {
303 .hw.init = &(struct clk_init_data){
304 .name = "fclk_div3_div",
305 .ops = &clk_fixed_factor_ops,
306 .parent_hws = (const struct clk_hw *[]) {
307 &meson8b_fixed_pll.hw
313 static struct clk_regmap meson8b_fclk_div3 = {
314 .data = &(struct clk_regmap_gate_data){
315 .offset = HHI_MPLL_CNTL6,
318 .hw.init = &(struct clk_init_data){
320 .ops = &clk_regmap_gate_ops,
321 .parent_hws = (const struct clk_hw *[]) {
322 &meson8b_fclk_div3_div.hw
328 static struct clk_fixed_factor meson8b_fclk_div4_div = {
331 .hw.init = &(struct clk_init_data){
332 .name = "fclk_div4_div",
333 .ops = &clk_fixed_factor_ops,
334 .parent_hws = (const struct clk_hw *[]) {
335 &meson8b_fixed_pll.hw
341 static struct clk_regmap meson8b_fclk_div4 = {
342 .data = &(struct clk_regmap_gate_data){
343 .offset = HHI_MPLL_CNTL6,
346 .hw.init = &(struct clk_init_data){
348 .ops = &clk_regmap_gate_ops,
349 .parent_hws = (const struct clk_hw *[]) {
350 &meson8b_fclk_div4_div.hw
356 static struct clk_fixed_factor meson8b_fclk_div5_div = {
359 .hw.init = &(struct clk_init_data){
360 .name = "fclk_div5_div",
361 .ops = &clk_fixed_factor_ops,
362 .parent_hws = (const struct clk_hw *[]) {
363 &meson8b_fixed_pll.hw
369 static struct clk_regmap meson8b_fclk_div5 = {
370 .data = &(struct clk_regmap_gate_data){
371 .offset = HHI_MPLL_CNTL6,
374 .hw.init = &(struct clk_init_data){
376 .ops = &clk_regmap_gate_ops,
377 .parent_hws = (const struct clk_hw *[]) {
378 &meson8b_fclk_div5_div.hw
384 static struct clk_fixed_factor meson8b_fclk_div7_div = {
387 .hw.init = &(struct clk_init_data){
388 .name = "fclk_div7_div",
389 .ops = &clk_fixed_factor_ops,
390 .parent_hws = (const struct clk_hw *[]) {
391 &meson8b_fixed_pll.hw
397 static struct clk_regmap meson8b_fclk_div7 = {
398 .data = &(struct clk_regmap_gate_data){
399 .offset = HHI_MPLL_CNTL6,
402 .hw.init = &(struct clk_init_data){
404 .ops = &clk_regmap_gate_ops,
405 .parent_hws = (const struct clk_hw *[]) {
406 &meson8b_fclk_div7_div.hw
412 static struct clk_regmap meson8b_mpll_prediv = {
413 .data = &(struct clk_regmap_div_data){
414 .offset = HHI_MPLL_CNTL5,
418 .hw.init = &(struct clk_init_data){
419 .name = "mpll_prediv",
420 .ops = &clk_regmap_divider_ro_ops,
421 .parent_hws = (const struct clk_hw *[]) {
422 &meson8b_fixed_pll.hw
428 static struct clk_regmap meson8b_mpll0_div = {
429 .data = &(struct meson_clk_mpll_data){
431 .reg_off = HHI_MPLL_CNTL7,
436 .reg_off = HHI_MPLL_CNTL7,
441 .reg_off = HHI_MPLL_CNTL7,
446 .reg_off = HHI_MPLL_CNTL,
450 .lock = &meson_clk_lock,
452 .hw.init = &(struct clk_init_data){
454 .ops = &meson_clk_mpll_ops,
455 .parent_hws = (const struct clk_hw *[]) {
456 &meson8b_mpll_prediv.hw
462 static struct clk_regmap meson8b_mpll0 = {
463 .data = &(struct clk_regmap_gate_data){
464 .offset = HHI_MPLL_CNTL7,
467 .hw.init = &(struct clk_init_data){
469 .ops = &clk_regmap_gate_ops,
470 .parent_hws = (const struct clk_hw *[]) {
471 &meson8b_mpll0_div.hw
474 .flags = CLK_SET_RATE_PARENT,
478 static struct clk_regmap meson8b_mpll1_div = {
479 .data = &(struct meson_clk_mpll_data){
481 .reg_off = HHI_MPLL_CNTL8,
486 .reg_off = HHI_MPLL_CNTL8,
491 .reg_off = HHI_MPLL_CNTL8,
495 .lock = &meson_clk_lock,
497 .hw.init = &(struct clk_init_data){
499 .ops = &meson_clk_mpll_ops,
500 .parent_hws = (const struct clk_hw *[]) {
501 &meson8b_mpll_prediv.hw
507 static struct clk_regmap meson8b_mpll1 = {
508 .data = &(struct clk_regmap_gate_data){
509 .offset = HHI_MPLL_CNTL8,
512 .hw.init = &(struct clk_init_data){
514 .ops = &clk_regmap_gate_ops,
515 .parent_hws = (const struct clk_hw *[]) {
516 &meson8b_mpll1_div.hw
519 .flags = CLK_SET_RATE_PARENT,
523 static struct clk_regmap meson8b_mpll2_div = {
524 .data = &(struct meson_clk_mpll_data){
526 .reg_off = HHI_MPLL_CNTL9,
531 .reg_off = HHI_MPLL_CNTL9,
536 .reg_off = HHI_MPLL_CNTL9,
540 .lock = &meson_clk_lock,
542 .hw.init = &(struct clk_init_data){
544 .ops = &meson_clk_mpll_ops,
545 .parent_hws = (const struct clk_hw *[]) {
546 &meson8b_mpll_prediv.hw
552 static struct clk_regmap meson8b_mpll2 = {
553 .data = &(struct clk_regmap_gate_data){
554 .offset = HHI_MPLL_CNTL9,
557 .hw.init = &(struct clk_init_data){
559 .ops = &clk_regmap_gate_ops,
560 .parent_hws = (const struct clk_hw *[]) {
561 &meson8b_mpll2_div.hw
564 .flags = CLK_SET_RATE_PARENT,
568 static u32 mux_table_clk81[] = { 6, 5, 7 };
569 static struct clk_regmap meson8b_mpeg_clk_sel = {
570 .data = &(struct clk_regmap_mux_data){
571 .offset = HHI_MPEG_CLK_CNTL,
574 .table = mux_table_clk81,
576 .hw.init = &(struct clk_init_data){
577 .name = "mpeg_clk_sel",
578 .ops = &clk_regmap_mux_ro_ops,
580 * FIXME bits 14:12 selects from 8 possible parents:
581 * xtal, 1'b0 (wtf), fclk_div7, mpll_clkout1, mpll_clkout2,
582 * fclk_div4, fclk_div3, fclk_div5
584 .parent_hws = (const struct clk_hw *[]) {
585 &meson8b_fclk_div3.hw,
586 &meson8b_fclk_div4.hw,
587 &meson8b_fclk_div5.hw,
593 static struct clk_regmap meson8b_mpeg_clk_div = {
594 .data = &(struct clk_regmap_div_data){
595 .offset = HHI_MPEG_CLK_CNTL,
599 .hw.init = &(struct clk_init_data){
600 .name = "mpeg_clk_div",
601 .ops = &clk_regmap_divider_ro_ops,
602 .parent_hws = (const struct clk_hw *[]) {
603 &meson8b_mpeg_clk_sel.hw
609 static struct clk_regmap meson8b_clk81 = {
610 .data = &(struct clk_regmap_gate_data){
611 .offset = HHI_MPEG_CLK_CNTL,
614 .hw.init = &(struct clk_init_data){
616 .ops = &clk_regmap_gate_ops,
617 .parent_hws = (const struct clk_hw *[]) {
618 &meson8b_mpeg_clk_div.hw
621 .flags = CLK_IS_CRITICAL,
625 static struct clk_regmap meson8b_cpu_in_sel = {
626 .data = &(struct clk_regmap_mux_data){
627 .offset = HHI_SYS_CPU_CLK_CNTL0,
631 .hw.init = &(struct clk_init_data){
632 .name = "cpu_in_sel",
633 .ops = &clk_regmap_mux_ops,
634 .parent_hws = (const struct clk_hw *[]) {
639 .flags = (CLK_SET_RATE_PARENT |
640 CLK_SET_RATE_NO_REPARENT),
644 static struct clk_fixed_factor meson8b_cpu_in_div2 = {
647 .hw.init = &(struct clk_init_data){
648 .name = "cpu_in_div2",
649 .ops = &clk_fixed_factor_ops,
650 .parent_hws = (const struct clk_hw *[]) {
651 &meson8b_cpu_in_sel.hw
654 .flags = CLK_SET_RATE_PARENT,
658 static struct clk_fixed_factor meson8b_cpu_in_div3 = {
661 .hw.init = &(struct clk_init_data){
662 .name = "cpu_in_div3",
663 .ops = &clk_fixed_factor_ops,
664 .parent_hws = (const struct clk_hw *[]) {
665 &meson8b_cpu_in_sel.hw
668 .flags = CLK_SET_RATE_PARENT,
672 static const struct clk_div_table cpu_scale_table[] = {
673 { .val = 1, .div = 4 },
674 { .val = 2, .div = 6 },
675 { .val = 3, .div = 8 },
676 { .val = 4, .div = 10 },
677 { .val = 5, .div = 12 },
678 { .val = 6, .div = 14 },
679 { .val = 7, .div = 16 },
680 { .val = 8, .div = 18 },
684 static struct clk_regmap meson8b_cpu_scale_div = {
685 .data = &(struct clk_regmap_div_data){
686 .offset = HHI_SYS_CPU_CLK_CNTL1,
689 .table = cpu_scale_table,
690 .flags = CLK_DIVIDER_ALLOW_ZERO,
692 .hw.init = &(struct clk_init_data){
693 .name = "cpu_scale_div",
694 .ops = &clk_regmap_divider_ops,
695 .parent_hws = (const struct clk_hw *[]) {
696 &meson8b_cpu_in_sel.hw
699 .flags = CLK_SET_RATE_PARENT,
703 static u32 mux_table_cpu_scale_out_sel[] = { 0, 1, 3 };
704 static struct clk_regmap meson8b_cpu_scale_out_sel = {
705 .data = &(struct clk_regmap_mux_data){
706 .offset = HHI_SYS_CPU_CLK_CNTL0,
709 .table = mux_table_cpu_scale_out_sel,
711 .hw.init = &(struct clk_init_data){
712 .name = "cpu_scale_out_sel",
713 .ops = &clk_regmap_mux_ops,
715 * NOTE: We are skipping the parent with value 0x2 (which is
716 * meson8b_cpu_in_div3) because it results in a duty cycle of
717 * 33% which makes the system unstable and can result in a
718 * lockup of the whole system.
720 .parent_hws = (const struct clk_hw *[]) {
721 &meson8b_cpu_in_sel.hw,
722 &meson8b_cpu_in_div2.hw,
723 &meson8b_cpu_scale_div.hw,
726 .flags = CLK_SET_RATE_PARENT,
730 static struct clk_regmap meson8b_cpu_clk = {
731 .data = &(struct clk_regmap_mux_data){
732 .offset = HHI_SYS_CPU_CLK_CNTL0,
736 .hw.init = &(struct clk_init_data){
738 .ops = &clk_regmap_mux_ops,
739 .parent_hws = (const struct clk_hw *[]) {
741 &meson8b_cpu_scale_out_sel.hw,
744 .flags = (CLK_SET_RATE_PARENT |
745 CLK_SET_RATE_NO_REPARENT |
750 static struct clk_regmap meson8b_nand_clk_sel = {
751 .data = &(struct clk_regmap_mux_data){
752 .offset = HHI_NAND_CLK_CNTL,
755 .flags = CLK_MUX_ROUND_CLOSEST,
757 .hw.init = &(struct clk_init_data){
758 .name = "nand_clk_sel",
759 .ops = &clk_regmap_mux_ops,
760 /* FIXME all other parents are unknown: */
761 .parent_hws = (const struct clk_hw *[]) {
762 &meson8b_fclk_div4.hw,
763 &meson8b_fclk_div3.hw,
764 &meson8b_fclk_div5.hw,
765 &meson8b_fclk_div7.hw,
769 .flags = CLK_SET_RATE_PARENT,
773 static struct clk_regmap meson8b_nand_clk_div = {
774 .data = &(struct clk_regmap_div_data){
775 .offset = HHI_NAND_CLK_CNTL,
778 .flags = CLK_DIVIDER_ROUND_CLOSEST,
780 .hw.init = &(struct clk_init_data){
781 .name = "nand_clk_div",
782 .ops = &clk_regmap_divider_ops,
783 .parent_hws = (const struct clk_hw *[]) {
784 &meson8b_nand_clk_sel.hw
787 .flags = CLK_SET_RATE_PARENT,
791 static struct clk_regmap meson8b_nand_clk_gate = {
792 .data = &(struct clk_regmap_gate_data){
793 .offset = HHI_NAND_CLK_CNTL,
796 .hw.init = &(struct clk_init_data){
797 .name = "nand_clk_gate",
798 .ops = &clk_regmap_gate_ops,
799 .parent_hws = (const struct clk_hw *[]) {
800 &meson8b_nand_clk_div.hw
803 .flags = CLK_SET_RATE_PARENT,
807 static struct clk_fixed_factor meson8b_cpu_clk_div2 = {
810 .hw.init = &(struct clk_init_data){
811 .name = "cpu_clk_div2",
812 .ops = &clk_fixed_factor_ops,
813 .parent_hws = (const struct clk_hw *[]) {
820 static struct clk_fixed_factor meson8b_cpu_clk_div3 = {
823 .hw.init = &(struct clk_init_data){
824 .name = "cpu_clk_div3",
825 .ops = &clk_fixed_factor_ops,
826 .parent_hws = (const struct clk_hw *[]) {
833 static struct clk_fixed_factor meson8b_cpu_clk_div4 = {
836 .hw.init = &(struct clk_init_data){
837 .name = "cpu_clk_div4",
838 .ops = &clk_fixed_factor_ops,
839 .parent_hws = (const struct clk_hw *[]) {
846 static struct clk_fixed_factor meson8b_cpu_clk_div5 = {
849 .hw.init = &(struct clk_init_data){
850 .name = "cpu_clk_div5",
851 .ops = &clk_fixed_factor_ops,
852 .parent_hws = (const struct clk_hw *[]) {
859 static struct clk_fixed_factor meson8b_cpu_clk_div6 = {
862 .hw.init = &(struct clk_init_data){
863 .name = "cpu_clk_div6",
864 .ops = &clk_fixed_factor_ops,
865 .parent_hws = (const struct clk_hw *[]) {
872 static struct clk_fixed_factor meson8b_cpu_clk_div7 = {
875 .hw.init = &(struct clk_init_data){
876 .name = "cpu_clk_div7",
877 .ops = &clk_fixed_factor_ops,
878 .parent_hws = (const struct clk_hw *[]) {
885 static struct clk_fixed_factor meson8b_cpu_clk_div8 = {
888 .hw.init = &(struct clk_init_data){
889 .name = "cpu_clk_div8",
890 .ops = &clk_fixed_factor_ops,
891 .parent_hws = (const struct clk_hw *[]) {
898 static u32 mux_table_apb[] = { 1, 2, 3, 4, 5, 6, 7 };
899 static struct clk_regmap meson8b_apb_clk_sel = {
900 .data = &(struct clk_regmap_mux_data){
901 .offset = HHI_SYS_CPU_CLK_CNTL1,
904 .table = mux_table_apb,
906 .hw.init = &(struct clk_init_data){
907 .name = "apb_clk_sel",
908 .ops = &clk_regmap_mux_ops,
909 .parent_hws = (const struct clk_hw *[]) {
910 &meson8b_cpu_clk_div2.hw,
911 &meson8b_cpu_clk_div3.hw,
912 &meson8b_cpu_clk_div4.hw,
913 &meson8b_cpu_clk_div5.hw,
914 &meson8b_cpu_clk_div6.hw,
915 &meson8b_cpu_clk_div7.hw,
916 &meson8b_cpu_clk_div8.hw,
922 static struct clk_regmap meson8b_apb_clk_gate = {
923 .data = &(struct clk_regmap_gate_data){
924 .offset = HHI_SYS_CPU_CLK_CNTL1,
926 .flags = CLK_GATE_SET_TO_DISABLE,
928 .hw.init = &(struct clk_init_data){
929 .name = "apb_clk_dis",
930 .ops = &clk_regmap_gate_ro_ops,
931 .parent_hws = (const struct clk_hw *[]) {
932 &meson8b_apb_clk_sel.hw
935 .flags = CLK_SET_RATE_PARENT,
939 static struct clk_regmap meson8b_periph_clk_sel = {
940 .data = &(struct clk_regmap_mux_data){
941 .offset = HHI_SYS_CPU_CLK_CNTL1,
945 .hw.init = &(struct clk_init_data){
946 .name = "periph_clk_sel",
947 .ops = &clk_regmap_mux_ops,
948 .parent_hws = (const struct clk_hw *[]) {
949 &meson8b_cpu_clk_div2.hw,
950 &meson8b_cpu_clk_div3.hw,
951 &meson8b_cpu_clk_div4.hw,
952 &meson8b_cpu_clk_div5.hw,
953 &meson8b_cpu_clk_div6.hw,
954 &meson8b_cpu_clk_div7.hw,
955 &meson8b_cpu_clk_div8.hw,
961 static struct clk_regmap meson8b_periph_clk_gate = {
962 .data = &(struct clk_regmap_gate_data){
963 .offset = HHI_SYS_CPU_CLK_CNTL1,
965 .flags = CLK_GATE_SET_TO_DISABLE,
967 .hw.init = &(struct clk_init_data){
968 .name = "periph_clk_dis",
969 .ops = &clk_regmap_gate_ro_ops,
970 .parent_hws = (const struct clk_hw *[]) {
971 &meson8b_periph_clk_sel.hw
974 .flags = CLK_SET_RATE_PARENT,
978 static u32 mux_table_axi[] = { 1, 2, 3, 4, 5, 6, 7 };
979 static struct clk_regmap meson8b_axi_clk_sel = {
980 .data = &(struct clk_regmap_mux_data){
981 .offset = HHI_SYS_CPU_CLK_CNTL1,
984 .table = mux_table_axi,
986 .hw.init = &(struct clk_init_data){
987 .name = "axi_clk_sel",
988 .ops = &clk_regmap_mux_ops,
989 .parent_hws = (const struct clk_hw *[]) {
990 &meson8b_cpu_clk_div2.hw,
991 &meson8b_cpu_clk_div3.hw,
992 &meson8b_cpu_clk_div4.hw,
993 &meson8b_cpu_clk_div5.hw,
994 &meson8b_cpu_clk_div6.hw,
995 &meson8b_cpu_clk_div7.hw,
996 &meson8b_cpu_clk_div8.hw,
1002 static struct clk_regmap meson8b_axi_clk_gate = {
1003 .data = &(struct clk_regmap_gate_data){
1004 .offset = HHI_SYS_CPU_CLK_CNTL1,
1006 .flags = CLK_GATE_SET_TO_DISABLE,
1008 .hw.init = &(struct clk_init_data){
1009 .name = "axi_clk_dis",
1010 .ops = &clk_regmap_gate_ro_ops,
1011 .parent_hws = (const struct clk_hw *[]) {
1012 &meson8b_axi_clk_sel.hw
1015 .flags = CLK_SET_RATE_PARENT,
1019 static struct clk_regmap meson8b_l2_dram_clk_sel = {
1020 .data = &(struct clk_regmap_mux_data){
1021 .offset = HHI_SYS_CPU_CLK_CNTL1,
1025 .hw.init = &(struct clk_init_data){
1026 .name = "l2_dram_clk_sel",
1027 .ops = &clk_regmap_mux_ops,
1028 .parent_hws = (const struct clk_hw *[]) {
1029 &meson8b_cpu_clk_div2.hw,
1030 &meson8b_cpu_clk_div3.hw,
1031 &meson8b_cpu_clk_div4.hw,
1032 &meson8b_cpu_clk_div5.hw,
1033 &meson8b_cpu_clk_div6.hw,
1034 &meson8b_cpu_clk_div7.hw,
1035 &meson8b_cpu_clk_div8.hw,
1041 static struct clk_regmap meson8b_l2_dram_clk_gate = {
1042 .data = &(struct clk_regmap_gate_data){
1043 .offset = HHI_SYS_CPU_CLK_CNTL1,
1045 .flags = CLK_GATE_SET_TO_DISABLE,
1047 .hw.init = &(struct clk_init_data){
1048 .name = "l2_dram_clk_dis",
1049 .ops = &clk_regmap_gate_ro_ops,
1050 .parent_hws = (const struct clk_hw *[]) {
1051 &meson8b_l2_dram_clk_sel.hw
1054 .flags = CLK_SET_RATE_PARENT,
1058 static struct clk_regmap meson8b_vid_pll_in_sel = {
1059 .data = &(struct clk_regmap_mux_data){
1060 .offset = HHI_VID_DIVIDER_CNTL,
1064 .hw.init = &(struct clk_init_data){
1065 .name = "vid_pll_in_sel",
1066 .ops = &clk_regmap_mux_ro_ops,
1068 * TODO: depending on the SoC there is also a second parent:
1070 * Meson8b: hdmi_pll_dco
1071 * Meson8m2: vid2_pll
1073 .parent_hws = (const struct clk_hw *[]) {
1074 &meson8b_hdmi_pll_dco.hw
1077 .flags = CLK_SET_RATE_PARENT,
1081 static struct clk_regmap meson8b_vid_pll_in_en = {
1082 .data = &(struct clk_regmap_gate_data){
1083 .offset = HHI_VID_DIVIDER_CNTL,
1086 .hw.init = &(struct clk_init_data){
1087 .name = "vid_pll_in_en",
1088 .ops = &clk_regmap_gate_ro_ops,
1089 .parent_hws = (const struct clk_hw *[]) {
1090 &meson8b_vid_pll_in_sel.hw
1093 .flags = CLK_SET_RATE_PARENT,
1097 static struct clk_regmap meson8b_vid_pll_pre_div = {
1098 .data = &(struct clk_regmap_div_data){
1099 .offset = HHI_VID_DIVIDER_CNTL,
1103 .hw.init = &(struct clk_init_data){
1104 .name = "vid_pll_pre_div",
1105 .ops = &clk_regmap_divider_ro_ops,
1106 .parent_hws = (const struct clk_hw *[]) {
1107 &meson8b_vid_pll_in_en.hw
1110 .flags = CLK_SET_RATE_PARENT,
1114 static struct clk_regmap meson8b_vid_pll_post_div = {
1115 .data = &(struct clk_regmap_div_data){
1116 .offset = HHI_VID_DIVIDER_CNTL,
1120 .hw.init = &(struct clk_init_data){
1121 .name = "vid_pll_post_div",
1122 .ops = &clk_regmap_divider_ro_ops,
1123 .parent_hws = (const struct clk_hw *[]) {
1124 &meson8b_vid_pll_pre_div.hw
1127 .flags = CLK_SET_RATE_PARENT,
1131 static struct clk_regmap meson8b_vid_pll = {
1132 .data = &(struct clk_regmap_mux_data){
1133 .offset = HHI_VID_DIVIDER_CNTL,
1137 .hw.init = &(struct clk_init_data){
1139 .ops = &clk_regmap_mux_ro_ops,
1140 /* TODO: parent 0x2 is vid_pll_pre_div_mult7_div2 */
1141 .parent_hws = (const struct clk_hw *[]) {
1142 &meson8b_vid_pll_pre_div.hw,
1143 &meson8b_vid_pll_post_div.hw,
1146 .flags = CLK_SET_RATE_PARENT,
1150 static struct clk_regmap meson8b_vid_pll_final_div = {
1151 .data = &(struct clk_regmap_div_data){
1152 .offset = HHI_VID_CLK_DIV,
1156 .hw.init = &(struct clk_init_data){
1157 .name = "vid_pll_final_div",
1158 .ops = &clk_regmap_divider_ro_ops,
1159 .parent_hws = (const struct clk_hw *[]) {
1163 .flags = CLK_SET_RATE_PARENT,
1167 static const struct clk_hw *meson8b_vclk_mux_parent_hws[] = {
1168 &meson8b_vid_pll_final_div.hw,
1169 &meson8b_fclk_div4.hw,
1170 &meson8b_fclk_div3.hw,
1171 &meson8b_fclk_div5.hw,
1172 &meson8b_vid_pll_final_div.hw,
1173 &meson8b_fclk_div7.hw,
1177 static struct clk_regmap meson8b_vclk_in_sel = {
1178 .data = &(struct clk_regmap_mux_data){
1179 .offset = HHI_VID_CLK_CNTL,
1183 .hw.init = &(struct clk_init_data){
1184 .name = "vclk_in_sel",
1185 .ops = &clk_regmap_mux_ro_ops,
1186 .parent_hws = meson8b_vclk_mux_parent_hws,
1187 .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws),
1188 .flags = CLK_SET_RATE_PARENT,
1192 static struct clk_regmap meson8b_vclk_in_en = {
1193 .data = &(struct clk_regmap_gate_data){
1194 .offset = HHI_VID_CLK_DIV,
1197 .hw.init = &(struct clk_init_data){
1198 .name = "vclk_in_en",
1199 .ops = &clk_regmap_gate_ro_ops,
1200 .parent_hws = (const struct clk_hw *[]) {
1201 &meson8b_vclk_in_sel.hw
1204 .flags = CLK_SET_RATE_PARENT,
1208 static struct clk_regmap meson8b_vclk_div1_gate = {
1209 .data = &(struct clk_regmap_gate_data){
1210 .offset = HHI_VID_CLK_DIV,
1213 .hw.init = &(struct clk_init_data){
1214 .name = "vclk_div1_en",
1215 .ops = &clk_regmap_gate_ro_ops,
1216 .parent_hws = (const struct clk_hw *[]) {
1217 &meson8b_vclk_in_en.hw
1220 .flags = CLK_SET_RATE_PARENT,
1224 static struct clk_fixed_factor meson8b_vclk_div2_div = {
1227 .hw.init = &(struct clk_init_data){
1228 .name = "vclk_div2",
1229 .ops = &clk_fixed_factor_ops,
1230 .parent_hws = (const struct clk_hw *[]) {
1231 &meson8b_vclk_in_en.hw
1234 .flags = CLK_SET_RATE_PARENT,
1238 static struct clk_regmap meson8b_vclk_div2_div_gate = {
1239 .data = &(struct clk_regmap_gate_data){
1240 .offset = HHI_VID_CLK_DIV,
1243 .hw.init = &(struct clk_init_data){
1244 .name = "vclk_div2_en",
1245 .ops = &clk_regmap_gate_ro_ops,
1246 .parent_hws = (const struct clk_hw *[]) {
1247 &meson8b_vclk_div2_div.hw
1250 .flags = CLK_SET_RATE_PARENT,
1254 static struct clk_fixed_factor meson8b_vclk_div4_div = {
1257 .hw.init = &(struct clk_init_data){
1258 .name = "vclk_div4",
1259 .ops = &clk_fixed_factor_ops,
1260 .parent_hws = (const struct clk_hw *[]) {
1261 &meson8b_vclk_in_en.hw
1264 .flags = CLK_SET_RATE_PARENT,
1268 static struct clk_regmap meson8b_vclk_div4_div_gate = {
1269 .data = &(struct clk_regmap_gate_data){
1270 .offset = HHI_VID_CLK_DIV,
1273 .hw.init = &(struct clk_init_data){
1274 .name = "vclk_div4_en",
1275 .ops = &clk_regmap_gate_ro_ops,
1276 .parent_hws = (const struct clk_hw *[]) {
1277 &meson8b_vclk_div4_div.hw
1280 .flags = CLK_SET_RATE_PARENT,
1284 static struct clk_fixed_factor meson8b_vclk_div6_div = {
1287 .hw.init = &(struct clk_init_data){
1288 .name = "vclk_div6",
1289 .ops = &clk_fixed_factor_ops,
1290 .parent_hws = (const struct clk_hw *[]) {
1291 &meson8b_vclk_in_en.hw
1294 .flags = CLK_SET_RATE_PARENT,
1298 static struct clk_regmap meson8b_vclk_div6_div_gate = {
1299 .data = &(struct clk_regmap_gate_data){
1300 .offset = HHI_VID_CLK_DIV,
1303 .hw.init = &(struct clk_init_data){
1304 .name = "vclk_div6_en",
1305 .ops = &clk_regmap_gate_ro_ops,
1306 .parent_hws = (const struct clk_hw *[]) {
1307 &meson8b_vclk_div6_div.hw
1310 .flags = CLK_SET_RATE_PARENT,
1314 static struct clk_fixed_factor meson8b_vclk_div12_div = {
1317 .hw.init = &(struct clk_init_data){
1318 .name = "vclk_div12",
1319 .ops = &clk_fixed_factor_ops,
1320 .parent_hws = (const struct clk_hw *[]) {
1321 &meson8b_vclk_in_en.hw
1324 .flags = CLK_SET_RATE_PARENT,
1328 static struct clk_regmap meson8b_vclk_div12_div_gate = {
1329 .data = &(struct clk_regmap_gate_data){
1330 .offset = HHI_VID_CLK_DIV,
1333 .hw.init = &(struct clk_init_data){
1334 .name = "vclk_div12_en",
1335 .ops = &clk_regmap_gate_ro_ops,
1336 .parent_hws = (const struct clk_hw *[]) {
1337 &meson8b_vclk_div12_div.hw
1340 .flags = CLK_SET_RATE_PARENT,
1344 static struct clk_regmap meson8b_vclk2_in_sel = {
1345 .data = &(struct clk_regmap_mux_data){
1346 .offset = HHI_VIID_CLK_CNTL,
1350 .hw.init = &(struct clk_init_data){
1351 .name = "vclk2_in_sel",
1352 .ops = &clk_regmap_mux_ro_ops,
1353 .parent_hws = meson8b_vclk_mux_parent_hws,
1354 .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws),
1355 .flags = CLK_SET_RATE_PARENT,
1359 static struct clk_regmap meson8b_vclk2_clk_in_en = {
1360 .data = &(struct clk_regmap_gate_data){
1361 .offset = HHI_VIID_CLK_DIV,
1364 .hw.init = &(struct clk_init_data){
1365 .name = "vclk2_in_en",
1366 .ops = &clk_regmap_gate_ro_ops,
1367 .parent_hws = (const struct clk_hw *[]) {
1368 &meson8b_vclk2_in_sel.hw
1371 .flags = CLK_SET_RATE_PARENT,
1375 static struct clk_regmap meson8b_vclk2_div1_gate = {
1376 .data = &(struct clk_regmap_gate_data){
1377 .offset = HHI_VIID_CLK_DIV,
1380 .hw.init = &(struct clk_init_data){
1381 .name = "vclk2_div1_en",
1382 .ops = &clk_regmap_gate_ro_ops,
1383 .parent_hws = (const struct clk_hw *[]) {
1384 &meson8b_vclk2_clk_in_en.hw
1387 .flags = CLK_SET_RATE_PARENT,
1391 static struct clk_fixed_factor meson8b_vclk2_div2_div = {
1394 .hw.init = &(struct clk_init_data){
1395 .name = "vclk2_div2",
1396 .ops = &clk_fixed_factor_ops,
1397 .parent_hws = (const struct clk_hw *[]) {
1398 &meson8b_vclk2_clk_in_en.hw
1401 .flags = CLK_SET_RATE_PARENT,
1405 static struct clk_regmap meson8b_vclk2_div2_div_gate = {
1406 .data = &(struct clk_regmap_gate_data){
1407 .offset = HHI_VIID_CLK_DIV,
1410 .hw.init = &(struct clk_init_data){
1411 .name = "vclk2_div2_en",
1412 .ops = &clk_regmap_gate_ro_ops,
1413 .parent_hws = (const struct clk_hw *[]) {
1414 &meson8b_vclk2_div2_div.hw
1417 .flags = CLK_SET_RATE_PARENT,
1421 static struct clk_fixed_factor meson8b_vclk2_div4_div = {
1424 .hw.init = &(struct clk_init_data){
1425 .name = "vclk2_div4",
1426 .ops = &clk_fixed_factor_ops,
1427 .parent_hws = (const struct clk_hw *[]) {
1428 &meson8b_vclk2_clk_in_en.hw
1431 .flags = CLK_SET_RATE_PARENT,
1435 static struct clk_regmap meson8b_vclk2_div4_div_gate = {
1436 .data = &(struct clk_regmap_gate_data){
1437 .offset = HHI_VIID_CLK_DIV,
1440 .hw.init = &(struct clk_init_data){
1441 .name = "vclk2_div4_en",
1442 .ops = &clk_regmap_gate_ro_ops,
1443 .parent_hws = (const struct clk_hw *[]) {
1444 &meson8b_vclk2_div4_div.hw
1447 .flags = CLK_SET_RATE_PARENT,
1451 static struct clk_fixed_factor meson8b_vclk2_div6_div = {
1454 .hw.init = &(struct clk_init_data){
1455 .name = "vclk2_div6",
1456 .ops = &clk_fixed_factor_ops,
1457 .parent_hws = (const struct clk_hw *[]) {
1458 &meson8b_vclk2_clk_in_en.hw
1461 .flags = CLK_SET_RATE_PARENT,
1465 static struct clk_regmap meson8b_vclk2_div6_div_gate = {
1466 .data = &(struct clk_regmap_gate_data){
1467 .offset = HHI_VIID_CLK_DIV,
1470 .hw.init = &(struct clk_init_data){
1471 .name = "vclk2_div6_en",
1472 .ops = &clk_regmap_gate_ro_ops,
1473 .parent_hws = (const struct clk_hw *[]) {
1474 &meson8b_vclk2_div6_div.hw
1477 .flags = CLK_SET_RATE_PARENT,
1481 static struct clk_fixed_factor meson8b_vclk2_div12_div = {
1484 .hw.init = &(struct clk_init_data){
1485 .name = "vclk2_div12",
1486 .ops = &clk_fixed_factor_ops,
1487 .parent_hws = (const struct clk_hw *[]) {
1488 &meson8b_vclk2_clk_in_en.hw
1491 .flags = CLK_SET_RATE_PARENT,
1495 static struct clk_regmap meson8b_vclk2_div12_div_gate = {
1496 .data = &(struct clk_regmap_gate_data){
1497 .offset = HHI_VIID_CLK_DIV,
1500 .hw.init = &(struct clk_init_data){
1501 .name = "vclk2_div12_en",
1502 .ops = &clk_regmap_gate_ro_ops,
1503 .parent_hws = (const struct clk_hw *[]) {
1504 &meson8b_vclk2_div12_div.hw
1507 .flags = CLK_SET_RATE_PARENT,
1511 static const struct clk_hw *meson8b_vclk_enc_mux_parent_hws[] = {
1512 &meson8b_vclk_div1_gate.hw,
1513 &meson8b_vclk_div2_div_gate.hw,
1514 &meson8b_vclk_div4_div_gate.hw,
1515 &meson8b_vclk_div6_div_gate.hw,
1516 &meson8b_vclk_div12_div_gate.hw,
1519 static struct clk_regmap meson8b_cts_enct_sel = {
1520 .data = &(struct clk_regmap_mux_data){
1521 .offset = HHI_VID_CLK_DIV,
1525 .hw.init = &(struct clk_init_data){
1526 .name = "cts_enct_sel",
1527 .ops = &clk_regmap_mux_ro_ops,
1528 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1529 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1530 .flags = CLK_SET_RATE_PARENT,
1534 static struct clk_regmap meson8b_cts_enct = {
1535 .data = &(struct clk_regmap_gate_data){
1536 .offset = HHI_VID_CLK_CNTL2,
1539 .hw.init = &(struct clk_init_data){
1541 .ops = &clk_regmap_gate_ro_ops,
1542 .parent_hws = (const struct clk_hw *[]) {
1543 &meson8b_cts_enct_sel.hw
1546 .flags = CLK_SET_RATE_PARENT,
1550 static struct clk_regmap meson8b_cts_encp_sel = {
1551 .data = &(struct clk_regmap_mux_data){
1552 .offset = HHI_VID_CLK_DIV,
1556 .hw.init = &(struct clk_init_data){
1557 .name = "cts_encp_sel",
1558 .ops = &clk_regmap_mux_ro_ops,
1559 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1560 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1561 .flags = CLK_SET_RATE_PARENT,
1565 static struct clk_regmap meson8b_cts_encp = {
1566 .data = &(struct clk_regmap_gate_data){
1567 .offset = HHI_VID_CLK_CNTL2,
1570 .hw.init = &(struct clk_init_data){
1572 .ops = &clk_regmap_gate_ro_ops,
1573 .parent_hws = (const struct clk_hw *[]) {
1574 &meson8b_cts_encp_sel.hw
1577 .flags = CLK_SET_RATE_PARENT,
1581 static struct clk_regmap meson8b_cts_enci_sel = {
1582 .data = &(struct clk_regmap_mux_data){
1583 .offset = HHI_VID_CLK_DIV,
1587 .hw.init = &(struct clk_init_data){
1588 .name = "cts_enci_sel",
1589 .ops = &clk_regmap_mux_ro_ops,
1590 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1591 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1592 .flags = CLK_SET_RATE_PARENT,
1596 static struct clk_regmap meson8b_cts_enci = {
1597 .data = &(struct clk_regmap_gate_data){
1598 .offset = HHI_VID_CLK_CNTL2,
1601 .hw.init = &(struct clk_init_data){
1603 .ops = &clk_regmap_gate_ro_ops,
1604 .parent_hws = (const struct clk_hw *[]) {
1605 &meson8b_cts_enci_sel.hw
1608 .flags = CLK_SET_RATE_PARENT,
1612 static struct clk_regmap meson8b_hdmi_tx_pixel_sel = {
1613 .data = &(struct clk_regmap_mux_data){
1614 .offset = HHI_HDMI_CLK_CNTL,
1618 .hw.init = &(struct clk_init_data){
1619 .name = "hdmi_tx_pixel_sel",
1620 .ops = &clk_regmap_mux_ro_ops,
1621 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1622 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1623 .flags = CLK_SET_RATE_PARENT,
1627 static struct clk_regmap meson8b_hdmi_tx_pixel = {
1628 .data = &(struct clk_regmap_gate_data){
1629 .offset = HHI_VID_CLK_CNTL2,
1632 .hw.init = &(struct clk_init_data){
1633 .name = "hdmi_tx_pixel",
1634 .ops = &clk_regmap_gate_ro_ops,
1635 .parent_hws = (const struct clk_hw *[]) {
1636 &meson8b_hdmi_tx_pixel_sel.hw
1639 .flags = CLK_SET_RATE_PARENT,
1643 static const struct clk_hw *meson8b_vclk2_enc_mux_parent_hws[] = {
1644 &meson8b_vclk2_div1_gate.hw,
1645 &meson8b_vclk2_div2_div_gate.hw,
1646 &meson8b_vclk2_div4_div_gate.hw,
1647 &meson8b_vclk2_div6_div_gate.hw,
1648 &meson8b_vclk2_div12_div_gate.hw,
1651 static struct clk_regmap meson8b_cts_encl_sel = {
1652 .data = &(struct clk_regmap_mux_data){
1653 .offset = HHI_VIID_CLK_DIV,
1657 .hw.init = &(struct clk_init_data){
1658 .name = "cts_encl_sel",
1659 .ops = &clk_regmap_mux_ro_ops,
1660 .parent_hws = meson8b_vclk2_enc_mux_parent_hws,
1661 .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws),
1662 .flags = CLK_SET_RATE_PARENT,
1666 static struct clk_regmap meson8b_cts_encl = {
1667 .data = &(struct clk_regmap_gate_data){
1668 .offset = HHI_VID_CLK_CNTL2,
1671 .hw.init = &(struct clk_init_data){
1673 .ops = &clk_regmap_gate_ro_ops,
1674 .parent_hws = (const struct clk_hw *[]) {
1675 &meson8b_cts_encl_sel.hw
1678 .flags = CLK_SET_RATE_PARENT,
1682 static struct clk_regmap meson8b_cts_vdac0_sel = {
1683 .data = &(struct clk_regmap_mux_data){
1684 .offset = HHI_VIID_CLK_DIV,
1688 .hw.init = &(struct clk_init_data){
1689 .name = "cts_vdac0_sel",
1690 .ops = &clk_regmap_mux_ro_ops,
1691 .parent_hws = meson8b_vclk2_enc_mux_parent_hws,
1692 .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws),
1693 .flags = CLK_SET_RATE_PARENT,
1697 static struct clk_regmap meson8b_cts_vdac0 = {
1698 .data = &(struct clk_regmap_gate_data){
1699 .offset = HHI_VID_CLK_CNTL2,
1702 .hw.init = &(struct clk_init_data){
1703 .name = "cts_vdac0",
1704 .ops = &clk_regmap_gate_ro_ops,
1705 .parent_hws = (const struct clk_hw *[]) {
1706 &meson8b_cts_vdac0_sel.hw
1709 .flags = CLK_SET_RATE_PARENT,
1713 static struct clk_regmap meson8b_hdmi_sys_sel = {
1714 .data = &(struct clk_regmap_mux_data){
1715 .offset = HHI_HDMI_CLK_CNTL,
1718 .flags = CLK_MUX_ROUND_CLOSEST,
1720 .hw.init = &(struct clk_init_data){
1721 .name = "hdmi_sys_sel",
1722 .ops = &clk_regmap_mux_ro_ops,
1723 /* FIXME: all other parents are unknown */
1724 .parent_hws = (const struct clk_hw *[]) {
1728 .flags = CLK_SET_RATE_NO_REPARENT,
1732 static struct clk_regmap meson8b_hdmi_sys_div = {
1733 .data = &(struct clk_regmap_div_data){
1734 .offset = HHI_HDMI_CLK_CNTL,
1738 .hw.init = &(struct clk_init_data){
1739 .name = "hdmi_sys_div",
1740 .ops = &clk_regmap_divider_ro_ops,
1741 .parent_hws = (const struct clk_hw *[]) {
1742 &meson8b_hdmi_sys_sel.hw
1745 .flags = CLK_SET_RATE_PARENT,
1749 static struct clk_regmap meson8b_hdmi_sys = {
1750 .data = &(struct clk_regmap_gate_data){
1751 .offset = HHI_HDMI_CLK_CNTL,
1754 .hw.init = &(struct clk_init_data) {
1756 .ops = &clk_regmap_gate_ro_ops,
1757 .parent_hws = (const struct clk_hw *[]) {
1758 &meson8b_hdmi_sys_div.hw
1761 .flags = CLK_SET_RATE_PARENT,
1766 * The MALI IP is clocked by two identical clocks (mali_0 and mali_1)
1767 * muxed by a glitch-free switch on Meson8b and Meson8m2. Meson8 only
1768 * has mali_0 and no glitch-free mux.
1770 static const struct clk_hw *meson8b_mali_0_1_parent_hws[] = {
1774 &meson8b_fclk_div7.hw,
1775 &meson8b_fclk_div4.hw,
1776 &meson8b_fclk_div3.hw,
1777 &meson8b_fclk_div5.hw,
1780 static u32 meson8b_mali_0_1_mux_table[] = { 0, 2, 3, 4, 5, 6, 7 };
1782 static struct clk_regmap meson8b_mali_0_sel = {
1783 .data = &(struct clk_regmap_mux_data){
1784 .offset = HHI_MALI_CLK_CNTL,
1787 .table = meson8b_mali_0_1_mux_table,
1789 .hw.init = &(struct clk_init_data){
1790 .name = "mali_0_sel",
1791 .ops = &clk_regmap_mux_ops,
1792 .parent_hws = meson8b_mali_0_1_parent_hws,
1793 .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_hws),
1795 * Don't propagate rate changes up because the only changeable
1796 * parents are mpll1 and mpll2 but we need those for audio and
1797 * RGMII (Ethernet). We don't want to change the audio or
1798 * Ethernet clocks when setting the GPU frequency.
1804 static struct clk_regmap meson8b_mali_0_div = {
1805 .data = &(struct clk_regmap_div_data){
1806 .offset = HHI_MALI_CLK_CNTL,
1810 .hw.init = &(struct clk_init_data){
1811 .name = "mali_0_div",
1812 .ops = &clk_regmap_divider_ops,
1813 .parent_hws = (const struct clk_hw *[]) {
1814 &meson8b_mali_0_sel.hw
1817 .flags = CLK_SET_RATE_PARENT,
1821 static struct clk_regmap meson8b_mali_0 = {
1822 .data = &(struct clk_regmap_gate_data){
1823 .offset = HHI_MALI_CLK_CNTL,
1826 .hw.init = &(struct clk_init_data){
1828 .ops = &clk_regmap_gate_ops,
1829 .parent_hws = (const struct clk_hw *[]) {
1830 &meson8b_mali_0_div.hw
1833 .flags = CLK_SET_RATE_PARENT,
1837 static struct clk_regmap meson8b_mali_1_sel = {
1838 .data = &(struct clk_regmap_mux_data){
1839 .offset = HHI_MALI_CLK_CNTL,
1842 .table = meson8b_mali_0_1_mux_table,
1844 .hw.init = &(struct clk_init_data){
1845 .name = "mali_1_sel",
1846 .ops = &clk_regmap_mux_ops,
1847 .parent_hws = meson8b_mali_0_1_parent_hws,
1848 .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_hws),
1850 * Don't propagate rate changes up because the only changeable
1851 * parents are mpll1 and mpll2 but we need those for audio and
1852 * RGMII (Ethernet). We don't want to change the audio or
1853 * Ethernet clocks when setting the GPU frequency.
1859 static struct clk_regmap meson8b_mali_1_div = {
1860 .data = &(struct clk_regmap_div_data){
1861 .offset = HHI_MALI_CLK_CNTL,
1865 .hw.init = &(struct clk_init_data){
1866 .name = "mali_1_div",
1867 .ops = &clk_regmap_divider_ops,
1868 .parent_hws = (const struct clk_hw *[]) {
1869 &meson8b_mali_1_sel.hw
1872 .flags = CLK_SET_RATE_PARENT,
1876 static struct clk_regmap meson8b_mali_1 = {
1877 .data = &(struct clk_regmap_gate_data){
1878 .offset = HHI_MALI_CLK_CNTL,
1881 .hw.init = &(struct clk_init_data){
1883 .ops = &clk_regmap_gate_ops,
1884 .parent_hws = (const struct clk_hw *[]) {
1885 &meson8b_mali_1_div.hw
1888 .flags = CLK_SET_RATE_PARENT,
1892 static struct clk_regmap meson8b_mali = {
1893 .data = &(struct clk_regmap_mux_data){
1894 .offset = HHI_MALI_CLK_CNTL,
1898 .hw.init = &(struct clk_init_data){
1900 .ops = &clk_regmap_mux_ops,
1901 .parent_hws = (const struct clk_hw *[]) {
1906 .flags = CLK_SET_RATE_PARENT,
1910 static const struct pll_params_table meson8m2_gp_pll_params_table[] = {
1915 static struct clk_regmap meson8m2_gp_pll_dco = {
1916 .data = &(struct meson_clk_pll_data){
1918 .reg_off = HHI_GP_PLL_CNTL,
1923 .reg_off = HHI_GP_PLL_CNTL,
1928 .reg_off = HHI_GP_PLL_CNTL,
1933 .reg_off = HHI_GP_PLL_CNTL,
1938 .reg_off = HHI_GP_PLL_CNTL,
1942 .table = meson8m2_gp_pll_params_table,
1944 .hw.init = &(struct clk_init_data){
1945 .name = "gp_pll_dco",
1946 .ops = &meson_clk_pll_ops,
1947 .parent_hws = (const struct clk_hw *[]) {
1954 static struct clk_regmap meson8m2_gp_pll = {
1955 .data = &(struct clk_regmap_div_data){
1956 .offset = HHI_GP_PLL_CNTL,
1959 .flags = CLK_DIVIDER_POWER_OF_TWO,
1961 .hw.init = &(struct clk_init_data){
1963 .ops = &clk_regmap_divider_ops,
1964 .parent_hws = (const struct clk_hw *[]) {
1965 &meson8m2_gp_pll_dco.hw
1968 .flags = CLK_SET_RATE_PARENT,
1972 static const struct clk_hw *meson8b_vpu_0_1_parent_hws[] = {
1973 &meson8b_fclk_div4.hw,
1974 &meson8b_fclk_div3.hw,
1975 &meson8b_fclk_div5.hw,
1976 &meson8b_fclk_div7.hw,
1979 static const struct clk_hw *mmeson8m2_vpu_0_1_parent_hws[] = {
1980 &meson8b_fclk_div4.hw,
1981 &meson8b_fclk_div3.hw,
1982 &meson8b_fclk_div5.hw,
1983 &meson8m2_gp_pll.hw,
1986 static struct clk_regmap meson8b_vpu_0_sel = {
1987 .data = &(struct clk_regmap_mux_data){
1988 .offset = HHI_VPU_CLK_CNTL,
1992 .hw.init = &(struct clk_init_data){
1993 .name = "vpu_0_sel",
1994 .ops = &clk_regmap_mux_ops,
1995 .parent_hws = meson8b_vpu_0_1_parent_hws,
1996 .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws),
1997 .flags = CLK_SET_RATE_PARENT,
2001 static struct clk_regmap meson8m2_vpu_0_sel = {
2002 .data = &(struct clk_regmap_mux_data){
2003 .offset = HHI_VPU_CLK_CNTL,
2007 .hw.init = &(struct clk_init_data){
2008 .name = "vpu_0_sel",
2009 .ops = &clk_regmap_mux_ops,
2010 .parent_hws = mmeson8m2_vpu_0_1_parent_hws,
2011 .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws),
2012 .flags = CLK_SET_RATE_PARENT,
2016 static struct clk_regmap meson8b_vpu_0_div = {
2017 .data = &(struct clk_regmap_div_data){
2018 .offset = HHI_VPU_CLK_CNTL,
2022 .hw.init = &(struct clk_init_data){
2023 .name = "vpu_0_div",
2024 .ops = &clk_regmap_divider_ops,
2025 .parent_data = &(const struct clk_parent_data) {
2028 * meson8b and meson8m2 have different vpu_0_sels (with
2029 * different struct clk_hw). We fallback to the global
2030 * naming string mechanism so vpu_0_div picks up the
2033 .name = "vpu_0_sel",
2037 .flags = CLK_SET_RATE_PARENT,
2041 static struct clk_regmap meson8b_vpu_0 = {
2042 .data = &(struct clk_regmap_gate_data){
2043 .offset = HHI_VPU_CLK_CNTL,
2046 .hw.init = &(struct clk_init_data) {
2048 .ops = &clk_regmap_gate_ops,
2049 .parent_hws = (const struct clk_hw *[]) {
2050 &meson8b_vpu_0_div.hw
2053 .flags = CLK_SET_RATE_PARENT,
2057 static struct clk_regmap meson8b_vpu_1_sel = {
2058 .data = &(struct clk_regmap_mux_data){
2059 .offset = HHI_VPU_CLK_CNTL,
2063 .hw.init = &(struct clk_init_data){
2064 .name = "vpu_1_sel",
2065 .ops = &clk_regmap_mux_ops,
2066 .parent_hws = meson8b_vpu_0_1_parent_hws,
2067 .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws),
2068 .flags = CLK_SET_RATE_PARENT,
2072 static struct clk_regmap meson8m2_vpu_1_sel = {
2073 .data = &(struct clk_regmap_mux_data){
2074 .offset = HHI_VPU_CLK_CNTL,
2078 .hw.init = &(struct clk_init_data){
2079 .name = "vpu_1_sel",
2080 .ops = &clk_regmap_mux_ops,
2081 .parent_hws = mmeson8m2_vpu_0_1_parent_hws,
2082 .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws),
2083 .flags = CLK_SET_RATE_PARENT,
2087 static struct clk_regmap meson8b_vpu_1_div = {
2088 .data = &(struct clk_regmap_div_data){
2089 .offset = HHI_VPU_CLK_CNTL,
2093 .hw.init = &(struct clk_init_data){
2094 .name = "vpu_1_div",
2095 .ops = &clk_regmap_divider_ops,
2096 .parent_data = &(const struct clk_parent_data) {
2099 * meson8b and meson8m2 have different vpu_1_sels (with
2100 * different struct clk_hw). We fallback to the global
2101 * naming string mechanism so vpu_1_div picks up the
2104 .name = "vpu_1_sel",
2108 .flags = CLK_SET_RATE_PARENT,
2112 static struct clk_regmap meson8b_vpu_1 = {
2113 .data = &(struct clk_regmap_gate_data){
2114 .offset = HHI_VPU_CLK_CNTL,
2117 .hw.init = &(struct clk_init_data) {
2119 .ops = &clk_regmap_gate_ops,
2120 .parent_hws = (const struct clk_hw *[]) {
2121 &meson8b_vpu_1_div.hw
2124 .flags = CLK_SET_RATE_PARENT,
2128 static struct clk_regmap meson8b_vpu = {
2129 .data = &(struct clk_regmap_mux_data){
2130 .offset = HHI_VPU_CLK_CNTL,
2134 .hw.init = &(struct clk_init_data){
2136 .ops = &clk_regmap_mux_ops,
2137 .parent_hws = (const struct clk_hw *[]) {
2142 .flags = CLK_SET_RATE_NO_REPARENT,
2146 static const struct clk_hw *meson8b_vdec_parent_hws[] = {
2147 &meson8b_fclk_div4.hw,
2148 &meson8b_fclk_div3.hw,
2149 &meson8b_fclk_div5.hw,
2150 &meson8b_fclk_div7.hw,
2155 static struct clk_regmap meson8b_vdec_1_sel = {
2156 .data = &(struct clk_regmap_mux_data){
2157 .offset = HHI_VDEC_CLK_CNTL,
2160 .flags = CLK_MUX_ROUND_CLOSEST,
2162 .hw.init = &(struct clk_init_data){
2163 .name = "vdec_1_sel",
2164 .ops = &clk_regmap_mux_ops,
2165 .parent_hws = meson8b_vdec_parent_hws,
2166 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2167 .flags = CLK_SET_RATE_PARENT,
2171 static struct clk_regmap meson8b_vdec_1_1_div = {
2172 .data = &(struct clk_regmap_div_data){
2173 .offset = HHI_VDEC_CLK_CNTL,
2176 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2178 .hw.init = &(struct clk_init_data){
2179 .name = "vdec_1_1_div",
2180 .ops = &clk_regmap_divider_ops,
2181 .parent_hws = (const struct clk_hw *[]) {
2182 &meson8b_vdec_1_sel.hw
2185 .flags = CLK_SET_RATE_PARENT,
2189 static struct clk_regmap meson8b_vdec_1_1 = {
2190 .data = &(struct clk_regmap_gate_data){
2191 .offset = HHI_VDEC_CLK_CNTL,
2194 .hw.init = &(struct clk_init_data) {
2196 .ops = &clk_regmap_gate_ops,
2197 .parent_hws = (const struct clk_hw *[]) {
2198 &meson8b_vdec_1_1_div.hw
2201 .flags = CLK_SET_RATE_PARENT,
2205 static struct clk_regmap meson8b_vdec_1_2_div = {
2206 .data = &(struct clk_regmap_div_data){
2207 .offset = HHI_VDEC3_CLK_CNTL,
2210 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2212 .hw.init = &(struct clk_init_data){
2213 .name = "vdec_1_2_div",
2214 .ops = &clk_regmap_divider_ops,
2215 .parent_hws = (const struct clk_hw *[]) {
2216 &meson8b_vdec_1_sel.hw
2219 .flags = CLK_SET_RATE_PARENT,
2223 static struct clk_regmap meson8b_vdec_1_2 = {
2224 .data = &(struct clk_regmap_gate_data){
2225 .offset = HHI_VDEC3_CLK_CNTL,
2228 .hw.init = &(struct clk_init_data) {
2230 .ops = &clk_regmap_gate_ops,
2231 .parent_hws = (const struct clk_hw *[]) {
2232 &meson8b_vdec_1_2_div.hw
2235 .flags = CLK_SET_RATE_PARENT,
2239 static struct clk_regmap meson8b_vdec_1 = {
2240 .data = &(struct clk_regmap_mux_data){
2241 .offset = HHI_VDEC3_CLK_CNTL,
2244 .flags = CLK_MUX_ROUND_CLOSEST,
2246 .hw.init = &(struct clk_init_data){
2248 .ops = &clk_regmap_mux_ops,
2249 .parent_hws = (const struct clk_hw *[]) {
2250 &meson8b_vdec_1_1.hw,
2251 &meson8b_vdec_1_2.hw,
2254 .flags = CLK_SET_RATE_PARENT,
2258 static struct clk_regmap meson8b_vdec_hcodec_sel = {
2259 .data = &(struct clk_regmap_mux_data){
2260 .offset = HHI_VDEC_CLK_CNTL,
2263 .flags = CLK_MUX_ROUND_CLOSEST,
2265 .hw.init = &(struct clk_init_data){
2266 .name = "vdec_hcodec_sel",
2267 .ops = &clk_regmap_mux_ops,
2268 .parent_hws = meson8b_vdec_parent_hws,
2269 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2270 .flags = CLK_SET_RATE_PARENT,
2274 static struct clk_regmap meson8b_vdec_hcodec_div = {
2275 .data = &(struct clk_regmap_div_data){
2276 .offset = HHI_VDEC_CLK_CNTL,
2279 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2281 .hw.init = &(struct clk_init_data){
2282 .name = "vdec_hcodec_div",
2283 .ops = &clk_regmap_divider_ops,
2284 .parent_hws = (const struct clk_hw *[]) {
2285 &meson8b_vdec_hcodec_sel.hw
2288 .flags = CLK_SET_RATE_PARENT,
2292 static struct clk_regmap meson8b_vdec_hcodec = {
2293 .data = &(struct clk_regmap_gate_data){
2294 .offset = HHI_VDEC_CLK_CNTL,
2297 .hw.init = &(struct clk_init_data) {
2298 .name = "vdec_hcodec",
2299 .ops = &clk_regmap_gate_ops,
2300 .parent_hws = (const struct clk_hw *[]) {
2301 &meson8b_vdec_hcodec_div.hw
2304 .flags = CLK_SET_RATE_PARENT,
2308 static struct clk_regmap meson8b_vdec_2_sel = {
2309 .data = &(struct clk_regmap_mux_data){
2310 .offset = HHI_VDEC2_CLK_CNTL,
2313 .flags = CLK_MUX_ROUND_CLOSEST,
2315 .hw.init = &(struct clk_init_data){
2316 .name = "vdec_2_sel",
2317 .ops = &clk_regmap_mux_ops,
2318 .parent_hws = meson8b_vdec_parent_hws,
2319 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2320 .flags = CLK_SET_RATE_PARENT,
2324 static struct clk_regmap meson8b_vdec_2_div = {
2325 .data = &(struct clk_regmap_div_data){
2326 .offset = HHI_VDEC2_CLK_CNTL,
2329 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2331 .hw.init = &(struct clk_init_data){
2332 .name = "vdec_2_div",
2333 .ops = &clk_regmap_divider_ops,
2334 .parent_hws = (const struct clk_hw *[]) {
2335 &meson8b_vdec_2_sel.hw
2338 .flags = CLK_SET_RATE_PARENT,
2342 static struct clk_regmap meson8b_vdec_2 = {
2343 .data = &(struct clk_regmap_gate_data){
2344 .offset = HHI_VDEC2_CLK_CNTL,
2347 .hw.init = &(struct clk_init_data) {
2349 .ops = &clk_regmap_gate_ops,
2350 .parent_hws = (const struct clk_hw *[]) {
2351 &meson8b_vdec_2_div.hw
2354 .flags = CLK_SET_RATE_PARENT,
2358 static struct clk_regmap meson8b_vdec_hevc_sel = {
2359 .data = &(struct clk_regmap_mux_data){
2360 .offset = HHI_VDEC2_CLK_CNTL,
2363 .flags = CLK_MUX_ROUND_CLOSEST,
2365 .hw.init = &(struct clk_init_data){
2366 .name = "vdec_hevc_sel",
2367 .ops = &clk_regmap_mux_ops,
2368 .parent_hws = meson8b_vdec_parent_hws,
2369 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2370 .flags = CLK_SET_RATE_PARENT,
2374 static struct clk_regmap meson8b_vdec_hevc_div = {
2375 .data = &(struct clk_regmap_div_data){
2376 .offset = HHI_VDEC2_CLK_CNTL,
2379 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2381 .hw.init = &(struct clk_init_data){
2382 .name = "vdec_hevc_div",
2383 .ops = &clk_regmap_divider_ops,
2384 .parent_hws = (const struct clk_hw *[]) {
2385 &meson8b_vdec_hevc_sel.hw
2388 .flags = CLK_SET_RATE_PARENT,
2392 static struct clk_regmap meson8b_vdec_hevc_en = {
2393 .data = &(struct clk_regmap_gate_data){
2394 .offset = HHI_VDEC2_CLK_CNTL,
2397 .hw.init = &(struct clk_init_data) {
2398 .name = "vdec_hevc_en",
2399 .ops = &clk_regmap_gate_ops,
2400 .parent_hws = (const struct clk_hw *[]) {
2401 &meson8b_vdec_hevc_div.hw
2404 .flags = CLK_SET_RATE_PARENT,
2408 static struct clk_regmap meson8b_vdec_hevc = {
2409 .data = &(struct clk_regmap_mux_data){
2410 .offset = HHI_VDEC2_CLK_CNTL,
2413 .flags = CLK_MUX_ROUND_CLOSEST,
2415 .hw.init = &(struct clk_init_data){
2416 .name = "vdec_hevc",
2417 .ops = &clk_regmap_mux_ops,
2418 /* TODO: The second parent is currently unknown */
2419 .parent_hws = (const struct clk_hw *[]) {
2420 &meson8b_vdec_hevc_en.hw
2423 .flags = CLK_SET_RATE_PARENT,
2427 /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */
2428 static const struct clk_hw *meson8b_cts_amclk_parent_hws[] = {
2434 static u32 meson8b_cts_amclk_mux_table[] = { 1, 2, 3 };
2436 static struct clk_regmap meson8b_cts_amclk_sel = {
2437 .data = &(struct clk_regmap_mux_data){
2438 .offset = HHI_AUD_CLK_CNTL,
2441 .table = meson8b_cts_amclk_mux_table,
2442 .flags = CLK_MUX_ROUND_CLOSEST,
2444 .hw.init = &(struct clk_init_data){
2445 .name = "cts_amclk_sel",
2446 .ops = &clk_regmap_mux_ops,
2447 .parent_hws = meson8b_cts_amclk_parent_hws,
2448 .num_parents = ARRAY_SIZE(meson8b_cts_amclk_parent_hws),
2452 static struct clk_regmap meson8b_cts_amclk_div = {
2453 .data = &(struct clk_regmap_div_data) {
2454 .offset = HHI_AUD_CLK_CNTL,
2457 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2459 .hw.init = &(struct clk_init_data){
2460 .name = "cts_amclk_div",
2461 .ops = &clk_regmap_divider_ops,
2462 .parent_hws = (const struct clk_hw *[]) {
2463 &meson8b_cts_amclk_sel.hw
2466 .flags = CLK_SET_RATE_PARENT,
2470 static struct clk_regmap meson8b_cts_amclk = {
2471 .data = &(struct clk_regmap_gate_data){
2472 .offset = HHI_AUD_CLK_CNTL,
2475 .hw.init = &(struct clk_init_data){
2476 .name = "cts_amclk",
2477 .ops = &clk_regmap_gate_ops,
2478 .parent_hws = (const struct clk_hw *[]) {
2479 &meson8b_cts_amclk_div.hw
2482 .flags = CLK_SET_RATE_PARENT,
2486 /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */
2487 static const struct clk_hw *meson8b_cts_mclk_i958_parent_hws[] = {
2493 static u32 meson8b_cts_mclk_i958_mux_table[] = { 1, 2, 3 };
2495 static struct clk_regmap meson8b_cts_mclk_i958_sel = {
2496 .data = &(struct clk_regmap_mux_data){
2497 .offset = HHI_AUD_CLK_CNTL2,
2500 .table = meson8b_cts_mclk_i958_mux_table,
2501 .flags = CLK_MUX_ROUND_CLOSEST,
2503 .hw.init = &(struct clk_init_data) {
2504 .name = "cts_mclk_i958_sel",
2505 .ops = &clk_regmap_mux_ops,
2506 .parent_hws = meson8b_cts_mclk_i958_parent_hws,
2507 .num_parents = ARRAY_SIZE(meson8b_cts_mclk_i958_parent_hws),
2511 static struct clk_regmap meson8b_cts_mclk_i958_div = {
2512 .data = &(struct clk_regmap_div_data){
2513 .offset = HHI_AUD_CLK_CNTL2,
2516 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2518 .hw.init = &(struct clk_init_data) {
2519 .name = "cts_mclk_i958_div",
2520 .ops = &clk_regmap_divider_ops,
2521 .parent_hws = (const struct clk_hw *[]) {
2522 &meson8b_cts_mclk_i958_sel.hw
2525 .flags = CLK_SET_RATE_PARENT,
2529 static struct clk_regmap meson8b_cts_mclk_i958 = {
2530 .data = &(struct clk_regmap_gate_data){
2531 .offset = HHI_AUD_CLK_CNTL2,
2534 .hw.init = &(struct clk_init_data){
2535 .name = "cts_mclk_i958",
2536 .ops = &clk_regmap_gate_ops,
2537 .parent_hws = (const struct clk_hw *[]) {
2538 &meson8b_cts_mclk_i958_div.hw
2541 .flags = CLK_SET_RATE_PARENT,
2545 static struct clk_regmap meson8b_cts_i958 = {
2546 .data = &(struct clk_regmap_mux_data){
2547 .offset = HHI_AUD_CLK_CNTL2,
2551 .hw.init = &(struct clk_init_data){
2553 .ops = &clk_regmap_mux_ops,
2554 .parent_hws = (const struct clk_hw *[]) {
2555 &meson8b_cts_amclk.hw,
2556 &meson8b_cts_mclk_i958.hw
2560 * The parent is specific to origin of the audio data. Let the
2561 * consumer choose the appropriate parent.
2563 .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
2567 #define MESON_GATE(_name, _reg, _bit) \
2568 MESON_PCLK(_name, _reg, _bit, &meson8b_clk81.hw)
2570 /* Everything Else (EE) domain gates */
2572 static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0);
2573 static MESON_GATE(meson8b_dos, HHI_GCLK_MPEG0, 1);
2574 static MESON_GATE(meson8b_isa, HHI_GCLK_MPEG0, 5);
2575 static MESON_GATE(meson8b_pl301, HHI_GCLK_MPEG0, 6);
2576 static MESON_GATE(meson8b_periphs, HHI_GCLK_MPEG0, 7);
2577 static MESON_GATE(meson8b_spicc, HHI_GCLK_MPEG0, 8);
2578 static MESON_GATE(meson8b_i2c, HHI_GCLK_MPEG0, 9);
2579 static MESON_GATE(meson8b_sar_adc, HHI_GCLK_MPEG0, 10);
2580 static MESON_GATE(meson8b_smart_card, HHI_GCLK_MPEG0, 11);
2581 static MESON_GATE(meson8b_rng0, HHI_GCLK_MPEG0, 12);
2582 static MESON_GATE(meson8b_uart0, HHI_GCLK_MPEG0, 13);
2583 static MESON_GATE(meson8b_sdhc, HHI_GCLK_MPEG0, 14);
2584 static MESON_GATE(meson8b_stream, HHI_GCLK_MPEG0, 15);
2585 static MESON_GATE(meson8b_async_fifo, HHI_GCLK_MPEG0, 16);
2586 static MESON_GATE(meson8b_sdio, HHI_GCLK_MPEG0, 17);
2587 static MESON_GATE(meson8b_abuf, HHI_GCLK_MPEG0, 18);
2588 static MESON_GATE(meson8b_hiu_iface, HHI_GCLK_MPEG0, 19);
2589 static MESON_GATE(meson8b_assist_misc, HHI_GCLK_MPEG0, 23);
2590 static MESON_GATE(meson8b_spi, HHI_GCLK_MPEG0, 30);
2592 static MESON_GATE(meson8b_i2s_spdif, HHI_GCLK_MPEG1, 2);
2593 static MESON_GATE(meson8b_eth, HHI_GCLK_MPEG1, 3);
2594 static MESON_GATE(meson8b_demux, HHI_GCLK_MPEG1, 4);
2595 static MESON_GATE(meson8b_aiu_glue, HHI_GCLK_MPEG1, 6);
2596 static MESON_GATE(meson8b_iec958, HHI_GCLK_MPEG1, 7);
2597 static MESON_GATE(meson8b_i2s_out, HHI_GCLK_MPEG1, 8);
2598 static MESON_GATE(meson8b_amclk, HHI_GCLK_MPEG1, 9);
2599 static MESON_GATE(meson8b_aififo2, HHI_GCLK_MPEG1, 10);
2600 static MESON_GATE(meson8b_mixer, HHI_GCLK_MPEG1, 11);
2601 static MESON_GATE(meson8b_mixer_iface, HHI_GCLK_MPEG1, 12);
2602 static MESON_GATE(meson8b_adc, HHI_GCLK_MPEG1, 13);
2603 static MESON_GATE(meson8b_blkmv, HHI_GCLK_MPEG1, 14);
2604 static MESON_GATE(meson8b_aiu, HHI_GCLK_MPEG1, 15);
2605 static MESON_GATE(meson8b_uart1, HHI_GCLK_MPEG1, 16);
2606 static MESON_GATE(meson8b_g2d, HHI_GCLK_MPEG1, 20);
2607 static MESON_GATE(meson8b_usb0, HHI_GCLK_MPEG1, 21);
2608 static MESON_GATE(meson8b_usb1, HHI_GCLK_MPEG1, 22);
2609 static MESON_GATE(meson8b_reset, HHI_GCLK_MPEG1, 23);
2610 static MESON_GATE(meson8b_nand, HHI_GCLK_MPEG1, 24);
2611 static MESON_GATE(meson8b_dos_parser, HHI_GCLK_MPEG1, 25);
2612 static MESON_GATE(meson8b_usb, HHI_GCLK_MPEG1, 26);
2613 static MESON_GATE(meson8b_vdin1, HHI_GCLK_MPEG1, 28);
2614 static MESON_GATE(meson8b_ahb_arb0, HHI_GCLK_MPEG1, 29);
2615 static MESON_GATE(meson8b_efuse, HHI_GCLK_MPEG1, 30);
2616 static MESON_GATE(meson8b_boot_rom, HHI_GCLK_MPEG1, 31);
2618 static MESON_GATE(meson8b_ahb_data_bus, HHI_GCLK_MPEG2, 1);
2619 static MESON_GATE(meson8b_ahb_ctrl_bus, HHI_GCLK_MPEG2, 2);
2620 static MESON_GATE(meson8b_hdmi_intr_sync, HHI_GCLK_MPEG2, 3);
2621 static MESON_GATE(meson8b_hdmi_pclk, HHI_GCLK_MPEG2, 4);
2622 static MESON_GATE(meson8b_usb1_ddr_bridge, HHI_GCLK_MPEG2, 8);
2623 static MESON_GATE(meson8b_usb0_ddr_bridge, HHI_GCLK_MPEG2, 9);
2624 static MESON_GATE(meson8b_mmc_pclk, HHI_GCLK_MPEG2, 11);
2625 static MESON_GATE(meson8b_dvin, HHI_GCLK_MPEG2, 12);
2626 static MESON_GATE(meson8b_uart2, HHI_GCLK_MPEG2, 15);
2627 static MESON_GATE(meson8b_sana, HHI_GCLK_MPEG2, 22);
2628 static MESON_GATE(meson8b_vpu_intr, HHI_GCLK_MPEG2, 25);
2629 static MESON_GATE(meson8b_sec_ahb_ahb3_bridge, HHI_GCLK_MPEG2, 26);
2630 static MESON_GATE(meson8b_clk81_a9, HHI_GCLK_MPEG2, 29);
2632 static MESON_GATE(meson8b_vclk2_venci0, HHI_GCLK_OTHER, 1);
2633 static MESON_GATE(meson8b_vclk2_venci1, HHI_GCLK_OTHER, 2);
2634 static MESON_GATE(meson8b_vclk2_vencp0, HHI_GCLK_OTHER, 3);
2635 static MESON_GATE(meson8b_vclk2_vencp1, HHI_GCLK_OTHER, 4);
2636 static MESON_GATE(meson8b_gclk_venci_int, HHI_GCLK_OTHER, 8);
2637 static MESON_GATE(meson8b_gclk_vencp_int, HHI_GCLK_OTHER, 9);
2638 static MESON_GATE(meson8b_dac_clk, HHI_GCLK_OTHER, 10);
2639 static MESON_GATE(meson8b_aoclk_gate, HHI_GCLK_OTHER, 14);
2640 static MESON_GATE(meson8b_iec958_gate, HHI_GCLK_OTHER, 16);
2641 static MESON_GATE(meson8b_enc480p, HHI_GCLK_OTHER, 20);
2642 static MESON_GATE(meson8b_rng1, HHI_GCLK_OTHER, 21);
2643 static MESON_GATE(meson8b_gclk_vencl_int, HHI_GCLK_OTHER, 22);
2644 static MESON_GATE(meson8b_vclk2_venclmcc, HHI_GCLK_OTHER, 24);
2645 static MESON_GATE(meson8b_vclk2_vencl, HHI_GCLK_OTHER, 25);
2646 static MESON_GATE(meson8b_vclk2_other, HHI_GCLK_OTHER, 26);
2647 static MESON_GATE(meson8b_edp, HHI_GCLK_OTHER, 31);
2649 /* Always On (AO) domain gates */
2651 static MESON_GATE(meson8b_ao_media_cpu, HHI_GCLK_AO, 0);
2652 static MESON_GATE(meson8b_ao_ahb_sram, HHI_GCLK_AO, 1);
2653 static MESON_GATE(meson8b_ao_ahb_bus, HHI_GCLK_AO, 2);
2654 static MESON_GATE(meson8b_ao_iface, HHI_GCLK_AO, 3);
2656 static struct clk_hw_onecell_data meson8_hw_onecell_data = {
2658 [CLKID_XTAL] = &meson8b_xtal.hw,
2659 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
2660 [CLKID_PLL_VID] = &meson8b_vid_pll.hw,
2661 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
2662 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
2663 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
2664 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
2665 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
2666 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
2667 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
2668 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
2669 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
2670 [CLKID_CLK81] = &meson8b_clk81.hw,
2671 [CLKID_DDR] = &meson8b_ddr.hw,
2672 [CLKID_DOS] = &meson8b_dos.hw,
2673 [CLKID_ISA] = &meson8b_isa.hw,
2674 [CLKID_PL301] = &meson8b_pl301.hw,
2675 [CLKID_PERIPHS] = &meson8b_periphs.hw,
2676 [CLKID_SPICC] = &meson8b_spicc.hw,
2677 [CLKID_I2C] = &meson8b_i2c.hw,
2678 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw,
2679 [CLKID_SMART_CARD] = &meson8b_smart_card.hw,
2680 [CLKID_RNG0] = &meson8b_rng0.hw,
2681 [CLKID_UART0] = &meson8b_uart0.hw,
2682 [CLKID_SDHC] = &meson8b_sdhc.hw,
2683 [CLKID_STREAM] = &meson8b_stream.hw,
2684 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw,
2685 [CLKID_SDIO] = &meson8b_sdio.hw,
2686 [CLKID_ABUF] = &meson8b_abuf.hw,
2687 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw,
2688 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw,
2689 [CLKID_SPI] = &meson8b_spi.hw,
2690 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw,
2691 [CLKID_ETH] = &meson8b_eth.hw,
2692 [CLKID_DEMUX] = &meson8b_demux.hw,
2693 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw,
2694 [CLKID_IEC958] = &meson8b_iec958.hw,
2695 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw,
2696 [CLKID_AMCLK] = &meson8b_amclk.hw,
2697 [CLKID_AIFIFO2] = &meson8b_aififo2.hw,
2698 [CLKID_MIXER] = &meson8b_mixer.hw,
2699 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw,
2700 [CLKID_ADC] = &meson8b_adc.hw,
2701 [CLKID_BLKMV] = &meson8b_blkmv.hw,
2702 [CLKID_AIU] = &meson8b_aiu.hw,
2703 [CLKID_UART1] = &meson8b_uart1.hw,
2704 [CLKID_G2D] = &meson8b_g2d.hw,
2705 [CLKID_USB0] = &meson8b_usb0.hw,
2706 [CLKID_USB1] = &meson8b_usb1.hw,
2707 [CLKID_RESET] = &meson8b_reset.hw,
2708 [CLKID_NAND] = &meson8b_nand.hw,
2709 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw,
2710 [CLKID_USB] = &meson8b_usb.hw,
2711 [CLKID_VDIN1] = &meson8b_vdin1.hw,
2712 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw,
2713 [CLKID_EFUSE] = &meson8b_efuse.hw,
2714 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw,
2715 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw,
2716 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw,
2717 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw,
2718 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw,
2719 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw,
2720 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw,
2721 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw,
2722 [CLKID_DVIN] = &meson8b_dvin.hw,
2723 [CLKID_UART2] = &meson8b_uart2.hw,
2724 [CLKID_SANA] = &meson8b_sana.hw,
2725 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw,
2726 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
2727 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw,
2728 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw,
2729 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw,
2730 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw,
2731 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw,
2732 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw,
2733 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw,
2734 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw,
2735 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw,
2736 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw,
2737 [CLKID_ENC480P] = &meson8b_enc480p.hw,
2738 [CLKID_RNG1] = &meson8b_rng1.hw,
2739 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw,
2740 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw,
2741 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw,
2742 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw,
2743 [CLKID_EDP] = &meson8b_edp.hw,
2744 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw,
2745 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw,
2746 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw,
2747 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw,
2748 [CLKID_MPLL0] = &meson8b_mpll0.hw,
2749 [CLKID_MPLL1] = &meson8b_mpll1.hw,
2750 [CLKID_MPLL2] = &meson8b_mpll2.hw,
2751 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw,
2752 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw,
2753 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw,
2754 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw,
2755 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw,
2756 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw,
2757 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw,
2758 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw,
2759 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw,
2760 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw,
2761 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw,
2762 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw,
2763 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw,
2764 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw,
2765 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw,
2766 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw,
2767 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw,
2768 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw,
2769 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw,
2770 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw,
2771 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw,
2772 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw,
2773 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw,
2774 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw,
2775 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw,
2776 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw,
2777 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw,
2778 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw,
2779 [CLKID_APB] = &meson8b_apb_clk_gate.hw,
2780 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw,
2781 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw,
2782 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw,
2783 [CLKID_AXI] = &meson8b_axi_clk_gate.hw,
2784 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw,
2785 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw,
2786 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw,
2787 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw,
2788 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw,
2789 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw,
2790 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw,
2791 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw,
2792 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw,
2793 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw,
2794 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw,
2795 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw,
2796 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw,
2797 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw,
2798 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw,
2799 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw,
2800 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw,
2801 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw,
2802 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw,
2803 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw,
2804 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw,
2805 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw,
2806 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw,
2807 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw,
2808 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw,
2809 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw,
2810 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw,
2811 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw,
2812 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw,
2813 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw,
2814 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw,
2815 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw,
2816 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw,
2817 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw,
2818 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw,
2819 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw,
2820 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw,
2821 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw,
2822 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw,
2823 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw,
2824 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw,
2825 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw,
2826 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw,
2827 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw,
2828 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw,
2829 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw,
2830 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw,
2831 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw,
2832 [CLKID_MALI] = &meson8b_mali_0.hw,
2833 [CLKID_VPU_0_SEL] = &meson8b_vpu_0_sel.hw,
2834 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
2835 [CLKID_VPU] = &meson8b_vpu_0.hw,
2836 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw,
2837 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw,
2838 [CLKID_VDEC_1] = &meson8b_vdec_1_1.hw,
2839 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw,
2840 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw,
2841 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw,
2842 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw,
2843 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw,
2844 [CLKID_VDEC_2] = &meson8b_vdec_2.hw,
2845 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw,
2846 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw,
2847 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw,
2848 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw,
2849 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw,
2850 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw,
2851 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw,
2852 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw,
2853 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw,
2854 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
2855 [CLKID_CTS_I958] = &meson8b_cts_i958.hw,
2856 [CLK_NR_CLKS] = NULL,
2861 static struct clk_hw_onecell_data meson8b_hw_onecell_data = {
2863 [CLKID_XTAL] = &meson8b_xtal.hw,
2864 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
2865 [CLKID_PLL_VID] = &meson8b_vid_pll.hw,
2866 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
2867 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
2868 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
2869 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
2870 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
2871 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
2872 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
2873 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
2874 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
2875 [CLKID_CLK81] = &meson8b_clk81.hw,
2876 [CLKID_DDR] = &meson8b_ddr.hw,
2877 [CLKID_DOS] = &meson8b_dos.hw,
2878 [CLKID_ISA] = &meson8b_isa.hw,
2879 [CLKID_PL301] = &meson8b_pl301.hw,
2880 [CLKID_PERIPHS] = &meson8b_periphs.hw,
2881 [CLKID_SPICC] = &meson8b_spicc.hw,
2882 [CLKID_I2C] = &meson8b_i2c.hw,
2883 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw,
2884 [CLKID_SMART_CARD] = &meson8b_smart_card.hw,
2885 [CLKID_RNG0] = &meson8b_rng0.hw,
2886 [CLKID_UART0] = &meson8b_uart0.hw,
2887 [CLKID_SDHC] = &meson8b_sdhc.hw,
2888 [CLKID_STREAM] = &meson8b_stream.hw,
2889 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw,
2890 [CLKID_SDIO] = &meson8b_sdio.hw,
2891 [CLKID_ABUF] = &meson8b_abuf.hw,
2892 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw,
2893 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw,
2894 [CLKID_SPI] = &meson8b_spi.hw,
2895 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw,
2896 [CLKID_ETH] = &meson8b_eth.hw,
2897 [CLKID_DEMUX] = &meson8b_demux.hw,
2898 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw,
2899 [CLKID_IEC958] = &meson8b_iec958.hw,
2900 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw,
2901 [CLKID_AMCLK] = &meson8b_amclk.hw,
2902 [CLKID_AIFIFO2] = &meson8b_aififo2.hw,
2903 [CLKID_MIXER] = &meson8b_mixer.hw,
2904 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw,
2905 [CLKID_ADC] = &meson8b_adc.hw,
2906 [CLKID_BLKMV] = &meson8b_blkmv.hw,
2907 [CLKID_AIU] = &meson8b_aiu.hw,
2908 [CLKID_UART1] = &meson8b_uart1.hw,
2909 [CLKID_G2D] = &meson8b_g2d.hw,
2910 [CLKID_USB0] = &meson8b_usb0.hw,
2911 [CLKID_USB1] = &meson8b_usb1.hw,
2912 [CLKID_RESET] = &meson8b_reset.hw,
2913 [CLKID_NAND] = &meson8b_nand.hw,
2914 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw,
2915 [CLKID_USB] = &meson8b_usb.hw,
2916 [CLKID_VDIN1] = &meson8b_vdin1.hw,
2917 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw,
2918 [CLKID_EFUSE] = &meson8b_efuse.hw,
2919 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw,
2920 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw,
2921 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw,
2922 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw,
2923 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw,
2924 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw,
2925 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw,
2926 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw,
2927 [CLKID_DVIN] = &meson8b_dvin.hw,
2928 [CLKID_UART2] = &meson8b_uart2.hw,
2929 [CLKID_SANA] = &meson8b_sana.hw,
2930 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw,
2931 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
2932 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw,
2933 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw,
2934 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw,
2935 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw,
2936 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw,
2937 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw,
2938 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw,
2939 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw,
2940 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw,
2941 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw,
2942 [CLKID_ENC480P] = &meson8b_enc480p.hw,
2943 [CLKID_RNG1] = &meson8b_rng1.hw,
2944 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw,
2945 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw,
2946 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw,
2947 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw,
2948 [CLKID_EDP] = &meson8b_edp.hw,
2949 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw,
2950 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw,
2951 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw,
2952 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw,
2953 [CLKID_MPLL0] = &meson8b_mpll0.hw,
2954 [CLKID_MPLL1] = &meson8b_mpll1.hw,
2955 [CLKID_MPLL2] = &meson8b_mpll2.hw,
2956 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw,
2957 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw,
2958 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw,
2959 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw,
2960 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw,
2961 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw,
2962 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw,
2963 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw,
2964 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw,
2965 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw,
2966 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw,
2967 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw,
2968 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw,
2969 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw,
2970 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw,
2971 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw,
2972 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw,
2973 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw,
2974 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw,
2975 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw,
2976 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw,
2977 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw,
2978 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw,
2979 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw,
2980 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw,
2981 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw,
2982 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw,
2983 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw,
2984 [CLKID_APB] = &meson8b_apb_clk_gate.hw,
2985 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw,
2986 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw,
2987 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw,
2988 [CLKID_AXI] = &meson8b_axi_clk_gate.hw,
2989 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw,
2990 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw,
2991 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw,
2992 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw,
2993 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw,
2994 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw,
2995 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw,
2996 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw,
2997 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw,
2998 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw,
2999 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw,
3000 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw,
3001 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw,
3002 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw,
3003 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw,
3004 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw,
3005 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw,
3006 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw,
3007 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw,
3008 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw,
3009 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw,
3010 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw,
3011 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw,
3012 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw,
3013 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw,
3014 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw,
3015 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw,
3016 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw,
3017 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw,
3018 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw,
3019 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw,
3020 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw,
3021 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw,
3022 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw,
3023 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw,
3024 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw,
3025 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw,
3026 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw,
3027 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw,
3028 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw,
3029 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw,
3030 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw,
3031 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw,
3032 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw,
3033 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw,
3034 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw,
3035 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw,
3036 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw,
3037 [CLKID_MALI_0] = &meson8b_mali_0.hw,
3038 [CLKID_MALI_1_SEL] = &meson8b_mali_1_sel.hw,
3039 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw,
3040 [CLKID_MALI_1] = &meson8b_mali_1.hw,
3041 [CLKID_MALI] = &meson8b_mali.hw,
3042 [CLKID_VPU_0_SEL] = &meson8b_vpu_0_sel.hw,
3043 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
3044 [CLKID_VPU_0] = &meson8b_vpu_0.hw,
3045 [CLKID_VPU_1_SEL] = &meson8b_vpu_1_sel.hw,
3046 [CLKID_VPU_1_DIV] = &meson8b_vpu_1_div.hw,
3047 [CLKID_VPU_1] = &meson8b_vpu_1.hw,
3048 [CLKID_VPU] = &meson8b_vpu.hw,
3049 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw,
3050 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw,
3051 [CLKID_VDEC_1_1] = &meson8b_vdec_1_1.hw,
3052 [CLKID_VDEC_1_2_DIV] = &meson8b_vdec_1_2_div.hw,
3053 [CLKID_VDEC_1_2] = &meson8b_vdec_1_2.hw,
3054 [CLKID_VDEC_1] = &meson8b_vdec_1.hw,
3055 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw,
3056 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw,
3057 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw,
3058 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw,
3059 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw,
3060 [CLKID_VDEC_2] = &meson8b_vdec_2.hw,
3061 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw,
3062 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw,
3063 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw,
3064 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw,
3065 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw,
3066 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw,
3067 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw,
3068 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw,
3069 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw,
3070 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
3071 [CLKID_CTS_I958] = &meson8b_cts_i958.hw,
3072 [CLK_NR_CLKS] = NULL,
3077 static struct clk_hw_onecell_data meson8m2_hw_onecell_data = {
3079 [CLKID_XTAL] = &meson8b_xtal.hw,
3080 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
3081 [CLKID_PLL_VID] = &meson8b_vid_pll.hw,
3082 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
3083 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
3084 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
3085 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
3086 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
3087 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
3088 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
3089 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
3090 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
3091 [CLKID_CLK81] = &meson8b_clk81.hw,
3092 [CLKID_DDR] = &meson8b_ddr.hw,
3093 [CLKID_DOS] = &meson8b_dos.hw,
3094 [CLKID_ISA] = &meson8b_isa.hw,
3095 [CLKID_PL301] = &meson8b_pl301.hw,
3096 [CLKID_PERIPHS] = &meson8b_periphs.hw,
3097 [CLKID_SPICC] = &meson8b_spicc.hw,
3098 [CLKID_I2C] = &meson8b_i2c.hw,
3099 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw,
3100 [CLKID_SMART_CARD] = &meson8b_smart_card.hw,
3101 [CLKID_RNG0] = &meson8b_rng0.hw,
3102 [CLKID_UART0] = &meson8b_uart0.hw,
3103 [CLKID_SDHC] = &meson8b_sdhc.hw,
3104 [CLKID_STREAM] = &meson8b_stream.hw,
3105 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw,
3106 [CLKID_SDIO] = &meson8b_sdio.hw,
3107 [CLKID_ABUF] = &meson8b_abuf.hw,
3108 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw,
3109 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw,
3110 [CLKID_SPI] = &meson8b_spi.hw,
3111 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw,
3112 [CLKID_ETH] = &meson8b_eth.hw,
3113 [CLKID_DEMUX] = &meson8b_demux.hw,
3114 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw,
3115 [CLKID_IEC958] = &meson8b_iec958.hw,
3116 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw,
3117 [CLKID_AMCLK] = &meson8b_amclk.hw,
3118 [CLKID_AIFIFO2] = &meson8b_aififo2.hw,
3119 [CLKID_MIXER] = &meson8b_mixer.hw,
3120 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw,
3121 [CLKID_ADC] = &meson8b_adc.hw,
3122 [CLKID_BLKMV] = &meson8b_blkmv.hw,
3123 [CLKID_AIU] = &meson8b_aiu.hw,
3124 [CLKID_UART1] = &meson8b_uart1.hw,
3125 [CLKID_G2D] = &meson8b_g2d.hw,
3126 [CLKID_USB0] = &meson8b_usb0.hw,
3127 [CLKID_USB1] = &meson8b_usb1.hw,
3128 [CLKID_RESET] = &meson8b_reset.hw,
3129 [CLKID_NAND] = &meson8b_nand.hw,
3130 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw,
3131 [CLKID_USB] = &meson8b_usb.hw,
3132 [CLKID_VDIN1] = &meson8b_vdin1.hw,
3133 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw,
3134 [CLKID_EFUSE] = &meson8b_efuse.hw,
3135 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw,
3136 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw,
3137 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw,
3138 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw,
3139 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw,
3140 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw,
3141 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw,
3142 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw,
3143 [CLKID_DVIN] = &meson8b_dvin.hw,
3144 [CLKID_UART2] = &meson8b_uart2.hw,
3145 [CLKID_SANA] = &meson8b_sana.hw,
3146 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw,
3147 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
3148 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw,
3149 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw,
3150 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw,
3151 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw,
3152 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw,
3153 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw,
3154 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw,
3155 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw,
3156 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw,
3157 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw,
3158 [CLKID_ENC480P] = &meson8b_enc480p.hw,
3159 [CLKID_RNG1] = &meson8b_rng1.hw,
3160 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw,
3161 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw,
3162 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw,
3163 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw,
3164 [CLKID_EDP] = &meson8b_edp.hw,
3165 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw,
3166 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw,
3167 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw,
3168 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw,
3169 [CLKID_MPLL0] = &meson8b_mpll0.hw,
3170 [CLKID_MPLL1] = &meson8b_mpll1.hw,
3171 [CLKID_MPLL2] = &meson8b_mpll2.hw,
3172 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw,
3173 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw,
3174 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw,
3175 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw,
3176 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw,
3177 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw,
3178 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw,
3179 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw,
3180 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw,
3181 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw,
3182 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw,
3183 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw,
3184 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw,
3185 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw,
3186 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw,
3187 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw,
3188 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw,
3189 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw,
3190 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw,
3191 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw,
3192 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw,
3193 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw,
3194 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw,
3195 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw,
3196 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw,
3197 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw,
3198 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw,
3199 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw,
3200 [CLKID_APB] = &meson8b_apb_clk_gate.hw,
3201 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw,
3202 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw,
3203 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw,
3204 [CLKID_AXI] = &meson8b_axi_clk_gate.hw,
3205 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw,
3206 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw,
3207 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw,
3208 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw,
3209 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw,
3210 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw,
3211 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw,
3212 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw,
3213 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw,
3214 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw,
3215 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw,
3216 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw,
3217 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw,
3218 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw,
3219 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw,
3220 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw,
3221 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw,
3222 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw,
3223 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw,
3224 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw,
3225 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw,
3226 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw,
3227 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw,
3228 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw,
3229 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw,
3230 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw,
3231 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw,
3232 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw,
3233 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw,
3234 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw,
3235 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw,
3236 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw,
3237 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw,
3238 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw,
3239 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw,
3240 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw,
3241 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw,
3242 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw,
3243 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw,
3244 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw,
3245 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw,
3246 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw,
3247 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw,
3248 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw,
3249 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw,
3250 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw,
3251 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw,
3252 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw,
3253 [CLKID_MALI_0] = &meson8b_mali_0.hw,
3254 [CLKID_MALI_1_SEL] = &meson8b_mali_1_sel.hw,
3255 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw,
3256 [CLKID_MALI_1] = &meson8b_mali_1.hw,
3257 [CLKID_MALI] = &meson8b_mali.hw,
3258 [CLKID_GP_PLL_DCO] = &meson8m2_gp_pll_dco.hw,
3259 [CLKID_GP_PLL] = &meson8m2_gp_pll.hw,
3260 [CLKID_VPU_0_SEL] = &meson8m2_vpu_0_sel.hw,
3261 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
3262 [CLKID_VPU_0] = &meson8b_vpu_0.hw,
3263 [CLKID_VPU_1_SEL] = &meson8m2_vpu_1_sel.hw,
3264 [CLKID_VPU_1_DIV] = &meson8b_vpu_1_div.hw,
3265 [CLKID_VPU_1] = &meson8b_vpu_1.hw,
3266 [CLKID_VPU] = &meson8b_vpu.hw,
3267 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw,
3268 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw,
3269 [CLKID_VDEC_1_1] = &meson8b_vdec_1_1.hw,
3270 [CLKID_VDEC_1_2_DIV] = &meson8b_vdec_1_2_div.hw,
3271 [CLKID_VDEC_1_2] = &meson8b_vdec_1_2.hw,
3272 [CLKID_VDEC_1] = &meson8b_vdec_1.hw,
3273 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw,
3274 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw,
3275 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw,
3276 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw,
3277 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw,
3278 [CLKID_VDEC_2] = &meson8b_vdec_2.hw,
3279 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw,
3280 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw,
3281 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw,
3282 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw,
3283 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw,
3284 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw,
3285 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw,
3286 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw,
3287 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw,
3288 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
3289 [CLKID_CTS_I958] = &meson8b_cts_i958.hw,
3290 [CLK_NR_CLKS] = NULL,
3295 static struct clk_regmap *const meson8b_clk_regmaps[] = {
3305 &meson8b_smart_card,
3310 &meson8b_async_fifo,
3314 &meson8b_assist_misc,
3325 &meson8b_mixer_iface,
3335 &meson8b_dos_parser,
3341 &meson8b_ahb_data_bus,
3342 &meson8b_ahb_ctrl_bus,
3343 &meson8b_hdmi_intr_sync,
3345 &meson8b_usb1_ddr_bridge,
3346 &meson8b_usb0_ddr_bridge,
3352 &meson8b_sec_ahb_ahb3_bridge,
3354 &meson8b_vclk2_venci0,
3355 &meson8b_vclk2_venci1,
3356 &meson8b_vclk2_vencp0,
3357 &meson8b_vclk2_vencp1,
3358 &meson8b_gclk_venci_int,
3359 &meson8b_gclk_vencp_int,
3361 &meson8b_aoclk_gate,
3362 &meson8b_iec958_gate,
3365 &meson8b_gclk_vencl_int,
3366 &meson8b_vclk2_venclmcc,
3367 &meson8b_vclk2_vencl,
3368 &meson8b_vclk2_other,
3370 &meson8b_ao_media_cpu,
3371 &meson8b_ao_ahb_sram,
3372 &meson8b_ao_ahb_bus,
3374 &meson8b_mpeg_clk_div,
3375 &meson8b_mpeg_clk_sel,
3384 &meson8b_cpu_in_sel,
3385 &meson8b_cpu_scale_div,
3386 &meson8b_cpu_scale_out_sel,
3388 &meson8b_mpll_prediv,
3394 &meson8b_nand_clk_sel,
3395 &meson8b_nand_clk_div,
3396 &meson8b_nand_clk_gate,
3397 &meson8b_fixed_pll_dco,
3398 &meson8b_hdmi_pll_dco,
3399 &meson8b_sys_pll_dco,
3400 &meson8b_apb_clk_sel,
3401 &meson8b_apb_clk_gate,
3402 &meson8b_periph_clk_sel,
3403 &meson8b_periph_clk_gate,
3404 &meson8b_axi_clk_sel,
3405 &meson8b_axi_clk_gate,
3406 &meson8b_l2_dram_clk_sel,
3407 &meson8b_l2_dram_clk_gate,
3408 &meson8b_hdmi_pll_lvds_out,
3409 &meson8b_hdmi_pll_hdmi_out,
3410 &meson8b_vid_pll_in_sel,
3411 &meson8b_vid_pll_in_en,
3412 &meson8b_vid_pll_pre_div,
3413 &meson8b_vid_pll_post_div,
3415 &meson8b_vid_pll_final_div,
3416 &meson8b_vclk_in_sel,
3417 &meson8b_vclk_in_en,
3418 &meson8b_vclk_div1_gate,
3419 &meson8b_vclk_div2_div_gate,
3420 &meson8b_vclk_div4_div_gate,
3421 &meson8b_vclk_div6_div_gate,
3422 &meson8b_vclk_div12_div_gate,
3423 &meson8b_vclk2_in_sel,
3424 &meson8b_vclk2_clk_in_en,
3425 &meson8b_vclk2_div1_gate,
3426 &meson8b_vclk2_div2_div_gate,
3427 &meson8b_vclk2_div4_div_gate,
3428 &meson8b_vclk2_div6_div_gate,
3429 &meson8b_vclk2_div12_div_gate,
3430 &meson8b_cts_enct_sel,
3432 &meson8b_cts_encp_sel,
3434 &meson8b_cts_enci_sel,
3436 &meson8b_hdmi_tx_pixel_sel,
3437 &meson8b_hdmi_tx_pixel,
3438 &meson8b_cts_encl_sel,
3440 &meson8b_cts_vdac0_sel,
3442 &meson8b_hdmi_sys_sel,
3443 &meson8b_hdmi_sys_div,
3445 &meson8b_mali_0_sel,
3446 &meson8b_mali_0_div,
3448 &meson8b_mali_1_sel,
3449 &meson8b_mali_1_div,
3452 &meson8m2_gp_pll_dco,
3455 &meson8m2_vpu_0_sel,
3459 &meson8m2_vpu_1_sel,
3463 &meson8b_vdec_1_sel,
3464 &meson8b_vdec_1_1_div,
3466 &meson8b_vdec_1_2_div,
3469 &meson8b_vdec_hcodec_sel,
3470 &meson8b_vdec_hcodec_div,
3471 &meson8b_vdec_hcodec,
3472 &meson8b_vdec_2_sel,
3473 &meson8b_vdec_2_div,
3475 &meson8b_vdec_hevc_sel,
3476 &meson8b_vdec_hevc_div,
3477 &meson8b_vdec_hevc_en,
3480 &meson8b_cts_amclk_sel,
3481 &meson8b_cts_amclk_div,
3482 &meson8b_cts_mclk_i958_sel,
3483 &meson8b_cts_mclk_i958_div,
3484 &meson8b_cts_mclk_i958,
3488 static const struct meson8b_clk_reset_line {
3491 } meson8b_clk_reset_bits[] = {
3492 [CLKC_RESET_L2_CACHE_SOFT_RESET] = {
3493 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 30
3495 [CLKC_RESET_AXI_64_TO_128_BRIDGE_A5_SOFT_RESET] = {
3496 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 29
3498 [CLKC_RESET_SCU_SOFT_RESET] = {
3499 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 28
3501 [CLKC_RESET_CPU3_SOFT_RESET] = {
3502 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 27
3504 [CLKC_RESET_CPU2_SOFT_RESET] = {
3505 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 26
3507 [CLKC_RESET_CPU1_SOFT_RESET] = {
3508 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 25
3510 [CLKC_RESET_CPU0_SOFT_RESET] = {
3511 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 24
3513 [CLKC_RESET_A5_GLOBAL_RESET] = {
3514 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 18
3516 [CLKC_RESET_A5_AXI_SOFT_RESET] = {
3517 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 17
3519 [CLKC_RESET_A5_ABP_SOFT_RESET] = {
3520 .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 16
3522 [CLKC_RESET_AXI_64_TO_128_BRIDGE_MMC_SOFT_RESET] = {
3523 .reg = HHI_SYS_CPU_CLK_CNTL1, .bit_idx = 30
3525 [CLKC_RESET_VID_CLK_CNTL_SOFT_RESET] = {
3526 .reg = HHI_VID_CLK_CNTL, .bit_idx = 15
3528 [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST] = {
3529 .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 7
3531 [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE] = {
3532 .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 3
3534 [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST] = {
3535 .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 1
3537 [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE] = {
3538 .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 0
3542 static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev,
3543 unsigned long id, bool assert)
3545 struct meson8b_clk_reset *meson8b_clk_reset =
3546 container_of(rcdev, struct meson8b_clk_reset, reset);
3547 unsigned long flags;
3548 const struct meson8b_clk_reset_line *reset;
3550 if (id >= ARRAY_SIZE(meson8b_clk_reset_bits))
3553 reset = &meson8b_clk_reset_bits[id];
3555 spin_lock_irqsave(&meson_clk_lock, flags);
3558 regmap_update_bits(meson8b_clk_reset->regmap, reset->reg,
3559 BIT(reset->bit_idx), BIT(reset->bit_idx));
3561 regmap_update_bits(meson8b_clk_reset->regmap, reset->reg,
3562 BIT(reset->bit_idx), 0);
3564 spin_unlock_irqrestore(&meson_clk_lock, flags);
3569 static int meson8b_clk_reset_assert(struct reset_controller_dev *rcdev,
3572 return meson8b_clk_reset_update(rcdev, id, true);
3575 static int meson8b_clk_reset_deassert(struct reset_controller_dev *rcdev,
3578 return meson8b_clk_reset_update(rcdev, id, false);
3581 static const struct reset_control_ops meson8b_clk_reset_ops = {
3582 .assert = meson8b_clk_reset_assert,
3583 .deassert = meson8b_clk_reset_deassert,
3586 struct meson8b_nb_data {
3587 struct notifier_block nb;
3588 struct clk_hw_onecell_data *onecell_data;
3591 static int meson8b_cpu_clk_notifier_cb(struct notifier_block *nb,
3592 unsigned long event, void *data)
3594 struct meson8b_nb_data *nb_data =
3595 container_of(nb, struct meson8b_nb_data, nb);
3596 struct clk_hw **hws = nb_data->onecell_data->hws;
3597 struct clk_hw *cpu_clk_hw, *parent_clk_hw;
3598 struct clk *cpu_clk, *parent_clk;
3602 case PRE_RATE_CHANGE:
3603 parent_clk_hw = hws[CLKID_XTAL];
3606 case POST_RATE_CHANGE:
3607 parent_clk_hw = hws[CLKID_CPU_SCALE_OUT_SEL];
3614 cpu_clk_hw = hws[CLKID_CPUCLK];
3615 cpu_clk = __clk_lookup(clk_hw_get_name(cpu_clk_hw));
3617 parent_clk = __clk_lookup(clk_hw_get_name(parent_clk_hw));
3619 ret = clk_set_parent(cpu_clk, parent_clk);
3621 return notifier_from_errno(ret);
3628 static struct meson8b_nb_data meson8b_cpu_nb_data = {
3629 .nb.notifier_call = meson8b_cpu_clk_notifier_cb,
3632 static const struct regmap_config clkc_regmap_config = {
3638 static void __init meson8b_clkc_init_common(struct device_node *np,
3639 struct clk_hw_onecell_data *clk_hw_onecell_data)
3641 struct meson8b_clk_reset *rstc;
3642 const char *notifier_clk_name;
3643 struct clk *notifier_clk;
3644 void __iomem *clk_base;
3648 map = syscon_node_to_regmap(of_get_parent(np));
3650 pr_info("failed to get HHI regmap - Trying obsolete regs\n");
3652 /* Generic clocks, PLLs and some of the reset-bits */
3653 clk_base = of_iomap(np, 1);
3655 pr_err("%s: Unable to map clk base\n", __func__);
3659 map = regmap_init_mmio(NULL, clk_base, &clkc_regmap_config);
3664 rstc = kzalloc(sizeof(*rstc), GFP_KERNEL);
3668 /* Reset Controller */
3670 rstc->reset.ops = &meson8b_clk_reset_ops;
3671 rstc->reset.nr_resets = ARRAY_SIZE(meson8b_clk_reset_bits);
3672 rstc->reset.of_node = np;
3673 ret = reset_controller_register(&rstc->reset);
3675 pr_err("%s: Failed to register clkc reset controller: %d\n",
3680 /* Populate regmap for the regmap backed clocks */
3681 for (i = 0; i < ARRAY_SIZE(meson8b_clk_regmaps); i++)
3682 meson8b_clk_regmaps[i]->map = map;
3686 * CLKID_UNUSED = 0, so skip it and start with CLKID_XTAL = 1
3688 for (i = CLKID_XTAL; i < CLK_NR_CLKS; i++) {
3689 /* array might be sparse */
3690 if (!clk_hw_onecell_data->hws[i])
3693 ret = clk_hw_register(NULL, clk_hw_onecell_data->hws[i]);
3698 meson8b_cpu_nb_data.onecell_data = clk_hw_onecell_data;
3701 * FIXME we shouldn't program the muxes in notifier handlers. The
3702 * tricky programming sequence will be handled by the forthcoming
3703 * coordinated clock rates mechanism once that feature is released.
3705 notifier_clk_name = clk_hw_get_name(&meson8b_cpu_scale_out_sel.hw);
3706 notifier_clk = __clk_lookup(notifier_clk_name);
3707 ret = clk_notifier_register(notifier_clk, &meson8b_cpu_nb_data.nb);
3709 pr_err("%s: failed to register the CPU clock notifier\n",
3714 ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get,
3715 clk_hw_onecell_data);
3717 pr_err("%s: failed to register clock provider\n", __func__);
3720 static void __init meson8_clkc_init(struct device_node *np)
3722 return meson8b_clkc_init_common(np, &meson8_hw_onecell_data);
3725 static void __init meson8b_clkc_init(struct device_node *np)
3727 return meson8b_clkc_init_common(np, &meson8b_hw_onecell_data);
3730 static void __init meson8m2_clkc_init(struct device_node *np)
3732 return meson8b_clkc_init_common(np, &meson8m2_hw_onecell_data);
3735 CLK_OF_DECLARE_DRIVER(meson8_clkc, "amlogic,meson8-clkc",
3737 CLK_OF_DECLARE_DRIVER(meson8b_clkc, "amlogic,meson8b-clkc",
3739 CLK_OF_DECLARE_DRIVER(meson8m2_clkc, "amlogic,meson8m2-clkc",
3740 meson8m2_clkc_init);