]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
arm64: dts: mediatek: mt8390-genio-700: Add USB, TypeC Controller, MUX
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Thu, 20 Feb 2025 10:55:14 +0000 (11:55 +0100)
committerAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tue, 25 Feb 2025 09:00:34 +0000 (10:00 +0100)
This board features multiple USB connectors:
 * One Type-C connector with Power Delivery and Alt. Modes;
 * One MicroUSB connector, also used for bootloader SW download;
 * One USB through the RaspberryPi-compatible pins header.

Add configuration for the MTU3 controllers providing OTG support
with role switching both on the MicroUSB port, RPi pins header,
and the Type-C port found on this board.

Moreover, add the Richtek RT1715 Type-C Power Delivery Controller
which manages current source/sink, linked to the iTE IT5205 Type-C
Alternate Mode Passive Mux, handling both mode switching between
USB (up to 3.1 Gen2 10Gbps) and DisplayPort (four lanes, DP1.4,
op to 8.1Gbps) and plug orientation switching.

All USB ports reside on different controller instances, and all of
them support host or gadget and can be configured as desired at
runtime.

Link: https://lore.kernel.org/r/20250220105514.43107-4-angelogioacchino.delregno@collabora.com
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi

index 0b22a1e2462569514da2b4300308a2800127895a..2f6c21f86893f28fcf96bf852dc0191114eccc7f 100644 (file)
        pinctrl-0 = <&i2c1_pins>;
        clock-frequency = <400000>;
        status = "okay";
+
+       typec-mux@48 {
+               compatible = "ite,it5205";
+               reg = <0x48>;
+
+               mode-switch;
+               orientation-switch;
+
+               vcc-supply = <&mt6359_vcn33_1_bt_ldo_reg>;
+
+               port {
+                       it5205_sbu_mux: endpoint {
+                               remote-endpoint = <&typec_sbu_out>;
+                       };
+               };
+       };
 };
 
 &i2c2 {
        pinctrl-0 = <&i2c4_pins>;
        clock-frequency = <1000000>;
        status = "okay";
+
+       rt1715@4e {
+               compatible = "richtek,rt1715";
+               reg = <0x4e>;
+               interrupts-extended = <&pio 12 IRQ_TYPE_LEVEL_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&tcpci_int_pins>;
+               vbus-supply = <&usb_p1_vbus>;
+
+               connector {
+                       compatible = "usb-c-connector";
+                       label = "USB-C";
+                       data-role = "dual";
+                       op-sink-microwatt = <10000000>;
+                       power-role = "dual";
+                       try-power-role  = "sink";
+                       pd-revision = /bits/ 8 <0x03 0x00 0x01 0x08>;
+
+                       sink-pdos = <PDO_FIXED(5000, 2000,
+                                              PDO_FIXED_DUAL_ROLE |
+                                              PDO_FIXED_DATA_SWAP)>;
+                       source-pdos = <PDO_FIXED(5000, 2000,
+                                                PDO_FIXED_DUAL_ROLE |
+                                                PDO_FIXED_DATA_SWAP)>;
+
+                       altmodes {
+                               displayport {
+                                       svid = /bits/ 16 <0xff01>;
+                                       vdo = <0x001c1c47>;
+                               };
+                       };
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       typec_con_hs: endpoint {
+                                               remote-endpoint = <&mtu3_hs1_role_sw>;
+                                       };
+                               };
+
+                               port@1 {
+                                       reg = <1>;
+                                       typec_con_ss: endpoint {
+                                               remote-endpoint = <&xhci_ss_ep>;
+                                       };
+                               };
+
+                               port@2 {
+                                       reg = <2>;
+                                       typec_sbu_out: endpoint {
+                                               remote-endpoint = <&it5205_sbu_mux>;
+                                       };
+
+                               };
+                       };
+               };
+       };
 };
 
 &i2c5 {
                };
        };
 
+       tcpci_int_pins: tcpci-int-pins {
+               pins-int-n {
+                       pinmux = <PINMUX_GPIO12__FUNC_B_GPIO12>;
+                       bias-pull-up;
+                       input-enable;
+               };
+       };
+
        uart0_pins: uart0-pins {
                pins {
                        pinmux = <PINMUX_GPIO31__FUNC_O_UTXD0>,
                };
        };
 
+       usb2_default_pins: usb2-default-pins {
+               pins-iddig {
+                       pinmux = <PINMUX_GPIO89__FUNC_B_GPIO89>;
+                       input-enable;
+                       bias-pull-up;
+               };
+       };
+
        wifi_pwrseq_pins: wifi-pwrseq-pins {
                pins-wifi-enable {
                        pinmux = <PINMUX_GPIO127__FUNC_B_GPIO127>;
 };
 
 &ssusb0 {
-       dr_mode = "host";
+       dr_mode = "otg";
+       maximum-speed = "high-speed";
+       usb-role-switch;
+       wakeup-source;
        vusb33-supply = <&mt6359_vusb_ldo_reg>;
+       pinctrl-0 = <&usb_default_pins>;
+       pinctrl-names = "default";
        status = "okay";
+
+       connector {
+               compatible = "gpio-usb-b-connector", "usb-b-connector";
+               type = "micro";
+               id-gpios = <&pio 83 GPIO_ACTIVE_HIGH>;
+               vbus-supply = <&usb_p0_vbus>;
+       };
 };
 
 &xhci0 {
 };
 
 &ssusb1 {
-       dr_mode = "host";
+       dr_mode = "otg";
+       usb-role-switch;
+       wakeup-source;
        vusb33-supply = <&mt6359_vusb_ldo_reg>;
+       pinctrl-0 = <&usb1_default_pins>;
+       pinctrl-names = "default";
        status = "okay";
+
+       port {
+               mtu3_hs1_role_sw: endpoint {
+                       remote-endpoint = <&typec_con_hs>;
+               };
+       };
 };
 
 &xhci1 {
        status = "okay";
-       vdd-supply = <&usb_hub_fixed_3v3>;
        vusb33-supply = <&mt6359_vusb_ldo_reg>;
        #address-cells = <1>;
        #size-cells = <0>;
 };
 
 &ssusb2 {
-       interrupts-extended = <&gic GIC_SPI 536 IRQ_TYPE_LEVEL_HIGH 0>,
-                             <&pio 220 IRQ_TYPE_LEVEL_HIGH>;
-       interrupt-names = "host", "wakeup";
-
-       dr_mode = "host";
+       dr_mode = "otg";
+       maximum-speed = "high-speed";
+       usb-role-switch;
        vusb33-supply = <&mt6359_vusb_ldo_reg>;
+       wakeup-source;
+       pinctrl-names = "default";
+       pinctrl-0 = <&usb2_default_pins>;
        status = "okay";
+
+       connector {
+               compatible = "gpio-usb-b-connector", "usb-b-connector";
+               type = "micro";
+               id-gpios = <&pio 89 GPIO_ACTIVE_HIGH>;
+               vbus-supply = <&usb_p2_vbus>;
+       };
 };
 
 &xhci2 {
-       status = "okay";
        vusb33-supply = <&mt6359_vusb_ldo_reg>;
        vbus-supply = <&sdio_fixed_3v3>; /* wifi_3v3 */
+       status = "okay";
 };