18c2ecf20Sopenharmony_ci/**
28c2ecf20Sopenharmony_ci * Copyright (c) 2014 Redpine Signals Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifndef __RSI_MGMT_H__
188c2ecf20Sopenharmony_ci#define __RSI_MGMT_H__
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include <linux/sort.h>
218c2ecf20Sopenharmony_ci#include "rsi_boot_params.h"
228c2ecf20Sopenharmony_ci#include "rsi_main.h"
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define MAX_MGMT_PKT_SIZE               512
258c2ecf20Sopenharmony_ci#define RSI_NEEDED_HEADROOM             84
268c2ecf20Sopenharmony_ci#define RSI_RCV_BUFFER_LEN              2000
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define RSI_11B_MODE                    0
298c2ecf20Sopenharmony_ci#define RSI_11G_MODE                    BIT(7)
308c2ecf20Sopenharmony_ci#define RETRY_COUNT                     8
318c2ecf20Sopenharmony_ci#define RETRY_LONG                      4
328c2ecf20Sopenharmony_ci#define RETRY_SHORT                     7
338c2ecf20Sopenharmony_ci#define WMM_SHORT_SLOT_TIME             9
348c2ecf20Sopenharmony_ci#define SIFS_DURATION                   16
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define EAPOL4_PACKET_LEN		0x85
378c2ecf20Sopenharmony_ci#define KEY_TYPE_CLEAR                  0
388c2ecf20Sopenharmony_ci#define RSI_PAIRWISE_KEY                1
398c2ecf20Sopenharmony_ci#define RSI_GROUP_KEY                   2
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* EPPROM_READ_ADDRESS */
428c2ecf20Sopenharmony_ci#define WLAN_MAC_EEPROM_ADDR            40
438c2ecf20Sopenharmony_ci#define WLAN_MAC_MAGIC_WORD_LEN         0x01
448c2ecf20Sopenharmony_ci#define WLAN_HOST_MODE_LEN              0x04
458c2ecf20Sopenharmony_ci#define WLAN_FW_VERSION_LEN             0x08
468c2ecf20Sopenharmony_ci#define MAGIC_WORD                      0x5A
478c2ecf20Sopenharmony_ci#define WLAN_EEPROM_RFTYPE_ADDR		424
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/*WOWLAN RESUME WAKEUP TYPES*/
508c2ecf20Sopenharmony_ci#define RSI_UNICAST_MAGIC_PKT		BIT(0)
518c2ecf20Sopenharmony_ci#define RSI_BROADCAST_MAGICPKT		BIT(1)
528c2ecf20Sopenharmony_ci#define RSI_EAPOL_PKT			BIT(2)
538c2ecf20Sopenharmony_ci#define RSI_DISCONNECT_PKT		BIT(3)
548c2ecf20Sopenharmony_ci#define RSI_HW_BMISS_PKT		BIT(4)
558c2ecf20Sopenharmony_ci#define RSI_INSERT_SEQ_IN_FW		BIT(2)
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define WOW_MAX_FILTERS_PER_LIST 16
588c2ecf20Sopenharmony_ci#define WOW_PATTERN_SIZE 256
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/* Receive Frame Types */
618c2ecf20Sopenharmony_ci#define RSI_RX_DESC_MSG_TYPE_OFFSET	2
628c2ecf20Sopenharmony_ci#define TA_CONFIRM_TYPE                 0x01
638c2ecf20Sopenharmony_ci#define RX_DOT11_MGMT                   0x02
648c2ecf20Sopenharmony_ci#define TX_STATUS_IND                   0x04
658c2ecf20Sopenharmony_ci#define BEACON_EVENT_IND		0x08
668c2ecf20Sopenharmony_ci#define EAPOL4_CONFIRM                  1
678c2ecf20Sopenharmony_ci#define PROBEREQ_CONFIRM                2
688c2ecf20Sopenharmony_ci#define CARD_READY_IND                  0x00
698c2ecf20Sopenharmony_ci#define SLEEP_NOTIFY_IND                0x06
708c2ecf20Sopenharmony_ci#define RSI_TX_STATUS_TYPE		15
718c2ecf20Sopenharmony_ci#define RSI_TX_STATUS			12
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define RSI_DELETE_PEER                 0x0
748c2ecf20Sopenharmony_ci#define RSI_ADD_PEER                    0x1
758c2ecf20Sopenharmony_ci#define START_AMPDU_AGGR                0x1
768c2ecf20Sopenharmony_ci#define STOP_AMPDU_AGGR                 0x0
778c2ecf20Sopenharmony_ci#define INTERNAL_MGMT_PKT               0x99
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#define PUT_BBP_RESET                   0
808c2ecf20Sopenharmony_ci#define BBP_REG_WRITE                   0
818c2ecf20Sopenharmony_ci#define RF_RESET_ENABLE                 BIT(3)
828c2ecf20Sopenharmony_ci#define RATE_INFO_ENABLE                BIT(0)
838c2ecf20Sopenharmony_ci#define MORE_DATA_PRESENT		BIT(1)
848c2ecf20Sopenharmony_ci#define RSI_BROADCAST_PKT               BIT(9)
858c2ecf20Sopenharmony_ci#define RSI_DESC_REQUIRE_CFM_TO_HOST	BIT(2)
868c2ecf20Sopenharmony_ci#define RSI_ADD_DELTA_TSF_VAP_ID	BIT(3)
878c2ecf20Sopenharmony_ci#define RSI_FETCH_RETRY_CNT_FRM_HST	BIT(4)
888c2ecf20Sopenharmony_ci#define RSI_QOS_ENABLE			BIT(12)
898c2ecf20Sopenharmony_ci#define RSI_REKEY_PURPOSE		BIT(13)
908c2ecf20Sopenharmony_ci#define RSI_ENCRYPT_PKT			BIT(15)
918c2ecf20Sopenharmony_ci#define RSI_SET_PS_ENABLE		BIT(12)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define RSI_CMDDESC_40MHZ		BIT(4)
948c2ecf20Sopenharmony_ci#define RSI_CMDDESC_UPPER_20_ENABLE	BIT(5)
958c2ecf20Sopenharmony_ci#define RSI_CMDDESC_LOWER_20_ENABLE	BIT(6)
968c2ecf20Sopenharmony_ci#define RSI_CMDDESC_FULL_40_ENABLE	(BIT(5) | BIT(6))
978c2ecf20Sopenharmony_ci#define UPPER_20_ENABLE                 (0x2 << 12)
988c2ecf20Sopenharmony_ci#define LOWER_20_ENABLE                 (0x4 << 12)
998c2ecf20Sopenharmony_ci#define FULL40M_ENABLE                  0x6
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci#define RSI_LMAC_CLOCK_80MHZ            0x1
1028c2ecf20Sopenharmony_ci#define RSI_ENABLE_40MHZ                (0x1 << 3)
1038c2ecf20Sopenharmony_ci#define ENABLE_SHORTGI_RATE		BIT(9)
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci#define RX_BA_INDICATION                1
1068c2ecf20Sopenharmony_ci#define RSI_TBL_SZ                      40
1078c2ecf20Sopenharmony_ci#define MAX_RETRIES                     8
1088c2ecf20Sopenharmony_ci#define RSI_IFTYPE_STATION		 0
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#define STD_RATE_MCS7                   0x07
1118c2ecf20Sopenharmony_ci#define STD_RATE_MCS6                   0x06
1128c2ecf20Sopenharmony_ci#define STD_RATE_MCS5                   0x05
1138c2ecf20Sopenharmony_ci#define STD_RATE_MCS4                   0x04
1148c2ecf20Sopenharmony_ci#define STD_RATE_MCS3                   0x03
1158c2ecf20Sopenharmony_ci#define STD_RATE_MCS2                   0x02
1168c2ecf20Sopenharmony_ci#define STD_RATE_MCS1                   0x01
1178c2ecf20Sopenharmony_ci#define STD_RATE_MCS0                   0x00
1188c2ecf20Sopenharmony_ci#define STD_RATE_54                     0x6c
1198c2ecf20Sopenharmony_ci#define STD_RATE_48                     0x60
1208c2ecf20Sopenharmony_ci#define STD_RATE_36                     0x48
1218c2ecf20Sopenharmony_ci#define STD_RATE_24                     0x30
1228c2ecf20Sopenharmony_ci#define STD_RATE_18                     0x24
1238c2ecf20Sopenharmony_ci#define STD_RATE_12                     0x18
1248c2ecf20Sopenharmony_ci#define STD_RATE_11                     0x16
1258c2ecf20Sopenharmony_ci#define STD_RATE_09                     0x12
1268c2ecf20Sopenharmony_ci#define STD_RATE_06                     0x0C
1278c2ecf20Sopenharmony_ci#define STD_RATE_5_5                    0x0B
1288c2ecf20Sopenharmony_ci#define STD_RATE_02                     0x04
1298c2ecf20Sopenharmony_ci#define STD_RATE_01                     0x02
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci#define RSI_RF_TYPE                     1
1328c2ecf20Sopenharmony_ci#define RSI_RATE_00                     0x00
1338c2ecf20Sopenharmony_ci#define RSI_RATE_1                      0x0
1348c2ecf20Sopenharmony_ci#define RSI_RATE_2                      0x2
1358c2ecf20Sopenharmony_ci#define RSI_RATE_5_5                    0x4
1368c2ecf20Sopenharmony_ci#define RSI_RATE_11                     0x6
1378c2ecf20Sopenharmony_ci#define RSI_RATE_6                      0x8b
1388c2ecf20Sopenharmony_ci#define RSI_RATE_9                      0x8f
1398c2ecf20Sopenharmony_ci#define RSI_RATE_12                     0x8a
1408c2ecf20Sopenharmony_ci#define RSI_RATE_18                     0x8e
1418c2ecf20Sopenharmony_ci#define RSI_RATE_24                     0x89
1428c2ecf20Sopenharmony_ci#define RSI_RATE_36                     0x8d
1438c2ecf20Sopenharmony_ci#define RSI_RATE_48                     0x88
1448c2ecf20Sopenharmony_ci#define RSI_RATE_54                     0x8c
1458c2ecf20Sopenharmony_ci#define RSI_RATE_MCS0                   0x100
1468c2ecf20Sopenharmony_ci#define RSI_RATE_MCS1                   0x101
1478c2ecf20Sopenharmony_ci#define RSI_RATE_MCS2                   0x102
1488c2ecf20Sopenharmony_ci#define RSI_RATE_MCS3                   0x103
1498c2ecf20Sopenharmony_ci#define RSI_RATE_MCS4                   0x104
1508c2ecf20Sopenharmony_ci#define RSI_RATE_MCS5                   0x105
1518c2ecf20Sopenharmony_ci#define RSI_RATE_MCS6                   0x106
1528c2ecf20Sopenharmony_ci#define RSI_RATE_MCS7                   0x107
1538c2ecf20Sopenharmony_ci#define RSI_RATE_MCS7_SG                0x307
1548c2ecf20Sopenharmony_ci#define RSI_RATE_AUTO			0xffff
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci#define BW_20MHZ                        0
1578c2ecf20Sopenharmony_ci#define BW_40MHZ                        1
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci#define EP_2GHZ_20MHZ			0
1608c2ecf20Sopenharmony_ci#define EP_2GHZ_40MHZ			1
1618c2ecf20Sopenharmony_ci#define EP_5GHZ_20MHZ			2
1628c2ecf20Sopenharmony_ci#define EP_5GHZ_40MHZ			3
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci#define SIFS_TX_11N_VALUE		580
1658c2ecf20Sopenharmony_ci#define SIFS_TX_11B_VALUE		346
1668c2ecf20Sopenharmony_ci#define SHORT_SLOT_VALUE		360
1678c2ecf20Sopenharmony_ci#define LONG_SLOT_VALUE			640
1688c2ecf20Sopenharmony_ci#define OFDM_ACK_TOUT_VALUE		2720
1698c2ecf20Sopenharmony_ci#define CCK_ACK_TOUT_VALUE		9440
1708c2ecf20Sopenharmony_ci#define LONG_PREAMBLE			0x0000
1718c2ecf20Sopenharmony_ci#define SHORT_PREAMBLE			0x0001
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci#define RSI_SUPP_FILTERS	(FIF_ALLMULTI | FIF_PROBE_REQ |\
1748c2ecf20Sopenharmony_ci				 FIF_BCN_PRBRESP_PROMISC)
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci#define ANTENNA_SEL_INT			0x02 /* RF_OUT_2 / Integerated */
1778c2ecf20Sopenharmony_ci#define ANTENNA_SEL_UFL			0x03 /* RF_OUT_1 / U.FL */
1788c2ecf20Sopenharmony_ci#define ANTENNA_MASK_VALUE		0x00ff
1798c2ecf20Sopenharmony_ci#define ANTENNA_SEL_TYPE		1
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/* Rx filter word definitions */
1828c2ecf20Sopenharmony_ci#define PROMISCOUS_MODE			BIT(0)
1838c2ecf20Sopenharmony_ci#define ALLOW_DATA_ASSOC_PEER		BIT(1)
1848c2ecf20Sopenharmony_ci#define ALLOW_MGMT_ASSOC_PEER		BIT(2)
1858c2ecf20Sopenharmony_ci#define ALLOW_CTRL_ASSOC_PEER		BIT(3)
1868c2ecf20Sopenharmony_ci#define DISALLOW_BEACONS		BIT(4)
1878c2ecf20Sopenharmony_ci#define ALLOW_CONN_PEER_MGMT_WHILE_BUF_FULL BIT(5)
1888c2ecf20Sopenharmony_ci#define DISALLOW_BROADCAST_DATA		BIT(6)
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci#define RSI_MPDU_DENSITY		0x8
1918c2ecf20Sopenharmony_ci#define RSI_CHAN_RADAR			BIT(7)
1928c2ecf20Sopenharmony_ci#define RSI_BEACON_INTERVAL		200
1938c2ecf20Sopenharmony_ci#define RSI_DTIM_COUNT			2
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci#define RSI_PS_DISABLE_IND		BIT(15)
1968c2ecf20Sopenharmony_ci#define RSI_PS_ENABLE			1
1978c2ecf20Sopenharmony_ci#define RSI_PS_DISABLE			0
1988c2ecf20Sopenharmony_ci#define RSI_DEEP_SLEEP			1
1998c2ecf20Sopenharmony_ci#define RSI_CONNECTED_SLEEP		2
2008c2ecf20Sopenharmony_ci#define RSI_SLEEP_REQUEST		1
2018c2ecf20Sopenharmony_ci#define RSI_WAKEUP_REQUEST		2
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci#define RSI_IEEE80211_UAPSD_QUEUES \
2048c2ecf20Sopenharmony_ci	(IEEE80211_WMM_IE_STA_QOSINFO_AC_VO | \
2058c2ecf20Sopenharmony_ci	 IEEE80211_WMM_IE_STA_QOSINFO_AC_VI | \
2068c2ecf20Sopenharmony_ci	 IEEE80211_WMM_IE_STA_QOSINFO_AC_BE | \
2078c2ecf20Sopenharmony_ci	 IEEE80211_WMM_IE_STA_QOSINFO_AC_BK)
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci#define RSI_DESC_VAP_ID_MASK		0xC000u
2108c2ecf20Sopenharmony_ci#define RSI_DESC_VAP_ID_OFST		14
2118c2ecf20Sopenharmony_ci#define RSI_DATA_DESC_MAC_BBP_INFO	BIT(0)
2128c2ecf20Sopenharmony_ci#define RSI_DATA_DESC_NO_ACK_IND	BIT(9)
2138c2ecf20Sopenharmony_ci#define RSI_DATA_DESC_QOS_EN		BIT(12)
2148c2ecf20Sopenharmony_ci#define RSI_DATA_DESC_NORMAL_FRAME	0x00
2158c2ecf20Sopenharmony_ci#define RSI_DATA_DESC_DTIM_BEACON_GATED_FRAME	BIT(10)
2168c2ecf20Sopenharmony_ci#define RSI_DATA_DESC_BEACON_FRAME	BIT(11)
2178c2ecf20Sopenharmony_ci#define RSI_DATA_DESC_DTIM_BEACON	(BIT(10) | BIT(11))
2188c2ecf20Sopenharmony_ci#define RSI_DATA_DESC_INSERT_TSF	BIT(15)
2198c2ecf20Sopenharmony_ci#define RSI_DATA_DESC_INSERT_SEQ_NO	BIT(2)
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci#ifdef CONFIG_PM
2228c2ecf20Sopenharmony_ci#define RSI_WOW_ANY			BIT(1)
2238c2ecf20Sopenharmony_ci#define RSI_WOW_GTK_REKEY		BIT(3)
2248c2ecf20Sopenharmony_ci#define RSI_WOW_MAGIC_PKT		BIT(4)
2258c2ecf20Sopenharmony_ci#define RSI_WOW_DISCONNECT		BIT(5)
2268c2ecf20Sopenharmony_ci#endif
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci#define RSI_MAX_TX_AGGR_FRMS		8
2298c2ecf20Sopenharmony_ci#define RSI_MAX_RX_AGGR_FRMS		8
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci#define RSI_MAX_SCAN_SSIDS		16
2328c2ecf20Sopenharmony_ci#define RSI_MAX_SCAN_IE_LEN		256
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_cienum opmode {
2358c2ecf20Sopenharmony_ci	RSI_OPMODE_UNSUPPORTED = -1,
2368c2ecf20Sopenharmony_ci	RSI_OPMODE_AP = 0,
2378c2ecf20Sopenharmony_ci	RSI_OPMODE_STA,
2388c2ecf20Sopenharmony_ci	RSI_OPMODE_P2P_GO,
2398c2ecf20Sopenharmony_ci	RSI_OPMODE_P2P_CLIENT
2408c2ecf20Sopenharmony_ci};
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_cienum vap_status {
2438c2ecf20Sopenharmony_ci	VAP_ADD = 1,
2448c2ecf20Sopenharmony_ci	VAP_DELETE = 2,
2458c2ecf20Sopenharmony_ci	VAP_UPDATE = 3
2468c2ecf20Sopenharmony_ci};
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_cienum peer_type {
2498c2ecf20Sopenharmony_ci	PEER_TYPE_AP,
2508c2ecf20Sopenharmony_ci	PEER_TYPE_STA,
2518c2ecf20Sopenharmony_ci};
2528c2ecf20Sopenharmony_ciextern struct ieee80211_rate rsi_rates[12];
2538c2ecf20Sopenharmony_ciextern const u16 rsi_mcsrates[8];
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_cienum sta_notify_events {
2568c2ecf20Sopenharmony_ci	STA_CONNECTED = 0,
2578c2ecf20Sopenharmony_ci	STA_DISCONNECTED,
2588c2ecf20Sopenharmony_ci	STA_TX_ADDBA_DONE,
2598c2ecf20Sopenharmony_ci	STA_TX_DELBA,
2608c2ecf20Sopenharmony_ci	STA_RX_ADDBA_DONE,
2618c2ecf20Sopenharmony_ci	STA_RX_DELBA
2628c2ecf20Sopenharmony_ci};
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci/* Send Frames Types */
2658c2ecf20Sopenharmony_cienum cmd_frame_type {
2668c2ecf20Sopenharmony_ci	TX_DOT11_MGMT,
2678c2ecf20Sopenharmony_ci	RESET_MAC_REQ,
2688c2ecf20Sopenharmony_ci	RADIO_CAPABILITIES,
2698c2ecf20Sopenharmony_ci	BB_PROG_VALUES_REQUEST,
2708c2ecf20Sopenharmony_ci	RF_PROG_VALUES_REQUEST,
2718c2ecf20Sopenharmony_ci	WAKEUP_SLEEP_REQUEST,
2728c2ecf20Sopenharmony_ci	SCAN_REQUEST,
2738c2ecf20Sopenharmony_ci	TSF_UPDATE,
2748c2ecf20Sopenharmony_ci	PEER_NOTIFY,
2758c2ecf20Sopenharmony_ci	BLOCK_HW_QUEUE,
2768c2ecf20Sopenharmony_ci	SET_KEY_REQ,
2778c2ecf20Sopenharmony_ci	AUTO_RATE_IND,
2788c2ecf20Sopenharmony_ci	BOOTUP_PARAMS_REQUEST,
2798c2ecf20Sopenharmony_ci	VAP_CAPABILITIES,
2808c2ecf20Sopenharmony_ci	EEPROM_READ,
2818c2ecf20Sopenharmony_ci	EEPROM_WRITE,
2828c2ecf20Sopenharmony_ci	GPIO_PIN_CONFIG ,
2838c2ecf20Sopenharmony_ci	SET_RX_FILTER,
2848c2ecf20Sopenharmony_ci	AMPDU_IND,
2858c2ecf20Sopenharmony_ci	STATS_REQUEST_FRAME,
2868c2ecf20Sopenharmony_ci	BB_BUF_PROG_VALUES_REQ,
2878c2ecf20Sopenharmony_ci	BBP_PROG_IN_TA,
2888c2ecf20Sopenharmony_ci	BG_SCAN_PARAMS,
2898c2ecf20Sopenharmony_ci	BG_SCAN_PROBE_REQ,
2908c2ecf20Sopenharmony_ci	CW_MODE_REQ,
2918c2ecf20Sopenharmony_ci	PER_CMD_PKT,
2928c2ecf20Sopenharmony_ci	ANT_SEL_FRAME = 0x20,
2938c2ecf20Sopenharmony_ci	VAP_DYNAMIC_UPDATE = 0x27,
2948c2ecf20Sopenharmony_ci	COMMON_DEV_CONFIG = 0x28,
2958c2ecf20Sopenharmony_ci	RADIO_PARAMS_UPDATE = 0x29,
2968c2ecf20Sopenharmony_ci	WOWLAN_CONFIG_PARAMS = 0x2B,
2978c2ecf20Sopenharmony_ci	FEATURES_ENABLE = 0x33,
2988c2ecf20Sopenharmony_ci	WOWLAN_WAKEUP_REASON = 0xc5
2998c2ecf20Sopenharmony_ci};
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_cistruct rsi_mac_frame {
3028c2ecf20Sopenharmony_ci	__le16 desc_word[8];
3038c2ecf20Sopenharmony_ci} __packed;
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci#define PWR_SAVE_WAKEUP_IND		BIT(0)
3068c2ecf20Sopenharmony_ci#define TCP_CHECK_SUM_OFFLOAD		BIT(1)
3078c2ecf20Sopenharmony_ci#define CONFIRM_REQUIRED_TO_HOST	BIT(2)
3088c2ecf20Sopenharmony_ci#define ADD_DELTA_TSF			BIT(3)
3098c2ecf20Sopenharmony_ci#define FETCH_RETRY_CNT_FROM_HOST_DESC	BIT(4)
3108c2ecf20Sopenharmony_ci#define EOSP_INDICATION			BIT(5)
3118c2ecf20Sopenharmony_ci#define REQUIRE_TSF_SYNC_CONFIRM	BIT(6)
3128c2ecf20Sopenharmony_ci#define ENCAP_MGMT_PKT			BIT(7)
3138c2ecf20Sopenharmony_ci#define DESC_IMMEDIATE_WAKEUP		BIT(15)
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_cistruct rsi_xtended_desc {
3168c2ecf20Sopenharmony_ci	u8 confirm_frame_type;
3178c2ecf20Sopenharmony_ci	u8 retry_cnt;
3188c2ecf20Sopenharmony_ci	u16 reserved;
3198c2ecf20Sopenharmony_ci};
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_cistruct rsi_cmd_desc_dword0 {
3228c2ecf20Sopenharmony_ci	__le16 len_qno;
3238c2ecf20Sopenharmony_ci	u8 frame_type;
3248c2ecf20Sopenharmony_ci	u8 misc_flags;
3258c2ecf20Sopenharmony_ci};
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_cistruct rsi_cmd_desc_dword1 {
3288c2ecf20Sopenharmony_ci	u8 xtend_desc_size;
3298c2ecf20Sopenharmony_ci	u8 reserved1;
3308c2ecf20Sopenharmony_ci	__le16 reserved2;
3318c2ecf20Sopenharmony_ci};
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_cistruct rsi_cmd_desc_dword2 {
3348c2ecf20Sopenharmony_ci	__le32 pkt_info; /* Packet specific data */
3358c2ecf20Sopenharmony_ci};
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_cistruct rsi_cmd_desc_dword3 {
3388c2ecf20Sopenharmony_ci	__le16 token;
3398c2ecf20Sopenharmony_ci	u8 qid_tid;
3408c2ecf20Sopenharmony_ci	u8 sta_id;
3418c2ecf20Sopenharmony_ci};
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_cistruct rsi_cmd_desc {
3448c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
3458c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword1 desc_dword1;
3468c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword2 desc_dword2;
3478c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword3 desc_dword3;
3488c2ecf20Sopenharmony_ci};
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_cistruct rsi_boot_params {
3518c2ecf20Sopenharmony_ci	__le16 desc_word[8];
3528c2ecf20Sopenharmony_ci	struct bootup_params bootup_params;
3538c2ecf20Sopenharmony_ci} __packed;
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_cistruct rsi_boot_params_9116 {
3568c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
3578c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword1 desc_dword1;
3588c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword2 desc_dword2;
3598c2ecf20Sopenharmony_ci	__le16 reserved;
3608c2ecf20Sopenharmony_ci	__le16 umac_clk;
3618c2ecf20Sopenharmony_ci	struct bootup_params_9116 bootup_params;
3628c2ecf20Sopenharmony_ci} __packed;
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_cistruct rsi_peer_notify {
3658c2ecf20Sopenharmony_ci	struct rsi_cmd_desc desc;
3668c2ecf20Sopenharmony_ci	u8 mac_addr[6];
3678c2ecf20Sopenharmony_ci	__le16 command;
3688c2ecf20Sopenharmony_ci	__le16 mpdu_density;
3698c2ecf20Sopenharmony_ci	__le16 reserved;
3708c2ecf20Sopenharmony_ci	__le32 sta_flags;
3718c2ecf20Sopenharmony_ci} __packed;
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci/* Aggregation params flags */
3748c2ecf20Sopenharmony_ci#define RSI_AGGR_PARAMS_TID_MASK	0xf
3758c2ecf20Sopenharmony_ci#define RSI_AGGR_PARAMS_START		BIT(4)
3768c2ecf20Sopenharmony_ci#define RSI_AGGR_PARAMS_RX_AGGR		BIT(5)
3778c2ecf20Sopenharmony_cistruct rsi_aggr_params {
3788c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
3798c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword1;
3808c2ecf20Sopenharmony_ci	__le16 seq_start;
3818c2ecf20Sopenharmony_ci	__le16 baw_size;
3828c2ecf20Sopenharmony_ci	__le16 token;
3838c2ecf20Sopenharmony_ci	u8 aggr_params;
3848c2ecf20Sopenharmony_ci	u8 peer_id;
3858c2ecf20Sopenharmony_ci} __packed;
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_cistruct rsi_bb_rf_prog {
3888c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
3898c2ecf20Sopenharmony_ci	__le16 reserved1;
3908c2ecf20Sopenharmony_ci	u8 rf_power_mode;
3918c2ecf20Sopenharmony_ci	u8 reserved2;
3928c2ecf20Sopenharmony_ci	u8 endpoint;
3938c2ecf20Sopenharmony_ci	u8 reserved3;
3948c2ecf20Sopenharmony_ci	__le16 reserved4;
3958c2ecf20Sopenharmony_ci	__le16 reserved5;
3968c2ecf20Sopenharmony_ci	__le16 flags;
3978c2ecf20Sopenharmony_ci} __packed;
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_cistruct rsi_chan_config {
4008c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
4018c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword1 desc_dword1;
4028c2ecf20Sopenharmony_ci	u8 channel_number;
4038c2ecf20Sopenharmony_ci	u8 antenna_gain_offset_2g;
4048c2ecf20Sopenharmony_ci	u8 antenna_gain_offset_5g;
4058c2ecf20Sopenharmony_ci	u8 channel_width;
4068c2ecf20Sopenharmony_ci	__le16 tx_power;
4078c2ecf20Sopenharmony_ci	u8 region_rftype;
4088c2ecf20Sopenharmony_ci	u8 flags;
4098c2ecf20Sopenharmony_ci} __packed;
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_cistruct rsi_vap_caps {
4128c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
4138c2ecf20Sopenharmony_ci	u8 reserved1;
4148c2ecf20Sopenharmony_ci	u8 status;
4158c2ecf20Sopenharmony_ci	__le16 reserved2;
4168c2ecf20Sopenharmony_ci	u8 vif_type;
4178c2ecf20Sopenharmony_ci	u8 channel_bw;
4188c2ecf20Sopenharmony_ci	__le16 antenna_info;
4198c2ecf20Sopenharmony_ci	__le16 token;
4208c2ecf20Sopenharmony_ci	u8 radioid_macid;
4218c2ecf20Sopenharmony_ci	u8 vap_id;
4228c2ecf20Sopenharmony_ci	u8 mac_addr[6];
4238c2ecf20Sopenharmony_ci	__le16 keep_alive_period;
4248c2ecf20Sopenharmony_ci	u8 bssid[6];
4258c2ecf20Sopenharmony_ci	__le16 reserved4;
4268c2ecf20Sopenharmony_ci	__le32 flags;
4278c2ecf20Sopenharmony_ci	__le16 frag_threshold;
4288c2ecf20Sopenharmony_ci	__le16 rts_threshold;
4298c2ecf20Sopenharmony_ci	__le32 default_mgmt_rate;
4308c2ecf20Sopenharmony_ci	__le16 default_ctrl_rate;
4318c2ecf20Sopenharmony_ci	__le16 ctrl_rate_flags;
4328c2ecf20Sopenharmony_ci	__le32 default_data_rate;
4338c2ecf20Sopenharmony_ci	__le16 beacon_interval;
4348c2ecf20Sopenharmony_ci	__le16 dtim_period;
4358c2ecf20Sopenharmony_ci	__le16 beacon_miss_threshold;
4368c2ecf20Sopenharmony_ci} __packed;
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_cistruct rsi_ant_sel_frame {
4398c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
4408c2ecf20Sopenharmony_ci	u8 reserved;
4418c2ecf20Sopenharmony_ci	u8 sub_frame_type;
4428c2ecf20Sopenharmony_ci	__le16 ant_value;
4438c2ecf20Sopenharmony_ci	__le32 reserved1;
4448c2ecf20Sopenharmony_ci	__le32 reserved2;
4458c2ecf20Sopenharmony_ci} __packed;
4468c2ecf20Sopenharmony_ci
4478c2ecf20Sopenharmony_cistruct rsi_dynamic_s {
4488c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
4498c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword1 desc_dword1;
4508c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword2 desc_dword2;
4518c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword3 desc_dword3;
4528c2ecf20Sopenharmony_ci	struct framebody {
4538c2ecf20Sopenharmony_ci		__le16 data_rate;
4548c2ecf20Sopenharmony_ci		__le16 mgmt_rate;
4558c2ecf20Sopenharmony_ci		__le16 keep_alive_period;
4568c2ecf20Sopenharmony_ci	} frame_body;
4578c2ecf20Sopenharmony_ci} __packed;
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_ci/* Key descriptor flags */
4608c2ecf20Sopenharmony_ci#define RSI_KEY_TYPE_BROADCAST	BIT(1)
4618c2ecf20Sopenharmony_ci#define RSI_WEP_KEY		BIT(2)
4628c2ecf20Sopenharmony_ci#define RSI_WEP_KEY_104		BIT(3)
4638c2ecf20Sopenharmony_ci#define RSI_CIPHER_WPA		BIT(4)
4648c2ecf20Sopenharmony_ci#define RSI_CIPHER_TKIP		BIT(5)
4658c2ecf20Sopenharmony_ci#define RSI_KEY_MODE_AP		BIT(7)
4668c2ecf20Sopenharmony_ci#define RSI_PROTECT_DATA_FRAMES	BIT(13)
4678c2ecf20Sopenharmony_ci#define RSI_KEY_ID_MASK		0xC0
4688c2ecf20Sopenharmony_ci#define RSI_KEY_ID_OFFSET	14
4698c2ecf20Sopenharmony_cistruct rsi_set_key {
4708c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
4718c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword1 desc_dword1;
4728c2ecf20Sopenharmony_ci	__le16 key_desc;
4738c2ecf20Sopenharmony_ci	__le32 bpn;
4748c2ecf20Sopenharmony_ci	u8 sta_id;
4758c2ecf20Sopenharmony_ci	u8 vap_id;
4768c2ecf20Sopenharmony_ci	u8 key[4][32];
4778c2ecf20Sopenharmony_ci	u8 tx_mic_key[8];
4788c2ecf20Sopenharmony_ci	u8 rx_mic_key[8];
4798c2ecf20Sopenharmony_ci} __packed;
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_cistruct rsi_auto_rate {
4828c2ecf20Sopenharmony_ci	struct rsi_cmd_desc desc;
4838c2ecf20Sopenharmony_ci	__le16 failure_limit;
4848c2ecf20Sopenharmony_ci	__le16 initial_boundary;
4858c2ecf20Sopenharmony_ci	__le16 max_threshold_limt;
4868c2ecf20Sopenharmony_ci	__le16 num_supported_rates;
4878c2ecf20Sopenharmony_ci	__le16 aarf_rssi;
4888c2ecf20Sopenharmony_ci	__le16 moderate_rate_inx;
4898c2ecf20Sopenharmony_ci	__le16 collision_tolerance;
4908c2ecf20Sopenharmony_ci	__le16 supported_rates[40];
4918c2ecf20Sopenharmony_ci} __packed;
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ci#define QUIET_INFO_VALID	BIT(0)
4948c2ecf20Sopenharmony_ci#define QUIET_ENABLE		BIT(1)
4958c2ecf20Sopenharmony_cistruct rsi_block_unblock_data {
4968c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
4978c2ecf20Sopenharmony_ci	u8 xtend_desc_size;
4988c2ecf20Sopenharmony_ci	u8 host_quiet_info;
4998c2ecf20Sopenharmony_ci	__le16 reserved;
5008c2ecf20Sopenharmony_ci	__le16 block_q_bitmap;
5018c2ecf20Sopenharmony_ci	__le16 unblock_q_bitmap;
5028c2ecf20Sopenharmony_ci	__le16 token;
5038c2ecf20Sopenharmony_ci	__le16 flush_q_bitmap;
5048c2ecf20Sopenharmony_ci} __packed;
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_cistruct qos_params {
5078c2ecf20Sopenharmony_ci	__le16 cont_win_min_q;
5088c2ecf20Sopenharmony_ci	__le16 cont_win_max_q;
5098c2ecf20Sopenharmony_ci	__le16 aifsn_val_q;
5108c2ecf20Sopenharmony_ci	__le16 txop_q;
5118c2ecf20Sopenharmony_ci} __packed;
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_cistruct rsi_radio_caps {
5148c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
5158c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword1;
5168c2ecf20Sopenharmony_ci	u8 channel_num;
5178c2ecf20Sopenharmony_ci	u8 rf_model;
5188c2ecf20Sopenharmony_ci	__le16 ppe_ack_rate;
5198c2ecf20Sopenharmony_ci	__le16 mode_11j;
5208c2ecf20Sopenharmony_ci	u8 radio_cfg_info;
5218c2ecf20Sopenharmony_ci	u8 radio_info;
5228c2ecf20Sopenharmony_ci	struct qos_params qos_params[MAX_HW_QUEUES];
5238c2ecf20Sopenharmony_ci	u8 num_11n_rates;
5248c2ecf20Sopenharmony_ci	u8 num_11ac_rates;
5258c2ecf20Sopenharmony_ci	__le16 gcpd_per_rate[20];
5268c2ecf20Sopenharmony_ci	__le16 sifs_tx_11n;
5278c2ecf20Sopenharmony_ci	__le16 sifs_tx_11b;
5288c2ecf20Sopenharmony_ci	__le16 slot_rx_11n;
5298c2ecf20Sopenharmony_ci	__le16 ofdm_ack_tout;
5308c2ecf20Sopenharmony_ci	__le16 cck_ack_tout;
5318c2ecf20Sopenharmony_ci	__le16 preamble_type;
5328c2ecf20Sopenharmony_ci} __packed;
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_ci/* ULP GPIO flags */
5358c2ecf20Sopenharmony_ci#define RSI_GPIO_MOTION_SENSOR_ULP_WAKEUP	BIT(0)
5368c2ecf20Sopenharmony_ci#define RSI_GPIO_SLEEP_IND_FROM_DEVICE		BIT(1)
5378c2ecf20Sopenharmony_ci#define RSI_GPIO_2_ULP				BIT(2)
5388c2ecf20Sopenharmony_ci#define RSI_GPIO_PUSH_BUTTON_ULP_WAKEUP		BIT(3)
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_ci/* SOC GPIO flags */
5418c2ecf20Sopenharmony_ci#define RSI_GPIO_0_PSPI_CSN_0			BIT(0)
5428c2ecf20Sopenharmony_ci#define RSI_GPIO_1_PSPI_CSN_1			BIT(1)
5438c2ecf20Sopenharmony_ci#define RSI_GPIO_2_HOST_WAKEUP_INTR		BIT(2)
5448c2ecf20Sopenharmony_ci#define RSI_GPIO_3_PSPI_DATA_0			BIT(3)
5458c2ecf20Sopenharmony_ci#define RSI_GPIO_4_PSPI_DATA_1			BIT(4)
5468c2ecf20Sopenharmony_ci#define RSI_GPIO_5_PSPI_DATA_2			BIT(5)
5478c2ecf20Sopenharmony_ci#define RSI_GPIO_6_PSPI_DATA_3			BIT(6)
5488c2ecf20Sopenharmony_ci#define RSI_GPIO_7_I2C_SCL			BIT(7)
5498c2ecf20Sopenharmony_ci#define RSI_GPIO_8_I2C_SDA			BIT(8)
5508c2ecf20Sopenharmony_ci#define RSI_GPIO_9_UART1_RX			BIT(9)
5518c2ecf20Sopenharmony_ci#define RSI_GPIO_10_UART1_TX			BIT(10)
5528c2ecf20Sopenharmony_ci#define RSI_GPIO_11_UART1_RTS_I2S_CLK		BIT(11)
5538c2ecf20Sopenharmony_ci#define RSI_GPIO_12_UART1_CTS_I2S_WS		BIT(12)
5548c2ecf20Sopenharmony_ci#define RSI_GPIO_13_DBG_UART_RX_I2S_DIN		BIT(13)
5558c2ecf20Sopenharmony_ci#define RSI_GPIO_14_DBG_UART_RX_I2S_DOUT	BIT(14)
5568c2ecf20Sopenharmony_ci#define RSI_GPIO_15_LP_WAKEUP_BOOT_BYPASS	BIT(15)
5578c2ecf20Sopenharmony_ci#define RSI_GPIO_16_LED_0			BIT(16)
5588c2ecf20Sopenharmony_ci#define RSI_GPIO_17_BTCOEX_WLAN_ACT_EXT_ANT_SEL	BIT(17)
5598c2ecf20Sopenharmony_ci#define RSI_GPIO_18_BTCOEX_BT_PRIO_EXT_ANT_SEL	BIT(18)
5608c2ecf20Sopenharmony_ci#define RSI_GPIO_19_BTCOEX_BT_ACT_EXT_ON_OFF	BIT(19)
5618c2ecf20Sopenharmony_ci#define RSI_GPIO_20_RF_RESET			BIT(20)
5628c2ecf20Sopenharmony_ci#define RSI_GPIO_21_SLEEP_IND_FROM_DEVICE	BIT(21)
5638c2ecf20Sopenharmony_ci
5648c2ecf20Sopenharmony_ci#define RSI_UNUSED_SOC_GPIO_BITMAP (RSI_GPIO_9_UART1_RX | \
5658c2ecf20Sopenharmony_ci				    RSI_GPIO_10_UART1_TX | \
5668c2ecf20Sopenharmony_ci				    RSI_GPIO_11_UART1_RTS_I2S_CLK | \
5678c2ecf20Sopenharmony_ci				    RSI_GPIO_12_UART1_CTS_I2S_WS | \
5688c2ecf20Sopenharmony_ci				    RSI_GPIO_13_DBG_UART_RX_I2S_DIN | \
5698c2ecf20Sopenharmony_ci				    RSI_GPIO_14_DBG_UART_RX_I2S_DOUT | \
5708c2ecf20Sopenharmony_ci				    RSI_GPIO_15_LP_WAKEUP_BOOT_BYPASS | \
5718c2ecf20Sopenharmony_ci				    RSI_GPIO_17_BTCOEX_WLAN_ACT_EXT_ANT_SEL | \
5728c2ecf20Sopenharmony_ci				    RSI_GPIO_18_BTCOEX_BT_PRIO_EXT_ANT_SEL | \
5738c2ecf20Sopenharmony_ci				    RSI_GPIO_19_BTCOEX_BT_ACT_EXT_ON_OFF | \
5748c2ecf20Sopenharmony_ci				    RSI_GPIO_21_SLEEP_IND_FROM_DEVICE)
5758c2ecf20Sopenharmony_ci
5768c2ecf20Sopenharmony_ci#define RSI_UNUSED_ULP_GPIO_BITMAP (RSI_GPIO_MOTION_SENSOR_ULP_WAKEUP | \
5778c2ecf20Sopenharmony_ci				    RSI_GPIO_SLEEP_IND_FROM_DEVICE | \
5788c2ecf20Sopenharmony_ci				    RSI_GPIO_2_ULP | \
5798c2ecf20Sopenharmony_ci				    RSI_GPIO_PUSH_BUTTON_ULP_WAKEUP);
5808c2ecf20Sopenharmony_cistruct rsi_config_vals {
5818c2ecf20Sopenharmony_ci	__le16 len_qno;
5828c2ecf20Sopenharmony_ci	u8 pkt_type;
5838c2ecf20Sopenharmony_ci	u8 misc_flags;
5848c2ecf20Sopenharmony_ci	__le16 reserved1[6];
5858c2ecf20Sopenharmony_ci	u8 lp_ps_handshake;
5868c2ecf20Sopenharmony_ci	u8 ulp_ps_handshake;
5878c2ecf20Sopenharmony_ci	u8 sleep_config_params; /* 0 for no handshake,
5888c2ecf20Sopenharmony_ci				 * 1 for GPIO based handshake,
5898c2ecf20Sopenharmony_ci				 * 2 packet handshake
5908c2ecf20Sopenharmony_ci				 */
5918c2ecf20Sopenharmony_ci	u8 unused_ulp_gpio;
5928c2ecf20Sopenharmony_ci	__le32 unused_soc_gpio_bitmap;
5938c2ecf20Sopenharmony_ci	u8 ext_pa_or_bt_coex_en;
5948c2ecf20Sopenharmony_ci	u8 opermode;
5958c2ecf20Sopenharmony_ci	u8 wlan_rf_pwr_mode;
5968c2ecf20Sopenharmony_ci	u8 bt_rf_pwr_mode;
5978c2ecf20Sopenharmony_ci	u8 zigbee_rf_pwr_mode;
5988c2ecf20Sopenharmony_ci	u8 driver_mode;
5998c2ecf20Sopenharmony_ci	u8 region_code;
6008c2ecf20Sopenharmony_ci	u8 antenna_sel_val;
6018c2ecf20Sopenharmony_ci	u8 reserved2[16];
6028c2ecf20Sopenharmony_ci} __packed;
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci/* Packet info flags */
6058c2ecf20Sopenharmony_ci#define RSI_EEPROM_HDR_SIZE_OFFSET		8
6068c2ecf20Sopenharmony_ci#define RSI_EEPROM_HDR_SIZE_MASK		0x300
6078c2ecf20Sopenharmony_ci#define RSI_EEPROM_LEN_OFFSET			20
6088c2ecf20Sopenharmony_ci#define RSI_EEPROM_LEN_MASK			0xFFF00000
6098c2ecf20Sopenharmony_ci
6108c2ecf20Sopenharmony_cistruct rsi_eeprom_read_frame {
6118c2ecf20Sopenharmony_ci	__le16 len_qno;
6128c2ecf20Sopenharmony_ci	u8 pkt_type;
6138c2ecf20Sopenharmony_ci	u8 misc_flags;
6148c2ecf20Sopenharmony_ci	__le32 pkt_info;
6158c2ecf20Sopenharmony_ci	__le32 eeprom_offset;
6168c2ecf20Sopenharmony_ci	__le16 delay_ms;
6178c2ecf20Sopenharmony_ci	__le16 reserved3;
6188c2ecf20Sopenharmony_ci} __packed;
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_cistruct rsi_request_ps {
6218c2ecf20Sopenharmony_ci	struct rsi_cmd_desc desc;
6228c2ecf20Sopenharmony_ci	struct ps_sleep_params ps_sleep;
6238c2ecf20Sopenharmony_ci	u8 ps_mimic_support;
6248c2ecf20Sopenharmony_ci	u8 ps_uapsd_acs;
6258c2ecf20Sopenharmony_ci	u8 ps_uapsd_wakeup_period;
6268c2ecf20Sopenharmony_ci	u8 reserved;
6278c2ecf20Sopenharmony_ci	__le32 ps_listen_interval;
6288c2ecf20Sopenharmony_ci	__le32 ps_dtim_interval_duration;
6298c2ecf20Sopenharmony_ci	__le16 ps_num_dtim_intervals;
6308c2ecf20Sopenharmony_ci} __packed;
6318c2ecf20Sopenharmony_ci
6328c2ecf20Sopenharmony_cistruct rsi_wowlan_req {
6338c2ecf20Sopenharmony_ci	struct rsi_cmd_desc desc;
6348c2ecf20Sopenharmony_ci	u8 sourceid[ETH_ALEN];
6358c2ecf20Sopenharmony_ci	u16 wow_flags;
6368c2ecf20Sopenharmony_ci	u16 host_sleep_status;
6378c2ecf20Sopenharmony_ci} __packed;
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ci#define RSI_START_BGSCAN		1
6408c2ecf20Sopenharmony_ci#define RSI_STOP_BGSCAN			0
6418c2ecf20Sopenharmony_ci#define HOST_BG_SCAN_TRIG		BIT(4)
6428c2ecf20Sopenharmony_cistruct rsi_bgscan_config {
6438c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
6448c2ecf20Sopenharmony_ci	__le64 reserved;
6458c2ecf20Sopenharmony_ci	__le32 reserved1;
6468c2ecf20Sopenharmony_ci	__le16 bgscan_threshold;
6478c2ecf20Sopenharmony_ci	__le16 roam_threshold;
6488c2ecf20Sopenharmony_ci	__le16 bgscan_periodicity;
6498c2ecf20Sopenharmony_ci	u8 num_bgscan_channels;
6508c2ecf20Sopenharmony_ci	u8 two_probe;
6518c2ecf20Sopenharmony_ci	__le16 active_scan_duration;
6528c2ecf20Sopenharmony_ci	__le16 passive_scan_duration;
6538c2ecf20Sopenharmony_ci	__le16 channels2scan[MAX_BGSCAN_CHANNELS_DUAL_BAND];
6548c2ecf20Sopenharmony_ci} __packed;
6558c2ecf20Sopenharmony_ci
6568c2ecf20Sopenharmony_cistruct rsi_bgscan_probe {
6578c2ecf20Sopenharmony_ci	struct rsi_cmd_desc_dword0 desc_dword0;
6588c2ecf20Sopenharmony_ci	__le64 reserved;
6598c2ecf20Sopenharmony_ci	__le32 reserved1;
6608c2ecf20Sopenharmony_ci	__le16 mgmt_rate;
6618c2ecf20Sopenharmony_ci	__le16 flags;
6628c2ecf20Sopenharmony_ci	__le16 def_chan;
6638c2ecf20Sopenharmony_ci	__le16 channel_scan_time;
6648c2ecf20Sopenharmony_ci	__le16 probe_req_length;
6658c2ecf20Sopenharmony_ci} __packed;
6668c2ecf20Sopenharmony_ci
6678c2ecf20Sopenharmony_ci#define RSI_DUTY_CYCLING	BIT(0)
6688c2ecf20Sopenharmony_ci#define RSI_END_OF_FRAME	BIT(1)
6698c2ecf20Sopenharmony_ci#define RSI_SIFS_TX_ENABLE	BIT(2)
6708c2ecf20Sopenharmony_ci#define RSI_DPD			BIT(3)
6718c2ecf20Sopenharmony_cistruct rsi_wlan_9116_features {
6728c2ecf20Sopenharmony_ci	struct rsi_cmd_desc desc;
6738c2ecf20Sopenharmony_ci	u8 pll_mode;
6748c2ecf20Sopenharmony_ci	u8 rf_type;
6758c2ecf20Sopenharmony_ci	u8 wireless_mode;
6768c2ecf20Sopenharmony_ci	u8 enable_ppe;
6778c2ecf20Sopenharmony_ci	u8 afe_type;
6788c2ecf20Sopenharmony_ci	u8 reserved1;
6798c2ecf20Sopenharmony_ci	__le16 reserved2;
6808c2ecf20Sopenharmony_ci	__le32 feature_enable;
6818c2ecf20Sopenharmony_ci};
6828c2ecf20Sopenharmony_ci
6838c2ecf20Sopenharmony_cistatic inline u32 rsi_get_queueno(u8 *addr, u16 offset)
6848c2ecf20Sopenharmony_ci{
6858c2ecf20Sopenharmony_ci	return (le16_to_cpu(*(__le16 *)&addr[offset]) & 0x7000) >> 12;
6868c2ecf20Sopenharmony_ci}
6878c2ecf20Sopenharmony_ci
6888c2ecf20Sopenharmony_cistatic inline u32 rsi_get_length(u8 *addr, u16 offset)
6898c2ecf20Sopenharmony_ci{
6908c2ecf20Sopenharmony_ci	return (le16_to_cpu(*(__le16 *)&addr[offset])) & 0x0fff;
6918c2ecf20Sopenharmony_ci}
6928c2ecf20Sopenharmony_ci
6938c2ecf20Sopenharmony_cistatic inline u8 rsi_get_extended_desc(u8 *addr, u16 offset)
6948c2ecf20Sopenharmony_ci{
6958c2ecf20Sopenharmony_ci	return le16_to_cpu(*((__le16 *)&addr[offset + 4])) & 0x00ff;
6968c2ecf20Sopenharmony_ci}
6978c2ecf20Sopenharmony_ci
6988c2ecf20Sopenharmony_cistatic inline u8 rsi_get_rssi(u8 *addr)
6998c2ecf20Sopenharmony_ci{
7008c2ecf20Sopenharmony_ci	return *(u8 *)(addr + FRAME_DESC_SZ);
7018c2ecf20Sopenharmony_ci}
7028c2ecf20Sopenharmony_ci
7038c2ecf20Sopenharmony_cistatic inline u8 rsi_get_channel(u8 *addr)
7048c2ecf20Sopenharmony_ci{
7058c2ecf20Sopenharmony_ci	return *(char *)(addr + 15);
7068c2ecf20Sopenharmony_ci}
7078c2ecf20Sopenharmony_ci
7088c2ecf20Sopenharmony_cistatic inline void rsi_set_len_qno(__le16 *addr, u16 len, u8 qno)
7098c2ecf20Sopenharmony_ci{
7108c2ecf20Sopenharmony_ci	*addr = cpu_to_le16(len | ((qno & 7) << 12));
7118c2ecf20Sopenharmony_ci}
7128c2ecf20Sopenharmony_ci
7138c2ecf20Sopenharmony_ciint rsi_handle_card_ready(struct rsi_common *common, u8 *msg);
7148c2ecf20Sopenharmony_ciint rsi_mgmt_pkt_recv(struct rsi_common *common, u8 *msg);
7158c2ecf20Sopenharmony_ciint rsi_set_vap_capabilities(struct rsi_common *common, enum opmode mode,
7168c2ecf20Sopenharmony_ci			     u8 *mac_addr, u8 vap_id, u8 vap_status);
7178c2ecf20Sopenharmony_ciint rsi_send_aggregation_params_frame(struct rsi_common *common, u16 tid,
7188c2ecf20Sopenharmony_ci				      u16 ssn, u8 buf_size, u8 event,
7198c2ecf20Sopenharmony_ci				      u8 sta_id);
7208c2ecf20Sopenharmony_ciint rsi_hal_load_key(struct rsi_common *common, u8 *data, u16 key_len,
7218c2ecf20Sopenharmony_ci		     u8 key_type, u8 key_id, u32 cipher, s16 sta_id,
7228c2ecf20Sopenharmony_ci		     struct ieee80211_vif *vif);
7238c2ecf20Sopenharmony_ciint rsi_set_channel(struct rsi_common *common,
7248c2ecf20Sopenharmony_ci		    struct ieee80211_channel *channel);
7258c2ecf20Sopenharmony_ciint rsi_send_vap_dynamic_update(struct rsi_common *common);
7268c2ecf20Sopenharmony_ciint rsi_send_block_unblock_frame(struct rsi_common *common, bool event);
7278c2ecf20Sopenharmony_ciint rsi_hal_send_sta_notify_frame(struct rsi_common *common, enum opmode opmode,
7288c2ecf20Sopenharmony_ci				  u8 notify_event, const unsigned char *bssid,
7298c2ecf20Sopenharmony_ci				  u8 qos_enable, u16 aid, u16 sta_id,
7308c2ecf20Sopenharmony_ci				  struct ieee80211_vif *vif);
7318c2ecf20Sopenharmony_civoid rsi_inform_bss_status(struct rsi_common *common, enum opmode opmode,
7328c2ecf20Sopenharmony_ci			   u8 status, const u8 *addr, u8 qos_enable, u16 aid,
7338c2ecf20Sopenharmony_ci			   struct ieee80211_sta *sta, u16 sta_id,
7348c2ecf20Sopenharmony_ci			   u16 assoc_cap, struct ieee80211_vif *vif);
7358c2ecf20Sopenharmony_civoid rsi_indicate_pkt_to_os(struct rsi_common *common, struct sk_buff *skb);
7368c2ecf20Sopenharmony_ciint rsi_mac80211_attach(struct rsi_common *common);
7378c2ecf20Sopenharmony_civoid rsi_indicate_tx_status(struct rsi_hw *common, struct sk_buff *skb,
7388c2ecf20Sopenharmony_ci			    int status);
7398c2ecf20Sopenharmony_cibool rsi_is_cipher_wep(struct rsi_common *common);
7408c2ecf20Sopenharmony_civoid rsi_core_qos_processor(struct rsi_common *common);
7418c2ecf20Sopenharmony_civoid rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb);
7428c2ecf20Sopenharmony_ciint rsi_send_mgmt_pkt(struct rsi_common *common, struct sk_buff *skb);
7438c2ecf20Sopenharmony_ciint rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb);
7448c2ecf20Sopenharmony_ciint rsi_band_check(struct rsi_common *common, struct ieee80211_channel *chan);
7458c2ecf20Sopenharmony_ciint rsi_send_rx_filter_frame(struct rsi_common *common, u16 rx_filter_word);
7468c2ecf20Sopenharmony_ciint rsi_send_radio_params_update(struct rsi_common *common);
7478c2ecf20Sopenharmony_ciint rsi_set_antenna(struct rsi_common *common, u8 antenna);
7488c2ecf20Sopenharmony_ci#ifdef CONFIG_PM
7498c2ecf20Sopenharmony_ciint rsi_send_wowlan_request(struct rsi_common *common, u16 flags,
7508c2ecf20Sopenharmony_ci			    u16 sleep_status);
7518c2ecf20Sopenharmony_ci#endif
7528c2ecf20Sopenharmony_ciint rsi_send_ps_request(struct rsi_hw *adapter, bool enable,
7538c2ecf20Sopenharmony_ci			struct ieee80211_vif *vif);
7548c2ecf20Sopenharmony_civoid init_bgscan_params(struct rsi_common *common);
7558c2ecf20Sopenharmony_ciint rsi_send_bgscan_params(struct rsi_common *common, int enable);
7568c2ecf20Sopenharmony_ciint rsi_send_bgscan_probe_req(struct rsi_common *common,
7578c2ecf20Sopenharmony_ci			      struct ieee80211_vif *vif);
7588c2ecf20Sopenharmony_ci#endif
759