usb: gadget: dwc3: Convert interrupt handling to usb_gadget_generic_ops
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>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # vim3
Link: https://lore.kernel.org/r/20240614005309.34433-5-marek.vasut+renesas@mailbox.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 8db678e..731ede2 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -194,16 +194,6 @@
}
#if CONFIG_IS_ENABLED(DM_USB_GADGET)
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- struct dwc3_generic_priv *priv = dev_get_priv(dev);
- struct dwc3 *dwc3 = &priv->dwc3;
-
- dwc3_gadget_uboot_handle_interrupt(dwc3);
-
- return 0;
-}
-
static int dwc3_generic_peripheral_probe(struct udevice *dev)
{
struct dwc3_generic_priv *priv = dev_get_priv(dev);
@@ -218,10 +208,25 @@
return dwc3_generic_remove(dev, priv);
}
+static int dwc3_gadget_handle_interrupts(struct udevice *dev)
+{
+ struct dwc3_generic_priv *priv = dev_get_priv(dev);
+ struct dwc3 *dwc3 = &priv->dwc3;
+
+ dwc3_gadget_uboot_handle_interrupt(dwc3);
+
+ return 0;
+}
+
+static const struct usb_gadget_generic_ops dwc3_gadget_ops = {
+ .handle_interrupts = dwc3_gadget_handle_interrupts,
+};
+
U_BOOT_DRIVER(dwc3_generic_peripheral) = {
.name = "dwc3-generic-peripheral",
.id = UCLASS_USB_GADGET_GENERIC,
.of_to_plat = dwc3_generic_of_to_plat,
+ .ops = &dwc3_gadget_ops,
.probe = dwc3_generic_peripheral_probe,
.remove = dwc3_generic_peripheral_remove,
.priv_auto = sizeof(struct dwc3_generic_priv),