From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tonymac32 <tonymckahan@gmail.com>
Date: Wed, 17 Feb 2021 00:54:00 -0500
Subject: Patching something

Signed-off-by: tonymac32 <tonymckahan@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts | 96 ++++++++++
 1 file changed, 96 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
index 111111111111..222222222222 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
@@ -9,6 +9,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/usb/pd.h>
 #include "rk3399-nanopi4.dtsi"
 
 / {
@@ -66,6 +67,12 @@ fan: pwm-fan {
 	};
 };
 
+&cdn_dp {
+	status = "okay";
+	extcon = <&fusb0>;
+	phys = <&tcphy0_dp>;
+};
+
 &cpu_thermal {
 	trips {
 		cpu_warm: cpu_warm {
@@ -94,6 +101,50 @@ map3 {
 	};
 };
 
+&fusb0 {
+
+	connector {
+		compatible = "usb-c-connector";
+		label = "USB-C";
+		power-role = "dual";
+		data-role = "dual";
+		try-power-role = "sink";
+		source-pdos = <PDO_FIXED(5000, 1200, PDO_FIXED_USB_COMM)>;
+		sink-pdos = <PDO_FIXED(5000, 500, PDO_FIXED_USB_COMM)>;
+		op-sink-microwatt = <5000000>;
+		
+		extcon-cables = <1 2 5 6 9 10 12 44>;
+		typec-altmodes = <0xff01 1 0x001c0000 1>;
+		
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			port@0 {
+				reg = <0>;
+				usb_con_hs: endpoint {
+					remote-endpoint = 
+						<&u2phy0_typec_hs>;
+				};
+			};
+			port@1 {
+				reg = <1>;
+
+				usb_con_ss: endpoint {
+					remote-endpoint = 
+						<&tcphy0_typec_ss>;
+				};
+			};
+			port@2 {
+				reg = <2>;
+				usb_con_dp: endpoint {
+					remote-endpoint = 
+						<&tcphy0_typec_dp>;
+				};
+			};
+		};
+	};		
+};
+
 &pcie0 {
 	ep-gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>;
 	num-lanes = <4>;
@@ -114,12 +165,57 @@ &sdhci {
 	mmc-hs400-enhanced-strobe;
 };
 
+&tcphy0 {
+	extcon = <&fusb0>;
+	status = "okay";
+};
+
+&tcphy0_dp {
+	port {
+		tcphy0_typec_dp: endpoint {
+			remote-endpoint = <&usb_con_dp>;
+		};
+	};
+};
+
+&tcphy0_usb3 {
+	port {
+		tcphy0_typec_ss: endpoint {
+			remote-endpoint = <&usb_con_ss>;
+		};
+	};
+};
+
+&u2phy0 {
+	extcon = <&fusb0>;
+};
+
 &u2phy0_host {
 	phy-supply = <&vcc5v0_host0>;
+	status = "okay";
+};
+
+&u2phy0_otg {
+	status = "okay";
+
+	port {
+		u2phy0_typec_hs: endpoint {
+			remote-endpoint = <&usb_con_hs>;
+		};
+	};
 };
 
 &u2phy1_host {
 	phy-supply = <&vcc5v0_host0>;
+	status = "okay";
+};
+
+&u2phy1_otg {
+	status = "okay";
+};
+
+&usbdrd_dwc3_0 {
+	extcon = <&fusb0>;
 };
 
 &vcc5v0_sys {
-- 
Armbian

