Fix xhci errors on Renesas uPD70202 (FRITZ!Box 3490)

I'm working on the FRITZ!Box 3490 which uses a Renesas uPD70202 USB 3.0 controller. I succeeded in uploading the firmware with the patch from https://patchwork.kernel.org/cover/11329773/ and initializing the controller works fine now. However, I'm getting read errors as soon as I plugin a USB device:

ed Jan 22 21:19:06 2020 kern.warn kernel: [  498.115808] ifx_pcie_bios_map_irq port 0 dev 0000:01:00.0 slot 0 pin 1
Wed Jan 22 21:19:06 2020 kern.warn kernel: [  498.121154] ifx_pcie_bios_map_irq dev 0000:01:00.0 irq 144 assigned
Wed Jan 22 21:19:06 2020 kern.info kernel: [  498.488541] renesas xhci 0000:01:00.0: xHCI Host Controller
Wed Jan 22 21:19:06 2020 kern.info kernel: [  498.492820] renesas xhci 0000:01:00.0: new USB bus registered, assigned bus number 1
Wed Jan 22 21:19:06 2020 kern.info kernel: [  498.506123] renesas xhci 0000:01:00.0: hcc params 0x014051cf hci version 0x100 quirks 0x0000000101000090
Wed Jan 22 21:19:06 2020 kern.info kernel: [  498.516869] hub 1-0:1.0: USB hub found
Wed Jan 22 21:19:06 2020 kern.info kernel: [  498.519631] hub 1-0:1.0: 2 ports detected
Wed Jan 22 21:19:06 2020 kern.info kernel: [  498.525641] renesas xhci 0000:01:00.0: xHCI Host Controller
Wed Jan 22 21:19:06 2020 kern.info kernel: [  498.530217] renesas xhci 0000:01:00.0: new USB bus registered, assigned bus number 2
Wed Jan 22 21:19:06 2020 kern.info kernel: [  498.537846] renesas xhci 0000:01:00.0: Host supports USB 3.0 SuperSpeed
Wed Jan 22 21:19:06 2020 kern.info kernel: [  498.545095] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
Wed Jan 22 21:19:06 2020 kern.info kernel: [  498.554921] hub 2-0:1.0: USB hub found
Wed Jan 22 21:19:06 2020 kern.info kernel: [  498.557588] hub 2-0:1.0: 2 ports detected
Wed Jan 22 21:19:31 2020 kern.info kernel: [  523.013361] usb 1-1: new full-speed USB device number 2 using renesas xhci
Wed Jan 22 21:19:31 2020 kern.err kernel: [  523.182725] usb 1-1: no configurations
Wed Jan 22 21:19:31 2020 kern.err kernel: [  523.185085] usb 1-1: can't read configurations, error -22
Wed Jan 22 21:19:31 2020 kern.info kernel: [  523.317423] usb 1-1: new full-speed USB device number 3 using renesas xhci
Wed Jan 22 21:19:31 2020 kern.err kernel: [  523.493710] usb 1-1: no configurations
Wed Jan 22 21:19:31 2020 kern.err kernel: [  523.496069] usb 1-1: can't read configurations, error -22
Wed Jan 22 21:19:31 2020 kern.info kernel: [  523.501951] usb usb1-port1: attempt power cycle
Wed Jan 22 21:19:32 2020 kern.info kernel: [  524.157361] usb 1-1: new full-speed USB device number 4 using renesas xhci
Wed Jan 22 21:19:32 2020 kern.err kernel: [  524.196649] usb 1-1: no configurations
Wed Jan 22 21:19:32 2020 kern.err kernel: [  524.199088] usb 1-1: can't read configurations, error -22
Wed Jan 22 21:19:32 2020 kern.info kernel: [  524.333362] usb 1-1: new full-speed USB device number 5 using renesas xhci
Wed Jan 22 21:19:32 2020 kern.err kernel: [  524.379660] usb 1-1: no configurations
Wed Jan 22 21:19:32 2020 kern.err kernel: [  524.382108] usb 1-1: can't read configurations, error -22
Wed Jan 22 21:19:32 2020 kern.err kernel: [  524.389787] usb usb1-port1: unable to enumerate USB device
Wed Jan 22 21:19:41 2020 kern.info kernel: [  533.061361] usb 1-2: new high-speed USB device number 6 using renesas xhci
Wed Jan 22 21:19:41 2020 kern.err kernel: [  533.197934] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:41 2020 kern.err kernel: [  533.437879] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:42 2020 kern.info kernel: [  533.677358] usb 1-2: new high-speed USB device number 7 using renesas xhci
Wed Jan 22 21:19:42 2020 kern.err kernel: [  533.809897] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:42 2020 kern.err kernel: [  534.049884] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:42 2020 kern.info kernel: [  534.161650] usb usb1-port2: attempt power cycle
Wed Jan 22 21:19:43 2020 kern.info kernel: [  534.813372] usb 1-2: new high-speed USB device number 8 using renesas xhci
Wed Jan 22 21:19:43 2020 kern.err kernel: [  534.839629] usb 1-2: device descriptor read/all, error -61
Wed Jan 22 21:19:43 2020 kern.info kernel: [  534.973361] usb 1-2: new high-speed USB device number 9 using renesas xhci
Wed Jan 22 21:19:43 2020 kern.err kernel: [  534.999498] usb 1-2: device descriptor read/all, error -61
Wed Jan 22 21:19:43 2020 kern.err kernel: [  535.003938] usb usb1-port2: unable to enumerate USB device
Wed Jan 22 21:19:47 2020 kern.info kernel: [  539.045362] usb 1-2: new high-speed USB device number 10 using renesas xhci
Wed Jan 22 21:19:47 2020 kern.err kernel: [  539.177898] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:47 2020 kern.err kernel: [  539.417880] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:48 2020 kern.info kernel: [  539.657363] usb 1-2: new high-speed USB device number 11 using renesas xhci
Wed Jan 22 21:19:48 2020 kern.err kernel: [  539.793867] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:48 2020 kern.err kernel: [  540.033855] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:48 2020 kern.info kernel: [  540.145613] usb usb1-port2: attempt power cycle
Wed Jan 22 21:19:49 2020 kern.info kernel: [  540.797506] usb 1-2: new high-speed USB device number 12 using renesas xhci
Wed Jan 22 21:19:49 2020 kern.err kernel: [  540.823608] usb 1-2: device descriptor read/all, error -61
Wed Jan 22 21:19:49 2020 kern.info kernel: [  540.957435] usb 1-2: new high-speed USB device number 13 using renesas xhci
Wed Jan 22 21:19:49 2020 kern.err kernel: [  540.983511] usb 1-2: device descriptor read/all, error -61
Wed Jan 22 21:19:49 2020 kern.err kernel: [  540.988040] usb usb1-port2: unable to enumerate USB device
Wed Jan 22 21:19:50 2020 kern.info kernel: [  542.449388] usb 1-2: new high-speed USB device number 14 using renesas xhci
Wed Jan 22 21:19:51 2020 kern.err kernel: [  542.585859] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:51 2020 kern.err kernel: [  542.825844] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:51 2020 kern.info kernel: [  543.065363] usb 1-2: new high-speed USB device number 15 using renesas xhci
Wed Jan 22 21:19:51 2020 kern.err kernel: [  543.201876] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:51 2020 kern.err kernel: [  543.441972] usb 1-2: device descriptor read/64, error 18
Wed Jan 22 21:19:51 2020 kern.info kernel: [  543.553659] usb usb1-port2: attempt power cycle

