iwlwifi: map A-MPDU HW queue to mac80211 A-MPDU SW queue
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-4965.c
index b1b7363bfdd4d89f9e3f73fe80267eda82898a93..70c0455b622d0f96b73ad44d86683fb8f841b044 100644 (file)
@@ -39,7 +39,7 @@
 #include <asm/unaligned.h>
 
 #include "iwl-eeprom.h"
-#include "iwl-4965.h"
+#include "iwl-dev.h"
 #include "iwl-core.h"
 #include "iwl-io.h"
 #include "iwl-helpers.h"
@@ -579,22 +579,13 @@ out:
        return ret;
 }
 
-int iwl4965_hw_nic_init(struct iwl_priv *priv)
+
+static void iwl4965_nic_config(struct iwl_priv *priv)
 {
        unsigned long flags;
-       struct iwl4965_rx_queue *rxq = &priv->rxq;
-       u8 val_link;
        u32 val;
-       int ret;
-
-       /* nic_init */
-       priv->cfg->ops->lib->apm_ops.init(priv);
-
-       spin_lock_irqsave(&priv->lock, flags);
-       iwl_write32(priv, CSR_INT_COALESCING, 512 / 32);
-       spin_unlock_irqrestore(&priv->lock, flags);
-
-       ret = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN);
+       u16 radio_cfg;
+       u8 val_link;
 
        spin_lock_irqsave(&priv->lock, flags);
 
@@ -605,37 +596,49 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv)
                                       val & ~(1 << 11));
        }
 
-       spin_unlock_irqrestore(&priv->lock, flags);
-
        pci_read_config_byte(priv->pci_dev, PCI_LINK_CTRL, &val_link);
 
        /* disable L1 entry -- workaround for pre-B1 */
        pci_write_config_byte(priv->pci_dev, PCI_LINK_CTRL, val_link & ~0x02);
 
-       spin_lock_irqsave(&priv->lock, flags);
+       radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
 
-       /* set CSR_HW_CONFIG_REG for uCode use */
+       /* write radio config values to register */
+       if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) == EEPROM_4965_RF_CFG_TYPE_MAX)
+               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+                           EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
+                           EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
+                           EEPROM_RF_CFG_DASH_MSK(radio_cfg));
 
+       /* set CSR_HW_CONFIG_REG for uCode use */
        iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
-                   CSR49_HW_IF_CONFIG_REG_BIT_4965_R |
                    CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
                    CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
 
-       ret = iwl_grab_nic_access(priv);
-       if (ret < 0) {
-               spin_unlock_irqrestore(&priv->lock, flags);
-               IWL_DEBUG_INFO("Failed to init the card\n");
-               return ret;
-       }
+       priv->calib_info = (struct iwl_eeprom_calib_info *)
+               iwl_eeprom_query_addr(priv, EEPROM_4965_CALIB_TXPOWER_OFFSET);
 
-       iwl_read_prph(priv, APMG_PS_CTRL_REG);
-       iwl_set_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ);
-       udelay(5);
-       iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ);
+       spin_unlock_irqrestore(&priv->lock, flags);
+}
 
-       iwl_release_nic_access(priv);
+
+int iwl4965_hw_nic_init(struct iwl_priv *priv)
+{
+       unsigned long flags;
+       struct iwl4965_rx_queue *rxq = &priv->rxq;
+       int ret;
+
+       /* nic_init */
+       priv->cfg->ops->lib->apm_ops.init(priv);
+
+       spin_lock_irqsave(&priv->lock, flags);
+       iwl_write32(priv, CSR_INT_COALESCING, 512 / 32);
        spin_unlock_irqrestore(&priv->lock, flags);
 
+       ret = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN);
+
+       priv->cfg->ops->lib->apm_ops.config(priv);
+
        iwl4965_hw_card_show_info(priv);
 
        /* end nic_init */
@@ -659,10 +662,6 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv)
        rxq->need_update = 1;
        iwl4965_rx_queue_update_write_ptr(priv, rxq);
 
-       /* init the txpower calibration pointer */
-       priv->calib_info = (struct iwl_eeprom_calib_info *)
-               iwl_eeprom_query_addr(priv, EEPROM_4965_CALIB_TXPOWER_OFFSET);
-
        spin_unlock_irqrestore(&priv->lock, flags);
 
        /* Allocate and init all Tx and Command queues */
@@ -3548,13 +3547,16 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv,
         * block-ack window (we assume that they've been successfully
         * transmitted ... if not, it's too late anyway). */
        if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) {
+               /* calculate mac80211 ampdu sw queue to wake */
+               int ampdu_q =
+                  scd_flow - IWL_BACK_QUEUE_FIRST_ID + priv->hw->queues;
                int freed = iwl4965_tx_queue_reclaim(priv, scd_flow, index);
                priv->stations[ba_resp->sta_id].
                        tid[ba_resp->tid].tfds_in_queue -= freed;
                if (iwl4965_queue_space(&txq->q) > txq->q.low_mark &&
                        priv->mac80211_registered &&
                        agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)
-                       ieee80211_wake_queue(priv->hw, scd_flow);
+                       ieee80211_wake_queue(priv->hw, ampdu_q);
                iwl4965_check_empty_hw_queue(priv, ba_resp->sta_id,
                        ba_resp->tid, scd_flow);
        }
@@ -4065,7 +4067,7 @@ int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
 #endif /* CONFIG_IWL4965_HT */
 
 /* Set up 4965-specific Rx frame reply handlers */
-void iwl4965_hw_rx_handler_setup(struct iwl_priv *priv)
+static void iwl4965_rx_handler_setup(struct iwl_priv *priv)
 {
        /* Legacy Rx frames */
        priv->rx_handlers[REPLY_RX] = iwl4965_rx_reply_rx;
@@ -4119,11 +4121,13 @@ static struct iwl_lib_ops iwl4965_lib = {
        .free_shared_mem = iwl4965_free_shared_mem,
        .txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl,
        .hw_nic_init = iwl4965_hw_nic_init,
+       .rx_handler_setup = iwl4965_rx_handler_setup,
        .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr,
        .alive_notify = iwl4965_alive_notify,
        .load_ucode = iwl4965_load_bsm,
        .apm_ops = {
                .init = iwl4965_apm_init,
+               .config = iwl4965_nic_config,
                .set_pwr_src = iwl4965_set_pwr_src,
        },
        .eeprom_ops = {
This page took 0.027571 seconds and 5 git commands to generate.