]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/staging/agnx/pci.c
Merge branch 'omap-pool'
[linux-2.6-omap-h63xx.git] / drivers / staging / agnx / pci.c
index 854630cb527eac8b6480293fcd3792c905548c73..25c0ffd2faa00bd73cf6642abeade61292f4d6e6 100644 (file)
@@ -39,34 +39,34 @@ static inline void agnx_interrupt_ack(struct agnx_priv *priv, u32 *reason)
        void __iomem *ctl = priv->ctl;
        u32 reg;
 
-       if ( *reason & AGNX_STAT_RX ) {
+       if (*reason & AGNX_STAT_RX) {
                /* Mark complete RX */
                reg = ioread32(ctl + AGNX_CIR_RXCTL);
                reg |= 0x4;
                iowrite32(reg, ctl + AGNX_CIR_RXCTL);
                /* disable Rx interrupt */
        }
-       if ( *reason & AGNX_STAT_TX ) {
+       if (*reason & AGNX_STAT_TX) {
                reg = ioread32(ctl + AGNX_CIR_TXDCTL);
                if (reg & 0x4) {
                        iowrite32(reg, ctl + AGNX_CIR_TXDCTL);
                        *reason |= AGNX_STAT_TXD;
                }
-               reg = ioread32(ctl + AGNX_CIR_TXMCTL);
+               reg = ioread32(ctl + AGNX_CIR_TXMCTL);
                if (reg & 0x4) {
                        iowrite32(reg, ctl + AGNX_CIR_TXMCTL);
                        *reason |= AGNX_STAT_TXM;
                }
        }
-       if ( *reason & AGNX_STAT_X ) {
-/*             reg = ioread32(ctl + AGNX_INT_STAT); */
-/*             iowrite32(reg, ctl + AGNX_INT_STAT); */
-/*             /\* FIXME reinit interrupt mask *\/ */
-/*             reg = 0xc390bf9 & ~IRQ_TX_BEACON; */
-/*             reg &= ~IRQ_TX_DISABLE; */
-/*             iowrite32(reg, ctl + AGNX_INT_MASK); */
-/*             iowrite32(0x800, ctl + AGNX_CIR_BLKCTL); */
-       }
+/*     if (*reason & AGNX_STAT_X) {
+               reg = ioread32(ctl + AGNX_INT_STAT);
+               iowrite32(reg, ctl + AGNX_INT_STAT);
+               /* FIXME reinit interrupt mask *\/
+               reg = 0xc390bf9 & ~IRQ_TX_BEACON;
+               reg &= ~IRQ_TX_DISABLE;
+               iowrite32(reg, ctl + AGNX_INT_MASK);
+               iowrite32(0x800, ctl + AGNX_CIR_BLKCTL);
+       } */
 } /* agnx_interrupt_ack */
 
 static irqreturn_t agnx_interrupt_handler(int irq, void *dev_id)
@@ -79,7 +79,7 @@ static irqreturn_t agnx_interrupt_handler(int irq, void *dev_id)
 
        spin_lock(&priv->lock);
 
-//     printk(KERN_ERR PFX "Get a interrupt %s\n", __func__);
+/*     printk(KERN_ERR PFX "Get a interrupt %s\n", __func__); */
 
        if (priv->init_status != AGNX_START)
                goto out;
@@ -92,7 +92,7 @@ static irqreturn_t agnx_interrupt_handler(int irq, void *dev_id)
        ret = IRQ_HANDLED;
        priv->irq_status = ioread32(ctl + AGNX_INT_STAT);
 
-//     printk(PFX "Interrupt reason is 0x%x\n", irq_reason);
+/*     printk(PFX "Interrupt reason is 0x%x\n", irq_reason); */
        /* Make sure the txm and txd flags don't conflict with other unknown
           interrupt flag, maybe is not necessary */
        irq_reason &= 0xF;
@@ -101,13 +101,13 @@ static irqreturn_t agnx_interrupt_handler(int irq, void *dev_id)
        /* TODO Make sure the card finished initialized */
        agnx_interrupt_ack(priv, &irq_reason);
 
-       if ( irq_reason & AGNX_STAT_RX )
+       if (irq_reason & AGNX_STAT_RX)
                handle_rx_irq(priv);
-       if ( irq_reason & AGNX_STAT_TXD )
+       if (irq_reason & AGNX_STAT_TXD)
                handle_txd_irq(priv);
-       if ( irq_reason & AGNX_STAT_TXM )
+       if (irq_reason & AGNX_STAT_TXM)
                handle_txm_irq(priv);
-       if ( irq_reason & AGNX_STAT_X )
+       if (irq_reason & AGNX_STAT_X)
                handle_other_irq(priv);
 
        enable_rx_interrupt(priv);
@@ -171,7 +171,7 @@ static int agnx_alloc_rings(struct agnx_priv *priv)
 
        len = priv->rx.size + priv->txm.size + priv->txd.size;
 
-//     priv->rx.info = kzalloc(sizeof(struct agnx_info) * len, GFP_KERNEL);
+/*     priv->rx.info = kzalloc(sizeof(struct agnx_info) * len, GFP_KERNEL); */
        priv->rx.info = kzalloc(sizeof(struct agnx_info) * len, GFP_ATOMIC);
        if (!priv->rx.info)
                return -ENOMEM;
@@ -210,28 +210,27 @@ static void rings_free(struct agnx_priv *priv)
 #if 0
 static void agnx_periodic_work_handler(struct work_struct *work)
 {
-       struct agnx_priv *priv = container_of(work, struct agnx_priv,
-                                             periodic_work.work);
-//     unsigned long flags;
+       struct agnx_priv *priv = container_of(work, struct agnx_priv, periodic_work.work);
+/*     unsigned long flags; */
        unsigned long delay;
 
        /* fixme: using mutex?? */
-//     spin_lock_irqsave(&priv->lock, flags);
+/*     spin_lock_irqsave(&priv->lock, flags); */
 
        /* TODO Recalibrate*/
-//     calibrate_oscillator(priv);
-//     antenna_calibrate(priv);
-//     agnx_send_packet(priv, 997);
+/*     calibrate_oscillator(priv); */
+/*     antenna_calibrate(priv); */
+/*     agnx_send_packet(priv, 997); /
        /* FIXME */
 /*     if (debug == 3) */
 /*                 delay = msecs_to_jiffies(AGNX_PERIODIC_DELAY); */
 /*     else */
        delay = msecs_to_jiffies(AGNX_PERIODIC_DELAY);
-//             delay = round_jiffies(HZ * 15);
+/*     delay = round_jiffies(HZ * 15); */
 
        queue_delayed_work(priv->hw->workqueue, &priv->periodic_work, delay);
 
-//     spin_unlock_irqrestore(&priv->lock, flags);
+/*     spin_unlock_irqrestore(&priv->lock, flags); */
 }
 #endif
 
@@ -255,12 +254,12 @@ static int agnx_start(struct ieee80211_hw *dev)
                goto out;
        }
 
