Skip to contentSkip to conversation

dt-bindings: usb: add documentation for typec switch via GPIO

PATCH In review Jun Li 4 participants 13 messages Mar 11, 2019 – Mar 19, 2019

Subsystems (3)
lore
Share & tools
lore

Jun Li

author
#0 lore raw

PATCH v3 1/2 dt-bindings: usb: add documentation for typec switch via GPIO

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
 .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +30 -0
new file mode 100644
index 0000000..4ef76cf
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+	- "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.
+
+- gpios: the GPIO used to switch the super speed active channel,
+		GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+		GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.
+
+Required sub-node:
+- port: specify the remote endpoint of typec switch consumer.
+
+Example:
+
+ptn36043 {
+	compatible = "nxp,ptn36043";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_ss_sel>;
+	gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+	orientation-switch;
+
+	port {
+		usb3_data_ss: endpoint {
+			remote-endpoint = <&typec_con_ss>;
+		};
+	};
+};
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v3 2/2 usb: typec: add typec switch via GPIO control

This patch adds a simple typec switch driver which only needs a GPIO to switch the super speed active channel according to typec orientation.

---

Change for v3:
- Remove file name in driver description.
- Add Andy Shevchenko's Reviewed-by tag.

Changes for v2:
- Use the correct head files for gpio api and of_device_id:
#include <linux/gpio/consumer.h>
#include <linux/mod_devicetable.h>
- Add driver dependency on GPIOLIB

 drivers/usb/typec/mux/Kconfig       |   7 +++
 drivers/usb/typec/mux/Makefile      |   1 +
 drivers/usb/typec/mux/gpio-switch.c | 105 ++++++++++++++++++++++++++++++++++++
 3 files changed, 113 insertions(+)
drivers/usb/typec/mux/Kconfig +7 -0
index 01ed0d5..27120e6 100644
@@ -9,4 +9,11 @@ config TYPEC_MUX_PI3USB30532
 	  Say Y or M if your system has a Pericom PI3USB30532 Type-C cross
 	  switch / mux chip found on some devices with a Type-C port.
 
+config TYPEC_SWITCH_GPIO
+	tristate "Simple Super Speed Active Switch via GPIO"
+	depends on GPIOLIB
+	help
+	  Say Y or M if your system has a typec super speed channel
+	  switch via a simple GPIO control.
+
 endmenu
drivers/usb/typec/mux/Makefile +1 -0
index 1332e46..e29377c 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_TYPEC_MUX_PI3USB30532)	+= pi3usb30532.o
+obj-$(CONFIG_TYPEC_SWITCH_GPIO)		+= gpio-switch.o
drivers/usb/typec/mux/gpio-switch.c new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw
In reply to Jun Li

Hi,

Quoted 16 lines · Jun Li

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
  .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30 ++++++++++++++++++++++
  1 file changed, 30 insertions(+)
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +1 -0
new file mode 100644
index 0000000..4ef76cf
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 11

Quoted 10 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +10 -0
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+	- "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.
+
+- gpios: the GPIO used to switch the super speed active channel,
+		GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+		GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.

Shouldn't this have usb-c in the propery name, e.g.:
usb-c-orientation-switch ?

