diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2014-07-08 21:36:06 -0400 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2014-07-15 19:39:00 -0400 |
commit | ff20783f7b9f35b29e768d8ecc7076c1ca1a60ca (patch) | |
tree | 90d68ce4e0a180ac68ad047f4fc3254202e240c6 | |
parent | 404c1ff67d241e8503fd46a09d324343aa321a8a (diff) |
clk: qcom: Fix MN frequency tables, parent map, and jpegd
Clocks that don't have a pre-divider don't list any pre-divider
in their frequency tables, but their tables are initialized using
aggregate initializers. Use tagged initializers so we properly
assign the m and n values for each frequency. Furthermore, the
mmcc_pxo_pll8_pll2_pll3 array improperly mapped the second
element to pll2 instead of pll8, causing the clock driver to
recalculate the wrong rate for any clocks using this array along
with a rate that uses pll2. Plus the .num_parents field is 3
instead of 4 so you can't even switch the parent to pll3. Finally
I noticed that the jpegd clock improperly indicates that the
pre-divider width is only 2, when it's actually 4 bits wide.
Fixes: 6d00b56fe "clk: qcom: Add support for MSM8960's multimedia clock controller (MMCC)"
Tested-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r-- | drivers/clk/qcom/mmcc-msm8960.c | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/drivers/clk/qcom/mmcc-msm8960.c b/drivers/clk/qcom/mmcc-msm8960.c index 14eeeba005f3..b050433af38e 100644 --- a/drivers/clk/qcom/mmcc-msm8960.c +++ b/drivers/clk/qcom/mmcc-msm8960.c | |||
@@ -38,6 +38,8 @@ | |||
38 | #define P_PLL2 2 | 38 | #define P_PLL2 2 |
39 | #define P_PLL3 3 | 39 | #define P_PLL3 3 |
40 | 40 | ||
41 | #define F_MN(f, s, _m, _n) { .freq = f, .src = s, .m = _m, .n = _n } | ||
42 | |||
41 | static u8 mmcc_pxo_pll8_pll2_map[] = { | 43 | static u8 mmcc_pxo_pll8_pll2_map[] = { |
42 | [P_PXO] = 0, | 44 | [P_PXO] = 0, |
43 | [P_PLL8] = 2, | 45 | [P_PLL8] = 2, |
@@ -59,8 +61,8 @@ static u8 mmcc_pxo_pll8_pll2_pll3_map[] = { | |||
59 | 61 | ||
60 | static const char *mmcc_pxo_pll8_pll2_pll3[] = { | 62 | static const char *mmcc_pxo_pll8_pll2_pll3[] = { |
61 | "pxo", | 63 | "pxo", |
62 | "pll2", | ||
63 | "pll8_vote", | 64 | "pll8_vote", |
65 | "pll2", | ||
64 | "pll3", | 66 | "pll3", |
65 | }; | 67 | }; |
66 | 68 | ||
@@ -710,18 +712,18 @@ static struct clk_branch csiphy2_timer_clk = { | |||
710 | }; | 712 | }; |
711 | 713 | ||
712 | static struct freq_tbl clk_tbl_gfx2d[] = { | 714 | static struct freq_tbl clk_tbl_gfx2d[] = { |
713 | { 27000000, P_PXO, 1, 0 }, | 715 | F_MN( 27000000, P_PXO, 1, 0), |
714 | { 48000000, P_PLL8, 1, 8 }, | 716 | F_MN( 48000000, P_PLL8, 1, 8), |
715 | { 54857000, P_PLL8, 1, 7 }, | 717 | F_MN( 54857000, P_PLL8, 1, 7), |
716 | { 64000000, P_PLL8, 1, 6 }, | 718 | F_MN( 64000000, P_PLL8, 1, 6), |
717 | { 76800000, P_PLL8, 1, 5 }, | 719 | F_MN( 76800000, P_PLL8, 1, 5), |
718 | { 96000000, P_PLL8, 1, 4 }, | 720 | F_MN( 96000000, P_PLL8, 1, 4), |
719 | { 128000000, P_PLL8, 1, 3 }, | 721 | F_MN(128000000, P_PLL8, 1, 3), |
720 | { 145455000, P_PLL2, 2, 11 }, | 722 | F_MN(145455000, P_PLL2, 2, 11), |
721 | { 160000000, P_PLL2, 1, 5 }, | 723 | F_MN(160000000, P_PLL2, 1, 5), |
722 | { 177778000, P_PLL2, 2, 9 }, | 724 | F_MN(177778000, P_PLL2, 2, 9), |
723 | { 200000000, P_PLL2, 1, 4 }, | 725 | F_MN(200000000, P_PLL2, 1, 4), |
724 | { 228571000, P_PLL2, 2, 7 }, | 726 | F_MN(228571000, P_PLL2, 2, 7), |
725 | { } | 727 | { } |
726 | }; | 728 | }; |
727 | 729 | ||
@@ -842,22 +844,22 @@ static struct clk_branch gfx2d1_clk = { | |||
842 | }; | 844 | }; |
843 | 845 | ||
844 | static struct freq_tbl clk_tbl_gfx3d[] = { | 846 | static struct freq_tbl clk_tbl_gfx3d[] = { |
845 | { 27000000, P_PXO, 1, 0 }, | 847 | F_MN( 27000000, P_PXO, 1, 0), |
846 | { 48000000, P_PLL8, 1, 8 }, | 848 | F_MN( 48000000, P_PLL8, 1, 8), |
847 | { 54857000, P_PLL8, 1, 7 }, | 849 | F_MN( 54857000, P_PLL8, 1, 7), |
848 | { 64000000, P_PLL8, 1, 6 }, | 850 | F_MN( 64000000, P_PLL8, 1, 6), |
849 | { 76800000, P_PLL8, 1, 5 }, | 851 | F_MN( 76800000, P_PLL8, 1, 5), |
850 | { 96000000, P_PLL8, 1, 4 }, | 852 | F_MN( 96000000, P_PLL8, 1, 4), |
851 | { 128000000, P_PLL8, 1, 3 }, | 853 | F_MN(128000000, P_PLL8, 1, 3), |
852 | { 145455000, P_PLL2, 2, 11 }, | 854 | F_MN(145455000, P_PLL2, 2, 11), |
853 | { 160000000, P_PLL2, 1, 5 }, | 855 | F_MN(160000000, P_PLL2, 1, 5), |
854 | { 177778000, P_PLL2, 2, 9 }, | 856 | F_MN(177778000, P_PLL2, 2, 9), |
855 | { 200000000, P_PLL2, 1, 4 }, | 857 | F_MN(200000000, P_PLL2, 1, 4), |
856 | { 228571000, P_PLL2, 2, 7 }, | 858 | F_MN(228571000, P_PLL2, 2, 7), |
857 | { 266667000, P_PLL2, 1, 3 }, | 859 | F_MN(266667000, P_PLL2, 1, 3), |
858 | { 300000000, P_PLL3, 1, 4 }, | 860 | F_MN(300000000, P_PLL3, 1, 4), |
859 | { 320000000, P_PLL2, 2, 5 }, | 861 | F_MN(320000000, P_PLL2, 2, 5), |
860 | { 400000000, P_PLL2, 1, 2 }, | 862 | F_MN(400000000, P_PLL2, 1, 2), |
861 | { } | 863 | { } |
862 | }; | 864 | }; |
863 | 865 | ||
@@ -897,7 +899,7 @@ static struct clk_dyn_rcg gfx3d_src = { | |||
897 | .hw.init = &(struct clk_init_data){ | 899 | .hw.init = &(struct clk_init_data){ |
898 | .name = "gfx3d_src", | 900 | .name = "gfx3d_src", |
899 | .parent_names = mmcc_pxo_pll8_pll2_pll3, | 901 | .parent_names = mmcc_pxo_pll8_pll2_pll3, |
900 | .num_parents = 3, | 902 | .num_parents = 4, |
901 | .ops = &clk_dyn_rcg_ops, | 903 | .ops = &clk_dyn_rcg_ops, |
902 | }, | 904 | }, |
903 | }, | 905 | }, |
@@ -995,7 +997,7 @@ static struct clk_rcg jpegd_src = { | |||
995 | .ns_reg = 0x00ac, | 997 | .ns_reg = 0x00ac, |
996 | .p = { | 998 | .p = { |
997 | .pre_div_shift = 12, | 999 | .pre_div_shift = 12, |
998 | .pre_div_width = 2, | 1000 | .pre_div_width = 4, |
999 | }, | 1001 | }, |
1000 | .s = { | 1002 | .s = { |
1001 | .src_sel_shift = 0, | 1003 | .src_sel_shift = 0, |
@@ -1337,15 +1339,15 @@ static struct clk_branch hdmi_app_clk = { | |||
1337 | }; | 1339 | }; |
1338 | 1340 | ||
1339 | static struct freq_tbl clk_tbl_vcodec[] = { | 1341 | static struct freq_tbl clk_tbl_vcodec[] = { |
1340 | { 27000000, P_PXO, 1, 0 }, | 1342 | F_MN( 27000000, P_PXO, 1, 0), |
1341 | { 32000000, P_PLL8, 1, 12 }, | 1343 | F_MN( 32000000, P_PLL8, 1, 12), |
1342 | { 48000000, P_PLL8, 1, 8 }, | 1344 | F_MN( 48000000, P_PLL8, 1, 8), |
1343 | { 54860000, P_PLL8, 1, 7 }, | 1345 | F_MN( 54860000, P_PLL8, 1, 7), |
1344 | { 96000000, P_PLL8, 1, 4 }, | 1346 | F_MN( 96000000, P_PLL8, 1, 4), |
1345 | { 133330000, P_PLL2, 1, 6 }, | 1347 | F_MN(133330000, P_PLL2, 1, 6), |
1346 | { 200000000, P_PLL2, 1, 4 }, | 1348 | F_MN(200000000, P_PLL2, 1, 4), |
1347 | { 228570000, P_PLL2, 2, 7 }, | 1349 | F_MN(228570000, P_PLL2, 2, 7), |
1348 | { 266670000, P_PLL2, 1, 3 }, | 1350 | F_MN(266670000, P_PLL2, 1, 3), |
1349 | { } | 1351 | { } |
1350 | }; | 1352 | }; |
1351 | 1353 | ||