USB port issues on a TX2 custom board

Hi,

Indeed, there are many topics, related to USB problems on custom boards, on this forum, and I’ve reviewed quite a few of them. In addition I’ve reviewed the USB section on “platform adaptation and bring-up guide” document, but didn’t manage to overcome this problem.

Regarding USB, the custom boards is similar in characteristics to the TX2 development kit, and contains a single USB3 port and a single USB2 port with OTG.

My SW configuration is:

  1. Jetpack 4.2.1
  2. L4T 32.2

I’ll start with describing what is the current status, and later on provide information about my configuration.
The output of ‘lsusb -t’ is:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=tegra-xusb/3p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=tegra-xusb/4p, 480M

Trying to connect a small hub with keyboard & mouse to the usb3 port yields the following output on dmesg:

[  150.266029] tegra-xusb 3530000.xhci: exiting ELPG
[  150.270895] tegra-xusb 3530000.xhci: Firmware timestamp: 2018-12-26 10:30:04 UTC, Version: 55.12 release
[  150.272239] tegra-xusb 3530000.xhci: exiting ELPG done
[b][  150.499160] usb 1-2: new full-speed USB device number 2 using tegra-xusb
[  150.499834] usb 1-2: Device not responding to setup address.
[  150.711794] usb 1-2: Device not responding to setup address.
[  150.923129] usb 1-2: device not accepting address 2, error -71
[  151.047085] usb 1-2: new full-speed USB device number 3 using tegra-xusb
[  151.047759] usb 1-2: Device not responding to setup address.
[  151.259744] usb 1-2: Device not responding to setup address.
[  151.471063] usb 1-2: device not accepting address 3, error -71[/b]
[  151.477245] usb usb1-port2: attempt power cycle
[  153.575741] usb usb1: usb_suspend_both: status 0
[  153.575801] tegra-xusb 3530000.xhci: entering ELPG
[  153.580364] tegra-xusb 3530000.xhci: entering ELPG done

BTW, when I connect the same to the USB2 port, I only see the ELPG exit & entry messages.

For your reference I’m attaching the complete kernel initialization log and schematics of the USB.

Device tree configuration:

The custom board doesn’t include the GPIO expander, as in the TX2 development kit, so I’ve applied the recommended changes to tegra186-quill-power-tree-p3310-1000-a00-00.dtsi.

As for USB lane mapping I’m using the default configuration and OMDATA is set to 0x1090000 in p2771-0000.conf.common.

Following is the relevant configuration from tegra186-quill-p3310-1000-a00-00-base.dts:

#if TEGRA_XUSB_PADCONTROL_VERSION >= DT_VERSION_2
	xhci@3530000 {
		status = "okay";
		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}>,
			<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-1}>;
		phy-names = "usb2-0", "usb2-1", "usb2-2", "usb3-1";
	};
#else
	xhci@3530000 {
		status = "okay";
		phys = <&tegra_xusb_padctl TEGRA_PADCTL_PHY_UTMI_P(0)>,
			<&tegra_xusb_padctl TEGRA_PADCTL_PHY_UTMI_P(1)>,
			<&tegra_xusb_padctl TEGRA_PADCTL_PHY_USB3_P(1)>;
		phy-names = "utmi-0", "utmi-1", "usb3-1";
		nvidia,boost_cpu_freq = <800>;
	};
#endif

