Skip to contentSkip to conversation

net: phy: air_en8811h: add dedicated suspend callback for AN8811HB

PATCH In review Weiting Lee 2 participants 3 messages Sep 17 – Oct 27

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: air_en8811h: add dedicated suspend callback for AN8811HB

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.

---
 drivers/net/phy/air_en8811h.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/net/phy/air_en8811h.c +14 -1
index a03d63dd4ac9..5b1edb127c68 100644
@@ -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,
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 3 lines · Weiting Lee

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.

drivers/net/phy/air_en8811h.c static void an8811hb_remove(struct phy_device *phydev) · line 1582

Quoted 7 lines
drivers/net/phy/air_en8811h.c +7 -0
+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

#2 lore raw

Hi Andrew,

Thanks for the review. I need to check this internally, which will take some time. I will continue with the other patches in the meantime.

Thanks,
Weiting

Quoted 17 lines · Andrew Lunn
Quoted 3 lines

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.

drivers/net/phy/air_en8811h.c static void an8811hb_remove(struct phy_device *phydev) · line 1582

Quoted 7 lines
drivers/net/phy/air_en8811h.c +7 -0
+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