~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

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