#if TEGRA_XUSB_PADCONTROL_VERSION >= DT_VERSION_2
	xusb_padctl@3520000 {
		status = "okay";
		pinctrl-0 = <&vbus_en0_default_state>;
		pinctrl-1 = <&vbus_en1_default_state>;
		pinctrl-2 = <&vbus_en0_sfio_tristate_state>;
		pinctrl-3 = <&vbus_en1_sfio_tristate_state>;
		pinctrl-4 = <&vbus_en0_sfio_passthrough_state>;
		pinctrl-5 = <&vbus_en1_sfio_passthrough_state>;
		pinctrl-names = "vbus_en0_default", "vbus_en1_default",
			"vbus_en0_sfio_tristate", "vbus_en1_sfio_tristate",
			"vbus_en0_sfio_passthrough", "vbus_en1_sfio_passthrough";

		pads {
			usb2 {
				lanes {
					usb2-0 {
						nvidia,function = "xusb";
						status = "okay";
					};
					usb2-1 {
						nvidia,function = "xusb";
						status = "okay";
					};
					usb2-2 {
						nvidia,function = "xusb";
						status = "okay";
					};
				};
			};
			usb3 {
				lanes {
					usb3-0 {
						nvidia,function = "xusb";
						status = "okay";
					};
					usb3-1 {
						nvidia,function = "xusb";
						status = "okay";
					};
					usb3-2 {
						nvidia,function = "xusb";
						status = "okay";
					};
				};
			};
		};

		ports {
			usb2-0 {
				status = "okay";
				mode = "otg";
				vbus-supply = <&vdd_usb0_5v>;
				nvidia,oc-pin = <0>;
			};
			usb2-1 {
				status = "okay";
				mode = "host";
				vbus-supply = <&vdd_usb1_5v>;
				nvidia,oc-pin = <1>;
			};
			usb2-2 {
				status = "okay";
				mode = "host";
				<b>vbus-supply = <&battery_reg>;</b>
			};
			usb3-0 {
				nvidia,usb2-companion = <2>;
			};
			usb3-1 {
				nvidia,usb2-companion = <1>;
				status = "okay";
			};
		};
	};
#endif
	pinctrl@3520000 {
		status = "okay";
		pinctrl-0 = <&tegra_xusb_padctl_pinmux_default>;
		pinctrl-1 = <&vbus_en0_sfio_tristate_state>;
		pinctrl-2 = <&vbus_en1_sfio_tristate_state>;
		pinctrl-3 = <&vbus_en0_sfio_passthrough_state>;
		pinctrl-4 = <&vbus_en1_sfio_passthrough_state>;
		pinctrl-5 = <&vbus_en0_default_state>;
		pinctrl-6 = <&vbus_en1_default_state>;
		pinctrl-names = "default",
			"vbus_en0_sfio_tristate", "vbus_en1_sfio_tristate",
			"vbus_en0_sfio_passthrough", "vbus_en1_sfio_passthrough",
			"vbus_en0_default", "vbus_en1_default";
		tegra_xusb_padctl_pinmux_default: pinmux {
			/* Quill does not support usb3-micro AB */
			usb2-micro-AB {
				nvidia,lanes = "otg-0";
				nvidia,function = "xusb";
				nvidia,port-cap = <TEGRA_PADCTL_PORT_OTG_CAP>;
				nvidia,oc-pin = <0>;
			};
			usb2-std-A-port2 {
				nvidia,lanes = "otg-1";
				nvidia,function = "xusb";
				nvidia,port-cap = <TEGRA_PADCTL_PORT_HOST_ONLY>;
				nvidia,oc-pin = <1>;
			};
			usb3-std-A-port2 {
				nvidia,lanes = "usb3-1";
				nvidia,port-cap = <TEGRA_PADCTL_PORT_HOST_ONLY>;
				nvidia,oc-pin = <1>;
			};

			e3325-usb3-std-A-HS {
				nvidia,lanes = "otg-2";
				nvidia,function = "xusb";
				nvidia,port-cap = <TEGRA_PADCTL_PORT_HOST_ONLY>;
				status = "disabled";
			};

			e3325-usb3-std-A-SS {
				nvidia,lanes = "usb3-0";
				nvidia,port-cap = <TEGRA_PADCTL_PORT_HOST_ONLY>;
				status = "disabled";
			};
		};
	};

The above is basically the default configuration except one modification where I updated the ‘vbus-supply’ for usb2-2 to battery_reg, as it was using vdd_usb2_5v.

I verified that plugin-manager doesn’t override my configuration.

I require your help in verifying if the DT configuration is OK and whether the failure I observe is related to some other missing configuration or an issue with the HW.

Looking forward to a response that would hopefully provide some clarifications.

Thanks in advance,
Eli.
usb_schematics.pdf (37.1 KB)
dmesg.txt (60.3 KB)

Hi,
In xusb_padctl@3520000, it shows two USB3 type A port. One pair is usb3-0+usb2-2 and the other is usb3-1+usb2-1. However, usb3-0 is not enabled in xhci@3530000. Please check this.

