xref: /linux/drivers/net/wireless/ti/wl1251/wl1251.h (revision e4c2e09e1534835c749de362b9b38e2d8b286236)
190921014SLuciano Coelho /*
290921014SLuciano Coelho  * This file is part of wl1251
390921014SLuciano Coelho  *
490921014SLuciano Coelho  * Copyright (c) 1998-2007 Texas Instruments Incorporated
590921014SLuciano Coelho  * Copyright (C) 2008-2009 Nokia Corporation
690921014SLuciano Coelho  *
790921014SLuciano Coelho  * This program is free software; you can redistribute it and/or
890921014SLuciano Coelho  * modify it under the terms of the GNU General Public License
990921014SLuciano Coelho  * version 2 as published by the Free Software Foundation.
1090921014SLuciano Coelho  *
1190921014SLuciano Coelho  * This program is distributed in the hope that it will be useful, but
1290921014SLuciano Coelho  * WITHOUT ANY WARRANTY; without even the implied warranty of
1390921014SLuciano Coelho  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1490921014SLuciano Coelho  * General Public License for more details.
1590921014SLuciano Coelho  *
1690921014SLuciano Coelho  * You should have received a copy of the GNU General Public License
1790921014SLuciano Coelho  * along with this program; if not, write to the Free Software
1890921014SLuciano Coelho  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
1990921014SLuciano Coelho  * 02110-1301 USA
2090921014SLuciano Coelho  *
2190921014SLuciano Coelho  */
2290921014SLuciano Coelho 
2390921014SLuciano Coelho #ifndef __WL1251_H__
2490921014SLuciano Coelho #define __WL1251_H__
2590921014SLuciano Coelho 
2690921014SLuciano Coelho #include <linux/mutex.h>
2790921014SLuciano Coelho #include <linux/list.h>
2890921014SLuciano Coelho #include <linux/bitops.h>
2990921014SLuciano Coelho #include <net/mac80211.h>
3090921014SLuciano Coelho 
3190921014SLuciano Coelho #define DRIVER_NAME "wl1251"
3290921014SLuciano Coelho #define DRIVER_PREFIX DRIVER_NAME ": "
3390921014SLuciano Coelho 
3490921014SLuciano Coelho enum {
3590921014SLuciano Coelho 	DEBUG_NONE	= 0,
3690921014SLuciano Coelho 	DEBUG_IRQ	= BIT(0),
3790921014SLuciano Coelho 	DEBUG_SPI	= BIT(1),
3890921014SLuciano Coelho 	DEBUG_BOOT	= BIT(2),
3990921014SLuciano Coelho 	DEBUG_MAILBOX	= BIT(3),
4090921014SLuciano Coelho 	DEBUG_NETLINK	= BIT(4),
4190921014SLuciano Coelho 	DEBUG_EVENT	= BIT(5),
4290921014SLuciano Coelho 	DEBUG_TX	= BIT(6),
4390921014SLuciano Coelho 	DEBUG_RX	= BIT(7),
4490921014SLuciano Coelho 	DEBUG_SCAN	= BIT(8),
4590921014SLuciano Coelho 	DEBUG_CRYPT	= BIT(9),
4690921014SLuciano Coelho 	DEBUG_PSM	= BIT(10),
4790921014SLuciano Coelho 	DEBUG_MAC80211	= BIT(11),
4890921014SLuciano Coelho 	DEBUG_CMD	= BIT(12),
4990921014SLuciano Coelho 	DEBUG_ACX	= BIT(13),
5090921014SLuciano Coelho 	DEBUG_ALL	= ~0,
5190921014SLuciano Coelho };
5290921014SLuciano Coelho 
5390921014SLuciano Coelho #define DEBUG_LEVEL (DEBUG_NONE)
5490921014SLuciano Coelho 
5590921014SLuciano Coelho #define DEBUG_DUMP_LIMIT 1024
5690921014SLuciano Coelho 
5790921014SLuciano Coelho #define wl1251_error(fmt, arg...) \
5890921014SLuciano Coelho 	printk(KERN_ERR DRIVER_PREFIX "ERROR " fmt "\n", ##arg)
5990921014SLuciano Coelho 
6090921014SLuciano Coelho #define wl1251_warning(fmt, arg...) \
6190921014SLuciano Coelho 	printk(KERN_WARNING DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
6290921014SLuciano Coelho 
6390921014SLuciano Coelho #define wl1251_notice(fmt, arg...) \
6490921014SLuciano Coelho 	printk(KERN_INFO DRIVER_PREFIX fmt "\n", ##arg)
6590921014SLuciano Coelho 
6690921014SLuciano Coelho #define wl1251_info(fmt, arg...) \
6790921014SLuciano Coelho 	printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg)
6890921014SLuciano Coelho 
6990921014SLuciano Coelho #define wl1251_debug(level, fmt, arg...) \
7090921014SLuciano Coelho 	do { \
7190921014SLuciano Coelho 		if (level & DEBUG_LEVEL) \
7290921014SLuciano Coelho 			printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg); \
7390921014SLuciano Coelho 	} while (0)
7490921014SLuciano Coelho 
7590921014SLuciano Coelho #define wl1251_dump(level, prefix, buf, len)	\
7690921014SLuciano Coelho 	do { \
7790921014SLuciano Coelho 		if (level & DEBUG_LEVEL) \
7890921014SLuciano Coelho 			print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \
7990921014SLuciano Coelho 				       DUMP_PREFIX_OFFSET, 16, 1,	\
8090921014SLuciano Coelho 				       buf,				\
8190921014SLuciano Coelho 				       min_t(size_t, len, DEBUG_DUMP_LIMIT), \
8290921014SLuciano Coelho 				       0);				\
8390921014SLuciano Coelho 	} while (0)
8490921014SLuciano Coelho 
8590921014SLuciano Coelho #define wl1251_dump_ascii(level, prefix, buf, len)	\
8690921014SLuciano Coelho 	do { \
8790921014SLuciano Coelho 		if (level & DEBUG_LEVEL) \
8890921014SLuciano Coelho 			print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \
8990921014SLuciano Coelho 				       DUMP_PREFIX_OFFSET, 16, 1,	\
9090921014SLuciano Coelho 				       buf,				\
9190921014SLuciano Coelho 				       min_t(size_t, len, DEBUG_DUMP_LIMIT), \
9290921014SLuciano Coelho 				       true);				\
9390921014SLuciano Coelho 	} while (0)
9490921014SLuciano Coelho 
9590921014SLuciano Coelho #define WL1251_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN |	\
969ed74ba0SDavid Gnedt 				  CFG_MC_FILTER_EN |	\
9790921014SLuciano Coelho 				  CFG_BSSID_FILTER_EN)
9890921014SLuciano Coelho 
9990921014SLuciano Coelho #define WL1251_DEFAULT_RX_FILTER (CFG_RX_PRSP_EN |  \
10090921014SLuciano Coelho 				  CFG_RX_MGMT_EN |  \
10190921014SLuciano Coelho 				  CFG_RX_DATA_EN |  \
10290921014SLuciano Coelho 				  CFG_RX_CTL_EN |   \
10390921014SLuciano Coelho 				  CFG_RX_BCN_EN |   \
10490921014SLuciano Coelho 				  CFG_RX_AUTH_EN |  \
10590921014SLuciano Coelho 				  CFG_RX_ASSOC_EN)
10690921014SLuciano Coelho 
10790921014SLuciano Coelho #define WL1251_BUSY_WORD_LEN 8
10890921014SLuciano Coelho 
10990921014SLuciano Coelho struct boot_attr {
11090921014SLuciano Coelho 	u32 radio_type;
11190921014SLuciano Coelho 	u8 mac_clock;
11290921014SLuciano Coelho 	u8 arm_clock;
11390921014SLuciano Coelho 	int firmware_debug;
11490921014SLuciano Coelho 	u32 minor;
11590921014SLuciano Coelho 	u32 major;
11690921014SLuciano Coelho 	u32 bugfix;
11790921014SLuciano Coelho };
11890921014SLuciano Coelho 
11990921014SLuciano Coelho enum wl1251_state {
12090921014SLuciano Coelho 	WL1251_STATE_OFF,
12190921014SLuciano Coelho 	WL1251_STATE_ON,
12290921014SLuciano Coelho 	WL1251_STATE_PLT,
12390921014SLuciano Coelho };
12490921014SLuciano Coelho 
12590921014SLuciano Coelho enum wl1251_partition_type {
12690921014SLuciano Coelho 	PART_DOWN,
12790921014SLuciano Coelho 	PART_WORK,
12890921014SLuciano Coelho 	PART_DRPW,
12990921014SLuciano Coelho 
13090921014SLuciano Coelho 	PART_TABLE_LEN
13190921014SLuciano Coelho };
13290921014SLuciano Coelho 
13390921014SLuciano Coelho enum wl1251_station_mode {
13490921014SLuciano Coelho 	STATION_ACTIVE_MODE,
13590921014SLuciano Coelho 	STATION_POWER_SAVE_MODE,
13690921014SLuciano Coelho 	STATION_IDLE,
13790921014SLuciano Coelho };
13890921014SLuciano Coelho 
13990921014SLuciano Coelho struct wl1251_partition {
14090921014SLuciano Coelho 	u32 size;
14190921014SLuciano Coelho 	u32 start;
14290921014SLuciano Coelho };
14390921014SLuciano Coelho 
14490921014SLuciano Coelho struct wl1251_partition_set {
14590921014SLuciano Coelho 	struct wl1251_partition mem;
14690921014SLuciano Coelho 	struct wl1251_partition reg;
14790921014SLuciano Coelho };
14890921014SLuciano Coelho 
14990921014SLuciano Coelho struct wl1251;
15090921014SLuciano Coelho 
15190921014SLuciano Coelho struct wl1251_stats {
15290921014SLuciano Coelho 	struct acx_statistics *fw_stats;
15390921014SLuciano Coelho 	unsigned long fw_stats_update;
15490921014SLuciano Coelho 
15590921014SLuciano Coelho 	unsigned int retry_count;
15690921014SLuciano Coelho 	unsigned int excessive_retries;
15790921014SLuciano Coelho };
15890921014SLuciano Coelho 
15990921014SLuciano Coelho struct wl1251_debugfs {
16090921014SLuciano Coelho 	struct dentry *rootdir;
16190921014SLuciano Coelho 	struct dentry *fw_statistics;
16290921014SLuciano Coelho 
16390921014SLuciano Coelho 	struct dentry *tx_internal_desc_overflow;
16490921014SLuciano Coelho 
16590921014SLuciano Coelho 	struct dentry *rx_out_of_mem;
16690921014SLuciano Coelho 	struct dentry *rx_hdr_overflow;
16790921014SLuciano Coelho 	struct dentry *rx_hw_stuck;
16890921014SLuciano Coelho 	struct dentry *rx_dropped;
16990921014SLuciano Coelho 	struct dentry *rx_fcs_err;
17090921014SLuciano Coelho 	struct dentry *rx_xfr_hint_trig;
17190921014SLuciano Coelho 	struct dentry *rx_path_reset;
17290921014SLuciano Coelho 	struct dentry *rx_reset_counter;
17390921014SLuciano Coelho 
17490921014SLuciano Coelho 	struct dentry *dma_rx_requested;
17590921014SLuciano Coelho 	struct dentry *dma_rx_errors;
17690921014SLuciano Coelho 	struct dentry *dma_tx_requested;
17790921014SLuciano Coelho 	struct dentry *dma_tx_errors;
17890921014SLuciano Coelho 
17990921014SLuciano Coelho 	struct dentry *isr_cmd_cmplt;
18090921014SLuciano Coelho 	struct dentry *isr_fiqs;
18190921014SLuciano Coelho 	struct dentry *isr_rx_headers;
18290921014SLuciano Coelho 	struct dentry *isr_rx_mem_overflow;
18390921014SLuciano Coelho 	struct dentry *isr_rx_rdys;
18490921014SLuciano Coelho 	struct dentry *isr_irqs;
18590921014SLuciano Coelho 	struct dentry *isr_tx_procs;
18690921014SLuciano Coelho 	struct dentry *isr_decrypt_done;
18790921014SLuciano Coelho 	struct dentry *isr_dma0_done;
18890921014SLuciano Coelho 	struct dentry *isr_dma1_done;
18990921014SLuciano Coelho 	struct dentry *isr_tx_exch_complete;
19090921014SLuciano Coelho 	struct dentry *isr_commands;
19190921014SLuciano Coelho 	struct dentry *isr_rx_procs;
19290921014SLuciano Coelho 	struct dentry *isr_hw_pm_mode_changes;
19390921014SLuciano Coelho 	struct dentry *isr_host_acknowledges;
19490921014SLuciano Coelho 	struct dentry *isr_pci_pm;
19590921014SLuciano Coelho 	struct dentry *isr_wakeups;
19690921014SLuciano Coelho 	struct dentry *isr_low_rssi;
19790921014SLuciano Coelho 
19890921014SLuciano Coelho 	struct dentry *wep_addr_key_count;
19990921014SLuciano Coelho 	struct dentry *wep_default_key_count;
20090921014SLuciano Coelho 	/* skipping wep.reserved */
20190921014SLuciano Coelho 	struct dentry *wep_key_not_found;
20290921014SLuciano Coelho 	struct dentry *wep_decrypt_fail;
20390921014SLuciano Coelho 	struct dentry *wep_packets;
20490921014SLuciano Coelho 	struct dentry *wep_interrupt;
20590921014SLuciano Coelho 
20690921014SLuciano Coelho 	struct dentry *pwr_ps_enter;
20790921014SLuciano Coelho 	struct dentry *pwr_elp_enter;
20890921014SLuciano Coelho 	struct dentry *pwr_missing_bcns;
20990921014SLuciano Coelho 	struct dentry *pwr_wake_on_host;
21090921014SLuciano Coelho 	struct dentry *pwr_wake_on_timer_exp;
21190921014SLuciano Coelho 	struct dentry *pwr_tx_with_ps;
21290921014SLuciano Coelho 	struct dentry *pwr_tx_without_ps;
21390921014SLuciano Coelho 	struct dentry *pwr_rcvd_beacons;
21490921014SLuciano Coelho 	struct dentry *pwr_power_save_off;
21590921014SLuciano Coelho 	struct dentry *pwr_enable_ps;
21690921014SLuciano Coelho 	struct dentry *pwr_disable_ps;
21790921014SLuciano Coelho 	struct dentry *pwr_fix_tsf_ps;
21890921014SLuciano Coelho 	/* skipping cont_miss_bcns_spread for now */
21990921014SLuciano Coelho 	struct dentry *pwr_rcvd_awake_beacons;
22090921014SLuciano Coelho 
22190921014SLuciano Coelho 	struct dentry *mic_rx_pkts;
22290921014SLuciano Coelho 	struct dentry *mic_calc_failure;
22390921014SLuciano Coelho 
22490921014SLuciano Coelho 	struct dentry *aes_encrypt_fail;
22590921014SLuciano Coelho 	struct dentry *aes_decrypt_fail;
22690921014SLuciano Coelho 	struct dentry *aes_encrypt_packets;
22790921014SLuciano Coelho 	struct dentry *aes_decrypt_packets;
22890921014SLuciano Coelho 	struct dentry *aes_encrypt_interrupt;
22990921014SLuciano Coelho 	struct dentry *aes_decrypt_interrupt;
23090921014SLuciano Coelho 
23190921014SLuciano Coelho 	struct dentry *event_heart_beat;
23290921014SLuciano Coelho 	struct dentry *event_calibration;
23390921014SLuciano Coelho 	struct dentry *event_rx_mismatch;
23490921014SLuciano Coelho 	struct dentry *event_rx_mem_empty;
23590921014SLuciano Coelho 	struct dentry *event_rx_pool;
23690921014SLuciano Coelho 	struct dentry *event_oom_late;
23790921014SLuciano Coelho 	struct dentry *event_phy_transmit_error;
23890921014SLuciano Coelho 	struct dentry *event_tx_stuck;
23990921014SLuciano Coelho 
24090921014SLuciano Coelho 	struct dentry *ps_pspoll_timeouts;
24190921014SLuciano Coelho 	struct dentry *ps_upsd_timeouts;
24290921014SLuciano Coelho 	struct dentry *ps_upsd_max_sptime;
24390921014SLuciano Coelho 	struct dentry *ps_upsd_max_apturn;
24490921014SLuciano Coelho 	struct dentry *ps_pspoll_max_apturn;
24590921014SLuciano Coelho 	struct dentry *ps_pspoll_utilization;
24690921014SLuciano Coelho 	struct dentry *ps_upsd_utilization;
24790921014SLuciano Coelho 
24890921014SLuciano Coelho 	struct dentry *rxpipe_rx_prep_beacon_drop;
24990921014SLuciano Coelho 	struct dentry *rxpipe_descr_host_int_trig_rx_data;
25090921014SLuciano Coelho 	struct dentry *rxpipe_beacon_buffer_thres_host_int_trig_rx_data;
25190921014SLuciano Coelho 	struct dentry *rxpipe_missed_beacon_host_int_trig_rx_data;
25290921014SLuciano Coelho 	struct dentry *rxpipe_tx_xfr_host_int_trig_rx_data;
25390921014SLuciano Coelho 
25490921014SLuciano Coelho 	struct dentry *tx_queue_len;
25590921014SLuciano Coelho 	struct dentry *tx_queue_status;
25690921014SLuciano Coelho 
25790921014SLuciano Coelho 	struct dentry *retry_count;
25890921014SLuciano Coelho 	struct dentry *excessive_retries;
25990921014SLuciano Coelho };
26090921014SLuciano Coelho 
26190921014SLuciano Coelho struct wl1251_if_operations {
26290921014SLuciano Coelho 	void (*read)(struct wl1251 *wl, int addr, void *buf, size_t len);
26390921014SLuciano Coelho 	void (*write)(struct wl1251 *wl, int addr, void *buf, size_t len);
26490921014SLuciano Coelho 	void (*read_elp)(struct wl1251 *wl, int addr, u32 *val);
26590921014SLuciano Coelho 	void (*write_elp)(struct wl1251 *wl, int addr, u32 val);
26690921014SLuciano Coelho 	int  (*power)(struct wl1251 *wl, bool enable);
26790921014SLuciano Coelho 	void (*reset)(struct wl1251 *wl);
26890921014SLuciano Coelho 	void (*enable_irq)(struct wl1251 *wl);
26990921014SLuciano Coelho 	void (*disable_irq)(struct wl1251 *wl);
27090921014SLuciano Coelho };
27190921014SLuciano Coelho 
27290921014SLuciano Coelho struct wl1251 {
27390921014SLuciano Coelho 	struct ieee80211_hw *hw;
27490921014SLuciano Coelho 	bool mac80211_registered;
27590921014SLuciano Coelho 
27690921014SLuciano Coelho 	void *if_priv;
27790921014SLuciano Coelho 	const struct wl1251_if_operations *if_ops;
27890921014SLuciano Coelho 
2791d207cd3SSebastian Reichel 	int power_gpio;
28090921014SLuciano Coelho 	int irq;
28190921014SLuciano Coelho 	bool use_eeprom;
28290921014SLuciano Coelho 
283*e4c2e09eSSebastian Reichel 	struct regulator *vio;
284*e4c2e09eSSebastian Reichel 
28590921014SLuciano Coelho 	spinlock_t wl_lock;
28690921014SLuciano Coelho 
28790921014SLuciano Coelho 	enum wl1251_state state;
28890921014SLuciano Coelho 	struct mutex mutex;
28990921014SLuciano Coelho 
29090921014SLuciano Coelho 	int physical_mem_addr;
29190921014SLuciano Coelho 	int physical_reg_addr;
29290921014SLuciano Coelho 	int virtual_mem_addr;
29390921014SLuciano Coelho 	int virtual_reg_addr;
29490921014SLuciano Coelho 
29590921014SLuciano Coelho 	int cmd_box_addr;
29690921014SLuciano Coelho 	int event_box_addr;
29790921014SLuciano Coelho 	struct boot_attr boot_attr;
29890921014SLuciano Coelho 
29990921014SLuciano Coelho 	u8 *fw;
30090921014SLuciano Coelho 	size_t fw_len;
30190921014SLuciano Coelho 	u8 *nvs;
30290921014SLuciano Coelho 	size_t nvs_len;
30390921014SLuciano Coelho 
30490921014SLuciano Coelho 	u8 bssid[ETH_ALEN];
30590921014SLuciano Coelho 	u8 mac_addr[ETH_ALEN];
30690921014SLuciano Coelho 	u8 bss_type;
30790921014SLuciano Coelho 	u8 listen_int;
30890921014SLuciano Coelho 	int channel;
3094d09b537SDavid Gnedt 	bool monitor_present;
310c8909e5aSDavid Gnedt 	bool joined;
31190921014SLuciano Coelho 
31290921014SLuciano Coelho 	void *target_mem_map;
31390921014SLuciano Coelho 	struct acx_data_path_params_resp *data_path;
31490921014SLuciano Coelho 
31590921014SLuciano Coelho 	/* Number of TX packets transferred to the FW, modulo 16 */
31690921014SLuciano Coelho 	u32 data_in_count;
31790921014SLuciano Coelho 
31890921014SLuciano Coelho 	/* Frames scheduled for transmission, not handled yet */
31990921014SLuciano Coelho 	struct sk_buff_head tx_queue;
32090921014SLuciano Coelho 	bool tx_queue_stopped;
32190921014SLuciano Coelho 
32290921014SLuciano Coelho 	struct work_struct tx_work;
32390921014SLuciano Coelho 
32490921014SLuciano Coelho 	/* Pending TX frames */
32590921014SLuciano Coelho 	struct sk_buff *tx_frames[16];
32690921014SLuciano Coelho 
32790921014SLuciano Coelho 	/*
32890921014SLuciano Coelho 	 * Index pointing to the next TX complete entry
32990921014SLuciano Coelho 	 * in the cyclic XT complete array we get from
33090921014SLuciano Coelho 	 * the FW.
33190921014SLuciano Coelho 	 */
33290921014SLuciano Coelho 	u32 next_tx_complete;
33390921014SLuciano Coelho 
33490921014SLuciano Coelho 	/* FW Rx counter */
33590921014SLuciano Coelho 	u32 rx_counter;
33690921014SLuciano Coelho 
33790921014SLuciano Coelho 	/* Rx frames handled */
33890921014SLuciano Coelho 	u32 rx_handled;
33990921014SLuciano Coelho 
34090921014SLuciano Coelho 	/* Current double buffer */
34190921014SLuciano Coelho 	u32 rx_current_buffer;
34290921014SLuciano Coelho 	u32 rx_last_id;
34390921014SLuciano Coelho 
34490921014SLuciano Coelho 	/* The target interrupt mask */
34590921014SLuciano Coelho 	u32 intr_mask;
34690921014SLuciano Coelho 	struct work_struct irq_work;
34790921014SLuciano Coelho 
34890921014SLuciano Coelho 	/* The mbox event mask */
34990921014SLuciano Coelho 	u32 event_mask;
35090921014SLuciano Coelho 
35190921014SLuciano Coelho 	/* Mailbox pointers */
35290921014SLuciano Coelho 	u32 mbox_ptr[2];
35390921014SLuciano Coelho 
35490921014SLuciano Coelho 	/* Are we currently scanning */
35590921014SLuciano Coelho 	bool scanning;
35690921014SLuciano Coelho 
35790921014SLuciano Coelho 	/* Default key (for WEP) */
35890921014SLuciano Coelho 	u32 default_key;
35990921014SLuciano Coelho 
36090921014SLuciano Coelho 	unsigned int tx_mgmt_frm_rate;
36190921014SLuciano Coelho 	unsigned int tx_mgmt_frm_mod;
36290921014SLuciano Coelho 
36390921014SLuciano Coelho 	unsigned int rx_config;
36490921014SLuciano Coelho 	unsigned int rx_filter;
36590921014SLuciano Coelho 
36690921014SLuciano Coelho 	/* is firmware in elp mode */
36790921014SLuciano Coelho 	bool elp;
36890921014SLuciano Coelho 
36990921014SLuciano Coelho 	struct delayed_work elp_work;
37090921014SLuciano Coelho 
37190921014SLuciano Coelho 	enum wl1251_station_mode station_mode;
37290921014SLuciano Coelho 
37390921014SLuciano Coelho 	/* PSM mode requested */
37490921014SLuciano Coelho 	bool psm_requested;
37590921014SLuciano Coelho 
376f7ad1eedSDavid Gnedt 	/* retry counter for PSM entries */
377f7ad1eedSDavid Gnedt 	u8 psm_entry_retry;
378f7ad1eedSDavid Gnedt 
37990921014SLuciano Coelho 	u16 beacon_int;
38090921014SLuciano Coelho 	u8 dtim_period;
38190921014SLuciano Coelho 
38290921014SLuciano Coelho 	/* in dBm */
38390921014SLuciano Coelho 	int power_level;
38490921014SLuciano Coelho 
38590921014SLuciano Coelho 	int rssi_thold;
38690921014SLuciano Coelho 
38790921014SLuciano Coelho 	struct wl1251_stats stats;
38890921014SLuciano Coelho 	struct wl1251_debugfs debugfs;
38990921014SLuciano Coelho 
39090921014SLuciano Coelho 	__le32 buffer_32;
39190921014SLuciano Coelho 	u32 buffer_cmd;
39290921014SLuciano Coelho 	u8 buffer_busyword[WL1251_BUSY_WORD_LEN];
39390921014SLuciano Coelho 	struct wl1251_rx_descriptor *rx_descriptor;
39490921014SLuciano Coelho 
39590921014SLuciano Coelho 	struct ieee80211_vif *vif;
39690921014SLuciano Coelho 
39790921014SLuciano Coelho 	u32 chip_id;
39890921014SLuciano Coelho 	char fw_ver[21];
39990921014SLuciano Coelho 
40090921014SLuciano Coelho 	/* Most recently reported noise in dBm */
40190921014SLuciano Coelho 	s8 noise;
40290921014SLuciano Coelho };
40390921014SLuciano Coelho 
40490921014SLuciano Coelho int wl1251_plt_start(struct wl1251 *wl);
40590921014SLuciano Coelho int wl1251_plt_stop(struct wl1251 *wl);
40690921014SLuciano Coelho 
40790921014SLuciano Coelho struct ieee80211_hw *wl1251_alloc_hw(void);
40890921014SLuciano Coelho int wl1251_free_hw(struct wl1251 *wl);
40990921014SLuciano Coelho int wl1251_init_ieee80211(struct wl1251 *wl);
41090921014SLuciano Coelho void wl1251_enable_interrupts(struct wl1251 *wl);
41190921014SLuciano Coelho void wl1251_disable_interrupts(struct wl1251 *wl);
41290921014SLuciano Coelho 
41390921014SLuciano Coelho #define DEFAULT_HW_GEN_MODULATION_TYPE    CCK_LONG /* Long Preamble */
41490921014SLuciano Coelho #define DEFAULT_HW_GEN_TX_RATE          RATE_2MBPS
41590921014SLuciano Coelho #define JOIN_TIMEOUT 5000 /* 5000 milliseconds to join */
41690921014SLuciano Coelho 
41790921014SLuciano Coelho #define WL1251_DEFAULT_POWER_LEVEL 20
41890921014SLuciano Coelho 
41990921014SLuciano Coelho #define WL1251_TX_QUEUE_LOW_WATERMARK  10
42090921014SLuciano Coelho #define WL1251_TX_QUEUE_HIGH_WATERMARK 25
42190921014SLuciano Coelho 
42290921014SLuciano Coelho #define WL1251_DEFAULT_BEACON_INT 100
42390921014SLuciano Coelho #define WL1251_DEFAULT_DTIM_PERIOD 1
42490921014SLuciano Coelho 
42590921014SLuciano Coelho #define WL1251_DEFAULT_CHANNEL 0
42690921014SLuciano Coelho 
42790921014SLuciano Coelho #define WL1251_DEFAULT_BET_CONSECUTIVE 10
42890921014SLuciano Coelho 
42990921014SLuciano Coelho #define CHIP_ID_1251_PG10	           (0x7010101)
43090921014SLuciano Coelho #define CHIP_ID_1251_PG11	           (0x7020101)
43190921014SLuciano Coelho #define CHIP_ID_1251_PG12	           (0x7030101)
43290921014SLuciano Coelho #define CHIP_ID_1271_PG10	           (0x4030101)
43390921014SLuciano Coelho #define CHIP_ID_1271_PG20	           (0x4030111)
43490921014SLuciano Coelho 
4359f55c620SFelipe Balbi #define WL1251_FW_NAME "ti-connectivity/wl1251-fw.bin"
4369f55c620SFelipe Balbi #define WL1251_NVS_NAME "ti-connectivity/wl1251-nvs.bin"
43790921014SLuciano Coelho 
43890921014SLuciano Coelho #define WL1251_POWER_ON_SLEEP 10 /* in milliseconds */
43990921014SLuciano Coelho 
44090921014SLuciano Coelho #define WL1251_PART_DOWN_MEM_START	0x0
44190921014SLuciano Coelho #define WL1251_PART_DOWN_MEM_SIZE	0x16800
44290921014SLuciano Coelho #define WL1251_PART_DOWN_REG_START	REGISTERS_BASE
44390921014SLuciano Coelho #define WL1251_PART_DOWN_REG_SIZE	REGISTERS_DOWN_SIZE
44490921014SLuciano Coelho 
44590921014SLuciano Coelho #define WL1251_PART_WORK_MEM_START	0x28000
44690921014SLuciano Coelho #define WL1251_PART_WORK_MEM_SIZE	0x14000
44790921014SLuciano Coelho #define WL1251_PART_WORK_REG_START	REGISTERS_BASE
44890921014SLuciano Coelho #define WL1251_PART_WORK_REG_SIZE	REGISTERS_WORK_SIZE
44990921014SLuciano Coelho 
45090921014SLuciano Coelho #define WL1251_DEFAULT_LOW_RSSI_WEIGHT          10
45190921014SLuciano Coelho #define WL1251_DEFAULT_LOW_RSSI_DEPTH           10
45290921014SLuciano Coelho 
45390921014SLuciano Coelho #endif
454