On Mon, Oct 16, 2017 at 1:36 AM, Minas Harutyunyan <Minas.Harutyunyan@xxxxxxxxxxxx> wrote: > On b-plug disconnect should asserted GOTGINT.SesEndDet interrupt. > According previously sent by you register dump (GHWCFG2 = 0x23affc70) > your core OTG_MODE=0. > Bellow fragment from programming guide on Device disconnect: > > "7.3Device Disconnection > The device session ends when the USB cable is disconnected or if the > VBUS is switched off by the Host. The > device disconnect flow varies depending on the value of the OTG_MODE > configuration parameter. > > When OTG_MODE = 0,1, or 3 > When OTG_MODE is set to 0,1, or 3, the device disconnect flow is as follows: > 1. When the USB cable is unplugged or when the VBUS is switched off by > the Host, the Device core > trigger GINTSTS.OTGInt [bit 2] interrupt bit. > 2. When the device application detects GINTSTS.OTGInt interrupt, it > checks that the > GOTGINT.SesEndDet (Session End Detected) bit is set to 1’b1." > > So, you should receive and handle "Session End Detected". In function > dwc2_handle_otg_intr() on this interrupt (in device mode) calling > dwc2_hsotg_disconnect() function. By adding your patch "[PATCH 3/3] usb: > dwc2: Fix UDC state tracking" state changed to not attached as required. So, on the HiKey board (using 4.14-rc5 + Vardan's patch), I'm not seeing the GOTGINT_SES_END_DET in dwc2_handle_otg_intr() when I remove the USB OTG cable. In fact, I'm not seeing any calls to dwc2_handle_otg_intr()... which seems... odd maybe? Any clues as to what might be going wrong then? thanks -john -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html