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 2/2] net: phy: dp83867: clear latched WoL interrupt before suspend
Date: Fri, 27 Nov 2026 19:44:57 +0100	[thread overview]
Message-ID: <20261127-wol-net-v1-2-769a2aff91df@tritechsolutions.se> (raw)
In-Reply-To: <20261127-wol-net-v1-0-769a2aff91df@tritechsolutions.se>

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



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

Thread overview: 6+ 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 ` [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 ` Willie Wiholm via B4 Relay [this message]

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-2-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