diff mbox series

[net-next,4/4] net: phy: marvell10g: check for newly set aneg in mv3310_config_aneg

Message ID 249c09b1-e4b2-6d72-b0cc-018fef336a4b@gmail.com
State Superseded
Delegated to: David Miller
Headers show
Series net: phy: add and use genphy_c45_an_config_an | expand

Commit Message

Heiner Kallweit Feb. 16, 2019, 7:53 p.m. UTC
Even if the advertisement registers content didn't change, we may have
just switched to aneg, and therefore have to trigger an aneg restart.
This matches the behavior of genphy_config_aneg().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/marvell10g.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Florian Fainelli Feb. 17, 2019, 2:49 a.m. UTC | #1
On 2/16/2019 11:53 AM, Heiner Kallweit wrote:
> Even if the advertisement registers content didn't change, we may have
> just switched to aneg, and therefore have to trigger an aneg restart.
> This matches the behavior of genphy_config_aneg().
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 03fa50087..4d8a290eb 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -288,6 +288,16 @@  static int mv3310_config_aneg(struct phy_device *phydev)
 	if (ret > 0)
 		changed = true;
 
+	if (!changed) {
+		/* Configure and restart aneg if it wasn't set before */
+		ret = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_CTRL1);
+		if (ret < 0)
+			return ret;
+
+		if (!(ret & MDIO_AN_CTRL1_ENABLE))
+			changed = 1;
+	}
+
 	if (changed)
 		ret = genphy_c45_restart_aneg(phydev);