Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: phy: marvell: Ensure SGMII auto-negotiation is enabled for 88E1111

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>

authored by

Robert Hancock and committed by
David S. Miller
06b334f0 884b6b8a

+8 -5
+8 -5
drivers/net/phy/marvell.c
··· 684 684 if (err < 0) 685 685 goto error; 686 686 687 - /* Do not touch the fiber page if we're in copper->sgmii mode */ 688 - if (phydev->interface == PHY_INTERFACE_MODE_SGMII) 689 - return 0; 690 - 691 687 /* Then the fiber link */ 692 688 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); 693 689 if (err < 0) 694 690 goto error; 695 691 696 - err = marvell_config_aneg_fiber(phydev); 692 + if (phydev->interface == PHY_INTERFACE_MODE_SGMII) 693 + /* Do not touch the fiber advertisement if we're in copper->sgmii mode. 694 + * Just ensure that SGMII-side autonegotiation is enabled. 695 + * If we switched from some other mode to SGMII it may not be. 696 + */ 697 + err = genphy_check_and_restart_aneg(phydev, false); 698 + else 699 + err = marvell_config_aneg_fiber(phydev); 697 700 if (err < 0) 698 701 goto error; 699 702