usb: dwc3: introduce a connection flag for rockchip platform
authorWu Liang feng <wulf@rock-chips.com>
Sat, 10 Sep 2016 04:34:14 +0000 (12:34 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 12 Sep 2016 03:30:02 +0000 (11:30 +0800)
commitfa0777162ee0366fb176266c24fa1812a547c6b0
tree366965c4a93b9452b2836076d24366c8ae411e6e
parenta905504e41e5f1274732f9bf0089c55c26b53e8e
usb: dwc3: introduce a connection flag for rockchip platform

We used dwc->connected flag for rockchip platform before, but this
flag can be modified both in dwc3_gadget_disconnect_interrupt() and
dwc3_rockchip_otg_extcon_evt_work(), this result in race condition
may casue USB hot plug failed.

A typical error case is:
Set DWC3 works as peripheral device, connect to PC, after
PC identifies the USB device, and then disconnet USB cable,
if dwc3_gadget_disconnect_interrupt() is called prior to
dwc3_rockchip_otg_extcon_evt_work(), it will cause extcon
work unable to do disconnect operation, and let DWC3 core
device stay in runtime active status. Then if we plug in
USB cable again, we'll fail to do runtime resume DWC3 core
and reinit it.

Change-Id: I1c06fa55c10b3dfb749b689a116ab939a6e13f97
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
drivers/usb/dwc3/dwc3-rockchip.c