All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Vinod Koul <vkoul@kernel.org>,
	Kishon Vijay Abraham I <kishon@ti.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
	linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org
Subject: [RFC PATCH v3 24/30] phy: qcom-qmp-pcie: drop multi-PHY support
Date: Thu,  2 Jun 2022 10:09:03 +0300	[thread overview]
Message-ID: <20220602070909.1666068-25-dmitry.baryshkov@linaro.org> (raw)
In-Reply-To: <20220602070909.1666068-1-dmitry.baryshkov@linaro.org>

Each PCIe QMP PHY device provides just a single PCIe PHY. Drop support
for handling multiple child PHYs.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 33 +++---------------------
 1 file changed, 3 insertions(+), 30 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
index d9e8a3e88890..0676b67d3ff6 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
@@ -1329,8 +1329,6 @@ struct qmp_phy {
  * @vregs: regulator supplies bulk data
  *
  * @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 device *dev;
@@ -1340,9 +1338,6 @@ struct qcom_qmp {
 	struct regulator_bulk_data *vregs;
 
 	struct qmp_phy **phys;
-
-	struct mutex phy_mutex;
-	int init_count;
 };
 
 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)
 	void __iomem *pcs = qphy->pcs;
 	int ret, i;
 
-	mutex_lock(&qmp->phy_mutex);
-	if (qmp->init_count++) {
-		mutex_unlock(&qmp->phy_mutex);
-		return 0;
-	}
-
 	/* turn on regulator supplies */
 	ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs);
 	if (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++) {
@@ -1839,8 +1828,6 @@ static int qcom_qmp_phy_pcie_com_init(struct qmp_phy *qphy)
 		qphy_setbits(pcs, QPHY_POWER_DOWN_CONTROL,
 				cfg->pwrdn_ctrl);
 
-	mutex_unlock(&qmp->phy_mutex);
-
 	return 0;
 
 err_assert_reset:
@@ -1848,8 +1835,6 @@ static int qcom_qmp_phy_pcie_com_init(struct qmp_phy *qphy)
 		reset_control_assert(qmp->resets[i]);
 err_disable_regulators:
 	regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
-err_unlock:
-	mutex_unlock(&qmp->phy_mutex);
 
 	return ret;
 }
@@ -1860,12 +1845,6 @@ static int qcom_qmp_phy_pcie_com_exit(struct qmp_phy *qphy)
 	const struct qmp_phy_cfg *cfg = qphy->cfg;
 	int i = cfg->num_resets;
 
-	mutex_lock(&qmp->phy_mutex);
-	if (--qmp->init_count) {
-		mutex_unlock(&qmp->phy_mutex);
-		return 0;
-	}
-
 	while (--i >= 0)
 		reset_control_assert(qmp->resets[i]);
 
@@ -1873,8 +1852,6 @@ static int qcom_qmp_phy_pcie_com_exit(struct qmp_phy *qphy)
 
 	regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
 
-	mutex_unlock(&qmp->phy_mutex);
-
 	return 0;
 }
 
@@ -2334,7 +2311,7 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev)
 	struct phy_provider *phy_provider;
 	void __iomem *serdes;
 	const struct qmp_phy_cfg *cfg = NULL;
-	int num, id, expected_phys;
+	int num, id;
 	int ret;
 
 	qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL);
@@ -2354,10 +2331,6 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev)
 	if (IS_ERR(serdes))
 		return PTR_ERR(serdes);
 
-	expected_phys = cfg->nlanes;
-
-	mutex_init(&qmp->phy_mutex);
-
 	ret = qcom_qmp_phy_pcie_clk_init(dev, cfg);
 	if (ret)
 		return ret;
@@ -2376,7 +2349,7 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev)
 
 	num = of_get_available_child_count(dev->of_node);
 	/* do we have a rogue child node ? */
-	if (num > expected_phys)
+	if (num > 1)
 		return -EINVAL;
 
 	qmp->phys = devm_kcalloc(dev, num, sizeof(*qmp->phys), GFP_KERNEL);
-- 
2.35.1


WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Vinod Koul <vkoul@kernel.org>,
	Kishon Vijay Abraham I <kishon@ti.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
	linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org
