USB does not working on Jatson AGX Xavier

We had designer carrier board 0n Jatson AGX Xavier and USB function does not working.
our debug process:

  1. compare demo carrier and our board => our carrier board on only USB type A function
  2. disable USB PD controller on demo carrier board=> demo board does not working on USB function
  3. jump USB PD controller to our carrier board=> USB function working
    Can Nvidia team can help this issue?

bill_tu,

Could you share more about your design? Could you tell how many usb port are on your board?

If there is no PD controller on your design, the device tree may need some change for otg function.

Please also share the full dmesg.

Hi WayneWWW

how to mask the PD controller in device tree?

You have to write your own extcon in device tree (if you need to use OTG).

example

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(M, 3) 0
&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 0) 0>;

//GPIO_M3 is VBUS_DETECT pin and GPIO_Q0 is ID pin.
extcon-gpio,out-cable-names = <EXTCON_USB EXTCON_USB_HOST EXTCON_NONE>;
#extcon-cells = <1>;
};

For extcon node, please refer to “kernel/kernel-4.9/Documentation/devicetree/bindings/extcon/extcon-gpio-states.txt”
Since we don’t know your design, we cannot tell what should be the correct value in your extcon node.

After creating this node, please set below property node under xhci/xudc

under xhci

extcon-cables = <&vbus_id_extcon 1>;
    extcon-cable-names = "id";
    #extcon-cells = <1>;

under xudc
 extcon-cables = <&vbus_id_extcon 0>;
    extcon-cable-names = "vbus";
    #extcon-cells = <1>;

Some notes for the property:

extcon-cables: OTG support. Must contains an extcon-cable entry which detects USB ID pin. When the extcon cable state is 0, OTG port will transition to host mode.

extcon-cable-names: Must be “id” for xhci and “vbus” for xudc.

#extcon-cells: Number of cells in extcon specifier. Always should be 1.

If you don’t need OTG, please just remove the extcon related properties under xhci/xudc

hi WayneWWW

Can you tell us what GPIO pin of VBUS_ID on P2822_B03? We will try to write device tree on test it.
By the way, this GPIO pin)VBUS_IS) can be disable USB PD controller? if not, please help to recoomand how to disable PD controller for our new design carried board

Bill

Removed my comments. I will share it later.

bill_tu,

What is the one having the problem now? The USB type A or the micro B with OTG?

For the type A, which has no OTG, if you don’t have PD controller, please just remove the extcon-* properties under xhci and xudc.

You also need to add one regulator for “vbus-supply” under xusb_pad_ctl for some usb2 port which is accompanied by the USB3.0 port.

May I know what is VBUS_ID you are talking about? VBUS Detect pin and ID pin? Is this for your micro B?

HI WayneWWW.

What is the one having the problem now? The USB type A or the micro B with OTG?
-> ANS: Our designal carried board doesn’t working for aLL USB port. After we had jump I2C and power pin from demo board to our carried board then USB issue was be closed.
May I know what is VBUS_ID you are talking about? VBUS Detect pin and ID pin? Is this for your micro B?
–>ANS: our OTG connector use Micro B. VBUS_ID=GPIO30(B55) pin ,VBUS Detect=GPIO10(A62)
By the way, We had check USB port VBUS pin keep 5V on our carried board.

Yes, you are right.
GPIO30 and GPIO10 is what p2822 carrier board using which matches the OEM design guide.

Hi WayneWWW.

For USB issue, Can you help us how to disable USB PD Controller or recommand to solve this issue?

Bill

Hi bill_tu,

As I already told in #9,

For the type A, which has no OTG, if you don’t have PD controller, please just remove the extcon-* properties under xhci and xudc.

You also need to add one regulator for “vbus-supply” under xusb_pad_ctl for some usb2 port which is accompanied by the USB3.0 port.

Hi bill_tu,

Does your USB work now?

Hi WayneWWW.

No, our SW will try solve this issue .

Bill

Hi Bill,

If you need our help, please share latest status with us.

Thanks.

