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-provider.h>
23 #include <linux/regmap.h>
24 #include <linux/reset-controller.h>
26 #include <dt-bindings/clock/qcom,mmcc-msm8960.h>
27 #include <dt-bindings/reset/qcom,mmcc-msm8960.h>
30 #include "clk-regmap.h"
33 #include "clk-branch.h"
41 #define F_MN(f, s, _m, _n) { .freq = f, .src = s, .m = _m, .n = _n }
43 static u8 mmcc_pxo_pll8_pll2_map[] = {
49 static const char *mmcc_pxo_pll8_pll2[] = {
55 static u8 mmcc_pxo_pll8_pll2_pll3_map[] = {
62 static const char *mmcc_pxo_pll8_pll2_pll3[] = {
69 static struct clk_pll pll2 = {
77 .clkr.hw.init = &(struct clk_init_data){
79 .parent_names = (const char *[]){ "pxo" },
85 static struct freq_tbl clk_tbl_cam[] = {
86 { 6000000, P_PLL8, 4, 1, 16 },
87 { 8000000, P_PLL8, 4, 1, 12 },
88 { 12000000, P_PLL8, 4, 1, 8 },
89 { 16000000, P_PLL8, 4, 1, 6 },
90 { 19200000, P_PLL8, 4, 1, 5 },
91 { 24000000, P_PLL8, 4, 1, 4 },
92 { 32000000, P_PLL8, 4, 1, 3 },
93 { 48000000, P_PLL8, 4, 1, 2 },
94 { 64000000, P_PLL8, 3, 1, 2 },
95 { 96000000, P_PLL8, 4, 0, 0 },
96 { 128000000, P_PLL8, 3, 0, 0 },
100 static struct clk_rcg camclk0_src = {
105 .mnctr_reset_bit = 8,
107 .mnctr_mode_shift = 6,
118 .parent_map = mmcc_pxo_pll8_pll2_map,
120 .freq_tbl = clk_tbl_cam,
122 .enable_reg = 0x0140,
123 .enable_mask = BIT(2),
124 .hw.init = &(struct clk_init_data){
125 .name = "camclk0_src",
126 .parent_names = mmcc_pxo_pll8_pll2,
133 static struct clk_branch camclk0_clk = {
137 .enable_reg = 0x0140,
138 .enable_mask = BIT(0),
139 .hw.init = &(struct clk_init_data){
140 .name = "camclk0_clk",
141 .parent_names = (const char *[]){ "camclk0_src" },
143 .ops = &clk_branch_ops,
149 static struct clk_rcg camclk1_src = {
154 .mnctr_reset_bit = 8,
156 .mnctr_mode_shift = 6,
167 .parent_map = mmcc_pxo_pll8_pll2_map,
169 .freq_tbl = clk_tbl_cam,
171 .enable_reg = 0x0154,
172 .enable_mask = BIT(2),
173 .hw.init = &(struct clk_init_data){
174 .name = "camclk1_src",
175 .parent_names = mmcc_pxo_pll8_pll2,
182 static struct clk_branch camclk1_clk = {
186 .enable_reg = 0x0154,
187 .enable_mask = BIT(0),
188 .hw.init = &(struct clk_init_data){
189 .name = "camclk1_clk",
190 .parent_names = (const char *[]){ "camclk1_src" },
192 .ops = &clk_branch_ops,
198 static struct clk_rcg camclk2_src = {
203 .mnctr_reset_bit = 8,
205 .mnctr_mode_shift = 6,
216 .parent_map = mmcc_pxo_pll8_pll2_map,
218 .freq_tbl = clk_tbl_cam,
220 .enable_reg = 0x0220,
221 .enable_mask = BIT(2),
222 .hw.init = &(struct clk_init_data){
223 .name = "camclk2_src",
224 .parent_names = mmcc_pxo_pll8_pll2,
231 static struct clk_branch camclk2_clk = {
235 .enable_reg = 0x0220,
236 .enable_mask = BIT(0),
237 .hw.init = &(struct clk_init_data){
238 .name = "camclk2_clk",
239 .parent_names = (const char *[]){ "camclk2_src" },
241 .ops = &clk_branch_ops,
247 static struct freq_tbl clk_tbl_csi[] = {
248 { 27000000, P_PXO, 1, 0, 0 },
249 { 85330000, P_PLL8, 1, 2, 9 },
250 { 177780000, P_PLL2, 1, 2, 9 },
254 static struct clk_rcg csi0_src = {
259 .mnctr_reset_bit = 7,
260 .mnctr_mode_shift = 6,
271 .parent_map = mmcc_pxo_pll8_pll2_map,
273 .freq_tbl = clk_tbl_csi,
275 .enable_reg = 0x0040,
276 .enable_mask = BIT(2),
277 .hw.init = &(struct clk_init_data){
279 .parent_names = mmcc_pxo_pll8_pll2,
286 static struct clk_branch csi0_clk = {
290 .enable_reg = 0x0040,
291 .enable_mask = BIT(0),
292 .hw.init = &(struct clk_init_data){
293 .parent_names = (const char *[]){ "csi0_src" },
296 .ops = &clk_branch_ops,
297 .flags = CLK_SET_RATE_PARENT,
302 static struct clk_branch csi0_phy_clk = {
306 .enable_reg = 0x0040,
307 .enable_mask = BIT(8),
308 .hw.init = &(struct clk_init_data){
309 .parent_names = (const char *[]){ "csi0_src" },
311 .name = "csi0_phy_clk",
312 .ops = &clk_branch_ops,
313 .flags = CLK_SET_RATE_PARENT,
318 static struct clk_rcg csi1_src = {
323 .mnctr_reset_bit = 7,
324 .mnctr_mode_shift = 6,
335 .parent_map = mmcc_pxo_pll8_pll2_map,
337 .freq_tbl = clk_tbl_csi,
339 .enable_reg = 0x0024,
340 .enable_mask = BIT(2),
341 .hw.init = &(struct clk_init_data){
343 .parent_names = mmcc_pxo_pll8_pll2,
350 static struct clk_branch csi1_clk = {
354 .enable_reg = 0x0024,
355 .enable_mask = BIT(0),
356 .hw.init = &(struct clk_init_data){
357 .parent_names = (const char *[]){ "csi1_src" },
360 .ops = &clk_branch_ops,
361 .flags = CLK_SET_RATE_PARENT,
366 static struct clk_branch csi1_phy_clk = {
370 .enable_reg = 0x0024,
371 .enable_mask = BIT(8),
372 .hw.init = &(struct clk_init_data){
373 .parent_names = (const char *[]){ "csi1_src" },
375 .name = "csi1_phy_clk",
376 .ops = &clk_branch_ops,
377 .flags = CLK_SET_RATE_PARENT,
382 static struct clk_rcg csi2_src = {
387 .mnctr_reset_bit = 7,
388 .mnctr_mode_shift = 6,
399 .parent_map = mmcc_pxo_pll8_pll2_map,
401 .freq_tbl = clk_tbl_csi,
403 .enable_reg = 0x022c,
404 .enable_mask = BIT(2),
405 .hw.init = &(struct clk_init_data){
407 .parent_names = mmcc_pxo_pll8_pll2,
414 static struct clk_branch csi2_clk = {
418 .enable_reg = 0x022c,
419 .enable_mask = BIT(0),
420 .hw.init = &(struct clk_init_data){
421 .parent_names = (const char *[]){ "csi2_src" },
424 .ops = &clk_branch_ops,
425 .flags = CLK_SET_RATE_PARENT,
430 static struct clk_branch csi2_phy_clk = {
434 .enable_reg = 0x022c,
435 .enable_mask = BIT(8),
436 .hw.init = &(struct clk_init_data){
437 .parent_names = (const char *[]){ "csi2_src" },
439 .name = "csi2_phy_clk",
440 .ops = &clk_branch_ops,
441 .flags = CLK_SET_RATE_PARENT,
451 struct clk_regmap clkr;
454 #define to_clk_pix_rdi(_hw) \
455 container_of(to_clk_regmap(_hw), struct clk_pix_rdi, clkr)
457 static int pix_rdi_set_parent(struct clk_hw *hw, u8 index)
462 struct clk_pix_rdi *rdi = to_clk_pix_rdi(hw);
463 struct clk *clk = hw->clk;
464 int num_parents = __clk_get_num_parents(hw->clk);
467 * These clocks select three inputs via two muxes. One mux selects
468 * between csi0 and csi1 and the second mux selects between that mux's
469 * output and csi2. The source and destination selections for each
470 * mux must be clocking for the switch to succeed so just turn on
471 * all three sources because it's easier than figuring out what source
472 * needs to be on at what time.
474 for (i = 0; i < num_parents; i++) {
475 ret = clk_prepare_enable(clk_get_parent_by_index(clk, i));
484 regmap_update_bits(rdi->clkr.regmap, rdi->s2_reg, rdi->s2_mask, val);
486 * Wait at least 6 cycles of slowest clock
487 * for the glitch-free MUX to fully switch sources.
495 regmap_update_bits(rdi->clkr.regmap, rdi->s_reg, rdi->s_mask, val);
497 * Wait at least 6 cycles of slowest clock
498 * for the glitch-free MUX to fully switch sources.
503 for (i--; i >= 0; i--)
504 clk_disable_unprepare(clk_get_parent_by_index(clk, i));
509 static u8 pix_rdi_get_parent(struct clk_hw *hw)
512 struct clk_pix_rdi *rdi = to_clk_pix_rdi(hw);
515 regmap_read(rdi->clkr.regmap, rdi->s2_reg, &val);
516 if (val & rdi->s2_mask)
519 regmap_read(rdi->clkr.regmap, rdi->s_reg, &val);
520 if (val & rdi->s_mask)
526 static const struct clk_ops clk_ops_pix_rdi = {
527 .enable = clk_enable_regmap,
528 .disable = clk_disable_regmap,
529 .set_parent = pix_rdi_set_parent,
530 .get_parent = pix_rdi_get_parent,
531 .determine_rate = __clk_mux_determine_rate,
534 static const char *pix_rdi_parents[] = {
540 static struct clk_pix_rdi csi_pix_clk = {
546 .enable_reg = 0x0058,
547 .enable_mask = BIT(26),
548 .hw.init = &(struct clk_init_data){
549 .name = "csi_pix_clk",
550 .parent_names = pix_rdi_parents,
552 .ops = &clk_ops_pix_rdi,
557 static struct clk_pix_rdi csi_pix1_clk = {
563 .enable_reg = 0x0238,
564 .enable_mask = BIT(10),
565 .hw.init = &(struct clk_init_data){
566 .name = "csi_pix1_clk",
567 .parent_names = pix_rdi_parents,
569 .ops = &clk_ops_pix_rdi,
574 static struct clk_pix_rdi csi_rdi_clk = {
580 .enable_reg = 0x0058,
581 .enable_mask = BIT(13),
582 .hw.init = &(struct clk_init_data){
583 .name = "csi_rdi_clk",
584 .parent_names = pix_rdi_parents,
586 .ops = &clk_ops_pix_rdi,
591 static struct clk_pix_rdi csi_rdi1_clk = {
597 .enable_reg = 0x0238,
598 .enable_mask = BIT(2),
599 .hw.init = &(struct clk_init_data){
600 .name = "csi_rdi1_clk",
601 .parent_names = pix_rdi_parents,
603 .ops = &clk_ops_pix_rdi,
608 static struct clk_pix_rdi csi_rdi2_clk = {
614 .enable_reg = 0x0238,
615 .enable_mask = BIT(6),
616 .hw.init = &(struct clk_init_data){
617 .name = "csi_rdi2_clk",
618 .parent_names = pix_rdi_parents,
620 .ops = &clk_ops_pix_rdi,
625 static struct freq_tbl clk_tbl_csiphytimer[] = {
626 { 85330000, P_PLL8, 1, 2, 9 },
627 { 177780000, P_PLL2, 1, 2, 9 },
631 static struct clk_rcg csiphytimer_src = {
636 .mnctr_reset_bit = 8,
638 .mnctr_mode_shift = 6,
649 .parent_map = mmcc_pxo_pll8_pll2_map,
651 .freq_tbl = clk_tbl_csiphytimer,
653 .enable_reg = 0x0160,
654 .enable_mask = BIT(2),
655 .hw.init = &(struct clk_init_data){
656 .name = "csiphytimer_src",
657 .parent_names = mmcc_pxo_pll8_pll2,
664 static const char *csixphy_timer_src[] = { "csiphytimer_src" };
666 static struct clk_branch csiphy0_timer_clk = {
670 .enable_reg = 0x0160,
671 .enable_mask = BIT(0),
672 .hw.init = &(struct clk_init_data){
673 .parent_names = csixphy_timer_src,
675 .name = "csiphy0_timer_clk",
676 .ops = &clk_branch_ops,
677 .flags = CLK_SET_RATE_PARENT,
682 static struct clk_branch csiphy1_timer_clk = {
686 .enable_reg = 0x0160,
687 .enable_mask = BIT(9),
688 .hw.init = &(struct clk_init_data){
689 .parent_names = csixphy_timer_src,
691 .name = "csiphy1_timer_clk",
692 .ops = &clk_branch_ops,
693 .flags = CLK_SET_RATE_PARENT,
698 static struct clk_branch csiphy2_timer_clk = {
702 .enable_reg = 0x0160,
703 .enable_mask = BIT(11),
704 .hw.init = &(struct clk_init_data){
705 .parent_names = csixphy_timer_src,
707 .name = "csiphy2_timer_clk",
708 .ops = &clk_branch_ops,
709 .flags = CLK_SET_RATE_PARENT,
714 static struct freq_tbl clk_tbl_gfx2d[] = {
715 F_MN( 27000000, P_PXO, 1, 0),
716 F_MN( 48000000, P_PLL8, 1, 8),
717 F_MN( 54857000, P_PLL8, 1, 7),
718 F_MN( 64000000, P_PLL8, 1, 6),
719 F_MN( 76800000, P_PLL8, 1, 5),
720 F_MN( 96000000, P_PLL8, 1, 4),
721 F_MN(128000000, P_PLL8, 1, 3),
722 F_MN(145455000, P_PLL2, 2, 11),
723 F_MN(160000000, P_PLL2, 1, 5),
724 F_MN(177778000, P_PLL2, 2, 9),
725 F_MN(200000000, P_PLL2, 1, 4),
726 F_MN(228571000, P_PLL2, 2, 7),
730 static struct clk_dyn_rcg gfx2d0_src = {
736 .mnctr_reset_bit = 25,
737 .mnctr_mode_shift = 9,
744 .mnctr_reset_bit = 24,
745 .mnctr_mode_shift = 6,
752 .parent_map = mmcc_pxo_pll8_pll2_map,
756 .parent_map = mmcc_pxo_pll8_pll2_map,
759 .freq_tbl = clk_tbl_gfx2d,
761 .enable_reg = 0x0060,
762 .enable_mask = BIT(2),
763 .hw.init = &(struct clk_init_data){
764 .name = "gfx2d0_src",
765 .parent_names = mmcc_pxo_pll8_pll2,
767 .ops = &clk_dyn_rcg_ops,
772 static struct clk_branch gfx2d0_clk = {
776 .enable_reg = 0x0060,
777 .enable_mask = BIT(0),
778 .hw.init = &(struct clk_init_data){
779 .name = "gfx2d0_clk",
780 .parent_names = (const char *[]){ "gfx2d0_src" },
782 .ops = &clk_branch_ops,
783 .flags = CLK_SET_RATE_PARENT,
788 static struct clk_dyn_rcg gfx2d1_src = {
794 .mnctr_reset_bit = 25,
795 .mnctr_mode_shift = 9,
802 .mnctr_reset_bit = 24,
803 .mnctr_mode_shift = 6,
810 .parent_map = mmcc_pxo_pll8_pll2_map,
814 .parent_map = mmcc_pxo_pll8_pll2_map,
817 .freq_tbl = clk_tbl_gfx2d,
819 .enable_reg = 0x0074,
820 .enable_mask = BIT(2),
821 .hw.init = &(struct clk_init_data){
822 .name = "gfx2d1_src",
823 .parent_names = mmcc_pxo_pll8_pll2,
825 .ops = &clk_dyn_rcg_ops,
830 static struct clk_branch gfx2d1_clk = {
834 .enable_reg = 0x0074,
835 .enable_mask = BIT(0),
836 .hw.init = &(struct clk_init_data){
837 .name = "gfx2d1_clk",
838 .parent_names = (const char *[]){ "gfx2d1_src" },
840 .ops = &clk_branch_ops,
841 .flags = CLK_SET_RATE_PARENT,
846 static struct freq_tbl clk_tbl_gfx3d[] = {
847 F_MN( 27000000, P_PXO, 1, 0),
848 F_MN( 48000000, P_PLL8, 1, 8),
849 F_MN( 54857000, P_PLL8, 1, 7),
850 F_MN( 64000000, P_PLL8, 1, 6),
851 F_MN( 76800000, P_PLL8, 1, 5),
852 F_MN( 96000000, P_PLL8, 1, 4),
853 F_MN(128000000, P_PLL8, 1, 3),
854 F_MN(145455000, P_PLL2, 2, 11),
855 F_MN(160000000, P_PLL2, 1, 5),
856 F_MN(177778000, P_PLL2, 2, 9),
857 F_MN(200000000, P_PLL2, 1, 4),
858 F_MN(228571000, P_PLL2, 2, 7),
859 F_MN(266667000, P_PLL2, 1, 3),
860 F_MN(300000000, P_PLL3, 1, 4),
861 F_MN(320000000, P_PLL2, 2, 5),
862 F_MN(400000000, P_PLL2, 1, 2),
866 static struct clk_dyn_rcg gfx3d_src = {
872 .mnctr_reset_bit = 25,
873 .mnctr_mode_shift = 9,
880 .mnctr_reset_bit = 24,
881 .mnctr_mode_shift = 6,
888 .parent_map = mmcc_pxo_pll8_pll2_pll3_map,
892 .parent_map = mmcc_pxo_pll8_pll2_pll3_map,
895 .freq_tbl = clk_tbl_gfx3d,
897 .enable_reg = 0x0080,
898 .enable_mask = BIT(2),
899 .hw.init = &(struct clk_init_data){
901 .parent_names = mmcc_pxo_pll8_pll2_pll3,
903 .ops = &clk_dyn_rcg_ops,
908 static struct clk_branch gfx3d_clk = {
912 .enable_reg = 0x0080,
913 .enable_mask = BIT(0),
914 .hw.init = &(struct clk_init_data){
916 .parent_names = (const char *[]){ "gfx3d_src" },
918 .ops = &clk_branch_ops,
919 .flags = CLK_SET_RATE_PARENT,
924 static struct freq_tbl clk_tbl_ijpeg[] = {
925 { 27000000, P_PXO, 1, 0, 0 },
926 { 36570000, P_PLL8, 1, 2, 21 },
927 { 54860000, P_PLL8, 7, 0, 0 },
928 { 96000000, P_PLL8, 4, 0, 0 },
929 { 109710000, P_PLL8, 1, 2, 7 },
930 { 128000000, P_PLL8, 3, 0, 0 },
931 { 153600000, P_PLL8, 1, 2, 5 },
932 { 200000000, P_PLL2, 4, 0, 0 },
933 { 228571000, P_PLL2, 1, 2, 7 },
934 { 266667000, P_PLL2, 1, 1, 3 },
935 { 320000000, P_PLL2, 1, 2, 5 },
939 static struct clk_rcg ijpeg_src = {
944 .mnctr_reset_bit = 7,
945 .mnctr_mode_shift = 6,
956 .parent_map = mmcc_pxo_pll8_pll2_map,
958 .freq_tbl = clk_tbl_ijpeg,
960 .enable_reg = 0x0098,
961 .enable_mask = BIT(2),
962 .hw.init = &(struct clk_init_data){
964 .parent_names = mmcc_pxo_pll8_pll2,
971 static struct clk_branch ijpeg_clk = {
975 .enable_reg = 0x0098,
976 .enable_mask = BIT(0),
977 .hw.init = &(struct clk_init_data){
979 .parent_names = (const char *[]){ "ijpeg_src" },
981 .ops = &clk_branch_ops,
982 .flags = CLK_SET_RATE_PARENT,
987 static struct freq_tbl clk_tbl_jpegd[] = {
988 { 64000000, P_PLL8, 6 },
989 { 76800000, P_PLL8, 5 },
990 { 96000000, P_PLL8, 4 },
991 { 160000000, P_PLL2, 5 },
992 { 200000000, P_PLL2, 4 },
996 static struct clk_rcg jpegd_src = {
1004 .parent_map = mmcc_pxo_pll8_pll2_map,
1006 .freq_tbl = clk_tbl_jpegd,
1008 .enable_reg = 0x00a4,
1009 .enable_mask = BIT(2),
1010 .hw.init = &(struct clk_init_data){
1011 .name = "jpegd_src",
1012 .parent_names = mmcc_pxo_pll8_pll2,
1014 .ops = &clk_rcg_ops,
1019 static struct clk_branch jpegd_clk = {
1023 .enable_reg = 0x00a4,
1024 .enable_mask = BIT(0),
1025 .hw.init = &(struct clk_init_data){
1026 .name = "jpegd_clk",
1027 .parent_names = (const char *[]){ "jpegd_src" },
1029 .ops = &clk_branch_ops,
1030 .flags = CLK_SET_RATE_PARENT,
1035 static struct freq_tbl clk_tbl_mdp[] = {
1036 { 9600000, P_PLL8, 1, 1, 40 },
1037 { 13710000, P_PLL8, 1, 1, 28 },
1038 { 27000000, P_PXO, 1, 0, 0 },
1039 { 29540000, P_PLL8, 1, 1, 13 },
1040 { 34910000, P_PLL8, 1, 1, 11 },
1041 { 38400000, P_PLL8, 1, 1, 10 },
1042 { 59080000, P_PLL8, 1, 2, 13 },
1043 { 76800000, P_PLL8, 1, 1, 5 },
1044 { 85330000, P_PLL8, 1, 2, 9 },
1045 { 96000000, P_PLL8, 1, 1, 4 },
1046 { 128000000, P_PLL8, 1, 1, 3 },
1047 { 160000000, P_PLL2, 1, 1, 5 },
1048 { 177780000, P_PLL2, 1, 2, 9 },
1049 { 200000000, P_PLL2, 1, 1, 4 },
1050 { 228571000, P_PLL2, 1, 2, 7 },
1051 { 266667000, P_PLL2, 1, 1, 3 },
1055 static struct clk_dyn_rcg mdp_src = {
1057 .md_reg[0] = 0x00c4,
1058 .md_reg[1] = 0x00c8,
1061 .mnctr_reset_bit = 31,
1062 .mnctr_mode_shift = 9,
1069 .mnctr_reset_bit = 30,
1070 .mnctr_mode_shift = 6,
1077 .parent_map = mmcc_pxo_pll8_pll2_map,
1081 .parent_map = mmcc_pxo_pll8_pll2_map,
1084 .freq_tbl = clk_tbl_mdp,
1086 .enable_reg = 0x00c0,
1087 .enable_mask = BIT(2),
1088 .hw.init = &(struct clk_init_data){
1090 .parent_names = mmcc_pxo_pll8_pll2,
1092 .ops = &clk_dyn_rcg_ops,
1097 static struct clk_branch mdp_clk = {
1101 .enable_reg = 0x00c0,
1102 .enable_mask = BIT(0),
1103 .hw.init = &(struct clk_init_data){
1105 .parent_names = (const char *[]){ "mdp_src" },
1107 .ops = &clk_branch_ops,
1108 .flags = CLK_SET_RATE_PARENT,
1113 static struct clk_branch mdp_lut_clk = {
1117 .enable_reg = 0x016c,
1118 .enable_mask = BIT(0),
1119 .hw.init = &(struct clk_init_data){
1120 .parent_names = (const char *[]){ "mdp_src" },
1122 .name = "mdp_lut_clk",
1123 .ops = &clk_branch_ops,
1124 .flags = CLK_SET_RATE_PARENT,
1129 static struct clk_branch mdp_vsync_clk = {
1133 .enable_reg = 0x0058,
1134 .enable_mask = BIT(6),
1135 .hw.init = &(struct clk_init_data){
1136 .name = "mdp_vsync_clk",
1137 .parent_names = (const char *[]){ "pxo" },
1139 .ops = &clk_branch_ops
1144 static struct freq_tbl clk_tbl_rot[] = {
1145 { 27000000, P_PXO, 1 },
1146 { 29540000, P_PLL8, 13 },
1147 { 32000000, P_PLL8, 12 },
1148 { 38400000, P_PLL8, 10 },
1149 { 48000000, P_PLL8, 8 },
1150 { 54860000, P_PLL8, 7 },
1151 { 64000000, P_PLL8, 6 },
1152 { 76800000, P_PLL8, 5 },
1153 { 96000000, P_PLL8, 4 },
1154 { 100000000, P_PLL2, 8 },
1155 { 114290000, P_PLL2, 7 },
1156 { 133330000, P_PLL2, 6 },
1157 { 160000000, P_PLL2, 5 },
1158 { 200000000, P_PLL2, 4 },
1162 static struct clk_dyn_rcg rot_src = {
1165 .pre_div_shift = 22,
1169 .pre_div_shift = 26,
1173 .src_sel_shift = 16,
1174 .parent_map = mmcc_pxo_pll8_pll2_map,
1177 .src_sel_shift = 19,
1178 .parent_map = mmcc_pxo_pll8_pll2_map,
1181 .freq_tbl = clk_tbl_rot,
1183 .enable_reg = 0x00e0,
1184 .enable_mask = BIT(2),
1185 .hw.init = &(struct clk_init_data){
1187 .parent_names = mmcc_pxo_pll8_pll2,
1189 .ops = &clk_dyn_rcg_ops,
1194 static struct clk_branch rot_clk = {
1198 .enable_reg = 0x00e0,
1199 .enable_mask = BIT(0),
1200 .hw.init = &(struct clk_init_data){
1202 .parent_names = (const char *[]){ "rot_src" },
1204 .ops = &clk_branch_ops,
1205 .flags = CLK_SET_RATE_PARENT,
1210 #define P_HDMI_PLL 1
1212 static u8 mmcc_pxo_hdmi_map[] = {
1217 static const char *mmcc_pxo_hdmi[] = {
1222 static struct freq_tbl clk_tbl_tv[] = {
1223 { 25200000, P_HDMI_PLL, 1, 0, 0 },
1224 { 27000000, P_HDMI_PLL, 1, 0, 0 },
1225 { 27030000, P_HDMI_PLL, 1, 0, 0 },
1226 { 74250000, P_HDMI_PLL, 1, 0, 0 },
1227 { 108000000, P_HDMI_PLL, 1, 0, 0 },
1228 { 148500000, P_HDMI_PLL, 1, 0, 0 },
1232 static struct clk_rcg tv_src = {
1237 .mnctr_reset_bit = 7,
1238 .mnctr_mode_shift = 6,
1244 .pre_div_shift = 14,
1249 .parent_map = mmcc_pxo_hdmi_map,
1251 .freq_tbl = clk_tbl_tv,
1253 .enable_reg = 0x00ec,
1254 .enable_mask = BIT(2),
1255 .hw.init = &(struct clk_init_data){
1257 .parent_names = mmcc_pxo_hdmi,
1259 .ops = &clk_rcg_ops,
1260 .flags = CLK_SET_RATE_PARENT,
1265 static const char *tv_src_name[] = { "tv_src" };
1267 static struct clk_branch tv_enc_clk = {
1271 .enable_reg = 0x00ec,
1272 .enable_mask = BIT(8),
1273 .hw.init = &(struct clk_init_data){
1274 .parent_names = tv_src_name,
1276 .name = "tv_enc_clk",
1277 .ops = &clk_branch_ops,
1278 .flags = CLK_SET_RATE_PARENT,
1283 static struct clk_branch tv_dac_clk = {
1287 .enable_reg = 0x00ec,
1288 .enable_mask = BIT(10),
1289 .hw.init = &(struct clk_init_data){
1290 .parent_names = tv_src_name,
1292 .name = "tv_dac_clk",
1293 .ops = &clk_branch_ops,
1294 .flags = CLK_SET_RATE_PARENT,
1299 static struct clk_branch mdp_tv_clk = {
1303 .enable_reg = 0x00ec,
1304 .enable_mask = BIT(0),
1305 .hw.init = &(struct clk_init_data){
1306 .parent_names = tv_src_name,
1308 .name = "mdp_tv_clk",
1309 .ops = &clk_branch_ops,
1310 .flags = CLK_SET_RATE_PARENT,
1315 static struct clk_branch hdmi_tv_clk = {
1319 .enable_reg = 0x00ec,
1320 .enable_mask = BIT(12),
1321 .hw.init = &(struct clk_init_data){
1322 .parent_names = tv_src_name,
1324 .name = "hdmi_tv_clk",
1325 .ops = &clk_branch_ops,
1326 .flags = CLK_SET_RATE_PARENT,
1331 static struct clk_branch hdmi_app_clk = {
1335 .enable_reg = 0x005c,
1336 .enable_mask = BIT(11),
1337 .hw.init = &(struct clk_init_data){
1338 .parent_names = (const char *[]){ "pxo" },
1340 .name = "hdmi_app_clk",
1341 .ops = &clk_branch_ops,
1346 static struct freq_tbl clk_tbl_vcodec[] = {
1347 F_MN( 27000000, P_PXO, 1, 0),
1348 F_MN( 32000000, P_PLL8, 1, 12),
1349 F_MN( 48000000, P_PLL8, 1, 8),
1350 F_MN( 54860000, P_PLL8, 1, 7),
1351 F_MN( 96000000, P_PLL8, 1, 4),
1352 F_MN(133330000, P_PLL2, 1, 6),
1353 F_MN(200000000, P_PLL2, 1, 4),
1354 F_MN(228570000, P_PLL2, 2, 7),
1355 F_MN(266670000, P_PLL2, 1, 3),
1359 static struct clk_dyn_rcg vcodec_src = {
1361 .md_reg[0] = 0x00fc,
1362 .md_reg[1] = 0x0128,
1365 .mnctr_reset_bit = 31,
1366 .mnctr_mode_shift = 6,
1373 .mnctr_reset_bit = 30,
1374 .mnctr_mode_shift = 11,
1380 .src_sel_shift = 27,
1381 .parent_map = mmcc_pxo_pll8_pll2_map,
1385 .parent_map = mmcc_pxo_pll8_pll2_map,
1388 .freq_tbl = clk_tbl_vcodec,
1390 .enable_reg = 0x00f8,
1391 .enable_mask = BIT(2),
1392 .hw.init = &(struct clk_init_data){
1393 .name = "vcodec_src",
1394 .parent_names = mmcc_pxo_pll8_pll2,
1396 .ops = &clk_dyn_rcg_ops,
1401 static struct clk_branch vcodec_clk = {
1405 .enable_reg = 0x00f8,
1406 .enable_mask = BIT(0),
1407 .hw.init = &(struct clk_init_data){
1408 .name = "vcodec_clk",
1409 .parent_names = (const char *[]){ "vcodec_src" },
1411 .ops = &clk_branch_ops,
1412 .flags = CLK_SET_RATE_PARENT,
1417 static struct freq_tbl clk_tbl_vpe[] = {
1418 { 27000000, P_PXO, 1 },
1419 { 34909000, P_PLL8, 11 },
1420 { 38400000, P_PLL8, 10 },
1421 { 64000000, P_PLL8, 6 },
1422 { 76800000, P_PLL8, 5 },
1423 { 96000000, P_PLL8, 4 },
1424 { 100000000, P_PLL2, 8 },
1425 { 160000000, P_PLL2, 5 },
1429 static struct clk_rcg vpe_src = {
1432 .pre_div_shift = 12,
1437 .parent_map = mmcc_pxo_pll8_pll2_map,
1439 .freq_tbl = clk_tbl_vpe,
1441 .enable_reg = 0x0110,
1442 .enable_mask = BIT(2),
1443 .hw.init = &(struct clk_init_data){
1445 .parent_names = mmcc_pxo_pll8_pll2,
1447 .ops = &clk_rcg_ops,
1452 static struct clk_branch vpe_clk = {
1456 .enable_reg = 0x0110,
1457 .enable_mask = BIT(0),
1458 .hw.init = &(struct clk_init_data){
1460 .parent_names = (const char *[]){ "vpe_src" },
1462 .ops = &clk_branch_ops,
1463 .flags = CLK_SET_RATE_PARENT,
1468 static struct freq_tbl clk_tbl_vfe[] = {
1469 { 13960000, P_PLL8, 1, 2, 55 },
1470 { 27000000, P_PXO, 1, 0, 0 },
1471 { 36570000, P_PLL8, 1, 2, 21 },
1472 { 38400000, P_PLL8, 2, 1, 5 },
1473 { 45180000, P_PLL8, 1, 2, 17 },
1474 { 48000000, P_PLL8, 2, 1, 4 },
1475 { 54860000, P_PLL8, 1, 1, 7 },
1476 { 64000000, P_PLL8, 2, 1, 3 },
1477 { 76800000, P_PLL8, 1, 1, 5 },
1478 { 96000000, P_PLL8, 2, 1, 2 },
1479 { 109710000, P_PLL8, 1, 2, 7 },
1480 { 128000000, P_PLL8, 1, 1, 3 },
1481 { 153600000, P_PLL8, 1, 2, 5 },
1482 { 200000000, P_PLL2, 2, 1, 2 },
1483 { 228570000, P_PLL2, 1, 2, 7 },
1484 { 266667000, P_PLL2, 1, 1, 3 },
1485 { 320000000, P_PLL2, 1, 2, 5 },
1489 static struct clk_rcg vfe_src = {
1493 .mnctr_reset_bit = 7,
1494 .mnctr_mode_shift = 6,
1500 .pre_div_shift = 10,
1505 .parent_map = mmcc_pxo_pll8_pll2_map,
1507 .freq_tbl = clk_tbl_vfe,
1509 .enable_reg = 0x0104,
1510 .enable_mask = BIT(2),
1511 .hw.init = &(struct clk_init_data){
1513 .parent_names = mmcc_pxo_pll8_pll2,
1515 .ops = &clk_rcg_ops,
1520 static struct clk_branch vfe_clk = {
1524 .enable_reg = 0x0104,
1525 .enable_mask = BIT(0),
1526 .hw.init = &(struct clk_init_data){
1528 .parent_names = (const char *[]){ "vfe_src" },
1530 .ops = &clk_branch_ops,
1531 .flags = CLK_SET_RATE_PARENT,
1536 static struct clk_branch vfe_csi_clk = {
1540 .enable_reg = 0x0104,
1541 .enable_mask = BIT(12),
1542 .hw.init = &(struct clk_init_data){
1543 .parent_names = (const char *[]){ "vfe_src" },
1545 .name = "vfe_csi_clk",
1546 .ops = &clk_branch_ops,
1547 .flags = CLK_SET_RATE_PARENT,
1552 static struct clk_branch gmem_axi_clk = {
1556 .enable_reg = 0x0018,
1557 .enable_mask = BIT(24),
1558 .hw.init = &(struct clk_init_data){
1559 .name = "gmem_axi_clk",
1560 .ops = &clk_branch_ops,
1561 .flags = CLK_IS_ROOT,
1566 static struct clk_branch ijpeg_axi_clk = {
1572 .enable_reg = 0x0018,
1573 .enable_mask = BIT(21),
1574 .hw.init = &(struct clk_init_data){
1575 .name = "ijpeg_axi_clk",
1576 .ops = &clk_branch_ops,
1577 .flags = CLK_IS_ROOT,
1582 static struct clk_branch mmss_imem_axi_clk = {
1588 .enable_reg = 0x0018,
1589 .enable_mask = BIT(22),
1590 .hw.init = &(struct clk_init_data){
1591 .name = "mmss_imem_axi_clk",
1592 .ops = &clk_branch_ops,
1593 .flags = CLK_IS_ROOT,
1598 static struct clk_branch jpegd_axi_clk = {
1602 .enable_reg = 0x0018,
1603 .enable_mask = BIT(25),
1604 .hw.init = &(struct clk_init_data){
1605 .name = "jpegd_axi_clk",
1606 .ops = &clk_branch_ops,
1607 .flags = CLK_IS_ROOT,
1612 static struct clk_branch vcodec_axi_b_clk = {
1618 .enable_reg = 0x0114,
1619 .enable_mask = BIT(23),
1620 .hw.init = &(struct clk_init_data){
1621 .name = "vcodec_axi_b_clk",
1622 .ops = &clk_branch_ops,
1623 .flags = CLK_IS_ROOT,
1628 static struct clk_branch vcodec_axi_a_clk = {
1634 .enable_reg = 0x0114,
1635 .enable_mask = BIT(25),
1636 .hw.init = &(struct clk_init_data){
1637 .name = "vcodec_axi_a_clk",
1638 .ops = &clk_branch_ops,
1639 .flags = CLK_IS_ROOT,
1644 static struct clk_branch vcodec_axi_clk = {
1650 .enable_reg = 0x0018,
1651 .enable_mask = BIT(19),
1652 .hw.init = &(struct clk_init_data){
1653 .name = "vcodec_axi_clk",
1654 .ops = &clk_branch_ops,
1655 .flags = CLK_IS_ROOT,
1660 static struct clk_branch vfe_axi_clk = {
1664 .enable_reg = 0x0018,
1665 .enable_mask = BIT(18),
1666 .hw.init = &(struct clk_init_data){
1667 .name = "vfe_axi_clk",
1668 .ops = &clk_branch_ops,
1669 .flags = CLK_IS_ROOT,
1674 static struct clk_branch mdp_axi_clk = {
1680 .enable_reg = 0x0018,
1681 .enable_mask = BIT(23),
1682 .hw.init = &(struct clk_init_data){
1683 .name = "mdp_axi_clk",
1684 .ops = &clk_branch_ops,
1685 .flags = CLK_IS_ROOT,
1690 static struct clk_branch rot_axi_clk = {
1696 .enable_reg = 0x0020,
1697 .enable_mask = BIT(24),
1698 .hw.init = &(struct clk_init_data){
1699 .name = "rot_axi_clk",
1700 .ops = &clk_branch_ops,
1701 .flags = CLK_IS_ROOT,
1706 static struct clk_branch vpe_axi_clk = {
1712 .enable_reg = 0x0020,
1713 .enable_mask = BIT(26),
1714 .hw.init = &(struct clk_init_data){
1715 .name = "vpe_axi_clk",
1716 .ops = &clk_branch_ops,
1717 .flags = CLK_IS_ROOT,
1722 static struct clk_branch gfx3d_axi_clk = {
1728 .enable_reg = 0x0244,
1729 .enable_mask = BIT(25),
1730 .hw.init = &(struct clk_init_data){
1731 .name = "gfx3d_axi_clk",
1732 .ops = &clk_branch_ops,
1733 .flags = CLK_IS_ROOT,
1738 static struct clk_branch amp_ahb_clk = {
1742 .enable_reg = 0x0008,
1743 .enable_mask = BIT(24),
1744 .hw.init = &(struct clk_init_data){
1745 .name = "amp_ahb_clk",
1746 .ops = &clk_branch_ops,
1747 .flags = CLK_IS_ROOT,
1752 static struct clk_branch csi_ahb_clk = {
1756 .enable_reg = 0x0008,
1757 .enable_mask = BIT(7),
1758 .hw.init = &(struct clk_init_data){
1759 .name = "csi_ahb_clk",
1760 .ops = &clk_branch_ops,
1761 .flags = CLK_IS_ROOT
1766 static struct clk_branch dsi_m_ahb_clk = {
1770 .enable_reg = 0x0008,
1771 .enable_mask = BIT(9),
1772 .hw.init = &(struct clk_init_data){
1773 .name = "dsi_m_ahb_clk",
1774 .ops = &clk_branch_ops,
1775 .flags = CLK_IS_ROOT,
1780 static struct clk_branch dsi_s_ahb_clk = {
1786 .enable_reg = 0x0008,
1787 .enable_mask = BIT(18),
1788 .hw.init = &(struct clk_init_data){
1789 .name = "dsi_s_ahb_clk",
1790 .ops = &clk_branch_ops,
1791 .flags = CLK_IS_ROOT,
1796 static struct clk_branch dsi2_m_ahb_clk = {
1800 .enable_reg = 0x0008,
1801 .enable_mask = BIT(17),
1802 .hw.init = &(struct clk_init_data){
1803 .name = "dsi2_m_ahb_clk",
1804 .ops = &clk_branch_ops,
1805 .flags = CLK_IS_ROOT
1810 static struct clk_branch dsi2_s_ahb_clk = {
1816 .enable_reg = 0x0008,
1817 .enable_mask = BIT(22),
1818 .hw.init = &(struct clk_init_data){
1819 .name = "dsi2_s_ahb_clk",
1820 .ops = &clk_branch_ops,
1821 .flags = CLK_IS_ROOT,
1826 static struct clk_branch gfx2d0_ahb_clk = {
1832 .enable_reg = 0x0008,
1833 .enable_mask = BIT(19),
1834 .hw.init = &(struct clk_init_data){
1835 .name = "gfx2d0_ahb_clk",
1836 .ops = &clk_branch_ops,
1837 .flags = CLK_IS_ROOT,
1842 static struct clk_branch gfx2d1_ahb_clk = {
1848 .enable_reg = 0x0008,
1849 .enable_mask = BIT(2),
1850 .hw.init = &(struct clk_init_data){
1851 .name = "gfx2d1_ahb_clk",
1852 .ops = &clk_branch_ops,
1853 .flags = CLK_IS_ROOT,
1858 static struct clk_branch gfx3d_ahb_clk = {
1864 .enable_reg = 0x0008,
1865 .enable_mask = BIT(3),
1866 .hw.init = &(struct clk_init_data){
1867 .name = "gfx3d_ahb_clk",
1868 .ops = &clk_branch_ops,
1869 .flags = CLK_IS_ROOT,
1874 static struct clk_branch hdmi_m_ahb_clk = {
1880 .enable_reg = 0x0008,
1881 .enable_mask = BIT(14),
1882 .hw.init = &(struct clk_init_data){
1883 .name = "hdmi_m_ahb_clk",
1884 .ops = &clk_branch_ops,
1885 .flags = CLK_IS_ROOT,
1890 static struct clk_branch hdmi_s_ahb_clk = {
1896 .enable_reg = 0x0008,
1897 .enable_mask = BIT(4),
1898 .hw.init = &(struct clk_init_data){
1899 .name = "hdmi_s_ahb_clk",
1900 .ops = &clk_branch_ops,
1901 .flags = CLK_IS_ROOT,
1906 static struct clk_branch ijpeg_ahb_clk = {
1910 .enable_reg = 0x0008,
1911 .enable_mask = BIT(5),
1912 .hw.init = &(struct clk_init_data){
1913 .name = "ijpeg_ahb_clk",
1914 .ops = &clk_branch_ops,
1915 .flags = CLK_IS_ROOT
1920 static struct clk_branch mmss_imem_ahb_clk = {
1926 .enable_reg = 0x0008,
1927 .enable_mask = BIT(6),
1928 .hw.init = &(struct clk_init_data){
1929 .name = "mmss_imem_ahb_clk",
1930 .ops = &clk_branch_ops,
1931 .flags = CLK_IS_ROOT
1936 static struct clk_branch jpegd_ahb_clk = {
1940 .enable_reg = 0x0008,
1941 .enable_mask = BIT(21),
1942 .hw.init = &(struct clk_init_data){
1943 .name = "jpegd_ahb_clk",
1944 .ops = &clk_branch_ops,
1945 .flags = CLK_IS_ROOT,
1950 static struct clk_branch mdp_ahb_clk = {
1954 .enable_reg = 0x0008,
1955 .enable_mask = BIT(10),
1956 .hw.init = &(struct clk_init_data){
1957 .name = "mdp_ahb_clk",
1958 .ops = &clk_branch_ops,
1959 .flags = CLK_IS_ROOT,
1964 static struct clk_branch rot_ahb_clk = {
1968 .enable_reg = 0x0008,
1969 .enable_mask = BIT(12),
1970 .hw.init = &(struct clk_init_data){
1971 .name = "rot_ahb_clk",
1972 .ops = &clk_branch_ops,
1973 .flags = CLK_IS_ROOT
1978 static struct clk_branch smmu_ahb_clk = {
1984 .enable_reg = 0x0008,
1985 .enable_mask = BIT(15),
1986 .hw.init = &(struct clk_init_data){
1987 .name = "smmu_ahb_clk",
1988 .ops = &clk_branch_ops,
1989 .flags = CLK_IS_ROOT,
1994 static struct clk_branch tv_enc_ahb_clk = {
1998 .enable_reg = 0x0008,
1999 .enable_mask = BIT(25),
2000 .hw.init = &(struct clk_init_data){
2001 .name = "tv_enc_ahb_clk",
2002 .ops = &clk_branch_ops,
2003 .flags = CLK_IS_ROOT,
2008 static struct clk_branch vcodec_ahb_clk = {
2014 .enable_reg = 0x0008,
2015 .enable_mask = BIT(11),
2016 .hw.init = &(struct clk_init_data){
2017 .name = "vcodec_ahb_clk",
2018 .ops = &clk_branch_ops,
2019 .flags = CLK_IS_ROOT,
2024 static struct clk_branch vfe_ahb_clk = {
2028 .enable_reg = 0x0008,
2029 .enable_mask = BIT(13),
2030 .hw.init = &(struct clk_init_data){
2031 .name = "vfe_ahb_clk",
2032 .ops = &clk_branch_ops,
2033 .flags = CLK_IS_ROOT,
2038 static struct clk_branch vpe_ahb_clk = {
2042 .enable_reg = 0x0008,
2043 .enable_mask = BIT(16),
2044 .hw.init = &(struct clk_init_data){
2045 .name = "vpe_ahb_clk",
2046 .ops = &clk_branch_ops,
2047 .flags = CLK_IS_ROOT,
2052 static struct clk_regmap *mmcc_msm8960_clks[] = {
2053 [TV_ENC_AHB_CLK] = &tv_enc_ahb_clk.clkr,
2054 [AMP_AHB_CLK] = &_ahb_clk.clkr,
2055 [DSI2_S_AHB_CLK] = &dsi2_s_ahb_clk.clkr,
2056 [JPEGD_AHB_CLK] = &jpegd_ahb_clk.clkr,
2057 [GFX2D0_AHB_CLK] = &gfx2d0_ahb_clk.clkr,
2058 [DSI_S_AHB_CLK] = &dsi_s_ahb_clk.clkr,
2059 [DSI2_M_AHB_CLK] = &dsi2_m_ahb_clk.clkr,
2060 [VPE_AHB_CLK] = &vpe_ahb_clk.clkr,
2061 [SMMU_AHB_CLK] = &smmu_ahb_clk.clkr,
2062 [HDMI_M_AHB_CLK] = &hdmi_m_ahb_clk.clkr,
2063 [VFE_AHB_CLK] = &vfe_ahb_clk.clkr,
2064 [ROT_AHB_CLK] = &rot_ahb_clk.clkr,
2065 [VCODEC_AHB_CLK] = &vcodec_ahb_clk.clkr,
2066 [MDP_AHB_CLK] = &mdp_ahb_clk.clkr,
2067 [DSI_M_AHB_CLK] = &dsi_m_ahb_clk.clkr,
2068 [CSI_AHB_CLK] = &csi_ahb_clk.clkr,
2069 [MMSS_IMEM_AHB_CLK] = &mmss_imem_ahb_clk.clkr,
2070 [IJPEG_AHB_CLK] = &ijpeg_ahb_clk.clkr,
2071 [HDMI_S_AHB_CLK] = &hdmi_s_ahb_clk.clkr,
2072 [GFX3D_AHB_CLK] = &gfx3d_ahb_clk.clkr,
2073 [GFX2D1_AHB_CLK] = &gfx2d1_ahb_clk.clkr,
2074 [JPEGD_AXI_CLK] = &jpegd_axi_clk.clkr,
2075 [GMEM_AXI_CLK] = &gmem_axi_clk.clkr,
2076 [MDP_AXI_CLK] = &mdp_axi_clk.clkr,
2077 [MMSS_IMEM_AXI_CLK] = &mmss_imem_axi_clk.clkr,
2078 [IJPEG_AXI_CLK] = &ijpeg_axi_clk.clkr,
2079 [GFX3D_AXI_CLK] = &gfx3d_axi_clk.clkr,
2080 [VCODEC_AXI_CLK] = &vcodec_axi_clk.clkr,
2081 [VFE_AXI_CLK] = &vfe_axi_clk.clkr,
2082 [VPE_AXI_CLK] = &vpe_axi_clk.clkr,
2083 [ROT_AXI_CLK] = &rot_axi_clk.clkr,
2084 [VCODEC_AXI_A_CLK] = &vcodec_axi_a_clk.clkr,
2085 [VCODEC_AXI_B_CLK] = &vcodec_axi_b_clk.clkr,
2086 [CSI0_SRC] = &csi0_src.clkr,
2087 [CSI0_CLK] = &csi0_clk.clkr,
2088 [CSI0_PHY_CLK] = &csi0_phy_clk.clkr,
2089 [CSI1_SRC] = &csi1_src.clkr,
2090 [CSI1_CLK] = &csi1_clk.clkr,
2091 [CSI1_PHY_CLK] = &csi1_phy_clk.clkr,
2092 [CSI2_SRC] = &csi2_src.clkr,
2093 [CSI2_CLK] = &csi2_clk.clkr,
2094 [CSI2_PHY_CLK] = &csi2_phy_clk.clkr,
2095 [CSI_PIX_CLK] = &csi_pix_clk.clkr,
2096 [CSI_RDI_CLK] = &csi_rdi_clk.clkr,
2097 [MDP_VSYNC_CLK] = &mdp_vsync_clk.clkr,
2098 [HDMI_APP_CLK] = &hdmi_app_clk.clkr,
2099 [CSI_PIX1_CLK] = &csi_pix1_clk.clkr,
2100 [CSI_RDI2_CLK] = &csi_rdi2_clk.clkr,
2101 [CSI_RDI1_CLK] = &csi_rdi1_clk.clkr,
2102 [GFX2D0_SRC] = &gfx2d0_src.clkr,
2103 [GFX2D0_CLK] = &gfx2d0_clk.clkr,
2104 [GFX2D1_SRC] = &gfx2d1_src.clkr,
2105 [GFX2D1_CLK] = &gfx2d1_clk.clkr,
2106 [GFX3D_SRC] = &gfx3d_src.clkr,
2107 [GFX3D_CLK] = &gfx3d_clk.clkr,
2108 [IJPEG_SRC] = &ijpeg_src.clkr,
2109 [IJPEG_CLK] = &ijpeg_clk.clkr,
2110 [JPEGD_SRC] = &jpegd_src.clkr,
2111 [JPEGD_CLK] = &jpegd_clk.clkr,
2112 [MDP_SRC] = &mdp_src.clkr,
2113 [MDP_CLK] = &mdp_clk.clkr,
2114 [MDP_LUT_CLK] = &mdp_lut_clk.clkr,
2115 [ROT_SRC] = &rot_src.clkr,
2116 [ROT_CLK] = &rot_clk.clkr,
2117 [TV_ENC_CLK] = &tv_enc_clk.clkr,
2118 [TV_DAC_CLK] = &tv_dac_clk.clkr,
2119 [HDMI_TV_CLK] = &hdmi_tv_clk.clkr,
2120 [MDP_TV_CLK] = &mdp_tv_clk.clkr,
2121 [TV_SRC] = &tv_src.clkr,
2122 [VCODEC_SRC] = &vcodec_src.clkr,
2123 [VCODEC_CLK] = &vcodec_clk.clkr,
2124 [VFE_SRC] = &vfe_src.clkr,
2125 [VFE_CLK] = &vfe_clk.clkr,
2126 [VFE_CSI_CLK] = &vfe_csi_clk.clkr,
2127 [VPE_SRC] = &vpe_src.clkr,
2128 [VPE_CLK] = &vpe_clk.clkr,
2129 [CAMCLK0_SRC] = &camclk0_src.clkr,
2130 [CAMCLK0_CLK] = &camclk0_clk.clkr,
2131 [CAMCLK1_SRC] = &camclk1_src.clkr,
2132 [CAMCLK1_CLK] = &camclk1_clk.clkr,
2133 [CAMCLK2_SRC] = &camclk2_src.clkr,
2134 [CAMCLK2_CLK] = &camclk2_clk.clkr,
2135 [CSIPHYTIMER_SRC] = &csiphytimer_src.clkr,
2136 [CSIPHY2_TIMER_CLK] = &csiphy2_timer_clk.clkr,
2137 [CSIPHY1_TIMER_CLK] = &csiphy1_timer_clk.clkr,
2138 [CSIPHY0_TIMER_CLK] = &csiphy0_timer_clk.clkr,
2139 [PLL2] = &pll2.clkr,
2142 static const struct qcom_reset_map mmcc_msm8960_resets[] = {
2143 [VPE_AXI_RESET] = { 0x0208, 15 },
2144 [IJPEG_AXI_RESET] = { 0x0208, 14 },
2145 [MPD_AXI_RESET] = { 0x0208, 13 },
2146 [VFE_AXI_RESET] = { 0x0208, 9 },
2147 [SP_AXI_RESET] = { 0x0208, 8 },
2148 [VCODEC_AXI_RESET] = { 0x0208, 7 },
2149 [ROT_AXI_RESET] = { 0x0208, 6 },
2150 [VCODEC_AXI_A_RESET] = { 0x0208, 5 },
2151 [VCODEC_AXI_B_RESET] = { 0x0208, 4 },
2152 [FAB_S3_AXI_RESET] = { 0x0208, 3 },
2153 [FAB_S2_AXI_RESET] = { 0x0208, 2 },
2154 [FAB_S1_AXI_RESET] = { 0x0208, 1 },
2155 [FAB_S0_AXI_RESET] = { 0x0208 },
2156 [SMMU_GFX3D_ABH_RESET] = { 0x020c, 31 },
2157 [SMMU_VPE_AHB_RESET] = { 0x020c, 30 },
2158 [SMMU_VFE_AHB_RESET] = { 0x020c, 29 },
2159 [SMMU_ROT_AHB_RESET] = { 0x020c, 28 },
2160 [SMMU_VCODEC_B_AHB_RESET] = { 0x020c, 27 },
2161 [SMMU_VCODEC_A_AHB_RESET] = { 0x020c, 26 },
2162 [SMMU_MDP1_AHB_RESET] = { 0x020c, 25 },
2163 [SMMU_MDP0_AHB_RESET] = { 0x020c, 24 },
2164 [SMMU_JPEGD_AHB_RESET] = { 0x020c, 23 },
2165 [SMMU_IJPEG_AHB_RESET] = { 0x020c, 22 },
2166 [SMMU_GFX2D0_AHB_RESET] = { 0x020c, 21 },
2167 [SMMU_GFX2D1_AHB_RESET] = { 0x020c, 20 },
2168 [APU_AHB_RESET] = { 0x020c, 18 },
2169 [CSI_AHB_RESET] = { 0x020c, 17 },
2170 [TV_ENC_AHB_RESET] = { 0x020c, 15 },
2171 [VPE_AHB_RESET] = { 0x020c, 14 },
2172 [FABRIC_AHB_RESET] = { 0x020c, 13 },
2173 [GFX2D0_AHB_RESET] = { 0x020c, 12 },
2174 [GFX2D1_AHB_RESET] = { 0x020c, 11 },
2175 [GFX3D_AHB_RESET] = { 0x020c, 10 },
2176 [HDMI_AHB_RESET] = { 0x020c, 9 },
2177 [MSSS_IMEM_AHB_RESET] = { 0x020c, 8 },
2178 [IJPEG_AHB_RESET] = { 0x020c, 7 },
2179 [DSI_M_AHB_RESET] = { 0x020c, 6 },
2180 [DSI_S_AHB_RESET] = { 0x020c, 5 },
2181 [JPEGD_AHB_RESET] = { 0x020c, 4 },
2182 [MDP_AHB_RESET] = { 0x020c, 3 },
2183 [ROT_AHB_RESET] = { 0x020c, 2 },
2184 [VCODEC_AHB_RESET] = { 0x020c, 1 },
2185 [VFE_AHB_RESET] = { 0x020c, 0 },
2186 [DSI2_M_AHB_RESET] = { 0x0210, 31 },
2187 [DSI2_S_AHB_RESET] = { 0x0210, 30 },
2188 [CSIPHY2_RESET] = { 0x0210, 29 },
2189 [CSI_PIX1_RESET] = { 0x0210, 28 },
2190 [CSIPHY0_RESET] = { 0x0210, 27 },
2191 [CSIPHY1_RESET] = { 0x0210, 26 },
2192 [DSI2_RESET] = { 0x0210, 25 },
2193 [VFE_CSI_RESET] = { 0x0210, 24 },
2194 [MDP_RESET] = { 0x0210, 21 },
2195 [AMP_RESET] = { 0x0210, 20 },
2196 [JPEGD_RESET] = { 0x0210, 19 },
2197 [CSI1_RESET] = { 0x0210, 18 },
2198 [VPE_RESET] = { 0x0210, 17 },
2199 [MMSS_FABRIC_RESET] = { 0x0210, 16 },
2200 [VFE_RESET] = { 0x0210, 15 },
2201 [GFX2D0_RESET] = { 0x0210, 14 },
2202 [GFX2D1_RESET] = { 0x0210, 13 },
2203 [GFX3D_RESET] = { 0x0210, 12 },
2204 [HDMI_RESET] = { 0x0210, 11 },
2205 [MMSS_IMEM_RESET] = { 0x0210, 10 },
2206 [IJPEG_RESET] = { 0x0210, 9 },
2207 [CSI0_RESET] = { 0x0210, 8 },
2208 [DSI_RESET] = { 0x0210, 7 },
2209 [VCODEC_RESET] = { 0x0210, 6 },
2210 [MDP_TV_RESET] = { 0x0210, 4 },
2211 [MDP_VSYNC_RESET] = { 0x0210, 3 },
2212 [ROT_RESET] = { 0x0210, 2 },
2213 [TV_HDMI_RESET] = { 0x0210, 1 },
2214 [TV_ENC_RESET] = { 0x0210 },
2215 [CSI2_RESET] = { 0x0214, 2 },
2216 [CSI_RDI1_RESET] = { 0x0214, 1 },
2217 [CSI_RDI2_RESET] = { 0x0214 },
2220 static const struct regmap_config mmcc_msm8960_regmap_config = {
2224 .max_register = 0x334,
2228 static const struct qcom_cc_desc mmcc_msm8960_desc = {
2229 .config = &mmcc_msm8960_regmap_config,
2230 .clks = mmcc_msm8960_clks,
2231 .num_clks = ARRAY_SIZE(mmcc_msm8960_clks),
2232 .resets = mmcc_msm8960_resets,
2233 .num_resets = ARRAY_SIZE(mmcc_msm8960_resets),
2236 static const struct of_device_id mmcc_msm8960_match_table[] = {
2237 { .compatible = "qcom,mmcc-msm8960" },
2240 MODULE_DEVICE_TABLE(of, mmcc_msm8960_match_table);
2242 static int mmcc_msm8960_probe(struct platform_device *pdev)
2244 return qcom_cc_probe(pdev, &mmcc_msm8960_desc);
2247 static int mmcc_msm8960_remove(struct platform_device *pdev)
2249 qcom_cc_remove(pdev);
2253 static struct platform_driver mmcc_msm8960_driver = {
2254 .probe = mmcc_msm8960_probe,
2255 .remove = mmcc_msm8960_remove,
2257 .name = "mmcc-msm8960",
2258 .owner = THIS_MODULE,
2259 .of_match_table = mmcc_msm8960_match_table,
2263 module_platform_driver(mmcc_msm8960_driver);
2265 MODULE_DESCRIPTION("QCOM MMCC MSM8960 Driver");
2266 MODULE_LICENSE("GPL v2");
2267 MODULE_ALIAS("platform:mmcc-msm8960");