From 85321831353304bd8d8e63bf59f7e5b02694b6c6 Mon Sep 17 00:00:00 2001
From: Sergey Larin <cerg2010cerg2010@mail.ru>
Date: Thu, 7 Feb 2019 13:33:31 +0300
Subject: [PATCH] ARM: dts: tegra20-glide: fix USB gadget mode

This commit makes USB gadget mode working by changing mode from
OTG to peripherial and specifying vbus regulator.

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

diff --git a/arch/arm/boot/dts/tegra20-glide.dts b/arch/arm/boot/dts/tegra20-glide.dts
index 93a4f50f0710..c582512936a6 100644
--- a/arch/arm/boot/dts/tegra20-glide.dts
+++ b/arch/arm/boot/dts/tegra20-glide.dts
@@ -655,7 +655,7 @@
 					regulator-max-microvolt = <1800000>;
 				};
 
-				ldo4 {
+				vbus1_reg: ldo4 {
 					regulator-name = "nvvdd_ldo4,vap_usb_3v3";
 					regulator-min-microvolt = <3300000>;
 					regulator-max-microvolt = <3300000>;
@@ -1107,18 +1107,18 @@
 		nvidia,lp0-vec = <0x1819E000 8192>;
 	};
 
-	// Enabling this makes device to hang at boot
-#if 0
 	usb@c5000000 {
 		compatible = "nvidia,tegra20-udc";
 		status = "okay";
-		dr_mode = "otg";
+		dr_mode = "peripheral"; // otg
 	};
 
 	usb-phy@c5000000 {
 		status = "okay";
+		vbus-supply = <&vbus1_reg>;
 	};
 
+#if 0
 	usb@c5004000 {
 		status = "okay";
 	};
@@ -1127,6 +1127,7 @@
 		status = "okay";
 	};
 #endif
+
 	wifi_pwrseq: bcm4330_pwrseq {
 		compatible = "mmc-pwrseq-simple";
 		clocks = <&tegra_car TEGRA20_CLK_BLINK>;
-- 
2.22.0

