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 	.shadow_ram_support = true,
108 	.led_compensation = 57,
109 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
110 	.max_event_log_size = 512,
111 	.shadow_reg_enable = true,
112 	.pcie_l1_allowed = true,
113 };
114 
115 static const struct iwl_ht_params iwl8000_ht_params = {
116 	.stbc = true,
117 	.ldpc = true,
118 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
119 };
120 
121 static const struct iwl_tt_params iwl8000_tt_params = {
122 	.ct_kill_entry = 115,
123 	.ct_kill_exit = 93,
124 	.ct_kill_duration = 5,
125 	.dynamic_smps_entry = 111,
126 	.dynamic_smps_exit = 107,
127 	.tx_protection_entry = 112,
128 	.tx_protection_exit = 105,
129 	.tx_backoff = {
130 		{.temperature = 110, .backoff = 200},
131 		{.temperature = 111, .backoff = 600},
132 		{.temperature = 112, .backoff = 1200},
133 		{.temperature = 113, .backoff = 2000},
134 		{.temperature = 114, .backoff = 4000},
135 	},
136 	.support_ct_kill = true,
137 	.support_dynamic_smps = true,
138 	.support_tx_protection = true,
139 	.support_tx_backoff = true,
140 };
141 
142 #define IWL_DEVICE_8000_COMMON						\
143 	.device_family = IWL_DEVICE_FAMILY_8000,			\
144 	.base_params = &iwl8000_base_params,				\
145 	.led_mode = IWL_LED_RF_STATE,					\
146 	.nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_8000,		\
147 	.features = NETIF_F_RXCSUM,					\
148 	.non_shared_ant = ANT_A,					\
149 	.dccm_offset = IWL8260_DCCM_OFFSET,				\
150 	.dccm_len = IWL8260_DCCM_LEN,					\
151 	.dccm2_offset = IWL8260_DCCM2_OFFSET,				\
152 	.dccm2_len = IWL8260_DCCM2_LEN,					\
153 	.smem_offset = IWL8260_SMEM_OFFSET,				\
154 	.smem_len = IWL8260_SMEM_LEN,					\
155 	.default_nvm_file_C_step = DEFAULT_NVM_FILE_FAMILY_8000C,	\
156 	.thermal_params = &iwl8000_tt_params,				\
157 	.apmg_not_supported = true,					\
158 	.nvm_type = IWL_NVM_EXT,					\
159 	.dbgc_supported = true,						\
160 	.min_umac_error_event_table = 0x800000,				\
161 	.csr = &iwl_csr_v1
162 
163 #define IWL_DEVICE_8000							\
164 	IWL_DEVICE_8000_COMMON,						\
165 	.ucode_api_max = IWL8000_UCODE_API_MAX,				\
166 	.ucode_api_min = IWL8000_UCODE_API_MIN				\
167 
168 #define IWL_DEVICE_8260							\
169 	IWL_DEVICE_8000_COMMON,						\
170 	.ucode_api_max = IWL8000_UCODE_API_MAX,				\
171 	.ucode_api_min = IWL8000_UCODE_API_MIN				\
172 
173 #define IWL_DEVICE_8265							\
174 	IWL_DEVICE_8000_COMMON,						\
175 	.ucode_api_max = IWL8265_UCODE_API_MAX,				\
176 	.ucode_api_min = IWL8265_UCODE_API_MIN				\
177 
178 const struct iwl_cfg iwl8260_2n_cfg = {
179 	.name = "Intel(R) Dual Band Wireless N 8260",
180 	.fw_name_pre = IWL8000_FW_PRE,
181 	IWL_DEVICE_8260,
182 	.ht_params = &iwl8000_ht_params,
183 	.nvm_ver = IWL8000_NVM_VERSION,
184 	.nvm_calib_ver = IWL8000_TX_POWER_VERSION,
185 };
186 
187 const struct iwl_cfg iwl8260_2ac_cfg = {
188 	.name = "Intel(R) Dual Band Wireless AC 8260",
189 	.fw_name_pre = IWL8000_FW_PRE,
190 	IWL_DEVICE_8260,
191 	.ht_params = &iwl8000_ht_params,
192 	.nvm_ver = IWL8000_NVM_VERSION,
193 	.nvm_calib_ver = IWL8000_TX_POWER_VERSION,
194 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
195 };
196 
197 const struct iwl_cfg iwl8265_2ac_cfg = {
198 	.name = "Intel(R) Dual Band Wireless AC 8265",
199 	.fw_name_pre = IWL8265_FW_PRE,
200 	IWL_DEVICE_8265,
201 	.ht_params = &iwl8000_ht_params,
202 	.nvm_ver = IWL8000_NVM_VERSION,
203 	.nvm_calib_ver = IWL8000_TX_POWER_VERSION,
204 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
205 	.vht_mu_mimo_supported = true,
206 };
207 
208 const struct iwl_cfg iwl8275_2ac_cfg = {
209 	.name = "Intel(R) Dual Band Wireless AC 8275",
210 	.fw_name_pre = IWL8265_FW_PRE,
211 	IWL_DEVICE_8265,
212 	.ht_params = &iwl8000_ht_params,
213 	.nvm_ver = IWL8000_NVM_VERSION,
214 	.nvm_calib_ver = IWL8000_TX_POWER_VERSION,
215 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
216 	.vht_mu_mimo_supported = true,
217 };
218 
219 const struct iwl_cfg iwl4165_2ac_cfg = {
220 	.name = "Intel(R) Dual Band Wireless AC 4165",
221 	.fw_name_pre = IWL8000_FW_PRE,
222 	IWL_DEVICE_8000,
223 	.ht_params = &iwl8000_ht_params,
224 	.nvm_ver = IWL8000_NVM_VERSION,
225 	.nvm_calib_ver = IWL8000_TX_POWER_VERSION,
226 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
227 };
228 
229 MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_MAX));
230 MODULE_FIRMWARE(IWL8265_MODULE_FIRMWARE(IWL8265_UCODE_API_MAX));
231