162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci/******************************************************************************
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
562306a36Sopenharmony_ci * Copyright(c) 2018 - 2020, 2023 Intel Corporation
662306a36Sopenharmony_ci *****************************************************************************/
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/module.h>
962306a36Sopenharmony_ci#include <linux/stringify.h>
1062306a36Sopenharmony_ci#include "iwl-config.h"
1162306a36Sopenharmony_ci#include "iwl-agn-hw.h"
1262306a36Sopenharmony_ci#include "dvm/commands.h" /* needed for BT for now */
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/* Highest firmware API version supported */
1562306a36Sopenharmony_ci#define IWL2030_UCODE_API_MAX 6
1662306a36Sopenharmony_ci#define IWL2000_UCODE_API_MAX 6
1762306a36Sopenharmony_ci#define IWL105_UCODE_API_MAX 6
1862306a36Sopenharmony_ci#define IWL135_UCODE_API_MAX 6
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci/* Lowest firmware API version supported */
2162306a36Sopenharmony_ci#define IWL2030_UCODE_API_MIN 5
2262306a36Sopenharmony_ci#define IWL2000_UCODE_API_MIN 5
2362306a36Sopenharmony_ci#define IWL105_UCODE_API_MIN 5
2462306a36Sopenharmony_ci#define IWL135_UCODE_API_MIN 5
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* EEPROM version */
2762306a36Sopenharmony_ci#define EEPROM_2000_TX_POWER_VERSION	(6)
2862306a36Sopenharmony_ci#define EEPROM_2000_EEPROM_VERSION	(0x805)
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#define IWL2030_FW_PRE "iwlwifi-2030"
3262306a36Sopenharmony_ci#define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE "-" __stringify(api) ".ucode"
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define IWL2000_FW_PRE "iwlwifi-2000"
3562306a36Sopenharmony_ci#define IWL2000_MODULE_FIRMWARE(api) IWL2000_FW_PRE "-" __stringify(api) ".ucode"
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#define IWL105_FW_PRE "iwlwifi-105"
3862306a36Sopenharmony_ci#define IWL105_MODULE_FIRMWARE(api) IWL105_FW_PRE "-" __stringify(api) ".ucode"
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define IWL135_FW_PRE "iwlwifi-135"
4162306a36Sopenharmony_ci#define IWL135_MODULE_FIRMWARE(api) IWL135_FW_PRE "-" __stringify(api) ".ucode"
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_cistatic const struct iwl_base_params iwl2000_base_params = {
4462306a36Sopenharmony_ci	.eeprom_size = OTP_LOW_IMAGE_SIZE_2K,
4562306a36Sopenharmony_ci	.num_of_queues = IWLAGN_NUM_QUEUES,
4662306a36Sopenharmony_ci	.max_tfd_queue_size = 256,
4762306a36Sopenharmony_ci	.max_ll_items = OTP_MAX_LL_ITEMS_2x00,
4862306a36Sopenharmony_ci	.shadow_ram_support = true,
4962306a36Sopenharmony_ci	.led_compensation = 51,
5062306a36Sopenharmony_ci	.wd_timeout = IWL_DEF_WD_TIMEOUT,
5162306a36Sopenharmony_ci	.max_event_log_size = 512,
5262306a36Sopenharmony_ci	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
5362306a36Sopenharmony_ci	.scd_chain_ext_wa = true,
5462306a36Sopenharmony_ci};
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_cistatic const struct iwl_base_params iwl2030_base_params = {
5862306a36Sopenharmony_ci	.eeprom_size = OTP_LOW_IMAGE_SIZE_2K,
5962306a36Sopenharmony_ci	.num_of_queues = IWLAGN_NUM_QUEUES,
6062306a36Sopenharmony_ci	.max_tfd_queue_size = 256,
6162306a36Sopenharmony_ci	.max_ll_items = OTP_MAX_LL_ITEMS_2x00,
6262306a36Sopenharmony_ci	.shadow_ram_support = true,
6362306a36Sopenharmony_ci	.led_compensation = 57,
6462306a36Sopenharmony_ci	.wd_timeout = IWL_LONG_WD_TIMEOUT,
6562306a36Sopenharmony_ci	.max_event_log_size = 512,
6662306a36Sopenharmony_ci	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
6762306a36Sopenharmony_ci	.scd_chain_ext_wa = true,
6862306a36Sopenharmony_ci};
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_cistatic const struct iwl_ht_params iwl2000_ht_params = {
7162306a36Sopenharmony_ci	.ht_greenfield_support = true,
7262306a36Sopenharmony_ci	.use_rts_for_aggregation = true, /* use rts/cts protection */
7362306a36Sopenharmony_ci	.ht40_bands = BIT(NL80211_BAND_2GHZ),
7462306a36Sopenharmony_ci};
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_cistatic const struct iwl_eeprom_params iwl20x0_eeprom_params = {
7762306a36Sopenharmony_ci	.regulatory_bands = {
7862306a36Sopenharmony_ci		EEPROM_REG_BAND_1_CHANNELS,
7962306a36Sopenharmony_ci		EEPROM_REG_BAND_2_CHANNELS,
8062306a36Sopenharmony_ci		EEPROM_REG_BAND_3_CHANNELS,
8162306a36Sopenharmony_ci		EEPROM_REG_BAND_4_CHANNELS,
8262306a36Sopenharmony_ci		EEPROM_REG_BAND_5_CHANNELS,
8362306a36Sopenharmony_ci		EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
8462306a36Sopenharmony_ci		EEPROM_REGULATORY_BAND_NO_HT40,
8562306a36Sopenharmony_ci	},
8662306a36Sopenharmony_ci	.enhanced_txpower = true,
8762306a36Sopenharmony_ci};
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#define IWL_DEVICE_2000						\
9062306a36Sopenharmony_ci	.fw_name_pre = IWL2000_FW_PRE,				\
9162306a36Sopenharmony_ci	.ucode_api_max = IWL2000_UCODE_API_MAX,			\
9262306a36Sopenharmony_ci	.ucode_api_min = IWL2000_UCODE_API_MIN,			\
9362306a36Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_2000,		\
9462306a36Sopenharmony_ci	.max_inst_size = IWL60_RTC_INST_SIZE,			\
9562306a36Sopenharmony_ci	.max_data_size = IWL60_RTC_DATA_SIZE,			\
9662306a36Sopenharmony_ci	.nvm_ver = EEPROM_2000_EEPROM_VERSION,			\
9762306a36Sopenharmony_ci	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,		\
9862306a36Sopenharmony_ci	.trans.base_params = &iwl2000_base_params,		\
9962306a36Sopenharmony_ci	.eeprom_params = &iwl20x0_eeprom_params,		\
10062306a36Sopenharmony_ci	.led_mode = IWL_LED_RF_STATE
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ciconst struct iwl_cfg iwl2000_2bgn_cfg = {
10462306a36Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 2200 BGN",
10562306a36Sopenharmony_ci	IWL_DEVICE_2000,
10662306a36Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
10762306a36Sopenharmony_ci};
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ciconst struct iwl_cfg iwl2000_2bgn_d_cfg = {
11062306a36Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 2200D BGN",
11162306a36Sopenharmony_ci	IWL_DEVICE_2000,
11262306a36Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
11362306a36Sopenharmony_ci};
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#define IWL_DEVICE_2030						\
11662306a36Sopenharmony_ci	.fw_name_pre = IWL2030_FW_PRE,				\
11762306a36Sopenharmony_ci	.ucode_api_max = IWL2030_UCODE_API_MAX,			\
11862306a36Sopenharmony_ci	.ucode_api_min = IWL2030_UCODE_API_MIN,			\
11962306a36Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_2030,		\
12062306a36Sopenharmony_ci	.max_inst_size = IWL60_RTC_INST_SIZE,			\
12162306a36Sopenharmony_ci	.max_data_size = IWL60_RTC_DATA_SIZE,			\
12262306a36Sopenharmony_ci	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
12362306a36Sopenharmony_ci	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
12462306a36Sopenharmony_ci	.trans.base_params = &iwl2030_base_params,		\
12562306a36Sopenharmony_ci	.eeprom_params = &iwl20x0_eeprom_params,		\
12662306a36Sopenharmony_ci	.led_mode = IWL_LED_RF_STATE
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ciconst struct iwl_cfg iwl2030_2bgn_cfg = {
12962306a36Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 2230 BGN",
13062306a36Sopenharmony_ci	IWL_DEVICE_2030,
13162306a36Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
13262306a36Sopenharmony_ci};
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci#define IWL_DEVICE_105						\
13562306a36Sopenharmony_ci	.fw_name_pre = IWL105_FW_PRE,				\
13662306a36Sopenharmony_ci	.ucode_api_max = IWL105_UCODE_API_MAX,			\
13762306a36Sopenharmony_ci	.ucode_api_min = IWL105_UCODE_API_MIN,			\
13862306a36Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_105,		\
13962306a36Sopenharmony_ci	.max_inst_size = IWL60_RTC_INST_SIZE,			\
14062306a36Sopenharmony_ci	.max_data_size = IWL60_RTC_DATA_SIZE,			\
14162306a36Sopenharmony_ci	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
14262306a36Sopenharmony_ci	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
14362306a36Sopenharmony_ci	.trans.base_params = &iwl2000_base_params,		\
14462306a36Sopenharmony_ci	.eeprom_params = &iwl20x0_eeprom_params,		\
14562306a36Sopenharmony_ci	.led_mode = IWL_LED_RF_STATE,				\
14662306a36Sopenharmony_ci	.rx_with_siso_diversity = true
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ciconst struct iwl_cfg iwl105_bgn_cfg = {
14962306a36Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 105 BGN",
15062306a36Sopenharmony_ci	IWL_DEVICE_105,
15162306a36Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
15262306a36Sopenharmony_ci};
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ciconst struct iwl_cfg iwl105_bgn_d_cfg = {
15562306a36Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 105D BGN",
15662306a36Sopenharmony_ci	IWL_DEVICE_105,
15762306a36Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
15862306a36Sopenharmony_ci};
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci#define IWL_DEVICE_135						\
16162306a36Sopenharmony_ci	.fw_name_pre = IWL135_FW_PRE,				\
16262306a36Sopenharmony_ci	.ucode_api_max = IWL135_UCODE_API_MAX,			\
16362306a36Sopenharmony_ci	.ucode_api_min = IWL135_UCODE_API_MIN,			\
16462306a36Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_135,		\
16562306a36Sopenharmony_ci	.max_inst_size = IWL60_RTC_INST_SIZE,			\
16662306a36Sopenharmony_ci	.max_data_size = IWL60_RTC_DATA_SIZE,			\
16762306a36Sopenharmony_ci	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
16862306a36Sopenharmony_ci	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
16962306a36Sopenharmony_ci	.trans.base_params = &iwl2030_base_params,		\
17062306a36Sopenharmony_ci	.eeprom_params = &iwl20x0_eeprom_params,		\
17162306a36Sopenharmony_ci	.led_mode = IWL_LED_RF_STATE,				\
17262306a36Sopenharmony_ci	.rx_with_siso_diversity = true
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ciconst struct iwl_cfg iwl135_bgn_cfg = {
17562306a36Sopenharmony_ci	.name = "Intel(R) Centrino(R) Wireless-N 135 BGN",
17662306a36Sopenharmony_ci	IWL_DEVICE_135,
17762306a36Sopenharmony_ci	.ht_params = &iwl2000_ht_params,
17862306a36Sopenharmony_ci};
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ciMODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX));
18162306a36Sopenharmony_ciMODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX));
18262306a36Sopenharmony_ciMODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX));
18362306a36Sopenharmony_ciMODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX));
184