All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC 00/11] add support for R-Car USB3.0 role switch
@ 2018-04-18  8:09 Yoshihiro Shimoda
  2018-04-18  8:09   ` [PATCH/RFC,01/11] " Yoshihiro Shimoda
                   ` (10 more replies)
  0 siblings, 11 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:09 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch set is based on v4.17-rc1.

In last week, I submitted a patch as v1 [1]. But, the v1 patch
doesn't use graphs to get usb host device pointer. So, I modified
some frameworks for it.
Since the patch 4 "of: platform: add device connection parsing"
has TODOs, I marked this patch set as "RFC". Before I resolve them,
I would like to know whether this way is good or not.

[1] https://patchwork.kernel.org/patch/10332865/


Yoshihiro Shimoda (11):
  Documentation: of: Add device-connection-id property
  dt-bindings: usb: add usb role switch driver
  dt-bindings: usb: add Renesas R-Car USB 3.0 role switch driver
  of: platform: add device connection parsing
  usb: common: roles: add fwnode graph parsing
  usb: common: roles: Allow if the parent dev_name matches
  usb: common: roles: add getting device pointer APIs
  usb: role: rcar-usb3-role-switch: add support for R-Car SoCs
  usb: gadget: udc: renesas_usb3: add support for a usb role switch
  arm64: dts: renesas: r8a7795: add OF graph for usb role switch
  arm64: dts: renesas: r8a7795: salvator-xs: add OF graph for usb role
    switch

 Documentation/devicetree/bindings/graph.txt        |   2 +-
 .../bindings/usb/renesas,rcar-usb3-role-sw.txt     |  56 +++++++
 .../devicetree/bindings/usb/usb-role-switch.txt    |  42 +++++
 .../arm64/boot/dts/renesas/r8a7795-salvator-xs.dts |  28 ++++
 arch/arm64/boot/dts/renesas/r8a7795.dtsi           |  44 +++++
 drivers/of/platform.c                              |  66 ++++++++
 drivers/usb/common/roles.c                         |  84 +++++++++-
 drivers/usb/gadget/udc/Kconfig                     |   1 +
 drivers/usb/gadget/udc/renesas_usb3.c              |  34 +++-
 drivers/usb/roles/Kconfig                          |  12 ++
 drivers/usb/roles/Makefile                         |   1 +
 drivers/usb/roles/rcar-usb3-role-switch.c          | 179 +++++++++++++++++++++
 include/linux/of.h                                 |   1 +
 include/linux/usb/role.h                           |   4 +
 14 files changed, 545 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt
 create mode 100644 Documentation/devicetree/bindings/usb/usb-role-switch.txt
 create mode 100644 drivers/usb/roles/rcar-usb3-role-switch.c

-- 
1.9.1

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

* [PATCH/RFC 01/11] Documentation: of: Add device-connection-id property
@ 2018-04-18  8:09   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:09 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds a new property for device connection framework.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 Documentation/devicetree/bindings/graph.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/graph.txt b/Documentation/devicetree/bindings/graph.txt
index 0415e2c..fca0030 100644
--- a/Documentation/devicetree/bindings/graph.txt
+++ b/Documentation/devicetree/bindings/graph.txt
@@ -125,4 +125,4 @@ Optional endpoint properties
 ----------------------------
 
 - remote-endpoint: phandle to an 'endpoint' subnode of a remote device node.
-
+- device-connection-id: string for device connection.
-- 
1.9.1

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

* [PATCH/RFC,01/11] Documentation: of: Add device-connection-id property
@ 2018-04-18  8:09   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:09 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds a new property for device connection framework.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 Documentation/devicetree/bindings/graph.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/graph.txt b/Documentation/devicetree/bindings/graph.txt
index 0415e2c..fca0030 100644
--- a/Documentation/devicetree/bindings/graph.txt
+++ b/Documentation/devicetree/bindings/graph.txt
@@ -125,4 +125,4 @@ Optional endpoint properties
 ----------------------------
 
 - remote-endpoint: phandle to an 'endpoint' subnode of a remote device node.
-
+- device-connection-id: string for device connection.

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

* [PATCH/RFC 02/11] dt-bindings: usb: add usb role switch driver
@ 2018-04-18  8:09   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:09 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds a new documentation for a usb role switch driver.
The usb role switch framework will parse this to get each device
pointer by using each remote-endpoint.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 .../devicetree/bindings/usb/usb-role-switch.txt    | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/usb-role-switch.txt

diff --git a/Documentation/devicetree/bindings/usb/usb-role-switch.txt b/Documentation/devicetree/bindings/usb/usb-role-switch.txt
new file mode 100644
index 0000000..941d582
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usb-role-switch.txt
@@ -0,0 +1,42 @@
+USB role switch driver
+
+Optional nodes:
+- If a role switch driver has OF graph ports, the usb role switch framework
+  will parse the remote-endpoints in usb_role_switch_register(). The OF graph
+  port number as follows:
+    0: USB 2.0 host port
+    1: USB 3.0 host port
+    2: UDC port
+
+For example:
+	usb-role-sw {
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+
+				usb2_host_sw0: endpoint {
+					remote-endpoint = <&usb2_host_ep0>;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+
+				usb3_host_sw0: endpoint {
+					remote-endpoint = <&usb3_host_ep0>;
+				};
+			};
+
+			port@2 {
+				reg = <2>;
+
+				udc_sw0: endpoint {
+					remote-endpoint = <&udc_ep0>;
+				};
+			};
+		};
+	};
-- 
1.9.1

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

* [PATCH/RFC,02/11] dt-bindings: usb: add usb role switch driver
@ 2018-04-18  8:09   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:09 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds a new documentation for a usb role switch driver.
The usb role switch framework will parse this to get each device
pointer by using each remote-endpoint.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 .../devicetree/bindings/usb/usb-role-switch.txt    | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/usb-role-switch.txt

diff --git a/Documentation/devicetree/bindings/usb/usb-role-switch.txt b/Documentation/devicetree/bindings/usb/usb-role-switch.txt
new file mode 100644
index 0000000..941d582
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usb-role-switch.txt
@@ -0,0 +1,42 @@
+USB role switch driver
+
+Optional nodes:
+- If a role switch driver has OF graph ports, the usb role switch framework
+  will parse the remote-endpoints in usb_role_switch_register(). The OF graph
+  port number as follows:
+    0: USB 2.0 host port
+    1: USB 3.0 host port
+    2: UDC port
+
+For example:
+	usb-role-sw {
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+
+				usb2_host_sw0: endpoint {
+					remote-endpoint = <&usb2_host_ep0>;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+
+				usb3_host_sw0: endpoint {
+					remote-endpoint = <&usb3_host_ep0>;
+				};
+			};
+
+			port@2 {
+				reg = <2>;
+
+				udc_sw0: endpoint {
+					remote-endpoint = <&udc_ep0>;
+				};
+			};
+		};
+	};

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

* [PATCH/RFC 03/11] dt-bindings: usb: add Renesas R-Car USB 3.0 role switch driver
@ 2018-04-18  8:09   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:09 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds a new documentation for Renesas R-Car USB 3.0 role
switch driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 .../bindings/usb/renesas,rcar-usb3-role-sw.txt     | 56 ++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt

diff --git a/Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt b/Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt
new file mode 100644
index 0000000..ed60f66
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt
@@ -0,0 +1,56 @@
+Renesas Electronics R-Car USB 3.0 role switch driver
+
+A renesas_usb3's node can contain this node.
+
+Required properties:
+ - compatible: Must contain "renesas,rcar-usb3-role-switch".
+
+Required nodes:
+
+The connection to a USB connector node and USB role switch node need by
+using OF graph bindings. Please refer to the usb-role-switch.txt about
+port number of the OF graph. Note that port@3 is connected to
+the usb-connector.
+
+
+Example of R-Car H3 ES2.0:
+	usb3_peri0: usb@ee020000 {
+		compatible = "renesas,r8a7795-usb3-peri",
+			     "renesas,rcar-gen3-usb3-peri";
+		reg = <0 0xee020000 0 0x400>;
+		interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cpg CPG_MOD 328>;
+		power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+		resets = <&cpg 328>;
+
+		usb3-role-sw {
+			compatible = "renesas,rcar-usb3-role-switch";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				port@1 {
+					reg = <1>;
+
+					usb3_host_sw0: endpoint {
+						remote-endpoint = <&usb3_host_ep0>;
+					};
+				};
+
+				port@2 {
+					reg = <2>;
+					usb3_peri_sw0: endpoint {
+						remote-endpoint = <&usb3_peri_ep0>;
+						device-connection-id = "usb-role-switch";
+					};
+				};
+
+				port@3 {
+					reg = <3>;
+					usb3_role_sw0_ep: endpoint {
+					};
+				};
+			};
+		};
+	};
-- 
1.9.1

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

* [PATCH/RFC,03/11] dt-bindings: usb: add Renesas R-Car USB 3.0 role switch driver
@ 2018-04-18  8:09   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:09 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds a new documentation for Renesas R-Car USB 3.0 role
switch driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 .../bindings/usb/renesas,rcar-usb3-role-sw.txt     | 56 ++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt

diff --git a/Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt b/Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt
new file mode 100644
index 0000000..ed60f66
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt
@@ -0,0 +1,56 @@
+Renesas Electronics R-Car USB 3.0 role switch driver
+
+A renesas_usb3's node can contain this node.
+
+Required properties:
+ - compatible: Must contain "renesas,rcar-usb3-role-switch".
+
+Required nodes:
+
+The connection to a USB connector node and USB role switch node need by
+using OF graph bindings. Please refer to the usb-role-switch.txt about
+port number of the OF graph. Note that port@3 is connected to
+the usb-connector.
+
+
+Example of R-Car H3 ES2.0:
+	usb3_peri0: usb@ee020000 {
+		compatible = "renesas,r8a7795-usb3-peri",
+			     "renesas,rcar-gen3-usb3-peri";
+		reg = <0 0xee020000 0 0x400>;
+		interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cpg CPG_MOD 328>;
+		power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+		resets = <&cpg 328>;
+
+		usb3-role-sw {
+			compatible = "renesas,rcar-usb3-role-switch";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				port@1 {
+					reg = <1>;
+
+					usb3_host_sw0: endpoint {
+						remote-endpoint = <&usb3_host_ep0>;
+					};
+				};
+
+				port@2 {
+					reg = <2>;
+					usb3_peri_sw0: endpoint {
+						remote-endpoint = <&usb3_peri_ep0>;
+						device-connection-id = "usb-role-switch";
+					};
+				};
+
+				port@3 {
+					reg = <3>;
+					usb3_role_sw0_ep: endpoint {
+					};
+				};
+			};
+		};
+	};

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

* [PATCH/RFC 04/11] of: platform: add device connection parsing
@ 2018-04-18  8:09   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:09 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds device connection parsing in of_platform_populate().

TODO:
 - How to free the devcon memories?
 - How to remove the devcon instances?

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/of/platform.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/of.h    |  1 +
 2 files changed, 67 insertions(+)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index c00d81d..41c018d 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -17,6 +17,7 @@
 #include <linux/slab.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
+#include <linux/of_graph.h>
 #include <linux/of_iommu.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
@@ -326,6 +327,63 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
 	return NULL;
 }
 
