1 // SPDX-License-Identifier: GPL-2.0-only
2 /******************************************************************************
3  *
4  * Copyright(c) 2008 - 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 #include "dvm/commands.h" /* needed for BT for now */
18 
19 /* Highest firmware API version supported */
20 #define IWL2030_UCODE_API_MAX 6
21 #define IWL2000_UCODE_API_MAX 6
22 #define IWL105_UCODE_API_MAX 6
23 #define IWL135_UCODE_API_MAX 6
24 
25 /* Lowest firmware API version supported */
26 #define IWL2030_UCODE_API_MIN 5
27 #define IWL2000_UCODE_API_MIN 5
28 #define IWL105_UCODE_API_MIN 5
29 #define IWL135_UCODE_API_MIN 5
30 
31 /* EEPROM version */
32 #define EEPROM_2000_TX_POWER_VERSION	(6)
33 #define EEPROM_2000_EEPROM_VERSION	(0x805)
34 
35 
36 #define IWL2030_FW_PRE "iwlwifi-2030-"
37 #define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE __stringify(api) ".ucode"
38 
39 #define IWL2000_FW_PRE "iwlwifi-2000-"
40 #define IWL2000_MODULE_FIRMWARE(api) IWL2000_FW_PRE __stringify(api) ".ucode"
41 
42 #define IWL105_FW_PRE "iwlwifi-105-"
43 #define IWL105_MODULE_FIRMWARE(api) IWL105_FW_PRE __stringify(api) ".ucode"
44 
45 #define IWL135_FW_PRE "iwlwifi-135-"
46 #define IWL135_MODULE_FIRMWARE(api) IWL135_FW_PRE __stringify(api) ".ucode"
47 
48 static const struct iwl_base_params iwl2000_base_params = {
49 	.eeprom_size = OTP_LOW_IMAGE_SIZE_2K,
50 	.num_of_queues = IWLAGN_NUM_QUEUES,
51 	.max_tfd_queue_size = 256,
52 	.max_ll_items = OTP_MAX_LL_ITEMS_2x00,
53 	.shadow_ram_support = true,
54 	.led_compensation = 51,
55 	.wd_timeout = IWL_DEF_WD_TIMEOUT,
56 	.max_event_log_size = 512,
57 	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
58 	.scd_chain_ext_wa = true,
59 };
60 
61 
62 static const struct iwl_base_params iwl2030_base_params = {
63 	.eeprom_size = OTP_LOW_IMAGE_SIZE_2K,
64 	.num_of_queues = IWLAGN_NUM_QUEUES,
65 	.max_tfd_queue_size = 256,
66 	.max_ll_items = OTP_MAX_LL_ITEMS_2x00,
67 	.shadow_ram_support = true,
68 	.led_compensation = 57,
69 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
70 	.max_event_log_size = 512,
71 	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
72 	.scd_chain_ext_wa = true,
73 };
74 
75 static const struct iwl_ht_params iwl2000_ht_params = {
76 	.ht_greenfield_support = true,
77 	.use_rts_for_aggregation = true, /* use rts/cts protection */
78 	.ht40_bands = BIT(NL80211_BAND_2GHZ),
79 };
80 
81 static const struct iwl_eeprom_params iwl20x0_eeprom_params = {
82 	.regulatory_bands = {
83 		EEPROM_REG_BAND_1_CHANNELS,
84 		EEPROM_REG_BAND_2_CHANNELS,
85 		EEPROM_REG_BAND_3_CHANNELS,
86 		EEPROM_REG_BAND_4_CHANNELS,
87 		EEPROM_REG_BAND_5_CHANNELS,
88 		EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
89 		EEPROM_REGULATORY_BAND_NO_HT40,
90 	},
91 	.enhanced_txpower = true,
92 };
93 
94 #define IWL_DEVICE_2000						\
95 	.fw_name_pre = IWL2000_FW_PRE,				\
96 	.ucode_api_max = IWL2000_UCODE_API_MAX,			\
97 	.ucode_api_min = IWL2000_UCODE_API_MIN,			\
98 	.trans.device_family = IWL_DEVICE_FAMILY_2000,		\
99 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
100 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
101 	.nvm_ver = EEPROM_2000_EEPROM_VERSION,			\
102 	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,		\
103 	.trans.base_params = &iwl2000_base_params,		\
104 	.eeprom_params = &iwl20x0_eeprom_params,		\
105 	.led_mode = IWL_LED_RF_STATE,				\
106 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
107 	.trans.csr = &iwl_csr_v1
108 
109 
110 const struct iwl_cfg iwl2000_2bgn_cfg = {
111 	.name = "Intel(R) Centrino(R) Wireless-N 2200 BGN",
112 	IWL_DEVICE_2000,
113 	.ht_params = &iwl2000_ht_params,
114 };
115 
116 const struct iwl_cfg iwl2000_2bgn_d_cfg = {
117 	.name = "Intel(R) Centrino(R) Wireless-N 2200D BGN",
118 	IWL_DEVICE_2000,
119 	.ht_params = &iwl2000_ht_params,
120 };
121 
122 #define IWL_DEVICE_2030						\
123 	.fw_name_pre = IWL2030_FW_PRE,				\
124 	.ucode_api_max = IWL2030_UCODE_API_MAX,			\
125 	.ucode_api_min = IWL2030_UCODE_API_MIN,			\
126 	.trans.device_family = IWL_DEVICE_FAMILY_2030,		\
127 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
128 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
129 	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
130 	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
131 	.trans.base_params = &iwl2030_base_params,		\
132 	.eeprom_params = &iwl20x0_eeprom_params,		\
133 	.led_mode = IWL_LED_RF_STATE,				\
134 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
135 	.trans.csr = &iwl_csr_v1
136 
137 const struct iwl_cfg iwl2030_2bgn_cfg = {
138 	.name = "Intel(R) Centrino(R) Wireless-N 2230 BGN",
139 	IWL_DEVICE_2030,
140 	.ht_params = &iwl2000_ht_params,
141 };
142 
143 #define IWL_DEVICE_105						\
144 	.fw_name_pre = IWL105_FW_PRE,				\
145 	.ucode_api_max = IWL105_UCODE_API_MAX,			\
146 	.ucode_api_min = IWL105_UCODE_API_MIN,			\
147 	.trans.device_family = IWL_DEVICE_FAMILY_105,		\
148 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
149 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
150 	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
151 	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
152 	.trans.base_params = &iwl2000_base_params,		\
153 	.eeprom_params = &iwl20x0_eeprom_params,		\
154 	.led_mode = IWL_LED_RF_STATE,				\
155 	.rx_with_siso_diversity = true,				\
156 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
157 	.trans.csr = &iwl_csr_v1
158 
159 const struct iwl_cfg iwl105_bgn_cfg = {
160 	.name = "Intel(R) Centrino(R) Wireless-N 105 BGN",
161 	IWL_DEVICE_105,
162 	.ht_params = &iwl2000_ht_params,
163 };
164 
165 const struct iwl_cfg iwl105_bgn_d_cfg = {
166 	.name = "Intel(R) Centrino(R) Wireless-N 105D BGN",
167 	IWL_DEVICE_105,
168 	.ht_params = &iwl2000_ht_params,
169 };
170 
171 #define IWL_DEVICE_135						\
172 	.fw_name_pre = IWL135_FW_PRE,				\
173 	.ucode_api_max = IWL135_UCODE_API_MAX,			\
174 	.ucode_api_min = IWL135_UCODE_API_MIN,			\
175 	.trans.device_family = IWL_DEVICE_FAMILY_135,		\
176 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
177 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
178 	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
179 	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
180 	.trans.base_params = &iwl2030_base_params,		\
181 	.eeprom_params = &iwl20x0_eeprom_params,		\
182 	.led_mode = IWL_LED_RF_STATE,				\
183 	.rx_with_siso_diversity = true,				\
184 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
185 	.trans.csr = &iwl_csr_v1
186 
187 const struct iwl_cfg iwl135_bgn_cfg = {
188 	.name = "Intel(R) Centrino(R) Wireless-N 135 BGN",
189 	IWL_DEVICE_135,
190 	.ht_params = &iwl2000_ht_params,
191 };
192 
193 MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX));
194 MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX));
195 MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX));
196 MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX));
197