net: phy: air_en8811h: fix LED GPIO not surviving MCU restart
Subsystems (3)
cover net: phy: air_en8811h: fix LED GPIO not surviving MCU restart
The EN8811H PHY's LED GPIO pins are only ever configured as outputs once, in .probe(). Every .config_init() call after the first restarts the PHY's MD32 MCU, which resets that GPIO configuration back to inputs, so the LEDs silently stop reflecting link/activity state after the first link renegotiation, ifdown/ifup, or resume. Patch 1 fixes that. Patch 2 is a small follow-on cleanup enabled by patch 1's removal of code from .probe(), kept as a separate patch so patch 1 stays a minimal, clean Fixes: change.
Verified on hardware (Nokia XG-040G-MD, Airoha AN7581) via OpenWrt:
before the fix, the LED stayed dark after the board's first link renegotiation post-boot; after the fix, it lit correctly through repeated link up/down cycles.
Vitaliy Sochnev (2):
net: phy: air_en8811h: move LED GPIO configuration to config_init
net: phy: air_en8811h: simplify en8811h_probe() trailing return
drivers/net/phy/air_en8811h.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
Signature · 1 line
2.55.0
PATCH 1/2 net: phy: air_en8811h: move LED GPIO configuration to config_init
The LED GPIO pins (GPIO3/4/5, mapped to LED2/LED1/LED0) are only ever configured as outputs once, in .probe(). But .config_init() restarts the MD32 MCU via en8811h_restart_mcu() on every call after the first (priv->mcu_needs_restart), and that restart resets buckpbus-mapped MCU state, including EN8811H_GPIO_OUTPUT. As a result the LED GPIOs fall back to inputs after the first event that re-triggers .config_init() (link renegotiation, ifdown/ifup, resume), and the PHY's LEDs stop reflecting link/activity state even though they worked right after probe.
Move the GPIO-as-output configuration from .probe() to the end of .config_init(), so it is reapplied every time the MCU may have been restarted.
--- drivers/net/phy/air_en8811h.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/phy/air_en8811h.c +11 -7
@@ -1173,13 +1173,6 @@ static int en8811h_probe(struct phy_device *phydev)if (ret)return ret; -/* Configure led gpio pins as output */ - ret =air_phy_buckpbus_reg_modify (phydev,EN8811H_GPIO_OUTPUT , -EN8811H_GPIO_OUTPUT_345 , -EN8811H_GPIO_OUTPUT_345 ); -if (ret <0 ) -return ret; -return 0 ; }
@@ -1324,6 +1317,17 @@ static int en8811h_config_init(struct phy_device *phydev)return ret; } +/* Configure led gpio pins as output. Must be redone on every +* .config_init(), not just once in .probe(): en8811h_restart_mcu() +* resets buckpbus-mapped MCU state (incl. this register) on every +* call after the first, e.g. on link renegotiation or ifup/ifdown. +*/ + ret =air_phy_buckpbus_reg_modify (phydev,EN8811H_GPIO_OUTPUT , +EN8811H_GPIO_OUTPUT_345 , +EN8811H_GPIO_OUTPUT_345 ); +if (ret <0 ) +return ret; +return 0 ; }
Signature · 1 line
2.55.0
PATCH 2/2 net: phy: air_en8811h: simplify en8811h_probe() trailing return
In reply to Vitaliy Sochneven8811h_clk_provider_setup() is now the last statement in the function, so the intermediate "if (ret) return ret; return 0;" is redundant.
--- drivers/net/phy/air_en8811h.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/phy/air_en8811h.c +1 -5
@@ -1169,11 +1169,7 @@ static int en8811h_probe(struct phy_device *phydev) priv->phydev = phydev;/* Co-Clock Output */ - ret =en8811h_clk_provider_setup (&phydev->mdio.dev, &priv->hw); -if (ret) -return ret; - -return 0 ; +return en8811h_clk_provider_setup (&phydev->mdio.dev, &priv->hw); }static int an8811hb_config_serdes_polarity (struct phy_device *phydev)
Signature · 1 line
2.55.0
Paolo Abeni
maintainerQuoted 8 lines · Vitaliy Sochnev
The EN8811H PHY's LED GPIO pins are only ever configured as outputs once, in .probe(). Every .config_init() call after the first restarts the PHY's MD32 MCU, which resets that GPIO configuration back to inputs, so the LEDs silently stop reflecting link/activity state after the first link renegotiation, ifdown/ifup, or resume. Patch 1 fixes that. Patch 2 is a small follow-on cleanup enabled by patch 1's removal of code from .probe(), kept as a separate patch so patch 1 stays a minimal, clean Fixes: change.
Patch 2/2 is net-next material, please re-submit after the merge window.
/P
This series was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 10 lines · On Sun, 23 Aug 2026 14:06:35 +0100 you wrote:
The EN8811H PHY's LED GPIO pins are only ever configured as outputs once, in .probe(). Every .config_init() call after the first restarts the PHY's MD32 MCU, which resets that GPIO configuration back to inputs, so the LEDs silently stop reflecting link/activity state after the first link renegotiation, ifdown/ifup, or resume. Patch 1 fixes that. Patch 2 is a small follow-on cleanup enabled by patch 1's removal of code from .probe(), kept as a separate patch so patch 1 stays a minimal, clean Fixes: change.
[...]
Here is the summary with links:
- [1/2] net: phy: air_en8811h: move LED GPIO configuration to config_init
https://git.kernel.org/netdev/net/c/03b4702fc5e3
- [2/2] net: phy: air_en8811h: simplify en8811h_probe() trailing return (no matching commit)
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html