blob: 59ff73536f3a87d467f3585ac4429e8d3d25441a [file] [log] [blame]
Jay Sternberge1228372009-01-19 15:30:34 -08001/******************************************************************************
2 *
3 * Copyright(c) 2008-2009 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/kernel.h>
28#include <linux/module.h>
29#include <linux/init.h>
30#include <linux/pci.h>
31#include <linux/dma-mapping.h>
32#include <linux/delay.h>
33#include <linux/skbuff.h>
34#include <linux/netdevice.h>
35#include <linux/wireless.h>
36#include <net/mac80211.h>
37#include <linux/etherdevice.h>
38#include <asm/unaligned.h>
39
40#include "iwl-eeprom.h"
41#include "iwl-dev.h"
42#include "iwl-core.h"
43#include "iwl-io.h"
44#include "iwl-sta.h"
45#include "iwl-helpers.h"
46#include "iwl-5000-hw.h"
47
48/* Highest firmware API version supported */
Jay Sternbergcc0f5552009-07-17 09:30:16 -070049#define IWL6000_UCODE_API_MAX 3
50#define IWL6050_UCODE_API_MAX 3
Jay Sternberge1228372009-01-19 15:30:34 -080051
52/* Lowest firmware API version supported */
53#define IWL6000_UCODE_API_MIN 1
54#define IWL6050_UCODE_API_MIN 1
55
56#define IWL6000_FW_PRE "iwlwifi-6000-"
57#define _IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE #api ".ucode"
58#define IWL6000_MODULE_FIRMWARE(api) _IWL6000_MODULE_FIRMWARE(api)
59
60#define IWL6050_FW_PRE "iwlwifi-6050-"
61#define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode"
62#define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api)
63
Wey-Yi Guy672639d2009-07-24 11:13:01 -070064static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
65{
66 /* want Celsius */
67 priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
68 priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
69}
70
71static struct iwl_lib_ops iwl6000_lib = {
72 .set_hw_params = iwl5000_hw_set_hw_params,
73 .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
74 .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
75 .txq_set_sched = iwl5000_txq_set_sched,
76 .txq_agg_enable = iwl5000_txq_agg_enable,
77 .txq_agg_disable = iwl5000_txq_agg_disable,
78 .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
79 .txq_free_tfd = iwl_hw_txq_free_tfd,
80 .txq_init = iwl_hw_tx_queue_init,
81 .rx_handler_setup = iwl5000_rx_handler_setup,
82 .setup_deferred_work = iwl5000_setup_deferred_work,
83 .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
84 .load_ucode = iwl5000_load_ucode,
85 .init_alive_start = iwl5000_init_alive_start,
86 .alive_notify = iwl5000_alive_notify,
87 .send_tx_power = iwl5000_send_tx_power,
88 .update_chain_flags = iwl_update_chain_flags,
89 .apm_ops = {
90 .init = iwl5000_apm_init,
91 .reset = iwl5000_apm_reset,
92 .stop = iwl5000_apm_stop,
93 .config = iwl5000_nic_config,
94 .set_pwr_src = iwl_set_pwr_src,
95 },
96 .eeprom_ops = {
97 .regulatory_bands = {
98 EEPROM_5000_REG_BAND_1_CHANNELS,
99 EEPROM_5000_REG_BAND_2_CHANNELS,
100 EEPROM_5000_REG_BAND_3_CHANNELS,
101 EEPROM_5000_REG_BAND_4_CHANNELS,
102 EEPROM_5000_REG_BAND_5_CHANNELS,
103 EEPROM_5000_REG_BAND_24_FAT_CHANNELS,
104 EEPROM_5000_REG_BAND_52_FAT_CHANNELS
105 },
106 .verify_signature = iwlcore_eeprom_verify_signature,
107 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
108 .release_semaphore = iwlcore_eeprom_release_semaphore,
109 .calib_version = iwl5000_eeprom_calib_version,
110 .query_addr = iwl5000_eeprom_query_addr,
111 },
112 .post_associate = iwl_post_associate,
113 .isr = iwl_isr_ict,
114 .config_ap = iwl_config_ap,
115 .temp_ops = {
116 .temperature = iwl5000_temperature,
117 .set_ct_kill = iwl6000_set_ct_threshold,
118 },
119};
120
Jay Sternberg29f35c12009-01-29 11:09:16 -0800121static struct iwl_hcmd_utils_ops iwl6000_hcmd_utils = {
122 .get_hcmd_size = iwl5000_get_hcmd_size,
123 .build_addsta_hcmd = iwl5000_build_addsta_hcmd,
124 .rts_tx_cmd_flag = iwl5000_rts_tx_cmd_flag,
125 .calc_rssi = iwl5000_calc_rssi,
126};
127
128static struct iwl_ops iwl6000_ops = {
Jay Sternbergcc0f5552009-07-17 09:30:16 -0700129 .ucode = &iwl5000_ucode,
Wey-Yi Guy672639d2009-07-24 11:13:01 -0700130 .lib = &iwl6000_lib,
Jay Sternberg29f35c12009-01-29 11:09:16 -0800131 .hcmd = &iwl5000_hcmd,
132 .utils = &iwl6000_hcmd_utils,
133};
134
Jay Sternberge1228372009-01-19 15:30:34 -0800135struct iwl_cfg iwl6000_2ag_cfg = {
136 .name = "6000 Series 2x2 AG",
137 .fw_name_pre = IWL6000_FW_PRE,
138 .ucode_api_max = IWL6000_UCODE_API_MAX,
139 .ucode_api_min = IWL6000_UCODE_API_MIN,
140 .sku = IWL_SKU_A|IWL_SKU_G,
Jay Sternberg29f35c12009-01-29 11:09:16 -0800141 .ops = &iwl6000_ops,
Jay Sternberge1228372009-01-19 15:30:34 -0800142 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
143 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
144 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
145 .mod_params = &iwl50_mod_params,
Jay Sternbergc0bac762009-02-02 16:21:14 -0800146 .valid_tx_ant = ANT_BC,
147 .valid_rx_ant = ANT_BC,
Jay Sternberg050681b2009-01-29 11:09:13 -0800148 .need_pll_cfg = false,
Jay Sternberge1228372009-01-19 15:30:34 -0800149};
150
151struct iwl_cfg iwl6000_2agn_cfg = {
152 .name = "6000 Series 2x2 AGN",
153 .fw_name_pre = IWL6000_FW_PRE,
154 .ucode_api_max = IWL6000_UCODE_API_MAX,
155 .ucode_api_min = IWL6000_UCODE_API_MIN,
156 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
Jay Sternberg29f35c12009-01-29 11:09:16 -0800157 .ops = &iwl6000_ops,
Jay Sternberge1228372009-01-19 15:30:34 -0800158 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
159 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
160 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
161 .mod_params = &iwl50_mod_params,
Jay Sternberg542cc792009-05-08 13:44:46 -0700162 .valid_tx_ant = ANT_AB,
163 .valid_rx_ant = ANT_AB,
Jay Sternberg050681b2009-01-29 11:09:13 -0800164 .need_pll_cfg = false,
Jay Sternberge1228372009-01-19 15:30:34 -0800165};
166
167struct iwl_cfg iwl6050_2agn_cfg = {
168 .name = "6050 Series 2x2 AGN",
169 .fw_name_pre = IWL6050_FW_PRE,
170 .ucode_api_max = IWL6050_UCODE_API_MAX,
171 .ucode_api_min = IWL6050_UCODE_API_MIN,
172 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
Jay Sternberg29f35c12009-01-29 11:09:16 -0800173 .ops = &iwl6000_ops,
Jay Sternberge1228372009-01-19 15:30:34 -0800174 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
175 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
176 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
177 .mod_params = &iwl50_mod_params,
Jay Sternberg542cc792009-05-08 13:44:46 -0700178 .valid_tx_ant = ANT_AB,
179 .valid_rx_ant = ANT_AB,
Jay Sternberg050681b2009-01-29 11:09:13 -0800180 .need_pll_cfg = false,
Jay Sternberge1228372009-01-19 15:30:34 -0800181};
182
183struct iwl_cfg iwl6000_3agn_cfg = {
184 .name = "6000 Series 3x3 AGN",
185 .fw_name_pre = IWL6000_FW_PRE,
186 .ucode_api_max = IWL6000_UCODE_API_MAX,
187 .ucode_api_min = IWL6000_UCODE_API_MIN,
188 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
Jay Sternberg29f35c12009-01-29 11:09:16 -0800189 .ops = &iwl6000_ops,
Jay Sternberge1228372009-01-19 15:30:34 -0800190 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
191 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
192 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
193 .mod_params = &iwl50_mod_params,
Jay Sternbergc0bac762009-02-02 16:21:14 -0800194 .valid_tx_ant = ANT_ABC,
195 .valid_rx_ant = ANT_ABC,
Jay Sternberg050681b2009-01-29 11:09:13 -0800196 .need_pll_cfg = false,
Jay Sternberge1228372009-01-19 15:30:34 -0800197};
198
199struct iwl_cfg iwl6050_3agn_cfg = {
200 .name = "6050 Series 3x3 AGN",
201 .fw_name_pre = IWL6050_FW_PRE,
202 .ucode_api_max = IWL6050_UCODE_API_MAX,
203 .ucode_api_min = IWL6050_UCODE_API_MIN,
204 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
Jay Sternberg29f35c12009-01-29 11:09:16 -0800205 .ops = &iwl6000_ops,
Jay Sternberge1228372009-01-19 15:30:34 -0800206 .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
207 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
208 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
209 .mod_params = &iwl50_mod_params,
Jay Sternbergc0bac762009-02-02 16:21:14 -0800210 .valid_tx_ant = ANT_ABC,
211 .valid_rx_ant = ANT_ABC,
Jay Sternberg050681b2009-01-29 11:09:13 -0800212 .need_pll_cfg = false,
Jay Sternberge1228372009-01-19 15:30:34 -0800213};
214
215MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
216MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));