[U-Boot] [PATCH 0/3] usb: xhci: Add interrupt transfer support

Stefan Bruens stefan.bruens at rwth-aachen.de
Thu Jun 29 09:12:01 UTC 2017


On Donnerstag, 29. Juni 2017 08:13:41 CEST Stefan Roese wrote:
> Hi Bin,
> 
> On 29.06.2017 07:39, Bin Meng wrote:
> > Hi Stefan,
> > 
> > On Wed, Jun 28, 2017 at 8:47 PM, Stefan Roese <sr at denx.de> wrote:
[...]
> >>> I am more concerned about
> >>> the "USB device descriptor short read (expected 18, got 8)". This
> >>> message indicates U-Boot cannot get the device descriptor during set
> >>> configuration process. So did you manage to get all USB devices that
> >>> are connected on your board enumerated?
> >> 
> >> Might be that I'm missing some keyboard / mouse, which I'm not
> >> using and not really aware of. One USB port is connected to a
> >> KVM switch, enumberating such devices. Here the log from U-Boot
> >> and Linux again:
> >> 
> >> => usb reset
> >> resetting USB...
> >> USB0:   Register 7000820 NbrPorts 7
> >> Starting the controller
> >> USB XHCI 1.00
> >> scanning bus 0 for devices... cannot reset port 1!?
> >> USB device descriptor short read (expected 18, got 8)
> >> 6 USB Device(s) found
> >> 
> >>         scanning usb for storage devices... 2 Storage Device(s) found
> >> 
> >> => usb tree
> >> 
> >> USB device tree:
> >>    1  Hub (5 Gb/s, 0mA)
> >>    
> >>    |  U-Boot XHCI Host Controller
> >>    
> >>    +-2  Hub (480 Mb/s, 100mA)
> >>    
> >>    +-3  Mass Storage (480 Mb/s, 98mA)
> >>    
> >>    |    USBest Technology USB Mass Storage Device 09092207fbf0c4
> >>    
> >>    +-4  Hub (480 Mb/s, 2mA)
> >>    
> >>    | +-6  Mass Storage (480 Mb/s, 200mA)
> >>    | 
> >>    |      JetFlash Mass Storage Device 3281440601
> >>    
> >>    +-5  Vendor specific (5 Gb/s, 64mA)
> >>    
> >>         Realtek USB 10/100/1000 LAN 000002000000
> >> 
> >> $ lsusb -t
> >> /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 5000M
> >> 
> >>      |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=r8152,
> >>      |5000M
> >> 
> >> /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 480M
> >> 
> >>      |__ Port 2: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
> >>      |
> >>          |__ Port 4: Dev 4, If 0, Class=Hub, Driver=hub/4p, 12M
> >>          |
> >>              |__ Port 1: Dev 6, If 1, Class=Human Interface Device,
> >>              |Driver=usbhid, 12M
> >>              |__ Port 1: Dev 6, If 2, Class=Human Interface Device,
> >>              |Driver=usbhid, 12M
> >>              |__ Port 1: Dev 6, If 0, Class=Human Interface Device,
> >>              |Driver=usbhid, 12M
> >>      |
> >>      |__ Port 4: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage,
> >>      |480M
> >>      |__ Port 5: Dev 5, If 0, Class=Hub, Driver=hub/4p, 480M
> >>      |
> >>          |__ Port 1: Dev 7, If 0, Class=Mass Storage, Driver=usb-storage,
> >>          |480M
> >> 
> >> Which event polling Kconfig option do I need to enable?
> > 
> > The default one CONFIG_SYS_USB_EVENT_POLL should be OK. By comparing
> > your U-Boot log and Linux one, I found the following devices were
> > 
> > enumerated by Linux but not by U-Boot:
> >              |__ Port 1: Dev 6, If 1, Class=Human Interface Device,
> > 
> > Driver=usbhid, 12M
> > 
> >              |__ Port 1: Dev 6, If 2, Class=Human Interface Device,
> > 
> > Driver=usbhid, 12M
> > 
> >              |__ Port 1: Dev 6, If 0, Class=Human Interface Device,
> > 
> > Driver=usbhid, 12M
> > 
> > These devices are full speed devices. I believe the reason is that
> > U-Boot encounters "USB device descriptor short read (expected 18, got
> > 8)" so it does  not continue the enumeration. As to why these full
> > speed devices only return 8 bytes descriptors, this needs to be
> > investigated. Which devices are they?
> 
> This is my KVM switch with its USB keyboard and mouse. When I unplug
> this USB cable, this message does not appear while running "usb reset".
> 
> This also happen, when I only plug a USB mouse to this same USB
> port:
> 
> => usb reset
> resetting USB...
> USB0:   Register 7000820 NbrPorts 7
> Starting the controller
> USB XHCI 1.00
> scanning bus 0 for devices... USB device descriptor short read (expected 18,
> got 8) 5 USB Device(s) found
>        scanning usb for storage devices... 2 Storage Device(s) found
> => usb tree
> USB device tree:
>   1  Hub (5 Gb/s, 0mA)
> 
>   |  U-Boot XHCI Host Controller
> 
>   +-2  Mass Storage (480 Mb/s, 98mA)
> 
>   |    USBest Technology USB Mass Storage Device 09092207fbf0c4
> 
>   +-3  Hub (480 Mb/s, 2mA)
> 
>   | +-5  Mass Storage (480 Mb/s, 200mA)
>   | 
>   |      JetFlash Mass Storage Device 3281440601
> 
>   +-4  Vendor specific (5 Gb/s, 64mA)
>        Realtek USB 10/100/1000 LAN 000002000000
> 
> 
> $ lsusb -t
> /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 5000M
> 
>     |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=r8152,
>     |5000M
> 
> /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 480M
> 
>     |__ Port 2: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid,
>     |12M
>     |__ Port 2: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid,
>     |12M
>     |__ Port 4: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M
>     |__ Port 5: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M
>     |
>         |__ Port 1: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage,
>         |480M

U-Boot requests the whole USB Device descriptor, i.e. at least 18 bytes. *If* 
the devices bMaxPacketSize0 is 8, it will only return 8 bytes per IN transfer. 
If the driver fails to set the packet size according to the devices 
capabilities, the HC may only do one instead of multiple IN transfers, i.e. 
you end up with only 8 bytes.

I you look at common/usb.c, usb_setup_descriptor(...), you can see it actually 
only requests *at least* 8 bytes. You should verify where you descriptor 
request is coming from. Either it failed to query the bMaxPacketSize0, or it 
somehow got reset, i.e. later requests are not split into multiple IN 
transfers.

Kind regards,

Stefan

-- 
Stefan Brüns  /  Bergstraße 21  /  52062 Aachen
home: +49 241 53809034     mobile: +49 151 50412019


More information about the U-Boot mailing list