Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
[cascardo/linux.git] / drivers / net / wireless / libertas / dev.h
1 /*
2  * This file contains definitions and data structures specific
3  * to Marvell 802.11 NIC. It contains the Device Information
4  * structure struct lbs_private..
5  */
6 #ifndef _LBS_DEV_H_
7 #define _LBS_DEV_H_
8
9 #include "mesh.h"
10 #include "defs.h"
11 #include "host.h"
12
13 #include <linux/kfifo.h>
14
15 /* sleep_params */
16 struct sleep_params {
17         uint16_t sp_error;
18         uint16_t sp_offset;
19         uint16_t sp_stabletime;
20         uint8_t  sp_calcontrol;
21         uint8_t  sp_extsleepclk;
22         uint16_t sp_reserved;
23 };
24
25
26 /* Private structure for the MV device */
27 struct lbs_private {
28
29         /* Basic networking */
30         struct net_device *dev;
31         u32 connect_status;
32         struct work_struct mcast_work;
33         u32 nr_of_multicastmacaddr;
34         u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
35
36         /* CFG80211 */
37         struct wireless_dev *wdev;
38         bool wiphy_registered;
39         bool stopping;
40         struct cfg80211_scan_request *scan_req;
41         u8 assoc_bss[ETH_ALEN];
42         u8 disassoc_reason;
43
44         /* Mesh */
45         struct net_device *mesh_dev; /* Virtual device */
46 #ifdef CONFIG_LIBERTAS_MESH
47         struct lbs_mesh_stats mstats;
48         uint16_t mesh_tlv;
49         u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
50         u8 mesh_ssid_len;
51 #endif
52
53         /* Debugfs */
54         struct dentry *debugfs_dir;
55         struct dentry *debugfs_debug;
56         struct dentry *debugfs_files[6];
57         struct dentry *events_dir;
58         struct dentry *debugfs_events_files[6];
59         struct dentry *regs_dir;
60         struct dentry *debugfs_regs_files[6];
61
62         /* Hardware debugging */
63         u32 mac_offset;
64         u32 bbp_offset;
65         u32 rf_offset;
66
67         /* Power management */
68         u16 psmode;
69         u32 psstate;
70         u8 needtowakeup;
71
72         /* Deep sleep */
73         int is_deep_sleep;
74         int deep_sleep_required;
75         int is_auto_deep_sleep_enabled;
76         int wakeup_dev_required;
77         int is_activity_detected;
78         int auto_deep_sleep_timeout; /* in ms */
79         wait_queue_head_t ds_awake_q;
80         struct timer_list auto_deepsleep_timer;
81
82         /* Host sleep*/
83         int is_host_sleep_configured;
84         int is_host_sleep_activated;
85         wait_queue_head_t host_sleep_q;
86
87         /* Hardware access */
88         void *card;
89         u8 fw_ready;
90         u8 surpriseremoved;
91         u8 setup_fw_on_resume;
92         int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
93         void (*reset_card) (struct lbs_private *priv);
94         int (*enter_deep_sleep) (struct lbs_private *priv);
95         int (*exit_deep_sleep) (struct lbs_private *priv);
96         int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
97
98         /* Adapter info (from EEPROM) */
99         u32 fwrelease;
100         u32 fwcapinfo;
101         u16 regioncode;
102         u8 current_addr[ETH_ALEN];
103         u8 copied_hwaddr;
104
105         /* Command download */
106         u8 dnld_sent;
107         /* bit0 1/0=data_sent/data_tx_done,
108            bit1 1/0=cmd_sent/cmd_tx_done,
109            all other bits reserved 0 */
110         u16 seqnum;
111         struct cmd_ctrl_node *cmd_array;
112         struct cmd_ctrl_node *cur_cmd;
113         struct list_head cmdfreeq;    /* free command buffers */
114         struct list_head cmdpendingq; /* pending command buffers */
115         struct timer_list command_timer;
116         int cmd_timed_out;
117
118         /* Command responses sent from the hardware to the driver */
119         u8 resp_idx;
120         u8 resp_buf[2][LBS_UPLD_SIZE];
121         u32 resp_len[2];
122
123         /* Events sent from hardware to driver */
124         struct kfifo event_fifo;
125
126         /* thread to service interrupts */
127         struct task_struct *main_thread;
128         wait_queue_head_t waitq;
129         struct workqueue_struct *work_thread;
130
131         /* Encryption stuff */
132         u8 authtype_auto;
133         u8 wep_tx_key;
134         u8 wep_key[4][WLAN_KEY_LEN_WEP104];
135         u8 wep_key_len[4];
136
137         /* Wake On LAN */
138         uint32_t wol_criteria;
139         uint8_t wol_gpio;
140         uint8_t wol_gap;
141         bool ehs_remove_supported;
142
143         /* Transmitting */
144         int tx_pending_len;             /* -1 while building packet */
145         u8 tx_pending_buf[LBS_UPLD_SIZE];
146         /* protected by hard_start_xmit serialization */
147         u8 txretrycount;
148         struct sk_buff *currenttxskb;
149
150         /* Locks */
151         struct mutex lock;
152         spinlock_t driver_lock;
153
154         /* NIC/link operation characteristics */
155         u16 mac_control;
156         u8 radio_on;
157         u8 cur_rate;
158         u8 channel;
159         s16 txpower_cur;
160         s16 txpower_min;
161         s16 txpower_max;
162
163         /* Scanning */
164         struct delayed_work scan_work;
165         int scan_channel;
166         /* Queue of things waiting for scan completion */
167         wait_queue_head_t scan_q;
168         /* Whether the scan was initiated internally and not by cfg80211 */
169         bool internal_scan;
170         unsigned long last_scan;
171 };
172
173 extern struct cmd_confirm_sleep confirm_sleep;
174
175 #endif