patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes
@ 2023-01-13 20:45 Stephen Boyd
  2023-01-13 20:45 ` [PATCH 5.15.y v2 1/5] phy: qcom-qmp-combo: disable runtime PM on unbind Stephen Boyd
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Stephen Boyd @ 2023-01-13 20:45 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, patches, Johan Hovold, Dmitry Baryshkov, Vinod Koul

After the qmp phy driver was split it looks like 5.15.y stable kernels
aren't getting fixes like commit 7a7d86d14d07 ("phy: qcom-qmp-combo: fix
broken power on") which is tagged for stable 5.10. Trogdor boards use
the qmp phy on 5.15.y kernels, so I backported the fixes I could find
that looked like we may possibly trip over at some point.

USB and DP work on my Trogdor.Lazor board with this set.

Changes from v1 (https://lore.kernel.org/r/20230113005405.3992011-1-swboyd@chromium.org):
 * New patch for memleak on probe deferal to avoid compat issues
 * Update "fix broken power on" patch for pcie/ufs phy

Johan Hovold (5):
  phy: qcom-qmp-combo: disable runtime PM on unbind
  phy: qcom-qmp-combo: fix memleak on probe deferral
  phy: qcom-qmp-usb: fix memleak on probe deferral
  phy: qcom-qmp-combo: fix broken power on
  phy: qcom-qmp-combo: fix runtime suspend

 drivers/phy/qualcomm/phy-qcom-qmp.c | 97 ++++++++++++++++++-----------
 1 file changed, 61 insertions(+), 36 deletions(-)

Cc: Johan Hovold <johan+linaro@kernel.org>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Vinod Koul <vkoul@kernel.org>

base-commit: d57287729e229188e7d07ef0117fe927664e08cb
-- 
https://chromeos.dev


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

* [PATCH 5.15.y v2 1/5] phy: qcom-qmp-combo: disable runtime PM on unbind
  2023-01-13 20:45 [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes Stephen Boyd
@ 2023-01-13 20:45 ` Stephen Boyd
  2023-01-13 20:45 ` [PATCH 5.15.y v2 2/5] phy: qcom-qmp-combo: fix memleak on probe deferral Stephen Boyd
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2023-01-13 20:45 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, linux-kernel, patches, Dmitry Baryshkov, Vinod Koul

From: Johan Hovold <johan+linaro@kernel.org>

commit 4382d518d1887e62234560ea08a0203d11d28cc1 upstream.

Make sure to disable runtime PM also on driver unbind.

Fixes: ac0d239936bd ("phy: qcom-qmp: Add support for runtime PM").
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220907110728.19092-2-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index a9687e040960..7b7557c35af6 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -5740,7 +5740,9 @@ static int qcom_qmp_phy_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	pm_runtime_set_active(dev);
-	pm_runtime_enable(dev);
+	ret = devm_pm_runtime_enable(dev);
+	if (ret)
+		return ret;
 	/*
 	 * Prevent runtime pm from being ON by default. Users can enable
 	 * it using power/control in sysfs.
@@ -5790,13 +5792,10 @@ static int qcom_qmp_phy_probe(struct platform_device *pdev)
 	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
 	if (!IS_ERR(phy_provider))
 		dev_info(dev, "Registered Qcom-QMP phy\n");
-	else
-		pm_runtime_disable(dev);
 
 	return PTR_ERR_OR_ZERO(phy_provider);
 
 err_node_put:
-	pm_runtime_disable(dev);
 	of_node_put(child);
 	return ret;
 }
-- 
https://chromeos.dev


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

* [PATCH 5.15.y v2 2/5] phy: qcom-qmp-combo: fix memleak on probe deferral
  2023-01-13 20:45 [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes Stephen Boyd
  2023-01-13 20:45 ` [PATCH 5.15.y v2 1/5] phy: qcom-qmp-combo: disable runtime PM on unbind Stephen Boyd
@ 2023-01-13 20:45 ` Stephen Boyd
  2023-01-13 20:45 ` [PATCH 5.15.y v2 3/5] phy: qcom-qmp-usb: " Stephen Boyd
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2023-01-13 20:45 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, linux-kernel, patches, Vinod Koul

