I would like to make a device tree where USB0 will function as a Device when the micro USB is plugged in, then as a host when the cable is not plugged in. I have a device on the board that I would like connected to the Jetson when the micro USB is not connected.
I know this question has been asked before but there hasn’t been an answer for dynamic device/host.
I see there exists some device tree logic with “vbus_excon” in other Jetson device trees.
Here is the USB device tree I currently have. USB0 only functions as a device. If I change OTG to HOST it works as a host but I am unable to flash the SSD. If I leave it as OTG, I can flash the SSD but not connect to my downstream device.
xusb_padctl: xusb_padctl@3520000 {
status = "okay";
pads {
usb2 {
lanes {
usb2-0 {
nvidia,function = "xusb";
status = "okay";
};
usb2-1 {
nvidia,function = "xusb";
status = "okay";
};
usb2-2 {
nvidia,function = "xusb";
status = "okay";
};
};
};
usb3 {
lanes {
usb3-0 {
nvidia,function = "xusb";
status = "okay";
};
usb3-1 {
nvidia,function = "xusb";
status = "okay";
};
usb3-2 {
nvidia,function = "xusb";
status = "okay";
};
};
};
};
ports {
usb2-0 {/* Goes to recovery port when micro usb connected, otherwise goes to Pixhawk */
mode = "otg";
status = "okay";
vbus-supply = <&p3768_vdd_5v_sys>;
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(Z, 1) GPIO_ACTIVE_LOW>;
};
// port {
// typec_p0: endpoint {
// remote-endpoint = <&fusb_p0>;
// };
// };
};
usb2-1 {/* Goes to hub */
mode = "host";
vbus-supply = <&p3768_vdd_av10_hub>;
status = "okay";
};
usb2-2 {/* Goes to Single USB A Port */
mode = "host";
vbus-supply = <&p3768_vdd_5v_sys>;
status = "okay";
};
usb3-0 {/* Goes to Single USB A Port */
nvidia,usb2-companion = <2>;
status = "okay";
};
usb3-1 {/* Goes to Dual USB A Port (USB 2 comes from Hub)*/
nvidia,usb2-companion = <1>;
status = "okay";
};
usb3-2 {/* Goes to Dual USB A Port (USB 2 comes from Hub)*/
nvidia,usb2-companion = <1>;
status = "okay";
};
};
};
tegra_xudc: xudc@3550000 {
status = "okay";
phys = <&{/xusb_padctl@3520000/pads/usb2/lanes/usb2-0}>;
phy-names = "usb2-0";
nvidia,xusb-padctl = <&xusb_padctl>;
};
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/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", "usb3-0", "usb3-1", "usb3-2";
nvidia,xusb-padctl = <&xusb_padctl>;
};
Here is the schematic. I don’t have the USB C controller, just the VBUS DET GPIO.
