Re: [PATCH net-next 2/2] net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5
From: Magnus Leatti
Date: Mon Nov 16 2026 - 11:49:31 EST
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.
> 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.
> 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
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.
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
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