Skip to content

Commit

Permalink
usb: gadget: udc: atmel: Fix vbus disconnect handling
Browse files Browse the repository at this point in the history
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: a64ef71 ("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>
  • Loading branch information
Cristian Birsan authored and Felipe Balbi committed Apr 17, 2020
1 parent 49e0590 commit 12b94da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/gadget/udc/atmel_usba_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1951,10 +1951,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;
}
Expand Down

0 comments on commit 12b94da

Please sign in to comment.