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) 2014 Intel Corporation. All rights reserved.
9  * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
10  * Copyright(c) 2016        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  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
25  * USA
26  *
27  * The full GNU General Public License is included in this distribution
28  * in the file called COPYING.
29  *
30  * Contact Information:
31  *  Intel Linux Wireless <linuxwifi@intel.com>
32  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
33  *
34  * BSD LICENSE
35  *
36  * Copyright(c) 2014 Intel Corporation. All rights reserved.
37  * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
38  * Copyright(c) 2018        Intel Corporation
39  * All rights reserved.
40  *
41  * Redistribution and use in source and binary forms, with or without
42  * modification, are permitted provided that the following conditions
43  * are met:
44  *
45  *  * Redistributions of source code must retain the above copyright
46  *    notice, this list of conditions and the following disclaimer.
47  *  * Redistributions in binary form must reproduce the above copyright
48  *    notice, this list of conditions and the following disclaimer in
49  *    the documentation and/or other materials provided with the
50  *    distribution.
51  *  * Neither the name Intel Corporation nor the names of its
52  *    contributors may be used to endorse or promote products derived
53  *    from this software without specific prior written permission.
54  *
55  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
56  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
57  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
58  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
59  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
61  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
62  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
63  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
64  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
65  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
66  *
67  *****************************************************************************/
68 
69 #include <linux/module.h>
70 #include <linux/stringify.h>
71 #include "iwl-config.h"
72 
73 /* Highest firmware API version supported */
74 #define IWL8000_UCODE_API_MAX	36
75 #define IWL8265_UCODE_API_MAX	36
76 
77 /* Lowest firmware API version supported */
78 #define IWL8000_UCODE_API_MIN	22
79 #define IWL8265_UCODE_API_MIN	22
80 
81 /* NVM versions */
82 #define IWL8000_NVM_VERSION		0x0a1d
83 #define IWL8000_TX_POWER_VERSION	0xffff /* meaningless */
84 
85 /* Memory offsets and lengths */
86 #define IWL8260_DCCM_OFFSET		0x800000
87 #define IWL8260_DCCM_LEN		0x18000
88 #define IWL8260_DCCM2_OFFSET		0x880000
89 #define IWL8260_DCCM2_LEN		0x8000
90 #define IWL8260_SMEM_OFFSET		0x400000
91 #define IWL8260_SMEM_LEN		0x68000
92 
93 #define IWL8000_FW_PRE "iwlwifi-8000C-"
94 #define IWL8000_MODULE_FIRMWARE(api) \
95 	IWL8000_FW_PRE __stringify(api) ".ucode"
96 
97 #define IWL8265_FW_PRE "iwlwifi-8265-"
98 #define IWL8265_MODULE_FIRMWARE(api) \
99 	IWL8265_FW_PRE __stringify(api) ".ucode"
100 
101 #define NVM_HW_SECTION_NUM_FAMILY_8000		10
102 #define DEFAULT_NVM_FILE_FAMILY_8000C		"nvmData-8000C"
103 
104 static const struct iwl_base_params iwl8000_base_params = {
105 	.eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_8000,
106 	.num_of_queues = 31,
107 	.max_tfd_queue_size = 256,
108 	.shadow_ram_support = true,
109 	.led_compensation = 57,
110 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
111 	.max_event_log_size = 512,
112 	.shadow_reg_enable = true,
113 	.pcie_l1_allowed = true,
114 };
115 
116 static const struct iwl_ht_params iwl8000_ht_params = {
117 	.stbc = true,
118 	.ldpc = true,
119 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
120 };
121 
122 static const struct iwl_tt_params iwl8000_tt_params = {
123 	.ct_kill_entry = 115,
124 	.ct_kill_exit = 93,
125 	.ct_kill_duration = 5,
126 	.dynamic_smps_entry = 111,
127 	.dynamic_smps_exit = 107,
128 	.tx_protection_entry = 112,
129 	.tx_protection_exit = 105,
130 	.tx_backoff = {
131 		{.temperature = 110, .backoff = 200},
132 		{.temperature = 111, .backoff = 600},
133 		{.temperature = 112, .backoff = 1200},
134 		{.temperature = 113, .backoff = 2000},
135 		{.temperature = 114, .backoff = 4000},
136 	},
137 	.support_ct_kill = true,
138 	.support_dynamic_smps = true,
139 	.support_tx_protection = true,
140 	.support_tx_backoff = true,
141 };
142 
143 #define IWL_DEVICE_8000_COMMON						\
144 	.device_family = IWL_DEVICE_FAMILY_8000,			\
145 	.base_params = &iwl8000_base_params,				\
146 	.led_mode = IWL_LED_RF_STATE,					\
147 	.nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_8000,		\
148 	.features = NETIF_F_RXCSUM,					\
149 	.non_shared_ant = ANT_A,					\
150 	.dccm_offset = IWL8260_DCCM_OFFSET,				\
151 	.dccm_len = IWL8260_DCCM_LEN,					\
152 	.dccm2_offset = IWL8260_DCCM2_OFFSET,				\
153 	.dccm2_len = IWL8260_DCCM2_LEN,					\
154 	.smem_offset = IWL8260_SMEM_OFFSET,				\
155 	.smem_len = IWL8260_SMEM_LEN,					\
156 	.default_nvm_file_C_step = DEFAULT_NVM_FILE_FAMILY_8000C,	\
157 	.thermal_params = &iwl8000_tt_params,				\
158 	.apmg_not_supported = true,					\
159 	.nvm_type = IWL_NVM_EXT,					\
160 	.dbgc_supported = true,						\
161 	.min_umac_error_event_table = 0x800000,				\
162 	.csr = &iwl_csr_v1
163 
164 #define IWL_DEVICE_8000							\
165 	IWL_DEVICE_8000_COMMON,						\
166 	.ucode_api_max = IWL8000_UCODE_API_MAX,				\
167 	.ucode_api_min = IWL8000_UCODE_API_MIN				\
168 
169 #define IWL_DEVICE_8260							\
170 	IWL_DEVICE_8000_COMMON,						\
171 	.ucode_api_max = IWL8000_UCODE_API_MAX,				\
172 	.ucode_api_min = IWL8000_UCODE_API_MIN				\
173 
174 #define IWL_DEVICE_8265							\
175 	IWL_DEVICE_8000_COMMON,						\
176 	.ucode_api_max = IWL8265_UCODE_API_MAX,				\
177 	.ucode_api_min = IWL8265_UCODE_API_MIN				\
178 
179 const struct iwl_cfg iwl8260_2n_cfg = {
180 	.name = "Intel(R) Dual Band Wireless N 8260",
181 	.fw_name_pre = IWL8000_FW_PRE,
182 	IWL_DEVICE_8260,
183 	.ht_params = &iwl8000_ht_params,
184 	.nvm_ver = IWL8000_NVM_VERSION,
185 	.nvm_calib_ver = IWL8000_TX_POWER_VERSION,
186 };
187 
188 const struct iwl_cfg iwl8260_2ac_cfg = {
189 	.name = "Intel(R) Dual Band Wireless AC 8260",
190 	.fw_name_pre = IWL8000_FW_PRE,
191 	IWL_DEVICE_8260,
192 	.ht_params = &iwl8000_ht_params,
193 	.nvm_ver = IWL8000_NVM_VERSION,
194 	.nvm_calib_ver = IWL8000_TX_POWER_VERSION,
195 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
196 };
197 
198 const struct iwl_cfg iwl8265_2ac_cfg = {
199 	.name = "Intel(R) Dual Band Wireless AC 8265",
200 	.fw_name_pre = IWL8265_FW_PRE,
201 	IWL_DEVICE_8265,
202 	.ht_params = &iwl8000_ht_params,
203 	.nvm_ver = IWL8000_NVM_VERSION,
204 	.nvm_calib_ver = IWL8000_TX_POWER_VERSION,
205 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
206 	.vht_mu_mimo_supported = true,
207 };
208 
209 const struct iwl_cfg iwl8275_2ac_cfg = {
210 	.name = "Intel(R) Dual Band Wireless AC 8275",
211 	.fw_name_pre = IWL8265_FW_PRE,
212 	IWL_DEVICE_8265,
213 	.ht_params = &iwl8000_ht_params,
214 	.nvm_ver = IWL8000_NVM_VERSION,
215 	.nvm_calib_ver = IWL8000_TX_POWER_VERSION,
216 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
217 	.vht_mu_mimo_supported = true,
218 };
219 
220 const struct iwl_cfg iwl4165_2ac_cfg = {
221 	.name = "Intel(R) Dual Band Wireless AC 4165",
222 	.fw_name_pre = IWL8000_FW_PRE,
223 	IWL_DEVICE_8000,
224 	.ht_params = &iwl8000_ht_params,
225 	.nvm_ver = IWL8000_NVM_VERSION,
226 	.nvm_calib_ver = IWL8000_TX_POWER_VERSION,
227 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
228 };
229 
230 MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_MAX));
231 MODULE_FIRMWARE(IWL8265_MODULE_FIRMWARE(IWL8265_UCODE_API_MAX));
232