Enabling USB device mode

I’m trying to follow the advice in this post for enabling USB device mode on a particular port.

Currently, my DTB looks like this:

	external-connection {
		vbus_id_extcon: extcon@1 {
			compatible = "extcon-gpio-states";
			reg = <0x1>;
			extcon-gpio,name = "VBUS";                        
			extcon-gpio,out-cable-names = <EXTCON_USB EXTCON_NONE>;
			cable-connected-on-boot = <0>;
			#extcon-cells = <1>;
			status = "okay";
		};
	};

	tegra_xudc: xudc@3550000 {
		extcon-cables = <&vbus_id_extcon 0>;
		extcon-cable-names = "vbus";
		...
	};

	tegra_xhci: xhci@3610000 {
		extcon-cables = <&vbus_id_extcon 1>;
		extcon-cable-names = "id";
		...
	};

The kernel function of_extcon_dev_get_by_cable_name() in extcon.c is complaining that “Cable id Index 1 is not supported”.

Which jetpack version are you using here?

It is L4T r32.7.2, maybe Jetpack 4.6.1?

I would suggest you can read the document here to make your device tree meet your hardware design…
https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3261/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/adaptation_and_bringup_xavier.html#wwpID0E0LK0HA

You should not just copy some unknown device tree from another stranger who may not use the same hardware design as your board…

Thanks. I’ve looked at that article but those examples reference a Cypress Type-C controller which my board does not have. My vendor’s device tree removes the Type-C controller as in this eLinux wiki article. This article also mentions OTG mode in the footer, but I don’t think it’s correct, because OTG mode requires the extcon-cables entries.

This is a learning experience for me so I agree the things that I’m doing may be incorrect or inadvisable, but I’m trying to decipher and learn the reasoning behind these changes so that it’s not simply copying and pasting.

My rough understanding is that to enable OTG mode, I need to add an external connection that reads GPIO pins and outputs the desired USB state (USB host, USB device, or none). This in turn triggers either the xUDC or xHCI driver.

In this case since I don’t have ID/VBUS_DETECT GPIO pins, instead of using OTG mode I just want to force device-only mode. Therefore rather than connect specific GPIO pins I just use cable-connected-on-boot which sets the default state to EXTCON_USB aka device mode.

Beyond that I’m not sure why my changes do not work as recommended in the thread. I also don’t understand why extcon-gpio,out-cable-names is completely unlike the extcon-cable-names referenced later, or where the special names “vbus” and “id” are defined.

Hi,

Not sure if you read the document carefully. There is also example of non-type C otg usecase.

Also, if your usecase is that “only need device mode case”. Actually you can refer to xavier nx or nano adaptation guide because those micro usb port on these two platforms are doing same thing as what you are doing now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.