[PATCH v2 2/2] musb-new: omap2430: fix compiling in DM_USB_GADGET config

Andreas Kemnade andreas at kemnade.info
Mon Jan 9 08:13:31 CET 2023


Add the separate IRQ handling function and change the registration.

Signed-off-by: Andreas Kemnade <andreas at kemnade.info>
---
 drivers/usb/musb-new/omap2430.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c
index 0d1fb03727..42e7abddbc 100644
--- a/drivers/usb/musb-new/omap2430.c
+++ b/drivers/usb/musb-new/omap2430.c
@@ -46,6 +46,15 @@ static inline void omap2430_low_level_init(struct musb *musb)
 	musb_writel(musb->mregs, OTG_FORCESTDBY, l);
 }
 
+#ifdef CONFIG_DM_USB_GADGET
+int dm_usb_gadget_handle_interrupts(struct udevice *dev)
+{
+	struct musb_host_data *host = dev_get_priv(dev);
+
+	host->host->isr(0, host->host);
+	return 0;
+}
+#endif
 
 static int omap2430_musb_init(struct musb *musb)
 {
@@ -235,6 +244,16 @@ static int omap2430_musb_probe(struct udevice *dev)
 			return -EIO;
 
 		return musb_lowlevel_init(host);
+	} else if (CONFIG_IS_ENABLED(DM_USB_GADGET)) {
+		struct musb_host_data *host = dev_get_priv(dev);
+
+		host->host = musb_init_controller(&plat->plat,
+						  (struct device *)otg_board_data,
+						  plat->base);
+		if (!host->host)
+			return -EIO;
+
+		return usb_add_gadget_udc((struct device *)otg_board_data, &host->host->g);
 	}
 
 	musbp = musb_register(&plat->plat, (struct device *)otg_board_data,
-- 
2.30.2



More information about the U-Boot mailing list