]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
authorJohn W. Linville <linville@tuxdriver.com>
Fri, 4 Mar 2011 19:10:40 +0000 (14:10 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 4 Mar 2011 19:10:40 +0000 (14:10 -0500)
1  2 
drivers/net/wireless/iwlegacy/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/rtlwifi/wifi.h
drivers/staging/brcm80211/sys/wl_mac80211.c
drivers/staging/brcm80211/sys/wlc_mac80211.c
net/mac80211/Kconfig

index f4cd9370e7facf74ecad4d9f012764f6a33236f9,8359594839e252d119a9284d966df9004b847d89..d096dc28204d70a60df4391163e6cd0500fc6326
@@@ -1,6 -1,6 +1,6 @@@
  /******************************************************************************
   *
-  * Copyright(c) 2003 - 2010 Intel Corporation. All rights reserved.
+  * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
   *
   * This program is free software; you can redistribute it and/or modify it
   * under the terms of version 2 of the GNU General Public License as
@@@ -51,7 -51,6 +51,6 @@@
  #include "iwl-led.h"
  #include "iwl-3945-led.h"
  #include "iwl-3945-debugfs.h"
- #include "iwl-legacy.h"
  
  #define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np)    \
        [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP,   \
@@@ -172,14 -171,14 +171,14 @@@ void iwl3945_disable_events(struct iwl_
                return;
        }
  
-       disable_ptr = iwl_read_targ_mem(priv, base + (4 * sizeof(u32)));
-       array_size = iwl_read_targ_mem(priv, base + (5 * sizeof(u32)));
+       disable_ptr = iwl_legacy_read_targ_mem(priv, base + (4 * sizeof(u32)));
+       array_size = iwl_legacy_read_targ_mem(priv, base + (5 * sizeof(u32)));
  
        if (IWL_EVT_DISABLE && (array_size == IWL_EVT_DISABLE_SIZE)) {
                IWL_DEBUG_INFO(priv, "Disabling selected uCode log events at 0x%x\n",
                               disable_ptr);
                for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++)
-                       iwl_write_targ_mem(priv,
+                       iwl_legacy_write_targ_mem(priv,
                                           disable_ptr + (i * sizeof(u32)),
                                           evt_disable[i]);
  
@@@ -202,7 -201,7 +201,7 @@@ static int iwl3945_hwrate_to_plcp_idx(u
        return -1;
  }
  
- #ifdef CONFIG_IWLWIFI_DEBUG
+ #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
  #define TX_STATUS_ENTRY(x) case TX_3945_STATUS_FAIL_ ## x: return #x
  
  static const char *iwl3945_get_tx_fail_reason(u32 status)
@@@ -255,7 -254,7 +254,7 @@@ int iwl3945_rs_next_rate(struct iwl_pri
                break;
        case IEEE80211_BAND_2GHZ:
                if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) &&
-                   iwl_is_associated(priv, IWL_RXON_CTX_BSS)) {
+                   iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) {
                        if (rate == IWL_RATE_11M_INDEX)
                                next_rate = IWL_RATE_5M_INDEX;
                }
@@@ -285,8 -284,9 +284,9 @@@ static void iwl3945_tx_queue_reclaim(st
  
        BUG_ON(txq_id == IWL39_CMD_QUEUE_NUM);
  
-       for (index = iwl_queue_inc_wrap(index, q->n_bd); q->read_ptr != index;
-               q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
+       for (index = iwl_legacy_queue_inc_wrap(index, q->n_bd);
+               q->read_ptr != index;
+               q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) {
  
                tx_info = &txq->txb[txq->q.read_ptr];
                ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb);
                priv->cfg->ops->lib->txq_free_tfd(priv, txq);
        }
  
-       if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) &&
+       if (iwl_legacy_queue_space(q) > q->low_mark && (txq_id >= 0) &&
                        (txq_id != IWL39_CMD_QUEUE_NUM) &&
                        priv->mac80211_registered)
-               iwl_wake_queue(priv, txq);
+               iwl_legacy_wake_queue(priv, txq);
  }
  
  /**
@@@ -317,7 -317,7 +317,7 @@@ static void iwl3945_rx_reply_tx(struct 
        int rate_idx;
        int fail;
  
-       if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
+       if ((index >= txq->q.n_bd) || (iwl_legacy_queue_used(&txq->q, index) == 0)) {
                IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d "
                          "is out of range [0-%d] %d %d\n", txq_id,
                          index, txq->q.n_bd, txq->q.write_ptr,
   *  RX handler implementations
   *
   *****************************************************************************/
- #ifdef CONFIG_IWLWIFI_DEBUGFS
- /*
-  *  based on the assumption of all statistics counter are in DWORD
-  *  FIXME: This function is for debugging, do not deal with
-  *  the case of counters roll-over.
-  */
+ #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
  static void iwl3945_accumulative_statistics(struct iwl_priv *priv,
                                            __le32 *stats)
  {
@@@ -410,10 -405,10 +405,10 @@@ void iwl3945_hw_rx_statistics(struct iw
        IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
                     (int)sizeof(struct iwl3945_notif_statistics),
                     le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
- #ifdef CONFIG_IWLWIFI_DEBUGFS
+ #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
        iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw);
  #endif
-       iwl_recover_from_statistics(priv, pkt);
+       iwl_legacy_recover_from_statistics(priv, pkt);
  
        memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics));
  }
@@@ -425,7 -420,7 +420,7 @@@ void iwl3945_reply_statistics(struct iw
        __le32 *flag = (__le32 *)&pkt->u.raw;
  
        if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) {
- #ifdef CONFIG_IWLWIFI_DEBUGFS
+ #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS
                memset(&priv->_3945.accum_statistics, 0,
                        sizeof(struct iwl3945_notif_statistics));
                memset(&priv->_3945.delta_statistics, 0,
@@@ -496,14 -491,14 +491,14 @@@ static void iwl3945_pass_packet_to_mac8
        }
  
        if (!iwl3945_mod_params.sw_crypto)
-               iwl_set_decrypted_flag(priv,
+               iwl_legacy_set_decrypted_flag(priv,
                                       (struct ieee80211_hdr *)rxb_addr(rxb),
                                       le32_to_cpu(rx_end->status), stats);
  
        skb_add_rx_frag(skb, 0, rxb->page,
                        (void *)rx_hdr->payload - (void *)pkt, len);
  
-       iwl_update_stats(priv, false, fc, len);
+       iwl_legacy_update_stats(priv, false, fc, len);
        memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats));
  
        ieee80211_rx(priv->hw, skb);
@@@ -576,7 -571,8 +571,8 @@@ static void iwl3945_rx_reply_rx(struct 
                              rx_status.signal, rx_status.signal,
                              rx_status.rate_idx);
  
