WOL + u-boot + want to change power button so it suspend in u-boot(TLP) mode

hello guys I am using debian image built with fenix script with bellow enviroment parameters

`
== ENV CONFIG =======================
VERSION=1.0.10
KHADAS_BOARD=VIM3L
LINUX=4.9
UBOOT=2015.01
DISTRIBUTION=Debian
DISTRIB_RELEASE=buster
DISTRIB_TYPE=lxde
DISTRIB_ARCH=arm64
INSTALL_TYPE=EMMC
COMPRESS_IMAGE=no

== ONE LINE CONFIG ==================
source env/setenv.sh -q -s KHADAS_BOARD=VIM3L LINUX=4.9 UBOOT=2015.01 DISTRIBUTION=Debian DISTRIB_RELEASE=buster DISTRIB_TYPE=lxde DISTRIB_ARCH=arm64 INSTALL_TYPE=EMMC COMPRESS_IMAGE=no
`

  • I have followed this link as main guide khadas-wol-guide

  • and following bellow guide to solve issues since I haven’t been able to meet requierment wich is to boot from WOL in all cases khadas document out of box
    ( note: from this documents I resolved pm-utils disable-wol-service and ethernet negotiation for realtek pcie driver)

    1. debian-wol
    2. arch-linux-wol
  • currently I have observed WOL for three scenario:

    1. turn of power supply (by supply switch or removing cable)
    2. shutdown command
    3. power button for shutdown
    4. power button for boot
    5. reboot button at any time
  • results are

    1. first case of power cut works fine with WOL board boot when powered up and suspend in u-boot until magic packet sent for boot-up.( note: after powering up and suspending in u-boot it will take ~1min to establish Ethernet connection so wait in case first magic packet didn’t turn on board)
    2. in second and third cases when used power button or shutdown button board completely power off and won’t boot from WOL since it require to establish ethernet connection which establish in u-boot and then suspend there to for wait of magic packet.
    3. third and fourth is understandable since someone reached board physically to the board no need stick for boot-up from WOL.

so cumming back to my question here is how to make board go in WOL mode in which board suspend in u-boot and wait for magic packet on Ethernet port

  1. alternative of shutdown command
  2. change power button on boards function to so board go in WOL u-boot mode insted of completely power off

testing this pm-suspend command from this post → pm-suspend for wol that’s why not mentioned in title

hope any one can give me hints or guide where to look for @numbqq @Frank :sweat_smile:

here are the logs when power down button pressed after login. there is no mention of Ethernet or WOL for wakeup sources

[   21.748448@0] reboot: Power down
bl31 reboot reason: 0x108
bl31 reboot reason: 0x108
system cmd  0.
bl30 get wakeup sources!
process command 00000006
bl30 enter suspend!
Little core clk suspend rate 1908000000
Error: Wait for CPU3 Power off state timeout
Error: Wait for CPU2 Power off state timeout
Error: Wait for CPU1 Power off state timeout
Error: Wait for CPU0 Power off state timeout
Error: Power switching is denied by A55!!
Error: wait power state change failed
store restore gp0 pll
store restore gp1 pll
suspend_counter: 1
Enter ddr suspend
ddr suspend time: 15us
alarm=0S
process command 00000001
use vddee new table!

logs where mentioned WOL enable

  • u-boot
mac address: c8:63:14:71:32:1e
[KM]Error:f[key_manage_query_size]L515:key[deviceid] not programed yet
gpio: pin GPIOAO_7 (gpio 7) value is 1
saradc: 0x286, hw_ver: 0x32 (VIM3.V12)
Product checking: pass! Hardware version: VIM3.V12
normal power off
boot wol: enable
port mode is usb3.0

kernel logs by dmesg:

[    0.000000] Kernel command line: root=UUID=f0c92a91-ddbf-4df5-8c2d-3f634bc50c20 rootfstype=ext4 rootflags=data=writeback rw ubootpart=NULL console=ttyS0,115200n8  no_console_suspend consoleblank=0 lo 
[    0.000000] init_wol_state, wol_enable=1
[    0.000000] max cpufreq of cluster0 : 1908MHz
[    1.184379] mcu_probe
[    1.184388] mcu_probe: board: 3, hwver: 2
[    1.184784] create_mcu_attrs
[    1.184873] mcu_probe,wol enable=1

debian guide says output should be wake-on = g but here it’s shown “d”. it shouldn’t be cause of trouble right I made 3 services for redundancy to set wake on parameter as “g” but hasn’t been successful still fine with WOL when i turn off then on power supply to boot

khadas@Khadas:~$ sudo ethtool eth0
[sudo] password for khadas: 
Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                             100baseT/Half 100baseT/Full 
                                             1000baseT/Full 
        Link partner advertised pause frame use: No
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 0
        Transceiver: external
        Auto-negotiation: on
        Supports Wake-on: ug
        **Wake-on: d**
        Current message level: 0x0000003f (63)
                               drv probe link timer ifdown ifup
        Link detected: yes

tested this workarround post using pm-suspend but didn’t worked board dosn’t start and suspent in u-boot. board remain complete off

just found this on wakeup sources should WOL or ethernet mentioned here?

khadas@Khadas:~$ sudo cat /sys/kernel/debug/wakeup_sources
name                                    active_count    event_count     wakeup_count    expire_count    active_since    total_time      max_time        last_change prevent_suspend_time
sdio:0001:2                             800             1921            0               0               0               2463            1262            1993264  0
1-1.2                                   0               0               0               0               0               0               0               3018     0
ff660000.audiobus:vad                   0               0               0               0               0               0               0               2001     0
rtc                                     0               0               0               0               0               0               0               1416     0
ff3f0000.ethernet                       0               0               0               0               0               0               0               1054     0
alarmtimer                              0               0               0               0               0               0               0               972      0
autosleep                               0               0               0               0               0               0               0               204      0
deleted                                 0               0               0               0               0               0               0               0        0