1 // SPDX-License-Identifier: GPL-2.0-only
3 * Amlogic C3 Peripherals Clock Controller Driver
5 * Copyright (c) 2023 Amlogic, inc.
6 * Author: Chuan Liu <chuan.liu@amlogic.com>
9 #include <linux/clk-provider.h>
10 #include <linux/platform_device.h>
11 #include "clk-regmap.h"
12 #include "clk-dualdiv.h"
13 #include "meson-clkc-utils.h"
14 #include <dt-bindings/clock/amlogic,c3-peripherals-clkc.h>
16 #define RTC_BY_OSCIN_CTRL0 0x8
17 #define RTC_BY_OSCIN_CTRL1 0xc
19 #define SYS_CLK_EN0_REG0 0x44
20 #define SYS_CLK_EN0_REG1 0x48
21 #define SYS_CLK_EN0_REG2 0x4c
22 #define CLK12_24_CTRL 0xa8
23 #define AXI_CLK_EN0 0xac
24 #define VDIN_MEAS_CLK_CTRL 0xf8
25 #define VAPB_CLK_CTRL 0xfc
26 #define MIPIDSI_PHY_CLK_CTRL 0x104
27 #define GE2D_CLK_CTRL 0x10c
28 #define ISP0_CLK_CTRL 0x110
29 #define DEWARPA_CLK_CTRL 0x114
30 #define VOUTENC_CLK_CTRL 0x118
31 #define VDEC_CLK_CTRL 0x140
32 #define VDEC3_CLK_CTRL 0x148
33 #define TS_CLK_CTRL 0x158
34 #define ETH_CLK_CTRL 0x164
35 #define NAND_CLK_CTRL 0x168
36 #define SD_EMMC_CLK_CTRL 0x16c
37 #define SPICC_CLK_CTRL 0x174
38 #define GEN_CLK_CTRL 0x178
39 #define SAR_CLK_CTRL0 0x17c
40 #define PWM_CLK_AB_CTRL 0x180
41 #define PWM_CLK_CD_CTRL 0x184
42 #define PWM_CLK_EF_CTRL 0x188
43 #define PWM_CLK_GH_CTRL 0x18c
44 #define PWM_CLK_IJ_CTRL 0x190
45 #define PWM_CLK_KL_CTRL 0x194
46 #define PWM_CLK_MN_CTRL 0x198
47 #define VC9000E_CLK_CTRL 0x19c
48 #define SPIFC_CLK_CTRL 0x1a0
49 #define NNA_CLK_CTRL 0x220
51 static struct clk_regmap rtc_xtal_clkin
= {
52 .data
= &(struct clk_regmap_gate_data
) {
53 .offset
= RTC_BY_OSCIN_CTRL0
,
56 .hw
.init
= &(struct clk_init_data
) {
57 .name
= "rtc_xtal_clkin",
58 .ops
= &clk_regmap_gate_ops
,
59 .parent_data
= &(const struct clk_parent_data
) {
66 static const struct meson_clk_dualdiv_param rtc_32k_div_table
[] = {
67 { 733, 732, 8, 11, 1 },
71 static struct clk_regmap rtc_32k_div
= {
72 .data
= &(struct meson_clk_dualdiv_data
) {
74 .reg_off
= RTC_BY_OSCIN_CTRL0
,
79 .reg_off
= RTC_BY_OSCIN_CTRL0
,
84 .reg_off
= RTC_BY_OSCIN_CTRL1
,
89 .reg_off
= RTC_BY_OSCIN_CTRL1
,
94 .reg_off
= RTC_BY_OSCIN_CTRL0
,
98 .table
= rtc_32k_div_table
,
100 .hw
.init
= &(struct clk_init_data
) {
101 .name
= "rtc_32k_div",
102 .ops
= &meson_clk_dualdiv_ops
,
103 .parent_hws
= (const struct clk_hw
*[]) {
110 static const struct clk_parent_data rtc_32k_mux_parent_data
[] = {
111 { .hw
= &rtc_32k_div
.hw
},
112 { .hw
= &rtc_xtal_clkin
.hw
}
115 static struct clk_regmap rtc_32k_mux
= {
116 .data
= &(struct clk_regmap_mux_data
) {
117 .offset
= RTC_BY_OSCIN_CTRL1
,
121 .hw
.init
= &(struct clk_init_data
) {
122 .name
= "rtc_32k_mux",
123 .ops
= &clk_regmap_mux_ops
,
124 .parent_data
= rtc_32k_mux_parent_data
,
125 .num_parents
= ARRAY_SIZE(rtc_32k_mux_parent_data
),
126 .flags
= CLK_SET_RATE_PARENT
,
130 static struct clk_regmap rtc_32k
= {
131 .data
= &(struct clk_regmap_gate_data
) {
132 .offset
= RTC_BY_OSCIN_CTRL0
,
135 .hw
.init
= &(struct clk_init_data
) {
137 .ops
= &clk_regmap_gate_ops
,
138 .parent_hws
= (const struct clk_hw
*[]) {
142 .flags
= CLK_SET_RATE_PARENT
,
146 static const struct clk_parent_data rtc_clk_mux_parent_data
[] = {
147 { .fw_name
= "oscin" },
148 { .hw
= &rtc_32k
.hw
},
149 { .fw_name
= "pad_osc" }
152 static struct clk_regmap rtc_clk
= {
153 .data
= &(struct clk_regmap_mux_data
) {
158 .hw
.init
= &(struct clk_init_data
) {
160 .ops
= &clk_regmap_mux_ops
,
161 .parent_data
= rtc_clk_mux_parent_data
,
162 .num_parents
= ARRAY_SIZE(rtc_clk_mux_parent_data
),
163 .flags
= CLK_SET_RATE_PARENT
,
167 #define C3_CLK_GATE(_name, _reg, _bit, _fw_name, _ops, _flags) \
168 struct clk_regmap _name = { \
169 .data = &(struct clk_regmap_gate_data){ \
173 .hw.init = &(struct clk_init_data) { \
176 .parent_data = &(const struct clk_parent_data) { \
177 .fw_name = #_fw_name, \
184 #define C3_SYS_GATE(_name, _reg, _bit, _flags) \
185 C3_CLK_GATE(_name, _reg, _bit, sysclk, \
186 &clk_regmap_gate_ops, _flags)
188 #define C3_SYS_GATE_RO(_name, _reg, _bit) \
189 C3_CLK_GATE(_name, _reg, _bit, sysclk, \
190 &clk_regmap_gate_ro_ops, 0)
192 static C3_SYS_GATE(sys_reset_ctrl
, SYS_CLK_EN0_REG0
, 1, 0);
193 static C3_SYS_GATE(sys_pwr_ctrl
, SYS_CLK_EN0_REG0
, 3, 0);
194 static C3_SYS_GATE(sys_pad_ctrl
, SYS_CLK_EN0_REG0
, 4, 0);
195 static C3_SYS_GATE(sys_ctrl
, SYS_CLK_EN0_REG0
, 5, 0);
196 static C3_SYS_GATE(sys_ts_pll
, SYS_CLK_EN0_REG0
, 6, 0);
199 * NOTE: sys_dev_arb provides the clock to the ETH and SPICC arbiters that
200 * access the AXI bus.
202 static C3_SYS_GATE(sys_dev_arb
, SYS_CLK_EN0_REG0
, 7, 0);
205 * FIXME: sys_mmc_pclk provides the clock for the DDR PHY, DDR will only be
206 * initialized in bl2, and this clock should not be touched in linux.
208 static C3_SYS_GATE_RO(sys_mmc_pclk
, SYS_CLK_EN0_REG0
, 8);
211 * NOTE: sys_cpu_ctrl provides the clock for CPU controller. After clock is
212 * disabled, cpu_clk and other key CPU-related configurations cannot take effect.
214 static C3_SYS_GATE(sys_cpu_ctrl
, SYS_CLK_EN0_REG0
, 11, CLK_IS_CRITICAL
);
215 static C3_SYS_GATE(sys_jtag_ctrl
, SYS_CLK_EN0_REG0
, 12, 0);
216 static C3_SYS_GATE(sys_ir_ctrl
, SYS_CLK_EN0_REG0
, 13, 0);
219 * NOTE: sys_irq_ctrl provides the clock for IRQ controller. The IRQ controller
220 * collects and distributes the interrupt signal to the GIC, PWR_CTRL, and
221 * AOCPU. If the clock is disabled, interrupt-related functions will occurs an
224 static C3_SYS_GATE(sys_irq_ctrl
, SYS_CLK_EN0_REG0
, 14, CLK_IS_CRITICAL
);
225 static C3_SYS_GATE(sys_msr_clk
, SYS_CLK_EN0_REG0
, 15, 0);
226 static C3_SYS_GATE(sys_rom
, SYS_CLK_EN0_REG0
, 16, 0);
227 static C3_SYS_GATE(sys_uart_f
, SYS_CLK_EN0_REG0
, 17, 0);
228 static C3_SYS_GATE(sys_cpu_apb
, SYS_CLK_EN0_REG0
, 18, 0);
229 static C3_SYS_GATE(sys_rsa
, SYS_CLK_EN0_REG0
, 19, 0);
230 static C3_SYS_GATE(sys_sar_adc
, SYS_CLK_EN0_REG0
, 20, 0);
231 static C3_SYS_GATE(sys_startup
, SYS_CLK_EN0_REG0
, 21, 0);
232 static C3_SYS_GATE(sys_secure
, SYS_CLK_EN0_REG0
, 22, 0);
233 static C3_SYS_GATE(sys_spifc
, SYS_CLK_EN0_REG0
, 23, 0);
234 static C3_SYS_GATE(sys_nna
, SYS_CLK_EN0_REG0
, 25, 0);
235 static C3_SYS_GATE(sys_eth_mac
, SYS_CLK_EN0_REG0
, 26, 0);
238 * FIXME: sys_gic provides the clock for GIC(Generic Interrupt Controller).
239 * After clock is disabled, The GIC cannot work properly. At present, the driver
240 * used by our GIC is the public driver in kernel, and there is no management
241 * clock in the driver.
243 static C3_SYS_GATE(sys_gic
, SYS_CLK_EN0_REG0
, 27, CLK_IS_CRITICAL
);
244 static C3_SYS_GATE(sys_rama
, SYS_CLK_EN0_REG0
, 28, 0);
247 * NOTE: sys_big_nic provides the clock to the control bus of the NIC(Network
248 * Interface Controller) between multiple devices(CPU, DDR, RAM, ROM, GIC,
249 * SPIFC, CAPU, JTAG, EMMC, SDIO, sec_top, USB, Audio, ETH, SPICC) in the
250 * system. After clock is disabled, The NIC cannot work.
252 static C3_SYS_GATE(sys_big_nic
, SYS_CLK_EN0_REG0
, 29, CLK_IS_CRITICAL
);
253 static C3_SYS_GATE(sys_ramb
, SYS_CLK_EN0_REG0
, 30, 0);
254 static C3_SYS_GATE(sys_audio_pclk
, SYS_CLK_EN0_REG0
, 31, 0);
255 static C3_SYS_GATE(sys_pwm_kl
, SYS_CLK_EN0_REG1
, 0, 0);
256 static C3_SYS_GATE(sys_pwm_ij
, SYS_CLK_EN0_REG1
, 1, 0);
257 static C3_SYS_GATE(sys_usb
, SYS_CLK_EN0_REG1
, 2, 0);
258 static C3_SYS_GATE(sys_sd_emmc_a
, SYS_CLK_EN0_REG1
, 3, 0);
259 static C3_SYS_GATE(sys_sd_emmc_c
, SYS_CLK_EN0_REG1
, 4, 0);
260 static C3_SYS_GATE(sys_pwm_ab
, SYS_CLK_EN0_REG1
, 5, 0);
261 static C3_SYS_GATE(sys_pwm_cd
, SYS_CLK_EN0_REG1
, 6, 0);
262 static C3_SYS_GATE(sys_pwm_ef
, SYS_CLK_EN0_REG1
, 7, 0);
263 static C3_SYS_GATE(sys_pwm_gh
, SYS_CLK_EN0_REG1
, 8, 0);
264 static C3_SYS_GATE(sys_spicc_1
, SYS_CLK_EN0_REG1
, 9, 0);
265 static C3_SYS_GATE(sys_spicc_0
, SYS_CLK_EN0_REG1
, 10, 0);
266 static C3_SYS_GATE(sys_uart_a
, SYS_CLK_EN0_REG1
, 11, 0);
267 static C3_SYS_GATE(sys_uart_b
, SYS_CLK_EN0_REG1
, 12, 0);
268 static C3_SYS_GATE(sys_uart_c
, SYS_CLK_EN0_REG1
, 13, 0);
269 static C3_SYS_GATE(sys_uart_d
, SYS_CLK_EN0_REG1
, 14, 0);
270 static C3_SYS_GATE(sys_uart_e
, SYS_CLK_EN0_REG1
, 15, 0);
271 static C3_SYS_GATE(sys_i2c_m_a
, SYS_CLK_EN0_REG1
, 16, 0);
272 static C3_SYS_GATE(sys_i2c_m_b
, SYS_CLK_EN0_REG1
, 17, 0);
273 static C3_SYS_GATE(sys_i2c_m_c
, SYS_CLK_EN0_REG1
, 18, 0);
274 static C3_SYS_GATE(sys_i2c_m_d
, SYS_CLK_EN0_REG1
, 19, 0);
275 static C3_SYS_GATE(sys_i2c_s_a
, SYS_CLK_EN0_REG1
, 20, 0);
276 static C3_SYS_GATE(sys_rtc
, SYS_CLK_EN0_REG1
, 21, 0);
277 static C3_SYS_GATE(sys_ge2d
, SYS_CLK_EN0_REG1
, 22, 0);
278 static C3_SYS_GATE(sys_isp
, SYS_CLK_EN0_REG1
, 23, 0);
279 static C3_SYS_GATE(sys_gpv_isp_nic
, SYS_CLK_EN0_REG1
, 24, 0);
280 static C3_SYS_GATE(sys_gpv_cve_nic
, SYS_CLK_EN0_REG1
, 25, 0);
281 static C3_SYS_GATE(sys_mipi_dsi_host
, SYS_CLK_EN0_REG1
, 26, 0);
282 static C3_SYS_GATE(sys_mipi_dsi_phy
, SYS_CLK_EN0_REG1
, 27, 0);
283 static C3_SYS_GATE(sys_eth_phy
, SYS_CLK_EN0_REG1
, 28, 0);
284 static C3_SYS_GATE(sys_acodec
, SYS_CLK_EN0_REG1
, 29, 0);
285 static C3_SYS_GATE(sys_dwap
, SYS_CLK_EN0_REG1
, 30, 0);
286 static C3_SYS_GATE(sys_dos
, SYS_CLK_EN0_REG1
, 31, 0);
287 static C3_SYS_GATE(sys_cve
, SYS_CLK_EN0_REG2
, 0, 0);
288 static C3_SYS_GATE(sys_vout
, SYS_CLK_EN0_REG2
, 1, 0);
289 static C3_SYS_GATE(sys_vc9000e
, SYS_CLK_EN0_REG2
, 2, 0);
290 static C3_SYS_GATE(sys_pwm_mn
, SYS_CLK_EN0_REG2
, 3, 0);
291 static C3_SYS_GATE(sys_sd_emmc_b
, SYS_CLK_EN0_REG2
, 4, 0);
293 #define C3_AXI_GATE(_name, _reg, _bit, _flags) \
294 C3_CLK_GATE(_name, _reg, _bit, axiclk, \
295 &clk_regmap_gate_ops, _flags)
298 * NOTE: axi_sys_nic provides the clock to the AXI bus of the system NIC. After
299 * clock is disabled, The NIC cannot work.
301 static C3_AXI_GATE(axi_sys_nic
, AXI_CLK_EN0
, 2, CLK_IS_CRITICAL
);
302 static C3_AXI_GATE(axi_isp_nic
, AXI_CLK_EN0
, 3, 0);
303 static C3_AXI_GATE(axi_cve_nic
, AXI_CLK_EN0
, 4, 0);
304 static C3_AXI_GATE(axi_ramb
, AXI_CLK_EN0
, 5, 0);
305 static C3_AXI_GATE(axi_rama
, AXI_CLK_EN0
, 6, 0);
308 * NOTE: axi_cpu_dmc provides the clock to the AXI bus where the CPU accesses
309 * the DDR. After clock is disabled, The CPU will not have access to the DDR.
311 static C3_AXI_GATE(axi_cpu_dmc
, AXI_CLK_EN0
, 7, CLK_IS_CRITICAL
);
312 static C3_AXI_GATE(axi_nic
, AXI_CLK_EN0
, 8, 0);
313 static C3_AXI_GATE(axi_dma
, AXI_CLK_EN0
, 9, 0);
316 * NOTE: axi_mux_nic provides the clock to the NIC's AXI bus for NN(Neural
317 * Network) and other devices(CPU, EMMC, SDIO, sec_top, USB, Audio, ETH, SPICC)
318 * to access RAM space.
320 static C3_AXI_GATE(axi_mux_nic
, AXI_CLK_EN0
, 10, 0);
321 static C3_AXI_GATE(axi_cve
, AXI_CLK_EN0
, 12, 0);
324 * NOTE: axi_dev1_dmc provides the clock for the peripherals(EMMC, SDIO,
325 * sec_top, USB, Audio, ETH, SPICC) to access the AXI bus of the DDR.
327 static C3_AXI_GATE(axi_dev1_dmc
, AXI_CLK_EN0
, 13, 0);
328 static C3_AXI_GATE(axi_dev0_dmc
, AXI_CLK_EN0
, 14, 0);
329 static C3_AXI_GATE(axi_dsp_dmc
, AXI_CLK_EN0
, 15, 0);
334 * |------| |-----| clk_12m_24m |-----|
335 * xtal---->| gate |---->| div |------------>| pad |
336 * |------| |-----| |-----|
338 static struct clk_regmap clk_12_24m_in
= {
339 .data
= &(struct clk_regmap_gate_data
) {
340 .offset
= CLK12_24_CTRL
,
343 .hw
.init
= &(struct clk_init_data
) {
344 .name
= "clk_12_24m_in",
345 .ops
= &clk_regmap_gate_ops
,
346 .parent_data
= &(const struct clk_parent_data
) {
347 .fw_name
= "xtal_24m",
353 static struct clk_regmap clk_12_24m
= {
354 .data
= &(struct clk_regmap_div_data
) {
355 .offset
= CLK12_24_CTRL
,
359 .hw
.init
= &(struct clk_init_data
) {
360 .name
= "clk_12_24m",
361 .ops
= &clk_regmap_divider_ops
,
362 .parent_hws
= (const struct clk_hw
*[]) {
369 /* Fix me: set value 0 will div by 2 like value 1 */
370 static struct clk_regmap fclk_25m_div
= {
371 .data
= &(struct clk_regmap_div_data
) {
372 .offset
= CLK12_24_CTRL
,
376 .hw
.init
= &(struct clk_init_data
) {
377 .name
= "fclk_25m_div",
378 .ops
= &clk_regmap_divider_ops
,
379 .parent_data
= &(const struct clk_parent_data
) {
386 static struct clk_regmap fclk_25m
= {
387 .data
= &(struct clk_regmap_gate_data
) {
388 .offset
= CLK12_24_CTRL
,
391 .hw
.init
= &(struct clk_init_data
) {
393 .ops
= &clk_regmap_gate_ops
,
394 .parent_hws
= (const struct clk_hw
*[]) {
398 .flags
= CLK_SET_RATE_PARENT
,
403 * Channel 3(ddr_dpll_pt_clk) is manged by the DDR module; channel 12(cts_msr_clk)
404 * is manged by clock measures module. Their hardware are out of clock tree.
405 * Channel 4 8 9 10 11 13 14 15 16 18 are not connected.
407 static u32 gen_parent_table
[] = { 0, 1, 2, 5, 6, 7, 17, 19, 20, 21, 22, 23, 24};
409 static const struct clk_parent_data gen_parent_data
[] = {
410 { .fw_name
= "oscin" },
411 { .hw
= &rtc_clk
.hw
},
412 { .fw_name
= "sysplldiv16" },
413 { .fw_name
= "gp0" },
414 { .fw_name
= "gp1" },
415 { .fw_name
= "hifi" },
416 { .fw_name
= "cpudiv16" },
417 { .fw_name
= "fdiv2" },
418 { .fw_name
= "fdiv2p5" },
419 { .fw_name
= "fdiv3" },
420 { .fw_name
= "fdiv4" },
421 { .fw_name
= "fdiv5" },
422 { .fw_name
= "fdiv7" }
425 static struct clk_regmap gen_sel
= {
426 .data
= &(struct clk_regmap_mux_data
) {
427 .offset
= GEN_CLK_CTRL
,
430 .table
= gen_parent_table
,
432 .hw
.init
= &(struct clk_init_data
) {
434 .ops
= &clk_regmap_mux_ops
,
435 .parent_data
= gen_parent_data
,
436 .num_parents
= ARRAY_SIZE(gen_parent_data
),
440 static struct clk_regmap gen_div
= {
441 .data
= &(struct clk_regmap_div_data
) {
442 .offset
= GEN_CLK_CTRL
,
446 .hw
.init
= &(struct clk_init_data
) {
448 .ops
= &clk_regmap_divider_ops
,
449 .parent_hws
= (const struct clk_hw
*[]) {
453 .flags
= CLK_SET_RATE_PARENT
,
457 static struct clk_regmap gen
= {
458 .data
= &(struct clk_regmap_gate_data
) {
459 .offset
= GEN_CLK_CTRL
,
462 .hw
.init
= &(struct clk_init_data
) {
464 .ops
= &clk_regmap_gate_ops
,
465 .parent_hws
= (const struct clk_hw
*[]) {
469 .flags
= CLK_SET_RATE_PARENT
,
473 static const struct clk_parent_data saradc_parent_data
[] = {
474 { .fw_name
= "oscin" },
475 { .fw_name
= "sysclk" }
478 static struct clk_regmap saradc_sel
= {
479 .data
= &(struct clk_regmap_mux_data
) {
480 .offset
= SAR_CLK_CTRL0
,
484 .hw
.init
= &(struct clk_init_data
) {
485 .name
= "saradc_sel",
486 .ops
= &clk_regmap_mux_ops
,
487 .parent_data
= saradc_parent_data
,
488 .num_parents
= ARRAY_SIZE(saradc_parent_data
),
492 static struct clk_regmap saradc_div
= {
493 .data
= &(struct clk_regmap_div_data
) {
494 .offset
= SAR_CLK_CTRL0
,
498 .hw
.init
= &(struct clk_init_data
) {
499 .name
= "saradc_div",
500 .ops
= &clk_regmap_divider_ops
,
501 .parent_hws
= (const struct clk_hw
*[]) {
505 .flags
= CLK_SET_RATE_PARENT
,
509 static struct clk_regmap saradc
= {
510 .data
= &(struct clk_regmap_gate_data
) {
511 .offset
= SAR_CLK_CTRL0
,
514 .hw
.init
= &(struct clk_init_data
) {
516 .ops
= &clk_regmap_gate_ops
,
517 .parent_hws
= (const struct clk_hw
*[]) {
521 .flags
= CLK_SET_RATE_PARENT
,
525 static const struct clk_parent_data pwm_parent_data
[] = {
526 { .fw_name
= "oscin" },
527 { .fw_name
= "gp1" },
528 { .fw_name
= "fdiv4" },
529 { .fw_name
= "fdiv3" }
532 #define AML_PWM_CLK_MUX(_name, _reg, _shift) { \
533 .data = &(struct clk_regmap_mux_data) { \
538 .hw.init = &(struct clk_init_data) { \
539 .name = #_name "_sel", \
540 .ops = &clk_regmap_mux_ops, \
541 .parent_data = pwm_parent_data, \
542 .num_parents = ARRAY_SIZE(pwm_parent_data), \
546 #define AML_PWM_CLK_DIV(_name, _reg, _shift) { \
547 .data = &(struct clk_regmap_div_data) { \
552 .hw.init = &(struct clk_init_data) { \
553 .name = #_name "_div", \
554 .ops = &clk_regmap_divider_ops, \
555 .parent_names = (const char *[]) { #_name "_sel" },\
557 .flags = CLK_SET_RATE_PARENT, \
561 #define AML_PWM_CLK_GATE(_name, _reg, _bit) { \
562 .data = &(struct clk_regmap_gate_data) { \
566 .hw.init = &(struct clk_init_data) { \
568 .ops = &clk_regmap_gate_ops, \
569 .parent_names = (const char *[]) { #_name "_div" },\
571 .flags = CLK_SET_RATE_PARENT, \
575 static struct clk_regmap pwm_a_sel
=
576 AML_PWM_CLK_MUX(pwm_a
, PWM_CLK_AB_CTRL
, 9);
577 static struct clk_regmap pwm_a_div
=
578 AML_PWM_CLK_DIV(pwm_a
, PWM_CLK_AB_CTRL
, 0);
579 static struct clk_regmap pwm_a
=
580 AML_PWM_CLK_GATE(pwm_a
, PWM_CLK_AB_CTRL
, 8);
582 static struct clk_regmap pwm_b_sel
=
583 AML_PWM_CLK_MUX(pwm_b
, PWM_CLK_AB_CTRL
, 25);
584 static struct clk_regmap pwm_b_div
=
585 AML_PWM_CLK_DIV(pwm_b
, PWM_CLK_AB_CTRL
, 16);
586 static struct clk_regmap pwm_b
=
587 AML_PWM_CLK_GATE(pwm_b
, PWM_CLK_AB_CTRL
, 24);
589 static struct clk_regmap pwm_c_sel
=
590 AML_PWM_CLK_MUX(pwm_c
, PWM_CLK_CD_CTRL
, 9);
591 static struct clk_regmap pwm_c_div
=
592 AML_PWM_CLK_DIV(pwm_c
, PWM_CLK_CD_CTRL
, 0);
593 static struct clk_regmap pwm_c
=
594 AML_PWM_CLK_GATE(pwm_c
, PWM_CLK_CD_CTRL
, 8);
596 static struct clk_regmap pwm_d_sel
=
597 AML_PWM_CLK_MUX(pwm_d
, PWM_CLK_CD_CTRL
, 25);
598 static struct clk_regmap pwm_d_div
=
599 AML_PWM_CLK_DIV(pwm_d
, PWM_CLK_CD_CTRL
, 16);
600 static struct clk_regmap pwm_d
=
601 AML_PWM_CLK_GATE(pwm_d
, PWM_CLK_CD_CTRL
, 24);
603 static struct clk_regmap pwm_e_sel
=
604 AML_PWM_CLK_MUX(pwm_e
, PWM_CLK_EF_CTRL
, 9);
605 static struct clk_regmap pwm_e_div
=
606 AML_PWM_CLK_DIV(pwm_e
, PWM_CLK_EF_CTRL
, 0);
607 static struct clk_regmap pwm_e
=
608 AML_PWM_CLK_GATE(pwm_e
, PWM_CLK_EF_CTRL
, 8);
610 static struct clk_regmap pwm_f_sel
=
611 AML_PWM_CLK_MUX(pwm_f
, PWM_CLK_EF_CTRL
, 25);
612 static struct clk_regmap pwm_f_div
=
613 AML_PWM_CLK_DIV(pwm_f
, PWM_CLK_EF_CTRL
, 16);
614 static struct clk_regmap pwm_f
=
615 AML_PWM_CLK_GATE(pwm_f
, PWM_CLK_EF_CTRL
, 24);
617 static struct clk_regmap pwm_g_sel
=
618 AML_PWM_CLK_MUX(pwm_g
, PWM_CLK_GH_CTRL
, 9);
619 static struct clk_regmap pwm_g_div
=
620 AML_PWM_CLK_DIV(pwm_g
, PWM_CLK_GH_CTRL
, 0);
621 static struct clk_regmap pwm_g
=
622 AML_PWM_CLK_GATE(pwm_g
, PWM_CLK_GH_CTRL
, 8);
624 static struct clk_regmap pwm_h_sel
=
625 AML_PWM_CLK_MUX(pwm_h
, PWM_CLK_GH_CTRL
, 25);
626 static struct clk_regmap pwm_h_div
=
627 AML_PWM_CLK_DIV(pwm_h
, PWM_CLK_GH_CTRL
, 16);
628 static struct clk_regmap pwm_h
=
629 AML_PWM_CLK_GATE(pwm_h
, PWM_CLK_GH_CTRL
, 24);
631 static struct clk_regmap pwm_i_sel
=
632 AML_PWM_CLK_MUX(pwm_i
, PWM_CLK_IJ_CTRL
, 9);
633 static struct clk_regmap pwm_i_div
=
634 AML_PWM_CLK_DIV(pwm_i
, PWM_CLK_IJ_CTRL
, 0);
635 static struct clk_regmap pwm_i
=
636 AML_PWM_CLK_GATE(pwm_i
, PWM_CLK_IJ_CTRL
, 8);
638 static struct clk_regmap pwm_j_sel
=
639 AML_PWM_CLK_MUX(pwm_j
, PWM_CLK_IJ_CTRL
, 25);
640 static struct clk_regmap pwm_j_div
=
641 AML_PWM_CLK_DIV(pwm_j
, PWM_CLK_IJ_CTRL
, 16);
642 static struct clk_regmap pwm_j
=
643 AML_PWM_CLK_GATE(pwm_j
, PWM_CLK_IJ_CTRL
, 24);
645 static struct clk_regmap pwm_k_sel
=
646 AML_PWM_CLK_MUX(pwm_k
, PWM_CLK_KL_CTRL
, 9);
647 static struct clk_regmap pwm_k_div
=
648 AML_PWM_CLK_DIV(pwm_k
, PWM_CLK_KL_CTRL
, 0);
649 static struct clk_regmap pwm_k
=
650 AML_PWM_CLK_GATE(pwm_k
, PWM_CLK_KL_CTRL
, 8);
652 static struct clk_regmap pwm_l_sel
=
653 AML_PWM_CLK_MUX(pwm_l
, PWM_CLK_KL_CTRL
, 25);
654 static struct clk_regmap pwm_l_div
=
655 AML_PWM_CLK_DIV(pwm_l
, PWM_CLK_KL_CTRL
, 16);
656 static struct clk_regmap pwm_l
=
657 AML_PWM_CLK_GATE(pwm_l
, PWM_CLK_KL_CTRL
, 24);
659 static struct clk_regmap pwm_m_sel
=
660 AML_PWM_CLK_MUX(pwm_m
, PWM_CLK_MN_CTRL
, 9);
661 static struct clk_regmap pwm_m_div
=
662 AML_PWM_CLK_DIV(pwm_m
, PWM_CLK_MN_CTRL
, 0);
663 static struct clk_regmap pwm_m
=
664 AML_PWM_CLK_GATE(pwm_m
, PWM_CLK_MN_CTRL
, 8);
666 static struct clk_regmap pwm_n_sel
=
667 AML_PWM_CLK_MUX(pwm_n
, PWM_CLK_MN_CTRL
, 25);
668 static struct clk_regmap pwm_n_div
=
669 AML_PWM_CLK_DIV(pwm_n
, PWM_CLK_MN_CTRL
, 16);
670 static struct clk_regmap pwm_n
=
671 AML_PWM_CLK_GATE(pwm_n
, PWM_CLK_MN_CTRL
, 24);
673 static const struct clk_parent_data spicc_parent_data
[] = {
674 { .fw_name
= "oscin" },
675 { .fw_name
= "sysclk" },
676 { .fw_name
= "fdiv4" },
677 { .fw_name
= "fdiv3" },
678 { .fw_name
= "fdiv2" },
679 { .fw_name
= "fdiv5" },
680 { .fw_name
= "fdiv7" },
684 static struct clk_regmap spicc_a_sel
= {
685 .data
= &(struct clk_regmap_mux_data
) {
686 .offset
= SPICC_CLK_CTRL
,
690 .hw
.init
= &(struct clk_init_data
) {
691 .name
= "spicc_a_sel",
692 .ops
= &clk_regmap_mux_ops
,
693 .parent_data
= spicc_parent_data
,
694 .num_parents
= ARRAY_SIZE(spicc_parent_data
),
698 static struct clk_regmap spicc_a_div
= {
699 .data
= &(struct clk_regmap_div_data
) {
700 .offset
= SPICC_CLK_CTRL
,
704 .hw
.init
= &(struct clk_init_data
) {
705 .name
= "spicc_a_div",
706 .ops
= &clk_regmap_divider_ops
,
707 .parent_hws
= (const struct clk_hw
*[]) {
711 .flags
= CLK_SET_RATE_PARENT
,
715 static struct clk_regmap spicc_a
= {
716 .data
= &(struct clk_regmap_gate_data
) {
717 .offset
= SPICC_CLK_CTRL
,
720 .hw
.init
= &(struct clk_init_data
) {
722 .ops
= &clk_regmap_gate_ops
,
723 .parent_hws
= (const struct clk_hw
*[]) {
727 .flags
= CLK_SET_RATE_PARENT
,
731 static struct clk_regmap spicc_b_sel
= {
732 .data
= &(struct clk_regmap_mux_data
) {
733 .offset
= SPICC_CLK_CTRL
,
737 .hw
.init
= &(struct clk_init_data
) {
738 .name
= "spicc_b_sel",
739 .ops
= &clk_regmap_mux_ops
,
740 .parent_data
= spicc_parent_data
,
741 .num_parents
= ARRAY_SIZE(spicc_parent_data
),
745 static struct clk_regmap spicc_b_div
= {
746 .data
= &(struct clk_regmap_div_data
) {
747 .offset
= SPICC_CLK_CTRL
,
751 .hw
.init
= &(struct clk_init_data
) {
752 .name
= "spicc_b_div",
753 .ops
= &clk_regmap_divider_ops
,
754 .parent_hws
= (const struct clk_hw
*[]) {
758 .flags
= CLK_SET_RATE_PARENT
,
762 static struct clk_regmap spicc_b
= {
763 .data
= &(struct clk_regmap_gate_data
) {
764 .offset
= SPICC_CLK_CTRL
,
767 .hw
.init
= &(struct clk_init_data
) {
769 .ops
= &clk_regmap_gate_ops
,
770 .parent_hws
= (const struct clk_hw
*[]) {
774 .flags
= CLK_SET_RATE_PARENT
,
778 static const struct clk_parent_data spifc_parent_data
[] = {
779 { .fw_name
= "gp0" },
780 { .fw_name
= "fdiv2" },
781 { .fw_name
= "fdiv3" },
782 { .fw_name
= "fdiv2p5" },
783 { .fw_name
= "hifi" },
784 { .fw_name
= "fdiv4" },
785 { .fw_name
= "fdiv5" },
786 { .fw_name
= "fdiv7" }
789 static struct clk_regmap spifc_sel
= {
790 .data
= &(struct clk_regmap_mux_data
) {
791 .offset
= SPIFC_CLK_CTRL
,
795 .hw
.init
= &(struct clk_init_data
) {
797 .ops
= &clk_regmap_mux_ops
,
798 .parent_data
= spifc_parent_data
,
799 .num_parents
= ARRAY_SIZE(spifc_parent_data
),
803 static struct clk_regmap spifc_div
= {
804 .data
= &(struct clk_regmap_div_data
) {
805 .offset
= SPIFC_CLK_CTRL
,
809 .hw
.init
= &(struct clk_init_data
) {
811 .ops
= &clk_regmap_divider_ops
,
812 .parent_hws
= (const struct clk_hw
*[]) {
816 .flags
= CLK_SET_RATE_PARENT
,
820 static struct clk_regmap spifc
= {
821 .data
= &(struct clk_regmap_gate_data
) {
822 .offset
= SPIFC_CLK_CTRL
,
825 .hw
.init
= &(struct clk_init_data
) {
827 .ops
= &clk_regmap_gate_ops
,
828 .parent_hws
= (const struct clk_hw
*[]) {
832 .flags
= CLK_SET_RATE_PARENT
,
836 static const struct clk_parent_data emmc_parent_data
[] = {
837 { .fw_name
= "oscin" },
838 { .fw_name
= "fdiv2" },
839 { .fw_name
= "fdiv3" },
840 { .fw_name
= "hifi" },
841 { .fw_name
= "fdiv2p5" },
842 { .fw_name
= "fdiv4" },
843 { .fw_name
= "gp1" },
847 static struct clk_regmap sd_emmc_a_sel
= {
848 .data
= &(struct clk_regmap_mux_data
) {
849 .offset
= SD_EMMC_CLK_CTRL
,
853 .hw
.init
= &(struct clk_init_data
) {
854 .name
= "sd_emmc_a_sel",
855 .ops
= &clk_regmap_mux_ops
,
856 .parent_data
= emmc_parent_data
,
857 .num_parents
= ARRAY_SIZE(emmc_parent_data
),
861 static struct clk_regmap sd_emmc_a_div
= {
862 .data
= &(struct clk_regmap_div_data
) {
863 .offset
= SD_EMMC_CLK_CTRL
,
867 .hw
.init
= &(struct clk_init_data
) {
868 .name
= "sd_emmc_a_div",
869 .ops
= &clk_regmap_divider_ops
,
870 .parent_hws
= (const struct clk_hw
*[]) {
874 .flags
= CLK_SET_RATE_PARENT
,
878 static struct clk_regmap sd_emmc_a
= {
879 .data
= &(struct clk_regmap_gate_data
) {
880 .offset
= SD_EMMC_CLK_CTRL
,
883 .hw
.init
= &(struct clk_init_data
) {
885 .ops
= &clk_regmap_gate_ops
,
886 .parent_hws
= (const struct clk_hw
*[]) {
890 .flags
= CLK_SET_RATE_PARENT
,
894 static struct clk_regmap sd_emmc_b_sel
= {
895 .data
= &(struct clk_regmap_mux_data
) {
896 .offset
= SD_EMMC_CLK_CTRL
,
900 .hw
.init
= &(struct clk_init_data
) {
901 .name
= "sd_emmc_b_sel",
902 .ops
= &clk_regmap_mux_ops
,
903 .parent_data
= emmc_parent_data
,
904 .num_parents
= ARRAY_SIZE(emmc_parent_data
),
908 static struct clk_regmap sd_emmc_b_div
= {
909 .data
= &(struct clk_regmap_div_data
) {
910 .offset
= SD_EMMC_CLK_CTRL
,
914 .hw
.init
= &(struct clk_init_data
) {
915 .name
= "sd_emmc_b_div",
916 .ops
= &clk_regmap_divider_ops
,
917 .parent_hws
= (const struct clk_hw
*[]) {
921 .flags
= CLK_SET_RATE_PARENT
,
925 static struct clk_regmap sd_emmc_b
= {
926 .data
= &(struct clk_regmap_gate_data
) {
927 .offset
= SD_EMMC_CLK_CTRL
,
930 .hw
.init
= &(struct clk_init_data
) {
932 .ops
= &clk_regmap_gate_ops
,
933 .parent_hws
= (const struct clk_hw
*[]) {
937 .flags
= CLK_SET_RATE_PARENT
,
941 static struct clk_regmap sd_emmc_c_sel
= {
942 .data
= &(struct clk_regmap_mux_data
) {
943 .offset
= NAND_CLK_CTRL
,
947 .hw
.init
= &(struct clk_init_data
) {
948 .name
= "sd_emmc_c_sel",
949 .ops
= &clk_regmap_mux_ops
,
950 .parent_data
= emmc_parent_data
,
951 .num_parents
= ARRAY_SIZE(emmc_parent_data
),
955 static struct clk_regmap sd_emmc_c_div
= {
956 .data
= &(struct clk_regmap_div_data
) {
957 .offset
= NAND_CLK_CTRL
,
961 .hw
.init
= &(struct clk_init_data
) {
962 .name
= "sd_emmc_c_div",
963 .ops
= &clk_regmap_divider_ops
,
964 .parent_hws
= (const struct clk_hw
*[]) {
968 .flags
= CLK_SET_RATE_PARENT
,
972 static struct clk_regmap sd_emmc_c
= {
973 .data
= &(struct clk_regmap_gate_data
) {
974 .offset
= NAND_CLK_CTRL
,
977 .hw
.init
= &(struct clk_init_data
) {
979 .ops
= &clk_regmap_gate_ops
,
980 .parent_hws
= (const struct clk_hw
*[]) {
984 .flags
= CLK_SET_RATE_PARENT
,
988 static struct clk_regmap ts_div
= {
989 .data
= &(struct clk_regmap_div_data
) {
990 .offset
= TS_CLK_CTRL
,
994 .hw
.init
= &(struct clk_init_data
) {
996 .ops
= &clk_regmap_divider_ops
,
997 .parent_data
= &(const struct clk_parent_data
) {
1004 static struct clk_regmap ts
= {
1005 .data
= &(struct clk_regmap_gate_data
) {
1006 .offset
= TS_CLK_CTRL
,
1009 .hw
.init
= &(struct clk_init_data
) {
1011 .ops
= &clk_regmap_gate_ops
,
1012 .parent_hws
= (const struct clk_hw
*[]) {
1016 .flags
= CLK_SET_RATE_PARENT
,
1020 static const struct clk_parent_data eth_parent
= {
1024 static struct clk_fixed_factor eth_125m_div
= {
1027 .hw
.init
= &(struct clk_init_data
) {
1028 .name
= "eth_125m_div",
1029 .ops
= &clk_fixed_factor_ops
,
1030 .parent_data
= ð_parent
,
1035 static struct clk_regmap eth_125m
= {
1036 .data
= &(struct clk_regmap_gate_data
) {
1037 .offset
= ETH_CLK_CTRL
,
1040 .hw
.init
= &(struct clk_init_data
) {
1042 .ops
= &clk_regmap_gate_ops
,
1043 .parent_hws
= (const struct clk_hw
*[]) {
1047 .flags
= CLK_SET_RATE_PARENT
,
1051 static struct clk_regmap eth_rmii_div
= {
1052 .data
= &(struct clk_regmap_div_data
) {
1053 .offset
= ETH_CLK_CTRL
,
1057 .hw
.init
= &(struct clk_init_data
) {
1058 .name
= "eth_rmii_div",
1059 .ops
= &clk_regmap_divider_ops
,
1060 .parent_data
= ð_parent
,
1065 static struct clk_regmap eth_rmii
= {
1066 .data
= &(struct clk_regmap_gate_data
) {
1067 .offset
= ETH_CLK_CTRL
,
1070 .hw
.init
= &(struct clk_init_data
) {
1072 .ops
= &clk_regmap_gate_ops
,
1073 .parent_hws
= (const struct clk_hw
*[]) {
1077 .flags
= CLK_SET_RATE_PARENT
,
1081 static const struct clk_parent_data mipi_dsi_meas_parent_data
[] = {
1082 { .fw_name
= "oscin" },
1083 { .fw_name
= "fdiv4" },
1084 { .fw_name
= "fdiv3" },
1085 { .fw_name
= "fdiv5" },
1086 { .fw_name
= "gp1" },
1087 { .fw_name
= "gp0" },
1088 { .fw_name
= "fdiv2" },
1089 { .fw_name
= "fdiv7" }
1092 static struct clk_regmap mipi_dsi_meas_sel
= {
1093 .data
= &(struct clk_regmap_mux_data
) {
1094 .offset
= VDIN_MEAS_CLK_CTRL
,
1098 .hw
.init
= &(struct clk_init_data
) {
1099 .name
= "mipi_dsi_meas_sel",
1100 .ops
= &clk_regmap_mux_ops
,
1101 .parent_data
= mipi_dsi_meas_parent_data
,
1102 .num_parents
= ARRAY_SIZE(mipi_dsi_meas_parent_data
),
1106 static struct clk_regmap mipi_dsi_meas_div
= {
1107 .data
= &(struct clk_regmap_div_data
) {
1108 .offset
= VDIN_MEAS_CLK_CTRL
,
1112 .hw
.init
= &(struct clk_init_data
) {
1113 .name
= "mipi_dsi_meas_div",
1114 .ops
= &clk_regmap_divider_ops
,
1115 .parent_hws
= (const struct clk_hw
*[]) {
1116 &mipi_dsi_meas_sel
.hw
1119 .flags
= CLK_SET_RATE_PARENT
,
1123 static struct clk_regmap mipi_dsi_meas
= {
1124 .data
= &(struct clk_regmap_gate_data
) {
1125 .offset
= VDIN_MEAS_CLK_CTRL
,
1128 .hw
.init
= &(struct clk_init_data
) {
1129 .name
= "mipi_dsi_meas",
1130 .ops
= &clk_regmap_gate_ops
,
1131 .parent_hws
= (const struct clk_hw
*[]) {
1132 &mipi_dsi_meas_div
.hw
1135 .flags
= CLK_SET_RATE_PARENT
,
1139 static const struct clk_parent_data dsi_phy_parent_data
[] = {
1140 { .fw_name
= "gp1" },
1141 { .fw_name
= "gp0" },
1142 { .fw_name
= "hifi" },
1143 { .fw_name
= "fdiv3" },
1144 { .fw_name
= "fdiv2" },
1145 { .fw_name
= "fdiv2p5" },
1146 { .fw_name
= "fdiv4" },
1147 { .fw_name
= "fdiv7" }
1150 static struct clk_regmap dsi_phy_sel
= {
1151 .data
= &(struct clk_regmap_mux_data
) {
1152 .offset
= MIPIDSI_PHY_CLK_CTRL
,
1156 .hw
.init
= &(struct clk_init_data
) {
1157 .name
= "dsi_phy_sel",
1158 .ops
= &clk_regmap_mux_ops
,
1159 .parent_data
= dsi_phy_parent_data
,
1160 .num_parents
= ARRAY_SIZE(dsi_phy_parent_data
),
1164 static struct clk_regmap dsi_phy_div
= {
1165 .data
= &(struct clk_regmap_div_data
) {
1166 .offset
= MIPIDSI_PHY_CLK_CTRL
,
1170 .hw
.init
= &(struct clk_init_data
) {
1171 .name
= "dsi_phy_div",
1172 .ops
= &clk_regmap_divider_ops
,
1173 .parent_hws
= (const struct clk_hw
*[]) {
1177 .flags
= CLK_SET_RATE_PARENT
,
1181 static struct clk_regmap dsi_phy
= {
1182 .data
= &(struct clk_regmap_gate_data
) {
1183 .offset
= MIPIDSI_PHY_CLK_CTRL
,
1186 .hw
.init
= &(struct clk_init_data
) {
1188 .ops
= &clk_regmap_gate_ops
,
1189 .parent_hws
= (const struct clk_hw
*[]) {
1193 .flags
= CLK_SET_RATE_PARENT
,
1197 static const struct clk_parent_data vout_mclk_parent_data
[] = {
1198 { .fw_name
= "fdiv2p5" },
1199 { .fw_name
= "fdiv3" },
1200 { .fw_name
= "fdiv4" },
1201 { .fw_name
= "fdiv5" },
1202 { .fw_name
= "gp0" },
1203 { .fw_name
= "hifi" },
1204 { .fw_name
= "gp1" },
1205 { .fw_name
= "fdiv7" }
1208 static struct clk_regmap vout_mclk_sel
= {
1209 .data
= &(struct clk_regmap_mux_data
) {
1210 .offset
= VOUTENC_CLK_CTRL
,
1214 .hw
.init
= &(struct clk_init_data
) {
1215 .name
= "vout_mclk_sel",
1216 .ops
= &clk_regmap_mux_ops
,
1217 .parent_data
= vout_mclk_parent_data
,
1218 .num_parents
= ARRAY_SIZE(vout_mclk_parent_data
),
1222 static struct clk_regmap vout_mclk_div
= {
1223 .data
= &(struct clk_regmap_div_data
) {
1224 .offset
= VOUTENC_CLK_CTRL
,
1228 .hw
.init
= &(struct clk_init_data
) {
1229 .name
= "vout_mclk_div",
1230 .ops
= &clk_regmap_divider_ops
,
1231 .parent_hws
= (const struct clk_hw
*[]) {
1235 .flags
= CLK_SET_RATE_PARENT
,
1239 static struct clk_regmap vout_mclk
= {
1240 .data
= &(struct clk_regmap_gate_data
) {
1241 .offset
= VOUTENC_CLK_CTRL
,
1244 .hw
.init
= &(struct clk_init_data
) {
1245 .name
= "vout_mclk",
1246 .ops
= &clk_regmap_gate_ops
,
1247 .parent_hws
= (const struct clk_hw
*[]) {
1251 .flags
= CLK_SET_RATE_PARENT
,
1255 static const struct clk_parent_data vout_enc_parent_data
[] = {
1256 { .fw_name
= "gp1" },
1257 { .fw_name
= "fdiv3" },
1258 { .fw_name
= "fdiv4" },
1259 { .fw_name
= "fdiv5" },
1260 { .fw_name
= "gp0" },
1261 { .fw_name
= "hifi" },
1262 { .fw_name
= "fdiv2p5" },
1263 { .fw_name
= "fdiv7" }
1266 static struct clk_regmap vout_enc_sel
= {
1267 .data
= &(struct clk_regmap_mux_data
) {
1268 .offset
= VOUTENC_CLK_CTRL
,
1272 .hw
.init
= &(struct clk_init_data
) {
1273 .name
= "vout_enc_sel",
1274 .ops
= &clk_regmap_mux_ops
,
1275 .parent_data
= vout_enc_parent_data
,
1276 .num_parents
= ARRAY_SIZE(vout_enc_parent_data
),
1280 static struct clk_regmap vout_enc_div
= {
1281 .data
= &(struct clk_regmap_div_data
) {
1282 .offset
= VOUTENC_CLK_CTRL
,
1286 .hw
.init
= &(struct clk_init_data
) {
1287 .name
= "vout_enc_div",
1288 .ops
= &clk_regmap_divider_ops
,
1289 .parent_hws
= (const struct clk_hw
*[]) {
1293 .flags
= CLK_SET_RATE_PARENT
,
1297 static struct clk_regmap vout_enc
= {
1298 .data
= &(struct clk_regmap_gate_data
) {
1299 .offset
= VOUTENC_CLK_CTRL
,
1302 .hw
.init
= &(struct clk_init_data
) {
1304 .ops
= &clk_regmap_gate_ops
,
1305 .parent_hws
= (const struct clk_hw
*[]) {
1309 .flags
= CLK_SET_RATE_PARENT
,
1313 static const struct clk_parent_data hcodec_pre_parent_data
[] = {
1314 { .fw_name
= "fdiv2p5" },
1315 { .fw_name
= "fdiv3" },
1316 { .fw_name
= "fdiv4" },
1317 { .fw_name
= "fdiv5" },
1318 { .fw_name
= "fdiv7" },
1319 { .fw_name
= "hifi" },
1320 { .fw_name
= "gp0" },
1321 { .fw_name
= "oscin" }
1324 static struct clk_regmap hcodec_0_sel
= {
1325 .data
= &(struct clk_regmap_mux_data
) {
1326 .offset
= VDEC_CLK_CTRL
,
1330 .hw
.init
= &(struct clk_init_data
) {
1331 .name
= "hcodec_0_sel",
1332 .ops
= &clk_regmap_mux_ops
,
1333 .parent_data
= hcodec_pre_parent_data
,
1334 .num_parents
= ARRAY_SIZE(hcodec_pre_parent_data
),
1338 static struct clk_regmap hcodec_0_div
= {
1339 .data
= &(struct clk_regmap_div_data
) {
1340 .offset
= VDEC_CLK_CTRL
,
1344 .hw
.init
= &(struct clk_init_data
) {
1345 .name
= "hcodec_0_div",
1346 .ops
= &clk_regmap_divider_ops
,
1347 .parent_hws
= (const struct clk_hw
*[]) {
1351 .flags
= CLK_SET_RATE_PARENT
,
1355 static struct clk_regmap hcodec_0
= {
1356 .data
= &(struct clk_regmap_gate_data
) {
1357 .offset
= VDEC_CLK_CTRL
,
1360 .hw
.init
= &(struct clk_init_data
) {
1362 .ops
= &clk_regmap_gate_ops
,
1363 .parent_hws
= (const struct clk_hw
*[]) {
1367 .flags
= CLK_SET_RATE_PARENT
,
1371 static struct clk_regmap hcodec_1_sel
= {
1372 .data
= &(struct clk_regmap_mux_data
) {
1373 .offset
= VDEC3_CLK_CTRL
,
1377 .hw
.init
= &(struct clk_init_data
) {
1378 .name
= "hcodec_1_sel",
1379 .ops
= &clk_regmap_mux_ops
,
1380 .parent_data
= hcodec_pre_parent_data
,
1381 .num_parents
= ARRAY_SIZE(hcodec_pre_parent_data
),
1385 static struct clk_regmap hcodec_1_div
= {
1386 .data
= &(struct clk_regmap_div_data
) {
1387 .offset
= VDEC3_CLK_CTRL
,
1391 .hw
.init
= &(struct clk_init_data
) {
1392 .name
= "hcodec_1_div",
1393 .ops
= &clk_regmap_divider_ops
,
1394 .parent_hws
= (const struct clk_hw
*[]) {
1398 .flags
= CLK_SET_RATE_PARENT
,
1402 static struct clk_regmap hcodec_1
= {
1403 .data
= &(struct clk_regmap_gate_data
) {
1404 .offset
= VDEC3_CLK_CTRL
,
1407 .hw
.init
= &(struct clk_init_data
) {
1409 .ops
= &clk_regmap_gate_ops
,
1410 .parent_hws
= (const struct clk_hw
*[]) {
1414 .flags
= CLK_SET_RATE_PARENT
,
1418 static const struct clk_parent_data hcodec_parent_data
[] = {
1419 { .hw
= &hcodec_0
.hw
},
1420 { .hw
= &hcodec_1
.hw
}
1423 static struct clk_regmap hcodec
= {
1424 .data
= &(struct clk_regmap_mux_data
) {
1425 .offset
= VDEC3_CLK_CTRL
,
1429 .hw
.init
= &(struct clk_init_data
) {
1431 .ops
= &clk_regmap_mux_ops
,
1432 .parent_data
= hcodec_parent_data
,
1433 .num_parents
= ARRAY_SIZE(hcodec_parent_data
),
1434 .flags
= CLK_SET_RATE_PARENT
,
1438 static const struct clk_parent_data vc9000e_parent_data
[] = {
1439 { .fw_name
= "oscin" },
1440 { .fw_name
= "fdiv4" },
1441 { .fw_name
= "fdiv3" },
1442 { .fw_name
= "fdiv5" },
1443 { .fw_name
= "fdiv7" },
1444 { .fw_name
= "fdiv2p5" },
1445 { .fw_name
= "hifi" },
1446 { .fw_name
= "gp0" }
1449 static struct clk_regmap vc9000e_aclk_sel
= {
1450 .data
= &(struct clk_regmap_mux_data
) {
1451 .offset
= VC9000E_CLK_CTRL
,
1455 .hw
.init
= &(struct clk_init_data
) {
1456 .name
= "vc9000e_aclk_sel",
1457 .ops
= &clk_regmap_mux_ops
,
1458 .parent_data
= vc9000e_parent_data
,
1459 .num_parents
= ARRAY_SIZE(vc9000e_parent_data
),
1463 static struct clk_regmap vc9000e_aclk_div
= {
1464 .data
= &(struct clk_regmap_div_data
) {
1465 .offset
= VC9000E_CLK_CTRL
,
1469 .hw
.init
= &(struct clk_init_data
) {
1470 .name
= "vc9000e_aclk_div",
1471 .ops
= &clk_regmap_divider_ops
,
1472 .parent_hws
= (const struct clk_hw
*[]) {
1473 &vc9000e_aclk_sel
.hw
1476 .flags
= CLK_SET_RATE_PARENT
,
1480 static struct clk_regmap vc9000e_aclk
= {
1481 .data
= &(struct clk_regmap_gate_data
) {
1482 .offset
= VC9000E_CLK_CTRL
,
1485 .hw
.init
= &(struct clk_init_data
) {
1486 .name
= "vc9000e_aclk",
1487 .ops
= &clk_regmap_gate_ops
,
1488 .parent_hws
= (const struct clk_hw
*[]) {
1489 &vc9000e_aclk_div
.hw
1492 .flags
= CLK_SET_RATE_PARENT
,
1496 static struct clk_regmap vc9000e_core_sel
= {
1497 .data
= &(struct clk_regmap_mux_data
) {
1498 .offset
= VC9000E_CLK_CTRL
,
1502 .hw
.init
= &(struct clk_init_data
) {
1503 .name
= "vc9000e_core_sel",
1504 .ops
= &clk_regmap_mux_ops
,
1505 .parent_data
= vc9000e_parent_data
,
1506 .num_parents
= ARRAY_SIZE(vc9000e_parent_data
),
1510 static struct clk_regmap vc9000e_core_div
= {
1511 .data
= &(struct clk_regmap_div_data
) {
1512 .offset
= VC9000E_CLK_CTRL
,
1516 .hw
.init
= &(struct clk_init_data
) {
1517 .name
= "vc9000e_core_div",
1518 .ops
= &clk_regmap_divider_ops
,
1519 .parent_hws
= (const struct clk_hw
*[]) {
1520 &vc9000e_core_sel
.hw
1523 .flags
= CLK_SET_RATE_PARENT
,
1527 static struct clk_regmap vc9000e_core
= {
1528 .data
= &(struct clk_regmap_gate_data
) {
1529 .offset
= VC9000E_CLK_CTRL
,
1532 .hw
.init
= &(struct clk_init_data
) {
1533 .name
= "vc9000e_core",
1534 .ops
= &clk_regmap_gate_ops
,
1535 .parent_hws
= (const struct clk_hw
*[]) {
1536 &vc9000e_core_div
.hw
1539 .flags
= CLK_SET_RATE_PARENT
,
1543 static const struct clk_parent_data csi_phy_parent_data
[] = {
1544 { .fw_name
= "fdiv2p5" },
1545 { .fw_name
= "fdiv3" },
1546 { .fw_name
= "fdiv4" },
1547 { .fw_name
= "fdiv5" },
1548 { .fw_name
= "gp0" },
1549 { .fw_name
= "hifi" },
1550 { .fw_name
= "gp1" },
1551 { .fw_name
= "oscin" }
1554 static struct clk_regmap csi_phy0_sel
= {
1555 .data
= &(struct clk_regmap_mux_data
) {
1556 .offset
= ISP0_CLK_CTRL
,
1560 .hw
.init
= &(struct clk_init_data
) {
1561 .name
= "csi_phy0_sel",
1562 .ops
= &clk_regmap_mux_ops
,
1563 .parent_data
= csi_phy_parent_data
,
1564 .num_parents
= ARRAY_SIZE(csi_phy_parent_data
),
1568 static struct clk_regmap csi_phy0_div
= {
1569 .data
= &(struct clk_regmap_div_data
) {
1570 .offset
= ISP0_CLK_CTRL
,
1574 .hw
.init
= &(struct clk_init_data
) {
1575 .name
= "csi_phy0_div",
1576 .ops
= &clk_regmap_divider_ops
,
1577 .parent_hws
= (const struct clk_hw
*[]) {
1581 .flags
= CLK_SET_RATE_PARENT
,
1585 static struct clk_regmap csi_phy0
= {
1586 .data
= &(struct clk_regmap_gate_data
) {
1587 .offset
= ISP0_CLK_CTRL
,
1590 .hw
.init
= &(struct clk_init_data
) {
1592 .ops
= &clk_regmap_gate_ops
,
1593 .parent_hws
= (const struct clk_hw
*[]) {
1597 .flags
= CLK_SET_RATE_PARENT
,
1601 static const struct clk_parent_data dewarpa_parent_data
[] = {
1602 { .fw_name
= "fdiv2p5" },
1603 { .fw_name
= "fdiv3" },
1604 { .fw_name
= "fdiv4" },
1605 { .fw_name
= "fdiv5" },
1606 { .fw_name
= "gp0" },
1607 { .fw_name
= "hifi" },
1608 { .fw_name
= "gp1" },
1609 { .fw_name
= "fdiv7" }
1612 static struct clk_regmap dewarpa_sel
= {
1613 .data
= &(struct clk_regmap_mux_data
) {
1614 .offset
= DEWARPA_CLK_CTRL
,
1618 .hw
.init
= &(struct clk_init_data
) {
1619 .name
= "dewarpa_sel",
1620 .ops
= &clk_regmap_mux_ops
,
1621 .parent_data
= dewarpa_parent_data
,
1622 .num_parents
= ARRAY_SIZE(dewarpa_parent_data
),
1626 static struct clk_regmap dewarpa_div
= {
1627 .data
= &(struct clk_regmap_div_data
) {
1628 .offset
= DEWARPA_CLK_CTRL
,
1632 .hw
.init
= &(struct clk_init_data
) {
1633 .name
= "dewarpa_div",
1634 .ops
= &clk_regmap_divider_ops
,
1635 .parent_hws
= (const struct clk_hw
*[]) {
1639 .flags
= CLK_SET_RATE_PARENT
,
1643 static struct clk_regmap dewarpa
= {
1644 .data
= &(struct clk_regmap_gate_data
) {
1645 .offset
= DEWARPA_CLK_CTRL
,
1648 .hw
.init
= &(struct clk_init_data
) {
1650 .ops
= &clk_regmap_gate_ops
,
1651 .parent_hws
= (const struct clk_hw
*[]) {
1655 .flags
= CLK_SET_RATE_PARENT
,
1659 static const struct clk_parent_data isp_parent_data
[] = {
1660 { .fw_name
= "fdiv2p5" },
1661 { .fw_name
= "fdiv3" },
1662 { .fw_name
= "fdiv4" },
1663 { .fw_name
= "fdiv5" },
1664 { .fw_name
= "gp0" },
1665 { .fw_name
= "hifi" },
1666 { .fw_name
= "gp1" },
1667 { .fw_name
= "oscin" }
1670 static struct clk_regmap isp0_sel
= {
1671 .data
= &(struct clk_regmap_mux_data
) {
1672 .offset
= ISP0_CLK_CTRL
,
1676 .hw
.init
= &(struct clk_init_data
) {
1678 .ops
= &clk_regmap_mux_ops
,
1679 .parent_data
= isp_parent_data
,
1680 .num_parents
= ARRAY_SIZE(isp_parent_data
),
1684 static struct clk_regmap isp0_div
= {
1685 .data
= &(struct clk_regmap_div_data
) {
1686 .offset
= ISP0_CLK_CTRL
,
1690 .hw
.init
= &(struct clk_init_data
) {
1692 .ops
= &clk_regmap_divider_ops
,
1693 .parent_hws
= (const struct clk_hw
*[]) {
1697 .flags
= CLK_SET_RATE_PARENT
,
1701 static struct clk_regmap isp0
= {
1702 .data
= &(struct clk_regmap_gate_data
) {
1703 .offset
= ISP0_CLK_CTRL
,
1706 .hw
.init
= &(struct clk_init_data
) {
1708 .ops
= &clk_regmap_gate_ops
,
1709 .parent_hws
= (const struct clk_hw
*[]) {
1713 .flags
= CLK_SET_RATE_PARENT
,
1717 static const struct clk_parent_data nna_core_parent_data
[] = {
1718 { .fw_name
= "oscin" },
1719 { .fw_name
= "fdiv2p5" },
1720 { .fw_name
= "fdiv4" },
1721 { .fw_name
= "fdiv3" },
1722 { .fw_name
= "fdiv5" },
1723 { .fw_name
= "fdiv2" },
1724 { .fw_name
= "gp1" },
1725 { .fw_name
= "hifi" }
1728 static struct clk_regmap nna_core_sel
= {
1729 .data
= &(struct clk_regmap_mux_data
) {
1730 .offset
= NNA_CLK_CTRL
,
1734 .hw
.init
= &(struct clk_init_data
) {
1735 .name
= "nna_core_sel",
1736 .ops
= &clk_regmap_mux_ops
,
1737 .parent_data
= nna_core_parent_data
,
1738 .num_parents
= ARRAY_SIZE(nna_core_parent_data
),
1742 static struct clk_regmap nna_core_div
= {
1743 .data
= &(struct clk_regmap_div_data
) {
1744 .offset
= NNA_CLK_CTRL
,
1748 .hw
.init
= &(struct clk_init_data
) {
1749 .name
= "nna_core_div",
1750 .ops
= &clk_regmap_divider_ops
,
1751 .parent_hws
= (const struct clk_hw
*[]) {
1755 .flags
= CLK_SET_RATE_PARENT
,
1759 static struct clk_regmap nna_core
= {
1760 .data
= &(struct clk_regmap_gate_data
) {
1761 .offset
= NNA_CLK_CTRL
,
1764 .hw
.init
= &(struct clk_init_data
) {
1766 .ops
= &clk_regmap_gate_ops
,
1767 .parent_hws
= (const struct clk_hw
*[]) {
1771 .flags
= CLK_SET_RATE_PARENT
,
1775 static const struct clk_parent_data ge2d_parent_data
[] = {
1776 { .fw_name
= "oscin" },
1777 { .fw_name
= "fdiv2p5" },
1778 { .fw_name
= "fdiv3" },
1779 { .fw_name
= "fdiv4" },
1780 { .fw_name
= "hifi" },
1781 { .fw_name
= "fdiv5" },
1782 { .fw_name
= "gp0" },
1783 { .hw
= &rtc_clk
.hw
}
1786 static struct clk_regmap ge2d_sel
= {
1787 .data
= &(struct clk_regmap_mux_data
) {
1788 .offset
= GE2D_CLK_CTRL
,
1792 .hw
.init
= &(struct clk_init_data
) {
1794 .ops
= &clk_regmap_mux_ops
,
1795 .parent_data
= ge2d_parent_data
,
1796 .num_parents
= ARRAY_SIZE(ge2d_parent_data
),
1800 static struct clk_regmap ge2d_div
= {
1801 .data
= &(struct clk_regmap_div_data
) {
1802 .offset
= GE2D_CLK_CTRL
,
1806 .hw
.init
= &(struct clk_init_data
) {
1808 .ops
= &clk_regmap_divider_ops
,
1809 .parent_hws
= (const struct clk_hw
*[]) {
1813 .flags
= CLK_SET_RATE_PARENT
,
1817 static struct clk_regmap ge2d
= {
1818 .data
= &(struct clk_regmap_gate_data
) {
1819 .offset
= GE2D_CLK_CTRL
,
1822 .hw
.init
= &(struct clk_init_data
) {
1824 .ops
= &clk_regmap_gate_ops
,
1825 .parent_hws
= (const struct clk_hw
*[]) {
1829 .flags
= CLK_SET_RATE_PARENT
,
1833 static const struct clk_parent_data vapb_parent_data
[] = {
1834 { .fw_name
= "fdiv2p5" },
1835 { .fw_name
= "fdiv3" },
1836 { .fw_name
= "fdiv4" },
1837 { .fw_name
= "fdiv5" },
1838 { .fw_name
= "gp0" },
1839 { .fw_name
= "hifi" },
1840 { .fw_name
= "gp1" },
1841 { .fw_name
= "oscin" },
1844 static struct clk_regmap vapb_sel
= {
1845 .data
= &(struct clk_regmap_mux_data
) {
1846 .offset
= VAPB_CLK_CTRL
,
1850 .hw
.init
= &(struct clk_init_data
) {
1852 .ops
= &clk_regmap_mux_ops
,
1853 .parent_data
= vapb_parent_data
,
1854 .num_parents
= ARRAY_SIZE(vapb_parent_data
),
1858 static struct clk_regmap vapb_div
= {
1859 .data
= &(struct clk_regmap_div_data
) {
1860 .offset
= VAPB_CLK_CTRL
,
1864 .hw
.init
= &(struct clk_init_data
) {
1866 .ops
= &clk_regmap_divider_ops
,
1867 .parent_hws
= (const struct clk_hw
*[]) {
1871 .flags
= CLK_SET_RATE_PARENT
,
1875 static struct clk_regmap vapb
= {
1876 .data
= &(struct clk_regmap_gate_data
) {
1877 .offset
= VAPB_CLK_CTRL
,
1880 .hw
.init
= &(struct clk_init_data
) {
1882 .ops
= &clk_regmap_gate_ops
,
1883 .parent_hws
= (const struct clk_hw
*[]) {
1887 .flags
= CLK_SET_RATE_PARENT
,
1891 static struct clk_hw
*c3_periphs_hw_clks
[] = {
1892 [CLKID_RTC_XTAL_CLKIN
] = &rtc_xtal_clkin
.hw
,
1893 [CLKID_RTC_32K_DIV
] = &rtc_32k_div
.hw
,
1894 [CLKID_RTC_32K_MUX
] = &rtc_32k_mux
.hw
,
1895 [CLKID_RTC_32K
] = &rtc_32k
.hw
,
1896 [CLKID_RTC_CLK
] = &rtc_clk
.hw
,
1897 [CLKID_SYS_RESET_CTRL
] = &sys_reset_ctrl
.hw
,
1898 [CLKID_SYS_PWR_CTRL
] = &sys_pwr_ctrl
.hw
,
1899 [CLKID_SYS_PAD_CTRL
] = &sys_pad_ctrl
.hw
,
1900 [CLKID_SYS_CTRL
] = &sys_ctrl
.hw
,
1901 [CLKID_SYS_TS_PLL
] = &sys_ts_pll
.hw
,
1902 [CLKID_SYS_DEV_ARB
] = &sys_dev_arb
.hw
,
1903 [CLKID_SYS_MMC_PCLK
] = &sys_mmc_pclk
.hw
,
1904 [CLKID_SYS_CPU_CTRL
] = &sys_cpu_ctrl
.hw
,
1905 [CLKID_SYS_JTAG_CTRL
] = &sys_jtag_ctrl
.hw
,
1906 [CLKID_SYS_IR_CTRL
] = &sys_ir_ctrl
.hw
,
1907 [CLKID_SYS_IRQ_CTRL
] = &sys_irq_ctrl
.hw
,
1908 [CLKID_SYS_MSR_CLK
] = &sys_msr_clk
.hw
,
1909 [CLKID_SYS_ROM
] = &sys_rom
.hw
,
1910 [CLKID_SYS_UART_F
] = &sys_uart_f
.hw
,
1911 [CLKID_SYS_CPU_ARB
] = &sys_cpu_apb
.hw
,
1912 [CLKID_SYS_RSA
] = &sys_rsa
.hw
,
1913 [CLKID_SYS_SAR_ADC
] = &sys_sar_adc
.hw
,
1914 [CLKID_SYS_STARTUP
] = &sys_startup
.hw
,
1915 [CLKID_SYS_SECURE
] = &sys_secure
.hw
,
1916 [CLKID_SYS_SPIFC
] = &sys_spifc
.hw
,
1917 [CLKID_SYS_NNA
] = &sys_nna
.hw
,
1918 [CLKID_SYS_ETH_MAC
] = &sys_eth_mac
.hw
,
1919 [CLKID_SYS_GIC
] = &sys_gic
.hw
,
1920 [CLKID_SYS_RAMA
] = &sys_rama
.hw
,
1921 [CLKID_SYS_BIG_NIC
] = &sys_big_nic
.hw
,
1922 [CLKID_SYS_RAMB
] = &sys_ramb
.hw
,
1923 [CLKID_SYS_AUDIO_PCLK
] = &sys_audio_pclk
.hw
,
1924 [CLKID_SYS_PWM_KL
] = &sys_pwm_kl
.hw
,
1925 [CLKID_SYS_PWM_IJ
] = &sys_pwm_ij
.hw
,
1926 [CLKID_SYS_USB
] = &sys_usb
.hw
,
1927 [CLKID_SYS_SD_EMMC_A
] = &sys_sd_emmc_a
.hw
,
1928 [CLKID_SYS_SD_EMMC_C
] = &sys_sd_emmc_c
.hw
,
1929 [CLKID_SYS_PWM_AB
] = &sys_pwm_ab
.hw
,
1930 [CLKID_SYS_PWM_CD
] = &sys_pwm_cd
.hw
,
1931 [CLKID_SYS_PWM_EF
] = &sys_pwm_ef
.hw
,
1932 [CLKID_SYS_PWM_GH
] = &sys_pwm_gh
.hw
,
1933 [CLKID_SYS_SPICC_1
] = &sys_spicc_1
.hw
,
1934 [CLKID_SYS_SPICC_0
] = &sys_spicc_0
.hw
,
1935 [CLKID_SYS_UART_A
] = &sys_uart_a
.hw
,
1936 [CLKID_SYS_UART_B
] = &sys_uart_b
.hw
,
1937 [CLKID_SYS_UART_C
] = &sys_uart_c
.hw
,
1938 [CLKID_SYS_UART_D
] = &sys_uart_d
.hw
,
1939 [CLKID_SYS_UART_E
] = &sys_uart_e
.hw
,
1940 [CLKID_SYS_I2C_M_A
] = &sys_i2c_m_a
.hw
,
1941 [CLKID_SYS_I2C_M_B
] = &sys_i2c_m_b
.hw
,
1942 [CLKID_SYS_I2C_M_C
] = &sys_i2c_m_c
.hw
,
1943 [CLKID_SYS_I2C_M_D
] = &sys_i2c_m_d
.hw
,
1944 [CLKID_SYS_I2S_S_A
] = &sys_i2c_s_a
.hw
,
1945 [CLKID_SYS_RTC
] = &sys_rtc
.hw
,
1946 [CLKID_SYS_GE2D
] = &sys_ge2d
.hw
,
1947 [CLKID_SYS_ISP
] = &sys_isp
.hw
,
1948 [CLKID_SYS_GPV_ISP_NIC
] = &sys_gpv_isp_nic
.hw
,
1949 [CLKID_SYS_GPV_CVE_NIC
] = &sys_gpv_cve_nic
.hw
,
1950 [CLKID_SYS_MIPI_DSI_HOST
] = &sys_mipi_dsi_host
.hw
,
1951 [CLKID_SYS_MIPI_DSI_PHY
] = &sys_mipi_dsi_phy
.hw
,
1952 [CLKID_SYS_ETH_PHY
] = &sys_eth_phy
.hw
,
1953 [CLKID_SYS_ACODEC
] = &sys_acodec
.hw
,
1954 [CLKID_SYS_DWAP
] = &sys_dwap
.hw
,
1955 [CLKID_SYS_DOS
] = &sys_dos
.hw
,
1956 [CLKID_SYS_CVE
] = &sys_cve
.hw
,
1957 [CLKID_SYS_VOUT
] = &sys_vout
.hw
,
1958 [CLKID_SYS_VC9000E
] = &sys_vc9000e
.hw
,
1959 [CLKID_SYS_PWM_MN
] = &sys_pwm_mn
.hw
,
1960 [CLKID_SYS_SD_EMMC_B
] = &sys_sd_emmc_b
.hw
,
1961 [CLKID_AXI_SYS_NIC
] = &axi_sys_nic
.hw
,
1962 [CLKID_AXI_ISP_NIC
] = &axi_isp_nic
.hw
,
1963 [CLKID_AXI_CVE_NIC
] = &axi_cve_nic
.hw
,
1964 [CLKID_AXI_RAMB
] = &axi_ramb
.hw
,
1965 [CLKID_AXI_RAMA
] = &axi_rama
.hw
,
1966 [CLKID_AXI_CPU_DMC
] = &axi_cpu_dmc
.hw
,
1967 [CLKID_AXI_NIC
] = &axi_nic
.hw
,
1968 [CLKID_AXI_DMA
] = &axi_dma
.hw
,
1969 [CLKID_AXI_MUX_NIC
] = &axi_mux_nic
.hw
,
1970 [CLKID_AXI_CVE
] = &axi_cve
.hw
,
1971 [CLKID_AXI_DEV1_DMC
] = &axi_dev1_dmc
.hw
,
1972 [CLKID_AXI_DEV0_DMC
] = &axi_dev0_dmc
.hw
,
1973 [CLKID_AXI_DSP_DMC
] = &axi_dsp_dmc
.hw
,
1974 [CLKID_12_24M_IN
] = &clk_12_24m_in
.hw
,
1975 [CLKID_12M_24M
] = &clk_12_24m
.hw
,
1976 [CLKID_FCLK_25M_DIV
] = &fclk_25m_div
.hw
,
1977 [CLKID_FCLK_25M
] = &fclk_25m
.hw
,
1978 [CLKID_GEN_SEL
] = &gen_sel
.hw
,
1979 [CLKID_GEN_DIV
] = &gen_div
.hw
,
1980 [CLKID_GEN
] = &gen
.hw
,
1981 [CLKID_SARADC_SEL
] = &saradc_sel
.hw
,
1982 [CLKID_SARADC_DIV
] = &saradc_div
.hw
,
1983 [CLKID_SARADC
] = &saradc
.hw
,
1984 [CLKID_PWM_A_SEL
] = &pwm_a_sel
.hw
,
1985 [CLKID_PWM_A_DIV
] = &pwm_a_div
.hw
,
1986 [CLKID_PWM_A
] = &pwm_a
.hw
,
1987 [CLKID_PWM_B_SEL
] = &pwm_b_sel
.hw
,
1988 [CLKID_PWM_B_DIV
] = &pwm_b_div
.hw
,
1989 [CLKID_PWM_B
] = &pwm_b
.hw
,
1990 [CLKID_PWM_C_SEL
] = &pwm_c_sel
.hw
,
1991 [CLKID_PWM_C_DIV
] = &pwm_c_div
.hw
,
1992 [CLKID_PWM_C
] = &pwm_c
.hw
,
1993 [CLKID_PWM_D_SEL
] = &pwm_d_sel
.hw
,
1994 [CLKID_PWM_D_DIV
] = &pwm_d_div
.hw
,
1995 [CLKID_PWM_D
] = &pwm_d
.hw
,
1996 [CLKID_PWM_E_SEL
] = &pwm_e_sel
.hw
,
1997 [CLKID_PWM_E_DIV
] = &pwm_e_div
.hw
,
1998 [CLKID_PWM_E
] = &pwm_e
.hw
,
1999 [CLKID_PWM_F_SEL
] = &pwm_f_sel
.hw
,
2000 [CLKID_PWM_F_DIV
] = &pwm_f_div
.hw
,
2001 [CLKID_PWM_F
] = &pwm_f
.hw
,
2002 [CLKID_PWM_G_SEL
] = &pwm_g_sel
.hw
,
2003 [CLKID_PWM_G_DIV
] = &pwm_g_div
.hw
,
2004 [CLKID_PWM_G
] = &pwm_g
.hw
,
2005 [CLKID_PWM_H_SEL
] = &pwm_h_sel
.hw
,
2006 [CLKID_PWM_H_DIV
] = &pwm_h_div
.hw
,
2007 [CLKID_PWM_H
] = &pwm_h
.hw
,
2008 [CLKID_PWM_I_SEL
] = &pwm_i_sel
.hw
,
2009 [CLKID_PWM_I_DIV
] = &pwm_i_div
.hw
,
2010 [CLKID_PWM_I
] = &pwm_i
.hw
,
2011 [CLKID_PWM_J_SEL
] = &pwm_j_sel
.hw
,
2012 [CLKID_PWM_J_DIV
] = &pwm_j_div
.hw
,
2013 [CLKID_PWM_J
] = &pwm_j
.hw
,
2014 [CLKID_PWM_K_SEL
] = &pwm_k_sel
.hw
,
2015 [CLKID_PWM_K_DIV
] = &pwm_k_div
.hw
,
2016 [CLKID_PWM_K
] = &pwm_k
.hw
,
2017 [CLKID_PWM_L_SEL
] = &pwm_l_sel
.hw
,
2018 [CLKID_PWM_L_DIV
] = &pwm_l_div
.hw
,
2019 [CLKID_PWM_L
] = &pwm_l
.hw
,
2020 [CLKID_PWM_M_SEL
] = &pwm_m_sel
.hw
,
2021 [CLKID_PWM_M_DIV
] = &pwm_m_div
.hw
,
2022 [CLKID_PWM_M
] = &pwm_m
.hw
,
2023 [CLKID_PWM_N_SEL
] = &pwm_n_sel
.hw
,
2024 [CLKID_PWM_N_DIV
] = &pwm_n_div
.hw
,
2025 [CLKID_PWM_N
] = &pwm_n
.hw
,
2026 [CLKID_SPICC_A_SEL
] = &spicc_a_sel
.hw
,
2027 [CLKID_SPICC_A_DIV
] = &spicc_a_div
.hw
,
2028 [CLKID_SPICC_A
] = &spicc_a
.hw
,
2029 [CLKID_SPICC_B_SEL
] = &spicc_b_sel
.hw
,
2030 [CLKID_SPICC_B_DIV
] = &spicc_b_div
.hw
,
2031 [CLKID_SPICC_B
] = &spicc_b
.hw
,
2032 [CLKID_SPIFC_SEL
] = &spifc_sel
.hw
,
2033 [CLKID_SPIFC_DIV
] = &spifc_div
.hw
,
2034 [CLKID_SPIFC
] = &spifc
.hw
,
2035 [CLKID_SD_EMMC_A_SEL
] = &sd_emmc_a_sel
.hw
,
2036 [CLKID_SD_EMMC_A_DIV
] = &sd_emmc_a_div
.hw
,
2037 [CLKID_SD_EMMC_A
] = &sd_emmc_a
.hw
,
2038 [CLKID_SD_EMMC_B_SEL
] = &sd_emmc_b_sel
.hw
,
2039 [CLKID_SD_EMMC_B_DIV
] = &sd_emmc_b_div
.hw
,
2040 [CLKID_SD_EMMC_B
] = &sd_emmc_b
.hw
,
2041 [CLKID_SD_EMMC_C_SEL
] = &sd_emmc_c_sel
.hw
,
2042 [CLKID_SD_EMMC_C_DIV
] = &sd_emmc_c_div
.hw
,
2043 [CLKID_SD_EMMC_C
] = &sd_emmc_c
.hw
,
2044 [CLKID_TS_DIV
] = &ts_div
.hw
,
2045 [CLKID_TS
] = &ts
.hw
,
2046 [CLKID_ETH_125M_DIV
] = ð_125m_div
.hw
,
2047 [CLKID_ETH_125M
] = ð_125m
.hw
,
2048 [CLKID_ETH_RMII_DIV
] = ð_rmii_div
.hw
,
2049 [CLKID_ETH_RMII
] = ð_rmii
.hw
,
2050 [CLKID_MIPI_DSI_MEAS_SEL
] = &mipi_dsi_meas_sel
.hw
,
2051 [CLKID_MIPI_DSI_MEAS_DIV
] = &mipi_dsi_meas_div
.hw
,
2052 [CLKID_MIPI_DSI_MEAS
] = &mipi_dsi_meas
.hw
,
2053 [CLKID_DSI_PHY_SEL
] = &dsi_phy_sel
.hw
,
2054 [CLKID_DSI_PHY_DIV
] = &dsi_phy_div
.hw
,
2055 [CLKID_DSI_PHY
] = &dsi_phy
.hw
,
2056 [CLKID_VOUT_MCLK_SEL
] = &vout_mclk_sel
.hw
,
2057 [CLKID_VOUT_MCLK_DIV
] = &vout_mclk_div
.hw
,
2058 [CLKID_VOUT_MCLK
] = &vout_mclk
.hw
,
2059 [CLKID_VOUT_ENC_SEL
] = &vout_enc_sel
.hw
,
2060 [CLKID_VOUT_ENC_DIV
] = &vout_enc_div
.hw
,
2061 [CLKID_VOUT_ENC
] = &vout_enc
.hw
,
2062 [CLKID_HCODEC_0_SEL
] = &hcodec_0_sel
.hw
,
2063 [CLKID_HCODEC_0_DIV
] = &hcodec_0_div
.hw
,
2064 [CLKID_HCODEC_0
] = &hcodec_0
.hw
,
2065 [CLKID_HCODEC_1_SEL
] = &hcodec_1_sel
.hw
,
2066 [CLKID_HCODEC_1_DIV
] = &hcodec_1_div
.hw
,
2067 [CLKID_HCODEC_1
] = &hcodec_1
.hw
,
2068 [CLKID_HCODEC
] = &hcodec
.hw
,
2069 [CLKID_VC9000E_ACLK_SEL
] = &vc9000e_aclk_sel
.hw
,
2070 [CLKID_VC9000E_ACLK_DIV
] = &vc9000e_aclk_div
.hw
,
2071 [CLKID_VC9000E_ACLK
] = &vc9000e_aclk
.hw
,
2072 [CLKID_VC9000E_CORE_SEL
] = &vc9000e_core_sel
.hw
,
2073 [CLKID_VC9000E_CORE_DIV
] = &vc9000e_core_div
.hw
,
2074 [CLKID_VC9000E_CORE
] = &vc9000e_core
.hw
,
2075 [CLKID_CSI_PHY0_SEL
] = &csi_phy0_sel
.hw
,
2076 [CLKID_CSI_PHY0_DIV
] = &csi_phy0_div
.hw
,
2077 [CLKID_CSI_PHY0
] = &csi_phy0
.hw
,
2078 [CLKID_DEWARPA_SEL
] = &dewarpa_sel
.hw
,
2079 [CLKID_DEWARPA_DIV
] = &dewarpa_div
.hw
,
2080 [CLKID_DEWARPA
] = &dewarpa
.hw
,
2081 [CLKID_ISP0_SEL
] = &isp0_sel
.hw
,
2082 [CLKID_ISP0_DIV
] = &isp0_div
.hw
,
2083 [CLKID_ISP0
] = &isp0
.hw
,
2084 [CLKID_NNA_CORE_SEL
] = &nna_core_sel
.hw
,
2085 [CLKID_NNA_CORE_DIV
] = &nna_core_div
.hw
,
2086 [CLKID_NNA_CORE
] = &nna_core
.hw
,
2087 [CLKID_GE2D_SEL
] = &ge2d_sel
.hw
,
2088 [CLKID_GE2D_DIV
] = &ge2d_div
.hw
,
2089 [CLKID_GE2D
] = &ge2d
.hw
,
2090 [CLKID_VAPB_SEL
] = &vapb_sel
.hw
,
2091 [CLKID_VAPB_DIV
] = &vapb_div
.hw
,
2092 [CLKID_VAPB
] = &vapb
.hw
,
2095 /* Convenience table to populate regmap in .probe */
2096 static struct clk_regmap
*const c3_periphs_clk_regmaps
[] = {
2299 static const struct regmap_config clkc_regmap_config
= {
2303 .max_register
= NNA_CLK_CTRL
,
2306 static struct meson_clk_hw_data c3_periphs_clks
= {
2307 .hws
= c3_periphs_hw_clks
,
2308 .num
= ARRAY_SIZE(c3_periphs_hw_clks
),
2311 static int c3_peripherals_probe(struct platform_device
*pdev
)
2313 struct device
*dev
= &pdev
->dev
;
2314 struct regmap
*regmap
;
2318 base
= devm_platform_ioremap_resource(pdev
, 0);
2320 return PTR_ERR(base
);
2322 regmap
= devm_regmap_init_mmio(dev
, base
, &clkc_regmap_config
);
2324 return PTR_ERR(regmap
);
2326 /* Populate regmap for the regmap backed clocks */
2327 for (i
= 0; i
< ARRAY_SIZE(c3_periphs_clk_regmaps
); i
++)
2328 c3_periphs_clk_regmaps
[i
]->map
= regmap
;
2330 for (clkid
= 0; clkid
< c3_periphs_clks
.num
; clkid
++) {
2331 /* array might be sparse */
2332 if (!c3_periphs_clks
.hws
[clkid
])
2335 ret
= devm_clk_hw_register(dev
, c3_periphs_clks
.hws
[clkid
]);
2337 dev_err(dev
, "Clock registration failed\n");
2342 return devm_of_clk_add_hw_provider(dev
, meson_clk_hw_get
,
2346 static const struct of_device_id c3_peripherals_clkc_match_table
[] = {
2348 .compatible
= "amlogic,c3-peripherals-clkc",
2353 MODULE_DEVICE_TABLE(of
, c3_peripherals_clkc_match_table
);
2355 static struct platform_driver c3_peripherals_driver
= {
2356 .probe
= c3_peripherals_probe
,
2358 .name
= "c3-peripherals-clkc",
2359 .of_match_table
= c3_peripherals_clkc_match_table
,
2362 module_platform_driver(c3_peripherals_driver
);
2364 MODULE_DESCRIPTION("Amlogic C3 Peripherals Clock Controller driver");
2365 MODULE_AUTHOR("Chuan Liu <chuan.liu@amlogic.com>");
2366 MODULE_LICENSE("GPL");
2367 MODULE_IMPORT_NS("CLK_MESON");