From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"michal.simek@amd.com" <michal.simek@amd.com>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] usb: dwc3: xilinx: fix system suspend and resume PHY handling
Date: Fri, 2 Oct 2026 02:06:05 +0000 [thread overview]
Message-ID: <ar8RTQ5zmTuV48C0@vbox> (raw)
In-Reply-To: <20260922182125.11067-2-radhey.shyam.pandey@amd.com>
On Tue, Sep 22, 2026, Radhey Shyam Pandey wrote:
> System suspend and resume error paths do not handle PHY and clock
> resources correctly. Suspend calls phy_exit() without first powering
> off the PHY and ignores failures, while resume can leave clocks
> enabled if PHY reinitialization fails.
>
> Propagate errors to the PM core and unwind resources to ensure a
> consistent state on suspend and resume failures.
>
> Fixes: d6edcdc1ef06 ("usb: dwc3: xilinx: fix usb3 non-wakeup source resume failure")
> Cc: stable@vger.kernel.org
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> ---
> Changes in v2:
> - Split out of the combined five patch series so the fixes can be sent
> and backported on their own, per review feedback.
> - Reordered ahead of the platform-data cleanups.
> - Log a failure of the phy_power_on() rollback. phy_exit() leaves
> init_count untouched when it fails, so if the rollback also fails the
> PHY is left with power_count and init_count out of step; that is now
> at least visible in the log.
> - Added Cc: stable.
>
> drivers/usb/dwc3/dwc3-xilinx.c | 24 +++++++++++++++++++++---
> 1 file changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
> index b832505e1b04..8c63e02575f1 100644
> --- a/drivers/usb/dwc3/dwc3-xilinx.c
> +++ b/drivers/usb/dwc3/dwc3-xilinx.c
> @@ -383,13 +383,26 @@ static int __maybe_unused dwc3_xlnx_runtime_idle(struct device *dev)
> static int __maybe_unused dwc3_xlnx_suspend(struct device *dev)
> {
> struct dwc3_xlnx *priv_data = dev_get_drvdata(dev);
> + int ret;
>
> - phy_exit(priv_data->usb3_phy);
> + ret = phy_power_off(priv_data->usb3_phy);
> + if (ret < 0)
> + return ret;
> +
> + ret = phy_exit(priv_data->usb3_phy);
> + if (ret < 0)
> + goto err_phy_power_on;
>
> /* Disable the clocks */
> clk_bulk_disable(priv_data->num_clocks, priv_data->clks);
>
> return 0;
> +
> +err_phy_power_on:
> + if (phy_power_on(priv_data->usb3_phy))
> + dev_err(dev, "failed to restore PHY power after suspend error\n");
> +
> + return ret;
> }
>
> static int __maybe_unused dwc3_xlnx_resume(struct device *dev)
> @@ -403,15 +416,20 @@ static int __maybe_unused dwc3_xlnx_resume(struct device *dev)
>
> ret = phy_init(priv_data->usb3_phy);
> if (ret < 0)
> - return ret;
> + goto err_clk_disable;
>
> ret = phy_power_on(priv_data->usb3_phy);
> if (ret < 0) {
> phy_exit(priv_data->usb3_phy);
> - return ret;
> + goto err_clk_disable;
> }
>
> return 0;
> +
> +err_clk_disable:
> + clk_bulk_disable(priv_data->num_clocks, priv_data->clks);
> +
> + return ret;
> }
>
> static const struct dev_pm_ops dwc3_xlnx_dev_pm_ops = {
> --
> 2.43.0
>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Thanks,
Thinh
next prev parent reply other threads:[~2026-10-02 2:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 18:21 [PATCH v2 0/3] usb: dwc3: xilinx: error path and teardown fixes Radhey Shyam Pandey
2026-09-22 18:21 ` [PATCH v2 1/3] usb: dwc3: xilinx: fix system suspend and resume PHY handling Radhey Shyam Pandey
2026-10-02 2:06 ` Thinh Nguyen [this message]
2026-09-22 18:21 ` [PATCH v2 2/3] usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths Radhey Shyam Pandey
2026-09-23 9:13 ` Philipp Zabel
2026-09-26 12:32 ` Pandey, Radhey Shyam
2026-10-02 2:14 ` Thinh Nguyen
2026-09-22 18:21 ` [PATCH v2 3/3] usb: dwc3: xilinx: unwind ZynqMP platform init on probe failure and remove Radhey Shyam Pandey
2026-10-02 2:15 ` Thinh Nguyen
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=ar8RTQ5zmTuV48C0@vbox \
--to=thinh.nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=p.zabel@pengutronix.de \
--cc=radhey.shyam.pandey@amd.com \
--cc=stable@vger.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
all inboxes | Powered by JetHome®