-//     mdelay(500);
+/*     mdelay(500); */
 
        might_sleep();
        agnx_hw_init(priv);
 
-//     mdelay(500);
+/*     mdelay(500); */
        might_sleep();
 
        priv->init_status = AGNX_START;
@@ -280,16 +279,16 @@ static void agnx_stop(struct ieee80211_hw *dev)
        /* make sure hardware will not generate irq */
        agnx_hw_reset(priv);
        free_irq(priv->pdev->irq, dev);
-        flush_workqueue(priv->hw->workqueue);
-//     cancel_delayed_work_sync(&priv->periodic_work);
+       flush_workqueue(priv->hw->workqueue);
+/*     cancel_delayed_work_sync(&priv->periodic_work); */
        unfill_rings(priv);
        rings_free(priv);
 }
 
-static int agnx_config(struct ieee80211_hw *dev,
-                      struct ieee80211_conf *conf)
+static int agnx_config(struct ieee80211_hw *dev, u32 changed)
 {
        struct agnx_priv *priv = dev->priv;
+       struct ieee80211_conf *conf = &dev->conf;
        int channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
        AGNX_TRACE;
 
@@ -315,7 +314,6 @@ static int agnx_config_interface(struct ieee80211_hw *dev,
        spin_lock(&priv->lock);
 
        if (memcmp(conf->bssid, priv->bssid, ETH_ALEN)) {
-//             u32 reghi, reglo;
                agnx_set_bssid(priv, conf->bssid);
                memcpy(priv->bssid, conf->bssid, ETH_ALEN);
                hash_write(priv, conf->bssid, BSSID_STAID);
@@ -425,7 +423,7 @@ static struct ieee80211_ops agnx_ops = {
        .remove_interface       = agnx_remove_interface,
        .config                 = agnx_config,
        .config_interface       = agnx_config_interface,
-       .configure_filter       = agnx_configure_filter,
+       .configure_filter       = agnx_configure_filter,
        .get_stats              = agnx_get_stats,
        .get_tx_stats           = agnx_get_tx_stats,
        .get_tsf                = agnx_get_tsft
@@ -434,11 +432,12 @@ static struct ieee80211_ops agnx_ops = {
 static void __devexit agnx_pci_remove(struct pci_dev *pdev)
 {
        struct ieee80211_hw *dev = pci_get_drvdata(pdev);
-       struct agnx_priv *priv = dev->priv;
+       struct agnx_priv *priv;
        AGNX_TRACE;
 
        if (!dev)
                return;
+       priv = dev->priv;
        ieee80211_unregister_hw(dev);
        pci_iounmap(pdev, priv->ctl);
        pci_iounmap(pdev, priv->data);
@@ -478,8 +477,8 @@ static int __devinit agnx_pci_probe(struct pci_dev *pdev,
                return err;
        }
 
-       if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) ||
-           pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) {
+       if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) ||
+           pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
                printk(KERN_ERR PFX "No suitable DMA available\n");
                goto err_free_reg;
        }
@@ -504,7 +503,7 @@ static int __devinit agnx_pci_probe(struct pci_dev *pdev,
 
        /* Map mem #1 and #2 */
        priv->ctl = pci_iomap(pdev, 0, mem_len0);
-//     printk(KERN_DEBUG PFX"MEM1 mapped address is 0x%p\n", priv->ctl);
+/*     printk(KERN_DEBUG PFX"MEM1 mapped address is 0x%p\n", priv->ctl); */
        if (!priv->ctl) {
                printk(KERN_ERR PFX "Can't map device memory\n");
                goto err_free_dev;