Skip to content
/ linux Public

Commit e629173

Browse files
xhackerustcSasha Levin
authored andcommitted
usb: dwc2: fix resume failure if dr_mode is host
[ Upstream commit a52e4f2 ] commit 13b1f8e ("usb: dwc2: Force mode optimizations") removed the dwc2_force_mode(hsotg, true) in dwc2_force_dr_mode() if dr_mode is host. But this brings a bug: the controller fails to resume back as host, further debugging shows that the controller is resumed as peripheral. The reason is dwc2_force_dr_mode() missed the host mode forcing, and when resuming from s2ram, GINTSTS is 0 by default, dwc2_is_device_mode in dwc2_resume() misreads this as the controller is in peripheral mode. Fix the resume failure by adding back the dwc2_force_mode(hsotg, true). Then an obvious question is: why this bug hasn't been observed and fixed for about six years? There are two resons: most dwc2 platforms set the dr_mode as otg; Some platforms don't have suspend & resume support yet. Fixes: 13b1f8e ("usb: dwc2: Force mode optimizations") Cc: stable <stable@kernel.org> Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Link: https://patch.msgid.link/20260129021534.10411-1-jszhang@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5d18673 commit e629173

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/usb/dwc2/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg)
572572
{
573573
switch (hsotg->dr_mode) {
574574
case USB_DR_MODE_HOST:
575+
dwc2_force_mode(hsotg, true);
575576
/*
576577
* NOTE: This is required for some rockchip soc based
577578
* platforms on their host-only dwc2.

0 commit comments

Comments
 (0)