diff mbox series

[07/11] usb: gadget: omap2430: Convert interrupt handling to usb_gadget_generic_ops

Message ID 20240614005309.34433-8-marek.vasut+renesas@mailbox.org
State Accepted
Commit 521bc756cb5fea0ca8c159bd812da063e08bd351
Delegated to: Mattijs Korpershoek
Headers show
Series usb: gadget: Introduce handle_interrupts ops to USB_GADGET_GENERIC uclass | expand

Commit Message

Marek Vasut June 14, 2024, 12:51 a.m. UTC
Implement .handle_interrupts callback as a replacement for deprecated
dm_usb_gadget_handle_interrupts() function. The new callback allows
for each DM capable USB gadget controller driver to define its own
IRQ handling implementation without colliding with other controller
drivers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
---
 drivers/usb/musb-new/omap2430.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c
index c8dd73050b2..96771c28cef 100644
--- a/drivers/usb/musb-new/omap2430.c
+++ b/drivers/usb/musb-new/omap2430.c
@@ -46,16 +46,6 @@  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)
 {
 	u32 l;
@@ -273,6 +263,21 @@  static int omap2430_musb_remove(struct udevice *dev)
 	return 0;
 }
 
+#ifndef CONFIG_USB_MUSB_HOST
+static int omap2340_gadget_handle_interrupts(struct udevice *dev)
+{
+	struct musb_host_data *host = dev_get_priv(dev);
+
+	host->host->isr(0, host->host);
+
+	return 0;
+}
+
+static const struct usb_gadget_generic_ops omap2340_gadget_ops = {
+	.handle_interrupts	= omap2340_gadget_handle_interrupts,
+};
+#endif
+
 static const struct udevice_id omap2430_musb_ids[] = {
 	{ .compatible = "ti,omap3-musb" },
 	{ .compatible = "ti,omap4-musb" },
@@ -285,6 +290,7 @@  U_BOOT_DRIVER(omap2430_musb) = {
 	.id		= UCLASS_USB,
 #else
 	.id		= UCLASS_USB_GADGET_GENERIC,
+	.ops		= &omap2340_gadget_ops,
 #endif
 	.of_match = omap2430_musb_ids,
 	.of_to_plat = omap2430_musb_of_to_plat,