Return-Path: <rl@hellgate.ch>
Received: from localhost (bix [127.0.0.1])
	by localhost.localdomain (8.12.10/8.12.10) with ESMTP id i4NAp9e9027020
	for <akpm@localhost>; Sun, 23 May 2004 03:51:10 -0700
Received: from bix [127.0.0.1]
	by localhost with POP3 (fetchmail-6.2.0)
	for akpm@localhost (single-drop); Sun, 23 May 2004 03:51:10 -0700 (PDT)
Received: from fire-2.osdl.org (air1.pdx.osdl.net [172.20.0.5])
	by mail.osdl.org (8.11.6/8.11.6) with ESMTP id i4NAn8r12265
	for <akpm@mail.gateway.osdl.net>; Sun, 23 May 2004 03:49:08 -0700
Received: from mail3.bluewin.ch (mail3.bluewin.ch [195.186.1.75])
	by fire-2.osdl.org (8.12.8/8.12.8) with ESMTP id i4NAn7wr026859
	for <akpm@osdl.org>; Sun, 23 May 2004 03:49:08 -0700
Received: from k3.hellgate.ch (81.62.85.188) by mail3.bluewin.ch (Bluewin AG 7.0.028)
        id 40A469630011B319; Sun, 23 May 2004 10:49:00 +0000
Received: by k3.hellgate.ch (Postfix, from userid 1000)
	id A92825A2F9E; Sun, 23 May 2004 12:48:59 +0200 (CEST)
Date: Sun, 23 May 2004 12:48:59 +0200
From: Roger Luethi <rl@hellgate.ch>
To: Jeff Garzik <jgarzik@pobox.com>, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, netdev@hellgate.ch
Subject: [1/4][PATCH 2.6] via-rhine: Fix force media
Message-ID: <20040523104859.GA10091@k3.hellgate.ch>
Mail-Followup-To: Jeff Garzik <jgarzik@pobox.com>,
	Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org,
	netdev@hellgate.ch
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="envbJBWh7q8WU6mo"
Content-Disposition: inline
In-Reply-To: <20040523104650.GA9979@k3.hellgate.ch>
X-Operating-System: Linux 2.6.6 on i686
X-GPG-Fingerprint: 92 F4 DC 20 57 46 7B 95  24 4E 9E E7 5A 54 DC 1B
X-GPG: 1024/80E744BD wwwkeys.ch.pgp.net
User-Agent: Mutt/1.5.6i
X-MIMEDefang-Filter: osdl$Revision: 1.62 $
X-Scanned-By: MIMEDefang 2.36
X-Spam-Status: No, hits=-4.9 required=1.0 tests=BAYES_00 autolearn=ham 
	version=2.60
X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on bix
X-Spam-Level: 


--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Lucas Nussbaum and Dirk Koeppen each found independently that the code
for forcing media options in via-rhine is borked and suggested the fix
below. I've been sitting on this way too long because there is more
badness in the immediate vicinity which needs a bigger surgery.

The second hunk fixes a braino I managed to introduce myself.

--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="via-rhine-2.6.6-1-fix.diff"

--- linux-2.6.6/drivers/net/via-rhine.c	2004-05-20 16:17:38.228468522 +0200
+++ linux-2.6.6-patch/drivers/net/via-rhine.c	2004-05-20 17:46:34.466916644 +0200
@@ -860,7 +860,7 @@
 		if (option & 0x220)
 			np->mii_if.full_duplex = 1;
 		np->default_port = option & 0x3ff;
-		if (np->default_port & 0x330) {
+		if (option & 0x330) {
 			/* FIXME: shouldn't someone check this variable? */
 			/* np->medialock = 1; */
 			printk(KERN_INFO "  Forcing %dMbs %s-duplex operation.\n",
@@ -1683,8 +1683,9 @@
 			printk(KERN_INFO "%s: Tx descriptor write-back race.\n",
 				   dev->name);
 	}
-	if ((intr_status & IntrTxError) && ~( IntrTxAborted | IntrTxUnderrun |
-										   IntrTxDescRace )) {
+	if ((intr_status & IntrTxError) &&
+			(intr_status & ( IntrTxAborted |
+			IntrTxUnderrun | IntrTxDescRace )) == 0) {
 		if (np->tx_thresh < 0xE0) {
 			writeb(np->tx_thresh += 0x20, ioaddr + TxConfig);
 		}

--envbJBWh7q8WU6mo--
