18c2ecf20Sopenharmony_ci/******************************************************************************
28c2ecf20Sopenharmony_ci *
38c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license.  When using or
48c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * GPL LICENSE SUMMARY
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright(c) 2015-2017 Intel Deutschland GmbH
98c2ecf20Sopenharmony_ci * Copyright(c) 2018 - 2020 Intel Corporation
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
128c2ecf20Sopenharmony_ci * it under the terms of version 2 of the GNU General Public License as
138c2ecf20Sopenharmony_ci * published by the Free Software Foundation.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but
168c2ecf20Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of
178c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
188c2ecf20Sopenharmony_ci * General Public License for more details.
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci * BSD LICENSE
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * Copyright(c) 2015-2017 Intel Deutschland GmbH
238c2ecf20Sopenharmony_ci * Copyright(c) 2018 - 2020 Intel Corporation
248c2ecf20Sopenharmony_ci * All rights reserved.
258c2ecf20Sopenharmony_ci *
268c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
278c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions
288c2ecf20Sopenharmony_ci * are met:
298c2ecf20Sopenharmony_ci *
308c2ecf20Sopenharmony_ci *  * Redistributions of source code must retain the above copyright
318c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer.
328c2ecf20Sopenharmony_ci *  * Redistributions in binary form must reproduce the above copyright
338c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer in
348c2ecf20Sopenharmony_ci *    the documentation and/or other materials provided with the
358c2ecf20Sopenharmony_ci *    distribution.
368c2ecf20Sopenharmony_ci *  * Neither the name Intel Corporation nor the names of its
378c2ecf20Sopenharmony_ci *    contributors may be used to endorse or promote products derived
388c2ecf20Sopenharmony_ci *    from this software without specific prior written permission.
398c2ecf20Sopenharmony_ci *
408c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
418c2ecf20Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
428c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
438c2ecf20Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
448c2ecf20Sopenharmony_ci * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
458c2ecf20Sopenharmony_ci * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
468c2ecf20Sopenharmony_ci * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
478c2ecf20Sopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
488c2ecf20Sopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
498c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
508c2ecf20Sopenharmony_ci * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
518c2ecf20Sopenharmony_ci *
528c2ecf20Sopenharmony_ci *****************************************************************************/
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#include <linux/module.h>
558c2ecf20Sopenharmony_ci#include <linux/stringify.h>
568c2ecf20Sopenharmony_ci#include "iwl-config.h"
578c2ecf20Sopenharmony_ci#include "fw/file.h"
588c2ecf20Sopenharmony_ci#include "iwl-prph.h"
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/* Highest firmware API version supported */
618c2ecf20Sopenharmony_ci#define IWL9000_UCODE_API_MAX	46
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/* Lowest firmware API version supported */
648c2ecf20Sopenharmony_ci#define IWL9000_UCODE_API_MIN	30
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/* NVM versions */
678c2ecf20Sopenharmony_ci#define IWL9000_NVM_VERSION		0x0a1d
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/* Memory offsets and lengths */
708c2ecf20Sopenharmony_ci#define IWL9000_DCCM_OFFSET		0x800000
718c2ecf20Sopenharmony_ci#define IWL9000_DCCM_LEN		0x18000
728c2ecf20Sopenharmony_ci#define IWL9000_DCCM2_OFFSET		0x880000
738c2ecf20Sopenharmony_ci#define IWL9000_DCCM2_LEN		0x8000
748c2ecf20Sopenharmony_ci#define IWL9000_SMEM_OFFSET		0x400000
758c2ecf20Sopenharmony_ci#define IWL9000_SMEM_LEN		0x68000
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define  IWL9000_FW_PRE "iwlwifi-9000-pu-b0-jf-b0-"
788c2ecf20Sopenharmony_ci#define  IWL9260_FW_PRE "iwlwifi-9260-th-b0-jf-b0-"
798c2ecf20Sopenharmony_ci#define IWL9000_MODULE_FIRMWARE(api) \
808c2ecf20Sopenharmony_ci	IWL9000_FW_PRE __stringify(api) ".ucode"
818c2ecf20Sopenharmony_ci#define IWL9260_MODULE_FIRMWARE(api) \
828c2ecf20Sopenharmony_ci	IWL9260_FW_PRE __stringify(api) ".ucode"
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_cistatic const struct iwl_base_params iwl9000_base_params = {
858c2ecf20Sopenharmony_ci	.eeprom_size = OTP_LOW_IMAGE_SIZE_32K,
868c2ecf20Sopenharmony_ci	.num_of_queues = 31,
878c2ecf20Sopenharmony_ci	.max_tfd_queue_size = 256,
888c2ecf20Sopenharmony_ci	.shadow_ram_support = true,
898c2ecf20Sopenharmony_ci	.led_compensation = 57,
908c2ecf20Sopenharmony_ci	.wd_timeout = IWL_LONG_WD_TIMEOUT,
918c2ecf20Sopenharmony_ci	.max_event_log_size = 512,
928c2ecf20Sopenharmony_ci	.shadow_reg_enable = true,
938c2ecf20Sopenharmony_ci	.pcie_l1_allowed = true,
948c2ecf20Sopenharmony_ci};
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_cistatic const struct iwl_ht_params iwl9000_ht_params = {
978c2ecf20Sopenharmony_ci	.stbc = true,
988c2ecf20Sopenharmony_ci	.ldpc = true,
998c2ecf20Sopenharmony_ci	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
1008c2ecf20Sopenharmony_ci};
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_cistatic const struct iwl_tt_params iwl9000_tt_params = {
1038c2ecf20Sopenharmony_ci	.ct_kill_entry = 115,
1048c2ecf20Sopenharmony_ci	.ct_kill_exit = 93,
1058c2ecf20Sopenharmony_ci	.ct_kill_duration = 5,
1068c2ecf20Sopenharmony_ci	.dynamic_smps_entry = 111,
1078c2ecf20Sopenharmony_ci	.dynamic_smps_exit = 107,
1088c2ecf20Sopenharmony_ci	.tx_protection_entry = 112,
1098c2ecf20Sopenharmony_ci	.tx_protection_exit = 105,
1108c2ecf20Sopenharmony_ci	.tx_backoff = {
1118c2ecf20Sopenharmony_ci		{.temperature = 110, .backoff = 200},
1128c2ecf20Sopenharmony_ci		{.temperature = 111, .backoff = 600},
1138c2ecf20Sopenharmony_ci		{.temperature = 112, .backoff = 1200},
1148c2ecf20Sopenharmony_ci		{.temperature = 113, .backoff = 2000},
1158c2ecf20Sopenharmony_ci		{.temperature = 114, .backoff = 4000},
1168c2ecf20Sopenharmony_ci	},
1178c2ecf20Sopenharmony_ci	.support_ct_kill = true,
1188c2ecf20Sopenharmony_ci	.support_dynamic_smps = true,
1198c2ecf20Sopenharmony_ci	.support_tx_protection = true,
1208c2ecf20Sopenharmony_ci	.support_tx_backoff = true,
1218c2ecf20Sopenharmony_ci};
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci#define IWL_DEVICE_9000							\
1248c2ecf20Sopenharmony_ci	.ucode_api_max = IWL9000_UCODE_API_MAX,				\
1258c2ecf20Sopenharmony_ci	.ucode_api_min = IWL9000_UCODE_API_MIN,				\
1268c2ecf20Sopenharmony_ci	.led_mode = IWL_LED_RF_STATE,					\
1278c2ecf20Sopenharmony_ci	.nvm_hw_section_num = 10,					\
1288c2ecf20Sopenharmony_ci	.non_shared_ant = ANT_B,					\
1298c2ecf20Sopenharmony_ci	.dccm_offset = IWL9000_DCCM_OFFSET,				\
1308c2ecf20Sopenharmony_ci	.dccm_len = IWL9000_DCCM_LEN,					\
1318c2ecf20Sopenharmony_ci	.dccm2_offset = IWL9000_DCCM2_OFFSET,				\
1328c2ecf20Sopenharmony_ci	.dccm2_len = IWL9000_DCCM2_LEN,					\
1338c2ecf20Sopenharmony_ci	.smem_offset = IWL9000_SMEM_OFFSET,				\
1348c2ecf20Sopenharmony_ci	.smem_len = IWL9000_SMEM_LEN,					\
1358c2ecf20Sopenharmony_ci	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,		\
1368c2ecf20Sopenharmony_ci	.thermal_params = &iwl9000_tt_params,				\
1378c2ecf20Sopenharmony_ci	.apmg_not_supported = true,					\
1388c2ecf20Sopenharmony_ci	.num_rbds = 512,						\
1398c2ecf20Sopenharmony_ci	.vht_mu_mimo_supported = true,					\
1408c2ecf20Sopenharmony_ci	.mac_addr_from_csr = true,					\
1418c2ecf20Sopenharmony_ci	.nvm_type = IWL_NVM_EXT,					\
1428c2ecf20Sopenharmony_ci	.dbgc_supported = true,						\
1438c2ecf20Sopenharmony_ci	.min_umac_error_event_table = 0x800000,				\
1448c2ecf20Sopenharmony_ci	.d3_debug_data_base_addr = 0x401000,				\
1458c2ecf20Sopenharmony_ci	.d3_debug_data_length = 92 * 1024,				\
1468c2ecf20Sopenharmony_ci	.ht_params = &iwl9000_ht_params,				\
1478c2ecf20Sopenharmony_ci	.nvm_ver = IWL9000_NVM_VERSION,					\
1488c2ecf20Sopenharmony_ci	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,		\
1498c2ecf20Sopenharmony_ci	.mon_smem_regs = {						\
1508c2ecf20Sopenharmony_ci		.write_ptr = {						\
1518c2ecf20Sopenharmony_ci			.addr = LDBG_M2S_BUF_WPTR,			\
1528c2ecf20Sopenharmony_ci			.mask = LDBG_M2S_BUF_WPTR_VAL_MSK,		\
1538c2ecf20Sopenharmony_ci		},							\
1548c2ecf20Sopenharmony_ci		.cycle_cnt = {						\
1558c2ecf20Sopenharmony_ci			.addr = LDBG_M2S_BUF_WRAP_CNT,			\
1568c2ecf20Sopenharmony_ci			.mask = LDBG_M2S_BUF_WRAP_CNT_VAL_MSK,		\
1578c2ecf20Sopenharmony_ci		},							\
1588c2ecf20Sopenharmony_ci	},								\
1598c2ecf20Sopenharmony_ci	.mon_dram_regs = {						\
1608c2ecf20Sopenharmony_ci		.write_ptr = {						\
1618c2ecf20Sopenharmony_ci			.addr = MON_BUFF_WRPTR_VER2,			\
1628c2ecf20Sopenharmony_ci			.mask = 0xffffffff,				\
1638c2ecf20Sopenharmony_ci		},							\
1648c2ecf20Sopenharmony_ci		.cycle_cnt = {						\
1658c2ecf20Sopenharmony_ci			.addr = MON_BUFF_CYCLE_CNT_VER2,		\
1668c2ecf20Sopenharmony_ci			.mask = 0xffffffff,				\
1678c2ecf20Sopenharmony_ci		},							\
1688c2ecf20Sopenharmony_ci	}
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ciconst struct iwl_cfg_trans_params iwl9000_trans_cfg = {
1718c2ecf20Sopenharmony_ci	.device_family = IWL_DEVICE_FAMILY_9000,
1728c2ecf20Sopenharmony_ci	.base_params = &iwl9000_base_params,
1738c2ecf20Sopenharmony_ci	.mq_rx_supported = true,
1748c2ecf20Sopenharmony_ci	.rf_id = true,
1758c2ecf20Sopenharmony_ci};
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ciconst struct iwl_cfg_trans_params iwl9560_trans_cfg = {
1788c2ecf20Sopenharmony_ci	.device_family = IWL_DEVICE_FAMILY_9000,
1798c2ecf20Sopenharmony_ci	.base_params = &iwl9000_base_params,
1808c2ecf20Sopenharmony_ci	.mq_rx_supported = true,
1818c2ecf20Sopenharmony_ci	.rf_id = true,
1828c2ecf20Sopenharmony_ci	.integrated = true,
1838c2ecf20Sopenharmony_ci	.xtal_latency = 650,
1848c2ecf20Sopenharmony_ci};
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ciconst struct iwl_cfg_trans_params iwl9560_long_latency_trans_cfg = {
1878c2ecf20Sopenharmony_ci	.device_family = IWL_DEVICE_FAMILY_9000,
1888c2ecf20Sopenharmony_ci	.base_params = &iwl9000_base_params,
1898c2ecf20Sopenharmony_ci	.mq_rx_supported = true,
1908c2ecf20Sopenharmony_ci	.rf_id = true,
1918c2ecf20Sopenharmony_ci	.integrated = true,
1928c2ecf20Sopenharmony_ci	.xtal_latency = 2820,
1938c2ecf20Sopenharmony_ci};
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ciconst struct iwl_cfg_trans_params iwl9560_shared_clk_trans_cfg = {
1968c2ecf20Sopenharmony_ci	.device_family = IWL_DEVICE_FAMILY_9000,
1978c2ecf20Sopenharmony_ci	.base_params = &iwl9000_base_params,
1988c2ecf20Sopenharmony_ci	.mq_rx_supported = true,
1998c2ecf20Sopenharmony_ci	.rf_id = true,
2008c2ecf20Sopenharmony_ci	.integrated = true,
2018c2ecf20Sopenharmony_ci	.xtal_latency = 670,
2028c2ecf20Sopenharmony_ci	.extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
2038c2ecf20Sopenharmony_ci};
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ciconst char iwl9162_name[] = "Intel(R) Wireless-AC 9162";
2068c2ecf20Sopenharmony_ciconst char iwl9260_name[] = "Intel(R) Wireless-AC 9260";
2078c2ecf20Sopenharmony_ciconst char iwl9260_1_name[] = "Intel(R) Wireless-AC 9260-1";
2088c2ecf20Sopenharmony_ciconst char iwl9270_name[] = "Intel(R) Wireless-AC 9270";
2098c2ecf20Sopenharmony_ciconst char iwl9461_name[] = "Intel(R) Wireless-AC 9461";
2108c2ecf20Sopenharmony_ciconst char iwl9462_name[] = "Intel(R) Wireless-AC 9462";
2118c2ecf20Sopenharmony_ciconst char iwl9560_name[] = "Intel(R) Wireless-AC 9560";
2128c2ecf20Sopenharmony_ciconst char iwl9162_160_name[] = "Intel(R) Wireless-AC 9162 160MHz";
2138c2ecf20Sopenharmony_ciconst char iwl9260_160_name[] = "Intel(R) Wireless-AC 9260 160MHz";
2148c2ecf20Sopenharmony_ciconst char iwl9270_160_name[] = "Intel(R) Wireless-AC 9270 160MHz";
2158c2ecf20Sopenharmony_ciconst char iwl9461_160_name[] = "Intel(R) Wireless-AC 9461 160MHz";
2168c2ecf20Sopenharmony_ciconst char iwl9462_160_name[] = "Intel(R) Wireless-AC 9462 160MHz";
2178c2ecf20Sopenharmony_ciconst char iwl9560_160_name[] = "Intel(R) Wireless-AC 9560 160MHz";
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ciconst char iwl9260_killer_1550_name[] =
2208c2ecf20Sopenharmony_ci	"Killer (R) Wireless-AC 1550 Wireless Network Adapter (9260NGW)";
2218c2ecf20Sopenharmony_ciconst char iwl9560_killer_1550i_name[] =
2228c2ecf20Sopenharmony_ci	"Killer (R) Wireless-AC 1550i Wireless Network Adapter (9560NGW)";
2238c2ecf20Sopenharmony_ciconst char iwl9560_killer_1550s_name[] =
2248c2ecf20Sopenharmony_ci	"Killer (R) Wireless-AC 1550s Wireless Network Adapter (9560NGW)";
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl9260_2ac_cfg = {
2278c2ecf20Sopenharmony_ci	.fw_name_pre = IWL9260_FW_PRE,
2288c2ecf20Sopenharmony_ci	IWL_DEVICE_9000,
2298c2ecf20Sopenharmony_ci};
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl9560_2ac_cfg_soc = {
2328c2ecf20Sopenharmony_ci	.fw_name_pre = IWL9000_FW_PRE,
2338c2ecf20Sopenharmony_ci	IWL_DEVICE_9000,
2348c2ecf20Sopenharmony_ci};
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ciMODULE_FIRMWARE(IWL9000_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
2378c2ecf20Sopenharmony_ciMODULE_FIRMWARE(IWL9260_MODULE_FIRMWARE(IWL9000_UCODE_API_MAX));
238