[PATCH 05/11] usb: gadget: max3420: Convert interrupt handling to usb_gadget_generic_ops

Marek Vasut marek.vasut+renesas at mailbox.org
Fri Jun 14 02:51:20 CEST 2024


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 at mailbox.org>
---
Cc: Alexander Sverdlin <alexander.sverdlin at siemens.com>
Cc: Felipe Balbi <felipe.balbi at linux.intel.com>
Cc: Lukasz Majewski <lukma at denx.de>
Cc: Mattijs Korpershoek <mkorpershoek at baylibre.com>
Cc: Nishanth Menon <nm at ti.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Thinh Nguyen <Thinh.Nguyen at synopsys.com>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at lists.denx.de
---
 drivers/usb/gadget/max3420_udc.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/max3420_udc.c b/drivers/usb/gadget/max3420_udc.c
index 5a227c0ffd9..557a1f0644e 100644
--- a/drivers/usb/gadget/max3420_udc.c
+++ b/drivers/usb/gadget/max3420_udc.c
@@ -808,13 +808,6 @@ static void max3420_setup_spi(struct max3420_udc *udc)
 	spi_wr8(udc, MAX3420_REG_PINCTL, bFDUPSPI);
 }
 
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
-	struct max3420_udc *udc = dev_get_priv(dev);
-
-	return max3420_irq(udc);
-}
-
 static int max3420_udc_probe(struct udevice *dev)
 {
 	struct max3420_udc *udc = dev_get_priv(dev);
@@ -859,6 +852,17 @@ static int max3420_udc_remove(struct udevice *dev)
 	return 0;
 }
 
+static int max3420_gadget_handle_interrupts(struct udevice *dev)
+{
+	struct max3420_udc *udc = dev_get_priv(dev);
+
+	return max3420_irq(udc);
+}
+
+static const struct usb_gadget_generic_ops max3420_gadget_ops = {
+	.handle_interrupts	= max3420_gadget_handle_interrupts,
+};
+
 static const struct udevice_id max3420_ids[] = {
 	{ .compatible = "maxim,max3421-udc" },
 	{ }
@@ -868,6 +872,7 @@ U_BOOT_DRIVER(max3420_generic_udc) = {
 	.name = "max3420-udc",
 	.id = UCLASS_USB_GADGET_GENERIC,
 	.of_match = max3420_ids,
+	.ops = &max3420_gadget_ops,
 	.probe = max3420_udc_probe,
 	.remove = max3420_udc_remove,
 	.priv_auto	= sizeof(struct max3420_udc),
-- 
2.43.0



More information about the U-Boot mailing list