This is on a Lantiq target, but I have no real clue on where these errors might come from? Any ideas?

I enabled dynamic debugging and capture some more logs:

[  111.177262] ifx_pcie_bios_map_irq port 0 dev 0000:01:00.0 slot 0 pin 1
[  111.182590] ifx_pcie_bios_map_irq dev 0000:01:00.0 irq 144 assigned
[  111.550582] renesas xhci 0000:01:00.0: xHCI Host Controller
[  111.554861] renesas xhci 0000:01:00.0: new USB bus registered, assigned bus number 1
[  111.562617] renesas xhci 0000:01:00.0: QUIRK: Resetting on resume
[  111.562635] renesas xhci 0000:01:00.0: // Halt the HC
[  111.562655] renesas xhci 0000:01:00.0: Resetting HCD
[  111.562669] renesas xhci 0000:01:00.0: // Reset the HC
[  111.567878] renesas xhci 0000:01:00.0: Wait for controller to be ready for doorbell rings
[  111.567915] renesas xhci 0000:01:00.0: Reset complete
[  111.567937] renesas xhci 0000:01:00.0: Enabling 64-bit DMA addresses.
[  111.567954] renesas xhci 0000:01:00.0: Calling HCD init
[  111.567970] renesas xhci 0000:01:00.0: xhci_init
[  111.567990] renesas xhci 0000:01:00.0: xHCI doesn't need link TRB QUIRK
[  111.568020] renesas xhci 0000:01:00.0: Supported page size register = 0x1
[  111.568043] renesas xhci 0000:01:00.0: Supported page size of 4K
[  111.568066] renesas xhci 0000:01:00.0: HCD page size set to 4K
[  111.568089] renesas xhci 0000:01:00.0: // xHC can handle at most 32 device slots.
[  111.568114] renesas xhci 0000:01:00.0: // Setting Max device slots reg = 0x20.
[  111.568185] renesas xhci 0000:01:00.0: // Device context base array address = 0xf076000 (DMA), 6097927c (virt)
[  111.568287] renesas xhci 0000:01:00.0: Allocated command ring at 795c02de
[  111.568312] renesas xhci 0000:01:00.0: First segment DMA is 0xf077000
[  111.568335] renesas xhci 0000:01:00.0: // Setting command ring address to 0x000000000f077001
[  111.568402] renesas xhci 0000:01:00.0: // Doorbell array is located at offset 0x800 from cap regs base addr
[  111.568426] renesas xhci 0000:01:00.0: // Allocating event ring
[  111.568505] renesas xhci 0000:01:00.0: TRB math tests passed.
[  111.568539] renesas xhci 0000:01:00.0: // Write ERST size = 1 to ir_set 0 (some bits preserved)
[  111.568556] renesas xhci 0000:01:00.0: // Set ERST entries to point to event ring.
[  111.568576] renesas xhci 0000:01:00.0: // Set ERST base address for ir_set 0 = 0xf075000
[  111.568602] renesas xhci 0000:01:00.0: // Write event ring dequeue pointer, preserving EHB bit
[  111.568637] renesas xhci 0000:01:00.0: Wrote ERST address to ir_set 0.
[  111.568695] renesas xhci 0000:01:00.0: Allocating 4 scratchpad buffers
[  111.568860] renesas xhci 0000:01:00.0: Ext Cap 2f3a1135, port offset = 1, count = 2, revision = 0x3
[  111.568933] renesas xhci 0000:01:00.0: Ext Cap c9890a7f, port offset = 3, count = 2, revision = 0x2
[  111.568992] renesas xhci 0000:01:00.0: xHCI 1.0: support USB2 software lpm
[  111.569038] renesas xhci 0000:01:00.0: Found 2 USB 2.0 ports and 2 USB 3.0 ports.
[  111.569083] renesas xhci 0000:01:00.0: Finished xhci_init
[  111.569124] renesas xhci 0000:01:00.0: Called HCD init
[  111.569173] renesas xhci 0000:01:00.0: hcc params 0x014051cf hci version 0x100 quirks 0x0000000101000090
[  111.577474] renesas xhci 0000:01:00.0: xhci_run
[  111.577499] renesas xhci 0000:01:00.0: failed to allocate MSI entry
[  111.577723] renesas xhci 0000:01:00.0: ERST deq = 64'hef09000
[  111.577751] renesas xhci 0000:01:00.0: // Set the interrupt modulation register
[  111.577776] renesas xhci 0000:01:00.0: // Enable interrupts, cmd = 0x4.
[  111.577810] renesas xhci 0000:01:00.0: // Enabling event ring interrupter 94ef5141 by writing 0x2 to irq_pending
[  111.577830] renesas xhci 0000:01:00.0: Finished xhci_run for USB2 roothub
[  111.580937] xHCI xhci_add_endpoint called for root hub
[  111.580958] xHCI xhci_check_bandwidth called for root hub
[  111.581701] hub 1-0:1.0: USB hub found
[  111.584781] hub 1-0:1.0: 2 ports detected
[  111.588970] renesas xhci 0000:01:00.0: set port power, actual port 0 status  = 0x2a0
[  111.589205] renesas xhci 0000:01:00.0: set port power, actual port 1 status  = 0x2a0
[  111.590640] renesas xhci 0000:01:00.0: xHCI Host Controller
[  111.595083] renesas xhci 0000:01:00.0: new USB bus registered, assigned bus number 2
[  111.602764] renesas xhci 0000:01:00.0: Host supports USB 3.0 SuperSpeed
[  111.609527] renesas xhci 0000:01:00.0: // Turn on HC, cmd = 0x5.
[  111.609574] renesas xhci 0000:01:00.0: Finished xhci_run for USB3 roothub
[  111.610563] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[  111.619468] xHCI xhci_add_endpoint called for root hub
[  111.619490] xHCI xhci_check_bandwidth called for root hub
[  111.620255] hub 2-0:1.0: USB hub found
[  111.622995] hub 2-0:1.0: 2 ports detected
[  111.628244] renesas xhci 0000:01:00.0: set port power, actual port 0 status  = 0x2a0
[  111.628519] renesas xhci 0000:01:00.0: set port power, actual port 1 status  = 0x2a0
[  111.690191] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2a0
[  111.690214] renesas xhci 0000:01:00.0: Get port status returned 0x100
[  111.690355] renesas xhci 0000:01:00.0: get port status, actual port 1 status  = 0x2a0
[  111.690374] renesas xhci 0000:01:00.0: Get port status returned 0x100
[  111.730187] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2a0
[  111.730210] renesas xhci 0000:01:00.0: Get port status returned 0x2a0
[  111.730347] renesas xhci 0000:01:00.0: get port status, actual port 1 status  = 0x2a0
[  111.730366] renesas xhci 0000:01:00.0: Get port status returned 0x2a0
[  143.511342] renesas xhci 0000:01:00.0: Port Status Change Event for port 3
[  143.511370] renesas xhci 0000:01:00.0: handle_port_status: starting port polling.
[  143.511535] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x202e1
[  143.511555] renesas xhci 0000:01:00.0: Get port status returned 0x10101
[  143.511687] renesas xhci 0000:01:00.0: clear port connect change, actual port 0 status  = 0x2e1
[  143.511799] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2e1
[  143.511818] renesas xhci 0000:01:00.0: Get port status returned 0x101
[  143.546216] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2e1
[  143.546239] renesas xhci 0000:01:00.0: Get port status returned 0x101
[  143.566118] renesas xhci 0000:01:00.0: xhci_hub_status_data: stopping port polling.
[  143.582205] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2e1
[  143.582227] renesas xhci 0000:01:00.0: Get port status returned 0x101
[  143.618161] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2e1
[  143.618184] renesas xhci 0000:01:00.0: Get port status returned 0x101
[  143.654191] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2e1
[  143.654214] renesas xhci 0000:01:00.0: Get port status returned 0x101
[  143.654341] renesas xhci 0000:01:00.0: // Ding dong!
[  143.654926] renesas xhci 0000:01:00.0: Slot 1 output ctx = 0xef1b000 (dma)
[  143.654963] renesas xhci 0000:01:00.0: Slot 1 input ctx = 0xef1a000 (dma)
[  143.655047] renesas xhci 0000:01:00.0: Set slot id 1 dcbaa entry 32a9cccd to 0xef1b000
[  143.655262] renesas xhci 0000:01:00.0: set port reset, actual port 0 status  = 0x331
[  143.705613] renesas xhci 0000:01:00.0: Port Status Change Event for port 3
[  143.705641] renesas xhci 0000:01:00.0: handle_port_status: starting port polling.
[  143.722203] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x200e03
[  143.722226] renesas xhci 0000:01:00.0: Get port status returned 0x100503
[  143.722361] renesas xhci 0000:01:00.0: clear port reset change, actual port 0 status  = 0xe03
[  143.782163] usb 1-1: new high-speed USB device number 2 using renesas xhci
[  143.787711] renesas xhci 0000:01:00.0: Set root hub portnum to 3
[  143.787727] renesas xhci 0000:01:00.0: Set fake root hub portnum to 1
[  143.787741] renesas xhci 0000:01:00.0: udev->tt =   (null)
[  143.787752] renesas xhci 0000:01:00.0: udev->ttport = 0x0
[  143.787777] renesas xhci 0000:01:00.0: // Ding dong!
[  143.788479] renesas xhci 0000:01:00.0: Successful setup context command
[  143.788505] renesas xhci 0000:01:00.0: Op regs DCBAA ptr = 0x0000000f076000
[  143.788528] renesas xhci 0000:01:00.0: Slot ID 1 dcbaa entry @32a9cccd = 0x0000000ef1b000
[  143.788542] renesas xhci 0000:01:00.0: Output Context DMA address = 0xef1b000
[  143.788555] renesas xhci 0000:01:00.0: Internal device address = 0
[  143.788974] renesas xhci 0000:01:00.0: Waiting for status stage event
[  143.789478] renesas xhci 0000:01:00.0: Waiting for status stage event
[  143.789977] renesas xhci 0000:01:00.0: Waiting for status stage event
[  143.792831] renesas xhci 0000:01:00.0: set port reset, actual port 0 status  = 0x331
[  143.814128] renesas xhci 0000:01:00.0: xhci_hub_status_data: stopping port polling.
[  143.843146] renesas xhci 0000:01:00.0: Port Status Change Event for port 3
[  143.843174] renesas xhci 0000:01:00.0: handle_port_status: starting port polling.
[  143.858178] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x200e03
[  143.858201] renesas xhci 0000:01:00.0: Get port status returned 0x100503
[  143.858365] renesas xhci 0000:01:00.0: clear port reset change, actual port 0 status  = 0xe03
[  143.918139] renesas xhci 0000:01:00.0: Resetting device with slot ID 1
[  143.918177] renesas xhci 0000:01:00.0: // Ding dong!
[  143.918655] renesas xhci 0000:01:00.0: Completed reset device command.
[  143.918732] renesas xhci 0000:01:00.0: Can't reset device (slot ID 1) in default state
[  143.918747] renesas xhci 0000:01:00.0: Not freeing device rings.
[  143.918769] usb 1-1: device descriptor read/64, error 18
[  144.030133] renesas xhci 0000:01:00.0: Slot already in default state
[  144.030599] renesas xhci 0000:01:00.0: Waiting for status stage event
[  144.031091] renesas xhci 0000:01:00.0: Waiting for status stage event
[  144.031589] renesas xhci 0000:01:00.0: Waiting for status stage event
[  144.031798] renesas xhci 0000:01:00.0: set port reset, actual port 0 status  = 0x331
[  144.062134] renesas xhci 0000:01:00.0: xhci_hub_status_data: stopping port polling.
[  144.082143] renesas xhci 0000:01:00.0: Port Status Change Event for port 3
[  144.082172] renesas xhci 0000:01:00.0: handle_port_status: starting port polling.
[  144.098178] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x200e03
[  144.098200] renesas xhci 0000:01:00.0: Get port status returned 0x100503
[  144.098363] renesas xhci 0000:01:00.0: clear port reset change, actual port 0 status  = 0xe03
[  144.158136] renesas xhci 0000:01:00.0: Resetting device with slot ID 1
[  144.158174] renesas xhci 0000:01:00.0: // Ding dong!
[  144.158653] renesas xhci 0000:01:00.0: Completed reset device command.
[  144.158733] renesas xhci 0000:01:00.0: Can't reset device (slot ID 1) in default state
[  144.158749] renesas xhci 0000:01:00.0: Not freeing device rings.
[  144.158770] usb 1-1: device descriptor read/64, error 18
[  144.270193] renesas xhci 0000:01:00.0: disable port, actual port 0 status  = 0x2e1
[  144.270471] renesas xhci 0000:01:00.0: // Ding dong!
[  144.270509] renesas xhci 0000:01:00.0: // Ding dong!
[  144.271484] renesas xhci 0000:01:00.0: Slot 1 output ctx = 0xef1a000 (dma)
[  144.271515] renesas xhci 0000:01:00.0: Slot 1 input ctx = 0xef1b000 (dma)
[  144.271578] renesas xhci 0000:01:00.0: Set slot id 1 dcbaa entry 32a9cccd to 0xef1a000
[  144.271824] renesas xhci 0000:01:00.0: set port reset, actual port 0 status  = 0x2f1
[  144.310094] renesas xhci 0000:01:00.0: xhci_hub_status_data: stopping port polling.
[  144.323800] renesas xhci 0000:01:00.0: Port Status Change Event for port 3
[  144.323829] renesas xhci 0000:01:00.0: handle_port_status: starting port polling.
[  144.338190] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x200e03
[  144.338213] renesas xhci 0000:01:00.0: Get port status returned 0x100503
[  144.338348] renesas xhci 0000:01:00.0: clear port reset change, actual port 0 status  = 0xe03
[  144.398141] usb 1-1: new high-speed USB device number 3 using renesas xhci
[  144.403695] renesas xhci 0000:01:00.0: Set root hub portnum to 3
[  144.403711] renesas xhci 0000:01:00.0: Set fake root hub portnum to 1
[  144.403725] renesas xhci 0000:01:00.0: udev->tt =   (null)
[  144.403736] renesas xhci 0000:01:00.0: udev->ttport = 0x0
[  144.403761] renesas xhci 0000:01:00.0: // Ding dong!
[  144.404444] renesas xhci 0000:01:00.0: Successful setup context command
[  144.404471] renesas xhci 0000:01:00.0: Op regs DCBAA ptr = 0x0000000f076000
[  144.404494] renesas xhci 0000:01:00.0: Slot ID 1 dcbaa entry @32a9cccd = 0x0000000ef1a000
[  144.404508] renesas xhci 0000:01:00.0: Output Context DMA address = 0xef1a000
[  144.404521] renesas xhci 0000:01:00.0: Internal device address = 0
[  144.404946] renesas xhci 0000:01:00.0: Waiting for status stage event
[  144.405449] renesas xhci 0000:01:00.0: Waiting for status stage event
[  144.405948] renesas xhci 0000:01:00.0: Waiting for status stage event
[  144.408932] renesas xhci 0000:01:00.0: set port reset, actual port 0 status  = 0x331
[  144.459246] renesas xhci 0000:01:00.0: Port Status Change Event for port 3
[  144.459274] renesas xhci 0000:01:00.0: handle_port_status: starting port polling.
[  144.474177] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x200e03
[  144.474200] renesas xhci 0000:01:00.0: Get port status returned 0x100503
[  144.474363] renesas xhci 0000:01:00.0: clear port reset change, actual port 0 status  = 0xe03
[  144.534130] renesas xhci 0000:01:00.0: Resetting device with slot ID 1
[  144.534168] renesas xhci 0000:01:00.0: // Ding dong!
[  144.534655] renesas xhci 0000:01:00.0: Completed reset device command.
[  144.534731] renesas xhci 0000:01:00.0: Can't reset device (slot ID 1) in default state
[  144.534746] renesas xhci 0000:01:00.0: Not freeing device rings.
[  144.534767] usb 1-1: device descriptor read/64, error 18
[  144.558118] renesas xhci 0000:01:00.0: xhci_hub_status_data: stopping port polling.
[  144.646126] renesas xhci 0000:01:00.0: Slot already in default state
[  144.646570] renesas xhci 0000:01:00.0: Waiting for status stage event
[  144.647061] renesas xhci 0000:01:00.0: Waiting for status stage event
[  144.647561] renesas xhci 0000:01:00.0: Waiting for status stage event
[  144.647765] renesas xhci 0000:01:00.0: set port reset, actual port 0 status  = 0x331
[  144.698131] renesas xhci 0000:01:00.0: Port Status Change Event for port 3
[  144.698160] renesas xhci 0000:01:00.0: handle_port_status: starting port polling.
[  144.714182] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x200e03
[  144.714204] renesas xhci 0000:01:00.0: Get port status returned 0x100503
[  144.714367] renesas xhci 0000:01:00.0: clear port reset change, actual port 0 status  = 0xe03
[  144.774135] renesas xhci 0000:01:00.0: Resetting device with slot ID 1
[  144.774173] renesas xhci 0000:01:00.0: // Ding dong!
[  144.774643] renesas xhci 0000:01:00.0: Completed reset device command.
[  144.774719] renesas xhci 0000:01:00.0: Can't reset device (slot ID 1) in default state
[  144.774734] renesas xhci 0000:01:00.0: Not freeing device rings.
[  144.774755] usb 1-1: device descriptor read/64, error 18
[  144.806135] renesas xhci 0000:01:00.0: xhci_hub_status_data: stopping port polling.
[  144.886162] renesas xhci 0000:01:00.0: disable port, actual port 0 status  = 0x2e1
[  144.886466] renesas xhci 0000:01:00.0: // Ding dong!
[  144.886494] usb usb1-port1: attempt power cycle
[  145.094162] renesas xhci 0000:01:00.0: set port power, actual port 0 status  = 0x2a0
[  145.106698] renesas xhci 0000:01:00.0: Port Status Change Event for port 3
[  145.106726] renesas xhci 0000:01:00.0: handle_port_status: starting port polling.
[  145.202146] renesas xhci 0000:01:00.0: // Ding dong!
[  145.202686] renesas xhci 0000:01:00.0: Slot 1 output ctx = 0xef1a000 (dma)
[  145.202715] renesas xhci 0000:01:00.0: Slot 1 input ctx = 0xef1b000 (dma)
[  145.202776] renesas xhci 0000:01:00.0: Set slot id 1 dcbaa entry 32a9cccd to 0xef1a000
[  145.202977] renesas xhci 0000:01:00.0: set port reset, actual port 0 status  = 0x20331
[  145.270164] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x220e03
[  145.270187] renesas xhci 0000:01:00.0: Get port status returned 0x110503
[  145.270321] renesas xhci 0000:01:00.0: clear port connect change, actual port 0 status  = 0x200e03
[  145.270428] renesas xhci 0000:01:00.0: set port reset, actual port 0 status  = 0x200331
[  145.478163] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x200e03
[  145.478186] renesas xhci 0000:01:00.0: Get port status returned 0x100503
[  145.478322] renesas xhci 0000:01:00.0: clear port reset change, actual port 0 status  = 0xe03
[  145.538140] usb 1-1: new high-speed USB device number 4 using renesas xhci
[  145.543704] renesas xhci 0000:01:00.0: Set root hub portnum to 3
[  145.543720] renesas xhci 0000:01:00.0: Set fake root hub portnum to 1
[  145.543734] renesas xhci 0000:01:00.0: udev->tt =   (null)
[  145.543746] renesas xhci 0000:01:00.0: udev->ttport = 0x0
[  145.543771] renesas xhci 0000:01:00.0: // Ding dong!
[  145.544604] renesas xhci 0000:01:00.0: Successful setup address command
[  145.544630] renesas xhci 0000:01:00.0: Op regs DCBAA ptr = 0x0000000f076000
[  145.544654] renesas xhci 0000:01:00.0: Slot ID 1 dcbaa entry @32a9cccd = 0x0000000ef1a000
[  145.544668] renesas xhci 0000:01:00.0: Output Context DMA address = 0xef1a000
[  145.544681] renesas xhci 0000:01:00.0: Internal device address = 0
[  145.550143] renesas xhci 0000:01:00.0: xhci_hub_status_data: stopping port polling.
[  145.564334] usb 1-1: device descriptor read/all, error -61
[  145.568542] renesas xhci 0000:01:00.0: disable port, actual port 0 status  = 0x2e1
[  145.568873] renesas xhci 0000:01:00.0: // Ding dong!
[  145.568910] renesas xhci 0000:01:00.0: // Ding dong!
[  145.570176] renesas xhci 0000:01:00.0: Slot 1 output ctx = 0xef1a000 (dma)
[  145.570211] renesas xhci 0000:01:00.0: Slot 1 input ctx = 0xef1b000 (dma)
[  145.570272] renesas xhci 0000:01:00.0: Set slot id 1 dcbaa entry 32a9cccd to 0xef1a000
[  145.570470] renesas xhci 0000:01:00.0: set port reset, actual port 0 status  = 0x2f1
[  145.622191] renesas xhci 0000:01:00.0: Port Status Change Event for port 3
[  145.622220] renesas xhci 0000:01:00.0: handle_port_status: starting port polling.
[  145.638237] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x200e03
[  145.638273] renesas xhci 0000:01:00.0: Get port status returned 0x100503
[  145.638425] renesas xhci 0000:01:00.0: clear port reset change, actual port 0 status  = 0xe03
[  145.698142] usb 1-1: new high-speed USB device number 5 using renesas xhci
[  145.703701] renesas xhci 0000:01:00.0: Set root hub portnum to 3
[  145.703717] renesas xhci 0000:01:00.0: Set fake root hub portnum to 1
[  145.703731] renesas xhci 0000:01:00.0: udev->tt =   (null)
[  145.703742] renesas xhci 0000:01:00.0: udev->ttport = 0x0
[  145.703767] renesas xhci 0000:01:00.0: // Ding dong!
[  145.704596] renesas xhci 0000:01:00.0: Successful setup address command
[  145.704623] renesas xhci 0000:01:00.0: Op regs DCBAA ptr = 0x0000000f076000
[  145.704646] renesas xhci 0000:01:00.0: Slot ID 1 dcbaa entry @32a9cccd = 0x0000000ef1a000
[  145.704661] renesas xhci 0000:01:00.0: Output Context DMA address = 0xef1a000
[  145.704674] renesas xhci 0000:01:00.0: Internal device address = 0
[  145.724329] usb 1-1: device descriptor read/all, error -61
[  145.728554] renesas xhci 0000:01:00.0: disable port, actual port 0 status  = 0x2e1
[  145.728831] renesas xhci 0000:01:00.0: // Ding dong!
[  145.728858] usb usb1-port1: unable to enumerate USB device
[  145.734165] renesas xhci 0000:01:00.0: disable port, actual port 0 status  = 0x2e1
[  145.739913] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2e1
[  145.739946] renesas xhci 0000:01:00.0: Get port status returned 0x101
[  145.798094] renesas xhci 0000:01:00.0: xhci_hub_status_data: stopping port polling.
[  146.363387] renesas xhci 0000:01:00.0: Port Status Change Event for port 3
[  146.363416] renesas xhci 0000:01:00.0: handle_port_status: starting port polling.
[  146.363579] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x202a0
[  146.363599] renesas xhci 0000:01:00.0: Get port status returned 0x10100
[  146.363730] renesas xhci 0000:01:00.0: clear port connect change, actual port 0 status  = 0x2a0
[  146.363844] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2a0
[  146.363863] renesas xhci 0000:01:00.0: Get port status returned 0x100
[  146.398195] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2a0
[  146.398217] renesas xhci 0000:01:00.0: Get port status returned 0x100
[  146.434202] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2a0
[  146.434224] renesas xhci 0000:01:00.0: Get port status returned 0x100
[  146.470182] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2a0
[  146.470204] renesas xhci 0000:01:00.0: Get port status returned 0x100
[  146.506164] renesas xhci 0000:01:00.0: get port status, actual port 0 status  = 0x2a0
[  146.506187] renesas xhci 0000:01:00.0: Get port status returned 0x100
[  146.542112] renesas xhci 0000:01:00.0: xhci_hub_status_data: stopping port polling.

