18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/******************************************************************************
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
58c2ecf20Sopenharmony_ci * Copyright(c) 2018 - 2019 Intel Corporation
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Contact Information:
88c2ecf20Sopenharmony_ci *  Intel Linux Wireless <linuxwifi@intel.com>
98c2ecf20Sopenharmony_ci * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci *****************************************************************************/
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <linux/module.h>
148c2ecf20Sopenharmony_ci#include <linux/stringify.h>
158c2ecf20Sopenharmony_ci#include "iwl-config.h"
168c2ecf20Sopenharmony_ci#include "iwl-agn-hw.h"
178c2ecf20Sopenharmony_ci#include "dvm/commands.h" /* needed for BT for now */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/* Highest firmware API version supported */
208c2ecf20Sopenharmony_ci#define IWL2030_UCODE_API_MAX 6
218c2ecf20Sopenharmony_ci#define IWL2000_UCODE_API_MAX 6
228c2ecf20Sopenharmony_ci#define IWL105_UCODE_API_MAX 6
238c2ecf20Sopenharmony_ci#define IWL135_UCODE_API_MAX 6
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* Lowest firmware API version supported */
268c2ecf20Sopenharmony_ci#define IWL2030_UCODE_API_MIN 5
278c2ecf20Sopenharmony_ci#define IWL2000_UCODE_API_MIN 5
288c2ecf20Sopenharmony_ci#define IWL105_UCODE_API_MIN 5
298c2ecf20Sopenharmony_ci#define IWL135_UCODE_API_MIN 5
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* EEPROM version */
328c2ecf20Sopenharmony_ci#define EEPROM_2000_TX_POWER_VERSION	(6)
338c2ecf20Sopenharmony_ci#define EEPROM_2000_EEPROM_VERSION	(0x805)
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define IWL2030_FW_PRE "iwlwifi-2030-"
378c2ecf20Sopenharmony_ci#define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE __stringify(api) ".ucode"
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define IWL2000_FW_PRE "iwlwifi-2000-"
408c2ecf20Sopenharmony_ci#define IWL2000_MODULE_FIRMWARE(api) IWL2000_FW_PRE __stringify(api) ".ucode"
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define IWL105_FW_PRE "iwlwifi-105-"
438c2ecf20Sopenharmony_ci#define IWL105_MODULE_FIRMWARE(api) IWL105_FW_PRE __stringify(api) ".ucode"
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define IWL135_FW_PRE "iwlwifi-135-"
468c2ecf20Sopenharmony_ci#define IWL135_MODULE_FIRMWARE(api) IWL135_FW_PRE __stringify(api) ".ucode"
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistatic const struct iwl_base_params iwl2000_base_params = {
498c2ecf20Sopenharmony_ci	.eeprom_size = OTP_LOW_IMAGE_SIZE_2K,
508c2ecf20Sopenharmony_ci	.num_of_queues = IWLAGN_NUM_QUEUES,
518c2ecf20Sopenharmony_ci	.max_tfd_queue_size = 256,
528c2ecf20Sopenharmony_ci	.max_ll_items = OTP_MAX_LL_ITEMS_2x00,
538c2ecf20Sopenharmony_ci	.shadow_ram_support = true,
548c2ecf20Sopenharmony_ci	.led_compensation = 51,
558c2ecf20Sopenharmony_ci	.wd_timeout = IWL_DEF_WD_TIMEOUT,
568c2ecf20Sopenharmony_ci	.max_event_log_size = 512,
578c2ecf20Sopenharmony_ci	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
588c2ecf20Sopenharmony_ci	.scd_chain_ext_wa = true,
598c2ecf20Sopenharmony_ci};
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_cistatic const struct iwl_base_params iwl2030_base_params = {
638c2ecf20Sopenharmony_ci	.eeprom_size = OTP_LOW_IMAGE_SIZE_2K,
648c2ecf20Sopenharmony_ci	.num_of_queues = IWLAGN_NUM_QUEUES,
658c2ecf20Sopenharmony_ci	.max_tfd_queue_size = 256,
668c2ecf20Sopenharmony_ci	.max_ll_items = OTP_MAX_LL_ITEMS_2x00,
678c2ecf20Sopenharmony_ci	.shadow_ram_support = true,
688c2ecf20Sopenharmony_ci	.led_compensation = 57,
698c2ecf20Sopenharmony_ci	.wd_timeout = IWL_LONG_WD_TIMEOUT,
708c2ecf20Sopenharmony_ci	.max_event_log_size = 512,
718c2ecf20Sopenharmony_ci	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
728c2ecf20Sopenharmony_ci	.scd_chain_ext_wa = true,
738c2ecf20Sopenharmony_ci};
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistatic const struct iwl_ht_params iwl2000_ht_params = {
768c2ecf20Sopenharmony_ci	.ht_greenfield_support = true,
778c2ecf20Sopenharmony_ci	.use_rts_for_aggregation = true, /* use rts/cts protection */
788c2ecf20Sopenharmony_ci	.ht40_bands = BIT(NL80211_BAND_2GHZ),
798c2ecf20Sopenharmony_ci};
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_cistatic const struct iwl_eeprom_params iwl20x0_eeprom_params = {
828c2ecf20Sopenharmony_ci	.regulatory_bands = {
838c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_1_CHANNELS,
848c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_2_CHANNELS,
858c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_3_CHANNELS,
868c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_4_CHANNELS,
878c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_5_CHANNELS,
888c2ecf20Sopenharmony_ci		EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
898c2ecf20Sopenharmony_ci		EEPROM_REGULATORY_BAND_NO_HT40,
908c2ecf20Sopenharmony_ci	},
918c2ecf20Sopenharmony_ci	.enhanced_txpower = true,
928c2ecf20Sopenharmony_ci};
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define IWL_DEVICE_2000						\
958c2ecf20Sopenharmony_ci	.fw_name_pre = IWL2000_FW_PRE,				\
968c2ecf20Sopenharmony_ci	.ucode_api_max = IWL2000_UCODE_API_MAX,			\
978c2ecf20Sopenharmony_ci	.ucode_api_min = IWL2000_UCODE_API_MIN,			\
988c2ecf20Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_2000,		\
998c2ecf20Sopenharmony_ci	.max_inst_size = IWL60_RTC_INST_SIZE,			\
1008c2ecf20Sopenharmony_ci	.max_data_size = IWL60_RTC_DATA_SIZE,			\
1018c2ecf20Sopenharmony_ci	.nvm_ver = EEPROM_2000_EEPROM_VERSION,			\
1028c2ecf20Sopenharmony_ci	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,		\
1038c2ecf20Sopenharmony_ci	.trans.base_params = &iwl2000_base_params,		\
1048c2ecf20Sopenharmony_ci	.eeprom_params = &iwl20x0_eeprom_params,		\
1058c2ecf20Sopenharmony_ci	.led_mode = IWL_LED_RF_STATE,				\
1068c2ecf20Sopenharmony_ci	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl2000_2bgn_cfg = {
1108c2ecf20Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 2200 BGN",
1118c2ecf20Sopenharmony_ci	IWL_DEVICE_2000,
1128c2ecf20Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
1138c2ecf20Sopenharmony_ci};
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl2000_2bgn_d_cfg = {
1168c2ecf20Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 2200D BGN",
1178c2ecf20Sopenharmony_ci	IWL_DEVICE_2000,
1188c2ecf20Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
1198c2ecf20Sopenharmony_ci};
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#define IWL_DEVICE_2030						\
1228c2ecf20Sopenharmony_ci	.fw_name_pre = IWL2030_FW_PRE,				\
1238c2ecf20Sopenharmony_ci	.ucode_api_max = IWL2030_UCODE_API_MAX,			\
1248c2ecf20Sopenharmony_ci	.ucode_api_min = IWL2030_UCODE_API_MIN,			\
1258c2ecf20Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_2030,		\
1268c2ecf20Sopenharmony_ci	.max_inst_size = IWL60_RTC_INST_SIZE,			\
1278c2ecf20Sopenharmony_ci	.max_data_size = IWL60_RTC_DATA_SIZE,			\
1288c2ecf20Sopenharmony_ci	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
1298c2ecf20Sopenharmony_ci	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
1308c2ecf20Sopenharmony_ci	.trans.base_params = &iwl2030_base_params,		\
1318c2ecf20Sopenharmony_ci	.eeprom_params = &iwl20x0_eeprom_params,		\
1328c2ecf20Sopenharmony_ci	.led_mode = IWL_LED_RF_STATE,				\
1338c2ecf20Sopenharmony_ci	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl2030_2bgn_cfg = {
1368c2ecf20Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 2230 BGN",
1378c2ecf20Sopenharmony_ci	IWL_DEVICE_2030,
1388c2ecf20Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
1398c2ecf20Sopenharmony_ci};
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#define IWL_DEVICE_105						\
1428c2ecf20Sopenharmony_ci	.fw_name_pre = IWL105_FW_PRE,				\
1438c2ecf20Sopenharmony_ci	.ucode_api_max = IWL105_UCODE_API_MAX,			\
1448c2ecf20Sopenharmony_ci	.ucode_api_min = IWL105_UCODE_API_MIN,			\
1458c2ecf20Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_105,		\
1468c2ecf20Sopenharmony_ci	.max_inst_size = IWL60_RTC_INST_SIZE,			\
1478c2ecf20Sopenharmony_ci	.max_data_size = IWL60_RTC_DATA_SIZE,			\
1488c2ecf20Sopenharmony_ci	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
1498c2ecf20Sopenharmony_ci	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
1508c2ecf20Sopenharmony_ci	.trans.base_params = &iwl2000_base_params,		\
1518c2ecf20Sopenharmony_ci	.eeprom_params = &iwl20x0_eeprom_params,		\
1528c2ecf20Sopenharmony_ci	.led_mode = IWL_LED_RF_STATE,				\
1538c2ecf20Sopenharmony_ci	.rx_with_siso_diversity = true,				\
1548c2ecf20Sopenharmony_ci	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl105_bgn_cfg = {
1578c2ecf20Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 105 BGN",
1588c2ecf20Sopenharmony_ci	IWL_DEVICE_105,
1598c2ecf20Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
1608c2ecf20Sopenharmony_ci};
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl105_bgn_d_cfg = {
1638c2ecf20Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 105D BGN",
1648c2ecf20Sopenharmony_ci	IWL_DEVICE_105,
1658c2ecf20Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
1668c2ecf20Sopenharmony_ci};
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#define IWL_DEVICE_135						\
1698c2ecf20Sopenharmony_ci	.fw_name_pre = IWL135_FW_PRE,				\
1708c2ecf20Sopenharmony_ci	.ucode_api_max = IWL135_UCODE_API_MAX,			\
1718c2ecf20Sopenharmony_ci	.ucode_api_min = IWL135_UCODE_API_MIN,			\
1728c2ecf20Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_135,		\
1738c2ecf20Sopenharmony_ci	.max_inst_size = IWL60_RTC_INST_SIZE,			\
1748c2ecf20Sopenharmony_ci	.max_data_size = IWL60_RTC_DATA_SIZE,			\
1758c2ecf20Sopenharmony_ci	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
1768c2ecf20Sopenharmony_ci	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
1778c2ecf20Sopenharmony_ci	.trans.base_params = &iwl2030_base_params,		\
1788c2ecf20Sopenharmony_ci	.eeprom_params = &iwl20x0_eeprom_params,		\
1798c2ecf20Sopenharmony_ci	.led_mode = IWL_LED_RF_STATE,				\
1808c2ecf20Sopenharmony_ci	.rx_with_siso_diversity = true,				\
1818c2ecf20Sopenharmony_ci	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl135_bgn_cfg = {
1848c2ecf20Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 135 BGN",
1858c2ecf20Sopenharmony_ci	IWL_DEVICE_135,
1868c2ecf20Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
1878c2ecf20Sopenharmony_ci};
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ciMODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX));
1908c2ecf20Sopenharmony_ciMODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX));
1918c2ecf20Sopenharmony_ciMODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX));
1928c2ecf20Sopenharmony_ciMODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX));
193