From: Johan Hovold <johan+linaro@kernel.org>

commit 2de8a325b1084330ae500380cc27edc39f488c30 upstream.

Switch to using the device-managed of_iomap helper to avoid leaking
memory on probe deferral and driver unbind.

Note that this helper checks for already reserved regions and may fail
if there are multiple devices claiming the same memory.

Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20220916102340.11520-5-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 32 +++++++++++++++--------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index 7b7557c35af6..c6f860ce3d99 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -5410,17 +5410,17 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id,
 	 * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5
 	 * For single lane PHYs: pcs_misc (optional) -> 3.
 	 */
-	qphy->tx = of_iomap(np, 0);
-	if (!qphy->tx)
-		return -ENOMEM;
+	qphy->tx = devm_of_iomap(dev, np, 0, NULL);
+	if (IS_ERR(qphy->tx))
+		return PTR_ERR(qphy->tx);
 
-	qphy->rx = of_iomap(np, 1);
-	if (!qphy->rx)
-		return -ENOMEM;
+	qphy->rx = devm_of_iomap(dev, np, 1, NULL);
+	if (IS_ERR(qphy->rx))
+		return PTR_ERR(qphy->rx);
 
-	qphy->pcs = of_iomap(np, 2);
-	if (!qphy->pcs)
-		return -ENOMEM;
+	qphy->pcs = devm_of_iomap(dev, np, 2, NULL);
+	if (IS_ERR(qphy->pcs))
+		return PTR_ERR(qphy->pcs);
 
 	/*
 	 * If this is a dual-lane PHY, then there should be registers for the
@@ -5429,9 +5429,9 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id,
 	 * offset from the first lane.
 	 */
 	if (cfg->is_dual_lane_phy) {
-		qphy->tx2 = of_iomap(np, 3);
-		qphy->rx2 = of_iomap(np, 4);
-		if (!qphy->tx2 || !qphy->rx2) {
+		qphy->tx2 = devm_of_iomap(dev, np, 3, NULL);
+		qphy->rx2 = devm_of_iomap(dev, np, 4, NULL);
+		if (IS_ERR(qphy->tx2) || IS_ERR(qphy->rx2)) {
 			dev_warn(dev,
 				 "Underspecified device tree, falling back to legacy register regions\n");
 
@@ -5441,15 +5441,17 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id,
 			qphy->rx2 = qphy->rx + QMP_PHY_LEGACY_LANE_STRIDE;
 
 		} else {
-			qphy->pcs_misc = of_iomap(np, 5);
+			qphy->pcs_misc = devm_of_iomap(dev, np, 5, NULL);
 		}
 
 	} else {
-		qphy->pcs_misc = of_iomap(np, 3);
+		qphy->pcs_misc = devm_of_iomap(dev, np, 3, NULL);
 	}
 
-	if (!qphy->pcs_misc)
+	if (IS_ERR(qphy->pcs_misc)) {
 		dev_vdbg(dev, "PHY pcs_misc-reg not used\n");
+		qphy->pcs_misc = NULL;
+	}
 
 	/*
 	 * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
-- 
https://chromeos.dev


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

* [PATCH 5.15.y v2 3/5] phy: qcom-qmp-usb: fix memleak on probe deferral
  2023-01-13 20:45 [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes Stephen Boyd
  2023-01-13 20:45 ` [PATCH 5.15.y v2 1/5] phy: qcom-qmp-combo: disable runtime PM on unbind Stephen Boyd
  2023-01-13 20:45 ` [PATCH 5.15.y v2 2/5] phy: qcom-qmp-combo: fix memleak on probe deferral Stephen Boyd
@ 2023-01-13 20:45 ` Stephen Boyd
  2023-01-13 20:45 ` [PATCH 5.15.y v2 4/5] phy: qcom-qmp-combo: fix broken power on Stephen Boyd
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2023-01-13 20:45 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, linux-kernel, patches, Vinod Koul

From: Johan Hovold <johan+linaro@kernel.org>

commit a5d6b1ac56cbd6b5850a3a54e35f1cb71e8e8cdd upstream.

Switch to using the device-managed of_iomap helper to avoid leaking
memory on probe deferral and driver unbind.

Note that this helper checks for already reserved regions and may fail
if there are multiple devices claiming the same memory.

Two bindings currently rely on overlapping mappings for the PCS region
so fallback to non-exclusive mappings for those for now.

Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20220916102340.11520-7-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
[swboyd@chromium.org: Backport to pre-split driver]
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index c6f860ce3d99..ee4fd7afcea2 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -5387,6 +5387,21 @@ static void qcom_qmp_reset_control_put(void *data)
 	reset_control_put(data);
 }
 
+static void __iomem *qmp_usb_iomap(struct device *dev, struct device_node *np,
+		int index, bool exclusive)
+{
+	struct resource res;
+
+	if (!exclusive) {
+		if (of_address_to_resource(np, index, &res))
+			return IOMEM_ERR_PTR(-EINVAL);
+
+		return devm_ioremap(dev, res.start, resource_size(&res));
+	}
+
+	return devm_of_iomap(dev, np, index, NULL);
+}
+
 static
 int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id,
 			void __iomem *serdes, const struct qmp_phy_cfg *cfg)
@@ -5396,8 +5411,18 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id,
 	struct qmp_phy *qphy;
 	const struct phy_ops *ops;
 	char prop_name[MAX_PROP_NAME];
+	bool exclusive = true;
 	int ret;
 
+	/*
+	 * FIXME: These bindings should be fixed to not rely on overlapping
+	 *        mappings for PCS.
+	 */
+	if (of_device_is_compatible(dev->of_node, "qcom,sdx65-qmp-usb3-uni-phy"))
+		exclusive = false;
+	if (of_device_is_compatible(dev->of_node, "qcom,sm8350-qmp-usb3-uni-phy"))
+		exclusive = false;
+
 	qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL);
 	if (!qphy)
 		return -ENOMEM;
