> -----邮件原件----- > 发件人: Marek Vasut <[email protected]> > 发送时间: 2025年12月16日 19:16 > 收件人: Alice Guo (OSS) <[email protected]>; dl-uboot-imx > <[email protected]>; [email protected] > 抄送: Stefano Babic <[email protected]>; Fabio Estevam > <[email protected]>; Tom Rini <[email protected]>; Marek Vasut > <[email protected]>; Marek Vasut <[email protected]>; Ye Li > <[email protected]>; [email protected]; Peng Fan <[email protected]>; > Mattijs Korpershoek <[email protected]>; Lukasz Majewski > <[email protected]>; Sherry Sun <[email protected]>; Kever Yang > <[email protected]>; Jonas Karlman <[email protected]>; Quentin > Schulz <[email protected]>; George Chan <[email protected]>; > Simon Glass <[email protected]>; David Zang <[email protected]>; Alice > Guo <[email protected]> > 主题: Re: [PATCH v1 2/7] usb: ehci-mx6: Fix usb_oc_config() for > i.MX7/8M/9/7ULP/8 and 8ULP platforms > > On 12/16/25 7:38 AM, [email protected] wrote: > > From: Alice Guo <[email protected]> > > > > The usb_oc_config() function previously assumed that the overcurrent > > control register index always matches the USB controller index, which > > is true for i.MX6 but not for i.MX7/8M/9/7ULP/8/8ULP. On these > > platforms, the overcurrent control is located in the USB OTG Control 1 > > register, which is always at index 0. > > > > Signed-off-by: Alice Guo <[email protected]> > > --- > > drivers/usb/host/ehci-mx6.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c > > index cfaf49d67f0..03ff4ce10d5 100644 > > --- a/drivers/usb/host/ehci-mx6.c > > +++ b/drivers/usb/host/ehci-mx6.c > > @@ -280,7 +280,12 @@ static void ehci_mx6_powerup_fixup(struct ehci_ctrl > *ctrl, uint32_t *status_reg, > > /* Should be done in the MXS PHY driver */ > > static void usb_oc_config(struct usbnc_regs *usbnc, int index) > > { > > +#if defined(CONFIG_MX6) > > void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl[index]); > > +#elif defined(CONFIG_USB_EHCI_MX7) || defined(CONFIG_MX7ULP) || > defined(CONFIG_IMX8) || \ > > + defined(CONFIG_IMX8ULP) > > + void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl[0]); #endif > Can we simply pass 0 to this function as index for non-MX6 instead of this > ifdeffery ?
Even if I move the condition from inside the usb_oc_config() to the call site, I still cannot avoid conditional compilation because the logic is platform-specific. Given this, is it acceptable to keep the current change as it is? Best Regards, Alice Guo

