/* lasi_82596.c -- driver for the intel 82596 ethernet controller, as
munged into HPPA boxen .
This driver is based upon 82596.c, original credits are below...
but there were too many hoops which HP wants jumped through to
keep this code in there in a sane manner.
3 primary sources of the mess --
1) hppa needs *lots* of cacheline flushing to keep this kind of
MMIO running.
2) The 82596 needs to see all of its pointers as their physical
address. Thus virt_to_bus/bus_to_virt are *everywhere*.
3) The implementation HP is using seems to be significantly pickier
about when and how the command and RX units are started. some
command ordering was changed.
Examination of the mach driver leads one to believe that there
might be a saner way to pull this off... anyone who feels like a
full rewrite can be my guest.
Split 02/13/2000 Sam Creasey (sammy@oh.verio.com)
02/01/2000 Initial modifications for parisc by Helge Deller (deller@gmx.de)
03/02/2000 changes for better/correct(?) cache-flushing (deller)
*/
/* 82596.c: A generic 82596 ethernet driver for linux. */
/*
Based on Apricot.c
Written 1994 by Mark Evans.
This driver is for the Apricot 82596 bus-master interface
Modularised 12/94 Mark Evans
Modified to support the 82596 ethernet chips on 680x0 VME boards.
by Richard Hirst <richard@sleepie.demon.co.uk>
Renamed to be 82596.c
980825: Changed to receive directly in to sk_buffs which are
allocated at open() time. Eliminates copy on incoming frames
(small ones are still copied). Shared data now held in a
non-cached page, so we can run on 68060 in copyback mode.
TBD:
* look at deferring rx frames rather than discarding (as per tulip)
* handle tx ring full as per tulip
* performace test to tune rx_copybreak
Most of my modifications relate to the braindead big-endian
implementation by Intel. When the i596 is operating in
'big-endian' mode, it thinks a 32 bit value of 0x12345678
should be stored as 0x56781234. This is a real pain, when
you have linked lists which are shared by the 680x0 and the
i596.
Driver skeleton
Written 1993 by Donald Becker.
Copyright 1993 United States Government as represented by the Director,
National Security Agency. This software may only be used and distributed
according to the terms of the GNU General Public License as modified by SRC,
incorporated herein by reference.
The author may be reached as becker@scyld.com, or C/O
Scyld Computing Corporation, 410 Severn Ave., Suite 210, Annapolis MD 21403
*/
#include <linux/module.h>
#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/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/irq.h>
/* DEBUG flags
*/
#define DEB_INIT 0x0001
#define DEB_PROBE 0x0002
#define DEB_SERIOUS 0x0004
#define DEB_ERRORS 0x0008
#define DEB_MULTI 0x0010
#define DEB_TDR 0x0020
#define DEB_OPEN 0x0040
#define DEB_RESET 0x0080
#define DEB_ADDCMD 0x0100
#define DEB_STATUS 0x0200
#define DEB_STARTTX 0x0400
#define DEB_RXADDR 0x0800
#define DEB_TXADDR 0x1000
#define DEB_RXFRAME 0x2000
#define DEB_INTS 0x4000
#define DEB_STRUCT 0x8000
#define DEB_ANY 0xffff
#define DEB(x, y) if (i596_debug & (x)) { y; }
/*
* The MPU_PORT command allows direct access to the 82596. With PORT access
* the following commands are available (p5-18). The 32-bit port command
* must be word-swapped with the most significant word written first.
* This only applies to VME boards.
*/
#define PORT_RESET 0x00 /* reset 82596 */
#define PORT_SELFTEST 0x01 /* selftest */
#define PORT_ALTSCP 0x02 /* alternate SCB address */
#define PORT_ALTDUMP 0x03 /* Alternate DUMP address */
static int i596_debug = (DEB_SERIOUS|DEB_PROBE);
/* Copy frames shorter than rx_copybr