+static int of_parse_device_connection(struct device_node *np)
+{
+	struct device_node *child_ep, *parent, *remote_parent;
+	struct platform_device *pdev, *remote_pdev;
+	struct device_connection *devcon = NULL;
+	const char *id;
+
+	if (of_node_check_flag(np, OF_DEVICE_CONNECTED)) {
+		pr_debug("%s() - skipping %pOF, already device connected\n",
+			__func__, np);
+		return 0;
+	}
+
+	of_node_set_flag(np, OF_DEVICE_CONNECTED);
+
+	for_each_endpoint_of_node(np, child_ep) {
+		if (of_property_read_string(child_ep, "device-connection-id",
+					    &id) < 0)
+			continue;
+
+		remote_parent = of_graph_get_remote_port_parent(child_ep);
+		if (!remote_parent)
+			return 0;
+
+		parent = of_graph_get_port_parent(child_ep);
+		if (!parent)
+			return 0;
+
+		pdev = of_find_device_by_node(parent);
+		if (!pdev)
+			return 0;
+
+		/*
+		 * WARN_ON in really_probe() may happen if devm_kzalloc is
+		 * used. TODO: How to free this?
+		 */
+		devcon = kzalloc(sizeof(*devcon), GFP_KERNEL);
+		if (!devcon)
+			return -ENOMEM;
+
+		devcon->id = id;
+		remote_pdev = of_find_device_by_node(remote_parent);
+		if (!remote_pdev) {
+			kfree(devcon);
+			return 0;
+		}
+
+		devcon->endpoint[0] = dev_name(&pdev->dev);
+		devcon->endpoint[1] = dev_name(&remote_pdev->dev);
+
+		/* TODO: How to remove the connection? */
+		device_connection_add(devcon);
+	}
+
+	return 0;
+}
+
 /**
  * of_platform_bus_create() - Create a device for a node and its children.
  * @bus: device node of the bus to instantiate
@@ -477,6 +535,14 @@ int of_platform_populate(struct device_node *root,
 	}
 	of_node_set_flag(root, OF_POPULATED_BUS);
 
+	for_each_child_of_node(root, child) {
+		rc = of_parse_device_connection(child);
+		if (rc) {
+			of_node_put(child);
+			break;
+		}
+	}
+
 	of_node_put(root);
 	return rc;
 }
diff --git a/include/linux/of.h b/include/linux/of.h
index 4d25e4f..30aa103 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -143,6 +143,7 @@ static inline void of_node_put(struct device_node *node) { }
 #define OF_DETACHED	2 /* node has been detached from the device tree */
 #define OF_POPULATED	3 /* device already created for the node */
 #define OF_POPULATED_BUS	4 /* of_platform_populate recursed to children of this node */
+#define OF_DEVICE_CONNECTED	5 /* checked devcon on of_platform_populate */
 
 #define OF_BAD_ADDR	((u64)-1)
 
-- 
1.9.1

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

* [PATCH/RFC,04/11] of: platform: add device connection parsing
@ 2018-04-18  8:09   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:09 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds device connection parsing in of_platform_populate().

TODO:
 - How to free the devcon memories?
 - How to remove the devcon instances?

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/of/platform.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/of.h    |  1 +
 2 files changed, 67 insertions(+)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index c00d81d..41c018d 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -17,6 +17,7 @@
 #include <linux/slab.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
+#include <linux/of_graph.h>
 #include <linux/of_iommu.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
@@ -326,6 +327,63 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
 	return NULL;
 }
 
+static int of_parse_device_connection(struct device_node *np)
+{
+	struct device_node *child_ep, *parent, *remote_parent;
+	struct platform_device *pdev, *remote_pdev;
+	struct device_connection *devcon = NULL;
+	const char *id;
+
+	if (of_node_check_flag(np, OF_DEVICE_CONNECTED)) {
+		pr_debug("%s() - skipping %pOF, already device connected\n",
+			__func__, np);
+		return 0;
+	}
+
+	of_node_set_flag(np, OF_DEVICE_CONNECTED);
+
+	for_each_endpoint_of_node(np, child_ep) {
+		if (of_property_read_string(child_ep, "device-connection-id",
+					    &id) < 0)
+			continue;
+
+		remote_parent = of_graph_get_remote_port_parent(child_ep);
+		if (!remote_parent)
+			return 0;
+
+		parent = of_graph_get_port_parent(child_ep);
+		if (!parent)
+			return 0;
+
+		pdev = of_find_device_by_node(parent);
+		if (!pdev)
+			return 0;
+
+		/*
+		 * WARN_ON in really_probe() may happen if devm_kzalloc is
+		 * used. TODO: How to free this?
+		 */
+		devcon = kzalloc(sizeof(*devcon), GFP_KERNEL);
+		if (!devcon)
+			return -ENOMEM;
+
+		devcon->id = id;
+		remote_pdev = of_find_device_by_node(remote_parent);
+		if (!remote_pdev) {
+			kfree(devcon);
+			return 0;
+		}
+
+		devcon->endpoint[0] = dev_name(&pdev->dev);
+		devcon->endpoint[1] = dev_name(&remote_pdev->dev);
+
+		/* TODO: How to remove the connection? */
+		device_connection_add(devcon);
+	}
+
+	return 0;
+}
+
 /**
  * of_platform_bus_create() - Create a device for a node and its children.
  * @bus: device node of the bus to instantiate
@@ -477,6 +535,14 @@ int of_platform_populate(struct device_node *root,
 	}
 	of_node_set_flag(root, OF_POPULATED_BUS);
 
+	for_each_child_of_node(root, child) {
+		rc = of_parse_device_connection(child);
+		if (rc) {
+			of_node_put(child);
+			break;
+		}
+	}
+
 	of_node_put(root);
 	return rc;
 }
diff --git a/include/linux/of.h b/include/linux/of.h
index 4d25e4f..30aa103 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -143,6 +143,7 @@ static inline void of_node_put(struct device_node *node) { }
 #define OF_DETACHED	2 /* node has been detached from the device tree */
 #define OF_POPULATED	3 /* device already created for the node */
 #define OF_POPULATED_BUS	4 /* of_platform_populate recursed to children of this node */
+#define OF_DEVICE_CONNECTED	5 /* checked devcon on of_platform_populate */
 
 #define OF_BAD_ADDR	((u64)-1)
 

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

* [PATCH/RFC 05/11] usb: common: roles: add fwnode graph parsing
@ 2018-04-18  8:09   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:09 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds fwnode graph parsing to set usb[23]_port and udc
into the usb_role_switch structure by usb_role_switch_register().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/common/roles.c | 40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/common/roles.c b/drivers/usb/common/roles.c
index 15cc76e..cc1c55a 100644
--- a/drivers/usb/common/roles.c
+++ b/drivers/usb/common/roles.c
@@ -11,6 +11,8 @@
 #include <linux/device.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
+#include <linux/of_platform.h>
+#include <linux/property.h>
 #include <linux/slab.h>
 
 static struct class *role_class;
@@ -219,6 +221,42 @@ static void usb_role_switch_release(struct device *dev)
 	.release = usb_role_switch_release,
 };
 
+static void usb_role_parse_fwnode_graph(struct usb_role_switch *sw)
+{
+	struct fwnode_handle *parent = sw->dev.parent->fwnode;
+	struct fwnode_handle *child_ep, *child_port;
+	struct fwnode_handle *remote;
+	/* This order comes from DT bindings */
+	struct device **dev[] = {
+		&sw->usb2_port,
+		&sw->usb3_port,
+		&sw->udc,
+	};
+	u32 port;
+
+	fwnode_graph_for_each_endpoint(parent, child_ep) {
+		child_port = fwnode_get_parent(child_ep);
+		if (!child_port)
+			continue;
+
+		if (fwnode_property_read_u32(child_port, "reg", &port) < 0)
+			continue;
+
+		if (port >= ARRAY_SIZE(dev))
+			break;
+
+		remote = fwnode_graph_get_remote_port_parent(child_ep);
+		if (remote) {
+			struct device_node *remote_np = to_of_node(remote);
+			struct platform_device *pdev;
+
+			pdev = of_find_device_by_node(remote_np);
+			if (pdev)
+				*dev[port] = &pdev->dev;
+		}
+	};
+}
+
 /**
  * usb_role_switch_register - Register USB Role Switch
  * @parent: Parent device for the switch
@@ -267,7 +305,7 @@ struct usb_role_switch *
 		return ERR_PTR(ret);
 	}
 
-	/* TODO: Symlinks for the host port and the device controller. */
+	usb_role_parse_fwnode_graph(sw);
 
 	return sw;
 }
-- 
1.9.1

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

* [PATCH/RFC,05/11] usb: common: roles: add fwnode graph parsing
@ 2018-04-18  8:09   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:09 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds fwnode graph parsing to set usb[23]_port and udc
into the usb_role_switch structure by usb_role_switch_register().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/common/roles.c | 40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/common/roles.c b/drivers/usb/common/roles.c
index 15cc76e..cc1c55a 100644
--- a/drivers/usb/common/roles.c
+++ b/drivers/usb/common/roles.c
@@ -11,6 +11,8 @@
 #include <linux/device.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
+#include <linux/of_platform.h>
+#include <linux/property.h>
 #include <linux/slab.h>
 
 static struct class *role_class;
@@ -219,6 +221,42 @@ static void usb_role_switch_release(struct device *dev)
 	.release = usb_role_switch_release,
 };
 
+static void usb_role_parse_fwnode_graph(struct usb_role_switch *sw)
+{
+	struct fwnode_handle *parent = sw->dev.parent->fwnode;
+	struct fwnode_handle *child_ep, *child_port;
+	struct fwnode_handle *remote;
+	/* This order comes from DT bindings */
+	struct device **dev[] = {
+		&sw->usb2_port,
+		&sw->usb3_port,
+		&sw->udc,
+	};
+	u32 port;
+
+	fwnode_graph_for_each_endpoint(parent, child_ep) {
+		child_port = fwnode_get_parent(child_ep);
+		if (!child_port)
+			continue;
+
+		if (fwnode_property_read_u32(child_port, "reg", &port) < 0)
+			continue;
+
+		if (port >= ARRAY_SIZE(dev))
+			break;
+
+		remote = fwnode_graph_get_remote_port_parent(child_ep);
+		if (remote) {
+			struct device_node *remote_np = to_of_node(remote);
+			struct platform_device *pdev;
+
+			pdev = of_find_device_by_node(remote_np);
+			if (pdev)
+				*dev[port] = &pdev->dev;
+		}
+	};
+}
+
 /**
  * usb_role_switch_register - Register USB Role Switch
  * @parent: Parent device for the switch
@@ -267,7 +305,7 @@ struct usb_role_switch *
 		return ERR_PTR(ret);
 	}
 
-	/* TODO: Symlinks for the host port and the device controller. */
+	usb_role_parse_fwnode_graph(sw);
 
 	return sw;
 }

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

* [PATCH/RFC 06/11] usb: common: roles: Allow if the parent dev_name matches
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

