[U-Boot] [PATCH v4 4/9] dm: usb: Fix finding of first upstream usb-2 hub in the ehci dm code

Simon Glass sjg at chromium.org
Tue May 5 19:42:09 CEST 2015


On 5 May 2015 at 03:54, Hans de Goede <hdegoede at redhat.com> wrote:
> The ehci driver model code for finding the first upstream usb-2 hub before
> this commit has a number of issues:
>
> 1) "if (!ttdev->speed != USB_SPEED_HIGH)" does not work because the '!'
>    takes presedence over the '!=' this should simply be
>    "if (ttdev->speed == USB_SPEED_HIGH)"
> 2) It makes ttdev point to the first upstream usb-2 hub, but ttdev should
>    point to the last usb-1 device before the first usb-2 hub (when going
>    upstream from the device), as ttdev is used to find the port of the
>    first usb-2 hub to which the the last usb-1 device is connected.
> 3) parent_devnum however should be set to the devnum of the first usb-2
>    hub, so we need to keep pointers around to both usb_device structs.
>
> To complicate things further during enumeration usb_device.dev will point
> to the parent udevice, where as during normal use it will point to
> the actual udevice, we must handle both cases correctly.
>
> This commit fixes all this making usb-1 devices attached to usb-2 hubs,
> including usb-1 devices attached to usb-1 hubs attached to usb-2 hubs, work.
>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> Acked-by: Simon Glass <sjg at chromium.org>
> ---
> Changes in v2:
> -Rewrote the fix to use driver-model logic to find the first upstream usb-2
>  hub rather then using the deprecated usb_device->parent pointer

Applied to u-boot-dm, thanks!


More information about the U-Boot mailing list