-       iwl_dbg_log_rx_data_frame(priv, le16_to_cpu(rx_hdr->len), header);
+       iwl_legacy_dbg_log_rx_data_frame(priv, le16_to_cpu(rx_hdr->len),
+                                               header);
  
        if (network_packet) {
                priv->_3945.last_beacon_time =
@@@ -744,7 -740,7 +740,7 @@@ static u8 iwl3945_sync_sta(struct iwl_p
        station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK;
        station->sta.rate_n_flags = cpu_to_le16(tx_rate);
        station->sta.mode = STA_CONTROL_MODIFY_MSK;
-       iwl_send_add_sta(priv, &station->sta, CMD_ASYNC);
+       iwl_legacy_send_add_sta(priv, &station->sta, CMD_ASYNC);
        spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
  
        IWL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n",
@@@ -759,7 -755,7 +755,7 @@@ static void iwl3945_set_pwr_vmain(struc
   * to set power to V_AUX, do
  
                if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) {
-                       iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
+                       iwl_legacy_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
                                        APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
                                        ~APMG_PS_CTRL_MSK_PWR_SRC);
  
                }
   */
  
-       iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
+       iwl_legacy_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
                        APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
                        ~APMG_PS_CTRL_MSK_PWR_SRC);
  
  
  static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
  {
-       iwl_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->bd_dma);
-       iwl_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0), rxq->rb_stts_dma);
-       iwl_write_direct32(priv, FH39_RCSR_WPTR(0), 0);
-       iwl_write_direct32(priv, FH39_RCSR_CONFIG(0),
+       iwl_legacy_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->bd_dma);
+       iwl_legacy_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0),
+                                       rxq->rb_stts_dma);
+       iwl_legacy_write_direct32(priv, FH39_RCSR_WPTR(0), 0);
+       iwl_legacy_write_direct32(priv, FH39_RCSR_CONFIG(0),
                FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE |
                FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE |
                FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN |
                FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH);
  
        /* fake read to flush all prev I/O */
-       iwl_read_direct32(priv, FH39_RSSR_CTRL);
+       iwl_legacy_read_direct32(priv, FH39_RSSR_CTRL);
  
        return 0;
  }
@@@ -802,23 -799,23 +799,23 @@@ static int iwl3945_tx_reset(struct iwl_
  {
  
        /* bypass mode */
-       iwl_write_prph(priv, ALM_SCD_MODE_REG, 0x2);
+       iwl_legacy_write_prph(priv, ALM_SCD_MODE_REG, 0x2);
  
        /* RA 0 is active */
-       iwl_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01);
+       iwl_legacy_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01);
  
        /* all 6 fifo are active */
-       iwl_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f);
+       iwl_legacy_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f);
  
-       iwl_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000);
-       iwl_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002);
-       iwl_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004);
-       iwl_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005);
+       iwl_legacy_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000);
+       iwl_legacy_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002);
+       iwl_legacy_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004);
+       iwl_legacy_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005);
  
-       iwl_write_direct32(priv, FH39_TSSR_CBB_BASE,
+       iwl_legacy_write_direct32(priv, FH39_TSSR_CBB_BASE,
                             priv->_3945.shared_phys);
  
-       iwl_write_direct32(priv, FH39_TSSR_MSG_CONFIG,
+       iwl_legacy_write_direct32(priv, FH39_TSSR_MSG_CONFIG,
                FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON |
                FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON |
                FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B |
@@@ -844,7 -841,7 +841,7 @@@ static int iwl3945_txq_ctx_reset(struc
        iwl3945_hw_txq_ctx_free(priv);
  
        /* allocate tx queue structure */
-       rc = iwl_alloc_txq_mem(priv);
+       rc = iwl_legacy_alloc_txq_mem(priv);
        if (rc)
                return rc;
  
        for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) {
                slots_num = (txq_id == IWL39_CMD_QUEUE_NUM) ?
                                TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
-               rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
-                                      txq_id);
+               rc = iwl_legacy_tx_queue_init(priv, &priv->txq[txq_id],
+                                               slots_num, txq_id);
                if (rc) {
                        IWL_ERR(priv, "Tx %d queue init failed\n", txq_id);
                        goto error;
  
  /*
   * Start up 3945's basic functionality after it has been reset
-  * (e.g. after platform boot, or shutdown via iwl_apm_stop())
+  * (e.g. after platform boot, or shutdown via iwl_legacy_apm_stop())
   * NOTE:  This does not load uCode nor start the embedded processor
   */
  static int iwl3945_apm_init(struct iwl_priv *priv)
  {
-       int ret = iwl_apm_init(priv);
+       int ret = iwl_legacy_apm_init(priv);
  
        /* Clear APMG (NIC's internal power management) interrupts */
-       iwl_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0);
-       iwl_write_prph(priv, APMG_RTC_INT_STT_REG, 0xFFFFFFFF);
+       iwl_legacy_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0);
+       iwl_legacy_write_prph(priv, APMG_RTC_INT_STT_REG, 0xFFFFFFFF);
  
        /* Reset radio chip */
-       iwl_set_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ);
+       iwl_legacy_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);
+       iwl_legacy_clear_bits_prph(priv, APMG_PS_CTRL_REG,
+                               APMG_PS_CTRL_VAL_RESET_REQ);
  
        return ret;
  }
@@@ -898,28 -897,30 +897,28 @@@ static void iwl3945_nic_config(struct i
  {
        struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom;
        unsigned long flags;
 -      u8 rev_id = 0;
 +      u8 rev_id = priv->pci_dev->revision;
  
        spin_lock_irqsave(&priv->lock, flags);
  
        /* Determine HW type */
 -      pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &rev_id);
 -
        IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id);
  
        if (rev_id & PCI_CFG_REV_ID_BIT_RTP)
                IWL_DEBUG_INFO(priv, "RTP type\n");
        else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) {
                IWL_DEBUG_INFO(priv, "3945 RADIO-MB type\n");
-               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+               iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BIT_3945_MB);
        } else {
                IWL_DEBUG_INFO(priv, "3945 RADIO-MM type\n");
-               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+               iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BIT_3945_MM);
        }
  
        if (EEPROM_SKU_CAP_OP_MODE_MRC == eeprom->sku_cap) {
                IWL_DEBUG_INFO(priv, "SKU OP mode is mrc\n");
-               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+               iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC);
        } else
                IWL_DEBUG_INFO(priv, "SKU OP mode is basic\n");
        if ((eeprom->board_revision & 0xF0) == 0xD0) {
                IWL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n",
                               eeprom->board_revision);
-               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+               iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE);
        } else {
                IWL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n",
                               eeprom->board_revision);
-               iwl_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
+               iwl_legacy_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
                              CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE);
        }
  
        if (eeprom->almgor_m_version <= 1) {
-               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+               iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A);
                IWL_DEBUG_INFO(priv, "Card M type A version is 0x%X\n",
                               eeprom->almgor_m_version);
        } else {
                IWL_DEBUG_INFO(priv, "Card M type B version is 0x%X\n",
                               eeprom->almgor_m_version);
-               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+               iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B);
        }
        spin_unlock_irqrestore(&priv->lock, flags);
