blob: 234a8dc90559607a4ac574248e3df10f9d0f7873 [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 Pellerc690ec82011-08-14 13:17:07 +030045int wl12xx_cmd_role_stop_sta(struct wl1271 *wl);
Eliad Peller87fbcb02011-10-05 11:55:41 +020046int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
Eliad Pellerc690ec82011-08-14 13:17:07 +030047int wl12xx_cmd_role_stop_ap(struct wl1271 *wl);
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 Pellerc8bde242011-02-02 09:59:35 +020053int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode);
Juuso Oikarinen65cddbf2010-08-24 06:28:03 +030054int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
55 size_t len);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030056int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
Juuso Oikarinen606c1482010-04-01 11:38:21 +030057 void *buf, size_t buf_len, int index, u32 rates);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030058int wl1271_cmd_build_null_data(struct wl1271 *wl);
Eliad Peller87fbcb02011-10-05 11:55:41 +020059int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif,
60 u16 aid);
Kalle Valo818e3062010-03-18 12:26:35 +020061int wl1271_cmd_build_probe_req(struct wl1271 *wl,
62 const u8 *ssid, size_t ssid_len,
63 const u8 *ie, size_t ie_len, u8 band);
Juuso Oikarinen2f6724b2010-11-24 08:16:57 +020064struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl,
65 struct sk_buff *skb);
Eliad Pellerc5312772010-12-09 11:31:27 +020066int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, __be32 ip_addr);
Eliad Peller784f6942011-10-05 11:55:39 +020067int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif);
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +020068int wl1271_cmd_build_klv_null_data(struct wl1271 *wl);
Eliad Pellerc690ec82011-08-14 13:17:07 +030069int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid);
Arik Nemtsov98bdaab2010-10-16 18:08:58 +020070int wl1271_cmd_set_sta_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
71 u8 key_size, const u8 *key, const u8 *addr,
72 u32 tx_seq_32, u16 tx_seq_16);
73int wl1271_cmd_set_ap_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
74 u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
75 u16 tx_seq_16);
Eliad Pellerb67476e2011-08-14 13:17:23 +030076int wl12xx_cmd_set_peer_state(struct wl1271 *wl, u8 hlid);
Eliad Peller251c1772011-08-14 13:17:17 +030077int wl12xx_roc(struct wl1271 *wl, u8 role_id);
78int wl12xx_croc(struct wl1271 *wl, u8 role_id);
Eliad Pellerc690ec82011-08-14 13:17:07 +030079int wl12xx_cmd_add_peer(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid);
80int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid);
Ido Yariv95dac04f2011-06-06 14:57:06 +030081int wl12xx_cmd_config_fwlog(struct wl1271 *wl);
82int wl12xx_cmd_start_fwlog(struct wl1271 *wl);
83int wl12xx_cmd_stop_fwlog(struct wl1271 *wl);
Shahar Levi6d158ff2011-09-08 13:01:33 +030084int wl12xx_cmd_channel_switch(struct wl1271 *wl,
85 struct ieee80211_channel_switch *ch_switch);
86int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl);
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030087
88enum wl1271_commands {
89 CMD_INTERROGATE = 1, /*use this to read information elements*/
90 CMD_CONFIGURE = 2, /*use this to write information elements*/
91 CMD_ENABLE_RX = 3,
92 CMD_ENABLE_TX = 4,
93 CMD_DISABLE_RX = 5,
94 CMD_DISABLE_TX = 6,
95 CMD_SCAN = 8,
96 CMD_STOP_SCAN = 9,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030097 CMD_SET_KEYS = 12,
98 CMD_READ_MEMORY = 13,
99 CMD_WRITE_MEMORY = 14,
100 CMD_SET_TEMPLATE = 19,
101 CMD_TEST = 23,
102 CMD_NOISE_HIST = 28,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300103 CMD_QUIET_ELEMENT_SET_STATE = 29,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300104 CMD_SET_BCN_MODE = 33,
105 CMD_MEASUREMENT = 34,
106 CMD_STOP_MEASUREMENT = 35,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300107 CMD_SET_PS_MODE = 37,
108 CMD_CHANNEL_SWITCH = 38,
109 CMD_STOP_CHANNEL_SWICTH = 39,
110 CMD_AP_DISCOVERY = 40,
111 CMD_STOP_AP_DISCOVERY = 41,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300112 CMD_HEALTH_CHECK = 45,
113 CMD_DEBUG = 46,
114 CMD_TRIGGER_SCAN_TO = 47,
115 CMD_CONNECTION_SCAN_CFG = 48,
116 CMD_CONNECTION_SCAN_SSID_CFG = 49,
117 CMD_START_PERIODIC_SCAN = 50,
118 CMD_STOP_PERIODIC_SCAN = 51,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300119 CMD_SET_PEER_STATE = 52,
120 CMD_REMAIN_ON_CHANNEL = 53,
121 CMD_CANCEL_REMAIN_ON_CHANNEL = 54,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300122
Eliad Pellerc690ec82011-08-14 13:17:07 +0300123 CMD_CONFIG_FWLOGGER = 55,
124 CMD_START_FWLOGGER = 56,
125 CMD_STOP_FWLOGGER = 57,
126
127 /* AP commands */
128 CMD_ADD_PEER = 62,
129 CMD_REMOVE_PEER = 63,
130
131 /* Role API */
132 CMD_ROLE_ENABLE = 70,
133 CMD_ROLE_DISABLE = 71,
134 CMD_ROLE_START = 72,
135 CMD_ROLE_STOP = 73,
136
137 /* WIFI Direct */
138 CMD_WFD_START_DISCOVERY = 80,
139 CMD_WFD_STOP_DISCOVERY = 81,
140 CMD_WFD_ATTRIBUTE_CONFIG = 82,
141
142 CMD_NOP = 100,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200143
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300144 NUM_COMMANDS,
145 MAX_COMMAND_ID = 0xFFFF,
146};
147
148#define MAX_CMD_PARAMS 572
149
Juuso Oikarinenbfb24c92010-03-26 12:53:31 +0200150enum {
151 CMD_TEMPL_KLV_IDX_NULL_DATA = 0,
152 CMD_TEMPL_KLV_IDX_MAX = 4
153};
154
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300155enum cmd_templ {
156 CMD_TEMPL_NULL_DATA = 0,
157 CMD_TEMPL_BEACON,
158 CMD_TEMPL_CFG_PROBE_REQ_2_4,
159 CMD_TEMPL_CFG_PROBE_REQ_5,
160 CMD_TEMPL_PROBE_RESPONSE,
161 CMD_TEMPL_QOS_NULL_DATA,
162 CMD_TEMPL_PS_POLL,
163 CMD_TEMPL_KLV,
164 CMD_TEMPL_DISCONNECT,
165 CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */
166 CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */
167 CMD_TEMPL_BAR, /* for firmware internal use only */
168 CMD_TEMPL_CTS, /*
169 * For CTS-to-self (FastCTS) mechanism
170 * for BT/WLAN coexistence (SoftGemini). */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300171 CMD_TEMPL_AP_BEACON,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200172 CMD_TEMPL_AP_PROBE_RESPONSE,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300173 CMD_TEMPL_ARP_RSP,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200174 CMD_TEMPL_DEAUTH_AP,
Eliad Pellerc690ec82011-08-14 13:17:07 +0300175 CMD_TEMPL_TEMPORARY,
176 CMD_TEMPL_LINK_MEASUREMENT_REPORT,
Arik Nemtsove0fe3712010-10-16 18:19:53 +0200177
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300178 CMD_TEMPL_MAX = 0xff
179};
180
181/* unit ms */
182#define WL1271_COMMAND_TIMEOUT 2000
Eliad Peller154037d2011-08-14 13:17:12 +0300183#define WL1271_CMD_TEMPL_DFLT_SIZE 252
184#define WL1271_CMD_TEMPL_MAX_SIZE 548
Teemu Paasikivi0cbb1032010-05-07 11:39:01 +0300185#define WL1271_EVENT_TIMEOUT 750
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300186
187struct wl1271_cmd_header {
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300188 __le16 id;
189 __le16 status;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300190 /* payload */
191 u8 data[0];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000192} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300193
194#define WL1271_CMD_MAX_PARAMS 572
195
196struct wl1271_command {
197 struct wl1271_cmd_header header;
198 u8 parameters[WL1271_CMD_MAX_PARAMS];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000199} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300200
201enum {
202 CMD_MAILBOX_IDLE = 0,
203 CMD_STATUS_SUCCESS = 1,
204 CMD_STATUS_UNKNOWN_CMD = 2,
205 CMD_STATUS_UNKNOWN_IE = 3,
206 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
207 CMD_STATUS_RX_BUSY = 13,
208 CMD_STATUS_INVALID_PARAM = 14,
209 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
210 CMD_STATUS_OUT_OF_MEMORY = 16,
211 CMD_STATUS_STA_TABLE_FULL = 17,
212 CMD_STATUS_RADIO_ERROR = 18,
213 CMD_STATUS_WRONG_NESTING = 19,
214 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
215 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
Eliad Pellerc690ec82011-08-14 13:17:07 +0300216 CMD_STATUS_TEMPLATE_OOM = 23,
Arik Nemtsov0f9c8252011-08-17 10:45:49 +0300217 CMD_STATUS_NO_RX_BA_SESSION = 24,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300218 MAX_COMMAND_STATUS = 0xff
219};
220
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300221#define CMDMBOX_HEADER_LEN 4
222#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
223
224enum {
225 BSS_TYPE_IBSS = 0,
226 BSS_TYPE_STA_BSS = 2,
227 BSS_TYPE_AP_BSS = 3,
228 MAX_BSS_TYPE = 0xFF
229};
230
231#define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
232#define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1
Teemu Paasikivia4102642009-10-13 12:47:51 +0300233#define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300234
Eliad Pellerc690ec82011-08-14 13:17:07 +0300235struct wl12xx_cmd_role_enable {
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300236 struct wl1271_cmd_header header;
237
Eliad Pellerc690ec82011-08-14 13:17:07 +0300238 u8 role_id;
239 u8 role_type;
240 u8 mac_address[ETH_ALEN];
241} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300242
Eliad Pellerc690ec82011-08-14 13:17:07 +0300243struct wl12xx_cmd_role_disable {
244 struct wl1271_cmd_header header;
245
246 u8 role_id;
247 u8 padding[3];
248} __packed;
249
250enum wl12xx_band {
251 WL12XX_BAND_2_4GHZ = 0,
252 WL12XX_BAND_5GHZ = 1,
253 WL12XX_BAND_JAPAN_4_9_GHZ = 2,
254 WL12XX_BAND_DEFAULT = WL12XX_BAND_2_4GHZ,
255 WL12XX_BAND_INVALID = 0x7E,
256 WL12XX_BAND_MAX_RADIO = 0x7F,
257};
258
259struct wl12xx_cmd_role_start {
260 struct wl1271_cmd_header header;
261
262 u8 role_id;
263 u8 band;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300264 u8 channel;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300265 u8 padding;
266
267 union {
268 struct {
269 u8 hlid;
270 u8 session;
271 u8 padding_1[54];
272 } __packed device;
273 /* sta & p2p_cli use the same struct */
274 struct {
275 u8 bssid[ETH_ALEN];
276 u8 hlid; /* data hlid */
277 u8 session;
278 __le32 remote_rates; /* remote supported rates */
279
280 /*
281 * The target uses this field to determine the rate at
282 * which to transmit control frame responses (such as
283 * ACK or CTS frames).
284 */
285 __le32 basic_rate_set;
286 __le32 local_rates; /* local supported rates */
287
288 u8 ssid_type;
289 u8 ssid_len;
290 u8 ssid[IEEE80211_MAX_SSID_LEN];
291
292 __le16 beacon_interval; /* in TBTTs */
293 } __packed sta;
294 struct {
295 u8 bssid[ETH_ALEN];
296 u8 hlid; /* data hlid */
297 u8 dtim_interval;
298 __le32 remote_rates; /* remote supported rates */
299
300 __le32 basic_rate_set;
301 __le32 local_rates; /* local supported rates */
302
303 u8 ssid_type;
304 u8 ssid_len;
305 u8 ssid[IEEE80211_MAX_SSID_LEN];
306
307 __le16 beacon_interval; /* in TBTTs */
308
309 u8 padding_1[4];
310 } __packed ibss;
311 /* ap & p2p_go use the same struct */
312 struct {
313 __le16 aging_period; /* in secs */
314 u8 beacon_expiry; /* in ms */
315 u8 bss_index;
316 /* The host link id for the AP's global queue */
317 u8 global_hlid;
318 /* The host link id for the AP's broadcast queue */
319 u8 broadcast_hlid;
320
321 __le16 beacon_interval; /* in TBTTs */
322
323 __le32 basic_rate_set;
324 __le32 local_rates; /* local supported rates */
325
326 u8 dtim_interval;
327
328 u8 ssid_type;
329 u8 ssid_len;
330 u8 ssid[IEEE80211_MAX_SSID_LEN];
331
332 u8 padding_1[5];
333 } __packed ap;
334 };
335} __packed;
336
337struct wl12xx_cmd_role_stop {
338 struct wl1271_cmd_header header;
339
340 u8 role_id;
341 u8 disc_type; /* only STA and P2P_CLI */
342 __le16 reason; /* only STA and P2P_CLI */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000343} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300344
345struct cmd_enabledisable_path {
346 struct wl1271_cmd_header header;
347
348 u8 channel;
349 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000350} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300351
Juuso Oikarinen606c1482010-04-01 11:38:21 +0300352#define WL1271_RATE_AUTOMATIC 0
353
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300354struct wl1271_cmd_template_set {
355 struct wl1271_cmd_header header;
356
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300357 __le16 len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300358 u8 template_type;
359 u8 index; /* relevant only for KLV_TEMPLATE type */
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300360 __le32 enabled_rates;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300361 u8 short_retry_limit;
362 u8 long_retry_limit;
363 u8 aflags;
364 u8 reserved;
365 u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000366} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300367
368#define TIM_ELE_ID 5
369#define PARTIAL_VBM_MAX 251
370
371struct wl1271_tim {
372 u8 identity;
373 u8 length;
374 u8 dtim_count;
375 u8 dtim_period;
376 u8 bitmap_ctrl;
377 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
Eric Dumazetba2d3582010-06-02 18:10:09 +0000378} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300379
380enum wl1271_cmd_ps_mode {
381 STATION_ACTIVE_MODE,
382 STATION_POWER_SAVE_MODE
383};
384
385struct wl1271_cmd_ps_params {
386 struct wl1271_cmd_header header;
387
Eliad Pellerc690ec82011-08-14 13:17:07 +0300388 u8 role_id;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300389 u8 ps_mode; /* STATION_* */
Eliad Pellerc690ec82011-08-14 13:17:07 +0300390 u8 padding[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000391} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300392
393/* HW encryption keys */
394#define NUM_ACCESS_CATEGORIES_COPY 4
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300395
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300396enum wl1271_cmd_key_action {
397 KEY_ADD_OR_REPLACE = 1,
398 KEY_REMOVE = 2,
399 KEY_SET_ID = 3,
400 MAX_KEY_ACTION = 0xffff,
401};
402
Eliad Pellerc690ec82011-08-14 13:17:07 +0300403enum wl1271_cmd_lid_key_type {
404 UNICAST_LID_TYPE = 0,
405 BROADCAST_LID_TYPE = 1,
406 WEP_DEFAULT_LID_TYPE = 2
407};
408
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300409enum wl1271_cmd_key_type {
410 KEY_NONE = 0,
411 KEY_WEP = 1,
412 KEY_TKIP = 2,
413 KEY_AES = 3,
Juuso Oikarinen7a557242010-09-27 12:42:07 +0200414 KEY_GEM = 4,
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300415};
416
Eliad Pellerc690ec82011-08-14 13:17:07 +0300417struct wl1271_cmd_set_keys {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200418 struct wl1271_cmd_header header;
419
420 /*
421 * Indicates whether the HLID is a unicast key set
422 * or broadcast key set. A special value 0xFF is
423 * used to indicate that the HLID is on WEP-default
424 * (multi-hlids). of type wl1271_cmd_lid_key_type.
425 */
426 u8 hlid;
427
428 /*
429 * In WEP-default network (hlid == 0xFF) used to
430 * indicate which network STA/IBSS/AP role should be
431 * changed
432 */
433 u8 lid_key_type;
434
435 /*
436 * Key ID - For TKIP and AES key types, this field
437 * indicates the value that should be inserted into
438 * the KeyID field of frames transmitted using this
439 * key entry. For broadcast keys the index use as a
440 * marker for TX/RX key.
441 * For WEP default network (HLID=0xFF), this field
442 * indicates the ID of the key to add or remove.
443 */
444 u8 key_id;
445 u8 reserved_1;
446
447 /* key_action_e */
448 __le16 key_action;
449
450 /* key size in bytes */
451 u8 key_size;
452
453 /* key_type_e */
454 u8 key_type;
455
456 /* This field holds the security key data to add to the STA table */
457 u8 key[MAX_KEY_SIZE];
458 __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
459 __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
460} __packed;
461
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300462struct wl1271_cmd_test_header {
463 u8 id;
464 u8 padding[3];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000465} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300466
467enum wl1271_channel_tune_bands {
468 WL1271_CHANNEL_TUNE_BAND_2_4,
469 WL1271_CHANNEL_TUNE_BAND_5,
470 WL1271_CHANNEL_TUNE_BAND_4_9
471};
472
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200473#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300474
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200475#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
476#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
477#define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200478
479struct wl1271_general_parms_cmd {
480 struct wl1271_cmd_header header;
481
482 struct wl1271_cmd_test_header test;
483
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300484 struct wl1271_ini_general_params general_params;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200485
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300486 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
487 u8 sr_sen_n_p;
488 u8 sr_sen_n_p_gain;
489 u8 sr_sen_nrn;
490 u8 sr_sen_prn;
491 u8 padding[3];
David S. Miller14599f12010-06-11 11:34:06 -0700492} __packed;
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200493
Shahar Levi49d750ca2011-03-06 16:32:09 +0200494struct wl128x_general_parms_cmd {
495 struct wl1271_cmd_header header;
496
497 struct wl1271_cmd_test_header test;
498
499 struct wl128x_ini_general_params general_params;
500
501 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
502 u8 sr_sen_n_p;
503 u8 sr_sen_n_p_gain;
504 u8 sr_sen_nrn;
505 u8 sr_sen_prn;
506 u8 padding[3];
507} __packed;
508
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200509struct wl1271_radio_parms_cmd {
510 struct wl1271_cmd_header header;
511
512 struct wl1271_cmd_test_header test;
513
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300514 /* Static radio parameters */
515 struct wl1271_ini_band_params_2 static_params_2;
516 struct wl1271_ini_band_params_5 static_params_5;
Luciano Coelho98b5dd52009-11-23 23:22:17 +0200517
Juuso Oikarineneb70eb72010-05-14 10:46:22 +0300518 /* Dynamic radio parameters */
519 struct wl1271_ini_fem_params_2 dyn_params_2;
520 u8 padding2;
521 struct wl1271_ini_fem_params_5 dyn_params_5;
522 u8 padding3[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +0000523} __packed;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300524
Shahar Levi49d750ca2011-03-06 16:32:09 +0200525struct wl128x_radio_parms_cmd {
526 struct wl1271_cmd_header header;
527
528 struct wl1271_cmd_test_header test;
529
530 /* Static radio parameters */
531 struct wl128x_ini_band_params_2 static_params_2;
532 struct wl128x_ini_band_params_5 static_params_5;
533
534 u8 fem_vendor_and_options;
535
536 /* Dynamic radio parameters */
537 struct wl128x_ini_fem_params_2 dyn_params_2;
538 u8 padding2;
539 struct wl128x_ini_fem_params_5 dyn_params_5;
540} __packed;
541
Juuso Oikarinen644a4862010-10-05 13:11:56 +0200542struct wl1271_ext_radio_parms_cmd {
543 struct wl1271_cmd_header header;
544
545 struct wl1271_cmd_test_header test;
546
547 u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
548 u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
549 u8 padding[3];
550} __packed;
551
Luciano Coelho25a7dc62009-10-12 15:08:42 +0300552/*
553 * There are three types of disconnections:
554 *
555 * DISCONNECT_IMMEDIATE: the fw doesn't send any frames
556 * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason
557 * we have passed
558 * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason
559 * we have passed
560 */
561enum wl1271_disconnect_type {
562 DISCONNECT_IMMEDIATE,
563 DISCONNECT_DEAUTH,
564 DISCONNECT_DISASSOC
565};
566
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300567#define WL1271_CMD_STA_STATE_CONNECTED 1
568
Eliad Pellerc690ec82011-08-14 13:17:07 +0300569struct wl12xx_cmd_set_peer_state {
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300570 struct wl1271_cmd_header header;
571
Eliad Pellerc690ec82011-08-14 13:17:07 +0300572 u8 hlid;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300573 u8 state;
Eliad Pellerc690ec82011-08-14 13:17:07 +0300574 u8 padding[2];
Luciano Coelho5082b822010-10-05 14:58:49 +0300575} __packed;
Juuso Oikarinenbe86cbe2010-05-27 12:53:01 +0300576
Eliad Pellera7cba382011-08-14 13:17:16 +0300577struct wl12xx_cmd_roc {
578 struct wl1271_cmd_header header;
579
580 u8 role_id;
581 u8 channel;
582 u8 band;
583 u8 padding;
584};
585
586struct wl12xx_cmd_croc {
587 struct wl1271_cmd_header header;
588
589 u8 role_id;
590 u8 padding[3];
591};
592
Eliad Pellerc690ec82011-08-14 13:17:07 +0300593enum wl12xx_ssid_type {
594 WL12XX_SSID_TYPE_PUBLIC = 0,
595 WL12XX_SSID_TYPE_HIDDEN = 1,
596 WL12XX_SSID_TYPE_ANY = 2,
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200597};
598
Eliad Peller1ec23f72011-08-25 14:26:54 +0300599enum wl1271_psd_type {
600 WL1271_PSD_LEGACY = 0,
601 WL1271_PSD_UPSD_TRIGGER = 1,
602 WL1271_PSD_LEGACY_PSPOLL = 2,
603 WL1271_PSD_SAPSD = 3
604};
605
Eliad Pellerc690ec82011-08-14 13:17:07 +0300606struct wl12xx_cmd_add_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200607 struct wl1271_cmd_header header;
608
609 u8 addr[ETH_ALEN];
610 u8 hlid;
611 u8 aid;
612 u8 psd_type[NUM_ACCESS_CATEGORIES_COPY];
613 __le32 supported_rates;
614 u8 bss_index;
615 u8 sp_len;
616 u8 wmm;
617 u8 padding1;
618} __packed;
619
Eliad Pellerc690ec82011-08-14 13:17:07 +0300620struct wl12xx_cmd_remove_peer {
Arik Nemtsov98bdaab2010-10-16 18:08:58 +0200621 struct wl1271_cmd_header header;
622
623 u8 hlid;
624 u8 reason_opcode;
625 u8 send_deauth_flag;
626 u8 padding1;
627} __packed;
628
Ido Yariv95dac04f2011-06-06 14:57:06 +0300629/*
630 * Continuous mode - packets are transferred to the host periodically
631 * via the data path.
632 * On demand - Log messages are stored in a cyclic buffer in the
633 * firmware, and only transferred to the host when explicitly requested
634 */
635enum wl12xx_fwlogger_log_mode {
636 WL12XX_FWLOG_CONTINUOUS,
637 WL12XX_FWLOG_ON_DEMAND
638};
639
640/* Include/exclude timestamps from the log messages */
641enum wl12xx_fwlogger_timestamp {
642 WL12XX_FWLOG_TIMESTAMP_DISABLED,
643 WL12XX_FWLOG_TIMESTAMP_ENABLED
644};
645
646/*
647 * Logs can be routed to the debug pinouts (where available), to the host bus
648 * (SDIO/SPI), or dropped
649 */
650enum wl12xx_fwlogger_output {
651 WL12XX_FWLOG_OUTPUT_NONE,
652 WL12XX_FWLOG_OUTPUT_DBG_PINS,
653 WL12XX_FWLOG_OUTPUT_HOST,
654};
655
656struct wl12xx_cmd_config_fwlog {
657 struct wl1271_cmd_header header;
658
659 /* See enum wl12xx_fwlogger_log_mode */
660 u8 logger_mode;
661
662 /* Minimum log level threshold */
663 u8 log_severity;
664
665 /* Include/exclude timestamps from the log messages */
666 u8 timestamp;
667
668 /* See enum wl1271_fwlogger_output */
669 u8 output;
670
671 /* Regulates the frequency of log messages */
672 u8 threshold;
673
674 u8 padding[3];
675} __packed;
676
677struct wl12xx_cmd_start_fwlog {
678 struct wl1271_cmd_header header;
679} __packed;
680
681struct wl12xx_cmd_stop_fwlog {
682 struct wl1271_cmd_header header;
683} __packed;
684
Shahar Levi6d158ff2011-09-08 13:01:33 +0300685struct wl12xx_cmd_channel_switch {
686 struct wl1271_cmd_header header;
687
688 /* The new serving channel */
689 u8 channel;
690 /* Relative time of the serving channel switch in TBTT units */
691 u8 switch_time;
692 /* 1: Suspend TX till switch time; 0: Do not suspend TX */
693 u8 tx_suspend;
694 /* 1: Flush TX at switch time; 0: Do not flush */
695 u8 flush;
696} __packed;
697
698struct wl12xx_cmd_stop_channel_switch {
699 struct wl1271_cmd_header header;
700} __packed;
701
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300702#endif /* __WL1271_CMD_H__ */