29 Jul, 2017

1 commit

  • It was observed that on Intel MinnowMax board, when xHCI is enabled
    in the BayTrail SoC, with a USB 3.0 device connected to the bottom
    USB 3.0 port (mapped to xHCI root port #7), its PORTSC register is
    always 0x201203 (CCS = 1, CSC = 0). The root cause of such behavior
    is unknown yet. Connect status change bit is set on the same port
    with a USB 2.0 device (mapped to xHCI port #1, which is a different
    port on the root hub).

    With current logic in usb_scan_port(), the enumeration process will
    abort if it does not detect a connect status change on a hub port.
    However since a device connection status is correctly reported, the
    enumeration process can still continue.

    With this change, USB device connected to the bottom blue port on
    MinnowMax board can be enumerated under either SS or HS mode.

    Signed-off-by: Bin Meng
    Reviewed-by: Stefan Roese
    Tested-by: Stefan Roese
    Tested-by: Dinh Nguyen

    Bin Meng
     

04 Jul, 2017

1 commit

  • There was for long time no activity in the 4xx area.
    We need to go further and convert to Kconfig, but it
    turned out, nobody is interested anymore in 4xx,
    so remove it.

    Signed-off-by: Heiko Schocher

    Heiko Schocher
     

28 Jul, 2016

2 commits


07 May, 2016

1 commit


03 May, 2016

1 commit


21 Mar, 2016

3 commits

  • This patch changes the USB port scanning procedure and timeout
    handling in the following ways:

    a)
    The power-on delay in usb_hub_power_on() is now reduced to a value of
    max(100ms, "hub->desc.bPwrOn2PwrGood * 2"). The code does not wait
    using mdelay, instead usb_hub_power_on() will wait before querying
    the device in the scanning loop later. The total timeout for this
    hub, which is 1 second + "hub->desc.bPwrOn2PwrGood * 2" is calculated
    and will be used in the following per-port scanning loop as the timeout
    to detect active USB devices on this hub.

    b)
    Don't delay the minimum delay (for power to stabilize) in
    usb_hub_power_on(). Instead skip querying these devices in the scannig
    loop until the delay time is reached.

    c)
    The ports are now scanned in a quasi parallel way. The current code did
    wait for each (unconnected) port to reach its timeout and only then
    continue with the next port. This patch now changes this to scan all
    ports of all USB hubs quasi simultaneously. For this, all ports are added
    to a scanning list. This list is scanned until all ports are ready
    by either a) reaching the connection timeout (calculated earlier), or
    by b) detecting a USB device. This results in a faster USB scan time as
    the recursive scanning of USB hubs connected to the hub that's currently
    being scanned will start earlier.

    One small functional change to the original code is, that ports with
    overcurrent detection will now get rescanned multiple times
    (PORT_OVERCURRENT_MAX_SCAN_COUNT).

    Without this patch:
    starting USB...
    USB0: USB EHCI 1.00
    scanning bus 0 for devices... 9 USB Device(s) found

    time: 20.163 seconds

    With this patch:
    starting USB...
    USB0: USB EHCI 1.00
    scanning bus 0 for devices... 9 USB Device(s) found

    time: 1.822 seconds

    So ~18.3 seconds of USB scanning time reduction.

    Signed-off-by: Stefan Roese
    Acked-by: Hans de Goede
    Tested-by: Stephen Warren

    Stefan Roese
     
  • This patch removes 2 mdelay(200) calls from usb_hub_port_connect_change().
    These delays don't seem to be necessary. At least not in my tests. Here
    the number for a custom x86 Bay Trail board (not in mainline yet) with
    a quite large and complex USB hub infrastructure.

    Without this patch:
    starting USB...
    USB0: USB EHCI 1.00
    scanning bus 0 for devices... 9 USB Device(s) found

    time: 28.415 seconds

    With this patch:
    starting USB...
    USB0: USB EHCI 1.00
    scanning bus 0 for devices... 9 USB Device(s) found

    time: 24.003 seconds

    So ~4.5 seconds of USB scanning time reduction.

    Signed-off-by: Stefan Roese
    Cc: Simon Glass
    Acked-by: Hans de Goede
    Tested-by: Stephen Warren
    Cc: Marek Vasut

    Stefan Roese
     
  • Start with a short USB hub reset delay of 20ms. This can be enough for
    some configurations.

    The 2nd delay at the end of the loop is completely removed. Since the
    delay hasn't been long enough, a longer delay time of 200ms is assigned
    and will be used in the next loop round.

    This hub reset handling is also used in the v4.4 Linux USB driver,
    hub_port_reset().

    Signed-off-by: Stefan Roese
    Cc: Simon Glass
    Acked-by: Hans de Goede
    Tested-by: Stephen Warren
    Cc: Marek Vasut

    Stefan Roese
     

