rsi_mgmt.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. /**
  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. #ifndef __RSI_MGMT_H__
  17. #define __RSI_MGMT_H__
  18. #include <linux/sort.h>
  19. #include "rsi_boot_params.h"
  20. #include "rsi_main.h"
  21. #define MAX_MGMT_PKT_SIZE 512
  22. #define RSI_NEEDED_HEADROOM 84
  23. #define RSI_RCV_BUFFER_LEN 2000
  24. #define RSI_11B_MODE 0
  25. #define RSI_11G_MODE BIT(7)
  26. #define RETRY_COUNT 8
  27. #define RETRY_LONG 4
  28. #define RETRY_SHORT 7
  29. #define WMM_SHORT_SLOT_TIME 9
  30. #define SIFS_DURATION 16
  31. #define EAPOL4_PACKET_LEN 0x85
  32. #define KEY_TYPE_CLEAR 0
  33. #define RSI_PAIRWISE_KEY 1
  34. #define RSI_GROUP_KEY 2
  35. /* EPPROM_READ_ADDRESS */
  36. #define WLAN_MAC_EEPROM_ADDR 40
  37. #define WLAN_MAC_MAGIC_WORD_LEN 0x01
  38. #define WLAN_HOST_MODE_LEN 0x04
  39. #define WLAN_FW_VERSION_LEN 0x08
  40. #define MAGIC_WORD 0x5A
  41. #define WLAN_EEPROM_RFTYPE_ADDR 424
  42. /*WOWLAN RESUME WAKEUP TYPES*/
  43. #define RSI_UNICAST_MAGIC_PKT BIT(0)
  44. #define RSI_BROADCAST_MAGICPKT BIT(1)
  45. #define RSI_EAPOL_PKT BIT(2)
  46. #define RSI_DISCONNECT_PKT BIT(3)
  47. #define RSI_HW_BMISS_PKT BIT(4)
  48. #define RSI_INSERT_SEQ_IN_FW BIT(2)
  49. #define WOW_MAX_FILTERS_PER_LIST 16
  50. #define WOW_PATTERN_SIZE 256
  51. /* Receive Frame Types */
  52. #define RSI_RX_DESC_MSG_TYPE_OFFSET 2
  53. #define TA_CONFIRM_TYPE 0x01
  54. #define RX_DOT11_MGMT 0x02
  55. #define TX_STATUS_IND 0x04
  56. #define BEACON_EVENT_IND 0x08
  57. #define EAPOL4_CONFIRM 1
  58. #define PROBEREQ_CONFIRM 2
  59. #define CARD_READY_IND 0x00
  60. #define SLEEP_NOTIFY_IND 0x06
  61. #define RSI_TX_STATUS_TYPE 15
  62. #define RSI_TX_STATUS 12
  63. #define RSI_DELETE_PEER 0x0
  64. #define RSI_ADD_PEER 0x1
  65. #define START_AMPDU_AGGR 0x1
  66. #define STOP_AMPDU_AGGR 0x0
  67. #define INTERNAL_MGMT_PKT 0x99
  68. #define PUT_BBP_RESET 0
  69. #define BBP_REG_WRITE 0
  70. #define RF_RESET_ENABLE BIT(3)
  71. #define RATE_INFO_ENABLE BIT(0)
  72. #define MORE_DATA_PRESENT BIT(1)
  73. #define RSI_BROADCAST_PKT BIT(9)
  74. #define RSI_DESC_REQUIRE_CFM_TO_HOST BIT(2)
  75. #define RSI_ADD_DELTA_TSF_VAP_ID BIT(3)
  76. #define RSI_FETCH_RETRY_CNT_FRM_HST BIT(4)
  77. #define RSI_QOS_ENABLE BIT(12)
  78. #define RSI_REKEY_PURPOSE BIT(13)
  79. #define RSI_ENCRYPT_PKT BIT(15)
  80. #define RSI_SET_PS_ENABLE BIT(12)
  81. #define RSI_CMDDESC_40MHZ BIT(4)
  82. #define RSI_CMDDESC_UPPER_20_ENABLE BIT(5)
  83. #define RSI_CMDDESC_LOWER_20_ENABLE BIT(6)
  84. #define RSI_CMDDESC_FULL_40_ENABLE (BIT(5) | BIT(6))
  85. #define UPPER_20_ENABLE (0x2 << 12)
  86. #define LOWER_20_ENABLE (0x4 << 12)
  87. #define FULL40M_ENABLE 0x6
  88. #define RSI_LMAC_CLOCK_80MHZ 0x1
  89. #define RSI_ENABLE_40MHZ (0x1 << 3)
  90. #define ENABLE_SHORTGI_RATE BIT(9)
  91. #define RX_BA_INDICATION 1
  92. #define RSI_TBL_SZ 40
  93. #define MAX_RETRIES 8
  94. #define RSI_IFTYPE_STATION 0
  95. #define STD_RATE_MCS7 0x07
  96. #define STD_RATE_MCS6 0x06
  97. #define STD_RATE_MCS5 0x05
  98. #define STD_RATE_MCS4 0x04
  99. #define STD_RATE_MCS3 0x03
  100. #define STD_RATE_MCS2 0x02
  101. #define STD_RATE_MCS1 0x01
  102. #define STD_RATE_MCS0 0x00
  103. #define STD_RATE_54 0x6c
  104. #define STD_RATE_48 0x60
  105. #define STD_RATE_36 0x48
  106. #define STD_RATE_24 0x30
  107. #define STD_RATE_18 0x24
  108. #define STD_RATE_12 0x18
  109. #define STD_RATE_11 0x16
  110. #define STD_RATE_09 0x12
  111. #define STD_RATE_06 0x0C
  112. #define STD_RATE_5_5 0x0B
  113. #define STD_RATE_02 0x04
  114. #define STD_RATE_01 0x02
  115. #define RSI_RF_TYPE 1
  116. #define RSI_RATE_00 0x00
  117. #define RSI_RATE_1 0x0
  118. #define RSI_RATE_2 0x2
  119. #define RSI_RATE_5_5 0x4
  120. #define RSI_RATE_11 0x6
  121. #define RSI_RATE_6 0x8b
  122. #define RSI_RATE_9 0x8f
  123. #define RSI_RATE_12 0x8a
  124. #define RSI_RATE_18 0x8e
  125. #define RSI_RATE_24 0x89
  126. #define RSI_RATE_36 0x8d
  127. #define RSI_RATE_48 0x88
  128. #define RSI_RATE_54 0x8c
  129. #define RSI_RATE_MCS0 0x100
  130. #define RSI_RATE_MCS1 0x101
  131. #define RSI_RATE_MCS2 0x102
  132. #define RSI_RATE_MCS3 0x103
  133. #define RSI_RATE_MCS4 0x104
  134. #define RSI_RATE_MCS5 0x105
  135. #define RSI_RATE_MCS6 0x106
  136. #define RSI_RATE_MCS7 0x107
  137. #define RSI_RATE_MCS7_SG 0x307
  138. #define RSI_RATE_AUTO 0xffff
  139. #define BW_20MHZ 0
  140. #define BW_40MHZ 1
  141. #define EP_2GHZ_20MHZ 0
  142. #define EP_2GHZ_40MHZ 1
  143. #define EP_5GHZ_20MHZ 2
  144. #define EP_5GHZ_40MHZ 3
  145. #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. #define RSI_SUPP_FILTERS (FIF_ALLMULTI | FIF_PROBE_REQ |\
  154. FIF_BCN_PRBRESP_PROMISC)
  155. #define ANTENNA_SEL_INT 0x02 /* RF_OUT_2 / Integerated */
  156. #define ANTENNA_SEL_UFL 0x03 /* RF_OUT_1 / U.FL */
  157. #define ANTENNA_MASK_VALUE 0x00ff
  158. #define ANTENNA_SEL_TYPE 1
  159. /* Rx filter word definitions */
  160. #define PROMISCOUS_MODE BIT(0)
  161. #define ALLOW_DATA_ASSOC_PEER BIT(1)
  162. #define ALLOW_MGMT_ASSOC_PEER BIT(2)
  163. #define ALLOW_CTRL_ASSOC_PEER BIT(3)
  164. #define DISALLOW_BEACONS BIT(4)
  165. #define ALLOW_CONN_PEER_MGMT_WHILE_BUF_FULL BIT(5)
  166. #define DISALLOW_BROADCAST_DATA BIT(6)
  167. #define RSI_MPDU_DENSITY 0x8
  168. #define RSI_CHAN_RADAR BIT(7)
  169. #define RSI_BEACON_INTERVAL 200
  170. #define RSI_DTIM_COUNT 2
  171. #define RSI_PS_DISABLE_IND BIT(15)
  172. #define RSI_PS_ENABLE 1
  173. #define RSI_PS_DISABLE 0
  174. #define RSI_DEEP_SLEEP 1
  175. #define RSI_CONNECTED_SLEEP 2
  176. #define RSI_SLEEP_REQUEST 1
  177. #define RSI_WAKEUP_REQUEST 2
  178. #define RSI_IEEE80211_UAPSD_QUEUES \
  179. (IEEE80211_WMM_IE_STA_QOSINFO_AC_VO | \
  180. IEEE80211_WMM_IE_STA_QOSINFO_AC_VI | \
  181. IEEE80211_WMM_IE_STA_QOSINFO_AC_BE | \
  182. IEEE80211_WMM_IE_STA_QOSINFO_AC_BK)
  183. #define RSI_DESC_VAP_ID_MASK 0xC000u
  184. #define RSI_DESC_VAP_ID_OFST 14
  185. #define RSI_DATA_DESC_MAC_BBP_INFO BIT(0)
  186. #define RSI_DATA_DESC_NO_ACK_IND BIT(9)
  187. #define RSI_DATA_DESC_QOS_EN BIT(12)
  188. #define RSI_DATA_DESC_NORMAL_FRAME 0x00
  189. #define RSI_DATA_DESC_DTIM_BEACON_GATED_FRAME BIT(10)
  190. #define RSI_DATA_DESC_BEACON_FRAME BIT(11)
  191. #define RSI_DATA_DESC_DTIM_BEACON (BIT(10) | BIT(11))
  192. #define RSI_DATA_DESC_INSERT_TSF BIT(15)
  193. #define RSI_DATA_DESC_INSERT_SEQ_NO BIT(2)
  194. #ifdef CONFIG_PM
  195. #define RSI_WOW_ANY BIT(1)
  196. #define RSI_WOW_GTK_REKEY BIT(3)
  197. #define RSI_WOW_MAGIC_PKT BIT(4)
  198. #define RSI_WOW_DISCONNECT BIT(5)
  199. #endif
  200. #define RSI_MAX_TX_AGGR_FRMS 8
  201. #define RSI_MAX_RX_AGGR_FRMS 8
  202. #define RSI_MAX_SCAN_SSIDS 16
  203. #define RSI_MAX_SCAN_IE_LEN 256
  204. enum opmode {
  205. RSI_OPMODE_UNSUPPORTED = -1,
  206. RSI_OPMODE_AP = 0,
  207. RSI_OPMODE_STA,
  208. RSI_OPMODE_P2P_GO,
  209. RSI_OPMODE_P2P_CLIENT
  210. };
  211. enum vap_status {
  212. VAP_ADD = 1,
  213. VAP_DELETE = 2,
  214. VAP_UPDATE = 3
  215. };
  216. enum peer_type {
  217. PEER_TYPE_AP,
  218. PEER_TYPE_STA,
  219. };
  220. extern struct ieee80211_rate rsi_rates[12];
  221. extern const u16 rsi_mcsrates[8];
  222. enum sta_notify_events {
  223. STA_CONNECTED = 0,
  224. STA_DISCONNECTED,
  225. STA_TX_ADDBA_DONE,
  226. STA_TX_DELBA,
  227. STA_RX_ADDBA_DONE,
  228. STA_RX_DELBA
  229. };
  230. /* Send Frames Types */
  231. enum cmd_frame_type {
  232. TX_DOT11_MGMT,
  233. RESET_MAC_REQ,
  234. RADIO_CAPABILITIES,
  235. BB_PROG_VALUES_REQUEST,
  236. RF_PROG_VALUES_REQUEST,
  237. WAKEUP_SLEEP_REQUEST,
  238. SCAN_REQUEST,
  239. TSF_UPDATE,
  240. PEER_NOTIFY,
  241. BLOCK_HW_QUEUE,
  242. SET_KEY_REQ,
  243. AUTO_RATE_IND,
  244. BOOTUP_PARAMS_REQUEST,
  245. VAP_CAPABILITIES,
  246. EEPROM_READ,
  247. EEPROM_WRITE,
  248. GPIO_PIN_CONFIG ,
  249. SET_RX_FILTER,
  250. AMPDU_IND,
  251. STATS_REQUEST_FRAME,
  252. BB_BUF_PROG_VALUES_REQ,
  253. BBP_PROG_IN_TA,
  254. BG_SCAN_PARAMS,
  255. BG_SCAN_PROBE_REQ,
  256. CW_MODE_REQ,
  257. PER_CMD_PKT,
  258. ANT_SEL_FRAME = 0x20,
  259. VAP_DYNAMIC_UPDATE = 0x27,
  260. COMMON_DEV_CONFIG = 0x28,
  261. RADIO_PARAMS_UPDATE = 0x29,
  262. WOWLAN_CONFIG_PARAMS = 0x2B,
  263. FEATURES_ENABLE = 0x33,
  264. WOWLAN_WAKEUP_REASON = 0xc5
  265. };
  266. struct rsi_mac_frame {
  267. __le16 desc_word[8];
  268. } __packed;
  269. #define PWR_SAVE_WAKEUP_IND BIT(0)
  270. #define TCP_CHECK_SUM_OFFLOAD BIT(1)
  271. #define CONFIRM_REQUIRED_TO_HOST BIT(2)
  272. #define ADD_DELTA_TSF BIT(3)
  273. #define FETCH_RETRY_CNT_FROM_HOST_DESC BIT(4)
  274. #define EOSP_INDICATION BIT(5)
  275. #define REQUIRE_TSF_SYNC_CONFIRM BIT(6)
  276. #define ENCAP_MGMT_PKT BIT(7)
  277. #define DESC_IMMEDIATE_WAKEUP BIT(15)
  278. struct rsi_xtended_desc {
  279. u8 confirm_frame_type;
  280. u8 retry_cnt;
  281. u16 reserved;
  282. };
  283. struct rsi_cmd_desc_dword0 {
  284. __le16 len_qno;
  285. u8 frame_type;
  286. u8 misc_flags;
  287. };
  288. struct rsi_cmd_desc_dword1 {
  289. u8 xtend_desc_size;
  290. u8 reserved1;
  291. __le16 reserved2;
  292. };
  293. struct rsi_cmd_desc_dword2 {
  294. __le32 pkt_info; /* Packet specific data */
  295. };
  296. struct rsi_cmd_desc_dword3 {
  297. __le16 token;
  298. u8 qid_tid;
  299. u8 sta_id;
  300. };
  301. struct rsi_cmd_desc {
  302. struct rsi_cmd_desc_dword0 desc_dword0;
  303. struct rsi_cmd_desc_dword1 desc_dword1;
  304. struct rsi_cmd_desc_dword2 desc_dword2;
  305. struct rsi_cmd_desc_dword3 desc_dword3;
  306. };
  307. struct rsi_boot_params {
  308. __le16 desc_word[8];
  309. struct bootup_params bootup_params;
  310. } __packed;
  311. struct rsi_boot_params_9116 {
  312. struct rsi_cmd_desc_dword0 desc_dword0;
  313. struct rsi_cmd_desc_dword1 desc_dword1;
  314. struct rsi_cmd_desc_dword2 desc_dword2;
  315. __le16 reserved;
  316. __le16 umac_clk;
  317. struct bootup_params_9116 bootup_params;
  318. } __packed;
  319. struct rsi_peer_notify {
  320. struct rsi_cmd_desc desc;
  321. u8 mac_addr[6];
  322. __le16 command;
  323. __le16 mpdu_density;
  324. __le16 reserved;
  325. __le32 sta_flags;
  326. } __packed;
  327. /* Aggregation params flags */
  328. #define RSI_AGGR_PARAMS_TID_MASK 0xf
  329. #define RSI_AGGR_PARAMS_START BIT(4)
  330. #define RSI_AGGR_PARAMS_RX_AGGR BIT(5)
  331. struct rsi_aggr_params {
  332. struct rsi_cmd_desc_dword0 desc_dword0;
  333. struct rsi_cmd_desc_dword0 desc_dword1;
  334. __le16 seq_start;
  335. __le16 baw_size;
  336. __le16 token;
  337. u8 aggr_params;
  338. u8 peer_id;
  339. } __packed;
  340. struct rsi_bb_rf_prog {
  341. struct rsi_cmd_desc_dword0 desc_dword0;
  342. __le16 reserved1;
  343. u8 rf_power_mode;
  344. u8 reserved2;
  345. u8 endpoint;
  346. u8 reserved3;
  347. __le16 reserved4;
  348. __le16 reserved5;
  349. __le16 flags;
  350. } __packed;
  351. struct rsi_chan_config {
  352. struct rsi_cmd_desc_dword0 desc_dword0;
  353. struct rsi_cmd_desc_dword1 desc_dword1;
  354. u8 channel_number;
  355. u8 antenna_gain_offset_2g;
  356. u8 antenna_gain_offset_5g;
  357. u8 channel_width;
  358. __le16 tx_power;
  359. u8 region_rftype;
  360. u8 flags;
  361. } __packed;
  362. struct rsi_vap_caps {
  363. struct rsi_cmd_desc_dword0 desc_dword0;
  364. u8 reserved1;
  365. u8 status;
  366. __le16 reserved2;
  367. u8 vif_type;
  368. u8 channel_bw;
  369. __le16 antenna_info;
  370. __le16 token;
  371. u8 radioid_macid;
  372. u8 vap_id;
  373. u8 mac_addr[6];
  374. __le16 keep_alive_period;
  375. u8 bssid[6];
  376. __le16 reserved4;
  377. __le32 flags;
  378. __le16 frag_threshold;
  379. __le16 rts_threshold;
  380. __le32 default_mgmt_rate;
  381. __le16 default_ctrl_rate;
  382. __le16 ctrl_rate_flags;
  383. __le32 default_data_rate;
  384. __le16 beacon_interval;
  385. __le16 dtim_period;
  386. __le16 beacon_miss_threshold;
  387. } __packed;
  388. struct rsi_ant_sel_frame {
  389. struct rsi_cmd_desc_dword0 desc_dword0;
  390. u8 reserved;
  391. u8 sub_frame_type;
  392. __le16 ant_value;
  393. __le32 reserved1;
  394. __le32 reserved2;
  395. } __packed;
  396. struct rsi_dynamic_s {
  397. struct rsi_cmd_desc_dword0 desc_dword0;
  398. struct rsi_cmd_desc_dword1 desc_dword1;
  399. struct rsi_cmd_desc_dword2 desc_dword2;
  400. struct rsi_cmd_desc_dword3 desc_dword3;
  401. struct framebody {
  402. __le16 data_rate;
  403. __le16 mgmt_rate;
  404. __le16 keep_alive_period;
  405. } frame_body;
  406. } __packed;
  407. /* Key descriptor flags */
  408. #define RSI_KEY_TYPE_BROADCAST BIT(1)
  409. #define RSI_WEP_KEY BIT(2)
  410. #define RSI_WEP_KEY_104 BIT(3)
  411. #define RSI_CIPHER_WPA BIT(4)
  412. #define RSI_CIPHER_TKIP BIT(5)
  413. #define RSI_KEY_MODE_AP BIT(7)
  414. #define RSI_PROTECT_DATA_FRAMES BIT(13)
  415. #define RSI_KEY_ID_MASK 0xC0
  416. #define RSI_KEY_ID_OFFSET 14
  417. struct rsi_set_key {
  418. struct rsi_cmd_desc_dword0 desc_dword0;
  419. struct rsi_cmd_desc_dword1 desc_dword1;
  420. __le16 key_desc;
  421. __le32 bpn;
  422. u8 sta_id;
  423. u8 vap_id;
  424. u8 key[4][32];
  425. u8 tx_mic_key[8];
  426. u8 rx_mic_key[8];
  427. } __packed;
  428. struct rsi_auto_rate {
  429. struct rsi_cmd_desc desc;
  430. __le16 failure_limit;
  431. __le16 initial_boundary;
  432. __le16 max_threshold_limt;
  433. __le16 num_supported_rates;
  434. __le16 aarf_rssi;
  435. __le16 moderate_rate_inx;
  436. __le16 collision_tolerance;
  437. __le16 supported_rates[40];
  438. } __packed;
  439. #define QUIET_INFO_VALID BIT(0)
  440. #define QUIET_ENABLE BIT(1)
  441. struct rsi_block_unblock_data {
  442. struct rsi_cmd_desc_dword0 desc_dword0;
  443. u8 xtend_desc_size;
  444. u8 host_quiet_info;
  445. __le16 reserved;
  446. __le16 block_q_bitmap;
  447. __le16 unblock_q_bitmap;
  448. __le16 token;
  449. __le16 flush_q_bitmap;
  450. } __packed;
  451. struct qos_params {
  452. __le16 cont_win_min_q;
  453. __le16 cont_win_max_q;
  454. __le16 aifsn_val_q;
  455. __le16 txop_q;
  456. } __packed;
  457. struct rsi_radio_caps {
  458. struct rsi_cmd_desc_dword0 desc_dword0;
  459. struct rsi_cmd_desc_dword0 desc_dword1;
  460. u8 channel_num;
  461. u8 rf_model;
  462. __le16 ppe_ack_rate;
  463. __le16 mode_11j;
  464. u8 radio_cfg_info;
  465. u8 radio_info;
  466. struct qos_params qos_params[MAX_HW_QUEUES];
  467. u8 num_11n_rates;
  468. u8 num_11ac_rates;
  469. __le16 gcpd_per_rate[20];
  470. __le16 sifs_tx_11n;
  471. __le16 sifs_tx_11b;
  472. __le16 slot_rx_11n;
  473. __le16 ofdm_ack_tout;
  474. __le16 cck_ack_tout;
  475. __le16 preamble_type;
  476. } __packed;
  477. /* ULP GPIO flags */
  478. #define RSI_GPIO_MOTION_SENSOR_ULP_WAKEUP BIT(0)
  479. #define RSI_GPIO_SLEEP_IND_FROM_DEVICE BIT(1)
  480. #define RSI_GPIO_2_ULP BIT(2)
  481. #define RSI_GPIO_PUSH_BUTTON_ULP_WAKEUP BIT(3)
  482. /* SOC GPIO flags */
  483. #define RSI_GPIO_0_PSPI_CSN_0 BIT(0)
  484. #define RSI_GPIO_1_PSPI_CSN_1 BIT(1)
  485. #define RSI_GPIO_2_HOST_WAKEUP_INTR BIT(2)
  486. #define RSI_GPIO_3_PSPI_DATA_0 BIT(3)
  487. #define RSI_GPIO_4_PSPI_DATA_1 BIT(4)
  488. #define RSI_GPIO_5_PSPI_DATA_2 BIT(5)
  489. #define RSI_GPIO_6_PSPI_DATA_3 BIT(6)
  490. #define RSI_GPIO_7_I2C_SCL BIT(7)
  491. #define RSI_GPIO_8_I2C_SDA BIT(8)
  492. #define RSI_GPIO_9_UART1_RX BIT(9)
  493. #define RSI_GPIO_10_UART1_TX BIT(10)
  494. #define RSI_GPIO_11_UART1_RTS_I2S_CLK BIT(11)
  495. #define RSI_GPIO_12_UART1_CTS_I2S_WS BIT(12)
  496. #define RSI_GPIO_13_DBG_UART_RX_I2S_DIN BIT(13)
  497. #define RSI_GPIO_14_DBG_UART_RX_I2S_DOUT BIT(14)
  498. #define RSI_GPIO_15_LP_WAKEUP_BOOT_BYPASS BIT(15)
  499. #define RSI_GPIO_16_LED_0 BIT(16)
  500. #define RSI_GPIO_17_BTCOEX_WLAN_ACT_EXT_ANT_SEL BIT(17)
  501. #define RSI_GPIO_18_BTCOEX_BT_PRIO_EXT_ANT_SEL BIT(18)
  502. #define RSI_GPIO_19_BTCOEX_BT_ACT_EXT_ON_OFF BIT(19)
  503. #define RSI_GPIO_20_RF_RESET BIT(20)
  504. #define RSI_GPIO_21_SLEEP_IND_FROM_DEVICE BIT(21)
  505. #define RSI_UNUSED_SOC_GPIO_BITMAP (RSI_GPIO_9_UART1_RX | \
  506. RSI_GPIO_10_UART1_TX | \
  507. RSI_GPIO_11_UART1_RTS_I2S_CLK | \
  508. RSI_GPIO_12_UART1_CTS_I2S_WS | \
  509. RSI_GPIO_13_DBG_UART_RX_I2S_DIN | \
  510. RSI_GPIO_14_DBG_UART_RX_I2S_DOUT | \
  511. RSI_GPIO_15_LP_WAKEUP_BOOT_BYPASS | \
  512. RSI_GPIO_17_BTCOEX_WLAN_ACT_EXT_ANT_SEL | \
  513. RSI_GPIO_18_BTCOEX_BT_PRIO_EXT_ANT_SEL | \
  514. RSI_GPIO_19_BTCOEX_BT_ACT_EXT_ON_OFF | \
  515. RSI_GPIO_21_SLEEP_IND_FROM_DEVICE)
  516. #define RSI_UNUSED_ULP_GPIO_BITMAP (RSI_GPIO_MOTION_SENSOR_ULP_WAKEUP | \
  517. RSI_GPIO_SLEEP_IND_FROM_DEVICE | \
  518. RSI_GPIO_2_ULP | \
  519. RSI_GPIO_PUSH_BUTTON_ULP_WAKEUP);
  520. struct rsi_config_vals {
  521. __le16 len_qno;
  522. u8 pkt_type;
  523. u8 misc_flags;
  524. __le16 reserved1[6];
  525. u8 lp_ps_handshake;
  526. u8 ulp_ps_handshake;
  527. u8 sleep_config_params; /* 0 for no handshake,
  528. * 1 for GPIO based handshake,
  529. * 2 packet handshake
  530. */
  531. u8 unused_ulp_gpio;
  532. __le32 unused_soc_gpio_bitmap;
  533. u8 ext_pa_or_bt_coex_en;
  534. u8 opermode;
  535. u8 wlan_rf_pwr_mode;
  536. u8 bt_rf_pwr_mode;
  537. u8 zigbee_rf_pwr_mode;
  538. u8 driver_mode;
  539. u8 region_code;
  540. u8 antenna_sel_val;
  541. u8 reserved2[16];
  542. } __packed;
  543. /* Packet info flags */
  544. #define RSI_EEPROM_HDR_SIZE_OFFSET 8
  545. #define RSI_EEPROM_HDR_SIZE_MASK 0x300
  546. #define RSI_EEPROM_LEN_OFFSET 20
  547. #define RSI_EEPROM_LEN_MASK 0xFFF00000
  548. struct rsi_eeprom_read_frame {
  549. __le16 len_qno;
  550. u8 pkt_type;
  551. u8 misc_flags;
  552. __le32 pkt_info;
  553. __le32 eeprom_offset;
  554. __le16 delay_ms;
  555. __le16 reserved3;
  556. } __packed;
  557. struct rsi_request_ps {
  558. struct rsi_cmd_desc desc;
  559. struct ps_sleep_params ps_sleep;
  560. u8 ps_mimic_support;
  561. u8 ps_uapsd_acs;
  562. u8 ps_uapsd_wakeup_period;
  563. u8 reserved;
  564. __le32 ps_listen_interval;
  565. __le32 ps_dtim_interval_duration;
  566. __le16 ps_num_dtim_intervals;
  567. } __packed;
  568. struct rsi_wowlan_req {
  569. struct rsi_cmd_desc desc;
  570. u8 sourceid[ETH_ALEN];
  571. u16 wow_flags;
  572. u16 host_sleep_status;
  573. } __packed;
  574. #define RSI_START_BGSCAN 1
  575. #define RSI_STOP_BGSCAN 0
  576. #define HOST_BG_SCAN_TRIG BIT(4)
  577. struct rsi_bgscan_config {
  578. struct rsi_cmd_desc_dword0 desc_dword0;
  579. __le64 reserved;
  580. __le32 reserved1;
  581. __le16 bgscan_threshold;
  582. __le16 roam_threshold;
  583. __le16 bgscan_periodicity;
  584. u8 num_bgscan_channels;
  585. u8 two_probe;
  586. __le16 active_scan_duration;
  587. __le16 passive_scan_duration;
  588. __le16 channels2scan[MAX_BGSCAN_CHANNELS_DUAL_BAND];
  589. } __packed;
  590. struct rsi_bgscan_probe {
  591. struct rsi_cmd_desc_dword0 desc_dword0;
  592. __le64 reserved;
  593. __le32 reserved1;
  594. __le16 mgmt_rate;
  595. __le16 flags;
  596. __le16 def_chan;
  597. __le16 channel_scan_time;
  598. __le16 probe_req_length;
  599. } __packed;
  600. #define RSI_DUTY_CYCLING BIT(0)
  601. #define RSI_END_OF_FRAME BIT(1)
  602. #define RSI_SIFS_TX_ENABLE BIT(2)
  603. #define RSI_DPD BIT(3)
  604. struct rsi_wlan_9116_features {
  605. struct rsi_cmd_desc desc;
  606. u8 pll_mode;
  607. u8 rf_type;
  608. u8 wireless_mode;
  609. u8 enable_ppe;
  610. u8 afe_type;
  611. u8 reserved1;
  612. __le16 reserved2;
  613. __le32 feature_enable;
  614. };
  615. static inline u32 rsi_get_queueno(u8 *addr, u16 offset)
  616. {
  617. return (le16_to_cpu(*(__le16 *)&addr[offset]) & 0x7000) >> 12;
  618. }
  619. static inline u32 rsi_get_length(u8 *addr, u16 offset)
  620. {
  621. return (le16_to_cpu(*(__le16 *)&addr[offset])) & 0x0fff;
  622. }
  623. static inline u8 rsi_get_extended_desc(u8 *addr, u16 offset)
  624. {
  625. return le16_to_cpu(*((__le16 *)&addr[offset + 4])) & 0x00ff;
  626. }
  627. static inline u8 rsi_get_rssi(u8 *addr)
  628. {
  629. return *(u8 *)(addr + FRAME_DESC_SZ);
  630. }
  631. static inline u8 rsi_get_channel(u8 *addr)
  632. {
  633. return *(char *)(addr + 15);
  634. }
  635. static inline void rsi_set_len_qno(__le16 *addr, u16 len, u8 qno)
  636. {
  637. *addr = cpu_to_le16(len | ((qno & 7) << 12));
  638. }
  639. int rsi_handle_card_ready(struct rsi_common *common, u8 *msg);
  640. int rsi_mgmt_pkt_recv(struct rsi_common *common, u8 *msg);
  641. int rsi_set_vap_capabilities(struct rsi_common *common, enum opmode mode,
  642. u8 *mac_addr, u8 vap_id, u8 vap_status);
  643. int rsi_send_aggregation_params_frame(struct rsi_common *common, u16 tid,
  644. u16 ssn, u8 buf_size, u8 event,
  645. u8 sta_id);
  646. int rsi_hal_load_key(struct rsi_common *common, u8 *data, u16 key_len,
  647. u8 key_type, u8 key_id, u32 cipher, s16 sta_id,
  648. struct ieee80211_vif *vif);
  649. int rsi_set_channel(struct rsi_common *common,
  650. struct ieee80211_channel *channel);
  651. int rsi_send_vap_dynamic_update(struct rsi_common *common);
  652. int rsi_send_block_unblock_frame(struct rsi_common *common, bool event);
  653. int rsi_hal_send_sta_notify_frame(struct rsi_common *common, enum opmode opmode,
  654. u8 notify_event, const unsigned char *bssid,
  655. u8 qos_enable, u16 aid, u16 sta_id,
  656. struct ieee80211_vif *vif);
  657. void rsi_inform_bss_status(struct rsi_common *common, enum opmode opmode,
  658. u8 status, const u8 *addr, u8 qos_enable, u16 aid,
  659. struct ieee80211_sta *sta, u16 sta_id,
  660. u16 assoc_cap, struct ieee80211_vif *vif);
  661. void rsi_indicate_pkt_to_os(struct rsi_common *common, struct sk_buff *skb);
  662. int rsi_mac80211_attach(struct rsi_common *common);
  663. void rsi_indicate_tx_status(struct rsi_hw *common, struct sk_buff *skb,
  664. int status);
  665. bool rsi_is_cipher_wep(struct rsi_common *common);
  666. void rsi_core_qos_processor(struct rsi_common *common);
  667. void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb);
  668. int rsi_send_mgmt_pkt(struct rsi_common *common, struct sk_buff *skb);
  669. int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb);
  670. int rsi_band_check(struct rsi_common *common, struct ieee80211_channel *chan);
  671. int rsi_send_rx_filter_frame(struct rsi_common *common, u16 rx_filter_word);
  672. int rsi_send_radio_params_update(struct rsi_common *common);
  673. int rsi_set_antenna(struct rsi_common *common, u8 antenna);
  674. #ifdef CONFIG_PM
  675. int rsi_send_wowlan_request(struct rsi_common *common, u16 flags,
  676. u16 sleep_status);
  677. #endif
  678. int rsi_send_ps_request(struct rsi_hw *adapter, bool enable,
  679. struct ieee80211_vif *vif);
  680. void init_bgscan_params(struct rsi_common *common);
  681. int rsi_send_bgscan_params(struct rsi_common *common, int enable);
  682. int rsi_send_bgscan_probe_req(struct rsi_common *common,
  683. struct ieee80211_vif *vif);
  684. #endif