Re: dwc2 gadget issues

Francesco Lavra
2017-03-01T07:37:15Z

On 02/28/2017 02:44 PM, Vardan Mikayelyan wrote:
> On 2/28/2017 3:44 PM, Francesco Lavra wrote:
>> Hi Vardan,
>>
>> On 02/28/2017 09:41 AM, Vardan Mikayelyan wrote:
>>> On 2/27/2017 11:55 PM, Francesco Lavra wrote:
>>>> Hi,
>>>>
>>>> On 02/23/2017 08:27 PM, Heiko Stuebner wrote:
>>>>> Hi Francesco,
>>>>>
>>>>> Am Donnerstag, 23. Februar 2017, 19:11:37 CET schrieb Francesco Lavra:
>>>>>> I'm having trouble getting the RK3288 OTG controller (the one at
>>>>>> ff580000) to work in peripheral mode. I'm using a Firefly Reload board,
>>>>>> and I know the hardware is fine because I can successfully use the port
>>>>>> in device mode with U-Boot's mass storage gadget driver.
>>>>>> Under Linux, the OTG port works fine when used in host mode, but fails
>>>>>> to work in device mode: nothing happens when the a USB host is plugged
>>>>>> into the OTG port, not even a single interrupt is generated by the
>>>>>> controller. I'm using the latest device tree definitions from
>>>>>> git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git.
>>>>>
>>>>> you shouldn't use my tree as base for any real work :-) . Best to use the
>>>>> regular mainline kernel or alternatively try linux-next to get all recent usb
>>>>> changes schedules for the next release.
>>>>
>>>> Thanks for your inputs.
>>>>
>>>> I was actually using the mainline kernel (4.8.1), in which the dwc2
>>>> driver wasn't working, that's why I went to your tree to pick up any
>>>> fixes or new features that might have been done. I also went to the
>>>> linux-usb tree for the same reason.
>>>>
>>>> Anyway, today I tried with the latest mainline release 4.10.0, and also
>>>> with linux-next. Unfortunately, still no luck: I can load a gadget
>>>> driver, which gets correctly bound to the OTG controller, but then
>>>> nothing happens if a USB host is connected to the OTG port.
>>>> I'm pasting below the dmesg contents (obtained with 4.10.0, with verbose
>>>> debugging enabled for the dwc2 driver) when a gadget driver is loaded,
>>>> in case you might spot something suspicious:
>>>>
>>>> [ 1147.035367] dwc2 ff580000.usb: bound driver g_audio
>>>> [ 1147.041203] dwc2 ff580000.usb: dwc2_hsotg_pullup: is_on: 1 op_state: 3
>>>> [ 1147.041250] dwc2 ff580000.usb: dwc2_core_reset()
>>>> [ 1147.041345] dwc2 ff580000.usb: FIFOs reset, timeout at 100
>>>> [ 1147.041405] dwc2 ff580000.usb: EP0: DIEPCTL0=0x00008000,
>>>> DOEPCTL0=0x00008000
>>>> [ 1147.041447] dwc2 ff580000.usb: gsintmsk now 0xd08c3cc4
>>>> [ 1147.041554] dwc2 ff580000.usb: DCTL=0x00000002
>>>> [ 1147.041631] dwc2 ff580000.usb: dwc2_hsotg_enqueue_setup: queueing
>>>> setup request
>>>> [ 1147.041692] dwc2 ff580000.usb: ep0: req ee241680: 8@ee241198, noi=0,
>>>> zero=0, snok=0
>>>> [ 1147.041757] dwc2 ff580000.usb: dwc2_hsotg_start_req:
>>>> DxEPCTL=0x80008000, ep 0, dir out
>>>> [ 1147.041799] dwc2 ff580000.usb: ureq->length:8 ureq->actual:0
>>>> [ 1147.041896] dwc2 ff580000.usb: dwc2_hsotg_start_req: 1@8/8,
>>>> 0x00080008 => 0x00000b10
>>>> [ 1147.041975] dwc2 ff580000.usb: dwc2_hsotg_start_req: 2e243000 pad =>
>>>> 0x00000b14
>>>> [ 1147.042014] dwc2 ff580000.usb: ep0 state:0
>>>> [ 1147.042055] dwc2 ff580000.usb: dwc2_hsotg_start_req: DxEPCTL=0x80008000
>>>> [ 1147.042097] dwc2 ff580000.usb: dwc2_hsotg_start_req: DXEPCTL=0x80008000
>>>> [ 1147.042169] dwc2 ff580000.usb: EP0: DIEPCTL0=0x00008000,
>>>> DOEPCTL0=0x80008000
>>>>
>>>> Thanks,
>>>> Francesco
>>>> --
>>>
>>> Hi Francesco,
>>>
>>> Could you please provide full log (with debugs enabled) from DWC2 driver
>>> loading to issue point? Two logs are not giving us the full picture.
>>
>> The full log from the DWC2 driver is below:
>>
>> [ 1.498030] dwc2 ff580000.usb: ff580000.usb supply vusb_d not found,
>> using dummy regulator
>> [ 1.507431] dwc2 ff580000.usb: ff580000.usb supply vusb_a not found,
>> using dummy regulator
>> [ 1.880012] dwc2 ff580000.usb: dwc2_check_param_tx_fifo_sizes:
>> Invalid parameter g-tx-fifo-size, setting to default average
>> [ 1.892596] dwc2 ff580000.usb: EPs: 10, dedicated fifos, 972 entries
>> in SPRAM
>> [ 1.901018] dwc2 ff580000.usb: DCFG=0x08100000, DCTL=0x00000002,
>> DIEPMSK=00000000
>> [ 1.909432] dwc2 ff580000.usb: GAHBCFG=0x00000000, GHWCFG1=0x00006664
>> [ 1.916698] dwc2 ff580000.usb: GRXFSIZ=0x00000400, GNPTXFSIZ=0x00100400
>> [ 1.924161] dwc2 ff580000.usb: DPTx[1] FSize=256, StAddr=0x00000410
>> [ 1.931224] dwc2 ff580000.usb: DPTx[2] FSize=256, StAddr=0x00000900
>> [ 1.938261] dwc2 ff580000.usb: DPTx[3] FSize=256, StAddr=0x00000a00
>> [ 1.945318] dwc2 ff580000.usb: DPTx[4] FSize=256, StAddr=0x00000b00
>> [ 1.952375] dwc2 ff580000.usb: DPTx[5] FSize=256, StAddr=0x00000c00
>> [ 1.959410] dwc2 ff580000.usb: DPTx[6] FSize=256, StAddr=0x00000d00
>> [ 1.966456] dwc2 ff580000.usb: DPTx[7] FSize=0, StAddr=0x00000e00
>> [ 1.973317] dwc2 ff580000.usb: DPTx[8] FSize=0, StAddr=0x00000f00
>> [ 1.980180] dwc2 ff580000.usb: DPTx[9] FSize=256, StAddr=0x00000410
>> [ 1.987216] dwc2 ff580000.usb: ep0-in: EPCTL=0x00008800,
>> SIZ=0x00000000, DMA=0x379a4f2d
>> [ 1.996232] dwc2 ff580000.usb: ep0-out: EPCTL=0x00008000,
>> SIZ=0x00000000, DMA=0xe3103c4f
>> [ 2.005352] dwc2 ff580000.usb: ep1-in: EPCTL=0x00001000,
>> SIZ=0x00000000, DMA=0x5cf9a35d
>> [ 2.014369] dwc2 ff580000.usb: ep1-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [ 2.023482] dwc2 ff580000.usb: ep2-in: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xfef360cf
>> [ 2.032497] dwc2 ff580000.usb: ep2-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x9f637bc4
>> [ 2.041609] dwc2 ff580000.usb: ep3-in: EPCTL=0x00002000,
>> SIZ=0x00000000, DMA=0xf03470c5
>> [ 2.050625] dwc2 ff580000.usb: ep3-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [ 2.059715] dwc2 ff580000.usb: ep4-in: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xfef360cf
>> [ 2.068731] dwc2 ff580000.usb: ep4-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xb6c8c271
>> [ 2.077843] dwc2 ff580000.usb: ep5-in: EPCTL=0x00003000,
>> SIZ=0x00000000, DMA=0x84245611
>> [ 2.086858] dwc2 ff580000.usb: ep5-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [ 2.095970] dwc2 ff580000.usb: ep6-in: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0xfef360cf
>> [ 2.104986] dwc2 ff580000.usb: ep6-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x0a6c1c90
>> [ 2.114102] dwc2 ff580000.usb: ep7-in: EPCTL=0x00004000,
>> SIZ=0x00000000, DMA=0xaccb75ec
>> [ 2.123111] dwc2 ff580000.usb: ep7-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x8b00a168
>> [ 2.132222] dwc2 ff580000.usb: ep8-in: EPCTL=0x00004800,
>> SIZ=0x00000000, DMA=0x4625773c
>> [ 2.141254] dwc2 ff580000.usb: ep8-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x437c9154
>> [ 2.150371] dwc2 ff580000.usb: ep9-in: EPCTL=0x00005000,
>> SIZ=0x00000000, DMA=0x9cb1c89c
>> [ 2.159365] dwc2 ff580000.usb: ep9-out: EPCTL=0x00000000,
>> SIZ=0x00000000, DMA=0x6ec79617
>> [ 2.168476] dwc2 ff580000.usb: DVBUSDIS=0x00000b8f, DVBUSPULSE=000002c6
>> [ 2.175996] usb 1-1: new high-speed USB device number 2 using dwc2
>> [ 2.176105] dwc2 ff580000.usb: DWC OTG Controller
>> [ 2.176147] dwc2 ff580000.usb: new USB bus registered, assigned bus
>> number 2
>> [ 2.176195] dwc2 ff580000.usb: irq 41, io mem 0xff580000
>> [ 2.176450] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
>> [ 2.176462] usb usb2: New USB device strings: Mfr=3, Product=2,
>> SerialNumber=1
>> [ 2.176470] usb usb2: Product: DWC OTG Controller
>> [ 2.176478] usb usb2: Manufacturer: Linux 4.10.0+ dwc2_hsotg
>> [ 2.176485] usb usb2: SerialNumber: ff580000.usb
>> [ 1147.035367] dwc2 ff580000.usb: bound driver g_audio
>> [ 1147.041203] dwc2 ff580000.usb: dwc2_hsotg_pullup: is_on: 1 op_state: 3
>> [ 1147.041250] dwc2 ff580000.usb: dwc2_core_reset()
>> [ 1147.041345] dwc2 ff580000.usb: FIFOs reset, timeout at 100
>> [ 1147.041405] dwc2 ff580000.usb: EP0: DIEPCTL0=0x00008000,
>> DOEPCTL0=0x00008000
>> [ 1147.041447] dwc2 ff580000.usb: gsintmsk now 0xd08c3cc4
>> [ 1147.041554] dwc2 ff580000.usb: DCTL=0x00000002
>> [ 1147.041631] dwc2 ff580000.usb: dwc2_hsotg_enqueue_setup: queueing
>> setup request
>> [ 1147.041692] dwc2 ff580000.usb: ep0: req ee241680: 8@ee241198, noi=0,
>> zero=0, snok=0
>> [ 1147.041757] dwc2 ff580000.usb: dwc2_hsotg_start_req:
>> DxEPCTL=0x80008000, ep 0, dir out
>> [ 1147.041799] dwc2 ff580000.usb: ureq->length:8 ureq->actual:0
>> [ 1147.041896] dwc2 ff580000.usb: dwc2_hsotg_start_req: 1@8/8,
>> 0x00080008 => 0x00000b10
>> [ 1147.041975] dwc2 ff580000.usb: dwc2_hsotg_start_req: 2e243000 pad =>
>> 0x00000b14
>> [ 1147.042014] dwc2 ff580000.usb: ep0 state:0
>> [ 1147.042055] dwc2 ff580000.usb: dwc2_hsotg_start_req: DxEPCTL=0x80008000
>> [ 1147.042097] dwc2 ff580000.usb: dwc2_hsotg_start_req: DXEPCTL=0x80008000
>> [ 1147.042169] dwc2 ff580000.usb: EP0: DIEPCTL0=0x00008000,
>> DOEPCTL0=0x80008000
>>
>> Thanks,
>> Francesco
>>
>>> Thanks,
>>> Vardan.
>>>
>>
>
> Seems here we have fifo configuration issue. We will follow up it and
> provide feedback soon.
>
> If it is possible, can you please provide to us register dump after
> driver loading.

