Skip to contentSkip to conversation

usb: max3420: add the gadget driver

PATCH Superseded jassisinghbrar at gmail.com 1 participant 1 message Jun 24, 2020 USB

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: max3420: add the gadget driver

From: Jassi Brar <[email protected]>

MAX3420 implements FullSpeed USB Device over SPI. Another version MAX3421, also implements USB Host mode. This driver should be good for the device mode of max3421 as well.

---
 drivers/usb/gadget/Kconfig        |   6 +
 drivers/usb/gadget/Makefile       |   1 +
 drivers/usb/gadget/gadget_chips.h |   8 +
 drivers/usb/gadget/max3420_udc.c  | 877 ++++++++++++++++++++++++++++++
 4 files changed, 892 insertions(+)
 create mode 100644 drivers/usb/gadget/max3420_udc.c
drivers/usb/gadget/Kconfig +6 -0
index 46aa3fe954..7c0df5c264 100644
@@ -105,6 +105,12 @@ config CI_UDC
 	  Say Y here to enable device controller functionality of the
 	  ChipIdea driver.
 
+config USB_GADGET_MAX3420
+	bool "MAX3420 USB Over SPI"
+	depends on DM_SPI
+	help
+	  MAX3420, from MAXIM, implements USB-over-SPI Full-Speed device controller.
+
 config USB_GADGET_VBUS_DRAW
 	int "Maximum VBUS Power usage (2-500 mA)"
 	range 2 500
drivers/usb/gadget/Makefile +1 -0
index 70f3bf43e7..f560068b41 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_USB_GADGET_BCM_UDC_OTG_PHY) += bcm_udc_otg_phy.o
 obj-$(CONFIG_USB_GADGET_DWC2_OTG) += dwc2_udc_otg.o
 obj-$(CONFIG_USB_GADGET_DWC2_OTG_PHY) += dwc2_udc_otg_phy.o
 obj-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
+obj-$(CONFIG_USB_GADGET_MAX3420) += max3420_udc.o
 obj-$(CONFIG_CI_UDC)	+= ci_udc.o
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
drivers/usb/gadget/gadget_chips.h +8 -0
index 91b0285244..587204cfb7 100644
@@ -155,6 +155,12 @@
 #define gadget_is_cdns3(g)        0
 #endif
 
+#ifdef CONFIG_USB_GADGET_MAX3420
+#define gadget_is_max3420(g)        (!strcmp("max3420-udc", (g)->name))
+#else
+#define gadget_is_max3420(g)        0
+#endif
+
 /**
  * usb_gadget_controller_number - support bcdDevice id convention
  * @gadget: the controller being driven
@@ -216,5 +222,7 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
 		return 0x23;
 	else if (gadget_is_cdns3(gadget))
 		return 0x24;
+	else if (gadget_is_max3420(gadget))
+		return 0x25;
 	return -ENOENT;
 }
drivers/usb/gadget/max3420_udc.c new file +877 -0

877 lines not on this page · raw message

Signature · 1 line
2.25.1