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