[tulip-bug] MX98715: small bug and fix for tulip version 0.92

Andrew D. Balsa andrewbalsa@dll.com.hk
Wed, 1 Nov 2000 13:13:31 +0800


Dear Donald,

There is a small but quite annoying bug lurking in the Linux tulip driver
(all version up to 0.921, AFAIK), when it is used with the Macronix MX98715
based NICs.

The Datasheet and the Application Note for the MX98715AEC-E (latest version
of the MX98715 chip) indicate that two bits have to be set by the driver to
enable autocompensation in the transceiver circuit. Quoting the Datasheet:
"...to improve quality & yield when long cable is used."

When I tested these NICs at the lab, everything seemed to work fine. I was
using 3 meter cables and running the NICs full-duplex 100BaseTx.

As soon as I moved a machine with this NIC to a production environment, I
got a large number of RX errors:

        [andrew@fw /sbin]$ ./ifconfig | more
        eth0    ...
                  ...
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                  RX packets:4546931 errors:16105 dropped:0 overruns:0
frame:16105
                  TX packets:2375026 errors:0 dropped:0 overruns:0 carrier:0
                  collisions:0 txqueuelen:100
                  Interrupt:4 Base address:0x7000

16105 errors receiving packets from the network!!!
The machine was connected to a switch, full-duplex 100BaseTx, through a 35
meter cable...

It took me two days to find out the problem was in the NIC initialization...
:-(
I made two small changes to your driver, recompiled, and this solved the
problem.

The changes are: defined CSR20 (equal to 0xA0), as shown below:

/* Offsets to the Command and Status Registers, "CSRs".  All accesses
   must be longword instructions and quadword aligned. */
enum tulip_offsets {
        CSR0=0,    CSR1=0x08, CSR2=0x10, CSR3=0x18, CSR4=0x20, CSR5=0x28,
        CSR6=0x30, CSR7=0x38, CSR8=0x40, CSR9=0x48, CSR10=0x50, CSR11=0x58,
        CSR12=0x60, CSR13=0x68, CSR14=0x70, CSR15=0x78, CSR20=0xA0 };

In the 98715 initialization , added a line to set the correct bits in CSR20
to enable autocompensation, as shown below:

        case MX98715: case MX98725:
                outl(0x01a80000, ioaddr + CSR6);
                outl(0xFFFFFFFF, ioaddr + CSR14);
                outl(0x00001000, ioaddr + CSR12);
/* ADB 27/09/2000 : set LEDs control bits */
                outl(inl(ioaddr + CSR9) | 0x30000000, ioaddr + CSR9);
/* end */
/* ADB 01/11/2000 : enable auto-compensation circuit in transceiver */
                outl(inl(ioaddr + CSR20) | 0x00004200, ioaddr + CSR20);
/* end */
                break;

The line related to the LEDs fixes a small aesthetic bug in the driver, for
my particular NIC (Buffalo brand).

Would you mind including these minute patches in your next release of the
driver?

Thank you in advance,
--
Andrew Derrick Balsa
Director
Dragon Linux Laboratories Ltd. (Hong Kong)
http://www.dll.com.hk