]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/net/wireless/iwlwifi/iwl-6000.c
p54usb: New USB ID for Gemtek WUBI-100GW
[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 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         iwl6000_set_ct_threshold(priv);
196
197         /* Set initial sensitivity parameters */
198         /* Set initial calibration set */
199         priv->hw_params.sens = &iwl6000_sensitivity;
200         priv->hw_params.calib_init_cfg =
201                 BIT(IWL_CALIB_XTAL)             |
202                 BIT(IWL_CALIB_LO)               |
203                 BIT(IWL_CALIB_TX_IQ)            |
204                 BIT(IWL_CALIB_BASE_BAND);
205         if (priv->cfg->need_dc_calib)
206                 priv->hw_params.calib_rt_cfg |= BIT(IWL_CALIB_CFG_DC_IDX);
207         if (priv->cfg->need_temp_offset_calib)
208                 priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
209
210         priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
211
212         return 0;
213 }
214
215 static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
216                                      struct ieee80211_channel_switch *ch_switch)
217 {
218         /*
219          * MULTI-FIXME
220          * See iwl_mac_channel_switch.
221          */
222         struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
223         struct iwl6000_channel_switch_cmd cmd;
224         const struct iwl_channel_info *ch_info;
225         u32 switch_time_in_usec, ucode_switch_time;
226         u16 ch;
227         u32 tsf_low;
228         u8 switch_count;
229         u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
230         struct ieee80211_vif *vif = ctx->vif;
231         struct iwl_host_cmd hcmd = {
232                 .id = REPLY_CHANNEL_SWITCH,
233                 .len = sizeof(cmd),
234                 .flags = CMD_SYNC,
235                 .data = &cmd,
236         };
237
238         cmd.band = priv->band == IEEE80211_BAND_2GHZ;
239         ch = ch_switch->channel->hw_value;
240         IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
241                       ctx->active.channel, ch);
242         cmd.channel = cpu_to_le16(ch);
243         cmd.rxon_flags = ctx->staging.flags;
244         cmd.rxon_filter_flags = ctx->staging.filter_flags;
245         switch_count = ch_switch->count;
246         tsf_low = ch_switch->timestamp & 0x0ffffffff;
247         /*
248          * calculate the ucode channel switch time
249          * adding TSF as one of the factor for when to switch
250          */
251         if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) {
252                 if (switch_count > ((priv->ucode_beacon_time - tsf_low) /
253                     beacon_interval)) {
254                         switch_count -= (priv->ucode_beacon_time -
255                                 tsf_low) / beacon_interval;
256                 } else
257                         switch_count = 0;
258         }
259         if (switch_count <= 1)
260                 cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
261         else {
262                 switch_time_in_usec =
263                         vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
264                 ucode_switch_time = iwl_usecs_to_beacons(priv,
265                                                          switch_time_in_usec,
266                                                          beacon_interval);
267                 cmd.switch_time = iwl_add_beacon_time(priv,
268                                                       priv->ucode_beacon_time,
269                                                       ucode_switch_time,
270                                                       beacon_interval);
271         }
272         IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
273                       cmd.switch_time);
274         ch_info = iwl_get_channel_info(priv, priv->band, ch);
275         if (ch_info)
276                 cmd.expect_beacon = is_channel_radar(ch_info);
277         else {
278                 IWL_ERR(priv, "invalid channel switch from %u to %u\n",
279                         ctx->active.channel, ch);
280                 return -EFAULT;
281         }
282         priv->switch_rxon.channel = cmd.channel;
283         priv->switch_rxon.switch_in_progress = true;
284
285         return iwl_send_cmd_sync(priv, &hcmd);
286 }
287
288 static struct iwl_lib_ops iwl6000_lib = {
289         .set_hw_params = iwl6000_hw_set_hw_params,
290         .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
291         .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
292         .txq_set_sched = iwlagn_txq_set_sched,
293         .txq_agg_enable = iwlagn_txq_agg_enable,
294         .txq_agg_disable = iwlagn_txq_agg_disable,
295         .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
296         .txq_free_tfd = iwl_hw_txq_free_tfd,
297         .txq_init = iwl_hw_tx_queue_init,
298         .rx_handler_setup = iwlagn_rx_handler_setup,
299         .setup_deferred_work = iwlagn_setup_deferred_work,
300         .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
301         .load_ucode = iwlagn_load_ucode,
302         .dump_nic_event_log = iwl_dump_nic_event_log,
303         .dump_nic_error_log = iwl_dump_nic_error_log,
304         .dump_csr = iwl_dump_csr,
305         .dump_fh = iwl_dump_fh,
306         .init_alive_start = iwlagn_init_alive_start,
307         .alive_notify = iwlagn_alive_notify,
308         .send_tx_power = iwlagn_send_tx_power,
309         .update_chain_flags = iwl_update_chain_flags,
310         .set_channel_switch = iwl6000_hw_channel_switch,
311         .apm_ops = {
312                 .init = iwl_apm_init,
313                 .config = iwl6000_nic_config,
314         },
315         .eeprom_ops = {
316                 .regulatory_bands = {
317                         EEPROM_REG_BAND_1_CHANNELS,
318                         EEPROM_REG_BAND_2_CHANNELS,
319                         EEPROM_REG_BAND_3_CHANNELS,
320                         EEPROM_REG_BAND_4_CHANNELS,
321                         EEPROM_REG_BAND_5_CHANNELS,
322                         EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
323                         EEPROM_REG_BAND_52_HT40_CHANNELS
324                 },
325                 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
326                 .release_semaphore = iwlcore_eeprom_release_semaphore,
327                 .calib_version  = iwlagn_eeprom_calib_version,
328                 .query_addr = iwlagn_eeprom_query_addr,
329                 .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
330         },
331         .post_associate = iwl_post_associate,
332         .isr = iwl_isr_ict,
333         .config_ap = iwl_config_ap,
334         .temp_ops = {
335                 .temperature = iwlagn_temperature,
336          },
337         .manage_ibss_station = iwlagn_manage_ibss_station,
338         .update_bcast_stations = iwl_update_bcast_stations,
339         .debugfs_ops = {
340                 .rx_stats_read = iwl_ucode_rx_stats_read,
341                 .tx_stats_read = iwl_ucode_tx_stats_read,
342                 .general_stats_read = iwl_ucode_general_stats_read,
343                 .bt_stats_read = iwl_ucode_bt_stats_read,
344                 .reply_tx_error = iwl_reply_tx_error_read,
345         },
346         .recover_from_tx_stall = iwl_bg_monitor_recover,
347         .check_plcp_health = iwl_good_plcp_health,
348         .check_ack_health = iwl_good_ack_health,
349         .txfifo_flush = iwlagn_txfifo_flush,
350         .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
351         .tt_ops = {
352                 .lower_power_detection = iwl_tt_is_low_power_state,
353                 .tt_power_mode = iwl_tt_current_power_mode,
354                 .ct_kill_check = iwl_check_for_ct_kill,
355         }
356 };
357
358 static struct iwl_lib_ops iwl6000g2b_lib = {
359         .set_hw_params = iwl6000_hw_set_hw_params,
360         .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
361         .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
362         .txq_set_sched = iwlagn_txq_set_sched,
363         .txq_agg_enable = iwlagn_txq_agg_enable,
364         .txq_agg_disable = iwlagn_txq_agg_disable,
365         .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
366         .txq_free_tfd = iwl_hw_txq_free_tfd,
367         .txq_init = iwl_hw_tx_queue_init,
368         .rx_handler_setup = iwlagn_bt_rx_handler_setup,
369         .setup_deferred_work = iwlagn_bt_setup_deferred_work,
370         .cancel_deferred_work = iwlagn_bt_cancel_deferred_work,
371         .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr,
372         .load_ucode = iwlagn_load_ucode,
373         .dump_nic_event_log = iwl_dump_nic_event_log,
374         .dump_nic_error_log = iwl_dump_nic_error_log,
375         .dump_csr = iwl_dump_csr,
376         .dump_fh = iwl_dump_fh,
377         .init_alive_start = iwlagn_init_alive_start,
378         .alive_notify = iwlagn_alive_notify,
379         .send_tx_power = iwlagn_send_tx_power,
380         .update_chain_flags = iwl_update_chain_flags,
381         .set_channel_switch = iwl6000_hw_channel_switch,
382         .apm_ops = {
383                 .init = iwl_apm_init,
384                 .config = iwl6000_nic_config,
385         },
386         .eeprom_ops = {
387                 .regulatory_bands = {
388                         EEPROM_REG_BAND_1_CHANNELS,
389                         EEPROM_REG_BAND_2_CHANNELS,
390                         EEPROM_REG_BAND_3_CHANNELS,
391                         EEPROM_REG_BAND_4_CHANNELS,
392                         EEPROM_REG_BAND_5_CHANNELS,
393                         EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
394                         EEPROM_REG_BAND_52_HT40_CHANNELS
395                 },
396                 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
397                 .release_semaphore = iwlcore_eeprom_release_semaphore,
398                 .calib_version  = iwlagn_eeprom_calib_version,
399                 .query_addr = iwlagn_eeprom_query_addr,
400                 .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower,
401         },
402         .post_associate = iwl_post_associate,
403         .isr = iwl_isr_ict,
404         .config_ap = iwl_config_ap,
405         .temp_ops = {
406                 .temperature = iwlagn_temperature,
407          },
408         .manage_ibss_station = iwlagn_manage_ibss_station,
409         .update_bcast_stations = iwl_update_bcast_stations,
410         .debugfs_ops = {
411                 .rx_stats_read = iwl_ucode_rx_stats_read,
412                 .tx_stats_read = iwl_ucode_tx_stats_read,
413                 .general_stats_read = iwl_ucode_general_stats_read,
414                 .bt_stats_read = iwl_ucode_bt_stats_read,
415                 .reply_tx_error = iwl_reply_tx_error_read,
416         },
417         .recover_from_tx_stall = iwl_bg_monitor_recover,
418         .check_plcp_health = iwl_good_plcp_health,
419         .check_ack_health = iwl_good_ack_health,
420         .txfifo_flush = iwlagn_txfifo_flush,
421         .dev_txfifo_flush = iwlagn_dev_txfifo_flush,
422         .tt_ops = {
423                 .lower_power_detection = iwl_tt_is_low_power_state,
424                 .tt_power_mode = iwl_tt_current_power_mode,
425                 .ct_kill_check = iwl_check_for_ct_kill,
426         }
427 };
428
429 static struct iwl_nic_ops iwl6050_nic_ops = {
430         .additional_nic_config = &iwl6050_additional_nic_config,
431 };
432
433 static struct iwl_nic_ops iwl6050g2_nic_ops = {
434         .additional_nic_config = &iwl6050g2_additional_nic_config,
435 };
436
437 static const struct iwl_ops iwl6000_ops = {
438         .lib = &iwl6000_lib,
439         .hcmd = &iwlagn_hcmd,
440         .utils = &iwlagn_hcmd_utils,
441         .led = &iwlagn_led_ops,
442 };
443
444 static const struct iwl_ops iwl6050_ops = {
445         .lib = &iwl6000_lib,
446         .hcmd = &iwlagn_hcmd,
447         .utils = &iwlagn_hcmd_utils,
448         .led = &iwlagn_led_ops,
449         .nic = &iwl6050_nic_ops,
450 };
451
452 static const struct iwl_ops iwl6050g2_ops = {
453         .lib = &iwl6000_lib,
454         .hcmd = &iwlagn_hcmd,
455         .utils = &iwlagn_hcmd_utils,
456         .led = &iwlagn_led_ops,
457         .nic = &iwl6050g2_nic_ops,
458 };
459
460 static const struct iwl_ops iwl6000g2b_ops = {
461         .lib = &iwl6000g2b_lib,
462         .hcmd = &iwlagn_bt_hcmd,
463         .utils = &iwlagn_hcmd_utils,
464         .led = &iwlagn_led_ops,
465 };
466
467 static struct iwl_base_params iwl6000_base_params = {
468         .eeprom_size = OTP_LOW_IMAGE_SIZE,
469         .num_of_queues = IWLAGN_NUM_QUEUES,
470         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
471         .pll_cfg_val = 0,
472         .set_l0s = true,
473         .use_bsm = false,
474         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
475         .shadow_ram_support = true,
476         .led_compensation = 51,
477         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
478         .supports_idle = true,
479         .adv_thermal_throttle = true,
480         .support_ct_kill_exit = true,
481         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
482         .chain_noise_scale = 1000,
483         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
484         .max_event_log_size = 512,
485         .ucode_tracing = true,
486         .sensitivity_calib_by_driver = true,
487         .chain_noise_calib_by_driver = true,
488 };
489
490 static struct iwl_base_params iwl6050_base_params = {
491         .eeprom_size = OTP_LOW_IMAGE_SIZE,
492         .num_of_queues = IWLAGN_NUM_QUEUES,
493         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
494         .pll_cfg_val = 0,
495         .set_l0s = true,
496         .use_bsm = false,
497         .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
498         .shadow_ram_support = true,
499         .led_compensation = 51,
500         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
501         .supports_idle = true,
502         .adv_thermal_throttle = true,
503         .support_ct_kill_exit = true,
504         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
505         .chain_noise_scale = 1500,
506         .monitor_recover_period = IWL_DEF_MONITORING_PERIOD,
507         .max_event_log_size = 1024,
508         .ucode_tracing = true,
509         .sensitivity_calib_by_driver = true,
510         .chain_noise_calib_by_driver = true,
511 };
512 static struct iwl_base_params iwl6000_coex_base_params = {
513         .eeprom_size = OTP_LOW_IMAGE_SIZE,
514         .num_of_queues = IWLAGN_NUM_QUEUES,
515         .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
516         .pll_cfg_val = 0,
517         .set_l0s = true,
518         .use_bsm = false,
519         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
520         .shadow_ram_support = true,
521         .led_compensation = 51,
522         .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
523         .supports_idle = true,
524         .adv_thermal_throttle = true,
525         .support_ct_kill_exit = true,
526         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
527         .chain_noise_scale = 1000,
528         .monitor_recover_period = IWL_LONG_MONITORING_PERIOD,
529         .max_event_log_size = 512,
530         .ucode_tracing = true,
531         .sensitivity_calib_by_driver = true,
532         .chain_noise_calib_by_driver = true,
533 };
534
535 static struct iwl_ht_params iwl6000_ht_params = {
536         .ht_greenfield_support = true,
537         .use_rts_for_aggregation = true, /* use rts/cts protection */
538 };
539
540 static struct iwl_bt_params iwl6000_bt_params = {
541         .bt_statistics = true,
542         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
543         .advanced_bt_coexist = true,
544         .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
545         .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
546 };
547
548 struct iwl_cfg iwl6000g2a_2agn_cfg = {
549         .name = "6000 Series 2x2 AGN Gen2a",
550         .fw_name_pre = IWL6000G2A_FW_PRE,
551         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
552         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
553         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
554         .valid_tx_ant = ANT_AB,
555         .valid_rx_ant = ANT_AB,
556         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
557         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
558         .ops = &iwl6000_ops,
559         .mod_params = &iwlagn_mod_params,
560         .base_params = &iwl6000_base_params,
561         .ht_params = &iwl6000_ht_params,
562         .need_dc_calib = true,
563         .need_temp_offset_calib = true,
564         .use_new_eeprom_reading = true,
565 };
566
567 struct iwl_cfg iwl6000g2a_2abg_cfg = {
568         .name = "6000 Series 2x2 ABG Gen2a",
569         .fw_name_pre = IWL6000G2A_FW_PRE,
570         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
571         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
572         .sku = IWL_SKU_A|IWL_SKU_G,
573         .valid_tx_ant = ANT_AB,
574         .valid_rx_ant = ANT_AB,
575         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
576         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
577         .ops = &iwl6000_ops,
578         .mod_params = &iwlagn_mod_params,
579         .base_params = &iwl6000_base_params,
580         .need_dc_calib = true,
581         .need_temp_offset_calib = true,
582         .use_new_eeprom_reading = true,
583 };
584
585 struct iwl_cfg iwl6000g2a_2bg_cfg = {
586         .name = "6000 Series 2x2 BG Gen2a",
587         .fw_name_pre = IWL6000G2A_FW_PRE,
588         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
589         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
590         .sku = IWL_SKU_G,
591         .valid_tx_ant = ANT_AB,
592         .valid_rx_ant = ANT_AB,
593         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
594         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
595         .ops = &iwl6000_ops,
596         .mod_params = &iwlagn_mod_params,
597         .base_params = &iwl6000_base_params,
598         .need_dc_calib = true,
599         .need_temp_offset_calib = true,
600         .use_new_eeprom_reading = true,
601 };
602
603 struct iwl_cfg iwl6000g2b_2agn_cfg = {
604         .name = "6000 Series 2x2 AGN Gen2b",
605         .fw_name_pre = IWL6000G2B_FW_PRE,
606         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
607         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
608         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
609         .valid_tx_ant = ANT_AB,
610         .valid_rx_ant = ANT_AB,
611         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
612         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
613         .ops = &iwl6000g2b_ops,
614         .mod_params = &iwlagn_mod_params,
615         .base_params = &iwl6000_coex_base_params,
616         .bt_params = &iwl6000_bt_params,
617         .ht_params = &iwl6000_ht_params,
618         .need_dc_calib = true,
619         .need_temp_offset_calib = true,
620         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
621         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
622         .use_new_eeprom_reading = true,
623 };
624
625 struct iwl_cfg iwl6000g2b_2abg_cfg = {
626         .name = "6000 Series 2x2 ABG Gen2b",
627         .fw_name_pre = IWL6000G2B_FW_PRE,
628         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
629         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
630         .sku = IWL_SKU_A|IWL_SKU_G,
631         .valid_tx_ant = ANT_AB,
632         .valid_rx_ant = ANT_AB,
633         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
634         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
635         .ops = &iwl6000g2b_ops,
636         .mod_params = &iwlagn_mod_params,
637         .base_params = &iwl6000_coex_base_params,
638         .bt_params = &iwl6000_bt_params,
639         .need_dc_calib = true,
640         .need_temp_offset_calib = true,
641         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
642         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
643         .use_new_eeprom_reading = true,
644 };
645
646 struct iwl_cfg iwl6000g2b_2bgn_cfg = {
647         .name = "6000 Series 2x2 BGN Gen2b",
648         .fw_name_pre = IWL6000G2B_FW_PRE,
649         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
650         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
651         .sku = IWL_SKU_G|IWL_SKU_N,
652         .valid_tx_ant = ANT_AB,
653         .valid_rx_ant = ANT_AB,
654         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
655         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
656         .ops = &iwl6000g2b_ops,
657         .mod_params = &iwlagn_mod_params,
658         .base_params = &iwl6000_coex_base_params,
659         .bt_params = &iwl6000_bt_params,
660         .ht_params = &iwl6000_ht_params,
661         .need_dc_calib = true,
662         .need_temp_offset_calib = true,
663         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
664         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
665         .use_new_eeprom_reading = true,
666 };
667
668 struct iwl_cfg iwl6000g2b_2bg_cfg = {
669         .name = "6000 Series 2x2 BG Gen2b",
670         .fw_name_pre = IWL6000G2B_FW_PRE,
671         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
672         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
673         .sku = IWL_SKU_G,
674         .valid_tx_ant = ANT_AB,
675         .valid_rx_ant = ANT_AB,
676         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
677         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
678         .ops = &iwl6000g2b_ops,
679         .mod_params = &iwlagn_mod_params,
680         .base_params = &iwl6000_coex_base_params,
681         .bt_params = &iwl6000_bt_params,
682         .need_dc_calib = true,
683         .need_temp_offset_calib = true,
684         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
685         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
686         .use_new_eeprom_reading = true,
687 };
688
689 struct iwl_cfg iwl6000g2b_bgn_cfg = {
690         .name = "6000 Series 1x2 BGN Gen2b",
691         .fw_name_pre = IWL6000G2B_FW_PRE,
692         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
693         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
694         .sku = IWL_SKU_G|IWL_SKU_N,
695         .valid_tx_ant = ANT_A,
696         .valid_rx_ant = ANT_AB,
697         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
698         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
699         .ops = &iwl6000g2b_ops,
700         .mod_params = &iwlagn_mod_params,
701         .base_params = &iwl6000_coex_base_params,
702         .bt_params = &iwl6000_bt_params,
703         .ht_params = &iwl6000_ht_params,
704         .need_dc_calib = true,
705         .need_temp_offset_calib = true,
706         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
707         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
708         .use_new_eeprom_reading = true,
709 };
710
711 struct iwl_cfg iwl6000g2b_bg_cfg = {
712         .name = "6000 Series 1x2 BG Gen2b",
713         .fw_name_pre = IWL6000G2B_FW_PRE,
714         .ucode_api_max = IWL6000G2_UCODE_API_MAX,
715         .ucode_api_min = IWL6000G2_UCODE_API_MIN,
716         .sku = IWL_SKU_G,
717         .valid_tx_ant = ANT_A,
718         .valid_rx_ant = ANT_AB,
719         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
720         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
721         .ops = &iwl6000g2b_ops,
722         .mod_params = &iwlagn_mod_params,
723         .base_params = &iwl6000_coex_base_params,
724         .bt_params = &iwl6000_bt_params,
725         .need_dc_calib = true,
726         .need_temp_offset_calib = true,
727         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
728         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
729         .use_new_eeprom_reading = true,
730 };
731
732 /*
733  * "i": Internal configuration, use internal Power Amplifier
734  */
735 struct iwl_cfg iwl6000i_2agn_cfg = {
736         .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN",
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_A|IWL_SKU_G|IWL_SKU_N,
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         .ht_params = &iwl6000_ht_params,
749         .pa_type = IWL_PA_INTERNAL,
750 };
751
752 struct iwl_cfg iwl6000i_2abg_cfg = {
753         .name = "Intel(R) Centrino(R) Advanced-N 6200 ABG",
754         .fw_name_pre = IWL6000_FW_PRE,
755         .ucode_api_max = IWL6000_UCODE_API_MAX,
756         .ucode_api_min = IWL6000_UCODE_API_MIN,
757         .sku = IWL_SKU_A|IWL_SKU_G,
758         .valid_tx_ant = ANT_BC,
759         .valid_rx_ant = ANT_BC,
760         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
761         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
762         .ops = &iwl6000_ops,
763         .mod_params = &iwlagn_mod_params,
764         .base_params = &iwl6000_base_params,
765         .pa_type = IWL_PA_INTERNAL,
766 };
767
768 struct iwl_cfg iwl6000i_2bg_cfg = {
769         .name = "Intel(R) Centrino(R) Advanced-N 6200 BG",
770         .fw_name_pre = IWL6000_FW_PRE,
771         .ucode_api_max = IWL6000_UCODE_API_MAX,
772         .ucode_api_min = IWL6000_UCODE_API_MIN,
773         .sku = IWL_SKU_G,
774         .valid_tx_ant = ANT_BC,
775         .valid_rx_ant = ANT_BC,
776         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
777         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
778         .ops = &iwl6000_ops,
779         .mod_params = &iwlagn_mod_params,
780         .base_params = &iwl6000_base_params,
781         .pa_type = IWL_PA_INTERNAL,
782 };
783
784 struct iwl_cfg iwl6050_2agn_cfg = {
785         .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN",
786         .fw_name_pre = IWL6050_FW_PRE,
787         .ucode_api_max = IWL6050_UCODE_API_MAX,
788         .ucode_api_min = IWL6050_UCODE_API_MIN,
789         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
790         .valid_tx_ant = ANT_AB,
791         .valid_rx_ant = ANT_AB,
792         .ops = &iwl6050_ops,
793         .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
794         .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
795         .mod_params = &iwlagn_mod_params,
796         .base_params = &iwl6050_base_params,
797         .ht_params = &iwl6000_ht_params,
798         .need_dc_calib = true,
799 };
800
801 struct iwl_cfg iwl6050g2_bgn_cfg = {
802         .name = "6050 Series 1x2 BGN Gen2",
803         .fw_name_pre = IWL6050_FW_PRE,
804         .ucode_api_max = IWL6050_UCODE_API_MAX,
805         .ucode_api_min = IWL6050_UCODE_API_MIN,
806         .sku = IWL_SKU_G|IWL_SKU_N,
807         .valid_tx_ant = ANT_A,
808         .valid_rx_ant = ANT_AB,
809         .eeprom_ver = EEPROM_6050G2_EEPROM_VERSION,
810         .eeprom_calib_ver = EEPROM_6050G2_TX_POWER_VERSION,
811         .ops = &iwl6050g2_ops,
812         .mod_params = &iwlagn_mod_params,
813         .base_params = &iwl6050_base_params,
814         .ht_params = &iwl6000_ht_params,
815         .need_dc_calib = true,
816         .use_new_eeprom_reading = true,
817 };
818
819 struct iwl_cfg iwl6050_2abg_cfg = {
820         .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 ABG",
821         .fw_name_pre = IWL6050_FW_PRE,
822         .ucode_api_max = IWL6050_UCODE_API_MAX,
823         .ucode_api_min = IWL6050_UCODE_API_MIN,
824         .sku = IWL_SKU_A|IWL_SKU_G,
825         .valid_tx_ant = ANT_AB,
826         .valid_rx_ant = ANT_AB,
827         .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
828         .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
829         .ops = &iwl6050_ops,
830         .mod_params = &iwlagn_mod_params,
831         .base_params = &iwl6050_base_params,
832         .need_dc_calib = true,
833 };
834
835 struct iwl_cfg iwl6000_3agn_cfg = {
836         .name = "Intel(R) Centrino(R) Ultimate-N 6300 AGN",
837         .fw_name_pre = IWL6000_FW_PRE,
838         .ucode_api_max = IWL6000_UCODE_API_MAX,
839         .ucode_api_min = IWL6000_UCODE_API_MIN,
840         .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
841         .valid_tx_ant = ANT_ABC,
842         .valid_rx_ant = ANT_ABC,
843         .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
844         .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
845         .ops = &iwl6000_ops,
846         .mod_params = &iwlagn_mod_params,
847         .base_params = &iwl6000_base_params,
848         .ht_params = &iwl6000_ht_params,
849         .need_dc_calib = true,
850 };
851
852 struct iwl_cfg iwl130_bgn_cfg = {
853         .name = "Intel(R) 130 Series 1x1 BGN",
854         .fw_name_pre = IWL6000G2B_FW_PRE,
855         .ucode_api_max = IWL130_UCODE_API_MAX,
856         .ucode_api_min = IWL130_UCODE_API_MIN,
857         .sku = IWL_SKU_G|IWL_SKU_N,
858         .valid_tx_ant = ANT_A,
859         .valid_rx_ant = ANT_A,
860         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
861         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
862         .ops = &iwl6000g2b_ops,
863         .mod_params = &iwlagn_mod_params,
864         .base_params = &iwl6000_coex_base_params,
865         .bt_params = &iwl6000_bt_params,
866         .ht_params = &iwl6000_ht_params,
867         .need_dc_calib = true,
868         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
869         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
870         .use_new_eeprom_reading = true,
871 };
872
873 struct iwl_cfg iwl130_bg_cfg = {
874         .name = "Intel(R) 130 Series 1x2 BG",
875         .fw_name_pre = IWL6000G2B_FW_PRE,
876         .ucode_api_max = IWL130_UCODE_API_MAX,
877         .ucode_api_min = IWL130_UCODE_API_MIN,
878         .sku = IWL_SKU_G,
879         .valid_tx_ant = ANT_A,
880         .valid_rx_ant = ANT_A,
881         .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
882         .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
883         .ops = &iwl6000g2b_ops,
884         .mod_params = &iwlagn_mod_params,
885         .base_params = &iwl6000_coex_base_params,
886         .bt_params = &iwl6000_bt_params,
887         .need_dc_calib = true,
888         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
889         .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
890         .use_new_eeprom_reading = true,
891 };
892
893 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
894 MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
895 MODULE_FIRMWARE(IWL6000G2A_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
896 MODULE_FIRMWARE(IWL6000G2B_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
897 MODULE_FIRMWARE(IWL130_MODULE_FIRMWARE(IWL130_UCODE_API_MAX));