Skip to contentSkip to conversation

arm64: dts: mediatek: mt8395-genio-1200-evk: add support for TCPC port

PATCH Superseded Macpaul Lin 2 participants 6 messages Oct 23, 2024 – Oct 24, 2024

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 arm64: dts: mediatek: mt8395-genio-1200-evk: add support for TCPC port

From: Fabien Parent <[email protected]>

Enable USB Type-C support on MediaTek MT8395 Genio 1200 EVK by adding configuration for TCPC Port, USB-C connector, and related settings.

Configure dual role switch capability, set up PD (Power Delivery) profiles, and establish endpoints for SSUSB (SuperSpeed USB).

Update pinctrl configurations for U3 P0 VBus default pins and set dr_mode to "otg" for OTG (On-The-Go) mode operation.

---
 .../dts/mediatek/mt8395-genio-1200-evk.dts    | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)

Changes for v2:
- Drop the no need '1/2' DT Schema update patch in the 1st version.
- Fix intent for 'ports' node, it should under the 'connector' node.
- Correct the index for 'port@0' and 'port@1' node.

Changes for v3:
- Correct the order between new added nodes.

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +54 -0
index 5f16fb820580..83d520226302 100644
@@ -335,6 +335,43 @@ mt6360_ldo7: ldo7 {
 				regulator-always-on;
 			};
 		};
+
+		tcpc {
+			compatible = "mediatek,mt6360-tcpc";
+			interrupts-extended = <&pio 17 IRQ_TYPE_LEVEL_LOW>;
+			interrupt-names = "PD_IRQB";
+
+			connector {
+				compatible = "usb-c-connector";
+				label = "USB-C";
+				data-role = "dual";
+				power-role = "dual";
+				try-power-role = "sink";
+				source-pdos = <PDO_FIXED(5000, 1000, \
+					       PDO_FIXED_DUAL_ROLE | \
+					       PDO_FIXED_DATA_SWAP)>;
+				sink-pdos = <PDO_FIXED(5000, 2000, \
+					     PDO_FIXED_DUAL_ROLE | \
+					     PDO_FIXED_DATA_SWAP)>;
+				op-sink-microwatt = <10000000>;
+
+				ports {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					port@0 {
+						reg = <0>;
+					};
+
+					port@1 {
+						reg = <1>;
+						mt6360_ssusb_ep: endpoint {
+							remote-endpoint = <&ssusb_ep>;
+						};
+					};
+				};
+			};
+		};
 	};
 };
 
@@ -770,6 +807,13 @@ pins-reset {
 		};
 	};
 
+	u3_p0_vbus: u3-p0-vbus-default-pins {
+		pins-cmd-dat {
+			pinmux = <PINMUX_GPIO63__FUNC_VBUSVALID>;
+			input-enable;
+		};
+	};
+
 	uart0_pins: uart0-pins {
 		pins {
 			pinmux = <PINMUX_GPIO98__FUNC_UTXD0>,
@@ -900,8 +944,18 @@ &ufsphy {
 };
 
 &ssusb0 {
+	dr_mode = "otg";
+	pinctrl-names = "default";
+	pinctrl-0 = <&u3_p0_vbus>;
+	usb-role-switch;
 	vusb33-supply = <&mt6359_vusb_ldo_reg>;
 	status = "okay";
+
+	port {
+		ssusb_ep: endpoint {
+			remote-endpoint = <&mt6360_ssusb_ep>;
+		};
+	};
 };
 
 &ssusb2 {
Signature · 1 line
2.45.2
#1 lore raw

PATCH v3 2/2 arm64: dts: mediatek: mt8395-genio-1200-evk: add support for MUX IT5205

Add ITE IT5205FN (TYPEC MUX) under I2C2 bus and configure its properties; also add references to it5205fn from MT6360 TYPE-C connector for TYPEC configuration.

---
 .../dts/mediatek/mt8395-genio-1200-evk.dts    | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

Changes for v2:
- This is a new patch in the v2 patch.

Changes for v3:
- No change.

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +22 -0
index 83d520226302..4c11c100e7b6 100644
@@ -229,6 +229,21 @@ &i2c2 {
 	pinctrl-0 = <&i2c2_pins>;
 	pinctrl-names = "default";
 	status = "okay";
+
+	it5205fn: typec-mux@48 {
+		compatible = "ite,it5205";
+		reg = <0x48>;
+		vcc-supply = <&mt6359_vibr_ldo_reg>;
+		mode-switch;
+		orientation-switch;
+		status = "okay";
+
+		port {
+			it5205_sbu_ep: endpoint {
+				remote-endpoint = <&mt6360_ssusb_sbu_ep>;
+			};
+		};
+	};
 };
 
 &i2c6 {
@@ -369,6 +384,13 @@ mt6360_ssusb_ep: endpoint {
 							remote-endpoint = <&ssusb_ep>;
 						};
 					};
+
+					port@2 {
+						reg = <2>;
+						mt6360_ssusb_sbu_ep: endpoint {
+							remote-endpoint = <&it5205_sbu_ep>;
+						};
+					};
 				};
 			};
 		};
