1 /******************************************************************************
2  *
3  * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
4  * Copyright(c) 2018 Intel Corporation
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18  *
19  * The full GNU General Public License is included in this distribution in the
20  * file called LICENSE.
21  *
22  * Contact Information:
23  *  Intel Linux Wireless <linuxwifi@intel.com>
24  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25  *
26  *****************************************************************************/
27 
28 #include <linux/module.h>
29 #include <linux/stringify.h>
30 #include "iwl-config.h"
31 #include "iwl-agn-hw.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 /* Lowest firmware API version supported */
41 #define IWL6000_UCODE_API_MIN 4
42 #define IWL6050_UCODE_API_MIN 4
43 #define IWL6000G2_UCODE_API_MIN 5
44 #define IWL6035_UCODE_API_MIN 6
45 
46 /* EEPROM versions */
47 #define EEPROM_6000_TX_POWER_VERSION	(4)
48 #define EEPROM_6000_EEPROM_VERSION	(0x423)
49 #define EEPROM_6050_TX_POWER_VERSION	(4)
50 #define EEPROM_6050_EEPROM_VERSION	(0x532)
51 #define EEPROM_6150_TX_POWER_VERSION	(6)
52 #define EEPROM_6150_EEPROM_VERSION	(0x553)
53 #define EEPROM_6005_TX_POWER_VERSION	(6)
54 #define EEPROM_6005_EEPROM_VERSION	(0x709)
55 #define EEPROM_6030_TX_POWER_VERSION	(6)
56 #define EEPROM_6030_EEPROM_VERSION	(0x709)
57 #define EEPROM_6035_TX_POWER_VERSION	(6)
58 #define EEPROM_6035_EEPROM_VERSION	(0x753)
59 
60 #define IWL6000_FW_PRE "iwlwifi-6000-"
61 #define IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE __stringify(api) ".ucode"
62 
63 #define IWL6050_FW_PRE "iwlwifi-6050-"
64 #define IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE __stringify(api) ".ucode"
65 
66 #define IWL6005_FW_PRE "iwlwifi-6000g2a-"
67 #define IWL6005_MODULE_FIRMWARE(api) IWL6005_FW_PRE __stringify(api) ".ucode"
68 
69 #define IWL6030_FW_PRE "iwlwifi-6000g2b-"
70 #define IWL6030_MODULE_FIRMWARE(api) IWL6030_FW_PRE __stringify(api) ".ucode"
71 
72 static const struct iwl_base_params iwl6000_base_params = {
73 	.eeprom_size = OTP_LOW_IMAGE_SIZE,
74 	.num_of_queues = IWLAGN_NUM_QUEUES,
75 	.max_tfd_queue_size = 256,
76 	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
77 	.shadow_ram_support = true,
78 	.led_compensation = 51,
79 	.wd_timeout = IWL_DEF_WD_TIMEOUT,
80 	.max_event_log_size = 512,
81 	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
82 	.scd_chain_ext_wa = true,
83 };
84 
85 static const struct iwl_base_params iwl6050_base_params = {
86 	.eeprom_size = OTP_LOW_IMAGE_SIZE,
87 	.num_of_queues = IWLAGN_NUM_QUEUES,
88 	.max_tfd_queue_size = 256,
89 	.max_ll_items = OTP_MAX_LL_ITEMS_6x50,
90 	.shadow_ram_support = true,
91 	.led_compensation = 51,
92 	.wd_timeout = IWL_DEF_WD_TIMEOUT,
93 	.max_event_log_size = 1024,
94 	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
95 	.scd_chain_ext_wa = true,
96 };
97 
98 static const struct iwl_base_params iwl6000_g2_base_params = {
99 	.eeprom_size = OTP_LOW_IMAGE_SIZE,
100 	.num_of_queues = IWLAGN_NUM_QUEUES,
101 	.max_tfd_queue_size = 256,
102 	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
103 	.shadow_ram_support = true,
104 	.led_compensation = 57,
105 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
106 	.max_event_log_size = 512,
107 	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
108 	.scd_chain_ext_wa = true,
109 };
110 
111 static const struct iwl_ht_params iwl6000_ht_params = {
112 	.ht_greenfield_support = true,
113 	.use_rts_for_aggregation = true, /* use rts/cts protection */
114 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
115 };
116 
117 static const struct iwl_eeprom_params iwl6000_eeprom_params = {
118 	.regulatory_bands = {
119 		EEPROM_REG_BAND_1_CHANNELS,
120 		EEPROM_REG_BAND_2_CHANNELS,
121 		EEPROM_REG_BAND_3_CHANNELS,
122 		EEPROM_REG_BAND_4_CHANNELS,
123 		EEPROM_REG_BAND_5_CHANNELS,
124 		EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
125 		EEPROM_REG_BAND_52_HT40_CHANNELS
126 	},
127 	.enhanced_txpower = true,
128 };
129 
130 #define IWL_DEVICE_6005						\
131 	.fw_name_pre = IWL6005_FW_PRE,				\
132 	.ucode_api_max = IWL6000G2_UCODE_API_MAX,		\
133 	.ucode_api_min = IWL6000G2_UCODE_API_MIN,		\
134 	.device_family = IWL_DEVICE_FAMILY_6005,		\
135 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
136 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
137 	.nvm_ver = EEPROM_6005_EEPROM_VERSION,		\
138 	.nvm_calib_ver = EEPROM_6005_TX_POWER_VERSION,	\
139 	.base_params = &iwl6000_g2_base_params,			\
140 	.eeprom_params = &iwl6000_eeprom_params,		\
141 	.led_mode = IWL_LED_RF_STATE,				\
142 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
143 	.csr = &iwl_csr_v1
144 
145 const struct iwl_cfg iwl6005_2agn_cfg = {
146 	.name = "Intel(R) Centrino(R) Advanced-N 6205 AGN",
147 	IWL_DEVICE_6005,
148 	.ht_params = &iwl6000_ht_params,
149 };
150 
151 const struct iwl_cfg iwl6005_2abg_cfg = {
152 	.name = "Intel(R) Centrino(R) Advanced-N 6205 ABG",
153 	IWL_DEVICE_6005,
154 };
155 
156 const struct iwl_cfg iwl6005_2bg_cfg = {
157 	.name = "Intel(R) Centrino(R) Advanced-N 6205 BG",
158 	IWL_DEVICE_6005,
159 };
160 
161 const struct iwl_cfg iwl6005_2agn_sff_cfg = {
162 	.name = "Intel(R) Centrino(R) Advanced-N 6205S AGN",
163 	IWL_DEVICE_6005,
164 	.ht_params = &iwl6000_ht_params,
165 };
166 
167 const struct iwl_cfg iwl6005_2agn_d_cfg = {
168 	.name = "Intel(R) Centrino(R) Advanced-N 6205D AGN",
169 	IWL_DEVICE_6005,
170 	.ht_params = &iwl6000_ht_params,
171 };
172 
173 const struct iwl_cfg iwl6005_2agn_mow1_cfg = {
174 	.name = "Intel(R) Centrino(R) Advanced-N 6206 AGN",
175 	IWL_DEVICE_6005,
176 	.ht_params = &iwl6000_ht_params,
177 };
178 
179 const struct iwl_cfg iwl6005_2agn_mow2_cfg = {
180 	.name = "Intel(R) Centrino(R) Advanced-N 6207 AGN",
181 	IWL_DEVICE_6005,
182 	.ht_params = &iwl6000_ht_params,
183 };
184 
185 #define IWL_DEVICE_6030						\
186 	.fw_name_pre = IWL6030_FW_PRE,				\
187 	.ucode_api_max = IWL6000G2_UCODE_API_MAX,		\
188 	.ucode_api_min = IWL6000G2_UCODE_API_MIN,		\
189 	.device_family = IWL_DEVICE_FAMILY_6030,		\
190 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
191 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
192 	.nvm_ver = EEPROM_6030_EEPROM_VERSION,		\
193 	.nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION,	\
194 	.base_params = &iwl6000_g2_base_params,			\
195 	.eeprom_params = &iwl6000_eeprom_params,		\
196 	.led_mode = IWL_LED_RF_STATE,				\
197 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
198 	.csr = &iwl_csr_v1
199 
200 const struct iwl_cfg iwl6030_2agn_cfg = {
201 	.name = "Intel(R) Centrino(R) Advanced-N 6230 AGN",
202 	IWL_DEVICE_6030,
203 	.ht_params = &iwl6000_ht_params,
204 };
205 
206 const struct iwl_cfg iwl6030_2abg_cfg = {
207 	.name = "Intel(R) Centrino(R) Advanced-N 6230 ABG",
208 	IWL_DEVICE_6030,
209 };
210 
211 const struct iwl_cfg iwl6030_2bgn_cfg = {
212 	.name = "Intel(R) Centrino(R) Advanced-N 6230 BGN",
213 	IWL_DEVICE_6030,
214 	.ht_params = &iwl6000_ht_params,
215 };
216 
217 const struct iwl_cfg iwl6030_2bg_cfg = {
218 	.name = "Intel(R) Centrino(R) Advanced-N 6230 BG",
219 	IWL_DEVICE_6030,
220 };
221 
222 #define IWL_DEVICE_6035						\
223 	.fw_name_pre = IWL6030_FW_PRE,				\
224 	.ucode_api_max = IWL6035_UCODE_API_MAX,			\
225 	.ucode_api_min = IWL6035_UCODE_API_MIN,			\
226 	.device_family = IWL_DEVICE_FAMILY_6030,		\
227 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
228 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
229 	.nvm_ver = EEPROM_6030_EEPROM_VERSION,		\
230 	.nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION,	\
231 	.base_params = &iwl6000_g2_base_params,			\
232 	.eeprom_params = &iwl6000_eeprom_params,		\
233 	.led_mode = IWL_LED_RF_STATE,				\
234 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
235 	.csr = &iwl_csr_v1
236 
237 const struct iwl_cfg iwl6035_2agn_cfg = {
238 	.name = "Intel(R) Centrino(R) Advanced-N 6235 AGN",
239 	IWL_DEVICE_6035,
240 	.ht_params = &iwl6000_ht_params,
241 };
242 
243 const struct iwl_cfg iwl6035_2agn_sff_cfg = {
244 	.name = "Intel(R) Centrino(R) Ultimate-N 6235 AGN",
245 	IWL_DEVICE_6035,
246 	.ht_params = &iwl6000_ht_params,
247 };
248 
249 const struct iwl_cfg iwl1030_bgn_cfg = {
250 	.name = "Intel(R) Centrino(R) Wireless-N 1030 BGN",
251 	IWL_DEVICE_6030,
252 	.ht_params = &iwl6000_ht_params,
253 };
254 
255 const struct iwl_cfg iwl1030_bg_cfg = {
256 	.name = "Intel(R) Centrino(R) Wireless-N 1030 BG",
257 	IWL_DEVICE_6030,
258 };
259 
260 const struct iwl_cfg iwl130_bgn_cfg = {
261 	.name = "Intel(R) Centrino(R) Wireless-N 130 BGN",
262 	IWL_DEVICE_6030,
263 	.ht_params = &iwl6000_ht_params,
264 	.rx_with_siso_diversity = true,
265 };
266 
267 const struct iwl_cfg iwl130_bg_cfg = {
268 	.name = "Intel(R) Centrino(R) Wireless-N 130 BG",
269 	IWL_DEVICE_6030,
270 	.rx_with_siso_diversity = true,
271 };
272 
273 /*
274  * "i": Internal configuration, use internal Power Amplifier
275  */
276 #define IWL_DEVICE_6000i					\
277 	.fw_name_pre = IWL6000_FW_PRE,				\
278 	.ucode_api_max = IWL6000_UCODE_API_MAX,			\
279 	.ucode_api_min = IWL6000_UCODE_API_MIN,			\
280 	.device_family = IWL_DEVICE_FAMILY_6000i,		\
281 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
282 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
283 	.valid_tx_ant = ANT_BC,		/* .cfg overwrite */	\
284 	.valid_rx_ant = ANT_BC,		/* .cfg overwrite */	\
285 	.nvm_ver = EEPROM_6000_EEPROM_VERSION,		\
286 	.nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION,	\
287 	.base_params = &iwl6000_base_params,			\
288 	.eeprom_params = &iwl6000_eeprom_params,		\
289 	.led_mode = IWL_LED_BLINK,				\
290 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
291 	.csr = &iwl_csr_v1
292 
293 const struct iwl_cfg iwl6000i_2agn_cfg = {
294 	.name = "Intel(R) Centrino(R) Advanced-N 6200 AGN",
295 	IWL_DEVICE_6000i,
296 	.ht_params = &iwl6000_ht_params,
297 };
298 
299 const struct iwl_cfg iwl6000i_2abg_cfg = {
300 	.name = "Intel(R) Centrino(R) Advanced-N 6200 ABG",
301 	IWL_DEVICE_6000i,
302 };
303 
304 const struct iwl_cfg iwl6000i_2bg_cfg = {
305 	.name = "Intel(R) Centrino(R) Advanced-N 6200 BG",
306 	IWL_DEVICE_6000i,
307 };
308 
309 #define IWL_DEVICE_6050						\
310 	.fw_name_pre = IWL6050_FW_PRE,				\
311 	.ucode_api_max = IWL6050_UCODE_API_MAX,			\
312 	.ucode_api_min = IWL6050_UCODE_API_MIN,			\
313 	.device_family = IWL_DEVICE_FAMILY_6050,		\
314 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
315 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
316 	.valid_tx_ant = ANT_AB,		/* .cfg overwrite */	\
317 	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */	\
318 	.nvm_ver = EEPROM_6050_EEPROM_VERSION,		\
319 	.nvm_calib_ver = EEPROM_6050_TX_POWER_VERSION,	\
320 	.base_params = &iwl6050_base_params,			\
321 	.eeprom_params = &iwl6000_eeprom_params,		\
322 	.led_mode = IWL_LED_BLINK,				\
323 	.internal_wimax_coex = true,				\
324 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
325 	.csr = &iwl_csr_v1
326 
327 const struct iwl_cfg iwl6050_2agn_cfg = {
328 	.name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN",
329 	IWL_DEVICE_6050,
330 	.ht_params = &iwl6000_ht_params,
331 };
332 
333 const struct iwl_cfg iwl6050_2abg_cfg = {
334 	.name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 ABG",
335 	IWL_DEVICE_6050,
336 };
337 
338 #define IWL_DEVICE_6150						\
339 	.fw_name_pre = IWL6050_FW_PRE,				\
340 	.ucode_api_max = IWL6050_UCODE_API_MAX,			\
341 	.ucode_api_min = IWL6050_UCODE_API_MIN,			\
342 	.device_family = IWL_DEVICE_FAMILY_6150,		\
343 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
344 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
345 	.nvm_ver = EEPROM_6150_EEPROM_VERSION,		\
346 	.nvm_calib_ver = EEPROM_6150_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 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
352 	.csr = &iwl_csr_v1
353 
354 const struct iwl_cfg iwl6150_bgn_cfg = {
355 	.name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN",
356 	IWL_DEVICE_6150,
357 	.ht_params = &iwl6000_ht_params,
358 };
359 
360 const struct iwl_cfg iwl6150_bg_cfg = {
361 	.name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BG",
362 	IWL_DEVICE_6150,
363 };
364 
365 const struct iwl_cfg iwl6000_3agn_cfg = {
366 	.name = "Intel(R) Centrino(R) Ultimate-N 6300 AGN",
367 	.fw_name_pre = IWL6000_FW_PRE,
368 	.ucode_api_max = IWL6000_UCODE_API_MAX,
369 	.ucode_api_min = IWL6000_UCODE_API_MIN,
370 	.device_family = IWL_DEVICE_FAMILY_6000,
371 	.max_inst_size = IWL60_RTC_INST_SIZE,
372 	.max_data_size = IWL60_RTC_DATA_SIZE,
373 	.nvm_ver = EEPROM_6000_EEPROM_VERSION,
374 	.nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION,
375 	.base_params = &iwl6000_base_params,
376 	.eeprom_params = &iwl6000_eeprom_params,
377 	.ht_params = &iwl6000_ht_params,
378 	.led_mode = IWL_LED_BLINK,
379 	.csr = &iwl_csr_v1,
380 };
381 
382 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
383 MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
384 MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
385 MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
386