Sure, here is the dump before loading the gadget driver:

GOTGCTL = 0x00010000
GOTGINT = 0x00000000
GAHBCFG = 0x0000002f
GUSBCFG = 0x00001408
GRSTCTL = 0x80000000
GINTSTS = 0x04000030
GINTMSK = 0xd0000806
GRXSTSR = 0x00000000
GRXSTSP = 0x00000000
GRXFSIZ = 0x00000400
GNPTXFSIZ = 0x00100400
GNPTXSTS = 0x00080010
GI2CCTL = 0x00000000
GPVNDCTL = 0x00000000
GGPIO = 0x00000000
GUID = 0x32000001
GSNPSID = 0x4f54310a
GHWCFG1 = 0x00006664
GHWCFG2 = 0x228e2450
GHWCFG3 = 0x03cc90e8
GHWCFG4 = 0xdbf04030
GLPMCFG = 0x00000000
GPWRDN = 0x00000000
GDFIFOCFG = 0x03cc0400
ADPCTL = 0x00000000
HPTXFSIZ = 0x00000000
DPTXFSIZN(1) = 0x01000410
DPTXFSIZN(2) = 0x01000900
DPTXFSIZN(3) = 0x01000a00
DPTXFSIZN(4) = 0x01000b00
DPTXFSIZN(5) = 0x01000c00
DPTXFSIZN(6) = 0x01000d00
DPTXFSIZN(7) = 0x00000e00
DPTXFSIZN(8) = 0x00000f00
DPTXFSIZN(9) = 0x01000410
DPTXFSIZN(10) = 0x01000900
DPTXFSIZN(11) = 0x01000a00
DPTXFSIZN(12) = 0x01000b00
DPTXFSIZN(13) = 0x01000c00
DPTXFSIZN(14) = 0x01000d00
DPTXFSIZN(15) = 0x00000e00
DCFG = 0x08100000
DCTL = 0x00000002
DSTS = 0x0007ff02
DIEPMSK = 0x00000000
DOEPMSK = 0x00000000
DAINT = 0x00000000
DAINTMSK = 0x00000000
DTKNQR1 = 0x00000000
DTKNQR2 = 0x00000000
DTKNQR3 = 0x0c100020
DTKNQR4 = 0x00000000
DVBUSDIS = 0x00000b8f
DVBUSPULSE = 0x000002c6
DIEPCTL(0) = 0x00008800
DIEPCTL(1) = 0x00001000
DIEPCTL(2) = 0x00000000
DIEPCTL(3) = 0x00002000
DIEPCTL(4) = 0x00000000
DIEPCTL(5) = 0x00003000
DIEPCTL(6) = 0x00000000
DIEPCTL(7) = 0x00004000
DIEPCTL(8) = 0x00004800
DIEPCTL(9) = 0x00005000
DIEPCTL(10) = 0x00000000
DIEPCTL(11) = 0x00000000
DIEPCTL(12) = 0x00000000
DIEPCTL(13) = 0x00000000
DIEPCTL(14) = 0x00000000
DIEPCTL(15) = 0x00000000
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) = 0x379a4f6d
DIEPDMA(1) = 0x5cc9a35d
DIEPDMA(2) = 0xfef360cb
DIEPDMA(3) = 0xf83470c5
DIEPDMA(4) = 0xfef360cb
DIEPDMA(5) = 0xbc245623
DIEPDMA(6) = 0xfef360cb
DIEPDMA(7) = 0xbdcb75ec
DIEPDMA(8) = 0x46617f3e
DIEPDMA(9) = 0x9cb1ca9c
DIEPDMA(10) = 0xfef360cb
DIEPDMA(11) = 0xfef360cb
DIEPDMA(12) = 0xfef360cb
DIEPDMA(13) = 0xfef360cb
DIEPDMA(14) = 0xfef360cb
DIEPDMA(15) = 0xfef360cb
DOEPDMA(0) = 0xf3143c4f
DOEPDMA(1) = 0x8b10a1e8
DOEPDMA(2) = 0x9f637bc4
DOEPDMA(3) = 0x8b10a1e8
DOEPDMA(4) = 0xb6c84231
DOEPDMA(5) = 0x8b10a1e8
DOEPDMA(6) = 0x126c1490
DOEPDMA(7) = 0x8b10a1e8
DOEPDMA(8) = 0x437c9154
DOEPDMA(9) = 0x6ec79607
DOEPDMA(10) = 0x8b10a1e8
DOEPDMA(11) = 0x8b10a1e8
DOEPDMA(12) = 0x8b10a1e8
DOEPDMA(13) = 0x8b10a1e8
DOEPDMA(14) = 0x8b10a1e8
DOEPDMA(15) = 0x8b10a1e8
DTXFSTS(0) = 0x00000010
DTXFSTS(1) = 0x00000010
DTXFSTS(2) = 0x00000010
DTXFSTS(3) = 0x00000010
DTXFSTS(4) = 0x00000010
DTXFSTS(5) = 0x00000010
DTXFSTS(6) = 0x00000010
DTXFSTS(7) = 0x00000010
DTXFSTS(8) = 0x00000010
DTXFSTS(9) = 0x00000010
DTXFSTS(10) = 0x00000010
DTXFSTS(11) = 0x00000010
DTXFSTS(12) = 0x00000010
DTXFSTS(13) = 0x00000010
DTXFSTS(14) = 0x00000010
DTXFSTS(15) = 0x00000010
PCGCTL = 0x00000000
HCFG = 0x00100000
HFIR = 0x00000b8f
HFNUM = 0x00003fff
HPTXSTS = 0x00080100
HAINT = 0x00000000
HAINTMSK = 0x00000000
HFLBADDR = 0x00000000
HPRT0 = 0x00000000
HCCHAR(0) = 0x00001000
HCCHAR(1) = 0x00004800
HCCHAR(2) = 0x00000000
HCCHAR(3) = 0x00004800
HCCHAR(4) = 0x00000000
HCCHAR(5) = 0x00004800
HCCHAR(6) = 0x00000000
HCCHAR(7) = 0x00004800
HCCHAR(8) = 0x00000000
HCCHAR(9) = 0x00000000
HCCHAR(10) = 0x00004800
HCCHAR(11) = 0x00004800
HCCHAR(12) = 0x00004800
HCCHAR(13) = 0x00004800
HCCHAR(14) = 0x00004800
HCCHAR(15) = 0x00004800
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) = 0xf3143c4f
HCDMA(1) = 0x8b10a1e8
HCDMA(2) = 0x9f637bc4
HCDMA(3) = 0x8b10a1e8
HCDMA(4) = 0xb6c84231
HCDMA(5) = 0x8b10a1e8
HCDMA(6) = 0x126c1490
HCDMA(7) = 0x8b10a1e8
HCDMA(8) = 0x437c9154
HCDMA(9) = 0x6ec79607
HCDMA(10) = 0x8b10a1e8
HCDMA(11) = 0x8b10a1e8
HCDMA(12) = 0x8b10a1e8
HCDMA(13) = 0x8b10a1e8
HCDMA(14) = 0x8b10a1e8
HCDMA(15) = 0x8b10a1e8
HCDMAB(0) = 0x8b10a1e8
HCDMAB(1) = 0x8b10a1e8
HCDMAB(2) = 0x8b10a1e8
HCDMAB(3) = 0x8b10a1e8
HCDMAB(4) = 0x8b10a1e8
HCDMAB(5) = 0x8b10a1e8
HCDMAB(6) = 0x8b10a1e8
HCDMAB(7) = 0x8b10a1e8
HCDMAB(8) = 0x8b10a1e8
HCDMAB(9) = 0x8b10a1e8
HCDMAB(10) = 0x8b10a1e8
HCDMAB(11) = 0x8b10a1e8
HCDMAB(12) = 0x8b10a1e8
HCDMAB(13) = 0x8b10a1e8
HCDMAB(14) = 0x8b10a1e8
HCDMAB(15) = 0x8b10a1e8

