]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net/davinci_emac: fix failing PHY connect attempts
authorAnatolij Gustschin <agust@denx.de>
Mon, 23 Apr 2012 12:06:43 +0000 (12:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Apr 2012 04:43:55 +0000 (00:43 -0400)
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.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/davinci_emac.c

index 174a3348f6762d67a661801342ea6cbe95a7810f..08aff1a2087c920207f544bf540917b481c35344 100644 (file)
@@ -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);
 }
 
 /**