i.MX8 evk_8mq: USB reset after waking from suspend

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8 evk_8mq: USB reset after waking from suspend

3,448 Views
UzairAfzal
Contributor I

I am currently testing suspend mode in i.MX8 with Android 11.

 I am suspending system via "echo mem > /sys/power/state" command and wakeup via ttymxc0 debug console.

Each time suspend is ok but during wakeup, it seems that all UART and USB ports are being reset.

Below is a log of the problem:

[ 2553.630352] PM: suspend entry (deep)
[ 2553.638561] Filesystems sync: 0.004 seconds
[ 2553.644527] Freezing user space processes ... (elapsed 0.002 seconds) done.
[ 2553.654510] OOM killer disabled.
[ 2553.657741] Freezing remaining freezable tasks ... (elapsed 0.096 seconds) done.
[ 2553.876136] android_work: sent uevent USB_STATE=DISCONNECTED
[ 2553.884352] fec 30be0000.ethernet eth0: Link is Down
[ 2553.928591] PM: suspend devices took 0.164 seconds
[ 2553.939156] Disabling non-boot CPUs ...
[ 2553.943605] CPU1: shutdown
[ 2553.956365] IRQ 6: no longer affine to CPU2
[ 2553.956462] CPU2: shutdown
[ 2553.973386] CPU3: shutdown

[ 2553.981238] PM: pm_system_irq_wakeup: 34 triggered 30860000.serial
[ 2553.987659] Enabling non-boot CPUs ...
[ 2553.992216] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[ 2553.992752] CPU1 is up
[ 2554.017619] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[ 2554.017958] CPU2 is up
[ 2554.042776] GICv3: CPU3: found redistributor 3 region 0:0x00000000388e0000
[ 2554.042794] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[ 2554.043160] CPU3 is up
[ 2554.347423] usb 2-1: reset SuperSpeed Gen 1 USB device number 2 using xhci-hcd
[ 2554.367700] android_work: sent uevent USB_STATE=CONNECTED
[ 2554.401449] configfs-gadget gadget: high-speed config #1: b
[ 2554.407099] android_work: sent uevent USB_STATE=CONFIGURED
[ 2554.521772] usb 1-1: reset high-speed USB device number 2 using xhci-hcd
[ 2555.098240] usb 1-1.1: reset full-speed USB device number 3 using xhci-hcd
[ 2555.287332] usb 1-1.4: reset full-speed USB device number 5 using xhci-hcd
[ 2555.408076] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 2555.416573] ftdi_sio 1-1.4:1.0: device disconnected
[ 2555.421634] ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB1
[ 2555.430124] ftdi_sio 1-1.4:1.1: device disconnected
[ 2555.513812] usb 1-1.2: reset high-speed USB device number 4 using xhci-hcd
[ 2555.647049] PM: resume devices took 1.576 seconds
[ 2555.651908] ftdi_sio 1-1.4:1.0: FTDI USB Serial Device converter detected
[ 2555.658855] usb 1-1.4: Detected FT2232C
[ 2555.662717] OOM killer enabled.
[ 2555.665874] Restarting tasks ...
[ 2555.671787] done.
[ 2555.682499] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB0
[ 2555.684713] hantro receive hot notification event: 0
[ 2555.694282] ftdi_sio 1-1.4:1.1: FTDI USB Serial Device converter detected
[ 2555.696791] Hot alarm is canceled. GPU3D clock will return to 64/64
[ 2555.704341] usb 1-1.4: Detected FT2232C
[ 2555.718055] usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB1
[ 2555.721143] hantro receive hot notification event: 0
[ 2555.730443] Resume caused by IRQ 34, 30860000.serial
[ 2555.735758] PM: suspend exit

 

 Kernel is resetting USB ports on wakeup and this is causing USB disconnections in user space applications. This seems to be not a correct way to reset USB on each wakeup.

Is this flow intentional or some kernel issue? And Is there any way to disable or patch this USB reset issue at kernel side for suspend mode?

Any workaround or suggestions are welcome.

0 Kudos
Reply
4 Replies

3,400 Views
igorpadykov
NXP Employee
NXP Employee

Hi Uzair

 

>Is this flow intentional or some kernel issue? And Is there any way to disable or
>patch this USB reset issue at kernel side for suspend mode?

 

seems it is expected as in Deep Sleep Mode (DSM) most modules clocks and power supplies

are disabled as described in 3.1.7 Power modes  i.MX 8M Dual / 8M QuadLite / 8M Quad Applications Processors Data Sheet for Consumer Products

In general one can try to change and enable necessary modules using sect.5.2 General Power Controller (GPC)   i.MX 8M Dual/8M QuadLite/8M Quad Applications Processors Reference Manual

and sect.2.5.1 Low Level Power Management (PM)  i.MX Linux Reference Manual​

 

Best regards
igor

0 Kudos
Reply

3,393 Views
UzairAfzal
Contributor I

Hi @igorpadykov ,

Thanks for your response.

Just a further query, should not all attached USB ports should resume their work from last saved state when wake up from suspend? It seems to be a undesired behavior that all USB peripherals are being detached on each suspend causing issues in user space. 

Moreover currently there are only 2 power saving modes present in /sys/power/state file for iMX8 Linux version 5.4.47-dirty, one is "freeze" and other is "mem" mode.

I have also checked the other "freeze" i.e. s2idle mode (https://www.kernel.org/doc/Documentation/power/states.txt) and it seems that the same USB reset is also present in this mode. I don't find documentation on this mode inside iMX official docs but it seems that for iMX8, this mode behaves the same as "mem" mode.

I have checked the documents shared by you and it seems that enabling selected peripherals as suggested by you requires deep kernel understanding as well as iMX platform architecture to avoid any critical or unwanted side affects.

Is there any already available kernel patch or option to avoid this USB disconnect issue as it seems to be common requirement? 

Thanks.

0 Kudos
Reply

3,386 Views
igorpadykov
NXP Employee
NXP Employee

>Is there any already available kernel patch or option to avoid this USB disconnect issue as it seems to be common requirement? 

 

not sorry.

 

>it seems that enabling selected peripherals as suggested by you requires deep kernel understanding as well as iMX platform architecture to avoid any critical or unwanted side affects.

 

right, nxp has special service for supporting such cases: https://contact.nxp.com/new-prof-svcs-sw-tech

 

Best regards
igor

0 Kudos
Reply

3,414 Views
UzairAfzal
Contributor I

Anyone has knowledge about above issue, plz reply. Thanks.

0 Kudos
Reply