From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bin Meng Date: Tue, 22 May 2018 16:20:26 +0800 Subject: [U-Boot] [xHCI] Controller failure with USB 3.0 hub In-Reply-To: References: <0833043c-33e0-43e1-e58a-58389cd8cc23@gmail.com> <532bd205-7efa-7994-4e4c-f0954f1226cd@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Marek, On Sat, May 19, 2018 at 7:54 PM, Bin Meng wrote: > Hi Marek, > > On Sat, May 19, 2018 at 7:30 PM, Marek Vasut wrote: >> On 05/19/2018 01:09 PM, Bin Meng wrote: >>> Hi Marek, >> >> Hi, >> >>> On Sat, May 19, 2018 at 9:03 AM, Marek Vasut wrote: >>>> 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. >>> >>> 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. > >>> Can you try the following patch to see if it makes any difference? >>> >>> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c >>> index 3adb002..eec3f64 100644 >>> --- a/drivers/usb/host/xhci.c >>> +++ b/drivers/usb/host/xhci.c >>> @@ -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. >> > > 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. To continue debugging this, could you print out the slot context contents (slot_ctx->*) before calling xhci_configure_endpoints(udev, false)? Regards, Bin