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