🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
4 messages
4 total messages Started by Willie Wiholm via B4 Relay Fri, 27 Nov 2026 18:44
[PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN
#23708
Author: Willie Wiholm via B4 Relay
Date: Fri, 27 Nov 2026 18:44
55 lines
12634 bytes
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
Re: [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN
#23712
Author: Andrew Lunn
Date: Fri, 27 Nov 2026 18:56
19 lines
9167 bytes
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
Re: [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN
#24241
Author: Andrew Lunn
Date: Sun, 29 Nov 2026 22:19
24 lines
9623 bytes
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
Re: [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN
#25549
Author: Andrew Lunn
Date: Wed, 02 Dec 2026 01:29
9 lines
9018 bytes
> One last question: the PSE GbE INT input is active-high and the PHY
> is active-low, so the PHY2MAC_INTR_POL bit in GCR must be set. On my
> board the firmware does not set it. Should that be handled by the
> firmware, or can it be set in dwmac-intel for EHL?

I try to avoid any dependencies on firmware.

  Andrew
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads