Skip to contentSkip to conversation

net: bcmgenet: Software reset EPHY after power on

PATCH In review Florian Fainelli 2 participants 3 messages Oct 30, 2015 – Nov 5, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: bcmgenet: Software reset EPHY after power on

The EPHY on GENET v1->v3 is extremely finicky, and will show occasional failures based on the timing and reset sequence, ranging from duplicate packets, to extremely high latencies.

Perform an additional software reset, and re-configuration to make sure it is in a consistent and working state.

Fixes 6ac3ce8295e6 ("net: bcmgenet: Remove excessive PHY reset")

---
Hi David,

I am sending this right after your latest pull request to Linus, so I would appreciate if you could queue that up for 4.4-stable when it exists, or if there are more pull requests going into 4.3-rc8?!?

Thanks!

 drivers/net/ethernet/broadcom/genet/bcmgenet.c |  4 +++-
 drivers/net/ethernet/broadcom/genet/bcmgenet.h |  1 +
 drivers/net/ethernet/broadcom/genet/bcmmii.c   | 18 ++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +3 -1
index 1805541b4240..5e3cd76cb69b 100644
@@ -907,8 +907,10 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
 	}
 
 	bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
-	if (mode == GENET_POWER_PASSIVE)
+	if (mode == GENET_POWER_PASSIVE) {
 		bcmgenet_phy_power_set(priv->dev, true);
+		bcmgenet_mii_reset(priv->dev);
+	}
 }
 
 /* ioctl handle special commands that are not present in ethtool. */
drivers/net/ethernet/broadcom/genet/bcmgenet.h +1 -0
index 7299d1075422..c739f7ebc992 100644
@@ -674,6 +674,7 @@ int bcmgenet_mii_init(struct net_device *dev);
 int bcmgenet_mii_config(struct net_device *dev);
 int bcmgenet_mii_probe(struct net_device *dev);
 void bcmgenet_mii_exit(struct net_device *dev);
+void bcmgenet_mii_reset(struct net_device *dev);
 void bcmgenet_phy_power_set(struct net_device *dev, bool enable);
 void bcmgenet_mii_setup(struct net_device *dev);
 
drivers/net/ethernet/broadcom/genet/bcmmii.c +18 -0
index c8affad76f36..8bdfe53754ba 100644
@@ -163,6 +163,7 @@ void bcmgenet_mii_setup(struct net_device *dev)
 	phy_print_status(phydev);
 }
 
+
 static int bcmgenet_fixed_phy_link_update(struct net_device *dev,
 					  struct fixed_phy_status *status)
 {
@@ -172,6 +173,22 @@ static int bcmgenet_fixed_phy_link_update(struct net_device *dev,
 	return 0;
 }
 
+/* Perform a voluntary PHY software reset, since the EPHY is very finicky about
+ * not doing it and will start corrupting packets
+ */
+void bcmgenet_mii_reset(struct net_device *dev)
+{
+	struct bcmgenet_priv *priv = netdev_priv(dev);
+
+	if (GENET_IS_V4(priv))
+		return;
+
+	if (priv->phydev) {
+		phy_init_hw(priv->phydev);
+		phy_start_aneg(priv->phydev);
+	}
+}
+
 void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
 {
 	struct bcmgenet_priv *priv = netdev_priv(dev);
@@ -214,6 +231,7 @@ static void bcmgenet_internal_phy_setup(struct net_device *dev)
 	reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
 	reg |= EXT_PWR_DN_EN_LD;
 	bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
+	bcmgenet_mii_reset(dev);
 }
 
 static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
Signature · 1 line
2.1.0
#1 lore raw
Quoted 9 lines · Florian Fainelli

The EPHY on GENET v1->v3 is extremely finicky, and will show occasional failures based on the timing and reset sequence, ranging from duplicate packets, to extremely high latencies.

Perform an additional software reset, and re-configuration to make sure it is in a consistent and working state.

Fixes 6ac3ce8295e6 ("net: bcmgenet: Remove excessive PHY reset")

I see that you have applied this to your pull request sent to Linus today, could you also queue this for 4.3-stable? Thank you!

Signature · 1 line
Florian
maintainer
#2 lore raw

From: Florian Fainelli <[email protected]>
Date: Tue, 03 Nov 2015 15:44:14 -0800

Quoted 5 lines · Florian Fainelli
Quoted 4 lines

The EPHY on GENET v1->v3 is extremely finicky, and will show occasional failures based on the timing and reset sequence, ranging from duplicate packets, to extremely high latencies.

Quoted 8 lines
Quoted 5 lines

Perform an additional software reset, and re-configuration to make sure it is in a consistent and working state.

Fixes 6ac3ce8295e6 ("net: bcmgenet: Remove excessive PHY reset")

I see that you have applied this to your pull request sent to Linus today, could you also queue this for 4.3-stable? Thank you!

Done.