On Thu, May 26, 2016 at 6:31 PM, Alan Stern <st...@rowland.harvard.edu> wrote: > On Thu, 26 May 2016, Martin Townsend wrote: > >> I tried hacking in the relevant code straight into the OHCI platform driver >> res_mem = platform_get_resource(dev, IORESOURCE_MEM, 1); >> if (res_mem == NULL) { >> dev_err(&dev->dev, "no resource definition for memory\n"); >> err = -ENOENT; >> goto err_power; >> } >> >> if (!request_mem_region(res_mem->start, resource_size(res_mem), >> dev->name)) { >> dev_err(&dev->dev, "request_mem_region failed\n"); >> err = -EBUSY; >> goto err_power; >> } >> >> /* >> * Use SH7760 Shared Memory >> */ >> if (!dma_declare_coherent_memory(&dev->dev, res_mem->start, >> res_mem->start - res_mem->parent->start, >> resource_size(res_mem), >> DMA_MEMORY_MAP | >> DMA_MEMORY_EXCLUSIVE)) { >> dev_err(&dev->dev, "cannot declare coherent memory\n"); >> err = -ENXIO; >> goto err_power; >> } >> and setting the HCD_MEMORY_LOCAL flag in the HC driver. > > Did you do this correctly? That is, in the correct driver? > I put the code for the declaring the DMA coherent memory into ohci-platform.c and set the flag in ohci-hcd.c
>> and I get the following error > > ... >> [ 1.510000] usb 1-1: new full-speed USB device number 2 using >> ohci-platform >> [ 1.690000] usb 1-1: device descriptor read/64, error -12 >> [ 1.980000] usb 1-1: device descriptor read/64, error -12 >> [ 2.270000] usb 1-1: new full-speed USB device number 3 using >> ohci-platform >> [ 2.450000] usb 1-1: device descriptor read/64, error -12 >> [ 2.740000] usb 1-1: device descriptor read/64, error -12 >> [ 3.030000] usb 1-1: new full-speed USB device number 4 using >> ohci-platform >> [ 3.450000] usb 1-1: device not accepting address 4, error -12 >> [ 3.630000] usb 1-1: new full-speed USB device number 5 using >> ohci-platform >> [ 4.050000] usb 1-1: device not accepting address 5, error -12 >> [ 4.050000] usb usb1-port1: unable to enumerate USB device > > -12 is -ENOMEM on your system? Yes > > ... >> which looks good. Anyone have an idea as to what's wrong or what the >> error messages mean. I have nothing plugged into the USB ports. > > Nothing plugged into the USB ports? Then why does the system think > something is plugged in? It sounds like the driver is not accessing > the right registers. > >> Also >> any ideas on where to start with debugging this would be appreciated. > > What do you see in /sys/kernel/debug/usb/ohci/*/registers? > root@sh7760:~# cat /sys/kernel/debug/usb/ohci/ohci-platform/registers bus platform, device ohci-platform Generic Platform OHCI controller ohci_hcd OHCI 1.0, NO legacy support registers, rh state running control 0x083 HCFS=operational CBSR=3 cmdstatus 0x00000 SOC=0 intrstatus 0x00000024 FNO SF intrenable 0x8000005a MIE RHSC UE RD WDH hcca frame 0x0000 fmintvl 0xa7782edf FIT FSMPS=0xa778 FI=0x2edf fmremaining 0x800008b0 FRT FR=0x08b0 periodicstart 0x2a2f lsthresh 0x0628 hub poll timer off roothub.a 02000202 POTPGT=2 NPS NDP=2(2) roothub.b 00000000 PPCM=0000 DR=0000 roothub.status 00008002 DRWE OCI roothub.portstatus [0] 0x00000101 PPS CCS roothub.portstatus [1] 0x00000100 PPS Does this look sane? Cheers, Martin. > Alan Stern > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html