aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1271.h
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/wireless/wl12xx/wl1271.h
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271.h')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h150
1 files changed, 120 insertions, 30 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 55818f94017b..97ea5096bc8c 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -32,6 +32,8 @@
32#include <linux/bitops.h> 32#include <linux/bitops.h>
33#include <net/mac80211.h> 33#include <net/mac80211.h>
34 34
35#include "wl1271_conf.h"
36
35#define DRIVER_NAME "wl1271" 37#define DRIVER_NAME "wl1271"
36#define DRIVER_PREFIX DRIVER_NAME ": " 38#define DRIVER_PREFIX DRIVER_NAME ": "
37 39
@@ -41,7 +43,7 @@ enum {
41 DEBUG_SPI = BIT(1), 43 DEBUG_SPI = BIT(1),
42 DEBUG_BOOT = BIT(2), 44 DEBUG_BOOT = BIT(2),
43 DEBUG_MAILBOX = BIT(3), 45 DEBUG_MAILBOX = BIT(3),
44 DEBUG_NETLINK = BIT(4), 46 DEBUG_TESTMODE = BIT(4),
45 DEBUG_EVENT = BIT(5), 47 DEBUG_EVENT = BIT(5),
46 DEBUG_TX = BIT(6), 48 DEBUG_TX = BIT(6),
47 DEBUG_RX = BIT(7), 49 DEBUG_RX = BIT(7),
@@ -97,7 +99,8 @@ enum {
97 } while (0) 99 } while (0)
98 100
99#define WL1271_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \ 101#define WL1271_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \
100 CFG_BSSID_FILTER_EN) 102 CFG_BSSID_FILTER_EN | \
103 CFG_MC_FILTER_EN)
101 104
102#define WL1271_DEFAULT_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PRSP_EN | \ 105#define WL1271_DEFAULT_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PRSP_EN | \
103 CFG_RX_MGMT_EN | CFG_RX_DATA_EN | \ 106 CFG_RX_MGMT_EN | CFG_RX_DATA_EN | \
@@ -107,11 +110,56 @@ enum {
107#define WL1271_FW_NAME "wl1271-fw.bin" 110#define WL1271_FW_NAME "wl1271-fw.bin"
108#define WL1271_NVS_NAME "wl1271-nvs.bin" 111#define WL1271_NVS_NAME "wl1271-nvs.bin"
109 112
110#define WL1271_BUSY_WORD_LEN 8 113/* NVS data structure */
114#define WL1271_NVS_SECTION_SIZE 468
115
116#define WL1271_NVS_GENERAL_PARAMS_SIZE 57
117#define WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED \
118 (WL1271_NVS_GENERAL_PARAMS_SIZE + 1)
119#define WL1271_NVS_STAT_RADIO_PARAMS_SIZE 17
120#define WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED \
121 (WL1271_NVS_STAT_RADIO_PARAMS_SIZE + 1)
122#define WL1271_NVS_DYN_RADIO_PARAMS_SIZE 65
123#define WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED \
124 (WL1271_NVS_DYN_RADIO_PARAMS_SIZE + 1)
125#define WL1271_NVS_FEM_COUNT 2
126#define WL1271_NVS_INI_SPARE_SIZE 124
127
128struct wl1271_nvs_file {
129 /* NVS section */
130 u8 nvs[WL1271_NVS_SECTION_SIZE];
131
132 /* INI section */
133 u8 general_params[WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED];
134 u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED];
135 u8 dyn_radio_params[WL1271_NVS_FEM_COUNT]
136 [WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED];
137 u8 ini_spare[WL1271_NVS_INI_SPARE_SIZE];
138} __attribute__ ((packed));
139
140/*
141 * Enable/disable 802.11a support for WL1273
142 */
143#undef WL1271_80211A_ENABLED
144
145/*
146 * FIXME: for the wl1271, a busy word count of 1 here will result in a more
147 * optimal SPI interface. There is some SPI bug however, causing RXS time outs
148 * with this mode occasionally on boot, so lets have three for now. A value of
149 * three should make sure, that the chipset will always be ready, though this
150 * will impact throughput and latencies slightly.
151 */
152#define WL1271_BUSY_WORD_CNT 3
153#define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32))
111 154
112#define WL1271_ELP_HW_STATE_ASLEEP 0 155#define WL1271_ELP_HW_STATE_ASLEEP 0
113#define WL1271_ELP_HW_STATE_IRQ 1 156#define WL1271_ELP_HW_STATE_IRQ 1
114 157
158#define WL1271_DEFAULT_BEACON_INT 100
159#define WL1271_DEFAULT_DTIM_PERIOD 1
160
161#define ACX_TX_DESCRIPTORS 32
162
115enum wl1271_state { 163enum wl1271_state {
116 WL1271_STATE_OFF, 164 WL1271_STATE_OFF,
117 WL1271_STATE_ON, 165 WL1271_STATE_ON,
@@ -134,6 +182,8 @@ struct wl1271_partition {
134struct wl1271_partition_set { 182struct wl1271_partition_set {
135 struct wl1271_partition mem; 183 struct wl1271_partition mem;
136 struct wl1271_partition reg; 184 struct wl1271_partition reg;
185 struct wl1271_partition mem2;
186 struct wl1271_partition mem3;
137}; 187};
138 188
139struct wl1271; 189struct wl1271;
@@ -251,6 +301,7 @@ struct wl1271_debugfs {
251 301
252 struct dentry *retry_count; 302 struct dentry *retry_count;
253 struct dentry *excessive_retries; 303 struct dentry *excessive_retries;
304 struct dentry *gpio_power;
254}; 305};
255 306
256#define NUM_TX_QUEUES 4 307#define NUM_TX_QUEUES 4
@@ -258,15 +309,15 @@ struct wl1271_debugfs {
258 309
259/* FW status registers */ 310/* FW status registers */
260struct wl1271_fw_status { 311struct wl1271_fw_status {
261 u32 intr; 312 __le32 intr;
262 u8 fw_rx_counter; 313 u8 fw_rx_counter;
263 u8 drv_rx_counter; 314 u8 drv_rx_counter;
264 u8 reserved; 315 u8 reserved;
265 u8 tx_results_counter; 316 u8 tx_results_counter;
266 u32 rx_pkt_descs[NUM_RX_PKT_DESC]; 317 __le32 rx_pkt_descs[NUM_RX_PKT_DESC];
267 u32 tx_released_blks[NUM_TX_QUEUES]; 318 __le32 tx_released_blks[NUM_TX_QUEUES];
268 u32 fw_localtime; 319 __le32 fw_localtime;
269 u32 padding[2]; 320 __le32 padding[2];
270} __attribute__ ((packed)); 321} __attribute__ ((packed));
271 322
272struct wl1271_rx_mem_pool_addr { 323struct wl1271_rx_mem_pool_addr {
@@ -274,6 +325,15 @@ struct wl1271_rx_mem_pool_addr {
274 u32 addr_extra; 325 u32 addr_extra;
275}; 326};
276 327
328struct wl1271_scan {
329 u8 state;
330 u8 ssid[IW_ESSID_MAX_SIZE+1];
331 size_t ssid_len;
332 u8 active;
333 u8 high_prio;
334 u8 probe_requests;
335};
336
277struct wl1271 { 337struct wl1271 {
278 struct ieee80211_hw *hw; 338 struct ieee80211_hw *hw;
279 bool mac80211_registered; 339 bool mac80211_registered;
@@ -288,10 +348,18 @@ struct wl1271 {
288 enum wl1271_state state; 348 enum wl1271_state state;
289 struct mutex mutex; 349 struct mutex mutex;
290 350
291 int physical_mem_addr; 351#define WL1271_FLAG_STA_RATES_CHANGED (0)
292 int physical_reg_addr; 352#define WL1271_FLAG_STA_ASSOCIATED (1)
293 int virtual_mem_addr; 353#define WL1271_FLAG_JOINED (2)
294 int virtual_reg_addr; 354#define WL1271_FLAG_GPIO_POWER (3)
355#define WL1271_FLAG_TX_QUEUE_STOPPED (4)
356#define WL1271_FLAG_SCANNING (5)
357#define WL1271_FLAG_IN_ELP (6)
358#define WL1271_FLAG_PSM (7)
359#define WL1271_FLAG_PSM_REQUESTED (8)
360 unsigned long flags;
361
362 struct wl1271_partition_set part;
295 363
296 struct wl1271_chip chip; 364 struct wl1271_chip chip;
297 365
@@ -300,15 +368,13 @@ struct wl1271 {
300 368
301 u8 *fw; 369 u8 *fw;
302 size_t fw_len; 370 size_t fw_len;
303 u8 *nvs; 371 struct wl1271_nvs_file *nvs;
304 size_t nvs_len;
305 372
306 u8 bssid[ETH_ALEN]; 373 u8 bssid[ETH_ALEN];
307 u8 mac_addr[ETH_ALEN]; 374 u8 mac_addr[ETH_ALEN];
308 u8 bss_type; 375 u8 bss_type;
309 u8 ssid[IW_ESSID_MAX_SIZE + 1]; 376 u8 ssid[IW_ESSID_MAX_SIZE + 1];
310 u8 ssid_len; 377 u8 ssid_len;
311 u8 listen_int;
312 int channel; 378 int channel;
313 379
314 struct wl1271_acx_mem_map *target_mem_map; 380 struct wl1271_acx_mem_map *target_mem_map;
@@ -329,13 +395,16 @@ struct wl1271 {
329 395
330 /* Frames scheduled for transmission, not handled yet */ 396 /* Frames scheduled for transmission, not handled yet */
331 struct sk_buff_head tx_queue; 397 struct sk_buff_head tx_queue;
332 bool tx_queue_stopped;
333 398
334 struct work_struct tx_work; 399 struct work_struct tx_work;
335 struct work_struct filter_work;
336 400
337 /* Pending TX frames */ 401 /* Pending TX frames */
338 struct sk_buff *tx_frames[16]; 402 struct sk_buff *tx_frames[ACX_TX_DESCRIPTORS];
403
404 /* Security sequence number counters */
405 u8 tx_security_last_seq;
406 u16 tx_security_seq_16;
407 u32 tx_security_seq_32;
339 408
340 /* FW Rx counter */ 409 /* FW Rx counter */
341 u32 rx_counter; 410 u32 rx_counter;
@@ -353,27 +422,30 @@ struct wl1271 {
353 u32 mbox_ptr[2]; 422 u32 mbox_ptr[2];
354 423
355 /* Are we currently scanning */ 424 /* Are we currently scanning */
356 bool scanning; 425 struct wl1271_scan scan;
357 426
358 /* Our association ID */ 427 /* Our association ID */
359 u16 aid; 428 u16 aid;
360 429
430 /* currently configured rate set */
431 u32 sta_rate_set;
432 u32 basic_rate_set;
433 u32 rate_set;
434
435 /* The current band */
436 enum ieee80211_band band;
437
361 /* Default key (for WEP) */ 438 /* Default key (for WEP) */
362 u32 default_key; 439 u32 default_key;
363 440
364 unsigned int rx_config; 441 unsigned int rx_config;
365 unsigned int rx_filter; 442 unsigned int rx_filter;
366 443
367 /* is firmware in elp mode */
368 bool elp;
369
370 struct completion *elp_compl; 444 struct completion *elp_compl;
445 struct delayed_work elp_work;
371 446
372 /* we can be in psm, but not in elp, we have to differentiate */ 447 /* retry counter for PSM entries */
373 bool psm; 448 u8 psm_entry_retry;
374
375 /* PSM mode requested */
376 bool psm_requested;
377 449
378 /* in dBm */ 450 /* in dBm */
379 int power_level; 451 int power_level;
@@ -383,11 +455,17 @@ struct wl1271 {
383 455
384 u32 buffer_32; 456 u32 buffer_32;
385 u32 buffer_cmd; 457 u32 buffer_cmd;
386 u8 buffer_busyword[WL1271_BUSY_WORD_LEN]; 458 u32 buffer_busyword[WL1271_BUSY_WORD_CNT];
387 struct wl1271_rx_descriptor *rx_descriptor;
388 459
389 struct wl1271_fw_status *fw_status; 460 struct wl1271_fw_status *fw_status;
390 struct wl1271_tx_hw_res_if *tx_res_if; 461 struct wl1271_tx_hw_res_if *tx_res_if;
462
463 struct ieee80211_vif *vif;
464
465 /* Current chipset configuration */
466 struct conf_drv_settings conf;
467
468 struct list_head list;
391}; 469};
392 470
393int wl1271_plt_start(struct wl1271 *wl); 471int wl1271_plt_start(struct wl1271 *wl);
@@ -401,7 +479,19 @@ int wl1271_plt_stop(struct wl1271 *wl);
401 479
402#define WL1271_TX_QUEUE_MAX_LENGTH 20 480#define WL1271_TX_QUEUE_MAX_LENGTH 20
403 481
404/* WL1271 needs a 200ms sleep after power on */ 482/* WL1271 needs a 200ms sleep after power on, and a 20ms sleep before power
483 on in case is has been shut down shortly before */
484#define WL1271_PRE_POWER_ON_SLEEP 20 /* in miliseconds */
405#define WL1271_POWER_ON_SLEEP 200 /* in miliseconds */ 485#define WL1271_POWER_ON_SLEEP 200 /* in miliseconds */
406 486
487static inline bool wl1271_11a_enabled(void)
488{
489 /* FIXME: this could be determined based on the NVS-INI file */
490#ifdef WL1271_80211A_ENABLED
491 return true;
492#else
493 return false;
494#endif
495}
496
407#endif 497#endif