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