Subject: [RFC PATCH v3 24/30] phy: qcom-qmp-pcie: drop multi-PHY support
Date: Thu,  2 Jun 2022 10:09:03 +0300	[thread overview]
Message-ID: <20220602070909.1666068-25-dmitry.baryshkov@linaro.org> (raw)
In-Reply-To: <20220602070909.1666068-1-dmitry.baryshkov@linaro.org>

Each PCIe QMP PHY device provides just a single PCIe PHY. Drop support
for handling multiple child PHYs.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 33 +++---------------------
 1 file changed, 3 insertions(+), 30 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
index d9e8a3e88890..0676b67d3ff6 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
@@ -1329,8 +1329,6 @@ struct qmp_phy {
  * @vregs: regulator supplies bulk data
  *
  * @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 device *dev;
@@ -1340,9 +1338,6 @@ struct qcom_qmp {
 	struct regulator_bulk_data *vregs;
 
 	struct qmp_phy **phys;
-
-	struct mutex phy_mutex;
-	int init_count;
 };
 
 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)
 	void __iomem *pcs = qphy->pcs;
 	int ret, i;
 
-	mutex_lock(&qmp->phy_mutex);
-	if (qmp->init_count++) {
-		mutex_unlock(&qmp->phy_mutex);
-		return 0;
-	}
-
 	/* turn on regulator supplies */
 	ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs);
 	if (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++) {
@@ -1839,8 +1828,6 @@ static int qcom_qmp_phy_pcie_com_init(struct qmp_phy *qphy)
 		qphy_setbits(pcs, QPHY_POWER_DOWN_CONTROL,
 				cfg->pwrdn_ctrl);
 
-	mutex_unlock(&qmp->phy_mutex);
-
 	return 0;
 
 err_assert_reset:
@@ -1848,8 +1835,6 @@ static int qcom_qmp_phy_pcie_com_init(struct qmp_phy *qphy)
 		reset_control_assert(qmp->resets[i]);
 err_disable_regulators:
 	regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
-err_unlock:
-	mutex_unlock(&qmp->phy_mutex);
 
 	return ret;
 }
@@ -1860,12 +1845,6 @@ static int qcom_qmp_phy_pcie_com_exit(struct qmp_phy *qphy)
 	const struct qmp_phy_cfg *cfg = qphy->cfg;
 	int i = cfg->num_resets;
 
-	mutex_lock(&qmp->phy_mutex);
-	if (--qmp->init_count) {
-		mutex_unlock(&qmp->phy_mutex);
-		return 0;
-	}
-
 	while (--i >= 0)
 		reset_control_assert(qmp->resets[i]);
 
@@ -1873,8 +1852,6 @@ static int qcom_qmp_phy_pcie_com_exit(struct qmp_phy *qphy)
 
 	regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
 
-	mutex_unlock(&qmp->phy_mutex);
-
 	return 0;
 }
 
@@ -2334,7 +2311,7 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev)
 	struct phy_provider *phy_provider;
 	void __iomem *serdes;
 	const struct qmp_phy_cfg *cfg = NULL;
-	int num, id, expected_phys;
+	int num, id;
 	int ret;
 
 	qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL);
@@ -2354,10 +2331,6 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev)
 	if (IS_ERR(serdes))
 		return PTR_ERR(serdes);
 
-	expected_phys = cfg->nlanes;
-
-	mutex_init(&qmp->phy_mutex);
-
 	ret = qcom_qmp_phy_pcie_clk_init(dev, cfg);
 	if (ret)
 		return ret;
@@ -2376,7 +2349,7 @@ static int qcom_qmp_phy_pcie_probe(struct platform_device *pdev)
 
 	num = of_get_available_child_count(dev->of_node);
 	/* do we have a rogue child node ? */
-	if (num > expected_phys)
+	if (num > 1)
 		return -EINVAL;
 
 	qmp->phys = devm_kcalloc(dev, num, sizeof(*qmp->phys), GFP_KERNEL);
