Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Magnus Leatti <magnusleatti@kernelriot.com>
To: Yao Zi <me@ziyao.cc>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Giuseppe Nespolino <g.nespolino@gmail.com>,
	netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH net-next v2 0/2] net: stmmac: dwmac-motorcomm: shutdown hook and Wake-on-LAN from S5
Date: Fri, 20 Nov 2026 07:27:52 -0300	[thread overview]
Message-ID: <20261120102754.778283-1-magnusleatti@kernelriot.com> (raw)

YT6801 accepts "ethtool -s eth0 wol g" today, but ignores magic packets.
This series makes S5 Wake-on-LAN work. My patches here touches only the
glue.

v1 called stmmac_suspend() from .shutdown and Yao rejected that [1].
This is the design proposed by Yao, remove the device at shutdown, reset
the chip and let it arm itself.

Patch 1 just wires .shutdown to the existing remove.

Patch 2 arms WoL: after remove, it resets the chip, restores the cleared
packet-wake bit, enables PME and drops to D3hot.

Changes from v1:

 - Wake uses the eFuse address, not whatever the driver programmed.
   r8169 works the same way.
 - Magic Packets only.
 - D3hot now. No more polling so D3hot is clean.

Tested on a Celeron N3350 mini pc, NIC soldered, net-next at
6964ff21c5d8 with storm fix [2].

  net-next  wol g                   no wake, 3 of 3
  patched   wol g                   no wake on the address in use,
                                    wake on the eFuse address, 5 of 5
  patched   wol g, 15 min off       same, 1 of 1
  patched   wol ug                  same, 1 of 1
  patched   wol u, unicast frames   no wake, 1 of 1
  patched   wol d                   no wake, 1 of 1
  patched   wol g, interface down   no wake, 1 of 1
  patched   wol g, wakeup disabled  no wake, 1 of 1
  patched   wol g, reboot           reboots, link back, 3 of 3
  patched   wol g, kexec            new kernel, link back, 1 of 1
  patched   wol g, hibernate        same, resumes, link back, 2 of 2
  patched   wol g, cable out, in    no wake, 2 of 2

19 patched shutdowns, all clean.

Hibernate on this box ends in a normal power-off (S4 is off in the
BIOS), so it goes through .shutdown and arms the same way.

The last row is a true power loss: So if power drops, it just won't
wake. Meaning: It needs to be shut down cleanly through the driver
again. FWIW the vendor driver does the same: wakes after a normal
power-off, sleeps through everything after a power loss. So its a
hardware thing and not something a driver can fix.

Giuseppe, your Tested-by was for the v1 design so I couldn't carry it
over :(. I'm sorry, could you test again?

Sashiko's nagging on patch 1 of v1 [3] came from calling
stmmac_suspend() in .shutdown. v2 doesn't, so it's gone.

BTW stmmac has an old bug here: if a resume fails, NAPI stays off, and
then closing the interface just hangs in napi_disable().

Changes in v2:
 - .shutdown no longer calls stmmac_suspend(). It removes the device.
 - A reset arms the chip, no more OOB WoL or MAC address writes.
 - D3hot at power-off, v1 stayed in D0.
 - Magic packet only, on the eFuse address.
 - The wake condition is read under RTNL.
 - Added Suggested-by Yao on both patches.

v1: https://lore.kernel.org/netdev/20261116091757.1656602-1-magnusleatti@kernelriot.com/

[1] https://lore.kernel.org/netdev/avsTEglKKD_wl_Fi@pie/
[2] https://lore.kernel.org/netdev/20261113103236.2184751-1-maxime.chevallier@bootlin.com/
[3] https://lore.kernel.org/netdev/179499351041.3136.14889707783816630750@kernel.org/

Magnus Leatti (2):
  net: stmmac: dwmac-motorcomm: remove the device at shutdown
  net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5

 .../ethernet/stmicro/stmmac/dwmac-motorcomm.c | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)


base-commit: 2208ab00f4f213ade91ab775e7f8c4dacdcc856e
-- 
2.56.1



             reply	other threads:[~2026-11-20 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 10:27 Magnus Leatti [this message]
2026-11-20 10:27 ` [PATCH net-next v2 1/2] net: stmmac: dwmac-motorcomm: remove the device at shutdown Magnus Leatti
2026-11-20 10:27 ` [PATCH net-next v2 2/2] net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5 Magnus Leatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261120102754.778283-1-magnusleatti@kernelriot.com \
    --to=magnusleatti@kernelriot.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=g.nespolino@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=me@ziyao.cc \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox