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 
58 /* Highest firmware API version supported */
59 #define IWL_22000_UCODE_API_MAX	38
60 
61 /* Lowest firmware API version supported */
62 #define IWL_22000_UCODE_API_MIN	24
63 
64 /* NVM versions */
65 #define IWL_22000_NVM_VERSION		0x0a1d
66 #define IWL_22000_TX_POWER_VERSION	0xffff /* meaningless */
67 
68 /* Memory offsets and lengths */
69 #define IWL_22000_DCCM_OFFSET		0x800000 /* LMAC1 */
70 #define IWL_22000_DCCM_LEN		0x10000 /* LMAC1 */
71 #define IWL_22000_DCCM2_OFFSET		0x880000
72 #define IWL_22000_DCCM2_LEN		0x8000
73 #define IWL_22000_SMEM_OFFSET		0x400000
74 #define IWL_22000_SMEM_LEN		0xD0000
75 
76 #define IWL_22000_JF_FW_PRE		"iwlwifi-Qu-a0-jf-b0-"
77 #define IWL_22000_HR_FW_PRE		"iwlwifi-Qu-a0-hr-a0-"
78 #define IWL_22000_HR_CDB_FW_PRE		"iwlwifi-QuIcp-z0-hrcdb-a0-"
79 #define IWL_22000_HR_A_F0_FW_PRE	"iwlwifi-QuQnj-f0-hr-a0-"
80 #define IWL_22000_HR_B_FW_PRE		"iwlwifi-Qu-b0-hr-b0-"
81 #define IWL_22000_JF_B0_FW_PRE		"iwlwifi-QuQnj-a0-jf-b0-"
82 #define IWL_22000_HR_A0_FW_PRE		"iwlwifi-QuQnj-a0-hr-a0-"
83 #define IWL_22000_SU_Z0_FW_PRE		"iwlwifi-su-z0-"
84 
85 #define IWL_22000_HR_MODULE_FIRMWARE(api) \
86 	IWL_22000_HR_FW_PRE __stringify(api) ".ucode"
87 #define IWL_22000_JF_MODULE_FIRMWARE(api) \
88 	IWL_22000_JF_FW_PRE __stringify(api) ".ucode"
89 #define IWL_22000_HR_A_F0_QNJ_MODULE_FIRMWARE(api) \
90 	IWL_22000_HR_A_F0_FW_PRE __stringify(api) ".ucode"
91 #define IWL_22000_HR_B_QNJ_MODULE_FIRMWARE(api) \
92 	IWL_22000_HR_B_FW_PRE __stringify(api) ".ucode"
93 #define IWL_22000_JF_B0_QNJ_MODULE_FIRMWARE(api) \
94 	IWL_22000_JF_B0_FW_PRE __stringify(api) ".ucode"
95 #define IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(api) \
96 	IWL_22000_HR_A0_FW_PRE __stringify(api) ".ucode"
97 #define IWL_22000_SU_Z0_MODULE_FIRMWARE(api) \
98 	IWL_22000_SU_Z0_FW_PRE __stringify(api) ".ucode"
99 
100 #define NVM_HW_SECTION_NUM_FAMILY_22000		10
101 
102 static const struct iwl_base_params iwl_22000_base_params = {
103 	.eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_22000,
104 	.num_of_queues = 512,
105 	.shadow_ram_support = true,
106 	.led_compensation = 57,
107 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
108 	.max_event_log_size = 512,
109 	.shadow_reg_enable = true,
110 	.pcie_l1_allowed = true,
111 };
112 
113 static const struct iwl_ht_params iwl_22000_ht_params = {
114 	.stbc = true,
115 	.ldpc = true,
116 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
117 };
118 
119 #define IWL_DEVICE_22000_COMMON						\
120 	.ucode_api_max = IWL_22000_UCODE_API_MAX,			\
121 	.ucode_api_min = IWL_22000_UCODE_API_MIN,			\
122 	.base_params = &iwl_22000_base_params,				\
123 	.led_mode = IWL_LED_RF_STATE,					\
124 	.nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_22000,		\
125 	.non_shared_ant = ANT_A,					\
126 	.dccm_offset = IWL_22000_DCCM_OFFSET,				\
127 	.dccm_len = IWL_22000_DCCM_LEN,					\
128 	.dccm2_offset = IWL_22000_DCCM2_OFFSET,				\
129 	.dccm2_len = IWL_22000_DCCM2_LEN,				\
130 	.smem_offset = IWL_22000_SMEM_OFFSET,				\
131 	.smem_len = IWL_22000_SMEM_LEN,					\
132 	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,		\
133 	.apmg_not_supported = true,					\
134 	.mq_rx_supported = true,					\
135 	.vht_mu_mimo_supported = true,					\
136 	.mac_addr_from_csr = true,					\
137 	.ht_params = &iwl_22000_ht_params,				\
138 	.nvm_ver = IWL_22000_NVM_VERSION,				\
139 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,			\
140 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,		\
141 	.use_tfh = true,						\
142 	.rf_id = true,							\
143 	.gen2 = true,							\
144 	.nvm_type = IWL_NVM_EXT,					\
145 	.dbgc_supported = true,						\
146 	.min_umac_error_event_table = 0x400000
147 
148 #define IWL_DEVICE_22500						\
149 	IWL_DEVICE_22000_COMMON,					\
150 	.device_family = IWL_DEVICE_FAMILY_22000,			\
151 	.csr = &iwl_csr_v1
152 
153 #define IWL_DEVICE_22560						\
154 	IWL_DEVICE_22000_COMMON,					\
155 	.device_family = IWL_DEVICE_FAMILY_22560,			\
156 	.csr = &iwl_csr_v2
157 
158 const struct iwl_cfg iwl22000_2ac_cfg_hr = {
159 	.name = "Intel(R) Dual Band Wireless AC 22000",
160 	.fw_name_pre = IWL_22000_HR_FW_PRE,
161 	IWL_DEVICE_22500,
162 };
163 
164 const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb = {
165 	.name = "Intel(R) Dual Band Wireless AC 22000",
166 	.fw_name_pre = IWL_22000_HR_CDB_FW_PRE,
167 	IWL_DEVICE_22500,
168 	.cdb = true,
169 };
170 
171 const struct iwl_cfg iwl22000_2ac_cfg_jf = {
172 	.name = "Intel(R) Dual Band Wireless AC 22000",
173 	.fw_name_pre = IWL_22000_JF_FW_PRE,
174 	IWL_DEVICE_22500,
175 };
176 
177 const struct iwl_cfg iwl22000_2ax_cfg_hr = {
178 	.name = "Intel(R) Dual Band Wireless AX 22000",
179 	.fw_name_pre = IWL_22000_HR_FW_PRE,
180 	IWL_DEVICE_22500,
181 	/*
182 	 * This device doesn't support receiving BlockAck with a large bitmap
183 	 * so we need to restrict the size of transmitted aggregation to the
184 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
185 	 */
186 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
187 };
188 
189 const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_a0_f0 = {
190 	.name = "Intel(R) Dual Band Wireless AX 22000",
191 	.fw_name_pre = IWL_22000_HR_A_F0_FW_PRE,
192 	IWL_DEVICE_22500,
193 	/*
194 	 * This device doesn't support receiving BlockAck with a large bitmap
195 	 * so we need to restrict the size of transmitted aggregation to the
196 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
197 	 */
198 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
199 };
200 
201 const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_b0 = {
202 	.name = "Intel(R) Dual Band Wireless AX 22000",
203 	.fw_name_pre = IWL_22000_HR_B_FW_PRE,
204 	IWL_DEVICE_22500,
205 	/*
206 	 * This device doesn't support receiving BlockAck with a large bitmap
207 	 * so we need to restrict the size of transmitted aggregation to the
208 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
209 	 */
210 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
211 };
212 
213 const struct iwl_cfg iwl22000_2ax_cfg_qnj_jf_b0 = {
214 	.name = "Intel(R) Dual Band Wireless AX 22000",
215 	.fw_name_pre = IWL_22000_JF_B0_FW_PRE,
216 	IWL_DEVICE_22500,
217 	/*
218 	 * This device doesn't support receiving BlockAck with a large bitmap
219 	 * so we need to restrict the size of transmitted aggregation to the
220 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
221 	 */
222 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
223 };
224 
225 const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_a0 = {
226 	.name = "Intel(R) Dual Band Wireless AX 22000",
227 	.fw_name_pre = IWL_22000_HR_A0_FW_PRE,
228 	IWL_DEVICE_22500,
229 	/*
230 	 * This device doesn't support receiving BlockAck with a large bitmap
231 	 * so we need to restrict the size of transmitted aggregation to the
232 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
233 	 */
234 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
235 };
236 
237 const struct iwl_cfg iwl22560_2ax_cfg_su_cdb = {
238 	.name = "Intel(R) Dual Band Wireless AX 22560",
239 	.fw_name_pre = IWL_22000_SU_Z0_FW_PRE,
240 	IWL_DEVICE_22560,
241 	.cdb = true,
242 	/*
243 	 * This device doesn't support receiving BlockAck with a large bitmap
244 	 * so we need to restrict the size of transmitted aggregation to the
245 	 * HT size; mac80211 would otherwise pick the HE max (256) by default.
246 	 */
247 	.max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
248 };
249 
250 MODULE_FIRMWARE(IWL_22000_HR_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
251 MODULE_FIRMWARE(IWL_22000_JF_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
252 MODULE_FIRMWARE(IWL_22000_HR_A_F0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
253 MODULE_FIRMWARE(IWL_22000_HR_B_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
254 MODULE_FIRMWARE(IWL_22000_JF_B0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
255 MODULE_FIRMWARE(IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
256 MODULE_FIRMWARE(IWL_22000_SU_Z0_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
257