THis patch adds a condition in __switch_match() to allow if
the parent dev_name matches. Otherwise, OF environment cannot match
the usb role switch devices because the usb role switch framework
adds the names of a new child device as the parent dev_name with
"-role-switch".

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/common/roles.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/common/roles.c b/drivers/usb/common/roles.c
index cc1c55a..381259c 100644
--- a/drivers/usb/common/roles.c
+++ b/drivers/usb/common/roles.c
@@ -88,7 +88,13 @@ enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw)
 
 static int __switch_match(struct device *dev, const void *name)
 {
-	return !strcmp((const char *)name, dev_name(dev));
+	int ret = !strcmp((const char *)name, dev_name(dev));
+
+	/* If doesn't match, this also checks the parent dev_name */
+	if (!ret && dev->parent)
+		ret = !strcmp((const char *)name, dev_name(dev->parent));
+
+	return ret;
 }
 
 static void *usb_role_switch_match(struct device_connection *con, int ep,
-- 
1.9.1

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

* [PATCH/RFC,06/11] usb: common: roles: Allow if the parent dev_name matches
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

THis patch adds a condition in __switch_match() to allow if
the parent dev_name matches. Otherwise, OF environment cannot match
the usb role switch devices because the usb role switch framework
adds the names of a new child device as the parent dev_name with
"-role-switch".

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/common/roles.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/common/roles.c b/drivers/usb/common/roles.c
index cc1c55a..381259c 100644
--- a/drivers/usb/common/roles.c
+++ b/drivers/usb/common/roles.c
@@ -88,7 +88,13 @@ enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw)
 
 static int __switch_match(struct device *dev, const void *name)
 {
-	return !strcmp((const char *)name, dev_name(dev));
+	int ret = !strcmp((const char *)name, dev_name(dev));
+
+	/* If doesn't match, this also checks the parent dev_name */
+	if (!ret && dev->parent)
+		ret = !strcmp((const char *)name, dev_name(dev->parent));
+
+	return ret;
 }
 
 static void *usb_role_switch_match(struct device_connection *con, int ep,

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

* [PATCH/RFC 07/11] usb: common: roles: add getting device pointer APIs
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds APIs that a role switch driver can get device pointer
of USB 2.0/3.0 and udc.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/common/roles.c | 36 ++++++++++++++++++++++++++++++++++++
 include/linux/usb/role.h   |  4 ++++
 2 files changed, 40 insertions(+)

diff --git a/drivers/usb/common/roles.c b/drivers/usb/common/roles.c
index 381259c..5fd14b2 100644
--- a/drivers/usb/common/roles.c
+++ b/drivers/usb/common/roles.c
@@ -34,6 +34,42 @@ struct usb_role_switch {
 #define to_role_switch(d)	container_of(d, struct usb_role_switch, dev)
 
 /**
+ * usb_role_switch_get_usb2_port - Get device of a USB 2.0 host
+ * @sw: USB role switch
+ *
+ * Returns USB 2.0 host device pointer.
+ */
+struct device *usb_role_switch_get_usb2_port(struct usb_role_switch *sw)
+{
+	return sw->usb2_port;
+}
+EXPORT_SYMBOL(usb_role_switch_get_usb2_port);
+
+/**
+ * usb_role_switch_get_usb3_port - Get device of a USB 3.0 host
+ * @sw: USB role switch
+ *
+ * Returns USB 3.0 host device pointer.
+ */
+struct device *usb_role_switch_get_usb3_port(struct usb_role_switch *sw)
+{
+	return sw->usb3_port;
+}
+EXPORT_SYMBOL(usb_role_switch_get_usb3_port);
+
+/**
+ * usb_role_switch_get_udc - Get device of a udc
+ * @sw: USB role switch
+ *
+ * Returns udc device pointer.
+ */
+struct device *usb_role_switch_get_udc(struct usb_role_switch *sw)
+{
+	return sw->udc;
+}
+EXPORT_SYMBOL(usb_role_switch_get_udc);
+
+/**
  * usb_role_switch_set_role - Set USB role for a switch
  * @sw: USB role switch
  * @role: USB role to be switched to
diff --git a/include/linux/usb/role.h b/include/linux/usb/role.h
index edc51be..c7eb73b 100644
--- a/include/linux/usb/role.h
+++ b/include/linux/usb/role.h
@@ -40,6 +40,10 @@ struct usb_role_switch_desc {
 	bool allow_userspace_control;
 };
 
+struct device *usb_role_switch_get_usb2_port(struct usb_role_switch *sw);
+struct device *usb_role_switch_get_usb3_port(struct usb_role_switch *sw);
+struct device *usb_role_switch_get_udc(struct usb_role_switch *sw);
+
 int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role);
 enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw);
 struct usb_role_switch *usb_role_switch_get(struct device *dev);
-- 
1.9.1

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

* [PATCH/RFC,07/11] usb: common: roles: add getting device pointer APIs
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds APIs that a role switch driver can get device pointer
of USB 2.0/3.0 and udc.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/common/roles.c | 36 ++++++++++++++++++++++++++++++++++++
 include/linux/usb/role.h   |  4 ++++
 2 files changed, 40 insertions(+)

diff --git a/drivers/usb/common/roles.c b/drivers/usb/common/roles.c
index 381259c..5fd14b2 100644
--- a/drivers/usb/common/roles.c
+++ b/drivers/usb/common/roles.c
@@ -34,6 +34,42 @@ struct usb_role_switch {
 #define to_role_switch(d)	container_of(d, struct usb_role_switch, dev)
 
 /**
+ * usb_role_switch_get_usb2_port - Get device of a USB 2.0 host
+ * @sw: USB role switch
+ *
+ * Returns USB 2.0 host device pointer.
+ */
+struct device *usb_role_switch_get_usb2_port(struct usb_role_switch *sw)
+{
+	return sw->usb2_port;
+}
+EXPORT_SYMBOL(usb_role_switch_get_usb2_port);
+
+/**
+ * usb_role_switch_get_usb3_port - Get device of a USB 3.0 host
+ * @sw: USB role switch
+ *
+ * Returns USB 3.0 host device pointer.
+ */
+struct device *usb_role_switch_get_usb3_port(struct usb_role_switch *sw)
+{
+	return sw->usb3_port;
+}
+EXPORT_SYMBOL(usb_role_switch_get_usb3_port);
+
+/**
+ * usb_role_switch_get_udc - Get device of a udc
+ * @sw: USB role switch
+ *
+ * Returns udc device pointer.
+ */
+struct device *usb_role_switch_get_udc(struct usb_role_switch *sw)
+{
+	return sw->udc;
+}
+EXPORT_SYMBOL(usb_role_switch_get_udc);
+
+/**
  * usb_role_switch_set_role - Set USB role for a switch
  * @sw: USB role switch
  * @role: USB role to be switched to
diff --git a/include/linux/usb/role.h b/include/linux/usb/role.h
index edc51be..c7eb73b 100644
--- a/include/linux/usb/role.h
+++ b/include/linux/usb/role.h
@@ -40,6 +40,10 @@ struct usb_role_switch_desc {
 	bool allow_userspace_control;
 };
 
+struct device *usb_role_switch_get_usb2_port(struct usb_role_switch *sw);
+struct device *usb_role_switch_get_usb3_port(struct usb_role_switch *sw);
+struct device *usb_role_switch_get_udc(struct usb_role_switch *sw);
+
 int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role);
 enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw);
 struct usb_role_switch *usb_role_switch_get(struct device *dev);

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

* [PATCH/RFC 08/11] usb: role: rcar-usb3-role-switch: add support for R-Car SoCs
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds role switch support for R-Car SoCs. Some R-Car SoCs
(e.g. R-Car H3) have USB 3.0 dual-role device controller which has
the USB 3.0 xHCI host and Renesas USB 3.0 peripheral.

Unfortunately, the mode change register contains the USB 3.0 peripheral
controller side only. So, the USB 3.0 peripheral driver (renesas_usb3)
manages this register. However, in peripheral mode, the host should
stop. Also the host hardware needs to reinitialize its own registers
when the mode changes from peripheral to host mode. Otherwise,
the host cannot work correctly (e.g. detect a device as high-speed).

To achieve this by a driver, this role switch driver manages
the mode change register and attach/release the xhci-plat driver.
The renesas_usb3 udc driver should call devm_of_platform_populate()
to probe this driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/roles/Kconfig                 |  12 ++
 drivers/usb/roles/Makefile                |   1 +
 drivers/usb/roles/rcar-usb3-role-switch.c | 179 ++++++++++++++++++++++++++++++
 3 files changed, 192 insertions(+)
 create mode 100644 drivers/usb/roles/rcar-usb3-role-switch.c

diff --git a/drivers/usb/roles/Kconfig b/drivers/usb/roles/Kconfig
index f5a5e6f..429d784 100644
--- a/drivers/usb/roles/Kconfig
+++ b/drivers/usb/roles/Kconfig
@@ -11,4 +11,16 @@ config USB_ROLES_INTEL_XHCI
 	  To compile the driver as a module, choose M here: the module will
 	  be called intel-xhci-usb-role-switch.
 
+config USB_ROLES_RCAR_USB3
+	tristate "Renesas R-Car USB3.0 Role Switch"
+	depends on ARCH_RENESAS && OF
+	help
+	  Driver for the internal USB role switch for switching the USB data
+	  lines between the xHCI host controller and the Renesas gadget
+	  controller (by using renesas_usb3 driver) found on various Renesas
+	  R-Car SoCs.
+
+	  To compile the driver as a module, choose M here: the module will
+	  be called rcar-usb3-role-switch.
+
 endif # USB_ROLE_SWITCH
diff --git a/drivers/usb/roles/Makefile b/drivers/usb/roles/Makefile
index e44b179..7ce3be3 100644
--- a/drivers/usb/roles/Makefile
+++ b/drivers/usb/roles/Makefile
@@ -1 +1,2 @@
 obj-$(CONFIG_USB_ROLES_INTEL_XHCI) += intel-xhci-usb-role-switch.o
+obj-$(CONFIG_USB_ROLES_RCAR_USB3) += rcar-usb3-role-switch.o
diff --git a/drivers/usb/roles/rcar-usb3-role-switch.c b/drivers/usb/roles/rcar-usb3-role-switch.c
new file mode 100644
index 0000000..9b56945
--- /dev/null
+++ b/drivers/usb/roles/rcar-usb3-role-switch.c
@@ -0,0 +1,179 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Renesas R-Car USB 3.0 role switch driver
+ *
+ * Copyright (C) 2018  Renesas Electronics Corporation
+ */
+
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/slab.h>
+#include <linux/usb/role.h>
+
+#define USB3_DRD_CON		0x218
+#define DRD_CON_PERI_CON	BIT(24)
+
+struct rcar_usb3_role_switch {
+	struct usb_role_switch *role_sw;
+	void __iomem *reg;
+	enum usb_role save_role;	/* for suspend/resume */
+};
+
+static enum usb_role
+rcar_usb3_role_switch_get_mode(struct rcar_usb3_role_switch *rcar_sw)
+{
+	u32 val = readl(rcar_sw->reg + USB3_DRD_CON);
+
+	if (val & DRD_CON_PERI_CON)
+		return USB_ROLE_DEVICE;
+
+	return USB_ROLE_HOST;
+}
+
+static void
+rcar_usb3_role_switch_set_mode(struct rcar_usb3_role_switch *rcar_sw,
+			       bool host)
+{
+	void __iomem *drd_con = rcar_sw->reg + USB3_DRD_CON;
+
+	if (host)
+		writel(readl(drd_con) & ~DRD_CON_PERI_CON, drd_con);
+	else
+		writel(readl(drd_con) | DRD_CON_PERI_CON, drd_con);
+}
+
+static int rcar_usb3_role_switch_set_role(struct device *dev,
+					  enum usb_role role)
+{
+	struct rcar_usb3_role_switch *rcar_sw = dev_get_drvdata(dev);
+	struct device *host = usb_role_switch_get_usb3_port(rcar_sw->role_sw);
+	enum usb_role cur_role;
+
+	pm_runtime_get_sync(dev->parent);
+
+	cur_role = rcar_usb3_role_switch_get_mode(rcar_sw);
+	if (cur_role == USB_ROLE_HOST && role == USB_ROLE_DEVICE) {
+		device_release_driver(host);
+		rcar_usb3_role_switch_set_mode(rcar_sw, false);
+	} else if (cur_role == USB_ROLE_DEVICE && role == USB_ROLE_HOST) {
+		/* Must set the mode before device_attach of the host */
+		rcar_usb3_role_switch_set_mode(rcar_sw, true);
+		if (device_attach(host) < 0)
+			dev_err(dev, "device_attach(usb3_port) failed\n");
+	}
+
+	pm_runtime_put(dev->parent);
+
+	return 0;
+}
+
+static enum usb_role rcar_usb3_role_switch_get_role(struct device *dev)
+{
+	struct rcar_usb3_role_switch *rcar_sw = dev_get_drvdata(dev);
+	enum usb_role cur_role;
+
+	pm_runtime_get(dev->parent);
+	cur_role = rcar_usb3_role_switch_get_mode(rcar_sw);
+	pm_runtime_put(dev->parent);
+
+	return cur_role;
+}
+
+static struct usb_role_switch_desc rcar_usb3_role_switch_desc = {
+	.set = rcar_usb3_role_switch_set_role,
+	.get = rcar_usb3_role_switch_get_role,
+};
+
+static const struct of_device_id rcar_usb3_role_switch_of_match[] = {
+	{ .compatible = "renesas,rcar-usb3-role-switch" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, rcar_usb3_role_switch_of_match);
+
+static int rcar_usb3_role_switch_remove(struct platform_device *pdev)
+{
+	struct rcar_usb3_role_switch *rcar_sw = platform_get_drvdata(pdev);
+
+	usb_role_switch_unregister(rcar_sw->role_sw);
+	pm_runtime_disable(pdev->dev.parent);
+
+	return 0;
+}
+
+static int rcar_usb3_role_switch_probe(struct platform_device *pdev)
+{
+	struct rcar_usb3_role_switch *rcar_sw;
+	struct resource *res;
+
+	rcar_sw = devm_kzalloc(&pdev->dev, sizeof(*rcar_sw), GFP_KERNEL);
+	if (!rcar_sw)
+		return -ENOMEM;
+
+	res = platform_get_resource(to_platform_device(pdev->dev.parent),
+				    IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENODEV;
+
+	rcar_sw->reg = devm_ioremap_nocache(&pdev->dev, res->start,
+					    resource_size(res));
+	if (IS_ERR(rcar_sw->reg))
+		return PTR_ERR(rcar_sw->reg);
+
+	platform_set_drvdata(pdev, rcar_sw);
+	pm_runtime_enable(pdev->dev.parent);
+
+	rcar_usb3_role_switch_desc.allow_userspace_control = true;
+	rcar_sw->role_sw = usb_role_switch_register(&pdev->dev,
+						&rcar_usb3_role_switch_desc);
+	if (IS_ERR(rcar_sw->role_sw)) {
+		pm_runtime_disable(pdev->dev.parent);
+		return PTR_ERR(rcar_sw->role_sw);
+	}
+
+	return 0;
+}
+
+static int __maybe_unused rcar_usb3_role_switch_suspend(struct device *dev)
+{
+	struct rcar_usb3_role_switch *rcar_sw = dev_get_drvdata(dev);
+
+	pm_runtime_get_sync(dev->parent);
+	rcar_sw->save_role = rcar_usb3_role_switch_get_mode(rcar_sw);
+	pm_runtime_put(dev->parent);
+
+	return 0;
+}
+
+static int __maybe_unused rcar_usb3_role_switch_resume(struct device *dev)
+{
+	struct rcar_usb3_role_switch *rcar_sw = dev_get_drvdata(dev);
+	bool host = rcar_sw->save_role == USB_ROLE_HOST ? true : false;
+
+	pm_runtime_get_sync(dev->parent);
+	rcar_usb3_role_switch_set_mode(rcar_sw, host);
+	pm_runtime_put(dev->parent);
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(rcar_usb3_role_switch_pm_ops,
+			 rcar_usb3_role_switch_suspend,
+			 rcar_usb3_role_switch_resume);
+
+static struct platform_driver rcar_usb3_role_switch_driver = {
+	.probe		= rcar_usb3_role_switch_probe,
+	.remove		= rcar_usb3_role_switch_remove,
+	.driver		= {
+		.name =	"rcar_usb3_role_switch",
+		.pm		= &rcar_usb3_role_switch_pm_ops,
+		.of_match_table = rcar_usb3_role_switch_of_match,
+	},
+};
+module_platform_driver(rcar_usb3_role_switch_driver);
+
+MODULE_DESCRIPTION("Renesas USB3.0 role switch driver");
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>");
-- 
1.9.1

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

* [PATCH/RFC,08/11] usb: role: rcar-usb3-role-switch: add support for R-Car SoCs
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds role switch support for R-Car SoCs. Some R-Car SoCs
(e.g. R-Car H3) have USB 3.0 dual-role device controller which has
the USB 3.0 xHCI host and Renesas USB 3.0 peripheral.

Unfortunately, the mode change register contains the USB 3.0 peripheral
controller side only. So, the USB 3.0 peripheral driver (renesas_usb3)
manages this register. However, in peripheral mode, the host should
stop. Also the host hardware needs to reinitialize its own registers
when the mode changes from peripheral to host mode. Otherwise,
the host cannot work correctly (e.g. detect a device as high-speed).

To achieve this by a driver, this role switch driver manages
the mode change register and attach/release the xhci-plat driver.
The renesas_usb3 udc driver should call devm_of_platform_populate()
to probe this driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/roles/Kconfig                 |  12 ++
 drivers/usb/roles/Makefile                |   1 +
 drivers/usb/roles/rcar-usb3-role-switch.c | 179 ++++++++++++++++++++++++++++++
 3 files changed, 192 insertions(+)
 create mode 100644 drivers/usb/roles/rcar-usb3-role-switch.c

diff --git a/drivers/usb/roles/Kconfig b/drivers/usb/roles/Kconfig
index f5a5e6f..429d784 100644
--- a/drivers/usb/roles/Kconfig
+++ b/drivers/usb/roles/Kconfig
@@ -11,4 +11,16 @@ config USB_ROLES_INTEL_XHCI
 	  To compile the driver as a module, choose M here: the module will
 	  be called intel-xhci-usb-role-switch.
 
+config USB_ROLES_RCAR_USB3
+	tristate "Renesas R-Car USB3.0 Role Switch"
+	depends on ARCH_RENESAS && OF
+	help
+	  Driver for the internal USB role switch for switching the USB data
+	  lines between the xHCI host controller and the Renesas gadget
+	  controller (by using renesas_usb3 driver) found on various Renesas
+	  R-Car SoCs.
+
+	  To compile the driver as a module, choose M here: the module will
+	  be called rcar-usb3-role-switch.
+
 endif # USB_ROLE_SWITCH
diff --git a/drivers/usb/roles/Makefile b/drivers/usb/roles/Makefile
index e44b179..7ce3be3 100644
--- a/drivers/usb/roles/Makefile
+++ b/drivers/usb/roles/Makefile
@@ -1 +1,2 @@
 obj-$(CONFIG_USB_ROLES_INTEL_XHCI) += intel-xhci-usb-role-switch.o
+obj-$(CONFIG_USB_ROLES_RCAR_USB3) += rcar-usb3-role-switch.o
diff --git a/drivers/usb/roles/rcar-usb3-role-switch.c b/drivers/usb/roles/rcar-usb3-role-switch.c
new file mode 100644
index 0000000..9b56945
--- /dev/null
+++ b/drivers/usb/roles/rcar-usb3-role-switch.c
@@ -0,0 +1,179 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Renesas R-Car USB 3.0 role switch driver
+ *
+ * Copyright (C) 2018  Renesas Electronics Corporation
+ */
+
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/slab.h>
+#include <linux/usb/role.h>
+
+#define USB3_DRD_CON		0x218
+#define DRD_CON_PERI_CON	BIT(24)
+
+struct rcar_usb3_role_switch {
+	struct usb_role_switch *role_sw;
+	void __iomem *reg;
+	enum usb_role save_role;	/* for suspend/resume */
+};
+
+static enum usb_role
+rcar_usb3_role_switch_get_mode(struct rcar_usb3_role_switch *rcar_sw)
+{
+	u32 val = readl(rcar_sw->reg + USB3_DRD_CON);
+
+	if (val & DRD_CON_PERI_CON)
+		return USB_ROLE_DEVICE;
+
+	return USB_ROLE_HOST;
+}
+
+static void
+rcar_usb3_role_switch_set_mode(struct rcar_usb3_role_switch *rcar_sw,
+			       bool host)
+{
+	void __iomem *drd_con = rcar_sw->reg + USB3_DRD_CON;
+
+	if (host)
+		writel(readl(drd_con) & ~DRD_CON_PERI_CON, drd_con);
+	else
+		writel(readl(drd_con) | DRD_CON_PERI_CON, drd_con);
+}
+
+static int rcar_usb3_role_switch_set_role(struct device *dev,
+					  enum usb_role role)
+{
+	struct rcar_usb3_role_switch *rcar_sw = dev_get_drvdata(dev);
+	struct device *host = usb_role_switch_get_usb3_port(rcar_sw->role_sw);
+	enum usb_role cur_role;
+
+	pm_runtime_get_sync(dev->parent);
+
+	cur_role = rcar_usb3_role_switch_get_mode(rcar_sw);
+	if (cur_role == USB_ROLE_HOST && role == USB_ROLE_DEVICE) {
+		device_release_driver(host);
+		rcar_usb3_role_switch_set_mode(rcar_sw, false);
+	} else if (cur_role == USB_ROLE_DEVICE && role == USB_ROLE_HOST) {
+		/* Must set the mode before device_attach of the host */
+		rcar_usb3_role_switch_set_mode(rcar_sw, true);
+		if (device_attach(host) < 0)
+			dev_err(dev, "device_attach(usb3_port) failed\n");
+	}
+
+	pm_runtime_put(dev->parent);
+
+	return 0;
+}
+
+static enum usb_role rcar_usb3_role_switch_get_role(struct device *dev)
+{
+	struct rcar_usb3_role_switch *rcar_sw = dev_get_drvdata(dev);
+	enum usb_role cur_role;
+
+	pm_runtime_get(dev->parent);
+	cur_role = rcar_usb3_role_switch_get_mode(rcar_sw);
+	pm_runtime_put(dev->parent);
+
+	return cur_role;
+}
+
+static struct usb_role_switch_desc rcar_usb3_role_switch_desc = {
+	.set = rcar_usb3_role_switch_set_role,
+	.get = rcar_usb3_role_switch_get_role,
+};
+
+static const struct of_device_id rcar_usb3_role_switch_of_match[] = {
+	{ .compatible = "renesas,rcar-usb3-role-switch" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, rcar_usb3_role_switch_of_match);
+
+static int rcar_usb3_role_switch_remove(struct platform_device *pdev)
+{
+	struct rcar_usb3_role_switch *rcar_sw = platform_get_drvdata(pdev);
+
+	usb_role_switch_unregister(rcar_sw->role_sw);
+	pm_runtime_disable(pdev->dev.parent);
+
+	return 0;
+}
+
+static int rcar_usb3_role_switch_probe(struct platform_device *pdev)
+{
+	struct rcar_usb3_role_switch *rcar_sw;
+	struct resource *res;
+
+	rcar_sw = devm_kzalloc(&pdev->dev, sizeof(*rcar_sw), GFP_KERNEL);
+	if (!rcar_sw)
+		return -ENOMEM;
+
+	res = platform_get_resource(to_platform_device(pdev->dev.parent),
+				    IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENODEV;
+
+	rcar_sw->reg = devm_ioremap_nocache(&pdev->dev, res->start,
+					    resource_size(res));
+	if (IS_ERR(rcar_sw->reg))
+		return PTR_ERR(rcar_sw->reg);
+
+	platform_set_drvdata(pdev, rcar_sw);
+	pm_runtime_enable(pdev->dev.parent);
+
+	rcar_usb3_role_switch_desc.allow_userspace_control = true;
+	rcar_sw->role_sw = usb_role_switch_register(&pdev->dev,
+						&rcar_usb3_role_switch_desc);
+	if (IS_ERR(rcar_sw->role_sw)) {
+		pm_runtime_disable(pdev->dev.parent);
+		return PTR_ERR(rcar_sw->role_sw);
+	}
+
+	return 0;
+}
+
+static int __maybe_unused rcar_usb3_role_switch_suspend(struct device *dev)
+{
+	struct rcar_usb3_role_switch *rcar_sw = dev_get_drvdata(dev);
+
+	pm_runtime_get_sync(dev->parent);
+	rcar_sw->save_role = rcar_usb3_role_switch_get_mode(rcar_sw);
+	pm_runtime_put(dev->parent);
+
+	return 0;
+}
+
+static int __maybe_unused rcar_usb3_role_switch_resume(struct device *dev)
+{
+	struct rcar_usb3_role_switch *rcar_sw = dev_get_drvdata(dev);
+	bool host = rcar_sw->save_role == USB_ROLE_HOST ? true : false;
+
+	pm_runtime_get_sync(dev->parent);
+	rcar_usb3_role_switch_set_mode(rcar_sw, host);
+	pm_runtime_put(dev->parent);
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(rcar_usb3_role_switch_pm_ops,
+			 rcar_usb3_role_switch_suspend,
+			 rcar_usb3_role_switch_resume);
+
+static struct platform_driver rcar_usb3_role_switch_driver = {
+	.probe		= rcar_usb3_role_switch_probe,
+	.remove		= rcar_usb3_role_switch_remove,
+	.driver		= {
+		.name =	"rcar_usb3_role_switch",
+		.pm		= &rcar_usb3_role_switch_pm_ops,
+		.of_match_table = rcar_usb3_role_switch_of_match,
+	},
+};
+module_platform_driver(rcar_usb3_role_switch_driver);
+
+MODULE_DESCRIPTION("Renesas USB3.0 role switch driver");
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>");

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

* [PATCH/RFC 09/11] usb: gadget: udc: renesas_usb3: add support for a usb role switch
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds support for a usb role switch driver. And then,
this driver uses the usb role switch APIs instead of hardware
access to initialize usb host side at specific timings.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/gadget/udc/Kconfig        |  1 +
 drivers/usb/gadget/udc/renesas_usb3.c | 34 ++++++++++++++++++++++++++++------
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 0875d38..7e4a5dd 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -193,6 +193,7 @@ config USB_RENESAS_USB3
 	tristate 'Renesas USB3.0 Peripheral controller'
 	depends on ARCH_RENESAS || COMPILE_TEST
 	depends on EXTCON && HAS_DMA
+	select USB_ROLE_SWITCH
 	help
 	   Renesas USB3.0 Peripheral controller is a USB peripheral controller
 	   that supports super, high, and full speed USB 3.0 data transfers.
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 409cde4..38dd759 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -23,6 +23,7 @@
 #include <linux/uaccess.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
+#include <linux/usb/role.h>
 
 /* register definitions */
 #define USB3_AXI_INT_STA	0x008
@@ -330,6 +331,7 @@ struct renesas_usb3 {
 
 	struct usb_gadget gadget;
 	struct usb_gadget_driver *driver;
+	struct usb_role_switch *role_sw;	/* Optional */
 	struct extcon_dev *extcon;
 	struct work_struct extcon_work;
 	struct phy *phy;
@@ -454,7 +456,11 @@ static void usb3_disable_pipe_irq(struct renesas_usb3 *usb3, int num)
 
 static bool usb3_is_host(struct renesas_usb3 *usb3)
 {
-	return !(usb3_read(usb3, USB3_DRD_CON) & DRD_CON_PERI_CON);
+	if (usb3->role_sw)
+		return usb_role_switch_get_role(usb3->role_sw) ==
+						USB_ROLE_HOST ? true : false;
+	else
+		return !(usb3_read(usb3, USB3_DRD_CON) & DRD_CON_PERI_CON);
 }
 
 static void usb3_init_axi_bridge(struct renesas_usb3 *usb3)
@@ -645,10 +651,16 @@ static void usb3_check_vbus(struct renesas_usb3 *usb3)
 
 static void usb3_set_mode(struct renesas_usb3 *usb3, bool host)
 {
-	if (host)
-		usb3_clear_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON);
-	else
-		usb3_set_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON);
+	if (usb3->role_sw) {
+		enum usb_role role = host ? USB_ROLE_HOST : USB_ROLE_DEVICE;
+
+		usb_role_switch_set_role(usb3->role_sw, role);
+	} else {
+		if (host)
+			usb3_clear_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON);
+		else
+			usb3_set_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON);
+	}
 }
 
 static void usb3_vbus_out(struct renesas_usb3 *usb3, bool enable)
@@ -663,8 +675,8 @@ static void usb3_mode_config(struct renesas_usb3 *usb3, bool host, bool a_dev)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&usb3->lock, flags);
 	usb3_set_mode(usb3, host);
+	spin_lock_irqsave(&usb3->lock, flags);
 	usb3_vbus_out(usb3, a_dev);
 	/* for A-Peripheral or forced B-device mode */
 	if ((!host && a_dev) ||
@@ -2238,6 +2250,10 @@ static int renesas_usb3_start(struct usb_gadget *gadget,
 	/* hook up the driver */
 	usb3->driver = driver;
 
+	usb3->role_sw = usb_role_switch_get(usb3_to_dev(usb3));
+	if (IS_ERR_OR_NULL(usb3->role_sw))
+		usb3->role_sw = NULL;
+
 	if (usb3->phy)
 		phy_init(usb3->phy);
 
@@ -2260,6 +2276,8 @@ static int renesas_usb3_stop(struct usb_gadget *gadget)
 	if (usb3->phy)
 		phy_exit(usb3->phy);
 
+	usb_role_switch_put(usb3->role_sw);
+
 	pm_runtime_put(usb3_to_dev(usb3));
 
 	return 0;
@@ -2632,6 +2650,10 @@ static int renesas_usb3_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto err_add_udc;
 
+	ret = devm_of_platform_populate(&pdev->dev);
+	if (ret < 0)
+		goto err_dev_create;
+
 	ret = device_create_file(&pdev->dev, &dev_attr_role);
 	if (ret < 0)
 		goto err_dev_create;
-- 
1.9.1

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

* [PATCH/RFC,09/11] usb: gadget: udc: renesas_usb3: add support for a usb role switch
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds support for a usb role switch driver. And then,
this driver uses the usb role switch APIs instead of hardware
access to initialize usb host side at specific timings.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/gadget/udc/Kconfig        |  1 +
 drivers/usb/gadget/udc/renesas_usb3.c | 34 ++++++++++++++++++++++++++++------
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 0875d38..7e4a5dd 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -193,6 +193,7 @@ config USB_RENESAS_USB3
 	tristate 'Renesas USB3.0 Peripheral controller'
 	depends on ARCH_RENESAS || COMPILE_TEST
 	depends on EXTCON && HAS_DMA
+	select USB_ROLE_SWITCH
 	help
 	   Renesas USB3.0 Peripheral controller is a USB peripheral controller
 	   that supports super, high, and full speed USB 3.0 data transfers.
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 409cde4..38dd759 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -23,6 +23,7 @@
 #include <linux/uaccess.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
+#include <linux/usb/role.h>
 
 /* register definitions */
 #define USB3_AXI_INT_STA	0x008
@@ -330,6 +331,7 @@ struct renesas_usb3 {
 
 	struct usb_gadget gadget;
 	struct usb_gadget_driver *driver;
+	struct usb_role_switch *role_sw;	/* Optional */
 	struct extcon_dev *extcon;
 	struct work_struct extcon_work;
 	struct phy *phy;
@@ -454,7 +456,11 @@ static void usb3_disable_pipe_irq(struct renesas_usb3 *usb3, int num)
 
 static bool usb3_is_host(struct renesas_usb3 *usb3)
 {
-	return !(usb3_read(usb3, USB3_DRD_CON) & DRD_CON_PERI_CON);
+	if (usb3->role_sw)
+		return usb_role_switch_get_role(usb3->role_sw) ==
+						USB_ROLE_HOST ? true : false;
+	else
+		return !(usb3_read(usb3, USB3_DRD_CON) & DRD_CON_PERI_CON);
 }
 
 static void usb3_init_axi_bridge(struct renesas_usb3 *usb3)
@@ -645,10 +651,16 @@ static void usb3_check_vbus(struct renesas_usb3 *usb3)
 
 static void usb3_set_mode(struct renesas_usb3 *usb3, bool host)
 {
-	if (host)
-		usb3_clear_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON);
-	else
-		usb3_set_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON);
+	if (usb3->role_sw) {
+		enum usb_role role = host ? USB_ROLE_HOST : USB_ROLE_DEVICE;
+
+		usb_role_switch_set_role(usb3->role_sw, role);
+	} else {
+		if (host)
+			usb3_clear_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON);
+		else
+			usb3_set_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON);
+	}
 }
 
 static void usb3_vbus_out(struct renesas_usb3 *usb3, bool enable)
@@ -663,8 +675,8 @@ static void usb3_mode_config(struct renesas_usb3 *usb3, bool host, bool a_dev)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&usb3->lock, flags);
 	usb3_set_mode(usb3, host);
+	spin_lock_irqsave(&usb3->lock, flags);
 	usb3_vbus_out(usb3, a_dev);
 	/* for A-Peripheral or forced B-device mode */
 	if ((!host && a_dev) ||
@@ -2238,6 +2250,10 @@ static int renesas_usb3_start(struct usb_gadget *gadget,
 	/* hook up the driver */
 	usb3->driver = driver;
 
+	usb3->role_sw = usb_role_switch_get(usb3_to_dev(usb3));
+	if (IS_ERR_OR_NULL(usb3->role_sw))
+		usb3->role_sw = NULL;
+
 	if (usb3->phy)
 		phy_init(usb3->phy);
 
@@ -2260,6 +2276,8 @@ static int renesas_usb3_stop(struct usb_gadget *gadget)
 	if (usb3->phy)
 		phy_exit(usb3->phy);
 
+	usb_role_switch_put(usb3->role_sw);
+
 	pm_runtime_put(usb3_to_dev(usb3));
 
 	return 0;
@@ -2632,6 +2650,10 @@ static int renesas_usb3_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto err_add_udc;
 
+	ret = devm_of_platform_populate(&pdev->dev);
+	if (ret < 0)
+		goto err_dev_create;
+
 	ret = device_create_file(&pdev->dev, &dev_attr_role);
 	if (ret < 0)
 		goto err_dev_create;

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

* [PATCH/RFC 10/11] arm64: dts: renesas: r8a7795: add OF graph for usb role switch
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds OF graph properties for usb role switch in r8a7795.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 44 ++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index 1d5e3ac..61c1fa0 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1746,6 +1746,12 @@
 			power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
 			resets = <&cpg 328>;
 			status = "disabled";
+
+			port {
+				usb3_host_ep0: endpoint {
+					remote-endpoint = <&usb3_host_ep0>;
+				};
+			};
 		};
 
 		usb3_peri0: usb@ee020000 {
@@ -1757,6 +1763,44 @@
 			power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
 			resets = <&cpg 328>;
 			status = "disabled";
+
+			port {
+				usb3_peri_ep0: endpoint {
+					remote-endpoint = <&usb3_peri_sw0>;
+				};
+			};
+
+			usb3_role_sw0: usb3-role-sw {
+				compatible = "renesas,rcar-usb3-role-switch";
+				renesas,host = <&xhci0>;
+
+				ports {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					port@1 {
+						reg = <1>;
+
+						usb3_host_sw0: endpoint {
+							remote-endpoint = <&usb3_host_ep0>;
+						};
+					};
+
+					port@2 {
+						reg = <2>;
+						usb3_peri_sw0: endpoint {
+							remote-endpoint = <&usb3_peri_ep0>;
+							device-connection-id = "usb-role-switch";
+						};
+					};
+
+					port@3 {
+						reg = <3>;
+						usb3_role_sw0_ep: endpoint {
+						};
+					};
+				};
+			};
 		};
 
 		usb_dmac0: dma-controller@e65a0000 {
-- 
1.9.1

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

* [PATCH/RFC,10/11] arm64: dts: renesas: r8a7795: add OF graph for usb role switch
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds OF graph properties for usb role switch in r8a7795.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 44 ++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index 1d5e3ac..61c1fa0 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1746,6 +1746,12 @@
 			power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
 			resets = <&cpg 328>;
 			status = "disabled";
+
+			port {
+				usb3_host_ep0: endpoint {
+					remote-endpoint = <&usb3_host_ep0>;
+				};
+			};
 		};
 
 		usb3_peri0: usb@ee020000 {
@@ -1757,6 +1763,44 @@
 			power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
 			resets = <&cpg 328>;
 			status = "disabled";
+
+			port {
+				usb3_peri_ep0: endpoint {
+					remote-endpoint = <&usb3_peri_sw0>;
+				};
+			};
+
+			usb3_role_sw0: usb3-role-sw {
+				compatible = "renesas,rcar-usb3-role-switch";
+				renesas,host = <&xhci0>;
+
+				ports {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					port@1 {
+						reg = <1>;
+
+						usb3_host_sw0: endpoint {
+							remote-endpoint = <&usb3_host_ep0>;
+						};
+					};
+
+					port@2 {
+						reg = <2>;
+						usb3_peri_sw0: endpoint {
+							remote-endpoint = <&usb3_peri_ep0>;
+							device-connection-id = "usb-role-switch";
+						};
+					};
+
+					port@3 {
+						reg = <3>;
+						usb3_role_sw0_ep: endpoint {
+						};
+					};
+				};
+			};
 		};
 
 		usb_dmac0: dma-controller@e65a0000 {

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

* [PATCH/RFC 11/11] arm64: dts: renesas: r8a7795: salvator-xs: add OF graph for usb role switch
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds OF graph properties for usb role switch.

TODO:
 - Each node should be in salvator-common.dtsi.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 .../arm64/boot/dts/renesas/r8a7795-salvator-xs.dts | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
index 8b50ceb..c815fca 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
@@ -36,6 +36,24 @@
 		device_type = "memory";
 		reg = <0x7 0x00000000 0x0 0x40000000>;
 	};
+
+	/* TODO: should be into salvator-common.dtsi */
+	usb3 {
+		compatible = "usb-a-connector";
+		label = "USB3_0";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@1 {
+				reg = <1>;
+				usb3_connector0: endpoint {
+					remote-endpoint = <&usb3_role_sw0_ep>;
+				};
+			};
+		};
+	};
 };
 
 &du {
@@ -107,3 +125,13 @@
 
 	status = "okay";
 };
+
+	&usb3_role_sw0 {
+		ports {
+			port@3 {
+				usb3_role_sw0_ep: endpoint {
+					remote-endpoint = <&usb3_connector0>;
+				};
+			};
+		};
+	};
-- 
1.9.1

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

* [PATCH/RFC,11/11] arm64: dts: renesas: r8a7795: salvator-xs: add OF graph for usb role switch
@ 2018-04-18  8:10   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-18  8:10 UTC (permalink / raw)
  To: gregkh, robh+dt, mark.rutland, frowand.list
  Cc: heikki.krogerus, hdegoede, andy.shevchenko, p.zabel, linux-usb,
	linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch adds OF graph properties for usb role switch.

TODO:
 - Each node should be in salvator-common.dtsi.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 .../arm64/boot/dts/renesas/r8a7795-salvator-xs.dts | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
index 8b50ceb..c815fca 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
@@ -36,6 +36,24 @@
 		device_type = "memory";
 		reg = <0x7 0x00000000 0x0 0x40000000>;
 	};
