Imx8mp wake-on-lan

Hello @loris.teq, @bw908 and @edwaugh !

Thank you for your patience!

After an intense and fruitful Embedded World (the best one I attended so far :D), I managed to test Wake-On-Lan on Torizon OS and Verdin iMX8MP.

TL;DR: it just worked.

See below for more details.

Hardware and Software details:

torizon@verdin-imx8mp-15010575:~$ sudo tdx-info

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           6.6.54-7.1.0-g3493ccd66900 #1-Torizon SMP PREEMPT Tue Dec 17 21:04:41 UTC 2024
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/500611918e07c8fe1cf9b3cc8f76327936d80d93ad461d3fe0da9c30624ff84b/0
Distro name:              NAME="Torizon OS"
Distro version:           VERSION_ID=7.1.0-build.4
Distro variant:           VARIANT="Docker"
Hostname:                 verdin-imx8mp-15010575
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Plus on Verdin Development Board
Toradex version:          0065 V1.1A
Serial number:            15010575
Processor arch:           aarch64
------------------------------------------------------------
  • Yavia V1.0A carrier board
  • Wired Ethernet
  • USB-C for access to the debug port (so I can run some commands and see kernel’s messages)
  • My Ubuntu 22.04 PC to send the Wake-On-Lan package to the module
    • This is connected to the same network as the module via wired Ethernet. But connecting it via Wi-Fi to the same network should work just the same.

Test procedure

I just used the same PDF I shared previously. Exact steps:

  1. Flash the module with Torizon OS 7.1.0
  2. Get the module’s MAC address: ip link ip link show ethernet0 (let’s call it <verdin-mac>)
  3. Configure Wake-On-Lan: sudo ethtool -s ethernet0 wol g
  4. Put the module to sleep: echo s2idle | sudo tee /sys/power/mem_sleep; echo mem | sudo tee /sys/power/state
  5. Trigger the Wake-On-Lan package from another machine: sudo etherwake -i <pc-network-interface-name> <verdin-mac>
  6. Module wakes up

For reference, check the dmesg below:

WOL enabled ----------> [  490.122913] stmmac: wakeup enable
put module to sleep --> [  699.040975] PM: suspend entry (s2idle)
						[  699.041740] Filesystems sync: 0.000 seconds
						[  699.043186] Freezing user space processes
						[  699.044794] Freezing user space processes completed (elapsed 0.001 seconds)
						[  699.044811] OOM killer disabled.
						[  699.044815] Freezing remaining freezable tasks
						[  699.046046] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
						[  699.046053] printk: Suspending console(s) (use no_console_suspend to debug)
						[  699.210873] imx-dwmac 30bf0000.ethernet ethernet0: FPE workqueue stop
						[  699.512660] caam 30900000.crypto: registering rng-caam
						[  699.520548] imx-dwmac 30bf0000.ethernet ethernet0: Link is Down
						[  699.520715] imx-dwmac 30bf0000.ethernet ethernet0: No Safety Features support found
						[  699.520736] imx-dwmac 30bf0000.ethernet ethernet0: IEEE 1588-2008 Advanced Timestamp supported
						[  699.521772] imx-dwmac 30bf0000.ethernet ethernet0: FPE workqueue start
						[  699.522393] usb-conn-gpio 38100000.usb:connector: repeated role: device
						[  699.522670] imx-dwmac 30bf0000.ethernet ethernet0: Link is Up - 1Gbps/Full - flow control rx/tx
						[  699.522850] xhci-hcd xhci-hcd.1.auto: xHC error in resume, USBSTS 0x411, Reinit
						[  699.522859] usb usb1: root hub lost power or was reset
						[  699.522864] usb usb2: root hub lost power or was reset
						[  699.868991] usb 1-1: reset high-speed USB device number 2 using xhci-hcd
WOL package sent -----> [  700.221935] OOM killer enabled.
						[  700.221945] Restarting tasks ... done.
						[  700.223637] random: crng reseeded on system resumption
						[  700.223901] PM: suspend exit

Could you please test like this? Do you get a different outcome?

Best regards,

is there a reason you are using this instead of systemctl suspend ? That is the only difference between your test and my most recent one which did not work.

Hi @bw908 !

I just followed Toradex’s documentation: Suspend/Resume (Linux) | Toradex Developer Center

To use systemctl suspend, you can check how it is implemented to see what could be the difference.

If you used systemctl suspend in your tests, is it possible that your module didn’t actually suspend? (just a wild guess :sweat_smile:)

Best regards,

Hi @henrique.tx, this is great work and we found the same. Any chance you could use your setup to enable wake-on-cable-connection? That is what we really need, ideally I don’t want to send technicians into the field with a giant list of MAC addresses.

Hi @edwaugh !

That’s an interesting use case.

To actually help you with ideas for a solution, I would need more information about how your technicians work.

Thinking out loud here: you could have some way of getting the specific MAC address of the specific machine (so no need for a giant list of MAC addresses) - like a QR code - and/or use Toradex’s MAC address, which is made out of the module’s serial number (MAC Address | Toradex Developer Center).

My general idea here is: you can try to solve it without getting into deeper hardware/software solution.

You could even develop a software that would send several WOL packets to the possible MAC addresses. Here you could even limit the list of MAC addresses by filtering them by region/customer/whatever - therefore you would need to somehow track the MAC address to have such table/database. So the technician would simply need to connect the cable and wait a bit for the software to send the WOL packet to the correct MAC address. TBH, this sounds plausible :slight_smile:

To be honest, I am not aware of such specific approach. Would you be able to share some reference(s)?

There are several ways of waking up a module:

You could try to use some of them.

If you really want to have the module waking up by specifically plugging an Ethernet cable, to the best of my knowledge, you would need to implement it via some interruption. Something like the insertion of the Ethernet cable would trigger a “button” that is configured to wake up the system.

Let us know if these ideas are helpful to you. :slight_smile:

Best regards,

Thanks @henrique.tx, you are correct, maybe there is a way we can work around it procedurally but I think we are also very close to it working. By looking at my and Rocco’s posts above I think the hardware is already in place to support it, it just needs to be enabled:

  1. Make the device tree change that @jeremias.tx describes to keep the PHY powered in sleep
  2. Configure the PHY to enable the wake on connect feature using the MDIO tool as Rocco describes here: Imx8mp wake-on-lan - #23 by RoccoBr

The bit that still remains is to figure out the interrupt waking up the device, Jeremias put some notes in his last message here: Imx8mp wake-on-lan - #30 by jeremias.tx

Hi @edwaugh !

I see. Let us know (in a new and specific thread) if you need further help on that specific need.


Regarding this specific thread (Wake-On-Lan on Verdin iMX8MP), is this solved? If yes, could you please mark the most suitable message as the Solution?

If this is not yet solved, please let me know what is missing. :slight_smile:

Best regards,

Hi @henrique.tx, sorry I wasn’t clear, we had to stop working on this ages ago and have not got back to it yet. We might be able to make the time to have another try but it would be nice if this was a core feature of Torizon or if you could make a guide to getting it to work.

Hi @edwaugh !

I am not sure what you mean by core feature of Torizon :thinking:… As we could see, the Wake-On-Lan is working (and there are more wake-up methods available: Suspend/Resume (Linux) | Toradex Developer Center and How to Suspend/Resume on Torizon OS | Toradex Developer Center). Application-specific approaches to wake-up can be developed on top of those already available.

As for the guide, I do agree. I triggered the documentation team to add the Wake-On-Lan how-to of this thread to be added to the documentation.

Best regards,