Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branches 'clk-mvebu', 'clk-phase', 'clk-nxp', 'clk-mtk2712' and 'clk-qcom-rpmcc' into clk-next

* clk-mvebu:
clk: mvebu: armada-38x: add support for missing clocks
clk: mvebu: cp110: Fix clock tree representation

* clk-phase:
clk: Don't show the incorrect clock phase
clk: update cached phase to respect the fact when setting phase

* clk-nxp:
clk: lpc32xx: Set name of regmap_config

* clk-mtk2712:
clk: mediatek: update clock driver of MT2712
dt-bindings: clock: add clocks for MT2712

* clk-qcom-rpmcc:
clk: qcom: rpmcc: Add support to XO buffered clocks

+202 -80
+7 -1
drivers/clk/clk.c
··· 2311 2311 2312 2312 trace_clk_set_phase(core, degrees); 2313 2313 2314 - if (core->ops->set_phase) 2314 + if (core->ops->set_phase) { 2315 2315 ret = core->ops->set_phase(core->hw, degrees); 2316 + if (!ret) 2317 + core->phase = degrees; 2318 + } 2316 2319 2317 2320 trace_clk_set_phase_complete(core, degrees); 2318 2321 ··· 2375 2372 int ret; 2376 2373 2377 2374 clk_prepare_lock(); 2375 + /* Always try to update cached phase if possible */ 2376 + if (core->ops->get_phase) 2377 + core->phase = core->ops->get_phase(core->hw); 2378 2378 ret = core->phase; 2379 2379 clk_prepare_unlock(); 2380 2380
+55 -14
drivers/clk/mediatek/clk-mt2712.c
··· 221 221 4), 222 222 FACTOR(CLK_TOP_D2A_ULCLK_6P5M, "d2a_ulclk_6p5m", "clk26m", 1, 223 223 4), 224 + FACTOR(CLK_TOP_APLL1_D3, "apll1_d3", "apll1_ck", 1, 225 + 3), 224 226 }; 225 227 226 228 static const char * const axi_parents[] = { ··· 627 625 static const char * const ether_50m_parents[] = { 628 626 "clk26m", 629 627 "etherpll_50m", 630 - "univpll_d26", 628 + "apll1_d3", 631 629 "univpll3_d4" 632 630 }; 633 631 ··· 688 686 689 687 static const char * const msdc0p_aes_parents[] = { 690 688 "clk26m", 691 - "msdcpll_ck", 689 + "syspll_d2", 692 690 "univpll_d3", 693 691 "vcodecpll_ck" 694 692 }; ··· 719 717 static const char * const aud_apll2_parents[] = { 720 718 "apll2", 721 719 "clkaud_ext_i_2" 720 + }; 721 + 722 + static const char * const apll1_ref_parents[] = { 723 + "clkaud_ext_i_2", 724 + "clkaud_ext_i_1", 725 + "clki2si0_mck_i", 726 + "clki2si1_mck_i", 727 + "clki2si2_mck_i", 728 + "clktdmin_mclk_i", 729 + "clki2si2_mck_i", 730 + "clktdmin_mclk_i" 722 731 }; 723 732 724 733 static const char * const audull_vtx_parents[] = { ··· 899 886 aud_apll2_parents, 0x134, 1, 1), 900 887 MUX(CLK_TOP_DA_AUDULL_VTX_6P5M_SEL, "audull_vtx_sel", 901 888 audull_vtx_parents, 0x134, 31, 1), 889 + MUX(CLK_TOP_APLL1_REF_SEL, "apll1_ref_sel", 890 + apll1_ref_parents, 0x134, 4, 3), 891 + MUX(CLK_TOP_APLL2_REF_SEL, "apll2_ref_sel", 892 + apll1_ref_parents, 0x134, 7, 3), 902 893 }; 903 894 904 895 static const char * const mcu_mp0_parents[] = { ··· 949 932 DIV_ADJ(CLK_TOP_APLL_DIV7, "apll_div7", "i2si3_sel", 0x128, 24, 8), 950 933 }; 951 934 952 - static const struct mtk_gate_regs top_cg_regs = { 935 + static const struct mtk_gate_regs top0_cg_regs = { 953 936 .set_ofs = 0x120, 954 937 .clr_ofs = 0x120, 955 938 .sta_ofs = 0x120, 956 939 }; 957 940 958 - #define GATE_TOP(_id, _name, _parent, _shift) { \ 941 + static const struct mtk_gate_regs top1_cg_regs = { 942 + .set_ofs = 0x424, 943 + .clr_ofs = 0x424, 944 + .sta_ofs = 0x424, 945 + }; 946 + 947 + #define GATE_TOP0(_id, _name, _parent, _shift) { \ 959 948 .id = _id, \ 960 949 .name = _name, \ 961 950 .parent_name = _parent, \ 962 - .regs = &top_cg_regs, \ 951 + .regs = &top0_cg_regs, \ 963 952 .shift = _shift, \ 964 953 .ops = &mtk_clk_gate_ops_no_setclr, \ 965 954 } 966 955 956 + #define GATE_TOP1(_id, _name, _parent, _shift) { \ 957 + .id = _id, \ 958 + .name = _name, \ 959 + .parent_name = _parent, \ 960 + .regs = &top1_cg_regs, \ 961 + .shift = _shift, \ 962 + .ops = &mtk_clk_gate_ops_no_setclr_inv, \ 963 + } 964 + 967 965 static const struct mtk_gate top_clks[] = { 968 - GATE_TOP(CLK_TOP_APLL_DIV_PDN0, "apll_div_pdn0", "i2so1_sel", 0), 969 - GATE_TOP(CLK_TOP_APLL_DIV_PDN1, "apll_div_pdn1", "i2so2_sel", 1), 970 - GATE_TOP(CLK_TOP_APLL_DIV_PDN2, "apll_div_pdn2", "i2so3_sel", 2), 971 - GATE_TOP(CLK_TOP_APLL_DIV_PDN3, "apll_div_pdn3", "tdmo0_sel", 3), 972 - GATE_TOP(CLK_TOP_APLL_DIV_PDN4, "apll_div_pdn4", "tdmo1_sel", 4), 973 - GATE_TOP(CLK_TOP_APLL_DIV_PDN5, "apll_div_pdn5", "i2si1_sel", 5), 974 - GATE_TOP(CLK_TOP_APLL_DIV_PDN6, "apll_div_pdn6", "i2si2_sel", 6), 975 - GATE_TOP(CLK_TOP_APLL_DIV_PDN7, "apll_div_pdn7", "i2si3_sel", 7), 966 + /* TOP0 */ 967 + GATE_TOP0(CLK_TOP_APLL_DIV_PDN0, "apll_div_pdn0", "i2so1_sel", 0), 968 + GATE_TOP0(CLK_TOP_APLL_DIV_PDN1, "apll_div_pdn1", "i2so2_sel", 1), 969 + GATE_TOP0(CLK_TOP_APLL_DIV_PDN2, "apll_div_pdn2", "i2so3_sel", 2), 970 + GATE_TOP0(CLK_TOP_APLL_DIV_PDN3, "apll_div_pdn3", "tdmo0_sel", 3), 971 + GATE_TOP0(CLK_TOP_APLL_DIV_PDN4, "apll_div_pdn4", "tdmo1_sel", 4), 972 + GATE_TOP0(CLK_TOP_APLL_DIV_PDN5, "apll_div_pdn5", "i2si1_sel", 5), 973 + GATE_TOP0(CLK_TOP_APLL_DIV_PDN6, "apll_div_pdn6", "i2si2_sel", 6), 974 + GATE_TOP0(CLK_TOP_APLL_DIV_PDN7, "apll_div_pdn7", "i2si3_sel", 7), 975 + /* TOP1 */ 976 + GATE_TOP1(CLK_TOP_NFI2X_EN, "nfi2x_en", "nfi2x_sel", 0), 977 + GATE_TOP1(CLK_TOP_NFIECC_EN, "nfiecc_en", "nfiecc_sel", 1), 978 + GATE_TOP1(CLK_TOP_NFI1X_CK_EN, "nfi1x_ck_en", "nfi2x_sel", 2), 976 979 }; 977 980 978 981 static const struct mtk_gate_regs infra_cg_regs = { 979 982 .set_ofs = 0x40, 980 983 .clr_ofs = 0x44, 981 - .sta_ofs = 0x40, 984 + .sta_ofs = 0x48, 982 985 }; 983 986 984 987 #define GATE_INFRA(_id, _name, _parent, _shift) { \ ··· 1157 1120 "msdc50_0_h_sel", 4), 1158 1121 GATE_PERI2(CLK_PERI_MSDC50_3_HCLK_EN, "per_msdc50_3_h", 1159 1122 "msdc50_3_h_sel", 5), 1123 + GATE_PERI2(CLK_PERI_MSDC30_0_QTR_EN, "per_msdc30_0_q", 1124 + "axi_sel", 6), 1125 + GATE_PERI2(CLK_PERI_MSDC30_3_QTR_EN, "per_msdc30_3_q", 1126 + "mem_sel", 7), 1160 1127 }; 1161 1128 1162 1129 #define MT2712_PLL_FMAX (3000UL * MHZ)
+7 -7
drivers/clk/mvebu/armada-38x.c
··· 46 46 } 47 47 48 48 static const u32 armada_38x_cpu_frequencies[] __initconst = { 49 - 0, 0, 0, 0, 50 - 1066 * 1000 * 1000, 0, 0, 0, 49 + 666 * 1000 * 1000, 0, 800 * 1000 * 1000, 0, 50 + 1066 * 1000 * 1000, 0, 1200 * 1000 * 1000, 0, 51 51 1332 * 1000 * 1000, 0, 0, 0, 52 52 1600 * 1000 * 1000, 0, 0, 0, 53 - 1866 * 1000 * 1000, 53 + 1866 * 1000 * 1000, 0, 0, 2000 * 1000 * 1000, 54 54 }; 55 55 56 56 static u32 __init armada_38x_get_cpu_freq(void __iomem *sar) ··· 76 76 }; 77 77 78 78 static const int armada_38x_cpu_l2_ratios[32][2] __initconst = { 79 - {0, 1}, {0, 1}, {0, 1}, {0, 1}, 79 + {1, 2}, {0, 1}, {1, 2}, {0, 1}, 80 + {1, 2}, {0, 1}, {1, 2}, {0, 1}, 80 81 {1, 2}, {0, 1}, {0, 1}, {0, 1}, 81 82 {1, 2}, {0, 1}, {0, 1}, {0, 1}, 82 - {1, 2}, {0, 1}, {0, 1}, {0, 1}, 83 - {1, 2}, {0, 1}, {0, 1}, {0, 1}, 83 + {1, 2}, {0, 1}, {0, 1}, {1, 2}, 84 84 {0, 1}, {0, 1}, {0, 1}, {0, 1}, 85 85 {0, 1}, {0, 1}, {0, 1}, {0, 1}, 86 86 {0, 1}, {0, 1}, {0, 1}, {0, 1}, ··· 91 91 {1, 2}, {0, 1}, {0, 1}, {0, 1}, 92 92 {1, 2}, {0, 1}, {0, 1}, {0, 1}, 93 93 {1, 2}, {0, 1}, {0, 1}, {0, 1}, 94 - {1, 2}, {0, 1}, {0, 1}, {0, 1}, 94 + {1, 2}, {0, 1}, {0, 1}, {7, 15}, 95 95 {0, 1}, {0, 1}, {0, 1}, {0, 1}, 96 96 {0, 1}, {0, 1}, {0, 1}, {0, 1}, 97 97 {0, 1}, {0, 1}, {0, 1}, {0, 1},
+39 -55
drivers/clk/mvebu/cp110-system-controller.c
··· 13 13 /* 14 14 * CP110 has 6 core clocks: 15 15 * 16 - * - APLL (1 Ghz) 17 - * - PPv2 core (1/3 APLL) 18 - * - EIP (1/2 APLL) 19 - * - Core (1/2 EIP) 20 - * - SDIO (2/5 APLL) 16 + * - PLL0 (1 Ghz) 17 + * - PPv2 core (1/3 PLL0) 18 + * - x2 Core (1/2 PLL0) 19 + * - Core (1/2 x2 Core) 20 + * - SDIO (2/5 PLL0) 21 21 * 22 22 * - NAND clock, which is either: 23 23 * - Equal to SDIO clock 24 - * - 2/5 APLL 24 + * - 2/5 PLL0 25 25 * 26 - * CP110 has 32 gatable clocks, for the various peripherals in the 27 - * IP. They have fairly complicated parent/child relationships. 26 + * CP110 has 32 gatable clocks, for the various peripherals in the IP. 28 27 */ 29 28 30 29 #define pr_fmt(fmt) "cp110-system-controller: " fmt ··· 52 53 #define CP110_CLK_NUM \ 53 54 (CP110_MAX_CORE_CLOCKS + CP110_MAX_GATABLE_CLOCKS) 54 55 55 - #define CP110_CORE_APLL 0 56 + #define CP110_CORE_PLL0 0 56 57 #define CP110_CORE_PPV2 1 57 - #define CP110_CORE_EIP 2 58 + #define CP110_CORE_X2CORE 2 58 59 #define CP110_CORE_CORE 3 59 60 #define CP110_CORE_NAND 4 60 61 #define CP110_CORE_SDIO 5 ··· 236 237 struct regmap *regmap; 237 238 struct device *dev = &pdev->dev; 238 239 struct device_node *np = dev->of_node; 239 - const char *ppv2_name, *apll_name, *core_name, *eip_name, *nand_name, 240 + const char *ppv2_name, *pll0_name, *core_name, *x2core_name, *nand_name, 240 241 *sdio_name; 241 242 struct clk_hw_onecell_data *cp110_clk_data; 242 243 struct clk_hw *hw, **cp110_clks; ··· 262 263 cp110_clks = cp110_clk_data->hws; 263 264 cp110_clk_data->num = CP110_CLK_NUM; 264 265 265 - /* Register the APLL which is the root of the hw tree */ 266 - apll_name = cp110_unique_name(dev, syscon_node, "apll"); 267 - hw = clk_hw_register_fixed_rate(NULL, apll_name, NULL, 0, 266 + /* Register the PLL0 which is the root of the hw tree */ 267 + pll0_name = cp110_unique_name(dev, syscon_node, "pll0"); 268 + hw = clk_hw_register_fixed_rate(NULL, pll0_name, NULL, 0, 268 269 1000 * 1000 * 1000); 269 270 if (IS_ERR(hw)) { 270 271 ret = PTR_ERR(hw); 271 - goto fail_apll; 272 + goto fail_pll0; 272 273 } 273 274 274 - cp110_clks[CP110_CORE_APLL] = hw; 275 + cp110_clks[CP110_CORE_PLL0] = hw; 275 276 276 - /* PPv2 is APLL/3 */ 277 + /* PPv2 is PLL0/3 */ 277 278 ppv2_name = cp110_unique_name(dev, syscon_node, "ppv2-core"); 278 - hw = clk_hw_register_fixed_factor(NULL, ppv2_name, apll_name, 0, 1, 3); 279 + hw = clk_hw_register_fixed_factor(NULL, ppv2_name, pll0_name, 0, 1, 3); 279 280 if (IS_ERR(hw)) { 280 281 ret = PTR_ERR(hw); 281 282 goto fail_ppv2; ··· 283 284 284 285 cp110_clks[CP110_CORE_PPV2] = hw; 285 286 286 - /* EIP clock is APLL/2 */ 287 - eip_name = cp110_unique_name(dev, syscon_node, "eip"); 288 - hw = clk_hw_register_fixed_factor(NULL, eip_name, apll_name, 0, 1, 2); 287 + /* X2CORE clock is PLL0/2 */ 288 + x2core_name = cp110_unique_name(dev, syscon_node, "x2core"); 289 + hw = clk_hw_register_fixed_factor(NULL, x2core_name, pll0_name, 290 + 0, 1, 2); 289 291 if (IS_ERR(hw)) { 290 292 ret = PTR_ERR(hw); 291 293 goto fail_eip; 292 294 } 293 295 294 - cp110_clks[CP110_CORE_EIP] = hw; 296 + cp110_clks[CP110_CORE_X2CORE] = hw; 295 297 296 - /* Core clock is EIP/2 */ 298 + /* Core clock is X2CORE/2 */ 297 299 core_name = cp110_unique_name(dev, syscon_node, "core"); 298 - hw = clk_hw_register_fixed_factor(NULL, core_name, eip_name, 0, 1, 2); 300 + hw = clk_hw_register_fixed_factor(NULL, core_name, x2core_name, 301 + 0, 1, 2); 299 302 if (IS_ERR(hw)) { 300 303 ret = PTR_ERR(hw); 301 304 goto fail_core; 302 305 } 303 306 304 307 cp110_clks[CP110_CORE_CORE] = hw; 305 - /* NAND can be either APLL/2.5 or core clock */ 308 + /* NAND can be either PLL0/2.5 or core clock */ 306 309 nand_name = cp110_unique_name(dev, syscon_node, "nand-core"); 307 310 if (nand_clk_ctrl & NF_CLOCK_SEL_400_MASK) 308 311 hw = clk_hw_register_fixed_factor(NULL, nand_name, 309 - apll_name, 0, 2, 5); 312 + pll0_name, 0, 2, 5); 310 313 else 311 314 hw = clk_hw_register_fixed_factor(NULL, nand_name, 312 315 core_name, 0, 1, 1); ··· 319 318 320 319 cp110_clks[CP110_CORE_NAND] = hw; 321 320 322 - /* SDIO clock is APLL/2.5 */ 321 + /* SDIO clock is PLL0/2.5 */ 323 322 sdio_name = cp110_unique_name(dev, syscon_node, "sdio-core"); 324 323 hw = clk_hw_register_fixed_factor(NULL, sdio_name, 325 - apll_name, 0, 2, 5); 324 + pll0_name, 0, 2, 5); 326 325 if (IS_ERR(hw)) { 327 326 ret = PTR_ERR(hw); 328 327 goto fail_sdio; ··· 342 341 continue; 343 342 344 343 switch (i) { 345 - case CP110_GATE_AUDIO: 346 - case CP110_GATE_COMM_UNIT: 347 - case CP110_GATE_EIP150: 348 - case CP110_GATE_EIP197: 349 - case CP110_GATE_SLOW_IO: 350 - parent = gate_name[CP110_GATE_MAIN]; 351 - break; 352 - case CP110_GATE_MG: 353 - parent = gate_name[CP110_GATE_MG_CORE]; 354 - break; 355 344 case CP110_GATE_NAND: 356 345 parent = nand_name; 357 346 break; 347 + case CP110_GATE_MG: 348 + case CP110_GATE_GOP_DP: 358 349 case CP110_GATE_PPV2: 359 350 parent = ppv2_name; 360 351 break; 361 352 case CP110_GATE_SDIO: 362 353 parent = sdio_name; 363 354 break; 364 - case CP110_GATE_GOP_DP: 365 - parent = gate_name[CP110_GATE_SDMMC_GOP]; 366 - break; 367 - case CP110_GATE_XOR1: 368 - case CP110_GATE_XOR0: 369 - case CP110_GATE_PCIE_X1_0: 370 - case CP110_GATE_PCIE_X1_1: 355 + case CP110_GATE_MAIN: 356 + case CP110_GATE_PCIE_XOR: 371 357 case CP110_GATE_PCIE_X4: 372 - parent = gate_name[CP110_GATE_PCIE_XOR]; 373 - break; 374 - case CP110_GATE_SATA: 375 - case CP110_GATE_USB3H0: 376 - case CP110_GATE_USB3H1: 377 - case CP110_GATE_USB3DEV: 378 - parent = gate_name[CP110_GATE_SATA_USB]; 358 + case CP110_GATE_EIP150: 359 + case CP110_GATE_EIP197: 360 + parent = x2core_name; 379 361 break; 380 362 default: 381 363 parent = core_name; ··· 397 413 fail_nand: 398 414 clk_hw_unregister_fixed_factor(cp110_clks[CP110_CORE_CORE]); 399 415 fail_core: 400 - clk_hw_unregister_fixed_factor(cp110_clks[CP110_CORE_EIP]); 416 + clk_hw_unregister_fixed_factor(cp110_clks[CP110_CORE_X2CORE]); 401 417 fail_eip: 402 418 clk_hw_unregister_fixed_factor(cp110_clks[CP110_CORE_PPV2]); 403 419 fail_ppv2: 404 - clk_hw_unregister_fixed_rate(cp110_clks[CP110_CORE_APLL]); 405 - fail_apll: 420 + clk_hw_unregister_fixed_rate(cp110_clks[CP110_CORE_PLL0]); 421 + fail_pll0: 406 422 return ret; 407 423 } 408 424
+1
drivers/clk/nxp/clk-lpc32xx.c
··· 67 67 #define LPC32XX_USB_CLK_STS 0xF8 68 68 69 69 static struct regmap_config lpc32xx_scb_regmap_config = { 70 + .name = "scb", 70 71 .reg_bits = 32, 71 72 .val_bits = 32, 72 73 .reg_stride = 4,
+78 -1
drivers/clk/qcom/clk-rpm.c
··· 29 29 30 30 #define QCOM_RPM_MISC_CLK_TYPE 0x306b6c63 31 31 #define QCOM_RPM_SCALING_ENABLE_ID 0x2 32 + #define QCOM_RPM_XO_MODE_ON 0x2 32 33 33 34 #define DEFINE_CLK_RPM(_platform, _name, _active, r_id) \ 34 35 static struct clk_rpm _platform##_##_active; \ ··· 53 52 .ops = &clk_rpm_ops, \ 54 53 .name = #_active, \ 55 54 .parent_names = (const char *[]){ "pxo_board" }, \ 55 + .num_parents = 1, \ 56 + }, \ 57 + } 58 + 59 + #define DEFINE_CLK_RPM_XO_BUFFER(_platform, _name, _active, offset) \ 60 + static struct clk_rpm _platform##_##_name = { \ 61 + .rpm_clk_id = QCOM_RPM_CXO_BUFFERS, \ 62 + .xo_offset = (offset), \ 63 + .hw.init = &(struct clk_init_data){ \ 64 + .ops = &clk_rpm_xo_ops, \ 65 + .name = #_name, \ 66 + .parent_names = (const char *[]){ "cxo_board" }, \ 56 67 .num_parents = 1, \ 57 68 }, \ 58 69 } ··· 139 126 140 127 #define to_clk_rpm(_hw) container_of(_hw, struct clk_rpm, hw) 141 128 129 + struct rpm_cc; 130 + 142 131 struct clk_rpm { 143 132 const int rpm_clk_id; 133 + const int xo_offset; 144 134 const bool active_only; 145 135 unsigned long rate; 146 136 bool enabled; ··· 151 135 struct clk_rpm *peer; 152 136 struct clk_hw hw; 153 137 struct qcom_rpm *rpm; 138 + struct rpm_cc *rpm_cc; 154 139 }; 155 140 156 141 struct rpm_cc { 157 142 struct qcom_rpm *rpm; 158 143 struct clk_rpm **clks; 159 144 size_t num_clks; 145 + u32 xo_buffer_value; 146 + struct mutex xo_lock; 160 147 }; 161 148 162 149 struct rpm_clk_desc { ··· 178 159 * The vendor tree simply reads the status for this 179 160 * RPM clock. 180 161 */ 181 - if (r->rpm_clk_id == QCOM_RPM_PLL_4) 162 + if (r->rpm_clk_id == QCOM_RPM_PLL_4 || 163 + r->rpm_clk_id == QCOM_RPM_CXO_BUFFERS) 182 164 return 0; 183 165 184 166 ret = qcom_rpm_write(r->rpm, QCOM_RPM_ACTIVE_STATE, ··· 308 288 mutex_unlock(&rpm_clk_lock); 309 289 } 310 290 291 + static int clk_rpm_xo_prepare(struct clk_hw *hw) 292 + { 293 + struct clk_rpm *r = to_clk_rpm(hw); 294 + struct rpm_cc *rcc = r->rpm_cc; 295 + int ret, clk_id = r->rpm_clk_id; 296 + u32 value; 297 + 298 + mutex_lock(&rcc->xo_lock); 299 + 300 + value = rcc->xo_buffer_value | (QCOM_RPM_XO_MODE_ON << r->xo_offset); 301 + ret = qcom_rpm_write(r->rpm, QCOM_RPM_ACTIVE_STATE, clk_id, &value, 1); 302 + if (!ret) { 303 + r->enabled = true; 304 + rcc->xo_buffer_value = value; 305 + } 306 + 307 + mutex_unlock(&rcc->xo_lock); 308 + 309 + return ret; 310 + } 311 + 312 + static void clk_rpm_xo_unprepare(struct clk_hw *hw) 313 + { 314 + struct clk_rpm *r = to_clk_rpm(hw); 315 + struct rpm_cc *rcc = r->rpm_cc; 316 + int ret, clk_id = r->rpm_clk_id; 317 + u32 value; 318 + 319 + mutex_lock(&rcc->xo_lock); 320 + 321 + value = rcc->xo_buffer_value & ~(QCOM_RPM_XO_MODE_ON << r->xo_offset); 322 + ret = qcom_rpm_write(r->rpm, QCOM_RPM_ACTIVE_STATE, clk_id, &value, 1); 323 + if (!ret) { 324 + r->enabled = false; 325 + rcc->xo_buffer_value = value; 326 + } 327 + 328 + mutex_unlock(&rcc->xo_lock); 329 + } 330 + 311 331 static int clk_rpm_fixed_prepare(struct clk_hw *hw) 312 332 { 313 333 struct clk_rpm *r = to_clk_rpm(hw); ··· 438 378 return r->rate; 439 379 } 440 380 381 + static const struct clk_ops clk_rpm_xo_ops = { 382 + .prepare = clk_rpm_xo_prepare, 383 + .unprepare = clk_rpm_xo_unprepare, 384 + }; 385 + 441 386 static const struct clk_ops clk_rpm_fixed_ops = { 442 387 .prepare = clk_rpm_fixed_prepare, 443 388 .unprepare = clk_rpm_fixed_unprepare, ··· 514 449 DEFINE_CLK_RPM(apq8064, sfab_clk, sfab_a_clk, QCOM_RPM_SYS_FABRIC_CLK); 515 450 DEFINE_CLK_RPM(apq8064, sfpb_clk, sfpb_a_clk, QCOM_RPM_SFPB_CLK); 516 451 DEFINE_CLK_RPM(apq8064, qdss_clk, qdss_a_clk, QCOM_RPM_QDSS_CLK); 452 + DEFINE_CLK_RPM_XO_BUFFER(apq8064, xo_d0_clk, xo_d0_a_clk, 0); 453 + DEFINE_CLK_RPM_XO_BUFFER(apq8064, xo_d1_clk, xo_d1_a_clk, 8); 454 + DEFINE_CLK_RPM_XO_BUFFER(apq8064, xo_a0_clk, xo_a0_a_clk, 16); 455 + DEFINE_CLK_RPM_XO_BUFFER(apq8064, xo_a1_clk, xo_a1_a_clk, 24); 456 + DEFINE_CLK_RPM_XO_BUFFER(apq8064, xo_a2_clk, xo_a2_a_clk, 28); 517 457 518 458 static struct clk_rpm *apq8064_clks[] = { 519 459 [RPM_APPS_FABRIC_CLK] = &apq8064_afab_clk, ··· 539 469 [RPM_SFPB_A_CLK] = &apq8064_sfpb_a_clk, 540 470 [RPM_QDSS_CLK] = &apq8064_qdss_clk, 541 471 [RPM_QDSS_A_CLK] = &apq8064_qdss_a_clk, 472 + [RPM_XO_D0] = &apq8064_xo_d0_clk, 473 + [RPM_XO_D1] = &apq8064_xo_d1_clk, 474 + [RPM_XO_A0] = &apq8064_xo_a0_clk, 475 + [RPM_XO_A1] = &apq8064_xo_a1_clk, 476 + [RPM_XO_A2] = &apq8064_xo_a2_clk, 542 477 }; 543 478 544 479 static const struct rpm_clk_desc rpm_clk_apq8064 = { ··· 601 526 602 527 rcc->clks = rpm_clks; 603 528 rcc->num_clks = num_clks; 529 + mutex_init(&rcc->xo_lock); 604 530 605 531 for (i = 0; i < num_clks; i++) { 606 532 if (!rpm_clks[i]) 607 533 continue; 608 534 609 535 rpm_clks[i]->rpm = rpm; 536 + rpm_clks[i]->rpm_cc = rcc; 610 537 611 538 ret = clk_rpm_handoff(rpm_clks[i]); 612 539 if (ret)
+10 -2
include/dt-bindings/clock/mt2712-clk.h
··· 222 222 #define CLK_TOP_APLL_DIV_PDN5 183 223 223 #define CLK_TOP_APLL_DIV_PDN6 184 224 224 #define CLK_TOP_APLL_DIV_PDN7 185 225 - #define CLK_TOP_NR_CLK 186 225 + #define CLK_TOP_APLL1_D3 186 226 + #define CLK_TOP_APLL1_REF_SEL 187 227 + #define CLK_TOP_APLL2_REF_SEL 188 228 + #define CLK_TOP_NFI2X_EN 189 229 + #define CLK_TOP_NFIECC_EN 190 230 + #define CLK_TOP_NFI1X_CK_EN 191 231 + #define CLK_TOP_NR_CLK 192 226 232 227 233 /* INFRACFG */ 228 234 ··· 287 281 #define CLK_PERI_MSDC30_3_EN 41 288 282 #define CLK_PERI_MSDC50_0_HCLK_EN 42 289 283 #define CLK_PERI_MSDC50_3_HCLK_EN 43 290 - #define CLK_PERI_NR_CLK 44 284 + #define CLK_PERI_MSDC30_0_QTR_EN 44 285 + #define CLK_PERI_MSDC30_3_QTR_EN 45 286 + #define CLK_PERI_NR_CLK 46 291 287 292 288 /* MCUCFG */ 293 289
+5
include/dt-bindings/clock/qcom,rpmcc.h
··· 40 40 #define RPM_SMI_CLK 22 41 41 #define RPM_SMI_A_CLK 23 42 42 #define RPM_PLL4_CLK 24 43 + #define RPM_XO_D0 25 44 + #define RPM_XO_D1 26 45 + #define RPM_XO_A0 27 46 + #define RPM_XO_A1 28 47 + #define RPM_XO_A2 29 43 48 44 49 /* SMD RPM clocks */ 45 50 #define RPM_SMD_XO_CLK_SRC 0