Merge tag 'firmware-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[cascardo/linux.git] / drivers / net / wireless / iwlwifi / iwl-5000.c
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 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 "iwl-csr.h"
32
33 /* Highest firmware API version supported */
34 #define IWL5000_UCODE_API_MAX 5
35 #define IWL5150_UCODE_API_MAX 2
36
37 /* Oldest version we won't warn about */
38 #define IWL5000_UCODE_API_OK 5
39 #define IWL5150_UCODE_API_OK 2
40
41 /* Lowest firmware API version supported */
42 #define IWL5000_UCODE_API_MIN 1
43 #define IWL5150_UCODE_API_MIN 1
44
45 /* EEPROM versions */
46 #define EEPROM_5000_TX_POWER_VERSION    (4)
47 #define EEPROM_5000_EEPROM_VERSION      (0x11A)
48 #define EEPROM_5050_TX_POWER_VERSION    (4)
49 #define EEPROM_5050_EEPROM_VERSION      (0x21E)
50
51 #define IWL5000_FW_PRE "iwlwifi-5000-"
52 #define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE __stringify(api) ".ucode"
53
54 #define IWL5150_FW_PRE "iwlwifi-5150-"
55 #define IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE __stringify(api) ".ucode"
56
57 static const struct iwl_base_params iwl5000_base_params = {
58         .eeprom_size = IWLAGN_EEPROM_IMG_SIZE,
59         .num_of_queues = IWLAGN_NUM_QUEUES,
60         .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
61         .led_compensation = 51,
62         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
63         .chain_noise_scale = 1000,
64         .wd_timeout = IWL_WATCHDOG_DISABLED,
65         .max_event_log_size = 512,
66         .no_idle_support = true,
67 };
68
69 static const struct iwl_ht_params iwl5000_ht_params = {
70         .ht_greenfield_support = true,
71         .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
72 };
73
74 static const struct iwl_eeprom_params iwl5000_eeprom_params = {
75         .regulatory_bands = {
76                 EEPROM_REG_BAND_1_CHANNELS,
77                 EEPROM_REG_BAND_2_CHANNELS,
78                 EEPROM_REG_BAND_3_CHANNELS,
79                 EEPROM_REG_BAND_4_CHANNELS,
80                 EEPROM_REG_BAND_5_CHANNELS,
81                 EEPROM_REG_BAND_24_HT40_CHANNELS,
82                 EEPROM_REG_BAND_52_HT40_CHANNELS
83         },
84 };
85
86 #define IWL_DEVICE_5000                                         \
87         .fw_name_pre = IWL5000_FW_PRE,                          \
88         .ucode_api_max = IWL5000_UCODE_API_MAX,                 \
89         .ucode_api_ok = IWL5000_UCODE_API_OK,                   \
90         .ucode_api_min = IWL5000_UCODE_API_MIN,                 \
91         .device_family = IWL_DEVICE_FAMILY_5000,                \
92         .max_inst_size = IWLAGN_RTC_INST_SIZE,                  \
93         .max_data_size = IWLAGN_RTC_DATA_SIZE,                  \
94         .nvm_ver = EEPROM_5000_EEPROM_VERSION,          \
95         .nvm_calib_ver = EEPROM_5000_TX_POWER_VERSION,  \
96         .base_params = &iwl5000_base_params,                    \
97         .eeprom_params = &iwl5000_eeprom_params,                \
98         .led_mode = IWL_LED_BLINK
99
100 const struct iwl_cfg iwl5300_agn_cfg = {
101         .name = "Intel(R) Ultimate N WiFi Link 5300 AGN",
102         IWL_DEVICE_5000,
103         /* at least EEPROM 0x11A has wrong info */
104         .valid_tx_ant = ANT_ABC,        /* .cfg overwrite */
105         .valid_rx_ant = ANT_ABC,        /* .cfg overwrite */
106         .ht_params = &iwl5000_ht_params,
107 };
108
109 const struct iwl_cfg iwl5100_bgn_cfg = {
110         .name = "Intel(R) WiFi Link 5100 BGN",
111         IWL_DEVICE_5000,
112         .valid_tx_ant = ANT_B,          /* .cfg overwrite */
113         .valid_rx_ant = ANT_AB,         /* .cfg overwrite */
114         .ht_params = &iwl5000_ht_params,
115 };
116
117 const struct iwl_cfg iwl5100_abg_cfg = {
118         .name = "Intel(R) WiFi Link 5100 ABG",
119         IWL_DEVICE_5000,
120         .valid_tx_ant = ANT_B,          /* .cfg overwrite */
121         .valid_rx_ant = ANT_AB,         /* .cfg overwrite */
122 };
123
124 const struct iwl_cfg iwl5100_agn_cfg = {
125         .name = "Intel(R) WiFi Link 5100 AGN",
126         IWL_DEVICE_5000,
127         .valid_tx_ant = ANT_B,          /* .cfg overwrite */
128         .valid_rx_ant = ANT_AB,         /* .cfg overwrite */
129         .ht_params = &iwl5000_ht_params,
130 };
131
132 const struct iwl_cfg iwl5350_agn_cfg = {
133         .name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
134         .fw_name_pre = IWL5000_FW_PRE,
135         .ucode_api_max = IWL5000_UCODE_API_MAX,
136         .ucode_api_ok = IWL5000_UCODE_API_OK,
137         .ucode_api_min = IWL5000_UCODE_API_MIN,
138         .device_family = IWL_DEVICE_FAMILY_5000,
139         .max_inst_size = IWLAGN_RTC_INST_SIZE,
140         .max_data_size = IWLAGN_RTC_DATA_SIZE,
141         .nvm_ver = EEPROM_5050_EEPROM_VERSION,
142         .nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION,
143         .base_params = &iwl5000_base_params,
144         .eeprom_params = &iwl5000_eeprom_params,
145         .ht_params = &iwl5000_ht_params,
146         .led_mode = IWL_LED_BLINK,
147         .internal_wimax_coex = true,
148 };
149
150 #define IWL_DEVICE_5150                                         \
151         .fw_name_pre = IWL5150_FW_PRE,                          \
152         .ucode_api_max = IWL5150_UCODE_API_MAX,                 \
153         .ucode_api_ok = IWL5150_UCODE_API_OK,                   \
154         .ucode_api_min = IWL5150_UCODE_API_MIN,                 \
155         .device_family = IWL_DEVICE_FAMILY_5150,                \
156         .max_inst_size = IWLAGN_RTC_INST_SIZE,                  \
157         .max_data_size = IWLAGN_RTC_DATA_SIZE,                  \
158         .nvm_ver = EEPROM_5050_EEPROM_VERSION,          \
159         .nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION,  \
160         .base_params = &iwl5000_base_params,                    \
161         .eeprom_params = &iwl5000_eeprom_params,                \
162         .no_xtal_calib = true,                                  \
163         .led_mode = IWL_LED_BLINK,                              \
164         .internal_wimax_coex = true
165
166 const struct iwl_cfg iwl5150_agn_cfg = {
167         .name = "Intel(R) WiMAX/WiFi Link 5150 AGN",
168         IWL_DEVICE_5150,
169         .ht_params = &iwl5000_ht_params,
170
171 };
172
173 const struct iwl_cfg iwl5150_abg_cfg = {
174         .name = "Intel(R) WiMAX/WiFi Link 5150 ABG",
175         IWL_DEVICE_5150,
176 };
177
178 MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_OK));
179 MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_OK));