iwlwifi: remove useless NVM_HW_SECTION_NUM_FAMILY_* macros
[linux-2.6-microblaze.git] / drivers / net / wireless / intel / iwlwifi / cfg / 7000.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) 2012 - 2014 Intel Corporation. All rights reserved.
9  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
10  * Copyright(c) 2015        Intel Deutschland GmbH
11  * Copyright(c) 2018        Intel Corporation
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of version 2 of the GNU General Public License as
15  * published by the Free Software Foundation.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * General Public License for more details.
21  *
22  * The full GNU General Public License is included in this distribution
23  * in the file called COPYING.
24  *
25  * Contact Information:
26  *  Intel Linux Wireless <linuxwifi@intel.com>
27  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
28  *
29  * BSD LICENSE
30  *
31  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
32  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
33  * Copyright(c) 2015        Intel Deutschland GmbH
34  * Copyright(c) 2018        Intel Corporation
35  * All rights reserved.
36  *
37  * Redistribution and use in source and binary forms, with or without
38  * modification, are permitted provided that the following conditions
39  * are met:
40  *
41  *  * Redistributions of source code must retain the above copyright
42  *    notice, this list of conditions and the following disclaimer.
43  *  * Redistributions in binary form must reproduce the above copyright
44  *    notice, this list of conditions and the following disclaimer in
45  *    the documentation and/or other materials provided with the
46  *    distribution.
47  *  * Neither the name Intel Corporation nor the names of its
48  *    contributors may be used to endorse or promote products derived
49  *    from this software without specific prior written permission.
50  *
51  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
52  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
53  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
54  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
55  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
56  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62  *
63  *****************************************************************************/
64
65 #include <linux/module.h>
66 #include <linux/stringify.h>
67 #include "iwl-config.h"
68
69 /* Highest firmware API version supported */
70 #define IWL7260_UCODE_API_MAX   17
71 #define IWL7265_UCODE_API_MAX   17
72 #define IWL7265D_UCODE_API_MAX  29
73 #define IWL3168_UCODE_API_MAX   29
74
75 /* Lowest firmware API version supported */
76 #define IWL7260_UCODE_API_MIN   17
77 #define IWL7265_UCODE_API_MIN   17
78 #define IWL7265D_UCODE_API_MIN  22
79 #define IWL3168_UCODE_API_MIN   22
80
81 /* NVM versions */
82 #define IWL7260_NVM_VERSION             0x0a1d
83 #define IWL7260_TX_POWER_VERSION        0xffff /* meaningless */
84 #define IWL3160_NVM_VERSION             0x709
85 #define IWL3160_TX_POWER_VERSION        0xffff /* meaningless */
86 #define IWL3165_NVM_VERSION             0x709
87 #define IWL3165_TX_POWER_VERSION        0xffff /* meaningless */
88 #define IWL3168_NVM_VERSION             0xd01
89 #define IWL3168_TX_POWER_VERSION        0xffff /* meaningless */
90 #define IWL7265_NVM_VERSION             0x0a1d
91 #define IWL7265_TX_POWER_VERSION        0xffff /* meaningless */
92 #define IWL7265D_NVM_VERSION            0x0c11
93 #define IWL7265_TX_POWER_VERSION        0xffff /* meaningless */
94
95 /* DCCM offsets and lengths */
96 #define IWL7000_DCCM_OFFSET             0x800000
97 #define IWL7260_DCCM_LEN                0x14000
98 #define IWL3160_DCCM_LEN                0x10000
99 #define IWL7265_DCCM_LEN                0x17A00
100
101 #define IWL7260_FW_PRE "iwlwifi-7260-"
102 #define IWL7260_MODULE_FIRMWARE(api) IWL7260_FW_PRE __stringify(api) ".ucode"
103
104 #define IWL3160_FW_PRE "iwlwifi-3160-"
105 #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode"
106
107 #define IWL3168_FW_PRE "iwlwifi-3168-"
108 #define IWL3168_MODULE_FIRMWARE(api) IWL3168_FW_PRE __stringify(api) ".ucode"
109
110 #define IWL7265_FW_PRE "iwlwifi-7265-"
111 #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode"
112
113 #define IWL7265D_FW_PRE "iwlwifi-7265D-"
114 #define IWL7265D_MODULE_FIRMWARE(api) IWL7265D_FW_PRE __stringify(api) ".ucode"
115
116 static const struct iwl_base_params iwl7000_base_params = {
117         .eeprom_size = OTP_LOW_IMAGE_SIZE_16K,
118         .num_of_queues = 31,
119         .max_tfd_queue_size = 256,
120         .shadow_ram_support = true,
121         .led_compensation = 57,
122         .wd_timeout = IWL_LONG_WD_TIMEOUT,
123         .max_event_log_size = 512,
124         .shadow_reg_enable = true,
125         .pcie_l1_allowed = true,
126         .apmg_wake_up_wa = true,
127 };
128
129 static const struct iwl_tt_params iwl7000_high_temp_tt_params = {
130         .ct_kill_entry = 118,
131         .ct_kill_exit = 96,
132         .ct_kill_duration = 5,
133         .dynamic_smps_entry = 114,
134         .dynamic_smps_exit = 110,
135         .tx_protection_entry = 114,
136         .tx_protection_exit = 108,
137         .tx_backoff = {
138                 {.temperature = 112, .backoff = 300},
139                 {.temperature = 113, .backoff = 800},
140                 {.temperature = 114, .backoff = 1500},
141                 {.temperature = 115, .backoff = 3000},
142                 {.temperature = 116, .backoff = 5000},
143                 {.temperature = 117, .backoff = 10000},
144         },
145         .support_ct_kill = true,
146         .support_dynamic_smps = true,
147         .support_tx_protection = true,
148         .support_tx_backoff = true,
149 };
150
151 static const struct iwl_ht_params iwl7000_ht_params = {
152         .stbc = true,
153         .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
154 };
155
156 #define IWL_DEVICE_7000_COMMON                                  \
157         .device_family = IWL_DEVICE_FAMILY_7000,                \
158         .base_params = &iwl7000_base_params,                    \
159         .led_mode = IWL_LED_RF_STATE,                           \
160         .nvm_hw_section_num = 0,                                \
161         .non_shared_ant = ANT_A,                                \
162         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,    \
163         .dccm_offset = IWL7000_DCCM_OFFSET,                     \
164         .csr = &iwl_csr_v1
165
166 #define IWL_DEVICE_7000                                         \
167         IWL_DEVICE_7000_COMMON,                                 \
168         .ucode_api_max = IWL7260_UCODE_API_MAX,                 \
169         .ucode_api_min = IWL7260_UCODE_API_MIN
170
171 #define IWL_DEVICE_7005                                         \
172         IWL_DEVICE_7000_COMMON,                                 \
173         .ucode_api_max = IWL7265_UCODE_API_MAX,                 \
174         .ucode_api_min = IWL7265_UCODE_API_MIN
175
176 #define IWL_DEVICE_3008                                         \
177         IWL_DEVICE_7000_COMMON,                                 \
178         .ucode_api_max = IWL3168_UCODE_API_MAX,                 \
179         .ucode_api_min = IWL3168_UCODE_API_MIN
180
181 #define IWL_DEVICE_7005D                                        \
182         IWL_DEVICE_7000_COMMON,                                 \
183         .ucode_api_max = IWL7265D_UCODE_API_MAX,                \
184         .ucode_api_min = IWL7265D_UCODE_API_MIN
185
186 const struct iwl_cfg iwl7260_2ac_cfg = {
187         .name = "Intel(R) Dual Band Wireless AC 7260",
188         .fw_name_pre = IWL7260_FW_PRE,
189         IWL_DEVICE_7000,
190         .ht_params = &iwl7000_ht_params,
191         .nvm_ver = IWL7260_NVM_VERSION,
192         .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
193         .host_interrupt_operation_mode = true,
194         .lp_xtal_workaround = true,
195         .dccm_len = IWL7260_DCCM_LEN,
196 };
197
198 const struct iwl_cfg iwl7260_2ac_cfg_high_temp = {
199         .name = "Intel(R) Dual Band Wireless AC 7260",
200         .fw_name_pre = IWL7260_FW_PRE,
201         IWL_DEVICE_7000,
202         .ht_params = &iwl7000_ht_params,
203         .nvm_ver = IWL7260_NVM_VERSION,
204         .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
205         .high_temp = true,
206         .host_interrupt_operation_mode = true,
207         .lp_xtal_workaround = true,
208         .dccm_len = IWL7260_DCCM_LEN,
209         .thermal_params = &iwl7000_high_temp_tt_params,
210 };
211
212 const struct iwl_cfg iwl7260_2n_cfg = {
213         .name = "Intel(R) Dual Band Wireless N 7260",
214         .fw_name_pre = IWL7260_FW_PRE,
215         IWL_DEVICE_7000,
216         .ht_params = &iwl7000_ht_params,
217         .nvm_ver = IWL7260_NVM_VERSION,
218         .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
219         .host_interrupt_operation_mode = true,
220         .lp_xtal_workaround = true,
221         .dccm_len = IWL7260_DCCM_LEN,
222 };
223
224 const struct iwl_cfg iwl7260_n_cfg = {
225         .name = "Intel(R) Wireless N 7260",
226         .fw_name_pre = IWL7260_FW_PRE,
227         IWL_DEVICE_7000,
228         .ht_params = &iwl7000_ht_params,
229         .nvm_ver = IWL7260_NVM_VERSION,
230         .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
231         .host_interrupt_operation_mode = true,
232         .lp_xtal_workaround = true,
233         .dccm_len = IWL7260_DCCM_LEN,
234 };
235
236 const struct iwl_cfg iwl3160_2ac_cfg = {
237         .name = "Intel(R) Dual Band Wireless AC 3160",
238         .fw_name_pre = IWL3160_FW_PRE,
239         IWL_DEVICE_7000,
240         .ht_params = &iwl7000_ht_params,
241         .nvm_ver = IWL3160_NVM_VERSION,
242         .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
243         .host_interrupt_operation_mode = true,
244         .dccm_len = IWL3160_DCCM_LEN,
245 };
246
247 const struct iwl_cfg iwl3160_2n_cfg = {
248         .name = "Intel(R) Dual Band Wireless N 3160",
249         .fw_name_pre = IWL3160_FW_PRE,
250         IWL_DEVICE_7000,
251         .ht_params = &iwl7000_ht_params,
252         .nvm_ver = IWL3160_NVM_VERSION,
253         .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
254         .host_interrupt_operation_mode = true,
255         .dccm_len = IWL3160_DCCM_LEN,
256 };
257
258 const struct iwl_cfg iwl3160_n_cfg = {
259         .name = "Intel(R) Wireless N 3160",
260         .fw_name_pre = IWL3160_FW_PRE,
261         IWL_DEVICE_7000,
262         .ht_params = &iwl7000_ht_params,
263         .nvm_ver = IWL3160_NVM_VERSION,
264         .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
265         .host_interrupt_operation_mode = true,
266         .dccm_len = IWL3160_DCCM_LEN,
267 };
268
269 static const struct iwl_pwr_tx_backoff iwl7265_pwr_tx_backoffs[] = {
270         {.pwr = 1600, .backoff = 0},
271         {.pwr = 1300, .backoff = 467},
272         {.pwr = 900,  .backoff = 1900},
273         {.pwr = 800, .backoff = 2630},
274         {.pwr = 700, .backoff = 3720},
275         {.pwr = 600, .backoff = 5550},
276         {.pwr = 500, .backoff = 9350},
277         {0},
278 };
279
280 static const struct iwl_ht_params iwl7265_ht_params = {
281         .stbc = true,
282         .ldpc = true,
283         .ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
284 };
285
286 const struct iwl_cfg iwl3165_2ac_cfg = {
287         .name = "Intel(R) Dual Band Wireless AC 3165",
288         .fw_name_pre = IWL7265D_FW_PRE,
289         IWL_DEVICE_7005D,
290         .ht_params = &iwl7000_ht_params,
291         .nvm_ver = IWL3165_NVM_VERSION,
292         .nvm_calib_ver = IWL3165_TX_POWER_VERSION,
293         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
294         .dccm_len = IWL7265_DCCM_LEN,
295 };
296
297 const struct iwl_cfg iwl3168_2ac_cfg = {
298         .name = "Intel(R) Dual Band Wireless AC 3168",
299         .fw_name_pre = IWL3168_FW_PRE,
300         IWL_DEVICE_3008,
301         .ht_params = &iwl7000_ht_params,
302         .nvm_ver = IWL3168_NVM_VERSION,
303         .nvm_calib_ver = IWL3168_TX_POWER_VERSION,
304         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
305         .dccm_len = IWL7265_DCCM_LEN,
306         .nvm_type = IWL_NVM_SDP,
307 };
308
309 const struct iwl_cfg iwl7265_2ac_cfg = {
310         .name = "Intel(R) Dual Band Wireless AC 7265",
311         .fw_name_pre = IWL7265_FW_PRE,
312         IWL_DEVICE_7005,
313         .ht_params = &iwl7265_ht_params,
314         .nvm_ver = IWL7265_NVM_VERSION,
315         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
316         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
317         .dccm_len = IWL7265_DCCM_LEN,
318 };
319
320 const struct iwl_cfg iwl7265_2n_cfg = {
321         .name = "Intel(R) Dual Band Wireless N 7265",
322         .fw_name_pre = IWL7265_FW_PRE,
323         IWL_DEVICE_7005,
324         .ht_params = &iwl7265_ht_params,
325         .nvm_ver = IWL7265_NVM_VERSION,
326         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
327         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
328         .dccm_len = IWL7265_DCCM_LEN,
329 };
330
331 const struct iwl_cfg iwl7265_n_cfg = {
332         .name = "Intel(R) Wireless N 7265",
333         .fw_name_pre = IWL7265_FW_PRE,
334         IWL_DEVICE_7005,
335         .ht_params = &iwl7265_ht_params,
336         .nvm_ver = IWL7265_NVM_VERSION,
337         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
338         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
339         .dccm_len = IWL7265_DCCM_LEN,
340 };
341
342 const struct iwl_cfg iwl7265d_2ac_cfg = {
343         .name = "Intel(R) Dual Band Wireless AC 7265",
344         .fw_name_pre = IWL7265D_FW_PRE,
345         IWL_DEVICE_7005D,
346         .ht_params = &iwl7265_ht_params,
347         .nvm_ver = IWL7265D_NVM_VERSION,
348         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
349         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
350         .dccm_len = IWL7265_DCCM_LEN,
351 };
352
353 const struct iwl_cfg iwl7265d_2n_cfg = {
354         .name = "Intel(R) Dual Band Wireless N 7265",
355         .fw_name_pre = IWL7265D_FW_PRE,
356         IWL_DEVICE_7005D,
357         .ht_params = &iwl7265_ht_params,
358         .nvm_ver = IWL7265D_NVM_VERSION,
359         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
360         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
361         .dccm_len = IWL7265_DCCM_LEN,
362 };
363
364 const struct iwl_cfg iwl7265d_n_cfg = {
365         .name = "Intel(R) Wireless N 7265",
366         .fw_name_pre = IWL7265D_FW_PRE,
367         IWL_DEVICE_7005D,
368         .ht_params = &iwl7265_ht_params,
369         .nvm_ver = IWL7265D_NVM_VERSION,
370         .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
371         .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
372         .dccm_len = IWL7265_DCCM_LEN,
373 };
374
375 MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_MAX));
376 MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_MAX));
377 MODULE_FIRMWARE(IWL3168_MODULE_FIRMWARE(IWL3168_UCODE_API_MAX));
378 MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7265_UCODE_API_MAX));
379 MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7265D_UCODE_API_MAX));