162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright (c) 2014 Redpine Signals Inc. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 562306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 662306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 962306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1062306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1162306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1262306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1362306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1462306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1562306a36Sopenharmony_ci */ 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#ifndef __RSI_MGMT_H__ 1862306a36Sopenharmony_ci#define __RSI_MGMT_H__ 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#include <linux/sort.h> 2162306a36Sopenharmony_ci#include "rsi_boot_params.h" 2262306a36Sopenharmony_ci#include "rsi_main.h" 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#define MAX_MGMT_PKT_SIZE 512 2562306a36Sopenharmony_ci#define RSI_NEEDED_HEADROOM 84 2662306a36Sopenharmony_ci#define RSI_RCV_BUFFER_LEN 2000 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci#define RSI_11B_MODE 0 2962306a36Sopenharmony_ci#define RSI_11G_MODE BIT(7) 3062306a36Sopenharmony_ci#define RETRY_COUNT 8 3162306a36Sopenharmony_ci#define RETRY_LONG 4 3262306a36Sopenharmony_ci#define RETRY_SHORT 7 3362306a36Sopenharmony_ci#define WMM_SHORT_SLOT_TIME 9 3462306a36Sopenharmony_ci#define SIFS_DURATION 16 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#define EAPOL4_PACKET_LEN 0x85 3762306a36Sopenharmony_ci#define KEY_TYPE_CLEAR 0 3862306a36Sopenharmony_ci#define RSI_PAIRWISE_KEY 1 3962306a36Sopenharmony_ci#define RSI_GROUP_KEY 2 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci/* EPPROM_READ_ADDRESS */ 4262306a36Sopenharmony_ci#define WLAN_MAC_EEPROM_ADDR 40 4362306a36Sopenharmony_ci#define WLAN_MAC_MAGIC_WORD_LEN 0x01 4462306a36Sopenharmony_ci#define WLAN_HOST_MODE_LEN 0x04 4562306a36Sopenharmony_ci#define WLAN_FW_VERSION_LEN 0x08 4662306a36Sopenharmony_ci#define MAGIC_WORD 0x5A 4762306a36Sopenharmony_ci#define WLAN_EEPROM_RFTYPE_ADDR 424 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci/*WOWLAN RESUME WAKEUP TYPES*/ 5062306a36Sopenharmony_ci#define RSI_UNICAST_MAGIC_PKT BIT(0) 5162306a36Sopenharmony_ci#define RSI_BROADCAST_MAGICPKT BIT(1) 5262306a36Sopenharmony_ci#define RSI_EAPOL_PKT BIT(2) 5362306a36Sopenharmony_ci#define RSI_DISCONNECT_PKT BIT(3) 5462306a36Sopenharmony_ci#define RSI_HW_BMISS_PKT BIT(4) 5562306a36Sopenharmony_ci#define RSI_INSERT_SEQ_IN_FW BIT(2) 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci#define WOW_MAX_FILTERS_PER_LIST 16 5862306a36Sopenharmony_ci#define WOW_PATTERN_SIZE 256 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci/* Receive Frame Types */ 6162306a36Sopenharmony_ci#define RSI_RX_DESC_MSG_TYPE_OFFSET 2 6262306a36Sopenharmony_ci#define TA_CONFIRM_TYPE 0x01 6362306a36Sopenharmony_ci#define RX_DOT11_MGMT 0x02 6462306a36Sopenharmony_ci#define TX_STATUS_IND 0x04 6562306a36Sopenharmony_ci#define BEACON_EVENT_IND 0x08 6662306a36Sopenharmony_ci#define EAPOL4_CONFIRM 1 6762306a36Sopenharmony_ci#define PROBEREQ_CONFIRM 2 6862306a36Sopenharmony_ci#define CARD_READY_IND 0x00 6962306a36Sopenharmony_ci#define SLEEP_NOTIFY_IND 0x06 7062306a36Sopenharmony_ci#define RSI_TX_STATUS_TYPE 15 7162306a36Sopenharmony_ci#define RSI_TX_STATUS 12 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define RSI_DELETE_PEER 0x0 7462306a36Sopenharmony_ci#define RSI_ADD_PEER 0x1 7562306a36Sopenharmony_ci#define START_AMPDU_AGGR 0x1 7662306a36Sopenharmony_ci#define STOP_AMPDU_AGGR 0x0 7762306a36Sopenharmony_ci#define INTERNAL_MGMT_PKT 0x99 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci#define PUT_BBP_RESET 0 8062306a36Sopenharmony_ci#define BBP_REG_WRITE 0 8162306a36Sopenharmony_ci#define RF_RESET_ENABLE BIT(3) 8262306a36Sopenharmony_ci#define RATE_INFO_ENABLE BIT(0) 8362306a36Sopenharmony_ci#define MORE_DATA_PRESENT BIT(1) 8462306a36Sopenharmony_ci#define RSI_BROADCAST_PKT BIT(9) 8562306a36Sopenharmony_ci#define RSI_DESC_REQUIRE_CFM_TO_HOST BIT(2) 8662306a36Sopenharmony_ci#define RSI_ADD_DELTA_TSF_VAP_ID BIT(3) 8762306a36Sopenharmony_ci#define RSI_FETCH_RETRY_CNT_FRM_HST BIT(4) 8862306a36Sopenharmony_ci#define RSI_QOS_ENABLE BIT(12) 8962306a36Sopenharmony_ci#define RSI_REKEY_PURPOSE BIT(13) 9062306a36Sopenharmony_ci#define RSI_ENCRYPT_PKT BIT(15) 9162306a36Sopenharmony_ci#define RSI_SET_PS_ENABLE BIT(12) 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#define RSI_CMDDESC_40MHZ BIT(4) 9462306a36Sopenharmony_ci#define RSI_CMDDESC_UPPER_20_ENABLE BIT(5) 9562306a36Sopenharmony_ci#define RSI_CMDDESC_LOWER_20_ENABLE BIT(6) 9662306a36Sopenharmony_ci#define RSI_CMDDESC_FULL_40_ENABLE (BIT(5) | BIT(6)) 9762306a36Sopenharmony_ci#define UPPER_20_ENABLE (0x2 << 12) 9862306a36Sopenharmony_ci#define LOWER_20_ENABLE (0x4 << 12) 9962306a36Sopenharmony_ci#define FULL40M_ENABLE 0x6 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci#define RSI_LMAC_CLOCK_80MHZ 0x1 10262306a36Sopenharmony_ci#define RSI_ENABLE_40MHZ (0x1 << 3) 10362306a36Sopenharmony_ci#define ENABLE_SHORTGI_RATE BIT(9) 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci#define RX_BA_INDICATION 1 10662306a36Sopenharmony_ci#define RSI_TBL_SZ 40 10762306a36Sopenharmony_ci#define MAX_RETRIES 8 10862306a36Sopenharmony_ci#define RSI_IFTYPE_STATION 0 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci#define STD_RATE_MCS7 0x07 11162306a36Sopenharmony_ci#define STD_RATE_MCS6 0x06 11262306a36Sopenharmony_ci#define STD_RATE_MCS5 0x05 11362306a36Sopenharmony_ci#define STD_RATE_MCS4 0x04 11462306a36Sopenharmony_ci#define STD_RATE_MCS3 0x03 11562306a36Sopenharmony_ci#define STD_RATE_MCS2 0x02 11662306a36Sopenharmony_ci#define STD_RATE_MCS1 0x01 11762306a36Sopenharmony_ci#define STD_RATE_MCS0 0x00 11862306a36Sopenharmony_ci#define STD_RATE_54 0x6c 11962306a36Sopenharmony_ci#define STD_RATE_48 0x60 12062306a36Sopenharmony_ci#define STD_RATE_36 0x48 12162306a36Sopenharmony_ci#define STD_RATE_24 0x30 12262306a36Sopenharmony_ci#define STD_RATE_18 0x24 12362306a36Sopenharmony_ci#define STD_RATE_12 0x18 12462306a36Sopenharmony_ci#define STD_RATE_11 0x16 12562306a36Sopenharmony_ci#define STD_RATE_09 0x12 12662306a36Sopenharmony_ci#define STD_RATE_06 0x0C 12762306a36Sopenharmony_ci#define STD_RATE_5_5 0x0B 12862306a36Sopenharmony_ci#define STD_RATE_02 0x04 12962306a36Sopenharmony_ci#define STD_RATE_01 0x02 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci#define RSI_RF_TYPE 1 13262306a36Sopenharmony_ci#define RSI_RATE_00 0x00 13362306a36Sopenharmony_ci#define RSI_RATE_1 0x0 13462306a36Sopenharmony_ci#define RSI_RATE_2 0x2 13562306a36Sopenharmony_ci#define RSI_RATE_5_5 0x4 13662306a36Sopenharmony_ci#define RSI_RATE_11 0x6 13762306a36Sopenharmony_ci#define RSI_RATE_6 0x8b 13862306a36Sopenharmony_ci#define RSI_RATE_9 0x8f 13962306a36Sopenharmony_ci#define RSI_RATE_12 0x8a 14062306a36Sopenharmony_ci#define RSI_RATE_18 0x8e 14162306a36Sopenharmony_ci#define RSI_RATE_24 0x89 14262306a36Sopenharmony_ci#define RSI_RATE_36 0x8d 14362306a36Sopenharmony_ci#define RSI_RATE_48 0x88 14462306a36Sopenharmony_ci#define RSI_RATE_54 0x8c 14562306a36Sopenharmony_ci#define RSI_RATE_MCS0 0x100 14662306a36Sopenharmony_ci#define RSI_RATE_MCS1 0x101 14762306a36Sopenharmony_ci#define RSI_RATE_MCS2 0x102 14862306a36Sopenharmony_ci#define RSI_RATE_MCS3 0x103 14962306a36Sopenharmony_ci#define RSI_RATE_MCS4 0x104 15062306a36Sopenharmony_ci#define RSI_RATE_MCS5 0x105 15162306a36Sopenharmony_ci#define RSI_RATE_MCS6 0x106 15262306a36Sopenharmony_ci#define RSI_RATE_MCS7 0x107 15362306a36Sopenharmony_ci#define RSI_RATE_MCS7_SG 0x307 15462306a36Sopenharmony_ci#define RSI_RATE_AUTO 0xffff 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci#define BW_20MHZ 0 15762306a36Sopenharmony_ci#define BW_40MHZ 1 15862306a36Sopenharmony_ci 15962306a36Sopenharmony_ci#define EP_2GHZ_20MHZ 0 16062306a36Sopenharmony_ci#define EP_2GHZ_40MHZ 1 16162306a36Sopenharmony_ci#define EP_5GHZ_20MHZ 2 16262306a36Sopenharmony_ci#define EP_5GHZ_40MHZ 3 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci#define SIFS_TX_11N_VALUE 580 16562306a36Sopenharmony_ci#define SIFS_TX_11B_VALUE 346 16662306a36Sopenharmony_ci#define SHORT_SLOT_VALUE 360 16762306a36Sopenharmony_ci#define LONG_SLOT_VALUE 640 16862306a36Sopenharmony_ci#define OFDM_ACK_TOUT_VALUE 2720 16962306a36Sopenharmony_ci#define CCK_ACK_TOUT_VALUE 9440 17062306a36Sopenharmony_ci#define LONG_PREAMBLE 0x0000 17162306a36Sopenharmony_ci#define SHORT_PREAMBLE 0x0001 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci#define RSI_SUPP_FILTERS (FIF_ALLMULTI | FIF_PROBE_REQ |\ 17462306a36Sopenharmony_ci FIF_BCN_PRBRESP_PROMISC) 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci#define ANTENNA_SEL_INT 0x02 /* RF_OUT_2 / Integerated */ 17762306a36Sopenharmony_ci#define ANTENNA_SEL_UFL 0x03 /* RF_OUT_1 / U.FL */ 17862306a36Sopenharmony_ci#define ANTENNA_MASK_VALUE 0x00ff 17962306a36Sopenharmony_ci#define ANTENNA_SEL_TYPE 1 18062306a36Sopenharmony_ci 18162306a36Sopenharmony_ci/* Rx filter word definitions */ 18262306a36Sopenharmony_ci#define PROMISCOUS_MODE BIT(0) 18362306a36Sopenharmony_ci#define ALLOW_DATA_ASSOC_PEER BIT(1) 18462306a36Sopenharmony_ci#define ALLOW_MGMT_ASSOC_PEER BIT(2) 18562306a36Sopenharmony_ci#define ALLOW_CTRL_ASSOC_PEER BIT(3) 18662306a36Sopenharmony_ci#define DISALLOW_BEACONS BIT(4) 18762306a36Sopenharmony_ci#define ALLOW_CONN_PEER_MGMT_WHILE_BUF_FULL BIT(5) 18862306a36Sopenharmony_ci#define DISALLOW_BROADCAST_DATA BIT(6) 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci#define RSI_MPDU_DENSITY 0x8 19162306a36Sopenharmony_ci#define RSI_CHAN_RADAR BIT(7) 19262306a36Sopenharmony_ci#define RSI_BEACON_INTERVAL 200 19362306a36Sopenharmony_ci#define RSI_DTIM_COUNT 2 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_ci#define RSI_PS_DISABLE_IND BIT(15) 19662306a36Sopenharmony_ci#define RSI_PS_ENABLE 1 19762306a36Sopenharmony_ci#define RSI_PS_DISABLE 0 19862306a36Sopenharmony_ci#define RSI_DEEP_SLEEP 1 19962306a36Sopenharmony_ci#define RSI_CONNECTED_SLEEP 2 20062306a36Sopenharmony_ci#define RSI_SLEEP_REQUEST 1 20162306a36Sopenharmony_ci#define RSI_WAKEUP_REQUEST 2 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci#define RSI_IEEE80211_UAPSD_QUEUES \ 20462306a36Sopenharmony_ci (IEEE80211_WMM_IE_STA_QOSINFO_AC_VO | \ 20562306a36Sopenharmony_ci IEEE80211_WMM_IE_STA_QOSINFO_AC_VI | \ 20662306a36Sopenharmony_ci IEEE80211_WMM_IE_STA_QOSINFO_AC_BE | \ 20762306a36Sopenharmony_ci IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci#define RSI_DESC_VAP_ID_MASK 0xC000u 21062306a36Sopenharmony_ci#define RSI_DESC_VAP_ID_OFST 14 21162306a36Sopenharmony_ci#define RSI_DATA_DESC_MAC_BBP_INFO BIT(0) 21262306a36Sopenharmony_ci#define RSI_DATA_DESC_NO_ACK_IND BIT(9) 21362306a36Sopenharmony_ci#define RSI_DATA_DESC_QOS_EN BIT(12) 21462306a36Sopenharmony_ci#define RSI_DATA_DESC_NORMAL_FRAME 0x00 21562306a36Sopenharmony_ci#define RSI_DATA_DESC_DTIM_BEACON_GATED_FRAME BIT(10) 21662306a36Sopenharmony_ci#define RSI_DATA_DESC_BEACON_FRAME BIT(11) 21762306a36Sopenharmony_ci#define RSI_DATA_DESC_DTIM_BEACON (BIT(10) | BIT(11)) 21862306a36Sopenharmony_ci#define RSI_DATA_DESC_INSERT_TSF BIT(15) 21962306a36Sopenharmony_ci#define RSI_DATA_DESC_INSERT_SEQ_NO BIT(2) 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_ci#ifdef CONFIG_PM 22262306a36Sopenharmony_ci#define RSI_WOW_ANY BIT(1) 22362306a36Sopenharmony_ci#define RSI_WOW_GTK_REKEY BIT(3) 22462306a36Sopenharmony_ci#define RSI_WOW_MAGIC_PKT BIT(4) 22562306a36Sopenharmony_ci#define RSI_WOW_DISCONNECT BIT(5) 22662306a36Sopenharmony_ci#endif 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci#define RSI_MAX_TX_AGGR_FRMS 8 22962306a36Sopenharmony_ci#define RSI_MAX_RX_AGGR_FRMS 8 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci#define RSI_MAX_SCAN_SSIDS 16 23262306a36Sopenharmony_ci#define RSI_MAX_SCAN_IE_LEN 256 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_cienum opmode { 23562306a36Sopenharmony_ci RSI_OPMODE_UNSUPPORTED = -1, 23662306a36Sopenharmony_ci RSI_OPMODE_AP = 0, 23762306a36Sopenharmony_ci RSI_OPMODE_STA, 23862306a36Sopenharmony_ci RSI_OPMODE_P2P_GO, 23962306a36Sopenharmony_ci RSI_OPMODE_P2P_CLIENT 24062306a36Sopenharmony_ci}; 24162306a36Sopenharmony_ci 24262306a36Sopenharmony_cienum vap_status { 24362306a36Sopenharmony_ci VAP_ADD = 1, 24462306a36Sopenharmony_ci VAP_DELETE = 2, 24562306a36Sopenharmony_ci VAP_UPDATE = 3 24662306a36Sopenharmony_ci}; 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_cienum peer_type { 24962306a36Sopenharmony_ci PEER_TYPE_AP, 25062306a36Sopenharmony_ci PEER_TYPE_STA, 25162306a36Sopenharmony_ci}; 25262306a36Sopenharmony_ciextern struct ieee80211_rate rsi_rates[12]; 25362306a36Sopenharmony_ciextern const u16 rsi_mcsrates[8]; 25462306a36Sopenharmony_ci 25562306a36Sopenharmony_cienum sta_notify_events { 25662306a36Sopenharmony_ci STA_CONNECTED = 0, 25762306a36Sopenharmony_ci STA_DISCONNECTED, 25862306a36Sopenharmony_ci STA_TX_ADDBA_DONE, 25962306a36Sopenharmony_ci STA_TX_DELBA, 26062306a36Sopenharmony_ci STA_RX_ADDBA_DONE, 26162306a36Sopenharmony_ci STA_RX_DELBA 26262306a36Sopenharmony_ci}; 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_ci/* Send Frames Types */ 26562306a36Sopenharmony_cienum cmd_frame_type { 26662306a36Sopenharmony_ci TX_DOT11_MGMT, 26762306a36Sopenharmony_ci RESET_MAC_REQ, 26862306a36Sopenharmony_ci RADIO_CAPABILITIES, 26962306a36Sopenharmony_ci BB_PROG_VALUES_REQUEST, 27062306a36Sopenharmony_ci RF_PROG_VALUES_REQUEST, 27162306a36Sopenharmony_ci WAKEUP_SLEEP_REQUEST, 27262306a36Sopenharmony_ci SCAN_REQUEST, 27362306a36Sopenharmony_ci TSF_UPDATE, 27462306a36Sopenharmony_ci PEER_NOTIFY, 27562306a36Sopenharmony_ci BLOCK_HW_QUEUE, 27662306a36Sopenharmony_ci SET_KEY_REQ, 27762306a36Sopenharmony_ci AUTO_RATE_IND, 27862306a36Sopenharmony_ci BOOTUP_PARAMS_REQUEST, 27962306a36Sopenharmony_ci VAP_CAPABILITIES, 28062306a36Sopenharmony_ci EEPROM_READ, 28162306a36Sopenharmony_ci EEPROM_WRITE, 28262306a36Sopenharmony_ci GPIO_PIN_CONFIG , 28362306a36Sopenharmony_ci SET_RX_FILTER, 28462306a36Sopenharmony_ci AMPDU_IND, 28562306a36Sopenharmony_ci STATS_REQUEST_FRAME, 28662306a36Sopenharmony_ci BB_BUF_PROG_VALUES_REQ, 28762306a36Sopenharmony_ci BBP_PROG_IN_TA, 28862306a36Sopenharmony_ci BG_SCAN_PARAMS, 28962306a36Sopenharmony_ci BG_SCAN_PROBE_REQ, 29062306a36Sopenharmony_ci CW_MODE_REQ, 29162306a36Sopenharmony_ci PER_CMD_PKT, 29262306a36Sopenharmony_ci ANT_SEL_FRAME = 0x20, 29362306a36Sopenharmony_ci VAP_DYNAMIC_UPDATE = 0x27, 29462306a36Sopenharmony_ci COMMON_DEV_CONFIG = 0x28, 29562306a36Sopenharmony_ci RADIO_PARAMS_UPDATE = 0x29, 29662306a36Sopenharmony_ci WOWLAN_CONFIG_PARAMS = 0x2B, 29762306a36Sopenharmony_ci FEATURES_ENABLE = 0x33, 29862306a36Sopenharmony_ci WOWLAN_WAKEUP_REASON = 0xc5 29962306a36Sopenharmony_ci}; 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_cistruct rsi_mac_frame { 30262306a36Sopenharmony_ci __le16 desc_word[8]; 30362306a36Sopenharmony_ci} __packed; 30462306a36Sopenharmony_ci 30562306a36Sopenharmony_ci#define PWR_SAVE_WAKEUP_IND BIT(0) 30662306a36Sopenharmony_ci#define TCP_CHECK_SUM_OFFLOAD BIT(1) 30762306a36Sopenharmony_ci#define CONFIRM_REQUIRED_TO_HOST BIT(2) 30862306a36Sopenharmony_ci#define ADD_DELTA_TSF BIT(3) 30962306a36Sopenharmony_ci#define FETCH_RETRY_CNT_FROM_HOST_DESC BIT(4) 31062306a36Sopenharmony_ci#define EOSP_INDICATION BIT(5) 31162306a36Sopenharmony_ci#define REQUIRE_TSF_SYNC_CONFIRM BIT(6) 31262306a36Sopenharmony_ci#define ENCAP_MGMT_PKT BIT(7) 31362306a36Sopenharmony_ci#define DESC_IMMEDIATE_WAKEUP BIT(15) 31462306a36Sopenharmony_ci 31562306a36Sopenharmony_cistruct rsi_xtended_desc { 31662306a36Sopenharmony_ci u8 confirm_frame_type; 31762306a36Sopenharmony_ci u8 retry_cnt; 31862306a36Sopenharmony_ci u16 reserved; 31962306a36Sopenharmony_ci}; 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_cistruct rsi_cmd_desc_dword0 { 32262306a36Sopenharmony_ci __le16 len_qno; 32362306a36Sopenharmony_ci u8 frame_type; 32462306a36Sopenharmony_ci u8 misc_flags; 32562306a36Sopenharmony_ci}; 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_cistruct rsi_cmd_desc_dword1 { 32862306a36Sopenharmony_ci u8 xtend_desc_size; 32962306a36Sopenharmony_ci u8 reserved1; 33062306a36Sopenharmony_ci __le16 reserved2; 33162306a36Sopenharmony_ci}; 33262306a36Sopenharmony_ci 33362306a36Sopenharmony_cistruct rsi_cmd_desc_dword2 { 33462306a36Sopenharmony_ci __le32 pkt_info; /* Packet specific data */ 33562306a36Sopenharmony_ci}; 33662306a36Sopenharmony_ci 33762306a36Sopenharmony_cistruct rsi_cmd_desc_dword3 { 33862306a36Sopenharmony_ci __le16 token; 33962306a36Sopenharmony_ci u8 qid_tid; 34062306a36Sopenharmony_ci u8 sta_id; 34162306a36Sopenharmony_ci}; 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_cistruct rsi_cmd_desc { 34462306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 34562306a36Sopenharmony_ci struct rsi_cmd_desc_dword1 desc_dword1; 34662306a36Sopenharmony_ci struct rsi_cmd_desc_dword2 desc_dword2; 34762306a36Sopenharmony_ci struct rsi_cmd_desc_dword3 desc_dword3; 34862306a36Sopenharmony_ci}; 34962306a36Sopenharmony_ci 35062306a36Sopenharmony_cistruct rsi_boot_params { 35162306a36Sopenharmony_ci __le16 desc_word[8]; 35262306a36Sopenharmony_ci struct bootup_params bootup_params; 35362306a36Sopenharmony_ci} __packed; 35462306a36Sopenharmony_ci 35562306a36Sopenharmony_cistruct rsi_boot_params_9116 { 35662306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 35762306a36Sopenharmony_ci struct rsi_cmd_desc_dword1 desc_dword1; 35862306a36Sopenharmony_ci struct rsi_cmd_desc_dword2 desc_dword2; 35962306a36Sopenharmony_ci __le16 reserved; 36062306a36Sopenharmony_ci __le16 umac_clk; 36162306a36Sopenharmony_ci struct bootup_params_9116 bootup_params; 36262306a36Sopenharmony_ci} __packed; 36362306a36Sopenharmony_ci 36462306a36Sopenharmony_cistruct rsi_peer_notify { 36562306a36Sopenharmony_ci struct rsi_cmd_desc desc; 36662306a36Sopenharmony_ci u8 mac_addr[6]; 36762306a36Sopenharmony_ci __le16 command; 36862306a36Sopenharmony_ci __le16 mpdu_density; 36962306a36Sopenharmony_ci __le16 reserved; 37062306a36Sopenharmony_ci __le32 sta_flags; 37162306a36Sopenharmony_ci} __packed; 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci/* Aggregation params flags */ 37462306a36Sopenharmony_ci#define RSI_AGGR_PARAMS_TID_MASK 0xf 37562306a36Sopenharmony_ci#define RSI_AGGR_PARAMS_START BIT(4) 37662306a36Sopenharmony_ci#define RSI_AGGR_PARAMS_RX_AGGR BIT(5) 37762306a36Sopenharmony_cistruct rsi_aggr_params { 37862306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 37962306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword1; 38062306a36Sopenharmony_ci __le16 seq_start; 38162306a36Sopenharmony_ci __le16 baw_size; 38262306a36Sopenharmony_ci __le16 token; 38362306a36Sopenharmony_ci u8 aggr_params; 38462306a36Sopenharmony_ci u8 peer_id; 38562306a36Sopenharmony_ci} __packed; 38662306a36Sopenharmony_ci 38762306a36Sopenharmony_cistruct rsi_bb_rf_prog { 38862306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 38962306a36Sopenharmony_ci __le16 reserved1; 39062306a36Sopenharmony_ci u8 rf_power_mode; 39162306a36Sopenharmony_ci u8 reserved2; 39262306a36Sopenharmony_ci u8 endpoint; 39362306a36Sopenharmony_ci u8 reserved3; 39462306a36Sopenharmony_ci __le16 reserved4; 39562306a36Sopenharmony_ci __le16 reserved5; 39662306a36Sopenharmony_ci __le16 flags; 39762306a36Sopenharmony_ci} __packed; 39862306a36Sopenharmony_ci 39962306a36Sopenharmony_cistruct rsi_chan_config { 40062306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 40162306a36Sopenharmony_ci struct rsi_cmd_desc_dword1 desc_dword1; 40262306a36Sopenharmony_ci u8 channel_number; 40362306a36Sopenharmony_ci u8 antenna_gain_offset_2g; 40462306a36Sopenharmony_ci u8 antenna_gain_offset_5g; 40562306a36Sopenharmony_ci u8 channel_width; 40662306a36Sopenharmony_ci __le16 tx_power; 40762306a36Sopenharmony_ci u8 region_rftype; 40862306a36Sopenharmony_ci u8 flags; 40962306a36Sopenharmony_ci} __packed; 41062306a36Sopenharmony_ci 41162306a36Sopenharmony_cistruct rsi_vap_caps { 41262306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 41362306a36Sopenharmony_ci u8 reserved1; 41462306a36Sopenharmony_ci u8 status; 41562306a36Sopenharmony_ci __le16 reserved2; 41662306a36Sopenharmony_ci u8 vif_type; 41762306a36Sopenharmony_ci u8 channel_bw; 41862306a36Sopenharmony_ci __le16 antenna_info; 41962306a36Sopenharmony_ci __le16 token; 42062306a36Sopenharmony_ci u8 radioid_macid; 42162306a36Sopenharmony_ci u8 vap_id; 42262306a36Sopenharmony_ci u8 mac_addr[6]; 42362306a36Sopenharmony_ci __le16 keep_alive_period; 42462306a36Sopenharmony_ci u8 bssid[6]; 42562306a36Sopenharmony_ci __le16 reserved4; 42662306a36Sopenharmony_ci __le32 flags; 42762306a36Sopenharmony_ci __le16 frag_threshold; 42862306a36Sopenharmony_ci __le16 rts_threshold; 42962306a36Sopenharmony_ci __le32 default_mgmt_rate; 43062306a36Sopenharmony_ci __le16 default_ctrl_rate; 43162306a36Sopenharmony_ci __le16 ctrl_rate_flags; 43262306a36Sopenharmony_ci __le32 default_data_rate; 43362306a36Sopenharmony_ci __le16 beacon_interval; 43462306a36Sopenharmony_ci __le16 dtim_period; 43562306a36Sopenharmony_ci __le16 beacon_miss_threshold; 43662306a36Sopenharmony_ci} __packed; 43762306a36Sopenharmony_ci 43862306a36Sopenharmony_cistruct rsi_ant_sel_frame { 43962306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 44062306a36Sopenharmony_ci u8 reserved; 44162306a36Sopenharmony_ci u8 sub_frame_type; 44262306a36Sopenharmony_ci __le16 ant_value; 44362306a36Sopenharmony_ci __le32 reserved1; 44462306a36Sopenharmony_ci __le32 reserved2; 44562306a36Sopenharmony_ci} __packed; 44662306a36Sopenharmony_ci 44762306a36Sopenharmony_cistruct rsi_dynamic_s { 44862306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 44962306a36Sopenharmony_ci struct rsi_cmd_desc_dword1 desc_dword1; 45062306a36Sopenharmony_ci struct rsi_cmd_desc_dword2 desc_dword2; 45162306a36Sopenharmony_ci struct rsi_cmd_desc_dword3 desc_dword3; 45262306a36Sopenharmony_ci struct framebody { 45362306a36Sopenharmony_ci __le16 data_rate; 45462306a36Sopenharmony_ci __le16 mgmt_rate; 45562306a36Sopenharmony_ci __le16 keep_alive_period; 45662306a36Sopenharmony_ci } frame_body; 45762306a36Sopenharmony_ci} __packed; 45862306a36Sopenharmony_ci 45962306a36Sopenharmony_ci/* Key descriptor flags */ 46062306a36Sopenharmony_ci#define RSI_KEY_TYPE_BROADCAST BIT(1) 46162306a36Sopenharmony_ci#define RSI_WEP_KEY BIT(2) 46262306a36Sopenharmony_ci#define RSI_WEP_KEY_104 BIT(3) 46362306a36Sopenharmony_ci#define RSI_CIPHER_WPA BIT(4) 46462306a36Sopenharmony_ci#define RSI_CIPHER_TKIP BIT(5) 46562306a36Sopenharmony_ci#define RSI_KEY_MODE_AP BIT(7) 46662306a36Sopenharmony_ci#define RSI_PROTECT_DATA_FRAMES BIT(13) 46762306a36Sopenharmony_ci#define RSI_KEY_ID_MASK 0xC0 46862306a36Sopenharmony_ci#define RSI_KEY_ID_OFFSET 14 46962306a36Sopenharmony_cistruct rsi_set_key { 47062306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 47162306a36Sopenharmony_ci struct rsi_cmd_desc_dword1 desc_dword1; 47262306a36Sopenharmony_ci __le16 key_desc; 47362306a36Sopenharmony_ci __le32 bpn; 47462306a36Sopenharmony_ci u8 sta_id; 47562306a36Sopenharmony_ci u8 vap_id; 47662306a36Sopenharmony_ci u8 key[4][32]; 47762306a36Sopenharmony_ci u8 tx_mic_key[8]; 47862306a36Sopenharmony_ci u8 rx_mic_key[8]; 47962306a36Sopenharmony_ci} __packed; 48062306a36Sopenharmony_ci 48162306a36Sopenharmony_cistruct rsi_auto_rate { 48262306a36Sopenharmony_ci struct rsi_cmd_desc desc; 48362306a36Sopenharmony_ci __le16 failure_limit; 48462306a36Sopenharmony_ci __le16 initial_boundary; 48562306a36Sopenharmony_ci __le16 max_threshold_limt; 48662306a36Sopenharmony_ci __le16 num_supported_rates; 48762306a36Sopenharmony_ci __le16 aarf_rssi; 48862306a36Sopenharmony_ci __le16 moderate_rate_inx; 48962306a36Sopenharmony_ci __le16 collision_tolerance; 49062306a36Sopenharmony_ci __le16 supported_rates[40]; 49162306a36Sopenharmony_ci} __packed; 49262306a36Sopenharmony_ci 49362306a36Sopenharmony_ci#define QUIET_INFO_VALID BIT(0) 49462306a36Sopenharmony_ci#define QUIET_ENABLE BIT(1) 49562306a36Sopenharmony_cistruct rsi_block_unblock_data { 49662306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 49762306a36Sopenharmony_ci u8 xtend_desc_size; 49862306a36Sopenharmony_ci u8 host_quiet_info; 49962306a36Sopenharmony_ci __le16 reserved; 50062306a36Sopenharmony_ci __le16 block_q_bitmap; 50162306a36Sopenharmony_ci __le16 unblock_q_bitmap; 50262306a36Sopenharmony_ci __le16 token; 50362306a36Sopenharmony_ci __le16 flush_q_bitmap; 50462306a36Sopenharmony_ci} __packed; 50562306a36Sopenharmony_ci 50662306a36Sopenharmony_cistruct qos_params { 50762306a36Sopenharmony_ci __le16 cont_win_min_q; 50862306a36Sopenharmony_ci __le16 cont_win_max_q; 50962306a36Sopenharmony_ci __le16 aifsn_val_q; 51062306a36Sopenharmony_ci __le16 txop_q; 51162306a36Sopenharmony_ci} __packed; 51262306a36Sopenharmony_ci 51362306a36Sopenharmony_cistruct rsi_radio_caps { 51462306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 51562306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword1; 51662306a36Sopenharmony_ci u8 channel_num; 51762306a36Sopenharmony_ci u8 rf_model; 51862306a36Sopenharmony_ci __le16 ppe_ack_rate; 51962306a36Sopenharmony_ci __le16 mode_11j; 52062306a36Sopenharmony_ci u8 radio_cfg_info; 52162306a36Sopenharmony_ci u8 radio_info; 52262306a36Sopenharmony_ci struct qos_params qos_params[MAX_HW_QUEUES]; 52362306a36Sopenharmony_ci u8 num_11n_rates; 52462306a36Sopenharmony_ci u8 num_11ac_rates; 52562306a36Sopenharmony_ci __le16 gcpd_per_rate[20]; 52662306a36Sopenharmony_ci __le16 sifs_tx_11n; 52762306a36Sopenharmony_ci __le16 sifs_tx_11b; 52862306a36Sopenharmony_ci __le16 slot_rx_11n; 52962306a36Sopenharmony_ci __le16 ofdm_ack_tout; 53062306a36Sopenharmony_ci __le16 cck_ack_tout; 53162306a36Sopenharmony_ci __le16 preamble_type; 53262306a36Sopenharmony_ci} __packed; 53362306a36Sopenharmony_ci 53462306a36Sopenharmony_ci/* ULP GPIO flags */ 53562306a36Sopenharmony_ci#define RSI_GPIO_MOTION_SENSOR_ULP_WAKEUP BIT(0) 53662306a36Sopenharmony_ci#define RSI_GPIO_SLEEP_IND_FROM_DEVICE BIT(1) 53762306a36Sopenharmony_ci#define RSI_GPIO_2_ULP BIT(2) 53862306a36Sopenharmony_ci#define RSI_GPIO_PUSH_BUTTON_ULP_WAKEUP BIT(3) 53962306a36Sopenharmony_ci 54062306a36Sopenharmony_ci/* SOC GPIO flags */ 54162306a36Sopenharmony_ci#define RSI_GPIO_0_PSPI_CSN_0 BIT(0) 54262306a36Sopenharmony_ci#define RSI_GPIO_1_PSPI_CSN_1 BIT(1) 54362306a36Sopenharmony_ci#define RSI_GPIO_2_HOST_WAKEUP_INTR BIT(2) 54462306a36Sopenharmony_ci#define RSI_GPIO_3_PSPI_DATA_0 BIT(3) 54562306a36Sopenharmony_ci#define RSI_GPIO_4_PSPI_DATA_1 BIT(4) 54662306a36Sopenharmony_ci#define RSI_GPIO_5_PSPI_DATA_2 BIT(5) 54762306a36Sopenharmony_ci#define RSI_GPIO_6_PSPI_DATA_3 BIT(6) 54862306a36Sopenharmony_ci#define RSI_GPIO_7_I2C_SCL BIT(7) 54962306a36Sopenharmony_ci#define RSI_GPIO_8_I2C_SDA BIT(8) 55062306a36Sopenharmony_ci#define RSI_GPIO_9_UART1_RX BIT(9) 55162306a36Sopenharmony_ci#define RSI_GPIO_10_UART1_TX BIT(10) 55262306a36Sopenharmony_ci#define RSI_GPIO_11_UART1_RTS_I2S_CLK BIT(11) 55362306a36Sopenharmony_ci#define RSI_GPIO_12_UART1_CTS_I2S_WS BIT(12) 55462306a36Sopenharmony_ci#define RSI_GPIO_13_DBG_UART_RX_I2S_DIN BIT(13) 55562306a36Sopenharmony_ci#define RSI_GPIO_14_DBG_UART_RX_I2S_DOUT BIT(14) 55662306a36Sopenharmony_ci#define RSI_GPIO_15_LP_WAKEUP_BOOT_BYPASS BIT(15) 55762306a36Sopenharmony_ci#define RSI_GPIO_16_LED_0 BIT(16) 55862306a36Sopenharmony_ci#define RSI_GPIO_17_BTCOEX_WLAN_ACT_EXT_ANT_SEL BIT(17) 55962306a36Sopenharmony_ci#define RSI_GPIO_18_BTCOEX_BT_PRIO_EXT_ANT_SEL BIT(18) 56062306a36Sopenharmony_ci#define RSI_GPIO_19_BTCOEX_BT_ACT_EXT_ON_OFF BIT(19) 56162306a36Sopenharmony_ci#define RSI_GPIO_20_RF_RESET BIT(20) 56262306a36Sopenharmony_ci#define RSI_GPIO_21_SLEEP_IND_FROM_DEVICE BIT(21) 56362306a36Sopenharmony_ci 56462306a36Sopenharmony_ci#define RSI_UNUSED_SOC_GPIO_BITMAP (RSI_GPIO_9_UART1_RX | \ 56562306a36Sopenharmony_ci RSI_GPIO_10_UART1_TX | \ 56662306a36Sopenharmony_ci RSI_GPIO_11_UART1_RTS_I2S_CLK | \ 56762306a36Sopenharmony_ci RSI_GPIO_12_UART1_CTS_I2S_WS | \ 56862306a36Sopenharmony_ci RSI_GPIO_13_DBG_UART_RX_I2S_DIN | \ 56962306a36Sopenharmony_ci RSI_GPIO_14_DBG_UART_RX_I2S_DOUT | \ 57062306a36Sopenharmony_ci RSI_GPIO_15_LP_WAKEUP_BOOT_BYPASS | \ 57162306a36Sopenharmony_ci RSI_GPIO_17_BTCOEX_WLAN_ACT_EXT_ANT_SEL | \ 57262306a36Sopenharmony_ci RSI_GPIO_18_BTCOEX_BT_PRIO_EXT_ANT_SEL | \ 57362306a36Sopenharmony_ci RSI_GPIO_19_BTCOEX_BT_ACT_EXT_ON_OFF | \ 57462306a36Sopenharmony_ci RSI_GPIO_21_SLEEP_IND_FROM_DEVICE) 57562306a36Sopenharmony_ci 57662306a36Sopenharmony_ci#define RSI_UNUSED_ULP_GPIO_BITMAP (RSI_GPIO_MOTION_SENSOR_ULP_WAKEUP | \ 57762306a36Sopenharmony_ci RSI_GPIO_SLEEP_IND_FROM_DEVICE | \ 57862306a36Sopenharmony_ci RSI_GPIO_2_ULP | \ 57962306a36Sopenharmony_ci RSI_GPIO_PUSH_BUTTON_ULP_WAKEUP); 58062306a36Sopenharmony_cistruct rsi_config_vals { 58162306a36Sopenharmony_ci __le16 len_qno; 58262306a36Sopenharmony_ci u8 pkt_type; 58362306a36Sopenharmony_ci u8 misc_flags; 58462306a36Sopenharmony_ci __le16 reserved1[6]; 58562306a36Sopenharmony_ci u8 lp_ps_handshake; 58662306a36Sopenharmony_ci u8 ulp_ps_handshake; 58762306a36Sopenharmony_ci u8 sleep_config_params; /* 0 for no handshake, 58862306a36Sopenharmony_ci * 1 for GPIO based handshake, 58962306a36Sopenharmony_ci * 2 packet handshake 59062306a36Sopenharmony_ci */ 59162306a36Sopenharmony_ci u8 unused_ulp_gpio; 59262306a36Sopenharmony_ci __le32 unused_soc_gpio_bitmap; 59362306a36Sopenharmony_ci u8 ext_pa_or_bt_coex_en; 59462306a36Sopenharmony_ci u8 opermode; 59562306a36Sopenharmony_ci u8 wlan_rf_pwr_mode; 59662306a36Sopenharmony_ci u8 bt_rf_pwr_mode; 59762306a36Sopenharmony_ci u8 zigbee_rf_pwr_mode; 59862306a36Sopenharmony_ci u8 driver_mode; 59962306a36Sopenharmony_ci u8 region_code; 60062306a36Sopenharmony_ci u8 antenna_sel_val; 60162306a36Sopenharmony_ci u8 reserved2[16]; 60262306a36Sopenharmony_ci} __packed; 60362306a36Sopenharmony_ci 60462306a36Sopenharmony_ci/* Packet info flags */ 60562306a36Sopenharmony_ci#define RSI_EEPROM_HDR_SIZE_OFFSET 8 60662306a36Sopenharmony_ci#define RSI_EEPROM_HDR_SIZE_MASK 0x300 60762306a36Sopenharmony_ci#define RSI_EEPROM_LEN_OFFSET 20 60862306a36Sopenharmony_ci#define RSI_EEPROM_LEN_MASK 0xFFF00000 60962306a36Sopenharmony_ci 61062306a36Sopenharmony_cistruct rsi_eeprom_read_frame { 61162306a36Sopenharmony_ci __le16 len_qno; 61262306a36Sopenharmony_ci u8 pkt_type; 61362306a36Sopenharmony_ci u8 misc_flags; 61462306a36Sopenharmony_ci __le32 pkt_info; 61562306a36Sopenharmony_ci __le32 eeprom_offset; 61662306a36Sopenharmony_ci __le16 delay_ms; 61762306a36Sopenharmony_ci __le16 reserved3; 61862306a36Sopenharmony_ci} __packed; 61962306a36Sopenharmony_ci 62062306a36Sopenharmony_cistruct rsi_request_ps { 62162306a36Sopenharmony_ci struct rsi_cmd_desc desc; 62262306a36Sopenharmony_ci struct ps_sleep_params ps_sleep; 62362306a36Sopenharmony_ci u8 ps_mimic_support; 62462306a36Sopenharmony_ci u8 ps_uapsd_acs; 62562306a36Sopenharmony_ci u8 ps_uapsd_wakeup_period; 62662306a36Sopenharmony_ci u8 reserved; 62762306a36Sopenharmony_ci __le32 ps_listen_interval; 62862306a36Sopenharmony_ci __le32 ps_dtim_interval_duration; 62962306a36Sopenharmony_ci __le16 ps_num_dtim_intervals; 63062306a36Sopenharmony_ci} __packed; 63162306a36Sopenharmony_ci 63262306a36Sopenharmony_cistruct rsi_wowlan_req { 63362306a36Sopenharmony_ci struct rsi_cmd_desc desc; 63462306a36Sopenharmony_ci u8 sourceid[ETH_ALEN]; 63562306a36Sopenharmony_ci u16 wow_flags; 63662306a36Sopenharmony_ci u16 host_sleep_status; 63762306a36Sopenharmony_ci} __packed; 63862306a36Sopenharmony_ci 63962306a36Sopenharmony_ci#define RSI_START_BGSCAN 1 64062306a36Sopenharmony_ci#define RSI_STOP_BGSCAN 0 64162306a36Sopenharmony_ci#define HOST_BG_SCAN_TRIG BIT(4) 64262306a36Sopenharmony_cistruct rsi_bgscan_config { 64362306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 64462306a36Sopenharmony_ci __le64 reserved; 64562306a36Sopenharmony_ci __le32 reserved1; 64662306a36Sopenharmony_ci __le16 bgscan_threshold; 64762306a36Sopenharmony_ci __le16 roam_threshold; 64862306a36Sopenharmony_ci __le16 bgscan_periodicity; 64962306a36Sopenharmony_ci u8 num_bgscan_channels; 65062306a36Sopenharmony_ci u8 two_probe; 65162306a36Sopenharmony_ci __le16 active_scan_duration; 65262306a36Sopenharmony_ci __le16 passive_scan_duration; 65362306a36Sopenharmony_ci __le16 channels2scan[MAX_BGSCAN_CHANNELS_DUAL_BAND]; 65462306a36Sopenharmony_ci} __packed; 65562306a36Sopenharmony_ci 65662306a36Sopenharmony_cistruct rsi_bgscan_probe { 65762306a36Sopenharmony_ci struct rsi_cmd_desc_dword0 desc_dword0; 65862306a36Sopenharmony_ci __le64 reserved; 65962306a36Sopenharmony_ci __le32 reserved1; 66062306a36Sopenharmony_ci __le16 mgmt_rate; 66162306a36Sopenharmony_ci __le16 flags; 66262306a36Sopenharmony_ci __le16 def_chan; 66362306a36Sopenharmony_ci __le16 channel_scan_time; 66462306a36Sopenharmony_ci __le16 probe_req_length; 66562306a36Sopenharmony_ci} __packed; 66662306a36Sopenharmony_ci 66762306a36Sopenharmony_ci#define RSI_DUTY_CYCLING BIT(0) 66862306a36Sopenharmony_ci#define RSI_END_OF_FRAME BIT(1) 66962306a36Sopenharmony_ci#define RSI_SIFS_TX_ENABLE BIT(2) 67062306a36Sopenharmony_ci#define RSI_DPD BIT(3) 67162306a36Sopenharmony_cistruct rsi_wlan_9116_features { 67262306a36Sopenharmony_ci struct rsi_cmd_desc desc; 67362306a36Sopenharmony_ci u8 pll_mode; 67462306a36Sopenharmony_ci u8 rf_type; 67562306a36Sopenharmony_ci u8 wireless_mode; 67662306a36Sopenharmony_ci u8 enable_ppe; 67762306a36Sopenharmony_ci u8 afe_type; 67862306a36Sopenharmony_ci u8 reserved1; 67962306a36Sopenharmony_ci __le16 reserved2; 68062306a36Sopenharmony_ci __le32 feature_enable; 68162306a36Sopenharmony_ci}; 68262306a36Sopenharmony_ci 68362306a36Sopenharmony_cistatic inline u32 rsi_get_queueno(u8 *addr, u16 offset) 68462306a36Sopenharmony_ci{ 68562306a36Sopenharmony_ci return (le16_to_cpu(*(__le16 *)&addr[offset]) & 0x7000) >> 12; 68662306a36Sopenharmony_ci} 68762306a36Sopenharmony_ci 68862306a36Sopenharmony_cistatic inline u32 rsi_get_length(u8 *addr, u16 offset) 68962306a36Sopenharmony_ci{ 69062306a36Sopenharmony_ci return (le16_to_cpu(*(__le16 *)&addr[offset])) & 0x0fff; 69162306a36Sopenharmony_ci} 69262306a36Sopenharmony_ci 69362306a36Sopenharmony_cistatic inline u8 rsi_get_extended_desc(u8 *addr, u16 offset) 69462306a36Sopenharmony_ci{ 69562306a36Sopenharmony_ci return le16_to_cpu(*((__le16 *)&addr[offset + 4])) & 0x00ff; 69662306a36Sopenharmony_ci} 69762306a36Sopenharmony_ci 69862306a36Sopenharmony_cistatic inline u8 rsi_get_rssi(u8 *addr) 69962306a36Sopenharmony_ci{ 70062306a36Sopenharmony_ci return *(u8 *)(addr + FRAME_DESC_SZ); 70162306a36Sopenharmony_ci} 70262306a36Sopenharmony_ci 70362306a36Sopenharmony_cistatic inline u8 rsi_get_channel(u8 *addr) 70462306a36Sopenharmony_ci{ 70562306a36Sopenharmony_ci return *(char *)(addr + 15); 70662306a36Sopenharmony_ci} 70762306a36Sopenharmony_ci 70862306a36Sopenharmony_cistatic inline void rsi_set_len_qno(__le16 *addr, u16 len, u8 qno) 70962306a36Sopenharmony_ci{ 71062306a36Sopenharmony_ci *addr = cpu_to_le16(len | ((qno & 7) << 12)); 71162306a36Sopenharmony_ci} 71262306a36Sopenharmony_ci 71362306a36Sopenharmony_ciint rsi_handle_card_ready(struct rsi_common *common, u8 *msg); 71462306a36Sopenharmony_ciint rsi_mgmt_pkt_recv(struct rsi_common *common, u8 *msg); 71562306a36Sopenharmony_ciint rsi_set_vap_capabilities(struct rsi_common *common, enum opmode mode, 71662306a36Sopenharmony_ci u8 *mac_addr, u8 vap_id, u8 vap_status); 71762306a36Sopenharmony_ciint rsi_send_aggregation_params_frame(struct rsi_common *common, u16 tid, 71862306a36Sopenharmony_ci u16 ssn, u8 buf_size, u8 event, 71962306a36Sopenharmony_ci u8 sta_id); 72062306a36Sopenharmony_ciint rsi_hal_load_key(struct rsi_common *common, u8 *data, u16 key_len, 72162306a36Sopenharmony_ci u8 key_type, u8 key_id, u32 cipher, s16 sta_id, 72262306a36Sopenharmony_ci struct ieee80211_vif *vif); 72362306a36Sopenharmony_ciint rsi_set_channel(struct rsi_common *common, 72462306a36Sopenharmony_ci struct ieee80211_channel *channel); 72562306a36Sopenharmony_ciint rsi_send_vap_dynamic_update(struct rsi_common *common); 72662306a36Sopenharmony_ciint rsi_send_block_unblock_frame(struct rsi_common *common, bool event); 72762306a36Sopenharmony_ciint rsi_hal_send_sta_notify_frame(struct rsi_common *common, enum opmode opmode, 72862306a36Sopenharmony_ci u8 notify_event, const unsigned char *bssid, 72962306a36Sopenharmony_ci u8 qos_enable, u16 aid, u16 sta_id, 73062306a36Sopenharmony_ci struct ieee80211_vif *vif); 73162306a36Sopenharmony_civoid rsi_inform_bss_status(struct rsi_common *common, enum opmode opmode, 73262306a36Sopenharmony_ci u8 status, const u8 *addr, u8 qos_enable, u16 aid, 73362306a36Sopenharmony_ci struct ieee80211_sta *sta, u16 sta_id, 73462306a36Sopenharmony_ci u16 assoc_cap, struct ieee80211_vif *vif); 73562306a36Sopenharmony_civoid rsi_indicate_pkt_to_os(struct rsi_common *common, struct sk_buff *skb); 73662306a36Sopenharmony_ciint rsi_mac80211_attach(struct rsi_common *common); 73762306a36Sopenharmony_civoid rsi_indicate_tx_status(struct rsi_hw *common, struct sk_buff *skb, 73862306a36Sopenharmony_ci int status); 73962306a36Sopenharmony_cibool rsi_is_cipher_wep(struct rsi_common *common); 74062306a36Sopenharmony_civoid rsi_core_qos_processor(struct rsi_common *common); 74162306a36Sopenharmony_civoid rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb); 74262306a36Sopenharmony_ciint rsi_send_mgmt_pkt(struct rsi_common *common, struct sk_buff *skb); 74362306a36Sopenharmony_ciint rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb); 74462306a36Sopenharmony_ciint rsi_band_check(struct rsi_common *common, struct ieee80211_channel *chan); 74562306a36Sopenharmony_ciint rsi_send_rx_filter_frame(struct rsi_common *common, u16 rx_filter_word); 74662306a36Sopenharmony_ciint rsi_send_radio_params_update(struct rsi_common *common); 74762306a36Sopenharmony_ciint rsi_set_antenna(struct rsi_common *common, u8 antenna); 74862306a36Sopenharmony_ci#ifdef CONFIG_PM 74962306a36Sopenharmony_ciint rsi_send_wowlan_request(struct rsi_common *common, u16 flags, 75062306a36Sopenharmony_ci u16 sleep_status); 75162306a36Sopenharmony_ci#endif 75262306a36Sopenharmony_ciint rsi_send_ps_request(struct rsi_hw *adapter, bool enable, 75362306a36Sopenharmony_ci struct ieee80211_vif *vif); 75462306a36Sopenharmony_civoid init_bgscan_params(struct rsi_common *common); 75562306a36Sopenharmony_ciint rsi_send_bgscan_params(struct rsi_common *common, int enable); 75662306a36Sopenharmony_ciint rsi_send_bgscan_probe_req(struct rsi_common *common, 75762306a36Sopenharmony_ci struct ieee80211_vif *vif); 75862306a36Sopenharmony_ci#endif 759