blob: 6b2c763e490821acd9c350a60922d890f90b2b48 [file] [log] [blame]
Luciano Coelhof5fc0f82009-08-06 16:25:28 +03001/*
2 * This file is part of wl1271
3 *
4 * Copyright (C) 1998-2009 Texas Instruments. All rights reserved.
5 * Copyright (C) 2008-2009 Nokia Corporation
6 *
7 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
Shahar Levi00d20102010-11-08 11:20:10 +000025#ifndef __WL12XX_H__
26#define __WL12XX_H__
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030027
28#include <linux/mutex.h>
29#include <linux/completion.h>
30#include <linux/spinlock.h>
31#include <linux/list.h>
32#include <linux/bitops.h>
33#include <net/mac80211.h>
34
Shahar Levi00d20102010-11-08 11:20:10 +000035#include "conf.h"
36#include "ini.h"
Juuso Oikarinen2b60100b2009-10-13 12:47:39 +030037
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030038#define DRIVER_NAME "wl1271"
39#define DRIVER_PREFIX DRIVER_NAME ": "
40
41enum {
42 DEBUG_NONE = 0,
43 DEBUG_IRQ = BIT(0),
44 DEBUG_SPI = BIT(1),
45 DEBUG_BOOT = BIT(2),
46 DEBUG_MAILBOX = BIT(3),
Kalle Valoc8c90872010-02-18 13:25:53 +020047 DEBUG_TESTMODE = BIT(4),
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030048 DEBUG_EVENT = BIT(5),
49 DEBUG_TX = BIT(6),
50 DEBUG_RX = BIT(7),
51 DEBUG_SCAN = BIT(8),
52 DEBUG_CRYPT = BIT(9),
53 DEBUG_PSM = BIT(10),
54 DEBUG_MAC80211 = BIT(11),
55 DEBUG_CMD = BIT(12),
56 DEBUG_ACX = BIT(13),
Teemu Paasikivia3b8ea72010-03-18 12:26:41 +020057 DEBUG_SDIO = BIT(14),
Juuso Oikarinen14b228a2010-03-18 12:26:43 +020058 DEBUG_FILTERS = BIT(15),
Juuso Oikarinen5da11dc2010-03-26 12:53:24 +020059 DEBUG_ADHOC = BIT(16),
Arik Nemtsove78a2872010-10-16 19:07:21 +020060 DEBUG_AP = BIT(17),
61 DEBUG_MASTER = (DEBUG_ADHOC | DEBUG_AP),
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030062 DEBUG_ALL = ~0,
63};
64
Eliad Peller17c17552010-12-12 12:15:35 +020065extern u32 wl12xx_debug_level;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030066
67#define DEBUG_DUMP_LIMIT 1024
68
69#define wl1271_error(fmt, arg...) \
Eliad Peller17c17552010-12-12 12:15:35 +020070 pr_err(DRIVER_PREFIX "ERROR " fmt "\n", ##arg)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030071
72#define wl1271_warning(fmt, arg...) \
Eliad Peller17c17552010-12-12 12:15:35 +020073 pr_warning(DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030074
75#define wl1271_notice(fmt, arg...) \
Eliad Peller17c17552010-12-12 12:15:35 +020076 pr_info(DRIVER_PREFIX fmt "\n", ##arg)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030077
78#define wl1271_info(fmt, arg...) \
Eliad Peller17c17552010-12-12 12:15:35 +020079 pr_info(DRIVER_PREFIX fmt "\n", ##arg)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030080
81#define wl1271_debug(level, fmt, arg...) \
82 do { \
Eliad Peller17c17552010-12-12 12:15:35 +020083 if (level & wl12xx_debug_level) \
84 pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030085 } while (0)
86
Eliad Peller17c17552010-12-12 12:15:35 +020087/* TODO: use pr_debug_hex_dump when it will be available */
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030088#define wl1271_dump(level, prefix, buf, len) \
89 do { \
Eliad Peller17c17552010-12-12 12:15:35 +020090 if (level & wl12xx_debug_level) \
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030091 print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \
92 DUMP_PREFIX_OFFSET, 16, 1, \
93 buf, \
94 min_t(size_t, len, DEBUG_DUMP_LIMIT), \
95 0); \
96 } while (0)
97
98#define wl1271_dump_ascii(level, prefix, buf, len) \
99 do { \
Eliad Peller17c17552010-12-12 12:15:35 +0200100 if (level & wl12xx_debug_level) \
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300101 print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \
102 DUMP_PREFIX_OFFSET, 16, 1, \
103 buf, \
104 min_t(size_t, len, DEBUG_DUMP_LIMIT), \
105 true); \
106 } while (0)
107
Arik Nemtsovae113b52010-10-16 18:45:07 +0200108#define WL1271_DEFAULT_STA_RX_CONFIG (CFG_UNI_FILTER_EN | \
Juuso Oikarinenc87dec92009-10-08 21:56:31 +0300109 CFG_BSSID_FILTER_EN | \
110 CFG_MC_FILTER_EN)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300111
Arik Nemtsovae113b52010-10-16 18:45:07 +0200112#define WL1271_DEFAULT_STA_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PRSP_EN | \
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300113 CFG_RX_MGMT_EN | CFG_RX_DATA_EN | \
114 CFG_RX_CTL_EN | CFG_RX_BCN_EN | \
115 CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN)
116
Arik Nemtsovae113b52010-10-16 18:45:07 +0200117#define WL1271_DEFAULT_AP_RX_CONFIG 0
118
119#define WL1271_DEFAULT_AP_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PREQ_EN | \
120 CFG_RX_MGMT_EN | CFG_RX_DATA_EN | \
121 CFG_RX_CTL_EN | CFG_RX_AUTH_EN | \
122 CFG_RX_ASSOC_EN)
123
124
125
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300126#define WL1271_FW_NAME "wl1271-fw.bin"
127#define WL1271_NVS_NAME "wl1271-nvs.bin"
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200128
Juuso Oikarinen04e36fc2010-02-22 08:38:40 +0200129#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff))
130#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff))
131
Juuso Oikarinen7a557242010-09-27 12:42:07 +0200132#define WL1271_CIPHER_SUITE_GEM 0x00147201
133
Juuso Oikarinen259da432010-03-26 12:53:18 +0200134#define WL1271_BUSY_WORD_CNT 1
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300135#define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32))
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300136
137#define WL1271_ELP_HW_STATE_ASLEEP 0
138#define WL1271_ELP_HW_STATE_IRQ 1
139
Juuso Oikarinend94cd292009-10-08 21:56:25 +0300140#define WL1271_DEFAULT_BEACON_INT 100
141#define WL1271_DEFAULT_DTIM_PERIOD 1
142
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200143#define WL1271_AP_GLOBAL_HLID 0
144#define WL1271_AP_BROADCAST_HLID 1
145#define WL1271_AP_STA_HLID_START 2
146
147#define WL1271_AP_BSS_INDEX 0
148#define WL1271_AP_DEF_INACTIV_SEC 300
149#define WL1271_AP_DEF_BEACON_EXP 20
150
Juuso Oikarinenc87dec92009-10-08 21:56:31 +0300151#define ACX_TX_DESCRIPTORS 32
Juuso Oikarinenbe7078c2009-10-08 21:56:26 +0300152
Ido Yariv1f37cbc2010-09-30 13:28:27 +0200153#define WL1271_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
154
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300155enum wl1271_state {
156 WL1271_STATE_OFF,
157 WL1271_STATE_ON,
158 WL1271_STATE_PLT,
159};
160
161enum wl1271_partition_type {
162 PART_DOWN,
163 PART_WORK,
164 PART_DRPW,
165
166 PART_TABLE_LEN
167};
168
169struct wl1271_partition {
170 u32 size;
171 u32 start;
172};
173
174struct wl1271_partition_set {
175 struct wl1271_partition mem;
176 struct wl1271_partition reg;
Juuso Oikarinen451de972009-10-12 15:08:46 +0300177 struct wl1271_partition mem2;
178 struct wl1271_partition mem3;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300179};
180
181struct wl1271;
182
183/* FIXME: I'm not sure about this structure name */
184struct wl1271_chip {
185 u32 id;
186 char fw_ver[21];
187};
188
189struct wl1271_stats {
190 struct acx_statistics *fw_stats;
191 unsigned long fw_stats_update;
192
193 unsigned int retry_count;
194 unsigned int excessive_retries;
195};
196
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300197#define NUM_TX_QUEUES 4
198#define NUM_RX_PKT_DESC 8
199
Arik Nemtsovbeb6c882010-10-16 18:53:48 +0200200#define AP_MAX_STATIONS 5
201
202/* Broadcast and Global links + links to stations */
203#define AP_MAX_LINKS (AP_MAX_STATIONS + 2)
204
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300205/* FW status registers */
206struct wl1271_fw_status {
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300207 __le32 intr;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300208 u8 fw_rx_counter;
209 u8 drv_rx_counter;
210 u8 reserved;
211 u8 tx_results_counter;
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300212 __le32 rx_pkt_descs[NUM_RX_PKT_DESC];
213 __le32 tx_released_blks[NUM_TX_QUEUES];
214 __le32 fw_localtime;
Arik Nemtsovbeb6c882010-10-16 18:53:48 +0200215
216 /* Next fields valid only in AP FW */
217
218 /*
219 * A bitmap (where each bit represents a single HLID)
220 * to indicate if the station is in PS mode.
221 */
222 __le32 link_ps_bitmap;
223
224 /* Number of freed MBs per HLID */
225 u8 tx_lnk_free_blks[AP_MAX_LINKS];
226 u8 padding_1[1];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000227} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300228
229struct wl1271_rx_mem_pool_addr {
230 u32 addr;
231 u32 addr_extra;
232};
233
Teemu Paasikiviabb0b3b2009-10-13 12:47:50 +0300234struct wl1271_scan {
Juuso Oikarinen4fb26fa2010-05-24 11:18:20 +0300235 struct cfg80211_scan_request *req;
Luciano Coelho08688d62010-07-08 17:50:07 +0300236 bool *scanned_ch;
Juuso Oikarinen78abd322010-09-21 06:23:32 +0200237 bool failed;
Teemu Paasikiviabb0b3b2009-10-13 12:47:50 +0300238 u8 state;
239 u8 ssid[IW_ESSID_MAX_SIZE+1];
240 size_t ssid_len;
Teemu Paasikiviabb0b3b2009-10-13 12:47:50 +0300241};
242
Teemu Paasikivi8197b712010-02-22 08:38:23 +0200243struct wl1271_if_operations {
244 void (*read)(struct wl1271 *wl, int addr, void *buf, size_t len,
245 bool fixed);
246 void (*write)(struct wl1271 *wl, int addr, void *buf, size_t len,
247 bool fixed);
248 void (*reset)(struct wl1271 *wl);
249 void (*init)(struct wl1271 *wl);
Ohad Ben-Cohen2cc78ff2010-09-16 01:22:04 +0200250 int (*power)(struct wl1271 *wl, bool enable);
Teemu Paasikivi8197b712010-02-22 08:38:23 +0200251 struct device* (*dev)(struct wl1271 *wl);
252 void (*enable_irq)(struct wl1271 *wl);
253 void (*disable_irq)(struct wl1271 *wl);
254};
255
Arik Nemtsov7f179b42010-10-16 21:39:06 +0200256#define MAX_NUM_KEYS 14
257#define MAX_KEY_SIZE 32
258
259struct wl1271_ap_key {
260 u8 id;
261 u8 key_type;
262 u8 key_size;
263 u8 key[MAX_KEY_SIZE];
264 u8 hlid;
265 u32 tx_seq_32;
266 u16 tx_seq_16;
267};
268
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300269struct wl1271 {
Teemu Paasikivi3b56dd62010-03-18 12:26:46 +0200270 struct platform_device *plat_dev;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300271 struct ieee80211_hw *hw;
272 bool mac80211_registered;
273
Teemu Paasikivi8197b712010-02-22 08:38:23 +0200274 void *if_priv;
275
276 struct wl1271_if_operations *if_ops;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300277
278 void (*set_power)(bool enable);
279 int irq;
Ohad Ben-Cohen15cea992010-09-16 01:31:51 +0200280 int ref_clock;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300281
282 spinlock_t wl_lock;
283
284 enum wl1271_state state;
285 struct mutex mutex;
286
Juuso Oikarinen830fb672009-12-11 15:41:06 +0200287#define WL1271_FLAG_STA_RATES_CHANGED (0)
288#define WL1271_FLAG_STA_ASSOCIATED (1)
Juuso Oikarinen71449f82009-12-11 15:41:07 +0200289#define WL1271_FLAG_JOINED (2)
290#define WL1271_FLAG_GPIO_POWER (3)
291#define WL1271_FLAG_TX_QUEUE_STOPPED (4)
Luciano Coelho08688d62010-07-08 17:50:07 +0300292#define WL1271_FLAG_IN_ELP (5)
293#define WL1271_FLAG_PSM (6)
294#define WL1271_FLAG_PSM_REQUESTED (7)
295#define WL1271_FLAG_IRQ_PENDING (8)
296#define WL1271_FLAG_IRQ_RUNNING (9)
297#define WL1271_FLAG_IDLE (10)
298#define WL1271_FLAG_IDLE_REQUESTED (11)
299#define WL1271_FLAG_PSPOLL_FAILURE (12)
Juuso Oikarinenc2c192a2010-07-27 03:30:09 +0300300#define WL1271_FLAG_STA_STATE_SENT (13)
Ido Yariva5225502010-10-12 14:49:10 +0200301#define WL1271_FLAG_FW_TX_BUSY (14)
Arik Nemtsove78a2872010-10-16 19:07:21 +0200302#define WL1271_FLAG_AP_STARTED (15)
Juuso Oikarinen830fb672009-12-11 15:41:06 +0200303 unsigned long flags;
304
Juuso Oikarinen451de972009-10-12 15:08:46 +0300305 struct wl1271_partition_set part;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300306
307 struct wl1271_chip chip;
308
309 int cmd_box_addr;
310 int event_box_addr;
311
312 u8 *fw;
313 size_t fw_len;
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200314 struct wl1271_nvs_file *nvs;
Juuso Oikarinen02fabb02010-08-19 04:41:15 +0200315 size_t nvs_len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300316
Juuso Oikarinend717fd62010-05-07 11:38:58 +0300317 s8 hw_pg_ver;
318
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300319 u8 bssid[ETH_ALEN];
320 u8 mac_addr[ETH_ALEN];
321 u8 bss_type;
Juuso Oikarinen5da11dc2010-03-26 12:53:24 +0200322 u8 set_bss_type;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300323 u8 ssid[IW_ESSID_MAX_SIZE + 1];
324 u8 ssid_len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300325 int channel;
326
327 struct wl1271_acx_mem_map *target_mem_map;
328
329 /* Accounting for allocated / available TX blocks on HW */
330 u32 tx_blocks_freed[NUM_TX_QUEUES];
331 u32 tx_blocks_available;
Juuso Oikarinenffb591c2010-02-22 08:38:31 +0200332 u32 tx_results_count;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300333
334 /* Transmitted TX packets counter for chipset interface */
Juuso Oikarinenffb591c2010-02-22 08:38:31 +0200335 u32 tx_packets_count;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300336
337 /* Time-offset between host and chipset clocks */
Juuso Oikarinenac5e1e32010-02-22 08:38:38 +0200338 s64 time_offset;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300339
340 /* Session counter for the chipset */
341 int session_counter;
342
343 /* Frames scheduled for transmission, not handled yet */
Juuso Oikarinen6742f552010-12-13 09:52:37 +0200344 struct sk_buff_head tx_queue[NUM_TX_QUEUES];
345 int tx_queue_count;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300346
347 struct work_struct tx_work;
Juuso Oikarinenc87dec92009-10-08 21:56:31 +0300348
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300349 /* Pending TX frames */
Ido Yariv25eeb9e2010-10-12 16:20:06 +0200350 unsigned long tx_frames_map[BITS_TO_LONGS(ACX_TX_DESCRIPTORS)];
Juuso Oikarinenbe7078c2009-10-08 21:56:26 +0300351 struct sk_buff *tx_frames[ACX_TX_DESCRIPTORS];
Juuso Oikarinen781608c2010-05-24 11:18:17 +0300352 int tx_frames_cnt;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300353
Juuso Oikarinenac4e4ce2009-10-08 21:56:19 +0300354 /* Security sequence number counters */
355 u8 tx_security_last_seq;
Juuso Oikarinen04e36fc2010-02-22 08:38:40 +0200356 s64 tx_security_seq;
Juuso Oikarinenac4e4ce2009-10-08 21:56:19 +0300357
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300358 /* FW Rx counter */
359 u32 rx_counter;
360
361 /* Rx memory pool address */
362 struct wl1271_rx_mem_pool_addr rx_mem_pool_addr;
363
Ido Yariv1f37cbc2010-09-30 13:28:27 +0200364 /* Intermediate buffer, used for packet aggregation */
365 u8 *aggr_buf;
366
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300367 /* The target interrupt mask */
368 struct work_struct irq_work;
369
Juuso Oikarinen52b0e7a2010-09-21 06:23:31 +0200370 /* Hardware recovery work */
371 struct work_struct recovery_work;
372
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300373 /* The mbox event mask */
374 u32 event_mask;
375
376 /* Mailbox pointers */
377 u32 mbox_ptr[2];
378
379 /* Are we currently scanning */
Teemu Paasikiviabb0b3b2009-10-13 12:47:50 +0300380 struct wl1271_scan scan;
Juuso Oikarinen78abd322010-09-21 06:23:32 +0200381 struct delayed_work scan_complete_work;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300382
Juuso Oikarinen2f6724b2010-11-24 08:16:57 +0200383 /* probe-req template for the current AP */
384 struct sk_buff *probereq;
385
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300386 /* Our association ID */
387 u16 aid;
388
Shahar Levie8b03a22010-10-13 16:09:39 +0200389 /*
390 * currently configured rate set:
391 * bits 0-15 - 802.11abg rates
392 * bits 16-23 - 802.11n MCS index mask
393 * support only 1 stream, thus only 8 bits for the MCS rates (0-7).
394 */
Juuso Oikarinen830fb672009-12-11 15:41:06 +0200395 u32 sta_rate_set;
Juuso Oikarinend94cd292009-10-08 21:56:25 +0300396 u32 basic_rate_set;
Juuso Oikarinenebba60c2010-04-01 11:38:20 +0300397 u32 basic_rate;
Juuso Oikarinen830fb672009-12-11 15:41:06 +0200398 u32 rate_set;
Juuso Oikarinend94cd292009-10-08 21:56:25 +0300399
Juuso Oikarinen8a5a37a2009-10-08 21:56:24 +0300400 /* The current band */
401 enum ieee80211_band band;
402
Juuso Oikarinen60e84c22010-03-26 12:53:25 +0200403 /* Beaconing interval (needed for ad-hoc) */
404 u32 beacon_int;
405
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300406 /* Default key (for WEP) */
407 u32 default_key;
408
Juuso Oikarinen14b228a2010-03-18 12:26:43 +0200409 unsigned int filters;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300410 unsigned int rx_config;
411 unsigned int rx_filter;
412
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300413 struct completion *elp_compl;
Juuso Oikarinen37b70a82009-10-08 21:56:21 +0300414 struct delayed_work elp_work;
Juuso Oikarinen90494a92010-07-08 17:50:00 +0300415 struct delayed_work pspoll_work;
416
417 /* counter for ps-poll delivery failures */
418 int ps_poll_failures;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300419
Juuso Oikarinen19ad0712009-11-02 20:22:11 +0200420 /* retry counter for PSM entries */
421 u8 psm_entry_retry;
422
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300423 /* in dBm */
424 int power_level;
425
Juuso Oikarinen00236aed2010-04-09 11:07:30 +0300426 int rssi_thold;
427 int last_rssi_event;
428
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300429 struct wl1271_stats stats;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300430
Juuso Oikarinen554d7202010-05-07 11:38:59 +0300431 __le32 buffer_32;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300432 u32 buffer_cmd;
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300433 u32 buffer_busyword[WL1271_BUSY_WORD_CNT];
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300434
435 struct wl1271_fw_status *fw_status;
436 struct wl1271_tx_hw_res_if *tx_res_if;
Juuso Oikarinenb771eee2009-10-08 21:56:34 +0300437
438 struct ieee80211_vif *vif;
Luciano Coelhod6e19d132009-10-12 15:08:43 +0300439
Juuso Oikarinen2b60100b2009-10-13 12:47:39 +0300440 /* Current chipset configuration */
441 struct conf_drv_settings conf;
Juuso Oikarinen01c09162009-10-13 12:47:55 +0300442
Juuso Oikarinen7fc3a862010-03-18 12:26:32 +0200443 bool sg_enabled;
444
Juuso Oikarinen02fabb02010-08-19 04:41:15 +0200445 bool enable_11a;
446
Juuso Oikarinen01c09162009-10-13 12:47:55 +0300447 struct list_head list;
John W. Linvilleece550d2010-07-28 16:41:06 -0400448
449 /* Most recently reported noise in dBm */
450 s8 noise;
Arik Nemtsovf84f7d72010-10-16 20:21:23 +0200451
452 /* map for HLIDs of associated stations - when operating in AP mode */
453 unsigned long ap_hlid_map[BITS_TO_LONGS(AP_MAX_STATIONS)];
Arik Nemtsov7f179b42010-10-16 21:39:06 +0200454
455 /* recoreded keys for AP-mode - set here before AP startup */
456 struct wl1271_ap_key *recorded_ap_keys[MAX_NUM_KEYS];
Arik Nemtsovf84f7d72010-10-16 20:21:23 +0200457};
458
459struct wl1271_station {
460 u8 hlid;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300461};
462
463int wl1271_plt_start(struct wl1271 *wl);
464int wl1271_plt_stop(struct wl1271 *wl);
465
466#define JOIN_TIMEOUT 5000 /* 5000 milliseconds to join */
467
468#define SESSION_COUNTER_MAX 7 /* maximum value for the session counter */
469
470#define WL1271_DEFAULT_POWER_LEVEL 0
471
Juuso Oikarinen06f7bc72010-02-22 08:38:33 +0200472#define WL1271_TX_QUEUE_LOW_WATERMARK 10
473#define WL1271_TX_QUEUE_HIGH_WATERMARK 25
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300474
Juuso Oikarinen01ac17e2009-12-11 15:41:02 +0200475/* WL1271 needs a 200ms sleep after power on, and a 20ms sleep before power
476 on in case is has been shut down shortly before */
Stefan Weile8a8b252011-01-02 15:12:42 +0100477#define WL1271_PRE_POWER_ON_SLEEP 20 /* in milliseconds */
478#define WL1271_POWER_ON_SLEEP 200 /* in milliseconds */
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300479
Shahar Levie8b03a22010-10-13 16:09:39 +0200480/* Macros to handle wl1271.sta_rate_set */
481#define HW_BG_RATES_MASK 0xffff
482#define HW_HT_RATES_OFFSET 16
483
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300484#endif