mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
net: phy: marvell: fix m88e1111_set_downshift
[ Upstream commite7679c55a7] 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:5c6bc5199b("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
1157d01e04
commit
bfcb5a8cc7
|
|
@ -861,22 +861,28 @@ static int m88e1111_get_downshift(struct phy_device *phydev, u8 *data)
|
||||||
|
|
||||||
static int m88e1111_set_downshift(struct phy_device *phydev, u8 cnt)
|
static int m88e1111_set_downshift(struct phy_device *phydev, u8 cnt)
|
||||||
{
|
{
|
||||||
int val;
|
int val, err;
|
||||||
|
|
||||||
if (cnt > MII_M1111_PHY_EXT_CR_DOWNSHIFT_MAX)
|
if (cnt > MII_M1111_PHY_EXT_CR_DOWNSHIFT_MAX)
|
||||||
return -E2BIG;
|
return -E2BIG;
|
||||||
|
|
||||||
if (!cnt)
|
if (!cnt) {
|
||||||
return phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR,
|
err = phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR,
|
||||||
MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN);
|
MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN);
|
||||||
|
} else {
|
||||||
|
val = MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN;
|
||||||
|
val |= FIELD_PREP(MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, cnt - 1);
|
||||||
|
|
||||||
val = MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN;
|
err = phy_modify(phydev, MII_M1111_PHY_EXT_CR,
|
||||||
val |= FIELD_PREP(MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, cnt - 1);
|
MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN |
|
||||||
|
MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK,
|
||||||
|
val);
|
||||||
|
}
|
||||||
|
|
||||||
return phy_modify(phydev, MII_M1111_PHY_EXT_CR,
|
if (err < 0)
|
||||||
MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN |
|
return err;
|
||||||
MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK,
|
|
||||||
val);
|
return genphy_soft_reset(phydev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int m88e1111_get_tunable(struct phy_device *phydev,
|
static int m88e1111_get_tunable(struct phy_device *phydev,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user