On Tue, Dec 25, 2018 at 2:12 AM Minas Harutyunyan <minas.harutyunyan@xxxxxxxxxxxx> wrote: > On 12/24/2018 7:04 PM, Frank Mori Hess wrote: > > On Mon, Dec 24, 2018 at 12:41 AM Minas Harutyunyan > >> You didn't see dummy USBRst interrupt on disconnect, follow to above > >> interrupts? > >> > > > > No, I only see the suspend interrupt when pulling the plug. The > > USBRst happens after plugging back in. It's actually not a problem > > for my use case if the device just appears suspended while the cable > > is disconnected, the problem is when the cable is plugged back in and > > the device still appears to be suspended. So it's ok if the gadget > > disconnect doesn't happen until I plug back in. Locally, I've > > addressed the problem by making the gadget/composite.c clear > > cdev->suspended in its gadget reset/disconnect handler. I also made > > dwc2 generate gadget reset events, just because they seemed to have > > been overlooked (libcomposite uses the same handler for disconnect and > > reset so it doesn't make much difference in my case). > > > > One other fact that may be relevant, I'm using a normal A/B usb cable, > > not an OTG cable. So maybe that takes the OTG HNP and SRP protocols > > our of play and suppresses the session end interrupt? > > > Which type of receptacle on the board? > Please provide full register dump. My board has a B receptacle. It also has a couple A receptacles, but they are connected to a second usb chip. The regdump is below. But before that, I want to note I did notice the hardware does generate 1 session end interrupt after I initially load the module (with cable unplugged): # insmod ./dwc2.ko [ 39.938321] ffb00000.usb supply vusb_d not found, using dummy regulator [ 39.945052] ffb00000.usb supply vusb_a not found, using dummy regulator [ 39.984554] dwc2 ffb00000.usb: EPs: 16, dedicated fifos, 8064 entries in SPRAM [ 40.015796] dwc2 ffb00000.usb: DWC OTG Controller [ 40.020594] dwc2 ffb00000.usb: new USB bus registered, assigned bus number 1 [ 40.027704] dwc2 ffb00000.usb: irq 40, io mem 0xffb00000 [ 40.045553] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 [ 40.052363] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 40.059597] usb usb1: Product: DWC OTG Controller [ 40.064310] usb usb1: Manufacturer: Linux 4.9.78-ltsi-altera+ dwc2_hsotg [ 40.071008] usb usb1: SerialNumber: ffb00000.usb [ 40.087722] hub 1-0:1.0: USB hub found [ 40.098114] hub 1-0:1.0: 1 port detected [ 40.102541] dwc2 ffb00000.usb: gintsts=04000024 gintmsk=d0000806 [ 40.108622] dwc2 ffb00000.usb: ++OTG Interrupt gotgint=4 [b_peripheral] [ 40.115213] dwc2 ffb00000.usb: ++OTG Interrupt: Session End Detected++ (b_peripheral) /sys/kernel/debug/ffb00000.usb# cat regdump GOTGCTL = 0x00010000 GOTGINT = 0x00000000 GAHBCFG = 0x00000023 GUSBCFG = 0x00001710 GRSTCTL = 0x80000000 GINTSTS = 0x040000a0 GINTMSK = 0xd0000806 GRXSTSR = 0xfcf9cffa GRXSTSP = 0xfcf9cffa GRXFSIZ = 0x00002000 GNPTXFSIZ = 0x20002000 GNPTXSTS = 0x00082000 GI2CCTL = 0x00000000 GPVNDCTL = 0x00000000 GGPIO = 0x00000000 GUID = 0x12345678 GSNPSID = 0x4f54293a GHWCFG1 = 0x00000000 GHWCFG2 = 0x238ffc90 GHWCFG3 = 0x1f8002e8 GHWCFG4 = 0xfe0f0020 GLPMCFG = 0x00000000 GPWRDN = 0x00000000 GDFIFOCFG = 0x1f802000 ADPCTL = 0x00000000 HPTXFSIZ = 0x00000000 DPTXFSIZN(1) = 0x20004000 DPTXFSIZN(2) = 0x20006000 DPTXFSIZN(3) = 0x20008000 DPTXFSIZN(4) = 0x2000a000 DPTXFSIZN(5) = 0x2000c000 DPTXFSIZN(6) = 0x2000e000 DPTXFSIZN(7) = 0x20000000 DPTXFSIZN(8) = 0x20002000 DPTXFSIZN(9) = 0x20004000 DPTXFSIZN(10) = 0x20006000 DPTXFSIZN(11) = 0x20008000 DPTXFSIZN(12) = 0x2000a000 DPTXFSIZN(13) = 0x2000c000 DPTXFSIZN(14) = 0x2000e000 DPTXFSIZN(15) = 0x20000000 DCFG = 0x08100000 DCTL = 0x00000000 DSTS = 0x00000002 DIEPMSK = 0x00000000 DOEPMSK = 0x00000000 DAINT = 0x00000000 DAINTMSK = 0x00000000 DTKNQR1 = 0x00000000 DTKNQR2 = 0x00000000 DTKNQR3 = 0x0c100020 DTKNQR4 = 0x00000000 DVBUSDIS = 0x000017d7 DVBUSPULSE = 0x000005b8 DIEPCTL(0) = 0x00008800 DIEPCTL(1) = 0x00001000 DIEPCTL(2) = 0x00001800 DIEPCTL(3) = 0x00002000 DIEPCTL(4) = 0x00002800 DIEPCTL(5) = 0x00003000 DIEPCTL(6) = 0x00003800 DIEPCTL(7) = 0x00004000 DIEPCTL(8) = 0x00004800 DIEPCTL(9) = 0x00005000 DIEPCTL(10) = 0x00005800 DIEPCTL(11) = 0x00006000 DIEPCTL(12) = 0x00006800 DIEPCTL(13) = 0x00007000 DIEPCTL(14) = 0x00000000 DIEPCTL(15) = 0x00000800 DOEPCTL(0) = 0x00008000 DOEPCTL(1) = 0x00000000 DOEPCTL(2) = 0x00000000 DOEPCTL(3) = 0x00000000 DOEPCTL(4) = 0x00000000 DOEPCTL(5) = 0x00000000 DOEPCTL(6) = 0x00000000 DOEPCTL(7) = 0x00000000 DOEPCTL(8) = 0x00000000 DOEPCTL(9) = 0x00000000 DOEPCTL(10) = 0x00000000 DOEPCTL(11) = 0x00000000 DOEPCTL(12) = 0x00000000 DOEPCTL(13) = 0x00000000 DOEPCTL(14) = 0x00000000 DOEPCTL(15) = 0x00000000 DIEPINT(0) = 0x00000080 DIEPINT(1) = 0x00000080 DIEPINT(2) = 0x00000080 DIEPINT(3) = 0x00000080 DIEPINT(4) = 0x00000080 DIEPINT(5) = 0x00000080 DIEPINT(6) = 0x00000080 DIEPINT(7) = 0x00000080 DIEPINT(8) = 0x00000080 DIEPINT(9) = 0x00000080 DIEPINT(10) = 0x00000080 DIEPINT(11) = 0x00000080 DIEPINT(12) = 0x00000080 DIEPINT(13) = 0x00000080 DIEPINT(14) = 0x00000080 DIEPINT(15) = 0x00000080 DOEPINT(0) = 0x00000000 DOEPINT(1) = 0x00000000 DOEPINT(2) = 0x00000000 DOEPINT(3) = 0x00000000 DOEPINT(4) = 0x00000000 DOEPINT(5) = 0x00000000 DOEPINT(6) = 0x00000000 DOEPINT(7) = 0x00000000 DOEPINT(8) = 0x00000000 DOEPINT(9) = 0x00000000 DOEPINT(10) = 0x00000000 DOEPINT(11) = 0x00000000 DOEPINT(12) = 0x00000000 DOEPINT(13) = 0x00000000 DOEPINT(14) = 0x00000000 DOEPINT(15) = 0x00000000 DIEPTSIZ(0) = 0x00000000 DIEPTSIZ(1) = 0x00000000 DIEPTSIZ(2) = 0x00000000 DIEPTSIZ(3) = 0x00000000 DIEPTSIZ(4) = 0x00000000 DIEPTSIZ(5) = 0x00000000 DIEPTSIZ(6) = 0x00000000 DIEPTSIZ(7) = 0x00000000 DIEPTSIZ(8) = 0x00000000 DIEPTSIZ(9) = 0x00000000 DIEPTSIZ(10) = 0x00000000 DIEPTSIZ(11) = 0x00000000 DIEPTSIZ(12) = 0x00000000 DIEPTSIZ(13) = 0x00000000 DIEPTSIZ(14) = 0x00000000 DIEPTSIZ(15) = 0x00000000 DOEPTSIZ(0) = 0x00000000 DOEPTSIZ(1) = 0x00000000 DOEPTSIZ(2) = 0x00000000 DOEPTSIZ(3) = 0x00000000 DOEPTSIZ(4) = 0x00000000 DOEPTSIZ(5) = 0x00000000 DOEPTSIZ(6) = 0x00000000 DOEPTSIZ(7) = 0x00000000 DOEPTSIZ(8) = 0x00000000 DOEPTSIZ(9) = 0x00000000 DOEPTSIZ(10) = 0x00000000 DOEPTSIZ(11) = 0x00000000 DOEPTSIZ(12) = 0x00000000 DOEPTSIZ(13) = 0x00000000 DOEPTSIZ(14) = 0x00000000 DOEPTSIZ(15) = 0x00000000 DIEPDMA(0) = 0x42000002 DIEPDMA(1) = 0xf973dfeb DIEPDMA(2) = 0x159a0a20 DIEPDMA(3) = 0xe1fe3fc7 DIEPDMA(4) = 0x81300046 DIEPDMA(5) = 0xedfddbef DIEPDMA(6) = 0x00481880 DIEPDMA(7) = 0xeb357ff7 DIEPDMA(8) = 0x10281b40 DIEPDMA(9) = 0xbdfefbe7 DIEPDMA(10) = 0x80900604 DIEPDMA(11) = 0xefeffea3 DIEPDMA(12) = 0xa0000100 DIEPDMA(13) = 0xf37bbe3c DIEPDMA(14) = 0x32490408 DIEPDMA(15) = 0xfa3dff3d DOEPDMA(0) = 0x00004004 DOEPDMA(1) = 0xf77adefd DOEPDMA(2) = 0x00c20002 DOEPDMA(3) = 0xf6fcff7f DOEPDMA(4) = 0x4484820a DOEPDMA(5) = 0xfcf9cffa DOEPDMA(6) = 0x60080100 DOEPDMA(7) = 0xdffcfefb DOEPDMA(8) = 0x0000ad04 DOEPDMA(9) = 0xfffffffa DOEPDMA(10) = 0x0563801c DOEPDMA(11) = 0xfefdbfef DOEPDMA(12) = 0x30000280 DOEPDMA(13) = 0xcf6eda7f DOEPDMA(14) = 0x02280400 DOEPDMA(15) = 0xf86ffde7 DTXFSTS(0) = 0x00002000 DTXFSTS(1) = 0x00002000 DTXFSTS(2) = 0x00002000 DTXFSTS(3) = 0x00002000 DTXFSTS(4) = 0x00002000 DTXFSTS(5) = 0x00002000 DTXFSTS(6) = 0x00002000 DTXFSTS(7) = 0x00002000 DTXFSTS(8) = 0x00002000 DTXFSTS(9) = 0x00002000 DTXFSTS(10) = 0x00002000 DTXFSTS(11) = 0x00002000 DTXFSTS(12) = 0x00002000 DTXFSTS(13) = 0x00002000 DTXFSTS(14) = 0x00002000 DTXFSTS(15) = 0x00002000 PCGCTL = 0x00000000 HCFG = 0x00100000 HFIR = 0x000017d7 HFNUM = 0x00000000 HPTXSTS = 0x00102000 HAINT = 0x00000000 HAINTMSK = 0x00000000 HFLBADDR = 0x00000000 HPRT0 = 0x00000000 HCCHAR(0) = 0x00001000 HCCHAR(1) = 0x00000000 HCCHAR(2) = 0x00000000 HCCHAR(3) = 0x00000000 HCCHAR(4) = 0x00000000 HCCHAR(5) = 0x00000000 HCCHAR(6) = 0x00000000 HCCHAR(7) = 0x00000000 HCCHAR(8) = 0x00000000 HCCHAR(9) = 0x00000000 HCCHAR(10) = 0x00000000 HCCHAR(11) = 0x00000000 HCCHAR(12) = 0x00000000 HCCHAR(13) = 0x00000000 HCCHAR(14) = 0x00000000 HCCHAR(15) = 0x00000000 HCSPLT(0) = 0x00000000 HCSPLT(1) = 0x00000000 HCSPLT(2) = 0x00000000 HCSPLT(3) = 0x00000000 HCSPLT(4) = 0x00000000 HCSPLT(5) = 0x00000000 HCSPLT(6) = 0x00000000 HCSPLT(7) = 0x00000000 HCSPLT(8) = 0x00000000 HCSPLT(9) = 0x00000000 HCSPLT(10) = 0x00000000 HCSPLT(11) = 0x00000000 HCSPLT(12) = 0x00000000 HCSPLT(13) = 0x00000000 HCSPLT(14) = 0x00000000 HCSPLT(15) = 0x00000000 HCINT(0) = 0x00000000 HCINT(1) = 0x00000000 HCINT(2) = 0x00000000 HCINT(3) = 0x00000000 HCINT(4) = 0x00000000 HCINT(5) = 0x00000000 HCINT(6) = 0x00000000 HCINT(7) = 0x00000000 HCINT(8) = 0x00000000 HCINT(9) = 0x00000000 HCINT(10) = 0x00000000 HCINT(11) = 0x00000000 HCINT(12) = 0x00000000 HCINT(13) = 0x00000000 HCINT(14) = 0x00000000 HCINT(15) = 0x00000000 HCINTMSK(0) = 0x00000000 HCINTMSK(1) = 0x00000000 HCINTMSK(2) = 0x00000000 HCINTMSK(3) = 0x00000000 HCINTMSK(4) = 0x00000000 HCINTMSK(5) = 0x00000000 HCINTMSK(6) = 0x00000000 HCINTMSK(7) = 0x00000000 HCINTMSK(8) = 0x00000000 HCINTMSK(9) = 0x00000000 HCINTMSK(10) = 0x00000000 HCINTMSK(11) = 0x00000000 HCINTMSK(12) = 0x00000000 HCINTMSK(13) = 0x00000000 HCINTMSK(14) = 0x00000000 HCINTMSK(15) = 0x00000000 HCTSIZ(0) = 0x00000000 HCTSIZ(1) = 0x00000000 HCTSIZ(2) = 0x00000000 HCTSIZ(3) = 0x00000000 HCTSIZ(4) = 0x00000000 HCTSIZ(5) = 0x00000000 HCTSIZ(6) = 0x00000000 HCTSIZ(7) = 0x00000000 HCTSIZ(8) = 0x00000000 HCTSIZ(9) = 0x00000000 HCTSIZ(10) = 0x00000000 HCTSIZ(11) = 0x00000000 HCTSIZ(12) = 0x00000000 HCTSIZ(13) = 0x00000000 HCTSIZ(14) = 0x00000000 HCTSIZ(15) = 0x00000000 HCDMA(0) = 0x00004004 HCDMA(1) = 0xf77adefd HCDMA(2) = 0x00c20002 HCDMA(3) = 0xf6fcff7f HCDMA(4) = 0x4484820a HCDMA(5) = 0xfcf9cffa HCDMA(6) = 0x60080100 HCDMA(7) = 0xdffcfefb HCDMA(8) = 0x0000ad04 HCDMA(9) = 0xfffffffa HCDMA(10) = 0x0563801c HCDMA(11) = 0xfefdbfef HCDMA(12) = 0x30000280 HCDMA(13) = 0xcf6eda7f HCDMA(14) = 0x02280400 HCDMA(15) = 0xf86ffde7 HCDMAB(0) = 0xf86ffde7 HCDMAB(1) = 0xf86ffde7 HCDMAB(2) = 0xf86ffde7 HCDMAB(3) = 0xf86ffde7 HCDMAB(4) = 0xf86ffde7 HCDMAB(5) = 0xf86ffde7 HCDMAB(6) = 0xf86ffde7 HCDMAB(7) = 0xf86ffde7 HCDMAB(8) = 0xf86ffde7 HCDMAB(9) = 0xf86ffde7 HCDMAB(10) = 0xf86ffde7 HCDMAB(11) = 0xf86ffde7 HCDMAB(12) = 0xf86ffde7 HCDMAB(13) = 0xf86ffde7 HCDMAB(14) = 0xf86ffde7 HCDMAB(15) = 0xf86ffde7