Boot on am33xx without CONFIG_USB will currently fail, as we error-out
of arch_misc_init() if no UCLASS_MISC device is found. This requirement
was introduced in commit 3aec2648698d ("am33xx: board: probe misc
drivers to register musb devices").

Instead, only attempt the UCLASS_MISC init if we would expect the MUSB
TI device to be present. Add a comment to explain why we're doing the
device lookup (which we immediately discard).

Fixes: 3aec2648698d ("am33xx: board: probe misc drivers to register musb 
devices")
Signed-off-by: Jeremy Kerr <[email protected]>
---
I'm not sure whether the CONFIG_ conditional is appropriate here, or
whether there's a better way to handle the UCLASS_MISC probe for the
MUSB init; we could potentially just ignore errors from the probe, but I
assume that's intentional as-is.

The new comment is mostly from the original commit; I am definitely open
to any better wording if needed.
---
 arch/arm/mach-omap2/am33xx/board.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/am33xx/board.c 
b/arch/arm/mach-omap2/am33xx/board.c
index 4e9ad8935e3..0261606089e 100644
--- a/arch/arm/mach-omap2/am33xx/board.c
+++ b/arch/arm/mach-omap2/am33xx/board.c
@@ -266,9 +266,15 @@ int arch_misc_init(void)
        struct udevice *dev;
        int ret;
 
-       ret = uclass_first_device_err(UCLASS_MISC, &dev);
-       if (ret)
-               return ret;
+       /*
+        * The MUSB wrapper driver is bound as a MISC device, so probe here
+        * to register the musb device early.
+        */
+       if (IS_ENABLED(CONFIG_USB_MUSB_TI)) {
+               ret = uclass_first_device_err(UCLASS_MISC, &dev);
+               if (ret)
+                       return ret;
+       }
 
 #if defined(CONFIG_DM_ETH) && defined(CONFIG_USB_ETHER)
        usb_ether_init();

---
base-commit: 3cdd19089f1b1b7cd08530f33ff4708abcfd426c
change-id: 20260508-dev-am33xx-6e5f040da058

Best regards,
--  
Jeremy Kerr <[email protected]>

Reply via email to