27
27
ATI provided their EEPROM configuration code header file.
28
28
Thanks to NIIBE Yutaka <gniibe@mri.co.jp> for bug fixes.
30
MCA bus (AT1720) support by Rene Schmit <rene@bss.lu>
30
MCA bus (AT1720) support (now deleted) by Rene Schmit <rene@bss.lu>
33
33
The MB86965 has a design flaw that makes all probes unreliable. Not
38
38
#include <linux/errno.h>
39
39
#include <linux/netdevice.h>
40
40
#include <linux/etherdevice.h>
41
#include <linux/mca-legacy.h>
42
41
#include <linux/module.h>
43
42
#include <linux/kernel.h>
44
43
#include <linux/types.h>
80
78
0x260, 0x280, 0x2a0, 0x240, 0x340, 0x320, 0x380, 0x300, 0
86
#ifdef CONFIG_MCA_LEGACY
87
static int at1700_ioaddr_pattern[] __initdata = {
88
0x00, 0x04, 0x01, 0x05, 0x02, 0x06, 0x03, 0x07
91
static int at1700_mca_probe_list[] __initdata = {
92
0x400, 0x1400, 0x2400, 0x3400, 0x4400, 0x5400, 0x6400, 0x7400, 0
95
static int at1700_irq_pattern[] __initdata = {
96
0x00, 0x00, 0x00, 0x30, 0x70, 0xb0, 0x00, 0x00,
97
0x00, 0xf0, 0x34, 0x74, 0xb4, 0x00, 0x00, 0xf4, 0x00
101
81
/* use 0 for production, 1 for verification, >2 for debug */
103
83
#define NET_DEBUG 1
115
95
uint tx_queue_ready:1; /* Tx queue is ready to be sent. */
116
96
uint rx_started:1; /* Packets are Rxing. */
117
97
uchar tx_queue; /* Number of packet on the Tx queue. */
118
char mca_slot; /* -1 means ISA */
119
98
ushort tx_queue_len; /* Current length of the Tx queue. */
167
146
static void net_tx_timeout (struct net_device *dev);
170
#ifdef CONFIG_MCA_LEGACY
171
struct at1720_mca_adapters_struct {
175
/* rEnE : maybe there are others I don't know off... */
177
static struct at1720_mca_adapters_struct at1720_mca_adapters[] __initdata = {
178
{ "Allied Telesys AT1720AT", 0x6410 },
179
{ "Allied Telesys AT1720BT", 0x6413 },
180
{ "Allied Telesys AT1720T", 0x6416 },
185
149
/* Check for a network adaptor of this type, and return '0' iff one exists.
186
150
If dev->base_addr == 0, probe all likely locations.
187
151
If dev->base_addr == 1, always return failure.
196
160
static void cleanup_card(struct net_device *dev)
198
#ifdef CONFIG_MCA_LEGACY
199
struct net_local *lp = netdev_priv(dev);
200
if (lp->mca_slot >= 0)
201
mca_mark_as_unused(lp->mca_slot);
203
162
free_irq(dev->irq, NULL);
204
163
release_region(dev->base_addr, AT1700_IO_EXTENT);
274
233
static const char fmv_irqmap_pnp[8] = {3, 4, 5, 7, 9, 10, 11, 15};
275
234
static const char at1700_irqmap[8] = {3, 4, 5, 9, 10, 11, 14, 15};
276
235
unsigned int i, irq, is_fmv18x = 0, is_at1700 = 0;
277
int slot, ret = -ENODEV;
278
237
struct net_local *lp = netdev_priv(dev);
280
239
if (!request_region(ioaddr, AT1700_IO_EXTENT, DRV_NAME))
289
248
ioaddr, read_eeprom(ioaddr, 4), read_eeprom(ioaddr, 5),
290
249
read_eeprom(ioaddr, 6), inw(ioaddr + EEPROM_Ctrl));
293
#ifdef CONFIG_MCA_LEGACY
294
/* rEnE (rene@bss.lu): got this from 3c509 driver source , adapted for AT1720 */
296
/* Based on Erik Nygren's (nygren@mit.edu) 3c529 patch, heavily
297
modified by Chris Beauregard (cpbeaure@csclub.uwaterloo.ca)
298
to support standard MCA probing. */
300
/* redone for multi-card detection by ZP Gu (zpg@castle.net) */
301
/* now works as a module */
308
for (j = 0; at1720_mca_adapters[j].name != NULL; j ++) {
310
while (slot != MCA_NOTFOUND) {
312
slot = mca_find_unused_adapter( at1720_mca_adapters[j].id, slot );
313
if (slot == MCA_NOTFOUND) break;
315
/* if we get this far, an adapter has been detected and is
318
pos3 = mca_read_stored_pos( slot, 3 );
319
pos4 = mca_read_stored_pos( slot, 4 );
321
for (l_i = 0; l_i < 8; l_i++)
322
if (( pos3 & 0x07) == at1700_ioaddr_pattern[l_i])
324
ioaddr = at1700_mca_probe_list[l_i];
326
for (irq = 0; irq < 0x10; irq++)
327
if (((((pos4>>4) & 0x0f) | (pos3 & 0xf0)) & 0xff) == at1700_irq_pattern[irq])
330
/* probing for a card at a particular IO/IRQ */
331
if ((dev->irq && dev->irq != irq) ||
332
(dev->base_addr && dev->base_addr != ioaddr)) {
333
slot++; /* probing next slot */
340
mca_set_adapter_name( slot, at1720_mca_adapters[j].name );
341
mca_mark_as_used(slot);
346
/* if we get here, we didn't find an MCA adapter - try ISA */
350
251
/* We must check for the EEPROM-config boards first, else accessing
351
252
IOCONFIG0 will move the board! */
352
253
if (at1700_probe_list[inb(ioaddr + IOCONFIG1) & 0x07] == ioaddr &&
465
362
spin_lock_init(&lp->lock);
467
364
lp->jumpered = is_fmv18x;
469
365
/* Snarf the interrupt vector now. */
470
366
ret = request_irq(irq, net_interrupt, 0, DRV_NAME, dev);
472
368
printk(KERN_ERR "AT1700 at %#3x is unusable due to a "
473
369
"conflict on IRQ %d.\n",
481
#ifdef CONFIG_MCA_LEGACY
483
mca_mark_as_unused(slot);
486
377
release_region(ioaddr, AT1700_IO_EXTENT);
757
648
dev->stats.rx_errors++;
760
skb = dev_alloc_skb(pkt_len+3);
651
skb = netdev_alloc_skb(dev, pkt_len + 3);
761
652
if (skb == NULL) {
762
653
printk("%s: Memory squeeze, dropping packet (len %d).\n",
763
654
dev->name, pkt_len);