[PATCH 06/11] usb: gadget: mtu3: Convert interrupt handling to usb_gadget_generic_ops

Marek Vasut marek.vasut+renesas at mailbox.org
Fri Jun 14 02:51:21 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/mtu3/mtu3_plat.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index ca86b58dfcd..f8e14eabfb2 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -223,15 +223,6 @@ static const struct udevice_id ssusb_of_match[] = {
 };
 
 #if CONFIG_IS_ENABLED(DM_USB_GADGET)
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
-	struct mtu3 *mtu = dev_get_priv(dev);
-
-	mtu3_irq(0, mtu);
-
-	return 0;
-}
-
 static int mtu3_gadget_probe(struct udevice *dev)
 {
 	struct ssusb_mtk *ssusb = dev_to_ssusb(dev->parent);
@@ -250,10 +241,24 @@ static int mtu3_gadget_remove(struct udevice *dev)
 	return 0;
 }
 
+static int mtu3_gadget_handle_interrupts(struct udevice *dev)
+{
+	struct mtu3 *mtu = dev_get_priv(dev);
+
+	mtu3_irq(0, mtu);
+
+	return 0;
+}
+
+static const struct usb_gadget_generic_ops mtu3_gadget_ops = {
+	.handle_interrupts	= mtu3_gadget_handle_interrupts,
+};
+
 U_BOOT_DRIVER(mtu3_peripheral) = {
 	.name = "mtu3-peripheral",
 	.id = UCLASS_USB_GADGET_GENERIC,
 	.of_match = ssusb_of_match,
+	.ops = &mtu3_gadget_ops,
 	.probe = mtu3_gadget_probe,
 	.remove = mtu3_gadget_remove,
 	.priv_auto	= sizeof(struct mtu3),
-- 
2.43.0



More information about the U-Boot mailing list