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  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of version 2 of the GNU General Public License as
12  * published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * General Public License for more details.
18  *
19  * BSD LICENSE
20  *
21  * Copyright(c) 2015-2017 Intel Deutschland GmbH
22  * All rights reserved.
23  *
24  * Redistribution and use in source and binary forms, with or without
25  * modification, are permitted provided that the following conditions
26  * are met:
27  *
28  *  * Redistributions of source code must retain the above copyright
29  *    notice, this list of conditions and the following disclaimer.
30  *  * Redistributions in binary form must reproduce the above copyright
31  *    notice, this list of conditions and the following disclaimer in
32  *    the documentation and/or other materials provided with the
33  *    distribution.
34  *  * Neither the name Intel Corporation nor the names of its
35  *    contributors may be used to endorse or promote products derived
36  *    from this software without specific prior written permission.
37  *
38  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
39  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
40  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
41  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
42  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
45  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
46  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
47  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49  *
50  *****************************************************************************/
51 
52 #include <linux/module.h>
53 #include <linux/stringify.h>
54 #include "iwl-config.h"
55 #include "iwl-agn-hw.h"
56 
57 /* Highest firmware API version supported */
58 #define IWL_22000_UCODE_API_MAX	36
59 
60 /* Lowest firmware API version supported */
61 #define IWL_22000_UCODE_API_MIN	24
62 
63 /* NVM versions */
64 #define IWL_22000_NVM_VERSION		0x0a1d
65 #define IWL_22000_TX_POWER_VERSION	0xffff /* meaningless */
66 
67 /* Memory offsets and lengths */
68 #define IWL_22000_DCCM_OFFSET		0x800000 /* LMAC1 */
69 #define IWL_22000_DCCM_LEN		0x10000 /* LMAC1 */
70 #define IWL_22000_DCCM2_OFFSET		0x880000
71 #define IWL_22000_DCCM2_LEN		0x8000
72 #define IWL_22000_SMEM_OFFSET		0x400000
73 #define IWL_22000_SMEM_LEN		0xD0000
74 
75 #define IWL_22000_JF_FW_PRE	"iwlwifi-Qu-a0-jf-b0-"
76 #define IWL_22000_HR_FW_PRE	"iwlwifi-Qu-a0-hr-a0-"
77 #define IWL_22000_HR_CDB_FW_PRE	"iwlwifi-QuIcp-z0-hrcdb-a0-"
78 #define IWL_22000_HR_F0_FW_PRE	"iwlwifi-QuQnj-f0-hr-a0-"
79 #define IWL_22000_JF_B0_FW_PRE	"iwlwifi-QuQnj-a0-jf-b0-"
80 #define IWL_22000_HR_A0_FW_PRE	"iwlwifi-QuQnj-a0-hr-a0-"
81 
82 #define IWL_22000_HR_MODULE_FIRMWARE(api) \
83 	IWL_22000_HR_FW_PRE __stringify(api) ".ucode"
84 #define IWL_22000_JF_MODULE_FIRMWARE(api) \
85 	IWL_22000_JF_FW_PRE __stringify(api) ".ucode"
86 #define IWL_22000_HR_F0_QNJ_MODULE_FIRMWARE(api) \
87 	IWL_22000_HR_F0_FW_PRE __stringify(api) ".ucode"
88 #define IWL_22000_JF_B0_QNJ_MODULE_FIRMWARE(api) \
89 	IWL_22000_JF_B0_FW_PRE __stringify(api) ".ucode"
90 #define IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(api) \
91 	IWL_22000_HR_A0_FW_PRE __stringify(api) ".ucode"
92 
93 #define NVM_HW_SECTION_NUM_FAMILY_22000		10
94 
95 static const struct iwl_base_params iwl_22000_base_params = {
96 	.eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_22000,
97 	.num_of_queues = 512,
98 	.shadow_ram_support = true,
99 	.led_compensation = 57,
100 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
101 	.max_event_log_size = 512,
102 	.shadow_reg_enable = true,
103 	.pcie_l1_allowed = true,
104 };
105 
106 static const struct iwl_ht_params iwl_22000_ht_params = {
107 	.stbc = true,
108 	.ldpc = true,
109 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
110 };
111 
112 #define IWL_DEVICE_22000						\
113 	.ucode_api_max = IWL_22000_UCODE_API_MAX,			\
114 	.ucode_api_min = IWL_22000_UCODE_API_MIN,			\
115 	.device_family = IWL_DEVICE_FAMILY_22000,			\
116 	.max_inst_size = IWL60_RTC_INST_SIZE,				\
117 	.max_data_size = IWL60_RTC_DATA_SIZE,				\
118 	.base_params = &iwl_22000_base_params,				\
119 	.led_mode = IWL_LED_RF_STATE,					\
120 	.nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_22000,		\
121 	.non_shared_ant = ANT_A,					\
122 	.dccm_offset = IWL_22000_DCCM_OFFSET,				\
123 	.dccm_len = IWL_22000_DCCM_LEN,					\
124 	.dccm2_offset = IWL_22000_DCCM2_OFFSET,				\
125 	.dccm2_len = IWL_22000_DCCM2_LEN,				\
126 	.smem_offset = IWL_22000_SMEM_OFFSET,				\
127 	.smem_len = IWL_22000_SMEM_LEN,					\
128 	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,		\
129 	.apmg_not_supported = true,					\
130 	.mq_rx_supported = true,					\
131 	.vht_mu_mimo_supported = true,					\
132 	.mac_addr_from_csr = true,					\
133 	.use_tfh = true,						\
134 	.rf_id = true,							\
135 	.gen2 = true,							\
136 	.nvm_type = IWL_NVM_EXT,					\
137 	.dbgc_supported = true,						\
138 	.tx_cmd_queue_size = 32,					\
139 	.min_umac_error_event_table = 0x400000
140 
141 const struct iwl_cfg iwl22000_2ac_cfg_hr = {
142 	.name = "Intel(R) Dual Band Wireless AC 22000",
143 	.fw_name_pre = IWL_22000_HR_FW_PRE,
144 	IWL_DEVICE_22000,
145 	.ht_params = &iwl_22000_ht_params,
146 	.nvm_ver = IWL_22000_NVM_VERSION,
147 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
148 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
149 };
150 
151 const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb = {
152 	.name = "Intel(R) Dual Band Wireless AC 22000",
153 	.fw_name_pre = IWL_22000_HR_CDB_FW_PRE,
154 	IWL_DEVICE_22000,
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 	.ht_params = &iwl_22000_ht_params,
167 	.nvm_ver = IWL_22000_NVM_VERSION,
168 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
169 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
170 };
171 
172 const struct iwl_cfg iwl22000_2ax_cfg_hr = {
173 	.name = "Intel(R) Dual Band Wireless AX 22000",
174 	.fw_name_pre = IWL_22000_HR_FW_PRE,
175 	IWL_DEVICE_22000,
176 	.ht_params = &iwl_22000_ht_params,
177 	.nvm_ver = IWL_22000_NVM_VERSION,
178 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
179 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
180 };
181 
182 const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_f0 = {
183 	.name = "Intel(R) Dual Band Wireless AX 22000",
184 	.fw_name_pre = IWL_22000_HR_F0_FW_PRE,
185 	IWL_DEVICE_22000,
186 	.ht_params = &iwl_22000_ht_params,
187 	.nvm_ver = IWL_22000_NVM_VERSION,
188 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
189 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
190 };
191 
192 const struct iwl_cfg iwl22000_2ax_cfg_qnj_jf_b0 = {
193 	.name = "Intel(R) Dual Band Wireless AX 22000",
194 	.fw_name_pre = IWL_22000_JF_B0_FW_PRE,
195 	IWL_DEVICE_22000,
196 	.ht_params = &iwl_22000_ht_params,
197 	.nvm_ver = IWL_22000_NVM_VERSION,
198 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
199 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
200 };
201 
202 const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_a0 = {
203 	.name = "Intel(R) Dual Band Wireless AX 22000",
204 	.fw_name_pre = IWL_22000_HR_A0_FW_PRE,
205 	IWL_DEVICE_22000,
206 	.ht_params = &iwl_22000_ht_params,
207 	.nvm_ver = IWL_22000_NVM_VERSION,
208 	.nvm_calib_ver = IWL_22000_TX_POWER_VERSION,
209 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
210 };
211 
212 MODULE_FIRMWARE(IWL_22000_HR_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
213 MODULE_FIRMWARE(IWL_22000_JF_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
214 MODULE_FIRMWARE(IWL_22000_HR_F0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
215 MODULE_FIRMWARE(IWL_22000_JF_B0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
216 MODULE_FIRMWARE(IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
217