All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [xHCI] Controller failure with USB 3.0 hub
Date: Sat, 19 May 2018 19:09:10 +0800	[thread overview]
Message-ID: <CAEUhbmXzZRbe2LWNH9QJW=Fi-w3eurcxaoZAhMAj3VdmjoD4mQ@mail.gmail.com> (raw)
In-Reply-To: <0833043c-33e0-43e1-e58a-58389cd8cc23@gmail.com>

Hi Marek,

On Sat, May 19, 2018 at 9:03 AM, Marek Vasut <marek.vasut@gmail.com> 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.

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);
 }

> ******** 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:
>
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 3adb0028f2..bd393d92bb 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -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 ?
> --

Regards,
Bin

  reply	other threads:[~2018-05-19 11:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-19  1:03 [U-Boot] [xHCI] Controller failure with USB 3.0 hub Marek Vasut
2018-05-19 11:09 ` Bin Meng [this message]
2018-05-19 11:30   ` Marek Vasut
2018-05-19 11:54     ` Bin Meng
2018-05-22  8:20       ` Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEUhbmXzZRbe2LWNH9QJW=Fi-w3eurcxaoZAhMAj3VdmjoD4mQ@mail.gmail.com' \
    --to=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.