Skip to contentSkip to conversation

Add Embedded USB Debugger (EUD) driver

PATCH In review Souradeep Chowdhury 2 participants 8 messages Feb 8, 2022 – Feb 11, 2022

Subsystems (6)
lore
Share & tools
lore

Souradeep Chowdhury

author maintainer
#0 lore raw

v6 cover Add Embedded USB Debugger (EUD) driver

This is a series of patches that implements a driver for the control peripheral, EUD (Embedded USB Debugger). The EUD is a mini-USB hub implemented on chip to support the USB-based debug and trace capabilities. Apart from debug capabilities, EUD has a control peripheral. Control Peripheral is on when EUD is on and gets signals like USB attach, pet EUD etc. EUD driver listens to events like USB attach or detach and then informs the USB about these events via ROLE-SWITCH. At regular intervals, the EUD driver receives an interrupt to pet the driver indicating that the software is functional.

Changes in V6

* Added the review tags from V5 and moved qcom_eud.c to drivers/usb/misc.

Changes in V5

* Added the review tags and implemented comments on V4 of the patch.

Changes in V4

* Aligned the device tree node structure of EUD as per discussion.

* Changes to usb-connector.yaml is no longer required and is not included in the patch series.

* Implemented the rest of the comments on Version 3 of the patch.

Changes in V3

* Removed the patch for registration of EUD connector as it is no longer required.

* Added the description to include EUD in usb-connector.yaml

* Implemented comments on V2 of the patch.

Changes in V2

* Fixed the yaml issue and also implemented comments on yaml in V1.

Changes in V1

* EUD has now been mapped as a separate DT node as it is an independent QCOM IP.

* EUD is attached to the connector child of dwc3 via port end point since EUD driver needs the connector for role-switching.

* EUD driver has been moved now to drivers/soc/qcom/qcom_eud.c.

* All the comments from version 0 of the patch has been implemented.

Souradeep Chowdhury (6):
dt-bindings: Add the yaml bindings for EUD
bindings: usb: dwc3: Update dwc3 properties for EUD connector
usb: misc: eud: Add driver support for Embedded USB Debugger(EUD)
arm64: dts: qcom: sc7280: Add EUD dt node and dwc3 connector
arm64: dts: qcom: sc7280: Set the default dr_mode for usb2
MAINTAINERS: Add maintainer entry for EUD

 Documentation/ABI/testing/sysfs-driver-eud         |   9 +
 .../devicetree/bindings/soc/qcom/qcom,eud.yaml     |  77 +++++++
 .../devicetree/bindings/usb/snps,dwc3.yaml         |   6 +
 MAINTAINERS                                        |   8 +
 arch/arm64/boot/dts/qcom/sc7280-idp.dts            |   4 +
 arch/arm64/boot/dts/qcom/sc7280.dtsi               |  36 +++
 drivers/usb/misc/Kconfig                           |  10 +
 drivers/usb/misc/Makefile                          |   1 +
 drivers/usb/misc/qcom_eud.c                        | 251 +++++++++++++++++++++
 9 files changed, 402 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-eud
 create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml
 create mode 100644 drivers/usb/misc/qcom_eud.c
Signature · 1 line
2.7.4
author maintainer
#3 lore raw

PATCH v6 3/6 usb: misc: eud: Add driver support for Embedded USB Debugger(EUD)

Add support for control peripheral of EUD (Embedded USB Debugger) to listen to events such as USB attach/detach, pet EUD to indicate software is functional.Reusing the platform device kobj, sysfs entry 'enable' is created to enable or disable EUD.

To enable the eud the following needs to be done
echo 1 > /sys/bus/platform/.../enable

To disable eud, following is the command
echo 0 > /sys/bus/platform/.../enable

---
 Documentation/ABI/testing/sysfs-driver-eud |   9 ++
 drivers/usb/misc/Kconfig                   |  10 ++
 drivers/usb/misc/Makefile                  |   1 +
 drivers/usb/misc/qcom_eud.c                | 251 +++++++++++++++++++++++++++++
 4 files changed, 271 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-eud
 create mode 100644 drivers/usb/misc/qcom_eud.c
Documentation/ABI/testing/sysfs-driver-eud new file +9 -0
new file mode 100644
index 0000000..83f3872
@@ -0,0 +1,9 @@
+What:		/sys/bus/platform/drivers/eud/.../enable
+Date:           February 2022
+Contact:        Souradeep Chowdhury <[email protected]>
+Description:
+		The Enable/Disable sysfs interface for Embedded
+		USB Debugger(EUD). This enables and disables the
+		EUD based on a 1 or a 0 value. By enabling EUD,
+		the user is able to activate the mini-usb hub of
+		EUD for debug and trace capabilities.
drivers/usb/misc/Kconfig +10 -0
index 8f11443..c9407b8 100644
@@ -137,6 +137,16 @@ config USB_APPLEDISPLAY
 	  Say Y here if you want to control the backlight of Apple Cinema
 	  Displays over USB. This driver provides a sysfs interface.
 
+config USB_QCOM_EUD
+	tristate "QCOM Embedded USB Debugger(EUD) Driver"
+	select USB_ROLE_SWITCH
+	help
+	  This module enables support for Qualcomm Technologies, Inc.
+	  Embedded USB Debugger (EUD). The EUD is a control peripheral
+	  which reports VBUS attach/detach events and has USB-based
+	  debug and trace capabilities. On selecting m, the module name
+	  that is built is qcom_eud.ko
+
 config APPLE_MFI_FASTCHARGE
 	tristate "Fast charge control for iOS devices"
 	select POWER_SUPPLY
drivers/usb/misc/Makefile +1 -0
index 5f4e598..35bdb4b 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_USB_ISIGHTFW)		+= isight_firmware.o
 obj-$(CONFIG_USB_LCD)			+= usblcd.o
 obj-$(CONFIG_USB_LD)			+= ldusb.o
 obj-$(CONFIG_USB_LEGOTOWER)		+= legousbtower.o
+obj-$(CONFIG_USB_QCOM_EUD)		+= qcom_eud.o
 obj-$(CONFIG_USB_TEST)			+= usbtest.o
 obj-$(CONFIG_USB_EHSET_TEST_FIXTURE)    += ehset.o
 obj-$(CONFIG_USB_TRANCEVIBRATOR)	+= trancevibrator.o
drivers/usb/misc/qcom_eud.c new file +251 -0

251 lines not on this page · raw message

--
2.7.4

author maintainer
#6 lore raw

PATCH v6 6/6 MAINTAINERS: Add maintainer entry for EUD

In reply to Souradeep Chowdhury

Add the entry for maintainer for EUD driver
and other associated files.

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index b84e2d5..f86ec0e 100644
@@ -7227,6 +7227,14 @@ F:	include/uapi/linux/mdio.h
 F:	include/uapi/linux/mii.h
 F:	net/core/of_net.c
 
+QCOM EMBEDDED USB DEBUGGER(EUD)
+M:	Souradeep Chowdhury <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/ABI/testing/sysfs-driver-eud
+F:	Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml
+F:	drivers/usb/misc/qcom_eud.c
+
 EXEC & BINFMT API
 R:	Eric Biederman <[email protected]>
 R:	Kees Cook <[email protected]>

--
2.7.4

author maintainer
#2 lore raw

PATCH v6 2/6 bindings: usb: dwc3: Update dwc3 properties for EUD connector

In reply to Souradeep Chowdhury

Add the ports property for dwc3 node. This port can be used by the Embedded USB Debugger for role switching the controller from device to host mode and vice versa.

---
 Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +6 -0
index d29ffcd..2d831db1 100644
@@ -332,6 +332,12 @@ properties:
     items:
       enum: [1, 4, 8, 16, 32, 64, 128, 256]
 
+  port:
+    $ref: /schemas/graph.yaml#/properties/port
+    description:
+      This port is used with the 'usb-role-switch' property  to connect the
+      dwc3 to type C connector.
+
 unevaluatedProperties: false
 
 required:
Signature · 1 line
2.7.4
author maintainer
#4 lore raw

PATCH v6 4/6 arm64: dts: qcom: sc7280: Add EUD dt node and dwc3 connector

In reply to Souradeep Chowdhury

Add the Embedded USB Debugger(EUD) device tree node. The node contains EUD base register region and EUD mode manager register regions along with the interrupt entry. Also add the typec connector node for EUD which is attached to EUD node via port. EUD is also attached to DWC3 node via port. Also add the role-switch property to dwc3 node.

---
 arch/arm64/boot/dts/qcom/sc7280.dtsi | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
arch/arm64/boot/dts/qcom/sc7280.dtsi +36 -0
index 937c2e0..96917fe 100644
@@ -2583,6 +2583,12 @@
 				phys = <&usb_2_hsphy>;
 				phy-names = "usb2-phy";
 				maximum-speed = "high-speed";
+				usb-role-switch;
+				port {
+					usb2_role_switch: endpoint {
+						remote-endpoint = <&eud_ep>;
+					};
+				};
 			};
 		};
 