Hi DaneLLL,

My initial configuration was actually different and, in my opinion, described the HW better. Following is the configuration I used in tegra186-quill-p3310-1000-a00-00-base.dts:

#if TEGRA_XUSB_PADCONTROL_VERSION >= DT_VERSION_2
	xhci@3530000 {
		status = "okay";
		phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>,
			<&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-1}>,
			<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-1}>;
		phy-names = "usb2-0", "usb2-1", "usb3-1";
	};
#else
	xhci@3530000 {
		status = "okay";
		phys = <&tegra_xusb_padctl TEGRA_PADCTL_PHY_UTMI_P(0)>,
			<&tegra_xusb_padctl TEGRA_PADCTL_PHY_UTMI_P(1)>,
			<&tegra_xusb_padctl TEGRA_PADCTL_PHY_USB3_P(1)>;
		phy-names = "utmi-0", "utmi-1", "usb3-1";
		nvidia,boost_cpu_freq = <800>;
	};
#endif

#if TEGRA_XUSB_PADCONTROL_VERSION >= DT_VERSION_2
	xusb_padctl@3520000 {
		status = "okay";
		pinctrl-0 = <&vbus_en0_default_state>;
		pinctrl-1 = <&vbus_en1_default_state>;
		pinctrl-2 = <&vbus_en0_sfio_tristate_state>;
		pinctrl-3 = <&vbus_en1_sfio_tristate_state>;
		pinctrl-4 = <&vbus_en0_sfio_passthrough_state>;
		pinctrl-5 = <&vbus_en1_sfio_passthrough_state>;
		pinctrl-names = "vbus_en0_default", "vbus_en1_default",
			"vbus_en0_sfio_tristate", "vbus_en1_sfio_tristate",
			"vbus_en0_sfio_passthrough", "vbus_en1_sfio_passthrough";

		pads {
			usb2 {
				lanes {
					usb2-0 {
						nvidia,function = "xusb";
						status = "okay";
					};
					usb2-1 {
						nvidia,function = "xusb";
						status = "okay";
					};
				};
			};
			usb3 {
				lanes {
					usb3-1 {
						nvidia,function = "xusb";
						status = "okay";
					};
				};
			};
		};

		ports {
			usb2-0 {
				status = "okay";
				mode = "otg";
				vbus-supply = <&vdd_usb0_5v>;
				nvidia,oc-pin = <0>;
			};
			usb2-1 {
				status = "okay";
				mode = "host";
				vbus-supply = <&vdd_usb1_5v>;
				nvidia,oc-pin = <1>;
			};
			usb3-1 {
				nvidia,usb2-companion = <1>;
				status = "okay";
			};
		};
	};
#endif
	pinctrl@3520000 {
		status = "okay";
		pinctrl-0 = <&tegra_xusb_padctl_pinmux_default>;
		pinctrl-1 = <&vbus_en0_sfio_tristate_state>;
		pinctrl-2 = <&vbus_en1_sfio_tristate_state>;
		pinctrl-3 = <&vbus_en0_sfio_passthrough_state>;
		pinctrl-4 = <&vbus_en1_sfio_passthrough_state>;
		pinctrl-5 = <&vbus_en0_default_state>;
		pinctrl-6 = <&vbus_en1_default_state>;
		pinctrl-names = "default",
			"vbus_en0_sfio_tristate", "vbus_en1_sfio_tristate",
			"vbus_en0_sfio_passthrough", "vbus_en1_sfio_passthrough",
			"vbus_en0_default", "vbus_en1_default";
		tegra_xusb_padctl_pinmux_default: pinmux {
			/* Quill does not support usb3-micro AB */
			usb2-micro-AB {
				nvidia,lanes = "otg-0";
				nvidia,function = "xusb";
				nvidia,port-cap = <TEGRA_PADCTL_PORT_OTG_CAP>;
				nvidia,oc-pin = <0>;
			};
			usb2-std-A-port2 {
				nvidia,lanes = "otg-1";
				nvidia,function = "xusb";
				nvidia,port-cap = <TEGRA_PADCTL_PORT_HOST_ONLY>;
				nvidia,oc-pin = <1>;
			};
			usb3-std-A-port2 {
				nvidia,lanes = "usb3-1";
				nvidia,port-cap = <TEGRA_PADCTL_PORT_HOST_ONLY>;
				nvidia,oc-pin = <1>;
			};
		};
	};

