From: Pengpeng Hou <pengpeng@iscas.ac.cn>
To: Robert Marko <robert.marko@sartura.hr>,
Luka Perkov <luka.perkov@sartura.hr>
Cc: Pengpeng Hou <pengpeng@iscas.ac.cn>,
Vinod Koul <vkoul@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH] phy: qcom: ipq4019-usb: Propagate reset operation failures
Date: Fri, 28 Aug 2026 17:18:56 +0800 [thread overview]
Message-ID: <20260828091857.8581-1-pengpeng@iscas.ac.cn> (raw)
The IPQ4019 USB PHY power operations ignore reset assertion and
deassertion failures. Their callers can therefore publish a PHY power
transition after the reset controller rejected part of it.
Propagate each reset error and restore the reset that was changed
earlier in the same HS transition where possible. This is an RFC
because a failed reset operation can leave hardware state uncertain;
feedback is requested on whether the proposed best-effort rollback
matches these PHYs.
The issue was identified via static analysis and manually reviewed.
Assisted-by: LLM
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c | 46 ++++++++++++++++-----
1 file changed, 36 insertions(+), 10 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c b/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
index da6f290af722..8c1834cd6a8e 100644
--- a/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
@@ -30,7 +30,12 @@ static int ipq4019_ss_phy_power_off(struct phy *_phy)
{
struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy);
- reset_control_assert(phy->por_rst);
+ int ret;
+
+ ret = reset_control_assert(phy->por_rst);
+ if (ret)
+ return ret;
+
msleep(10);
return 0;
@@ -40,11 +45,13 @@ static int ipq4019_ss_phy_power_on(struct phy *_phy)
{
struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy);
- ipq4019_ss_phy_power_off(_phy);
+ int ret;
- reset_control_deassert(phy->por_rst);
+ ret = ipq4019_ss_phy_power_off(_phy);
+ if (ret)
+ return ret;
- return 0;
+ return reset_control_deassert(phy->por_rst);
}
static const struct phy_ops ipq4019_usb_ss_phy_ops = {
@@ -56,10 +63,20 @@ static int ipq4019_hs_phy_power_off(struct phy *_phy)
{
struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy);
- reset_control_assert(phy->por_rst);
+ int ret;
+
+ ret = reset_control_assert(phy->por_rst);
+ if (ret)
+ return ret;
+
msleep(10);
- reset_control_assert(phy->srif_rst);
+ ret = reset_control_assert(phy->srif_rst);
+ if (ret) {
+ reset_control_deassert(phy->por_rst);
+ return ret;
+ }
+
msleep(10);
return 0;
@@ -69,14 +86,23 @@ static int ipq4019_hs_phy_power_on(struct phy *_phy)
{
struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy);
- ipq4019_hs_phy_power_off(_phy);
+ int ret;
+
+ ret = ipq4019_hs_phy_power_off(_phy);
+ if (ret)
+ return ret;
+
+ ret = reset_control_deassert(phy->srif_rst);
+ if (ret)
+ return ret;
- reset_control_deassert(phy->srif_rst);
msleep(10);
- reset_control_deassert(phy->por_rst);
+ ret = reset_control_deassert(phy->por_rst);
+ if (ret)
+ reset_control_assert(phy->srif_rst);
- return 0;
+ return ret;
}
static const struct phy_ops ipq4019_usb_hs_phy_ops = {
--
2.43.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next reply other threads:[~2026-08-28 9:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 9:18 Pengpeng Hou [this message]
2026-08-28 9:30 ` [RFC PATCH] phy: qcom: ipq4019-usb: Propagate reset operation failures sashiko-bot
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=20260828091857.8581-1-pengpeng@iscas.ac.cn \
--to=pengpeng@iscas.ac.cn \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=luka.perkov@sartura.hr \
--cc=mani@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=p.zabel@pengutronix.de \
--cc=robert.marko@sartura.hr \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox