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

**URL:** <https://forums.developer.nvidia.com/t/usb2-2-in-companion-with-usb3-2-type-c-port-has-peripheral-mode-device-mode-instead-of-host-mode/244200>\
**Category:** Jetson Xavier NX\
**Tags:** usb, board-design, device-tree\
**Created:** [February 27, 2023, 8:09am UTC](https://forums.developer.nvidia.com/t/usb2-2-in-companion-with-usb3-2-type-c-port-has-peripheral-mode-device-mode-instead-of-host-mode/244200 "2023-02-27T08:09:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashwath.narasimhamurthy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ashwath.narasimhamurthy](https://forums.developer.nvidia.com/u/ashwath.narasimhamurthy)\
**Post date:** [February 27, 2023, 8:09am UTC](https://forums.developer.nvidia.com/t/usb2-2-in-companion-with-usb3-2-type-c-port-has-peripheral-mode-device-mode-instead-of-host-mode/244200/1 "2023-02-27T08:09:11Z")

</div>

Hi ALL,  
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”;  
> #if TEGRA\_XUSB\_DT\_VERSION \>= DT\_VERSION\_3  
> /\* 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\>;  
> };  
> #endif  
> };  
> usb2-2 {  
> mode = “peripheral”;  
> /_vbus-supply = \<&usb2\_2\>;_/  
> vbus-supply = \<&battery\_reg\>;  
> status = “okay”;  
> **usb-role-switch;**  
> };  
> 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.

 ![image](https://global.discourse-cdn.com/nvidia/original/3X/6/d/6d7185a5f27ef955fd9753372242c199f6e6d7b3.png)  
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 {  
> fusb302@22{  
> 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?

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [March 1, 2023, 6:40am UTC](https://forums.developer.nvidia.com/t/usb2-2-in-companion-with-usb3-2-type-c-port-has-peripheral-mode-device-mode-instead-of-host-mode/244200/3 "2023-03-01T06:40:06Z")

</div>

Hi,  
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.

---

<div class="post-metadata">

**Author:** ![ashwath.narasimhamurthy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ashwath.narasimhamurthy](https://forums.developer.nvidia.com/u/ashwath.narasimhamurthy)\
**Post date:** [March 1, 2023, 7:08am UTC](https://forums.developer.nvidia.com/t/usb2-2-in-companion-with-usb3-2-type-c-port-has-peripheral-mode-device-mode-instead-of-host-mode/244200/4 "2023-03-01T07:08:59Z")

</div>

> [@DaneLLL](#):
>
> 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.

Hi,  
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

> [@DaneLLL](#):
>
> And do you try to enable the type-C port in USB2 device mode after booting?

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

> [@DaneLLL](#):
>
> 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.

Yes, I am aware about this.

> [@ashwath.narasimhamurthy](#):
>
> We have 3.0 PD module which controls the type C port.

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.

---

<div class="post-metadata">

**Author:** ![kayccc](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kayccc/32/14043_2.png) [@kayccc](https://forums.developer.nvidia.com/u/kayccc)\
**Post date:** [March 15, 2023, 2:58am UTC](https://forums.developer.nvidia.com/t/usb2-2-in-companion-with-usb3-2-type-c-port-has-peripheral-mode-device-mode-instead-of-host-mode/244200/5 "2023-03-15T02:58:08Z")

</div>

**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.  
Thanks**

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

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [April 12, 2023, 3:01am UTC](https://forums.developer.nvidia.com/t/usb2-2-in-companion-with-usb3-2-type-c-port-has-peripheral-mode-device-mode-instead-of-host-mode/244200/7 "2023-04-12T03:01:43Z")

</div>

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