+
+	/* TODO: should be into salvator-common.dtsi */
+	usb3 {
+		compatible = "usb-a-connector";
+		label = "USB3_0";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@1 {
+				reg = <1>;
+				usb3_connector0: endpoint {
+					remote-endpoint = <&usb3_role_sw0_ep>;
+				};
+			};
+		};
+	};
 };
 
 &du {
@@ -107,3 +125,13 @@
 
 	status = "okay";
 };
+
+	&usb3_role_sw0 {
+		ports {
+			port@3 {
+				usb3_role_sw0_ep: endpoint {
+					remote-endpoint = <&usb3_connector0>;
+				};
+			};
+		};
+	};

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

* Re: [PATCH/RFC 08/11] usb: role: rcar-usb3-role-switch: add support for R-Car SoCs
@ 2018-04-18  8:47     ` Geert Uytterhoeven
  0 siblings, 0 replies; 35+ messages in thread
From: Geert Uytterhoeven @ 2018-04-18  8:47 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: Greg KH, Rob Herring, Mark Rutland, Frank Rowand,
	Heikki Krogerus, Hans de Goede, Andy Shevchenko, Philipp Zabel,
	USB list, Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi Shimoda-san,

On Wed, Apr 18, 2018 at 10:10 AM, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> This patch adds role switch support for R-Car SoCs. Some R-Car SoCs
> (e.g. R-Car H3) have USB 3.0 dual-role device controller which has
> the USB 3.0 xHCI host and Renesas USB 3.0 peripheral.
>
> Unfortunately, the mode change register contains the USB 3.0 peripheral
> controller side only. So, the USB 3.0 peripheral driver (renesas_usb3)
> manages this register. However, in peripheral mode, the host should
> stop. Also the host hardware needs to reinitialize its own registers
> when the mode changes from peripheral to host mode. Otherwise,
> the host cannot work correctly (e.g. detect a device as high-speed).
>
> To achieve this by a driver, this role switch driver manages
> the mode change register and attach/release the xhci-plat driver.
> The renesas_usb3 udc driver should call devm_of_platform_populate()
> to probe this driver.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Thanks for your patch!

> --- a/drivers/usb/roles/Kconfig
> +++ b/drivers/usb/roles/Kconfig
> @@ -11,4 +11,16 @@ config USB_ROLES_INTEL_XHCI
>           To compile the driver as a module, choose M here: the module will
>           be called intel-xhci-usb-role-switch.
>
> +config USB_ROLES_RCAR_USB3
> +       tristate "Renesas R-Car USB3.0 Role Switch"
> +       depends on ARCH_RENESAS && OF

ARCH_RENESAS implies OF.

Perhaps you intended:

        depends on OF
        depends on ARCH_RENESAS || COMPILE_TEST

?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH/RFC,08/11] usb: role: rcar-usb3-role-switch: add support for R-Car SoCs
@ 2018-04-18  8:47     ` Geert Uytterhoeven
  0 siblings, 0 replies; 35+ messages in thread
