39 #include <linux/module.h>
40 #include <linux/kernel.h>
41 #include <linux/errno.h>
42 #include <linux/string.h>
44 #include <linux/netdevice.h>
54 #define DRV_NAME "e2100"
56 static int e21_probe_list[] = {0x300, 0x280, 0x380, 0x220, 0};
61 #define E21_NIC_OFFSET 0
63 #define E21_MEM_ENABLE 0x10
64 #define E21_MEM_ON 0x05
65 #define E21_MEM_ON_8 0x07
66 #define E21_MEM_BASE 0x11
67 #define E21_IRQ_LOW 0x12
68 #define E21_IRQ_HIGH 0x14
69 #define E21_MEDIA 0x14
70 #define E21_ALT_IFPORT 0x02
71 #define E21_BIG_MEM 0x04
72 #define E21_SAPROM 0x10
73 #define E21_IO_EXTENT 0x20
76 unsigned char start_page )
80 readb(mem_base+start_page);
85 static inline void mem_off(
short port)
95 #define E21_RX_START_PG 0x00
96 #define E21_RX_STOP_PG 0x30
97 #define E21_BIG_RX_STOP_PG 0xF0
98 #define E21_TX_START_PG E21_RX_STOP_PG
107 const unsigned char *
buf,
int start_page);
127 if (base_addr > 0x1ff)
128 return e21_probe1(dev, base_addr);
129 else if (base_addr != 0)
132 for (port = e21_probe_list; *
port; port++) {
134 if (e21_probe1(dev, *port) == 0)
153 err = do_e2100_probe(dev);
164 .ndo_open = e21_open,
165 .ndo_stop = e21_close,
174 #ifdef CONFIG_NET_POLL_CONTROLLER
175 .ndo_poll_controller = ei_poll,
183 static unsigned version_printed;
199 status =
inb(ioaddr);
200 if (status != 0x21 && status != 0x23) {
206 for (i = 0; i < 6; i++)
212 if (
ei_debug && version_printed++ == 0)
215 for (i = 0; i < 6; i++)
216 printk(
" %02X", station_addr[i]);
219 static const int irqlist[] = {15, 11, 10, 12, 5, 9, 3, 4};
222 dev->
irq = irqlist[
i];
226 printk(
" unable to get IRQ %d.\n", dev->
irq);
230 }
else if (dev->
irq == 2)
250 for(i = 0; i < 6; i++)
265 printk(
"unable to remap memory\n");
277 printk(
", IRQ %d, %s media, memory @ %#lx.\n", dev->
irq,
281 ei_status.block_input = &e21_block_input;
282 ei_status.block_output = &e21_block_output;
283 ei_status.get_8390_hdr = &e21_get_8390_hdr;
325 if (
ei_debug > 1)
printk(
"resetting the E2180x3 t=%ld...", jiffies);
343 mem_on(ioaddr, shared_mem, ring_page);
349 ((
unsigned int*)hdr)[0] =
readl(shared_mem);
366 mem_on(ioaddr, shared_mem, (ring_offset>>8));
374 e21_block_output(
struct net_device *dev,
int count,
const unsigned char *
buf,
382 readb(shared_mem + start_page);
383 mem_on(ioaddr, shared_mem, start_page);
395 printk(
"%s: Shutting down ethercard.\n", dev->
name);
417 #define MAX_E21_CARDS 4
418 static struct net_device *dev_e21[MAX_E21_CARDS];
419 static int io[MAX_E21_CARDS];
420 static int irq[MAX_E21_CARDS];
421 static int mem[MAX_E21_CARDS];
422 static int xcvr[MAX_E21_CARDS];
441 int this_dev, found = 0;
443 for (this_dev = 0; this_dev < MAX_E21_CARDS; this_dev++) {
444 if (io[this_dev] == 0) {
445 if (this_dev != 0)
break;
446 printk(
KERN_NOTICE "e2100.c: Presently autoprobing (not recommended) for a single card.\n");
448 dev = alloc_ei_netdev();
451 dev->
irq = irq[this_dev];
455 if (do_e2100_probe(dev) == 0) {
456 dev_e21[found++] =
dev;
468 static void cleanup_card(
struct net_device *dev)
480 for (this_dev = 0; this_dev < MAX_E21_CARDS; this_dev++) {