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