Re: [PATCH net-next 2/2] net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5
From: Yao Zi
Date: Mon Nov 16 2026 - 12:27:59 EST
On Mon, Nov 16, 2026 at 01:48:47PM -0300, Magnus Leatti wrote:
> Hi Yao,
>
> On Mon, Nov 16, 2026 at 03:17:00PM +0000, Yao Zi wrote:
> > > Does the chip automatically enables WoL and loads MAC from eFuse on
> > > power-on?
>
> Yes. I pulled the power cable, kept the driver from loading and dumped
> the registers before anything touched the chip: OOB WoL enabled, eFuse
> address in filter 0, PMT armed for magic packet, receiver on. The
> packet wake bit in WOL_CTRL is clear.
Nice. But with packet wake disabled by default, wouldn't the card fail
to wake the machine if it just recovers from a power failure?
This behavior is confusing to me, but yes, useful.
> > Aside from a clean power-on, its behavior on reset also matters.
>
> Same state, about 2 s after SYS_RESET. Probe disables OOB WoL before
> that, so a cold and a warm boot look the same to the driver. But the
> chip arms with the eFuse address, not the one in use. The vendor
> driver writes the address again after enabling OOB WoL, for the same
> reason.
Makes sense.
> > we might probably call stmmac_dvr_remove() in .shutdown() to detach
> > the NIC from kernel's infrastructure, then reset it with SYS_RESET to
> > get a functional WoL state in S5.
>
> YES! Bingo, and I built AND tested now :) .shutdown calls
> stmmac_dvr_remove(), then with "wol g":
>
> reset only no wake, 1 of 1
> reset, wait, address no wake, 1 of 1
> reset, wait, packet wake wake on the eFuse address, 1 of 1
> reset, wait, address, packet wake wake on the address in use, 3 of 3
> "wol d", remove only no wake, 1 of 1
> reboot, remove only link back, 1 of 1
>
> "wait" polls PMT until the chip has armed itself, 2.6 to 2.7 s, 7 of 7.
> "packet wake" is the bit in WOL_CTRL, the reset clears it. PME was
> enabled in every row but the first. It also wakes without PME and in
> D3hot, 1 of 1 each. No warning in any shutdown log.
>
> So v2 would be, glue only:
>
> - every shutdown: stmmac_dvr_remove()
> - power-off with WoL set: motorcomm_reset(), poll PMT, write the
> address in use, set the packet wake bit, pci_wake_from_d3(), D3hot
IMHO, this would be the right way to go, but I'd like to drop the part
of writing the MAC address, since AFAIK WoL from S5 is usually achieved
through the real hardware address by convention, and
> Two questions:
>
> 1) The glue writes MAC_ADDR0 directly after the remove, two writel().
> Is it reasonable?
> 2) Power-off takes about 2.7 s longer with WoL set. I can't write the
> address earlier: in a test that left the registers returning
> garbage until the driver was bound again.
if we keep using the real hardware address, at least problem 1
disappears, and I do think it's a little cursed (but not much) to write
the core MAC in a glue driver. And at least now we don't need to write
the address on our own, so if packet WOL bit could be set before PMT
polling succeeds, the second problem goes away, too.
> Maxime, this needs no helper in the core, please ignore my question.
>
> So my plan for this week: I'll write a v2 that addresses everything
> you've mentioned (once again, thanks) and send it your way. If
Then feel free to add a Suggested-by tag :)
> something else comes up there will be a v3, and a v4, until WoL works
> on every YT6801, NUC, laptop or add-in card. Deal?
>
> Magnus
--
Thanks,
Yao Zi
Meow-mrrp-mrow, I'm a cat.