netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: linux-kernel@vger.kernel.org
Cc: netdev@oss.sgi.com, jgarzik@pobox.com, grant.grundler@hp.com,
	charlie.brett@hp.com
Subject: [patch 2.4.28-rc3] tulip: make tulip_stop_rxtx() wait for DMA to fully stop
Date: Wed, 17 Nov 2004 15:15:53 -0500	[thread overview]
Message-ID: <20041117151553.C31363@tuxdriver.com> (raw)

tulip_stop_rxtx() doesn't wait for DMA to fully stop like the function
call name implies.

Acked-by: Grant Grundler <grant.grundler@hp.com>
Acked-by: Charlie Brett <charlie.brett@hp.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
This was submitted through my employer -- I am not the original author
of this patch.  However, I passed it by Jeff Garizk and he expressed
interest in having it upstream.

 drivers/net/tulip/21142.c      |    2 +-
 drivers/net/tulip/eeprom.c     |    1 +
 drivers/net/tulip/interrupt.c  |    2 +-
 drivers/net/tulip/media.c      |    1 +
 drivers/net/tulip/pnic.c       |    1 +
 drivers/net/tulip/pnic2.c      |    2 +-
 drivers/net/tulip/timer.c      |    1 +
 drivers/net/tulip/tulip.h      |   15 ++++++++++++++-
 drivers/net/tulip/tulip_core.c |    2 +-
 9 files changed, 22 insertions(+), 5 deletions(-)

--- tulip_stop_rxtx-2.4/drivers/net/tulip/tulip_core.c.orig
+++ tulip_stop_rxtx-2.4/drivers/net/tulip/tulip_core.c
@@ -20,8 +20,8 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
-#include "tulip.h"
 #include <linux/pci.h>
+#include "tulip.h"
 #include <linux/init.h>
 #include <linux/etherdevice.h>
 #include <linux/delay.h>
--- tulip_stop_rxtx-2.4/drivers/net/tulip/media.c.orig
+++ tulip_stop_rxtx-2.4/drivers/net/tulip/media.c
@@ -18,6 +18,7 @@
 #include <linux/mii.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/pci.h>
 #include "tulip.h"
 
 
--- tulip_stop_rxtx-2.4/drivers/net/tulip/21142.c.orig
+++ tulip_stop_rxtx-2.4/drivers/net/tulip/21142.c
@@ -14,8 +14,8 @@
 
 */
 
-#include "tulip.h"
 #include <linux/pci.h>
+#include "tulip.h"
 #include <linux/delay.h>
 
 
--- tulip_stop_rxtx-2.4/drivers/net/tulip/timer.c.orig
+++ tulip_stop_rxtx-2.4/drivers/net/tulip/timer.c
@@ -14,6 +14,7 @@
 
 */
 
+#include <linux/pci.h>
 #include "tulip.h"
 
 
--- tulip_stop_rxtx-2.4/drivers/net/tulip/tulip.h.orig
+++ tulip_stop_rxtx-2.4/drivers/net/tulip/tulip.h
@@ -146,6 +146,9 @@ enum status_bits {
 	TxIntr = 0x01,
 };
 
+/* bit mask for CSR5 TX/RX process state */
+#define CSR5_TS	0x00700000
+#define CSR5_RS	0x000e0000
 
 enum tulip_mode_bits {
 	TxThreshold		= (1 << 22),
@@ -484,9 +487,19 @@ static inline void tulip_stop_rxtx(struc
 	u32 csr6 = inl(ioaddr + CSR6);
 
 	if (csr6 & RxTx) {
+		unsigned i=1300/10;
 		outl(csr6 & ~RxTx, ioaddr + CSR6);
 		barrier();
-		(void) inl(ioaddr + CSR6); /* mmio sync */
+		/* wait until in-flight frame completes.
+		 * Max time @ 10BT: 1500*8b/10Mbps == 1200us (+ 100us margin)
+		 * Typically expect this loop to end in < 50us on 100BT.
+		 */
+		while (--i && (inl(ioaddr + CSR5) & (CSR5_TS|CSR5_RS))) 
+			udelay(10);
+
+		if (!i)
+			printk (KERN_DEBUG "%s: tulip_stop_rxtx() failed\n",
+					tp->pdev->slot_name);
 	}
 }
 
--- tulip_stop_rxtx-2.4/drivers/net/tulip/pnic.c.orig
+++ tulip_stop_rxtx-2.4/drivers/net/tulip/pnic.c
@@ -15,6 +15,7 @@
 */
 
 #include <linux/kernel.h>
+#include <linux/pci.h>
 #include "tulip.h"
 
 
--- tulip_stop_rxtx-2.4/drivers/net/tulip/pnic2.c.orig
+++ tulip_stop_rxtx-2.4/drivers/net/tulip/pnic2.c
@@ -76,8 +76,8 @@
 
 
 
-#include "tulip.h"
 #include <linux/pci.h>
+#include "tulip.h"
 #include <linux/delay.h>
 
 
--- tulip_stop_rxtx-2.4/drivers/net/tulip/eeprom.c.orig
+++ tulip_stop_rxtx-2.4/drivers/net/tulip/eeprom.c
@@ -14,6 +14,7 @@
 
 */
 
+#include <linux/pci.h>
 #include "tulip.h"
 #include <linux/init.h>
 #include <asm/unaligned.h>
--- tulip_stop_rxtx-2.4/drivers/net/tulip/interrupt.c.orig
+++ tulip_stop_rxtx-2.4/drivers/net/tulip/interrupt.c
@@ -14,10 +14,10 @@
 
 */
 
+#include <linux/pci.h>
 #include "tulip.h"
 #include <linux/config.h>
 #include <linux/etherdevice.h>
-#include <linux/pci.h>
 
 
 int tulip_rx_copybreak;

                 reply	other threads:[~2004-11-17 20:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20041117151553.C31363@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=charlie.brett@hp.com \
    --cc=grant.grundler@hp.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --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).