As you can see there is no definition of usb3-0 and also usb2-2, which is not relevant as well. The above configuration ends with no root hubs and ‘lsusb’ returns with no devices.

Looking at the kernel log, there is the following entry:

[    1.026709] tegra-xusb-padctl 3520000.xusb_padctl: failed to setup XUSB ports: -19

BTW, with the configuration in this comment the TX2 dev-kit behaves the same as our custom board and USB is not functioning, however with the configuration in my first post, USB is functioning OK in the TX2 dev-kit but not on our custom board.
It is not clear to me, why the first configuration is working on the TX2 dev-kit on the first place. To my understanding, it doesn’t describe well the HW configuration, but obviously I’m missing something. I hope you could clarify that.

Thanks for you prompt response.

Eli.

Hi,
Please refer to
https://devtalk.nvidia.com/default/topic/1057885/jetson-tx2/usb-not-working-in-jetson-tx2-r32-2/post/5364464/#5364464

If you use default config #2 on your custom board, the failure can be due to wrong ‘vbus-supply’, or VBUS is turned on too early. It is suggested be turned on after booting to kernel.

Hi DaneLLL,

Following the configuration that you have linked, I can say that I’ve returned to the initial state. I see USB2 & USB3 root hubs but can’t connect anything.

My assumption is that from software configuration POV, my current configuration is OK. Can you please confirm that?

When you say “wrong ‘vbus-supply’”, do you suggest to check the supply on the HW level?
Can you please refer me to more information regarding the timing of the regulator and how to control it?

Eli.

Hi,
Yes, if device tree is confirms to be correct, suggest you check VBUS. After booting to desktop, you can open a console and use xxd to check device tree. An example of using xxd:
https://devtalk.nvidia.com/default/topic/1064834/jetson-tx2/usb-doesn-t-work-on-custom-board/post/5393437/#5393437

For checking VBUS, you can try hardware reset and see if enumeration is triggered. Below is a similar case:
https://devtalk.nvidia.com/default/topic/1043644/jetson-tx2/usb1-and-installing-kernel-modules-for-lte-modem/post/5294983/#5294983

Hi DaneLLL,

Does the following make sense?

xxd /proc/device-tree/xusb_padctl@3520000/ports/usb2-0/vbus-supply
00000000: 0000 00b0
xxd /proc/device-tree/xusb_padctl@3520000/ports/usb2-1/vbus-supply
00000000: 0000 00b1

