1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
6 #include <linux/clk-provider.h>
7 #include <linux/module.h>
8 #include <linux/platform_device.h>
9 #include <linux/regmap.h>
11 #include <dt-bindings/clock/qcom,camcc-sdm845.h>
14 #include "clk-alpha-pll.h"
15 #include "clk-branch.h"
17 #include "clk-regmap.h"
22 P_CAM_CC_PLL0_OUT_EVEN
,
23 P_CAM_CC_PLL1_OUT_EVEN
,
24 P_CAM_CC_PLL2_OUT_EVEN
,
25 P_CAM_CC_PLL3_OUT_EVEN
,
26 P_CORE_BI_PLL_TEST_SE
,
29 static const struct parent_map cam_cc_parent_map_0
[] = {
31 { P_CAM_CC_PLL2_OUT_EVEN
, 1 },
32 { P_CAM_CC_PLL1_OUT_EVEN
, 2 },
33 { P_CAM_CC_PLL3_OUT_EVEN
, 5 },
34 { P_CAM_CC_PLL0_OUT_EVEN
, 6 },
35 { P_CORE_BI_PLL_TEST_SE
, 7 },
38 static const char * const cam_cc_parent_names_0
[] = {
40 "cam_cc_pll2_out_even",
41 "cam_cc_pll1_out_even",
42 "cam_cc_pll3_out_even",
43 "cam_cc_pll0_out_even",
44 "core_bi_pll_test_se",
47 static struct clk_alpha_pll cam_cc_pll0
= {
49 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_FABIA
],
51 .hw
.init
= &(struct clk_init_data
){
52 .name
= "cam_cc_pll0",
53 .parent_names
= (const char *[]){ "bi_tcxo" },
55 .ops
= &clk_alpha_pll_fabia_ops
,
60 static const struct clk_div_table post_div_table_fabia_even
[] = {
66 static struct clk_alpha_pll_postdiv cam_cc_pll0_out_even
= {
69 .post_div_table
= post_div_table_fabia_even
,
70 .num_post_div
= ARRAY_SIZE(post_div_table_fabia_even
),
72 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_FABIA
],
73 .clkr
.hw
.init
= &(struct clk_init_data
){
74 .name
= "cam_cc_pll0_out_even",
75 .parent_names
= (const char *[]){ "cam_cc_pll0" },
77 .ops
= &clk_alpha_pll_postdiv_fabia_ops
,
81 static struct clk_alpha_pll cam_cc_pll1
= {
83 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_FABIA
],
85 .hw
.init
= &(struct clk_init_data
){
86 .name
= "cam_cc_pll1",
87 .parent_names
= (const char *[]){ "bi_tcxo" },
89 .ops
= &clk_alpha_pll_fabia_ops
,
94 static struct clk_alpha_pll_postdiv cam_cc_pll1_out_even
= {
97 .post_div_table
= post_div_table_fabia_even
,
98 .num_post_div
= ARRAY_SIZE(post_div_table_fabia_even
),
100 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_FABIA
],
101 .clkr
.hw
.init
= &(struct clk_init_data
){
102 .name
= "cam_cc_pll1_out_even",
103 .parent_names
= (const char *[]){ "cam_cc_pll1" },
105 .ops
= &clk_alpha_pll_postdiv_fabia_ops
,
109 static struct clk_alpha_pll cam_cc_pll2
= {
111 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_FABIA
],
113 .hw
.init
= &(struct clk_init_data
){
114 .name
= "cam_cc_pll2",
115 .parent_names
= (const char *[]){ "bi_tcxo" },
117 .ops
= &clk_alpha_pll_fabia_ops
,
122 static struct clk_alpha_pll_postdiv cam_cc_pll2_out_even
= {
125 .post_div_table
= post_div_table_fabia_even
,
126 .num_post_div
= ARRAY_SIZE(post_div_table_fabia_even
),
128 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_FABIA
],
129 .clkr
.hw
.init
= &(struct clk_init_data
){
130 .name
= "cam_cc_pll2_out_even",
131 .parent_names
= (const char *[]){ "cam_cc_pll2" },
133 .ops
= &clk_alpha_pll_postdiv_fabia_ops
,
137 static struct clk_alpha_pll cam_cc_pll3
= {
139 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_FABIA
],
141 .hw
.init
= &(struct clk_init_data
){
142 .name
= "cam_cc_pll3",
143 .parent_names
= (const char *[]){ "bi_tcxo" },
145 .ops
= &clk_alpha_pll_fabia_ops
,
150 static struct clk_alpha_pll_postdiv cam_cc_pll3_out_even
= {
153 .post_div_table
= post_div_table_fabia_even
,
154 .num_post_div
= ARRAY_SIZE(post_div_table_fabia_even
),
156 .regs
= clk_alpha_pll_regs
[CLK_ALPHA_PLL_TYPE_FABIA
],
157 .clkr
.hw
.init
= &(struct clk_init_data
){
158 .name
= "cam_cc_pll3_out_even",
159 .parent_names
= (const char *[]){ "cam_cc_pll3" },
161 .ops
= &clk_alpha_pll_postdiv_fabia_ops
,
165 static const struct freq_tbl ftbl_cam_cc_bps_clk_src
[] = {
166 F(19200000, P_BI_TCXO
, 1, 0, 0),
167 F(100000000, P_CAM_CC_PLL0_OUT_EVEN
, 6, 0, 0),
168 F(200000000, P_CAM_CC_PLL0_OUT_EVEN
, 3, 0, 0),
169 F(404000000, P_CAM_CC_PLL1_OUT_EVEN
, 2, 0, 0),
170 F(480000000, P_CAM_CC_PLL2_OUT_EVEN
, 1, 0, 0),
171 F(600000000, P_CAM_CC_PLL0_OUT_EVEN
, 1, 0, 0),
176 * As per HW design, some of the CAMCC RCGs needs to
177 * move to XO clock during their clock disable so using
178 * clk_rcg2_shared_ops for such RCGs. This is required
179 * to power down the camera memories gracefully.
180 * Also, use CLK_SET_RATE_PARENT flag for the RCGs which
181 * have CAM_CC_PLL2_OUT_EVEN PLL as parent in frequency
182 * table and requires reconfiguration of the PLL frequency.
184 static struct clk_rcg2 cam_cc_bps_clk_src
= {
188 .parent_map
= cam_cc_parent_map_0
,
189 .freq_tbl
= ftbl_cam_cc_bps_clk_src
,
190 .clkr
.hw
.init
= &(struct clk_init_data
){
191 .name
= "cam_cc_bps_clk_src",
192 .parent_names
= cam_cc_parent_names_0
,
194 .flags
= CLK_SET_RATE_PARENT
,
195 .ops
= &clk_rcg2_shared_ops
,
199 static const struct freq_tbl ftbl_cam_cc_cci_clk_src
[] = {
200 F(19200000, P_BI_TCXO
, 1, 0, 0),
201 F(37500000, P_CAM_CC_PLL0_OUT_EVEN
, 16, 0, 0),
202 F(50000000, P_CAM_CC_PLL0_OUT_EVEN
, 12, 0, 0),
203 F(100000000, P_CAM_CC_PLL0_OUT_EVEN
, 6, 0, 0),
207 static struct clk_rcg2 cam_cc_cci_clk_src
= {
211 .parent_map
= cam_cc_parent_map_0
,
212 .freq_tbl
= ftbl_cam_cc_cci_clk_src
,
213 .clkr
.hw
.init
= &(struct clk_init_data
){
214 .name
= "cam_cc_cci_clk_src",
215 .parent_names
= cam_cc_parent_names_0
,
217 .ops
= &clk_rcg2_ops
,
221 static const struct freq_tbl ftbl_cam_cc_cphy_rx_clk_src
[] = {
222 F(19200000, P_BI_TCXO
, 1, 0, 0),
223 F(384000000, P_CAM_CC_PLL3_OUT_EVEN
, 1, 0, 0),
227 static struct clk_rcg2 cam_cc_cphy_rx_clk_src
= {
231 .parent_map
= cam_cc_parent_map_0
,
232 .freq_tbl
= ftbl_cam_cc_cphy_rx_clk_src
,
233 .clkr
.hw
.init
= &(struct clk_init_data
){
234 .name
= "cam_cc_cphy_rx_clk_src",
235 .parent_names
= cam_cc_parent_names_0
,
237 .ops
= &clk_rcg2_ops
,
241 static const struct freq_tbl ftbl_cam_cc_csi0phytimer_clk_src
[] = {
242 F(19200000, P_BI_TCXO
, 1, 0, 0),
243 F(240000000, P_CAM_CC_PLL2_OUT_EVEN
, 2, 0, 0),
244 F(269333333, P_CAM_CC_PLL1_OUT_EVEN
, 3, 0, 0),
248 static struct clk_rcg2 cam_cc_csi0phytimer_clk_src
= {
252 .parent_map
= cam_cc_parent_map_0
,
253 .freq_tbl
= ftbl_cam_cc_csi0phytimer_clk_src
,
254 .clkr
.hw
.init
= &(struct clk_init_data
){
255 .name
= "cam_cc_csi0phytimer_clk_src",
256 .parent_names
= cam_cc_parent_names_0
,
258 .flags
= CLK_SET_RATE_PARENT
,
259 .ops
= &clk_rcg2_ops
,
263 static struct clk_rcg2 cam_cc_csi1phytimer_clk_src
= {
267 .parent_map
= cam_cc_parent_map_0
,
268 .freq_tbl
= ftbl_cam_cc_csi0phytimer_clk_src
,
269 .clkr
.hw
.init
= &(struct clk_init_data
){
270 .name
= "cam_cc_csi1phytimer_clk_src",
271 .parent_names
= cam_cc_parent_names_0
,
273 .flags
= CLK_SET_RATE_PARENT
,
274 .ops
= &clk_rcg2_ops
,
278 static struct clk_rcg2 cam_cc_csi2phytimer_clk_src
= {
282 .parent_map
= cam_cc_parent_map_0
,
283 .freq_tbl
= ftbl_cam_cc_csi0phytimer_clk_src
,
284 .clkr
.hw
.init
= &(struct clk_init_data
){
285 .name
= "cam_cc_csi2phytimer_clk_src",
286 .parent_names
= cam_cc_parent_names_0
,
288 .flags
= CLK_SET_RATE_PARENT
,
289 .ops
= &clk_rcg2_ops
,
293 static struct clk_rcg2 cam_cc_csi3phytimer_clk_src
= {
297 .parent_map
= cam_cc_parent_map_0
,
298 .freq_tbl
= ftbl_cam_cc_csi0phytimer_clk_src
,
299 .clkr
.hw
.init
= &(struct clk_init_data
){
300 .name
= "cam_cc_csi3phytimer_clk_src",
301 .parent_names
= cam_cc_parent_names_0
,
303 .flags
= CLK_SET_RATE_PARENT
,
304 .ops
= &clk_rcg2_ops
,
308 static const struct freq_tbl ftbl_cam_cc_fast_ahb_clk_src
[] = {
309 F(19200000, P_BI_TCXO
, 1, 0, 0),
310 F(50000000, P_CAM_CC_PLL0_OUT_EVEN
, 12, 0, 0),
311 F(100000000, P_CAM_CC_PLL0_OUT_EVEN
, 6, 0, 0),
312 F(200000000, P_CAM_CC_PLL0_OUT_EVEN
, 3, 0, 0),
313 F(300000000, P_CAM_CC_PLL0_OUT_EVEN
, 2, 0, 0),
314 F(400000000, P_CAM_CC_PLL0_OUT_EVEN
, 1.5, 0, 0),
318 static struct clk_rcg2 cam_cc_fast_ahb_clk_src
= {
322 .parent_map
= cam_cc_parent_map_0
,
323 .freq_tbl
= ftbl_cam_cc_fast_ahb_clk_src
,
324 .clkr
.hw
.init
= &(struct clk_init_data
){
325 .name
= "cam_cc_fast_ahb_clk_src",
326 .parent_names
= cam_cc_parent_names_0
,
328 .ops
= &clk_rcg2_ops
,
332 static const struct freq_tbl ftbl_cam_cc_fd_core_clk_src
[] = {
333 F(19200000, P_BI_TCXO
, 1, 0, 0),
334 F(384000000, P_CAM_CC_PLL3_OUT_EVEN
, 1, 0, 0),
335 F(400000000, P_CAM_CC_PLL0_OUT_EVEN
, 1.5, 0, 0),
336 F(538666667, P_CAM_CC_PLL1_OUT_EVEN
, 1.5, 0, 0),
337 F(600000000, P_CAM_CC_PLL0_OUT_EVEN
, 1, 0, 0),
341 static struct clk_rcg2 cam_cc_fd_core_clk_src
= {
345 .parent_map
= cam_cc_parent_map_0
,
346 .freq_tbl
= ftbl_cam_cc_fd_core_clk_src
,
347 .clkr
.hw
.init
= &(struct clk_init_data
){
348 .name
= "cam_cc_fd_core_clk_src",
349 .parent_names
= cam_cc_parent_names_0
,
351 .ops
= &clk_rcg2_shared_ops
,
355 static const struct freq_tbl ftbl_cam_cc_icp_clk_src
[] = {
356 F(19200000, P_BI_TCXO
, 1, 0, 0),
357 F(384000000, P_CAM_CC_PLL3_OUT_EVEN
, 1, 0, 0),
358 F(400000000, P_CAM_CC_PLL0_OUT_EVEN
, 1.5, 0, 0),
359 F(538666667, P_CAM_CC_PLL1_OUT_EVEN
, 1.5, 0, 0),
360 F(600000000, P_CAM_CC_PLL0_OUT_EVEN
, 1, 0, 0),
364 static struct clk_rcg2 cam_cc_icp_clk_src
= {
368 .parent_map
= cam_cc_parent_map_0
,
369 .freq_tbl
= ftbl_cam_cc_icp_clk_src
,
370 .clkr
.hw
.init
= &(struct clk_init_data
){
371 .name
= "cam_cc_icp_clk_src",
372 .parent_names
= cam_cc_parent_names_0
,
374 .ops
= &clk_rcg2_shared_ops
,
378 static const struct freq_tbl ftbl_cam_cc_ife_0_clk_src
[] = {
379 F(19200000, P_BI_TCXO
, 1, 0, 0),
380 F(100000000, P_CAM_CC_PLL0_OUT_EVEN
, 6, 0, 0),
381 F(320000000, P_CAM_CC_PLL2_OUT_EVEN
, 1.5, 0, 0),
382 F(404000000, P_CAM_CC_PLL1_OUT_EVEN
, 2, 0, 0),
383 F(480000000, P_CAM_CC_PLL2_OUT_EVEN
, 1, 0, 0),
384 F(600000000, P_CAM_CC_PLL0_OUT_EVEN
, 1, 0, 0),
388 static struct clk_rcg2 cam_cc_ife_0_clk_src
= {
392 .parent_map
= cam_cc_parent_map_0
,
393 .freq_tbl
= ftbl_cam_cc_ife_0_clk_src
,
394 .clkr
.hw
.init
= &(struct clk_init_data
){
395 .name
= "cam_cc_ife_0_clk_src",
396 .parent_names
= cam_cc_parent_names_0
,
398 .flags
= CLK_SET_RATE_PARENT
,
399 .ops
= &clk_rcg2_shared_ops
,
403 static const struct freq_tbl ftbl_cam_cc_ife_0_csid_clk_src
[] = {
404 F(19200000, P_BI_TCXO
, 1, 0, 0),
405 F(75000000, P_CAM_CC_PLL0_OUT_EVEN
, 8, 0, 0),
406 F(384000000, P_CAM_CC_PLL3_OUT_EVEN
, 1, 0, 0),
407 F(538666667, P_CAM_CC_PLL1_OUT_EVEN
, 1.5, 0, 0),
411 static struct clk_rcg2 cam_cc_ife_0_csid_clk_src
= {
415 .parent_map
= cam_cc_parent_map_0
,
416 .freq_tbl
= ftbl_cam_cc_ife_0_csid_clk_src
,
417 .clkr
.hw
.init
= &(struct clk_init_data
){
418 .name
= "cam_cc_ife_0_csid_clk_src",
419 .parent_names
= cam_cc_parent_names_0
,
421 .ops
= &clk_rcg2_shared_ops
,
425 static struct clk_rcg2 cam_cc_ife_1_clk_src
= {
429 .parent_map
= cam_cc_parent_map_0
,
430 .freq_tbl
= ftbl_cam_cc_ife_0_clk_src
,
431 .clkr
.hw
.init
= &(struct clk_init_data
){
432 .name
= "cam_cc_ife_1_clk_src",
433 .parent_names
= cam_cc_parent_names_0
,
435 .flags
= CLK_SET_RATE_PARENT
,
436 .ops
= &clk_rcg2_shared_ops
,
440 static struct clk_rcg2 cam_cc_ife_1_csid_clk_src
= {
444 .parent_map
= cam_cc_parent_map_0
,
445 .freq_tbl
= ftbl_cam_cc_ife_0_csid_clk_src
,
446 .clkr
.hw
.init
= &(struct clk_init_data
){
447 .name
= "cam_cc_ife_1_csid_clk_src",
448 .parent_names
= cam_cc_parent_names_0
,
450 .ops
= &clk_rcg2_shared_ops
,
454 static struct clk_rcg2 cam_cc_ife_lite_clk_src
= {
458 .parent_map
= cam_cc_parent_map_0
,
459 .freq_tbl
= ftbl_cam_cc_ife_0_clk_src
,
460 .clkr
.hw
.init
= &(struct clk_init_data
){
461 .name
= "cam_cc_ife_lite_clk_src",
462 .parent_names
= cam_cc_parent_names_0
,
464 .flags
= CLK_SET_RATE_PARENT
,
465 .ops
= &clk_rcg2_shared_ops
,
469 static struct clk_rcg2 cam_cc_ife_lite_csid_clk_src
= {
473 .parent_map
= cam_cc_parent_map_0
,
474 .freq_tbl
= ftbl_cam_cc_ife_0_csid_clk_src
,
475 .clkr
.hw
.init
= &(struct clk_init_data
){
476 .name
= "cam_cc_ife_lite_csid_clk_src",
477 .parent_names
= cam_cc_parent_names_0
,
479 .ops
= &clk_rcg2_shared_ops
,
483 static const struct freq_tbl ftbl_cam_cc_ipe_0_clk_src
[] = {
484 F(19200000, P_BI_TCXO
, 1, 0, 0),
485 F(100000000, P_CAM_CC_PLL0_OUT_EVEN
, 6, 0, 0),
486 F(240000000, P_CAM_CC_PLL0_OUT_EVEN
, 2.5, 0, 0),
487 F(404000000, P_CAM_CC_PLL1_OUT_EVEN
, 2, 0, 0),
488 F(480000000, P_CAM_CC_PLL2_OUT_EVEN
, 1, 0, 0),
489 F(538666667, P_CAM_CC_PLL1_OUT_EVEN
, 1.5, 0, 0),
490 F(600000000, P_CAM_CC_PLL0_OUT_EVEN
, 1, 0, 0),
494 static struct clk_rcg2 cam_cc_ipe_0_clk_src
= {
498 .parent_map
= cam_cc_parent_map_0
,
499 .freq_tbl
= ftbl_cam_cc_ipe_0_clk_src
,
500 .clkr
.hw
.init
= &(struct clk_init_data
){
501 .name
= "cam_cc_ipe_0_clk_src",
502 .parent_names
= cam_cc_parent_names_0
,
504 .flags
= CLK_SET_RATE_PARENT
,
505 .ops
= &clk_rcg2_shared_ops
,
509 static struct clk_rcg2 cam_cc_ipe_1_clk_src
= {
513 .parent_map
= cam_cc_parent_map_0
,
514 .freq_tbl
= ftbl_cam_cc_ipe_0_clk_src
,
515 .clkr
.hw
.init
= &(struct clk_init_data
){
516 .name
= "cam_cc_ipe_1_clk_src",
517 .parent_names
= cam_cc_parent_names_0
,
519 .flags
= CLK_SET_RATE_PARENT
,
520 .ops
= &clk_rcg2_shared_ops
,
524 static struct clk_rcg2 cam_cc_jpeg_clk_src
= {
528 .parent_map
= cam_cc_parent_map_0
,
529 .freq_tbl
= ftbl_cam_cc_bps_clk_src
,
530 .clkr
.hw
.init
= &(struct clk_init_data
){
531 .name
= "cam_cc_jpeg_clk_src",
532 .parent_names
= cam_cc_parent_names_0
,
534 .flags
= CLK_SET_RATE_PARENT
,
535 .ops
= &clk_rcg2_shared_ops
,
539 static const struct freq_tbl ftbl_cam_cc_lrme_clk_src
[] = {
540 F(19200000, P_BI_TCXO
, 1, 0, 0),
541 F(100000000, P_CAM_CC_PLL0_OUT_EVEN
, 6, 0, 0),
542 F(200000000, P_CAM_CC_PLL0_OUT_EVEN
, 3, 0, 0),
543 F(269333333, P_CAM_CC_PLL1_OUT_EVEN
, 3, 0, 0),
544 F(320000000, P_CAM_CC_PLL2_OUT_EVEN
, 1.5, 0, 0),
545 F(400000000, P_CAM_CC_PLL0_OUT_EVEN
, 1.5, 0, 0),
549 static struct clk_rcg2 cam_cc_lrme_clk_src
= {
553 .parent_map
= cam_cc_parent_map_0
,
554 .freq_tbl
= ftbl_cam_cc_lrme_clk_src
,
555 .clkr
.hw
.init
= &(struct clk_init_data
){
556 .name
= "cam_cc_lrme_clk_src",
557 .parent_names
= cam_cc_parent_names_0
,
559 .flags
= CLK_SET_RATE_PARENT
,
560 .ops
= &clk_rcg2_shared_ops
,
564 static const struct freq_tbl ftbl_cam_cc_mclk0_clk_src
[] = {
565 F(19200000, P_BI_TCXO
, 1, 0, 0),
566 F(24000000, P_CAM_CC_PLL2_OUT_EVEN
, 10, 1, 2),
567 F(33333333, P_CAM_CC_PLL0_OUT_EVEN
, 2, 1, 9),
568 F(34285714, P_CAM_CC_PLL2_OUT_EVEN
, 14, 0, 0),
572 static struct clk_rcg2 cam_cc_mclk0_clk_src
= {
576 .parent_map
= cam_cc_parent_map_0
,
577 .freq_tbl
= ftbl_cam_cc_mclk0_clk_src
,
578 .clkr
.hw
.init
= &(struct clk_init_data
){
579 .name
= "cam_cc_mclk0_clk_src",
580 .parent_names
= cam_cc_parent_names_0
,
582 .flags
= CLK_SET_RATE_PARENT
,
583 .ops
= &clk_rcg2_ops
,
587 static struct clk_rcg2 cam_cc_mclk1_clk_src
= {
591 .parent_map
= cam_cc_parent_map_0
,
592 .freq_tbl
= ftbl_cam_cc_mclk0_clk_src
,
593 .clkr
.hw
.init
= &(struct clk_init_data
){
594 .name
= "cam_cc_mclk1_clk_src",
595 .parent_names
= cam_cc_parent_names_0
,
597 .flags
= CLK_SET_RATE_PARENT
,
598 .ops
= &clk_rcg2_ops
,
602 static struct clk_rcg2 cam_cc_mclk2_clk_src
= {
606 .parent_map
= cam_cc_parent_map_0
,
607 .freq_tbl
= ftbl_cam_cc_mclk0_clk_src
,
608 .clkr
.hw
.init
= &(struct clk_init_data
){
609 .name
= "cam_cc_mclk2_clk_src",
610 .parent_names
= cam_cc_parent_names_0
,
612 .flags
= CLK_SET_RATE_PARENT
,
613 .ops
= &clk_rcg2_ops
,
617 static struct clk_rcg2 cam_cc_mclk3_clk_src
= {
621 .parent_map
= cam_cc_parent_map_0
,
622 .freq_tbl
= ftbl_cam_cc_mclk0_clk_src
,
623 .clkr
.hw
.init
= &(struct clk_init_data
){
624 .name
= "cam_cc_mclk3_clk_src",
625 .parent_names
= cam_cc_parent_names_0
,
627 .flags
= CLK_SET_RATE_PARENT
,
628 .ops
= &clk_rcg2_ops
,
632 static const struct freq_tbl ftbl_cam_cc_slow_ahb_clk_src
[] = {
633 F(19200000, P_BI_TCXO
, 1, 0, 0),
634 F(60000000, P_CAM_CC_PLL0_OUT_EVEN
, 10, 0, 0),
635 F(66666667, P_CAM_CC_PLL0_OUT_EVEN
, 9, 0, 0),
636 F(73846154, P_CAM_CC_PLL2_OUT_EVEN
, 6.5, 0, 0),
637 F(80000000, P_CAM_CC_PLL2_OUT_EVEN
, 6, 0, 0),
641 static struct clk_rcg2 cam_cc_slow_ahb_clk_src
= {
645 .parent_map
= cam_cc_parent_map_0
,
646 .freq_tbl
= ftbl_cam_cc_slow_ahb_clk_src
,
647 .clkr
.hw
.init
= &(struct clk_init_data
){
648 .name
= "cam_cc_slow_ahb_clk_src",
649 .parent_names
= cam_cc_parent_names_0
,
651 .flags
= CLK_SET_RATE_PARENT
,
652 .ops
= &clk_rcg2_ops
,
656 static struct clk_branch cam_cc_bps_ahb_clk
= {
658 .halt_check
= BRANCH_HALT
,
660 .enable_reg
= 0x606c,
661 .enable_mask
= BIT(0),
662 .hw
.init
= &(struct clk_init_data
){
663 .name
= "cam_cc_bps_ahb_clk",
664 .parent_names
= (const char *[]){
665 "cam_cc_slow_ahb_clk_src",
668 .flags
= CLK_SET_RATE_PARENT
,
669 .ops
= &clk_branch2_ops
,
674 static struct clk_branch cam_cc_bps_areg_clk
= {
676 .halt_check
= BRANCH_HALT
,
678 .enable_reg
= 0x6050,
679 .enable_mask
= BIT(0),
680 .hw
.init
= &(struct clk_init_data
){
681 .name
= "cam_cc_bps_areg_clk",
682 .parent_names
= (const char *[]){
683 "cam_cc_fast_ahb_clk_src",
686 .flags
= CLK_SET_RATE_PARENT
,
687 .ops
= &clk_branch2_ops
,
692 static struct clk_branch cam_cc_bps_axi_clk
= {
694 .halt_check
= BRANCH_HALT
,
696 .enable_reg
= 0x6034,
697 .enable_mask
= BIT(0),
698 .hw
.init
= &(struct clk_init_data
){
699 .name
= "cam_cc_bps_axi_clk",
700 .ops
= &clk_branch2_ops
,
705 static struct clk_branch cam_cc_bps_clk
= {
707 .halt_check
= BRANCH_HALT
,
709 .enable_reg
= 0x6024,
710 .enable_mask
= BIT(0),
711 .hw
.init
= &(struct clk_init_data
){
712 .name
= "cam_cc_bps_clk",
713 .parent_names
= (const char *[]){
714 "cam_cc_bps_clk_src",
717 .flags
= CLK_SET_RATE_PARENT
,
718 .ops
= &clk_branch2_ops
,
723 static struct clk_branch cam_cc_camnoc_atb_clk
= {
725 .halt_check
= BRANCH_HALT
,
727 .enable_reg
= 0xb12c,
728 .enable_mask
= BIT(0),
729 .hw
.init
= &(struct clk_init_data
){
730 .name
= "cam_cc_camnoc_atb_clk",
731 .ops
= &clk_branch2_ops
,
736 static struct clk_branch cam_cc_camnoc_axi_clk
= {
738 .halt_check
= BRANCH_HALT
,
740 .enable_reg
= 0xb124,
741 .enable_mask
= BIT(0),
742 .hw
.init
= &(struct clk_init_data
){
743 .name
= "cam_cc_camnoc_axi_clk",
744 .ops
= &clk_branch2_ops
,
749 static struct clk_branch cam_cc_cci_clk
= {
751 .halt_check
= BRANCH_HALT
,
753 .enable_reg
= 0xb0f0,
754 .enable_mask
= BIT(0),
755 .hw
.init
= &(struct clk_init_data
){
756 .name
= "cam_cc_cci_clk",
757 .parent_names
= (const char *[]){
758 "cam_cc_cci_clk_src",
761 .flags
= CLK_SET_RATE_PARENT
,
762 .ops
= &clk_branch2_ops
,
767 static struct clk_branch cam_cc_cpas_ahb_clk
= {
769 .halt_check
= BRANCH_HALT
,
771 .enable_reg
= 0xb11c,
772 .enable_mask
= BIT(0),
773 .hw
.init
= &(struct clk_init_data
){
774 .name
= "cam_cc_cpas_ahb_clk",
775 .parent_names
= (const char *[]){
776 "cam_cc_slow_ahb_clk_src",
779 .flags
= CLK_SET_RATE_PARENT
,
780 .ops
= &clk_branch2_ops
,
785 static struct clk_branch cam_cc_csi0phytimer_clk
= {
787 .halt_check
= BRANCH_HALT
,
789 .enable_reg
= 0x501c,
790 .enable_mask
= BIT(0),
791 .hw
.init
= &(struct clk_init_data
){
792 .name
= "cam_cc_csi0phytimer_clk",
793 .parent_names
= (const char *[]){
794 "cam_cc_csi0phytimer_clk_src",
797 .flags
= CLK_SET_RATE_PARENT
,
798 .ops
= &clk_branch2_ops
,
803 static struct clk_branch cam_cc_csi1phytimer_clk
= {
805 .halt_check
= BRANCH_HALT
,
807 .enable_reg
= 0x5040,
808 .enable_mask
= BIT(0),
809 .hw
.init
= &(struct clk_init_data
){
810 .name
= "cam_cc_csi1phytimer_clk",
811 .parent_names
= (const char *[]){
812 "cam_cc_csi1phytimer_clk_src",
815 .flags
= CLK_SET_RATE_PARENT
,
816 .ops
= &clk_branch2_ops
,
821 static struct clk_branch cam_cc_csi2phytimer_clk
= {
823 .halt_check
= BRANCH_HALT
,
825 .enable_reg
= 0x5064,
826 .enable_mask
= BIT(0),
827 .hw
.init
= &(struct clk_init_data
){
828 .name
= "cam_cc_csi2phytimer_clk",
829 .parent_names
= (const char *[]){
830 "cam_cc_csi2phytimer_clk_src",
833 .flags
= CLK_SET_RATE_PARENT
,
834 .ops
= &clk_branch2_ops
,
839 static struct clk_branch cam_cc_csi3phytimer_clk
= {
841 .halt_check
= BRANCH_HALT
,
843 .enable_reg
= 0x5088,
844 .enable_mask
= BIT(0),
845 .hw
.init
= &(struct clk_init_data
){
846 .name
= "cam_cc_csi3phytimer_clk",
847 .parent_names
= (const char *[]){
848 "cam_cc_csi3phytimer_clk_src",
851 .flags
= CLK_SET_RATE_PARENT
,
852 .ops
= &clk_branch2_ops
,
857 static struct clk_branch cam_cc_csiphy0_clk
= {
859 .halt_check
= BRANCH_HALT
,
861 .enable_reg
= 0x5020,
862 .enable_mask
= BIT(0),
863 .hw
.init
= &(struct clk_init_data
){
864 .name
= "cam_cc_csiphy0_clk",
865 .parent_names
= (const char *[]){
866 "cam_cc_cphy_rx_clk_src",
869 .flags
= CLK_SET_RATE_PARENT
,
870 .ops
= &clk_branch2_ops
,
875 static struct clk_branch cam_cc_csiphy1_clk
= {
877 .halt_check
= BRANCH_HALT
,
879 .enable_reg
= 0x5044,
880 .enable_mask
= BIT(0),
881 .hw
.init
= &(struct clk_init_data
){
882 .name
= "cam_cc_csiphy1_clk",
883 .parent_names
= (const char *[]){
884 "cam_cc_cphy_rx_clk_src",
887 .flags
= CLK_SET_RATE_PARENT
,
888 .ops
= &clk_branch2_ops
,
893 static struct clk_branch cam_cc_csiphy2_clk
= {
895 .halt_check
= BRANCH_HALT
,
897 .enable_reg
= 0x5068,
898 .enable_mask
= BIT(0),
899 .hw
.init
= &(struct clk_init_data
){
900 .name
= "cam_cc_csiphy2_clk",
901 .parent_names
= (const char *[]){
902 "cam_cc_cphy_rx_clk_src",
905 .flags
= CLK_SET_RATE_PARENT
,
906 .ops
= &clk_branch2_ops
,
911 static struct clk_branch cam_cc_csiphy3_clk
= {
913 .halt_check
= BRANCH_HALT
,
915 .enable_reg
= 0x508c,
916 .enable_mask
= BIT(0),
917 .hw
.init
= &(struct clk_init_data
){
918 .name
= "cam_cc_csiphy3_clk",
919 .parent_names
= (const char *[]){
920 "cam_cc_cphy_rx_clk_src",
923 .flags
= CLK_SET_RATE_PARENT
,
924 .ops
= &clk_branch2_ops
,
929 static struct clk_branch cam_cc_fd_core_clk
= {
931 .halt_check
= BRANCH_HALT
,
933 .enable_reg
= 0xb0c8,
934 .enable_mask
= BIT(0),
935 .hw
.init
= &(struct clk_init_data
){
936 .name
= "cam_cc_fd_core_clk",
937 .parent_names
= (const char *[]){
938 "cam_cc_fd_core_clk_src",
941 .flags
= CLK_SET_RATE_PARENT
,
942 .ops
= &clk_branch2_ops
,
947 static struct clk_branch cam_cc_fd_core_uar_clk
= {
949 .halt_check
= BRANCH_HALT
,
951 .enable_reg
= 0xb0d0,
952 .enable_mask
= BIT(0),
953 .hw
.init
= &(struct clk_init_data
){
954 .name
= "cam_cc_fd_core_uar_clk",
955 .parent_names
= (const char *[]){
956 "cam_cc_fd_core_clk_src",
959 .ops
= &clk_branch2_ops
,
964 static struct clk_branch cam_cc_icp_apb_clk
= {
966 .halt_check
= BRANCH_HALT
,
968 .enable_reg
= 0xb084,
969 .enable_mask
= BIT(0),
970 .hw
.init
= &(struct clk_init_data
){
971 .name
= "cam_cc_icp_apb_clk",
972 .ops
= &clk_branch2_ops
,
977 static struct clk_branch cam_cc_icp_atb_clk
= {
979 .halt_check
= BRANCH_HALT
,
981 .enable_reg
= 0xb078,
982 .enable_mask
= BIT(0),
983 .hw
.init
= &(struct clk_init_data
){
984 .name
= "cam_cc_icp_atb_clk",
985 .ops
= &clk_branch2_ops
,
990 static struct clk_branch cam_cc_icp_clk
= {
992 .halt_check
= BRANCH_HALT
,
994 .enable_reg
= 0xb0a0,
995 .enable_mask
= BIT(0),
996 .hw
.init
= &(struct clk_init_data
){
997 .name
= "cam_cc_icp_clk",
998 .parent_names
= (const char *[]){
999 "cam_cc_icp_clk_src",
1002 .flags
= CLK_SET_RATE_PARENT
,
1003 .ops
= &clk_branch2_ops
,
1008 static struct clk_branch cam_cc_icp_cti_clk
= {
1010 .halt_check
= BRANCH_HALT
,
1012 .enable_reg
= 0xb07c,
1013 .enable_mask
= BIT(0),
1014 .hw
.init
= &(struct clk_init_data
){
1015 .name
= "cam_cc_icp_cti_clk",
1016 .ops
= &clk_branch2_ops
,
1021 static struct clk_branch cam_cc_icp_ts_clk
= {
1023 .halt_check
= BRANCH_HALT
,
1025 .enable_reg
= 0xb080,
1026 .enable_mask
= BIT(0),
1027 .hw
.init
= &(struct clk_init_data
){
1028 .name
= "cam_cc_icp_ts_clk",
1029 .ops
= &clk_branch2_ops
,
1034 static struct clk_branch cam_cc_ife_0_axi_clk
= {
1036 .halt_check
= BRANCH_HALT
,
1038 .enable_reg
= 0x907c,
1039 .enable_mask
= BIT(0),
1040 .hw
.init
= &(struct clk_init_data
){
1041 .name
= "cam_cc_ife_0_axi_clk",
1042 .ops
= &clk_branch2_ops
,
1047 static struct clk_branch cam_cc_ife_0_clk
= {
1049 .halt_check
= BRANCH_HALT
,
1051 .enable_reg
= 0x9024,
1052 .enable_mask
= BIT(0),
1053 .hw
.init
= &(struct clk_init_data
){
1054 .name
= "cam_cc_ife_0_clk",
1055 .parent_names
= (const char *[]){
1056 "cam_cc_ife_0_clk_src",
1059 .flags
= CLK_SET_RATE_PARENT
,
1060 .ops
= &clk_branch2_ops
,
1065 static struct clk_branch cam_cc_ife_0_cphy_rx_clk
= {
1067 .halt_check
= BRANCH_HALT
,
1069 .enable_reg
= 0x9078,
1070 .enable_mask
= BIT(0),
1071 .hw
.init
= &(struct clk_init_data
){
1072 .name
= "cam_cc_ife_0_cphy_rx_clk",
1073 .parent_names
= (const char *[]){
1074 "cam_cc_cphy_rx_clk_src",
1077 .flags
= CLK_SET_RATE_PARENT
,
1078 .ops
= &clk_branch2_ops
,
1083 static struct clk_branch cam_cc_ife_0_csid_clk
= {
1085 .halt_check
= BRANCH_HALT
,
1087 .enable_reg
= 0x9050,
1088 .enable_mask
= BIT(0),
1089 .hw
.init
= &(struct clk_init_data
){
1090 .name
= "cam_cc_ife_0_csid_clk",
1091 .parent_names
= (const char *[]){
1092 "cam_cc_ife_0_csid_clk_src",
1095 .flags
= CLK_SET_RATE_PARENT
,
1096 .ops
= &clk_branch2_ops
,
1101 static struct clk_branch cam_cc_ife_0_dsp_clk
= {
1103 .halt_check
= BRANCH_HALT
,
1105 .enable_reg
= 0x9034,
1106 .enable_mask
= BIT(0),
1107 .hw
.init
= &(struct clk_init_data
){
1108 .name
= "cam_cc_ife_0_dsp_clk",
1109 .parent_names
= (const char *[]){
1110 "cam_cc_ife_0_clk_src",
1113 .ops
= &clk_branch2_ops
,
1118 static struct clk_branch cam_cc_ife_1_axi_clk
= {
1120 .halt_check
= BRANCH_HALT
,
1122 .enable_reg
= 0xa054,
1123 .enable_mask
= BIT(0),
1124 .hw
.init
= &(struct clk_init_data
){
1125 .name
= "cam_cc_ife_1_axi_clk",
1126 .ops
= &clk_branch2_ops
,
1131 static struct clk_branch cam_cc_ife_1_clk
= {
1133 .halt_check
= BRANCH_HALT
,
1135 .enable_reg
= 0xa024,
1136 .enable_mask
= BIT(0),
1137 .hw
.init
= &(struct clk_init_data
){
1138 .name
= "cam_cc_ife_1_clk",
1139 .parent_names
= (const char *[]){
1140 "cam_cc_ife_1_clk_src",
1143 .flags
= CLK_SET_RATE_PARENT
,
1144 .ops
= &clk_branch2_ops
,
1149 static struct clk_branch cam_cc_ife_1_cphy_rx_clk
= {
1151 .halt_check
= BRANCH_HALT
,
1153 .enable_reg
= 0xa050,
1154 .enable_mask
= BIT(0),
1155 .hw
.init
= &(struct clk_init_data
){
1156 .name
= "cam_cc_ife_1_cphy_rx_clk",
1157 .parent_names
= (const char *[]){
1158 "cam_cc_cphy_rx_clk_src",
1161 .flags
= CLK_SET_RATE_PARENT
,
1162 .ops
= &clk_branch2_ops
,
1167 static struct clk_branch cam_cc_ife_1_csid_clk
= {
1169 .halt_check
= BRANCH_HALT
,
1171 .enable_reg
= 0xa048,
1172 .enable_mask
= BIT(0),
1173 .hw
.init
= &(struct clk_init_data
){
1174 .name
= "cam_cc_ife_1_csid_clk",
1175 .parent_names
= (const char *[]){
1176 "cam_cc_ife_1_csid_clk_src",
1179 .flags
= CLK_SET_RATE_PARENT
,
1180 .ops
= &clk_branch2_ops
,
1185 static struct clk_branch cam_cc_ife_1_dsp_clk
= {
1187 .halt_check
= BRANCH_HALT
,
1189 .enable_reg
= 0xa02c,
1190 .enable_mask
= BIT(0),
1191 .hw
.init
= &(struct clk_init_data
){
1192 .name
= "cam_cc_ife_1_dsp_clk",
1193 .parent_names
= (const char *[]){
1194 "cam_cc_ife_1_clk_src",
1197 .ops
= &clk_branch2_ops
,
1202 static struct clk_branch cam_cc_ife_lite_clk
= {
1204 .halt_check
= BRANCH_HALT
,
1206 .enable_reg
= 0xb01c,
1207 .enable_mask
= BIT(0),
1208 .hw
.init
= &(struct clk_init_data
){
1209 .name
= "cam_cc_ife_lite_clk",
1210 .parent_names
= (const char *[]){
1211 "cam_cc_ife_lite_clk_src",
1214 .flags
= CLK_SET_RATE_PARENT
,
1215 .ops
= &clk_branch2_ops
,
1220 static struct clk_branch cam_cc_ife_lite_cphy_rx_clk
= {
1222 .halt_check
= BRANCH_HALT
,
1224 .enable_reg
= 0xb044,
1225 .enable_mask
= BIT(0),
1226 .hw
.init
= &(struct clk_init_data
){
1227 .name
= "cam_cc_ife_lite_cphy_rx_clk",
1228 .parent_names
= (const char *[]){
1229 "cam_cc_cphy_rx_clk_src",
1232 .flags
= CLK_SET_RATE_PARENT
,
1233 .ops
= &clk_branch2_ops
,
1238 static struct clk_branch cam_cc_ife_lite_csid_clk
= {
1240 .halt_check
= BRANCH_HALT
,
1242 .enable_reg
= 0xb03c,
1243 .enable_mask
= BIT(0),
1244 .hw
.init
= &(struct clk_init_data
){
1245 .name
= "cam_cc_ife_lite_csid_clk",
1246 .parent_names
= (const char *[]){
1247 "cam_cc_ife_lite_csid_clk_src",
1250 .flags
= CLK_SET_RATE_PARENT
,
1251 .ops
= &clk_branch2_ops
,
1256 static struct clk_branch cam_cc_ipe_0_ahb_clk
= {
1258 .halt_check
= BRANCH_HALT
,
1260 .enable_reg
= 0x703c,
1261 .enable_mask
= BIT(0),
1262 .hw
.init
= &(struct clk_init_data
){
1263 .name
= "cam_cc_ipe_0_ahb_clk",
1264 .parent_names
= (const char *[]){
1265 "cam_cc_slow_ahb_clk_src",
1268 .flags
= CLK_SET_RATE_PARENT
,
1269 .ops
= &clk_branch2_ops
,
1274 static struct clk_branch cam_cc_ipe_0_areg_clk
= {
1276 .halt_check
= BRANCH_HALT
,
1278 .enable_reg
= 0x7038,
1279 .enable_mask
= BIT(0),
1280 .hw
.init
= &(struct clk_init_data
){
1281 .name
= "cam_cc_ipe_0_areg_clk",
1282 .parent_names
= (const char *[]){
1283 "cam_cc_fast_ahb_clk_src",
1286 .flags
= CLK_SET_RATE_PARENT
,
1287 .ops
= &clk_branch2_ops
,
1292 static struct clk_branch cam_cc_ipe_0_axi_clk
= {
1294 .halt_check
= BRANCH_HALT
,
1296 .enable_reg
= 0x7034,
1297 .enable_mask
= BIT(0),
1298 .hw
.init
= &(struct clk_init_data
){
1299 .name
= "cam_cc_ipe_0_axi_clk",
1300 .ops
= &clk_branch2_ops
,
1305 static struct clk_branch cam_cc_ipe_0_clk
= {
1307 .halt_check
= BRANCH_HALT
,
1309 .enable_reg
= 0x7024,
1310 .enable_mask
= BIT(0),
1311 .hw
.init
= &(struct clk_init_data
){
1312 .name
= "cam_cc_ipe_0_clk",
1313 .parent_names
= (const char *[]){
1314 "cam_cc_ipe_0_clk_src",
1317 .flags
= CLK_SET_RATE_PARENT
,
1318 .ops
= &clk_branch2_ops
,
1323 static struct clk_branch cam_cc_ipe_1_ahb_clk
= {
1325 .halt_check
= BRANCH_HALT
,
1327 .enable_reg
= 0x803c,
1328 .enable_mask
= BIT(0),
1329 .hw
.init
= &(struct clk_init_data
){
1330 .name
= "cam_cc_ipe_1_ahb_clk",
1331 .parent_names
= (const char *[]){
1332 "cam_cc_slow_ahb_clk_src",
1335 .flags
= CLK_SET_RATE_PARENT
,
1336 .ops
= &clk_branch2_ops
,
1341 static struct clk_branch cam_cc_ipe_1_areg_clk
= {
1343 .halt_check
= BRANCH_HALT
,
1345 .enable_reg
= 0x8038,
1346 .enable_mask
= BIT(0),
1347 .hw
.init
= &(struct clk_init_data
){
1348 .name
= "cam_cc_ipe_1_areg_clk",
1349 .parent_names
= (const char *[]){
1350 "cam_cc_fast_ahb_clk_src",
1353 .flags
= CLK_SET_RATE_PARENT
,
1354 .ops
= &clk_branch2_ops
,
1359 static struct clk_branch cam_cc_ipe_1_axi_clk
= {
1361 .halt_check
= BRANCH_HALT
,
1363 .enable_reg
= 0x8034,
1364 .enable_mask
= BIT(0),
1365 .hw
.init
= &(struct clk_init_data
){
1366 .name
= "cam_cc_ipe_1_axi_clk",
1367 .ops
= &clk_branch2_ops
,
1372 static struct clk_branch cam_cc_ipe_1_clk
= {
1374 .halt_check
= BRANCH_HALT
,
1376 .enable_reg
= 0x8024,
1377 .enable_mask
= BIT(0),
1378 .hw
.init
= &(struct clk_init_data
){
1379 .name
= "cam_cc_ipe_1_clk",
1380 .parent_names
= (const char *[]){
1381 "cam_cc_ipe_1_clk_src",
1384 .flags
= CLK_SET_RATE_PARENT
,
1385 .ops
= &clk_branch2_ops
,
1390 static struct clk_branch cam_cc_jpeg_clk
= {
1392 .halt_check
= BRANCH_HALT
,
1394 .enable_reg
= 0xb064,
1395 .enable_mask
= BIT(0),
1396 .hw
.init
= &(struct clk_init_data
){
1397 .name
= "cam_cc_jpeg_clk",
1398 .parent_names
= (const char *[]){
1399 "cam_cc_jpeg_clk_src",
1402 .flags
= CLK_SET_RATE_PARENT
,
1403 .ops
= &clk_branch2_ops
,
1408 static struct clk_branch cam_cc_lrme_clk
= {
1410 .halt_check
= BRANCH_HALT
,
1412 .enable_reg
= 0xb110,
1413 .enable_mask
= BIT(0),
1414 .hw
.init
= &(struct clk_init_data
){
1415 .name
= "cam_cc_lrme_clk",
1416 .parent_names
= (const char *[]){
1417 "cam_cc_lrme_clk_src",
1420 .flags
= CLK_SET_RATE_PARENT
,
1421 .ops
= &clk_branch2_ops
,
1426 static struct clk_branch cam_cc_mclk0_clk
= {
1428 .halt_check
= BRANCH_HALT
,
1430 .enable_reg
= 0x401c,
1431 .enable_mask
= BIT(0),
1432 .hw
.init
= &(struct clk_init_data
){
1433 .name
= "cam_cc_mclk0_clk",
1434 .parent_names
= (const char *[]){
1435 "cam_cc_mclk0_clk_src",
1438 .flags
= CLK_SET_RATE_PARENT
,
1439 .ops
= &clk_branch2_ops
,
1444 static struct clk_branch cam_cc_mclk1_clk
= {
1446 .halt_check
= BRANCH_HALT
,
1448 .enable_reg
= 0x403c,
1449 .enable_mask
= BIT(0),
1450 .hw
.init
= &(struct clk_init_data
){
1451 .name
= "cam_cc_mclk1_clk",
1452 .parent_names
= (const char *[]){
1453 "cam_cc_mclk1_clk_src",
1456 .flags
= CLK_SET_RATE_PARENT
,
1457 .ops
= &clk_branch2_ops
,
1462 static struct clk_branch cam_cc_mclk2_clk
= {
1464 .halt_check
= BRANCH_HALT
,
1466 .enable_reg
= 0x405c,
1467 .enable_mask
= BIT(0),
1468 .hw
.init
= &(struct clk_init_data
){
1469 .name
= "cam_cc_mclk2_clk",
1470 .parent_names
= (const char *[]){
1471 "cam_cc_mclk2_clk_src",
1474 .flags
= CLK_SET_RATE_PARENT
,
1475 .ops
= &clk_branch2_ops
,
1480 static struct clk_branch cam_cc_mclk3_clk
= {
1482 .halt_check
= BRANCH_HALT
,
1484 .enable_reg
= 0x407c,
1485 .enable_mask
= BIT(0),
1486 .hw
.init
= &(struct clk_init_data
){
1487 .name
= "cam_cc_mclk3_clk",
1488 .parent_names
= (const char *[]){
1489 "cam_cc_mclk3_clk_src",
1492 .flags
= CLK_SET_RATE_PARENT
,
1493 .ops
= &clk_branch2_ops
,
1498 static struct clk_branch cam_cc_soc_ahb_clk
= {
1500 .halt_check
= BRANCH_HALT
,
1502 .enable_reg
= 0xb13c,
1503 .enable_mask
= BIT(0),
1504 .hw
.init
= &(struct clk_init_data
){
1505 .name
= "cam_cc_soc_ahb_clk",
1506 .ops
= &clk_branch2_ops
,
1511 static struct clk_branch cam_cc_sys_tmr_clk
= {
1513 .halt_check
= BRANCH_HALT
,
1515 .enable_reg
= 0xb0a8,
1516 .enable_mask
= BIT(0),
1517 .hw
.init
= &(struct clk_init_data
){
1518 .name
= "cam_cc_sys_tmr_clk",
1519 .ops
= &clk_branch2_ops
,
1524 static struct gdsc bps_gdsc
= {
1529 .flags
= HW_CTRL
| POLL_CFG_GDSCR
,
1530 .pwrsts
= PWRSTS_OFF_ON
,
1533 static struct gdsc ipe_0_gdsc
= {
1536 .name
= "ipe_0_gdsc",
1538 .flags
= HW_CTRL
| POLL_CFG_GDSCR
,
1539 .pwrsts
= PWRSTS_OFF_ON
,
1542 static struct gdsc ipe_1_gdsc
= {
1545 .name
= "ipe_1_gdsc",
1547 .flags
= HW_CTRL
| POLL_CFG_GDSCR
,
1548 .pwrsts
= PWRSTS_OFF_ON
,
1551 static struct gdsc ife_0_gdsc
= {
1554 .name
= "ife_0_gdsc",
1556 .flags
= POLL_CFG_GDSCR
,
1557 .pwrsts
= PWRSTS_OFF_ON
,
1560 static struct gdsc ife_1_gdsc
= {
1563 .name
= "ife_1_gdsc",
1565 .flags
= POLL_CFG_GDSCR
,
1566 .pwrsts
= PWRSTS_OFF_ON
,
1569 static struct gdsc titan_top_gdsc
= {
1572 .name
= "titan_top_gdsc",
1574 .flags
= POLL_CFG_GDSCR
,
1575 .pwrsts
= PWRSTS_OFF_ON
,
1578 static struct clk_regmap
*cam_cc_sdm845_clocks
[] = {
1579 [CAM_CC_BPS_AHB_CLK
] = &cam_cc_bps_ahb_clk
.clkr
,
1580 [CAM_CC_BPS_AREG_CLK
] = &cam_cc_bps_areg_clk
.clkr
,
1581 [CAM_CC_BPS_AXI_CLK
] = &cam_cc_bps_axi_clk
.clkr
,
1582 [CAM_CC_BPS_CLK
] = &cam_cc_bps_clk
.clkr
,
1583 [CAM_CC_BPS_CLK_SRC
] = &cam_cc_bps_clk_src
.clkr
,
1584 [CAM_CC_CAMNOC_ATB_CLK
] = &cam_cc_camnoc_atb_clk
.clkr
,
1585 [CAM_CC_CAMNOC_AXI_CLK
] = &cam_cc_camnoc_axi_clk
.clkr
,
1586 [CAM_CC_CCI_CLK
] = &cam_cc_cci_clk
.clkr
,
1587 [CAM_CC_CCI_CLK_SRC
] = &cam_cc_cci_clk_src
.clkr
,
1588 [CAM_CC_CPAS_AHB_CLK
] = &cam_cc_cpas_ahb_clk
.clkr
,
1589 [CAM_CC_CPHY_RX_CLK_SRC
] = &cam_cc_cphy_rx_clk_src
.clkr
,
1590 [CAM_CC_CSI0PHYTIMER_CLK
] = &cam_cc_csi0phytimer_clk
.clkr
,
1591 [CAM_CC_CSI0PHYTIMER_CLK_SRC
] = &cam_cc_csi0phytimer_clk_src
.clkr
,
1592 [CAM_CC_CSI1PHYTIMER_CLK
] = &cam_cc_csi1phytimer_clk
.clkr
,
1593 [CAM_CC_CSI1PHYTIMER_CLK_SRC
] = &cam_cc_csi1phytimer_clk_src
.clkr
,
1594 [CAM_CC_CSI2PHYTIMER_CLK
] = &cam_cc_csi2phytimer_clk
.clkr
,
1595 [CAM_CC_CSI2PHYTIMER_CLK_SRC
] = &cam_cc_csi2phytimer_clk_src
.clkr
,
1596 [CAM_CC_CSI3PHYTIMER_CLK
] = &cam_cc_csi3phytimer_clk
.clkr
,
1597 [CAM_CC_CSI3PHYTIMER_CLK_SRC
] = &cam_cc_csi3phytimer_clk_src
.clkr
,
1598 [CAM_CC_CSIPHY0_CLK
] = &cam_cc_csiphy0_clk
.clkr
,
1599 [CAM_CC_CSIPHY1_CLK
] = &cam_cc_csiphy1_clk
.clkr
,
1600 [CAM_CC_CSIPHY2_CLK
] = &cam_cc_csiphy2_clk
.clkr
,
1601 [CAM_CC_CSIPHY3_CLK
] = &cam_cc_csiphy3_clk
.clkr
,
1602 [CAM_CC_FAST_AHB_CLK_SRC
] = &cam_cc_fast_ahb_clk_src
.clkr
,
1603 [CAM_CC_FD_CORE_CLK
] = &cam_cc_fd_core_clk
.clkr
,
1604 [CAM_CC_FD_CORE_CLK_SRC
] = &cam_cc_fd_core_clk_src
.clkr
,
1605 [CAM_CC_FD_CORE_UAR_CLK
] = &cam_cc_fd_core_uar_clk
.clkr
,
1606 [CAM_CC_ICP_APB_CLK
] = &cam_cc_icp_apb_clk
.clkr
,
1607 [CAM_CC_ICP_ATB_CLK
] = &cam_cc_icp_atb_clk
.clkr
,
1608 [CAM_CC_ICP_CLK
] = &cam_cc_icp_clk
.clkr
,
1609 [CAM_CC_ICP_CLK_SRC
] = &cam_cc_icp_clk_src
.clkr
,
1610 [CAM_CC_ICP_CTI_CLK
] = &cam_cc_icp_cti_clk
.clkr
,
1611 [CAM_CC_ICP_TS_CLK
] = &cam_cc_icp_ts_clk
.clkr
,
1612 [CAM_CC_IFE_0_AXI_CLK
] = &cam_cc_ife_0_axi_clk
.clkr
,
1613 [CAM_CC_IFE_0_CLK
] = &cam_cc_ife_0_clk
.clkr
,
1614 [CAM_CC_IFE_0_CLK_SRC
] = &cam_cc_ife_0_clk_src
.clkr
,
1615 [CAM_CC_IFE_0_CPHY_RX_CLK
] = &cam_cc_ife_0_cphy_rx_clk
.clkr
,
1616 [CAM_CC_IFE_0_CSID_CLK
] = &cam_cc_ife_0_csid_clk
.clkr
,
1617 [CAM_CC_IFE_0_CSID_CLK_SRC
] = &cam_cc_ife_0_csid_clk_src
.clkr
,
1618 [CAM_CC_IFE_0_DSP_CLK
] = &cam_cc_ife_0_dsp_clk
.clkr
,
1619 [CAM_CC_IFE_1_AXI_CLK
] = &cam_cc_ife_1_axi_clk
.clkr
,
1620 [CAM_CC_IFE_1_CLK
] = &cam_cc_ife_1_clk
.clkr
,
1621 [CAM_CC_IFE_1_CLK_SRC
] = &cam_cc_ife_1_clk_src
.clkr
,
1622 [CAM_CC_IFE_1_CPHY_RX_CLK
] = &cam_cc_ife_1_cphy_rx_clk
.clkr
,
1623 [CAM_CC_IFE_1_CSID_CLK
] = &cam_cc_ife_1_csid_clk
.clkr
,
1624 [CAM_CC_IFE_1_CSID_CLK_SRC
] = &cam_cc_ife_1_csid_clk_src
.clkr
,
1625 [CAM_CC_IFE_1_DSP_CLK
] = &cam_cc_ife_1_dsp_clk
.clkr
,
1626 [CAM_CC_IFE_LITE_CLK
] = &cam_cc_ife_lite_clk
.clkr
,
1627 [CAM_CC_IFE_LITE_CLK_SRC
] = &cam_cc_ife_lite_clk_src
.clkr
,
1628 [CAM_CC_IFE_LITE_CPHY_RX_CLK
] = &cam_cc_ife_lite_cphy_rx_clk
.clkr
,
1629 [CAM_CC_IFE_LITE_CSID_CLK
] = &cam_cc_ife_lite_csid_clk
.clkr
,
1630 [CAM_CC_IFE_LITE_CSID_CLK_SRC
] = &cam_cc_ife_lite_csid_clk_src
.clkr
,
1631 [CAM_CC_IPE_0_AHB_CLK
] = &cam_cc_ipe_0_ahb_clk
.clkr
,
1632 [CAM_CC_IPE_0_AREG_CLK
] = &cam_cc_ipe_0_areg_clk
.clkr
,
1633 [CAM_CC_IPE_0_AXI_CLK
] = &cam_cc_ipe_0_axi_clk
.clkr
,
1634 [CAM_CC_IPE_0_CLK
] = &cam_cc_ipe_0_clk
.clkr
,
1635 [CAM_CC_IPE_0_CLK_SRC
] = &cam_cc_ipe_0_clk_src
.clkr
,
1636 [CAM_CC_IPE_1_AHB_CLK
] = &cam_cc_ipe_1_ahb_clk
.clkr
,
1637 [CAM_CC_IPE_1_AREG_CLK
] = &cam_cc_ipe_1_areg_clk
.clkr
,
1638 [CAM_CC_IPE_1_AXI_CLK
] = &cam_cc_ipe_1_axi_clk
.clkr
,
1639 [CAM_CC_IPE_1_CLK
] = &cam_cc_ipe_1_clk
.clkr
,
1640 [CAM_CC_IPE_1_CLK_SRC
] = &cam_cc_ipe_1_clk_src
.clkr
,
1641 [CAM_CC_JPEG_CLK
] = &cam_cc_jpeg_clk
.clkr
,
1642 [CAM_CC_JPEG_CLK_SRC
] = &cam_cc_jpeg_clk_src
.clkr
,
1643 [CAM_CC_LRME_CLK
] = &cam_cc_lrme_clk
.clkr
,
1644 [CAM_CC_LRME_CLK_SRC
] = &cam_cc_lrme_clk_src
.clkr
,
1645 [CAM_CC_MCLK0_CLK
] = &cam_cc_mclk0_clk
.clkr
,
1646 [CAM_CC_MCLK0_CLK_SRC
] = &cam_cc_mclk0_clk_src
.clkr
,
1647 [CAM_CC_MCLK1_CLK
] = &cam_cc_mclk1_clk
.clkr
,
1648 [CAM_CC_MCLK1_CLK_SRC
] = &cam_cc_mclk1_clk_src
.clkr
,
1649 [CAM_CC_MCLK2_CLK
] = &cam_cc_mclk2_clk
.clkr
,
1650 [CAM_CC_MCLK2_CLK_SRC
] = &cam_cc_mclk2_clk_src
.clkr
,
1651 [CAM_CC_MCLK3_CLK
] = &cam_cc_mclk3_clk
.clkr
,
1652 [CAM_CC_MCLK3_CLK_SRC
] = &cam_cc_mclk3_clk_src
.clkr
,
1653 [CAM_CC_PLL0
] = &cam_cc_pll0
.clkr
,
1654 [CAM_CC_PLL0_OUT_EVEN
] = &cam_cc_pll0_out_even
.clkr
,
1655 [CAM_CC_PLL1
] = &cam_cc_pll1
.clkr
,
1656 [CAM_CC_PLL1_OUT_EVEN
] = &cam_cc_pll1_out_even
.clkr
,
1657 [CAM_CC_PLL2
] = &cam_cc_pll2
.clkr
,
1658 [CAM_CC_PLL2_OUT_EVEN
] = &cam_cc_pll2_out_even
.clkr
,
1659 [CAM_CC_PLL3
] = &cam_cc_pll3
.clkr
,
1660 [CAM_CC_PLL3_OUT_EVEN
] = &cam_cc_pll3_out_even
.clkr
,
1661 [CAM_CC_SLOW_AHB_CLK_SRC
] = &cam_cc_slow_ahb_clk_src
.clkr
,
1662 [CAM_CC_SOC_AHB_CLK
] = &cam_cc_soc_ahb_clk
.clkr
,
1663 [CAM_CC_SYS_TMR_CLK
] = &cam_cc_sys_tmr_clk
.clkr
,
1666 static struct gdsc
*cam_cc_sdm845_gdscs
[] = {
1667 [BPS_GDSC
] = &bps_gdsc
,
1668 [IPE_0_GDSC
] = &ipe_0_gdsc
,
1669 [IPE_1_GDSC
] = &ipe_1_gdsc
,
1670 [IFE_0_GDSC
] = &ife_0_gdsc
,
1671 [IFE_1_GDSC
] = &ife_1_gdsc
,
1672 [TITAN_TOP_GDSC
] = &titan_top_gdsc
,
1675 static const struct regmap_config cam_cc_sdm845_regmap_config
= {
1679 .max_register
= 0xd004,
1683 static const struct qcom_cc_desc cam_cc_sdm845_desc
= {
1684 .config
= &cam_cc_sdm845_regmap_config
,
1685 .clks
= cam_cc_sdm845_clocks
,
1686 .num_clks
= ARRAY_SIZE(cam_cc_sdm845_clocks
),
1687 .gdscs
= cam_cc_sdm845_gdscs
,
1688 .num_gdscs
= ARRAY_SIZE(cam_cc_sdm845_gdscs
),
1691 static const struct of_device_id cam_cc_sdm845_match_table
[] = {
1692 { .compatible
= "qcom,sdm845-camcc" },
1695 MODULE_DEVICE_TABLE(of
, cam_cc_sdm845_match_table
);
1697 static int cam_cc_sdm845_probe(struct platform_device
*pdev
)
1699 struct regmap
*regmap
;
1700 struct alpha_pll_config cam_cc_pll_config
= { };
1702 regmap
= qcom_cc_map(pdev
, &cam_cc_sdm845_desc
);
1704 return PTR_ERR(regmap
);
1706 cam_cc_pll_config
.l
= 0x1f;
1707 cam_cc_pll_config
.alpha
= 0x4000;
1708 clk_fabia_pll_configure(&cam_cc_pll0
, regmap
, &cam_cc_pll_config
);
1710 cam_cc_pll_config
.l
= 0x2a;
1711 cam_cc_pll_config
.alpha
= 0x1556;
1712 clk_fabia_pll_configure(&cam_cc_pll1
, regmap
, &cam_cc_pll_config
);
1714 cam_cc_pll_config
.l
= 0x32;
1715 cam_cc_pll_config
.alpha
= 0x0;
1716 clk_fabia_pll_configure(&cam_cc_pll2
, regmap
, &cam_cc_pll_config
);
1718 cam_cc_pll_config
.l
= 0x14;
1719 clk_fabia_pll_configure(&cam_cc_pll3
, regmap
, &cam_cc_pll_config
);
1721 return qcom_cc_really_probe(pdev
, &cam_cc_sdm845_desc
, regmap
);
1724 static struct platform_driver cam_cc_sdm845_driver
= {
1725 .probe
= cam_cc_sdm845_probe
,
1727 .name
= "sdm845-camcc",
1728 .of_match_table
= cam_cc_sdm845_match_table
,
1732 static int __init
cam_cc_sdm845_init(void)
1734 return platform_driver_register(&cam_cc_sdm845_driver
);
1736 subsys_initcall(cam_cc_sdm845_init
);
1738 static void __exit
cam_cc_sdm845_exit(void)
1740 platform_driver_unregister(&cam_cc_sdm845_driver
);
1742 module_exit(cam_cc_sdm845_exit
);
1744 MODULE_DESCRIPTION("QTI CAM_CC SDM845 Driver");
1745 MODULE_LICENSE("GPL v2");