Hi Frank, On 12/21/2018 5:53 PM, Frank Mori Hess wrote: > On Fri, Dec 21, 2018 at 6:01 AM Minas Harutyunyan > <minas.harutyunyan@xxxxxxxxxxxx> wrote: > >> >> According data book Disconnect Interrupt asserted only in Host mode. >> Programming guide says for device initialization unmask follow device >> specific interrupts: USB reset, Enum Done, Early suspend, Suspend and SOF. >> And on device disconnect asserted interrupts: >> - In OTG_MODE=0,1,3: GOTGINT.SesEndDet; >> - In OTG_MODE=2,4: GINTSTS.USBRst >> Looks like on Frank's platform/PHY SesEndDet not asserted, otherwise >> will be called dwc2_hsotg_disconnect()->call_gadget(hsotg, disconnect). >> But above function call chain performing on USB reset interrupt also. >> Any case on cable pull should be called gadget with "disconnect" state >> not "resume". >> >> Frank, can you please review dmesg log to see which exactly interrupts >> sequence asserted on cable disconnect. >> > > With DEBUG defined in dwc2/core_intr.c I get: > > #unplugging > [ 364.111260] dwc2 ffb00000.usb: GINTSTS_ErlySusp > [ 364.115831] dwc2 ffb00000.usb: gintsts=04008828 gintmsk=d08c3cc4 > [ 364.121906] dwc2 ffb00000.usb: USB SUSPEND > [ 364.125994] dwc2 ffb00000.usb: dwc2_handle_usb_suspend_intr: DSTS=0x3cf701 > [ 364.132844] dwc2 ffb00000.usb: DSTS.Suspend Status=1 HWCFG4.Power > Optimize=0 HWCFG4.Hibernation=0 > You didn't see dummy USBRst interrupt on disconnect, follow to above interrupts? > #plugging back in > [ 526.407546] dwc2 ffb00000.usb: EnumDone (DSTS=0x003cf000) > [ 526.412936] dwc2 ffb00000.usb: new device is high-speed > [ 526.470634] dwc2 ffb00000.usb: GINTSTS_ErlySusp > [ 526.475204] dwc2 ffb00000.usb: dwc2_hsotg_irq: USBRst > [ 526.527561] dwc2 ffb00000.usb: EnumDone (DSTS=0x000e0000) > [ 526.532953] dwc2 ffb00000.usb: new device is high-speed > [ 526.587560] dwc2 ffb00000.usb: new address 6 > [ 526.620544] g_serial gadget: high-speed config #2: CDC ACM config > > So it looks like gadget disconnect will get called when I plug back in > and the USBRst is handled (I hacked the driver to also do a gadget > reset since that was missing?). is the problem that libcomposite > doesn't clear its suspended flag in it's gadget disconnect handler? > Thanks, Minas