Commit 9011b4ee authored by Andrew Morton's avatar Andrew Morton Committed by Jeff Garzik

[PATCH] tulip: make tulip_stop_rxtx() wait for DMA to fully stop

From: "John W. Linville" <linville@tuxdriver.com>

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

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.
Signed-off-by: default avatarGrant Grundler <iod00d@hp.com>
Acked-by: default avatarCharlie Brett <charlie.brett@hp.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent 139292f2
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
*/ */
#include "tulip.h"
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/delay.h> #include <linux/delay.h>
#include "tulip.h"
static u16 t21142_csr13[] = { 0x0001, 0x0009, 0x0009, 0x0000, 0x0001, }; static u16 t21142_csr13[] = { 0x0001, 0x0009, 0x0009, 0x0000, 0x0001, };
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
#include <linux/pci.h>
#include "tulip.h" #include "tulip.h"
#include <linux/init.h> #include <linux/init.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
......
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
*/ */
#include <linux/pci.h>
#include "tulip.h" #include "tulip.h"
#include <linux/config.h> #include <linux/config.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/pci.h>
int tulip_rx_copybreak; int tulip_rx_copybreak;
unsigned int tulip_max_interrupt_work; unsigned int tulip_max_interrupt_work;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pci.h>
#include "tulip.h" #include "tulip.h"
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/pci.h>
#include "tulip.h" #include "tulip.h"
......
...@@ -76,8 +76,8 @@ ...@@ -76,8 +76,8 @@
#include "tulip.h"
#include <linux/pci.h> #include <linux/pci.h>
#include "tulip.h"
#include <linux/delay.h> #include <linux/delay.h>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
#include <linux/pci.h>
#include "tulip.h" #include "tulip.h"
......
...@@ -149,6 +149,9 @@ enum status_bits { ...@@ -149,6 +149,9 @@ enum status_bits {
TxIntr = 0x01, TxIntr = 0x01,
}; };
/* bit mask for CSR5 TX/RX process state */
#define CSR5_TS 0x00700000
#define CSR5_RS 0x000e0000
enum tulip_mode_bits { enum tulip_mode_bits {
TxThreshold = (1 << 22), TxThreshold = (1 << 22),
...@@ -460,9 +463,19 @@ static inline void tulip_stop_rxtx(struct tulip_private *tp) ...@@ -460,9 +463,19 @@ static inline void tulip_stop_rxtx(struct tulip_private *tp)
u32 csr6 = ioread32(ioaddr + CSR6); u32 csr6 = ioread32(ioaddr + CSR6);
if (csr6 & RxTx) { if (csr6 & RxTx) {
unsigned i=1300/10;
iowrite32(csr6 & ~RxTx, ioaddr + CSR6); iowrite32(csr6 & ~RxTx, ioaddr + CSR6);
barrier(); barrier();
(void) ioread32(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 < 50 us on 100BT.
*/
while (--i && (ioread32(ioaddr + CSR5) & (CSR5_TS|CSR5_RS)))
udelay(10);
if (!i)
printk(KERN_DEBUG "%s: tulip_stop_rxtx() failed\n",
tp->pdev->slot_name);
} }
} }
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#include <linux/module.h> #include <linux/module.h>
#include "tulip.h"
#include <linux/pci.h> #include <linux/pci.h>
#include "tulip.h"
#include <linux/init.h> #include <linux/init.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/delay.h> #include <linux/delay.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment