Controller failure with USB 3.0 hub
Subsystems (2)
Hello Bin,
I noticed a potential bug in the U-Boot xHCI implementation. I observe this one Renesas RCar Gen3 platform.
If I plug a USB 3.0 hub into the root port, I see the following error:
ERROR: Configure Endpoint command returned completion code 5.
If I plug a USB 3.0 stick into the root port, I do not get the error and the stick is correctly detected.
Example with the USB 3.0 hub:
=> usb reset
resetting USB...
USB0: Register 2000120 NbrPorts 2
Starting the controller
USB XHCI 1.00
USB1: USB EHCI 1.10 USB2: USB EHCI 1.10 USB3: USB EHCI 1.10
******** HERE ********
scanning bus 0 for devices... ERROR: Configure Endpoint command returned completion code 5.
******** HERE ********
1 USB Device(s) found
scanning bus 1 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
scanning bus 3 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
=> usb tree
USB device tree:
1 Hub (5 Gb/s, 0mA)
U-Boot XHCI Host Controller
1 Hub (480 Mb/s, 0mA)
u-boot EHCI Host Controller
1 Hub (480 Mb/s, 0mA)
u-boot EHCI Host Controller
1 Hub (480 Mb/s, 0mA)
u-boot EHCI Host Controller
If I revert d228ca362b though, the setup starts working fine. In fact, if I just commend out xhci_update_hub_device() in xhci_usb_ops , it works fine as well.
Moreover, if I use the following patch, it works fine too:
drivers/usb/host/xhci.c +0 -0
@@ -1453,7 +1453,7 @@ static int xhci_update_hub_device(struct udevice
*dev, struct usb_device *udev)
if (udev->speed == USB_SPEED_HIGH)
slot_ctx->tt_info |= cpu_to_le32(TT_THINK_TIME(think_time));- return xhci_configure_endpoints(udev, false);
+ return xhci_configure_endpoints(udev, true);
}
static int xhci_get_max_xfer_size(struct udevice *dev, size_t *size)
That is:
=> usb reset
resetting USB...
USB0: Register 2000120 NbrPorts 2
Starting the controller
USB XHCI 1.00
USB1: USB EHCI 1.10 USB2: USB EHCI 1.10 USB3: USB EHCI 1.10
scanning bus 0 for devices... 5 USB Device(s) found scanning bus 1 for devices... 1 USB Device(s) found scanning bus 2 for devices... 1 USB Device(s) found scanning bus 3 for devices... 1 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 (5 Gb/s, 2mA)
| | VIA Labs, Inc. 4-Port USB 3.0 Hub
| |
| +-4 Mass Storage (5 Gb/s, 224mA)
| SanDisk Ultra 4C530001110620109113
|
+-3 Hub (480 Mb/s, 100mA)
| USB2.0 Hub
|
+-5 Mass Storage (480 Mb/s, 200mA)
USB FLASH DRIVE 195A06010623 1 Hub (480 Mb/s, 0mA)
u-boot EHCI Host Controller
1 Hub (480 Mb/s, 0mA)
u-boot EHCI Host Controller
1 Hub (480 Mb/s, 0mA)
u-boot EHCI Host Controller
Do you have an explanation for me ?
Signature · 2 lines
Best regards, Marek Vasut
Hi Marek,
Quoted 17 lines · Marek Vasut
Hello Bin,
I noticed a potential bug in the U-Boot xHCI implementation. I observe this one Renesas RCar Gen3 platform.
If I plug a USB 3.0 hub into the root port, I see the following error:
ERROR: Configure Endpoint command returned completion code 5.
If I plug a USB 3.0 stick into the root port, I do not get the error and the stick is correctly detected.Example with the USB 3.0 hub:
=> usb reset
resetting USB...
USB0: Register 2000120 NbrPorts 2
Starting the controller
USB XHCI 1.00
Quoted 6 lines
USB1: USB EHCI 1.10 USB2: USB EHCI 1.10 USB3: USB EHCI 1.10******** HERE ********
scanning bus 0 for devices... ERROR: Configure Endpoint command returned completion code 5.
Completion code 5 means TRB parameter error, guess the Renesas xHC has some checks on the TRB.
Can you try the following patch to see if it makes any difference?
drivers/usb/host/xhci.c +0 -0
@@ -1453,6 +1453,8 @@ static int xhci_update_hub_device(struct udevice
*dev, struct usb_device *udev)
if (udev->speed == USB_SPEED_HIGH)
slot_ctx->tt_info |= cpu_to_le32(TT_THINK_TIME(think_time));+ slot_ctx->dev_state = 0;
+
return xhci_configure_endpoints(udev, false);
}
Quoted 76 lines
******** HERE ********
1 USB Device(s) found
scanning bus 1 for devices... 1 USB Device(s) found scanning bus 2 for devices... 1 USB Device(s) found scanning bus 3 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
=> usb tree
USB device tree:
1 Hub (5 Gb/s, 0mA)
U-Boot XHCI Host Controller1 Hub (480 Mb/s, 0mA)
u-boot EHCI Host Controller1 Hub (480 Mb/s, 0mA)
u-boot EHCI Host Controller1 Hub (480 Mb/s, 0mA)
u-boot EHCI Host ControllerIf I revert
d228ca362bthough, the setup starts working fine. In fact, if I just commend outxhci_update_hub_device()inxhci_usb_ops, it works fine as well.Moreover, if I use the following patch, it works fine too:
drivers/usb/host/xhci.c +1
-1@@ -1453,7 +1453,7 @@ static int xhci_update_hub_device(struct udevice *dev, struct usb_device *udev)if (udev->speed ==USB_SPEED_HIGH ) slot_ctx->tt_info |=cpu_to_le32 (TT_THINK_TIME (think_time)); -return xhci_configure_endpoints (udev, false); +return xhci_configure_endpoints (udev, true); }static int
xhci_get_max_xfer_size(struct udevice *dev, size_t *size)That is:
=> usb reset
resetting USB...
USB0: Register 2000120 NbrPorts 2
Starting the controller
USB XHCI 1.00USB1: USB EHCI 1.10 USB2: USB EHCI 1.10 USB3: USB EHCI 1.10scanning bus 0 for devices... 5 USB Device(s) found scanning bus 1 for devices... 1 USB Device(s) found scanning bus 2 for devices... 1 USB Device(s) found scanning bus 3 for devices... 1 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 (5 Gb/s, 2mA) | | VIA Labs, Inc. 4-Port USB 3.0 Hub | | | +-4 Mass Storage (5 Gb/s, 224mA) | SanDisk Ultra 4C530001110620109113 | +-3 Hub (480 Mb/s, 100mA) | USB2.0 Hub | +-5 Mass Storage (480 Mb/s, 200mA) USB FLASH DRIVE 195A060106231 Hub (480 Mb/s, 0mA)
u-boot EHCI Host Controller
Quoted 8 lines
1 Hub (480 Mb/s, 0mA)
u-boot EHCI Host Controller1 Hub (480 Mb/s, 0mA)
u-boot EHCI Host ControllerDo you have an explanation for me ?
--
Regards,
Bin
Quoted 1 line · Bin Meng
Hi Marek,
Hi,
Quoted 25 lines · Marek Vasut
Quoted 17 lines
Hello Bin,
I noticed a potential bug in the U-Boot xHCI implementation. I observe this one Renesas RCar Gen3 platform.
If I plug a USB 3.0 hub into the root port, I see the following error:
ERROR: Configure Endpoint command returned completion code 5.
If I plug a USB 3.0 stick into the root port, I do not get the error and the stick is correctly detected.Example with the USB 3.0 hub:
=> usb reset
resetting USB...
USB0: Register 2000120 NbrPorts 2
Starting the controller
USB XHCI 1.00Quoted 6 lines
USB1: USB EHCI 1.10 USB2: USB EHCI 1.10 USB3: USB EHCI 1.10******** HERE ********
scanning bus 0 for devices... ERROR: Configure Endpoint command returned completion code 5.
Quoted 2 lines
Completion code 5 means TRB parameter error, guess the Renesas xHC has some checks on the TRB.
Do you have xhci spec chapter reference/number for me too ? :)
Quoted 7 lines
Can you try the following patch to see if it makes any difference?
drivers/usb/host/xhci.c +0
-0
drivers/usb/host/xhci.c static int xhci_update_hub_device(struct udevice · line 1460
Quoted 8 lines
drivers/usb/host/xhci.c +2
-0@@ -1453,6 +1453,8 @@ static int xhci_update_hub_device(struct udevice *dev, struct usb_device *udev)if (udev->speed ==USB_SPEED_HIGH ) slot_ctx->tt_info |=cpu_to_le32 (TT_THINK_TIME (think_time)); + slot_ctx->dev_state =0 ; +return xhci_configure_endpoints (udev, false); }
Doesn't make any difference, sorry.
Signature · 2 lines
Best regards, Marek Vasut
Hi Marek,
Quoted 30 lines · Marek Vasut
Quoted 1 line · Bin Meng
Hi Marek,
Hi,
Quoted 25 lines · Marek Vasut
Quoted 23 lines
Hello Bin,
I noticed a potential bug in the U-Boot xHCI implementation. I observe this one Renesas RCar Gen3 platform.
If I plug a USB 3.0 hub into the root port, I see the following error:
ERROR: Configure Endpoint command returned completion code 5.
If I plug a USB 3.0 stick into the root port, I do not get the error and the stick is correctly detected.Example with the USB 3.0 hub:
=> usb reset
resetting USB...
USB0: Register 2000120 NbrPorts 2
Starting the controller
USB XHCI 1.00USB1: USB EHCI 1.10 USB2: USB EHCI 1.10 USB3: USB EHCI 1.10******** HERE ********
scanning bus 0 for devices... ERROR: Configure Endpoint command returned completion code 5.
Quoted 5 lines
Quoted 2 lines
Completion code 5 means TRB parameter error, guess the Renesas xHC has some checks on the TRB.
Do you have xhci spec chapter reference/number for me too ? :)
I was looking at xhci spec 1.1 chapter 6.4.5 TRB Completion Codes. I don't have Renesas xHC manual to cross check.
Quoted 11 lines
Quoted 11 lines
Can you try the following patch to see if it makes any difference?
drivers/usb/host/xhci.c +0
-0@@ -1453,6 +1453,8 @@ static int xhci_update_hub_device(struct udevice *dev, struct usb_device *udev)if (udev->speed ==USB_SPEED_HIGH ) slot_ctx->tt_info |=cpu_to_le32 (TT_THINK_TIME (think_time));
Quoted 7 lines
drivers/usb/host/xhci.c static int xhci_update_hub_device(struct udevice · line 1460
Quoted 4 lines
drivers/usb/host/xhci.c +2
-0+ slot_ctx->dev_state =0 ; +return xhci_configure_endpoints (udev, false); }Doesn't make any difference, sorry.
Too bad. Then I don't have any obvious clue so far. The completion code 5 is a helpful sign from xHC to the software that something was wrong in the TRB. Per the xHCI spec, dev_state needs to be cleared. It was working with the x86 xHC though. Changing xhci_configure_endpoints(udev, false) to xhci_configure_endpoints(udev, true) is not correct as the Evaluate Context command is not used with configure the hub attributes.
Regards,
Bin
Hi Marek,
Quoted 61 lines · Bin Meng
Hi Marek,
Quoted 30 lines · Marek Vasut
Quoted 1 line · Bin Meng
Hi Marek,
Hi,
Quoted 25 lines · Marek Vasut
Quoted 23 lines
Hello Bin,
I noticed a potential bug in the U-Boot xHCI implementation. I observe this one Renesas RCar Gen3 platform.
If I plug a USB 3.0 hub into the root port, I see the following error:
ERROR: Configure Endpoint command returned completion code 5.
If I plug a USB 3.0 stick into the root port, I do not get the error and the stick is correctly detected.Example with the USB 3.0 hub:
=> usb reset
resetting USB...
USB0: Register 2000120 NbrPorts 2
Starting the controller
USB XHCI 1.00USB1: USB EHCI 1.10 USB2: USB EHCI 1.10 USB3: USB EHCI 1.10******** HERE ********
scanning bus 0 for devices... ERROR: Configure Endpoint command returned completion code 5.Quoted 5 lines
Quoted 2 lines
Completion code 5 means TRB parameter error, guess the Renesas xHC has some checks on the TRB.
Do you have xhci spec chapter reference/number for me too ? :)
I was looking at xhci spec 1.1 chapter 6.4.5 TRB Completion Codes. I don't have Renesas xHC manual to cross check.
Quoted 11 lines
Quoted 11 lines
Can you try the following patch to see if it makes any difference?
drivers/usb/host/xhci.c +0
-0@@ -1453,6 +1453,8 @@ static int xhci_update_hub_device(struct udevice *dev, struct usb_device *udev)if (udev->speed ==USB_SPEED_HIGH ) slot_ctx->tt_info |=cpu_to_le32 (TT_THINK_TIME (think_time));Quoted 7 lines
drivers/usb/host/xhci.c static int xhci_update_hub_device(struct udevice · line 1460
Quoted 4 lines
drivers/usb/host/xhci.c +2
-0+ slot_ctx->dev_state =0 ; +return xhci_configure_endpoints (udev, false); }Doesn't make any difference, sorry.
Quoted 7 lines
Too bad. Then I don't have any obvious clue so far. The completion code 5 is a helpful sign from xHC to the software that something was wrong in the TRB. Per the xHCI spec,
dev_stateneeds to be cleared. It was working with the x86 xHC though. Changingxhci_configure_endpoints(udev, false)toxhci_configure_endpoints(udev, true)is not correct as the Evaluate Context command is not used with configure the hub attributes.
To continue debugging this, could you print out the slot context contents (slot_ctx->*) before calling xhci_configure_endpoints(udev, false)?
Regards,
Bin