Skip to contentSkip to conversation

net/davinci_emac: fix failing PHY connect attempts

PATCH Applied Anatolij Gustschin 2 participants 2 messages Apr 23, 2012 – Apr 24, 2012

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

PATCH 1/1 net/davinci_emac: fix failing PHY connect attempts

PHY connect attempts fail if no PHY id is specified in the emac platform data and another mdio bus has been registered before 'davinci_mdio' bus. In this case when configuring the interface, there will be an attempt to connect to already attached PHY on the previously registered mdio bus:

net eth1: PHY already attached
net eth1: could not connect to phy smsc911x-0:01
IP-Config: Failed to open eth1
IP-Config: Device `eth1' not found

Fix this by modifying match_first_device() to match first PHY device on 'davinci_mdio' bus.

---
 drivers/net/ethernet/ti/davinci_emac.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/ti/davinci_emac.c +1 -1
index 174a334..08aff1a 100644
@@ -1511,7 +1511,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
 
 static int match_first_device(struct device *dev, void *data)
 {
-	return 1;
+	return !strncmp(dev_name(dev), "davinci_mdio", 12);
 }
 
 /**
Signature · 1 line
1.7.1
maintainer Applied
#1 lore raw

From: Anatolij Gustschin <[email protected]>
Date: Tue, 24 Apr 2012 00:06:43 +0200

Quoted 10 lines

PHY connect attempts fail if no PHY id is specified in the emac platform data and another mdio bus has been registered before 'davinci_mdio' bus. In this case when configuring the interface, there will be an attempt to connect to already attached PHY on the previously registered mdio bus:

net eth1: PHY already attached
net eth1: could not connect to phy smsc911x-0:01
IP-Config: Failed to open eth1
IP-Config: Device `eth1' not found

Quoted 4 lines

Fix this by modifying match_first_device() to match first PHY device on 'davinci_mdio' bus.

Applied, thanks.