netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Gortmaker <p_gortmaker@yahoo.com>
To: netdev@oss.sgi.com
Cc: jgarzik@pobox.com, becker@scyld.com
Subject: [PATCH] ne2k-pci full duplex with RealTek
Date: Mon, 22 Sep 2003 21:22:11 -0400	[thread overview]
Message-ID: <3F6FA043.6010503@yahoo.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 463 bytes --]

A while ago Mika Liljeberg dug through the RTL8029.doc and
sent me the sequence to enable full duplex for these after
testing it worked OK.  The current sequence is just a copy
of the Holtek sequence and apparently doesn't work.

While updateing the sequence, I separated out the FDX code from
ne2k_pci_open() for enhanced readability and so that it may
also be called from other code paths eventually (e.g. ethtool)

Patch is against 2.6.0-test5.

Thanks,
Paul.

[-- Attachment #2: 2.6-test5-ne2k-diff0 --]
[-- Type: text/plain, Size: 1904 bytes --]

--- linux/drivers/net/ne2k-pci.c	Mon Sep  8 12:51:03 2003
+++ linux-net/drivers/net/ne2k-pci.c	Mon Sep 22 21:00:14 2003
@@ -26,8 +26,8 @@
 */
 
 #define DRV_NAME	"ne2k-pci"
-#define DRV_VERSION	"1.02"
-#define DRV_RELDATE	"10/19/2000"
+#define DRV_VERSION	"1.03"
+#define DRV_RELDATE	"9/22/2003"
 
 
 /* The user-configurable values.
@@ -380,21 +380,48 @@
 
 }
 
+/* 
+ * Magic incantation sequence for full duplex on the supported cards.
+ */
+static inline int set_realtek_fdx(struct net_device *dev)
+{
+	long ioaddr = dev->base_addr;
+
+	outb(0xC0 + E8390_NODMA, ioaddr + NE_CMD); /* Page 3 */
+	outb(0xC0, ioaddr + 0x01); /* Enable writes to CONFIG3 */
+	outb(0x40, ioaddr + 0x06); /* Enable full duplex */
+	outb(0x00, ioaddr + 0x01); /* Disable writes to CONFIG3 */
+	outb(E8390_PAGE0 + E8390_NODMA, ioaddr + NE_CMD); /* Page 0 */
+	return 0;
+}
+
+static inline int set_holtek_fdx(struct net_device *dev)
+{
+	long ioaddr = dev->base_addr;
+
+	outb(inb(ioaddr + 0x20) | 0x80, ioaddr + 0x20);
+	return 0;
+}
+
+static int ne2k_pci_set_fdx(struct net_device *dev)
+{
+	if (ei_status.ne2k_flags & REALTEK_FDX) 
+		return set_realtek_fdx(dev);
+	else if (ei_status.ne2k_flags & HOLTEK_FDX)
+		return set_holtek_fdx(dev);
+
+	return -EOPNOTSUPP;
+}
+
 static int ne2k_pci_open(struct net_device *dev)
 {
 	int ret = request_irq(dev->irq, ei_interrupt, SA_SHIRQ, dev->name, dev);
 	if (ret)
 		return ret;
 
-	/* Set full duplex for the chips that we know about. */
-	if (ei_status.ne2k_flags & FORCE_FDX) {
-		long ioaddr = dev->base_addr;
-		if (ei_status.ne2k_flags & REALTEK_FDX) {
-			outb(0xC0 + E8390_NODMA, ioaddr + NE_CMD); /* Page 3 */
-			outb(inb(ioaddr + 0x20) | 0x80, ioaddr + 0x20);
-		} else if (ei_status.ne2k_flags & HOLTEK_FDX)
-			outb(inb(ioaddr + 0x20) | 0x80, ioaddr + 0x20);
-	}
+	if (ei_status.ne2k_flags & FORCE_FDX)
+		ne2k_pci_set_fdx(dev);
+
 	ei_open(dev);
 	return 0;
 }

             reply	other threads:[~2003-09-23  1:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-23  1:22 Paul Gortmaker [this message]
2003-09-26  0:46 ` [PATCH] ne2k-pci full duplex with RealTek Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F6FA043.6010503@yahoo.com \
    --to=p_gortmaker@yahoo.com \
    --cc=becker@scyld.com \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).