netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] natsemi: long cable, short cable
@ 2005-02-08 14:18 Olaf Kirch
  2005-02-11 22:07 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Olaf Kirch @ 2005-02-08 14:18 UTC (permalink / raw)
  To: netdev

The current version of the natsemi driver comes with a workaround
for a hardware problem that causes link failures on short cables.
Unfortunately, this workaround causes massive link failures on _long_
cables (270-300ft). This patch adds a module parameter to disable
the workaround if required.

Signed-off-by: Olaf Kirch <okir@suse.de>

Index: linux-2.6.10/drivers/net/natsemi.c
===================================================================
--- linux-2.6.10.orig/drivers/net/natsemi.c
+++ linux-2.6.10/drivers/net/natsemi.c
@@ -186,6 +186,7 @@ static int debug = -1;
 /* Maximum events (Rx packets, etc.) to handle at each interrupt. */
 static int max_interrupt_work = 20;
 static int mtu;
+static int no_cable_magic = 0;
 
 /* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
    This chip uses a 512 element hash table based on the Ethernet CRC.  */
@@ -257,6 +258,7 @@ module_param(debug, int, 0);
 module_param(rx_copybreak, int, 0);
 module_param_array(options, int, NULL, 0);
 module_param_array(full_duplex, int, NULL, 0);
+module_param(no_cable_magic, int, 0);
 MODULE_PARM_DESC(max_interrupt_work, 
 	"DP8381x maximum events handled per interrupt");
 MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)");
@@ -266,6 +268,9 @@ MODULE_PARM_DESC(rx_copybreak, 
 MODULE_PARM_DESC(options, 
 	"DP8381x: Bits 0-3: media type, bit 17: full duplex");
 MODULE_PARM_DESC(full_duplex, "DP8381x full duplex setting(s) (1)");
+MODULE_PARM_DESC(no_cable_magic,
+	"DP8381x: set no_cable_magic=1 to disable magic workaround for short cables "
+	"(may help with long cables:-)");
 
 /*
 				Theory of Operation
@@ -1578,6 +1583,9 @@ static void do_cable_magic(struct net_de
 	struct netdev_private *np = netdev_priv(dev);
 	void __iomem *ioaddr = ns_ioaddr(dev);
 
+	if (no_cable_magic)
+		return;
+
 	if (dev->if_port != PORT_TP)
 		return;
 
@@ -1623,6 +1631,9 @@ static void undo_cable_magic(struct net_
 	struct netdev_private *np = netdev_priv(dev);
 	void __iomem * ioaddr = ns_ioaddr(dev);
 
+	if (no_cable_magic)
+		return;
+
 	if (dev->if_port != PORT_TP)
 		return;
 

-- 
Olaf Kirch   |  --- o --- Nous sommes du soleil we love when we play
okir@suse.de |    / | \   sol.dhoop.naytheet.ah kin.ir.samse.qurax

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: [PATCH] natsemi: long cable, short cable
@ 2005-02-15  4:35 Gary Spiess
  0 siblings, 0 replies; 3+ messages in thread
From: Gary Spiess @ 2005-02-15  4:35 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev

Jeff,

I just read your message of Feb 10th, 2005 regarding the cable problems 
of natsemi.c.  My investigation started late last week.  On Feb 14th, I 
got serious and nailed it down.  I submitted a patch of my own without 
realizing there was other work in progress on the same issue.  Please 
consider replacing the patch you didn't like with mine.

What was happening with my DP83815D was that the TSTDAT value being read 
in the do_cable_magic function was near 0x1f, regardless of cable 
length.  The code that fixes short cable problems actually works for 
short cables, but messes up long ones.  The cable magic couldn't figure 
out the length of the cable and always applied the fix.  I went looking 
for the history of this patch on the Internet and found a DP83815 Linux 
driver written and maintained by National Semiconductor.  I was struck 
by the difference in the initialization sequences.  natsemi.c always 
applies the sequence documented for the DP83815B.  dp83815.c applies 
different sequences for chip revisions B, C, and D+.  I used the D 
initialization for my D chip, and again watched the values being 
returned from TSTDAT in do_cable magic.  A 1m cable returned something 
like 0xF8 and a 90m cable return something like 0xB8.  Now the register 
was returning a value like it must have done with previous revisions of 
the chip. The magic is properly applied in the proper situation.

Since there is no public documentation on these PHY manipulations, I 
minimized the 'fix' to the setting of the DSPCFG register.  If I only 
turn on the bit that makes the coefficient readable, do_cable_magic now 
appears to have the right information to decide the cable length 
automatically.

Ain't life great?

Gary

in reply to http://oss.sgi.com/archives/netdev/2005-02/msg00396.html

-- 
 oooooooooooooooooooooooooooooooooooooooooooooooooo
  Gary Spiess (Gary.Spiess@Intermec.com)
  MobileLan Wireless Products Group, Intermec Technology Corp
  voice: 319 369-3580  fax: 319 369-3804

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

end of thread, other threads:[~2005-02-15  4:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-08 14:18 [PATCH] natsemi: long cable, short cable Olaf Kirch
2005-02-11 22:07 ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2005-02-15  4:35 Gary Spiess

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