How to realize usb otg when use Jetpack 5.1

Hello, everyone,
Now i want to use the new jetpack(5.2.1), but i find it changed which implements USB-OTG compared with the jetpack(4.6.x). I do something the following guide:

change DTS file xxx/tegra194-p3668-0001-p3509-0000.dts , just added following

 xusb_padctl: xusb_padctl@3520000 {
 
                  ports {
                         usb2-0 {
                                 mode = "otg";
                                 status = "okay";
                                 usb-role-switch;
                                 connector {
                                         compatible = "usb-b-connector", "gpio-usb-b-connector";
                                          label = "micro-USB";
                                          type = "micro";
                                          vbus-gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Z, 1) GPIO_ACTIVE_LOW>;
                                          id-gpio = <&tegra_aon_gpio TEGRA194_AON_GPIO(CC, 0) GPIO_ACTIVE_HIGH>;  
                                  };
                          };
                  };
          };

But it can not work correctly, so what should i do next?

Thank you,
Best regards,
ultwcz1997

Hi,
The default setting for micro-b port on Xavier NX developer kit is in

hardware/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-p3668-common.dtsi

You may modify the one directly to fit your custom board. And the ID pin is PCC.00, so please remove this setting to avoid conflict:

                w-disable2 {
                        gpio-hog;
                        output-high;
                        gpios = <TEGRA194_AON_GPIO(CC, 0) GPIO_ACTIVE_LOW>;
                        label = "w-disable2";
                        status = "okay";
                };

Hi DaneLLL,
Thank you for your reply, I will change it in the file ‘hardware/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-p3668-common.dtsi’

But when i compiled and got the last DTB file, i could not find the item which you mentioned before ‘w-disable2’

In DTS file

#if TEGRA_PCIE_VERSION < DT_VERSION_2
	gpio@c2f0000 {
		.....
		w-disable2 {
			gpio-hog;
			output-high;

But in

hardware/nvidia/soc/tegra/kernel-include/dt-bindings/version.h

It shows

#define TEGRA_PCIE_VERSION			DT_VERSION_2

So i think it has not conflict when i use GPIO CC0 as id pin.

Thank you.

BTW, @DaneLLL

sudo cat /sys/kernel/debug/gpio

gpio-317 (PCC.00 |id ) in lo IRQ
gpio-493 (PZ.01 |vbus ) in lo IRQ ACTIVE LOW

PZ.01 is always low, because Vbus is directly connected to VDD-5V.

When i inserted OTG device and dmesg | grep usb, it shows

[  258.010871] tegra-xusb 3610000.xhci: Firmware timestamp: 2022-03-16 11:07:43 UTC, Version: 60.13 release
[  260.650724] tegra-xusb 3610000.xhci: entering ELPG done
[  269.627177] tegra-xusb 3610000.xhci: Firmware timestamp: 2022-03-16 11:07:43 UTC, Version: 60.13 release
[  272.242957] tegra-xusb 3610000.xhci: entering ELPG done
[  284.720704] tegra-xusb 3610000.xhci: Firmware timestamp: 2022-03-16 11:07:43 UTC, Version: 60.13 release
[  286.882585] tegra-xusb 3610000.xhci: entering ELPG done
[  314.916081] tegra-xusb 3610000.xhci: Firmware timestamp: 2022-03-16 11:07:43 UTC, Version: 60.13 release
[  317.093926] tegra-xusb 3610000.xhci: entering ELPG done
[  323.804822] tegra-xusb 3610000.xhci: Firmware timestamp: 2022-03-16 11:07:43 UTC, Version: 60.13 release
[  326.277611] tegra-xusb 3610000.xhci: entering ELPG done

Hi,
It seems like the VBUS_DETECT pin does not work as expected. Please check
Jetson Module Adaptation and Bring-Up: Jetson Xavier NX Series — Jetson Linux Developer Guide documentation

And see if you have similar design as GPIO_M3 and GPIO_Q0 pins in the example.

Hi, @DaneLLL

In the online developer guide, it says:

VBUS_DETECT is initially logical high, then logical low because VBUS is provided by the host controller. Therefore, the state of the VBUS_DETECT pin does not matter when the OTG port is operating in host mode.

So i was confused.

Thank you.

Hi,
The device tree looks fine so it may be an issue in hardware design or hardware signal. If you have confirmed the design is good, please refer to the guidance and do compliance test:
Log in | NVIDIA Developer

For testing purpose, you may try

  1. configure the port to host mode only. See if it works in host mode
  2. Or remove id-gpio to run in device mode only. This is same as Xavier NX carrier board. See if it can enter device mode in the setup

iodOK, i will try to test the hardware.

So the device tree setting is right, only add id-gpio like following,

Thanks.

Hi @DaneLLL
I commented vbus-gpio just now, it works correctly as a host now.

This is not right when used as OTG.

Thank you very much, ^^ ^^.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.