/*
net-3-driver for the 3c523 Etherlink/MC card (i82586 Ethernet chip)
This is an extension to the Linux operating system, and is covered by the
same GNU General Public License that covers that work.
Copyright 1995, 1996 by Chris Beauregard (cpbeaure@undergrad.math.uwaterloo.ca)
This is basically Michael Hipp's ni52 driver, with a new probing
algorithm and some minor changes to the 82586 CA and reset routines.
Thanks a lot Michael for a really clean i82586 implementation! Unless
otherwise documented in ni52.c, any bugs are mine.
Contrary to the Ethernet-HOWTO, this isn't based on the 3c507 driver in
any way. The ni52 is a lot easier to modify.
sources:
ni52.c
Crynwr packet driver collection was a great reference for my first
attempt at this sucker. The 3c507 driver also helped, until I noticed
that ni52.c was a lot nicer.
EtherLink/MC: Micro Channel Ethernet Adapter Technical Reference
Manual, courtesy of 3Com CardFacts, documents the 3c523-specific
stuff. Information on CardFacts is found in the Ethernet HOWTO.
Also see <a href="http://www.3com.com/">
Microprocessor Communications Support Chips, T.J. Byers, ISBN
0-444-01224-9, has a section on the i82586. It tells you just enough
to know that you really don't want to learn how to program the chip.
The original device probe code was stolen from ps2esdi.c
Known Problems:
Since most of the code was stolen from ni52.c, you'll run across the
same bugs in the 0.62 version of ni52.c, plus maybe a few because of
the 3c523 idiosynchacies. The 3c523 has 16K of RAM though, so there
shouldn't be the overrun problem that the 8K ni52 has.
This driver is for a 16K adapter. It should work fine on the 64K
adapters, but it will only use one of the 4 banks of RAM. Modifying
this for the 64K version would require a lot of heinous bank
switching, which I'm sure not interested in doing. If you try to
implement a bank switching version, you'll basically have to remember
what bank is enabled and do a switch everytime you access a memory
location that's not current. You'll also have to remap pointers on
the driver side, because it only knows about 16K of the memory.
Anyone desperate or masochistic enough to try?
It seems to be stable now when multiple transmit buffers are used. I
can't see any performance difference, but then I'm working on a 386SX.
Multicast doesn't work. It doesn't even pretend to work. Don't use
it. Don't compile your kernel with multicast support. I don't know
why.
Features:
This driver is useable as a loadable module. If you try to specify an
IRQ or a IO address (via insmod 3c523.o irq=xx io=0xyyy), it will
search the MCA slots until it finds a 3c523 with the specified
parameters.
This driver does support multiple ethernet cards when used as a module
(up to MAX_3C523_CARDS, the default being 4)
This has been tested with both BNC and TP versions, internal and
external transceivers. Haven't tested with the 64K version (that I
know of).
History:
Jan 1st, 1996
first public release
Feb 4th, 1996
update to 1.3.59, incorporated multicast diffs from ni52.c
Feb 15th, 1996
added shared irq support
Apr 1999
added support for multiple cards when used as a module
added option to disable multicast as is causes problems
Ganesh Sittampalam <ganesh.sittampalam@magdalen.oxford.ac.uk>
Stuart Adamson <stuart.adamson@compsoc.net>
Nov 2001
added support for ethtool (jgarzik)
$Header: /fsys2/home/chrisb/linux-1.3.59-MCA/drivers/net/RCS/3c523.c,v 1.1 1996/02/05 01:53:46 chrisb Exp chrisb $
*/
#define DRV_NAME "3c523"
#define DRV_VERSION "17-Nov-2001"
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/mca-legacy.h>
#include <linux/ethtool.h>
#include <linux/bitops.h>
#include <linux/jiffies.h>
#include <asm/uaccess.h>
#include <asm/processor.h>
#include <asm/io.h>
#include "3c523.h"
/*************************************************************************/
#define DEBUG /* debug on */
#define SYSBUSVAL 0 /* 1 = 8 Bit, 0 = 16 bit - 3c523 only does 16 bit */
#undef ELMC_MULTICAST /* Disable multicast support as it is somewhat seriously broken at the moment */
#define make32(ptr16) (p->memtop + (short) (ptr16) )
#define make24(ptr32) ((char *) (ptr32) - p->base)
#define make16(ptr32) ((unsigned short) ((unsigned long) (ptr32) - (unsigned long) p->memtop ))
/*************************************************************************/
/*
Tables to which we can map values in the configuration registers.
*/
static int irq_table[] __initdata = {
12, 7, 3, 9
};
static int csr_table[] __initdata = {
0x300, 0x1300, 0x2300, 0x3300
};
static int shm_table[] __initdata = {
0x0c0000, 0x0c8000, 0x0d0000, 0x0d8000
};
/******************* how to calculate the buffers *****************************
* IMPORTANT NOTE: if you configure only one NUM_XMIT_BUFFS, the driver works
* --------------- in a different (more stable?) mode. Only in this mode it's
* possible to configure the driver with 'NO_NOPCOMMANDS'
sizeof(scp)=12; sizeof(scb)=16; sizeof(iscp)=8;
sizeof(scp)+sizeof(iscp)+sizeof(scb) = 36 = INIT
sizeof(rfd) = 24; sizeof(rbd) = 12;
sizeof(tbd) = 8; sizeof(transmit_cmd) = 16;
sizeof(nop_cmd) = 8;
* if you don't know the driver, better do not change this values: */
#define RECV_BUFF_SIZE 1524 /* slightly oversized */
#define XMIT_BUFF_SIZE 1524 /* slightly oversized */
#define NUM_XMIT_BUFFS 1 /* config for both, 8K and 16K shmem */
#define NUM_RECV_BUFFS_8 4 /* config for 8K shared mem */