Skip to contentSkip to conversation

net: bcmgenet: Set phydev->dev_flags only for internal PHYs

PATCH In review Florian Fainelli 3 participants 4 messages Oct 11, 2019 – Oct 15, 2019

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

PATCH 1/1 net: bcmgenet: Set phydev->dev_flags only for internal PHYs

phydev->dev_flags is entirely dependent on the PHY device driver which is going to be used, setting the internal GENET PHY revision in those bits only makes sense when drivers/net/phy/bcm7xxx.c is the PHY driver being used.

Fixes 487320c54143 ("net: bcmgenet: communicate integrated PHY revision to PHY driver")
---
 drivers/net/ethernet/broadcom/genet/bcmmii.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmmii.c +3 -2
index 970e478a9017..94d1dd5d56bf 100644
@@ -273,11 +273,12 @@ int bcmgenet_mii_probe(struct net_device *dev)
 	struct bcmgenet_priv *priv = netdev_priv(dev);
 	struct device_node *dn = priv->pdev->dev.of_node;
 	struct phy_device *phydev;
-	u32 phy_flags;
+	u32 phy_flags = 0;
 	int ret;
 
 	/* Communicate the integrated PHY revision */
-	phy_flags = priv->gphy_rev;
+	if (priv->internal_phy)
+		phy_flags = priv->gphy_rev;
 
 	/* Initialize link state variables that bcmgenet_mii_setup() uses */
 	priv->old_link = -1;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 7 lines · Florian Fainelli

phydev->dev_flags is entirely dependent on the PHY device driver which is going to be used, setting the internal GENET PHY revision in those bits only makes sense when drivers/net/phy/bcm7xxx.c is the PHY driver being used.

Fixes 487320c54143 ("net: bcmgenet: communicate integrated PHY revision to PHY driver")

FWIW, I am preparing net-next material which allows the phy_flags to be scoped towards a specific PHY driver, and not broadly applied, but until this happens, we should probably go with this change.

Quoted 24 lines
---
 drivers/net/ethernet/broadcom/genet/bcmmii.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmmii.c +3 -2
index 970e478a9017..94d1dd5d56bf 100644
@@ -273,11 +273,12 @@ int bcmgenet_mii_probe(struct net_device *dev)
 	struct bcmgenet_priv *priv = netdev_priv(dev);
 	struct device_node *dn = priv->pdev->dev.of_node;
 	struct phy_device *phydev;
-	u32 phy_flags;
+	u32 phy_flags = 0;
 	int ret;
 
 	/* Communicate the integrated PHY revision */
-	phy_flags = priv->gphy_rev;
+	if (priv->internal_phy)
+		phy_flags = priv->gphy_rev;
 
 	/* Initialize link state variables that bcmgenet_mii_setup() uses */
 	priv->old_link = -1;
Signature · 1 line
Florian
maintainer Acked-by
#2 lore raw
Quoted 29 lines · Florian Fainelli
Quoted 7 lines · Florian Fainelli

phydev->dev_flags is entirely dependent on the PHY device driver which is going to be used, setting the internal GENET PHY revision in those bits only makes sense when drivers/net/phy/bcm7xxx.c is the PHY driver being used.

Fixes 487320c54143 ("net: bcmgenet: communicate integrated PHY revision to PHY driver")

FWIW, I am preparing net-next material which allows the phy_flags to be scoped towards a specific PHY driver, and not broadly applied, but until this happens, we should probably go with this change.

Quoted 16 lines
---
 drivers/net/ethernet/broadcom/genet/bcmmii.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmmii.c +1 -1
index 970e478a9017..94d1dd5d56bf 100644
@@ -273,11 +273,12 @@ int bcmgenet_mii_probe(struct net_device *dev)
 	struct bcmgenet_priv *priv = netdev_priv(dev);
 	struct device_node *dn = priv->pdev->dev.of_node;
 	struct phy_device *phydev;
-	u32 phy_flags;
+	u32 phy_flags = 0;
 	int ret;
 
Quoted 10 lines

drivers/net/ethernet/broadcom/genet/bcmmii.c int bcmgenet_mii_probe(struct net_device *dev) · line 284

Quoted 8 lines
drivers/net/ethernet/broadcom/genet/bcmmii.c +2 -1
 	/* Communicate the integrated PHY revision */
-	phy_flags = priv->gphy_rev;
+	if (priv->internal_phy)
+		phy_flags = priv->gphy_rev;
 
 	/* Initialize link state variables that bcmgenet_mii_setup() uses */
 	priv->old_link = -1;
maintainer
#3 lore raw
In reply to Florian Fainelli

From: Florian Fainelli <[email protected]>
Date: Fri, 11 Oct 2019 12:53:49 -0700

Quoted 7 lines

phydev->dev_flags is entirely dependent on the PHY device driver which is going to be used, setting the internal GENET PHY revision in those bits only makes sense when drivers/net/phy/bcm7xxx.c is the PHY driver being used.

Fixes 487320c54143 ("net: bcmgenet: communicate integrated PHY revision to PHY driver")

Applied and queued up for -stable, thanks Florian.