blob: 25ab400f2ebd1c9aab2ce8a75f588f355640dd03 [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) 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 __CMD_H__
26#define __CMD_H__
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030027
Shahar Levi00d20102010-11-08 11:20:10 +000028#include "wl12xx.h"
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030029
30struct acx_header;
31
Juuso Oikarinenfa867e72009-11-02 20:22:13 +020032int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len,
33 size_t res_len);
Luciano Coelho98b5dd52009-11-23 23:22:17 +020034int wl1271_cmd_general_parms(struct wl1271 *wl);
Shahar Levi49d750ca2011-03-06 16:32:09 +020035int wl128x_cmd_general_parms(struct wl1271 *wl);
Luciano Coelho98b5dd52009-11-23 23:22:17 +020036int wl1271_cmd_radio_parms(struct wl1271 *wl);
Shahar Levi49d750ca2011-03-06 16:32:09 +020037int wl128x_cmd_radio_parms(struct wl1271 *wl);
Juuso Oikarinen644a4862010-10-05 13:11:56 +020038int wl1271_cmd_ext_radio_parms(struct wl1271 *wl);
Eliad Peller784f6942011-10-05 11:55:39 +020039int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type,
40 u8 *role_id);
Eliad Pellerc690ec82011-08-14 13:17:07 +030041int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id);
Eliad Peller7edebf52011-10-05 11:55:52 +020042int wl12xx_cmd_role_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif);
43int wl12xx_cmd_role_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller87fbcb02011-10-05 11:55:41 +020044int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller0603d892011-10-05 11:55:51 +020045int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller87fbcb02011-10-05 11:55:41 +020046int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller0603d892011-10-05 11:55:51 +020047int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller87fbcb02011-10-05 11:55:41 +020048int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030049int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
50int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
51int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
Luciano Coelho94210892009-12-11 15:40:55 +020052int wl1271_cmd_data_path(struct wl1271 *wl, bool enable);
Eliad Peller0603d892011-10-05 11:55:51 +020053int wl1271_cmd_ps_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
54 u8 ps_mode);
Juuso Oikarinen65cddbf2010-08-24 06:28:03 +030055int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
56 size_t len);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030057int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
Juuso Oikarinen606c1482010-04-01 11:38:21 +030058 void *buf, size_t buf_len, int index, u32 rates);
Eliad Pellerd2d66c52011-10-05 11:55:43 +020059int wl12xx_cmd_build_null_data(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Peller87fbcb02011-10-05 11:55:41 +020060int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif,
61 u16 aid);
Kalle Valo818e3062010-03-18 12:26:35 +020062int wl1271_cmd_build_probe_req(struct wl1271 *wl,
63 const u8 *ssid, size_t ssid_len,
64 const u8 *ie, size_t ie_len, u8 band);
Juuso Oikarinen2f6724b2010-11-24 08:16:57 +020065struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl,
66 struct sk_buff *skb);
Eliad Pellerd2d66c52011-10-05 11:55:43 +020067int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif,
68 __be32 ip_addr);
Eliad Peller784f6942011-10-05 11:55:39 +020069int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif);
Eliad Pellerd2d66c52011-10-05 11:55:43 +020070int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl,
71 struct wl12xx_vif *wlvif);
Eliad Pellerc690ec82011-08-14 13:17:07 +030072int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid);
Eliad Peller154da672011-10-05 11:55:53 +020073int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct ieee80211_vif *vif,
74 u16 action, u8 id, u8 key_type,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020075 u8 key_size, const u8 *key, const u8 *addr,
76 u32 tx_seq_32, u16 tx_seq_16);
77int wl1271_cmd_set_ap_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
78 u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
79 u16 tx_seq_16);
Eliad Pellerb67476e2011-08-14 13:17:23 +030080int wl12xx_cmd_set_peer_state(struct wl1271 *wl, u8 hlid);
Eliad Peller251c1772011-08-14 13:17:17 +030081int wl12xx_roc(struct wl1271 *wl, u8 role_id);
82int wl12xx_croc(struct wl1271 *wl, u8 role_id);
Eliad Pellerc690ec82011-08-14 13:17:07 +030083int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid);
84int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid);
Ido Yariv95dac04f2011-06-06 14:57:06 +030085int wl12xx_cmd_config_fwlog(struct wl1271 *wl);
86int wl12xx_cmd_start_fwlog(struct wl1271 *wl);
87int wl12xx_cmd_stop_fwlog(struct wl1271 *wl);
Shahar Levi6d158ff2011-09-08 13:01:33 +030088int wl12xx_cmd_channel_switch(struct wl1271 *wl,
89 struct ieee80211_channel_switch *ch_switch);
90int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030091
92enum wl1271_commands {
93 CMD_INTERROGATE = 1, /*use this to read information elements*/
94 CMD_CONFIGURE = 2, /*use this to write information elements*/
95 CMD_ENABLE_RX = 3,
96 CMD_ENABLE_TX = 4,
97 CMD_DISABLE_RX = 5,
98 CMD_DISABLE_TX = 6,
99 CMD_SCAN = 8,
100 CMD_STOP_SCAN = 9,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300101 CMD_SET_KEYS = 12,
102 CMD_READ_MEMORY = 13,
103 CMD_WRITE_MEMORY = 14,
104 CMD_SET_TEMPLATE = 19,
105 CMD_TEST = 23,
106 CMD_NOISE_HIST = 28,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300107 CMD_QUIET_ELEMENT_SET_STATE = 29,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300108 CMD_SET_BCN_MODE = 33,
109 CMD_MEASUREMENT = 34,
110 CMD_STOP_MEASUREMENT = 35,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300111 CMD_SET_PS_MODE = 37,
112 CMD_CHANNEL_SWITCH = 38,
113 CMD_STOP_CHANNEL_SWICTH = 39,
114 CMD_AP_DISCOVERY = 40,
115 CMD_STOP_AP_DISCOVERY = 41,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300116 CMD_HEALTH_CHECK = 45,
117 CMD_DEBUG = 46,
118 CMD_TRIGGER_SCAN_TO = 47,
119 CMD_CONNECTION_SCAN_CFG = 48,
120 CMD_CONNECTION_SCAN_SSID_CFG = 49,
121 CMD_START_PERIODIC_SCAN = 50,
122 CMD_STOP_PERIODIC_SCAN = 51,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300123 CMD_SET_PEER_STATE = 52,
124 CMD_REMAIN_ON_CHANNEL = 53,
125 CMD_CANCEL_REMAIN_ON_CHANNEL = 54,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300126
Eliad Pellerc690ec82011-08-14 13:17:07 +0300127 CMD_CONFIG_FWLOGGER = 55,
128 CMD_START_FWLOGGER = 56,
129 CMD_STOP_FWLOGGER = 57,
130
131 /* AP commands */
132 CMD_ADD_PEER = 62,
133 CMD_REMOVE_PEER = 63,
134
135 /* Role API */
136 CMD_ROLE_ENABLE = 70,
137 CMD_ROLE_DISABLE = 71,
138 CMD_ROLE_START = 72,
139 CMD_ROLE_STOP = 73,
140
141 /* WIFI Direct */
142 CMD_WFD_START_DISCOVERY = 80,
143 CMD_WFD_STOP_DISCOVERY = 81,
144 CMD_WFD_ATTRIBUTE_CONFIG = 82,
145
146 CMD_NOP = 100,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200147
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300148 NUM_COMMANDS,
149 MAX_COMMAND_ID = 0xFFFF,
150};
151
152#define MAX_CMD_PARAMS 572
153
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +0200154enum {
155 CMD_TEMPL_KLV_IDX_NULL_DATA = 0,
156 CMD_TEMPL_KLV_IDX_MAX = 4
157};
158
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300159enum cmd_templ {
160 CMD_TEMPL_NULL_DATA = 0,
161 CMD_TEMPL_BEACON,
162 CMD_TEMPL_CFG_PROBE_REQ_2_4,
163 CMD_TEMPL_CFG_PROBE_REQ_5,
164 CMD_TEMPL_PROBE_RESPONSE,
165 CMD_TEMPL_QOS_NULL_DATA,
166 CMD_TEMPL_PS_POLL,
167 CMD_TEMPL_KLV,
168 CMD_TEMPL_DISCONNECT,
169 CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */
170 CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */
171 CMD_TEMPL_BAR, /* for firmware internal use only */
172 CMD_TEMPL_CTS, /*
173 * For CTS-to-self (FastCTS) mechanism
174 * for BT/WLAN coexistence (SoftGemini). */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300175 CMD_TEMPL_AP_BEACON,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200176 CMD_TEMPL_AP_PROBE_RESPONSE,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300177 CMD_TEMPL_ARP_RSP,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200178 CMD_TEMPL_DEAUTH_AP,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300179 CMD_TEMPL_TEMPORARY,
180 CMD_TEMPL_LINK_MEASUREMENT_REPORT,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200181
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300182 CMD_TEMPL_MAX = 0xff
183};
184
185/* unit ms */
186#define WL1271_COMMAND_TIMEOUT 2000
Eliad Peller154037d2011-08-14 13:17:12 +0300187#define WL1271_CMD_TEMPL_DFLT_SIZE 252
188#define WL1271_CMD_TEMPL_MAX_SIZE 548
Teemu Paasikivi0cbb1032010-05-07 11:39:01 +0300189#define WL1271_EVENT_TIMEOUT 750
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300190
191struct wl1271_cmd_header {
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300192 __le16 id;
193 __le16 status;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300194 /* payload */
195 u8 data[0];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000196} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300197
198#define WL1271_CMD_MAX_PARAMS 572
199
200struct wl1271_command {
201 struct wl1271_cmd_header header;
202 u8 parameters[WL1271_CMD_MAX_PARAMS];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000203} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300204
205enum {
206 CMD_MAILBOX_IDLE = 0,
207 CMD_STATUS_SUCCESS = 1,
208 CMD_STATUS_UNKNOWN_CMD = 2,
209 CMD_STATUS_UNKNOWN_IE = 3,
210 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
211 CMD_STATUS_RX_BUSY = 13,
212 CMD_STATUS_INVALID_PARAM = 14,
213 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
214 CMD_STATUS_OUT_OF_MEMORY = 16,
215 CMD_STATUS_STA_TABLE_FULL = 17,
216 CMD_STATUS_RADIO_ERROR = 18,
217 CMD_STATUS_WRONG_NESTING = 19,
218 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
219 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
Eliad Pellerc690ec82011-08-14 13:17:07 +0300220 CMD_STATUS_TEMPLATE_OOM = 23,
Arik Nemtsov0f9c8252011-08-17 10:45:49 +0300221 CMD_STATUS_NO_RX_BA_SESSION = 24,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300222 MAX_COMMAND_STATUS = 0xff
223};
224
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300225#define CMDMBOX_HEADER_LEN 4
226#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
227
228enum {
229 BSS_TYPE_IBSS = 0,
230 BSS_TYPE_STA_BSS = 2,
231 BSS_TYPE_AP_BSS = 3,
232 MAX_BSS_TYPE = 0xFF
233};
234
235#define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
236#define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1
Teemu Paasikivia4102642009-10-13 12:47:51 +0300237#define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300238
Eliad Pellerc690ec82011-08-14 13:17:07 +0300239struct wl12xx_cmd_role_enable {
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300240 struct wl1271_cmd_header header;
241
Eliad Pellerc690ec82011-08-14 13:17:07 +0300242 u8 role_id;
243 u8 role_type;
244 u8 mac_address[ETH_ALEN];
245} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300246
Eliad Pellerc690ec82011-08-14 13:17:07 +0300247struct wl12xx_cmd_role_disable {
248 struct wl1271_cmd_header header;
249
250 u8 role_id;
251 u8 padding[3];
252} __packed;
253
254enum wl12xx_band {
255 WL12XX_BAND_2_4GHZ = 0,
256 WL12XX_BAND_5GHZ = 1,
257 WL12XX_BAND_JAPAN_4_9_GHZ = 2,
258 WL12XX_BAND_DEFAULT = WL12XX_BAND_2_4GHZ,
259 WL12XX_BAND_INVALID = 0x7E,
260 WL12XX_BAND_MAX_RADIO = 0x7F,
261};
262
263struct wl12xx_cmd_role_start {
264 struct wl1271_cmd_header header;
265
266 u8 role_id;
267 u8 band;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300268 u8 channel;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300269 u8 padding;
270
271 union {
272 struct {
273 u8 hlid;
274 u8 session;
275 u8 padding_1[54];
276 } __packed device;
277 /* sta & p2p_cli use the same struct */
278 struct {
279 u8 bssid[ETH_ALEN];
280 u8 hlid; /* data hlid */
281 u8 session;
282 __le32 remote_rates; /* remote supported rates */
283
284 /*
285 * The target uses this field to determine the rate at
286 * which to transmit control frame responses (such as
287 * ACK or CTS frames).
288 */
289 __le32 basic_rate_set;
290 __le32 local_rates; /* local supported rates */
291
292 u8 ssid_type;
293 u8 ssid_len;
294 u8 ssid[IEEE80211_MAX_SSID_LEN];
295
296 __le16 beacon_interval; /* in TBTTs */
297 } __packed sta;
298 struct {
299 u8 bssid[ETH_ALEN];
300 u8 hlid; /* data hlid */
301 u8 dtim_interval;
302 __le32 remote_rates; /* remote supported rates */
303
304 __le32 basic_rate_set;
305 __le32 local_rates; /* local supported rates */
306
307 u8 ssid_type;
308 u8 ssid_len;
309 u8 ssid[IEEE80211_MAX_SSID_LEN];
310
311 __le16 beacon_interval; /* in TBTTs */
312
313 u8 padding_1[4];
314 } __packed ibss;
315 /* ap & p2p_go use the same struct */
316 struct {
317 __le16 aging_period; /* in secs */
318 u8 beacon_expiry; /* in ms */
319 u8 bss_index;
320 /* The host link id for the AP's global queue */
321 u8 global_hlid;
322 /* The host link id for the AP's broadcast queue */
323 u8 broadcast_hlid;
324
325 __le16 beacon_interval; /* in TBTTs */
326
327 __le32 basic_rate_set;
328 __le32 local_rates; /* local supported rates */
329
330 u8 dtim_interval;
331
332 u8 ssid_type;
333 u8 ssid_len;
334 u8 ssid[IEEE80211_MAX_SSID_LEN];
335
336 u8 padding_1[5];
337 } __packed ap;
338 };
339} __packed;
340
341struct wl12xx_cmd_role_stop {
342 struct wl1271_cmd_header header;
343
344 u8 role_id;
345 u8 disc_type; /* only STA and P2P_CLI */
346 __le16 reason; /* only STA and P2P_CLI */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000347} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300348
349struct cmd_enabledisable_path {
350 struct wl1271_cmd_header header;
351
352 u8 channel;
353 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000354} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300355
Juuso Oikarinen606c1482010-04-01 11:38:21 +0300356#define WL1271_RATE_AUTOMATIC 0
357
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300358struct wl1271_cmd_template_set {
359 struct wl1271_cmd_header header;
360
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300361 __le16 len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300362 u8 template_type;
363 u8 index; /* relevant only for KLV_TEMPLATE type */
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300364 __le32 enabled_rates;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300365 u8 short_retry_limit;
366 u8 long_retry_limit;
367 u8 aflags;
368 u8 reserved;
369 u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000370} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300371
372#define TIM_ELE_ID 5
373#define PARTIAL_VBM_MAX 251
374
375struct wl1271_tim {
376 u8 identity;
377 u8 length;
378 u8 dtim_count;
379 u8 dtim_period;
380 u8 bitmap_ctrl;
381 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000382} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300383
384enum wl1271_cmd_ps_mode {
385 STATION_ACTIVE_MODE,
386 STATION_POWER_SAVE_MODE
387};
388
389struct wl1271_cmd_ps_params {
390 struct wl1271_cmd_header header;
391
Eliad Pellerc690ec82011-08-14 13:17:07 +0300392 u8 role_id;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300393 u8 ps_mode; /* STATION_* */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300394 u8 padding[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000395} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300396
397/* HW encryption keys */
398#define NUM_ACCESS_CATEGORIES_COPY 4
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300399
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300400enum wl1271_cmd_key_action {
401 KEY_ADD_OR_REPLACE = 1,
402 KEY_REMOVE = 2,
403 KEY_SET_ID = 3,
404 MAX_KEY_ACTION = 0xffff,
405};
406
Eliad Pellerc690ec82011-08-14 13:17:07 +0300407enum wl1271_cmd_lid_key_type {
408 UNICAST_LID_TYPE = 0,
409 BROADCAST_LID_TYPE = 1,
410 WEP_DEFAULT_LID_TYPE = 2
411};
412
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300413enum wl1271_cmd_key_type {
414 KEY_NONE = 0,
415 KEY_WEP = 1,
416 KEY_TKIP = 2,
417 KEY_AES = 3,
Juuso Oikarinen7a557242010-09-27 12:42:07 +0200418 KEY_GEM = 4,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300419};
420
Eliad Pellerc690ec82011-08-14 13:17:07 +0300421struct wl1271_cmd_set_keys {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200422 struct wl1271_cmd_header header;
423
424 /*
425 * Indicates whether the HLID is a unicast key set
426 * or broadcast key set. A special value 0xFF is
427 * used to indicate that the HLID is on WEP-default
428 * (multi-hlids). of type wl1271_cmd_lid_key_type.
429 */
430 u8 hlid;
431
432 /*
433 * In WEP-default network (hlid == 0xFF) used to
434 * indicate which network STA/IBSS/AP role should be
435 * changed
436 */
437 u8 lid_key_type;
438
439 /*
440 * Key ID - For TKIP and AES key types, this field
441 * indicates the value that should be inserted into
442 * the KeyID field of frames transmitted using this
443 * key entry. For broadcast keys the index use as a
444 * marker for TX/RX key.
445 * For WEP default network (HLID=0xFF), this field
446 * indicates the ID of the key to add or remove.
447 */
448 u8 key_id;
449 u8 reserved_1;
450
451 /* key_action_e */
452 __le16 key_action;
453
454 /* key size in bytes */
455 u8 key_size;
456
457 /* key_type_e */
458 u8 key_type;
459
460 /* This field holds the security key data to add to the STA table */
461 u8 key[MAX_KEY_SIZE];
462 __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
463 __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
464} __packed;
465
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300466struct wl1271_cmd_test_header {
467 u8 id;
468 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000469} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300470
471enum wl1271_channel_tune_bands {
472 WL1271_CHANNEL_TUNE_BAND_2_4,
473 WL1271_CHANNEL_TUNE_BAND_5,
474 WL1271_CHANNEL_TUNE_BAND_4_9
475};
476
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200477#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300478
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200479#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
480#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
481#define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200482
483struct wl1271_general_parms_cmd {
484 struct wl1271_cmd_header header;
485
486 struct wl1271_cmd_test_header test;
487
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300488 struct wl1271_ini_general_params general_params;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200489
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300490 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
491 u8 sr_sen_n_p;
492 u8 sr_sen_n_p_gain;
493 u8 sr_sen_nrn;
494 u8 sr_sen_prn;
495 u8 padding[3];
David S. Miller14599f12010-06-11 11:34:06 -0700496} __packed;
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200497
Shahar Levi49d750ca2011-03-06 16:32:09 +0200498struct wl128x_general_parms_cmd {
499 struct wl1271_cmd_header header;
500
501 struct wl1271_cmd_test_header test;
502
503 struct wl128x_ini_general_params general_params;
504
505 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
506 u8 sr_sen_n_p;
507 u8 sr_sen_n_p_gain;
508 u8 sr_sen_nrn;
509 u8 sr_sen_prn;
510 u8 padding[3];
511} __packed;
512
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200513struct wl1271_radio_parms_cmd {
514 struct wl1271_cmd_header header;
515
516 struct wl1271_cmd_test_header test;
517
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300518 /* Static radio parameters */
519 struct wl1271_ini_band_params_2 static_params_2;
520 struct wl1271_ini_band_params_5 static_params_5;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200521
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300522 /* Dynamic radio parameters */
523 struct wl1271_ini_fem_params_2 dyn_params_2;
524 u8 padding2;
525 struct wl1271_ini_fem_params_5 dyn_params_5;
526 u8 padding3[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000527} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300528
Shahar Levi49d750ca2011-03-06 16:32:09 +0200529struct wl128x_radio_parms_cmd {
530 struct wl1271_cmd_header header;
531
532 struct wl1271_cmd_test_header test;
533
534 /* Static radio parameters */
535 struct wl128x_ini_band_params_2 static_params_2;
536 struct wl128x_ini_band_params_5 static_params_5;
537
538 u8 fem_vendor_and_options;
539
540 /* Dynamic radio parameters */
541 struct wl128x_ini_fem_params_2 dyn_params_2;
542 u8 padding2;
543 struct wl128x_ini_fem_params_5 dyn_params_5;
544} __packed;
545
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200546struct wl1271_ext_radio_parms_cmd {
547 struct wl1271_cmd_header header;
548
549 struct wl1271_cmd_test_header test;
550
551 u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
552 u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
553 u8 padding[3];
554} __packed;
555
Luciano Coelho25a7dc62009-10-12 15:08:42 +0300556/*
557 * There are three types of disconnections:
558 *
559 * DISCONNECT_IMMEDIATE: the fw doesn't send any frames
560 * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason
561 * we have passed
562 * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason
563 * we have passed
564 */
565enum wl1271_disconnect_type {
566 DISCONNECT_IMMEDIATE,
567 DISCONNECT_DEAUTH,
568 DISCONNECT_DISASSOC
569};
570
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300571#define WL1271_CMD_STA_STATE_CONNECTED 1
572
Eliad Pellerc690ec82011-08-14 13:17:07 +0300573struct wl12xx_cmd_set_peer_state {
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300574 struct wl1271_cmd_header header;
575
Eliad Pellerc690ec82011-08-14 13:17:07 +0300576 u8 hlid;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300577 u8 state;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300578 u8 padding[2];
Luciano Coelho5082b822010-10-05 14:58:49 +0300579} __packed;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300580
Eliad Pellera7cba382011-08-14 13:17:16 +0300581struct wl12xx_cmd_roc {
582 struct wl1271_cmd_header header;
583
584 u8 role_id;
585 u8 channel;
586 u8 band;
587 u8 padding;
588};
589
590struct wl12xx_cmd_croc {
591 struct wl1271_cmd_header header;
592
593 u8 role_id;
594 u8 padding[3];
595};
596
Eliad Pellerc690ec82011-08-14 13:17:07 +0300597enum wl12xx_ssid_type {
598 WL12XX_SSID_TYPE_PUBLIC = 0,
599 WL12XX_SSID_TYPE_HIDDEN = 1,
600 WL12XX_SSID_TYPE_ANY = 2,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200601};
602
Eliad Peller1ec23f72011-08-25 14:26:54 +0300603enum wl1271_psd_type {
604 WL1271_PSD_LEGACY = 0,
605 WL1271_PSD_UPSD_TRIGGER = 1,
606 WL1271_PSD_LEGACY_PSPOLL = 2,
607 WL1271_PSD_SAPSD = 3
608};
609
Eliad Pellerc690ec82011-08-14 13:17:07 +0300610struct wl12xx_cmd_add_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200611 struct wl1271_cmd_header header;
612
613 u8 addr[ETH_ALEN];
614 u8 hlid;
615 u8 aid;
616 u8 psd_type[NUM_ACCESS_CATEGORIES_COPY];
617 __le32 supported_rates;
618 u8 bss_index;
619 u8 sp_len;
620 u8 wmm;
621 u8 padding1;
622} __packed;
623
Eliad Pellerc690ec82011-08-14 13:17:07 +0300624struct wl12xx_cmd_remove_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200625 struct wl1271_cmd_header header;
626
627 u8 hlid;
628 u8 reason_opcode;
629 u8 send_deauth_flag;
630 u8 padding1;
631} __packed;
632
Ido Yariv95dac04f2011-06-06 14:57:06 +0300633/*
634 * Continuous mode - packets are transferred to the host periodically
635 * via the data path.
636 * On demand - Log messages are stored in a cyclic buffer in the
637 * firmware, and only transferred to the host when explicitly requested
638 */
639enum wl12xx_fwlogger_log_mode {
640 WL12XX_FWLOG_CONTINUOUS,
641 WL12XX_FWLOG_ON_DEMAND
642};
643
644/* Include/exclude timestamps from the log messages */
645enum wl12xx_fwlogger_timestamp {
646 WL12XX_FWLOG_TIMESTAMP_DISABLED,
647 WL12XX_FWLOG_TIMESTAMP_ENABLED
648};
649
650/*
651 * Logs can be routed to the debug pinouts (where available), to the host bus
652 * (SDIO/SPI), or dropped
653 */
654enum wl12xx_fwlogger_output {
655 WL12XX_FWLOG_OUTPUT_NONE,
656 WL12XX_FWLOG_OUTPUT_DBG_PINS,
657 WL12XX_FWLOG_OUTPUT_HOST,
658};
659
660struct wl12xx_cmd_config_fwlog {
661 struct wl1271_cmd_header header;
662
663 /* See enum wl12xx_fwlogger_log_mode */
664 u8 logger_mode;
665
666 /* Minimum log level threshold */
667 u8 log_severity;
668
669 /* Include/exclude timestamps from the log messages */
670 u8 timestamp;
671
672 /* See enum wl1271_fwlogger_output */
673 u8 output;
674
675 /* Regulates the frequency of log messages */
676 u8 threshold;
677
678 u8 padding[3];
679} __packed;
680
681struct wl12xx_cmd_start_fwlog {
682 struct wl1271_cmd_header header;
683} __packed;
684
685struct wl12xx_cmd_stop_fwlog {
686 struct wl1271_cmd_header header;
687} __packed;
688
Shahar Levi6d158ff2011-09-08 13:01:33 +0300689struct wl12xx_cmd_channel_switch {
690 struct wl1271_cmd_header header;
691
692 /* The new serving channel */
693 u8 channel;
694 /* Relative time of the serving channel switch in TBTT units */
695 u8 switch_time;
696 /* 1: Suspend TX till switch time; 0: Do not suspend TX */
697 u8 tx_suspend;
698 /* 1: Flush TX at switch time; 0: Do not flush */
699 u8 flush;
700} __packed;
701
702struct wl12xx_cmd_stop_channel_switch {
703 struct wl1271_cmd_header header;
704} __packed;
705
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300706#endif /* __WL1271_CMD_H__ */