Skip to contentSkip to conversation

usb: dwc2: gadget: Consider VBUS discharge time in disconnect flow

DISCUSSION John Keeping 1 participant 1 message Feb 6, 2019 USB

lore
Share & tools
lore
#0 lore raw
Quoted 7 lines · On Tue, 5 Feb 2019 12:08:48 +0400 Minas Harutyunyan…

If VBUS discharge time > 3ms then on device cable disconnect, core asserted Early Suspend then Suspend interrupts which no need to handle.

VBUS discharge time depend on PHY schematic implementation. Can be up to 1 sec.

Quoted 7 lines

To unambiguous recognize disconnect event on Early_Suspend interrupt added delay to allow VBUS fully discharge and as result GOTGCTL_BSESVLD goes to 0. If GOTGCTL_BSESVLD after delay still set to 1 that mean Suspend initiated by host, not by disconnect. In case of disconnect after Early_Suspend core asserting Suspend, Reset Detect and Reset interrupts which no any meaning, so these interrupts no need to handle and resetting in GINTSTS.

I have just tried this and it makes enumeration much slower. The host system shows:

[1495332.243080] usb 1-2.4.7: new high-speed USB device number 89 using xhci_hcd
[1495337.399713] usb 1-2.4.7: device descriptor read/64, error -110
[1495347.779878] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
[1495348.004513] usb 1-2.4.7: New USB device found, idVendor=0001, idProduct=0001, bcdDevice= 1.01

My guess is that the added delay is triggering in cases when it shouldn't and delaying the response to the setup device command.