Hi,I had the usb-otg on my custom board with JetPack 5.0.2,However, the host driver/device driver mode switch cannot be implemented.
The USB2.0 signal pins D+/D− F12 (USB0_P) and F13 (USB0_N) , ID pin is designed as an internal pull high (logical high),VBUS_DETECTpin is designed as an internal pull high (logical high).
The following code works in device driver mode.
ports {
usb2-0 {
mode = "otg";
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 TEGRA234_MAIN_GPIO(G, 3) GPIO_ACTIVE_LOW>;
id-gpio = <&tegra_main_gpio TEGRA234_MAIN_GPIO(G, 7) GPIO_ACTIVE_HIGH>;
};
#endif
port {
usb_role_switch0: endpoint {
remote-endpoint = <&ucsi_ccg_p1>;
};
};
};
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-1 {
nvidia,usb2-companion = <0>;
status = "okay";
};
usb3-2 {
nvidia,usb2-companion = <3>;
status = "okay";
};
};
};
tegra_xudc: xudc@3550000 {
status = "okay";
phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>,
<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-1}>;
phy-names = "usb2-0", "usb3-1";
nvidia,xusb-padctl = <&xusb_padctl>;
nvidia,boost_cpu_freq = <1200>;
};
tegra_xhci: xhci@3610000 {
status = "okay";
phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>,
<&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-1}>,
<&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-2}>,
<&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-3}>,
<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-0}>,
<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-1}>,
<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-2}>;
phy-names = "usb2-0", "usb2-1", "usb2-2", "usb2-3",
"usb3-0", "usb3-1", "usb3-2";
nvidia,xusb-padctl = <&xusb_padctl>;
};
If the tegra_xudc: xudc@3550000 device node is masked, it is the host driver mode.
tegra_xudc: xudc@3550000 {
status = "disabled";
phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>,
<&{/xusb_padctl@3520000/pads/usb3/lanes/usb3-1}>;
phy-names = "usb2-0", "usb3-1";
nvidia,xusb-padctl = <&xusb_padctl>;
nvidia,boost_cpu_freq = <1200>;
};
The preceding two modes work in only one mode and cannot switch between host driver and device driver mode,How can we solve this problem?
thanks.