diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2013-01-10 18:25:04 -0500 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2013-01-22 10:39:52 -0500 |
commit | d2477de7a63a332a8fe75008fa87e05290c5caac (patch) | |
tree | a268c30a46f21bc62e19b07f4f2a4ef0ef31b35d /drivers | |
parent | 04861c535d1f5bad0fd537820116c0429a2dfe4b (diff) |
drivers/net: delete old 8 bit ISA Racal ni5010 support.
These cards were only available in 8bit format, and in addition
they only had AUI and BNC(10-Base2) interfaces (i.e. no RJ-45).
In fact, they are so rare, that an internet search on these old
cards almost comes up empty, unless the "Micom interlan" name
is used.
This puts them in the equivalent domain as the 3c501, so there
should be no strong opposition to the driver removal, as nobody
is seriously using 3.9+ with 8 bit ISA hardware.
In doing so, the whole "ethernet/racal" category becomes empty,
so we clean up the Makefile/Kconfig and subdir appropriately.
Cc: Andreas Mohr <andi@lisas.de>
Cc: Jan-Pascal van Best <janpascal@vanbest.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/Space.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/Kconfig | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/Makefile | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/racal/Kconfig | 33 | ||||
-rw-r--r-- | drivers/net/ethernet/racal/Makefile | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/racal/ni5010.c | 771 | ||||
-rw-r--r-- | drivers/net/ethernet/racal/ni5010.h | 144 |
7 files changed, 0 insertions, 959 deletions
diff --git a/drivers/net/Space.c b/drivers/net/Space.c index b69dac1df344..4141c6465683 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c | |||
@@ -50,7 +50,6 @@ extern struct net_device *eth16i_probe(int unit); | |||
50 | extern struct net_device *i82596_probe(int unit); | 50 | extern struct net_device *i82596_probe(int unit); |
51 | extern struct net_device *ewrk3_probe(int unit); | 51 | extern struct net_device *ewrk3_probe(int unit); |
52 | extern struct net_device *e2100_probe(int unit); | 52 | extern struct net_device *e2100_probe(int unit); |
53 | extern struct net_device *ni5010_probe(int unit); | ||
54 | extern struct net_device *ni65_probe(int unit); | 53 | extern struct net_device *ni65_probe(int unit); |
55 | extern struct net_device *sonic_probe(int unit); | 54 | extern struct net_device *sonic_probe(int unit); |
56 | extern struct net_device *seeq8005_probe(int unit); | 55 | extern struct net_device *seeq8005_probe(int unit); |
@@ -153,9 +152,6 @@ static struct devprobe2 isa_probes[] __initdata = { | |||
153 | #if defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET) /* Intel I82596 */ | 152 | #if defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET) /* Intel I82596 */ |
154 | {i82596_probe, 0}, | 153 | {i82596_probe, 0}, |
155 | #endif | 154 | #endif |
156 | #ifdef CONFIG_NI5010 | ||
157 | {ni5010_probe, 0}, | ||
158 | #endif | ||
159 | #ifdef CONFIG_NI65 | 155 | #ifdef CONFIG_NI65 |
160 | {ni65_probe, 0}, | 156 | {ni65_probe, 0}, |
161 | #endif | 157 | #endif |
diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig index e4ff38949112..ed956e08d38b 100644 --- a/drivers/net/ethernet/Kconfig +++ b/drivers/net/ethernet/Kconfig | |||
@@ -135,7 +135,6 @@ config ETHOC | |||
135 | source "drivers/net/ethernet/packetengines/Kconfig" | 135 | source "drivers/net/ethernet/packetengines/Kconfig" |
136 | source "drivers/net/ethernet/pasemi/Kconfig" | 136 | source "drivers/net/ethernet/pasemi/Kconfig" |
137 | source "drivers/net/ethernet/qlogic/Kconfig" | 137 | source "drivers/net/ethernet/qlogic/Kconfig" |
138 | source "drivers/net/ethernet/racal/Kconfig" | ||
139 | source "drivers/net/ethernet/realtek/Kconfig" | 138 | source "drivers/net/ethernet/realtek/Kconfig" |
140 | source "drivers/net/ethernet/renesas/Kconfig" | 139 | source "drivers/net/ethernet/renesas/Kconfig" |
141 | source "drivers/net/ethernet/rdc/Kconfig" | 140 | source "drivers/net/ethernet/rdc/Kconfig" |
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile index d4473072654a..8268d85f9448 100644 --- a/drivers/net/ethernet/Makefile +++ b/drivers/net/ethernet/Makefile | |||
@@ -53,7 +53,6 @@ obj-$(CONFIG_ETHOC) += ethoc.o | |||
53 | obj-$(CONFIG_NET_PACKET_ENGINE) += packetengines/ | 53 | obj-$(CONFIG_NET_PACKET_ENGINE) += packetengines/ |
54 | obj-$(CONFIG_NET_VENDOR_PASEMI) += pasemi/ | 54 | obj-$(CONFIG_NET_VENDOR_PASEMI) += pasemi/ |
55 | obj-$(CONFIG_NET_VENDOR_QLOGIC) += qlogic/ | 55 | obj-$(CONFIG_NET_VENDOR_QLOGIC) += qlogic/ |
56 | obj-$(CONFIG_NET_VENDOR_RACAL) += racal/ | ||
57 | obj-$(CONFIG_NET_VENDOR_REALTEK) += realtek/ | 56 | obj-$(CONFIG_NET_VENDOR_REALTEK) += realtek/ |
58 | obj-$(CONFIG_SH_ETH) += renesas/ | 57 | obj-$(CONFIG_SH_ETH) += renesas/ |
59 | obj-$(CONFIG_NET_VENDOR_RDC) += rdc/ | 58 | obj-$(CONFIG_NET_VENDOR_RDC) += rdc/ |
diff --git a/drivers/net/ethernet/racal/Kconfig b/drivers/net/ethernet/racal/Kconfig deleted file mode 100644 index 01969e0a9c68..000000000000 --- a/drivers/net/ethernet/racal/Kconfig +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | # | ||
2 | # Racal-Interlan device configuration | ||
3 | # | ||
4 | |||
5 | config NET_VENDOR_RACAL | ||
6 | bool "Racal-Interlan (Micom) NI devices" | ||
7 | default y | ||
8 | depends on ISA | ||
9 | ---help--- | ||
10 | If you have a network (Ethernet) card belonging to this class, such | ||
11 | as the NI5010, NI5210 or NI6210, say Y and read the Ethernet-HOWTO, | ||
12 | available from <http://www.tldp.org/docs.html#howto>. | ||
13 | |||
14 | Note that the answer to this question doesn't directly affect the | ||
15 | kernel: saying N will just cause the configurator to skip all | ||
16 | the questions about NI cards. If you say Y, you will be asked for | ||
17 | your specific card in the following questions. | ||
18 | |||
19 | if NET_VENDOR_RACAL | ||
20 | |||
21 | config NI5010 | ||
22 | tristate "NI5010 support (EXPERIMENTAL)" | ||
23 | depends on ISA && EXPERIMENTAL && BROKEN_ON_SMP | ||
24 | ---help--- | ||
25 | If you have a network (Ethernet) card of this type, say Y and read | ||
26 | the Ethernet-HOWTO, available from | ||
27 | <http://www.tldp.org/docs.html#howto>. Note that this is still | ||
28 | experimental code. | ||
29 | |||
30 | To compile this driver as a module, choose M here. The module | ||
31 | will be called ni5010. | ||
32 | |||
33 | endif # NET_VENDOR_RACAL | ||
diff --git a/drivers/net/ethernet/racal/Makefile b/drivers/net/ethernet/racal/Makefile deleted file mode 100644 index 1e210ca1d78b..000000000000 --- a/drivers/net/ethernet/racal/Makefile +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the Racal-Interlan network device drivers. | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_NI5010) += ni5010.o | ||
diff --git a/drivers/net/ethernet/racal/ni5010.c b/drivers/net/ethernet/racal/ni5010.c deleted file mode 100644 index 807982220050..000000000000 --- a/drivers/net/ethernet/racal/ni5010.c +++ /dev/null | |||
@@ -1,771 +0,0 @@ | |||
1 | /* ni5010.c: A network driver for the MiCom-Interlan NI5010 ethercard. | ||
2 | * | ||
3 | * Copyright 1996,1997,2006 Jan-Pascal van Best and Andreas Mohr. | ||
4 | * | ||
5 | * This software may be used and distributed according to the terms | ||
6 | * of the GNU General Public License, incorporated herein by reference. | ||
7 | * | ||
8 | * The authors may be reached as: | ||
9 | * janpascal@vanbest.org andi@lisas.de | ||
10 | * | ||
11 | * Sources: | ||
12 | * Donald Becker's "skeleton.c" | ||
13 | * Crynwr ni5010 packet driver | ||
14 | * | ||
15 | * Changes: | ||
16 | * v0.0: First test version | ||
17 | * v0.1: First working version | ||
18 | * v0.2: | ||
19 | * v0.3->v0.90: Now demand setting io and irq when loading as module | ||
20 | * 970430 v0.91: modified for Linux 2.1.14 | ||
21 | * v0.92: Implemented Andreas' (better) NI5010 probe | ||
22 | * 970503 v0.93: Fixed auto-irq failure on warm reboot (JB) | ||
23 | * 970623 v1.00: First kernel version (AM) | ||
24 | * 970814 v1.01: Added detection of onboard receive buffer size (AM) | ||
25 | * 060611 v1.02: slight cleanup: email addresses, driver modernization. | ||
26 | * Bugs: | ||
27 | * - not SMP-safe (no locking of I/O accesses) | ||
28 | * - Note that you have to patch ifconfig for the new /proc/net/dev | ||
29 | * format. It gives incorrect stats otherwise. | ||
30 | * | ||
31 | * To do: | ||
32 | * Fix all bugs :-) | ||
33 | * Move some stuff to chipset_init() | ||
34 | * Handle xmt errors other than collisions | ||
35 | * Complete merge with Andreas' driver | ||
36 | * Implement ring buffers (Is this useful? You can't squeeze | ||
37 | * too many packet in a 2k buffer!) | ||
38 | * Implement DMA (Again, is this useful? Some docs say DMA is | ||
39 | * slower than programmed I/O) | ||
40 | * | ||
41 | * Compile with: | ||
42 | * gcc -O2 -fomit-frame-pointer -m486 -D__KERNEL__ \ | ||
43 | * -DMODULE -c ni5010.c | ||
44 | * | ||
45 | * Insert with e.g.: | ||
46 | * insmod ni5010.ko io=0x300 irq=5 | ||
47 | */ | ||
48 | |||
49 | #include <linux/module.h> | ||
50 | #include <linux/kernel.h> | ||
51 | #include <linux/string.h> | ||
52 | #include <linux/errno.h> | ||
53 | #include <linux/ioport.h> | ||
54 | #include <linux/interrupt.h> | ||
55 | #include <linux/delay.h> | ||
56 | #include <linux/init.h> | ||
57 | #include <linux/bitops.h> | ||
58 | #include <asm/io.h> | ||
59 | #include <asm/dma.h> | ||
60 | |||
61 | #include <linux/netdevice.h> | ||
62 | #include <linux/etherdevice.h> | ||
63 | #include <linux/skbuff.h> | ||
64 | |||
65 | #include "ni5010.h" | ||
66 | |||
67 | static const char boardname[] = "NI5010"; | ||
68 | static char version[] __initdata = | ||
69 | "ni5010.c: v1.02 20060611 Jan-Pascal van Best and Andreas Mohr\n"; | ||
70 | |||
71 | /* bufsize_rcv == 0 means autoprobing */ | ||
72 | static unsigned int bufsize_rcv; | ||
73 | |||
74 | #define JUMPERED_INTERRUPTS /* IRQ line jumpered on board */ | ||
75 | #undef JUMPERED_DMA /* No DMA used */ | ||
76 | #undef FULL_IODETECT /* Only detect in portlist */ | ||
77 | |||
78 | #ifndef FULL_IODETECT | ||
79 | /* A zero-terminated list of I/O addresses to be probed. */ | ||
80 | static unsigned int ports[] __initdata = | ||
81 | { 0x300, 0x320, 0x340, 0x360, 0x380, 0x3a0, 0 }; | ||
82 | #endif | ||
83 | |||
84 | /* Use 0 for production, 1 for verification, >2 for debug */ | ||
85 | #ifndef NI5010_DEBUG | ||
86 | #define NI5010_DEBUG 0 | ||
87 | #endif | ||
88 | |||
89 | /* Information that needs to be kept for each board. */ | ||
90 | struct ni5010_local { | ||
91 | int o_pkt_size; | ||
92 | spinlock_t lock; | ||
93 | }; | ||
94 | |||
95 | /* Index to functions, as function prototypes. */ | ||
96 | |||
97 | static int ni5010_probe1(struct net_device *dev, int ioaddr); | ||
98 | static int ni5010_open(struct net_device *dev); | ||
99 | static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev); | ||
100 | static irqreturn_t ni5010_interrupt(int irq, void *dev_id); | ||
101 | static void ni5010_rx(struct net_device *dev); | ||
102 | static void ni5010_timeout(struct net_device *dev); | ||
103 | static int ni5010_close(struct net_device *dev); | ||
104 | static void ni5010_set_multicast_list(struct net_device *dev); | ||
105 | static void reset_receiver(struct net_device *dev); | ||
106 | |||
107 | static int process_xmt_interrupt(struct net_device *dev); | ||
108 | #define tx_done(dev) 1 | ||
109 | static void hardware_send_packet(struct net_device *dev, char *buf, int length, int pad); | ||
110 | static void chipset_init(struct net_device *dev, int startp); | ||
111 | static void dump_packet(void *buf, int len); | ||
112 | static void ni5010_show_registers(struct net_device *dev); | ||
113 | |||
114 | static int io; | ||
115 | static int irq; | ||
116 | |||
117 | struct net_device * __init ni5010_probe(int unit) | ||
118 | { | ||
119 | struct net_device *dev = alloc_etherdev(sizeof(struct ni5010_local)); | ||
120 | int *port; | ||
121 | int err = 0; | ||
122 | |||
123 | if (!dev) | ||
124 | return ERR_PTR(-ENOMEM); | ||
125 | |||
126 | if (unit >= 0) { | ||
127 | sprintf(dev->name, "eth%d", unit); | ||
128 | netdev_boot_setup_check(dev); | ||
129 | io = dev->base_addr; | ||
130 | irq = dev->irq; | ||
131 | } | ||
132 | |||
133 | PRINTK2((KERN_DEBUG "%s: Entering ni5010_probe\n", dev->name)); | ||
134 | |||
135 | if (io > 0x1ff) { /* Check a single specified location. */ | ||
136 | err = ni5010_probe1(dev, io); | ||
137 | } else if (io != 0) { /* Don't probe at all. */ | ||
138 | err = -ENXIO; | ||
139 | } else { | ||
140 | #ifdef FULL_IODETECT | ||
141 | for (io=0x200; io<0x400 && ni5010_probe1(dev, io) ; io+=0x20) | ||
142 | ; | ||
143 | if (io == 0x400) | ||
144 | err = -ENODEV; | ||
145 | |||
146 | #else | ||
147 | for (port = ports; *port && ni5010_probe1(dev, *port); port++) | ||
148 | ; | ||
149 | if (!*port) | ||
150 | err = -ENODEV; | ||
151 | #endif /* FULL_IODETECT */ | ||
152 | } | ||
153 | if (err) | ||
154 | goto out; | ||
155 | err = register_netdev(dev); | ||
156 | if (err) | ||
157 | goto out1; | ||
158 | return dev; | ||
159 | out1: | ||
160 | release_region(dev->base_addr, NI5010_IO_EXTENT); | ||
161 | out: | ||
162 | free_netdev(dev); | ||
163 | return ERR_PTR(err); | ||
164 | } | ||
165 | |||
166 | static inline int rd_port(int ioaddr) | ||
167 | { | ||
168 | inb(IE_RBUF); | ||
169 | return inb(IE_SAPROM); | ||
170 | } | ||
171 | |||
172 | static void __init trigger_irq(int ioaddr) | ||
173 | { | ||
174 | outb(0x00, EDLC_RESET); /* Clear EDLC hold RESET state */ | ||
175 | outb(0x00, IE_RESET); /* Board reset */ | ||
176 | outb(0x00, EDLC_XMASK); /* Disable all Xmt interrupts */ | ||
177 | outb(0x00, EDLC_RMASK); /* Disable all Rcv interrupt */ | ||
178 | outb(0xff, EDLC_XCLR); /* Clear all pending Xmt interrupts */ | ||
179 | outb(0xff, EDLC_RCLR); /* Clear all pending Rcv interrupts */ | ||
180 | /* | ||
181 | * Transmit packet mode: Ignore parity, Power xcvr, | ||
182 | * Enable loopback | ||
183 | */ | ||
184 | outb(XMD_IG_PAR | XMD_T_MODE | XMD_LBC, EDLC_XMODE); | ||
185 | outb(RMD_BROADCAST, EDLC_RMODE); /* Receive normal&broadcast */ | ||
186 | outb(XM_ALL, EDLC_XMASK); /* Enable all Xmt interrupts */ | ||
187 | udelay(50); /* FIXME: Necessary? */ | ||
188 | outb(MM_EN_XMT|MM_MUX, IE_MMODE); /* Start transmission */ | ||
189 | } | ||
190 | |||
191 | static const struct net_device_ops ni5010_netdev_ops = { | ||
192 | .ndo_open = ni5010_open, | ||
193 | .ndo_stop = ni5010_close, | ||
194 | .ndo_start_xmit = ni5010_send_packet, | ||
195 | .ndo_set_rx_mode = ni5010_set_multicast_list, | ||
196 | .ndo_tx_timeout = ni5010_timeout, | ||
197 | .ndo_validate_addr = eth_validate_addr, | ||
198 | .ndo_set_mac_address = eth_mac_addr, | ||
199 | .ndo_change_mtu = eth_change_mtu, | ||
200 | }; | ||
201 | |||
202 | /* | ||
203 | * This is the real probe routine. Linux has a history of friendly device | ||
204 | * probes on the ISA bus. A good device probes avoids doing writes, and | ||
205 | * verifies that the correct device exists and functions. | ||
206 | */ | ||
207 | |||
208 | static int __init ni5010_probe1(struct net_device *dev, int ioaddr) | ||
209 | { | ||
210 | static unsigned version_printed; | ||
211 | struct ni5010_local *lp; | ||
212 | int i; | ||
213 | unsigned int data = 0; | ||
214 | int boguscount = 40; | ||
215 | int err = -ENODEV; | ||
216 | |||
217 | dev->base_addr = ioaddr; | ||
218 | dev->irq = irq; | ||
219 | |||
220 | if (!request_region(ioaddr, NI5010_IO_EXTENT, boardname)) | ||
221 | return -EBUSY; | ||
222 | |||
223 | /* | ||
224 | * This is no "official" probe method, I've rather tested which | ||
225 | * probe works best with my seven NI5010 cards | ||
226 | * (they have very different serial numbers) | ||
227 | * Suggestions or failure reports are very, very welcome ! | ||
228 | * But I think it is a relatively good probe method | ||
229 | * since it doesn't use any "outb" | ||
230 | * It should be nearly 100% reliable ! | ||
231 | * well-known WARNING: this probe method (like many others) | ||
232 | * will hang the system if a NE2000 card region is probed ! | ||
233 | * | ||
234 | * - Andreas | ||
235 | */ | ||
236 | |||
237 | PRINTK2((KERN_DEBUG "%s: entering ni5010_probe1(%#3x)\n", | ||
238 | dev->name, ioaddr)); | ||
239 | |||
240 | if (inb(ioaddr+0) == 0xff) | ||
241 | goto out; | ||
242 | |||
243 | while ( (rd_port(ioaddr) & rd_port(ioaddr) & rd_port(ioaddr) & | ||
244 | rd_port(ioaddr) & rd_port(ioaddr) & rd_port(ioaddr)) != 0xff) | ||
245 | { | ||
246 | if (boguscount-- == 0) | ||
247 | goto out; | ||
248 | } | ||
249 | |||
250 | PRINTK2((KERN_DEBUG "%s: I/O #1 passed!\n", dev->name)); | ||
251 | |||
252 | for (i=0; i<32; i++) | ||
253 | if ( (data = rd_port(ioaddr)) != 0xff) break; | ||
254 | if (data==0xff) | ||
255 | goto out; | ||
256 | |||
257 | PRINTK2((KERN_DEBUG "%s: I/O #2 passed!\n", dev->name)); | ||
258 | |||
259 | if ((data != SA_ADDR0) || (rd_port(ioaddr) != SA_ADDR1) || | ||
260 | (rd_port(ioaddr) != SA_ADDR2)) | ||
261 | goto out; | ||
262 | |||
263 | for (i=0; i<4; i++) | ||
264 | rd_port(ioaddr); | ||
265 | |||
266 | if ( (rd_port(ioaddr) != NI5010_MAGICVAL1) || | ||
267 | (rd_port(ioaddr) != NI5010_MAGICVAL2) ) | ||
268 | goto out; | ||
269 | |||
270 | PRINTK2((KERN_DEBUG "%s: I/O #3 passed!\n", dev->name)); | ||
271 | |||
272 | if (NI5010_DEBUG && version_printed++ == 0) | ||
273 | printk(KERN_INFO "%s", version); | ||
274 | |||
275 | printk("NI5010 ethercard probe at 0x%x: ", ioaddr); | ||
276 | |||
277 | dev->base_addr = ioaddr; | ||
278 | |||
279 | for (i=0; i<6; i++) { | ||
280 | outw(i, IE_GP); | ||
281 | dev->dev_addr[i] = inb(IE_SAPROM); | ||
282 | } | ||
283 | printk("%pM ", dev->dev_addr); | ||
284 | |||
285 | PRINTK2((KERN_DEBUG "%s: I/O #4 passed!\n", dev->name)); | ||
286 | |||
287 | #ifdef JUMPERED_INTERRUPTS | ||
288 | if (dev->irq == 0xff) | ||
289 | ; | ||
290 | else if (dev->irq < 2) { | ||
291 | unsigned long irq_mask; | ||
292 | |||
293 | PRINTK2((KERN_DEBUG "%s: I/O #5 passed!\n", dev->name)); | ||
294 | |||
295 | irq_mask = probe_irq_on(); | ||
296 | trigger_irq(ioaddr); | ||
297 | mdelay(20); | ||
298 | dev->irq = probe_irq_off(irq_mask); | ||
299 | |||
300 | PRINTK2((KERN_DEBUG "%s: I/O #6 passed!\n", dev->name)); | ||
301 | |||
302 | if (dev->irq == 0) { | ||
303 | err = -EAGAIN; | ||
304 | printk(KERN_WARNING "%s: no IRQ found!\n", dev->name); | ||
305 | goto out; | ||
306 | } | ||
307 | PRINTK2((KERN_DEBUG "%s: I/O #7 passed!\n", dev->name)); | ||
308 | } else if (dev->irq == 2) { | ||
309 | dev->irq = 9; | ||
310 | } | ||
311 | #endif /* JUMPERED_INTERRUPTS */ | ||
312 | PRINTK2((KERN_DEBUG "%s: I/O #9 passed!\n", dev->name)); | ||
313 | |||
314 | /* DMA is not supported (yet?), so no use detecting it */ | ||
315 | lp = netdev_priv(dev); | ||
316 | |||
317 | spin_lock_init(&lp->lock); | ||
318 | |||
319 | PRINTK2((KERN_DEBUG "%s: I/O #10 passed!\n", dev->name)); | ||
320 | |||
321 | /* get the size of the onboard receive buffer | ||
322 | * higher addresses than bufsize are wrapped into real buffer | ||
323 | * i.e. data for offs. 0x801 is written to 0x1 with a 2K onboard buffer | ||
324 | */ | ||
325 | if (!bufsize_rcv) { | ||
326 | outb(1, IE_MMODE); /* Put Rcv buffer on system bus */ | ||
327 | outw(0, IE_GP); /* Point GP at start of packet */ | ||
328 | outb(0, IE_RBUF); /* set buffer byte 0 to 0 */ | ||
329 | for (i = 1; i < 0xff; i++) { | ||
330 | outw(i << 8, IE_GP); /* Point GP at packet size to be tested */ | ||
331 | outb(i, IE_RBUF); | ||
332 | outw(0x0, IE_GP); /* Point GP at start of packet */ | ||
333 | data = inb(IE_RBUF); | ||
334 | if (data == i) break; | ||
335 | } | ||
336 | bufsize_rcv = i << 8; | ||
337 | outw(0, IE_GP); /* Point GP at start of packet */ | ||
338 | outb(0, IE_RBUF); /* set buffer byte 0 to 0 again */ | ||
339 | } | ||
340 | printk("-> bufsize rcv/xmt=%d/%d\n", bufsize_rcv, NI5010_BUFSIZE); | ||
341 | |||
342 | dev->netdev_ops = &ni5010_netdev_ops; | ||
343 | dev->watchdog_timeo = HZ/20; | ||
344 | |||
345 | dev->flags &= ~IFF_MULTICAST; /* Multicast doesn't work */ | ||
346 | |||
347 | /* Shut up the ni5010 */ | ||
348 | outb(0, EDLC_RMASK); /* Mask all receive interrupts */ | ||
349 | outb(0, EDLC_XMASK); /* Mask all xmit interrupts */ | ||
350 | outb(0xff, EDLC_RCLR); /* Kill all pending rcv interrupts */ | ||
351 | outb(0xff, EDLC_XCLR); /* Kill all pending xmt interrupts */ | ||
352 | |||
353 | printk(KERN_INFO "%s: NI5010 found at 0x%x, using IRQ %d", dev->name, ioaddr, dev->irq); | ||
354 | if (dev->dma) | ||
355 | printk(" & DMA %d", dev->dma); | ||
356 | printk(".\n"); | ||
357 | return 0; | ||
358 | out: | ||
359 | release_region(dev->base_addr, NI5010_IO_EXTENT); | ||
360 | return err; | ||
361 | } | ||
362 | |||
363 | /* | ||
364 | * Open/initialize the board. This is called (in the current kernel) | ||
365 | * sometime after booting when the 'ifconfig' program is run. | ||
366 | * | ||
367 | * This routine should set everything up anew at each open, even | ||
368 | * registers that "should" only need to be set once at boot, so that | ||
369 | * there is a non-reboot way to recover if something goes wrong. | ||
370 | */ | ||
371 | |||
372 | static int ni5010_open(struct net_device *dev) | ||
373 | { | ||
374 | int ioaddr = dev->base_addr; | ||
375 | int i; | ||
376 | |||
377 | PRINTK2((KERN_DEBUG "%s: entering ni5010_open()\n", dev->name)); | ||
378 | |||
379 | if (request_irq(dev->irq, ni5010_interrupt, 0, boardname, dev)) { | ||
380 | printk(KERN_WARNING "%s: Cannot get irq %#2x\n", dev->name, dev->irq); | ||
381 | return -EAGAIN; | ||
382 | } | ||
383 | PRINTK3((KERN_DEBUG "%s: passed open() #1\n", dev->name)); | ||
384 | /* | ||
385 | * Always allocate the DMA channel after the IRQ, | ||
386 | * and clean up on failure. | ||
387 | */ | ||
388 | #ifdef JUMPERED_DMA | ||
389 | if (request_dma(dev->dma, cardname)) { | ||
390 | printk(KERN_WARNING "%s: Cannot get dma %#2x\n", dev->name, dev->dma); | ||
391 | free_irq(dev->irq, NULL); | ||
392 | return -EAGAIN; | ||
393 | } | ||
394 | #endif /* JUMPERED_DMA */ | ||
395 | |||
396 | PRINTK3((KERN_DEBUG "%s: passed open() #2\n", dev->name)); | ||
397 | /* Reset the hardware here. Don't forget to set the station address. */ | ||
398 | |||
399 | outb(RS_RESET, EDLC_RESET); /* Hold up EDLC_RESET while configing board */ | ||
400 | outb(0, IE_RESET); /* Hardware reset of ni5010 board */ | ||
401 | outb(XMD_LBC, EDLC_XMODE); /* Only loopback xmits */ | ||
402 | |||
403 | PRINTK3((KERN_DEBUG "%s: passed open() #3\n", dev->name)); | ||
404 | /* Set the station address */ | ||
405 | for(i = 0;i < 6; i++) { | ||
406 | outb(dev->dev_addr[i], EDLC_ADDR + i); | ||
407 | } | ||
408 | |||
409 | PRINTK3((KERN_DEBUG "%s: Initialising ni5010\n", dev->name)); | ||
410 | outb(0, EDLC_XMASK); /* No xmit interrupts for now */ | ||
411 | outb(XMD_IG_PAR | XMD_T_MODE | XMD_LBC, EDLC_XMODE); | ||
412 | /* Normal packet xmit mode */ | ||
413 | outb(0xff, EDLC_XCLR); /* Clear all pending xmit interrupts */ | ||
414 | outb(RMD_BROADCAST, EDLC_RMODE); | ||
415 | /* Receive broadcast and normal packets */ | ||
416 | reset_receiver(dev); /* Ready ni5010 for receiving packets */ | ||
417 | |||
418 | outb(0, EDLC_RESET); /* Un-reset the ni5010 */ | ||
419 | |||
420 | netif_start_queue(dev); | ||
421 | |||
422 | if (NI5010_DEBUG) ni5010_show_registers(dev); | ||
423 | |||
424 | PRINTK((KERN_DEBUG "%s: open successful\n", dev->name)); | ||
425 | return 0; | ||
426 | } | ||
427 | |||
428 | static void reset_receiver(struct net_device *dev) | ||
429 | { | ||
430 | int ioaddr = dev->base_addr; | ||
431 | |||
432 | PRINTK3((KERN_DEBUG "%s: resetting receiver\n", dev->name)); | ||
433 | outw(0, IE_GP); /* Receive packet at start of buffer */ | ||
434 | outb(0xff, EDLC_RCLR); /* Clear all pending rcv interrupts */ | ||
435 | outb(0, IE_MMODE); /* Put EDLC to rcv buffer */ | ||
436 | outb(MM_EN_RCV, IE_MMODE); /* Enable rcv */ | ||
437 | outb(0xff, EDLC_RMASK); /* Enable all rcv interrupts */ | ||
438 | } | ||
439 | |||
440 | static void ni5010_timeout(struct net_device *dev) | ||
441 | { | ||
442 | printk(KERN_WARNING "%s: transmit timed out, %s?\n", dev->name, | ||
443 | tx_done(dev) ? "IRQ conflict" : "network cable problem"); | ||
444 | /* Try to restart the adaptor. */ | ||
445 | /* FIXME: Give it a real kick here */ | ||
446 | chipset_init(dev, 1); | ||
447 | dev->trans_start = jiffies; /* prevent tx timeout */ | ||
448 | netif_wake_queue(dev); | ||
449 | } | ||
450 | |||
451 | static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev) | ||
452 | { | ||
453 | int length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; | ||
454 | |||
455 | PRINTK2((KERN_DEBUG "%s: entering ni5010_send_packet\n", dev->name)); | ||
456 | |||
457 | /* | ||
458 | * Block sending | ||
459 | */ | ||
460 | |||
461 | netif_stop_queue(dev); | ||
462 | hardware_send_packet(dev, (unsigned char *)skb->data, skb->len, length-skb->len); | ||
463 | dev_kfree_skb (skb); | ||
464 | return NETDEV_TX_OK; | ||
465 | } | ||
466 | |||
467 | /* | ||
468 | * The typical workload of the driver: | ||
469 | * Handle the network interface interrupts. | ||
470 | */ | ||
471 | static irqreturn_t ni5010_interrupt(int irq, void *dev_id) | ||
472 | { | ||
473 | struct net_device *dev = dev_id; | ||
474 | struct ni5010_local *lp; | ||
475 | int ioaddr, status; | ||
476 | int xmit_was_error = 0; | ||
477 | |||
478 | PRINTK2((KERN_DEBUG "%s: entering ni5010_interrupt\n", dev->name)); | ||
479 | |||
480 | ioaddr = dev->base_addr; | ||
481 | lp = netdev_priv(dev); | ||
482 | |||
483 | spin_lock(&lp->lock); | ||
484 | status = inb(IE_ISTAT); | ||
485 | PRINTK3((KERN_DEBUG "%s: IE_ISTAT = %#02x\n", dev->name, status)); | ||
486 | |||
487 | if ((status & IS_R_INT) == 0) ni5010_rx(dev); | ||
488 | |||
489 | if ((status & IS_X_INT) == 0) { | ||
490 | xmit_was_error = process_xmt_interrupt(dev); | ||
491 | } | ||
492 | |||
493 | if ((status & IS_DMA_INT) == 0) { | ||
494 | PRINTK((KERN_DEBUG "%s: DMA complete (?)\n", dev->name)); | ||
495 | outb(0, IE_DMA_RST); /* Reset DMA int */ | ||
496 | } | ||
497 | |||
498 | if (!xmit_was_error) | ||
499 | reset_receiver(dev); | ||
500 | spin_unlock(&lp->lock); | ||
501 | return IRQ_HANDLED; | ||
502 | } | ||
503 | |||
504 | |||
505 | static void dump_packet(void *buf, int len) | ||
506 | { | ||
507 | int i; | ||
508 | |||
509 | printk(KERN_DEBUG "Packet length = %#4x\n", len); | ||
510 | for (i = 0; i < len; i++){ | ||
511 | if (i % 16 == 0) printk(KERN_DEBUG "%#4.4x", i); | ||
512 | if (i % 2 == 0) printk(" "); | ||
513 | printk("%2.2x", ((unsigned char *)buf)[i]); | ||
514 | if (i % 16 == 15) printk("\n"); | ||
515 | } | ||
516 | printk("\n"); | ||
517 | } | ||
518 | |||
519 | /* We have a good packet, get it out of the buffer. */ | ||
520 | static void ni5010_rx(struct net_device *dev) | ||
521 | { | ||
522 | int ioaddr = dev->base_addr; | ||
523 | unsigned char rcv_stat; | ||
524 | struct sk_buff *skb; | ||
525 | int i_pkt_size; | ||
526 | |||
527 | PRINTK2((KERN_DEBUG "%s: entering ni5010_rx()\n", dev->name)); | ||
528 | |||
529 | rcv_stat = inb(EDLC_RSTAT); | ||
530 | PRINTK3((KERN_DEBUG "%s: EDLC_RSTAT = %#2x\n", dev->name, rcv_stat)); | ||
531 | |||
532 | if ( (rcv_stat & RS_VALID_BITS) != RS_PKT_OK) { | ||
533 | PRINTK((KERN_INFO "%s: receive error.\n", dev->name)); | ||
534 | dev->stats.rx_errors++; | ||
535 | if (rcv_stat & RS_RUNT) dev->stats.rx_length_errors++; | ||
536 | if (rcv_stat & RS_ALIGN) dev->stats.rx_frame_errors++; | ||
537 | if (rcv_stat & RS_CRC_ERR) dev->stats.rx_crc_errors++; | ||
538 | if (rcv_stat & RS_OFLW) dev->stats.rx_fifo_errors++; | ||
539 | outb(0xff, EDLC_RCLR); /* Clear the interrupt */ | ||
540 | return; | ||
541 | } | ||
542 | |||
543 | outb(0xff, EDLC_RCLR); /* Clear the interrupt */ | ||
544 | |||
545 | i_pkt_size = inw(IE_RCNT); | ||
546 | if (i_pkt_size > ETH_FRAME_LEN || i_pkt_size < 10 ) { | ||
547 | PRINTK((KERN_DEBUG "%s: Packet size error, packet size = %#4.4x\n", | ||
548 | dev->name, i_pkt_size)); | ||
549 | dev->stats.rx_errors++; | ||
550 | dev->stats.rx_length_errors++; | ||
551 | return; | ||
552 | } | ||
553 | |||
554 | /* Malloc up new buffer. */ | ||
555 | skb = netdev_alloc_skb(dev, i_pkt_size + 3); | ||
556 | if (skb == NULL) { | ||
557 | printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name); | ||
558 | dev->stats.rx_dropped++; | ||
559 | return; | ||
560 | } | ||
561 | |||
562 | skb_reserve(skb, 2); | ||
563 | |||
564 | /* Read packet into buffer */ | ||
565 | outb(MM_MUX, IE_MMODE); /* Rcv buffer to system bus */ | ||
566 | outw(0, IE_GP); /* Seek to beginning of packet */ | ||
567 | insb(IE_RBUF, skb_put(skb, i_pkt_size), i_pkt_size); | ||
568 | |||
569 | if (NI5010_DEBUG >= 4) | ||
570 | dump_packet(skb->data, skb->len); | ||
571 | |||
572 | skb->protocol = eth_type_trans(skb,dev); | ||
573 | netif_rx(skb); | ||
574 | dev->stats.rx_packets++; | ||
575 | dev->stats.rx_bytes += i_pkt_size; | ||
576 | |||
577 | PRINTK2((KERN_DEBUG "%s: Received packet, size=%#4.4x\n", | ||
578 | dev->name, i_pkt_size)); | ||
579 | } | ||
580 | |||
581 | static int process_xmt_interrupt(struct net_device *dev) | ||
582 | { | ||
583 | struct ni5010_local *lp = netdev_priv(dev); | ||
584 | int ioaddr = dev->base_addr; | ||
585 | int xmit_stat; | ||
586 | |||
587 | PRINTK2((KERN_DEBUG "%s: entering process_xmt_interrupt\n", dev->name)); | ||
588 | |||
589 | xmit_stat = inb(EDLC_XSTAT); | ||
590 | PRINTK3((KERN_DEBUG "%s: EDLC_XSTAT = %2.2x\n", dev->name, xmit_stat)); | ||
591 | |||
592 | outb(0, EDLC_XMASK); /* Disable xmit IRQ's */ | ||
593 | outb(0xff, EDLC_XCLR); /* Clear all pending xmit IRQ's */ | ||
594 | |||
595 | if (xmit_stat & XS_COLL){ | ||
596 | PRINTK((KERN_DEBUG "%s: collision detected, retransmitting\n", | ||
597 | dev->name)); | ||
598 | outw(NI5010_BUFSIZE - lp->o_pkt_size, IE_GP); | ||
599 | /* outb(0, IE_MMODE); */ /* xmt buf on sysbus FIXME: needed ? */ | ||
600 | outb(MM_EN_XMT | MM_MUX, IE_MMODE); | ||
601 | outb(XM_ALL, EDLC_XMASK); /* Enable xmt IRQ's */ | ||
602 | dev->stats.collisions++; | ||
603 | return 1; | ||
604 | } | ||
605 | |||
606 | /* FIXME: handle other xmt error conditions */ | ||
607 | |||
608 | dev->stats.tx_packets++; | ||
609 | dev->stats.tx_bytes += lp->o_pkt_size; | ||
610 | netif_wake_queue(dev); | ||
611 | |||
612 | PRINTK2((KERN_DEBUG "%s: sent packet, size=%#4.4x\n", | ||
613 | dev->name, lp->o_pkt_size)); | ||
614 | |||
615 | return 0; | ||
616 | } | ||
617 | |||
618 | /* The inverse routine to ni5010_open(). */ | ||
619 | static int ni5010_close(struct net_device *dev) | ||
620 | { | ||
621 | int ioaddr = dev->base_addr; | ||
622 | |||
623 | PRINTK2((KERN_DEBUG "%s: entering ni5010_close\n", dev->name)); | ||
624 | #ifdef JUMPERED_INTERRUPTS | ||
625 | free_irq(dev->irq, NULL); | ||
626 | #endif | ||
627 | /* Put card in held-RESET state */ | ||
628 | outb(0, IE_MMODE); | ||
629 | outb(RS_RESET, EDLC_RESET); | ||
630 | |||
631 | netif_stop_queue(dev); | ||
632 | |||
633 | PRINTK((KERN_DEBUG "%s: %s closed down\n", dev->name, boardname)); | ||
634 | return 0; | ||
635 | |||
636 | } | ||
637 | |||
638 | /* Set or clear the multicast filter for this adaptor. | ||
639 | num_addrs == -1 Promiscuous mode, receive all packets | ||
640 | num_addrs == 0 Normal mode, clear multicast list | ||
641 | num_addrs > 0 Multicast mode, receive normal and MC packets, and do | ||
642 | best-effort filtering. | ||
643 | */ | ||
644 | static void ni5010_set_multicast_list(struct net_device *dev) | ||
645 | { | ||
646 | short ioaddr = dev->base_addr; | ||
647 | |||
648 | PRINTK2((KERN_DEBUG "%s: entering set_multicast_list\n", dev->name)); | ||
649 | |||
650 | if (dev->flags & IFF_PROMISC || dev->flags & IFF_ALLMULTI || | ||
651 | !netdev_mc_empty(dev)) { | ||
652 | outb(RMD_PROMISC, EDLC_RMODE); /* Enable promiscuous mode */ | ||
653 | PRINTK((KERN_DEBUG "%s: Entering promiscuous mode\n", dev->name)); | ||
654 | } else { | ||
655 | PRINTK((KERN_DEBUG "%s: Entering broadcast mode\n", dev->name)); | ||
656 | outb(RMD_BROADCAST, EDLC_RMODE); /* Disable promiscuous mode, use normal mode */ | ||
657 | } | ||
658 | } | ||
659 | |||
660 | static void hardware_send_packet(struct net_device *dev, char *buf, int length, int pad) | ||
661 | { | ||
662 | struct ni5010_local *lp = netdev_priv(dev); | ||
663 | int ioaddr = dev->base_addr; | ||
664 | unsigned long flags; | ||
665 | unsigned int buf_offs; | ||
666 | |||
667 | PRINTK2((KERN_DEBUG "%s: entering hardware_send_packet\n", dev->name)); | ||
668 | |||
669 | if (length > ETH_FRAME_LEN) { | ||
670 | PRINTK((KERN_WARNING "%s: packet too large, not possible\n", | ||
671 | dev->name)); | ||
672 | return; | ||
673 | } | ||
674 | |||
675 | if (NI5010_DEBUG) ni5010_show_registers(dev); | ||
676 | |||
677 | if (inb(IE_ISTAT) & IS_EN_XMT) { | ||
678 | PRINTK((KERN_WARNING "%s: sending packet while already transmitting, not possible\n", | ||
679 | dev->name)); | ||
680 | return; | ||
681 | } | ||
682 | |||
683 | if (NI5010_DEBUG > 3) dump_packet(buf, length); | ||
684 | |||
685 | buf_offs = NI5010_BUFSIZE - length - pad; | ||
686 | |||
687 | spin_lock_irqsave(&lp->lock, flags); | ||
688 | lp->o_pkt_size = length + pad; | ||
689 | |||
690 | outb(0, EDLC_RMASK); /* Mask all receive interrupts */ | ||
691 | outb(0, IE_MMODE); /* Put Xmit buffer on system bus */ | ||
692 | outb(0xff, EDLC_RCLR); /* Clear out pending rcv interrupts */ | ||
693 | |||
694 | outw(buf_offs, IE_GP); /* Point GP at start of packet */ | ||
695 | outsb(IE_XBUF, buf, length); /* Put data in buffer */ | ||
696 | while(pad--) | ||
697 | outb(0, IE_XBUF); | ||
698 | |||
699 | outw(buf_offs, IE_GP); /* Rewrite where packet starts */ | ||
700 | |||
701 | /* should work without that outb() (Crynwr used it) */ | ||
702 | /*outb(MM_MUX, IE_MMODE);*/ /* Xmt buffer to EDLC bus */ | ||
703 | outb(MM_EN_XMT | MM_MUX, IE_MMODE); /* Begin transmission */ | ||
704 | outb(XM_ALL, EDLC_XMASK); /* Cause interrupt after completion or fail */ | ||
705 | |||
706 | spin_unlock_irqrestore(&lp->lock, flags); | ||
707 | |||
708 | netif_wake_queue(dev); | ||
709 | |||
710 | if (NI5010_DEBUG) ni5010_show_registers(dev); | ||
711 | } | ||
712 | |||
713 | static void chipset_init(struct net_device *dev, int startp) | ||
714 | { | ||
715 | /* FIXME: Move some stuff here */ | ||
716 | PRINTK3((KERN_DEBUG "%s: doing NOTHING in chipset_init\n", dev->name)); | ||
717 | } | ||
718 | |||
719 | static void ni5010_show_registers(struct net_device *dev) | ||
720 | { | ||
721 | int ioaddr = dev->base_addr; | ||
722 | |||
723 | PRINTK3((KERN_DEBUG "%s: XSTAT %#2.2x\n", dev->name, inb(EDLC_XSTAT))); | ||
724 | PRINTK3((KERN_DEBUG "%s: XMASK %#2.2x\n", dev->name, inb(EDLC_XMASK))); | ||
725 | PRINTK3((KERN_DEBUG "%s: RSTAT %#2.2x\n", dev->name, inb(EDLC_RSTAT))); | ||
726 | PRINTK3((KERN_DEBUG "%s: RMASK %#2.2x\n", dev->name, inb(EDLC_RMASK))); | ||
727 | PRINTK3((KERN_DEBUG "%s: RMODE %#2.2x\n", dev->name, inb(EDLC_RMODE))); | ||
728 | PRINTK3((KERN_DEBUG "%s: XMODE %#2.2x\n", dev->name, inb(EDLC_XMODE))); | ||
729 | PRINTK3((KERN_DEBUG "%s: ISTAT %#2.2x\n", dev->name, inb(IE_ISTAT))); | ||
730 | } | ||
731 | |||
732 | #ifdef MODULE | ||
733 | static struct net_device *dev_ni5010; | ||
734 | |||
735 | module_param(io, int, 0); | ||
736 | module_param(irq, int, 0); | ||
737 | MODULE_PARM_DESC(io, "ni5010 I/O base address"); | ||
738 | MODULE_PARM_DESC(irq, "ni5010 IRQ number"); | ||
739 | |||
740 | static int __init ni5010_init_module(void) | ||
741 | { | ||
742 | PRINTK2((KERN_DEBUG "%s: entering init_module\n", boardname)); | ||
743 | /* | ||
744 | if(io <= 0 || irq == 0){ | ||
745 | printk(KERN_WARNING "%s: Autoprobing not allowed for modules.\n", boardname); | ||
746 | printk(KERN_WARNING "%s: Set symbols 'io' and 'irq'\n", boardname); | ||
747 | return -EINVAL; | ||
748 | } | ||
749 | */ | ||
750 | if (io <= 0){ | ||
751 | printk(KERN_WARNING "%s: Autoprobing for modules is hazardous, trying anyway..\n", boardname); | ||
752 | } | ||
753 | |||
754 | PRINTK2((KERN_DEBUG "%s: init_module irq=%#2x, io=%#3x\n", boardname, irq, io)); | ||
755 | dev_ni5010 = ni5010_probe(-1); | ||
756 | if (IS_ERR(dev_ni5010)) | ||
757 | return PTR_ERR(dev_ni5010); | ||
758 | return 0; | ||
759 | } | ||
760 | |||
761 | static void __exit ni5010_cleanup_module(void) | ||
762 | { | ||
763 | PRINTK2((KERN_DEBUG "%s: entering cleanup_module\n", boardname)); | ||
764 | unregister_netdev(dev_ni5010); | ||
765 | release_region(dev_ni5010->base_addr, NI5010_IO_EXTENT); | ||
766 | free_netdev(dev_ni5010); | ||
767 | } | ||
768 | module_init(ni5010_init_module); | ||
769 | module_exit(ni5010_cleanup_module); | ||
770 | #endif /* MODULE */ | ||
771 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/ethernet/racal/ni5010.h b/drivers/net/ethernet/racal/ni5010.h deleted file mode 100644 index e10e717fcd76..000000000000 --- a/drivers/net/ethernet/racal/ni5010.h +++ /dev/null | |||
@@ -1,144 +0,0 @@ | |||
1 | /* | ||
2 | * Racal-Interlan ni5010 Ethernet definitions | ||
3 | * | ||
4 | * This is an extension to the Linux operating system, and is covered by the | ||
5 | * same GNU General Public License that covers that work. | ||
6 | * | ||
7 | * copyrights (c) 1996 by Jan-Pascal van Best (jvbest@wi.leidenuniv.nl) | ||
8 | * | ||
9 | * I have done a look in the following sources: | ||
10 | * crynwr-packet-driver by Russ Nelson | ||
11 | */ | ||
12 | |||
13 | #define NI5010_BUFSIZE 2048 /* number of bytes in a buffer */ | ||
14 | |||
15 | #define NI5010_MAGICVAL0 0x00 /* magic-values for ni5010 card */ | ||
16 | #define NI5010_MAGICVAL1 0x55 | ||
17 | #define NI5010_MAGICVAL2 0xAA | ||
18 | |||
19 | #define SA_ADDR0 0x02 | ||
20 | #define SA_ADDR1 0x07 | ||
21 | #define SA_ADDR2 0x01 | ||
22 | |||
23 | /* The number of low I/O ports used by the ni5010 ethercard. */ | ||
24 | #define NI5010_IO_EXTENT 32 | ||
25 | |||
26 | #define PRINTK(x) if (NI5010_DEBUG) printk x | ||
27 | #define PRINTK2(x) if (NI5010_DEBUG>=2) printk x | ||
28 | #define PRINTK3(x) if (NI5010_DEBUG>=3) printk x | ||
29 | |||
30 | /* The various IE command registers */ | ||
31 | #define EDLC_XSTAT (ioaddr + 0x00) /* EDLC transmit csr */ | ||
32 | #define EDLC_XCLR (ioaddr + 0x00) /* EDLC transmit "Clear IRQ" */ | ||
33 | #define EDLC_XMASK (ioaddr + 0x01) /* EDLC transmit "IRQ Masks" */ | ||
34 | #define EDLC_RSTAT (ioaddr + 0x02) /* EDLC receive csr */ | ||
35 | #define EDLC_RCLR (ioaddr + 0x02) /* EDLC receive "Clear IRQ" */ | ||
36 | #define EDLC_RMASK (ioaddr + 0x03) /* EDLC receive "IRQ Masks" */ | ||
37 | #define EDLC_XMODE (ioaddr + 0x04) /* EDLC transmit Mode */ | ||
38 | #define EDLC_RMODE (ioaddr + 0x05) /* EDLC receive Mode */ | ||
39 | #define EDLC_RESET (ioaddr + 0x06) /* EDLC RESET register */ | ||
40 | #define EDLC_TDR1 (ioaddr + 0x07) /* "Time Domain Reflectometry" reg1 */ | ||
41 | #define EDLC_ADDR (ioaddr + 0x08) /* EDLC station address, 6 bytes */ | ||
42 | /* 0x0E doesn't exist for r/w */ | ||
43 | #define EDLC_TDR2 (ioaddr + 0x0f) /* "Time Domain Reflectometry" reg2 */ | ||
44 | #define IE_GP (ioaddr + 0x10) /* GP pointer (word register) */ | ||
45 | /* 0x11 is 2nd byte of GP Pointer */ | ||
46 | #define IE_RCNT (ioaddr + 0x10) /* Count of bytes in rcv'd packet */ | ||
47 | /* 0x11 is 2nd byte of "Byte Count" */ | ||
48 | #define IE_MMODE (ioaddr + 0x12) /* Memory Mode register */ | ||
49 | #define IE_DMA_RST (ioaddr + 0x13) /* IE DMA Reset. write only */ | ||
50 | #define IE_ISTAT (ioaddr + 0x13) /* IE Interrupt Status. read only */ | ||
51 | #define IE_RBUF (ioaddr + 0x14) /* IE Receive Buffer port */ | ||
52 | #define IE_XBUF (ioaddr + 0x15) /* IE Transmit Buffer port */ | ||
53 | #define IE_SAPROM (ioaddr + 0x16) /* window on station addr prom */ | ||
54 | #define IE_RESET (ioaddr + 0x17) /* any write causes Board Reset */ | ||
55 | |||
56 | /* bits in EDLC_XSTAT, interrupt clear on write, status when read */ | ||
57 | #define XS_TPOK 0x80 /* transmit packet successful */ | ||
58 | #define XS_CS 0x40 /* carrier sense */ | ||
59 | #define XS_RCVD 0x20 /* transmitted packet received */ | ||
60 | #define XS_SHORT 0x10 /* transmission media is shorted */ | ||
61 | #define XS_UFLW 0x08 /* underflow. iff failed board */ | ||
62 | #define XS_COLL 0x04 /* collision occurred */ | ||
63 | #define XS_16COLL 0x02 /* 16th collision occurred */ | ||
64 | #define XS_PERR 0x01 /* parity error */ | ||
65 | |||
66 | #define XS_CLR_UFLW 0x08 /* clear underflow */ | ||
67 | #define XS_CLR_COLL 0x04 /* clear collision */ | ||
68 | #define XS_CLR_16COLL 0x02 /* clear 16th collision */ | ||
69 | #define XS_CLR_PERR 0x01 /* clear parity error */ | ||
70 | |||
71 | /* bits in EDLC_XMASK, mask/enable transmit interrupts. register is r/w */ | ||
72 | #define XM_TPOK 0x80 /* =1 to enable Xmt Pkt OK interrupts */ | ||
73 | #define XM_RCVD 0x20 /* =1 to enable Xmt Pkt Rcvd ints */ | ||
74 | #define XM_UFLW 0x08 /* =1 to enable Xmt Underflow ints */ | ||
75 | #define XM_COLL 0x04 /* =1 to enable Xmt Collision ints */ | ||
76 | #define XM_COLL16 0x02 /* =1 to enable Xmt 16th Coll ints */ | ||
77 | #define XM_PERR 0x01 /* =1 to enable Xmt Parity Error ints */ | ||
78 | /* note: always clear this bit */ | ||
79 | #define XM_ALL (XM_TPOK | XM_RCVD | XM_UFLW | XM_COLL | XM_COLL16) | ||
80 | |||
81 | /* bits in EDLC_RSTAT, interrupt clear on write, status when read */ | ||
82 | #define RS_PKT_OK 0x80 /* received good packet */ | ||
83 | #define RS_RST_PKT 0x10 /* RESET packet received */ | ||
84 | #define RS_RUNT 0x08 /* Runt Pkt rcvd. Len < 64 Bytes */ | ||
85 | #define RS_ALIGN 0x04 /* Alignment error. not 8 bit aligned */ | ||
86 | #define RS_CRC_ERR 0x02 /* Bad CRC on rcvd pkt */ | ||
87 | #define RS_OFLW 0x01 /* overflow for rcv FIFO */ | ||
88 | #define RS_VALID_BITS ( RS_PKT_OK | RS_RST_PKT | RS_RUNT | RS_ALIGN | RS_CRC_ERR | RS_OFLW ) | ||
89 | /* all valid RSTAT bits */ | ||
90 | |||
91 | #define RS_CLR_PKT_OK 0x80 /* clear rcvd packet interrupt */ | ||
92 | #define RS_CLR_RST_PKT 0x10 /* clear RESET packet received */ | ||
93 | #define RS_CLR_RUNT 0x08 /* clear Runt Pckt received */ | ||
94 | #define RS_CLR_ALIGN 0x04 /* clear Alignment error */ | ||
95 | #define RS_CLR_CRC_ERR 0x02 /* clear CRC error */ | ||
96 | #define RS_CLR_OFLW 0x01 /* clear rcv FIFO Overflow */ | ||
97 | |||
98 | /* bits in EDLC_RMASK, mask/enable receive interrupts. register is r/w */ | ||
99 | #define RM_PKT_OK 0x80 /* =1 to enable rcvd good packet ints */ | ||
100 | #define RM_RST_PKT 0x10 /* =1 to enable RESET packet ints */ | ||
101 | #define RM_RUNT 0x08 /* =1 to enable Runt Pkt rcvd ints */ | ||
102 | #define RM_ALIGN 0x04 /* =1 to enable Alignment error ints */ | ||
103 | #define RM_CRC_ERR 0x02 /* =1 to enable Bad CRC error ints */ | ||
104 | #define RM_OFLW 0x01 /* =1 to enable overflow error ints */ | ||
105 | |||
106 | /* bits in EDLC_RMODE, set Receive Packet mode. register is r/w */ | ||
107 | #define RMD_TEST 0x80 /* =1 for Chip testing. normally 0 */ | ||
108 | #define RMD_ADD_SIZ 0x10 /* =1 5-byte addr match. normally 0 */ | ||
109 | #define RMD_EN_RUNT 0x08 /* =1 enable runt rcv. normally 0 */ | ||
110 | #define RMD_EN_RST 0x04 /* =1 to rcv RESET pkt. normally 0 */ | ||
111 | |||
112 | #define RMD_PROMISC 0x03 /* receive *all* packets. unusual */ | ||
113 | #define RMD_MULTICAST 0x02 /* receive multicasts too. unusual */ | ||
114 | #define RMD_BROADCAST 0x01 /* receive broadcasts & normal. usual */ | ||
115 | #define RMD_NO_PACKETS 0x00 /* don't receive any packets. unusual */ | ||
116 | |||
117 | /* bits in EDLC_XMODE, set Transmit Packet mode. register is r/w */ | ||
118 | #define XMD_COLL_CNT 0xf0 /* coll's since success. read-only */ | ||
119 | #define XMD_IG_PAR 0x08 /* =1 to ignore parity. ALWAYS set */ | ||
120 | #define XMD_T_MODE 0x04 /* =1 to power xcvr. ALWAYS set this */ | ||
121 | #define XMD_LBC 0x02 /* =1 for loopbakc. normally set */ | ||
122 | #define XMD_DIS_C 0x01 /* =1 disables contention. normally 0 */ | ||
123 | |||
124 | /* bits in EDLC_RESET, write only */ | ||
125 | #define RS_RESET 0x80 /* =1 to hold EDLC in reset state */ | ||
126 | |||
127 | /* bits in IE_MMODE, write only */ | ||
128 | #define MM_EN_DMA 0x80 /* =1 begin DMA xfer, Cplt clrs it */ | ||
129 | #define MM_EN_RCV 0x40 /* =1 allows Pkt rcv. clr'd by rcv */ | ||
130 | #define MM_EN_XMT 0x20 /* =1 begin Xmt pkt. Cplt clrs it */ | ||
131 | #define MM_BUS_PAGE 0x18 /* =00 ALWAYS. Used when MUX=1 */ | ||
132 | #define MM_NET_PAGE 0x06 /* =00 ALWAYS. Used when MUX=0 */ | ||
133 | #define MM_MUX 0x01 /* =1 means Rcv Buff on system bus */ | ||
134 | /* =0 means Xmt Buff on system bus */ | ||
135 | |||
136 | /* bits in IE_ISTAT, read only */ | ||
137 | #define IS_TDIAG 0x80 /* =1 if Diagnostic problem */ | ||
138 | #define IS_EN_RCV 0x20 /* =1 until frame is rcv'd cplt */ | ||
139 | #define IS_EN_XMT 0x10 /* =1 until frame is xmt'd cplt */ | ||
140 | #define IS_EN_DMA 0x08 /* =1 until DMA is cplt or aborted */ | ||
141 | #define IS_DMA_INT 0x04 /* =0 iff DMA done interrupt. */ | ||
142 | #define IS_R_INT 0x02 /* =0 iff unmasked Rcv interrupt */ | ||
143 | #define IS_X_INT 0x01 /* =0 iff unmasked Xmt interrupt */ | ||
144 | |||