-- 
2.35.1


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  parent reply	other threads:[~2022-06-02  7:09 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02  7:08 [RFC PATCH v3 00/30] phy: qcom-qmp: split the QMP PHY driver Dmitry Baryshkov
2022-06-02  7:08 ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 01/30] phy: qcom-qmp: create copies of " Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 02/30] phy: qcom-qmp-combo: drop all non-combo compatibles support Dmitry Baryshkov
2022-06-06 13:54   ` Bjorn Andersson
2022-06-06 13:54     ` Bjorn Andersson
2022-06-06 14:19     ` Dmitry Baryshkov
2022-06-06 14:19       ` Dmitry Baryshkov
2022-06-06 20:55   ` Bjorn Andersson
2022-06-06 20:55     ` Bjorn Andersson
2022-06-02  7:08 ` [RFC PATCH v3 03/30] phy: qcom-qmp-pcie: drop all non-PCIe " Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 04/30] phy: qcom-qmp-pcie-msm8996: drop all compatibles except msm8996-pcie-phy Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 05/30] phy: qcom-qmp-ufs: drop all non-UFS compatibles support Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 06/30] phy: qcom-qmp-usb: drop all non-USB " Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 07/30] phy: qcom-qmp-combo: change symbol prefix to qcom_qmp_phy_combo Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 08/30] phy: qcom-qmp-pcie: change symbol prefix to qcom_qmp_phy_pcie Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 09/30] phy: qcom-qmp-pcie: change symbol prefix to qcom_qmp_phy_pcie_msm8996 Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 10/30] phy: qcom-qmp-ufs: change symbol prefix to qcom_qmp_phy_ufs Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 11/30] phy: qcom-qmp-usb: change symbol prefix to qcom_qmp_phy_usb Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 12/30] phy: qcom-qmp: switch to new split QMP PHY driver Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 13/30] phy: qcom-qmp: drop old QMP PHY driver source Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 14/30] phy: qcom-qmp-combo: drop support for PCIe,UFS PHY types Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 15/30] phy: qcom-qmp-pcie: drop support for non-PCIe " Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 16/30] phy: qcom-qmp-pcie-msm8996: " Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 17/30] phy: qcom-qmp-ufs: drop support for non-UFS " Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 18/30] phy: qcom-qmp-usb: drop support for non-USB " Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 19/30] phy: qcom-qmp-combo: cleanup the driver Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:08 ` [RFC PATCH v3 20/30] phy: qcom-qmp-pcie: " Dmitry Baryshkov
2022-06-02  7:08   ` Dmitry Baryshkov
2022-06-02  7:09 ` [RFC PATCH v3 21/30] phy: qcom-qmp-pcie-msm8996: " Dmitry Baryshkov
2022-06-02  7:09   ` Dmitry Baryshkov
2022-06-02  7:09 ` [RFC PATCH v3 22/30] phy: qcom-qmp-ufs: " Dmitry Baryshkov
2022-06-02  7:09   ` Dmitry Baryshkov
2022-06-02  7:09 ` [RFC PATCH v3 23/30] phy: qcom-qmp-usb: " Dmitry Baryshkov
2022-06-02  7:09   ` Dmitry Baryshkov
2022-06-02  7:09 ` Dmitry Baryshkov [this message]
2022-06-02  7:09   ` [RFC PATCH v3 24/30] phy: qcom-qmp-pcie: drop multi-PHY support Dmitry Baryshkov
2022-06-02  7:09 ` [RFC PATCH v3 25/30] phy: qcom-qmp-ufs: " Dmitry Baryshkov
2022-06-02  7:09   ` Dmitry Baryshkov
2022-06-02  7:09 ` [RFC PATCH v3 26/30] phy: qcom-qmp-usb: " Dmitry Baryshkov
2022-06-02  7:09   ` Dmitry Baryshkov
2022-06-02  7:09 ` [RFC PATCH v3 27/30] phy: qcom-qmp-combo: use bulk reset_control API Dmitry Baryshkov
2022-06-02  7:09   ` Dmitry Baryshkov
2022-06-02  7:09 ` [RFC PATCH v3 28/30] phy: qcom-qmp-pcie: " Dmitry Baryshkov
2022-06-02  7:09   ` Dmitry Baryshkov
2022-06-02  7:09 ` [RFC PATCH v3 29/30] phy: qcom-qmp-pcie-msm8996: " Dmitry Baryshkov
2022-06-02  7:09   ` Dmitry Baryshkov
2022-06-02  7:09 ` [RFC PATCH v3 30/30] phy: qcom-qmp-usb: " Dmitry Baryshkov
2022-06-02  7:09   ` Dmitry Baryshkov
2022-06-06 20:56 ` [RFC PATCH v3 00/30] phy: qcom-qmp: split the QMP PHY driver Bjorn Andersson
2022-06-06 20:56   ` Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220602070909.1666068-25-dmitry.baryshkov@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=kishon@ti.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=p.zabel@pengutronix.de \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.