Skip to content

Commit e835c0a

Browse files
xhackerustcgregkh
authored andcommitted
usb: dwc3: don't reset device side if dwc3 was configured as host-only
Commit c4a5153 ("usb: dwc3: core: Power-off core/PHYs on system_suspend in host mode") replaces check for HOST only dr_mode with current_dr_role. But during booting, the current_dr_role isn't initialized, thus the device side reset is always issued even if dwc3 was configured as host-only. What's more, on some platforms with host only dwc3, aways issuing device side reset by accessing device register block can cause kernel panic. Fixes: c4a5153 ("usb: dwc3: core: Power-off core/PHYs on system_suspend in host mode") Cc: stable <stable@kernel.org> Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20230627162018.739-1-jszhang@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 71c47ad commit e835c0a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/usb/dwc3/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ int dwc3_core_soft_reset(struct dwc3 *dwc)
277277
/*
278278
* We're resetting only the device side because, if we're in host mode,
279279
* XHCI driver will reset the host block. If dwc3 was configured for
280-
* host-only mode, then we can return early.
280+
* host-only mode or current role is host, then we can return early.
281281
*/
282-
if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST)
282+
if (dwc->dr_mode == USB_DR_MODE_HOST || dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST)
283283
return 0;
284284

285285
reg = dwc3_readl(dwc->regs, DWC3_DCTL);

0 commit comments

Comments
 (0)