1 // SPDX-License-Identifier: (GPL-2.0-only OR MIT)
3 * Amlogic S4 Peripherals Clock Controller Driver
5 * Copyright (c) 2022-2023 Amlogic, inc. All rights reserved
6 * Author: Yu Tu <yu.tu@amlogic.com>
9 #include <linux/clk-provider.h>
10 #include <linux/of_device.h>
11 #include <linux/platform_device.h>
13 #include "clk-regmap.h"
14 #include "vid-pll-div.h"
15 #include "clk-dualdiv.h"
16 #include "s4-peripherals.h"
17 #include "meson-clkc-utils.h"
18 #include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h>
20 static struct clk_regmap s4_rtc_32k_by_oscin_clkin = {
21 .data = &(struct clk_regmap_gate_data){
22 .offset = CLKCTRL_RTC_BY_OSCIN_CTRL0,
25 .hw.init = &(struct clk_init_data) {
26 .name = "rtc_32k_by_oscin_clkin",
27 .ops = &clk_regmap_gate_ops,
28 .parent_data = (const struct clk_parent_data []) {
29 { .fw_name = "xtal", }
35 static const struct meson_clk_dualdiv_param s4_32k_div_table[] = {
46 static struct clk_regmap s4_rtc_32k_by_oscin_div = {
47 .data = &(struct meson_clk_dualdiv_data){
49 .reg_off = CLKCTRL_RTC_BY_OSCIN_CTRL0,
54 .reg_off = CLKCTRL_RTC_BY_OSCIN_CTRL0,
59 .reg_off = CLKCTRL_RTC_BY_OSCIN_CTRL1,
64 .reg_off = CLKCTRL_RTC_BY_OSCIN_CTRL1,
69 .reg_off = CLKCTRL_RTC_BY_OSCIN_CTRL0,
73 .table = s4_32k_div_table,
75 .hw.init = &(struct clk_init_data){
76 .name = "rtc_32k_by_oscin_div",
77 .ops = &meson_clk_dualdiv_ops,
78 .parent_hws = (const struct clk_hw *[]) {
79 &s4_rtc_32k_by_oscin_clkin.hw
85 static struct clk_regmap s4_rtc_32k_by_oscin_sel = {
86 .data = &(struct clk_regmap_mux_data) {
87 .offset = CLKCTRL_RTC_BY_OSCIN_CTRL1,
90 .flags = CLK_MUX_ROUND_CLOSEST,
92 .hw.init = &(struct clk_init_data){
93 .name = "rtc_32k_by_oscin_sel",
94 .ops = &clk_regmap_mux_ops,
95 .parent_hws = (const struct clk_hw *[]) {
96 &s4_rtc_32k_by_oscin_div.hw,
97 &s4_rtc_32k_by_oscin_clkin.hw,
100 .flags = CLK_SET_RATE_PARENT,
104 static struct clk_regmap s4_rtc_32k_by_oscin = {
105 .data = &(struct clk_regmap_gate_data){
106 .offset = CLKCTRL_RTC_BY_OSCIN_CTRL0,
109 .hw.init = &(struct clk_init_data) {
110 .name = "rtc_32k_by_oscin",
111 .ops = &clk_regmap_gate_ops,
112 .parent_hws = (const struct clk_hw *[]) {
113 &s4_rtc_32k_by_oscin_sel.hw
116 .flags = CLK_SET_RATE_PARENT,
120 static struct clk_regmap s4_rtc_clk = {
121 .data = &(struct clk_regmap_mux_data) {
122 .offset = CLKCTRL_RTC_CTRL,
125 .flags = CLK_MUX_ROUND_CLOSEST,
127 .hw.init = &(struct clk_init_data){
128 .name = "rtc_clk_sel",
129 .ops = &clk_regmap_mux_ops,
130 .parent_hws = (const struct clk_hw *[]) {
131 &s4_rtc_32k_by_oscin.hw,
132 &s4_rtc_32k_by_oscin_div.hw,
135 .flags = CLK_SET_RATE_PARENT,
139 /* The index 5 is AXI_CLK, which is dedicated to AXI. So skip it. */
140 static u32 mux_table_sys_ab_clk_sel[] = { 0, 1, 2, 3, 4, 6, 7 };
141 static const struct clk_parent_data sys_ab_clk_parent_data[] = {
142 { .fw_name = "xtal" },
143 { .fw_name = "fclk_div2" },
144 { .fw_name = "fclk_div3" },
145 { .fw_name = "fclk_div4" },
146 { .fw_name = "fclk_div5" },
147 { .fw_name = "fclk_div7" },
148 { .hw = &s4_rtc_clk.hw }
152 * This clock is initialized by ROMcode.
153 * The chip was changed SYS CLK for security reasons. SYS CLK registers are not writable
154 * in the kernel phase. Write of SYS related register will cause the system to crash.
155 * Meanwhile, these clock won't ever change at runtime.
156 * For the above reasons, we can only use ro_ops for SYS related clocks.
158 static struct clk_regmap s4_sysclk_b_sel = {
159 .data = &(struct clk_regmap_mux_data){
160 .offset = CLKCTRL_SYS_CLK_CTRL0,
163 .table = mux_table_sys_ab_clk_sel,
165 .hw.init = &(struct clk_init_data){
166 .name = "sysclk_b_sel",
167 .ops = &clk_regmap_mux_ro_ops,
168 .parent_data = sys_ab_clk_parent_data,
169 .num_parents = ARRAY_SIZE(sys_ab_clk_parent_data),
173 static struct clk_regmap s4_sysclk_b_div = {
174 .data = &(struct clk_regmap_div_data){
175 .offset = CLKCTRL_SYS_CLK_CTRL0,
179 .hw.init = &(struct clk_init_data){
180 .name = "sysclk_b_div",
181 .ops = &clk_regmap_divider_ro_ops,
182 .parent_hws = (const struct clk_hw *[]) {
189 static struct clk_regmap s4_sysclk_b = {
190 .data = &(struct clk_regmap_gate_data){
191 .offset = CLKCTRL_SYS_CLK_CTRL0,
194 .hw.init = &(struct clk_init_data) {
196 .ops = &clk_regmap_gate_ro_ops,
197 .parent_hws = (const struct clk_hw *[]) {
204 static struct clk_regmap s4_sysclk_a_sel = {
205 .data = &(struct clk_regmap_mux_data){
206 .offset = CLKCTRL_SYS_CLK_CTRL0,
209 .table = mux_table_sys_ab_clk_sel,
211 .hw.init = &(struct clk_init_data){
212 .name = "sysclk_a_sel",
213 .ops = &clk_regmap_mux_ro_ops,
214 .parent_data = sys_ab_clk_parent_data,
215 .num_parents = ARRAY_SIZE(sys_ab_clk_parent_data),
219 static struct clk_regmap s4_sysclk_a_div = {
220 .data = &(struct clk_regmap_div_data){
221 .offset = CLKCTRL_SYS_CLK_CTRL0,
225 .hw.init = &(struct clk_init_data){
226 .name = "sysclk_a_div",
227 .ops = &clk_regmap_divider_ro_ops,
228 .parent_hws = (const struct clk_hw *[]) {
235 static struct clk_regmap s4_sysclk_a = {
236 .data = &(struct clk_regmap_gate_data){
237 .offset = CLKCTRL_SYS_CLK_CTRL0,
240 .hw.init = &(struct clk_init_data) {
242 .ops = &clk_regmap_gate_ro_ops,
243 .parent_hws = (const struct clk_hw *[]) {
250 static struct clk_regmap s4_sys_clk = {
251 .data = &(struct clk_regmap_mux_data){
252 .offset = CLKCTRL_SYS_CLK_CTRL0,
256 .hw.init = &(struct clk_init_data){
258 .ops = &clk_regmap_mux_ro_ops,
259 .parent_hws = (const struct clk_hw *[]) {
267 static struct clk_regmap s4_ceca_32k_clkin = {
268 .data = &(struct clk_regmap_gate_data){
269 .offset = CLKCTRL_CECA_CTRL0,
272 .hw.init = &(struct clk_init_data) {
273 .name = "ceca_32k_clkin",
274 .ops = &clk_regmap_gate_ops,
275 .parent_data = (const struct clk_parent_data []) {
276 { .fw_name = "xtal", }
282 static struct clk_regmap s4_ceca_32k_div = {
283 .data = &(struct meson_clk_dualdiv_data){
285 .reg_off = CLKCTRL_CECA_CTRL0,
290 .reg_off = CLKCTRL_CECA_CTRL0,
295 .reg_off = CLKCTRL_CECA_CTRL1,
300 .reg_off = CLKCTRL_CECA_CTRL1,
305 .reg_off = CLKCTRL_CECA_CTRL0,
309 .table = s4_32k_div_table,
311 .hw.init = &(struct clk_init_data){
312 .name = "ceca_32k_div",
313 .ops = &meson_clk_dualdiv_ops,
314 .parent_hws = (const struct clk_hw *[]) {
315 &s4_ceca_32k_clkin.hw
321 static struct clk_regmap s4_ceca_32k_sel_pre = {
322 .data = &(struct clk_regmap_mux_data) {
323 .offset = CLKCTRL_CECA_CTRL1,
326 .flags = CLK_MUX_ROUND_CLOSEST,
328 .hw.init = &(struct clk_init_data){
329 .name = "ceca_32k_sel_pre",
330 .ops = &clk_regmap_mux_ops,
331 .parent_hws = (const struct clk_hw *[]) {
333 &s4_ceca_32k_clkin.hw
336 .flags = CLK_SET_RATE_PARENT,
340 static struct clk_regmap s4_ceca_32k_sel = {
341 .data = &(struct clk_regmap_mux_data) {
342 .offset = CLKCTRL_CECA_CTRL1,
345 .flags = CLK_MUX_ROUND_CLOSEST,
347 .hw.init = &(struct clk_init_data){
348 .name = "ceca_32k_sel",
349 .ops = &clk_regmap_mux_ops,
350 .parent_hws = (const struct clk_hw *[]) {
351 &s4_ceca_32k_sel_pre.hw,
358 static struct clk_regmap s4_ceca_32k_clkout = {
359 .data = &(struct clk_regmap_gate_data){
360 .offset = CLKCTRL_CECA_CTRL0,
363 .hw.init = &(struct clk_init_data){
364 .name = "ceca_32k_clkout",
365 .ops = &clk_regmap_gate_ops,
366 .parent_hws = (const struct clk_hw *[]) {
370 .flags = CLK_SET_RATE_PARENT,
374 static struct clk_regmap s4_cecb_32k_clkin = {
375 .data = &(struct clk_regmap_gate_data){
376 .offset = CLKCTRL_CECB_CTRL0,
379 .hw.init = &(struct clk_init_data) {
380 .name = "cecb_32k_clkin",
381 .ops = &clk_regmap_gate_ops,
382 .parent_data = (const struct clk_parent_data []) {
383 { .fw_name = "xtal", }
389 static struct clk_regmap s4_cecb_32k_div = {
390 .data = &(struct meson_clk_dualdiv_data){
392 .reg_off = CLKCTRL_CECB_CTRL0,
397 .reg_off = CLKCTRL_CECB_CTRL0,
402 .reg_off = CLKCTRL_CECB_CTRL1,
407 .reg_off = CLKCTRL_CECB_CTRL1,
412 .reg_off = CLKCTRL_CECB_CTRL0,
416 .table = s4_32k_div_table,
418 .hw.init = &(struct clk_init_data){
419 .name = "cecb_32k_div",
420 .ops = &meson_clk_dualdiv_ops,
421 .parent_hws = (const struct clk_hw *[]) {
422 &s4_cecb_32k_clkin.hw
428 static struct clk_regmap s4_cecb_32k_sel_pre = {
429 .data = &(struct clk_regmap_mux_data) {
430 .offset = CLKCTRL_CECB_CTRL1,
433 .flags = CLK_MUX_ROUND_CLOSEST,
435 .hw.init = &(struct clk_init_data){
436 .name = "cecb_32k_sel_pre",
437 .ops = &clk_regmap_mux_ops,
438 .parent_hws = (const struct clk_hw *[]) {
440 &s4_cecb_32k_clkin.hw
443 .flags = CLK_SET_RATE_PARENT,
447 static struct clk_regmap s4_cecb_32k_sel = {
448 .data = &(struct clk_regmap_mux_data) {
449 .offset = CLKCTRL_CECB_CTRL1,
452 .flags = CLK_MUX_ROUND_CLOSEST,
454 .hw.init = &(struct clk_init_data){
455 .name = "cecb_32k_sel",
456 .ops = &clk_regmap_mux_ops,
457 .parent_hws = (const struct clk_hw *[]) {
458 &s4_cecb_32k_sel_pre.hw,
465 static struct clk_regmap s4_cecb_32k_clkout = {
466 .data = &(struct clk_regmap_gate_data){
467 .offset = CLKCTRL_CECB_CTRL0,
470 .hw.init = &(struct clk_init_data){
471 .name = "cecb_32k_clkout",
472 .ops = &clk_regmap_gate_ops,
473 .parent_hws = (const struct clk_hw *[]) {
477 .flags = CLK_SET_RATE_PARENT,
481 static const struct clk_parent_data s4_sc_parent_data[] = {
482 { .fw_name = "fclk_div4" },
483 { .fw_name = "fclk_div3" },
484 { .fw_name = "fclk_div5" },
485 { .fw_name = "xtal", }
488 static struct clk_regmap s4_sc_clk_mux = {
489 .data = &(struct clk_regmap_mux_data){
490 .offset = CLKCTRL_SC_CLK_CTRL,
494 .hw.init = &(struct clk_init_data) {
495 .name = "sc_clk_mux",
496 .ops = &clk_regmap_mux_ops,
497 .parent_data = s4_sc_parent_data,
498 .num_parents = ARRAY_SIZE(s4_sc_parent_data),
499 .flags = CLK_SET_RATE_PARENT,
503 static struct clk_regmap s4_sc_clk_div = {
504 .data = &(struct clk_regmap_div_data){
505 .offset = CLKCTRL_SC_CLK_CTRL,
509 .hw.init = &(struct clk_init_data) {
510 .name = "sc_clk_div",
511 .ops = &clk_regmap_divider_ops,
512 .parent_hws = (const struct clk_hw *[]) {
516 .flags = CLK_SET_RATE_PARENT,
520 static struct clk_regmap s4_sc_clk_gate = {
521 .data = &(struct clk_regmap_gate_data){
522 .offset = CLKCTRL_SC_CLK_CTRL,
525 .hw.init = &(struct clk_init_data){
526 .name = "sc_clk_gate",
527 .ops = &clk_regmap_gate_ops,
528 .parent_hws = (const struct clk_hw *[]) {
532 .flags = CLK_SET_RATE_PARENT,
536 static struct clk_regmap s4_12_24M_clk_gate = {
537 .data = &(struct clk_regmap_gate_data){
538 .offset = CLKCTRL_CLK12_24_CTRL,
541 .hw.init = &(struct clk_init_data) {
542 .name = "12_24m_gate",
543 .ops = &clk_regmap_gate_ops,
544 .parent_data = (const struct clk_parent_data []) {
545 { .fw_name = "xtal", }
551 static struct clk_fixed_factor s4_12M_clk_div = {
554 .hw.init = &(struct clk_init_data){
556 .ops = &clk_fixed_factor_ops,
557 .parent_hws = (const struct clk_hw *[]) {
558 &s4_12_24M_clk_gate.hw
561 .flags = CLK_SET_RATE_PARENT,
565 static struct clk_regmap s4_12_24M_clk = {
566 .data = &(struct clk_regmap_mux_data){
567 .offset = CLKCTRL_CLK12_24_CTRL,
571 .hw.init = &(struct clk_init_data) {
573 .ops = &clk_regmap_mux_ops,
574 .parent_hws = (const struct clk_hw *[]) {
575 &s4_12_24M_clk_gate.hw,
579 .flags = CLK_SET_RATE_PARENT,
584 static struct clk_regmap s4_vid_pll_div = {
585 .data = &(struct meson_vid_pll_div_data){
587 .reg_off = CLKCTRL_VID_PLL_CLK_DIV,
592 .reg_off = CLKCTRL_VID_PLL_CLK_DIV,
597 .hw.init = &(struct clk_init_data) {
598 .name = "vid_pll_div",
600 * TODO meson_vid_pll_div_ro_ops to meson_vid_pll_div_ops
602 .ops = &meson_vid_pll_div_ro_ops,
603 .parent_data = (const struct clk_parent_data []) {
604 { .fw_name = "hdmi_pll", }
607 .flags = CLK_SET_RATE_PARENT,
611 static struct clk_regmap s4_vid_pll_sel = {
612 .data = &(struct clk_regmap_mux_data){
613 .offset = CLKCTRL_VID_PLL_CLK_DIV,
617 .hw.init = &(struct clk_init_data){
618 .name = "vid_pll_sel",
619 .ops = &clk_regmap_mux_ops,
620 .parent_data = (const struct clk_parent_data []) {
621 { .hw = &s4_vid_pll_div.hw },
622 { .fw_name = "hdmi_pll", }
625 .flags = CLK_SET_RATE_PARENT,
629 static struct clk_regmap s4_vid_pll = {
630 .data = &(struct clk_regmap_gate_data){
631 .offset = CLKCTRL_VID_PLL_CLK_DIV,
634 .hw.init = &(struct clk_init_data) {
636 .ops = &clk_regmap_gate_ops,
637 .parent_hws = (const struct clk_hw *[]) {
641 .flags = CLK_SET_RATE_PARENT,
645 static const struct clk_parent_data s4_vclk_parent_data[] = {
646 { .hw = &s4_vid_pll.hw },
647 { .fw_name = "gp0_pll", },
648 { .fw_name = "hifi_pll", },
649 { .fw_name = "mpll1", },
650 { .fw_name = "fclk_div3", },
651 { .fw_name = "fclk_div4", },
652 { .fw_name = "fclk_div5", },
653 { .fw_name = "fclk_div7", },
656 static struct clk_regmap s4_vclk_sel = {
657 .data = &(struct clk_regmap_mux_data){
658 .offset = CLKCTRL_VID_CLK_CTRL,
662 .hw.init = &(struct clk_init_data){
664 .ops = &clk_regmap_mux_ops,
665 .parent_data = s4_vclk_parent_data,
666 .num_parents = ARRAY_SIZE(s4_vclk_parent_data),
671 static struct clk_regmap s4_vclk2_sel = {
672 .data = &(struct clk_regmap_mux_data){
673 .offset = CLKCTRL_VIID_CLK_CTRL,
677 .hw.init = &(struct clk_init_data){
679 .ops = &clk_regmap_mux_ops,
680 .parent_data = s4_vclk_parent_data,
681 .num_parents = ARRAY_SIZE(s4_vclk_parent_data),
686 static struct clk_regmap s4_vclk_input = {
687 .data = &(struct clk_regmap_gate_data){
688 .offset = CLKCTRL_VID_CLK_DIV,
691 .hw.init = &(struct clk_init_data) {
692 .name = "vclk_input",
693 .ops = &clk_regmap_gate_ops,
694 .parent_hws = (const struct clk_hw *[]) { &s4_vclk_sel.hw },
696 .flags = CLK_SET_RATE_PARENT,
700 static struct clk_regmap s4_vclk2_input = {
701 .data = &(struct clk_regmap_gate_data){
702 .offset = CLKCTRL_VIID_CLK_DIV,
705 .hw.init = &(struct clk_init_data) {
706 .name = "vclk2_input",
707 .ops = &clk_regmap_gate_ops,
708 .parent_hws = (const struct clk_hw *[]) { &s4_vclk2_sel.hw },
710 .flags = CLK_SET_RATE_PARENT,
714 static struct clk_regmap s4_vclk_div = {
715 .data = &(struct clk_regmap_div_data){
716 .offset = CLKCTRL_VID_CLK_DIV,
720 .hw.init = &(struct clk_init_data){
722 .ops = &clk_regmap_divider_ops,
723 .parent_hws = (const struct clk_hw *[]) {
727 .flags = CLK_SET_RATE_PARENT,
731 static struct clk_regmap s4_vclk2_div = {
732 .data = &(struct clk_regmap_div_data){
733 .offset = CLKCTRL_VIID_CLK_DIV,
737 .hw.init = &(struct clk_init_data){
739 .ops = &clk_regmap_divider_ops,
740 .parent_hws = (const struct clk_hw *[]) {
744 .flags = CLK_SET_RATE_PARENT,
748 static struct clk_regmap s4_vclk = {
749 .data = &(struct clk_regmap_gate_data){
750 .offset = CLKCTRL_VID_CLK_CTRL,
753 .hw.init = &(struct clk_init_data) {
755 .ops = &clk_regmap_gate_ops,
756 .parent_hws = (const struct clk_hw *[]) { &s4_vclk_div.hw },
758 .flags = CLK_SET_RATE_PARENT,
762 static struct clk_regmap s4_vclk2 = {
763 .data = &(struct clk_regmap_gate_data){
764 .offset = CLKCTRL_VIID_CLK_CTRL,
767 .hw.init = &(struct clk_init_data) {
769 .ops = &clk_regmap_gate_ops,
770 .parent_hws = (const struct clk_hw *[]) { &s4_vclk2_div.hw },
772 .flags = CLK_SET_RATE_PARENT,
776 static struct clk_regmap s4_vclk_div1 = {
777 .data = &(struct clk_regmap_gate_data){
778 .offset = CLKCTRL_VID_CLK_CTRL,
781 .hw.init = &(struct clk_init_data) {
783 .ops = &clk_regmap_gate_ops,
784 .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw },
786 .flags = CLK_SET_RATE_PARENT,
790 static struct clk_regmap s4_vclk_div2_en = {
791 .data = &(struct clk_regmap_gate_data){
792 .offset = CLKCTRL_VID_CLK_CTRL,
795 .hw.init = &(struct clk_init_data) {
796 .name = "vclk_div2_en",
797 .ops = &clk_regmap_gate_ops,
798 .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw },
800 .flags = CLK_SET_RATE_PARENT,
804 static struct clk_regmap s4_vclk_div4_en = {
805 .data = &(struct clk_regmap_gate_data){
806 .offset = CLKCTRL_VID_CLK_CTRL,
809 .hw.init = &(struct clk_init_data) {
810 .name = "vclk_div4_en",
811 .ops = &clk_regmap_gate_ops,
812 .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw },
814 .flags = CLK_SET_RATE_PARENT,
818 static struct clk_regmap s4_vclk_div6_en = {
819 .data = &(struct clk_regmap_gate_data){
820 .offset = CLKCTRL_VID_CLK_CTRL,
823 .hw.init = &(struct clk_init_data) {
824 .name = "vclk_div6_en",
825 .ops = &clk_regmap_gate_ops,
826 .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw },
828 .flags = CLK_SET_RATE_PARENT,
832 static struct clk_regmap s4_vclk_div12_en = {
833 .data = &(struct clk_regmap_gate_data){
834 .offset = CLKCTRL_VID_CLK_CTRL,
837 .hw.init = &(struct clk_init_data) {
838 .name = "vclk_div12_en",
839 .ops = &clk_regmap_gate_ops,
840 .parent_hws = (const struct clk_hw *[]) { &s4_vclk.hw },
842 .flags = CLK_SET_RATE_PARENT,
846 static struct clk_regmap s4_vclk2_div1 = {
847 .data = &(struct clk_regmap_gate_data){
848 .offset = CLKCTRL_VIID_CLK_CTRL,
851 .hw.init = &(struct clk_init_data) {
852 .name = "vclk2_div1",
853 .ops = &clk_regmap_gate_ops,
854 .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw },
856 .flags = CLK_SET_RATE_PARENT,
860 static struct clk_regmap s4_vclk2_div2_en = {
861 .data = &(struct clk_regmap_gate_data){
862 .offset = CLKCTRL_VIID_CLK_CTRL,
865 .hw.init = &(struct clk_init_data) {
866 .name = "vclk2_div2_en",
867 .ops = &clk_regmap_gate_ops,
868 .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw },
870 .flags = CLK_SET_RATE_PARENT,
874 static struct clk_regmap s4_vclk2_div4_en = {
875 .data = &(struct clk_regmap_gate_data){
876 .offset = CLKCTRL_VIID_CLK_CTRL,
879 .hw.init = &(struct clk_init_data) {
880 .name = "vclk2_div4_en",
881 .ops = &clk_regmap_gate_ops,
882 .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw },
884 .flags = CLK_SET_RATE_PARENT,
888 static struct clk_regmap s4_vclk2_div6_en = {
889 .data = &(struct clk_regmap_gate_data){
890 .offset = CLKCTRL_VIID_CLK_CTRL,
893 .hw.init = &(struct clk_init_data) {
894 .name = "vclk2_div6_en",
895 .ops = &clk_regmap_gate_ops,
896 .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw },
898 .flags = CLK_SET_RATE_PARENT,
902 static struct clk_regmap s4_vclk2_div12_en = {
903 .data = &(struct clk_regmap_gate_data){
904 .offset = CLKCTRL_VIID_CLK_CTRL,
907 .hw.init = &(struct clk_init_data) {
908 .name = "vclk2_div12_en",
909 .ops = &clk_regmap_gate_ops,
910 .parent_hws = (const struct clk_hw *[]) { &s4_vclk2.hw },
912 .flags = CLK_SET_RATE_PARENT,
916 static struct clk_fixed_factor s4_vclk_div2 = {
919 .hw.init = &(struct clk_init_data){
921 .ops = &clk_fixed_factor_ops,
922 .parent_hws = (const struct clk_hw *[]) {
926 .flags = CLK_SET_RATE_PARENT,
930 static struct clk_fixed_factor s4_vclk_div4 = {
933 .hw.init = &(struct clk_init_data){
935 .ops = &clk_fixed_factor_ops,
936 .parent_hws = (const struct clk_hw *[]) {
940 .flags = CLK_SET_RATE_PARENT,
944 static struct clk_fixed_factor s4_vclk_div6 = {
947 .hw.init = &(struct clk_init_data){
949 .ops = &clk_fixed_factor_ops,
950 .parent_hws = (const struct clk_hw *[]) {
954 .flags = CLK_SET_RATE_PARENT,
958 static struct clk_fixed_factor s4_vclk_div12 = {
961 .hw.init = &(struct clk_init_data){
962 .name = "vclk_div12",
963 .ops = &clk_fixed_factor_ops,
964 .parent_hws = (const struct clk_hw *[]) {
968 .flags = CLK_SET_RATE_PARENT,
972 static struct clk_fixed_factor s4_vclk2_div2 = {
975 .hw.init = &(struct clk_init_data){
976 .name = "vclk2_div2",
977 .ops = &clk_fixed_factor_ops,
978 .parent_hws = (const struct clk_hw *[]) {
982 .flags = CLK_SET_RATE_PARENT,
986 static struct clk_fixed_factor s4_vclk2_div4 = {
989 .hw.init = &(struct clk_init_data){
990 .name = "vclk2_div4",
991 .ops = &clk_fixed_factor_ops,
992 .parent_hws = (const struct clk_hw *[]) {
996 .flags = CLK_SET_RATE_PARENT,
1000 static struct clk_fixed_factor s4_vclk2_div6 = {
1003 .hw.init = &(struct clk_init_data){
1004 .name = "vclk2_div6",
1005 .ops = &clk_fixed_factor_ops,
1006 .parent_hws = (const struct clk_hw *[]) {
1007 &s4_vclk2_div6_en.hw
1010 .flags = CLK_SET_RATE_PARENT,
1014 static struct clk_fixed_factor s4_vclk2_div12 = {
1017 .hw.init = &(struct clk_init_data){
1018 .name = "vclk2_div12",
1019 .ops = &clk_fixed_factor_ops,
1020 .parent_hws = (const struct clk_hw *[]) {
1021 &s4_vclk2_div12_en.hw
1024 .flags = CLK_SET_RATE_PARENT,
1028 /* The 5,6,7 indexes corresponds to no real clock, so there are not used. */
1029 static u32 mux_table_cts_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 };
1030 static const struct clk_hw *s4_cts_parent_hws[] = {
1043 static struct clk_regmap s4_cts_enci_sel = {
1044 .data = &(struct clk_regmap_mux_data){
1045 .offset = CLKCTRL_VID_CLK_DIV,
1048 .table = mux_table_cts_sel,
1050 .hw.init = &(struct clk_init_data){
1051 .name = "cts_enci_sel",
1052 .ops = &clk_regmap_mux_ops,
1053 .parent_hws = s4_cts_parent_hws,
1054 .num_parents = ARRAY_SIZE(s4_cts_parent_hws),
1055 .flags = CLK_SET_RATE_PARENT,
1059 static struct clk_regmap s4_cts_encp_sel = {
1060 .data = &(struct clk_regmap_mux_data){
1061 .offset = CLKCTRL_VID_CLK_DIV,
1064 .table = mux_table_cts_sel,
1066 .hw.init = &(struct clk_init_data){
1067 .name = "cts_encp_sel",
1068 .ops = &clk_regmap_mux_ops,
1069 .parent_hws = s4_cts_parent_hws,
1070 .num_parents = ARRAY_SIZE(s4_cts_parent_hws),
1071 .flags = CLK_SET_RATE_PARENT,
1075 static struct clk_regmap s4_cts_vdac_sel = {
1076 .data = &(struct clk_regmap_mux_data){
1077 .offset = CLKCTRL_VIID_CLK_DIV,
1080 .table = mux_table_cts_sel,
1082 .hw.init = &(struct clk_init_data){
1083 .name = "cts_vdac_sel",
1084 .ops = &clk_regmap_mux_ops,
1085 .parent_hws = s4_cts_parent_hws,
1086 .num_parents = ARRAY_SIZE(s4_cts_parent_hws),
1087 .flags = CLK_SET_RATE_PARENT,
1091 /* The 5,6,7 indexes corresponds to no real clock, so there are not used. */
1092 static u32 mux_table_hdmi_tx_sel[] = { 0, 1, 2, 3, 4, 8, 9, 10, 11, 12 };
1093 static const struct clk_hw *s4_cts_hdmi_tx_parent_hws[] = {
1106 static struct clk_regmap s4_hdmi_tx_sel = {
1107 .data = &(struct clk_regmap_mux_data){
1108 .offset = CLKCTRL_HDMI_CLK_CTRL,
1111 .table = mux_table_hdmi_tx_sel,
1113 .hw.init = &(struct clk_init_data){
1114 .name = "hdmi_tx_sel",
1115 .ops = &clk_regmap_mux_ops,
1116 .parent_hws = s4_cts_hdmi_tx_parent_hws,
1117 .num_parents = ARRAY_SIZE(s4_cts_hdmi_tx_parent_hws),
1118 .flags = CLK_SET_RATE_PARENT,
1122 static struct clk_regmap s4_cts_enci = {
1123 .data = &(struct clk_regmap_gate_data){
1124 .offset = CLKCTRL_VID_CLK_CTRL2,
1127 .hw.init = &(struct clk_init_data) {
1129 .ops = &clk_regmap_gate_ops,
1130 .parent_hws = (const struct clk_hw *[]) {
1134 .flags = CLK_SET_RATE_PARENT,
1138 static struct clk_regmap s4_cts_encp = {
1139 .data = &(struct clk_regmap_gate_data){
1140 .offset = CLKCTRL_VID_CLK_CTRL2,
1143 .hw.init = &(struct clk_init_data) {
1145 .ops = &clk_regmap_gate_ops,
1146 .parent_hws = (const struct clk_hw *[]) {
1150 .flags = CLK_SET_RATE_PARENT,
1154 static struct clk_regmap s4_cts_vdac = {
1155 .data = &(struct clk_regmap_gate_data){
1156 .offset = CLKCTRL_VID_CLK_CTRL2,
1159 .hw.init = &(struct clk_init_data) {
1161 .ops = &clk_regmap_gate_ops,
1162 .parent_hws = (const struct clk_hw *[]) {
1166 .flags = CLK_SET_RATE_PARENT,
1170 static struct clk_regmap s4_hdmi_tx = {
1171 .data = &(struct clk_regmap_gate_data){
1172 .offset = CLKCTRL_VID_CLK_CTRL2,
1175 .hw.init = &(struct clk_init_data) {
1177 .ops = &clk_regmap_gate_ops,
1178 .parent_hws = (const struct clk_hw *[]) {
1182 .flags = CLK_SET_RATE_PARENT,
1187 static const struct clk_parent_data s4_hdmi_parent_data[] = {
1188 { .fw_name = "xtal", },
1189 { .fw_name = "fclk_div4", },
1190 { .fw_name = "fclk_div3", },
1191 { .fw_name = "fclk_div5", }
1194 static struct clk_regmap s4_hdmi_sel = {
1195 .data = &(struct clk_regmap_mux_data){
1196 .offset = CLKCTRL_HDMI_CLK_CTRL,
1199 .flags = CLK_MUX_ROUND_CLOSEST,
1201 .hw.init = &(struct clk_init_data){
1203 .ops = &clk_regmap_mux_ops,
1204 .parent_data = s4_hdmi_parent_data,
1205 .num_parents = ARRAY_SIZE(s4_hdmi_parent_data),
1206 .flags = CLK_SET_RATE_PARENT,
1210 static struct clk_regmap s4_hdmi_div = {
1211 .data = &(struct clk_regmap_div_data){
1212 .offset = CLKCTRL_HDMI_CLK_CTRL,
1216 .hw.init = &(struct clk_init_data){
1218 .ops = &clk_regmap_divider_ops,
1219 .parent_hws = (const struct clk_hw *[]) { &s4_hdmi_sel.hw },
1221 .flags = CLK_SET_RATE_PARENT,
1225 static struct clk_regmap s4_hdmi = {
1226 .data = &(struct clk_regmap_gate_data){
1227 .offset = CLKCTRL_HDMI_CLK_CTRL,
1230 .hw.init = &(struct clk_init_data) {
1232 .ops = &clk_regmap_gate_ops,
1233 .parent_hws = (const struct clk_hw *[]) { &s4_hdmi_div.hw },
1235 .flags = CLK_SET_RATE_PARENT,
1239 static struct clk_regmap s4_ts_clk_div = {
1240 .data = &(struct clk_regmap_div_data){
1241 .offset = CLKCTRL_TS_CLK_CTRL,
1245 .hw.init = &(struct clk_init_data){
1246 .name = "ts_clk_div",
1247 .ops = &clk_regmap_divider_ops,
1248 .parent_data = &(const struct clk_parent_data) {
1252 .flags = CLK_SET_RATE_PARENT,
1256 static struct clk_regmap s4_ts_clk_gate = {
1257 .data = &(struct clk_regmap_gate_data){
1258 .offset = CLKCTRL_TS_CLK_CTRL,
1261 .hw.init = &(struct clk_init_data){
1263 .ops = &clk_regmap_gate_ops,
1264 .parent_hws = (const struct clk_hw *[]) {
1268 .flags = CLK_SET_RATE_PARENT,
1273 * The MALI IP is clocked by two identical clocks (mali_0 and mali_1)
1274 * muxed by a glitch-free switch. The CCF can manage this glitch-free
1275 * mux because it does top-to-bottom updates the each clock tree and
1276 * switches to the "inactive" one when CLK_SET_RATE_GATE is set.
1278 static const struct clk_parent_data s4_mali_0_1_parent_data[] = {
1279 { .fw_name = "xtal", },
1280 { .fw_name = "gp0_pll", },
1281 { .fw_name = "hifi_pll", },
1282 { .fw_name = "fclk_div2p5", },
1283 { .fw_name = "fclk_div3", },
1284 { .fw_name = "fclk_div4", },
1285 { .fw_name = "fclk_div5", },
1286 { .fw_name = "fclk_div7", }
1289 static struct clk_regmap s4_mali_0_sel = {
1290 .data = &(struct clk_regmap_mux_data){
1291 .offset = CLKCTRL_MALI_CLK_CTRL,
1295 .hw.init = &(struct clk_init_data){
1296 .name = "mali_0_sel",
1297 .ops = &clk_regmap_mux_ops,
1298 .parent_data = s4_mali_0_1_parent_data,
1299 .num_parents = ARRAY_SIZE(s4_mali_0_1_parent_data),
1301 * Don't request the parent to change the rate because
1302 * all GPU frequencies can be derived from the fclk_*
1303 * clocks and one special GP0_PLL setting. This is
1304 * important because we need the HIFI PLL clock for audio.
1310 static struct clk_regmap s4_mali_0_div = {
1311 .data = &(struct clk_regmap_div_data){
1312 .offset = CLKCTRL_MALI_CLK_CTRL,
1316 .hw.init = &(struct clk_init_data){
1317 .name = "mali_0_div",
1318 .ops = &clk_regmap_divider_ops,
1319 .parent_hws = (const struct clk_hw *[]) {
1323 .flags = CLK_SET_RATE_PARENT,
1327 static struct clk_regmap s4_mali_0 = {
1328 .data = &(struct clk_regmap_gate_data){
1329 .offset = CLKCTRL_MALI_CLK_CTRL,
1332 .hw.init = &(struct clk_init_data){
1334 .ops = &clk_regmap_gate_ops,
1335 .parent_hws = (const struct clk_hw *[]) {
1339 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
1343 static struct clk_regmap s4_mali_1_sel = {
1344 .data = &(struct clk_regmap_mux_data){
1345 .offset = CLKCTRL_MALI_CLK_CTRL,
1349 .hw.init = &(struct clk_init_data){
1350 .name = "mali_1_sel",
1351 .ops = &clk_regmap_mux_ops,
1352 .parent_data = s4_mali_0_1_parent_data,
1353 .num_parents = ARRAY_SIZE(s4_mali_0_1_parent_data),
1358 static struct clk_regmap s4_mali_1_div = {
1359 .data = &(struct clk_regmap_div_data){
1360 .offset = CLKCTRL_MALI_CLK_CTRL,
1364 .hw.init = &(struct clk_init_data){
1365 .name = "mali_1_div",
1366 .ops = &clk_regmap_divider_ops,
1367 .parent_hws = (const struct clk_hw *[]) {
1371 .flags = CLK_SET_RATE_PARENT,
1375 static struct clk_regmap s4_mali_1 = {
1376 .data = &(struct clk_regmap_gate_data){
1377 .offset = CLKCTRL_MALI_CLK_CTRL,
1380 .hw.init = &(struct clk_init_data){
1382 .ops = &clk_regmap_gate_ops,
1383 .parent_hws = (const struct clk_hw *[]) {
1387 .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
1391 static const struct clk_hw *s4_mali_parent_hws[] = {
1396 static struct clk_regmap s4_mali_mux = {
1397 .data = &(struct clk_regmap_mux_data){
1398 .offset = CLKCTRL_MALI_CLK_CTRL,
1402 .hw.init = &(struct clk_init_data){
1404 .ops = &clk_regmap_mux_ops,
1405 .parent_hws = s4_mali_parent_hws,
1407 .flags = CLK_SET_RATE_PARENT,
1412 static const struct clk_parent_data s4_dec_parent_data[] = {
1413 { .fw_name = "fclk_div2p5", },
1414 { .fw_name = "fclk_div3", },
1415 { .fw_name = "fclk_div4", },
1416 { .fw_name = "fclk_div5", },
1417 { .fw_name = "fclk_div7", },
1418 { .fw_name = "hifi_pll", },
1419 { .fw_name = "gp0_pll", },
1420 { .fw_name = "xtal", }
1423 static struct clk_regmap s4_vdec_p0_mux = {
1424 .data = &(struct clk_regmap_mux_data){
1425 .offset = CLKCTRL_VDEC_CLK_CTRL,
1428 .flags = CLK_MUX_ROUND_CLOSEST,
1430 .hw.init = &(struct clk_init_data) {
1431 .name = "vdec_p0_mux",
1432 .ops = &clk_regmap_mux_ops,
1433 .parent_data = s4_dec_parent_data,
1434 .num_parents = ARRAY_SIZE(s4_dec_parent_data),
1439 static struct clk_regmap s4_vdec_p0_div = {
1440 .data = &(struct clk_regmap_div_data){
1441 .offset = CLKCTRL_VDEC_CLK_CTRL,
1444 .flags = CLK_DIVIDER_ROUND_CLOSEST,
1446 .hw.init = &(struct clk_init_data) {
1447 .name = "vdec_p0_div",
1448 .ops = &clk_regmap_divider_ops,
1449 .parent_hws = (const struct clk_hw *[]) {
1453 .flags = CLK_SET_RATE_PARENT,
1457 static struct clk_regmap s4_vdec_p0 = {
1458 .data = &(struct clk_regmap_gate_data){
1459 .offset = CLKCTRL_VDEC_CLK_CTRL,
1462 .hw.init = &(struct clk_init_data){
1464 .ops = &clk_regmap_gate_ops,
1465 .parent_hws = (const struct clk_hw *[]) {
1469 .flags = CLK_SET_RATE_PARENT,
1473 static struct clk_regmap s4_vdec_p1_mux = {
1474 .data = &(struct clk_regmap_mux_data){
1475 .offset = CLKCTRL_VDEC3_CLK_CTRL,
1478 .flags = CLK_MUX_ROUND_CLOSEST,
1480 .hw.init = &(struct clk_init_data) {
1481 .name = "vdec_p1_mux",
1482 .ops = &clk_regmap_mux_ops,
1483 .parent_data = s4_dec_parent_data,
1484 .num_parents = ARRAY_SIZE(s4_dec_parent_data),
1489 static struct clk_regmap s4_vdec_p1_div = {
1490 .data = &(struct clk_regmap_div_data){
1491 .offset = CLKCTRL_VDEC3_CLK_CTRL,
1494 .flags = CLK_DIVIDER_ROUND_CLOSEST,
1496 .hw.init = &(struct clk_init_data) {
1497 .name = "vdec_p1_div",
1498 .ops = &clk_regmap_divider_ops,
1499 .parent_hws = (const struct clk_hw *[]) {
1503 .flags = CLK_SET_RATE_PARENT,
1507 static struct clk_regmap s4_vdec_p1 = {
1508 .data = &(struct clk_regmap_gate_data){
1509 .offset = CLKCTRL_VDEC3_CLK_CTRL,
1512 .hw.init = &(struct clk_init_data){
1514 .ops = &clk_regmap_gate_ops,
1515 .parent_hws = (const struct clk_hw *[]) {
1519 .flags = CLK_SET_RATE_PARENT,
1523 static const struct clk_hw *s4_vdec_mux_parent_hws[] = {
1528 static struct clk_regmap s4_vdec_mux = {
1529 .data = &(struct clk_regmap_mux_data){
1530 .offset = CLKCTRL_VDEC3_CLK_CTRL,
1534 .hw.init = &(struct clk_init_data) {
1536 .ops = &clk_regmap_mux_ops,
1537 .parent_hws = s4_vdec_mux_parent_hws,
1538 .num_parents = ARRAY_SIZE(s4_vdec_mux_parent_hws),
1539 .flags = CLK_SET_RATE_PARENT,
1543 static struct clk_regmap s4_hevcf_p0_mux = {
1544 .data = &(struct clk_regmap_mux_data){
1545 .offset = CLKCTRL_VDEC2_CLK_CTRL,
1548 .flags = CLK_MUX_ROUND_CLOSEST,
1550 .hw.init = &(struct clk_init_data) {
1551 .name = "hevcf_p0_mux",
1552 .ops = &clk_regmap_mux_ops,
1553 .parent_data = s4_dec_parent_data,
1554 .num_parents = ARRAY_SIZE(s4_dec_parent_data),
1559 static struct clk_regmap s4_hevcf_p0_div = {
1560 .data = &(struct clk_regmap_div_data){
1561 .offset = CLKCTRL_VDEC2_CLK_CTRL,
1564 .flags = CLK_DIVIDER_ROUND_CLOSEST,
1566 .hw.init = &(struct clk_init_data) {
1567 .name = "hevcf_p0_div",
1568 .ops = &clk_regmap_divider_ops,
1569 .parent_hws = (const struct clk_hw *[]) {
1573 .flags = CLK_SET_RATE_PARENT,
1577 static struct clk_regmap s4_hevcf_p0 = {
1578 .data = &(struct clk_regmap_gate_data){
1579 .offset = CLKCTRL_VDEC2_CLK_CTRL,
1582 .hw.init = &(struct clk_init_data){
1583 .name = "hevcf_p0_gate",
1584 .ops = &clk_regmap_gate_ops,
1585 .parent_hws = (const struct clk_hw *[]) {
1589 .flags = CLK_SET_RATE_PARENT,
1593 static struct clk_regmap s4_hevcf_p1_mux = {
1594 .data = &(struct clk_regmap_mux_data){
1595 .offset = CLKCTRL_VDEC4_CLK_CTRL,
1598 .flags = CLK_MUX_ROUND_CLOSEST,
1600 .hw.init = &(struct clk_init_data) {
1601 .name = "hevcf_p1_mux",
1602 .ops = &clk_regmap_mux_ops,
1603 .parent_data = s4_dec_parent_data,
1604 .num_parents = ARRAY_SIZE(s4_dec_parent_data),
1609 static struct clk_regmap s4_hevcf_p1_div = {
1610 .data = &(struct clk_regmap_div_data){
1611 .offset = CLKCTRL_VDEC4_CLK_CTRL,
1614 .flags = CLK_DIVIDER_ROUND_CLOSEST,
1616 .hw.init = &(struct clk_init_data) {
1617 .name = "hevcf_p1_div",
1618 .ops = &clk_regmap_divider_ops,
1619 .parent_hws = (const struct clk_hw *[]) {
1623 .flags = CLK_SET_RATE_PARENT,
1627 static struct clk_regmap s4_hevcf_p1 = {
1628 .data = &(struct clk_regmap_gate_data){
1629 .offset = CLKCTRL_VDEC4_CLK_CTRL,
1632 .hw.init = &(struct clk_init_data){
1634 .ops = &clk_regmap_gate_ops,
1635 .parent_hws = (const struct clk_hw *[]) {
1639 .flags = CLK_SET_RATE_PARENT,
1643 static const struct clk_hw *s4_hevcf_mux_parent_hws[] = {
1648 static struct clk_regmap s4_hevcf_mux = {
1649 .data = &(struct clk_regmap_mux_data){
1650 .offset = CLKCTRL_VDEC4_CLK_CTRL,
1654 .hw.init = &(struct clk_init_data) {
1656 .ops = &clk_regmap_mux_ops,
1657 .parent_hws = s4_hevcf_mux_parent_hws,
1658 .num_parents = ARRAY_SIZE(s4_hevcf_mux_parent_hws),
1659 .flags = CLK_SET_RATE_PARENT,
1664 static const struct clk_parent_data s4_vpu_parent_data[] = {
1665 { .fw_name = "fclk_div3", },
1666 { .fw_name = "fclk_div4", },
1667 { .fw_name = "fclk_div5", },
1668 { .fw_name = "fclk_div7", },
1669 { .fw_name = "mpll1", },
1670 { .hw = &s4_vid_pll.hw },
1671 { .fw_name = "hifi_pll", },
1672 { .fw_name = "gp0_pll", },
1675 static struct clk_regmap s4_vpu_0_sel = {
1676 .data = &(struct clk_regmap_mux_data){
1677 .offset = CLKCTRL_VPU_CLK_CTRL,
1681 .hw.init = &(struct clk_init_data){
1682 .name = "vpu_0_sel",
1683 .ops = &clk_regmap_mux_ops,
1684 .parent_data = s4_vpu_parent_data,
1685 .num_parents = ARRAY_SIZE(s4_vpu_parent_data),
1690 static struct clk_regmap s4_vpu_0_div = {
1691 .data = &(struct clk_regmap_div_data){
1692 .offset = CLKCTRL_VPU_CLK_CTRL,
1696 .hw.init = &(struct clk_init_data){
1697 .name = "vpu_0_div",
1698 .ops = &clk_regmap_divider_ops,
1699 .parent_hws = (const struct clk_hw *[]) { &s4_vpu_0_sel.hw },
1701 .flags = CLK_SET_RATE_PARENT,
1705 static struct clk_regmap s4_vpu_0 = {
1706 .data = &(struct clk_regmap_gate_data){
1707 .offset = CLKCTRL_VPU_CLK_CTRL,
1710 .hw.init = &(struct clk_init_data) {
1712 .ops = &clk_regmap_gate_ops,
1713 .parent_hws = (const struct clk_hw *[]) { &s4_vpu_0_div.hw },
1715 .flags = CLK_SET_RATE_PARENT,
1719 static struct clk_regmap s4_vpu_1_sel = {
1720 .data = &(struct clk_regmap_mux_data){
1721 .offset = CLKCTRL_VPU_CLK_CTRL,
1725 .hw.init = &(struct clk_init_data){
1726 .name = "vpu_1_sel",
1727 .ops = &clk_regmap_mux_ops,
1728 .parent_data = s4_vpu_parent_data,
1729 .num_parents = ARRAY_SIZE(s4_vpu_parent_data),
1734 static struct clk_regmap s4_vpu_1_div = {
1735 .data = &(struct clk_regmap_div_data){
1736 .offset = CLKCTRL_VPU_CLK_CTRL,
1740 .hw.init = &(struct clk_init_data){
1741 .name = "vpu_1_div",
1742 .ops = &clk_regmap_divider_ops,
1743 .parent_hws = (const struct clk_hw *[]) { &s4_vpu_1_sel.hw },
1745 .flags = CLK_SET_RATE_PARENT,
1749 static struct clk_regmap s4_vpu_1 = {
1750 .data = &(struct clk_regmap_gate_data){
1751 .offset = CLKCTRL_VPU_CLK_CTRL,
1754 .hw.init = &(struct clk_init_data) {
1756 .ops = &clk_regmap_gate_ops,
1757 .parent_hws = (const struct clk_hw *[]) { &s4_vpu_1_div.hw },
1759 .flags = CLK_SET_RATE_PARENT,
1763 static struct clk_regmap s4_vpu = {
1764 .data = &(struct clk_regmap_mux_data){
1765 .offset = CLKCTRL_VPU_CLK_CTRL,
1769 .hw.init = &(struct clk_init_data){
1771 .ops = &clk_regmap_mux_ops,
1772 .parent_hws = (const struct clk_hw *[]) {
1777 .flags = CLK_SET_RATE_PARENT,
1781 static const struct clk_parent_data vpu_clkb_tmp_parent_data[] = {
1782 { .hw = &s4_vpu.hw },
1783 { .fw_name = "fclk_div4", },
1784 { .fw_name = "fclk_div5", },
1785 { .fw_name = "fclk_div7", }
1788 static struct clk_regmap s4_vpu_clkb_tmp_mux = {
1789 .data = &(struct clk_regmap_mux_data){
1790 .offset = CLKCTRL_VPU_CLKB_CTRL,
1794 .hw.init = &(struct clk_init_data) {
1795 .name = "vpu_clkb_tmp_mux",
1796 .ops = &clk_regmap_mux_ops,
1797 .parent_data = vpu_clkb_tmp_parent_data,
1798 .num_parents = ARRAY_SIZE(vpu_clkb_tmp_parent_data),
1799 .flags = CLK_SET_RATE_PARENT,
1803 static struct clk_regmap s4_vpu_clkb_tmp_div = {
1804 .data = &(struct clk_regmap_div_data){
1805 .offset = CLKCTRL_VPU_CLKB_CTRL,
1809 .hw.init = &(struct clk_init_data) {
1810 .name = "vpu_clkb_tmp_div",
1811 .ops = &clk_regmap_divider_ops,
1812 .parent_hws = (const struct clk_hw *[]) {
1813 &s4_vpu_clkb_tmp_mux.hw
1816 .flags = CLK_SET_RATE_PARENT,
1820 static struct clk_regmap s4_vpu_clkb_tmp = {
1821 .data = &(struct clk_regmap_gate_data){
1822 .offset = CLKCTRL_VPU_CLKB_CTRL,
1825 .hw.init = &(struct clk_init_data){
1826 .name = "vpu_clkb_tmp",
1827 .ops = &clk_regmap_gate_ops,
1828 .parent_hws = (const struct clk_hw *[]) {
1829 &s4_vpu_clkb_tmp_div.hw
1832 .flags = CLK_SET_RATE_PARENT,
1836 static struct clk_regmap s4_vpu_clkb_div = {
1837 .data = &(struct clk_regmap_div_data){
1838 .offset = CLKCTRL_VPU_CLKB_CTRL,
1842 .hw.init = &(struct clk_init_data) {
1843 .name = "vpu_clkb_div",
1844 .ops = &clk_regmap_divider_ops,
1845 .parent_hws = (const struct clk_hw *[]) {
1849 .flags = CLK_SET_RATE_PARENT,
1853 static struct clk_regmap s4_vpu_clkb = {
1854 .data = &(struct clk_regmap_gate_data){
1855 .offset = CLKCTRL_VPU_CLKB_CTRL,
1858 .hw.init = &(struct clk_init_data){
1860 .ops = &clk_regmap_gate_ops,
1861 .parent_hws = (const struct clk_hw *[]) {
1865 .flags = CLK_SET_RATE_PARENT,
1869 static const struct clk_parent_data s4_vpu_clkc_parent_data[] = {
1870 { .fw_name = "fclk_div4", },
1871 { .fw_name = "fclk_div3", },
1872 { .fw_name = "fclk_div5", },
1873 { .fw_name = "fclk_div7", },
1874 { .fw_name = "mpll1", },
1875 { .hw = &s4_vid_pll.hw },
1876 { .fw_name = "mpll2", },
1877 { .fw_name = "gp0_pll", },
1880 static struct clk_regmap s4_vpu_clkc_p0_mux = {
1881 .data = &(struct clk_regmap_mux_data){
1882 .offset = CLKCTRL_VPU_CLKC_CTRL,
1886 .hw.init = &(struct clk_init_data) {
1887 .name = "vpu_clkc_p0_mux",
1888 .ops = &clk_regmap_mux_ops,
1889 .parent_data = s4_vpu_clkc_parent_data,
1890 .num_parents = ARRAY_SIZE(s4_vpu_clkc_parent_data),
1895 static struct clk_regmap s4_vpu_clkc_p0_div = {
1896 .data = &(struct clk_regmap_div_data){
1897 .offset = CLKCTRL_VPU_CLKC_CTRL,
1901 .hw.init = &(struct clk_init_data) {
1902 .name = "vpu_clkc_p0_div",
1903 .ops = &clk_regmap_divider_ops,
1904 .parent_hws = (const struct clk_hw *[]) {
1905 &s4_vpu_clkc_p0_mux.hw
1908 .flags = CLK_SET_RATE_PARENT,
1912 static struct clk_regmap s4_vpu_clkc_p0 = {
1913 .data = &(struct clk_regmap_gate_data){
1914 .offset = CLKCTRL_VPU_CLKC_CTRL,
1917 .hw.init = &(struct clk_init_data){
1918 .name = "vpu_clkc_p0",
1919 .ops = &clk_regmap_gate_ops,
1920 .parent_hws = (const struct clk_hw *[]) {
1921 &s4_vpu_clkc_p0_div.hw
1924 .flags = CLK_SET_RATE_PARENT,
1928 static struct clk_regmap s4_vpu_clkc_p1_mux = {
1929 .data = &(struct clk_regmap_mux_data){
1930 .offset = CLKCTRL_VPU_CLKC_CTRL,
1934 .hw.init = &(struct clk_init_data) {
1935 .name = "vpu_clkc_p1_mux",
1936 .ops = &clk_regmap_mux_ops,
1937 .parent_data = s4_vpu_clkc_parent_data,
1938 .num_parents = ARRAY_SIZE(s4_vpu_clkc_parent_data),
1943 static struct clk_regmap s4_vpu_clkc_p1_div = {
1944 .data = &(struct clk_regmap_div_data){
1945 .offset = CLKCTRL_VPU_CLKC_CTRL,
1949 .hw.init = &(struct clk_init_data) {
1950 .name = "vpu_clkc_p1_div",
1951 .ops = &clk_regmap_divider_ops,
1952 .parent_hws = (const struct clk_hw *[]) {
1953 &s4_vpu_clkc_p1_mux.hw
1956 .flags = CLK_SET_RATE_PARENT,
1960 static struct clk_regmap s4_vpu_clkc_p1 = {
1961 .data = &(struct clk_regmap_gate_data){
1962 .offset = CLKCTRL_VPU_CLKC_CTRL,
1965 .hw.init = &(struct clk_init_data){
1966 .name = "vpu_clkc_p1",
1967 .ops = &clk_regmap_gate_ops,
1968 .parent_hws = (const struct clk_hw *[]) {
1969 &s4_vpu_clkc_p1_div.hw
1972 .flags = CLK_SET_RATE_PARENT,
1976 static const struct clk_hw *s4_vpu_mux_parent_hws[] = {
1981 static struct clk_regmap s4_vpu_clkc_mux = {
1982 .data = &(struct clk_regmap_mux_data){
1983 .offset = CLKCTRL_VPU_CLKC_CTRL,
1987 .hw.init = &(struct clk_init_data) {
1988 .name = "vpu_clkc_mux",
1989 .ops = &clk_regmap_mux_ops,
1990 .parent_hws = s4_vpu_mux_parent_hws,
1991 .num_parents = ARRAY_SIZE(s4_vpu_mux_parent_hws),
1992 .flags = CLK_SET_RATE_PARENT,
1997 static const struct clk_parent_data s4_vapb_parent_data[] = {
1998 { .fw_name = "fclk_div4", },
1999 { .fw_name = "fclk_div3", },
2000 { .fw_name = "fclk_div5", },
2001 { .fw_name = "fclk_div7", },
2002 { .fw_name = "mpll1", },
2003 { .hw = &s4_vid_pll.hw },
2004 { .fw_name = "mpll2", },
2005 { .fw_name = "fclk_div2p5", },
2008 static struct clk_regmap s4_vapb_0_sel = {
2009 .data = &(struct clk_regmap_mux_data){
2010 .offset = CLKCTRL_VAPBCLK_CTRL,
2014 .hw.init = &(struct clk_init_data){
2015 .name = "vapb_0_sel",
2016 .ops = &clk_regmap_mux_ops,
2017 .parent_data = s4_vapb_parent_data,
2018 .num_parents = ARRAY_SIZE(s4_vapb_parent_data),
2023 static struct clk_regmap s4_vapb_0_div = {
2024 .data = &(struct clk_regmap_div_data){
2025 .offset = CLKCTRL_VAPBCLK_CTRL,
2029 .hw.init = &(struct clk_init_data){
2030 .name = "vapb_0_div",
2031 .ops = &clk_regmap_divider_ops,
2032 .parent_hws = (const struct clk_hw *[]) {
2036 .flags = CLK_SET_RATE_PARENT,
2040 static struct clk_regmap s4_vapb_0 = {
2041 .data = &(struct clk_regmap_gate_data){
2042 .offset = CLKCTRL_VAPBCLK_CTRL,
2045 .hw.init = &(struct clk_init_data) {
2047 .ops = &clk_regmap_gate_ops,
2048 .parent_hws = (const struct clk_hw *[]) {
2052 .flags = CLK_SET_RATE_PARENT,
2056 static struct clk_regmap s4_vapb_1_sel = {
2057 .data = &(struct clk_regmap_mux_data){
2058 .offset = CLKCTRL_VAPBCLK_CTRL,
2062 .hw.init = &(struct clk_init_data){
2063 .name = "vapb_1_sel",
2064 .ops = &clk_regmap_mux_ops,
2065 .parent_data = s4_vapb_parent_data,
2066 .num_parents = ARRAY_SIZE(s4_vapb_parent_data),
2071 static struct clk_regmap s4_vapb_1_div = {
2072 .data = &(struct clk_regmap_div_data){
2073 .offset = CLKCTRL_VAPBCLK_CTRL,
2077 .hw.init = &(struct clk_init_data){
2078 .name = "vapb_1_div",
2079 .ops = &clk_regmap_divider_ops,
2080 .parent_hws = (const struct clk_hw *[]) {
2084 .flags = CLK_SET_RATE_PARENT,
2088 static struct clk_regmap s4_vapb_1 = {
2089 .data = &(struct clk_regmap_gate_data){
2090 .offset = CLKCTRL_VAPBCLK_CTRL,
2093 .hw.init = &(struct clk_init_data) {
2095 .ops = &clk_regmap_gate_ops,
2096 .parent_hws = (const struct clk_hw *[]) {
2100 .flags = CLK_SET_RATE_PARENT,
2104 static struct clk_regmap s4_vapb = {
2105 .data = &(struct clk_regmap_mux_data){
2106 .offset = CLKCTRL_VAPBCLK_CTRL,
2110 .hw.init = &(struct clk_init_data){
2112 .ops = &clk_regmap_mux_ops,
2113 .parent_hws = (const struct clk_hw *[]) {
2118 .flags = CLK_SET_RATE_PARENT,
2122 static struct clk_regmap s4_ge2d_gate = {
2123 .data = &(struct clk_regmap_gate_data){
2124 .offset = CLKCTRL_VAPBCLK_CTRL,
2127 .hw.init = &(struct clk_init_data) {
2129 .ops = &clk_regmap_gate_ops,
2130 .parent_hws = (const struct clk_hw *[]) { &s4_vapb.hw },
2132 .flags = CLK_SET_RATE_PARENT,
2136 static const struct clk_parent_data s4_esmclk_parent_data[] = {
2137 { .fw_name = "fclk_div7", },
2138 { .fw_name = "fclk_div4", },
2139 { .fw_name = "fclk_div3", },
2140 { .fw_name = "fclk_div5", },
2143 static struct clk_regmap s4_hdcp22_esmclk_mux = {
2144 .data = &(struct clk_regmap_mux_data){
2145 .offset = CLKCTRL_HDCP22_CTRL,
2149 .hw.init = &(struct clk_init_data) {
2150 .name = "hdcp22_esmclk_mux",
2151 .ops = &clk_regmap_mux_ops,
2152 .parent_data = s4_esmclk_parent_data,
2153 .num_parents = ARRAY_SIZE(s4_esmclk_parent_data),
2154 .flags = CLK_SET_RATE_PARENT,
2158 static struct clk_regmap s4_hdcp22_esmclk_div = {
2159 .data = &(struct clk_regmap_div_data){
2160 .offset = CLKCTRL_HDCP22_CTRL,
2164 .hw.init = &(struct clk_init_data) {
2165 .name = "hdcp22_esmclk_div",
2166 .ops = &clk_regmap_divider_ops,
2167 .parent_hws = (const struct clk_hw *[]) {
2168 &s4_hdcp22_esmclk_mux.hw
2171 .flags = CLK_SET_RATE_PARENT,
2175 static struct clk_regmap s4_hdcp22_esmclk_gate = {
2176 .data = &(struct clk_regmap_gate_data){
2177 .offset = CLKCTRL_HDCP22_CTRL,
2180 .hw.init = &(struct clk_init_data){
2181 .name = "hdcp22_esmclk_gate",
2182 .ops = &clk_regmap_gate_ops,
2183 .parent_hws = (const struct clk_hw *[]) {
2184 &s4_hdcp22_esmclk_div.hw
2187 .flags = CLK_SET_RATE_PARENT,
2191 static const struct clk_parent_data s4_skpclk_parent_data[] = {
2192 { .fw_name = "xtal", },
2193 { .fw_name = "fclk_div4", },
2194 { .fw_name = "fclk_div3", },
2195 { .fw_name = "fclk_div5", },
2198 static struct clk_regmap s4_hdcp22_skpclk_mux = {
2199 .data = &(struct clk_regmap_mux_data){
2200 .offset = CLKCTRL_HDCP22_CTRL,
2204 .hw.init = &(struct clk_init_data) {
2205 .name = "hdcp22_skpclk_mux",
2206 .ops = &clk_regmap_mux_ops,
2207 .parent_data = s4_skpclk_parent_data,
2208 .num_parents = ARRAY_SIZE(s4_skpclk_parent_data),
2209 .flags = CLK_SET_RATE_PARENT,
2213 static struct clk_regmap s4_hdcp22_skpclk_div = {
2214 .data = &(struct clk_regmap_div_data){
2215 .offset = CLKCTRL_HDCP22_CTRL,
2219 .hw.init = &(struct clk_init_data) {
2220 .name = "hdcp22_skpclk_div",
2221 .ops = &clk_regmap_divider_ops,
2222 .parent_hws = (const struct clk_hw *[]) {
2223 &s4_hdcp22_skpclk_mux.hw
2226 .flags = CLK_SET_RATE_PARENT,
2230 static struct clk_regmap s4_hdcp22_skpclk_gate = {
2231 .data = &(struct clk_regmap_gate_data){
2232 .offset = CLKCTRL_HDCP22_CTRL,
2235 .hw.init = &(struct clk_init_data){
2236 .name = "hdcp22_skpclk_gate",
2237 .ops = &clk_regmap_gate_ops,
2238 .parent_hws = (const struct clk_hw *[]) {
2239 &s4_hdcp22_skpclk_div.hw
2242 .flags = CLK_SET_RATE_PARENT,
2246 static const struct clk_parent_data s4_vdin_parent_data[] = {
2247 { .fw_name = "xtal", },
2248 { .fw_name = "fclk_div4", },
2249 { .fw_name = "fclk_div3", },
2250 { .fw_name = "fclk_div5", },
2251 { .hw = &s4_vid_pll.hw }
2254 static struct clk_regmap s4_vdin_meas_mux = {
2255 .data = &(struct clk_regmap_mux_data){
2256 .offset = CLKCTRL_VDIN_MEAS_CLK_CTRL,
2260 .hw.init = &(struct clk_init_data) {
2261 .name = "vdin_meas_mux",
2262 .ops = &clk_regmap_mux_ops,
2263 .parent_data = s4_vdin_parent_data,
2264 .num_parents = ARRAY_SIZE(s4_vdin_parent_data),
2265 .flags = CLK_SET_RATE_PARENT,
2269 static struct clk_regmap s4_vdin_meas_div = {
2270 .data = &(struct clk_regmap_div_data){
2271 .offset = CLKCTRL_VDIN_MEAS_CLK_CTRL,
2275 .hw.init = &(struct clk_init_data) {
2276 .name = "vdin_meas_div",
2277 .ops = &clk_regmap_divider_ops,
2278 .parent_hws = (const struct clk_hw *[]) {
2279 &s4_vdin_meas_mux.hw
2282 .flags = CLK_SET_RATE_PARENT,
2286 static struct clk_regmap s4_vdin_meas_gate = {
2287 .data = &(struct clk_regmap_gate_data){
2288 .offset = CLKCTRL_VDIN_MEAS_CLK_CTRL,
2291 .hw.init = &(struct clk_init_data){
2292 .name = "vdin_meas_gate",
2293 .ops = &clk_regmap_gate_ops,
2294 .parent_hws = (const struct clk_hw *[]) {
2295 &s4_vdin_meas_div.hw
2298 .flags = CLK_SET_RATE_PARENT,
2302 /* EMMC/NAND clock */
2303 static const struct clk_parent_data s4_sd_emmc_clk0_parent_data[] = {
2304 { .fw_name = "xtal", },
2305 { .fw_name = "fclk_div2", },
2306 { .fw_name = "fclk_div3", },
2307 { .fw_name = "hifi_pll", },
2308 { .fw_name = "fclk_div2p5", },
2309 { .fw_name = "mpll2", },
2310 { .fw_name = "mpll3", },
2311 { .fw_name = "gp0_pll", },
2314 static struct clk_regmap s4_sd_emmc_c_clk0_sel = {
2315 .data = &(struct clk_regmap_mux_data){
2316 .offset = CLKCTRL_NAND_CLK_CTRL,
2320 .hw.init = &(struct clk_init_data) {
2321 .name = "sd_emmc_c_clk0_sel",
2322 .ops = &clk_regmap_mux_ops,
2323 .parent_data = s4_sd_emmc_clk0_parent_data,
2324 .num_parents = ARRAY_SIZE(s4_sd_emmc_clk0_parent_data),
2329 static struct clk_regmap s4_sd_emmc_c_clk0_div = {
2330 .data = &(struct clk_regmap_div_data){
2331 .offset = CLKCTRL_NAND_CLK_CTRL,
2335 .hw.init = &(struct clk_init_data) {
2336 .name = "sd_emmc_c_clk0_div",
2337 .ops = &clk_regmap_divider_ops,
2338 .parent_hws = (const struct clk_hw *[]) {
2339 &s4_sd_emmc_c_clk0_sel.hw
2342 .flags = CLK_SET_RATE_PARENT,
2346 static struct clk_regmap s4_sd_emmc_c_clk0 = {
2347 .data = &(struct clk_regmap_gate_data){
2348 .offset = CLKCTRL_NAND_CLK_CTRL,
2351 .hw.init = &(struct clk_init_data){
2352 .name = "sd_emmc_c_clk0",
2353 .ops = &clk_regmap_gate_ops,
2354 .parent_hws = (const struct clk_hw *[]) {
2355 &s4_sd_emmc_c_clk0_div.hw
2358 .flags = CLK_SET_RATE_PARENT,
2362 static struct clk_regmap s4_sd_emmc_a_clk0_sel = {
2363 .data = &(struct clk_regmap_mux_data){
2364 .offset = CLKCTRL_SD_EMMC_CLK_CTRL,
2368 .hw.init = &(struct clk_init_data) {
2369 .name = "sd_emmc_a_clk0_sel",
2370 .ops = &clk_regmap_mux_ops,
2371 .parent_data = s4_sd_emmc_clk0_parent_data,
2372 .num_parents = ARRAY_SIZE(s4_sd_emmc_clk0_parent_data),
2377 static struct clk_regmap s4_sd_emmc_a_clk0_div = {
2378 .data = &(struct clk_regmap_div_data){
2379 .offset = CLKCTRL_SD_EMMC_CLK_CTRL,
2383 .hw.init = &(struct clk_init_data) {
2384 .name = "sd_emmc_a_clk0_div",
2385 .ops = &clk_regmap_divider_ops,
2386 .parent_hws = (const struct clk_hw *[]) {
2387 &s4_sd_emmc_a_clk0_sel.hw
2390 .flags = CLK_SET_RATE_PARENT,
2394 static struct clk_regmap s4_sd_emmc_a_clk0 = {
2395 .data = &(struct clk_regmap_gate_data){
2396 .offset = CLKCTRL_SD_EMMC_CLK_CTRL,
2399 .hw.init = &(struct clk_init_data){
2400 .name = "sd_emmc_a_clk0",
2401 .ops = &clk_regmap_gate_ops,
2402 .parent_hws = (const struct clk_hw *[]) {
2403 &s4_sd_emmc_a_clk0_div.hw
2406 .flags = CLK_SET_RATE_PARENT,
2410 static struct clk_regmap s4_sd_emmc_b_clk0_sel = {
2411 .data = &(struct clk_regmap_mux_data){
2412 .offset = CLKCTRL_SD_EMMC_CLK_CTRL,
2416 .hw.init = &(struct clk_init_data) {
2417 .name = "sd_emmc_b_clk0_sel",
2418 .ops = &clk_regmap_mux_ops,
2419 .parent_data = s4_sd_emmc_clk0_parent_data,
2420 .num_parents = ARRAY_SIZE(s4_sd_emmc_clk0_parent_data),
2425 static struct clk_regmap s4_sd_emmc_b_clk0_div = {
2426 .data = &(struct clk_regmap_div_data){
2427 .offset = CLKCTRL_SD_EMMC_CLK_CTRL,
2431 .hw.init = &(struct clk_init_data) {
2432 .name = "sd_emmc_b_clk0_div",
2433 .ops = &clk_regmap_divider_ops,
2434 .parent_hws = (const struct clk_hw *[]) {
2435 &s4_sd_emmc_b_clk0_sel.hw
2438 .flags = CLK_SET_RATE_PARENT,
2442 static struct clk_regmap s4_sd_emmc_b_clk0 = {
2443 .data = &(struct clk_regmap_gate_data){
2444 .offset = CLKCTRL_SD_EMMC_CLK_CTRL,
2447 .hw.init = &(struct clk_init_data){
2448 .name = "sd_emmc_b_clk0",
2449 .ops = &clk_regmap_gate_ops,
2450 .parent_hws = (const struct clk_hw *[]) {
2451 &s4_sd_emmc_b_clk0_div.hw
2454 .flags = CLK_SET_RATE_PARENT,
2459 static const struct clk_parent_data s4_spicc_parent_data[] = {
2460 { .fw_name = "xtal", },
2461 { .hw = &s4_sys_clk.hw },
2462 { .fw_name = "fclk_div4", },
2463 { .fw_name = "fclk_div3", },
2464 { .fw_name = "fclk_div2", },
2465 { .fw_name = "fclk_div5", },
2466 { .fw_name = "fclk_div7", },
2469 static struct clk_regmap s4_spicc0_mux = {
2470 .data = &(struct clk_regmap_mux_data){
2471 .offset = CLKCTRL_SPICC_CLK_CTRL,
2475 .hw.init = &(struct clk_init_data) {
2476 .name = "spicc0_mux",
2477 .ops = &clk_regmap_mux_ops,
2478 .parent_data = s4_spicc_parent_data,
2479 .num_parents = ARRAY_SIZE(s4_spicc_parent_data),
2480 .flags = CLK_SET_RATE_PARENT,
2484 static struct clk_regmap s4_spicc0_div = {
2485 .data = &(struct clk_regmap_div_data){
2486 .offset = CLKCTRL_SPICC_CLK_CTRL,
2490 .hw.init = &(struct clk_init_data) {
2491 .name = "spicc0_div",
2492 .ops = &clk_regmap_divider_ops,
2493 .parent_hws = (const struct clk_hw *[]) {
2497 .flags = CLK_SET_RATE_PARENT,
2501 static struct clk_regmap s4_spicc0_gate = {
2502 .data = &(struct clk_regmap_gate_data){
2503 .offset = CLKCTRL_SPICC_CLK_CTRL,
2506 .hw.init = &(struct clk_init_data){
2508 .ops = &clk_regmap_gate_ops,
2509 .parent_hws = (const struct clk_hw *[]) {
2513 .flags = CLK_SET_RATE_PARENT,
2518 static const struct clk_parent_data s4_pwm_parent_data[] = {
2519 { .fw_name = "xtal", },
2520 { .hw = &s4_vid_pll.hw },
2521 { .fw_name = "fclk_div4", },
2522 { .fw_name = "fclk_div3", },
2525 static struct clk_regmap s4_pwm_a_mux = {
2526 .data = &(struct clk_regmap_mux_data) {
2527 .offset = CLKCTRL_PWM_CLK_AB_CTRL,
2531 .hw.init = &(struct clk_init_data){
2532 .name = "pwm_a_mux",
2533 .ops = &clk_regmap_mux_ops,
2534 .parent_data = s4_pwm_parent_data,
2535 .num_parents = ARRAY_SIZE(s4_pwm_parent_data),
2540 static struct clk_regmap s4_pwm_a_div = {
2541 .data = &(struct clk_regmap_div_data) {
2542 .offset = CLKCTRL_PWM_CLK_AB_CTRL,
2546 .hw.init = &(struct clk_init_data){
2547 .name = "pwm_a_div",
2548 .ops = &clk_regmap_divider_ops,
2549 .parent_hws = (const struct clk_hw *[]) {
2553 .flags = CLK_SET_RATE_PARENT,
2557 static struct clk_regmap s4_pwm_a_gate = {
2558 .data = &(struct clk_regmap_gate_data) {
2559 .offset = CLKCTRL_PWM_CLK_AB_CTRL,
2562 .hw.init = &(struct clk_init_data){
2563 .name = "pwm_a_gate",
2564 .ops = &clk_regmap_gate_ops,
2565 .parent_hws = (const struct clk_hw *[]) {
2569 .flags = CLK_SET_RATE_PARENT,
2573 static struct clk_regmap s4_pwm_b_mux = {
2574 .data = &(struct clk_regmap_mux_data) {
2575 .offset = CLKCTRL_PWM_CLK_AB_CTRL,
2579 .hw.init = &(struct clk_init_data){
2580 .name = "pwm_b_mux",
2581 .ops = &clk_regmap_mux_ops,
2582 .parent_data = s4_pwm_parent_data,
2583 .num_parents = ARRAY_SIZE(s4_pwm_parent_data),
2588 static struct clk_regmap s4_pwm_b_div = {
2589 .data = &(struct clk_regmap_div_data) {
2590 .offset = CLKCTRL_PWM_CLK_AB_CTRL,
2594 .hw.init = &(struct clk_init_data){
2595 .name = "pwm_b_div",
2596 .ops = &clk_regmap_divider_ops,
2597 .parent_hws = (const struct clk_hw *[]) {
2601 .flags = CLK_SET_RATE_PARENT,
2605 static struct clk_regmap s4_pwm_b_gate = {
2606 .data = &(struct clk_regmap_gate_data) {
2607 .offset = CLKCTRL_PWM_CLK_AB_CTRL,
2610 .hw.init = &(struct clk_init_data){
2611 .name = "pwm_b_gate",
2612 .ops = &clk_regmap_gate_ops,
2613 .parent_hws = (const struct clk_hw *[]) {
2617 .flags = CLK_SET_RATE_PARENT,
2621 static struct clk_regmap s4_pwm_c_mux = {
2622 .data = &(struct clk_regmap_mux_data) {
2623 .offset = CLKCTRL_PWM_CLK_CD_CTRL,
2627 .hw.init = &(struct clk_init_data){
2628 .name = "pwm_c_mux",
2629 .ops = &clk_regmap_mux_ops,
2630 .parent_data = s4_pwm_parent_data,
2631 .num_parents = ARRAY_SIZE(s4_pwm_parent_data),
2636 static struct clk_regmap s4_pwm_c_div = {
2637 .data = &(struct clk_regmap_div_data) {
2638 .offset = CLKCTRL_PWM_CLK_CD_CTRL,
2642 .hw.init = &(struct clk_init_data){
2643 .name = "pwm_c_div",
2644 .ops = &clk_regmap_divider_ops,
2645 .parent_hws = (const struct clk_hw *[]) {
2652 static struct clk_regmap s4_pwm_c_gate = {
2653 .data = &(struct clk_regmap_gate_data) {
2654 .offset = CLKCTRL_PWM_CLK_CD_CTRL,
2657 .hw.init = &(struct clk_init_data){
2658 .name = "pwm_c_gate",
2659 .ops = &clk_regmap_gate_ops,
2660 .parent_hws = (const struct clk_hw *[]) {
2664 .flags = CLK_SET_RATE_PARENT,
2668 static struct clk_regmap s4_pwm_d_mux = {
2669 .data = &(struct clk_regmap_mux_data) {
2670 .offset = CLKCTRL_PWM_CLK_CD_CTRL,
2674 .hw.init = &(struct clk_init_data){
2675 .name = "pwm_d_mux",
2676 .ops = &clk_regmap_mux_ops,
2677 .parent_data = s4_pwm_parent_data,
2678 .num_parents = ARRAY_SIZE(s4_pwm_parent_data),
2683 static struct clk_regmap s4_pwm_d_div = {
2684 .data = &(struct clk_regmap_div_data) {
2685 .offset = CLKCTRL_PWM_CLK_CD_CTRL,
2689 .hw.init = &(struct clk_init_data){
2690 .name = "pwm_d_div",
2691 .ops = &clk_regmap_divider_ops,
2692 .parent_hws = (const struct clk_hw *[]) {
2696 .flags = CLK_SET_RATE_PARENT,
2700 static struct clk_regmap s4_pwm_d_gate = {
2701 .data = &(struct clk_regmap_gate_data) {
2702 .offset = CLKCTRL_PWM_CLK_CD_CTRL,
2705 .hw.init = &(struct clk_init_data){
2706 .name = "pwm_d_gate",
2707 .ops = &clk_regmap_gate_ops,
2708 .parent_hws = (const struct clk_hw *[]) {
2712 .flags = CLK_SET_RATE_PARENT,
2716 static struct clk_regmap s4_pwm_e_mux = {
2717 .data = &(struct clk_regmap_mux_data) {
2718 .offset = CLKCTRL_PWM_CLK_EF_CTRL,
2722 .hw.init = &(struct clk_init_data){
2723 .name = "pwm_e_mux",
2724 .ops = &clk_regmap_mux_ops,
2725 .parent_data = s4_pwm_parent_data,
2726 .num_parents = ARRAY_SIZE(s4_pwm_parent_data),
2731 static struct clk_regmap s4_pwm_e_div = {
2732 .data = &(struct clk_regmap_div_data) {
2733 .offset = CLKCTRL_PWM_CLK_EF_CTRL,
2737 .hw.init = &(struct clk_init_data){
2738 .name = "pwm_e_div",
2739 .ops = &clk_regmap_divider_ops,
2740 .parent_hws = (const struct clk_hw *[]) {
2744 .flags = CLK_SET_RATE_PARENT,
2748 static struct clk_regmap s4_pwm_e_gate = {
2749 .data = &(struct clk_regmap_gate_data) {
2750 .offset = CLKCTRL_PWM_CLK_EF_CTRL,
2753 .hw.init = &(struct clk_init_data){
2754 .name = "pwm_e_gate",
2755 .ops = &clk_regmap_gate_ops,
2756 .parent_hws = (const struct clk_hw *[]) {
2760 .flags = CLK_SET_RATE_PARENT,
2764 static struct clk_regmap s4_pwm_f_mux = {
2765 .data = &(struct clk_regmap_mux_data) {
2766 .offset = CLKCTRL_PWM_CLK_EF_CTRL,
2770 .hw.init = &(struct clk_init_data){
2771 .name = "pwm_f_mux",
2772 .ops = &clk_regmap_mux_ops,
2773 .parent_data = s4_pwm_parent_data,
2774 .num_parents = ARRAY_SIZE(s4_pwm_parent_data),
2779 static struct clk_regmap s4_pwm_f_div = {
2780 .data = &(struct clk_regmap_div_data) {
2781 .offset = CLKCTRL_PWM_CLK_EF_CTRL,
2785 .hw.init = &(struct clk_init_data){
2786 .name = "pwm_f_div",
2787 .ops = &clk_regmap_divider_ops,
2788 .parent_hws = (const struct clk_hw *[]) {
2792 .flags = CLK_SET_RATE_PARENT,
2796 static struct clk_regmap s4_pwm_f_gate = {
2797 .data = &(struct clk_regmap_gate_data) {
2798 .offset = CLKCTRL_PWM_CLK_EF_CTRL,
2801 .hw.init = &(struct clk_init_data){
2802 .name = "pwm_f_gate",
2803 .ops = &clk_regmap_gate_ops,
2804 .parent_hws = (const struct clk_hw *[]) {
2808 .flags = CLK_SET_RATE_PARENT,
2812 static struct clk_regmap s4_pwm_g_mux = {
2813 .data = &(struct clk_regmap_mux_data) {
2814 .offset = CLKCTRL_PWM_CLK_GH_CTRL,
2818 .hw.init = &(struct clk_init_data){
2819 .name = "pwm_g_mux",
2820 .ops = &clk_regmap_mux_ops,
2821 .parent_data = s4_pwm_parent_data,
2822 .num_parents = ARRAY_SIZE(s4_pwm_parent_data),
2827 static struct clk_regmap s4_pwm_g_div = {
2828 .data = &(struct clk_regmap_div_data) {
2829 .offset = CLKCTRL_PWM_CLK_GH_CTRL,
2833 .hw.init = &(struct clk_init_data){
2834 .name = "pwm_g_div",
2835 .ops = &clk_regmap_divider_ops,
2836 .parent_hws = (const struct clk_hw *[]) {
2840 .flags = CLK_SET_RATE_PARENT,
2844 static struct clk_regmap s4_pwm_g_gate = {
2845 .data = &(struct clk_regmap_gate_data) {
2846 .offset = CLKCTRL_PWM_CLK_GH_CTRL,
2849 .hw.init = &(struct clk_init_data){
2850 .name = "pwm_g_gate",
2851 .ops = &clk_regmap_gate_ops,
2852 .parent_hws = (const struct clk_hw *[]) {
2856 .flags = CLK_SET_RATE_PARENT,
2860 static struct clk_regmap s4_pwm_h_mux = {
2861 .data = &(struct clk_regmap_mux_data) {
2862 .offset = CLKCTRL_PWM_CLK_GH_CTRL,
2866 .hw.init = &(struct clk_init_data){
2867 .name = "pwm_h_mux",
2868 .ops = &clk_regmap_mux_ops,
2869 .parent_data = s4_pwm_parent_data,
2870 .num_parents = ARRAY_SIZE(s4_pwm_parent_data),
2875 static struct clk_regmap s4_pwm_h_div = {
2876 .data = &(struct clk_regmap_div_data) {
2877 .offset = CLKCTRL_PWM_CLK_GH_CTRL,
2881 .hw.init = &(struct clk_init_data){
2882 .name = "pwm_h_div",
2883 .ops = &clk_regmap_divider_ops,
2884 .parent_hws = (const struct clk_hw *[]) {
2888 .flags = CLK_SET_RATE_PARENT,
2892 static struct clk_regmap s4_pwm_h_gate = {
2893 .data = &(struct clk_regmap_gate_data) {
2894 .offset = CLKCTRL_PWM_CLK_GH_CTRL,
2897 .hw.init = &(struct clk_init_data){
2898 .name = "pwm_h_gate",
2899 .ops = &clk_regmap_gate_ops,
2900 .parent_hws = (const struct clk_hw *[]) {
2904 .flags = CLK_SET_RATE_PARENT,
2908 static struct clk_regmap s4_pwm_i_mux = {
2909 .data = &(struct clk_regmap_mux_data) {
2910 .offset = CLKCTRL_PWM_CLK_IJ_CTRL,
2914 .hw.init = &(struct clk_init_data){
2915 .name = "pwm_i_mux",
2916 .ops = &clk_regmap_mux_ops,
2917 .parent_data = s4_pwm_parent_data,
2918 .num_parents = ARRAY_SIZE(s4_pwm_parent_data),
2923 static struct clk_regmap s4_pwm_i_div = {
2924 .data = &(struct clk_regmap_div_data) {
2925 .offset = CLKCTRL_PWM_CLK_IJ_CTRL,
2929 .hw.init = &(struct clk_init_data){
2930 .name = "pwm_i_div",
2931 .ops = &clk_regmap_divider_ops,
2932 .parent_hws = (const struct clk_hw *[]) {
2936 .flags = CLK_SET_RATE_PARENT,
2940 static struct clk_regmap s4_pwm_i_gate = {
2941 .data = &(struct clk_regmap_gate_data) {
2942 .offset = CLKCTRL_PWM_CLK_IJ_CTRL,
2945 .hw.init = &(struct clk_init_data){
2946 .name = "pwm_i_gate",
2947 .ops = &clk_regmap_gate_ops,
2948 .parent_hws = (const struct clk_hw *[]) {
2952 .flags = CLK_SET_RATE_PARENT,
2956 static struct clk_regmap s4_pwm_j_mux = {
2957 .data = &(struct clk_regmap_mux_data) {
2958 .offset = CLKCTRL_PWM_CLK_IJ_CTRL,
2962 .hw.init = &(struct clk_init_data){
2963 .name = "pwm_j_mux",
2964 .ops = &clk_regmap_mux_ops,
2965 .parent_data = s4_pwm_parent_data,
2966 .num_parents = ARRAY_SIZE(s4_pwm_parent_data),
2971 static struct clk_regmap s4_pwm_j_div = {
2972 .data = &(struct clk_regmap_div_data) {
2973 .offset = CLKCTRL_PWM_CLK_IJ_CTRL,
2977 .hw.init = &(struct clk_init_data){
2978 .name = "pwm_j_div",
2979 .ops = &clk_regmap_divider_ops,
2980 .parent_hws = (const struct clk_hw *[]) {
2984 .flags = CLK_SET_RATE_PARENT,
2988 static struct clk_regmap s4_pwm_j_gate = {
2989 .data = &(struct clk_regmap_gate_data) {
2990 .offset = CLKCTRL_PWM_CLK_IJ_CTRL,
2993 .hw.init = &(struct clk_init_data){
2994 .name = "pwm_j_gate",
2995 .ops = &clk_regmap_gate_ops,
2996 .parent_hws = (const struct clk_hw *[]) {
3000 .flags = CLK_SET_RATE_PARENT,
3004 static struct clk_regmap s4_saradc_mux = {
3005 .data = &(struct clk_regmap_mux_data) {
3006 .offset = CLKCTRL_SAR_CLK_CTRL,
3010 .hw.init = &(struct clk_init_data){
3011 .name = "saradc_mux",
3012 .ops = &clk_regmap_mux_ops,
3013 .parent_data = (const struct clk_parent_data []) {
3014 { .fw_name = "xtal", },
3015 { .hw = &s4_sys_clk.hw },
3018 .flags = CLK_SET_RATE_PARENT,
3022 static struct clk_regmap s4_saradc_div = {
3023 .data = &(struct clk_regmap_div_data) {
3024 .offset = CLKCTRL_SAR_CLK_CTRL,
3028 .hw.init = &(struct clk_init_data){
3029 .name = "saradc_div",
3030 .ops = &clk_regmap_divider_ops,
3031 .parent_hws = (const struct clk_hw *[]) {
3035 .flags = CLK_SET_RATE_PARENT,
3039 static struct clk_regmap s4_saradc_gate = {
3040 .data = &(struct clk_regmap_gate_data) {
3041 .offset = CLKCTRL_SAR_CLK_CTRL,
3044 .hw.init = &(struct clk_init_data){
3045 .name = "saradc_clk",
3046 .ops = &clk_regmap_gate_ops,
3047 .parent_hws = (const struct clk_hw *[]) {
3051 .flags = CLK_SET_RATE_PARENT,
3056 * gen clk is designed for debug/monitor some internal clock quality. Some of the
3057 * corresponding clock sources are not described in the clock tree and internal clock
3058 * for debug, so they are skipped.
3060 static u32 s4_gen_clk_mux_table[] = { 0, 4, 5, 7, 19, 21, 22,
3061 23, 24, 25, 26, 27, 28 };
3062 static const struct clk_parent_data s4_gen_clk_parent_data[] = {
3063 { .fw_name = "xtal", },
3064 { .hw = &s4_vid_pll.hw },
3065 { .fw_name = "gp0_pll", },
3066 { .fw_name = "hifi_pll", },
3067 { .fw_name = "fclk_div2", },
3068 { .fw_name = "fclk_div3", },
3069 { .fw_name = "fclk_div4", },
3070 { .fw_name = "fclk_div5", },
3071 { .fw_name = "fclk_div7", },
3072 { .fw_name = "mpll0", },
3073 { .fw_name = "mpll1", },
3074 { .fw_name = "mpll2", },
3075 { .fw_name = "mpll3", },
3078 static struct clk_regmap s4_gen_clk_sel = {
3079 .data = &(struct clk_regmap_mux_data){
3080 .offset = CLKCTRL_GEN_CLK_CTRL,
3083 .table = s4_gen_clk_mux_table,
3085 .hw.init = &(struct clk_init_data){
3086 .name = "gen_clk_sel",
3087 .ops = &clk_regmap_mux_ops,
3088 .parent_data = s4_gen_clk_parent_data,
3089 .num_parents = ARRAY_SIZE(s4_gen_clk_parent_data),
3091 * Because the GEN clock can be connected to an external pad
3092 * and may be set up directly from the device tree. Don't
3093 * really want to automatically reparent.
3095 .flags = CLK_SET_RATE_NO_REPARENT,
3099 static struct clk_regmap s4_gen_clk_div = {
3100 .data = &(struct clk_regmap_div_data){
3101 .offset = CLKCTRL_GEN_CLK_CTRL,
3105 .hw.init = &(struct clk_init_data){
3106 .name = "gen_clk_div",
3107 .ops = &clk_regmap_divider_ops,
3108 .parent_hws = (const struct clk_hw *[]) {
3112 .flags = CLK_SET_RATE_PARENT,
3116 static struct clk_regmap s4_gen_clk = {
3117 .data = &(struct clk_regmap_gate_data){
3118 .offset = CLKCTRL_GEN_CLK_CTRL,
3121 .hw.init = &(struct clk_init_data) {
3123 .ops = &clk_regmap_gate_ops,
3124 .parent_hws = (const struct clk_hw *[]) {
3128 .flags = CLK_SET_RATE_PARENT,
3132 static const struct clk_parent_data s4_adc_extclk_in_parent_data[] = {
3133 { .fw_name = "xtal", },
3134 { .fw_name = "fclk_div4", },
3135 { .fw_name = "fclk_div3", },
3136 { .fw_name = "fclk_div5", },
3137 { .fw_name = "fclk_div7", },
3138 { .fw_name = "mpll2", },
3139 { .fw_name = "gp0_pll", },
3140 { .fw_name = "hifi_pll", },
3143 static struct clk_regmap s4_adc_extclk_in_mux = {
3144 .data = &(struct clk_regmap_mux_data) {
3145 .offset = CLKCTRL_DEMOD_CLK_CTRL,
3149 .hw.init = &(struct clk_init_data){
3150 .name = "adc_extclk_in_mux",
3151 .ops = &clk_regmap_mux_ops,
3152 .parent_data = s4_adc_extclk_in_parent_data,
3153 .num_parents = ARRAY_SIZE(s4_adc_extclk_in_parent_data),
3158 static struct clk_regmap s4_adc_extclk_in_div = {
3159 .data = &(struct clk_regmap_div_data) {
3160 .offset = CLKCTRL_DEMOD_CLK_CTRL,
3164 .hw.init = &(struct clk_init_data){
3165 .name = "adc_extclk_in_div",
3166 .ops = &clk_regmap_divider_ops,
3167 .parent_hws = (const struct clk_hw *[]) {
3168 &s4_adc_extclk_in_mux.hw
3171 .flags = CLK_SET_RATE_PARENT,
3175 static struct clk_regmap s4_adc_extclk_in_gate = {
3176 .data = &(struct clk_regmap_gate_data) {
3177 .offset = CLKCTRL_DEMOD_CLK_CTRL,
3180 .hw.init = &(struct clk_init_data){
3181 .name = "adc_extclk_in",
3182 .ops = &clk_regmap_gate_ops,
3183 .parent_hws = (const struct clk_hw *[]) {
3184 &s4_adc_extclk_in_div.hw
3187 .flags = CLK_SET_RATE_PARENT,
3191 static struct clk_regmap s4_demod_core_clk_mux = {
3192 .data = &(struct clk_regmap_mux_data) {
3193 .offset = CLKCTRL_DEMOD_CLK_CTRL,
3197 .hw.init = &(struct clk_init_data){
3198 .name = "demod_core_clk_mux",
3199 .ops = &clk_regmap_mux_ops,
3200 .parent_data = (const struct clk_parent_data []) {
3201 { .fw_name = "xtal", },
3202 { .fw_name = "fclk_div7", },
3203 { .fw_name = "fclk_div4", },
3204 { .hw = &s4_adc_extclk_in_gate.hw }
3207 .flags = CLK_SET_RATE_PARENT,
3211 static struct clk_regmap s4_demod_core_clk_div = {
3212 .data = &(struct clk_regmap_div_data) {
3213 .offset = CLKCTRL_DEMOD_CLK_CTRL,
3217 .hw.init = &(struct clk_init_data){
3218 .name = "demod_core_clk_div",
3219 .ops = &clk_regmap_divider_ops,
3220 .parent_hws = (const struct clk_hw *[]) {
3221 &s4_demod_core_clk_mux.hw
3224 .flags = CLK_SET_RATE_PARENT,
3228 static struct clk_regmap s4_demod_core_clk_gate = {
3229 .data = &(struct clk_regmap_gate_data) {
3230 .offset = CLKCTRL_DEMOD_CLK_CTRL,
3233 .hw.init = &(struct clk_init_data){
3234 .name = "demod_core_clk",
3235 .ops = &clk_regmap_gate_ops,
3236 .parent_hws = (const struct clk_hw *[]) {
3237 &s4_demod_core_clk_div.hw
3240 .flags = CLK_SET_RATE_PARENT,
3244 #define MESON_GATE(_name, _reg, _bit) \
3245 MESON_PCLK(_name, _reg, _bit, &s4_sys_clk.hw)
3247 static MESON_GATE(s4_ddr, CLKCTRL_SYS_CLK_EN0_REG0, 0);
3248 static MESON_GATE(s4_dos, CLKCTRL_SYS_CLK_EN0_REG0, 1);
3249 static MESON_GATE(s4_ethphy, CLKCTRL_SYS_CLK_EN0_REG0, 4);
3250 static MESON_GATE(s4_mali, CLKCTRL_SYS_CLK_EN0_REG0, 6);
3251 static MESON_GATE(s4_aocpu, CLKCTRL_SYS_CLK_EN0_REG0, 13);
3252 static MESON_GATE(s4_aucpu, CLKCTRL_SYS_CLK_EN0_REG0, 14);
3253 static MESON_GATE(s4_cec, CLKCTRL_SYS_CLK_EN0_REG0, 16);
3254 static MESON_GATE(s4_sdemmca, CLKCTRL_SYS_CLK_EN0_REG0, 24);
3255 static MESON_GATE(s4_sdemmcb, CLKCTRL_SYS_CLK_EN0_REG0, 25);
3256 static MESON_GATE(s4_nand, CLKCTRL_SYS_CLK_EN0_REG0, 26);
3257 static MESON_GATE(s4_smartcard, CLKCTRL_SYS_CLK_EN0_REG0, 27);
3258 static MESON_GATE(s4_acodec, CLKCTRL_SYS_CLK_EN0_REG0, 28);
3259 static MESON_GATE(s4_spifc, CLKCTRL_SYS_CLK_EN0_REG0, 29);
3260 static MESON_GATE(s4_msr_clk, CLKCTRL_SYS_CLK_EN0_REG0, 30);
3261 static MESON_GATE(s4_ir_ctrl, CLKCTRL_SYS_CLK_EN0_REG0, 31);
3262 static MESON_GATE(s4_audio, CLKCTRL_SYS_CLK_EN0_REG1, 0);
3263 static MESON_GATE(s4_eth, CLKCTRL_SYS_CLK_EN0_REG1, 3);
3264 static MESON_GATE(s4_uart_a, CLKCTRL_SYS_CLK_EN0_REG1, 5);
3265 static MESON_GATE(s4_uart_b, CLKCTRL_SYS_CLK_EN0_REG1, 6);
3266 static MESON_GATE(s4_uart_c, CLKCTRL_SYS_CLK_EN0_REG1, 7);
3267 static MESON_GATE(s4_uart_d, CLKCTRL_SYS_CLK_EN0_REG1, 8);
3268 static MESON_GATE(s4_uart_e, CLKCTRL_SYS_CLK_EN0_REG1, 9);
3269 static MESON_GATE(s4_aififo, CLKCTRL_SYS_CLK_EN0_REG1, 11);
3270 static MESON_GATE(s4_ts_ddr, CLKCTRL_SYS_CLK_EN0_REG1, 15);
3271 static MESON_GATE(s4_ts_pll, CLKCTRL_SYS_CLK_EN0_REG1, 16);
3272 static MESON_GATE(s4_g2d, CLKCTRL_SYS_CLK_EN0_REG1, 20);
3273 static MESON_GATE(s4_spicc0, CLKCTRL_SYS_CLK_EN0_REG1, 21);
3274 static MESON_GATE(s4_usb, CLKCTRL_SYS_CLK_EN0_REG1, 26);
3275 static MESON_GATE(s4_i2c_m_a, CLKCTRL_SYS_CLK_EN0_REG1, 30);
3276 static MESON_GATE(s4_i2c_m_b, CLKCTRL_SYS_CLK_EN0_REG1, 31);
3277 static MESON_GATE(s4_i2c_m_c, CLKCTRL_SYS_CLK_EN0_REG2, 0);
3278 static MESON_GATE(s4_i2c_m_d, CLKCTRL_SYS_CLK_EN0_REG2, 1);
3279 static MESON_GATE(s4_i2c_m_e, CLKCTRL_SYS_CLK_EN0_REG2, 2);
3280 static MESON_GATE(s4_hdmitx_apb, CLKCTRL_SYS_CLK_EN0_REG2, 4);
3281 static MESON_GATE(s4_i2c_s_a, CLKCTRL_SYS_CLK_EN0_REG2, 5);
3282 static MESON_GATE(s4_usb1_to_ddr, CLKCTRL_SYS_CLK_EN0_REG2, 8);
3283 static MESON_GATE(s4_hdcp22, CLKCTRL_SYS_CLK_EN0_REG2, 10);
3284 static MESON_GATE(s4_mmc_apb, CLKCTRL_SYS_CLK_EN0_REG2, 11);
3285 static MESON_GATE(s4_rsa, CLKCTRL_SYS_CLK_EN0_REG2, 18);
3286 static MESON_GATE(s4_cpu_debug, CLKCTRL_SYS_CLK_EN0_REG2, 19);
3287 static MESON_GATE(s4_vpu_intr, CLKCTRL_SYS_CLK_EN0_REG2, 25);
3288 static MESON_GATE(s4_demod, CLKCTRL_SYS_CLK_EN0_REG2, 27);
3289 static MESON_GATE(s4_sar_adc, CLKCTRL_SYS_CLK_EN0_REG2, 28);
3290 static MESON_GATE(s4_gic, CLKCTRL_SYS_CLK_EN0_REG2, 30);
3291 static MESON_GATE(s4_pwm_ab, CLKCTRL_SYS_CLK_EN0_REG3, 7);
3292 static MESON_GATE(s4_pwm_cd, CLKCTRL_SYS_CLK_EN0_REG3, 8);
3293 static MESON_GATE(s4_pwm_ef, CLKCTRL_SYS_CLK_EN0_REG3, 9);
3294 static MESON_GATE(s4_pwm_gh, CLKCTRL_SYS_CLK_EN0_REG3, 10);
3295 static MESON_GATE(s4_pwm_ij, CLKCTRL_SYS_CLK_EN0_REG3, 11);
3297 /* Array of all clocks provided by this provider */
3298 static struct clk_hw *s4_periphs_hw_clks[] = {
3299 [CLKID_RTC_32K_CLKIN] = &s4_rtc_32k_by_oscin_clkin.hw,
3300 [CLKID_RTC_32K_DIV] = &s4_rtc_32k_by_oscin_div.hw,
3301 [CLKID_RTC_32K_SEL] = &s4_rtc_32k_by_oscin_sel.hw,
3302 [CLKID_RTC_32K_XATL] = &s4_rtc_32k_by_oscin.hw,
3303 [CLKID_RTC] = &s4_rtc_clk.hw,
3304 [CLKID_SYS_CLK_B_SEL] = &s4_sysclk_b_sel.hw,
3305 [CLKID_SYS_CLK_B_DIV] = &s4_sysclk_b_div.hw,
3306 [CLKID_SYS_CLK_B] = &s4_sysclk_b.hw,
3307 [CLKID_SYS_CLK_A_SEL] = &s4_sysclk_a_sel.hw,
3308 [CLKID_SYS_CLK_A_DIV] = &s4_sysclk_a_div.hw,
3309 [CLKID_SYS_CLK_A] = &s4_sysclk_a.hw,
3310 [CLKID_SYS] = &s4_sys_clk.hw,
3311 [CLKID_CECA_32K_CLKIN] = &s4_ceca_32k_clkin.hw,
3312 [CLKID_CECA_32K_DIV] = &s4_ceca_32k_div.hw,
3313 [CLKID_CECA_32K_SEL_PRE] = &s4_ceca_32k_sel_pre.hw,
3314 [CLKID_CECA_32K_SEL] = &s4_ceca_32k_sel.hw,
3315 [CLKID_CECA_32K_CLKOUT] = &s4_ceca_32k_clkout.hw,
3316 [CLKID_CECB_32K_CLKIN] = &s4_cecb_32k_clkin.hw,
3317 [CLKID_CECB_32K_DIV] = &s4_cecb_32k_div.hw,
3318 [CLKID_CECB_32K_SEL_PRE] = &s4_cecb_32k_sel_pre.hw,
3319 [CLKID_CECB_32K_SEL] = &s4_cecb_32k_sel.hw,
3320 [CLKID_CECB_32K_CLKOUT] = &s4_cecb_32k_clkout.hw,
3321 [CLKID_SC_CLK_SEL] = &s4_sc_clk_mux.hw,
3322 [CLKID_SC_CLK_DIV] = &s4_sc_clk_div.hw,
3323 [CLKID_SC] = &s4_sc_clk_gate.hw,
3324 [CLKID_12_24M] = &s4_12_24M_clk_gate.hw,
3325 [CLKID_12M_CLK_DIV] = &s4_12M_clk_div.hw,
3326 [CLKID_12_24M_CLK_SEL] = &s4_12_24M_clk.hw,
3327 [CLKID_VID_PLL_DIV] = &s4_vid_pll_div.hw,
3328 [CLKID_VID_PLL_SEL] = &s4_vid_pll_sel.hw,
3329 [CLKID_VID_PLL] = &s4_vid_pll.hw,
3330 [CLKID_VCLK_SEL] = &s4_vclk_sel.hw,
3331 [CLKID_VCLK2_SEL] = &s4_vclk2_sel.hw,
3332 [CLKID_VCLK_INPUT] = &s4_vclk_input.hw,
3333 [CLKID_VCLK2_INPUT] = &s4_vclk2_input.hw,
3334 [CLKID_VCLK_DIV] = &s4_vclk_div.hw,
3335 [CLKID_VCLK2_DIV] = &s4_vclk2_div.hw,
3336 [CLKID_VCLK] = &s4_vclk.hw,
3337 [CLKID_VCLK2] = &s4_vclk2.hw,
3338 [CLKID_VCLK_DIV1] = &s4_vclk_div1.hw,
3339 [CLKID_VCLK_DIV2_EN] = &s4_vclk_div2_en.hw,
3340 [CLKID_VCLK_DIV4_EN] = &s4_vclk_div4_en.hw,
3341 [CLKID_VCLK_DIV6_EN] = &s4_vclk_div6_en.hw,
3342 [CLKID_VCLK_DIV12_EN] = &s4_vclk_div12_en.hw,
3343 [CLKID_VCLK2_DIV1] = &s4_vclk2_div1.hw,
3344 [CLKID_VCLK2_DIV2_EN] = &s4_vclk2_div2_en.hw,
3345 [CLKID_VCLK2_DIV4_EN] = &s4_vclk2_div4_en.hw,
3346 [CLKID_VCLK2_DIV6_EN] = &s4_vclk2_div6_en.hw,
3347 [CLKID_VCLK2_DIV12_EN] = &s4_vclk2_div12_en.hw,
3348 [CLKID_VCLK_DIV2] = &s4_vclk_div2.hw,
3349 [CLKID_VCLK_DIV4] = &s4_vclk_div4.hw,
3350 [CLKID_VCLK_DIV6] = &s4_vclk_div6.hw,
3351 [CLKID_VCLK_DIV12] = &s4_vclk_div12.hw,
3352 [CLKID_VCLK2_DIV2] = &s4_vclk2_div2.hw,
3353 [CLKID_VCLK2_DIV4] = &s4_vclk2_div4.hw,
3354 [CLKID_VCLK2_DIV6] = &s4_vclk2_div6.hw,
3355 [CLKID_VCLK2_DIV12] = &s4_vclk2_div12.hw,
3356 [CLKID_CTS_ENCI_SEL] = &s4_cts_enci_sel.hw,
3357 [CLKID_CTS_ENCP_SEL] = &s4_cts_encp_sel.hw,
3358 [CLKID_CTS_VDAC_SEL] = &s4_cts_vdac_sel.hw,
3359 [CLKID_HDMI_TX_SEL] = &s4_hdmi_tx_sel.hw,
3360 [CLKID_CTS_ENCI] = &s4_cts_enci.hw,
3361 [CLKID_CTS_ENCP] = &s4_cts_encp.hw,
3362 [CLKID_CTS_VDAC] = &s4_cts_vdac.hw,
3363 [CLKID_HDMI_TX] = &s4_hdmi_tx.hw,
3364 [CLKID_HDMI_SEL] = &s4_hdmi_sel.hw,
3365 [CLKID_HDMI_DIV] = &s4_hdmi_div.hw,
3366 [CLKID_HDMI] = &s4_hdmi.hw,
3367 [CLKID_TS_CLK_DIV] = &s4_ts_clk_div.hw,
3368 [CLKID_TS] = &s4_ts_clk_gate.hw,
3369 [CLKID_MALI_0_SEL] = &s4_mali_0_sel.hw,
3370 [CLKID_MALI_0_DIV] = &s4_mali_0_div.hw,
3371 [CLKID_MALI_0] = &s4_mali_0.hw,
3372 [CLKID_MALI_1_SEL] = &s4_mali_1_sel.hw,
3373 [CLKID_MALI_1_DIV] = &s4_mali_1_div.hw,
3374 [CLKID_MALI_1] = &s4_mali_1.hw,
3375 [CLKID_MALI_SEL] = &s4_mali_mux.hw,
3376 [CLKID_VDEC_P0_SEL] = &s4_vdec_p0_mux.hw,
3377 [CLKID_VDEC_P0_DIV] = &s4_vdec_p0_div.hw,
3378 [CLKID_VDEC_P0] = &s4_vdec_p0.hw,
3379 [CLKID_VDEC_P1_SEL] = &s4_vdec_p1_mux.hw,
3380 [CLKID_VDEC_P1_DIV] = &s4_vdec_p1_div.hw,
3381 [CLKID_VDEC_P1] = &s4_vdec_p1.hw,
3382 [CLKID_VDEC_SEL] = &s4_vdec_mux.hw,
3383 [CLKID_HEVCF_P0_SEL] = &s4_hevcf_p0_mux.hw,
3384 [CLKID_HEVCF_P0_DIV] = &s4_hevcf_p0_div.hw,
3385 [CLKID_HEVCF_P0] = &s4_hevcf_p0.hw,
3386 [CLKID_HEVCF_P1_SEL] = &s4_hevcf_p1_mux.hw,
3387 [CLKID_HEVCF_P1_DIV] = &s4_hevcf_p1_div.hw,
3388 [CLKID_HEVCF_P1] = &s4_hevcf_p1.hw,
3389 [CLKID_HEVCF_SEL] = &s4_hevcf_mux.hw,
3390 [CLKID_VPU_0_SEL] = &s4_vpu_0_sel.hw,
3391 [CLKID_VPU_0_DIV] = &s4_vpu_0_div.hw,
3392 [CLKID_VPU_0] = &s4_vpu_0.hw,
3393 [CLKID_VPU_1_SEL] = &s4_vpu_1_sel.hw,
3394 [CLKID_VPU_1_DIV] = &s4_vpu_1_div.hw,
3395 [CLKID_VPU_1] = &s4_vpu_1.hw,
3396 [CLKID_VPU] = &s4_vpu.hw,
3397 [CLKID_VPU_CLKB_TMP_SEL] = &s4_vpu_clkb_tmp_mux.hw,
3398 [CLKID_VPU_CLKB_TMP_DIV] = &s4_vpu_clkb_tmp_div.hw,
3399 [CLKID_VPU_CLKB_TMP] = &s4_vpu_clkb_tmp.hw,
3400 [CLKID_VPU_CLKB_DIV] = &s4_vpu_clkb_div.hw,
3401 [CLKID_VPU_CLKB] = &s4_vpu_clkb.hw,
3402 [CLKID_VPU_CLKC_P0_SEL] = &s4_vpu_clkc_p0_mux.hw,
3403 [CLKID_VPU_CLKC_P0_DIV] = &s4_vpu_clkc_p0_div.hw,
3404 [CLKID_VPU_CLKC_P0] = &s4_vpu_clkc_p0.hw,
3405 [CLKID_VPU_CLKC_P1_SEL] = &s4_vpu_clkc_p1_mux.hw,
3406 [CLKID_VPU_CLKC_P1_DIV] = &s4_vpu_clkc_p1_div.hw,
3407 [CLKID_VPU_CLKC_P1] = &s4_vpu_clkc_p1.hw,
3408 [CLKID_VPU_CLKC_SEL] = &s4_vpu_clkc_mux.hw,
3409 [CLKID_VAPB_0_SEL] = &s4_vapb_0_sel.hw,
3410 [CLKID_VAPB_0_DIV] = &s4_vapb_0_div.hw,
3411 [CLKID_VAPB_0] = &s4_vapb_0.hw,
3412 [CLKID_VAPB_1_SEL] = &s4_vapb_1_sel.hw,
3413 [CLKID_VAPB_1_DIV] = &s4_vapb_1_div.hw,
3414 [CLKID_VAPB_1] = &s4_vapb_1.hw,
3415 [CLKID_VAPB] = &s4_vapb.hw,
3416 [CLKID_GE2D] = &s4_ge2d_gate.hw,
3417 [CLKID_VDIN_MEAS_SEL] = &s4_vdin_meas_mux.hw,
3418 [CLKID_VDIN_MEAS_DIV] = &s4_vdin_meas_div.hw,
3419 [CLKID_VDIN_MEAS] = &s4_vdin_meas_gate.hw,
3420 [CLKID_SD_EMMC_C_CLK_SEL] = &s4_sd_emmc_c_clk0_sel.hw,
3421 [CLKID_SD_EMMC_C_CLK_DIV] = &s4_sd_emmc_c_clk0_div.hw,
3422 [CLKID_SD_EMMC_C] = &s4_sd_emmc_c_clk0.hw,
3423 [CLKID_SD_EMMC_A_CLK_SEL] = &s4_sd_emmc_a_clk0_sel.hw,
3424 [CLKID_SD_EMMC_A_CLK_DIV] = &s4_sd_emmc_a_clk0_div.hw,
3425 [CLKID_SD_EMMC_A] = &s4_sd_emmc_a_clk0.hw,
3426 [CLKID_SD_EMMC_B_CLK_SEL] = &s4_sd_emmc_b_clk0_sel.hw,
3427 [CLKID_SD_EMMC_B_CLK_DIV] = &s4_sd_emmc_b_clk0_div.hw,
3428 [CLKID_SD_EMMC_B] = &s4_sd_emmc_b_clk0.hw,
3429 [CLKID_SPICC0_SEL] = &s4_spicc0_mux.hw,
3430 [CLKID_SPICC0_DIV] = &s4_spicc0_div.hw,
3431 [CLKID_SPICC0_EN] = &s4_spicc0_gate.hw,
3432 [CLKID_PWM_A_SEL] = &s4_pwm_a_mux.hw,
3433 [CLKID_PWM_A_DIV] = &s4_pwm_a_div.hw,
3434 [CLKID_PWM_A] = &s4_pwm_a_gate.hw,
3435 [CLKID_PWM_B_SEL] = &s4_pwm_b_mux.hw,
3436 [CLKID_PWM_B_DIV] = &s4_pwm_b_div.hw,
3437 [CLKID_PWM_B] = &s4_pwm_b_gate.hw,
3438 [CLKID_PWM_C_SEL] = &s4_pwm_c_mux.hw,
3439 [CLKID_PWM_C_DIV] = &s4_pwm_c_div.hw,
3440 [CLKID_PWM_C] = &s4_pwm_c_gate.hw,
3441 [CLKID_PWM_D_SEL] = &s4_pwm_d_mux.hw,
3442 [CLKID_PWM_D_DIV] = &s4_pwm_d_div.hw,
3443 [CLKID_PWM_D] = &s4_pwm_d_gate.hw,
3444 [CLKID_PWM_E_SEL] = &s4_pwm_e_mux.hw,
3445 [CLKID_PWM_E_DIV] = &s4_pwm_e_div.hw,
3446 [CLKID_PWM_E] = &s4_pwm_e_gate.hw,
3447 [CLKID_PWM_F_SEL] = &s4_pwm_f_mux.hw,
3448 [CLKID_PWM_F_DIV] = &s4_pwm_f_div.hw,
3449 [CLKID_PWM_F] = &s4_pwm_f_gate.hw,
3450 [CLKID_PWM_G_SEL] = &s4_pwm_g_mux.hw,
3451 [CLKID_PWM_G_DIV] = &s4_pwm_g_div.hw,
3452 [CLKID_PWM_G] = &s4_pwm_g_gate.hw,
3453 [CLKID_PWM_H_SEL] = &s4_pwm_h_mux.hw,
3454 [CLKID_PWM_H_DIV] = &s4_pwm_h_div.hw,
3455 [CLKID_PWM_H] = &s4_pwm_h_gate.hw,
3456 [CLKID_PWM_I_SEL] = &s4_pwm_i_mux.hw,
3457 [CLKID_PWM_I_DIV] = &s4_pwm_i_div.hw,
3458 [CLKID_PWM_I] = &s4_pwm_i_gate.hw,
3459 [CLKID_PWM_J_SEL] = &s4_pwm_j_mux.hw,
3460 [CLKID_PWM_J_DIV] = &s4_pwm_j_div.hw,
3461 [CLKID_PWM_J] = &s4_pwm_j_gate.hw,
3462 [CLKID_SARADC_SEL] = &s4_saradc_mux.hw,
3463 [CLKID_SARADC_DIV] = &s4_saradc_div.hw,
3464 [CLKID_SARADC] = &s4_saradc_gate.hw,
3465 [CLKID_GEN_SEL] = &s4_gen_clk_sel.hw,
3466 [CLKID_GEN_DIV] = &s4_gen_clk_div.hw,
3467 [CLKID_GEN] = &s4_gen_clk.hw,
3468 [CLKID_DDR] = &s4_ddr.hw,
3469 [CLKID_DOS] = &s4_dos.hw,
3470 [CLKID_ETHPHY] = &s4_ethphy.hw,
3471 [CLKID_MALI] = &s4_mali.hw,
3472 [CLKID_AOCPU] = &s4_aocpu.hw,
3473 [CLKID_AUCPU] = &s4_aucpu.hw,
3474 [CLKID_CEC] = &s4_cec.hw,
3475 [CLKID_SDEMMC_A] = &s4_sdemmca.hw,
3476 [CLKID_SDEMMC_B] = &s4_sdemmcb.hw,
3477 [CLKID_NAND] = &s4_nand.hw,
3478 [CLKID_SMARTCARD] = &s4_smartcard.hw,
3479 [CLKID_ACODEC] = &s4_acodec.hw,
3480 [CLKID_SPIFC] = &s4_spifc.hw,
3481 [CLKID_MSR] = &s4_msr_clk.hw,
3482 [CLKID_IR_CTRL] = &s4_ir_ctrl.hw,
3483 [CLKID_AUDIO] = &s4_audio.hw,
3484 [CLKID_ETH] = &s4_eth.hw,
3485 [CLKID_UART_A] = &s4_uart_a.hw,
3486 [CLKID_UART_B] = &s4_uart_b.hw,
3487 [CLKID_UART_C] = &s4_uart_c.hw,
3488 [CLKID_UART_D] = &s4_uart_d.hw,
3489 [CLKID_UART_E] = &s4_uart_e.hw,
3490 [CLKID_AIFIFO] = &s4_aififo.hw,
3491 [CLKID_TS_DDR] = &s4_ts_ddr.hw,
3492 [CLKID_TS_PLL] = &s4_ts_pll.hw,
3493 [CLKID_G2D] = &s4_g2d.hw,
3494 [CLKID_SPICC0] = &s4_spicc0.hw,
3495 [CLKID_USB] = &s4_usb.hw,
3496 [CLKID_I2C_M_A] = &s4_i2c_m_a.hw,
3497 [CLKID_I2C_M_B] = &s4_i2c_m_b.hw,
3498 [CLKID_I2C_M_C] = &s4_i2c_m_c.hw,
3499 [CLKID_I2C_M_D] = &s4_i2c_m_d.hw,
3500 [CLKID_I2C_M_E] = &s4_i2c_m_e.hw,
3501 [CLKID_HDMITX_APB] = &s4_hdmitx_apb.hw,
3502 [CLKID_I2C_S_A] = &s4_i2c_s_a.hw,
3503 [CLKID_USB1_TO_DDR] = &s4_usb1_to_ddr.hw,
3504 [CLKID_HDCP22] = &s4_hdcp22.hw,
3505 [CLKID_MMC_APB] = &s4_mmc_apb.hw,
3506 [CLKID_RSA] = &s4_rsa.hw,
3507 [CLKID_CPU_DEBUG] = &s4_cpu_debug.hw,
3508 [CLKID_VPU_INTR] = &s4_vpu_intr.hw,
3509 [CLKID_DEMOD] = &s4_demod.hw,
3510 [CLKID_SAR_ADC] = &s4_sar_adc.hw,
3511 [CLKID_GIC] = &s4_gic.hw,
3512 [CLKID_PWM_AB] = &s4_pwm_ab.hw,
3513 [CLKID_PWM_CD] = &s4_pwm_cd.hw,
3514 [CLKID_PWM_EF] = &s4_pwm_ef.hw,
3515 [CLKID_PWM_GH] = &s4_pwm_gh.hw,
3516 [CLKID_PWM_IJ] = &s4_pwm_ij.hw,
3517 [CLKID_HDCP22_ESMCLK_SEL] = &s4_hdcp22_esmclk_mux.hw,
3518 [CLKID_HDCP22_ESMCLK_DIV] = &s4_hdcp22_esmclk_div.hw,
3519 [CLKID_HDCP22_ESMCLK] = &s4_hdcp22_esmclk_gate.hw,
3520 [CLKID_HDCP22_SKPCLK_SEL] = &s4_hdcp22_skpclk_mux.hw,
3521 [CLKID_HDCP22_SKPCLK_DIV] = &s4_hdcp22_skpclk_div.hw,
3522 [CLKID_HDCP22_SKPCLK] = &s4_hdcp22_skpclk_gate.hw,
3525 /* Convenience table to populate regmap in .probe */
3526 static struct clk_regmap *const s4_periphs_clk_regmaps[] = {
3527 &s4_rtc_32k_by_oscin_clkin,
3528 &s4_rtc_32k_by_oscin_div,
3529 &s4_rtc_32k_by_oscin_sel,
3530 &s4_rtc_32k_by_oscin,
3541 &s4_ceca_32k_sel_pre,
3543 &s4_ceca_32k_clkout,
3546 &s4_cecb_32k_sel_pre,
3548 &s4_cecb_32k_clkout,
3552 &s4_12_24M_clk_gate,
3616 &s4_vpu_clkb_tmp_mux,
3617 &s4_vpu_clkb_tmp_div,
3621 &s4_vpu_clkc_p0_mux,
3622 &s4_vpu_clkc_p0_div,
3624 &s4_vpu_clkc_p1_mux,
3625 &s4_vpu_clkc_p1_div,
3636 &s4_hdcp22_esmclk_mux,
3637 &s4_hdcp22_esmclk_div,
3638 &s4_hdcp22_esmclk_gate,
3639 &s4_hdcp22_skpclk_mux,
3640 &s4_hdcp22_skpclk_div,
3641 &s4_hdcp22_skpclk_gate,
3645 &s4_sd_emmc_c_clk0_sel,
3646 &s4_sd_emmc_c_clk0_div,
3648 &s4_sd_emmc_a_clk0_sel,
3649 &s4_sd_emmc_a_clk0_div,
3651 &s4_sd_emmc_b_clk0_sel,
3652 &s4_sd_emmc_b_clk0_div,
3742 &s4_demod_core_clk_mux,
3743 &s4_demod_core_clk_div,
3744 &s4_demod_core_clk_gate,
3745 &s4_adc_extclk_in_mux,
3746 &s4_adc_extclk_in_div,
3747 &s4_adc_extclk_in_gate,
3750 static struct regmap_config clkc_regmap_config = {
3756 static struct meson_clk_hw_data s4_periphs_clks = {
3757 .hws = s4_periphs_hw_clks,
3758 .num = ARRAY_SIZE(s4_periphs_hw_clks),
3761 static int meson_s4_periphs_probe(struct platform_device *pdev)
3763 struct device *dev = &pdev->dev;
3764 struct regmap *regmap;
3768 base = devm_platform_ioremap_resource(pdev, 0);
3770 return dev_err_probe(dev, PTR_ERR(base),
3771 "can't ioremap resource\n");
3773 regmap = devm_regmap_init_mmio(dev, base, &clkc_regmap_config);
3775 return dev_err_probe(dev, PTR_ERR(regmap),
3776 "can't init regmap mmio region\n");
3778 /* Populate regmap for the regmap backed clocks */
3779 for (i = 0; i < ARRAY_SIZE(s4_periphs_clk_regmaps); i++)
3780 s4_periphs_clk_regmaps[i]->map = regmap;
3782 for (i = 0; i < s4_periphs_clks.num; i++) {
3783 /* array might be sparse */
3784 if (!s4_periphs_clks.hws[i])
3787 ret = devm_clk_hw_register(dev, s4_periphs_clks.hws[i]);
3789 return dev_err_probe(dev, ret,
3790 "clock[%d] registration failed\n", i);
3793 return devm_of_clk_add_hw_provider(dev, meson_clk_hw_get, &s4_periphs_clks);
3796 static const struct of_device_id clkc_match_table[] = {
3798 .compatible = "amlogic,s4-peripherals-clkc",
3803 static struct platform_driver s4_driver = {
3804 .probe = meson_s4_periphs_probe,
3806 .name = "s4-periphs-clkc",
3807 .of_match_table = clkc_match_table,
3811 module_platform_driver(s4_driver);
3812 MODULE_AUTHOR("Yu Tu <yu.tu@amlogic.com>");
3813 MODULE_LICENSE("GPL");