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