netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] r6040: check for absent PHY
@ 2009-05-05  6:30 Florian Fainelli
  2009-05-05 19:30 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2009-05-05  6:30 UTC (permalink / raw)
  To: David Miller, netdev

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>
---
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 6f97b47..b75b047 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-05 19:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-05  6:30 [PATCH 1/2] r6040: check for absent PHY Florian Fainelli
2009-05-05 19:30 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).