@@ -2624,6 +2630,36 @@
 			interrupts = <GIC_SPI 582 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		eud: eud@88e0000 {
+			compatible = "qcom,sc7280-eud","qcom,eud";
+			reg = <0 0x88e0000 0 0x2000>,
+			      <0 0x88e2000 0 0x1000>;
+			interrupts-extended = <&pdc 11 IRQ_TYPE_LEVEL_HIGH>;
+			ports {
+				port@0 {
+					eud_ep: endpoint {
+						remote-endpoint = <&usb2_role_switch>;
+					};
+				};
+				port@1 {
+					eud_con: endpoint {
+						remote-endpoint = <&con_eud>;
+					};
+				};
+			};
+		};
+
+		eud_typec: connector {
+			compatible = "usb-c-connector";
+			ports {
+				port@0 {
+					con_eud: endpoint {
+						remote-endpoint = <&eud_con>;
+					};
+				};
+			};
+		};
+
 		nsp_noc: interconnect@a0c0000 {
 			reg = <0 0x0a0c0000 0 0x10000>;
 			compatible = "qcom,sc7280-nsp-noc";
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH v6 1/6 dt-bindings: Add the yaml bindings for EUD

In reply to Souradeep Chowdhury

Documentation for Embedded USB Debugger(EUD) device tree bindings in yaml format.

---
 .../devicetree/bindings/soc/qcom/qcom,eud.yaml     | 77 ++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml
Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml new file +77 -0
new file mode 100644
index 0000000..c98aab2
@@ -0,0 +1,77 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/soc/qcom/qcom,eud.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Qualcomm Embedded USB Debugger
+
+maintainers:
+  - Souradeep Chowdhury <[email protected]>
+
+description:
+  This binding is used to describe the Qualcomm Embedded USB Debugger, which is
+  mini USB-hub implemented on chip to support USB-based debug capabilities.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - qcom,sc7280-eud
+      - const: qcom,eud
+
+  reg:
+    items:
+      - description: EUD Base Register Region
+      - description: EUD Mode Manager Register
+
+  interrupts:
+    description: EUD interrupt
+    maxItems: 1
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+    description:
+      These ports is to be attached to the endpoint of the DWC3 controller node
+      and type C connector node. The controller has the "usb-role-switch"
+      property.
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: This port is to be attached to the DWC3 controller.
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: This port is to be attached to the type C connector.
+
+required:
+  - compatible
+  - reg
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+    eud@88e0000 {
+           compatible = "qcom,sc7280-eud","qcom,eud";
+           reg = <0x88e0000 0x2000>,
+                 <0x88e2000 0x1000>;
+           ports {
+                   #address-cells = <1>;
+                   #size-cells = <0>;
+                   port@0 {
+                           reg = <0>;
+                           eud_ep: endpoint {
+                                   remote-endpoint = <&usb2_role_switch>;
+                           };
+                   };
+                   port@1 {
+                           reg = <1>;
+                           eud_con: endpoint {
+                                   remote-endpoint = <&con_eud>;
+                           };
+                   };
+           };
+    };
Signature · 1 line
2.7.4
author maintainer
#5 lore raw

PATCH v6 5/6 arm64: dts: qcom: sc7280: Set the default dr_mode for usb2

In reply to Souradeep Chowdhury

Set the default dr_mode for usb2 node to "otg" to enable role-switch for EUD(Embedded USB Debugger) connector node.

---
 arch/arm64/boot/dts/qcom/sc7280-idp.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/sc7280-idp.dts +4 -0
index 9b991ba..f40eaa5 100644
@@ -61,6 +61,10 @@
 	modem-init;
 };
 
+&usb_2_dwc3 {
+	dr_mode = "otg";
+};
+
 &pmk8350_rtc {
 	status = "okay";
 };
Signature · 1 line
2.7.4
#7 lore raw

Re: [PATCH V6 6/6] MAINTAINERS: Add maintainer entry for EUD

In reply to Souradeep Chowdhury
Quoted 14 lines · Souradeep Chowdhury

Add the entry for maintainer for EUD driver
and other associated files.

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +0 -0
index b84e2d5..f86ec0e 100644

MAINTAINERS F: include/uapi/linux/mdio.h · line 7236

Quoted 10 lines
MAINTAINERS +7 -0
@@ -7227,6 +7227,14 @@ F:	include/uapi/linux/mdio.h
 F:	include/uapi/linux/mii.h
 F:	net/core/of_net.c
 
+QCOM EMBEDDED USB DEBUGGER(EUD)
+M:	Souradeep Chowdhury <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/ABI/testing/sysfs-driver-eud
+F:	Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml
+F:	drivers/usb/misc/qcom_eud.c

This needs to be in sorted order :(