1 // SPDX-License-Identifier: GPL-2.0-only
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
5  * Copyright(c) 2018 - 2019 Intel Corporation
6  *
7  * Contact Information:
8  *  Intel Linux Wireless <linuxwifi@intel.com>
9  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
10  *
11  *****************************************************************************/
12 
13 #include <linux/module.h>
14 #include <linux/stringify.h>
15 #include "iwl-config.h"
16 #include "iwl-agn-hw.h"
17 
18 /* Highest firmware API version supported */
19 #define IWL5000_UCODE_API_MAX 5
20 #define IWL5150_UCODE_API_MAX 2
21 
22 /* Lowest firmware API version supported */
23 #define IWL5000_UCODE_API_MIN 1
24 #define IWL5150_UCODE_API_MIN 1
25 
26 /* EEPROM versions */
27 #define EEPROM_5000_TX_POWER_VERSION	(4)
28 #define EEPROM_5000_EEPROM_VERSION	(0x11A)
29 #define EEPROM_5050_TX_POWER_VERSION	(4)
30 #define EEPROM_5050_EEPROM_VERSION	(0x21E)
31 
32 #define IWL5000_FW_PRE "iwlwifi-5000-"
33 #define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE __stringify(api) ".ucode"
34 
35 #define IWL5150_FW_PRE "iwlwifi-5150-"
36 #define IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE __stringify(api) ".ucode"
37 
38 static const struct iwl_base_params iwl5000_base_params = {
39 	.eeprom_size = IWLAGN_EEPROM_IMG_SIZE,
40 	.num_of_queues = IWLAGN_NUM_QUEUES,
41 	.max_tfd_queue_size = 256,
42 	.pll_cfg = true,
43 	.led_compensation = 51,
44 	.wd_timeout = IWL_WATCHDOG_DISABLED,
45 	.max_event_log_size = 512,
46 	.scd_chain_ext_wa = true,
47 };
48 
49 static const struct iwl_ht_params iwl5000_ht_params = {
50 	.ht_greenfield_support = true,
51 	.ht40_bands = BIT(NL80211_BAND_2GHZ) | BIT(NL80211_BAND_5GHZ),
52 };
53 
54 static const struct iwl_eeprom_params iwl5000_eeprom_params = {
55 	.regulatory_bands = {
56 		EEPROM_REG_BAND_1_CHANNELS,
57 		EEPROM_REG_BAND_2_CHANNELS,
58 		EEPROM_REG_BAND_3_CHANNELS,
59 		EEPROM_REG_BAND_4_CHANNELS,
60 		EEPROM_REG_BAND_5_CHANNELS,
61 		EEPROM_REG_BAND_24_HT40_CHANNELS,
62 		EEPROM_REG_BAND_52_HT40_CHANNELS
63 	},
64 };
65 
66 #define IWL_DEVICE_5000						\
67 	.fw_name_pre = IWL5000_FW_PRE,				\
68 	.ucode_api_max = IWL5000_UCODE_API_MAX,			\
69 	.ucode_api_min = IWL5000_UCODE_API_MIN,			\
70 	.trans.device_family = IWL_DEVICE_FAMILY_5000,		\
71 	.max_inst_size = IWLAGN_RTC_INST_SIZE,			\
72 	.max_data_size = IWLAGN_RTC_DATA_SIZE,			\
73 	.nvm_ver = EEPROM_5000_EEPROM_VERSION,		\
74 	.nvm_calib_ver = EEPROM_5000_TX_POWER_VERSION,	\
75 	.trans.base_params = &iwl5000_base_params,		\
76 	.eeprom_params = &iwl5000_eeprom_params,		\
77 	.led_mode = IWL_LED_BLINK,				\
78 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
79 
80 const struct iwl_cfg iwl5300_agn_cfg = {
81 	.name = "Intel(R) Ultimate N WiFi Link 5300 AGN",
82 	IWL_DEVICE_5000,
83 	/* at least EEPROM 0x11A has wrong info */
84 	.valid_tx_ant = ANT_ABC,	/* .cfg overwrite */
85 	.valid_rx_ant = ANT_ABC,	/* .cfg overwrite */
86 	.ht_params = &iwl5000_ht_params,
87 };
88 
89 const struct iwl_cfg iwl5100_bgn_cfg = {
90 	.name = "Intel(R) WiFi Link 5100 BGN",
91 	IWL_DEVICE_5000,
92 	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
93 	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
94 	.ht_params = &iwl5000_ht_params,
95 };
96 
97 const struct iwl_cfg iwl5100_abg_cfg = {
98 	.name = "Intel(R) WiFi Link 5100 ABG",
99 	IWL_DEVICE_5000,
100 	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
101 	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
102 };
103 
104 const struct iwl_cfg iwl5100_agn_cfg = {
105 	.name = "Intel(R) WiFi Link 5100 AGN",
106 	IWL_DEVICE_5000,
107 	.valid_tx_ant = ANT_B,		/* .cfg overwrite */
108 	.valid_rx_ant = ANT_AB,		/* .cfg overwrite */
109 	.ht_params = &iwl5000_ht_params,
110 };
111 
112 const struct iwl_cfg iwl5350_agn_cfg = {
113 	.name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
114 	.fw_name_pre = IWL5000_FW_PRE,
115 	.ucode_api_max = IWL5000_UCODE_API_MAX,
116 	.ucode_api_min = IWL5000_UCODE_API_MIN,
117 	.trans.device_family = IWL_DEVICE_FAMILY_5000,
118 	.max_inst_size = IWLAGN_RTC_INST_SIZE,
119 	.max_data_size = IWLAGN_RTC_DATA_SIZE,
120 	.nvm_ver = EEPROM_5050_EEPROM_VERSION,
121 	.nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION,
122 	.trans.base_params = &iwl5000_base_params,
123 	.eeprom_params = &iwl5000_eeprom_params,
124 	.ht_params = &iwl5000_ht_params,
125 	.led_mode = IWL_LED_BLINK,
126 	.internal_wimax_coex = true,
127 };
128 
129 #define IWL_DEVICE_5150						\
130 	.fw_name_pre = IWL5150_FW_PRE,				\
131 	.ucode_api_max = IWL5150_UCODE_API_MAX,			\
132 	.ucode_api_min = IWL5150_UCODE_API_MIN,			\
133 	.trans.device_family = IWL_DEVICE_FAMILY_5150,		\
134 	.max_inst_size = IWLAGN_RTC_INST_SIZE,			\
135 	.max_data_size = IWLAGN_RTC_DATA_SIZE,			\
136 	.nvm_ver = EEPROM_5050_EEPROM_VERSION,		\
137 	.nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION,	\
138 	.trans.base_params = &iwl5000_base_params,		\
139 	.eeprom_params = &iwl5000_eeprom_params,		\
140 	.led_mode = IWL_LED_BLINK,				\
141 	.internal_wimax_coex = true,				\
142 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
143 
144 const struct iwl_cfg iwl5150_agn_cfg = {
145 	.name = "Intel(R) WiMAX/WiFi Link 5150 AGN",
146 	IWL_DEVICE_5150,
147 	.ht_params = &iwl5000_ht_params,
148 
149 };
150 
151 const struct iwl_cfg iwl5150_abg_cfg = {
152 	.name = "Intel(R) WiMAX/WiFi Link 5150 ABG",
153 	IWL_DEVICE_5150,
154 };
155 
156 MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
157 MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));
158