/*
net-3-driver for the SKNET MCA-based cards
This is an extension to the Linux operating system, and is covered by the
same GNU General Public License that covers that work.
Copyright 1999 by Alfred Arnold (alfred@ccac.rwth-aachen.de,
alfred.arnold@lancom.de)
This driver is based both on the 3C523 driver and the SK_G16 driver.
paper sources:
'PC Hardware: Aufbau, Funktionsweise, Programmierung' by
Hans-Peter Messmer for the basic Microchannel stuff
'Linux Geraetetreiber' by Allesandro Rubini, Kalle Dalheimer
for help on Ethernet driver programming
'Ethernet/IEEE 802.3 Family 1992 World Network Data Book/Handbook' by AMD
for documentation on the AM7990 LANCE
'SKNET Personal Technisches Manual', Version 1.2 by Schneider&Koch
for documentation on the Junior board
'SK-NET MC2+ Technical Manual", Version 1.1 by Schneider&Koch for
documentation on the MC2 bord
A big thank you to the S&K support for providing me so quickly with
documentation!
Also see http://www.syskonnect.com/
Missing things:
-> set debug level via ioctl instead of compile-time switches
-> I didn't follow the development of the 2.1.x kernels, so my
assumptions about which things changed with which kernel version
are probably nonsense
History:
May 16th, 1999
startup
May 22st, 1999
added private structure, methods
begun building data structures in RAM
May 23nd, 1999
can receive frames, send frames
May 24th, 1999
modularized initialization of LANCE
loadable as module
still Tx problem :-(
May 26th, 1999
MC2 works
support for multiple devices
display media type for MC2+
May 28th, 1999
fixed problem in GetLANCE leaving interrupts turned off
increase TX queue to 4 packets to improve send performance
May 29th, 1999
a few corrections in statistics, caught rcvr overruns
reinitialization of LANCE/board in critical situations
MCA info implemented
implemented LANCE multicast filter
Jun 6th, 1999
additions for Linux 2.2
Dec 25th, 1999
unfortunately there seem to be newer MC2+ boards that react
on IRQ 3/5/9/10 instead of 3/5/10/11, so we have to autoprobe
in questionable cases...
Dec 28th, 1999
integrated patches from David Weinehall & Bill Wendling for 2.3
kernels (isa_...functions). Things are defined in a way that
it still works with 2.0.x 8-)
Dec 30th, 1999
added handling of the remaining interrupt conditions. That
should cure the spurious hangs.
Jan 30th, 2000
newer kernels automatically probe more than one board, so the
'startslot' as a variable is also needed here
June 1st, 2000
added changes for recent 2.3 kernels
*************************************************************************/
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/time.h>
#include <linux/mca-legacy.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/bitops.h>
#include <asm/processor.h>
#include <asm/io.h>
#define _SK_MCA_DRIVER_
#include "sk_mca.h"
/* ------------------------------------------------------------------------
* global static data - not more since we can handle multiple boards and
* have to pack all state info into the device struct!
* ------------------------------------------------------------------------ */
static char *MediaNames[Media_Count] =
{ "10Base2", "10BaseT", "10Base5", "Unknown" };
static unsigned char poly[] =
{ 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0,
1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0
};
/* ------------------------------------------------------------------------
* private subfunctions
* ------------------------------------------------------------------------ */
/* dump parts of shared memory - only needed during debugging */
#ifdef DEBUG
static void dumpmem(struct net_device *dev, u32 start, u32 len)
{
skmca_priv *priv = netdev_priv(dev);
int z;
for (z = 0; z < len; z++) {
if ((z & 15) == 0)
printk("%04x:", z);
printk(" %02x", readb(priv->base + start + z));
if ((z & 15) == 15)
printk("\n");
}
}
/* print exact time - ditto */
static void PrTime(void)
{
struct timeval tv;
do_gettimeofday(&tv);
printk("%9d:%06d: ", tv.tv_sec, tv.tv_usec);
}
#endif
/* deduce resources out of POS registers */
static void __