Xavier: Trying to use J513 as OTG instead of J512

Hello, I would like to make the “rear” (J513) USB3.1C port an OTG port instead of a HOST-only port.

I have looked at the Adaptation Guide and I have made the following modifications. See below.

To summarize,

  • Under xusb_padctl@3520000/ports/usb2-0, I changed the mode to "host"
  • Under xusb_padctl@3520000/ports/usb2-1, I changed the mode to "otg"
  • Under xudc@3550000, I changed phys to <0xd8 0xdb>, which are the handles corresponding to usb2-1 and usb3-0, respectively
  • Under xudc@3550000, I changed phy-names to
  • Under usb_cd, I changed phys to <0xd8> (i.e. usb2-1) -- This node does not appear in the Adaptation Guide, but I changed it anyway. I see no difference whether it is set to usb2-0 or usb2-1.

It seems to work partially: the “front” J512 port (usb2-0, usb3-2) no longer acts as a USB device when I plug it in, and the J513’s port (usb2-1, usb3-0) device tree appears to have the OTG characteristics: /proc/device-tree/xudc@3550000/phys and phy names seem to be correct.

However, when I connect the port to my PC, it does not detect a device. I’m wondering if I need to do more. I noticed the scripts under “/opt/nvidia/nv-l4t-usb-device-mode” - do I have to configure something to trigger these services/scripts?

Any suggestions regarding what I might be missing?

Device tree changes below:

xusb_padctl@3520000 {
		compatible = "nvidia,tegra19x-xusb-padctl";
		reg = <0x0 0x3520000 0x0 0x1000 0x0 0x3540000 0x0 0x1000>;
		reg-names = "padctl", "ao";
		interrupts = <0x0 0xa7 0x4>;
		resets = <0x5 0x72>;
		reset-names = "padctl";
		status = "okay";
		pex_dvdd-supply = <0x76>;
		pex_hvdd-supply = <0x77>;
		pex_pll_hvdd-supply = <0x77>;
		vclamp_usb-supply = <0xa>;
		avdd_usb-supply = <0xd3>;
		avdd_pll_nvhs_eutmip-supply = <0x77>;
		linux,phandle = <0xd5>;
		phandle = <0xd5>;

		pads {

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

				lanes {

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

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

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

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

			usb3 {

				lanes {

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

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

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

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

		ports {

			usb2-0 {
				status = "okay";
				vbus-supply = <0x1c>;
[b]				mode = "host";
[/b]			};

			usb2-1 {
				status = "okay";
				vbus-supply = <0x1c>;
[b]				mode = "otg";
[/b]			};

			usb2-2 {
				status = "okay";
				vbus-supply = <0x1c>;
				mode = "host";
			};

			usb2-3 {
				status = "okay";
				vbus-supply = <0xd4>;
				mode = "host";
			};

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

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

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

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

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

			prod_c_bias {
				prod = <0x0 0x284 0x38 0x38>;
			};

			prod {
				prod = <0x0 0x24 0xfff 0x0>;
			};
		};
	};

	usb_cd {
		compatible = "nvidia,tegra194-usb-cd";
		nvidia,xusb-padctl = <0xd5>;
[b]		phys = <0xd6>;
[/b]
		phy-names = "otg-phy";
		status = "okay";
		linux,phandle = <0x178>;
		phandle = <0x178>;
	};

	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 = <0xd5>;
		iommus = <0x2 0x1c>;
		dma-coherent;
		status = "okay";
		avdd-usb-supply = <0xd3>;
		extcon-cables = <0x79 0x0>;
		extcon-cable-names = "vbus";
		#extcon-cells = <0x1>;
[b]		phys = <0xd8 0xdb>;
		phy-names = "usb2-1", "usb3-0";
[/b]		nvidia,boost_cpu_freq = <0x4b0>;
		linux,phandle = <0x179>;
		phandle = <0x179>;
	};

	xhci@3610000 {
		compatible = "nvidia,tegra194-xhci";
		reg = <0x0 0x3610000 0x0 0x40000 0x0 0x3600000 0x0 0x10000>;
		interrupts = <0x0 0xa3 0x4 0x0 0xa4 0x4 0x0 0xa7 0x4>;
		interrupt-parent = <0x31>;
		clocks = <0x4 0x10a 0x4 0x10b 0x4 0x10c 0x4 0x10d 0x4 0x10e 0x4 0x10f 0x4 0x110 0x4 0x111 0x4 0x113 0x4 0x115 0x4 0x67 0x4 0xe 0x4 0x64>;
		clock-names = "xusb_hs_src", "xusb_host", "xusb_core_superspeed_clk", "xusb_falcon_src", "xusb_falcon_host_clk", "xusb_falcon_superspeed_clk", "xusb_fs_src", "xusb_fs_host_clk", "xusb_ss_src", "xusb_ss", "pll_u_480m", "clk_m", "pll_e";
		nvidia,xusb-padctl = <0xd5>;
		iommus = <0x2 0x1b>;
		dma-coherent;
		status = "okay";
		extcon-cables = <0x79 0x1>;
		extcon-cable-names = "id";
		#extcon-cells = <0x1>;
		phys = <0xd6 0xd8 0xd9 0xda 0xd7 0xdb 0xdc>;
		phy-names = "usb2-0", "usb2-1", "usb2-3", "usb2-2", "usb3-2", "usb3-0", "usb3-3";
		linux,phandle = <0x17a>;
		phandle = <0x17a>;
	};

Hi,
For type C port, it is controlled by USB PD controller. Do you have the controller chip in your hardware design?

I’m using the standard Xavier Dev kit right now. Does it have the PD controller chip on both USB C ports?
I was under the impression that both ports could potentially be configured to be OTG.
Did I misunderstand?

If I am mistaken, would it be ok to simply force it to “device” instead of “otg”?

Please also try to update the phys,phy-names and extcon-cables in

tegra_usb_cd
tegra_xudc
tegra_xhci

Hi WayneWWW. Thanks for your suggestions.

In my file, the nodes you pointed out appear to be aliases for the entries I already modified.

That being said, I think you are right in suggesting that I review the extcon-cables values.
After a cursory analysis, I think I am indeed using the wrong value.

I have been pulled off on another high-priority task, but I should be able to get back to this next week.

Thank you very much for your insight. I will report back soon.

Confirmed. I was missing one change:

I needed to change extcon-cables under xhci and xudc to match the phandle defined under …/usci_ccg/typec-extcon/port-1.