aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/eth16i.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
commit6aa20a2235535605db6d6d2bd850298b2fe7f31e (patch)
treedf0b855043407b831d57f2f2c271f8aab48444f4 /drivers/net/eth16i.c
parent7a291083225af6e22ffaa46b3d91cfc1a1ccaab4 (diff)
drivers/net: Trim trailing whitespace
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/eth16i.c')
-rw-r--r--drivers/net/eth16i.c308
1 files changed, 154 insertions, 154 deletions
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c
index ca42efa9143c..f16b6a5aaa34 100644
--- a/drivers/net/eth16i.c
+++ b/drivers/net/eth16i.c
@@ -1,7 +1,7 @@
1/* eth16i.c An ICL EtherTeam 16i and 32 EISA ethernet driver for Linux 1/* eth16i.c An ICL EtherTeam 16i and 32 EISA ethernet driver for Linux
2 2
3 Written 1994-1999 by Mika Kuoppala 3 Written 1994-1999 by Mika Kuoppala
4 4
5 Copyright (C) 1994-1999 by Mika Kuoppala 5 Copyright (C) 1994-1999 by Mika Kuoppala
6 Based on skeleton.c and heavily on at1700.c by Donald Becker 6 Based on skeleton.c and heavily on at1700.c by Donald Becker
7 7
@@ -12,7 +12,7 @@
12 12
13 This driver supports following cards : 13 This driver supports following cards :
14 - ICL EtherTeam 16i 14 - ICL EtherTeam 16i
15 - ICL EtherTeam 32 EISA 15 - ICL EtherTeam 32 EISA
16 (Uses true 32 bit transfers rather than 16i compability mode) 16 (Uses true 32 bit transfers rather than 16i compability mode)
17 17
18 Example Module usage: 18 Example Module usage:
@@ -25,26 +25,26 @@
25 25
26 I have benchmarked driver with PII/300Mhz as a ftp client 26 I have benchmarked driver with PII/300Mhz as a ftp client
27 and 486/33Mhz as a ftp server. Top speed was 1128.37 kilobytes/sec. 27 and 486/33Mhz as a ftp server. Top speed was 1128.37 kilobytes/sec.
28 28
29 Sources: 29 Sources:
30 - skeleton.c a sample network driver core for linux, 30 - skeleton.c a sample network driver core for linux,
31 written by Donald Becker <becker@scyld.com> 31 written by Donald Becker <becker@scyld.com>
32 - at1700.c a driver for Allied Telesis AT1700, written 32 - at1700.c a driver for Allied Telesis AT1700, written
33 by Donald Becker. 33 by Donald Becker.
34 - e16iSRV.asm a Netware 3.X Server Driver for ICL EtherTeam16i 34 - e16iSRV.asm a Netware 3.X Server Driver for ICL EtherTeam16i
35 written by Markku Viima 35 written by Markku Viima
36 - The Fujitsu MB86965 databook. 36 - The Fujitsu MB86965 databook.
37 37
38 Author thanks following persons due to their valueble assistance: 38 Author thanks following persons due to their valueble assistance:
39 Markku Viima (ICL) 39 Markku Viima (ICL)
40 Ari Valve (ICL) 40 Ari Valve (ICL)
41 Donald Becker 41 Donald Becker
42 Kurt Huwig <kurt@huwig.de> 42 Kurt Huwig <kurt@huwig.de>
43 43
44 Revision history: 44 Revision history:
45 45
46 Version Date Description 46 Version Date Description
47 47
48 0.01 15.12-94 Initial version (card detection) 48 0.01 15.12-94 Initial version (card detection)
49 0.02 23.01-95 Interrupt is now hooked correctly 49 0.02 23.01-95 Interrupt is now hooked correctly
50 0.03 01.02-95 Rewrote initialization part 50 0.03 01.02-95 Rewrote initialization part
@@ -58,7 +58,7 @@
58 0.05 08.02-95 If there were more than one packet to send, 58 0.05 08.02-95 If there were more than one packet to send,
59 transmit was jammed due to invalid 59 transmit was jammed due to invalid
60 register write...now fixed 60 register write...now fixed
61 0.06 19.02-95 Rewrote interrupt handling 61 0.06 19.02-95 Rewrote interrupt handling
62 0.07 13.04-95 Wrote EEPROM read routines 62 0.07 13.04-95 Wrote EEPROM read routines
63 Card configuration now set according to 63 Card configuration now set according to
64 data read from EEPROM 64 data read from EEPROM
@@ -66,34 +66,34 @@
66 port if AUTO is selected 66 port if AUTO is selected
67 67
68 0.09 01.09-95 Added module support 68 0.09 01.09-95 Added module support
69 69
70 0.10 04.09-95 Fixed receive packet allocation to work 70 0.10 04.09-95 Fixed receive packet allocation to work
71 with kernels > 1.3.x 71 with kernels > 1.3.x
72
73 0.20 20.09-95 Added support for EtherTeam32 EISA
74 72
75 0.21 17.10-95 Removed the unnecessary extern 73 0.20 20.09-95 Added support for EtherTeam32 EISA
74
75 0.21 17.10-95 Removed the unnecessary extern
76 init_etherdev() declaration. Some 76 init_etherdev() declaration. Some
77 other cleanups. 77 other cleanups.
78 78
79 0.22 22.02-96 Receive buffer was not flushed 79 0.22 22.02-96 Receive buffer was not flushed
80 correctly when faulty packet was 80 correctly when faulty packet was
81 received. Now fixed. 81 received. Now fixed.
82 82
83 0.23 26.02-96 Made resetting the adapter 83 0.23 26.02-96 Made resetting the adapter
84 more reliable. 84 more reliable.
85 85
86 0.24 27.02-96 Rewrote faulty packet handling in eth16i_rx 86 0.24 27.02-96 Rewrote faulty packet handling in eth16i_rx
87 87
88 0.25 22.05-96 kfree() was missing from cleanup_module. 88 0.25 22.05-96 kfree() was missing from cleanup_module.
89 89
90 0.26 11.06-96 Sometimes card was not found by 90 0.26 11.06-96 Sometimes card was not found by
91 check_signature(). Now made more reliable. 91 check_signature(). Now made more reliable.
92 92
93 0.27 23.06-96 Oops. 16 consecutive collisions halted 93 0.27 23.06-96 Oops. 16 consecutive collisions halted
94 adapter. Now will try to retransmit 94 adapter. Now will try to retransmit
95 MAX_COL_16 times before finally giving up. 95 MAX_COL_16 times before finally giving up.
96 96
97 0.28 28.10-97 Added dev_id parameter (NULL) for free_irq 97 0.28 28.10-97 Added dev_id parameter (NULL) for free_irq
98 98
99 0.29 29.10-97 Multiple card support for module users 99 0.29 29.10-97 Multiple card support for module users
@@ -103,16 +103,16 @@
103 103
104 0.30a 21.08-98 Card detection made more relaxed. Driver 104 0.30a 21.08-98 Card detection made more relaxed. Driver
105 had problems with some TCP/IP-PROM boots 105 had problems with some TCP/IP-PROM boots
106 to find the card. Suggested by 106 to find the card. Suggested by
107 Kurt Huwig <kurt@huwig.de> 107 Kurt Huwig <kurt@huwig.de>
108 108
109 0.31 28.08-98 Media interface port can now be selected 109 0.31 28.08-98 Media interface port can now be selected
110 with module parameters or kernel 110 with module parameters or kernel
111 boot parameters. 111 boot parameters.
112 112
113 0.32 31.08-98 IRQ was never freed if open/close 113 0.32 31.08-98 IRQ was never freed if open/close
114 pair wasn't called. Now fixed. 114 pair wasn't called. Now fixed.
115 115
116 0.33 10.09-98 When eth16i_open() was called after 116 0.33 10.09-98 When eth16i_open() was called after
117 eth16i_close() chip never recovered. 117 eth16i_close() chip never recovered.
118 Now more shallow reset is made on 118 Now more shallow reset is made on
@@ -122,15 +122,15 @@
122 Changed ioaddr -> io for consistency 122 Changed ioaddr -> io for consistency
123 123
124 0.35 01.07-99 transmit,-receive bytes were never 124 0.35 01.07-99 transmit,-receive bytes were never
125 updated in stats. 125 updated in stats.
126 126
127 Bugs: 127 Bugs:
128 In some cases the media interface autoprobing code doesn't find 128 In some cases the media interface autoprobing code doesn't find
129 the correct interface type. In this case you can 129 the correct interface type. In this case you can
130 manually choose the interface type in DOS with E16IC.EXE which is 130 manually choose the interface type in DOS with E16IC.EXE which is
131 configuration software for EtherTeam16i and EtherTeam32 cards. 131 configuration software for EtherTeam16i and EtherTeam32 cards.
132 This is also true for IRQ setting. You cannot use module 132 This is also true for IRQ setting. You cannot use module
133 parameter to configure IRQ of the card (yet). 133 parameter to configure IRQ of the card (yet).
134 134
135 To do: 135 To do:
136 - Real multicast support 136 - Real multicast support
@@ -142,18 +142,18 @@
142 irq without configuration utility. 142 irq without configuration utility.
143*/ 143*/
144 144
145static char *version = 145static char *version =
146 "eth16i.c: v0.35 01-Jul-1999 Mika Kuoppala (miku@iki.fi)\n"; 146 "eth16i.c: v0.35 01-Jul-1999 Mika Kuoppala (miku@iki.fi)\n";
147 147
148#include <linux/module.h> 148#include <linux/module.h>
149#include <linux/kernel.h> 149#include <linux/kernel.h>
150#include <linux/types.h> 150#include <linux/types.h>
151#include <linux/fcntl.h> 151#include <linux/fcntl.h>
152#include <linux/interrupt.h> 152#include <linux/interrupt.h>
153#include <linux/ioport.h> 153#include <linux/ioport.h>
154#include <linux/in.h> 154#include <linux/in.h>
155#include <linux/slab.h> 155#include <linux/slab.h>
156#include <linux/string.h> 156#include <linux/string.h>
157#include <linux/errno.h> 157#include <linux/errno.h>
158#include <linux/init.h> 158#include <linux/init.h>
159#include <linux/spinlock.h> 159#include <linux/spinlock.h>
@@ -163,15 +163,15 @@ static char *version =
163#include <linux/bitops.h> 163#include <linux/bitops.h>
164#include <linux/jiffies.h> 164#include <linux/jiffies.h>
165 165
166#include <asm/system.h> 166#include <asm/system.h>
167#include <asm/io.h> 167#include <asm/io.h>
168#include <asm/dma.h> 168#include <asm/dma.h>
169 169
170 170
171 171
172/* Few macros */ 172/* Few macros */
173#define BIT(a) ( (1 << (a)) ) 173#define BIT(a) ( (1 << (a)) )
174#define BITSET(ioaddr, bnum) ((outb(((inb(ioaddr)) | (bnum)), ioaddr))) 174#define BITSET(ioaddr, bnum) ((outb(((inb(ioaddr)) | (bnum)), ioaddr)))
175#define BITCLR(ioaddr, bnum) ((outb(((inb(ioaddr)) & (~(bnum))), ioaddr))) 175#define BITCLR(ioaddr, bnum) ((outb(((inb(ioaddr)) & (~(bnum))), ioaddr)))
176 176
177/* This is the I/O address space for Etherteam 16i adapter. */ 177/* This is the I/O address space for Etherteam 16i adapter. */
@@ -186,7 +186,7 @@ static char *version =
186/* Some interrupt masks */ 186/* Some interrupt masks */
187#define ETH16I_INTR_ON 0xef8a /* Higher is receive mask */ 187#define ETH16I_INTR_ON 0xef8a /* Higher is receive mask */
188#define ETH16I_INTR_OFF 0x0000 188#define ETH16I_INTR_OFF 0x0000
189 189
190/* Buffers header status byte meanings */ 190/* Buffers header status byte meanings */
191#define PKT_GOOD BIT(5) 191#define PKT_GOOD BIT(5)
192#define PKT_GOOD_RMT BIT(4) 192#define PKT_GOOD_RMT BIT(4)
@@ -213,7 +213,7 @@ static char *version =
213#define ALIGN_ERR BIT(2) 213#define ALIGN_ERR BIT(2)
214#define CRC_ERR BIT(1) 214#define CRC_ERR BIT(1)
215#define RX_BUF_OVERFLOW BIT(0) 215#define RX_BUF_OVERFLOW BIT(0)
216 216
217/* Transmit Interrupt Enable Register (DLCR2) */ 217/* Transmit Interrupt Enable Register (DLCR2) */
218#define TX_INTR_REG 2 218#define TX_INTR_REG 2
219#define TX_INTR_DONE BIT(7) 219#define TX_INTR_DONE BIT(7)
@@ -252,14 +252,14 @@ static char *version =
252#define SRAM_CYCLE_TIME_100NS BIT(6) 252#define SRAM_CYCLE_TIME_100NS BIT(6)
253#define SYSTEM_BUS_WIDTH_8 BIT(5) /* 1 = 8bit, 0 = 16bit */ 253#define SYSTEM_BUS_WIDTH_8 BIT(5) /* 1 = 8bit, 0 = 16bit */
254#define BUFFER_WIDTH_8 BIT(4) /* 1 = 8bit, 0 = 16bit */ 254#define BUFFER_WIDTH_8 BIT(4) /* 1 = 8bit, 0 = 16bit */
255#define TBS1 BIT(3) 255#define TBS1 BIT(3)
256#define TBS0 BIT(2) 256#define TBS0 BIT(2)
257#define SRAM_BS1 BIT(1) /* 00=8kb, 01=16kb */ 257#define SRAM_BS1 BIT(1) /* 00=8kb, 01=16kb */
258#define SRAM_BS0 BIT(0) /* 10=32kb, 11=64kb */ 258#define SRAM_BS0 BIT(0) /* 10=32kb, 11=64kb */
259 259
260#ifndef ETH16I_TX_BUF_SIZE /* 0 = 2kb, 1 = 4kb */ 260#ifndef ETH16I_TX_BUF_SIZE /* 0 = 2kb, 1 = 4kb */
261#define ETH16I_TX_BUF_SIZE 3 /* 2 = 8kb, 3 = 16kb */ 261#define ETH16I_TX_BUF_SIZE 3 /* 2 = 8kb, 3 = 16kb */
262#endif 262#endif
263#define TX_BUF_1x2048 0 263#define TX_BUF_1x2048 0
264#define TX_BUF_2x2048 1 264#define TX_BUF_2x2048 1
265#define TX_BUF_2x4098 2 265#define TX_BUF_2x4098 2
@@ -297,7 +297,7 @@ static char *version =
297 297
298/* DMA Burst and Transceiver Mode Register (BMPR13) */ 298/* DMA Burst and Transceiver Mode Register (BMPR13) */
299#define TRANSCEIVER_MODE_REG 13 299#define TRANSCEIVER_MODE_REG 13
300#define TRANSCEIVER_MODE_RB 2 300#define TRANSCEIVER_MODE_RB 2
301#define IO_BASE_UNLOCK BIT(7) 301#define IO_BASE_UNLOCK BIT(7)
302#define LOWER_SQUELCH_TRESH BIT(6) 302#define LOWER_SQUELCH_TRESH BIT(6)
303#define LINK_TEST_DISABLE BIT(5) 303#define LINK_TEST_DISABLE BIT(5)
@@ -337,7 +337,7 @@ static char *version =
337 #define E_PORT_AUTO 0x03 337 #define E_PORT_AUTO 0x03
338 #define E_PORT_FROM_EPROM 0x04 338 #define E_PORT_FROM_EPROM 0x04
339#define E_PRODUCT_CFG 0x30 339#define E_PRODUCT_CFG 0x30
340 340
341 341
342/* Macro to slow down io between EEPROM clock transitions */ 342/* Macro to slow down io between EEPROM clock transitions */
343#define eeprom_slow_io() do { int _i = 40; while(--_i > 0) { inb(0x80); }}while(0) 343#define eeprom_slow_io() do { int _i = 40; while(--_i > 0) { inb(0x80); }}while(0)
@@ -352,12 +352,12 @@ static char *version =
352 352
353/* This is the I/O address list to be probed when seeking the card */ 353/* This is the I/O address list to be probed when seeking the card */
354static unsigned int eth16i_portlist[] __initdata = { 354static unsigned int eth16i_portlist[] __initdata = {
355 0x260, 0x280, 0x2A0, 0x240, 0x340, 0x320, 0x380, 0x300, 0 355 0x260, 0x280, 0x2A0, 0x240, 0x340, 0x320, 0x380, 0x300, 0
356}; 356};
357 357
358static unsigned int eth32i_portlist[] __initdata = { 358static unsigned int eth32i_portlist[] __initdata = {
359 0x1000, 0x2000, 0x3000, 0x4000, 0x5000, 0x6000, 0x7000, 0x8000, 359 0x1000, 0x2000, 0x3000, 0x4000, 0x5000, 0x6000, 0x7000, 0x8000,
360 0x9000, 0xA000, 0xB000, 0xC000, 0xD000, 0xE000, 0xF000, 0 360 0x9000, 0xA000, 0xB000, 0xC000, 0xD000, 0xE000, 0xF000, 0
361}; 361};
362 362
363/* This is the Interrupt lookup table for Eth16i card */ 363/* This is the Interrupt lookup table for Eth16i card */
@@ -365,7 +365,7 @@ static unsigned int eth16i_irqmap[] __initdata = { 9, 10, 5, 15, 0 };
365#define NUM_OF_ISA_IRQS 4 365#define NUM_OF_ISA_IRQS 4
366 366
367/* This is the Interrupt lookup table for Eth32i card */ 367/* This is the Interrupt lookup table for Eth32i card */
368static unsigned int eth32i_irqmap[] __initdata = { 3, 5, 7, 9, 10, 11, 12, 15, 0 }; 368static unsigned int eth32i_irqmap[] __initdata = { 3, 5, 7, 9, 10, 11, 12, 15, 0 };
369#define EISA_IRQ_REG 0xc89 369#define EISA_IRQ_REG 0xc89
370#define NUM_OF_EISA_IRQS 8 370#define NUM_OF_EISA_IRQS 8
371 371
@@ -384,7 +384,7 @@ struct eth16i_local {
384 unsigned char tx_started; 384 unsigned char tx_started;
385 unsigned char tx_buf_busy; 385 unsigned char tx_buf_busy;
386 unsigned short tx_queue; /* Number of packets in transmit buffer */ 386 unsigned short tx_queue; /* Number of packets in transmit buffer */
387 unsigned short tx_queue_len; 387 unsigned short tx_queue_len;
388 unsigned int tx_buf_size; 388 unsigned int tx_buf_size;
389 unsigned long open_time; 389 unsigned long open_time;
390 unsigned long tx_buffered_packets; 390 unsigned long tx_buffered_packets;
@@ -414,7 +414,7 @@ static irqreturn_t eth16i_interrupt(int irq, void *dev_id, struct pt_regs *regs)
414static void eth16i_reset(struct net_device *dev); 414static void eth16i_reset(struct net_device *dev);
415static void eth16i_timeout(struct net_device *dev); 415static void eth16i_timeout(struct net_device *dev);
416static void eth16i_skip_packet(struct net_device *dev); 416static void eth16i_skip_packet(struct net_device *dev);
417static void eth16i_multicast(struct net_device *dev); 417static void eth16i_multicast(struct net_device *dev);
418static void eth16i_select_regbank(unsigned char regbank, int ioaddr); 418static void eth16i_select_regbank(unsigned char regbank, int ioaddr);
419static void eth16i_initialize(struct net_device *dev, int boot); 419static void eth16i_initialize(struct net_device *dev, int boot);
420 420
@@ -435,10 +435,10 @@ static int __init do_eth16i_probe(struct net_device *dev)
435 int i; 435 int i;
436 int ioaddr; 436 int ioaddr;
437 int base_addr = dev->base_addr; 437 int base_addr = dev->base_addr;
438 438
439 SET_MODULE_OWNER(dev); 439 SET_MODULE_OWNER(dev);
440 440
441 if(eth16i_debug > 4) 441 if(eth16i_debug > 4)
442 printk(KERN_DEBUG "Probing started for %s\n", cardname); 442 printk(KERN_DEBUG "Probing started for %s\n", cardname);
443 443
444 if(base_addr > 0x1ff) /* Check only single location */ 444 if(base_addr > 0x1ff) /* Check only single location */
@@ -492,14 +492,14 @@ static int __init eth16i_probe1(struct net_device *dev, int ioaddr)
492 return -EBUSY; 492 return -EBUSY;
493 493
494 /* 494 /*
495 The MB86985 chip has on register which holds information in which 495 The MB86985 chip has on register which holds information in which
496 io address the chip lies. First read this register and compare 496 io address the chip lies. First read this register and compare
497 it to our current io address and if match then this could 497 it to our current io address and if match then this could
498 be our chip. 498 be our chip.
499 */ 499 */
500 500
501 if(ioaddr < 0x1000) { 501 if(ioaddr < 0x1000) {
502 if(eth16i_portlist[(inb(ioaddr + JUMPERLESS_CONFIG) & 0x07)] 502 if(eth16i_portlist[(inb(ioaddr + JUMPERLESS_CONFIG) & 0x07)]
503 != ioaddr) { 503 != ioaddr) {
504 retval = -ENODEV; 504 retval = -ENODEV;
505 goto out; 505 goto out;
@@ -513,9 +513,9 @@ static int __init eth16i_probe1(struct net_device *dev, int ioaddr)
513 goto out; 513 goto out;
514 } 514 }
515 515
516 /* 516 /*
517 Now it seems that we have found a ethernet chip in this particular 517 Now it seems that we have found a ethernet chip in this particular
518 ioaddr. The MB86985 chip has this feature, that when you read a 518 ioaddr. The MB86985 chip has this feature, that when you read a
519 certain register it will increase it's io base address to next 519 certain register it will increase it's io base address to next
520 configurable slot. Now when we have found the chip, first thing is 520 configurable slot. Now when we have found the chip, first thing is
521 to make sure that the chip's ioaddr will hold still here. 521 to make sure that the chip's ioaddr will hold still here.
@@ -536,7 +536,7 @@ static int __init eth16i_probe1(struct net_device *dev, int ioaddr)
536 /* Try to obtain interrupt vector */ 536 /* Try to obtain interrupt vector */
537 537
538 if ((retval = request_irq(dev->irq, (void *)&eth16i_interrupt, 0, cardname, dev))) { 538 if ((retval = request_irq(dev->irq, (void *)&eth16i_interrupt, 0, cardname, dev))) {
539 printk(KERN_WARNING "%s at %#3x, but is unusable due to conflicting IRQ %d.\n", 539 printk(KERN_WARNING "%s at %#3x, but is unusable due to conflicting IRQ %d.\n",
540 cardname, ioaddr, dev->irq); 540 cardname, ioaddr, dev->irq);
541 goto out; 541 goto out;
542 } 542 }
@@ -547,7 +547,7 @@ static int __init eth16i_probe1(struct net_device *dev, int ioaddr)
547 547
548 /* Now we will have to lock the chip's io address */ 548 /* Now we will have to lock the chip's io address */
549 eth16i_select_regbank(TRANSCEIVER_MODE_RB, ioaddr); 549 eth16i_select_regbank(TRANSCEIVER_MODE_RB, ioaddr);
550 outb(0x38, ioaddr + TRANSCEIVER_MODE_REG); 550 outb(0x38, ioaddr + TRANSCEIVER_MODE_REG);
551 551
552 eth16i_initialize(dev, 1); /* Initialize rest of the chip's registers */ 552 eth16i_initialize(dev, 1); /* Initialize rest of the chip's registers */
553 553
@@ -590,7 +590,7 @@ static void eth16i_initialize(struct net_device *dev, int boot)
590 ((unsigned short *)dev->dev_addr)[i] = ntohs(node_val); 590 ((unsigned short *)dev->dev_addr)[i] = ntohs(node_val);
591 } 591 }
592 592
593 for(i = 0; i < 6; i++) { 593 for(i = 0; i < 6; i++) {
594 outb( ((unsigned char *)dev->dev_addr)[i], ioaddr + NODE_ID_0 + i); 594 outb( ((unsigned char *)dev->dev_addr)[i], ioaddr + NODE_ID_0 + i);
595 if(boot) { 595 if(boot) {
596 printk("%02x", inb(ioaddr + NODE_ID_0 + i)); 596 printk("%02x", inb(ioaddr + NODE_ID_0 + i));
@@ -601,11 +601,11 @@ static void eth16i_initialize(struct net_device *dev, int boot)
601 601
602 /* Now we will set multicast addresses to accept none */ 602 /* Now we will set multicast addresses to accept none */
603 eth16i_select_regbank(HASH_TABLE_RB, ioaddr); 603 eth16i_select_regbank(HASH_TABLE_RB, ioaddr);
604 for(i = 0; i < 8; i++) 604 for(i = 0; i < 8; i++)
605 outb(0x00, ioaddr + HASH_TABLE_0 + i); 605 outb(0x00, ioaddr + HASH_TABLE_0 + i);
606 606
607 /* 607 /*
608 Now let's disable the transmitter and receiver, set the buffer ram 608 Now let's disable the transmitter and receiver, set the buffer ram
609 cycle time, bus width and buffer data path width. Also we shall 609 cycle time, bus width and buffer data path width. Also we shall
610 set transmit buffer size and total buffer size. 610 set transmit buffer size and total buffer size.
611 */ 611 */
@@ -633,7 +633,7 @@ static void eth16i_initialize(struct net_device *dev, int boot)
633#ifdef MODULE 633#ifdef MODULE
634 /* if_port already set by init_module() */ 634 /* if_port already set by init_module() */
635#else 635#else
636 dev->if_port = (dev->mem_start < E_PORT_FROM_EPROM) ? 636 dev->if_port = (dev->mem_start < E_PORT_FROM_EPROM) ?
637 dev->mem_start : E_PORT_FROM_EPROM; 637 dev->mem_start : E_PORT_FROM_EPROM;
638#endif 638#endif
639 639
@@ -651,7 +651,7 @@ static void eth16i_initialize(struct net_device *dev, int boot)
651 case E_PORT_AUTO: 651 case E_PORT_AUTO:
652 dev->if_port = eth16i_probe_port(ioaddr); 652 dev->if_port = eth16i_probe_port(ioaddr);
653 break; 653 break;
654 654
655 case E_PORT_BNC: 655 case E_PORT_BNC:
656 case E_PORT_TP: 656 case E_PORT_TP:
657 case E_PORT_DIX: 657 case E_PORT_DIX:
@@ -721,7 +721,7 @@ static int eth16i_probe_port(int ioaddr)
721} 721}
722 722
723static void eth16i_set_port(int ioaddr, int porttype) 723static void eth16i_set_port(int ioaddr, int porttype)
724{ 724{
725 unsigned short temp = 0; 725 unsigned short temp = 0;
726 726
727 eth16i_select_regbank(TRANSCEIVER_MODE_RB, ioaddr); 727 eth16i_select_regbank(TRANSCEIVER_MODE_RB, ioaddr);
@@ -742,13 +742,13 @@ static void eth16i_set_port(int ioaddr, int porttype)
742 temp |= AUI_SELECT; 742 temp |= AUI_SELECT;
743 BITSET(ioaddr + TRANSMIT_MODE_REG, CONTROL_OUTPUT); 743 BITSET(ioaddr + TRANSMIT_MODE_REG, CONTROL_OUTPUT);
744 break; 744 break;
745 } 745 }
746 746
747 outb(temp, ioaddr + TRANSCEIVER_MODE_REG); 747 outb(temp, ioaddr + TRANSCEIVER_MODE_REG);
748 748
749 if(eth16i_debug > 1) { 749 if(eth16i_debug > 1) {
750 printk(KERN_DEBUG "TRANSMIT_MODE_REG = %x\n", inb(ioaddr + TRANSMIT_MODE_REG)); 750 printk(KERN_DEBUG "TRANSMIT_MODE_REG = %x\n", inb(ioaddr + TRANSMIT_MODE_REG));
751 printk(KERN_DEBUG "TRANSCEIVER_MODE_REG = %x\n", 751 printk(KERN_DEBUG "TRANSCEIVER_MODE_REG = %x\n",
752 inb(ioaddr+TRANSCEIVER_MODE_REG)); 752 inb(ioaddr+TRANSCEIVER_MODE_REG));
753 } 753 }
754} 754}
@@ -760,10 +760,10 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
760 outb(0xff, ioaddr + TX_STATUS_REG); 760 outb(0xff, ioaddr + TX_STATUS_REG);
761 761
762 outw(l, ioaddr + DATAPORT); 762 outw(l, ioaddr + DATAPORT);
763 outsw(ioaddr + DATAPORT, (unsigned short *)b, (l + 1) >> 1); 763 outsw(ioaddr + DATAPORT, (unsigned short *)b, (l + 1) >> 1);
764 764
765 starttime = jiffies; 765 starttime = jiffies;
766 outb(TX_START | 1, ioaddr + TRANSMIT_START_REG); 766 outb(TX_START | 1, ioaddr + TRANSMIT_START_REG);
767 767
768 while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) { 768 while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) {
769 if( time_after(jiffies, starttime + TX_TIMEOUT)) { 769 if( time_after(jiffies, starttime + TX_TIMEOUT)) {
@@ -815,10 +815,10 @@ static int eth16i_set_irq(struct net_device* dev)
815 const int irq = dev->irq; 815 const int irq = dev->irq;
816 int i = 0; 816 int i = 0;
817 817
818 if(ioaddr < 0x1000) { 818 if(ioaddr < 0x1000) {
819 while(eth16i_irqmap[i] && eth16i_irqmap[i] != irq) 819 while(eth16i_irqmap[i] && eth16i_irqmap[i] != irq)
820 i++; 820 i++;
821 821
822 if(i < NUM_OF_ISA_IRQS) { 822 if(i < NUM_OF_ISA_IRQS) {
823 u8 cbyte = inb(ioaddr + JUMPERLESS_CONFIG); 823 u8 cbyte = inb(ioaddr + JUMPERLESS_CONFIG);
824 cbyte = (cbyte & 0x3F) | (i << 6); 824 cbyte = (cbyte & 0x3F) | (i << 6);
@@ -829,7 +829,7 @@ static int eth16i_set_irq(struct net_device* dev)
829 else { 829 else {
830 printk(KERN_NOTICE "%s: EISA Interrupt cannot be set. Use EISA Configuration utility.\n", dev->name); 830 printk(KERN_NOTICE "%s: EISA Interrupt cannot be set. Use EISA Configuration utility.\n", dev->name);
831 } 831 }
832 832
833 return -1; 833 return -1;
834 834
835} 835}
@@ -863,7 +863,7 @@ static int __init eth16i_check_signature(int ioaddr)
863 creg[i] = inb(ioaddr + TRANSMIT_MODE_REG + i); 863 creg[i] = inb(ioaddr + TRANSMIT_MODE_REG + i);
864 864
865 if(eth16i_debug > 1) 865 if(eth16i_debug > 1)
866 printk("eth16i: read signature byte %x at %x\n", 866 printk("eth16i: read signature byte %x at %x\n",
867 creg[i], 867 creg[i],
868 ioaddr + TRANSMIT_MODE_REG + i); 868 ioaddr + TRANSMIT_MODE_REG + i);
869 } 869 }
@@ -872,7 +872,7 @@ static int __init eth16i_check_signature(int ioaddr)
872 creg[2] &= 0x7F; /* Mask DCLEN bit */ 872 creg[2] &= 0x7F; /* Mask DCLEN bit */
873 873
874#if 0 874#if 0
875 /* 875 /*
876 This was removed because the card was sometimes left to state 876 This was removed because the card was sometimes left to state
877 from which it couldn't be find anymore. If there is need 877 from which it couldn't be find anymore. If there is need
878 to more strict check still this have to be fixed. 878 to more strict check still this have to be fixed.
@@ -886,14 +886,14 @@ static int __init eth16i_check_signature(int ioaddr)
886 if( !((creg[2] == 0x36) && (creg[3] == 0xE0)) ) { 886 if( !((creg[2] == 0x36) && (creg[3] == 0xE0)) ) {
887 creg[2] &= 0x40; 887 creg[2] &= 0x40;
888 creg[3] &= 0x03; 888 creg[3] &= 0x03;
889 889
890 if( !((creg[2] == 0x40) && (creg[3] == 0x00)) ) 890 if( !((creg[2] == 0x40) && (creg[3] == 0x00)) )
891 return -1; 891 return -1;
892 } 892 }
893 893
894 if(eth16i_read_eeprom(ioaddr, E_NODEID_0) != 0) 894 if(eth16i_read_eeprom(ioaddr, E_NODEID_0) != 0)
895 return -1; 895 return -1;
896 896
897 if((eth16i_read_eeprom(ioaddr, E_NODEID_1) & 0xFF00) != 0x4B00) 897 if((eth16i_read_eeprom(ioaddr, E_NODEID_1) & 0xFF00) != 0x4B00)
898 return -1; 898 return -1;
899 899
@@ -909,22 +909,22 @@ static int eth16i_read_eeprom(int ioaddr, int offset)
909 data = eth16i_read_eeprom_word(ioaddr); 909 data = eth16i_read_eeprom_word(ioaddr);
910 outb(CS_0 | SK_0, ioaddr + EEPROM_CTRL_REG); 910 outb(CS_0 | SK_0, ioaddr + EEPROM_CTRL_REG);
911 911
912 return(data); 912 return(data);
913} 913}
914 914
915static int eth16i_read_eeprom_word(int ioaddr) 915static int eth16i_read_eeprom_word(int ioaddr)
916{ 916{
917 int i; 917 int i;
918 int data = 0; 918 int data = 0;
919 919
920 for(i = 16; i > 0; i--) { 920 for(i = 16; i > 0; i--) {
921 outb(CS_1 | SK_0, ioaddr + EEPROM_CTRL_REG); 921 outb(CS_1 | SK_0, ioaddr + EEPROM_CTRL_REG);
922 eeprom_slow_io(); 922 eeprom_slow_io();
923 outb(CS_1 | SK_1, ioaddr + EEPROM_CTRL_REG); 923 outb(CS_1 | SK_1, ioaddr + EEPROM_CTRL_REG);
924 eeprom_slow_io(); 924 eeprom_slow_io();
925 data = (data << 1) | 925 data = (data << 1) |
926 ((inb(ioaddr + EEPROM_DATA_REG) & DI_1) ? 1 : 0); 926 ((inb(ioaddr + EEPROM_DATA_REG) & DI_1) ? 1 : 0);
927 927
928 eeprom_slow_io(); 928 eeprom_slow_io();
929 } 929 }
930 930
@@ -948,25 +948,25 @@ static void eth16i_eeprom_cmd(int ioaddr, unsigned char command)
948 eeprom_slow_io(); 948 eeprom_slow_io();
949 outb(CS_1 | SK_1, ioaddr + EEPROM_CTRL_REG); 949 outb(CS_1 | SK_1, ioaddr + EEPROM_CTRL_REG);
950 eeprom_slow_io(); 950 eeprom_slow_io();
951 } 951 }
952} 952}
953 953
954static int eth16i_open(struct net_device *dev) 954static int eth16i_open(struct net_device *dev)
955{ 955{
956 struct eth16i_local *lp = netdev_priv(dev); 956 struct eth16i_local *lp = netdev_priv(dev);
957 int ioaddr = dev->base_addr; 957 int ioaddr = dev->base_addr;
958 958
959 /* Powerup the chip */ 959 /* Powerup the chip */
960 outb(0xc0 | POWERUP, ioaddr + CONFIG_REG_1); 960 outb(0xc0 | POWERUP, ioaddr + CONFIG_REG_1);
961 961
962 /* Initialize the chip */ 962 /* Initialize the chip */
963 eth16i_initialize(dev, 0); 963 eth16i_initialize(dev, 0);
964 964
965 /* Set the transmit buffer size */ 965 /* Set the transmit buffer size */
966 lp->tx_buf_size = eth16i_tx_buf_map[ETH16I_TX_BUF_SIZE & 0x03]; 966 lp->tx_buf_size = eth16i_tx_buf_map[ETH16I_TX_BUF_SIZE & 0x03];
967 967
968 if(eth16i_debug > 0) 968 if(eth16i_debug > 0)
969 printk(KERN_DEBUG "%s: transmit buffer size %d\n", 969 printk(KERN_DEBUG "%s: transmit buffer size %d\n",
970 dev->name, lp->tx_buf_size); 970 dev->name, lp->tx_buf_size);
971 971
972 /* Now enable Transmitter and Receiver sections */ 972 /* Now enable Transmitter and Receiver sections */
@@ -981,7 +981,7 @@ static int eth16i_open(struct net_device *dev)
981 lp->tx_queue_len = 0; 981 lp->tx_queue_len = 0;
982 982
983 /* Turn on interrupts*/ 983 /* Turn on interrupts*/
984 outw(ETH16I_INTR_ON, ioaddr + TX_INTR_REG); 984 outw(ETH16I_INTR_ON, ioaddr + TX_INTR_REG);
985 985
986 netif_start_queue(dev); 986 netif_start_queue(dev);
987 return 0; 987 return 0;
@@ -995,10 +995,10 @@ static int eth16i_close(struct net_device *dev)
995 eth16i_reset(dev); 995 eth16i_reset(dev);
996 996
997 /* Turn off interrupts*/ 997 /* Turn off interrupts*/
998 outw(ETH16I_INTR_OFF, ioaddr + TX_INTR_REG); 998 outw(ETH16I_INTR_OFF, ioaddr + TX_INTR_REG);
999 999
1000 netif_stop_queue(dev); 1000 netif_stop_queue(dev);
1001 1001
1002 lp->open_time = 0; 1002 lp->open_time = 0;
1003 1003
1004 /* Disable transmit and receive */ 1004 /* Disable transmit and receive */
@@ -1007,7 +1007,7 @@ static int eth16i_close(struct net_device *dev)
1007 /* Reset the chip */ 1007 /* Reset the chip */
1008 /* outb(0xff, ioaddr + RESET); */ 1008 /* outb(0xff, ioaddr + RESET); */
1009 /* outw(0xffff, ioaddr + TX_STATUS_REG); */ 1009 /* outw(0xffff, ioaddr + TX_STATUS_REG); */
1010 1010
1011 outb(0x00, ioaddr + CONFIG_REG_1); 1011 outb(0x00, ioaddr + CONFIG_REG_1);
1012 1012
1013 return 0; 1013 return 0;
@@ -1017,26 +1017,26 @@ static void eth16i_timeout(struct net_device *dev)
1017{ 1017{
1018 struct eth16i_local *lp = netdev_priv(dev); 1018 struct eth16i_local *lp = netdev_priv(dev);
1019 int ioaddr = dev->base_addr; 1019 int ioaddr = dev->base_addr;
1020 /* 1020 /*
1021 If we get here, some higher level has decided that 1021 If we get here, some higher level has decided that
1022 we are broken. There should really be a "kick me" 1022 we are broken. There should really be a "kick me"
1023 function call instead. 1023 function call instead.
1024 */ 1024 */
1025 1025
1026 outw(ETH16I_INTR_OFF, ioaddr + TX_INTR_REG); 1026 outw(ETH16I_INTR_OFF, ioaddr + TX_INTR_REG);
1027 printk(KERN_WARNING "%s: transmit timed out with status %04x, %s ?\n", 1027 printk(KERN_WARNING "%s: transmit timed out with status %04x, %s ?\n",
1028 dev->name, 1028 dev->name,
1029 inw(ioaddr + TX_STATUS_REG), (inb(ioaddr + TX_STATUS_REG) & TX_DONE) ? 1029 inw(ioaddr + TX_STATUS_REG), (inb(ioaddr + TX_STATUS_REG) & TX_DONE) ?
1030 "IRQ conflict" : "network cable problem"); 1030 "IRQ conflict" : "network cable problem");
1031 1031
1032 dev->trans_start = jiffies; 1032 dev->trans_start = jiffies;
1033 1033
1034 /* Let's dump all registers */ 1034 /* Let's dump all registers */
1035 if(eth16i_debug > 0) { 1035 if(eth16i_debug > 0) {
1036 printk(KERN_DEBUG "%s: timeout: %02x %02x %02x %02x %02x %02x %02x %02x.\n", 1036 printk(KERN_DEBUG "%s: timeout: %02x %02x %02x %02x %02x %02x %02x %02x.\n",
1037 dev->name, inb(ioaddr + 0), 1037 dev->name, inb(ioaddr + 0),
1038 inb(ioaddr + 1), inb(ioaddr + 2), 1038 inb(ioaddr + 1), inb(ioaddr + 2),
1039 inb(ioaddr + 3), inb(ioaddr + 4), 1039 inb(ioaddr + 3), inb(ioaddr + 4),
1040 inb(ioaddr + 5), 1040 inb(ioaddr + 5),
1041 inb(ioaddr + 6), inb(ioaddr + 7)); 1041 inb(ioaddr + 6), inb(ioaddr + 7));
1042 1042
@@ -1071,31 +1071,31 @@ static int eth16i_tx(struct sk_buff *skb, struct net_device *dev)
1071 buf = skb->data; 1071 buf = skb->data;
1072 1072
1073 netif_stop_queue(dev); 1073 netif_stop_queue(dev);
1074 1074
1075 /* Turn off TX interrupts */ 1075 /* Turn off TX interrupts */
1076 outw(ETH16I_INTR_OFF, ioaddr + TX_INTR_REG); 1076 outw(ETH16I_INTR_OFF, ioaddr + TX_INTR_REG);
1077 1077
1078 /* We would be better doing the disable_irq tricks the 3c509 does, 1078 /* We would be better doing the disable_irq tricks the 3c509 does,
1079 that would make this suck a lot less */ 1079 that would make this suck a lot less */
1080 1080
1081 spin_lock_irqsave(&lp->lock, flags); 1081 spin_lock_irqsave(&lp->lock, flags);
1082 1082
1083 if( (length + 2) > (lp->tx_buf_size - lp->tx_queue_len)) { 1083 if( (length + 2) > (lp->tx_buf_size - lp->tx_queue_len)) {
1084 if(eth16i_debug > 0) 1084 if(eth16i_debug > 0)
1085 printk(KERN_WARNING "%s: Transmit buffer full.\n", dev->name); 1085 printk(KERN_WARNING "%s: Transmit buffer full.\n", dev->name);
1086 } 1086 }
1087 else { 1087 else {
1088 outw(length, ioaddr + DATAPORT); 1088 outw(length, ioaddr + DATAPORT);
1089 1089
1090 if( ioaddr < 0x1000 ) 1090 if( ioaddr < 0x1000 )
1091 outsw(ioaddr + DATAPORT, buf, (length + 1) >> 1); 1091 outsw(ioaddr + DATAPORT, buf, (length + 1) >> 1);
1092 else { 1092 else {
1093 unsigned char frag = length % 4; 1093 unsigned char frag = length % 4;
1094 outsl(ioaddr + DATAPORT, buf, length >> 2); 1094 outsl(ioaddr + DATAPORT, buf, length >> 2);
1095 if( frag != 0 ) { 1095 if( frag != 0 ) {
1096 outsw(ioaddr + DATAPORT, (buf + (length & 0xFFFC)), 1); 1096 outsw(ioaddr + DATAPORT, (buf + (length & 0xFFFC)), 1);
1097 if( frag == 3 ) 1097 if( frag == 3 )
1098 outsw(ioaddr + DATAPORT, 1098 outsw(ioaddr + DATAPORT,
1099 (buf + (length & 0xFFFC) + 2), 1); 1099 (buf + (length & 0xFFFC) + 2), 1);
1100 } 1100 }
1101 } 1101 }
@@ -1119,9 +1119,9 @@ static int eth16i_tx(struct sk_buff *skb, struct net_device *dev)
1119 /* There is still more room for one more packet in tx buffer */ 1119 /* There is still more room for one more packet in tx buffer */
1120 netif_wake_queue(dev); 1120 netif_wake_queue(dev);
1121 } 1121 }
1122 1122
1123 spin_unlock_irqrestore(&lp->lock, flags); 1123 spin_unlock_irqrestore(&lp->lock, flags);
1124 1124
1125 outw(ETH16I_INTR_ON, ioaddr + TX_INTR_REG); 1125 outw(ETH16I_INTR_ON, ioaddr + TX_INTR_REG);
1126 /* Turn TX interrupts back on */ 1126 /* Turn TX interrupts back on */
1127 /* outb(TX_INTR_DONE | TX_INTR_16_COL, ioaddr + TX_INTR_REG); */ 1127 /* outb(TX_INTR_DONE | TX_INTR_16_COL, ioaddr + TX_INTR_REG); */
@@ -1139,36 +1139,36 @@ static void eth16i_rx(struct net_device *dev)
1139 /* Loop until all packets have been read */ 1139 /* Loop until all packets have been read */
1140 while( (inb(ioaddr + RECEIVE_MODE_REG) & RX_BUFFER_EMPTY) == 0) { 1140 while( (inb(ioaddr + RECEIVE_MODE_REG) & RX_BUFFER_EMPTY) == 0) {
1141 1141
1142 /* Read status byte from receive buffer */ 1142 /* Read status byte from receive buffer */
1143 ushort status = inw(ioaddr + DATAPORT); 1143 ushort status = inw(ioaddr + DATAPORT);
1144 1144
1145 /* Get the size of the packet from receive buffer */ 1145 /* Get the size of the packet from receive buffer */
1146 ushort pkt_len = inw(ioaddr + DATAPORT); 1146 ushort pkt_len = inw(ioaddr + DATAPORT);
1147 1147
1148 if(eth16i_debug > 4) 1148 if(eth16i_debug > 4)
1149 printk(KERN_DEBUG "%s: Receiving packet mode %02x status %04x.\n", 1149 printk(KERN_DEBUG "%s: Receiving packet mode %02x status %04x.\n",
1150 dev->name, 1150 dev->name,
1151 inb(ioaddr + RECEIVE_MODE_REG), status); 1151 inb(ioaddr + RECEIVE_MODE_REG), status);
1152 1152
1153 if( !(status & PKT_GOOD) ) { 1153 if( !(status & PKT_GOOD) ) {
1154 lp->stats.rx_errors++; 1154 lp->stats.rx_errors++;
1155 1155
1156 if( (pkt_len < ETH_ZLEN) || (pkt_len > ETH_FRAME_LEN) ) { 1156 if( (pkt_len < ETH_ZLEN) || (pkt_len > ETH_FRAME_LEN) ) {
1157 lp->stats.rx_length_errors++; 1157 lp->stats.rx_length_errors++;
1158 eth16i_reset(dev); 1158 eth16i_reset(dev);
1159 return; 1159 return;
1160 } 1160 }
1161 else { 1161 else {
1162 eth16i_skip_packet(dev); 1162 eth16i_skip_packet(dev);
1163 lp->stats.rx_dropped++; 1163 lp->stats.rx_dropped++;
1164 } 1164 }
1165 } 1165 }
1166 else { /* Ok so now we should have a good packet */ 1166 else { /* Ok so now we should have a good packet */
1167 struct sk_buff *skb; 1167 struct sk_buff *skb;
1168 1168
1169 skb = dev_alloc_skb(pkt_len + 3); 1169 skb = dev_alloc_skb(pkt_len + 3);
1170 if( skb == NULL ) { 1170 if( skb == NULL ) {
1171 printk(KERN_WARNING "%s: Could'n allocate memory for packet (len %d)\n", 1171 printk(KERN_WARNING "%s: Could'n allocate memory for packet (len %d)\n",
1172 dev->name, pkt_len); 1172 dev->name, pkt_len);
1173 eth16i_skip_packet(dev); 1173 eth16i_skip_packet(dev);
1174 lp->stats.rx_dropped++; 1174 lp->stats.rx_dropped++;
@@ -1177,17 +1177,17 @@ static void eth16i_rx(struct net_device *dev)
1177 1177
1178 skb->dev = dev; 1178 skb->dev = dev;
1179 skb_reserve(skb,2); 1179 skb_reserve(skb,2);
1180 1180
1181 /* 1181 /*
1182 Now let's get the packet out of buffer. 1182 Now let's get the packet out of buffer.
1183 size is (pkt_len + 1) >> 1, cause we are now reading words 1183 size is (pkt_len + 1) >> 1, cause we are now reading words
1184 and it have to be even aligned. 1184 and it have to be even aligned.
1185 */ 1185 */
1186 1186
1187 if(ioaddr < 0x1000) 1187 if(ioaddr < 0x1000)
1188 insw(ioaddr + DATAPORT, skb_put(skb, pkt_len), 1188 insw(ioaddr + DATAPORT, skb_put(skb, pkt_len),
1189 (pkt_len + 1) >> 1); 1189 (pkt_len + 1) >> 1);
1190 else { 1190 else {
1191 unsigned char *buf = skb_put(skb, pkt_len); 1191 unsigned char *buf = skb_put(skb, pkt_len);
1192 unsigned char frag = pkt_len % 4; 1192 unsigned char frag = pkt_len % 4;
1193 1193
@@ -1207,9 +1207,9 @@ static void eth16i_rx(struct net_device *dev)
1207 1207
1208 if( eth16i_debug > 5 ) { 1208 if( eth16i_debug > 5 ) {
1209 int i; 1209 int i;
1210 printk(KERN_DEBUG "%s: Received packet of length %d.\n", 1210 printk(KERN_DEBUG "%s: Received packet of length %d.\n",
1211 dev->name, pkt_len); 1211 dev->name, pkt_len);
1212 for(i = 0; i < 14; i++) 1212 for(i = 0; i < 14; i++)
1213 printk(KERN_DEBUG " %02x", skb->data[i]); 1213 printk(KERN_DEBUG " %02x", skb->data[i]);
1214 printk(KERN_DEBUG ".\n"); 1214 printk(KERN_DEBUG ".\n");
1215 } 1215 }
@@ -1255,7 +1255,7 @@ static irqreturn_t eth16i_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1255 1255
1256 lp->stats.rx_errors++; 1256 lp->stats.rx_errors++;
1257 1257
1258 if(status & (BUS_RD_ERR << 8) ) 1258 if(status & (BUS_RD_ERR << 8) )
1259 printk(KERN_WARNING "%s: Bus read error.\n",dev->name); 1259 printk(KERN_WARNING "%s: Bus read error.\n",dev->name);
1260 if(status & (SHORT_PKT_ERR << 8) ) lp->stats.rx_length_errors++; 1260 if(status & (SHORT_PKT_ERR << 8) ) lp->stats.rx_length_errors++;
1261 if(status & (ALIGN_ERR << 8) ) lp->stats.rx_frame_errors++; 1261 if(status & (ALIGN_ERR << 8) ) lp->stats.rx_frame_errors++;
@@ -1269,14 +1269,14 @@ static irqreturn_t eth16i_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1269 if(status & CR_LOST) lp->stats.tx_carrier_errors++; 1269 if(status & CR_LOST) lp->stats.tx_carrier_errors++;
1270 if(status & TX_JABBER_ERR) lp->stats.tx_window_errors++; 1270 if(status & TX_JABBER_ERR) lp->stats.tx_window_errors++;
1271 1271
1272#if 0 1272#if 0
1273 if(status & COLLISION) { 1273 if(status & COLLISION) {
1274 lp->stats.collisions += 1274 lp->stats.collisions +=
1275 ((inb(ioaddr+TRANSMIT_MODE_REG) & 0xF0) >> 4); 1275 ((inb(ioaddr+TRANSMIT_MODE_REG) & 0xF0) >> 4);
1276 } 1276 }
1277#endif 1277#endif
1278 if(status & COLLISIONS_16) { 1278 if(status & COLLISIONS_16) {
1279 if(lp->col_16 < MAX_COL_16) { 1279 if(lp->col_16 < MAX_COL_16) {
1280 lp->col_16++; 1280 lp->col_16++;
1281 lp->stats.collisions++; 1281 lp->stats.collisions++;
1282 /* Resume transmitting, skip failed packet */ 1282 /* Resume transmitting, skip failed packet */
@@ -1293,7 +1293,7 @@ static irqreturn_t eth16i_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1293 if(status & TX_DONE) { /* The transmit has been done */ 1293 if(status & TX_DONE) { /* The transmit has been done */
1294 lp->stats.tx_packets = lp->tx_buffered_packets; 1294 lp->stats.tx_packets = lp->tx_buffered_packets;
1295 lp->stats.tx_bytes += lp->tx_buffered_bytes; 1295 lp->stats.tx_bytes += lp->tx_buffered_bytes;
1296 lp->col_16 = 0; 1296 lp->col_16 = 0;
1297 1297
1298 if(lp->tx_queue) { /* Is there still packets ? */ 1298 if(lp->tx_queue) { /* Is there still packets ? */
1299 /* There was packet(s) so start transmitting and write also 1299 /* There was packet(s) so start transmitting and write also
@@ -1310,26 +1310,26 @@ static irqreturn_t eth16i_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1310 } 1310 }
1311 } 1311 }
1312 1312
1313 if( ( status & 0x8000 ) || 1313 if( ( status & 0x8000 ) ||
1314 ( (inb(ioaddr + RECEIVE_MODE_REG) & RX_BUFFER_EMPTY) == 0) ) { 1314 ( (inb(ioaddr + RECEIVE_MODE_REG) & RX_BUFFER_EMPTY) == 0) ) {
1315 eth16i_rx(dev); /* We have packet in receive buffer */ 1315 eth16i_rx(dev); /* We have packet in receive buffer */
1316 } 1316 }
1317 1317
1318 /* Turn interrupts back on */ 1318 /* Turn interrupts back on */
1319 outw(ETH16I_INTR_ON, ioaddr + TX_INTR_REG); 1319 outw(ETH16I_INTR_ON, ioaddr + TX_INTR_REG);
1320 1320
1321 if(lp->tx_queue_len < lp->tx_buf_size - (ETH_FRAME_LEN + 2)) { 1321 if(lp->tx_queue_len < lp->tx_buf_size - (ETH_FRAME_LEN + 2)) {
1322 /* There is still more room for one more packet in tx buffer */ 1322 /* There is still more room for one more packet in tx buffer */
1323 netif_wake_queue(dev); 1323 netif_wake_queue(dev);
1324 } 1324 }
1325 1325
1326 spin_unlock(&lp->lock); 1326 spin_unlock(&lp->lock);
1327 1327
1328 return IRQ_RETVAL(handled); 1328 return IRQ_RETVAL(handled);
1329} 1329}
1330 1330
1331static void eth16i_skip_packet(struct net_device *dev) 1331static void eth16i_skip_packet(struct net_device *dev)
1332{ 1332{
1333 int ioaddr = dev->base_addr; 1333 int ioaddr = dev->base_addr;
1334 1334
1335 inw(ioaddr + DATAPORT); 1335 inw(ioaddr + DATAPORT);
@@ -1345,28 +1345,28 @@ static void eth16i_reset(struct net_device *dev)
1345 struct eth16i_local *lp = netdev_priv(dev); 1345 struct eth16i_local *lp = netdev_priv(dev);
1346 int ioaddr = dev->base_addr; 1346 int ioaddr = dev->base_addr;
1347 1347
1348 if(eth16i_debug > 1) 1348 if(eth16i_debug > 1)
1349 printk(KERN_DEBUG "%s: Resetting device.\n", dev->name); 1349 printk(KERN_DEBUG "%s: Resetting device.\n", dev->name);
1350 1350
1351 BITSET(ioaddr + CONFIG_REG_0, DLC_EN); 1351 BITSET(ioaddr + CONFIG_REG_0, DLC_EN);
1352 outw(0xffff, ioaddr + TX_STATUS_REG); 1352 outw(0xffff, ioaddr + TX_STATUS_REG);
1353 eth16i_select_regbank(2, ioaddr); 1353 eth16i_select_regbank(2, ioaddr);
1354 1354
1355 lp->tx_started = 0; 1355 lp->tx_started = 0;
1356 lp->tx_buf_busy = 0; 1356 lp->tx_buf_busy = 0;
1357 lp->tx_queue = 0; 1357 lp->tx_queue = 0;
1358 lp->tx_queue_len = 0; 1358 lp->tx_queue_len = 0;
1359 BITCLR(ioaddr + CONFIG_REG_0, DLC_EN); 1359 BITCLR(ioaddr + CONFIG_REG_0, DLC_EN);
1360} 1360}
1361 1361
1362static void eth16i_multicast(struct net_device *dev) 1362static void eth16i_multicast(struct net_device *dev)
1363{ 1363{
1364 int ioaddr = dev->base_addr; 1364 int ioaddr = dev->base_addr;
1365 1365
1366 if(dev->mc_count || dev->flags&(IFF_ALLMULTI|IFF_PROMISC)) 1366 if(dev->mc_count || dev->flags&(IFF_ALLMULTI|IFF_PROMISC))
1367 { 1367 {
1368 dev->flags|=IFF_PROMISC; /* Must do this */ 1368 dev->flags|=IFF_PROMISC; /* Must do this */
1369 outb(3, ioaddr + RECEIVE_MODE_REG); 1369 outb(3, ioaddr + RECEIVE_MODE_REG);
1370 } else { 1370 } else {
1371 outb(2, ioaddr + RECEIVE_MODE_REG); 1371 outb(2, ioaddr + RECEIVE_MODE_REG);
1372 } 1372 }
@@ -1383,7 +1383,7 @@ static void eth16i_select_regbank(unsigned char banknbr, int ioaddr)
1383 unsigned char data; 1383 unsigned char data;
1384 1384
1385 data = inb(ioaddr + CONFIG_REG_1); 1385 data = inb(ioaddr + CONFIG_REG_1);
1386 outb( ((data & 0xF3) | ( (banknbr & 0x03) << 2)), ioaddr + CONFIG_REG_1); 1386 outb( ((data & 0xF3) | ( (banknbr & 0x03) << 2)), ioaddr + CONFIG_REG_1);
1387} 1387}
1388 1388
1389#ifdef MODULE 1389#ifdef MODULE
@@ -1392,7 +1392,7 @@ static ushort eth16i_parse_mediatype(const char* s)
1392{ 1392{
1393 if(!s) 1393 if(!s)
1394 return E_PORT_FROM_EPROM; 1394 return E_PORT_FROM_EPROM;
1395 1395
1396 if (!strncmp(s, "bnc", 3)) 1396 if (!strncmp(s, "bnc", 3))
1397 return E_PORT_BNC; 1397 return E_PORT_BNC;
1398 else if (!strncmp(s, "tp", 2)) 1398 else if (!strncmp(s, "tp", 2))
@@ -1474,14 +1474,14 @@ int __init init_module(void)
1474 return 0; 1474 return 0;
1475 return -ENXIO; 1475 return -ENXIO;
1476} 1476}
1477 1477
1478void cleanup_module(void) 1478void cleanup_module(void)
1479{ 1479{
1480 int this_dev; 1480 int this_dev;
1481 1481
1482 for(this_dev = 0; this_dev < MAX_ETH16I_CARDS; this_dev++) { 1482 for(this_dev = 0; this_dev < MAX_ETH16I_CARDS; this_dev++) {
1483 struct net_device *dev = dev_eth16i[this_dev]; 1483 struct net_device *dev = dev_eth16i[this_dev];
1484 1484
1485 if(dev->priv) { 1485 if(dev->priv) {
1486 unregister_netdev(dev); 1486 unregister_netdev(dev);
1487 free_irq(dev->irq, dev); 1487 free_irq(dev->irq, dev);