]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/wireless/iwlwifi/iwl-6000.c
iwlagn: set CSR register for 6050g2 devices
[karo-tx-linux.git] / drivers / net / wireless / iwlwifi / iwl-6000.c
index 30dc1f3342022a242f8010dd2463487ffeb3006b..83a5262d8bd8aea148b5c53f6b7934aec0d37e18 100644 (file)
@@ -83,15 +83,24 @@ static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
        priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
 }
 
-/* Indicate calibration version to uCode. */
-static void iwl6000_set_calib_version(struct iwl_priv *priv)
+static void iwl6050_additional_nic_config(struct iwl_priv *priv)
 {
-       if (priv->cfg->need_dc_calib &&
-           (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6))
+       /* Indicate calibration version to uCode. */
+       if (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6)
                iwl_set_bit(priv, CSR_GP_DRIVER_REG,
                                CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
 }
 
+static void iwl6050g2_additional_nic_config(struct iwl_priv *priv)
+{
+       /* Indicate calibration version to uCode. */
+       if (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6)
+               iwl_set_bit(priv, CSR_GP_DRIVER_REG,
+                               CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
+       iwl_set_bit(priv, CSR_GP_DRIVER_REG,
+                   CSR_GP_DRIVER_REG_BIT_6050_1x2);
+}
+
 /* NIC configuration for 6000 series */
 static void iwl6000_nic_config(struct iwl_priv *priv)
 {
@@ -117,167 +126,10 @@ static void iwl6000_nic_config(struct iwl_priv *priv)
                iwl_write32(priv, CSR_GP_DRIVER_REG,
                             CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA);
        }
-       /* else do nothing, uCode configured */
-       if (priv->cfg->ops->lib->temp_ops.set_calib_version)
-               priv->cfg->ops->lib->temp_ops.set_calib_version(priv);
-}
-
-/*
- * Macros to access the lookup table.
- *
- * The lookup table has 7 inputs: bt3_prio, bt3_txrx, bt_rf_act, wifi_req,
- * wifi_prio, wifi_txrx and wifi_sh_ant_req.
- *
- * It has three outputs: WLAN_ACTIVE, WLAN_KILL and ANT_SWITCH
- *
- * The format is that "registers" 8 through 11 contain the WLAN_ACTIVE bits
- * one after another in 32-bit registers, and "registers" 0 through 7 contain
- * the WLAN_KILL and ANT_SWITCH bits interleaved (in that order).
- *
- * These macros encode that format.
- */
-#define LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, wifi_req, wifi_prio, \
-       wifi_txrx, wifi_sh_ant_req) \
-       (bt3_prio | (bt3_txrx << 1) | (bt_rf_act << 2) | (wifi_req << 3) | \
-       (wifi_prio << 4) | (wifi_txrx << 5) | (wifi_sh_ant_req << 6))
-
-#define LUT_PTA_WLAN_ACTIVE_OP(lut, op, val) \
-       lut[8 + ((val) >> 5)] op (cpu_to_le32(BIT((val) & 0x1f)))
-#define LUT_TEST_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, \
-       wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req) \
-       (!!(LUT_PTA_WLAN_ACTIVE_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx,\
-       bt_rf_act, wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))))
-#define LUT_SET_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, \
-       wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req) \
-       LUT_PTA_WLAN_ACTIVE_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, \
-       bt_rf_act, wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
-#define LUT_CLEAR_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, \
-       wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req) \
-       LUT_PTA_WLAN_ACTIVE_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, \
-       bt_rf_act, wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
-
-#define LUT_WLAN_KILL_OP(lut, op, val) \
-       lut[(val) >> 4] op (cpu_to_le32(BIT(((val) << 1) & 0x1e)))
-#define LUT_TEST_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
-       wifi_prio, wifi_txrx, wifi_sh_ant_req) \
-       (!!(LUT_WLAN_KILL_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
-       wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))))
-#define LUT_SET_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
-       wifi_prio, wifi_txrx, wifi_sh_ant_req) \
-       LUT_WLAN_KILL_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
-       wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
-#define LUT_CLEAR_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
-       wifi_prio, wifi_txrx, wifi_sh_ant_req) \
-       LUT_WLAN_KILL_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
-       wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
-
-#define LUT_ANT_SWITCH_OP(lut, op, val) \
-       lut[(val) >> 4] op (cpu_to_le32(BIT((((val) << 1) & 0x1e) + 1)))
-#define LUT_TEST_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
-       wifi_prio, wifi_txrx, wifi_sh_ant_req) \
-       (!!(LUT_ANT_SWITCH_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
-       wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))))
-#define LUT_SET_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
-       wifi_prio, wifi_txrx, wifi_sh_ant_req) \
-       LUT_ANT_SWITCH_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
-       wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
-#define LUT_CLEAR_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
-       wifi_prio, wifi_txrx, wifi_sh_ant_req) \
-       LUT_ANT_SWITCH_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
-       wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
-
-static const __le32 iwl6000g2b_def_3w_lookup[12] = {
-       cpu_to_le32(0xaaaaaaaa),
-       cpu_to_le32(0xaaaaaaaa),
-       cpu_to_le32(0xaeaaaaaa),
-       cpu_to_le32(0xaaaaaaaa),
-       cpu_to_le32(0xcc00ff28),
-       cpu_to_le32(0x0000aaaa),
-       cpu_to_le32(0xcc00aaaa),
-       cpu_to_le32(0x0000aaaa),
-       cpu_to_le32(0xc0004000),
-       cpu_to_le32(0x00004000),
-       cpu_to_le32(0xf0005000),
-       cpu_to_le32(0xf0004000),
-};
-
-static const __le32 iwl6000g2b_concurrent_lookup[12] = {
-       cpu_to_le32(0xaaaaaaaa),
-       cpu_to_le32(0xaaaaaaaa),
-       cpu_to_le32(0xaaaaaaaa),
-       cpu_to_le32(0xaaaaaaaa),
-       cpu_to_le32(0xaaaaaaaa),
-       cpu_to_le32(0xaaaaaaaa),
-       cpu_to_le32(0xaaaaaaaa),
-       cpu_to_le32(0xaaaaaaaa),
-       cpu_to_le32(0x00000000),
-       cpu_to_le32(0x00000000),
-       cpu_to_le32(0x00000000),
-       cpu_to_le32(0x00000000),
-};
-
-static void iwl6000g2b_send_bt_config(struct iwl_priv *priv)
-{
-       struct iwl6000g2b_bt_cmd bt_cmd = {
-               .max_kill = IWL6000G2B_BT_MAX_KILL_DEFAULT,
-               .bt3_timer_t7_value = IWL6000G2B_BT3_T7_DEFAULT,
-               .bt3_prio_sample_time = IWL6000G2B_BT3_PRIO_SAMPLE_DEFAULT,
-               .bt3_timer_t2_value = IWL6000G2B_BT3_T2_DEFAULT,
-       };
-
-       BUILD_BUG_ON(sizeof(iwl6000g2b_def_3w_lookup) !=
-                       sizeof(bt_cmd.bt3_lookup_table));
-
-       bt_cmd.prio_boost = priv->cfg->bt_prio_boost;
-       bt_cmd.kill_ack_mask = priv->kill_ack_mask;
-       bt_cmd.kill_cts_mask = priv->kill_cts_mask;
-       bt_cmd.valid = priv->bt_valid;
-
-       /*
-        * Configure BT coex mode to "no coexistence" when the
-        * user disabled BT coexistence, we have no interface
-        * user disabled BT coexistence, or the interface is in
-        * IBSS mode (no proper uCode support for coex then).
-        */
-       if (!bt_coex_active || priv->iw_mode == NL80211_IFTYPE_ADHOC) {
-               bt_cmd.flags = 0;
-       } else {
-               bt_cmd.flags = IWL6000G2B_BT_FLAG_COEX_MODE_3W <<
-                                       IWL6000G2B_BT_FLAG_COEX_MODE_SHIFT;
-               if (priv->bt_ch_announce)
-                       bt_cmd.flags |= IWL6000G2B_BT_FLAG_CHANNEL_INHIBITION;
-               IWL_DEBUG_INFO(priv, "BT coex flag: 0X%x\n", bt_cmd.flags);
-       }
-
-       if (priv->bt_full_concurrent)
-               memcpy(bt_cmd.bt3_lookup_table, iwl6000g2b_concurrent_lookup,
-                       sizeof(iwl6000g2b_concurrent_lookup));
-       else
-               memcpy(bt_cmd.bt3_lookup_table, iwl6000g2b_def_3w_lookup,
-                       sizeof(iwl6000g2b_def_3w_lookup));
-
-       IWL_DEBUG_INFO(priv, "BT coex %s in %s mode\n",
-                      bt_cmd.flags ? "active" : "disabled",
-                      priv->bt_full_concurrent ?
-                      "full concurrency" : "3-wire");
-
-       if (iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, sizeof(bt_cmd), &bt_cmd))
-               IWL_ERR(priv, "failed to send BT Coex Config\n");
-
-       /*
-        * When we are doing a restart, need to also reconfigure BT
-        * SCO to the device. If not doing a restart, bt_sco_active
-        * will always be false, so there's no need to have an extra
-        * variable to check for it.
-        */
-       if (priv->bt_sco_active) {
-               struct iwl6000g2b_bt_sco_cmd sco_cmd = { .flags = 0 };
-
-               if (priv->bt_sco_active)
-                       sco_cmd.flags |= IWL6000G2B_BT_SCO_ACTIVE;
-               if (iwl_send_cmd_pdu(priv, REPLY_BT_COEX_SCO,
-                                    sizeof(sco_cmd), &sco_cmd))
-                       IWL_ERR(priv, "failed to send BT SCO command\n");
+       /* do additional nic configuration if needed */
+       if (priv->cfg->ops->nic &&
+               priv->cfg->ops->nic->additional_nic_config) {
+                       priv->cfg->ops->nic->additional_nic_config(priv);
        }
 }
 
