Wakeup using Wake-on-Lan (ethernet magic packet) for Apalis iMX6Q from suspend mem (Linux)

Hi,

I have successfully suspended the Apalis iMX6Q (Linux) to mem using the tutorial here: http://developer.toradex.com/knowledge-base/suspend-resume-(linux)

I was able to configure RTC for waking up.

However, I was not able to configure the UART for wake up as the following path does not exist in the rootfs.

# echo enabled > /sys/class/tty/ttyLP0/power/wakeup

Would like to know how to fix it?

Also, I was not able to find any info on how to configure the ethernet to detect a wake-on-lan (magic packet) signal. I am using the wakeonlan utility from Ubuntu host to send the magic packet to the eval board.

However, I was not able to configure the UART for wake up as the following path does not exist in the rootfs. Would like to know how to fix it?

Please note that the article you are refering to is not applicable for Apalis iMX6. Have a look at this article for information on available tty ports on Apalis iMX6. To enable wakeup via UART port:

# echo enabled > /sys/class/tty/ttymxc0/power/wakeup

Also, I was not able to find any info on how to configure the ethernet to detect a wake-on-lan (magic packet) signal. I am using the wakeonlan utility from Ubuntu host to send the magic packet to the eval board.

By default wake-on-lan is not enabled, one will need to enable it in device tree. Have a look at the device tree bindings documentation here. You can try enabling wake-on-lan support, changes required to enable wake-on-lan:

diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
 index b621e8b..26c4e40 100644
 --- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
 +++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
 @@ -281,6 +281,7 @@
         phy-handle = <&ethphy>;
         phy-reset-duration = <10>;
         phy-reset-gpios = <&gpio1 25 1>;
 +       fsl,magic-packet;
         status = "okay";
  
         mdio {

Also by default in userspace the wake-on-lan is disabled, to enable the wake-on-lan run:

# ethtool -s eth0 wol g

To enable the eth0 as wakeup source:

# echo enabled > /sys/class/net/eth0/power/wakeup

Tested using ‘etherwake’ tool.

root@apalis-imx6:~# echo mem > /sys/power/state
[ 1075.714184] mxc_sdc_fb fb.20: 640x480 h_sync,r,l: 96,16,48  v_sync,l,u: 2,10,33 pixclock=25174000 Hz
[ 1075.759690] PM: Syncing filesystems ... 
[ 1075.911921] done.
[ 1075.919630] Freezing user space processes ... (elapsed 0.001 seconds) done.
[ 1075.930513] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 1076.103283] PM: suspend of devices complete after 158.399 msecs
[ 1076.109286] PM: suspend devices took 0.170 seconds
[ 1076.114742] PM: late suspend of devices complete after 0.638 msecs
[ 1076.121830] PM: noirq suspend of devices complete after 0.838 msecs
[ 1076.128153] Disabling non-boot CPUs ...
[ 1076.133044] CPU1: shutdown
[ 1076.137375] CPU2: shutdown
[ 1076.141485] CPU3: shutdown

Sending magic-packet using ‘etherwake’:

$ sudo etherwake -i enp12s0 -D 00:14:2D:4B:16:03
The target station address is 0:14:2d:4b:16:3.
Packet is  00 14 2d 4b 16 03 00 14 2d 4b 16 03 08 42 ff ff ff ff ff ff 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03 00 14 2d 4b 16 03.
Sendto worked ! 116.

On target:

[ 1076.145037] Enabling non-boot CPUs ...
    [ 1076.149403] CPU1: Booted secondary processor
    [ 1076.149740] CPU1 is up
    [ 1076.156984] CPU2: Booted secondary processor
    [ 1076.157323] CPU2 is up
    [ 1076.164485] CPU3: Booted secondary processor
    [ 1076.164911] CPU3 is up
    [ 1076.172112] PM: noirq resume of devices complete after 0.494 msecs
    [ 1076.179174] PM: early resume of devices complete after 0.547 msecs
    [ 1076.189938] mxc_sdc_fb fb.22: 800x480 h_sync,r,l: 20,60,40  v_sync,l,u: 10,10,10 pixclock=27000000 Hz
    [ 1076.221409] mxc_sdc_fb fb.23: 640x350 h_sync,r,l: 64,32,96  v_sync,l,u: 3,32,60 pixclock=31500000 Hz
    [ 1076.365174] PM: resume of devices complete after 179.727 msecs
    [ 1076.374574] PM: resume devices took 0.190 seconds
    [ 1076.381866] Restarting tasks ... done.
    root@apalis-imx6:~# [ 1076.536719] ata1: SATA link down (SStatus 0 SControl 300)
    [ 1077.257890] libphy: 2188000.ethernet:07 - Link is Up - 1000/Full

Dear bhuvan.tx,

Thank you for the detailed reply. Wake on UART worked perfectly.

For wake on lan, please see the terminal output below (after sending the magic packet):

 root@apalis-imx6:~# ethtool -s eth0 wol g
 root@apalis-imx6:~# 
 root@apalis-imx6:~#  echo enabled > /sys/class/net/eth0/power/wakeup
 root@apalis-imx6:~# 
 root@apalis-imx6:~# 
 root@apalis-imx6:~# echo mem>/sys/power/state 
 [   45.513959] PM: Syncing filesystems ... done.
 [   45.834195] mxc_sdc_fb fb.20: 1920x1080 h_sync,r,l: 44,88,148  v_sync,l,u: 5,4,36 pixclock=148500000 Hz
 [   45.906858] Freezing user space processes ... (elapsed 0.015 seconds) done.
 [   45.929221] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
 [   46.021737] PM: suspend of devices complete after 83.021 msecs
 [   46.027631] PM: suspend devices took 0.090 seconds
 [   46.033138] PM: late suspend of devices complete after 0.699 msecs
 [   46.041940] Info: don't support pm_turn_off yet.
 [   46.046627] PM: noirq suspend of devices complete after 7.256 msecs
 [   46.052905] Disabling non-boot CPUs ...
 [   46.057531] CPU1: shutdown
 [   46.061779] CPU2: shutdown
 [   46.066033] CPU3: shutdown
 ...
 [   46.069648] Enabling non-boot CPUs ...
 [   46.074020] CPU1: Booted secondary processor
 [   46.074349] CPU1 is up
 [   46.081514] CPU2: Booted secondary processor
 [   46.081834] CPU2 is up
 [   46.089060] CPU3: Booted secondary processor
 [   46.089442] CPU3 is up

Even though the CPUs are up, the system remains in frozen state and the tasks are not restarted. Notice the “Info” which says “Info: don’t support pm_turn_off yet.” Can you please advice how I can fix this?

May I know the kernel version and the image version which you are using ?