summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJisheng Zhang <jszhang@kernel.org>2023-06-27 18:20:18 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-25 17:39:58 +0200
commite835c0a4e23c38531dcee5ef77e8d1cf462658c7 (patch)
tree966be6863702c831e125ded971154d0fc5edf185 /drivers
parentusb: typec: ucsi: move typec_set_mode(TYPEC_STATE_SAFE) to ucsi_unregister_pa... (diff)
downloadlinux-e835c0a4e23c38531dcee5ef77e8d1cf462658c7.tar.xz
linux-e835c0a4e23c38531dcee5ef77e8d1cf462658c7.zip
usb: dwc3: don't reset device side if dwc3 was configured as host-only
Commit c4a5153e87fd ("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: c4a5153e87fd ("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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/dwc3/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index f6689b731718..e719e772f926 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -277,9 +277,9 @@ int dwc3_core_soft_reset(struct dwc3 *dwc)
/*
* We're resetting only the device side because, if we're in host mode,
* XHCI driver will reset the host block. If dwc3 was configured for
- * host-only mode, then we can return early.
+ * host-only mode or current role is host, then we can return early.
*/
- if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST)
+ if (dwc->dr_mode == USB_DR_MODE_HOST || dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST)
return 0;
reg = dwc3_readl(dwc->regs, DWC3_DCTL);