On Thu, May 26, 2016 at 4:05 PM, Martin Townsend <mtownsend1973@xxxxxxxxx> wrote: > Hi, > > I'm currently trying to get the USB Host working on the SH7760. I > tried the platform driver to start with and get the following error on > boot: > [ 3.600000] usb 1-1: new full-speed USB device number 2 using ohci-platform > [ 3.872000] ohci-platform ohci-platform: frame counter not updating; disabled > [ 3.872000] ohci-platform ohci-platform: HC died; cleaning up > > So I dug a bit further and see that the SH7760 driver in the 2.6 > kernel makes use of the 8KB shared memory for HCCA and ED/TD buffers. > After looking through the code for the 4.1 Kernel I am currently > trying to port to I think I need to write my own platform driver that > calls dma_declare_coherent_memory so that the OHCI driver uses this > 8KB shared memory. Then set HCD_LOCAL_MEM in the hc_driver flags to > ensure that it uses dma_alloc_coherent. In other words copy what the > ohci-sm501.c file is doing. I just wanted to confirm that this is > what I should be doing or is there a better generic way of telling the > OHCI driver to use this 8KB shared memory. > 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. and I get the following error [ 1.040000] Found resource sh7760-usb-irq [ 1.060000] Found resource sh7760-usb-shared-memory [ 1.060000] Found resource sh7760-usb-io-memory [ 1.130000] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001 [ 1.130000] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 1.130000] usb usb1: Product: Generic Platform OHCI controller [ 1.130000] usb usb1: Manufacturer: Linux 4.1.17-yocto-standard ohci_hcd [ 1.130000] usb usb1: SerialNumber: ohci-platform [ 1.130000] device: 'usb1': device_add [ 1.130000] bus: 'usb': add device usb1 [ 1.130000] bus: 'usb': driver_probe_device: matched device usb1 with driver usb [ 1.130000] bus: 'usb': really_probe: probing driver usb with device usb1 [ 1.130000] bus: 'usb': add device 1-0:1.0 [ 1.130000] bus: 'usb': driver_probe_device: matched device 1-0:1.0 with driver hub [ 1.130000] bus: 'usb': really_probe: probing driver hub with device 1-0:1.0 [ 1.130000] device: 'usb1-port1': device_add [ 1.130000] device: 'usb1-port2': device_add [ 1.130000] bus: 'usb': really_probe: bound device 1-0:1.0 to driver hub [ 1.130000] driver: 'usb': driver_bound: bound to device 'usb1' [ 1.130000] bus: 'usb': really_probe: bound device usb1 to driver usb [ 1.140000] bus: 'usb': add driver usbhid [ 1.140000] usbcore: registered new interface driver usbhid [ 1.140000] usbhid: USB HID core driver [ 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 Here's the board support definitions /* No power control needed so a blank platform data */ static struct usb_ohci_pdata usb_ohci_pdata; static u64 usb_ohci_dma_mask = 0xffffffff; static struct resource sh7760_usb_resources[] = { DEFINE_RES_MEM_NAMED(SH7760_USB_BASE, SH7760_USB_IOLEN, "sh7760-usb-io-memory"), DEFINE_RES_MEM_NAMED(SH7760_USB_SHARED_MEM_BASE_ADDR, SH7760_USB_SHARED_MEM_LEN, "sh7760-usb-shared-memory"), DEFINE_RES_IRQ_NAMED(USB_IRQ, "sh7760-usb-irq"), }; static struct platform_device sh7760_usb_host_device = { .name = "ohci-platform", .id = -1, .dev = { .dma_mask = &usb_ohci_dma_mask, .coherent_dma_mask = DMA_BIT_MASK(32), .platform_data = &usb_ohci_pdata, }, .num_resources = ARRAY_SIZE(sh7760_usb_resources), .resource = sh7760_usb_resources, }; /proc/iomem is showing fe340000-fe340ffe : sh7760-usb-io-memory fe340000-fe340ffe : sh7760-usb-io-memory fe341000-fe342fff : sh7760-usb-shared-memory fe341000-fe342fff : ohci-platform 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. Also any ideas on where to start with debugging this would be appreciated. - Martin > Thanks in advance, > Martin. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html