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

AngeloGioacchino Del Regno angelogioacchino.delregno at collabora.com
Thu Feb 20 07:58:52 PST 2025


Il 20/02/25 15:33, Macpaul Lin ha scritto:
> From: Fabien Parent <fparent at baylibre.com>
> 
> 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 SS (SuperSpeed) and HS (HighSpeed) USB.
> 
> Update pinctrl configurations for U3 P0 VBus default pins and set dr_mode
> to "otg" for OTG (On-The-Go) mode operation.
> 
> Signed-off-by: Fabien Parent <fparent at baylibre.com>
> Signed-off-by: Yow-Shin Liou <yow-shin.liou at mediatek.com>
> Signed-off-by: Simon Sun <simon.sun at yunjingtech.com>
> Signed-off-by: Macpaul Lin <macpaul.lin at mediatek.com>
> ---
>   .../dts/mediatek/mt8395-genio-1200-evk.dts    | 72 +++++++++++++++++++
>   1 file changed, 72 insertions(+)
> 
> Changes for v2:
>   - Drop the no need '1/2' DT Schema update patch in the 1st version.
>   - Fix indent for 'ports' node, it should under the 'connector' node.
>   - Correct the index for 'port at 0' and 'port at 1' node.
> 
> Changes for v3:
>   - Correct the order between new added nodes.
> 
> Changes for v4:
>   - Reorder for property 'op-sink-microwatt'.
>   - Fix indentation for 'source-pdos' and 'sink-pdos' nodes.
>   - Correct node 'pin-cmd-dat' with 'pins-vbus'.
>   - Add both Highspeed and Superspeed ports to ssusb0 port.
>   - Set 'role-switch-default-mode' = "peripheral" for ssusb0 port.
>   - Rename endpoint of USB data port to 'mtu3_hs0_role_sw' and
>     'mtu3_ss0_role_sw'.
> 
> diff --git a/arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts b/arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts
> index 1ef6262b65c9..ca039c8e4c71 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts
> +++ b/arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts
> @@ -330,6 +330,47 @@ 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";
> +				op-sink-microwatt = <10000000>;
> +				power-role = "dual";
> +				try-power-role = "sink";

Would be appreciated if you could also complete the node by adding the pd-revision
property, enabling full USBC Power Delivery for the MT6360 PMIC.

Same for the alternate modes, adding the DP alt mode is a matter of seconds... and
well, it does sound a bit weird to add alternate modes without a mux... so, in this
case you can choose either to:
  - Squash the two commits (tcpc, it5205) and do everything in one; or
  - Add the alternate mode node to the connector in the commit introducing the mux.

Either of the two options is okay for me, so you choose.

> +
> +				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)>;
> +
> +				ports {
> +					#address-cells = <1>;
> +					#size-cells = <0>;
> +
> +					port at 0 {
> +						reg = <0>;
> +						typec_con_hs: endpoint {
> +							remote-endpoint = <&mtu3_hs0_role_sw>;
> +						};
> +					};
> +
> +					port at 1 {
> +						reg = <1>;
> +						typec_con_ss: endpoint {
> +							remote-endpoint = <&mtu3_ss0_role_sw>;
> +						};
> +					};
> +				};
> +			};
> +		};
>   	};
>   };
>   
> @@ -755,6 +796,13 @@ pins-reset {
>   		};
>   	};
>   
> +	u3_p0_vbus: u3-p0-vbus-default-pins {
> +		pins-vbus {
> +			pinmux = <PINMUX_GPIO63__FUNC_VBUSVALID>;
> +			input-enable;
> +		};
> +	};
> +
>   	uart0_pins: uart0-pins {
>   		pins {
>   			pinmux = <PINMUX_GPIO98__FUNC_UTXD0>,
> @@ -885,8 +933,32 @@ &ufsphy {
>   };
>   
>   &ssusb0 {
> +	dr_mode = "otg";
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&u3_p0_vbus>;
> +	role-switch-default-mode = "peripheral";

There's no need for a default mode here, luckily the MediaTek MTU3 controllers
don't need that for real :-)

Drop please.

Cheers,
Angelo





More information about the linux-arm-kernel mailing list