Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Vinod Koul <vkoul@kernel.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	 Neil Armstrong <neil.armstrong@linaro.org>,
	 Heiko Stuebner <heiko@sntech.de>,
	Frank Wang <frank.wang@rock-chips.com>,
	 Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>
Cc: Andy Yan <andy.yan@rock-chips.com>,
	Dmitry Baryshkov <lumag@kernel.org>,
	 Yubing Zhang <yubing.zhang@rock-chips.com>,
	 Alexey Charkov <alchark@flipper.net>,
	Igor Paunovic <royalnet026@gmail.com>,
	 linux-phy@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-rockchip@lists.infradead.org,
	linux-kernel@vger.kernel.org,  kernel@collabora.com,
	devicetree@vger.kernel.org,
	 Sebastian Reichel <sebastian.reichel@collabora.com>,
	 Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH v15 02/16] phy: rockchip: usbdp: Update mode_change after error handling
Date: Tue, 15 Sep 2026 15:49:49 +0200	[thread overview]
Message-ID: <20260915-rockchip-usbdp-cleanup-v15-2-80e2c11d1ce8@collabora.com> (raw)
In-Reply-To: <20260915-rockchip-usbdp-cleanup-v15-0-80e2c11d1ce8@collabora.com>

If rk_udphy_init() or rk_udphy_setup() fails, the reinit will not be
tried again. Fix this by only updating the variable after all potential
errors have been handled.

Note, that no errors have been seen on real hardware and failures would
most likely be fatal and require at least a full reboot as the function
already asserts the PHY reset lines. So this is more of a theoretical
issue.

Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-phy/20260612163835.8D5471F000E9@smtp.kernel.org/
Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/phy/rockchip/phy-rockchip-usbdp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index 07a839e41db7..13649b52e99b 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -999,15 +999,14 @@ static int rk_udphy_power_on(struct rk_udphy *udphy, u8 mode)
 	}
 
 	if (udphy->status == UDPHY_MODE_NONE) {
-		udphy->mode_change = false;
 		ret = rk_udphy_setup(udphy);
 		if (ret)
 			return ret;
 
 		if (udphy->mode & UDPHY_MODE_USB)
 			rk_udphy_u3_port_disable(udphy, false);
-	} else if (udphy->mode_change) {
 		udphy->mode_change = false;
+	} else if (udphy->mode_change) {
 		udphy->status = UDPHY_MODE_NONE;
 		if (udphy->mode == UDPHY_MODE_DP)
 			rk_udphy_u3_port_disable(udphy, true);
@@ -1016,6 +1015,7 @@ static int rk_udphy_power_on(struct rk_udphy *udphy, u8 mode)
 		ret = rk_udphy_setup(udphy);
 		if (ret)
 			return ret;
+		udphy->mode_change = false;
 	}
 
 	udphy->status |= mode;

-- 
2.53.0


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

  parent reply	other threads:[~2026-09-15 13:50 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 13:49 [PATCH v15 00/16] phy: rockchip: usbdp: Clean up the mess (part 1) Sebastian Reichel
2026-09-15 13:49 ` [PATCH v15 01/16] dt-bindings: phy: rockchip-usbdp: add improved ports scheme Sebastian Reichel
2026-09-15 13:49 ` Sebastian Reichel [this message]
2026-09-26  3:18   ` [PATCH v15 02/16] phy: rockchip: usbdp: Update mode_change after error handling Manivannan Sadhasivam
2026-09-15 13:49 ` [PATCH v15 03/16] phy: rockchip: usbdp: Do not lose USB3 PHY status Sebastian Reichel
2026-09-26  3:28   ` Manivannan Sadhasivam
2026-09-15 13:49 ` [PATCH v15 04/16] phy: rockchip: usbdp: Fix devm_clk_bulk_get_all check Sebastian Reichel
2026-09-26  3:30   ` Manivannan Sadhasivam
2026-09-15 13:49 ` [PATCH v15 05/16] phy: rockchip: usbdp: Handle missing clock-names DT property gracefully Sebastian Reichel
2026-09-26  3:32   ` Manivannan Sadhasivam
2026-09-15 13:49 ` [PATCH v15 06/16] phy: rockchip: usbdp: Drop seamless DP takeover Sebastian Reichel
2026-09-26  3:33   ` Manivannan Sadhasivam
2026-09-15 13:49 ` [PATCH v15 07/16] phy: rockchip: usbdp: Keep clocks running on PHY re-init Sebastian Reichel
2026-09-26  3:37   ` Manivannan Sadhasivam
2026-09-15 13:49 ` [PATCH v15 08/16] phy: rockchip: usbdp: Amend SSC modulation deviation Sebastian Reichel
2026-09-26  3:59   ` Manivannan Sadhasivam
2026-09-15 13:49 ` [PATCH v15 09/16] phy: rockchip: usbdp: Fix LFPS detect threshold control Sebastian Reichel
2026-09-26  4:00   ` Manivannan Sadhasivam
2026-09-15 13:49 ` [PATCH v15 10/16] phy: rockchip: usbdp: Add missing mode_change update Sebastian Reichel
2026-09-26  4:01   ` Manivannan Sadhasivam
2026-09-15 13:49 ` [PATCH v15 11/16] phy: rockchip: usbdp: Support single-lane DP Sebastian Reichel
2026-09-15 14:03   ` sashiko-bot
2026-09-26  4:03   ` Manivannan Sadhasivam
2026-09-15 13:49 ` [PATCH v15 12/16] phy: rockchip: usbdp: Limit DP lane count to muxed lanes Sebastian Reichel
2026-09-26  4:04   ` Manivannan Sadhasivam
2026-09-15 13:50 ` [PATCH v15 13/16] phy: rockchip: usbdp: Rename DP lane functions Sebastian Reichel
2026-09-26  4:06   ` Manivannan Sadhasivam
2026-09-15 13:50 ` [PATCH v15 14/16] phy: rockchip: usbdp: Use FIELD_PREP_WM16_CONST Sebastian Reichel
2026-09-26  4:10   ` Manivannan Sadhasivam
2026-09-15 13:50 ` [PATCH v15 15/16] phy: rockchip: usbdp: Cleanup DP lane selection function Sebastian Reichel
2026-09-26  4:20   ` Manivannan Sadhasivam
2026-09-15 13:50 ` [PATCH v15 16/16] phy: rockchip: usbdp: Register DP aux bridge Sebastian Reichel
2026-09-26  4:28   ` Manivannan Sadhasivam
2026-10-03  9:36 ` [PATCH v15 00/16] phy: rockchip: usbdp: Clean up the mess (part 1) Vinod Koul

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=20260915-rockchip-usbdp-cleanup-v15-2-80e2c11d1ce8@collabora.com \
    --to=sebastian.reichel@collabora.com \
    --cc=alchark@flipper.net \
    --cc=andy.yan@rock-chips.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frank.wang@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=kernel@collabora.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=lumag@kernel.org \
    --cc=mani@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=royalnet026@gmail.com \
    --cc=sashiko-bot@kernel.org \
    --cc=vkoul@kernel.org \
    --cc=yubing.zhang@rock-chips.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox