diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2011-08-31 08:04:45 -0400 |
---|---|---|
committer | Stanislaw Gruszka <sgruszka@redhat.com> | 2011-11-15 08:20:23 -0500 |
commit | 47ef694dd47b1e97a0d766f3c74067bab3debfa5 (patch) | |
tree | 29f0b10ee8ee17e59ac3c3c7768d0be1e5f48ce1 /drivers/net/wireless/iwlegacy/common.h | |
parent | 99412002a07b63781adfc3d1272d3677841d4170 (diff) |
iwlegacy: merge iwl-{eeprom,led}.h into common.h
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy/common.h')
-rw-r--r-- | drivers/net/wireless/iwlegacy/common.h | 307 |
1 files changed, 303 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index 65c593d34bf0..8e4450edfa74 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h | |||
@@ -31,14 +31,13 @@ | |||
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/leds.h> | 32 | #include <linux/leds.h> |
33 | #include <linux/wait.h> | 33 | #include <linux/wait.h> |
34 | #include <net/mac80211.h> | ||
34 | #include <net/ieee80211_radiotap.h> | 35 | #include <net/ieee80211_radiotap.h> |
35 | 36 | ||
36 | #include "commands.h" | 37 | #include "commands.h" |
37 | #include "iwl-eeprom.h" | ||
38 | #include "csr.h" | 38 | #include "csr.h" |
39 | #include "iwl-prph.h" | 39 | #include "iwl-prph.h" |
40 | #include "iwl-debug.h" | 40 | #include "iwl-debug.h" |
41 | #include "iwl-led.h" | ||
42 | 41 | ||
43 | struct il_host_cmd; | 42 | struct il_host_cmd; |
44 | struct il_cmd; | 43 | struct il_cmd; |
@@ -178,6 +177,281 @@ struct il_tx_queue { | |||
178 | u8 swq_id; | 177 | u8 swq_id; |
179 | }; | 178 | }; |
180 | 179 | ||
180 | /* | ||
181 | * EEPROM access time values: | ||
182 | * | ||
183 | * Driver initiates EEPROM read by writing byte address << 1 to CSR_EEPROM_REG. | ||
184 | * Driver then polls CSR_EEPROM_REG for CSR_EEPROM_REG_READ_VALID_MSK (0x1). | ||
185 | * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec. | ||
186 | * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG. | ||
187 | */ | ||
188 | #define IL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ | ||
189 | |||
190 | #define IL_EEPROM_SEM_TIMEOUT 10 /* microseconds */ | ||
191 | #define IL_EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ | ||
192 | |||
193 | |||
194 | /* | ||
195 | * Regulatory channel usage flags in EEPROM struct il4965_eeprom_channel.flags. | ||
196 | * | ||
197 | * IBSS and/or AP operation is allowed *only* on those channels with | ||
198 | * (VALID && IBSS && ACTIVE && !RADAR). This restriction is in place because | ||
199 | * RADAR detection is not supported by the 4965 driver, but is a | ||
200 | * requirement for establishing a new network for legal operation on channels | ||
201 | * requiring RADAR detection or restricting ACTIVE scanning. | ||
202 | * | ||
203 | * NOTE: "WIDE" flag does not indicate anything about "HT40" 40 MHz channels. | ||
204 | * It only indicates that 20 MHz channel use is supported; HT40 channel | ||
205 | * usage is indicated by a separate set of regulatory flags for each | ||
206 | * HT40 channel pair. | ||
207 | * | ||
208 | * NOTE: Using a channel inappropriately will result in a uCode error! | ||
209 | */ | ||
210 | #define IL_NUM_TX_CALIB_GROUPS 5 | ||
211 | enum { | ||
212 | EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */ | ||
213 | EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */ | ||
214 | /* Bit 2 Reserved */ | ||
215 | EEPROM_CHANNEL_ACTIVE = (1 << 3), /* active scanning allowed */ | ||
216 | EEPROM_CHANNEL_RADAR = (1 << 4), /* radar detection required */ | ||
217 | EEPROM_CHANNEL_WIDE = (1 << 5), /* 20 MHz channel okay */ | ||
218 | /* Bit 6 Reserved (was Narrow Channel) */ | ||
219 | EEPROM_CHANNEL_DFS = (1 << 7), /* dynamic freq selection candidate */ | ||
220 | }; | ||
221 | |||
222 | /* SKU Capabilities */ | ||
223 | /* 3945 only */ | ||
224 | #define EEPROM_SKU_CAP_SW_RF_KILL_ENABLE (1 << 0) | ||
225 | #define EEPROM_SKU_CAP_HW_RF_KILL_ENABLE (1 << 1) | ||
226 | |||
227 | /* *regulatory* channel data format in eeprom, one for each channel. | ||
228 | * There are separate entries for HT40 (40 MHz) vs. normal (20 MHz) channels. */ | ||
229 | struct il_eeprom_channel { | ||
230 | u8 flags; /* EEPROM_CHANNEL_* flags copied from EEPROM */ | ||
231 | s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ | ||
232 | } __packed; | ||
233 | |||
234 | /* 3945 Specific */ | ||
235 | #define EEPROM_3945_EEPROM_VERSION (0x2f) | ||
236 | |||
237 | /* 4965 has two radio transmitters (and 3 radio receivers) */ | ||
238 | #define EEPROM_TX_POWER_TX_CHAINS (2) | ||
239 | |||
240 | /* 4965 has room for up to 8 sets of txpower calibration data */ | ||
241 | #define EEPROM_TX_POWER_BANDS (8) | ||
242 | |||
243 | /* 4965 factory calibration measures txpower gain settings for | ||
244 | * each of 3 target output levels */ | ||
245 | #define EEPROM_TX_POWER_MEASUREMENTS (3) | ||
246 | |||
247 | /* 4965 Specific */ | ||
248 | /* 4965 driver does not work with txpower calibration version < 5 */ | ||
249 | #define EEPROM_4965_TX_POWER_VERSION (5) | ||
250 | #define EEPROM_4965_EEPROM_VERSION (0x2f) | ||
251 | #define EEPROM_4965_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */ | ||
252 | #define EEPROM_4965_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */ | ||
253 | #define EEPROM_4965_BOARD_REVISION (2*0x4F) /* 2 bytes */ | ||
254 | #define EEPROM_4965_BOARD_PBA (2*0x56+1) /* 9 bytes */ | ||
255 | |||
256 | /* 2.4 GHz */ | ||
257 | extern const u8 il_eeprom_band_1[14]; | ||
258 | |||
259 | /* | ||
260 | * factory calibration data for one txpower level, on one channel, | ||
261 | * measured on one of the 2 tx chains (radio transmitter and associated | ||
262 | * antenna). EEPROM contains: | ||
263 | * | ||
264 | * 1) Temperature (degrees Celsius) of device when measurement was made. | ||
265 | * | ||
266 | * 2) Gain table idx used to achieve the target measurement power. | ||
267 | * This refers to the "well-known" gain tables (see 4965.h). | ||
268 | * | ||
269 | * 3) Actual measured output power, in half-dBm ("34" = 17 dBm). | ||
270 | * | ||
271 | * 4) RF power amplifier detector level measurement (not used). | ||
272 | */ | ||
273 | struct il_eeprom_calib_measure { | ||
274 | u8 temperature; /* Device temperature (Celsius) */ | ||
275 | u8 gain_idx; /* Index into gain table */ | ||
276 | u8 actual_pow; /* Measured RF output power, half-dBm */ | ||
277 | s8 pa_det; /* Power amp detector level (not used) */ | ||
278 | } __packed; | ||
279 | |||
280 | |||
281 | /* | ||
282 | * measurement set for one channel. EEPROM contains: | ||
283 | * | ||
284 | * 1) Channel number measured | ||
285 | * | ||
286 | * 2) Measurements for each of 3 power levels for each of 2 radio transmitters | ||
287 | * (a.k.a. "tx chains") (6 measurements altogether) | ||
288 | */ | ||
289 | struct il_eeprom_calib_ch_info { | ||
290 | u8 ch_num; | ||
291 | struct il_eeprom_calib_measure | ||
292 | measurements[EEPROM_TX_POWER_TX_CHAINS] | ||
293 | [EEPROM_TX_POWER_MEASUREMENTS]; | ||
294 | } __packed; | ||
295 | |||
296 | /* | ||
297 | * txpower subband info. | ||
298 | * | ||
299 | * For each frequency subband, EEPROM contains the following: | ||
300 | * | ||
301 | * 1) First and last channels within range of the subband. "0" values | ||
302 | * indicate that this sample set is not being used. | ||
303 | * | ||
304 | * 2) Sample measurement sets for 2 channels close to the range endpoints. | ||
305 | */ | ||
306 | struct il_eeprom_calib_subband_info { | ||
307 | u8 ch_from; /* channel number of lowest channel in subband */ | ||
308 | u8 ch_to; /* channel number of highest channel in subband */ | ||
309 | struct il_eeprom_calib_ch_info ch1; | ||
310 | struct il_eeprom_calib_ch_info ch2; | ||
311 | } __packed; | ||
312 | |||
313 | |||
314 | /* | ||
315 | * txpower calibration info. EEPROM contains: | ||
316 | * | ||
317 | * 1) Factory-measured saturation power levels (maximum levels at which | ||
318 | * tx power amplifier can output a signal without too much distortion). | ||
319 | * There is one level for 2.4 GHz band and one for 5 GHz band. These | ||
320 | * values apply to all channels within each of the bands. | ||
321 | * | ||
322 | * 2) Factory-measured power supply voltage level. This is assumed to be | ||
323 | * constant (i.e. same value applies to all channels/bands) while the | ||
324 | * factory measurements are being made. | ||
325 | * | ||
326 | * 3) Up to 8 sets of factory-measured txpower calibration values. | ||
327 | * These are for different frequency ranges, since txpower gain | ||
328 | * characteristics of the analog radio circuitry vary with frequency. | ||
329 | * | ||
330 | * Not all sets need to be filled with data; | ||
331 | * struct il_eeprom_calib_subband_info contains range of channels | ||
332 | * (0 if unused) for each set of data. | ||
333 | */ | ||
334 | struct il_eeprom_calib_info { | ||
335 | u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ | ||
336 | u8 saturation_power52; /* half-dBm */ | ||
337 | __le16 voltage; /* signed */ | ||
338 | struct il_eeprom_calib_subband_info | ||
339 | band_info[EEPROM_TX_POWER_BANDS]; | ||
340 | } __packed; | ||
341 | |||
342 | |||
343 | /* General */ | ||
344 | #define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ | ||
345 | #define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */ | ||
346 | #define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */ | ||
347 | #define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */ | ||
348 | #define EEPROM_VERSION (2*0x44) /* 2 bytes */ | ||
349 | #define EEPROM_SKU_CAP (2*0x45) /* 2 bytes */ | ||
350 | #define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */ | ||
351 | #define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */ | ||
352 | #define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */ | ||
353 | #define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */ | ||
354 | |||
355 | /* The following masks are to be applied on EEPROM_RADIO_CONFIG */ | ||
356 | #define EEPROM_RF_CFG_TYPE_MSK(x) (x & 0x3) /* bits 0-1 */ | ||
357 | #define EEPROM_RF_CFG_STEP_MSK(x) ((x >> 2) & 0x3) /* bits 2-3 */ | ||
358 | #define EEPROM_RF_CFG_DASH_MSK(x) ((x >> 4) & 0x3) /* bits 4-5 */ | ||
359 | #define EEPROM_RF_CFG_PNUM_MSK(x) ((x >> 6) & 0x3) /* bits 6-7 */ | ||
360 | #define EEPROM_RF_CFG_TX_ANT_MSK(x) ((x >> 8) & 0xF) /* bits 8-11 */ | ||
361 | #define EEPROM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF) /* bits 12-15 */ | ||
362 | |||
363 | #define EEPROM_3945_RF_CFG_TYPE_MAX 0x0 | ||
364 | #define EEPROM_4965_RF_CFG_TYPE_MAX 0x1 | ||
365 | |||
366 | /* | ||
367 | * Per-channel regulatory data. | ||
368 | * | ||
369 | * Each channel that *might* be supported by iwl has a fixed location | ||
370 | * in EEPROM containing EEPROM_CHANNEL_* usage flags (LSB) and max regulatory | ||
371 | * txpower (MSB). | ||
372 | * | ||
373 | * Entries immediately below are for 20 MHz channel width. HT40 (40 MHz) | ||
374 | * channels (only for 4965, not supported by 3945) appear later in the EEPROM. | ||
375 | * | ||
376 | * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 | ||
377 | */ | ||
378 | #define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */ | ||
379 | #define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */ | ||
380 | #define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */ | ||
381 | |||
382 | /* | ||
383 | * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196, | ||
384 | * 5.0 GHz channels 7, 8, 11, 12, 16 | ||
385 | * (4915-5080MHz) (none of these is ever supported) | ||
386 | */ | ||
387 | #define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */ | ||
388 | #define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */ | ||
389 | |||
390 | /* | ||
391 | * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 | ||
392 | * (5170-5320MHz) | ||
393 | */ | ||
394 | #define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */ | ||
395 | #define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */ | ||
396 | |||
397 | /* | ||
398 | * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 | ||
399 | * (5500-5700MHz) | ||
400 | */ | ||
401 | #define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */ | ||
402 | #define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */ | ||
403 | |||
404 | /* | ||
405 | * 5.7 GHz channels 145, 149, 153, 157, 161, 165 | ||
406 | * (5725-5825MHz) | ||
407 | */ | ||
408 | #define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */ | ||
409 | #define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */ | ||
410 | |||
411 | /* | ||
412 | * 2.4 GHz HT40 channels 1 (5), 2 (6), 3 (7), 4 (8), 5 (9), 6 (10), 7 (11) | ||
413 | * | ||
414 | * The channel listed is the center of the lower 20 MHz half of the channel. | ||
415 | * The overall center frequency is actually 2 channels (10 MHz) above that, | ||
416 | * and the upper half of each HT40 channel is centered 4 channels (20 MHz) away | ||
417 | * from the lower half; e.g. the upper half of HT40 channel 1 is channel 5, | ||
418 | * and the overall HT40 channel width centers on channel 3. | ||
419 | * | ||
420 | * NOTE: The RXON command uses 20 MHz channel numbers to specify the | ||
421 | * control channel to which to tune. RXON also specifies whether the | ||
422 | * control channel is the upper or lower half of a HT40 channel. | ||
423 | * | ||
424 | * NOTE: 4965 does not support HT40 channels on 2.4 GHz. | ||
425 | */ | ||
426 | #define EEPROM_4965_REGULATORY_BAND_24_HT40_CHANNELS (2*0xA0) /* 14 bytes */ | ||
427 | |||
428 | /* | ||
429 | * 5.2 GHz HT40 channels 36 (40), 44 (48), 52 (56), 60 (64), | ||
430 | * 100 (104), 108 (112), 116 (120), 124 (128), 132 (136), 149 (153), 157 (161) | ||
431 | */ | ||
432 | #define EEPROM_4965_REGULATORY_BAND_52_HT40_CHANNELS (2*0xA8) /* 22 bytes */ | ||
433 | |||
434 | #define EEPROM_REGULATORY_BAND_NO_HT40 (0) | ||
435 | |||
436 | struct il_eeprom_ops { | ||
437 | const u32 regulatory_bands[7]; | ||
438 | int (*acquire_semaphore) (struct il_priv *il); | ||
439 | void (*release_semaphore) (struct il_priv *il); | ||
440 | }; | ||
441 | |||
442 | |||
443 | int il_eeprom_init(struct il_priv *il); | ||
444 | void il_eeprom_free(struct il_priv *il); | ||
445 | const u8 *il_eeprom_query_addr(const struct il_priv *il, | ||
446 | size_t offset); | ||
447 | u16 il_eeprom_query16(const struct il_priv *il, size_t offset); | ||
448 | int il_init_channel_map(struct il_priv *il); | ||
449 | void il_free_channel_map(struct il_priv *il); | ||
450 | const struct il_channel_info *il_get_channel_info( | ||
451 | const struct il_priv *il, | ||
452 | enum ieee80211_band band, u16 channel); | ||
453 | |||
454 | |||
181 | #define IL_NUM_SCAN_RATES (2) | 455 | #define IL_NUM_SCAN_RATES (2) |
182 | 456 | ||
183 | struct il4965_channel_tgd_info { | 457 | struct il4965_channel_tgd_info { |
@@ -1329,6 +1603,7 @@ il_is_channel_ibss(const struct il_channel_info *ch) | |||
1329 | return (ch->flags & EEPROM_CHANNEL_IBSS) ? 1 : 0; | 1603 | return (ch->flags & EEPROM_CHANNEL_IBSS) ? 1 : 0; |
1330 | } | 1604 | } |
1331 | 1605 | ||
1606 | |||
1332 | static inline void | 1607 | static inline void |
1333 | __il_free_pages(struct il_priv *il, struct page *page) | 1608 | __il_free_pages(struct il_priv *il, struct page *page) |
1334 | { | 1609 | { |
@@ -1432,7 +1707,7 @@ struct il_lib_ops { | |||
1432 | int (*send_tx_power) (struct il_priv *il); | 1707 | int (*send_tx_power) (struct il_priv *il); |
1433 | void (*update_chain_flags)(struct il_priv *il); | 1708 | void (*update_chain_flags)(struct il_priv *il); |
1434 | 1709 | ||
1435 | /* eeprom operations (as defined in iwl-eeprom.h) */ | 1710 | /* eeprom operations */ |
1436 | struct il_eeprom_ops eeprom_ops; | 1711 | struct il_eeprom_ops eeprom_ops; |
1437 | 1712 | ||
1438 | /* temperature */ | 1713 | /* temperature */ |
@@ -1478,7 +1753,7 @@ struct il_mod_params { | |||
1478 | /* | 1753 | /* |
1479 | * @led_compensation: compensate on the led on/off time per HW according | 1754 | * @led_compensation: compensate on the led on/off time per HW according |
1480 | * to the deviation to achieve the desired led frequency. | 1755 | * to the deviation to achieve the desired led frequency. |
1481 | * The detail algorithm is described in iwl-led.c | 1756 | * The detail algorithm is described in common.c |
1482 | * @chain_noise_num_beacons: number of beacons used to compute chain noise | 1757 | * @chain_noise_num_beacons: number of beacons used to compute chain noise |
1483 | * @wd_timeout: TX queues watchdog timeout | 1758 | * @wd_timeout: TX queues watchdog timeout |
1484 | * @temperature_kelvin: temperature report by uCode in kelvin | 1759 | * @temperature_kelvin: temperature report by uCode in kelvin |
@@ -1506,6 +1781,29 @@ struct il_base_params { | |||
1506 | const bool chain_noise_calib_by_driver; | 1781 | const bool chain_noise_calib_by_driver; |
1507 | }; | 1782 | }; |
1508 | 1783 | ||
1784 | #define IL_LED_SOLID 11 | ||
1785 | #define IL_DEF_LED_INTRVL cpu_to_le32(1000) | ||
1786 | |||
1787 | #define IL_LED_ACTIVITY (0<<1) | ||
1788 | #define IL_LED_LINK (1<<1) | ||
1789 | |||
1790 | /* | ||
1791 | * LED mode | ||
1792 | * IL_LED_DEFAULT: use device default | ||
1793 | * IL_LED_RF_STATE: turn LED on/off based on RF state | ||
1794 | * LED ON = RF ON | ||
1795 | * LED OFF = RF OFF | ||
1796 | * IL_LED_BLINK: adjust led blink rate based on blink table | ||
1797 | */ | ||
1798 | enum il_led_mode { | ||
1799 | IL_LED_DEFAULT, | ||
1800 | IL_LED_RF_STATE, | ||
1801 | IL_LED_BLINK, | ||
1802 | }; | ||
1803 | |||
1804 | void il_leds_init(struct il_priv *il); | ||
1805 | void il_leds_exit(struct il_priv *il); | ||
1806 | |||
1509 | /** | 1807 | /** |
1510 | * struct il_cfg | 1808 | * struct il_cfg |
1511 | * @fw_name_pre: Firmware filename prefix. The api version and extension | 1809 | * @fw_name_pre: Firmware filename prefix. The api version and extension |
@@ -3005,4 +3303,5 @@ extern void il3945_rate_control_unregister(void); | |||
3005 | 3303 | ||
3006 | extern int il_power_update_mode(struct il_priv *il, bool force); | 3304 | extern int il_power_update_mode(struct il_priv *il, bool force); |
3007 | extern void il_power_initialize(struct il_priv *il); | 3305 | extern void il_power_initialize(struct il_priv *il); |
3306 | |||
3008 | #endif /* __il_core_h__ */ | 3307 | #endif /* __il_core_h__ */ |