linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V5 0/6] Add Embedded USB Debugger (EUD) driver
@ 2022-02-03 10:34 Souradeep Chowdhury
  2022-02-03 10:34 ` [PATCH V5 1/6] dt-bindings: Add the yaml bindings for EUD Souradeep Chowdhury
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Souradeep Chowdhury @ 2022-02-03 10:34 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, pure.logic,
	bjorn.andersson, greg, robh
  Cc: linux-kernel, quic_tsoni, quic_psodagud, quic_satyap,
	quic_pheragu, quic_rjendra, quic_sibis, quic_saipraka,
	quic_schowdhu

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 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: common: 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/common/Kconfig                         |  10 +
 drivers/usb/common/Makefile                        |   1 +
 drivers/usb/common/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/common/qcom_eud.c

-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH V5 1/6] dt-bindings: Add the yaml bindings for EUD
  2022-02-03 10:34 [PATCH V5 0/6] Add Embedded USB Debugger (EUD) driver Souradeep Chowdhury
@ 2022-02-03 10:34 ` Souradeep Chowdhury
  2022-02-04 22:49   ` Rob Herring
  2022-02-03 10:34 ` [PATCH V5 2/6] bindings: usb: dwc3: Update dwc3 properties for EUD connector Souradeep Chowdhury
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Souradeep Chowdhury @ 2022-02-03 10:34 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, pure.logic,
	bjorn.andersson, greg, robh
  Cc: linux-kernel, quic_tsoni, quic_psodagud, quic_satyap,
	quic_pheragu, quic_rjendra, quic_sibis, quic_saipraka,
	quic_schowdhu

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

Signed-off-by: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 .../devicetree/bindings/soc/qcom/qcom,eud.yaml     | 77 ++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml
new file mode 100644
index 0000000..c98aab2
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml
@@ -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 <quic_schowdhu@quicinc.com>
+
+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>;
+                           };
+                   };
+           };
+    };
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V5 2/6] bindings: usb: dwc3: Update dwc3 properties for EUD connector
  2022-02-03 10:34 [PATCH V5 0/6] Add Embedded USB Debugger (EUD) driver Souradeep Chowdhury
  2022-02-03 10:34 ` [PATCH V5 1/6] dt-bindings: Add the yaml bindings for EUD Souradeep Chowdhury
@ 2022-02-03 10:34 ` Souradeep Chowdhury
  2022-02-04 22:50   ` Rob Herring
  2022-02-03 10:34 ` [PATCH V5 3/6] usb: common: eud: Add driver support for Embedded USB Debugger(EUD) Souradeep Chowdhury
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Souradeep Chowdhury @ 2022-02-03 10:34 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, pure.logic,
	bjorn.andersson, greg, robh
  Cc: linux-kernel, quic_tsoni, quic_psodagud, quic_satyap,
	quic_pheragu, quic_rjendra, quic_sibis, quic_saipraka,
	quic_schowdhu

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.

Signed-off-by: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
---
 Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
index d29ffcd..2d831db1 100644
--- a/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/snps,dwc3.yaml
@@ -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:
--
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V5 3/6] usb: common: eud: Add driver support for Embedded USB Debugger(EUD)
  2022-02-03 10:34 [PATCH V5 0/6] Add Embedded USB Debugger (EUD) driver Souradeep Chowdhury
  2022-02-03 10:34 ` [PATCH V5 1/6] dt-bindings: Add the yaml bindings for EUD Souradeep Chowdhury
  2022-02-03 10:34 ` [PATCH V5 2/6] bindings: usb: dwc3: Update dwc3 properties for EUD connector Souradeep Chowdhury
