]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/net/wireless/iwlwifi/iwl-6000.c
iwlwifi: Relax uCode timeout/error checking for 6000g2b
[karo-tx-linux.git] / drivers / net / wireless / iwlwifi / iwl-6000.c
1 /******************************************************************************
2  *
3  * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  * The full GNU General Public License is included in this distribution in the
19  * file called LICENSE.
20  *
21  * Contact Information:
22  *  Intel Linux Wireless <ilw@linux.intel.com>
23  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24  *
25  *****************************************************************************/
26
27 #include <linux/kernel.h>
28 #include <linux/module.h>
29 #include <linux/init.h>
30 #include <linux/pci.h>
31 #include <linux/dma-mapping.h>
32 #include <linux/delay.h>
33 #include <linux/skbuff.h>
34 #include <linux/netdevice.h>
35 #include <linux/wireless.h>
36 #include <net/mac80211.h>
37 #include <linux/etherdevice.h>
38 #include <asm/unaligned.h>
39
40 #include "iwl-eeprom.h"
41 #include "iwl-dev.h"
42 #include "iwl-core.h"
43 #include "iwl-io.h"
44 #include "iwl-sta.h"
45 #include "iwl-agn.h"
46 #include "iwl-helpers.h"
47 #include "iwl-agn-hw.h"
48 #include "iwl-6000-hw.h"
49 #include "iwl-agn-led.h"
50 #include "iwl-agn-debugfs.h"
51
52 /* Highest firmware API version supported */
53 #define IWL6000_UCODE_API_MAX 4
54 #define IWL6050_UCODE_API_MAX 4
55 #define IWL6000G2_UCODE_API_MAX 5
56
57 /* Lowest firmware API version supported */
58 #define IWL6000_UCODE_API_MIN 4
59 #define IWL6050_UCODE_API_MIN 4
60 #define IWL6000G2_UCODE_API_MIN 4
61
62 #define IWL6000_FW_PRE "iwlwifi-6000-"
63 #define _IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE #api ".ucode"
64 #define IWL6000_MODULE_FIRMWARE(api) _IWL6000_MODULE_FIRMWARE(api)
65
66 #define IWL6050_FW_PRE "iwlwifi-6050-"
67 #define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode"
68 #define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api)
69
70 #define IWL6000G2A_FW_PRE "iwlwifi-6000g2a-"
71 #define _IWL6000G2A_MODULE_FIRMWARE(api) IWL6000G2A_FW_PRE #api ".ucode"
72 #define IWL6000G2A_MODULE_FIRMWARE(api) _IWL6000G2A_MODULE_FIRMWARE(api)
73
74 #define IWL6000G2B_FW_PRE "iwlwifi-6000g2b-"
75 #define _IWL6000G2B_MODULE_FIRMWARE(api) IWL6000G2B_FW_PRE #api ".ucode"
76 #define IWL6000G2B_MODULE_FIRMWARE(api) _IWL6000G2B_MODULE_FIRMWARE(api)
77
78
79 static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
80 {
81         /* want Celsius */
82         priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
83         priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
84 }
85
86 /* Indicate calibration version to uCode. */
87 static void iwl6000_set_calib_version(struct iwl_priv *priv)
88 {
89         if (priv->cfg->need_dc_calib &&
90             (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6))
91                 iwl_set_bit(priv, CSR_GP_DRIVER_REG,
92                                 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
93 }
94
95 /* NIC configuration for 6000 series */
96 static void iwl6000_nic_config(struct iwl_priv *priv)
97 {
98         u16 radio_cfg;
99
100         radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
101
102         /* write radio config values to register */
103         if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX)
104                 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
105                             EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
106                             EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
107                             EEPROM_RF_CFG_DASH_MSK(radio_cfg));
108
109         /* set CSR_HW_CONFIG_REG for uCode use */
110         iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
111                     CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
112                     CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
113
114         /* no locking required for register write */
115         if (priv->cfg->pa_type == IWL_PA_INTERNAL) {
116                 /* 2x2 IPA phy type */
117                 iwl_write32(priv, CSR_GP_DRIVER_REG,
118                              CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA);
119         }
120         /* else do nothing, uCode configured */
121         if (priv->cfg->ops->lib->temp_ops.set_calib_version)
122                 priv->cfg->ops->lib->temp_ops.set_calib_version(priv);
123 }
124
125 /*
126  * Macros to access the lookup table.
127  *
128  * The lookup table has 7 inputs: bt3_prio, bt3_txrx, bt_rf_act, wifi_req,
129  * wifi_prio, wifi_txrx and wifi_sh_ant_req.
130  *
131  * It has three outputs: WLAN_ACTIVE, WLAN_KILL and ANT_SWITCH
132  *
133  * The format is that "registers" 8 through 11 contain the WLAN_ACTIVE bits
134  * one after another in 32-bit registers, and "registers" 0 through 7 contain
135  * the WLAN_KILL and ANT_SWITCH bits interleaved (in that order).
136  *
137  * These macros encode that format.
138  */
139 #define LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, wifi_req, wifi_prio, \
140         wifi_txrx, wifi_sh_ant_req) \
141         (bt3_prio | (bt3_txrx << 1) | (bt_rf_act << 2) | (wifi_req << 3) | \
142         (wifi_prio << 4) | (wifi_txrx << 5) | (wifi_sh_ant_req << 6))
143
144 #define LUT_PTA_WLAN_ACTIVE_OP(lut, op, val) \
145         lut[8 + ((val) >> 5)] op (cpu_to_le32(BIT((val) & 0x1f)))
146 #define LUT_TEST_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, \
147         wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req) \
148         (!!(LUT_PTA_WLAN_ACTIVE_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx,\
149         bt_rf_act, wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))))
150 #define LUT_SET_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, \
151         wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req) \
152         LUT_PTA_WLAN_ACTIVE_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, \
153         bt_rf_act, wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
154 #define LUT_CLEAR_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, \
155         wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req) \
156         LUT_PTA_WLAN_ACTIVE_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, \
157         bt_rf_act, wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
158
159 #define LUT_WLAN_KILL_OP(lut, op, val) \
160         lut[(val) >> 4] op (cpu_to_le32(BIT(((val) << 1) & 0x1e)))
161 #define LUT_TEST_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
162         wifi_prio, wifi_txrx, wifi_sh_ant_req) \
163         (!!(LUT_WLAN_KILL_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
164         wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))))
165 #define LUT_SET_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
166         wifi_prio, wifi_txrx, wifi_sh_ant_req) \
167         LUT_WLAN_KILL_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
168         wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
169 #define LUT_CLEAR_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
170         wifi_prio, wifi_txrx, wifi_sh_ant_req) \
171         LUT_WLAN_KILL_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
172         wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
173
174 #define LUT_ANT_SWITCH_OP(lut, op, val) \
175         lut[(val) >> 4] op (cpu_to_le32(BIT((((val) << 1) & 0x1e) + 1)))
176 #define LUT_TEST_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
177         wifi_prio, wifi_txrx, wifi_sh_ant_req) \
178         (!!(LUT_ANT_SWITCH_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
179         wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))))
180 #define LUT_SET_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
181         wifi_prio, wifi_txrx, wifi_sh_ant_req) \
182         LUT_ANT_SWITCH_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
183         wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
184 #define LUT_CLEAR_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
185         wifi_prio, wifi_txrx, wifi_sh_ant_req) \
186         LUT_ANT_SWITCH_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
187         wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
188
189 static const __le32 iwl6000g2b_def_3w_lookup[12] = {
190         cpu_to_le32(0xaaaaaaaa),
191         cpu_to_le32(0xaaaaaaaa),
192         cpu_to_le32(0xaeaaaaaa),
193         cpu_to_le32(0xaaaaaaaa),
194         cpu_to_le32(0xcc00ff28),
195         cpu_to_le32(0x0000aaaa),
196         cpu_to_le32(0xcc00aaaa),
197         cpu_to_le32(0x0000aaaa),
198         cpu_to_le32(0xc0004000),
199         cpu_to_le32(0x00004000),
200         cpu_to_le32(0xf0005000),
201         cpu_to_le32(0xf0004000),
202 };
203
204 static void iwl6000g2b_send_bt_config(struct iwl_priv *priv)
205 {
206         struct iwl6000g2b_bt_cmd bt_cmd = {
207                 .prio_boost = IWL6000G2B_BT_PRIO_BOOST_DEFAULT,
208                 .max_kill = IWL6000G2B_BT_MAX_KILL_DEFAULT,
209                 .bt3_timer_t7_value = IWL6000G2B_BT3_T7_DEFAULT,
210                 .kill_ack_mask = IWL6000G2B_BT_KILL_ACK_MASK_DEFAULT,
211                 .kill_cts_mask = IWL6000G2B_BT_KILL_CTS_MASK_DEFAULT,
212                 .bt3_prio_sample_time = IWL6000G2B_BT3_PRIO_SAMPLE_DEFAULT,
213                 .bt3_timer_t2_value = IWL6000G2B_BT3_T2_DEFAULT,
214                 .valid = IWL6000G2B_BT_VALID_ENABLE_FLAGS,
215         };
216
217         BUILD_BUG_ON(sizeof(iwl6000g2b_def_3w_lookup) !=
218                         sizeof(bt_cmd.bt3_lookup_table));
219
220         /*
221          * Configure BT coex mode to "no coexistence" when the
222          * user disabled BT coexistence, we have no interface
223          * (might be in monitor mode), or the interface is in
224          * IBSS mode (no proper uCode support for coex then).
225          */
226         if (!bt_coex_active || !priv->vif ||
227             priv->iw_mode == NL80211_IFTYPE_ADHOC) {
228                 bt_cmd.flags = 0;
229         } else {
230                 bt_cmd.flags = IWL6000G2B_BT_FLAG_CHANNEL_INHIBITION |
231                                 IWL6000G2B_BT_FLAG_COEX_MODE_3W <<
232                                         IWL6000G2B_BT_FLAG_COEX_MODE_SHIFT;
233                 bt_cmd.valid |= IWL6000G2B_BT_ALL_VALID_MSK;
234         }
235
236         memcpy(bt_cmd.bt3_lookup_table, iwl6000g2b_def_3w_lookup,
237                 sizeof(iwl6000g2b_def_3w_lookup));
238
239         IWL_DEBUG_INFO(priv, "BT coex %s\n",
240                        bt_cmd.flags ? "active" : "disabled");
241
242         if (iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, sizeof(bt_cmd), &bt_cmd))
243                 IWL_ERR(priv, "failed to send BT Coex Config\n");
244
245         /*
246          * When we are doing a restart, need to also reconfigure BT
247          * SCO to the device. If not doing a restart, bt_sco_active
248          * will always be false, so there's no need to have an extra
249          * variable to check for it.
250          */
251         if (priv->bt_sco_active) {
252                 struct iwl6000g2b_bt_sco_cmd sco_cmd = { .flags = 0 };
253
254                 if (priv->bt_sco_active)
255                         sco_cmd.flags |= IWL6000G2B_BT_SCO_ACTIVE;
256                 if (iwl_send_cmd_pdu(priv, REPLY_BT_COEX_SCO,
257                                      sizeof(sco_cmd), &sco_cmd))
258                         IWL_ERR(priv, "failed to send BT SCO command\n");
259         }
260 }
261
262 static struct iwl_sensitivity_ranges iwl6000_sensitivity = {
263         .min_nrg_cck = 97,
264         .max_nrg_cck = 0, /* not used, set to 0 */
265         .auto_corr_min_ofdm = 80,
266         .auto_corr_min_ofdm_mrc = 128,
267         .auto_corr_min_ofdm_x1 = 105,
268         .auto_corr_min_ofdm_mrc_x1 = 192,
269
270         .auto_corr_max_ofdm = 145,
271         .auto_corr_max_ofdm_mrc = 232,
272         .auto_corr_max_ofdm_x1 = 110,
273         .auto_corr_max_ofdm_mrc_x1 = 232,
274
275         .auto_corr_min_cck = 125,
276         .auto_corr_max_cck = 175,
277         .auto_corr_min_cck_mrc = 160,
278         .auto_corr_max_cck_mrc = 310,
279         .nrg_th_cck = 97,
280         .nrg_th_ofdm = 100,
281
282         .barker_corr_th_min = 190,
283         .barker_corr_th_min_mrc = 390,
284         .nrg_th_cca = 62,
285 };
286
287 static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
288 {
289         if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
290             priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES)
291                 priv->cfg->num_of_queues =
292                         priv->cfg->mod_params->num_of_queues;
293
294         priv->hw_params.max_txq_num = priv->cfg->num_of_queues;
295         priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
296         priv->hw_params.scd_bc_tbls_size =
297                         priv->cfg->num_of_queues *
298                         sizeof(struct iwlagn_scd_bc_tbl);
299         priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
300         priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
301         priv->hw_params.bcast_sta_id = IWLAGN_BROADCAST_ID;
302
303         priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
304         priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
305
306         priv->hw_params.max_bsm_size = 0;
307         priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
308                                         BIT(IEEE80211_BAND_5GHZ);
309         priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
310
311         priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
312         priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
313         priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
314         priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
315
316         if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
317                 priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
318
319         /* Set initial sensitivity parameters */
320         /* Set initial calibration set */
321         priv->hw_params.sens = &iwl6000_sensitivity;
322         priv->hw_params.calib_init_cfg =
323                 BIT(IWL_CALIB_XTAL)             |
324                 BIT(IWL_CALIB_LO)               |
325                 BIT(IWL_CALIB_TX_IQ)            |
326                 BIT(IWL_CALIB_BASE_BAND);
327         if (priv->cfg->need_dc_calib)
328                 priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_DC);
329
330         priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
331
332         return 0;
333 }
334
335 static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
336                                      struct ieee80211_channel_switch *ch_switch)
337 {
338         struct iwl6000_channel_switch_cmd cmd;
339         const struct iwl_channel_info *ch_info;
340         u32 switch_time_in_usec, ucode_switch_time;
341         u16 ch;
342         u32 tsf_low;
343         u8 switch_count;
344         u16 beacon_interval = le16_to_cpu(priv->rxon_timing.beacon_interval);
345         struct ieee80211_vif *vif = priv->vif;
346         struct iwl_host_cmd hcmd = {
347                 .id = REPLY_CHANNEL_SWITCH,
348                 .len = sizeof(cmd),
349                 .flags = CMD_SYNC,
350                 .data = &cmd,
351         };
352
353         cmd.band = priv->band == IEEE80211_BAND_2GHZ;
354         ch = ch_switch->channel->hw_value;
355         IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
356                       priv->active_rxon.channel, ch);
357         cmd.channel = cpu_to_le16(ch);
358         cmd.rxon_flags = priv->staging_rxon.flags;
359         cmd.rxon_filter_flags = priv->staging_rxon.filter_flags;
360         switch_count = ch_switch->count;
361         tsf_low = ch_switch->timestamp & 0x0ffffffff;
362         /*
363          * calculate the ucode channel switch time
364          * adding TSF as one of the factor for when to switch
365          */
366         if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) {
367                 if (switch_count > ((priv->ucode_beacon_time - tsf_low) /
368                     beacon_interval)) {
369                         switch_count -= (priv->ucode_beacon_time -
370                                 tsf_low) / beacon_interval;
371                 } else
372                         switch_count = 0;
373         }
374         if (switch_count <= 1)
375                 cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
376         else {
377                 switch_time_in_usec =
378                         vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
379                 ucode_switch_time = iwl_usecs_to_beacons(priv,
380                                                          switch_time_in_usec,
381                                                          beacon_interval);
382                 cmd.switch_time = iwl_add_beacon_time(priv,
383                                                       priv->ucode_beacon_time,
384                                                       ucode_switch_time,
385                                                       beacon_interval);
386         }
387         IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
388                       cmd.switch_time);
389         ch_info = iwl_get_channel_info(priv, priv->band, ch);
390         if (ch_info)
391                 cmd.expect_beacon = is_channel_radar(ch_info);
392         else {
393                 IWL_ERR(priv, "invalid channel switch from %u to %u\n",
394                         priv->active_rxon.channel, ch);
395                 return -EFAULT;
396         }
397         priv->switch_rxon.channel = cmd.channel;
398         priv->switch_rxon.switch_in_progress = true;
399
400         return iwl_send_cmd_sync(priv, &hcmd);
401 }
402
403 static void iwl6000g2b_bt_traffic_change_work(struct work_struct *work)
404 {
405         struct iwl_priv *priv =
406                 container_of(work, struct iwl_priv, bt_traffic_change_work);
407         int smps_request = -1;
408
409         switch (priv->bt_traffic_load) {
410         case IWL_BT_COEX_TRAFFIC_LOAD_NONE:
411                 smps_request = IEEE80211_SMPS_AUTOMATIC;
412                 break;
413         case IWL_BT_COEX_TRAFFIC_LOAD_LOW:
414                 smps_request = IEEE80211_SMPS_DYNAMIC;
415                 break;
416         case IWL_BT_COEX_TRAFFIC_LOAD_HIGH:
417         case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
418                 smps_request = IEEE80211_SMPS_STATIC;
419                 break;
420         default:
421                 IWL_ERR(priv, "Invalid BT traffic load: %d\n",
422                         priv->bt_traffic_load);
423                 break;
424         }
425
426         mutex_lock(&priv->mutex);
427
428         if (smps_request != -1 &&
429             priv->vif && priv->vif->type == NL80211_IFTYPE_STATION)
430                 ieee80211_request_smps(priv->vif, smps_request);
431
432         mutex_unlock(&priv->mutex);
433 }
434
435 static void iwl6000g2b_bt_coex_profile_notif(struct iwl_priv *priv,
436                                              struct iwl_rx_mem_buffer *rxb)
437 {
438         struct iwl_rx_packet *pkt = rxb_addr(rxb);
439         struct iwl_bt_coex_profile_notif *coex = &pkt->u.bt_coex_profile_notif;
440         struct iwl6000g2b_bt_sco_cmd sco_cmd = { .flags = 0 };
441
442         IWL_DEBUG_NOTIF(priv, "BT Coex notification:\n");
443         IWL_DEBUG_NOTIF(priv, "    status: %d\n", coex->bt_status);
444         IWL_DEBUG_NOTIF(priv, "    traffic load: %d\n", coex->bt_traffic_load);
445         IWL_DEBUG_NOTIF(priv, "    CI compliance: %d\n", coex->bt_ci_compliance);
446         IWL_DEBUG_NOTIF(priv, "    UART msg: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x:"
447                               "%.2x:%.2x\n",
448                         coex->uart_msg[0], coex->uart_msg[1], coex->uart_msg[2],
449                         coex->uart_msg[3], coex->uart_msg[4], coex->uart_msg[5],
450                         coex->uart_msg[6], coex->uart_msg[7]);
451
452         priv->notif_bt_traffic_load = coex->bt_traffic_load;
453
454         if (priv->iw_mode != NL80211_IFTYPE_ADHOC) {
455                 if (coex->bt_traffic_load != priv->bt_traffic_load) {
456                         priv->bt_traffic_load = coex->bt_traffic_load;
457
458                         queue_work(priv->workqueue,
459                                    &priv->bt_traffic_change_work);
460                 }
461
462                 /* FIXME: add defines for this check */
463                 priv->bt_sco_active = coex->uart_msg[3] & 1;
464                 if (priv->bt_sco_active)
465                         sco_cmd.flags |= IWL6000G2B_BT_SCO_ACTIVE;
466                 iwl_send_cmd_pdu_async(priv, REPLY_BT_COEX_SCO,
467                                        sizeof(sco_cmd), &sco_cmd, NULL);
468         }
469 }
470
471 void iwl6000g2b_rx_handler_setup(struct iwl_priv *priv)
472 {
473         iwlagn_rx_handler_setup(priv);
474         priv->rx_handlers[REPLY_BT_COEX_PROFILE_NOTIF] =
475                 iwl6000g2b_bt_coex_profile_notif;
476 }
477
478 static void iwl6000g2b_bt_setup_deferred_work(struct iwl_priv *priv)
479 {
480         iwlagn_setup_deferred_work(priv);
481
482         INIT_WORK(&priv->bt_traffic_change_work,
483                   iwl6000g2b_bt_traffic_change_work);
484
485 }
486
487 static void iwl6000g2b_bt_cancel_deferred_work(struct iwl_priv *priv)
488 {
489         cancel_work_sync(&priv->bt_traffic_change_work);
490 }
491
492 static struct iwl_lib_ops iwl6000_lib = {
493         .set_hw_params = iwl6000_hw_set_hw_params,
494         .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
495         .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
496         .txq_set_sched = iwlagn_txq_set_sched,
497         .txq_agg_enable = iwlagn_txq_agg_enable,
498         .txq_agg_disable = iwlagn_txq_agg_disable,
499         .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
500         .txq_free_tfd = iwl_hw_txq_free_tfd,
501         .txq_init = iwl_hw_tx_queue_init,
502         .rx_handler_setup = iwlagn_rx_handler_setup,
503         .setup_deferred_work = iwlagn_setup_deferred_work,
504         .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
505         .load_ucode = iwlagn_load_ucode,
506         .dump_nic_event_log = iwl_dump_nic_event_log,
507         .dump_nic_error_log = iwl_dump_nic_error_log,
508         .dump_csr = iwl_dump_csr,
509         .dump_fh = iwl_dump_fh,
510         .init_alive_start = iwlagn_init_alive_start,
511         .alive_notify = iwlagn_alive_notify,
512         .send_tx_power = iwlagn_send_tx_power,
513         .update_chain_flags = iwl_update_chain_flags,
514         .set_channel_switch = iwl6000_hw_channel_switch,
515         .apm_ops = {
516                 .init = iwl_apm_init,
517                 .stop = iwl_apm_stop,
518                 .config = iwl6000_nic_config,
519                 .set_pwr_src = iwl_set_pwr_src,
520         },
521         .eeprom_ops = {
522                 .regulatory_bands = {
523                         EEPROM_REG_BAND_1_CHANNELS,
524                         EEPROM_REG_BAND_2_CHANNELS,
525                         EEPROM_REG_BAND_3_CHANNELS,
526                         EEPROM_REG_BAND_4_CHANNELS,
527                         EEPROM_REG_BAND_5_CHANNELS,
528                         EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
529                         EEPROM_REG_BAND_52_HT40_CHANNELS
530                 },
531                 .verify_signature  = iwlcore_eeprom_verify_signature,
532                 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
533                 .release_semaphore = iwlcore_eeprom_release_semaphore,
534                 .calib_version  = iwlagn_eeprom_calib_version,
535                 .query_addr = iwlagn_eeprom_query_addr,
536                 .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
537         },
538         .post_associate = iwl_post_associate,
539         .isr = iwl_isr_ict,
540         .config_ap = iwl_config_ap,
541         .temp_ops = {
542                 .temperature = iwlagn_temperature,
543                 .set_ct_kill = iwl6000_set_ct_threshold,
544                 .set_calib_version = iwl6000_set_calib_version,
545          },
546         .manage_ibss_station = iwlagn_manage_ibss_station,
547         .update_bcast_station = iwl_update_bcast_station,
548         .debugfs_ops = {
549                 .rx_stats_read = iwl_ucode_rx_stats_read,
550                 .tx_stats_read = iwl_ucode_tx_stats_read,
551                 .general_stats_read = iwl_ucode_general_stats_read,
552                 .bt_stats_read = iwl_ucode_bt_stats_read,
553         },
554         .recover_from_tx_stall = iwl_bg_monitor_recover,
555         .check_plcp_health = iwl_good_plcp_health,
556         .check_ack_health = iwl_good_ack_health,
557         .txfifo_flush = iwlagn_txfifo_flush,
558         .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
559         .tt_ops = {
560                 .lower_power_detection = iwl_tt_is_low_power_state,
561                 .tt_power_mode = iwl_tt_current_power_mode,
562                 .ct_kill_check = iwl_check_for_ct_kill,
563         }
564 };
565
566 static struct iwl_lib_ops iwl6000g2b_lib = {
567         .set_hw_params = iwl6000_hw_set_hw_params,
568         .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
569         .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
570         .txq_set_sched = iwlagn_txq_set_sched,
571         .txq_agg_enable = iwlagn_txq_agg_enable,
572         .txq_agg_disable = iwlagn_txq_agg_disable,
573         .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
574         .txq_free_tfd = iwl_hw_txq_free_tfd,
575         .txq_init = iwl_hw_tx_queue_init,
576         .rx_handler_setup = iwl6000g2b_rx_handler_setup,
577         .setup_deferred_work = iwl6000g2b_bt_setup_deferred_work,
578         .cancel_deferred_work = iwl6000g2b_bt_cancel_deferred_work,
579         .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
580         .load_ucode = iwlagn_load_ucode,
581         .dump_nic_event_log = iwl_dump_nic_event_log,
582         .dump_nic_error_log = iwl_dump_nic_error_log,
583         .dump_csr = iwl_dump_csr,
584         .dump_fh = iwl_dump_fh,
585         .init_alive_start = iwlagn_init_alive_start,
586         .alive_notify = iwlagn_alive_notify,
587         .send_tx_power = iwlagn_send_tx_power,
588         .update_chain_flags = iwl_update_chain_flags,
589         .set_channel_switch = iwl6000_hw_channel_switch,
590         .apm_ops = {
591                 .init = iwl_apm_init,
592                 .stop = iwl_apm_stop,
593                 .config = iwl6000_nic_config,
594                 .set_pwr_src = iwl_set_pwr_src,
595         },
596         .eeprom_ops = {
597                 .regulatory_bands = {
598                         EEPROM_REG_BAND_1_CHANNELS,
599                         EEPROM_REG_BAND_2_CHANNELS,
600                         EEPROM_REG_BAND_3_CHANNELS,
601                         EEPROM_REG_BAND_4_CHANNELS,
602                         EEPROM_REG_BAND_5_CHANNELS,
603                         EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
604                         EEPROM_REG_BAND_52_HT40_CHANNELS
605                 },
606                 .verify_signature  = iwlcore_eeprom_verify_signature,
607                 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
608                 .release_semaphore = iwlcore_eeprom_release_semaphore,
609                 .calib_version  = iwlagn_eeprom_calib_version,
610                 .query_addr = iwlagn_eeprom_query_addr,
611                 .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
612         },
613         .post_associate = iwl_post_associate,
614         .isr = iwl_isr_ict,
615         .config_ap = iwl_config_ap,
616         .temp_ops = {
617                 .temperature = iwlagn_temperature,
618                 .set_ct_kill = iwl6000_set_ct_threshold,
619                 .set_calib_version = iwl6000_set_calib_version,
620          },
621         .manage_ibss_station = iwlagn_manage_ibss_station,
622         .update_bcast_station = iwl_update_bcast_station,
623         .debugfs_ops = {
624                 .rx_stats_read = iwl_ucode_rx_stats_read,
625                 .tx_stats_read = iwl_ucode_tx_stats_read,
626                 .general_stats_read = iwl_ucode_general_stats_read,
627                 .bt_stats_read = iwl_ucode_bt_stats_read,
628         },
629         .recover_from_tx_stall = iwl_bg_monitor_recover,
630         .check_plcp_health = iwl_good_plcp_health,
631         .check_ack_health = iwl_good_ack_health,
632         .txfifo_flush = iwlagn_txfifo_flush,
633         .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
634         .tt_ops = {
635                 .lower_power_detection = iwl_tt_is_low_power_state,
636                 .tt_power_mode = iwl_tt_current_power_mode,
637                 .ct_kill_check = iwl_check_for_ct_kill,
638         }
639 };
640
641 static const struct iwl_ops iwl6000_ops = {
642         .lib = &iwl6000_lib,
643         .hcmd = &iwlagn_hcmd,
644         .utils = &iwlagn_hcmd_utils,
645         .led = &iwlagn_led_ops,
646 };
647
648 static struct iwl_hcmd_ops iwl6000g2b_hcmd = {
649         .rxon_assoc = iwlagn_send_rxon_assoc,
650         .commit_rxon = iwl_commit_rxon,
651         .set_rxon_chain = iwl_set_rxon_chain,
652         .set_tx_ant = iwlagn_send_tx_ant_config,
653         .send_bt_config = iwl6000g2b_send_bt_config,
654 };
655
656 static const struct iwl_ops iwl6000g2b_ops = {
657         .lib = &iwl6000g2b_lib,
658         .hcmd = &iwl6000g2b_hcmd,
659         .utils = &iwlagn_hcmd_utils,
660         .led = &iwlagn_led_ops,
661 };
662
663 struct iwl_cfg iwl6000g2a_2agn_cfg = {
664         .name = "6000 Series 2x2 AGN Gen2a",
665         .fw_name_pre = IWL6000G2A_FW_PRE,
666         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
667         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
668         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
669         .ops = &iwl6000_ops,
670         .eeprom_size = OTP_LOW_IMAGE_SIZE,
671         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
672         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
673         .num_of_queues = IWLAGN_NUM_QUEUES,
674         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
675         .mod_params = &iwlagn_mod_params,
676         .valid_tx_ant = ANT_AB,
677         .valid_rx_ant = ANT_AB,
678         .pll_cfg_val = 0,
679         .set_l0s = true,
680         .use_bsm = false,
681         .pa_type = IWL_PA_SYSTEM,
682         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
683         .shadow_ram_support = true,
684         .ht_greenfield_support = true,
685         .led_compensation = 51,
686         .use_rts_for_aggregation = true, /* use rts/cts protection */
687         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
688         .supports_idle = true,
689         .adv_thermal_throttle = true,
690         .support_ct_kill_exit = true,
691         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
692         .chain_noise_scale = 1000,
693         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
694         .max_event_log_size = 512,
695         .ucode_tracing = true,
696         .sensitivity_calib_by_driver = true,
697         .chain_noise_calib_by_driver = true,
698         .need_dc_calib = true,
699 };
700
701 struct iwl_cfg iwl6000g2a_2abg_cfg = {
702         .name = "6000 Series 2x2 ABG Gen2a",
703         .fw_name_pre = IWL6000G2A_FW_PRE,
704         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
705         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
706         .sku = IWL_SKU_A|IWL_SKU_G,
707         .ops = &iwl6000_ops,
708         .eeprom_size = OTP_LOW_IMAGE_SIZE,
709         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
710         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
711         .num_of_queues = IWLAGN_NUM_QUEUES,
712         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
713         .mod_params = &iwlagn_mod_params,
714         .valid_tx_ant = ANT_AB,
715         .valid_rx_ant = ANT_AB,
716         .pll_cfg_val = 0,
717         .set_l0s = true,
718         .use_bsm = false,
719         .pa_type = IWL_PA_SYSTEM,
720         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
721         .shadow_ram_support = true,
722         .led_compensation = 51,
723         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
724         .supports_idle = true,
725         .adv_thermal_throttle = true,
726         .support_ct_kill_exit = true,
727         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
728         .chain_noise_scale = 1000,
729         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
730         .max_event_log_size = 512,
731         .sensitivity_calib_by_driver = true,
732         .chain_noise_calib_by_driver = true,
733         .need_dc_calib = true,
734 };
735
736 struct iwl_cfg iwl6000g2a_2bg_cfg = {
737         .name = "6000 Series 2x2 BG Gen2a",
738         .fw_name_pre = IWL6000G2A_FW_PRE,
739         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
740         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
741         .sku = IWL_SKU_G,
742         .ops = &iwl6000_ops,
743         .eeprom_size = OTP_LOW_IMAGE_SIZE,
744         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
745         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
746         .num_of_queues = IWLAGN_NUM_QUEUES,
747         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
748         .mod_params = &iwlagn_mod_params,
749         .valid_tx_ant = ANT_AB,
750         .valid_rx_ant = ANT_AB,
751         .pll_cfg_val = 0,
752         .set_l0s = true,
753         .use_bsm = false,
754         .pa_type = IWL_PA_SYSTEM,
755         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
756         .shadow_ram_support = true,
757         .led_compensation = 51,
758         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
759         .supports_idle = true,
760         .adv_thermal_throttle = true,
761         .support_ct_kill_exit = true,
762         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
763         .chain_noise_scale = 1000,
764         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
765         .max_event_log_size = 512,
766         .sensitivity_calib_by_driver = true,
767         .chain_noise_calib_by_driver = true,
768         .need_dc_calib = true,
769 };
770
771 struct iwl_cfg iwl6000g2b_2agn_cfg = {
772         .name = "6000 Series 2x2 AGN Gen2b",
773         .fw_name_pre = IWL6000G2B_FW_PRE,
774         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
775         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
776         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
777         .ops = &iwl6000g2b_ops,
778         .eeprom_size = OTP_LOW_IMAGE_SIZE,
779         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
780         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
781         .num_of_queues = IWLAGN_NUM_QUEUES,
782         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
783         .mod_params = &iwlagn_mod_params,
784         .valid_tx_ant = ANT_AB,
785         .valid_rx_ant = ANT_AB,
786         .pll_cfg_val = 0,
787         .set_l0s = true,
788         .use_bsm = false,
789         .pa_type = IWL_PA_SYSTEM,
790         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
791         .shadow_ram_support = true,
792         .ht_greenfield_support = true,
793         .led_compensation = 51,
794         .use_rts_for_aggregation = true, /* use rts/cts protection */
795         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
796         .supports_idle = true,
797         .adv_thermal_throttle = true,
798         .support_ct_kill_exit = true,
799         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
800         .chain_noise_scale = 1000,
801         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
802         .max_event_log_size = 512,
803         .sensitivity_calib_by_driver = true,
804         .chain_noise_calib_by_driver = true,
805         .need_dc_calib = true,
806         .bt_statistics = true,
807         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
808         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
809         .advanced_bt_coexist = true,
810 };
811
812 struct iwl_cfg iwl6000g2b_2abg_cfg = {
813         .name = "6000 Series 2x2 ABG Gen2b",
814         .fw_name_pre = IWL6000G2B_FW_PRE,
815         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
816         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
817         .sku = IWL_SKU_A|IWL_SKU_G,
818         .ops = &iwl6000g2b_ops,
819         .eeprom_size = OTP_LOW_IMAGE_SIZE,
820         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
821         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
822         .num_of_queues = IWLAGN_NUM_QUEUES,
823         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
824         .mod_params = &iwlagn_mod_params,
825         .valid_tx_ant = ANT_AB,
826         .valid_rx_ant = ANT_AB,
827         .pll_cfg_val = 0,
828         .set_l0s = true,
829         .use_bsm = false,
830         .pa_type = IWL_PA_SYSTEM,
831         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
832         .shadow_ram_support = true,
833         .led_compensation = 51,
834         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
835         .supports_idle = true,
836         .adv_thermal_throttle = true,
837         .support_ct_kill_exit = true,
838         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
839         .chain_noise_scale = 1000,
840         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
841         .max_event_log_size = 512,
842         .sensitivity_calib_by_driver = true,
843         .chain_noise_calib_by_driver = true,
844         .need_dc_calib = true,
845         .bt_statistics = true,
846         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
847         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
848         .advanced_bt_coexist = true,
849 };
850
851 struct iwl_cfg iwl6000g2b_2bgn_cfg = {
852         .name = "6000 Series 2x2 BGN Gen2b",
853         .fw_name_pre = IWL6000G2B_FW_PRE,
854         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
855         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
856         .sku = IWL_SKU_G|IWL_SKU_N,
857         .ops = &iwl6000g2b_ops,
858         .eeprom_size = OTP_LOW_IMAGE_SIZE,
859         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
860         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
861         .num_of_queues = IWLAGN_NUM_QUEUES,
862         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
863         .mod_params = &iwlagn_mod_params,
864         .valid_tx_ant = ANT_AB,
865         .valid_rx_ant = ANT_AB,
866         .pll_cfg_val = 0,
867         .set_l0s = true,
868         .use_bsm = false,
869         .pa_type = IWL_PA_SYSTEM,
870         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
871         .shadow_ram_support = true,
872         .ht_greenfield_support = true,
873         .led_compensation = 51,
874         .use_rts_for_aggregation = true, /* use rts/cts protection */
875         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
876         .supports_idle = true,
877         .adv_thermal_throttle = true,
878         .support_ct_kill_exit = true,
879         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
880         .chain_noise_scale = 1000,
881         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
882         .max_event_log_size = 512,
883         .sensitivity_calib_by_driver = true,
884         .chain_noise_calib_by_driver = true,
885         .need_dc_calib = true,
886         .bt_statistics = true,
887         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
888         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
889         .advanced_bt_coexist = true,
890 };
891
892 struct iwl_cfg iwl6000g2b_2bg_cfg = {
893         .name = "6000 Series 2x2 BG Gen2b",
894         .fw_name_pre = IWL6000G2B_FW_PRE,
895         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
896         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
897         .sku = IWL_SKU_G,
898         .ops = &iwl6000g2b_ops,
899         .eeprom_size = OTP_LOW_IMAGE_SIZE,
900         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
901         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
902         .num_of_queues = IWLAGN_NUM_QUEUES,
903         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
904         .mod_params = &iwlagn_mod_params,
905         .valid_tx_ant = ANT_AB,
906         .valid_rx_ant = ANT_AB,
907         .pll_cfg_val = 0,
908         .set_l0s = true,
909         .use_bsm = false,
910         .pa_type = IWL_PA_SYSTEM,
911         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
912         .shadow_ram_support = true,
913         .led_compensation = 51,
914         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
915         .supports_idle = true,
916         .adv_thermal_throttle = true,
917         .support_ct_kill_exit = true,
918         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
919         .chain_noise_scale = 1000,
920         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
921         .max_event_log_size = 512,
922         .sensitivity_calib_by_driver = true,
923         .chain_noise_calib_by_driver = true,
924         .need_dc_calib = true,
925         .bt_statistics = true,
926         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
927         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
928         .advanced_bt_coexist = true,
929 };
930
931 struct iwl_cfg iwl6000g2b_bgn_cfg = {
932         .name = "6000 Series 1x2 BGN Gen2b",
933         .fw_name_pre = IWL6000G2B_FW_PRE,
934         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
935         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
936         .sku = IWL_SKU_G|IWL_SKU_N,
937         .ops = &iwl6000g2b_ops,
938         .eeprom_size = OTP_LOW_IMAGE_SIZE,
939         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
940         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
941         .num_of_queues = IWLAGN_NUM_QUEUES,
942         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
943         .mod_params = &iwlagn_mod_params,
944         .valid_tx_ant = ANT_A,
945         .valid_rx_ant = ANT_AB,
946         .pll_cfg_val = 0,
947         .set_l0s = true,
948         .use_bsm = false,
949         .pa_type = IWL_PA_SYSTEM,
950         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
951         .shadow_ram_support = true,
952         .ht_greenfield_support = true,
953         .led_compensation = 51,
954         .use_rts_for_aggregation = true, /* use rts/cts protection */
955         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
956         .supports_idle = true,
957         .adv_thermal_throttle = true,
958         .support_ct_kill_exit = true,
959         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
960         .chain_noise_scale = 1000,
961         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
962         .max_event_log_size = 512,
963         .sensitivity_calib_by_driver = true,
964         .chain_noise_calib_by_driver = true,
965         .need_dc_calib = true,
966         .bt_statistics = true,
967         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
968         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
969         .advanced_bt_coexist = true,
970 };
971
972 struct iwl_cfg iwl6000g2b_bg_cfg = {
973         .name = "6000 Series 1x2 BG Gen2b",
974         .fw_name_pre = IWL6000G2B_FW_PRE,
975         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
976         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
977         .sku = IWL_SKU_G,
978         .ops = &iwl6000g2b_ops,
979         .eeprom_size = OTP_LOW_IMAGE_SIZE,
980         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
981         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
982         .num_of_queues = IWLAGN_NUM_QUEUES,
983         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
984         .mod_params = &iwlagn_mod_params,
985         .valid_tx_ant = ANT_A,
986         .valid_rx_ant = ANT_AB,
987         .pll_cfg_val = 0,
988         .set_l0s = true,
989         .use_bsm = false,
990         .pa_type = IWL_PA_SYSTEM,
991         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
992         .shadow_ram_support = true,
993         .led_compensation = 51,
994         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
995         .supports_idle = true,
996         .adv_thermal_throttle = true,
997         .support_ct_kill_exit = true,
998         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
999         .chain_noise_scale = 1000,
1000         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
1001         .max_event_log_size = 512,
1002         .sensitivity_calib_by_driver = true,
1003         .chain_noise_calib_by_driver = true,
1004         .need_dc_calib = true,
1005         .bt_statistics = true,
1006         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
1007         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
1008         .advanced_bt_coexist = true,
1009 };
1010
1011 /*
1012  * "i": Internal configuration, use internal Power Amplifier
1013  */
1014 struct iwl_cfg iwl6000i_2agn_cfg = {
1015         .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN",
1016         .fw_name_pre = IWL6000_FW_PRE,
1017         .ucode_api_max = IWL6000_UCODE_API_MAX,
1018         .ucode_api_min = IWL6000_UCODE_API_MIN,
1019         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
1020         .ops = &iwl6000_ops,
1021         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1022         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
1023         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
1024         .num_of_queues = IWLAGN_NUM_QUEUES,
1025         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1026         .mod_params = &iwlagn_mod_params,
1027         .valid_tx_ant = ANT_BC,
1028         .valid_rx_ant = ANT_BC,
1029         .pll_cfg_val = 0,
1030         .set_l0s = true,
1031         .use_bsm = false,
1032         .pa_type = IWL_PA_INTERNAL,
1033         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1034         .shadow_ram_support = true,
1035         .ht_greenfield_support = true,
1036         .led_compensation = 51,
1037         .use_rts_for_aggregation = true, /* use rts/cts protection */
1038         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1039         .supports_idle = true,
1040         .adv_thermal_throttle = true,
1041         .support_ct_kill_exit = true,
1042         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1043         .chain_noise_scale = 1000,
1044         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1045         .max_event_log_size = 1024,
1046         .ucode_tracing = true,
1047         .sensitivity_calib_by_driver = true,
1048         .chain_noise_calib_by_driver = true,
1049 };
1050
1051 struct iwl_cfg iwl6000i_2abg_cfg = {
1052         .name = "Intel(R) Centrino(R) Advanced-N 6200 ABG",
1053         .fw_name_pre = IWL6000_FW_PRE,
1054         .ucode_api_max = IWL6000_UCODE_API_MAX,
1055         .ucode_api_min = IWL6000_UCODE_API_MIN,
1056         .sku = IWL_SKU_A|IWL_SKU_G,
1057         .ops = &iwl6000_ops,
1058         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1059         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
1060         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
1061         .num_of_queues = IWLAGN_NUM_QUEUES,
1062         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1063         .mod_params = &iwlagn_mod_params,
1064         .valid_tx_ant = ANT_BC,
1065         .valid_rx_ant = ANT_BC,
1066         .pll_cfg_val = 0,
1067         .set_l0s = true,
1068         .use_bsm = false,
1069         .pa_type = IWL_PA_INTERNAL,
1070         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1071         .shadow_ram_support = true,
1072         .led_compensation = 51,
1073         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1074         .supports_idle = true,
1075         .adv_thermal_throttle = true,
1076         .support_ct_kill_exit = true,
1077         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1078         .chain_noise_scale = 1000,
1079         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1080         .max_event_log_size = 1024,
1081         .ucode_tracing = true,
1082         .sensitivity_calib_by_driver = true,
1083         .chain_noise_calib_by_driver = true,
1084 };
1085
1086 struct iwl_cfg iwl6000i_2bg_cfg = {
1087         .name = "Intel(R) Centrino(R) Advanced-N 6200 BG",
1088         .fw_name_pre = IWL6000_FW_PRE,
1089         .ucode_api_max = IWL6000_UCODE_API_MAX,
1090         .ucode_api_min = IWL6000_UCODE_API_MIN,
1091         .sku = IWL_SKU_G,
1092         .ops = &iwl6000_ops,
1093         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1094         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
1095         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
1096         .num_of_queues = IWLAGN_NUM_QUEUES,
1097         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1098         .mod_params = &iwlagn_mod_params,
1099         .valid_tx_ant = ANT_BC,
1100         .valid_rx_ant = ANT_BC,
1101         .pll_cfg_val = 0,
1102         .set_l0s = true,
1103         .use_bsm = false,
1104         .pa_type = IWL_PA_INTERNAL,
1105         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1106         .shadow_ram_support = true,
1107         .led_compensation = 51,
1108         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1109         .supports_idle = true,
1110         .adv_thermal_throttle = true,
1111         .support_ct_kill_exit = true,
1112         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1113         .chain_noise_scale = 1000,
1114         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1115         .max_event_log_size = 1024,
1116         .ucode_tracing = true,
1117         .sensitivity_calib_by_driver = true,
1118         .chain_noise_calib_by_driver = true,
1119 };
1120
1121 struct iwl_cfg iwl6050_2agn_cfg = {
1122         .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN",
1123         .fw_name_pre = IWL6050_FW_PRE,
1124         .ucode_api_max = IWL6050_UCODE_API_MAX,
1125         .ucode_api_min = IWL6050_UCODE_API_MIN,
1126         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
1127         .ops = &iwl6000_ops,
1128         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1129         .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
1130         .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
1131         .num_of_queues = IWLAGN_NUM_QUEUES,
1132         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1133         .mod_params = &iwlagn_mod_params,
1134         .valid_tx_ant = ANT_AB,
1135         .valid_rx_ant = ANT_AB,
1136         .pll_cfg_val = 0,
1137         .set_l0s = true,
1138         .use_bsm = false,
1139         .pa_type = IWL_PA_SYSTEM,
1140         .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
1141         .shadow_ram_support = true,
1142         .ht_greenfield_support = true,
1143         .led_compensation = 51,
1144         .use_rts_for_aggregation = true, /* use rts/cts protection */
1145         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1146         .supports_idle = true,
1147         .adv_thermal_throttle = true,
1148         .support_ct_kill_exit = true,
1149         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1150         .chain_noise_scale = 1500,
1151         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1152         .max_event_log_size = 1024,
1153         .ucode_tracing = true,
1154         .sensitivity_calib_by_driver = true,
1155         .chain_noise_calib_by_driver = true,
1156         .need_dc_calib = true,
1157 };
1158
1159 struct iwl_cfg iwl6050g2_bgn_cfg = {
1160         .name = "6050 Series 1x2 BGN Gen2",
1161         .fw_name_pre = IWL6050_FW_PRE,
1162         .ucode_api_max = IWL6050_UCODE_API_MAX,
1163         .ucode_api_min = IWL6050_UCODE_API_MIN,
1164         .sku = IWL_SKU_G|IWL_SKU_N,
1165         .ops = &iwl6000_ops,
1166         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1167         .eeprom_ver = EEPROM_6050G2_EEPROM_VERSION,
1168         .eeprom_calib_ver = EEPROM_6050G2_TX_POWER_VERSION,
1169         .num_of_queues = IWLAGN_NUM_QUEUES,
1170         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1171         .mod_params = &iwlagn_mod_params,
1172         .valid_tx_ant = ANT_A,
1173         .valid_rx_ant = ANT_AB,
1174         .pll_cfg_val = 0,
1175         .set_l0s = true,
1176         .use_bsm = false,
1177         .pa_type = IWL_PA_SYSTEM,
1178         .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
1179         .shadow_ram_support = true,
1180         .ht_greenfield_support = true,
1181         .led_compensation = 51,
1182         .use_rts_for_aggregation = true, /* use rts/cts protection */
1183         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1184         .supports_idle = true,
1185         .adv_thermal_throttle = true,
1186         .support_ct_kill_exit = true,
1187         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1188         .chain_noise_scale = 1500,
1189         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1190         .max_event_log_size = 1024,
1191         .ucode_tracing = true,
1192         .sensitivity_calib_by_driver = true,
1193         .chain_noise_calib_by_driver = true,
1194         .need_dc_calib = true,
1195 };
1196
1197 struct iwl_cfg iwl6050_2abg_cfg = {
1198         .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 ABG",
1199         .fw_name_pre = IWL6050_FW_PRE,
1200         .ucode_api_max = IWL6050_UCODE_API_MAX,
1201         .ucode_api_min = IWL6050_UCODE_API_MIN,
1202         .sku = IWL_SKU_A|IWL_SKU_G,
1203         .ops = &iwl6000_ops,
1204         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1205         .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
1206         .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
1207         .num_of_queues = IWLAGN_NUM_QUEUES,
1208         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1209         .mod_params = &iwlagn_mod_params,
1210         .valid_tx_ant = ANT_AB,
1211         .valid_rx_ant = ANT_AB,
1212         .pll_cfg_val = 0,
1213         .set_l0s = true,
1214         .use_bsm = false,
1215         .pa_type = IWL_PA_SYSTEM,
1216         .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
1217         .shadow_ram_support = true,
1218         .led_compensation = 51,
1219         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1220         .supports_idle = true,
1221         .adv_thermal_throttle = true,
1222         .support_ct_kill_exit = true,
1223         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1224         .chain_noise_scale = 1500,
1225         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1226         .max_event_log_size = 1024,
1227         .ucode_tracing = true,
1228         .sensitivity_calib_by_driver = true,
1229         .chain_noise_calib_by_driver = true,
1230         .need_dc_calib = true,
1231 };
1232
1233 struct iwl_cfg iwl6000_3agn_cfg = {
1234         .name = "Intel(R) Centrino(R) Ultimate-N 6300 AGN",
1235         .fw_name_pre = IWL6000_FW_PRE,
1236         .ucode_api_max = IWL6000_UCODE_API_MAX,
1237         .ucode_api_min = IWL6000_UCODE_API_MIN,
1238         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
1239         .ops = &iwl6000_ops,
1240         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1241         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
1242         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
1243         .num_of_queues = IWLAGN_NUM_QUEUES,
1244         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1245         .mod_params = &iwlagn_mod_params,
1246         .valid_tx_ant = ANT_ABC,
1247         .valid_rx_ant = ANT_ABC,
1248         .pll_cfg_val = 0,
1249         .set_l0s = true,
1250         .use_bsm = false,
1251         .pa_type = IWL_PA_SYSTEM,
1252         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1253         .shadow_ram_support = true,
1254         .ht_greenfield_support = true,
1255         .led_compensation = 51,
1256         .use_rts_for_aggregation = true, /* use rts/cts protection */
1257         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1258         .supports_idle = true,
1259         .adv_thermal_throttle = true,
1260         .support_ct_kill_exit = true,
1261         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1262         .chain_noise_scale = 1000,
1263         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1264         .max_event_log_size = 1024,
1265         .ucode_tracing = true,
1266         .sensitivity_calib_by_driver = true,
1267         .chain_noise_calib_by_driver = true,
1268 };
1269
1270 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
1271 MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
1272 MODULE_FIRMWARE(IWL6000G2A_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
1273 MODULE_FIRMWARE(IWL6000G2B_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));