@@@ -972,7 -973,7 +971,7 @@@ int iwl3945_hw_nic_init(struct iwl_pri
  
        /* Allocate the RX queue, or reset if it is already allocated */
        if (!rxq->bd) {
-               rc = iwl_rx_queue_alloc(priv);
+               rc = iwl_legacy_rx_queue_alloc(priv);
                if (rc) {
                        IWL_ERR(priv, "Unable to initialize Rx queue\n");
                        return -ENOMEM;
  
        /* Look at using this instead:
        rxq->need_update = 1;
-       iwl_rx_queue_update_write_ptr(priv, rxq);
+       iwl_legacy_rx_queue_update_write_ptr(priv, rxq);
        */
  
-       iwl_write_direct32(priv, FH39_RCSR_WPTR(0), rxq->write & ~7);
+       iwl_legacy_write_direct32(priv, FH39_RCSR_WPTR(0), rxq->write & ~7);
  
        rc = iwl3945_txq_ctx_reset(priv);
        if (rc)
@@@ -1015,12 -1016,12 +1014,12 @@@ void iwl3945_hw_txq_ctx_free(struct iwl
                for (txq_id = 0; txq_id < priv->hw_params.max_txq_num;
                     txq_id++)
                        if (txq_id == IWL39_CMD_QUEUE_NUM)
-                               iwl_cmd_queue_free(priv);
+                               iwl_legacy_cmd_queue_free(priv);
                        else
-                               iwl_tx_queue_free(priv, txq_id);
+                               iwl_legacy_tx_queue_free(priv, txq_id);
  
        /* free tx queue structure */
-       iwl_free_txq_mem(priv);
+       iwl_legacy_txq_mem(priv);
  }
  
  void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv)
        int txq_id;
  
        /* stop SCD */
-       iwl_write_prph(priv, ALM_SCD_MODE_REG, 0);
-       iwl_write_prph(priv, ALM_SCD_TXFACT_REG, 0);
+       iwl_legacy_write_prph(priv, ALM_SCD_MODE_REG, 0);
+       iwl_legacy_write_prph(priv, ALM_SCD_TXFACT_REG, 0);
  
        /* reset TFD queues */
        for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) {
-               iwl_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), 0x0);
+               iwl_legacy_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), 0x0);
                iwl_poll_direct_bit(priv, FH39_TSSR_TX_STATUS,
                                FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(txq_id),
                                1000);
@@@ -1100,12 -1101,12 +1099,12 @@@ static int iwl3945_hw_reg_txpower_get_t
  #define IWL_TEMPERATURE_LIMIT_TIMER   6
  
  /**
-  * is_temp_calib_needed - determines if new calibration is needed
+  * iwl3945_is_temp_calib_needed - determines if new calibration is needed
   *
   * records new temperature in tx_mgr->temperature.
   * replaces tx_mgr->last_temperature *only* if calib needed
   *    (assumes caller will actually do the calibration!). */
- static int is_temp_calib_needed(struct iwl_priv *priv)
+ static int iwl3945_is_temp_calib_needed(struct iwl_priv *priv)
  {
        int temp_diff;
  
@@@ -1336,9 -1337,6 +1335,6 @@@ static void iwl3945_hw_reg_set_scan_pow
         *   based on eeprom channel data) for this channel.  */
        power = min(ch_info->scan_power, clip_pwrs[IWL_RATE_6M_INDEX_TABLE]);
  
-       /* further limit to user's max power preference.
-        * FIXME:  Other spectrum management power limitations do not
-        *   seem to apply?? */
        power = min(power, priv->tx_power_user_lmt);
        scan_power_info->requested_power = power;
  
@@@ -1392,7 -1390,7 +1388,7 @@@ static int iwl3945_send_tx_power(struc
        chan = le16_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.channel);
  
        txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
-       ch_info = iwl_get_channel_info(priv, priv->band, chan);
+       ch_info = iwl_legacy_get_channel_info(priv, priv->band, chan);
        if (!ch_info) {
                IWL_ERR(priv,
                        "Failed to get channel info for channel %d [%d]\n",
                return -EINVAL;
        }
  
-       if (!is_channel_valid(ch_info)) {
+       if (!iwl_legacy_is_channel_valid(ch_info)) {
                IWL_DEBUG_POWER(priv, "Not calling TX_PWR_TABLE_CMD on "
                                "non-Tx channel.\n");
                return 0;
                                txpower.power[i].rate);
        }
  
-       return iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD,
+       return iwl_legacy_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD,
                                sizeof(struct iwl3945_txpowertable_cmd),
                                &txpower);
  
