Hi everybody!
I have a new design issue for a customer who wants to use iMX280 and a sort of power-saving feature.
The board is equipped with 4Gb eMMC and a fairly-stock Debian Stretch 9.4 and a vanilla Linux Kernel 4.9 and everything is working good so far.
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.4 (stretch)
Release: 9.4
Codename: stretch
# uname -a
Linux edelin-ek420-08d411 4.9.78 #1 PREEMPT Wed Jun 20 17:16:59 CEST 2018 armv5tejl GNU/Linux
The board has an RTC (PCF8563) battery powered and a sort of circuitry to wakeup at some hours and it is working good: it uses sysfs to wakeup every hour using this simple script:
#!/bin/bash
echo 0 > /sys/class/rtc/rtc0/wakealarm
echo `date '+%s' -d '+ 60 minutes'` > /sys/class/rtc/rtc0/wakealarm
poweroff
Naturally it has a "gpio-poweroff" pin to shutdown itself when it reaches the poweroff syscall. And this stuff is working good...
gpio-poweroff {
compatible = "gpio-poweroff";
gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>;
status = "okay";
};
The board has a special button and it is used as wakeup source as defined in the device-tree:
gpio-buttons {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&board_buttons>;
status = "okay";
wakeupbutton {
label = "WAKEUP_BTN";
gpios = <&gpio1 26 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WAKEUP>;
wakeup-source;
};
and when I put the board in sleep mode (1):
echo freeze > /sys/power/state
or (2)
echo mem > /sys/power/state
it works fine!
Now the customer wants to wakeup the board when in sleep (1) or (2), via ethernet using wakeonlan feature.
mac0: ethernet@800f0000 {
phy-mode = "rmii";
pinctrl-names = "default";
pinctrl-0 = <&mac0_pins_a>;
phy-supply = <®_3p3v>;
phy-reset-gpios = <&gpio3 17 0>;
phy-reset-duration = <100>;
fsl,magic-packet;
status = "okay";
};
There is fsl,magic-packet for mac0, so in this way I can have wakeup entries in /sys/class/net/eth0/power/wakeup*:
echo enabled > /sys/class/net/eth0/power/wakeup
and ethtool eth0 gives me:
# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Link partner advertised pause frame use: Symmetric
Link partner advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Link detected: yes
# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.210 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::21b:c5ff:fe08:d411 prefixlen 64 scopeid 0x20<link>
ether 00:1b:c5:08:d4:11 txqueuelen 1000 (Ethernet)
RX packets 296 bytes 32987 (32.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 73 bytes 10340 (10.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 2 bytes 78 (78.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2 bytes 78 (78.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
So I supposed the wake-on-lan features was working good. But it does not indeed! I was wrong.
From another PC on the same subnet I sent the wol packet:
$ wakeonlan -i 192.168.1.210 00:1b:c5:08:d4:11
Sending magic packet to 192.168.1.210:9 with 00:1b:c5:08:d4:11
When I put the device in sleep mode as before (1) or (2) it NEVER wakes up.
The Ethernet Link seems to be lost when in sleep mode looking at the lights in the ethernet switch where the board is connected. I thought the link MUST BE ACTIVE during the sleep mode if someone wants to wake the board via wake-on-lan. Is it right assumption? Or not?
Please point me somewhere... I need a sparkle...
Regards,
Gianluca Renzi
Hi Gianluca
one can look at patch provided on
Power Consumed under Standby with WOL Enable
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------