]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/blob - drivers/net/wireless/iwlwifi/pcie/6000.c
Merge branch 'akpm' (Andrew's patch-bomb)
[can-eth-gw-linux.git] / drivers / net / wireless / iwlwifi / pcie / 6000.c
1 /******************************************************************************
2  *
3  * Copyright(c) 2008 - 2012 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/module.h>
28 #include <linux/stringify.h>
29 #include "iwl-config.h"
30 #include "iwl-agn-hw.h"
31 #include "cfg.h"
32 #include "dvm/commands.h" /* needed for BT for now */
33
34 /* Highest firmware API version supported */
35 #define IWL6000_UCODE_API_MAX 6
36 #define IWL6050_UCODE_API_MAX 5
37 #define IWL6000G2_UCODE_API_MAX 6
38 #define IWL6035_UCODE_API_MAX 6
39
40 /* Oldest version we won't warn about */
41 #define IWL6000_UCODE_API_OK 4
42 #define IWL6000G2_UCODE_API_OK 5
43 #define IWL6050_UCODE_API_OK 5
44 #define IWL6000G2B_UCODE_API_OK 6
45 #define IWL6035_UCODE_API_OK 6
46
47 /* Lowest firmware API version supported */
48 #define IWL6000_UCODE_API_MIN 4
49 #define IWL6050_UCODE_API_MIN 4
50 #define IWL6000G2_UCODE_API_MIN 5
51 #define IWL6035_UCODE_API_MIN 6
52
53 /* EEPROM versions */
54 #define EEPROM_6000_TX_POWER_VERSION    (4)
55 #define EEPROM_6000_EEPROM_VERSION      (0x423)
56 #define EEPROM_6050_TX_POWER_VERSION    (4)
57 #define EEPROM_6050_EEPROM_VERSION      (0x532)
58 #define EEPROM_6150_TX_POWER_VERSION    (6)
59 #define EEPROM_6150_EEPROM_VERSION      (0x553)
60 #define EEPROM_6005_TX_POWER_VERSION    (6)
61 #define EEPROM_6005_EEPROM_VERSION      (0x709)
62 #define EEPROM_6030_TX_POWER_VERSION    (6)
63 #define EEPROM_6030_EEPROM_VERSION      (0x709)
64 #define EEPROM_6035_TX_POWER_VERSION    (6)
65 #define EEPROM_6035_EEPROM_VERSION      (0x753)
66
67 #define IWL6000_FW_PRE "iwlwifi-6000-"
68 #define IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE __stringify(api) ".ucode"
69
70 #define IWL6050_FW_PRE "iwlwifi-6050-"
71 #define IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE __stringify(api) ".ucode"
72
73 #define IWL6005_FW_PRE "iwlwifi-6000g2a-"
74 #define IWL6005_MODULE_FIRMWARE(api) IWL6005_FW_PRE __stringify(api) ".ucode"
75
76 #define IWL6030_FW_PRE "iwlwifi-6000g2b-"
77 #define IWL6030_MODULE_FIRMWARE(api) IWL6030_FW_PRE __stringify(api) ".ucode"
78
79 static const struct iwl_base_params iwl6000_base_params = {
80         .eeprom_size = OTP_LOW_IMAGE_SIZE,
81         .num_of_queues = IWLAGN_NUM_QUEUES,
82         .pll_cfg_val = 0,
83         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
84         .shadow_ram_support = true,
85         .led_compensation = 51,
86         .adv_thermal_throttle = true,
87         .support_ct_kill_exit = true,
88         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
89         .chain_noise_scale = 1000,
90         .wd_timeout = IWL_DEF_WD_TIMEOUT,
91         .max_event_log_size = 512,
92         .shadow_reg_enable = false, /* TODO: fix bugs using this feature */
93 };
94
95 static const struct iwl_base_params iwl6050_base_params = {
96         .eeprom_size = OTP_LOW_IMAGE_SIZE,
97         .num_of_queues = IWLAGN_NUM_QUEUES,
98         .pll_cfg_val = 0,
99         .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
100         .shadow_ram_support = true,
101         .led_compensation = 51,
102         .adv_thermal_throttle = true,
103         .support_ct_kill_exit = true,
104         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
105         .chain_noise_scale = 1500,
106         .wd_timeout = IWL_DEF_WD_TIMEOUT,
107         .max_event_log_size = 1024,
108         .shadow_reg_enable = false, /* TODO: fix bugs using this feature */
109 };
110
111 static const struct iwl_base_params iwl6000_g2_base_params = {
112         .eeprom_size = OTP_LOW_IMAGE_SIZE,
113         .num_of_queues = IWLAGN_NUM_QUEUES,
114         .pll_cfg_val = 0,
115         .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
116         .shadow_ram_support = true,
117         .led_compensation = 57,
118         .adv_thermal_throttle = true,
119         .support_ct_kill_exit = true,
120         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
121         .chain_noise_scale = 1000,
122         .wd_timeout = IWL_LONG_WD_TIMEOUT,
123         .max_event_log_size = 512,
124         .shadow_reg_enable = false, /* TODO: fix bugs using this feature */
125 };
126
127 static const struct iwl_ht_params iwl6000_ht_params = {
128         .ht_greenfield_support = true,
129         .use_rts_for_aggregation = true, /* use rts/cts protection */
130         .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
131 };
132
133 static const struct iwl_bt_params iwl6000_bt_params = {
134         /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
135         .advanced_bt_coexist = true,
136         .agg_time_limit = BT_AGG_THRESHOLD_DEF,
137         .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
138         .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
139         .bt_sco_disable = true,
140 };
141
142 static const struct iwl_eeprom_params iwl6000_eeprom_params = {
143         .regulatory_bands = {
144                 EEPROM_REG_BAND_1_CHANNELS,
145                 EEPROM_REG_BAND_2_CHANNELS,
146                 EEPROM_REG_BAND_3_CHANNELS,
147                 EEPROM_REG_BAND_4_CHANNELS,
148                 EEPROM_REG_BAND_5_CHANNELS,
149                 EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
150                 EEPROM_REG_BAND_52_HT40_CHANNELS
151         },
152         .enhanced_txpower = true,
153 };
154
155 #define IWL_DEVICE_6005                                         \
156         .fw_name_pre = IWL6005_FW_PRE,                          \
157         .ucode_api_max = IWL6000G2_UCODE_API_MAX,               \
158         .ucode_api_ok = IWL6000G2_UCODE_API_OK,                 \
159         .ucode_api_min = IWL6000G2_UCODE_API_MIN,               \
160         .device_family = IWL_DEVICE_FAMILY_6005,                \
161         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
162         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
163         .nvm_ver = EEPROM_6005_EEPROM_VERSION,          \
164         .nvm_calib_ver = EEPROM_6005_TX_POWER_VERSION,  \
165         .base_params = &iwl6000_g2_base_params,                 \
166         .eeprom_params = &iwl6000_eeprom_params,                \
167         .need_temp_offset_calib = true,                         \
168         .led_mode = IWL_LED_RF_STATE
169
170 const struct iwl_cfg iwl6005_2agn_cfg = {
171         .name = "Intel(R) Centrino(R) Advanced-N 6205 AGN",
172         IWL_DEVICE_6005,
173         .ht_params = &iwl6000_ht_params,
174 };
175
176 const struct iwl_cfg iwl6005_2abg_cfg = {
177         .name = "Intel(R) Centrino(R) Advanced-N 6205 ABG",
178         IWL_DEVICE_6005,
179 };
180
181 const struct iwl_cfg iwl6005_2bg_cfg = {
182         .name = "Intel(R) Centrino(R) Advanced-N 6205 BG",
183         IWL_DEVICE_6005,
184 };
185
186 const struct iwl_cfg iwl6005_2agn_sff_cfg = {
187         .name = "Intel(R) Centrino(R) Advanced-N 6205S AGN",
188         IWL_DEVICE_6005,
189         .ht_params = &iwl6000_ht_params,
190 };
191
192 const struct iwl_cfg iwl6005_2agn_d_cfg = {
193         .name = "Intel(R) Centrino(R) Advanced-N 6205D AGN",
194         IWL_DEVICE_6005,
195         .ht_params = &iwl6000_ht_params,
196 };
197
198 const struct iwl_cfg iwl6005_2agn_mow1_cfg = {
199         .name = "Intel(R) Centrino(R) Advanced-N 6206 AGN",
200         IWL_DEVICE_6005,
201         .ht_params = &iwl6000_ht_params,
202 };
203
204 const struct iwl_cfg iwl6005_2agn_mow2_cfg = {
205         .name = "Intel(R) Centrino(R) Advanced-N 6207 AGN",
206         IWL_DEVICE_6005,
207         .ht_params = &iwl6000_ht_params,
208 };
209
210 #define IWL_DEVICE_6030                                         \
211         .fw_name_pre = IWL6030_FW_PRE,                          \
212         .ucode_api_max = IWL6000G2_UCODE_API_MAX,               \
213         .ucode_api_ok = IWL6000G2B_UCODE_API_OK,                \
214         .ucode_api_min = IWL6000G2_UCODE_API_MIN,               \
215         .device_family = IWL_DEVICE_FAMILY_6030,                \
216         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
217         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
218         .nvm_ver = EEPROM_6030_EEPROM_VERSION,          \
219         .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION,  \
220         .base_params = &iwl6000_g2_base_params,                 \
221         .bt_params = &iwl6000_bt_params,                        \
222         .eeprom_params = &iwl6000_eeprom_params,                \
223         .need_temp_offset_calib = true,                         \
224         .led_mode = IWL_LED_RF_STATE,                           \
225         .adv_pm = true                                          \
226
227 const struct iwl_cfg iwl6030_2agn_cfg = {
228         .name = "Intel(R) Centrino(R) Advanced-N 6230 AGN",
229         IWL_DEVICE_6030,
230         .ht_params = &iwl6000_ht_params,
231 };
232
233 const struct iwl_cfg iwl6030_2abg_cfg = {
234         .name = "Intel(R) Centrino(R) Advanced-N 6230 ABG",
235         IWL_DEVICE_6030,
236 };
237
238 const struct iwl_cfg iwl6030_2bgn_cfg = {
239         .name = "Intel(R) Centrino(R) Advanced-N 6230 BGN",
240         IWL_DEVICE_6030,
241         .ht_params = &iwl6000_ht_params,
242 };
243
244 const struct iwl_cfg iwl6030_2bg_cfg = {
245         .name = "Intel(R) Centrino(R) Advanced-N 6230 BG",
246         IWL_DEVICE_6030,
247 };
248
249 #define IWL_DEVICE_6035                                         \
250         .fw_name_pre = IWL6030_FW_PRE,                          \
251         .ucode_api_max = IWL6035_UCODE_API_MAX,                 \
252         .ucode_api_ok = IWL6035_UCODE_API_OK,                   \
253         .ucode_api_min = IWL6035_UCODE_API_MIN,                 \
254         .device_family = IWL_DEVICE_FAMILY_6030,                \
255         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
256         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
257         .nvm_ver = EEPROM_6030_EEPROM_VERSION,          \
258         .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION,  \
259         .base_params = &iwl6000_g2_base_params,                 \
260         .bt_params = &iwl6000_bt_params,                        \
261         .eeprom_params = &iwl6000_eeprom_params,                \
262         .need_temp_offset_calib = true,                         \
263         .led_mode = IWL_LED_RF_STATE,                           \
264         .adv_pm = true
265
266 const struct iwl_cfg iwl6035_2agn_cfg = {
267         .name = "Intel(R) Centrino(R) Advanced-N 6235 AGN",
268         IWL_DEVICE_6035,
269         .ht_params = &iwl6000_ht_params,
270 };
271
272 const struct iwl_cfg iwl1030_bgn_cfg = {
273         .name = "Intel(R) Centrino(R) Wireless-N 1030 BGN",
274         IWL_DEVICE_6030,
275         .ht_params = &iwl6000_ht_params,
276 };
277
278 const struct iwl_cfg iwl1030_bg_cfg = {
279         .name = "Intel(R) Centrino(R) Wireless-N 1030 BG",
280         IWL_DEVICE_6030,
281 };
282
283 const struct iwl_cfg iwl130_bgn_cfg = {
284         .name = "Intel(R) Centrino(R) Wireless-N 130 BGN",
285         IWL_DEVICE_6030,
286         .ht_params = &iwl6000_ht_params,
287         .rx_with_siso_diversity = true,
288 };
289
290 const struct iwl_cfg iwl130_bg_cfg = {
291         .name = "Intel(R) Centrino(R) Wireless-N 130 BG",
292         IWL_DEVICE_6030,
293         .rx_with_siso_diversity = true,
294 };
295
296 /*
297  * "i": Internal configuration, use internal Power Amplifier
298  */
299 #define IWL_DEVICE_6000i                                        \
300         .fw_name_pre = IWL6000_FW_PRE,                          \
301         .ucode_api_max = IWL6000_UCODE_API_MAX,                 \
302         .ucode_api_ok = IWL6000_UCODE_API_OK,                   \
303         .ucode_api_min = IWL6000_UCODE_API_MIN,                 \
304         .device_family = IWL_DEVICE_FAMILY_6000i,               \
305         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
306         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
307         .valid_tx_ant = ANT_BC,         /* .cfg overwrite */    \
308         .valid_rx_ant = ANT_BC,         /* .cfg overwrite */    \
309         .nvm_ver = EEPROM_6000_EEPROM_VERSION,          \
310         .nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION,  \
311         .base_params = &iwl6000_base_params,                    \
312         .eeprom_params = &iwl6000_eeprom_params,                \
313         .led_mode = IWL_LED_BLINK
314
315 const struct iwl_cfg iwl6000i_2agn_cfg = {
316         .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN",
317         IWL_DEVICE_6000i,
318         .ht_params = &iwl6000_ht_params,
319 };
320
321 const struct iwl_cfg iwl6000i_2abg_cfg = {
322         .name = "Intel(R) Centrino(R) Advanced-N 6200 ABG",
323         IWL_DEVICE_6000i,
324 };
325
326 const struct iwl_cfg iwl6000i_2bg_cfg = {
327         .name = "Intel(R) Centrino(R) Advanced-N 6200 BG",
328         IWL_DEVICE_6000i,
329 };
330
331 #define IWL_DEVICE_6050                                         \
332         .fw_name_pre = IWL6050_FW_PRE,                          \
333         .ucode_api_max = IWL6050_UCODE_API_MAX,                 \
334         .ucode_api_min = IWL6050_UCODE_API_MIN,                 \
335         .device_family = IWL_DEVICE_FAMILY_6050,                \
336         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
337         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
338         .valid_tx_ant = ANT_AB,         /* .cfg overwrite */    \
339         .valid_rx_ant = ANT_AB,         /* .cfg overwrite */    \
340         .nvm_ver = EEPROM_6050_EEPROM_VERSION,          \
341         .nvm_calib_ver = EEPROM_6050_TX_POWER_VERSION,  \
342         .base_params = &iwl6050_base_params,                    \
343         .eeprom_params = &iwl6000_eeprom_params,                \
344         .led_mode = IWL_LED_BLINK,                              \
345         .internal_wimax_coex = true
346
347 const struct iwl_cfg iwl6050_2agn_cfg = {
348         .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN",
349         IWL_DEVICE_6050,
350         .ht_params = &iwl6000_ht_params,
351 };
352
353 const struct iwl_cfg iwl6050_2abg_cfg = {
354         .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 ABG",
355         IWL_DEVICE_6050,
356 };
357
358 #define IWL_DEVICE_6150                                         \
359         .fw_name_pre = IWL6050_FW_PRE,                          \
360         .ucode_api_max = IWL6050_UCODE_API_MAX,                 \
361         .ucode_api_min = IWL6050_UCODE_API_MIN,                 \
362         .device_family = IWL_DEVICE_FAMILY_6150,                \
363         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
364         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
365         .nvm_ver = EEPROM_6150_EEPROM_VERSION,          \
366         .nvm_calib_ver = EEPROM_6150_TX_POWER_VERSION,  \
367         .base_params = &iwl6050_base_params,                    \
368         .eeprom_params = &iwl6000_eeprom_params,                \
369         .led_mode = IWL_LED_BLINK,                              \
370         .internal_wimax_coex = true
371
372 const struct iwl_cfg iwl6150_bgn_cfg = {
373         .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN",
374         IWL_DEVICE_6150,
375         .ht_params = &iwl6000_ht_params,
376 };
377
378 const struct iwl_cfg iwl6150_bg_cfg = {
379         .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BG",
380         IWL_DEVICE_6150,
381 };
382
383 const struct iwl_cfg iwl6000_3agn_cfg = {
384         .name = "Intel(R) Centrino(R) Ultimate-N 6300 AGN",
385         .fw_name_pre = IWL6000_FW_PRE,
386         .ucode_api_max = IWL6000_UCODE_API_MAX,
387         .ucode_api_ok = IWL6000_UCODE_API_OK,
388         .ucode_api_min = IWL6000_UCODE_API_MIN,
389         .device_family = IWL_DEVICE_FAMILY_6000,
390         .max_inst_size = IWL60_RTC_INST_SIZE,
391         .max_data_size = IWL60_RTC_DATA_SIZE,
392         .nvm_ver = EEPROM_6000_EEPROM_VERSION,
393         .nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION,
394         .base_params = &iwl6000_base_params,
395         .eeprom_params = &iwl6000_eeprom_params,
396         .ht_params = &iwl6000_ht_params,
397         .led_mode = IWL_LED_BLINK,
398 };
399
400 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK));
401 MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_OK));
402 MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_OK));
403 MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_OK));