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