Enabling USB device/otg mode breaks all USB ports

Hi,
We are using a custom carrier board that I have written a new device tree for.
It is based off of the standard p2822 dev kit device tree, but for USB, all of the type C code is stripped out.
With all of the ports set to host mode, it works fine on both 2.0 and 3.0.

If I set usb2-0 to device or otg mode in the DT, none of the USB ports work anymore. I would think that this would only cause port 2-0 and 3-2 to stop working, but that is not the case.

here is the USB section from the DT:

#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 = "device";
				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 = <1>;
				status = "okay";
			};
			usb3-2 {
				nvidia,usb2-companion = <0>;
				status = "okay";
			};
			usb3-3 {
				nvidia,usb2-companion = <3>;
				nvidia,usb3-gen1-only= <1>;
				status = "okay";
			};
		};
	};
#endif
	/* extconn GPIOs for USB device mode. Currently not working.*/
	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>;
		extcon-gpio,out-cable-names =
				<EXTCON_USB EXTCON_USB_HOST EXTCON_NONE>;
		#extcon-cells = <1>;
	};

	tegra_xudc: xudc@3550000 {
		extcon-cables = <&vbus_id_extcon 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/usb3/lanes/usb3-2}>;
		phy-names = "usb2", "usb3";
		nvidia,xusb-padctl = <&xusb_padctl>;
#endif
		nvidia,boost_cpu_freq = <1200>;
		status = "okay";
	};
	tegra_xhci: xhci@3610000 {
#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";
	};

The output of lsusb is totally blank, it doesnt even show the host controllers, and I am still getting power to the USB ports.

Hi,
On Xavier devkits, OTG function is on J512 port. There is a topic about moving the function to J513 port. Please check if it helps:
RNDIS failed with USB 2.0 - #6 by DaneLLL

Thanks! I had to add the extcon parts to the tegra_xhci node and wrap vbus_id_extcon with external-connection as shown in what you linked to.

1 Like