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_F0_FW_PRE	"iwlwifi-QuQnj-f0-hr-a0-"
80 #define IWL_22000_JF_B0_FW_PRE	"iwlwifi-QuQnj-a0-jf-b0-"
81 #define IWL_22000_HR_A0_FW_PRE	"iwlwifi-QuQnj-a0-hr-a0-"
82 
83 #define IWL_22000_HR_MODULE_FIRMWARE(api) \
84 	IWL_22000_HR_FW_PRE __stringify(api) ".ucode"
85 #define IWL_22000_JF_MODULE_FIRMWARE(api) \
86 	IWL_22000_JF_FW_PRE __stringify(api) ".ucode"
87 #define IWL_22000_HR_F0_QNJ_MODULE_FIRMWARE(api) \
88 	IWL_22000_HR_F0_FW_PRE __stringify(api) ".ucode"
89 #define IWL_22000_JF_B0_QNJ_MODULE_FIRMWARE(api) \
90 	IWL_22000_JF_B0_FW_PRE __stringify(api) ".ucode"
91 #define IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(api) \
92 	IWL_22000_HR_A0_FW_PRE __stringify(api) ".ucode"
93 
94 #define NVM_HW_SECTION_NUM_FAMILY_22000		10
95 
96 static const struct iwl_base_params iwl_22000_base_params = {
97 	.eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_22000,
98 	.num_of_queues = 512,
99 	.shadow_ram_support = true,
100 	.led_compensation = 57,
101 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
102 	.max_event_log_size = 512,
103 	.shadow_reg_enable = true,
104 	.pcie_l1_allowed = true,
105 };
106 
107 static const struct iwl_ht_params iwl_22000_ht_params = {
108 	.stbc = true,
109 	.ldpc = true,
110 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
111 };
112 
113 #define IWL_DEVICE_22000						\
114 	.ucode_api_max = IWL_22000_UCODE_API_MAX,			\
115 	.ucode_api_min = IWL_22000_UCODE_API_MIN,			\
116 	.device_family = IWL_DEVICE_FAMILY_22000,			\
117 	.base_params = &iwl_22000_base_params,				\
118 	.led_mode = IWL_LED_RF_STATE,					\
119 	.nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_22000,		\
120 	.non_shared_ant = ANT_A,					\
121 	.dccm_offset = IWL_22000_DCCM_OFFSET,				\
122 	.dccm_len = IWL_22000_DCCM_LEN,					\
123 	.dccm2_offset = IWL_22000_DCCM2_OFFSET,				\
124 	.dccm2_len = IWL_22000_DCCM2_LEN,				\
125 	.smem_offset = IWL_22000_SMEM_OFFSET,				\
126 	.smem_len = IWL_22000_SMEM_LEN,					\
127 	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,		\
128 	.apmg_not_supported = true,					\
129 	.mq_rx_supported = true,					\
130 	.vht_mu_mimo_supported = true,					\
131 	.mac_addr_from_csr = true,					\
132 	.use_tfh = true,						\
133 	.rf_id = true,							\
134 	.gen2 = true,							\
135 	.nvm_type = IWL_NVM_EXT,					\
136 	.dbgc_supported = true,						\
137 	.min_umac_error_event_table = 0x400000
138 
139 const struct iwl_cfg iwl22000_2ac_cfg_hr = {
140 	.name = "Intel(R) Dual Band Wireless AC 22000",
141 	.fw_name_pre = IWL_22000_HR_FW_PRE,
142 	IWL_DEVICE_22000,
143 	.csr = &iwl_csr_v1,
144 	.ht_params = &iwl_22000_ht_params,
145 	.nvm_ver = IWL_22000_NVM_VERSION,
146 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
147 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
148 };
149 
150 const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb = {
151 	.name = "Intel(R) Dual Band Wireless AC 22000",
152 	.fw_name_pre = IWL_22000_HR_CDB_FW_PRE,
153 	IWL_DEVICE_22000,
154 	.csr = &iwl_csr_v1,
155 	.ht_params = &iwl_22000_ht_params,
156 	.nvm_ver = IWL_22000_NVM_VERSION,
157 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
158 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
159 	.cdb = true,
160 };
161 
162 const struct iwl_cfg iwl22000_2ac_cfg_jf = {
163 	.name = "Intel(R) Dual Band Wireless AC 22000",
164 	.fw_name_pre = IWL_22000_JF_FW_PRE,
165 	IWL_DEVICE_22000,
166 	.csr = &iwl_csr_v1,
167 	.ht_params = &iwl_22000_ht_params,
168 	.nvm_ver = IWL_22000_NVM_VERSION,
169 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
170 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
171 };
172 
173 const struct iwl_cfg iwl22000_2ax_cfg_hr = {
174 	.name = "Intel(R) Dual Band Wireless AX 22000",
175 	.fw_name_pre = IWL_22000_HR_FW_PRE,
176 	IWL_DEVICE_22000,
177 	.csr = &iwl_csr_v1,
178 	.ht_params = &iwl_22000_ht_params,
179 	.nvm_ver = IWL_22000_NVM_VERSION,
180 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
181 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
182 };
183 
184 const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_f0 = {
185 	.name = "Intel(R) Dual Band Wireless AX 22000",
186 	.fw_name_pre = IWL_22000_HR_F0_FW_PRE,
187 	IWL_DEVICE_22000,
188 	.csr = &iwl_csr_v1,
189 	.ht_params = &iwl_22000_ht_params,
190 	.nvm_ver = IWL_22000_NVM_VERSION,
191 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
192 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
193 };
194 
195 const struct iwl_cfg iwl22000_2ax_cfg_qnj_jf_b0 = {
196 	.name = "Intel(R) Dual Band Wireless AX 22000",
197 	.fw_name_pre = IWL_22000_JF_B0_FW_PRE,
198 	IWL_DEVICE_22000,
199 	.csr = &iwl_csr_v1,
200 	.ht_params = &iwl_22000_ht_params,
201 	.nvm_ver = IWL_22000_NVM_VERSION,
202 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
203 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
204 };
205 
206 const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_a0 = {
207 	.name = "Intel(R) Dual Band Wireless AX 22000",
208 	.fw_name_pre = IWL_22000_HR_A0_FW_PRE,
209 	IWL_DEVICE_22000,
210 	.csr = &iwl_csr_v1,
211 	.ht_params = &iwl_22000_ht_params,
212 	.nvm_ver = IWL_22000_NVM_VERSION,
213 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
214 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
215 };
216 
217 MODULE_FIRMWARE(IWL_22000_HR_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
218 MODULE_FIRMWARE(IWL_22000_JF_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
219 MODULE_FIRMWARE(IWL_22000_HR_F0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
220 MODULE_FIRMWARE(IWL_22000_JF_B0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
221 MODULE_FIRMWARE(IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
222