Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] net: phy: air_en8811h: restore AN8811HB LED GPIO after MCU restart
@ 2026-08-28  3:29 Ziyou Xu
  2026-08-28 13:08 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Ziyou Xu @ 2026-08-28  3:29 UTC (permalink / raw)
  To: netdev
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, bjorn,
	ericwouds, linux-kernel, stable

Commit 03b4702fc5e3 ("net: phy: air_en8811h: move LED GPIO
configuration to config_init") moved the EN8811H LED GPIO setup from
probe to config_init because an MD32 restart clears the output-enable
bits.

AN8811HB follows the same initialization sequence: an8811hb_probe()
enables GPIO3/4/5, and later config_init() calls restart MD32.

Move the AN8811HB GPIO setup to the end of an8811hb_config_init(),
matching the current EN8811H path.

Fixes: 5afda1d734ed ("net: phy: air_en8811h: add Airoha AN8811HB support")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Ziyou Xu <xuziyougm@gmail.com>
---
Changes in v2:
- Drop the EN8811H change, merged independently as commit 03b4702fc5e3
  ("net: phy: air_en8811h: move LED GPIO configuration to config_init").
- Apply the same fix to AN8811HB per Jakub's review.
- Rebase onto netdev/main.

Not tested on AN8811HB hardware.

v1: https://lore.kernel.org/netdev/20260820141034.1400439-1-xuziyougm@gmail.com/

---
 drivers/net/phy/air_en8811h.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/phy/air_en8811h.c b/drivers/net/phy/air_en8811h.c
index 0eeb7b9a4..6ee5df63c 100644
--- a/drivers/net/phy/air_en8811h.c
+++ b/drivers/net/phy/air_en8811h.c
@@ -1125,13 +1125,6 @@ static int an8811hb_probe(struct phy_device *phydev)
 	if (ret)
 		goto err_dev_create;
 
-	/* Configure led gpio pins as output */
-	ret = air_phy_buckpbus_reg_modify(phydev, AN8811HB_GPIO_OUTPUT,
-					  AN8811HB_GPIO_OUTPUT_345,
-					  AN8811HB_GPIO_OUTPUT_345);
-	if (ret < 0)
-		goto err_dev_create;
-
 	return 0;
 
 err_dev_create:
@@ -1265,10 +1258,19 @@ static int an8811hb_config_init(struct phy_device *phydev)
 
 	ret = air_leds_init(phydev, EN8811H_LED_COUNT, AIR_PHY_LED_DUR,
 			    AIR_LED_MODE_USER_DEFINE);
-	if (ret < 0)
+	if (ret < 0) {
 		phydev_err(phydev, "Failed to initialize leds: %d\n", ret);
+		return ret;
+	}
 
-	return ret;
+	/* Restore LED GPIO output enables after MCU initialization. */
+	ret = air_phy_buckpbus_reg_modify(phydev, AN8811HB_GPIO_OUTPUT,
+					  AN8811HB_GPIO_OUTPUT_345,
+					  AN8811HB_GPIO_OUTPUT_345);
+	if (ret < 0)
+		return ret;
+
+	return 0;
 }
 
 static int en8811h_config_init(struct phy_device *phydev)

base-commit: 1b78070aaef63512688aebfbc82365ef9d6660f1
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2] net: phy: air_en8811h: restore AN8811HB LED GPIO after MCU restart
  2026-08-28  3:29 [PATCH net v2] net: phy: air_en8811h: restore AN8811HB LED GPIO after MCU restart Ziyou Xu
@ 2026-08-28 13:08 ` Andrew Lunn
  2026-08-28 13:59   ` Ziyou Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2026-08-28 13:08 UTC (permalink / raw)
  To: Ziyou Xu
  Cc: netdev, hkallweit1, linux, davem, edumazet, kuba, pabeni, bjorn,
	ericwouds, linux-kernel, stable

> @@ -1265,10 +1258,19 @@ static int an8811hb_config_init(struct phy_device *phydev)
>  
>  	ret = air_leds_init(phydev, EN8811H_LED_COUNT, AIR_PHY_LED_DUR,
>  			    AIR_LED_MODE_USER_DEFINE);
> -	if (ret < 0)
> +	if (ret < 0) {
>  		phydev_err(phydev, "Failed to initialize leds: %d\n", ret);
> +		return ret;
> +	}
>  
> -	return ret;
> +	/* Restore LED GPIO output enables after MCU initialization. */
> +	ret = air_phy_buckpbus_reg_modify(phydev, AN8811HB_GPIO_OUTPUT,
> +					  AN8811HB_GPIO_OUTPUT_345,
> +					  AN8811HB_GPIO_OUTPUT_345);
> +	if (ret < 0)
> +		return ret;
> +
> +	return 0;

That can be squashed down to:

	return ret;

    Andrew

---
pw-bot: cr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2] net: phy: air_en8811h: restore AN8811HB LED GPIO after MCU restart
  2026-08-28 13:08 ` Andrew Lunn
@ 2026-08-28 13:59   ` Ziyou Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Ziyou Xu @ 2026-08-28 13:59 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, hkallweit1, linux, davem, edumazet, kuba, pabeni, bjorn,
	ericwouds, linux-kernel, stable

Right, I'll fold that into v3.

Andrew Lunn <andrew@lunn.ch> 于2026年8月28日周五 21:09写道:
>
> > @@ -1265,10 +1258,19 @@ static int an8811hb_config_init(struct phy_device *phydev)
> >
> >       ret = air_leds_init(phydev, EN8811H_LED_COUNT, AIR_PHY_LED_DUR,
> >                           AIR_LED_MODE_USER_DEFINE);
> > -     if (ret < 0)
> > +     if (ret < 0) {
> >               phydev_err(phydev, "Failed to initialize leds: %d\n", ret);
> > +             return ret;
> > +     }
> >
> > -     return ret;
> > +     /* Restore LED GPIO output enables after MCU initialization. */
> > +     ret = air_phy_buckpbus_reg_modify(phydev, AN8811HB_GPIO_OUTPUT,
> > +                                       AN8811HB_GPIO_OUTPUT_345,
> > +                                       AN8811HB_GPIO_OUTPUT_345);
> > +     if (ret < 0)
> > +             return ret;
> > +
> > +     return 0;
>
> That can be squashed down to:
>
>         return ret;
>
>     Andrew
>
> ---
> pw-bot: cr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-28 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28  3:29 [PATCH net v2] net: phy: air_en8811h: restore AN8811HB LED GPIO after MCU restart Ziyou Xu
2026-08-28 13:08 ` Andrew Lunn
2026-08-28 13:59   ` Ziyou Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox