* [PATCH RFC net 0/2] net: phy: dp83867: fix Wake-on-LAN without a PHY IRQ
@ 2026-11-27 18:44 Willie Wiholm via B4 Relay
2026-11-27 18:44 ` [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN Willie Wiholm via B4 Relay
2026-11-27 18:44 ` [PATCH RFC net 2/2] net: phy: dp83867: clear latched WoL interrupt before suspend Willie Wiholm via B4 Relay
0 siblings, 2 replies; 6+ messages in thread
From: Willie Wiholm via B4 Relay @ 2026-11-27 18:44 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Thomas Haemmerle
Cc: netdev, Willie Wiholm, stable
On an Intel Elkhart Lake board (congatec conga-SA7, dwmac-intel with a
DP83867 over RGMII) Wake-on-LAN from S3 does not work on the first
suspend after boot or after a link down/up.
Patch 1 sets CFG3.INT_OE when WoL is enabled. Without a PHY IRQ the
driver never sets it, so the pin stays a power-down input. The firmware
sets it, but the soft reset on attach clears it, so the first suspend
after boot does not wake up.
Patch 2 reads ISR before suspend. Nothing reads it when the PHY is
polled, so a magic packet received while the system is running leaves
the WoL interrupt latched, and the next suspend does not wake up.
Tested on the board with net (28a371228d4e): the first suspend after
boot, after link down/up and after a magic packet received while
running all wake up on a unicast magic packet.
Questions:
1. Patch 1 makes the pin an output when WoL is enabled. Would you
rather preserve the firmware setting across the soft reset, as
043777e94880 does for the LED registers?
2. Patch 2 uses PHY_ALWAYS_CALL_SUSPEND to get a hook before suspend,
like bcm54xx. Is that acceptable?
I used an AI coding assistant (Claude) for parts of the analysis, the
test automation and for drafting the cover letter. I have
reviewed the changes and tested them on the hardware.
Signed-off-by: Willie Wiholm <willie.wiholm@tritechsolutions.se>
---
Willie Wiholm (2):
net: phy: dp83867: set INT_OE when enabling Wake-on-LAN
net: phy: dp83867: clear latched WoL interrupt before suspend
drivers/net/phy/dp83867.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
base-commit: 28a371228d4eb4857cc31eeb1a0d7d01e9c3ea2f
change-id: 20261127-wol-net-10fed393954a
Best regards,
--
Willie Wiholm <willie.wiholm@tritechsolutions.se>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN
2026-11-27 18:44 [PATCH RFC net 0/2] net: phy: dp83867: fix Wake-on-LAN without a PHY IRQ Willie Wiholm via B4 Relay
@ 2026-11-27 18:44 ` Willie Wiholm via B4 Relay
2026-11-27 18:56 ` Andrew Lunn
2026-11-27 18:44 ` [PATCH RFC net 2/2] net: phy: dp83867: clear latched WoL interrupt before suspend Willie Wiholm via B4 Relay
1 sibling, 1 reply; 6+ messages in thread
From: Willie Wiholm via B4 Relay @ 2026-11-27 18:44 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Thomas Haemmerle
Cc: netdev, Willie Wiholm, stable
From: Willie Wiholm <willie.wiholm@tritechsolutions.se>
dp83867_set_wol() enables the WoL interrupt in MICR, so a detected
magic packet is signalled on the INT/PWDN_N pin. That pin is only an
interrupt output when CFG3.INT_OE is set, and dp83867_config_init()
sets INT_OE only when the PHY has a valid IRQ. Otherwise the pin stays
a power-down input and the WoL event never leaves the PHY.
This happens on Intel Elkhart Lake boards with dwmac-intel, where the
PHY is polled (no PHY IRQ in Linux) and INT/PWDN_N is wired to the MAC,
which raises PME to wake the system.
The firmware on such a board (congatec conga-SA7) sets INT_OE, but the
global soft reset in dp83867_phy_reset() clears it on every attach. As
a result the first suspend after boot or after a link down/up never
wakes up. Later suspends do wake, because the firmware sets INT_OE
again on S3 resume, which makes the bug look intermittent.
Set INT_OE when WoL is enabled. When WoL is disabled, clear it again
if the PHY has no IRQ, restoring the reset default. PHYs with a valid
IRQ already have INT_OE set, so nothing changes for them.
Fixes: caabee5b53f5 ("net: phy: dp83867: support Wake on LAN")
Cc: stable@vger.kernel.org
Signed-off-by: Willie Wiholm <willie.wiholm@tritechsolutions.se>
---
drivers/net/phy/dp83867.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index b4b4931c6f8c..e3617f01b5d9 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -233,6 +233,8 @@ static int dp83867_set_wol(struct phy_device *phydev,
WAKE_BCAST)) {
val_rxcfg |= DP83867_WOL_ENH_MAC;
val_micr |= MII_DP83867_MICR_WOL_INT_EN;
+ /* WoL is signalled on INT/PWDN_N which must be an output */
+ phy_set_bits(phydev, DP83867_CFG3, DP83867_CFG3_INT_OE);
if (wol->wolopts & WAKE_MAGIC) {
mac = (const u8 *)ndev->dev_addr;
@@ -277,6 +279,8 @@ static int dp83867_set_wol(struct phy_device *phydev,
} else {
val_rxcfg &= ~DP83867_WOL_ENH_MAC;
val_micr &= ~MII_DP83867_MICR_WOL_INT_EN;
+ if (!phy_interrupt_is_valid(phydev))
+ phy_clear_bits(phydev, DP83867_CFG3, DP83867_CFG3_INT_OE);
}
phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFCFG, val_rxcfg);
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH RFC net 2/2] net: phy: dp83867: clear latched WoL interrupt before suspend
2026-11-27 18:44 [PATCH RFC net 0/2] net: phy: dp83867: fix Wake-on-LAN without a PHY IRQ Willie Wiholm via B4 Relay
2026-11-27 18:44 ` [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN Willie Wiholm via B4 Relay
@ 2026-11-27 18:44 ` Willie Wiholm via B4 Relay
1 sibling, 0 replies; 6+ messages in thread
From: Willie Wiholm via B4 Relay @ 2026-11-27 18:44 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Thomas Haemmerle
Cc: netdev, Willie Wiholm, stable
From: Willie Wiholm <willie.wiholm@tritechsolutions.se>
WOL_INT in ISR is latched until ISR is read. When the PHY has no IRQ,
nothing reads ISR, so a magic packet received while the system is
running leaves the WoL interrupt pending and INT/PWDN_N asserted. The
next suspend then does not wake up on a magic packet, as the pin is
already active.
With WoL enabled, phy_suspend() does not call the driver's suspend
callback, so the driver has no chance to clear the interrupt. Set
PHY_ALWAYS_CALL_SUSPEND and, when WoL is enabled, only read ISR in
dp83867_suspend(). ISR is only read when the PHY has no IRQ, so that
pending interrupts are not lost when it has one. Without WoL the
behaviour is unchanged.
bcm54xx_suspend() acknowledges the WoL interrupt before suspend in the
same way.
Fixes: caabee5b53f5 ("net: phy: dp83867: support Wake on LAN")
Cc: stable@vger.kernel.org
Signed-off-by: Willie Wiholm <willie.wiholm@tritechsolutions.se>
---
drivers/net/phy/dp83867.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index e3617f01b5d9..d997e10cd5ef 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -712,6 +712,22 @@ static int dp83867_of_init(struct phy_device *phydev)
static int dp83867_suspend(struct phy_device *phydev)
{
+ int ret;
+
+ /* The PHY must stay powered up for WoL. Without a PHY IRQ nothing
+ * reads ISR, so a WoL event latched while the system was running
+ * keeps INT/PWDN_N asserted and the next magic packet does not
+ * wake the system. Clear it before suspend.
+ */
+ if (phydev->wol_enabled) {
+ if (!phy_interrupt_is_valid(phydev)) {
+ ret = phy_read(phydev, MII_DP83867_ISR);
+ if (ret < 0)
+ return ret;
+ }
+ return 0;
+ }
+
/* Disable PHY Interrupts */
if (phy_interrupt_is_valid(phydev)) {
phydev->interrupts = PHY_INTERRUPT_DISABLED;
@@ -1274,6 +1290,7 @@ static struct phy_driver dp83867_driver[] = {
.phy_id_mask = 0xfffffff0,
.name = "TI DP83867",
/* PHY_GBIT_FEATURES */
+ .flags = PHY_ALWAYS_CALL_SUSPEND,
.probe = dp83867_probe,
.config_init = dp83867_config_init,
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN
2026-11-27 18:44 ` [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN Willie Wiholm via B4 Relay
@ 2026-11-27 18:56 ` Andrew Lunn
2026-11-29 22:03 ` Wiholm Willie, Tritech Solutions AB
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2026-11-27 18:56 UTC (permalink / raw)
To: willie.wiholm
Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Thomas Haemmerle, netdev, stable
On Fri, Nov 27, 2026 at 07:44:56PM +0100, Willie Wiholm via B4 Relay wrote:
> From: Willie Wiholm <willie.wiholm@tritechsolutions.se>
>
> dp83867_set_wol() enables the WoL interrupt in MICR, so a detected
> magic packet is signalled on the INT/PWDN_N pin. That pin is only an
> interrupt output when CFG3.INT_OE is set, and dp83867_config_init()
> sets INT_OE only when the PHY has a valid IRQ. Otherwise the pin stays
> a power-down input and the WoL event never leaves the PHY.
>
> This happens on Intel Elkhart Lake boards with dwmac-intel, where the
> PHY is polled (no PHY IRQ in Linux) and INT/PWDN_N is wired to the MAC,
> which raises PME to wake the system.
Can this pin on the MAC actually generate interrupts? It would be
better to turn it into an interrupt controller, so all the usual
mechanisms just work, like PHY interrupts, not just WoL wake up.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN
2026-11-27 18:56 ` Andrew Lunn
@ 2026-11-29 22:03 ` Wiholm Willie, Tritech Solutions AB
2026-11-29 22:19 ` Andrew Lunn
0 siblings, 1 reply; 6+ messages in thread
From: Wiholm Willie, Tritech Solutions AB @ 2026-11-29 22:03 UTC (permalink / raw)
To: Andrew Lunn
Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Thomas Haemmerle,
netdev@vger.kernel.org, stable@vger.kernel.org
On Fri, Nov 27, 2026 at 07:56:51PM +0100, Andrew Lunn wrote:
> Can this pin on the MAC actually generate interrupts? It would be
> better to turn it into an interrupt controller, so all the usual
> mechanisms just work, like PHY interrupts, not just WoL wake up.
Yes, by setting the PHYIE bit in the MAC_INTERRUPT_ENABLE
register I can generate interrupts. It also requires
PHY2MAC_INTR_POL in the GCR register which was not set
by the firmware on my board.
I tested it by manually setting PHY2MAC_INTR_POL, PHYIE
and INT_OE (DP83867 CFG3). Magic packet then triggers
an interrupt in eno1:mac.
Willie
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN
2026-11-29 22:03 ` Wiholm Willie, Tritech Solutions AB
@ 2026-11-29 22:19 ` Andrew Lunn
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2026-11-29 22:19 UTC (permalink / raw)
To: Wiholm Willie, Tritech Solutions AB
Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Thomas Haemmerle,
netdev@vger.kernel.org, stable@vger.kernel.org
On Sun, Nov 29, 2026 at 10:03:37PM +0000, Wiholm Willie, Tritech Solutions AB wrote:
> On Fri, Nov 27, 2026 at 07:56:51PM +0100, Andrew Lunn wrote:
> > Can this pin on the MAC actually generate interrupts? It would be
> > better to turn it into an interrupt controller, so all the usual
> > mechanisms just work, like PHY interrupts, not just WoL wake up.
>
> Yes, by setting the PHYIE bit in the MAC_INTERRUPT_ENABLE
> register I can generate interrupts. It also requires
> PHY2MAC_INTR_POL in the GCR register which was not set
> by the firmware on my board.
>
> I tested it by manually setting PHY2MAC_INTR_POL, PHYIE
> and INT_OE (DP83867 CFG3). Magic packet then triggers
> an interrupt in eno1:mac.
Great. So you need a Linux interrupt controller, so you can then
ideally reference it in DT, in the PHY node, in the normal way.
There are a couple of DSA drivers which embed an interrupt controller
in them, which you can use as an example. They support more than one
interrupt, so are a bit more complex than what you need.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-29 22:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 18:44 [PATCH RFC net 0/2] net: phy: dp83867: fix Wake-on-LAN without a PHY IRQ Willie Wiholm via B4 Relay
2026-11-27 18:44 ` [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN Willie Wiholm via B4 Relay
2026-11-27 18:56 ` Andrew Lunn
2026-11-29 22:03 ` Wiholm Willie, Tritech Solutions AB
2026-11-29 22:19 ` Andrew Lunn
2026-11-27 18:44 ` [PATCH RFC net 2/2] net: phy: dp83867: clear latched WoL interrupt before suspend Willie Wiholm via B4 Relay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox