Skip to content

Commit 0ed99ec

Browse files
robhancockseddavem330
authored andcommitted
net: phy: marvell: update abilities and advertising when switching to SGMII
With some SFP modules, such as Finisar FCLF8522P2BTL, the PHY hardware strapping defaults to 1000BaseX mode, but the kernel prefers to set them for SGMII mode. When this happens and the PHY is soft reset, the BMSR status register is updated, but this happens after the kernel has already read the PHY abilities during probing. This results in support not being detected for, and the PHY not advertising support for, 10 and 100 Mbps modes, preventing the link from working with a non-gigabit link partner. When the PHY is being configured for SGMII mode, call genphy_read_abilities again in order to re-read the capabilities, and update the advertising field accordingly. Signed-off-by: Robert Hancock <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 48cec73 commit 0ed99ec

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

drivers/net/phy/marvell.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,21 @@ static int m88e1111_config_init(struct phy_device *phydev)
961961
if (err < 0)
962962
return err;
963963

964-
return genphy_soft_reset(phydev);
964+
err = genphy_soft_reset(phydev);
965+
if (err < 0)
966+
return err;
967+
968+
if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
969+
/* If the HWCFG_MODE was changed from another mode (such as
970+
* 1000BaseX) to SGMII, the state of the support bits may have
971+
* also changed now that the PHY has been reset.
972+
* Update the PHY abilities accordingly.
973+
*/
974+
err = genphy_read_abilities(phydev);
975+
linkmode_or(phydev->advertising, phydev->advertising,
976+
phydev->supported);
977+
}
978+
return err;
965979
}
966980

967981
static int m88e1111_get_downshift(struct phy_device *phydev, u8 *data)

0 commit comments

Comments
 (0)