From linux-kernel-owner+willy=40w.ods.org-S262394AbUKRCE3@vger.kernel.org Thu Nov 18 03:11:14 2004 Return-Path: Received: from vger.kernel.org (vger.kernel.org [12.107.209.244]) by mail.w.ods.org (8.12.9/8.12.1) with ESMTP id iAI2Djac025562 for ; Thu, 18 Nov 2004 03:13:46 +0100 (CET) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262394AbUKRCE3 (ORCPT ); Wed, 17 Nov 2004 21:04:29 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262391AbUKRCCV (ORCPT ); Wed, 17 Nov 2004 21:02:21 -0500 Received: from ra.tuxdriver.com ([24.172.12.4]:31251 "EHLO ra.tuxdriver.com") by vger.kernel.org with ESMTP id S262369AbUKQUTV (ORCPT ); Wed, 17 Nov 2004 15:19:21 -0500 Received: (from linville@localhost) by ra.tuxdriver.com (8.11.6/8.11.6) id iAHKFrI04211; Wed, 17 Nov 2004 15:15:53 -0500 Date: Wed, 17 Nov 2004 15:15:53 -0500 From: "John W. Linville" 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 Message-ID: <20041117151553.C31363@tuxdriver.com> Mail-Followup-To: linux-kernel@vger.kernel.org, netdev@oss.sgi.com, jgarzik@pobox.com, grant.grundler@hp.com, charlie.brett@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org Status: RO Content-Length: 3962 Lines: 150 tulip_stop_rxtx() doesn't wait for DMA to fully stop like the function call name implies. Acked-by: Grant Grundler Acked-by: Charlie Brett Signed-off-by: John W. Linville --- 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 #include -#include "tulip.h" #include +#include "tulip.h" #include #include #include --- 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 #include #include +#include #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 +#include "tulip.h" #include --- 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 #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 +#include #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 +#include "tulip.h" #include --- 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 #include "tulip.h" #include #include --- 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 #include "tulip.h" #include #include -#include int tulip_rx_copybreak; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/