提交 5bb844db 编写于 作者: M Maxim Kochetkov 提交者: Zheng Zengkai

net: phy: marvell: fix m88e1011_set_downshift

stable inclusion
from stable-5.10.37
commit 1157d01e04d90dde889b6bd5342df33b5db39949
bugzilla: 51868
CVE: NA

--------------------------------

[ Upstream commit 990875b2 ]

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: 911af5e1 ("net: phy: marvell: fix downshift function naming")
Signed-off-by: NMaxim Kochetkov <fido_max@inbox.ru>
Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 bc27d337
...@@ -919,22 +919,28 @@ static int m88e1011_get_downshift(struct phy_device *phydev, u8 *data) ...@@ -919,22 +919,28 @@ static int m88e1011_get_downshift(struct phy_device *phydev, u8 *data)
static int m88e1011_set_downshift(struct phy_device *phydev, u8 cnt) static int m88e1011_set_downshift(struct phy_device *phydev, u8 cnt)
{ {
int val; int val, err;
if (cnt > MII_M1011_PHY_SCR_DOWNSHIFT_MAX) if (cnt > MII_M1011_PHY_SCR_DOWNSHIFT_MAX)
return -E2BIG; return -E2BIG;
if (!cnt) if (!cnt) {
return phy_clear_bits(phydev, MII_M1011_PHY_SCR, err = phy_clear_bits(phydev, MII_M1011_PHY_SCR,
MII_M1011_PHY_SCR_DOWNSHIFT_EN); MII_M1011_PHY_SCR_DOWNSHIFT_EN);
} else {
val = MII_M1011_PHY_SCR_DOWNSHIFT_EN;
val |= FIELD_PREP(MII_M1011_PHY_SCR_DOWNSHIFT_MASK, cnt - 1);
val = MII_M1011_PHY_SCR_DOWNSHIFT_EN; err = phy_modify(phydev, MII_M1011_PHY_SCR,
val |= FIELD_PREP(MII_M1011_PHY_SCR_DOWNSHIFT_MASK, cnt - 1); MII_M1011_PHY_SCR_DOWNSHIFT_EN |
MII_M1011_PHY_SCR_DOWNSHIFT_MASK,
val);
}
return phy_modify(phydev, MII_M1011_PHY_SCR, if (err < 0)
MII_M1011_PHY_SCR_DOWNSHIFT_EN | return err;
MII_M1011_PHY_SCR_DOWNSHIFT_MASK,
val); return genphy_soft_reset(phydev);
} }
static int m88e1011_get_tunable(struct phy_device *phydev, static int m88e1011_get_tunable(struct phy_device *phydev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册