2 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #include <linux/kernel.h>
15 #include <linux/bitops.h>
16 #include <linux/err.h>
17 #include <linux/delay.h>
18 #include <linux/platform_device.h>
19 #include <linux/module.h>
21 #include <linux/of_device.h>
22 #include <linux/clk.h>
23 #include <linux/clk-provider.h>
24 #include <linux/regmap.h>
25 #include <linux/reset-controller.h>
27 #include <dt-bindings/clock/qcom,mmcc-msm8960.h>
28 #include <dt-bindings/reset/qcom,mmcc-msm8960.h>
31 #include "clk-regmap.h"
34 #include "clk-branch.h"
50 #define F_MN(f, s, _m, _n) { .freq = f, .src = s, .m = _m, .n = _n }
52 static const struct parent_map mmcc_pxo_pll8_pll2_map
[] = {
58 static const char * const mmcc_pxo_pll8_pll2
[] = {
64 static const struct parent_map mmcc_pxo_pll8_pll2_pll3_map
[] = {
71 static const char * const mmcc_pxo_pll8_pll2_pll15
[] = {
78 static const struct parent_map mmcc_pxo_pll8_pll2_pll15_map
[] = {
85 static const char * const mmcc_pxo_pll8_pll2_pll3
[] = {
92 static const struct parent_map mmcc_pxo_dsi2_dsi1_map
[] = {
94 { P_DSI2_PLL_DSICLK
, 1 },
95 { P_DSI1_PLL_DSICLK
, 3 },
98 static const char * const mmcc_pxo_dsi2_dsi1
[] = {
104 static const struct parent_map mmcc_pxo_dsi1_dsi2_byte_map
[] = {
106 { P_DSI1_PLL_BYTECLK
, 1 },
107 { P_DSI2_PLL_BYTECLK
, 2 },
110 static const char * const mmcc_pxo_dsi1_dsi2_byte
[] = {
116 static struct clk_pll pll2
= {
124 .clkr
.hw
.init
= &(struct clk_init_data
){
126 .parent_names
= (const char *[]){ "pxo" },
132 static struct clk_pll pll15
= {
140 .clkr
.hw
.init
= &(struct clk_init_data
){
142 .parent_names
= (const char *[]){ "pxo" },
148 static const struct pll_config pll15_config
= {
152 .vco_val
= 0x2 << 16,
153 .vco_mask
= 0x3 << 16,
155 .pre_div_mask
= BIT(19),
157 .post_div_mask
= 0x3 << 20,
158 .mn_ena_mask
= BIT(22),
159 .main_output_mask
= BIT(23),
162 static struct freq_tbl clk_tbl_cam
[] = {
163 { 6000000, P_PLL8
, 4, 1, 16 },
164 { 8000000, P_PLL8
, 4, 1, 12 },
165 { 12000000, P_PLL8
, 4, 1, 8 },
166 { 16000000, P_PLL8
, 4, 1, 6 },
167 { 19200000, P_PLL8
, 4, 1, 5 },
168 { 24000000, P_PLL8
, 4, 1, 4 },
169 { 32000000, P_PLL8
, 4, 1, 3 },
170 { 48000000, P_PLL8
, 4, 1, 2 },
171 { 64000000, P_PLL8
, 3, 1, 2 },
172 { 96000000, P_PLL8
, 4, 0, 0 },
173 { 128000000, P_PLL8
, 3, 0, 0 },
177 static struct clk_rcg camclk0_src
= {
182 .mnctr_reset_bit
= 8,
184 .mnctr_mode_shift
= 6,
195 .parent_map
= mmcc_pxo_pll8_pll2_map
,
197 .freq_tbl
= clk_tbl_cam
,
199 .enable_reg
= 0x0140,
200 .enable_mask
= BIT(2),
201 .hw
.init
= &(struct clk_init_data
){
202 .name
= "camclk0_src",
203 .parent_names
= mmcc_pxo_pll8_pll2
,
210 static struct clk_branch camclk0_clk
= {
214 .enable_reg
= 0x0140,
215 .enable_mask
= BIT(0),
216 .hw
.init
= &(struct clk_init_data
){
217 .name
= "camclk0_clk",
218 .parent_names
= (const char *[]){ "camclk0_src" },
220 .ops
= &clk_branch_ops
,
226 static struct clk_rcg camclk1_src
= {
231 .mnctr_reset_bit
= 8,
233 .mnctr_mode_shift
= 6,
244 .parent_map
= mmcc_pxo_pll8_pll2_map
,
246 .freq_tbl
= clk_tbl_cam
,
248 .enable_reg
= 0x0154,
249 .enable_mask
= BIT(2),
250 .hw
.init
= &(struct clk_init_data
){
251 .name
= "camclk1_src",
252 .parent_names
= mmcc_pxo_pll8_pll2
,
259 static struct clk_branch camclk1_clk
= {
263 .enable_reg
= 0x0154,
264 .enable_mask
= BIT(0),
265 .hw
.init
= &(struct clk_init_data
){
266 .name
= "camclk1_clk",
267 .parent_names
= (const char *[]){ "camclk1_src" },
269 .ops
= &clk_branch_ops
,
275 static struct clk_rcg camclk2_src
= {
280 .mnctr_reset_bit
= 8,
282 .mnctr_mode_shift
= 6,
293 .parent_map
= mmcc_pxo_pll8_pll2_map
,
295 .freq_tbl
= clk_tbl_cam
,
297 .enable_reg
= 0x0220,
298 .enable_mask
= BIT(2),
299 .hw
.init
= &(struct clk_init_data
){
300 .name
= "camclk2_src",
301 .parent_names
= mmcc_pxo_pll8_pll2
,
308 static struct clk_branch camclk2_clk
= {
312 .enable_reg
= 0x0220,
313 .enable_mask
= BIT(0),
314 .hw
.init
= &(struct clk_init_data
){
315 .name
= "camclk2_clk",
316 .parent_names
= (const char *[]){ "camclk2_src" },
318 .ops
= &clk_branch_ops
,
324 static struct freq_tbl clk_tbl_csi
[] = {
325 { 27000000, P_PXO
, 1, 0, 0 },
326 { 85330000, P_PLL8
, 1, 2, 9 },
327 { 177780000, P_PLL2
, 1, 2, 9 },
331 static struct clk_rcg csi0_src
= {
336 .mnctr_reset_bit
= 7,
337 .mnctr_mode_shift
= 6,
348 .parent_map
= mmcc_pxo_pll8_pll2_map
,
350 .freq_tbl
= clk_tbl_csi
,
352 .enable_reg
= 0x0040,
353 .enable_mask
= BIT(2),
354 .hw
.init
= &(struct clk_init_data
){
356 .parent_names
= mmcc_pxo_pll8_pll2
,
363 static struct clk_branch csi0_clk
= {
367 .enable_reg
= 0x0040,
368 .enable_mask
= BIT(0),
369 .hw
.init
= &(struct clk_init_data
){
370 .parent_names
= (const char *[]){ "csi0_src" },
373 .ops
= &clk_branch_ops
,
374 .flags
= CLK_SET_RATE_PARENT
,
379 static struct clk_branch csi0_phy_clk
= {
383 .enable_reg
= 0x0040,
384 .enable_mask
= BIT(8),
385 .hw
.init
= &(struct clk_init_data
){
386 .parent_names
= (const char *[]){ "csi0_src" },
388 .name
= "csi0_phy_clk",
389 .ops
= &clk_branch_ops
,
390 .flags
= CLK_SET_RATE_PARENT
,
395 static struct clk_rcg csi1_src
= {
400 .mnctr_reset_bit
= 7,
401 .mnctr_mode_shift
= 6,
412 .parent_map
= mmcc_pxo_pll8_pll2_map
,
414 .freq_tbl
= clk_tbl_csi
,
416 .enable_reg
= 0x0024,
417 .enable_mask
= BIT(2),
418 .hw
.init
= &(struct clk_init_data
){
420 .parent_names
= mmcc_pxo_pll8_pll2
,
427 static struct clk_branch csi1_clk
= {
431 .enable_reg
= 0x0024,
432 .enable_mask
= BIT(0),
433 .hw
.init
= &(struct clk_init_data
){
434 .parent_names
= (const char *[]){ "csi1_src" },
437 .ops
= &clk_branch_ops
,
438 .flags
= CLK_SET_RATE_PARENT
,
443 static struct clk_branch csi1_phy_clk
= {
447 .enable_reg
= 0x0024,
448 .enable_mask
= BIT(8),
449 .hw
.init
= &(struct clk_init_data
){
450 .parent_names
= (const char *[]){ "csi1_src" },
452 .name
= "csi1_phy_clk",
453 .ops
= &clk_branch_ops
,
454 .flags
= CLK_SET_RATE_PARENT
,
459 static struct clk_rcg csi2_src
= {
464 .mnctr_reset_bit
= 7,
465 .mnctr_mode_shift
= 6,
476 .parent_map
= mmcc_pxo_pll8_pll2_map
,
478 .freq_tbl
= clk_tbl_csi
,
480 .enable_reg
= 0x022c,
481 .enable_mask
= BIT(2),
482 .hw
.init
= &(struct clk_init_data
){
484 .parent_names
= mmcc_pxo_pll8_pll2
,
491 static struct clk_branch csi2_clk
= {
495 .enable_reg
= 0x022c,
496 .enable_mask
= BIT(0),
497 .hw
.init
= &(struct clk_init_data
){
498 .parent_names
= (const char *[]){ "csi2_src" },
501 .ops
= &clk_branch_ops
,
502 .flags
= CLK_SET_RATE_PARENT
,
507 static struct clk_branch csi2_phy_clk
= {
511 .enable_reg
= 0x022c,
512 .enable_mask
= BIT(8),
513 .hw
.init
= &(struct clk_init_data
){
514 .parent_names
= (const char *[]){ "csi2_src" },
516 .name
= "csi2_phy_clk",
517 .ops
= &clk_branch_ops
,
518 .flags
= CLK_SET_RATE_PARENT
,
528 struct clk_regmap clkr
;
531 #define to_clk_pix_rdi(_hw) \
532 container_of(to_clk_regmap(_hw), struct clk_pix_rdi, clkr)
534 static int pix_rdi_set_parent(struct clk_hw
*hw
, u8 index
)
539 struct clk_pix_rdi
*rdi
= to_clk_pix_rdi(hw
);
540 int num_parents
= clk_hw_get_num_parents(hw
);
543 * These clocks select three inputs via two muxes. One mux selects
544 * between csi0 and csi1 and the second mux selects between that mux's
545 * output and csi2. The source and destination selections for each
546 * mux must be clocking for the switch to succeed so just turn on
547 * all three sources because it's easier than figuring out what source
548 * needs to be on at what time.
550 for (i
= 0; i
< num_parents
; i
++) {
551 struct clk_hw
*p
= clk_hw_get_parent_by_index(hw
, i
);
552 ret
= clk_prepare_enable(p
->clk
);
561 regmap_update_bits(rdi
->clkr
.regmap
, rdi
->s2_reg
, rdi
->s2_mask
, val
);
563 * Wait at least 6 cycles of slowest clock
564 * for the glitch-free MUX to fully switch sources.
572 regmap_update_bits(rdi
->clkr
.regmap
, rdi
->s_reg
, rdi
->s_mask
, val
);
574 * Wait at least 6 cycles of slowest clock
575 * for the glitch-free MUX to fully switch sources.
580 for (i
--; i
>= 0; i
--) {
581 struct clk_hw
*p
= clk_hw_get_parent_by_index(hw
, i
);
582 clk_disable_unprepare(p
->clk
);
588 static u8
pix_rdi_get_parent(struct clk_hw
*hw
)
591 struct clk_pix_rdi
*rdi
= to_clk_pix_rdi(hw
);
594 regmap_read(rdi
->clkr
.regmap
, rdi
->s2_reg
, &val
);
595 if (val
& rdi
->s2_mask
)
598 regmap_read(rdi
->clkr
.regmap
, rdi
->s_reg
, &val
);
599 if (val
& rdi
->s_mask
)
605 static const struct clk_ops clk_ops_pix_rdi
= {
606 .enable
= clk_enable_regmap
,
607 .disable
= clk_disable_regmap
,
608 .set_parent
= pix_rdi_set_parent
,
609 .get_parent
= pix_rdi_get_parent
,
610 .determine_rate
= __clk_mux_determine_rate
,
613 static const char * const pix_rdi_parents
[] = {
619 static struct clk_pix_rdi csi_pix_clk
= {
625 .enable_reg
= 0x0058,
626 .enable_mask
= BIT(26),
627 .hw
.init
= &(struct clk_init_data
){
628 .name
= "csi_pix_clk",
629 .parent_names
= pix_rdi_parents
,
631 .ops
= &clk_ops_pix_rdi
,
636 static struct clk_pix_rdi csi_pix1_clk
= {
642 .enable_reg
= 0x0238,
643 .enable_mask
= BIT(10),
644 .hw
.init
= &(struct clk_init_data
){
645 .name
= "csi_pix1_clk",
646 .parent_names
= pix_rdi_parents
,
648 .ops
= &clk_ops_pix_rdi
,
653 static struct clk_pix_rdi csi_rdi_clk
= {
659 .enable_reg
= 0x0058,
660 .enable_mask
= BIT(13),
661 .hw
.init
= &(struct clk_init_data
){
662 .name
= "csi_rdi_clk",
663 .parent_names
= pix_rdi_parents
,
665 .ops
= &clk_ops_pix_rdi
,
670 static struct clk_pix_rdi csi_rdi1_clk
= {
676 .enable_reg
= 0x0238,
677 .enable_mask
= BIT(2),
678 .hw
.init
= &(struct clk_init_data
){
679 .name
= "csi_rdi1_clk",
680 .parent_names
= pix_rdi_parents
,
682 .ops
= &clk_ops_pix_rdi
,
687 static struct clk_pix_rdi csi_rdi2_clk
= {
693 .enable_reg
= 0x0238,
694 .enable_mask
= BIT(6),
695 .hw
.init
= &(struct clk_init_data
){
696 .name
= "csi_rdi2_clk",
697 .parent_names
= pix_rdi_parents
,
699 .ops
= &clk_ops_pix_rdi
,
704 static struct freq_tbl clk_tbl_csiphytimer
[] = {
705 { 85330000, P_PLL8
, 1, 2, 9 },
706 { 177780000, P_PLL2
, 1, 2, 9 },
710 static struct clk_rcg csiphytimer_src
= {
715 .mnctr_reset_bit
= 8,
717 .mnctr_mode_shift
= 6,
728 .parent_map
= mmcc_pxo_pll8_pll2_map
,
730 .freq_tbl
= clk_tbl_csiphytimer
,
732 .enable_reg
= 0x0160,
733 .enable_mask
= BIT(2),
734 .hw
.init
= &(struct clk_init_data
){
735 .name
= "csiphytimer_src",
736 .parent_names
= mmcc_pxo_pll8_pll2
,
743 static const char * const csixphy_timer_src
[] = { "csiphytimer_src" };
745 static struct clk_branch csiphy0_timer_clk
= {
749 .enable_reg
= 0x0160,
750 .enable_mask
= BIT(0),
751 .hw
.init
= &(struct clk_init_data
){
752 .parent_names
= csixphy_timer_src
,
754 .name
= "csiphy0_timer_clk",
755 .ops
= &clk_branch_ops
,
756 .flags
= CLK_SET_RATE_PARENT
,
761 static struct clk_branch csiphy1_timer_clk
= {
765 .enable_reg
= 0x0160,
766 .enable_mask
= BIT(9),
767 .hw
.init
= &(struct clk_init_data
){
768 .parent_names
= csixphy_timer_src
,
770 .name
= "csiphy1_timer_clk",
771 .ops
= &clk_branch_ops
,
772 .flags
= CLK_SET_RATE_PARENT
,
777 static struct clk_branch csiphy2_timer_clk
= {
781 .enable_reg
= 0x0160,
782 .enable_mask
= BIT(11),
783 .hw
.init
= &(struct clk_init_data
){
784 .parent_names
= csixphy_timer_src
,
786 .name
= "csiphy2_timer_clk",
787 .ops
= &clk_branch_ops
,
788 .flags
= CLK_SET_RATE_PARENT
,
793 static struct freq_tbl clk_tbl_gfx2d
[] = {
794 F_MN( 27000000, P_PXO
, 1, 0),
795 F_MN( 48000000, P_PLL8
, 1, 8),
796 F_MN( 54857000, P_PLL8
, 1, 7),
797 F_MN( 64000000, P_PLL8
, 1, 6),
798 F_MN( 76800000, P_PLL8
, 1, 5),
799 F_MN( 96000000, P_PLL8
, 1, 4),
800 F_MN(128000000, P_PLL8
, 1, 3),
801 F_MN(145455000, P_PLL2
, 2, 11),
802 F_MN(160000000, P_PLL2
, 1, 5),
803 F_MN(177778000, P_PLL2
, 2, 9),
804 F_MN(200000000, P_PLL2
, 1, 4),
805 F_MN(228571000, P_PLL2
, 2, 7),
809 static struct clk_dyn_rcg gfx2d0_src
= {
817 .mnctr_reset_bit
= 25,
818 .mnctr_mode_shift
= 9,
825 .mnctr_reset_bit
= 24,
826 .mnctr_mode_shift
= 6,
833 .parent_map
= mmcc_pxo_pll8_pll2_map
,
837 .parent_map
= mmcc_pxo_pll8_pll2_map
,
840 .freq_tbl
= clk_tbl_gfx2d
,
842 .enable_reg
= 0x0060,
843 .enable_mask
= BIT(2),
844 .hw
.init
= &(struct clk_init_data
){
845 .name
= "gfx2d0_src",
846 .parent_names
= mmcc_pxo_pll8_pll2
,
848 .ops
= &clk_dyn_rcg_ops
,
853 static struct clk_branch gfx2d0_clk
= {
857 .enable_reg
= 0x0060,
858 .enable_mask
= BIT(0),
859 .hw
.init
= &(struct clk_init_data
){
860 .name
= "gfx2d0_clk",
861 .parent_names
= (const char *[]){ "gfx2d0_src" },
863 .ops
= &clk_branch_ops
,
864 .flags
= CLK_SET_RATE_PARENT
,
869 static struct clk_dyn_rcg gfx2d1_src
= {
877 .mnctr_reset_bit
= 25,
878 .mnctr_mode_shift
= 9,
885 .mnctr_reset_bit
= 24,
886 .mnctr_mode_shift
= 6,
893 .parent_map
= mmcc_pxo_pll8_pll2_map
,
897 .parent_map
= mmcc_pxo_pll8_pll2_map
,
900 .freq_tbl
= clk_tbl_gfx2d
,
902 .enable_reg
= 0x0074,
903 .enable_mask
= BIT(2),
904 .hw
.init
= &(struct clk_init_data
){
905 .name
= "gfx2d1_src",
906 .parent_names
= mmcc_pxo_pll8_pll2
,
908 .ops
= &clk_dyn_rcg_ops
,
913 static struct clk_branch gfx2d1_clk
= {
917 .enable_reg
= 0x0074,
918 .enable_mask
= BIT(0),
919 .hw
.init
= &(struct clk_init_data
){
920 .name
= "gfx2d1_clk",
921 .parent_names
= (const char *[]){ "gfx2d1_src" },
923 .ops
= &clk_branch_ops
,
924 .flags
= CLK_SET_RATE_PARENT
,
929 static struct freq_tbl clk_tbl_gfx3d
[] = {
930 F_MN( 27000000, P_PXO
, 1, 0),
931 F_MN( 48000000, P_PLL8
, 1, 8),
932 F_MN( 54857000, P_PLL8
, 1, 7),
933 F_MN( 64000000, P_PLL8
, 1, 6),
934 F_MN( 76800000, P_PLL8
, 1, 5),
935 F_MN( 96000000, P_PLL8
, 1, 4),
936 F_MN(128000000, P_PLL8
, 1, 3),
937 F_MN(145455000, P_PLL2
, 2, 11),
938 F_MN(160000000, P_PLL2
, 1, 5),
939 F_MN(177778000, P_PLL2
, 2, 9),
940 F_MN(200000000, P_PLL2
, 1, 4),
941 F_MN(228571000, P_PLL2
, 2, 7),
942 F_MN(266667000, P_PLL2
, 1, 3),
943 F_MN(300000000, P_PLL3
, 1, 4),
944 F_MN(320000000, P_PLL2
, 2, 5),
945 F_MN(400000000, P_PLL2
, 1, 2),
949 static struct freq_tbl clk_tbl_gfx3d_8064
[] = {
950 F_MN( 27000000, P_PXO
, 0, 0),
951 F_MN( 48000000, P_PLL8
, 1, 8),
952 F_MN( 54857000, P_PLL8
, 1, 7),
953 F_MN( 64000000, P_PLL8
, 1, 6),
954 F_MN( 76800000, P_PLL8
, 1, 5),
955 F_MN( 96000000, P_PLL8
, 1, 4),
956 F_MN(128000000, P_PLL8
, 1, 3),
957 F_MN(145455000, P_PLL2
, 2, 11),
958 F_MN(160000000, P_PLL2
, 1, 5),
959 F_MN(177778000, P_PLL2
, 2, 9),
960 F_MN(192000000, P_PLL8
, 1, 2),
961 F_MN(200000000, P_PLL2
, 1, 4),
962 F_MN(228571000, P_PLL2
, 2, 7),
963 F_MN(266667000, P_PLL2
, 1, 3),
964 F_MN(320000000, P_PLL2
, 2, 5),
965 F_MN(400000000, P_PLL2
, 1, 2),
966 F_MN(450000000, P_PLL15
, 1, 2),
970 static struct clk_dyn_rcg gfx3d_src
= {
978 .mnctr_reset_bit
= 25,
979 .mnctr_mode_shift
= 9,
986 .mnctr_reset_bit
= 24,
987 .mnctr_mode_shift
= 6,
994 .parent_map
= mmcc_pxo_pll8_pll2_pll3_map
,
998 .parent_map
= mmcc_pxo_pll8_pll2_pll3_map
,
1001 .freq_tbl
= clk_tbl_gfx3d
,
1003 .enable_reg
= 0x0080,
1004 .enable_mask
= BIT(2),
1005 .hw
.init
= &(struct clk_init_data
){
1006 .name
= "gfx3d_src",
1007 .parent_names
= mmcc_pxo_pll8_pll2_pll3
,
1009 .ops
= &clk_dyn_rcg_ops
,
1014 static const struct clk_init_data gfx3d_8064_init
= {
1015 .name
= "gfx3d_src",
1016 .parent_names
= mmcc_pxo_pll8_pll2_pll15
,
1018 .ops
= &clk_dyn_rcg_ops
,
1021 static struct clk_branch gfx3d_clk
= {
1025 .enable_reg
= 0x0080,
1026 .enable_mask
= BIT(0),
1027 .hw
.init
= &(struct clk_init_data
){
1028 .name
= "gfx3d_clk",
1029 .parent_names
= (const char *[]){ "gfx3d_src" },
1031 .ops
= &clk_branch_ops
,
1032 .flags
= CLK_SET_RATE_PARENT
,
1037 static struct freq_tbl clk_tbl_vcap
[] = {
1038 F_MN( 27000000, P_PXO
, 0, 0),
1039 F_MN( 54860000, P_PLL8
, 1, 7),
1040 F_MN( 64000000, P_PLL8
, 1, 6),
1041 F_MN( 76800000, P_PLL8
, 1, 5),
1042 F_MN(128000000, P_PLL8
, 1, 3),
1043 F_MN(160000000, P_PLL2
, 1, 5),
1044 F_MN(200000000, P_PLL2
, 1, 4),
1048 static struct clk_dyn_rcg vcap_src
= {
1049 .ns_reg
[0] = 0x021c,
1050 .ns_reg
[1] = 0x021c,
1051 .md_reg
[0] = 0x01ec,
1052 .md_reg
[1] = 0x0218,
1056 .mnctr_reset_bit
= 23,
1057 .mnctr_mode_shift
= 9,
1064 .mnctr_reset_bit
= 22,
1065 .mnctr_mode_shift
= 6,
1072 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1076 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1079 .freq_tbl
= clk_tbl_vcap
,
1081 .enable_reg
= 0x0178,
1082 .enable_mask
= BIT(2),
1083 .hw
.init
= &(struct clk_init_data
){
1085 .parent_names
= mmcc_pxo_pll8_pll2
,
1087 .ops
= &clk_dyn_rcg_ops
,
1092 static struct clk_branch vcap_clk
= {
1096 .enable_reg
= 0x0178,
1097 .enable_mask
= BIT(0),
1098 .hw
.init
= &(struct clk_init_data
){
1100 .parent_names
= (const char *[]){ "vcap_src" },
1102 .ops
= &clk_branch_ops
,
1103 .flags
= CLK_SET_RATE_PARENT
,
1108 static struct clk_branch vcap_npl_clk
= {
1112 .enable_reg
= 0x0178,
1113 .enable_mask
= BIT(13),
1114 .hw
.init
= &(struct clk_init_data
){
1115 .name
= "vcap_npl_clk",
1116 .parent_names
= (const char *[]){ "vcap_src" },
1118 .ops
= &clk_branch_ops
,
1119 .flags
= CLK_SET_RATE_PARENT
,
1124 static struct freq_tbl clk_tbl_ijpeg
[] = {
1125 { 27000000, P_PXO
, 1, 0, 0 },
1126 { 36570000, P_PLL8
, 1, 2, 21 },
1127 { 54860000, P_PLL8
, 7, 0, 0 },
1128 { 96000000, P_PLL8
, 4, 0, 0 },
1129 { 109710000, P_PLL8
, 1, 2, 7 },
1130 { 128000000, P_PLL8
, 3, 0, 0 },
1131 { 153600000, P_PLL8
, 1, 2, 5 },
1132 { 200000000, P_PLL2
, 4, 0, 0 },
1133 { 228571000, P_PLL2
, 1, 2, 7 },
1134 { 266667000, P_PLL2
, 1, 1, 3 },
1135 { 320000000, P_PLL2
, 1, 2, 5 },
1139 static struct clk_rcg ijpeg_src
= {
1144 .mnctr_reset_bit
= 7,
1145 .mnctr_mode_shift
= 6,
1151 .pre_div_shift
= 12,
1156 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1158 .freq_tbl
= clk_tbl_ijpeg
,
1160 .enable_reg
= 0x0098,
1161 .enable_mask
= BIT(2),
1162 .hw
.init
= &(struct clk_init_data
){
1163 .name
= "ijpeg_src",
1164 .parent_names
= mmcc_pxo_pll8_pll2
,
1166 .ops
= &clk_rcg_ops
,
1171 static struct clk_branch ijpeg_clk
= {
1175 .enable_reg
= 0x0098,
1176 .enable_mask
= BIT(0),
1177 .hw
.init
= &(struct clk_init_data
){
1178 .name
= "ijpeg_clk",
1179 .parent_names
= (const char *[]){ "ijpeg_src" },
1181 .ops
= &clk_branch_ops
,
1182 .flags
= CLK_SET_RATE_PARENT
,
1187 static struct freq_tbl clk_tbl_jpegd
[] = {
1188 { 64000000, P_PLL8
, 6 },
1189 { 76800000, P_PLL8
, 5 },
1190 { 96000000, P_PLL8
, 4 },
1191 { 160000000, P_PLL2
, 5 },
1192 { 200000000, P_PLL2
, 4 },
1196 static struct clk_rcg jpegd_src
= {
1199 .pre_div_shift
= 12,
1204 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1206 .freq_tbl
= clk_tbl_jpegd
,
1208 .enable_reg
= 0x00a4,
1209 .enable_mask
= BIT(2),
1210 .hw
.init
= &(struct clk_init_data
){
1211 .name
= "jpegd_src",
1212 .parent_names
= mmcc_pxo_pll8_pll2
,
1214 .ops
= &clk_rcg_ops
,
1219 static struct clk_branch jpegd_clk
= {
1223 .enable_reg
= 0x00a4,
1224 .enable_mask
= BIT(0),
1225 .hw
.init
= &(struct clk_init_data
){
1226 .name
= "jpegd_clk",
1227 .parent_names
= (const char *[]){ "jpegd_src" },
1229 .ops
= &clk_branch_ops
,
1230 .flags
= CLK_SET_RATE_PARENT
,
1235 static struct freq_tbl clk_tbl_mdp
[] = {
1236 { 9600000, P_PLL8
, 1, 1, 40 },
1237 { 13710000, P_PLL8
, 1, 1, 28 },
1238 { 27000000, P_PXO
, 1, 0, 0 },
1239 { 29540000, P_PLL8
, 1, 1, 13 },
1240 { 34910000, P_PLL8
, 1, 1, 11 },
1241 { 38400000, P_PLL8
, 1, 1, 10 },
1242 { 59080000, P_PLL8
, 1, 2, 13 },
1243 { 76800000, P_PLL8
, 1, 1, 5 },
1244 { 85330000, P_PLL8
, 1, 2, 9 },
1245 { 96000000, P_PLL8
, 1, 1, 4 },
1246 { 128000000, P_PLL8
, 1, 1, 3 },
1247 { 160000000, P_PLL2
, 1, 1, 5 },
1248 { 177780000, P_PLL2
, 1, 2, 9 },
1249 { 200000000, P_PLL2
, 1, 1, 4 },
1250 { 228571000, P_PLL2
, 1, 2, 7 },
1251 { 266667000, P_PLL2
, 1, 1, 3 },
1255 static struct clk_dyn_rcg mdp_src
= {
1256 .ns_reg
[0] = 0x00d0,
1257 .ns_reg
[1] = 0x00d0,
1258 .md_reg
[0] = 0x00c4,
1259 .md_reg
[1] = 0x00c8,
1263 .mnctr_reset_bit
= 31,
1264 .mnctr_mode_shift
= 9,
1271 .mnctr_reset_bit
= 30,
1272 .mnctr_mode_shift
= 6,
1279 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1283 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1286 .freq_tbl
= clk_tbl_mdp
,
1288 .enable_reg
= 0x00c0,
1289 .enable_mask
= BIT(2),
1290 .hw
.init
= &(struct clk_init_data
){
1292 .parent_names
= mmcc_pxo_pll8_pll2
,
1294 .ops
= &clk_dyn_rcg_ops
,
1299 static struct clk_branch mdp_clk
= {
1303 .enable_reg
= 0x00c0,
1304 .enable_mask
= BIT(0),
1305 .hw
.init
= &(struct clk_init_data
){
1307 .parent_names
= (const char *[]){ "mdp_src" },
1309 .ops
= &clk_branch_ops
,
1310 .flags
= CLK_SET_RATE_PARENT
,
1315 static struct clk_branch mdp_lut_clk
= {
1319 .enable_reg
= 0x016c,
1320 .enable_mask
= BIT(0),
1321 .hw
.init
= &(struct clk_init_data
){
1322 .parent_names
= (const char *[]){ "mdp_src" },
1324 .name
= "mdp_lut_clk",
1325 .ops
= &clk_branch_ops
,
1326 .flags
= CLK_SET_RATE_PARENT
,
1331 static struct clk_branch mdp_vsync_clk
= {
1335 .enable_reg
= 0x0058,
1336 .enable_mask
= BIT(6),
1337 .hw
.init
= &(struct clk_init_data
){
1338 .name
= "mdp_vsync_clk",
1339 .parent_names
= (const char *[]){ "pxo" },
1341 .ops
= &clk_branch_ops
1346 static struct freq_tbl clk_tbl_rot
[] = {
1347 { 27000000, P_PXO
, 1 },
1348 { 29540000, P_PLL8
, 13 },
1349 { 32000000, P_PLL8
, 12 },
1350 { 38400000, P_PLL8
, 10 },
1351 { 48000000, P_PLL8
, 8 },
1352 { 54860000, P_PLL8
, 7 },
1353 { 64000000, P_PLL8
, 6 },
1354 { 76800000, P_PLL8
, 5 },
1355 { 96000000, P_PLL8
, 4 },
1356 { 100000000, P_PLL2
, 8 },
1357 { 114290000, P_PLL2
, 7 },
1358 { 133330000, P_PLL2
, 6 },
1359 { 160000000, P_PLL2
, 5 },
1360 { 200000000, P_PLL2
, 4 },
1364 static struct clk_dyn_rcg rot_src
= {
1365 .ns_reg
[0] = 0x00e8,
1366 .ns_reg
[1] = 0x00e8,
1369 .pre_div_shift
= 22,
1373 .pre_div_shift
= 26,
1377 .src_sel_shift
= 16,
1378 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1381 .src_sel_shift
= 19,
1382 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1385 .freq_tbl
= clk_tbl_rot
,
1387 .enable_reg
= 0x00e0,
1388 .enable_mask
= BIT(2),
1389 .hw
.init
= &(struct clk_init_data
){
1391 .parent_names
= mmcc_pxo_pll8_pll2
,
1393 .ops
= &clk_dyn_rcg_ops
,
1398 static struct clk_branch rot_clk
= {
1402 .enable_reg
= 0x00e0,
1403 .enable_mask
= BIT(0),
1404 .hw
.init
= &(struct clk_init_data
){
1406 .parent_names
= (const char *[]){ "rot_src" },
1408 .ops
= &clk_branch_ops
,
1409 .flags
= CLK_SET_RATE_PARENT
,
1414 static const struct parent_map mmcc_pxo_hdmi_map
[] = {
1419 static const char * const mmcc_pxo_hdmi
[] = {
1424 static struct freq_tbl clk_tbl_tv
[] = {
1425 { .src
= P_HDMI_PLL
, .pre_div
= 1 },
1429 static struct clk_rcg tv_src
= {
1434 .mnctr_reset_bit
= 7,
1435 .mnctr_mode_shift
= 6,
1441 .pre_div_shift
= 14,
1446 .parent_map
= mmcc_pxo_hdmi_map
,
1448 .freq_tbl
= clk_tbl_tv
,
1450 .enable_reg
= 0x00ec,
1451 .enable_mask
= BIT(2),
1452 .hw
.init
= &(struct clk_init_data
){
1454 .parent_names
= mmcc_pxo_hdmi
,
1456 .ops
= &clk_rcg_bypass_ops
,
1457 .flags
= CLK_SET_RATE_PARENT
,
1462 static const char * const tv_src_name
[] = { "tv_src" };
1464 static struct clk_branch tv_enc_clk
= {
1468 .enable_reg
= 0x00ec,
1469 .enable_mask
= BIT(8),
1470 .hw
.init
= &(struct clk_init_data
){
1471 .parent_names
= tv_src_name
,
1473 .name
= "tv_enc_clk",
1474 .ops
= &clk_branch_ops
,
1475 .flags
= CLK_SET_RATE_PARENT
,
1480 static struct clk_branch tv_dac_clk
= {
1484 .enable_reg
= 0x00ec,
1485 .enable_mask
= BIT(10),
1486 .hw
.init
= &(struct clk_init_data
){
1487 .parent_names
= tv_src_name
,
1489 .name
= "tv_dac_clk",
1490 .ops
= &clk_branch_ops
,
1491 .flags
= CLK_SET_RATE_PARENT
,
1496 static struct clk_branch mdp_tv_clk
= {
1500 .enable_reg
= 0x00ec,
1501 .enable_mask
= BIT(0),
1502 .hw
.init
= &(struct clk_init_data
){
1503 .parent_names
= tv_src_name
,
1505 .name
= "mdp_tv_clk",
1506 .ops
= &clk_branch_ops
,
1507 .flags
= CLK_SET_RATE_PARENT
,
1512 static struct clk_branch hdmi_tv_clk
= {
1516 .enable_reg
= 0x00ec,
1517 .enable_mask
= BIT(12),
1518 .hw
.init
= &(struct clk_init_data
){
1519 .parent_names
= tv_src_name
,
1521 .name
= "hdmi_tv_clk",
1522 .ops
= &clk_branch_ops
,
1523 .flags
= CLK_SET_RATE_PARENT
,
1528 static struct clk_branch rgb_tv_clk
= {
1532 .enable_reg
= 0x0124,
1533 .enable_mask
= BIT(14),
1534 .hw
.init
= &(struct clk_init_data
){
1535 .parent_names
= tv_src_name
,
1537 .name
= "rgb_tv_clk",
1538 .ops
= &clk_branch_ops
,
1539 .flags
= CLK_SET_RATE_PARENT
,
1544 static struct clk_branch npl_tv_clk
= {
1548 .enable_reg
= 0x0124,
1549 .enable_mask
= BIT(16),
1550 .hw
.init
= &(struct clk_init_data
){
1551 .parent_names
= tv_src_name
,
1553 .name
= "npl_tv_clk",
1554 .ops
= &clk_branch_ops
,
1555 .flags
= CLK_SET_RATE_PARENT
,
1560 static struct clk_branch hdmi_app_clk
= {
1564 .enable_reg
= 0x005c,
1565 .enable_mask
= BIT(11),
1566 .hw
.init
= &(struct clk_init_data
){
1567 .parent_names
= (const char *[]){ "pxo" },
1569 .name
= "hdmi_app_clk",
1570 .ops
= &clk_branch_ops
,
1575 static struct freq_tbl clk_tbl_vcodec
[] = {
1576 F_MN( 27000000, P_PXO
, 1, 0),
1577 F_MN( 32000000, P_PLL8
, 1, 12),
1578 F_MN( 48000000, P_PLL8
, 1, 8),
1579 F_MN( 54860000, P_PLL8
, 1, 7),
1580 F_MN( 96000000, P_PLL8
, 1, 4),
1581 F_MN(133330000, P_PLL2
, 1, 6),
1582 F_MN(200000000, P_PLL2
, 1, 4),
1583 F_MN(228570000, P_PLL2
, 2, 7),
1584 F_MN(266670000, P_PLL2
, 1, 3),
1588 static struct clk_dyn_rcg vcodec_src
= {
1589 .ns_reg
[0] = 0x0100,
1590 .ns_reg
[1] = 0x0100,
1591 .md_reg
[0] = 0x00fc,
1592 .md_reg
[1] = 0x0128,
1596 .mnctr_reset_bit
= 31,
1597 .mnctr_mode_shift
= 6,
1604 .mnctr_reset_bit
= 30,
1605 .mnctr_mode_shift
= 11,
1611 .src_sel_shift
= 27,
1612 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1616 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1619 .freq_tbl
= clk_tbl_vcodec
,
1621 .enable_reg
= 0x00f8,
1622 .enable_mask
= BIT(2),
1623 .hw
.init
= &(struct clk_init_data
){
1624 .name
= "vcodec_src",
1625 .parent_names
= mmcc_pxo_pll8_pll2
,
1627 .ops
= &clk_dyn_rcg_ops
,
1632 static struct clk_branch vcodec_clk
= {
1636 .enable_reg
= 0x00f8,
1637 .enable_mask
= BIT(0),
1638 .hw
.init
= &(struct clk_init_data
){
1639 .name
= "vcodec_clk",
1640 .parent_names
= (const char *[]){ "vcodec_src" },
1642 .ops
= &clk_branch_ops
,
1643 .flags
= CLK_SET_RATE_PARENT
,
1648 static struct freq_tbl clk_tbl_vpe
[] = {
1649 { 27000000, P_PXO
, 1 },
1650 { 34909000, P_PLL8
, 11 },
1651 { 38400000, P_PLL8
, 10 },
1652 { 64000000, P_PLL8
, 6 },
1653 { 76800000, P_PLL8
, 5 },
1654 { 96000000, P_PLL8
, 4 },
1655 { 100000000, P_PLL2
, 8 },
1656 { 160000000, P_PLL2
, 5 },
1660 static struct clk_rcg vpe_src
= {
1663 .pre_div_shift
= 12,
1668 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1670 .freq_tbl
= clk_tbl_vpe
,
1672 .enable_reg
= 0x0110,
1673 .enable_mask
= BIT(2),
1674 .hw
.init
= &(struct clk_init_data
){
1676 .parent_names
= mmcc_pxo_pll8_pll2
,
1678 .ops
= &clk_rcg_ops
,
1683 static struct clk_branch vpe_clk
= {
1687 .enable_reg
= 0x0110,
1688 .enable_mask
= BIT(0),
1689 .hw
.init
= &(struct clk_init_data
){
1691 .parent_names
= (const char *[]){ "vpe_src" },
1693 .ops
= &clk_branch_ops
,
1694 .flags
= CLK_SET_RATE_PARENT
,
1699 static struct freq_tbl clk_tbl_vfe
[] = {
1700 { 13960000, P_PLL8
, 1, 2, 55 },
1701 { 27000000, P_PXO
, 1, 0, 0 },
1702 { 36570000, P_PLL8
, 1, 2, 21 },
1703 { 38400000, P_PLL8
, 2, 1, 5 },
1704 { 45180000, P_PLL8
, 1, 2, 17 },
1705 { 48000000, P_PLL8
, 2, 1, 4 },
1706 { 54860000, P_PLL8
, 1, 1, 7 },
1707 { 64000000, P_PLL8
, 2, 1, 3 },
1708 { 76800000, P_PLL8
, 1, 1, 5 },
1709 { 96000000, P_PLL8
, 2, 1, 2 },
1710 { 109710000, P_PLL8
, 1, 2, 7 },
1711 { 128000000, P_PLL8
, 1, 1, 3 },
1712 { 153600000, P_PLL8
, 1, 2, 5 },
1713 { 200000000, P_PLL2
, 2, 1, 2 },
1714 { 228570000, P_PLL2
, 1, 2, 7 },
1715 { 266667000, P_PLL2
, 1, 1, 3 },
1716 { 320000000, P_PLL2
, 1, 2, 5 },
1720 static struct clk_rcg vfe_src
= {
1724 .mnctr_reset_bit
= 7,
1725 .mnctr_mode_shift
= 6,
1731 .pre_div_shift
= 10,
1736 .parent_map
= mmcc_pxo_pll8_pll2_map
,
1738 .freq_tbl
= clk_tbl_vfe
,
1740 .enable_reg
= 0x0104,
1741 .enable_mask
= BIT(2),
1742 .hw
.init
= &(struct clk_init_data
){
1744 .parent_names
= mmcc_pxo_pll8_pll2
,
1746 .ops
= &clk_rcg_ops
,
1751 static struct clk_branch vfe_clk
= {
1755 .enable_reg
= 0x0104,
1756 .enable_mask
= BIT(0),
1757 .hw
.init
= &(struct clk_init_data
){
1759 .parent_names
= (const char *[]){ "vfe_src" },
1761 .ops
= &clk_branch_ops
,
1762 .flags
= CLK_SET_RATE_PARENT
,
1767 static struct clk_branch vfe_csi_clk
= {
1771 .enable_reg
= 0x0104,
1772 .enable_mask
= BIT(12),
1773 .hw
.init
= &(struct clk_init_data
){
1774 .parent_names
= (const char *[]){ "vfe_src" },
1776 .name
= "vfe_csi_clk",
1777 .ops
= &clk_branch_ops
,
1778 .flags
= CLK_SET_RATE_PARENT
,
1783 static struct clk_branch gmem_axi_clk
= {
1787 .enable_reg
= 0x0018,
1788 .enable_mask
= BIT(24),
1789 .hw
.init
= &(struct clk_init_data
){
1790 .name
= "gmem_axi_clk",
1791 .ops
= &clk_branch_ops
,
1792 .flags
= CLK_IS_ROOT
,
1797 static struct clk_branch ijpeg_axi_clk
= {
1803 .enable_reg
= 0x0018,
1804 .enable_mask
= BIT(21),
1805 .hw
.init
= &(struct clk_init_data
){
1806 .name
= "ijpeg_axi_clk",
1807 .ops
= &clk_branch_ops
,
1808 .flags
= CLK_IS_ROOT
,
1813 static struct clk_branch mmss_imem_axi_clk
= {
1819 .enable_reg
= 0x0018,
1820 .enable_mask
= BIT(22),
1821 .hw
.init
= &(struct clk_init_data
){
1822 .name
= "mmss_imem_axi_clk",
1823 .ops
= &clk_branch_ops
,
1824 .flags
= CLK_IS_ROOT
,
1829 static struct clk_branch jpegd_axi_clk
= {
1833 .enable_reg
= 0x0018,
1834 .enable_mask
= BIT(25),
1835 .hw
.init
= &(struct clk_init_data
){
1836 .name
= "jpegd_axi_clk",
1837 .ops
= &clk_branch_ops
,
1838 .flags
= CLK_IS_ROOT
,
1843 static struct clk_branch vcodec_axi_b_clk
= {
1849 .enable_reg
= 0x0114,
1850 .enable_mask
= BIT(23),
1851 .hw
.init
= &(struct clk_init_data
){
1852 .name
= "vcodec_axi_b_clk",
1853 .ops
= &clk_branch_ops
,
1854 .flags
= CLK_IS_ROOT
,
1859 static struct clk_branch vcodec_axi_a_clk
= {
1865 .enable_reg
= 0x0114,
1866 .enable_mask
= BIT(25),
1867 .hw
.init
= &(struct clk_init_data
){
1868 .name
= "vcodec_axi_a_clk",
1869 .ops
= &clk_branch_ops
,
1870 .flags
= CLK_IS_ROOT
,
1875 static struct clk_branch vcodec_axi_clk
= {
1881 .enable_reg
= 0x0018,
1882 .enable_mask
= BIT(19),
1883 .hw
.init
= &(struct clk_init_data
){
1884 .name
= "vcodec_axi_clk",
1885 .ops
= &clk_branch_ops
,
1886 .flags
= CLK_IS_ROOT
,
1891 static struct clk_branch vfe_axi_clk
= {
1895 .enable_reg
= 0x0018,
1896 .enable_mask
= BIT(18),
1897 .hw
.init
= &(struct clk_init_data
){
1898 .name
= "vfe_axi_clk",
1899 .ops
= &clk_branch_ops
,
1900 .flags
= CLK_IS_ROOT
,
1905 static struct clk_branch mdp_axi_clk
= {
1911 .enable_reg
= 0x0018,
1912 .enable_mask
= BIT(23),
1913 .hw
.init
= &(struct clk_init_data
){
1914 .name
= "mdp_axi_clk",
1915 .ops
= &clk_branch_ops
,
1916 .flags
= CLK_IS_ROOT
,
1921 static struct clk_branch rot_axi_clk
= {
1927 .enable_reg
= 0x0020,
1928 .enable_mask
= BIT(24),
1929 .hw
.init
= &(struct clk_init_data
){
1930 .name
= "rot_axi_clk",
1931 .ops
= &clk_branch_ops
,
1932 .flags
= CLK_IS_ROOT
,
1937 static struct clk_branch vcap_axi_clk
= {
1943 .enable_reg
= 0x0244,
1944 .enable_mask
= BIT(12),
1945 .hw
.init
= &(struct clk_init_data
){
1946 .name
= "vcap_axi_clk",
1947 .ops
= &clk_branch_ops
,
1948 .flags
= CLK_IS_ROOT
,
1953 static struct clk_branch vpe_axi_clk
= {
1959 .enable_reg
= 0x0020,
1960 .enable_mask
= BIT(26),
1961 .hw
.init
= &(struct clk_init_data
){
1962 .name
= "vpe_axi_clk",
1963 .ops
= &clk_branch_ops
,
1964 .flags
= CLK_IS_ROOT
,
1969 static struct clk_branch gfx3d_axi_clk
= {
1975 .enable_reg
= 0x0244,
1976 .enable_mask
= BIT(25),
1977 .hw
.init
= &(struct clk_init_data
){
1978 .name
= "gfx3d_axi_clk",
1979 .ops
= &clk_branch_ops
,
1980 .flags
= CLK_IS_ROOT
,
1985 static struct clk_branch amp_ahb_clk
= {
1989 .enable_reg
= 0x0008,
1990 .enable_mask
= BIT(24),
1991 .hw
.init
= &(struct clk_init_data
){
1992 .name
= "amp_ahb_clk",
1993 .ops
= &clk_branch_ops
,
1994 .flags
= CLK_IS_ROOT
,
1999 static struct clk_branch csi_ahb_clk
= {
2003 .enable_reg
= 0x0008,
2004 .enable_mask
= BIT(7),
2005 .hw
.init
= &(struct clk_init_data
){
2006 .name
= "csi_ahb_clk",
2007 .ops
= &clk_branch_ops
,
2008 .flags
= CLK_IS_ROOT
2013 static struct clk_branch dsi_m_ahb_clk
= {
2017 .enable_reg
= 0x0008,
2018 .enable_mask
= BIT(9),
2019 .hw
.init
= &(struct clk_init_data
){
2020 .name
= "dsi_m_ahb_clk",
2021 .ops
= &clk_branch_ops
,
2022 .flags
= CLK_IS_ROOT
,
2027 static struct clk_branch dsi_s_ahb_clk
= {
2033 .enable_reg
= 0x0008,
2034 .enable_mask
= BIT(18),
2035 .hw
.init
= &(struct clk_init_data
){
2036 .name
= "dsi_s_ahb_clk",
2037 .ops
= &clk_branch_ops
,
2038 .flags
= CLK_IS_ROOT
,
2043 static struct clk_branch dsi2_m_ahb_clk
= {
2047 .enable_reg
= 0x0008,
2048 .enable_mask
= BIT(17),
2049 .hw
.init
= &(struct clk_init_data
){
2050 .name
= "dsi2_m_ahb_clk",
2051 .ops
= &clk_branch_ops
,
2052 .flags
= CLK_IS_ROOT
2057 static struct clk_branch dsi2_s_ahb_clk
= {
2063 .enable_reg
= 0x0008,
2064 .enable_mask
= BIT(22),
2065 .hw
.init
= &(struct clk_init_data
){
2066 .name
= "dsi2_s_ahb_clk",
2067 .ops
= &clk_branch_ops
,
2068 .flags
= CLK_IS_ROOT
,
2073 static struct clk_rcg dsi1_src
= {
2078 .mnctr_reset_bit
= 7,
2079 .mnctr_mode_shift
= 6,
2085 .pre_div_shift
= 14,
2090 .parent_map
= mmcc_pxo_dsi2_dsi1_map
,
2093 .enable_reg
= 0x004c,
2094 .enable_mask
= BIT(2),
2095 .hw
.init
= &(struct clk_init_data
){
2097 .parent_names
= mmcc_pxo_dsi2_dsi1
,
2099 .ops
= &clk_rcg_bypass2_ops
,
2100 .flags
= CLK_SET_RATE_PARENT
,
2105 static struct clk_branch dsi1_clk
= {
2109 .enable_reg
= 0x004c,
2110 .enable_mask
= BIT(0),
2111 .hw
.init
= &(struct clk_init_data
){
2113 .parent_names
= (const char *[]){ "dsi1_src" },
2115 .ops
= &clk_branch_ops
,
2116 .flags
= CLK_SET_RATE_PARENT
,
2121 static struct clk_rcg dsi2_src
= {
2126 .mnctr_reset_bit
= 7,
2127 .mnctr_mode_shift
= 6,
2133 .pre_div_shift
= 14,
2138 .parent_map
= mmcc_pxo_dsi2_dsi1_map
,
2141 .enable_reg
= 0x003c,
2142 .enable_mask
= BIT(2),
2143 .hw
.init
= &(struct clk_init_data
){
2145 .parent_names
= mmcc_pxo_dsi2_dsi1
,
2147 .ops
= &clk_rcg_bypass2_ops
,
2148 .flags
= CLK_SET_RATE_PARENT
,
2153 static struct clk_branch dsi2_clk
= {
2157 .enable_reg
= 0x003c,
2158 .enable_mask
= BIT(0),
2159 .hw
.init
= &(struct clk_init_data
){
2161 .parent_names
= (const char *[]){ "dsi2_src" },
2163 .ops
= &clk_branch_ops
,
2164 .flags
= CLK_SET_RATE_PARENT
,
2169 static struct clk_rcg dsi1_byte_src
= {
2172 .pre_div_shift
= 12,
2177 .parent_map
= mmcc_pxo_dsi1_dsi2_byte_map
,
2180 .enable_reg
= 0x0090,
2181 .enable_mask
= BIT(2),
2182 .hw
.init
= &(struct clk_init_data
){
2183 .name
= "dsi1_byte_src",
2184 .parent_names
= mmcc_pxo_dsi1_dsi2_byte
,
2186 .ops
= &clk_rcg_bypass2_ops
,
2187 .flags
= CLK_SET_RATE_PARENT
,
2192 static struct clk_branch dsi1_byte_clk
= {
2196 .enable_reg
= 0x0090,
2197 .enable_mask
= BIT(0),
2198 .hw
.init
= &(struct clk_init_data
){
2199 .name
= "dsi1_byte_clk",
2200 .parent_names
= (const char *[]){ "dsi1_byte_src" },
2202 .ops
= &clk_branch_ops
,
2203 .flags
= CLK_SET_RATE_PARENT
,
2208 static struct clk_rcg dsi2_byte_src
= {
2211 .pre_div_shift
= 12,
2216 .parent_map
= mmcc_pxo_dsi1_dsi2_byte_map
,
2219 .enable_reg
= 0x0130,
2220 .enable_mask
= BIT(2),
2221 .hw
.init
= &(struct clk_init_data
){
2222 .name
= "dsi2_byte_src",
2223 .parent_names
= mmcc_pxo_dsi1_dsi2_byte
,
2225 .ops
= &clk_rcg_bypass2_ops
,
2226 .flags
= CLK_SET_RATE_PARENT
,
2231 static struct clk_branch dsi2_byte_clk
= {
2235 .enable_reg
= 0x00b4,
2236 .enable_mask
= BIT(0),
2237 .hw
.init
= &(struct clk_init_data
){
2238 .name
= "dsi2_byte_clk",
2239 .parent_names
= (const char *[]){ "dsi2_byte_src" },
2241 .ops
= &clk_branch_ops
,
2242 .flags
= CLK_SET_RATE_PARENT
,
2247 static struct clk_rcg dsi1_esc_src
= {
2250 .pre_div_shift
= 12,
2255 .parent_map
= mmcc_pxo_dsi1_dsi2_byte_map
,
2258 .enable_reg
= 0x00cc,
2259 .enable_mask
= BIT(2),
2260 .hw
.init
= &(struct clk_init_data
){
2261 .name
= "dsi1_esc_src",
2262 .parent_names
= mmcc_pxo_dsi1_dsi2_byte
,
2264 .ops
= &clk_rcg_esc_ops
,
2269 static struct clk_branch dsi1_esc_clk
= {
2273 .enable_reg
= 0x00cc,
2274 .enable_mask
= BIT(0),
2275 .hw
.init
= &(struct clk_init_data
){
2276 .name
= "dsi1_esc_clk",
2277 .parent_names
= (const char *[]){ "dsi1_esc_src" },
2279 .ops
= &clk_branch_ops
,
2280 .flags
= CLK_SET_RATE_PARENT
,
2285 static struct clk_rcg dsi2_esc_src
= {
2288 .pre_div_shift
= 12,
2293 .parent_map
= mmcc_pxo_dsi1_dsi2_byte_map
,
2296 .enable_reg
= 0x013c,
2297 .enable_mask
= BIT(2),
2298 .hw
.init
= &(struct clk_init_data
){
2299 .name
= "dsi2_esc_src",
2300 .parent_names
= mmcc_pxo_dsi1_dsi2_byte
,
2302 .ops
= &clk_rcg_esc_ops
,
2307 static struct clk_branch dsi2_esc_clk
= {
2311 .enable_reg
= 0x013c,
2312 .enable_mask
= BIT(0),
2313 .hw
.init
= &(struct clk_init_data
){
2314 .name
= "dsi2_esc_clk",
2315 .parent_names
= (const char *[]){ "dsi2_esc_src" },
2317 .ops
= &clk_branch_ops
,
2318 .flags
= CLK_SET_RATE_PARENT
,
2323 static struct clk_rcg dsi1_pixel_src
= {
2328 .mnctr_reset_bit
= 7,
2329 .mnctr_mode_shift
= 6,
2335 .pre_div_shift
= 12,
2340 .parent_map
= mmcc_pxo_dsi2_dsi1_map
,
2343 .enable_reg
= 0x0130,
2344 .enable_mask
= BIT(2),
2345 .hw
.init
= &(struct clk_init_data
){
2346 .name
= "dsi1_pixel_src",
2347 .parent_names
= mmcc_pxo_dsi2_dsi1
,
2349 .ops
= &clk_rcg_pixel_ops
,
2354 static struct clk_branch dsi1_pixel_clk
= {
2358 .enable_reg
= 0x0130,
2359 .enable_mask
= BIT(0),
2360 .hw
.init
= &(struct clk_init_data
){
2361 .name
= "mdp_pclk1_clk",
2362 .parent_names
= (const char *[]){ "dsi1_pixel_src" },
2364 .ops
= &clk_branch_ops
,
2365 .flags
= CLK_SET_RATE_PARENT
,
2370 static struct clk_rcg dsi2_pixel_src
= {
2375 .mnctr_reset_bit
= 7,
2376 .mnctr_mode_shift
= 6,
2382 .pre_div_shift
= 12,
2387 .parent_map
= mmcc_pxo_dsi2_dsi1_map
,
2390 .enable_reg
= 0x0094,
2391 .enable_mask
= BIT(2),
2392 .hw
.init
= &(struct clk_init_data
){
2393 .name
= "dsi2_pixel_src",
2394 .parent_names
= mmcc_pxo_dsi2_dsi1
,
2396 .ops
= &clk_rcg_pixel_ops
,
2401 static struct clk_branch dsi2_pixel_clk
= {
2405 .enable_reg
= 0x0094,
2406 .enable_mask
= BIT(0),
2407 .hw
.init
= &(struct clk_init_data
){
2408 .name
= "mdp_pclk2_clk",
2409 .parent_names
= (const char *[]){ "dsi2_pixel_src" },
2411 .ops
= &clk_branch_ops
,
2412 .flags
= CLK_SET_RATE_PARENT
,
2417 static struct clk_branch gfx2d0_ahb_clk
= {
2423 .enable_reg
= 0x0008,
2424 .enable_mask
= BIT(19),
2425 .hw
.init
= &(struct clk_init_data
){
2426 .name
= "gfx2d0_ahb_clk",
2427 .ops
= &clk_branch_ops
,
2428 .flags
= CLK_IS_ROOT
,
2433 static struct clk_branch gfx2d1_ahb_clk
= {
2439 .enable_reg
= 0x0008,
2440 .enable_mask
= BIT(2),
2441 .hw
.init
= &(struct clk_init_data
){
2442 .name
= "gfx2d1_ahb_clk",
2443 .ops
= &clk_branch_ops
,
2444 .flags
= CLK_IS_ROOT
,
2449 static struct clk_branch gfx3d_ahb_clk
= {
2455 .enable_reg
= 0x0008,
2456 .enable_mask
= BIT(3),
2457 .hw
.init
= &(struct clk_init_data
){
2458 .name
= "gfx3d_ahb_clk",
2459 .ops
= &clk_branch_ops
,
2460 .flags
= CLK_IS_ROOT
,
2465 static struct clk_branch hdmi_m_ahb_clk
= {
2471 .enable_reg
= 0x0008,
2472 .enable_mask
= BIT(14),
2473 .hw
.init
= &(struct clk_init_data
){
2474 .name
= "hdmi_m_ahb_clk",
2475 .ops
= &clk_branch_ops
,
2476 .flags
= CLK_IS_ROOT
,
2481 static struct clk_branch hdmi_s_ahb_clk
= {
2487 .enable_reg
= 0x0008,
2488 .enable_mask
= BIT(4),
2489 .hw
.init
= &(struct clk_init_data
){
2490 .name
= "hdmi_s_ahb_clk",
2491 .ops
= &clk_branch_ops
,
2492 .flags
= CLK_IS_ROOT
,
2497 static struct clk_branch ijpeg_ahb_clk
= {
2501 .enable_reg
= 0x0008,
2502 .enable_mask
= BIT(5),
2503 .hw
.init
= &(struct clk_init_data
){
2504 .name
= "ijpeg_ahb_clk",
2505 .ops
= &clk_branch_ops
,
2506 .flags
= CLK_IS_ROOT
2511 static struct clk_branch mmss_imem_ahb_clk
= {
2517 .enable_reg
= 0x0008,
2518 .enable_mask
= BIT(6),
2519 .hw
.init
= &(struct clk_init_data
){
2520 .name
= "mmss_imem_ahb_clk",
2521 .ops
= &clk_branch_ops
,
2522 .flags
= CLK_IS_ROOT
2527 static struct clk_branch jpegd_ahb_clk
= {
2531 .enable_reg
= 0x0008,
2532 .enable_mask
= BIT(21),
2533 .hw
.init
= &(struct clk_init_data
){
2534 .name
= "jpegd_ahb_clk",
2535 .ops
= &clk_branch_ops
,
2536 .flags
= CLK_IS_ROOT
,
2541 static struct clk_branch mdp_ahb_clk
= {
2545 .enable_reg
= 0x0008,
2546 .enable_mask
= BIT(10),
2547 .hw
.init
= &(struct clk_init_data
){
2548 .name
= "mdp_ahb_clk",
2549 .ops
= &clk_branch_ops
,
2550 .flags
= CLK_IS_ROOT
,
2555 static struct clk_branch rot_ahb_clk
= {
2559 .enable_reg
= 0x0008,
2560 .enable_mask
= BIT(12),
2561 .hw
.init
= &(struct clk_init_data
){
2562 .name
= "rot_ahb_clk",
2563 .ops
= &clk_branch_ops
,
2564 .flags
= CLK_IS_ROOT
2569 static struct clk_branch smmu_ahb_clk
= {
2575 .enable_reg
= 0x0008,
2576 .enable_mask
= BIT(15),
2577 .hw
.init
= &(struct clk_init_data
){
2578 .name
= "smmu_ahb_clk",
2579 .ops
= &clk_branch_ops
,
2580 .flags
= CLK_IS_ROOT
,
2585 static struct clk_branch tv_enc_ahb_clk
= {
2589 .enable_reg
= 0x0008,
2590 .enable_mask
= BIT(25),
2591 .hw
.init
= &(struct clk_init_data
){
2592 .name
= "tv_enc_ahb_clk",
2593 .ops
= &clk_branch_ops
,
2594 .flags
= CLK_IS_ROOT
,
2599 static struct clk_branch vcap_ahb_clk
= {
2603 .enable_reg
= 0x0248,
2604 .enable_mask
= BIT(1),
2605 .hw
.init
= &(struct clk_init_data
){
2606 .name
= "vcap_ahb_clk",
2607 .ops
= &clk_branch_ops
,
2608 .flags
= CLK_IS_ROOT
,
2613 static struct clk_branch vcodec_ahb_clk
= {
2619 .enable_reg
= 0x0008,
2620 .enable_mask
= BIT(11),
2621 .hw
.init
= &(struct clk_init_data
){
2622 .name
= "vcodec_ahb_clk",
2623 .ops
= &clk_branch_ops
,
2624 .flags
= CLK_IS_ROOT
,
2629 static struct clk_branch vfe_ahb_clk
= {
2633 .enable_reg
= 0x0008,
2634 .enable_mask
= BIT(13),
2635 .hw
.init
= &(struct clk_init_data
){
2636 .name
= "vfe_ahb_clk",
2637 .ops
= &clk_branch_ops
,
2638 .flags
= CLK_IS_ROOT
,
2643 static struct clk_branch vpe_ahb_clk
= {
2647 .enable_reg
= 0x0008,
2648 .enable_mask
= BIT(16),
2649 .hw
.init
= &(struct clk_init_data
){
2650 .name
= "vpe_ahb_clk",
2651 .ops
= &clk_branch_ops
,
2652 .flags
= CLK_IS_ROOT
,
2657 static struct clk_regmap
*mmcc_msm8960_clks
[] = {
2658 [TV_ENC_AHB_CLK
] = &tv_enc_ahb_clk
.clkr
,
2659 [AMP_AHB_CLK
] = &_ahb_clk
.clkr
,
2660 [DSI2_S_AHB_CLK
] = &dsi2_s_ahb_clk
.clkr
,
2661 [JPEGD_AHB_CLK
] = &jpegd_ahb_clk
.clkr
,
2662 [GFX2D0_AHB_CLK
] = &gfx2d0_ahb_clk
.clkr
,
2663 [DSI_S_AHB_CLK
] = &dsi_s_ahb_clk
.clkr
,
2664 [DSI2_M_AHB_CLK
] = &dsi2_m_ahb_clk
.clkr
,
2665 [VPE_AHB_CLK
] = &vpe_ahb_clk
.clkr
,
2666 [SMMU_AHB_CLK
] = &smmu_ahb_clk
.clkr
,
2667 [HDMI_M_AHB_CLK
] = &hdmi_m_ahb_clk
.clkr
,
2668 [VFE_AHB_CLK
] = &vfe_ahb_clk
.clkr
,
2669 [ROT_AHB_CLK
] = &rot_ahb_clk
.clkr
,
2670 [VCODEC_AHB_CLK
] = &vcodec_ahb_clk
.clkr
,
2671 [MDP_AHB_CLK
] = &mdp_ahb_clk
.clkr
,
2672 [DSI_M_AHB_CLK
] = &dsi_m_ahb_clk
.clkr
,
2673 [CSI_AHB_CLK
] = &csi_ahb_clk
.clkr
,
2674 [MMSS_IMEM_AHB_CLK
] = &mmss_imem_ahb_clk
.clkr
,
2675 [IJPEG_AHB_CLK
] = &ijpeg_ahb_clk
.clkr
,
2676 [HDMI_S_AHB_CLK
] = &hdmi_s_ahb_clk
.clkr
,
2677 [GFX3D_AHB_CLK
] = &gfx3d_ahb_clk
.clkr
,
2678 [GFX2D1_AHB_CLK
] = &gfx2d1_ahb_clk
.clkr
,
2679 [JPEGD_AXI_CLK
] = &jpegd_axi_clk
.clkr
,
2680 [GMEM_AXI_CLK
] = &gmem_axi_clk
.clkr
,
2681 [MDP_AXI_CLK
] = &mdp_axi_clk
.clkr
,
2682 [MMSS_IMEM_AXI_CLK
] = &mmss_imem_axi_clk
.clkr
,
2683 [IJPEG_AXI_CLK
] = &ijpeg_axi_clk
.clkr
,
2684 [GFX3D_AXI_CLK
] = &gfx3d_axi_clk
.clkr
,
2685 [VCODEC_AXI_CLK
] = &vcodec_axi_clk
.clkr
,
2686 [VFE_AXI_CLK
] = &vfe_axi_clk
.clkr
,
2687 [VPE_AXI_CLK
] = &vpe_axi_clk
.clkr
,
2688 [ROT_AXI_CLK
] = &rot_axi_clk
.clkr
,
2689 [VCODEC_AXI_A_CLK
] = &vcodec_axi_a_clk
.clkr
,
2690 [VCODEC_AXI_B_CLK
] = &vcodec_axi_b_clk
.clkr
,
2691 [CSI0_SRC
] = &csi0_src
.clkr
,
2692 [CSI0_CLK
] = &csi0_clk
.clkr
,
2693 [CSI0_PHY_CLK
] = &csi0_phy_clk
.clkr
,
2694 [CSI1_SRC
] = &csi1_src
.clkr
,
2695 [CSI1_CLK
] = &csi1_clk
.clkr
,
2696 [CSI1_PHY_CLK
] = &csi1_phy_clk
.clkr
,
2697 [CSI2_SRC
] = &csi2_src
.clkr
,
2698 [CSI2_CLK
] = &csi2_clk
.clkr
,
2699 [CSI2_PHY_CLK
] = &csi2_phy_clk
.clkr
,
2700 [DSI_SRC
] = &dsi1_src
.clkr
,
2701 [DSI_CLK
] = &dsi1_clk
.clkr
,
2702 [CSI_PIX_CLK
] = &csi_pix_clk
.clkr
,
2703 [CSI_RDI_CLK
] = &csi_rdi_clk
.clkr
,
2704 [MDP_VSYNC_CLK
] = &mdp_vsync_clk
.clkr
,
2705 [HDMI_APP_CLK
] = &hdmi_app_clk
.clkr
,
2706 [CSI_PIX1_CLK
] = &csi_pix1_clk
.clkr
,
2707 [CSI_RDI2_CLK
] = &csi_rdi2_clk
.clkr
,
2708 [CSI_RDI1_CLK
] = &csi_rdi1_clk
.clkr
,
2709 [GFX2D0_SRC
] = &gfx2d0_src
.clkr
,
2710 [GFX2D0_CLK
] = &gfx2d0_clk
.clkr
,
2711 [GFX2D1_SRC
] = &gfx2d1_src
.clkr
,
2712 [GFX2D1_CLK
] = &gfx2d1_clk
.clkr
,
2713 [GFX3D_SRC
] = &gfx3d_src
.clkr
,
2714 [GFX3D_CLK
] = &gfx3d_clk
.clkr
,
2715 [IJPEG_SRC
] = &ijpeg_src
.clkr
,
2716 [IJPEG_CLK
] = &ijpeg_clk
.clkr
,
2717 [JPEGD_SRC
] = &jpegd_src
.clkr
,
2718 [JPEGD_CLK
] = &jpegd_clk
.clkr
,
2719 [MDP_SRC
] = &mdp_src
.clkr
,
2720 [MDP_CLK
] = &mdp_clk
.clkr
,
2721 [MDP_LUT_CLK
] = &mdp_lut_clk
.clkr
,
2722 [DSI2_PIXEL_SRC
] = &dsi2_pixel_src
.clkr
,
2723 [DSI2_PIXEL_CLK
] = &dsi2_pixel_clk
.clkr
,
2724 [DSI2_SRC
] = &dsi2_src
.clkr
,
2725 [DSI2_CLK
] = &dsi2_clk
.clkr
,
2726 [DSI1_BYTE_SRC
] = &dsi1_byte_src
.clkr
,
2727 [DSI1_BYTE_CLK
] = &dsi1_byte_clk
.clkr
,
2728 [DSI2_BYTE_SRC
] = &dsi2_byte_src
.clkr
,
2729 [DSI2_BYTE_CLK
] = &dsi2_byte_clk
.clkr
,
2730 [DSI1_ESC_SRC
] = &dsi1_esc_src
.clkr
,
2731 [DSI1_ESC_CLK
] = &dsi1_esc_clk
.clkr
,
2732 [DSI2_ESC_SRC
] = &dsi2_esc_src
.clkr
,
2733 [DSI2_ESC_CLK
] = &dsi2_esc_clk
.clkr
,
2734 [ROT_SRC
] = &rot_src
.clkr
,
2735 [ROT_CLK
] = &rot_clk
.clkr
,
2736 [TV_ENC_CLK
] = &tv_enc_clk
.clkr
,
2737 [TV_DAC_CLK
] = &tv_dac_clk
.clkr
,
2738 [HDMI_TV_CLK
] = &hdmi_tv_clk
.clkr
,
2739 [MDP_TV_CLK
] = &mdp_tv_clk
.clkr
,
2740 [TV_SRC
] = &tv_src
.clkr
,
2741 [VCODEC_SRC
] = &vcodec_src
.clkr
,
2742 [VCODEC_CLK
] = &vcodec_clk
.clkr
,
2743 [VFE_SRC
] = &vfe_src
.clkr
,
2744 [VFE_CLK
] = &vfe_clk
.clkr
,
2745 [VFE_CSI_CLK
] = &vfe_csi_clk
.clkr
,
2746 [VPE_SRC
] = &vpe_src
.clkr
,
2747 [VPE_CLK
] = &vpe_clk
.clkr
,
2748 [DSI_PIXEL_SRC
] = &dsi1_pixel_src
.clkr
,
2749 [DSI_PIXEL_CLK
] = &dsi1_pixel_clk
.clkr
,
2750 [CAMCLK0_SRC
] = &camclk0_src
.clkr
,
2751 [CAMCLK0_CLK
] = &camclk0_clk
.clkr
,
2752 [CAMCLK1_SRC
] = &camclk1_src
.clkr
,
2753 [CAMCLK1_CLK
] = &camclk1_clk
.clkr
,
2754 [CAMCLK2_SRC
] = &camclk2_src
.clkr
,
2755 [CAMCLK2_CLK
] = &camclk2_clk
.clkr
,
2756 [CSIPHYTIMER_SRC
] = &csiphytimer_src
.clkr
,
2757 [CSIPHY2_TIMER_CLK
] = &csiphy2_timer_clk
.clkr
,
2758 [CSIPHY1_TIMER_CLK
] = &csiphy1_timer_clk
.clkr
,
2759 [CSIPHY0_TIMER_CLK
] = &csiphy0_timer_clk
.clkr
,
2760 [PLL2
] = &pll2
.clkr
,
2763 static const struct qcom_reset_map mmcc_msm8960_resets
[] = {
2764 [VPE_AXI_RESET
] = { 0x0208, 15 },
2765 [IJPEG_AXI_RESET
] = { 0x0208, 14 },
2766 [MPD_AXI_RESET
] = { 0x0208, 13 },
2767 [VFE_AXI_RESET
] = { 0x0208, 9 },
2768 [SP_AXI_RESET
] = { 0x0208, 8 },
2769 [VCODEC_AXI_RESET
] = { 0x0208, 7 },
2770 [ROT_AXI_RESET
] = { 0x0208, 6 },
2771 [VCODEC_AXI_A_RESET
] = { 0x0208, 5 },
2772 [VCODEC_AXI_B_RESET
] = { 0x0208, 4 },
2773 [FAB_S3_AXI_RESET
] = { 0x0208, 3 },
2774 [FAB_S2_AXI_RESET
] = { 0x0208, 2 },
2775 [FAB_S1_AXI_RESET
] = { 0x0208, 1 },
2776 [FAB_S0_AXI_RESET
] = { 0x0208 },
2777 [SMMU_GFX3D_ABH_RESET
] = { 0x020c, 31 },
2778 [SMMU_VPE_AHB_RESET
] = { 0x020c, 30 },
2779 [SMMU_VFE_AHB_RESET
] = { 0x020c, 29 },
2780 [SMMU_ROT_AHB_RESET
] = { 0x020c, 28 },
2781 [SMMU_VCODEC_B_AHB_RESET
] = { 0x020c, 27 },
2782 [SMMU_VCODEC_A_AHB_RESET
] = { 0x020c, 26 },
2783 [SMMU_MDP1_AHB_RESET
] = { 0x020c, 25 },
2784 [SMMU_MDP0_AHB_RESET
] = { 0x020c, 24 },
2785 [SMMU_JPEGD_AHB_RESET
] = { 0x020c, 23 },
2786 [SMMU_IJPEG_AHB_RESET
] = { 0x020c, 22 },
2787 [SMMU_GFX2D0_AHB_RESET
] = { 0x020c, 21 },
2788 [SMMU_GFX2D1_AHB_RESET
] = { 0x020c, 20 },
2789 [APU_AHB_RESET
] = { 0x020c, 18 },
2790 [CSI_AHB_RESET
] = { 0x020c, 17 },
2791 [TV_ENC_AHB_RESET
] = { 0x020c, 15 },
2792 [VPE_AHB_RESET
] = { 0x020c, 14 },
2793 [FABRIC_AHB_RESET
] = { 0x020c, 13 },
2794 [GFX2D0_AHB_RESET
] = { 0x020c, 12 },
2795 [GFX2D1_AHB_RESET
] = { 0x020c, 11 },
2796 [GFX3D_AHB_RESET
] = { 0x020c, 10 },
2797 [HDMI_AHB_RESET
] = { 0x020c, 9 },
2798 [MSSS_IMEM_AHB_RESET
] = { 0x020c, 8 },
2799 [IJPEG_AHB_RESET
] = { 0x020c, 7 },
2800 [DSI_M_AHB_RESET
] = { 0x020c, 6 },
2801 [DSI_S_AHB_RESET
] = { 0x020c, 5 },
2802 [JPEGD_AHB_RESET
] = { 0x020c, 4 },
2803 [MDP_AHB_RESET
] = { 0x020c, 3 },
2804 [ROT_AHB_RESET
] = { 0x020c, 2 },
2805 [VCODEC_AHB_RESET
] = { 0x020c, 1 },
2806 [VFE_AHB_RESET
] = { 0x020c, 0 },
2807 [DSI2_M_AHB_RESET
] = { 0x0210, 31 },
2808 [DSI2_S_AHB_RESET
] = { 0x0210, 30 },
2809 [CSIPHY2_RESET
] = { 0x0210, 29 },
2810 [CSI_PIX1_RESET
] = { 0x0210, 28 },
2811 [CSIPHY0_RESET
] = { 0x0210, 27 },
2812 [CSIPHY1_RESET
] = { 0x0210, 26 },
2813 [DSI2_RESET
] = { 0x0210, 25 },
2814 [VFE_CSI_RESET
] = { 0x0210, 24 },
2815 [MDP_RESET
] = { 0x0210, 21 },
2816 [AMP_RESET
] = { 0x0210, 20 },
2817 [JPEGD_RESET
] = { 0x0210, 19 },
2818 [CSI1_RESET
] = { 0x0210, 18 },
2819 [VPE_RESET
] = { 0x0210, 17 },
2820 [MMSS_FABRIC_RESET
] = { 0x0210, 16 },
2821 [VFE_RESET
] = { 0x0210, 15 },
2822 [GFX2D0_RESET
] = { 0x0210, 14 },
2823 [GFX2D1_RESET
] = { 0x0210, 13 },
2824 [GFX3D_RESET
] = { 0x0210, 12 },
2825 [HDMI_RESET
] = { 0x0210, 11 },
2826 [MMSS_IMEM_RESET
] = { 0x0210, 10 },
2827 [IJPEG_RESET
] = { 0x0210, 9 },
2828 [CSI0_RESET
] = { 0x0210, 8 },
2829 [DSI_RESET
] = { 0x0210, 7 },
2830 [VCODEC_RESET
] = { 0x0210, 6 },
2831 [MDP_TV_RESET
] = { 0x0210, 4 },
2832 [MDP_VSYNC_RESET
] = { 0x0210, 3 },
2833 [ROT_RESET
] = { 0x0210, 2 },
2834 [TV_HDMI_RESET
] = { 0x0210, 1 },
2835 [TV_ENC_RESET
] = { 0x0210 },
2836 [CSI2_RESET
] = { 0x0214, 2 },
2837 [CSI_RDI1_RESET
] = { 0x0214, 1 },
2838 [CSI_RDI2_RESET
] = { 0x0214 },
2841 static struct clk_regmap
*mmcc_apq8064_clks
[] = {
2842 [AMP_AHB_CLK
] = &_ahb_clk
.clkr
,
2843 [DSI2_S_AHB_CLK
] = &dsi2_s_ahb_clk
.clkr
,
2844 [JPEGD_AHB_CLK
] = &jpegd_ahb_clk
.clkr
,
2845 [DSI_S_AHB_CLK
] = &dsi_s_ahb_clk
.clkr
,
2846 [DSI2_M_AHB_CLK
] = &dsi2_m_ahb_clk
.clkr
,
2847 [VPE_AHB_CLK
] = &vpe_ahb_clk
.clkr
,
2848 [SMMU_AHB_CLK
] = &smmu_ahb_clk
.clkr
,
2849 [HDMI_M_AHB_CLK
] = &hdmi_m_ahb_clk
.clkr
,
2850 [VFE_AHB_CLK
] = &vfe_ahb_clk
.clkr
,
2851 [ROT_AHB_CLK
] = &rot_ahb_clk
.clkr
,
2852 [VCODEC_AHB_CLK
] = &vcodec_ahb_clk
.clkr
,
2853 [MDP_AHB_CLK
] = &mdp_ahb_clk
.clkr
,
2854 [DSI_M_AHB_CLK
] = &dsi_m_ahb_clk
.clkr
,
2855 [CSI_AHB_CLK
] = &csi_ahb_clk
.clkr
,
2856 [MMSS_IMEM_AHB_CLK
] = &mmss_imem_ahb_clk
.clkr
,
2857 [IJPEG_AHB_CLK
] = &ijpeg_ahb_clk
.clkr
,
2858 [HDMI_S_AHB_CLK
] = &hdmi_s_ahb_clk
.clkr
,
2859 [GFX3D_AHB_CLK
] = &gfx3d_ahb_clk
.clkr
,
2860 [JPEGD_AXI_CLK
] = &jpegd_axi_clk
.clkr
,
2861 [GMEM_AXI_CLK
] = &gmem_axi_clk
.clkr
,
2862 [MDP_AXI_CLK
] = &mdp_axi_clk
.clkr
,
2863 [MMSS_IMEM_AXI_CLK
] = &mmss_imem_axi_clk
.clkr
,
2864 [IJPEG_AXI_CLK
] = &ijpeg_axi_clk
.clkr
,
2865 [GFX3D_AXI_CLK
] = &gfx3d_axi_clk
.clkr
,
2866 [VCODEC_AXI_CLK
] = &vcodec_axi_clk
.clkr
,
2867 [VFE_AXI_CLK
] = &vfe_axi_clk
.clkr
,
2868 [VPE_AXI_CLK
] = &vpe_axi_clk
.clkr
,
2869 [ROT_AXI_CLK
] = &rot_axi_clk
.clkr
,
2870 [VCODEC_AXI_A_CLK
] = &vcodec_axi_a_clk
.clkr
,
2871 [VCODEC_AXI_B_CLK
] = &vcodec_axi_b_clk
.clkr
,
2872 [CSI0_SRC
] = &csi0_src
.clkr
,
2873 [CSI0_CLK
] = &csi0_clk
.clkr
,
2874 [CSI0_PHY_CLK
] = &csi0_phy_clk
.clkr
,
2875 [CSI1_SRC
] = &csi1_src
.clkr
,
2876 [CSI1_CLK
] = &csi1_clk
.clkr
,
2877 [CSI1_PHY_CLK
] = &csi1_phy_clk
.clkr
,
2878 [CSI2_SRC
] = &csi2_src
.clkr
,
2879 [CSI2_CLK
] = &csi2_clk
.clkr
,
2880 [CSI2_PHY_CLK
] = &csi2_phy_clk
.clkr
,
2881 [DSI_SRC
] = &dsi1_src
.clkr
,
2882 [DSI_CLK
] = &dsi1_clk
.clkr
,
2883 [CSI_PIX_CLK
] = &csi_pix_clk
.clkr
,
2884 [CSI_RDI_CLK
] = &csi_rdi_clk
.clkr
,
2885 [MDP_VSYNC_CLK
] = &mdp_vsync_clk
.clkr
,
2886 [HDMI_APP_CLK
] = &hdmi_app_clk
.clkr
,
2887 [CSI_PIX1_CLK
] = &csi_pix1_clk
.clkr
,
2888 [CSI_RDI2_CLK
] = &csi_rdi2_clk
.clkr
,
2889 [CSI_RDI1_CLK
] = &csi_rdi1_clk
.clkr
,
2890 [GFX3D_SRC
] = &gfx3d_src
.clkr
,
2891 [GFX3D_CLK
] = &gfx3d_clk
.clkr
,
2892 [IJPEG_SRC
] = &ijpeg_src
.clkr
,
2893 [IJPEG_CLK
] = &ijpeg_clk
.clkr
,
2894 [JPEGD_SRC
] = &jpegd_src
.clkr
,
2895 [JPEGD_CLK
] = &jpegd_clk
.clkr
,
2896 [MDP_SRC
] = &mdp_src
.clkr
,
2897 [MDP_CLK
] = &mdp_clk
.clkr
,
2898 [MDP_LUT_CLK
] = &mdp_lut_clk
.clkr
,
2899 [DSI2_PIXEL_SRC
] = &dsi2_pixel_src
.clkr
,
2900 [DSI2_PIXEL_CLK
] = &dsi2_pixel_clk
.clkr
,
2901 [DSI2_SRC
] = &dsi2_src
.clkr
,
2902 [DSI2_CLK
] = &dsi2_clk
.clkr
,
2903 [DSI1_BYTE_SRC
] = &dsi1_byte_src
.clkr
,
2904 [DSI1_BYTE_CLK
] = &dsi1_byte_clk
.clkr
,
2905 [DSI2_BYTE_SRC
] = &dsi2_byte_src
.clkr
,
2906 [DSI2_BYTE_CLK
] = &dsi2_byte_clk
.clkr
,
2907 [DSI1_ESC_SRC
] = &dsi1_esc_src
.clkr
,
2908 [DSI1_ESC_CLK
] = &dsi1_esc_clk
.clkr
,
2909 [DSI2_ESC_SRC
] = &dsi2_esc_src
.clkr
,
2910 [DSI2_ESC_CLK
] = &dsi2_esc_clk
.clkr
,
2911 [ROT_SRC
] = &rot_src
.clkr
,
2912 [ROT_CLK
] = &rot_clk
.clkr
,
2913 [TV_DAC_CLK
] = &tv_dac_clk
.clkr
,
2914 [HDMI_TV_CLK
] = &hdmi_tv_clk
.clkr
,
2915 [MDP_TV_CLK
] = &mdp_tv_clk
.clkr
,
2916 [TV_SRC
] = &tv_src
.clkr
,
2917 [VCODEC_SRC
] = &vcodec_src
.clkr
,
2918 [VCODEC_CLK
] = &vcodec_clk
.clkr
,
2919 [VFE_SRC
] = &vfe_src
.clkr
,
2920 [VFE_CLK
] = &vfe_clk
.clkr
,
2921 [VFE_CSI_CLK
] = &vfe_csi_clk
.clkr
,
2922 [VPE_SRC
] = &vpe_src
.clkr
,
2923 [VPE_CLK
] = &vpe_clk
.clkr
,
2924 [DSI_PIXEL_SRC
] = &dsi1_pixel_src
.clkr
,
2925 [DSI_PIXEL_CLK
] = &dsi1_pixel_clk
.clkr
,
2926 [CAMCLK0_SRC
] = &camclk0_src
.clkr
,
2927 [CAMCLK0_CLK
] = &camclk0_clk
.clkr
,
2928 [CAMCLK1_SRC
] = &camclk1_src
.clkr
,
2929 [CAMCLK1_CLK
] = &camclk1_clk
.clkr
,
2930 [CAMCLK2_SRC
] = &camclk2_src
.clkr
,
2931 [CAMCLK2_CLK
] = &camclk2_clk
.clkr
,
2932 [CSIPHYTIMER_SRC
] = &csiphytimer_src
.clkr
,
2933 [CSIPHY2_TIMER_CLK
] = &csiphy2_timer_clk
.clkr
,
2934 [CSIPHY1_TIMER_CLK
] = &csiphy1_timer_clk
.clkr
,
2935 [CSIPHY0_TIMER_CLK
] = &csiphy0_timer_clk
.clkr
,
2936 [PLL2
] = &pll2
.clkr
,
2937 [RGB_TV_CLK
] = &rgb_tv_clk
.clkr
,
2938 [NPL_TV_CLK
] = &npl_tv_clk
.clkr
,
2939 [VCAP_AHB_CLK
] = &vcap_ahb_clk
.clkr
,
2940 [VCAP_AXI_CLK
] = &vcap_axi_clk
.clkr
,
2941 [VCAP_SRC
] = &vcap_src
.clkr
,
2942 [VCAP_CLK
] = &vcap_clk
.clkr
,
2943 [VCAP_NPL_CLK
] = &vcap_npl_clk
.clkr
,
2944 [PLL15
] = &pll15
.clkr
,
2947 static const struct qcom_reset_map mmcc_apq8064_resets
[] = {
2948 [GFX3D_AXI_RESET
] = { 0x0208, 17 },
2949 [VCAP_AXI_RESET
] = { 0x0208, 16 },
2950 [VPE_AXI_RESET
] = { 0x0208, 15 },
2951 [IJPEG_AXI_RESET
] = { 0x0208, 14 },
2952 [MPD_AXI_RESET
] = { 0x0208, 13 },
2953 [VFE_AXI_RESET
] = { 0x0208, 9 },
2954 [SP_AXI_RESET
] = { 0x0208, 8 },
2955 [VCODEC_AXI_RESET
] = { 0x0208, 7 },
2956 [ROT_AXI_RESET
] = { 0x0208, 6 },
2957 [VCODEC_AXI_A_RESET
] = { 0x0208, 5 },
2958 [VCODEC_AXI_B_RESET
] = { 0x0208, 4 },
2959 [FAB_S3_AXI_RESET
] = { 0x0208, 3 },
2960 [FAB_S2_AXI_RESET
] = { 0x0208, 2 },
2961 [FAB_S1_AXI_RESET
] = { 0x0208, 1 },
2962 [FAB_S0_AXI_RESET
] = { 0x0208 },
2963 [SMMU_GFX3D_ABH_RESET
] = { 0x020c, 31 },
2964 [SMMU_VPE_AHB_RESET
] = { 0x020c, 30 },
2965 [SMMU_VFE_AHB_RESET
] = { 0x020c, 29 },
2966 [SMMU_ROT_AHB_RESET
] = { 0x020c, 28 },
2967 [SMMU_VCODEC_B_AHB_RESET
] = { 0x020c, 27 },
2968 [SMMU_VCODEC_A_AHB_RESET
] = { 0x020c, 26 },
2969 [SMMU_MDP1_AHB_RESET
] = { 0x020c, 25 },
2970 [SMMU_MDP0_AHB_RESET
] = { 0x020c, 24 },
2971 [SMMU_JPEGD_AHB_RESET
] = { 0x020c, 23 },
2972 [SMMU_IJPEG_AHB_RESET
] = { 0x020c, 22 },
2973 [APU_AHB_RESET
] = { 0x020c, 18 },
2974 [CSI_AHB_RESET
] = { 0x020c, 17 },
2975 [TV_ENC_AHB_RESET
] = { 0x020c, 15 },
2976 [VPE_AHB_RESET
] = { 0x020c, 14 },
2977 [FABRIC_AHB_RESET
] = { 0x020c, 13 },
2978 [GFX3D_AHB_RESET
] = { 0x020c, 10 },
2979 [HDMI_AHB_RESET
] = { 0x020c, 9 },
2980 [MSSS_IMEM_AHB_RESET
] = { 0x020c, 8 },
2981 [IJPEG_AHB_RESET
] = { 0x020c, 7 },
2982 [DSI_M_AHB_RESET
] = { 0x020c, 6 },
2983 [DSI_S_AHB_RESET
] = { 0x020c, 5 },
2984 [JPEGD_AHB_RESET
] = { 0x020c, 4 },
2985 [MDP_AHB_RESET
] = { 0x020c, 3 },
2986 [ROT_AHB_RESET
] = { 0x020c, 2 },
2987 [VCODEC_AHB_RESET
] = { 0x020c, 1 },
2988 [VFE_AHB_RESET
] = { 0x020c, 0 },
2989 [SMMU_VCAP_AHB_RESET
] = { 0x0200, 3 },
2990 [VCAP_AHB_RESET
] = { 0x0200, 2 },
2991 [DSI2_M_AHB_RESET
] = { 0x0200, 1 },
2992 [DSI2_S_AHB_RESET
] = { 0x0200, 0 },
2993 [CSIPHY2_RESET
] = { 0x0210, 31 },
2994 [CSI_PIX1_RESET
] = { 0x0210, 30 },
2995 [CSIPHY0_RESET
] = { 0x0210, 29 },
2996 [CSIPHY1_RESET
] = { 0x0210, 28 },
2997 [CSI_RDI_RESET
] = { 0x0210, 27 },
2998 [CSI_PIX_RESET
] = { 0x0210, 26 },
2999 [DSI2_RESET
] = { 0x0210, 25 },
3000 [VFE_CSI_RESET
] = { 0x0210, 24 },
3001 [MDP_RESET
] = { 0x0210, 21 },
3002 [AMP_RESET
] = { 0x0210, 20 },
3003 [JPEGD_RESET
] = { 0x0210, 19 },
3004 [CSI1_RESET
] = { 0x0210, 18 },
3005 [VPE_RESET
] = { 0x0210, 17 },
3006 [MMSS_FABRIC_RESET
] = { 0x0210, 16 },
3007 [VFE_RESET
] = { 0x0210, 15 },
3008 [GFX3D_RESET
] = { 0x0210, 12 },
3009 [HDMI_RESET
] = { 0x0210, 11 },
3010 [MMSS_IMEM_RESET
] = { 0x0210, 10 },
3011 [IJPEG_RESET
] = { 0x0210, 9 },
3012 [CSI0_RESET
] = { 0x0210, 8 },
3013 [DSI_RESET
] = { 0x0210, 7 },
3014 [VCODEC_RESET
] = { 0x0210, 6 },
3015 [MDP_TV_RESET
] = { 0x0210, 4 },
3016 [MDP_VSYNC_RESET
] = { 0x0210, 3 },
3017 [ROT_RESET
] = { 0x0210, 2 },
3018 [TV_HDMI_RESET
] = { 0x0210, 1 },
3019 [VCAP_NPL_RESET
] = { 0x0214, 4 },
3020 [VCAP_RESET
] = { 0x0214, 3 },
3021 [CSI2_RESET
] = { 0x0214, 2 },
3022 [CSI_RDI1_RESET
] = { 0x0214, 1 },
3023 [CSI_RDI2_RESET
] = { 0x0214 },
3026 static const struct regmap_config mmcc_msm8960_regmap_config
= {
3030 .max_register
= 0x334,
3034 static const struct regmap_config mmcc_apq8064_regmap_config
= {
3038 .max_register
= 0x350,
3042 static const struct qcom_cc_desc mmcc_msm8960_desc
= {
3043 .config
= &mmcc_msm8960_regmap_config
,
3044 .clks
= mmcc_msm8960_clks
,
3045 .num_clks
= ARRAY_SIZE(mmcc_msm8960_clks
),
3046 .resets
= mmcc_msm8960_resets
,
3047 .num_resets
= ARRAY_SIZE(mmcc_msm8960_resets
),
3050 static const struct qcom_cc_desc mmcc_apq8064_desc
= {
3051 .config
= &mmcc_apq8064_regmap_config
,
3052 .clks
= mmcc_apq8064_clks
,
3053 .num_clks
= ARRAY_SIZE(mmcc_apq8064_clks
),
3054 .resets
= mmcc_apq8064_resets
,
3055 .num_resets
= ARRAY_SIZE(mmcc_apq8064_resets
),
3058 static const struct of_device_id mmcc_msm8960_match_table
[] = {
3059 { .compatible
= "qcom,mmcc-msm8960", .data
= &mmcc_msm8960_desc
},
3060 { .compatible
= "qcom,mmcc-apq8064", .data
= &mmcc_apq8064_desc
},
3063 MODULE_DEVICE_TABLE(of
, mmcc_msm8960_match_table
);
3065 static int mmcc_msm8960_probe(struct platform_device
*pdev
)
3067 const struct of_device_id
*match
;
3068 struct regmap
*regmap
;
3070 struct device
*dev
= &pdev
->dev
;
3072 match
= of_match_device(mmcc_msm8960_match_table
, dev
);
3076 is_8064
= of_device_is_compatible(dev
->of_node
, "qcom,mmcc-apq8064");
3078 gfx3d_src
.freq_tbl
= clk_tbl_gfx3d_8064
;
3079 gfx3d_src
.clkr
.hw
.init
= &gfx3d_8064_init
;
3080 gfx3d_src
.s
[0].parent_map
= mmcc_pxo_pll8_pll2_pll15_map
;
3081 gfx3d_src
.s
[1].parent_map
= mmcc_pxo_pll8_pll2_pll15_map
;
3084 regmap
= qcom_cc_map(pdev
, match
->data
);
3086 return PTR_ERR(regmap
);
3088 clk_pll_configure_sr(&pll15
, regmap
, &pll15_config
, false);
3090 return qcom_cc_really_probe(pdev
, match
->data
, regmap
);
3093 static struct platform_driver mmcc_msm8960_driver
= {
3094 .probe
= mmcc_msm8960_probe
,
3096 .name
= "mmcc-msm8960",
3097 .of_match_table
= mmcc_msm8960_match_table
,
3101 module_platform_driver(mmcc_msm8960_driver
);
3103 MODULE_DESCRIPTION("QCOM MMCC MSM8960 Driver");
3104 MODULE_LICENSE("GPL v2");
3105 MODULE_ALIAS("platform:mmcc-msm8960");