Quoted 6 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +6 -0
+
+Required sub-node:
+- port: specify the remote endpoint of typec switch consumer.
+
+Example:
+

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +10 -0
+ptn36043 {
+	compatible = "nxp,ptn36043";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_ss_sel>;
+	gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+	orientation-switch;
+
+	port {
+		usb3_data_ss: endpoint {
+			remote-endpoint = <&typec_con_ss>;

Isn't this the wrong way around, shouldn't the "usb-c-connector" compatible port be pointing to the orientation switch, rather then the other way around? Both will work in the end. but to me it feels more natural to group all the info about the type-c connector together in the "usb-c-connector" compatible port

Regards,

Hans

#3 lore raw

Hi,

Quoted 12 lines · Hans de Goede

Hi,

Quoted 9 lines · Jun Li

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
  .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30 ++++++++++++++++++++++

  1 file changed, 30 insertions(+)
Quoted 12 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 6

Quoted 12 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +6 -0
new file mode 100644
index 0000000..4ef76cf
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+    - "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.

Hmm, it seems that this binding should work fine with other orientation-switches as well, so I think this needs a generic compatible string.

Quoted 8 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 11

Quoted 5 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +5 -0
+
+- gpios: the GPIO used to switch the super speed active channel,
+        GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+        GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.

Shouldn't this have usb-c in the propery name, e.g.:
usb-c-orientation-switch  ?

Also perhaps it would be better to use an additional compatible string for this, rather then a boolean property, because what you are trying to say is that this device is compatible with some (to be written) generic usb-c-orientation-switch binding.

So I think you may want to use an extra compatible for this and describe the port/graph usage linking the usb-c-connector port and the port on the orientation-switch together in a new usb-c-orientation-switch binding document.

This new binding will then document the port usage which is mostly undocumented in your typec-switch-gpio.txt binding and this port usage documentation can then be re-used for other orientation-switch bindings.

Regards,

Hans

Quoted 29 lines
Quoted 7 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +6 -0
+
+Required sub-node:
+- port: specify the remote endpoint of typec switch consumer.
+
+Example:
+

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +10 -0
+ptn36043 {
+    compatible = "nxp,ptn36043";
+    pinctrl-names = "default";
+    pinctrl-0 = <&pinctrl_ss_sel>;
+    gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+    orientation-switch;
+
+    port {
+        usb3_data_ss: endpoint {
+            remote-endpoint = <&typec_con_ss>;

Isn't this the wrong way around, shouldn't the "usb-c-connector" compatible port be pointing to the orientation switch, rather then the other way around?  Both will work in the end. but to me it feels more natural to group all the info about the type-c connector together in the "usb-c-connector" compatible port

Regards,

Hans

author
#4 lore raw
Quoted 55 lines

-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: 2019年3月11日 19:12
To: Jun Li <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH v3 1/2] dt-bindings: usb: add documentation for typec switch via GPIO

Hi,

Quoted 13 lines · Hans de Goede

Hi,

Quoted 10 lines · Jun Li

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
  .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30
++++++++++++++++++++++

  1 file changed, 30 insertions(+)
Quoted 14 lines
Quoted 8 lines

diff --git a/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt b/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file mode 100644
index 0000000..4ef76cf

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 6

Quoted 6 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +6 -0
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+    - "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.

Hmm, it seems that this binding should work fine with other orientation-switches as well, so I think this needs a generic compatible string.

Quoted 8 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 11

Quoted 5 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +5 -0
+
+- gpios: the GPIO used to switch the super speed active channel,
+        GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+        GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.

Shouldn't this have usb-c in the propery name, e.g.:
usb-c-orientation-switch  ?

Quoted 8 lines

Also perhaps it would be better to use an additional compatible string for this, rather then a boolean property, because what you are trying to say is that this device is compatible with some (to be written) generic usb-c-orientation-switch binding.

So I think you may want to use an extra compatible for this and describe the port/graph usage linking the usb-c-connector port and the port on the orientation-switch together in a new usb-c-orientation-switch binding document.

This patch was to only cover one kind of *typical* typec switch: done by GPIO toggle, as I don't know how other typec switch may be implemented, I will try to change this to be a *common* typec switch by using a generic compatible(type-c-orientation-switch), which will for now only support switch-gpios.

Quoted 3 lines

This new binding will then document the port usage which is mostly undocumented in your typec-switch-gpio.txt binding and this port usage documentation can then be re-used for other orientation-switch bindings.

Port usage should be the same as I gave the example:
https://www.spinics.net/lists/devicetree/msg278042.html

thanks
Li Jun

Quoted 35 lines

Regards,

Hans

Quoted 29 lines
Quoted 7 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +6 -0
+
+Required sub-node:
+- port: specify the remote endpoint of typec switch consumer.
+
+Example:
+

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +10 -0
+ptn36043 {
+    compatible = "nxp,ptn36043";
+    pinctrl-names = "default";
+    pinctrl-0 = <&pinctrl_ss_sel>;
+    gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+    orientation-switch;
+
+    port {
+        usb3_data_ss: endpoint {
+            remote-endpoint = <&typec_con_ss>;

Isn't this the wrong way around, shouldn't the "usb-c-connector" compatible port be pointing to the orientation switch, rather then the other way around?  Both will work in the end. but to me it feels more natural to group all the info about the type-c connector together in the "usb-c-connector" compatible port

Regards,

Hans

author
#5 lore raw
In reply to Hans de Goede

Hi Hans

Quoted 37 lines

-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: 2019年3月11日 19:03
To: Jun Li <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH v3 1/2] dt-bindings: usb: add documentation for typec switch via GPIO

Hi,

Quoted 7 lines · Jun Li

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
  .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30

++++++++++++++++++++++

Quoted 16 lines
  1 file changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt b/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file mode 100644
index 0000000..4ef76cf

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +6 -0
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+	- "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.
Quoted 8 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 11

Quoted 5 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +5 -0
+
+- gpios: the GPIO used to switch the super speed active channel,
+		GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+		GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.

Shouldn't this have usb-c in the propery name, e.g.:
usb-c-orientation-switch ?

This is decided by drivers/usb/typec/mux.c:36
/*
* With OF graph the mux node must have a boolean device property named
* "orientation-switch".
*/

Quoted 14 lines
Quoted 14 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +13 -0
+
+Required sub-node:
+- port: specify the remote endpoint of typec switch consumer.
+
+Example:
+
+ptn36043 {
+	compatible = "nxp,ptn36043";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_ss_sel>;
+	gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+	orientation-switch;
+
Quoted 8 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 27

Quoted 3 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +3 -0
+	port {
+		usb3_data_ss: endpoint {
+			remote-endpoint = <&typec_con_ss>;

Isn't this the wrong way around, shouldn't the "usb-c-connector" compatible port be pointing to the orientation switch, rather then the other way around?

I am not sure I am getting your point, "usb-c-connector" is the user of typec switch, yes, it is pointing to the orientation switch provider(i.e, this example node).

Quoted 3 lines

Both will work in the end. but to me it feels more natural to group all the info about the type-c connector together in the "usb-c-connector" compatible port

        ptn36043 {
                compatible = "nxp,ptn36043";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_ss_sel>;
                gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
                orientation-switch;

                port {
                        usb3_data_ss: endpoint {
                                remote-endpoint = <&typec_con_ss>;
                        };
                };
        };
usb_con: connector {
	compatible = "usb-c-connector";
	...
	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		port@1 {
			reg = <1>;
			typec_con_ss: endpoint {
				remote-endpoint = <&usb3_data_ss>;
			};
		};
	};
};

Regards
Jun

Quoted 3 lines

Regards,

Hans

maintainer
#6 lore raw

Hi,

Quoted 47 lines · Jun Li

Hi Hans

Quoted 37 lines

-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: 2019年3月11日 19:03
To: Jun Li <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH v3 1/2] dt-bindings: usb: add documentation for typec switch via GPIO

Hi,

Quoted 7 lines · Jun Li

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
  .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30

++++++++++++++++++++++

Quoted 16 lines
  1 file changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt b/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file mode 100644
index 0000000..4ef76cf

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +6 -0
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+	- "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.
Quoted 8 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 11

Quoted 5 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +5 -0
+
+- gpios: the GPIO used to switch the super speed active channel,
+		GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+		GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.

Shouldn't this have usb-c in the propery name, e.g.:
usb-c-orientation-switch ?

Quoted 5 lines

This is decided by drivers/usb/typec/mux.c:36
/*
* With OF graph the mux node must have a boolean device property named
* "orientation-switch".
*/

Yes, but it's still OK to change it. It's not documented anywhere yet.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +13 -0
+
+Required sub-node:
+- port: specify the remote endpoint of typec switch consumer.
+
+Example:
+
+ptn36043 {
+	compatible = "nxp,ptn36043";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_ss_sel>;
+	gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+	orientation-switch;
+
Quoted 8 lines
Quoted 8 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 27

Quoted 3 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +3 -0
+	port {
+		usb3_data_ss: endpoint {
+			remote-endpoint = <&typec_con_ss>;

Isn't this the wrong way around, shouldn't the "usb-c-connector" compatible port be pointing to the orientation switch, rather then the other way around?

Hans, in OF graph both endpoints will have a remote-endpoint pointing to each other..

Quoted 21 lines

I am not sure I am getting your point, "usb-c-connector" is the user of typec switch, yes, it is pointing to the orientation switch provider(i.e, this example node).

Quoted 3 lines

Both will work in the end. but to me it feels more natural to group all the info about the type-c connector together in the "usb-c-connector" compatible port

        ptn36043 {
                compatible = "nxp,ptn36043";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_ss_sel>;
                gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
                orientation-switch;

                port {
                        usb3_data_ss: endpoint {
                                remote-endpoint = <&typec_con_ss>;
                        };
                };
        };
Quoted 15 lines
usb_con: connector {
	compatible = "usb-c-connector";
	...
	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		port@1 {
			reg = <1>;
			typec_con_ss: endpoint {
				remote-endpoint = <&usb3_data_ss>;
			};
		};
	};
};

So like that.

thanks,

#7 lore raw

Hi,

Quoted 120 lines · Heikki Krogerus

Hi,

Quoted 47 lines · Jun Li

Hi Hans

Quoted 37 lines

-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: 2019年3月11日 19:03
To: Jun Li <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH v3 1/2] dt-bindings: usb: add documentation for typec switch via GPIO

Hi,

Quoted 7 lines · Jun Li

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
   .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30

++++++++++++++++++++++

Quoted 16 lines
   1 file changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt b/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file mode 100644
index 0000000..4ef76cf

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +6 -0
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+	- "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.
Quoted 8 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 11

Quoted 5 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +5 -0
+
+- gpios: the GPIO used to switch the super speed active channel,
+		GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+		GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.

Shouldn't this have usb-c in the propery name, e.g.:
usb-c-orientation-switch ?

Quoted 5 lines

This is decided by drivers/usb/typec/mux.c:36
/*
* With OF graph the mux node must have a boolean device property named
* "orientation-switch".
*/

Yes, but it's still OK to change it. It's not documented anywhere yet.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +13 -0
+
+Required sub-node:
+- port: specify the remote endpoint of typec switch consumer.
+
+Example:
+
+ptn36043 {
+	compatible = "nxp,ptn36043";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_ss_sel>;
+	gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+	orientation-switch;
+
Quoted 8 lines
Quoted 8 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 27

Quoted 3 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +3 -0
+	port {
+		usb3_data_ss: endpoint {
+			remote-endpoint = <&typec_con_ss>;

Isn't this the wrong way around, shouldn't the "usb-c-connector" compatible port be pointing to the orientation switch, rather then the other way around?

Hans, in OF graph both endpoints will have a remote-endpoint pointing to each other..

Quoted 21 lines

I am not sure I am getting your point, "usb-c-connector" is the user of typec switch, yes, it is pointing to the orientation switch provider(i.e, this example node).

Quoted 3 lines

Both will work in the end. but to me it feels more natural to group all the info about the type-c connector together in the "usb-c-connector" compatible port

         ptn36043 {
                 compatible = "nxp,ptn36043";
                 pinctrl-names = "default";
                 pinctrl-0 = <&pinctrl_ss_sel>;
                 gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
                 orientation-switch;

                 port {
                         usb3_data_ss: endpoint {
                                 remote-endpoint = <&typec_con_ss>;
                         };
                 };
         };
Quoted 15 lines
usb_con: connector {
	compatible = "usb-c-connector";
	...
	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		port@1 {
			reg = <1>;
			typec_con_ss: endpoint {
				remote-endpoint = <&usb3_data_ss>;
			};
		};
	};
};
Quoted 1 line

So like that.

Ah I see, thank you for clarifying that.

Regards,

Hans

maintainer
#8 lore raw
In reply to Jun Li
Quoted 15 lines · Jun Li

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
 .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +0 -0
new file mode 100644
index 0000000..4ef76cf

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 8

Quoted 8 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +8 -0
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+	- "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.
+
+- gpios: the GPIO used to switch the super speed active channel,

Perhaps switch-gpios in case there are other gpios needed.

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 11

Quoted 3 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +3 -0
+		GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+		GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.

Why is this needed? The compatible can't imply this?

Quoted 22 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +19 -0
+
+Required sub-node:
+- port: specify the remote endpoint of typec switch consumer.
+
+Example:
+
+ptn36043 {
+	compatible = "nxp,ptn36043";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_ss_sel>;
+	gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+	orientation-switch;
+
+	port {
+		usb3_data_ss: endpoint {
+			remote-endpoint = <&typec_con_ss>;
+		};
+	};
+};
Signature · 1 line
2.7.4
maintainer
#9 lore raw
Quoted 27 lines · Rob Herring
Quoted 15 lines · Jun Li

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
 .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +0 -0
new file mode 100644
index 0000000..4ef76cf

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 8

Quoted 8 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +8 -0
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+	- "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.
+
+- gpios: the GPIO used to switch the super speed active channel,

Perhaps switch-gpios in case there are other gpios needed.

Quoted 5 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 11

Quoted 3 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +3 -0
+		GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+		GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.

Why is this needed? The compatible can't imply this?

I think Jun Li is added that based on the comment I put to drivers/usb/typec/mux.c, so I'm to blame here. If we can handle this with the compatible like I guess we can, I'm happy.

thanks,

Signature · 1 line
heikki
author
#10 lore raw
Quoted 49 lines

-----Original Message-----
From: Heikki Krogerus <[email protected]>
Sent: 2019年3月13日 17:36
To: Rob Herring <[email protected]>
Cc: Jun Li <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH v3 1/2] dt-bindings: usb: add documentation for typec switch via GPIO

Quoted 30 lines · Rob Herring
Quoted 18 lines · Jun Li

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
 .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30
++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt b/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file mode 100644
index 0000000..4ef76cf

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 8

Quoted 8 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +8 -0
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+	- "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.
+
+- gpios: the GPIO used to switch the super speed active channel,

Perhaps switch-gpios in case there are other gpios needed.

Quoted 5 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 11

Quoted 3 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +3 -0
+		GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+		GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.

Why is this needed? The compatible can't imply this?

Quoted 3 lines

I think Jun Li is added that based on the comment I put to drivers/usb/typec/mux.c, so I'm to blame here. If we can handle this with the compatible like I guess we can, I'm happy.

Hi Heikki

Can I just remove the original bool property check? i.e, match OK if the remote parent node is in switch_list.

Thanks
Li Jun

Quoted 5 lines

thanks,

--
heikki

maintainer
#11 lore raw
Quoted 49 lines · Jun Li
Quoted 49 lines

-----Original Message-----
From: Heikki Krogerus <[email protected]>
Sent: 2019年3月13日 17:36
To: Rob Herring <[email protected]>
Cc: Jun Li <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH v3 1/2] dt-bindings: usb: add documentation for typec switch via GPIO

Quoted 35 lines · Rob Herring
Quoted 18 lines · Jun Li

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
 .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30
++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt b/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file mode 100644
index 0000000..4ef76cf

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 8

Quoted 8 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +8 -0
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+	- "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.
+
+- gpios: the GPIO used to switch the super speed active channel,

Perhaps switch-gpios in case there are other gpios needed.

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 11

Quoted 3 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +3 -0
+		GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+		GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.

Why is this needed? The compatible can't imply this?

Quoted 8 lines
Quoted 3 lines

I think Jun Li is added that based on the comment I put to drivers/usb/typec/mux.c, so I'm to blame here. If we can handle this with the compatible like I guess we can, I'm happy.

Hi Heikki

Can I just remove the original bool property check? i.e, match OK if the remote parent node is in switch_list.

No. If typec_switch_get() is called before the mux device is registered, we need to return -EPROBE_DEFER. That means we need to be able to identify the mux device node.

I think we should just use the compatible like Rob suggested. The Type-C muxes should probable have their own bindings file where it's defined for these muxes.

thanks,

Signature · 1 line
heikki
author
#12 lore raw
In reply to Rob Herring
Quoted 33 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: 2019年3月12日 22:45
To: Jun Li <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH v3 1/2] dt-bindings: usb: add documentation for typec switch via GPIO

Quoted 20 lines · Jun Li

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumer.

---
 .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30
++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt b/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file mode 100644
index 0000000..4ef76cf

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +2 -0
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
Quoted 8 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 8

Quoted 6 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +6 -0
+
+Required properties:
+- compatible: should be set one of following:
+	- "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.
+
+- gpios: the GPIO used to switch the super speed active channel,

Perhaps switch-gpios in case there are other gpios needed.

OK, I will change it to be switch-gpios.

Quoted 6 lines

Documentation/devicetree/bindings/usb/typec-switch-gpio.txt line 11

Quoted 4 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +3 -0
+		GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+		GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.

Why is this needed? The compatible can't imply this?

I will try to remove this bool property and use a general compatible string.

Quoted 23 lines
Quoted 23 lines
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +19 -1
+
+Required sub-node:
+- port: specify the remote endpoint of typec switch consumer.
+
+Example:
+
+ptn36043 {
+	compatible = "nxp,ptn36043";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_ss_sel>;
+	gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+	orientation-switch;
+
+	port {
+		usb3_data_ss: endpoint {
+			remote-endpoint = <&typec_con_ss>;
+		};
+	};
+};
--

2.7.4