1 /******************************************************************************
2  *
3  * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
4  * Copyright(c) 2018 Intel Corporation
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18  *
19  * The full GNU General Public License is included in this distribution in the
20  * file called LICENSE.
21  *
22  * Contact Information:
23  *  Intel Linux Wireless <linuxwifi@intel.com>
24  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25  *
26  *****************************************************************************/
27 
28 #include <linux/module.h>
29 #include <linux/stringify.h>
30 #include "iwl-config.h"
31 #include "iwl-agn-hw.h"
32 #include "dvm/commands.h" /* needed for BT for now */
33 
34 /* Highest firmware API version supported */
35 #define IWL2030_UCODE_API_MAX 6
36 #define IWL2000_UCODE_API_MAX 6
37 #define IWL105_UCODE_API_MAX 6
38 #define IWL135_UCODE_API_MAX 6
39 
40 /* Lowest firmware API version supported */
41 #define IWL2030_UCODE_API_MIN 5
42 #define IWL2000_UCODE_API_MIN 5
43 #define IWL105_UCODE_API_MIN 5
44 #define IWL135_UCODE_API_MIN 5
45 
46 /* EEPROM version */
47 #define EEPROM_2000_TX_POWER_VERSION	(6)
48 #define EEPROM_2000_EEPROM_VERSION	(0x805)
49 
50 
51 #define IWL2030_FW_PRE "iwlwifi-2030-"
52 #define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE __stringify(api) ".ucode"
53 
54 #define IWL2000_FW_PRE "iwlwifi-2000-"
55 #define IWL2000_MODULE_FIRMWARE(api) IWL2000_FW_PRE __stringify(api) ".ucode"
56 
57 #define IWL105_FW_PRE "iwlwifi-105-"
58 #define IWL105_MODULE_FIRMWARE(api) IWL105_FW_PRE __stringify(api) ".ucode"
59 
60 #define IWL135_FW_PRE "iwlwifi-135-"
61 #define IWL135_MODULE_FIRMWARE(api) IWL135_FW_PRE __stringify(api) ".ucode"
62 
63 static const struct iwl_base_params iwl2000_base_params = {
64 	.eeprom_size = OTP_LOW_IMAGE_SIZE,
65 	.num_of_queues = IWLAGN_NUM_QUEUES,
66 	.max_tfd_queue_size = 256,
67 	.max_ll_items = OTP_MAX_LL_ITEMS_2x00,
68 	.shadow_ram_support = true,
69 	.led_compensation = 51,
70 	.wd_timeout = IWL_DEF_WD_TIMEOUT,
71 	.max_event_log_size = 512,
72 	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
73 	.scd_chain_ext_wa = true,
74 };
75 
76 
77 static const struct iwl_base_params iwl2030_base_params = {
78 	.eeprom_size = OTP_LOW_IMAGE_SIZE,
79 	.num_of_queues = IWLAGN_NUM_QUEUES,
80 	.max_tfd_queue_size = 256,
81 	.max_ll_items = OTP_MAX_LL_ITEMS_2x00,
82 	.shadow_ram_support = true,
83 	.led_compensation = 57,
84 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
85 	.max_event_log_size = 512,
86 	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
87 	.scd_chain_ext_wa = true,
88 };
89 
90 static const struct iwl_ht_params iwl2000_ht_params = {
91 	.ht_greenfield_support = true,
92 	.use_rts_for_aggregation = true, /* use rts/cts protection */
93 	.ht40_bands = BIT(NL80211_BAND_2GHZ),
94 };
95 
96 static const struct iwl_eeprom_params iwl20x0_eeprom_params = {
97 	.regulatory_bands = {
98 		EEPROM_REG_BAND_1_CHANNELS,
99 		EEPROM_REG_BAND_2_CHANNELS,
100 		EEPROM_REG_BAND_3_CHANNELS,
101 		EEPROM_REG_BAND_4_CHANNELS,
102 		EEPROM_REG_BAND_5_CHANNELS,
103 		EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
104 		EEPROM_REGULATORY_BAND_NO_HT40,
105 	},
106 	.enhanced_txpower = true,
107 };
108 
109 #define IWL_DEVICE_2000						\
110 	.fw_name_pre = IWL2000_FW_PRE,				\
111 	.ucode_api_max = IWL2000_UCODE_API_MAX,			\
112 	.ucode_api_min = IWL2000_UCODE_API_MIN,			\
113 	.device_family = IWL_DEVICE_FAMILY_2000,		\
114 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
115 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
116 	.nvm_ver = EEPROM_2000_EEPROM_VERSION,			\
117 	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,		\
118 	.base_params = &iwl2000_base_params,			\
119 	.eeprom_params = &iwl20x0_eeprom_params,		\
120 	.led_mode = IWL_LED_RF_STATE,				\
121 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
122 	.csr = &iwl_csr_v1
123 
124 
125 const struct iwl_cfg iwl2000_2bgn_cfg = {
126 	.name = "Intel(R) Centrino(R) Wireless-N 2200 BGN",
127 	IWL_DEVICE_2000,
128 	.ht_params = &iwl2000_ht_params,
129 };
130 
131 const struct iwl_cfg iwl2000_2bgn_d_cfg = {
132 	.name = "Intel(R) Centrino(R) Wireless-N 2200D BGN",
133 	IWL_DEVICE_2000,
134 	.ht_params = &iwl2000_ht_params,
135 };
136 
137 #define IWL_DEVICE_2030						\
138 	.fw_name_pre = IWL2030_FW_PRE,				\
139 	.ucode_api_max = IWL2030_UCODE_API_MAX,			\
140 	.ucode_api_min = IWL2030_UCODE_API_MIN,			\
141 	.device_family = IWL_DEVICE_FAMILY_2030,		\
142 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
143 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
144 	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
145 	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
146 	.base_params = &iwl2030_base_params,			\
147 	.eeprom_params = &iwl20x0_eeprom_params,		\
148 	.led_mode = IWL_LED_RF_STATE,				\
149 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
150 	.csr = &iwl_csr_v1
151 
152 const struct iwl_cfg iwl2030_2bgn_cfg = {
153 	.name = "Intel(R) Centrino(R) Wireless-N 2230 BGN",
154 	IWL_DEVICE_2030,
155 	.ht_params = &iwl2000_ht_params,
156 };
157 
158 #define IWL_DEVICE_105						\
159 	.fw_name_pre = IWL105_FW_PRE,				\
160 	.ucode_api_max = IWL105_UCODE_API_MAX,			\
161 	.ucode_api_min = IWL105_UCODE_API_MIN,			\
162 	.device_family = IWL_DEVICE_FAMILY_105,			\
163 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
164 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
165 	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
166 	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
167 	.base_params = &iwl2000_base_params,			\
168 	.eeprom_params = &iwl20x0_eeprom_params,		\
169 	.led_mode = IWL_LED_RF_STATE,				\
170 	.rx_with_siso_diversity = true,				\
171 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
172 	.csr = &iwl_csr_v1
173 
174 const struct iwl_cfg iwl105_bgn_cfg = {
175 	.name = "Intel(R) Centrino(R) Wireless-N 105 BGN",
176 	IWL_DEVICE_105,
177 	.ht_params = &iwl2000_ht_params,
178 };
179 
180 const struct iwl_cfg iwl105_bgn_d_cfg = {
181 	.name = "Intel(R) Centrino(R) Wireless-N 105D BGN",
182 	IWL_DEVICE_105,
183 	.ht_params = &iwl2000_ht_params,
184 };
185 
186 #define IWL_DEVICE_135						\
187 	.fw_name_pre = IWL135_FW_PRE,				\
188 	.ucode_api_max = IWL135_UCODE_API_MAX,			\
189 	.ucode_api_min = IWL135_UCODE_API_MIN,			\
190 	.device_family = IWL_DEVICE_FAMILY_135,			\
191 	.max_inst_size = IWL60_RTC_INST_SIZE,			\
192 	.max_data_size = IWL60_RTC_DATA_SIZE,			\
193 	.nvm_ver = EEPROM_2000_EEPROM_VERSION,		\
194 	.nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,	\
195 	.base_params = &iwl2030_base_params,			\
196 	.eeprom_params = &iwl20x0_eeprom_params,		\
197 	.led_mode = IWL_LED_RF_STATE,				\
198 	.rx_with_siso_diversity = true,				\
199 	.max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K,	\
200 	.csr = &iwl_csr_v1
201 
202 const struct iwl_cfg iwl135_bgn_cfg = {
203 	.name = "Intel(R) Centrino(R) Wireless-N 135 BGN",
204 	IWL_DEVICE_135,
205 	.ht_params = &iwl2000_ht_params,
206 };
207 
208 MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX));
209 MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX));
210 MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX));
211 MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX));
212