Since you don’t need PD controller and you only have type A usb ports there,which means no otg is needed.

Your device tree need some modification as below.

1. under ucsi_ccg 
        ucsi_ccg: ucsi_ccg@8 {
-            status = "okay";
+           status = "disabled";

2. under xusb_padctl@3520000, make sure mode is set to "host" and usb3 ports need its companion usb2 port.
    xusb_padctl: xusb_padctl@3520000 {
......
        ports {
            usb2-0 {
               mode = "host";
               status = "okay";
            };
            usb3-0 {
		status = "okay";
		nvidia,usb2-companion = <0x0>; //it means the port is coupled with usb2-0
	    };
        };

3. add regulator for vbus-supply
//I don't know how is your hw design this part. You need to add those regulators for them.

+        vdd_usb20_5v0: regulator@115 {
+            compatible = "regulator-fixed";
+            reg = <115>;
+            regulator-name = "vdd-usb20-5v0";
+            regulator-min-microvolt = <5000000>;
+            regulator-max-microvolt = <5000000>;
+            enable-active-high;
+            gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Z, 1) 0>;
+            vin-supply = <&battery_reg>;
+        };

        ports {
            usb2-0 {
-                vbus-supply = <&battery_reg>;
+                vbus-supply = <&vdd_usb20_5v0>;
            };

4. Please just remove all "extcon*" property under xhci@3610000 and xudc@3550000.

Hi WayneWWW

thanks for your step.

i followed your step to modify the device tree and i don’t have otg feature.
but now the system always show the error message.

[  468.481055] usb usb2-port4: cannot disable (err = -32)
[  469.968830] tegra-xusb 3610000.xhci: Cannot set link state.
[  469.969036] usb usb2-port4: cannot disable (err = -32)
[  469.969195] tegra-xusb 3610000.xhci: Cannot set link state.
[  469.969313] usb usb2-port4: cannot disable (err = -32)
[  472.313439] usb 2-4: Device not responding to setup address.
[  472.521413] usb 2-4: Device not responding to setup address.
[  472.728640] usb 2-4: device not accepting address 66, error -71
[  472.728848] tegra-xusb 3610000.xhci: Cannot set link state.
[  472.728994] usb usb2-port4: cannot disable (err = -32)

[  474.216900] tegra-xusb 3610000.xhci: Cannot set link state.
[  474.217099] usb usb2-port4: cannot disable (err = -32)
[  474.217261] tegra-xusb 3610000.xhci: Cannot set link state.
[  474.217378] usb usb2-port4: cannot disable (err = -32)

nvidia@jetson-0424418058605:~$ [  476.561449] usb 2-4: Device not responding to setup address.
[  476.769406] usb 2-4: Device not responding to setup address.
[  476.976634] usb 2-4: device not accepting address 68, error -71
[  476.976859] tegra-xusb 3610000.xhci: Cannot set link state.
[  476.977018] usb usb2-port4: cannot disable (err = -32)

nvidia@jetson-0424418058605:~$ [  478.464874] tegra-xusb 3610000.xhci: Cannot set link state.
[  478.465153] usb usb2-port4: cannot disable (err = -32)
[  478.465334] tegra-xusb 3610000.xhci: Cannot set link state.
[  478.465456] usb usb2-port4: cannot disable (err = -32)

nvidia@jetson-0424418058605:~$ [  480.805508] usb 2-4: Device not responding to setup address.
[  481.013411] usb 2-4: Device not responding to setup address.
[  481.220639] usb 2-4: device not accepting address 70, error -71
[  481.220857] tegra-xusb 3610000.xhci: Cannot set link state.
[  481.221028] usb usb2-port4: cannot disable (err = -32)

nvidia@jetson-0424418058605:~$ [  482.708824] tegra-xusb 3610000.xhci: Cannot set link state.
[  482.709033] usb usb2-port4: cannot disable (err = -32)
[  482.709194] tegra-xusb 3610000.xhci: Cannot set link state.
[  482.709321] usb usb2-port4: cannot disable (err = -32)

nvidia@jetson-0424418058605:~$ [  485.053439] usb 2-4: Device not responding to setup address.
[  485.261460] usb 2-4: Device not responding to setup address.
[  485.468677] usb 2-4: device not accepting address 72, error -71
[  485.468893] tegra-xusb 3610000.xhci: Cannot set link state.
[  485.469060] usb usb2-port4: cannot disable (err = -32)

could you give some suggestion to fix this issue?

Could you share your full dts to us? It is really hard to debug if we don’t have it.

Hi WayneWWW

this is my dtsi for step 2~4

/*
 * Common include DTS file for CVM:P2888-0001 and CVB:P2822-0000 variants.
 *
 * Copyright (c) 2018, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#include "dt-bindings/extcon-ids.h"
#include "dt-bindings/gpio/tegra194-gpio.h"
#include "tegra194-p2888-0000-a00.dtsi"
#include <t19x-common-platforms/tegra194-platforms-eqos.dtsi>
#include "tegra194-p2822-0000-a00.dtsi"
#include "tegra194-power-tree-p2888-0001-p2822-1000.dtsi"
#include <t19x-common-platforms/tegra194-comms.dtsi>
#include "tegra194-thermal-p2888.dtsi"
#include "tegra194-plugin-manager-p2888-0000.dtsi"
#include "tegra194-plugin-manager-p2822-0000.dtsi"
#include "tegra194-super-module-e2614-p2888-0000.dtsi"

/ {
	nvidia,dtsfilename = __FILE__;
	nvidia,dtbbuildtime = __DATE__, __TIME__;
	nvidia,fastboot-usb-vid = <0x0955>;
	nvidia,fastboot-usb-pid = <0xee1e>;

	model = "jetson-xavier";
	compatible = "nvidia,jetson-xavier", "nvidia,tegra194";

	chosen {
		bootargs ="console=ttyTCU0,115200";
		board-has-eeprom;
	};

	firmware {
		android {
			compatible = "android,firmware";
			hardware = "jetson-xavier";
			fstab {
				compatible = "android,fstab";
				vendor {
					compatible = "android,vendor";
					dev = "/dev/block/platform/3460000.sdhci/by-name/vendor";
					type = "ext4";
					mnt_flags = "ro";
					fsmgr_flags = "wait";
				};
				odm {
					compatible = "android,odm";
					dev = "/dev/block/platform/3460000.sdhci/by-name/odm";
					type = "ext4";
					mnt_flags = "ro";
					fsmgr_flags = "wait";
				};
			};
		};
	};

	arm64_ras {
		status = "okay";
	};

	carmel_ras {
		status = "okay";
	};

	spi@3270000 {
		status = "disabled";
	};

	spi@3300000 {
		status = "disabled";
	};

	pmc@c370000 {
		nvidia,invert-interrupt;
	};

	i2c@c240000 {
		ucsi_ccg: ucsi_ccg@8 {
			status = "disabled";
			typec-extcon {
				typec_port0: port-0 {
					status = "okay";
					#extcon-cells = <1>;
				};
				typec_port1: port-1 {
					status = "okay";
					#extcon-cells = <1>;
				};
			};
			typec-pd {
				typec_pd: pd {
					status = "okay";
					#extcon-cells = <1>;
				};
			};
		};
	};

#if TEGRA_XUSB_PADCONTROL_VERSION >= DT_VERSION_2

	xusb_padctl: xusb_padctl@3520000 {
		status = "okay";

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

		ports {
			usb2-0 {
				mode = "host";
				//vbus-supply = <&battery_reg>;
				status = "okay";
			};
			usb2-1 {
				mode = "host";
				status = "okay";
			};
			usb2-2 {
				mode = "host";
				status = "okay";
			};
			usb2-3 {
				mode = "host";
				status = "okay";
			};
			usb3-0 {
				nvidia,usb2-companion = <0x0>;
				status = "okay";
			};
			usb3-2 {
				nvidia,usb2-companion = <0>;
				status = "okay";
			};
			usb3-3 {
				nvidia,usb2-companion = <3>;
				nvidia,usb3-gen1-only= <1>;
				status = "okay";
			};
		};
	};
#endif

	tegra_xudc: xudc@3550000 {
		/*extcon-cables = <&typec_port0 0>;
		extcon-cable-names = "vbus";
		#extcon-cells = <1>;*/
#if TEGRA_XUSB_PADCONTROL_VERSION >= DT_VERSION_2
		phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>,
			<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-2}>;
		phy-names = "usb2", "usb3";
		nvidia,xusb-padctl = <&xusb_padctl>;
#endif
		status = "okay";
	};

	tegra_xhci: xhci@3610000 {
		/*extcon-cables = <&typec_port0 1>;
		extcon-cable-names = "id";
		#extcon-cells = <1>;*/
#if TEGRA_XUSB_PADCONTROL_VERSION >= DT_VERSION_2
		phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>,
			<&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-1}>,
			<&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-3}>,
			<&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-2}>,
			<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-2}>,
			<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-0}>,
			<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-3}>;
		phy-names = "usb2-0", "usb2-1", "usb2-3", "usb2-2",
			"usb3-2", "usb3-0", "usb3-3";
		nvidia,xusb-padctl = <&xusb_padctl>;