@ 2022-02-03 10:34 ` Souradeep Chowdhury
  2022-02-03 11:14   ` Greg KH
  2022-02-03 10:34 ` [PATCH V5 4/6] arm64: dts: qcom: sc7280: Add EUD dt node and dwc3 connector Souradeep Chowdhury
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Souradeep Chowdhury @ 2022-02-03 10:34 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, pure.logic,
	bjorn.andersson, greg, robh
  Cc: linux-kernel, quic_tsoni, quic_psodagud, quic_satyap,
	quic_pheragu, quic_rjendra, quic_sibis, quic_saipraka,
	quic_schowdhu

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

Signed-off-by: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
---
 Documentation/ABI/testing/sysfs-driver-eud |   9 ++
 drivers/usb/common/Kconfig                 |  10 ++
 drivers/usb/common/Makefile                |   1 +
 drivers/usb/common/qcom_eud.c              | 251 +++++++++++++++++++++++++++++
 4 files changed, 271 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-eud
 create mode 100644 drivers/usb/common/qcom_eud.c

diff --git a/Documentation/ABI/testing/sysfs-driver-eud b/Documentation/ABI/testing/sysfs-driver-eud
new file mode 100644
index 0000000..83f3872
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-eud
@@ -0,0 +1,9 @@
+What:		/sys/bus/platform/drivers/eud/.../enable
+Date:           February 2022
+Contact:        Souradeep Chowdhury <quic_schowdhu@quicinc.com>
+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.
diff --git a/drivers/usb/common/Kconfig b/drivers/usb/common/Kconfig
index b856622..e4f8b48 100644
--- a/drivers/usb/common/Kconfig
+++ b/drivers/usb/common/Kconfig
@@ -14,6 +14,16 @@ config USB_LED_TRIG
 	  LEDs and you want to use them as activity indicators for USB host or
 	  gadget.

+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 USB_ULPI_BUS
 	tristate "USB ULPI PHY interface support"
 	select USB_COMMON
diff --git a/drivers/usb/common/Makefile b/drivers/usb/common/Makefile
index 8ac4d21..597e48e 100644
--- a/drivers/usb/common/Makefile
+++ b/drivers/usb/common/Makefile
@@ -10,4 +10,5 @@ usb-common-$(CONFIG_USB_LED_TRIG) += led.o

 obj-$(CONFIG_USB_CONN_GPIO)	+= usb-conn-gpio.o
 obj-$(CONFIG_USB_OTG_FSM) += usb-otg-fsm.o
+obj-$(CONFIG_USB_QCOM_EUD) += qcom_eud.o
 obj-$(CONFIG_USB_ULPI_BUS)	+= ulpi.o
diff --git a/drivers/usb/common/qcom_eud.c b/drivers/usb/common/qcom_eud.c
new file mode 100644
index 0000000..84a9884
--- /dev/null
+++ b/drivers/usb/common/qcom_eud.c
@@ -0,0 +1,251 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/sysfs.h>
+#include <linux/usb/role.h>
+
+#define EUD_REG_INT1_EN_MASK	0x0024
+#define EUD_REG_INT_STATUS_1	0x0044
+#define EUD_REG_CTL_OUT_1	0x0074
+#define EUD_REG_VBUS_INT_CLR	0x0080
+#define EUD_REG_CSR_EUD_EN	0x1014
+#define EUD_REG_SW_ATTACH_DET	0x1018
+#define EUD_REG_EUD_EN2        0x0000
+
+#define EUD_ENABLE		BIT(0)
+#define EUD_INT_PET_EUD	BIT(0)
+#define EUD_INT_VBUS		BIT(2)
+#define EUD_INT_SAFE_MODE	BIT(4)
+#define EUD_INT_ALL		(EUD_INT_VBUS|EUD_INT_SAFE_MODE)
+
+struct eud_chip {
+	struct device			*dev;
+	struct usb_role_switch		*role_sw;
+	void __iomem			*base;
+	void __iomem			*mode_mgr;
+	unsigned int			int_status;
+	int				irq;
+	bool				enabled;
+	bool				usb_attached;
+};
+
+static int enable_eud(struct eud_chip *priv)
+{
+	writel(EUD_ENABLE, priv->base + EUD_REG_CSR_EUD_EN);
+	writel(EUD_INT_VBUS | EUD_INT_SAFE_MODE,
+			priv->base + EUD_REG_INT1_EN_MASK);
+	writel(1, priv->mode_mgr + EUD_REG_EUD_EN2);
+
+	return usb_role_switch_set_role(priv->role_sw, USB_ROLE_DEVICE);
+}
+
+static void disable_eud(struct eud_chip *priv)
+{
+	writel(0, priv->base + EUD_REG_CSR_EUD_EN);
+	writel(0, priv->mode_mgr + EUD_REG_EUD_EN2);
+}
+
+static ssize_t enable_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct eud_chip *chip = dev_get_drvdata(dev);
+
+	return sysfs_emit(buf, "%d\n", chip->enabled);
+}
+
+static ssize_t enable_store(struct device *dev,
+		struct device_attribute *attr,
+		const char *buf, size_t count)
+{
+	struct eud_chip *chip = dev_get_drvdata(dev);
+	bool enable;
+	int ret;
+
+	if (kstrtobool(buf, &enable))
+		return -EINVAL;
+
+	if (enable) {
+		ret = enable_eud(chip);
+		if (!ret)
+			chip->enabled = enable;
+		else
+			disable_eud(chip);
+	} else {
+		disable_eud(chip);
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR_RW(enable);
+
+static struct attribute *eud_attrs[] = {
+	&dev_attr_enable.attr,
+	NULL,
+};
+ATTRIBUTE_GROUPS(eud);
+
+static void usb_attach_detach(struct eud_chip *chip)
+{
+	u32 reg;
+
+	/* read ctl_out_1[4] to find USB attach or detach event */
+	reg = readl(chip->base + EUD_REG_CTL_OUT_1);
+	chip->usb_attached = reg & EUD_INT_SAFE_MODE;
+}
+
+static void pet_eud(struct eud_chip *chip)
+{
+	u32 reg;
+	int ret;
+
+	/* When the EUD_INT_PET_EUD in SW_ATTACH_DET is set, the cable has been
+	 * disconnected and we need to detach the pet to check if EUD is in safe
+	 * mode before attaching again.
+	 */
+	reg = readl(chip->base + EUD_REG_SW_ATTACH_DET);
+	if (reg & EUD_INT_PET_EUD) {
+		/* Detach & Attach pet for EUD */
+		writel(0, chip->base + EUD_REG_SW_ATTACH_DET);
+		/* Delay to make sure detach pet is done before attach pet */
+		ret = readl_poll_timeout(chip->base + EUD_REG_SW_ATTACH_DET,
+					reg, (reg == 0), 1, 100);
+		if (ret) {
+			dev_err(chip->dev, "Detach pet failed\n");
+			return;
+		}
+	}
+	/* Attach pet for EUD */
+	writel(EUD_INT_PET_EUD, chip->base +EUD_REG_SW_ATTACH_DET);
+}
+
+static irqreturn_t handle_eud_irq(int irq, void *data)
+{
+	struct eud_chip *chip = data;
+	u32 reg;
+
+	reg = readl(chip->base + EUD_REG_INT_STATUS_1);
+	switch (reg & EUD_INT_ALL) {
+	case EUD_INT_VBUS:
+		usb_attach_detach(chip);
+		return IRQ_WAKE_THREAD;
+	case EUD_INT_SAFE_MODE:
+		pet_eud(chip);
+		return IRQ_HANDLED;
+	default:
+		return IRQ_NONE;
+	}
+}
+
+static irqreturn_t handle_eud_irq_thread(int irq, void *data)
+{
+	struct eud_chip *chip = data;
+	int ret;
+
+	if (chip->usb_attached)
+		ret = usb_role_switch_set_role(chip->role_sw, USB_ROLE_DEVICE);
+	else
+		ret = usb_role_switch_set_role(chip->role_sw, USB_ROLE_HOST);
+	if (ret)
+		dev_err(chip->dev, "failed to set role switch\n");
+
+	/* set and clear vbus_int_clr[0] to clear interrupt */
+	writel(BIT(0), chip->base + EUD_REG_VBUS_INT_CLR);
+	writel(0, chip->base + EUD_REG_VBUS_INT_CLR);
+
+	return IRQ_HANDLED;
+}
+
+static void eud_role_switch_release(void *data)
+{
+	struct eud_chip *chip = data;
+
+	usb_role_switch_put(chip->role_sw);
+}
+
+static int eud_probe(struct platform_device *pdev)
+{
+	struct eud_chip *chip;
+	int ret;
+
+	chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
+	if (!chip)
+		return -ENOMEM;
+
+	chip->dev = &pdev->dev;
+
+	ret = devm_add_action_or_reset(chip->dev, eud_role_switch_release, chip);
+	if (ret)
+		return dev_err_probe(chip->dev, ret,
+				"failed to add role switch release action\n");
+
+	chip->role_sw = usb_role_switch_get(&pdev->dev);
+	if (IS_ERR(chip->role_sw))
+		return dev_err_probe(chip->dev, PTR_ERR(chip->role_sw),
+					"failed to get role switch\n");
+
+	chip->base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(chip->base))
+		return PTR_ERR(chip->base);
+
+	chip->mode_mgr = devm_platform_ioremap_resource(pdev, 1);
+	if (IS_ERR(chip->mode_mgr))
+		return PTR_ERR(chip->mode_mgr);
+
+	chip->irq = platform_get_irq(pdev, 0);
+	ret = devm_request_threaded_irq(&pdev->dev, chip->irq, handle_eud_irq,
+			handle_eud_irq_thread, IRQF_ONESHOT, NULL, chip);
+	if (ret)
+		return dev_err_probe(chip->dev, ret, "failed to allocate irq\n");
+
+	enable_irq_wake(chip->irq);
+
+	platform_set_drvdata(pdev, chip);
+
+	return 0;
+}
+
+static int eud_remove(struct platform_device *pdev)
+{
+	struct eud_chip *chip = platform_get_drvdata(pdev);
+
+	if (chip->enabled)
+		disable_eud(chip);
+
+	device_init_wakeup(&pdev->dev, false);
+	disable_irq_wake(chip->irq);
+
+	return 0;
+}
+
+static const struct of_device_id eud_dt_match[] = {
+	{ .compatible = "qcom,sc7280-eud" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, eud_dt_match);
+
+static struct platform_driver eud_driver = {
+	.probe	= eud_probe,
+	.remove	= eud_remove,
+	.driver	= {
+		.name = "qcom_eud",
+		.dev_groups = eud_groups,
+		.of_match_table = eud_dt_match,
+	},
+};
+module_platform_driver(eud_driver);
+
+MODULE_DESCRIPTION("QTI EUD driver");
+MODULE_LICENSE("GPL v2");
--
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V5 4/6] arm64: dts: qcom: sc7280: Add EUD dt node and dwc3 connector
  2022-02-03 10:34 [PATCH V5 0/6] Add Embedded USB Debugger (EUD) driver Souradeep Chowdhury
                   ` (2 preceding siblings ...)
  2022-02-03 10:34 ` [PATCH V5 3/6] usb: common: eud: Add driver support for Embedded USB Debugger(EUD) Souradeep Chowdhury
@ 2022-02-03 10:34 ` Souradeep Chowdhury
  2022-02-03 10:34 ` [PATCH V5 5/6] arm64: dts: qcom: sc7280: Set the default dr_mode for usb2 Souradeep Chowdhury
  2022-02-03 10:34 ` [PATCH V5 6/6] MAINTAINERS: Add maintainer entry for EUD Souradeep Chowdhury
  5 siblings, 0 replies; 11+ messages in thread
