wifi: iwlwifi: remove 'use_tfh' config to fix crash
[platform/kernel/linux-starfive.git] / drivers / net / wireless / intel / iwlwifi / cfg / 22000.c
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.rf_id = true,                                            \
88         .trans.gen2 = true,                                             \
89         .nvm_type = IWL_NVM_EXT,                                        \
90         .dbgc_supported = true,                                         \
91         .min_umac_error_event_table = 0x400000,                         \
92         .d3_debug_data_base_addr = 0x401000,                            \
93         .d3_debug_data_length = 60 * 1024,                              \
94         .mon_smem_regs = {                                              \
95                 .write_ptr = {                                          \
96                         .addr = LDBG_M2S_BUF_WPTR,                      \
97                         .mask = LDBG_M2S_BUF_WPTR_VAL_MSK,              \
98         },                                                              \
99                 .cycle_cnt = {                                          \
100                         .addr = LDBG_M2S_BUF_WRAP_CNT,                  \
101                         .mask = LDBG_M2S_BUF_WRAP_CNT_VAL_MSK,          \
102                 },                                                      \
103         }
104
105 #define IWL_DEVICE_22500                                                \
106         IWL_DEVICE_22000_COMMON,                                        \
107         .ucode_api_max = IWL_22000_UCODE_API_MAX,                       \
108         .trans.device_family = IWL_DEVICE_FAMILY_22000,                 \
109         .trans.base_params = &iwl_22000_base_params,                    \
110         .gp2_reg_addr = 0xa02c68,                                       \
111         .mon_dram_regs = {                                              \
112                 .write_ptr = {                                          \
113                         .addr = MON_BUFF_WRPTR_VER2,                    \
114                         .mask = 0xffffffff,                             \
115                 },                                                      \
116                 .cycle_cnt = {                                          \
117                         .addr = MON_BUFF_CYCLE_CNT_VER2,                \
118                         .mask = 0xffffffff,                             \
119                 },                                                      \
120         }
121
122 const struct iwl_cfg_trans_params iwl_qu_trans_cfg = {
123         .mq_rx_supported = true,
124         .rf_id = true,
125         .gen2 = true,
126         .device_family = IWL_DEVICE_FAMILY_22000,
127         .base_params = &iwl_22000_base_params,
128         .integrated = true,
129         .xtal_latency = 500,
130         .ltr_delay = IWL_CFG_TRANS_LTR_DELAY_200US,
131 };
132
133 const struct iwl_cfg_trans_params iwl_qu_medium_latency_trans_cfg = {
134         .mq_rx_supported = true,
135         .rf_id = true,
136         .gen2 = true,
137         .device_family = IWL_DEVICE_FAMILY_22000,
138         .base_params = &iwl_22000_base_params,
139         .integrated = true,
140         .xtal_latency = 1820,
141         .ltr_delay = IWL_CFG_TRANS_LTR_DELAY_1820US,
142 };
143
144 const struct iwl_cfg_trans_params iwl_qu_long_latency_trans_cfg = {
145         .mq_rx_supported = true,
146         .rf_id = true,
147         .gen2 = true,
148         .device_family = IWL_DEVICE_FAMILY_22000,
149         .base_params = &iwl_22000_base_params,
150         .integrated = true,
151         .xtal_latency = 12000,
152         .low_latency_xtal = true,
153         .ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US,
154 };
155
156 /*
157  * If the device doesn't support HE, no need to have that many buffers.
158  * 22000 devices can split multiple frames into a single RB, so fewer are
159  * needed; AX210 cannot (but use smaller RBs by default) - these sizes
160  * were picked according to 8 MSDUs inside 256 A-MSDUs in an A-MPDU, with
161  * additional overhead to account for processing time.
162  */
163 #define IWL_NUM_RBDS_NON_HE             512
164 #define IWL_NUM_RBDS_22000_HE           2048
165
166 /*
167  * All JF radio modules are part of the 9000 series, but the MAC part
168  * looks more like 22000.  That's why this device is here, but called
169  * 9560 nevertheless.
170  */
171 const struct iwl_cfg iwl9560_qu_b0_jf_b0_cfg = {
172         .fw_name_pre = IWL_QU_B_JF_B_FW_PRE,
173         IWL_DEVICE_22500,
174         .num_rbds = IWL_NUM_RBDS_NON_HE,
175 };
176
177 const struct iwl_cfg iwl9560_qu_c0_jf_b0_cfg = {
178         .fw_name_pre = IWL_QU_C_JF_B_FW_PRE,
179         IWL_DEVICE_22500,
180         .num_rbds = IWL_NUM_RBDS_NON_HE,
181 };
182
183 const struct iwl_cfg iwl9560_quz_a0_jf_b0_cfg = {
184         .fw_name_pre = IWL_QUZ_A_JF_B_FW_PRE,
185         IWL_DEVICE_22500,
186         /*
187          * This device doesn't support receiving BlockAck with a large bitmap
188          * so we need to restrict the size of transmitted aggregation to the
189          * HT size; mac80211 would otherwise pick the HE max (256) by default.
190          */
191         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
192         .num_rbds = IWL_NUM_RBDS_NON_HE,
193 };
194
195 const struct iwl_cfg_trans_params iwl_ax200_trans_cfg = {
196         .device_family = IWL_DEVICE_FAMILY_22000,
197         .base_params = &iwl_22000_base_params,
198         .mq_rx_supported = true,
199         .rf_id = true,
200         .gen2 = true,
201         .bisr_workaround = 1,
202 };
203
204 const char iwl_ax101_name[] = "Intel(R) Wi-Fi 6 AX101";
205 const char iwl_ax200_name[] = "Intel(R) Wi-Fi 6 AX200 160MHz";
206 const char iwl_ax201_name[] = "Intel(R) Wi-Fi 6 AX201 160MHz";
207 const char iwl_ax203_name[] = "Intel(R) Wi-Fi 6 AX203";
208 const char iwl_ax204_name[] = "Intel(R) Wi-Fi 6 AX204 160MHz";
209
210 const char iwl_ax200_killer_1650w_name[] =
211         "Killer(R) Wi-Fi 6 AX1650w 160MHz Wireless Network Adapter (200D2W)";
212 const char iwl_ax200_killer_1650x_name[] =
213         "Killer(R) Wi-Fi 6 AX1650x 160MHz Wireless Network Adapter (200NGW)";
214 const char iwl_ax201_killer_1650s_name[] =
215         "Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201D2W)";
216 const char iwl_ax201_killer_1650i_name[] =
217         "Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201NGW)";
218
219 const struct iwl_cfg iwl_qu_b0_hr1_b0 = {
220         .fw_name_pre = IWL_QU_B_HR_B_FW_PRE,
221         IWL_DEVICE_22500,
222         /*
223          * This device doesn't support receiving BlockAck with a large bitmap
224          * so we need to restrict the size of transmitted aggregation to the
225          * HT size; mac80211 would otherwise pick the HE max (256) by default.
226          */
227         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
228         .tx_with_siso_diversity = true,
229         .num_rbds = IWL_NUM_RBDS_22000_HE,
230 };
231
232 const struct iwl_cfg iwl_qu_b0_hr_b0 = {
233         .fw_name_pre = IWL_QU_B_HR_B_FW_PRE,
234         IWL_DEVICE_22500,
235         /*
236          * This device doesn't support receiving BlockAck with a large bitmap
237          * so we need to restrict the size of transmitted aggregation to the
238          * HT size; mac80211 would otherwise pick the HE max (256) by default.
239          */
240         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
241         .num_rbds = IWL_NUM_RBDS_22000_HE,
242 };
243
244 const struct iwl_cfg iwl_ax201_cfg_qu_hr = {
245         .name = "Intel(R) Wi-Fi 6 AX201 160MHz",
246         .fw_name_pre = IWL_QU_B_HR_B_FW_PRE,
247         IWL_DEVICE_22500,
248         /*
249          * This device doesn't support receiving BlockAck with a large bitmap
250          * so we need to restrict the size of transmitted aggregation to the
251          * HT size; mac80211 would otherwise pick the HE max (256) by default.
252          */
253         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
254         .num_rbds = IWL_NUM_RBDS_22000_HE,
255 };
256
257 const struct iwl_cfg iwl_qu_c0_hr1_b0 = {
258         .fw_name_pre = IWL_QU_C_HR_B_FW_PRE,
259         IWL_DEVICE_22500,
260         /*
261          * This device doesn't support receiving BlockAck with a large bitmap
262          * so we need to restrict the size of transmitted aggregation to the
263          * HT size; mac80211 would otherwise pick the HE max (256) by default.
264          */
265         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
266         .tx_with_siso_diversity = true,
267         .num_rbds = IWL_NUM_RBDS_22000_HE,
268 };
269
270 const struct iwl_cfg iwl_qu_c0_hr_b0 = {
271         .fw_name_pre = IWL_QU_C_HR_B_FW_PRE,
272         IWL_DEVICE_22500,
273         /*
274          * This device doesn't support receiving BlockAck with a large bitmap
275          * so we need to restrict the size of transmitted aggregation to the
276          * HT size; mac80211 would otherwise pick the HE max (256) by default.
277          */
278         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
279         .num_rbds = IWL_NUM_RBDS_22000_HE,
280 };
281
282 const struct iwl_cfg iwl_ax201_cfg_qu_c0_hr_b0 = {
283         .name = "Intel(R) Wi-Fi 6 AX201 160MHz",
284         .fw_name_pre = IWL_QU_C_HR_B_FW_PRE,
285         IWL_DEVICE_22500,
286         /*
287          * This device doesn't support receiving BlockAck with a large bitmap
288          * so we need to restrict the size of transmitted aggregation to the
289          * HT size; mac80211 would otherwise pick the HE max (256) by default.
290          */
291         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
292         .num_rbds = IWL_NUM_RBDS_22000_HE,
293 };
294
295 const struct iwl_cfg iwl_quz_a0_hr1_b0 = {
296         .fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
297         IWL_DEVICE_22500,
298         /*
299          * This device doesn't support receiving BlockAck with a large bitmap
300          * so we need to restrict the size of transmitted aggregation to the
301          * HT size; mac80211 would otherwise pick the HE max (256) by default.
302          */
303         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
304         .tx_with_siso_diversity = true,
305         .num_rbds = IWL_NUM_RBDS_22000_HE,
306 };
307
308 const struct iwl_cfg iwl_ax201_cfg_quz_hr = {
309         .name = "Intel(R) Wi-Fi 6 AX201 160MHz",
310         .fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
311         IWL_DEVICE_22500,
312         /*
313          * This device doesn't support receiving BlockAck with a large bitmap
314          * so we need to restrict the size of transmitted aggregation to the
315          * HT size; mac80211 would otherwise pick the HE max (256) by default.
316          */
317         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
318         .num_rbds = IWL_NUM_RBDS_22000_HE,
319 };
320
321 const struct iwl_cfg iwl_ax1650s_cfg_quz_hr = {
322         .name = "Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201D2W)",
323         .fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
324         IWL_DEVICE_22500,
325         /*
326          * This device doesn't support receiving BlockAck with a large bitmap
327          * so we need to restrict the size of transmitted aggregation to the
328          * HT size; mac80211 would otherwise pick the HE max (256) by default.
329          */
330         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
331         .num_rbds = IWL_NUM_RBDS_22000_HE,
332 };
333
334 const struct iwl_cfg iwl_ax1650i_cfg_quz_hr = {
335         .name = "Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201NGW)",
336         .fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
337         IWL_DEVICE_22500,
338         /*
339          * This device doesn't support receiving BlockAck with a large bitmap
340          * so we need to restrict the size of transmitted aggregation to the
341          * HT size; mac80211 would otherwise pick the HE max (256) by default.
342          */
343         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
344         .num_rbds = IWL_NUM_RBDS_22000_HE,
345 };
346
347 const struct iwl_cfg iwl_ax200_cfg_cc = {
348         .fw_name_pre = IWL_CC_A_FW_PRE,
349         IWL_DEVICE_22500,
350         /*
351          * This device doesn't support receiving BlockAck with a large bitmap
352          * so we need to restrict the size of transmitted aggregation to the
353          * HT size; mac80211 would otherwise pick the HE max (256) by default.
354          */
355         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
356         .num_rbds = IWL_NUM_RBDS_22000_HE,
357 };
358
359 const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0 = {
360         .name = "Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201NGW)",
361         .fw_name_pre = IWL_QU_B_HR_B_FW_PRE,
362         IWL_DEVICE_22500,
363         /*
364          * This device doesn't support receiving BlockAck with a large bitmap
365          * so we need to restrict the size of transmitted aggregation to the
366          * HT size; mac80211 would otherwise pick the HE max (256) by default.
367          */
368         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
369         .num_rbds = IWL_NUM_RBDS_22000_HE,
370 };
371
372 const struct iwl_cfg killer1650i_2ax_cfg_qu_b0_hr_b0 = {
373         .name = "Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201D2W)",
374         .fw_name_pre = IWL_QU_B_HR_B_FW_PRE,
375         IWL_DEVICE_22500,
376         /*
377          * This device doesn't support receiving BlockAck with a large bitmap
378          * so we need to restrict the size of transmitted aggregation to the
379          * HT size; mac80211 would otherwise pick the HE max (256) by default.
380          */
381         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
382         .num_rbds = IWL_NUM_RBDS_22000_HE,
383 };
384
385 const struct iwl_cfg killer1650s_2ax_cfg_qu_c0_hr_b0 = {
386         .name = "Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201NGW)",
387         .fw_name_pre = IWL_QU_C_HR_B_FW_PRE,
388         IWL_DEVICE_22500,
389         /*
390          * This device doesn't support receiving BlockAck with a large bitmap
391          * so we need to restrict the size of transmitted aggregation to the
392          * HT size; mac80211 would otherwise pick the HE max (256) by default.
393          */
394         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
395         .num_rbds = IWL_NUM_RBDS_22000_HE,
396 };
397
398 const struct iwl_cfg killer1650i_2ax_cfg_qu_c0_hr_b0 = {
399         .name = "Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201D2W)",
400         .fw_name_pre = IWL_QU_C_HR_B_FW_PRE,
401         IWL_DEVICE_22500,
402         /*
403          * This device doesn't support receiving BlockAck with a large bitmap
404          * so we need to restrict the size of transmitted aggregation to the
405          * HT size; mac80211 would otherwise pick the HE max (256) by default.
406          */
407         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
408         .num_rbds = IWL_NUM_RBDS_22000_HE,
409 };
410
411 const struct iwl_cfg iwl_cfg_quz_a0_hr_b0 = {
412         .fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
413         IWL_DEVICE_22500,
414         /*
415          * This device doesn't support receiving BlockAck with a large bitmap
416          * so we need to restrict the size of transmitted aggregation to the
417          * HT size; mac80211 would otherwise pick the HE max (256) by default.
418          */
419         .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
420         .num_rbds = IWL_NUM_RBDS_22000_HE,
421 };
422
423 MODULE_FIRMWARE(IWL_QU_B_HR_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
424 MODULE_FIRMWARE(IWL_QU_C_HR_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
425 MODULE_FIRMWARE(IWL_QU_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
426 MODULE_FIRMWARE(IWL_QUZ_A_HR_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
427 MODULE_FIRMWARE(IWL_QUZ_A_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
428 MODULE_FIRMWARE(IWL_CC_A_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));