I did some printk tracing in the driver. It seems that as long as the urbs during the initialization phase of the port are transferred using method rh_urb_enqueue, everything is fine, but for reading the device descriptor of the plugged in device, this is the first dma based transfer and all of those never return anything.

The code that switches the methods from my point of view is the following in usb_hcd_submit_urb in drivers/usb/core/hcd.c:


	if (is_root_hub(urb->dev)) {
		status = rh_urb_enqueue(hcd, urb);
	} else {
		status = map_urb_for_dma(hcd, urb, mem_flags);
		if (likely(status == 0)) {
			status = hcd->driver->urb_enqueue(hcd, urb, mem_flags);
			if (unlikely(status))
				unmap_urb_for_dma(hcd, urb);
		}
	}

The driver in the avm kernel in the freetz-ng sources seems to allocate pages. The dwc2 driver also does some alignment in hcd.c but either just word boundary or what dma_get_cache_alignment() returns (seems to be 128 for mips). But copying both behaviours did not make the dma transfers in the drivers urb_enqueue method work.

I could neither figure out what the alignment requirements are, bytes, pages, 4k, nor to what structures they are required to be applied (avm does the allocate page for urb->transfer_buffer and urb->setup_packet). I wonder if thats documented somewhere.

Thanks for the insight!
It might be of use to the guys working on the 7490: In the meantime, I've sold my Lantiq/AVM devices and I have moved to a ISP Modem / OpenWrt Router configuration due to new cabling demands in my renovated house.

I found the solution, which was an endianess problem.
In older linux sources there is a flag IFX_RCU_AHB_BE_XBAR_S (0x00000008 Configure AHB slave port that connects to XBAR in big endian), which is neither defined nor set in the current kernels or patches. Spotted it in arch/mips/lantiq/vr9/vr9.c and not in the arch/mips/pci/ifxmips_pcie.c where the other changes were based on and so it was probably forgotten when creating the lantiq pcie patches. Adding the definition to ifxmips_pcie_vr9.h and setting it in method pcie_rc_initialize in addition to the regmap_update_bits that are already there, makes the renesas USB driver work without further changes.

I think the thread can be marked as solved and closed.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.