@@ -320,7 +172,7 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
                        sizeof(struct iwlagn_scd_bc_tbl);
        priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
        priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
-       priv->hw_params.bcast_sta_id = IWLAGN_BROADCAST_ID;
+       priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
 
        priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
        priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
@@ -357,14 +209,19 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
 static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
                                     struct ieee80211_channel_switch *ch_switch)
 {
+       /*
+        * MULTI-FIXME
+        * See iwl_mac_channel_switch.
+        */
+       struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
        struct iwl6000_channel_switch_cmd cmd;
        const struct iwl_channel_info *ch_info;
        u32 switch_time_in_usec, ucode_switch_time;
        u16 ch;
        u32 tsf_low;
        u8 switch_count;
-       u16 beacon_interval = le16_to_cpu(priv->rxon_timing.beacon_interval);
-       struct ieee80211_vif *vif = priv->vif;
+       u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
+       struct ieee80211_vif *vif = ctx->vif;
        struct iwl_host_cmd hcmd = {
                .id = REPLY_CHANNEL_SWITCH,
                .len = sizeof(cmd),
@@ -375,10 +232,10 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
        cmd.band = priv->band == IEEE80211_BAND_2GHZ;
        ch = ch_switch->channel->hw_value;
        IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
-                     priv->active_rxon.channel, ch);
+                     ctx->active.channel, ch);
        cmd.channel = cpu_to_le16(ch);