Signature · 1 line
2.45.2
maintainer Reviewed-by on v3 2/2
#2 lore raw

Re: [PATCH v3 2/2] arm64: dts: mediatek: mt8395-genio-1200-evk: add support for MUX IT5205

Il 23/10/24 10:09, Macpaul Lin ha scritto:

Quoted 22 lines

Add ITE IT5205FN (TYPEC MUX) under I2C2 bus and configure its properties; also add references to it5205fn from MT6360 TYPE-C connector for TYPEC configuration.

---
  .../dts/mediatek/mt8395-genio-1200-evk.dts    | 22 +++++++++++++++++++
  1 file changed, 22 insertions(+)

Changes for v2:
- This is a new patch in the v2 patch.

Changes for v3:
- No change.

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +0 -0
index 83d520226302..4c11c100e7b6 100644

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts &i2c2 { · line 233

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +2 -0
@@ -229,6 +229,21 @@ &i2c2 {
  	pinctrl-0 = <&i2c2_pins>;
  	pinctrl-names = "default";
  	status = "okay";
+
+	it5205fn: typec-mux@48 {

You don't need the it5205fn phandle, please drop.

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts &i2c2 { · line 238

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +5 -0
+		compatible = "ite,it5205";
+		reg = <0x48>;
+		vcc-supply = <&mt6359_vibr_ldo_reg>;
+		mode-switch;
+		orientation-switch;

compatible
reg
mode-switch
orientation-switch
vcc-supply

Please reorder.

After which:

Quoted 25 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +15 -0
+		status = "okay";
+
+		port {
+			it5205_sbu_ep: endpoint {
+				remote-endpoint = <&mt6360_ssusb_sbu_ep>;
+			};
+		};
+	};
  };
 
  &i2c6 {
@@ -369,6 +384,13 @@ mt6360_ssusb_ep: endpoint {
  							remote-endpoint = <&ssusb_ep>;
  						};
  					};
+
+					port@2 {
+						reg = <2>;
+						mt6360_ssusb_sbu_ep: endpoint {
+							remote-endpoint = <&it5205_sbu_ep>;
+						};
+					};
  				};
  			};
  		};
#3 lore raw
In reply to Macpaul Lin

Il 23/10/24 10:09, Macpaul Lin ha scritto:

Quoted 35 lines

From: Fabien Parent <[email protected]>

Enable USB Type-C support on MediaTek MT8395 Genio 1200 EVK by adding configuration for TCPC Port, USB-C connector, and related settings.

Configure dual role switch capability, set up PD (Power Delivery) profiles, and establish endpoints for SSUSB (SuperSpeed USB).

Update pinctrl configurations for U3 P0 VBus default pins and set dr_mode to "otg" for OTG (On-The-Go) mode operation.

---
  .../dts/mediatek/mt8395-genio-1200-evk.dts    | 54 +++++++++++++++++++
  1 file changed, 54 insertions(+)

Changes for v2:
- Drop the no need '1/2' DT Schema update patch in the 1st version.
- Fix intent for 'ports' node, it should under the 'connector' node.
- Correct the index for 'port@0' and 'port@1' node.

