Skip to content

Commit b3cbdf2

Browse files
committed
[nrf fromtree] drivers: udc_dwc2: avoid register read on disabled controller
The VBUS bounces when the USB connector is plugged in. This can lead to events VBUS removed and Suspended occurring in that order. With hibernation support enabled, hibernation request, as result of the suspend interrupt, will be delegated to the driver thread. Once the driver thread is scheduled to process hibernation request, the controller may be already disabled and controller/phy clocks be off. On nRF54LM20 this leads to CPU crash and a hang. To avoid this happening, cancel the possible hibernation request after interrupts are disabled. Although the thread could be still waked up because of USBSUSP interrupt raised and event posted, this is considered to be harmless, as there would be a second check in the thread whether the event is still valid or is cleared in between. Signed-off-by: Johann Fischer <[email protected]> (cherry picked from commit 0d515e7)
1 parent 2e998ab commit b3cbdf2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/usb/udc/udc_dwc2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,6 +2328,7 @@ static int udc_dwc2_disable(const struct device *dev)
23282328
}
23292329

23302330
config->irq_disable_func(dev);
2331+
cancel_hibernation_request(priv);
23312332

23322333
if (priv->hibernated) {
23332334
dwc2_exit_hibernation(dev, false, true);

0 commit comments

Comments
 (0)