~ubuntu-branches/ubuntu/quantal/linux-lowlatency/quantal-proposed

« back to all changes in this revision

Viewing changes to drivers/net/ethernet/fujitsu/at1700.c

  • Committer: Package Import Robot
  • Author(s): Andy Whitcroft, Andy Whitcroft
  • Date: 2012-06-21 09:16:38 UTC
  • Revision ID: package-import@ubuntu.com-20120621091638-gubhv4nox8xez1ct
Tags: 3.5.0-1.1
[ Andy Whitcroft]

* Rebuild lowlatency against Ubuntu-3.5.0-1.1
* All new configuration system to allow configuration deltas to be
  exposed via debian.lowlatency/config-delta

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
        ATI provided their EEPROM configuration code header file.
28
28
    Thanks to NIIBE Yutaka <gniibe@mri.co.jp> for bug fixes.
29
29
 
30
 
    MCA bus (AT1720) support by Rene Schmit <rene@bss.lu>
 
30
    MCA bus (AT1720) support (now deleted) by Rene Schmit <rene@bss.lu>
31
31
 
32
32
  Bugs:
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>
52
51
#include <linux/crc32.h>
53
52
#include <linux/bitops.h>
54
53
 
55
 
#include <asm/system.h>
56
54
#include <asm/io.h>
57
55
#include <asm/dma.h>
58
56
 
80
78
        0x260, 0x280, 0x2a0, 0x240, 0x340, 0x320, 0x380, 0x300, 0
81
79
};
82
80
 
83
 
/*
84
 
 *      MCA
85
 
 */
86
 
#ifdef CONFIG_MCA_LEGACY
87
 
static int at1700_ioaddr_pattern[] __initdata = {
88
 
        0x00, 0x04, 0x01, 0x05, 0x02, 0x06, 0x03, 0x07
89
 
};
90
 
 
91
 
static int at1700_mca_probe_list[] __initdata = {
92
 
        0x400, 0x1400, 0x2400, 0x3400, 0x4400, 0x5400, 0x6400, 0x7400, 0
93
 
};
94
 
 
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
98
 
};
99
 
#endif
100
 
 
101
81
/* use 0 for production, 1 for verification, >2 for debug */
102
82
#ifndef NET_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. */
120
99
};
121
100
 
167
146
static void net_tx_timeout (struct net_device *dev);
168
147
 
169
148
 
170
 
#ifdef CONFIG_MCA_LEGACY
171
 
struct at1720_mca_adapters_struct {
172
 
        char* name;
173
 
        int id;
174
 
};
175
 
/* rEnE : maybe there are others I don't know off... */
176
 
 
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 },
181
 
        { NULL, 0 },
182
 
};
183
 
#endif
184
 
 
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.
195
159
 
196
160
static void cleanup_card(struct net_device *dev)
197
161
{
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);
202
 
#endif
203
162
        free_irq(dev->irq, NULL);
204
163
        release_region(dev->base_addr, AT1700_IO_EXTENT);
205
164
}
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;
 
236
        int ret = -ENODEV;
278
237
        struct net_local *lp = netdev_priv(dev);
279
238
 
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));
291
250
#endif
292
 
 
293
 
#ifdef CONFIG_MCA_LEGACY
294
 
        /* rEnE (rene@bss.lu): got this from 3c509 driver source , adapted for AT1720 */
295
 
 
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. */
299
 
 
300
 
        /* redone for multi-card detection by ZP Gu (zpg@castle.net) */
301
 
        /* now works as a module */
302
 
 
303
 
        if (MCA_bus) {
304
 
                int j;
305
 
                int l_i;
306
 
                u_char pos3, pos4;
307
 
 
308
 
                for (j = 0; at1720_mca_adapters[j].name != NULL; j ++) {
309
 
                        slot = 0;
310
 
                        while (slot != MCA_NOTFOUND) {
311
 
 
312
 
                                slot = mca_find_unused_adapter( at1720_mca_adapters[j].id, slot );
313
 
                                if (slot == MCA_NOTFOUND) break;
314
 
 
315
 
                                /* if we get this far, an adapter has been detected and is
316
 
                                enabled */
317
 
 
318
 
                                pos3 = mca_read_stored_pos( slot, 3 );
319
 
                                pos4 = mca_read_stored_pos( slot, 4 );
320
 
 
321
 
                                for (l_i = 0; l_i < 8; l_i++)
322
 
                                        if (( pos3 & 0x07) == at1700_ioaddr_pattern[l_i])
323
 
                                                break;
324
 
                                ioaddr = at1700_mca_probe_list[l_i];
325
 
 
326
 
                                for (irq = 0; irq < 0x10; irq++)
327
 
                                        if (((((pos4>>4) & 0x0f) | (pos3 & 0xf0)) & 0xff) == at1700_irq_pattern[irq])
328
 
                                                break;
329
 
 
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 */
334
 
                                        continue;
335
 
                                }
336
 
 
337
 
                                dev->irq = irq;
338
 
 
339
 
                                /* claim the slot */
340
 
                                mca_set_adapter_name( slot, at1720_mca_adapters[j].name );
341
 
                                mca_mark_as_used(slot);
342
 
 
343
 
                                goto found;
344
 
                        }
345
 
                }
346
 
                /* if we get here, we didn't find an MCA adapter - try ISA */
347
 
        }
348
 
#endif
349
 
        slot = -1;
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 &&
361
262
                goto err_out;
362
263
        }
363
264
 
364
 
#ifdef CONFIG_MCA_LEGACY
365
 
found:
366
 
#endif
367
 
 
368
 
                /* Reset the internal state machines. */
 
265
        /* Reset the internal state machines. */
369
266
        outb(0, ioaddr + RESET);
370
267
 
371
268
        if (is_at1700) {
381
278
                                        break;
382
279
                        }
383
280
                        if (i == 8) {
384
 
                                goto err_mca;
 
281
                                goto err_out;
385
282
                        }
386
283
                } else {
387
284
                        if (fmv18x_probe_list[inb(ioaddr + IOCONFIG) & 0x07] != ioaddr)
388
 
                                goto err_mca;
 
285
                                goto err_out;
389
286
                        irq = fmv_irqmap[(inb(ioaddr + IOCONFIG)>>6) & 0x03];
390
287
                }
391
288
        }
465
362
        spin_lock_init(&lp->lock);
466
363
 
467
364
        lp->jumpered = is_fmv18x;
468
 
        lp->mca_slot = slot;
469
365
        /* Snarf the interrupt vector now. */
470
366
        ret = request_irq(irq, net_interrupt, 0, DRV_NAME, dev);
471
367
        if (ret) {
472
368
                printk(KERN_ERR "AT1700 at %#3x is unusable due to a "
473
369
                       "conflict on IRQ %d.\n",
474
370
                       ioaddr, irq);
475
 
                goto err_mca;
 
371
                goto err_out;
476
372
        }
477
373
 
478
374
        return 0;
479
375
 
480
 
err_mca:
481
 
#ifdef CONFIG_MCA_LEGACY
482
 
        if (slot >= 0)
483
 
                mca_mark_as_unused(slot);
484
 
#endif
485
376
err_out:
486
377
        release_region(ioaddr, AT1700_IO_EXTENT);
487
378
        return ret;
757
648
                                dev->stats.rx_errors++;
758
649
                                break;
759
650
                        }
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);