iwlwifi: add bt_init_traffic_load as configurable parameter
[linux-2.6.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 const __le32 iwl6000g2b_concurrent_lookup[12] = {
205         cpu_to_le32(0xaaaaaaaa),
206         cpu_to_le32(0xaaaaaaaa),
207         cpu_to_le32(0xaaaaaaaa),
208         cpu_to_le32(0xaaaaaaaa),
209         cpu_to_le32(0xaaaaaaaa),
210         cpu_to_le32(0xaaaaaaaa),
211         cpu_to_le32(0xaaaaaaaa),
212         cpu_to_le32(0xaaaaaaaa),
213         cpu_to_le32(0x00000000),
214         cpu_to_le32(0x00000000),
215         cpu_to_le32(0x00000000),
216         cpu_to_le32(0x00000000),
217 };
218
219 static void iwl6000g2b_send_bt_config(struct iwl_priv *priv)
220 {
221         struct iwl6000g2b_bt_cmd bt_cmd = {
222                 .prio_boost = IWL6000G2B_BT_PRIO_BOOST_DEFAULT,
223                 .max_kill = IWL6000G2B_BT_MAX_KILL_DEFAULT,
224                 .bt3_timer_t7_value = IWL6000G2B_BT3_T7_DEFAULT,
225                 .kill_ack_mask = IWL6000G2B_BT_KILL_ACK_MASK_DEFAULT,
226                 .kill_cts_mask = IWL6000G2B_BT_KILL_CTS_MASK_DEFAULT,
227                 .bt3_prio_sample_time = IWL6000G2B_BT3_PRIO_SAMPLE_DEFAULT,
228                 .bt3_timer_t2_value = IWL6000G2B_BT3_T2_DEFAULT,
229                 .valid = IWL6000G2B_BT_VALID_ENABLE_FLAGS,
230         };
231
232         BUILD_BUG_ON(sizeof(iwl6000g2b_def_3w_lookup) !=
233                         sizeof(bt_cmd.bt3_lookup_table));
234
235         /*
236          * Configure BT coex mode to "no coexistence" when the
237          * user disabled BT coexistence, we have no interface
238          * user disabled BT coexistence, or the interface is in
239          * IBSS mode (no proper uCode support for coex then).
240          */
241         if (!bt_coex_active || priv->iw_mode == NL80211_IFTYPE_ADHOC) {
242                 bt_cmd.flags = 0;
243         } else {
244                 bt_cmd.flags = IWL6000G2B_BT_FLAG_CHANNEL_INHIBITION |
245                                 IWL6000G2B_BT_FLAG_COEX_MODE_3W <<
246                                         IWL6000G2B_BT_FLAG_COEX_MODE_SHIFT;
247                 bt_cmd.valid |= IWL6000G2B_BT_ALL_VALID_MSK;
248         }
249
250         if (priv->bt_full_concurrent)
251                 memcpy(bt_cmd.bt3_lookup_table, iwl6000g2b_concurrent_lookup,
252                         sizeof(iwl6000g2b_concurrent_lookup));
253         else
254                 memcpy(bt_cmd.bt3_lookup_table, iwl6000g2b_def_3w_lookup,
255                         sizeof(iwl6000g2b_def_3w_lookup));
256
257         IWL_DEBUG_INFO(priv, "BT coex %s in %s mode\n",
258                        bt_cmd.flags ? "active" : "disabled",
259                        priv->bt_full_concurrent ?
260                        "full concurrency" : "3-wire");
261
262         if (iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, sizeof(bt_cmd), &bt_cmd))
263                 IWL_ERR(priv, "failed to send BT Coex Config\n");
264
265         /*
266          * When we are doing a restart, need to also reconfigure BT
267          * SCO to the device. If not doing a restart, bt_sco_active
268          * will always be false, so there's no need to have an extra
269          * variable to check for it.
270          */
271         if (priv->bt_sco_active) {
272                 struct iwl6000g2b_bt_sco_cmd sco_cmd = { .flags = 0 };
273
274                 if (priv->bt_sco_active)
275                         sco_cmd.flags |= IWL6000G2B_BT_SCO_ACTIVE;
276                 if (iwl_send_cmd_pdu(priv, REPLY_BT_COEX_SCO,
277                                      sizeof(sco_cmd), &sco_cmd))
278                         IWL_ERR(priv, "failed to send BT SCO command\n");
279         }
280 }
281
282 static struct iwl_sensitivity_ranges iwl6000_sensitivity = {
283         .min_nrg_cck = 97,
284         .max_nrg_cck = 0, /* not used, set to 0 */
285         .auto_corr_min_ofdm = 80,
286         .auto_corr_min_ofdm_mrc = 128,
287         .auto_corr_min_ofdm_x1 = 105,
288         .auto_corr_min_ofdm_mrc_x1 = 192,
289
290         .auto_corr_max_ofdm = 145,
291         .auto_corr_max_ofdm_mrc = 232,
292         .auto_corr_max_ofdm_x1 = 110,
293         .auto_corr_max_ofdm_mrc_x1 = 232,
294
295         .auto_corr_min_cck = 125,
296         .auto_corr_max_cck = 175,
297         .auto_corr_min_cck_mrc = 160,
298         .auto_corr_max_cck_mrc = 310,
299         .nrg_th_cck = 97,
300         .nrg_th_ofdm = 100,
301
302         .barker_corr_th_min = 190,
303         .barker_corr_th_min_mrc = 390,
304         .nrg_th_cca = 62,
305 };
306
307 static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
308 {
309         if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
310             priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES)
311                 priv->cfg->num_of_queues =
312                         priv->cfg->mod_params->num_of_queues;
313
314         priv->hw_params.max_txq_num = priv->cfg->num_of_queues;
315         priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
316         priv->hw_params.scd_bc_tbls_size =
317                         priv->cfg->num_of_queues *
318                         sizeof(struct iwlagn_scd_bc_tbl);
319         priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
320         priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
321         priv->hw_params.bcast_sta_id = IWLAGN_BROADCAST_ID;
322
323         priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
324         priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
325
326         priv->hw_params.max_bsm_size = 0;
327         priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
328                                         BIT(IEEE80211_BAND_5GHZ);
329         priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
330
331         priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
332         priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
333         priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
334         priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
335
336         if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
337                 priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
338
339         /* Set initial sensitivity parameters */
340         /* Set initial calibration set */
341         priv->hw_params.sens = &iwl6000_sensitivity;
342         priv->hw_params.calib_init_cfg =
343                 BIT(IWL_CALIB_XTAL)             |
344                 BIT(IWL_CALIB_LO)               |
345                 BIT(IWL_CALIB_TX_IQ)            |
346                 BIT(IWL_CALIB_BASE_BAND);
347         if (priv->cfg->need_dc_calib)
348                 priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_DC);
349
350         priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
351
352         return 0;
353 }
354
355 static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
356                                      struct ieee80211_channel_switch *ch_switch)
357 {
358         struct iwl6000_channel_switch_cmd cmd;
359         const struct iwl_channel_info *ch_info;
360         u32 switch_time_in_usec, ucode_switch_time;
361         u16 ch;
362         u32 tsf_low;
363         u8 switch_count;
364         u16 beacon_interval = le16_to_cpu(priv->rxon_timing.beacon_interval);
365         struct ieee80211_vif *vif = priv->vif;
366         struct iwl_host_cmd hcmd = {
367                 .id = REPLY_CHANNEL_SWITCH,
368                 .len = sizeof(cmd),
369                 .flags = CMD_SYNC,
370                 .data = &cmd,
371         };
372
373         cmd.band = priv->band == IEEE80211_BAND_2GHZ;
374         ch = ch_switch->channel->hw_value;
375         IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
376                       priv->active_rxon.channel, ch);
377         cmd.channel = cpu_to_le16(ch);
378         cmd.rxon_flags = priv->staging_rxon.flags;
379         cmd.rxon_filter_flags = priv->staging_rxon.filter_flags;
380         switch_count = ch_switch->count;
381         tsf_low = ch_switch->timestamp & 0x0ffffffff;
382         /*
383          * calculate the ucode channel switch time
384          * adding TSF as one of the factor for when to switch
385          */
386         if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) {
387                 if (switch_count > ((priv->ucode_beacon_time - tsf_low) /
388                     beacon_interval)) {
389                         switch_count -= (priv->ucode_beacon_time -
390                                 tsf_low) / beacon_interval;
391                 } else
392                         switch_count = 0;
393         }
394         if (switch_count <= 1)
395                 cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
396         else {
397                 switch_time_in_usec =
398                         vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
399                 ucode_switch_time = iwl_usecs_to_beacons(priv,
400                                                          switch_time_in_usec,
401                                                          beacon_interval);
402                 cmd.switch_time = iwl_add_beacon_time(priv,
403                                                       priv->ucode_beacon_time,
404                                                       ucode_switch_time,
405                                                       beacon_interval);
406         }
407         IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
408                       cmd.switch_time);
409         ch_info = iwl_get_channel_info(priv, priv->band, ch);
410         if (ch_info)
411                 cmd.expect_beacon = is_channel_radar(ch_info);
412         else {
413                 IWL_ERR(priv, "invalid channel switch from %u to %u\n",
414                         priv->active_rxon.channel, ch);
415                 return -EFAULT;
416         }
417         priv->switch_rxon.channel = cmd.channel;
418         priv->switch_rxon.switch_in_progress = true;
419
420         return iwl_send_cmd_sync(priv, &hcmd);
421 }
422
423 static void iwl6000g2b_bt_traffic_change_work(struct work_struct *work)
424 {
425         struct iwl_priv *priv =
426                 container_of(work, struct iwl_priv, bt_traffic_change_work);
427         int smps_request = -1;
428
429         switch (priv->bt_traffic_load) {
430         case IWL_BT_COEX_TRAFFIC_LOAD_NONE:
431                 smps_request = IEEE80211_SMPS_AUTOMATIC;
432                 break;
433         case IWL_BT_COEX_TRAFFIC_LOAD_LOW:
434                 smps_request = IEEE80211_SMPS_DYNAMIC;
435                 break;
436         case IWL_BT_COEX_TRAFFIC_LOAD_HIGH:
437         case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
438                 smps_request = IEEE80211_SMPS_STATIC;
439                 break;
440         default:
441                 IWL_ERR(priv, "Invalid BT traffic load: %d\n",
442                         priv->bt_traffic_load);
443                 break;
444         }
445
446         mutex_lock(&priv->mutex);
447
448         if (smps_request != -1 &&
449             priv->vif && priv->vif->type == NL80211_IFTYPE_STATION)
450                 ieee80211_request_smps(priv->vif, smps_request);
451
452         mutex_unlock(&priv->mutex);
453 }
454
455 static void iwl6000g2b_bt_coex_profile_notif(struct iwl_priv *priv,
456                                              struct iwl_rx_mem_buffer *rxb)
457 {
458         unsigned long flags;
459         struct iwl_rx_packet *pkt = rxb_addr(rxb);
460         struct iwl_bt_coex_profile_notif *coex = &pkt->u.bt_coex_profile_notif;
461         struct iwl6000g2b_bt_sco_cmd sco_cmd = { .flags = 0 };
462
463         IWL_DEBUG_NOTIF(priv, "BT Coex notification:\n");
464         IWL_DEBUG_NOTIF(priv, "    status: %d\n", coex->bt_status);
465         IWL_DEBUG_NOTIF(priv, "    traffic load: %d\n", coex->bt_traffic_load);
466         IWL_DEBUG_NOTIF(priv, "    CI compliance: %d\n", coex->bt_ci_compliance);
467         IWL_DEBUG_NOTIF(priv, "    UART msg: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x:"
468                               "%.2x:%.2x\n",
469                         coex->uart_msg[0], coex->uart_msg[1], coex->uart_msg[2],
470                         coex->uart_msg[3], coex->uart_msg[4], coex->uart_msg[5],
471                         coex->uart_msg[6], coex->uart_msg[7]);
472
473         priv->notif_bt_traffic_load = coex->bt_traffic_load;
474
475         if (priv->iw_mode != NL80211_IFTYPE_ADHOC) {
476                 if (coex->bt_traffic_load != priv->bt_traffic_load) {
477                         priv->bt_traffic_load = coex->bt_traffic_load;
478
479                         queue_work(priv->workqueue,
480                                    &priv->bt_traffic_change_work);
481                 }
482
483                 /* FIXME: add defines for this check */
484                 priv->bt_sco_active = coex->uart_msg[3] & 1;
485                 if (priv->bt_sco_active)
486                         sco_cmd.flags |= IWL6000G2B_BT_SCO_ACTIVE;
487                 iwl_send_cmd_pdu_async(priv, REPLY_BT_COEX_SCO,
488                                        sizeof(sco_cmd), &sco_cmd, NULL);
489         }
490
491         spin_lock_irqsave(&priv->lock, flags);
492         priv->bt_ci_compliance = coex->bt_ci_compliance;
493         spin_unlock_irqrestore(&priv->lock, flags);
494 }
495
496 void iwl6000g2b_rx_handler_setup(struct iwl_priv *priv)
497 {
498         iwlagn_rx_handler_setup(priv);
499         priv->rx_handlers[REPLY_BT_COEX_PROFILE_NOTIF] =
500                 iwl6000g2b_bt_coex_profile_notif;
501 }
502
503 static void iwl6000g2b_bt_setup_deferred_work(struct iwl_priv *priv)
504 {
505         iwlagn_setup_deferred_work(priv);
506
507         INIT_WORK(&priv->bt_traffic_change_work,
508                   iwl6000g2b_bt_traffic_change_work);
509
510 }
511
512 static void iwl6000g2b_bt_cancel_deferred_work(struct iwl_priv *priv)
513 {
514         cancel_work_sync(&priv->bt_traffic_change_work);
515 }
516
517 static struct iwl_lib_ops iwl6000_lib = {
518         .set_hw_params = iwl6000_hw_set_hw_params,
519         .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
520         .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
521         .txq_set_sched = iwlagn_txq_set_sched,
522         .txq_agg_enable = iwlagn_txq_agg_enable,
523         .txq_agg_disable = iwlagn_txq_agg_disable,
524         .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
525         .txq_free_tfd = iwl_hw_txq_free_tfd,
526         .txq_init = iwl_hw_tx_queue_init,
527         .rx_handler_setup = iwlagn_rx_handler_setup,
528         .setup_deferred_work = iwlagn_setup_deferred_work,
529         .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
530         .load_ucode = iwlagn_load_ucode,
531         .dump_nic_event_log = iwl_dump_nic_event_log,
532         .dump_nic_error_log = iwl_dump_nic_error_log,
533         .dump_csr = iwl_dump_csr,
534         .dump_fh = iwl_dump_fh,
535         .init_alive_start = iwlagn_init_alive_start,
536         .alive_notify = iwlagn_alive_notify,
537         .send_tx_power = iwlagn_send_tx_power,
538         .update_chain_flags = iwl_update_chain_flags,
539         .set_channel_switch = iwl6000_hw_channel_switch,
540         .apm_ops = {
541                 .init = iwl_apm_init,
542                 .stop = iwl_apm_stop,
543                 .config = iwl6000_nic_config,
544                 .set_pwr_src = iwl_set_pwr_src,
545         },
546         .eeprom_ops = {
547                 .regulatory_bands = {
548                         EEPROM_REG_BAND_1_CHANNELS,
549                         EEPROM_REG_BAND_2_CHANNELS,
550                         EEPROM_REG_BAND_3_CHANNELS,
551                         EEPROM_REG_BAND_4_CHANNELS,
552                         EEPROM_REG_BAND_5_CHANNELS,
553                         EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
554                         EEPROM_REG_BAND_52_HT40_CHANNELS
555                 },
556                 .verify_signature  = iwlcore_eeprom_verify_signature,
557                 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
558                 .release_semaphore = iwlcore_eeprom_release_semaphore,
559                 .calib_version  = iwlagn_eeprom_calib_version,
560                 .query_addr = iwlagn_eeprom_query_addr,
561                 .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
562         },
563         .post_associate = iwl_post_associate,
564         .isr = iwl_isr_ict,
565         .config_ap = iwl_config_ap,
566         .temp_ops = {
567                 .temperature = iwlagn_temperature,
568                 .set_ct_kill = iwl6000_set_ct_threshold,
569                 .set_calib_version = iwl6000_set_calib_version,
570          },
571         .manage_ibss_station = iwlagn_manage_ibss_station,
572         .update_bcast_station = iwl_update_bcast_station,
573         .debugfs_ops = {
574                 .rx_stats_read = iwl_ucode_rx_stats_read,
575                 .tx_stats_read = iwl_ucode_tx_stats_read,
576                 .general_stats_read = iwl_ucode_general_stats_read,
577                 .bt_stats_read = iwl_ucode_bt_stats_read,
578         },
579         .recover_from_tx_stall = iwl_bg_monitor_recover,
580         .check_plcp_health = iwl_good_plcp_health,
581         .check_ack_health = iwl_good_ack_health,
582         .txfifo_flush = iwlagn_txfifo_flush,
583         .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
584         .tt_ops = {
585                 .lower_power_detection = iwl_tt_is_low_power_state,
586                 .tt_power_mode = iwl_tt_current_power_mode,
587                 .ct_kill_check = iwl_check_for_ct_kill,
588         }
589 };
590
591 static struct iwl_lib_ops iwl6000g2b_lib = {
592         .set_hw_params = iwl6000_hw_set_hw_params,
593         .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
594         .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
595         .txq_set_sched = iwlagn_txq_set_sched,
596         .txq_agg_enable = iwlagn_txq_agg_enable,
597         .txq_agg_disable = iwlagn_txq_agg_disable,
598         .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
599         .txq_free_tfd = iwl_hw_txq_free_tfd,
600         .txq_init = iwl_hw_tx_queue_init,
601         .rx_handler_setup = iwl6000g2b_rx_handler_setup,
602         .setup_deferred_work = iwl6000g2b_bt_setup_deferred_work,
603         .cancel_deferred_work = iwl6000g2b_bt_cancel_deferred_work,
604         .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
605         .load_ucode = iwlagn_load_ucode,
606         .dump_nic_event_log = iwl_dump_nic_event_log,
607         .dump_nic_error_log = iwl_dump_nic_error_log,
608         .dump_csr = iwl_dump_csr,
609         .dump_fh = iwl_dump_fh,
610         .init_alive_start = iwlagn_init_alive_start,
611         .alive_notify = iwlagn_alive_notify,
612         .send_tx_power = iwlagn_send_tx_power,
613         .update_chain_flags = iwl_update_chain_flags,
614         .set_channel_switch = iwl6000_hw_channel_switch,
615         .apm_ops = {
616                 .init = iwl_apm_init,
617                 .stop = iwl_apm_stop,
618                 .config = iwl6000_nic_config,
619                 .set_pwr_src = iwl_set_pwr_src,
620         },
621         .eeprom_ops = {
622                 .regulatory_bands = {
623                         EEPROM_REG_BAND_1_CHANNELS,
624                         EEPROM_REG_BAND_2_CHANNELS,
625                         EEPROM_REG_BAND_3_CHANNELS,
626                         EEPROM_REG_BAND_4_CHANNELS,
627                         EEPROM_REG_BAND_5_CHANNELS,
628                         EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
629                         EEPROM_REG_BAND_52_HT40_CHANNELS
630                 },
631                 .verify_signature  = iwlcore_eeprom_verify_signature,
632                 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
633                 .release_semaphore = iwlcore_eeprom_release_semaphore,
634                 .calib_version  = iwlagn_eeprom_calib_version,
635                 .query_addr = iwlagn_eeprom_query_addr,
636                 .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
637         },
638         .post_associate = iwl_post_associate,
639         .isr = iwl_isr_ict,
640         .config_ap = iwl_config_ap,
641         .temp_ops = {
642                 .temperature = iwlagn_temperature,
643                 .set_ct_kill = iwl6000_set_ct_threshold,
644                 .set_calib_version = iwl6000_set_calib_version,
645          },
646         .manage_ibss_station = iwlagn_manage_ibss_station,
647         .update_bcast_station = iwl_update_bcast_station,
648         .debugfs_ops = {
649                 .rx_stats_read = iwl_ucode_rx_stats_read,
650                 .tx_stats_read = iwl_ucode_tx_stats_read,
651                 .general_stats_read = iwl_ucode_general_stats_read,
652                 .bt_stats_read = iwl_ucode_bt_stats_read,
653         },
654         .recover_from_tx_stall = iwl_bg_monitor_recover,
655         .check_plcp_health = iwl_good_plcp_health,
656         .check_ack_health = iwl_good_ack_health,
657         .txfifo_flush = iwlagn_txfifo_flush,
658         .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
659         .tt_ops = {
660                 .lower_power_detection = iwl_tt_is_low_power_state,
661                 .tt_power_mode = iwl_tt_current_power_mode,
662                 .ct_kill_check = iwl_check_for_ct_kill,
663         }
664 };
665
666 static const struct iwl_ops iwl6000_ops = {
667         .lib = &iwl6000_lib,
668         .hcmd = &iwlagn_hcmd,
669         .utils = &iwlagn_hcmd_utils,
670         .led = &iwlagn_led_ops,
671 };
672
673 static struct iwl_hcmd_ops iwl6000g2b_hcmd = {
674         .rxon_assoc = iwlagn_send_rxon_assoc,
675         .commit_rxon = iwl_commit_rxon,
676         .set_rxon_chain = iwl_set_rxon_chain,
677         .set_tx_ant = iwlagn_send_tx_ant_config,
678         .send_bt_config = iwl6000g2b_send_bt_config,
679 };
680
681 static const struct iwl_ops iwl6000g2b_ops = {
682         .lib = &iwl6000g2b_lib,
683         .hcmd = &iwl6000g2b_hcmd,
684         .utils = &iwlagn_hcmd_utils,
685         .led = &iwlagn_led_ops,
686 };
687
688 struct iwl_cfg iwl6000g2a_2agn_cfg = {
689         .name = "6000 Series 2x2 AGN Gen2a",
690         .fw_name_pre = IWL6000G2A_FW_PRE,
691         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
692         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
693         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
694         .ops = &iwl6000_ops,
695         .eeprom_size = OTP_LOW_IMAGE_SIZE,
696         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
697         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
698         .num_of_queues = IWLAGN_NUM_QUEUES,
699         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
700         .mod_params = &iwlagn_mod_params,
701         .valid_tx_ant = ANT_AB,
702         .valid_rx_ant = ANT_AB,
703         .pll_cfg_val = 0,
704         .set_l0s = true,
705         .use_bsm = false,
706         .pa_type = IWL_PA_SYSTEM,
707         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
708         .shadow_ram_support = true,
709         .ht_greenfield_support = true,
710         .led_compensation = 51,
711         .use_rts_for_aggregation = true, /* use rts/cts protection */
712         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
713         .supports_idle = true,
714         .adv_thermal_throttle = true,
715         .support_ct_kill_exit = true,
716         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
717         .chain_noise_scale = 1000,
718         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
719         .max_event_log_size = 512,
720         .ucode_tracing = true,
721         .sensitivity_calib_by_driver = true,
722         .chain_noise_calib_by_driver = true,
723         .need_dc_calib = true,
724 };
725
726 struct iwl_cfg iwl6000g2a_2abg_cfg = {
727         .name = "6000 Series 2x2 ABG Gen2a",
728         .fw_name_pre = IWL6000G2A_FW_PRE,
729         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
730         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
731         .sku = IWL_SKU_A|IWL_SKU_G,
732         .ops = &iwl6000_ops,
733         .eeprom_size = OTP_LOW_IMAGE_SIZE,
734         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
735         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
736         .num_of_queues = IWLAGN_NUM_QUEUES,
737         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
738         .mod_params = &iwlagn_mod_params,
739         .valid_tx_ant = ANT_AB,
740         .valid_rx_ant = ANT_AB,
741         .pll_cfg_val = 0,
742         .set_l0s = true,
743         .use_bsm = false,
744         .pa_type = IWL_PA_SYSTEM,
745         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
746         .shadow_ram_support = true,
747         .led_compensation = 51,
748         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
749         .supports_idle = true,
750         .adv_thermal_throttle = true,
751         .support_ct_kill_exit = true,
752         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
753         .chain_noise_scale = 1000,
754         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
755         .max_event_log_size = 512,
756         .sensitivity_calib_by_driver = true,
757         .chain_noise_calib_by_driver = true,
758         .need_dc_calib = true,
759 };
760
761 struct iwl_cfg iwl6000g2a_2bg_cfg = {
762         .name = "6000 Series 2x2 BG Gen2a",
763         .fw_name_pre = IWL6000G2A_FW_PRE,
764         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
765         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
766         .sku = IWL_SKU_G,
767         .ops = &iwl6000_ops,
768         .eeprom_size = OTP_LOW_IMAGE_SIZE,
769         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
770         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
771         .num_of_queues = IWLAGN_NUM_QUEUES,
772         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
773         .mod_params = &iwlagn_mod_params,
774         .valid_tx_ant = ANT_AB,
775         .valid_rx_ant = ANT_AB,
776         .pll_cfg_val = 0,
777         .set_l0s = true,
778         .use_bsm = false,
779         .pa_type = IWL_PA_SYSTEM,
780         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
781         .shadow_ram_support = true,
782         .led_compensation = 51,
783         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
784         .supports_idle = true,
785         .adv_thermal_throttle = true,
786         .support_ct_kill_exit = true,
787         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
788         .chain_noise_scale = 1000,
789         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
790         .max_event_log_size = 512,
791         .sensitivity_calib_by_driver = true,
792         .chain_noise_calib_by_driver = true,
793         .need_dc_calib = true,
794 };
795
796 struct iwl_cfg iwl6000g2b_2agn_cfg = {
797         .name = "6000 Series 2x2 AGN Gen2b",
798         .fw_name_pre = IWL6000G2B_FW_PRE,
799         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
800         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
801         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
802         .ops = &iwl6000g2b_ops,
803         .eeprom_size = OTP_LOW_IMAGE_SIZE,
804         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
805         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
806         .num_of_queues = IWLAGN_NUM_QUEUES,
807         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
808         .mod_params = &iwlagn_mod_params,
809         .valid_tx_ant = ANT_AB,
810         .valid_rx_ant = ANT_AB,
811         .pll_cfg_val = 0,
812         .set_l0s = true,
813         .use_bsm = false,
814         .pa_type = IWL_PA_SYSTEM,
815         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
816         .shadow_ram_support = true,
817         .ht_greenfield_support = true,
818         .led_compensation = 51,
819         .use_rts_for_aggregation = true, /* use rts/cts protection */
820         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
821         .supports_idle = true,
822         .adv_thermal_throttle = true,
823         .support_ct_kill_exit = true,
824         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
825         .chain_noise_scale = 1000,
826         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
827         .max_event_log_size = 512,
828         .sensitivity_calib_by_driver = true,
829         .chain_noise_calib_by_driver = true,
830         .need_dc_calib = true,
831         .bt_statistics = true,
832         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
833         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
834         .advanced_bt_coexist = true,
835         .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
836 };
837
838 struct iwl_cfg iwl6000g2b_2abg_cfg = {
839         .name = "6000 Series 2x2 ABG Gen2b",
840         .fw_name_pre = IWL6000G2B_FW_PRE,
841         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
842         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
843         .sku = IWL_SKU_A|IWL_SKU_G,
844         .ops = &iwl6000g2b_ops,
845         .eeprom_size = OTP_LOW_IMAGE_SIZE,
846         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
847         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
848         .num_of_queues = IWLAGN_NUM_QUEUES,
849         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
850         .mod_params = &iwlagn_mod_params,
851         .valid_tx_ant = ANT_AB,
852         .valid_rx_ant = ANT_AB,
853         .pll_cfg_val = 0,
854         .set_l0s = true,
855         .use_bsm = false,
856         .pa_type = IWL_PA_SYSTEM,
857         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
858         .shadow_ram_support = true,
859         .led_compensation = 51,
860         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
861         .supports_idle = true,
862         .adv_thermal_throttle = true,
863         .support_ct_kill_exit = true,
864         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
865         .chain_noise_scale = 1000,
866         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
867         .max_event_log_size = 512,
868         .sensitivity_calib_by_driver = true,
869         .chain_noise_calib_by_driver = true,
870         .need_dc_calib = true,
871         .bt_statistics = true,
872         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
873         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
874         .advanced_bt_coexist = true,
875         .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
876 };
877
878 struct iwl_cfg iwl6000g2b_2bgn_cfg = {
879         .name = "6000 Series 2x2 BGN Gen2b",
880         .fw_name_pre = IWL6000G2B_FW_PRE,
881         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
882         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
883         .sku = IWL_SKU_G|IWL_SKU_N,
884         .ops = &iwl6000g2b_ops,
885         .eeprom_size = OTP_LOW_IMAGE_SIZE,
886         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
887         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
888         .num_of_queues = IWLAGN_NUM_QUEUES,
889         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
890         .mod_params = &iwlagn_mod_params,
891         .valid_tx_ant = ANT_AB,
892         .valid_rx_ant = ANT_AB,
893         .pll_cfg_val = 0,
894         .set_l0s = true,
895         .use_bsm = false,
896         .pa_type = IWL_PA_SYSTEM,
897         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
898         .shadow_ram_support = true,
899         .ht_greenfield_support = true,
900         .led_compensation = 51,
901         .use_rts_for_aggregation = true, /* use rts/cts protection */
902         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
903         .supports_idle = true,
904         .adv_thermal_throttle = true,
905         .support_ct_kill_exit = true,
906         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
907         .chain_noise_scale = 1000,
908         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
909         .max_event_log_size = 512,
910         .sensitivity_calib_by_driver = true,
911         .chain_noise_calib_by_driver = true,
912         .need_dc_calib = true,
913         .bt_statistics = true,
914         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
915         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
916         .advanced_bt_coexist = true,
917         .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
918 };
919
920 struct iwl_cfg iwl6000g2b_2bg_cfg = {
921         .name = "6000 Series 2x2 BG Gen2b",
922         .fw_name_pre = IWL6000G2B_FW_PRE,
923         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
924         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
925         .sku = IWL_SKU_G,
926         .ops = &iwl6000g2b_ops,
927         .eeprom_size = OTP_LOW_IMAGE_SIZE,
928         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
929         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
930         .num_of_queues = IWLAGN_NUM_QUEUES,
931         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
932         .mod_params = &iwlagn_mod_params,
933         .valid_tx_ant = ANT_AB,
934         .valid_rx_ant = ANT_AB,
935         .pll_cfg_val = 0,
936         .set_l0s = true,
937         .use_bsm = false,
938         .pa_type = IWL_PA_SYSTEM,
939         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
940         .shadow_ram_support = true,
941         .led_compensation = 51,
942         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
943         .supports_idle = true,
944         .adv_thermal_throttle = true,
945         .support_ct_kill_exit = true,
946         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
947         .chain_noise_scale = 1000,
948         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
949         .max_event_log_size = 512,
950         .sensitivity_calib_by_driver = true,
951         .chain_noise_calib_by_driver = true,
952         .need_dc_calib = true,
953         .bt_statistics = true,
954         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
955         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
956         .advanced_bt_coexist = true,
957         .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
958 };
959
960 struct iwl_cfg iwl6000g2b_bgn_cfg = {
961         .name = "6000 Series 1x2 BGN Gen2b",
962         .fw_name_pre = IWL6000G2B_FW_PRE,
963         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
964         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
965         .sku = IWL_SKU_G|IWL_SKU_N,
966         .ops = &iwl6000g2b_ops,
967         .eeprom_size = OTP_LOW_IMAGE_SIZE,
968         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
969         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
970         .num_of_queues = IWLAGN_NUM_QUEUES,
971         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
972         .mod_params = &iwlagn_mod_params,
973         .valid_tx_ant = ANT_A,
974         .valid_rx_ant = ANT_AB,
975         .pll_cfg_val = 0,
976         .set_l0s = true,
977         .use_bsm = false,
978         .pa_type = IWL_PA_SYSTEM,
979         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
980         .shadow_ram_support = true,
981         .ht_greenfield_support = true,
982         .led_compensation = 51,
983         .use_rts_for_aggregation = true, /* use rts/cts protection */
984         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
985         .supports_idle = true,
986         .adv_thermal_throttle = true,
987         .support_ct_kill_exit = true,
988         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
989         .chain_noise_scale = 1000,
990         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
991         .max_event_log_size = 512,
992         .sensitivity_calib_by_driver = true,
993         .chain_noise_calib_by_driver = true,
994         .need_dc_calib = true,
995         .bt_statistics = true,
996         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
997         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
998         .advanced_bt_coexist = true,
999         .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
1000 };
1001
1002 struct iwl_cfg iwl6000g2b_bg_cfg = {
1003         .name = "6000 Series 1x2 BG Gen2b",
1004         .fw_name_pre = IWL6000G2B_FW_PRE,
1005         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
1006         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
1007         .sku = IWL_SKU_G,
1008         .ops = &iwl6000g2b_ops,
1009         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1010         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
1011         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
1012         .num_of_queues = IWLAGN_NUM_QUEUES,
1013         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1014         .mod_params = &iwlagn_mod_params,
1015         .valid_tx_ant = ANT_A,
1016         .valid_rx_ant = ANT_AB,
1017         .pll_cfg_val = 0,
1018         .set_l0s = true,
1019         .use_bsm = false,
1020         .pa_type = IWL_PA_SYSTEM,
1021         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1022         .shadow_ram_support = true,
1023         .led_compensation = 51,
1024         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1025         .supports_idle = true,
1026         .adv_thermal_throttle = true,
1027         .support_ct_kill_exit = true,
1028         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE,
1029         .chain_noise_scale = 1000,
1030         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
1031         .max_event_log_size = 512,
1032         .sensitivity_calib_by_driver = true,
1033         .chain_noise_calib_by_driver = true,
1034         .need_dc_calib = true,
1035         .bt_statistics = true,
1036         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
1037         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
1038         .advanced_bt_coexist = true,
1039         .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
1040 };
1041
1042 /*
1043  * "i": Internal configuration, use internal Power Amplifier
1044  */
1045 struct iwl_cfg iwl6000i_2agn_cfg = {
1046         .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN",
1047         .fw_name_pre = IWL6000_FW_PRE,
1048         .ucode_api_max = IWL6000_UCODE_API_MAX,
1049         .ucode_api_min = IWL6000_UCODE_API_MIN,
1050         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
1051         .ops = &iwl6000_ops,
1052         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1053         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
1054         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
1055         .num_of_queues = IWLAGN_NUM_QUEUES,
1056         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1057         .mod_params = &iwlagn_mod_params,
1058         .valid_tx_ant = ANT_BC,
1059         .valid_rx_ant = ANT_BC,
1060         .pll_cfg_val = 0,
1061         .set_l0s = true,
1062         .use_bsm = false,
1063         .pa_type = IWL_PA_INTERNAL,
1064         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1065         .shadow_ram_support = true,
1066         .ht_greenfield_support = true,
1067         .led_compensation = 51,
1068         .use_rts_for_aggregation = true, /* use rts/cts protection */
1069         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1070         .supports_idle = true,
1071         .adv_thermal_throttle = true,
1072         .support_ct_kill_exit = true,
1073         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1074         .chain_noise_scale = 1000,
1075         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1076         .max_event_log_size = 1024,
1077         .ucode_tracing = true,
1078         .sensitivity_calib_by_driver = true,
1079         .chain_noise_calib_by_driver = true,
1080 };
1081
1082 struct iwl_cfg iwl6000i_2abg_cfg = {
1083         .name = "Intel(R) Centrino(R) Advanced-N 6200 ABG",
1084         .fw_name_pre = IWL6000_FW_PRE,
1085         .ucode_api_max = IWL6000_UCODE_API_MAX,
1086         .ucode_api_min = IWL6000_UCODE_API_MIN,
1087         .sku = IWL_SKU_A|IWL_SKU_G,
1088         .ops = &iwl6000_ops,
1089         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1090         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
1091         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
1092         .num_of_queues = IWLAGN_NUM_QUEUES,
1093         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1094         .mod_params = &iwlagn_mod_params,
1095         .valid_tx_ant = ANT_BC,
1096         .valid_rx_ant = ANT_BC,
1097         .pll_cfg_val = 0,
1098         .set_l0s = true,
1099         .use_bsm = false,
1100         .pa_type = IWL_PA_INTERNAL,
1101         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1102         .shadow_ram_support = true,
1103         .led_compensation = 51,
1104         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1105         .supports_idle = true,
1106         .adv_thermal_throttle = true,
1107         .support_ct_kill_exit = true,
1108         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1109         .chain_noise_scale = 1000,
1110         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1111         .max_event_log_size = 1024,
1112         .ucode_tracing = true,
1113         .sensitivity_calib_by_driver = true,
1114         .chain_noise_calib_by_driver = true,
1115 };
1116
1117 struct iwl_cfg iwl6000i_2bg_cfg = {
1118         .name = "Intel(R) Centrino(R) Advanced-N 6200 BG",
1119         .fw_name_pre = IWL6000_FW_PRE,
1120         .ucode_api_max = IWL6000_UCODE_API_MAX,
1121         .ucode_api_min = IWL6000_UCODE_API_MIN,
1122         .sku = IWL_SKU_G,
1123         .ops = &iwl6000_ops,
1124         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1125         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
1126         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
1127         .num_of_queues = IWLAGN_NUM_QUEUES,
1128         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1129         .mod_params = &iwlagn_mod_params,
1130         .valid_tx_ant = ANT_BC,
1131         .valid_rx_ant = ANT_BC,
1132         .pll_cfg_val = 0,
1133         .set_l0s = true,
1134         .use_bsm = false,
1135         .pa_type = IWL_PA_INTERNAL,
1136         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1137         .shadow_ram_support = true,
1138         .led_compensation = 51,
1139         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1140         .supports_idle = true,
1141         .adv_thermal_throttle = true,
1142         .support_ct_kill_exit = true,
1143         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1144         .chain_noise_scale = 1000,
1145         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1146         .max_event_log_size = 1024,
1147         .ucode_tracing = true,
1148         .sensitivity_calib_by_driver = true,
1149         .chain_noise_calib_by_driver = true,
1150 };
1151
1152 struct iwl_cfg iwl6050_2agn_cfg = {
1153         .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN",
1154         .fw_name_pre = IWL6050_FW_PRE,
1155         .ucode_api_max = IWL6050_UCODE_API_MAX,
1156         .ucode_api_min = IWL6050_UCODE_API_MIN,
1157         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
1158         .ops = &iwl6000_ops,
1159         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1160         .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
1161         .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
1162         .num_of_queues = IWLAGN_NUM_QUEUES,
1163         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1164         .mod_params = &iwlagn_mod_params,
1165         .valid_tx_ant = ANT_AB,
1166         .valid_rx_ant = ANT_AB,
1167         .pll_cfg_val = 0,
1168         .set_l0s = true,
1169         .use_bsm = false,
1170         .pa_type = IWL_PA_SYSTEM,
1171         .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
1172         .shadow_ram_support = true,
1173         .ht_greenfield_support = true,
1174         .led_compensation = 51,
1175         .use_rts_for_aggregation = true, /* use rts/cts protection */
1176         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1177         .supports_idle = true,
1178         .adv_thermal_throttle = true,
1179         .support_ct_kill_exit = true,
1180         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1181         .chain_noise_scale = 1500,
1182         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1183         .max_event_log_size = 1024,
1184         .ucode_tracing = true,
1185         .sensitivity_calib_by_driver = true,
1186         .chain_noise_calib_by_driver = true,
1187         .need_dc_calib = true,
1188 };
1189
1190 struct iwl_cfg iwl6050g2_bgn_cfg = {
1191         .name = "6050 Series 1x2 BGN Gen2",
1192         .fw_name_pre = IWL6050_FW_PRE,
1193         .ucode_api_max = IWL6050_UCODE_API_MAX,
1194         .ucode_api_min = IWL6050_UCODE_API_MIN,
1195         .sku = IWL_SKU_G|IWL_SKU_N,
1196         .ops = &iwl6000_ops,
1197         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1198         .eeprom_ver = EEPROM_6050G2_EEPROM_VERSION,
1199         .eeprom_calib_ver = EEPROM_6050G2_TX_POWER_VERSION,
1200         .num_of_queues = IWLAGN_NUM_QUEUES,
1201         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1202         .mod_params = &iwlagn_mod_params,
1203         .valid_tx_ant = ANT_A,
1204         .valid_rx_ant = ANT_AB,
1205         .pll_cfg_val = 0,
1206         .set_l0s = true,
1207         .use_bsm = false,
1208         .pa_type = IWL_PA_SYSTEM,
1209         .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
1210         .shadow_ram_support = true,
1211         .ht_greenfield_support = true,
1212         .led_compensation = 51,
1213         .use_rts_for_aggregation = true, /* use rts/cts protection */
1214         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1215         .supports_idle = true,
1216         .adv_thermal_throttle = true,
1217         .support_ct_kill_exit = true,
1218         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1219         .chain_noise_scale = 1500,
1220         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1221         .max_event_log_size = 1024,
1222         .ucode_tracing = true,
1223         .sensitivity_calib_by_driver = true,
1224         .chain_noise_calib_by_driver = true,
1225         .need_dc_calib = true,
1226 };
1227
1228 struct iwl_cfg iwl6050_2abg_cfg = {
1229         .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 ABG",
1230         .fw_name_pre = IWL6050_FW_PRE,
1231         .ucode_api_max = IWL6050_UCODE_API_MAX,
1232         .ucode_api_min = IWL6050_UCODE_API_MIN,
1233         .sku = IWL_SKU_A|IWL_SKU_G,
1234         .ops = &iwl6000_ops,
1235         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1236         .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
1237         .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
1238         .num_of_queues = IWLAGN_NUM_QUEUES,
1239         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1240         .mod_params = &iwlagn_mod_params,
1241         .valid_tx_ant = ANT_AB,
1242         .valid_rx_ant = ANT_AB,
1243         .pll_cfg_val = 0,
1244         .set_l0s = true,
1245         .use_bsm = false,
1246         .pa_type = IWL_PA_SYSTEM,
1247         .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
1248         .shadow_ram_support = true,
1249         .led_compensation = 51,
1250         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1251         .supports_idle = true,
1252         .adv_thermal_throttle = true,
1253         .support_ct_kill_exit = true,
1254         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1255         .chain_noise_scale = 1500,
1256         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1257         .max_event_log_size = 1024,
1258         .ucode_tracing = true,
1259         .sensitivity_calib_by_driver = true,
1260         .chain_noise_calib_by_driver = true,
1261         .need_dc_calib = true,
1262 };
1263
1264 struct iwl_cfg iwl6000_3agn_cfg = {
1265         .name = "Intel(R) Centrino(R) Ultimate-N 6300 AGN",
1266         .fw_name_pre = IWL6000_FW_PRE,
1267         .ucode_api_max = IWL6000_UCODE_API_MAX,
1268         .ucode_api_min = IWL6000_UCODE_API_MIN,
1269         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
1270         .ops = &iwl6000_ops,
1271         .eeprom_size = OTP_LOW_IMAGE_SIZE,
1272         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
1273         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
1274         .num_of_queues = IWLAGN_NUM_QUEUES,
1275         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
1276         .mod_params = &iwlagn_mod_params,
1277         .valid_tx_ant = ANT_ABC,
1278         .valid_rx_ant = ANT_ABC,
1279         .pll_cfg_val = 0,
1280         .set_l0s = true,
1281         .use_bsm = false,
1282         .pa_type = IWL_PA_SYSTEM,
1283         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1284         .shadow_ram_support = true,
1285         .ht_greenfield_support = true,
1286         .led_compensation = 51,
1287         .use_rts_for_aggregation = true, /* use rts/cts protection */
1288         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1289         .supports_idle = true,
1290         .adv_thermal_throttle = true,
1291         .support_ct_kill_exit = true,
1292         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
1293         .chain_noise_scale = 1000,
1294         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
1295         .max_event_log_size = 1024,
1296         .ucode_tracing = true,
1297         .sensitivity_calib_by_driver = true,
1298         .chain_noise_calib_by_driver = true,
1299 };
1300
1301 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
1302 MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
1303 MODULE_FIRMWARE(IWL6000G2A_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
1304 MODULE_FIRMWARE(IWL6000G2B_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));