Skip to content

Commit 990875b

Browse files
fidomaxdavem330
authored andcommitted
net: phy: marvell: fix m88e1011_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: 911af5e ("net: phy: marvell: fix downshift function naming") 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 eefb45e commit 990875b

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
@@ -1025,22 +1025,28 @@ static int m88e1011_get_downshift(struct phy_device *phydev, u8 *data)
10251025

10261026
static int m88e1011_set_downshift(struct phy_device *phydev, u8 cnt)
10271027
{
1028-
int val;
1028+
int val, err;
10291029

10301030
if (cnt > MII_M1011_PHY_SCR_DOWNSHIFT_MAX)
10311031
return -E2BIG;
10321032

1033-
if (!cnt)
1034-
return phy_clear_bits(phydev, MII_M1011_PHY_SCR,
1035-
MII_M1011_PHY_SCR_DOWNSHIFT_EN);
1033+
if (!cnt) {
1034+
err = phy_clear_bits(phydev, MII_M1011_PHY_SCR,
1035+
MII_M1011_PHY_SCR_DOWNSHIFT_EN);
1036+
} else {
1037+
val = MII_M1011_PHY_SCR_DOWNSHIFT_EN;
1038+
val |= FIELD_PREP(MII_M1011_PHY_SCR_DOWNSHIFT_MASK, cnt - 1);
10361039

1037-
val = MII_M1011_PHY_SCR_DOWNSHIFT_EN;
1038-
val |= FIELD_PREP(MII_M1011_PHY_SCR_DOWNSHIFT_MASK, cnt - 1);
1040+
err = phy_modify(phydev, MII_M1011_PHY_SCR,
1041+
MII_M1011_PHY_SCR_DOWNSHIFT_EN |
1042+
MII_M1011_PHY_SCR_DOWNSHIFT_MASK,
1043+
val);
1044+
}
10391045

1040-
return phy_modify(phydev, MII_M1011_PHY_SCR,
1041-
MII_M1011_PHY_SCR_DOWNSHIFT_EN |
1042-
MII_M1011_PHY_SCR_DOWNSHIFT_MASK,
1043-
val);
1046+
if (err < 0)
1047+
return err;
1048+
1049+
return genphy_soft_reset(phydev);
10441050
}
10451051

10461052
static int m88e1011_get_tunable(struct phy_device *phydev,

0 commit comments

Comments
 (0)