Changes for v3:
- Correct the order between new added nodes.

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +0 -0
index 5f16fb820580..83d520226302 100644
@@ -335,6 +335,43 @@ mt6360_ldo7: ldo7 {
  				regulator-always-on;
  			};
  		};

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts mt6360_ldo7: ldo7 { · line 347

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +10 -0
+
+		tcpc {
+			compatible = "mediatek,mt6360-tcpc";
+			interrupts-extended = <&pio 17 IRQ_TYPE_LEVEL_LOW>;
+			interrupt-names = "PD_IRQB";
+
+			connector {
+				compatible = "usb-c-connector";
+				label = "USB-C";
+				data-role = "dual";

op-sink-microwatt goes here

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts mt6360_ldo7: ldo7 { · line 352

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +5 -0
+				power-role = "dual";
+				try-power-role = "sink";
+				source-pdos = <PDO_FIXED(5000, 1000, \
+					       PDO_FIXED_DUAL_ROLE | \
+					       PDO_FIXED_DATA_SWAP)>;

Please fix the indentation (and also you don't need the escaping)

				source-pdos = <PDO_FIXED(5000, 1000,
							 PDO_FIXED_DUAL_ROLE |
							 PDO_FIXED_DATA_SWAP)>;

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts mt6360_ldo7: ldo7 { · line 363

Quoted 11 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +11 -0
+				sink-pdos = <PDO_FIXED(5000, 2000, \
+					     PDO_FIXED_DUAL_ROLE | \
+					     PDO_FIXED_DATA_SWAP)>;
+				op-sink-microwatt = <10000000>;
+
+				ports {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					port@0 {
+						reg = <0>;

Just to make sure that this is ok: are you sure that this port supports SuperSpeed (physical connector too) and that it's not limited to HighSpeed?

I have seen Rob's comment stating that ssusb_ep goes to port@1, but I think that his comment came after reading "ss" in "ssusb": while the controller does surely support SS, if the port does not, this should still go to port@0.

P.S.: I didn't check the schematics - just please make sure it's correct, and
that this actually works.

Quoted 15 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +11 -0
+					};
+
+					port@1 {
+						reg = <1>;
+						mt6360_ssusb_ep: endpoint {
+							remote-endpoint = <&ssusb_ep>;
+						};
+					};
+				};
+			};
+		};
  	};
  };
 

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts pins-reset { · line 811

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +2 -0
@@ -770,6 +807,13 @@ pins-reset {
  		};
  	};
 
+	u3_p0_vbus: u3-p0-vbus-default-pins {
+		pins-cmd-dat {

That's not a command nor data pin.

pins-vbus {

Quoted 9 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +5 -0
+			pinmux = <PINMUX_GPIO63__FUNC_VBUSVALID>;
+			input-enable;
+		};
+	};
+
  	uart0_pins: uart0-pins {
  		pins {
  			pinmux = <PINMUX_GPIO98__FUNC_UTXD0>,

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts &ufsphy { · line 949

Quoted 6 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +3 -0
@@ -900,8 +944,18 @@ &ufsphy {
  };
 
  &ssusb0 {
+	dr_mode = "otg";
+	pinctrl-names = "default";
+	pinctrl-0 = <&u3_p0_vbus>;

Is this port usb host by default? If it is:

	role-switch-default-mode = "host";

Cheers,
Angelo

Quoted 12 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +7 -0
+	usb-role-switch;
  	vusb33-supply = <&mt6359_vusb_ldo_reg>;
  	status = "okay";
+
+	port {
+		ssusb_ep: endpoint {
+			remote-endpoint = <&mt6360_ssusb_ep>;
+		};
+	};
  };
 
  &ssusb2 {
#4 lore raw

Il 23/10/24 13:07, AngeloGioacchino Del Regno ha scritto:

Quoted 76 lines

Il 23/10/24 10:09, Macpaul Lin ha scritto:

Quoted 35 lines

From: Fabien Parent <[email protected]>

Enable USB Type-C support on MediaTek MT8395 Genio 1200 EVK by adding configuration for TCPC Port, USB-C connector, and related settings.

Configure dual role switch capability, set up PD (Power Delivery) profiles, and establish endpoints for SSUSB (SuperSpeed USB).

Update pinctrl configurations for U3 P0 VBus default pins and set dr_mode to "otg" for OTG (On-The-Go) mode operation.

---
  .../dts/mediatek/mt8395-genio-1200-evk.dts    | 54 +++++++++++++++++++

  1 file changed, 54 insertions(+)

Changes for v2:
  - Drop the no need '1/2' DT Schema update patch in the 1st version.
  - Fix intent for 'ports' node, it should under the 'connector' node.
  - Correct the index for 'port@0' and 'port@1' node.

Changes for v3:
  - Correct the order between new added nodes.

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +0 -0
index 5f16fb820580..83d520226302 100644
@@ -335,6 +335,43 @@ mt6360_ldo7: ldo7 {
                   regulator-always-on;
               };
           };

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts mt6360_ldo7: ldo7 { · line 347

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +10 -0
+
+        tcpc {
+            compatible = "mediatek,mt6360-tcpc";
+            interrupts-extended = <&pio 17 IRQ_TYPE_LEVEL_LOW>;
+            interrupt-names = "PD_IRQB";
+
+            connector {
+                compatible = "usb-c-connector";
+                label = "USB-C";
+                data-role = "dual";

op-sink-microwatt goes here

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts mt6360_ldo7: ldo7 { · line 352

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +5 -0
+                power-role = "dual";
+                try-power-role = "sink";
+                source-pdos = <PDO_FIXED(5000, 1000, \
+                           PDO_FIXED_DUAL_ROLE | \
+                           PDO_FIXED_DATA_SWAP)>;

Please fix the indentation (and also you don't need the escaping)

                source-pdos = <PDO_FIXED(5000, 1000, PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP)>;

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts mt6360_ldo7: ldo7 { · line 363

Quoted 11 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +11 -0
+                sink-pdos = <PDO_FIXED(5000, 2000, \
+                         PDO_FIXED_DUAL_ROLE | \
+                         PDO_FIXED_DATA_SWAP)>;
+                op-sink-microwatt = <10000000>;
+
+                ports {
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+
+                    port@0 {
+                        reg = <0>;

Just to make sure that this is ok: are you sure that this port supports SuperSpeed (physical connector too) and that it's not limited to HighSpeed?

Quoted 7 lines

I have seen Rob's comment stating that ssusb_ep goes to port@1, but I think that his comment came after reading "ss" in "ssusb": while the controller does surely support SS, if the port does not, this should still go to port@0.

P.S.: I didn't check the schematics - just please make sure it's correct, and
      that this actually works.

Sorry for the double email, but I've done some fast research on this as something came to mind right after sending this review.

usb-connector.yaml says that the ports property models a data bus to the USB connector, and that a single connector can have multiple data buses, of course.

The last statement doesn't come as a surprise, and actually makes me think about what MTU3 actually provides: a High Speed data bus, and a SuperSpeed data bus.

Now, I see in MTU3 that only port is allowed and that only the HS part is is exposed... so to resolve this, you want to add a binding to connect the data bus of the MTU3 controller to the usb-c-connector, and obviously only then you should use it here.

That should look like this:

mediatek,mtu3.yaml:
ports:
$ref: /schemas/graph.yaml#/properties/ports

properties:
port@0:
$ref: /schemas/graph.yaml#/properties/port
description: High Speed (HS) data bus.

port@1:
$ref: /schemas/graph.yaml#/properties/port
description: Super Speed (SS) data bus.

some_devicetree.dts

&ssusb0 {
	ports {
		port@0 {
			reg = <0>;

			/* High Speed data bus */
			mtu3_hs0_ep: endpoint {
				/* connects to port@0 (HS) of usb-c-connector */
				remote-endpoint = <&typec_con_hs>;
			}
		};

		port@1 {
			reg = <1>;

			/* SuperSpeed data bus */
			mtu3_ss0_ep: endpoint {
				/* connects to port@1 (SS) of usb-c-connector */
				remote-endpoint = <&typec_con_sss>;
			}
		};
	};
};

I don't have time to do any testing in this precise moment, so, if you want to go on and test - cool; otherwise, I can check that at a later time, but on Genio 700 EVK instead (which is the same thing for this specific topic anyway).

Cheers,
Angelo

Quoted 57 lines
Quoted 14 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +11 -0
+                    };
+
+                    port@1 {
+                        reg = <1>;
+                        mt6360_ssusb_ep: endpoint {
+                            remote-endpoint = <&ssusb_ep>;
+                        };
+                    };
+                };
+            };
+        };
       };
   };

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts pins-reset { · line 810

Quoted 4 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +2 -0
@@ -770,6 +807,13 @@ pins-reset {
           };
       };
+    u3_p0_vbus: u3-p0-vbus-default-pins {
+        pins-cmd-dat {

That's not a command nor data pin.

pins-vbus {

Quoted 9 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +5 -0
+            pinmux = <PINMUX_GPIO63__FUNC_VBUSVALID>;
+            input-enable;
+        };
+    };
+
       uart0_pins: uart0-pins {
           pins {
               pinmux = <PINMUX_GPIO98__FUNC_UTXD0>,

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts &ufsphy { · line 948

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +3 -0
@@ -900,8 +944,18 @@ &ufsphy {
   };
   &ssusb0 {
+    dr_mode = "otg";
+    pinctrl-names = "default";
+    pinctrl-0 = <&u3_p0_vbus>;

Is this port usb host by default? If it is:

    role-switch-default-mode = "host";

Cheers,
Angelo

Quoted 11 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +7 -0
+    usb-role-switch;
       vusb33-supply = <&mt6359_vusb_ldo_reg>;
       status = "okay";
+
+    port {
+        ssusb_ep: endpoint {
+            remote-endpoint = <&mt6360_ssusb_ep>;
+        };
+    };
   };
   &ssusb2 {
#5 lore raw
Quoted 49 lines · AngeloGioacchino Del Regno

Il 23/10/24 13:07, AngeloGioacchino Del Regno ha scritto:

Quoted 48 lines

Il 23/10/24 10:09, Macpaul Lin ha scritto:

Quoted 35 lines

From: Fabien Parent <[email protected]>

Enable USB Type-C support on MediaTek MT8395 Genio 1200 EVK by adding configuration for TCPC Port, USB-C connector, and related settings.

Configure dual role switch capability, set up PD (Power Delivery) profiles, and establish endpoints for SSUSB (SuperSpeed USB).

Update pinctrl configurations for U3 P0 VBus default pins and set dr_mode to "otg" for OTG (On-The-Go) mode operation.

---
  .../dts/mediatek/mt8395-genio-1200-evk.dts    | 54 +++++++++++++++++++

  1 file changed, 54 insertions(+)

Changes for v2:
  - Drop the no need '1/2' DT Schema update patch in the 1st version.
  - Fix intent for 'ports' node, it should under the 'connector' node.
  - Correct the index for 'port@0' and 'port@1' node.

Changes for v3:
  - Correct the order between new added nodes.

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +0 -0
index 5f16fb820580..83d520226302 100644
@@ -335,6 +335,43 @@ mt6360_ldo7: ldo7 {
                   regulator-always-on;
               };
           };

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts mt6360_ldo7: ldo7 { · line 347

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +10 -0
+
+        tcpc {
+            compatible = "mediatek,mt6360-tcpc";
+            interrupts-extended = <&pio 17 IRQ_TYPE_LEVEL_LOW>;
+            interrupt-names = "PD_IRQB";
+
+            connector {
+                compatible = "usb-c-connector";
+                label = "USB-C";
+                data-role = "dual";

op-sink-microwatt goes here

Okay, will fix it.

Quoted 7 lines
Quoted 7 lines

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts mt6360_ldo7: ldo7 { · line 352

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +5 -0
+                power-role = "dual";
+                try-power-role = "sink";
+                source-pdos = <PDO_FIXED(5000, 1000, \
+                           PDO_FIXED_DUAL_ROLE | \
+                           PDO_FIXED_DATA_SWAP)>;

Please fix the indentation (and also you don't need the escaping)

Okay, it has been complained by checkpatch about this line is too long. Will fix it in next version.

Quoted 4 lines
Quoted 4 lines

                 source-pdos = <PDO_FIXED(5000, 1000, PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP)>;

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +6 -0
+                sink-pdos = <PDO_FIXED(5000, 2000, \
+                         PDO_FIXED_DUAL_ROLE | \
+                         PDO_FIXED_DATA_SWAP)>;
+                op-sink-microwatt = <10000000>;
+
+                ports {
Quoted 8 lines

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts mt6360_ldo7: ldo7 { · line 363

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +5 -0
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+
+                    port@0 {
+                        reg = <0>;

Just to make sure that this is ok: are you sure that this port supports SuperSpeed (physical connector too) and that it's not limited to HighSpeed?

This port should be able to do both HighSpeed and SuperSpeed. However our internal reference code set SuperSpeed at port@0 and seems just work for both high and supoer speeds.
See more detail discussion below.

Quoted 8 lines
Quoted 8 lines

I have seen Rob's comment stating that ssusb_ep goes to port@1, but I think that his comment came after reading "ss" in "ssusb": while the controller does surely support SS, if the port does not, this should still go to port@0.

P.S.: I didn't check the schematics - just please make sure it's correct, and that this actually works.

Quoted 8 lines

Sorry for the double email, but I've done some fast research on this as something came to mind right after sending this review.

usb-connector.yaml says that the ports property models a data bus to the USB connector, and that a single connector can have multiple data buses, of course.

The last statement doesn't come as a surprise, and actually makes me think about what MTU3 actually provides: a High Speed data bus, and a SuperSpeed data bus.

Ya. That's the question I was wondering, too.
Current DT bindings of MTU3 support only 1 port which is also a required property. For the SSUSB0 port on MT8195, it indeed provides a High Speed data bus, and a SuperSpeed data bus.

Quoted 36 lines

Now, I see in MTU3 that only port is allowed and that only the HS part is is exposed... so to resolve this, you want to add a binding to connect the data bus of the MTU3 controller to the usb-c-connector, and obviously only then you should use it here.

That should look like this:

mediatek,mtu3.yaml:
  ports:
    $ref: /schemas/graph.yaml#/properties/ports

    properties:
      port@0:
        $ref: /schemas/graph.yaml#/properties/port
        description: High Speed (HS) data bus.

      port@1:
        $ref: /schemas/graph.yaml#/properties/port
        description: Super Speed (SS) data bus.

some_devicetree.dts
&ssusb0 {
    ports {
        port@0 {
            reg = <0>;

            /* High Speed data bus */
            mtu3_hs0_ep: endpoint {
                /* connects to port@0 (HS) of usb-c-connector */ remote-endpoint = <&typec_con_hs>;
            }
        };

        port@1 {
            reg = <1>;

Quoted 8 lines

            /* SuperSpeed data bus */
            mtu3_ss0_ep: endpoint {
                /* connects to port@1 (SS) of usb-c-connector */ remote-endpoint = <&typec_con_sss>;
            }
        };
    };
};

Sure, but after adding that DT schema before the v3 patch has been send. The dt_binding_check seems show 'port' is a required property for MTU3. However I didn't found where it has been defined.
I think to add the 'ports' property in MTU3's DT Schema should be better.

Quoted 4 lines

I don't have time to do any testing in this precise moment, so, if you want to go on and test - cool; otherwise, I can check that at a later time, but on Genio 700 EVK instead (which is the same thing for this specific topic anyway).

Quoted 23 lines

Cheers,
Angelo

Quoted 20 lines
Quoted 14 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +11 -0
+                    };
+
+                    port@1 {
+                        reg = <1>;
+                        mt6360_ssusb_ep: endpoint {
+                            remote-endpoint = <&ssusb_ep>;
+                        };
+                    };
+                };
+            };
+        };
       };
   };

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts pins-reset { · line 810

Quoted 4 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +2 -0
@@ -770,6 +807,13 @@ pins-reset {
           };
       };
+    u3_p0_vbus: u3-p0-vbus-default-pins {
+        pins-cmd-dat {

That's not a command nor data pin.

Oh! Will fix it.

Quoted 19 lines
Quoted 19 lines

pins-vbus {

Quoted 9 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +5 -0
+            pinmux = <PINMUX_GPIO63__FUNC_VBUSVALID>;
+            input-enable;
+        };
+    };
+
       uart0_pins: uart0-pins {
           pins {
               pinmux = <PINMUX_GPIO98__FUNC_UTXD0>,

arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts &ufsphy { · line 948

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +3 -0
@@ -900,8 +944,18 @@ &ufsphy {
   };
   &ssusb0 {
+    dr_mode = "otg";
+    pinctrl-names = "default";
+    pinctrl-0 = <&u3_p0_vbus>;

Is this port usb host by default? If it is:

Quoted 1 line
Quoted 1 line

     role-switch-default-mode = "host";

This port0 is exactly a dual-role port for genio-1200-evk. It is usually used as gadget device port (like ADB) and sometimes can do OTG function with xhci0.

Quoted 15 lines
Quoted 15 lines

Cheers,
Angelo

Quoted 11 lines
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts +7 -0
+    usb-role-switch;
       vusb33-supply = <&mt6359_vusb_ldo_reg>;
       status = "okay";
+
+    port {
+        ssusb_ep: endpoint {
+            remote-endpoint = <&mt6360_ssusb_ep>;
+        };
+    };
   };
   &ssusb2 {

Thanks
Macpaul Lin