~ubuntu-branches/debian/sid/acx100/sid

« back to all changes in this revision

Viewing changes to pci.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Canepa
  • Date: 2008-01-23 23:29:44 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080123232944-zj28ri4e3xngonjs
Tags: 20070101-3
Added dpatch in depends (Closes: #462118)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
*/
32
32
#define ACX_PCI 1
33
33
 
 
34
#include <linux/version.h>
 
35
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)
34
36
#include <linux/config.h>
35
 
#include <linux/version.h>
 
37
#endif
 
38
 
 
39
/* Linux 2.6.18+ uses <linux/utsrelease.h> */
 
40
#ifndef UTS_RELEASE
 
41
#include <linux/utsrelease.h>
 
42
#endif
 
43
 
36
44
#include <linux/compiler.h> /* required for Lx 2.6.8 ?? */
37
45
#include <linux/kernel.h>
38
46
#include <linux/module.h>
101
109
/***********************************************************************
102
110
*/
103
111
static void acxpci_i_tx_timeout(struct net_device *ndev);
 
112
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
 
113
static irqreturn_t acxpci_i_interrupt(int irq, void *dev_id);
 
114
#else
104
115
static irqreturn_t acxpci_i_interrupt(int irq, void *dev_id, struct pt_regs *regs);
 
116
#endif
105
117
static void acxpci_i_set_multicast_list(struct net_device *ndev);
106
118
 
107
119
static int acxpci_e_open(struct net_device *ndev);
626
638
 
627
639
        FN_ENTER;
628
640
 
 
641
        /* print exact chipset and radio ID to make sure people really get a clue on which files exactly they are supposed to provide,
 
642
         * since firmware loading is the biggest enduser PITA with these chipsets.
 
643
         * Not printing radio ID in 0xHEX in order to not confuse them into wrong file naming */
 
644
        printk( "acx: need to load firmware for acx1%02d chipset with radio ID %02x, please provide via firmware hotplug:\n"
 
645
                "acx: either one file only (<c>ombined firmware image file, radio-specific) or two files (radio-less base image file *plus* separate <r>adio-specific extension file)\n",
 
646
                IS_ACX111(adev)*11, adev->radio_type);
 
647
 
629
648
        /* Try combined, then main image */
630
649
        adev->need_radio_fw = 0;
