[PATCH] net: phy: air_en8811h: add dedicated suspend callback for AN8811HB

Weiting Lee posted 1 patch 1 week, 1 day ago
drivers/net/phy/air_en8811h.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
[PATCH] net: phy: air_en8811h: add dedicated suspend callback for AN8811HB
Posted by Weiting Lee 1 week, 1 day ago
The AN8811HB hardware requires a re-negotiation sequence before
entering power-down to correctly restore the link upon resume.
Add an8811hb_suspend() to handle this.

Signed-off-by: Weiting Lee <weiting.lee@airoha.com>
---
 drivers/net/phy/air_en8811h.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/air_en8811h.c b/drivers/net/phy/air_en8811h.c
index a03d63dd4ac9..5b1edb127c68 100644
--- a/drivers/net/phy/air_en8811h.c
+++ b/drivers/net/phy/air_en8811h.c
@@ -1573,6 +1573,19 @@ static void an8811hb_remove(struct phy_device *phydev)
 	}
 }
 
+static int an8811hb_suspend(struct phy_device *phydev)
+{
+	int ret;
+
+	clk_save_context();
+
+	ret = phy_modify(phydev, MII_BMCR, 0, BMCR_ANRESTART);
+	if (ret < 0)
+		return ret;
+
+	return genphy_suspend(phydev);
+}
+
 static struct phy_driver en8811h_driver[] = {
 {
 	PHY_ID_MATCH_MODEL(EN8811H_PHY_ID),
@@ -1606,7 +1619,7 @@ static struct phy_driver en8811h_driver[] = {
 	.config_aneg		= en8811h_config_aneg,
 	.read_status		= en8811h_read_status,
 	.resume			= en8811h_resume,
-	.suspend		= en8811h_suspend,
+	.suspend		= an8811hb_suspend,
 	.config_intr		= en8811h_clear_intr,
 	.handle_interrupt	= en8811h_handle_interrupt,
 	.led_hw_is_supported	= en8811h_led_hw_is_supported,
-- 
2.43.0
Re: [PATCH] net: phy: air_en8811h: add dedicated suspend callback for AN8811HB
Posted by Andrew Lunn 1 week, 1 day ago
On Thu, Sep 17, 2026 at 09:21:02AM +0800, Weiting Lee wrote:
> The AN8811HB hardware requires a re-negotiation sequence before
> entering power-down to correctly restore the link upon resume.
> Add an8811hb_suspend() to handle this.

Is there an errata for this? Please mention it in the commit message.

> +static int an8811hb_suspend(struct phy_device *phydev)
> +{
> +	int ret;
> +
> +	clk_save_context();
> +
> +	ret = phy_modify(phydev, MII_BMCR, 0, BMCR_ANRESTART);

Why use phy_modify() if you are going to pass a mask of 0?

	Andrew