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