aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/tulip
diff options
context:
space:
mode:
authorJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-05-20 07:15:19 -0700
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-08-12 00:21:25 -0700
commita88394cfb58007cca945699545469017beb0d206 (patch)
tree7efa1efcaf18d1b8f7bede1f25acdfc0c657c086 /drivers/net/tulip
parent5ff2241dd42ade03572753f9ed7743719b47c474 (diff)
ewrk3/tulip: Move the DEC - Tulip drivers
Move the DEC - Tulip driver into drivers/net/ethernet/dec/tulip/ and make the necessary Kconfig and Makefile changes. The Digital Equioment (DEC) driver ewrk3 was moved into drivers/net/ethernet/dec/ and the remaining drivers (Tulip) were moved into drivers/net/ethernet/dec/tulip/ CC: Tobias Ringstrom <tori@unhappy.mine.nu> CC: Grant Grundler <grundler@parisc-linux.org> CC: David Davies <davies@maniac.ultranet.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Acked-by: Grant Grundler <grundler@parisc-linux.org>
Diffstat (limited to 'drivers/net/tulip')
-rw-r--r--drivers/net/tulip/21142.c260
-rw-r--r--drivers/net/tulip/Kconfig171
-rw-r--r--drivers/net/tulip/Makefile19
-rw-r--r--drivers/net/tulip/de2104x.c2215
-rw-r--r--drivers/net/tulip/de4x5.c5599
-rw-r--r--drivers/net/tulip/de4x5.h1019
-rw-r--r--drivers/net/tulip/dmfe.c2253
-rw-r--r--drivers/net/tulip/eeprom.c385
-rw-r--r--drivers/net/tulip/interrupt.c811
-rw-r--r--drivers/net/tulip/media.c556
-rw-r--r--drivers/net/tulip/pnic.c173
-rw-r--r--drivers/net/tulip/pnic2.c406
-rw-r--r--drivers/net/tulip/timer.c179
-rw-r--r--drivers/net/tulip/tulip.h573
-rw-r--r--drivers/net/tulip/tulip_core.c2011
-rw-r--r--drivers/net/tulip/uli526x.c1850
-rw-r--r--drivers/net/tulip/winbond-840.c1670
-rw-r--r--drivers/net/tulip/xircom_cb.c1154
18 files changed, 0 insertions, 21304 deletions
diff --git a/drivers/net/tulip/21142.c b/drivers/net/tulip/21142.c
deleted file mode 100644
index 092c3faa882..00000000000
--- a/drivers/net/tulip/21142.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- drivers/net/tulip/21142.c
-
- Copyright 2000,2001 The Linux Kernel Team
- Written/copyright 1994-2001 by Donald Becker.
-
- This software may be used and distributed according to the terms
- of the GNU General Public License, incorporated herein by reference.
-
- Please refer to Documentation/DocBook/tulip-user.{pdf,ps,html}
- for more information on this driver.
-
- DC21143 manual "21143 PCI/CardBus 10/100Mb/s Ethernet LAN Controller
- Hardware Reference Manual" is currently available at :
- http://developer.intel.com/design/network/manuals/278074.htm
-
- Please submit bugs to http://bugzilla.kernel.org/ .
-*/
-
-#include <linux/delay.h>
-#include "tulip.h"
-
-
-static u16 t21142_csr13[] = { 0x0001, 0x0009, 0x0009, 0x0000, 0x0001, };
-u16 t21142_csr14[] = { 0xFFFF, 0x0705, 0x0705, 0x0000, 0x7F3D, };
-static u16 t21142_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
-
-
-/* Handle the 21143 uniquely: do autoselect with NWay, not the EEPROM list
- of available transceivers. */
-void t21142_media_task(struct work_struct *work)
-{
- struct tulip_private *tp =
- container_of(work, struct tulip_private, media_work);
- struct net_device *dev = tp->dev;
- void __iomem *ioaddr = tp->base_addr;
- int csr12 = ioread32(ioaddr + CSR12);
- int next_tick = 60*HZ;
- int new_csr6 = 0;
- int csr14 = ioread32(ioaddr + CSR14);
-
- /* CSR12[LS10,LS100] are not reliable during autonegotiation */
- if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000)
- csr12 |= 6;
- if (tulip_debug > 2)
- dev_info(&dev->dev, "21143 negotiation status %08x, %s\n",
- csr12, medianame[dev->if_port]);
- if (tulip_media_cap[dev->if_port] & MediaIsMII) {
- if (tulip_check_duplex(dev) < 0) {
- netif_carrier_off(dev);
- next_tick = 3*HZ;
- } else {
- netif_carrier_on(dev);
- next_tick = 60*HZ;
- }
- } else if (tp->nwayset) {
- /* Don't screw up a negotiated session! */
- if (tulip_debug > 1)
- dev_info(&dev->dev,
- "Using NWay-set %s media, csr12 %08x\n",
- medianame[dev->if_port], csr12);
- } else if (tp->medialock) {
- ;
- } else if (dev->if_port == 3) {
- if (csr12 & 2) { /* No 100mbps link beat, revert to 10mbps. */
- if (tulip_debug > 1)
- dev_info(&dev->dev,
- "No 21143 100baseTx link beat, %08x, trying NWay\n",
- csr12);
- t21142_start_nway(dev);
- next_tick = 3*HZ;
- }
- } else if ((csr12 & 0x7000) != 0x5000) {
- /* Negotiation failed. Search media types. */
- if (tulip_debug > 1)
- dev_info(&dev->dev,
- "21143 negotiation failed, status %08x\n",
- csr12);
- if (!(csr12 & 4)) { /* 10mbps link beat good. */
- new_csr6 = 0x82420000;
- dev->if_port = 0;
- iowrite32(0, ioaddr + CSR13);
- iowrite32(0x0003FFFF, ioaddr + CSR14);
- iowrite16(t21142_csr15[dev->if_port], ioaddr + CSR15);
- iowrite32(t21142_csr13[dev->if_port], ioaddr + CSR13);
- } else {
- /* Select 100mbps port to check for link beat. */
- new_csr6 = 0x83860000;
- dev->if_port = 3;
- iowrite32(0, ioaddr + CSR13);
- iowrite32(0x0003FFFF, ioaddr + CSR14);
- iowrite16(8, ioaddr + CSR15);
- iowrite32(1, ioaddr + CSR13);
- }
- if (tulip_debug > 1)
- dev_info(&dev->dev, "Testing new 21143 media %s\n",
- medianame[dev->if_port]);
- if (new_csr6 != (tp->csr6 & ~0x00D5)) {
- tp->csr6 &= 0x00D5;
- tp->csr6 |= new_csr6;
- iowrite32(0x0301, ioaddr + CSR12);
- tulip_restart_rxtx(tp);
- }
- next_tick = 3*HZ;
- }
-
- /* mod_timer synchronizes us with potential add_timer calls
- * from interrupts.
- */
- mod_timer(&tp->timer, RUN_AT(next_tick));
-}
-
-
-void t21142_start_nway(struct net_device *dev)
-{
- struct tulip_private *tp = netdev_priv(dev);
- void __iomem *ioaddr = tp->base_addr;
- int csr14 = ((tp->sym_advertise & 0x0780) << 9) |
- ((tp->sym_advertise & 0x0020) << 1) | 0xffbf;
-
- dev->if_port = 0;
- tp->nway = tp->mediasense = 1;
- tp->nwayset = tp->lpar = 0;
- if (tulip_debug > 1)
- netdev_dbg(dev, "Restarting 21143 autonegotiation, csr14=%08x\n",
- csr14);
- iowrite32(0x0001, ioaddr + CSR13);
- udelay(100);
- iowrite32(csr14, ioaddr + CSR14);
- tp->csr6 = 0x82420000 | (tp->sym_advertise & 0x0040 ? FullDuplex : 0);
- iowrite32(tp->csr6, ioaddr + CSR6);
- if (tp->mtable && tp->mtable->csr15dir) {
- iowrite32(tp->mtable->csr15dir, ioaddr + CSR15);
- iowrite32(tp->mtable->csr15val, ioaddr + CSR15);
- } else
- iowrite16(0x0008, ioaddr + CSR15);
- iowrite32(0x1301, ioaddr + CSR12); /* Trigger NWAY. */
-}
-
-
-
-void t21142_lnk_change(struct net_device *dev, int csr5)
-{
- struct tulip_private *tp = netdev_priv(dev);
- void __iomem *ioaddr = tp->base_addr;
- int csr12 = ioread32(ioaddr + CSR12);
- int csr14 = ioread32(ioaddr + CSR14);
-
- /* CSR12[LS10,LS100] are not reliable during autonegotiation */
- if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000)
- csr12 |= 6;
- if (tulip_debug > 1)
- dev_info(&dev->dev,
- "21143 link status interrupt %08x, CSR5 %x, %08x\n",
- csr12, csr5, csr14);
-
- /* If NWay finished and we have a negotiated partner capability. */
- if (tp->nway && !tp->nwayset && (csr12 & 0x7000) == 0x5000) {
- int setup_done = 0;
- int negotiated = tp->sym_advertise & (csr12 >> 16);
- tp->lpar = csr12 >> 16;
- tp->nwayset = 1;
- /* If partner cannot negotiate, it is 10Mbps Half Duplex */
- if (!(csr12 & 0x8000)) dev->if_port = 0;
- else if (negotiated & 0x0100) dev->if_port = 5;
- else if (negotiated & 0x0080) dev->if_port = 3;
- else if (negotiated & 0x0040) dev->if_port = 4;
- else if (negotiated & 0x0020) dev->if_port = 0;
- else {
- tp->nwayset = 0;
- if ((csr12 & 2) == 0 && (tp->sym_advertise & 0x0180))
- dev->if_port = 3;
- }
- tp->full_duplex = (tulip_media_cap[dev->if_port] & MediaAlwaysFD) ? 1:0;
-
- if (tulip_debug > 1) {
- if (tp->nwayset)
- dev_info(&dev->dev,
- "Switching to %s based on link negotiation %04x & %04x = %04x\n",
- medianame[dev->if_port],
- tp->sym_advertise, tp->lpar,
- negotiated);
- else
- dev_info(&dev->dev,
- "Autonegotiation failed, using %s, link beat status %04x\n",
- medianame[dev->if_port], csr12);
- }
-
- if (tp->mtable) {
- int i;
- for (i = 0; i < tp->mtable->leafcount; i++)
- if (tp->mtable->mleaf[i].media == dev->if_port) {
- int startup = ! ((tp->chip_id == DC21143 && (tp->revision == 48 || tp->revision == 65)));
- tp->cur_index = i;
- tulip_select_media(dev, startup);
- setup_done = 1;
- break;
- }
- }
- if ( ! setup_done) {
- tp->csr6 = (dev->if_port & 1 ? 0x838E0000 : 0x82420000) | (tp->csr6 & 0x20ff);
- if (tp->full_duplex)
- tp->csr6 |= 0x0200;
- iowrite32(1, ioaddr + CSR13);
- }
-#if 0 /* Restart shouldn't be needed. */
- iowrite32(tp->csr6 | RxOn, ioaddr + CSR6);
- if (tulip_debug > 2)
- netdev_dbg(dev, " Restarting Tx and Rx, CSR5 is %08x\n",
- ioread32(ioaddr + CSR5));
-#endif
- tulip_start_rxtx(tp);
- if (tulip_debug > 2)
- netdev_dbg(dev, " Setting CSR6 %08x/%x CSR12 %08x\n",
- tp->csr6, ioread32(ioaddr + CSR6),
- ioread32(ioaddr + CSR12));
- } else if ((tp->nwayset && (csr5 & 0x08000000) &&
- (dev->if_port == 3 || dev->if_port == 5) &&
- (csr12 & 2) == 2) ||
- (tp->nway && (csr5 & (TPLnkFail)))) {
- /* Link blew? Maybe restart NWay. */
- del_timer_sync(&tp->timer);
- t21142_start_nway(dev);
- tp->timer.expires = RUN_AT(3*HZ);
- add_timer(&tp->timer);
- } else if (dev->if_port == 3 || dev->if_port == 5) {
- if (tulip_debug > 1)
- dev_info(&dev->dev, "21143 %s link beat %s\n",
- medianame[dev->if_port],
- (csr12 & 2) ? "failed" : "good");
- if ((csr12 & 2) && ! tp->medialock) {
- del_timer_sync(&tp->timer);
- t21142_start_nway(dev);
- tp->timer.expires = RUN_AT(3*HZ);
- add_timer(&tp->timer);
- } else if (dev->if_port == 5)
- iowrite32(csr14 & ~0x080, ioaddr + CSR14);
- } else if (dev->if_port == 0 || dev->if_port == 4) {
- if ((csr12 & 4) == 0)
- dev_info(&dev->dev, "21143 10baseT link beat good\n");
- } else if (!(csr12 & 4)) { /* 10mbps link beat good. */
- if (tulip_debug)
- dev_info(&dev->dev, "21143 10mbps sensed media\n");
- dev->if_port = 0;
- } else if (tp->nwayset) {
- if (tulip_debug)
- dev_info(&dev->dev, "21143 using NWay-set %s, csr6 %08x\n",
- medianame[dev->if_port], tp->csr6);
- } else { /* 100mbps link beat good. */
- if (tulip_debug)
- dev_info(&dev->dev, "21143 100baseTx sensed media\n");
- dev->if_port = 3;
- tp->csr6 = 0x838E0000 | (tp->csr6 & 0x20ff);
- iowrite32(0x0003FF7F, ioaddr + CSR14);
- iowrite32(0x0301, ioaddr + CSR12);
- tulip_restart_rxtx(tp);
- }
-}
-
-
diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig
deleted file mode 100644
index 1f8d4a8d8ea..00000000000
--- a/drivers/net/tulip/Kconfig
+++ /dev/null
@@ -1,171 +0,0 @@
-#
-# Tulip family network device configuration
-#
-
-menuconfig NET_TULIP
- bool "\"Tulip\" family network device support"
- depends on PCI || EISA || CARDBUS
- help
- This selects the "Tulip" family of EISA/PCI network cards.
-
-if NET_TULIP
-
-config DE2104X
- tristate "Early DECchip Tulip (dc2104x) PCI support"
- depends on PCI
- select CRC32
- ---help---
- This driver is developed for the SMC EtherPower series Ethernet
- cards and also works with cards based on the DECchip
- 21040 (Tulip series) chips. Some LinkSys PCI cards are
- of this type. (If your card is NOT SMC EtherPower 10/100 PCI
- (smc9332dst), you can also try the driver for "Generic DECchip"
- cards, below. However, most people with a network card of this type
- will say Y here.) Do read the Ethernet-HOWTO, available from
- <http://www.tldp.org/docs.html#howto>.
-
- To compile this driver as a module, choose M here. The module will
- be called de2104x.
-
-config DE2104X_DSL
- int "Descriptor Skip Length in 32 bit longwords"
- depends on DE2104X
- range 0 31
- default 0
- help
- Setting this value allows to align ring buffer descriptors into their
- own cache lines. Value of 4 corresponds to the typical 32 byte line
- (the descriptor is 16 bytes). This is necessary on systems that lack
- cache coherence, an example is PowerMac 5500. Otherwise 0 is safe.
- Default is 0, and range is 0 to 31.
-
-config TULIP
- tristate "DECchip Tulip (dc2114x) PCI support"
- depends on PCI
- select CRC32
- ---help---
- This driver is developed for the SMC EtherPower series Ethernet
- cards and also works with cards based on the DECchip
- 21140 (Tulip series) chips. Some LinkSys PCI cards are
- of this type. (If your card is NOT SMC EtherPower 10/100 PCI
- (smc9332dst), you can also try the driver for "Generic DECchip"
- cards, above. However, most people with a network card of this type
- will say Y here.) Do read the Ethernet-HOWTO, available from
- <http://www.tldp.org/docs.html#howto>.
-
- To compile this driver as a module, choose M here. The module will
- be called tulip.
-
-config TULIP_MWI
- bool "New bus configuration (EXPERIMENTAL)"
- depends on TULIP && EXPERIMENTAL
- help
- This configures your Tulip card specifically for the card and
- system cache line size type you are using.
-
- This is experimental code, not yet tested on many boards.
-
- If unsure, say N.
-
-config TULIP_MMIO
- bool "Use PCI shared mem for NIC registers"
- depends on TULIP
- help
- Use PCI shared memory for the NIC registers, rather than going through
- the Tulip's PIO (programmed I/O ports). Faster, but could produce
- obscure bugs if your mainboard has memory controller timing issues.
- If in doubt, say N.
-
-config TULIP_NAPI
- bool "Use RX polling (NAPI)"
- depends on TULIP
- help
- NAPI is a new driver API designed to reduce CPU and interrupt load
- when the driver is receiving lots of packets from the card. It is
- still somewhat experimental and thus not yet enabled by default.
-
- If your estimated Rx load is 10kpps or more, or if the card will be
- deployed on potentially unfriendly networks (e.g. in a firewall),
- then say Y here.
-
- If in doubt, say N.
-
-config TULIP_NAPI_HW_MITIGATION
- bool "Use Interrupt Mitigation"
- depends on TULIP_NAPI
- ---help---
- Use HW to reduce RX interrupts. Not strictly necessary since NAPI
- reduces RX interrupts by itself. Interrupt mitigation reduces RX
- interrupts even at low levels of traffic at the cost of a small
- latency.
-
- If in doubt, say Y.
-
-config TULIP_DM910X
- def_bool y
- depends on TULIP && SPARC
-
-config DE4X5
- tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA"
- depends on PCI || EISA
- select CRC32
- ---help---
- This is support for the DIGITAL series of PCI/EISA Ethernet cards.
- These include the DE425, DE434, DE435, DE450 and DE500 models. If
- you have a network card of this type, say Y and read the
- Ethernet-HOWTO, available from
- <http://www.tldp.org/docs.html#howto>. More specific
- information is contained in
- <file:Documentation/networking/de4x5.txt>.
-
- To compile this driver as a module, choose M here. The module will
- be called de4x5.
-
-config WINBOND_840
- tristate "Winbond W89c840 Ethernet support"
- depends on PCI
- select CRC32
- select MII
- help
- This driver is for the Winbond W89c840 chip. It also works with
- the TX9882 chip on the Compex RL100-ATX board.
- More specific information and updates are available from
- <http://www.scyld.com/network/drivers.html>.
-
-config DM9102
- tristate "Davicom DM910x/DM980x support"
- depends on PCI
- select CRC32
- ---help---
- This driver is for DM9102(A)/DM9132/DM9801 compatible PCI cards from
- Davicom (<http://www.davicom.com.tw/>). If you have such a network
- (Ethernet) card, say Y. Some information is contained in the file
- <file:Documentation/networking/dmfe.txt>.
-
- To compile this driver as a module, choose M here. The module will
- be called dmfe.
-
-config ULI526X
- tristate "ULi M526x controller support"
- depends on PCI
- select CRC32
- ---help---
- This driver is for ULi M5261/M5263 10/100M Ethernet Controller
- (<http://www.nvidia.com/page/uli_drivers.html>).
-
- To compile this driver as a module, choose M here. The module will
- be called uli526x.
-
-config PCMCIA_XIRCOM
- tristate "Xircom CardBus support"
- depends on CARDBUS
- ---help---
- This driver is for the Digital "Tulip" Ethernet CardBus adapters.
- It should work with most DEC 21*4*-based chips/ethercards, as well
- as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and
- ASIX.
-
- To compile this driver as a module, choose M here. The module will
- be called xircom_cb. If unsure, say N.
-
-endif # NET_TULIP
diff --git a/drivers/net/tulip/Makefile b/drivers/net/tulip/Makefile
deleted file mode 100644
index 5e8be38b45b..00000000000
--- a/drivers/net/tulip/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Makefile for the Linux "Tulip" family network device drivers.
-#
-
-ccflags-$(CONFIG_NET_TULIP) := -DDEBUG
-
-obj-$(CONFIG_PCMCIA_XIRCOM) += xircom_cb.o
-obj-$(CONFIG_DM9102) += dmfe.o
-obj-$(CONFIG_WINBOND_840) += winbond-840.o
-obj-$(CONFIG_DE2104X) += de2104x.o
-obj-$(CONFIG_TULIP) += tulip.o
-obj-$(CONFIG_DE4X5) += de4x5.o
-obj-$(CONFIG_ULI526X) += uli526x.o
-
-# Declare multi-part drivers.
-
-tulip-objs := eeprom.o interrupt.o media.o \
- timer.o tulip_core.o \
- 21142.o pnic.o pnic2.o
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
deleted file mode 100644
index ce90efc6ba3..00000000000
--- a/drivers/net/tulip/de2104x.c
+++ /dev/null
@@ -1,2215 +0,0 @@
-/* de2104x.c: A Linux PCI Ethernet driver for Intel/Digital 21040/1 chips. */
-/*
- Copyright 2001,2003 Jeff Garzik <jgarzik@pobox.com>
-
- Copyright 1994, 1995 Digital Equipment Corporation. [de4x5.c]
- Written/copyright 1994-2001 by Donald Becker. [tulip.c]
-
- This software may be used and distributed according to the terms of
- the GNU General Public License (GPL), incorporated herein by reference.
- Drivers based on or derived from this code fall under the GPL and must
- retain the authorship, copyright and license notice. This file is not
- a complete program and may only be used when the entire operating
- system is licensed under the GPL.
-
- See the file COPYING in this distribution for more information.
-
- TODO, in rough priority order:
- * Support forcing media type with a module parameter,
- like dl2k.c/sundance.c
- * Constants (module parms?) for Rx work limit
- * Complete reset on PciErr
- * Jumbo frames / dev->change_mtu
- * Adjust Rx FIFO threshold and Max Rx DMA burst on Rx FIFO error
- * Adjust Tx FIFO threshold and Max Tx DMA burst on Tx FIFO error
- * Implement Tx software interrupt mitigation via
- Tx descriptor bit
-
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#define DRV_NAME "de2104x"
-#define DRV_VERSION "0.7"
-#define DRV_RELDATE "Mar 17, 2004"
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/pci.h>
-#include <linux/delay.h>
-#include <linux/ethtool.h>
-#include <linux/compiler.h>
-#include <linux/rtnetlink.h>
-#include <linux/crc32.h>
-#include <linux/slab.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <asm/unaligned.h>
-
-/* These identify the driver base version and may not be removed. */
-static char version[] =
-"PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE ")";
-
-MODULE_AUTHOR("Jeff Garzik <jgarzik@pobox.com>");
-MODULE_DESCRIPTION("Intel/Digital 21040/1 series PCI Ethernet driver");
-MODULE_LICENSE("GPL");
-MODULE_VERSION(DRV_VERSION);
-
-static int debug = -1;
-module_param (debug, int, 0);
-MODULE_PARM_DESC (debug, "de2104x bitmapped message enable number");
-
-/* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */
-#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) || \
- defined(CONFIG_SPARC) || defined(__ia64__) || \
- defined(__sh__) || defined(__mips__)
-static int rx_copybreak = 1518;
-#else
-static int rx_copybreak = 100;
-#endif
-module_param (rx_copybreak, int, 0);
-MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copied");
-
-#define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \
- NETIF_MSG_PROBE | \
- NETIF_MSG_LINK | \
- NETIF_MSG_IFDOWN | \
- NETIF_MSG_IFUP | \
- NETIF_MSG_RX_ERR | \
- NETIF_MSG_TX_ERR)
-
-/* Descriptor skip length in 32 bit longwords. */
-#ifndef CONFIG_DE2104X_DSL
-#define DSL 0
-#else
-#define DSL CONFIG_DE2104X_DSL
-#endif
-
-#define DE_RX_RING_SIZE 64
-#define DE_TX_RING_SIZE 64
-#define DE_RING_BYTES \
- ((sizeof(struct de_desc) * DE_RX_RING_SIZE) + \
- (sizeof(struct de_desc) * DE_TX_RING_SIZE))
-#define NEXT_TX(N) (((N) + 1) & (DE_TX_RING_SIZE - 1))
-#define NEXT_RX(N) (((N) + 1) & (DE_RX_RING_SIZE - 1))
-#define TX_BUFFS_AVAIL(CP) \
- (((CP)->tx_tail <= (CP)->tx_head) ? \
- (CP)->tx_tail + (DE_TX_RING_SIZE - 1) - (CP)->tx_head : \
- (CP)->tx_tail - (CP)->tx_head - 1)
-
-#define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer.*/
-#define RX_OFFSET 2
-
-#define DE_SETUP_SKB ((struct sk_buff *) 1)
-#define DE_DUMMY_SKB ((struct sk_buff *) 2)
-#define DE_SETUP_FRAME_WORDS 96
-#define DE_EEPROM_WORDS 256
-#define DE_EEPROM_SIZE (DE_EEPROM_WORDS * sizeof(u16))
-#define DE_MAX_MEDIA 5
-
-#define DE_MEDIA_TP_AUTO 0
-#define DE_MEDIA_BNC 1
-#define DE_MEDIA_AUI 2
-#define DE_MEDIA_TP 3
-#define DE_MEDIA_TP_FD 4
-#define DE_MEDIA_INVALID DE_MAX_MEDIA
-#define DE_MEDIA_FIRST 0
-#define DE_MEDIA_LAST (DE_MAX_MEDIA - 1)
-#define DE_AUI_BNC (SUPPORTED_AUI | SUPPORTED_BNC)
-
-#define DE_TIMER_LINK (60 * HZ)
-#define DE_TIMER_NO_LINK (5 * HZ)
-
-#define DE_NUM_REGS 16
-#define DE_REGS_SIZE (DE_NUM_REGS * sizeof(u32))
-#define DE_REGS_VER 1
-
-/* Time in jiffies before concluding the transmitter is hung. */
-#define TX_TIMEOUT (6*HZ)
-
-/* This is a mysterious value that can be written to CSR11 in the 21040 (only)
- to support a pre-NWay full-duplex signaling mechanism using short frames.
- No one knows what it should be, but if left at its default value some
- 10base2(!) packets trigger a full-duplex-request interrupt. */
-#define FULL_DUPLEX_MAGIC 0x6969
-
-enum {
- /* NIC registers */
- BusMode = 0x00,
- TxPoll = 0x08,
- RxPoll = 0x10,
- RxRingAddr = 0x18,
- TxRingAddr = 0x20,
- MacStatus = 0x28,
- MacMode = 0x30,
- IntrMask = 0x38,
- RxMissed = 0x40,
- ROMCmd = 0x48,
- CSR11 = 0x58,
- SIAStatus = 0x60,
- CSR13 = 0x68,
- CSR14 = 0x70,
- CSR15 = 0x78,
- PCIPM = 0x40,
-
- /* BusMode bits */
- CmdReset = (1 << 0),
- CacheAlign16 = 0x00008000,
- BurstLen4 = 0x00000400,
- DescSkipLen = (DSL << 2),
-
- /* Rx/TxPoll bits */
- NormalTxPoll = (1 << 0),
- NormalRxPoll = (1 << 0),
-
- /* Tx/Rx descriptor status bits */
- DescOwn = (1 << 31),
- RxError = (1 << 15),
- RxErrLong = (1 << 7),
- RxErrCRC = (1 << 1),
- RxErrFIFO = (1 << 0),
- RxErrRunt = (1 << 11),
- RxErrFrame = (1 << 14),
- RingEnd = (1 << 25),
- FirstFrag = (1 << 29),
- LastFrag = (1 << 30),
- TxError = (1 << 15),
- TxFIFOUnder = (1 << 1),
- TxLinkFail = (1 << 2) | (1 << 10) | (1 << 11),
- TxMaxCol = (1 << 8),
- TxOWC = (1 << 9),
- TxJabber = (1 << 14),
- SetupFrame = (1 << 27),
- TxSwInt = (1 << 31),
-
- /* MacStatus bits */
- IntrOK = (1 << 16),
- IntrErr = (1 << 15),
- RxIntr = (1 << 6),
- RxEmpty = (1 << 7),
- TxIntr = (1 << 0),
- TxEmpty = (1 << 2),
- PciErr = (1 << 13),
- TxState = (1 << 22) | (1 << 21) | (1 << 20),
- RxState = (1 << 19) | (1 << 18) | (1 << 17),
- LinkFail = (1 << 12),
- LinkPass = (1 << 4),
- RxStopped = (1 << 8),
- TxStopped = (1 << 1),
-
- /* MacMode bits */
- TxEnable = (1 << 13),
- RxEnable = (1 << 1),
- RxTx = TxEnable | RxEnable,
- FullDuplex = (1 << 9),
- AcceptAllMulticast = (1 << 7),
- AcceptAllPhys = (1 << 6),
- BOCnt = (1 << 5),
- MacModeClear = (1<<12) | (1<<11) | (1<<10) | (1<<8) | (1<<3) |
- RxTx | BOCnt | AcceptAllPhys | AcceptAllMulticast,
-
- /* ROMCmd bits */
- EE_SHIFT_CLK = 0x02, /* EEPROM shift clock. */
- EE_CS = 0x01, /* EEPROM chip select. */
- EE_DATA_WRITE = 0x04, /* Data from the Tulip to EEPROM. */
- EE_WRITE_0 = 0x01,
- EE_WRITE_1 = 0x05,
- EE_DATA_READ = 0x08, /* Data from the EEPROM chip. */
- EE_ENB = (0x4800 | EE_CS),
-
- /* The EEPROM commands include the alway-set leading bit. */
- EE_READ_CMD = 6,
-
- /* RxMissed bits */
- RxMissedOver = (1 << 16),
- RxMissedMask = 0xffff,
-
- /* SROM-related bits */
- SROMC0InfoLeaf = 27,
- MediaBlockMask = 0x3f,
- MediaCustomCSRs = (1 << 6),
-
- /* PCIPM bits */
- PM_Sleep = (1 << 31),
- PM_Snooze = (1 << 30),
- PM_Mask = PM_Sleep | PM_Snooze,
-
- /* SIAStatus bits */
- NWayState = (1 << 14) | (1 << 13) | (1 << 12),
- NWayRestart = (1 << 12),
- NonselPortActive = (1 << 9),
- SelPortActive = (1 << 8),
- LinkFailStatus = (1 << 2),
- NetCxnErr = (1 << 1),
-};
-
-static const u32 de_intr_mask =
- IntrOK | IntrErr | RxIntr | RxEmpty | TxIntr | TxEmpty |
- LinkPass | LinkFail | PciErr;
-
-/*
- * Set the programmable burst length to 4 longwords for all:
- * DMA errors result without these values. Cache align 16 long.
- */
-static const u32 de_bus_mode = CacheAlign16 | BurstLen4 | DescSkipLen;
-
-struct de_srom_media_block {
- u8 opts;
- u16 csr13;
- u16 csr14;
- u16 csr15;
-} __packed;
-
-struct de_srom_info_leaf {
- u16 default_media;
- u8 n_blocks;
- u8 unused;
-} __packed;
-
-struct de_desc {
- __le32 opts1;
- __le32 opts2;
- __le32 addr1;
- __le32 addr2;
-#if DSL
- __le32 skip[DSL];
-#endif
-};
-
-struct media_info {
- u16 type; /* DE_MEDIA_xxx */
- u16 csr13;
- u16 csr14;
- u16 csr15;
-};
-
-struct ring_info {
- struct sk_buff *skb;
- dma_addr_t mapping;
-};
-
-struct de_private {
- unsigned tx_head;
- unsigned tx_tail;
- unsigned rx_tail;
-
- void __iomem *regs;
- struct net_device *dev;
- spinlock_t lock;
-
- struct de_desc *rx_ring;
- struct de_desc *tx_ring;
- struct ring_info tx_skb[DE_TX_RING_SIZE];
- struct ring_info rx_skb[DE_RX_RING_SIZE];
- unsigned rx_buf_sz;
- dma_addr_t ring_dma;
-
- u32 msg_enable;
-
- struct net_device_stats net_stats;
-
- struct pci_dev *pdev;
-
- u16 setup_frame[DE_SETUP_FRAME_WORDS];
-
- u32 media_type;
- u32 media_supported;
- u32 media_advertise;
- struct media_info media[DE_MAX_MEDIA];
- struct timer_list media_timer;
-
- u8 *ee_data;
- unsigned board_idx;
- unsigned de21040 : 1;
- unsigned media_lock : 1;
-};
-
-
-static void de_set_rx_mode (struct net_device *dev);
-static void de_tx (struct de_private *de);
-static void de_clean_rings (struct de_private *de);
-static void de_media_interrupt (struct de_private *de, u32 status);
-static void de21040_media_timer (unsigned long data);
-static void de21041_media_timer (unsigned long data);
-static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media);
-
-
-static DEFINE_PCI_DEVICE_TABLE(de_pci_tbl) = {
- { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP,
- PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
- { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_PLUS,
- PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },
- { },
-};
-MODULE_DEVICE_TABLE(pci, de_pci_tbl);
-
-static const char * const media_name[DE_MAX_MEDIA] = {
- "10baseT auto",
- "BNC",
- "AUI",
- "10baseT-HD",
- "10baseT-FD"
-};
-
-/* 21040 transceiver register settings:
- * TP AUTO(unused), BNC(unused), AUI, TP, TP FD*/
-static u16 t21040_csr13[] = { 0, 0, 0x8F09, 0x8F01, 0x8F01, };
-static u16 t21040_csr14[] = { 0, 0, 0x0705, 0xFFFF, 0xFFFD, };
-static u16 t21040_csr15[] = { 0, 0, 0x0006, 0x0000, 0x0000, };
-
-/* 21041 transceiver register settings: TP AUTO, BNC, AUI, TP, TP FD*/
-static u16 t21041_csr13[] = { 0xEF01, 0xEF09, 0xEF09, 0xEF01, 0xEF09, };
-static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x7F3F, 0x7F3D, };
-/* If on-chip autonegotiation is broken, use half-duplex (FF3F) instead */
-static u16 t21041_csr14_brk[] = { 0xFF3F, 0xF7FD, 0xF7FD, 0x7F3F, 0x7F3D, };
-static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
-
-
-#define dr32(reg) ioread32(de->regs + (reg))
-#define dw32(reg, val) iowrite32((val), de->regs + (reg))
-
-
-static void de_rx_err_acct (struct de_private *de, unsigned rx_tail,
- u32 status, u32 len)
-{
- netif_dbg(de, rx_err, de->dev,
- "rx err, slot %d status 0x%x len %d\n",
- rx_tail, status, len);
-
- if ((status & 0x38000300) != 0x0300) {
- /* Ingore earlier buffers. */
- if ((status & 0xffff) != 0x7fff) {
- netif_warn(de, rx_err, de->dev,
- "Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
- status);
- de->net_stats.rx_length_errors++;
- }
- } else if (status & RxError) {
- /* There was a fatal error. */
- de->net_stats.rx_errors++; /* end of a packet.*/
- if (status & 0x0890) de->net_stats.rx_length_errors++;
- if (status & RxErrCRC) de->net_stats.rx_crc_errors++;
- if (status & RxErrFIFO) de->net_stats.rx_fifo_errors++;
- }
-}
-
-static void de_rx (struct de_private *de)
-{
- unsigned rx_tail = de->rx_tail;
- unsigned rx_work = DE_RX_RING_SIZE;
- unsigned drop = 0;
- int rc;
-
- while (--rx_work) {
- u32 status, len;
- dma_addr_t mapping;
- struct sk_buff *skb, *copy_skb;
- unsigned copying_skb, buflen;
-
- skb = de->rx_skb[rx_tail].skb;
- BUG_ON(!skb);
- rmb();
- status = le32_to_cpu(de->rx_ring[rx_tail].opts1);
- if (status & DescOwn)
- break;
-
- len = ((status >> 16) & 0x7ff) - 4;
- mapping = de->rx_skb[rx_tail].mapping;
-
- if (unlikely(drop)) {
- de->net_stats.rx_dropped++;
- goto rx_next;
- }
-
- if (unlikely((status & 0x38008300) != 0x0300)) {
- de_rx_err_acct(de, rx_tail, status, len);
- goto rx_next;
- }
-
- copying_skb = (len <= rx_copybreak);
-
- netif_dbg(de, rx_status, de->dev,
- "rx slot %d status 0x%x len %d copying? %d\n",
- rx_tail, status, len, copying_skb);
-
- buflen = copying_skb ? (len + RX_OFFSET) : de->rx_buf_sz;
- copy_skb = dev_alloc_skb (buflen);
- if (unlikely(!copy_skb)) {
- de->net_stats.rx_dropped++;
- drop = 1;
- rx_work = 100;
- goto rx_next;
- }
-
- if (!copying_skb) {
- pci_unmap_single(de->pdev, mapping,
- buflen, PCI_DMA_FROMDEVICE);
- skb_put(skb, len);
-
- mapping =
- de->rx_skb[rx_tail].mapping =
- pci_map_single(de->pdev, copy_skb->data,
- buflen, PCI_DMA_FROMDEVICE);
- de->rx_skb[rx_tail].skb = copy_skb;
- } else {
- pci_dma_sync_single_for_cpu(de->pdev, mapping, len, PCI_DMA_FROMDEVICE);
- skb_reserve(copy_skb, RX_OFFSET);
- skb_copy_from_linear_data(skb, skb_put(copy_skb, len),
- len);
- pci_dma_sync_single_for_device(de->pdev, mapping, len, PCI_DMA_FROMDEVICE);
-
- /* We'll reuse the original ring buffer. */
- skb = copy