mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yao Zi <me@ziyao.cc>
To: Magnus Leatti <magnusleatti@kernelriot.com>,
	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 17:26:53 +0000	[thread overview]
Message-ID: <avs83CgSuGULMzmq@pie> (raw)
In-Reply-To: <20261116164847.3432765-1-magnusleatti@kernelriot.com>

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.

  reply	other threads:[~2026-11-16 17:27 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 " 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
2026-11-16 17:26         ` Yao Zi [this message]
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=avs83CgSuGULMzmq@pie \
    --to=me@ziyao.cc \
    --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=magnusleatti@kernelriot.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --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

all inboxes | Powered by JetHome®