USB OTG only works if connected while booting

We have a self-developed board on which an Apalis imx6 runs.

It has a USB-C socket and an onsemi FUSB303 for automatic configuration of the ID pin. When the system (BSP 5.7.1) has started, I can plug in and use a USB stick without any problems (host mode). The gadget mode only works if the other side is plugged in before the boot. After some trial and error, the gadget is restarted if the cable is disconnected and reconnected within a few seconds. Also, instead of rebooting the Apalis, it is sufficient to reload the kernel module ci_hdrc_imx.

Here is an excerpt from the device tree (derived from the ixora carrier board):

&reg_usb_otg_vbus {
	status = "okay";
};

&usbotg {
	vbus-supply = <&reg_usb_otg_vbus>;
	status = "okay";
};

What can we do to use the gadget mode during operation. With other products we have a dedicated USB-B socket for this case, without switching. But this should be omitted. It seems like there is a driver bug. Because under /sys/kernel/debug/ci_hdrc.0/role the entry changes as expected according to the connected device.

Apalis iMX6Q 1GB V1.1B
Yocto-BSP: 5.7.1

Hi @aweger ,

Welcome to the Toradex community! :tada:

Thanks for your question.

Just for the record, did you already see this article about USB gadget mode?

If I understand correctly, the connection between host and gadget has to be already connected together before the boot to make it work. If you plug either side in after boot it does not work. Am I correctly understanding?

I will investigate this.

Best Regards
Kevin

Hi @kevin.tx

Thank you for addressing my concerns.

I have read the article. Unfortunately, it did not help me with my problem. The standard configuration has worked very well for us for years.

You have understood my problem exactly right.

Best Regards
Andreas

Hi @aweger ,

Sorry for the delay. Most of my team are attending the Embedded World in Nuremberg.

Would you be willing to share a snipped of your schematic where we could see how you implemented the USB port? If you prefer I can make this topic private, if you think the information might be confidential.

Best Regards
Kevin

Hi @kevin.tx

Here is the snipped of our schematic.

And for the completeness of the devicetree.
imx6-apalis.dts (9.0 KB)

Best Regards
Andreas