aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r6040.c
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2009-05-04 16:30:01 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-05 15:29:45 -0400
commitc8014fe1d4548da8b9ea54730852c48a7117b03f (patch)
treeadc1d1cd7dcab92c35bb2e10ad9c5df70882115f /drivers/net/r6040.c
parentaee64faf236815e0f337408892c01b373cd340f3 (diff)
r6040: check for absent PHY
Some devices have two R6040 MACs but the second one is not wired to any PHY, therefore the interface is just unusable. Warn the user about that and prevent device from registering. Tested-by: bifferos <bifferos@yahoo.co.uk> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/r6040.c')
-rw-r--r--drivers/net/r6040.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 6f97b47d74a6..65627253c988 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -742,6 +742,14 @@ static int r6040_up(struct net_device *dev)
742 struct r6040_private *lp = netdev_priv(dev); 742 struct r6040_private *lp = netdev_priv(dev);
743 void __iomem *ioaddr = lp->base; 743 void __iomem *ioaddr = lp->base;
744 int ret; 744 int ret;
745 u16 val;
746
747 /* Check presence of a second PHY */
748 val = r6040_phy_read(ioaddr, lp->phy_addr, 2);
749 if (val == 0xFFFF) {
750 printk(KERN_ERR DRV_NAME " no second PHY attached\n");
751 return -EIO;
752 }
745 753
746 /* Initialise and alloc RX/TX buffers */ 754 /* Initialise and alloc RX/TX buffers */
747 r6040_init_txbufs(dev); 755 r6040_init_txbufs(dev);