How to change mode of usb in xavier?

hi .

I want to change usb-mode from “host” to “device” or “otg” in xavier.
And I try to change usb-mode in device tree source. but I connect the port changed mode from “host” to “device” with my host pc, My host pc didn’t recognize usb-port in xavier.
How to change mode of usb in xavier?

device tree source: tegra194-p2888-0001-p2822-0000.dts


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


usb2-1 {
        	status = "okay";
		vbus-supply = <0x1c>;
		mode = "device";

I referred to page 23 in Tegra Linux Driver Package AGX Xavier Adaptation Guide.

I can’t answer fully. However, are you using a micro-B connector? This would be required.

Additionally, unless you’ve programmed in the kind of device you want this to become (such as through the gadget framework), then even if the device mode is correct the PC would not do anything with this (the type of device is what you’d see from a plug in message, and if no device type is associated, it is unlikely anything would show up).

In the case of a micro-OTG connector the ID pin would be used to detect if the port is in host mode or device mode. I suppose you could use the device tree to tell the system the port is always in device mode, but more details on just what you’re trying to do would needed for anyone to give a complete answer.

thanks for your answer
I made a my mistake . I try to change usb-mode of J513(USB type-C).
In brief, if i change device-tree to above modification, usb-port isn’t recognized to device mode?
I try to design this system, From you tell that, Do i need to change device-tree and add gadget framework ?

uvc-camera ----(usb)----- xavier ----(usb)----- Host PC

[system related]
uvc-camera : xavier <=> device : host
xavier : host pc <=> device : host

I have not worked on device mode of USB-C. However, even if the port is in device mode, then there will be no recognition of such from the other side of the cable unless the port responds as a device. The gadget framework is itself a partial implementation of certain standard class devices, e.g., ethernet devices or mass storage, but you have to go through setting up the details of those specific devices before the port will actually respond as such. A mode is more or less an assignment of of pins and functions, but drivers of a sort are still required to talk to those pins.

As I mentioned, I am unfamiliar with using gadget on USB-C, I’ve only dealt with micro-OTG ports and dedicated type-B ports. However, if you Google for the topic, there should be significant information out in the wild. Here is one URL I found which you will probably be interested in:

Do keep in mind that USB-C is quite different than all other past cables. USB itself has only a device at one end, and a host at the other end, with no exceptions to the rule. This is true regardless of being USB-C or not, but there is a bit of “magic” and extra wiring which means the cable itself can have the same connector on both ends, and more logic to determine whether that cable is device or host. I have not studied any of those USB-C details.