/* depca.c: A DIGITAL DEPCA & EtherWORKS ethernet driver for linux. Written 1994, 1995 by David C. Davies. Copyright 1994 David C. Davies and United States Government (as represented by the Director, National Security Agency). Copyright 1995 Digital Equipment Corporation. This software may be used and distributed according to the terms of the GNU General Public License, incorporated herein by reference. This driver is written for the Digital Equipment Corporation series of DEPCA and EtherWORKS ethernet cards: DEPCA (the original) DE100 DE101 DE200 Turbo DE201 Turbo DE202 Turbo (TP BNC) DE210 DE422 (EISA) The driver has been tested on DE100, DE200 and DE202 cards in a relatively busy network. The DE422 has been tested a little. This driver will NOT work for the DE203, DE204 and DE205 series of cards, since they have a new custom ASIC in place of the AMD LANCE chip. See the 'ewrk3.c' driver in the Linux source tree for running those cards. I have benchmarked the driver with a DE100 at 595kB/s to (542kB/s from) a DECstation 5000/200. The author may be reached at davies@maniac.ultranet.com ========================================================================= The driver was originally based on the 'lance.c' driver from Donald Becker which is included with the standard driver distribution for linux. V0.4 is a complete re-write with only the kernel interface remaining from the original code. 1) Lance.c code in /linux/drivers/net/ 2) "Ethernet/IEEE 802.3 Family. 1992 World Network Data Book/Handbook", AMD, 1992 [(800) 222-9323]. 3) "Am79C90 CMOS Local Area Network Controller for Ethernet (C-LANCE)", AMD, Pub. #17881, May 1993. 4) "Am79C960 PCnet-ISA(tm), Single-Chip Ethernet Controller for ISA", AMD, Pub. #16907, May 1992 5) "DEC EtherWORKS LC Ethernet Controller Owners Manual", Digital Equipment corporation, 1990, Pub. #EK-DE100-OM.003 6) "DEC EtherWORKS Turbo Ethernet Controller Owners Manual", Digital Equipment corporation, 1990, Pub. #EK-DE200-OM.003 7) "DEPCA Hardware Reference Manual", Pub. #EK-DEPCA-PR Digital Equipment Corporation, 1989 8) "DEC EtherWORKS Turbo_(TP BNC) Ethernet Controller Owners Manual", Digital Equipment corporation, 1991, Pub. #EK-DE202-OM.001 Peter Bauer's depca.c (V0.5) was referred to when debugging V0.1 of this driver. The original DEPCA card requires that the ethernet ROM address counter be enabled to count and has an 8 bit NICSR. The ROM counter enabling is only done when a 0x08 is read as the first address octet (to minimise the chances of writing over some other hardware's I/O register). The NICSR accesses have been changed to byte accesses for all the cards supported by this driver, since there is only one useful bit in the MSB (remote boot timeout) and it is not used. Also, there is a maximum of only 48kB network RAM for this card. My thanks to Torbjorn Lindh for help debugging all this (and holding my feet to the fire until I got it right). The DE200 series boards have on-board 64kB RAM for use as a shared memory network buffer. Only the DE100 cards make use of a 2kB buffer mode which has not been implemented in this driver (only the 32kB and 64kB modes are supported [16kB/48kB for the original DEPCA]). At the most only 2 DEPCA cards can be supported on the ISA bus because there is only provision for two I/O base addresses on each card (0x300 and 0x200). The I/O address is detected by searching for a byte sequence in the Ethernet station address PROM at the expected I/O address for the Ethernet PROM. The shared memory base address is 'autoprobed' by looking for the self test PROM and detecting the card name. When a second DEPCA is detected, information is placed in the base_addr variable of the next device structure (which is created if necessary), thus enabling ethif_probe initialization for the device. More than 2 EISA cards can be supported, but care will be needed assigning the shared memory to ensure that each slot has the correct IRQ, I/O address and shared memory address assigned. ************************************************************************ NOTE: If you are using two ISA DEPCAs, it is important that you assign the base memory addresses correctly. The driver autoprobes I/O 0x300 then 0x200. The base memory address for the first device must be less than that of the second so that the auto probe will correctly assign the I/O and memory addresses on the same card. I can't think of a way to do this unambiguously at the moment, since there is nothing on the cards to tie I/O and memory information together. I am unable to test 2 cards together for now, so this code is unchecked. All reports, good or bad, are welcome. ************************************************************************ The board IRQ setting must be at an unused IRQ which is auto-probed using Donald Becker's autoprobe routines. DEPCA and DE100 board IRQs are {2,3,4,5,7}, whereas the DE200 is at {5,9,10,11,15}. Note that IRQ2 is really IRQ9 in machines with 16 IRQ lines. No 16MB memory limitation should exist with this driver as DMA is not used and the common memory area is in low memory on the network card (my current system has 20MB and I've not had problems yet). The ability to load this driver as a loadable module has been added. To utilise this ability, you have to do <8 things: 0) have a copy of the loadable modules code installed on your system. 1) copy depca.c from the /linux/drivers/net directory to your favourite temporary directory. 2) if you wish, edit the source code near line 1530 to reflect the I/O address and IRQ you're using (see also 5). 3) compile depca.c, but include -DMODULE in the command line to ensure that the correct bits are compiled (see end of source code). 4) if you are wanting to add a new card, goto 5. Otherwise, recompile a kernel with the depca configuration turned off and reboot. 5) insmod depca.o [irq=7] [io=0x200] [mem=0xd0000] [adapter_name=DE100] [Alan Cox: Changed the code to allow command line irq/io assignments] [Dave Davies: Changed the code to allow command line mem/name assignments] 6) run the net startup bits for your eth?? interface manually (usually /etc/rc.inet[12] at boot time). 7) enjoy! Note that autoprobing is not allowed in loadable modules - the system is already up and running and you're messing with interrupts. To unload a module, turn off the associated interface 'ifconfig eth?? down' then 'rmmod depca'. To assign a base memory address for the shared memory when running as a loadable module, see 5 above. To include the adapter name (if you have no PROM but know the card name) also see