162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci/******************************************************************************
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright(c) 2007 - 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
1362306a36Sopenharmony_ci/* Highest firmware API version supported */
1462306a36Sopenharmony_ci#define IWL5000_UCODE_API_MAX 5
1562306a36Sopenharmony_ci#define IWL5150_UCODE_API_MAX 2
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/* Lowest firmware API version supported */
1862306a36Sopenharmony_ci#define IWL5000_UCODE_API_MIN 1
1962306a36Sopenharmony_ci#define IWL5150_UCODE_API_MIN 1
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* EEPROM versions */
2262306a36Sopenharmony_ci#define EEPROM_5000_TX_POWER_VERSION	(4)
2362306a36Sopenharmony_ci#define EEPROM_5000_EEPROM_VERSION	(0x11A)
2462306a36Sopenharmony_ci#define EEPROM_5050_TX_POWER_VERSION	(4)
2562306a36Sopenharmony_ci#define EEPROM_5050_EEPROM_VERSION	(0x21E)
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define IWL5000_FW_PRE "iwlwifi-5000"
2862306a36Sopenharmony_ci#define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE "-" __stringify(api) ".ucode"
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define IWL5150_FW_PRE "iwlwifi-5150"
3162306a36Sopenharmony_ci#define IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE "-" __stringify(api) ".ucode"
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_cistatic const struct iwl_base_params iwl5000_base_params = {
3462306a36Sopenharmony_ci	.eeprom_size = IWLAGN_EEPROM_IMG_SIZE,
3562306a36Sopenharmony_ci	.num_of_queues = IWLAGN_NUM_QUEUES,
3662306a36Sopenharmony_ci	.max_tfd_queue_size = 256,
3762306a36Sopenharmony_ci	.pll_cfg = true,
3862306a36Sopenharmony_ci	.led_compensation = 51,
3962306a36Sopenharmony_ci	.wd_timeout = IWL_WATCHDOG_DISABLED,
4062306a36Sopenharmony_ci	.max_event_log_size = 512,
4162306a36Sopenharmony_ci	.scd_chain_ext_wa = true,
4262306a36Sopenharmony_ci};
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_cistatic const struct iwl_ht_params iwl5000_ht_params = {
4562306a36Sopenharmony_ci	.ht_greenfield_support = true,
4662306a36Sopenharmony_ci	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
4762306a36Sopenharmony_ci};
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_cistatic const struct iwl_eeprom_params iwl5000_eeprom_params = {
5062306a36Sopenharmony_ci	.regulatory_bands = {
5162306a36Sopenharmony_ci		EEPROM_REG_BAND_1_CHANNELS,
5262306a36Sopenharmony_ci		EEPROM_REG_BAND_2_CHANNELS,
5362306a36Sopenharmony_ci		EEPROM_REG_BAND_3_CHANNELS,
5462306a36Sopenharmony_ci		EEPROM_REG_BAND_4_CHANNELS,
5562306a36Sopenharmony_ci		EEPROM_REG_BAND_5_CHANNELS,
5662306a36Sopenharmony_ci		EEPROM_REG_BAND_24_HT40_CHANNELS,
5762306a36Sopenharmony_ci		EEPROM_REG_BAND_52_HT40_CHANNELS
5862306a36Sopenharmony_ci	},
5962306a36Sopenharmony_ci};
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#define IWL_DEVICE_5000						\
6262306a36Sopenharmony_ci	.fw_name_pre = IWL5000_FW_PRE,				\
6362306a36Sopenharmony_ci	.ucode_api_max = IWL5000_UCODE_API_MAX,			\
6462306a36Sopenharmony_ci	.ucode_api_min = IWL5000_UCODE_API_MIN,			\
6562306a36Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_5000,		\
6662306a36Sopenharmony_ci	.max_inst_size = IWLAGN_RTC_INST_SIZE,			\
6762306a36Sopenharmony_ci	.max_data_size = IWLAGN_RTC_DATA_SIZE,			\
6862306a36Sopenharmony_ci	.nvm_ver = EEPROM_5000_EEPROM_VERSION,		\
6962306a36Sopenharmony_ci	.nvm_calib_ver = EEPROM_5000_TX_POWER_VERSION,	\
7062306a36Sopenharmony_ci	.trans.base_params = &iwl5000_base_params,		\
7162306a36Sopenharmony_ci	.eeprom_params = &iwl5000_eeprom_params,		\
7262306a36Sopenharmony_ci	.led_mode = IWL_LED_BLINK
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ciconst struct iwl_cfg iwl5300_agn_cfg = {
7562306a36Sopenharmony_ci	.name = "Intel(R) Ultimate N WiFi Link 5300 AGN",
7662306a36Sopenharmony_ci	IWL_DEVICE_5000,
7762306a36Sopenharmony_ci	/* at least EEPROM 0x11A has wrong info */
7862306a36Sopenharmony_ci	.valid_tx_ant = ANT_ABC,	/* .cfg overwrite */
7962306a36Sopenharmony_ci	.valid_rx_ant = ANT_ABC,	/* .cfg overwrite */
8062306a36Sopenharmony_ci	.ht_params = &iwl5000_ht_params,
8162306a36Sopenharmony_ci};
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ciconst struct iwl_cfg iwl5100_bgn_cfg = {
8462306a36Sopenharmony_ci	.name = "Intel(R) WiFi Link 5100 BGN",
8562306a36Sopenharmony_ci	IWL_DEVICE_5000,
8662306a36Sopenharmony_ci	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
8762306a36Sopenharmony_ci	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
8862306a36Sopenharmony_ci	.ht_params = &iwl5000_ht_params,
8962306a36Sopenharmony_ci};
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ciconst struct iwl_cfg iwl5100_abg_cfg = {
9262306a36Sopenharmony_ci	.name = "Intel(R) WiFi Link 5100 ABG",
9362306a36Sopenharmony_ci	IWL_DEVICE_5000,
9462306a36Sopenharmony_ci	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
9562306a36Sopenharmony_ci	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
9662306a36Sopenharmony_ci};
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ciconst struct iwl_cfg iwl5100_agn_cfg = {
9962306a36Sopenharmony_ci	.name = "Intel(R) WiFi Link 5100 AGN",
10062306a36Sopenharmony_ci	IWL_DEVICE_5000,
10162306a36Sopenharmony_ci	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
10262306a36Sopenharmony_ci	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
10362306a36Sopenharmony_ci	.ht_params = &iwl5000_ht_params,
10462306a36Sopenharmony_ci};
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ciconst struct iwl_cfg iwl5350_agn_cfg = {
10762306a36Sopenharmony_ci	.name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
10862306a36Sopenharmony_ci	.fw_name_pre = IWL5000_FW_PRE,
10962306a36Sopenharmony_ci	.ucode_api_max = IWL5000_UCODE_API_MAX,
11062306a36Sopenharmony_ci	.ucode_api_min = IWL5000_UCODE_API_MIN,
11162306a36Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_5000,
11262306a36Sopenharmony_ci	.max_inst_size = IWLAGN_RTC_INST_SIZE,
11362306a36Sopenharmony_ci	.max_data_size = IWLAGN_RTC_DATA_SIZE,
11462306a36Sopenharmony_ci	.nvm_ver = EEPROM_5050_EEPROM_VERSION,
11562306a36Sopenharmony_ci	.nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION,
11662306a36Sopenharmony_ci	.trans.base_params = &iwl5000_base_params,
11762306a36Sopenharmony_ci	.eeprom_params = &iwl5000_eeprom_params,
11862306a36Sopenharmony_ci	.ht_params = &iwl5000_ht_params,
11962306a36Sopenharmony_ci	.led_mode = IWL_LED_BLINK,
12062306a36Sopenharmony_ci	.internal_wimax_coex = true,
12162306a36Sopenharmony_ci};
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#define IWL_DEVICE_5150						\
12462306a36Sopenharmony_ci	.fw_name_pre = IWL5150_FW_PRE,				\
12562306a36Sopenharmony_ci	.ucode_api_max = IWL5150_UCODE_API_MAX,			\
12662306a36Sopenharmony_ci	.ucode_api_min = IWL5150_UCODE_API_MIN,			\
12762306a36Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_5150,		\
12862306a36Sopenharmony_ci	.max_inst_size = IWLAGN_RTC_INST_SIZE,			\
12962306a36Sopenharmony_ci	.max_data_size = IWLAGN_RTC_DATA_SIZE,			\
13062306a36Sopenharmony_ci	.nvm_ver = EEPROM_5050_EEPROM_VERSION,		\
13162306a36Sopenharmony_ci	.nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION,	\
13262306a36Sopenharmony_ci	.trans.base_params = &iwl5000_base_params,		\
13362306a36Sopenharmony_ci	.eeprom_params = &iwl5000_eeprom_params,		\
13462306a36Sopenharmony_ci	.led_mode = IWL_LED_BLINK,				\
13562306a36Sopenharmony_ci	.internal_wimax_coex = true
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ciconst struct iwl_cfg iwl5150_agn_cfg = {
13862306a36Sopenharmony_ci	.name = "Intel(R) WiMAX/WiFi Link 5150 AGN",
13962306a36Sopenharmony_ci	IWL_DEVICE_5150,
14062306a36Sopenharmony_ci	.ht_params = &iwl5000_ht_params,
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci};
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ciconst struct iwl_cfg iwl5150_abg_cfg = {
14562306a36Sopenharmony_ci	.name = "Intel(R) WiMAX/WiFi Link 5150 ABG",
14662306a36Sopenharmony_ci	IWL_DEVICE_5150,
14762306a36Sopenharmony_ci};
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ciMODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
15062306a36Sopenharmony_ciMODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));
151