usb: gadget: udc: atmel: Fix vbus disconnect handling
commit 12b94da411f9c6d950beb067d913024fd5617a61 upstream.
A DMA transfer can be in progress while vbus is lost due to a cable
disconnect. For endpoints that use DMA, this condition can lead to
peripheral hang. The patch ensures that endpoints are disabled before
the clocks are stopped to prevent this issue.
Fixes: a64ef71ddc
("usb: gadget: atmel_usba_udc: condition clocks to vbus state")
Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7155416143
commit
9dcb1844f8
@ -1950,10 +1950,10 @@ static irqreturn_t usba_vbus_irq_thread(int irq, void *devid)
|
||||
usba_start(udc);
|
||||
} else {
|
||||
udc->suspended = false;
|
||||
usba_stop(udc);
|
||||
|
||||
if (udc->driver->disconnect)
|
||||
udc->driver->disconnect(&udc->gadget);
|
||||
|
||||
usba_stop(udc);
|
||||
}
|
||||
udc->vbus_prev = vbus;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user