usb: dwc3-rockchip: delay suspend until gadget finish transfer
authorMeng Dongyang <daniel.meng@rock-chips.com>
Thu, 24 Nov 2016 07:59:40 +0000 (15:59 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 8 Dec 2016 12:21:34 +0000 (20:21 +0800)
commit78c84e83bb530d10e7f811cd9fcbebbbd5eea87b
treef9bdfb9875784a30e500ac9e0cbdcf7c4f241946
parent58f09e08b34b9f8769cc7516845d82cf3e9c25d9
usb: dwc3-rockchip: delay suspend until gadget finish transfer

DWC3 controller still need to read or write memory after dwc3
rockchip receive disconnect notify, the dwc3 controller will not
suspend immediately and the clock is still enabled even if we put
dwc_rockchip sync. So if we reconnect to PC quickly, the transer
will start before dwc3 rockchip receive connect notify and the dwc3
controller will reset during normal transer which result in the gadget
function break.

In order to suspend dwc3 controller and disable clock when transfer
finish immediately, this patch wait for usage_count of dwc3 controller
change to 1 and disconnect interrupt occur then suspend dwc3 controller
and disable clock, make the dwc3 continue transfer after dwc3 rockchip
receive connect notify, otherwise do not reset and get or put dwc3
controller if timeout.

Change-Id: If65344557d77370e9b6cf4bfea84175c37f00057
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
drivers/usb/dwc3/dwc3-rockchip.c