Skip to content

Commit

Permalink
net: phy: marvell: Ensure SGMII auto-negotiation is enabled for 88E1111
Browse files Browse the repository at this point in the history
When 88E1111 is operating in SGMII mode, auto-negotiation should be enabled
on the SGMII side so that the link will come up properly with PCSes which
normally have auto-negotiation enabled. This is normally the case when the
PHY defaults to SGMII mode at power-up, however if we switched it from some
other mode like 1000Base-X, as may happen in some SFP module situations,
it may not be, particularly for modules which have 1000Base-X
auto-negotiation defaulting to disabled.

Call genphy_check_and_restart_aneg on the fiber page to ensure that auto-
negotiation is properly enabled on the SGMII interface.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Robert Hancock authored and David S. Miller committed Feb 16, 2021
1 parent 884b6b8 commit 06b334f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/net/phy/marvell.c
Original file line number Diff line number Diff line change
@@ -684,16 +684,19 @@ static int m88e1111_config_aneg(struct phy_device *phydev)
if (err < 0)
goto error;

/* Do not touch the fiber page if we're in copper->sgmii mode */
if (phydev->interface == PHY_INTERFACE_MODE_SGMII)
return 0;

/* Then the fiber link */
err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE);
if (err < 0)
goto error;

err = marvell_config_aneg_fiber(phydev);
if (phydev->interface == PHY_INTERFACE_MODE_SGMII)
/* Do not touch the fiber advertisement if we're in copper->sgmii mode.
* Just ensure that SGMII-side autonegotiation is enabled.
* If we switched from some other mode to SGMII it may not be.
*/
err = genphy_check_and_restart_aneg(phydev, false);
else
err = marvell_config_aneg_fiber(phydev);
if (err < 0)
goto error;

0 comments on commit 06b334f

Please sign in to comment.