@@ -5418,7 +5443,7 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id,
 	if (IS_ERR(qphy->rx))
 		return PTR_ERR(qphy->rx);
 
-	qphy->pcs = devm_of_iomap(dev, np, 2, NULL);
+	qphy->pcs = qmp_usb_iomap(dev, np, 2, exclusive);
 	if (IS_ERR(qphy->pcs))
 		return PTR_ERR(qphy->pcs);
 
-- 
https://chromeos.dev


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

* [PATCH 5.15.y v2 4/5] phy: qcom-qmp-combo: fix broken power on
  2023-01-13 20:45 [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes Stephen Boyd
                   ` (2 preceding siblings ...)
  2023-01-13 20:45 ` [PATCH 5.15.y v2 3/5] phy: qcom-qmp-usb: " Stephen Boyd
@ 2023-01-13 20:45 ` Stephen Boyd
  2023-01-13 20:45 ` [PATCH 5.15.y v2 5/5] phy: qcom-qmp-combo: fix runtime suspend Stephen Boyd
  2023-01-22 14:23 ` [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes Greg KH
  5 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2023-01-13 20:45 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, linux-kernel, patches, Dmitry Baryshkov, Vinod Koul

From: Johan Hovold <johan+linaro@kernel.org>

commit 7a7d86d14d073dfa3429c550667a8e78b99edbd4 upstream.

The PHY is powered on during phy-init by setting the SW_PWRDN bit in the
COM_POWER_DOWN_CTRL register and then setting the same bit in the in the
PCS_POWER_DOWN_CONTROL register that belongs to the USB part of the
PHY.

Currently, whether power on succeeds depends on probe order and having
the USB part of the PHY be initialised first. In case the DP part of the
PHY is instead initialised first, the intended power on of the USB block
results in a corrupted DP_PHY register (e.g. DP_PHY_AUX_CFG8).

Add a pointer to the USB part of the PHY to the driver data and use that
to power on the PHY also if the DP part of the PHY is initialised first.

Fixes: 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo phy")
Cc: stable@vger.kernel.org	# 5.10
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20221114081346.5116-5-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
[swboyd@chromium.org: Backport to pre-split driver, also set usb_phy for
pcie/ufs]
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index ee4fd7afcea2..b8646eaf1767 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -2919,6 +2919,7 @@ struct qcom_qmp {
 	struct regulator_bulk_data *vregs;
 
 	struct qmp_phy **phys;
+	struct qmp_phy *usb_phy;
 
 	struct mutex phy_mutex;
 	int init_count;
@@ -4554,7 +4555,7 @@ static int qcom_qmp_phy_com_init(struct qmp_phy *qphy)
 	struct qcom_qmp *qmp = qphy->qmp;
 	const struct qmp_phy_cfg *cfg = qphy->cfg;
 	void __iomem *serdes = qphy->serdes;
-	void __iomem *pcs = qphy->pcs;
+	struct qmp_phy *usb_phy = qmp->usb_phy;
 	void __iomem *dp_com = qmp->dp_com;
 	int ret, i;
 
@@ -4620,13 +4621,13 @@ static int qcom_qmp_phy_com_init(struct qmp_phy *qphy)
 		qphy_setbits(serdes, cfg->regs[QPHY_COM_POWER_DOWN_CONTROL],
 			     SW_PWRDN);
 	} else {
-		if (cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL])
-			qphy_setbits(pcs,
-					cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
-					cfg->pwrdn_ctrl);
+		if (usb_phy->cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL])
+			qphy_setbits(usb_phy->pcs,
+					usb_phy->cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+					usb_phy->cfg->pwrdn_ctrl);
 		else
-			qphy_setbits(pcs, QPHY_POWER_DOWN_CONTROL,
-					cfg->pwrdn_ctrl);
+			qphy_setbits(usb_phy->pcs, QPHY_POWER_DOWN_CONTROL,
+					usb_phy->cfg->pwrdn_ctrl);
 	}
 
 	mutex_unlock(&qmp->phy_mutex);
@@ -5794,6 +5795,9 @@ static int qcom_qmp_phy_probe(struct platform_device *pdev)
 			goto err_node_put;
 		}
 
+		if (cfg->type != PHY_TYPE_DP)
+			qmp->usb_phy = qmp->phys[id];
+
 		/*
 		 * Register the pipe clock provided by phy.
 		 * See function description to see details of this pipe clock.
@@ -5816,6 +5820,9 @@ static int qcom_qmp_phy_probe(struct platform_device *pdev)
 		id++;
 	}
 
+	if (!qmp->usb_phy)
+		return -EINVAL;
+
 	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
 	if (!IS_ERR(phy_provider))
 		dev_info(dev, "Registered Qcom-QMP phy\n");
-- 
https://chromeos.dev


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

* [PATCH 5.15.y v2 5/5] phy: qcom-qmp-combo: fix runtime suspend
  2023-01-13 20:45 [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes Stephen Boyd
                   ` (3 preceding siblings ...)
  2023-01-13 20:45 ` [PATCH 5.15.y v2 4/5] phy: qcom-qmp-combo: fix broken power on Stephen Boyd
@ 2023-01-13 20:45 ` Stephen Boyd
  2023-01-23 10:48   ` Johan Hovold
  2023-01-22 14:23 ` [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes Greg KH
  5 siblings, 1 reply; 10+ messages in thread
From: Stephen Boyd @ 2023-01-13 20:45 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, linux-kernel, patches, Dmitry Baryshkov, Vinod Koul

From: Johan Hovold <johan+linaro@kernel.org>

commit c7b98de745cffdceefc077ad5cf9cda032ef8959 upstream.

Drop the confused runtime-suspend type check which effectively broke
runtime PM if the DP child node happens to be parsed before the USB
child node during probe (e.g. due to order of child nodes in the
devicetree).

Instead use the new driver data USB PHY pointer to access the USB
configuration and resources.

Fixes: 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo phy")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20221114081346.5116-6-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
[swboyd@chromium.org: Backport to pre-split driver]
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index b8646eaf1767..64a42e28e99f 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -4985,15 +4985,11 @@ static void qcom_qmp_phy_disable_autonomous_mode(struct qmp_phy *qphy)
 static int __maybe_unused qcom_qmp_phy_runtime_suspend(struct device *dev)
 {
 	struct qcom_qmp *qmp = dev_get_drvdata(dev);
-	struct qmp_phy *qphy = qmp->phys[0];
+	struct qmp_phy *qphy = qmp->usb_phy;
 	const struct qmp_phy_cfg *cfg = qphy->cfg;
 
 	dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qphy->mode);
 
-	/* Supported only for USB3 PHY and luckily USB3 is the first phy */
-	if (cfg->type != PHY_TYPE_USB3)
-		return 0;
-
 	if (!qmp->init_count) {
 		dev_vdbg(dev, "PHY not initialized, bailing out\n");
 		return 0;
@@ -5010,16 +5006,12 @@ static int __maybe_unused qcom_qmp_phy_runtime_suspend(struct device *dev)
 static int __maybe_unused qcom_qmp_phy_runtime_resume(struct device *dev)
 {
 	struct qcom_qmp *qmp = dev_get_drvdata(dev);
-	struct qmp_phy *qphy = qmp->phys[0];
+	struct qmp_phy *qphy = qmp->usb_phy;
 	const struct qmp_phy_cfg *cfg = qphy->cfg;
 	int ret = 0;
 
 	dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qphy->mode);
 
-	/* Supported only for USB3 PHY and luckily USB3 is the first phy */
-	if (cfg->type != PHY_TYPE_USB3)
-		return 0;
-
 	if (!qmp->init_count) {
 		dev_vdbg(dev, "PHY not initialized, bailing out\n");
 		return 0;
-- 
https://chromeos.dev


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

* Re: [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes
  2023-01-13 20:45 [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes Stephen Boyd
                   ` (4 preceding siblings ...)
  2023-01-13 20:45 ` [PATCH 5.15.y v2 5/5] phy: qcom-qmp-combo: fix runtime suspend Stephen Boyd
@ 2023-01-22 14:23 ` Greg KH
  2023-02-02 22:27   ` Stephen Boyd
  5 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2023-01-22 14:23 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: stable, linux-kernel, patches, Johan Hovold, Dmitry Baryshkov,
	Vinod Koul

On Fri, Jan 13, 2023 at 12:45:43PM -0800, Stephen Boyd wrote:
> After the qmp phy driver was split it looks like 5.15.y stable kernels
> aren't getting fixes like commit 7a7d86d14d07 ("phy: qcom-qmp-combo: fix
> broken power on") which is tagged for stable 5.10. Trogdor boards use
> the qmp phy on 5.15.y kernels, so I backported the fixes I could find
> that looked like we may possibly trip over at some point.
> 
> USB and DP work on my Trogdor.Lazor board with this set.
> 
> Changes from v1 (https://lore.kernel.org/r/20230113005405.3992011-1-swboyd@chromium.org):
>  * New patch for memleak on probe deferal to avoid compat issues
>  * Update "fix broken power on" patch for pcie/ufs phy
> 
> Johan Hovold (5):
>   phy: qcom-qmp-combo: disable runtime PM on unbind
>   phy: qcom-qmp-combo: fix memleak on probe deferral
>   phy: qcom-qmp-usb: fix memleak on probe deferral
>   phy: qcom-qmp-combo: fix broken power on
>   phy: qcom-qmp-combo: fix runtime suspend
> 
>  drivers/phy/qualcomm/phy-qcom-qmp.c | 97 ++++++++++++++++++-----------
>  1 file changed, 61 insertions(+), 36 deletions(-)
> 
> Cc: Johan Hovold <johan+linaro@kernel.org>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Vinod Koul <vkoul@kernel.org>
> 
> base-commit: d57287729e229188e7d07ef0117fe927664e08cb
> -- 
> https://chromeos.dev
> 

For obvious reasons, I can't take this series if newer kernel releases
do not also contain all of these (no would you want me to.)

So can you please also provide a backported series for 6.1.y so that
these can be considered?

thanks,

greg k-h

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

* Re: [PATCH 5.15.y v2 5/5] phy: qcom-qmp-combo: fix runtime suspend
  2023-01-13 20:45 ` [PATCH 5.15.y v2 5/5] phy: qcom-qmp-combo: fix runtime suspend Stephen Boyd
@ 2023-01-23 10:48   ` Johan Hovold
  2023-02-02 21:49     ` Stephen Boyd
  0 siblings, 1 reply; 10+ messages in thread
From: Johan Hovold @ 2023-01-23 10:48 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: stable, Johan Hovold, linux-kernel, patches, Dmitry Baryshkov,
	Vinod Koul

On Fri, Jan 13, 2023 at 12:45:48PM -0800, Stephen Boyd wrote:
> From: Johan Hovold <johan+linaro@kernel.org>
> 
> commit c7b98de745cffdceefc077ad5cf9cda032ef8959 upstream.
> 
> Drop the confused runtime-suspend type check which effectively broke
> runtime PM if the DP child node happens to be parsed before the USB
> child node during probe (e.g. due to order of child nodes in the
> devicetree).
> 
> Instead use the new driver data USB PHY pointer to access the USB
> configuration and resources.
> 
> Fixes: 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo phy")
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> Link: https://lore.kernel.org/r/20221114081346.5116-6-johan+linaro@kernel.org
> Signed-off-by: Vinod Koul <vkoul@kernel.org>
> [swboyd@chromium.org: Backport to pre-split driver]
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  drivers/phy/qualcomm/phy-qcom-qmp.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
> index b8646eaf1767..64a42e28e99f 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
> @@ -4985,15 +4985,11 @@ static void qcom_qmp_phy_disable_autonomous_mode(struct qmp_phy *qphy)
>  static int __maybe_unused qcom_qmp_phy_runtime_suspend(struct device *dev)
>  {
>  	struct qcom_qmp *qmp = dev_get_drvdata(dev);
> -	struct qmp_phy *qphy = qmp->phys[0];
> +	struct qmp_phy *qphy = qmp->usb_phy;
>  	const struct qmp_phy_cfg *cfg = qphy->cfg;
>  
>  	dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qphy->mode);
>  
> -	/* Supported only for USB3 PHY and luckily USB3 is the first phy */
> -	if (cfg->type != PHY_TYPE_USB3)
> -		return 0;

This is still not correct as this code would now be executed also for
PCIe and UFS PHYs, which wasn't the case before.

> -
>  	if (!qmp->init_count) {
>  		dev_vdbg(dev, "PHY not initialized, bailing out\n");
>  		return 0;

Johan

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

* Re: [PATCH 5.15.y v2 5/5] phy: qcom-qmp-combo: fix runtime suspend
  2023-01-23 10:48   ` Johan Hovold
@ 2023-02-02 21:49     ` Stephen Boyd
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2023-02-02 21:49 UTC (permalink / raw)
  To: Johan Hovold
  Cc: stable, Johan Hovold, linux-kernel, patches, Dmitry Baryshkov,
	Vinod Koul

Quoting Johan Hovold (2023-01-23 02:48:01)
> On Fri, Jan 13, 2023 at 12:45:48PM -0800, Stephen Boyd wrote:
> > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
> > index b8646eaf1767..64a42e28e99f 100644
> > --- a/drivers/phy/qualcomm/phy-qcom-qmp.c
> > +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
> > @@ -4985,15 +4985,11 @@ static void qcom_qmp_phy_disable_autonomous_mode(struct qmp_phy *qphy)
> >  static int __maybe_unused qcom_qmp_phy_runtime_suspend(struct device *dev)
> >  {
> >       struct qcom_qmp *qmp = dev_get_drvdata(dev);
> > -     struct qmp_phy *qphy = qmp->phys[0];
> > +     struct qmp_phy *qphy = qmp->usb_phy;
> >       const struct qmp_phy_cfg *cfg = qphy->cfg;
> >
> >       dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qphy->mode);
> >
> > -     /* Supported only for USB3 PHY and luckily USB3 is the first phy */
> > -     if (cfg->type != PHY_TYPE_USB3)
> > -             return 0;
>
> This is still not correct as this code would now be executed also for
> PCIe and UFS PHYs, which wasn't the case before.

Ah right. So weirdly, the conditional should be kept.

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

* Re: [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes
  2023-01-22 14:23 ` [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes Greg KH
@ 2023-02-02 22:27   ` Stephen Boyd
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2023-02-02 22:27 UTC (permalink / raw)
  To: Greg KH
  Cc: stable, linux-kernel, patches, Johan Hovold, Dmitry Baryshkov,
	Vinod Koul

Quoting Greg KH (2023-01-22 06:23:25)
> On Fri, Jan 13, 2023 at 12:45:43PM -0800, Stephen Boyd wrote:
> > After the qmp phy driver was split it looks like 5.15.y stable kernels
> > aren't getting fixes like commit 7a7d86d14d07 ("phy: qcom-qmp-combo: fix
> > broken power on") which is tagged for stable 5.10. Trogdor boards use
> > the qmp phy on 5.15.y kernels, so I backported the fixes I could find
> > that looked like we may possibly trip over at some point.
> >
> > USB and DP work on my Trogdor.Lazor board with this set.
> >
> > Changes from v1 (https://lore.kernel.org/r/20230113005405.3992011-1-swboyd@chromium.org):
> >  * New patch for memleak on probe deferal to avoid compat issues
> >  * Update "fix broken power on" patch for pcie/ufs phy
> >
> > Johan Hovold (5):
> >   phy: qcom-qmp-combo: disable runtime PM on unbind
> >   phy: qcom-qmp-combo: fix memleak on probe deferral
> >   phy: qcom-qmp-usb: fix memleak on probe deferral
> >   phy: qcom-qmp-combo: fix broken power on
> >   phy: qcom-qmp-combo: fix runtime suspend
> >
> >  drivers/phy/qualcomm/phy-qcom-qmp.c | 97 ++++++++++++++++++-----------
> >  1 file changed, 61 insertions(+), 36 deletions(-)
> >
> > Cc: Johan Hovold <johan+linaro@kernel.org>
> > Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > Cc: Vinod Koul <vkoul@kernel.org>
> >
> > base-commit: d57287729e229188e7d07ef0117fe927664e08cb
> > --
> > https://chromeos.dev
> >
>
> For obvious reasons, I can't take this series if newer kernel releases
> do not also contain all of these (no would you want me to.)
>
> So can you please also provide a backported series for 6.1.y so that
> these can be considered?

Sure. All of the patches have been applied to 6.1.y except for the last
one, which picks cleanly, c7b98de745cf ("phy: qcom-qmp-combo: fix
runtime suspend"). I can send that over.

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

end of thread, other threads:[~2023-02-02 22:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 20:45 [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes Stephen Boyd
2023-01-13 20:45 ` [PATCH 5.15.y v2 1/5] phy: qcom-qmp-combo: disable runtime PM on unbind Stephen Boyd
2023-01-13 20:45 ` [PATCH 5.15.y v2 2/5] phy: qcom-qmp-combo: fix memleak on probe deferral Stephen Boyd
2023-01-13 20:45 ` [PATCH 5.15.y v2 3/5] phy: qcom-qmp-usb: " Stephen Boyd
2023-01-13 20:45 ` [PATCH 5.15.y v2 4/5] phy: qcom-qmp-combo: fix broken power on Stephen Boyd
2023-01-13 20:45 ` [PATCH 5.15.y v2 5/5] phy: qcom-qmp-combo: fix runtime suspend Stephen Boyd
2023-01-23 10:48   ` Johan Hovold
2023-02-02 21:49     ` Stephen Boyd
2023-01-22 14:23 ` [PATCH 5.15.y v2 0/5] phy: qcom-qmp-combo: Backport some stable fixes Greg KH
2023-02-02 22:27   ` Stephen Boyd

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).