aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-08-31 08:04:45 -0400
committerStanislaw Gruszka <sgruszka@redhat.com>2011-11-15 08:20:23 -0500
commit47ef694dd47b1e97a0d766f3c74067bab3debfa5 (patch)
tree29f0b10ee8ee17e59ac3c3c7768d0be1e5f48ce1 /drivers/net
parent99412002a07b63781adfc3d1272d3677841d4170 (diff)
iwlegacy: merge iwl-{eeprom,led}.h into common.h
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlegacy/3945.c3
-rw-r--r--drivers/net/wireless/iwlegacy/3945.h2
-rw-r--r--drivers/net/wireless/iwlegacy/4965-mac.c1
-rw-r--r--drivers/net/wireless/iwlegacy/4965.c1
-rw-r--r--drivers/net/wireless/iwlegacy/common.c1
-rw-r--r--drivers/net/wireless/iwlegacy/common.h307
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-eeprom.h344
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-led.h56
8 files changed, 303 insertions, 412 deletions
diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c
index 02ae32cc90de..b1ced05ab3d3 100644
--- a/drivers/net/wireless/iwlegacy/3945.c
+++ b/drivers/net/wireless/iwlegacy/3945.c
@@ -40,9 +40,6 @@
40#include <net/mac80211.h> 40#include <net/mac80211.h>
41 41
42#include "common.h" 42#include "common.h"
43#include "commands.h"
44#include "iwl-eeprom.h"
45#include "iwl-led.h"
46#include "3945.h" 43#include "3945.h"
47 44
48/* Send led command */ 45/* Send led command */
diff --git a/drivers/net/wireless/iwlegacy/3945.h b/drivers/net/wireless/iwlegacy/3945.h
index 22166bdbeeec..5e4fcbc2fab6 100644
--- a/drivers/net/wireless/iwlegacy/3945.h
+++ b/drivers/net/wireless/iwlegacy/3945.h
@@ -37,8 +37,6 @@ extern const struct pci_device_id il3945_hw_card_ids[];
37#include "common.h" 37#include "common.h"
38#include "iwl-prph.h" 38#include "iwl-prph.h"
39#include "iwl-debug.h" 39#include "iwl-debug.h"
40#include "iwl-led.h"
41#include "iwl-eeprom.h"
42 40
43/* Highest firmware API version supported */ 41/* Highest firmware API version supported */
44#define IL3945_UCODE_API_MAX 2 42#define IL3945_UCODE_API_MAX 2
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index 6848b9182a71..82b6a7b8624a 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -50,7 +50,6 @@
50 50
51#define DRV_NAME "iwl4965" 51#define DRV_NAME "iwl4965"
52 52
53#include "iwl-eeprom.h"
54#include "common.h" 53#include "common.h"
55#include "4965.h" 54#include "4965.h"
56 55
diff --git a/drivers/net/wireless/iwlegacy/4965.c b/drivers/net/wireless/iwlegacy/4965.c
index d66d4e8c1e76..4b977177d8b6 100644
--- a/drivers/net/wireless/iwlegacy/4965.c
+++ b/drivers/net/wireless/iwlegacy/4965.c
@@ -38,7 +38,6 @@
38#include <asm/unaligned.h> 38#include <asm/unaligned.h>
39 39
40#include "common.h" 40#include "common.h"
41#include "iwl-eeprom.h"
42#include "4965.h" 41#include "4965.h"
43 42
44#define IL_AC_UNSET -1 43#define IL_AC_UNSET -1
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 3b8d47c0d6b5..5d5efcb4045e 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -40,7 +40,6 @@
40#include <linux/skbuff.h> 40#include <linux/skbuff.h>
41#include <net/mac80211.h> 41#include <net/mac80211.h>
42 42
43#include "iwl-eeprom.h"
44#include "iwl-debug.h" 43#include "iwl-debug.h"
45#include "common.h" 44#include "common.h"
46 45
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
43struct il_host_cmd; 42struct il_host_cmd;
44struct il_cmd; 43struct 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
211enum {
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. */
229struct 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 */
257extern 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 */
273struct 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 */
289struct 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 */
306struct 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 */
334struct 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
436struct 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
443int il_eeprom_init(struct il_priv *il);
444void il_eeprom_free(struct il_priv *il);
445const u8 *il_eeprom_query_addr(const struct il_priv *il,
446 size_t offset);
447u16 il_eeprom_query16(const struct il_priv *il, size_t offset);
448int il_init_channel_map(struct il_priv *il);
449void il_free_channel_map(struct il_priv *il);
450const 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
183struct il4965_channel_tgd_info { 457struct 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
1332static inline void 1607static 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 */
1798enum il_led_mode {
1799 IL_LED_DEFAULT,
1800 IL_LED_RF_STATE,
1801 IL_LED_BLINK,
1802};
1803
1804void il_leds_init(struct il_priv *il);
1805void 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
3006extern int il_power_update_mode(struct il_priv *il, bool force); 3304extern int il_power_update_mode(struct il_priv *il, bool force);
3007extern void il_power_initialize(struct il_priv *il); 3305extern void il_power_initialize(struct il_priv *il);
3306
3008#endif /* __il_core_h__ */ 3307#endif /* __il_core_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.h b/drivers/net/wireless/iwlegacy/iwl-eeprom.h
deleted file mode 100644
index 61435a522c84..000000000000
--- a/drivers/net/wireless/iwlegacy/iwl-eeprom.h
+++ /dev/null
@@ -1,344 +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) 2008 - 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_eeprom_h__
64#define __il_eeprom_h__
65
66#include <net/mac80211.h>
67
68struct il_priv;
69
70/*
71 * EEPROM access time values:
72 *
73 * Driver initiates EEPROM read by writing byte address << 1 to CSR_EEPROM_REG.
74 * Driver then polls CSR_EEPROM_REG for CSR_EEPROM_REG_READ_VALID_MSK (0x1).
75 * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec.
76 * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG.
77 */
78#define IL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */
79
80#define IL_EEPROM_SEM_TIMEOUT 10 /* microseconds */
81#define IL_EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */
82
83
84/*
85 * Regulatory channel usage flags in EEPROM struct il4965_eeprom_channel.flags.
86 *
87 * IBSS and/or AP operation is allowed *only* on those channels with
88 * (VALID && IBSS && ACTIVE && !RADAR). This restriction is in place because
89 * RADAR detection is not supported by the 4965 driver, but is a
90 * requirement for establishing a new network for legal operation on channels
91 * requiring RADAR detection or restricting ACTIVE scanning.
92 *
93 * NOTE: "WIDE" flag does not indicate anything about "HT40" 40 MHz channels.
94 * It only indicates that 20 MHz channel use is supported; HT40 channel
95 * usage is indicated by a separate set of regulatory flags for each
96 * HT40 channel pair.
97 *
98 * NOTE: Using a channel inappropriately will result in a uCode error!
99 */
100#define IL_NUM_TX_CALIB_GROUPS 5
101enum {
102 EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */
103 EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */
104 /* Bit 2 Reserved */
105 EEPROM_CHANNEL_ACTIVE = (1 << 3), /* active scanning allowed */
106 EEPROM_CHANNEL_RADAR = (1 << 4), /* radar detection required */
107 EEPROM_CHANNEL_WIDE = (1 << 5), /* 20 MHz channel okay */
108 /* Bit 6 Reserved (was Narrow Channel) */
109 EEPROM_CHANNEL_DFS = (1 << 7), /* dynamic freq selection candidate */
110};
111
112/* SKU Capabilities */
113/* 3945 only */
114#define EEPROM_SKU_CAP_SW_RF_KILL_ENABLE (1 << 0)
115#define EEPROM_SKU_CAP_HW_RF_KILL_ENABLE (1 << 1)
116
117/* *regulatory* channel data format in eeprom, one for each channel.
118 * There are separate entries for HT40 (40 MHz) vs. normal (20 MHz) channels. */
119struct il_eeprom_channel {
120 u8 flags; /* EEPROM_CHANNEL_* flags copied from EEPROM */
121 s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
122} __packed;
123
124/* 3945 Specific */
125#define EEPROM_3945_EEPROM_VERSION (0x2f)
126
127/* 4965 has two radio transmitters (and 3 radio receivers) */
128#define EEPROM_TX_POWER_TX_CHAINS (2)
129
130/* 4965 has room for up to 8 sets of txpower calibration data */
131#define EEPROM_TX_POWER_BANDS (8)
132
133/* 4965 factory calibration measures txpower gain settings for
134 * each of 3 target output levels */
135#define EEPROM_TX_POWER_MEASUREMENTS (3)
136
137/* 4965 Specific */
138/* 4965 driver does not work with txpower calibration version < 5 */
139#define EEPROM_4965_TX_POWER_VERSION (5)
140#define EEPROM_4965_EEPROM_VERSION (0x2f)
141#define EEPROM_4965_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */
142#define EEPROM_4965_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */
143#define EEPROM_4965_BOARD_REVISION (2*0x4F) /* 2 bytes */
144#define EEPROM_4965_BOARD_PBA (2*0x56+1) /* 9 bytes */
145
146/* 2.4 GHz */
147extern const u8 il_eeprom_band_1[14];
148
149/*
150 * factory calibration data for one txpower level, on one channel,
151 * measured on one of the 2 tx chains (radio transmitter and associated
152 * antenna). EEPROM contains:
153 *
154 * 1) Temperature (degrees Celsius) of device when measurement was made.
155 *
156 * 2) Gain table idx used to achieve the target measurement power.
157 * This refers to the "well-known" gain tables (see 4965.h).
158 *
159 * 3) Actual measured output power, in half-dBm ("34" = 17 dBm).
160 *
161 * 4) RF power amplifier detector level measurement (not used).
162 */
163struct il_eeprom_calib_measure {
164 u8 temperature; /* Device temperature (Celsius) */
165 u8 gain_idx; /* Index into gain table */
166 u8 actual_pow; /* Measured RF output power, half-dBm */
167 s8 pa_det; /* Power amp detector level (not used) */
168} __packed;
169
170
171/*
172 * measurement set for one channel. EEPROM contains:
173 *
174 * 1) Channel number measured
175 *
176 * 2) Measurements for each of 3 power levels for each of 2 radio transmitters
177 * (a.k.a. "tx chains") (6 measurements altogether)
178 */
179struct il_eeprom_calib_ch_info {
180 u8 ch_num;
181 struct il_eeprom_calib_measure
182 measurements[EEPROM_TX_POWER_TX_CHAINS]
183 [EEPROM_TX_POWER_MEASUREMENTS];
184} __packed;
185
186/*
187 * txpower subband info.
188 *
189 * For each frequency subband, EEPROM contains the following:
190 *
191 * 1) First and last channels within range of the subband. "0" values
192 * indicate that this sample set is not being used.
193 *
194 * 2) Sample measurement sets for 2 channels close to the range endpoints.
195 */
196struct il_eeprom_calib_subband_info {
197 u8 ch_from; /* channel number of lowest channel in subband */
198 u8 ch_to; /* channel number of highest channel in subband */
199 struct il_eeprom_calib_ch_info ch1;
200 struct il_eeprom_calib_ch_info ch2;
201} __packed;
202
203
204/*
205 * txpower calibration info. EEPROM contains:
206 *
207 * 1) Factory-measured saturation power levels (maximum levels at which
208 * tx power amplifier can output a signal without too much distortion).
209 * There is one level for 2.4 GHz band and one for 5 GHz band. These
210 * values apply to all channels within each of the bands.
211 *
212 * 2) Factory-measured power supply voltage level. This is assumed to be
213 * constant (i.e. same value applies to all channels/bands) while the
214 * factory measurements are being made.
215 *
216 * 3) Up to 8 sets of factory-measured txpower calibration values.
217 * These are for different frequency ranges, since txpower gain
218 * characteristics of the analog radio circuitry vary with frequency.
219 *
220 * Not all sets need to be filled with data;
221 * struct il_eeprom_calib_subband_info contains range of channels
222 * (0 if unused) for each set of data.
223 */
224struct il_eeprom_calib_info {
225 u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */
226 u8 saturation_power52; /* half-dBm */
227 __le16 voltage; /* signed */
228 struct il_eeprom_calib_subband_info
229 band_info[EEPROM_TX_POWER_BANDS];
230} __packed;
231
232
233/* General */
234#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
235#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */
236#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */
237#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */
238#define EEPROM_VERSION (2*0x44) /* 2 bytes */
239#define EEPROM_SKU_CAP (2*0x45) /* 2 bytes */
240#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */
241#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */
242#define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */
243#define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */
244
245/* The following masks are to be applied on EEPROM_RADIO_CONFIG */
246#define EEPROM_RF_CFG_TYPE_MSK(x) (x & 0x3) /* bits 0-1 */
247#define EEPROM_RF_CFG_STEP_MSK(x) ((x >> 2) & 0x3) /* bits 2-3 */
248#define EEPROM_RF_CFG_DASH_MSK(x) ((x >> 4) & 0x3) /* bits 4-5 */
249#define EEPROM_RF_CFG_PNUM_MSK(x) ((x >> 6) & 0x3) /* bits 6-7 */
250#define EEPROM_RF_CFG_TX_ANT_MSK(x) ((x >> 8) & 0xF) /* bits 8-11 */
251#define EEPROM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF) /* bits 12-15 */
252
253#define EEPROM_3945_RF_CFG_TYPE_MAX 0x0
254#define EEPROM_4965_RF_CFG_TYPE_MAX 0x1
255
256/*
257 * Per-channel regulatory data.
258 *
259 * Each channel that *might* be supported by iwl has a fixed location
260 * in EEPROM containing EEPROM_CHANNEL_* usage flags (LSB) and max regulatory
261 * txpower (MSB).
262 *
263 * Entries immediately below are for 20 MHz channel width. HT40 (40 MHz)
264 * channels (only for 4965, not supported by 3945) appear later in the EEPROM.
265 *
266 * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
267 */
268#define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */
269#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */
270#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */
271
272/*
273 * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196,
274 * 5.0 GHz channels 7, 8, 11, 12, 16
275 * (4915-5080MHz) (none of these is ever supported)
276 */
277#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */
278#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */
279
280/*
281 * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
282 * (5170-5320MHz)
283 */
284#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */
285#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */
286
287/*
288 * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
289 * (5500-5700MHz)
290 */
291#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */
292#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */
293
294/*
295 * 5.7 GHz channels 145, 149, 153, 157, 161, 165
296 * (5725-5825MHz)
297 */
298#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */
299#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */
300
301/*
302 * 2.4 GHz HT40 channels 1 (5), 2 (6), 3 (7), 4 (8), 5 (9), 6 (10), 7 (11)
303 *
304 * The channel listed is the center of the lower 20 MHz half of the channel.
305 * The overall center frequency is actually 2 channels (10 MHz) above that,
306 * and the upper half of each HT40 channel is centered 4 channels (20 MHz) away
307 * from the lower half; e.g. the upper half of HT40 channel 1 is channel 5,
308 * and the overall HT40 channel width centers on channel 3.
309 *
310 * NOTE: The RXON command uses 20 MHz channel numbers to specify the
311 * control channel to which to tune. RXON also specifies whether the
312 * control channel is the upper or lower half of a HT40 channel.
313 *
314 * NOTE: 4965 does not support HT40 channels on 2.4 GHz.
315 */
316#define EEPROM_4965_REGULATORY_BAND_24_HT40_CHANNELS (2*0xA0) /* 14 bytes */
317
318/*
319 * 5.2 GHz HT40 channels 36 (40), 44 (48), 52 (56), 60 (64),
320 * 100 (104), 108 (112), 116 (120), 124 (128), 132 (136), 149 (153), 157 (161)
321 */
322#define EEPROM_4965_REGULATORY_BAND_52_HT40_CHANNELS (2*0xA8) /* 22 bytes */
323
324#define EEPROM_REGULATORY_BAND_NO_HT40 (0)
325
326struct il_eeprom_ops {
327 const u32 regulatory_bands[7];
328 int (*acquire_semaphore) (struct il_priv *il);
329 void (*release_semaphore) (struct il_priv *il);
330};
331
332
333int il_eeprom_init(struct il_priv *il);
334void il_eeprom_free(struct il_priv *il);
335const u8 *il_eeprom_query_addr(const struct il_priv *il,
336 size_t offset);
337u16 il_eeprom_query16(const struct il_priv *il, size_t offset);
338int il_init_channel_map(struct il_priv *il);
339void il_free_channel_map(struct il_priv *il);
340const struct il_channel_info *il_get_channel_info(
341 const struct il_priv *il,
342 enum ieee80211_band band, u16 channel);
343
344#endif /* __il_eeprom_h__ */
diff --git a/drivers/net/wireless/iwlegacy/iwl-led.h b/drivers/net/wireless/iwlegacy/iwl-led.h
deleted file mode 100644
index d3aba57feba7..000000000000
--- a/drivers/net/wireless/iwlegacy/iwl-led.h
+++ /dev/null
@@ -1,56 +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#ifndef __il_leds_h__
28#define __il_leds_h__
29
30
31struct il_priv;
32
33#define IL_LED_SOLID 11
34#define IL_DEF_LED_INTRVL cpu_to_le32(1000)
35
36#define IL_LED_ACTIVITY (0<<1)
37#define IL_LED_LINK (1<<1)
38
39/*
40 * LED mode
41 * IL_LED_DEFAULT: use device default
42 * IL_LED_RF_STATE: turn LED on/off based on RF state
43 * LED ON = RF ON
44 * LED OFF = RF OFF
45 * IL_LED_BLINK: adjust led blink rate based on blink table
46 */
47enum il_led_mode {
48 IL_LED_DEFAULT,
49 IL_LED_RF_STATE,
50 IL_LED_BLINK,
51};
52
53void il_leds_init(struct il_priv *il);
54void il_leds_exit(struct il_priv *il);
55
56#endif /* __il_leds_h__ */