From 3d34fd2c2b5d89ae7c9eaf50da256be0d1a8fb89 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sun, 8 Oct 2023 12:36:55 +0200
Subject: [PATCH 412/463] arm64: dts: rk3566-pinetab2: Re-order and use extcon
 bridge

Use my extcon <-> type-c API adapter.

Signed-of-by: Ondrej Jirman <megi@xff.cz>
---
 .../boot/dts/rockchip/rk3566-pinetab2.dtsi    | 59 +++++++++++--------
 1 file changed, 33 insertions(+), 26 deletions(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3566-pinetab2.dtsi b/arch/arm64/boot/dts/rockchip/rk3566-pinetab2.dtsi
index f3b76cb3b1e3f..b5d5a17909466 100644
--- a/arch/arm64/boot/dts/rockchip/rk3566-pinetab2.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3566-pinetab2.dtsi
@@ -239,6 +239,13 @@ vdd1v2_dvp: vdd1v2-dvp-regulator {
 		regulator-max-microvolt = <1200000>;
 		vin-supply = <&vcc_3v3>;
 	};
+
+	typec_extcon_bridge: typec-extcon {
+		compatible = "linux,typec-extcon-bridge";
+		usb-role-switch;
+		orientation-switch;
+		mode-switch;
+	};
 };
 
 &combphy1 {
@@ -886,39 +893,34 @@ &uart2 {
 	status = "okay";
 };
 
-&usb_host0_ehci {
+&usb2phy0 {
 	status = "okay";
+	extcon = <&typec_extcon_bridge>;
+	extcon,ignore-usb;
 };
 
-&usb_host0_ohci {
+&usb2phy1 {
 	status = "okay";
 };
 
-&usb_host1_ehci {
-	status = "okay";
-};
+/* POGO USB host port */
 
-&usb_host1_ohci {
+&usb_host0_ehci {
 	status = "okay";
 };
 
-/* OTG port controller */
-&usb_host0_xhci {
-	usb-role-switch;
+&usb_host0_ohci {
 	status = "okay";
-
-	port {
-		usb_host0_xhci_typec_hs: endpoint {
-			remote-endpoint = <&typec_hs_usb_host0_xhci>;
-		};
-	};
 };
 
-&usb_host1_xhci {
+&usb2phy1_otg {
+	phy-supply = <&vcc5v0_usb_host2>;
 	status = "okay";
 };
 
-&usb2phy0 {
+/* Top USB3.0 host only port */
+
+&usb_host1_xhci {
 	status = "okay";
 };
 
@@ -927,17 +929,20 @@ &usb2phy0_host {
 	status = "okay";
 };
 
-/* OTG port phy */
-&usb2phy0_otg {
-	status = "okay";
-};
+/* Bottom USB2.0 only OTG port */
 
-&usb2phy1 {
+&usb_host0_xhci {
 	status = "okay";
+	extcon = <&typec_extcon_bridge>;
+
+	port {
+		usb_host0_xhci_typec_hs: endpoint {
+			remote-endpoint = <&typec_hs_usb_host0_xhci>;
+		};
+	};
 };
 
-&usb2phy1_otg {
-	phy-supply = <&vcc5v0_usb_host2>;
+&usb2phy0_otg {
 	status = "okay";
 };
 
@@ -974,8 +979,8 @@ usbc0: usb-typec@4e {
 		pinctrl-names = "default";
 		pinctrl-0 = <&usbcc_int_l>;
 		vbus-supply = <&vbus>;
-		usb-role-switch = <&usb_host0_xhci>;
-		extcon = <&usb2phy0>;
+		extcon = <&typec_extcon_bridge>;
+		usb-role-switch = <&typec_extcon_bridge>;
 
 		connector {
 			compatible = "usb-c-connector";
@@ -986,6 +991,8 @@ connector {
 			op-sink-microwatt = <2500000>;
 			sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
 			source-pdos = <PDO_FIXED(5000, 500, PDO_FIXED_USB_COMM)>;
+			mode-switch = <&typec_extcon_bridge>;
+			orientation-switch = <&typec_extcon_bridge>;
 
 			ports {
 				#address-cells = <1>;
-- 
2.46.0

