Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: dwc2: fix hang during shutdown if set as peripheral

dwc2 on most platforms needs phy controller, clock and power supply.
All of them must be enabled/activated to properly operate. If dwc2
is configured as peripheral mode, then all the above three hardware
resources are disabled at the end of the probe:

/* Gadget code manages lowlevel hw on its own */
if (hsotg->dr_mode == USB_DR_MODE_PERIPHERAL)
dwc2_lowlevel_hw_disable(hsotg);

But dwc2_driver_shutdown() tries to disable the interrupts on HW IP
level. This would result in hang during shutdown if dwc2 is configured
as peripheral mode.

Fix this hang by only disable and sync irq when lowlevel hw is enabled.

Fixes: 4fdf228cdf69 ("usb: dwc2: Fix shutdown callback in platform")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Link: https://patch.msgid.link/20251104002503.17158-2-jszhang@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jisheng Zhang and committed by
Greg Kroah-Hartman
b6ebcfdc 86a35865

+4 -4
+4 -4
drivers/usb/dwc2/platform.c
··· 369 369 { 370 370 struct dwc2_hsotg *hsotg = platform_get_drvdata(dev); 371 371 372 - dwc2_disable_global_interrupts(hsotg); 373 - synchronize_irq(hsotg->irq); 374 - 375 - if (hsotg->ll_hw_enabled) 372 + if (hsotg->ll_hw_enabled) { 373 + dwc2_disable_global_interrupts(hsotg); 374 + synchronize_irq(hsotg->irq); 376 375 dwc2_lowlevel_hw_disable(hsotg); 376 + } 377 377 } 378 378 379 379 /**