[U-Boot] [PATCH] usb: Move determination of TT hub address/port into seperate function

Stefan Bruens
2015-12-19T17:17:24Z

On Friday 18 December 2015 11:00:19 Hans de Goede wrote:
> Hi,
>
> On 18-12-15 02:11, Stefan Br?ns wrote:
> > Start split and complete split tokens need the hub address and the
> > downstream port of the first HS hub (device view).
> >
> > The core of the function was duplicated in both host/ehci_hcd and
> > musb-new/usb-compat.h.
> >
> > Signed-off-by: Stefan Br?ns <stefan.bruens@rwth-aachen.de>
>
> Thanks for working on this, I think I've spotted one small bug though, see
> comments inline.

Ah, sorry for not mentioning this.

Yes, this changes the musb code, but this was on purpose. Rationale:

The ifdef'ed Linux kernel code uses the 1 based port number, whereas U-Boot
puts a 0 based port number into the register. The reason the 0 based port
number apparently works can probably be taken from the USB 2.0 spec:

8.4.2.2 Start-Split Transaction Token
... The host must correctly set the port field for single and multiple TT hub
implementations. A single TT hub implementation *may ignore* the port field.

Actually, as far as I unterstand, a multi TT hub defaults to single TT
(bAlternateSetting: 0) until switched via SetInterface, so even "port 42"
would work.

I have somewhat verified this assumption by hardcoding the port number and
split transactions still work. Used hubs are the RPi onboard SMC9514 and an
external "05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB". The former is a
multi TT hub, the latter single TT only.

I have no board with musb, but I think a 0 based port number is wrong.

> This function is usb-2 controller / hub specific, maybe rename it to:
> "usb_find_usb2_hub_address_port" to reflect this ?

Yes, sounds reasonable.

Kind regards,

Stefan

--
Stefan Br?ns / Bergstra?e 21 / 52062 Aachen
home: +49 241 53809034 mobile: +49 151 50412019
work: +49 2405 49936-424