Re: [RFC PATCH 1/2] usb: ehci: Add option to override ehci_readl()/ehci_writel()

From: Daniel Palmer

Date: Mon Jul 13 2026 - 10:43:09 EST


Hi Alan,

On Mon, 13 Jul 2026 at 23:21, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> > +config HAVE_BROKEN_EHCI_HCD
> > + bool
>
> That is not a good choice of name; it's far too generic. EHCI
> controllers can be broken in so many different ways...
>
> How about USB_EHCI_MMIO_OVERRIDES instead?

Noted. Based on that we'd have a config for each piece that needs to
be overridden so drivers can pick the ones they need?

> Also, the way this is implemented below implicitly assumes that the new
> CONFIG flag will never be set at the same time as
> USB_EHCI_BIG_ENDIAN_MMIO. That should be enforced here. Even though
> IMX28 doesn't do it, someone else might do it in the future.

Sashiko picked this up as well suggesting there are some pre-existing
issues.. I'll work out what to do here.
I think the situation sashiko was complaining about was imx28 running
a big endian kernel so its workaround never gets applied but I think
that might be impossible. :)

> > +
> > endif # USB_EHCI_HCD
> >
> > config USB_OXU210HP_HCD
> > diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
> > index d7a3c8d13f6b..f592cc26e494 100644
> > --- a/drivers/usb/host/ehci.h
> > +++ b/drivers/usb/host/ehci.h
> > @@ -258,6 +258,14 @@ struct ehci_hcd { /* one per controller */
> > /* us budgeted per uframe */
> > struct list_head tt_list;
> >
> > +#ifdef CONFIG_HAVE_BROKEN_EHCI_HCD
> > + /* Overrides to fix up broken implementations */
> > + /* Broken IO */
>
> Similarly, the comment should be improved. "Overrides to fix up broken
> MMIO implementations".

Noted. My intention was to have all of the brokenness inside the
single #ifdef and then have a comment for what each function pointer
allows you to fix up.
If there is a config per workaround I'll put a comment in each saying
what that workaround is for.

Thanks,

Daniel