Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 1 | /* |
| 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 Levi | 00d2010 | 2010-11-08 11:20:10 +0000 | [diff] [blame] | 25 | #ifndef __WL12XX_H__ |
| 26 | #define __WL12XX_H__ |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 27 | |
| 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 Levi | 00d2010 | 2010-11-08 11:20:10 +0000 | [diff] [blame] | 35 | #include "conf.h" |
| 36 | #include "ini.h" |
Juuso Oikarinen | 2b60100b | 2009-10-13 12:47:39 +0300 | [diff] [blame] | 37 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 38 | #define DRIVER_NAME "wl1271" |
| 39 | #define DRIVER_PREFIX DRIVER_NAME ": " |
| 40 | |
| 41 | enum { |
| 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 Valo | c8c9087 | 2010-02-18 13:25:53 +0200 | [diff] [blame] | 47 | DEBUG_TESTMODE = BIT(4), |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 48 | 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 Paasikivi | a3b8ea7 | 2010-03-18 12:26:41 +0200 | [diff] [blame] | 57 | DEBUG_SDIO = BIT(14), |
Juuso Oikarinen | 14b228a | 2010-03-18 12:26:43 +0200 | [diff] [blame] | 58 | DEBUG_FILTERS = BIT(15), |
Juuso Oikarinen | 5da11dc | 2010-03-26 12:53:24 +0200 | [diff] [blame] | 59 | DEBUG_ADHOC = BIT(16), |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 60 | DEBUG_ALL = ~0, |
| 61 | }; |
| 62 | |
Eliad Peller | 17c1755 | 2010-12-12 12:15:35 +0200 | [diff] [blame] | 63 | extern u32 wl12xx_debug_level; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 64 | |
| 65 | #define DEBUG_DUMP_LIMIT 1024 |
| 66 | |
| 67 | #define wl1271_error(fmt, arg...) \ |
Eliad Peller | 17c1755 | 2010-12-12 12:15:35 +0200 | [diff] [blame] | 68 | pr_err(DRIVER_PREFIX "ERROR " fmt "\n", ##arg) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 69 | |
| 70 | #define wl1271_warning(fmt, arg...) \ |
Eliad Peller | 17c1755 | 2010-12-12 12:15:35 +0200 | [diff] [blame] | 71 | pr_warning(DRIVER_PREFIX "WARNING " fmt "\n", ##arg) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 72 | |
| 73 | #define wl1271_notice(fmt, arg...) \ |
Eliad Peller | 17c1755 | 2010-12-12 12:15:35 +0200 | [diff] [blame] | 74 | pr_info(DRIVER_PREFIX fmt "\n", ##arg) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 75 | |
| 76 | #define wl1271_info(fmt, arg...) \ |
Eliad Peller | 17c1755 | 2010-12-12 12:15:35 +0200 | [diff] [blame] | 77 | pr_info(DRIVER_PREFIX fmt "\n", ##arg) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 78 | |
| 79 | #define wl1271_debug(level, fmt, arg...) \ |
| 80 | do { \ |
Eliad Peller | 17c1755 | 2010-12-12 12:15:35 +0200 | [diff] [blame] | 81 | if (level & wl12xx_debug_level) \ |
| 82 | pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \ |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 83 | } while (0) |
| 84 | |
Eliad Peller | 17c1755 | 2010-12-12 12:15:35 +0200 | [diff] [blame] | 85 | /* TODO: use pr_debug_hex_dump when it will be available */ |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 86 | #define wl1271_dump(level, prefix, buf, len) \ |
| 87 | do { \ |
Eliad Peller | 17c1755 | 2010-12-12 12:15:35 +0200 | [diff] [blame] | 88 | if (level & wl12xx_debug_level) \ |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 89 | print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ |
| 90 | DUMP_PREFIX_OFFSET, 16, 1, \ |
| 91 | buf, \ |
| 92 | min_t(size_t, len, DEBUG_DUMP_LIMIT), \ |
| 93 | 0); \ |
| 94 | } while (0) |
| 95 | |
| 96 | #define wl1271_dump_ascii(level, prefix, buf, len) \ |
| 97 | do { \ |
Eliad Peller | 17c1755 | 2010-12-12 12:15:35 +0200 | [diff] [blame] | 98 | if (level & wl12xx_debug_level) \ |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 99 | print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ |
| 100 | DUMP_PREFIX_OFFSET, 16, 1, \ |
| 101 | buf, \ |
| 102 | min_t(size_t, len, DEBUG_DUMP_LIMIT), \ |
| 103 | true); \ |
| 104 | } while (0) |
| 105 | |
| 106 | #define WL1271_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \ |
Juuso Oikarinen | c87dec9 | 2009-10-08 21:56:31 +0300 | [diff] [blame] | 107 | CFG_BSSID_FILTER_EN | \ |
| 108 | CFG_MC_FILTER_EN) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 109 | |
| 110 | #define WL1271_DEFAULT_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PRSP_EN | \ |
| 111 | CFG_RX_MGMT_EN | CFG_RX_DATA_EN | \ |
| 112 | CFG_RX_CTL_EN | CFG_RX_BCN_EN | \ |
| 113 | CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN) |
| 114 | |
| 115 | #define WL1271_FW_NAME "wl1271-fw.bin" |
| 116 | #define WL1271_NVS_NAME "wl1271-nvs.bin" |
Juuso Oikarinen | 152ee6e | 2010-02-18 13:25:42 +0200 | [diff] [blame] | 117 | |
Juuso Oikarinen | 04e36fc | 2010-02-22 08:38:40 +0200 | [diff] [blame] | 118 | #define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff)) |
| 119 | #define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff)) |
| 120 | |
Juuso Oikarinen | 7a55724 | 2010-09-27 12:42:07 +0200 | [diff] [blame] | 121 | #define WL1271_CIPHER_SUITE_GEM 0x00147201 |
| 122 | |
Juuso Oikarinen | 259da43 | 2010-03-26 12:53:18 +0200 | [diff] [blame] | 123 | #define WL1271_BUSY_WORD_CNT 1 |
Juuso Oikarinen | 545f1da | 2009-10-08 21:56:23 +0300 | [diff] [blame] | 124 | #define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32)) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 125 | |
| 126 | #define WL1271_ELP_HW_STATE_ASLEEP 0 |
| 127 | #define WL1271_ELP_HW_STATE_IRQ 1 |
| 128 | |
Juuso Oikarinen | d94cd29 | 2009-10-08 21:56:25 +0300 | [diff] [blame] | 129 | #define WL1271_DEFAULT_BEACON_INT 100 |
| 130 | #define WL1271_DEFAULT_DTIM_PERIOD 1 |
| 131 | |
Juuso Oikarinen | c87dec9 | 2009-10-08 21:56:31 +0300 | [diff] [blame] | 132 | #define ACX_TX_DESCRIPTORS 32 |
Juuso Oikarinen | be7078c | 2009-10-08 21:56:26 +0300 | [diff] [blame] | 133 | |
Ido Yariv | 1f37cbc | 2010-09-30 13:28:27 +0200 | [diff] [blame] | 134 | #define WL1271_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) |
| 135 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 136 | enum wl1271_state { |
| 137 | WL1271_STATE_OFF, |
| 138 | WL1271_STATE_ON, |
| 139 | WL1271_STATE_PLT, |
| 140 | }; |
| 141 | |
| 142 | enum wl1271_partition_type { |
| 143 | PART_DOWN, |
| 144 | PART_WORK, |
| 145 | PART_DRPW, |
| 146 | |
| 147 | PART_TABLE_LEN |
| 148 | }; |
| 149 | |
| 150 | struct wl1271_partition { |
| 151 | u32 size; |
| 152 | u32 start; |
| 153 | }; |
| 154 | |
| 155 | struct wl1271_partition_set { |
| 156 | struct wl1271_partition mem; |
| 157 | struct wl1271_partition reg; |
Juuso Oikarinen | 451de97 | 2009-10-12 15:08:46 +0300 | [diff] [blame] | 158 | struct wl1271_partition mem2; |
| 159 | struct wl1271_partition mem3; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 160 | }; |
| 161 | |
| 162 | struct wl1271; |
| 163 | |
| 164 | /* FIXME: I'm not sure about this structure name */ |
| 165 | struct wl1271_chip { |
| 166 | u32 id; |
| 167 | char fw_ver[21]; |
| 168 | }; |
| 169 | |
| 170 | struct wl1271_stats { |
| 171 | struct acx_statistics *fw_stats; |
| 172 | unsigned long fw_stats_update; |
| 173 | |
| 174 | unsigned int retry_count; |
| 175 | unsigned int excessive_retries; |
| 176 | }; |
| 177 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 178 | #define NUM_TX_QUEUES 4 |
| 179 | #define NUM_RX_PKT_DESC 8 |
| 180 | |
| 181 | /* FW status registers */ |
| 182 | struct wl1271_fw_status { |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 183 | __le32 intr; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 184 | u8 fw_rx_counter; |
| 185 | u8 drv_rx_counter; |
| 186 | u8 reserved; |
| 187 | u8 tx_results_counter; |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 188 | __le32 rx_pkt_descs[NUM_RX_PKT_DESC]; |
| 189 | __le32 tx_released_blks[NUM_TX_QUEUES]; |
| 190 | __le32 fw_localtime; |
| 191 | __le32 padding[2]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 192 | } __packed; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 193 | |
| 194 | struct wl1271_rx_mem_pool_addr { |
| 195 | u32 addr; |
| 196 | u32 addr_extra; |
| 197 | }; |
| 198 | |
Teemu Paasikivi | abb0b3b | 2009-10-13 12:47:50 +0300 | [diff] [blame] | 199 | struct wl1271_scan { |
Juuso Oikarinen | 4fb26fa | 2010-05-24 11:18:20 +0300 | [diff] [blame] | 200 | struct cfg80211_scan_request *req; |
Luciano Coelho | 08688d6 | 2010-07-08 17:50:07 +0300 | [diff] [blame] | 201 | bool *scanned_ch; |
Juuso Oikarinen | 78abd32 | 2010-09-21 06:23:32 +0200 | [diff] [blame] | 202 | bool failed; |
Teemu Paasikivi | abb0b3b | 2009-10-13 12:47:50 +0300 | [diff] [blame] | 203 | u8 state; |
| 204 | u8 ssid[IW_ESSID_MAX_SIZE+1]; |
| 205 | size_t ssid_len; |
Teemu Paasikivi | abb0b3b | 2009-10-13 12:47:50 +0300 | [diff] [blame] | 206 | }; |
| 207 | |
Teemu Paasikivi | 8197b71 | 2010-02-22 08:38:23 +0200 | [diff] [blame] | 208 | struct wl1271_if_operations { |
| 209 | void (*read)(struct wl1271 *wl, int addr, void *buf, size_t len, |
| 210 | bool fixed); |
| 211 | void (*write)(struct wl1271 *wl, int addr, void *buf, size_t len, |
| 212 | bool fixed); |
| 213 | void (*reset)(struct wl1271 *wl); |
| 214 | void (*init)(struct wl1271 *wl); |
Ohad Ben-Cohen | 2cc78ff | 2010-09-16 01:22:04 +0200 | [diff] [blame] | 215 | int (*power)(struct wl1271 *wl, bool enable); |
Teemu Paasikivi | 8197b71 | 2010-02-22 08:38:23 +0200 | [diff] [blame] | 216 | struct device* (*dev)(struct wl1271 *wl); |
| 217 | void (*enable_irq)(struct wl1271 *wl); |
| 218 | void (*disable_irq)(struct wl1271 *wl); |
| 219 | }; |
| 220 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 221 | struct wl1271 { |
Teemu Paasikivi | 3b56dd6 | 2010-03-18 12:26:46 +0200 | [diff] [blame] | 222 | struct platform_device *plat_dev; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 223 | struct ieee80211_hw *hw; |
| 224 | bool mac80211_registered; |
| 225 | |
Teemu Paasikivi | 8197b71 | 2010-02-22 08:38:23 +0200 | [diff] [blame] | 226 | void *if_priv; |
| 227 | |
| 228 | struct wl1271_if_operations *if_ops; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 229 | |
| 230 | void (*set_power)(bool enable); |
| 231 | int irq; |
Ohad Ben-Cohen | 15cea99 | 2010-09-16 01:31:51 +0200 | [diff] [blame] | 232 | int ref_clock; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 233 | |
| 234 | spinlock_t wl_lock; |
| 235 | |
| 236 | enum wl1271_state state; |
| 237 | struct mutex mutex; |
| 238 | |
Juuso Oikarinen | 830fb67 | 2009-12-11 15:41:06 +0200 | [diff] [blame] | 239 | #define WL1271_FLAG_STA_RATES_CHANGED (0) |
| 240 | #define WL1271_FLAG_STA_ASSOCIATED (1) |
Juuso Oikarinen | 71449f8 | 2009-12-11 15:41:07 +0200 | [diff] [blame] | 241 | #define WL1271_FLAG_JOINED (2) |
| 242 | #define WL1271_FLAG_GPIO_POWER (3) |
| 243 | #define WL1271_FLAG_TX_QUEUE_STOPPED (4) |
Luciano Coelho | 08688d6 | 2010-07-08 17:50:07 +0300 | [diff] [blame] | 244 | #define WL1271_FLAG_IN_ELP (5) |
| 245 | #define WL1271_FLAG_PSM (6) |
| 246 | #define WL1271_FLAG_PSM_REQUESTED (7) |
| 247 | #define WL1271_FLAG_IRQ_PENDING (8) |
| 248 | #define WL1271_FLAG_IRQ_RUNNING (9) |
| 249 | #define WL1271_FLAG_IDLE (10) |
| 250 | #define WL1271_FLAG_IDLE_REQUESTED (11) |
| 251 | #define WL1271_FLAG_PSPOLL_FAILURE (12) |
Juuso Oikarinen | c2c192a | 2010-07-27 03:30:09 +0300 | [diff] [blame] | 252 | #define WL1271_FLAG_STA_STATE_SENT (13) |
Ido Yariv | a522550 | 2010-10-12 14:49:10 +0200 | [diff] [blame] | 253 | #define WL1271_FLAG_FW_TX_BUSY (14) |
Juuso Oikarinen | 830fb67 | 2009-12-11 15:41:06 +0200 | [diff] [blame] | 254 | unsigned long flags; |
| 255 | |
Juuso Oikarinen | 451de97 | 2009-10-12 15:08:46 +0300 | [diff] [blame] | 256 | struct wl1271_partition_set part; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 257 | |
| 258 | struct wl1271_chip chip; |
| 259 | |
| 260 | int cmd_box_addr; |
| 261 | int event_box_addr; |
| 262 | |
| 263 | u8 *fw; |
| 264 | size_t fw_len; |
Juuso Oikarinen | 152ee6e | 2010-02-18 13:25:42 +0200 | [diff] [blame] | 265 | struct wl1271_nvs_file *nvs; |
Juuso Oikarinen | 02fabb0 | 2010-08-19 04:41:15 +0200 | [diff] [blame] | 266 | size_t nvs_len; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 267 | |
Juuso Oikarinen | d717fd6 | 2010-05-07 11:38:58 +0300 | [diff] [blame] | 268 | s8 hw_pg_ver; |
| 269 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 270 | u8 bssid[ETH_ALEN]; |
| 271 | u8 mac_addr[ETH_ALEN]; |
| 272 | u8 bss_type; |
Juuso Oikarinen | 5da11dc | 2010-03-26 12:53:24 +0200 | [diff] [blame] | 273 | u8 set_bss_type; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 274 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
| 275 | u8 ssid_len; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 276 | int channel; |
| 277 | |
| 278 | struct wl1271_acx_mem_map *target_mem_map; |
| 279 | |
| 280 | /* Accounting for allocated / available TX blocks on HW */ |
| 281 | u32 tx_blocks_freed[NUM_TX_QUEUES]; |
| 282 | u32 tx_blocks_available; |
Juuso Oikarinen | ffb591c | 2010-02-22 08:38:31 +0200 | [diff] [blame] | 283 | u32 tx_results_count; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 284 | |
| 285 | /* Transmitted TX packets counter for chipset interface */ |
Juuso Oikarinen | ffb591c | 2010-02-22 08:38:31 +0200 | [diff] [blame] | 286 | u32 tx_packets_count; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 287 | |
| 288 | /* Time-offset between host and chipset clocks */ |
Juuso Oikarinen | ac5e1e3 | 2010-02-22 08:38:38 +0200 | [diff] [blame] | 289 | s64 time_offset; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 290 | |
| 291 | /* Session counter for the chipset */ |
| 292 | int session_counter; |
| 293 | |
| 294 | /* Frames scheduled for transmission, not handled yet */ |
Juuso Oikarinen | 6742f55 | 2010-12-13 09:52:37 +0200 | [diff] [blame^] | 295 | struct sk_buff_head tx_queue[NUM_TX_QUEUES]; |
| 296 | int tx_queue_count; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 297 | |
| 298 | struct work_struct tx_work; |
Juuso Oikarinen | c87dec9 | 2009-10-08 21:56:31 +0300 | [diff] [blame] | 299 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 300 | /* Pending TX frames */ |
Ido Yariv | 25eeb9e | 2010-10-12 16:20:06 +0200 | [diff] [blame] | 301 | unsigned long tx_frames_map[BITS_TO_LONGS(ACX_TX_DESCRIPTORS)]; |
Juuso Oikarinen | be7078c | 2009-10-08 21:56:26 +0300 | [diff] [blame] | 302 | struct sk_buff *tx_frames[ACX_TX_DESCRIPTORS]; |
Juuso Oikarinen | 781608c | 2010-05-24 11:18:17 +0300 | [diff] [blame] | 303 | int tx_frames_cnt; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 304 | |
Juuso Oikarinen | ac4e4ce | 2009-10-08 21:56:19 +0300 | [diff] [blame] | 305 | /* Security sequence number counters */ |
| 306 | u8 tx_security_last_seq; |
Juuso Oikarinen | 04e36fc | 2010-02-22 08:38:40 +0200 | [diff] [blame] | 307 | s64 tx_security_seq; |
Juuso Oikarinen | ac4e4ce | 2009-10-08 21:56:19 +0300 | [diff] [blame] | 308 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 309 | /* FW Rx counter */ |
| 310 | u32 rx_counter; |
| 311 | |
| 312 | /* Rx memory pool address */ |
| 313 | struct wl1271_rx_mem_pool_addr rx_mem_pool_addr; |
| 314 | |
Ido Yariv | 1f37cbc | 2010-09-30 13:28:27 +0200 | [diff] [blame] | 315 | /* Intermediate buffer, used for packet aggregation */ |
| 316 | u8 *aggr_buf; |
| 317 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 318 | /* The target interrupt mask */ |
| 319 | struct work_struct irq_work; |
| 320 | |
Juuso Oikarinen | 52b0e7a | 2010-09-21 06:23:31 +0200 | [diff] [blame] | 321 | /* Hardware recovery work */ |
| 322 | struct work_struct recovery_work; |
| 323 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 324 | /* The mbox event mask */ |
| 325 | u32 event_mask; |
| 326 | |
| 327 | /* Mailbox pointers */ |
| 328 | u32 mbox_ptr[2]; |
| 329 | |
| 330 | /* Are we currently scanning */ |
Teemu Paasikivi | abb0b3b | 2009-10-13 12:47:50 +0300 | [diff] [blame] | 331 | struct wl1271_scan scan; |
Juuso Oikarinen | 78abd32 | 2010-09-21 06:23:32 +0200 | [diff] [blame] | 332 | struct delayed_work scan_complete_work; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 333 | |
Juuso Oikarinen | 2f6724b | 2010-11-24 08:16:57 +0200 | [diff] [blame] | 334 | /* probe-req template for the current AP */ |
| 335 | struct sk_buff *probereq; |
| 336 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 337 | /* Our association ID */ |
| 338 | u16 aid; |
| 339 | |
Shahar Levi | e8b03a2 | 2010-10-13 16:09:39 +0200 | [diff] [blame] | 340 | /* |
| 341 | * currently configured rate set: |
| 342 | * bits 0-15 - 802.11abg rates |
| 343 | * bits 16-23 - 802.11n MCS index mask |
| 344 | * support only 1 stream, thus only 8 bits for the MCS rates (0-7). |
| 345 | */ |
Juuso Oikarinen | 830fb67 | 2009-12-11 15:41:06 +0200 | [diff] [blame] | 346 | u32 sta_rate_set; |
Juuso Oikarinen | d94cd29 | 2009-10-08 21:56:25 +0300 | [diff] [blame] | 347 | u32 basic_rate_set; |
Juuso Oikarinen | ebba60c | 2010-04-01 11:38:20 +0300 | [diff] [blame] | 348 | u32 basic_rate; |
Juuso Oikarinen | 830fb67 | 2009-12-11 15:41:06 +0200 | [diff] [blame] | 349 | u32 rate_set; |
Juuso Oikarinen | d94cd29 | 2009-10-08 21:56:25 +0300 | [diff] [blame] | 350 | |
Juuso Oikarinen | 8a5a37a | 2009-10-08 21:56:24 +0300 | [diff] [blame] | 351 | /* The current band */ |
| 352 | enum ieee80211_band band; |
| 353 | |
Juuso Oikarinen | 60e84c2 | 2010-03-26 12:53:25 +0200 | [diff] [blame] | 354 | /* Beaconing interval (needed for ad-hoc) */ |
| 355 | u32 beacon_int; |
| 356 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 357 | /* Default key (for WEP) */ |
| 358 | u32 default_key; |
| 359 | |
Juuso Oikarinen | 14b228a | 2010-03-18 12:26:43 +0200 | [diff] [blame] | 360 | unsigned int filters; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 361 | unsigned int rx_config; |
| 362 | unsigned int rx_filter; |
| 363 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 364 | struct completion *elp_compl; |
Juuso Oikarinen | 37b70a8 | 2009-10-08 21:56:21 +0300 | [diff] [blame] | 365 | struct delayed_work elp_work; |
Juuso Oikarinen | 90494a9 | 2010-07-08 17:50:00 +0300 | [diff] [blame] | 366 | struct delayed_work pspoll_work; |
| 367 | |
| 368 | /* counter for ps-poll delivery failures */ |
| 369 | int ps_poll_failures; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 370 | |
Juuso Oikarinen | 19ad071 | 2009-11-02 20:22:11 +0200 | [diff] [blame] | 371 | /* retry counter for PSM entries */ |
| 372 | u8 psm_entry_retry; |
| 373 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 374 | /* in dBm */ |
| 375 | int power_level; |
| 376 | |
Juuso Oikarinen | 00236aed | 2010-04-09 11:07:30 +0300 | [diff] [blame] | 377 | int rssi_thold; |
| 378 | int last_rssi_event; |
| 379 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 380 | struct wl1271_stats stats; |
Eliad Peller | 7cb2cea | 2010-11-24 12:53:15 +0200 | [diff] [blame] | 381 | struct dentry *rootdir; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 382 | |
Juuso Oikarinen | 554d720 | 2010-05-07 11:38:59 +0300 | [diff] [blame] | 383 | __le32 buffer_32; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 384 | u32 buffer_cmd; |
Juuso Oikarinen | 545f1da | 2009-10-08 21:56:23 +0300 | [diff] [blame] | 385 | u32 buffer_busyword[WL1271_BUSY_WORD_CNT]; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 386 | |
| 387 | struct wl1271_fw_status *fw_status; |
| 388 | struct wl1271_tx_hw_res_if *tx_res_if; |
Juuso Oikarinen | b771eee | 2009-10-08 21:56:34 +0300 | [diff] [blame] | 389 | |
| 390 | struct ieee80211_vif *vif; |
Luciano Coelho | d6e19d13 | 2009-10-12 15:08:43 +0300 | [diff] [blame] | 391 | |
Juuso Oikarinen | 2b60100b | 2009-10-13 12:47:39 +0300 | [diff] [blame] | 392 | /* Current chipset configuration */ |
| 393 | struct conf_drv_settings conf; |
Juuso Oikarinen | 01c0916 | 2009-10-13 12:47:55 +0300 | [diff] [blame] | 394 | |
Juuso Oikarinen | 7fc3a86 | 2010-03-18 12:26:32 +0200 | [diff] [blame] | 395 | bool sg_enabled; |
| 396 | |
Juuso Oikarinen | 02fabb0 | 2010-08-19 04:41:15 +0200 | [diff] [blame] | 397 | bool enable_11a; |
| 398 | |
Juuso Oikarinen | 01c0916 | 2009-10-13 12:47:55 +0300 | [diff] [blame] | 399 | struct list_head list; |
John W. Linville | ece550d | 2010-07-28 16:41:06 -0400 | [diff] [blame] | 400 | |
| 401 | /* Most recently reported noise in dBm */ |
| 402 | s8 noise; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 403 | }; |
| 404 | |
| 405 | int wl1271_plt_start(struct wl1271 *wl); |
| 406 | int wl1271_plt_stop(struct wl1271 *wl); |
| 407 | |
| 408 | #define JOIN_TIMEOUT 5000 /* 5000 milliseconds to join */ |
| 409 | |
| 410 | #define SESSION_COUNTER_MAX 7 /* maximum value for the session counter */ |
| 411 | |
| 412 | #define WL1271_DEFAULT_POWER_LEVEL 0 |
| 413 | |
Juuso Oikarinen | 06f7bc7 | 2010-02-22 08:38:33 +0200 | [diff] [blame] | 414 | #define WL1271_TX_QUEUE_LOW_WATERMARK 10 |
| 415 | #define WL1271_TX_QUEUE_HIGH_WATERMARK 25 |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 416 | |
Juuso Oikarinen | 01ac17e | 2009-12-11 15:41:02 +0200 | [diff] [blame] | 417 | /* WL1271 needs a 200ms sleep after power on, and a 20ms sleep before power |
| 418 | on in case is has been shut down shortly before */ |
| 419 | #define WL1271_PRE_POWER_ON_SLEEP 20 /* in miliseconds */ |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 420 | #define WL1271_POWER_ON_SLEEP 200 /* in miliseconds */ |
| 421 | |
Shahar Levi | e8b03a2 | 2010-10-13 16:09:39 +0200 | [diff] [blame] | 422 | /* Macros to handle wl1271.sta_rate_set */ |
| 423 | #define HW_BG_RATES_MASK 0xffff |
| 424 | #define HW_HT_RATES_OFFSET 16 |
| 425 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 426 | #endif |