From 9af18d58ad5b4f5d99bd1ae080d615892dbaee88 Mon Sep 17 00:00:00 2001
From: Sergey Larin <cerg2010cerg2010@mail.ru>
Date: Sat, 23 Feb 2019 21:14:49 +0300
Subject: [PATCH] ARM: dts: tegra20-glide: USB OTG mode and power

OTG mode is now configured for ChipIdea UDC driver, but
I don't have a cable to test it.

Signed-off-by: Sergey Larin <cerg2010cerg2010@mail.ru>
---
 arch/arm/boot/dts/tegra20-glide.dts | 30 ++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/tegra20-glide.dts b/arch/arm/boot/dts/tegra20-glide.dts
index 751c67924310..aa6cb3a78b2d 100644
--- a/arch/arm/boot/dts/tegra20-glide.dts
+++ b/arch/arm/boot/dts/tegra20-glide.dts
@@ -589,7 +589,7 @@
 
 			maxim,system-power-controller;
 
-			mbatt-supply = <&usb0_vbus_reg>;
+			mbatt-supply = <&pmic_reg>;
 			in-v1-supply = <&mbatt_reg>;
 			in-v2-supply = <&mbatt_reg>;
 			in-v3-supply = <&mbatt_reg>;
@@ -666,7 +666,7 @@
 					regulator-max-microvolt = <1800000>;
 				};
 
-				vbus1_reg: ldo4 {
+				usb_phy_reg: ldo4 {
 					regulator-name = "nvvdd_ldo4,vap_usb_3v3";
 					regulator-min-microvolt = <3300000>;
 					regulator-max-microvolt = <3300000>;
@@ -1147,12 +1147,13 @@
 	usb@c5000000 {
 		compatible = "nvidia,tegra20-udc";
 		status = "okay";
-		dr_mode = "peripheral"; // otg
+		dr_mode = "otg";
+		vbus-supply = <&vbus_reg>;
 	};
 
 	usb-phy@c5000000 {
 		status = "okay";
-		vbus-supply = <&vbus1_reg>;
+		vbus-supply = <&usb_phy_reg>;
 	};
 
 #if 0
@@ -1305,7 +1306,7 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		usb0_vbus_reg: regulator@0 {
+		pmic_reg: regulator@0 {
 			compatible = "regulator-fixed";
 			reg = <0>;
 			regulator-name = "usb0_vbus";
@@ -1315,25 +1316,36 @@
 			regulator-boot-on;
 		};
 
-		vdd_5v0_hdmi: regulator@4 {
+		vdd_5v0_hdmi: regulator@1 {
 			compatible = "regulator-fixed";
-			reg = <4>;
+			reg = <1>;
 			regulator-name = "+5V_HDMI_CON";
 			regulator-min-microvolt = <5000000>;
 			regulator-max-microvolt = <5000000>;
 		};
 
-		vdd_hdmi_ldo: regulator@5 {
+		vdd_hdmi_ldo: regulator@2 {
 			compatible = "regulator-fixed";
-			reg = <5>;
+			reg = <2>;
 			regulator-name = "vdd-hdmi-ldo";
 			regulator-min-microvolt = <1200000>;
 			regulator-max-microvolt = <1200000>;
 			gpio = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_HIGH>;
 			enable-active-high;
 		};
+
+		vbus_reg: regulator@3 {
+			compatible = "regulator-fixed";
+			reg = <3>;
+			regulator-name = "otg-en";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			gpio = <&gpio TEGRA_GPIO(R, 7) GPIO_ACTIVE_HIGH>;
+			enable-active-high;
+		};
 	};
 
+
 	sound {
 		compatible = "nvidia,tegra-audio-wm8994";
 		nvidia,model = "wm8994-aif1";
-- 
2.22.0