and here is the dump after loading the gadget driver:

GOTGCTL = 0x00010000
GOTGINT = 0x00000000
GAHBCFG = 0x00000027
GUSBCFG = 0x0000140f
GRSTCTL = 0x80000400
GINTSTS = 0x04008020
GINTMSK = 0xd08c3cc4
GRXSTSR = 0x00000000
GRXSTSP = 0x00000000
GRXFSIZ = 0x00000113
GNPTXFSIZ = 0x00100113
GNPTXSTS = 0x00080010
GI2CCTL = 0x00000000
GPVNDCTL = 0x00000000
GGPIO = 0x00000000
GUID = 0x32000001
GSNPSID = 0x4f54310a
GHWCFG1 = 0x00006664
GHWCFG2 = 0x228e2450
GHWCFG3 = 0x03cc90e8
GHWCFG4 = 0xdbf04030
GLPMCFG = 0x00000000
GPWRDN = 0x00000000
GDFIFOCFG = 0x039303cc
ADPCTL = 0x00000000
HPTXFSIZ = 0x00000000
DPTXFSIZN(1) = 0x00680123
DPTXFSIZN(2) = 0x0068018b
DPTXFSIZN(3) = 0x006801f3
DPTXFSIZN(4) = 0x0068025b
DPTXFSIZN(5) = 0x006802c3
DPTXFSIZN(6) = 0x0068032b
DPTXFSIZN(7) = 0x000003f3
DPTXFSIZN(8) = 0x0000037b
DPTXFSIZN(9) = 0x00680123
DPTXFSIZN(10) = 0x0068018b
DPTXFSIZN(11) = 0x006801f3
DPTXFSIZN(12) = 0x0068025b
DPTXFSIZN(13) = 0x006802c3
DPTXFSIZN(14) = 0x0068032b
DPTXFSIZN(15) = 0x000003f3
DCFG = 0x00840000
DCTL = 0x00000000
DSTS = 0x00000002
DIEPMSK = 0x0000000f
DOEPMSK = 0x0000022f
DAINT = 0x00000000
DAINTMSK = 0x00010001
DTKNQR1 = 0x00000000
DTKNQR2 = 0x00000000
DTKNQR3 = 0x0c100020
DTKNQR4 = 0x00000000
DVBUSDIS = 0x00000b8f
DVBUSPULSE = 0x000002c6
DIEPCTL(0) = 0x00008000
DIEPCTL(1) = 0x00000000
DIEPCTL(2) = 0x00000000
DIEPCTL(3) = 0x00000000
DIEPCTL(4) = 0x00000000
DIEPCTL(5) = 0x00000000
DIEPCTL(6) = 0x00000000
DIEPCTL(7) = 0x00000000
DIEPCTL(8) = 0x00000000
DIEPCTL(9) = 0x00000000
DIEPCTL(10) = 0x00000000
DIEPCTL(11) = 0x00000000
DIEPCTL(12) = 0x00000000
DIEPCTL(13) = 0x00000000
DIEPCTL(14) = 0x00000000
DIEPCTL(15) = 0x00000000
DOEPCTL(0) = 0x80008000
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) = 0x20080008
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) = 0xb616a434
DIEPDMA(1) = 0x1def4eb6
DIEPDMA(2) = 0xbdcb75ec
DIEPDMA(3) = 0xd55e9df3
DIEPDMA(4) = 0xbdcb75ec
DIEPDMA(5) = 0x026813f5
DIEPDMA(6) = 0xbdcb75ec
DIEPDMA(7) = 0xc10f8789
DIEPDMA(8) = 0xb0f82040
DIEPDMA(9) = 0xcbf8ce30
DIEPDMA(10) = 0xbdcb75ec
DIEPDMA(11) = 0xbdcb75ec
DIEPDMA(12) = 0xbdcb75ec
DIEPDMA(13) = 0xbdcb75ec
DIEPDMA(14) = 0xbdcb75ec
DIEPDMA(15) = 0xbdcb75ec
DOEPDMA(0) = 0xff43819d
DOEPDMA(1) = 0x5afb2109
DOEPDMA(2) = 0x074e8688
DOEPDMA(3) = 0x5afb2109
DOEPDMA(4) = 0xe7952f76
DOEPDMA(5) = 0x5afb2109
DOEPDMA(6) = 0x19c23309
DOEPDMA(7) = 0x5afb2109
DOEPDMA(8) = 0x1a1bb42e
DOEPDMA(9) = 0xcd2257a4
DOEPDMA(10) = 0x5afb2109
DOEPDMA(11) = 0x5afb2109
DOEPDMA(12) = 0x5afb2109
DOEPDMA(13) = 0x5afb2109
DOEPDMA(14) = 0x5afb2109
DOEPDMA(15) = 0x5afb2109
DTXFSTS(0) = 0x00000010
DTXFSTS(1) = 0x00000010
DTXFSTS(2) = 0x00000010
DTXFSTS(3) = 0x00000010
DTXFSTS(4) = 0x00000010
DTXFSTS(5) = 0x00000010
DTXFSTS(6) = 0x00000010
DTXFSTS(7) = 0x00000010
DTXFSTS(8) = 0x00000010
DTXFSTS(9) = 0x00000010
DTXFSTS(10) = 0x00000010
DTXFSTS(11) = 0x00000010
DTXFSTS(12) = 0x00000010
DTXFSTS(13) = 0x00000010
DTXFSTS(14) = 0x00000010
DTXFSTS(15) = 0x00000010
PCGCTL = 0x00000000
HCFG = 0x00840000
HFIR = 0x00000b8f
HFNUM = 0x4ebd0000
HPTXSTS = 0x00080068
HAINT = 0x00000000
HAINTMSK = 0x00000001
HFLBADDR = 0x00000000
HPRT0 = 0x00000000
HCCHAR(0) = 0x00000000
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) = 0x0000000f
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) = 0xff43819d
HCDMA(1) = 0x5afb2109
HCDMA(2) = 0x074e8688
HCDMA(3) = 0x5afb2109
HCDMA(4) = 0xe7952f76
HCDMA(5) = 0x5afb2109
HCDMA(6) = 0x19c23309
HCDMA(7) = 0x5afb2109
HCDMA(8) = 0x1a1bb42e
HCDMA(9) = 0xcd2257a4
HCDMA(10) = 0x5afb2109
HCDMA(11) = 0x5afb2109
HCDMA(12) = 0x5afb2109
HCDMA(13) = 0x5afb2109
HCDMA(14) = 0x5afb2109
HCDMA(15) = 0x5afb2109
HCDMAB(0) = 0x4d39126c
HCDMAB(1) = 0xdd37f8a2
HCDMAB(2) = 0x14b9118c
HCDMAB(3) = 0xdd37f8a2
HCDMAB(4) = 0x5d5bff79
HCDMAB(5) = 0xdd37f8a2
HCDMAB(6) = 0x01144f4d
HCDMAB(7) = 0xdd37f8a2
HCDMAB(8) = 0x8b35ac87
HCDMAB(9) = 0x28a47b1b
HCDMAB(10) = 0xdd37f8a2
HCDMAB(11) = 0xdd37f8a2
HCDMAB(12) = 0xdd37f8a2
HCDMAB(13) = 0xdd37f8a2
HCDMAB(14) = 0xdd37f8a2
HCDMAB(15) = 0xdd37f8a2

When I plug a USB host into the OTG port, GINTSTS changes from
0x04008020 to 0x04008022, while the other registers remain unchanged
(except HFNUM).
It may be worth noting that when I request a register dump for the first
time, I get two interrupts from the controller, both of which say:

[ 23.081525] dwc2 ff580000.usb: gintsts=04000032 gintmsk=d0000806
[ 23.081568] dwc2 ff580000.usb: Mode Mismatch Interrupt: currently in
Device mode
[ 23.089908] dwc2 ff580000.usb: dwc2_hsotg_irq: 04000030 00000000
(d0000806) retry 8

Thanks,
Francesco