[PATCH v3 1/3] usb: dwc3: xilinx: fix system suspend and resume PHY handling

Thinh Nguyen Thinh.Nguyen at synopsys.com
Fri Oct 2 14:49:50 PDT 2026


On Mon, Sep 28, 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 at vger.kernel.org
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey at amd.com>
> ---
> Changes in v3:
> - None
> 
> 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.44.4
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen at synopsys.com>

Thanks,
Thinh


More information about the linux-arm-kernel mailing list