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>
79
78
0x260, 0x280, 0x2a0, 0x240, 0x340, 0x320, 0x380, 0x300, 0
85
#ifdef CONFIG_MCA_LEGACY
86
static int at1700_ioaddr_pattern[] __initdata = {
87
0x00, 0x04, 0x01, 0x05, 0x02, 0x06, 0x03, 0x07
90
static int at1700_mca_probe_list[] __initdata = {
91
0x400, 0x1400, 0x2400, 0x3400, 0x4400, 0x5400, 0x6400, 0x7400, 0
94
static int at1700_irq_pattern[] __initdata = {
95
0x00, 0x00, 0x00, 0x30, 0x70, 0xb0, 0x00, 0x00,
96
0x00, 0xf0, 0x34, 0x74, 0xb4, 0x00, 0x00, 0xf4, 0x00
100
81
/* use 0 for production, 1 for verification, >2 for debug */
102
83
#define NET_DEBUG 1
114
95
uint tx_queue_ready:1; /* Tx queue is ready to be sent. */
115
96
uint rx_started:1; /* Packets are Rxing. */
116
97
uchar tx_queue; /* Number of packet on the Tx queue. */
117
char mca_slot; /* -1 means ISA */
118
98
ushort tx_queue_len; /* Current length of the Tx queue. */
166
146
static void net_tx_timeout (struct net_device *dev);
169
#ifdef CONFIG_MCA_LEGACY
170
struct at1720_mca_adapters_struct {
174
/* rEnE : maybe there are others I don't know off... */
176
static struct at1720_mca_adapters_struct at1720_mca_adapters[] __initdata = {
177
{ "Allied Telesys AT1720AT", 0x6410 },
178
{ "Allied Telesys AT1720BT", 0x6413 },
179
{ "Allied Telesys AT1720T", 0x6416 },
184
149
/* Check for a network adaptor of this type, and return '0' iff one exists.
185
150
If dev->base_addr == 0, probe all likely locations.
186
151
If dev->base_addr == 1, always return failure.
195
160
static void cleanup_card(struct net_device *dev)
197
#ifdef CONFIG_MCA_LEGACY
198
struct net_local *lp = netdev_priv(dev);
199
if (lp->mca_slot >= 0)
200
mca_mark_as_unused(lp->mca_slot);
202
162
free_irq(dev->irq, NULL);
203
163
release_region(dev->base_addr, AT1700_IO_EXTENT);
273
233
static const char fmv_irqmap_pnp[8] = {3, 4, 5, 7, 9, 10, 11, 15};
274
234
static const char at1700_irqmap[8] = {3, 4, 5, 9, 10, 11, 14, 15};
275
235
unsigned int i, irq, is_fmv18x = 0, is_at1700 = 0;
276
int slot, ret = -ENODEV;
277
237
struct net_local *lp = netdev_priv(dev);
279
239
if (!request_region(ioaddr, AT1700_IO_EXTENT, DRV_NAME))
288
248
ioaddr, read_eeprom(ioaddr, 4), read_eeprom(ioaddr, 5),
289
249
read_eeprom(ioaddr, 6), inw(ioaddr + EEPROM_Ctrl));
292
#ifdef CONFIG_MCA_LEGACY
293
/* rEnE (rene@bss.lu): got this from 3c509 driver source , adapted for AT1720 */
295
/* Based on Erik Nygren's (nygren@mit.edu) 3c529 patch, heavily
296
modified by Chris Beauregard (cpbeaure@csclub.uwaterloo.ca)
297
to support standard MCA probing. */
299
/* redone for multi-card detection by ZP Gu (zpg@castle.net) */
300
/* now works as a module */
307
for (j = 0; at1720_mca_adapters[j].name != NULL; j ++) {
309
while (slot != MCA_NOTFOUND) {
311
slot = mca_find_unused_adapter( at1720_mca_adapters[j].id, slot );
312
if (slot == MCA_NOTFOUND) break;
314
/* if we get this far, an adapter has been detected and is
317
pos3 = mca_read_stored_pos( slot, 3 );
318
pos4 = mca_read_stored_pos( slot, 4 );
320
for (l_i = 0; l_i < 8; l_i++)
321
if (( pos3 & 0x07) == at1700_ioaddr_pattern[l_i])
323
ioaddr = at1700_mca_probe_list[l_i];
325
for (irq = 0; irq < 0x10; irq++)
326
if (((((pos4>>4) & 0x0f) | (pos3 & 0xf0)) & 0xff) == at1700_irq_pattern[irq])
329
/* probing for a card at a particular IO/IRQ */
330
if ((dev->irq && dev->irq != irq) ||
331
(dev->base_addr && dev->base_addr != ioaddr)) {
332
slot++; /* probing next slot */
339
mca_set_adapter_name( slot, at1720_mca_adapters[j].name );
340
mca_mark_as_used(slot);
345
/* if we get here, we didn't find an MCA adapter - try ISA */
349
251
/* We must check for the EEPROM-config boards first, else accessing
350
252
IOCONFIG0 will move the board! */
351
253
if (at1700_probe_list[inb(ioaddr + IOCONFIG1) & 0x07] == ioaddr &&
464
362
spin_lock_init(&lp->lock);
466
364
lp->jumpered = is_fmv18x;
468
365
/* Snarf the interrupt vector now. */
469
366
ret = request_irq(irq, net_interrupt, 0, DRV_NAME, dev);
471
368
printk(KERN_ERR "AT1700 at %#3x is unusable due to a "
472
369
"conflict on IRQ %d.\n",
480
#ifdef CONFIG_MCA_LEGACY
482
mca_mark_as_unused(slot);
485
377
release_region(ioaddr, AT1700_IO_EXTENT);