From: Geert Uytterhoeven @ 2018-04-18  8:47 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: Greg KH, Rob Herring, Mark Rutland, Frank Rowand,
	Heikki Krogerus, Hans de Goede, Andy Shevchenko, Philipp Zabel,
	USB list, Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi Shimoda-san,

On Wed, Apr 18, 2018 at 10:10 AM, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> This patch adds role switch support for R-Car SoCs. Some R-Car SoCs
> (e.g. R-Car H3) have USB 3.0 dual-role device controller which has
> the USB 3.0 xHCI host and Renesas USB 3.0 peripheral.
>
> Unfortunately, the mode change register contains the USB 3.0 peripheral
> controller side only. So, the USB 3.0 peripheral driver (renesas_usb3)
> manages this register. However, in peripheral mode, the host should
> stop. Also the host hardware needs to reinitialize its own registers
> when the mode changes from peripheral to host mode. Otherwise,
> the host cannot work correctly (e.g. detect a device as high-speed).
>
> To achieve this by a driver, this role switch driver manages
> the mode change register and attach/release the xhci-plat driver.
> The renesas_usb3 udc driver should call devm_of_platform_populate()
> to probe this driver.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Thanks for your patch!

> --- a/drivers/usb/roles/Kconfig
> +++ b/drivers/usb/roles/Kconfig
> @@ -11,4 +11,16 @@ config USB_ROLES_INTEL_XHCI
>           To compile the driver as a module, choose M here: the module will
>           be called intel-xhci-usb-role-switch.
>
> +config USB_ROLES_RCAR_USB3
> +       tristate "Renesas R-Car USB3.0 Role Switch"
> +       depends on ARCH_RENESAS && OF

