[U-Boot] [PATCH 8/8] config: smdk5420: Enable support for multiple XHCI controllers

Marek Vasut marex at denx.de
Tue Jan 7 10:14:31 CET 2014


On Tuesday, January 07, 2014 at 09:55:37 AM, Vivek Gautam wrote:
> HI Marek,
> 
> 
> On Mon, Jan 6, 2014 at 9:24 PM, Marek Vasut <marex at denx.de> wrote:
> 
> Thanks for reviewing this. :-)
> 
> > On Monday, January 06, 2014 at 10:29:43 AM, Vivek Gautam wrote:
> >> Update USB_MAX_CONTROLLER_COUNT to be '2' to enable support
> >> for both usb 3.0 controllers on exynos5420.
> >> 
> >> NOTE: To use EHCI on exynos5420, this change will need to be
> >> reverted, since there's only one EHCI controller available on
> >> exynos5420.
> > 
> > OK, this I seriously dislike. Hence a question ... my feeling is the XHCI
> > and EHCI code for handling multiple controllers and multiple ports is
> > almost the same. Can this code be adjusted to handle both EHCI and XHCI
> > controllers indiscriminately ?
> 
> The controller count is actually used by the usb core (common/usb*)
> framework, right ?
> There's a need to add support for multiple controller types actually
> (so that EHCI
> and XHCI can be enabled simultaneously). Is that what you mean here ?

Yes. That should not be too much of a problem though.

> > This would result in having CONFIG_USB_MAX_CONTROLLER_COUNT 3 on this
> > board and being able to use both EHCI and XHCI . Would this be possible
> > for you to implement please ? Thanks !
> 
> Ok, so you mean get all the controllers present on the board (EHCI and
> XHCI) setup.

Yes

> I think right now, the way USB core handles the controller count is
> quite different, so
> that 'CONFIG_USB_MAX_CONTROLLER_COUNT' helps in probing multiple
> controllers of the same type.

The only problem is, that both EHCI and XHCI core implement:

submit_control_msg()
submit_bulk_msg()
submit_int_msg()
usb_lowlevel_init()
usb_lowlevel_stop()

How I'd do this:
1) Rename all these submit_*() functions to usb_submit_*()
2) Rename all five usb_*() functions to ehci_*() resp. xhci_*()
3) Implement translation layer, where the common code would still call usb_*()
   and the layer would determine whether to call ehci_*() or xhci_*() call.

Surely, you'd need to change the probe() logic a bit, the controller drivers 
would have to call some "usb_register_driver()" function for each controller. 
This function would generate a new entry in a linked list of all controllers 
registered and would add a flag whether this controller is EHCI or XHCI.

Effectively, this would even remove the need for CONFIG_USB_MAX_CONTROLLER_COUNT 
at all, since you'd be tracking all the USB controllers in the USB core code and 
in a linked list.

> I had plans to add support to use controllers of different types (EHCI
> and XHCI etc) simultaneously.
> But haven't really put a code for that yet.
> Can you suggest some pointers about how would you like to see EHCI and
> XHCI or even OHCI work
> together :-)
> I can take up this.

Thank you, see above please. OHCI might be nastier, but should happen along 
these lines above as well.

Best regards,
Marek Vasut


More information about the U-Boot mailing list