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_MAIN_H__ 188c2ecf20Sopenharmony_ci#define __RSI_MAIN_H__ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include <linux/string.h> 218c2ecf20Sopenharmony_ci#include <linux/skbuff.h> 228c2ecf20Sopenharmony_ci#include <net/mac80211.h> 238c2ecf20Sopenharmony_ci#include <net/rsi_91x.h> 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistruct rsi_sta { 268c2ecf20Sopenharmony_ci struct ieee80211_sta *sta; 278c2ecf20Sopenharmony_ci s16 sta_id; 288c2ecf20Sopenharmony_ci u16 seq_start[IEEE80211_NUM_TIDS]; 298c2ecf20Sopenharmony_ci bool start_tx_aggr[IEEE80211_NUM_TIDS]; 308c2ecf20Sopenharmony_ci}; 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_cistruct rsi_hw; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#include "rsi_ps.h" 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#define ERR_ZONE BIT(0) /* For Error Msgs */ 378c2ecf20Sopenharmony_ci#define INFO_ZONE BIT(1) /* For General Status Msgs */ 388c2ecf20Sopenharmony_ci#define INIT_ZONE BIT(2) /* For Driver Init Seq Msgs */ 398c2ecf20Sopenharmony_ci#define MGMT_TX_ZONE BIT(3) /* For TX Mgmt Path Msgs */ 408c2ecf20Sopenharmony_ci#define MGMT_RX_ZONE BIT(4) /* For RX Mgmt Path Msgs */ 418c2ecf20Sopenharmony_ci#define DATA_TX_ZONE BIT(5) /* For TX Data Path Msgs */ 428c2ecf20Sopenharmony_ci#define DATA_RX_ZONE BIT(6) /* For RX Data Path Msgs */ 438c2ecf20Sopenharmony_ci#define FSM_ZONE BIT(7) /* For State Machine Msgs */ 448c2ecf20Sopenharmony_ci#define ISR_ZONE BIT(8) /* For Interrupt Msgs */ 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_cienum RSI_FSM_STATES { 478c2ecf20Sopenharmony_ci FSM_FW_NOT_LOADED, 488c2ecf20Sopenharmony_ci FSM_CARD_NOT_READY, 498c2ecf20Sopenharmony_ci FSM_COMMON_DEV_PARAMS_SENT, 508c2ecf20Sopenharmony_ci FSM_BOOT_PARAMS_SENT, 518c2ecf20Sopenharmony_ci FSM_EEPROM_READ_MAC_ADDR, 528c2ecf20Sopenharmony_ci FSM_EEPROM_READ_RF_TYPE, 538c2ecf20Sopenharmony_ci FSM_RESET_MAC_SENT, 548c2ecf20Sopenharmony_ci FSM_RADIO_CAPS_SENT, 558c2ecf20Sopenharmony_ci FSM_BB_RF_PROG_SENT, 568c2ecf20Sopenharmony_ci FSM_MAC_INIT_DONE, 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci NUM_FSM_STATES 598c2ecf20Sopenharmony_ci}; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ciextern u32 rsi_zone_enabled; 628c2ecf20Sopenharmony_ciextern __printf(2, 3) void rsi_dbg(u32 zone, const char *fmt, ...); 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define RSI_MAX_BANDS 2 658c2ecf20Sopenharmony_ci#define RSI_MAX_VIFS 3 668c2ecf20Sopenharmony_ci#define NUM_EDCA_QUEUES 4 678c2ecf20Sopenharmony_ci#define IEEE80211_ADDR_LEN 6 688c2ecf20Sopenharmony_ci#define FRAME_DESC_SZ 16 698c2ecf20Sopenharmony_ci#define MIN_802_11_HDR_LEN 24 708c2ecf20Sopenharmony_ci#define RSI_DEF_KEEPALIVE 90 718c2ecf20Sopenharmony_ci#define RSI_WOW_KEEPALIVE 5 728c2ecf20Sopenharmony_ci#define RSI_BCN_MISS_THRESHOLD 24 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define DATA_QUEUE_WATER_MARK 400 758c2ecf20Sopenharmony_ci#define MIN_DATA_QUEUE_WATER_MARK 300 768c2ecf20Sopenharmony_ci#define MULTICAST_WATER_MARK 200 778c2ecf20Sopenharmony_ci#define MAC_80211_HDR_FRAME_CONTROL 0 788c2ecf20Sopenharmony_ci#define WME_NUM_AC 4 798c2ecf20Sopenharmony_ci#define NUM_SOFT_QUEUES 6 808c2ecf20Sopenharmony_ci#define MAX_HW_QUEUES 12 818c2ecf20Sopenharmony_ci#define INVALID_QUEUE 0xff 828c2ecf20Sopenharmony_ci#define MAX_CONTINUOUS_VO_PKTS 8 838c2ecf20Sopenharmony_ci#define MAX_CONTINUOUS_VI_PKTS 4 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci/* Hardware queue info */ 868c2ecf20Sopenharmony_ci#define BROADCAST_HW_Q 9 878c2ecf20Sopenharmony_ci#define MGMT_HW_Q 10 888c2ecf20Sopenharmony_ci#define BEACON_HW_Q 11 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#define IEEE80211_MGMT_FRAME 0x00 918c2ecf20Sopenharmony_ci#define IEEE80211_CTL_FRAME 0x04 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#define RSI_MAX_ASSOC_STAS 32 948c2ecf20Sopenharmony_ci#define IEEE80211_QOS_TID 0x0f 958c2ecf20Sopenharmony_ci#define IEEE80211_NONQOS_TID 16 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci#define MAX_DEBUGFS_ENTRIES 4 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci#define TID_TO_WME_AC(_tid) ( \ 1008c2ecf20Sopenharmony_ci ((_tid) == 0 || (_tid) == 3) ? BE_Q : \ 1018c2ecf20Sopenharmony_ci ((_tid) < 3) ? BK_Q : \ 1028c2ecf20Sopenharmony_ci ((_tid) < 6) ? VI_Q : \ 1038c2ecf20Sopenharmony_ci VO_Q) 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci#define WME_AC(_q) ( \ 1068c2ecf20Sopenharmony_ci ((_q) == BK_Q) ? IEEE80211_AC_BK : \ 1078c2ecf20Sopenharmony_ci ((_q) == BE_Q) ? IEEE80211_AC_BE : \ 1088c2ecf20Sopenharmony_ci ((_q) == VI_Q) ? IEEE80211_AC_VI : \ 1098c2ecf20Sopenharmony_ci IEEE80211_AC_VO) 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci/* WoWLAN flags */ 1128c2ecf20Sopenharmony_ci#define RSI_WOW_ENABLED BIT(0) 1138c2ecf20Sopenharmony_ci#define RSI_WOW_NO_CONNECTION BIT(1) 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci#define RSI_MAX_RX_PKTS 64 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_cienum rsi_dev_model { 1188c2ecf20Sopenharmony_ci RSI_DEV_9113 = 0, 1198c2ecf20Sopenharmony_ci RSI_DEV_9116 1208c2ecf20Sopenharmony_ci}; 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_cistruct version_info { 1238c2ecf20Sopenharmony_ci u16 major; 1248c2ecf20Sopenharmony_ci u16 minor; 1258c2ecf20Sopenharmony_ci u8 release_num; 1268c2ecf20Sopenharmony_ci u8 patch_num; 1278c2ecf20Sopenharmony_ci union { 1288c2ecf20Sopenharmony_ci struct { 1298c2ecf20Sopenharmony_ci u8 fw_ver[8]; 1308c2ecf20Sopenharmony_ci } info; 1318c2ecf20Sopenharmony_ci } ver; 1328c2ecf20Sopenharmony_ci} __packed; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_cistruct skb_info { 1358c2ecf20Sopenharmony_ci s8 rssi; 1368c2ecf20Sopenharmony_ci u32 flags; 1378c2ecf20Sopenharmony_ci u16 channel; 1388c2ecf20Sopenharmony_ci s8 tid; 1398c2ecf20Sopenharmony_ci s8 sta_id; 1408c2ecf20Sopenharmony_ci u8 internal_hdr_size; 1418c2ecf20Sopenharmony_ci struct ieee80211_vif *vif; 1428c2ecf20Sopenharmony_ci u8 vap_id; 1438c2ecf20Sopenharmony_ci bool have_key; 1448c2ecf20Sopenharmony_ci}; 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_cienum edca_queue { 1478c2ecf20Sopenharmony_ci BK_Q, 1488c2ecf20Sopenharmony_ci BE_Q, 1498c2ecf20Sopenharmony_ci VI_Q, 1508c2ecf20Sopenharmony_ci VO_Q, 1518c2ecf20Sopenharmony_ci MGMT_SOFT_Q, 1528c2ecf20Sopenharmony_ci MGMT_BEACON_Q 1538c2ecf20Sopenharmony_ci}; 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_cistruct security_info { 1568c2ecf20Sopenharmony_ci u32 ptk_cipher; 1578c2ecf20Sopenharmony_ci u32 gtk_cipher; 1588c2ecf20Sopenharmony_ci}; 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_cistruct wmm_qinfo { 1618c2ecf20Sopenharmony_ci s32 weight; 1628c2ecf20Sopenharmony_ci s32 wme_params; 1638c2ecf20Sopenharmony_ci s32 pkt_contended; 1648c2ecf20Sopenharmony_ci s32 txop; 1658c2ecf20Sopenharmony_ci}; 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_cistruct transmit_q_stats { 1688c2ecf20Sopenharmony_ci u32 total_tx_pkt_send[NUM_EDCA_QUEUES + 2]; 1698c2ecf20Sopenharmony_ci u32 total_tx_pkt_freed[NUM_EDCA_QUEUES + 2]; 1708c2ecf20Sopenharmony_ci}; 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci#define MAX_BGSCAN_CHANNELS_DUAL_BAND 38 1738c2ecf20Sopenharmony_ci#define MAX_BGSCAN_PROBE_REQ_LEN 0x64 1748c2ecf20Sopenharmony_ci#define RSI_DEF_BGSCAN_THRLD 0x0 1758c2ecf20Sopenharmony_ci#define RSI_DEF_ROAM_THRLD 0xa 1768c2ecf20Sopenharmony_ci#define RSI_BGSCAN_PERIODICITY 0x1e 1778c2ecf20Sopenharmony_ci#define RSI_ACTIVE_SCAN_TIME 0x14 1788c2ecf20Sopenharmony_ci#define RSI_PASSIVE_SCAN_TIME 0x46 1798c2ecf20Sopenharmony_ci#define RSI_CHANNEL_SCAN_TIME 20 1808c2ecf20Sopenharmony_cistruct rsi_bgscan_params { 1818c2ecf20Sopenharmony_ci u16 bgscan_threshold; 1828c2ecf20Sopenharmony_ci u16 roam_threshold; 1838c2ecf20Sopenharmony_ci u16 bgscan_periodicity; 1848c2ecf20Sopenharmony_ci u8 num_bgscan_channels; 1858c2ecf20Sopenharmony_ci u8 two_probe; 1868c2ecf20Sopenharmony_ci u16 active_scan_duration; 1878c2ecf20Sopenharmony_ci u16 passive_scan_duration; 1888c2ecf20Sopenharmony_ci}; 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_cistruct vif_priv { 1918c2ecf20Sopenharmony_ci bool is_ht; 1928c2ecf20Sopenharmony_ci bool sgi; 1938c2ecf20Sopenharmony_ci u16 seq_start; 1948c2ecf20Sopenharmony_ci int vap_id; 1958c2ecf20Sopenharmony_ci}; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_cistruct rsi_event { 1988c2ecf20Sopenharmony_ci atomic_t event_condition; 1998c2ecf20Sopenharmony_ci wait_queue_head_t event_queue; 2008c2ecf20Sopenharmony_ci}; 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_cistruct rsi_thread { 2038c2ecf20Sopenharmony_ci void (*thread_function)(void *); 2048c2ecf20Sopenharmony_ci struct completion completion; 2058c2ecf20Sopenharmony_ci struct task_struct *task; 2068c2ecf20Sopenharmony_ci struct rsi_event event; 2078c2ecf20Sopenharmony_ci atomic_t thread_done; 2088c2ecf20Sopenharmony_ci}; 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_cistruct cqm_info { 2118c2ecf20Sopenharmony_ci s8 last_cqm_event_rssi; 2128c2ecf20Sopenharmony_ci int rssi_thold; 2138c2ecf20Sopenharmony_ci u32 rssi_hyst; 2148c2ecf20Sopenharmony_ci}; 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_cienum rsi_dfs_regions { 2178c2ecf20Sopenharmony_ci RSI_REGION_FCC = 0, 2188c2ecf20Sopenharmony_ci RSI_REGION_ETSI, 2198c2ecf20Sopenharmony_ci RSI_REGION_TELEC, 2208c2ecf20Sopenharmony_ci RSI_REGION_WORLD 2218c2ecf20Sopenharmony_ci}; 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_cistruct rsi_9116_features { 2248c2ecf20Sopenharmony_ci u8 pll_mode; 2258c2ecf20Sopenharmony_ci u8 rf_type; 2268c2ecf20Sopenharmony_ci u8 wireless_mode; 2278c2ecf20Sopenharmony_ci u8 afe_type; 2288c2ecf20Sopenharmony_ci u8 enable_ppe; 2298c2ecf20Sopenharmony_ci u8 dpd; 2308c2ecf20Sopenharmony_ci u32 sifs_tx_enable; 2318c2ecf20Sopenharmony_ci u32 ps_options; 2328c2ecf20Sopenharmony_ci}; 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_cistruct rsi_rate_config { 2358c2ecf20Sopenharmony_ci u32 configured_mask; /* configured by mac80211 bits 0-11=legacy 12+ mcs */ 2368c2ecf20Sopenharmony_ci u16 fixed_hw_rate; 2378c2ecf20Sopenharmony_ci bool fixed_enabled; 2388c2ecf20Sopenharmony_ci}; 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_cistruct rsi_common { 2418c2ecf20Sopenharmony_ci struct rsi_hw *priv; 2428c2ecf20Sopenharmony_ci struct vif_priv vif_info[RSI_MAX_VIFS]; 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci void *coex_cb; 2458c2ecf20Sopenharmony_ci bool mgmt_q_block; 2468c2ecf20Sopenharmony_ci struct version_info lmac_ver; 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci struct rsi_thread tx_thread; 2498c2ecf20Sopenharmony_ci struct sk_buff_head tx_queue[NUM_EDCA_QUEUES + 2]; 2508c2ecf20Sopenharmony_ci struct completion wlan_init_completion; 2518c2ecf20Sopenharmony_ci /* Mutex declaration */ 2528c2ecf20Sopenharmony_ci struct mutex mutex; 2538c2ecf20Sopenharmony_ci /* Mutex used for tx thread */ 2548c2ecf20Sopenharmony_ci struct mutex tx_lock; 2558c2ecf20Sopenharmony_ci /* Mutex used for rx thread */ 2568c2ecf20Sopenharmony_ci struct mutex rx_lock; 2578c2ecf20Sopenharmony_ci u8 endpoint; 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci /* Channel/band related */ 2608c2ecf20Sopenharmony_ci u8 band; 2618c2ecf20Sopenharmony_ci u8 num_supp_bands; 2628c2ecf20Sopenharmony_ci u8 channel_width; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci u16 rts_threshold; 2658c2ecf20Sopenharmony_ci u32 bitrate_mask[RSI_MAX_BANDS]; 2668c2ecf20Sopenharmony_ci struct rsi_rate_config rate_config[RSI_MAX_BANDS]; 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci u8 rf_reset; 2698c2ecf20Sopenharmony_ci struct transmit_q_stats tx_stats; 2708c2ecf20Sopenharmony_ci struct security_info secinfo; 2718c2ecf20Sopenharmony_ci struct wmm_qinfo tx_qinfo[NUM_EDCA_QUEUES]; 2728c2ecf20Sopenharmony_ci struct ieee80211_tx_queue_params edca_params[NUM_EDCA_QUEUES]; 2738c2ecf20Sopenharmony_ci u8 mac_addr[IEEE80211_ADDR_LEN]; 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci /* state related */ 2768c2ecf20Sopenharmony_ci u32 fsm_state; 2778c2ecf20Sopenharmony_ci bool init_done; 2788c2ecf20Sopenharmony_ci u8 bb_rf_prog_count; 2798c2ecf20Sopenharmony_ci bool iface_down; 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci /* Generic */ 2828c2ecf20Sopenharmony_ci u8 channel; 2838c2ecf20Sopenharmony_ci u8 *rx_data_pkt; 2848c2ecf20Sopenharmony_ci u8 mac_id; 2858c2ecf20Sopenharmony_ci u8 radio_id; 2868c2ecf20Sopenharmony_ci u16 rate_pwr[20]; 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci /* WMM algo related */ 2898c2ecf20Sopenharmony_ci u8 selected_qnum; 2908c2ecf20Sopenharmony_ci u32 pkt_cnt; 2918c2ecf20Sopenharmony_ci u8 min_weight; 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci /* bgscan related */ 2948c2ecf20Sopenharmony_ci struct cqm_info cqm_info; 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci bool hw_data_qs_blocked; 2978c2ecf20Sopenharmony_ci u8 driver_mode; 2988c2ecf20Sopenharmony_ci u8 coex_mode; 2998c2ecf20Sopenharmony_ci u16 oper_mode; 3008c2ecf20Sopenharmony_ci u8 lp_ps_handshake_mode; 3018c2ecf20Sopenharmony_ci u8 ulp_ps_handshake_mode; 3028c2ecf20Sopenharmony_ci u8 uapsd_bitmap; 3038c2ecf20Sopenharmony_ci u8 rf_power_val; 3048c2ecf20Sopenharmony_ci u8 wlan_rf_power_mode; 3058c2ecf20Sopenharmony_ci u8 obm_ant_sel_val; 3068c2ecf20Sopenharmony_ci int tx_power; 3078c2ecf20Sopenharmony_ci u8 ant_in_use; 3088c2ecf20Sopenharmony_ci /* Mutex used for writing packet to bus */ 3098c2ecf20Sopenharmony_ci struct mutex tx_bus_mutex; 3108c2ecf20Sopenharmony_ci bool hibernate_resume; 3118c2ecf20Sopenharmony_ci bool reinit_hw; 3128c2ecf20Sopenharmony_ci u8 wow_flags; 3138c2ecf20Sopenharmony_ci u16 beacon_interval; 3148c2ecf20Sopenharmony_ci u8 dtim_cnt; 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci /* AP mode parameters */ 3178c2ecf20Sopenharmony_ci u8 beacon_enabled; 3188c2ecf20Sopenharmony_ci u16 beacon_cnt; 3198c2ecf20Sopenharmony_ci struct rsi_sta stations[RSI_MAX_ASSOC_STAS + 1]; 3208c2ecf20Sopenharmony_ci int num_stations; 3218c2ecf20Sopenharmony_ci int max_stations; 3228c2ecf20Sopenharmony_ci struct ieee80211_key_conf *key; 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_ci /* Wi-Fi direct mode related */ 3258c2ecf20Sopenharmony_ci bool p2p_enabled; 3268c2ecf20Sopenharmony_ci struct timer_list roc_timer; 3278c2ecf20Sopenharmony_ci struct ieee80211_vif *roc_vif; 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci bool eapol4_confirm; 3308c2ecf20Sopenharmony_ci bool bt_defer_attach; 3318c2ecf20Sopenharmony_ci void *bt_adapter; 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci struct cfg80211_scan_request *hwscan; 3348c2ecf20Sopenharmony_ci struct rsi_bgscan_params bgscan; 3358c2ecf20Sopenharmony_ci struct rsi_9116_features w9116_features; 3368c2ecf20Sopenharmony_ci u8 bgscan_en; 3378c2ecf20Sopenharmony_ci u8 mac_ops_resumed; 3388c2ecf20Sopenharmony_ci}; 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_cistruct eepromrw_info { 3418c2ecf20Sopenharmony_ci u32 offset; 3428c2ecf20Sopenharmony_ci u32 length; 3438c2ecf20Sopenharmony_ci u8 write; 3448c2ecf20Sopenharmony_ci u16 eeprom_erase; 3458c2ecf20Sopenharmony_ci u8 data[480]; 3468c2ecf20Sopenharmony_ci}; 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_cistruct eeprom_read { 3498c2ecf20Sopenharmony_ci u16 length; 3508c2ecf20Sopenharmony_ci u16 off_set; 3518c2ecf20Sopenharmony_ci}; 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_cistruct rsi_hw { 3548c2ecf20Sopenharmony_ci struct rsi_common *priv; 3558c2ecf20Sopenharmony_ci enum rsi_dev_model device_model; 3568c2ecf20Sopenharmony_ci struct ieee80211_hw *hw; 3578c2ecf20Sopenharmony_ci struct ieee80211_vif *vifs[RSI_MAX_VIFS]; 3588c2ecf20Sopenharmony_ci struct ieee80211_tx_queue_params edca_params[NUM_EDCA_QUEUES]; 3598c2ecf20Sopenharmony_ci struct ieee80211_supported_band sbands[NUM_NL80211_BANDS]; 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_ci struct device *device; 3628c2ecf20Sopenharmony_ci u8 sc_nvifs; 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ci enum rsi_host_intf rsi_host_intf; 3658c2ecf20Sopenharmony_ci u16 block_size; 3668c2ecf20Sopenharmony_ci enum ps_state ps_state; 3678c2ecf20Sopenharmony_ci struct rsi_ps_info ps_info; 3688c2ecf20Sopenharmony_ci spinlock_t ps_lock; /*To protect power save config*/ 3698c2ecf20Sopenharmony_ci u32 usb_buffer_status_reg; 3708c2ecf20Sopenharmony_ci#ifdef CONFIG_RSI_DEBUGFS 3718c2ecf20Sopenharmony_ci struct rsi_debugfs *dfsentry; 3728c2ecf20Sopenharmony_ci u8 num_debugfs_entries; 3738c2ecf20Sopenharmony_ci#endif 3748c2ecf20Sopenharmony_ci char *fw_file_name; 3758c2ecf20Sopenharmony_ci struct timer_list bl_cmd_timer; 3768c2ecf20Sopenharmony_ci bool blcmd_timer_expired; 3778c2ecf20Sopenharmony_ci u32 flash_capacity; 3788c2ecf20Sopenharmony_ci struct eepromrw_info eeprom; 3798c2ecf20Sopenharmony_ci u32 interrupt_status; 3808c2ecf20Sopenharmony_ci u8 dfs_region; 3818c2ecf20Sopenharmony_ci char country[2]; 3828c2ecf20Sopenharmony_ci void *rsi_dev; 3838c2ecf20Sopenharmony_ci struct rsi_host_intf_ops *host_intf_ops; 3848c2ecf20Sopenharmony_ci int (*check_hw_queue_status)(struct rsi_hw *adapter, u8 q_num); 3858c2ecf20Sopenharmony_ci int (*determine_event_timeout)(struct rsi_hw *adapter); 3868c2ecf20Sopenharmony_ci}; 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_civoid rsi_print_version(struct rsi_common *common); 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_cistruct rsi_host_intf_ops { 3918c2ecf20Sopenharmony_ci int (*read_pkt)(struct rsi_hw *adapter, u8 *pkt, u32 len); 3928c2ecf20Sopenharmony_ci int (*write_pkt)(struct rsi_hw *adapter, u8 *pkt, u32 len); 3938c2ecf20Sopenharmony_ci int (*master_access_msword)(struct rsi_hw *adapter, u16 ms_word); 3948c2ecf20Sopenharmony_ci int (*read_reg_multiple)(struct rsi_hw *adapter, u32 addr, 3958c2ecf20Sopenharmony_ci u8 *data, u16 count); 3968c2ecf20Sopenharmony_ci int (*write_reg_multiple)(struct rsi_hw *adapter, u32 addr, 3978c2ecf20Sopenharmony_ci u8 *data, u16 count); 3988c2ecf20Sopenharmony_ci int (*master_reg_read)(struct rsi_hw *adapter, u32 addr, 3998c2ecf20Sopenharmony_ci u32 *read_buf, u16 size); 4008c2ecf20Sopenharmony_ci int (*master_reg_write)(struct rsi_hw *adapter, 4018c2ecf20Sopenharmony_ci unsigned long addr, unsigned long data, 4028c2ecf20Sopenharmony_ci u16 size); 4038c2ecf20Sopenharmony_ci int (*load_data_master_write)(struct rsi_hw *adapter, u32 addr, 4048c2ecf20Sopenharmony_ci u32 instructions_size, u16 block_size, 4058c2ecf20Sopenharmony_ci u8 *fw); 4068c2ecf20Sopenharmony_ci int (*reinit_device)(struct rsi_hw *adapter); 4078c2ecf20Sopenharmony_ci int (*ta_reset)(struct rsi_hw *adapter); 4088c2ecf20Sopenharmony_ci}; 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_cienum rsi_host_intf rsi_get_host_intf(void *priv); 4118c2ecf20Sopenharmony_civoid rsi_set_bt_context(void *priv, void *bt_context); 4128c2ecf20Sopenharmony_civoid rsi_attach_bt(struct rsi_common *common); 4138c2ecf20Sopenharmony_ci 4148c2ecf20Sopenharmony_ci#endif 415