Merge tag 'drm-fixes-2018-08-03' of git://anongit.freedesktop.org/drm/drm
[sfrench/cifs-2.6.git] / drivers / net / wireless / intel / iwlwifi / cfg / 9000.c
1 /******************************************************************************
2  *
3  * This file is provided under a dual BSD/GPLv2 license.  When using or
4  * redistributing this file, you may do so under either license.
5  *
6  * GPL LICENSE SUMMARY
7  *
8  * Copyright(c) 2015-2017 Intel Deutschland GmbH
9  * Copyright (C) 2018 Intel Corporation
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of version 2 of the GNU General Public License as
13  * published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  *
20  * BSD LICENSE
21  *
22  * Copyright(c) 2015-2017 Intel Deutschland GmbH
23  * Copyright (C) 2018 Intel Corporation
24  * All rights reserved.
25  *
26  * Redistribution and use in source and binary forms, with or without
27  * modification, are permitted provided that the following conditions
28  * are met:
29  *
30  *  * Redistributions of source code must retain the above copyright
31  *    notice, this list of conditions and the following disclaimer.
32  *  * Redistributions in binary form must reproduce the above copyright
33  *    notice, this list of conditions and the following disclaimer in
34  *    the documentation and/or other materials provided with the
35  *    distribution.
36  *  * Neither the name Intel Corporation nor the names of its
37  *    contributors may be used to endorse or promote products derived
38  *    from this software without specific prior written permission.
39  *
40  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51  *
52  *****************************************************************************/
53
54 #include <linux/module.h>
55 #include <linux/stringify.h>
56 #include "iwl-config.h"
57 #include "fw/file.h"
58
59 /* Highest firmware API version supported */
60 #define IWL9000_UCODE_API_MAX   38
61
62 /* Lowest firmware API version supported */
63 #define IWL9000_UCODE_API_MIN   30
64
65 /* NVM versions */
66 #define IWL9000_NVM_VERSION             0x0a1d
67 #define IWL9000_TX_POWER_VERSION        0xffff /* meaningless */
68
69 /* Memory offsets and lengths */
70 #define IWL9000_DCCM_OFFSET             0x800000
71 #define IWL9000_DCCM_LEN                0x18000
72 #define IWL9000_DCCM2_OFFSET            0x880000
73 #define IWL9000_DCCM2_LEN               0x8000
74 #define IWL9000_SMEM_OFFSET             0x400000
75 #define IWL9000_SMEM_LEN                0x68000
76
77 #define  IWL9000A_FW_PRE "iwlwifi-9000-pu-a0-jf-a0-"
78 #define  IWL9000B_FW_PRE "iwlwifi-9000-pu-b0-jf-b0-"
79 #define  IWL9000RFB_FW_PRE "iwlwifi-9000-pu-a0-jf-b0-"
80 #define  IWL9260A_FW_PRE "iwlwifi-9260-th-a0-jf-a0-"
81 #define  IWL9260B_FW_PRE "iwlwifi-9260-th-b0-jf-b0-"
82 #define IWL9000A_MODULE_FIRMWARE(api) \
83         IWL9000A_FW_PRE __stringify(api) ".ucode"
84 #define IWL9000B_MODULE_FIRMWARE(api) \
85         IWL9000B_FW_PRE __stringify(api) ".ucode"
86 #define IWL9000RFB_MODULE_FIRMWARE(api) \
87         IWL9000RFB_FW_PRE __stringify(api) ".ucode"
88 #define IWL9260A_MODULE_FIRMWARE(api) \
89         IWL9260A_FW_PRE __stringify(api) ".ucode"
90 #define IWL9260B_MODULE_FIRMWARE(api) \
91         IWL9260B_FW_PRE __stringify(api) ".ucode"
92
93 #define NVM_HW_SECTION_NUM_FAMILY_9000          10
94
95 static const struct iwl_base_params iwl9000_base_params = {
96         .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_9000,
97         .num_of_queues = 31,
98         .shadow_ram_support = true,
99         .led_compensation = 57,
100         .wd_timeout = IWL_LONG_WD_TIMEOUT,
101         .max_event_log_size = 512,
102         .shadow_reg_enable = true,
103         .pcie_l1_allowed = true,
104 };
105
106 static const struct iwl_ht_params iwl9000_ht_params = {
107         .stbc = true,
108         .ldpc = true,
109         .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
110 };
111
112 static const struct iwl_tt_params iwl9000_tt_params = {
113         .ct_kill_entry = 115,
114         .ct_kill_exit = 93,
115         .ct_kill_duration = 5,
116         .dynamic_smps_entry = 111,
117         .dynamic_smps_exit = 107,
118         .tx_protection_entry = 112,
119         .tx_protection_exit = 105,
120         .tx_backoff = {
121                 {.temperature = 110, .backoff = 200},
122                 {.temperature = 111, .backoff = 600},
123                 {.temperature = 112, .backoff = 1200},
124                 {.temperature = 113, .backoff = 2000},
125                 {.temperature = 114, .backoff = 4000},
126         },
127         .support_ct_kill = true,
128         .support_dynamic_smps = true,
129         .support_tx_protection = true,
130         .support_tx_backoff = true,
131 };
132
133 #define IWL_DEVICE_9000                                                 \
134         .ucode_api_max = IWL9000_UCODE_API_MAX,                         \
135         .ucode_api_min = IWL9000_UCODE_API_MIN,                         \
136         .device_family = IWL_DEVICE_FAMILY_9000,                        \
137         .base_params = &iwl9000_base_params,                            \
138         .led_mode = IWL_LED_RF_STATE,                                   \
139         .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_9000,           \
140         .non_shared_ant = ANT_B,                                        \
141         .dccm_offset = IWL9000_DCCM_OFFSET,                             \
142         .dccm_len = IWL9000_DCCM_LEN,                                   \
143         .dccm2_offset = IWL9000_DCCM2_OFFSET,                           \
144         .dccm2_len = IWL9000_DCCM2_LEN,                                 \
145         .smem_offset = IWL9000_SMEM_OFFSET,                             \
146         .smem_len = IWL9000_SMEM_LEN,                                   \
147         .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,           \
148         .thermal_params = &iwl9000_tt_params,                           \
149         .apmg_not_supported = true,                                     \
150         .mq_rx_supported = true,                                        \
151         .vht_mu_mimo_supported = true,                                  \
152         .mac_addr_from_csr = true,                                      \
153         .rf_id = true,                                                  \
154         .nvm_type = IWL_NVM_EXT,                                        \
155         .dbgc_supported = true,                                         \
156         .min_umac_error_event_table = 0x800000,                         \
157         .csr = &iwl_csr_v1
158
159 const struct iwl_cfg iwl9160_2ac_cfg = {
160         .name = "Intel(R) Dual Band Wireless AC 9160",
161         .fw_name_pre = IWL9260A_FW_PRE,
162         .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE,
163         IWL_DEVICE_9000,
164         .ht_params = &iwl9000_ht_params,
165         .nvm_ver = IWL9000_NVM_VERSION,
166         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
167         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
168 };
169
170 const struct iwl_cfg iwl9260_2ac_cfg = {
171         .name = "Intel(R) Dual Band Wireless AC 9260",
172         .fw_name_pre = IWL9260A_FW_PRE,
173         .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE,
174         IWL_DEVICE_9000,
175         .ht_params = &iwl9000_ht_params,
176         .nvm_ver = IWL9000_NVM_VERSION,
177         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
178         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
179 };
180
181 const struct iwl_cfg iwl9260_killer_2ac_cfg = {
182         .name = "Killer (R) Wireless-AC 1550 Wireless Network Adapter (9260NGW)",
183         .fw_name_pre = IWL9260A_FW_PRE,
184         .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE,
185         IWL_DEVICE_9000,
186         .ht_params = &iwl9000_ht_params,
187         .nvm_ver = IWL9000_NVM_VERSION,
188         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
189         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
190 };
191
192 const struct iwl_cfg iwl9270_2ac_cfg = {
193         .name = "Intel(R) Dual Band Wireless AC 9270",
194         .fw_name_pre = IWL9260A_FW_PRE,
195         .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE,
196         IWL_DEVICE_9000,
197         .ht_params = &iwl9000_ht_params,
198         .nvm_ver = IWL9000_NVM_VERSION,
199         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
200         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
201 };
202
203 const struct iwl_cfg iwl9460_2ac_cfg = {
204         .name = "Intel(R) Dual Band Wireless AC 9460",
205         .fw_name_pre = IWL9260A_FW_PRE,
206         .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE,
207         IWL_DEVICE_9000,
208         .ht_params = &iwl9000_ht_params,
209         .nvm_ver = IWL9000_NVM_VERSION,
210         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
211         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
212 };
213
214 const struct iwl_cfg iwl9460_2ac_cfg_soc = {
215         .name = "Intel(R) Dual Band Wireless AC 9460",
216         .fw_name_pre = IWL9000A_FW_PRE,
217         .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
218         .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
219         IWL_DEVICE_9000,
220         .ht_params = &iwl9000_ht_params,
221         .nvm_ver = IWL9000_NVM_VERSION,
222         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
223         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
224         .integrated = true,
225         .soc_latency = 5000,
226 };
227
228 const struct iwl_cfg iwl9461_2ac_cfg_soc = {
229                 .name = "Intel(R) Dual Band Wireless AC 9461",
230                 .fw_name_pre = IWL9000A_FW_PRE,
231                 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
232                 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
233                 IWL_DEVICE_9000,
234                 .ht_params = &iwl9000_ht_params,
235                 .nvm_ver = IWL9000_NVM_VERSION,
236                 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
237                 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
238                 .integrated = true,
239                 .soc_latency = 5000,
240 };
241
242 const struct iwl_cfg iwl9462_2ac_cfg_soc = {
243                 .name = "Intel(R) Dual Band Wireless AC 9462",
244                 .fw_name_pre = IWL9000A_FW_PRE,
245                 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
246                 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
247                 IWL_DEVICE_9000,
248                 .ht_params = &iwl9000_ht_params,
249                 .nvm_ver = IWL9000_NVM_VERSION,
250                 .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
251                 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
252                 .integrated = true,
253                 .soc_latency = 5000,
254 };
255
256 const struct iwl_cfg iwl9560_2ac_cfg = {
257         .name = "Intel(R) Dual Band Wireless AC 9560",
258         .fw_name_pre = IWL9260A_FW_PRE,
259         .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE,
260         IWL_DEVICE_9000,
261         .ht_params = &iwl9000_ht_params,
262         .nvm_ver = IWL9000_NVM_VERSION,
263         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
264         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
265 };
266
267 const struct iwl_cfg iwl9560_2ac_cfg_soc = {
268         .name = "Intel(R) Dual Band Wireless AC 9560",
269         .fw_name_pre = IWL9000A_FW_PRE,
270         .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
271         .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
272         IWL_DEVICE_9000,
273         .ht_params = &iwl9000_ht_params,
274         .nvm_ver = IWL9000_NVM_VERSION,
275         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
276         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
277         .integrated = true,
278         .soc_latency = 5000,
279 };
280
281 const struct iwl_cfg iwl9560_killer_2ac_cfg_soc = {
282         .name = "Killer (R) Wireless-AC 1550i Wireless Network Adapter (9560NGW)",
283         .fw_name_pre = IWL9000A_FW_PRE,
284         .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
285         .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
286         IWL_DEVICE_9000,
287         .ht_params = &iwl9000_ht_params,
288         .nvm_ver = IWL9000_NVM_VERSION,
289         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
290         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
291         .integrated = true,
292         .soc_latency = 5000,
293 };
294
295 const struct iwl_cfg iwl9560_killer_s_2ac_cfg_soc = {
296         .name = "Killer (R) Wireless-AC 1550s Wireless Network Adapter (9560NGW)",
297         .fw_name_pre = IWL9000A_FW_PRE,
298         .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
299         .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
300         IWL_DEVICE_9000,
301         .ht_params = &iwl9000_ht_params,
302         .nvm_ver = IWL9000_NVM_VERSION,
303         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
304         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
305         .integrated = true,
306         .soc_latency = 5000,
307 };
308
309 const struct iwl_cfg iwl9460_2ac_cfg_shared_clk = {
310         .name = "Intel(R) Dual Band Wireless AC 9460",
311         .fw_name_pre = IWL9000A_FW_PRE,
312         .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
313         .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
314         IWL_DEVICE_9000,
315         .ht_params = &iwl9000_ht_params,
316         .nvm_ver = IWL9000_NVM_VERSION,
317         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
318         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
319         .integrated = true,
320         .soc_latency = 5000,
321         .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
322 };
323
324 const struct iwl_cfg iwl9461_2ac_cfg_shared_clk = {
325         .name = "Intel(R) Dual Band Wireless AC 9461",
326         .fw_name_pre = IWL9000A_FW_PRE,
327         .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
328         .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
329         IWL_DEVICE_9000,
330         .ht_params = &iwl9000_ht_params,
331         .nvm_ver = IWL9000_NVM_VERSION,
332         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
333         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
334         .integrated = true,
335         .soc_latency = 5000,
336         .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
337 };
338
339 const struct iwl_cfg iwl9462_2ac_cfg_shared_clk = {
340         .name = "Intel(R) Dual Band Wireless AC 9462",
341         .fw_name_pre = IWL9000A_FW_PRE,
342         .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
343         .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
344         IWL_DEVICE_9000,
345         .ht_params = &iwl9000_ht_params,
346         .nvm_ver = IWL9000_NVM_VERSION,
347         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
348         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
349         .integrated = true,
350         .soc_latency = 5000,
351         .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
352 };
353
354 const struct iwl_cfg iwl9560_2ac_cfg_shared_clk = {
355         .name = "Intel(R) Dual Band Wireless AC 9560",
356         .fw_name_pre = IWL9000A_FW_PRE,
357         .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
358         .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
359         IWL_DEVICE_9000,
360         .ht_params = &iwl9000_ht_params,
361         .nvm_ver = IWL9000_NVM_VERSION,
362         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
363         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
364         .integrated = true,
365         .soc_latency = 5000,
366         .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
367 };
368
369 const struct iwl_cfg iwl9560_killer_2ac_cfg_shared_clk = {
370         .name = "Killer (R) Wireless-AC 1550i Wireless Network Adapter (9560NGW)",
371         .fw_name_pre = IWL9000A_FW_PRE,
372         .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
373         .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
374         IWL_DEVICE_9000,
375         .ht_params = &iwl9000_ht_params,
376         .nvm_ver = IWL9000_NVM_VERSION,
377         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
378         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
379         .integrated = true,
380         .soc_latency = 5000,
381         .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
382 };
383
384 const struct iwl_cfg iwl9560_killer_s_2ac_cfg_shared_clk = {
385         .name = "Killer (R) Wireless-AC 1550s Wireless Network Adapter (9560NGW)",
386         .fw_name_pre = IWL9000A_FW_PRE,
387         .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE,
388         .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE,
389         IWL_DEVICE_9000,
390         .ht_params = &iwl9000_ht_params,
391         .nvm_ver = IWL9000_NVM_VERSION,
392         .nvm_calib_ver = IWL9000_TX_POWER_VERSION,
393         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
394         .integrated = true,
395         .soc_latency = 5000,
396         .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
397 };
398
399 MODULE_FIRMWARE(IWL9000A_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
400 MODULE_FIRMWARE(IWL9000B_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
401 MODULE_FIRMWARE(IWL9000RFB_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
402 MODULE_FIRMWARE(IWL9260A_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
403 MODULE_FIRMWARE(IWL9260B_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));