I’m trying to control the following enable gpios for VUBS:

  • gpio-412 - vdd-usb0-5v
  • gpio-413 - vdd-usb1-5v
  • However I have a permission issue, as these gpios are probably owned by some other driver.

    Thanks,
    Eli.

    Hi eliz,

    Could you find out which pins are 412 and 413? You could then search which driver is using it in device tree.
    You could also try to find other gpios.

    Hi WayneWWW,

    First, after the comment regarding the VBUS power timing and further investigation on our side it seems like the board I’m using is patched in a way that the power supplies (vdd-usb0-5v & vdd-usb1-5v) are constantly on from the moment you plug the board to wall power. So, there is currently no point in trying to toggle USB_VBUS_EN0 or USB_VBUS_EN1.
    The HW will be reset to its initial design, as indicated in the schematic I’ve uploaded, and then I’ll try again.

    Regarding your question, the pins are as follows:

  • Pin A17 is connected to USB_VBUS_EN0, which relates to vdd-usb0-5v
  • Pin A18 is connected to USB_VBUS_EN1, which relates to vdd-usb1-5v
  • I took the information about gpios from /sys/kernel/debug/gpio:

    ...
    gpiochip0: GPIOs 320-511, parent: platform/2200000.gpio, tegra-gpio:
     gpio-381 (                    |reset_gpio          ) out lo    
     <b>gpio-412 (                    |vdd-usb0-5v         ) out lo</b>   
     <b>gpio-413 (                    |vdd-usb1-5v         ) out lo</b>  
    ...
    

    Am I missing something?

    In addition, Following the info from https://elinux.org/Jetson/TX2_USB, It seemed like the plugin manager was not overriding my configuration, based on dmesg output. However, when I reviewed the device-tree from Linux it seems different from my configuration. For example, the value of ‘/proc/device-tree/xhci@3530000/phy-names’ was similar to one of the overrides in plugin manager and not like my configuration. I ended up with modifying tegra186-quill-p3310-1000-a00-plugin-manager.dtsi to be aligned with tegra186-quill-p3310-1000-a00-00-base.dts.
    Does it make any sense?
    I must say that even with this inconsistency (before I modified the plugin manager), it was working on Tx2 development kit.

    Anyway, I’ll update after I get the updated HW.

    Thanks for the support so far,
    Eli.

    Hi,
    It is possible plugin-manager overrides certain configuration, so suggest disable it and confirm the correctness via ‘xxd’.
    https://elinux.org/Jetson/TX2_USB#USB-Lane_Mapping

    Please be careful that the plugin-manager log only shows up in dmesg in rel-28 release.

    After rel-31, it has been moved to bootloader so dmesg would not tell you. I just added this note to the elinux page.

    Thanks WayneWWW, I think your comment is important and will prevent confusion to others as well.
    BTW, I couldn’t just comment out a complete fragment from the plugin dtsi file, as recommended in the same web page. Once I did it, I kind of lost the USB at all (i.e. lsusb didn’t even display the root hubs). I ended up with aligning it with my configuration.

    I’m still waiting to get the updated HW, so don’t have an answer on the main matter yet.

    Thanks,
    Eli.

    Good news!
    The updated HW was finally tested and we have the USB3 port up and running.
    The modification on the HW side was just to add the power switches, which are controlled by USB_VBUS_EN0 & USB_VBUS_EN1 signals. This is due to the comment on having VBUS turned on to early.

    We still have an issue with the USB2 port that is configured as OTG. The HW team reports that they don’t see any toggling of USB_VBUS_EN0 which is an input to the power switch. While they are still checking if it is a HW issue, do you guys have any recommendation of what or where to look?
    Is there something in the device tree configuration that I should verify?

    Many thanks for your support so far.
    Eli.

    Hi,
    Here is a post about disabling OTG. FYR.

    Hello DaneLLL and WayneWWW,

    I’m working with Eli (eliz) on this issue, and would like to possibly clarify what we are experiencing right now, as Eli is abroad at the moment.

    At the moment we are unsure regarding the need of OTG on this port, but in case it won’t be needed we will definitely disable it. That said, I would like to explain what we are seeing currently.

    With the current device tree Eli defined based on your inputs and recommendations, we now have up to super speed communication on the USB3 enabled port. This is a major milestone. However, the USB2/OTG port does not function properly. When connecting a device, the device does receive power, however, there is no notable handshaking registered by the Linux system (i.e., nothing is reported to dmesg, and of course the device is not listed).

    One things to point out is that HW replaced a component so that power will be passed to port when EN signal is low instead of high, otherwise the connected devices wouldn’t even get power.

    Any suggestions as to what might prevent detection of USB device connections to this port?

    Hi,
    Please check [For an OTG (On-The-GO) Port] in adaptation guide and modify extcon accordingly.

    vbus_id_extcon: extcon@1 {
            compatible = "extcon-gpio-states";
            reg = <0x1>;
            extcon-gpio,name = "VBUS";
            extcon-gpio,wait-for-gpio-scan = <0>;
            extcon-gpio,cable-states = <0x3 0x0
                                        0x0 0x2
                                        0x1 0x2
                                        0x2 0x1>;
            gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(X, 7) 0 &spmic 0 0>;
            extcon-gpio,out-cable-names = <EXTCON_USB EXTCON_USB_Host EXTCON_NONE>;
            wakeup-source;
            #extcon-cells = <1>;
    };
    

    Probably the gpio pin is different.

    Hi,I want to point out that, settings set by xusb_padctl@3520000 node are overwritten by pinctrl@3520000 node. I occured a error " tegra-xusb-padctl 3520000.xusb_padctl: failed to setup XUSB ports: -517". By changing #endif to #else at line before pinctrl@3520000 node and adding #endif to end of pinctrl@3520000 solved my problem.