Commit | Line | Data |
---|---|---|
4bc85c13 | 1 | /****************************************************************************** |
4bc85c13 WYG |
2 | * |
3 | * GPL LICENSE SUMMARY | |
4 | * | |
af038f40 | 5 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. |
4bc85c13 WYG |
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 | * | |
4bc85c13 | 28 | *****************************************************************************/ |
af038f40 SG |
29 | |
30 | #ifndef __il_4965_h__ | |
31 | #define __il_4965_h__ | |
32 | ||
33 | #include "iwl-fh.h" | |
34 | #include "iwl-debug.h" | |
35 | ||
36 | struct il_rx_queue; | |
37 | struct il_rx_buf; | |
38 | struct il_rx_pkt; | |
39 | struct il_tx_queue; | |
40 | struct il_rxon_context; | |
41 | ||
42 | /* configuration for the _4965 devices */ | |
43 | extern struct il_cfg il4965_cfg; | |
44 | ||
45 | extern struct il_mod_params il4965_mod_params; | |
46 | ||
47 | extern struct ieee80211_ops il4965_hw_ops; | |
48 | ||
49 | /* tx queue */ | |
50 | void il4965_free_tfds_in_queue(struct il_priv *il, | |
51 | int sta_id, int tid, int freed); | |
52 | ||
53 | /* RXON */ | |
54 | void il4965_set_rxon_chain(struct il_priv *il, | |
55 | struct il_rxon_context *ctx); | |
56 | ||
57 | /* uCode */ | |
58 | int il4965_verify_ucode(struct il_priv *il); | |
59 | ||
60 | /* lib */ | |
61 | void il4965_check_abort_status(struct il_priv *il, | |
62 | u8 frame_count, u32 status); | |
63 | ||
64 | void il4965_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq); | |
65 | int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq); | |
66 | int il4965_hw_nic_init(struct il_priv *il); | |
67 | int il4965_dump_fh(struct il_priv *il, char **buf, bool display); | |
68 | ||
69 | /* rx */ | |
70 | void il4965_rx_queue_restock(struct il_priv *il); | |
71 | void il4965_rx_replenish(struct il_priv *il); | |
72 | void il4965_rx_replenish_now(struct il_priv *il); | |
73 | void il4965_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq); | |
74 | int il4965_rxq_stop(struct il_priv *il); | |
75 | int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band); | |
76 | void il4965_rx_reply_rx(struct il_priv *il, | |
77 | struct il_rx_buf *rxb); | |
78 | void il4965_rx_reply_rx_phy(struct il_priv *il, | |
79 | struct il_rx_buf *rxb); | |
80 | void il4965_rx_handle(struct il_priv *il); | |
81 | ||
82 | /* tx */ | |
83 | void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq); | |
84 | int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il, | |
85 | struct il_tx_queue *txq, | |
86 | dma_addr_t addr, u16 len, u8 reset, u8 pad); | |
87 | int il4965_hw_tx_queue_init(struct il_priv *il, | |
88 | struct il_tx_queue *txq); | |
89 | void il4965_hwrate_to_tx_control(struct il_priv *il, u32 rate_n_flags, | |
90 | struct ieee80211_tx_info *info); | |
91 | int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb); | |
92 | int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif, | |
93 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); | |
94 | int il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif, | |
95 | struct ieee80211_sta *sta, u16 tid); | |
96 | int il4965_txq_check_empty(struct il_priv *il, | |
97 | int sta_id, u8 tid, int txq_id); | |
98 | void il4965_rx_reply_compressed_ba(struct il_priv *il, | |
99 | struct il_rx_buf *rxb); | |
100 | int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx); | |
101 | void il4965_hw_txq_ctx_free(struct il_priv *il); | |
102 | int il4965_txq_ctx_alloc(struct il_priv *il); | |
103 | void il4965_txq_ctx_reset(struct il_priv *il); | |
104 | void il4965_txq_ctx_stop(struct il_priv *il); | |
105 | void il4965_txq_set_sched(struct il_priv *il, u32 mask); | |
106 | ||
4bc85c13 | 107 | /* |
af038f40 | 108 | * Acquire il->lock before calling this function ! |
4bc85c13 | 109 | */ |
af038f40 SG |
110 | void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 idx); |
111 | /** | |
112 | * il4965_tx_queue_set_status - (optionally) start Tx/Cmd queue | |
113 | * @tx_fifo_id: Tx DMA/FIFO channel (range 0-7) that the queue will feed | |
114 | * @scd_retry: (1) Indicates queue will be used in aggregation mode | |
115 | * | |
116 | * NOTE: Acquire il->lock before calling this function ! | |
117 | */ | |
118 | void il4965_tx_queue_set_status(struct il_priv *il, | |
119 | struct il_tx_queue *txq, | |
120 | int tx_fifo_id, int scd_retry); | |
121 | ||
122 | u8 il4965_toggle_tx_ant(struct il_priv *il, u8 ant_idx, u8 valid); | |
123 | ||
124 | /* rx */ | |
125 | void il4965_rx_missed_beacon_notif(struct il_priv *il, | |
126 | struct il_rx_buf *rxb); | |
127 | bool il4965_good_plcp_health(struct il_priv *il, | |
128 | struct il_rx_pkt *pkt); | |
129 | void il4965_rx_stats(struct il_priv *il, | |
130 | struct il_rx_buf *rxb); | |
131 | void il4965_reply_stats(struct il_priv *il, | |
132 | struct il_rx_buf *rxb); | |
133 | ||
134 | /* scan */ | |
135 | int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif); | |
136 | ||
137 | /* station mgmt */ | |
138 | int il4965_manage_ibss_station(struct il_priv *il, | |
139 | struct ieee80211_vif *vif, bool add); | |
140 | ||
141 | /* hcmd */ | |
142 | int il4965_send_beacon_cmd(struct il_priv *il); | |
143 | ||
144 | #ifdef CONFIG_IWLEGACY_DEBUG | |
145 | const char *il4965_get_tx_fail_reason(u32 status); | |
146 | #else | |
147 | static inline const char * | |
148 | il4965_get_tx_fail_reason(u32 status) { return ""; } | |
149 | #endif | |
150 | ||
151 | /* station management */ | |
152 | int il4965_alloc_bcast_station(struct il_priv *il, | |
153 | struct il_rxon_context *ctx); | |
154 | int il4965_add_bssid_station(struct il_priv *il, | |
155 | struct il_rxon_context *ctx, | |
156 | const u8 *addr, u8 *sta_id_r); | |
157 | int il4965_remove_default_wep_key(struct il_priv *il, | |
158 | struct il_rxon_context *ctx, | |
159 | struct ieee80211_key_conf *key); | |
160 | int il4965_set_default_wep_key(struct il_priv *il, | |
161 | struct il_rxon_context *ctx, | |
162 | struct ieee80211_key_conf *key); | |
163 | int il4965_restore_default_wep_keys(struct il_priv *il, | |
164 | struct il_rxon_context *ctx); | |
165 | int il4965_set_dynamic_key(struct il_priv *il, | |
166 | struct il_rxon_context *ctx, | |
167 | struct ieee80211_key_conf *key, u8 sta_id); | |
168 | int il4965_remove_dynamic_key(struct il_priv *il, | |
169 | struct il_rxon_context *ctx, | |
170 | struct ieee80211_key_conf *key, u8 sta_id); | |
171 | void il4965_update_tkip_key(struct il_priv *il, | |
172 | struct il_rxon_context *ctx, | |
173 | struct ieee80211_key_conf *keyconf, | |
174 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); | |
175 | int il4965_sta_tx_modify_enable_tid(struct il_priv *il, | |
176 | int sta_id, int tid); | |
177 | int il4965_sta_rx_agg_start(struct il_priv *il, struct ieee80211_sta *sta, | |
178 | int tid, u16 ssn); | |
179 | int il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta, | |
180 | int tid); | |
181 | void il4965_sta_modify_sleep_tx_count(struct il_priv *il, | |
182 | int sta_id, int cnt); | |
183 | int il4965_update_bcast_stations(struct il_priv *il); | |
184 | ||
185 | /* rate */ | |
186 | static inline u8 il4965_hw_get_rate(__le32 rate_n_flags) | |
187 | { | |
188 | return le32_to_cpu(rate_n_flags) & 0xFF; | |
189 | } | |
4bc85c13 | 190 | |
af038f40 SG |
191 | static inline __le32 il4965_hw_set_rate_n_flags(u8 rate, u32 flags) |
192 | { | |
193 | return cpu_to_le32(flags|(u32)rate); | |
194 | } | |
195 | ||
196 | /* eeprom */ | |
197 | void il4965_eeprom_get_mac(const struct il_priv *il, u8 *mac); | |
198 | int il4965_eeprom_acquire_semaphore(struct il_priv *il); | |
199 | void il4965_eeprom_release_semaphore(struct il_priv *il); | |
200 | int il4965_eeprom_check_version(struct il_priv *il); | |
201 | ||
202 | /* mac80211 handlers (for 4965) */ | |
203 | void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); | |
204 | int il4965_mac_start(struct ieee80211_hw *hw); | |
205 | void il4965_mac_stop(struct ieee80211_hw *hw); | |
206 | void il4965_configure_filter(struct ieee80211_hw *hw, | |
207 | unsigned int changed_flags, | |
208 | unsigned int *total_flags, | |
209 | u64 multicast); | |
210 | int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |
211 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, | |
212 | struct ieee80211_key_conf *key); | |
213 | void il4965_mac_update_tkip_key(struct ieee80211_hw *hw, | |
214 | struct ieee80211_vif *vif, | |
215 | struct ieee80211_key_conf *keyconf, | |
216 | struct ieee80211_sta *sta, | |
217 | u32 iv32, u16 *phase1key); | |
218 | int il4965_mac_ampdu_action(struct ieee80211_hw *hw, | |
219 | struct ieee80211_vif *vif, | |
220 | enum ieee80211_ampdu_mlme_action action, | |
221 | struct ieee80211_sta *sta, u16 tid, u16 *ssn, | |
222 | u8 buf_size); | |
223 | int il4965_mac_sta_add(struct ieee80211_hw *hw, | |
224 | struct ieee80211_vif *vif, | |
225 | struct ieee80211_sta *sta); | |
226 | void il4965_mac_channel_switch(struct ieee80211_hw *hw, | |
227 | struct ieee80211_channel_switch *ch_switch); | |
228 | ||
229 | void il4965_led_enable(struct il_priv *il); | |
4bc85c13 | 230 | |
4bc85c13 WYG |
231 | |
232 | /* EEPROM */ | |
d3175167 | 233 | #define IL4965_EEPROM_IMG_SIZE 1024 |
4bc85c13 WYG |
234 | |
235 | /* | |
236 | * uCode queue management definitions ... | |
237 | * The first queue used for block-ack aggregation is #7 (4965 only). | |
238 | * All block-ack aggregation queues should map to Tx DMA/FIFO channel 7. | |
239 | */ | |
d3175167 | 240 | #define IL49_FIRST_AMPDU_QUEUE 7 |
4bc85c13 WYG |
241 | |
242 | /* Sizes and addresses for instruction and data memory (SRAM) in | |
243 | * 4965's embedded processor. Driver access is via HBUS_TARG_MEM_* regs. */ | |
d3175167 SG |
244 | #define IL49_RTC_INST_LOWER_BOUND (0x000000) |
245 | #define IL49_RTC_INST_UPPER_BOUND (0x018000) | |
4bc85c13 | 246 | |
d3175167 SG |
247 | #define IL49_RTC_DATA_LOWER_BOUND (0x800000) |
248 | #define IL49_RTC_DATA_UPPER_BOUND (0x80A000) | |
4bc85c13 | 249 | |
d3175167 SG |
250 | #define IL49_RTC_INST_SIZE (IL49_RTC_INST_UPPER_BOUND - \ |
251 | IL49_RTC_INST_LOWER_BOUND) | |
252 | #define IL49_RTC_DATA_SIZE (IL49_RTC_DATA_UPPER_BOUND - \ | |
253 | IL49_RTC_DATA_LOWER_BOUND) | |
4bc85c13 | 254 | |
d3175167 SG |
255 | #define IL49_MAX_INST_SIZE IL49_RTC_INST_SIZE |
256 | #define IL49_MAX_DATA_SIZE IL49_RTC_DATA_SIZE | |
4bc85c13 WYG |
257 | |
258 | /* Size of uCode instruction memory in bootstrap state machine */ | |
d3175167 | 259 | #define IL49_MAX_BSM_SIZE BSM_SRAM_SIZE |
4bc85c13 | 260 | |
e2ebc833 | 261 | static inline int il4965_hw_valid_rtc_data_addr(u32 addr) |
4bc85c13 | 262 | { |
d3175167 SG |
263 | return (addr >= IL49_RTC_DATA_LOWER_BOUND && |
264 | addr < IL49_RTC_DATA_UPPER_BOUND); | |
4bc85c13 WYG |
265 | } |
266 | ||
267 | /********************* START TEMPERATURE *************************************/ | |
268 | ||
269 | /** | |
270 | * 4965 temperature calculation. | |
271 | * | |
272 | * The driver must calculate the device temperature before calculating | |
273 | * a txpower setting (amplifier gain is temperature dependent). The | |
274 | * calculation uses 4 measurements, 3 of which (R1, R2, R3) are calibration | |
275 | * values used for the life of the driver, and one of which (R4) is the | |
276 | * real-time temperature indicator. | |
277 | * | |
278 | * uCode provides all 4 values to the driver via the "initialize alive" | |
e2ebc833 | 279 | * notification (see struct il4965_init_alive_resp). After the runtime uCode |
ebf0d90d | 280 | * image loads, uCode updates the R4 value via stats notifications |
4d69c752 SG |
281 | * (see N_STATS), which occur after each received beacon |
282 | * when associated, or can be requested via C_STATS. | |
4bc85c13 WYG |
283 | * |
284 | * NOTE: uCode provides the R4 value as a 23-bit signed value. Driver | |
285 | * must sign-extend to 32 bits before applying formula below. | |
286 | * | |
287 | * Formula: | |
288 | * | |
289 | * degrees Kelvin = ((97 * 259 * (R4 - R2) / (R3 - R1)) / 100) + 8 | |
290 | * | |
291 | * NOTE: The basic formula is 259 * (R4-R2) / (R3-R1). The 97/100 is | |
292 | * an additional correction, which should be centered around 0 degrees | |
293 | * Celsius (273 degrees Kelvin). The 8 (3 percent of 273) compensates for | |
294 | * centering the 97/100 correction around 0 degrees K. | |
295 | * | |
296 | * Add 273 to Kelvin value to find degrees Celsius, for comparing current | |
297 | * temperature with factory-measured temperatures when calculating txpower | |
298 | * settings. | |
299 | */ | |
300 | #define TEMPERATURE_CALIB_KELVIN_OFFSET 8 | |
301 | #define TEMPERATURE_CALIB_A_VAL 259 | |
302 | ||
303 | /* Limit range of calculated temperature to be between these Kelvin values */ | |
e2ebc833 SG |
304 | #define IL_TX_POWER_TEMPERATURE_MIN (263) |
305 | #define IL_TX_POWER_TEMPERATURE_MAX (410) | |
4bc85c13 | 306 | |
e2ebc833 | 307 | #define IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \ |
232913b5 SG |
308 | ((t) < IL_TX_POWER_TEMPERATURE_MIN || \ |
309 | (t) > IL_TX_POWER_TEMPERATURE_MAX) | |
4bc85c13 WYG |
310 | |
311 | /********************* END TEMPERATURE ***************************************/ | |
312 | ||
313 | /********************* START TXPOWER *****************************************/ | |
314 | ||
315 | /** | |
316 | * 4965 txpower calculations rely on information from three sources: | |
317 | * | |
318 | * 1) EEPROM | |
319 | * 2) "initialize" alive notification | |
ebf0d90d | 320 | * 3) stats notifications |
4bc85c13 WYG |
321 | * |
322 | * EEPROM data consists of: | |
323 | * | |
324 | * 1) Regulatory information (max txpower and channel usage flags) is provided | |
325 | * separately for each channel that can possibly supported by 4965. | |
326 | * 40 MHz wide (.11n HT40) channels are listed separately from 20 MHz | |
327 | * (legacy) channels. | |
328 | * | |
e2ebc833 | 329 | * See struct il4965_eeprom_channel for format, and struct il4965_eeprom |
4bc85c13 WYG |
330 | * for locations in EEPROM. |
331 | * | |
332 | * 2) Factory txpower calibration information is provided separately for | |
333 | * sub-bands of contiguous channels. 2.4GHz has just one sub-band, | |
334 | * but 5 GHz has several sub-bands. | |
335 | * | |
336 | * In addition, per-band (2.4 and 5 Ghz) saturation txpowers are provided. | |
337 | * | |
e2ebc833 SG |
338 | * See struct il4965_eeprom_calib_info (and the tree of structures |
339 | * contained within it) for format, and struct il4965_eeprom for | |
4bc85c13 WYG |
340 | * locations in EEPROM. |
341 | * | |
e2ebc833 | 342 | * "Initialization alive" notification (see struct il4965_init_alive_resp) |
4bc85c13 WYG |
343 | * consists of: |
344 | * | |
345 | * 1) Temperature calculation parameters. | |
346 | * | |
347 | * 2) Power supply voltage measurement. | |
348 | * | |
349 | * 3) Tx gain compensation to balance 2 transmitters for MIMO use. | |
350 | * | |
351 | * Statistics notifications deliver: | |
352 | * | |
353 | * 1) Current values for temperature param R4. | |
354 | */ | |
355 | ||
356 | /** | |
357 | * To calculate a txpower setting for a given desired target txpower, channel, | |
358 | * modulation bit rate, and transmitter chain (4965 has 2 transmitters to | |
359 | * support MIMO and transmit diversity), driver must do the following: | |
360 | * | |
361 | * 1) Compare desired txpower vs. (EEPROM) regulatory limit for this channel. | |
362 | * Do not exceed regulatory limit; reduce target txpower if necessary. | |
363 | * | |
0c2c8852 | 364 | * If setting up txpowers for MIMO rates (rate idxes 8-15, 24-31), |
4bc85c13 WYG |
365 | * 2 transmitters will be used simultaneously; driver must reduce the |
366 | * regulatory limit by 3 dB (half-power) for each transmitter, so the | |
367 | * combined total output of the 2 transmitters is within regulatory limits. | |
368 | * | |
369 | * | |
370 | * 2) Compare target txpower vs. (EEPROM) saturation txpower *reduced by | |
371 | * backoff for this bit rate*. Do not exceed (saturation - backoff[rate]); | |
372 | * reduce target txpower if necessary. | |
373 | * | |
374 | * Backoff values below are in 1/2 dB units (equivalent to steps in | |
375 | * txpower gain tables): | |
376 | * | |
377 | * OFDM 6 - 36 MBit: 10 steps (5 dB) | |
378 | * OFDM 48 MBit: 15 steps (7.5 dB) | |
379 | * OFDM 54 MBit: 17 steps (8.5 dB) | |
380 | * OFDM 60 MBit: 20 steps (10 dB) | |
381 | * CCK all rates: 10 steps (5 dB) | |
382 | * | |
383 | * Backoff values apply to saturation txpower on a per-transmitter basis; | |
384 | * when using MIMO (2 transmitters), each transmitter uses the same | |
385 | * saturation level provided in EEPROM, and the same backoff values; | |
386 | * no reduction (such as with regulatory txpower limits) is required. | |
387 | * | |
388 | * Saturation and Backoff values apply equally to 20 Mhz (legacy) channel | |
389 | * widths and 40 Mhz (.11n HT40) channel widths; there is no separate | |
390 | * factory measurement for ht40 channels. | |
391 | * | |
392 | * The result of this step is the final target txpower. The rest of | |
393 | * the steps figure out the proper settings for the device to achieve | |
394 | * that target txpower. | |
395 | * | |
396 | * | |
397 | * 3) Determine (EEPROM) calibration sub band for the target channel, by | |
398 | * comparing against first and last channels in each sub band | |
e2ebc833 | 399 | * (see struct il4965_eeprom_calib_subband_info). |
4bc85c13 WYG |
400 | * |
401 | * | |
402 | * 4) Linearly interpolate (EEPROM) factory calibration measurement sets, | |
403 | * referencing the 2 factory-measured (sample) channels within the sub band. | |
404 | * | |
405 | * Interpolation is based on difference between target channel's frequency | |
406 | * and the sample channels' frequencies. Since channel numbers are based | |
407 | * on frequency (5 MHz between each channel number), this is equivalent | |
408 | * to interpolating based on channel number differences. | |
409 | * | |
410 | * Note that the sample channels may or may not be the channels at the | |
411 | * edges of the sub band. The target channel may be "outside" of the | |
412 | * span of the sampled channels. | |
413 | * | |
414 | * Driver may choose the pair (for 2 Tx chains) of measurements (see | |
e2ebc833 | 415 | * struct il4965_eeprom_calib_ch_info) for which the actual measured |
4bc85c13 WYG |
416 | * txpower comes closest to the desired txpower. Usually, though, |
417 | * the middle set of measurements is closest to the regulatory limits, | |
418 | * and is therefore a good choice for all txpower calculations (this | |
419 | * assumes that high accuracy is needed for maximizing legal txpower, | |
420 | * while lower txpower configurations do not need as much accuracy). | |
421 | * | |
422 | * Driver should interpolate both members of the chosen measurement pair, | |
423 | * i.e. for both Tx chains (radio transmitters), unless the driver knows | |
424 | * that only one of the chains will be used (e.g. only one tx antenna | |
425 | * connected, but this should be unusual). The rate scaling algorithm | |
426 | * switches antennas to find best performance, so both Tx chains will | |
427 | * be used (although only one at a time) even for non-MIMO transmissions. | |
428 | * | |
429 | * Driver should interpolate factory values for temperature, gain table | |
0c2c8852 | 430 | * idx, and actual power. The power amplifier detector values are |
4bc85c13 WYG |
431 | * not used by the driver. |
432 | * | |
433 | * Sanity check: If the target channel happens to be one of the sample | |
434 | * channels, the results should agree with the sample channel's | |
435 | * measurements! | |
436 | * | |
437 | * | |
438 | * 5) Find difference between desired txpower and (interpolated) | |
0c2c8852 SG |
439 | * factory-measured txpower. Using (interpolated) factory gain table idx |
440 | * (shown elsewhere) as a starting point, adjust this idx lower to | |
4bc85c13 WYG |
441 | * increase txpower, or higher to decrease txpower, until the target |
442 | * txpower is reached. Each step in the gain table is 1/2 dB. | |
443 | * | |
444 | * For example, if factory measured txpower is 16 dBm, and target txpower | |
0c2c8852 | 445 | * is 13 dBm, add 6 steps to the factory gain idx to reduce txpower |
4bc85c13 WYG |
446 | * by 3 dB. |
447 | * | |
448 | * | |
449 | * 6) Find difference between current device temperature and (interpolated) | |
450 | * factory-measured temperature for sub-band. Factory values are in | |
451 | * degrees Celsius. To calculate current temperature, see comments for | |
452 | * "4965 temperature calculation". | |
453 | * | |
454 | * If current temperature is higher than factory temperature, driver must | |
0c2c8852 | 455 | * increase gain (lower gain table idx), and vice verse. |
4bc85c13 WYG |
456 | * |
457 | * Temperature affects gain differently for different channels: | |
458 | * | |
459 | * 2.4 GHz all channels: 3.5 degrees per half-dB step | |
460 | * 5 GHz channels 34-43: 4.5 degrees per half-dB step | |
461 | * 5 GHz channels >= 44: 4.0 degrees per half-dB step | |
462 | * | |
463 | * NOTE: Temperature can increase rapidly when transmitting, especially | |
464 | * with heavy traffic at high txpowers. Driver should update | |
465 | * temperature calculations often under these conditions to | |
466 | * maintain strong txpower in the face of rising temperature. | |
467 | * | |
468 | * | |
469 | * 7) Find difference between current power supply voltage indicator | |
470 | * (from "initialize alive") and factory-measured power supply voltage | |
471 | * indicator (EEPROM). | |
472 | * | |
473 | * If the current voltage is higher (indicator is lower) than factory | |
0c2c8852 | 474 | * voltage, gain should be reduced (gain table idx increased) by: |
4bc85c13 WYG |
475 | * |
476 | * (eeprom - current) / 7 | |
477 | * | |
478 | * If the current voltage is lower (indicator is higher) than factory | |
0c2c8852 | 479 | * voltage, gain should be increased (gain table idx decreased) by: |
4bc85c13 WYG |
480 | * |
481 | * 2 * (current - eeprom) / 7 | |
482 | * | |
0c2c8852 | 483 | * If number of idx steps in either direction turns out to be > 2, |
4bc85c13 WYG |
484 | * something is wrong ... just use 0. |
485 | * | |
486 | * NOTE: Voltage compensation is independent of band/channel. | |
487 | * | |
488 | * NOTE: "Initialize" uCode measures current voltage, which is assumed | |
489 | * to be constant after this initial measurement. Voltage | |
490 | * compensation for txpower (number of steps in gain table) | |
491 | * may be calculated once and used until the next uCode bootload. | |
492 | * | |
493 | * | |
0c2c8852 | 494 | * 8) If setting up txpowers for MIMO rates (rate idxes 8-15, 24-31), |
4bc85c13 WYG |
495 | * adjust txpower for each transmitter chain, so txpower is balanced |
496 | * between the two chains. There are 5 pairs of tx_atten[group][chain] | |
497 | * values in "initialize alive", one pair for each of 5 channel ranges: | |
498 | * | |
499 | * Group 0: 5 GHz channel 34-43 | |
500 | * Group 1: 5 GHz channel 44-70 | |
501 | * Group 2: 5 GHz channel 71-124 | |
502 | * Group 3: 5 GHz channel 125-200 | |
503 | * Group 4: 2.4 GHz all channels | |
504 | * | |
0c2c8852 | 505 | * Add the tx_atten[group][chain] value to the idx for the target chain. |
4bc85c13 WYG |
506 | * The values are signed, but are in pairs of 0 and a non-negative number, |
507 | * so as to reduce gain (if necessary) of the "hotter" channel. This | |
508 | * avoids any need to double-check for regulatory compliance after | |
509 | * this step. | |
510 | * | |
511 | * | |
512 | * 9) If setting up for a CCK rate, lower the gain by adding a CCK compensation | |
0c2c8852 | 513 | * value to the idx: |
4bc85c13 WYG |
514 | * |
515 | * Hardware rev B: 9 steps (4.5 dB) | |
516 | * Hardware rev C: 5 steps (2.5 dB) | |
517 | * | |
518 | * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG, | |
519 | * bits [3:2], 1 = B, 2 = C. | |
520 | * | |
521 | * NOTE: This compensation is in addition to any saturation backoff that | |
522 | * might have been applied in an earlier step. | |
523 | * | |
524 | * | |
525 | * 10) Select the gain table, based on band (2.4 vs 5 GHz). | |
526 | * | |
0c2c8852 | 527 | * Limit the adjusted idx to stay within the table! |
4bc85c13 WYG |
528 | * |
529 | * | |
530 | * 11) Read gain table entries for DSP and radio gain, place into appropriate | |
e2ebc833 | 531 | * location(s) in command (struct il4965_txpowertable_cmd). |
4bc85c13 WYG |
532 | */ |
533 | ||
534 | /** | |
535 | * When MIMO is used (2 transmitters operating simultaneously), driver should | |
536 | * limit each transmitter to deliver a max of 3 dB below the regulatory limit | |
537 | * for the device. That is, use half power for each transmitter, so total | |
538 | * txpower is within regulatory limits. | |
539 | * | |
540 | * The value "6" represents number of steps in gain table to reduce power 3 dB. | |
541 | * Each step is 1/2 dB. | |
542 | */ | |
e2ebc833 | 543 | #define IL_TX_POWER_MIMO_REGULATORY_COMPENSATION (6) |
4bc85c13 WYG |
544 | |
545 | /** | |
546 | * CCK gain compensation. | |
547 | * | |
548 | * When calculating txpowers for CCK, after making sure that the target power | |
549 | * is within regulatory and saturation limits, driver must additionally | |
0c2c8852 | 550 | * back off gain by adding these values to the gain table idx. |
4bc85c13 WYG |
551 | * |
552 | * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG, | |
553 | * bits [3:2], 1 = B, 2 = C. | |
554 | */ | |
e2ebc833 SG |
555 | #define IL_TX_POWER_CCK_COMPENSATION_B_STEP (9) |
556 | #define IL_TX_POWER_CCK_COMPENSATION_C_STEP (5) | |
4bc85c13 WYG |
557 | |
558 | /* | |
559 | * 4965 power supply voltage compensation for txpower | |
560 | */ | |
e2ebc833 | 561 | #define TX_POWER_IL_VOLTAGE_CODES_PER_03V (7) |
4bc85c13 WYG |
562 | |
563 | /** | |
564 | * Gain tables. | |
565 | * | |
566 | * The following tables contain pair of values for setting txpower, i.e. | |
567 | * gain settings for the output of the device's digital signal processor (DSP), | |
568 | * and for the analog gain structure of the transmitter. | |
569 | * | |
570 | * Each entry in the gain tables represents a step of 1/2 dB. Note that these | |
571 | * are *relative* steps, not indications of absolute output power. Output | |
572 | * power varies with temperature, voltage, and channel frequency, and also | |
573 | * requires consideration of average power (to satisfy regulatory constraints), | |
574 | * and peak power (to avoid distortion of the output signal). | |
575 | * | |
576 | * Each entry contains two values: | |
577 | * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained | |
578 | * linear value that multiplies the output of the digital signal processor, | |
579 | * before being sent to the analog radio. | |
580 | * 2) Radio gain. This sets the analog gain of the radio Tx path. | |
581 | * It is a coarser setting, and behaves in a logarithmic (dB) fashion. | |
582 | * | |
583 | * EEPROM contains factory calibration data for txpower. This maps actual | |
584 | * measured txpower levels to gain settings in the "well known" tables | |
585 | * below ("well-known" means here that both factory calibration *and* the | |
586 | * driver work with the same table). | |
587 | * | |
588 | * There are separate tables for 2.4 GHz and 5 GHz bands. The 5 GHz table | |
0c2c8852 | 589 | * has an extension (into negative idxes), in case the driver needs to |
4bc85c13 | 590 | * boost power setting for high device temperatures (higher than would be |
0c2c8852 | 591 | * present during factory calibration). A 5 Ghz EEPROM idx of "40" |
4bc85c13 WYG |
592 | * corresponds to the 49th entry in the table used by the driver. |
593 | */ | |
2d09b062 SG |
594 | #define MIN_TX_GAIN_IDX (0) /* highest gain, lowest idx, 2.4 */ |
595 | #define MIN_TX_GAIN_IDX_52GHZ_EXT (-9) /* highest gain, lowest idx, 5 */ | |
4bc85c13 WYG |
596 | |
597 | /** | |
598 | * 2.4 GHz gain table | |
599 | * | |
600 | * Index Dsp gain Radio gain | |
601 | * 0 110 0x3f (highest gain) | |
602 | * 1 104 0x3f | |
603 | * 2 98 0x3f | |
604 | * 3 110 0x3e | |
605 | * 4 104 0x3e | |
606 | * 5 98 0x3e | |
607 | * 6 110 0x3d | |
608 | * 7 104 0x3d | |
609 | * 8 98 0x3d | |
610 | * 9 110 0x3c | |
611 | * 10 104 0x3c | |
612 | * 11 98 0x3c | |
613 | * 12 110 0x3b | |
614 | * 13 104 0x3b | |
615 | * 14 98 0x3b | |
616 | * 15 110 0x3a | |
617 | * 16 104 0x3a | |
618 | * 17 98 0x3a | |
619 | * 18 110 0x39 | |
620 | * 19 104 0x39 | |
621 | * 20 98 0x39 | |
622 | * 21 110 0x38 | |
623 | * 22 104 0x38 | |
624 | * 23 98 0x38 | |
625 | * 24 110 0x37 | |
626 | * 25 104 0x37 | |
627 | * 26 98 0x37 | |
628 | * 27 110 0x36 | |
629 | * 28 104 0x36 | |
630 | * 29 98 0x36 | |
631 | * 30 110 0x35 | |
632 | * 31 104 0x35 | |
633 | * 32 98 0x35 | |
634 | * 33 110 0x34 | |
635 | * 34 104 0x34 | |
636 | * 35 98 0x34 | |
637 | * 36 110 0x33 | |
638 | * 37 104 0x33 | |
639 | * 38 98 0x33 | |
640 | * 39 110 0x32 | |
641 | * 40 104 0x32 | |
642 | * 41 98 0x32 | |
643 | * 42 110 0x31 | |
644 | * 43 104 0x31 | |
645 | * 44 98 0x31 | |
646 | * 45 110 0x30 | |
647 | * 46 104 0x30 | |
648 | * 47 98 0x30 | |
649 | * 48 110 0x6 | |
650 | * 49 104 0x6 | |
651 | * 50 98 0x6 | |
652 | * 51 110 0x5 | |
653 | * 52 104 0x5 | |
654 | * 53 98 0x5 | |
655 | * 54 110 0x4 | |
656 | * 55 104 0x4 | |
657 | * 56 98 0x4 | |
658 | * 57 110 0x3 | |
659 | * 58 104 0x3 | |
660 | * 59 98 0x3 | |
661 | * 60 110 0x2 | |
662 | * 61 104 0x2 | |
663 | * 62 98 0x2 | |
664 | * 63 110 0x1 | |
665 | * 64 104 0x1 | |
666 | * 65 98 0x1 | |
667 | * 66 110 0x0 | |
668 | * 67 104 0x0 | |
669 | * 68 98 0x0 | |
670 | * 69 97 0 | |
671 | * 70 96 0 | |
672 | * 71 95 0 | |
673 | * 72 94 0 | |
674 | * 73 93 0 | |
675 | * 74 92 0 | |
676 | * 75 91 0 | |
677 | * 76 90 0 | |
678 | * 77 89 0 | |
679 | * 78 88 0 | |
680 | * 79 87 0 | |
681 | * 80 86 0 | |
682 | * 81 85 0 | |
683 | * 82 84 0 | |
684 | * 83 83 0 | |
685 | * 84 82 0 | |
686 | * 85 81 0 | |
687 | * 86 80 0 | |
688 | * 87 79 0 | |
689 | * 88 78 0 | |
690 | * 89 77 0 | |
691 | * 90 76 0 | |
692 | * 91 75 0 | |
693 | * 92 74 0 | |
694 | * 93 73 0 | |
695 | * 94 72 0 | |
696 | * 95 71 0 | |
697 | * 96 70 0 | |
698 | * 97 69 0 | |
699 | * 98 68 0 | |
700 | */ | |
701 | ||
702 | /** | |
703 | * 5 GHz gain table | |
704 | * | |
705 | * Index Dsp gain Radio gain | |
706 | * -9 123 0x3F (highest gain) | |
707 | * -8 117 0x3F | |
708 | * -7 110 0x3F | |
709 | * -6 104 0x3F | |
710 | * -5 98 0x3F | |
711 | * -4 110 0x3E | |
712 | * -3 104 0x3E | |
713 | * -2 98 0x3E | |
714 | * -1 110 0x3D | |
715 | * 0 104 0x3D | |
716 | * 1 98 0x3D | |
717 | * 2 110 0x3C | |
718 | * 3 104 0x3C | |
719 | * 4 98 0x3C | |
720 | * 5 110 0x3B | |
721 | * 6 104 0x3B | |
722 | * 7 98 0x3B | |
723 | * 8 110 0x3A | |
724 | * 9 104 0x3A | |
725 | * 10 98 0x3A | |
726 | * 11 110 0x39 | |
727 | * 12 104 0x39 | |
728 | * 13 98 0x39 | |
729 | * 14 110 0x38 | |
730 | * 15 104 0x38 | |
731 | * 16 98 0x38 | |
732 | * 17 110 0x37 | |
733 | * 18 104 0x37 | |
734 | * 19 98 0x37 | |
735 | * 20 110 0x36 | |
736 | * 21 104 0x36 | |
737 | * 22 98 0x36 | |
738 | * 23 110 0x35 | |
739 | * 24 104 0x35 | |
740 | * 25 98 0x35 | |
741 | * 26 110 0x34 | |
742 | * 27 104 0x34 | |
743 | * 28 98 0x34 | |
744 | * 29 110 0x33 | |
745 | * 30 104 0x33 | |
746 | * 31 98 0x33 | |
747 | * 32 110 0x32 | |
748 | * 33 104 0x32 | |
749 | * 34 98 0x32 | |
750 | * 35 110 0x31 | |
751 | * 36 104 0x31 | |
752 | * 37 98 0x31 | |
753 | * 38 110 0x30 | |
754 | * 39 104 0x30 | |
755 | * 40 98 0x30 | |
756 | * 41 110 0x25 | |
757 | * 42 104 0x25 | |
758 | * 43 98 0x25 | |
759 | * 44 110 0x24 | |
760 | * 45 104 0x24 | |
761 | * 46 98 0x24 | |
762 | * 47 110 0x23 | |
763 | * 48 104 0x23 | |
764 | * 49 98 0x23 | |
765 | * 50 110 0x22 | |
766 | * 51 104 0x18 | |
767 | * 52 98 0x18 | |
768 | * 53 110 0x17 | |
769 | * 54 104 0x17 | |
770 | * 55 98 0x17 | |
771 | * 56 110 0x16 | |
772 | * 57 104 0x16 | |
773 | * 58 98 0x16 | |
774 | * 59 110 0x15 | |
775 | * 60 104 0x15 | |
776 | * 61 98 0x15 | |
777 | * 62 110 0x14 | |
778 | * 63 104 0x14 | |
779 | * 64 98 0x14 | |
780 | * 65 110 0x13 | |
781 | * 66 104 0x13 | |
782 | * 67 98 0x13 | |
783 | * 68 110 0x12 | |
784 | * 69 104 0x08 | |
785 | * 70 98 0x08 | |
786 | * 71 110 0x07 | |
787 | * 72 104 0x07 | |
788 | * 73 98 0x07 | |
789 | * 74 110 0x06 | |
790 | * 75 104 0x06 | |
791 | * 76 98 0x06 | |
792 | * 77 110 0x05 | |
793 | * 78 104 0x05 | |
794 | * 79 98 0x05 | |
795 | * 80 110 0x04 | |
796 | * 81 104 0x04 | |
797 | * 82 98 0x04 | |
798 | * 83 110 0x03 | |
799 | * 84 104 0x03 | |
800 | * 85 98 0x03 | |
801 | * 86 110 0x02 | |
802 | * 87 104 0x02 | |
803 | * 88 98 0x02 | |
804 | * 89 110 0x01 | |
805 | * 90 104 0x01 | |
806 | * 91 98 0x01 | |
807 | * 92 110 0x00 | |
808 | * 93 104 0x00 | |
809 | * 94 98 0x00 | |
810 | * 95 93 0x00 | |
811 | * 96 88 0x00 | |
812 | * 97 83 0x00 | |
813 | * 98 78 0x00 | |
814 | */ | |
815 | ||
816 | ||
817 | /** | |
818 | * Sanity checks and default values for EEPROM regulatory levels. | |
819 | * If EEPROM values fall outside MIN/MAX range, use default values. | |
820 | * | |
821 | * Regulatory limits refer to the maximum average txpower allowed by | |
822 | * regulatory agencies in the geographies in which the device is meant | |
823 | * to be operated. These limits are SKU-specific (i.e. geography-specific), | |
824 | * and channel-specific; each channel has an individual regulatory limit | |
825 | * listed in the EEPROM. | |
826 | * | |
827 | * Units are in half-dBm (i.e. "34" means 17 dBm). | |
828 | */ | |
e2ebc833 SG |
829 | #define IL_TX_POWER_DEFAULT_REGULATORY_24 (34) |
830 | #define IL_TX_POWER_DEFAULT_REGULATORY_52 (34) | |
831 | #define IL_TX_POWER_REGULATORY_MIN (0) | |
832 | #define IL_TX_POWER_REGULATORY_MAX (34) | |
4bc85c13 WYG |
833 | |
834 | /** | |
835 | * Sanity checks and default values for EEPROM saturation levels. | |
836 | * If EEPROM values fall outside MIN/MAX range, use default values. | |
837 | * | |
838 | * Saturation is the highest level that the output power amplifier can produce | |
839 | * without significant clipping distortion. This is a "peak" power level. | |
840 | * Different types of modulation (i.e. various "rates", and OFDM vs. CCK) | |
841 | * require differing amounts of backoff, relative to their average power output, | |
842 | * in order to avoid clipping distortion. | |
843 | * | |
844 | * Driver must make sure that it is violating neither the saturation limit, | |
845 | * nor the regulatory limit, when calculating Tx power settings for various | |
846 | * rates. | |
847 | * | |
848 | * Units are in half-dBm (i.e. "38" means 19 dBm). | |
849 | */ | |
e2ebc833 SG |
850 | #define IL_TX_POWER_DEFAULT_SATURATION_24 (38) |
851 | #define IL_TX_POWER_DEFAULT_SATURATION_52 (38) | |
852 | #define IL_TX_POWER_SATURATION_MIN (20) | |
853 | #define IL_TX_POWER_SATURATION_MAX (50) | |
4bc85c13 WYG |
854 | |
855 | /** | |
856 | * Channel groups used for Tx Attenuation calibration (MIMO tx channel balance) | |
857 | * and thermal Txpower calibration. | |
858 | * | |
859 | * When calculating txpower, driver must compensate for current device | |
860 | * temperature; higher temperature requires higher gain. Driver must calculate | |
861 | * current temperature (see "4965 temperature calculation"), then compare vs. | |
862 | * factory calibration temperature in EEPROM; if current temperature is higher | |
863 | * than factory temperature, driver must *increase* gain by proportions shown | |
864 | * in table below. If current temperature is lower than factory, driver must | |
865 | * *decrease* gain. | |
866 | * | |
867 | * Different frequency ranges require different compensation, as shown below. | |
868 | */ | |
869 | /* Group 0, 5.2 GHz ch 34-43: 4.5 degrees per 1/2 dB. */ | |
e2ebc833 SG |
870 | #define CALIB_IL_TX_ATTEN_GR1_FCH 34 |
871 | #define CALIB_IL_TX_ATTEN_GR1_LCH 43 | |
4bc85c13 WYG |
872 | |
873 | /* Group 1, 5.3 GHz ch 44-70: 4.0 degrees per 1/2 dB. */ | |
e2ebc833 SG |
874 | #define CALIB_IL_TX_ATTEN_GR2_FCH 44 |
875 | #define CALIB_IL_TX_ATTEN_GR2_LCH 70 | |
4bc85c13 WYG |
876 | |
877 | /* Group 2, 5.5 GHz ch 71-124: 4.0 degrees per 1/2 dB. */ | |
e2ebc833 SG |
878 | #define CALIB_IL_TX_ATTEN_GR3_FCH 71 |
879 | #define CALIB_IL_TX_ATTEN_GR3_LCH 124 | |
4bc85c13 WYG |
880 | |
881 | /* Group 3, 5.7 GHz ch 125-200: 4.0 degrees per 1/2 dB. */ | |
e2ebc833 SG |
882 | #define CALIB_IL_TX_ATTEN_GR4_FCH 125 |
883 | #define CALIB_IL_TX_ATTEN_GR4_LCH 200 | |
4bc85c13 WYG |
884 | |
885 | /* Group 4, 2.4 GHz all channels: 3.5 degrees per 1/2 dB. */ | |
e2ebc833 SG |
886 | #define CALIB_IL_TX_ATTEN_GR5_FCH 1 |
887 | #define CALIB_IL_TX_ATTEN_GR5_LCH 20 | |
4bc85c13 WYG |
888 | |
889 | enum { | |
890 | CALIB_CH_GROUP_1 = 0, | |
891 | CALIB_CH_GROUP_2 = 1, | |
892 | CALIB_CH_GROUP_3 = 2, | |
893 | CALIB_CH_GROUP_4 = 3, | |
894 | CALIB_CH_GROUP_5 = 4, | |
895 | CALIB_CH_GROUP_MAX | |
896 | }; | |
897 | ||
898 | /********************* END TXPOWER *****************************************/ | |
899 | ||
900 | ||
901 | /** | |
902 | * Tx/Rx Queues | |
903 | * | |
904 | * Most communication between driver and 4965 is via queues of data buffers. | |
905 | * For example, all commands that the driver issues to device's embedded | |
906 | * controller (uCode) are via the command queue (one of the Tx queues). All | |
907 | * uCode command responses/replies/notifications, including Rx frames, are | |
908 | * conveyed from uCode to driver via the Rx queue. | |
909 | * | |
910 | * Most support for these queues, including handshake support, resides in | |
911 | * structures in host DRAM, shared between the driver and the device. When | |
912 | * allocating this memory, the driver must make sure that data written by | |
913 | * the host CPU updates DRAM immediately (and does not get "stuck" in CPU's | |
914 | * cache memory), so DRAM and cache are consistent, and the device can | |
915 | * immediately see changes made by the driver. | |
916 | * | |
917 | * 4965 supports up to 16 DRAM-based Tx queues, and services these queues via | |
918 | * up to 7 DMA channels (FIFOs). Each Tx queue is supported by a circular array | |
919 | * in DRAM containing 256 Transmit Frame Descriptors (TFDs). | |
920 | */ | |
d3175167 SG |
921 | #define IL49_NUM_FIFOS 7 |
922 | #define IL49_CMD_FIFO_NUM 4 | |
923 | #define IL49_NUM_QUEUES 16 | |
924 | #define IL49_NUM_AMPDU_QUEUES 8 | |
4bc85c13 WYG |
925 | |
926 | ||
927 | /** | |
e2ebc833 | 928 | * struct il4965_schedq_bc_tbl |
4bc85c13 WYG |
929 | * |
930 | * Byte Count table | |
931 | * | |
932 | * Each Tx queue uses a byte-count table containing 320 entries: | |
933 | * one 16-bit entry for each of 256 TFDs, plus an additional 64 entries that | |
6ce1dc45 SG |
934 | * duplicate the first 64 entries (to avoid wrap-around within a Tx win; |
935 | * max Tx win is 64 TFDs). | |
4bc85c13 WYG |
936 | * |
937 | * When driver sets up a new TFD, it must also enter the total byte count | |
938 | * of the frame to be transmitted into the corresponding entry in the byte | |
0c2c8852 SG |
939 | * count table for the chosen Tx queue. If the TFD idx is 0-63, the driver |
940 | * must duplicate the byte count entry in corresponding idx 256-319. | |
4bc85c13 WYG |
941 | * |
942 | * padding puts each byte count table on a 1024-byte boundary; | |
943 | * 4965 assumes tables are separated by 1024 bytes. | |
944 | */ | |
e2ebc833 | 945 | struct il4965_scd_bc_tbl { |
4bc85c13 WYG |
946 | __le16 tfd_offset[TFD_QUEUE_BC_SIZE]; |
947 | u8 pad[1024 - (TFD_QUEUE_BC_SIZE) * sizeof(__le16)]; | |
948 | } __packed; | |
949 | ||
be663ab6 | 950 | |
d3175167 | 951 | #define IL4965_RTC_INST_LOWER_BOUND (0x000000) |
be663ab6 WYG |
952 | |
953 | /* RSSI to dBm */ | |
d3175167 | 954 | #define IL4965_RSSI_OFFSET 44 |
be663ab6 WYG |
955 | |
956 | /* PCI registers */ | |
957 | #define PCI_CFG_RETRY_TIMEOUT 0x041 | |
958 | ||
959 | /* PCI register values */ | |
960 | #define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01 | |
961 | #define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02 | |
962 | ||
d3175167 | 963 | #define IL4965_DEFAULT_TX_RETRY 15 |
be663ab6 | 964 | |
be663ab6 | 965 | /* EEPROM */ |
d3175167 | 966 | #define IL4965_FIRST_AMPDU_QUEUE 10 |
be663ab6 | 967 | |
af038f40 SG |
968 | /* Calibration */ |
969 | void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp); | |
970 | void il4965_sensitivity_calibration(struct il_priv *il, void *resp); | |
971 | void il4965_init_sensitivity(struct il_priv *il); | |
972 | void il4965_reset_run_time_calib(struct il_priv *il); | |
973 | void il4965_calib_free_results(struct il_priv *il); | |
974 | ||
975 | /* Debug */ | |
976 | #ifdef CONFIG_IWLEGACY_DEBUGFS | |
977 | ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, | |
978 | size_t count, loff_t *ppos); | |
979 | ssize_t il4965_ucode_tx_stats_read(struct file *file, char __user *user_buf, | |
980 | size_t count, loff_t *ppos); | |
981 | ssize_t il4965_ucode_general_stats_read(struct file *file, | |
982 | char __user *user_buf, size_t count, loff_t *ppos); | |
983 | #else | |
984 | static ssize_t | |
985 | il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, | |
986 | size_t count, loff_t *ppos) | |
987 | { | |
988 | return 0; | |
989 | } | |
990 | static ssize_t | |
991 | il4965_ucode_tx_stats_read(struct file *file, char __user *user_buf, | |
992 | size_t count, loff_t *ppos) | |
993 | { | |
994 | return 0; | |
995 | } | |
996 | static ssize_t | |
997 | il4965_ucode_general_stats_read(struct file *file, char __user *user_buf, | |
998 | size_t count, loff_t *ppos) | |
999 | { | |
1000 | return 0; | |
1001 | } | |
1002 | #endif | |
be663ab6 | 1003 | |
af038f40 | 1004 | #endif /* __il_4965_h__ */ |