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 - 2019 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 - 2019 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
97static 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
109static 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
115static 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	.trans.device_family = IWL_DEVICE_FAMILY_8000,			\
138	.trans.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
156#define IWL_DEVICE_8000							\
157	IWL_DEVICE_8000_COMMON,						\
158	.ucode_api_max = IWL8000_UCODE_API_MAX,				\
159	.ucode_api_min = IWL8000_UCODE_API_MIN				\
160
161#define IWL_DEVICE_8260							\
162	IWL_DEVICE_8000_COMMON,						\
163	.ucode_api_max = IWL8000_UCODE_API_MAX,				\
164	.ucode_api_min = IWL8000_UCODE_API_MIN				\
165
166#define IWL_DEVICE_8265							\
167	IWL_DEVICE_8000_COMMON,						\
168	.ucode_api_max = IWL8265_UCODE_API_MAX,				\
169	.ucode_api_min = IWL8265_UCODE_API_MIN				\
170
171const struct iwl_cfg iwl8260_2n_cfg = {
172	.name = "Intel(R) Dual Band Wireless N 8260",
173	.fw_name_pre = IWL8000_FW_PRE,
174	IWL_DEVICE_8260,
175	.ht_params = &iwl8000_ht_params,
176	.nvm_ver = IWL8000_NVM_VERSION,
177};
178
179const struct iwl_cfg iwl8260_2ac_cfg = {
180	.name = "Intel(R) Dual Band Wireless AC 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	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
186};
187
188const struct iwl_cfg iwl8265_2ac_cfg = {
189	.name = "Intel(R) Dual Band Wireless AC 8265",
190	.fw_name_pre = IWL8265_FW_PRE,
191	IWL_DEVICE_8265,
192	.ht_params = &iwl8000_ht_params,
193	.nvm_ver = IWL8000_NVM_VERSION,
194	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
195	.vht_mu_mimo_supported = true,
196};
197
198const struct iwl_cfg iwl8275_2ac_cfg = {
199	.name = "Intel(R) Dual Band Wireless AC 8275",
200	.fw_name_pre = IWL8265_FW_PRE,
201	IWL_DEVICE_8265,
202	.ht_params = &iwl8000_ht_params,
203	.nvm_ver = IWL8000_NVM_VERSION,
204	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
205	.vht_mu_mimo_supported = true,
206};
207
208const struct iwl_cfg iwl4165_2ac_cfg = {
209	.name = "Intel(R) Dual Band Wireless AC 4165",
210	.fw_name_pre = IWL8000_FW_PRE,
211	IWL_DEVICE_8000,
212	.ht_params = &iwl8000_ht_params,
213	.nvm_ver = IWL8000_NVM_VERSION,
214	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,
215};
216
217MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_MAX));
218MODULE_FIRMWARE(IWL8265_MODULE_FIRMWARE(IWL8265_UCODE_API_MAX));
219