@@@ -1569,7 -1567,7 +1565,7 @@@ static int iwl3945_hw_reg_comp_txpower_
        /* set up new Tx power info for each and every channel, 2.4 and 5.x */
        for (i = 0; i < priv->channel_count; i++) {
                ch_info = &priv->channel_info[i];
-               a_band = is_channel_a_band(ch_info);
+               a_band = iwl_legacy_is_channel_a_band(ch_info);
  
                /* Get this chnlgrp's factory calibration temperature */
                ref_temp = (s16)eeprom->groups[ch_info->group_index].
@@@ -1635,7 -1633,7 +1631,7 @@@ int iwl3945_hw_reg_set_txpower(struct i
  
        for (i = 0; i < priv->channel_count; i++) {
                ch_info = &priv->channel_info[i];
-               a_band = is_channel_a_band(ch_info);
+               a_band = iwl_legacy_is_channel_a_band(ch_info);
  
                /* find minimum power of all user and regulatory constraints
                 *    (does not consider h/w clipping limitations) */
  
        /* update txpower settings for all channels,
         *   send to NIC if associated. */
-       is_temp_calib_needed(priv);
+       iwl3945_is_temp_calib_needed(priv);
        iwl3945_hw_reg_comp_txpower_temp(priv);
  
        return 0;
@@@ -1669,8 -1667,8 +1665,8 @@@ static int iwl3945_send_rxon_assoc(stru
                .flags = CMD_WANT_SKB,
                .data = &rxon_assoc,
        };
-       const struct iwl_rxon_cmd *rxon1 = &ctx->staging;
-       const struct iwl_rxon_cmd *rxon2 = &ctx->active;
+       const struct iwl_legacy_rxon_cmd *rxon1 = &ctx->staging;
+       const struct iwl_legacy_rxon_cmd *rxon2 = &ctx->active;
  
        if ((rxon1->flags == rxon2->flags) &&
            (rxon1->filter_flags == rxon2->filter_flags) &&
        rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates;
        rxon_assoc.reserved = 0;
  
-       rc = iwl_send_cmd_sync(priv, &cmd);
+       rc = iwl_legacy_send_cmd_sync(priv, &cmd);
        if (rc)
                return rc;
  
                rc = -EIO;
        }
  
-       iwl_free_pages(priv, cmd.reply_page);
+       iwl_legacy_free_pages(priv, cmd.reply_page);
  
        return rc;
  }
@@@ -1720,7 -1718,7 +1716,7 @@@ int iwl3945_commit_rxon(struct iwl_pri
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return -EINVAL;
  
-       if (!iwl_is_alive(priv))
+       if (!iwl_legacy_is_alive(priv))
                return -1;
  
        /* always get timestamp with Rx frame */
            ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK);
        staging_rxon->flags |= iwl3945_get_antenna_flags(priv);
  
-       rc = iwl_check_rxon_cmd(priv, ctx);
+       rc = iwl_legacy_check_rxon_cmd(priv, ctx);
        if (rc) {
                IWL_ERR(priv, "Invalid RXON configuration.  Not committing.\n");
                return -EINVAL;
        /* If we don't need to send a full RXON, we can use
         * iwl3945_rxon_assoc_cmd which is used to reconfigure filter
         * and other flags for the current radio configuration. */
-       if (!iwl_full_rxon_required(priv, &priv->contexts[IWL_RXON_CTX_BSS])) {
-               rc = iwl_send_rxon_assoc(priv,
+       if (!iwl_legacy_full_rxon_required(priv,
+                       &priv->contexts[IWL_RXON_CTX_BSS])) {
+               rc = iwl_legacy_send_rxon_assoc(priv,
                                         &priv->contexts[IWL_RXON_CTX_BSS]);
                if (rc) {
                        IWL_ERR(priv, "Error setting RXON_ASSOC "
         * an RXON_ASSOC and the new config wants the associated mask enabled,
         * we must clear the associated from the active configuration
         * before we apply the new config */
-       if (iwl_is_associated(priv, IWL_RXON_CTX_BSS) && new_assoc) {
+       if (iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS) && new_assoc) {
                IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n");
                active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
  
                 */
                active_rxon->reserved4 = 0;
                active_rxon->reserved5 = 0;
-               rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
+               rc = iwl_legacy_send_cmd_pdu(priv, REPLY_RXON,
                                      sizeof(struct iwl3945_rxon_cmd),
                                      &priv->contexts[IWL_RXON_CTX_BSS].active);
  
                                  "configuration (%d).\n", rc);
                        return rc;
                }
-               iwl_clear_ucode_stations(priv,
+               iwl_legacy_clear_ucode_stations(priv,
+                                        &priv->contexts[IWL_RXON_CTX_BSS]);
+               iwl_legacy_restore_stations(priv,
                                         &priv->contexts[IWL_RXON_CTX_BSS]);
-               iwl_restore_stations(priv, &priv->contexts[IWL_RXON_CTX_BSS]);
        }
  
        IWL_DEBUG_INFO(priv, "Sending RXON\n"
        staging_rxon->reserved4 = 0;
        staging_rxon->reserved5 = 0;
  
-       iwl_set_rxon_hwcrypto(priv, ctx, !iwl3945_mod_params.sw_crypto);
+       iwl_legacy_set_rxon_hwcrypto(priv, ctx, !iwl3945_mod_params.sw_crypto);
  
        /* Apply the new configuration */
-       rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
+       rc = iwl_legacy_send_cmd_pdu(priv, REPLY_RXON,
                              sizeof(struct iwl3945_rxon_cmd),
                              staging_rxon);
        if (rc) {
        memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
  
        if (!new_assoc) {
-               iwl_clear_ucode_stations(priv,
+               iwl_legacy_clear_ucode_stations(priv,
                                         &priv->contexts[IWL_RXON_CTX_BSS]);
-               iwl_restore_stations(priv, &priv->contexts[IWL_RXON_CTX_BSS]);
+               iwl_legacy_restore_stations(priv,
+                                       &priv->contexts[IWL_RXON_CTX_BSS]);
        }
  
        /* If we issue a new RXON command which required a tune then we must
         * send a new TXPOWER command or we won't be able to Tx any frames */
-       rc = iwl_set_tx_power(priv, priv->tx_power_next, true);
+       rc = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true);
        if (rc) {
                IWL_ERR(priv, "Error setting Tx power (%d).\n", rc);
                return rc;
@@@ -1851,7 -1852,7 +1850,7 @@@ void iwl3945_reg_txpower_periodic(struc
  {
        /* This will kick in the "brute force"
         * iwl3945_hw_reg_comp_txpower_temp() below */
-       if (!is_temp_calib_needed(priv))
+       if (!iwl3945_is_temp_calib_needed(priv))
                goto reschedule;
  
        /* Set up a new set of temp-adjusted TxPowers, send to NIC.
@@@ -1898,7 -1899,7 +1897,7 @@@ static u16 iwl3945_hw_reg_get_ch_grp_in
        u8 grp_channel;
  
        /* Find the group index for the channel ... don't use index 1(?) */
-       if (is_channel_a_band(ch_info)) {
+       if (iwl_legacy_is_channel_a_band(ch_info)) {
                for (group = 1; group < 5; group++) {
                        grp_channel = ch_grp[group].group_channel;
                        if (ch_info->channel <= grp_channel) {
@@@ -2078,8 -2079,8 +2077,8 @@@ int iwl3945_txpower_set_from_eeprom(str
        /* initialize Tx power info for each and every channel, 2.4 and 5.x */
        for (i = 0, ch_info = priv->channel_info; i < priv->channel_count;
             i++, ch_info++) {
-               a_band = is_channel_a_band(ch_info);
-               if (!is_channel_valid(ch_info))
+               a_band = iwl_legacy_is_channel_a_band(ch_info);
+               if (!iwl_legacy_is_channel_valid(ch_info))
                        continue;
  
                /* find this channel's channel group (*not* "band") index */
@@@ -2182,7 -2183,7 +2181,7 @@@ int iwl3945_hw_rxq_stop(struct iwl_pri
  {
        int rc;
  
-       iwl_write_direct32(priv, FH39_RCSR_CONFIG(0), 0);
+       iwl_legacy_write_direct32(priv, FH39_RCSR_CONFIG(0), 0);
        rc = iwl_poll_direct_bit(priv, FH39_RSSR_STATUS,
                        FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
        if (rc < 0)
@@@ -2199,10 -2200,10 +2198,10 @@@ int iwl3945_hw_tx_queue_init(struct iwl
  
        shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr);
  
-       iwl_write_direct32(priv, FH39_CBCC_CTRL(txq_id), 0);
-       iwl_write_direct32(priv, FH39_CBCC_BASE(txq_id), 0);
+       iwl_legacy_write_direct32(priv, FH39_CBCC_CTRL(txq_id), 0);
+       iwl_legacy_write_direct32(priv, FH39_CBCC_BASE(txq_id), 0);
  
-       iwl_write_direct32(priv, FH39_TCSR_CONFIG(txq_id),
+       iwl_legacy_write_direct32(priv, FH39_TCSR_CONFIG(txq_id),
                FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT |
                FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF |
                FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD |
@@@ -2231,7 -2232,8 +2230,8 @@@ static u16 iwl3945_get_hcmd_size(u8 cmd
  }
  
  
- static u16 iwl3945_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
+ static u16 iwl3945_build_addsta_hcmd(const struct iwl_legacy_addsta_cmd *cmd,
+                                                               u8 *data)
  {
        struct iwl3945_addsta_cmd *addsta = (struct iwl3945_addsta_cmd *)data;
        addsta->mode = cmd->mode;
@@@ -2259,7 -2261,7 +2259,7 @@@ static int iwl3945_add_bssid_station(st
        if (sta_id_r)
                *sta_id_r = IWL_INVALID_STATION;
  
-       ret = iwl_add_station_common(priv, ctx, addr, 0, NULL, &sta_id);
+       ret = iwl_legacy_add_station_common(priv, ctx, addr, 0, NULL, &sta_id);
        if (ret) {
                IWL_ERR(priv, "Unable to add station %pM\n", addr);
                return ret;
@@@ -2294,7 -2296,7 +2294,7 @@@ static int iwl3945_manage_ibss_station(
                return 0;
        }
  
-       return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id,
+       return iwl_legacy_remove_station(priv, vif_priv->ibss_bssid_sta_id,
                                  vif->bss_conf.bssid);
  }
  
@@@ -2345,7 -2347,7 +2345,7 @@@ int iwl3945_init_hw_rate_table(struct i
                 * 1M CCK rates */
  
                if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) &&
-                   iwl_is_associated(priv, IWL_RXON_CTX_BSS)) {
+                   iwl_legacy_is_associated(priv, IWL_RXON_CTX_BSS)) {
  
                        index = IWL_FIRST_CCK_RATE;
                        for (i = IWL_RATE_6M_INDEX_TABLE;
  
        /* Update the rate scaling for control frame Tx */
        rate_cmd.table_id = 0;
-       rc = iwl_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
+       rc = iwl_legacy_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
                              &rate_cmd);
        if (rc)
                return rc;
  
        /* Update the rate scaling for data frame Tx */
        rate_cmd.table_id = 1;
-       return iwl_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
+       return iwl_legacy_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
                                &rate_cmd);
  }
  
@@@ -2473,11 -2475,11 +2473,11 @@@ static int iwl3945_verify_bsm(struct iw
        IWL_DEBUG_INFO(priv, "Begin verify bsm\n");
  
        /* verify BSM SRAM contents */
-       val = iwl_read_prph(priv, BSM_WR_DWCOUNT_REG);
+       val = iwl_legacy_read_prph(priv, BSM_WR_DWCOUNT_REG);
        for (reg = BSM_SRAM_LOWER_BOUND;
             reg < BSM_SRAM_LOWER_BOUND + len;
             reg += sizeof(u32), image++) {
-               val = iwl_read_prph(priv, reg);
+               val = iwl_legacy_read_prph(priv, reg);
                if (val != le32_to_cpu(*image)) {
                        IWL_ERR(priv, "BSM uCode verification failed at "
                                  "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
   */
  static int iwl3945_eeprom_acquire_semaphore(struct iwl_priv *priv)
  {
-       _iwl_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK);
+       _iwl_legacy_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK);
        return 0;
  }
  
@@@ -2581,16 -2583,16 +2581,16 @@@ static int iwl3945_load_bsm(struct iwl_
        inst_len = priv->ucode_init.len;
        data_len = priv->ucode_init_data.len;
  
-       iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
-       iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
-       iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
-       iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);
+       iwl_legacy_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
+       iwl_legacy_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
+       iwl_legacy_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
+       iwl_legacy_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);
  
        /* Fill BSM memory with bootstrap instructions */
        for (reg_offset = BSM_SRAM_LOWER_BOUND;
             reg_offset < BSM_SRAM_LOWER_BOUND + len;
             reg_offset += sizeof(u32), image++)
-               _iwl_write_prph(priv, reg_offset,
+               _iwl_legacy_write_prph(priv, reg_offset,
                                          le32_to_cpu(*image));
  
        rc = iwl3945_verify_bsm(priv);
                return rc;
  
        /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
-       iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
-       iwl_write_prph(priv, BSM_WR_MEM_DST_REG,
+       iwl_legacy_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
+       iwl_legacy_write_prph(priv, BSM_WR_MEM_DST_REG,
                                 IWL39_RTC_INST_LOWER_BOUND);
-       iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
+       iwl_legacy_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
  
        /* Load bootstrap code into instruction SRAM now,
         *   to prepare to load "initialize" uCode */
-       iwl_write_prph(priv, BSM_WR_CTRL_REG,
+       iwl_legacy_write_prph(priv, BSM_WR_CTRL_REG,
                BSM_WR_CTRL_REG_BIT_START);
  
        /* Wait for load of bootstrap uCode to finish */
        for (i = 0; i < 100; i++) {
-               done = iwl_read_prph(priv, BSM_WR_CTRL_REG);
+               done = iwl_legacy_read_prph(priv, BSM_WR_CTRL_REG);
                if (!(done & BSM_WR_CTRL_REG_BIT_START))
                        break;
                udelay(10);
  
        /* Enable future boot loads whenever power management unit triggers it
         *   (e.g. when powering back up after power-save shutdown) */
-       iwl_write_prph(priv, BSM_WR_CTRL_REG,
+       iwl_legacy_write_prph(priv, BSM_WR_CTRL_REG,
                BSM_WR_CTRL_REG_BIT_START_EN);
  
        return 0;
  static struct iwl_hcmd_ops iwl3945_hcmd = {
        .rxon_assoc = iwl3945_send_rxon_assoc,
        .commit_rxon = iwl3945_commit_rxon,
-       .send_bt_config = iwl_send_bt_config,
  };
  
  static struct iwl_lib_ops iwl3945_lib = {
                },
                .acquire_semaphore = iwl3945_eeprom_acquire_semaphore,
                .release_semaphore = iwl3945_eeprom_release_semaphore,
-               .query_addr = iwlcore_eeprom_query_addr,
        },
        .send_tx_power  = iwl3945_send_tx_power,
        .is_valid_rtc_data_addr = iwl3945_hw_valid_rtc_data_addr,
-       .isr_ops = {
-               .isr = iwl_isr_legacy,
-       },
  
        .debugfs_ops = {
                .rx_stats_read = iwl3945_ucode_rx_stats_read,
@@@ -2683,7 -2680,6 +2678,6 @@@ static const struct iwl_legacy_ops iwl3
  static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
        .get_hcmd_size = iwl3945_get_hcmd_size,
        .build_addsta_hcmd = iwl3945_build_addsta_hcmd,
-       .tx_cmd_protection = iwl_legacy_tx_cmd_protection,
        .request_scan = iwl3945_request_scan,
        .post_scan = iwl3945_post_scan,
  };
@@@ -2703,13 -2699,10 +2697,10 @@@ static struct iwl_base_params iwl3945_b
        .pll_cfg_val = CSR39_ANA_PLL_CFG_VAL,
        .set_l0s = false,
        .use_bsm = true,
-       .use_isr_legacy = true,
        .led_compensation = 64,
-       .broken_powersave = true,
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
        .wd_timeout = IWL_DEF_WD_TIMEOUT,
        .max_event_log_size = 512,
-       .tx_power_by_driver = true,
  };
  
  static struct iwl_cfg iwl3945_bg_cfg = {
index 8025c62d4d0c66dc5bc76571639735f0ab18f083,c96d4ad5def0b3e8159e2b2d496b43f4e31e7f08..f189bbe78fa677cf31b4eab3b6e6f760e08272b3
@@@ -86,7 -86,6 +86,6 @@@ MODULE_DESCRIPTION(DRV_DESCRIPTION)
  MODULE_VERSION(DRV_VERSION);
  MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
  MODULE_LICENSE("GPL");
- MODULE_ALIAS("iwl4965");
  
  static int iwlagn_ant_coupling;
  static bool iwlagn_bt_ch_announce = 1;
@@@ -466,6 -465,15 +465,15 @@@ static void iwl_rx_reply_alive(struct i
                IWL_WARN(priv, "%s uCode did not respond OK.\n",
                        (palive->ver_subtype == INITIALIZE_SUBTYPE) ?
                        "init" : "runtime");
+               /*
+                * If fail to load init uCode,
+                * let's try to load the init uCode again.
+                * We should not get into this situation, but if it
+                * does happen, we should not move on and loading "runtime"
+                * without proper calibrate the device.
+                */
+               if (palive->ver_subtype == INITIALIZE_SUBTYPE)
+                       priv->ucode_type = UCODE_NONE;
                queue_work(priv->workqueue, &priv->restart);
        }
  }
@@@ -1405,72 -1413,6 +1413,6 @@@ static void iwl_irq_tasklet(struct iwl_
                iwl_enable_rfkill_int(priv);
  }
  
- /* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */
- #define ACK_CNT_RATIO (50)
- #define BA_TIMEOUT_CNT (5)
- #define BA_TIMEOUT_MAX (16)
- /**
-  * iwl_good_ack_health - checks for ACK count ratios, BA timeout retries.
-  *
-  * When the ACK count ratio is low and aggregated BA timeout retries exceeding
-  * the BA_TIMEOUT_MAX, reload firmware and bring system back to normal
-  * operation state.
-  */
- bool iwl_good_ack_health(struct iwl_priv *priv, struct iwl_rx_packet *pkt)
- {
-       int actual_delta, expected_delta, ba_timeout_delta;
-       struct statistics_tx *cur, *old;
-       if (priv->_agn.agg_tids_count)
-               return true;
-       if (iwl_bt_statistics(priv)) {
-               cur = &pkt->u.stats_bt.tx;
-               old = &priv->_agn.statistics_bt.tx;
-       } else {
-               cur = &pkt->u.stats.tx;
-               old = &priv->_agn.statistics.tx;
-       }
-       actual_delta = le32_to_cpu(cur->actual_ack_cnt) -
-                      le32_to_cpu(old->actual_ack_cnt);
-       expected_delta = le32_to_cpu(cur->expected_ack_cnt) -
-                        le32_to_cpu(old->expected_ack_cnt);
-       /* Values should not be negative, but we do not trust the firmware */
-       if (actual_delta <= 0 || expected_delta <= 0)
-               return true;
-       ba_timeout_delta = le32_to_cpu(cur->agg.ba_timeout) -
-                          le32_to_cpu(old->agg.ba_timeout);
-       if ((actual_delta * 100 / expected_delta) < ACK_CNT_RATIO &&
-           ba_timeout_delta > BA_TIMEOUT_CNT) {
-               IWL_DEBUG_RADIO(priv, "deltas: actual %d expected %d ba_timeout %d\n",
-                               actual_delta, expected_delta, ba_timeout_delta);
- #ifdef CONFIG_IWLWIFI_DEBUGFS
-               /*
-                * This is ifdef'ed on DEBUGFS because otherwise the
-                * statistics aren't available. If DEBUGFS is set but
-                * DEBUG is not, these will just compile out.
-                */
-               IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta %d\n",
-                               priv->_agn.delta_statistics.tx.rx_detected_cnt);
-               IWL_DEBUG_RADIO(priv,
-                               "ack_or_ba_timeout_collision delta %d\n",
-                               priv->_agn.delta_statistics.tx.ack_or_ba_timeout_collision);
- #endif
-               if (ba_timeout_delta >= BA_TIMEOUT_MAX)
-                       return false;
-       }
-       return true;
- }
  /*****************************************************************************
   *
   * sysfs attributes
@@@ -2735,9 -2677,11 +2677,11 @@@ static void iwl_alive_start(struct iwl_
                        priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
        }
  
-       if (priv->cfg->bt_params &&
-           !priv->cfg->bt_params->advanced_bt_coexist) {
-               /* Configure Bluetooth device coexistence support */
+       if (!priv->cfg->bt_params || (priv->cfg->bt_params &&
+           !priv->cfg->bt_params->advanced_bt_coexist)) {
+               /*
+                * default is 2-wire BT coexexistence support
+                */
                priv->cfg->ops->hcmd->send_bt_config(priv);
        }
  
@@@ -3320,7 -3264,7 +3264,7 @@@ void iwlagn_mac_stop(struct ieee80211_h
        IWL_DEBUG_MAC80211(priv, "leave\n");
  }
  
int iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
void iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
  {
        struct iwl_priv *priv = hw->priv;
  
                dev_kfree_skb_any(skb);
  
        IWL_DEBUG_MACDUMP(priv, "leave\n");
-       return NETDEV_TX_OK;
  }
  
  void iwlagn_mac_update_tkip_key(struct ieee80211_hw *hw,
@@@ -3799,7 -3742,6 +3742,6 @@@ static void iwlagn_bg_roc_done(struct w
        mutex_unlock(&priv->mutex);
  }
  
- #ifdef CONFIG_IWL5000
  static int iwl_mac_remain_on_channel(struct ieee80211_hw *hw,
                                     struct ieee80211_channel *channel,
                                     enum nl80211_channel_type channel_type,
@@@ -3855,7 -3797,6 +3797,6 @@@ static int iwl_mac_cancel_remain_on_cha
  
        return 0;
  }
- #endif
  
  /*****************************************************************************
   *
@@@ -4025,7 -3966,6 +3966,6 @@@ static void iwl_uninit_drv(struct iwl_p
        kfree(priv->scan_cmd);
  }
  
- #ifdef CONFIG_IWL5000
  struct ieee80211_ops iwlagn_hw_ops = {
        .tx = iwlagn_mac_tx,
        .start = iwlagn_mac_start,
        .remain_on_channel = iwl_mac_remain_on_channel,
        .cancel_remain_on_channel = iwl_mac_cancel_remain_on_channel,
  };
- #endif
  
  static void iwl_hw_detect(struct iwl_priv *priv)
  {
        priv->hw_rev = _iwl_read32(priv, CSR_HW_REV);
        priv->hw_wa_rev = _iwl_read32(priv, CSR_HW_REV_WA_REG);
 -      pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &priv->rev_id);
 +      priv->rev_id = priv->pci_dev->revision;
        IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", priv->rev_id);
  }
  
@@@ -4118,12 -4057,7 +4057,7 @@@ static int iwl_pci_probe(struct pci_de
        if (cfg->mod_params->disable_hw_scan) {
                dev_printk(KERN_DEBUG, &(pdev->dev),
                        "sw scan support is deprecated\n");
- #ifdef CONFIG_IWL5000
                iwlagn_hw_ops.hw_scan = NULL;
- #endif
- #ifdef CONFIG_IWL4965
-               iwl4965_hw_ops.hw_scan = NULL;
- #endif
        }
  
        hw = iwl_alloc_all(cfg);
@@@ -4502,12 -4436,6 +4436,6 @@@ static void __devexit iwl_pci_remove(st
  
  /* Hardware specific file defines the PCI IDs table for that hardware module */
  static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
- #ifdef CONFIG_IWL4965
-       {IWL_PCI_DEVICE(0x4229, PCI_ANY_ID, iwl4965_agn_cfg)},
-       {IWL_PCI_DEVICE(0x4230, PCI_ANY_ID, iwl4965_agn_cfg)},
- #endif /* CONFIG_IWL4965 */
- #ifdef CONFIG_IWL5000
- /* 5100 Series WiFi */
        {IWL_PCI_DEVICE(0x4232, 0x1201, iwl5100_agn_cfg)}, /* Mini Card */
        {IWL_PCI_DEVICE(0x4232, 0x1301, iwl5100_agn_cfg)}, /* Half Mini Card */
        {IWL_PCI_DEVICE(0x4232, 0x1204, iwl5100_agn_cfg)}, /* Mini Card */
        {IWL_PCI_DEVICE(0x0893, 0x0266, iwl230_bg_cfg)},
        {IWL_PCI_DEVICE(0x0892, 0x0466, iwl230_bg_cfg)},
  
- #endif /* CONFIG_IWL5000 */
        {0}
  };
  MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
@@@ -4793,3 -4719,9 +4719,9 @@@ MODULE_PARM_DESC(antenna_coupling
  module_param_named(bt_ch_inhibition, iwlagn_bt_ch_announce, bool, S_IRUGO);
  MODULE_PARM_DESC(bt_ch_inhibition,
                 "Disable BT channel inhibition (default: enable)");
+ module_param_named(plcp_check, iwlagn_mod_params.plcp_check, bool, S_IRUGO);
+ MODULE_PARM_DESC(plcp_check, "Check plcp health (default: 1 [enabled])");
+ module_param_named(ack_check, iwlagn_mod_params.ack_check, bool, S_IRUGO);
+ MODULE_PARM_DESC(ack_check, "Check ack health (default: 0 [disabled])");
index 7d47184d6bfeb4bcbc8b27f5ad88c6359fc6b4d4,9d0c01a86d0c6562f87c3474d8d963894b143f54..01226f8e70f948b32d9d820b61cd033d25dd9ef7
@@@ -34,7 -34,6 +34,7 @@@
  #include <linux/firmware.h>
  #include <linux/version.h>
  #include <linux/etherdevice.h>
 +#include <linux/vmalloc.h>
  #include <linux/usb.h>
  #include <net/mac80211.h>
  #include "debug.h"
@@@ -1384,6 -1383,18 +1384,18 @@@ struct rtl_hal_ops 
                          u32 regaddr, u32 bitmask);
        void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath,
                           u32 regaddr, u32 bitmask, u32 data);
+       bool (*phy_rf6052_config) (struct ieee80211_hw *hw);
+       void (*phy_rf6052_set_cck_txpower) (struct ieee80211_hw *hw,
+                                           u8 *powerlevel);
+       void (*phy_rf6052_set_ofdm_txpower) (struct ieee80211_hw *hw,
+                                            u8 *ppowerlevel, u8 channel);
+       bool (*config_bb_with_headerfile) (struct ieee80211_hw *hw,
+                                          u8 configtype);
+       bool (*config_bb_with_pgheaderfile) (struct ieee80211_hw *hw,
+                                            u8 configtype);
+       void (*phy_lc_calibrate) (struct ieee80211_hw *hw, bool is2t);
+       void (*phy_set_bw_mode_callback) (struct ieee80211_hw *hw);
+       void (*dm_dynamic_txpower) (struct ieee80211_hw *hw);
  };
  
  struct rtl_intf_ops {
index cd8392badff07e6059cf2b2e99fb697a2855b220,c83bdcc640a5d26ba83e6bc73dfd72725f3142bb..6363077468f1297e8135a0bf7b4c5d21785f2aa1
@@@ -104,9 -104,6 +104,6 @@@ static int wl_request_fw(struct wl_inf
  static void wl_release_fw(struct wl_info *wl);
  
  /* local prototypes */
- static int wl_start(struct sk_buff *skb, struct wl_info *wl);
- static int wl_start_int(struct wl_info *wl, struct ieee80211_hw *hw,
-                       struct sk_buff *skb);
  static void wl_dpc(unsigned long data);
  
  MODULE_AUTHOR("Broadcom Corporation");
@@@ -135,7 -132,6 +132,6 @@@ module_param(phymsglevel, int, 0)
  
  #define HW_TO_WL(hw)   (hw->priv)
  #define WL_TO_HW(wl)    (wl->pub->ieee_hw)
- static int wl_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
  static int wl_ops_start(struct ieee80211_hw *hw);
  static void wl_ops_stop(struct ieee80211_hw *hw);
  static int wl_ops_add_interface(struct ieee80211_hw *hw,
@@@ -173,20 -169,18 +169,18 @@@ static int wl_ampdu_action(struct ieee8
                           enum ieee80211_ampdu_mlme_action action,
                           struct ieee80211_sta *sta, u16 tid, u16 *ssn);
  
- static int wl_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
+ static void wl_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
  {
-       int status;
        struct wl_info *wl = hw->priv;
        WL_LOCK(wl);
        if (!wl->pub->up) {
                WL_ERROR("ops->tx called while down\n");
-               status = -ENETDOWN;
+               kfree_skb(skb);
                goto done;
        }
-       status = wl_start(skb, wl);
+       wlc_sendpkt_mac80211(wl->wlc, skb, hw);
   done:
        WL_UNLOCK(wl);
-       return status;
  }
  
  static int wl_ops_start(struct ieee80211_hw *hw)
@@@ -209,8 -203,11 +203,8 @@@ static void wl_ops_stop(struct ieee8021
        struct wl_info *wl = hw->priv;
        ASSERT(wl);
        WL_LOCK(wl);
 -      wl_down(wl);
        ieee80211_stop_queues(hw);
        WL_UNLOCK(wl);
 -
 -      return;
  }
  
  static int
@@@ -243,14 -240,7 +237,14 @@@ wl_ops_add_interface(struct ieee80211_h
  static void
  wl_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  {
 -      return;
 +      struct wl_info *wl;
 +
 +      wl = HW_TO_WL(hw);
 +
 +      /* put driver in down state */
 +      WL_LOCK(wl);
 +      wl_down(wl);
 +      WL_UNLOCK(wl);
  }
  
  static int
@@@ -263,7 -253,9 +257,7 @@@ ieee_set_channel(struct ieee80211_hw *h
        switch (type) {
        case NL80211_CHAN_HT20:
        case NL80211_CHAN_NO_HT:
 -              WL_LOCK(wl);
                err = wlc_set(wl->wlc, WLC_SET_CHANNEL, chan->hw_value);
 -              WL_UNLOCK(wl);
                break;
        case NL80211_CHAN_HT40MINUS:
        case NL80211_CHAN_HT40PLUS:
@@@ -283,7 -275,6 +277,7 @@@ static int wl_ops_config(struct ieee802
        int err = 0;
        int new_int;
  
 +      WL_LOCK(wl);
        if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) {
                WL_NONE("%s: Setting listen interval to %d\n",
                        __func__, conf->listen_interval);
        }
  
   config_out:
 +      WL_UNLOCK(wl);
        return err;
  }
  
@@@ -459,21 -449,13 +453,21 @@@ wl_ops_set_tim(struct ieee80211_hw *hw
  
  static void wl_ops_sw_scan_start(struct ieee80211_hw *hw)
  {
 +      struct wl_info *wl = hw->priv;
        WL_NONE("Scan Start\n");
 +      WL_LOCK(wl);
 +      wlc_scan_start(wl->wlc);
 +      WL_UNLOCK(wl);
        return;
  }
  
  static void wl_ops_sw_scan_complete(struct ieee80211_hw *hw)
  {
 +      struct wl_info *wl = hw->priv;
        WL_NONE("Scan Complete\n");
 +      WL_LOCK(wl);
 +      wlc_scan_stop(wl->wlc);
 +      WL_UNLOCK(wl);
        return;
  }
  
@@@ -791,7 -773,7 +785,7 @@@ static struct wl_info *wl_attach(u16 ve
        wl_found++;
        return wl;
  
 - fail:
 +fail:
        wl_free(wl);
  fail1:
        return NULL;
@@@ -1102,6 -1084,7 +1096,6 @@@ wl_pci_probe(struct pci_dev *pdev, cons
        return 0;
  }
  
 -#ifdef LINUXSTA_PS
  static int wl_suspend(struct pci_dev *pdev, pm_message_t state)
  {
        struct wl_info *wl;
                return -ENODEV;
        }
  
 +      /* only need to flag hw is down for proper resume */
        WL_LOCK(wl);
 -      wl_down(wl);
        wl->pub->hw_up = false;
        WL_UNLOCK(wl);
 -      pci_save_state(pdev, wl->pci_psstate);
 +
 +      pci_save_state(pdev);
        pci_disable_device(pdev);
        return pci_set_power_state(pdev, PCI_D3hot);
  }
@@@ -1145,7 -1127,7 +1139,7 @@@ static int wl_resume(struct pci_dev *pd
        if (err)
                return err;
  
 -      pci_restore_state(pdev, wl->pci_psstate);
 +      pci_restore_state(pdev);
  
        err = pci_enable_device(pdev);
        if (err)
        if ((val & 0x0000ff00) != 0)
                pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
  
 -      WL_LOCK(wl);
 -      err = wl_up(wl);
 -      WL_UNLOCK(wl);
 -
 +      /*
 +      *  done. driver will be put in up state
 +      *  in wl_ops_add_interface() call.
 +      */
        return err;
  }
 -#endif                                /* LINUXSTA_PS */
  
  static void wl_remove(struct pci_dev *pdev)
  {
  }
  
  static struct pci_driver wl_pci_driver = {
 - .name  = "brcm80211",
 - .probe = wl_pci_probe,
 -#ifdef LINUXSTA_PS
 - .suspend = wl_suspend,
 - .resume  = wl_resume,
 -#endif                                /* LINUXSTA_PS */
 - .remove   = __devexit_p(wl_remove),
 - .id_table = wl_id_table,
 +      .name = "brcm80211",
 +      .probe = wl_pci_probe,
 +      .suspend = wl_suspend,
 +      .resume = wl_resume,
 +      .remove = __devexit_p(wl_remove),
 +      .id_table = wl_id_table,
  };
  
  /**
@@@ -1325,22 -1310,6 +1319,6 @@@ void wl_free(struct wl_info *wl
        osl_detach(osh);
  }
  
- /* transmit a packet */
- static int BCMFASTPATH wl_start(struct sk_buff *skb, struct wl_info *wl)
- {
-       if (!wl)
-               return -ENETDOWN;
-       return wl_start_int(wl, WL_TO_HW(wl), skb);
- }
- static int BCMFASTPATH
- wl_start_int(struct wl_info *wl, struct ieee80211_hw *hw, struct sk_buff *skb)
- {
-       wlc_sendpkt_mac80211(wl->wlc, skb, hw);
-       return NETDEV_TX_OK;
- }
  void wl_txflowcontrol(struct wl_info *wl, struct wl_if *wlif, bool state,
                      int prio)
  {
index e37e8058e2b846ffa99576e3968adcc0445073d9,f305bf9486173fd27d40e552e29bea564cb64630..aa12d1a65184d97c81639e0dcec4b439101c0390
@@@ -5126,6 -5126,7 +5126,6 @@@ wlc_sendpkt_mac80211(struct wlc_info *w
        fifo = prio2fifo[prio];
  
        ASSERT((uint) skb_headroom(sdu) >= TXOFF);
 -      ASSERT(!(sdu->cloned));
        ASSERT(!(sdu->next));
        ASSERT(!(sdu->prev));
        ASSERT(fifo < NFIFO);
@@@ -6818,11 -6819,14 +6818,14 @@@ prep_mac80211_status(struct wlc_info *w
        ratespec_t rspec;
        unsigned char *plcp;
  
+ #if 0
+       /* Clearly, this is bogus -- reading the TSF now is wrong */
        wlc_read_tsf(wlc, &tsf_l, &tsf_h);      /* mactime */
        rx_status->mactime = tsf_h;
        rx_status->mactime <<= 32;
        rx_status->mactime |= tsf_l;
-       rx_status->flag |= RX_FLAG_TSFT;
+       rx_status->flag |= RX_FLAG_MACTIME_MPDU; /* clearly wrong */
+ #endif
  
        channel = WLC_CHAN_CHANNEL(rxh->RxChan);
  
@@@ -8461,16 -8465,3 +8464,16 @@@ static void wlc_txq_free(struct wlc_inf
  
        kfree(qi);
  }
 +
 +/*
 + * Flag 'scan in progress' to withold dynamic phy calibration
 + */
 +void wlc_scan_start(struct wlc_info *wlc)
 +{
 +      wlc_phy_hold_upd(wlc->band->pi, PHY_HOLD_FOR_SCAN, true);
 +}
 +
 +void wlc_scan_stop(struct wlc_info *wlc)
 +{
 +      wlc_phy_hold_upd(wlc->band->pi, PHY_HOLD_FOR_SCAN, false);
 +}
diff --combined net/mac80211/Kconfig
index dbf5e4006bc1475a17acff920f38bade34e7e5a2,841dd1e2909e0f1e9a937b630dc52a259ffb5d16..513f85cc2ae1b1ad707f8a878fcf2fd5e6e93a91
@@@ -20,7 -20,7 +20,7 @@@ config MAC80211_HAS_R
        bool
  
  config MAC80211_RC_PID
 -      bool "PID controller based rate control algorithm" if EMBEDDED
 +      bool "PID controller based rate control algorithm" if EXPERT
        select MAC80211_HAS_RC
        ---help---
          This option enables a TX rate control algorithm for
          rate.
  
  config MAC80211_RC_MINSTREL
 -      bool "Minstrel" if EMBEDDED
 +      bool "Minstrel" if EXPERT
        select MAC80211_HAS_RC
        default y
        ---help---
          This option enables the 'minstrel' TX rate control algorithm
  
  config MAC80211_RC_MINSTREL_HT
 -      bool "Minstrel 802.11n support" if EMBEDDED
 +      bool "Minstrel 802.11n support" if EXPERT
        depends on MAC80211_RC_MINSTREL
        default y
        ---help---
@@@ -78,7 -78,7 +78,7 @@@ config MAC80211_RC_DEFAUL
  endif
  
  comment "Some wireless drivers require a rate control algorithm"
-       depends on MAC80211_HAS_RC=n
+       depends on MAC80211 && MAC80211_HAS_RC=n
  
  config MAC80211_MESH
        bool "Enable mac80211 mesh networking (pre-802.11s) support"