[<prev] [next>] [day] [month] [year] [list]
Message-ID: <7f45d9390607191429y403e5bc8s69e1056e0a27d711@mail.gmail.com>
Date: Wed, 19 Jul 2006 15:29:25 -0600
From: "Shaun Jackman" <sjackman@...il.com>
To: LKML <linux-kernel@...r.kernel.org>,
"uClinux development list" <uClinux-dev@...inux.org>
Cc: "Russell King" <rmk@....linux.org.uk>,
"Nicolas Pitre" <nico@....org>
Subject: [PATCH] smc91x: Add support for an external PHY
[PATCH] smc91x: Add support for an external PHY
Add an `extphy' module parameter to the smc91x Ethernet driver. This
parameter enables use of the external MII port and disables the
internal PHY.
Signed-off-by: Shaun Jackman <sjackman@...il.com>
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 3d8dcb6..d784565 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -26,6 +26,7 @@
* io = for the base address
* irq = for the IRQ
* nowait = 0 for normal wait states, 1 eliminates additional wait states
+ * extphy = use an external PHY
*
* original author:
* Erik Stahlman <erik@...edu>
@@ -37,6 +38,7 @@
* Daris A Nevil <dnevil@...c.com>
* Nicolas Pitre <nico@....org>
* Russell King <rmk@....linux.org.uk>
+ * Shaun Jackman <sjackman@...il.com>
*
* History:
* 08/20/00 Arnaldo Melo fix kfree(skb) in smc_hardware_send_packet
@@ -56,6 +58,7 @@
* - clean up (and fix stack overrun) in PHY
* MII read/write functions
* 22/09/04 Nicolas Pitre big update (see commit log for details)
+ * 18/07/06 Shaun Jackman add extphy parameter
*/
static const char version[] =
"smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <nico@....org>\n";
@@ -124,6 +127,13 @@ static int nowait = SMC_NOWAIT;
module_param(nowait, int, 0400);
MODULE_PARM_DESC(nowait, "set to 1 for no wait state");
+#ifndef SMC_EXTPHY
+# define SMC_EXTPHY 0
+#endif
+static int extphy = SMC_EXTPHY;
+module_param(extphy, int, 0400);
+MODULE_PARM_DESC(extphy, "set to 1 to use an external PHY");
+
/*
* Transmit timeout, default 5 seconds.
*/
@@ -359,6 +369,10 @@ static void smc_reset(struct net_device
if (nowait)
cfg |= CONFIG_NO_WAIT;
+ /* Use an external PHY if requested. */
+ if (extphy)
+ cfg |= CONFIG_EXT_PHY;
+
/*
* Release from possible power-down state
* Configuration register is not affected by Soft Reset
@@ -949,6 +963,9 @@ static void smc_phy_detect(struct net_de
lp->phy_type = 0;
+ if (extphy)
+ return;
+
/*
* Scan all 32 PHY addresses if necessary, starting at
* PHY#1 to PHY#31, and then PHY#0 last.
@@ -1583,7 +1600,7 @@ smc_open(struct net_device *dev)
* If we are not using a MII interface, we need to
* monitor our own carrier signal to detect faults.
*/
- if (lp->phy_type == 0)
+ if (lp->phy_type == 0 && !extphy)
lp->tcr_cur_mode |= TCR_MON_CSN;
/* reset the hardware */
@@ -2025,8 +2042,9 @@ #endif
if (dev->dma != (unsigned char)-1)
printk(" DMA %d", dev->dma);
- printk("%s%s\n", nowait ? " [nowait]" : "",
- THROTTLE_TX_PKTS ? " [throttle_tx]" : "");
+ printk("%s%s%s\n", nowait ? " [nowait]" : "",
+ THROTTLE_TX_PKTS ? " [throttle_tx]" : "",
+ extphy ? " [extphy]" : "");
if (!is_valid_ether_addr(dev->dev_addr)) {
printk("%s: Invalid ethernet MAC address. Please "
@@ -2046,6 +2064,8 @@ #endif
} else if ((lp->phy_type & 0xfffffff0) == 0x02821c50) {
PRINTK("%s: PHY LAN83C180\n", dev->name);
}
+ if (extphy)
+ PRINTK("%s: Using external PHY\n", dev->name);
}
err_out:
View attachment "linux-smc91x-extphy.diff" of type "text/plain" (3117 bytes)
Powered by blists - more mailing lists