Skip to contentSkip to conversation

net: phy: don't clear BMCR in genphy_soft_reset

PATCH In review Heiner Kallweit 3 participants 3 messages Mar 22, 2019 – Mar 26, 2019

Subsystems (3)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH 1/1 net: phy: don't clear BMCR in genphy_soft_reset

So far we effectively clear the BMCR register. Some PHY's can deal with this (e.g. because they reset BMCR to a default as part of a soft-reset) whilst on others this causes issues because e.g. the autoneg bit is cleared. Marvell is an example, see also thread [0]. So let's be a little bit more gentle and leave all bits we're not interested in as-is. This change is needed for PHY drivers to properly deal with the original patch.

[0] https://marc.info/?t=155264050700001&r=1&w=2

Fixes 6e2d85ec0559 ("net: phy: Stop with excessive soft reset")
---
 drivers/net/phy/phy_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy_device.c +1 -1
index 49fdd1ee7..77068c545 100644
@@ -1831,7 +1831,7 @@ int genphy_soft_reset(struct phy_device *phydev)
 {
 	int ret;
 
-	ret = phy_write(phydev, MII_BMCR, BMCR_RESET);
+	ret = phy_set_bits(phydev, MII_BMCR, BMCR_RESET);
 	if (ret < 0)
 		return ret;
 
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Heiner Kallweit

So far we effectively clear the BMCR register. Some PHY's can deal with this (e.g. because they reset BMCR to a default as part of a soft-reset) whilst on others this causes issues because e.g. the autoneg bit is cleared. Marvell is an example, see also thread [0]. So let's be a little bit more gentle and leave all bits we're not interested in as-is. This change is needed for PHY drivers to properly deal with the original patch.

Quoted 6 lines

[0] https://marc.info/?t=155264050700001&r=1&w=2

Fixes 6e2d85ec0559 ("net: phy: Stop with excessive soft reset")

Thanks for investigating and coming up with a fix for this!

Quoted 18 lines
---
 drivers/net/phy/phy_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy_device.c +1 -1
index 49fdd1ee7..77068c545 100644
@@ -1831,7 +1831,7 @@ int genphy_soft_reset(struct phy_device *phydev)
 {
 	int ret;
 
-	ret = phy_write(phydev, MII_BMCR, BMCR_RESET);
+	ret = phy_set_bits(phydev, MII_BMCR, BMCR_RESET);
 	if (ret < 0)
 		return ret;
 
Signature · 1 line
Florian
maintainer
#2 lore raw
In reply to Heiner Kallweit

From: Heiner Kallweit <[email protected]>
Date: Fri, 22 Mar 2019 20:00:20 +0100

Quoted 8 lines

So far we effectively clear the BMCR register. Some PHY's can deal with this (e.g. because they reset BMCR to a default as part of a soft-reset) whilst on others this causes issues because e.g. the autoneg bit is cleared. Marvell is an example, see also thread [0]. So let's be a little bit more gentle and leave all bits we're not interested in as-is. This change is needed for PHY drivers to properly deal with the original patch.

Quoted 6 lines

[0] https://marc.info/?t=155264050700001&r=1&w=2

Fixes 6e2d85ec0559 ("net: phy: Stop with excessive soft reset")

Applied and queued up for -stable, thanks.