How to use USB2-1 and USB3-0 as a device mode

Here’s the schematic.

This is a modification of the device tree:

	xusb_padctl@3520000 {
		compatible = "nvidia,tegra234-xusb-padctl";
		reg = <0x0 0x3520000 0x0 0x20000 0x0 0x3540000 0x0 0x10000>;
		reg-names = "padctl", "ao";
		interrupts = <0x0 0xa7 0x4>;
		resets = <0x2 0x72>;
		reset-names = "padctl";
		status = "okay";
		vclamp-usb-supply = <0x4e>;
		avdd-usb-supply = <0x2b2>;
		phandle = <0x2b3>;

		pads {

			usb2 {
				clocks = <0x2 0xa5>;
				clock-names = "trk";

				lanes {

					usb2-0 {
						status = "disabled";
						#phy-cells = <0x0>;
					};

					usb2-1 {
						status = "okay";
						#phy-cells = <0x0>;
						nvidia,function = "xusb";
						phandle = <0x2b4>;
					};

					usb2-2 {
						status = "disabled";
						#phy-cells = <0x0>;
					};

					usb2-3 {
						status = "disabled";
						#phy-cells = <0x0>;
					};
				};
			};

			usb3 {

				lanes {

					usb3-0 {
						status = "okay";
						#phy-cells = <0x0>;
						nvidia,function = "xusb";
						phandle = <0x2b5>;
					};

					usb3-1 {
						status = "disabled";
						#phy-cells = <0x0>;
					};

					usb3-2 {
						status = "disabled";
						#phy-cells = <0x0>;
					};

					usb3-3 {
						status = "disabled";
						#phy-cells = <0x0>;
					};
				};
			};
		};

		ports {

			usb2-0 {
				status = "disabled";
			};

			usb2-1 {
				status = "okay";
				mode = "device";
			};

			usb2-2 {
				status = "disabled";
			};

			usb2-3 {
				status = "disabled";
			};

			usb3-0 {
				status = "okay";
				nvidia,usb2-companion = <0x1>;
			};

			usb3-1 {
				status = "disabled";
			};

			usb3-2 {
				status = "disabled";
			};

			usb3-3 {
				status = "disabled";
			};
		};

		prod-settings {
			#prod-cells = <0x4>;

			prod {
				prod = <0x0 0x284 0x38 0x38 0x0 0x288 0x3fff000 0x51e000>;
			};
		};
	};

	usb_cd {
		compatible = "nvidia,tegra234-usb-cd";
		nvidia,xusb-padctl = <0x2b3>;
		phys = <0x2b4>;
		phy-names = "otg-phy";
		status = "disabled";
		phandle = <0x45f>;
	};

	xudc@3550000 {
		compatible = "nvidia,tegra234-xudc";
		reg = <0x0 0x3550000 0x0 0x8000 0x0 0x3558000 0x0 0x8000>;
		reg-names = "base", "fpci";
		interrupts = <0x0 0xa6 0x4>;
		clocks = <0x2 0x109 0x2 0x115 0x2 0x113 0x2 0x110>;
		clock-names = "dev", "ss", "ss_src", "fs_src";
		power-domains = <0x2 0xb 0x2 0xa 0x2 0xc>;
		power-domain-names = "dev", "ss", "host";
		nvidia,xusb-padctl = <0x2b3>;
		iommus = <0x4d 0xf>;
		dma-coherent;
		status = "okay";
		avdd-usb-supply = <0x2b2>;
		phys = <0x2b4 0x2b5>;
		phy-names = "usb2-1", "usb3-0";
		phandle = <0x460>;
	};

After making the above changes, i get the following message in dmesg:

[   12.132593] systemd[1]: Starting udev Coldplug all Devices...
[   12.153864] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   12.164532] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   12.173728] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   12.189115] systemd[1]: Started Journal Service.
[   12.491606] systemd-journald[243]: Received client request to flush runtime journal.
[   13.048989] nvidia: loading out-of-tree module taints kernel.
[   13.085096] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.123211] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.131719] imx219 9-0010: imx219_board_setup: error during i2c read probe (-121)
[   13.168610] imx219 9-0010: board setup failed
[   13.172864] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.173448] imx219: probe of 9-0010 failed with error -121
[   13.195218] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.211155] imx219 10-0010: imx219_board_setup: error during i2c read probe (-121)
[   13.211537] random: crng init done
[   13.222442] random: 7 urandom warning(s) missed due to ratelimiting
[   13.237837] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.242244] imx219 10-0010: board setup failed
[   13.261578] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.278118] imx219: probe of 10-0010 failed with error -121
[   13.279391] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.295126] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.312769] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.344396] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.550575] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.615418] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   13.847110] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517
[   15.194181] tegra-xudc 3550000.xudc: failed to get usbphy-1: -517

What did I do wrong? Thank you, sir.

  phys = <0x2b4 0x2b5>;

What is the original value you wrote into this ?

The original device tree looks like this:

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

		ports {
			usb2-1 {
				mode = "peripheral";
				status = "okay";
			};
			usb3-0 {
				nvidia,usb2-companion = <1>;
				status = "okay";
			};
		};

	tegra_xudc: xudc@3550000 {
		status = "okay";
		phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-1}>,
			<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-0}>;
		phy-names = "usb2-1", "usb3-0";
		nvidia,xusb-padctl = <&xusb_padctl>;
	};



Could you convert you final dtb file back to dts and attach your full dts file here?

full dts file is here

tegra234-p3767-0004-p3768-0000-a0.dts (424.7 KB)

Hello. Any good news?

Could you clarify how you update your device tree? What got changed?

The error log looks like it cannot find the phys listed in your xudc.

I replaced the usb2 and usb3 lines of the xudc from usb2-0, usb3-1 to usb2-1, usb3-0 and then changed the otg mode to peripheral

Could you attach your full error log instead of partial log?

1 Like

Hi,

https://docs.nvidia.com/jetson/archives/r35.4.1/DeveloperGuide/text/HR/JetsonModuleAdaptationAndBringUp/JetsonAgxOrinSeries.html?highlight=usb%20role%20switch#porting-the-universal-serial-bus

You need to have usb-role-switch added so that the usb2-1 lane can get detected by driver. Only enabling it in DT is not sufficient.

do we need “usb-role-switch” when mode is peripheral ?

yes, it is needed in otg and peripheral mode. Only not needed when it is host mode.

After adding the attribute “usb-role-switch”, the error is no longer reported in dmesg.
But the device is still not found on PC

I found two profiles, but they seem to contradict each other a bit, please help confirm.

Orin-TRM:

Orin Nano DS:

The document you are posting does not matter.

The problem here is your device tree is still wrong and may not match your board. Please check the adaptation guide again.

Also, I am not kind of all-knowing person. You should at least share your latest kernel log because I won’t tell anything out without checking the log…

dmesg:
dmesg.log (60.7 KB)

I reflashed the version and it is now 35.4.1

The document Orin_Nano_DS.pdf said We can’t use usb2-1 as a device, and I’m wondering if this is true
Jetson_Orin_Nano_DS-11105-001_v1.0_2.24.pdf (1.4 MB)

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

Is this still an issue to support? Any result can be shared? Thanks