Commit 1239fd71 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Vinod Koul

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

Each PCIe QMP PHY device provides just a single PCIe PHY. Drop support
for handling multiple child PHYs.
Acked-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org> # UFS, PCIe and USB on SC8180X
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220607213203.2819885-25-dmitry.baryshkov@linaro.orgSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent faf83af5
...@@ -1329,8 +1329,6 @@ struct qmp_phy { ...@@ -1329,8 +1329,6 @@ struct qmp_phy {
* @vregs: regulator supplies bulk data * @vregs: regulator supplies bulk data
* *
* @phys: array of per-lane phy descriptors * @phys: array of per-lane phy descriptors
* @phy_mutex: mutex lock for PHY common block initialization
* @init_count: phy common block initialization count
*/ */
struct qcom_qmp { struct qcom_qmp {
struct device *dev; struct device *dev;
...@@ -1340,9 +1338,6 @@ struct qcom_qmp { ...@@ -1340,9 +1338,6 @@ struct qcom_qmp {
struct regulator_bulk_data *vregs; struct regulator_bulk_data *vregs;
struct qmp_phy **phys; struct qmp_phy **phys;
struct mutex phy_mutex;
int init_count;
}; };
static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val) static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val)
...@@ -1796,17 +1791,11 @@ static int qcom_qmp_phy_pcie_com_init(struct qmp_phy *qphy) ...@@ -1796,17 +1791,11 @@ static int qcom_qmp_phy_pcie_com_init(struct qmp_phy *qphy)
void __iomem *pcs = qphy->pcs; void __iomem *pcs = qphy->pcs;
int ret, i; int ret, i;
mutex_lock(&qmp->phy_mutex);
if (qmp->init_count++) {
mutex_unlock(&qmp->phy_mutex);
return 0;
}
/* turn on regulator supplies */ /* turn on regulator supplies */
ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs); ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs);
if (ret) { if (ret) {
dev_err(qmp->dev, "failed to enable regulators, err=%d\n", ret); dev_err(qmp->dev, "failed to enable regulators, err=%d\n", ret);
goto err_unlock; return ret;
} }
for (i = 0; i < cfg->num_resets; i++) { for (i = 0; i < cfg->num_resets; i++) {
...@@ -1839,8 +1828,6 @@ static int qcom_qmp_phy_pcie_com_init(struct qmp_phy *qphy) ...@@ -1839,8 +1828,6 @@ static int qcom_qmp_phy_pcie_com_init(struct qmp_phy *qphy)
qphy_setbits(pcs, QPHY_POWER_DOWN_CONTROL, qphy_setbits(pcs, QPHY_POWER_DOWN_CONTROL,
cfg->pwrdn_ctrl); cfg->pwrdn_ctrl);
mutex_unlock(&qmp->phy_mutex);
return 0; return 0;
err_assert_reset: err_assert_reset:
...@@ -1848,8 +1835,6 @@ static int qcom_qmp_phy_pcie_com_init(struct qmp_phy *qphy) ...@@ -1848,8 +1835,6 @@ static int qcom_qmp_phy_pcie_com_init(struct qmp_phy *qphy)
reset_control_assert(qmp->resets[i]); reset_control_assert(qmp->resets[i]);
err_disable_regulators: err_disable_regulators:
regulator_bulk_disable(cfg->num_vregs, qmp->vregs); regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
err_unlock:
mutex_unlock(&qmp->phy_mutex);
return ret; return ret;
} }
...@@ -1860,12 +1845,6 @@ static int qcom_qmp_phy_pcie_com_exit(struct qmp_phy *qphy) ...@@ -1860,12 +1845,6 @@ static int qcom_qmp_phy_pcie_com_exit(struct qmp_phy *qphy)
const struct qmp_phy_cfg *cfg = qphy->cfg; const struct qmp_phy_cfg *cfg = qphy->cfg;
int i = cfg->num_resets; int i = cfg->num_resets;
mutex_lock(&qmp->phy_mutex);
if (--qmp->init_count) {
mutex_unlock(&qmp->phy_mutex);
return 0;
}
while (--i >= 0) while (--i >= 0)
reset_control_assert(qmp->resets[i]); reset_control_assert(qmp->resets[i]);
...@@ -1873,8 +1852,6 @@ static int qcom_qmp_phy_pcie_com_exit(struct qmp_phy *qphy) ...@@ -1873,8 +1852,6 @@ static int qcom_qmp_phy_pcie_com_exit(struct qmp_phy *qphy)
regulator_bulk_disable(cfg->num_vregs, qmp->vregs); regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
mutex_unlock(&qmp->phy_mutex);
return 0; return 0;
} }
...@@ -2334,7 +2311,7 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev) ...@@ -2334,7 +2311,7 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev)
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
void __iomem *serdes; void __iomem *serdes;
const struct qmp_phy_cfg *cfg = NULL; const struct qmp_phy_cfg *cfg = NULL;
int num, id, expected_phys; int num, id;
int ret; int ret;
qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL);
...@@ -2354,10 +2331,6 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev) ...@@ -2354,10 +2331,6 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev)
if (IS_ERR(serdes)) if (IS_ERR(serdes))
return PTR_ERR(serdes); return PTR_ERR(serdes);
expected_phys = cfg->nlanes;
mutex_init(&qmp->phy_mutex);
ret = qcom_qmp_phy_pcie_clk_init(dev, cfg); ret = qcom_qmp_phy_pcie_clk_init(dev, cfg);
if (ret) if (ret)
return ret; return ret;
...@@ -2376,7 +2349,7 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev) ...@@ -2376,7 +2349,7 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev)
num = of_get_available_child_count(dev->of_node); num = of_get_available_child_count(dev->of_node);
/* do we have a rogue child node ? */ /* do we have a rogue child node ? */
if (num > expected_phys) if (num > 1)
return -EINVAL; return -EINVAL;
qmp->phys = devm_kcalloc(dev, num, sizeof(*qmp->phys), GFP_KERNEL); qmp->phys = devm_kcalloc(dev, num, sizeof(*qmp->phys), GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment