dear expert :
on imx8qxp platform ,we configure usbotg1 to OTG mode，we found that if we switch usb role from gadget to host , the os will be abnormal ；
in most cases , it will show follow log repeatedly：
[ 1140.418947] Task dump for CPU 2:
[ 1140.422180] swapper/2 R running task 0 0 1 0x0000002a
[ 1140.429233] Call trace:
[ 1140.431695] __switch_to+0xf8/0x160
[ 1140.435192] __cpu_online_mask+0x0/0x20
[ 1203.403893] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
[ 1203.410014] rcu: 2-...0: (1 GPs behind) idle=6aa/0/0x1 softirq=172961/172962 fqs=20045
[ 1203.418110] (detected by 3, t=84016 jiffies, g=499141, q=41071)
[ 1203.424120] Task dump for CPU 2:
[ 1203.427353] swapper/2 R running task 0 0 1 0x0000002a
and the OS may be hung up and serial port can not input;
in other cases , different driver communication error will be printed ：
root@imx8qxpc0mek:~# [ 63.230102] imx-scu scu: RPC send msg timeout
[ 63.234503] sdhc0_clk: clk unprepare failed -110
[ 65.278105] fsl_lpspi 5a020000.spi: I/O Error in DMA TX
[ 65.284636] spidev spi2.0: SPI transfer failed: -110
[ 65.289759] spi_master spi2: failed to transfer one message from queue
and the error : rcu_preempt detected stalls on CPUs/tasks still be printed。
i trace the problem, it seems after cmd_reset send， the error will be occurred;
Thank you for sharing more information, could you share the name of the dts that you're using?
Since the package you shared have many files in it.
Is there any steps you could provide to reproduce this on MEK?
we use imx8x_mek.dtsi ;
reproduce way : plug usb in to pc to enumerate RNDIS , later , plug out usb and usb will switch to gadget mode by hardware , then the issue will produce.
Please do accept my delayed response, I had some problems with my setup.
I tried with MEK board on my side, unfortunately I have only B0 version so this may be tied to C0 version.
I do not see such issue when trying as you mentioned with default device tree, even trying latest BSP version.
Would it be possible to try with latest one (L5.15.52_2.1.0) on your side and check if the issue persist?
Could you share if you're using a custom design or a MEK board?
Which BSP version are you working with?
Also, if possible could you share your device tree bindings?