aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1271_cmd.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_cmd.h')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.h464
1 files changed, 464 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
new file mode 100644
index 000000000000..951a8447a516
--- /dev/null
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -0,0 +1,464 @@
1/*
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
25#ifndef __WL1271_CMD_H__
26#define __WL1271_CMD_H__
27
28#include "wl1271.h"
29
30struct acx_header;
31
32int wl1271_cmd_send(struct wl1271 *wl, u16 type, void *buf, size_t buf_len);
33int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
34 u16 beacon_interval, u8 wait);
35int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
36int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
37int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
38int wl1271_cmd_data_path(struct wl1271 *wl, u8 channel, bool enable);
39int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode);
40int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
41 size_t len);
42int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len,
43 u8 active_scan, u8 high_prio, u8 num_channels,
44 u8 probe_requests);
45int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
46 void *buf, size_t buf_len);
47int wl1271_cmd_build_null_data(struct wl1271 *wl);
48int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid);
49int wl1271_cmd_build_probe_req(struct wl1271 *wl, u8 *ssid, size_t ssid_len);
50int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id);
51int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
52 u8 key_size, const u8 *key, const u8 *addr);
53
54enum wl1271_commands {
55 CMD_INTERROGATE = 1, /*use this to read information elements*/
56 CMD_CONFIGURE = 2, /*use this to write information elements*/
57 CMD_ENABLE_RX = 3,
58 CMD_ENABLE_TX = 4,
59 CMD_DISABLE_RX = 5,
60 CMD_DISABLE_TX = 6,
61 CMD_SCAN = 8,
62 CMD_STOP_SCAN = 9,
63 CMD_START_JOIN = 11,
64 CMD_SET_KEYS = 12,
65 CMD_READ_MEMORY = 13,
66 CMD_WRITE_MEMORY = 14,
67 CMD_SET_TEMPLATE = 19,
68 CMD_TEST = 23,
69 CMD_NOISE_HIST = 28,
70 CMD_LNA_CONTROL = 32,
71 CMD_SET_BCN_MODE = 33,
72 CMD_MEASUREMENT = 34,
73 CMD_STOP_MEASUREMENT = 35,
74 CMD_DISCONNECT = 36,
75 CMD_SET_PS_MODE = 37,
76 CMD_CHANNEL_SWITCH = 38,
77 CMD_STOP_CHANNEL_SWICTH = 39,
78 CMD_AP_DISCOVERY = 40,
79 CMD_STOP_AP_DISCOVERY = 41,
80 CMD_SPS_SCAN = 42,
81 CMD_STOP_SPS_SCAN = 43,
82 CMD_HEALTH_CHECK = 45,
83 CMD_DEBUG = 46,
84 CMD_TRIGGER_SCAN_TO = 47,
85 CMD_CONNECTION_SCAN_CFG = 48,
86 CMD_CONNECTION_SCAN_SSID_CFG = 49,
87 CMD_START_PERIODIC_SCAN = 50,
88 CMD_STOP_PERIODIC_SCAN = 51,
89 CMD_SET_STA_STATE = 52,
90
91 NUM_COMMANDS,
92 MAX_COMMAND_ID = 0xFFFF,
93};
94
95#define MAX_CMD_PARAMS 572
96
97enum cmd_templ {
98 CMD_TEMPL_NULL_DATA = 0,
99 CMD_TEMPL_BEACON,
100 CMD_TEMPL_CFG_PROBE_REQ_2_4,
101 CMD_TEMPL_CFG_PROBE_REQ_5,
102 CMD_TEMPL_PROBE_RESPONSE,
103 CMD_TEMPL_QOS_NULL_DATA,
104 CMD_TEMPL_PS_POLL,
105 CMD_TEMPL_KLV,
106 CMD_TEMPL_DISCONNECT,
107 CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */
108 CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */
109 CMD_TEMPL_BAR, /* for firmware internal use only */
110 CMD_TEMPL_CTS, /*
111 * For CTS-to-self (FastCTS) mechanism
112 * for BT/WLAN coexistence (SoftGemini). */
113 CMD_TEMPL_MAX = 0xff
114};
115
116/* unit ms */
117#define WL1271_COMMAND_TIMEOUT 2000
118#define WL1271_CMD_TEMPL_MAX_SIZE 252
119
120struct wl1271_cmd_header {
121 u16 id;
122 u16 status;
123 /* payload */
124 u8 data[0];
125} __attribute__ ((packed));
126
127#define WL1271_CMD_MAX_PARAMS 572
128
129struct wl1271_command {
130 struct wl1271_cmd_header header;
131 u8 parameters[WL1271_CMD_MAX_PARAMS];
132} __attribute__ ((packed));
133
134enum {
135 CMD_MAILBOX_IDLE = 0,
136 CMD_STATUS_SUCCESS = 1,
137 CMD_STATUS_UNKNOWN_CMD = 2,
138 CMD_STATUS_UNKNOWN_IE = 3,
139 CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
140 CMD_STATUS_RX_BUSY = 13,
141 CMD_STATUS_INVALID_PARAM = 14,
142 CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
143 CMD_STATUS_OUT_OF_MEMORY = 16,
144 CMD_STATUS_STA_TABLE_FULL = 17,
145 CMD_STATUS_RADIO_ERROR = 18,
146 CMD_STATUS_WRONG_NESTING = 19,
147 CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
148 CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
149 MAX_COMMAND_STATUS = 0xff
150};
151
152
153/*
154 * CMD_READ_MEMORY
155 *
156 * The host issues this command to read the WiLink device memory/registers.
157 *
158 * Note: The Base Band address has special handling (16 bits registers and
159 * addresses). For more information, see the hardware specification.
160 */
161/*
162 * CMD_WRITE_MEMORY
163 *
164 * The host issues this command to write the WiLink device memory/registers.
165 *
166 * The Base Band address has special handling (16 bits registers and
167 * addresses). For more information, see the hardware specification.
168 */
169#define MAX_READ_SIZE 256
170
171struct cmd_read_write_memory {
172 struct wl1271_cmd_header header;
173
174 /* The address of the memory to read from or write to.*/
175 u32 addr;
176
177 /* The amount of data in bytes to read from or write to the WiLink
178 * device.*/
179 u32 size;
180
181 /* The actual value read from or written to the Wilink. The source
182 of this field is the Host in WRITE command or the Wilink in READ
183 command. */
184 u8 value[MAX_READ_SIZE];
185};
186
187#define CMDMBOX_HEADER_LEN 4
188#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
189
190enum {
191 BSS_TYPE_IBSS = 0,
192 BSS_TYPE_STA_BSS = 2,
193 BSS_TYPE_AP_BSS = 3,
194 MAX_BSS_TYPE = 0xFF
195};
196
197#define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
198#define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1
199
200struct wl1271_cmd_join {
201 struct wl1271_cmd_header header;
202
203 u32 bssid_lsb;
204 u16 bssid_msb;
205 u16 beacon_interval; /* in TBTTs */
206 u32 rx_config_options;
207 u32 rx_filter_options;
208
209 /*
210 * The target uses this field to determine the rate at
211 * which to transmit control frame responses (such as
212 * ACK or CTS frames).
213 */
214 u32 basic_rate_set;
215 u8 dtim_interval;
216 /*
217 * bits 0-2: This bitwise field specifies the type
218 * of BSS to start or join (BSS_TYPE_*).
219 * bit 4: Band - The radio band in which to join
220 * or start.
221 * 0 - 2.4GHz band
222 * 1 - 5GHz band
223 * bits 3, 5-7: Reserved
224 */
225 u8 bss_type;
226 u8 channel;
227 u8 ssid_len;
228 u8 ssid[IW_ESSID_MAX_SIZE];
229 u8 ctrl; /* JOIN_CMD_CTRL_* */
230 u8 reserved[3];
231} __attribute__ ((packed));
232
233struct cmd_enabledisable_path {
234 struct wl1271_cmd_header header;
235
236 u8 channel;
237 u8 padding[3];
238} __attribute__ ((packed));
239
240struct wl1271_cmd_template_set {
241 struct wl1271_cmd_header header;
242
243 u16 len;
244 u8 template_type;
245 u8 index; /* relevant only for KLV_TEMPLATE type */
246 u32 enabled_rates;
247 u8 short_retry_limit;
248 u8 long_retry_limit;
249 u8 aflags;
250 u8 reserved;
251 u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE];
252} __attribute__ ((packed));
253
254#define TIM_ELE_ID 5
255#define PARTIAL_VBM_MAX 251
256
257struct wl1271_tim {
258 u8 identity;
259 u8 length;
260 u8 dtim_count;
261 u8 dtim_period;
262 u8 bitmap_ctrl;
263 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
264} __attribute__ ((packed));
265
266enum wl1271_cmd_ps_mode {
267 STATION_ACTIVE_MODE,
268 STATION_POWER_SAVE_MODE
269};
270
271struct wl1271_cmd_ps_params {
272 struct wl1271_cmd_header header;
273
274 u8 ps_mode; /* STATION_* */
275 u8 send_null_data; /* Do we have to send NULL data packet ? */
276 u8 retries; /* Number of retires for the initial NULL data packet */
277
278 /*
279 * TUs during which the target stays awake after switching
280 * to power save mode.
281 */
282 u8 hang_over_period;
283 u32 null_data_rate;
284} __attribute__ ((packed));
285
286/* HW encryption keys */
287#define NUM_ACCESS_CATEGORIES_COPY 4
288#define MAX_KEY_SIZE 32
289
290/* When set, disable HW encryption */
291#define DF_ENCRYPTION_DISABLE 0x01
292/* When set, disable HW decryption */
293#define DF_SNIFF_MODE_ENABLE 0x80
294
295enum wl1271_cmd_key_action {
296 KEY_ADD_OR_REPLACE = 1,
297 KEY_REMOVE = 2,
298 KEY_SET_ID = 3,
299 MAX_KEY_ACTION = 0xffff,
300};
301
302enum wl1271_cmd_key_type {
303 KEY_NONE = 0,
304 KEY_WEP = 1,
305 KEY_TKIP = 2,
306 KEY_AES = 3,
307 KEY_GEM = 4
308};
309
310/* FIXME: Add description for key-types */
311
312struct wl1271_cmd_set_keys {
313 struct wl1271_cmd_header header;
314
315 /* Ignored for default WEP key */
316 u8 addr[ETH_ALEN];
317
318 /* key_action_e */
319 u16 key_action;
320
321 u16 reserved_1;
322
323 /* key size in bytes */
324 u8 key_size;
325
326 /* key_type_e */
327 u8 key_type;
328 u8 ssid_profile;
329
330 /*
331 * TKIP, AES: frame's key id field.
332 * For WEP default key: key id;
333 */
334 u8 id;
335 u8 reserved_2[6];
336 u8 key[MAX_KEY_SIZE];
337 u16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
338 u32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
339} __attribute__ ((packed));
340
341
342#define WL1271_SCAN_MAX_CHANNELS 24
343#define WL1271_SCAN_DEFAULT_TAG 1
344#define WL1271_SCAN_CURRENT_TX_PWR 0
345#define WL1271_SCAN_OPT_ACTIVE 0
346#define WL1271_SCAN_OPT_PASSIVE 1
347#define WL1271_SCAN_OPT_PRIORITY_HIGH 4
348#define WL1271_SCAN_CHAN_MIN_DURATION 30000 /* TU */
349#define WL1271_SCAN_CHAN_MAX_DURATION 60000 /* TU */
350
351struct basic_scan_params {
352 u32 rx_config_options;
353 u32 rx_filter_options;
354 /* Scan option flags (WL1271_SCAN_OPT_*) */
355 u16 scan_options;
356 /* Number of scan channels in the list (maximum 30) */
357 u8 num_channels;
358 /* This field indicates the number of probe requests to send
359 per channel for an active scan */
360 u8 num_probe_requests;
361 /* Rate bit field for sending the probes */
362 u32 tx_rate;
363 u8 tid_trigger;
364 u8 ssid_len;
365 /* in order to align */
366 u8 padding1[2];
367 u8 ssid[IW_ESSID_MAX_SIZE];
368 /* Band to scan */
369 u8 band;
370 u8 use_ssid_list;
371 u8 scan_tag;
372 u8 padding2;
373} __attribute__ ((packed));
374
375struct basic_scan_channel_params {
376 /* Duration in TU to wait for frames on a channel for active scan */
377 u32 min_duration;
378 u32 max_duration;
379 u32 bssid_lsb;
380 u16 bssid_msb;
381 u8 early_termination;
382 u8 tx_power_att;
383 u8 channel;
384 /* FW internal use only! */
385 u8 dfs_candidate;
386 u8 activity_detected;
387 u8 pad;
388} __attribute__ ((packed));
389
390struct wl1271_cmd_scan {
391 struct wl1271_cmd_header header;
392
393 struct basic_scan_params params;
394 struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS];
395} __attribute__ ((packed));
396
397struct wl1271_cmd_trigger_scan_to {
398 struct wl1271_cmd_header header;
399
400 u32 timeout;
401};
402
403struct wl1271_cmd_test_header {
404 u8 id;
405 u8 padding[3];
406};
407
408enum wl1271_channel_tune_bands {
409 WL1271_CHANNEL_TUNE_BAND_2_4,
410 WL1271_CHANNEL_TUNE_BAND_5,
411 WL1271_CHANNEL_TUNE_BAND_4_9
412};
413
414#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
415
416#define TEST_CMD_P2G_CAL 0x02
417#define TEST_CMD_CHANNEL_TUNE 0x0d
418#define TEST_CMD_UPDATE_PD_REFERENCE_POINT 0x1d
419
420struct wl1271_cmd_cal_channel_tune {
421 struct wl1271_cmd_header header;
422
423 struct wl1271_cmd_test_header test;
424
425 u8 band;
426 u8 channel;
427
428 u16 radio_status;
429} __attribute__ ((packed));
430
431struct wl1271_cmd_cal_update_ref_point {
432 struct wl1271_cmd_header header;
433
434 struct wl1271_cmd_test_header test;
435
436 s32 ref_power;
437 s32 ref_detector;
438 u8 sub_band;
439 u8 padding[3];
440} __attribute__ ((packed));
441
442#define MAX_TLV_LENGTH 400
443#define MAX_NVS_VERSION_LENGTH 12
444
445#define WL1271_CAL_P2G_BAND_B_G BIT(0)
446
447struct wl1271_cmd_cal_p2g {
448 struct wl1271_cmd_header header;
449
450 struct wl1271_cmd_test_header test;
451
452 u16 len;
453 u8 buf[MAX_TLV_LENGTH];
454 u8 type;
455 u8 padding;
456
457 s16 radio_status;
458 u8 nvs_version[MAX_NVS_VERSION_LENGTH];
459
460 u8 sub_band_mask;
461 u8 padding2;
462} __attribute__ ((packed));
463
464#endif /* __WL1271_CMD_H__ */