[PATCH] usb: musb: musb_dsps: Wait for controller reset
From: Ettore Chimenti
Date: Wed Oct 14 2026 - 13:53:47 EST
From: Andrew Goodbody <andrew.goodbody@xxxxxxxxxx>
After soft resetting the USB controller wait for it to complete and then
set the mode of the controller. This ensures that the controller is in a
sane state. The timeout value used is just large as the board is likely
broken if it is ever reached so no need to optimise. It was tested with
a timeout of 500us which worked so gave it a 10x safety margin and used
5000us as the timeout value.
Fixes: 9ecb887522a0 ("usb: musb: Add support for ti81xx platform")
Signed-off-by: Andrew Goodbody <andrew.goodbody@xxxxxxxxxx>
Signed-off-by: Ettore Chimenti <ettore.chimenti@xxxxxxxxxx>
---
drivers/usb/musb/musb_dsps.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index e3935f18dd56..d909c45c253d 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -15,6 +15,7 @@
*/
#include <linux/io.h>
+#include <linux/iopoll.h>
#include <linux/irq.h>
#include <linux/err.h>
#include <linux/platform_device.h>
@@ -35,6 +36,7 @@
#include "musb_core.h"
static const struct of_device_id musb_dsps_of_match[];
+static int dsps_musb_set_mode(struct musb *musb, u8 mode);
/*
* DSPS musb wrapper register offset.
@@ -466,7 +468,13 @@ static int dsps_musb_init(struct musb *musb)
timer_setup(&musb->dev_timer, otg_timer, 0);
/* Reset the musb */
- musb_writel(reg_base, wrp->control, (1 << wrp->reset));
+ musb_writel(reg_base, wrp->control, BIT(wrp->reset));
+ read_poll_timeout(musb_readl, val, !(val & BIT(wrp->reset)), 2, 5000,
+ false, reg_base, wrp->control);
+ if (val & BIT(wrp->reset))
+ return -ENODEV;
+
+ dsps_musb_set_mode(musb, musb->port_mode);
musb->isr = dsps_interrupt;
---
base-commit: 0fcb05b72344f40806cbe810de8872f1698bf053
change-id: 20261014-patch-ektor5-dm8168-usb-d6ca2a5189f6
Best regards,
--
Ettore Chimenti <ettore.chimenti@xxxxxxxxxx>