NVIDIA NX disabling USB0 as serial console

I am trying to disable USB0 as a serial console so we can use it as a host and connect devices to it. I tried modifying tegra186-quill-p3310-1000-c03-00-base.dtb and tegra186-quill-p3310-1000-a00-00-base.dtb, and setting the mode of
usb2-0 from otg to host, but that did not seem to do it. Is this even doable? If so, what else do I need to change?

If you re-assigned it as a host, how would you flash and recover?
In any case, you don’t want “quill”, you want p3668. It’s root is in tegra194-p3668-all-p3509-0000.dts.

By default it supports device mode only. Please check product design guide:
https://developer.nvidia.com/jetson-xavier-nx-product-design-guide-v10

You would need to design custom board for enabling OTG. There is a valid usecase on Jetson Nano. Please check

The file for Xavier NX is tegra194-p3668-all-p3509-0000.dts, as gtj mentioned.

My NX module has an SD card so I never had to enter force recovery mode, but you are right. This won’t work for modules that don’t have the SD card.

Thanks for your help. The Nano and the NX are significantly different from each other so what I did was find the NX Adaptation and Bring up document(https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/adaptation_and_bringup_xavier_nx.html) that they recommend looking at and tried to incorporate their recommendations. They use use PQ0 as the ID and PM3 as the VBUS pins. I used PCC3 as the ID and PZ01 as the VBUS. These were my changes to the original file:

diff tegra194-p3668-all-p3509-0000.dts.orig tegra194-p3668-all-p3509-0000.dts.new
new

tegra_xudc: xudc@3550000 {
extcon-cables = <&vbus_id_extcon 0>;
extcon-cable-names = “vbus”;
#extcon-cells = <1>;
phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>;
phy-names = “usb2”;
nvidia,xusb-padctl = <&xusb_padctl>;
nvidia,boost_cpu_freq = <1200>;
status = “okay”;
};

tegra_xhci: xhci@3610000 {
extcon-cables = <&vbus_id_extcon 1>;
extcon-cable-names = “id”;
#extcon-cells = <1>;
phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>;
phy-names = “usb2-0”;
nvidia,xusb-padctl = <&xusb_padctl>;
status = “okay”;
};

old

  compatible = "simple-bus";
  device_type = "external-connection";
  #address-cells = <0x1>;
  #size-cells = <0x0>;

  disp-state {
  	compatible = "extcon-disp-state";
  	#extcon-cells = <0x1>;
  };

  extcon@1 {
  	compatible = "extcon-gpio-states";
  	reg = <0x1>;
  	extcon-gpio,name = "VBUS";
  	extcon-gpio,cable-states = <0x0 0x1 0x1 0x0>;
  	gpios = <0x13 0xc9 0x0>;
  	extcon-gpio,out-cable-names = <0x1 0x2 0x0>;
  	wakeup-source;
  	#extcon-cells = <0x1>;
  	linux,phandle = <0xb1>;
  	phandle = <0xb1>;

new

  vbus_id_extcon: extcon@1 {
			compatible = "extcon-gpio-states";
			extcon-gpio,name = "VBUS_ID";
			extcon-gpio,wait-for-gpio-scan = <0>;
			extcon-gpio,cable-states = <0x3 0x0
            			            0x0 0x2
                                                0x1 0x2
                                                0x2 0x1>;
  	gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Z, 1) 0
        		&tegra_main_gpio TEGRA194_MAIN_GPIO(CC, 3) 0>;
			extcon-gpio,out-cable-names =
                    	<EXTCON_USB EXTCON_USB_HOST EXTCON_NONE>;
			#extcon-cells = <1>;

Attached is my dts file saved as a text file. tegra194-p3668-all-p3509-0000.txt (243.1 KB)
I apologize if I incorporated the changes incorrectly, but this is my first time messing with device trees. Do the changes look correct?

Unfortunately, when I try to generate the dtb file I get the following error:

dtc -I dts -O dtb -o tegra194-p3668-all-p3509-0000.dtb.new tegra194-p3668-all-p3509-0000.dts.new
Error: tegra194-p3668-all-p3509-0000.dts.new:7308.34-35 syntax error
FATAL ERROR: Unable to parse input tree

It looks like it does not like the way the GPIOs are being set (gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Z, 1) ). Is there a mapping for the hex values for the GPIOs? I noticed that the original dts file does not use any functions for setting the values, but the adaptation file does. Thanks for your help!

