USB2-2 in companion with USB3-2 type C port has peripheral mode (device mode) instead of host mode

In our custom board, the type C port which is combination of usb2-2 and usb3-2. We want to change usb2-2 to peripheral mode(device mode) instead of host mode which is currently deafult mode in dtsi. Currently recovery port usb2-0 with micro usb connector is tied with xudc. Now we have mapped xudc to usb2-2 instead of usb2-0

Done the following DTSI changes to make the usb2-2 has peripheral mode.

  • usb2-0 is changed to host instead of otg.
  • Now we have mapped xudc to usb2-2 instead of usb2-0.

usb2-0 {
mode = “host”;
status = “okay”;
/* usb-role-switch; */
connector {
compatible = “usb-b-connector”, “gpio-usb-b-connector”;
label = “micro-USB”;
type = “micro”;
vbus-gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Z, 1) GPIO_ACTIVE_LOW>;
usb2-2 {
mode = “peripheral”;
/vbus-supply = <&usb2_2>;/
vbus-supply = <&battery_reg>;
status = “okay”;
usb3-2 {
nvidia,usb2-companion = <2>;
status = “okay”;
With the following changes usb2-2, I don’t see any error in dmesg during bootup, so ports are properly hooked up. But if I connect the custom board to laptop don’t see that jeston xavier is not going into device mode.

We have 3.0 PD module which controls the type C port for device mode. Below is the schematic. This module can be controlled via I2C.

Linux has FUSB302 driver, enabled this driver in the configuration file and added below DTSI changes in tegra194-p3668-common.dtsi.

/*Added FUSB entry */
i2c8: i2c@31e0000 {
compatible = “fcs,fusb302”; // String must match driver’s .compatible string exactly
reg = <0x22>; // I2C Slave address
status = “okay”; // The device is enabled, comment out or delete to disable
vbus-supply = <&usb2_2>;
fcs,int_n = <&tegra_aon_gpio TEGRA194_AON_GPIO(CC, 0) GPIO_ACTIVE_LOW>; // INT_N GPIO pin - <&gpio_bus pin# 0>.

Now fusb driver probe is successful and IRQ 264 is registered with GPIO. cat /sys/kernel/debug/gpio shows gpio-317 (PCC.00 |fcs,int_n ) in hi IRQ ACTIVE LOW
Even with this driver no interrupt is generated to jetson xavier nx when it is connected to windows/Linux PC.
I know there is service which runs at bootup and configures the mass storage, serial port and RNDIS. Later need to modify this if required to consider usb2-2 instead of usb2-0.
Is there changes I am missing at DTSI side or anything else need to be taken care for usb port to work in peripheral mode?

Do you use Jetpack 4(which is K4.9) or 5(K5.10)? The programming of device tree for Kernal 4.9 and 5.10 is different. Would like to make sure which release you are using.

And do you try to enable the type-C port in USB2 device mode after booting? If the type-C port is consisted of usb3-2 and usb2-2, it is not possible to have usb3-2 in host mode and usb2-2 in device mode simultaneously.

I am using jetpack5. Below is the Dmesg log

Linux version 5.10.104-tegra (xavier-nx@xavier-nx) (aarch64-buildroot-linux-gnu-gcc.br_real (Buildroot 2020.08) 9.3.0, GNU ld (GNU Binutils) 2.33.1) #6 SMP PREEMPT Wed Mar 1 11:13:33 IST 2023

I tried to enable type-C port in USB2 device mode after booting.

Yes, I am aware about this.

This part is FUSB302, I have attached the schematic for the same above. The Linux kernel supports FUSB302 driver, but by default it not enabled. I enable this driver in kernel and successfully probe and IRQ registered. DSTI changes as below

fusb302: typec-portc@22 {
compatible = “fcs,fusb302”;
reg = <0x22>;
fcs,int_n = <&tegra_aon_gpio TEGRA194_AON_GPIO(CC, 0) GPIO_ACTIVE_LOW>;
usb_con: connector {
compatible = “usb-c-connector”;
label = “USB-C”;
vbus-supply = <&usb2_2>;
power-role = “dual”;
try-power-role = “sink”;
source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)
PDO_VAR(3000, 12000, 3000)
PDO_PPS_APDO(3000, 11000, 3000)>;
op-sink-microwatt = <10000000>;
How to verify that USB2 is in device mode. If I connect and disconnect type C port of device to windows/Linux PC don’t see anything in dmesg.

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.

Sorry for the late response, have you managed to get issue resolved or still need the support? Thanks

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