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

Configure Feed

Select the types of activity you want to include in your feed.

phy: qcom-qmp-usb: drop multi-PHY support

Each USB QMP PHY device provides just a single UFS PHY. Drop support
for handling multiple child PHYs. Use phy->init_count to check if the
PHY was initialized rather than duplicating this count.

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org> # UFS, PCIe and USB on SC8180X
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220607213203.2819885-27-dmitry.baryshkov@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Dmitry Baryshkov and committed by
Vinod Koul
65753f38 1da7115e

+5 -32
+5 -32
drivers/phy/qualcomm/phy-qcom-qmp-usb.c
··· 1440 1440 * @vregs: regulator supplies bulk data 1441 1441 * 1442 1442 * @phys: array of per-lane phy descriptors 1443 - * @phy_mutex: mutex lock for PHY common block initialization 1444 - * @init_count: phy common block initialization count 1445 1443 */ 1446 1444 struct qcom_qmp { 1447 1445 struct device *dev; ··· 1450 1452 struct regulator_bulk_data *vregs; 1451 1453 1452 1454 struct qmp_phy **phys; 1453 - 1454 - struct mutex phy_mutex; 1455 - int init_count; 1456 1455 }; 1457 1456 1458 1457 static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val) ··· 2011 2016 void __iomem *dp_com = qmp->dp_com; 2012 2017 int ret, i; 2013 2018 2014 - mutex_lock(&qmp->phy_mutex); 2015 - if (qmp->init_count++) { 2016 - mutex_unlock(&qmp->phy_mutex); 2017 - return 0; 2018 - } 2019 - 2020 2019 /* turn on regulator supplies */ 2021 2020 ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs); 2022 2021 if (ret) { 2023 2022 dev_err(qmp->dev, "failed to enable regulators, err=%d\n", ret); 2024 - goto err_unlock; 2023 + return ret; 2025 2024 } 2026 2025 2027 2026 for (i = 0; i < cfg->num_resets; i++) { ··· 2071 2082 qphy_setbits(pcs, QPHY_POWER_DOWN_CONTROL, 2072 2083 cfg->pwrdn_ctrl); 2073 2084 2074 - mutex_unlock(&qmp->phy_mutex); 2075 - 2076 2085 return 0; 2077 2086 2078 2087 err_assert_reset: ··· 2078 2091 reset_control_assert(qmp->resets[i]); 2079 2092 err_disable_regulators: 2080 2093 regulator_bulk_disable(cfg->num_vregs, qmp->vregs); 2081 - err_unlock: 2082 - mutex_unlock(&qmp->phy_mutex); 2083 2094 2084 2095 return ret; 2085 2096 } ··· 2088 2103 const struct qmp_phy_cfg *cfg = qphy->cfg; 2089 2104 int i = cfg->num_resets; 2090 2105 2091 - mutex_lock(&qmp->phy_mutex); 2092 - if (--qmp->init_count) { 2093 - mutex_unlock(&qmp->phy_mutex); 2094 - return 0; 2095 - } 2096 - 2097 2106 while (--i >= 0) 2098 2107 reset_control_assert(qmp->resets[i]); 2099 2108 2100 2109 clk_bulk_disable_unprepare(cfg->num_clks, qmp->clks); 2101 2110 2102 2111 regulator_bulk_disable(cfg->num_vregs, qmp->vregs); 2103 - 2104 - mutex_unlock(&qmp->phy_mutex); 2105 2112 2106 2113 return 0; 2107 2114 } ··· 2309 2332 if (cfg->type != PHY_TYPE_USB3) 2310 2333 return 0; 2311 2334 2312 - if (!qmp->init_count) { 2335 + if (!qphy->phy->init_count) { 2313 2336 dev_vdbg(dev, "PHY not initialized, bailing out\n"); 2314 2337 return 0; 2315 2338 } ··· 2335 2358 if (cfg->type != PHY_TYPE_USB3) 2336 2359 return 0; 2337 2360 2338 - if (!qmp->init_count) { 2361 + if (!qphy->phy->init_count) { 2339 2362 dev_vdbg(dev, "PHY not initialized, bailing out\n"); 2340 2363 return 0; 2341 2364 } ··· 2650 2673 struct phy_provider *phy_provider; 2651 2674 void __iomem *serdes; 2652 2675 const struct qmp_phy_cfg *cfg = NULL; 2653 - int num, id, expected_phys; 2676 + int num, id; 2654 2677 int ret; 2655 2678 2656 2679 qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); ··· 2677 2700 return PTR_ERR(qmp->dp_com); 2678 2701 } 2679 2702 2680 - expected_phys = cfg->nlanes; 2681 - 2682 - mutex_init(&qmp->phy_mutex); 2683 - 2684 2703 ret = qcom_qmp_phy_usb_clk_init(dev, cfg); 2685 2704 if (ret) 2686 2705 return ret; ··· 2695 2722 2696 2723 num = of_get_available_child_count(dev->of_node); 2697 2724 /* do we have a rogue child node ? */ 2698 - if (num > expected_phys) 2725 + if (num > 1) 2699 2726 return -EINVAL; 2700 2727 2701 2728 qmp->phys = devm_kcalloc(dev, num, sizeof(*qmp->phys), GFP_KERNEL);