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 | |
| 25 | #ifndef __WL1271_H__ |
| 26 | #define __WL1271_H__ |
| 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 | |
Juuso Oikarinen | 2b60100b | 2009-10-13 12:47:39 +0300 | [diff] [blame] | 35 | #include "wl1271_conf.h" |
| 36 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 37 | #define DRIVER_NAME "wl1271" |
| 38 | #define DRIVER_PREFIX DRIVER_NAME ": " |
| 39 | |
| 40 | enum { |
| 41 | DEBUG_NONE = 0, |
| 42 | DEBUG_IRQ = BIT(0), |
| 43 | DEBUG_SPI = BIT(1), |
| 44 | DEBUG_BOOT = BIT(2), |
| 45 | DEBUG_MAILBOX = BIT(3), |
| 46 | DEBUG_NETLINK = BIT(4), |
| 47 | DEBUG_EVENT = BIT(5), |
| 48 | DEBUG_TX = BIT(6), |
| 49 | DEBUG_RX = BIT(7), |
| 50 | DEBUG_SCAN = BIT(8), |
| 51 | DEBUG_CRYPT = BIT(9), |
| 52 | DEBUG_PSM = BIT(10), |
| 53 | DEBUG_MAC80211 = BIT(11), |
| 54 | DEBUG_CMD = BIT(12), |
| 55 | DEBUG_ACX = BIT(13), |
| 56 | DEBUG_ALL = ~0, |
| 57 | }; |
| 58 | |
| 59 | #define DEBUG_LEVEL (DEBUG_NONE) |
| 60 | |
| 61 | #define DEBUG_DUMP_LIMIT 1024 |
| 62 | |
| 63 | #define wl1271_error(fmt, arg...) \ |
| 64 | printk(KERN_ERR DRIVER_PREFIX "ERROR " fmt "\n", ##arg) |
| 65 | |
| 66 | #define wl1271_warning(fmt, arg...) \ |
| 67 | printk(KERN_WARNING DRIVER_PREFIX "WARNING " fmt "\n", ##arg) |
| 68 | |
| 69 | #define wl1271_notice(fmt, arg...) \ |
| 70 | printk(KERN_INFO DRIVER_PREFIX fmt "\n", ##arg) |
| 71 | |
| 72 | #define wl1271_info(fmt, arg...) \ |
| 73 | printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg) |
| 74 | |
| 75 | #define wl1271_debug(level, fmt, arg...) \ |
| 76 | do { \ |
| 77 | if (level & DEBUG_LEVEL) \ |
| 78 | printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg); \ |
| 79 | } while (0) |
| 80 | |
| 81 | #define wl1271_dump(level, prefix, buf, len) \ |
| 82 | do { \ |
| 83 | if (level & DEBUG_LEVEL) \ |
| 84 | print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ |
| 85 | DUMP_PREFIX_OFFSET, 16, 1, \ |
| 86 | buf, \ |
| 87 | min_t(size_t, len, DEBUG_DUMP_LIMIT), \ |
| 88 | 0); \ |
| 89 | } while (0) |
| 90 | |
| 91 | #define wl1271_dump_ascii(level, prefix, buf, len) \ |
| 92 | do { \ |
| 93 | if (level & DEBUG_LEVEL) \ |
| 94 | print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ |
| 95 | DUMP_PREFIX_OFFSET, 16, 1, \ |
| 96 | buf, \ |
| 97 | min_t(size_t, len, DEBUG_DUMP_LIMIT), \ |
| 98 | true); \ |
| 99 | } while (0) |
| 100 | |
| 101 | #define WL1271_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \ |
Juuso Oikarinen | c87dec9 | 2009-10-08 21:56:31 +0300 | [diff] [blame] | 102 | CFG_BSSID_FILTER_EN | \ |
| 103 | CFG_MC_FILTER_EN) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 104 | |
| 105 | #define WL1271_DEFAULT_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PRSP_EN | \ |
| 106 | CFG_RX_MGMT_EN | CFG_RX_DATA_EN | \ |
| 107 | CFG_RX_CTL_EN | CFG_RX_BCN_EN | \ |
| 108 | CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN) |
| 109 | |
| 110 | #define WL1271_FW_NAME "wl1271-fw.bin" |
| 111 | #define WL1271_NVS_NAME "wl1271-nvs.bin" |
Luciano Coelho | 8cf5e8e | 2009-12-11 15:40:53 +0200 | [diff] [blame] | 112 | #define WL1271_NVS_LEN 468 |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 113 | |
Juuso Oikarinen | 545f1da | 2009-10-08 21:56:23 +0300 | [diff] [blame] | 114 | /* |
Teemu Paasikivi | 1ebec3d | 2009-10-13 12:47:48 +0300 | [diff] [blame] | 115 | * Enable/disable 802.11a support for WL1273 |
| 116 | */ |
| 117 | #undef WL1271_80211A_ENABLED |
| 118 | |
| 119 | /* |
Juuso Oikarinen | 545f1da | 2009-10-08 21:56:23 +0300 | [diff] [blame] | 120 | * FIXME: for the wl1271, a busy word count of 1 here will result in a more |
| 121 | * optimal SPI interface. There is some SPI bug however, causing RXS time outs |
Juuso Oikarinen | c6d5d06 | 2009-10-13 12:47:47 +0300 | [diff] [blame] | 122 | * with this mode occasionally on boot, so lets have three for now. A value of |
| 123 | * three should make sure, that the chipset will always be ready, though this |
| 124 | * will impact throughput and latencies slightly. |
Juuso Oikarinen | 545f1da | 2009-10-08 21:56:23 +0300 | [diff] [blame] | 125 | */ |
Juuso Oikarinen | c6d5d06 | 2009-10-13 12:47:47 +0300 | [diff] [blame] | 126 | #define WL1271_BUSY_WORD_CNT 3 |
Juuso Oikarinen | 545f1da | 2009-10-08 21:56:23 +0300 | [diff] [blame] | 127 | #define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32)) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 128 | |
| 129 | #define WL1271_ELP_HW_STATE_ASLEEP 0 |
| 130 | #define WL1271_ELP_HW_STATE_IRQ 1 |
| 131 | |
Juuso Oikarinen | d94cd29 | 2009-10-08 21:56:25 +0300 | [diff] [blame] | 132 | #define WL1271_DEFAULT_BEACON_INT 100 |
| 133 | #define WL1271_DEFAULT_DTIM_PERIOD 1 |
| 134 | |
Juuso Oikarinen | c87dec9 | 2009-10-08 21:56:31 +0300 | [diff] [blame] | 135 | #define ACX_TX_DESCRIPTORS 32 |
Juuso Oikarinen | be7078c | 2009-10-08 21:56:26 +0300 | [diff] [blame] | 136 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 137 | enum wl1271_state { |
| 138 | WL1271_STATE_OFF, |
| 139 | WL1271_STATE_ON, |
| 140 | WL1271_STATE_PLT, |
| 141 | }; |
| 142 | |
| 143 | enum wl1271_partition_type { |
| 144 | PART_DOWN, |
| 145 | PART_WORK, |
| 146 | PART_DRPW, |
| 147 | |
| 148 | PART_TABLE_LEN |
| 149 | }; |
| 150 | |
| 151 | struct wl1271_partition { |
| 152 | u32 size; |
| 153 | u32 start; |
| 154 | }; |
| 155 | |
| 156 | struct wl1271_partition_set { |
| 157 | struct wl1271_partition mem; |
| 158 | struct wl1271_partition reg; |
Juuso Oikarinen | 451de97 | 2009-10-12 15:08:46 +0300 | [diff] [blame] | 159 | struct wl1271_partition mem2; |
| 160 | struct wl1271_partition mem3; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 161 | }; |
| 162 | |
| 163 | struct wl1271; |
| 164 | |
| 165 | /* FIXME: I'm not sure about this structure name */ |
| 166 | struct wl1271_chip { |
| 167 | u32 id; |
| 168 | char fw_ver[21]; |
| 169 | }; |
| 170 | |
| 171 | struct wl1271_stats { |
| 172 | struct acx_statistics *fw_stats; |
| 173 | unsigned long fw_stats_update; |
| 174 | |
| 175 | unsigned int retry_count; |
| 176 | unsigned int excessive_retries; |
| 177 | }; |
| 178 | |
| 179 | struct wl1271_debugfs { |
| 180 | struct dentry *rootdir; |
| 181 | struct dentry *fw_statistics; |
| 182 | |
| 183 | struct dentry *tx_internal_desc_overflow; |
| 184 | |
| 185 | struct dentry *rx_out_of_mem; |
| 186 | struct dentry *rx_hdr_overflow; |
| 187 | struct dentry *rx_hw_stuck; |
| 188 | struct dentry *rx_dropped; |
| 189 | struct dentry *rx_fcs_err; |
| 190 | struct dentry *rx_xfr_hint_trig; |
| 191 | struct dentry *rx_path_reset; |
| 192 | struct dentry *rx_reset_counter; |
| 193 | |
| 194 | struct dentry *dma_rx_requested; |
| 195 | struct dentry *dma_rx_errors; |
| 196 | struct dentry *dma_tx_requested; |
| 197 | struct dentry *dma_tx_errors; |
| 198 | |
| 199 | struct dentry *isr_cmd_cmplt; |
| 200 | struct dentry *isr_fiqs; |
| 201 | struct dentry *isr_rx_headers; |
| 202 | struct dentry *isr_rx_mem_overflow; |
| 203 | struct dentry *isr_rx_rdys; |
| 204 | struct dentry *isr_irqs; |
| 205 | struct dentry *isr_tx_procs; |
| 206 | struct dentry *isr_decrypt_done; |
| 207 | struct dentry *isr_dma0_done; |
| 208 | struct dentry *isr_dma1_done; |
| 209 | struct dentry *isr_tx_exch_complete; |
| 210 | struct dentry *isr_commands; |
| 211 | struct dentry *isr_rx_procs; |
| 212 | struct dentry *isr_hw_pm_mode_changes; |
| 213 | struct dentry *isr_host_acknowledges; |
| 214 | struct dentry *isr_pci_pm; |
| 215 | struct dentry *isr_wakeups; |
| 216 | struct dentry *isr_low_rssi; |
| 217 | |
| 218 | struct dentry *wep_addr_key_count; |
| 219 | struct dentry *wep_default_key_count; |
| 220 | /* skipping wep.reserved */ |
| 221 | struct dentry *wep_key_not_found; |
| 222 | struct dentry *wep_decrypt_fail; |
| 223 | struct dentry *wep_packets; |
| 224 | struct dentry *wep_interrupt; |
| 225 | |
| 226 | struct dentry *pwr_ps_enter; |
| 227 | struct dentry *pwr_elp_enter; |
| 228 | struct dentry *pwr_missing_bcns; |
| 229 | struct dentry *pwr_wake_on_host; |
| 230 | struct dentry *pwr_wake_on_timer_exp; |
| 231 | struct dentry *pwr_tx_with_ps; |
| 232 | struct dentry *pwr_tx_without_ps; |
| 233 | struct dentry *pwr_rcvd_beacons; |
| 234 | struct dentry *pwr_power_save_off; |
| 235 | struct dentry *pwr_enable_ps; |
| 236 | struct dentry *pwr_disable_ps; |
| 237 | struct dentry *pwr_fix_tsf_ps; |
| 238 | /* skipping cont_miss_bcns_spread for now */ |
| 239 | struct dentry *pwr_rcvd_awake_beacons; |
| 240 | |
| 241 | struct dentry *mic_rx_pkts; |
| 242 | struct dentry *mic_calc_failure; |
| 243 | |
| 244 | struct dentry *aes_encrypt_fail; |
| 245 | struct dentry *aes_decrypt_fail; |
| 246 | struct dentry *aes_encrypt_packets; |
| 247 | struct dentry *aes_decrypt_packets; |
| 248 | struct dentry *aes_encrypt_interrupt; |
| 249 | struct dentry *aes_decrypt_interrupt; |
| 250 | |
| 251 | struct dentry *event_heart_beat; |
| 252 | struct dentry *event_calibration; |
| 253 | struct dentry *event_rx_mismatch; |
| 254 | struct dentry *event_rx_mem_empty; |
| 255 | struct dentry *event_rx_pool; |
| 256 | struct dentry *event_oom_late; |
| 257 | struct dentry *event_phy_transmit_error; |
| 258 | struct dentry *event_tx_stuck; |
| 259 | |
| 260 | struct dentry *ps_pspoll_timeouts; |
| 261 | struct dentry *ps_upsd_timeouts; |
| 262 | struct dentry *ps_upsd_max_sptime; |
| 263 | struct dentry *ps_upsd_max_apturn; |
| 264 | struct dentry *ps_pspoll_max_apturn; |
| 265 | struct dentry *ps_pspoll_utilization; |
| 266 | struct dentry *ps_upsd_utilization; |
| 267 | |
| 268 | struct dentry *rxpipe_rx_prep_beacon_drop; |
| 269 | struct dentry *rxpipe_descr_host_int_trig_rx_data; |
| 270 | struct dentry *rxpipe_beacon_buffer_thres_host_int_trig_rx_data; |
| 271 | struct dentry *rxpipe_missed_beacon_host_int_trig_rx_data; |
| 272 | struct dentry *rxpipe_tx_xfr_host_int_trig_rx_data; |
| 273 | |
| 274 | struct dentry *tx_queue_len; |
| 275 | |
| 276 | struct dentry *retry_count; |
| 277 | struct dentry *excessive_retries; |
Luciano Coelho | 98b2a68 | 2009-12-11 15:40:52 +0200 | [diff] [blame] | 278 | struct dentry *gpio_power; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 279 | }; |
| 280 | |
| 281 | #define NUM_TX_QUEUES 4 |
| 282 | #define NUM_RX_PKT_DESC 8 |
| 283 | |
| 284 | /* FW status registers */ |
| 285 | struct wl1271_fw_status { |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 286 | __le32 intr; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 287 | u8 fw_rx_counter; |
| 288 | u8 drv_rx_counter; |
| 289 | u8 reserved; |
| 290 | u8 tx_results_counter; |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 291 | __le32 rx_pkt_descs[NUM_RX_PKT_DESC]; |
| 292 | __le32 tx_released_blks[NUM_TX_QUEUES]; |
| 293 | __le32 fw_localtime; |
| 294 | __le32 padding[2]; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 295 | } __attribute__ ((packed)); |
| 296 | |
| 297 | struct wl1271_rx_mem_pool_addr { |
| 298 | u32 addr; |
| 299 | u32 addr_extra; |
| 300 | }; |
| 301 | |
Teemu Paasikivi | abb0b3b | 2009-10-13 12:47:50 +0300 | [diff] [blame] | 302 | struct wl1271_scan { |
| 303 | u8 state; |
| 304 | u8 ssid[IW_ESSID_MAX_SIZE+1]; |
| 305 | size_t ssid_len; |
| 306 | u8 active; |
| 307 | u8 high_prio; |
| 308 | u8 probe_requests; |
| 309 | }; |
| 310 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 311 | struct wl1271 { |
| 312 | struct ieee80211_hw *hw; |
| 313 | bool mac80211_registered; |
| 314 | |
| 315 | struct spi_device *spi; |
| 316 | |
| 317 | void (*set_power)(bool enable); |
| 318 | int irq; |
| 319 | |
| 320 | spinlock_t wl_lock; |
| 321 | |
| 322 | enum wl1271_state state; |
| 323 | struct mutex mutex; |
| 324 | |
Juuso Oikarinen | 830fb67 | 2009-12-11 15:41:06 +0200 | [diff] [blame^] | 325 | #define WL1271_FLAG_STA_RATES_CHANGED (0) |
| 326 | #define WL1271_FLAG_STA_ASSOCIATED (1) |
| 327 | unsigned long flags; |
| 328 | |
Juuso Oikarinen | 451de97 | 2009-10-12 15:08:46 +0300 | [diff] [blame] | 329 | struct wl1271_partition_set part; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 330 | |
| 331 | struct wl1271_chip chip; |
| 332 | |
| 333 | int cmd_box_addr; |
| 334 | int event_box_addr; |
| 335 | |
| 336 | u8 *fw; |
| 337 | size_t fw_len; |
| 338 | u8 *nvs; |
| 339 | size_t nvs_len; |
| 340 | |
| 341 | u8 bssid[ETH_ALEN]; |
| 342 | u8 mac_addr[ETH_ALEN]; |
| 343 | u8 bss_type; |
| 344 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
| 345 | u8 ssid_len; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 346 | int channel; |
| 347 | |
| 348 | struct wl1271_acx_mem_map *target_mem_map; |
| 349 | |
| 350 | /* Accounting for allocated / available TX blocks on HW */ |
| 351 | u32 tx_blocks_freed[NUM_TX_QUEUES]; |
| 352 | u32 tx_blocks_available; |
| 353 | u8 tx_results_count; |
| 354 | |
| 355 | /* Transmitted TX packets counter for chipset interface */ |
| 356 | int tx_packets_count; |
| 357 | |
| 358 | /* Time-offset between host and chipset clocks */ |
| 359 | int time_offset; |
| 360 | |
| 361 | /* Session counter for the chipset */ |
| 362 | int session_counter; |
| 363 | |
| 364 | /* Frames scheduled for transmission, not handled yet */ |
| 365 | struct sk_buff_head tx_queue; |
| 366 | bool tx_queue_stopped; |
| 367 | |
| 368 | struct work_struct tx_work; |
Juuso Oikarinen | c87dec9 | 2009-10-08 21:56:31 +0300 | [diff] [blame] | 369 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 370 | /* Pending TX frames */ |
Juuso Oikarinen | be7078c | 2009-10-08 21:56:26 +0300 | [diff] [blame] | 371 | struct sk_buff *tx_frames[ACX_TX_DESCRIPTORS]; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 372 | |
Juuso Oikarinen | ac4e4ce | 2009-10-08 21:56:19 +0300 | [diff] [blame] | 373 | /* Security sequence number counters */ |
| 374 | u8 tx_security_last_seq; |
| 375 | u16 tx_security_seq_16; |
| 376 | u32 tx_security_seq_32; |
| 377 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 378 | /* FW Rx counter */ |
| 379 | u32 rx_counter; |
| 380 | |
| 381 | /* Rx memory pool address */ |
| 382 | struct wl1271_rx_mem_pool_addr rx_mem_pool_addr; |
| 383 | |
| 384 | /* The target interrupt mask */ |
| 385 | struct work_struct irq_work; |
| 386 | |
| 387 | /* The mbox event mask */ |
| 388 | u32 event_mask; |
| 389 | |
| 390 | /* Mailbox pointers */ |
| 391 | u32 mbox_ptr[2]; |
| 392 | |
| 393 | /* Are we currently scanning */ |
| 394 | bool scanning; |
Teemu Paasikivi | abb0b3b | 2009-10-13 12:47:50 +0300 | [diff] [blame] | 395 | struct wl1271_scan scan; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 396 | |
| 397 | /* Our association ID */ |
| 398 | u16 aid; |
| 399 | |
Juuso Oikarinen | d94cd29 | 2009-10-08 21:56:25 +0300 | [diff] [blame] | 400 | /* currently configured rate set */ |
Juuso Oikarinen | 830fb67 | 2009-12-11 15:41:06 +0200 | [diff] [blame^] | 401 | u32 sta_rate_set; |
Juuso Oikarinen | d94cd29 | 2009-10-08 21:56:25 +0300 | [diff] [blame] | 402 | u32 basic_rate_set; |
Juuso Oikarinen | 830fb67 | 2009-12-11 15:41:06 +0200 | [diff] [blame^] | 403 | u32 rate_set; |
Juuso Oikarinen | d94cd29 | 2009-10-08 21:56:25 +0300 | [diff] [blame] | 404 | |
Juuso Oikarinen | 8a5a37a | 2009-10-08 21:56:24 +0300 | [diff] [blame] | 405 | /* The current band */ |
| 406 | enum ieee80211_band band; |
| 407 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 408 | /* Default key (for WEP) */ |
| 409 | u32 default_key; |
| 410 | |
| 411 | unsigned int rx_config; |
| 412 | unsigned int rx_filter; |
| 413 | |
| 414 | /* is firmware in elp mode */ |
| 415 | bool elp; |
| 416 | |
| 417 | struct completion *elp_compl; |
Juuso Oikarinen | 37b70a8 | 2009-10-08 21:56:21 +0300 | [diff] [blame] | 418 | struct delayed_work elp_work; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 419 | |
| 420 | /* we can be in psm, but not in elp, we have to differentiate */ |
| 421 | bool psm; |
| 422 | |
| 423 | /* PSM mode requested */ |
| 424 | bool psm_requested; |
| 425 | |
Juuso Oikarinen | 19ad071 | 2009-11-02 20:22:11 +0200 | [diff] [blame] | 426 | /* retry counter for PSM entries */ |
| 427 | u8 psm_entry_retry; |
| 428 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 429 | /* in dBm */ |
| 430 | int power_level; |
| 431 | |
| 432 | struct wl1271_stats stats; |
| 433 | struct wl1271_debugfs debugfs; |
| 434 | |
| 435 | u32 buffer_32; |
| 436 | u32 buffer_cmd; |
Juuso Oikarinen | 545f1da | 2009-10-08 21:56:23 +0300 | [diff] [blame] | 437 | u32 buffer_busyword[WL1271_BUSY_WORD_CNT]; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 438 | |
| 439 | struct wl1271_fw_status *fw_status; |
| 440 | struct wl1271_tx_hw_res_if *tx_res_if; |
Juuso Oikarinen | b771eee | 2009-10-08 21:56:34 +0300 | [diff] [blame] | 441 | |
| 442 | struct ieee80211_vif *vif; |
Luciano Coelho | d6e19d13 | 2009-10-12 15:08:43 +0300 | [diff] [blame] | 443 | |
| 444 | /* Used for a workaround to send disconnect before rejoining */ |
| 445 | bool joined; |
Juuso Oikarinen | 2b60100b | 2009-10-13 12:47:39 +0300 | [diff] [blame] | 446 | |
| 447 | /* Current chipset configuration */ |
| 448 | struct conf_drv_settings conf; |
Juuso Oikarinen | 01c0916 | 2009-10-13 12:47:55 +0300 | [diff] [blame] | 449 | |
| 450 | struct list_head list; |
Luciano Coelho | 98b2a68 | 2009-12-11 15:40:52 +0200 | [diff] [blame] | 451 | |
| 452 | bool gpio_power; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 453 | }; |
| 454 | |
| 455 | int wl1271_plt_start(struct wl1271 *wl); |
| 456 | int wl1271_plt_stop(struct wl1271 *wl); |
| 457 | |
| 458 | #define JOIN_TIMEOUT 5000 /* 5000 milliseconds to join */ |
| 459 | |
| 460 | #define SESSION_COUNTER_MAX 7 /* maximum value for the session counter */ |
| 461 | |
| 462 | #define WL1271_DEFAULT_POWER_LEVEL 0 |
| 463 | |
| 464 | #define WL1271_TX_QUEUE_MAX_LENGTH 20 |
| 465 | |
Juuso Oikarinen | 01ac17e | 2009-12-11 15:41:02 +0200 | [diff] [blame] | 466 | /* WL1271 needs a 200ms sleep after power on, and a 20ms sleep before power |
| 467 | on in case is has been shut down shortly before */ |
| 468 | #define WL1271_PRE_POWER_ON_SLEEP 20 /* in miliseconds */ |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 469 | #define WL1271_POWER_ON_SLEEP 200 /* in miliseconds */ |
| 470 | |
Teemu Paasikivi | 1ebec3d | 2009-10-13 12:47:48 +0300 | [diff] [blame] | 471 | static inline bool wl1271_11a_enabled(void) |
| 472 | { |
| 473 | #ifdef WL1271_80211A_ENABLED |
| 474 | return true; |
| 475 | #else |
| 476 | return false; |
| 477 | #endif |
| 478 | } |
| 479 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 480 | #endif |