Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[pandora-kernel.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 5
55 #define IWL6000G2_UCODE_API_MAX 5
56 #define IWL130_UCODE_API_MAX 5
57
58 /* Lowest firmware API version supported */
59 #define IWL6000_UCODE_API_MIN 4
60 #define IWL6050_UCODE_API_MIN 4
61 #define IWL6000G2_UCODE_API_MIN 4
62 #define IWL130_UCODE_API_MIN 5
63
64 #define IWL6000_FW_PRE "iwlwifi-6000-"
65 #define _IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE #api ".ucode"
66 #define IWL6000_MODULE_FIRMWARE(api) _IWL6000_MODULE_FIRMWARE(api)
67
68 #define IWL6050_FW_PRE "iwlwifi-6050-"
69 #define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode"
70 #define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api)
71
72 #define IWL6000G2A_FW_PRE "iwlwifi-6000g2a-"
73 #define _IWL6000G2A_MODULE_FIRMWARE(api) IWL6000G2A_FW_PRE #api ".ucode"
74 #define IWL6000G2A_MODULE_FIRMWARE(api) _IWL6000G2A_MODULE_FIRMWARE(api)
75
76 #define IWL6000G2B_FW_PRE "iwlwifi-6000g2b-"
77 #define _IWL6000G2B_MODULE_FIRMWARE(api) IWL6000G2B_FW_PRE #api ".ucode"
78 #define IWL6000G2B_MODULE_FIRMWARE(api) _IWL6000G2B_MODULE_FIRMWARE(api)
79
80 #define IWL130_FW_PRE "iwlwifi-130-"
81 #define _IWL130_MODULE_FIRMWARE(api) IWL130_FW_PRE #api ".ucode"
82 #define IWL130_MODULE_FIRMWARE(api) _IWL130_MODULE_FIRMWARE(api)
83
84 static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
85 {
86         /* want Celsius */
87         priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
88         priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
89 }
90
91 static void iwl6050_additional_nic_config(struct iwl_priv *priv)
92 {
93         /* Indicate calibration version to uCode. */
94         if (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6)
95                 iwl_set_bit(priv, CSR_GP_DRIVER_REG,
96                                 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
97 }
98
99 static void iwl6050g2_additional_nic_config(struct iwl_priv *priv)
100 {
101         /* Indicate calibration version to uCode. */
102         if (priv->cfg->ops->lib->eeprom_ops.calib_version(priv) >= 6)
103                 iwl_set_bit(priv, CSR_GP_DRIVER_REG,
104                                 CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6);
105         iwl_set_bit(priv, CSR_GP_DRIVER_REG,
106                     CSR_GP_DRIVER_REG_BIT_6050_1x2);
107 }
108
109 /* NIC configuration for 6000 series */
110 static void iwl6000_nic_config(struct iwl_priv *priv)
111 {
112         u16 radio_cfg;
113
114         radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
115
116         /* write radio config values to register */
117         if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX)
118                 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
119                             EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
120                             EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
121                             EEPROM_RF_CFG_DASH_MSK(radio_cfg));
122
123         /* set CSR_HW_CONFIG_REG for uCode use */
124         iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
125                     CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
126                     CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
127
128         /* no locking required for register write */
129         if (priv->cfg->pa_type == IWL_PA_INTERNAL) {
130                 /* 2x2 IPA phy type */
131                 iwl_write32(priv, CSR_GP_DRIVER_REG,
132                              CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA);
133         }
134         /* do additional nic configuration if needed */
135         if (priv->cfg->ops->nic &&
136                 priv->cfg->ops->nic->additional_nic_config) {
137                         priv->cfg->ops->nic->additional_nic_config(priv);
138         }
139 }
140
141 static struct iwl_sensitivity_ranges iwl6000_sensitivity = {
142         .min_nrg_cck = 97,
143         .max_nrg_cck = 0, /* not used, set to 0 */
144         .auto_corr_min_ofdm = 80,
145         .auto_corr_min_ofdm_mrc = 128,
146         .auto_corr_min_ofdm_x1 = 105,
147         .auto_corr_min_ofdm_mrc_x1 = 192,
148
149         .auto_corr_max_ofdm = 145,
150         .auto_corr_max_ofdm_mrc = 232,
151         .auto_corr_max_ofdm_x1 = 110,
152         .auto_corr_max_ofdm_mrc_x1 = 232,
153
154         .auto_corr_min_cck = 125,
155         .auto_corr_max_cck = 175,
156         .auto_corr_min_cck_mrc = 160,
157         .auto_corr_max_cck_mrc = 310,
158         .nrg_th_cck = 97,
159         .nrg_th_ofdm = 100,
160
161         .barker_corr_th_min = 190,
162         .barker_corr_th_min_mrc = 390,
163         .nrg_th_cca = 62,
164 };
165
166 static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
167 {
168         if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
169             priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES)
170                 priv->cfg->base_params->num_of_queues =
171                         priv->cfg->mod_params->num_of_queues;
172
173         priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues;
174         priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
175         priv->hw_params.scd_bc_tbls_size =
176                         priv->cfg->base_params->num_of_queues *
177                         sizeof(struct iwlagn_scd_bc_tbl);
178         priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
179         priv->hw_params.max_stations = IWLAGN_STATION_COUNT;
180         priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
181
182         priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
183         priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
184
185         priv->hw_params.max_bsm_size = 0;
186         priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
187                                         BIT(IEEE80211_BAND_5GHZ);
188         priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
189
190         priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
191         priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
192         priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
193         priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
194
195         if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
196                 priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
197
198         /* Set initial sensitivity parameters */
199         /* Set initial calibration set */
200         priv->hw_params.sens = &iwl6000_sensitivity;
201         priv->hw_params.calib_init_cfg =
202                 BIT(IWL_CALIB_XTAL)             |
203                 BIT(IWL_CALIB_LO)               |
204                 BIT(IWL_CALIB_TX_IQ)            |
205                 BIT(IWL_CALIB_BASE_BAND);
206         if (priv->cfg->need_dc_calib)
207                 priv->hw_params.calib_rt_cfg |= BIT(IWL_CALIB_CFG_DC_IDX);
208
209         priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
210
211         return 0;
212 }
213
214 static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
215                                      struct ieee80211_channel_switch *ch_switch)
216 {
217         /*
218          * MULTI-FIXME
219          * See iwl_mac_channel_switch.
220          */
221         struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
222         struct iwl6000_channel_switch_cmd cmd;
223         const struct iwl_channel_info *ch_info;
224         u32 switch_time_in_usec, ucode_switch_time;
225         u16 ch;
226         u32 tsf_low;
227         u8 switch_count;
228         u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
229         struct ieee80211_vif *vif = ctx->vif;
230         struct iwl_host_cmd hcmd = {
231                 .id = REPLY_CHANNEL_SWITCH,
232                 .len = sizeof(cmd),
233                 .flags = CMD_SYNC,
234                 .data = &cmd,
235         };
236
237         cmd.band = priv->band == IEEE80211_BAND_2GHZ;
238         ch = ch_switch->channel->hw_value;
239         IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
240                       ctx->active.channel, ch);
241         cmd.channel = cpu_to_le16(ch);
242         cmd.rxon_flags = ctx->staging.flags;
243         cmd.rxon_filter_flags = ctx->staging.filter_flags;
244         switch_count = ch_switch->count;
245         tsf_low = ch_switch->timestamp & 0x0ffffffff;
246         /*
247          * calculate the ucode channel switch time
248          * adding TSF as one of the factor for when to switch
249          */
250         if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) {
251                 if (switch_count > ((priv->ucode_beacon_time - tsf_low) /
252                     beacon_interval)) {
253                         switch_count -= (priv->ucode_beacon_time -
254                                 tsf_low) / beacon_interval;
255                 } else
256                         switch_count = 0;
257         }
258         if (switch_count <= 1)
259                 cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
260         else {
261                 switch_time_in_usec =
262                         vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
263                 ucode_switch_time = iwl_usecs_to_beacons(priv,
264                                                          switch_time_in_usec,
265                                                          beacon_interval);
266                 cmd.switch_time = iwl_add_beacon_time(priv,
267                                                       priv->ucode_beacon_time,
268                                                       ucode_switch_time,
269                                                       beacon_interval);
270         }
271         IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
272                       cmd.switch_time);
273         ch_info = iwl_get_channel_info(priv, priv->band, ch);
274         if (ch_info)
275                 cmd.expect_beacon = is_channel_radar(ch_info);
276         else {
277                 IWL_ERR(priv, "invalid channel switch from %u to %u\n",
278                         ctx->active.channel, ch);
279                 return -EFAULT;
280         }
281         priv->switch_rxon.channel = cmd.channel;
282         priv->switch_rxon.switch_in_progress = true;
283
284         return iwl_send_cmd_sync(priv, &hcmd);
285 }
286
287 static struct iwl_lib_ops iwl6000_lib = {
288         .set_hw_params = iwl6000_hw_set_hw_params,
289         .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
290         .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
291         .txq_set_sched = iwlagn_txq_set_sched,
292         .txq_agg_enable = iwlagn_txq_agg_enable,
293         .txq_agg_disable = iwlagn_txq_agg_disable,
294         .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
295         .txq_free_tfd = iwl_hw_txq_free_tfd,
296         .txq_init = iwl_hw_tx_queue_init,
297         .rx_handler_setup = iwlagn_rx_handler_setup,
298         .setup_deferred_work = iwlagn_setup_deferred_work,
299         .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
300         .load_ucode = iwlagn_load_ucode,
301         .dump_nic_event_log = iwl_dump_nic_event_log,
302         .dump_nic_error_log = iwl_dump_nic_error_log,
303         .dump_csr = iwl_dump_csr,
304         .dump_fh = iwl_dump_fh,
305         .init_alive_start = iwlagn_init_alive_start,
306         .alive_notify = iwlagn_alive_notify,
307         .send_tx_power = iwlagn_send_tx_power,
308         .update_chain_flags = iwl_update_chain_flags,
309         .set_channel_switch = iwl6000_hw_channel_switch,
310         .apm_ops = {
311                 .init = iwl_apm_init,
312                 .stop = iwl_apm_stop,
313                 .config = iwl6000_nic_config,
314                 .set_pwr_src = iwl_set_pwr_src,
315         },
316         .eeprom_ops = {
317                 .regulatory_bands = {
318                         EEPROM_REG_BAND_1_CHANNELS,
319                         EEPROM_REG_BAND_2_CHANNELS,
320                         EEPROM_REG_BAND_3_CHANNELS,
321                         EEPROM_REG_BAND_4_CHANNELS,
322                         EEPROM_REG_BAND_5_CHANNELS,
323                         EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
324                         EEPROM_REG_BAND_52_HT40_CHANNELS
325                 },
326                 .verify_signature  = iwlcore_eeprom_verify_signature,
327                 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
328                 .release_semaphore = iwlcore_eeprom_release_semaphore,
329                 .calib_version  = iwlagn_eeprom_calib_version,
330                 .query_addr = iwlagn_eeprom_query_addr,
331                 .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
332         },
333         .post_associate = iwl_post_associate,
334         .isr = iwl_isr_ict,
335         .config_ap = iwl_config_ap,
336         .temp_ops = {
337                 .temperature = iwlagn_temperature,
338                 .set_ct_kill = iwl6000_set_ct_threshold,
339          },
340         .manage_ibss_station = iwlagn_manage_ibss_station,
341         .update_bcast_stations = iwl_update_bcast_stations,
342         .debugfs_ops = {
343                 .rx_stats_read = iwl_ucode_rx_stats_read,
344                 .tx_stats_read = iwl_ucode_tx_stats_read,
345                 .general_stats_read = iwl_ucode_general_stats_read,
346                 .bt_stats_read = iwl_ucode_bt_stats_read,
347                 .reply_tx_error = iwl_reply_tx_error_read,
348         },
349         .recover_from_tx_stall = iwl_bg_monitor_recover,
350         .check_plcp_health = iwl_good_plcp_health,
351         .check_ack_health = iwl_good_ack_health,
352         .txfifo_flush = iwlagn_txfifo_flush,
353         .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
354         .tt_ops = {
355                 .lower_power_detection = iwl_tt_is_low_power_state,
356                 .tt_power_mode = iwl_tt_current_power_mode,
357                 .ct_kill_check = iwl_check_for_ct_kill,
358         }
359 };
360
361 static struct iwl_lib_ops iwl6000g2b_lib = {
362         .set_hw_params = iwl6000_hw_set_hw_params,
363         .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
364         .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
365         .txq_set_sched = iwlagn_txq_set_sched,
366         .txq_agg_enable = iwlagn_txq_agg_enable,
367         .txq_agg_disable = iwlagn_txq_agg_disable,
368         .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
369         .txq_free_tfd = iwl_hw_txq_free_tfd,
370         .txq_init = iwl_hw_tx_queue_init,
371         .rx_handler_setup = iwlagn_bt_rx_handler_setup,
372         .setup_deferred_work = iwlagn_bt_setup_deferred_work,
373         .cancel_deferred_work = iwlagn_bt_cancel_deferred_work,
374         .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
375         .load_ucode = iwlagn_load_ucode,
376         .dump_nic_event_log = iwl_dump_nic_event_log,
377         .dump_nic_error_log = iwl_dump_nic_error_log,
378         .dump_csr = iwl_dump_csr,
379         .dump_fh = iwl_dump_fh,
380         .init_alive_start = iwlagn_init_alive_start,
381         .alive_notify = iwlagn_alive_notify,
382         .send_tx_power = iwlagn_send_tx_power,
383         .update_chain_flags = iwl_update_chain_flags,
384         .set_channel_switch = iwl6000_hw_channel_switch,
385         .apm_ops = {
386                 .init = iwl_apm_init,
387                 .stop = iwl_apm_stop,
388                 .config = iwl6000_nic_config,
389                 .set_pwr_src = iwl_set_pwr_src,
390         },
391         .eeprom_ops = {
392                 .regulatory_bands = {
393                         EEPROM_REG_BAND_1_CHANNELS,
394                         EEPROM_REG_BAND_2_CHANNELS,
395                         EEPROM_REG_BAND_3_CHANNELS,
396                         EEPROM_REG_BAND_4_CHANNELS,
397                         EEPROM_REG_BAND_5_CHANNELS,
398                         EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
399                         EEPROM_REG_BAND_52_HT40_CHANNELS
400                 },
401                 .verify_signature  = iwlcore_eeprom_verify_signature,
402                 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
403                 .release_semaphore = iwlcore_eeprom_release_semaphore,
404                 .calib_version  = iwlagn_eeprom_calib_version,
405                 .query_addr = iwlagn_eeprom_query_addr,
406                 .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
407         },
408         .post_associate = iwl_post_associate,
409         .isr = iwl_isr_ict,
410         .config_ap = iwl_config_ap,
411         .temp_ops = {
412                 .temperature = iwlagn_temperature,
413                 .set_ct_kill = iwl6000_set_ct_threshold,
414          },
415         .manage_ibss_station = iwlagn_manage_ibss_station,
416         .update_bcast_stations = iwl_update_bcast_stations,
417         .debugfs_ops = {
418                 .rx_stats_read = iwl_ucode_rx_stats_read,
419                 .tx_stats_read = iwl_ucode_tx_stats_read,
420                 .general_stats_read = iwl_ucode_general_stats_read,
421                 .bt_stats_read = iwl_ucode_bt_stats_read,
422                 .reply_tx_error = iwl_reply_tx_error_read,
423         },
424         .recover_from_tx_stall = iwl_bg_monitor_recover,
425         .check_plcp_health = iwl_good_plcp_health,
426         .check_ack_health = iwl_good_ack_health,
427         .txfifo_flush = iwlagn_txfifo_flush,
428         .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
429         .tt_ops = {
430                 .lower_power_detection = iwl_tt_is_low_power_state,
431                 .tt_power_mode = iwl_tt_current_power_mode,
432                 .ct_kill_check = iwl_check_for_ct_kill,
433         }
434 };
435
436 static struct iwl_nic_ops iwl6050_nic_ops = {
437         .additional_nic_config = &iwl6050_additional_nic_config,
438 };
439
440 static struct iwl_nic_ops iwl6050g2_nic_ops = {
441         .additional_nic_config = &iwl6050g2_additional_nic_config,
442 };
443
444 static const struct iwl_ops iwl6000_ops = {
445         .lib = &iwl6000_lib,
446         .hcmd = &iwlagn_hcmd,
447         .utils = &iwlagn_hcmd_utils,
448         .led = &iwlagn_led_ops,
449 };
450
451 static const struct iwl_ops iwl6050_ops = {
452         .lib = &iwl6000_lib,
453         .hcmd = &iwlagn_hcmd,
454         .utils = &iwlagn_hcmd_utils,
455         .led = &iwlagn_led_ops,
456         .nic = &iwl6050_nic_ops,
457 };
458
459 static const struct iwl_ops iwl6050g2_ops = {
460         .lib = &iwl6000_lib,
461         .hcmd = &iwlagn_hcmd,
462         .utils = &iwlagn_hcmd_utils,
463         .led = &iwlagn_led_ops,
464         .nic = &iwl6050g2_nic_ops,
465 };
466
467 static const struct iwl_ops iwl6000g2b_ops = {
468         .lib = &iwl6000g2b_lib,
469         .hcmd = &iwlagn_bt_hcmd,
470         .utils = &iwlagn_hcmd_utils,
471         .led = &iwlagn_led_ops,
472 };
473
474 static struct iwl_base_params iwl6000_base_params = {
475         .eeprom_size = OTP_LOW_IMAGE_SIZE,
476         .num_of_queues = IWLAGN_NUM_QUEUES,
477         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
478         .pll_cfg_val = 0,
479         .set_l0s = true,
480         .use_bsm = false,
481         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
482         .shadow_ram_support = true,
483         .led_compensation = 51,
484         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
485         .supports_idle = true,
486         .adv_thermal_throttle = true,
487         .support_ct_kill_exit = true,
488         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
489         .chain_noise_scale = 1000,
490         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
491         .max_event_log_size = 512,
492         .ucode_tracing = true,
493         .sensitivity_calib_by_driver = true,
494         .chain_noise_calib_by_driver = true,
495 };
496
497 static struct iwl_base_params iwl6050_base_params = {
498         .eeprom_size = OTP_LOW_IMAGE_SIZE,
499         .num_of_queues = IWLAGN_NUM_QUEUES,
500         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
501         .pll_cfg_val = 0,
502         .set_l0s = true,
503         .use_bsm = false,
504         .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
505         .shadow_ram_support = true,
506         .led_compensation = 51,
507         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
508         .supports_idle = true,
509         .adv_thermal_throttle = true,
510         .support_ct_kill_exit = true,
511         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
512         .chain_noise_scale = 1500,
513         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
514         .max_event_log_size = 1024,
515         .ucode_tracing = true,
516         .sensitivity_calib_by_driver = true,
517         .chain_noise_calib_by_driver = true,
518 };
519
520 static struct iwl_ht_params iwl6000_ht_params = {
521         .ht_greenfield_support = true,
522         .use_rts_for_aggregation = true, /* use rts/cts protection */
523 };
524
525 static struct iwl_bt_params iwl6000_bt_params = {
526         .bt_statistics = true,
527         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
528         .advanced_bt_coexist = true,
529         .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
530         .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
531 };
532
533 struct iwl_cfg iwl6000g2a_2agn_cfg = {
534         .name = "6000 Series 2x2 AGN Gen2a",
535         .fw_name_pre = IWL6000G2A_FW_PRE,
536         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
537         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
538         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
539         .valid_tx_ant = ANT_AB,
540         .valid_rx_ant = ANT_AB,
541         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
542         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
543         .ops = &iwl6000_ops,
544         .mod_params = &iwlagn_mod_params,
545         .base_params = &iwl6000_base_params,
546         .ht_params = &iwl6000_ht_params,
547         .need_dc_calib = true,
548 };
549
550 struct iwl_cfg iwl6000g2a_2abg_cfg = {
551         .name = "6000 Series 2x2 ABG Gen2a",
552         .fw_name_pre = IWL6000G2A_FW_PRE,
553         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
554         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
555         .sku = IWL_SKU_A|IWL_SKU_G,
556         .valid_tx_ant = ANT_AB,
557         .valid_rx_ant = ANT_AB,
558         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
559         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
560         .ops = &iwl6000_ops,
561         .mod_params = &iwlagn_mod_params,
562         .base_params = &iwl6000_base_params,
563         .need_dc_calib = true,
564 };
565
566 struct iwl_cfg iwl6000g2a_2bg_cfg = {
567         .name = "6000 Series 2x2 BG Gen2a",
568         .fw_name_pre = IWL6000G2A_FW_PRE,
569         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
570         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
571         .sku = IWL_SKU_G,
572         .valid_tx_ant = ANT_AB,
573         .valid_rx_ant = ANT_AB,
574         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
575         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
576         .ops = &iwl6000_ops,
577         .mod_params = &iwlagn_mod_params,
578         .base_params = &iwl6000_base_params,
579         .need_dc_calib = true,
580 };
581
582 struct iwl_cfg iwl6000g2b_2agn_cfg = {
583         .name = "6000 Series 2x2 AGN Gen2b",
584         .fw_name_pre = IWL6000G2B_FW_PRE,
585         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
586         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
587         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
588         .valid_tx_ant = ANT_AB,
589         .valid_rx_ant = ANT_AB,
590         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
591         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
592         .ops = &iwl6000g2b_ops,
593         .mod_params = &iwlagn_mod_params,
594         .base_params = &iwl6000_base_params,
595         .bt_params = &iwl6000_bt_params,
596         .ht_params = &iwl6000_ht_params,
597         .need_dc_calib = true,
598         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
599         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
600 };
601
602 struct iwl_cfg iwl6000g2b_2abg_cfg = {
603         .name = "6000 Series 2x2 ABG Gen2b",
604         .fw_name_pre = IWL6000G2B_FW_PRE,
605         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
606         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
607         .sku = IWL_SKU_A|IWL_SKU_G,
608         .valid_tx_ant = ANT_AB,
609         .valid_rx_ant = ANT_AB,
610         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
611         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
612         .ops = &iwl6000g2b_ops,
613         .mod_params = &iwlagn_mod_params,
614         .base_params = &iwl6000_base_params,
615         .bt_params = &iwl6000_bt_params,
616         .need_dc_calib = true,
617         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
618         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
619 };
620
621 struct iwl_cfg iwl6000g2b_2bgn_cfg = {
622         .name = "6000 Series 2x2 BGN Gen2b",
623         .fw_name_pre = IWL6000G2B_FW_PRE,
624         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
625         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
626         .sku = IWL_SKU_G|IWL_SKU_N,
627         .valid_tx_ant = ANT_AB,
628         .valid_rx_ant = ANT_AB,
629         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
630         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
631         .ops = &iwl6000g2b_ops,
632         .mod_params = &iwlagn_mod_params,
633         .base_params = &iwl6000_base_params,
634         .bt_params = &iwl6000_bt_params,
635         .ht_params = &iwl6000_ht_params,
636         .need_dc_calib = true,
637         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
638         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
639 };
640
641 struct iwl_cfg iwl6000g2b_2bg_cfg = {
642         .name = "6000 Series 2x2 BG Gen2b",
643         .fw_name_pre = IWL6000G2B_FW_PRE,
644         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
645         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
646         .sku = IWL_SKU_G,
647         .valid_tx_ant = ANT_AB,
648         .valid_rx_ant = ANT_AB,
649         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
650         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
651         .ops = &iwl6000g2b_ops,
652         .mod_params = &iwlagn_mod_params,
653         .base_params = &iwl6000_base_params,
654         .bt_params = &iwl6000_bt_params,
655         .need_dc_calib = true,
656         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
657         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
658 };
659
660 struct iwl_cfg iwl6000g2b_bgn_cfg = {
661         .name = "6000 Series 1x2 BGN Gen2b",
662         .fw_name_pre = IWL6000G2B_FW_PRE,
663         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
664         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
665         .sku = IWL_SKU_G|IWL_SKU_N,
666         .valid_tx_ant = ANT_A,
667         .valid_rx_ant = ANT_AB,
668         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
669         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
670         .ops = &iwl6000g2b_ops,
671         .mod_params = &iwlagn_mod_params,
672         .base_params = &iwl6000_base_params,
673         .bt_params = &iwl6000_bt_params,
674         .ht_params = &iwl6000_ht_params,
675         .need_dc_calib = true,
676         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
677         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
678 };
679
680 struct iwl_cfg iwl6000g2b_bg_cfg = {
681         .name = "6000 Series 1x2 BG Gen2b",
682         .fw_name_pre = IWL6000G2B_FW_PRE,
683         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
684         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
685         .sku = IWL_SKU_G,
686         .valid_tx_ant = ANT_A,
687         .valid_rx_ant = ANT_AB,
688         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
689         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
690         .ops = &iwl6000g2b_ops,
691         .mod_params = &iwlagn_mod_params,
692         .base_params = &iwl6000_base_params,
693         .bt_params = &iwl6000_bt_params,
694         .need_dc_calib = true,
695         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
696         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
697 };
698
699 /*
700  * "i": Internal configuration, use internal Power Amplifier
701  */
702 struct iwl_cfg iwl6000i_2agn_cfg = {
703         .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN",
704         .fw_name_pre = IWL6000_FW_PRE,
705         .ucode_api_max = IWL6000_UCODE_API_MAX,
706         .ucode_api_min = IWL6000_UCODE_API_MIN,
707         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
708         .valid_tx_ant = ANT_BC,
709         .valid_rx_ant = ANT_BC,
710         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
711         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
712         .ops = &iwl6000_ops,
713         .mod_params = &iwlagn_mod_params,
714         .base_params = &iwl6000_base_params,
715         .ht_params = &iwl6000_ht_params,
716         .pa_type = IWL_PA_INTERNAL,
717 };
718
719 struct iwl_cfg iwl6000i_2abg_cfg = {
720         .name = "Intel(R) Centrino(R) Advanced-N 6200 ABG",
721         .fw_name_pre = IWL6000_FW_PRE,
722         .ucode_api_max = IWL6000_UCODE_API_MAX,
723         .ucode_api_min = IWL6000_UCODE_API_MIN,
724         .sku = IWL_SKU_A|IWL_SKU_G,
725         .valid_tx_ant = ANT_BC,
726         .valid_rx_ant = ANT_BC,
727         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
728         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
729         .ops = &iwl6000_ops,
730         .mod_params = &iwlagn_mod_params,
731         .base_params = &iwl6000_base_params,
732         .pa_type = IWL_PA_INTERNAL,
733 };
734
735 struct iwl_cfg iwl6000i_2bg_cfg = {
736         .name = "Intel(R) Centrino(R) Advanced-N 6200 BG",
737         .fw_name_pre = IWL6000_FW_PRE,
738         .ucode_api_max = IWL6000_UCODE_API_MAX,
739         .ucode_api_min = IWL6000_UCODE_API_MIN,
740         .sku = IWL_SKU_G,
741         .valid_tx_ant = ANT_BC,
742         .valid_rx_ant = ANT_BC,
743         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
744         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
745         .ops = &iwl6000_ops,
746         .mod_params = &iwlagn_mod_params,
747         .base_params = &iwl6000_base_params,
748         .pa_type = IWL_PA_INTERNAL,
749 };
750
751 struct iwl_cfg iwl6050_2agn_cfg = {
752         .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN",
753         .fw_name_pre = IWL6050_FW_PRE,
754         .ucode_api_max = IWL6050_UCODE_API_MAX,
755         .ucode_api_min = IWL6050_UCODE_API_MIN,
756         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
757         .valid_tx_ant = ANT_AB,
758         .valid_rx_ant = ANT_AB,
759         .ops = &iwl6000_ops,
760         .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
761         .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
762         .mod_params = &iwlagn_mod_params,
763         .base_params = &iwl6050_base_params,
764         .ht_params = &iwl6000_ht_params,
765         .need_dc_calib = true,
766 };
767
768 struct iwl_cfg iwl6050g2_bgn_cfg = {
769         .name = "6050 Series 1x2 BGN Gen2",
770         .fw_name_pre = IWL6050_FW_PRE,
771         .ucode_api_max = IWL6050_UCODE_API_MAX,
772         .ucode_api_min = IWL6050_UCODE_API_MIN,
773         .sku = IWL_SKU_G|IWL_SKU_N,
774         .valid_tx_ant = ANT_A,
775         .valid_rx_ant = ANT_AB,
776         .eeprom_ver = EEPROM_6050G2_EEPROM_VERSION,
777         .eeprom_calib_ver = EEPROM_6050G2_TX_POWER_VERSION,
778         .ops = &iwl6050g2_ops,
779         .mod_params = &iwlagn_mod_params,
780         .base_params = &iwl6050_base_params,
781         .ht_params = &iwl6000_ht_params,
782         .need_dc_calib = true,
783 };
784
785 struct iwl_cfg iwl6050_2abg_cfg = {
786         .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 ABG",
787         .fw_name_pre = IWL6050_FW_PRE,
788         .ucode_api_max = IWL6050_UCODE_API_MAX,
789         .ucode_api_min = IWL6050_UCODE_API_MIN,
790         .sku = IWL_SKU_A|IWL_SKU_G,
791         .valid_tx_ant = ANT_AB,
792         .valid_rx_ant = ANT_AB,
793         .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
794         .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
795         .ops = &iwl6050_ops,
796         .mod_params = &iwlagn_mod_params,
797         .base_params = &iwl6050_base_params,
798         .need_dc_calib = true,
799 };
800
801 struct iwl_cfg iwl6000_3agn_cfg = {
802         .name = "Intel(R) Centrino(R) Ultimate-N 6300 AGN",
803         .fw_name_pre = IWL6000_FW_PRE,
804         .ucode_api_max = IWL6000_UCODE_API_MAX,
805         .ucode_api_min = IWL6000_UCODE_API_MIN,
806         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
807         .valid_tx_ant = ANT_ABC,
808         .valid_rx_ant = ANT_ABC,
809         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
810         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
811         .ops = &iwl6000_ops,
812         .mod_params = &iwlagn_mod_params,
813         .base_params = &iwl6000_base_params,
814         .ht_params = &iwl6000_ht_params,
815         .need_dc_calib = true,
816 };
817
818 struct iwl_cfg iwl130_bgn_cfg = {
819         .name = "Intel(R) 130 Series 1x1 BGN",
820         .fw_name_pre = IWL6000G2B_FW_PRE,
821         .ucode_api_max = IWL130_UCODE_API_MAX,
822         .ucode_api_min = IWL130_UCODE_API_MIN,
823         .sku = IWL_SKU_G|IWL_SKU_N,
824         .valid_tx_ant = ANT_A,
825         .valid_rx_ant = ANT_A,
826         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
827         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
828         .ops = &iwl6000g2b_ops,
829         .mod_params = &iwlagn_mod_params,
830         .base_params = &iwl6000_base_params,
831         .bt_params = &iwl6000_bt_params,
832         .ht_params = &iwl6000_ht_params,
833         .need_dc_calib = true,
834         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
835         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
836 };
837
838 struct iwl_cfg iwl130_bg_cfg = {
839         .name = "Intel(R) 130 Series 1x2 BG",
840         .fw_name_pre = IWL6000G2B_FW_PRE,
841         .ucode_api_max = IWL130_UCODE_API_MAX,
842         .ucode_api_min = IWL130_UCODE_API_MIN,
843         .sku = IWL_SKU_G,
844         .valid_tx_ant = ANT_A,
845         .valid_rx_ant = ANT_A,
846         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
847         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
848         .ops = &iwl6000g2b_ops,
849         .mod_params = &iwlagn_mod_params,
850         .base_params = &iwl6000_base_params,
851         .bt_params = &iwl6000_bt_params,
852         .need_dc_calib = true,
853         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
854         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
855 };
856
857 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
858 MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
859 MODULE_FIRMWARE(IWL6000G2A_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
860 MODULE_FIRMWARE(IWL6000G2B_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
861 MODULE_FIRMWARE(IWL130_MODULE_FIRMWARE(IWL130_UCODE_API_MAX));