#endif
		status = "okay";
	};

	arm-pmu {
		status = "okay";
	};

	power-domain {
		status = "disabled";
	};

	interrupt-controller {
		status = "disabled";
	};

	mods-simple-bus {
		status = "disabled";
	};

	eeprom-manager {
		status = "disabled";
	};

	cpuidle {
		compatible = "nvidia,tegra19x-cpuidle";
		status = "okay";
	};

	thermal-zones {
		status = "disabled";
	};

	reserved-memory {
		ramoops_carveout {
			status = "okay";
		};
	};

	mttcan@c310000 {
		status = "okay";
	};

	mttcan@c320000 {
		status = "okay";
	};

	serial@3110000 {
		status = "okay";
	};

	pwm@32c0000 {
		status = "okay";
	};

	pwm@32f0000 {
		status = "okay";
	};

	i2c@31e0000 {
		pinctrl-names = "default";
		pinctrl-0 = <&dpaux_default>;
		bmi160@69 {
			compatible = "bmi,bmi160";
			reg = <0x69>;
			accelerometer_matrix    = [01 00 00 00 01 00 00 00 01];
			gyroscope_matrix        = [01 00 00 00 01 00 00 00 01];
			status = "okay";
		};
	};

	host1x {
		dpaux@155F0000 {
			status = "okay";
			compatible = "nvidia,tegra194-dpaux3-padctl";
			/delete-property/ power-domains;
			dpaux_default: pinmux@0 {
				dpaux3_pins {
					pins = "dpaux3-3";
					function = "i2c";
				};
			};
		};
	};

	hardwood {
		compatible = "nvidia,denver-hardwood";
		interrupts = <0 24 0x4>;
	};

	ufshci@2450000 {
		nvidia,enable-hs-mode;
	};
};
/*
&head0 {
	extcon-cables = <&typec_port0 2 &typec_port1 2>;
	extcon-cable-names = "typec0", "typec1";
	#extcon-cells = <1>;
};

&head1 {
	extcon-cables = <&typec_port0 2 &typec_port1 2>;
	extcon-cable-names = "typec0", "typec1";
	#extcon-cells = <1>;
};

&head2 {
	extcon-cables = <&typec_port0 2 &typec_port1 2>;
	extcon-cable-names = "typec0", "typec1";
	#extcon-cells = <1>;
};
*/
&sor0 {
	nvidia,typec-port = /bits/ 8 <0>;
};

&sor1 {
	nvidia,typec-port = /bits/ 8 <1>;
};

#if LINUX_VERSION >= 414
#include <tegra194-linux-4.14.dtsi>
#endif

i use hardware method to bypass vbus , so i have no vbus structure.
now i can see the usb node and device but i have many error message.