Netdev List
 help / color / mirror / Atom feed
From: Willie Wiholm via B4 Relay <devnull+willie.wiholm.tritechsolutions.se@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	 Russell King <linux@armlinux.org.uk>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	 Thomas Haemmerle <thomas.haemmerle@wolfvision.net>
Cc: netdev@vger.kernel.org,
	 Willie Wiholm <willie.wiholm@tritechsolutions.se>,
	stable@vger.kernel.org
Subject: [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN
Date: Fri, 27 Nov 2026 19:44:56 +0100	[thread overview]
Message-ID: <20261127-wol-net-v1-1-769a2aff91df@tritechsolutions.se> (raw)
In-Reply-To: <20261127-wol-net-v1-0-769a2aff91df@tritechsolutions.se>

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



  reply	other threads:[~2026-11-27 18:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-11-27 18:56   ` [PATCH RFC net 1/2] net: phy: dp83867: set INT_OE when enabling Wake-on-LAN 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

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=20261127-wol-net-v1-1-769a2aff91df@tritechsolutions.se \
    --to=devnull+willie.wiholm.tritechsolutions.se@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=thomas.haemmerle@wolfvision.net \
    --cc=willie.wiholm@tritechsolutions.se \
    /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