RE: Slightly off-topic, USB code in Linux working, but fails in U-Boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
> 
> Unfortunately, similar reports on the U-Boot mailing list have been met
> with no useful information. I'm asking here because 1) the setup works on
> Linux, and 2) there are a lot of knowledgable USB folks here.
> 
> That being said, my issue has to do with a Freescale PowerPC SoC based
> system: P4080 with dual ehci-fsl USB controllers. One of them is internal
> only, and has a DisplayLink device attached. The second is connected to
> an internal USB2514 hub, self-powered. The 2514 is then connected to 3
> external ports. The issues are to do with the second hcd and certain
> devices connected to the USB2514 hub.
> 
> Here is lsusb -t from Linux (as I said, things work in Linux):
> 
> /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=fsl-ehci/1p, 480M
>     |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=udlfb,
> 480M
> /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=fsl-ehci/1p, 480M
>     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
>         |__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/3p, 12M
>             |__ Port 1: Dev 4, If 0, Class=Human Interface Device,
> Driver=usbhid, 1.5M
>             |__ Port 1: Dev 4, If 1, Class=Human Interface Device,
> Driver=usbhid, 1.5M
>             |__ Port 3: Dev 5, If 0, Class=Human Interface Device,
> Driver=usbhid, 1.5M
> 
> So the problem in U-Boot has to do with device 3 on bus 1, which is a
> Dell USB keyboard with internal hub (it has two ports on the keyboard for
> attaching a mouse, etc).
> 
> Now, on U-Boot, if I connect a standard device such as a USB stick or USB
> mouse, to the 2514 (device 2, bus 1), it is detected and works without
> issue.
> 
> However, this external Dell Keyboard Hub (and a few other similar
> keyboard devices) cause an error when U-Boot tries to probe it. The error
> occurs when retrieving the descriptor. U-Boot has both methods (8byte and
> 64byte) for retrieving descriptor, and both fail the same way. The status
> returned from the hcd is 0x4a (Stalled, XactErr, SplitXState). I've even
> tried setting the device address first (which succeeds) and then
> retrieving the descriptor, but that descriptor request fails the same way.
> 
> Note that all other devices in this tree are detected fine, including the
> 2514 Hub, and simple devices attached to it.
> 
> Here is the code in question from U-Boot usb.c:
> 
>         desc = (struct usb_device_descriptor *)tmpbuf;
>         dev->descriptor.bMaxPacketSize0 = 64;       /* Start off at 64
> bytes  */
>         /* Default to 64 byte max packet size */
>         dev->maxpacketsize = PACKET_SIZE_64;
>         dev->epmaxpacketin[0] = 64;
>         dev->epmaxpacketout[0] = 64;
> 
>         err = usb_control_msg(dev, usb_rcvaddr0pipe(),
>                         USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
>                         USB_DT_DEVICE << 8, 0, desc, 64,
>                         USB_CNTL_TIMEOUT);
> 
>         if (err < 0) {
>                 printf("usb_new_device: usb_get_descriptor() failed\n");
>                 return 1;
>         }
> 
> This control message fails. Here's the full lsusb output from Linux:
> 

