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 "iwl-agn-hw.h"
58 
59 /* Highest firmware API version supported */
60 #define IWL_22000_UCODE_API_MAX	38
61 
62 /* Lowest firmware API version supported */
63 #define IWL_22000_UCODE_API_MIN	24
64 
65 /* NVM versions */
66 #define IWL_22000_NVM_VERSION		0x0a1d
67 #define IWL_22000_TX_POWER_VERSION	0xffff /* meaningless */
68 
69 /* Memory offsets and lengths */
70 #define IWL_22000_DCCM_OFFSET		0x800000 /* LMAC1 */
71 #define IWL_22000_DCCM_LEN		0x10000 /* LMAC1 */
72 #define IWL_22000_DCCM2_OFFSET		0x880000
73 #define IWL_22000_DCCM2_LEN		0x8000
74 #define IWL_22000_SMEM_OFFSET		0x400000
75 #define IWL_22000_SMEM_LEN		0xD0000
76 
77 #define IWL_22000_JF_FW_PRE	"iwlwifi-Qu-a0-jf-b0-"
78 #define IWL_22000_HR_FW_PRE	"iwlwifi-Qu-a0-hr-a0-"
79 #define IWL_22000_HR_CDB_FW_PRE	"iwlwifi-QuIcp-z0-hrcdb-a0-"
80 #define IWL_22000_HR_F0_FW_PRE	"iwlwifi-QuQnj-f0-hr-a0-"
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 
84 #define IWL_22000_HR_MODULE_FIRMWARE(api) \
85 	IWL_22000_HR_FW_PRE __stringify(api) ".ucode"
86 #define IWL_22000_JF_MODULE_FIRMWARE(api) \
87 	IWL_22000_JF_FW_PRE __stringify(api) ".ucode"
88 #define IWL_22000_HR_F0_QNJ_MODULE_FIRMWARE(api) \
89 	IWL_22000_HR_F0_FW_PRE __stringify(api) ".ucode"
90 #define IWL_22000_JF_B0_QNJ_MODULE_FIRMWARE(api) \
91 	IWL_22000_JF_B0_FW_PRE __stringify(api) ".ucode"
92 #define IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(api) \
93 	IWL_22000_HR_A0_FW_PRE __stringify(api) ".ucode"
94 
95 #define NVM_HW_SECTION_NUM_FAMILY_22000		10
96 
97 static const struct iwl_base_params iwl_22000_base_params = {
98 	.eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_22000,
99 	.num_of_queues = 512,
100 	.shadow_ram_support = true,
101 	.led_compensation = 57,
102 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
103 	.max_event_log_size = 512,
104 	.shadow_reg_enable = true,
105 	.pcie_l1_allowed = true,
106 };
107 
108 static const struct iwl_ht_params iwl_22000_ht_params = {
109 	.stbc = true,
110 	.ldpc = true,
111 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
112 };
113 
114 #define IWL_DEVICE_22000						\
115 	.ucode_api_max = IWL_22000_UCODE_API_MAX,			\
116 	.ucode_api_min = IWL_22000_UCODE_API_MIN,			\
117 	.device_family = IWL_DEVICE_FAMILY_22000,			\
118 	.max_inst_size = IWL60_RTC_INST_SIZE,				\
119 	.max_data_size = IWL60_RTC_DATA_SIZE,				\
120 	.base_params = &iwl_22000_base_params,				\
121 	.led_mode = IWL_LED_RF_STATE,					\
122 	.nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_22000,		\
123 	.non_shared_ant = ANT_A,					\
124 	.dccm_offset = IWL_22000_DCCM_OFFSET,				\
125 	.dccm_len = IWL_22000_DCCM_LEN,					\
126 	.dccm2_offset = IWL_22000_DCCM2_OFFSET,				\
127 	.dccm2_len = IWL_22000_DCCM2_LEN,				\
128 	.smem_offset = IWL_22000_SMEM_OFFSET,				\
129 	.smem_len = IWL_22000_SMEM_LEN,					\
130 	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,		\
131 	.apmg_not_supported = true,					\
132 	.mq_rx_supported = true,					\
133 	.vht_mu_mimo_supported = true,					\
134 	.mac_addr_from_csr = true,					\
135 	.use_tfh = true,						\
136 	.rf_id = true,							\
137 	.gen2 = true,							\
138 	.nvm_type = IWL_NVM_EXT,					\
139 	.dbgc_supported = true,						\
140 	.tx_cmd_queue_size = 32,					\
141 	.min_umac_error_event_table = 0x400000
142 
143 const struct iwl_cfg iwl22000_2ac_cfg_hr = {
144 	.name = "Intel(R) Dual Band Wireless AC 22000",
145 	.fw_name_pre = IWL_22000_HR_FW_PRE,
146 	IWL_DEVICE_22000,
147 	.ht_params = &iwl_22000_ht_params,
148 	.nvm_ver = IWL_22000_NVM_VERSION,
149 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
150 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
151 };
152 
153 const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb = {
154 	.name = "Intel(R) Dual Band Wireless AC 22000",
155 	.fw_name_pre = IWL_22000_HR_CDB_FW_PRE,
156 	IWL_DEVICE_22000,
157 	.ht_params = &iwl_22000_ht_params,
158 	.nvm_ver = IWL_22000_NVM_VERSION,
159 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
160 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
161 	.cdb = true,
162 };
163 
164 const struct iwl_cfg iwl22000_2ac_cfg_jf = {
165 	.name = "Intel(R) Dual Band Wireless AC 22000",
166 	.fw_name_pre = IWL_22000_JF_FW_PRE,
167 	IWL_DEVICE_22000,
168 	.ht_params = &iwl_22000_ht_params,
169 	.nvm_ver = IWL_22000_NVM_VERSION,
170 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
171 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
172 };
173 
174 const struct iwl_cfg iwl22000_2ax_cfg_hr = {
175 	.name = "Intel(R) Dual Band Wireless AX 22000",
176 	.fw_name_pre = IWL_22000_HR_FW_PRE,
177 	IWL_DEVICE_22000,
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 	.ht_params = &iwl_22000_ht_params,
189 	.nvm_ver = IWL_22000_NVM_VERSION,
190 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
191 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
192 };
193 
194 const struct iwl_cfg iwl22000_2ax_cfg_qnj_jf_b0 = {
195 	.name = "Intel(R) Dual Band Wireless AX 22000",
196 	.fw_name_pre = IWL_22000_JF_B0_FW_PRE,
197 	IWL_DEVICE_22000,
198 	.ht_params = &iwl_22000_ht_params,
199 	.nvm_ver = IWL_22000_NVM_VERSION,
200 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
201 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
202 };
203 
204 const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_a0 = {
205 	.name = "Intel(R) Dual Band Wireless AX 22000",
206 	.fw_name_pre = IWL_22000_HR_A0_FW_PRE,
207 	IWL_DEVICE_22000,
208 	.ht_params = &iwl_22000_ht_params,
209 	.nvm_ver = IWL_22000_NVM_VERSION,
210 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
211 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
212 };
213 
214 MODULE_FIRMWARE(IWL_22000_HR_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
215 MODULE_FIRMWARE(IWL_22000_JF_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
216 MODULE_FIRMWARE(IWL_22000_HR_F0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
217 MODULE_FIRMWARE(IWL_22000_JF_B0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
218 MODULE_FIRMWARE(IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
219