Commit | Line | Data |
---|---|---|
e1228374 JS |
1 | /****************************************************************************** |
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 */ | |
fcbaf8b0 WYG |
49 | #define IWL6000_UCODE_API_MAX 4 |
50 | #define IWL6050_UCODE_API_MAX 4 | |
e1228374 JS |
51 | |
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 | ||
672639de WYG |
64 | static 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 | ||
65b7998a WYG |
71 | /* NIC configuration for 6000 series */ |
72 | static void iwl6000_nic_config(struct iwl_priv *priv) | |
73 | { | |
74 | iwl5000_nic_config(priv); | |
75 | ||
76 | /* no locking required for register write */ | |
77 | if (priv->cfg->pa_type == IWL_PA_HYBRID) { | |
78 | /* 2x2 hybrid phy type */ | |
79 | iwl_write32(priv, CSR_GP_DRIVER_REG, | |
80 | CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_HYB); | |
81 | } else if (priv->cfg->pa_type == IWL_PA_INTERNAL) { | |
82 | /* 2x2 IPA phy type */ | |
83 | iwl_write32(priv, CSR_GP_DRIVER_REG, | |
84 | CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA); | |
85 | } | |
86 | /* else do nothing, uCode configured */ | |
87 | } | |
88 | ||
672639de WYG |
89 | static struct iwl_lib_ops iwl6000_lib = { |
90 | .set_hw_params = iwl5000_hw_set_hw_params, | |
91 | .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl, | |
92 | .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl, | |
93 | .txq_set_sched = iwl5000_txq_set_sched, | |
94 | .txq_agg_enable = iwl5000_txq_agg_enable, | |
95 | .txq_agg_disable = iwl5000_txq_agg_disable, | |
96 | .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd, | |
97 | .txq_free_tfd = iwl_hw_txq_free_tfd, | |
98 | .txq_init = iwl_hw_tx_queue_init, | |
99 | .rx_handler_setup = iwl5000_rx_handler_setup, | |
100 | .setup_deferred_work = iwl5000_setup_deferred_work, | |
101 | .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr, | |
102 | .load_ucode = iwl5000_load_ucode, | |
b7a79404 RC |
103 | .dump_nic_event_log = iwl_dump_nic_event_log, |
104 | .dump_nic_error_log = iwl_dump_nic_error_log, | |
672639de WYG |
105 | .init_alive_start = iwl5000_init_alive_start, |
106 | .alive_notify = iwl5000_alive_notify, | |
107 | .send_tx_power = iwl5000_send_tx_power, | |
108 | .update_chain_flags = iwl_update_chain_flags, | |
109 | .apm_ops = { | |
110 | .init = iwl5000_apm_init, | |
111 | .reset = iwl5000_apm_reset, | |
112 | .stop = iwl5000_apm_stop, | |
65b7998a | 113 | .config = iwl6000_nic_config, |
672639de WYG |
114 | .set_pwr_src = iwl_set_pwr_src, |
115 | }, | |
116 | .eeprom_ops = { | |
117 | .regulatory_bands = { | |
118 | EEPROM_5000_REG_BAND_1_CHANNELS, | |
119 | EEPROM_5000_REG_BAND_2_CHANNELS, | |
120 | EEPROM_5000_REG_BAND_3_CHANNELS, | |
121 | EEPROM_5000_REG_BAND_4_CHANNELS, | |
122 | EEPROM_5000_REG_BAND_5_CHANNELS, | |
7aafef1c WYG |
123 | EEPROM_5000_REG_BAND_24_HT40_CHANNELS, |
124 | EEPROM_5000_REG_BAND_52_HT40_CHANNELS | |
672639de WYG |
125 | }, |
126 | .verify_signature = iwlcore_eeprom_verify_signature, | |
127 | .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, | |
128 | .release_semaphore = iwlcore_eeprom_release_semaphore, | |
129 | .calib_version = iwl5000_eeprom_calib_version, | |
130 | .query_addr = iwl5000_eeprom_query_addr, | |
ab9fd1bf | 131 | .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower, |
672639de WYG |
132 | }, |
133 | .post_associate = iwl_post_associate, | |
134 | .isr = iwl_isr_ict, | |
135 | .config_ap = iwl_config_ap, | |
136 | .temp_ops = { | |
137 | .temperature = iwl5000_temperature, | |
138 | .set_ct_kill = iwl6000_set_ct_threshold, | |
139 | }, | |
140 | }; | |
141 | ||
29f35c14 JS |
142 | static struct iwl_hcmd_utils_ops iwl6000_hcmd_utils = { |
143 | .get_hcmd_size = iwl5000_get_hcmd_size, | |
144 | .build_addsta_hcmd = iwl5000_build_addsta_hcmd, | |
145 | .rts_tx_cmd_flag = iwl5000_rts_tx_cmd_flag, | |
146 | .calc_rssi = iwl5000_calc_rssi, | |
147 | }; | |
148 | ||
149 | static struct iwl_ops iwl6000_ops = { | |
cc0f555d | 150 | .ucode = &iwl5000_ucode, |
672639de | 151 | .lib = &iwl6000_lib, |
29f35c14 JS |
152 | .hcmd = &iwl5000_hcmd, |
153 | .utils = &iwl6000_hcmd_utils, | |
154 | }; | |
155 | ||
e1228374 | 156 | |
65b7998a WYG |
157 | /* |
158 | * "h": Hybrid configuration, use both internal and external Power Amplifier | |
159 | */ | |
160 | struct iwl_cfg iwl6000h_2agn_cfg = { | |
e1228374 JS |
161 | .name = "6000 Series 2x2 AGN", |
162 | .fw_name_pre = IWL6000_FW_PRE, | |
163 | .ucode_api_max = IWL6000_UCODE_API_MAX, | |
164 | .ucode_api_min = IWL6000_UCODE_API_MIN, | |
165 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | |
29f35c14 | 166 | .ops = &iwl6000_ops, |
415e4993 | 167 | .eeprom_size = OTP_LOW_IMAGE_SIZE, |
e1228374 JS |
168 | .eeprom_ver = EEPROM_5000_EEPROM_VERSION, |
169 | .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, | |
170 | .mod_params = &iwl50_mod_params, | |
542cc793 JS |
171 | .valid_tx_ant = ANT_AB, |
172 | .valid_rx_ant = ANT_AB, | |
050681b7 | 173 | .need_pll_cfg = false, |
65b7998a | 174 | .pa_type = IWL_PA_HYBRID, |
415e4993 WYG |
175 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, |
176 | .shadow_ram_support = true, | |
b261793d | 177 | .ht_greenfield_support = true, |
65b7998a WYG |
178 | }; |
179 | ||
180 | /* | |
181 | * "i": Internal configuration, use internal Power Amplifier | |
182 | */ | |
183 | struct iwl_cfg iwl6000i_2agn_cfg = { | |
184 | .name = "6000 Series 2x2 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, | |
189 | .ops = &iwl6000_ops, | |
415e4993 | 190 | .eeprom_size = OTP_LOW_IMAGE_SIZE, |
65b7998a WYG |
191 | .eeprom_ver = EEPROM_5000_EEPROM_VERSION, |
192 | .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, | |
193 | .mod_params = &iwl50_mod_params, | |
194 | .valid_tx_ant = ANT_BC, | |
195 | .valid_rx_ant = ANT_BC, | |
196 | .need_pll_cfg = false, | |
197 | .pa_type = IWL_PA_INTERNAL, | |
415e4993 WYG |
198 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, |
199 | .shadow_ram_support = true, | |
b261793d | 200 | .ht_greenfield_support = true, |
e1228374 JS |
201 | }; |
202 | ||
203 | struct iwl_cfg iwl6050_2agn_cfg = { | |
204 | .name = "6050 Series 2x2 AGN", | |
205 | .fw_name_pre = IWL6050_FW_PRE, | |
206 | .ucode_api_max = IWL6050_UCODE_API_MAX, | |
207 | .ucode_api_min = IWL6050_UCODE_API_MIN, | |
208 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | |
29f35c14 | 209 | .ops = &iwl6000_ops, |
415e4993 | 210 | .eeprom_size = OTP_LOW_IMAGE_SIZE, |
e1228374 JS |
211 | .eeprom_ver = EEPROM_5000_EEPROM_VERSION, |
212 | .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, | |
213 | .mod_params = &iwl50_mod_params, | |
542cc793 JS |
214 | .valid_tx_ant = ANT_AB, |
215 | .valid_rx_ant = ANT_AB, | |
050681b7 | 216 | .need_pll_cfg = false, |
65b7998a | 217 | .pa_type = IWL_PA_SYSTEM, |
415e4993 WYG |
218 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, |
219 | .shadow_ram_support = true, | |
b261793d | 220 | .ht_greenfield_support = true, |
e1228374 JS |
221 | }; |
222 | ||
223 | struct iwl_cfg iwl6000_3agn_cfg = { | |
224 | .name = "6000 Series 3x3 AGN", | |
225 | .fw_name_pre = IWL6000_FW_PRE, | |
226 | .ucode_api_max = IWL6000_UCODE_API_MAX, | |
227 | .ucode_api_min = IWL6000_UCODE_API_MIN, | |
228 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | |
29f35c14 | 229 | .ops = &iwl6000_ops, |
415e4993 | 230 | .eeprom_size = OTP_LOW_IMAGE_SIZE, |
e1228374 JS |
231 | .eeprom_ver = EEPROM_5000_EEPROM_VERSION, |
232 | .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, | |
233 | .mod_params = &iwl50_mod_params, | |
c0bac76a JS |
234 | .valid_tx_ant = ANT_ABC, |
235 | .valid_rx_ant = ANT_ABC, | |
050681b7 | 236 | .need_pll_cfg = false, |
65b7998a | 237 | .pa_type = IWL_PA_SYSTEM, |
415e4993 WYG |
238 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, |
239 | .shadow_ram_support = true, | |
b261793d | 240 | .ht_greenfield_support = true, |
e1228374 JS |
241 | }; |
242 | ||
243 | struct iwl_cfg iwl6050_3agn_cfg = { | |
244 | .name = "6050 Series 3x3 AGN", | |
245 | .fw_name_pre = IWL6050_FW_PRE, | |
246 | .ucode_api_max = IWL6050_UCODE_API_MAX, | |
247 | .ucode_api_min = IWL6050_UCODE_API_MIN, | |
248 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | |
29f35c14 | 249 | .ops = &iwl6000_ops, |
415e4993 | 250 | .eeprom_size = OTP_LOW_IMAGE_SIZE, |
e1228374 JS |
251 | .eeprom_ver = EEPROM_5000_EEPROM_VERSION, |
252 | .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, | |
253 | .mod_params = &iwl50_mod_params, | |
c0bac76a JS |
254 | .valid_tx_ant = ANT_ABC, |
255 | .valid_rx_ant = ANT_ABC, | |
050681b7 | 256 | .need_pll_cfg = false, |
65b7998a | 257 | .pa_type = IWL_PA_SYSTEM, |
415e4993 WYG |
258 | .max_ll_items = OTP_MAX_LL_ITEMS_6x00, |
259 | .shadow_ram_support = true, | |
b261793d | 260 | .ht_greenfield_support = true, |
e1228374 JS |
261 | }; |
262 | ||
263 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); | |
264 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); |