From: Souradeep Chowdhury @ 2022-02-03 10:34 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, pure.logic,
	bjorn.andersson, greg, robh
  Cc: linux-kernel, quic_tsoni, quic_psodagud, quic_satyap,
	quic_pheragu, quic_rjendra, quic_sibis, quic_saipraka,
	quic_schowdhu

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.

Signed-off-by: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
---
 arch/arm64/boot/dts/qcom/sc7280.dtsi | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi
index 937c2e0..96917fe 100644
--- a/arch/arm64/boot/dts/qcom/sc7280.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi
@@ -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";
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V5 5/6] arm64: dts: qcom: sc7280: Set the default dr_mode for usb2
  2022-02-03 10:34 [PATCH V5 0/6] Add Embedded USB Debugger (EUD) driver Souradeep Chowdhury
                   ` (3 preceding siblings ...)
  2022-02-03 10:34 ` [PATCH V5 4/6] arm64: dts: qcom: sc7280: Add EUD dt node and dwc3 connector Souradeep Chowdhury
@ 2022-02-03 10:34 ` Souradeep Chowdhury
  2022-02-03 10:34 ` [PATCH V5 6/6] MAINTAINERS: Add maintainer entry for EUD Souradeep Chowdhury
  5 siblings, 0 replies; 11+ messages in thread
