Merge tag 'iwlwifi-next-for-kalle-2014-12-30' of https://git.kernel.org/pub/scm/linux...
[cascardo/linux.git] / 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
128 const struct iwl_cfg iwl2000_2bgn_cfg = {
129         .name = "Intel(R) Centrino(R) Wireless-N 2200 BGN",
130         IWL_DEVICE_2000,
131         .ht_params = &iwl2000_ht_params,
132 };
133
134 const struct iwl_cfg iwl2000_2bgn_d_cfg = {
135         .name = "Intel(R) Centrino(R) Wireless-N 2200D BGN",
136         IWL_DEVICE_2000,
137         .ht_params = &iwl2000_ht_params,
138 };
139
140 #define IWL_DEVICE_2030                                         \
141         .fw_name_pre = IWL2030_FW_PRE,                          \
142         .ucode_api_max = IWL2030_UCODE_API_MAX,                 \
143         .ucode_api_ok = IWL2030_UCODE_API_OK,                   \
144         .ucode_api_min = IWL2030_UCODE_API_MIN,                 \
145         .device_family = IWL_DEVICE_FAMILY_2030,                \
146         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
147         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
148         .nvm_ver = EEPROM_2000_EEPROM_VERSION,          \
149         .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,  \
150         .base_params = &iwl2030_base_params,                    \
151         .eeprom_params = &iwl20x0_eeprom_params,                \
152         .led_mode = IWL_LED_RF_STATE
153
154 const struct iwl_cfg iwl2030_2bgn_cfg = {
155         .name = "Intel(R) Centrino(R) Wireless-N 2230 BGN",
156         IWL_DEVICE_2030,
157         .ht_params = &iwl2000_ht_params,
158 };
159
160 #define IWL_DEVICE_105                                          \
161         .fw_name_pre = IWL105_FW_PRE,                           \
162         .ucode_api_max = IWL105_UCODE_API_MAX,                  \
163         .ucode_api_ok = IWL105_UCODE_API_OK,                    \
164         .ucode_api_min = IWL105_UCODE_API_MIN,                  \
165         .device_family = IWL_DEVICE_FAMILY_105,                 \
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 = &iwl2000_base_params,                    \
171         .eeprom_params = &iwl20x0_eeprom_params,                \
172         .led_mode = IWL_LED_RF_STATE,                           \
173         .rx_with_siso_diversity = true
174
175 const struct iwl_cfg iwl105_bgn_cfg = {
176         .name = "Intel(R) Centrino(R) Wireless-N 105 BGN",
177         IWL_DEVICE_105,
178         .ht_params = &iwl2000_ht_params,
179 };
180
181 const struct iwl_cfg iwl105_bgn_d_cfg = {
182         .name = "Intel(R) Centrino(R) Wireless-N 105D BGN",
183         IWL_DEVICE_105,
184         .ht_params = &iwl2000_ht_params,
185 };
186
187 #define IWL_DEVICE_135                                          \
188         .fw_name_pre = IWL135_FW_PRE,                           \
189         .ucode_api_max = IWL135_UCODE_API_MAX,                  \
190         .ucode_api_ok = IWL135_UCODE_API_OK,                    \
191         .ucode_api_min = IWL135_UCODE_API_MIN,                  \
192         .device_family = IWL_DEVICE_FAMILY_135,                 \
193         .max_inst_size = IWL60_RTC_INST_SIZE,                   \
194         .max_data_size = IWL60_RTC_DATA_SIZE,                   \
195         .nvm_ver = EEPROM_2000_EEPROM_VERSION,          \
196         .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION,  \
197         .base_params = &iwl2030_base_params,                    \
198         .eeprom_params = &iwl20x0_eeprom_params,                \
199         .led_mode = IWL_LED_RF_STATE,                           \
200         .rx_with_siso_diversity = true
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_OK));
209 MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK));
210 MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK));
211 MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_OK));