Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Magnus Leatti <magnusleatti@kernelriot.com>
To: me@ziyao.cc, Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: 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>,
	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: Re: [PATCH net-next 2/2] net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5
Date: Mon, 16 Nov 2026 13:48:47 -0300	[thread overview]
Message-ID: <20261116164847.3432765-1-magnusleatti@kernelriot.com> (raw)
In-Reply-To: <avsebFtnIASV-KpV@pie>

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


  reply	other threads:[~2026-11-16 16:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  9:17 [PATCH net-next 0/2] net: stmmac: dwmac-motorcomm: shutdown hook and Wake-on-LAN from S5 Magnus Leatti
2026-11-16  9:17 ` [PATCH net-next 1/2] net: stmmac: dwmac-motorcomm: quiesce the device at shutdown Magnus Leatti
2026-11-16 14:33   ` Yao Zi
2026-11-16 14:58     ` Magnus Leatti
2026-11-16  9:17 ` [PATCH net-next 2/2] net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5 Magnus Leatti
2026-11-16 15:08   ` Yao Zi
2026-11-16 15:17     ` Yao Zi
2026-11-16 16:48       ` Magnus Leatti [this message]
2026-11-16 17:26         ` Yao Zi
2026-11-16 11:23 ` [PATCH net-next 0/2] net: stmmac: dwmac-motorcomm: shutdown hook and " Giuseppe Nespolino
2026-11-16 11:36   ` 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=20261116164847.3432765-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