From: Souradeep Chowdhury @ 2022-02-03 10:34 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, pure.logic,
	bjorn.andersson, greg, robh
  Cc: linux-kernel, quic_tsoni, quic_psodagud, quic_satyap,
	quic_pheragu, quic_rjendra, quic_sibis, quic_saipraka,
	quic_schowdhu

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

Signed-off-by: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 arch/arm64/boot/dts/qcom/sc7280-idp.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp.dts b/arch/arm64/boot/dts/qcom/sc7280-idp.dts
index 9b991ba..f40eaa5 100644
--- a/arch/arm64/boot/dts/qcom/sc7280-idp.dts
+++ b/arch/arm64/boot/dts/qcom/sc7280-idp.dts
@@ -61,6 +61,10 @@
 	modem-init;
 };
 
+&usb_2_dwc3 {
+	dr_mode = "otg";
+};
+
 &pmk8350_rtc {
 	status = "okay";
 };
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V5 6/6] MAINTAINERS: Add maintainer entry for EUD
  2022-02-03 10:34 [PATCH V5 0/6] Add Embedded USB Debugger (EUD) driver Souradeep Chowdhury
                   ` (4 preceding siblings ...)
  2022-02-03 10:34 ` [PATCH V5 5/6] arm64: dts: qcom: sc7280: Set the default dr_mode for usb2 Souradeep Chowdhury
@ 2022-02-03 10:34 ` Souradeep Chowdhury
  5 siblings, 0 replies; 11+ messages in thread
From: Souradeep Chowdhury @ 2022-02-03 10:34 UTC (permalink / raw)
  To: linux-arm-msm, linux-usb, devicetree, pure.logic,
	bjorn.andersson, greg, robh
  Cc: linux-kernel, quic_tsoni, quic_psodagud, quic_satyap,
	quic_pheragu, quic_rjendra, quic_sibis, quic_saipraka,
	quic_schowdhu

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

Signed-off-by: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b84e2d5..f86ec0e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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 <quic_schowdhu@quicinc.com>
+L:	linux-arm-msm@vger.kernel.org
+S:	Maintained
+F:	Documentation/ABI/testing/sysfs-driver-eud
+F:	Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml
+F:	drivers/usb/common/qcom_eud.c
+
 EXEC & BINFMT API
 R:	Eric Biederman <ebiederm@xmission.com>
 R:	Kees Cook <keescook@chromium.org>
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH V5 3/6] usb: common: eud: Add driver support for Embedded USB Debugger(EUD)
  2022-02-03 10:34 ` [PATCH V5 3/6] usb: common: eud: Add driver support for Embedded USB Debugger(EUD) Souradeep Chowdhury
@ 2022-02-03 11:14   ` Greg KH
  2022-02-04  7:03     ` Souradeep Chowdhury
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2022-02-03 11:14 UTC (permalink / raw)
  To: Souradeep Chowdhury
  Cc: linux-arm-msm, linux-usb, devicetree, pure.logic,
	bjorn.andersson, robh, linux-kernel, quic_tsoni, quic_psodagud,
	quic_satyap, quic_pheragu, quic_rjendra, quic_sibis,
	quic_saipraka

On Thu, Feb 03, 2022 at 04:04:32PM +0530, Souradeep Chowdhury wrote:
> 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
> 
> Signed-off-by: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
> ---
>  Documentation/ABI/testing/sysfs-driver-eud |   9 ++
>  drivers/usb/common/Kconfig                 |  10 ++
>  drivers/usb/common/Makefile                |   1 +
>  drivers/usb/common/qcom_eud.c              | 251 +++++++++++++++++++++++++++++

This really should be drivers/usb/misc/ right?  No other code uses
anything from this driver which is what "common" is for.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH V5 3/6] usb: common: eud: Add driver support for Embedded USB Debugger(EUD)
  2022-02-03 11:14   ` Greg KH
@ 2022-02-04  7:03     ` Souradeep Chowdhury
  0 siblings, 0 replies; 11+ messages in thread
