Skip to content

Commit e7679c5

Browse files
fidomaxdavem330
authored andcommitted
net: phy: marvell: fix m88e1111_set_downshift
Changing downshift params without software reset has no effect, so call genphy_soft_reset() after change downshift params. As the datasheet says: Changes to these bits are disruptive to the normal operation therefore, any changes to these registers must be followed by software reset to take effect. Fixes: 5c6bc51 ("net: phy: marvell: add downshift support for M88E1111") Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 990875b commit e7679c5

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

drivers/net/phy/marvell.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -967,22 +967,28 @@ static int m88e1111_get_downshift(struct phy_device *phydev, u8 *data)
967967

968968
static int m88e1111_set_downshift(struct phy_device *phydev, u8 cnt)
969969
{
970-
int val;
970+
int val, err;
971971

972972
if (cnt > MII_M1111_PHY_EXT_CR_DOWNSHIFT_MAX)
973973
return -E2BIG;
974974

975-
if (!cnt)
976-
return phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR,
977-
MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN);
975+
if (!cnt) {
976+
err = phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR,
977+
MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN);
978+
} else {
979+
val = MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN;
980+
val |= FIELD_PREP(MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, cnt - 1);
978981

979-
val = MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN;
980-
val |= FIELD_PREP(MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, cnt - 1);
982+
err = phy_modify(phydev, MII_M1111_PHY_EXT_CR,
983+
MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN |
984+
MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK,
985+
val);
986+
}
981987

982-
return phy_modify(phydev, MII_M1111_PHY_EXT_CR,
983-
MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN |
984-
MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK,
985-
val);
988+
if (err < 0)
989+
return err;
990+
991+
return genphy_soft_reset(phydev);
986992
}
987993

988994
static int m88e1111_get_tunable(struct phy_device *phydev,

0 commit comments

Comments
 (0)