Skip to contentSkip to conversation

NET: PHY names vs MDIO bus names regression fixes

PATCH In review Florian Fainelli 2 participants 9 messages Feb 13, 2012

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

cover NET: PHY names vs MDIO bus names regression fixes

Hello David,

This patch serie aims at fixing the regressions introduced with the "use an unique MDIO bus name" patchset. Some drivers still formatted the PHY id to use the old bus name (e.g: "0" or "1") and therefore the PHY probing logic gets broken because their underlying MDIO bus name was changed too from "0" to <foo>-<id>.

The offending patches got introduced during 3.3-rc1.

Thanks!

Florian Fainelli (5):
cpmac: fix PHY name to match MDIO bus name
bcm63xx-enet: fix PHY name to match MDIO bus name
fec: fix PHY name to match fixed MDIO bus name
octeon: fix PHY name to match MDIO bus name
ixp4xx-eth: fix PHY name to match MDIO bus name

 drivers/net/ethernet/broadcom/bcm63xx_enet.c |    2 +-
 drivers/net/ethernet/freescale/fec.c         |    2 +-
 drivers/net/ethernet/octeon/octeon_mgmt.c    |    4 ++--
 drivers/net/ethernet/ti/cpmac.c              |    4 ++--
 drivers/net/ethernet/xscale/ixp4xx_eth.c     |    3 ++-
 5 files changed, 8 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/5 cpmac: fix PHY name to match MDIO bus name

Commit d1733f07: cpmac: use an unique MDIO bus name changed the MDIO bus name from "1" to "cpmac-1", this breaks the PHY connection logic because the PHY name still uses the old bus names "0" and "1", fix that to always use the mdio bus id instead.

---
 drivers/net/ethernet/ti/cpmac.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/cpmac.c +2 -2
index 97e1df3..860c252 100644
@@ -1122,7 +1122,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
 	pdata = pdev->dev.platform_data;
 
 	if (external_switch || dumb_switch) {
-		strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
+		strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */
 		phy_id = pdev->id;
 	} else {
 		for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
@@ -1138,7 +1138,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
 	if (phy_id == PHY_MAX_ADDR) {
 		dev_err(&pdev->dev, "no PHY present, falling back "
 					"to switch on MDIO bus 0\n");
-		strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
+		strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */
 		phy_id = pdev->id;
 	}
 
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/5 bcm63xx-enet: fix PHY name to match MDIO bus name

In reply to Florian Fainelli

Commit 3e617506: bcm63xx_enet: use an unique MDIO bus name introduced a regression in the PHY connection logic, since the PHY name was formatted to expect the bus name to be "0" or "1", whereas it is now "bcm63xx-enet-0" or "bcm63xx-enet-1".

---
 drivers/net/ethernet/broadcom/bcm63xx_enet.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/broadcom/bcm63xx_enet.c +1 -1
index 986019b..c7ca7ec 100644
@@ -797,7 +797,7 @@ static int bcm_enet_open(struct net_device *dev)
 	if (priv->has_phy) {
 		/* connect to PHY */
 		snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
-			 priv->mac_id ? "1" : "0", priv->phy_id);
+			 priv->mii_bus->id, priv->phy_id);
 
 		phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, 0,
 				     PHY_INTERFACE_MODE_MII);
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 3/5 fec: fix PHY name to match fixed MDIO bus name

In reply to Florian Fainelli

Commit "391420f7: fec: use an unique MDIO bus name" first modified the MDIO bus name to include the platform name, then in commit "a7ed07d5: net: fec: correct phy_name buffer length when init phy_name" the PHY name formatting was fixed in the case the PHY matches a PHY driver.

The FEC driver however, also handles the case where we want to attach to the fixed MDIO bus name, which was previously named "0", and now "fixed-0". Change the PHY formatting logic to account for that.

---
 drivers/net/ethernet/freescale/fec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/freescale/fec.c +1 -1
index 0ee2ca7..a12b3f5 100644
@@ -986,7 +986,7 @@ static int fec_enet_mii_probe(struct net_device *ndev)
 		printk(KERN_INFO
 			"%s: no PHY, assuming direct connection to switch\n",
 			ndev->name);
-		strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE);
+		strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE);
 		phy_id = 0;
 	}
 
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH 4/5 octeon: fix PHY name to match MDIO bus name

