Re: [PATCH v2 1/5] usb: ehci: support non-standard port status registers
From: Alan Stern
Date: Wed Sep 02 2026 - 11:42:05 EST
On Wed, Sep 02, 2026 at 08:11:32AM +0200, Linus Walleij wrote:
> Some EHCI implementations place the port status registers outside the
> standard operational register layout.
>
> Add a per-controller port status base and use a helper for all PORTSC
> accesses, while preserving the standard location by default.
>
> Suggested-by: Daniel Palmer <daniel@xxxxxxxxx>
> Assisted-by: LLM
> Signed-off-by: Linus Walleij <linusw@xxxxxxxxxx>
For this and the other two patches...
> diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
> index d7a3c8d13f6b..765338c2eb88 100644
> --- a/drivers/usb/host/ehci.h
> +++ b/drivers/usb/host/ehci.h
> @@ -278,6 +279,17 @@ static inline struct usb_hcd *ehci_to_hcd(struct ehci_hcd *ehci)
>
> /*-------------------------------------------------------------------------*/
>
> +static inline u32 __iomem *ehci_portsc(struct ehci_hcd *ehci,
> + unsigned int port)
> +{
> + if (ehci->port_status)
> + return ehci->port_status + port;
> +
> + return &ehci->regs->port_status[port];
> +}
Can you introduce a new Kconfig symbol (or symbols), which the FOTG
config entry would select, and then generate the "if" statement only
when the new symbol is set? For example:
#ifdef CONFIG_EHCI_NONSTANDARD_PORT_STATUS
if (ehci->port_status)
return ehci->port_status + port;
#endif
A similar approach could be used in accessors for the other items you're
changing.
This way other architectures won't pay the price of doing the
unnecessary test all the time.
Alan Stern