- If you have a usb bus analyzer, please check if the GET_DESCRPTOR sends out successfully.
(Most probably, I don't think it sends out)
- You may need to check if the value for qh and qtd are the same with Linux (for GET_DESCRITPOR)
The hardware will use qh and qtd to sends data. You can dump memory for that. 
At linux, the code to print current qh and qtd: at drivers/usb/host/ehci-q.c (fn: qh_link_async)
NOTE: You can only print current qh/qtd before the async schedule has begun.

                {
                int i;
                struct ehci_qtd *qtd;
                u32 *qh_addr_virt = qh->hw;
                printk("addr of qh 0x%x\n", qh_addr_virt);
                for (i=0; i<12;i++)
                        printk("0x%x\n", *(u32 *)(qh_addr_virt + i));
                qtd = list_entry (qh->qtd_list.next,
                                struct ehci_qtd, qtd_list);
                printk("addr of qtd 0x%x\n", qtd);
                for (i=0; i<8;i++)
                        printk("0x%x\n", *((u32 *)qtd + i));

                }

Peter

> Bus 002 Device 002: ID 17e9:047b DisplayLink
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.00
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0        64
>   idVendor           0x17e9 DisplayLink
>   idProduct          0x047b
>   bcdDevice            1.06
>   iManufacturer           1 DisplayLink
>   iProduct                2 CTS-1000
>   iSerial                 3 00000000-000000
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           55
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          0
>     bmAttributes         0x80
>       (Bus Powered)
>     MaxPower              500mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      0
>       bInterfaceProtocol      0
>       iInterface              0
>       ** UNRECOGNIZED:  17 5f 01 00 15 05 00 01 03 00 04 04 01 00 03 60
> 00 02 04 60 e3 16 00
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x01  EP 1 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x82  EP 2 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0008  1x 8 bytes
>         bInterval               4
> Device Qualifier (for other device speed):
>   bLength                10
>   bDescriptorType         6
>   bcdUSB               2.00
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0        64
>   bNumConfigurations      1
> Device Status:     0x0000
>   (Bus Powered)
> 
> Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.00
>   bDeviceClass            9 Hub
>   bDeviceSubClass         0 Unused
>   bDeviceProtocol         1 Single TT
>   bMaxPacketSize0        64
>   idVendor           0x1d6b Linux Foundation
>   idProduct          0x0002 2.0 root hub
>   bcdDevice            3.11
>   iManufacturer           3 Linux 3.11.0-5-powerpc-e500mc ehci_hcd
>   iProduct                2 Freescale On-Chip EHCI Host Controller
>   iSerial                 1 fsl-ehci.1
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           25
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          0
>     bmAttributes         0xe0
>       Self Powered
>       Remote Wakeup
>     MaxPower                0mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         9 Hub
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 Full speed (or root) hub
>       iInterface              0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0004  1x 4 bytes
>         bInterval              12
> Hub Descriptor:
>   bLength               9
>   bDescriptorType      41
>   nNbrPorts             1
>   wHubCharacteristic 0x0009
>     Per-port power switching
>     Per-port overcurrent protection
>     TT think time 8 FS bits
>   bPwrOn2PwrGood       10 * 2 milli seconds
>   bHubContrCurrent      0 milli Ampere
>   DeviceRemovable    0x00
>   PortPwrCtrlMask    0xff
>  Hub Port Status:
>    Port 1: 0000.0503 highspeed power enable connect
> Device Status:     0x0001
>   Self Powered
> 
> Bus 001 Device 005: ID 046d:c00e Logitech, Inc. M-BJ58/M-BJ69 Optical
> Wheel Mouse
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.00
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0         8
>   idVendor           0x046d Logitech, Inc.
>   idProduct          0xc00e M-BJ58/M-BJ69 Optical Wheel Mouse
>   bcdDevice           11.10
>   iManufacturer           1 Logitech
>   iProduct                2 USB-PS/2 Optical Mouse
>   iSerial                 0
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           34
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          0
>     bmAttributes         0xa0
>       (Bus Powered)
>       Remote Wakeup
>     MaxPower               98mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         3 Human Interface Device
>       bInterfaceSubClass      1 Boot Interface Subclass
>       bInterfaceProtocol      2 Mouse
>       iInterface              0
>         HID Device Descriptor:
>           bLength                 9
>           bDescriptorType        33
>           bcdHID               1.10
>           bCountryCode            0 Not supported
>           bNumDescriptors         1
>           bDescriptorType        34 Report
>           wDescriptorLength      52
>          Report Descriptors:
>            ** UNAVAILABLE **
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0004  1x 4 bytes
>         bInterval              10
> Device Status:     0x0000
>   (Bus Powered)
> 
> Bus 001 Device 004: ID 413c:2006 Dell Computer Corp.
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               1.10
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0         8
>   idVendor           0x413c Dell Computer Corp.
>   idProduct          0x2006
>   bcdDevice           48.00
>   iManufacturer           1 Dell
>   iProduct                2 Dell USB Keyboard Hub
>   iSerial                 0
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           59
>     bNumInterfaces          2
>     bConfigurationValue     1
>     iConfiguration          3 83NT6504V110
>     bmAttributes         0xa0
>       (Bus Powered)
>       Remote Wakeup
>     MaxPower               90mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         3 Human Interface Device
>       bInterfaceSubClass      1 Boot Interface Subclass
>       bInterfaceProtocol      1 Keyboard
>       iInterface              2 Dell USB Keyboard Hub
>         HID Device Descriptor:
>           bLength                 9
>           bDescriptorType        33
>           bcdHID               1.10
>           bCountryCode            0 Not supported
>           bNumDescriptors         1
>           bDescriptorType        34 Report
>           wDescriptorLength      65
>          Report Descriptors:
>            ** UNAVAILABLE **
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0008  1x 8 bytes
>         bInterval              10
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         3 Human Interface Device
>       bInterfaceSubClass      0 No Subclass
>       bInterfaceProtocol      0 None
>       iInterface              2 Dell USB Keyboard Hub
>         HID Device Descriptor:
>           bLength                 9
>           bDescriptorType        33
>           bcdHID               1.10
>           bCountryCode            0 Not supported
>           bNumDescriptors         1
>           bDescriptorType        34 Report
>           wDescriptorLength     142
>          Report Descriptors:
>            ** UNAVAILABLE **
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x82  EP 2 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0004  1x 4 bytes
>         bInterval             255
> Device Status:     0x0000
>   (Bus Powered)
> 
> Bus 001 Device 003: ID 413c:1004 Dell Computer Corp.
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               1.10
>   bDeviceClass            9 Hub
>   bDeviceSubClass         0 Unused
>   bDeviceProtocol         0 Full speed (or root) hub
>   bMaxPacketSize0         8
>   idVendor           0x413c Dell Computer Corp.
>   idProduct          0x1004
>   bcdDevice           48.01
>   iManufacturer           1 Dell
>   iProduct                2 Dell USB Keyboard Hub
>   iSerial                 0
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           25
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          2 Dell USB Keyboard Hub
>     bmAttributes         0xa0
>       (Bus Powered)
>       Remote Wakeup
>     MaxPower              100mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         9 Hub
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 Full speed (or root) hub
>       iInterface              2 Dell USB Keyboard Hub
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0001  1x 1 bytes
>         bInterval              24
> Hub Descriptor:
>   bLength               9
>   bDescriptorType      41
>   nNbrPorts             3
>   wHubCharacteristic 0x000d
>     Per-port power switching
>     Compound device
>     Per-port overcurrent protection
>   bPwrOn2PwrGood       22 * 2 milli seconds
>   bHubContrCurrent    100 milli Ampere
>   DeviceRemovable    0x02
>   PortPwrCtrlMask    0xff
>  Hub Port Status:
>    Port 1: 0000.0303 lowspeed power enable connect
>    Port 2: 0000.0100 power
>    Port 3: 0000.0303 lowspeed power enable connect
> Device Status:     0x0000
>   (Bus Powered)
> 
> Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.00
>   bDeviceClass            9 Hub
>   bDeviceSubClass         0 Unused
>   bDeviceProtocol         2 TT per port
>   bMaxPacketSize0        64
>   idVendor           0x0424 Standard Microsystems Corp.
>   idProduct          0x2514 USB 2.0 Hub
>   bcdDevice            0.00
>   iManufacturer           1 (error)
>   iProduct                2 (error)
>   iSerial                 3 (error)
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           41
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          0
>     bmAttributes         0xe0
>       Self Powered
>       Remote Wakeup
>     MaxPower              100mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         9 Hub
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      1 Single TT
>       iInterface              0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0001  1x 1 bytes
>         bInterval              12
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       1
>       bNumEndpoints           1
>       bInterfaceClass         9 Hub
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      2 TT per port
>       iInterface              0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0001  1x 1 bytes
>         bInterval              12
> Hub Descriptor:
>   bLength               9
>   bDescriptorType      41
>   nNbrPorts             4
>   wHubCharacteristic 0x0009
>     Per-port power switching
>     Per-port overcurrent protection
>     TT think time 8 FS bits
>   bPwrOn2PwrGood       50 * 2 milli seconds
>   bHubContrCurrent     50 milli Ampere
>   DeviceRemovable    0x00
>   PortPwrCtrlMask    0xff
>  Hub Port Status:
>    Port 1: 0000.0103 power enable connect
>    Port 2: 0000.0100 power
>    Port 3: 0000.0100 power
>    Port 4: 0000.0100 power
> Device Qualifier (for other device speed):
>   bLength                10
>   bDescriptorType         6
>   bcdUSB               2.00
>   bDeviceClass            9 Hub
>   bDeviceSubClass         0 Unused
>   bDeviceProtocol         0 Full speed (or root) hub
>   bMaxPacketSize0        64
>   bNumConfigurations      1
> Device Status:     0x0001
>   Self Powered
> 
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.00
>   bDeviceClass            9 Hub
>   bDeviceSubClass         0 Unused
>   bDeviceProtocol         1 Single TT
>   bMaxPacketSize0        64
>   idVendor           0x1d6b Linux Foundation
>   idProduct          0x0002 2.0 root hub
>   bcdDevice            3.11
>   iManufacturer           3 Linux 3.11.0-5-powerpc-e500mc ehci_hcd
>   iProduct                2 Freescale On-Chip EHCI Host Controller
>   iSerial                 1 fsl-ehci.0
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           25
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          0
>     bmAttributes         0xe0
>       Self Powered
>       Remote Wakeup
>     MaxPower                0mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         9 Hub
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 Full speed (or root) hub
>       iInterface              0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0004  1x 4 bytes
>         bInterval              12
> Hub Descriptor:
>   bLength               9
>   bDescriptorType      41
>   nNbrPorts             1
>   wHubCharacteristic 0x0009
>     Per-port power switching
>     Per-port overcurrent protection
>     TT think time 8 FS bits
>   bPwrOn2PwrGood       10 * 2 milli seconds
>   bHubContrCurrent      0 milli Ampere
>   DeviceRemovable    0x00
>   PortPwrCtrlMask    0xff
>  Hub Port Status:
>    Port 1: 0000.0503 highspeed power enable connect
> Device Status:     0x0001
>   Self Powered
> 
> 
> --
> Servergy  : http://www.servergy.com/
> SwissDisk : http://www.swissdisk.com/
> Ubuntu    : http://www.ubuntu.com/
> My Blog   : http://ben-collins.blogspot.com/

--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux