[PATCH net-next] net: phy: marvell: undo WoL setup when Wake-on-LAN is disabled

From: Rosen Penev

Date: Sun Sep 13 2026 - 16:58:03 EST


Fully disabling Wake-on-LAN on the 88E1318S/88E1510 used to leave
the WoL interrupt enable bit (CSIER.WOL_EIE) set and LED[2]
configured as the INTn pin. A magic packet arriving after "wol d"
would still assert INTn, and a later "wol g" re-enabled WoL from a
dirty register state.

Undo the WoL interrupt setup once all WoL options are cleared:
clear CSIER.WOL_EIE and restore LED[2] to its prior use - the INTn
output on interrupt-driven PHYs, the plain LED function otherwise.
Never set the FORCE_INT bit while disposing of the pin: it holds
the interrupt line asserted and turns the shared PHY interrupt into
a "nobody cared" IRQ storm when the PHY interrupt is in use.

Assisted-by: LLM
Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
drivers/net/phy/marvell.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index f71cffa88406..6f7c190880f2 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -2074,6 +2074,35 @@ static int m88e1318_set_wol(struct phy_device *phydev,
goto error;
}

+ if (!(wol->wolopts & (WAKE_MAGIC | WAKE_PHY))) {
+ /* Fully disabled: undo the WoL interrupt setup done above,
+ * so a later re-enable starts from a clean state.
+ */
+ err = marvell_write_page(phydev, MII_MARVELL_COPPER_PAGE);
+ if (err < 0)
+ goto error;
+
+ err = __phy_clear_bits(phydev, MII_88E1318S_PHY_CSIER,
+ MII_88E1318S_PHY_CSIER_WOL_EIE);
+ if (err < 0)
+ goto error;
+
+ err = marvell_write_page(phydev, MII_MARVELL_LED_PAGE);
+ if (err < 0)
+ goto error;
+
+ err = __phy_modify(phydev, MII_88E1318S_PHY_LED_TCR,
+ MII_88E1318S_PHY_LED_TCR_FORCE_INT |
+ MII_88E1318S_PHY_LED_TCR_INTn_ENABLE |
+ MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW,
+ phy_interrupt_is_valid(phydev) ?
+ MII_88E1318S_PHY_LED_TCR_INTn_ENABLE |
+ MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW :
+ 0);
+ if (err < 0)
+ goto error;
+ }
+
error:
return phy_restore_page(phydev, oldpage, err);
}
--
2.55.0