-       cmd.rxon_flags = priv->staging_rxon.flags;
-       cmd.rxon_filter_flags = priv->staging_rxon.filter_flags;
+       cmd.rxon_flags = ctx->staging.flags;
+       cmd.rxon_filter_flags = ctx->staging.filter_flags;
        switch_count = ch_switch->count;
        tsf_low = ch_switch->timestamp & 0x0ffffffff;
        /*
@@ -413,7 +270,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
                cmd.expect_beacon = is_channel_radar(ch_info);
        else {
                IWL_ERR(priv, "invalid channel switch from %u to %u\n",
-                       priv->active_rxon.channel, ch);
+                       ctx->active.channel, ch);
                return -EFAULT;
        }
        priv->switch_rxon.channel = cmd.channel;
@@ -422,210 +279,6 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
        return iwl_send_cmd_sync(priv, &hcmd);
 }
 
-static void iwl6000g2b_bt_traffic_change_work(struct work_struct *work)
-{
-       struct iwl_priv *priv =
-               container_of(work, struct iwl_priv, bt_traffic_change_work);
-       int smps_request = -1;
-
-       IWL_DEBUG_INFO(priv, "BT traffic load changes: %d\n",
-                      priv->bt_traffic_load);
-
-       switch (priv->bt_traffic_load) {
-       case IWL_BT_COEX_TRAFFIC_LOAD_NONE:
-               smps_request = IEEE80211_SMPS_AUTOMATIC;
-               break;
-       case IWL_BT_COEX_TRAFFIC_LOAD_LOW:
-               smps_request = IEEE80211_SMPS_DYNAMIC;
-               break;
-       case IWL_BT_COEX_TRAFFIC_LOAD_HIGH:
-       case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
-               smps_request = IEEE80211_SMPS_STATIC;
-               break;
-       default:
-               IWL_ERR(priv, "Invalid BT traffic load: %d\n",
-                       priv->bt_traffic_load);
-               break;
-       }
-
-       mutex_lock(&priv->mutex);
-
-       if (priv->cfg->ops->lib->update_chain_flags)
-               priv->cfg->ops->lib->update_chain_flags(priv);
-
-       if (smps_request != -1 &&
-           priv->vif && priv->vif->type == NL80211_IFTYPE_STATION)
-               ieee80211_request_smps(priv->vif, smps_request);
-
-       mutex_unlock(&priv->mutex);
-}
-
-static void iwlagn_print_uartmsg(struct iwl_priv *priv,
-                               struct iwl_bt_uart_msg *uart_msg)
-{
-       IWL_DEBUG_NOTIF(priv, "Message Type = 0x%X, SSN = 0x%X, "
-                       "Update Req = 0x%X",
-               (BT_UART_MSG_FRAME1MSGTYPE_MSK & uart_msg->frame1) >>
-                       BT_UART_MSG_FRAME1MSGTYPE_POS,
-               (BT_UART_MSG_FRAME1SSN_MSK & uart_msg->frame1) >>
-                       BT_UART_MSG_FRAME1SSN_POS,
-               (BT_UART_MSG_FRAME1UPDATEREQ_MSK & uart_msg->frame1) >>
-                       BT_UART_MSG_FRAME1UPDATEREQ_POS);
-
-       IWL_DEBUG_NOTIF(priv, "Open connections = 0x%X, Traffic load = 0x%X, "
-                       "Chl_SeqN = 0x%X, In band = 0x%X",
-               (BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK & uart_msg->frame2) >>
-                       BT_UART_MSG_FRAME2OPENCONNECTIONS_POS,
-               (BT_UART_MSG_FRAME2TRAFFICLOAD_MSK & uart_msg->frame2) >>
-                       BT_UART_MSG_FRAME2TRAFFICLOAD_POS,
-               (BT_UART_MSG_FRAME2CHLSEQN_MSK & uart_msg->frame2) >>
-                       BT_UART_MSG_FRAME2CHLSEQN_POS,
-               (BT_UART_MSG_FRAME2INBAND_MSK & uart_msg->frame2) >>
-                       BT_UART_MSG_FRAME2INBAND_POS);
-
-       IWL_DEBUG_NOTIF(priv, "SCO/eSCO = 0x%X, Sniff = 0x%X, A2DP = 0x%X, "
-                       "ACL = 0x%X, Master = 0x%X, OBEX = 0x%X",
-               (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) >>
-                       BT_UART_MSG_FRAME3SCOESCO_POS,
-               (BT_UART_MSG_FRAME3SNIFF_MSK & uart_msg->frame3) >>
-                       BT_UART_MSG_FRAME3SNIFF_POS,
-               (BT_UART_MSG_FRAME3A2DP_MSK & uart_msg->frame3) >>
-                       BT_UART_MSG_FRAME3A2DP_POS,
-               (BT_UART_MSG_FRAME3ACL_MSK & uart_msg->frame3) >>
-                       BT_UART_MSG_FRAME3ACL_POS,
-               (BT_UART_MSG_FRAME3MASTER_MSK & uart_msg->frame3) >>
-                       BT_UART_MSG_FRAME3MASTER_POS,
-               (BT_UART_MSG_FRAME3OBEX_MSK & uart_msg->frame3) >>
-                       BT_UART_MSG_FRAME3OBEX_POS);
-
-       IWL_DEBUG_NOTIF(priv, "Idle duration = 0x%X",
-               (BT_UART_MSG_FRAME4IDLEDURATION_MSK & uart_msg->frame4) >>
-                       BT_UART_MSG_FRAME4IDLEDURATION_POS);
-
-       IWL_DEBUG_NOTIF(priv, "Tx Activity = 0x%X, Rx Activity = 0x%X, "
-                       "eSCO Retransmissions = 0x%X",
-               (BT_UART_MSG_FRAME5TXACTIVITY_MSK & uart_msg->frame5) >>
-                       BT_UART_MSG_FRAME5TXACTIVITY_POS,
-               (BT_UART_MSG_FRAME5RXACTIVITY_MSK & uart_msg->frame5) >>
-                       BT_UART_MSG_FRAME5RXACTIVITY_POS,
-               (BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK & uart_msg->frame5) >>
-                       BT_UART_MSG_FRAME5ESCORETRANSMIT_POS);
-
-       IWL_DEBUG_NOTIF(priv, "Sniff Interval = 0x%X, Discoverable = 0x%X",
-               (BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK & uart_msg->frame6) >>
-                       BT_UART_MSG_FRAME6SNIFFINTERVAL_POS,
-               (BT_UART_MSG_FRAME6DISCOVERABLE_MSK & uart_msg->frame6) >>
-                       BT_UART_MSG_FRAME6DISCOVERABLE_POS);
-
-       IWL_DEBUG_NOTIF(priv, "Sniff Activity = 0x%X, Inquiry/Page SR Mode = "
-                       "0x%X, Connectable = 0x%X",
-               (BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK & uart_msg->frame7) >>
-                       BT_UART_MSG_FRAME7SNIFFACTIVITY_POS,
-               (BT_UART_MSG_FRAME7INQUIRYPAGESRMODE_MSK & uart_msg->frame7) >>
-                       BT_UART_MSG_FRAME7INQUIRYPAGESRMODE_POS,
-               (BT_UART_MSG_FRAME7CONNECTABLE_MSK & uart_msg->frame7) >>
-                       BT_UART_MSG_FRAME7CONNECTABLE_POS);
-}
-
-static void iwl6000g2b_set_kill_ack_msk(struct iwl_priv *priv,
-                                    struct iwl_bt_uart_msg *uart_msg)
-{
-       u8 kill_ack_msk;
-       __le32 bt_kill_ack_msg[2] = {
-               cpu_to_le32(0xFFFFFFF), cpu_to_le32(0xFFFFFC00) };
-
-       kill_ack_msk = (((BT_UART_MSG_FRAME3A2DP_MSK |
-                       BT_UART_MSG_FRAME3SNIFF_MSK |
-                       BT_UART_MSG_FRAME3SCOESCO_MSK) &
-                       uart_msg->frame3) == 0) ? 1 : 0;
-       if (priv->kill_ack_mask != bt_kill_ack_msg[kill_ack_msk]) {
-               priv->bt_valid |= IWL6000G2B_BT_VALID_KILL_ACK_MASK;
-               priv->kill_ack_mask = bt_kill_ack_msg[kill_ack_msk];
-               /* schedule to send runtime bt_config */
-               queue_work(priv->workqueue, &priv->bt_runtime_config);
-       }
-
-}
-
-static void iwl6000g2b_bt_coex_profile_notif(struct iwl_priv *priv,
-                                            struct iwl_rx_mem_buffer *rxb)
-{
-       unsigned long flags;
-       struct iwl_rx_packet *pkt = rxb_addr(rxb);
-       struct iwl_bt_coex_profile_notif *coex = &pkt->u.bt_coex_profile_notif;
-       struct iwl6000g2b_bt_sco_cmd sco_cmd = { .flags = 0 };
-       struct iwl_bt_uart_msg *uart_msg = &coex->last_bt_uart_msg;
-       u8 last_traffic_load;
-
-       IWL_DEBUG_NOTIF(priv, "BT Coex notification:\n");
-       IWL_DEBUG_NOTIF(priv, "    status: %d\n", coex->bt_status);
-       IWL_DEBUG_NOTIF(priv, "    traffic load: %d\n", coex->bt_traffic_load);
-       IWL_DEBUG_NOTIF(priv, "    CI compliance: %d\n", coex->bt_ci_compliance);
-       iwlagn_print_uartmsg(priv, uart_msg);
-
-       last_traffic_load = priv->notif_bt_traffic_load;
-       priv->notif_bt_traffic_load = coex->bt_traffic_load;
-       if (priv->iw_mode != NL80211_IFTYPE_ADHOC) {
-               if (priv->bt_status != coex->bt_status ||
-                   last_traffic_load != coex->bt_traffic_load) {
-                       if (coex->bt_status) {
-                               /* BT on */
-                               if (!priv->bt_ch_announce)
-                                       priv->bt_traffic_load =
-                                               IWL_BT_COEX_TRAFFIC_LOAD_HIGH;
-                               else
-                                       priv->bt_traffic_load =
-                                               coex->bt_traffic_load;
-                       } else {
-                               /* BT off */
-                               priv->bt_traffic_load =
-                                       IWL_BT_COEX_TRAFFIC_LOAD_NONE;
-                       }
-                       priv->bt_status = coex->bt_status;
-                       queue_work(priv->workqueue,
-                                  &priv->bt_traffic_change_work);
-               }
-               if (priv->bt_sco_active !=
-                   (uart_msg->frame3 & BT_UART_MSG_FRAME3SCOESCO_MSK)) {
-                       priv->bt_sco_active = uart_msg->frame3 &
-                               BT_UART_MSG_FRAME3SCOESCO_MSK;
-                       if (priv->bt_sco_active)
-                               sco_cmd.flags |= IWL6000G2B_BT_SCO_ACTIVE;
-                       iwl_send_cmd_pdu_async(priv, REPLY_BT_COEX_SCO,
-                                      sizeof(sco_cmd), &sco_cmd, NULL);
-               }
-       }
-
-       iwl6000g2b_set_kill_ack_msk(priv, uart_msg);
-
-       /* FIXME: based on notification, adjust the prio_boost */
-
-       spin_lock_irqsave(&priv->lock, flags);
-       priv->bt_ci_compliance = coex->bt_ci_compliance;
-       spin_unlock_irqrestore(&priv->lock, flags);
-}
-
-void iwl6000g2b_rx_handler_setup(struct iwl_priv *priv)
-{
-       iwlagn_rx_handler_setup(priv);
-       priv->rx_handlers[REPLY_BT_COEX_PROFILE_NOTIF] =
-               iwl6000g2b_bt_coex_profile_notif;
-}
-
-static void iwl6000g2b_bt_setup_deferred_work(struct iwl_priv *priv)
-{
-       iwlagn_setup_deferred_work(priv);
-
-       INIT_WORK(&priv->bt_traffic_change_work,
-                 iwl6000g2b_bt_traffic_change_work);
-
-}
-
-static void iwl6000g2b_bt_cancel_deferred_work(struct iwl_priv *priv)
-{
-       cancel_work_sync(&priv->bt_traffic_change_work);
-}
-
 static struct iwl_lib_ops iwl6000_lib = {
        .set_hw_params = iwl6000_hw_set_hw_params,
        .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
@@ -678,15 +331,15 @@ static struct iwl_lib_ops iwl6000_lib = {
        .temp_ops = {
                .temperature = iwlagn_temperature,
                .set_ct_kill = iwl6000_set_ct_threshold,
-               .set_calib_version = iwl6000_set_calib_version,
         },
        .manage_ibss_station = iwlagn_manage_ibss_station,
-       .update_bcast_station = iwl_update_bcast_station,
+       .update_bcast_stations = iwl_update_bcast_stations,
        .debugfs_ops = {
                .rx_stats_read = iwl_ucode_rx_stats_read,
                .tx_stats_read = iwl_ucode_tx_stats_read,
                .general_stats_read = iwl_ucode_general_stats_read,
                .bt_stats_read = iwl_ucode_bt_stats_read,
+               .reply_tx_error = iwl_reply_tx_error_read,
        },
        .recover_from_tx_stall = iwl_bg_monitor_recover,
        .check_plcp_health = iwl_good_plcp_health,
@@ -710,9 +363,9 @@ static struct iwl_lib_ops iwl6000g2b_lib = {
        .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
        .txq_free_tfd = iwl_hw_txq_free_tfd,
        .txq_init = iwl_hw_tx_queue_init,
-       .rx_handler_setup = iwl6000g2b_rx_handler_setup,
-       .setup_deferred_work = iwl6000g2b_bt_setup_deferred_work,
-       .cancel_deferred_work = iwl6000g2b_bt_cancel_deferred_work,
+       .rx_handler_setup = iwlagn_bt_rx_handler_setup,
+       .setup_deferred_work = iwlagn_bt_setup_deferred_work,
+       .cancel_deferred_work = iwlagn_bt_cancel_deferred_work,
        .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
        .load_ucode = iwlagn_load_ucode,
        .dump_nic_event_log = iwl_dump_nic_event_log,
@@ -753,15 +406,15 @@ static struct iwl_lib_ops iwl6000g2b_lib = {
        .temp_ops = {
                .temperature = iwlagn_temperature,
                .set_ct_kill = iwl6000_set_ct_threshold,
-               .set_calib_version = iwl6000_set_calib_version,
         },
        .manage_ibss_station = iwlagn_manage_ibss_station,
-       .update_bcast_station = iwl_update_bcast_station,
+       .update_bcast_stations = iwl_update_bcast_stations,
        .debugfs_ops = {
                .rx_stats_read = iwl_ucode_rx_stats_read,
                .tx_stats_read = iwl_ucode_tx_stats_read,
                .general_stats_read = iwl_ucode_general_stats_read,
                .bt_stats_read = iwl_ucode_bt_stats_read,
+               .reply_tx_error = iwl_reply_tx_error_read,
        },
        .recover_from_tx_stall = iwl_bg_monitor_recover,
        .check_plcp_health = iwl_good_plcp_health,
@@ -775,6 +428,14 @@ static struct iwl_lib_ops iwl6000g2b_lib = {
        }
 };
 
+static struct iwl_nic_ops iwl6050_nic_ops = {
+       .additional_nic_config = &iwl6050_additional_nic_config,
+};
+
+static struct iwl_nic_ops iwl6050g2_nic_ops = {
+       .additional_nic_config = &iwl6050g2_additional_nic_config,
+};
+
 static const struct iwl_ops iwl6000_ops = {
        .lib = &iwl6000_lib,
        .hcmd = &iwlagn_hcmd,
@@ -782,17 +443,25 @@ static const struct iwl_ops iwl6000_ops = {
        .led = &iwlagn_led_ops,
 };
 
-static struct iwl_hcmd_ops iwl6000g2b_hcmd = {
-       .rxon_assoc = iwlagn_send_rxon_assoc,
-       .commit_rxon = iwl_commit_rxon,
-       .set_rxon_chain = iwl_set_rxon_chain,
-       .set_tx_ant = iwlagn_send_tx_ant_config,
-       .send_bt_config = iwl6000g2b_send_bt_config,
+static const struct iwl_ops iwl6050_ops = {
+       .lib = &iwl6000_lib,
+       .hcmd = &iwlagn_hcmd,
+       .utils = &iwlagn_hcmd_utils,
+       .led = &iwlagn_led_ops,
+       .nic = &iwl6050_nic_ops,
+};
+
+static const struct iwl_ops iwl6050g2_ops = {
+       .lib = &iwl6000_lib,
+       .hcmd = &iwlagn_hcmd,
+       .utils = &iwlagn_hcmd_utils,
+       .led = &iwlagn_led_ops,
+       .nic = &iwl6050g2_nic_ops,
 };
 
 static const struct iwl_ops iwl6000g2b_ops = {
        .lib = &iwl6000g2b_lib,
-       .hcmd = &iwl6000g2b_hcmd,
+       .hcmd = &iwlagn_bt_hcmd,
        .utils = &iwlagn_hcmd_utils,
        .led = &iwlagn_led_ops,
 };
@@ -945,7 +614,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = {
        .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
        .advanced_bt_coexist = true,
        .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
-       .bt_prio_boost = IWL6000G2B_BT_PRIO_BOOST_DEFAULT,
+       .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
 };
 
 struct iwl_cfg iwl6000g2b_2abg_cfg = {
@@ -986,7 +655,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = {
        .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
        .advanced_bt_coexist = true,
        .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
-       .bt_prio_boost = IWL6000G2B_BT_PRIO_BOOST_DEFAULT,
+       .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
 };
 
 struct iwl_cfg iwl6000g2b_2bgn_cfg = {
@@ -1029,7 +698,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = {
        .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
        .advanced_bt_coexist = true,
        .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
-       .bt_prio_boost = IWL6000G2B_BT_PRIO_BOOST_DEFAULT,
+       .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
 };
 
 struct iwl_cfg iwl6000g2b_2bg_cfg = {
@@ -1070,7 +739,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = {
        .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
        .advanced_bt_coexist = true,
        .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
-       .bt_prio_boost = IWL6000G2B_BT_PRIO_BOOST_DEFAULT,
+       .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
 };
 
 struct iwl_cfg iwl6000g2b_bgn_cfg = {
@@ -1113,7 +782,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = {
        .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
        .advanced_bt_coexist = true,
        .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
-       .bt_prio_boost = IWL6000G2B_BT_PRIO_BOOST_DEFAULT,
+       .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
 };
 
 struct iwl_cfg iwl6000g2b_bg_cfg = {
@@ -1154,7 +823,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = {
        .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
        .advanced_bt_coexist = true,
        .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
-       .bt_prio_boost = IWL6000G2B_BT_PRIO_BOOST_DEFAULT,
+       .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
 };
 
 /*
@@ -1273,7 +942,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
        .ucode_api_max = IWL6050_UCODE_API_MAX,
        .ucode_api_min = IWL6050_UCODE_API_MIN,
        .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
-       .ops = &iwl6000_ops,
+       .ops = &iwl6050_ops,
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
@@ -1311,7 +980,7 @@ struct iwl_cfg iwl6050g2_bgn_cfg = {
        .ucode_api_max = IWL6050_UCODE_API_MAX,
        .ucode_api_min = IWL6050_UCODE_API_MIN,
        .sku = IWL_SKU_G|IWL_SKU_N,
-       .ops = &iwl6000_ops,
+       .ops = &iwl6050g2_ops,
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .eeprom_ver = EEPROM_6050G2_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_6050G2_TX_POWER_VERSION,
@@ -1349,7 +1018,7 @@ struct iwl_cfg iwl6050_2abg_cfg = {
        .ucode_api_max = IWL6050_UCODE_API_MAX,
        .ucode_api_min = IWL6050_UCODE_API_MIN,
        .sku = IWL_SKU_A|IWL_SKU_G,
-       .ops = &iwl6000_ops,
+       .ops = &iwl6050_ops,
        .eeprom_size = OTP_LOW_IMAGE_SIZE,
        .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,