diff options
-rw-r--r-- | drivers/net/wireless/iwlegacy/3945-debug.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/3945-mac.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/3945-rs.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/3945.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/3945.h | 667 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h | 60 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl-3945-fh.h | 187 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl-3945-hw.h | 291 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl-3945.h | 308 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/iwl-dev.h | 3 |
10 files changed, 675 insertions, 855 deletions
diff --git a/drivers/net/wireless/iwlegacy/3945-debug.c b/drivers/net/wireless/iwlegacy/3945-debug.c index 88b3d8fc38f8..9c837c3c4f04 100644 --- a/drivers/net/wireless/iwlegacy/3945-debug.c +++ b/drivers/net/wireless/iwlegacy/3945-debug.c | |||
@@ -26,8 +26,9 @@ | |||
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | 28 | ||
29 | #include "iwl-3945-debugfs.h" | 29 | #include "iwl-dev.h" |
30 | 30 | #include "iwl-core.h" | |
31 | #include "3945.h" | ||
31 | 32 | ||
32 | static int il3945_stats_flag(struct il_priv *il, char *buf, int bufsz) | 33 | static int il3945_stats_flag(struct il_priv *il, char *buf, int bufsz) |
33 | { | 34 | { |
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c index 151c8faa18dd..17edbdf9dc84 100644 --- a/drivers/net/wireless/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/iwlegacy/3945-mac.c | |||
@@ -52,10 +52,9 @@ | |||
52 | #define DRV_NAME "iwl3945" | 52 | #define DRV_NAME "iwl3945" |
53 | 53 | ||
54 | #include "iwl-fh.h" | 54 | #include "iwl-fh.h" |
55 | #include "iwl-3945-fh.h" | ||
56 | #include "iwl-commands.h" | 55 | #include "iwl-commands.h" |
57 | #include "iwl-sta.h" | 56 | #include "iwl-sta.h" |
58 | #include "iwl-3945.h" | 57 | #include "3945.h" |
59 | #include "iwl-core.h" | 58 | #include "iwl-core.h" |
60 | #include "iwl-helpers.h" | 59 | #include "iwl-helpers.h" |
61 | #include "iwl-dev.h" | 60 | #include "iwl-dev.h" |
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c index f84ed5ecc676..0d2beba1a25a 100644 --- a/drivers/net/wireless/iwlegacy/3945-rs.c +++ b/drivers/net/wireless/iwlegacy/3945-rs.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/workqueue.h> | 37 | #include <linux/workqueue.h> |
38 | 38 | ||
39 | #include "iwl-commands.h" | 39 | #include "iwl-commands.h" |
40 | #include "iwl-3945.h" | 40 | #include "3945.h" |
41 | #include "iwl-sta.h" | 41 | #include "iwl-sta.h" |
42 | 42 | ||
43 | #define RS_NAME "iwl-3945-rs" | 43 | #define RS_NAME "iwl-3945-rs" |
diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c index b41e60b40264..17615c33d1aa 100644 --- a/drivers/net/wireless/iwlegacy/3945.c +++ b/drivers/net/wireless/iwlegacy/3945.c | |||
@@ -40,15 +40,13 @@ | |||
40 | #include <net/mac80211.h> | 40 | #include <net/mac80211.h> |
41 | 41 | ||
42 | #include "iwl-fh.h" | 42 | #include "iwl-fh.h" |
43 | #include "iwl-3945-fh.h" | ||
44 | #include "iwl-commands.h" | 43 | #include "iwl-commands.h" |
45 | #include "iwl-sta.h" | 44 | #include "iwl-sta.h" |
46 | #include "iwl-3945.h" | ||
47 | #include "iwl-eeprom.h" | 45 | #include "iwl-eeprom.h" |
48 | #include "iwl-core.h" | 46 | #include "iwl-core.h" |
49 | #include "iwl-helpers.h" | 47 | #include "iwl-helpers.h" |
50 | #include "iwl-led.h" | 48 | #include "iwl-led.h" |
51 | #include "iwl-3945-debugfs.h" | 49 | #include "3945.h" |
52 | 50 | ||
53 | /* Send led command */ | 51 | /* Send led command */ |
54 | static int il3945_send_led_cmd(struct il_priv *il, | 52 | static int il3945_send_led_cmd(struct il_priv *il, |
diff --git a/drivers/net/wireless/iwlegacy/3945.h b/drivers/net/wireless/iwlegacy/3945.h new file mode 100644 index 000000000000..d65565f7c871 --- /dev/null +++ b/drivers/net/wireless/iwlegacy/3945.h | |||
@@ -0,0 +1,667 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2003 - 2011 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 | #ifndef __il_3945_h__ | ||
28 | #define __il_3945_h__ | ||
29 | |||
30 | #include <linux/pci.h> /* for struct pci_device_id */ | ||
31 | #include <linux/kernel.h> | ||
32 | #include <net/ieee80211_radiotap.h> | ||
33 | |||
34 | /* Hardware specific file defines the PCI IDs table for that hardware module */ | ||
35 | extern const struct pci_device_id il3945_hw_card_ids[]; | ||
36 | |||
37 | #include "iwl-csr.h" | ||
38 | #include "iwl-prph.h" | ||
39 | #include "iwl-fh.h" | ||
40 | #include "iwl-debug.h" | ||
41 | #include "iwl-power.h" | ||
42 | #include "iwl-dev.h" | ||
43 | #include "iwl-led.h" | ||
44 | #include "iwl-eeprom.h" | ||
45 | |||
46 | /* Highest firmware API version supported */ | ||
47 | #define IL3945_UCODE_API_MAX 2 | ||
48 | |||
49 | /* Lowest firmware API version supported */ | ||
50 | #define IL3945_UCODE_API_MIN 1 | ||
51 | |||
52 | #define IL3945_FW_PRE "iwlwifi-3945-" | ||
53 | #define _IL3945_MODULE_FIRMWARE(api) IL3945_FW_PRE #api ".ucode" | ||
54 | #define IL3945_MODULE_FIRMWARE(api) _IL3945_MODULE_FIRMWARE(api) | ||
55 | |||
56 | /* Default noise level to report when noise measurement is not available. | ||
57 | * This may be because we're: | ||
58 | * 1) Not associated (4965, no beacon stats being sent to driver) | ||
59 | * 2) Scanning (noise measurement does not apply to associated channel) | ||
60 | * 3) Receiving CCK (3945 delivers noise info only for OFDM frames) | ||
61 | * Use default noise value of -127 ... this is below the range of measurable | ||
62 | * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user. | ||
63 | * Also, -127 works better than 0 when averaging frames with/without | ||
64 | * noise info (e.g. averaging might be done in app); measured dBm values are | ||
65 | * always negative ... using a negative value as the default keeps all | ||
66 | * averages within an s8's (used in some apps) range of negative values. */ | ||
67 | #define IL_NOISE_MEAS_NOT_AVAILABLE (-127) | ||
68 | |||
69 | /* Module parameters accessible from iwl-*.c */ | ||
70 | extern struct il_mod_params il3945_mod_params; | ||
71 | |||
72 | struct il3945_rate_scale_data { | ||
73 | u64 data; | ||
74 | s32 success_counter; | ||
75 | s32 success_ratio; | ||
76 | s32 counter; | ||
77 | s32 average_tpt; | ||
78 | unsigned long stamp; | ||
79 | }; | ||
80 | |||
81 | struct il3945_rs_sta { | ||
82 | spinlock_t lock; | ||
83 | struct il_priv *il; | ||
84 | s32 *expected_tpt; | ||
85 | unsigned long last_partial_flush; | ||
86 | unsigned long last_flush; | ||
87 | u32 flush_time; | ||
88 | u32 last_tx_packets; | ||
89 | u32 tx_packets; | ||
90 | u8 tgg; | ||
91 | u8 flush_pending; | ||
92 | u8 start_rate; | ||
93 | struct timer_list rate_scale_flush; | ||
94 | struct il3945_rate_scale_data win[RATE_COUNT_3945]; | ||
95 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
96 | struct dentry *rs_sta_dbgfs_stats_table_file; | ||
97 | #endif | ||
98 | |||
99 | /* used to be in sta_info */ | ||
100 | int last_txrate_idx; | ||
101 | }; | ||
102 | |||
103 | |||
104 | /* | ||
105 | * The common struct MUST be first because it is shared between | ||
106 | * 3945 and 4965! | ||
107 | */ | ||
108 | struct il3945_sta_priv { | ||
109 | struct il_station_priv_common common; | ||
110 | struct il3945_rs_sta rs_sta; | ||
111 | }; | ||
112 | |||
113 | enum il3945_antenna { | ||
114 | IL_ANTENNA_DIVERSITY, | ||
115 | IL_ANTENNA_MAIN, | ||
116 | IL_ANTENNA_AUX | ||
117 | }; | ||
118 | |||
119 | /* | ||
120 | * RTS threshold here is total size [2347] minus 4 FCS bytes | ||
121 | * Per spec: | ||
122 | * a value of 0 means RTS on all data/management packets | ||
123 | * a value > max MSDU size means no RTS | ||
124 | * else RTS for data/management frames where MPDU is larger | ||
125 | * than RTS value. | ||
126 | */ | ||
127 | #define DEFAULT_RTS_THRESHOLD 2347U | ||
128 | #define MIN_RTS_THRESHOLD 0U | ||
129 | #define MAX_RTS_THRESHOLD 2347U | ||
130 | #define MAX_MSDU_SIZE 2304U | ||
131 | #define MAX_MPDU_SIZE 2346U | ||
132 | #define DEFAULT_BEACON_INTERVAL 100U | ||
133 | #define DEFAULT_SHORT_RETRY_LIMIT 7U | ||
134 | #define DEFAULT_LONG_RETRY_LIMIT 4U | ||
135 | |||
136 | #define IL_TX_FIFO_AC0 0 | ||
137 | #define IL_TX_FIFO_AC1 1 | ||
138 | #define IL_TX_FIFO_AC2 2 | ||
139 | #define IL_TX_FIFO_AC3 3 | ||
140 | #define IL_TX_FIFO_HCCA_1 5 | ||
141 | #define IL_TX_FIFO_HCCA_2 6 | ||
142 | #define IL_TX_FIFO_NONE 7 | ||
143 | |||
144 | #define IEEE80211_DATA_LEN 2304 | ||
145 | #define IEEE80211_4ADDR_LEN 30 | ||
146 | #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) | ||
147 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | ||
148 | |||
149 | struct il3945_frame { | ||
150 | union { | ||
151 | struct ieee80211_hdr frame; | ||
152 | struct il3945_tx_beacon_cmd beacon; | ||
153 | u8 raw[IEEE80211_FRAME_LEN]; | ||
154 | u8 cmd[360]; | ||
155 | } u; | ||
156 | struct list_head list; | ||
157 | }; | ||
158 | |||
159 | #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) | ||
160 | #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) | ||
161 | #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) | ||
162 | |||
163 | #define SUP_RATE_11A_MAX_NUM_CHANNELS 8 | ||
164 | #define SUP_RATE_11B_MAX_NUM_CHANNELS 4 | ||
165 | #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 | ||
166 | |||
167 | #define IL_SUPPORTED_RATES_IE_LEN 8 | ||
168 | |||
169 | #define SCAN_INTERVAL 100 | ||
170 | |||
171 | #define MAX_TID_COUNT 9 | ||
172 | |||
173 | #define IL_INVALID_RATE 0xFF | ||
174 | #define IL_INVALID_VALUE -1 | ||
175 | |||
176 | #define STA_PS_STATUS_WAKE 0 | ||
177 | #define STA_PS_STATUS_SLEEP 1 | ||
178 | |||
179 | struct il3945_ibss_seq { | ||
180 | u8 mac[ETH_ALEN]; | ||
181 | u16 seq_num; | ||
182 | u16 frag_num; | ||
183 | unsigned long packet_time; | ||
184 | struct list_head list; | ||
185 | }; | ||
186 | |||
187 | #define IL_RX_HDR(x) ((struct il3945_rx_frame_hdr *)(\ | ||
188 | x->u.rx_frame.stats.payload + \ | ||
189 | x->u.rx_frame.stats.phy_count)) | ||
190 | #define IL_RX_END(x) ((struct il3945_rx_frame_end *)(\ | ||
191 | IL_RX_HDR(x)->payload + \ | ||
192 | le16_to_cpu(IL_RX_HDR(x)->len))) | ||
193 | #define IL_RX_STATS(x) (&x->u.rx_frame.stats) | ||
194 | #define IL_RX_DATA(x) (IL_RX_HDR(x)->payload) | ||
195 | |||
196 | |||
197 | /****************************************************************************** | ||
198 | * | ||
199 | * Functions implemented in iwl3945-base.c which are forward declared here | ||
200 | * for use by iwl-*.c | ||
201 | * | ||
202 | *****************************************************************************/ | ||
203 | extern int il3945_calc_db_from_ratio(int sig_ratio); | ||
204 | extern void il3945_rx_replenish(void *data); | ||
205 | extern void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq); | ||
206 | extern unsigned int il3945_fill_beacon_frame(struct il_priv *il, | ||
207 | struct ieee80211_hdr *hdr, int left); | ||
208 | extern int il3945_dump_nic_event_log(struct il_priv *il, bool full_log, | ||
209 | char **buf, bool display); | ||
210 | extern void il3945_dump_nic_error_log(struct il_priv *il); | ||
211 | |||
212 | /****************************************************************************** | ||
213 | * | ||
214 | * Functions implemented in iwl-[34]*.c which are forward declared here | ||
215 | * for use by iwl3945-base.c | ||
216 | * | ||
217 | * NOTE: The implementation of these functions are hardware specific | ||
218 | * which is why they are in the hardware specific files (vs. iwl-base.c) | ||
219 | * | ||
220 | * Naming convention -- | ||
221 | * il3945_ <-- Its part of iwlwifi (should be changed to il3945_) | ||
222 | * il3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) | ||
223 | * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) | ||
224 | * il3945_bg_ <-- Called from work queue context | ||
225 | * il3945_mac_ <-- mac80211 callback | ||
226 | * | ||
227 | ****************************************************************************/ | ||
228 | extern void il3945_hw_rx_handler_setup(struct il_priv *il); | ||
229 | extern void il3945_hw_setup_deferred_work(struct il_priv *il); | ||
230 | extern void il3945_hw_cancel_deferred_work(struct il_priv *il); | ||
231 | extern int il3945_hw_rxq_stop(struct il_priv *il); | ||
232 | extern int il3945_hw_set_hw_params(struct il_priv *il); | ||
233 | extern int il3945_hw_nic_init(struct il_priv *il); | ||
234 | extern int il3945_hw_nic_stop_master(struct il_priv *il); | ||
235 | extern void il3945_hw_txq_ctx_free(struct il_priv *il); | ||
236 | extern void il3945_hw_txq_ctx_stop(struct il_priv *il); | ||
237 | extern int il3945_hw_nic_reset(struct il_priv *il); | ||
238 | extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il, | ||
239 | struct il_tx_queue *txq, | ||
240 | dma_addr_t addr, u16 len, | ||
241 | u8 reset, u8 pad); | ||
242 | extern void il3945_hw_txq_free_tfd(struct il_priv *il, | ||
243 | struct il_tx_queue *txq); | ||
244 | extern int il3945_hw_get_temperature(struct il_priv *il); | ||
245 | extern int il3945_hw_tx_queue_init(struct il_priv *il, | ||
246 | struct il_tx_queue *txq); | ||
247 | extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il, | ||
248 | struct il3945_frame *frame, u8 rate); | ||
249 | void il3945_hw_build_tx_cmd_rate(struct il_priv *il, | ||
250 | struct il_device_cmd *cmd, | ||
251 | struct ieee80211_tx_info *info, | ||
252 | struct ieee80211_hdr *hdr, | ||
253 | int sta_id, int tx_id); | ||
254 | extern int il3945_hw_reg_send_txpower(struct il_priv *il); | ||
255 | extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power); | ||
256 | extern void il3945_hw_rx_stats(struct il_priv *il, | ||
257 | struct il_rx_buf *rxb); | ||
258 | void il3945_reply_stats(struct il_priv *il, | ||
259 | struct il_rx_buf *rxb); | ||
260 | extern void il3945_disable_events(struct il_priv *il); | ||
261 | extern int il4965_get_temperature(const struct il_priv *il); | ||
262 | extern void il3945_post_associate(struct il_priv *il); | ||
263 | extern void il3945_config_ap(struct il_priv *il); | ||
264 | |||
265 | extern int il3945_commit_rxon(struct il_priv *il, | ||
266 | struct il_rxon_context *ctx); | ||
267 | |||
268 | /** | ||
269 | * il3945_hw_find_station - Find station id for a given BSSID | ||
270 | * @bssid: MAC address of station ID to find | ||
271 | * | ||
272 | * NOTE: This should not be hardware specific but the code has | ||
273 | * not yet been merged into a single common layer for managing the | ||
274 | * station tables. | ||
275 | */ | ||
276 | extern u8 il3945_hw_find_station(struct il_priv *il, const u8 *bssid); | ||
277 | |||
278 | extern struct ieee80211_ops il3945_hw_ops; | ||
279 | |||
280 | extern __le32 il3945_get_antenna_flags(const struct il_priv *il); | ||
281 | extern int il3945_init_hw_rate_table(struct il_priv *il); | ||
282 | extern void il3945_reg_txpower_periodic(struct il_priv *il); | ||
283 | extern int il3945_txpower_set_from_eeprom(struct il_priv *il); | ||
284 | |||
285 | extern const struct il_channel_info *il3945_get_channel_info( | ||
286 | const struct il_priv *il, enum ieee80211_band band, u16 channel); | ||
287 | |||
288 | extern int il3945_rs_next_rate(struct il_priv *il, int rate); | ||
289 | |||
290 | /* scanning */ | ||
291 | int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif); | ||
292 | void il3945_post_scan(struct il_priv *il); | ||
293 | |||
294 | /* rates */ | ||
295 | extern const struct il3945_rate_info il3945_rates[RATE_COUNT_3945]; | ||
296 | |||
297 | |||
298 | |||
299 | /* RSSI to dBm */ | ||
300 | #define IL39_RSSI_OFFSET 95 | ||
301 | |||
302 | /* | ||
303 | * EEPROM related constants, enums, and structures. | ||
304 | */ | ||
305 | #define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7) | ||
306 | |||
307 | /* | ||
308 | * Mapping of a Tx power level, at factory calibration temperature, | ||
309 | * to a radio/DSP gain table idx. | ||
310 | * One for each of 5 "sample" power levels in each band. | ||
311 | * v_det is measured at the factory, using the 3945's built-in power amplifier | ||
312 | * (PA) output voltage detector. This same detector is used during Tx of | ||
313 | * long packets in normal operation to provide feedback as to proper output | ||
314 | * level. | ||
315 | * Data copied from EEPROM. | ||
316 | * DO NOT ALTER THIS STRUCTURE!!! | ||
317 | */ | ||
318 | struct il3945_eeprom_txpower_sample { | ||
319 | u8 gain_idx; /* idx into power (gain) setup table ... */ | ||
320 | s8 power; /* ... for this pwr level for this chnl group */ | ||
321 | u16 v_det; /* PA output voltage */ | ||
322 | } __packed; | ||
323 | |||
324 | /* | ||
325 | * Mappings of Tx power levels -> nominal radio/DSP gain table idxes. | ||
326 | * One for each channel group (a.k.a. "band") (1 for BG, 4 for A). | ||
327 | * Tx power setup code interpolates between the 5 "sample" power levels | ||
328 | * to determine the nominal setup for a requested power level. | ||
329 | * Data copied from EEPROM. | ||
330 | * DO NOT ALTER THIS STRUCTURE!!! | ||
331 | */ | ||
332 | struct il3945_eeprom_txpower_group { | ||
333 | struct il3945_eeprom_txpower_sample samples[5]; /* 5 power levels */ | ||
334 | s32 a, b, c, d, e; /* coefficients for voltage->power | ||
335 | * formula (signed) */ | ||
336 | s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on | ||
337 | * frequency (signed) */ | ||
338 | s8 saturation_power; /* highest power possible by h/w in this | ||
339 | * band */ | ||
340 | u8 group_channel; /* "representative" channel # in this band */ | ||
341 | s16 temperature; /* h/w temperature at factory calib this band | ||
342 | * (signed) */ | ||
343 | } __packed; | ||
344 | |||
345 | /* | ||
346 | * Temperature-based Tx-power compensation data, not band-specific. | ||
347 | * These coefficients are use to modify a/b/c/d/e coeffs based on | ||
348 | * difference between current temperature and factory calib temperature. | ||
349 | * Data copied from EEPROM. | ||
350 | */ | ||
351 | struct il3945_eeprom_temperature_corr { | ||
352 | u32 Ta; | ||
353 | u32 Tb; | ||
354 | u32 Tc; | ||
355 | u32 Td; | ||
356 | u32 Te; | ||
357 | } __packed; | ||
358 | |||
359 | /* | ||
360 | * EEPROM map | ||
361 | */ | ||
362 | struct il3945_eeprom { | ||
363 | u8 reserved0[16]; | ||
364 | u16 device_id; /* abs.ofs: 16 */ | ||
365 | u8 reserved1[2]; | ||
366 | u16 pmc; /* abs.ofs: 20 */ | ||
367 | u8 reserved2[20]; | ||
368 | u8 mac_address[6]; /* abs.ofs: 42 */ | ||
369 | u8 reserved3[58]; | ||
370 | u16 board_revision; /* abs.ofs: 106 */ | ||
371 | u8 reserved4[11]; | ||
372 | u8 board_pba_number[9]; /* abs.ofs: 119 */ | ||
373 | u8 reserved5[8]; | ||
374 | u16 version; /* abs.ofs: 136 */ | ||
375 | u8 sku_cap; /* abs.ofs: 138 */ | ||
376 | u8 leds_mode; /* abs.ofs: 139 */ | ||
377 | u16 oem_mode; | ||
378 | u16 wowlan_mode; /* abs.ofs: 142 */ | ||
379 | u16 leds_time_interval; /* abs.ofs: 144 */ | ||
380 | u8 leds_off_time; /* abs.ofs: 146 */ | ||
381 | u8 leds_on_time; /* abs.ofs: 147 */ | ||
382 | u8 almgor_m_version; /* abs.ofs: 148 */ | ||
383 | u8 antenna_switch_type; /* abs.ofs: 149 */ | ||
384 | u8 reserved6[42]; | ||
385 | u8 sku_id[4]; /* abs.ofs: 192 */ | ||
386 | |||
387 | /* | ||
388 | * Per-channel regulatory data. | ||
389 | * | ||
390 | * Each channel that *might* be supported by 3945 has a fixed location | ||
391 | * in EEPROM containing EEPROM_CHANNEL_* usage flags (LSB) and max regulatory | ||
392 | * txpower (MSB). | ||
393 | * | ||
394 | * Entries immediately below are for 20 MHz channel width. | ||
395 | * | ||
396 | * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 | ||
397 | */ | ||
398 | u16 band_1_count; /* abs.ofs: 196 */ | ||
399 | struct il_eeprom_channel band_1_channels[14]; /* abs.ofs: 198 */ | ||
400 | |||
401 | /* | ||
402 | * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196, | ||
403 | * 5.0 GHz channels 7, 8, 11, 12, 16 | ||
404 | * (4915-5080MHz) (none of these is ever supported) | ||
405 | */ | ||
406 | u16 band_2_count; /* abs.ofs: 226 */ | ||
407 | struct il_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ | ||
408 | |||
409 | /* | ||
410 | * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 | ||
411 | * (5170-5320MHz) | ||
412 | */ | ||
413 | u16 band_3_count; /* abs.ofs: 254 */ | ||
414 | struct il_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ | ||
415 | |||
416 | /* | ||
417 | * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 | ||
418 | * (5500-5700MHz) | ||
419 | */ | ||
420 | u16 band_4_count; /* abs.ofs: 280 */ | ||
421 | struct il_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ | ||
422 | |||
423 | /* | ||
424 | * 5.7 GHz channels 145, 149, 153, 157, 161, 165 | ||
425 | * (5725-5825MHz) | ||
426 | */ | ||
427 | u16 band_5_count; /* abs.ofs: 304 */ | ||
428 | struct il_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ | ||
429 | |||
430 | u8 reserved9[194]; | ||
431 | |||
432 | /* | ||
433 | * 3945 Txpower calibration data. | ||
434 | */ | ||
435 | #define IL_NUM_TX_CALIB_GROUPS 5 | ||
436 | struct il3945_eeprom_txpower_group groups[IL_NUM_TX_CALIB_GROUPS]; | ||
437 | /* abs.ofs: 512 */ | ||
438 | struct il3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ | ||
439 | u8 reserved16[172]; /* fill out to full 1024 byte block */ | ||
440 | } __packed; | ||
441 | |||
442 | #define IL3945_EEPROM_IMG_SIZE 1024 | ||
443 | |||
444 | /* End of EEPROM */ | ||
445 | |||
446 | #define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */ | ||
447 | #define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */ | ||
448 | |||
449 | /* 4 DATA + 1 CMD. There are 2 HCCA queues that are not used. */ | ||
450 | #define IL39_NUM_QUEUES 5 | ||
451 | #define IL39_CMD_QUEUE_NUM 4 | ||
452 | |||
453 | #define IL_DEFAULT_TX_RETRY 15 | ||
454 | |||
455 | /*********************************************/ | ||
456 | |||
457 | #define RFD_SIZE 4 | ||
458 | #define NUM_TFD_CHUNKS 4 | ||
459 | |||
460 | #define RX_QUEUE_SIZE 256 | ||
461 | #define RX_QUEUE_MASK 255 | ||
462 | #define RX_QUEUE_SIZE_LOG 8 | ||
463 | |||
464 | #define TFD_CTL_COUNT_SET(n) (n << 24) | ||
465 | #define TFD_CTL_COUNT_GET(ctl) ((ctl >> 24) & 7) | ||
466 | #define TFD_CTL_PAD_SET(n) (n << 28) | ||
467 | #define TFD_CTL_PAD_GET(ctl) (ctl >> 28) | ||
468 | |||
469 | /* Sizes and addresses for instruction and data memory (SRAM) in | ||
470 | * 3945's embedded processor. Driver access is via HBUS_TARG_MEM_* regs. */ | ||
471 | #define IL39_RTC_INST_LOWER_BOUND (0x000000) | ||
472 | #define IL39_RTC_INST_UPPER_BOUND (0x014000) | ||
473 | |||
474 | #define IL39_RTC_DATA_LOWER_BOUND (0x800000) | ||
475 | #define IL39_RTC_DATA_UPPER_BOUND (0x808000) | ||
476 | |||
477 | #define IL39_RTC_INST_SIZE (IL39_RTC_INST_UPPER_BOUND - \ | ||
478 | IL39_RTC_INST_LOWER_BOUND) | ||
479 | #define IL39_RTC_DATA_SIZE (IL39_RTC_DATA_UPPER_BOUND - \ | ||
480 | IL39_RTC_DATA_LOWER_BOUND) | ||
481 | |||
482 | #define IL39_MAX_INST_SIZE IL39_RTC_INST_SIZE | ||
483 | #define IL39_MAX_DATA_SIZE IL39_RTC_DATA_SIZE | ||
484 | |||
485 | /* Size of uCode instruction memory in bootstrap state machine */ | ||
486 | #define IL39_MAX_BSM_SIZE IL39_RTC_INST_SIZE | ||
487 | |||
488 | static inline int il3945_hw_valid_rtc_data_addr(u32 addr) | ||
489 | { | ||
490 | return (addr >= IL39_RTC_DATA_LOWER_BOUND && | ||
491 | addr < IL39_RTC_DATA_UPPER_BOUND); | ||
492 | } | ||
493 | |||
494 | /* Base physical address of il3945_shared is provided to FH_TSSR_CBB_BASE | ||
495 | * and &il3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */ | ||
496 | struct il3945_shared { | ||
497 | __le32 tx_base_ptr[8]; | ||
498 | } __packed; | ||
499 | |||
500 | static inline u8 il3945_hw_get_rate(__le16 rate_n_flags) | ||
501 | { | ||
502 | return le16_to_cpu(rate_n_flags) & 0xFF; | ||
503 | } | ||
504 | |||
505 | static inline u16 il3945_hw_get_rate_n_flags(__le16 rate_n_flags) | ||
506 | { | ||
507 | return le16_to_cpu(rate_n_flags); | ||
508 | } | ||
509 | |||
510 | static inline __le16 il3945_hw_set_rate_n_flags(u8 rate, u16 flags) | ||
511 | { | ||
512 | return cpu_to_le16((u16)rate|flags); | ||
513 | } | ||
514 | |||
515 | /************************************/ | ||
516 | /* iwl3945 Flow Handler Definitions */ | ||
517 | /************************************/ | ||
518 | |||
519 | /** | ||
520 | * This I/O area is directly read/writable by driver (e.g. Linux uses writel()) | ||
521 | * Addresses are offsets from device's PCI hardware base address. | ||
522 | */ | ||
523 | #define FH39_MEM_LOWER_BOUND (0x0800) | ||
524 | #define FH39_MEM_UPPER_BOUND (0x1000) | ||
525 | |||
526 | #define FH39_CBCC_TBL (FH39_MEM_LOWER_BOUND + 0x140) | ||
527 | #define FH39_TFDB_TBL (FH39_MEM_LOWER_BOUND + 0x180) | ||
528 | #define FH39_RCSR_TBL (FH39_MEM_LOWER_BOUND + 0x400) | ||
529 | #define FH39_RSSR_TBL (FH39_MEM_LOWER_BOUND + 0x4c0) | ||
530 | #define FH39_TCSR_TBL (FH39_MEM_LOWER_BOUND + 0x500) | ||
531 | #define FH39_TSSR_TBL (FH39_MEM_LOWER_BOUND + 0x680) | ||
532 | |||
533 | /* TFDB (Transmit Frame Buffer Descriptor) */ | ||
534 | #define FH39_TFDB(_ch, buf) (FH39_TFDB_TBL + \ | ||
535 | ((_ch) * 2 + (buf)) * 0x28) | ||
536 | #define FH39_TFDB_CHNL_BUF_CTRL_REG(_ch) (FH39_TFDB_TBL + 0x50 * (_ch)) | ||
537 | |||
538 | /* CBCC channel is [0,2] */ | ||
539 | #define FH39_CBCC(_ch) (FH39_CBCC_TBL + (_ch) * 0x8) | ||
540 | #define FH39_CBCC_CTRL(_ch) (FH39_CBCC(_ch) + 0x00) | ||
541 | #define FH39_CBCC_BASE(_ch) (FH39_CBCC(_ch) + 0x04) | ||
542 | |||
543 | /* RCSR channel is [0,2] */ | ||
544 | #define FH39_RCSR(_ch) (FH39_RCSR_TBL + (_ch) * 0x40) | ||
545 | #define FH39_RCSR_CONFIG(_ch) (FH39_RCSR(_ch) + 0x00) | ||
546 | #define FH39_RCSR_RBD_BASE(_ch) (FH39_RCSR(_ch) + 0x04) | ||
547 | #define FH39_RCSR_WPTR(_ch) (FH39_RCSR(_ch) + 0x20) | ||
548 | #define FH39_RCSR_RPTR_ADDR(_ch) (FH39_RCSR(_ch) + 0x24) | ||
549 | |||
550 | #define FH39_RSCSR_CHNL0_WPTR (FH39_RCSR_WPTR(0)) | ||
551 | |||
552 | /* RSSR */ | ||
553 | #define FH39_RSSR_CTRL (FH39_RSSR_TBL + 0x000) | ||
554 | #define FH39_RSSR_STATUS (FH39_RSSR_TBL + 0x004) | ||
555 | |||
556 | /* TCSR */ | ||
557 | #define FH39_TCSR(_ch) (FH39_TCSR_TBL + (_ch) * 0x20) | ||
558 | #define FH39_TCSR_CONFIG(_ch) (FH39_TCSR(_ch) + 0x00) | ||
559 | #define FH39_TCSR_CREDIT(_ch) (FH39_TCSR(_ch) + 0x04) | ||
560 | #define FH39_TCSR_BUFF_STTS(_ch) (FH39_TCSR(_ch) + 0x08) | ||
561 | |||
562 | /* TSSR */ | ||
563 | #define FH39_TSSR_CBB_BASE (FH39_TSSR_TBL + 0x000) | ||
564 | #define FH39_TSSR_MSG_CONFIG (FH39_TSSR_TBL + 0x008) | ||
565 | #define FH39_TSSR_TX_STATUS (FH39_TSSR_TBL + 0x010) | ||
566 | |||
567 | |||
568 | /* DBM */ | ||
569 | |||
570 | #define FH39_SRVC_CHNL (6) | ||
571 | |||
572 | #define FH39_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20) | ||
573 | #define FH39_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4) | ||
574 | |||
575 | #define FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000) | ||
576 | |||
577 | #define FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000) | ||
578 | |||
579 | #define FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000) | ||
580 | |||
581 | #define FH39_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000) | ||
582 | |||
583 | #define FH39_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000) | ||
584 | |||
585 | #define FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000) | ||
586 | |||
587 | #define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) | ||
588 | #define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001) | ||
589 | |||
590 | #define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) | ||
591 | #define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) | ||
592 | |||
593 | #define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) | ||
594 | |||
595 | #define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) | ||
596 | |||
597 | #define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) | ||
598 | #define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) | ||
599 | |||
600 | #define FH39_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000) | ||
601 | |||
602 | #define FH39_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001) | ||
603 | |||
604 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000) | ||
605 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000) | ||
606 | |||
607 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400) | ||
608 | |||
609 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100) | ||
610 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080) | ||
611 | |||
612 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020) | ||
613 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005) | ||
614 | |||
615 | #define FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch) (BIT(_ch) << 24) | ||
616 | #define FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch) (BIT(_ch) << 16) | ||
617 | |||
618 | #define FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_ch) \ | ||
619 | (FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch) | \ | ||
620 | FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch)) | ||
621 | |||
622 | #define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) | ||
623 | |||
624 | struct il3945_tfd_tb { | ||
625 | __le32 addr; | ||
626 | __le32 len; | ||
627 | } __packed; | ||
628 | |||
629 | struct il3945_tfd { | ||
630 | __le32 control_flags; | ||
631 | struct il3945_tfd_tb tbs[4]; | ||
632 | u8 __pad[28]; | ||
633 | } __packed; | ||
634 | |||
635 | #ifdef CONFIG_IWLEGACY_DEBUGFS | ||
636 | ssize_t il3945_ucode_rx_stats_read(struct file *file, char __user *user_buf, | ||
637 | size_t count, loff_t *ppos); | ||
638 | ssize_t il3945_ucode_tx_stats_read(struct file *file, char __user *user_buf, | ||
639 | size_t count, loff_t *ppos); | ||
640 | ssize_t il3945_ucode_general_stats_read(struct file *file, | ||
641 | char __user *user_buf, size_t count, | ||
642 | loff_t *ppos); | ||
643 | #else | ||
644 | static ssize_t il3945_ucode_rx_stats_read(struct file *file, | ||
645 | char __user *user_buf, size_t count, | ||
646 | loff_t *ppos) | ||
647 | { | ||
648 | return 0; | ||
649 | } | ||
650 | static ssize_t il3945_ucode_tx_stats_read(struct file *file, | ||
651 | char __user *user_buf, size_t count, | ||
652 | loff_t *ppos) | ||
653 | { | ||
654 | return 0; | ||
655 | } | ||
656 | static ssize_t il3945_ucode_general_stats_read(struct file *file, | ||
657 | char __user *user_buf, | ||
658 | size_t count, loff_t *ppos) | ||
659 | { | ||
660 | return 0; | ||
661 | } | ||
662 | #endif | ||
663 | |||
664 | /* Requires full declaration of il_priv before including */ | ||
665 | #include "iwl-io.h" | ||
666 | |||
667 | #endif | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h deleted file mode 100644 index 9d1a4a041b18..000000000000 --- a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.h +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * GPL LICENSE SUMMARY | ||
4 | * | ||
5 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of version 2 of the GNU General Public License as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
19 | * USA | ||
20 | * | ||
21 | * The full GNU General Public License is included in this distribution | ||
22 | * in the file called LICENSE.GPL. | ||
23 | * | ||
24 | * Contact Information: | ||
25 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
27 | *****************************************************************************/ | ||
28 | |||
29 | #include "iwl-dev.h" | ||
30 | #include "iwl-core.h" | ||
31 | #include "iwl-debug.h" | ||
32 | |||
33 | #ifdef CONFIG_IWLEGACY_DEBUGFS | ||
34 | ssize_t il3945_ucode_rx_stats_read(struct file *file, char __user *user_buf, | ||
35 | size_t count, loff_t *ppos); | ||
36 | ssize_t il3945_ucode_tx_stats_read(struct file *file, char __user *user_buf, | ||
37 | size_t count, loff_t *ppos); | ||
38 | ssize_t il3945_ucode_general_stats_read(struct file *file, | ||
39 | char __user *user_buf, size_t count, | ||
40 | loff_t *ppos); | ||
41 | #else | ||
42 | static ssize_t il3945_ucode_rx_stats_read(struct file *file, | ||
43 | char __user *user_buf, size_t count, | ||
44 | loff_t *ppos) | ||
45 | { | ||
46 | return 0; | ||
47 | } | ||
48 | static ssize_t il3945_ucode_tx_stats_read(struct file *file, | ||
49 | char __user *user_buf, size_t count, | ||
50 | loff_t *ppos) | ||
51 | { | ||
52 | return 0; | ||
53 | } | ||
54 | static ssize_t il3945_ucode_general_stats_read(struct file *file, | ||
55 | char __user *user_buf, | ||
56 | size_t count, loff_t *ppos) | ||
57 | { | ||
58 | return 0; | ||
59 | } | ||
60 | #endif | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-fh.h b/drivers/net/wireless/iwlegacy/iwl-3945-fh.h deleted file mode 100644 index aa44a9036201..000000000000 --- a/drivers/net/wireless/iwlegacy/iwl-3945-fh.h +++ /dev/null | |||
@@ -1,187 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
4 | * redistributing this file, you may do so under either license. | ||
5 | * | ||
6 | * GPL LICENSE SUMMARY | ||
7 | * | ||
8 | * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of version 2 of the GNU General Public License as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
22 | * USA | ||
23 | * | ||
24 | * The full GNU General Public License is included in this distribution | ||
25 | * in the file called LICENSE.GPL. | ||
26 | * | ||
27 | * Contact Information: | ||
28 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
30 | * | ||
31 | * BSD LICENSE | ||
32 | * | ||
33 | * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. | ||
34 | * All rights reserved. | ||
35 | * | ||
36 | * Redistribution and use in source and binary forms, with or without | ||
37 | * modification, are permitted provided that the following conditions | ||
38 | * are met: | ||
39 | * | ||
40 | * * Redistributions of source code must retain the above copyright | ||
41 | * notice, this list of conditions and the following disclaimer. | ||
42 | * * Redistributions in binary form must reproduce the above copyright | ||
43 | * notice, this list of conditions and the following disclaimer in | ||
44 | * the documentation and/or other materials provided with the | ||
45 | * distribution. | ||
46 | * * Neither the name Intel Corporation nor the names of its | ||
47 | * contributors may be used to endorse or promote products derived | ||
48 | * from this software without specific prior written permission. | ||
49 | * | ||
50 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
51 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
52 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
53 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
54 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
59 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
61 | * | ||
62 | *****************************************************************************/ | ||
63 | #ifndef __il_3945_fh_h__ | ||
64 | #define __il_3945_fh_h__ | ||
65 | |||
66 | /************************************/ | ||
67 | /* iwl3945 Flow Handler Definitions */ | ||
68 | /************************************/ | ||
69 | |||
70 | /** | ||
71 | * This I/O area is directly read/writable by driver (e.g. Linux uses writel()) | ||
72 | * Addresses are offsets from device's PCI hardware base address. | ||
73 | */ | ||
74 | #define FH39_MEM_LOWER_BOUND (0x0800) | ||
75 | #define FH39_MEM_UPPER_BOUND (0x1000) | ||
76 | |||
77 | #define FH39_CBCC_TBL (FH39_MEM_LOWER_BOUND + 0x140) | ||
78 | #define FH39_TFDB_TBL (FH39_MEM_LOWER_BOUND + 0x180) | ||
79 | #define FH39_RCSR_TBL (FH39_MEM_LOWER_BOUND + 0x400) | ||
80 | #define FH39_RSSR_TBL (FH39_MEM_LOWER_BOUND + 0x4c0) | ||
81 | #define FH39_TCSR_TBL (FH39_MEM_LOWER_BOUND + 0x500) | ||
82 | #define FH39_TSSR_TBL (FH39_MEM_LOWER_BOUND + 0x680) | ||
83 | |||
84 | /* TFDB (Transmit Frame Buffer Descriptor) */ | ||
85 | #define FH39_TFDB(_ch, buf) (FH39_TFDB_TBL + \ | ||
86 | ((_ch) * 2 + (buf)) * 0x28) | ||
87 | #define FH39_TFDB_CHNL_BUF_CTRL_REG(_ch) (FH39_TFDB_TBL + 0x50 * (_ch)) | ||
88 | |||
89 | /* CBCC channel is [0,2] */ | ||
90 | #define FH39_CBCC(_ch) (FH39_CBCC_TBL + (_ch) * 0x8) | ||
91 | #define FH39_CBCC_CTRL(_ch) (FH39_CBCC(_ch) + 0x00) | ||
92 | #define FH39_CBCC_BASE(_ch) (FH39_CBCC(_ch) + 0x04) | ||
93 | |||
94 | /* RCSR channel is [0,2] */ | ||
95 | #define FH39_RCSR(_ch) (FH39_RCSR_TBL + (_ch) * 0x40) | ||
96 | #define FH39_RCSR_CONFIG(_ch) (FH39_RCSR(_ch) + 0x00) | ||
97 | #define FH39_RCSR_RBD_BASE(_ch) (FH39_RCSR(_ch) + 0x04) | ||
98 | #define FH39_RCSR_WPTR(_ch) (FH39_RCSR(_ch) + 0x20) | ||
99 | #define FH39_RCSR_RPTR_ADDR(_ch) (FH39_RCSR(_ch) + 0x24) | ||
100 | |||
101 | #define FH39_RSCSR_CHNL0_WPTR (FH39_RCSR_WPTR(0)) | ||
102 | |||
103 | /* RSSR */ | ||
104 | #define FH39_RSSR_CTRL (FH39_RSSR_TBL + 0x000) | ||
105 | #define FH39_RSSR_STATUS (FH39_RSSR_TBL + 0x004) | ||
106 | |||
107 | /* TCSR */ | ||
108 | #define FH39_TCSR(_ch) (FH39_TCSR_TBL + (_ch) * 0x20) | ||
109 | #define FH39_TCSR_CONFIG(_ch) (FH39_TCSR(_ch) + 0x00) | ||
110 | #define FH39_TCSR_CREDIT(_ch) (FH39_TCSR(_ch) + 0x04) | ||
111 | #define FH39_TCSR_BUFF_STTS(_ch) (FH39_TCSR(_ch) + 0x08) | ||
112 | |||
113 | /* TSSR */ | ||
114 | #define FH39_TSSR_CBB_BASE (FH39_TSSR_TBL + 0x000) | ||
115 | #define FH39_TSSR_MSG_CONFIG (FH39_TSSR_TBL + 0x008) | ||
116 | #define FH39_TSSR_TX_STATUS (FH39_TSSR_TBL + 0x010) | ||
117 | |||
118 | |||
119 | /* DBM */ | ||
120 | |||
121 | #define FH39_SRVC_CHNL (6) | ||
122 | |||
123 | #define FH39_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20) | ||
124 | #define FH39_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4) | ||
125 | |||
126 | #define FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000) | ||
127 | |||
128 | #define FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000) | ||
129 | |||
130 | #define FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000) | ||
131 | |||
132 | #define FH39_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000) | ||
133 | |||
134 | #define FH39_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000) | ||
135 | |||
136 | #define FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000) | ||
137 | |||
138 | #define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) | ||
139 | #define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001) | ||
140 | |||
141 | #define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) | ||
142 | #define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) | ||
143 | |||
144 | #define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) | ||
145 | |||
146 | #define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) | ||
147 | |||
148 | #define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) | ||
149 | #define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) | ||
150 | |||
151 | #define FH39_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000) | ||
152 | |||
153 | #define FH39_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001) | ||
154 | |||
155 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000) | ||
156 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000) | ||
157 | |||
158 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400) | ||
159 | |||
160 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100) | ||
161 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080) | ||
162 | |||
163 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020) | ||
164 | #define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005) | ||
165 | |||
166 | #define FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch) (BIT(_ch) << 24) | ||
167 | #define FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch) (BIT(_ch) << 16) | ||
168 | |||
169 | #define FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_ch) \ | ||
170 | (FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch) | \ | ||
171 | FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch)) | ||
172 | |||
173 | #define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) | ||
174 | |||
175 | struct il3945_tfd_tb { | ||
176 | __le32 addr; | ||
177 | __le32 len; | ||
178 | } __packed; | ||
179 | |||
180 | struct il3945_tfd { | ||
181 | __le32 control_flags; | ||
182 | struct il3945_tfd_tb tbs[4]; | ||
183 | u8 __pad[28]; | ||
184 | } __packed; | ||
185 | |||
186 | |||
187 | #endif /* __il_3945_fh_h__ */ | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h deleted file mode 100644 index 53e5fb4373d9..000000000000 --- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h +++ /dev/null | |||
@@ -1,291 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
4 | * redistributing this file, you may do so under either license. | ||
5 | * | ||
6 | * GPL LICENSE SUMMARY | ||
7 | * | ||
8 | * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of version 2 of the GNU General Public License as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
22 | * USA | ||
23 | * | ||
24 | * The full GNU General Public License is included in this distribution | ||
25 | * in the file called LICENSE.GPL. | ||
26 | * | ||
27 | * Contact Information: | ||
28 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
30 | * | ||
31 | * BSD LICENSE | ||
32 | * | ||
33 | * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. | ||
34 | * All rights reserved. | ||
35 | * | ||
36 | * Redistribution and use in source and binary forms, with or without | ||
37 | * modification, are permitted provided that the following conditions | ||
38 | * are met: | ||
39 | * | ||
40 | * * Redistributions of source code must retain the above copyright | ||
41 | * notice, this list of conditions and the following disclaimer. | ||
42 | * * Redistributions in binary form must reproduce the above copyright | ||
43 | * notice, this list of conditions and the following disclaimer in | ||
44 | * the documentation and/or other materials provided with the | ||
45 | * distribution. | ||
46 | * * Neither the name Intel Corporation nor the names of its | ||
47 | * contributors may be used to endorse or promote products derived | ||
48 | * from this software without specific prior written permission. | ||
49 | * | ||
50 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
51 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
52 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
53 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
54 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
59 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
61 | * | ||
62 | *****************************************************************************/ | ||
63 | /* | ||
64 | * Please use this file (iwl-3945-hw.h) only for hardware-related definitions. | ||
65 | * Please use iwl-commands.h for uCode API definitions. | ||
66 | * Please use iwl-3945.h for driver implementation definitions. | ||
67 | */ | ||
68 | |||
69 | #ifndef __il_3945_hw__ | ||
70 | #define __il_3945_hw__ | ||
71 | |||
72 | #include "iwl-eeprom.h" | ||
73 | |||
74 | /* RSSI to dBm */ | ||
75 | #define IL39_RSSI_OFFSET 95 | ||
76 | |||
77 | /* | ||
78 | * EEPROM related constants, enums, and structures. | ||
79 | */ | ||
80 | #define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7) | ||
81 | |||
82 | /* | ||
83 | * Mapping of a Tx power level, at factory calibration temperature, | ||
84 | * to a radio/DSP gain table idx. | ||
85 | * One for each of 5 "sample" power levels in each band. | ||
86 | * v_det is measured at the factory, using the 3945's built-in power amplifier | ||
87 | * (PA) output voltage detector. This same detector is used during Tx of | ||
88 | * long packets in normal operation to provide feedback as to proper output | ||
89 | * level. | ||
90 | * Data copied from EEPROM. | ||
91 | * DO NOT ALTER THIS STRUCTURE!!! | ||
92 | */ | ||
93 | struct il3945_eeprom_txpower_sample { | ||
94 | u8 gain_idx; /* idx into power (gain) setup table ... */ | ||
95 | s8 power; /* ... for this pwr level for this chnl group */ | ||
96 | u16 v_det; /* PA output voltage */ | ||
97 | } __packed; | ||
98 | |||
99 | /* | ||
100 | * Mappings of Tx power levels -> nominal radio/DSP gain table idxes. | ||
101 | * One for each channel group (a.k.a. "band") (1 for BG, 4 for A). | ||
102 | * Tx power setup code interpolates between the 5 "sample" power levels | ||
103 | * to determine the nominal setup for a requested power level. | ||
104 | * Data copied from EEPROM. | ||
105 | * DO NOT ALTER THIS STRUCTURE!!! | ||
106 | */ | ||
107 | struct il3945_eeprom_txpower_group { | ||
108 | struct il3945_eeprom_txpower_sample samples[5]; /* 5 power levels */ | ||
109 | s32 a, b, c, d, e; /* coefficients for voltage->power | ||
110 | * formula (signed) */ | ||
111 | s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on | ||
112 | * frequency (signed) */ | ||
113 | s8 saturation_power; /* highest power possible by h/w in this | ||
114 | * band */ | ||
115 | u8 group_channel; /* "representative" channel # in this band */ | ||
116 | s16 temperature; /* h/w temperature at factory calib this band | ||
117 | * (signed) */ | ||
118 | } __packed; | ||
119 | |||
120 | /* | ||
121 | * Temperature-based Tx-power compensation data, not band-specific. | ||
122 | * These coefficients are use to modify a/b/c/d/e coeffs based on | ||
123 | * difference between current temperature and factory calib temperature. | ||
124 | * Data copied from EEPROM. | ||
125 | */ | ||
126 | struct il3945_eeprom_temperature_corr { | ||
127 | u32 Ta; | ||
128 | u32 Tb; | ||
129 | u32 Tc; | ||
130 | u32 Td; | ||
131 | u32 Te; | ||
132 | } __packed; | ||
133 | |||
134 | /* | ||
135 | * EEPROM map | ||
136 | */ | ||
137 | struct il3945_eeprom { | ||
138 | u8 reserved0[16]; | ||
139 | u16 device_id; /* abs.ofs: 16 */ | ||
140 | u8 reserved1[2]; | ||
141 | u16 pmc; /* abs.ofs: 20 */ | ||
142 | u8 reserved2[20]; | ||
143 | u8 mac_address[6]; /* abs.ofs: 42 */ | ||
144 | u8 reserved3[58]; | ||
145 | u16 board_revision; /* abs.ofs: 106 */ | ||
146 | u8 reserved4[11]; | ||
147 | u8 board_pba_number[9]; /* abs.ofs: 119 */ | ||
148 | u8 reserved5[8]; | ||
149 | u16 version; /* abs.ofs: 136 */ | ||
150 | u8 sku_cap; /* abs.ofs: 138 */ | ||
151 | u8 leds_mode; /* abs.ofs: 139 */ | ||
152 | u16 oem_mode; | ||
153 | u16 wowlan_mode; /* abs.ofs: 142 */ | ||
154 | u16 leds_time_interval; /* abs.ofs: 144 */ | ||
155 | u8 leds_off_time; /* abs.ofs: 146 */ | ||
156 | u8 leds_on_time; /* abs.ofs: 147 */ | ||
157 | u8 almgor_m_version; /* abs.ofs: 148 */ | ||
158 | u8 antenna_switch_type; /* abs.ofs: 149 */ | ||
159 | u8 reserved6[42]; | ||
160 | u8 sku_id[4]; /* abs.ofs: 192 */ | ||
161 | |||
162 | /* | ||
163 | * Per-channel regulatory data. | ||
164 | * | ||
165 | * Each channel that *might* be supported by 3945 has a fixed location | ||
166 | * in EEPROM containing EEPROM_CHANNEL_* usage flags (LSB) and max regulatory | ||
167 | * txpower (MSB). | ||
168 | * | ||
169 | * Entries immediately below are for 20 MHz channel width. | ||
170 | * | ||
171 | * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 | ||
172 | */ | ||
173 | u16 band_1_count; /* abs.ofs: 196 */ | ||
174 | struct il_eeprom_channel band_1_channels[14]; /* abs.ofs: 198 */ | ||
175 | |||
176 | /* | ||
177 | * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196, | ||
178 | * 5.0 GHz channels 7, 8, 11, 12, 16 | ||
179 | * (4915-5080MHz) (none of these is ever supported) | ||
180 | */ | ||
181 | u16 band_2_count; /* abs.ofs: 226 */ | ||
182 | struct il_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ | ||
183 | |||
184 | /* | ||
185 | * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 | ||
186 | * (5170-5320MHz) | ||
187 | */ | ||
188 | u16 band_3_count; /* abs.ofs: 254 */ | ||
189 | struct il_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ | ||
190 | |||
191 | /* | ||
192 | * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 | ||
193 | * (5500-5700MHz) | ||
194 | */ | ||
195 | u16 band_4_count; /* abs.ofs: 280 */ | ||
196 | struct il_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ | ||
197 | |||
198 | /* | ||
199 | * 5.7 GHz channels 145, 149, 153, 157, 161, 165 | ||
200 | * (5725-5825MHz) | ||
201 | */ | ||
202 | u16 band_5_count; /* abs.ofs: 304 */ | ||
203 | struct il_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ | ||
204 | |||
205 | u8 reserved9[194]; | ||
206 | |||
207 | /* | ||
208 | * 3945 Txpower calibration data. | ||
209 | */ | ||
210 | #define IL_NUM_TX_CALIB_GROUPS 5 | ||
211 | struct il3945_eeprom_txpower_group groups[IL_NUM_TX_CALIB_GROUPS]; | ||
212 | /* abs.ofs: 512 */ | ||
213 | struct il3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ | ||
214 | u8 reserved16[172]; /* fill out to full 1024 byte block */ | ||
215 | } __packed; | ||
216 | |||
217 | #define IL3945_EEPROM_IMG_SIZE 1024 | ||
218 | |||
219 | /* End of EEPROM */ | ||
220 | |||
221 | #define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */ | ||
222 | #define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */ | ||
223 | |||
224 | /* 4 DATA + 1 CMD. There are 2 HCCA queues that are not used. */ | ||
225 | #define IL39_NUM_QUEUES 5 | ||
226 | #define IL39_CMD_QUEUE_NUM 4 | ||
227 | |||
228 | #define IL_DEFAULT_TX_RETRY 15 | ||
229 | |||
230 | /*********************************************/ | ||
231 | |||
232 | #define RFD_SIZE 4 | ||
233 | #define NUM_TFD_CHUNKS 4 | ||
234 | |||
235 | #define RX_QUEUE_SIZE 256 | ||
236 | #define RX_QUEUE_MASK 255 | ||
237 | #define RX_QUEUE_SIZE_LOG 8 | ||
238 | |||
239 | #define U32_PAD(n) ((4-(n))&0x3) | ||
240 | |||
241 | #define TFD_CTL_COUNT_SET(n) (n << 24) | ||
242 | #define TFD_CTL_COUNT_GET(ctl) ((ctl >> 24) & 7) | ||
243 | #define TFD_CTL_PAD_SET(n) (n << 28) | ||
244 | #define TFD_CTL_PAD_GET(ctl) (ctl >> 28) | ||
245 | |||
246 | /* Sizes and addresses for instruction and data memory (SRAM) in | ||
247 | * 3945's embedded processor. Driver access is via HBUS_TARG_MEM_* regs. */ | ||
248 | #define IL39_RTC_INST_LOWER_BOUND (0x000000) | ||
249 | #define IL39_RTC_INST_UPPER_BOUND (0x014000) | ||
250 | |||
251 | #define IL39_RTC_DATA_LOWER_BOUND (0x800000) | ||
252 | #define IL39_RTC_DATA_UPPER_BOUND (0x808000) | ||
253 | |||
254 | #define IL39_RTC_INST_SIZE (IL39_RTC_INST_UPPER_BOUND - \ | ||
255 | IL39_RTC_INST_LOWER_BOUND) | ||
256 | #define IL39_RTC_DATA_SIZE (IL39_RTC_DATA_UPPER_BOUND - \ | ||
257 | IL39_RTC_DATA_LOWER_BOUND) | ||
258 | |||
259 | #define IL39_MAX_INST_SIZE IL39_RTC_INST_SIZE | ||
260 | #define IL39_MAX_DATA_SIZE IL39_RTC_DATA_SIZE | ||
261 | |||
262 | /* Size of uCode instruction memory in bootstrap state machine */ | ||
263 | #define IL39_MAX_BSM_SIZE IL39_RTC_INST_SIZE | ||
264 | |||
265 | static inline int il3945_hw_valid_rtc_data_addr(u32 addr) | ||
266 | { | ||
267 | return (addr >= IL39_RTC_DATA_LOWER_BOUND && | ||
268 | addr < IL39_RTC_DATA_UPPER_BOUND); | ||
269 | } | ||
270 | |||
271 | /* Base physical address of il3945_shared is provided to FH_TSSR_CBB_BASE | ||
272 | * and &il3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */ | ||
273 | struct il3945_shared { | ||
274 | __le32 tx_base_ptr[8]; | ||
275 | } __packed; | ||
276 | |||
277 | static inline u8 il3945_hw_get_rate(__le16 rate_n_flags) | ||
278 | { | ||
279 | return le16_to_cpu(rate_n_flags) & 0xFF; | ||
280 | } | ||
281 | |||
282 | static inline u16 il3945_hw_get_rate_n_flags(__le16 rate_n_flags) | ||
283 | { | ||
284 | return le16_to_cpu(rate_n_flags); | ||
285 | } | ||
286 | |||
287 | static inline __le16 il3945_hw_set_rate_n_flags(u8 rate, u16 flags) | ||
288 | { | ||
289 | return cpu_to_le16((u16)rate|flags); | ||
290 | } | ||
291 | #endif | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.h b/drivers/net/wireless/iwlegacy/iwl-3945.h deleted file mode 100644 index 80fcbf8bbc5b..000000000000 --- a/drivers/net/wireless/iwlegacy/iwl-3945.h +++ /dev/null | |||
@@ -1,308 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2003 - 2011 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 | * Please use this file (iwl-3945.h) for driver implementation definitions. | ||
28 | * Please use iwl-3945-commands.h for uCode API definitions. | ||
29 | * Please use iwl-3945-hw.h for hardware-related definitions. | ||
30 | */ | ||
31 | |||
32 | #ifndef __il_3945_h__ | ||
33 | #define __il_3945_h__ | ||
34 | |||
35 | #include <linux/pci.h> /* for struct pci_device_id */ | ||
36 | #include <linux/kernel.h> | ||
37 | #include <net/ieee80211_radiotap.h> | ||
38 | |||
39 | /* Hardware specific file defines the PCI IDs table for that hardware module */ | ||
40 | extern const struct pci_device_id il3945_hw_card_ids[]; | ||
41 | |||
42 | #include "iwl-csr.h" | ||
43 | #include "iwl-prph.h" | ||
44 | #include "iwl-fh.h" | ||
45 | #include "iwl-3945-hw.h" | ||
46 | #include "iwl-debug.h" | ||
47 | #include "iwl-power.h" | ||
48 | #include "iwl-dev.h" | ||
49 | #include "iwl-led.h" | ||
50 | |||
51 | /* Highest firmware API version supported */ | ||
52 | #define IL3945_UCODE_API_MAX 2 | ||
53 | |||
54 | /* Lowest firmware API version supported */ | ||
55 | #define IL3945_UCODE_API_MIN 1 | ||
56 | |||
57 | #define IL3945_FW_PRE "iwlwifi-3945-" | ||
58 | #define _IL3945_MODULE_FIRMWARE(api) IL3945_FW_PRE #api ".ucode" | ||
59 | #define IL3945_MODULE_FIRMWARE(api) _IL3945_MODULE_FIRMWARE(api) | ||
60 | |||
61 | /* Default noise level to report when noise measurement is not available. | ||
62 | * This may be because we're: | ||
63 | * 1) Not associated (4965, no beacon stats being sent to driver) | ||
64 | * 2) Scanning (noise measurement does not apply to associated channel) | ||
65 | * 3) Receiving CCK (3945 delivers noise info only for OFDM frames) | ||
66 | * Use default noise value of -127 ... this is below the range of measurable | ||
67 | * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user. | ||
68 | * Also, -127 works better than 0 when averaging frames with/without | ||
69 | * noise info (e.g. averaging might be done in app); measured dBm values are | ||
70 | * always negative ... using a negative value as the default keeps all | ||
71 | * averages within an s8's (used in some apps) range of negative values. */ | ||
72 | #define IL_NOISE_MEAS_NOT_AVAILABLE (-127) | ||
73 | |||
74 | /* Module parameters accessible from iwl-*.c */ | ||
75 | extern struct il_mod_params il3945_mod_params; | ||
76 | |||
77 | struct il3945_rate_scale_data { | ||
78 | u64 data; | ||
79 | s32 success_counter; | ||
80 | s32 success_ratio; | ||
81 | s32 counter; | ||
82 | s32 average_tpt; | ||
83 | unsigned long stamp; | ||
84 | }; | ||
85 | |||
86 | struct il3945_rs_sta { | ||
87 | spinlock_t lock; | ||
88 | struct il_priv *il; | ||
89 | s32 *expected_tpt; | ||
90 | unsigned long last_partial_flush; | ||
91 | unsigned long last_flush; | ||
92 | u32 flush_time; | ||
93 | u32 last_tx_packets; | ||
94 | u32 tx_packets; | ||
95 | u8 tgg; | ||
96 | u8 flush_pending; | ||
97 | u8 start_rate; | ||
98 | struct timer_list rate_scale_flush; | ||
99 | struct il3945_rate_scale_data win[RATE_COUNT_3945]; | ||
100 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
101 | struct dentry *rs_sta_dbgfs_stats_table_file; | ||
102 | #endif | ||
103 | |||
104 | /* used to be in sta_info */ | ||
105 | int last_txrate_idx; | ||
106 | }; | ||
107 | |||
108 | |||
109 | /* | ||
110 | * The common struct MUST be first because it is shared between | ||
111 | * 3945 and 4965! | ||
112 | */ | ||
113 | struct il3945_sta_priv { | ||
114 | struct il_station_priv_common common; | ||
115 | struct il3945_rs_sta rs_sta; | ||
116 | }; | ||
117 | |||
118 | enum il3945_antenna { | ||
119 | IL_ANTENNA_DIVERSITY, | ||
120 | IL_ANTENNA_MAIN, | ||
121 | IL_ANTENNA_AUX | ||
122 | }; | ||
123 | |||
124 | /* | ||
125 | * RTS threshold here is total size [2347] minus 4 FCS bytes | ||
126 | * Per spec: | ||
127 | * a value of 0 means RTS on all data/management packets | ||
128 | * a value > max MSDU size means no RTS | ||
129 | * else RTS for data/management frames where MPDU is larger | ||
130 | * than RTS value. | ||
131 | */ | ||
132 | #define DEFAULT_RTS_THRESHOLD 2347U | ||
133 | #define MIN_RTS_THRESHOLD 0U | ||
134 | #define MAX_RTS_THRESHOLD 2347U | ||
135 | #define MAX_MSDU_SIZE 2304U | ||
136 | #define MAX_MPDU_SIZE 2346U | ||
137 | #define DEFAULT_BEACON_INTERVAL 100U | ||
138 | #define DEFAULT_SHORT_RETRY_LIMIT 7U | ||
139 | #define DEFAULT_LONG_RETRY_LIMIT 4U | ||
140 | |||
141 | #define IL_TX_FIFO_AC0 0 | ||
142 | #define IL_TX_FIFO_AC1 1 | ||
143 | #define IL_TX_FIFO_AC2 2 | ||
144 | #define IL_TX_FIFO_AC3 3 | ||
145 | #define IL_TX_FIFO_HCCA_1 5 | ||
146 | #define IL_TX_FIFO_HCCA_2 6 | ||
147 | #define IL_TX_FIFO_NONE 7 | ||
148 | |||
149 | #define IEEE80211_DATA_LEN 2304 | ||
150 | #define IEEE80211_4ADDR_LEN 30 | ||
151 | #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) | ||
152 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | ||
153 | |||
154 | struct il3945_frame { | ||
155 | union { | ||
156 | struct ieee80211_hdr frame; | ||
157 | struct il3945_tx_beacon_cmd beacon; | ||
158 | u8 raw[IEEE80211_FRAME_LEN]; | ||
159 | u8 cmd[360]; | ||
160 | } u; | ||
161 | struct list_head list; | ||
162 | }; | ||
163 | |||
164 | #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) | ||
165 | #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) | ||
166 | #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) | ||
167 | |||
168 | #define SUP_RATE_11A_MAX_NUM_CHANNELS 8 | ||
169 | #define SUP_RATE_11B_MAX_NUM_CHANNELS 4 | ||
170 | #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 | ||
171 | |||
172 | #define IL_SUPPORTED_RATES_IE_LEN 8 | ||
173 | |||
174 | #define SCAN_INTERVAL 100 | ||
175 | |||
176 | #define MAX_TID_COUNT 9 | ||
177 | |||
178 | #define IL_INVALID_RATE 0xFF | ||
179 | #define IL_INVALID_VALUE -1 | ||
180 | |||
181 | #define STA_PS_STATUS_WAKE 0 | ||
182 | #define STA_PS_STATUS_SLEEP 1 | ||
183 | |||
184 | struct il3945_ibss_seq { | ||
185 | u8 mac[ETH_ALEN]; | ||
186 | u16 seq_num; | ||
187 | u16 frag_num; | ||
188 | unsigned long packet_time; | ||
189 | struct list_head list; | ||
190 | }; | ||
191 | |||
192 | #define IL_RX_HDR(x) ((struct il3945_rx_frame_hdr *)(\ | ||
193 | x->u.rx_frame.stats.payload + \ | ||
194 | x->u.rx_frame.stats.phy_count)) | ||
195 | #define IL_RX_END(x) ((struct il3945_rx_frame_end *)(\ | ||
196 | IL_RX_HDR(x)->payload + \ | ||
197 | le16_to_cpu(IL_RX_HDR(x)->len))) | ||
198 | #define IL_RX_STATS(x) (&x->u.rx_frame.stats) | ||
199 | #define IL_RX_DATA(x) (IL_RX_HDR(x)->payload) | ||
200 | |||
201 | |||
202 | /****************************************************************************** | ||
203 | * | ||
204 | * Functions implemented in iwl3945-base.c which are forward declared here | ||
205 | * for use by iwl-*.c | ||
206 | * | ||
207 | *****************************************************************************/ | ||
208 | extern int il3945_calc_db_from_ratio(int sig_ratio); | ||
209 | extern void il3945_rx_replenish(void *data); | ||
210 | extern void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq); | ||
211 | extern unsigned int il3945_fill_beacon_frame(struct il_priv *il, | ||
212 | struct ieee80211_hdr *hdr, int left); | ||
213 | extern int il3945_dump_nic_event_log(struct il_priv *il, bool full_log, | ||
214 | char **buf, bool display); | ||
215 | extern void il3945_dump_nic_error_log(struct il_priv *il); | ||
216 | |||
217 | /****************************************************************************** | ||
218 | * | ||
219 | * Functions implemented in iwl-[34]*.c which are forward declared here | ||
220 | * for use by iwl3945-base.c | ||
221 | * | ||
222 | * NOTE: The implementation of these functions are hardware specific | ||
223 | * which is why they are in the hardware specific files (vs. iwl-base.c) | ||
224 | * | ||
225 | * Naming convention -- | ||
226 | * il3945_ <-- Its part of iwlwifi (should be changed to il3945_) | ||
227 | * il3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) | ||
228 | * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) | ||
229 | * il3945_bg_ <-- Called from work queue context | ||
230 | * il3945_mac_ <-- mac80211 callback | ||
231 | * | ||
232 | ****************************************************************************/ | ||
233 | extern void il3945_hw_rx_handler_setup(struct il_priv *il); | ||
234 | extern void il3945_hw_setup_deferred_work(struct il_priv *il); | ||
235 | extern void il3945_hw_cancel_deferred_work(struct il_priv *il); | ||
236 | extern int il3945_hw_rxq_stop(struct il_priv *il); | ||
237 | extern int il3945_hw_set_hw_params(struct il_priv *il); | ||
238 | extern int il3945_hw_nic_init(struct il_priv *il); | ||
239 | extern int il3945_hw_nic_stop_master(struct il_priv *il); | ||
240 | extern void il3945_hw_txq_ctx_free(struct il_priv *il); | ||
241 | extern void il3945_hw_txq_ctx_stop(struct il_priv *il); | ||
242 | extern int il3945_hw_nic_reset(struct il_priv *il); | ||
243 | extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il, | ||
244 | struct il_tx_queue *txq, | ||
245 | dma_addr_t addr, u16 len, | ||
246 | u8 reset, u8 pad); | ||
247 | extern void il3945_hw_txq_free_tfd(struct il_priv *il, | ||
248 | struct il_tx_queue *txq); | ||
249 | extern int il3945_hw_get_temperature(struct il_priv *il); | ||
250 | extern int il3945_hw_tx_queue_init(struct il_priv *il, | ||
251 | struct il_tx_queue *txq); | ||
252 | extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il, | ||
253 | struct il3945_frame *frame, u8 rate); | ||
254 | void il3945_hw_build_tx_cmd_rate(struct il_priv *il, | ||
255 | struct il_device_cmd *cmd, | ||
256 | struct ieee80211_tx_info *info, | ||
257 | struct ieee80211_hdr *hdr, | ||
258 | int sta_id, int tx_id); | ||
259 | extern int il3945_hw_reg_send_txpower(struct il_priv *il); | ||
260 | extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power); | ||
261 | extern void il3945_hw_rx_stats(struct il_priv *il, | ||
262 | struct il_rx_buf *rxb); | ||
263 | void il3945_reply_stats(struct il_priv *il, | ||
264 | struct il_rx_buf *rxb); | ||
265 | extern void il3945_disable_events(struct il_priv *il); | ||
266 | extern int il4965_get_temperature(const struct il_priv *il); | ||
267 | extern void il3945_post_associate(struct il_priv *il); | ||
268 | extern void il3945_config_ap(struct il_priv *il); | ||
269 | |||
270 | extern int il3945_commit_rxon(struct il_priv *il, | ||
271 | struct il_rxon_context *ctx); | ||
272 | |||
273 | /** | ||
274 | * il3945_hw_find_station - Find station id for a given BSSID | ||
275 | * @bssid: MAC address of station ID to find | ||
276 | * | ||
277 | * NOTE: This should not be hardware specific but the code has | ||
278 | * not yet been merged into a single common layer for managing the | ||
279 | * station tables. | ||
280 | */ | ||
281 | extern u8 il3945_hw_find_station(struct il_priv *il, const u8 *bssid); | ||
282 | |||
283 | extern struct ieee80211_ops il3945_hw_ops; | ||
284 | |||
285 | /* | ||
286 | * Forward declare iwl-3945.c functions for iwl3945-base.c | ||
287 | */ | ||
288 | extern __le32 il3945_get_antenna_flags(const struct il_priv *il); | ||
289 | extern int il3945_init_hw_rate_table(struct il_priv *il); | ||
290 | extern void il3945_reg_txpower_periodic(struct il_priv *il); | ||
291 | extern int il3945_txpower_set_from_eeprom(struct il_priv *il); | ||
292 | |||
293 | extern const struct il_channel_info *il3945_get_channel_info( | ||
294 | const struct il_priv *il, enum ieee80211_band band, u16 channel); | ||
295 | |||
296 | extern int il3945_rs_next_rate(struct il_priv *il, int rate); | ||
297 | |||
298 | /* scanning */ | ||
299 | int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif); | ||
300 | void il3945_post_scan(struct il_priv *il); | ||
301 | |||
302 | /* rates */ | ||
303 | extern const struct il3945_rate_info il3945_rates[RATE_COUNT_3945]; | ||
304 | |||
305 | /* Requires full declaration of il_priv before including */ | ||
306 | #include "iwl-io.h" | ||
307 | |||
308 | #endif | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h index 97b25730c329..f7c3b43ae049 100644 --- a/drivers/net/wireless/iwlegacy/iwl-dev.h +++ b/drivers/net/wireless/iwlegacy/iwl-dev.h | |||
@@ -45,11 +45,12 @@ | |||
45 | #include "iwl-fh.h" | 45 | #include "iwl-fh.h" |
46 | #include "iwl-debug.h" | 46 | #include "iwl-debug.h" |
47 | #include "4965.h" | 47 | #include "4965.h" |
48 | #include "iwl-3945-hw.h" | ||
49 | #include "iwl-led.h" | 48 | #include "iwl-led.h" |
50 | #include "iwl-power.h" | 49 | #include "iwl-power.h" |
51 | #include "iwl-legacy-rs.h" | 50 | #include "iwl-legacy-rs.h" |
52 | 51 | ||
52 | #define U32_PAD(n) ((4-(n))&0x3) | ||
53 | |||
53 | struct il_tx_queue; | 54 | struct il_tx_queue; |
54 | 55 | ||
55 | /* CT-KILL constants */ | 56 | /* CT-KILL constants */ |