Skip to contentSkip to conversation

net: phy: Fix marvell_set_downshift() from clobbering MSCR register

PATCH New Darell Tan 1 participant 1 message Mar 15, 2020

Subsystems (3)
lore
Share & tools
lore

Darell Tan

author
#0 lore raw

PATCH v2 1/1 net: phy: Fix marvell_set_downshift() from clobbering MSCR register

Fix marvell_set_downshift() from clobbering MSCR register.

A typo in marvell_set_downshift() clobbers the MSCR register. This register also shares settings with the auto MDI-X detection, set by marvell_set_polarity(). In the 1116R init, downshift is set after polarity, causing the polarity settings to be clobbered.

This bug is present on the 5.4 series and was introduced in commit 6ef05eb73c8f ("net: phy: marvell: Refactor setting downshift into a helper"). This patch need not be forward-ported to 5.5 because the affected functions were rewritten.

Fixes 6ef05eb73c8f ("net: phy: marvell: Refactor setting downshift into a helper")

---
changes v2:
- added tags to sign-off area
- resubmitted to stable list from netdev, as instructed by David Miller

 drivers/net/phy/marvell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/marvell.c +1 -1
index a7796134e..6ab8fe339 100644
@@ -282,7 +282,7 @@ static int marvell_set_downshift(struct phy_device *phydev, bool enable,
 	if (reg < 0)
 		return reg;
 
-	reg &= MII_M1011_PHY_SRC_DOWNSHIFT_MASK;
+	reg &= ~MII_M1011_PHY_SRC_DOWNSHIFT_MASK;
 	reg |= ((retries - 1) << MII_M1011_PHY_SCR_DOWNSHIFT_SHIFT);
 	if (enable)
 		reg |= MII_M1011_PHY_SCR_DOWNSHIFT_EN;
Signature · 1 line
2.17.1