cfg80211: remove enum ieee80211_band
[cascardo/linux.git] / drivers / net / wireless / intel / 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 <linuxwifi@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 /* Lowest firmware API version supported */
40 #define IWL2030_UCODE_API_MIN 5
41 #define IWL2000_UCODE_API_MIN 5
42 #define IWL105_UCODE_API_MIN 5
43 #define IWL135_UCODE_API_MIN 5
44
45 /* EEPROM version */
46 #define EEPROM_2000_TX_POWER_VERSION    (6)
47 #define EEPROM_2000_EEPROM_VERSION      (0x805)
48
49
50 #define IWL2030_FW_PRE "iwlwifi-2030-"
51 #define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE __stringify(api) ".ucode"
52
53 #define IWL2000_FW_PRE "iwlwifi-2000-"
54 #define IWL2000_MODULE_FIRMWARE(api) IWL2000_FW_PRE __stringify(api) ".ucode"
55
56 #define IWL105_FW_PRE "iwlwifi-105-"
57 #define IWL105_MODULE_FIRMWARE(api) IWL105_FW_PRE __stringify(api) ".ucode"
58
59 #define IWL135_FW_PRE "iwlwifi-135-"
60 #define IWL135_MODULE_FIRMWARE(api) IWL135_FW_PRE __stringify(api) ".ucode"
61
62 static const struct iwl_base_params iwl2000_base_params = {
63         .eeprom_size = OTP_LOW_IMAGE_SIZE,
64         .num_of_queues = IWLAGN_NUM_QUEUES,
65         .pll_cfg_val = 0,
66         .max_ll_items = OTP_MAX_LL_ITEMS_2x00,
67         .shadow_ram_support = true,
68         .led_compensation = 51,
69         .wd_timeout = IWL_DEF_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
76 static const struct iwl_base_params iwl2030_base_params = {
77         .eeprom_size = OTP_LOW_IMAGE_SIZE,
78         .num_of_queues = IWLAGN_NUM_QUEUES,
79         .pll_cfg_val = 0,
80         .max_ll_items = OTP_MAX_LL_ITEMS_2x00,
81         .shadow_ram_support = true,
82         .led_compensation = 57,
83         .wd_timeout = IWL_LONG_WD_TIMEOUT,
84         .max_event_log_size = 512,
85         .shadow_reg_enable = false, /* TODO: fix bugs using this feature */
86         .scd_chain_ext_wa = true,
87 };
88
89 static const struct iwl_ht_params iwl2000_ht_params = {
90         .ht_greenfield_support = true,
91         .use_rts_for_aggregation = true, /* use rts/cts protection */
92         .ht40_bands = BIT(NL80211_BAND_2GHZ),
93 };
94
95 static const struct iwl_eeprom_params iwl20x0_eeprom_params = {
96         .regulatory_bands = {
97                 EEPROM_REG_BAND_1_CHANNELS,
98                 EEPROM_REG_BAND_2_CHANNELS,
99                 EEPROM_REG_BAND_3_CHANNELS,
100                 EEPROM_REG_BAND_4_CHANNELS,
101                 EEPROM_REG_BAND_5_CHANNELS,
102                 EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
103                 EEPROM_REGULATORY_BAND_NO_HT40,
104         },
105         .enhanced_txpower = true,
106 };
107
108 #define IWL_DEVICE_2000                                         \
109         .fw_name_pre = IWL2000_FW_PRE,                          \
110         .ucode_api_max = IWL2000_UCODE_API_MAX,                 \
111         .ucode_api_min = IWL2000_UCODE_API_MIN,                 \
112         .device_family = IWL_DEVICE_FAMILY_2000,                \
113         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
114         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
115         .nvm_ver = EEPROM_2000_EEPROM_VERSION,                  \
116         .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,          \
117         .base_params = &iwl2000_base_params,                    \
118         .eeprom_params = &iwl20x0_eeprom_params,                \
119         .led_mode = IWL_LED_RF_STATE,                           \
120         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
121
122
123 const struct iwl_cfg iwl2000_2bgn_cfg = {
124         .name = "Intel(R) Centrino(R) Wireless-N 2200 BGN",
125         IWL_DEVICE_2000,
126         .ht_params = &iwl2000_ht_params,
127 };
128
129 const struct iwl_cfg iwl2000_2bgn_d_cfg = {
130         .name = "Intel(R) Centrino(R) Wireless-N 2200D BGN",
131         IWL_DEVICE_2000,
132         .ht_params = &iwl2000_ht_params,
133 };
134
135 #define IWL_DEVICE_2030                                         \
136         .fw_name_pre = IWL2030_FW_PRE,                          \
137         .ucode_api_max = IWL2030_UCODE_API_MAX,                 \
138         .ucode_api_min = IWL2030_UCODE_API_MIN,                 \
139         .device_family = IWL_DEVICE_FAMILY_2030,                \
140         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
141         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
142         .nvm_ver = EEPROM_2000_EEPROM_VERSION,          \
143         .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,  \
144         .base_params = &iwl2030_base_params,                    \
145         .eeprom_params = &iwl20x0_eeprom_params,                \
146         .led_mode = IWL_LED_RF_STATE,                           \
147         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
148
149 const struct iwl_cfg iwl2030_2bgn_cfg = {
150         .name = "Intel(R) Centrino(R) Wireless-N 2230 BGN",
151         IWL_DEVICE_2030,
152         .ht_params = &iwl2000_ht_params,
153 };
154
155 #define IWL_DEVICE_105                                          \
156         .fw_name_pre = IWL105_FW_PRE,                           \
157         .ucode_api_max = IWL105_UCODE_API_MAX,                  \
158         .ucode_api_min = IWL105_UCODE_API_MIN,                  \
159         .device_family = IWL_DEVICE_FAMILY_105,                 \
160         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
161         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
162         .nvm_ver = EEPROM_2000_EEPROM_VERSION,          \
163         .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,  \
164         .base_params = &iwl2000_base_params,                    \
165         .eeprom_params = &iwl20x0_eeprom_params,                \
166         .led_mode = IWL_LED_RF_STATE,                           \
167         .rx_with_siso_diversity = true,                         \
168         .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K
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
197 const struct iwl_cfg iwl135_bgn_cfg = {
198         .name = "Intel(R) Centrino(R) Wireless-N 135 BGN",
199         IWL_DEVICE_135,
200         .ht_params = &iwl2000_ht_params,
201 };
202
203 MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX));
204 MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX));
205 MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX));
206 MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX));