blob: bf2c45b8b91145caeca498822bff6531eee9d31a [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);
42int wl12xx_cmd_role_start_dev(struct wl1271 *wl);
43int wl12xx_cmd_role_stop_dev(struct wl1271 *wl);
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 Oikarinen65cddbf12010-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);
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020073int wl1271_cmd_set_sta_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
74 u8 key_size, const u8 *key, const u8 *addr,
75 u32 tx_seq_32, u16 tx_seq_16);
76int wl1271_cmd_set_ap_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
77 u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
78 u16 tx_seq_16);
Eliad Pellerb67476e2011-08-14 13:17:23 +030079int wl12xx_cmd_set_peer_state(struct wl1271 *wl, u8 hlid);
Eliad Peller251c1772011-08-14 13:17:17 +030080int wl12xx_roc(struct wl1271 *wl, u8 role_id);
81int wl12xx_croc(struct wl1271 *wl, u8 role_id);
Eliad Pellerc690ec82011-08-14 13:17:07 +030082int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid);
83int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid);
Ido Yariv95dac04f2011-06-06 14:57:06 +030084int wl12xx_cmd_config_fwlog(struct wl1271 *wl);
85int wl12xx_cmd_start_fwlog(struct wl1271 *wl);
86int wl12xx_cmd_stop_fwlog(struct wl1271 *wl);
Shahar Levi6d158ff2011-09-08 13:01:33 +030087int wl12xx_cmd_channel_switch(struct wl1271 *wl,
88 struct ieee80211_channel_switch *ch_switch);
89int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030090
91enum wl1271_commands {
92 CMD_INTERROGATE = 1, /*use this to read information elements*/
93 CMD_CONFIGURE = 2, /*use this to write information elements*/
94 CMD_ENABLE_RX = 3,
95 CMD_ENABLE_TX = 4,
96 CMD_DISABLE_RX = 5,
97 CMD_DISABLE_TX = 6,
98 CMD_SCAN = 8,
99 CMD_STOP_SCAN = 9,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300100 CMD_SET_KEYS = 12,
101 CMD_READ_MEMORY = 13,
102 CMD_WRITE_MEMORY = 14,
103 CMD_SET_TEMPLATE = 19,
104 CMD_TEST = 23,
105 CMD_NOISE_HIST = 28,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300106 CMD_QUIET_ELEMENT_SET_STATE = 29,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300107 CMD_SET_BCN_MODE = 33,
108 CMD_MEASUREMENT = 34,
109 CMD_STOP_MEASUREMENT = 35,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300110 CMD_SET_PS_MODE = 37,
111 CMD_CHANNEL_SWITCH = 38,
112 CMD_STOP_CHANNEL_SWICTH = 39,
113 CMD_AP_DISCOVERY = 40,
114 CMD_STOP_AP_DISCOVERY = 41,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300115 CMD_HEALTH_CHECK = 45,
116 CMD_DEBUG = 46,
117 CMD_TRIGGER_SCAN_TO = 47,
118 CMD_CONNECTION_SCAN_CFG = 48,
119 CMD_CONNECTION_SCAN_SSID_CFG = 49,
120 CMD_START_PERIODIC_SCAN = 50,
121 CMD_STOP_PERIODIC_SCAN = 51,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300122 CMD_SET_PEER_STATE = 52,
123 CMD_REMAIN_ON_CHANNEL = 53,
124 CMD_CANCEL_REMAIN_ON_CHANNEL = 54,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300125
Eliad Pellerc690ec82011-08-14 13:17:07 +0300126 CMD_CONFIG_FWLOGGER = 55,
127 CMD_START_FWLOGGER = 56,
128 CMD_STOP_FWLOGGER = 57,
129
130 /* AP commands */
131 CMD_ADD_PEER = 62,
132 CMD_REMOVE_PEER = 63,
133
134 /* Role API */
135 CMD_ROLE_ENABLE = 70,
136 CMD_ROLE_DISABLE = 71,
137 CMD_ROLE_START = 72,
138 CMD_ROLE_STOP = 73,
139
140 /* WIFI Direct */
141 CMD_WFD_START_DISCOVERY = 80,
142 CMD_WFD_STOP_DISCOVERY = 81,
143 CMD_WFD_ATTRIBUTE_CONFIG = 82,
144
145 CMD_NOP = 100,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200146
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300147 NUM_COMMANDS,
148 MAX_COMMAND_ID = 0xFFFF,
149};
150
151#define MAX_CMD_PARAMS 572
152
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +0200153enum {
154 CMD_TEMPL_KLV_IDX_NULL_DATA = 0,
155 CMD_TEMPL_KLV_IDX_MAX = 4
156};
157
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300158enum cmd_templ {
159 CMD_TEMPL_NULL_DATA = 0,
160 CMD_TEMPL_BEACON,
161 CMD_TEMPL_CFG_PROBE_REQ_2_4,
162 CMD_TEMPL_CFG_PROBE_REQ_5,
163 CMD_TEMPL_PROBE_RESPONSE,
164 CMD_TEMPL_QOS_NULL_DATA,
165 CMD_TEMPL_PS_POLL,
166 CMD_TEMPL_KLV,
167 CMD_TEMPL_DISCONNECT,
168 CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */
169 CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */
170 CMD_TEMPL_BAR, /* for firmware internal use only */
171 CMD_TEMPL_CTS, /*
172 * For CTS-to-self (FastCTS) mechanism
173 * for BT/WLAN coexistence (SoftGemini). */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300174 CMD_TEMPL_AP_BEACON,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200175 CMD_TEMPL_AP_PROBE_RESPONSE,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300176 CMD_TEMPL_ARP_RSP,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200177 CMD_TEMPL_DEAUTH_AP,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300178 CMD_TEMPL_TEMPORARY,
179 CMD_TEMPL_LINK_MEASUREMENT_REPORT,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200180
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300181 CMD_TEMPL_MAX = 0xff
182};
183
184/* unit ms */
185#define WL1271_COMMAND_TIMEOUT 2000
Eliad Peller154037d2011-08-14 13:17:12 +0300186#define WL1271_CMD_TEMPL_DFLT_SIZE 252
187#define WL1271_CMD_TEMPL_MAX_SIZE 548
Teemu Paasikivi0cbb1032010-05-07 11:39:01 +0300188#define WL1271_EVENT_TIMEOUT 750
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300189
190struct wl1271_cmd_header {
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300191 __le16 id;
192 __le16 status;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300193 /* payload */
194 u8 data[0];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000195} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300196
197#define WL1271_CMD_MAX_PARAMS 572
198
199struct wl1271_command {
200 struct wl1271_cmd_header header;
201 u8 parameters[WL1271_CMD_MAX_PARAMS];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000202} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300203
204enum {
205 CMD_MAILBOX_IDLE = 0,
206 CMD_STATUS_SUCCESS = 1,
207 CMD_STATUS_UNKNOWN_CMD = 2,
208 CMD_STATUS_UNKNOWN_IE = 3,
209 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
210 CMD_STATUS_RX_BUSY = 13,
211 CMD_STATUS_INVALID_PARAM = 14,
212 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
213 CMD_STATUS_OUT_OF_MEMORY = 16,
214 CMD_STATUS_STA_TABLE_FULL = 17,
215 CMD_STATUS_RADIO_ERROR = 18,
216 CMD_STATUS_WRONG_NESTING = 19,
217 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
218 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
Eliad Pellerc690ec82011-08-14 13:17:07 +0300219 CMD_STATUS_TEMPLATE_OOM = 23,
Arik Nemtsov0f9c8252011-08-17 10:45:49 +0300220 CMD_STATUS_NO_RX_BA_SESSION = 24,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300221 MAX_COMMAND_STATUS = 0xff
222};
223
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300224#define CMDMBOX_HEADER_LEN 4
225#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
226
227enum {
228 BSS_TYPE_IBSS = 0,
229 BSS_TYPE_STA_BSS = 2,
230 BSS_TYPE_AP_BSS = 3,
231 MAX_BSS_TYPE = 0xFF
232};
233
234#define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
235#define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1
Teemu Paasikivia4102642009-10-13 12:47:51 +0300236#define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300237
Eliad Pellerc690ec82011-08-14 13:17:07 +0300238struct wl12xx_cmd_role_enable {
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300239 struct wl1271_cmd_header header;
240
Eliad Pellerc690ec82011-08-14 13:17:07 +0300241 u8 role_id;
242 u8 role_type;
243 u8 mac_address[ETH_ALEN];
244} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300245
Eliad Pellerc690ec82011-08-14 13:17:07 +0300246struct wl12xx_cmd_role_disable {
247 struct wl1271_cmd_header header;
248
249 u8 role_id;
250 u8 padding[3];
251} __packed;
252
253enum wl12xx_band {
254 WL12XX_BAND_2_4GHZ = 0,
255 WL12XX_BAND_5GHZ = 1,
256 WL12XX_BAND_JAPAN_4_9_GHZ = 2,
257 WL12XX_BAND_DEFAULT = WL12XX_BAND_2_4GHZ,
258 WL12XX_BAND_INVALID = 0x7E,
259 WL12XX_BAND_MAX_RADIO = 0x7F,
260};
261
262struct wl12xx_cmd_role_start {
263 struct wl1271_cmd_header header;
264
265 u8 role_id;
266 u8 band;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300267 u8 channel;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300268 u8 padding;
269
270 union {
271 struct {
272 u8 hlid;
273 u8 session;
274 u8 padding_1[54];
275 } __packed device;
276 /* sta & p2p_cli use the same struct */
277 struct {
278 u8 bssid[ETH_ALEN];
279 u8 hlid; /* data hlid */
280 u8 session;
281 __le32 remote_rates; /* remote supported rates */
282
283 /*
284 * The target uses this field to determine the rate at
285 * which to transmit control frame responses (such as
286 * ACK or CTS frames).
287 */
288 __le32 basic_rate_set;
289 __le32 local_rates; /* local supported rates */
290
291 u8 ssid_type;
292 u8 ssid_len;
293 u8 ssid[IEEE80211_MAX_SSID_LEN];
294
295 __le16 beacon_interval; /* in TBTTs */
296 } __packed sta;
297 struct {
298 u8 bssid[ETH_ALEN];
299 u8 hlid; /* data hlid */
300 u8 dtim_interval;
301 __le32 remote_rates; /* remote supported rates */
302
303 __le32 basic_rate_set;
304 __le32 local_rates; /* local supported rates */
305
306 u8 ssid_type;
307 u8 ssid_len;
308 u8 ssid[IEEE80211_MAX_SSID_LEN];
309
310 __le16 beacon_interval; /* in TBTTs */
311
312 u8 padding_1[4];
313 } __packed ibss;
314 /* ap & p2p_go use the same struct */
315 struct {
316 __le16 aging_period; /* in secs */
317 u8 beacon_expiry; /* in ms */
318 u8 bss_index;
319 /* The host link id for the AP's global queue */
320 u8 global_hlid;
321 /* The host link id for the AP's broadcast queue */
322 u8 broadcast_hlid;
323
324 __le16 beacon_interval; /* in TBTTs */
325
326 __le32 basic_rate_set;
327 __le32 local_rates; /* local supported rates */
328
329 u8 dtim_interval;
330
331 u8 ssid_type;
332 u8 ssid_len;
333 u8 ssid[IEEE80211_MAX_SSID_LEN];
334
335 u8 padding_1[5];
336 } __packed ap;
337 };
338} __packed;
339
340struct wl12xx_cmd_role_stop {
341 struct wl1271_cmd_header header;
342
343 u8 role_id;
344 u8 disc_type; /* only STA and P2P_CLI */
345 __le16 reason; /* only STA and P2P_CLI */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000346} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300347
348struct cmd_enabledisable_path {
349 struct wl1271_cmd_header header;
350
351 u8 channel;
352 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000353} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300354
Juuso Oikarinen606c1482010-04-01 11:38:21 +0300355#define WL1271_RATE_AUTOMATIC 0
356
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300357struct wl1271_cmd_template_set {
358 struct wl1271_cmd_header header;
359
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300360 __le16 len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300361 u8 template_type;
362 u8 index; /* relevant only for KLV_TEMPLATE type */
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300363 __le32 enabled_rates;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300364 u8 short_retry_limit;
365 u8 long_retry_limit;
366 u8 aflags;
367 u8 reserved;
368 u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000369} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300370
371#define TIM_ELE_ID 5
372#define PARTIAL_VBM_MAX 251
373
374struct wl1271_tim {
375 u8 identity;
376 u8 length;
377 u8 dtim_count;
378 u8 dtim_period;
379 u8 bitmap_ctrl;
380 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000381} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300382
383enum wl1271_cmd_ps_mode {
384 STATION_ACTIVE_MODE,
385 STATION_POWER_SAVE_MODE
386};
387
388struct wl1271_cmd_ps_params {
389 struct wl1271_cmd_header header;
390
Eliad Pellerc690ec82011-08-14 13:17:07 +0300391 u8 role_id;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300392 u8 ps_mode; /* STATION_* */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300393 u8 padding[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000394} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300395
396/* HW encryption keys */
397#define NUM_ACCESS_CATEGORIES_COPY 4
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300398
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300399enum wl1271_cmd_key_action {
400 KEY_ADD_OR_REPLACE = 1,
401 KEY_REMOVE = 2,
402 KEY_SET_ID = 3,
403 MAX_KEY_ACTION = 0xffff,
404};
405
Eliad Pellerc690ec82011-08-14 13:17:07 +0300406enum wl1271_cmd_lid_key_type {
407 UNICAST_LID_TYPE = 0,
408 BROADCAST_LID_TYPE = 1,
409 WEP_DEFAULT_LID_TYPE = 2
410};
411
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300412enum wl1271_cmd_key_type {
413 KEY_NONE = 0,
414 KEY_WEP = 1,
415 KEY_TKIP = 2,
416 KEY_AES = 3,
Juuso Oikarinen7a557242010-09-27 12:42:07 +0200417 KEY_GEM = 4,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300418};
419
Eliad Pellerc690ec82011-08-14 13:17:07 +0300420struct wl1271_cmd_set_keys {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200421 struct wl1271_cmd_header header;
422
423 /*
424 * Indicates whether the HLID is a unicast key set
425 * or broadcast key set. A special value 0xFF is
426 * used to indicate that the HLID is on WEP-default
427 * (multi-hlids). of type wl1271_cmd_lid_key_type.
428 */
429 u8 hlid;
430
431 /*
432 * In WEP-default network (hlid == 0xFF) used to
433 * indicate which network STA/IBSS/AP role should be
434 * changed
435 */
436 u8 lid_key_type;
437
438 /*
439 * Key ID - For TKIP and AES key types, this field
440 * indicates the value that should be inserted into
441 * the KeyID field of frames transmitted using this
442 * key entry. For broadcast keys the index use as a
443 * marker for TX/RX key.
444 * For WEP default network (HLID=0xFF), this field
445 * indicates the ID of the key to add or remove.
446 */
447 u8 key_id;
448 u8 reserved_1;
449
450 /* key_action_e */
451 __le16 key_action;
452
453 /* key size in bytes */
454 u8 key_size;
455
456 /* key_type_e */
457 u8 key_type;
458
459 /* This field holds the security key data to add to the STA table */
460 u8 key[MAX_KEY_SIZE];
461 __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
462 __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
463} __packed;
464
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300465struct wl1271_cmd_test_header {
466 u8 id;
467 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000468} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300469
470enum wl1271_channel_tune_bands {
471 WL1271_CHANNEL_TUNE_BAND_2_4,
472 WL1271_CHANNEL_TUNE_BAND_5,
473 WL1271_CHANNEL_TUNE_BAND_4_9
474};
475
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200476#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300477
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200478#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
479#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
480#define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200481
482struct wl1271_general_parms_cmd {
483 struct wl1271_cmd_header header;
484
485 struct wl1271_cmd_test_header test;
486
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300487 struct wl1271_ini_general_params general_params;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200488
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300489 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
490 u8 sr_sen_n_p;
491 u8 sr_sen_n_p_gain;
492 u8 sr_sen_nrn;
493 u8 sr_sen_prn;
494 u8 padding[3];
David S. Miller14599f12010-06-11 11:34:06 -0700495} __packed;
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200496
Shahar Levi49d750ca2011-03-06 16:32:09 +0200497struct wl128x_general_parms_cmd {
498 struct wl1271_cmd_header header;
499
500 struct wl1271_cmd_test_header test;
501
502 struct wl128x_ini_general_params general_params;
503
504 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
505 u8 sr_sen_n_p;
506 u8 sr_sen_n_p_gain;
507 u8 sr_sen_nrn;
508 u8 sr_sen_prn;
509 u8 padding[3];
510} __packed;
511
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200512struct wl1271_radio_parms_cmd {
513 struct wl1271_cmd_header header;
514
515 struct wl1271_cmd_test_header test;
516
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300517 /* Static radio parameters */
518 struct wl1271_ini_band_params_2 static_params_2;
519 struct wl1271_ini_band_params_5 static_params_5;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200520
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300521 /* Dynamic radio parameters */
522 struct wl1271_ini_fem_params_2 dyn_params_2;
523 u8 padding2;
524 struct wl1271_ini_fem_params_5 dyn_params_5;
525 u8 padding3[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000526} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300527
Shahar Levi49d750ca2011-03-06 16:32:09 +0200528struct wl128x_radio_parms_cmd {
529 struct wl1271_cmd_header header;
530
531 struct wl1271_cmd_test_header test;
532
533 /* Static radio parameters */
534 struct wl128x_ini_band_params_2 static_params_2;
535 struct wl128x_ini_band_params_5 static_params_5;
536
537 u8 fem_vendor_and_options;
538
539 /* Dynamic radio parameters */
540 struct wl128x_ini_fem_params_2 dyn_params_2;
541 u8 padding2;
542 struct wl128x_ini_fem_params_5 dyn_params_5;
543} __packed;
544
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200545struct wl1271_ext_radio_parms_cmd {
546 struct wl1271_cmd_header header;
547
548 struct wl1271_cmd_test_header test;
549
550 u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
551 u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
552 u8 padding[3];
553} __packed;
554
Luciano Coelho25a7dc62009-10-12 15:08:42 +0300555/*
556 * There are three types of disconnections:
557 *
558 * DISCONNECT_IMMEDIATE: the fw doesn't send any frames
559 * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason
560 * we have passed
561 * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason
562 * we have passed
563 */
564enum wl1271_disconnect_type {
565 DISCONNECT_IMMEDIATE,
566 DISCONNECT_DEAUTH,
567 DISCONNECT_DISASSOC
568};
569
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300570#define WL1271_CMD_STA_STATE_CONNECTED 1
571
Eliad Pellerc690ec82011-08-14 13:17:07 +0300572struct wl12xx_cmd_set_peer_state {
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300573 struct wl1271_cmd_header header;
574
Eliad Pellerc690ec82011-08-14 13:17:07 +0300575 u8 hlid;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300576 u8 state;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300577 u8 padding[2];
Luciano Coelho5082b822010-10-05 14:58:49 +0300578} __packed;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300579
Eliad Pellera7cba382011-08-14 13:17:16 +0300580struct wl12xx_cmd_roc {
581 struct wl1271_cmd_header header;
582
583 u8 role_id;
584 u8 channel;
585 u8 band;
586 u8 padding;
587};
588
589struct wl12xx_cmd_croc {
590 struct wl1271_cmd_header header;
591
592 u8 role_id;
593 u8 padding[3];
594};
595
Eliad Pellerc690ec82011-08-14 13:17:07 +0300596enum wl12xx_ssid_type {
597 WL12XX_SSID_TYPE_PUBLIC = 0,
598 WL12XX_SSID_TYPE_HIDDEN = 1,
599 WL12XX_SSID_TYPE_ANY = 2,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200600};
601
Eliad Peller1ec23f72011-08-25 14:26:54 +0300602enum wl1271_psd_type {
603 WL1271_PSD_LEGACY = 0,
604 WL1271_PSD_UPSD_TRIGGER = 1,
605 WL1271_PSD_LEGACY_PSPOLL = 2,
606 WL1271_PSD_SAPSD = 3
607};
608
Eliad Pellerc690ec82011-08-14 13:17:07 +0300609struct wl12xx_cmd_add_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200610 struct wl1271_cmd_header header;
611
612 u8 addr[ETH_ALEN];
613 u8 hlid;
614 u8 aid;
615 u8 psd_type[NUM_ACCESS_CATEGORIES_COPY];
616 __le32 supported_rates;
617 u8 bss_index;
618 u8 sp_len;
619 u8 wmm;
620 u8 padding1;
621} __packed;
622
Eliad Pellerc690ec82011-08-14 13:17:07 +0300623struct wl12xx_cmd_remove_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200624 struct wl1271_cmd_header header;
625
626 u8 hlid;
627 u8 reason_opcode;
628 u8 send_deauth_flag;
629 u8 padding1;
630} __packed;
631
Ido Yariv95dac04f2011-06-06 14:57:06 +0300632/*
633 * Continuous mode - packets are transferred to the host periodically
634 * via the data path.
635 * On demand - Log messages are stored in a cyclic buffer in the
636 * firmware, and only transferred to the host when explicitly requested
637 */
638enum wl12xx_fwlogger_log_mode {
639 WL12XX_FWLOG_CONTINUOUS,
640 WL12XX_FWLOG_ON_DEMAND
641};
642
643/* Include/exclude timestamps from the log messages */
644enum wl12xx_fwlogger_timestamp {
645 WL12XX_FWLOG_TIMESTAMP_DISABLED,
646 WL12XX_FWLOG_TIMESTAMP_ENABLED
647};
648
649/*
650 * Logs can be routed to the debug pinouts (where available), to the host bus
651 * (SDIO/SPI), or dropped
652 */
653enum wl12xx_fwlogger_output {
654 WL12XX_FWLOG_OUTPUT_NONE,
655 WL12XX_FWLOG_OUTPUT_DBG_PINS,
656 WL12XX_FWLOG_OUTPUT_HOST,
657};
658
659struct wl12xx_cmd_config_fwlog {
660 struct wl1271_cmd_header header;
661
662 /* See enum wl12xx_fwlogger_log_mode */
663 u8 logger_mode;
664
665 /* Minimum log level threshold */
666 u8 log_severity;
667
668 /* Include/exclude timestamps from the log messages */
669 u8 timestamp;
670
671 /* See enum wl1271_fwlogger_output */
672 u8 output;
673
674 /* Regulates the frequency of log messages */
675 u8 threshold;
676
677 u8 padding[3];
678} __packed;
679
680struct wl12xx_cmd_start_fwlog {
681 struct wl1271_cmd_header header;
682} __packed;
683
684struct wl12xx_cmd_stop_fwlog {
685 struct wl1271_cmd_header header;
686} __packed;
687
Shahar Levi6d158ff2011-09-08 13:01:33 +0300688struct wl12xx_cmd_channel_switch {
689 struct wl1271_cmd_header header;
690
691 /* The new serving channel */
692 u8 channel;
693 /* Relative time of the serving channel switch in TBTT units */
694 u8 switch_time;
695 /* 1: Suspend TX till switch time; 0: Do not suspend TX */
696 u8 tx_suspend;
697 /* 1: Flush TX at switch time; 0: Do not flush */
698 u8 flush;
699} __packed;
700
701struct wl12xx_cmd_stop_channel_switch {
702 struct wl1271_cmd_header header;
703} __packed;
704
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300705#endif /* __WL1271_CMD_H__ */