The dm_usb_gadget_handle_interrupts() has no place in board code. Move
this into DWC3 driver. The OMAP implementation is special, add new weak
dwc3_uboot_interrupt_status() function to decide whether DWC3 interrupt
handling should be called, and override it in OMAP DWC3 code, to repair
the special OMAP interrupt handling code until OMAP gets switched over
to DM UDC proper.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # vim3
Tested-by: Caleb Connolly <caleb.connolly@linaro.org> # qcom sdm845
Link: https://lore.kernel.org/r/20240317044357.547037-1-marek.vasut+renesas@mailbox.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
return rv;
}
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- dwc3_uboot_handle_interrupt(dev);
- return 0;
-}
-
static void dwc3_nxp_usb_phy_init(struct dwc3_device *dwc3)
{
u32 RegData;
.index = 0,
};
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- dwc3_uboot_handle_interrupt(dev);
- return 0;
-}
-
int board_usb_init(int index, enum usb_init_type init)
{
struct exynos_usb3_phy *phy = (struct exynos_usb3_phy *)
.index = 0,
};
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- dwc3_uboot_handle_interrupt(dev);
- return 0;
-}
-
int board_usb_init(int index, enum usb_init_type init)
{
int node;
.usb2_phy_power = (void *)USB2_PHY2_POWER,
.index = 1,
};
-
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
- u32 status;
-
- status = dwc3_omap_uboot_interrupt_status(dev);
- if (status)
- dwc3_uboot_handle_interrupt(dev);
-
- return 0;
-}
#endif /* CONFIG_USB_DWC3 */
#if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
}
}
+MODULE_ALIAS("platform:dwc3");
+MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver");
+
/**
* dwc3_uboot_handle_interrupt - handle dwc3 core interrupt
* @dev: device of this controller
}
}
-MODULE_ALIAS("platform:dwc3");
-MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver");
+#if !CONFIG_IS_ENABLED(DM_USB_GADGET)
+__weak int dwc3_uboot_interrupt_status(struct udevice *dev)
+{
+ return 1;
+}
+
+int dm_usb_gadget_handle_interrupts(struct udevice *dev)
+{
+ if (!dwc3_uboot_interrupt_status(dev))
+ return 0;
+
+ dwc3_uboot_handle_interrupt(dev);
+
+ return 0;
+}
+#endif
#if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB)
int dwc3_setup_phy(struct udevice *dev, struct phy_bulk *phys)
}
/**
- * dwc3_omap_uboot_interrupt_status - check the status of interrupt
+ * dwc3_uboot_interrupt_status - check the status of interrupt
* @dev: device of this controller
*
* Checks the status of interrupts and returns true if an interrupt
*
* Generally called from board file.
*/
-int dwc3_omap_uboot_interrupt_status(struct udevice *dev)
+int dwc3_uboot_interrupt_status(struct udevice *dev)
{
struct dwc3_omap *omap = NULL;
int dwc3_omap_uboot_init(struct dwc3_omap_device *dev);
void dwc3_omap_uboot_exit(int index);
-int dwc3_omap_uboot_interrupt_status(struct udevice *dev);
#endif /* __DWC3_OMAP_UBOOT_H_ */
int dwc3_uboot_init(struct dwc3_device *dev);
void dwc3_uboot_exit(int index);
+int dwc3_uboot_interrupt_status(struct udevice *dev);
void dwc3_uboot_handle_interrupt(struct udevice *dev);
struct phy;