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