ARCH_RENESAS implies OF.

Perhaps you intended:

        depends on OF
        depends on ARCH_RENESAS || COMPILE_TEST

?

Gr{oetje,eeting}s,

                        Geert

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

* Re: [PATCH/RFC 04/11] of: platform: add device connection parsing
@ 2018-04-24 12:33     ` Heikki Krogerus
  0 siblings, 0 replies; 35+ messages in thread
From: Heikki Krogerus @ 2018-04-24 12:33 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: gregkh, robh+dt, mark.rutland, frowand.list, hdegoede,
	andy.shevchenko, p.zabel, linux-usb, linux-renesas-soc,
	devicetree

Hi Yoshihiro,

On Wed, Apr 18, 2018 at 05:09:58PM +0900, Yoshihiro Shimoda wrote:
> This patch adds device connection parsing in of_platform_populate().
> 
> TODO:
>  - How to free the devcon memories?
>  - How to remove the devcon instances?
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  drivers/of/platform.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/of.h    |  1 +
>  2 files changed, 67 insertions(+)
> 
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index c00d81d..41c018d 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -17,6 +17,7 @@
>  #include <linux/slab.h>
>  #include <linux/of_address.h>
>  #include <linux/of_device.h>
> +#include <linux/of_graph.h>
>  #include <linux/of_iommu.h>
>  #include <linux/of_irq.h>
>  #include <linux/of_platform.h>
> @@ -326,6 +327,63 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
>  	return NULL;
>  }
>  
> +static int of_parse_device_connection(struct device_node *np)
> +{
> +	struct device_node *child_ep, *parent, *remote_parent;
> +	struct platform_device *pdev, *remote_pdev;
> +	struct device_connection *devcon = NULL;
> +	const char *id;
> +
> +	if (of_node_check_flag(np, OF_DEVICE_CONNECTED)) {
> +		pr_debug("%s() - skipping %pOF, already device connected\n",
> +			__func__, np);
> +		return 0;
> +	}
> +
> +	of_node_set_flag(np, OF_DEVICE_CONNECTED);
> +
> +	for_each_endpoint_of_node(np, child_ep) {
> +		if (of_property_read_string(child_ep, "device-connection-id",
> +					    &id) < 0)
> +			continue;
> +
> +		remote_parent = of_graph_get_remote_port_parent(child_ep);
> +		if (!remote_parent)
> +			return 0;
> +
> +		parent = of_graph_get_port_parent(child_ep);
> +		if (!parent)
> +			return 0;
> +
> +		pdev = of_find_device_by_node(parent);
> +		if (!pdev)
> +			return 0;
> +
> +		/*
> +		 * WARN_ON in really_probe() may happen if devm_kzalloc is
> +		 * used. TODO: How to free this?
> +		 */
> +		devcon = kzalloc(sizeof(*devcon), GFP_KERNEL);
> +		if (!devcon)
> +			return -ENOMEM;
> +
> +		devcon->id = id;
> +		remote_pdev = of_find_device_by_node(remote_parent);
> +		if (!remote_pdev) {
> +			kfree(devcon);
> +			return 0;
> +		}
> +
> +		devcon->endpoint[0] = dev_name(&pdev->dev);
> +		devcon->endpoint[1] = dev_name(&remote_pdev->dev);
> +
> +		/* TODO: How to remove the connection? */
> +		device_connection_add(devcon);

This is wrong. You are converting a connection that is described in
graph into a "build-in" one. If the connection is already described in
graph there is no need to, actually, we _should not_, add it to the
list of "build-in" connection descriptions.

What should be done is that we parse the graph the moment
device_connection_find*() is called. And that should be done in
drivers/base/devcon.c .

> +	}
> +
> +	return 0;
> +}
> +
>  /**
>   * of_platform_bus_create() - Create a device for a node and its children.
>   * @bus: device node of the bus to instantiate
> @@ -477,6 +535,14 @@ int of_platform_populate(struct device_node *root,
>  	}
>  	of_node_set_flag(root, OF_POPULATED_BUS);
>  
> +	for_each_child_of_node(root, child) {
> +		rc = of_parse_device_connection(child);
> +		if (rc) {
> +			of_node_put(child);
> +			break;
> +		}
> +	}
> +
>  	of_node_put(root);
>  	return rc;
>  }
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 4d25e4f..30aa103 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -143,6 +143,7 @@ static inline void of_node_put(struct device_node *node) { }
>  #define OF_DETACHED	2 /* node has been detached from the device tree */
>  #define OF_POPULATED	3 /* device already created for the node */
>  #define OF_POPULATED_BUS	4 /* of_platform_populate recursed to children of this node */
> +#define OF_DEVICE_CONNECTED	5 /* checked devcon on of_platform_populate */
>  
>  #define OF_BAD_ADDR	((u64)-1)


Thanks,

-- 
heikki

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

* [PATCH/RFC,04/11] of: platform: add device connection parsing
@ 2018-04-24 12:33     ` Heikki Krogerus
  0 siblings, 0 replies; 35+ messages in thread
From: Heikki Krogerus @ 2018-04-24 12:33 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: gregkh, robh+dt, mark.rutland, frowand.list, hdegoede,
	andy.shevchenko, p.zabel, linux-usb, linux-renesas-soc,
	devicetree

