Skip to content

Commit

Permalink
r6040: check for absent PHY
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed May 5, 2009
1 parent aee64fa commit c8014fe
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/net/r6040.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@ static int r6040_up(struct net_device *dev)
struct r6040_private *lp = netdev_priv(dev);
void __iomem *ioaddr = lp->base;
int ret;
u16 val;

/* Check presence of a second PHY */
val = r6040_phy_read(ioaddr, lp->phy_addr, 2);
if (val == 0xFFFF) {
printk(KERN_ERR DRV_NAME " no second PHY attached\n");
return -EIO;
}

/* Initialise and alloc RX/TX buffers */
r6040_init_txbufs(dev);
Expand Down

0 comments on commit c8014fe

Please sign in to comment.