usb: dwc3: gadget: Clear pending events when stopping controller

Just prior to stopping the controller, we may have issued stop
transfer commands to any endpoints with any pending transfers.
This will result in EP Command Complete events being generated.
However, as per the Databook, the controller will not assert the
halt status bit after clearing the run/stop bit if there are any
pending events in the GEVNTCOUNT(n) registers, so this results
in a timeout error. Fix this by simply clearing GEVNTCOUNT(n)
by reading and writing back the counts.

Change-Id: I2fd0b161b08048072aa7fcea8c636662bcd76bd4
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
3 files changed