Hi Yoshihiro,

On Wed, Apr 18, 2018 at 05:09:58PM +0900, Yoshihiro Shimoda wrote:
> This patch adds device connection parsing in of_platform_populate().
> 
> TODO:
>  - How to free the devcon memories?
>  - How to remove the devcon instances?
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  drivers/of/platform.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/of.h    |  1 +
>  2 files changed, 67 insertions(+)
> 
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index c00d81d..41c018d 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -17,6 +17,7 @@
>  #include <linux/slab.h>
>  #include <linux/of_address.h>
>  #include <linux/of_device.h>
> +#include <linux/of_graph.h>
>  #include <linux/of_iommu.h>
>  #include <linux/of_irq.h>
>  #include <linux/of_platform.h>
> @@ -326,6 +327,63 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
>  	return NULL;
>  }
>  
> +static int of_parse_device_connection(struct device_node *np)
> +{
> +	struct device_node *child_ep, *parent, *remote_parent;
> +	struct platform_device *pdev, *remote_pdev;
> +	struct device_connection *devcon = NULL;
> +	const char *id;
> +
> +	if (of_node_check_flag(np, OF_DEVICE_CONNECTED)) {
> +		pr_debug("%s() - skipping %pOF, already device connected\n",
> +			__func__, np);
> +		return 0;
> +	}
> +
> +	of_node_set_flag(np, OF_DEVICE_CONNECTED);
> +
> +	for_each_endpoint_of_node(np, child_ep) {
> +		if (of_property_read_string(child_ep, "device-connection-id",
> +					    &id) < 0)
> +			continue;
> +
> +		remote_parent = of_graph_get_remote_port_parent(child_ep);
> +		if (!remote_parent)
> +			return 0;
> +
> +		parent = of_graph_get_port_parent(child_ep);
> +		if (!parent)
> +			return 0;
> +
> +		pdev = of_find_device_by_node(parent);
> +		if (!pdev)
> +			return 0;
> +
> +		/*
> +		 * WARN_ON in really_probe() may happen if devm_kzalloc is
> +		 * used. TODO: How to free this?
> +		 */
> +		devcon = kzalloc(sizeof(*devcon), GFP_KERNEL);
> +		if (!devcon)
> +			return -ENOMEM;
> +
> +		devcon->id = id;
> +		remote_pdev = of_find_device_by_node(remote_parent);
> +		if (!remote_pdev) {
> +			kfree(devcon);
> +			return 0;
> +		}
> +
> +		devcon->endpoint[0] = dev_name(&pdev->dev);
> +		devcon->endpoint[1] = dev_name(&remote_pdev->dev);
> +
> +		/* TODO: How to remove the connection? */
> +		device_connection_add(devcon);

This is wrong. You are converting a connection that is described in
graph into a "build-in" one. If the connection is already described in
graph there is no need to, actually, we _should not_, add it to the
list of "build-in" connection descriptions.

What should be done is that we parse the graph the moment
device_connection_find*() is called. And that should be done in
drivers/base/devcon.c .

> +	}
> +
> +	return 0;
> +}
> +
>  /**
>   * of_platform_bus_create() - Create a device for a node and its children.
>   * @bus: device node of the bus to instantiate
> @@ -477,6 +535,14 @@ int of_platform_populate(struct device_node *root,
>  	}
>  	of_node_set_flag(root, OF_POPULATED_BUS);
>  
> +	for_each_child_of_node(root, child) {
> +		rc = of_parse_device_connection(child);
> +		if (rc) {
> +			of_node_put(child);
> +			break;
> +		}
> +	}
> +
>  	of_node_put(root);
>  	return rc;
>  }
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 4d25e4f..30aa103 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -143,6 +143,7 @@ static inline void of_node_put(struct device_node *node) { }
>  #define OF_DETACHED	2 /* node has been detached from the device tree */
>  #define OF_POPULATED	3 /* device already created for the node */
>  #define OF_POPULATED_BUS	4 /* of_platform_populate recursed to children of this node */
> +#define OF_DEVICE_CONNECTED	5 /* checked devcon on of_platform_populate */
>  
>  #define OF_BAD_ADDR	((u64)-1)


Thanks,

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

* Re: [PATCH/RFC 01/11] Documentation: of: Add device-connection-id property
@ 2018-04-24 14:33     ` Rob Herring
  0 siblings, 0 replies; 35+ messages in thread
From: Rob Herring @ 2018-04-24 14:33 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: gregkh, mark.rutland, frowand.list, heikki.krogerus, hdegoede,
	andy.shevchenko, p.zabel, linux-usb, linux-renesas-soc,
	devicetree

On Wed, Apr 18, 2018 at 05:09:55PM +0900, Yoshihiro Shimoda wrote:
> This patch adds a new property for device connection framework.

What's the "device connection framework" and what does it have to do 
with DT?

> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  Documentation/devicetree/bindings/graph.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/graph.txt b/Documentation/devicetree/bindings/graph.txt
> index 0415e2c..fca0030 100644
> --- a/Documentation/devicetree/bindings/graph.txt
> +++ b/Documentation/devicetree/bindings/graph.txt
> @@ -125,4 +125,4 @@ Optional endpoint properties
>  ----------------------------
>  
>  - remote-endpoint: phandle to an 'endpoint' subnode of a remote device node.
> -
> +- device-connection-id: string for device connection.

Why do we need this?

> -- 
> 1.9.1
> 

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

* [PATCH/RFC,01/11] Documentation: of: Add device-connection-id property
@ 2018-04-24 14:33     ` Rob Herring
  0 siblings, 0 replies; 35+ messages in thread
From: Rob Herring @ 2018-04-24 14:33 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: gregkh, mark.rutland, frowand.list, heikki.krogerus, hdegoede,
	andy.shevchenko, p.zabel, linux-usb, linux-renesas-soc,
	devicetree

On Wed, Apr 18, 2018 at 05:09:55PM +0900, Yoshihiro Shimoda wrote:
> This patch adds a new property for device connection framework.

What's the "device connection framework" and what does it have to do 
with DT?

> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  Documentation/devicetree/bindings/graph.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/graph.txt b/Documentation/devicetree/bindings/graph.txt
> index 0415e2c..fca0030 100644
> --- a/Documentation/devicetree/bindings/graph.txt
> +++ b/Documentation/devicetree/bindings/graph.txt
> @@ -125,4 +125,4 @@ Optional endpoint properties
>  ----------------------------
>  
>  - remote-endpoint: phandle to an 'endpoint' subnode of a remote device node.
> -
> +- device-connection-id: string for device connection.

Why do we need this?

> -- 
> 1.9.1
>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH/RFC 02/11] dt-bindings: usb: add usb role switch driver
@ 2018-04-24 14:35     ` Rob Herring
  0 siblings, 0 replies; 35+ messages in thread
From: Rob Herring @ 2018-04-24 14:35 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: gregkh, mark.rutland, frowand.list, heikki.krogerus, hdegoede,
	andy.shevchenko, p.zabel, linux-usb, linux-renesas-soc,
	devicetree

On Wed, Apr 18, 2018 at 05:09:56PM +0900, Yoshihiro Shimoda wrote:
> This patch adds a new documentation for a usb role switch driver.
> The usb role switch framework will parse this to get each device
> pointer by using each remote-endpoint.

Bindings describe h/w, not drivers. This doesn't look like a h/w device.

> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  .../devicetree/bindings/usb/usb-role-switch.txt    | 42 ++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/usb-role-switch.txt
> 
> diff --git a/Documentation/devicetree/bindings/usb/usb-role-switch.txt b/Documentation/devicetree/bindings/usb/usb-role-switch.txt
> new file mode 100644
> index 0000000..941d582
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/usb-role-switch.txt
> @@ -0,0 +1,42 @@
> +USB role switch driver
> +
> +Optional nodes:
> +- If a role switch driver has OF graph ports, the usb role switch framework
> +  will parse the remote-endpoints in usb_role_switch_register(). The OF graph
> +  port number as follows:
> +    0: USB 2.0 host port
> +    1: USB 3.0 host port
> +    2: UDC port
> +
> +For example:
> +	usb-role-sw {
> +
> +		ports {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			port@0 {
> +				reg = <0>;
> +
> +				usb2_host_sw0: endpoint {
> +					remote-endpoint = <&usb2_host_ep0>;
> +				};
> +			};
> +
> +			port@1 {
> +				reg = <1>;
> +
> +				usb3_host_sw0: endpoint {
> +					remote-endpoint = <&usb3_host_ep0>;
> +				};
> +			};
> +
> +			port@2 {
> +				reg = <2>;
> +
> +				udc_sw0: endpoint {
> +					remote-endpoint = <&udc_ep0>;
> +				};
> +			};
> +		};
> +	};
> -- 
> 1.9.1
> 

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

* [PATCH/RFC,02/11] dt-bindings: usb: add usb role switch driver
@ 2018-04-24 14:35     ` Rob Herring
  0 siblings, 0 replies; 35+ messages in thread
From: Rob Herring @ 2018-04-24 14:35 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: gregkh, mark.rutland, frowand.list, heikki.krogerus, hdegoede,
	andy.shevchenko, p.zabel, linux-usb, linux-renesas-soc,
	devicetree

On Wed, Apr 18, 2018 at 05:09:56PM +0900, Yoshihiro Shimoda wrote:
> This patch adds a new documentation for a usb role switch driver.
> The usb role switch framework will parse this to get each device
> pointer by using each remote-endpoint.

Bindings describe h/w, not drivers. This doesn't look like a h/w device.

> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  .../devicetree/bindings/usb/usb-role-switch.txt    | 42 ++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/usb-role-switch.txt
> 
> diff --git a/Documentation/devicetree/bindings/usb/usb-role-switch.txt b/Documentation/devicetree/bindings/usb/usb-role-switch.txt
> new file mode 100644
> index 0000000..941d582
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/usb-role-switch.txt
> @@ -0,0 +1,42 @@
> +USB role switch driver
> +
> +Optional nodes:
> +- If a role switch driver has OF graph ports, the usb role switch framework
> +  will parse the remote-endpoints in usb_role_switch_register(). The OF graph
> +  port number as follows:
> +    0: USB 2.0 host port
> +    1: USB 3.0 host port
> +    2: UDC port
> +
> +For example:
> +	usb-role-sw {
> +
> +		ports {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			port@0 {
> +				reg = <0>;
> +
> +				usb2_host_sw0: endpoint {
> +					remote-endpoint = <&usb2_host_ep0>;
> +				};
> +			};
> +
> +			port@1 {
> +				reg = <1>;
> +
> +				usb3_host_sw0: endpoint {
> +					remote-endpoint = <&usb3_host_ep0>;
> +				};
> +			};
> +
> +			port@2 {
> +				reg = <2>;
> +
> +				udc_sw0: endpoint {
> +					remote-endpoint = <&udc_ep0>;
> +				};
> +			};
> +		};
> +	};
> -- 
> 1.9.1
>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH/RFC 04/11] of: platform: add device connection parsing
@ 2018-04-25  8:59       ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-25  8:59 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: gregkh, robh+dt, mark.rutland, frowand.list, hdegoede,
	andy.shevchenko, p.zabel, linux-usb, linux-renesas-soc,
	devicetree

Hi Heikki,

> From: Heikki Krogerus, Sent: Tuesday, April 24, 2018 9:34 PM
> 
> Hi Yoshihiro,
> 
> On Wed, Apr 18, 2018 at 05:09:58PM +0900, Yoshihiro Shimoda wrote:
<snip>
> > +		devcon->endpoint[0] = dev_name(&pdev->dev);
> > +		devcon->endpoint[1] = dev_name(&remote_pdev->dev);
> > +
> > +		/* TODO: How to remove the connection? */
> > +		device_connection_add(devcon);
> 
> This is wrong. You are converting a connection that is described in
> graph into a "build-in" one. If the connection is already described in
> graph there is no need to, actually, we _should not_, add it to the
> list of "build-in" connection descriptions.
> 
> What should be done is that we parse the graph the moment
> device_connection_find*() is called. And that should be done in
> drivers/base/devcon.c .

