Skip to contentSkip to conversation

am33xx: don't assume we have a UCLASS_MISC device present

PATCH In review Jeremy Kerr 2 participants 3 messages May 8 – May 29

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 am33xx: don't assume we have a UCLASS_MISC device present

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")

---
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(-)
arch/arm/mach-omap2/am33xx/board.c +9 -3
index 4e9ad8935e3..0261606089e 100644
@@ -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,

Signature · 1 line
Jeremy Kerr <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Jeremy Kerr

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")
Signature · 1 line
Tom
#2 lore raw
In reply to Jeremy Kerr
Quoted 10 lines · Jeremy Kerr

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).

[...]

Applied to u-boot/next, thanks!

[1/1] am33xx: don't assume we have a UCLASS_MISC device present

      commit: 5151c208b56c6a954c121363ad33557046154b27
Signature · 1 line
Tom