Skip to contentSkip to conversation

Max3420 udc driver

PATCH Superseded [email protected] 3 participants 6 messages Jan 5, 2020 – Jan 8, 2020

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Max3420 udc driver

From: Jassi Brar <[email protected]>

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          | 1333 +++++++++++++++++
 4 files changed, 1413 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 v2 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
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: max3421-udc: add dt bindings for MAX3420 UDC

Quoted 10 lines · On Sun, 5 Jan 2020 16:55:47 -0600, [email protected] wrote:

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
#3 lore raw

PATCH v2 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 | 1333 ++++++++++++++++++++++++++
 3 files changed, 1344 insertions(+)
 create mode 100644 drivers/usb/gadget/udc/max3420_udc.c
drivers/usb/gadget/udc/Kconfig +10 -0
index ae70ce29d5e4..3a7179e90f4e 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 +1333 -0

1,333 lines not on this page · raw message

Signature · 1 line
2.20.1
maintainer
#4 lore raw

Re: [PATCH v2 2/2] usb: gadget: add udc driver for max3420

Quoted 8 lines · On Sun, Jan 05, 2020 at 04:55:57PM -0600, [email protected] wrote:
drivers/usb/gadget/udc/max3420_udc.c new file +5 -0
@@ -0,0 +1,1333 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * MAX3420 Device Controller driver for USB.
+ *
+ * Author: Jaswinder Singh Brar <[email protected]>

drivers/usb/gadget/udc/max3420_udc.c line 15

Quoted 10 lines
drivers/usb/gadget/udc/max3420_udc.c new file +10 -0
+ * (C) Copyright 2019 Linaro Ltd
+ *
+ * Based on:
+ *	o MAX3420E datasheet
+ *		http://datasheets.maximintegrated.com/en/ds/MAX3420E.pdf
+ *	o MAX342{0,1}E Programming Guides
+ *		https://pdfserv.maximintegrated.com/en/an/AN3598.pdf
+ *		https://pdfserv.maximintegrated.com/en/an/AN3785.pdf
+ *
+ * This file is licenced under the GPL v2.

This line says that the SPDX line above is a lie :(

Please fix this.

As pennance, please re-read Documentation/process/license-rules.rst.

thanks,

greg k-h

author
#5 lore raw

Re: [PATCH v2 2/2] usb: gadget: add udc driver for max3420

Quoted 23 lines · Greg KH
Quoted 8 lines · On Sun, Jan 05, 2020 at 04:55:57PM -0600, [email protected] wrote:
drivers/usb/gadget/udc/max3420_udc.c new file +5 -0
@@ -0,0 +1,1333 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * MAX3420 Device Controller driver for USB.
+ *
+ * Author: Jaswinder Singh Brar <[email protected]>

drivers/usb/gadget/udc/max3420_udc.c line 15

Quoted 10 lines
drivers/usb/gadget/udc/max3420_udc.c new file +10 -0
+ * (C) Copyright 2019 Linaro Ltd
+ *
+ * Based on:
+ *   o MAX3420E datasheet
+ *           http://datasheets.maximintegrated.com/en/ds/MAX3420E.pdf
+ *   o MAX342{0,1}E Programming Guides
+ *           https://pdfserv.maximintegrated.com/en/an/AN3598.pdf
+ *           https://pdfserv.maximintegrated.com/en/an/AN3785.pdf
+ *
+ * This file is licenced under the GPL v2.

This line says that the SPDX line above is a lie :(

Quoted 2 lines

Please fix this.

Sorry, that is a relic from forward porting the driver. I updated the copyright year (guess need to again) but missed that line.

Quoted 2 lines

As pennance, please re-read Documentation/process/license-rules.rst.

I will take a dozen lines each day before bed.

Cheers still !