In reply to Florian Fainelli

Commit "d6c25be: mdio-octeon: use an unique MDIO bus name" changed the octeon MDIO bus name from "0" to "mdio-octeon-0", change the PHY formatting logic to account for that name change, so that PHY connection on this bus succeeds.

---
 drivers/net/ethernet/octeon/octeon_mgmt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/octeon/octeon_mgmt.c +2 -2
index 212f43b..cd827ff 100644
@@ -670,7 +670,7 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev)
 static int octeon_mgmt_init_phy(struct net_device *netdev)
 {
 	struct octeon_mgmt *p = netdev_priv(netdev);
-	char phy_id[20];
+	char phy_id[MII_BUS_ID_SIZE + 3];
 
 	if (octeon_is_simulation()) {
 		/* No PHYs in the simulator. */
@@ -678,7 +678,7 @@ static int octeon_mgmt_init_phy(struct net_device *netdev)
 		return 0;
 	}
 
-	snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "0", p->port);
+	snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "mdio-octeon-0", p->port);
 
 	p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0,
 				PHY_INTERFACE_MODE_MII);
Signature · 1 line
1.7.5.4
#5 lore raw

PATCH 5/5 ixp4xx-eth: fix PHY name to match MDIO bus name

In reply to Florian Fainelli

Commit 0869b3a4: ixp4xx-eth: use an unique MDIO bus name changed the MDIO bus name from "0" to "ixp4xx-eth-0", as a result the PHY name is not longer appropriate and will not match the MDIO bus name so PHY connection will not succeed, fix that.

---
 drivers/net/ethernet/xscale/ixp4xx_eth.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/ethernet/xscale/ixp4xx_eth.c +2 -1
index 72a854f..41a8b5a 100644
@@ -1416,7 +1416,8 @@ static int __devinit eth_init_one(struct platform_device *pdev)
 	__raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control);
 	udelay(50);
 
-	snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy);
+	snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT,
+		mdio_bus->id, plat->phy);
 	port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
 				   PHY_INTERFACE_MODE_MII);
 	if (IS_ERR(port->phydev)) {
Signature · 1 line
1.7.5.4
maintainer
#6 lore raw
In reply to Florian Fainelli

From: Florian Fainelli <[email protected]>
Date: Mon, 13 Feb 2012 12:23:19 +0100

Quoted 7 lines

This patch serie aims at fixing the regressions introduced with the "use an unique MDIO bus name" patchset. Some drivers still formatted the PHY id to use the old bus name (e.g: "0" or "1") and therefore the PHY probing logic gets broken because their underlying MDIO bus name was changed too from "0" to <foo>-<id>.

The offending patches got introduced during 3.3-rc1.

Then why the heck are you CC:'ing -stable on these patches?

We're still in the 3.3-rcX phase, so there is no other tree in the world these patches should be applied to.

In any event, for networking stuff, you shouldn't be adding the stable CC: anyways, I take care of all networking stable submissions myself.

#7 lore raw
Quoted 9 lines · David Miller

From: Florian Fainelli <[email protected]>
Date: Mon, 13 Feb 2012 12:23:19 +0100

Quoted 6 lines

This patch serie aims at fixing the regressions introduced with the "use an unique MDIO bus name" patchset. Some drivers still formatted the PHY id to use the old bus name (e.g: "0" or "1") and therefore the PHY probing logic gets broken because their underlying MDIO bus name was changed too from "0" to <foo>-<id>.

Quoted 3 lines
Quoted 1 line

The offending patches got introduced during 3.3-rc1.

Then why the heck are you CC:'ing -stable on these patches?

There was no reason, just some bad habit.

Quoted 7 lines

We're still in the 3.3-rcX phase, so there is no other tree in the world these patches should be applied to.

In any event, for networking stuff, you shouldn't be adding the stable CC: anyways, I take care of all networking stable submissions myself.

Allright, do you want me to resend these without the CC or are they okay as is?

Signature · 1 line
Florian
maintainer
#8 lore raw

From: Florian Fainelli <[email protected]>
Date: Mon, 13 Feb 2012 23:00:27 +0100

Quoted 2 lines

Allright, do you want me to resend these without the CC or are they okay as is?

If you actually took a look at my tree you'd see all of your changes there, and therefore you wouldn't have to waste time asking silly questions like this.