* [PATCH net-next v3 0/2] net: stmmac: dwmac-motorcomm: shutdown hook and Wake-on-LAN from S5
@ 2026-11-30 10:16 Magnus Leatti
2026-11-30 10:16 ` [PATCH net-next v3 1/2] net: stmmac: dwmac-motorcomm: remove the device at shutdown Magnus Leatti
2026-11-30 10:17 ` [PATCH net-next v3 2/2] net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5 Magnus Leatti
0 siblings, 2 replies; 5+ messages in thread
From: Magnus Leatti @ 2026-11-30 10:16 UTC (permalink / raw)
To: Yao Zi, Maxime Chevallier, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Maxime Coquelin, Alexandre Torgue, Sai Krishna,
Giuseppe Nespolino, netdev, linux-stm32, linux-arm-kernel,
linux-kernel
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.
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.
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 v3:
- Patch 1: added the Fixes tag (Yao).
- Patch 2: dropped the test numbers from the commit message and two
comments (Yao).
- No code change.
- Collected Reviewed-by from Maxime and Yao, Tested-by from Giuseppe.
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.
v2: https://lore.kernel.org/netdev/20261120102754.778283-1-magnusleatti@kernelriot.com/
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/
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 | 35 +++++++++++++++++++
1 file changed, 35 insertions(+)
base-commit: 81159a672c331993566a12ad8e07532b38355cba
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH net-next v3 1/2] net: stmmac: dwmac-motorcomm: remove the device at shutdown
2026-11-30 10:16 [PATCH net-next v3 0/2] net: stmmac: dwmac-motorcomm: shutdown hook and Wake-on-LAN from S5 Magnus Leatti
@ 2026-11-30 10:16 ` Magnus Leatti
2026-12-01 10:18 ` netdev-bot+sashiko
2026-11-30 10:17 ` [PATCH net-next v3 2/2] net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5 Magnus Leatti
1 sibling, 1 reply; 5+ messages in thread
From: Magnus Leatti @ 2026-11-30 10:16 UTC (permalink / raw)
To: Yao Zi, Maxime Chevallier, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Maxime Coquelin, Alexandre Torgue, Sai Krishna,
Giuseppe Nespolino, netdev, linux-stm32, linux-arm-kernel,
linux-kernel
No .shutdown here, so reboot, kexec and power-off leave the MAC and
DMA running. This chip keeps its registers through S5 too.
Hook .shutdown to stmmac_dvr_remove(): interface closed, DMA and MAC
stopped, PHY dropped.
Fixes: 02ff155ea281 ("net: stmmac: Add glue driver for Motorcomm YT6801 ethernet controller")
Suggested-by: Yao Zi <me@ziyao.cc>
Signed-off-by: Magnus Leatti <magnusleatti@kernelriot.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Tested-by: Giuseppe Nespolino <g.nespolino@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
index 42f0b11a7b60..63ce2301a0f6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
@@ -374,6 +374,7 @@ static struct pci_driver dwmac_motorcomm_pci_driver = {
.id_table = dwmac_motorcomm_pci_id_table,
.probe = motorcomm_probe,
.remove = motorcomm_remove,
+ .shutdown = motorcomm_remove,
.driver = {
.pm = &stmmac_simple_pm_ops,
},
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net-next v3 1/2] net: stmmac: dwmac-motorcomm: remove the device at shutdown
2026-11-30 10:16 ` [PATCH net-next v3 1/2] net: stmmac: dwmac-motorcomm: remove the device at shutdown Magnus Leatti
@ 2026-12-01 10:18 ` netdev-bot+sashiko
0 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sashiko @ 2026-12-01 10:18 UTC (permalink / raw)
To: magnusleatti
Cc: me, maxime.chevallier, andrew+netdev, davem, edumazet, kuba,
pabeni, mcoquelin.stm32, alexandre.torgue, saikrishnag,
g.nespolino, netdev, linux-stm32, linux-arm-kernel, linux-kernel
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1 (1)
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] Remove can run twice on one bound device, ending in BUG_ON()
or a use-after-free.
- [Low] The commit message gives no user-visible symptom, yet the patch
carries a Fixes: tag.
Pre-existing issues:
- [Low] (Baseline decision: false; kept only because
requires_validation=true.) The concern is that the new shutdown path…
--
net: stmmac: dwmac-motorcomm: remove the device at shutdown
This patch points the pci_driver .shutdown callback of the Motorcomm
YT6801 glue driver at motorcomm_remove(). As a result,
stmmac_dvr_remove() runs at reboot, kexec and power-off. The intent is to
close the interface, stop the DMA and MAC, and drop the PHY before the
system goes down.
> No .shutdown here, so reboot, kexec and power-off leave the MAC and
> DMA running. This chip keeps its registers through S5 too.
[Severity: Low]
The patch carries a Fixes: tag. Could the commit message say what
user-visible symptom it fixes?
For kexec, pci_device_shutdown() already clears bus mastering after the
driver's shutdown hook, even when no .shutdown is set:
drivers/pci/pci-driver.c:pci_device_shutdown() {
...
if (kexec_in_progress && (pci_dev->current_state <= PCI_D3hot))
pci_clear_master(pci_dev);
}
The next kernel's motorcomm_probe() also calls motorcomm_reset() before
any other setup.
For a regular reboot, the comment in pci_device_shutdown() notes that
firmware stops device DMA anyway.
That leaves the S5 register retention case. What actually goes wrong
there? It could be stale DMA once firmware re-enables bus mastering,
extra standby power, or something else.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
> index 42f0b11a7b606..63ce2301a0f69 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
> @@ -374,6 +374,7 @@ static struct pci_driver dwmac_motorcomm_pci_driver = {
> .id_table = dwmac_motorcomm_pci_id_table,
> .probe = motorcomm_probe,
> .remove = motorcomm_remove,
> + .shutdown = motorcomm_remove,
[Severity: Medium]
Can stmmac_dvr_remove() now run twice for the same bound device?
pci_device_shutdown() calls drv->shutdown() but leaves the driver bound.
The netdev comes from devm_alloc_etherdev_mqs(), so dev_get_drvdata()
still returns it afterwards. Any later .remove then runs the full
teardown again:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:stmmac_dvr_remove() {
...
unregister_netdev(ndev);
...
phylink_destroy(priv->phylink);
...
destroy_workqueue(priv->wq);
mutex_destroy(&priv->lock);
mutex_destroy(&priv->est_lock);
bitmap_free(priv->af_xdp_zc_qps);
...
}
None of these pointers are cleared. Nothing records that the teardown
has already run.
Here are some ways .remove can follow .shutdown:
- A PCIe hot-unplug or link-down handled by pciehp or DPC between this
device's shutdown and its parent port's shutdown. device_shutdown()
holds device_lock only around each ->shutdown. Its own comment says
"device unplug events may also start pulling devices offline, even as
the system is shutting down".
- A sysfs unbind or rmmod racing with reboot, since userspace is not
frozen.
- A failed power-off. reboot(2) with LINUX_REBOOT_CMD_POWER_OFF does
kernel_power_off(); do_exit(0); so the system keeps running with the
driver bound but already torn down. A later unbind or rmmod then calls
.remove.
On the second pass, unregister_netdevice_many_notify() would hit:
BUG_ON(dev->reg_state != NETREG_REGISTERED);
phylink_destroy() and bitmap_free() would also double free, and
destroy_workqueue() would run on a freed workqueue.
Before this patch there was no .shutdown, so the teardown could only run
once.
The follow-up commit "net: stmmac: dwmac-motorcomm: support Wake-on-LAN
from S5" replaces this with a dedicated motorcomm_shutdown(). That
function still calls stmmac_dvr_remove() without a guard, and it may
leave the device in D3hot before a later remove. So the problem still
exists at the end of the series.
dwmac-sun8i is the only other stmmac glue driver with a shutdown hook. It
uses a narrower sun8i_dwmac_shutdown() instead of reusing remove. Would a
similar shutdown-specific handler avoid the double teardown here?
[Severity: Low]
This isn't a bug introduced by this patch, but the new shutdown path
leaves the YT6801 wake logic disarmed at power-off. motorcomm_init()
disables OOB WoL at probe:
drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c:motorcomm_init() {
...
writel(OOB_WOL_CTRL_DIS, priv->base + OOB_WOL_CTRL);
}
MAC PMT is not armed, PME_En is not set, and the device stays in D0, so
magic-packet wake from S5 still does not work.
Wake from S5 did not work before this patch either. stmmac arms PMT only
in stmmac_suspend(), and pci_wake_from_d3() was never called on
power-off.
The next commit in the series, "net: stmmac: dwmac-motorcomm: support
Wake-on-LAN from S5", fixes this. Its motorcomm_shutdown() first checks
that system_state == SYSTEM_POWER_OFF, the interface is running,
WAKE_MAGIC is set and device_may_wakeup() is true. If so, it:
- calls motorcomm_reset() to re-enable OOB WoL
- sets WOL_CTRL_PKT_EN
- calls pci_wake_from_d3(pdev, true)
- enters PCI_D3hot
That commit also documents 'wol u' as unsupported.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130101700.1715598-1-magnusleatti%40kernelriot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next v3 2/2] net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5
2026-11-30 10:16 [PATCH net-next v3 0/2] net: stmmac: dwmac-motorcomm: shutdown hook and Wake-on-LAN from S5 Magnus Leatti
2026-11-30 10:16 ` [PATCH net-next v3 1/2] net: stmmac: dwmac-motorcomm: remove the device at shutdown Magnus Leatti
@ 2026-11-30 10:17 ` Magnus Leatti
2026-12-01 10:18 ` netdev-bot+sashiko
1 sibling, 1 reply; 5+ messages in thread
From: Magnus Leatti @ 2026-11-30 10:17 UTC (permalink / raw)
To: Yao Zi, Maxime Chevallier, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Maxime Coquelin, Alexandre Torgue, Sai Krishna,
Giuseppe Nespolino, netdev, linux-stm32, linux-arm-kernel,
linux-kernel
"wol g" is accepted, but the chip sleeps right through magic packets
in S5: motorcomm_init() turns OOB WoL off and nothing turns it back on
at power-off.
Turns out the chip can just arm itself. Hit it with a reset, OOB WoL
comes right back on, and about 2-3 s later it has the PHY up, receiver
running, the eFuse address loaded into the first MAC filter, and PMT
ready for magic packets. Timed that from userspace without a driver
bound.
So on a power-off with "wol g": remove, reset, set WOL_CTRL_PKT_EN
again because the reset clears it, enable PME, D3hot.
Notes:
- It wakes on the eFuse address, not the software one. Same as r8169.
- Magic packets only. "wol u", reboot, kexec and interface down stop
at the remove.
- Hibernation that powers off through .shutdown arms too, and resume
copes without a reset. Tried twice: woke on the packet, link back.
- After a power loss (cable out and back in, BIOS set to stay off) it
won't wake until the next clean shutdown. The vendor driver does
the same, so that's the hardware.
Suggested-by: Yao Zi <me@ziyao.cc>
Signed-off-by: Magnus Leatti <magnusleatti@kernelriot.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Yao Zi <me@ziyao.cc>
Tested-by: Giuseppe Nespolino <g.nespolino@gmail.com>
---
.../ethernet/stmicro/stmmac/dwmac-motorcomm.c | 36 ++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
index 63ce2301a0f6..41e440ed141e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
@@ -12,6 +12,7 @@
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/pci.h>
+#include <linux/rtnetlink.h>
#include <linux/slab.h>
#include <linux/stmmac.h>
@@ -27,6 +28,9 @@
#define EPHY_CTRL 0x1004
/* Clearing this bit asserts resets for internal MDIO bus and PHY */
#define EPHY_MDIO_PHY_RESET BIT(0)
+#define WOL_CTRL 0x100c
+/* Magic and remote wake-up packet enable */
+#define WOL_CTRL_PKT_EN BIT(1)
#define OOB_WOL_CTRL 0x1010
#define OOB_WOL_CTRL_DIS BIT(0)
#define MGMT_INT_CTRL0 0x1100
@@ -363,6 +367,36 @@ static void motorcomm_remove(struct pci_dev *pdev)
stmmac_dvr_remove(&pdev->dev);
}
+static void motorcomm_shutdown(struct pci_dev *pdev)
+{
+ struct net_device *ndev = dev_get_drvdata(&pdev->dev);
+ struct stmmac_priv *spriv = netdev_priv(ndev);
+ struct dwmac_motorcomm_priv *priv = spriv->plat->bsp_priv;
+ bool wake;
+ u32 reg;
+
+ /* Userspace is still running and may close the interface */
+ rtnl_lock();
+ wake = system_state == SYSTEM_POWER_OFF && netif_running(ndev) &&
+ (spriv->wolopts & WAKE_MAGIC) && device_may_wakeup(&pdev->dev);
+ rtnl_unlock();
+
+ stmmac_dvr_remove(&pdev->dev);
+
+ if (!wake)
+ return;
+
+ /* Reset re-enables OOB WoL; left alone, chip arms itself (eFuse MAC) */
+ motorcomm_reset(priv);
+
+ reg = readl(priv->base + WOL_CTRL);
+ reg |= WOL_CTRL_PKT_EN;
+ writel(reg, priv->base + WOL_CTRL);
+
+ pci_wake_from_d3(pdev, true);
+ pci_set_power_state(pdev, PCI_D3hot);
+}
+
static const struct pci_device_id dwmac_motorcomm_pci_id_table[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_MOTORCOMM, 0x6801) },
{ },
@@ -374,7 +408,7 @@ static struct pci_driver dwmac_motorcomm_pci_driver = {
.id_table = dwmac_motorcomm_pci_id_table,
.probe = motorcomm_probe,
.remove = motorcomm_remove,
- .shutdown = motorcomm_remove,
+ .shutdown = motorcomm_shutdown,
.driver = {
.pm = &stmmac_simple_pm_ops,
},
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net-next v3 2/2] net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5
2026-11-30 10:17 ` [PATCH net-next v3 2/2] net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5 Magnus Leatti
@ 2026-12-01 10:18 ` netdev-bot+sashiko
0 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sashiko @ 2026-12-01 10:18 UTC (permalink / raw)
To: magnusleatti
Cc: me, maxime.chevallier, andrew+netdev, davem, edumazet, kuba,
pabeni, mcoquelin.stm32, alexandre.torgue, saikrishnag,
g.nespolino, netdev, linux-stm32, linux-arm-kernel, linux-kernel
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c,
motorcomm_shutdown() arms S5 wake on a board whose eFuse holds no MAC…
- [Medium] motorcomm_shutdown() takes a snapshot of netif_running(ndev),
spriv->wolopts and device_may_wakeup() under rtnl_lock() and stores it…
- [Medium] motorcomm_shutdown() starts the chip's self-arm sequence by
toggling SYS_RESET.
- [Low] motorcomm_shutdown() releases SYS_RESET and, with no settle delay
and no read-back, runs a read-modify-write on WOL_CTRL to set…
--
net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5
This adds a separate .shutdown callback to the YT6801 glue driver. On
power-off with magic packet WoL enabled, it removes the stmmac device and
resets the chip so that it re-arms OOB WoL by itself using the eFuse MAC.
It then sets WOL_CTRL_PKT_EN again, enables PME and puts the function in
D3hot.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
> index 63ce2301a0f69..41e440ed141e3 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
[ ... ]
> @@ -363,6 +367,36 @@ static void motorcomm_remove(struct pci_dev *pdev)
> stmmac_dvr_remove(&pdev->dev);
> }
>
> +static void motorcomm_shutdown(struct pci_dev *pdev)
> +{
> + struct net_device *ndev = dev_get_drvdata(&pdev->dev);
> + struct stmmac_priv *spriv = netdev_priv(ndev);
> + struct dwmac_motorcomm_priv *priv = spriv->plat->bsp_priv;
> + bool wake;
> + u32 reg;
> +
> + /* Userspace is still running and may close the interface */
> + rtnl_lock();
> + wake = system_state == SYSTEM_POWER_OFF && netif_running(ndev) &&
> + (spriv->wolopts & WAKE_MAGIC) && device_may_wakeup(&pdev->dev);
> + rtnl_unlock();
> +
> + stmmac_dvr_remove(&pdev->dev);
[Severity: Medium]
Can the value of wake go stale between rtnl_unlock() and the netdev
teardown?
Userspace is still running during device_shutdown(). A request that was
blocked on rtnl can take it right after this rtnl_unlock() and complete
successfully. Examples are "ethtool -s <dev> wol d" or
"ip link set <dev> down":
phylink_ethtool_set_wol()
stmmac_mac_wol_set()
device_set_wakeup_enable(priv->device, !!wolopts);
...
priv->wolopts = wolopts;
After that, stmmac_dvr_remove()->unregister_netdev() runs. The old value
of wake is still used to reset the chip, set WOL_CTRL_PKT_EN, enable PME
and enter D3hot.
Could the machine then wake from S5 on a magic packet after WoL was
disabled or the interface was brought down? That would go against the
commit message note that "reboot, kexec and interface down stop at the
remove". The reverse case, enabling WoL in that window, would leave the
device unarmed.
Would it help to call netif_device_detach(ndev) in the same rtnl section
as the snapshot? Another option is to keep the wake decision and the
netdev teardown in one exclusion region.
> +
> + if (!wake)
> + return;
> +
> + /* Reset re-enables OOB WoL; left alone, chip arms itself (eFuse MAC) */
> + motorcomm_reset(priv);
[Severity: Medium]
What happens here on boards whose eFuse holds no MAC address?
motorcomm_probe() already handles that case by falling back to a random
address:
ret = motorcomm_efuse_read_mac(&pdev->dev, priv, res.mac);
if (ret == -ENOENT) {
dev_warn(&pdev->dev, "eFuse contains no valid MAC address\n");
dev_warn(&pdev->dev, "fallback to random MAC address\n");
eth_random_addr(res.mac);
The commit message says the chip arms itself with "the eFuse address
loaded into the first MAC filter". It also says "It wakes on the eFuse
address, not the software one".
On such a board the random MAC is the only address the network knows.
The wake decision above only checks system_state, netif_running(),
WAKE_MAGIC and device_may_wakeup(). Nothing records whether probe found
an eFuse MAC.
With "wol g" set, would this path silently arm the chip with an address
that a magic packet sent to the interface can never match? Should arming
be skipped, or at least warned about, when probe fell back to a random
MAC? Alternatively, should the commit message state this limitation?
> +
> + reg = readl(priv->base + WOL_CTRL);
> + reg |= WOL_CTRL_PKT_EN;
> + writel(reg, priv->base + WOL_CTRL);
[Severity: Low]
Is it safe to do this read-modify-write right after the reset is
released?
motorcomm_probe() follows the same motorcomm_reset() with a settle delay,
because the eFuse controller is still loading internal data:
motorcomm_reset(priv);
/*
* After system reset, the eFuse controller needs time to load
* its internal data. Without this delay, eFuse reads return
* all zeros, causing MAC address detection to fail.
*/
usleep_range(2000, 5000);
The commit message also describes the chip running its own arming
sequence for about 2-3 s after the reset.
If the eFuse autoload or the self-arm sequence writes WOL_CTRL after this
RMW, PKT_EN would be lost. Nothing reads the register back, so the driver
would still enter D3hot as if wake were armed.
On the other hand, the EPHY_CTRL RMW in motorcomm_reset() takes effect
immediately after the reset, and the patch was tested successfully. So
this depends on undocumented hardware behaviour.
Would a short delay or a read-back check here be worth adding?
> +
> + pci_wake_from_d3(pdev, true);
> + pci_set_power_state(pdev, PCI_D3hot);
> +}
[Severity: Medium]
Does the self-arm sequence started by motorcomm_reset() have time to
finish before power is removed?
The commit message says it takes "about 2-3 s" for the chip to bring the
PHY up, start the receiver, load the eFuse MAC into the first MAC filter
and get PMT ready. That was timed from userspace with no driver bound,
not across an S5 transition.
Here the function moves the device to D3hot and returns at once. Nothing
in the rest of kernel_power_off() waits for that window:
kernel/reboot.c:kernel_power_off() {
kernel_shutdown_prepare(SYSTEM_POWER_OFF);
do_kernel_power_off_prepare();
migrate_to_reboot_cpu();
syscore_shutdown();
pr_emerg("Power down\n");
pr_flush(1000, true);
kmsg_dump(KMSG_DUMP_SHUTDOWN);
machine_power_off();
}
The commit message also notes that after a power loss the chip doesn't
arm itself again until the next clean shutdown.
Suppose PERST# assertion or main-power removal interrupts the sequence.
Could the device be left with OOB WoL and PME enabled but no programmed
MAC filter or PMT, so that "wol g" fails silently?
Is there a completion indication that could be polled here? Or does the
hardware guarantee that the sequence survives the power transition?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130101700.1715598-1-magnusleatti%40kernelriot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-01 10:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30 10:16 [PATCH net-next v3 0/2] net: stmmac: dwmac-motorcomm: shutdown hook and Wake-on-LAN from S5 Magnus Leatti
2026-11-30 10:16 ` [PATCH net-next v3 1/2] net: stmmac: dwmac-motorcomm: remove the device at shutdown Magnus Leatti
2026-12-01 10:18 ` netdev-bot+sashiko
2026-11-30 10:17 ` [PATCH net-next v3 2/2] net: stmmac: dwmac-motorcomm: support Wake-on-LAN from S5 Magnus Leatti
2026-12-01 10:18 ` netdev-bot+sashiko
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®