Thank you for the comments! I completely misunderstood which framework I should improve.
I'll try to improve the devcon.
However, I'll have a vacation in next week. So, I think I can submit next version in early May.

Best regards,
Yoshihiro Shimoda

> > +	}
> > +
> > +	return 0;
> > +}
> > +
> >  /**
> >   * of_platform_bus_create() - Create a device for a node and its children.
> >   * @bus: device node of the bus to instantiate
> > @@ -477,6 +535,14 @@ int of_platform_populate(struct device_node *root,
> >  	}
> >  	of_node_set_flag(root, OF_POPULATED_BUS);
> >
> > +	for_each_child_of_node(root, child) {
> > +		rc = of_parse_device_connection(child);
> > +		if (rc) {
> > +			of_node_put(child);
> > +			break;
> > +		}
> > +	}
> > +
> >  	of_node_put(root);
> >  	return rc;
> >  }
> > diff --git a/include/linux/of.h b/include/linux/of.h
> > index 4d25e4f..30aa103 100644
> > --- a/include/linux/of.h
> > +++ b/include/linux/of.h
> > @@ -143,6 +143,7 @@ static inline void of_node_put(struct device_node *node) { }
> >  #define OF_DETACHED	2 /* node has been detached from the device tree */
> >  #define OF_POPULATED	3 /* device already created for the node */
> >  #define OF_POPULATED_BUS	4 /* of_platform_populate recursed to children of this node */
> > +#define OF_DEVICE_CONNECTED	5 /* checked devcon on of_platform_populate */
> >
> >  #define OF_BAD_ADDR	((u64)-1)
> 
> 
> Thanks,
> 
> --
> heikki

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

* [PATCH/RFC,04/11] of: platform: add device connection parsing
@ 2018-04-25  8:59       ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-25  8:59 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: gregkh, robh+dt, mark.rutland, frowand.list, hdegoede,
	andy.shevchenko, p.zabel, linux-usb, linux-renesas-soc,
	devicetree

Hi Heikki,

> From: Heikki Krogerus, Sent: Tuesday, April 24, 2018 9:34 PM
> 
> Hi Yoshihiro,
> 
> On Wed, Apr 18, 2018 at 05:09:58PM +0900, Yoshihiro Shimoda wrote:
<snip>
> > +		devcon->endpoint[0] = dev_name(&pdev->dev);
> > +		devcon->endpoint[1] = dev_name(&remote_pdev->dev);
> > +
> > +		/* TODO: How to remove the connection? */
> > +		device_connection_add(devcon);
> 
> This is wrong. You are converting a connection that is described in
> graph into a "build-in" one. If the connection is already described in
> graph there is no need to, actually, we _should not_, add it to the
> list of "build-in" connection descriptions.
> 
> What should be done is that we parse the graph the moment
> device_connection_find*() is called. And that should be done in
> drivers/base/devcon.c .

Thank you for the comments! I completely misunderstood which framework I should improve.
I'll try to improve the devcon.
However, I'll have a vacation in next week. So, I think I can submit next version in early May.

Best regards,
Yoshihiro Shimoda

> > +	}
> > +
> > +	return 0;
> > +}
> > +
> >  /**
> >   * of_platform_bus_create() - Create a device for a node and its children.
> >   * @bus: device node of the bus to instantiate
> > @@ -477,6 +535,14 @@ int of_platform_populate(struct device_node *root,
> >  	}
> >  	of_node_set_flag(root, OF_POPULATED_BUS);
> >
> > +	for_each_child_of_node(root, child) {
> > +		rc = of_parse_device_connection(child);
> > +		if (rc) {
> > +			of_node_put(child);
> > +			break;
> > +		}
> > +	}
> > +
> >  	of_node_put(root);
> >  	return rc;
> >  }
> > diff --git a/include/linux/of.h b/include/linux/of.h
> > index 4d25e4f..30aa103 100644
> > --- a/include/linux/of.h
> > +++ b/include/linux/of.h
> > @@ -143,6 +143,7 @@ static inline void of_node_put(struct device_node *node) { }
> >  #define OF_DETACHED	2 /* node has been detached from the device tree */
> >  #define OF_POPULATED	3 /* device already created for the node */
> >  #define OF_POPULATED_BUS	4 /* of_platform_populate recursed to children of this node */
> > +#define OF_DEVICE_CONNECTED	5 /* checked devcon on of_platform_populate */
> >
> >  #define OF_BAD_ADDR	((u64)-1)
> 
> 
> Thanks,
> 
> --
> heikki
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH/RFC 01/11] Documentation: of: Add device-connection-id property
@ 2018-04-25  9:09       ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-25  9:09 UTC (permalink / raw)
  To: Rob Herring
  Cc: gregkh, mark.rutland, frowand.list, heikki.krogerus, hdegoede,
	andy.shevchenko, p.zabel, linux-usb, linux-renesas-soc,
	devicetree

Hi,

> From: Rob Herring, Sent: Tuesday, April 24, 2018 11:33 PM
> 
> On Wed, Apr 18, 2018 at 05:09:55PM +0900, Yoshihiro Shimoda wrote:
> > This patch adds a new property for device connection framework.
> 
> What's the "device connection framework" and what does it have to do
> with DT?

The "device connection framework" is described in the following:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/driver-api/device_connection.rst?h=v4.17-rc2

However, according to the Heikki's comments [1], I completely misunderstood what should I do.
So, I'd like to recall this patch set.

[1]
http://www.spinics.net/lists/linux-renesas-soc/msg26869.html

Best regards,
Yoshihiro Shimoda

> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >  Documentation/devicetree/bindings/graph.txt | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/graph.txt b/Documentation/devicetree/bindings/graph.txt
> > index 0415e2c..fca0030 100644
> > --- a/Documentation/devicetree/bindings/graph.txt
> > +++ b/Documentation/devicetree/bindings/graph.txt
> > @@ -125,4 +125,4 @@ Optional endpoint properties
> >  ----------------------------
> >
> >  - remote-endpoint: phandle to an 'endpoint' subnode of a remote device node.
> > -
> > +- device-connection-id: string for device connection.
> 
> Why do we need this?
> 
> > --
> > 1.9.1
> >

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

* [PATCH/RFC,01/11] Documentation: of: Add device-connection-id property
@ 2018-04-25  9:09       ` Yoshihiro Shimoda
  0 siblings, 0 replies; 35+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-25  9:09 UTC (permalink / raw)
  To: Rob Herring
  Cc: gregkh, mark.rutland, frowand.list, heikki.krogerus, hdegoede,
	andy.shevchenko, p.zabel, linux-usb, linux-renesas-soc,
	devicetree

Hi,

> From: Rob Herring, Sent: Tuesday, April 24, 2018 11:33 PM
> 
> On Wed, Apr 18, 2018 at 05:09:55PM +0900, Yoshihiro Shimoda wrote:
> > This patch adds a new property for device connection framework.
> 
> What's the "device connection framework" and what does it have to do
> with DT?

The "device connection framework" is described in the following:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/driver-api/device_connection.rst?h=v4.17-rc2

However, according to the Heikki's comments [1], I completely misunderstood what should I do.
So, I'd like to recall this patch set.

[1]
http://www.spinics.net/lists/linux-renesas-soc/msg26869.html

Best regards,
Yoshihiro Shimoda

> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >  Documentation/devicetree/bindings/graph.txt | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/graph.txt b/Documentation/devicetree/bindings/graph.txt
> > index 0415e2c..fca0030 100644
> > --- a/Documentation/devicetree/bindings/graph.txt
> > +++ b/Documentation/devicetree/bindings/graph.txt
> > @@ -125,4 +125,4 @@ Optional endpoint properties
> >  ----------------------------
> >
> >  - remote-endpoint: phandle to an 'endpoint' subnode of a remote device node.
> > -
> > +- device-connection-id: string for device connection.
> 
> Why do we need this?
> 
> > --
> > 1.9.1
> >
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2018-04-25  9:09 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18  8:09 [PATCH/RFC 00/11] add support for R-Car USB3.0 role switch Yoshihiro Shimoda
2018-04-18  8:09 ` [PATCH/RFC 01/11] Documentation: of: Add device-connection-id property Yoshihiro Shimoda
2018-04-18  8:09   ` [PATCH/RFC,01/11] " Yoshihiro Shimoda
2018-04-24 14:33   ` [PATCH/RFC 01/11] " Rob Herring
2018-04-24 14:33     ` [PATCH/RFC,01/11] " Rob Herring
2018-04-25  9:09     ` [PATCH/RFC 01/11] " Yoshihiro Shimoda
2018-04-25  9:09       ` [PATCH/RFC,01/11] " Yoshihiro Shimoda
2018-04-18  8:09 ` [PATCH/RFC 02/11] dt-bindings: usb: add usb role switch driver Yoshihiro Shimoda
2018-04-18  8:09   ` [PATCH/RFC,02/11] " Yoshihiro Shimoda
2018-04-24 14:35   ` [PATCH/RFC 02/11] " Rob Herring
2018-04-24 14:35     ` [PATCH/RFC,02/11] " Rob Herring
2018-04-18  8:09 ` [PATCH/RFC 03/11] dt-bindings: usb: add Renesas R-Car USB 3.0 " Yoshihiro Shimoda
2018-04-18  8:09   ` [PATCH/RFC,03/11] " Yoshihiro Shimoda
2018-04-18  8:09 ` [PATCH/RFC 04/11] of: platform: add device connection parsing Yoshihiro Shimoda
2018-04-18  8:09   ` [PATCH/RFC,04/11] " Yoshihiro Shimoda
2018-04-24 12:33   ` [PATCH/RFC 04/11] " Heikki Krogerus
2018-04-24 12:33     ` [PATCH/RFC,04/11] " Heikki Krogerus
2018-04-25  8:59     ` [PATCH/RFC 04/11] " Yoshihiro Shimoda
2018-04-25  8:59       ` [PATCH/RFC,04/11] " Yoshihiro Shimoda
2018-04-18  8:09 ` [PATCH/RFC 05/11] usb: common: roles: add fwnode graph parsing Yoshihiro Shimoda
2018-04-18  8:09   ` [PATCH/RFC,05/11] " Yoshihiro Shimoda
2018-04-18  8:10 ` [PATCH/RFC 06/11] usb: common: roles: Allow if the parent dev_name matches Yoshihiro Shimoda
2018-04-18  8:10   ` [PATCH/RFC,06/11] " Yoshihiro Shimoda
2018-04-18  8:10 ` [PATCH/RFC 07/11] usb: common: roles: add getting device pointer APIs Yoshihiro Shimoda
2018-04-18  8:10   ` [PATCH/RFC,07/11] " Yoshihiro Shimoda
2018-04-18  8:10 ` [PATCH/RFC 08/11] usb: role: rcar-usb3-role-switch: add support for R-Car SoCs Yoshihiro Shimoda
2018-04-18  8:10   ` [PATCH/RFC,08/11] " Yoshihiro Shimoda
2018-04-18  8:47   ` [PATCH/RFC 08/11] " Geert Uytterhoeven
2018-04-18  8:47     ` [PATCH/RFC,08/11] " Geert Uytterhoeven
2018-04-18  8:10 ` [PATCH/RFC 09/11] usb: gadget: udc: renesas_usb3: add support for a usb role switch Yoshihiro Shimoda
2018-04-18  8:10   ` [PATCH/RFC,09/11] " Yoshihiro Shimoda
2018-04-18  8:10 ` [PATCH/RFC 10/11] arm64: dts: renesas: r8a7795: add OF graph for " Yoshihiro Shimoda
2018-04-18  8:10   ` [PATCH/RFC,10/11] " Yoshihiro Shimoda
2018-04-18  8:10 ` [PATCH/RFC 11/11] arm64: dts: renesas: r8a7795: salvator-xs: " Yoshihiro Shimoda
2018-04-18  8:10   ` [PATCH/RFC,11/11] " Yoshihiro Shimoda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.