All of lore.kernel.org
 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

* Re: [PATCH 1/2] r6040: check for absent PHY
  2009-05-05  6:30 [PATCH 1/2] r6040: check for absent PHY Florian Fainelli
@ 2009-05-05 19:30 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-05-05 19:30 UTC (permalink / raw)
  To: florian; +Cc: netdev

From: Florian Fainelli <florian@openwrt.org>
Date: Tue, 5 May 2009 08:30:01 +0200

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

Applied to net-next-2.6

^ permalink raw reply	[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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.