iwlwifi: dynamically determine lib_ops
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-5000.c
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2012 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-cfg.h"
31 #include "iwl-dev.h" /* still needed */
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 #define IWL5000_FW_PRE "iwlwifi-5000-"
42 #define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE __stringify(api) ".ucode"
43
44 #define IWL5150_FW_PRE "iwlwifi-5150-"
45 #define IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE __stringify(api) ".ucode"
46
47 static const struct iwl_base_params iwl5000_base_params = {
48         .eeprom_size = IWLAGN_EEPROM_IMG_SIZE,
49         .num_of_queues = IWLAGN_NUM_QUEUES,
50         .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
51         .led_compensation = 51,
52         .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
53         .chain_noise_scale = 1000,
54         .wd_timeout = IWL_WATCHHDOG_DISABLED,
55         .max_event_log_size = 512,
56         .no_idle_support = true,
57 };
58
59 static const struct iwl_ht_params iwl5000_ht_params = {
60         .ht_greenfield_support = true,
61 };
62
63 #define IWL_DEVICE_5000                                         \
64         .fw_name_pre = IWL5000_FW_PRE,                          \
65         .ucode_api_max = IWL5000_UCODE_API_MAX,                 \
66         .ucode_api_min = IWL5000_UCODE_API_MIN,                 \
67         .device_family = IWL_DEVICE_FAMILY_5000,                \
68         .max_inst_size = IWLAGN_RTC_INST_SIZE,                  \
69         .max_data_size = IWLAGN_RTC_DATA_SIZE,                  \
70         .eeprom_ver = EEPROM_5000_EEPROM_VERSION,               \
71         .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,       \
72         .base_params = &iwl5000_base_params,                    \
73         .led_mode = IWL_LED_BLINK
74
75 const struct iwl_cfg iwl5300_agn_cfg = {
76         .name = "Intel(R) Ultimate N WiFi Link 5300 AGN",
77         IWL_DEVICE_5000,
78         /* at least EEPROM 0x11A has wrong info */
79         .valid_tx_ant = ANT_ABC,        /* .cfg overwrite */
80         .valid_rx_ant = ANT_ABC,        /* .cfg overwrite */
81         .ht_params = &iwl5000_ht_params,
82 };
83
84 const struct iwl_cfg iwl5100_bgn_cfg = {
85         .name = "Intel(R) WiFi Link 5100 BGN",
86         IWL_DEVICE_5000,
87         .valid_tx_ant = ANT_B,          /* .cfg overwrite */
88         .valid_rx_ant = ANT_AB,         /* .cfg overwrite */
89         .ht_params = &iwl5000_ht_params,
90 };
91
92 const struct iwl_cfg iwl5100_abg_cfg = {
93         .name = "Intel(R) WiFi Link 5100 ABG",
94         IWL_DEVICE_5000,
95         .valid_tx_ant = ANT_B,          /* .cfg overwrite */
96         .valid_rx_ant = ANT_AB,         /* .cfg overwrite */
97 };
98
99 const struct iwl_cfg iwl5100_agn_cfg = {
100         .name = "Intel(R) WiFi Link 5100 AGN",
101         IWL_DEVICE_5000,
102         .valid_tx_ant = ANT_B,          /* .cfg overwrite */
103         .valid_rx_ant = ANT_AB,         /* .cfg overwrite */
104         .ht_params = &iwl5000_ht_params,
105 };
106
107 const struct iwl_cfg iwl5350_agn_cfg = {
108         .name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
109         .fw_name_pre = IWL5000_FW_PRE,
110         .ucode_api_max = IWL5000_UCODE_API_MAX,
111         .ucode_api_min = IWL5000_UCODE_API_MIN,
112         .device_family = IWL_DEVICE_FAMILY_5000,
113         .max_inst_size = IWLAGN_RTC_INST_SIZE,
114         .max_data_size = IWLAGN_RTC_DATA_SIZE,
115         .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
116         .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
117         .base_params = &iwl5000_base_params,
118         .ht_params = &iwl5000_ht_params,
119         .led_mode = IWL_LED_BLINK,
120         .internal_wimax_coex = true,
121 };
122
123 #define IWL_DEVICE_5150                                         \
124         .fw_name_pre = IWL5150_FW_PRE,                          \
125         .ucode_api_max = IWL5150_UCODE_API_MAX,                 \
126         .ucode_api_min = IWL5150_UCODE_API_MIN,                 \
127         .device_family = IWL_DEVICE_FAMILY_5150,                \
128         .max_inst_size = IWLAGN_RTC_INST_SIZE,                  \
129         .max_data_size = IWLAGN_RTC_DATA_SIZE,                  \
130         .eeprom_ver = EEPROM_5050_EEPROM_VERSION,               \
131         .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,       \
132         .base_params = &iwl5000_base_params,                    \
133         .no_xtal_calib = true,                                  \
134         .led_mode = IWL_LED_BLINK,                              \
135         .internal_wimax_coex = true
136
137 const struct iwl_cfg iwl5150_agn_cfg = {
138         .name = "Intel(R) WiMAX/WiFi Link 5150 AGN",
139         IWL_DEVICE_5150,
140         .ht_params = &iwl5000_ht_params,
141
142 };
143
144 const struct iwl_cfg iwl5150_abg_cfg = {
145         .name = "Intel(R) WiMAX/WiFi Link 5150 ABG",
146         IWL_DEVICE_5150,
147 };
148
149 MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
150 MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));