1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2015 Endless Mobile, Inc.
4 * Author: Carlo Caione <carlo@endlessm.com>
6 * Copyright (c) 2016 BayLibre, Inc.
7 * Michael Turquette <mturquette@baylibre.com>
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_regmap meson8b_fixed_pll_dco = {
56 .data = &(struct meson_clk_pll_data){
58 .reg_off = HHI_MPLL_CNTL,
63 .reg_off = HHI_MPLL_CNTL,
68 .reg_off = HHI_MPLL_CNTL,
73 .reg_off = HHI_MPLL_CNTL2,
78 .reg_off = HHI_MPLL_CNTL,
83 .reg_off = HHI_MPLL_CNTL,
88 .hw.init = &(struct clk_init_data){
89 .name = "fixed_pll_dco",
90 .ops = &meson_clk_pll_ro_ops,
91 .parent_data = &(const struct clk_parent_data) {
100 static struct clk_regmap meson8b_fixed_pll = {
101 .data = &(struct clk_regmap_div_data){
102 .offset = HHI_MPLL_CNTL,
105 .flags = CLK_DIVIDER_POWER_OF_TWO,
107 .hw.init = &(struct clk_init_data){
109 .ops = &clk_regmap_divider_ro_ops,
110 .parent_hws = (const struct clk_hw *[]) {
111 &meson8b_fixed_pll_dco.hw
115 * This clock won't ever change at runtime so
116 * CLK_SET_RATE_PARENT is not required
121 static struct clk_fixed_factor hdmi_pll_dco_in = {
124 .hw.init = &(struct clk_init_data){
125 .name = "hdmi_pll_dco_in",
126 .ops = &clk_fixed_factor_ops,
127 .parent_data = &(const struct clk_parent_data) {
136 * Taken from the vendor driver for the 2970/2975MHz (both only differ in the
137 * FRAC part in HHI_VID_PLL_CNTL2) where these values are identical for Meson8,
138 * Meson8b and Meson8m2. This doubles the input (or output - it's not clear
139 * which one but the result is the same) clock. The vendor driver additionally
140 * has the following comment about: "optimise HPLL VCO 2.97GHz performance".
142 static const struct reg_sequence meson8b_hdmi_pll_init_regs[] = {
143 { .reg = HHI_VID_PLL_CNTL2, .def = 0x69c84000 },
144 { .reg = HHI_VID_PLL_CNTL3, .def = 0x8a46c023 },
145 { .reg = HHI_VID_PLL_CNTL4, .def = 0x4123b100 },
146 { .reg = HHI_VID_PLL_CNTL5, .def = 0x00012385 },
147 { .reg = HHI_VID2_PLL_CNTL2, .def = 0x0430a800 },
150 static const struct pll_params_table hdmi_pll_params_table[] = {
171 static struct clk_regmap meson8b_hdmi_pll_dco = {
172 .data = &(struct meson_clk_pll_data){
174 .reg_off = HHI_VID_PLL_CNTL,
179 .reg_off = HHI_VID_PLL_CNTL,
184 .reg_off = HHI_VID_PLL_CNTL,
189 .reg_off = HHI_VID_PLL_CNTL2,
194 .reg_off = HHI_VID_PLL_CNTL,
199 .reg_off = HHI_VID_PLL_CNTL,
203 .table = hdmi_pll_params_table,
204 .init_regs = meson8b_hdmi_pll_init_regs,
205 .init_count = ARRAY_SIZE(meson8b_hdmi_pll_init_regs),
207 .hw.init = &(struct clk_init_data){
208 /* sometimes also called "HPLL" or "HPLL PLL" */
209 .name = "hdmi_pll_dco",
210 .ops = &meson_clk_pll_ops,
211 .parent_hws = (const struct clk_hw *[]) {
218 static struct clk_regmap meson8b_hdmi_pll_lvds_out = {
219 .data = &(struct clk_regmap_div_data){
220 .offset = HHI_VID_PLL_CNTL,
223 .flags = CLK_DIVIDER_POWER_OF_TWO,
225 .hw.init = &(struct clk_init_data){
226 .name = "hdmi_pll_lvds_out",
227 .ops = &clk_regmap_divider_ops,
228 .parent_hws = (const struct clk_hw *[]) {
229 &meson8b_hdmi_pll_dco.hw
232 .flags = CLK_SET_RATE_PARENT,
236 static struct clk_regmap meson8b_hdmi_pll_hdmi_out = {
237 .data = &(struct clk_regmap_div_data){
238 .offset = HHI_VID_PLL_CNTL,
241 .flags = CLK_DIVIDER_POWER_OF_TWO,
243 .hw.init = &(struct clk_init_data){
244 .name = "hdmi_pll_hdmi_out",
245 .ops = &clk_regmap_divider_ops,
246 .parent_hws = (const struct clk_hw *[]) {
247 &meson8b_hdmi_pll_dco.hw
250 .flags = CLK_SET_RATE_PARENT,
254 static struct clk_regmap meson8b_sys_pll_dco = {
255 .data = &(struct meson_clk_pll_data){
257 .reg_off = HHI_SYS_PLL_CNTL,
262 .reg_off = HHI_SYS_PLL_CNTL,
267 .reg_off = HHI_SYS_PLL_CNTL,
272 .reg_off = HHI_SYS_PLL_CNTL,
277 .reg_off = HHI_SYS_PLL_CNTL,
281 .table = sys_pll_params_table,
283 .hw.init = &(struct clk_init_data){
284 .name = "sys_pll_dco",
285 .ops = &meson_clk_pll_ops,
286 .parent_data = &(const struct clk_parent_data) {
295 static struct clk_regmap meson8b_sys_pll = {
296 .data = &(struct clk_regmap_div_data){
297 .offset = HHI_SYS_PLL_CNTL,
300 .flags = CLK_DIVIDER_POWER_OF_TWO,
302 .hw.init = &(struct clk_init_data){
304 .ops = &clk_regmap_divider_ops,
305 .parent_hws = (const struct clk_hw *[]) {
306 &meson8b_sys_pll_dco.hw
309 .flags = CLK_SET_RATE_PARENT,
313 static struct clk_fixed_factor meson8b_fclk_div2_div = {
316 .hw.init = &(struct clk_init_data){
317 .name = "fclk_div2_div",
318 .ops = &clk_fixed_factor_ops,
319 .parent_hws = (const struct clk_hw *[]) {
320 &meson8b_fixed_pll.hw
326 static struct clk_regmap meson8b_fclk_div2 = {
327 .data = &(struct clk_regmap_gate_data){
328 .offset = HHI_MPLL_CNTL6,
331 .hw.init = &(struct clk_init_data){
333 .ops = &clk_regmap_gate_ops,
334 .parent_hws = (const struct clk_hw *[]) {
335 &meson8b_fclk_div2_div.hw
341 static struct clk_fixed_factor meson8b_fclk_div3_div = {
344 .hw.init = &(struct clk_init_data){
345 .name = "fclk_div3_div",
346 .ops = &clk_fixed_factor_ops,
347 .parent_hws = (const struct clk_hw *[]) {
348 &meson8b_fixed_pll.hw
354 static struct clk_regmap meson8b_fclk_div3 = {
355 .data = &(struct clk_regmap_gate_data){
356 .offset = HHI_MPLL_CNTL6,
359 .hw.init = &(struct clk_init_data){
361 .ops = &clk_regmap_gate_ops,
362 .parent_hws = (const struct clk_hw *[]) {
363 &meson8b_fclk_div3_div.hw
369 static struct clk_fixed_factor meson8b_fclk_div4_div = {
372 .hw.init = &(struct clk_init_data){
373 .name = "fclk_div4_div",
374 .ops = &clk_fixed_factor_ops,
375 .parent_hws = (const struct clk_hw *[]) {
376 &meson8b_fixed_pll.hw
382 static struct clk_regmap meson8b_fclk_div4 = {
383 .data = &(struct clk_regmap_gate_data){
384 .offset = HHI_MPLL_CNTL6,
387 .hw.init = &(struct clk_init_data){
389 .ops = &clk_regmap_gate_ops,
390 .parent_hws = (const struct clk_hw *[]) {
391 &meson8b_fclk_div4_div.hw
397 static struct clk_fixed_factor meson8b_fclk_div5_div = {
400 .hw.init = &(struct clk_init_data){
401 .name = "fclk_div5_div",
402 .ops = &clk_fixed_factor_ops,
403 .parent_hws = (const struct clk_hw *[]) {
404 &meson8b_fixed_pll.hw
410 static struct clk_regmap meson8b_fclk_div5 = {
411 .data = &(struct clk_regmap_gate_data){
412 .offset = HHI_MPLL_CNTL6,
415 .hw.init = &(struct clk_init_data){
417 .ops = &clk_regmap_gate_ops,
418 .parent_hws = (const struct clk_hw *[]) {
419 &meson8b_fclk_div5_div.hw
425 static struct clk_fixed_factor meson8b_fclk_div7_div = {
428 .hw.init = &(struct clk_init_data){
429 .name = "fclk_div7_div",
430 .ops = &clk_fixed_factor_ops,
431 .parent_hws = (const struct clk_hw *[]) {
432 &meson8b_fixed_pll.hw
438 static struct clk_regmap meson8b_fclk_div7 = {
439 .data = &(struct clk_regmap_gate_data){
440 .offset = HHI_MPLL_CNTL6,
443 .hw.init = &(struct clk_init_data){
445 .ops = &clk_regmap_gate_ops,
446 .parent_hws = (const struct clk_hw *[]) {
447 &meson8b_fclk_div7_div.hw
453 static struct clk_regmap meson8b_mpll_prediv = {
454 .data = &(struct clk_regmap_div_data){
455 .offset = HHI_MPLL_CNTL5,
459 .hw.init = &(struct clk_init_data){
460 .name = "mpll_prediv",
461 .ops = &clk_regmap_divider_ro_ops,
462 .parent_hws = (const struct clk_hw *[]) {
463 &meson8b_fixed_pll.hw
469 static struct clk_regmap meson8b_mpll0_div = {
470 .data = &(struct meson_clk_mpll_data){
472 .reg_off = HHI_MPLL_CNTL7,
477 .reg_off = HHI_MPLL_CNTL7,
482 .reg_off = HHI_MPLL_CNTL7,
487 .reg_off = HHI_MPLL_CNTL,
491 .lock = &meson_clk_lock,
493 .hw.init = &(struct clk_init_data){
495 .ops = &meson_clk_mpll_ops,
496 .parent_hws = (const struct clk_hw *[]) {
497 &meson8b_mpll_prediv.hw
503 static struct clk_regmap meson8b_mpll0 = {
504 .data = &(struct clk_regmap_gate_data){
505 .offset = HHI_MPLL_CNTL7,
508 .hw.init = &(struct clk_init_data){
510 .ops = &clk_regmap_gate_ops,
511 .parent_hws = (const struct clk_hw *[]) {
512 &meson8b_mpll0_div.hw
515 .flags = CLK_SET_RATE_PARENT,
519 static struct clk_regmap meson8b_mpll1_div = {
520 .data = &(struct meson_clk_mpll_data){
522 .reg_off = HHI_MPLL_CNTL8,
527 .reg_off = HHI_MPLL_CNTL8,
532 .reg_off = HHI_MPLL_CNTL8,
536 .lock = &meson_clk_lock,
538 .hw.init = &(struct clk_init_data){
540 .ops = &meson_clk_mpll_ops,
541 .parent_hws = (const struct clk_hw *[]) {
542 &meson8b_mpll_prediv.hw
548 static struct clk_regmap meson8b_mpll1 = {
549 .data = &(struct clk_regmap_gate_data){
550 .offset = HHI_MPLL_CNTL8,
553 .hw.init = &(struct clk_init_data){
555 .ops = &clk_regmap_gate_ops,
556 .parent_hws = (const struct clk_hw *[]) {
557 &meson8b_mpll1_div.hw
560 .flags = CLK_SET_RATE_PARENT,
564 static struct clk_regmap meson8b_mpll2_div = {
565 .data = &(struct meson_clk_mpll_data){
567 .reg_off = HHI_MPLL_CNTL9,
572 .reg_off = HHI_MPLL_CNTL9,
577 .reg_off = HHI_MPLL_CNTL9,
581 .lock = &meson_clk_lock,
583 .hw.init = &(struct clk_init_data){
585 .ops = &meson_clk_mpll_ops,
586 .parent_hws = (const struct clk_hw *[]) {
587 &meson8b_mpll_prediv.hw
593 static struct clk_regmap meson8b_mpll2 = {
594 .data = &(struct clk_regmap_gate_data){
595 .offset = HHI_MPLL_CNTL9,
598 .hw.init = &(struct clk_init_data){
600 .ops = &clk_regmap_gate_ops,
601 .parent_hws = (const struct clk_hw *[]) {
602 &meson8b_mpll2_div.hw
605 .flags = CLK_SET_RATE_PARENT,
609 static u32 mux_table_clk81[] = { 6, 5, 7 };
610 static struct clk_regmap meson8b_mpeg_clk_sel = {
611 .data = &(struct clk_regmap_mux_data){
612 .offset = HHI_MPEG_CLK_CNTL,
615 .table = mux_table_clk81,
617 .hw.init = &(struct clk_init_data){
618 .name = "mpeg_clk_sel",
619 .ops = &clk_regmap_mux_ro_ops,
621 * FIXME bits 14:12 selects from 8 possible parents:
622 * xtal, 1'b0 (wtf), fclk_div7, mpll_clkout1, mpll_clkout2,
623 * fclk_div4, fclk_div3, fclk_div5
625 .parent_hws = (const struct clk_hw *[]) {
626 &meson8b_fclk_div3.hw,
627 &meson8b_fclk_div4.hw,
628 &meson8b_fclk_div5.hw,
634 static struct clk_regmap meson8b_mpeg_clk_div = {
635 .data = &(struct clk_regmap_div_data){
636 .offset = HHI_MPEG_CLK_CNTL,
640 .hw.init = &(struct clk_init_data){
641 .name = "mpeg_clk_div",
642 .ops = &clk_regmap_divider_ro_ops,
643 .parent_hws = (const struct clk_hw *[]) {
644 &meson8b_mpeg_clk_sel.hw
650 static struct clk_regmap meson8b_clk81 = {
651 .data = &(struct clk_regmap_gate_data){
652 .offset = HHI_MPEG_CLK_CNTL,
655 .hw.init = &(struct clk_init_data){
657 .ops = &clk_regmap_gate_ops,
658 .parent_hws = (const struct clk_hw *[]) {
659 &meson8b_mpeg_clk_div.hw
662 .flags = CLK_IS_CRITICAL,
666 static struct clk_regmap meson8b_cpu_in_sel = {
667 .data = &(struct clk_regmap_mux_data){
668 .offset = HHI_SYS_CPU_CLK_CNTL0,
672 .hw.init = &(struct clk_init_data){
673 .name = "cpu_in_sel",
674 .ops = &clk_regmap_mux_ops,
675 .parent_data = (const struct clk_parent_data[]) {
676 { .fw_name = "xtal", .name = "xtal", .index = -1, },
677 { .hw = &meson8b_sys_pll.hw, },
680 .flags = (CLK_SET_RATE_PARENT |
681 CLK_SET_RATE_NO_REPARENT),
685 static struct clk_fixed_factor meson8b_cpu_in_div2 = {
688 .hw.init = &(struct clk_init_data){
689 .name = "cpu_in_div2",
690 .ops = &clk_fixed_factor_ops,
691 .parent_hws = (const struct clk_hw *[]) {
692 &meson8b_cpu_in_sel.hw
695 .flags = CLK_SET_RATE_PARENT,
699 static struct clk_fixed_factor meson8b_cpu_in_div3 = {
702 .hw.init = &(struct clk_init_data){
703 .name = "cpu_in_div3",
704 .ops = &clk_fixed_factor_ops,
705 .parent_hws = (const struct clk_hw *[]) {
706 &meson8b_cpu_in_sel.hw
709 .flags = CLK_SET_RATE_PARENT,
713 static const struct clk_div_table cpu_scale_table[] = {
714 { .val = 1, .div = 4 },
715 { .val = 2, .div = 6 },
716 { .val = 3, .div = 8 },
717 { .val = 4, .div = 10 },
718 { .val = 5, .div = 12 },
719 { .val = 6, .div = 14 },
720 { .val = 7, .div = 16 },
721 { .val = 8, .div = 18 },
725 static struct clk_regmap meson8b_cpu_scale_div = {
726 .data = &(struct clk_regmap_div_data){
727 .offset = HHI_SYS_CPU_CLK_CNTL1,
730 .table = cpu_scale_table,
731 .flags = CLK_DIVIDER_ALLOW_ZERO,
733 .hw.init = &(struct clk_init_data){
734 .name = "cpu_scale_div",
735 .ops = &clk_regmap_divider_ops,
736 .parent_hws = (const struct clk_hw *[]) {
737 &meson8b_cpu_in_sel.hw
740 .flags = CLK_SET_RATE_PARENT,
744 static u32 mux_table_cpu_scale_out_sel[] = { 0, 1, 3 };
745 static struct clk_regmap meson8b_cpu_scale_out_sel = {
746 .data = &(struct clk_regmap_mux_data){
747 .offset = HHI_SYS_CPU_CLK_CNTL0,
750 .table = mux_table_cpu_scale_out_sel,
752 .hw.init = &(struct clk_init_data){
753 .name = "cpu_scale_out_sel",
754 .ops = &clk_regmap_mux_ops,
756 * NOTE: We are skipping the parent with value 0x2 (which is
757 * meson8b_cpu_in_div3) because it results in a duty cycle of
758 * 33% which makes the system unstable and can result in a
759 * lockup of the whole system.
761 .parent_hws = (const struct clk_hw *[]) {
762 &meson8b_cpu_in_sel.hw,
763 &meson8b_cpu_in_div2.hw,
764 &meson8b_cpu_scale_div.hw,
767 .flags = CLK_SET_RATE_PARENT,
771 static struct clk_regmap meson8b_cpu_clk = {
772 .data = &(struct clk_regmap_mux_data){
773 .offset = HHI_SYS_CPU_CLK_CNTL0,
777 .hw.init = &(struct clk_init_data){
779 .ops = &clk_regmap_mux_ops,
780 .parent_data = (const struct clk_parent_data[]) {
781 { .fw_name = "xtal", .name = "xtal", .index = -1, },
782 { .hw = &meson8b_cpu_scale_out_sel.hw, },
785 .flags = (CLK_SET_RATE_PARENT |
786 CLK_SET_RATE_NO_REPARENT |
791 static struct clk_regmap meson8b_nand_clk_sel = {
792 .data = &(struct clk_regmap_mux_data){
793 .offset = HHI_NAND_CLK_CNTL,
796 .flags = CLK_MUX_ROUND_CLOSEST,
798 .hw.init = &(struct clk_init_data){
799 .name = "nand_clk_sel",
800 .ops = &clk_regmap_mux_ops,
801 /* FIXME all other parents are unknown: */
802 .parent_data = (const struct clk_parent_data[]) {
803 { .hw = &meson8b_fclk_div4.hw, },
804 { .hw = &meson8b_fclk_div3.hw, },
805 { .hw = &meson8b_fclk_div5.hw, },
806 { .hw = &meson8b_fclk_div7.hw, },
807 { .fw_name = "xtal", .name = "xtal", .index = -1, },
810 .flags = CLK_SET_RATE_PARENT,
814 static struct clk_regmap meson8b_nand_clk_div = {
815 .data = &(struct clk_regmap_div_data){
816 .offset = HHI_NAND_CLK_CNTL,
819 .flags = CLK_DIVIDER_ROUND_CLOSEST,
821 .hw.init = &(struct clk_init_data){
822 .name = "nand_clk_div",
823 .ops = &clk_regmap_divider_ops,
824 .parent_hws = (const struct clk_hw *[]) {
825 &meson8b_nand_clk_sel.hw
828 .flags = CLK_SET_RATE_PARENT,
832 static struct clk_regmap meson8b_nand_clk_gate = {
833 .data = &(struct clk_regmap_gate_data){
834 .offset = HHI_NAND_CLK_CNTL,
837 .hw.init = &(struct clk_init_data){
838 .name = "nand_clk_gate",
839 .ops = &clk_regmap_gate_ops,
840 .parent_hws = (const struct clk_hw *[]) {
841 &meson8b_nand_clk_div.hw
844 .flags = CLK_SET_RATE_PARENT,
848 static struct clk_fixed_factor meson8b_cpu_clk_div2 = {
851 .hw.init = &(struct clk_init_data){
852 .name = "cpu_clk_div2",
853 .ops = &clk_fixed_factor_ops,
854 .parent_hws = (const struct clk_hw *[]) {
861 static struct clk_fixed_factor meson8b_cpu_clk_div3 = {
864 .hw.init = &(struct clk_init_data){
865 .name = "cpu_clk_div3",
866 .ops = &clk_fixed_factor_ops,
867 .parent_hws = (const struct clk_hw *[]) {
874 static struct clk_fixed_factor meson8b_cpu_clk_div4 = {
877 .hw.init = &(struct clk_init_data){
878 .name = "cpu_clk_div4",
879 .ops = &clk_fixed_factor_ops,
880 .parent_hws = (const struct clk_hw *[]) {
887 static struct clk_fixed_factor meson8b_cpu_clk_div5 = {
890 .hw.init = &(struct clk_init_data){
891 .name = "cpu_clk_div5",
892 .ops = &clk_fixed_factor_ops,
893 .parent_hws = (const struct clk_hw *[]) {
900 static struct clk_fixed_factor meson8b_cpu_clk_div6 = {
903 .hw.init = &(struct clk_init_data){
904 .name = "cpu_clk_div6",
905 .ops = &clk_fixed_factor_ops,
906 .parent_hws = (const struct clk_hw *[]) {
913 static struct clk_fixed_factor meson8b_cpu_clk_div7 = {
916 .hw.init = &(struct clk_init_data){
917 .name = "cpu_clk_div7",
918 .ops = &clk_fixed_factor_ops,
919 .parent_hws = (const struct clk_hw *[]) {
926 static struct clk_fixed_factor meson8b_cpu_clk_div8 = {
929 .hw.init = &(struct clk_init_data){
930 .name = "cpu_clk_div8",
931 .ops = &clk_fixed_factor_ops,
932 .parent_hws = (const struct clk_hw *[]) {
939 static u32 mux_table_apb[] = { 1, 2, 3, 4, 5, 6, 7 };
940 static struct clk_regmap meson8b_apb_clk_sel = {
941 .data = &(struct clk_regmap_mux_data){
942 .offset = HHI_SYS_CPU_CLK_CNTL1,
945 .table = mux_table_apb,
947 .hw.init = &(struct clk_init_data){
948 .name = "apb_clk_sel",
949 .ops = &clk_regmap_mux_ops,
950 .parent_hws = (const struct clk_hw *[]) {
951 &meson8b_cpu_clk_div2.hw,
952 &meson8b_cpu_clk_div3.hw,
953 &meson8b_cpu_clk_div4.hw,
954 &meson8b_cpu_clk_div5.hw,
955 &meson8b_cpu_clk_div6.hw,
956 &meson8b_cpu_clk_div7.hw,
957 &meson8b_cpu_clk_div8.hw,
963 static struct clk_regmap meson8b_apb_clk_gate = {
964 .data = &(struct clk_regmap_gate_data){
965 .offset = HHI_SYS_CPU_CLK_CNTL1,
967 .flags = CLK_GATE_SET_TO_DISABLE,
969 .hw.init = &(struct clk_init_data){
970 .name = "apb_clk_dis",
971 .ops = &clk_regmap_gate_ro_ops,
972 .parent_hws = (const struct clk_hw *[]) {
973 &meson8b_apb_clk_sel.hw
976 .flags = CLK_SET_RATE_PARENT,
980 static struct clk_regmap meson8b_periph_clk_sel = {
981 .data = &(struct clk_regmap_mux_data){
982 .offset = HHI_SYS_CPU_CLK_CNTL1,
986 .hw.init = &(struct clk_init_data){
987 .name = "periph_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_periph_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 = "periph_clk_dis",
1010 .ops = &clk_regmap_gate_ro_ops,
1011 .parent_hws = (const struct clk_hw *[]) {
1012 &meson8b_periph_clk_sel.hw
1015 .flags = CLK_SET_RATE_PARENT,
1019 static u32 mux_table_axi[] = { 1, 2, 3, 4, 5, 6, 7 };
1020 static struct clk_regmap meson8b_axi_clk_sel = {
1021 .data = &(struct clk_regmap_mux_data){
1022 .offset = HHI_SYS_CPU_CLK_CNTL1,
1025 .table = mux_table_axi,
1027 .hw.init = &(struct clk_init_data){
1028 .name = "axi_clk_sel",
1029 .ops = &clk_regmap_mux_ops,
1030 .parent_hws = (const struct clk_hw *[]) {
1031 &meson8b_cpu_clk_div2.hw,
1032 &meson8b_cpu_clk_div3.hw,
1033 &meson8b_cpu_clk_div4.hw,
1034 &meson8b_cpu_clk_div5.hw,
1035 &meson8b_cpu_clk_div6.hw,
1036 &meson8b_cpu_clk_div7.hw,
1037 &meson8b_cpu_clk_div8.hw,
1043 static struct clk_regmap meson8b_axi_clk_gate = {
1044 .data = &(struct clk_regmap_gate_data){
1045 .offset = HHI_SYS_CPU_CLK_CNTL1,
1047 .flags = CLK_GATE_SET_TO_DISABLE,
1049 .hw.init = &(struct clk_init_data){
1050 .name = "axi_clk_dis",
1051 .ops = &clk_regmap_gate_ro_ops,
1052 .parent_hws = (const struct clk_hw *[]) {
1053 &meson8b_axi_clk_sel.hw
1056 .flags = CLK_SET_RATE_PARENT,
1060 static struct clk_regmap meson8b_l2_dram_clk_sel = {
1061 .data = &(struct clk_regmap_mux_data){
1062 .offset = HHI_SYS_CPU_CLK_CNTL1,
1066 .hw.init = &(struct clk_init_data){
1067 .name = "l2_dram_clk_sel",
1068 .ops = &clk_regmap_mux_ops,
1069 .parent_hws = (const struct clk_hw *[]) {
1070 &meson8b_cpu_clk_div2.hw,
1071 &meson8b_cpu_clk_div3.hw,
1072 &meson8b_cpu_clk_div4.hw,
1073 &meson8b_cpu_clk_div5.hw,
1074 &meson8b_cpu_clk_div6.hw,
1075 &meson8b_cpu_clk_div7.hw,
1076 &meson8b_cpu_clk_div8.hw,
1082 static struct clk_regmap meson8b_l2_dram_clk_gate = {
1083 .data = &(struct clk_regmap_gate_data){
1084 .offset = HHI_SYS_CPU_CLK_CNTL1,
1086 .flags = CLK_GATE_SET_TO_DISABLE,
1088 .hw.init = &(struct clk_init_data){
1089 .name = "l2_dram_clk_dis",
1090 .ops = &clk_regmap_gate_ro_ops,
1091 .parent_hws = (const struct clk_hw *[]) {
1092 &meson8b_l2_dram_clk_sel.hw
1095 .flags = CLK_SET_RATE_PARENT,
1099 /* also called LVDS_CLK_EN */
1100 static struct clk_regmap meson8b_vid_pll_lvds_en = {
1101 .data = &(struct clk_regmap_gate_data){
1102 .offset = HHI_VID_DIVIDER_CNTL,
1105 .hw.init = &(struct clk_init_data){
1106 .name = "vid_pll_lvds_en",
1107 .ops = &clk_regmap_gate_ops,
1108 .parent_hws = (const struct clk_hw *[]) {
1109 &meson8b_hdmi_pll_lvds_out.hw
1112 .flags = CLK_SET_RATE_PARENT,
1116 static struct clk_regmap meson8b_vid_pll_in_sel = {
1117 .data = &(struct clk_regmap_mux_data){
1118 .offset = HHI_VID_DIVIDER_CNTL,
1122 .hw.init = &(struct clk_init_data){
1123 .name = "vid_pll_in_sel",
1124 .ops = &clk_regmap_mux_ops,
1126 * TODO: depending on the SoC there is also a second parent:
1128 * Meson8b: hdmi_pll_dco
1129 * Meson8m2: vid2_pll
1131 .parent_hws = (const struct clk_hw *[]) {
1132 &meson8b_vid_pll_lvds_en.hw
1135 .flags = CLK_SET_RATE_PARENT,
1139 static struct clk_regmap meson8b_vid_pll_in_en = {
1140 .data = &(struct clk_regmap_gate_data){
1141 .offset = HHI_VID_DIVIDER_CNTL,
1144 .hw.init = &(struct clk_init_data){
1145 .name = "vid_pll_in_en",
1146 .ops = &clk_regmap_gate_ops,
1147 .parent_hws = (const struct clk_hw *[]) {
1148 &meson8b_vid_pll_in_sel.hw
1151 .flags = CLK_SET_RATE_PARENT,
1155 static struct clk_regmap meson8b_vid_pll_pre_div = {
1156 .data = &(struct clk_regmap_div_data){
1157 .offset = HHI_VID_DIVIDER_CNTL,
1161 .hw.init = &(struct clk_init_data){
1162 .name = "vid_pll_pre_div",
1163 .ops = &clk_regmap_divider_ops,
1164 .parent_hws = (const struct clk_hw *[]) {
1165 &meson8b_vid_pll_in_en.hw
1168 .flags = CLK_SET_RATE_PARENT,
1172 static struct clk_regmap meson8b_vid_pll_post_div = {
1173 .data = &(struct clk_regmap_div_data){
1174 .offset = HHI_VID_DIVIDER_CNTL,
1178 .hw.init = &(struct clk_init_data){
1179 .name = "vid_pll_post_div",
1180 .ops = &clk_regmap_divider_ops,
1181 .parent_hws = (const struct clk_hw *[]) {
1182 &meson8b_vid_pll_pre_div.hw
1185 .flags = CLK_SET_RATE_PARENT,
1189 static struct clk_regmap meson8b_vid_pll = {
1190 .data = &(struct clk_regmap_mux_data){
1191 .offset = HHI_VID_DIVIDER_CNTL,
1195 .hw.init = &(struct clk_init_data){
1197 .ops = &clk_regmap_mux_ops,
1198 /* TODO: parent 0x2 is vid_pll_pre_div_mult7_div2 */
1199 .parent_hws = (const struct clk_hw *[]) {
1200 &meson8b_vid_pll_pre_div.hw,
1201 &meson8b_vid_pll_post_div.hw,
1204 .flags = CLK_SET_RATE_PARENT,
1208 static struct clk_regmap meson8b_vid_pll_final_div = {
1209 .data = &(struct clk_regmap_div_data){
1210 .offset = HHI_VID_CLK_DIV,
1214 .hw.init = &(struct clk_init_data){
1215 .name = "vid_pll_final_div",
1216 .ops = &clk_regmap_divider_ops,
1217 .parent_hws = (const struct clk_hw *[]) {
1221 .flags = CLK_SET_RATE_PARENT,
1225 static const struct clk_hw *meson8b_vclk_mux_parent_hws[] = {
1226 &meson8b_vid_pll_final_div.hw,
1227 &meson8b_fclk_div4.hw,
1228 &meson8b_fclk_div3.hw,
1229 &meson8b_fclk_div5.hw,
1230 &meson8b_vid_pll_final_div.hw,
1231 &meson8b_fclk_div7.hw,
1235 static struct clk_regmap meson8b_vclk_in_sel = {
1236 .data = &(struct clk_regmap_mux_data){
1237 .offset = HHI_VID_CLK_CNTL,
1241 .hw.init = &(struct clk_init_data){
1242 .name = "vclk_in_sel",
1243 .ops = &clk_regmap_mux_ops,
1244 .parent_hws = meson8b_vclk_mux_parent_hws,
1245 .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws),
1246 .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
1250 static struct clk_regmap meson8b_vclk_in_en = {
1251 .data = &(struct clk_regmap_gate_data){
1252 .offset = HHI_VID_CLK_DIV,
1255 .hw.init = &(struct clk_init_data){
1256 .name = "vclk_in_en",
1257 .ops = &clk_regmap_gate_ops,
1258 .parent_hws = (const struct clk_hw *[]) {
1259 &meson8b_vclk_in_sel.hw
1262 .flags = CLK_SET_RATE_PARENT,
1266 static struct clk_regmap meson8b_vclk_en = {
1267 .data = &(struct clk_regmap_gate_data){
1268 .offset = HHI_VID_CLK_CNTL,
1271 .hw.init = &(struct clk_init_data){
1273 .ops = &clk_regmap_gate_ops,
1274 .parent_hws = (const struct clk_hw *[]) {
1275 &meson8b_vclk_in_en.hw
1278 .flags = CLK_SET_RATE_PARENT,
1282 static struct clk_regmap meson8b_vclk_div1_gate = {
1283 .data = &(struct clk_regmap_gate_data){
1284 .offset = HHI_VID_CLK_CNTL,
1287 .hw.init = &(struct clk_init_data){
1288 .name = "vclk_div1_en",
1289 .ops = &clk_regmap_gate_ops,
1290 .parent_hws = (const struct clk_hw *[]) {
1294 .flags = CLK_SET_RATE_PARENT,
1298 static struct clk_fixed_factor meson8b_vclk_div2_div = {
1301 .hw.init = &(struct clk_init_data){
1302 .name = "vclk_div2",
1303 .ops = &clk_fixed_factor_ops,
1304 .parent_hws = (const struct clk_hw *[]) {
1308 .flags = CLK_SET_RATE_PARENT,
1312 static struct clk_regmap meson8b_vclk_div2_div_gate = {
1313 .data = &(struct clk_regmap_gate_data){
1314 .offset = HHI_VID_CLK_CNTL,
1317 .hw.init = &(struct clk_init_data){
1318 .name = "vclk_div2_en",
1319 .ops = &clk_regmap_gate_ops,
1320 .parent_hws = (const struct clk_hw *[]) {
1321 &meson8b_vclk_div2_div.hw
1324 .flags = CLK_SET_RATE_PARENT,
1328 static struct clk_fixed_factor meson8b_vclk_div4_div = {
1331 .hw.init = &(struct clk_init_data){
1332 .name = "vclk_div4",
1333 .ops = &clk_fixed_factor_ops,
1334 .parent_hws = (const struct clk_hw *[]) {
1338 .flags = CLK_SET_RATE_PARENT,
1342 static struct clk_regmap meson8b_vclk_div4_div_gate = {
1343 .data = &(struct clk_regmap_gate_data){
1344 .offset = HHI_VID_CLK_CNTL,
1347 .hw.init = &(struct clk_init_data){
1348 .name = "vclk_div4_en",
1349 .ops = &clk_regmap_gate_ops,
1350 .parent_hws = (const struct clk_hw *[]) {
1351 &meson8b_vclk_div4_div.hw
1354 .flags = CLK_SET_RATE_PARENT,
1358 static struct clk_fixed_factor meson8b_vclk_div6_div = {
1361 .hw.init = &(struct clk_init_data){
1362 .name = "vclk_div6",
1363 .ops = &clk_fixed_factor_ops,
1364 .parent_hws = (const struct clk_hw *[]) {
1368 .flags = CLK_SET_RATE_PARENT,
1372 static struct clk_regmap meson8b_vclk_div6_div_gate = {
1373 .data = &(struct clk_regmap_gate_data){
1374 .offset = HHI_VID_CLK_CNTL,
1377 .hw.init = &(struct clk_init_data){
1378 .name = "vclk_div6_en",
1379 .ops = &clk_regmap_gate_ops,
1380 .parent_hws = (const struct clk_hw *[]) {
1381 &meson8b_vclk_div6_div.hw
1384 .flags = CLK_SET_RATE_PARENT,
1388 static struct clk_fixed_factor meson8b_vclk_div12_div = {
1391 .hw.init = &(struct clk_init_data){
1392 .name = "vclk_div12",
1393 .ops = &clk_fixed_factor_ops,
1394 .parent_hws = (const struct clk_hw *[]) {
1398 .flags = CLK_SET_RATE_PARENT,
1402 static struct clk_regmap meson8b_vclk_div12_div_gate = {
1403 .data = &(struct clk_regmap_gate_data){
1404 .offset = HHI_VID_CLK_CNTL,
1407 .hw.init = &(struct clk_init_data){
1408 .name = "vclk_div12_en",
1409 .ops = &clk_regmap_gate_ops,
1410 .parent_hws = (const struct clk_hw *[]) {
1411 &meson8b_vclk_div12_div.hw
1414 .flags = CLK_SET_RATE_PARENT,
1418 static struct clk_regmap meson8b_vclk2_in_sel = {
1419 .data = &(struct clk_regmap_mux_data){
1420 .offset = HHI_VIID_CLK_CNTL,
1424 .hw.init = &(struct clk_init_data){
1425 .name = "vclk2_in_sel",
1426 .ops = &clk_regmap_mux_ops,
1427 .parent_hws = meson8b_vclk_mux_parent_hws,
1428 .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws),
1429 .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
1433 static struct clk_regmap meson8b_vclk2_clk_in_en = {
1434 .data = &(struct clk_regmap_gate_data){
1435 .offset = HHI_VIID_CLK_DIV,
1438 .hw.init = &(struct clk_init_data){
1439 .name = "vclk2_in_en",
1440 .ops = &clk_regmap_gate_ops,
1441 .parent_hws = (const struct clk_hw *[]) {
1442 &meson8b_vclk2_in_sel.hw
1445 .flags = CLK_SET_RATE_PARENT,
1449 static struct clk_regmap meson8b_vclk2_clk_en = {
1450 .data = &(struct clk_regmap_gate_data){
1451 .offset = HHI_VIID_CLK_DIV,
1454 .hw.init = &(struct clk_init_data){
1456 .ops = &clk_regmap_gate_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_div1_gate = {
1466 .data = &(struct clk_regmap_gate_data){
1467 .offset = HHI_VIID_CLK_DIV,
1470 .hw.init = &(struct clk_init_data){
1471 .name = "vclk2_div1_en",
1472 .ops = &clk_regmap_gate_ops,
1473 .parent_hws = (const struct clk_hw *[]) {
1474 &meson8b_vclk2_clk_en.hw
1477 .flags = CLK_SET_RATE_PARENT,
1481 static struct clk_fixed_factor meson8b_vclk2_div2_div = {
1484 .hw.init = &(struct clk_init_data){
1485 .name = "vclk2_div2",
1486 .ops = &clk_fixed_factor_ops,
1487 .parent_hws = (const struct clk_hw *[]) {
1488 &meson8b_vclk2_clk_en.hw
1491 .flags = CLK_SET_RATE_PARENT,
1495 static struct clk_regmap meson8b_vclk2_div2_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_div2_en",
1502 .ops = &clk_regmap_gate_ops,
1503 .parent_hws = (const struct clk_hw *[]) {
1504 &meson8b_vclk2_div2_div.hw
1507 .flags = CLK_SET_RATE_PARENT,
1511 static struct clk_fixed_factor meson8b_vclk2_div4_div = {
1514 .hw.init = &(struct clk_init_data){
1515 .name = "vclk2_div4",
1516 .ops = &clk_fixed_factor_ops,
1517 .parent_hws = (const struct clk_hw *[]) {
1518 &meson8b_vclk2_clk_en.hw
1521 .flags = CLK_SET_RATE_PARENT,
1525 static struct clk_regmap meson8b_vclk2_div4_div_gate = {
1526 .data = &(struct clk_regmap_gate_data){
1527 .offset = HHI_VIID_CLK_DIV,
1530 .hw.init = &(struct clk_init_data){
1531 .name = "vclk2_div4_en",
1532 .ops = &clk_regmap_gate_ops,
1533 .parent_hws = (const struct clk_hw *[]) {
1534 &meson8b_vclk2_div4_div.hw
1537 .flags = CLK_SET_RATE_PARENT,
1541 static struct clk_fixed_factor meson8b_vclk2_div6_div = {
1544 .hw.init = &(struct clk_init_data){
1545 .name = "vclk2_div6",
1546 .ops = &clk_fixed_factor_ops,
1547 .parent_hws = (const struct clk_hw *[]) {
1548 &meson8b_vclk2_clk_en.hw
1551 .flags = CLK_SET_RATE_PARENT,
1555 static struct clk_regmap meson8b_vclk2_div6_div_gate = {
1556 .data = &(struct clk_regmap_gate_data){
1557 .offset = HHI_VIID_CLK_DIV,
1560 .hw.init = &(struct clk_init_data){
1561 .name = "vclk2_div6_en",
1562 .ops = &clk_regmap_gate_ops,
1563 .parent_hws = (const struct clk_hw *[]) {
1564 &meson8b_vclk2_div6_div.hw
1567 .flags = CLK_SET_RATE_PARENT,
1571 static struct clk_fixed_factor meson8b_vclk2_div12_div = {
1574 .hw.init = &(struct clk_init_data){
1575 .name = "vclk2_div12",
1576 .ops = &clk_fixed_factor_ops,
1577 .parent_hws = (const struct clk_hw *[]) {
1578 &meson8b_vclk2_clk_en.hw
1581 .flags = CLK_SET_RATE_PARENT,
1585 static struct clk_regmap meson8b_vclk2_div12_div_gate = {
1586 .data = &(struct clk_regmap_gate_data){
1587 .offset = HHI_VIID_CLK_DIV,
1590 .hw.init = &(struct clk_init_data){
1591 .name = "vclk2_div12_en",
1592 .ops = &clk_regmap_gate_ops,
1593 .parent_hws = (const struct clk_hw *[]) {
1594 &meson8b_vclk2_div12_div.hw
1597 .flags = CLK_SET_RATE_PARENT,
1601 static const struct clk_hw *meson8b_vclk_enc_mux_parent_hws[] = {
1602 &meson8b_vclk_div1_gate.hw,
1603 &meson8b_vclk_div2_div_gate.hw,
1604 &meson8b_vclk_div4_div_gate.hw,
1605 &meson8b_vclk_div6_div_gate.hw,
1606 &meson8b_vclk_div12_div_gate.hw,
1609 static struct clk_regmap meson8b_cts_enct_sel = {
1610 .data = &(struct clk_regmap_mux_data){
1611 .offset = HHI_VID_CLK_DIV,
1615 .hw.init = &(struct clk_init_data){
1616 .name = "cts_enct_sel",
1617 .ops = &clk_regmap_mux_ops,
1618 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1619 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1620 .flags = CLK_SET_RATE_PARENT,
1624 static struct clk_regmap meson8b_cts_enct = {
1625 .data = &(struct clk_regmap_gate_data){
1626 .offset = HHI_VID_CLK_CNTL2,
1629 .hw.init = &(struct clk_init_data){
1631 .ops = &clk_regmap_gate_ops,
1632 .parent_hws = (const struct clk_hw *[]) {
1633 &meson8b_cts_enct_sel.hw
1636 .flags = CLK_SET_RATE_PARENT,
1640 static struct clk_regmap meson8b_cts_encp_sel = {
1641 .data = &(struct clk_regmap_mux_data){
1642 .offset = HHI_VID_CLK_DIV,
1646 .hw.init = &(struct clk_init_data){
1647 .name = "cts_encp_sel",
1648 .ops = &clk_regmap_mux_ops,
1649 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1650 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1651 .flags = CLK_SET_RATE_PARENT,
1655 static struct clk_regmap meson8b_cts_encp = {
1656 .data = &(struct clk_regmap_gate_data){
1657 .offset = HHI_VID_CLK_CNTL2,
1660 .hw.init = &(struct clk_init_data){
1662 .ops = &clk_regmap_gate_ops,
1663 .parent_hws = (const struct clk_hw *[]) {
1664 &meson8b_cts_encp_sel.hw
1667 .flags = CLK_SET_RATE_PARENT,
1671 static struct clk_regmap meson8b_cts_enci_sel = {
1672 .data = &(struct clk_regmap_mux_data){
1673 .offset = HHI_VID_CLK_DIV,
1677 .hw.init = &(struct clk_init_data){
1678 .name = "cts_enci_sel",
1679 .ops = &clk_regmap_mux_ops,
1680 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1681 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1682 .flags = CLK_SET_RATE_PARENT,
1686 static struct clk_regmap meson8b_cts_enci = {
1687 .data = &(struct clk_regmap_gate_data){
1688 .offset = HHI_VID_CLK_CNTL2,
1691 .hw.init = &(struct clk_init_data){
1693 .ops = &clk_regmap_gate_ops,
1694 .parent_hws = (const struct clk_hw *[]) {
1695 &meson8b_cts_enci_sel.hw
1698 .flags = CLK_SET_RATE_PARENT,
1702 static struct clk_regmap meson8b_hdmi_tx_pixel_sel = {
1703 .data = &(struct clk_regmap_mux_data){
1704 .offset = HHI_HDMI_CLK_CNTL,
1708 .hw.init = &(struct clk_init_data){
1709 .name = "hdmi_tx_pixel_sel",
1710 .ops = &clk_regmap_mux_ops,
1711 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1712 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1713 .flags = CLK_SET_RATE_PARENT,
1717 static struct clk_regmap meson8b_hdmi_tx_pixel = {
1718 .data = &(struct clk_regmap_gate_data){
1719 .offset = HHI_VID_CLK_CNTL2,
1722 .hw.init = &(struct clk_init_data){
1723 .name = "hdmi_tx_pixel",
1724 .ops = &clk_regmap_gate_ops,
1725 .parent_hws = (const struct clk_hw *[]) {
1726 &meson8b_hdmi_tx_pixel_sel.hw
1729 .flags = CLK_SET_RATE_PARENT,
1733 static const struct clk_hw *meson8b_vclk2_enc_mux_parent_hws[] = {
1734 &meson8b_vclk2_div1_gate.hw,
1735 &meson8b_vclk2_div2_div_gate.hw,
1736 &meson8b_vclk2_div4_div_gate.hw,
1737 &meson8b_vclk2_div6_div_gate.hw,
1738 &meson8b_vclk2_div12_div_gate.hw,
1741 static struct clk_regmap meson8b_cts_encl_sel = {
1742 .data = &(struct clk_regmap_mux_data){
1743 .offset = HHI_VIID_CLK_DIV,
1747 .hw.init = &(struct clk_init_data){
1748 .name = "cts_encl_sel",
1749 .ops = &clk_regmap_mux_ops,
1750 .parent_hws = meson8b_vclk2_enc_mux_parent_hws,
1751 .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws),
1752 .flags = CLK_SET_RATE_PARENT,
1756 static struct clk_regmap meson8b_cts_encl = {
1757 .data = &(struct clk_regmap_gate_data){
1758 .offset = HHI_VID_CLK_CNTL2,
1761 .hw.init = &(struct clk_init_data){
1763 .ops = &clk_regmap_gate_ops,
1764 .parent_hws = (const struct clk_hw *[]) {
1765 &meson8b_cts_encl_sel.hw
1768 .flags = CLK_SET_RATE_PARENT,
1772 static struct clk_regmap meson8b_cts_vdac0_sel = {
1773 .data = &(struct clk_regmap_mux_data){
1774 .offset = HHI_VIID_CLK_DIV,
1778 .hw.init = &(struct clk_init_data){
1779 .name = "cts_vdac0_sel",
1780 .ops = &clk_regmap_mux_ops,
1781 .parent_hws = meson8b_vclk2_enc_mux_parent_hws,
1782 .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws),
1783 .flags = CLK_SET_RATE_PARENT,
1787 static struct clk_regmap meson8b_cts_vdac0 = {
1788 .data = &(struct clk_regmap_gate_data){
1789 .offset = HHI_VID_CLK_CNTL2,
1792 .hw.init = &(struct clk_init_data){
1793 .name = "cts_vdac0",
1794 .ops = &clk_regmap_gate_ops,
1795 .parent_hws = (const struct clk_hw *[]) {
1796 &meson8b_cts_vdac0_sel.hw
1799 .flags = CLK_SET_RATE_PARENT,
1803 static struct clk_regmap meson8b_hdmi_sys_sel = {
1804 .data = &(struct clk_regmap_mux_data){
1805 .offset = HHI_HDMI_CLK_CNTL,
1808 .flags = CLK_MUX_ROUND_CLOSEST,
1810 .hw.init = &(struct clk_init_data){
1811 .name = "hdmi_sys_sel",
1812 .ops = &clk_regmap_mux_ops,
1813 /* FIXME: all other parents are unknown */
1814 .parent_data = &(const struct clk_parent_data) {
1820 .flags = CLK_SET_RATE_NO_REPARENT,
1824 static struct clk_regmap meson8b_hdmi_sys_div = {
1825 .data = &(struct clk_regmap_div_data){
1826 .offset = HHI_HDMI_CLK_CNTL,
1830 .hw.init = &(struct clk_init_data){
1831 .name = "hdmi_sys_div",
1832 .ops = &clk_regmap_divider_ops,
1833 .parent_hws = (const struct clk_hw *[]) {
1834 &meson8b_hdmi_sys_sel.hw
1837 .flags = CLK_SET_RATE_PARENT,
1841 static struct clk_regmap meson8b_hdmi_sys = {
1842 .data = &(struct clk_regmap_gate_data){
1843 .offset = HHI_HDMI_CLK_CNTL,
1846 .hw.init = &(struct clk_init_data) {
1848 .ops = &clk_regmap_gate_ops,
1849 .parent_hws = (const struct clk_hw *[]) {
1850 &meson8b_hdmi_sys_div.hw
1853 .flags = CLK_SET_RATE_PARENT,
1858 * The MALI IP is clocked by two identical clocks (mali_0 and mali_1)
1859 * muxed by a glitch-free switch on Meson8b and Meson8m2. The CCF can
1860 * actually manage this glitch-free mux because it does top-to-bottom
1861 * updates the each clock tree and switches to the "inactive" one when
1862 * CLK_SET_RATE_GATE is set.
1863 * Meson8 only has mali_0 and no glitch-free mux.
1865 static const struct clk_parent_data meson8b_mali_0_1_parent_data[] = {
1866 { .fw_name = "xtal", .name = "xtal", .index = -1, },
1867 { .hw = &meson8b_mpll2.hw, },
1868 { .hw = &meson8b_mpll1.hw, },
1869 { .hw = &meson8b_fclk_div7.hw, },
1870 { .hw = &meson8b_fclk_div4.hw, },
1871 { .hw = &meson8b_fclk_div3.hw, },
1872 { .hw = &meson8b_fclk_div5.hw, },
1875 static u32 meson8b_mali_0_1_mux_table[] = { 0, 2, 3, 4, 5, 6, 7 };
1877 static struct clk_regmap meson8b_mali_0_sel = {
1878 .data = &(struct clk_regmap_mux_data){
1879 .offset = HHI_MALI_CLK_CNTL,
1882 .table = meson8b_mali_0_1_mux_table,
1884 .hw.init = &(struct clk_init_data){
1885 .name = "mali_0_sel",
1886 .ops = &clk_regmap_mux_ops,
1887 .parent_data = meson8b_mali_0_1_parent_data,
1888 .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_data),
1890 * Don't propagate rate changes up because the only changeable
1891 * parents are mpll1 and mpll2 but we need those for audio and
1892 * RGMII (Ethernet). We don't want to change the audio or
1893 * Ethernet clocks when setting the GPU frequency.
1899 static struct clk_regmap meson8b_mali_0_div = {
1900 .data = &(struct clk_regmap_div_data){
1901 .offset = HHI_MALI_CLK_CNTL,
1905 .hw.init = &(struct clk_init_data){
1906 .name = "mali_0_div",
1907 .ops = &clk_regmap_divider_ops,
1908 .parent_hws = (const struct clk_hw *[]) {
1909 &meson8b_mali_0_sel.hw
1912 .flags = CLK_SET_RATE_PARENT,
1916 static struct clk_regmap meson8b_mali_0 = {
1917 .data = &(struct clk_regmap_gate_data){
1918 .offset = HHI_MALI_CLK_CNTL,
1921 .hw.init = &(struct clk_init_data){
1923 .ops = &clk_regmap_gate_ops,
1924 .parent_hws = (const struct clk_hw *[]) {
1925 &meson8b_mali_0_div.hw
1928 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
1932 static struct clk_regmap meson8b_mali_1_sel = {
1933 .data = &(struct clk_regmap_mux_data){
1934 .offset = HHI_MALI_CLK_CNTL,
1937 .table = meson8b_mali_0_1_mux_table,
1939 .hw.init = &(struct clk_init_data){
1940 .name = "mali_1_sel",
1941 .ops = &clk_regmap_mux_ops,
1942 .parent_data = meson8b_mali_0_1_parent_data,
1943 .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_data),
1945 * Don't propagate rate changes up because the only changeable
1946 * parents are mpll1 and mpll2 but we need those for audio and
1947 * RGMII (Ethernet). We don't want to change the audio or
1948 * Ethernet clocks when setting the GPU frequency.
1954 static struct clk_regmap meson8b_mali_1_div = {
1955 .data = &(struct clk_regmap_div_data){
1956 .offset = HHI_MALI_CLK_CNTL,
1960 .hw.init = &(struct clk_init_data){
1961 .name = "mali_1_div",
1962 .ops = &clk_regmap_divider_ops,
1963 .parent_hws = (const struct clk_hw *[]) {
1964 &meson8b_mali_1_sel.hw
1967 .flags = CLK_SET_RATE_PARENT,
1971 static struct clk_regmap meson8b_mali_1 = {
1972 .data = &(struct clk_regmap_gate_data){
1973 .offset = HHI_MALI_CLK_CNTL,
1976 .hw.init = &(struct clk_init_data){
1978 .ops = &clk_regmap_gate_ops,
1979 .parent_hws = (const struct clk_hw *[]) {
1980 &meson8b_mali_1_div.hw
1983 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
1987 static struct clk_regmap meson8b_mali = {
1988 .data = &(struct clk_regmap_mux_data){
1989 .offset = HHI_MALI_CLK_CNTL,
1993 .hw.init = &(struct clk_init_data){
1995 .ops = &clk_regmap_mux_ops,
1996 .parent_hws = (const struct clk_hw *[]) {
2001 .flags = CLK_SET_RATE_PARENT,
2005 static const struct reg_sequence meson8m2_gp_pll_init_regs[] = {
2006 { .reg = HHI_GP_PLL_CNTL2, .def = 0x59c88000 },
2007 { .reg = HHI_GP_PLL_CNTL3, .def = 0xca463823 },
2008 { .reg = HHI_GP_PLL_CNTL4, .def = 0x0286a027 },
2009 { .reg = HHI_GP_PLL_CNTL5, .def = 0x00003000 },
2012 static const struct pll_params_table meson8m2_gp_pll_params_table[] = {
2017 static struct clk_regmap meson8m2_gp_pll_dco = {
2018 .data = &(struct meson_clk_pll_data){
2020 .reg_off = HHI_GP_PLL_CNTL,
2025 .reg_off = HHI_GP_PLL_CNTL,
2030 .reg_off = HHI_GP_PLL_CNTL,
2035 .reg_off = HHI_GP_PLL_CNTL,
2040 .reg_off = HHI_GP_PLL_CNTL,
2044 .table = meson8m2_gp_pll_params_table,
2045 .init_regs = meson8m2_gp_pll_init_regs,
2046 .init_count = ARRAY_SIZE(meson8m2_gp_pll_init_regs),
2048 .hw.init = &(struct clk_init_data){
2049 .name = "gp_pll_dco",
2050 .ops = &meson_clk_pll_ops,
2051 .parent_data = &(const struct clk_parent_data) {
2060 static struct clk_regmap meson8m2_gp_pll = {
2061 .data = &(struct clk_regmap_div_data){
2062 .offset = HHI_GP_PLL_CNTL,
2065 .flags = CLK_DIVIDER_POWER_OF_TWO,
2067 .hw.init = &(struct clk_init_data){
2069 .ops = &clk_regmap_divider_ops,
2070 .parent_hws = (const struct clk_hw *[]) {
2071 &meson8m2_gp_pll_dco.hw
2074 .flags = CLK_SET_RATE_PARENT,
2078 static const struct clk_hw *meson8b_vpu_0_1_parent_hws[] = {
2079 &meson8b_fclk_div4.hw,
2080 &meson8b_fclk_div3.hw,
2081 &meson8b_fclk_div5.hw,
2082 &meson8b_fclk_div7.hw,
2085 static const struct clk_hw *mmeson8m2_vpu_0_1_parent_hws[] = {
2086 &meson8b_fclk_div4.hw,
2087 &meson8b_fclk_div3.hw,
2088 &meson8b_fclk_div5.hw,
2089 &meson8m2_gp_pll.hw,
2092 static struct clk_regmap meson8b_vpu_0_sel = {
2093 .data = &(struct clk_regmap_mux_data){
2094 .offset = HHI_VPU_CLK_CNTL,
2098 .hw.init = &(struct clk_init_data){
2099 .name = "vpu_0_sel",
2100 .ops = &clk_regmap_mux_ops,
2101 .parent_hws = meson8b_vpu_0_1_parent_hws,
2102 .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws),
2103 .flags = CLK_SET_RATE_PARENT,
2107 static struct clk_regmap meson8m2_vpu_0_sel = {
2108 .data = &(struct clk_regmap_mux_data){
2109 .offset = HHI_VPU_CLK_CNTL,
2113 .hw.init = &(struct clk_init_data){
2114 .name = "vpu_0_sel",
2115 .ops = &clk_regmap_mux_ops,
2116 .parent_hws = mmeson8m2_vpu_0_1_parent_hws,
2117 .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws),
2118 .flags = CLK_SET_RATE_PARENT,
2122 static struct clk_regmap meson8b_vpu_0_div = {
2123 .data = &(struct clk_regmap_div_data){
2124 .offset = HHI_VPU_CLK_CNTL,
2128 .hw.init = &(struct clk_init_data){
2129 .name = "vpu_0_div",
2130 .ops = &clk_regmap_divider_ops,
2131 .parent_data = &(const struct clk_parent_data) {
2134 * meson8b and meson8m2 have different vpu_0_sels (with
2135 * different struct clk_hw). We fallback to the global
2136 * naming string mechanism so vpu_0_div picks up the
2139 .name = "vpu_0_sel",
2143 .flags = CLK_SET_RATE_PARENT,
2147 static struct clk_regmap meson8b_vpu_0 = {
2148 .data = &(struct clk_regmap_gate_data){
2149 .offset = HHI_VPU_CLK_CNTL,
2152 .hw.init = &(struct clk_init_data) {
2154 .ops = &clk_regmap_gate_ops,
2155 .parent_hws = (const struct clk_hw *[]) {
2156 &meson8b_vpu_0_div.hw
2159 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
2163 static struct clk_regmap meson8b_vpu_1_sel = {
2164 .data = &(struct clk_regmap_mux_data){
2165 .offset = HHI_VPU_CLK_CNTL,
2169 .hw.init = &(struct clk_init_data){
2170 .name = "vpu_1_sel",
2171 .ops = &clk_regmap_mux_ops,
2172 .parent_hws = meson8b_vpu_0_1_parent_hws,
2173 .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws),
2174 .flags = CLK_SET_RATE_PARENT,
2178 static struct clk_regmap meson8m2_vpu_1_sel = {
2179 .data = &(struct clk_regmap_mux_data){
2180 .offset = HHI_VPU_CLK_CNTL,
2184 .hw.init = &(struct clk_init_data){
2185 .name = "vpu_1_sel",
2186 .ops = &clk_regmap_mux_ops,
2187 .parent_hws = mmeson8m2_vpu_0_1_parent_hws,
2188 .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws),
2189 .flags = CLK_SET_RATE_PARENT,
2193 static struct clk_regmap meson8b_vpu_1_div = {
2194 .data = &(struct clk_regmap_div_data){
2195 .offset = HHI_VPU_CLK_CNTL,
2199 .hw.init = &(struct clk_init_data){
2200 .name = "vpu_1_div",
2201 .ops = &clk_regmap_divider_ops,
2202 .parent_data = &(const struct clk_parent_data) {
2205 * meson8b and meson8m2 have different vpu_1_sels (with
2206 * different struct clk_hw). We fallback to the global
2207 * naming string mechanism so vpu_1_div picks up the
2210 .name = "vpu_1_sel",
2214 .flags = CLK_SET_RATE_PARENT,
2218 static struct clk_regmap meson8b_vpu_1 = {
2219 .data = &(struct clk_regmap_gate_data){
2220 .offset = HHI_VPU_CLK_CNTL,
2223 .hw.init = &(struct clk_init_data) {
2225 .ops = &clk_regmap_gate_ops,
2226 .parent_hws = (const struct clk_hw *[]) {
2227 &meson8b_vpu_1_div.hw
2230 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
2235 * The VPU clock has two identical clock trees (vpu_0 and vpu_1)
2236 * muxed by a glitch-free switch on Meson8b and Meson8m2. The CCF can
2237 * actually manage this glitch-free mux because it does top-to-bottom
2238 * updates the each clock tree and switches to the "inactive" one when
2239 * CLK_SET_RATE_GATE is set.
2240 * Meson8 only has vpu_0 and no glitch-free mux.
2242 static struct clk_regmap meson8b_vpu = {
2243 .data = &(struct clk_regmap_mux_data){
2244 .offset = HHI_VPU_CLK_CNTL,
2248 .hw.init = &(struct clk_init_data){
2250 .ops = &clk_regmap_mux_ops,
2251 .parent_hws = (const struct clk_hw *[]) {
2256 .flags = CLK_SET_RATE_PARENT,
2260 static const struct clk_hw *meson8b_vdec_parent_hws[] = {
2261 &meson8b_fclk_div4.hw,
2262 &meson8b_fclk_div3.hw,
2263 &meson8b_fclk_div5.hw,
2264 &meson8b_fclk_div7.hw,
2269 static struct clk_regmap meson8b_vdec_1_sel = {
2270 .data = &(struct clk_regmap_mux_data){
2271 .offset = HHI_VDEC_CLK_CNTL,
2274 .flags = CLK_MUX_ROUND_CLOSEST,
2276 .hw.init = &(struct clk_init_data){
2277 .name = "vdec_1_sel",
2278 .ops = &clk_regmap_mux_ops,
2279 .parent_hws = meson8b_vdec_parent_hws,
2280 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2281 .flags = CLK_SET_RATE_PARENT,
2285 static struct clk_regmap meson8b_vdec_1_1_div = {
2286 .data = &(struct clk_regmap_div_data){
2287 .offset = HHI_VDEC_CLK_CNTL,
2290 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2292 .hw.init = &(struct clk_init_data){
2293 .name = "vdec_1_1_div",
2294 .ops = &clk_regmap_divider_ops,
2295 .parent_hws = (const struct clk_hw *[]) {
2296 &meson8b_vdec_1_sel.hw
2299 .flags = CLK_SET_RATE_PARENT,
2303 static struct clk_regmap meson8b_vdec_1_1 = {
2304 .data = &(struct clk_regmap_gate_data){
2305 .offset = HHI_VDEC_CLK_CNTL,
2308 .hw.init = &(struct clk_init_data) {
2310 .ops = &clk_regmap_gate_ops,
2311 .parent_hws = (const struct clk_hw *[]) {
2312 &meson8b_vdec_1_1_div.hw
2315 .flags = CLK_SET_RATE_PARENT,
2319 static struct clk_regmap meson8b_vdec_1_2_div = {
2320 .data = &(struct clk_regmap_div_data){
2321 .offset = HHI_VDEC3_CLK_CNTL,
2324 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2326 .hw.init = &(struct clk_init_data){
2327 .name = "vdec_1_2_div",
2328 .ops = &clk_regmap_divider_ops,
2329 .parent_hws = (const struct clk_hw *[]) {
2330 &meson8b_vdec_1_sel.hw
2333 .flags = CLK_SET_RATE_PARENT,
2337 static struct clk_regmap meson8b_vdec_1_2 = {
2338 .data = &(struct clk_regmap_gate_data){
2339 .offset = HHI_VDEC3_CLK_CNTL,
2342 .hw.init = &(struct clk_init_data) {
2344 .ops = &clk_regmap_gate_ops,
2345 .parent_hws = (const struct clk_hw *[]) {
2346 &meson8b_vdec_1_2_div.hw
2349 .flags = CLK_SET_RATE_PARENT,
2353 static struct clk_regmap meson8b_vdec_1 = {
2354 .data = &(struct clk_regmap_mux_data){
2355 .offset = HHI_VDEC3_CLK_CNTL,
2358 .flags = CLK_MUX_ROUND_CLOSEST,
2360 .hw.init = &(struct clk_init_data){
2362 .ops = &clk_regmap_mux_ops,
2363 .parent_hws = (const struct clk_hw *[]) {
2364 &meson8b_vdec_1_1.hw,
2365 &meson8b_vdec_1_2.hw,
2368 .flags = CLK_SET_RATE_PARENT,
2372 static struct clk_regmap meson8b_vdec_hcodec_sel = {
2373 .data = &(struct clk_regmap_mux_data){
2374 .offset = HHI_VDEC_CLK_CNTL,
2377 .flags = CLK_MUX_ROUND_CLOSEST,
2379 .hw.init = &(struct clk_init_data){
2380 .name = "vdec_hcodec_sel",
2381 .ops = &clk_regmap_mux_ops,
2382 .parent_hws = meson8b_vdec_parent_hws,
2383 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2384 .flags = CLK_SET_RATE_PARENT,
2388 static struct clk_regmap meson8b_vdec_hcodec_div = {
2389 .data = &(struct clk_regmap_div_data){
2390 .offset = HHI_VDEC_CLK_CNTL,
2393 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2395 .hw.init = &(struct clk_init_data){
2396 .name = "vdec_hcodec_div",
2397 .ops = &clk_regmap_divider_ops,
2398 .parent_hws = (const struct clk_hw *[]) {
2399 &meson8b_vdec_hcodec_sel.hw
2402 .flags = CLK_SET_RATE_PARENT,
2406 static struct clk_regmap meson8b_vdec_hcodec = {
2407 .data = &(struct clk_regmap_gate_data){
2408 .offset = HHI_VDEC_CLK_CNTL,
2411 .hw.init = &(struct clk_init_data) {
2412 .name = "vdec_hcodec",
2413 .ops = &clk_regmap_gate_ops,
2414 .parent_hws = (const struct clk_hw *[]) {
2415 &meson8b_vdec_hcodec_div.hw
2418 .flags = CLK_SET_RATE_PARENT,
2422 static struct clk_regmap meson8b_vdec_2_sel = {
2423 .data = &(struct clk_regmap_mux_data){
2424 .offset = HHI_VDEC2_CLK_CNTL,
2427 .flags = CLK_MUX_ROUND_CLOSEST,
2429 .hw.init = &(struct clk_init_data){
2430 .name = "vdec_2_sel",
2431 .ops = &clk_regmap_mux_ops,
2432 .parent_hws = meson8b_vdec_parent_hws,
2433 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2434 .flags = CLK_SET_RATE_PARENT,
2438 static struct clk_regmap meson8b_vdec_2_div = {
2439 .data = &(struct clk_regmap_div_data){
2440 .offset = HHI_VDEC2_CLK_CNTL,
2443 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2445 .hw.init = &(struct clk_init_data){
2446 .name = "vdec_2_div",
2447 .ops = &clk_regmap_divider_ops,
2448 .parent_hws = (const struct clk_hw *[]) {
2449 &meson8b_vdec_2_sel.hw
2452 .flags = CLK_SET_RATE_PARENT,
2456 static struct clk_regmap meson8b_vdec_2 = {
2457 .data = &(struct clk_regmap_gate_data){
2458 .offset = HHI_VDEC2_CLK_CNTL,
2461 .hw.init = &(struct clk_init_data) {
2463 .ops = &clk_regmap_gate_ops,
2464 .parent_hws = (const struct clk_hw *[]) {
2465 &meson8b_vdec_2_div.hw
2468 .flags = CLK_SET_RATE_PARENT,
2472 static struct clk_regmap meson8b_vdec_hevc_sel = {
2473 .data = &(struct clk_regmap_mux_data){
2474 .offset = HHI_VDEC2_CLK_CNTL,
2477 .flags = CLK_MUX_ROUND_CLOSEST,
2479 .hw.init = &(struct clk_init_data){
2480 .name = "vdec_hevc_sel",
2481 .ops = &clk_regmap_mux_ops,
2482 .parent_hws = meson8b_vdec_parent_hws,
2483 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2484 .flags = CLK_SET_RATE_PARENT,
2488 static struct clk_regmap meson8b_vdec_hevc_div = {
2489 .data = &(struct clk_regmap_div_data){
2490 .offset = HHI_VDEC2_CLK_CNTL,
2493 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2495 .hw.init = &(struct clk_init_data){
2496 .name = "vdec_hevc_div",
2497 .ops = &clk_regmap_divider_ops,
2498 .parent_hws = (const struct clk_hw *[]) {
2499 &meson8b_vdec_hevc_sel.hw
2502 .flags = CLK_SET_RATE_PARENT,
2506 static struct clk_regmap meson8b_vdec_hevc_en = {
2507 .data = &(struct clk_regmap_gate_data){
2508 .offset = HHI_VDEC2_CLK_CNTL,
2511 .hw.init = &(struct clk_init_data) {
2512 .name = "vdec_hevc_en",
2513 .ops = &clk_regmap_gate_ops,
2514 .parent_hws = (const struct clk_hw *[]) {
2515 &meson8b_vdec_hevc_div.hw
2518 .flags = CLK_SET_RATE_PARENT,
2522 static struct clk_regmap meson8b_vdec_hevc = {
2523 .data = &(struct clk_regmap_mux_data){
2524 .offset = HHI_VDEC2_CLK_CNTL,
2527 .flags = CLK_MUX_ROUND_CLOSEST,
2529 .hw.init = &(struct clk_init_data){
2530 .name = "vdec_hevc",
2531 .ops = &clk_regmap_mux_ops,
2532 /* TODO: The second parent is currently unknown */
2533 .parent_hws = (const struct clk_hw *[]) {
2534 &meson8b_vdec_hevc_en.hw
2537 .flags = CLK_SET_RATE_PARENT,
2541 /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */
2542 static const struct clk_hw *meson8b_cts_amclk_parent_hws[] = {
2548 static u32 meson8b_cts_amclk_mux_table[] = { 1, 2, 3 };
2550 static struct clk_regmap meson8b_cts_amclk_sel = {
2551 .data = &(struct clk_regmap_mux_data){
2552 .offset = HHI_AUD_CLK_CNTL,
2555 .table = meson8b_cts_amclk_mux_table,
2556 .flags = CLK_MUX_ROUND_CLOSEST,
2558 .hw.init = &(struct clk_init_data){
2559 .name = "cts_amclk_sel",
2560 .ops = &clk_regmap_mux_ops,
2561 .parent_hws = meson8b_cts_amclk_parent_hws,
2562 .num_parents = ARRAY_SIZE(meson8b_cts_amclk_parent_hws),
2566 static struct clk_regmap meson8b_cts_amclk_div = {
2567 .data = &(struct clk_regmap_div_data) {
2568 .offset = HHI_AUD_CLK_CNTL,
2571 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2573 .hw.init = &(struct clk_init_data){
2574 .name = "cts_amclk_div",
2575 .ops = &clk_regmap_divider_ops,
2576 .parent_hws = (const struct clk_hw *[]) {
2577 &meson8b_cts_amclk_sel.hw
2580 .flags = CLK_SET_RATE_PARENT,
2584 static struct clk_regmap meson8b_cts_amclk = {
2585 .data = &(struct clk_regmap_gate_data){
2586 .offset = HHI_AUD_CLK_CNTL,
2589 .hw.init = &(struct clk_init_data){
2590 .name = "cts_amclk",
2591 .ops = &clk_regmap_gate_ops,
2592 .parent_hws = (const struct clk_hw *[]) {
2593 &meson8b_cts_amclk_div.hw
2596 .flags = CLK_SET_RATE_PARENT,
2600 /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */
2601 static const struct clk_hw *meson8b_cts_mclk_i958_parent_hws[] = {
2607 static u32 meson8b_cts_mclk_i958_mux_table[] = { 1, 2, 3 };
2609 static struct clk_regmap meson8b_cts_mclk_i958_sel = {
2610 .data = &(struct clk_regmap_mux_data){
2611 .offset = HHI_AUD_CLK_CNTL2,
2614 .table = meson8b_cts_mclk_i958_mux_table,
2615 .flags = CLK_MUX_ROUND_CLOSEST,
2617 .hw.init = &(struct clk_init_data) {
2618 .name = "cts_mclk_i958_sel",
2619 .ops = &clk_regmap_mux_ops,
2620 .parent_hws = meson8b_cts_mclk_i958_parent_hws,
2621 .num_parents = ARRAY_SIZE(meson8b_cts_mclk_i958_parent_hws),
2625 static struct clk_regmap meson8b_cts_mclk_i958_div = {
2626 .data = &(struct clk_regmap_div_data){
2627 .offset = HHI_AUD_CLK_CNTL2,
2630 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2632 .hw.init = &(struct clk_init_data) {
2633 .name = "cts_mclk_i958_div",
2634 .ops = &clk_regmap_divider_ops,
2635 .parent_hws = (const struct clk_hw *[]) {
2636 &meson8b_cts_mclk_i958_sel.hw
2639 .flags = CLK_SET_RATE_PARENT,
2643 static struct clk_regmap meson8b_cts_mclk_i958 = {
2644 .data = &(struct clk_regmap_gate_data){
2645 .offset = HHI_AUD_CLK_CNTL2,
2648 .hw.init = &(struct clk_init_data){
2649 .name = "cts_mclk_i958",
2650 .ops = &clk_regmap_gate_ops,
2651 .parent_hws = (const struct clk_hw *[]) {
2652 &meson8b_cts_mclk_i958_div.hw
2655 .flags = CLK_SET_RATE_PARENT,
2659 static struct clk_regmap meson8b_cts_i958 = {
2660 .data = &(struct clk_regmap_mux_data){
2661 .offset = HHI_AUD_CLK_CNTL2,
2665 .hw.init = &(struct clk_init_data){
2667 .ops = &clk_regmap_mux_ops,
2668 .parent_hws = (const struct clk_hw *[]) {
2669 &meson8b_cts_amclk.hw,
2670 &meson8b_cts_mclk_i958.hw
2674 * The parent is specific to origin of the audio data. Let the
2675 * consumer choose the appropriate parent.
2677 .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
2681 #define MESON_GATE(_name, _reg, _bit) \
2682 MESON_PCLK(_name, _reg, _bit, &meson8b_clk81.hw)
2684 /* Everything Else (EE) domain gates */
2686 static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0);
2687 static MESON_GATE(meson8b_dos, HHI_GCLK_MPEG0, 1);
2688 static MESON_GATE(meson8b_isa, HHI_GCLK_MPEG0, 5);
2689 static MESON_GATE(meson8b_pl301, HHI_GCLK_MPEG0, 6);
2690 static MESON_GATE(meson8b_periphs, HHI_GCLK_MPEG0, 7);
2691 static MESON_GATE(meson8b_spicc, HHI_GCLK_MPEG0, 8);
2692 static MESON_GATE(meson8b_i2c, HHI_GCLK_MPEG0, 9);
2693 static MESON_GATE(meson8b_sar_adc, HHI_GCLK_MPEG0, 10);
2694 static MESON_GATE(meson8b_smart_card, HHI_GCLK_MPEG0, 11);
2695 static MESON_GATE(meson8b_rng0, HHI_GCLK_MPEG0, 12);
2696 static MESON_GATE(meson8b_uart0, HHI_GCLK_MPEG0, 13);
2697 static MESON_GATE(meson8b_sdhc, HHI_GCLK_MPEG0, 14);
2698 static MESON_GATE(meson8b_stream, HHI_GCLK_MPEG0, 15);
2699 static MESON_GATE(meson8b_async_fifo, HHI_GCLK_MPEG0, 16);
2700 static MESON_GATE(meson8b_sdio, HHI_GCLK_MPEG0, 17);
2701 static MESON_GATE(meson8b_abuf, HHI_GCLK_MPEG0, 18);
2702 static MESON_GATE(meson8b_hiu_iface, HHI_GCLK_MPEG0, 19);
2703 static MESON_GATE(meson8b_assist_misc, HHI_GCLK_MPEG0, 23);
2704 static MESON_GATE(meson8b_spi, HHI_GCLK_MPEG0, 30);
2706 static MESON_GATE(meson8b_i2s_spdif, HHI_GCLK_MPEG1, 2);
2707 static MESON_GATE(meson8b_eth, HHI_GCLK_MPEG1, 3);
2708 static MESON_GATE(meson8b_demux, HHI_GCLK_MPEG1, 4);
2709 static MESON_GATE(meson8b_blkmv, HHI_GCLK_MPEG1, 14);
2710 static MESON_GATE(meson8b_aiu, HHI_GCLK_MPEG1, 15);
2711 static MESON_GATE(meson8b_uart1, HHI_GCLK_MPEG1, 16);
2712 static MESON_GATE(meson8b_g2d, HHI_GCLK_MPEG1, 20);
2713 static MESON_GATE(meson8b_usb0, HHI_GCLK_MPEG1, 21);
2714 static MESON_GATE(meson8b_usb1, HHI_GCLK_MPEG1, 22);
2715 static MESON_GATE(meson8b_reset, HHI_GCLK_MPEG1, 23);
2716 static MESON_GATE(meson8b_nand, HHI_GCLK_MPEG1, 24);
2717 static MESON_GATE(meson8b_dos_parser, HHI_GCLK_MPEG1, 25);
2718 static MESON_GATE(meson8b_usb, HHI_GCLK_MPEG1, 26);
2719 static MESON_GATE(meson8b_vdin1, HHI_GCLK_MPEG1, 28);
2720 static MESON_GATE(meson8b_ahb_arb0, HHI_GCLK_MPEG1, 29);
2721 static MESON_GATE(meson8b_efuse, HHI_GCLK_MPEG1, 30);
2722 static MESON_GATE(meson8b_boot_rom, HHI_GCLK_MPEG1, 31);
2724 static MESON_GATE(meson8b_ahb_data_bus, HHI_GCLK_MPEG2, 1);
2725 static MESON_GATE(meson8b_ahb_ctrl_bus, HHI_GCLK_MPEG2, 2);
2726 static MESON_GATE(meson8b_hdmi_intr_sync, HHI_GCLK_MPEG2, 3);
2727 static MESON_GATE(meson8b_hdmi_pclk, HHI_GCLK_MPEG2, 4);
2728 static MESON_GATE(meson8b_usb1_ddr_bridge, HHI_GCLK_MPEG2, 8);
2729 static MESON_GATE(meson8b_usb0_ddr_bridge, HHI_GCLK_MPEG2, 9);
2730 static MESON_GATE(meson8b_mmc_pclk, HHI_GCLK_MPEG2, 11);
2731 static MESON_GATE(meson8b_dvin, HHI_GCLK_MPEG2, 12);
2732 static MESON_GATE(meson8b_uart2, HHI_GCLK_MPEG2, 15);
2733 static MESON_GATE(meson8b_sana, HHI_GCLK_MPEG2, 22);
2734 static MESON_GATE(meson8b_vpu_intr, HHI_GCLK_MPEG2, 25);
2735 static MESON_GATE(meson8b_sec_ahb_ahb3_bridge, HHI_GCLK_MPEG2, 26);
2736 static MESON_GATE(meson8b_clk81_a9, HHI_GCLK_MPEG2, 29);
2738 static MESON_GATE(meson8b_vclk2_venci0, HHI_GCLK_OTHER, 1);
2739 static MESON_GATE(meson8b_vclk2_venci1, HHI_GCLK_OTHER, 2);
2740 static MESON_GATE(meson8b_vclk2_vencp0, HHI_GCLK_OTHER, 3);
2741 static MESON_GATE(meson8b_vclk2_vencp1, HHI_GCLK_OTHER, 4);
2742 static MESON_GATE(meson8b_gclk_venci_int, HHI_GCLK_OTHER, 8);
2743 static MESON_GATE(meson8b_gclk_vencp_int, HHI_GCLK_OTHER, 9);
2744 static MESON_GATE(meson8b_dac_clk, HHI_GCLK_OTHER, 10);
2745 static MESON_GATE(meson8b_aoclk_gate, HHI_GCLK_OTHER, 14);
2746 static MESON_GATE(meson8b_iec958_gate, HHI_GCLK_OTHER, 16);
2747 static MESON_GATE(meson8b_enc480p, HHI_GCLK_OTHER, 20);
2748 static MESON_GATE(meson8b_rng1, HHI_GCLK_OTHER, 21);
2749 static MESON_GATE(meson8b_gclk_vencl_int, HHI_GCLK_OTHER, 22);
2750 static MESON_GATE(meson8b_vclk2_venclmcc, HHI_GCLK_OTHER, 24);
2751 static MESON_GATE(meson8b_vclk2_vencl, HHI_GCLK_OTHER, 25);
2752 static MESON_GATE(meson8b_vclk2_other, HHI_GCLK_OTHER, 26);
2753 static MESON_GATE(meson8b_edp, HHI_GCLK_OTHER, 31);
2756 #define MESON_AIU_GLUE_GATE(_name, _reg, _bit) \
2757 MESON_PCLK(_name, _reg, _bit, &meson8b_aiu_glue.hw)
2759 static MESON_PCLK(meson8b_aiu_glue, HHI_GCLK_MPEG1, 6, &meson8b_aiu.hw);
2760 static MESON_AIU_GLUE_GATE(meson8b_iec958, HHI_GCLK_MPEG1, 7);
2761 static MESON_AIU_GLUE_GATE(meson8b_i2s_out, HHI_GCLK_MPEG1, 8);
2762 static MESON_AIU_GLUE_GATE(meson8b_amclk, HHI_GCLK_MPEG1, 9);
2763 static MESON_AIU_GLUE_GATE(meson8b_aififo2, HHI_GCLK_MPEG1, 10);
2764 static MESON_AIU_GLUE_GATE(meson8b_mixer, HHI_GCLK_MPEG1, 11);
2765 static MESON_AIU_GLUE_GATE(meson8b_mixer_iface, HHI_GCLK_MPEG1, 12);
2766 static MESON_AIU_GLUE_GATE(meson8b_adc, HHI_GCLK_MPEG1, 13);
2768 /* Always On (AO) domain gates */
2770 static MESON_GATE(meson8b_ao_media_cpu, HHI_GCLK_AO, 0);
2771 static MESON_GATE(meson8b_ao_ahb_sram, HHI_GCLK_AO, 1);
2772 static MESON_GATE(meson8b_ao_ahb_bus, HHI_GCLK_AO, 2);
2773 static MESON_GATE(meson8b_ao_iface, HHI_GCLK_AO, 3);
2775 static struct clk_hw_onecell_data meson8_hw_onecell_data = {
2777 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
2778 [CLKID_PLL_VID] = &meson8b_vid_pll.hw,
2779 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
2780 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
2781 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
2782 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
2783 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
2784 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
2785 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
2786 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
2787 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
2788 [CLKID_CLK81] = &meson8b_clk81.hw,
2789 [CLKID_DDR] = &meson8b_ddr.hw,
2790 [CLKID_DOS] = &meson8b_dos.hw,
2791 [CLKID_ISA] = &meson8b_isa.hw,
2792 [CLKID_PL301] = &meson8b_pl301.hw,
2793 [CLKID_PERIPHS] = &meson8b_periphs.hw,
2794 [CLKID_SPICC] = &meson8b_spicc.hw,
2795 [CLKID_I2C] = &meson8b_i2c.hw,
2796 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw,
2797 [CLKID_SMART_CARD] = &meson8b_smart_card.hw,
2798 [CLKID_RNG0] = &meson8b_rng0.hw,
2799 [CLKID_UART0] = &meson8b_uart0.hw,
2800 [CLKID_SDHC] = &meson8b_sdhc.hw,
2801 [CLKID_STREAM] = &meson8b_stream.hw,
2802 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw,
2803 [CLKID_SDIO] = &meson8b_sdio.hw,
2804 [CLKID_ABUF] = &meson8b_abuf.hw,
2805 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw,
2806 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw,
2807 [CLKID_SPI] = &meson8b_spi.hw,
2808 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw,
2809 [CLKID_ETH] = &meson8b_eth.hw,
2810 [CLKID_DEMUX] = &meson8b_demux.hw,
2811 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw,
2812 [CLKID_IEC958] = &meson8b_iec958.hw,
2813 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw,
2814 [CLKID_AMCLK] = &meson8b_amclk.hw,
2815 [CLKID_AIFIFO2] = &meson8b_aififo2.hw,
2816 [CLKID_MIXER] = &meson8b_mixer.hw,
2817 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw,
2818 [CLKID_ADC] = &meson8b_adc.hw,
2819 [CLKID_BLKMV] = &meson8b_blkmv.hw,
2820 [CLKID_AIU] = &meson8b_aiu.hw,
2821 [CLKID_UART1] = &meson8b_uart1.hw,
2822 [CLKID_G2D] = &meson8b_g2d.hw,
2823 [CLKID_USB0] = &meson8b_usb0.hw,
2824 [CLKID_USB1] = &meson8b_usb1.hw,
2825 [CLKID_RESET] = &meson8b_reset.hw,
2826 [CLKID_NAND] = &meson8b_nand.hw,
2827 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw,
2828 [CLKID_USB] = &meson8b_usb.hw,
2829 [CLKID_VDIN1] = &meson8b_vdin1.hw,
2830 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw,
2831 [CLKID_EFUSE] = &meson8b_efuse.hw,
2832 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw,
2833 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw,
2834 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw,
2835 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw,
2836 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw,
2837 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw,
2838 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw,
2839 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw,
2840 [CLKID_DVIN] = &meson8b_dvin.hw,
2841 [CLKID_UART2] = &meson8b_uart2.hw,
2842 [CLKID_SANA] = &meson8b_sana.hw,
2843 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw,
2844 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
2845 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw,
2846 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw,
2847 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw,
2848 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw,
2849 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw,
2850 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw,
2851 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw,
2852 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw,
2853 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw,
2854 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw,
2855 [CLKID_ENC480P] = &meson8b_enc480p.hw,
2856 [CLKID_RNG1] = &meson8b_rng1.hw,
2857 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw,
2858 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw,
2859 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw,
2860 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw,
2861 [CLKID_EDP] = &meson8b_edp.hw,
2862 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw,
2863 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw,
2864 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw,
2865 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw,
2866 [CLKID_MPLL0] = &meson8b_mpll0.hw,
2867 [CLKID_MPLL1] = &meson8b_mpll1.hw,
2868 [CLKID_MPLL2] = &meson8b_mpll2.hw,
2869 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw,
2870 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw,
2871 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw,
2872 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw,
2873 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw,
2874 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw,
2875 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw,
2876 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw,
2877 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw,
2878 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw,
2879 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw,
2880 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw,
2881 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw,
2882 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw,
2883 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw,
2884 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw,
2885 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw,
2886 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw,
2887 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw,
2888 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw,
2889 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw,
2890 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw,
2891 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw,
2892 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw,
2893 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw,
2894 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw,
2895 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw,
2896 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw,
2897 [CLKID_APB] = &meson8b_apb_clk_gate.hw,
2898 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw,
2899 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw,
2900 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw,
2901 [CLKID_AXI] = &meson8b_axi_clk_gate.hw,
2902 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw,
2903 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw,
2904 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw,
2905 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw,
2906 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw,
2907 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw,
2908 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw,
2909 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw,
2910 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw,
2911 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw,
2912 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw,
2913 [CLKID_VCLK_EN] = &meson8b_vclk_en.hw,
2914 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw,
2915 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw,
2916 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw,
2917 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw,
2918 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw,
2919 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw,
2920 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw,
2921 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw,
2922 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw,
2923 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw,
2924 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw,
2925 [CLKID_VCLK2_EN] = &meson8b_vclk2_clk_en.hw,
2926 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw,
2927 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw,
2928 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw,
2929 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw,
2930 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw,
2931 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw,
2932 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw,
2933 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw,
2934 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw,
2935 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw,
2936 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw,
2937 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw,
2938 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw,
2939 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw,
2940 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw,
2941 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw,
2942 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw,
2943 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw,
2944 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw,
2945 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw,
2946 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw,
2947 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw,
2948 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw,
2949 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw,
2950 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw,
2951 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw,
2952 [CLKID_MALI] = &meson8b_mali_0.hw,
2953 [CLKID_VPU_0_SEL] = &meson8b_vpu_0_sel.hw,
2954 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
2955 [CLKID_VPU] = &meson8b_vpu_0.hw,
2956 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw,
2957 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw,
2958 [CLKID_VDEC_1] = &meson8b_vdec_1_1.hw,
2959 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw,
2960 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw,
2961 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw,
2962 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw,
2963 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw,
2964 [CLKID_VDEC_2] = &meson8b_vdec_2.hw,
2965 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw,
2966 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw,
2967 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw,
2968 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw,
2969 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw,
2970 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw,
2971 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw,
2972 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw,
2973 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw,
2974 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
2975 [CLKID_CTS_I958] = &meson8b_cts_i958.hw,
2976 [CLKID_VID_PLL_LVDS_EN] = &meson8b_vid_pll_lvds_en.hw,
2977 [CLKID_HDMI_PLL_DCO_IN] = &hdmi_pll_dco_in.hw,
2978 [CLK_NR_CLKS] = NULL,
2983 static struct clk_hw_onecell_data meson8b_hw_onecell_data = {
2985 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
2986 [CLKID_PLL_VID] = &meson8b_vid_pll.hw,
2987 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
2988 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
2989 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
2990 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
2991 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
2992 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
2993 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
2994 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
2995 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
2996 [CLKID_CLK81] = &meson8b_clk81.hw,
2997 [CLKID_DDR] = &meson8b_ddr.hw,
2998 [CLKID_DOS] = &meson8b_dos.hw,
2999 [CLKID_ISA] = &meson8b_isa.hw,
3000 [CLKID_PL301] = &meson8b_pl301.hw,
3001 [CLKID_PERIPHS] = &meson8b_periphs.hw,
3002 [CLKID_SPICC] = &meson8b_spicc.hw,
3003 [CLKID_I2C] = &meson8b_i2c.hw,
3004 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw,
3005 [CLKID_SMART_CARD] = &meson8b_smart_card.hw,
3006 [CLKID_RNG0] = &meson8b_rng0.hw,
3007 [CLKID_UART0] = &meson8b_uart0.hw,
3008 [CLKID_SDHC] = &meson8b_sdhc.hw,
3009 [CLKID_STREAM] = &meson8b_stream.hw,
3010 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw,
3011 [CLKID_SDIO] = &meson8b_sdio.hw,
3012 [CLKID_ABUF] = &meson8b_abuf.hw,
3013 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw,
3014 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw,
3015 [CLKID_SPI] = &meson8b_spi.hw,
3016 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw,
3017 [CLKID_ETH] = &meson8b_eth.hw,
3018 [CLKID_DEMUX] = &meson8b_demux.hw,
3019 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw,
3020 [CLKID_IEC958] = &meson8b_iec958.hw,
3021 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw,
3022 [CLKID_AMCLK] = &meson8b_amclk.hw,
3023 [CLKID_AIFIFO2] = &meson8b_aififo2.hw,
3024 [CLKID_MIXER] = &meson8b_mixer.hw,
3025 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw,
3026 [CLKID_ADC] = &meson8b_adc.hw,
3027 [CLKID_BLKMV] = &meson8b_blkmv.hw,
3028 [CLKID_AIU] = &meson8b_aiu.hw,
3029 [CLKID_UART1] = &meson8b_uart1.hw,
3030 [CLKID_G2D] = &meson8b_g2d.hw,
3031 [CLKID_USB0] = &meson8b_usb0.hw,
3032 [CLKID_USB1] = &meson8b_usb1.hw,
3033 [CLKID_RESET] = &meson8b_reset.hw,
3034 [CLKID_NAND] = &meson8b_nand.hw,
3035 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw,
3036 [CLKID_USB] = &meson8b_usb.hw,
3037 [CLKID_VDIN1] = &meson8b_vdin1.hw,
3038 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw,
3039 [CLKID_EFUSE] = &meson8b_efuse.hw,
3040 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw,
3041 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw,
3042 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw,
3043 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw,
3044 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw,
3045 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw,
3046 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw,
3047 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw,
3048 [CLKID_DVIN] = &meson8b_dvin.hw,
3049 [CLKID_UART2] = &meson8b_uart2.hw,
3050 [CLKID_SANA] = &meson8b_sana.hw,
3051 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw,
3052 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
3053 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw,
3054 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw,
3055 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw,
3056 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw,
3057 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw,
3058 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw,
3059 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw,
3060 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw,
3061 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw,
3062 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw,
3063 [CLKID_ENC480P] = &meson8b_enc480p.hw,
3064 [CLKID_RNG1] = &meson8b_rng1.hw,
3065 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw,
3066 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw,
3067 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw,
3068 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw,
3069 [CLKID_EDP] = &meson8b_edp.hw,
3070 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw,
3071 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw,
3072 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw,
3073 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw,
3074 [CLKID_MPLL0] = &meson8b_mpll0.hw,
3075 [CLKID_MPLL1] = &meson8b_mpll1.hw,
3076 [CLKID_MPLL2] = &meson8b_mpll2.hw,
3077 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw,
3078 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw,
3079 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw,
3080 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw,
3081 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw,
3082 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw,
3083 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw,
3084 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw,
3085 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw,
3086 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw,
3087 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw,
3088 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw,
3089 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw,
3090 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw,
3091 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw,
3092 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw,
3093 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw,
3094 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw,
3095 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw,
3096 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw,
3097 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw,
3098 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw,
3099 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw,
3100 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw,
3101 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw,
3102 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw,
3103 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw,
3104 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw,
3105 [CLKID_APB] = &meson8b_apb_clk_gate.hw,
3106 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw,
3107 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw,
3108 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw,
3109 [CLKID_AXI] = &meson8b_axi_clk_gate.hw,
3110 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw,
3111 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw,
3112 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw,
3113 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw,
3114 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw,
3115 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw,
3116 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw,
3117 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw,
3118 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw,
3119 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw,
3120 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw,
3121 [CLKID_VCLK_EN] = &meson8b_vclk_en.hw,
3122 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw,
3123 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw,
3124 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw,
3125 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw,
3126 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw,
3127 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw,
3128 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw,
3129 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw,
3130 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw,
3131 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw,
3132 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw,
3133 [CLKID_VCLK2_EN] = &meson8b_vclk2_clk_en.hw,
3134 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw,
3135 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw,
3136 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw,
3137 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw,
3138 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw,
3139 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw,
3140 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw,
3141 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw,
3142 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw,
3143 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw,
3144 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw,
3145 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw,
3146 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw,
3147 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw,
3148 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw,
3149 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw,
3150 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw,
3151 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw,
3152 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw,
3153 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw,
3154 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw,
3155 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw,
3156 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw,
3157 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw,
3158 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw,
3159 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw,
3160 [CLKID_MALI_0] = &meson8b_mali_0.hw,
3161 [CLKID_MALI_1_SEL] = &meson8b_mali_1_sel.hw,
3162 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw,
3163 [CLKID_MALI_1] = &meson8b_mali_1.hw,
3164 [CLKID_MALI] = &meson8b_mali.hw,
3165 [CLKID_VPU_0_SEL] = &meson8b_vpu_0_sel.hw,
3166 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
3167 [CLKID_VPU_0] = &meson8b_vpu_0.hw,
3168 [CLKID_VPU_1_SEL] = &meson8b_vpu_1_sel.hw,
3169 [CLKID_VPU_1_DIV] = &meson8b_vpu_1_div.hw,
3170 [CLKID_VPU_1] = &meson8b_vpu_1.hw,
3171 [CLKID_VPU] = &meson8b_vpu.hw,
3172 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw,
3173 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw,
3174 [CLKID_VDEC_1_1] = &meson8b_vdec_1_1.hw,
3175 [CLKID_VDEC_1_2_DIV] = &meson8b_vdec_1_2_div.hw,
3176 [CLKID_VDEC_1_2] = &meson8b_vdec_1_2.hw,
3177 [CLKID_VDEC_1] = &meson8b_vdec_1.hw,
3178 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw,
3179 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw,
3180 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw,
3181 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw,
3182 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw,
3183 [CLKID_VDEC_2] = &meson8b_vdec_2.hw,
3184 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw,
3185 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw,
3186 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw,
3187 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw,
3188 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw,
3189 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw,
3190 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw,
3191 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw,
3192 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw,
3193 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
3194 [CLKID_CTS_I958] = &meson8b_cts_i958.hw,
3195 [CLKID_VID_PLL_LVDS_EN] = &meson8b_vid_pll_lvds_en.hw,
3196 [CLKID_HDMI_PLL_DCO_IN] = &hdmi_pll_dco_in.hw,
3197 [CLK_NR_CLKS] = NULL,
3202 static struct clk_hw_onecell_data meson8m2_hw_onecell_data = {
3204 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
3205 [CLKID_PLL_VID] = &meson8b_vid_pll.hw,
3206 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
3207 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
3208 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
3209 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
3210 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
3211 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
3212 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
3213 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
3214 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
3215 [CLKID_CLK81] = &meson8b_clk81.hw,
3216 [CLKID_DDR] = &meson8b_ddr.hw,
3217 [CLKID_DOS] = &meson8b_dos.hw,
3218 [CLKID_ISA] = &meson8b_isa.hw,
3219 [CLKID_PL301] = &meson8b_pl301.hw,
3220 [CLKID_PERIPHS] = &meson8b_periphs.hw,
3221 [CLKID_SPICC] = &meson8b_spicc.hw,
3222 [CLKID_I2C] = &meson8b_i2c.hw,
3223 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw,
3224 [CLKID_SMART_CARD] = &meson8b_smart_card.hw,
3225 [CLKID_RNG0] = &meson8b_rng0.hw,
3226 [CLKID_UART0] = &meson8b_uart0.hw,
3227 [CLKID_SDHC] = &meson8b_sdhc.hw,
3228 [CLKID_STREAM] = &meson8b_stream.hw,
3229 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw,
3230 [CLKID_SDIO] = &meson8b_sdio.hw,
3231 [CLKID_ABUF] = &meson8b_abuf.hw,
3232 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw,
3233 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw,
3234 [CLKID_SPI] = &meson8b_spi.hw,
3235 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw,
3236 [CLKID_ETH] = &meson8b_eth.hw,
3237 [CLKID_DEMUX] = &meson8b_demux.hw,
3238 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw,
3239 [CLKID_IEC958] = &meson8b_iec958.hw,
3240 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw,
3241 [CLKID_AMCLK] = &meson8b_amclk.hw,
3242 [CLKID_AIFIFO2] = &meson8b_aififo2.hw,
3243 [CLKID_MIXER] = &meson8b_mixer.hw,
3244 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw,
3245 [CLKID_ADC] = &meson8b_adc.hw,
3246 [CLKID_BLKMV] = &meson8b_blkmv.hw,
3247 [CLKID_AIU] = &meson8b_aiu.hw,
3248 [CLKID_UART1] = &meson8b_uart1.hw,
3249 [CLKID_G2D] = &meson8b_g2d.hw,
3250 [CLKID_USB0] = &meson8b_usb0.hw,
3251 [CLKID_USB1] = &meson8b_usb1.hw,
3252 [CLKID_RESET] = &meson8b_reset.hw,
3253 [CLKID_NAND] = &meson8b_nand.hw,
3254 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw,
3255 [CLKID_USB] = &meson8b_usb.hw,
3256 [CLKID_VDIN1] = &meson8b_vdin1.hw,
3257 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw,
3258 [CLKID_EFUSE] = &meson8b_efuse.hw,
3259 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw,
3260 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw,
3261 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw,
3262 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw,
3263 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw,
3264 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw,
3265 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw,
3266 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw,
3267 [CLKID_DVIN] = &meson8b_dvin.hw,
3268 [CLKID_UART2] = &meson8b_uart2.hw,
3269 [CLKID_SANA] = &meson8b_sana.hw,
3270 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw,
3271 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
3272 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw,
3273 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw,
3274 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw,
3275 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw,
3276 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw,
3277 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw,
3278 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw,
3279 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw,
3280 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw,
3281 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw,
3282 [CLKID_ENC480P] = &meson8b_enc480p.hw,
3283 [CLKID_RNG1] = &meson8b_rng1.hw,
3284 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw,
3285 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw,
3286 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw,
3287 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw,
3288 [CLKID_EDP] = &meson8b_edp.hw,
3289 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw,
3290 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw,
3291 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw,
3292 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw,
3293 [CLKID_MPLL0] = &meson8b_mpll0.hw,
3294 [CLKID_MPLL1] = &meson8b_mpll1.hw,
3295 [CLKID_MPLL2] = &meson8b_mpll2.hw,
3296 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw,
3297 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw,
3298 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw,
3299 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw,
3300 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw,
3301 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw,
3302 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw,
3303 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw,
3304 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw,
3305 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw,
3306 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw,
3307 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw,
3308 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw,
3309 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw,
3310 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw,
3311 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw,
3312 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw,
3313 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw,
3314 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw,
3315 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw,
3316 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw,
3317 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw,
3318 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw,
3319 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw,
3320 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw,
3321 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw,
3322 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw,
3323 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw,
3324 [CLKID_APB] = &meson8b_apb_clk_gate.hw,
3325 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw,
3326 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw,
3327 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw,
3328 [CLKID_AXI] = &meson8b_axi_clk_gate.hw,
3329 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw,
3330 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw,
3331 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw,
3332 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw,
3333 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw,
3334 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw,
3335 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw,
3336 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw,
3337 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw,
3338 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw,
3339 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw,
3340 [CLKID_VCLK_EN] = &meson8b_vclk_en.hw,
3341 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw,
3342 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw,
3343 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw,
3344 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw,
3345 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw,
3346 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw,
3347 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw,
3348 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw,
3349 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw,
3350 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw,
3351 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw,
3352 [CLKID_VCLK2_EN] = &meson8b_vclk2_clk_en.hw,
3353 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw,
3354 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw,
3355 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw,
3356 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw,
3357 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw,
3358 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw,
3359 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw,
3360 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw,
3361 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw,
3362 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw,
3363 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw,
3364 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw,
3365 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw,
3366 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw,
3367 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw,
3368 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw,
3369 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw,
3370 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw,
3371 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw,
3372 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw,
3373 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw,
3374 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw,
3375 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw,
3376 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw,
3377 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw,
3378 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw,
3379 [CLKID_MALI_0] = &meson8b_mali_0.hw,
3380 [CLKID_MALI_1_SEL] = &meson8b_mali_1_sel.hw,
3381 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw,
3382 [CLKID_MALI_1] = &meson8b_mali_1.hw,
3383 [CLKID_MALI] = &meson8b_mali.hw,
3384 [CLKID_GP_PLL_DCO] = &meson8m2_gp_pll_dco.hw,
3385 [CLKID_GP_PLL] = &meson8m2_gp_pll.hw,
3386 [CLKID_VPU_0_SEL] = &meson8m2_vpu_0_sel.hw,
3387 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
3388 [CLKID_VPU_0] = &meson8b_vpu_0.hw,
3389 [CLKID_VPU_1_SEL] = &meson8m2_vpu_1_sel.hw,
3390 [CLKID_VPU_1_DIV] = &meson8b_vpu_1_div.hw,
3391 [CLKID_VPU_1] = &meson8b_vpu_1.hw,
3392 [CLKID_VPU] = &meson8b_vpu.hw,
3393 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw,
3394 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw,
3395 [CLKID_VDEC_1_1] = &meson8b_vdec_1_1.hw,
3396 [CLKID_VDEC_1_2_DIV] = &meson8b_vdec_1_2_div.hw,
3397 [CLKID_VDEC_1_2] = &meson8b_vdec_1_2.hw,
3398 [CLKID_VDEC_1] = &meson8b_vdec_1.hw,
3399 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw,
3400 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw,
3401 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw,
3402 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw,
3403 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw,
3404 [CLKID_VDEC_2] = &meson8b_vdec_2.hw,
3405 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw,
3406 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw,
3407 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw,
3408 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw,
3409 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw,
3410 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw,
3411 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw,
3412 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw,
3413 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw,
3414 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
3415 [CLKID_CTS_I958] = &meson8b_cts_i958.hw,
3416 [CLKID_VID_PLL_LVDS_EN] = &meson8b_vid_pll_lvds_en.hw,
3417 [CLKID_HDMI_PLL_DCO_IN] = &hdmi_pll_dco_in.hw,
3418 [CLK_NR_CLKS] = NULL,
3423 static struct clk_regmap *const meson8b_clk_regmaps[] = {
3433 &meson8b_smart_card,
3438 &meson8b_async_fifo,
3442 &meson8b_assist_misc,
3453 &meson8b_mixer_iface,
3463 &meson8b_dos_parser,
3469 &meson8b_ahb_data_bus,
3470 &meson8b_ahb_ctrl_bus,
3471 &meson8b_hdmi_intr_sync,
3473 &meson8b_usb1_ddr_bridge,
3474 &meson8b_usb0_ddr_bridge,
3480 &meson8b_sec_ahb_ahb3_bridge,
3482 &meson8b_vclk2_venci0,
3483 &meson8b_vclk2_venci1,
3484 &meson8b_vclk2_vencp0,
3485 &meson8b_vclk2_vencp1,
3486 &meson8b_gclk_venci_int,
3487 &meson8b_gclk_vencp_int,
3489 &meson8b_aoclk_gate,
3490 &meson8b_iec958_gate,
3493 &meson8b_gclk_vencl_int,
3494 &meson8b_vclk2_venclmcc,
3495 &meson8b_vclk2_vencl,
3496 &meson8b_vclk2_other,
3498 &meson8b_ao_media_cpu,
3499 &meson8b_ao_ahb_sram,
3500 &meson8b_ao_ahb_bus,
3502 &meson8b_mpeg_clk_div,
3503 &meson8b_mpeg_clk_sel,
3512 &meson8b_cpu_in_sel,
3513 &meson8b_cpu_scale_div,
3514 &meson8b_cpu_scale_out_sel,
3516 &meson8b_mpll_prediv,
3522 &meson8b_nand_clk_sel,
3523 &meson8b_nand_clk_div,
3524 &meson8b_nand_clk_gate,
3525 &meson8b_fixed_pll_dco,
3526 &meson8b_hdmi_pll_dco,
3527 &meson8b_sys_pll_dco,
3528 &meson8b_apb_clk_sel,
3529 &meson8b_apb_clk_gate,
3530 &meson8b_periph_clk_sel,
3531 &meson8b_periph_clk_gate,
3532 &meson8b_axi_clk_sel,
3533 &meson8b_axi_clk_gate,
3534 &meson8b_l2_dram_clk_sel,
3535 &meson8b_l2_dram_clk_gate,
3536 &meson8b_hdmi_pll_lvds_out,
3537 &meson8b_hdmi_pll_hdmi_out,
3538 &meson8b_vid_pll_in_sel,
3539 &meson8b_vid_pll_in_en,
3540 &meson8b_vid_pll_pre_div,
3541 &meson8b_vid_pll_post_div,
3543 &meson8b_vid_pll_final_div,
3544 &meson8b_vclk_in_sel,
3545 &meson8b_vclk_in_en,
3547 &meson8b_vclk_div1_gate,
3548 &meson8b_vclk_div2_div_gate,
3549 &meson8b_vclk_div4_div_gate,
3550 &meson8b_vclk_div6_div_gate,
3551 &meson8b_vclk_div12_div_gate,
3552 &meson8b_vclk2_in_sel,
3553 &meson8b_vclk2_clk_in_en,
3554 &meson8b_vclk2_clk_en,
3555 &meson8b_vclk2_div1_gate,
3556 &meson8b_vclk2_div2_div_gate,
3557 &meson8b_vclk2_div4_div_gate,
3558 &meson8b_vclk2_div6_div_gate,
3559 &meson8b_vclk2_div12_div_gate,
3560 &meson8b_cts_enct_sel,
3562 &meson8b_cts_encp_sel,
3564 &meson8b_cts_enci_sel,
3566 &meson8b_hdmi_tx_pixel_sel,
3567 &meson8b_hdmi_tx_pixel,
3568 &meson8b_cts_encl_sel,
3570 &meson8b_cts_vdac0_sel,
3572 &meson8b_hdmi_sys_sel,
3573 &meson8b_hdmi_sys_div,
3575 &meson8b_mali_0_sel,
3576 &meson8b_mali_0_div,
3578 &meson8b_mali_1_sel,
3579 &meson8b_mali_1_div,
3582 &meson8m2_gp_pll_dco,
3585 &meson8m2_vpu_0_sel,
3589 &meson8m2_vpu_1_sel,
3593 &meson8b_vdec_1_sel,
3594 &meson8b_vdec_1_1_div,
3596 &meson8b_vdec_1_2_div,
3599 &meson8b_vdec_hcodec_sel,
3600 &meson8b_vdec_hcodec_div,
3601 &meson8b_vdec_hcodec,
3602 &meson8b_vdec_2_sel,
3603 &meson8b_vdec_2_div,
3605 &meson8b_vdec_hevc_sel,
3606 &meson8b_vdec_hevc_div,
3607 &meson8b_vdec_hevc_en,
3610 &meson8b_cts_amclk_sel,
3611 &meson8b_cts_amclk_div,
3612 &meson8b_cts_mclk_i958_sel,
3613 &meson8b_cts_mclk_i958_div,
3614 &meson8b_cts_mclk_i958,
3616 &meson8b_vid_pll_lvds_en,
3619 static const struct meson8b_clk_reset_line {
3623 } meson8b_clk_reset_bits[] = {
3624 [CLKC_RESET_L2_CACHE_SOFT_RESET] = {
3625 .reg = HHI_SYS_CPU_CLK_CNTL0,
3627 .active_low = false,
3629 [CLKC_RESET_AXI_64_TO_128_BRIDGE_A5_SOFT_RESET] = {
3630 .reg = HHI_SYS_CPU_CLK_CNTL0,
3632 .active_low = false,
3634 [CLKC_RESET_SCU_SOFT_RESET] = {
3635 .reg = HHI_SYS_CPU_CLK_CNTL0,
3637 .active_low = false,
3639 [CLKC_RESET_CPU3_SOFT_RESET] = {
3640 .reg = HHI_SYS_CPU_CLK_CNTL0,
3642 .active_low = false,
3644 [CLKC_RESET_CPU2_SOFT_RESET] = {
3645 .reg = HHI_SYS_CPU_CLK_CNTL0,
3647 .active_low = false,
3649 [CLKC_RESET_CPU1_SOFT_RESET] = {
3650 .reg = HHI_SYS_CPU_CLK_CNTL0,
3652 .active_low = false,
3654 [CLKC_RESET_CPU0_SOFT_RESET] = {
3655 .reg = HHI_SYS_CPU_CLK_CNTL0,
3657 .active_low = false,
3659 [CLKC_RESET_A5_GLOBAL_RESET] = {
3660 .reg = HHI_SYS_CPU_CLK_CNTL0,
3662 .active_low = false,
3664 [CLKC_RESET_A5_AXI_SOFT_RESET] = {
3665 .reg = HHI_SYS_CPU_CLK_CNTL0,
3667 .active_low = false,
3669 [CLKC_RESET_A5_ABP_SOFT_RESET] = {
3670 .reg = HHI_SYS_CPU_CLK_CNTL0,
3672 .active_low = false,
3674 [CLKC_RESET_AXI_64_TO_128_BRIDGE_MMC_SOFT_RESET] = {
3675 .reg = HHI_SYS_CPU_CLK_CNTL1,
3677 .active_low = false,
3679 [CLKC_RESET_VID_CLK_CNTL_SOFT_RESET] = {
3680 .reg = HHI_VID_CLK_CNTL,
3682 .active_low = false,
3684 [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST] = {
3685 .reg = HHI_VID_DIVIDER_CNTL,
3687 .active_low = false,
3689 [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE] = {
3690 .reg = HHI_VID_DIVIDER_CNTL,
3692 .active_low = false,
3694 [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST] = {
3695 .reg = HHI_VID_DIVIDER_CNTL,
3699 [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE] = {
3700 .reg = HHI_VID_DIVIDER_CNTL,
3706 static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev,
3707 unsigned long id, bool assert)
3709 struct meson8b_clk_reset *meson8b_clk_reset =
3710 container_of(rcdev, struct meson8b_clk_reset, reset);
3711 const struct meson8b_clk_reset_line *reset;
3712 unsigned int value = 0;
3713 unsigned long flags;
3715 if (id >= ARRAY_SIZE(meson8b_clk_reset_bits))
3718 reset = &meson8b_clk_reset_bits[id];
3720 if (assert != reset->active_low)
3721 value = BIT(reset->bit_idx);
3723 spin_lock_irqsave(&meson_clk_lock, flags);
3725 regmap_update_bits(meson8b_clk_reset->regmap, reset->reg,
3726 BIT(reset->bit_idx), value);
3728 spin_unlock_irqrestore(&meson_clk_lock, flags);
3733 static int meson8b_clk_reset_assert(struct reset_controller_dev *rcdev,
3736 return meson8b_clk_reset_update(rcdev, id, true);
3739 static int meson8b_clk_reset_deassert(struct reset_controller_dev *rcdev,
3742 return meson8b_clk_reset_update(rcdev, id, false);
3745 static const struct reset_control_ops meson8b_clk_reset_ops = {
3746 .assert = meson8b_clk_reset_assert,
3747 .deassert = meson8b_clk_reset_deassert,
3750 struct meson8b_nb_data {
3751 struct notifier_block nb;
3752 struct clk_hw *cpu_clk;
3755 static int meson8b_cpu_clk_notifier_cb(struct notifier_block *nb,
3756 unsigned long event, void *data)
3758 struct meson8b_nb_data *nb_data =
3759 container_of(nb, struct meson8b_nb_data, nb);
3760 struct clk_hw *parent_clk;
3764 case PRE_RATE_CHANGE:
3766 parent_clk = clk_hw_get_parent_by_index(nb_data->cpu_clk, 0);
3769 case POST_RATE_CHANGE:
3770 /* cpu_scale_out_sel */
3771 parent_clk = clk_hw_get_parent_by_index(nb_data->cpu_clk, 1);
3778 ret = clk_hw_set_parent(nb_data->cpu_clk, parent_clk);
3780 return notifier_from_errno(ret);
3787 static struct meson8b_nb_data meson8b_cpu_nb_data = {
3788 .nb.notifier_call = meson8b_cpu_clk_notifier_cb,
3791 static void __init meson8b_clkc_init_common(struct device_node *np,
3792 struct clk_hw_onecell_data *clk_hw_onecell_data)
3794 struct meson8b_clk_reset *rstc;
3795 struct device_node *parent_np;
3796 const char *notifier_clk_name;
3797 struct clk *notifier_clk;
3801 parent_np = of_get_parent(np);
3802 map = syscon_node_to_regmap(parent_np);
3803 of_node_put(parent_np);
3805 pr_err("failed to get HHI regmap - Trying obsolete regs\n");
3809 rstc = kzalloc(sizeof(*rstc), GFP_KERNEL);
3813 /* Reset Controller */
3815 rstc->reset.ops = &meson8b_clk_reset_ops;
3816 rstc->reset.nr_resets = ARRAY_SIZE(meson8b_clk_reset_bits);
3817 rstc->reset.of_node = np;
3818 ret = reset_controller_register(&rstc->reset);
3820 pr_err("%s: Failed to register clkc reset controller: %d\n",
3825 /* Populate regmap for the regmap backed clocks */
3826 for (i = 0; i < ARRAY_SIZE(meson8b_clk_regmaps); i++)
3827 meson8b_clk_regmaps[i]->map = map;
3830 * register all clks and start with the first used ID (which is
3833 for (i = CLKID_PLL_FIXED; i < CLK_NR_CLKS; i++) {
3834 /* array might be sparse */
3835 if (!clk_hw_onecell_data->hws[i])
3838 ret = of_clk_hw_register(np, clk_hw_onecell_data->hws[i]);
3843 meson8b_cpu_nb_data.cpu_clk = clk_hw_onecell_data->hws[CLKID_CPUCLK];
3846 * FIXME we shouldn't program the muxes in notifier handlers. The
3847 * tricky programming sequence will be handled by the forthcoming
3848 * coordinated clock rates mechanism once that feature is released.
3850 notifier_clk_name = clk_hw_get_name(&meson8b_cpu_scale_out_sel.hw);
3851 notifier_clk = __clk_lookup(notifier_clk_name);
3852 ret = clk_notifier_register(notifier_clk, &meson8b_cpu_nb_data.nb);
3854 pr_err("%s: failed to register the CPU clock notifier\n",
3859 ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get,
3860 clk_hw_onecell_data);
3862 pr_err("%s: failed to register clock provider\n", __func__);
3865 static void __init meson8_clkc_init(struct device_node *np)
3867 return meson8b_clkc_init_common(np, &meson8_hw_onecell_data);
3870 static void __init meson8b_clkc_init(struct device_node *np)
3872 return meson8b_clkc_init_common(np, &meson8b_hw_onecell_data);
3875 static void __init meson8m2_clkc_init(struct device_node *np)
3877 return meson8b_clkc_init_common(np, &meson8m2_hw_onecell_data);
3880 CLK_OF_DECLARE_DRIVER(meson8_clkc, "amlogic,meson8-clkc",
3882 CLK_OF_DECLARE_DRIVER(meson8b_clkc, "amlogic,meson8b-clkc",
3884 CLK_OF_DECLARE_DRIVER(meson8m2_clkc, "amlogic,meson8m2-clkc",
3885 meson8m2_clkc_init);