2 * This file is part of wl1271
4 * Copyright (C) 1998-2009 Texas Instruments. All rights reserved.
5 * Copyright (C) 2009 Nokia Corporation
7 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
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.
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.
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
32 int wl1271_cmd_send(struct wl1271
*wl
, u16 id
, void *buf
, size_t len
,
34 int wl1271_cmd_general_parms(struct wl1271
*wl
);
35 int wl128x_cmd_general_parms(struct wl1271
*wl
);
36 int wl1271_cmd_radio_parms(struct wl1271
*wl
);
37 int wl128x_cmd_radio_parms(struct wl1271
*wl
);
38 int wl1271_cmd_ext_radio_parms(struct wl1271
*wl
);
39 int wl12xx_cmd_role_enable(struct wl1271
*wl
, u8 role_type
, u8
*role_id
);
40 int wl12xx_cmd_role_disable(struct wl1271
*wl
, u8
*role_id
);
41 int wl12xx_cmd_role_start_dev(struct wl1271
*wl
);
42 int wl12xx_cmd_role_stop_dev(struct wl1271
*wl
);
43 int wl12xx_cmd_role_start_sta(struct wl1271
*wl
);
44 int wl12xx_cmd_role_stop_sta(struct wl1271
*wl
);
45 int wl12xx_cmd_role_start_ap(struct wl1271
*wl
);
46 int wl12xx_cmd_role_stop_ap(struct wl1271
*wl
);
47 int wl12xx_cmd_role_start_ibss(struct wl1271
*wl
);
48 int wl1271_cmd_test(struct wl1271
*wl
, void *buf
, size_t buf_len
, u8 answer
);
49 int wl1271_cmd_interrogate(struct wl1271
*wl
, u16 id
, void *buf
, size_t len
);
50 int wl1271_cmd_configure(struct wl1271
*wl
, u16 id
, void *buf
, size_t len
);
51 int wl1271_cmd_data_path(struct wl1271
*wl
, bool enable
);
52 int wl1271_cmd_ps_mode(struct wl1271
*wl
, u8 ps_mode
);
53 int wl1271_cmd_read_memory(struct wl1271
*wl
, u32 addr
, void *answer
,
55 int wl1271_cmd_template_set(struct wl1271
*wl
, u16 template_id
,
56 void *buf
, size_t buf_len
, int index
, u32 rates
);
57 int wl1271_cmd_build_null_data(struct wl1271
*wl
);
58 int wl1271_cmd_build_ps_poll(struct wl1271
*wl
, u16 aid
);
59 int wl1271_cmd_build_probe_req(struct wl1271
*wl
,
60 const u8
*ssid
, size_t ssid_len
,
61 const u8
*ie
, size_t ie_len
, u8 band
);
62 struct sk_buff
*wl1271_cmd_build_ap_probe_req(struct wl1271
*wl
,
64 int wl1271_cmd_build_arp_rsp(struct wl1271
*wl
, __be32 ip_addr
);
65 int wl1271_build_qos_null_data(struct wl1271
*wl
);
66 int wl1271_cmd_build_klv_null_data(struct wl1271
*wl
);
67 int wl12xx_cmd_set_default_wep_key(struct wl1271
*wl
, u8 id
, u8 hlid
);
68 int wl1271_cmd_set_sta_key(struct wl1271
*wl
, u16 action
, u8 id
, u8 key_type
,
69 u8 key_size
, const u8
*key
, const u8
*addr
,
70 u32 tx_seq_32
, u16 tx_seq_16
);
71 int wl1271_cmd_set_ap_key(struct wl1271
*wl
, u16 action
, u8 id
, u8 key_type
,
72 u8 key_size
, const u8
*key
, u8 hlid
, u32 tx_seq_32
,
74 int wl12xx_cmd_set_peer_state(struct wl1271
*wl
, u8 hlid
);
75 int wl12xx_roc(struct wl1271
*wl
, u8 role_id
);
76 int wl12xx_croc(struct wl1271
*wl
, u8 role_id
);
77 int wl12xx_cmd_add_peer(struct wl1271
*wl
, struct ieee80211_sta
*sta
, u8 hlid
);
78 int wl12xx_cmd_remove_peer(struct wl1271
*wl
, u8 hlid
);
79 int wl12xx_cmd_config_fwlog(struct wl1271
*wl
);
80 int wl12xx_cmd_start_fwlog(struct wl1271
*wl
);
81 int wl12xx_cmd_stop_fwlog(struct wl1271
*wl
);
83 enum wl1271_commands
{
84 CMD_INTERROGATE
= 1, /*use this to read information elements*/
85 CMD_CONFIGURE
= 2, /*use this to write information elements*/
94 CMD_WRITE_MEMORY
= 14,
95 CMD_SET_TEMPLATE
= 19,
98 CMD_QUIET_ELEMENT_SET_STATE
= 29,
99 CMD_SET_BCN_MODE
= 33,
100 CMD_MEASUREMENT
= 34,
101 CMD_STOP_MEASUREMENT
= 35,
102 CMD_SET_PS_MODE
= 37,
103 CMD_CHANNEL_SWITCH
= 38,
104 CMD_STOP_CHANNEL_SWICTH
= 39,
105 CMD_AP_DISCOVERY
= 40,
106 CMD_STOP_AP_DISCOVERY
= 41,
107 CMD_HEALTH_CHECK
= 45,
109 CMD_TRIGGER_SCAN_TO
= 47,
110 CMD_CONNECTION_SCAN_CFG
= 48,
111 CMD_CONNECTION_SCAN_SSID_CFG
= 49,
112 CMD_START_PERIODIC_SCAN
= 50,
113 CMD_STOP_PERIODIC_SCAN
= 51,
114 CMD_SET_PEER_STATE
= 52,
115 CMD_REMAIN_ON_CHANNEL
= 53,
116 CMD_CANCEL_REMAIN_ON_CHANNEL
= 54,
118 CMD_CONFIG_FWLOGGER
= 55,
119 CMD_START_FWLOGGER
= 56,
120 CMD_STOP_FWLOGGER
= 57,
124 CMD_REMOVE_PEER
= 63,
127 CMD_ROLE_ENABLE
= 70,
128 CMD_ROLE_DISABLE
= 71,
133 CMD_WFD_START_DISCOVERY
= 80,
134 CMD_WFD_STOP_DISCOVERY
= 81,
135 CMD_WFD_ATTRIBUTE_CONFIG
= 82,
140 MAX_COMMAND_ID
= 0xFFFF,
143 #define MAX_CMD_PARAMS 572
146 CMD_TEMPL_KLV_IDX_NULL_DATA
= 0,
147 CMD_TEMPL_KLV_IDX_MAX
= 4
151 CMD_TEMPL_NULL_DATA
= 0,
153 CMD_TEMPL_CFG_PROBE_REQ_2_4
,
154 CMD_TEMPL_CFG_PROBE_REQ_5
,
155 CMD_TEMPL_PROBE_RESPONSE
,
156 CMD_TEMPL_QOS_NULL_DATA
,
159 CMD_TEMPL_DISCONNECT
,
160 CMD_TEMPL_PROBE_REQ_2_4
, /* for firmware internal use only */
161 CMD_TEMPL_PROBE_REQ_5
, /* for firmware internal use only */
162 CMD_TEMPL_BAR
, /* for firmware internal use only */
164 * For CTS-to-self (FastCTS) mechanism
165 * for BT/WLAN coexistence (SoftGemini). */
167 CMD_TEMPL_AP_PROBE_RESPONSE
,
171 CMD_TEMPL_LINK_MEASUREMENT_REPORT
,
177 #define WL1271_COMMAND_TIMEOUT 2000
178 #define WL1271_CMD_TEMPL_DFLT_SIZE 252
179 #define WL1271_CMD_TEMPL_MAX_SIZE 548
180 #define WL1271_EVENT_TIMEOUT 750
182 struct wl1271_cmd_header
{
189 #define WL1271_CMD_MAX_PARAMS 572
191 struct wl1271_command
{
192 struct wl1271_cmd_header header
;
193 u8 parameters
[WL1271_CMD_MAX_PARAMS
];
197 CMD_MAILBOX_IDLE
= 0,
198 CMD_STATUS_SUCCESS
= 1,
199 CMD_STATUS_UNKNOWN_CMD
= 2,
200 CMD_STATUS_UNKNOWN_IE
= 3,
201 CMD_STATUS_REJECT_MEAS_SG_ACTIVE
= 11,
202 CMD_STATUS_RX_BUSY
= 13,
203 CMD_STATUS_INVALID_PARAM
= 14,
204 CMD_STATUS_TEMPLATE_TOO_LARGE
= 15,
205 CMD_STATUS_OUT_OF_MEMORY
= 16,
206 CMD_STATUS_STA_TABLE_FULL
= 17,
207 CMD_STATUS_RADIO_ERROR
= 18,
208 CMD_STATUS_WRONG_NESTING
= 19,
209 CMD_STATUS_TIMEOUT
= 21, /* Driver internal use.*/
210 CMD_STATUS_FW_RESET
= 22, /* Driver internal use.*/
211 CMD_STATUS_TEMPLATE_OOM
= 23,
212 CMD_STATUS_NO_RX_BA_SESSION
= 24,
213 MAX_COMMAND_STATUS
= 0xff
216 #define CMDMBOX_HEADER_LEN 4
217 #define CMDMBOX_INFO_ELEM_HEADER_LEN 4
221 BSS_TYPE_STA_BSS
= 2,
226 #define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
227 #define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1
228 #define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10
230 struct wl12xx_cmd_role_enable
{
231 struct wl1271_cmd_header header
;
235 u8 mac_address
[ETH_ALEN
];
238 struct wl12xx_cmd_role_disable
{
239 struct wl1271_cmd_header header
;
246 WL12XX_BAND_2_4GHZ
= 0,
247 WL12XX_BAND_5GHZ
= 1,
248 WL12XX_BAND_JAPAN_4_9_GHZ
= 2,
249 WL12XX_BAND_DEFAULT
= WL12XX_BAND_2_4GHZ
,
250 WL12XX_BAND_INVALID
= 0x7E,
251 WL12XX_BAND_MAX_RADIO
= 0x7F,
254 struct wl12xx_cmd_role_start
{
255 struct wl1271_cmd_header header
;
268 /* sta & p2p_cli use the same struct */
271 u8 hlid
; /* data hlid */
273 __le32 remote_rates
; /* remote supported rates */
276 * The target uses this field to determine the rate at
277 * which to transmit control frame responses (such as
278 * ACK or CTS frames).
280 __le32 basic_rate_set
;
281 __le32 local_rates
; /* local supported rates */
285 u8 ssid
[IEEE80211_MAX_SSID_LEN
];
287 __le16 beacon_interval
; /* in TBTTs */
291 u8 hlid
; /* data hlid */
293 __le32 remote_rates
; /* remote supported rates */
295 __le32 basic_rate_set
;
296 __le32 local_rates
; /* local supported rates */
300 u8 ssid
[IEEE80211_MAX_SSID_LEN
];
302 __le16 beacon_interval
; /* in TBTTs */
306 /* ap & p2p_go use the same struct */
308 __le16 aging_period
; /* in secs */
309 u8 beacon_expiry
; /* in ms */
311 /* The host link id for the AP's global queue */
313 /* The host link id for the AP's broadcast queue */
316 __le16 beacon_interval
; /* in TBTTs */
318 __le32 basic_rate_set
;
319 __le32 local_rates
; /* local supported rates */
325 u8 ssid
[IEEE80211_MAX_SSID_LEN
];
332 struct wl12xx_cmd_role_stop
{
333 struct wl1271_cmd_header header
;
336 u8 disc_type
; /* only STA and P2P_CLI */
337 __le16 reason
; /* only STA and P2P_CLI */
340 struct cmd_enabledisable_path
{
341 struct wl1271_cmd_header header
;
347 #define WL1271_RATE_AUTOMATIC 0
349 struct wl1271_cmd_template_set
{
350 struct wl1271_cmd_header header
;
354 u8 index
; /* relevant only for KLV_TEMPLATE type */
355 __le32 enabled_rates
;
356 u8 short_retry_limit
;
360 u8 template_data
[WL1271_CMD_TEMPL_MAX_SIZE
];
364 #define PARTIAL_VBM_MAX 251
372 u8 pvb_field
[PARTIAL_VBM_MAX
]; /* Partial Virtual Bitmap */
375 enum wl1271_cmd_ps_mode
{
377 STATION_POWER_SAVE_MODE
380 struct wl1271_cmd_ps_params
{
381 struct wl1271_cmd_header header
;
384 u8 ps_mode
; /* STATION_* */
388 /* HW encryption keys */
389 #define NUM_ACCESS_CATEGORIES_COPY 4
391 enum wl1271_cmd_key_action
{
392 KEY_ADD_OR_REPLACE
= 1,
395 MAX_KEY_ACTION
= 0xffff,
398 enum wl1271_cmd_lid_key_type
{
399 UNICAST_LID_TYPE
= 0,
400 BROADCAST_LID_TYPE
= 1,
401 WEP_DEFAULT_LID_TYPE
= 2
404 enum wl1271_cmd_key_type
{
412 struct wl1271_cmd_set_keys
{
413 struct wl1271_cmd_header header
;
416 * Indicates whether the HLID is a unicast key set
417 * or broadcast key set. A special value 0xFF is
418 * used to indicate that the HLID is on WEP-default
419 * (multi-hlids). of type wl1271_cmd_lid_key_type.
424 * In WEP-default network (hlid == 0xFF) used to
425 * indicate which network STA/IBSS/AP role should be
431 * Key ID - For TKIP and AES key types, this field
432 * indicates the value that should be inserted into
433 * the KeyID field of frames transmitted using this
434 * key entry. For broadcast keys the index use as a
435 * marker for TX/RX key.
436 * For WEP default network (HLID=0xFF), this field
437 * indicates the ID of the key to add or remove.
445 /* key size in bytes */
451 /* This field holds the security key data to add to the STA table */
452 u8 key
[MAX_KEY_SIZE
];
453 __le16 ac_seq_num16
[NUM_ACCESS_CATEGORIES_COPY
];
454 __le32 ac_seq_num32
[NUM_ACCESS_CATEGORIES_COPY
];
457 struct wl1271_cmd_test_header
{
462 enum wl1271_channel_tune_bands
{
463 WL1271_CHANNEL_TUNE_BAND_2_4
,
464 WL1271_CHANNEL_TUNE_BAND_5
,
465 WL1271_CHANNEL_TUNE_BAND_4_9
468 #define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
470 #define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
471 #define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
472 #define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26
474 struct wl1271_general_parms_cmd
{
475 struct wl1271_cmd_header header
;
477 struct wl1271_cmd_test_header test
;
479 struct wl1271_ini_general_params general_params
;
481 u8 sr_debug_table
[WL1271_INI_MAX_SMART_REFLEX_PARAM
];
489 struct wl128x_general_parms_cmd
{
490 struct wl1271_cmd_header header
;
492 struct wl1271_cmd_test_header test
;
494 struct wl128x_ini_general_params general_params
;
496 u8 sr_debug_table
[WL1271_INI_MAX_SMART_REFLEX_PARAM
];
504 struct wl1271_radio_parms_cmd
{
505 struct wl1271_cmd_header header
;
507 struct wl1271_cmd_test_header test
;
509 /* Static radio parameters */
510 struct wl1271_ini_band_params_2 static_params_2
;
511 struct wl1271_ini_band_params_5 static_params_5
;
513 /* Dynamic radio parameters */
514 struct wl1271_ini_fem_params_2 dyn_params_2
;
516 struct wl1271_ini_fem_params_5 dyn_params_5
;
520 struct wl128x_radio_parms_cmd
{
521 struct wl1271_cmd_header header
;
523 struct wl1271_cmd_test_header test
;
525 /* Static radio parameters */
526 struct wl128x_ini_band_params_2 static_params_2
;
527 struct wl128x_ini_band_params_5 static_params_5
;
529 u8 fem_vendor_and_options
;
531 /* Dynamic radio parameters */
532 struct wl128x_ini_fem_params_2 dyn_params_2
;
534 struct wl128x_ini_fem_params_5 dyn_params_5
;
537 struct wl1271_ext_radio_parms_cmd
{
538 struct wl1271_cmd_header header
;
540 struct wl1271_cmd_test_header test
;
542 u8 tx_per_channel_power_compensation_2
[CONF_TX_PWR_COMPENSATION_LEN_2
];
543 u8 tx_per_channel_power_compensation_5
[CONF_TX_PWR_COMPENSATION_LEN_5
];
548 * There are three types of disconnections:
550 * DISCONNECT_IMMEDIATE: the fw doesn't send any frames
551 * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason
553 * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason
556 enum wl1271_disconnect_type
{
557 DISCONNECT_IMMEDIATE
,
562 #define WL1271_CMD_STA_STATE_CONNECTED 1
564 struct wl12xx_cmd_set_peer_state
{
565 struct wl1271_cmd_header header
;
572 struct wl12xx_cmd_roc
{
573 struct wl1271_cmd_header header
;
581 struct wl12xx_cmd_croc
{
582 struct wl1271_cmd_header header
;
588 enum wl12xx_ssid_type
{
589 WL12XX_SSID_TYPE_PUBLIC
= 0,
590 WL12XX_SSID_TYPE_HIDDEN
= 1,
591 WL12XX_SSID_TYPE_ANY
= 2,
594 struct wl12xx_cmd_add_peer
{
595 struct wl1271_cmd_header header
;
600 u8 psd_type
[NUM_ACCESS_CATEGORIES_COPY
];
601 __le32 supported_rates
;
608 struct wl12xx_cmd_remove_peer
{
609 struct wl1271_cmd_header header
;
618 * Continuous mode - packets are transferred to the host periodically
620 * On demand - Log messages are stored in a cyclic buffer in the
621 * firmware, and only transferred to the host when explicitly requested
623 enum wl12xx_fwlogger_log_mode
{
624 WL12XX_FWLOG_CONTINUOUS
,
625 WL12XX_FWLOG_ON_DEMAND
628 /* Include/exclude timestamps from the log messages */
629 enum wl12xx_fwlogger_timestamp
{
630 WL12XX_FWLOG_TIMESTAMP_DISABLED
,
631 WL12XX_FWLOG_TIMESTAMP_ENABLED
635 * Logs can be routed to the debug pinouts (where available), to the host bus
636 * (SDIO/SPI), or dropped
638 enum wl12xx_fwlogger_output
{
639 WL12XX_FWLOG_OUTPUT_NONE
,
640 WL12XX_FWLOG_OUTPUT_DBG_PINS
,
641 WL12XX_FWLOG_OUTPUT_HOST
,
644 struct wl12xx_cmd_config_fwlog
{
645 struct wl1271_cmd_header header
;
647 /* See enum wl12xx_fwlogger_log_mode */
650 /* Minimum log level threshold */
653 /* Include/exclude timestamps from the log messages */
656 /* See enum wl1271_fwlogger_output */
659 /* Regulates the frequency of log messages */
665 struct wl12xx_cmd_start_fwlog
{
666 struct wl1271_cmd_header header
;
669 struct wl12xx_cmd_stop_fwlog
{
670 struct wl1271_cmd_header header
;
673 #endif /* __WL1271_CMD_H__ */