18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/******************************************************************************
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright(c) 2007 - 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
188c2ecf20Sopenharmony_ci/* Highest firmware API version supported */
198c2ecf20Sopenharmony_ci#define IWL5000_UCODE_API_MAX 5
208c2ecf20Sopenharmony_ci#define IWL5150_UCODE_API_MAX 2
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* Lowest firmware API version supported */
238c2ecf20Sopenharmony_ci#define IWL5000_UCODE_API_MIN 1
248c2ecf20Sopenharmony_ci#define IWL5150_UCODE_API_MIN 1
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* EEPROM versions */
278c2ecf20Sopenharmony_ci#define EEPROM_5000_TX_POWER_VERSION	(4)
288c2ecf20Sopenharmony_ci#define EEPROM_5000_EEPROM_VERSION	(0x11A)
298c2ecf20Sopenharmony_ci#define EEPROM_5050_TX_POWER_VERSION	(4)
308c2ecf20Sopenharmony_ci#define EEPROM_5050_EEPROM_VERSION	(0x21E)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define IWL5000_FW_PRE "iwlwifi-5000-"
338c2ecf20Sopenharmony_ci#define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE __stringify(api) ".ucode"
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define IWL5150_FW_PRE "iwlwifi-5150-"
368c2ecf20Sopenharmony_ci#define IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE __stringify(api) ".ucode"
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistatic const struct iwl_base_params iwl5000_base_params = {
398c2ecf20Sopenharmony_ci	.eeprom_size = IWLAGN_EEPROM_IMG_SIZE,
408c2ecf20Sopenharmony_ci	.num_of_queues = IWLAGN_NUM_QUEUES,
418c2ecf20Sopenharmony_ci	.max_tfd_queue_size = 256,
428c2ecf20Sopenharmony_ci	.pll_cfg = true,
438c2ecf20Sopenharmony_ci	.led_compensation = 51,
448c2ecf20Sopenharmony_ci	.wd_timeout = IWL_WATCHDOG_DISABLED,
458c2ecf20Sopenharmony_ci	.max_event_log_size = 512,
468c2ecf20Sopenharmony_ci	.scd_chain_ext_wa = true,
478c2ecf20Sopenharmony_ci};
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_cistatic const struct iwl_ht_params iwl5000_ht_params = {
508c2ecf20Sopenharmony_ci	.ht_greenfield_support = true,
518c2ecf20Sopenharmony_ci	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
528c2ecf20Sopenharmony_ci};
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_cistatic const struct iwl_eeprom_params iwl5000_eeprom_params = {
558c2ecf20Sopenharmony_ci	.regulatory_bands = {
568c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_1_CHANNELS,
578c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_2_CHANNELS,
588c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_3_CHANNELS,
598c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_4_CHANNELS,
608c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_5_CHANNELS,
618c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_24_HT40_CHANNELS,
628c2ecf20Sopenharmony_ci		EEPROM_REG_BAND_52_HT40_CHANNELS
638c2ecf20Sopenharmony_ci	},
648c2ecf20Sopenharmony_ci};
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#define IWL_DEVICE_5000						\
678c2ecf20Sopenharmony_ci	.fw_name_pre = IWL5000_FW_PRE,				\
688c2ecf20Sopenharmony_ci	.ucode_api_max = IWL5000_UCODE_API_MAX,			\
698c2ecf20Sopenharmony_ci	.ucode_api_min = IWL5000_UCODE_API_MIN,			\
708c2ecf20Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_5000,		\
718c2ecf20Sopenharmony_ci	.max_inst_size = IWLAGN_RTC_INST_SIZE,			\
728c2ecf20Sopenharmony_ci	.max_data_size = IWLAGN_RTC_DATA_SIZE,			\
738c2ecf20Sopenharmony_ci	.nvm_ver = EEPROM_5000_EEPROM_VERSION,		\
748c2ecf20Sopenharmony_ci	.nvm_calib_ver = EEPROM_5000_TX_POWER_VERSION,	\
758c2ecf20Sopenharmony_ci	.trans.base_params = &iwl5000_base_params,		\
768c2ecf20Sopenharmony_ci	.eeprom_params = &iwl5000_eeprom_params,		\
778c2ecf20Sopenharmony_ci	.led_mode = IWL_LED_BLINK,				\
788c2ecf20Sopenharmony_ci	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl5300_agn_cfg = {
818c2ecf20Sopenharmony_ci	.name = "Intel(R) Ultimate N WiFi Link 5300 AGN",
828c2ecf20Sopenharmony_ci	IWL_DEVICE_5000,
838c2ecf20Sopenharmony_ci	/* at least EEPROM 0x11A has wrong info */
848c2ecf20Sopenharmony_ci	.valid_tx_ant = ANT_ABC,	/* .cfg overwrite */
858c2ecf20Sopenharmony_ci	.valid_rx_ant = ANT_ABC,	/* .cfg overwrite */
868c2ecf20Sopenharmony_ci	.ht_params = &iwl5000_ht_params,
878c2ecf20Sopenharmony_ci};
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl5100_bgn_cfg = {
908c2ecf20Sopenharmony_ci	.name = "Intel(R) WiFi Link 5100 BGN",
918c2ecf20Sopenharmony_ci	IWL_DEVICE_5000,
928c2ecf20Sopenharmony_ci	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
938c2ecf20Sopenharmony_ci	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
948c2ecf20Sopenharmony_ci	.ht_params = &iwl5000_ht_params,
958c2ecf20Sopenharmony_ci};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl5100_abg_cfg = {
988c2ecf20Sopenharmony_ci	.name = "Intel(R) WiFi Link 5100 ABG",
998c2ecf20Sopenharmony_ci	IWL_DEVICE_5000,
1008c2ecf20Sopenharmony_ci	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
1018c2ecf20Sopenharmony_ci	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
1028c2ecf20Sopenharmony_ci};
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl5100_agn_cfg = {
1058c2ecf20Sopenharmony_ci	.name = "Intel(R) WiFi Link 5100 AGN",
1068c2ecf20Sopenharmony_ci	IWL_DEVICE_5000,
1078c2ecf20Sopenharmony_ci	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
1088c2ecf20Sopenharmony_ci	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
1098c2ecf20Sopenharmony_ci	.ht_params = &iwl5000_ht_params,
1108c2ecf20Sopenharmony_ci};
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl5350_agn_cfg = {
1138c2ecf20Sopenharmony_ci	.name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
1148c2ecf20Sopenharmony_ci	.fw_name_pre = IWL5000_FW_PRE,
1158c2ecf20Sopenharmony_ci	.ucode_api_max = IWL5000_UCODE_API_MAX,
1168c2ecf20Sopenharmony_ci	.ucode_api_min = IWL5000_UCODE_API_MIN,
1178c2ecf20Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_5000,
1188c2ecf20Sopenharmony_ci	.max_inst_size = IWLAGN_RTC_INST_SIZE,
1198c2ecf20Sopenharmony_ci	.max_data_size = IWLAGN_RTC_DATA_SIZE,
1208c2ecf20Sopenharmony_ci	.nvm_ver = EEPROM_5050_EEPROM_VERSION,
1218c2ecf20Sopenharmony_ci	.nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION,
1228c2ecf20Sopenharmony_ci	.trans.base_params = &iwl5000_base_params,
1238c2ecf20Sopenharmony_ci	.eeprom_params = &iwl5000_eeprom_params,
1248c2ecf20Sopenharmony_ci	.ht_params = &iwl5000_ht_params,
1258c2ecf20Sopenharmony_ci	.led_mode = IWL_LED_BLINK,
1268c2ecf20Sopenharmony_ci	.internal_wimax_coex = true,
1278c2ecf20Sopenharmony_ci};
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci#define IWL_DEVICE_5150						\
1308c2ecf20Sopenharmony_ci	.fw_name_pre = IWL5150_FW_PRE,				\
1318c2ecf20Sopenharmony_ci	.ucode_api_max = IWL5150_UCODE_API_MAX,			\
1328c2ecf20Sopenharmony_ci	.ucode_api_min = IWL5150_UCODE_API_MIN,			\
1338c2ecf20Sopenharmony_ci	.trans.device_family = IWL_DEVICE_FAMILY_5150,		\
1348c2ecf20Sopenharmony_ci	.max_inst_size = IWLAGN_RTC_INST_SIZE,			\
1358c2ecf20Sopenharmony_ci	.max_data_size = IWLAGN_RTC_DATA_SIZE,			\
1368c2ecf20Sopenharmony_ci	.nvm_ver = EEPROM_5050_EEPROM_VERSION,		\
1378c2ecf20Sopenharmony_ci	.nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION,	\
1388c2ecf20Sopenharmony_ci	.trans.base_params = &iwl5000_base_params,		\
1398c2ecf20Sopenharmony_ci	.eeprom_params = &iwl5000_eeprom_params,		\
1408c2ecf20Sopenharmony_ci	.led_mode = IWL_LED_BLINK,				\
1418c2ecf20Sopenharmony_ci	.internal_wimax_coex = true,				\
1428c2ecf20Sopenharmony_ci	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl5150_agn_cfg = {
1458c2ecf20Sopenharmony_ci	.name = "Intel(R) WiMAX/WiFi Link 5150 AGN",
1468c2ecf20Sopenharmony_ci	IWL_DEVICE_5150,
1478c2ecf20Sopenharmony_ci	.ht_params = &iwl5000_ht_params,
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci};
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ciconst struct iwl_cfg iwl5150_abg_cfg = {
1528c2ecf20Sopenharmony_ci	.name = "Intel(R) WiMAX/WiFi Link 5150 ABG",
1538c2ecf20Sopenharmony_ci	IWL_DEVICE_5150,
1548c2ecf20Sopenharmony_ci};
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ciMODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
1578c2ecf20Sopenharmony_ciMODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));
158