linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] phy: qcom-qmp: pipe clock fixes
@ 2022-05-02 13:31 Johan Hovold
  2022-05-02 13:31 ` [PATCH v2 1/2] phy: qcom-qmp: fix pipe-clock imbalance on power-on failure Johan Hovold
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Johan Hovold @ 2022-05-02 13:31 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I
  Cc: Andy Gross, Bjorn Andersson, linux-arm-msm, linux-phy,
	linux-kernel, Johan Hovold

This series fixes a pipe clock imbalance on PHY power-on failures and
renames some error labels in order to improve readability and avoid
future bugs in the same category.

Both patches can be applied for -next.

Johan

Changes in v2:
 - drop kernel doc fix which has been applied
 - split pipe-clock fix from error label rename and rename also the
   remaining labels in qcom_qmp_phy_com_init() in a separate patch

Johan Hovold (2):
  phy: qcom-qmp: fix pipe-clock imbalance on power-on failure
  phy: qcom-qmp: rename error labels

 drivers/phy/qualcomm/phy-qcom-qmp.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] phy: qcom-qmp: fix pipe-clock imbalance on power-on failure
  2022-05-02 13:31 [PATCH v2 0/2] phy: qcom-qmp: pipe clock fixes Johan Hovold
@ 2022-05-02 13:31 ` Johan Hovold
  2022-05-02 13:31 ` [PATCH v2 2/2] phy: qcom-qmp: rename error labels Johan Hovold
  2022-05-03  4:42 ` [PATCH v2 0/2] phy: qcom-qmp: pipe clock fixes Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2022-05-02 13:31 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I
  Cc: Andy Gross, Bjorn Andersson, linux-arm-msm, linux-phy,
	linux-kernel, Johan Hovold, Evan Green

Make sure to disable the pipe clock also if ufs-reset deassertion fails
during power on.

Note that the ufs-reset is asserted in qcom_qmp_phy_com_exit().

Fixes: c9b589791fc1 ("phy: qcom: Utilize UFS reset controller")
Cc: Evan Green <evgreen@chromium.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index 8c2300bfe489..c37c0d8fea4e 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -5433,7 +5433,7 @@ static int qcom_qmp_phy_power_on(struct phy *phy)
 
 	ret = reset_control_deassert(qmp->ufs_reset);
 	if (ret)
