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_regmap meson8b_hdmi_pll_dco = {
122 .data = &(struct meson_clk_pll_data){
124 .reg_off = HHI_VID_PLL_CNTL,
129 .reg_off = HHI_VID_PLL_CNTL,
134 .reg_off = HHI_VID_PLL_CNTL,
139 .reg_off = HHI_VID_PLL_CNTL2,
144 .reg_off = HHI_VID_PLL_CNTL,
149 .reg_off = HHI_VID_PLL_CNTL,
154 .hw.init = &(struct clk_init_data){
155 /* sometimes also called "HPLL" or "HPLL PLL" */
156 .name = "hdmi_pll_dco",
157 .ops = &meson_clk_pll_ro_ops,
158 .parent_data = &(const struct clk_parent_data) {
167 static struct clk_regmap meson8b_hdmi_pll_lvds_out = {
168 .data = &(struct clk_regmap_div_data){
169 .offset = HHI_VID_PLL_CNTL,
172 .flags = CLK_DIVIDER_POWER_OF_TWO,
174 .hw.init = &(struct clk_init_data){
175 .name = "hdmi_pll_lvds_out",
176 .ops = &clk_regmap_divider_ro_ops,
177 .parent_hws = (const struct clk_hw *[]) {
178 &meson8b_hdmi_pll_dco.hw
181 .flags = CLK_SET_RATE_PARENT,
185 static struct clk_regmap meson8b_hdmi_pll_hdmi_out = {
186 .data = &(struct clk_regmap_div_data){
187 .offset = HHI_VID_PLL_CNTL,
190 .flags = CLK_DIVIDER_POWER_OF_TWO,
192 .hw.init = &(struct clk_init_data){
193 .name = "hdmi_pll_hdmi_out",
194 .ops = &clk_regmap_divider_ro_ops,
195 .parent_hws = (const struct clk_hw *[]) {
196 &meson8b_hdmi_pll_dco.hw
199 .flags = CLK_SET_RATE_PARENT,
203 static struct clk_regmap meson8b_sys_pll_dco = {
204 .data = &(struct meson_clk_pll_data){
206 .reg_off = HHI_SYS_PLL_CNTL,
211 .reg_off = HHI_SYS_PLL_CNTL,
216 .reg_off = HHI_SYS_PLL_CNTL,
221 .reg_off = HHI_SYS_PLL_CNTL,
226 .reg_off = HHI_SYS_PLL_CNTL,
230 .table = sys_pll_params_table,
232 .hw.init = &(struct clk_init_data){
233 .name = "sys_pll_dco",
234 .ops = &meson_clk_pll_ops,
235 .parent_data = &(const struct clk_parent_data) {
244 static struct clk_regmap meson8b_sys_pll = {
245 .data = &(struct clk_regmap_div_data){
246 .offset = HHI_SYS_PLL_CNTL,
249 .flags = CLK_DIVIDER_POWER_OF_TWO,
251 .hw.init = &(struct clk_init_data){
253 .ops = &clk_regmap_divider_ops,
254 .parent_hws = (const struct clk_hw *[]) {
255 &meson8b_sys_pll_dco.hw
258 .flags = CLK_SET_RATE_PARENT,
262 static struct clk_fixed_factor meson8b_fclk_div2_div = {
265 .hw.init = &(struct clk_init_data){
266 .name = "fclk_div2_div",
267 .ops = &clk_fixed_factor_ops,
268 .parent_hws = (const struct clk_hw *[]) {
269 &meson8b_fixed_pll.hw
275 static struct clk_regmap meson8b_fclk_div2 = {
276 .data = &(struct clk_regmap_gate_data){
277 .offset = HHI_MPLL_CNTL6,
280 .hw.init = &(struct clk_init_data){
282 .ops = &clk_regmap_gate_ops,
283 .parent_hws = (const struct clk_hw *[]) {
284 &meson8b_fclk_div2_div.hw
290 static struct clk_fixed_factor meson8b_fclk_div3_div = {
293 .hw.init = &(struct clk_init_data){
294 .name = "fclk_div3_div",
295 .ops = &clk_fixed_factor_ops,
296 .parent_hws = (const struct clk_hw *[]) {
297 &meson8b_fixed_pll.hw
303 static struct clk_regmap meson8b_fclk_div3 = {
304 .data = &(struct clk_regmap_gate_data){
305 .offset = HHI_MPLL_CNTL6,
308 .hw.init = &(struct clk_init_data){
310 .ops = &clk_regmap_gate_ops,
311 .parent_hws = (const struct clk_hw *[]) {
312 &meson8b_fclk_div3_div.hw
318 static struct clk_fixed_factor meson8b_fclk_div4_div = {
321 .hw.init = &(struct clk_init_data){
322 .name = "fclk_div4_div",
323 .ops = &clk_fixed_factor_ops,
324 .parent_hws = (const struct clk_hw *[]) {
325 &meson8b_fixed_pll.hw
331 static struct clk_regmap meson8b_fclk_div4 = {
332 .data = &(struct clk_regmap_gate_data){
333 .offset = HHI_MPLL_CNTL6,
336 .hw.init = &(struct clk_init_data){
338 .ops = &clk_regmap_gate_ops,
339 .parent_hws = (const struct clk_hw *[]) {
340 &meson8b_fclk_div4_div.hw
346 static struct clk_fixed_factor meson8b_fclk_div5_div = {
349 .hw.init = &(struct clk_init_data){
350 .name = "fclk_div5_div",
351 .ops = &clk_fixed_factor_ops,
352 .parent_hws = (const struct clk_hw *[]) {
353 &meson8b_fixed_pll.hw
359 static struct clk_regmap meson8b_fclk_div5 = {
360 .data = &(struct clk_regmap_gate_data){
361 .offset = HHI_MPLL_CNTL6,
364 .hw.init = &(struct clk_init_data){
366 .ops = &clk_regmap_gate_ops,
367 .parent_hws = (const struct clk_hw *[]) {
368 &meson8b_fclk_div5_div.hw
374 static struct clk_fixed_factor meson8b_fclk_div7_div = {
377 .hw.init = &(struct clk_init_data){
378 .name = "fclk_div7_div",
379 .ops = &clk_fixed_factor_ops,
380 .parent_hws = (const struct clk_hw *[]) {
381 &meson8b_fixed_pll.hw
387 static struct clk_regmap meson8b_fclk_div7 = {
388 .data = &(struct clk_regmap_gate_data){
389 .offset = HHI_MPLL_CNTL6,
392 .hw.init = &(struct clk_init_data){
394 .ops = &clk_regmap_gate_ops,
395 .parent_hws = (const struct clk_hw *[]) {
396 &meson8b_fclk_div7_div.hw
402 static struct clk_regmap meson8b_mpll_prediv = {
403 .data = &(struct clk_regmap_div_data){
404 .offset = HHI_MPLL_CNTL5,
408 .hw.init = &(struct clk_init_data){
409 .name = "mpll_prediv",
410 .ops = &clk_regmap_divider_ro_ops,
411 .parent_hws = (const struct clk_hw *[]) {
412 &meson8b_fixed_pll.hw
418 static struct clk_regmap meson8b_mpll0_div = {
419 .data = &(struct meson_clk_mpll_data){
421 .reg_off = HHI_MPLL_CNTL7,
426 .reg_off = HHI_MPLL_CNTL7,
431 .reg_off = HHI_MPLL_CNTL7,
436 .reg_off = HHI_MPLL_CNTL,
440 .lock = &meson_clk_lock,
442 .hw.init = &(struct clk_init_data){
444 .ops = &meson_clk_mpll_ops,
445 .parent_hws = (const struct clk_hw *[]) {
446 &meson8b_mpll_prediv.hw
452 static struct clk_regmap meson8b_mpll0 = {
453 .data = &(struct clk_regmap_gate_data){
454 .offset = HHI_MPLL_CNTL7,
457 .hw.init = &(struct clk_init_data){
459 .ops = &clk_regmap_gate_ops,
460 .parent_hws = (const struct clk_hw *[]) {
461 &meson8b_mpll0_div.hw
464 .flags = CLK_SET_RATE_PARENT,
468 static struct clk_regmap meson8b_mpll1_div = {
469 .data = &(struct meson_clk_mpll_data){
471 .reg_off = HHI_MPLL_CNTL8,
476 .reg_off = HHI_MPLL_CNTL8,
481 .reg_off = HHI_MPLL_CNTL8,
485 .lock = &meson_clk_lock,
487 .hw.init = &(struct clk_init_data){
489 .ops = &meson_clk_mpll_ops,
490 .parent_hws = (const struct clk_hw *[]) {
491 &meson8b_mpll_prediv.hw
497 static struct clk_regmap meson8b_mpll1 = {
498 .data = &(struct clk_regmap_gate_data){
499 .offset = HHI_MPLL_CNTL8,
502 .hw.init = &(struct clk_init_data){
504 .ops = &clk_regmap_gate_ops,
505 .parent_hws = (const struct clk_hw *[]) {
506 &meson8b_mpll1_div.hw
509 .flags = CLK_SET_RATE_PARENT,
513 static struct clk_regmap meson8b_mpll2_div = {
514 .data = &(struct meson_clk_mpll_data){
516 .reg_off = HHI_MPLL_CNTL9,
521 .reg_off = HHI_MPLL_CNTL9,
526 .reg_off = HHI_MPLL_CNTL9,
530 .lock = &meson_clk_lock,
532 .hw.init = &(struct clk_init_data){
534 .ops = &meson_clk_mpll_ops,
535 .parent_hws = (const struct clk_hw *[]) {
536 &meson8b_mpll_prediv.hw
542 static struct clk_regmap meson8b_mpll2 = {
543 .data = &(struct clk_regmap_gate_data){
544 .offset = HHI_MPLL_CNTL9,
547 .hw.init = &(struct clk_init_data){
549 .ops = &clk_regmap_gate_ops,
550 .parent_hws = (const struct clk_hw *[]) {
551 &meson8b_mpll2_div.hw
554 .flags = CLK_SET_RATE_PARENT,
558 static u32 mux_table_clk81[] = { 6, 5, 7 };
559 static struct clk_regmap meson8b_mpeg_clk_sel = {
560 .data = &(struct clk_regmap_mux_data){
561 .offset = HHI_MPEG_CLK_CNTL,
564 .table = mux_table_clk81,
566 .hw.init = &(struct clk_init_data){
567 .name = "mpeg_clk_sel",
568 .ops = &clk_regmap_mux_ro_ops,
570 * FIXME bits 14:12 selects from 8 possible parents:
571 * xtal, 1'b0 (wtf), fclk_div7, mpll_clkout1, mpll_clkout2,
572 * fclk_div4, fclk_div3, fclk_div5
574 .parent_hws = (const struct clk_hw *[]) {
575 &meson8b_fclk_div3.hw,
576 &meson8b_fclk_div4.hw,
577 &meson8b_fclk_div5.hw,
583 static struct clk_regmap meson8b_mpeg_clk_div = {
584 .data = &(struct clk_regmap_div_data){
585 .offset = HHI_MPEG_CLK_CNTL,
589 .hw.init = &(struct clk_init_data){
590 .name = "mpeg_clk_div",
591 .ops = &clk_regmap_divider_ro_ops,
592 .parent_hws = (const struct clk_hw *[]) {
593 &meson8b_mpeg_clk_sel.hw
599 static struct clk_regmap meson8b_clk81 = {
600 .data = &(struct clk_regmap_gate_data){
601 .offset = HHI_MPEG_CLK_CNTL,
604 .hw.init = &(struct clk_init_data){
606 .ops = &clk_regmap_gate_ops,
607 .parent_hws = (const struct clk_hw *[]) {
608 &meson8b_mpeg_clk_div.hw
611 .flags = CLK_IS_CRITICAL,
615 static struct clk_regmap meson8b_cpu_in_sel = {
616 .data = &(struct clk_regmap_mux_data){
617 .offset = HHI_SYS_CPU_CLK_CNTL0,
621 .hw.init = &(struct clk_init_data){
622 .name = "cpu_in_sel",
623 .ops = &clk_regmap_mux_ops,
624 .parent_data = (const struct clk_parent_data[]) {
625 { .fw_name = "xtal", .name = "xtal", .index = -1, },
626 { .hw = &meson8b_sys_pll.hw, },
629 .flags = (CLK_SET_RATE_PARENT |
630 CLK_SET_RATE_NO_REPARENT),
634 static struct clk_fixed_factor meson8b_cpu_in_div2 = {
637 .hw.init = &(struct clk_init_data){
638 .name = "cpu_in_div2",
639 .ops = &clk_fixed_factor_ops,
640 .parent_hws = (const struct clk_hw *[]) {
641 &meson8b_cpu_in_sel.hw
644 .flags = CLK_SET_RATE_PARENT,
648 static struct clk_fixed_factor meson8b_cpu_in_div3 = {
651 .hw.init = &(struct clk_init_data){
652 .name = "cpu_in_div3",
653 .ops = &clk_fixed_factor_ops,
654 .parent_hws = (const struct clk_hw *[]) {
655 &meson8b_cpu_in_sel.hw
658 .flags = CLK_SET_RATE_PARENT,
662 static const struct clk_div_table cpu_scale_table[] = {
663 { .val = 1, .div = 4 },
664 { .val = 2, .div = 6 },
665 { .val = 3, .div = 8 },
666 { .val = 4, .div = 10 },
667 { .val = 5, .div = 12 },
668 { .val = 6, .div = 14 },
669 { .val = 7, .div = 16 },
670 { .val = 8, .div = 18 },
674 static struct clk_regmap meson8b_cpu_scale_div = {
675 .data = &(struct clk_regmap_div_data){
676 .offset = HHI_SYS_CPU_CLK_CNTL1,
679 .table = cpu_scale_table,
680 .flags = CLK_DIVIDER_ALLOW_ZERO,
682 .hw.init = &(struct clk_init_data){
683 .name = "cpu_scale_div",
684 .ops = &clk_regmap_divider_ops,
685 .parent_hws = (const struct clk_hw *[]) {
686 &meson8b_cpu_in_sel.hw
689 .flags = CLK_SET_RATE_PARENT,
693 static u32 mux_table_cpu_scale_out_sel[] = { 0, 1, 3 };
694 static struct clk_regmap meson8b_cpu_scale_out_sel = {
695 .data = &(struct clk_regmap_mux_data){
696 .offset = HHI_SYS_CPU_CLK_CNTL0,
699 .table = mux_table_cpu_scale_out_sel,
701 .hw.init = &(struct clk_init_data){
702 .name = "cpu_scale_out_sel",
703 .ops = &clk_regmap_mux_ops,
705 * NOTE: We are skipping the parent with value 0x2 (which is
706 * meson8b_cpu_in_div3) because it results in a duty cycle of
707 * 33% which makes the system unstable and can result in a
708 * lockup of the whole system.
710 .parent_hws = (const struct clk_hw *[]) {
711 &meson8b_cpu_in_sel.hw,
712 &meson8b_cpu_in_div2.hw,
713 &meson8b_cpu_scale_div.hw,
716 .flags = CLK_SET_RATE_PARENT,
720 static struct clk_regmap meson8b_cpu_clk = {
721 .data = &(struct clk_regmap_mux_data){
722 .offset = HHI_SYS_CPU_CLK_CNTL0,
726 .hw.init = &(struct clk_init_data){
728 .ops = &clk_regmap_mux_ops,
729 .parent_data = (const struct clk_parent_data[]) {
730 { .fw_name = "xtal", .name = "xtal", .index = -1, },
731 { .hw = &meson8b_cpu_scale_out_sel.hw, },
734 .flags = (CLK_SET_RATE_PARENT |
735 CLK_SET_RATE_NO_REPARENT |
740 static struct clk_regmap meson8b_nand_clk_sel = {
741 .data = &(struct clk_regmap_mux_data){
742 .offset = HHI_NAND_CLK_CNTL,
745 .flags = CLK_MUX_ROUND_CLOSEST,
747 .hw.init = &(struct clk_init_data){
748 .name = "nand_clk_sel",
749 .ops = &clk_regmap_mux_ops,
750 /* FIXME all other parents are unknown: */
751 .parent_data = (const struct clk_parent_data[]) {
752 { .hw = &meson8b_fclk_div4.hw, },
753 { .hw = &meson8b_fclk_div3.hw, },
754 { .hw = &meson8b_fclk_div5.hw, },
755 { .hw = &meson8b_fclk_div7.hw, },
756 { .fw_name = "xtal", .name = "xtal", .index = -1, },
759 .flags = CLK_SET_RATE_PARENT,
763 static struct clk_regmap meson8b_nand_clk_div = {
764 .data = &(struct clk_regmap_div_data){
765 .offset = HHI_NAND_CLK_CNTL,
768 .flags = CLK_DIVIDER_ROUND_CLOSEST,
770 .hw.init = &(struct clk_init_data){
771 .name = "nand_clk_div",
772 .ops = &clk_regmap_divider_ops,
773 .parent_hws = (const struct clk_hw *[]) {
774 &meson8b_nand_clk_sel.hw
777 .flags = CLK_SET_RATE_PARENT,
781 static struct clk_regmap meson8b_nand_clk_gate = {
782 .data = &(struct clk_regmap_gate_data){
783 .offset = HHI_NAND_CLK_CNTL,
786 .hw.init = &(struct clk_init_data){
787 .name = "nand_clk_gate",
788 .ops = &clk_regmap_gate_ops,
789 .parent_hws = (const struct clk_hw *[]) {
790 &meson8b_nand_clk_div.hw
793 .flags = CLK_SET_RATE_PARENT,
797 static struct clk_fixed_factor meson8b_cpu_clk_div2 = {
800 .hw.init = &(struct clk_init_data){
801 .name = "cpu_clk_div2",
802 .ops = &clk_fixed_factor_ops,
803 .parent_hws = (const struct clk_hw *[]) {
810 static struct clk_fixed_factor meson8b_cpu_clk_div3 = {
813 .hw.init = &(struct clk_init_data){
814 .name = "cpu_clk_div3",
815 .ops = &clk_fixed_factor_ops,
816 .parent_hws = (const struct clk_hw *[]) {
823 static struct clk_fixed_factor meson8b_cpu_clk_div4 = {
826 .hw.init = &(struct clk_init_data){
827 .name = "cpu_clk_div4",
828 .ops = &clk_fixed_factor_ops,
829 .parent_hws = (const struct clk_hw *[]) {
836 static struct clk_fixed_factor meson8b_cpu_clk_div5 = {
839 .hw.init = &(struct clk_init_data){
840 .name = "cpu_clk_div5",
841 .ops = &clk_fixed_factor_ops,
842 .parent_hws = (const struct clk_hw *[]) {
849 static struct clk_fixed_factor meson8b_cpu_clk_div6 = {
852 .hw.init = &(struct clk_init_data){
853 .name = "cpu_clk_div6",
854 .ops = &clk_fixed_factor_ops,
855 .parent_hws = (const struct clk_hw *[]) {
862 static struct clk_fixed_factor meson8b_cpu_clk_div7 = {
865 .hw.init = &(struct clk_init_data){
866 .name = "cpu_clk_div7",
867 .ops = &clk_fixed_factor_ops,
868 .parent_hws = (const struct clk_hw *[]) {
875 static struct clk_fixed_factor meson8b_cpu_clk_div8 = {
878 .hw.init = &(struct clk_init_data){
879 .name = "cpu_clk_div8",
880 .ops = &clk_fixed_factor_ops,
881 .parent_hws = (const struct clk_hw *[]) {
888 static u32 mux_table_apb[] = { 1, 2, 3, 4, 5, 6, 7 };
889 static struct clk_regmap meson8b_apb_clk_sel = {
890 .data = &(struct clk_regmap_mux_data){
891 .offset = HHI_SYS_CPU_CLK_CNTL1,
894 .table = mux_table_apb,
896 .hw.init = &(struct clk_init_data){
897 .name = "apb_clk_sel",
898 .ops = &clk_regmap_mux_ops,
899 .parent_hws = (const struct clk_hw *[]) {
900 &meson8b_cpu_clk_div2.hw,
901 &meson8b_cpu_clk_div3.hw,
902 &meson8b_cpu_clk_div4.hw,
903 &meson8b_cpu_clk_div5.hw,
904 &meson8b_cpu_clk_div6.hw,
905 &meson8b_cpu_clk_div7.hw,
906 &meson8b_cpu_clk_div8.hw,
912 static struct clk_regmap meson8b_apb_clk_gate = {
913 .data = &(struct clk_regmap_gate_data){
914 .offset = HHI_SYS_CPU_CLK_CNTL1,
916 .flags = CLK_GATE_SET_TO_DISABLE,
918 .hw.init = &(struct clk_init_data){
919 .name = "apb_clk_dis",
920 .ops = &clk_regmap_gate_ro_ops,
921 .parent_hws = (const struct clk_hw *[]) {
922 &meson8b_apb_clk_sel.hw
925 .flags = CLK_SET_RATE_PARENT,
929 static struct clk_regmap meson8b_periph_clk_sel = {
930 .data = &(struct clk_regmap_mux_data){
931 .offset = HHI_SYS_CPU_CLK_CNTL1,
935 .hw.init = &(struct clk_init_data){
936 .name = "periph_clk_sel",
937 .ops = &clk_regmap_mux_ops,
938 .parent_hws = (const struct clk_hw *[]) {
939 &meson8b_cpu_clk_div2.hw,
940 &meson8b_cpu_clk_div3.hw,
941 &meson8b_cpu_clk_div4.hw,
942 &meson8b_cpu_clk_div5.hw,
943 &meson8b_cpu_clk_div6.hw,
944 &meson8b_cpu_clk_div7.hw,
945 &meson8b_cpu_clk_div8.hw,
951 static struct clk_regmap meson8b_periph_clk_gate = {
952 .data = &(struct clk_regmap_gate_data){
953 .offset = HHI_SYS_CPU_CLK_CNTL1,
955 .flags = CLK_GATE_SET_TO_DISABLE,
957 .hw.init = &(struct clk_init_data){
958 .name = "periph_clk_dis",
959 .ops = &clk_regmap_gate_ro_ops,
960 .parent_hws = (const struct clk_hw *[]) {
961 &meson8b_periph_clk_sel.hw
964 .flags = CLK_SET_RATE_PARENT,
968 static u32 mux_table_axi[] = { 1, 2, 3, 4, 5, 6, 7 };
969 static struct clk_regmap meson8b_axi_clk_sel = {
970 .data = &(struct clk_regmap_mux_data){
971 .offset = HHI_SYS_CPU_CLK_CNTL1,
974 .table = mux_table_axi,
976 .hw.init = &(struct clk_init_data){
977 .name = "axi_clk_sel",
978 .ops = &clk_regmap_mux_ops,
979 .parent_hws = (const struct clk_hw *[]) {
980 &meson8b_cpu_clk_div2.hw,
981 &meson8b_cpu_clk_div3.hw,
982 &meson8b_cpu_clk_div4.hw,
983 &meson8b_cpu_clk_div5.hw,
984 &meson8b_cpu_clk_div6.hw,
985 &meson8b_cpu_clk_div7.hw,
986 &meson8b_cpu_clk_div8.hw,
992 static struct clk_regmap meson8b_axi_clk_gate = {
993 .data = &(struct clk_regmap_gate_data){
994 .offset = HHI_SYS_CPU_CLK_CNTL1,
996 .flags = CLK_GATE_SET_TO_DISABLE,
998 .hw.init = &(struct clk_init_data){
999 .name = "axi_clk_dis",
1000 .ops = &clk_regmap_gate_ro_ops,
1001 .parent_hws = (const struct clk_hw *[]) {
1002 &meson8b_axi_clk_sel.hw
1005 .flags = CLK_SET_RATE_PARENT,
1009 static struct clk_regmap meson8b_l2_dram_clk_sel = {
1010 .data = &(struct clk_regmap_mux_data){
1011 .offset = HHI_SYS_CPU_CLK_CNTL1,
1015 .hw.init = &(struct clk_init_data){
1016 .name = "l2_dram_clk_sel",
1017 .ops = &clk_regmap_mux_ops,
1018 .parent_hws = (const struct clk_hw *[]) {
1019 &meson8b_cpu_clk_div2.hw,
1020 &meson8b_cpu_clk_div3.hw,
1021 &meson8b_cpu_clk_div4.hw,
1022 &meson8b_cpu_clk_div5.hw,
1023 &meson8b_cpu_clk_div6.hw,
1024 &meson8b_cpu_clk_div7.hw,
1025 &meson8b_cpu_clk_div8.hw,
1031 static struct clk_regmap meson8b_l2_dram_clk_gate = {
1032 .data = &(struct clk_regmap_gate_data){
1033 .offset = HHI_SYS_CPU_CLK_CNTL1,
1035 .flags = CLK_GATE_SET_TO_DISABLE,
1037 .hw.init = &(struct clk_init_data){
1038 .name = "l2_dram_clk_dis",
1039 .ops = &clk_regmap_gate_ro_ops,
1040 .parent_hws = (const struct clk_hw *[]) {
1041 &meson8b_l2_dram_clk_sel.hw
1044 .flags = CLK_SET_RATE_PARENT,
1048 static struct clk_regmap meson8b_vid_pll_in_sel = {
1049 .data = &(struct clk_regmap_mux_data){
1050 .offset = HHI_VID_DIVIDER_CNTL,
1054 .hw.init = &(struct clk_init_data){
1055 .name = "vid_pll_in_sel",
1056 .ops = &clk_regmap_mux_ro_ops,
1058 * TODO: depending on the SoC there is also a second parent:
1060 * Meson8b: hdmi_pll_dco
1061 * Meson8m2: vid2_pll
1063 .parent_hws = (const struct clk_hw *[]) {
1064 &meson8b_hdmi_pll_lvds_out.hw
1067 .flags = CLK_SET_RATE_PARENT,
1071 static struct clk_regmap meson8b_vid_pll_in_en = {
1072 .data = &(struct clk_regmap_gate_data){
1073 .offset = HHI_VID_DIVIDER_CNTL,
1076 .hw.init = &(struct clk_init_data){
1077 .name = "vid_pll_in_en",
1078 .ops = &clk_regmap_gate_ro_ops,
1079 .parent_hws = (const struct clk_hw *[]) {
1080 &meson8b_vid_pll_in_sel.hw
1083 .flags = CLK_SET_RATE_PARENT,
1087 static struct clk_regmap meson8b_vid_pll_pre_div = {
1088 .data = &(struct clk_regmap_div_data){
1089 .offset = HHI_VID_DIVIDER_CNTL,
1093 .hw.init = &(struct clk_init_data){
1094 .name = "vid_pll_pre_div",
1095 .ops = &clk_regmap_divider_ro_ops,
1096 .parent_hws = (const struct clk_hw *[]) {
1097 &meson8b_vid_pll_in_en.hw
1100 .flags = CLK_SET_RATE_PARENT,
1104 static struct clk_regmap meson8b_vid_pll_post_div = {
1105 .data = &(struct clk_regmap_div_data){
1106 .offset = HHI_VID_DIVIDER_CNTL,
1110 .hw.init = &(struct clk_init_data){
1111 .name = "vid_pll_post_div",
1112 .ops = &clk_regmap_divider_ro_ops,
1113 .parent_hws = (const struct clk_hw *[]) {
1114 &meson8b_vid_pll_pre_div.hw
1117 .flags = CLK_SET_RATE_PARENT,
1121 static struct clk_regmap meson8b_vid_pll = {
1122 .data = &(struct clk_regmap_mux_data){
1123 .offset = HHI_VID_DIVIDER_CNTL,
1127 .hw.init = &(struct clk_init_data){
1129 .ops = &clk_regmap_mux_ro_ops,
1130 /* TODO: parent 0x2 is vid_pll_pre_div_mult7_div2 */
1131 .parent_hws = (const struct clk_hw *[]) {
1132 &meson8b_vid_pll_pre_div.hw,
1133 &meson8b_vid_pll_post_div.hw,
1136 .flags = CLK_SET_RATE_PARENT,
1140 static struct clk_regmap meson8b_vid_pll_final_div = {
1141 .data = &(struct clk_regmap_div_data){
1142 .offset = HHI_VID_CLK_DIV,
1146 .hw.init = &(struct clk_init_data){
1147 .name = "vid_pll_final_div",
1148 .ops = &clk_regmap_divider_ro_ops,
1149 .parent_hws = (const struct clk_hw *[]) {
1153 .flags = CLK_SET_RATE_PARENT,
1157 static const struct clk_hw *meson8b_vclk_mux_parent_hws[] = {
1158 &meson8b_vid_pll_final_div.hw,
1159 &meson8b_fclk_div4.hw,
1160 &meson8b_fclk_div3.hw,
1161 &meson8b_fclk_div5.hw,
1162 &meson8b_vid_pll_final_div.hw,
1163 &meson8b_fclk_div7.hw,
1167 static struct clk_regmap meson8b_vclk_in_sel = {
1168 .data = &(struct clk_regmap_mux_data){
1169 .offset = HHI_VID_CLK_CNTL,
1173 .hw.init = &(struct clk_init_data){
1174 .name = "vclk_in_sel",
1175 .ops = &clk_regmap_mux_ro_ops,
1176 .parent_hws = meson8b_vclk_mux_parent_hws,
1177 .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws),
1178 .flags = CLK_SET_RATE_PARENT,
1182 static struct clk_regmap meson8b_vclk_in_en = {
1183 .data = &(struct clk_regmap_gate_data){
1184 .offset = HHI_VID_CLK_DIV,
1187 .hw.init = &(struct clk_init_data){
1188 .name = "vclk_in_en",
1189 .ops = &clk_regmap_gate_ro_ops,
1190 .parent_hws = (const struct clk_hw *[]) {
1191 &meson8b_vclk_in_sel.hw
1194 .flags = CLK_SET_RATE_PARENT,
1198 static struct clk_regmap meson8b_vclk_en = {
1199 .data = &(struct clk_regmap_gate_data){
1200 .offset = HHI_VID_CLK_CNTL,
1203 .hw.init = &(struct clk_init_data){
1205 .ops = &clk_regmap_gate_ro_ops,
1206 .parent_hws = (const struct clk_hw *[]) {
1207 &meson8b_vclk_in_en.hw
1210 .flags = CLK_SET_RATE_PARENT,
1214 static struct clk_regmap meson8b_vclk_div1_gate = {
1215 .data = &(struct clk_regmap_gate_data){
1216 .offset = HHI_VID_CLK_CNTL,
1219 .hw.init = &(struct clk_init_data){
1220 .name = "vclk_div1_en",
1221 .ops = &clk_regmap_gate_ro_ops,
1222 .parent_hws = (const struct clk_hw *[]) {
1226 .flags = CLK_SET_RATE_PARENT,
1230 static struct clk_fixed_factor meson8b_vclk_div2_div = {
1233 .hw.init = &(struct clk_init_data){
1234 .name = "vclk_div2",
1235 .ops = &clk_fixed_factor_ops,
1236 .parent_hws = (const struct clk_hw *[]) {
1240 .flags = CLK_SET_RATE_PARENT,
1244 static struct clk_regmap meson8b_vclk_div2_div_gate = {
1245 .data = &(struct clk_regmap_gate_data){
1246 .offset = HHI_VID_CLK_CNTL,
1249 .hw.init = &(struct clk_init_data){
1250 .name = "vclk_div2_en",
1251 .ops = &clk_regmap_gate_ro_ops,
1252 .parent_hws = (const struct clk_hw *[]) {
1253 &meson8b_vclk_div2_div.hw
1256 .flags = CLK_SET_RATE_PARENT,
1260 static struct clk_fixed_factor meson8b_vclk_div4_div = {
1263 .hw.init = &(struct clk_init_data){
1264 .name = "vclk_div4",
1265 .ops = &clk_fixed_factor_ops,
1266 .parent_hws = (const struct clk_hw *[]) {
1270 .flags = CLK_SET_RATE_PARENT,
1274 static struct clk_regmap meson8b_vclk_div4_div_gate = {
1275 .data = &(struct clk_regmap_gate_data){
1276 .offset = HHI_VID_CLK_CNTL,
1279 .hw.init = &(struct clk_init_data){
1280 .name = "vclk_div4_en",
1281 .ops = &clk_regmap_gate_ro_ops,
1282 .parent_hws = (const struct clk_hw *[]) {
1283 &meson8b_vclk_div4_div.hw
1286 .flags = CLK_SET_RATE_PARENT,
1290 static struct clk_fixed_factor meson8b_vclk_div6_div = {
1293 .hw.init = &(struct clk_init_data){
1294 .name = "vclk_div6",
1295 .ops = &clk_fixed_factor_ops,
1296 .parent_hws = (const struct clk_hw *[]) {
1300 .flags = CLK_SET_RATE_PARENT,
1304 static struct clk_regmap meson8b_vclk_div6_div_gate = {
1305 .data = &(struct clk_regmap_gate_data){
1306 .offset = HHI_VID_CLK_CNTL,
1309 .hw.init = &(struct clk_init_data){
1310 .name = "vclk_div6_en",
1311 .ops = &clk_regmap_gate_ro_ops,
1312 .parent_hws = (const struct clk_hw *[]) {
1313 &meson8b_vclk_div6_div.hw
1316 .flags = CLK_SET_RATE_PARENT,
1320 static struct clk_fixed_factor meson8b_vclk_div12_div = {
1323 .hw.init = &(struct clk_init_data){
1324 .name = "vclk_div12",
1325 .ops = &clk_fixed_factor_ops,
1326 .parent_hws = (const struct clk_hw *[]) {
1330 .flags = CLK_SET_RATE_PARENT,
1334 static struct clk_regmap meson8b_vclk_div12_div_gate = {
1335 .data = &(struct clk_regmap_gate_data){
1336 .offset = HHI_VID_CLK_CNTL,
1339 .hw.init = &(struct clk_init_data){
1340 .name = "vclk_div12_en",
1341 .ops = &clk_regmap_gate_ro_ops,
1342 .parent_hws = (const struct clk_hw *[]) {
1343 &meson8b_vclk_div12_div.hw
1346 .flags = CLK_SET_RATE_PARENT,
1350 static struct clk_regmap meson8b_vclk2_in_sel = {
1351 .data = &(struct clk_regmap_mux_data){
1352 .offset = HHI_VIID_CLK_CNTL,
1356 .hw.init = &(struct clk_init_data){
1357 .name = "vclk2_in_sel",
1358 .ops = &clk_regmap_mux_ro_ops,
1359 .parent_hws = meson8b_vclk_mux_parent_hws,
1360 .num_parents = ARRAY_SIZE(meson8b_vclk_mux_parent_hws),
1361 .flags = CLK_SET_RATE_PARENT,
1365 static struct clk_regmap meson8b_vclk2_clk_in_en = {
1366 .data = &(struct clk_regmap_gate_data){
1367 .offset = HHI_VIID_CLK_DIV,
1370 .hw.init = &(struct clk_init_data){
1371 .name = "vclk2_in_en",
1372 .ops = &clk_regmap_gate_ro_ops,
1373 .parent_hws = (const struct clk_hw *[]) {
1374 &meson8b_vclk2_in_sel.hw
1377 .flags = CLK_SET_RATE_PARENT,
1381 static struct clk_regmap meson8b_vclk2_clk_en = {
1382 .data = &(struct clk_regmap_gate_data){
1383 .offset = HHI_VIID_CLK_DIV,
1386 .hw.init = &(struct clk_init_data){
1388 .ops = &clk_regmap_gate_ro_ops,
1389 .parent_hws = (const struct clk_hw *[]) {
1390 &meson8b_vclk2_clk_in_en.hw
1393 .flags = CLK_SET_RATE_PARENT,
1397 static struct clk_regmap meson8b_vclk2_div1_gate = {
1398 .data = &(struct clk_regmap_gate_data){
1399 .offset = HHI_VIID_CLK_DIV,
1402 .hw.init = &(struct clk_init_data){
1403 .name = "vclk2_div1_en",
1404 .ops = &clk_regmap_gate_ro_ops,
1405 .parent_hws = (const struct clk_hw *[]) {
1406 &meson8b_vclk2_clk_en.hw
1409 .flags = CLK_SET_RATE_PARENT,
1413 static struct clk_fixed_factor meson8b_vclk2_div2_div = {
1416 .hw.init = &(struct clk_init_data){
1417 .name = "vclk2_div2",
1418 .ops = &clk_fixed_factor_ops,
1419 .parent_hws = (const struct clk_hw *[]) {
1420 &meson8b_vclk2_clk_en.hw
1423 .flags = CLK_SET_RATE_PARENT,
1427 static struct clk_regmap meson8b_vclk2_div2_div_gate = {
1428 .data = &(struct clk_regmap_gate_data){
1429 .offset = HHI_VIID_CLK_DIV,
1432 .hw.init = &(struct clk_init_data){
1433 .name = "vclk2_div2_en",
1434 .ops = &clk_regmap_gate_ro_ops,
1435 .parent_hws = (const struct clk_hw *[]) {
1436 &meson8b_vclk2_div2_div.hw
1439 .flags = CLK_SET_RATE_PARENT,
1443 static struct clk_fixed_factor meson8b_vclk2_div4_div = {
1446 .hw.init = &(struct clk_init_data){
1447 .name = "vclk2_div4",
1448 .ops = &clk_fixed_factor_ops,
1449 .parent_hws = (const struct clk_hw *[]) {
1450 &meson8b_vclk2_clk_en.hw
1453 .flags = CLK_SET_RATE_PARENT,
1457 static struct clk_regmap meson8b_vclk2_div4_div_gate = {
1458 .data = &(struct clk_regmap_gate_data){
1459 .offset = HHI_VIID_CLK_DIV,
1462 .hw.init = &(struct clk_init_data){
1463 .name = "vclk2_div4_en",
1464 .ops = &clk_regmap_gate_ro_ops,
1465 .parent_hws = (const struct clk_hw *[]) {
1466 &meson8b_vclk2_div4_div.hw
1469 .flags = CLK_SET_RATE_PARENT,
1473 static struct clk_fixed_factor meson8b_vclk2_div6_div = {
1476 .hw.init = &(struct clk_init_data){
1477 .name = "vclk2_div6",
1478 .ops = &clk_fixed_factor_ops,
1479 .parent_hws = (const struct clk_hw *[]) {
1480 &meson8b_vclk2_clk_en.hw
1483 .flags = CLK_SET_RATE_PARENT,
1487 static struct clk_regmap meson8b_vclk2_div6_div_gate = {
1488 .data = &(struct clk_regmap_gate_data){
1489 .offset = HHI_VIID_CLK_DIV,
1492 .hw.init = &(struct clk_init_data){
1493 .name = "vclk2_div6_en",
1494 .ops = &clk_regmap_gate_ro_ops,
1495 .parent_hws = (const struct clk_hw *[]) {
1496 &meson8b_vclk2_div6_div.hw
1499 .flags = CLK_SET_RATE_PARENT,
1503 static struct clk_fixed_factor meson8b_vclk2_div12_div = {
1506 .hw.init = &(struct clk_init_data){
1507 .name = "vclk2_div12",
1508 .ops = &clk_fixed_factor_ops,
1509 .parent_hws = (const struct clk_hw *[]) {
1510 &meson8b_vclk2_clk_en.hw
1513 .flags = CLK_SET_RATE_PARENT,
1517 static struct clk_regmap meson8b_vclk2_div12_div_gate = {
1518 .data = &(struct clk_regmap_gate_data){
1519 .offset = HHI_VIID_CLK_DIV,
1522 .hw.init = &(struct clk_init_data){
1523 .name = "vclk2_div12_en",
1524 .ops = &clk_regmap_gate_ro_ops,
1525 .parent_hws = (const struct clk_hw *[]) {
1526 &meson8b_vclk2_div12_div.hw
1529 .flags = CLK_SET_RATE_PARENT,
1533 static const struct clk_hw *meson8b_vclk_enc_mux_parent_hws[] = {
1534 &meson8b_vclk_div1_gate.hw,
1535 &meson8b_vclk_div2_div_gate.hw,
1536 &meson8b_vclk_div4_div_gate.hw,
1537 &meson8b_vclk_div6_div_gate.hw,
1538 &meson8b_vclk_div12_div_gate.hw,
1541 static struct clk_regmap meson8b_cts_enct_sel = {
1542 .data = &(struct clk_regmap_mux_data){
1543 .offset = HHI_VID_CLK_DIV,
1547 .hw.init = &(struct clk_init_data){
1548 .name = "cts_enct_sel",
1549 .ops = &clk_regmap_mux_ro_ops,
1550 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1551 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1552 .flags = CLK_SET_RATE_PARENT,
1556 static struct clk_regmap meson8b_cts_enct = {
1557 .data = &(struct clk_regmap_gate_data){
1558 .offset = HHI_VID_CLK_CNTL2,
1561 .hw.init = &(struct clk_init_data){
1563 .ops = &clk_regmap_gate_ro_ops,
1564 .parent_hws = (const struct clk_hw *[]) {
1565 &meson8b_cts_enct_sel.hw
1568 .flags = CLK_SET_RATE_PARENT,
1572 static struct clk_regmap meson8b_cts_encp_sel = {
1573 .data = &(struct clk_regmap_mux_data){
1574 .offset = HHI_VID_CLK_DIV,
1578 .hw.init = &(struct clk_init_data){
1579 .name = "cts_encp_sel",
1580 .ops = &clk_regmap_mux_ro_ops,
1581 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1582 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1583 .flags = CLK_SET_RATE_PARENT,
1587 static struct clk_regmap meson8b_cts_encp = {
1588 .data = &(struct clk_regmap_gate_data){
1589 .offset = HHI_VID_CLK_CNTL2,
1592 .hw.init = &(struct clk_init_data){
1594 .ops = &clk_regmap_gate_ro_ops,
1595 .parent_hws = (const struct clk_hw *[]) {
1596 &meson8b_cts_encp_sel.hw
1599 .flags = CLK_SET_RATE_PARENT,
1603 static struct clk_regmap meson8b_cts_enci_sel = {
1604 .data = &(struct clk_regmap_mux_data){
1605 .offset = HHI_VID_CLK_DIV,
1609 .hw.init = &(struct clk_init_data){
1610 .name = "cts_enci_sel",
1611 .ops = &clk_regmap_mux_ro_ops,
1612 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1613 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1614 .flags = CLK_SET_RATE_PARENT,
1618 static struct clk_regmap meson8b_cts_enci = {
1619 .data = &(struct clk_regmap_gate_data){
1620 .offset = HHI_VID_CLK_CNTL2,
1623 .hw.init = &(struct clk_init_data){
1625 .ops = &clk_regmap_gate_ro_ops,
1626 .parent_hws = (const struct clk_hw *[]) {
1627 &meson8b_cts_enci_sel.hw
1630 .flags = CLK_SET_RATE_PARENT,
1634 static struct clk_regmap meson8b_hdmi_tx_pixel_sel = {
1635 .data = &(struct clk_regmap_mux_data){
1636 .offset = HHI_HDMI_CLK_CNTL,
1640 .hw.init = &(struct clk_init_data){
1641 .name = "hdmi_tx_pixel_sel",
1642 .ops = &clk_regmap_mux_ro_ops,
1643 .parent_hws = meson8b_vclk_enc_mux_parent_hws,
1644 .num_parents = ARRAY_SIZE(meson8b_vclk_enc_mux_parent_hws),
1645 .flags = CLK_SET_RATE_PARENT,
1649 static struct clk_regmap meson8b_hdmi_tx_pixel = {
1650 .data = &(struct clk_regmap_gate_data){
1651 .offset = HHI_VID_CLK_CNTL2,
1654 .hw.init = &(struct clk_init_data){
1655 .name = "hdmi_tx_pixel",
1656 .ops = &clk_regmap_gate_ro_ops,
1657 .parent_hws = (const struct clk_hw *[]) {
1658 &meson8b_hdmi_tx_pixel_sel.hw
1661 .flags = CLK_SET_RATE_PARENT,
1665 static const struct clk_hw *meson8b_vclk2_enc_mux_parent_hws[] = {
1666 &meson8b_vclk2_div1_gate.hw,
1667 &meson8b_vclk2_div2_div_gate.hw,
1668 &meson8b_vclk2_div4_div_gate.hw,
1669 &meson8b_vclk2_div6_div_gate.hw,
1670 &meson8b_vclk2_div12_div_gate.hw,
1673 static struct clk_regmap meson8b_cts_encl_sel = {
1674 .data = &(struct clk_regmap_mux_data){
1675 .offset = HHI_VIID_CLK_DIV,
1679 .hw.init = &(struct clk_init_data){
1680 .name = "cts_encl_sel",
1681 .ops = &clk_regmap_mux_ro_ops,
1682 .parent_hws = meson8b_vclk2_enc_mux_parent_hws,
1683 .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws),
1684 .flags = CLK_SET_RATE_PARENT,
1688 static struct clk_regmap meson8b_cts_encl = {
1689 .data = &(struct clk_regmap_gate_data){
1690 .offset = HHI_VID_CLK_CNTL2,
1693 .hw.init = &(struct clk_init_data){
1695 .ops = &clk_regmap_gate_ro_ops,
1696 .parent_hws = (const struct clk_hw *[]) {
1697 &meson8b_cts_encl_sel.hw
1700 .flags = CLK_SET_RATE_PARENT,
1704 static struct clk_regmap meson8b_cts_vdac0_sel = {
1705 .data = &(struct clk_regmap_mux_data){
1706 .offset = HHI_VIID_CLK_DIV,
1710 .hw.init = &(struct clk_init_data){
1711 .name = "cts_vdac0_sel",
1712 .ops = &clk_regmap_mux_ro_ops,
1713 .parent_hws = meson8b_vclk2_enc_mux_parent_hws,
1714 .num_parents = ARRAY_SIZE(meson8b_vclk2_enc_mux_parent_hws),
1715 .flags = CLK_SET_RATE_PARENT,
1719 static struct clk_regmap meson8b_cts_vdac0 = {
1720 .data = &(struct clk_regmap_gate_data){
1721 .offset = HHI_VID_CLK_CNTL2,
1724 .hw.init = &(struct clk_init_data){
1725 .name = "cts_vdac0",
1726 .ops = &clk_regmap_gate_ro_ops,
1727 .parent_hws = (const struct clk_hw *[]) {
1728 &meson8b_cts_vdac0_sel.hw
1731 .flags = CLK_SET_RATE_PARENT,
1735 static struct clk_regmap meson8b_hdmi_sys_sel = {
1736 .data = &(struct clk_regmap_mux_data){
1737 .offset = HHI_HDMI_CLK_CNTL,
1740 .flags = CLK_MUX_ROUND_CLOSEST,
1742 .hw.init = &(struct clk_init_data){
1743 .name = "hdmi_sys_sel",
1744 .ops = &clk_regmap_mux_ops,
1745 /* FIXME: all other parents are unknown */
1746 .parent_data = &(const struct clk_parent_data) {
1752 .flags = CLK_SET_RATE_NO_REPARENT,
1756 static struct clk_regmap meson8b_hdmi_sys_div = {
1757 .data = &(struct clk_regmap_div_data){
1758 .offset = HHI_HDMI_CLK_CNTL,
1762 .hw.init = &(struct clk_init_data){
1763 .name = "hdmi_sys_div",
1764 .ops = &clk_regmap_divider_ops,
1765 .parent_hws = (const struct clk_hw *[]) {
1766 &meson8b_hdmi_sys_sel.hw
1769 .flags = CLK_SET_RATE_PARENT,
1773 static struct clk_regmap meson8b_hdmi_sys = {
1774 .data = &(struct clk_regmap_gate_data){
1775 .offset = HHI_HDMI_CLK_CNTL,
1778 .hw.init = &(struct clk_init_data) {
1780 .ops = &clk_regmap_gate_ops,
1781 .parent_hws = (const struct clk_hw *[]) {
1782 &meson8b_hdmi_sys_div.hw
1785 .flags = CLK_SET_RATE_PARENT,
1790 * The MALI IP is clocked by two identical clocks (mali_0 and mali_1)
1791 * muxed by a glitch-free switch on Meson8b and Meson8m2. The CCF can
1792 * actually manage this glitch-free mux because it does top-to-bottom
1793 * updates the each clock tree and switches to the "inactive" one when
1794 * CLK_SET_RATE_GATE is set.
1795 * Meson8 only has mali_0 and no glitch-free mux.
1797 static const struct clk_parent_data meson8b_mali_0_1_parent_data[] = {
1798 { .fw_name = "xtal", .name = "xtal", .index = -1, },
1799 { .hw = &meson8b_mpll2.hw, },
1800 { .hw = &meson8b_mpll1.hw, },
1801 { .hw = &meson8b_fclk_div7.hw, },
1802 { .hw = &meson8b_fclk_div4.hw, },
1803 { .hw = &meson8b_fclk_div3.hw, },
1804 { .hw = &meson8b_fclk_div5.hw, },
1807 static u32 meson8b_mali_0_1_mux_table[] = { 0, 2, 3, 4, 5, 6, 7 };
1809 static struct clk_regmap meson8b_mali_0_sel = {
1810 .data = &(struct clk_regmap_mux_data){
1811 .offset = HHI_MALI_CLK_CNTL,
1814 .table = meson8b_mali_0_1_mux_table,
1816 .hw.init = &(struct clk_init_data){
1817 .name = "mali_0_sel",
1818 .ops = &clk_regmap_mux_ops,
1819 .parent_data = meson8b_mali_0_1_parent_data,
1820 .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_data),
1822 * Don't propagate rate changes up because the only changeable
1823 * parents are mpll1 and mpll2 but we need those for audio and
1824 * RGMII (Ethernet). We don't want to change the audio or
1825 * Ethernet clocks when setting the GPU frequency.
1831 static struct clk_regmap meson8b_mali_0_div = {
1832 .data = &(struct clk_regmap_div_data){
1833 .offset = HHI_MALI_CLK_CNTL,
1837 .hw.init = &(struct clk_init_data){
1838 .name = "mali_0_div",
1839 .ops = &clk_regmap_divider_ops,
1840 .parent_hws = (const struct clk_hw *[]) {
1841 &meson8b_mali_0_sel.hw
1844 .flags = CLK_SET_RATE_PARENT,
1848 static struct clk_regmap meson8b_mali_0 = {
1849 .data = &(struct clk_regmap_gate_data){
1850 .offset = HHI_MALI_CLK_CNTL,
1853 .hw.init = &(struct clk_init_data){
1855 .ops = &clk_regmap_gate_ops,
1856 .parent_hws = (const struct clk_hw *[]) {
1857 &meson8b_mali_0_div.hw
1860 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
1864 static struct clk_regmap meson8b_mali_1_sel = {
1865 .data = &(struct clk_regmap_mux_data){
1866 .offset = HHI_MALI_CLK_CNTL,
1869 .table = meson8b_mali_0_1_mux_table,
1871 .hw.init = &(struct clk_init_data){
1872 .name = "mali_1_sel",
1873 .ops = &clk_regmap_mux_ops,
1874 .parent_data = meson8b_mali_0_1_parent_data,
1875 .num_parents = ARRAY_SIZE(meson8b_mali_0_1_parent_data),
1877 * Don't propagate rate changes up because the only changeable
1878 * parents are mpll1 and mpll2 but we need those for audio and
1879 * RGMII (Ethernet). We don't want to change the audio or
1880 * Ethernet clocks when setting the GPU frequency.
1886 static struct clk_regmap meson8b_mali_1_div = {
1887 .data = &(struct clk_regmap_div_data){
1888 .offset = HHI_MALI_CLK_CNTL,
1892 .hw.init = &(struct clk_init_data){
1893 .name = "mali_1_div",
1894 .ops = &clk_regmap_divider_ops,
1895 .parent_hws = (const struct clk_hw *[]) {
1896 &meson8b_mali_1_sel.hw
1899 .flags = CLK_SET_RATE_PARENT,
1903 static struct clk_regmap meson8b_mali_1 = {
1904 .data = &(struct clk_regmap_gate_data){
1905 .offset = HHI_MALI_CLK_CNTL,
1908 .hw.init = &(struct clk_init_data){
1910 .ops = &clk_regmap_gate_ops,
1911 .parent_hws = (const struct clk_hw *[]) {
1912 &meson8b_mali_1_div.hw
1915 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
1919 static struct clk_regmap meson8b_mali = {
1920 .data = &(struct clk_regmap_mux_data){
1921 .offset = HHI_MALI_CLK_CNTL,
1925 .hw.init = &(struct clk_init_data){
1927 .ops = &clk_regmap_mux_ops,
1928 .parent_hws = (const struct clk_hw *[]) {
1933 .flags = CLK_SET_RATE_PARENT,
1937 static const struct reg_sequence meson8m2_gp_pll_init_regs[] = {
1938 { .reg = HHI_GP_PLL_CNTL2, .def = 0x59c88000 },
1939 { .reg = HHI_GP_PLL_CNTL3, .def = 0xca463823 },
1940 { .reg = HHI_GP_PLL_CNTL4, .def = 0x0286a027 },
1941 { .reg = HHI_GP_PLL_CNTL5, .def = 0x00003000 },
1944 static const struct pll_params_table meson8m2_gp_pll_params_table[] = {
1949 static struct clk_regmap meson8m2_gp_pll_dco = {
1950 .data = &(struct meson_clk_pll_data){
1952 .reg_off = HHI_GP_PLL_CNTL,
1957 .reg_off = HHI_GP_PLL_CNTL,
1962 .reg_off = HHI_GP_PLL_CNTL,
1967 .reg_off = HHI_GP_PLL_CNTL,
1972 .reg_off = HHI_GP_PLL_CNTL,
1976 .table = meson8m2_gp_pll_params_table,
1977 .init_regs = meson8m2_gp_pll_init_regs,
1978 .init_count = ARRAY_SIZE(meson8m2_gp_pll_init_regs),
1980 .hw.init = &(struct clk_init_data){
1981 .name = "gp_pll_dco",
1982 .ops = &meson_clk_pll_ops,
1983 .parent_data = &(const struct clk_parent_data) {
1992 static struct clk_regmap meson8m2_gp_pll = {
1993 .data = &(struct clk_regmap_div_data){
1994 .offset = HHI_GP_PLL_CNTL,
1997 .flags = CLK_DIVIDER_POWER_OF_TWO,
1999 .hw.init = &(struct clk_init_data){
2001 .ops = &clk_regmap_divider_ops,
2002 .parent_hws = (const struct clk_hw *[]) {
2003 &meson8m2_gp_pll_dco.hw
2006 .flags = CLK_SET_RATE_PARENT,
2010 static const struct clk_hw *meson8b_vpu_0_1_parent_hws[] = {
2011 &meson8b_fclk_div4.hw,
2012 &meson8b_fclk_div3.hw,
2013 &meson8b_fclk_div5.hw,
2014 &meson8b_fclk_div7.hw,
2017 static const struct clk_hw *mmeson8m2_vpu_0_1_parent_hws[] = {
2018 &meson8b_fclk_div4.hw,
2019 &meson8b_fclk_div3.hw,
2020 &meson8b_fclk_div5.hw,
2021 &meson8m2_gp_pll.hw,
2024 static struct clk_regmap meson8b_vpu_0_sel = {
2025 .data = &(struct clk_regmap_mux_data){
2026 .offset = HHI_VPU_CLK_CNTL,
2030 .hw.init = &(struct clk_init_data){
2031 .name = "vpu_0_sel",
2032 .ops = &clk_regmap_mux_ops,
2033 .parent_hws = meson8b_vpu_0_1_parent_hws,
2034 .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws),
2035 .flags = CLK_SET_RATE_PARENT,
2039 static struct clk_regmap meson8m2_vpu_0_sel = {
2040 .data = &(struct clk_regmap_mux_data){
2041 .offset = HHI_VPU_CLK_CNTL,
2045 .hw.init = &(struct clk_init_data){
2046 .name = "vpu_0_sel",
2047 .ops = &clk_regmap_mux_ops,
2048 .parent_hws = mmeson8m2_vpu_0_1_parent_hws,
2049 .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws),
2050 .flags = CLK_SET_RATE_PARENT,
2054 static struct clk_regmap meson8b_vpu_0_div = {
2055 .data = &(struct clk_regmap_div_data){
2056 .offset = HHI_VPU_CLK_CNTL,
2060 .hw.init = &(struct clk_init_data){
2061 .name = "vpu_0_div",
2062 .ops = &clk_regmap_divider_ops,
2063 .parent_data = &(const struct clk_parent_data) {
2066 * meson8b and meson8m2 have different vpu_0_sels (with
2067 * different struct clk_hw). We fallback to the global
2068 * naming string mechanism so vpu_0_div picks up the
2071 .name = "vpu_0_sel",
2075 .flags = CLK_SET_RATE_PARENT,
2079 static struct clk_regmap meson8b_vpu_0 = {
2080 .data = &(struct clk_regmap_gate_data){
2081 .offset = HHI_VPU_CLK_CNTL,
2084 .hw.init = &(struct clk_init_data) {
2086 .ops = &clk_regmap_gate_ops,
2087 .parent_hws = (const struct clk_hw *[]) {
2088 &meson8b_vpu_0_div.hw
2091 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
2095 static struct clk_regmap meson8b_vpu_1_sel = {
2096 .data = &(struct clk_regmap_mux_data){
2097 .offset = HHI_VPU_CLK_CNTL,
2101 .hw.init = &(struct clk_init_data){
2102 .name = "vpu_1_sel",
2103 .ops = &clk_regmap_mux_ops,
2104 .parent_hws = meson8b_vpu_0_1_parent_hws,
2105 .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_hws),
2106 .flags = CLK_SET_RATE_PARENT,
2110 static struct clk_regmap meson8m2_vpu_1_sel = {
2111 .data = &(struct clk_regmap_mux_data){
2112 .offset = HHI_VPU_CLK_CNTL,
2116 .hw.init = &(struct clk_init_data){
2117 .name = "vpu_1_sel",
2118 .ops = &clk_regmap_mux_ops,
2119 .parent_hws = mmeson8m2_vpu_0_1_parent_hws,
2120 .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_hws),
2121 .flags = CLK_SET_RATE_PARENT,
2125 static struct clk_regmap meson8b_vpu_1_div = {
2126 .data = &(struct clk_regmap_div_data){
2127 .offset = HHI_VPU_CLK_CNTL,
2131 .hw.init = &(struct clk_init_data){
2132 .name = "vpu_1_div",
2133 .ops = &clk_regmap_divider_ops,
2134 .parent_data = &(const struct clk_parent_data) {
2137 * meson8b and meson8m2 have different vpu_1_sels (with
2138 * different struct clk_hw). We fallback to the global
2139 * naming string mechanism so vpu_1_div picks up the
2142 .name = "vpu_1_sel",
2146 .flags = CLK_SET_RATE_PARENT,
2150 static struct clk_regmap meson8b_vpu_1 = {
2151 .data = &(struct clk_regmap_gate_data){
2152 .offset = HHI_VPU_CLK_CNTL,
2155 .hw.init = &(struct clk_init_data) {
2157 .ops = &clk_regmap_gate_ops,
2158 .parent_hws = (const struct clk_hw *[]) {
2159 &meson8b_vpu_1_div.hw
2162 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
2167 * The VPU clock has two two identical clock trees (vpu_0 and vpu_1)
2168 * muxed by a glitch-free switch on Meson8b and Meson8m2. The CCF can
2169 * actually manage this glitch-free mux because it does top-to-bottom
2170 * updates the each clock tree and switches to the "inactive" one when
2171 * CLK_SET_RATE_GATE is set.
2172 * Meson8 only has vpu_0 and no glitch-free mux.
2174 static struct clk_regmap meson8b_vpu = {
2175 .data = &(struct clk_regmap_mux_data){
2176 .offset = HHI_VPU_CLK_CNTL,
2180 .hw.init = &(struct clk_init_data){
2182 .ops = &clk_regmap_mux_ops,
2183 .parent_hws = (const struct clk_hw *[]) {
2188 .flags = CLK_SET_RATE_PARENT,
2192 static const struct clk_hw *meson8b_vdec_parent_hws[] = {
2193 &meson8b_fclk_div4.hw,
2194 &meson8b_fclk_div3.hw,
2195 &meson8b_fclk_div5.hw,
2196 &meson8b_fclk_div7.hw,
2201 static struct clk_regmap meson8b_vdec_1_sel = {
2202 .data = &(struct clk_regmap_mux_data){
2203 .offset = HHI_VDEC_CLK_CNTL,
2206 .flags = CLK_MUX_ROUND_CLOSEST,
2208 .hw.init = &(struct clk_init_data){
2209 .name = "vdec_1_sel",
2210 .ops = &clk_regmap_mux_ops,
2211 .parent_hws = meson8b_vdec_parent_hws,
2212 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2213 .flags = CLK_SET_RATE_PARENT,
2217 static struct clk_regmap meson8b_vdec_1_1_div = {
2218 .data = &(struct clk_regmap_div_data){
2219 .offset = HHI_VDEC_CLK_CNTL,
2222 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2224 .hw.init = &(struct clk_init_data){
2225 .name = "vdec_1_1_div",
2226 .ops = &clk_regmap_divider_ops,
2227 .parent_hws = (const struct clk_hw *[]) {
2228 &meson8b_vdec_1_sel.hw
2231 .flags = CLK_SET_RATE_PARENT,
2235 static struct clk_regmap meson8b_vdec_1_1 = {
2236 .data = &(struct clk_regmap_gate_data){
2237 .offset = HHI_VDEC_CLK_CNTL,
2240 .hw.init = &(struct clk_init_data) {
2242 .ops = &clk_regmap_gate_ops,
2243 .parent_hws = (const struct clk_hw *[]) {
2244 &meson8b_vdec_1_1_div.hw
2247 .flags = CLK_SET_RATE_PARENT,
2251 static struct clk_regmap meson8b_vdec_1_2_div = {
2252 .data = &(struct clk_regmap_div_data){
2253 .offset = HHI_VDEC3_CLK_CNTL,
2256 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2258 .hw.init = &(struct clk_init_data){
2259 .name = "vdec_1_2_div",
2260 .ops = &clk_regmap_divider_ops,
2261 .parent_hws = (const struct clk_hw *[]) {
2262 &meson8b_vdec_1_sel.hw
2265 .flags = CLK_SET_RATE_PARENT,
2269 static struct clk_regmap meson8b_vdec_1_2 = {
2270 .data = &(struct clk_regmap_gate_data){
2271 .offset = HHI_VDEC3_CLK_CNTL,
2274 .hw.init = &(struct clk_init_data) {
2276 .ops = &clk_regmap_gate_ops,
2277 .parent_hws = (const struct clk_hw *[]) {
2278 &meson8b_vdec_1_2_div.hw
2281 .flags = CLK_SET_RATE_PARENT,
2285 static struct clk_regmap meson8b_vdec_1 = {
2286 .data = &(struct clk_regmap_mux_data){
2287 .offset = HHI_VDEC3_CLK_CNTL,
2290 .flags = CLK_MUX_ROUND_CLOSEST,
2292 .hw.init = &(struct clk_init_data){
2294 .ops = &clk_regmap_mux_ops,
2295 .parent_hws = (const struct clk_hw *[]) {
2296 &meson8b_vdec_1_1.hw,
2297 &meson8b_vdec_1_2.hw,
2300 .flags = CLK_SET_RATE_PARENT,
2304 static struct clk_regmap meson8b_vdec_hcodec_sel = {
2305 .data = &(struct clk_regmap_mux_data){
2306 .offset = HHI_VDEC_CLK_CNTL,
2309 .flags = CLK_MUX_ROUND_CLOSEST,
2311 .hw.init = &(struct clk_init_data){
2312 .name = "vdec_hcodec_sel",
2313 .ops = &clk_regmap_mux_ops,
2314 .parent_hws = meson8b_vdec_parent_hws,
2315 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2316 .flags = CLK_SET_RATE_PARENT,
2320 static struct clk_regmap meson8b_vdec_hcodec_div = {
2321 .data = &(struct clk_regmap_div_data){
2322 .offset = HHI_VDEC_CLK_CNTL,
2325 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2327 .hw.init = &(struct clk_init_data){
2328 .name = "vdec_hcodec_div",
2329 .ops = &clk_regmap_divider_ops,
2330 .parent_hws = (const struct clk_hw *[]) {
2331 &meson8b_vdec_hcodec_sel.hw
2334 .flags = CLK_SET_RATE_PARENT,
2338 static struct clk_regmap meson8b_vdec_hcodec = {
2339 .data = &(struct clk_regmap_gate_data){
2340 .offset = HHI_VDEC_CLK_CNTL,
2343 .hw.init = &(struct clk_init_data) {
2344 .name = "vdec_hcodec",
2345 .ops = &clk_regmap_gate_ops,
2346 .parent_hws = (const struct clk_hw *[]) {
2347 &meson8b_vdec_hcodec_div.hw
2350 .flags = CLK_SET_RATE_PARENT,
2354 static struct clk_regmap meson8b_vdec_2_sel = {
2355 .data = &(struct clk_regmap_mux_data){
2356 .offset = HHI_VDEC2_CLK_CNTL,
2359 .flags = CLK_MUX_ROUND_CLOSEST,
2361 .hw.init = &(struct clk_init_data){
2362 .name = "vdec_2_sel",
2363 .ops = &clk_regmap_mux_ops,
2364 .parent_hws = meson8b_vdec_parent_hws,
2365 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2366 .flags = CLK_SET_RATE_PARENT,
2370 static struct clk_regmap meson8b_vdec_2_div = {
2371 .data = &(struct clk_regmap_div_data){
2372 .offset = HHI_VDEC2_CLK_CNTL,
2375 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2377 .hw.init = &(struct clk_init_data){
2378 .name = "vdec_2_div",
2379 .ops = &clk_regmap_divider_ops,
2380 .parent_hws = (const struct clk_hw *[]) {
2381 &meson8b_vdec_2_sel.hw
2384 .flags = CLK_SET_RATE_PARENT,
2388 static struct clk_regmap meson8b_vdec_2 = {
2389 .data = &(struct clk_regmap_gate_data){
2390 .offset = HHI_VDEC2_CLK_CNTL,
2393 .hw.init = &(struct clk_init_data) {
2395 .ops = &clk_regmap_gate_ops,
2396 .parent_hws = (const struct clk_hw *[]) {
2397 &meson8b_vdec_2_div.hw
2400 .flags = CLK_SET_RATE_PARENT,
2404 static struct clk_regmap meson8b_vdec_hevc_sel = {
2405 .data = &(struct clk_regmap_mux_data){
2406 .offset = HHI_VDEC2_CLK_CNTL,
2409 .flags = CLK_MUX_ROUND_CLOSEST,
2411 .hw.init = &(struct clk_init_data){
2412 .name = "vdec_hevc_sel",
2413 .ops = &clk_regmap_mux_ops,
2414 .parent_hws = meson8b_vdec_parent_hws,
2415 .num_parents = ARRAY_SIZE(meson8b_vdec_parent_hws),
2416 .flags = CLK_SET_RATE_PARENT,
2420 static struct clk_regmap meson8b_vdec_hevc_div = {
2421 .data = &(struct clk_regmap_div_data){
2422 .offset = HHI_VDEC2_CLK_CNTL,
2425 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2427 .hw.init = &(struct clk_init_data){
2428 .name = "vdec_hevc_div",
2429 .ops = &clk_regmap_divider_ops,
2430 .parent_hws = (const struct clk_hw *[]) {
2431 &meson8b_vdec_hevc_sel.hw
2434 .flags = CLK_SET_RATE_PARENT,
2438 static struct clk_regmap meson8b_vdec_hevc_en = {
2439 .data = &(struct clk_regmap_gate_data){
2440 .offset = HHI_VDEC2_CLK_CNTL,
2443 .hw.init = &(struct clk_init_data) {
2444 .name = "vdec_hevc_en",
2445 .ops = &clk_regmap_gate_ops,
2446 .parent_hws = (const struct clk_hw *[]) {
2447 &meson8b_vdec_hevc_div.hw
2450 .flags = CLK_SET_RATE_PARENT,
2454 static struct clk_regmap meson8b_vdec_hevc = {
2455 .data = &(struct clk_regmap_mux_data){
2456 .offset = HHI_VDEC2_CLK_CNTL,
2459 .flags = CLK_MUX_ROUND_CLOSEST,
2461 .hw.init = &(struct clk_init_data){
2462 .name = "vdec_hevc",
2463 .ops = &clk_regmap_mux_ops,
2464 /* TODO: The second parent is currently unknown */
2465 .parent_hws = (const struct clk_hw *[]) {
2466 &meson8b_vdec_hevc_en.hw
2469 .flags = CLK_SET_RATE_PARENT,
2473 /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */
2474 static const struct clk_hw *meson8b_cts_amclk_parent_hws[] = {
2480 static u32 meson8b_cts_amclk_mux_table[] = { 1, 2, 3 };
2482 static struct clk_regmap meson8b_cts_amclk_sel = {
2483 .data = &(struct clk_regmap_mux_data){
2484 .offset = HHI_AUD_CLK_CNTL,
2487 .table = meson8b_cts_amclk_mux_table,
2488 .flags = CLK_MUX_ROUND_CLOSEST,
2490 .hw.init = &(struct clk_init_data){
2491 .name = "cts_amclk_sel",
2492 .ops = &clk_regmap_mux_ops,
2493 .parent_hws = meson8b_cts_amclk_parent_hws,
2494 .num_parents = ARRAY_SIZE(meson8b_cts_amclk_parent_hws),
2498 static struct clk_regmap meson8b_cts_amclk_div = {
2499 .data = &(struct clk_regmap_div_data) {
2500 .offset = HHI_AUD_CLK_CNTL,
2503 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2505 .hw.init = &(struct clk_init_data){
2506 .name = "cts_amclk_div",
2507 .ops = &clk_regmap_divider_ops,
2508 .parent_hws = (const struct clk_hw *[]) {
2509 &meson8b_cts_amclk_sel.hw
2512 .flags = CLK_SET_RATE_PARENT,
2516 static struct clk_regmap meson8b_cts_amclk = {
2517 .data = &(struct clk_regmap_gate_data){
2518 .offset = HHI_AUD_CLK_CNTL,
2521 .hw.init = &(struct clk_init_data){
2522 .name = "cts_amclk",
2523 .ops = &clk_regmap_gate_ops,
2524 .parent_hws = (const struct clk_hw *[]) {
2525 &meson8b_cts_amclk_div.hw
2528 .flags = CLK_SET_RATE_PARENT,
2532 /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */
2533 static const struct clk_hw *meson8b_cts_mclk_i958_parent_hws[] = {
2539 static u32 meson8b_cts_mclk_i958_mux_table[] = { 1, 2, 3 };
2541 static struct clk_regmap meson8b_cts_mclk_i958_sel = {
2542 .data = &(struct clk_regmap_mux_data){
2543 .offset = HHI_AUD_CLK_CNTL2,
2546 .table = meson8b_cts_mclk_i958_mux_table,
2547 .flags = CLK_MUX_ROUND_CLOSEST,
2549 .hw.init = &(struct clk_init_data) {
2550 .name = "cts_mclk_i958_sel",
2551 .ops = &clk_regmap_mux_ops,
2552 .parent_hws = meson8b_cts_mclk_i958_parent_hws,
2553 .num_parents = ARRAY_SIZE(meson8b_cts_mclk_i958_parent_hws),
2557 static struct clk_regmap meson8b_cts_mclk_i958_div = {
2558 .data = &(struct clk_regmap_div_data){
2559 .offset = HHI_AUD_CLK_CNTL2,
2562 .flags = CLK_DIVIDER_ROUND_CLOSEST,
2564 .hw.init = &(struct clk_init_data) {
2565 .name = "cts_mclk_i958_div",
2566 .ops = &clk_regmap_divider_ops,
2567 .parent_hws = (const struct clk_hw *[]) {
2568 &meson8b_cts_mclk_i958_sel.hw
2571 .flags = CLK_SET_RATE_PARENT,
2575 static struct clk_regmap meson8b_cts_mclk_i958 = {
2576 .data = &(struct clk_regmap_gate_data){
2577 .offset = HHI_AUD_CLK_CNTL2,
2580 .hw.init = &(struct clk_init_data){
2581 .name = "cts_mclk_i958",
2582 .ops = &clk_regmap_gate_ops,
2583 .parent_hws = (const struct clk_hw *[]) {
2584 &meson8b_cts_mclk_i958_div.hw
2587 .flags = CLK_SET_RATE_PARENT,
2591 static struct clk_regmap meson8b_cts_i958 = {
2592 .data = &(struct clk_regmap_mux_data){
2593 .offset = HHI_AUD_CLK_CNTL2,
2597 .hw.init = &(struct clk_init_data){
2599 .ops = &clk_regmap_mux_ops,
2600 .parent_hws = (const struct clk_hw *[]) {
2601 &meson8b_cts_amclk.hw,
2602 &meson8b_cts_mclk_i958.hw
2606 * The parent is specific to origin of the audio data. Let the
2607 * consumer choose the appropriate parent.
2609 .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
2613 #define MESON_GATE(_name, _reg, _bit) \
2614 MESON_PCLK(_name, _reg, _bit, &meson8b_clk81.hw)
2616 /* Everything Else (EE) domain gates */
2618 static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0);
2619 static MESON_GATE(meson8b_dos, HHI_GCLK_MPEG0, 1);
2620 static MESON_GATE(meson8b_isa, HHI_GCLK_MPEG0, 5);
2621 static MESON_GATE(meson8b_pl301, HHI_GCLK_MPEG0, 6);
2622 static MESON_GATE(meson8b_periphs, HHI_GCLK_MPEG0, 7);
2623 static MESON_GATE(meson8b_spicc, HHI_GCLK_MPEG0, 8);
2624 static MESON_GATE(meson8b_i2c, HHI_GCLK_MPEG0, 9);
2625 static MESON_GATE(meson8b_sar_adc, HHI_GCLK_MPEG0, 10);
2626 static MESON_GATE(meson8b_smart_card, HHI_GCLK_MPEG0, 11);
2627 static MESON_GATE(meson8b_rng0, HHI_GCLK_MPEG0, 12);
2628 static MESON_GATE(meson8b_uart0, HHI_GCLK_MPEG0, 13);
2629 static MESON_GATE(meson8b_sdhc, HHI_GCLK_MPEG0, 14);
2630 static MESON_GATE(meson8b_stream, HHI_GCLK_MPEG0, 15);
2631 static MESON_GATE(meson8b_async_fifo, HHI_GCLK_MPEG0, 16);
2632 static MESON_GATE(meson8b_sdio, HHI_GCLK_MPEG0, 17);
2633 static MESON_GATE(meson8b_abuf, HHI_GCLK_MPEG0, 18);
2634 static MESON_GATE(meson8b_hiu_iface, HHI_GCLK_MPEG0, 19);
2635 static MESON_GATE(meson8b_assist_misc, HHI_GCLK_MPEG0, 23);
2636 static MESON_GATE(meson8b_spi, HHI_GCLK_MPEG0, 30);
2638 static MESON_GATE(meson8b_i2s_spdif, HHI_GCLK_MPEG1, 2);
2639 static MESON_GATE(meson8b_eth, HHI_GCLK_MPEG1, 3);
2640 static MESON_GATE(meson8b_demux, HHI_GCLK_MPEG1, 4);
2641 static MESON_GATE(meson8b_blkmv, HHI_GCLK_MPEG1, 14);
2642 static MESON_GATE(meson8b_aiu, HHI_GCLK_MPEG1, 15);
2643 static MESON_GATE(meson8b_uart1, HHI_GCLK_MPEG1, 16);
2644 static MESON_GATE(meson8b_g2d, HHI_GCLK_MPEG1, 20);
2645 static MESON_GATE(meson8b_usb0, HHI_GCLK_MPEG1, 21);
2646 static MESON_GATE(meson8b_usb1, HHI_GCLK_MPEG1, 22);
2647 static MESON_GATE(meson8b_reset, HHI_GCLK_MPEG1, 23);
2648 static MESON_GATE(meson8b_nand, HHI_GCLK_MPEG1, 24);
2649 static MESON_GATE(meson8b_dos_parser, HHI_GCLK_MPEG1, 25);
2650 static MESON_GATE(meson8b_usb, HHI_GCLK_MPEG1, 26);
2651 static MESON_GATE(meson8b_vdin1, HHI_GCLK_MPEG1, 28);
2652 static MESON_GATE(meson8b_ahb_arb0, HHI_GCLK_MPEG1, 29);
2653 static MESON_GATE(meson8b_efuse, HHI_GCLK_MPEG1, 30);
2654 static MESON_GATE(meson8b_boot_rom, HHI_GCLK_MPEG1, 31);
2656 static MESON_GATE(meson8b_ahb_data_bus, HHI_GCLK_MPEG2, 1);
2657 static MESON_GATE(meson8b_ahb_ctrl_bus, HHI_GCLK_MPEG2, 2);
2658 static MESON_GATE(meson8b_hdmi_intr_sync, HHI_GCLK_MPEG2, 3);
2659 static MESON_GATE(meson8b_hdmi_pclk, HHI_GCLK_MPEG2, 4);
2660 static MESON_GATE(meson8b_usb1_ddr_bridge, HHI_GCLK_MPEG2, 8);
2661 static MESON_GATE(meson8b_usb0_ddr_bridge, HHI_GCLK_MPEG2, 9);
2662 static MESON_GATE(meson8b_mmc_pclk, HHI_GCLK_MPEG2, 11);
2663 static MESON_GATE(meson8b_dvin, HHI_GCLK_MPEG2, 12);
2664 static MESON_GATE(meson8b_uart2, HHI_GCLK_MPEG2, 15);
2665 static MESON_GATE(meson8b_sana, HHI_GCLK_MPEG2, 22);
2666 static MESON_GATE(meson8b_vpu_intr, HHI_GCLK_MPEG2, 25);
2667 static MESON_GATE(meson8b_sec_ahb_ahb3_bridge, HHI_GCLK_MPEG2, 26);
2668 static MESON_GATE(meson8b_clk81_a9, HHI_GCLK_MPEG2, 29);
2670 static MESON_GATE(meson8b_vclk2_venci0, HHI_GCLK_OTHER, 1);
2671 static MESON_GATE(meson8b_vclk2_venci1, HHI_GCLK_OTHER, 2);
2672 static MESON_GATE(meson8b_vclk2_vencp0, HHI_GCLK_OTHER, 3);
2673 static MESON_GATE(meson8b_vclk2_vencp1, HHI_GCLK_OTHER, 4);
2674 static MESON_GATE(meson8b_gclk_venci_int, HHI_GCLK_OTHER, 8);
2675 static MESON_GATE(meson8b_gclk_vencp_int, HHI_GCLK_OTHER, 9);
2676 static MESON_GATE(meson8b_dac_clk, HHI_GCLK_OTHER, 10);
2677 static MESON_GATE(meson8b_aoclk_gate, HHI_GCLK_OTHER, 14);
2678 static MESON_GATE(meson8b_iec958_gate, HHI_GCLK_OTHER, 16);
2679 static MESON_GATE(meson8b_enc480p, HHI_GCLK_OTHER, 20);
2680 static MESON_GATE(meson8b_rng1, HHI_GCLK_OTHER, 21);
2681 static MESON_GATE(meson8b_gclk_vencl_int, HHI_GCLK_OTHER, 22);
2682 static MESON_GATE(meson8b_vclk2_venclmcc, HHI_GCLK_OTHER, 24);
2683 static MESON_GATE(meson8b_vclk2_vencl, HHI_GCLK_OTHER, 25);
2684 static MESON_GATE(meson8b_vclk2_other, HHI_GCLK_OTHER, 26);
2685 static MESON_GATE(meson8b_edp, HHI_GCLK_OTHER, 31);
2688 #define MESON_AIU_GLUE_GATE(_name, _reg, _bit) \
2689 MESON_PCLK(_name, _reg, _bit, &meson8b_aiu_glue.hw)
2691 static MESON_PCLK(meson8b_aiu_glue, HHI_GCLK_MPEG1, 6, &meson8b_aiu.hw);
2692 static MESON_AIU_GLUE_GATE(meson8b_iec958, HHI_GCLK_MPEG1, 7);
2693 static MESON_AIU_GLUE_GATE(meson8b_i2s_out, HHI_GCLK_MPEG1, 8);
2694 static MESON_AIU_GLUE_GATE(meson8b_amclk, HHI_GCLK_MPEG1, 9);
2695 static MESON_AIU_GLUE_GATE(meson8b_aififo2, HHI_GCLK_MPEG1, 10);
2696 static MESON_AIU_GLUE_GATE(meson8b_mixer, HHI_GCLK_MPEG1, 11);
2697 static MESON_AIU_GLUE_GATE(meson8b_mixer_iface, HHI_GCLK_MPEG1, 12);
2698 static MESON_AIU_GLUE_GATE(meson8b_adc, HHI_GCLK_MPEG1, 13);
2700 /* Always On (AO) domain gates */
2702 static MESON_GATE(meson8b_ao_media_cpu, HHI_GCLK_AO, 0);
2703 static MESON_GATE(meson8b_ao_ahb_sram, HHI_GCLK_AO, 1);
2704 static MESON_GATE(meson8b_ao_ahb_bus, HHI_GCLK_AO, 2);
2705 static MESON_GATE(meson8b_ao_iface, HHI_GCLK_AO, 3);
2707 static struct clk_hw_onecell_data meson8_hw_onecell_data = {
2709 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
2710 [CLKID_PLL_VID] = &meson8b_vid_pll.hw,
2711 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
2712 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
2713 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
2714 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
2715 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
2716 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
2717 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
2718 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
2719 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
2720 [CLKID_CLK81] = &meson8b_clk81.hw,
2721 [CLKID_DDR] = &meson8b_ddr.hw,
2722 [CLKID_DOS] = &meson8b_dos.hw,
2723 [CLKID_ISA] = &meson8b_isa.hw,
2724 [CLKID_PL301] = &meson8b_pl301.hw,
2725 [CLKID_PERIPHS] = &meson8b_periphs.hw,
2726 [CLKID_SPICC] = &meson8b_spicc.hw,
2727 [CLKID_I2C] = &meson8b_i2c.hw,
2728 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw,
2729 [CLKID_SMART_CARD] = &meson8b_smart_card.hw,
2730 [CLKID_RNG0] = &meson8b_rng0.hw,
2731 [CLKID_UART0] = &meson8b_uart0.hw,
2732 [CLKID_SDHC] = &meson8b_sdhc.hw,
2733 [CLKID_STREAM] = &meson8b_stream.hw,
2734 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw,
2735 [CLKID_SDIO] = &meson8b_sdio.hw,
2736 [CLKID_ABUF] = &meson8b_abuf.hw,
2737 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw,
2738 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw,
2739 [CLKID_SPI] = &meson8b_spi.hw,
2740 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw,
2741 [CLKID_ETH] = &meson8b_eth.hw,
2742 [CLKID_DEMUX] = &meson8b_demux.hw,
2743 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw,
2744 [CLKID_IEC958] = &meson8b_iec958.hw,
2745 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw,
2746 [CLKID_AMCLK] = &meson8b_amclk.hw,
2747 [CLKID_AIFIFO2] = &meson8b_aififo2.hw,
2748 [CLKID_MIXER] = &meson8b_mixer.hw,
2749 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw,
2750 [CLKID_ADC] = &meson8b_adc.hw,
2751 [CLKID_BLKMV] = &meson8b_blkmv.hw,
2752 [CLKID_AIU] = &meson8b_aiu.hw,
2753 [CLKID_UART1] = &meson8b_uart1.hw,
2754 [CLKID_G2D] = &meson8b_g2d.hw,
2755 [CLKID_USB0] = &meson8b_usb0.hw,
2756 [CLKID_USB1] = &meson8b_usb1.hw,
2757 [CLKID_RESET] = &meson8b_reset.hw,
2758 [CLKID_NAND] = &meson8b_nand.hw,
2759 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw,
2760 [CLKID_USB] = &meson8b_usb.hw,
2761 [CLKID_VDIN1] = &meson8b_vdin1.hw,
2762 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw,
2763 [CLKID_EFUSE] = &meson8b_efuse.hw,
2764 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw,
2765 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw,
2766 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw,
2767 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw,
2768 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw,
2769 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw,
2770 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw,
2771 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw,
2772 [CLKID_DVIN] = &meson8b_dvin.hw,
2773 [CLKID_UART2] = &meson8b_uart2.hw,
2774 [CLKID_SANA] = &meson8b_sana.hw,
2775 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw,
2776 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
2777 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw,
2778 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw,
2779 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw,
2780 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw,
2781 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw,
2782 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw,
2783 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw,
2784 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw,
2785 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw,
2786 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw,
2787 [CLKID_ENC480P] = &meson8b_enc480p.hw,
2788 [CLKID_RNG1] = &meson8b_rng1.hw,
2789 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw,
2790 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw,
2791 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw,
2792 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw,
2793 [CLKID_EDP] = &meson8b_edp.hw,
2794 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw,
2795 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw,
2796 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw,
2797 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw,
2798 [CLKID_MPLL0] = &meson8b_mpll0.hw,
2799 [CLKID_MPLL1] = &meson8b_mpll1.hw,
2800 [CLKID_MPLL2] = &meson8b_mpll2.hw,
2801 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw,
2802 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw,
2803 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw,
2804 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw,
2805 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw,
2806 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw,
2807 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw,
2808 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw,
2809 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw,
2810 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw,
2811 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw,
2812 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw,
2813 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw,
2814 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw,
2815 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw,
2816 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw,
2817 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw,
2818 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw,
2819 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw,
2820 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw,
2821 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw,
2822 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw,
2823 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw,
2824 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw,
2825 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw,
2826 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw,
2827 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw,
2828 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw,
2829 [CLKID_APB] = &meson8b_apb_clk_gate.hw,
2830 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw,
2831 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw,
2832 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw,
2833 [CLKID_AXI] = &meson8b_axi_clk_gate.hw,
2834 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw,
2835 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw,
2836 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw,
2837 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw,
2838 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw,
2839 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw,
2840 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw,
2841 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw,
2842 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw,
2843 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw,
2844 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw,
2845 [CLKID_VCLK_EN] = &meson8b_vclk_en.hw,
2846 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw,
2847 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw,
2848 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw,
2849 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw,
2850 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw,
2851 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw,
2852 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw,
2853 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw,
2854 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw,
2855 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw,
2856 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw,
2857 [CLKID_VCLK2_EN] = &meson8b_vclk2_clk_en.hw,
2858 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw,
2859 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw,
2860 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw,
2861 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw,
2862 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw,
2863 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw,
2864 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw,
2865 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw,
2866 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw,
2867 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw,
2868 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw,
2869 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw,
2870 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw,
2871 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw,
2872 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw,
2873 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw,
2874 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw,
2875 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw,
2876 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw,
2877 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw,
2878 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw,
2879 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw,
2880 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw,
2881 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw,
2882 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw,
2883 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw,
2884 [CLKID_MALI] = &meson8b_mali_0.hw,
2885 [CLKID_VPU_0_SEL] = &meson8b_vpu_0_sel.hw,
2886 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
2887 [CLKID_VPU] = &meson8b_vpu_0.hw,
2888 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw,
2889 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw,
2890 [CLKID_VDEC_1] = &meson8b_vdec_1_1.hw,
2891 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw,
2892 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw,
2893 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw,
2894 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw,
2895 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw,
2896 [CLKID_VDEC_2] = &meson8b_vdec_2.hw,
2897 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw,
2898 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw,
2899 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw,
2900 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw,
2901 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw,
2902 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw,
2903 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw,
2904 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw,
2905 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw,
2906 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
2907 [CLKID_CTS_I958] = &meson8b_cts_i958.hw,
2908 [CLK_NR_CLKS] = NULL,
2913 static struct clk_hw_onecell_data meson8b_hw_onecell_data = {
2915 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
2916 [CLKID_PLL_VID] = &meson8b_vid_pll.hw,
2917 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
2918 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
2919 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
2920 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
2921 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
2922 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
2923 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
2924 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
2925 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
2926 [CLKID_CLK81] = &meson8b_clk81.hw,
2927 [CLKID_DDR] = &meson8b_ddr.hw,
2928 [CLKID_DOS] = &meson8b_dos.hw,
2929 [CLKID_ISA] = &meson8b_isa.hw,
2930 [CLKID_PL301] = &meson8b_pl301.hw,
2931 [CLKID_PERIPHS] = &meson8b_periphs.hw,
2932 [CLKID_SPICC] = &meson8b_spicc.hw,
2933 [CLKID_I2C] = &meson8b_i2c.hw,
2934 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw,
2935 [CLKID_SMART_CARD] = &meson8b_smart_card.hw,
2936 [CLKID_RNG0] = &meson8b_rng0.hw,
2937 [CLKID_UART0] = &meson8b_uart0.hw,
2938 [CLKID_SDHC] = &meson8b_sdhc.hw,
2939 [CLKID_STREAM] = &meson8b_stream.hw,
2940 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw,
2941 [CLKID_SDIO] = &meson8b_sdio.hw,
2942 [CLKID_ABUF] = &meson8b_abuf.hw,
2943 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw,
2944 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw,
2945 [CLKID_SPI] = &meson8b_spi.hw,
2946 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw,
2947 [CLKID_ETH] = &meson8b_eth.hw,
2948 [CLKID_DEMUX] = &meson8b_demux.hw,
2949 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw,
2950 [CLKID_IEC958] = &meson8b_iec958.hw,
2951 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw,
2952 [CLKID_AMCLK] = &meson8b_amclk.hw,
2953 [CLKID_AIFIFO2] = &meson8b_aififo2.hw,
2954 [CLKID_MIXER] = &meson8b_mixer.hw,
2955 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw,
2956 [CLKID_ADC] = &meson8b_adc.hw,
2957 [CLKID_BLKMV] = &meson8b_blkmv.hw,
2958 [CLKID_AIU] = &meson8b_aiu.hw,
2959 [CLKID_UART1] = &meson8b_uart1.hw,
2960 [CLKID_G2D] = &meson8b_g2d.hw,
2961 [CLKID_USB0] = &meson8b_usb0.hw,
2962 [CLKID_USB1] = &meson8b_usb1.hw,
2963 [CLKID_RESET] = &meson8b_reset.hw,
2964 [CLKID_NAND] = &meson8b_nand.hw,
2965 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw,
2966 [CLKID_USB] = &meson8b_usb.hw,
2967 [CLKID_VDIN1] = &meson8b_vdin1.hw,
2968 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw,
2969 [CLKID_EFUSE] = &meson8b_efuse.hw,
2970 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw,
2971 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw,
2972 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw,
2973 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw,
2974 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw,
2975 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw,
2976 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw,
2977 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw,
2978 [CLKID_DVIN] = &meson8b_dvin.hw,
2979 [CLKID_UART2] = &meson8b_uart2.hw,
2980 [CLKID_SANA] = &meson8b_sana.hw,
2981 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw,
2982 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
2983 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw,
2984 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw,
2985 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw,
2986 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw,
2987 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw,
2988 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw,
2989 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw,
2990 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw,
2991 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw,
2992 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw,
2993 [CLKID_ENC480P] = &meson8b_enc480p.hw,
2994 [CLKID_RNG1] = &meson8b_rng1.hw,
2995 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw,
2996 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw,
2997 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw,
2998 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw,
2999 [CLKID_EDP] = &meson8b_edp.hw,
3000 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw,
3001 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw,
3002 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw,
3003 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw,
3004 [CLKID_MPLL0] = &meson8b_mpll0.hw,
3005 [CLKID_MPLL1] = &meson8b_mpll1.hw,
3006 [CLKID_MPLL2] = &meson8b_mpll2.hw,
3007 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw,
3008 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw,
3009 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw,
3010 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw,
3011 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw,
3012 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw,
3013 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw,
3014 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw,
3015 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw,
3016 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw,
3017 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw,
3018 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw,
3019 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw,
3020 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw,
3021 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw,
3022 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw,
3023 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw,
3024 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw,
3025 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw,
3026 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw,
3027 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw,
3028 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw,
3029 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw,
3030 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw,
3031 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw,
3032 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw,
3033 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw,
3034 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw,
3035 [CLKID_APB] = &meson8b_apb_clk_gate.hw,
3036 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw,
3037 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw,
3038 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw,
3039 [CLKID_AXI] = &meson8b_axi_clk_gate.hw,
3040 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw,
3041 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw,
3042 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw,
3043 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw,
3044 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw,
3045 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw,
3046 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw,
3047 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw,
3048 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw,
3049 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw,
3050 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw,
3051 [CLKID_VCLK_EN] = &meson8b_vclk_en.hw,
3052 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw,
3053 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw,
3054 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw,
3055 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw,
3056 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw,
3057 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw,
3058 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw,
3059 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw,
3060 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw,
3061 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw,
3062 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw,
3063 [CLKID_VCLK2_EN] = &meson8b_vclk2_clk_en.hw,
3064 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw,
3065 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw,
3066 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw,
3067 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw,
3068 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw,
3069 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw,
3070 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw,
3071 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw,
3072 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw,
3073 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw,
3074 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw,
3075 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw,
3076 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw,
3077 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw,
3078 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw,
3079 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw,
3080 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw,
3081 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw,
3082 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw,
3083 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw,
3084 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw,
3085 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw,
3086 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw,
3087 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw,
3088 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw,
3089 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw,
3090 [CLKID_MALI_0] = &meson8b_mali_0.hw,
3091 [CLKID_MALI_1_SEL] = &meson8b_mali_1_sel.hw,
3092 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw,
3093 [CLKID_MALI_1] = &meson8b_mali_1.hw,
3094 [CLKID_MALI] = &meson8b_mali.hw,
3095 [CLKID_VPU_0_SEL] = &meson8b_vpu_0_sel.hw,
3096 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
3097 [CLKID_VPU_0] = &meson8b_vpu_0.hw,
3098 [CLKID_VPU_1_SEL] = &meson8b_vpu_1_sel.hw,
3099 [CLKID_VPU_1_DIV] = &meson8b_vpu_1_div.hw,
3100 [CLKID_VPU_1] = &meson8b_vpu_1.hw,
3101 [CLKID_VPU] = &meson8b_vpu.hw,
3102 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw,
3103 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw,
3104 [CLKID_VDEC_1_1] = &meson8b_vdec_1_1.hw,
3105 [CLKID_VDEC_1_2_DIV] = &meson8b_vdec_1_2_div.hw,
3106 [CLKID_VDEC_1_2] = &meson8b_vdec_1_2.hw,
3107 [CLKID_VDEC_1] = &meson8b_vdec_1.hw,
3108 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw,
3109 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw,
3110 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw,
3111 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw,
3112 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw,
3113 [CLKID_VDEC_2] = &meson8b_vdec_2.hw,
3114 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw,
3115 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw,
3116 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw,
3117 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw,
3118 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw,
3119 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw,
3120 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw,
3121 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw,
3122 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw,
3123 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
3124 [CLKID_CTS_I958] = &meson8b_cts_i958.hw,
3125 [CLK_NR_CLKS] = NULL,
3130 static struct clk_hw_onecell_data meson8m2_hw_onecell_data = {
3132 [CLKID_PLL_FIXED] = &meson8b_fixed_pll.hw,
3133 [CLKID_PLL_VID] = &meson8b_vid_pll.hw,
3134 [CLKID_PLL_SYS] = &meson8b_sys_pll.hw,
3135 [CLKID_FCLK_DIV2] = &meson8b_fclk_div2.hw,
3136 [CLKID_FCLK_DIV3] = &meson8b_fclk_div3.hw,
3137 [CLKID_FCLK_DIV4] = &meson8b_fclk_div4.hw,
3138 [CLKID_FCLK_DIV5] = &meson8b_fclk_div5.hw,
3139 [CLKID_FCLK_DIV7] = &meson8b_fclk_div7.hw,
3140 [CLKID_CPUCLK] = &meson8b_cpu_clk.hw,
3141 [CLKID_MPEG_SEL] = &meson8b_mpeg_clk_sel.hw,
3142 [CLKID_MPEG_DIV] = &meson8b_mpeg_clk_div.hw,
3143 [CLKID_CLK81] = &meson8b_clk81.hw,
3144 [CLKID_DDR] = &meson8b_ddr.hw,
3145 [CLKID_DOS] = &meson8b_dos.hw,
3146 [CLKID_ISA] = &meson8b_isa.hw,
3147 [CLKID_PL301] = &meson8b_pl301.hw,
3148 [CLKID_PERIPHS] = &meson8b_periphs.hw,
3149 [CLKID_SPICC] = &meson8b_spicc.hw,
3150 [CLKID_I2C] = &meson8b_i2c.hw,
3151 [CLKID_SAR_ADC] = &meson8b_sar_adc.hw,
3152 [CLKID_SMART_CARD] = &meson8b_smart_card.hw,
3153 [CLKID_RNG0] = &meson8b_rng0.hw,
3154 [CLKID_UART0] = &meson8b_uart0.hw,
3155 [CLKID_SDHC] = &meson8b_sdhc.hw,
3156 [CLKID_STREAM] = &meson8b_stream.hw,
3157 [CLKID_ASYNC_FIFO] = &meson8b_async_fifo.hw,
3158 [CLKID_SDIO] = &meson8b_sdio.hw,
3159 [CLKID_ABUF] = &meson8b_abuf.hw,
3160 [CLKID_HIU_IFACE] = &meson8b_hiu_iface.hw,
3161 [CLKID_ASSIST_MISC] = &meson8b_assist_misc.hw,
3162 [CLKID_SPI] = &meson8b_spi.hw,
3163 [CLKID_I2S_SPDIF] = &meson8b_i2s_spdif.hw,
3164 [CLKID_ETH] = &meson8b_eth.hw,
3165 [CLKID_DEMUX] = &meson8b_demux.hw,
3166 [CLKID_AIU_GLUE] = &meson8b_aiu_glue.hw,
3167 [CLKID_IEC958] = &meson8b_iec958.hw,
3168 [CLKID_I2S_OUT] = &meson8b_i2s_out.hw,
3169 [CLKID_AMCLK] = &meson8b_amclk.hw,
3170 [CLKID_AIFIFO2] = &meson8b_aififo2.hw,
3171 [CLKID_MIXER] = &meson8b_mixer.hw,
3172 [CLKID_MIXER_IFACE] = &meson8b_mixer_iface.hw,
3173 [CLKID_ADC] = &meson8b_adc.hw,
3174 [CLKID_BLKMV] = &meson8b_blkmv.hw,
3175 [CLKID_AIU] = &meson8b_aiu.hw,
3176 [CLKID_UART1] = &meson8b_uart1.hw,
3177 [CLKID_G2D] = &meson8b_g2d.hw,
3178 [CLKID_USB0] = &meson8b_usb0.hw,
3179 [CLKID_USB1] = &meson8b_usb1.hw,
3180 [CLKID_RESET] = &meson8b_reset.hw,
3181 [CLKID_NAND] = &meson8b_nand.hw,
3182 [CLKID_DOS_PARSER] = &meson8b_dos_parser.hw,
3183 [CLKID_USB] = &meson8b_usb.hw,
3184 [CLKID_VDIN1] = &meson8b_vdin1.hw,
3185 [CLKID_AHB_ARB0] = &meson8b_ahb_arb0.hw,
3186 [CLKID_EFUSE] = &meson8b_efuse.hw,
3187 [CLKID_BOOT_ROM] = &meson8b_boot_rom.hw,
3188 [CLKID_AHB_DATA_BUS] = &meson8b_ahb_data_bus.hw,
3189 [CLKID_AHB_CTRL_BUS] = &meson8b_ahb_ctrl_bus.hw,
3190 [CLKID_HDMI_INTR_SYNC] = &meson8b_hdmi_intr_sync.hw,
3191 [CLKID_HDMI_PCLK] = &meson8b_hdmi_pclk.hw,
3192 [CLKID_USB1_DDR_BRIDGE] = &meson8b_usb1_ddr_bridge.hw,
3193 [CLKID_USB0_DDR_BRIDGE] = &meson8b_usb0_ddr_bridge.hw,
3194 [CLKID_MMC_PCLK] = &meson8b_mmc_pclk.hw,
3195 [CLKID_DVIN] = &meson8b_dvin.hw,
3196 [CLKID_UART2] = &meson8b_uart2.hw,
3197 [CLKID_SANA] = &meson8b_sana.hw,
3198 [CLKID_VPU_INTR] = &meson8b_vpu_intr.hw,
3199 [CLKID_SEC_AHB_AHB3_BRIDGE] = &meson8b_sec_ahb_ahb3_bridge.hw,
3200 [CLKID_CLK81_A9] = &meson8b_clk81_a9.hw,
3201 [CLKID_VCLK2_VENCI0] = &meson8b_vclk2_venci0.hw,
3202 [CLKID_VCLK2_VENCI1] = &meson8b_vclk2_venci1.hw,
3203 [CLKID_VCLK2_VENCP0] = &meson8b_vclk2_vencp0.hw,
3204 [CLKID_VCLK2_VENCP1] = &meson8b_vclk2_vencp1.hw,
3205 [CLKID_GCLK_VENCI_INT] = &meson8b_gclk_venci_int.hw,
3206 [CLKID_GCLK_VENCP_INT] = &meson8b_gclk_vencp_int.hw,
3207 [CLKID_DAC_CLK] = &meson8b_dac_clk.hw,
3208 [CLKID_AOCLK_GATE] = &meson8b_aoclk_gate.hw,
3209 [CLKID_IEC958_GATE] = &meson8b_iec958_gate.hw,
3210 [CLKID_ENC480P] = &meson8b_enc480p.hw,
3211 [CLKID_RNG1] = &meson8b_rng1.hw,
3212 [CLKID_GCLK_VENCL_INT] = &meson8b_gclk_vencl_int.hw,
3213 [CLKID_VCLK2_VENCLMCC] = &meson8b_vclk2_venclmcc.hw,
3214 [CLKID_VCLK2_VENCL] = &meson8b_vclk2_vencl.hw,
3215 [CLKID_VCLK2_OTHER] = &meson8b_vclk2_other.hw,
3216 [CLKID_EDP] = &meson8b_edp.hw,
3217 [CLKID_AO_MEDIA_CPU] = &meson8b_ao_media_cpu.hw,
3218 [CLKID_AO_AHB_SRAM] = &meson8b_ao_ahb_sram.hw,
3219 [CLKID_AO_AHB_BUS] = &meson8b_ao_ahb_bus.hw,
3220 [CLKID_AO_IFACE] = &meson8b_ao_iface.hw,
3221 [CLKID_MPLL0] = &meson8b_mpll0.hw,
3222 [CLKID_MPLL1] = &meson8b_mpll1.hw,
3223 [CLKID_MPLL2] = &meson8b_mpll2.hw,
3224 [CLKID_MPLL0_DIV] = &meson8b_mpll0_div.hw,
3225 [CLKID_MPLL1_DIV] = &meson8b_mpll1_div.hw,
3226 [CLKID_MPLL2_DIV] = &meson8b_mpll2_div.hw,
3227 [CLKID_CPU_IN_SEL] = &meson8b_cpu_in_sel.hw,
3228 [CLKID_CPU_IN_DIV2] = &meson8b_cpu_in_div2.hw,
3229 [CLKID_CPU_IN_DIV3] = &meson8b_cpu_in_div3.hw,
3230 [CLKID_CPU_SCALE_DIV] = &meson8b_cpu_scale_div.hw,
3231 [CLKID_CPU_SCALE_OUT_SEL] = &meson8b_cpu_scale_out_sel.hw,
3232 [CLKID_MPLL_PREDIV] = &meson8b_mpll_prediv.hw,
3233 [CLKID_FCLK_DIV2_DIV] = &meson8b_fclk_div2_div.hw,
3234 [CLKID_FCLK_DIV3_DIV] = &meson8b_fclk_div3_div.hw,
3235 [CLKID_FCLK_DIV4_DIV] = &meson8b_fclk_div4_div.hw,
3236 [CLKID_FCLK_DIV5_DIV] = &meson8b_fclk_div5_div.hw,
3237 [CLKID_FCLK_DIV7_DIV] = &meson8b_fclk_div7_div.hw,
3238 [CLKID_NAND_SEL] = &meson8b_nand_clk_sel.hw,
3239 [CLKID_NAND_DIV] = &meson8b_nand_clk_div.hw,
3240 [CLKID_NAND_CLK] = &meson8b_nand_clk_gate.hw,
3241 [CLKID_PLL_FIXED_DCO] = &meson8b_fixed_pll_dco.hw,
3242 [CLKID_HDMI_PLL_DCO] = &meson8b_hdmi_pll_dco.hw,
3243 [CLKID_PLL_SYS_DCO] = &meson8b_sys_pll_dco.hw,
3244 [CLKID_CPU_CLK_DIV2] = &meson8b_cpu_clk_div2.hw,
3245 [CLKID_CPU_CLK_DIV3] = &meson8b_cpu_clk_div3.hw,
3246 [CLKID_CPU_CLK_DIV4] = &meson8b_cpu_clk_div4.hw,
3247 [CLKID_CPU_CLK_DIV5] = &meson8b_cpu_clk_div5.hw,
3248 [CLKID_CPU_CLK_DIV6] = &meson8b_cpu_clk_div6.hw,
3249 [CLKID_CPU_CLK_DIV7] = &meson8b_cpu_clk_div7.hw,
3250 [CLKID_CPU_CLK_DIV8] = &meson8b_cpu_clk_div8.hw,
3251 [CLKID_APB_SEL] = &meson8b_apb_clk_sel.hw,
3252 [CLKID_APB] = &meson8b_apb_clk_gate.hw,
3253 [CLKID_PERIPH_SEL] = &meson8b_periph_clk_sel.hw,
3254 [CLKID_PERIPH] = &meson8b_periph_clk_gate.hw,
3255 [CLKID_AXI_SEL] = &meson8b_axi_clk_sel.hw,
3256 [CLKID_AXI] = &meson8b_axi_clk_gate.hw,
3257 [CLKID_L2_DRAM_SEL] = &meson8b_l2_dram_clk_sel.hw,
3258 [CLKID_L2_DRAM] = &meson8b_l2_dram_clk_gate.hw,
3259 [CLKID_HDMI_PLL_LVDS_OUT] = &meson8b_hdmi_pll_lvds_out.hw,
3260 [CLKID_HDMI_PLL_HDMI_OUT] = &meson8b_hdmi_pll_hdmi_out.hw,
3261 [CLKID_VID_PLL_IN_SEL] = &meson8b_vid_pll_in_sel.hw,
3262 [CLKID_VID_PLL_IN_EN] = &meson8b_vid_pll_in_en.hw,
3263 [CLKID_VID_PLL_PRE_DIV] = &meson8b_vid_pll_pre_div.hw,
3264 [CLKID_VID_PLL_POST_DIV] = &meson8b_vid_pll_post_div.hw,
3265 [CLKID_VID_PLL_FINAL_DIV] = &meson8b_vid_pll_final_div.hw,
3266 [CLKID_VCLK_IN_SEL] = &meson8b_vclk_in_sel.hw,
3267 [CLKID_VCLK_IN_EN] = &meson8b_vclk_in_en.hw,
3268 [CLKID_VCLK_EN] = &meson8b_vclk_en.hw,
3269 [CLKID_VCLK_DIV1] = &meson8b_vclk_div1_gate.hw,
3270 [CLKID_VCLK_DIV2_DIV] = &meson8b_vclk_div2_div.hw,
3271 [CLKID_VCLK_DIV2] = &meson8b_vclk_div2_div_gate.hw,
3272 [CLKID_VCLK_DIV4_DIV] = &meson8b_vclk_div4_div.hw,
3273 [CLKID_VCLK_DIV4] = &meson8b_vclk_div4_div_gate.hw,
3274 [CLKID_VCLK_DIV6_DIV] = &meson8b_vclk_div6_div.hw,
3275 [CLKID_VCLK_DIV6] = &meson8b_vclk_div6_div_gate.hw,
3276 [CLKID_VCLK_DIV12_DIV] = &meson8b_vclk_div12_div.hw,
3277 [CLKID_VCLK_DIV12] = &meson8b_vclk_div12_div_gate.hw,
3278 [CLKID_VCLK2_IN_SEL] = &meson8b_vclk2_in_sel.hw,
3279 [CLKID_VCLK2_IN_EN] = &meson8b_vclk2_clk_in_en.hw,
3280 [CLKID_VCLK2_EN] = &meson8b_vclk2_clk_en.hw,
3281 [CLKID_VCLK2_DIV1] = &meson8b_vclk2_div1_gate.hw,
3282 [CLKID_VCLK2_DIV2_DIV] = &meson8b_vclk2_div2_div.hw,
3283 [CLKID_VCLK2_DIV2] = &meson8b_vclk2_div2_div_gate.hw,
3284 [CLKID_VCLK2_DIV4_DIV] = &meson8b_vclk2_div4_div.hw,
3285 [CLKID_VCLK2_DIV4] = &meson8b_vclk2_div4_div_gate.hw,
3286 [CLKID_VCLK2_DIV6_DIV] = &meson8b_vclk2_div6_div.hw,
3287 [CLKID_VCLK2_DIV6] = &meson8b_vclk2_div6_div_gate.hw,
3288 [CLKID_VCLK2_DIV12_DIV] = &meson8b_vclk2_div12_div.hw,
3289 [CLKID_VCLK2_DIV12] = &meson8b_vclk2_div12_div_gate.hw,
3290 [CLKID_CTS_ENCT_SEL] = &meson8b_cts_enct_sel.hw,
3291 [CLKID_CTS_ENCT] = &meson8b_cts_enct.hw,
3292 [CLKID_CTS_ENCP_SEL] = &meson8b_cts_encp_sel.hw,
3293 [CLKID_CTS_ENCP] = &meson8b_cts_encp.hw,
3294 [CLKID_CTS_ENCI_SEL] = &meson8b_cts_enci_sel.hw,
3295 [CLKID_CTS_ENCI] = &meson8b_cts_enci.hw,
3296 [CLKID_HDMI_TX_PIXEL_SEL] = &meson8b_hdmi_tx_pixel_sel.hw,
3297 [CLKID_HDMI_TX_PIXEL] = &meson8b_hdmi_tx_pixel.hw,
3298 [CLKID_CTS_ENCL_SEL] = &meson8b_cts_encl_sel.hw,
3299 [CLKID_CTS_ENCL] = &meson8b_cts_encl.hw,
3300 [CLKID_CTS_VDAC0_SEL] = &meson8b_cts_vdac0_sel.hw,
3301 [CLKID_CTS_VDAC0] = &meson8b_cts_vdac0.hw,
3302 [CLKID_HDMI_SYS_SEL] = &meson8b_hdmi_sys_sel.hw,
3303 [CLKID_HDMI_SYS_DIV] = &meson8b_hdmi_sys_div.hw,
3304 [CLKID_HDMI_SYS] = &meson8b_hdmi_sys.hw,
3305 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw,
3306 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw,
3307 [CLKID_MALI_0] = &meson8b_mali_0.hw,
3308 [CLKID_MALI_1_SEL] = &meson8b_mali_1_sel.hw,
3309 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw,
3310 [CLKID_MALI_1] = &meson8b_mali_1.hw,
3311 [CLKID_MALI] = &meson8b_mali.hw,
3312 [CLKID_GP_PLL_DCO] = &meson8m2_gp_pll_dco.hw,
3313 [CLKID_GP_PLL] = &meson8m2_gp_pll.hw,
3314 [CLKID_VPU_0_SEL] = &meson8m2_vpu_0_sel.hw,
3315 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
3316 [CLKID_VPU_0] = &meson8b_vpu_0.hw,
3317 [CLKID_VPU_1_SEL] = &meson8m2_vpu_1_sel.hw,
3318 [CLKID_VPU_1_DIV] = &meson8b_vpu_1_div.hw,
3319 [CLKID_VPU_1] = &meson8b_vpu_1.hw,
3320 [CLKID_VPU] = &meson8b_vpu.hw,
3321 [CLKID_VDEC_1_SEL] = &meson8b_vdec_1_sel.hw,
3322 [CLKID_VDEC_1_1_DIV] = &meson8b_vdec_1_1_div.hw,
3323 [CLKID_VDEC_1_1] = &meson8b_vdec_1_1.hw,
3324 [CLKID_VDEC_1_2_DIV] = &meson8b_vdec_1_2_div.hw,
3325 [CLKID_VDEC_1_2] = &meson8b_vdec_1_2.hw,
3326 [CLKID_VDEC_1] = &meson8b_vdec_1.hw,
3327 [CLKID_VDEC_HCODEC_SEL] = &meson8b_vdec_hcodec_sel.hw,
3328 [CLKID_VDEC_HCODEC_DIV] = &meson8b_vdec_hcodec_div.hw,
3329 [CLKID_VDEC_HCODEC] = &meson8b_vdec_hcodec.hw,
3330 [CLKID_VDEC_2_SEL] = &meson8b_vdec_2_sel.hw,
3331 [CLKID_VDEC_2_DIV] = &meson8b_vdec_2_div.hw,
3332 [CLKID_VDEC_2] = &meson8b_vdec_2.hw,
3333 [CLKID_VDEC_HEVC_SEL] = &meson8b_vdec_hevc_sel.hw,
3334 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw,
3335 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw,
3336 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw,
3337 [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw,
3338 [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw,
3339 [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw,
3340 [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw,
3341 [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw,
3342 [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
3343 [CLKID_CTS_I958] = &meson8b_cts_i958.hw,
3344 [CLK_NR_CLKS] = NULL,
3349 static struct clk_regmap *const meson8b_clk_regmaps[] = {
3359 &meson8b_smart_card,
3364 &meson8b_async_fifo,
3368 &meson8b_assist_misc,
3379 &meson8b_mixer_iface,
3389 &meson8b_dos_parser,
3395 &meson8b_ahb_data_bus,
3396 &meson8b_ahb_ctrl_bus,
3397 &meson8b_hdmi_intr_sync,
3399 &meson8b_usb1_ddr_bridge,
3400 &meson8b_usb0_ddr_bridge,
3406 &meson8b_sec_ahb_ahb3_bridge,
3408 &meson8b_vclk2_venci0,
3409 &meson8b_vclk2_venci1,
3410 &meson8b_vclk2_vencp0,
3411 &meson8b_vclk2_vencp1,
3412 &meson8b_gclk_venci_int,
3413 &meson8b_gclk_vencp_int,
3415 &meson8b_aoclk_gate,
3416 &meson8b_iec958_gate,
3419 &meson8b_gclk_vencl_int,
3420 &meson8b_vclk2_venclmcc,
3421 &meson8b_vclk2_vencl,
3422 &meson8b_vclk2_other,
3424 &meson8b_ao_media_cpu,
3425 &meson8b_ao_ahb_sram,
3426 &meson8b_ao_ahb_bus,
3428 &meson8b_mpeg_clk_div,
3429 &meson8b_mpeg_clk_sel,
3438 &meson8b_cpu_in_sel,
3439 &meson8b_cpu_scale_div,
3440 &meson8b_cpu_scale_out_sel,
3442 &meson8b_mpll_prediv,
3448 &meson8b_nand_clk_sel,
3449 &meson8b_nand_clk_div,
3450 &meson8b_nand_clk_gate,
3451 &meson8b_fixed_pll_dco,
3452 &meson8b_hdmi_pll_dco,
3453 &meson8b_sys_pll_dco,
3454 &meson8b_apb_clk_sel,
3455 &meson8b_apb_clk_gate,
3456 &meson8b_periph_clk_sel,
3457 &meson8b_periph_clk_gate,
3458 &meson8b_axi_clk_sel,
3459 &meson8b_axi_clk_gate,
3460 &meson8b_l2_dram_clk_sel,
3461 &meson8b_l2_dram_clk_gate,
3462 &meson8b_hdmi_pll_lvds_out,
3463 &meson8b_hdmi_pll_hdmi_out,
3464 &meson8b_vid_pll_in_sel,
3465 &meson8b_vid_pll_in_en,
3466 &meson8b_vid_pll_pre_div,
3467 &meson8b_vid_pll_post_div,
3469 &meson8b_vid_pll_final_div,
3470 &meson8b_vclk_in_sel,
3471 &meson8b_vclk_in_en,
3473 &meson8b_vclk_div1_gate,
3474 &meson8b_vclk_div2_div_gate,
3475 &meson8b_vclk_div4_div_gate,
3476 &meson8b_vclk_div6_div_gate,
3477 &meson8b_vclk_div12_div_gate,
3478 &meson8b_vclk2_in_sel,
3479 &meson8b_vclk2_clk_in_en,
3480 &meson8b_vclk2_clk_en,
3481 &meson8b_vclk2_div1_gate,
3482 &meson8b_vclk2_div2_div_gate,
3483 &meson8b_vclk2_div4_div_gate,
3484 &meson8b_vclk2_div6_div_gate,
3485 &meson8b_vclk2_div12_div_gate,
3486 &meson8b_cts_enct_sel,
3488 &meson8b_cts_encp_sel,
3490 &meson8b_cts_enci_sel,
3492 &meson8b_hdmi_tx_pixel_sel,
3493 &meson8b_hdmi_tx_pixel,
3494 &meson8b_cts_encl_sel,
3496 &meson8b_cts_vdac0_sel,
3498 &meson8b_hdmi_sys_sel,
3499 &meson8b_hdmi_sys_div,
3501 &meson8b_mali_0_sel,
3502 &meson8b_mali_0_div,
3504 &meson8b_mali_1_sel,
3505 &meson8b_mali_1_div,
3508 &meson8m2_gp_pll_dco,
3511 &meson8m2_vpu_0_sel,
3515 &meson8m2_vpu_1_sel,
3519 &meson8b_vdec_1_sel,
3520 &meson8b_vdec_1_1_div,
3522 &meson8b_vdec_1_2_div,
3525 &meson8b_vdec_hcodec_sel,
3526 &meson8b_vdec_hcodec_div,
3527 &meson8b_vdec_hcodec,
3528 &meson8b_vdec_2_sel,
3529 &meson8b_vdec_2_div,
3531 &meson8b_vdec_hevc_sel,
3532 &meson8b_vdec_hevc_div,
3533 &meson8b_vdec_hevc_en,
3536 &meson8b_cts_amclk_sel,
3537 &meson8b_cts_amclk_div,
3538 &meson8b_cts_mclk_i958_sel,
3539 &meson8b_cts_mclk_i958_div,
3540 &meson8b_cts_mclk_i958,
3544 static const struct meson8b_clk_reset_line {
3548 } meson8b_clk_reset_bits[] = {
3549 [CLKC_RESET_L2_CACHE_SOFT_RESET] = {
3550 .reg = HHI_SYS_CPU_CLK_CNTL0,
3552 .active_low = false,
3554 [CLKC_RESET_AXI_64_TO_128_BRIDGE_A5_SOFT_RESET] = {
3555 .reg = HHI_SYS_CPU_CLK_CNTL0,
3557 .active_low = false,
3559 [CLKC_RESET_SCU_SOFT_RESET] = {
3560 .reg = HHI_SYS_CPU_CLK_CNTL0,
3562 .active_low = false,
3564 [CLKC_RESET_CPU3_SOFT_RESET] = {
3565 .reg = HHI_SYS_CPU_CLK_CNTL0,
3567 .active_low = false,
3569 [CLKC_RESET_CPU2_SOFT_RESET] = {
3570 .reg = HHI_SYS_CPU_CLK_CNTL0,
3572 .active_low = false,
3574 [CLKC_RESET_CPU1_SOFT_RESET] = {
3575 .reg = HHI_SYS_CPU_CLK_CNTL0,
3577 .active_low = false,
3579 [CLKC_RESET_CPU0_SOFT_RESET] = {
3580 .reg = HHI_SYS_CPU_CLK_CNTL0,
3582 .active_low = false,
3584 [CLKC_RESET_A5_GLOBAL_RESET] = {
3585 .reg = HHI_SYS_CPU_CLK_CNTL0,
3587 .active_low = false,
3589 [CLKC_RESET_A5_AXI_SOFT_RESET] = {
3590 .reg = HHI_SYS_CPU_CLK_CNTL0,
3592 .active_low = false,
3594 [CLKC_RESET_A5_ABP_SOFT_RESET] = {
3595 .reg = HHI_SYS_CPU_CLK_CNTL0,
3597 .active_low = false,
3599 [CLKC_RESET_AXI_64_TO_128_BRIDGE_MMC_SOFT_RESET] = {
3600 .reg = HHI_SYS_CPU_CLK_CNTL1,
3602 .active_low = false,
3604 [CLKC_RESET_VID_CLK_CNTL_SOFT_RESET] = {
3605 .reg = HHI_VID_CLK_CNTL,
3607 .active_low = false,
3609 [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST] = {
3610 .reg = HHI_VID_DIVIDER_CNTL,
3612 .active_low = false,
3614 [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE] = {
3615 .reg = HHI_VID_DIVIDER_CNTL,
3617 .active_low = false,
3619 [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST] = {
3620 .reg = HHI_VID_DIVIDER_CNTL,
3624 [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE] = {
3625 .reg = HHI_VID_DIVIDER_CNTL,
3631 static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev,
3632 unsigned long id, bool assert)
3634 struct meson8b_clk_reset *meson8b_clk_reset =
3635 container_of(rcdev, struct meson8b_clk_reset, reset);
3636 const struct meson8b_clk_reset_line *reset;
3637 unsigned int value = 0;
3638 unsigned long flags;
3640 if (id >= ARRAY_SIZE(meson8b_clk_reset_bits))
3643 reset = &meson8b_clk_reset_bits[id];
3645 if (assert != reset->active_low)
3646 value = BIT(reset->bit_idx);
3648 spin_lock_irqsave(&meson_clk_lock, flags);
3650 regmap_update_bits(meson8b_clk_reset->regmap, reset->reg,
3651 BIT(reset->bit_idx), value);
3653 spin_unlock_irqrestore(&meson_clk_lock, flags);
3658 static int meson8b_clk_reset_assert(struct reset_controller_dev *rcdev,
3661 return meson8b_clk_reset_update(rcdev, id, true);
3664 static int meson8b_clk_reset_deassert(struct reset_controller_dev *rcdev,
3667 return meson8b_clk_reset_update(rcdev, id, false);
3670 static const struct reset_control_ops meson8b_clk_reset_ops = {
3671 .assert = meson8b_clk_reset_assert,
3672 .deassert = meson8b_clk_reset_deassert,
3675 struct meson8b_nb_data {
3676 struct notifier_block nb;
3677 struct clk_hw *cpu_clk;
3680 static int meson8b_cpu_clk_notifier_cb(struct notifier_block *nb,
3681 unsigned long event, void *data)
3683 struct meson8b_nb_data *nb_data =
3684 container_of(nb, struct meson8b_nb_data, nb);
3685 struct clk_hw *parent_clk;
3689 case PRE_RATE_CHANGE:
3691 parent_clk = clk_hw_get_parent_by_index(nb_data->cpu_clk, 0);
3694 case POST_RATE_CHANGE:
3695 /* cpu_scale_out_sel */
3696 parent_clk = clk_hw_get_parent_by_index(nb_data->cpu_clk, 1);
3703 ret = clk_hw_set_parent(nb_data->cpu_clk, parent_clk);
3705 return notifier_from_errno(ret);
3712 static struct meson8b_nb_data meson8b_cpu_nb_data = {
3713 .nb.notifier_call = meson8b_cpu_clk_notifier_cb,
3716 static void __init meson8b_clkc_init_common(struct device_node *np,
3717 struct clk_hw_onecell_data *clk_hw_onecell_data)
3719 struct meson8b_clk_reset *rstc;
3720 const char *notifier_clk_name;
3721 struct clk *notifier_clk;
3725 map = syscon_node_to_regmap(of_get_parent(np));
3727 pr_err("failed to get HHI regmap - Trying obsolete regs\n");
3731 rstc = kzalloc(sizeof(*rstc), GFP_KERNEL);
3735 /* Reset Controller */
3737 rstc->reset.ops = &meson8b_clk_reset_ops;
3738 rstc->reset.nr_resets = ARRAY_SIZE(meson8b_clk_reset_bits);
3739 rstc->reset.of_node = np;
3740 ret = reset_controller_register(&rstc->reset);
3742 pr_err("%s: Failed to register clkc reset controller: %d\n",
3747 /* Populate regmap for the regmap backed clocks */
3748 for (i = 0; i < ARRAY_SIZE(meson8b_clk_regmaps); i++)
3749 meson8b_clk_regmaps[i]->map = map;
3752 * register all clks and start with the first used ID (which is
3755 for (i = CLKID_PLL_FIXED; i < CLK_NR_CLKS; i++) {
3756 /* array might be sparse */
3757 if (!clk_hw_onecell_data->hws[i])
3760 ret = of_clk_hw_register(np, clk_hw_onecell_data->hws[i]);
3765 meson8b_cpu_nb_data.cpu_clk = clk_hw_onecell_data->hws[CLKID_CPUCLK];
3768 * FIXME we shouldn't program the muxes in notifier handlers. The
3769 * tricky programming sequence will be handled by the forthcoming
3770 * coordinated clock rates mechanism once that feature is released.
3772 notifier_clk_name = clk_hw_get_name(&meson8b_cpu_scale_out_sel.hw);
3773 notifier_clk = __clk_lookup(notifier_clk_name);
3774 ret = clk_notifier_register(notifier_clk, &meson8b_cpu_nb_data.nb);
3776 pr_err("%s: failed to register the CPU clock notifier\n",
3781 ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get,
3782 clk_hw_onecell_data);
3784 pr_err("%s: failed to register clock provider\n", __func__);
3787 static void __init meson8_clkc_init(struct device_node *np)
3789 return meson8b_clkc_init_common(np, &meson8_hw_onecell_data);
3792 static void __init meson8b_clkc_init(struct device_node *np)
3794 return meson8b_clkc_init_common(np, &meson8b_hw_onecell_data);
3797 static void __init meson8m2_clkc_init(struct device_node *np)
3799 return meson8b_clkc_init_common(np, &meson8m2_hw_onecell_data);
3802 CLK_OF_DECLARE_DRIVER(meson8_clkc, "amlogic,meson8-clkc",
3804 CLK_OF_DECLARE_DRIVER(meson8b_clkc, "amlogic,meson8b-clkc",
3806 CLK_OF_DECLARE_DRIVER(meson8m2_clkc, "amlogic,meson8m2-clkc",
3807 meson8m2_clkc_init);