From: Stefan Roese Date: Thu, 29 Jun 2017 08:13:41 +0200 Subject: [U-Boot] [PATCH 0/3] usb: xhci: Add interrupt transfer support In-Reply-To: References: <1498475142-9252-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <87d6fcc1-b8cd-5822-582a-c1ecf55d4296@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Bin, On 29.06.2017 07:39, Bin Meng wrote: > Hi Stefan, > > On Wed, Jun 28, 2017 at 8:47 PM, Stefan Roese wrote: >> Hi Bin, >> >> On 28.06.2017 14:11, Bin Meng wrote: >>> On Wed, Jun 28, 2017 at 7:00 PM, Stefan Roese wrote: >>>> Hi Bin, >>>> >>>> On 26.06.2017 13:05, Bin Meng wrote: >>>>> This series is the final series of the xHCI driver update. >>>>> >>>>> This adds the missing interrupt transfer support to xHCI driver, so >>>>> that devices like USB keyboard that uses interrupt transfer when >>>>> CONFIG_SYS_USB_EVENT_POLL is defined can work. >>>>> >>>>> Previous two series: >>>>> [1]: usb: xhci: Fix USB xHCI support on Intel platform >>>>> https://lists.denx.de/pipermail/u-boot/2017-June/296166.html >>>>> [2]: usb: hub: Support USB 3.0 hubs >>>>> https://lists.denx.de/pipermail/u-boot/2017-June/296284.html >>>>> >>>>> This series is available at u-boot-x86/xhci-working3 for testing. >>>> >>>> I'm using this git branch to test all your xHCI related patches >>>> now. On my BayTrail platform I get these messages upon "usb reset" >>>> scanning: >>>> >>>> => 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) >>>> 5 USB Device(s) found >>>> scanning usb for storage devices... 1 Storage Device(s) found >>>> >>>> On the 2nd scan, the "cannot reset port 1" line is gone: >>>> >>>> => 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... 1 Storage Device(s) found >>>> >>>> All USB devices seem to be detected correctly though. Here the >>>> logs: >>>> >>>> => usb tree >>>> USB device tree: >>>> 1 Hub (5 Gb/s, 0mA) >>>> | U-Boot XHCI Host Controller >>>> | >>>> +-2 Hub (480 Mb/s, 100mA) >>>> | >>>> +-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 >>>> >>>> => usb info >>>> 1: Hub, USB Revision 3.0 >>>> - U-Boot XHCI Host Controller >>>> - Class: Hub >>>> - PacketSize: 512 Configurations: 1 >>>> - Vendor: 0x0000 Product 0x0000 Version 1.0 >>>> Configuration: 1 >>>> - Interfaces: 1 Self Powered 0mA >>>> Interface: 0 >>>> - Alternate Setting 0, Endpoints: 1 >>>> - Class Hub >>>> - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms >>>> >>>> 2: Hub, USB Revision 2.0 >>>> - Class: Hub >>>> - PacketSize: 64 Configurations: 1 >>>> - Vendor: 0x0409 Product 0x005a Version 1.0 >>>> Configuration: 1 >>>> - Interfaces: 1 Self Powered Remote Wakeup 100mA >>>> Interface: 0 >>>> - Alternate Setting 0, Endpoints: 1 >>>> - Class Hub >>>> - Endpoint 1 In Interrupt MaxPacket 1 Interval 12ms >>>> >>>> 3: Hub, USB Revision 2.1 >>>> - Class: Hub >>>> - PacketSize: 64 Configurations: 1 >>>> - Vendor: 0x0424 Product 0x4604 Version 1.131 >>>> Configuration: 1 >>>> - Interfaces: 1 Self Powered Remote Wakeup 2mA >>>> Interface: 0 >>>> - Alternate Setting 0, Endpoints: 1 >>>> - Class Hub >>>> - Endpoint 1 In Interrupt MaxPacket 1 Interval 12ms >>>> - Endpoint 1 In Interrupt MaxPacket 1 Interval 12ms >>>> >>>> 5: Mass Storage, USB Revision 2.10 >>>> - JetFlash Mass Storage Device 3281440601 >>>> - Class: (from Interface) Mass Storage >>>> - PacketSize: 64 Configurations: 1 >>>> - Vendor: 0x8564 Product 0x1000 Version 16.117 >>>> Configuration: 1 >>>> - Interfaces: 1 Bus Powered 200mA >>>> Interface: 0 >>>> - Alternate Setting 0, Endpoints: 2 >>>> - Class Mass Storage, Transp. SCSI, Bulk only >>>> - Endpoint 2 Out Bulk MaxPacket 512 >>>> - Endpoint 1 In Bulk MaxPacket 512 >>>> >>>> 4: Vendor specific, USB Revision 3.0 >>>> - Realtek USB 10/100/1000 LAN 000002000000 >>>> - Class: (from Interface) Vendor specific >>>> - PacketSize: 512 Configurations: 2 >>>> - Vendor: 0x0bda Product 0x8153 Version 48.0 >>>> Configuration: 1 >>>> - Interfaces: 1 Bus Powered Remote Wakeup 64mA >>>> Interface: 0 >>>> - Alternate Setting 0, Endpoints: 3 >>>> - Class Vendor specific >>>> - Endpoint 1 In Bulk MaxPacket 1024 >>>> - Endpoint 2 Out Bulk MaxPacket 1024 >>>> - Endpoint 3 In Interrupt MaxPacket 2 Interval 8ms >>>> >>>> Do you have any ideas about the scanning logs that I've noticed >>>> above? Would it help if I provided some debug logs (-DDEBUG) >>>> for this? >>> >>> "cannot reset port 1" message is annoying, but that may happen >>> sometimes due to unstable power supply. I will see if we can mute it >>> if it's not the final round of reset try. >> >> That would be good, thanks. >> >>> 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 Can you reproduce this on your MinnowMax? Would it help, if I would enable some traces (-DDEBUG)? Thanks, Stefan