1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /*
3  * Copyright (C) 2015-2017 Intel Deutschland GmbH
4  * Copyright (C) 2018-2023 Intel Corporation
5  */
6 #include <linux/module.h>
7 #include <linux/stringify.h>
8 #include "iwl-config.h"
9 #include "iwl-prph.h"
10 #include "fw/api/txq.h"
11 
12 /* Highest firmware API version supported */
13 #define IWL_22000_UCODE_API_MAX	77
14 
15 /* Lowest firmware API version supported */
16 #define IWL_22000_UCODE_API_MIN	50
17 
18 /* NVM versions */
19 #define IWL_22000_NVM_VERSION		0x0a1d
20 
21 /* Memory offsets and lengths */
22 #define IWL_22000_DCCM_OFFSET		0x800000 /* LMAC1 */
23 #define IWL_22000_DCCM_LEN		0x10000 /* LMAC1 */
24 #define IWL_22000_DCCM2_OFFSET		0x880000
25 #define IWL_22000_DCCM2_LEN		0x8000
26 #define IWL_22000_SMEM_OFFSET		0x400000
27 #define IWL_22000_SMEM_LEN		0xD0000
28 
29 #define IWL_QU_B_HR_B_FW_PRE		"iwlwifi-Qu-b0-hr-b0"
30 #define IWL_QU_C_HR_B_FW_PRE		"iwlwifi-Qu-c0-hr-b0"
31 #define IWL_QU_B_JF_B_FW_PRE		"iwlwifi-Qu-b0-jf-b0"
32 #define IWL_QU_C_JF_B_FW_PRE		"iwlwifi-Qu-c0-jf-b0"
33 #define IWL_QUZ_A_HR_B_FW_PRE		"iwlwifi-QuZ-a0-hr-b0"
34 #define IWL_QUZ_A_JF_B_FW_PRE		"iwlwifi-QuZ-a0-jf-b0"
35 #define IWL_CC_A_FW_PRE			"iwlwifi-cc-a0"
36 
37 #define IWL_QU_B_HR_B_MODULE_FIRMWARE(api) \
38 	IWL_QU_B_HR_B_FW_PRE "-" __stringify(api) ".ucode"
39 #define IWL_QUZ_A_HR_B_MODULE_FIRMWARE(api) \
40 	IWL_QUZ_A_HR_B_FW_PRE "-" __stringify(api) ".ucode"
41 #define IWL_QUZ_A_JF_B_MODULE_FIRMWARE(api) \
42 	IWL_QUZ_A_JF_B_FW_PRE "-" __stringify(api) ".ucode"
43 #define IWL_QU_C_HR_B_MODULE_FIRMWARE(api) \
44 	IWL_QU_C_HR_B_FW_PRE "-" __stringify(api) ".ucode"
45 #define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \
46 	IWL_QU_B_JF_B_FW_PRE "-" __stringify(api) ".ucode"
47 #define IWL_CC_A_MODULE_FIRMWARE(api)			\
48 	IWL_CC_A_FW_PRE "-" __stringify(api) ".ucode"
49 
50 static const struct iwl_base_params iwl_22000_base_params = {
51 	.eeprom_size = OTP_LOW_IMAGE_SIZE_32K,
52 	.num_of_queues = 512,
53 	.max_tfd_queue_size = 256,
54 	.shadow_ram_support = true,
55 	.led_compensation = 57,
56 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
57 	.max_event_log_size = 512,
58 	.shadow_reg_enable = true,
59 	.pcie_l1_allowed = true,
60 };
61 
62 const struct iwl_ht_params iwl_22000_ht_params = {
63 	.stbc = true,
64 	.ldpc = true,
65 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ) |
66 		      BIT(NL80211_BAND_6GHZ),
67 };
68 
69 #define IWL_DEVICE_22000_COMMON						\
70 	.ucode_api_min = IWL_22000_UCODE_API_MIN,			\
71 	.led_mode = IWL_LED_RF_STATE,					\
72 	.nvm_hw_section_num = 10,					\
73 	.non_shared_ant = ANT_B,					\
74 	.dccm_offset = IWL_22000_DCCM_OFFSET,				\
75 	.dccm_len = IWL_22000_DCCM_LEN,					\
76 	.dccm2_offset = IWL_22000_DCCM2_OFFSET,				\
77 	.dccm2_len = IWL_22000_DCCM2_LEN,				\
78 	.smem_offset = IWL_22000_SMEM_OFFSET,				\
79 	.smem_len = IWL_22000_SMEM_LEN,					\
80 	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,		\
81 	.apmg_not_supported = true,					\
82 	.trans.mq_rx_supported = true,					\
83 	.vht_mu_mimo_supported = true,					\
84 	.mac_addr_from_csr = 0x380,					\
85 	.ht_params = &iwl_22000_ht_params,				\
86 	.nvm_ver = IWL_22000_NVM_VERSION,				\
87 	.trans.use_tfh = true,						\
88 	.trans.rf_id = true,						\
89 	.trans.gen2 = true,						\
90 	.nvm_type = IWL_NVM_EXT,					\
91 	.dbgc_supported = true,						\
92 	.min_umac_error_event_table = 0x400000,				\
93 	.d3_debug_data_base_addr = 0x401000,				\
94 	.d3_debug_data_length = 60 * 1024,				\
95 	.mon_smem_regs = {						\
96 		.write_ptr = {						\
97 			.addr = LDBG_M2S_BUF_WPTR,			\
98 			.mask = LDBG_M2S_BUF_WPTR_VAL_MSK,		\
99 	},								\
100 		.cycle_cnt = {						\
101 			.addr = LDBG_M2S_BUF_WRAP_CNT,			\
102 			.mask = LDBG_M2S_BUF_WRAP_CNT_VAL_MSK,		\
103 		},							\
104 	}
105 
106 #define IWL_DEVICE_22500						\
107 	IWL_DEVICE_22000_COMMON,					\
108 	.ucode_api_max = IWL_22000_UCODE_API_MAX,			\
109 	.trans.device_family = IWL_DEVICE_FAMILY_22000,			\
110 	.trans.base_params = &iwl_22000_base_params,			\
111 	.gp2_reg_addr = 0xa02c68,					\
112 	.mon_dram_regs = {						\
113 		.write_ptr = {						\
114 			.addr = MON_BUFF_WRPTR_VER2,			\
115 			.mask = 0xffffffff,				\
116 		},							\
117 		.cycle_cnt = {						\
118 			.addr = MON_BUFF_CYCLE_CNT_VER2,		\
119 			.mask = 0xffffffff,				\
120 		},							\
121 	}
122 
123 const struct iwl_cfg_trans_params iwl_qu_trans_cfg = {
124 	.mq_rx_supported = true,
125 	.use_tfh = true,
126 	.rf_id = true,
127 	.gen2 = true,
128 	.device_family = IWL_DEVICE_FAMILY_22000,
129 	.base_params = &iwl_22000_base_params,
130 	.integrated = true,
131 	.xtal_latency = 500,
132 	.ltr_delay = IWL_CFG_TRANS_LTR_DELAY_200US,
133 };
134 
135 const struct iwl_cfg_trans_params iwl_qu_medium_latency_trans_cfg = {
136 	.mq_rx_supported = true,
137 	.use_tfh = true,
138 	.rf_id = true,
139 	.gen2 = true,
140 	.device_family = IWL_DEVICE_FAMILY_22000,
141 	.base_params = &iwl_22000_base_params,
142 	.integrated = true,
143 	.xtal_latency = 1820,
144 	.ltr_delay = IWL_CFG_TRANS_LTR_DELAY_1820US,
145 };
146 
147 const struct iwl_cfg_trans_params iwl_qu_long_latency_trans_cfg = {
148 	.mq_rx_supported = true,
149 	.use_tfh = true,
150 	.rf_id = true,
151 	.gen2 = true,
152 	.device_family = IWL_DEVICE_FAMILY_22000,
153 	.base_params = &iwl_22000_base_params,
154 	.integrated = true,
155 	.xtal_latency = 12000,
156 	.low_latency_xtal = true,
157 	.ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US,
158 };
159 
160 /*
161  * If the device doesn't support HE, no need to have that many buffers.
162  * 22000 devices can split multiple frames into a single RB, so fewer are
163  * needed; AX210 cannot (but use smaller RBs by default) - these sizes
164  * were picked according to 8 MSDUs inside 256 A-MSDUs in an A-MPDU, with
165  * additional overhead to account for processing time.
166  */
167 #define IWL_NUM_RBDS_NON_HE		512
168 #define IWL_NUM_RBDS_22000_HE		2048
169 
170 /*
171  * All JF radio modules are part of the 9000 series, but the MAC part
172  * looks more like 22000.  That's why this device is here, but called
173  * 9560 nevertheless.
174  */
175 const struct iwl_cfg iwl9560_qu_b0_jf_b0_cfg = {
176 	.fw_name_pre = IWL_QU_B_JF_B_FW_PRE,
177 	IWL_DEVICE_22500,
178 	.num_rbds = IWL_NUM_RBDS_NON_HE,
179 };
180 
181 const struct iwl_cfg iwl9560_qu_c0_jf_b0_cfg = {
182 	.fw_name_pre = IWL_QU_C_JF_B_FW_PRE,
183 	IWL_DEVICE_22500,
184 	.num_rbds = IWL_NUM_RBDS_NON_HE,
185 };
186 
187 const struct iwl_cfg iwl9560_quz_a0_jf_b0_cfg = {
188 	.fw_name_pre = IWL_QUZ_A_JF_B_FW_PRE,
189 	IWL_DEVICE_22500,
190 	/*
191 	 * This device doesn't support receiving BlockAck with a large bitmap
192 	 * so we need to restrict the size of transmitted aggregation to the
193 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
194 	 */
195 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
196 	.num_rbds = IWL_NUM_RBDS_NON_HE,
197 };
198 
199 const struct iwl_cfg_trans_params iwl_ax200_trans_cfg = {
200 	.device_family = IWL_DEVICE_FAMILY_22000,
201 	.base_params = &iwl_22000_base_params,
202 	.mq_rx_supported = true,
203 	.use_tfh = true,
204 	.rf_id = true,
205 	.gen2 = true,
206 	.bisr_workaround = 1,
207 };
208 
209 const char iwl_ax101_name[] = "Intel(R) Wi-Fi 6 AX101";
210 const char iwl_ax200_name[] = "Intel(R) Wi-Fi 6 AX200 160MHz";
211 const char iwl_ax201_name[] = "Intel(R) Wi-Fi 6 AX201 160MHz";
212 const char iwl_ax203_name[] = "Intel(R) Wi-Fi 6 AX203";
213 const char iwl_ax204_name[] = "Intel(R) Wi-Fi 6 AX204 160MHz";
214 
215 const char iwl_ax200_killer_1650w_name[] =
216 	"Killer(R) Wi-Fi 6 AX1650w 160MHz Wireless Network Adapter (200D2W)";
217 const char iwl_ax200_killer_1650x_name[] =
218 	"Killer(R) Wi-Fi 6 AX1650x 160MHz Wireless Network Adapter (200NGW)";
219 const char iwl_ax201_killer_1650s_name[] =
220 	"Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201D2W)";
221 const char iwl_ax201_killer_1650i_name[] =
222 	"Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201NGW)";
223 
224 const struct iwl_cfg iwl_qu_b0_hr1_b0 = {
225 	.fw_name_pre = IWL_QU_B_HR_B_FW_PRE,
226 	IWL_DEVICE_22500,
227 	/*
228 	 * This device doesn't support receiving BlockAck with a large bitmap
229 	 * so we need to restrict the size of transmitted aggregation to the
230 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
231 	 */
232 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
233 	.tx_with_siso_diversity = true,
234 	.num_rbds = IWL_NUM_RBDS_22000_HE,
235 };
236 
237 const struct iwl_cfg iwl_qu_b0_hr_b0 = {
238 	.fw_name_pre = IWL_QU_B_HR_B_FW_PRE,
239 	IWL_DEVICE_22500,
240 	/*
241 	 * This device doesn't support receiving BlockAck with a large bitmap
242 	 * so we need to restrict the size of transmitted aggregation to the
243 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
244 	 */
245 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
246 	.num_rbds = IWL_NUM_RBDS_22000_HE,
247 };
248 
249 const struct iwl_cfg iwl_ax201_cfg_qu_hr = {
250 	.name = "Intel(R) Wi-Fi 6 AX201 160MHz",
251 	.fw_name_pre = IWL_QU_B_HR_B_FW_PRE,
252 	IWL_DEVICE_22500,
253 	/*
254 	 * This device doesn't support receiving BlockAck with a large bitmap
255 	 * so we need to restrict the size of transmitted aggregation to the
256 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
257 	 */
258 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
259 	.num_rbds = IWL_NUM_RBDS_22000_HE,
260 };
261 
262 const struct iwl_cfg iwl_qu_c0_hr1_b0 = {
263 	.fw_name_pre = IWL_QU_C_HR_B_FW_PRE,
264 	IWL_DEVICE_22500,
265 	/*
266 	 * This device doesn't support receiving BlockAck with a large bitmap
267 	 * so we need to restrict the size of transmitted aggregation to the
268 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
269 	 */
270 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
271 	.tx_with_siso_diversity = true,
272 	.num_rbds = IWL_NUM_RBDS_22000_HE,
273 };
274 
275 const struct iwl_cfg iwl_qu_c0_hr_b0 = {
276 	.fw_name_pre = IWL_QU_C_HR_B_FW_PRE,
277 	IWL_DEVICE_22500,
278 	/*
279 	 * This device doesn't support receiving BlockAck with a large bitmap
280 	 * so we need to restrict the size of transmitted aggregation to the
281 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
282 	 */
283 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
284 	.num_rbds = IWL_NUM_RBDS_22000_HE,
285 };
286 
287 const struct iwl_cfg iwl_ax201_cfg_qu_c0_hr_b0 = {
288 	.name = "Intel(R) Wi-Fi 6 AX201 160MHz",
289 	.fw_name_pre = IWL_QU_C_HR_B_FW_PRE,
290 	IWL_DEVICE_22500,
291 	/*
292 	 * This device doesn't support receiving BlockAck with a large bitmap
293 	 * so we need to restrict the size of transmitted aggregation to the
294 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
295 	 */
296 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
297 	.num_rbds = IWL_NUM_RBDS_22000_HE,
298 };
299 
300 const struct iwl_cfg iwl_quz_a0_hr1_b0 = {
301 	.fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
302 	IWL_DEVICE_22500,
303 	/*
304 	 * This device doesn't support receiving BlockAck with a large bitmap
305 	 * so we need to restrict the size of transmitted aggregation to the
306 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
307 	 */
308 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
309 	.tx_with_siso_diversity = true,
310 	.num_rbds = IWL_NUM_RBDS_22000_HE,
311 };
312 
313 const struct iwl_cfg iwl_ax201_cfg_quz_hr = {
314 	.name = "Intel(R) Wi-Fi 6 AX201 160MHz",
315 	.fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
316 	IWL_DEVICE_22500,
317 	/*
318          * This device doesn't support receiving BlockAck with a large bitmap
319          * so we need to restrict the size of transmitted aggregation to the
320          * HT size; mac80211 would otherwise pick the HE max (256) by default.
321          */
322 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
323 	.num_rbds = IWL_NUM_RBDS_22000_HE,
324 };
325 
326 const struct iwl_cfg iwl_ax1650s_cfg_quz_hr = {
327 	.name = "Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201D2W)",
328 	.fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
329 	IWL_DEVICE_22500,
330 	/*
331          * This device doesn't support receiving BlockAck with a large bitmap
332          * so we need to restrict the size of transmitted aggregation to the
333          * HT size; mac80211 would otherwise pick the HE max (256) by default.
334          */
335 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
336 	.num_rbds = IWL_NUM_RBDS_22000_HE,
337 };
338 
339 const struct iwl_cfg iwl_ax1650i_cfg_quz_hr = {
340 	.name = "Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201NGW)",
341 	.fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
342 	IWL_DEVICE_22500,
343 	/*
344          * This device doesn't support receiving BlockAck with a large bitmap
345          * so we need to restrict the size of transmitted aggregation to the
346          * HT size; mac80211 would otherwise pick the HE max (256) by default.
347          */
348 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
349 	.num_rbds = IWL_NUM_RBDS_22000_HE,
350 };
351 
352 const struct iwl_cfg iwl_ax200_cfg_cc = {
353 	.fw_name_pre = IWL_CC_A_FW_PRE,
354 	IWL_DEVICE_22500,
355 	/*
356 	 * This device doesn't support receiving BlockAck with a large bitmap
357 	 * so we need to restrict the size of transmitted aggregation to the
358 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
359 	 */
360 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
361 	.num_rbds = IWL_NUM_RBDS_22000_HE,
362 };
363 
364 const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0 = {
365 	.name = "Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201NGW)",
366 	.fw_name_pre = IWL_QU_B_HR_B_FW_PRE,
367 	IWL_DEVICE_22500,
368 	/*
369 	 * This device doesn't support receiving BlockAck with a large bitmap
370 	 * so we need to restrict the size of transmitted aggregation to the
371 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
372 	 */
373 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
374 	.num_rbds = IWL_NUM_RBDS_22000_HE,
375 };
376 
377 const struct iwl_cfg killer1650i_2ax_cfg_qu_b0_hr_b0 = {
378 	.name = "Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201D2W)",
379 	.fw_name_pre = IWL_QU_B_HR_B_FW_PRE,
380 	IWL_DEVICE_22500,
381 	/*
382 	 * This device doesn't support receiving BlockAck with a large bitmap
383 	 * so we need to restrict the size of transmitted aggregation to the
384 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
385 	 */
386 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
387 	.num_rbds = IWL_NUM_RBDS_22000_HE,
388 };
389 
390 const struct iwl_cfg killer1650s_2ax_cfg_qu_c0_hr_b0 = {
391 	.name = "Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201NGW)",
392 	.fw_name_pre = IWL_QU_C_HR_B_FW_PRE,
393 	IWL_DEVICE_22500,
394 	/*
395 	 * This device doesn't support receiving BlockAck with a large bitmap
396 	 * so we need to restrict the size of transmitted aggregation to the
397 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
398 	 */
399 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
400 	.num_rbds = IWL_NUM_RBDS_22000_HE,
401 };
402 
403 const struct iwl_cfg killer1650i_2ax_cfg_qu_c0_hr_b0 = {
404 	.name = "Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201D2W)",
405 	.fw_name_pre = IWL_QU_C_HR_B_FW_PRE,
406 	IWL_DEVICE_22500,
407 	/*
408 	 * This device doesn't support receiving BlockAck with a large bitmap
409 	 * so we need to restrict the size of transmitted aggregation to the
410 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
411 	 */
412 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
413 	.num_rbds = IWL_NUM_RBDS_22000_HE,
414 };
415 
416 const struct iwl_cfg iwl_cfg_quz_a0_hr_b0 = {
417 	.fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
418 	IWL_DEVICE_22500,
419 	/*
420 	 * This device doesn't support receiving BlockAck with a large bitmap
421 	 * so we need to restrict the size of transmitted aggregation to the
422 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
423 	 */
424 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
425 	.num_rbds = IWL_NUM_RBDS_22000_HE,
426 };
427 
428 MODULE_FIRMWARE(IWL_QU_B_HR_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
429 MODULE_FIRMWARE(IWL_QU_C_HR_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
430 MODULE_FIRMWARE(IWL_QU_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
431 MODULE_FIRMWARE(IWL_QUZ_A_HR_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
432 MODULE_FIRMWARE(IWL_QUZ_A_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
433 MODULE_FIRMWARE(IWL_CC_A_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
434