When you compile a dts outside the kernel tree, you can’t use macros like TEGRA194_MAIN_GPIO
because the kernel make file calls cpp to expand those macros automatically. You have 2 options, get the “sources” packages by running the “source_sync.sh” script from the L4T directory and modify the original source dts and dtsi files on L4T/sources/hardware" then build them, OR find the tegra194-gpio.h file that defines TEGRA194_MAIN_GPIO and reproduce what it does. I can’t look now but IIRC it’s pretty simple to convert.

I was able to do the conversions with the link you provided and got the dtb file to generate properly after making a few changes. Unfortunately, the USB port still does not detect device plugged into it. Attached is my latest file as a txt file: tegra194-p3668-all-p3509-0000.txt (242.6 KB) . I tried to combine the recommended settings from the Jetson Xavier NX Platform Adaptation and Bring-Up and what was there originally since I did not want to mess up the other USB ports. Here are the changes between the original and my new file:
diff tegra194-p3668-all-p3509-0000.dts.new tegra194-p3668-all-p3509-0000.dts.orig
7027,7044c7027,7044
< tegra_xudc: xudc@3550000 {
< compatible = “nvidia,tegra194-xudc”;
< reg = <0x0 0x3550000 0x0 0x8000 0x0 0x3558000 0x0 0x1000>;
< interrupts = <0x0 0xa6 0x4>;
< clocks = <0x4 0x109 0x4 0x115 0x4 0x113 0x4 0x110>;
< iommus = <0x2 0x1c>;
< dma-coherent;
< status = “okay”;
< avdd-usb-supply = <0xad>;
< extcon-cables = <&vbus_id_extcon 0>;
< extcon-cable-names = “vbus”;
< #extcon-cells = <1>;
< phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>;
< phy-names = “usb2”;
< nvidia,xusb-padctl = <0xaf>;
< nvidia,boost_cpu_freq = <0x4b0>;
< linux,phandle = <0x15d>;
< phandle = <0x15d>;

> xudc@3550000 {
> compatible = “nvidia,tegra194-xudc”;
> reg = <0x0 0x3550000 0x0 0x8000 0x0 0x3558000 0x0 0x1000>;
> interrupts = <0x0 0xa6 0x4>;
> clocks = <0x4 0x109 0x4 0x115 0x4 0x113 0x4 0x110>;
> nvidia,xusb-padctl = <0xaf>;
> iommus = <0x2 0x1c>;
> dma-coherent;
> status = “okay”;
> avdd-usb-supply = <0xad>;
> extcon-cables = <0xb1 0x0>;
> extcon-cable-names = “vbus”;
> #extcon-cells = <0x1>;
> phys = <0xb0>;
> phy-names = “usb2”;
> nvidia,boost_cpu_freq = <0x4b0>;
> linux,phandle = <0x15d>;
> phandle = <0x15d>;
7047c7047
< tegra_xhci: xhci@3610000 {

> xhci@3610000 {
7053a7054
> nvidia,xusb-padctl = <0xaf>;
7056,7060c7057,7062
< extcon-cables = <&vbus_id_extcon 1>;
< extcon-cable-names = “id”;
< #extcon-cells = <1>;
< phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0} 0xb2 0xb3 0xb4>;
< phy-names = “usb2-0”, “usb2-1”, “usb2-2”, “usb3-2”;

> status = “okay”;
> extcon-cables = <0xb1 0x1>;
> extcon-cable-names = “id”;
> #extcon-cells = <0x1>;
> phys = <0xb0 0xb2 0xb3 0xb4>;
> phy-names = “usb2-0”, “usb2-1”, “usb2-2”, “usb3-2”;
7063,7065c7065,7066
< nvidia,xusb-padctl = <0xaf>;
< status = “okay”;
< };

> };
>
7279,7290c7280,7300
< vbus_id_extcon: extcon@1 {
< compatible = “extcon-gpio-states”;
< extcon-gpio,name = “VBUS_ID”;
< extcon-gpio,wait-for-gpio-scan = <0>;
< extcon-gpio,cable-states = <0x3 0x0
< 0x0 0x2
< 0x1 0x2
< 0x2 0x1>;
< gpios = <0x13 0xc9 0 0x13 0x13 0>;
< extcon-gpio,out-cable-names =
< <0x1 0x2 0x0>;
< #extcon-cells = <1>;

> compatible = “simple-bus”;
> device_type = “external-connection”;
> #address-cells = <0x1>;
> #size-cells = <0x0>;
>
> disp-state {
> compatible = “extcon-disp-state”;
> #extcon-cells = <0x1>;
> };
>
> extcon@1 {
> compatible = “extcon-gpio-states”;
> reg = <0x1>;
> extcon-gpio,name = “VBUS”;
> extcon-gpio,cable-states = <0x0 0x1 0x1 0x0>;
> gpios = <0x13 0xc9 0x0>;
> extcon-gpio,out-cable-names = <0x1 0x2 0x0>;
> wakeup-source;
> #extcon-cells = <0x1>;
> linux,phandle = <0xb1>;
> phandle = <0xb1>;

I verified and the voltage on the VBUS pin was 0V and on the ID pin it was 1.8V. Any help would be appreciated.

Hi,
The default board is designed for device mode only and is not able to provide VBUS power. It is hardware limitation. You would need to design the custom board with proper VBUS pin.

Dane, when I said “VBUS pin was 0V” I meant the VBUS pin (PZ01) on our NX custom board. But we do provide 5V as VBUS power to the USB connector. The ID pin is connected through a pull up to 1.8V to PCC3 on the NX. Similar to this diagram but with different GPIOS:
A close up of a mapDescription automatically generated

Did you have a chance to look at my device tree? Are my changes correct?

Hi,
Please refer to the patch

diff --git a/common/tegra194-fixed-regulator-p3668.dtsi b/common/tegra194-fixed-regulator-p3668.dtsi
index 6fb7fe1..0f6bcf2 100644
--- a/common/tegra194-fixed-regulator-p3668.dtsi
+++ b/common/tegra194-fixed-regulator-p3668.dtsi
@@ -53,5 +53,15 @@
                        gpio = <&tegra_aon_gpio TEGRA194_AON_GPIO(CC, 2) GPIO_ACTIVE_HIGH>;
                        enable-active-high;
                };
+
+        vdd_usb0_5v: regulator@115 {
+                       compatible = "regulator-fixed";
+                       reg = <115>;
+                       regulator-name = "vdd-usb0-5v";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Z, 1) GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+               };
        };
 };
