blob: c5d114d67c83afca526e23591c0d85eba2909b8c [file] [log] [blame]
Fariya Fatimadad0d042014-03-16 03:47:02 +05301/**
2 * Copyright (c) 2014 Redpine Signals Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef __RSI_MGMT_H__
18#define __RSI_MGMT_H__
19
20#include <linux/sort.h>
21#include "rsi_boot_params.h"
22#include "rsi_main.h"
23
24#define MAX_MGMT_PKT_SIZE 512
25#define RSI_NEEDED_HEADROOM 80
26#define RSI_RCV_BUFFER_LEN 2000
27
28#define RSI_11B_MODE 0
29#define RSI_11G_MODE BIT(7)
30#define RETRY_COUNT 8
31#define RETRY_LONG 4
32#define RETRY_SHORT 7
33#define WMM_SHORT_SLOT_TIME 9
34#define SIFS_DURATION 16
35
36#define KEY_TYPE_CLEAR 0
37#define RSI_PAIRWISE_KEY 1
38#define RSI_GROUP_KEY 2
39
40/* EPPROM_READ_ADDRESS */
41#define WLAN_MAC_EEPROM_ADDR 40
42#define WLAN_MAC_MAGIC_WORD_LEN 0x01
43#define WLAN_HOST_MODE_LEN 0x04
44#define WLAN_FW_VERSION_LEN 0x08
45#define MAGIC_WORD 0x5A
Prameela Rani Garnepudi09cfb412017-07-06 20:07:05 +053046#define WLAN_EEPROM_RFTYPE_ADDR 424
Fariya Fatimadad0d042014-03-16 03:47:02 +053047
48/* Receive Frame Types */
49#define TA_CONFIRM_TYPE 0x01
50#define RX_DOT11_MGMT 0x02
51#define TX_STATUS_IND 0x04
52#define PROBEREQ_CONFIRM 2
53#define CARD_READY_IND 0x00
54
55#define RSI_DELETE_PEER 0x0
56#define RSI_ADD_PEER 0x1
57#define START_AMPDU_AGGR 0x1
58#define STOP_AMPDU_AGGR 0x0
59#define INTERNAL_MGMT_PKT 0x99
60
61#define PUT_BBP_RESET 0
62#define BBP_REG_WRITE 0
63#define RF_RESET_ENABLE BIT(3)
64#define RATE_INFO_ENABLE BIT(0)
65#define RSI_BROADCAST_PKT BIT(9)
Prameela Rani Garnepudi6507de62017-07-06 20:07:16 +053066#define RSI_DESC_REQUIRE_CFM_TO_HOST BIT(2)
Pavani Muthyala0eb42582017-07-06 20:07:18 +053067#define RSI_ADD_DELTA_TSF_VAP_ID BIT(3)
68#define RSI_FETCH_RETRY_CNT_FRM_HST BIT(4)
Pavani Muthyalaaf193092017-07-06 20:07:17 +053069#define RSI_QOS_ENABLE BIT(12)
Pavani Muthyala0eb42582017-07-06 20:07:18 +053070#define RSI_REKEY_PURPOSE BIT(13)
Pavani Muthyalaaf193092017-07-06 20:07:17 +053071#define RSI_ENCRYPT_PKT BIT(15)
Karun Eagalapatice868932017-08-03 19:58:59 +053072#define RSI_SET_PS_ENABLE BIT(12)
Fariya Fatimadad0d042014-03-16 03:47:02 +053073
Prameela Rani Garnepudi6abdf2c2017-07-10 18:10:34 +053074#define RSI_CMDDESC_40MHZ BIT(4)
75#define RSI_CMDDESC_UPPER_20_ENABLE BIT(5)
76#define RSI_CMDDESC_LOWER_20_ENABLE BIT(6)
77#define RSI_CMDDESC_FULL_40_ENABLE (BIT(5) | BIT(6))
Fariya Fatimadad0d042014-03-16 03:47:02 +053078#define UPPER_20_ENABLE (0x2 << 12)
79#define LOWER_20_ENABLE (0x4 << 12)
80#define FULL40M_ENABLE 0x6
81
82#define RSI_LMAC_CLOCK_80MHZ 0x1
83#define RSI_ENABLE_40MHZ (0x1 << 3)
Jahnavi Meher2bfa6962014-06-16 19:43:54 +053084#define ENABLE_SHORTGI_RATE BIT(9)
Fariya Fatimadad0d042014-03-16 03:47:02 +053085
86#define RX_BA_INDICATION 1
87#define RSI_TBL_SZ 40
88#define MAX_RETRIES 8
Jahnavi Meher48d11dc2014-04-29 01:03:53 +053089#define RSI_IFTYPE_STATION 0
Fariya Fatimadad0d042014-03-16 03:47:02 +053090
91#define STD_RATE_MCS7 0x07
92#define STD_RATE_MCS6 0x06
93#define STD_RATE_MCS5 0x05
94#define STD_RATE_MCS4 0x04
95#define STD_RATE_MCS3 0x03
96#define STD_RATE_MCS2 0x02
97#define STD_RATE_MCS1 0x01
98#define STD_RATE_MCS0 0x00
99#define STD_RATE_54 0x6c
100#define STD_RATE_48 0x60
101#define STD_RATE_36 0x48
102#define STD_RATE_24 0x30
103#define STD_RATE_18 0x24
104#define STD_RATE_12 0x18
105#define STD_RATE_11 0x16
106#define STD_RATE_09 0x12
107#define STD_RATE_06 0x0C
108#define STD_RATE_5_5 0x0B
109#define STD_RATE_02 0x04
110#define STD_RATE_01 0x02
111
112#define RSI_RF_TYPE 1
113#define RSI_RATE_00 0x00
114#define RSI_RATE_1 0x0
115#define RSI_RATE_2 0x2
116#define RSI_RATE_5_5 0x4
117#define RSI_RATE_11 0x6
118#define RSI_RATE_6 0x8b
119#define RSI_RATE_9 0x8f
120#define RSI_RATE_12 0x8a
121#define RSI_RATE_18 0x8e
122#define RSI_RATE_24 0x89
123#define RSI_RATE_36 0x8d
124#define RSI_RATE_48 0x88
125#define RSI_RATE_54 0x8c
126#define RSI_RATE_MCS0 0x100
127#define RSI_RATE_MCS1 0x101
128#define RSI_RATE_MCS2 0x102
129#define RSI_RATE_MCS3 0x103
130#define RSI_RATE_MCS4 0x104
131#define RSI_RATE_MCS5 0x105
132#define RSI_RATE_MCS6 0x106
133#define RSI_RATE_MCS7 0x107
134#define RSI_RATE_MCS7_SG 0x307
Pavani Muthyalaaf193092017-07-06 20:07:17 +0530135#define RSI_RATE_AUTO 0xffff
Fariya Fatimadad0d042014-03-16 03:47:02 +0530136
137#define BW_20MHZ 0
138#define BW_40MHZ 1
139
Jahnavi Meherf870a342014-06-16 19:41:22 +0530140#define EP_2GHZ_20MHZ 0
141#define EP_2GHZ_40MHZ 1
142#define EP_5GHZ_20MHZ 2
143#define EP_5GHZ_40MHZ 3
144
Jahnavi Meher4550faa2014-06-16 19:41:41 +0530145#define SIFS_TX_11N_VALUE 580
146#define SIFS_TX_11B_VALUE 346
147#define SHORT_SLOT_VALUE 360
148#define LONG_SLOT_VALUE 640
149#define OFDM_ACK_TOUT_VALUE 2720
150#define CCK_ACK_TOUT_VALUE 9440
151#define LONG_PREAMBLE 0x0000
152#define SHORT_PREAMBLE 0x0001
153
Fariya Fatimadad0d042014-03-16 03:47:02 +0530154#define RSI_SUPP_FILTERS (FIF_ALLMULTI | FIF_PROBE_REQ |\
155 FIF_BCN_PRBRESP_PROMISC)
Prameela Rani Garnepudie6d64282016-11-18 16:07:09 +0530156
Prameela Rani Garnepudi4edbcd12016-11-18 16:08:22 +0530157#define ANTENNA_SEL_INT 0x02 /* RF_OUT_2 / Integerated */
158#define ANTENNA_SEL_UFL 0x03 /* RF_OUT_1 / U.FL */
Pavani Muthyala588349a2017-08-03 19:58:58 +0530159#define ANTENNA_MASK_VALUE 0x00ff
160#define ANTENNA_SEL_TYPE 1
Prameela Rani Garnepudi4edbcd12016-11-18 16:08:22 +0530161
Prameela Rani Garnepudie6d64282016-11-18 16:07:09 +0530162/* Rx filter word definitions */
163#define PROMISCOUS_MODE BIT(0)
164#define ALLOW_DATA_ASSOC_PEER BIT(1)
165#define ALLOW_MGMT_ASSOC_PEER BIT(2)
166#define ALLOW_CTRL_ASSOC_PEER BIT(3)
167#define DISALLOW_BEACONS BIT(4)
168#define ALLOW_CONN_PEER_MGMT_WHILE_BUF_FULL BIT(5)
169#define DISALLOW_BROADCAST_DATA BIT(6)
170
Prameela Rani Garnepudi59e006d2017-07-10 18:10:36 +0530171#define RSI_MPDU_DENSITY 0x8
Prameela Rani Garnepudif04854f2017-07-10 18:10:39 +0530172#define RSI_CHAN_RADAR BIT(7)
Prameela Rani Garnepudide1d1812017-07-10 18:10:40 +0530173#define RSI_BEACON_INTERVAL 200
174#define RSI_DTIM_COUNT 2
Prameela Rani Garnepudi59e006d2017-07-10 18:10:36 +0530175
Karun Eagalapatice868932017-08-03 19:58:59 +0530176#define RSI_PS_DISABLE_IND BIT(15)
177#define RSI_PS_ENABLE 1
178#define RSI_PS_DISABLE 0
179#define RSI_DEEP_SLEEP 1
180#define RSI_CONNECTED_SLEEP 2
181#define RSI_SLEEP_REQUEST 1
182#define RSI_WAKEUP_REQUEST 2
183
Fariya Fatimadad0d042014-03-16 03:47:02 +0530184enum opmode {
185 STA_OPMODE = 1,
186 AP_OPMODE = 2
187};
188
Prameela Rani Garnepudi77364aa2016-10-13 16:56:45 +0530189enum vap_status {
190 VAP_ADD = 1,
191 VAP_DELETE = 2,
192 VAP_UPDATE = 3
193};
194
Fariya Fatimadad0d042014-03-16 03:47:02 +0530195extern struct ieee80211_rate rsi_rates[12];
196extern const u16 rsi_mcsrates[8];
197
198enum sta_notify_events {
199 STA_CONNECTED = 0,
200 STA_DISCONNECTED,
201 STA_TX_ADDBA_DONE,
202 STA_TX_DELBA,
203 STA_RX_ADDBA_DONE,
204 STA_RX_DELBA
205};
206
207/* Send Frames Types */
208enum cmd_frame_type {
209 TX_DOT11_MGMT,
210 RESET_MAC_REQ,
211 RADIO_CAPABILITIES,
212 BB_PROG_VALUES_REQUEST,
213 RF_PROG_VALUES_REQUEST,
214 WAKEUP_SLEEP_REQUEST,
215 SCAN_REQUEST,
216 TSF_UPDATE,
217 PEER_NOTIFY,
Jahnavi Meher686a2542014-06-16 19:46:48 +0530218 BLOCK_HW_QUEUE,
Fariya Fatimadad0d042014-03-16 03:47:02 +0530219 SET_KEY_REQ,
220 AUTO_RATE_IND,
221 BOOTUP_PARAMS_REQUEST,
222 VAP_CAPABILITIES,
Prameela Rani Garnepudi09cfb412017-07-06 20:07:05 +0530223 EEPROM_READ,
Fariya Fatimadad0d042014-03-16 03:47:02 +0530224 EEPROM_WRITE,
225 GPIO_PIN_CONFIG ,
226 SET_RX_FILTER,
227 AMPDU_IND,
228 STATS_REQUEST_FRAME,
229 BB_BUF_PROG_VALUES_REQ,
230 BBP_PROG_IN_TA,
231 BG_SCAN_PARAMS,
232 BG_SCAN_PROBE_REQ,
233 CW_MODE_REQ,
Prameela Rani Garnepudi8b36de82016-11-18 16:08:04 +0530234 PER_CMD_PKT,
Prameela Rani Garnepudi4edbcd12016-11-18 16:08:22 +0530235 ANT_SEL_FRAME = 0x20,
Prameela Rani Garnepudi99203222017-06-16 20:12:05 +0530236 COMMON_DEV_CONFIG = 0x28,
Prameela Rani Garnepudi8b36de82016-11-18 16:08:04 +0530237 RADIO_PARAMS_UPDATE = 0x29
Fariya Fatimadad0d042014-03-16 03:47:02 +0530238};
239
240struct rsi_mac_frame {
241 __le16 desc_word[8];
242} __packed;
243
Prameela Rani Garnepudi6c8ab762017-07-10 18:10:32 +0530244#define PWR_SAVE_WAKEUP_IND BIT(0)
245#define TCP_CHECK_SUM_OFFLOAD BIT(1)
246#define CONFIRM_REQUIRED_TO_HOST BIT(2)
247#define ADD_DELTA_TSF BIT(3)
248#define FETCH_RETRY_CNT_FROM_HOST_DESC BIT(4)
249#define EOSP_INDICATION BIT(5)
250#define REQUIRE_TSF_SYNC_CONFIRM BIT(6)
251#define ENCAP_MGMT_PKT BIT(7)
Prameela Rani Garnepudi9a629fa2017-07-10 18:10:33 +0530252#define DESC_IMMEDIATE_WAKEUP BIT(15)
Prameela Rani Garnepudi6c8ab762017-07-10 18:10:32 +0530253
254struct rsi_cmd_desc_dword0 {
255 __le16 len_qno;
256 u8 frame_type;
257 u8 misc_flags;
258};
259
260struct rsi_cmd_desc_dword1 {
261 u8 xtend_desc_size;
262 u8 reserved1;
263 __le16 reserved2;
264};
265
266struct rsi_cmd_desc_dword2 {
267 __le32 pkt_info; /* Packet specific data */
268};
269
270struct rsi_cmd_desc_dword3 {
271 __le16 token;
272 u8 qid_tid;
273 u8 sta_id;
274};
275
276struct rsi_cmd_desc {
277 struct rsi_cmd_desc_dword0 desc_dword0;
278 struct rsi_cmd_desc_dword1 desc_dword1;
279 struct rsi_cmd_desc_dword2 desc_dword2;
280 struct rsi_cmd_desc_dword3 desc_dword3;
281};
282
Fariya Fatimadad0d042014-03-16 03:47:02 +0530283struct rsi_boot_params {
284 __le16 desc_word[8];
285 struct bootup_params bootup_params;
286} __packed;
287
288struct rsi_peer_notify {
Prameela Rani Garnepudi59e006d2017-07-10 18:10:36 +0530289 struct rsi_cmd_desc desc;
Fariya Fatimadad0d042014-03-16 03:47:02 +0530290 u8 mac_addr[6];
291 __le16 command;
292 __le16 mpdu_density;
293 __le16 reserved;
294 __le32 sta_flags;
295} __packed;
296
Prameela Rani Garnepudi3a9828c2017-07-10 18:10:37 +0530297/* Aggregation params flags */
298#define RSI_AGGR_PARAMS_TID_MASK 0xf
299#define RSI_AGGR_PARAMS_START BIT(4)
300#define RSI_AGGR_PARAMS_RX_AGGR BIT(5)
301struct rsi_aggr_params {
302 struct rsi_cmd_desc_dword0 desc_dword0;
303 struct rsi_cmd_desc_dword0 desc_dword1;
304 __le16 seq_start;
305 __le16 baw_size;
306 __le16 token;
307 u8 aggr_params;
308 u8 peer_id;
309} __packed;
310
Prameela Rani Garnepudi5c7ca1b2017-07-10 18:10:38 +0530311struct rsi_bb_rf_prog {
312 struct rsi_cmd_desc_dword0 desc_dword0;
313 __le16 reserved1;
314 u8 rf_power_mode;
315 u8 reserved2;
316 u8 endpoint;
317 u8 reserved3;
318 __le16 reserved4;
319 __le16 reserved5;
320 __le16 flags;
321} __packed;
322
Prameela Rani Garnepudif04854f2017-07-10 18:10:39 +0530323struct rsi_chan_config {
324 struct rsi_cmd_desc_dword0 desc_dword0;
325 struct rsi_cmd_desc_dword1 desc_dword1;
326 u8 channel_number;
327 u8 antenna_gain_offset_2g;
328 u8 antenna_gain_offset_5g;
329 u8 channel_width;
330 __le16 tx_power;
331 u8 region_rftype;
332 u8 flags;
333} __packed;
334
Fariya Fatimadad0d042014-03-16 03:47:02 +0530335struct rsi_vap_caps {
Prameela Rani Garnepudide1d1812017-07-10 18:10:40 +0530336 struct rsi_cmd_desc_dword0 desc_dword0;
337 u8 reserved1;
338 u8 status;
339 __le16 reserved2;
340 u8 vif_type;
341 u8 channel_bw;
342 __le16 antenna_info;
343 u8 radioid_macid;
344 u8 vap_id;
345 __le16 reserved3;
Fariya Fatimadad0d042014-03-16 03:47:02 +0530346 u8 mac_addr[6];
347 __le16 keep_alive_period;
348 u8 bssid[6];
Prameela Rani Garnepudide1d1812017-07-10 18:10:40 +0530349 __le16 reserved4;
Fariya Fatimadad0d042014-03-16 03:47:02 +0530350 __le32 flags;
351 __le16 frag_threshold;
352 __le16 rts_threshold;
353 __le32 default_mgmt_rate;
Prameela Rani Garnepudide1d1812017-07-10 18:10:40 +0530354 __le16 default_ctrl_rate;
355 __le16 ctrl_rate_flags;
Fariya Fatimadad0d042014-03-16 03:47:02 +0530356 __le32 default_data_rate;
357 __le16 beacon_interval;
358 __le16 dtim_period;
Prameela Rani Garnepudide1d1812017-07-10 18:10:40 +0530359 __le16 beacon_miss_threshold;
Fariya Fatimadad0d042014-03-16 03:47:02 +0530360} __packed;
361
Pavani Muthyala588349a2017-08-03 19:58:58 +0530362struct rsi_ant_sel_frame {
363 struct rsi_cmd_desc_dword0 desc_dword0;
364 u8 reserved;
365 u8 sub_frame_type;
366 __le16 ant_value;
367 __le32 reserved1;
368 __le32 reserved2;
369} __packed;
370
Prameela Rani Garnepudia84faab2017-07-10 18:10:41 +0530371/* Key descriptor flags */
372#define RSI_KEY_TYPE_BROADCAST BIT(1)
373#define RSI_WEP_KEY BIT(2)
374#define RSI_WEP_KEY_104 BIT(3)
375#define RSI_CIPHER_WPA BIT(4)
376#define RSI_CIPHER_TKIP BIT(5)
377#define RSI_PROTECT_DATA_FRAMES BIT(13)
378#define RSI_KEY_ID_MASK 0xC0
379#define RSI_KEY_ID_OFFSET 14
Fariya Fatimadad0d042014-03-16 03:47:02 +0530380struct rsi_set_key {
Prameela Rani Garnepudia84faab2017-07-10 18:10:41 +0530381 struct rsi_cmd_desc_dword0 desc_dword0;
382 struct rsi_cmd_desc_dword1 desc_dword1;
383 __le16 key_desc;
384 __le32 bpn;
385 u8 sta_id;
386 u8 vap_id;
Fariya Fatimadad0d042014-03-16 03:47:02 +0530387 u8 key[4][32];
388 u8 tx_mic_key[8];
389 u8 rx_mic_key[8];
390} __packed;
391
392struct rsi_auto_rate {
393 __le16 desc_word[8];
394 __le16 failure_limit;
395 __le16 initial_boundary;
396 __le16 max_threshold_limt;
397 __le16 num_supported_rates;
398 __le16 aarf_rssi;
399 __le16 moderate_rate_inx;
400 __le16 collision_tolerance;
401 __le16 supported_rates[40];
402} __packed;
403
Prameela Rani Garnepudi79e590d2017-07-10 18:10:45 +0530404#define QUIET_INFO_VALID BIT(0)
405#define QUIET_ENABLE BIT(1)
406struct rsi_block_unblock_data {
407 struct rsi_cmd_desc_dword0 desc_dword0;
408 u8 xtend_desc_size;
409 u8 host_quiet_info;
410 __le16 reserved;
411 __le16 block_q_bitmap;
412 __le16 unblock_q_bitmap;
413 __le16 token;
414 __le16 flush_q_bitmap;
415} __packed;
416
Fariya Fatimadad0d042014-03-16 03:47:02 +0530417struct qos_params {
418 __le16 cont_win_min_q;
419 __le16 cont_win_max_q;
420 __le16 aifsn_val_q;
421 __le16 txop_q;
422} __packed;
423
424struct rsi_radio_caps {
Prameela Rani Garnepudi6abdf2c2017-07-10 18:10:34 +0530425 struct rsi_cmd_desc_dword0 desc_dword0;
426 struct rsi_cmd_desc_dword0 desc_dword1;
427 u8 channel_num;
428 u8 rf_model;
429 __le16 ppe_ack_rate;
430 __le16 mode_11j;
431 u8 radio_cfg_info;
432 u8 radio_info;
Fariya Fatimadad0d042014-03-16 03:47:02 +0530433 struct qos_params qos_params[MAX_HW_QUEUES];
434 u8 num_11n_rates;
435 u8 num_11ac_rates;
436 __le16 gcpd_per_rate[20];
Jahnavi Meher4550faa2014-06-16 19:41:41 +0530437 __le16 sifs_tx_11n;
438 __le16 sifs_tx_11b;
439 __le16 slot_rx_11n;
440 __le16 ofdm_ack_tout;
441 __le16 cck_ack_tout;
442 __le16 preamble_type;
Fariya Fatimadad0d042014-03-16 03:47:02 +0530443} __packed;
444
Prameela Rani Garnepudi99203222017-06-16 20:12:05 +0530445/* ULP GPIO flags */
446#define RSI_GPIO_MOTION_SENSOR_ULP_WAKEUP BIT(0)
447#define RSI_GPIO_SLEEP_IND_FROM_DEVICE BIT(1)
448#define RSI_GPIO_2_ULP BIT(2)
449#define RSI_GPIO_PUSH_BUTTON_ULP_WAKEUP BIT(3)
450
451/* SOC GPIO flags */
452#define RSI_GPIO_0_PSPI_CSN_0 BIT(0)
453#define RSI_GPIO_1_PSPI_CSN_1 BIT(1)
454#define RSI_GPIO_2_HOST_WAKEUP_INTR BIT(2)
455#define RSI_GPIO_3_PSPI_DATA_0 BIT(3)
456#define RSI_GPIO_4_PSPI_DATA_1 BIT(4)
457#define RSI_GPIO_5_PSPI_DATA_2 BIT(5)
458#define RSI_GPIO_6_PSPI_DATA_3 BIT(6)
459#define RSI_GPIO_7_I2C_SCL BIT(7)
460#define RSI_GPIO_8_I2C_SDA BIT(8)
461#define RSI_GPIO_9_UART1_RX BIT(9)
462#define RSI_GPIO_10_UART1_TX BIT(10)
463#define RSI_GPIO_11_UART1_RTS_I2S_CLK BIT(11)
464#define RSI_GPIO_12_UART1_CTS_I2S_WS BIT(12)
465#define RSI_GPIO_13_DBG_UART_RX_I2S_DIN BIT(13)
466#define RSI_GPIO_14_DBG_UART_RX_I2S_DOUT BIT(14)
467#define RSI_GPIO_15_LP_WAKEUP_BOOT_BYPASS BIT(15)
468#define RSI_GPIO_16_LED_0 BIT(16)
469#define RSI_GPIO_17_BTCOEX_WLAN_ACT_EXT_ANT_SEL BIT(17)
470#define RSI_GPIO_18_BTCOEX_BT_PRIO_EXT_ANT_SEL BIT(18)
471#define RSI_GPIO_19_BTCOEX_BT_ACT_EXT_ON_OFF BIT(19)
472#define RSI_GPIO_20_RF_RESET BIT(20)
473#define RSI_GPIO_21_SLEEP_IND_FROM_DEVICE BIT(21)
474
475#define RSI_UNUSED_SOC_GPIO_BITMAP (RSI_GPIO_9_UART1_RX | \
476 RSI_GPIO_10_UART1_TX | \
477 RSI_GPIO_11_UART1_RTS_I2S_CLK | \
478 RSI_GPIO_12_UART1_CTS_I2S_WS | \
479 RSI_GPIO_13_DBG_UART_RX_I2S_DIN | \
480 RSI_GPIO_14_DBG_UART_RX_I2S_DOUT | \
481 RSI_GPIO_15_LP_WAKEUP_BOOT_BYPASS | \
482 RSI_GPIO_17_BTCOEX_WLAN_ACT_EXT_ANT_SEL | \
483 RSI_GPIO_18_BTCOEX_BT_PRIO_EXT_ANT_SEL | \
484 RSI_GPIO_19_BTCOEX_BT_ACT_EXT_ON_OFF | \
485 RSI_GPIO_21_SLEEP_IND_FROM_DEVICE)
486
487#define RSI_UNUSED_ULP_GPIO_BITMAP (RSI_GPIO_MOTION_SENSOR_ULP_WAKEUP | \
488 RSI_GPIO_SLEEP_IND_FROM_DEVICE | \
489 RSI_GPIO_2_ULP | \
490 RSI_GPIO_PUSH_BUTTON_ULP_WAKEUP);
491struct rsi_config_vals {
492 __le16 len_qno;
493 u8 pkt_type;
494 u8 misc_flags;
495 __le16 reserved1[6];
496 u8 lp_ps_handshake;
497 u8 ulp_ps_handshake;
498 u8 sleep_config_params; /* 0 for no handshake,
499 * 1 for GPIO based handshake,
500 * 2 packet handshake
501 */
502 u8 unused_ulp_gpio;
503 __le32 unused_soc_gpio_bitmap;
504 u8 ext_pa_or_bt_coex_en;
505 u8 opermode;
506 u8 wlan_rf_pwr_mode;
507 u8 bt_rf_pwr_mode;
508 u8 zigbee_rf_pwr_mode;
509 u8 driver_mode;
510 u8 region_code;
511 u8 antenna_sel_val;
512 u8 reserved2[16];
513} __packed;
514
Prameela Rani Garnepudi09cfb412017-07-06 20:07:05 +0530515/* Packet info flags */
516#define RSI_EEPROM_HDR_SIZE_OFFSET 8
517#define RSI_EEPROM_HDR_SIZE_MASK 0x300
518#define RSI_EEPROM_LEN_OFFSET 20
519#define RSI_EEPROM_LEN_MASK 0xFFF00000
520
521struct rsi_eeprom_read_frame {
522 __le16 len_qno;
523 u8 pkt_type;
524 u8 misc_flags;
525 __le32 pkt_info;
526 __le32 eeprom_offset;
527 __le16 delay_ms;
528 __le16 reserved3;
529} __packed;
530
Karun Eagalapatice868932017-08-03 19:58:59 +0530531struct rsi_request_ps {
532 struct rsi_cmd_desc desc;
533 struct ps_sleep_params ps_sleep;
534 u8 ps_mimic_support;
535 u8 ps_uapsd_acs;
536 u8 ps_uapsd_wakeup_period;
537 u8 reserved;
538 __le32 ps_listen_interval;
539 __le32 ps_dtim_interval_duration;
540 __le16 ps_num_dtim_intervals;
541} __packed;
542
Fariya Fatimadad0d042014-03-16 03:47:02 +0530543static inline u32 rsi_get_queueno(u8 *addr, u16 offset)
544{
545 return (le16_to_cpu(*(__le16 *)&addr[offset]) & 0x7000) >> 12;
546}
547
548static inline u32 rsi_get_length(u8 *addr, u16 offset)
549{
550 return (le16_to_cpu(*(__le16 *)&addr[offset])) & 0x0fff;
551}
552
553static inline u8 rsi_get_extended_desc(u8 *addr, u16 offset)
554{
555 return le16_to_cpu(*((__le16 *)&addr[offset + 4])) & 0x00ff;
556}
557
558static inline u8 rsi_get_rssi(u8 *addr)
559{
560 return *(u8 *)(addr + FRAME_DESC_SZ);
561}
562
563static inline u8 rsi_get_channel(u8 *addr)
564{
565 return *(char *)(addr + 15);
566}
567
Prameela Rani Garnepudi99203222017-06-16 20:12:05 +0530568static inline void rsi_set_len_qno(__le16 *addr, u16 len, u8 qno)
569{
570 *addr = cpu_to_le16(len | ((qno & 7) << 12));
571}
572
Fariya Fatimadad0d042014-03-16 03:47:02 +0530573int rsi_mgmt_pkt_recv(struct rsi_common *common, u8 *msg);
Prameela Rani Garnepudi77364aa2016-10-13 16:56:45 +0530574int rsi_set_vap_capabilities(struct rsi_common *common, enum opmode mode,
575 u8 vap_status);
Fariya Fatimadad0d042014-03-16 03:47:02 +0530576int rsi_send_aggregation_params_frame(struct rsi_common *common, u16 tid,
577 u16 ssn, u8 buf_size, u8 event);
578int rsi_hal_load_key(struct rsi_common *common, u8 *data, u16 key_len,
579 u8 key_type, u8 key_id, u32 cipher);
Prameela Rani Garnepudi61d10842016-11-18 16:08:43 +0530580int rsi_set_channel(struct rsi_common *common,
581 struct ieee80211_channel *channel);
Jahnavi Meher686a2542014-06-16 19:46:48 +0530582int rsi_send_block_unblock_frame(struct rsi_common *common, bool event);
Fariya Fatimadad0d042014-03-16 03:47:02 +0530583void rsi_inform_bss_status(struct rsi_common *common, u8 status,
584 const u8 *bssid, u8 qos_enable, u16 aid);
585void rsi_indicate_pkt_to_os(struct rsi_common *common, struct sk_buff *skb);
586int rsi_mac80211_attach(struct rsi_common *common);
587void rsi_indicate_tx_status(struct rsi_hw *common, struct sk_buff *skb,
588 int status);
589bool rsi_is_cipher_wep(struct rsi_common *common);
590void rsi_core_qos_processor(struct rsi_common *common);
591void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb);
592int rsi_send_mgmt_pkt(struct rsi_common *common, struct sk_buff *skb);
593int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb);
Jahnavi Meher85af5bf2014-06-16 19:46:31 +0530594int rsi_band_check(struct rsi_common *common);
Prameela Rani Garnepudie6d64282016-11-18 16:07:09 +0530595int rsi_send_rx_filter_frame(struct rsi_common *common, u16 rx_filter_word);
Prameela Rani Garnepudi8b36de82016-11-18 16:08:04 +0530596int rsi_send_radio_params_update(struct rsi_common *common);
Prameela Rani Garnepudi4edbcd12016-11-18 16:08:22 +0530597int rsi_set_antenna(struct rsi_common *common, u8 antenna);
Fariya Fatimadad0d042014-03-16 03:47:02 +0530598#endif