20 Nov, 2015

1 commit


23 Oct, 2015

1 commit


12 Sep, 2015

1 commit


05 Aug, 2015

1 commit

  • The code in question polls an USB port status via USB_REQ_GET_STATUS
    to determine whether there is a device on the port or not. The way to
    figure that out is to check two bits. Those are wPortChange[0] and
    wPortStatus[0].

    The wPortChange[0] indicates whether some kind of a connection status
    change happened on a port (a device was plugged or unplugged). The
    wPortStatus[0] bit indicates the status of the connection (plugged or
    unplugged).

    The current code tests whether wPortChange[0] == wPortStatus[0] and
    if that's the case, considers the loop polling for the presence of a
    USB device on port finished.

    This works for most USB sticks, since they come up really quickly and
    trigger the USB port change detection before the first iteration of the
    detection loop happens. Thus, both wPortChange[0] and wPortStatus[0]
    are set to 1 and thus equal. The loop is existed in it's first iteration
    and the stick is detected correctly.

    The problem is with some obscure USB sticks, which take some time before
    they pop up on the bus after the port was enabled. In this case, both
    the wPortChange[0] and wPortStatus[0] are 0. They are equal again, so
    the loop again exits in the first iteration, but this is incorrect, as
    such USB stick didn't have the opportunity to get detected on the bus.

    Rework the code such, that it checks for wPortChange[0] first to test
    if any connection change happened at all. If no change occured, keep
    polling. If a change did occur, test the wPortStatus[0] to see there is
    some device present on the port and only if this is the case, break out
    of the polling loop.

    This patch also trims down the duration of the polling loop from 10s
    per port to 1s per port. This is still annoyingly long, but there is
    no better option in case of U-Boot unfortunatelly. This change will
    most likely increase the duration of 'usb start' on some platforms,
    but this is needed to fix a bug.

    Signed-off-by: Marek Vasut
    Cc: Simon Glass
    Cc: Hans de Goede

    Marek Vasut
     

22 Jul, 2015

1 commit

  • In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
    We should follow the same convention in U-Boot. Rename the existing
    USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
    macro from Linux for use in U-Boot.

    Signed-off-by: Simon Glass

    Simon Glass
     

15 May, 2015

3 commits


19 Apr, 2015

4 commits


14 Apr, 2015

1 commit


23 Nov, 2014

1 commit

  • U-Boot has never cared about the type when we get max/min of two
    values, but Linux Kernel does. This commit gets min, max, min3, max3
    macros synced with the kernel introducing type checks.

    Many of references of those macros must be fixed to suppress warnings.
    We have two options:
    - Use min, max, min3, max3 only when the arguments have the same type
    (or add casts to the arguments)
    - Use min_t/max_t instead with the appropriate type for the first
    argument

    Signed-off-by: Masahiro Yamada
    Acked-by: Pavel Machek
    Acked-by: Lukasz Majewski
    Tested-by: Lukasz Majewski
    [trini: Fixup arch/blackfin/lib/string.c]
    Signed-off-by: Tom Rini

    Masahiro Yamada
     

04 Nov, 2014

1 commit


29 Aug, 2014

