Skip to contentSkip to conversation

Max3420 udc driver

PATCH New [email protected] 1 participant 3 messages Jan 22, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover Max3420 udc driver

From: Jassi Brar <[email protected]>

Changes since v2:
# Remove inconsistent licence term from the driver

Changes since v1:
# No functional changes, just cosmetic changes as suggested in review.
o prepend everything with MAX3420_
o avoid CaMeLcAsE
o use GENMASK some more
o reorder struct max3420_ep and struct max3420_udc members
o added some comments
o changed license in dt-bindings
o changed interrupt property to names

Jassi Brar (2):
dt-bindings: max3421-udc: add dt bindings for MAX3420 UDC
usb: gadget: add udc driver for max3420

 .../bindings/usb/maxim,max3420-udc.yaml       |   69 +
 drivers/usb/gadget/udc/Kconfig                |   10 +
 drivers/usb/gadget/udc/Makefile               |    1 +
 drivers/usb/gadget/udc/max3420_udc.c          | 1331 +++++++++++++++++
 4 files changed, 1411 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/maxim,max3420-udc.yaml
 create mode 100644 drivers/usb/gadget/udc/max3420_udc.c
Signature · 1 line
2.20.1
#1 lore raw

PATCH v3 1/2 dt-bindings: max3421-udc: add dt bindings for MAX3420 UDC

From: Jassi Brar <[email protected]>

Add YAML dt bindings for Maxim MAX3420 UDC controller.

---
 .../bindings/usb/maxim,max3420-udc.yaml       | 69 +++++++++++++++++++
 1 file changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/maxim,max3420-udc.yaml
Documentation/devicetree/bindings/usb/maxim,max3420-udc.yaml new file +69 -0
new file mode 100644
index 000000000000..4241d38d5864
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/maxim,max3420-udc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MAXIM MAX3420/1 USB Peripheral Controller
+
+maintainers:
+  - Jassi Brar <[email protected]>
+
+description: |
+  The controller provices USB2.0 compliant FullSpeed peripheral
+  implementation over the SPI interface.
+
+  Specifications about the part can be found at:
+    http://datasheets.maximintegrated.com/en/ds/MAX3420E.pdf
+
+properties:
+  compatible:
+    enum:
+      - maxim,max3420-udc
+      - maxim,max3421-udc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    items:
+      - description: usb irq from max3420
+      - description: vbus detection irq
+    minItems: 1
+    maxItems: 2
+
+  interrupt-names:
+    items:
+      - const: udc
+      - const: vbus
+    minItems: 1
+    maxItems: 2
+
+  spi-max-frequency:
+    maximum: 26000000
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+
+additionalProperties: false
+
+examples:
+  - |
+      #include <dt-bindings/gpio/gpio.h>
+      #include <dt-bindings/interrupt-controller/irq.h>
+      spi0 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            udc@0 {
+                  compatible = "maxim,max3420-udc";
+                  reg = <0>;
+                  interrupt-parent = <&gpio>;
+                  interrupts = <0 IRQ_TYPE_EDGE_FALLING>, <10 IRQ_TYPE_EDGE_BOTH>;
+                  interrupt-names = "udc", "vbus";
+                  spi-max-frequency = <12500000>;
+            };
+      };
Signature · 1 line
2.20.1
#2 lore raw

PATCH v3 2/2 usb: gadget: add udc driver for max3420

In reply to [email protected]

From: Jassi Brar <[email protected]>

The MAX3420 is USB2.0 only, UDC-over-SPI controller. This driver also supports the peripheral mode of MAX3421.

---
 drivers/usb/gadget/udc/Kconfig       |   10 +
 drivers/usb/gadget/udc/Makefile      |    1 +
 drivers/usb/gadget/udc/max3420_udc.c | 1331 ++++++++++++++++++++++++++
 3 files changed, 1342 insertions(+)
 create mode 100644 drivers/usb/gadget/udc/max3420_udc.c
drivers/usb/gadget/udc/Kconfig +10 -0
index 797d6ace8994..1ff82285ac7a 100644
@@ -441,6 +441,16 @@ config USB_GADGET_XILINX
 	  dynamically linked module called "udc-xilinx" and force all
 	  gadget drivers to also be dynamically linked.
 
+config USB_MAX3420_UDC
+	tristate "MAX3420 (USB-over-SPI) support"
+	depends on SPI
+	help
+	  The Maxim MAX3420 chip supports USB2.0 full-speed peripheral mode.
+	  The MAX3420 is run by SPI interface, and hence the dependency.
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called max3420_udc
+
 config USB_TEGRA_XUDC
 	tristate "NVIDIA Tegra Superspeed USB 3.0 Device Controller"
 	depends on ARCH_TEGRA || COMPILE_TEST
drivers/usb/gadget/udc/Makefile +1 -0
index f6777e654a8e..f5a7ce28aecd 100644
@@ -42,3 +42,4 @@ obj-$(CONFIG_USB_GADGET_XILINX)	+= udc-xilinx.o
 obj-$(CONFIG_USB_SNP_UDC_PLAT) += snps_udc_plat.o
 obj-$(CONFIG_USB_ASPEED_VHUB)	+= aspeed-vhub/
 obj-$(CONFIG_USB_BDC_UDC)	+= bdc/
+obj-$(CONFIG_USB_MAX3420_UDC)	+= max3420_udc.o
drivers/usb/gadget/udc/max3420_udc.c new file +1331 -0

1,331 lines not on this page · raw message

Signature · 1 line
2.20.1