Re: [PATCH] usb: dwc3: qcom: Restore UTMI PIPE clock on resume
From: Dmitry Baryshkov
Date: Tue Oct 27 2026 - 07:16:24 EST
On Tue, Oct 27, 2026 at 01:21:42AM +0000, Filippo Falezza wrote:
> Boards whose controller has no SuperSpeed PHY set
> qcom,select-utmi-as-pipe-clk, and the glue then programs QSCRATCH
> GENERAL_CFG so that the core's PIPE clock domain runs from the UTMI
> clock. This is only done at probe.
>
> When the SoC reaches its deepest state in suspend-to-idle (CX power
> collapse), the QSCRATCH registers lose their contents. On resume the
> core is reinitialised with its PIPE domain unclocked, and the gadget
> does not come back:
>
> dwc3-qcom a600000.usb: failed to enable ep0out
>
> The link stays down until the driver is unbound and bound again.
>
> Remember the property at probe and select the UTMI clock again in
> dwc3_qcom_resume(), after the clocks and interconnect paths are enabled
> and before the core is resumed. Move dwc3_qcom_select_utmi_clk() up so
> that it is defined before its new caller.
>
> Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")
> Signed-off-by: Filippo Falezza <effeffe99@xxxxxxxxx>
> ---
> Hello there,
>
> this fixes USB peripheral mode after suspend on a Motorola Moto G 5G
> Plus (SM7250), a phone with a USB 2.0-only port that I'm bringing up on
> mainline. Its controller needs qcom,select-utmi-as-pipe-clk. The first
> s2idle that reached CX power collapse broke the gadget: "failed to
> enable ep0out" on resume, and USB networking stayed down until I
> rebound dwc3-qcom by hand. Rebinding works because probe programs
> GENERAL_CFG again, which is what this patch does in the resume path.
>
> With the patch, the gadget (NCM plus ACM) reconnects after s2idle, and
> the SSH session over the cable that I use for testing survives
> suspend; the phone has run with it on linux-next since 11 October.
> The other boards that use
> qcom,select-utmi-as-pipe-clk should benefit as well, but I have only
> tested this one, in peripheral mode. The legacy glue driver
> (dwc3-qcom-legacy.c) has the same probe-only programming; I left it
> alone because I can't test it.
>
> The patch is on top of usb-linus (6b4b543fa187) and builds with W=1 for
> arm64.
>
> I wrote this patch and drafted this note with the help of an AI coding
> assistant (Claude Code). The testing above is on the phone.
>
> Thanks,
> Filippo
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 45 +++++++++++++++++++++++++++-----------------
> 1 file changed, 28 insertions(+), 17 deletions(-)
>
> @@ -388,6 +406,15 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom, bool wakeup)
> if (ret)
> dev_warn(qcom->dev, "failed to enable interconnect: %d\n", ret);
>
> + /*
> + * The QSCRATCH registers lose their state when the controller's power
> + * domain is collapsed during system suspend: select the UTMI clock
> + * for the PIPE domain again, or the core can't run without a PIPE
> + * clock ("failed to enable ep0out").
> + */
This better fits the commit message. Please drop.
With that:
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
> + if (qcom->utmi_as_pipe_clk)
> + dwc3_qcom_select_utmi_clk(qcom);
> +
> /* Clear existing events from PHY related to L2 in/out */
> for (i = 0; i < qcom->num_ports; i++) {
> dwc3_qcom_setbits(qcom->qscratch_base,
--
With best wishes
Dmitry