Received: with ECARTIS (v1.0.0; list netdev); Tue, 15 Feb 2005 13:00:33 -0800 (PST) Received: from spiess2.norand.com (spiess2.norand.com [136.179.85.112]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id j1FL0Sp1026320 for ; Tue, 15 Feb 2005 13:00:28 -0800 Received: from [136.179.85.111] (spiess.norand.com [136.179.85.111]) by spiess2.norand.com (8.12.10/8.12.10) with ESMTP id j1FLT6Th024785; Tue, 15 Feb 2005 15:29:06 -0600 Message-ID: <421262DF.9050503@Intermec.com> Date: Tue, 15 Feb 2005 15:00:15 -0600 From: Gary Spiess User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: netdev@oss.sgi.com CC: Manfred Spraul , Jeff Garzik Subject: Re: [PATCH] natsemi long cable fix References: <421129DE.4070101@Intermec.com> In-Reply-To: <421129DE.4070101@Intermec.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 0.81, clamav-milter version 0.81b on oss.sgi.com X-Virus-Status: Clean X-archive-position: 1655 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: Gary.Spiess@Intermec.com Precedence: bulk X-list: netdev Content-Length: 1898 Lines: 39 This is a minor modification to the previous patch submission that does not assume the default contents of the DSPCFG register are zero. When used with Revision D of the DP83815, the "Recommended Registers Configuration" from page 78 of the DP83815 data sheet is not entirely compatible with the driver's "short cable patch". When the DSPCFG register is written with the value suggested in the document, then do_cable_magic() can't read the DSP coefficient and determines that all cables attached to the DP83815D are 'short', regardless of actual length. Short cables (< 30m) cause do_cable_magic to enable additional attenuation to reduce CRC and idle errors. If the extra attenuation is unintentionally enabled for long cables (> 50m?), they will not operate properly. The National Semiconductor driver, 'dp83815.c' from http://www.national.com/appinfo/networks/files/linux_2_4.tar.gz was used as a basis for this modification. This patch applies to the driver distributed in linux-2.6.10. --- linux-2.6.10.orig/drivers/net/natsemi.c 2004-12-24 15:33:50.000000000 -0600 +++ linux-2.6.10/drivers/net/natsemi.c 2005-02-14 16:45:46.000000000 -0600 @@ -441,6 +441,7 @@ #define DSPCFG_VAL 0x5040 #define SDCFG_VAL 0x008c /* set voltage thresholds for Signal Detect */ #define DSPCFG_LOCK 0x20 /* coefficient lock bit in DSPCFG */ +#define DSPCFG_COEF 0x1000 /* see coefficient (in TSTDAT) bit in DSPCFG */ #define TSTDAT_FIXED 0xe8 /* magic number for bad coefficients */ /* misc PCI space registers */ @@ -1243,7 +1244,8 @@ writew(1, ioaddr + PGSEL); writew(PMDCSR_VAL, ioaddr + PMDCSR); writew(TSTDAT_VAL, ioaddr + TSTDAT); - np->dspcfg = DSPCFG_VAL; + np->dspcfg = (np->srr <= SRR_DP83815_C)? + DSPCFG_VAL : (DSPCFG_COEF | readw(ioaddr + DSPCFG)); writew(np->dspcfg, ioaddr + DSPCFG); writew(SDCFG_VAL, ioaddr + SDCFG); writew(0, ioaddr + PGSEL);