diff mbox series

[net-next,v2] net: phy: marvell: Ensure SGMII auto-negotiation is enabled for 88E1111

Message ID 20210216205330.2803064-1-robert.hancock@calian.com (mailing list archive)
State Accepted
Commit 06b334f08b4f0e53be64160392be4c37db28a413
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] net: phy: marvell: Ensure SGMII auto-negotiation is enabled for 88E1111 | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: line length of 87 exceeds 80 columns
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Robert Hancock Feb. 16, 2021, 8:53 p.m. UTC
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>
---

Changed since v1: Fixed typo and added more explanation in commit message

 drivers/net/phy/marvell.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 16, 2021, 10:20 p.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Tue, 16 Feb 2021 14:53:30 -0600 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: phy: marvell: Ensure SGMII auto-negotiation is enabled for 88E1111
    https://git.kernel.org/netdev/net-next/c/06b334f08b4f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 3238d0fbf437..e26a5d663f8a 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -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;