Patchwork [net] net/davinci_emac: fix failing PHY connect attempts

login
register
mail settings
Submitter Anatolij Gustschin
Date April 23, 2012, 10:06 p.m.
Message ID <1335218803-8664-1-git-send-email-agust@denx.de>
Download mbox | patch
Permalink /patch/154550/
State Accepted
Delegated to: David Miller
Headers show

Comments

Anatolij Gustschin - April 23, 2012, 10:06 p.m.
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>
---
 drivers/net/ethernet/ti/davinci_emac.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
David Miller - April 24, 2012, 4:44 a.m.
From: Anatolij Gustschin <agust@denx.de>
Date: Tue, 24 Apr 2012 00:06:43 +0200

> 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>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 174a334..08aff1a 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -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);
 }
 
 /**