xref: /openbmc/linux/drivers/net/wireless/intel/iwlwifi/cfg/7000.c (revision fed8b7e366e7c8f81e957ef91aa8f0a38e038c66)
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 #define NVM_HW_SECTION_NUM_FAMILY_7000		0
117 
118 static const struct iwl_base_params iwl7000_base_params = {
119 	.eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_7000,
120 	.num_of_queues = 31,
121 	.max_tfd_queue_size = 256,
122 	.shadow_ram_support = true,
123 	.led_compensation = 57,
124 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
125 	.max_event_log_size = 512,
126 	.shadow_reg_enable = true,
127 	.pcie_l1_allowed = true,
128 	.apmg_wake_up_wa = true,
129 };
130 
131 static const struct iwl_tt_params iwl7000_high_temp_tt_params = {
132 	.ct_kill_entry = 118,
133 	.ct_kill_exit = 96,
134 	.ct_kill_duration = 5,
135 	.dynamic_smps_entry = 114,
136 	.dynamic_smps_exit = 110,
137 	.tx_protection_entry = 114,
138 	.tx_protection_exit = 108,
139 	.tx_backoff = {
140 		{.temperature = 112, .backoff = 300},
141 		{.temperature = 113, .backoff = 800},
142 		{.temperature = 114, .backoff = 1500},
143 		{.temperature = 115, .backoff = 3000},
144 		{.temperature = 116, .backoff = 5000},
145 		{.temperature = 117, .backoff = 10000},
146 	},
147 	.support_ct_kill = true,
148 	.support_dynamic_smps = true,
149 	.support_tx_protection = true,
150 	.support_tx_backoff = true,
151 };
152 
153 static const struct iwl_ht_params iwl7000_ht_params = {
154 	.stbc = true,
155 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
156 };
157 
158 #define IWL_DEVICE_7000_COMMON					\
159 	.device_family = IWL_DEVICE_FAMILY_7000,		\
160 	.base_params = &iwl7000_base_params,			\
161 	.led_mode = IWL_LED_RF_STATE,				\
162 	.nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_7000,	\
163 	.non_shared_ant = ANT_A,				\
164 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
165 	.dccm_offset = IWL7000_DCCM_OFFSET,			\
166 	.csr = &iwl_csr_v1
167 
168 #define IWL_DEVICE_7000						\
169 	IWL_DEVICE_7000_COMMON,					\
170 	.ucode_api_max = IWL7260_UCODE_API_MAX,			\
171 	.ucode_api_min = IWL7260_UCODE_API_MIN
172 
173 #define IWL_DEVICE_7005						\
174 	IWL_DEVICE_7000_COMMON,					\
175 	.ucode_api_max = IWL7265_UCODE_API_MAX,			\
176 	.ucode_api_min = IWL7265_UCODE_API_MIN
177 
178 #define IWL_DEVICE_3008						\
179 	IWL_DEVICE_7000_COMMON,					\
180 	.ucode_api_max = IWL3168_UCODE_API_MAX,			\
181 	.ucode_api_min = IWL3168_UCODE_API_MIN
182 
183 #define IWL_DEVICE_7005D					\
184 	IWL_DEVICE_7000_COMMON,					\
185 	.ucode_api_max = IWL7265D_UCODE_API_MAX,		\
186 	.ucode_api_min = IWL7265D_UCODE_API_MIN
187 
188 const struct iwl_cfg iwl7260_2ac_cfg = {
189 	.name = "Intel(R) Dual Band Wireless AC 7260",
190 	.fw_name_pre = IWL7260_FW_PRE,
191 	IWL_DEVICE_7000,
192 	.ht_params = &iwl7000_ht_params,
193 	.nvm_ver = IWL7260_NVM_VERSION,
194 	.nvm_calib_ver = IWL7260_TX_POWER_VERSION,
195 	.host_interrupt_operation_mode = true,
196 	.lp_xtal_workaround = true,
197 	.dccm_len = IWL7260_DCCM_LEN,
198 };
199 
200 const struct iwl_cfg iwl7260_2ac_cfg_high_temp = {
201 	.name = "Intel(R) Dual Band Wireless AC 7260",
202 	.fw_name_pre = IWL7260_FW_PRE,
203 	IWL_DEVICE_7000,
204 	.ht_params = &iwl7000_ht_params,
205 	.nvm_ver = IWL7260_NVM_VERSION,
206 	.nvm_calib_ver = IWL7260_TX_POWER_VERSION,
207 	.high_temp = true,
208 	.host_interrupt_operation_mode = true,
209 	.lp_xtal_workaround = true,
210 	.dccm_len = IWL7260_DCCM_LEN,
211 	.thermal_params = &iwl7000_high_temp_tt_params,
212 };
213 
214 const struct iwl_cfg iwl7260_2n_cfg = {
215 	.name = "Intel(R) Dual Band Wireless N 7260",
216 	.fw_name_pre = IWL7260_FW_PRE,
217 	IWL_DEVICE_7000,
218 	.ht_params = &iwl7000_ht_params,
219 	.nvm_ver = IWL7260_NVM_VERSION,
220 	.nvm_calib_ver = IWL7260_TX_POWER_VERSION,
221 	.host_interrupt_operation_mode = true,
222 	.lp_xtal_workaround = true,
223 	.dccm_len = IWL7260_DCCM_LEN,
224 };
225 
226 const struct iwl_cfg iwl7260_n_cfg = {
227 	.name = "Intel(R) Wireless N 7260",
228 	.fw_name_pre = IWL7260_FW_PRE,
229 	IWL_DEVICE_7000,
230 	.ht_params = &iwl7000_ht_params,
231 	.nvm_ver = IWL7260_NVM_VERSION,
232 	.nvm_calib_ver = IWL7260_TX_POWER_VERSION,
233 	.host_interrupt_operation_mode = true,
234 	.lp_xtal_workaround = true,
235 	.dccm_len = IWL7260_DCCM_LEN,
236 };
237 
238 const struct iwl_cfg iwl3160_2ac_cfg = {
239 	.name = "Intel(R) Dual Band Wireless AC 3160",
240 	.fw_name_pre = IWL3160_FW_PRE,
241 	IWL_DEVICE_7000,
242 	.ht_params = &iwl7000_ht_params,
243 	.nvm_ver = IWL3160_NVM_VERSION,
244 	.nvm_calib_ver = IWL3160_TX_POWER_VERSION,
245 	.host_interrupt_operation_mode = true,
246 	.dccm_len = IWL3160_DCCM_LEN,
247 };
248 
249 const struct iwl_cfg iwl3160_2n_cfg = {
250 	.name = "Intel(R) Dual Band Wireless N 3160",
251 	.fw_name_pre = IWL3160_FW_PRE,
252 	IWL_DEVICE_7000,
253 	.ht_params = &iwl7000_ht_params,
254 	.nvm_ver = IWL3160_NVM_VERSION,
255 	.nvm_calib_ver = IWL3160_TX_POWER_VERSION,
256 	.host_interrupt_operation_mode = true,
257 	.dccm_len = IWL3160_DCCM_LEN,
258 };
259 
260 const struct iwl_cfg iwl3160_n_cfg = {
261 	.name = "Intel(R) Wireless N 3160",
262 	.fw_name_pre = IWL3160_FW_PRE,
263 	IWL_DEVICE_7000,
264 	.ht_params = &iwl7000_ht_params,
265 	.nvm_ver = IWL3160_NVM_VERSION,
266 	.nvm_calib_ver = IWL3160_TX_POWER_VERSION,
267 	.host_interrupt_operation_mode = true,
268 	.dccm_len = IWL3160_DCCM_LEN,
269 };
270 
271 static const struct iwl_pwr_tx_backoff iwl7265_pwr_tx_backoffs[] = {
272 	{.pwr = 1600, .backoff = 0},
273 	{.pwr = 1300, .backoff = 467},
274 	{.pwr = 900,  .backoff = 1900},
275 	{.pwr = 800, .backoff = 2630},
276 	{.pwr = 700, .backoff = 3720},
277 	{.pwr = 600, .backoff = 5550},
278 	{.pwr = 500, .backoff = 9350},
279 	{0},
280 };
281 
282 static const struct iwl_ht_params iwl7265_ht_params = {
283 	.stbc = true,
284 	.ldpc = true,
285 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
286 };
287 
288 const struct iwl_cfg iwl3165_2ac_cfg = {
289 	.name = "Intel(R) Dual Band Wireless AC 3165",
290 	.fw_name_pre = IWL7265D_FW_PRE,
291 	IWL_DEVICE_7005D,
292 	.ht_params = &iwl7000_ht_params,
293 	.nvm_ver = IWL3165_NVM_VERSION,
294 	.nvm_calib_ver = IWL3165_TX_POWER_VERSION,
295 	.pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
296 	.dccm_len = IWL7265_DCCM_LEN,
297 };
298 
299 const struct iwl_cfg iwl3168_2ac_cfg = {
300 	.name = "Intel(R) Dual Band Wireless AC 3168",
301 	.fw_name_pre = IWL3168_FW_PRE,
302 	IWL_DEVICE_3008,
303 	.ht_params = &iwl7000_ht_params,
304 	.nvm_ver = IWL3168_NVM_VERSION,
305 	.nvm_calib_ver = IWL3168_TX_POWER_VERSION,
306 	.pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
307 	.dccm_len = IWL7265_DCCM_LEN,
308 	.nvm_type = IWL_NVM_SDP,
309 };
310 
311 const struct iwl_cfg iwl7265_2ac_cfg = {
312 	.name = "Intel(R) Dual Band Wireless AC 7265",
313 	.fw_name_pre = IWL7265_FW_PRE,
314 	IWL_DEVICE_7005,
315 	.ht_params = &iwl7265_ht_params,
316 	.nvm_ver = IWL7265_NVM_VERSION,
317 	.nvm_calib_ver = IWL7265_TX_POWER_VERSION,
318 	.pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
319 	.dccm_len = IWL7265_DCCM_LEN,
320 };
321 
322 const struct iwl_cfg iwl7265_2n_cfg = {
323 	.name = "Intel(R) Dual Band Wireless N 7265",
324 	.fw_name_pre = IWL7265_FW_PRE,
325 	IWL_DEVICE_7005,
326 	.ht_params = &iwl7265_ht_params,
327 	.nvm_ver = IWL7265_NVM_VERSION,
328 	.nvm_calib_ver = IWL7265_TX_POWER_VERSION,
329 	.pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
330 	.dccm_len = IWL7265_DCCM_LEN,
331 };
332 
333 const struct iwl_cfg iwl7265_n_cfg = {
334 	.name = "Intel(R) Wireless N 7265",
335 	.fw_name_pre = IWL7265_FW_PRE,
336 	IWL_DEVICE_7005,
337 	.ht_params = &iwl7265_ht_params,
338 	.nvm_ver = IWL7265_NVM_VERSION,
339 	.nvm_calib_ver = IWL7265_TX_POWER_VERSION,
340 	.pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
341 	.dccm_len = IWL7265_DCCM_LEN,
342 };
343 
344 const struct iwl_cfg iwl7265d_2ac_cfg = {
345 	.name = "Intel(R) Dual Band Wireless AC 7265",
346 	.fw_name_pre = IWL7265D_FW_PRE,
347 	IWL_DEVICE_7005D,
348 	.ht_params = &iwl7265_ht_params,
349 	.nvm_ver = IWL7265D_NVM_VERSION,
350 	.nvm_calib_ver = IWL7265_TX_POWER_VERSION,
351 	.pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
352 	.dccm_len = IWL7265_DCCM_LEN,
353 };
354 
355 const struct iwl_cfg iwl7265d_2n_cfg = {
356 	.name = "Intel(R) Dual Band Wireless N 7265",
357 	.fw_name_pre = IWL7265D_FW_PRE,
358 	IWL_DEVICE_7005D,
359 	.ht_params = &iwl7265_ht_params,
360 	.nvm_ver = IWL7265D_NVM_VERSION,
361 	.nvm_calib_ver = IWL7265_TX_POWER_VERSION,
362 	.pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
363 	.dccm_len = IWL7265_DCCM_LEN,
364 };
365 
366 const struct iwl_cfg iwl7265d_n_cfg = {
367 	.name = "Intel(R) Wireless N 7265",
368 	.fw_name_pre = IWL7265D_FW_PRE,
369 	IWL_DEVICE_7005D,
370 	.ht_params = &iwl7265_ht_params,
371 	.nvm_ver = IWL7265D_NVM_VERSION,
372 	.nvm_calib_ver = IWL7265_TX_POWER_VERSION,
373 	.pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
374 	.dccm_len = IWL7265_DCCM_LEN,
375 };
376 
377 MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_MAX));
378 MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_MAX));
379 MODULE_FIRMWARE(IWL3168_MODULE_FIRMWARE(IWL3168_UCODE_API_MAX));
380 MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7265_UCODE_API_MAX));
381 MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7265D_UCODE_API_MAX));
382