1 commit

  • One specific USB 3.0 device behaves strangely when reset by
    usb_new_device()'s call to hub_port_reset(). For some reason, the device
    appears to briefly drop off the bus when this second bus reset is
    executed, yet if we retry this loop, it'll eventually come back after
    another two resets.

    If USB bus reset is executed over and over within usb_new_device()'s call
    to hub_port_reset(), I see the following sequence of results, which
    repeats as long as you want:

    1) STAT_C_CONNECTION = 1 STAT_CONNECTION = 0 USB_PORT_STAT_ENABLE 0
    2) STAT_C_CONNECTION = 1 STAT_CONNECTION = 1 USB_PORT_STAT_ENABLE 0
    3) STAT_C_CONNECTION = 1 STAT_CONNECTION = 1 USB_PORT_STAT_ENABLE 1

    The device in question is a SanDisk Ultra USB 3.0 16GB memory stick with
    USB VID/PID 0x0781/0x5581.

    In order to allow this device to work with U-Boot, ignore the
    {C_,}CONNECTION bits in the status/change registers, and only use the
    ENABLE bit to determine if the reset was successful.

    To be honest, extensive investigation has failed to determine why this
    problem occurs. I'd love to know! I don't know if it's caused by:
    * A HW bug in the device
    * A HW bug in the Tegra USB controller
    * A SW bug in the U-Boot Tegra USB driver
    * A SW bug in the U-Boot USB core

    This issue only occurs when the device's USB3 pins are attached to the
    host; if only the USB2 pins are connected the issue does not occur. The
    USB3 controller on Tegra is in reset, so is not actively communicating
    with the device at all - a USB3 analyzer confirms this. Slightly
    unplugging the device (so the USB3 pins don't contact) or using a USB2
    cable or hub as an intermediary avoids the problem. For some reason,
    the Linux kernel (either on the same Tegra board, or on an x86 host)
    has no issue with the device, and I observe no disconnections during
    reset.

    This change won't affect any USB device that already works, since such
    devices could not currently be triggering the error return this patch
    removes, or they wouldn't be working currently.

    However, this patch is quite reliable in practice, hence I hope it's
    acceptable to solve the problem.

    The only potential fallout I can see from this patch is:

    * A broken device that triggers C_CONNECTION/!CONNECTION now causes the
    loop in hub_port_reset() to run multiple times. If it never succeeds,
    this will cause "usb start" to take roughly 1s extra to execute.

    * If the user unplugs a device while hub_port_reset() is executing, and
    very quickly swaps in a new device, hub_port_reset() might succeed on
    the new device. This would mean that any information cached about the
    original device (from the descriptor read in usb_new_device(), which
    simply caches the max packet size) might be invalid, which would cause
    problems talking to the new device. However, without this change, the
    new device wouldn't work anyway, so this is probably not much of a
    loss.

    Signed-off-by: Stephen Warren

    Stephen Warren
     

02 Jun, 2014

2 commits

  • Now that we wait the correct specification-mandated time at the end of
    usb_hub_power_on(), I suspect that CONFIG_USB_HUB_MIN_POWER_ON_DELAY has
    no purpose.

    For cm_t35.h, we already wait longer than the original MIN_POWER_ON_DELAY,
    so this change is safe.

    For gw_ventana.h, we will wait as long as the original MIN_POWER_ON_DELAY
    iff pgood_delay was at least 200ms. I'm not sure if this is the case or
    not, hence I've CC'd relevant people to test this change.

    Cc: Igor Grinberg
    Cc: Tim Harvey
    Signed-off-by: Stephen Warren

    Stephen Warren
     
  • usb_hub_power_on() currently waits for the maximum of (a) the hub port's
    power output to become good, (b) the max time the USB specification
    allows a device to take to connect.

    However, these two operations must occur in series rather than in
    parallel. First, the power supply ramps up to the level required to
    power the USB device, and then the device may take a certain amount of
    time to connect (assert D+/D- pullups).

    Related, the maximum time that a device has to assert pullups is 1s not
    100ms.

    This is explained in "Connect Timing ECN.pdf", itself part of
    usb_20_042814.zip from www.usb.org.

    Signed-off-by: Stephen Warren

    Stephen Warren
     

27 Aug, 2013

2 commits


30 Jul, 2013

1 commit

  • When power cycling the hub ports, a misbehaving port will prevent all ports
    from being powered on because we quit at the first sign of trouble.

    Skip problematic ports instead of failing the entire power on.

    Cc: Marek Vasut
    Cc: Igor Grinberg
    Signed-off-by: Nikita Kiryanov

    Nikita Kiryanov
     

24 Jul, 2013

1 commit


13 Jun, 2013

2 commits

  • This patch adds support to both Faraday FUSBH200 and FOTG210,
    the differences between Faraday EHCI and standard EHCI are
    listed bellow:

    1. The PORTSC starts at 0x30 instead of 0x44.
    2. The CONFIGFLAG(0x40) is not only un-implemented, and
    also has its address space removed.
    3. Faraday EHCI is a TDI design, but it doesn't
    compatible with the general TDI implementation
    found at both U-Boot and Linux.
    4. The ISOC descriptors differ from standard EHCI in
    several ways. But since U-boot doesn't support ISOC,
    we don't have to worry about that.

    Signed-off-by: Kuo-Jung Su
    CC: Marek Vasut

    Kuo-Jung Su
     
  • This patch makes the minimum power-on delay for USB HUB
    become configurable. The original design waits at least
    100 msec here, but some EHCI controlers(e.g. Faraday EHCI)
    are known to require much longer delay interval.

    Signed-off-by: Kuo-Jung Su
    CC: Marek Vasut

    Kuo-Jung Su
     

06 May, 2013

6 commits


17 Dec, 2012

1 commit