diff options
Diffstat (limited to 'drivers/clk/mediatek/clk-mt2712.c')
-rw-r--r-- | drivers/clk/mediatek/clk-mt2712.c | 69 |
1 files changed, 55 insertions, 14 deletions
diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c index 498d13799388..991d4093726e 100644 --- a/drivers/clk/mediatek/clk-mt2712.c +++ b/drivers/clk/mediatek/clk-mt2712.c | |||
@@ -221,6 +221,8 @@ static const struct mtk_fixed_factor top_divs[] = { | |||
221 | 4), | 221 | 4), |
222 | FACTOR(CLK_TOP_D2A_ULCLK_6P5M, "d2a_ulclk_6p5m", "clk26m", 1, | 222 | FACTOR(CLK_TOP_D2A_ULCLK_6P5M, "d2a_ulclk_6p5m", "clk26m", 1, |
223 | 4), | 223 | 4), |
224 | FACTOR(CLK_TOP_APLL1_D3, "apll1_d3", "apll1_ck", 1, | ||
225 | 3), | ||
224 | }; | 226 | }; |
225 | 227 | ||
226 | static const char * const axi_parents[] = { | 228 | static const char * const axi_parents[] = { |
@@ -625,7 +627,7 @@ static const char * const ether_125m_parents[] = { | |||
625 | static const char * const ether_50m_parents[] = { | 627 | static const char * const ether_50m_parents[] = { |
626 | "clk26m", | 628 | "clk26m", |
627 | "etherpll_50m", | 629 | "etherpll_50m", |
628 | "univpll_d26", | 630 | "apll1_d3", |
629 | "univpll3_d4" | 631 | "univpll3_d4" |
630 | }; | 632 | }; |
631 | 633 | ||
@@ -686,7 +688,7 @@ static const char * const i2c_parents[] = { | |||
686 | 688 | ||
687 | static const char * const msdc0p_aes_parents[] = { | 689 | static const char * const msdc0p_aes_parents[] = { |
688 | "clk26m", | 690 | "clk26m", |
689 | "msdcpll_ck", | 691 | "syspll_d2", |
690 | "univpll_d3", | 692 | "univpll_d3", |
691 | "vcodecpll_ck" | 693 | "vcodecpll_ck" |
692 | }; | 694 | }; |
@@ -719,6 +721,17 @@ static const char * const aud_apll2_parents[] = { | |||
719 | "clkaud_ext_i_2" | 721 | "clkaud_ext_i_2" |
720 | }; | 722 | }; |
721 | 723 | ||
724 | static const char * const apll1_ref_parents[] = { | ||
725 | "clkaud_ext_i_2", | ||
726 | "clkaud_ext_i_1", | ||
727 | "clki2si0_mck_i", | ||
728 | "clki2si1_mck_i", | ||
729 | "clki2si2_mck_i", | ||
730 | "clktdmin_mclk_i", | ||
731 | "clki2si2_mck_i", | ||
732 | "clktdmin_mclk_i" | ||
733 | }; | ||
734 | |||
722 | static const char * const audull_vtx_parents[] = { | 735 | static const char * const audull_vtx_parents[] = { |
723 | "d2a_ulclk_6p5m", | 736 | "d2a_ulclk_6p5m", |
724 | "clkaud_ext_i_0" | 737 | "clkaud_ext_i_0" |
@@ -886,6 +899,10 @@ static struct mtk_composite top_muxes[] = { | |||
886 | aud_apll2_parents, 0x134, 1, 1), | 899 | aud_apll2_parents, 0x134, 1, 1), |
887 | MUX(CLK_TOP_DA_AUDULL_VTX_6P5M_SEL, "audull_vtx_sel", | 900 | MUX(CLK_TOP_DA_AUDULL_VTX_6P5M_SEL, "audull_vtx_sel", |
888 | audull_vtx_parents, 0x134, 31, 1), | 901 | audull_vtx_parents, 0x134, 31, 1), |
902 | MUX(CLK_TOP_APLL1_REF_SEL, "apll1_ref_sel", | ||
903 | apll1_ref_parents, 0x134, 4, 3), | ||
904 | MUX(CLK_TOP_APLL2_REF_SEL, "apll2_ref_sel", | ||
905 | apll1_ref_parents, 0x134, 7, 3), | ||
889 | }; | 906 | }; |
890 | 907 | ||
891 | static const char * const mcu_mp0_parents[] = { | 908 | static const char * const mcu_mp0_parents[] = { |
@@ -932,36 +949,56 @@ static const struct mtk_clk_divider top_adj_divs[] = { | |||
932 | DIV_ADJ(CLK_TOP_APLL_DIV7, "apll_div7", "i2si3_sel", 0x128, 24, 8), | 949 | DIV_ADJ(CLK_TOP_APLL_DIV7, "apll_div7", "i2si3_sel", 0x128, 24, 8), |
933 | }; | 950 | }; |
934 | 951 | ||
935 | static const struct mtk_gate_regs top_cg_regs = { | 952 | static const struct mtk_gate_regs top0_cg_regs = { |
936 | .set_ofs = 0x120, | 953 | .set_ofs = 0x120, |
937 | .clr_ofs = 0x120, | 954 | .clr_ofs = 0x120, |
938 | .sta_ofs = 0x120, | 955 | .sta_ofs = 0x120, |
939 | }; | 956 | }; |
940 | 957 | ||
941 | #define GATE_TOP(_id, _name, _parent, _shift) { \ | 958 | static const struct mtk_gate_regs top1_cg_regs = { |
959 | .set_ofs = 0x424, | ||
960 | .clr_ofs = 0x424, | ||
961 | .sta_ofs = 0x424, | ||
962 | }; | ||
963 | |||
964 | #define GATE_TOP0(_id, _name, _parent, _shift) { \ | ||
942 | .id = _id, \ | 965 | .id = _id, \ |
943 | .name = _name, \ | 966 | .name = _name, \ |
944 | .parent_name = _parent, \ | 967 | .parent_name = _parent, \ |
945 | .regs = &top_cg_regs, \ | 968 | .regs = &top0_cg_regs, \ |
946 | .shift = _shift, \ | 969 | .shift = _shift, \ |
947 | .ops = &mtk_clk_gate_ops_no_setclr, \ | 970 | .ops = &mtk_clk_gate_ops_no_setclr, \ |
948 | } | 971 | } |
949 | 972 | ||
973 | #define GATE_TOP1(_id, _name, _parent, _shift) { \ | ||
974 | .id = _id, \ | ||
975 | .name = _name, \ | ||
976 | .parent_name = _parent, \ | ||
977 | .regs = &top1_cg_regs, \ | ||
978 | .shift = _shift, \ | ||
979 | .ops = &mtk_clk_gate_ops_no_setclr_inv, \ | ||
980 | } | ||
981 | |||
950 | static const struct mtk_gate top_clks[] = { | 982 | static const struct mtk_gate top_clks[] = { |
951 | GATE_TOP(CLK_TOP_APLL_DIV_PDN0, "apll_div_pdn0", "i2so1_sel", 0), | 983 | /* TOP0 */ |
952 | GATE_TOP(CLK_TOP_APLL_DIV_PDN1, "apll_div_pdn1", "i2so2_sel", 1), | 984 | GATE_TOP0(CLK_TOP_APLL_DIV_PDN0, "apll_div_pdn0", "i2so1_sel", 0), |
953 | GATE_TOP(CLK_TOP_APLL_DIV_PDN2, "apll_div_pdn2", "i2so3_sel", 2), | 985 | GATE_TOP0(CLK_TOP_APLL_DIV_PDN1, "apll_div_pdn1", "i2so2_sel", 1), |
954 | GATE_TOP(CLK_TOP_APLL_DIV_PDN3, "apll_div_pdn3", "tdmo0_sel", 3), | 986 | GATE_TOP0(CLK_TOP_APLL_DIV_PDN2, "apll_div_pdn2", "i2so3_sel", 2), |
955 | GATE_TOP(CLK_TOP_APLL_DIV_PDN4, "apll_div_pdn4", "tdmo1_sel", 4), | 987 | GATE_TOP0(CLK_TOP_APLL_DIV_PDN3, "apll_div_pdn3", "tdmo0_sel", 3), |
956 | GATE_TOP(CLK_TOP_APLL_DIV_PDN5, "apll_div_pdn5", "i2si1_sel", 5), | 988 | GATE_TOP0(CLK_TOP_APLL_DIV_PDN4, "apll_div_pdn4", "tdmo1_sel", 4), |
957 | GATE_TOP(CLK_TOP_APLL_DIV_PDN6, "apll_div_pdn6", "i2si2_sel", 6), | 989 | GATE_TOP0(CLK_TOP_APLL_DIV_PDN5, "apll_div_pdn5", "i2si1_sel", 5), |
958 | GATE_TOP(CLK_TOP_APLL_DIV_PDN7, "apll_div_pdn7", "i2si3_sel", 7), | 990 | GATE_TOP0(CLK_TOP_APLL_DIV_PDN6, "apll_div_pdn6", "i2si2_sel", 6), |
991 | GATE_TOP0(CLK_TOP_APLL_DIV_PDN7, "apll_div_pdn7", "i2si3_sel", 7), | ||
992 | /* TOP1 */ | ||
993 | GATE_TOP1(CLK_TOP_NFI2X_EN, "nfi2x_en", "nfi2x_sel", 0), | ||
994 | GATE_TOP1(CLK_TOP_NFIECC_EN, "nfiecc_en", "nfiecc_sel", 1), | ||
995 | GATE_TOP1(CLK_TOP_NFI1X_CK_EN, "nfi1x_ck_en", "nfi2x_sel", 2), | ||
959 | }; | 996 | }; |
960 | 997 | ||
961 | static const struct mtk_gate_regs infra_cg_regs = { | 998 | static const struct mtk_gate_regs infra_cg_regs = { |
962 | .set_ofs = 0x40, | 999 | .set_ofs = 0x40, |
963 | .clr_ofs = 0x44, | 1000 | .clr_ofs = 0x44, |
964 | .sta_ofs = 0x40, | 1001 | .sta_ofs = 0x48, |
965 | }; | 1002 | }; |
966 | 1003 | ||
967 | #define GATE_INFRA(_id, _name, _parent, _shift) { \ | 1004 | #define GATE_INFRA(_id, _name, _parent, _shift) { \ |
@@ -1120,6 +1157,10 @@ static const struct mtk_gate peri_clks[] = { | |||
1120 | "msdc50_0_h_sel", 4), | 1157 | "msdc50_0_h_sel", 4), |
1121 | GATE_PERI2(CLK_PERI_MSDC50_3_HCLK_EN, "per_msdc50_3_h", | 1158 | GATE_PERI2(CLK_PERI_MSDC50_3_HCLK_EN, "per_msdc50_3_h", |
1122 | "msdc50_3_h_sel", 5), | 1159 | "msdc50_3_h_sel", 5), |
1160 | GATE_PERI2(CLK_PERI_MSDC30_0_QTR_EN, "per_msdc30_0_q", | ||
1161 | "axi_sel", 6), | ||
1162 | GATE_PERI2(CLK_PERI_MSDC30_3_QTR_EN, "per_msdc30_3_q", | ||
1163 | "mem_sel", 7), | ||
1123 | }; | 1164 | }; |
1124 | 1165 | ||
1125 | #define MT2712_PLL_FMAX (3000UL * MHZ) | 1166 | #define MT2712_PLL_FMAX (3000UL * MHZ) |