1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
6 #include <linux/kernel.h>
7 #include <linux/bitops.h>
9 #include <linux/delay.h>
10 #include <linux/platform_device.h>
11 #include <linux/module.h>
13 #include <linux/of_device.h>
14 #include <linux/clk.h>
15 #include <linux/clk-provider.h>
16 #include <linux/regmap.h>
17 #include <linux/reset-controller.h>
19 #include <dt-bindings/clock/qcom,mmcc-msm8960.h>
20 #include <dt-bindings/reset/qcom,mmcc-msm8960.h>
23 #include "clk-regmap.h"
26 #include "clk-branch.h"
42 #define F_MN(f, s, _m, _n) { .freq = f, .src = s, .m = _m, .n = _n }
44 static const struct parent_map mmcc_pxo_pll8_pll2_map
[] = {
50 static const char * const mmcc_pxo_pll8_pll2
[] = {
56 static const struct parent_map mmcc_pxo_pll8_pll2_pll3_map
[] = {
63 static const char * const mmcc_pxo_pll8_pll2_pll15
[] = {
70 static const struct parent_map mmcc_pxo_pll8_pll2_pll15_map
[] = {
77 static const char * const mmcc_pxo_pll8_pll2_pll3
[] = {
84 static const struct parent_map mmcc_pxo_dsi2_dsi1_map
[] = {
86 { P_DSI2_PLL_DSICLK
, 1 },
87 { P_DSI1_PLL_DSICLK
, 3 },
90 static const char * const mmcc_pxo_dsi2_dsi1
[] = {
96 static const struct parent_map mmcc_pxo_dsi1_dsi2_byte_map
[] = {
98 { P_DSI1_PLL_BYTECLK
, 1 },
99 { P_DSI2_PLL_BYTECLK
, 2 },
102 static const char * const mmcc_pxo_dsi1_dsi2_byte
[] = {
108 static struct clk_pll pll2
= {
116 .clkr
.hw
.init
= &(struct clk_init_data
){
118 .parent_names
= (const char *[]){ "pxo" },
124 static struct clk_pll pll15
= {
132 .clkr
.hw
.init
= &(struct clk_init_data
){
134 .parent_names
= (const char *[]){ "pxo" },
140 static const struct pll_config pll15_config
= {
144 .vco_val
= 0x2 << 16,
145 .vco_mask
= 0x3 << 16,
147 .pre_div_mask
= BIT(19),
149 .post_div_mask
= 0x3 << 20,
150 .mn_ena_mask
= BIT(22),
151 .main_output_mask
= BIT(23),
154 static struct freq_tbl clk_tbl_cam
[] = {
155 { 6000000, P_PLL8
, 4, 1, 16 },
156 { 8000000, P_PLL8
, 4, 1, 12 },
157 { 12000000, P_PLL8
, 4, 1, 8 },
158 { 16000000, P_PLL8
, 4, 1, 6 },
159 { 19200000, P_PLL8
, 4, 1, 5 },
160 { 24000000, P_PLL8
, 4, 1, 4 },
161 { 32000000, P_PLL8
, 4, 1, 3 },
162 { 48000000, P_PLL8
, 4, 1, 2 },
163 { 64000000, P_PLL8
, 3, 1, 2 },
164 { 96000000, P_PLL8
, 4, 0, 0 },
165 { 128000000, P_PLL8
, 3, 0, 0 },
169 static struct clk_rcg camclk0_src
= {
174 .mnctr_reset_bit
= 8,
176 .mnctr_mode_shift
= 6,
187 .parent_map
= mmcc_pxo_pll8_pll2_map
,
189 .freq_tbl
= clk_tbl_cam
,
191 .enable_reg
= 0x0140,
192 .enable_mask
= BIT(2),
193 .hw
.init
= &(struct clk_init_data
){
194 .name
= "camclk0_src",
195 .parent_names
= mmcc_pxo_pll8_pll2
,
202 static struct clk_branch camclk0_clk
= {
206 .enable_reg
= 0x0140,
207 .enable_mask
= BIT(0),
208 .hw
.init
= &(struct clk_init_data
){
209 .name
= "camclk0_clk",
210 .parent_names
= (const char *[]){ "camclk0_src" },
212 .ops
= &clk_branch_ops
,
218 static struct clk_rcg camclk1_src
= {
223 .mnctr_reset_bit
= 8,
225 .mnctr_mode_shift
= 6,
236 .parent_map
= mmcc_pxo_pll8_pll2_map
,
238 .freq_tbl
= clk_tbl_cam
,
240 .enable_reg
= 0x0154,
241 .enable_mask
= BIT(2),
242 .hw
.init
= &(struct clk_init_data
){
243 .name
= "camclk1_src",
244 .parent_names
= mmcc_pxo_pll8_pll2
,
251 static struct clk_branch camclk1_clk
= {
255 .enable_reg
= 0x0154,
256 .enable_mask
= BIT(0),
257 .hw
.init
= &(struct clk_init_data
){
258 .name
= "camclk1_clk",
259 .parent_names
= (const char *[]){ "camclk1_src" },
261 .ops
= &clk_branch_ops
,
267 static struct clk_rcg camclk2_src
= {
272 .mnctr_reset_bit
= 8,
274 .mnctr_mode_shift
= 6,
285 .parent_map
= mmcc_pxo_pll8_pll2_map
,
287 .freq_tbl
= clk_tbl_cam
,
289 .enable_reg
= 0x0220,
290 .enable_mask
= BIT(2),
291 .hw
.init
= &(struct clk_init_data
){
292 .name
= "camclk2_src",
293 .parent_names
= mmcc_pxo_pll8_pll2
,
300 static struct clk_branch camclk2_clk
= {
304 .enable_reg
= 0x0220,
305 .enable_mask
= BIT(0),
306 .hw
.init
= &(struct clk_init_data
){
307 .name
= "camclk2_clk",
308 .parent_names
= (const char *[]){ "camclk2_src" },
310 .ops
= &clk_branch_ops
,
316 static struct freq_tbl clk_tbl_csi
[] = {
317 { 27000000, P_PXO
, 1, 0, 0 },
318 { 85330000, P_PLL8
, 1, 2, 9 },
319 { 177780000, P_PLL2
, 1, 2, 9 },
323 static struct clk_rcg csi0_src
= {
328 .mnctr_reset_bit
= 7,
329 .mnctr_mode_shift
= 6,
340 .parent_map
= mmcc_pxo_pll8_pll2_map
,
342 .freq_tbl
= clk_tbl_csi
,
344 .enable_reg
= 0x0040,
345 .enable_mask
= BIT(2),
346 .hw
.init
= &(struct clk_init_data
){
348 .parent_names
= mmcc_pxo_pll8_pll2
,
355 static struct clk_branch csi0_clk
= {
359 .enable_reg
= 0x0040,
360 .enable_mask
= BIT(0),
361 .hw
.init
= &(struct clk_init_data
){
362 .parent_names
= (const char *[]){ "csi0_src" },
365 .ops
= &clk_branch_ops
,
366 .flags
= CLK_SET_RATE_PARENT
,
371 static struct clk_branch csi0_phy_clk
= {
375 .enable_reg
= 0x0040,
376 .enable_mask
= BIT(8),
377 .hw
.init
= &(struct clk_init_data
){
378 .parent_names
= (const char *[]){ "csi0_src" },
380 .name
= "csi0_phy_clk",
381 .ops
= &clk_branch_ops
,
382 .flags
= CLK_SET_RATE_PARENT
,
387 static struct clk_rcg csi1_src
= {
392 .mnctr_reset_bit
= 7,
393 .mnctr_mode_shift
= 6,
404 .parent_map
= mmcc_pxo_pll8_pll2_map
,
406 .freq_tbl
= clk_tbl_csi
,
408 .enable_reg
= 0x0024,
409 .enable_mask
= BIT(2),
410 .hw
.init
= &(struct clk_init_data
){
412 .parent_names
= mmcc_pxo_pll8_pll2
,
419 static struct clk_branch csi1_clk
= {
423 .enable_reg
= 0x0024,
424 .enable_mask
= BIT(0),
425 .hw
.init
= &(struct clk_init_data
){
426 .parent_names
= (const char *[]){ "csi1_src" },
429 .ops
= &clk_branch_ops
,
430 .flags
= CLK_SET_RATE_PARENT
,
435 static struct clk_branch csi1_phy_clk
= {
439 .enable_reg
= 0x0024,
440 .enable_mask
= BIT(8),
441 .hw
.init
= &(struct clk_init_data
){
442 .parent_names
= (const char *[]){ "csi1_src" },
444 .name
= "csi1_phy_clk",
445 .ops
= &clk_branch_ops
,
446 .flags
= CLK_SET_RATE_PARENT
,
451 static struct clk_rcg csi2_src
= {
456 .mnctr_reset_bit
= 7,
457 .mnctr_mode_shift
= 6,
468 .parent_map
= mmcc_pxo_pll8_pll2_map
,
470 .freq_tbl
= clk_tbl_csi
,
472 .enable_reg
= 0x022c,
473 .enable_mask
= BIT(2),
474 .hw
.init
= &(struct clk_init_data
){
476 .parent_names
= mmcc_pxo_pll8_pll2
,
483 static struct clk_branch csi2_clk
= {
487 .enable_reg
= 0x022c,
488 .enable_mask
= BIT(0),
489 .hw
.init
= &(struct clk_init_data
){
490 .parent_names
= (const char *[]){ "csi2_src" },
493 .ops
= &clk_branch_ops
,
494 .flags
= CLK_SET_RATE_PARENT
,
499 static struct clk_branch csi2_phy_clk
= {
503 .enable_reg
= 0x022c,
504 .enable_mask
= BIT(8),
505 .hw
.init
= &(struct clk_init_data
){
506 .parent_names
= (const char *[]){ "csi2_src" },
508 .name
= "csi2_phy_clk",
509 .ops
= &clk_branch_ops
,
510 .flags
= CLK_SET_RATE_PARENT
,
520 struct clk_regmap clkr
;
523 #define to_clk_pix_rdi(_hw) \
524 container_of(to_clk_regmap(_hw), struct clk_pix_rdi, clkr)
526 static int pix_rdi_set_parent(struct clk_hw
*hw
, u8 index
)
531 struct clk_pix_rdi
*rdi
= to_clk_pix_rdi(hw
);
532 int num_parents
= clk_hw_get_num_parents(hw
);
535 * These clocks select three inputs via two muxes. One mux selects
536 * between csi0 and csi1 and the second mux selects between that mux's
537 * output and csi2. The source and destination selections for each
538 * mux must be clocking for the switch to succeed so just turn on
539 * all three sources because it's easier than figuring out what source
540 * needs to be on at what time.
542 for (i
= 0; i
< num_parents
; i
++) {
543 struct clk_hw
*p
= clk_hw_get_parent_by_index(hw
, i
);
544 ret
= clk_prepare_enable(p
->clk
);
553 regmap_update_bits(rdi
->clkr
.regmap
, rdi
->s2_reg
, rdi
->s2_mask
, val
);
555 * Wait at least 6 cycles of slowest clock
556 * for the glitch-free MUX to fully switch sources.
564 regmap_update_bits(rdi
->clkr
.regmap
, rdi
->s_reg
, rdi
->s_mask
, val
);
566 * Wait at least 6 cycles of slowest clock
567 * for the glitch-free MUX to fully switch sources.
572 for (i
--; i
>= 0; i
--) {
573 struct clk_hw
*p
= clk_hw_get_parent_by_index(hw
, i
);
574 clk_disable_unprepare(p
->clk
);
580 static u8
pix_rdi_get_parent(struct clk_hw
*hw
)
583 struct clk_pix_rdi
*rdi
= to_clk_pix_rdi(hw
);
586 regmap_read(rdi
->clkr
.regmap
, rdi
->s2_reg
, &val
);
587 if (val
& rdi
->s2_mask
)
590 regmap_read(rdi
->clkr
.regmap
, rdi
->s_reg
, &val
);
591 if (val
& rdi
->s_mask
)
597 static const struct clk_ops clk_ops_pix_rdi
= {
598 .enable
= clk_enable_regmap
,
599 .disable
= clk_disable_regmap
,
600 .set_parent
= pix_rdi_set_parent
,
601 .get_parent
= pix_rdi_get_parent
,
602 .determine_rate
= __clk_mux_determine_rate
,
605 static const char * const pix_rdi_parents
[] = {
611 static struct clk_pix_rdi csi_pix_clk
= {
617 .enable_reg
= 0x0058,
618 .enable_mask
= BIT(26),
619 .hw
.init
= &(struct clk_init_data
){
620 .name
= "csi_pix_clk",
621 .parent_names
= pix_rdi_parents
,
623 .ops
= &clk_ops_pix_rdi
,
628 static struct clk_pix_rdi csi_pix1_clk
= {
634 .enable_reg
= 0x0238,
635 .enable_mask
= BIT(10),
636 .hw
.init
= &(struct clk_init_data
){
637 .name
= "csi_pix1_clk",
638 .parent_names
= pix_rdi_parents
,
640 .ops
= &clk_ops_pix_rdi
,
645 static struct clk_pix_rdi csi_rdi_clk
= {
651 .enable_reg
= 0x0058,
652 .enable_mask
= BIT(13),
653 .hw
.init
= &(struct clk_init_data
){
654 .name
= "csi_rdi_clk",
655 .parent_names
= pix_rdi_parents
,
657 .ops
= &clk_ops_pix_rdi
,
662 static struct clk_pix_rdi csi_rdi1_clk
= {
668 .enable_reg
= 0x0238,
669 .enable_mask
= BIT(2),
670 .hw
.init
= &(struct clk_init_data
){
671 .name
= "csi_rdi1_clk",
672 .parent_names
= pix_rdi_parents
,
674 .ops
= &clk_ops_pix_rdi
,
679 static struct clk_pix_rdi csi_rdi2_clk
= {
685 .enable_reg
= 0x0238,
686 .enable_mask
= BIT(6),
687 .hw
.init
= &(struct clk_init_data
){
688 .name
= "csi_rdi2_clk",
689 .parent_names
= pix_rdi_parents
,
691 .ops
= &clk_ops_pix_rdi
,
696 static struct freq_tbl clk_tbl_csiphytimer
[] = {
697 { 85330000, P_PLL8
, 1, 2, 9 },
698 { 177780000, P_PLL2
, 1, 2, 9 },
702 static struct clk_rcg csiphytimer_src
= {
707 .mnctr_reset_bit
= 8,
709 .mnctr_mode_shift
= 6,
720 .parent_map
= mmcc_pxo_pll8_pll2_map
,
722 .freq_tbl
= clk_tbl_csiphytimer
,
724 .enable_reg
= 0x0160,
725 .enable_mask
= BIT(2),
726 .hw
.init
= &(struct clk_init_data
){
727 .name
= "csiphytimer_src",
728 .parent_names
= mmcc_pxo_pll8_pll2
,
735 static const char * const csixphy_timer_src
[] = { "csiphytimer_src" };
737 static struct clk_branch csiphy0_timer_clk
= {
741 .enable_reg
= 0x0160,
742 .enable_mask
= BIT(0),
743 .hw
.init
= &(struct clk_init_data
){
744 .parent_names
= csixphy_timer_src
,
746 .name
= "csiphy0_timer_clk",
747 .ops
= &clk_branch_ops
,
748 .flags
= CLK_SET_RATE_PARENT
,
753 static struct clk_branch csiphy1_timer_clk
= {
757 .enable_reg
= 0x0160,
758 .enable_mask
= BIT(9),
759 .hw
.init
= &(struct clk_init_data
){
760 .parent_names
= csixphy_timer_src
,
762 .name
= "csiphy1_timer_clk",
763 .ops
= &clk_branch_ops
,
764 .flags
= CLK_SET_RATE_PARENT
,
769 static struct clk_branch csiphy2_timer_clk
= {
773 .enable_reg
= 0x0160,
774 .enable_mask
= BIT(11),
775 .hw
.init
= &(struct clk_init_data
){
776 .parent_names
= csixphy_timer_src
,
778 .name
= "csiphy2_timer_clk",
779 .ops
= &clk_branch_ops
,
780 .flags
= CLK_SET_RATE_PARENT
,
785 static struct freq_tbl clk_tbl_gfx2d
[] = {
786 F_MN( 27000000, P_PXO
, 1, 0),
787 F_MN( 48000000, P_PLL8
, 1, 8),
788 F_MN( 54857000, P_PLL8
, 1, 7),
789 F_MN( 64000000, P_PLL8
, 1, 6),
790 F_MN( 76800000, P_PLL8
, 1, 5),
791 F_MN( 96000000, P_PLL8
, 1, 4),
792 F_MN(128000000, P_PLL8
, 1, 3),
793 F_MN(145455000, P_PLL2
, 2, 11),
794 F_MN(160000000, P_PLL2
, 1, 5),
795 F_MN(177778000, P_PLL2
, 2, 9),
796 F_MN(200000000, P_PLL2
, 1, 4),
797 F_MN(228571000, P_PLL2
, 2, 7),
801 static struct clk_dyn_rcg gfx2d0_src
= {
809 .mnctr_reset_bit
= 25,
810 .mnctr_mode_shift
= 9,
817 .mnctr_reset_bit
= 24,
818 .mnctr_mode_shift
= 6,
825 .parent_map
= mmcc_pxo_pll8_pll2_map
,
829 .parent_map
= mmcc_pxo_pll8_pll2_map
,
832 .freq_tbl
= clk_tbl_gfx2d
,
834 .enable_reg
= 0x0060,
835 .enable_mask
= BIT(2),
836 .hw
.init
= &(struct clk_init_data
){
837 .name
= "gfx2d0_src",
838 .parent_names
= mmcc_pxo_pll8_pll2
,
840 .ops
= &clk_dyn_rcg_ops
,
845 static struct clk_branch gfx2d0_clk
= {
849 .enable_reg
= 0x0060,
850 .enable_mask
= BIT(0),
851 .hw
.init
= &(struct clk_init_data
){
852 .name
= "gfx2d0_clk",
853 .parent_names
= (const char *[]){ "gfx2d0_src" },
855 .ops
= &clk_branch_ops
,
856 .flags
= CLK_SET_RATE_PARENT
,
861 static struct clk_dyn_rcg gfx2d1_src
= {
869 .mnctr_reset_bit
= 25,
870 .mnctr_mode_shift
= 9,
877 .mnctr_reset_bit
= 24,
878 .mnctr_mode_shift
= 6,
885 .parent_map
= mmcc_pxo_pll8_pll2_map
,
889 .parent_map
= mmcc_pxo_pll8_pll2_map
,
892 .freq_tbl
= clk_tbl_gfx2d
,
894 .enable_reg
= 0x0074,
895 .enable_mask
= BIT(2),
896 .hw
.init
= &(struct clk_init_data
){
897 .name
= "gfx2d1_src",
898 .parent_names
= mmcc_pxo_pll8_pll2
,
900 .ops
= &clk_dyn_rcg_ops
,
905 static struct clk_branch gfx2d1_clk
= {
909 .enable_reg
= 0x0074,
910 .enable_mask
= BIT(0),
911 .hw
.init
= &(struct clk_init_data
){
912 .name
= "gfx2d1_clk",
913 .parent_names
= (const char *[]){ "gfx2d1_src" },
915 .ops
= &clk_branch_ops
,
916 .flags
= CLK_SET_RATE_PARENT
,
921 static struct freq_tbl clk_tbl_gfx3d
[] = {
922 F_MN( 27000000, P_PXO
, 1, 0),
923 F_MN( 48000000, P_PLL8
, 1, 8),
924 F_MN( 54857000, P_PLL8
, 1, 7),
925 F_MN( 64000000, P_PLL8
, 1, 6),
926 F_MN( 76800000, P_PLL8
, 1, 5),
927 F_MN( 96000000, P_PLL8
, 1, 4),
928 F_MN(128000000, P_PLL8
, 1, 3),
929 F_MN(145455000, P_PLL2
, 2, 11),
930 F_MN(160000000, P_PLL2
, 1, 5),
931 F_MN(177778000, P_PLL2
, 2, 9),
932 F_MN(200000000, P_PLL2
, 1, 4),
933 F_MN(228571000, P_PLL2
, 2, 7),
934 F_MN(266667000, P_PLL2
, 1, 3),
935 F_MN(300000000, P_PLL3
, 1, 4),
936 F_MN(320000000, P_PLL2
, 2, 5),
937 F_MN(400000000, P_PLL2
, 1, 2),
941 static struct freq_tbl clk_tbl_gfx3d_8064
[] = {
942 F_MN( 27000000, P_PXO
, 0, 0),
943 F_MN( 48000000, P_PLL8
, 1, 8),
944 F_MN( 54857000, P_PLL8
, 1, 7),
945 F_MN( 64000000, P_PLL8
, 1, 6),
946 F_MN( 76800000, P_PLL8
, 1, 5),
947 F_MN( 96000000, P_PLL8
, 1, 4),
948 F_MN(128000000, P_PLL8
, 1, 3),
949 F_MN(145455000, P_PLL2
, 2, 11),
950 F_MN(160000000, P_PLL2
, 1, 5),
951 F_MN(177778000, P_PLL2
, 2, 9),
952 F_MN(192000000, P_PLL8
, 1, 2),
953 F_MN(200000000, P_PLL2
, 1, 4),
954 F_MN(228571000, P_PLL2
, 2, 7),
955 F_MN(266667000, P_PLL2
, 1, 3),
956 F_MN(320000000, P_PLL2
, 2, 5),
957 F_MN(400000000, P_PLL2
, 1, 2),
958 F_MN(450000000, P_PLL15
, 1, 2),
962 static struct clk_dyn_rcg gfx3d_src
= {
970 .mnctr_reset_bit
= 25,
971 .mnctr_mode_shift
= 9,
978 .mnctr_reset_bit
= 24,
979 .mnctr_mode_shift
= 6,
986 .parent_map
= mmcc_pxo_pll8_pll2_pll3_map
,
990 .parent_map
= mmcc_pxo_pll8_pll2_pll3_map
,
993 .freq_tbl
= clk_tbl_gfx3d
,
995 .enable_reg
= 0x0080,
996 .enable_mask
= BIT(2),
997 .hw
.init
= &(struct clk_init_data
){
999 .parent_names
= mmcc_pxo_pll8_pll2_pll3
,
1001 .ops
= &clk_dyn_rcg_ops
,
1006 static const struct clk_init_data gfx3d_8064_init
= {
1007 .name
= "gfx3d_src",
1008 .parent_names
= mmcc_pxo_pll8_pll2_pll15
,
1010 .ops
= &clk_dyn_rcg_ops
,
1013 static struct clk_branch gfx3d_clk
= {
1017 .enable_reg
= 0x0080,
1018 .enable_mask
= BIT(0),
1019 .hw
.init
= &(struct clk_init_data
){
1020 .name
= "gfx3d_clk",
1021 .parent_names
= (const char *[]){ "gfx3d_src" },
1023 .ops
= &clk_branch_ops
,
1024 .flags
= CLK_SET_RATE_PARENT
,
1029 static struct freq_tbl clk_tbl_vcap
[] = {
1030 F_MN( 27000000, P_PXO
, 0, 0),
1031 F_MN( 54860000, P_PLL8
, 1, 7),
1032 F_MN( 64000000, P_PLL8
, 1, 6),
1033 F_MN( 76800000, P_PLL8
, 1, 5),
1034 F_MN(128000000, P_PLL8
, 1, 3),
1035 F_MN(160000000, P_PLL2
, 1, 5),
1036 F_MN(200000000, P_PLL2
, 1, 4),
1040 static struct clk_dyn_rcg vcap_src
= {
1041 .ns_reg
[0] = 0x021c,
1042 .ns_reg
[1] = 0x021c,
1043 .md_reg
[0] = 0x01ec,
1044 .md_reg
[1] = 0x0218,
1048 .mnctr_reset_bit
= 23,
1049 .mnctr_mode_shift
= 9,
1056 .mnctr_reset_bit
= 22,
1057 .mnctr_mode_shift
= 6,
1064 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1068 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1071 .freq_tbl
= clk_tbl_vcap
,
1073 .enable_reg
= 0x0178,
1074 .enable_mask
= BIT(2),
1075 .hw
.init
= &(struct clk_init_data
){
1077 .parent_names
= mmcc_pxo_pll8_pll2
,
1079 .ops
= &clk_dyn_rcg_ops
,
1084 static struct clk_branch vcap_clk
= {
1088 .enable_reg
= 0x0178,
1089 .enable_mask
= BIT(0),
1090 .hw
.init
= &(struct clk_init_data
){
1092 .parent_names
= (const char *[]){ "vcap_src" },
1094 .ops
= &clk_branch_ops
,
1095 .flags
= CLK_SET_RATE_PARENT
,
1100 static struct clk_branch vcap_npl_clk
= {
1104 .enable_reg
= 0x0178,
1105 .enable_mask
= BIT(13),
1106 .hw
.init
= &(struct clk_init_data
){
1107 .name
= "vcap_npl_clk",
1108 .parent_names
= (const char *[]){ "vcap_src" },
1110 .ops
= &clk_branch_ops
,
1111 .flags
= CLK_SET_RATE_PARENT
,
1116 static struct freq_tbl clk_tbl_ijpeg
[] = {
1117 { 27000000, P_PXO
, 1, 0, 0 },
1118 { 36570000, P_PLL8
, 1, 2, 21 },
1119 { 54860000, P_PLL8
, 7, 0, 0 },
1120 { 96000000, P_PLL8
, 4, 0, 0 },
1121 { 109710000, P_PLL8
, 1, 2, 7 },
1122 { 128000000, P_PLL8
, 3, 0, 0 },
1123 { 153600000, P_PLL8
, 1, 2, 5 },
1124 { 200000000, P_PLL2
, 4, 0, 0 },
1125 { 228571000, P_PLL2
, 1, 2, 7 },
1126 { 266667000, P_PLL2
, 1, 1, 3 },
1127 { 320000000, P_PLL2
, 1, 2, 5 },
1131 static struct clk_rcg ijpeg_src
= {
1136 .mnctr_reset_bit
= 7,
1137 .mnctr_mode_shift
= 6,
1143 .pre_div_shift
= 12,
1148 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1150 .freq_tbl
= clk_tbl_ijpeg
,
1152 .enable_reg
= 0x0098,
1153 .enable_mask
= BIT(2),
1154 .hw
.init
= &(struct clk_init_data
){
1155 .name
= "ijpeg_src",
1156 .parent_names
= mmcc_pxo_pll8_pll2
,
1158 .ops
= &clk_rcg_ops
,
1163 static struct clk_branch ijpeg_clk
= {
1167 .enable_reg
= 0x0098,
1168 .enable_mask
= BIT(0),
1169 .hw
.init
= &(struct clk_init_data
){
1170 .name
= "ijpeg_clk",
1171 .parent_names
= (const char *[]){ "ijpeg_src" },
1173 .ops
= &clk_branch_ops
,
1174 .flags
= CLK_SET_RATE_PARENT
,
1179 static struct freq_tbl clk_tbl_jpegd
[] = {
1180 { 64000000, P_PLL8
, 6 },
1181 { 76800000, P_PLL8
, 5 },
1182 { 96000000, P_PLL8
, 4 },
1183 { 160000000, P_PLL2
, 5 },
1184 { 200000000, P_PLL2
, 4 },
1188 static struct clk_rcg jpegd_src
= {
1191 .pre_div_shift
= 12,
1196 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1198 .freq_tbl
= clk_tbl_jpegd
,
1200 .enable_reg
= 0x00a4,
1201 .enable_mask
= BIT(2),
1202 .hw
.init
= &(struct clk_init_data
){
1203 .name
= "jpegd_src",
1204 .parent_names
= mmcc_pxo_pll8_pll2
,
1206 .ops
= &clk_rcg_ops
,
1211 static struct clk_branch jpegd_clk
= {
1215 .enable_reg
= 0x00a4,
1216 .enable_mask
= BIT(0),
1217 .hw
.init
= &(struct clk_init_data
){
1218 .name
= "jpegd_clk",
1219 .parent_names
= (const char *[]){ "jpegd_src" },
1221 .ops
= &clk_branch_ops
,
1222 .flags
= CLK_SET_RATE_PARENT
,
1227 static struct freq_tbl clk_tbl_mdp
[] = {
1228 { 9600000, P_PLL8
, 1, 1, 40 },
1229 { 13710000, P_PLL8
, 1, 1, 28 },
1230 { 27000000, P_PXO
, 1, 0, 0 },
1231 { 29540000, P_PLL8
, 1, 1, 13 },
1232 { 34910000, P_PLL8
, 1, 1, 11 },
1233 { 38400000, P_PLL8
, 1, 1, 10 },
1234 { 59080000, P_PLL8
, 1, 2, 13 },
1235 { 76800000, P_PLL8
, 1, 1, 5 },
1236 { 85330000, P_PLL8
, 1, 2, 9 },
1237 { 96000000, P_PLL8
, 1, 1, 4 },
1238 { 128000000, P_PLL8
, 1, 1, 3 },
1239 { 160000000, P_PLL2
, 1, 1, 5 },
1240 { 177780000, P_PLL2
, 1, 2, 9 },
1241 { 200000000, P_PLL2
, 1, 1, 4 },
1242 { 228571000, P_PLL2
, 1, 2, 7 },
1243 { 266667000, P_PLL2
, 1, 1, 3 },
1247 static struct clk_dyn_rcg mdp_src
= {
1248 .ns_reg
[0] = 0x00d0,
1249 .ns_reg
[1] = 0x00d0,
1250 .md_reg
[0] = 0x00c4,
1251 .md_reg
[1] = 0x00c8,
1255 .mnctr_reset_bit
= 31,
1256 .mnctr_mode_shift
= 9,
1263 .mnctr_reset_bit
= 30,
1264 .mnctr_mode_shift
= 6,
1271 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1275 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1278 .freq_tbl
= clk_tbl_mdp
,
1280 .enable_reg
= 0x00c0,
1281 .enable_mask
= BIT(2),
1282 .hw
.init
= &(struct clk_init_data
){
1284 .parent_names
= mmcc_pxo_pll8_pll2
,
1286 .ops
= &clk_dyn_rcg_ops
,
1291 static struct clk_branch mdp_clk
= {
1295 .enable_reg
= 0x00c0,
1296 .enable_mask
= BIT(0),
1297 .hw
.init
= &(struct clk_init_data
){
1299 .parent_names
= (const char *[]){ "mdp_src" },
1301 .ops
= &clk_branch_ops
,
1302 .flags
= CLK_SET_RATE_PARENT
,
1307 static struct clk_branch mdp_lut_clk
= {
1311 .enable_reg
= 0x016c,
1312 .enable_mask
= BIT(0),
1313 .hw
.init
= &(struct clk_init_data
){
1314 .parent_names
= (const char *[]){ "mdp_src" },
1316 .name
= "mdp_lut_clk",
1317 .ops
= &clk_branch_ops
,
1318 .flags
= CLK_SET_RATE_PARENT
,
1323 static struct clk_branch mdp_vsync_clk
= {
1327 .enable_reg
= 0x0058,
1328 .enable_mask
= BIT(6),
1329 .hw
.init
= &(struct clk_init_data
){
1330 .name
= "mdp_vsync_clk",
1331 .parent_names
= (const char *[]){ "pxo" },
1333 .ops
= &clk_branch_ops
1338 static struct freq_tbl clk_tbl_rot
[] = {
1339 { 27000000, P_PXO
, 1 },
1340 { 29540000, P_PLL8
, 13 },
1341 { 32000000, P_PLL8
, 12 },
1342 { 38400000, P_PLL8
, 10 },
1343 { 48000000, P_PLL8
, 8 },
1344 { 54860000, P_PLL8
, 7 },
1345 { 64000000, P_PLL8
, 6 },
1346 { 76800000, P_PLL8
, 5 },
1347 { 96000000, P_PLL8
, 4 },
1348 { 100000000, P_PLL2
, 8 },
1349 { 114290000, P_PLL2
, 7 },
1350 { 133330000, P_PLL2
, 6 },
1351 { 160000000, P_PLL2
, 5 },
1352 { 200000000, P_PLL2
, 4 },
1356 static struct clk_dyn_rcg rot_src
= {
1357 .ns_reg
[0] = 0x00e8,
1358 .ns_reg
[1] = 0x00e8,
1361 .pre_div_shift
= 22,
1365 .pre_div_shift
= 26,
1369 .src_sel_shift
= 16,
1370 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1373 .src_sel_shift
= 19,
1374 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1377 .freq_tbl
= clk_tbl_rot
,
1379 .enable_reg
= 0x00e0,
1380 .enable_mask
= BIT(2),
1381 .hw
.init
= &(struct clk_init_data
){
1383 .parent_names
= mmcc_pxo_pll8_pll2
,
1385 .ops
= &clk_dyn_rcg_ops
,
1390 static struct clk_branch rot_clk
= {
1394 .enable_reg
= 0x00e0,
1395 .enable_mask
= BIT(0),
1396 .hw
.init
= &(struct clk_init_data
){
1398 .parent_names
= (const char *[]){ "rot_src" },
1400 .ops
= &clk_branch_ops
,
1401 .flags
= CLK_SET_RATE_PARENT
,
1406 static const struct parent_map mmcc_pxo_hdmi_map
[] = {
1411 static const char * const mmcc_pxo_hdmi
[] = {
1416 static struct freq_tbl clk_tbl_tv
[] = {
1417 { .src
= P_HDMI_PLL
, .pre_div
= 1 },
1421 static struct clk_rcg tv_src
= {
1426 .mnctr_reset_bit
= 7,
1427 .mnctr_mode_shift
= 6,
1433 .pre_div_shift
= 14,
1438 .parent_map
= mmcc_pxo_hdmi_map
,
1440 .freq_tbl
= clk_tbl_tv
,
1442 .enable_reg
= 0x00ec,
1443 .enable_mask
= BIT(2),
1444 .hw
.init
= &(struct clk_init_data
){
1446 .parent_names
= mmcc_pxo_hdmi
,
1448 .ops
= &clk_rcg_bypass_ops
,
1449 .flags
= CLK_SET_RATE_PARENT
,
1454 static const char * const tv_src_name
[] = { "tv_src" };
1456 static struct clk_branch tv_enc_clk
= {
1460 .enable_reg
= 0x00ec,
1461 .enable_mask
= BIT(8),
1462 .hw
.init
= &(struct clk_init_data
){
1463 .parent_names
= tv_src_name
,
1465 .name
= "tv_enc_clk",
1466 .ops
= &clk_branch_ops
,
1467 .flags
= CLK_SET_RATE_PARENT
,
1472 static struct clk_branch tv_dac_clk
= {
1476 .enable_reg
= 0x00ec,
1477 .enable_mask
= BIT(10),
1478 .hw
.init
= &(struct clk_init_data
){
1479 .parent_names
= tv_src_name
,
1481 .name
= "tv_dac_clk",
1482 .ops
= &clk_branch_ops
,
1483 .flags
= CLK_SET_RATE_PARENT
,
1488 static struct clk_branch mdp_tv_clk
= {
1492 .enable_reg
= 0x00ec,
1493 .enable_mask
= BIT(0),
1494 .hw
.init
= &(struct clk_init_data
){
1495 .parent_names
= tv_src_name
,
1497 .name
= "mdp_tv_clk",
1498 .ops
= &clk_branch_ops
,
1499 .flags
= CLK_SET_RATE_PARENT
,
1504 static struct clk_branch hdmi_tv_clk
= {
1508 .enable_reg
= 0x00ec,
1509 .enable_mask
= BIT(12),
1510 .hw
.init
= &(struct clk_init_data
){
1511 .parent_names
= tv_src_name
,
1513 .name
= "hdmi_tv_clk",
1514 .ops
= &clk_branch_ops
,
1515 .flags
= CLK_SET_RATE_PARENT
,
1520 static struct clk_branch rgb_tv_clk
= {
1524 .enable_reg
= 0x0124,
1525 .enable_mask
= BIT(14),
1526 .hw
.init
= &(struct clk_init_data
){
1527 .parent_names
= tv_src_name
,
1529 .name
= "rgb_tv_clk",
1530 .ops
= &clk_branch_ops
,
1531 .flags
= CLK_SET_RATE_PARENT
,
1536 static struct clk_branch npl_tv_clk
= {
1540 .enable_reg
= 0x0124,
1541 .enable_mask
= BIT(16),
1542 .hw
.init
= &(struct clk_init_data
){
1543 .parent_names
= tv_src_name
,
1545 .name
= "npl_tv_clk",
1546 .ops
= &clk_branch_ops
,
1547 .flags
= CLK_SET_RATE_PARENT
,
1552 static struct clk_branch hdmi_app_clk
= {
1556 .enable_reg
= 0x005c,
1557 .enable_mask
= BIT(11),
1558 .hw
.init
= &(struct clk_init_data
){
1559 .parent_names
= (const char *[]){ "pxo" },
1561 .name
= "hdmi_app_clk",
1562 .ops
= &clk_branch_ops
,
1567 static struct freq_tbl clk_tbl_vcodec
[] = {
1568 F_MN( 27000000, P_PXO
, 1, 0),
1569 F_MN( 32000000, P_PLL8
, 1, 12),
1570 F_MN( 48000000, P_PLL8
, 1, 8),
1571 F_MN( 54860000, P_PLL8
, 1, 7),
1572 F_MN( 96000000, P_PLL8
, 1, 4),
1573 F_MN(133330000, P_PLL2
, 1, 6),
1574 F_MN(200000000, P_PLL2
, 1, 4),
1575 F_MN(228570000, P_PLL2
, 2, 7),
1576 F_MN(266670000, P_PLL2
, 1, 3),
1580 static struct clk_dyn_rcg vcodec_src
= {
1581 .ns_reg
[0] = 0x0100,
1582 .ns_reg
[1] = 0x0100,
1583 .md_reg
[0] = 0x00fc,
1584 .md_reg
[1] = 0x0128,
1588 .mnctr_reset_bit
= 31,
1589 .mnctr_mode_shift
= 6,
1596 .mnctr_reset_bit
= 30,
1597 .mnctr_mode_shift
= 11,
1603 .src_sel_shift
= 27,
1604 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1608 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1611 .freq_tbl
= clk_tbl_vcodec
,
1613 .enable_reg
= 0x00f8,
1614 .enable_mask
= BIT(2),
1615 .hw
.init
= &(struct clk_init_data
){
1616 .name
= "vcodec_src",
1617 .parent_names
= mmcc_pxo_pll8_pll2
,
1619 .ops
= &clk_dyn_rcg_ops
,
1624 static struct clk_branch vcodec_clk
= {
1628 .enable_reg
= 0x00f8,
1629 .enable_mask
= BIT(0),
1630 .hw
.init
= &(struct clk_init_data
){
1631 .name
= "vcodec_clk",
1632 .parent_names
= (const char *[]){ "vcodec_src" },
1634 .ops
= &clk_branch_ops
,
1635 .flags
= CLK_SET_RATE_PARENT
,
1640 static struct freq_tbl clk_tbl_vpe
[] = {
1641 { 27000000, P_PXO
, 1 },
1642 { 34909000, P_PLL8
, 11 },
1643 { 38400000, P_PLL8
, 10 },
1644 { 64000000, P_PLL8
, 6 },
1645 { 76800000, P_PLL8
, 5 },
1646 { 96000000, P_PLL8
, 4 },
1647 { 100000000, P_PLL2
, 8 },
1648 { 160000000, P_PLL2
, 5 },
1652 static struct clk_rcg vpe_src
= {
1655 .pre_div_shift
= 12,
1660 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1662 .freq_tbl
= clk_tbl_vpe
,
1664 .enable_reg
= 0x0110,
1665 .enable_mask
= BIT(2),
1666 .hw
.init
= &(struct clk_init_data
){
1668 .parent_names
= mmcc_pxo_pll8_pll2
,
1670 .ops
= &clk_rcg_ops
,
1675 static struct clk_branch vpe_clk
= {
1679 .enable_reg
= 0x0110,
1680 .enable_mask
= BIT(0),
1681 .hw
.init
= &(struct clk_init_data
){
1683 .parent_names
= (const char *[]){ "vpe_src" },
1685 .ops
= &clk_branch_ops
,
1686 .flags
= CLK_SET_RATE_PARENT
,
1691 static struct freq_tbl clk_tbl_vfe
[] = {
1692 { 13960000, P_PLL8
, 1, 2, 55 },
1693 { 27000000, P_PXO
, 1, 0, 0 },
1694 { 36570000, P_PLL8
, 1, 2, 21 },
1695 { 38400000, P_PLL8
, 2, 1, 5 },
1696 { 45180000, P_PLL8
, 1, 2, 17 },
1697 { 48000000, P_PLL8
, 2, 1, 4 },
1698 { 54860000, P_PLL8
, 1, 1, 7 },
1699 { 64000000, P_PLL8
, 2, 1, 3 },
1700 { 76800000, P_PLL8
, 1, 1, 5 },
1701 { 96000000, P_PLL8
, 2, 1, 2 },
1702 { 109710000, P_PLL8
, 1, 2, 7 },
1703 { 128000000, P_PLL8
, 1, 1, 3 },
1704 { 153600000, P_PLL8
, 1, 2, 5 },
1705 { 200000000, P_PLL2
, 2, 1, 2 },
1706 { 228570000, P_PLL2
, 1, 2, 7 },
1707 { 266667000, P_PLL2
, 1, 1, 3 },
1708 { 320000000, P_PLL2
, 1, 2, 5 },
1712 static struct clk_rcg vfe_src
= {
1716 .mnctr_reset_bit
= 7,
1717 .mnctr_mode_shift
= 6,
1723 .pre_div_shift
= 10,
1728 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1730 .freq_tbl
= clk_tbl_vfe
,
1732 .enable_reg
= 0x0104,
1733 .enable_mask
= BIT(2),
1734 .hw
.init
= &(struct clk_init_data
){
1736 .parent_names
= mmcc_pxo_pll8_pll2
,
1738 .ops
= &clk_rcg_ops
,
1743 static struct clk_branch vfe_clk
= {
1747 .enable_reg
= 0x0104,
1748 .enable_mask
= BIT(0),
1749 .hw
.init
= &(struct clk_init_data
){
1751 .parent_names
= (const char *[]){ "vfe_src" },
1753 .ops
= &clk_branch_ops
,
1754 .flags
= CLK_SET_RATE_PARENT
,
1759 static struct clk_branch vfe_csi_clk
= {
1763 .enable_reg
= 0x0104,
1764 .enable_mask
= BIT(12),
1765 .hw
.init
= &(struct clk_init_data
){
1766 .parent_names
= (const char *[]){ "vfe_src" },
1768 .name
= "vfe_csi_clk",
1769 .ops
= &clk_branch_ops
,
1770 .flags
= CLK_SET_RATE_PARENT
,
1775 static struct clk_branch gmem_axi_clk
= {
1779 .enable_reg
= 0x0018,
1780 .enable_mask
= BIT(24),
1781 .hw
.init
= &(struct clk_init_data
){
1782 .name
= "gmem_axi_clk",
1783 .ops
= &clk_branch_ops
,
1788 static struct clk_branch ijpeg_axi_clk
= {
1794 .enable_reg
= 0x0018,
1795 .enable_mask
= BIT(21),
1796 .hw
.init
= &(struct clk_init_data
){
1797 .name
= "ijpeg_axi_clk",
1798 .ops
= &clk_branch_ops
,
1803 static struct clk_branch mmss_imem_axi_clk
= {
1809 .enable_reg
= 0x0018,
1810 .enable_mask
= BIT(22),
1811 .hw
.init
= &(struct clk_init_data
){
1812 .name
= "mmss_imem_axi_clk",
1813 .ops
= &clk_branch_ops
,
1818 static struct clk_branch jpegd_axi_clk
= {
1822 .enable_reg
= 0x0018,
1823 .enable_mask
= BIT(25),
1824 .hw
.init
= &(struct clk_init_data
){
1825 .name
= "jpegd_axi_clk",
1826 .ops
= &clk_branch_ops
,
1831 static struct clk_branch vcodec_axi_b_clk
= {
1837 .enable_reg
= 0x0114,
1838 .enable_mask
= BIT(23),
1839 .hw
.init
= &(struct clk_init_data
){
1840 .name
= "vcodec_axi_b_clk",
1841 .ops
= &clk_branch_ops
,
1846 static struct clk_branch vcodec_axi_a_clk
= {
1852 .enable_reg
= 0x0114,
1853 .enable_mask
= BIT(25),
1854 .hw
.init
= &(struct clk_init_data
){
1855 .name
= "vcodec_axi_a_clk",
1856 .ops
= &clk_branch_ops
,
1861 static struct clk_branch vcodec_axi_clk
= {
1867 .enable_reg
= 0x0018,
1868 .enable_mask
= BIT(19),
1869 .hw
.init
= &(struct clk_init_data
){
1870 .name
= "vcodec_axi_clk",
1871 .ops
= &clk_branch_ops
,
1876 static struct clk_branch vfe_axi_clk
= {
1880 .enable_reg
= 0x0018,
1881 .enable_mask
= BIT(18),
1882 .hw
.init
= &(struct clk_init_data
){
1883 .name
= "vfe_axi_clk",
1884 .ops
= &clk_branch_ops
,
1889 static struct clk_branch mdp_axi_clk
= {
1895 .enable_reg
= 0x0018,
1896 .enable_mask
= BIT(23),
1897 .hw
.init
= &(struct clk_init_data
){
1898 .name
= "mdp_axi_clk",
1899 .ops
= &clk_branch_ops
,
1904 static struct clk_branch rot_axi_clk
= {
1910 .enable_reg
= 0x0020,
1911 .enable_mask
= BIT(24),
1912 .hw
.init
= &(struct clk_init_data
){
1913 .name
= "rot_axi_clk",
1914 .ops
= &clk_branch_ops
,
1919 static struct clk_branch vcap_axi_clk
= {
1925 .enable_reg
= 0x0244,
1926 .enable_mask
= BIT(12),
1927 .hw
.init
= &(struct clk_init_data
){
1928 .name
= "vcap_axi_clk",
1929 .ops
= &clk_branch_ops
,
1934 static struct clk_branch vpe_axi_clk
= {
1940 .enable_reg
= 0x0020,
1941 .enable_mask
= BIT(26),
1942 .hw
.init
= &(struct clk_init_data
){
1943 .name
= "vpe_axi_clk",
1944 .ops
= &clk_branch_ops
,
1949 static struct clk_branch gfx3d_axi_clk
= {
1955 .enable_reg
= 0x0244,
1956 .enable_mask
= BIT(25),
1957 .hw
.init
= &(struct clk_init_data
){
1958 .name
= "gfx3d_axi_clk",
1959 .ops
= &clk_branch_ops
,
1964 static struct clk_branch amp_ahb_clk
= {
1968 .enable_reg
= 0x0008,
1969 .enable_mask
= BIT(24),
1970 .hw
.init
= &(struct clk_init_data
){
1971 .name
= "amp_ahb_clk",
1972 .ops
= &clk_branch_ops
,
1977 static struct clk_branch csi_ahb_clk
= {
1981 .enable_reg
= 0x0008,
1982 .enable_mask
= BIT(7),
1983 .hw
.init
= &(struct clk_init_data
){
1984 .name
= "csi_ahb_clk",
1985 .ops
= &clk_branch_ops
,
1990 static struct clk_branch dsi_m_ahb_clk
= {
1994 .enable_reg
= 0x0008,
1995 .enable_mask
= BIT(9),
1996 .hw
.init
= &(struct clk_init_data
){
1997 .name
= "dsi_m_ahb_clk",
1998 .ops
= &clk_branch_ops
,
2003 static struct clk_branch dsi_s_ahb_clk
= {
2009 .enable_reg
= 0x0008,
2010 .enable_mask
= BIT(18),
2011 .hw
.init
= &(struct clk_init_data
){
2012 .name
= "dsi_s_ahb_clk",
2013 .ops
= &clk_branch_ops
,
2018 static struct clk_branch dsi2_m_ahb_clk
= {
2022 .enable_reg
= 0x0008,
2023 .enable_mask
= BIT(17),
2024 .hw
.init
= &(struct clk_init_data
){
2025 .name
= "dsi2_m_ahb_clk",
2026 .ops
= &clk_branch_ops
,
2031 static struct clk_branch dsi2_s_ahb_clk
= {
2037 .enable_reg
= 0x0008,
2038 .enable_mask
= BIT(22),
2039 .hw
.init
= &(struct clk_init_data
){
2040 .name
= "dsi2_s_ahb_clk",
2041 .ops
= &clk_branch_ops
,
2046 static struct clk_rcg dsi1_src
= {
2051 .mnctr_reset_bit
= 7,
2052 .mnctr_mode_shift
= 6,
2058 .pre_div_shift
= 14,
2063 .parent_map
= mmcc_pxo_dsi2_dsi1_map
,
2066 .enable_reg
= 0x004c,
2067 .enable_mask
= BIT(2),
2068 .hw
.init
= &(struct clk_init_data
){
2070 .parent_names
= mmcc_pxo_dsi2_dsi1
,
2072 .ops
= &clk_rcg_bypass2_ops
,
2073 .flags
= CLK_SET_RATE_PARENT
,
2078 static struct clk_branch dsi1_clk
= {
2082 .enable_reg
= 0x004c,
2083 .enable_mask
= BIT(0),
2084 .hw
.init
= &(struct clk_init_data
){
2086 .parent_names
= (const char *[]){ "dsi1_src" },
2088 .ops
= &clk_branch_ops
,
2089 .flags
= CLK_SET_RATE_PARENT
,
2094 static struct clk_rcg dsi2_src
= {
2099 .mnctr_reset_bit
= 7,
2100 .mnctr_mode_shift
= 6,
2106 .pre_div_shift
= 14,
2111 .parent_map
= mmcc_pxo_dsi2_dsi1_map
,
2114 .enable_reg
= 0x003c,
2115 .enable_mask
= BIT(2),
2116 .hw
.init
= &(struct clk_init_data
){
2118 .parent_names
= mmcc_pxo_dsi2_dsi1
,
2120 .ops
= &clk_rcg_bypass2_ops
,
2121 .flags
= CLK_SET_RATE_PARENT
,
2126 static struct clk_branch dsi2_clk
= {
2130 .enable_reg
= 0x003c,
2131 .enable_mask
= BIT(0),
2132 .hw
.init
= &(struct clk_init_data
){
2134 .parent_names
= (const char *[]){ "dsi2_src" },
2136 .ops
= &clk_branch_ops
,
2137 .flags
= CLK_SET_RATE_PARENT
,
2142 static struct clk_rcg dsi1_byte_src
= {
2145 .pre_div_shift
= 12,
2150 .parent_map
= mmcc_pxo_dsi1_dsi2_byte_map
,
2153 .enable_reg
= 0x0090,
2154 .enable_mask
= BIT(2),
2155 .hw
.init
= &(struct clk_init_data
){
2156 .name
= "dsi1_byte_src",
2157 .parent_names
= mmcc_pxo_dsi1_dsi2_byte
,
2159 .ops
= &clk_rcg_bypass2_ops
,
2160 .flags
= CLK_SET_RATE_PARENT
,
2165 static struct clk_branch dsi1_byte_clk
= {
2169 .enable_reg
= 0x0090,
2170 .enable_mask
= BIT(0),
2171 .hw
.init
= &(struct clk_init_data
){
2172 .name
= "dsi1_byte_clk",
2173 .parent_names
= (const char *[]){ "dsi1_byte_src" },
2175 .ops
= &clk_branch_ops
,
2176 .flags
= CLK_SET_RATE_PARENT
,
2181 static struct clk_rcg dsi2_byte_src
= {
2184 .pre_div_shift
= 12,
2189 .parent_map
= mmcc_pxo_dsi1_dsi2_byte_map
,
2192 .enable_reg
= 0x0130,
2193 .enable_mask
= BIT(2),
2194 .hw
.init
= &(struct clk_init_data
){
2195 .name
= "dsi2_byte_src",
2196 .parent_names
= mmcc_pxo_dsi1_dsi2_byte
,
2198 .ops
= &clk_rcg_bypass2_ops
,
2199 .flags
= CLK_SET_RATE_PARENT
,
2204 static struct clk_branch dsi2_byte_clk
= {
2208 .enable_reg
= 0x00b4,
2209 .enable_mask
= BIT(0),
2210 .hw
.init
= &(struct clk_init_data
){
2211 .name
= "dsi2_byte_clk",
2212 .parent_names
= (const char *[]){ "dsi2_byte_src" },
2214 .ops
= &clk_branch_ops
,
2215 .flags
= CLK_SET_RATE_PARENT
,
2220 static struct clk_rcg dsi1_esc_src
= {
2223 .pre_div_shift
= 12,
2228 .parent_map
= mmcc_pxo_dsi1_dsi2_byte_map
,
2231 .enable_reg
= 0x00cc,
2232 .enable_mask
= BIT(2),
2233 .hw
.init
= &(struct clk_init_data
){
2234 .name
= "dsi1_esc_src",
2235 .parent_names
= mmcc_pxo_dsi1_dsi2_byte
,
2237 .ops
= &clk_rcg_esc_ops
,
2242 static struct clk_branch dsi1_esc_clk
= {
2246 .enable_reg
= 0x00cc,
2247 .enable_mask
= BIT(0),
2248 .hw
.init
= &(struct clk_init_data
){
2249 .name
= "dsi1_esc_clk",
2250 .parent_names
= (const char *[]){ "dsi1_esc_src" },
2252 .ops
= &clk_branch_ops
,
2253 .flags
= CLK_SET_RATE_PARENT
,
2258 static struct clk_rcg dsi2_esc_src
= {
2261 .pre_div_shift
= 12,
2266 .parent_map
= mmcc_pxo_dsi1_dsi2_byte_map
,
2269 .enable_reg
= 0x013c,
2270 .enable_mask
= BIT(2),
2271 .hw
.init
= &(struct clk_init_data
){
2272 .name
= "dsi2_esc_src",
2273 .parent_names
= mmcc_pxo_dsi1_dsi2_byte
,
2275 .ops
= &clk_rcg_esc_ops
,
2280 static struct clk_branch dsi2_esc_clk
= {
2284 .enable_reg
= 0x013c,
2285 .enable_mask
= BIT(0),
2286 .hw
.init
= &(struct clk_init_data
){
2287 .name
= "dsi2_esc_clk",
2288 .parent_names
= (const char *[]){ "dsi2_esc_src" },
2290 .ops
= &clk_branch_ops
,
2291 .flags
= CLK_SET_RATE_PARENT
,
2296 static struct clk_rcg dsi1_pixel_src
= {
2301 .mnctr_reset_bit
= 7,
2302 .mnctr_mode_shift
= 6,
2308 .pre_div_shift
= 12,
2313 .parent_map
= mmcc_pxo_dsi2_dsi1_map
,
2316 .enable_reg
= 0x0130,
2317 .enable_mask
= BIT(2),
2318 .hw
.init
= &(struct clk_init_data
){
2319 .name
= "dsi1_pixel_src",
2320 .parent_names
= mmcc_pxo_dsi2_dsi1
,
2322 .ops
= &clk_rcg_pixel_ops
,
2327 static struct clk_branch dsi1_pixel_clk
= {
2331 .enable_reg
= 0x0130,
2332 .enable_mask
= BIT(0),
2333 .hw
.init
= &(struct clk_init_data
){
2334 .name
= "mdp_pclk1_clk",
2335 .parent_names
= (const char *[]){ "dsi1_pixel_src" },
2337 .ops
= &clk_branch_ops
,
2338 .flags
= CLK_SET_RATE_PARENT
,
2343 static struct clk_rcg dsi2_pixel_src
= {
2348 .mnctr_reset_bit
= 7,
2349 .mnctr_mode_shift
= 6,
2355 .pre_div_shift
= 12,
2360 .parent_map
= mmcc_pxo_dsi2_dsi1_map
,
2363 .enable_reg
= 0x0094,
2364 .enable_mask
= BIT(2),
2365 .hw
.init
= &(struct clk_init_data
){
2366 .name
= "dsi2_pixel_src",
2367 .parent_names
= mmcc_pxo_dsi2_dsi1
,
2369 .ops
= &clk_rcg_pixel_ops
,
2374 static struct clk_branch dsi2_pixel_clk
= {
2378 .enable_reg
= 0x0094,
2379 .enable_mask
= BIT(0),
2380 .hw
.init
= &(struct clk_init_data
){
2381 .name
= "mdp_pclk2_clk",
2382 .parent_names
= (const char *[]){ "dsi2_pixel_src" },
2384 .ops
= &clk_branch_ops
,
2385 .flags
= CLK_SET_RATE_PARENT
,
2390 static struct clk_branch gfx2d0_ahb_clk
= {
2396 .enable_reg
= 0x0008,
2397 .enable_mask
= BIT(19),
2398 .hw
.init
= &(struct clk_init_data
){
2399 .name
= "gfx2d0_ahb_clk",
2400 .ops
= &clk_branch_ops
,
2405 static struct clk_branch gfx2d1_ahb_clk
= {
2411 .enable_reg
= 0x0008,
2412 .enable_mask
= BIT(2),
2413 .hw
.init
= &(struct clk_init_data
){
2414 .name
= "gfx2d1_ahb_clk",
2415 .ops
= &clk_branch_ops
,
2420 static struct clk_branch gfx3d_ahb_clk
= {
2426 .enable_reg
= 0x0008,
2427 .enable_mask
= BIT(3),
2428 .hw
.init
= &(struct clk_init_data
){
2429 .name
= "gfx3d_ahb_clk",
2430 .ops
= &clk_branch_ops
,
2435 static struct clk_branch hdmi_m_ahb_clk
= {
2441 .enable_reg
= 0x0008,
2442 .enable_mask
= BIT(14),
2443 .hw
.init
= &(struct clk_init_data
){
2444 .name
= "hdmi_m_ahb_clk",
2445 .ops
= &clk_branch_ops
,
2450 static struct clk_branch hdmi_s_ahb_clk
= {
2456 .enable_reg
= 0x0008,
2457 .enable_mask
= BIT(4),
2458 .hw
.init
= &(struct clk_init_data
){
2459 .name
= "hdmi_s_ahb_clk",
2460 .ops
= &clk_branch_ops
,
2465 static struct clk_branch ijpeg_ahb_clk
= {
2469 .enable_reg
= 0x0008,
2470 .enable_mask
= BIT(5),
2471 .hw
.init
= &(struct clk_init_data
){
2472 .name
= "ijpeg_ahb_clk",
2473 .ops
= &clk_branch_ops
,
2478 static struct clk_branch mmss_imem_ahb_clk
= {
2484 .enable_reg
= 0x0008,
2485 .enable_mask
= BIT(6),
2486 .hw
.init
= &(struct clk_init_data
){
2487 .name
= "mmss_imem_ahb_clk",
2488 .ops
= &clk_branch_ops
,
2493 static struct clk_branch jpegd_ahb_clk
= {
2497 .enable_reg
= 0x0008,
2498 .enable_mask
= BIT(21),
2499 .hw
.init
= &(struct clk_init_data
){
2500 .name
= "jpegd_ahb_clk",
2501 .ops
= &clk_branch_ops
,
2506 static struct clk_branch mdp_ahb_clk
= {
2510 .enable_reg
= 0x0008,
2511 .enable_mask
= BIT(10),
2512 .hw
.init
= &(struct clk_init_data
){
2513 .name
= "mdp_ahb_clk",
2514 .ops
= &clk_branch_ops
,
2519 static struct clk_branch rot_ahb_clk
= {
2523 .enable_reg
= 0x0008,
2524 .enable_mask
= BIT(12),
2525 .hw
.init
= &(struct clk_init_data
){
2526 .name
= "rot_ahb_clk",
2527 .ops
= &clk_branch_ops
,
2532 static struct clk_branch smmu_ahb_clk
= {
2538 .enable_reg
= 0x0008,
2539 .enable_mask
= BIT(15),
2540 .hw
.init
= &(struct clk_init_data
){
2541 .name
= "smmu_ahb_clk",
2542 .ops
= &clk_branch_ops
,
2547 static struct clk_branch tv_enc_ahb_clk
= {
2551 .enable_reg
= 0x0008,
2552 .enable_mask
= BIT(25),
2553 .hw
.init
= &(struct clk_init_data
){
2554 .name
= "tv_enc_ahb_clk",
2555 .ops
= &clk_branch_ops
,
2560 static struct clk_branch vcap_ahb_clk
= {
2564 .enable_reg
= 0x0248,
2565 .enable_mask
= BIT(1),
2566 .hw
.init
= &(struct clk_init_data
){
2567 .name
= "vcap_ahb_clk",
2568 .ops
= &clk_branch_ops
,
2573 static struct clk_branch vcodec_ahb_clk
= {
2579 .enable_reg
= 0x0008,
2580 .enable_mask
= BIT(11),
2581 .hw
.init
= &(struct clk_init_data
){
2582 .name
= "vcodec_ahb_clk",
2583 .ops
= &clk_branch_ops
,
2588 static struct clk_branch vfe_ahb_clk
= {
2592 .enable_reg
= 0x0008,
2593 .enable_mask
= BIT(13),
2594 .hw
.init
= &(struct clk_init_data
){
2595 .name
= "vfe_ahb_clk",
2596 .ops
= &clk_branch_ops
,
2601 static struct clk_branch vpe_ahb_clk
= {
2605 .enable_reg
= 0x0008,
2606 .enable_mask
= BIT(16),
2607 .hw
.init
= &(struct clk_init_data
){
2608 .name
= "vpe_ahb_clk",
2609 .ops
= &clk_branch_ops
,
2614 static struct clk_regmap
*mmcc_msm8960_clks
[] = {
2615 [TV_ENC_AHB_CLK
] = &tv_enc_ahb_clk
.clkr
,
2616 [AMP_AHB_CLK
] = &_ahb_clk
.clkr
,
2617 [DSI2_S_AHB_CLK
] = &dsi2_s_ahb_clk
.clkr
,
2618 [JPEGD_AHB_CLK
] = &jpegd_ahb_clk
.clkr
,
2619 [GFX2D0_AHB_CLK
] = &gfx2d0_ahb_clk
.clkr
,
2620 [DSI_S_AHB_CLK
] = &dsi_s_ahb_clk
.clkr
,
2621 [DSI2_M_AHB_CLK
] = &dsi2_m_ahb_clk
.clkr
,
2622 [VPE_AHB_CLK
] = &vpe_ahb_clk
.clkr
,
2623 [SMMU_AHB_CLK
] = &smmu_ahb_clk
.clkr
,
2624 [HDMI_M_AHB_CLK
] = &hdmi_m_ahb_clk
.clkr
,
2625 [VFE_AHB_CLK
] = &vfe_ahb_clk
.clkr
,
2626 [ROT_AHB_CLK
] = &rot_ahb_clk
.clkr
,
2627 [VCODEC_AHB_CLK
] = &vcodec_ahb_clk
.clkr
,
2628 [MDP_AHB_CLK
] = &mdp_ahb_clk
.clkr
,
2629 [DSI_M_AHB_CLK
] = &dsi_m_ahb_clk
.clkr
,
2630 [CSI_AHB_CLK
] = &csi_ahb_clk
.clkr
,
2631 [MMSS_IMEM_AHB_CLK
] = &mmss_imem_ahb_clk
.clkr
,
2632 [IJPEG_AHB_CLK
] = &ijpeg_ahb_clk
.clkr
,
2633 [HDMI_S_AHB_CLK
] = &hdmi_s_ahb_clk
.clkr
,
2634 [GFX3D_AHB_CLK
] = &gfx3d_ahb_clk
.clkr
,
2635 [GFX2D1_AHB_CLK
] = &gfx2d1_ahb_clk
.clkr
,
2636 [JPEGD_AXI_CLK
] = &jpegd_axi_clk
.clkr
,
2637 [GMEM_AXI_CLK
] = &gmem_axi_clk
.clkr
,
2638 [MDP_AXI_CLK
] = &mdp_axi_clk
.clkr
,
2639 [MMSS_IMEM_AXI_CLK
] = &mmss_imem_axi_clk
.clkr
,
2640 [IJPEG_AXI_CLK
] = &ijpeg_axi_clk
.clkr
,
2641 [GFX3D_AXI_CLK
] = &gfx3d_axi_clk
.clkr
,
2642 [VCODEC_AXI_CLK
] = &vcodec_axi_clk
.clkr
,
2643 [VFE_AXI_CLK
] = &vfe_axi_clk
.clkr
,
2644 [VPE_AXI_CLK
] = &vpe_axi_clk
.clkr
,
2645 [ROT_AXI_CLK
] = &rot_axi_clk
.clkr
,
2646 [VCODEC_AXI_A_CLK
] = &vcodec_axi_a_clk
.clkr
,
2647 [VCODEC_AXI_B_CLK
] = &vcodec_axi_b_clk
.clkr
,
2648 [CSI0_SRC
] = &csi0_src
.clkr
,
2649 [CSI0_CLK
] = &csi0_clk
.clkr
,
2650 [CSI0_PHY_CLK
] = &csi0_phy_clk
.clkr
,
2651 [CSI1_SRC
] = &csi1_src
.clkr
,
2652 [CSI1_CLK
] = &csi1_clk
.clkr
,
2653 [CSI1_PHY_CLK
] = &csi1_phy_clk
.clkr
,
2654 [CSI2_SRC
] = &csi2_src
.clkr
,
2655 [CSI2_CLK
] = &csi2_clk
.clkr
,
2656 [CSI2_PHY_CLK
] = &csi2_phy_clk
.clkr
,
2657 [DSI_SRC
] = &dsi1_src
.clkr
,
2658 [DSI_CLK
] = &dsi1_clk
.clkr
,
2659 [CSI_PIX_CLK
] = &csi_pix_clk
.clkr
,
2660 [CSI_RDI_CLK
] = &csi_rdi_clk
.clkr
,
2661 [MDP_VSYNC_CLK
] = &mdp_vsync_clk
.clkr
,
2662 [HDMI_APP_CLK
] = &hdmi_app_clk
.clkr
,
2663 [CSI_PIX1_CLK
] = &csi_pix1_clk
.clkr
,
2664 [CSI_RDI2_CLK
] = &csi_rdi2_clk
.clkr
,
2665 [CSI_RDI1_CLK
] = &csi_rdi1_clk
.clkr
,
2666 [GFX2D0_SRC
] = &gfx2d0_src
.clkr
,
2667 [GFX2D0_CLK
] = &gfx2d0_clk
.clkr
,
2668 [GFX2D1_SRC
] = &gfx2d1_src
.clkr
,
2669 [GFX2D1_CLK
] = &gfx2d1_clk
.clkr
,
2670 [GFX3D_SRC
] = &gfx3d_src
.clkr
,
2671 [GFX3D_CLK
] = &gfx3d_clk
.clkr
,
2672 [IJPEG_SRC
] = &ijpeg_src
.clkr
,
2673 [IJPEG_CLK
] = &ijpeg_clk
.clkr
,
2674 [JPEGD_SRC
] = &jpegd_src
.clkr
,
2675 [JPEGD_CLK
] = &jpegd_clk
.clkr
,
2676 [MDP_SRC
] = &mdp_src
.clkr
,
2677 [MDP_CLK
] = &mdp_clk
.clkr
,
2678 [MDP_LUT_CLK
] = &mdp_lut_clk
.clkr
,
2679 [DSI2_PIXEL_SRC
] = &dsi2_pixel_src
.clkr
,
2680 [DSI2_PIXEL_CLK
] = &dsi2_pixel_clk
.clkr
,
2681 [DSI2_SRC
] = &dsi2_src
.clkr
,
2682 [DSI2_CLK
] = &dsi2_clk
.clkr
,
2683 [DSI1_BYTE_SRC
] = &dsi1_byte_src
.clkr
,
2684 [DSI1_BYTE_CLK
] = &dsi1_byte_clk
.clkr
,
2685 [DSI2_BYTE_SRC
] = &dsi2_byte_src
.clkr
,
2686 [DSI2_BYTE_CLK
] = &dsi2_byte_clk
.clkr
,
2687 [DSI1_ESC_SRC
] = &dsi1_esc_src
.clkr
,
2688 [DSI1_ESC_CLK
] = &dsi1_esc_clk
.clkr
,
2689 [DSI2_ESC_SRC
] = &dsi2_esc_src
.clkr
,
2690 [DSI2_ESC_CLK
] = &dsi2_esc_clk
.clkr
,
2691 [ROT_SRC
] = &rot_src
.clkr
,
2692 [ROT_CLK
] = &rot_clk
.clkr
,
2693 [TV_ENC_CLK
] = &tv_enc_clk
.clkr
,
2694 [TV_DAC_CLK
] = &tv_dac_clk
.clkr
,
2695 [HDMI_TV_CLK
] = &hdmi_tv_clk
.clkr
,
2696 [MDP_TV_CLK
] = &mdp_tv_clk
.clkr
,
2697 [TV_SRC
] = &tv_src
.clkr
,
2698 [VCODEC_SRC
] = &vcodec_src
.clkr
,
2699 [VCODEC_CLK
] = &vcodec_clk
.clkr
,
2700 [VFE_SRC
] = &vfe_src
.clkr
,
2701 [VFE_CLK
] = &vfe_clk
.clkr
,
2702 [VFE_CSI_CLK
] = &vfe_csi_clk
.clkr
,
2703 [VPE_SRC
] = &vpe_src
.clkr
,
2704 [VPE_CLK
] = &vpe_clk
.clkr
,
2705 [DSI_PIXEL_SRC
] = &dsi1_pixel_src
.clkr
,
2706 [DSI_PIXEL_CLK
] = &dsi1_pixel_clk
.clkr
,
2707 [CAMCLK0_SRC
] = &camclk0_src
.clkr
,
2708 [CAMCLK0_CLK
] = &camclk0_clk
.clkr
,
2709 [CAMCLK1_SRC
] = &camclk1_src
.clkr
,
2710 [CAMCLK1_CLK
] = &camclk1_clk
.clkr
,
2711 [CAMCLK2_SRC
] = &camclk2_src
.clkr
,
2712 [CAMCLK2_CLK
] = &camclk2_clk
.clkr
,
2713 [CSIPHYTIMER_SRC
] = &csiphytimer_src
.clkr
,
2714 [CSIPHY2_TIMER_CLK
] = &csiphy2_timer_clk
.clkr
,
2715 [CSIPHY1_TIMER_CLK
] = &csiphy1_timer_clk
.clkr
,
2716 [CSIPHY0_TIMER_CLK
] = &csiphy0_timer_clk
.clkr
,
2717 [PLL2
] = &pll2
.clkr
,
2720 static const struct qcom_reset_map mmcc_msm8960_resets
[] = {
2721 [VPE_AXI_RESET
] = { 0x0208, 15 },
2722 [IJPEG_AXI_RESET
] = { 0x0208, 14 },
2723 [MPD_AXI_RESET
] = { 0x0208, 13 },
2724 [VFE_AXI_RESET
] = { 0x0208, 9 },
2725 [SP_AXI_RESET
] = { 0x0208, 8 },
2726 [VCODEC_AXI_RESET
] = { 0x0208, 7 },
2727 [ROT_AXI_RESET
] = { 0x0208, 6 },
2728 [VCODEC_AXI_A_RESET
] = { 0x0208, 5 },
2729 [VCODEC_AXI_B_RESET
] = { 0x0208, 4 },
2730 [FAB_S3_AXI_RESET
] = { 0x0208, 3 },
2731 [FAB_S2_AXI_RESET
] = { 0x0208, 2 },
2732 [FAB_S1_AXI_RESET
] = { 0x0208, 1 },
2733 [FAB_S0_AXI_RESET
] = { 0x0208 },
2734 [SMMU_GFX3D_ABH_RESET
] = { 0x020c, 31 },
2735 [SMMU_VPE_AHB_RESET
] = { 0x020c, 30 },
2736 [SMMU_VFE_AHB_RESET
] = { 0x020c, 29 },
2737 [SMMU_ROT_AHB_RESET
] = { 0x020c, 28 },
2738 [SMMU_VCODEC_B_AHB_RESET
] = { 0x020c, 27 },
2739 [SMMU_VCODEC_A_AHB_RESET
] = { 0x020c, 26 },
2740 [SMMU_MDP1_AHB_RESET
] = { 0x020c, 25 },
2741 [SMMU_MDP0_AHB_RESET
] = { 0x020c, 24 },
2742 [SMMU_JPEGD_AHB_RESET
] = { 0x020c, 23 },
2743 [SMMU_IJPEG_AHB_RESET
] = { 0x020c, 22 },
2744 [SMMU_GFX2D0_AHB_RESET
] = { 0x020c, 21 },
2745 [SMMU_GFX2D1_AHB_RESET
] = { 0x020c, 20 },
2746 [APU_AHB_RESET
] = { 0x020c, 18 },
2747 [CSI_AHB_RESET
] = { 0x020c, 17 },
2748 [TV_ENC_AHB_RESET
] = { 0x020c, 15 },
2749 [VPE_AHB_RESET
] = { 0x020c, 14 },
2750 [FABRIC_AHB_RESET
] = { 0x020c, 13 },
2751 [GFX2D0_AHB_RESET
] = { 0x020c, 12 },
2752 [GFX2D1_AHB_RESET
] = { 0x020c, 11 },
2753 [GFX3D_AHB_RESET
] = { 0x020c, 10 },
2754 [HDMI_AHB_RESET
] = { 0x020c, 9 },
2755 [MSSS_IMEM_AHB_RESET
] = { 0x020c, 8 },
2756 [IJPEG_AHB_RESET
] = { 0x020c, 7 },
2757 [DSI_M_AHB_RESET
] = { 0x020c, 6 },
2758 [DSI_S_AHB_RESET
] = { 0x020c, 5 },
2759 [JPEGD_AHB_RESET
] = { 0x020c, 4 },
2760 [MDP_AHB_RESET
] = { 0x020c, 3 },
2761 [ROT_AHB_RESET
] = { 0x020c, 2 },
2762 [VCODEC_AHB_RESET
] = { 0x020c, 1 },
2763 [VFE_AHB_RESET
] = { 0x020c, 0 },
2764 [DSI2_M_AHB_RESET
] = { 0x0210, 31 },
2765 [DSI2_S_AHB_RESET
] = { 0x0210, 30 },
2766 [CSIPHY2_RESET
] = { 0x0210, 29 },
2767 [CSI_PIX1_RESET
] = { 0x0210, 28 },
2768 [CSIPHY0_RESET
] = { 0x0210, 27 },
2769 [CSIPHY1_RESET
] = { 0x0210, 26 },
2770 [DSI2_RESET
] = { 0x0210, 25 },
2771 [VFE_CSI_RESET
] = { 0x0210, 24 },
2772 [MDP_RESET
] = { 0x0210, 21 },
2773 [AMP_RESET
] = { 0x0210, 20 },
2774 [JPEGD_RESET
] = { 0x0210, 19 },
2775 [CSI1_RESET
] = { 0x0210, 18 },
2776 [VPE_RESET
] = { 0x0210, 17 },
2777 [MMSS_FABRIC_RESET
] = { 0x0210, 16 },
2778 [VFE_RESET
] = { 0x0210, 15 },
2779 [GFX2D0_RESET
] = { 0x0210, 14 },
2780 [GFX2D1_RESET
] = { 0x0210, 13 },
2781 [GFX3D_RESET
] = { 0x0210, 12 },
2782 [HDMI_RESET
] = { 0x0210, 11 },
2783 [MMSS_IMEM_RESET
] = { 0x0210, 10 },
2784 [IJPEG_RESET
] = { 0x0210, 9 },
2785 [CSI0_RESET
] = { 0x0210, 8 },
2786 [DSI_RESET
] = { 0x0210, 7 },
2787 [VCODEC_RESET
] = { 0x0210, 6 },
2788 [MDP_TV_RESET
] = { 0x0210, 4 },
2789 [MDP_VSYNC_RESET
] = { 0x0210, 3 },
2790 [ROT_RESET
] = { 0x0210, 2 },
2791 [TV_HDMI_RESET
] = { 0x0210, 1 },
2792 [TV_ENC_RESET
] = { 0x0210 },
2793 [CSI2_RESET
] = { 0x0214, 2 },
2794 [CSI_RDI1_RESET
] = { 0x0214, 1 },
2795 [CSI_RDI2_RESET
] = { 0x0214 },
2798 static struct clk_regmap
*mmcc_apq8064_clks
[] = {
2799 [AMP_AHB_CLK
] = &_ahb_clk
.clkr
,
2800 [DSI2_S_AHB_CLK
] = &dsi2_s_ahb_clk
.clkr
,
2801 [JPEGD_AHB_CLK
] = &jpegd_ahb_clk
.clkr
,
2802 [DSI_S_AHB_CLK
] = &dsi_s_ahb_clk
.clkr
,
2803 [DSI2_M_AHB_CLK
] = &dsi2_m_ahb_clk
.clkr
,
2804 [VPE_AHB_CLK
] = &vpe_ahb_clk
.clkr
,
2805 [SMMU_AHB_CLK
] = &smmu_ahb_clk
.clkr
,
2806 [HDMI_M_AHB_CLK
] = &hdmi_m_ahb_clk
.clkr
,
2807 [VFE_AHB_CLK
] = &vfe_ahb_clk
.clkr
,
2808 [ROT_AHB_CLK
] = &rot_ahb_clk
.clkr
,
2809 [VCODEC_AHB_CLK
] = &vcodec_ahb_clk
.clkr
,
2810 [MDP_AHB_CLK
] = &mdp_ahb_clk
.clkr
,
2811 [DSI_M_AHB_CLK
] = &dsi_m_ahb_clk
.clkr
,
2812 [CSI_AHB_CLK
] = &csi_ahb_clk
.clkr
,
2813 [MMSS_IMEM_AHB_CLK
] = &mmss_imem_ahb_clk
.clkr
,
2814 [IJPEG_AHB_CLK
] = &ijpeg_ahb_clk
.clkr
,
2815 [HDMI_S_AHB_CLK
] = &hdmi_s_ahb_clk
.clkr
,
2816 [GFX3D_AHB_CLK
] = &gfx3d_ahb_clk
.clkr
,
2817 [JPEGD_AXI_CLK
] = &jpegd_axi_clk
.clkr
,
2818 [GMEM_AXI_CLK
] = &gmem_axi_clk
.clkr
,
2819 [MDP_AXI_CLK
] = &mdp_axi_clk
.clkr
,
2820 [MMSS_IMEM_AXI_CLK
] = &mmss_imem_axi_clk
.clkr
,
2821 [IJPEG_AXI_CLK
] = &ijpeg_axi_clk
.clkr
,
2822 [GFX3D_AXI_CLK
] = &gfx3d_axi_clk
.clkr
,
2823 [VCODEC_AXI_CLK
] = &vcodec_axi_clk
.clkr
,
2824 [VFE_AXI_CLK
] = &vfe_axi_clk
.clkr
,
2825 [VPE_AXI_CLK
] = &vpe_axi_clk
.clkr
,
2826 [ROT_AXI_CLK
] = &rot_axi_clk
.clkr
,
2827 [VCODEC_AXI_A_CLK
] = &vcodec_axi_a_clk
.clkr
,
2828 [VCODEC_AXI_B_CLK
] = &vcodec_axi_b_clk
.clkr
,
2829 [CSI0_SRC
] = &csi0_src
.clkr
,
2830 [CSI0_CLK
] = &csi0_clk
.clkr
,
2831 [CSI0_PHY_CLK
] = &csi0_phy_clk
.clkr
,
2832 [CSI1_SRC
] = &csi1_src
.clkr
,
2833 [CSI1_CLK
] = &csi1_clk
.clkr
,
2834 [CSI1_PHY_CLK
] = &csi1_phy_clk
.clkr
,
2835 [CSI2_SRC
] = &csi2_src
.clkr
,
2836 [CSI2_CLK
] = &csi2_clk
.clkr
,
2837 [CSI2_PHY_CLK
] = &csi2_phy_clk
.clkr
,
2838 [DSI_SRC
] = &dsi1_src
.clkr
,
2839 [DSI_CLK
] = &dsi1_clk
.clkr
,
2840 [CSI_PIX_CLK
] = &csi_pix_clk
.clkr
,
2841 [CSI_RDI_CLK
] = &csi_rdi_clk
.clkr
,
2842 [MDP_VSYNC_CLK
] = &mdp_vsync_clk
.clkr
,
2843 [HDMI_APP_CLK
] = &hdmi_app_clk
.clkr
,
2844 [CSI_PIX1_CLK
] = &csi_pix1_clk
.clkr
,
2845 [CSI_RDI2_CLK
] = &csi_rdi2_clk
.clkr
,
2846 [CSI_RDI1_CLK
] = &csi_rdi1_clk
.clkr
,
2847 [GFX3D_SRC
] = &gfx3d_src
.clkr
,
2848 [GFX3D_CLK
] = &gfx3d_clk
.clkr
,
2849 [IJPEG_SRC
] = &ijpeg_src
.clkr
,
2850 [IJPEG_CLK
] = &ijpeg_clk
.clkr
,
2851 [JPEGD_SRC
] = &jpegd_src
.clkr
,
2852 [JPEGD_CLK
] = &jpegd_clk
.clkr
,
2853 [MDP_SRC
] = &mdp_src
.clkr
,
2854 [MDP_CLK
] = &mdp_clk
.clkr
,
2855 [MDP_LUT_CLK
] = &mdp_lut_clk
.clkr
,
2856 [DSI2_PIXEL_SRC
] = &dsi2_pixel_src
.clkr
,
2857 [DSI2_PIXEL_CLK
] = &dsi2_pixel_clk
.clkr
,
2858 [DSI2_SRC
] = &dsi2_src
.clkr
,
2859 [DSI2_CLK
] = &dsi2_clk
.clkr
,
2860 [DSI1_BYTE_SRC
] = &dsi1_byte_src
.clkr
,
2861 [DSI1_BYTE_CLK
] = &dsi1_byte_clk
.clkr
,
2862 [DSI2_BYTE_SRC
] = &dsi2_byte_src
.clkr
,
2863 [DSI2_BYTE_CLK
] = &dsi2_byte_clk
.clkr
,
2864 [DSI1_ESC_SRC
] = &dsi1_esc_src
.clkr
,
2865 [DSI1_ESC_CLK
] = &dsi1_esc_clk
.clkr
,
2866 [DSI2_ESC_SRC
] = &dsi2_esc_src
.clkr
,
2867 [DSI2_ESC_CLK
] = &dsi2_esc_clk
.clkr
,
2868 [ROT_SRC
] = &rot_src
.clkr
,
2869 [ROT_CLK
] = &rot_clk
.clkr
,
2870 [TV_DAC_CLK
] = &tv_dac_clk
.clkr
,
2871 [HDMI_TV_CLK
] = &hdmi_tv_clk
.clkr
,
2872 [MDP_TV_CLK
] = &mdp_tv_clk
.clkr
,
2873 [TV_SRC
] = &tv_src
.clkr
,
2874 [VCODEC_SRC
] = &vcodec_src
.clkr
,
2875 [VCODEC_CLK
] = &vcodec_clk
.clkr
,
2876 [VFE_SRC
] = &vfe_src
.clkr
,
2877 [VFE_CLK
] = &vfe_clk
.clkr
,
2878 [VFE_CSI_CLK
] = &vfe_csi_clk
.clkr
,
2879 [VPE_SRC
] = &vpe_src
.clkr
,
2880 [VPE_CLK
] = &vpe_clk
.clkr
,
2881 [DSI_PIXEL_SRC
] = &dsi1_pixel_src
.clkr
,
2882 [DSI_PIXEL_CLK
] = &dsi1_pixel_clk
.clkr
,
2883 [CAMCLK0_SRC
] = &camclk0_src
.clkr
,
2884 [CAMCLK0_CLK
] = &camclk0_clk
.clkr
,
2885 [CAMCLK1_SRC
] = &camclk1_src
.clkr
,
2886 [CAMCLK1_CLK
] = &camclk1_clk
.clkr
,
2887 [CAMCLK2_SRC
] = &camclk2_src
.clkr
,
2888 [CAMCLK2_CLK
] = &camclk2_clk
.clkr
,
2889 [CSIPHYTIMER_SRC
] = &csiphytimer_src
.clkr
,
2890 [CSIPHY2_TIMER_CLK
] = &csiphy2_timer_clk
.clkr
,
2891 [CSIPHY1_TIMER_CLK
] = &csiphy1_timer_clk
.clkr
,
2892 [CSIPHY0_TIMER_CLK
] = &csiphy0_timer_clk
.clkr
,
2893 [PLL2
] = &pll2
.clkr
,
2894 [RGB_TV_CLK
] = &rgb_tv_clk
.clkr
,
2895 [NPL_TV_CLK
] = &npl_tv_clk
.clkr
,
2896 [VCAP_AHB_CLK
] = &vcap_ahb_clk
.clkr
,
2897 [VCAP_AXI_CLK
] = &vcap_axi_clk
.clkr
,
2898 [VCAP_SRC
] = &vcap_src
.clkr
,
2899 [VCAP_CLK
] = &vcap_clk
.clkr
,
2900 [VCAP_NPL_CLK
] = &vcap_npl_clk
.clkr
,
2901 [PLL15
] = &pll15
.clkr
,
2904 static const struct qcom_reset_map mmcc_apq8064_resets
[] = {
2905 [GFX3D_AXI_RESET
] = { 0x0208, 17 },
2906 [VCAP_AXI_RESET
] = { 0x0208, 16 },
2907 [VPE_AXI_RESET
] = { 0x0208, 15 },
2908 [IJPEG_AXI_RESET
] = { 0x0208, 14 },
2909 [MPD_AXI_RESET
] = { 0x0208, 13 },
2910 [VFE_AXI_RESET
] = { 0x0208, 9 },
2911 [SP_AXI_RESET
] = { 0x0208, 8 },
2912 [VCODEC_AXI_RESET
] = { 0x0208, 7 },
2913 [ROT_AXI_RESET
] = { 0x0208, 6 },
2914 [VCODEC_AXI_A_RESET
] = { 0x0208, 5 },
2915 [VCODEC_AXI_B_RESET
] = { 0x0208, 4 },
2916 [FAB_S3_AXI_RESET
] = { 0x0208, 3 },
2917 [FAB_S2_AXI_RESET
] = { 0x0208, 2 },
2918 [FAB_S1_AXI_RESET
] = { 0x0208, 1 },
2919 [FAB_S0_AXI_RESET
] = { 0x0208 },
2920 [SMMU_GFX3D_ABH_RESET
] = { 0x020c, 31 },
2921 [SMMU_VPE_AHB_RESET
] = { 0x020c, 30 },
2922 [SMMU_VFE_AHB_RESET
] = { 0x020c, 29 },
2923 [SMMU_ROT_AHB_RESET
] = { 0x020c, 28 },
2924 [SMMU_VCODEC_B_AHB_RESET
] = { 0x020c, 27 },
2925 [SMMU_VCODEC_A_AHB_RESET
] = { 0x020c, 26 },
2926 [SMMU_MDP1_AHB_RESET
] = { 0x020c, 25 },
2927 [SMMU_MDP0_AHB_RESET
] = { 0x020c, 24 },
2928 [SMMU_JPEGD_AHB_RESET
] = { 0x020c, 23 },
2929 [SMMU_IJPEG_AHB_RESET
] = { 0x020c, 22 },
2930 [APU_AHB_RESET
] = { 0x020c, 18 },
2931 [CSI_AHB_RESET
] = { 0x020c, 17 },
2932 [TV_ENC_AHB_RESET
] = { 0x020c, 15 },
2933 [VPE_AHB_RESET
] = { 0x020c, 14 },
2934 [FABRIC_AHB_RESET
] = { 0x020c, 13 },
2935 [GFX3D_AHB_RESET
] = { 0x020c, 10 },
2936 [HDMI_AHB_RESET
] = { 0x020c, 9 },
2937 [MSSS_IMEM_AHB_RESET
] = { 0x020c, 8 },
2938 [IJPEG_AHB_RESET
] = { 0x020c, 7 },
2939 [DSI_M_AHB_RESET
] = { 0x020c, 6 },
2940 [DSI_S_AHB_RESET
] = { 0x020c, 5 },
2941 [JPEGD_AHB_RESET
] = { 0x020c, 4 },
2942 [MDP_AHB_RESET
] = { 0x020c, 3 },
2943 [ROT_AHB_RESET
] = { 0x020c, 2 },
2944 [VCODEC_AHB_RESET
] = { 0x020c, 1 },
2945 [VFE_AHB_RESET
] = { 0x020c, 0 },
2946 [SMMU_VCAP_AHB_RESET
] = { 0x0200, 3 },
2947 [VCAP_AHB_RESET
] = { 0x0200, 2 },
2948 [DSI2_M_AHB_RESET
] = { 0x0200, 1 },
2949 [DSI2_S_AHB_RESET
] = { 0x0200, 0 },
2950 [CSIPHY2_RESET
] = { 0x0210, 31 },
2951 [CSI_PIX1_RESET
] = { 0x0210, 30 },
2952 [CSIPHY0_RESET
] = { 0x0210, 29 },
2953 [CSIPHY1_RESET
] = { 0x0210, 28 },
2954 [CSI_RDI_RESET
] = { 0x0210, 27 },
2955 [CSI_PIX_RESET
] = { 0x0210, 26 },
2956 [DSI2_RESET
] = { 0x0210, 25 },
2957 [VFE_CSI_RESET
] = { 0x0210, 24 },
2958 [MDP_RESET
] = { 0x0210, 21 },
2959 [AMP_RESET
] = { 0x0210, 20 },
2960 [JPEGD_RESET
] = { 0x0210, 19 },
2961 [CSI1_RESET
] = { 0x0210, 18 },
2962 [VPE_RESET
] = { 0x0210, 17 },
2963 [MMSS_FABRIC_RESET
] = { 0x0210, 16 },
2964 [VFE_RESET
] = { 0x0210, 15 },
2965 [GFX3D_RESET
] = { 0x0210, 12 },
2966 [HDMI_RESET
] = { 0x0210, 11 },
2967 [MMSS_IMEM_RESET
] = { 0x0210, 10 },
2968 [IJPEG_RESET
] = { 0x0210, 9 },
2969 [CSI0_RESET
] = { 0x0210, 8 },
2970 [DSI_RESET
] = { 0x0210, 7 },
2971 [VCODEC_RESET
] = { 0x0210, 6 },
2972 [MDP_TV_RESET
] = { 0x0210, 4 },
2973 [MDP_VSYNC_RESET
] = { 0x0210, 3 },
2974 [ROT_RESET
] = { 0x0210, 2 },
2975 [TV_HDMI_RESET
] = { 0x0210, 1 },
2976 [VCAP_NPL_RESET
] = { 0x0214, 4 },
2977 [VCAP_RESET
] = { 0x0214, 3 },
2978 [CSI2_RESET
] = { 0x0214, 2 },
2979 [CSI_RDI1_RESET
] = { 0x0214, 1 },
2980 [CSI_RDI2_RESET
] = { 0x0214 },
2983 static const struct regmap_config mmcc_msm8960_regmap_config
= {
2987 .max_register
= 0x334,
2991 static const struct regmap_config mmcc_apq8064_regmap_config
= {
2995 .max_register
= 0x350,
2999 static const struct qcom_cc_desc mmcc_msm8960_desc
= {
3000 .config
= &mmcc_msm8960_regmap_config
,
3001 .clks
= mmcc_msm8960_clks
,
3002 .num_clks
= ARRAY_SIZE(mmcc_msm8960_clks
),
3003 .resets
= mmcc_msm8960_resets
,
3004 .num_resets
= ARRAY_SIZE(mmcc_msm8960_resets
),
3007 static const struct qcom_cc_desc mmcc_apq8064_desc
= {
3008 .config
= &mmcc_apq8064_regmap_config
,
3009 .clks
= mmcc_apq8064_clks
,
3010 .num_clks
= ARRAY_SIZE(mmcc_apq8064_clks
),
3011 .resets
= mmcc_apq8064_resets
,
3012 .num_resets
= ARRAY_SIZE(mmcc_apq8064_resets
),
3015 static const struct of_device_id mmcc_msm8960_match_table
[] = {
3016 { .compatible
= "qcom,mmcc-msm8960", .data
= &mmcc_msm8960_desc
},
3017 { .compatible
= "qcom,mmcc-apq8064", .data
= &mmcc_apq8064_desc
},
3020 MODULE_DEVICE_TABLE(of
, mmcc_msm8960_match_table
);
3022 static int mmcc_msm8960_probe(struct platform_device
*pdev
)
3024 const struct of_device_id
*match
;
3025 struct regmap
*regmap
;
3027 struct device
*dev
= &pdev
->dev
;
3029 match
= of_match_device(mmcc_msm8960_match_table
, dev
);
3033 is_8064
= of_device_is_compatible(dev
->of_node
, "qcom,mmcc-apq8064");
3035 gfx3d_src
.freq_tbl
= clk_tbl_gfx3d_8064
;
3036 gfx3d_src
.clkr
.hw
.init
= &gfx3d_8064_init
;
3037 gfx3d_src
.s
[0].parent_map
= mmcc_pxo_pll8_pll2_pll15_map
;
3038 gfx3d_src
.s
[1].parent_map
= mmcc_pxo_pll8_pll2_pll15_map
;
3041 regmap
= qcom_cc_map(pdev
, match
->data
);
3043 return PTR_ERR(regmap
);
3045 clk_pll_configure_sr(&pll15
, regmap
, &pll15_config
, false);
3047 return qcom_cc_really_probe(pdev
, match
->data
, regmap
);
3050 static struct platform_driver mmcc_msm8960_driver
= {
3051 .probe
= mmcc_msm8960_probe
,
3053 .name
= "mmcc-msm8960",
3054 .of_match_table
= mmcc_msm8960_match_table
,
3058 module_platform_driver(mmcc_msm8960_driver
);
3060 MODULE_DESCRIPTION("QCOM MMCC MSM8960 Driver");
3061 MODULE_LICENSE("GPL v2");
3062 MODULE_ALIAS("platform:mmcc-msm8960");