usb: dwc3: Stop active transfers before halting the controller
authorWesley Cheng <wcheng@codeaurora.org>
Tue, 29 Sep 2020 00:20:59 +0000 (17:20 -0700)
committerFelipe Balbi <balbi@kernel.org>
Fri, 2 Oct 2020 06:57:46 +0000 (09:57 +0300)
commitae7e86108b12351028fa7e8796a59f9b2d9e1774
tree539ddd97b6ac54a7da80d492b2735f8faba88f2a
parent71ea88f6652a52f85b2110486ca99d26b71a3d8d
usb: dwc3: Stop active transfers before halting the controller

In the DWC3 databook, for a device initiated disconnect or bus reset, the
driver is required to send dependxfer commands for any pending transfers.
In addition, before the controller can move to the halted state, the SW
needs to acknowledge any pending events.  If the controller is not halted
properly, there is a chance the controller will continue accessing stale or
freed TRBs and buffers.

Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
Reviewed-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c