diff --git a/common/tegra194-p3668-common.dtsi b/common/tegra194-p3668-common.dtsi
index ad05897..256b9cc 100644
--- a/common/tegra194-p3668-common.dtsi
+++ b/common/tegra194-p3668-common.dtsi
@@ -75,21 +75,6 @@
                };
        };

-       external-connection {
-               vbus_id_extcon: extcon@1 {
-                       compatible = "extcon-gpio-states";
-                       reg = <0x1>;
-                       extcon-gpio,name = "VBUS";
-                       extcon-gpio,cable-states = <
-                                               0x0 0x1
-                                               0x1 0x0>;
-                       gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Z, 1) 0>;
-                       extcon-gpio,out-cable-names = <EXTCON_USB EXTCON_USB_HOST EXTCON_NONE>;
-                       wakeup-source;
-                       #extcon-cells = <1>;
-               };
-       };
-
        xusb_padctl: xusb_padctl@3520000 {
                status = "okay";

@@ -122,7 +107,8 @@

                ports {
                        usb2-0 {
-                               mode = "otg";
+                               mode = "host";
+                               vbus-supply = <&vdd_usb0_5v>;
                                status = "okay";
                        };
                        usb2-1 {
@@ -149,13 +135,10 @@
                phy-names = "usb2";
                nvidia,xusb-padctl = <&xusb_padctl>;
                nvidia,boost_cpu_freq = <1200>;
-               status = "okay";
+              status = "disabled";
        };

        tegra_xhci: xhci@3610000 {
-               extcon-cables = <&vbus_id_extcon 1>;
-               extcon-cable-names = "id";
-               #extcon-cells = <1>;
                phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>,
                        <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-1}>,
                        <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-2}>,

My file looks completely different than yours (tegra194-p3668-all-p3509-0000). I could not find tegra194-fixed-regulator-p3668 or tegra194-p3668-common to make the recommended changes. I looked in both the sd card image that is provided by Nvidia and the files generated by the SDK manager.

Hi,
You should see the files in source code package:
https://developer.nvidia.com/embedded/L4T/r32_Release_v4.2/Sources/T186/public_sources.tbz2

Please follow development guide to build device tree.