From: Souradeep Chowdhury @ 2022-02-04  7:03 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-arm-msm, linux-usb, devicetree, pure.logic,
	bjorn.andersson, robh, linux-kernel, quic_tsoni, quic_psodagud,
	quic_satyap, quic_pheragu, quic_rjendra, quic_sibis,
	quic_saipraka


On 2/3/2022 4:44 PM, Greg KH wrote:
> On Thu, Feb 03, 2022 at 04:04:32PM +0530, Souradeep Chowdhury wrote:
>> 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
>>
>> Signed-off-by: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
>> ---
>>   Documentation/ABI/testing/sysfs-driver-eud |   9 ++
>>   drivers/usb/common/Kconfig                 |  10 ++
>>   drivers/usb/common/Makefile                |   1 +
>>   drivers/usb/common/qcom_eud.c              | 251 +++++++++++++++++++++++++++++
> This really should be drivers/usb/misc/ right?  No other code uses
> anything from this driver which is what "common" is for.
Ack
>
> thanks,
>
> greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH V5 1/6] dt-bindings: Add the yaml bindings for EUD
  2022-02-03 10:34 ` [PATCH V5 1/6] dt-bindings: Add the yaml bindings for EUD Souradeep Chowdhury
@ 2022-02-04 22:49   ` Rob Herring
  0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2022-02-04 22:49 UTC (permalink / raw)
  To: Souradeep Chowdhury
  Cc: quic_sibis, quic_satyap, pure.logic, quic_saipraka, greg,
	quic_psodagud, linux-usb, linux-arm-msm, bjorn.andersson,
	linux-kernel, quic_tsoni, quic_rjendra, devicetree, quic_pheragu

On Thu, 03 Feb 2022 16:04:30 +0530, Souradeep Chowdhury wrote:
> Documentation for Embedded USB Debugger(EUD) device tree
> bindings in yaml format.
> 
> Signed-off-by: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>  .../devicetree/bindings/soc/qcom/qcom,eud.yaml     | 77 ++++++++++++++++++++++
>  1 file changed, 77 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH V5 2/6] bindings: usb: dwc3: Update dwc3 properties for EUD connector
  2022-02-03 10:34 ` [PATCH V5 2/6] bindings: usb: dwc3: Update dwc3 properties for EUD connector Souradeep Chowdhury
@ 2022-02-04 22:50   ` Rob Herring
  0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2022-02-04 22:50 UTC (permalink / raw)
  To: Souradeep Chowdhury
  Cc: quic_pheragu, quic_sibis, quic_saipraka, quic_tsoni, quic_satyap,
	linux-usb, bjorn.andersson, linux-kernel, linux-arm-msm, greg,
	quic_psodagud, quic_rjendra, devicetree, pure.logic

On Thu, 03 Feb 2022 16:04:31 +0530, Souradeep Chowdhury wrote:
> 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.
> 
> Signed-off-by: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
> ---
>  Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 6 ++++++
>  1 file changed, 6 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-02-04 22:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 10:34 [PATCH V5 0/6] Add Embedded USB Debugger (EUD) driver Souradeep Chowdhury
2022-02-03 10:34 ` [PATCH V5 1/6] dt-bindings: Add the yaml bindings for EUD Souradeep Chowdhury
2022-02-04 22:49   ` Rob Herring
2022-02-03 10:34 ` [PATCH V5 2/6] bindings: usb: dwc3: Update dwc3 properties for EUD connector Souradeep Chowdhury
2022-02-04 22:50   ` Rob Herring
2022-02-03 10:34 ` [PATCH V5 3/6] usb: common: eud: Add driver support for Embedded USB Debugger(EUD) Souradeep Chowdhury
2022-02-03 11:14   ` Greg KH
2022-02-04  7:03     ` Souradeep Chowdhury
2022-02-03 10:34 ` [PATCH V5 4/6] arm64: dts: qcom: sc7280: Add EUD dt node and dwc3 connector Souradeep Chowdhury
2022-02-03 10:34 ` [PATCH V5 5/6] arm64: dts: qcom: sc7280: Set the default dr_mode for usb2 Souradeep Chowdhury
2022-02-03 10:34 ` [PATCH V5 6/6] MAINTAINERS: Add maintainer entry for EUD Souradeep Chowdhury

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).