Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / net / wireless / iwlwifi / iwl-2000.c
1 /******************************************************************************
2  *
3  * Copyright(c) 2008 - 2014 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         .wd_timeout = IWL_DEF_WD_TIMEOUT,
76         .max_event_log_size = 512,
77         .shadow_reg_enable = false, /* TODO: fix bugs using this feature */
78         .scd_chain_ext_wa = true,
79 };
80
81
82 static const struct iwl_base_params iwl2030_base_params = {
83         .eeprom_size = OTP_LOW_IMAGE_SIZE,
84         .num_of_queues = IWLAGN_NUM_QUEUES,
85         .pll_cfg_val = 0,
86         .max_ll_items = OTP_MAX_LL_ITEMS_2x00,
87         .shadow_ram_support = true,
88         .led_compensation = 57,
89         .wd_timeout = IWL_LONG_WD_TIMEOUT,
90         .max_event_log_size = 512,
91         .shadow_reg_enable = false, /* TODO: fix bugs using this feature */
92         .scd_chain_ext_wa = true,
93 };
94
95 static const struct iwl_ht_params iwl2000_ht_params = {
96         .ht_greenfield_support = true,
97         .use_rts_for_aggregation = true, /* use rts/cts protection */
98         .ht40_bands = BIT(IEEE80211_BAND_2GHZ),
99 };
100
101 static const struct iwl_eeprom_params iwl20x0_eeprom_params = {
102         .regulatory_bands = {
103                 EEPROM_REG_BAND_1_CHANNELS,
104                 EEPROM_REG_BAND_2_CHANNELS,
105                 EEPROM_REG_BAND_3_CHANNELS,
106                 EEPROM_REG_BAND_4_CHANNELS,
107                 EEPROM_REG_BAND_5_CHANNELS,
108                 EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
109                 EEPROM_REGULATORY_BAND_NO_HT40,
110         },
111         .enhanced_txpower = true,
112 };
113
114 #define IWL_DEVICE_2000                                         \
115         .fw_name_pre = IWL2000_FW_PRE,                          \
116         .ucode_api_max = IWL2000_UCODE_API_MAX,                 \
117         .ucode_api_ok = IWL2000_UCODE_API_OK,                   \
118         .ucode_api_min = IWL2000_UCODE_API_MIN,                 \
119         .device_family = IWL_DEVICE_FAMILY_2000,                \
120         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
121         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
122         .nvm_ver = EEPROM_2000_EEPROM_VERSION,                  \
123         .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,          \
124         .base_params = &iwl2000_base_params,                    \
125         .eeprom_params = &iwl20x0_eeprom_params,                \
126         .led_mode = IWL_LED_RF_STATE,                           \
127         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
128
129
130 const struct iwl_cfg iwl2000_2bgn_cfg = {
131         .name = "Intel(R) Centrino(R) Wireless-N 2200 BGN",
132         IWL_DEVICE_2000,
133         .ht_params = &iwl2000_ht_params,
134 };
135
136 const struct iwl_cfg iwl2000_2bgn_d_cfg = {
137         .name = "Intel(R) Centrino(R) Wireless-N 2200D BGN",
138         IWL_DEVICE_2000,
139         .ht_params = &iwl2000_ht_params,
140 };
141
142 #define IWL_DEVICE_2030                                         \
143         .fw_name_pre = IWL2030_FW_PRE,                          \
144         .ucode_api_max = IWL2030_UCODE_API_MAX,                 \
145         .ucode_api_ok = IWL2030_UCODE_API_OK,                   \
146         .ucode_api_min = IWL2030_UCODE_API_MIN,                 \
147         .device_family = IWL_DEVICE_FAMILY_2030,                \
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         .base_params = &iwl2030_base_params,                    \
153         .eeprom_params = &iwl20x0_eeprom_params,                \
154         .led_mode = IWL_LED_RF_STATE,                           \
155         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
156
157 const struct iwl_cfg iwl2030_2bgn_cfg = {
158         .name = "Intel(R) Centrino(R) Wireless-N 2230 BGN",
159         IWL_DEVICE_2030,
160         .ht_params = &iwl2000_ht_params,
161 };
162
163 #define IWL_DEVICE_105                                          \
164         .fw_name_pre = IWL105_FW_PRE,                           \
165         .ucode_api_max = IWL105_UCODE_API_MAX,                  \
166         .ucode_api_ok = IWL105_UCODE_API_OK,                    \
167         .ucode_api_min = IWL105_UCODE_API_MIN,                  \
168         .device_family = IWL_DEVICE_FAMILY_105,                 \
169         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
170         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
171         .nvm_ver = EEPROM_2000_EEPROM_VERSION,          \
172         .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,  \
173         .base_params = &iwl2000_base_params,                    \
174         .eeprom_params = &iwl20x0_eeprom_params,                \
175         .led_mode = IWL_LED_RF_STATE,                           \
176         .rx_with_siso_diversity = true,                         \
177         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
178
179 const struct iwl_cfg iwl105_bgn_cfg = {
180         .name = "Intel(R) Centrino(R) Wireless-N 105 BGN",
181         IWL_DEVICE_105,
182         .ht_params = &iwl2000_ht_params,
183 };
184
185 const struct iwl_cfg iwl105_bgn_d_cfg = {
186         .name = "Intel(R) Centrino(R) Wireless-N 105D BGN",
187         IWL_DEVICE_105,
188         .ht_params = &iwl2000_ht_params,
189 };
190
191 #define IWL_DEVICE_135                                          \
192         .fw_name_pre = IWL135_FW_PRE,                           \
193         .ucode_api_max = IWL135_UCODE_API_MAX,                  \
194         .ucode_api_ok = IWL135_UCODE_API_OK,                    \
195         .ucode_api_min = IWL135_UCODE_API_MIN,                  \
196         .device_family = IWL_DEVICE_FAMILY_135,                 \
197         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
198         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
199         .nvm_ver = EEPROM_2000_EEPROM_VERSION,          \
200         .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,  \
201         .base_params = &iwl2030_base_params,                    \
202         .eeprom_params = &iwl20x0_eeprom_params,                \
203         .led_mode = IWL_LED_RF_STATE,                           \
204         .rx_with_siso_diversity = true,                         \
205         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
206
207 const struct iwl_cfg iwl135_bgn_cfg = {
208         .name = "Intel(R) Centrino(R) Wireless-N 135 BGN",
209         IWL_DEVICE_135,
210         .ht_params = &iwl2000_ht_params,
211 };
212
213 MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_OK));
214 MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK));
215 MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK));
216 MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_OK));