On Wed, Dec 03, 2025 at 04:51:20PM +0530, Balaji Selvanathan wrote:
> 
> On 11/26/2025 7:54 PM, Casey Connolly wrote:
> > Hi Balaji,
> > 
> > On 24/11/2025 16:55, Balaji Selvanathan wrote:
> > > Add CONFIG_QCOM_USB_FIXUP option to allow platforms to disable
> > > the USB speed limitation fixup when they have proper super-speed
> > > USB support in U-Boot.
> > In general, we prefer to handle cases like this at runtime rather than
> > compile time. Could you rework this to check for the "qcom,sc7280-dwc3"
> > compatible and just skip the check in that case? I would also propose
> > adding a log_warning() in the fixup case so that folks working on other
> > platforms know to add their compatible too.
> > 
> > Obviously that's still not an ideal solution, maybe it would be possible
> > to implement the Super Smart (tm) fix and actually check if a driver
> > /will/ bind to the ss-phy node before the fixup, it depends how slow
> > that would be.
> This is good idea. Actually, I have implemented the super smart fix rather
> than hardcoding
> 
> "qcom,sc7280-dwc3" in code. The respined code is here: 
> https://lore.kernel.org/u-boot/[email protected]/;
> The code checks if the SS PHY driver is indeed available and if it exists, 
> then it skips doing
> USB HS fixup.
> The entire time to check if the SS PHY driver is available is ~125ms. Request 
> to say if this is reasonable.

I don't think it's reasonable to add more than 125ms in boot for every
platform considering slower platforms as compared to RB3G2 where it will
be much worse.

Lets just rather add a static check for "qcom,sc7280-dwc3" to skip the
USB fixup.

-Sumit

> The power domain fixup is taking ~98us (mentioning just for comparison).
> Thanks,
> Balaji
> 
> > 
> > Kind regards,
> > 
> > > Currently, U-Boot limits USB to high-speed mode on all Qualcomm
> > > platforms by fixing up the device tree at runtime. This was
> > > necessary because most platforms lacked super-speed PHY drivers.
> > > 
> > > However, newer platforms now have proper QMP PHY drivers that support
> > > super-speed USB. For these platforms, the fixup is counterproductive
> > > as it prevents the hardware from operating at its full capability.
> > > 
> > > This change:
> > > - Adds CONFIG_QCOM_USB_FIXUP (default y) to maintain backward
> > >    compatibility with existing platforms
> > > - Wraps the fixup code with #ifdef to allow selective disabling
> > > - Allows platforms with super-speed support to disable the fixup
> > >    via their defconfig
> > > 
> > > Platforms without super-speed PHY drivers will continue to work
> > > as before with the fixup enabled by default.
> > > 
> > > Signed-off-by: Balaji Selvanathan <[email protected]>
> > > ---
> > >   arch/arm/mach-snapdragon/Kconfig    | 10 ++++++++++
> > >   arch/arm/mach-snapdragon/of_fixup.c |  4 ++++
> > >   2 files changed, 14 insertions(+)
> > > 
> > > diff --git a/arch/arm/mach-snapdragon/Kconfig 
> > > b/arch/arm/mach-snapdragon/Kconfig
> > > index 976c0e35fce..6c53aeef597 100644
> > > --- a/arch/arm/mach-snapdragon/Kconfig
> > > +++ b/arch/arm/mach-snapdragon/Kconfig
> > > @@ -29,6 +29,16 @@ config SYS_MALLOC_LEN
> > >   config LNX_KRNL_IMG_TEXT_OFFSET_BASE
> > >           default 0x80000000
> > > +config QCOM_USB_FIXUP
> > > + bool "Enable USB speed fixup for Qualcomm platforms"
> > > + default y
> > > + help
> > > +   Enable runtime fixup of USB device tree nodes to limit USB to
> > > +   high-speed mode. This is needed on some Qualcomm platforms where
> > > +   U-Boot doesn't support super-speed USB.
> > > +   Disable this for platforms that have proper super-speed USB support
> > > +   in U-Boot.
> > > +
> > >   config SYS_BOARD
> > >           string "Snapdragon SoCs based board"
> > >           help
> > > diff --git a/arch/arm/mach-snapdragon/of_fixup.c 
> > > b/arch/arm/mach-snapdragon/of_fixup.c
> > > index eec2c0c757e..6a64168f67e 100644
> > > --- a/arch/arm/mach-snapdragon/of_fixup.c
> > > +++ b/arch/arm/mach-snapdragon/of_fixup.c
> > > @@ -27,6 +27,7 @@
> > >   #include <stdlib.h>
> > >   #include <time.h>
> > > +#ifdef CONFIG_QCOM_USB_FIXUP
> > >   /* U-Boot only supports USB high-speed mode on Qualcomm platforms with 
> > > DWC3
> > >    * USB controllers. Rather than requiring source level DT changes, we 
> > > fix up
> > >    * DT here. This improves compatibility with upstream DT and simplifies 
> > > the
> > > @@ -115,6 +116,7 @@ static void fixup_usb_nodes(struct device_node *root)
> > >                           log_warning("Failed to fixup node %s: %d\n", 
> > > glue_np->name, ret);
> > >           }
> > >   }
> > > +#endif
> > >   /* Remove all references to the rpmhpd device */
> > >   static void fixup_power_domains(struct device_node *root)
> > > @@ -157,7 +159,9 @@ static int qcom_of_fixup_nodes(void * __maybe_unused 
> > > ctx, struct event *event)
> > >   {
> > >           struct device_node *root = event->data.of_live_built.root;
> > > +#ifdef CONFIG_QCOM_USB_FIXUP
> > >           time_call(fixup_usb_nodes, root);
> > > +#endif
> > >           time_call(fixup_power_domains, root);
> > >           return 0;

Reply via email to