-		goto err_lane_rst;
+		goto err_pcs_ready;
 
 	qcom_qmp_phy_configure(pcs_misc, cfg->regs, cfg->pcs_misc_tbl,
 			       cfg->pcs_misc_tbl_num);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] phy: qcom-qmp: rename error labels
  2022-05-02 13:31 [PATCH v2 0/2] phy: qcom-qmp: pipe clock fixes Johan Hovold
  2022-05-02 13:31 ` [PATCH v2 1/2] phy: qcom-qmp: fix pipe-clock imbalance on power-on failure Johan Hovold
@ 2022-05-02 13:31 ` Johan Hovold
  2022-05-03  4:42 ` [PATCH v2 0/2] phy: qcom-qmp: pipe clock fixes Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2022-05-02 13:31 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I
  Cc: Andy Gross, Bjorn Andersson, linux-arm-msm, linux-phy,
	linux-kernel, Johan Hovold

Rename all error labels after what they are used for in order to improve
readability and for consistency.

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index c37c0d8fea4e..515e3ec64e17 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -5199,7 +5199,7 @@ static int qcom_qmp_phy_com_init(struct qmp_phy *qphy)
 	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_reg_enable;
+		goto err_unlock;
 	}
 
 	for (i = 0; i < cfg->num_resets; i++) {
@@ -5207,7 +5207,7 @@ static int qcom_qmp_phy_com_init(struct qmp_phy *qphy)
 		if (ret) {
 			dev_err(qmp->dev, "%s reset assert failed\n",
 				cfg->reset_list[i]);
-			goto err_rst_assert;
+			goto err_disable_regulators;
 		}
 	}
 
@@ -5216,13 +5216,13 @@ static int qcom_qmp_phy_com_init(struct qmp_phy *qphy)
 		if (ret) {
 			dev_err(qmp->dev, "%s reset deassert failed\n",
 				qphy->cfg->reset_list[i]);
-			goto err_rst;
+			goto err_assert_reset;
 		}
 	}
 
 	ret = clk_bulk_prepare_enable(cfg->num_clks, qmp->clks);
 	if (ret)
-		goto err_rst;
+		goto err_assert_reset;
 
 	if (cfg->has_phy_dp_com_ctrl) {
 		qphy_setbits(dp_com, QPHY_V3_DP_COM_POWER_DOWN_CTRL,
@@ -5264,12 +5264,12 @@ static int qcom_qmp_phy_com_init(struct qmp_phy *qphy)
 
 	return 0;
 
-err_rst:
+err_assert_reset:
 	while (++i < cfg->num_resets)
 		reset_control_assert(qmp->resets[i]);
-err_rst_assert:
+err_disable_regulators:
 	regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
-err_reg_enable:
+err_unlock:
 	mutex_unlock(&qmp->phy_mutex);
 
 	return ret;
@@ -5375,14 +5375,14 @@ static int qcom_qmp_phy_power_on(struct phy *phy)
 		if (ret) {
 			dev_err(qmp->dev, "lane%d reset deassert failed\n",
 				qphy->index);
-			goto err_lane_rst;
+			return ret;
 		}
 	}
 
 	ret = clk_prepare_enable(qphy->pipe_clk);
 	if (ret) {
 		dev_err(qmp->dev, "pipe_clk enable failed err=%d\n", ret);
-		goto err_clk_enable;
+		goto err_reset_lane;
 	}
 
 	/* Tx, Rx, and PCS configurations */
@@ -5433,7 +5433,7 @@ static int qcom_qmp_phy_power_on(struct phy *phy)
 
 	ret = reset_control_deassert(qmp->ufs_reset);
 	if (ret)
-		goto err_pcs_ready;
+		goto err_disable_pipe_clk;
 
 	qcom_qmp_phy_configure(pcs_misc, cfg->regs, cfg->pcs_misc_tbl,
 			       cfg->pcs_misc_tbl_num);
@@ -5472,17 +5472,17 @@ static int qcom_qmp_phy_power_on(struct phy *phy)
 					 PHY_INIT_COMPLETE_TIMEOUT);
 		if (ret) {
 			dev_err(qmp->dev, "phy initialization timed-out\n");
-			goto err_pcs_ready;
+			goto err_disable_pipe_clk;
 		}
 	}
 	return 0;
 
-err_pcs_ready:
+err_disable_pipe_clk:
 	clk_disable_unprepare(qphy->pipe_clk);
-err_clk_enable:
+err_reset_lane:
 	if (cfg->has_lane_rst)
 		reset_control_assert(qphy->lane_rst);
-err_lane_rst:
+
 	return ret;
 }
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] phy: qcom-qmp: pipe clock fixes
  2022-05-02 13:31 [PATCH v2 0/2] phy: qcom-qmp: pipe clock fixes Johan Hovold
  2022-05-02 13:31 ` [PATCH v2 1/2] phy: qcom-qmp: fix pipe-clock imbalance on power-on failure Johan Hovold
  2022-05-02 13:31 ` [PATCH v2 2/2] phy: qcom-qmp: rename error labels Johan Hovold
@ 2022-05-03  4:42 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2022-05-03  4:42 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Kishon Vijay Abraham I, Andy Gross, Bjorn Andersson,
	linux-arm-msm, linux-phy, linux-kernel

On 02-05-22, 15:31, Johan Hovold wrote:
> This series fixes a pipe clock imbalance on PHY power-on failures and
> renames some error labels in order to improve readability and avoid
> future bugs in the same category.
> 
> Both patches can be applied for -next.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-03  4:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02 13:31 [PATCH v2 0/2] phy: qcom-qmp: pipe clock fixes Johan Hovold
2022-05-02 13:31 ` [PATCH v2 1/2] phy: qcom-qmp: fix pipe-clock imbalance on power-on failure Johan Hovold
2022-05-02 13:31 ` [PATCH v2 2/2] phy: qcom-qmp: rename error labels Johan Hovold
2022-05-03  4:42 ` [PATCH v2 0/2] phy: qcom-qmp: pipe clock fixes Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).