631
650
        snprintf(filename, sizeof(filename), "tiacx1%02dc%02X",
644
663
 
645
664
        for (try = 1; try <= 5; try++) {
646
665
                res = acxpci_s_write_fw(adev, fw_image, 0);
647
 
                log(L_DEBUG|L_INIT, "acx_write_fw (main/combined):%d\n", res);
 
666
                log(L_DEBUG|L_INIT, "acx_write_fw (main/combined): %d\n", res);
648
667
                if (OK == res) {
649
668
                        res = acxpci_s_validate_fw(adev, fw_image, 0);
650
669
                        log(L_DEBUG|L_INIT, "acx_validate_fw "
651
 
                                        "(main/combined):%d\n", res);
 
670
                                        "(main/combined): %d\n", res);
652
671
                }
653
672
 
654
673
                if (OK == res) {
1517
1536
                printk("acx: cannot reserve PCI memory region 2\n");
1518
1537
                goto fail_request_mem_region2;
1519
1538
        }
1520
 
        mem1 = ioremap(phymem1, mem_region1_size);
 
1539
        
 
1540
        /* this used to be ioremap(), but ioremap_nocache()
 
1541
         * is much less risky, right? (and slower?)
 
1542
         * FIXME: we may want to go back to cached variant if it's
 
1543
         * certain that our code really properly handles
 
1544
         * cached operation (memory barriers, volatile?, ...)
 
1545
         * (but always keep this comment here regardless!)
 
1546
         * Possibly make this a driver config setting? */
 
1547
        
 
1548
        mem1 = ioremap_nocache(phymem1, mem_region1_size);
1521
1549
        if (!mem1) {
1522
1550
                printk("acx: ioremap() FAILED\n");
1523
1551
                goto fail_ioremap1;
1524
1552
        }
1525
 
        mem2 = ioremap(phymem2, mem_region2_size);
 
1553
        mem2 = ioremap_nocache(phymem2, mem_region2_size);
1526
1554
        if (!mem2) {
1527
1555
                printk("acx: ioremap() #2 FAILED\n");
1528
1556
                goto fail_ioremap2;
1544
1572
        ndev = alloc_netdev(sizeof(*adev), "wlan%d", dummy_netdev_init);
1545
1573
        /* (NB: memsets to 0 entire area) */
1546
1574
        if (!ndev) {
1547
 
                printk("acx: no memory for netdevice structure\n");
 
1575
                printk("acx: no memory for netdevice struct\n");
1548
1576
                goto fail_alloc_netdev;
1549
1577
        }
1550
1578
 
1622
1650
                acx_s_interrogate(adev, &co, ACX111_IE_CONFIG_OPTIONS);
1623
1651
        }
1624
1652
 
1625
 
//TODO: merge them into one function, they are called just once and are the same for pci & usb
 
1653
/* TODO: merge them into one function, they are called just once and are the same for pci & usb */
1626
1654
        if (OK != acxpci_read_eeprom_byte(adev, 0x05, &adev->eeprom_version))
1627
1655
                goto fail_read_eeprom_version;
1628
1656
 
2076
2104
 
2077
2105
        acx_init_task_scheduler(adev);
2078
2106
 
2079
 
//TODO: pci_set_power_state(pdev, PCI_D0); ?
 
2107
/* TODO: pci_set_power_state(pdev, PCI_D0); ? */
2080
2108
 
2081
2109
        /* request shared IRQ handler */
2082
 
        if (request_irq(ndev->irq, acxpci_i_interrupt, SA_SHIRQ, ndev->name, ndev)) {
 
2110
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)        
 
2111
    if (request_irq(ndev->irq, acxpci_i_interrupt, IRQF_SHARED, ndev->name, ndev)) {
 
2112
#else
 
2113
    if (request_irq(ndev->irq, acxpci_i_interrupt, SA_SHIRQ, ndev->name, ndev)) {
 
2114
#endif                                             
2083
2115
                printk("%s: request_irq FAILED\n", ndev->name);
2084
2116
                result = -EAGAIN;
2085
2117
                goto done;
2135
2167
        write_reg16(adev, IO_ACX_FEMR, 0x0);
2136
2168
        free_irq(ndev->irq, ndev);
2137
2169
 
2138
 
//TODO: pci_set_power_state(pdev, PCI_D3hot); ?
 
2170
/* TODO: pci_set_power_state(pdev, PCI_D3hot); ? */
2139
2171
 
2140
2172
        /* We currently don't have to do anything else.
2141
2173
         * Higher layers know we're not ready from dev->start==0 and
2436
2468
                printk(" Key_Not_Found");
2437
2469
        }
2438
2470
        if (irqtype & HOST_INT_IV_ICV_FAILURE) {
2439
 
                printk(" IV_ICV_Failure");
 
2471
                printk(" IV_ICV_Failure (crypto)");
2440
2472
        }
2441
2473
                /* HOST_INT_CMD_COMPLETE  */
2442
2474
                /* HOST_INT_INFO          */
2478
2510
#define MAX_IRQLOOPS_PER_JIFFY  (20000/HZ) /* a la orinoco.c */
2479
2511
 
2480
2512
static irqreturn_t
 
2513
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
 
2514
acxpci_i_interrupt(int irq, void *dev_id)
 
2515
#else
2481
2516
acxpci_i_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
2517
#endif
2482
2518
{
2483
2519
        acx_device_t *adev;
2484
2520
        unsigned long flags;
3344
3380
                adev->stats.tx_fifo_errors++;
3345
3381
                break;
3346
3382
        case 0x80:
 
3383
                /* possibly ACPI C-state powersaving related!!!
 
3384
                 * (DMA timeout due to excessively high wakeup
 
3385
                 * latency after C-state activation!?)
 
3386
                 * Disable C-State powersaving and try again,
 
3387
                 * then PLEASE REPORT, I'm VERY interested in
 
3388
                 * whether my theory is correct that this is
 
3389
                 * actually the problem here.
 
3390
                 * In that case, use new Linux idle wakeup latency
 
3391
                 * requirements kernel API to prevent this issue. */
3347
3392
                err = "DMA error";
3348
3393
                adev->wstats.discard.misc++;
3349
3394
                break;