18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ISC */ 28c2ecf20Sopenharmony_ci/* Copyright (C) 2019 MediaTek Inc. */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef __MT7615_H 58c2ecf20Sopenharmony_ci#define __MT7615_H 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/completion.h> 88c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 98c2ecf20Sopenharmony_ci#include <linux/ktime.h> 108c2ecf20Sopenharmony_ci#include <linux/regmap.h> 118c2ecf20Sopenharmony_ci#include "../mt76.h" 128c2ecf20Sopenharmony_ci#include "regs.h" 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define MT7615_MAX_INTERFACES 4 158c2ecf20Sopenharmony_ci#define MT7615_MAX_WMM_SETS 4 168c2ecf20Sopenharmony_ci#define MT7663_WTBL_SIZE 32 178c2ecf20Sopenharmony_ci#define MT7615_WTBL_SIZE 128 188c2ecf20Sopenharmony_ci#define MT7615_WTBL_RESERVED (mt7615_wtbl_size(dev) - 1) 198c2ecf20Sopenharmony_ci#define MT7615_WTBL_STA (MT7615_WTBL_RESERVED - \ 208c2ecf20Sopenharmony_ci MT7615_MAX_INTERFACES) 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define MT7615_PM_TIMEOUT (HZ / 12) 238c2ecf20Sopenharmony_ci#define MT7615_WATCHDOG_TIME (HZ / 10) 248c2ecf20Sopenharmony_ci#define MT7615_HW_SCAN_TIMEOUT (HZ / 10) 258c2ecf20Sopenharmony_ci#define MT7615_RESET_TIMEOUT (30 * HZ) 268c2ecf20Sopenharmony_ci#define MT7615_RATE_RETRY 2 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define MT7615_TX_RING_SIZE 1024 298c2ecf20Sopenharmony_ci#define MT7615_TX_MGMT_RING_SIZE 128 308c2ecf20Sopenharmony_ci#define MT7615_TX_MCU_RING_SIZE 128 318c2ecf20Sopenharmony_ci#define MT7615_TX_FWDL_RING_SIZE 128 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#define MT7615_RX_RING_SIZE 1024 348c2ecf20Sopenharmony_ci#define MT7615_RX_MCU_RING_SIZE 512 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#define MT7615_DRV_OWN_RETRY_COUNT 10 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define MT7615_FIRMWARE_CR4 "mediatek/mt7615_cr4.bin" 398c2ecf20Sopenharmony_ci#define MT7615_FIRMWARE_N9 "mediatek/mt7615_n9.bin" 408c2ecf20Sopenharmony_ci#define MT7615_ROM_PATCH "mediatek/mt7615_rom_patch.bin" 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define MT7622_FIRMWARE_N9 "mediatek/mt7622_n9.bin" 438c2ecf20Sopenharmony_ci#define MT7622_ROM_PATCH "mediatek/mt7622_rom_patch.bin" 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#define MT7615_FIRMWARE_V1 1 468c2ecf20Sopenharmony_ci#define MT7615_FIRMWARE_V2 2 478c2ecf20Sopenharmony_ci#define MT7615_FIRMWARE_V3 3 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#define MT7663_OFFLOAD_ROM_PATCH "mediatek/mt7663pr2h.bin" 508c2ecf20Sopenharmony_ci#define MT7663_OFFLOAD_FIRMWARE_N9 "mediatek/mt7663_n9_v3.bin" 518c2ecf20Sopenharmony_ci#define MT7663_ROM_PATCH "mediatek/mt7663pr2h_rebb.bin" 528c2ecf20Sopenharmony_ci#define MT7663_FIRMWARE_N9 "mediatek/mt7663_n9_rebb.bin" 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define MT7615_EEPROM_SIZE 1024 558c2ecf20Sopenharmony_ci#define MT7615_TOKEN_SIZE 4096 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define MT_FRAC_SCALE 12 588c2ecf20Sopenharmony_ci#define MT_FRAC(val, div) (((val) << MT_FRAC_SCALE) / (div)) 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define MT_CHFREQ_VALID BIT(7) 618c2ecf20Sopenharmony_ci#define MT_CHFREQ_DBDC_IDX BIT(6) 628c2ecf20Sopenharmony_ci#define MT_CHFREQ_SEQ GENMASK(5, 0) 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define MT7615_BAR_RATE_DEFAULT 0x4b /* OFDM 6M */ 658c2ecf20Sopenharmony_ci#define MT7615_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */ 668c2ecf20Sopenharmony_ci#define MT7615_CFEND_RATE_11B 0x03 /* 11B LP, 11M */ 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci#define MT7615_SCAN_IE_LEN 600 698c2ecf20Sopenharmony_ci#define MT7615_MAX_SCHED_SCAN_INTERVAL 10 708c2ecf20Sopenharmony_ci#define MT7615_MAX_SCHED_SCAN_SSID 10 718c2ecf20Sopenharmony_ci#define MT7615_MAX_SCAN_MATCH 16 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_cistruct mt7615_vif; 748c2ecf20Sopenharmony_cistruct mt7615_sta; 758c2ecf20Sopenharmony_cistruct mt7615_dfs_pulse; 768c2ecf20Sopenharmony_cistruct mt7615_dfs_pattern; 778c2ecf20Sopenharmony_cienum mt7615_cipher_type; 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_cienum mt7615_hw_txq_id { 808c2ecf20Sopenharmony_ci MT7615_TXQ_MAIN, 818c2ecf20Sopenharmony_ci MT7615_TXQ_EXT, 828c2ecf20Sopenharmony_ci MT7615_TXQ_MCU, 838c2ecf20Sopenharmony_ci MT7615_TXQ_FWDL, 848c2ecf20Sopenharmony_ci}; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_cienum mt7622_hw_txq_id { 878c2ecf20Sopenharmony_ci MT7622_TXQ_AC0, 888c2ecf20Sopenharmony_ci MT7622_TXQ_AC1, 898c2ecf20Sopenharmony_ci MT7622_TXQ_AC2, 908c2ecf20Sopenharmony_ci MT7622_TXQ_FWDL = MT7615_TXQ_FWDL, 918c2ecf20Sopenharmony_ci MT7622_TXQ_AC3, 928c2ecf20Sopenharmony_ci MT7622_TXQ_MGMT, 938c2ecf20Sopenharmony_ci MT7622_TXQ_MCU = 15, 948c2ecf20Sopenharmony_ci}; 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_cistruct mt7615_rate_set { 978c2ecf20Sopenharmony_ci struct ieee80211_tx_rate probe_rate; 988c2ecf20Sopenharmony_ci struct ieee80211_tx_rate rates[4]; 998c2ecf20Sopenharmony_ci}; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_cistruct mt7615_rate_desc { 1028c2ecf20Sopenharmony_ci bool rateset; 1038c2ecf20Sopenharmony_ci u16 probe_val; 1048c2ecf20Sopenharmony_ci u16 val[4]; 1058c2ecf20Sopenharmony_ci u8 bw_idx; 1068c2ecf20Sopenharmony_ci u8 bw; 1078c2ecf20Sopenharmony_ci}; 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_cienum mt7615_wtbl_desc_type { 1108c2ecf20Sopenharmony_ci MT7615_WTBL_RATE_DESC, 1118c2ecf20Sopenharmony_ci MT7615_WTBL_KEY_DESC 1128c2ecf20Sopenharmony_ci}; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_cistruct mt7615_key_desc { 1158c2ecf20Sopenharmony_ci enum set_key_cmd cmd; 1168c2ecf20Sopenharmony_ci u32 cipher; 1178c2ecf20Sopenharmony_ci s8 keyidx; 1188c2ecf20Sopenharmony_ci u8 keylen; 1198c2ecf20Sopenharmony_ci u8 *key; 1208c2ecf20Sopenharmony_ci}; 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_cistruct mt7615_wtbl_desc { 1238c2ecf20Sopenharmony_ci struct list_head node; 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci enum mt7615_wtbl_desc_type type; 1268c2ecf20Sopenharmony_ci struct mt7615_sta *sta; 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci union { 1298c2ecf20Sopenharmony_ci struct mt7615_rate_desc rate; 1308c2ecf20Sopenharmony_ci struct mt7615_key_desc key; 1318c2ecf20Sopenharmony_ci }; 1328c2ecf20Sopenharmony_ci}; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_cistruct mt7615_sta { 1358c2ecf20Sopenharmony_ci struct mt76_wcid wcid; /* must be first */ 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci struct mt7615_vif *vif; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci struct list_head poll_list; 1408c2ecf20Sopenharmony_ci u32 airtime_ac[8]; 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci struct ieee80211_tx_rate rates[4]; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci struct mt7615_rate_set rateset[2]; 1458c2ecf20Sopenharmony_ci u32 rate_set_tsf; 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci u8 rate_count; 1488c2ecf20Sopenharmony_ci u8 n_rates; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci u8 rate_probe; 1518c2ecf20Sopenharmony_ci}; 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_cistruct mt7615_vif { 1548c2ecf20Sopenharmony_ci u8 idx; 1558c2ecf20Sopenharmony_ci u8 omac_idx; 1568c2ecf20Sopenharmony_ci u8 band_idx; 1578c2ecf20Sopenharmony_ci u8 wmm_idx; 1588c2ecf20Sopenharmony_ci u8 scan_seq_num; 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci struct mt7615_sta sta; 1618c2ecf20Sopenharmony_ci}; 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_cistruct mib_stats { 1648c2ecf20Sopenharmony_ci u32 ack_fail_cnt; 1658c2ecf20Sopenharmony_ci u32 fcs_err_cnt; 1668c2ecf20Sopenharmony_ci u32 rts_cnt; 1678c2ecf20Sopenharmony_ci u32 rts_retries_cnt; 1688c2ecf20Sopenharmony_ci u32 ba_miss_cnt; 1698c2ecf20Sopenharmony_ci unsigned long aggr_per; 1708c2ecf20Sopenharmony_ci}; 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_cistruct mt7615_phy { 1738c2ecf20Sopenharmony_ci struct mt76_phy *mt76; 1748c2ecf20Sopenharmony_ci struct mt7615_dev *dev; 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci struct ieee80211_vif *monitor_vif; 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci u32 rxfilter; 1798c2ecf20Sopenharmony_ci u32 omac_mask; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci u16 noise; 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci bool scs_en; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci unsigned long last_cca_adj; 1868c2ecf20Sopenharmony_ci int false_cca_ofdm, false_cca_cck; 1878c2ecf20Sopenharmony_ci s8 ofdm_sensitivity; 1888c2ecf20Sopenharmony_ci s8 cck_sensitivity; 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci u16 chainmask; 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci s16 coverage_class; 1938c2ecf20Sopenharmony_ci u8 slottime; 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci u8 chfreq; 1968c2ecf20Sopenharmony_ci u8 rdd_state; 1978c2ecf20Sopenharmony_ci int dfs_state; 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci __le32 rx_ampdu_ts; 2008c2ecf20Sopenharmony_ci u32 ampdu_ref; 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_ci struct mib_stats mib; 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci struct delayed_work mac_work; 2058c2ecf20Sopenharmony_ci u8 mac_work_count; 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci struct sk_buff_head scan_event_list; 2088c2ecf20Sopenharmony_ci struct delayed_work scan_work; 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci struct work_struct roc_work; 2118c2ecf20Sopenharmony_ci struct timer_list roc_timer; 2128c2ecf20Sopenharmony_ci wait_queue_head_t roc_wait; 2138c2ecf20Sopenharmony_ci bool roc_grant; 2148c2ecf20Sopenharmony_ci}; 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci#define mt7615_mcu_add_tx_ba(dev, ...) (dev)->mcu_ops->add_tx_ba((dev), __VA_ARGS__) 2178c2ecf20Sopenharmony_ci#define mt7615_mcu_add_rx_ba(dev, ...) (dev)->mcu_ops->add_rx_ba((dev), __VA_ARGS__) 2188c2ecf20Sopenharmony_ci#define mt7615_mcu_sta_add(dev, ...) (dev)->mcu_ops->sta_add((dev), __VA_ARGS__) 2198c2ecf20Sopenharmony_ci#define mt7615_mcu_add_dev_info(dev, ...) (dev)->mcu_ops->add_dev_info((dev), __VA_ARGS__) 2208c2ecf20Sopenharmony_ci#define mt7615_mcu_add_bss_info(phy, ...) (phy->dev)->mcu_ops->add_bss_info((phy), __VA_ARGS__) 2218c2ecf20Sopenharmony_ci#define mt7615_mcu_add_beacon(dev, ...) (dev)->mcu_ops->add_beacon_offload((dev), __VA_ARGS__) 2228c2ecf20Sopenharmony_ci#define mt7615_mcu_set_pm(dev, ...) (dev)->mcu_ops->set_pm_state((dev), __VA_ARGS__) 2238c2ecf20Sopenharmony_ci#define mt7615_mcu_set_drv_ctrl(dev) (dev)->mcu_ops->set_drv_ctrl((dev)) 2248c2ecf20Sopenharmony_ci#define mt7615_mcu_set_fw_ctrl(dev) (dev)->mcu_ops->set_fw_ctrl((dev)) 2258c2ecf20Sopenharmony_cistruct mt7615_mcu_ops { 2268c2ecf20Sopenharmony_ci int (*add_tx_ba)(struct mt7615_dev *dev, 2278c2ecf20Sopenharmony_ci struct ieee80211_ampdu_params *params, 2288c2ecf20Sopenharmony_ci bool enable); 2298c2ecf20Sopenharmony_ci int (*add_rx_ba)(struct mt7615_dev *dev, 2308c2ecf20Sopenharmony_ci struct ieee80211_ampdu_params *params, 2318c2ecf20Sopenharmony_ci bool enable); 2328c2ecf20Sopenharmony_ci int (*sta_add)(struct mt7615_dev *dev, 2338c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 2348c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, bool enable); 2358c2ecf20Sopenharmony_ci int (*add_dev_info)(struct mt7615_dev *dev, 2368c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, bool enable); 2378c2ecf20Sopenharmony_ci int (*add_bss_info)(struct mt7615_phy *phy, struct ieee80211_vif *vif, 2388c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, bool enable); 2398c2ecf20Sopenharmony_ci int (*add_beacon_offload)(struct mt7615_dev *dev, 2408c2ecf20Sopenharmony_ci struct ieee80211_hw *hw, 2418c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, bool enable); 2428c2ecf20Sopenharmony_ci int (*set_pm_state)(struct mt7615_dev *dev, int band, int state); 2438c2ecf20Sopenharmony_ci int (*set_drv_ctrl)(struct mt7615_dev *dev); 2448c2ecf20Sopenharmony_ci int (*set_fw_ctrl)(struct mt7615_dev *dev); 2458c2ecf20Sopenharmony_ci}; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_cistruct mt7615_dev { 2488c2ecf20Sopenharmony_ci union { /* must be first */ 2498c2ecf20Sopenharmony_ci struct mt76_dev mt76; 2508c2ecf20Sopenharmony_ci struct mt76_phy mphy; 2518c2ecf20Sopenharmony_ci }; 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci const struct mt76_bus_ops *bus_ops; 2548c2ecf20Sopenharmony_ci struct tasklet_struct irq_tasklet; 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci struct mt7615_phy phy; 2578c2ecf20Sopenharmony_ci u32 omac_mask; 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci u16 chainmask; 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci struct ieee80211_ops *ops; 2628c2ecf20Sopenharmony_ci const struct mt7615_mcu_ops *mcu_ops; 2638c2ecf20Sopenharmony_ci struct regmap *infracfg; 2648c2ecf20Sopenharmony_ci const u32 *reg_map; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci struct work_struct mcu_work; 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci struct work_struct reset_work; 2698c2ecf20Sopenharmony_ci wait_queue_head_t reset_wait; 2708c2ecf20Sopenharmony_ci u32 reset_state; 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci struct list_head sta_poll_list; 2738c2ecf20Sopenharmony_ci spinlock_t sta_poll_lock; 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci struct { 2768c2ecf20Sopenharmony_ci u8 n_pulses; 2778c2ecf20Sopenharmony_ci u32 period; 2788c2ecf20Sopenharmony_ci u16 width; 2798c2ecf20Sopenharmony_ci s16 power; 2808c2ecf20Sopenharmony_ci } radar_pattern; 2818c2ecf20Sopenharmony_ci u32 hw_pattern; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci bool fw_debug; 2848c2ecf20Sopenharmony_ci bool flash_eeprom; 2858c2ecf20Sopenharmony_ci bool dbdc_support; 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci spinlock_t token_lock; 2888c2ecf20Sopenharmony_ci struct idr token; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci u8 fw_ver; 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci struct work_struct wtbl_work; 2938c2ecf20Sopenharmony_ci struct list_head wd_head; 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci u32 debugfs_rf_wf; 2968c2ecf20Sopenharmony_ci u32 debugfs_rf_reg; 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci#ifdef CONFIG_NL80211_TESTMODE 2998c2ecf20Sopenharmony_ci struct { 3008c2ecf20Sopenharmony_ci u32 *reg_backup; 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_ci s16 last_freq_offset; 3038c2ecf20Sopenharmony_ci u8 last_rcpi[4]; 3048c2ecf20Sopenharmony_ci s8 last_ib_rssi; 3058c2ecf20Sopenharmony_ci s8 last_wb_rssi; 3068c2ecf20Sopenharmony_ci } test; 3078c2ecf20Sopenharmony_ci#endif 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_ci struct { 3108c2ecf20Sopenharmony_ci bool enable; 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci spinlock_t txq_lock; 3138c2ecf20Sopenharmony_ci struct { 3148c2ecf20Sopenharmony_ci struct mt7615_sta *msta; 3158c2ecf20Sopenharmony_ci struct sk_buff *skb; 3168c2ecf20Sopenharmony_ci } tx_q[IEEE80211_NUM_ACS]; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci struct work_struct wake_work; 3198c2ecf20Sopenharmony_ci struct completion wake_cmpl; 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci struct delayed_work ps_work; 3228c2ecf20Sopenharmony_ci unsigned long last_activity; 3238c2ecf20Sopenharmony_ci unsigned long idle_timeout; 3248c2ecf20Sopenharmony_ci } pm; 3258c2ecf20Sopenharmony_ci}; 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_cienum tx_pkt_queue_idx { 3288c2ecf20Sopenharmony_ci MT_LMAC_AC00, 3298c2ecf20Sopenharmony_ci MT_LMAC_AC01, 3308c2ecf20Sopenharmony_ci MT_LMAC_AC02, 3318c2ecf20Sopenharmony_ci MT_LMAC_AC03, 3328c2ecf20Sopenharmony_ci MT_LMAC_ALTX0 = 0x10, 3338c2ecf20Sopenharmony_ci MT_LMAC_BMC0, 3348c2ecf20Sopenharmony_ci MT_LMAC_BCN0, 3358c2ecf20Sopenharmony_ci MT_LMAC_PSMP0, 3368c2ecf20Sopenharmony_ci MT_LMAC_ALTX1, 3378c2ecf20Sopenharmony_ci MT_LMAC_BMC1, 3388c2ecf20Sopenharmony_ci MT_LMAC_BCN1, 3398c2ecf20Sopenharmony_ci MT_LMAC_PSMP1, 3408c2ecf20Sopenharmony_ci}; 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_cienum { 3438c2ecf20Sopenharmony_ci HW_BSSID_0 = 0x0, 3448c2ecf20Sopenharmony_ci HW_BSSID_1, 3458c2ecf20Sopenharmony_ci HW_BSSID_2, 3468c2ecf20Sopenharmony_ci HW_BSSID_3, 3478c2ecf20Sopenharmony_ci HW_BSSID_MAX, 3488c2ecf20Sopenharmony_ci EXT_BSSID_START = 0x10, 3498c2ecf20Sopenharmony_ci EXT_BSSID_1, 3508c2ecf20Sopenharmony_ci EXT_BSSID_2, 3518c2ecf20Sopenharmony_ci EXT_BSSID_3, 3528c2ecf20Sopenharmony_ci EXT_BSSID_4, 3538c2ecf20Sopenharmony_ci EXT_BSSID_5, 3548c2ecf20Sopenharmony_ci EXT_BSSID_6, 3558c2ecf20Sopenharmony_ci EXT_BSSID_7, 3568c2ecf20Sopenharmony_ci EXT_BSSID_8, 3578c2ecf20Sopenharmony_ci EXT_BSSID_9, 3588c2ecf20Sopenharmony_ci EXT_BSSID_10, 3598c2ecf20Sopenharmony_ci EXT_BSSID_11, 3608c2ecf20Sopenharmony_ci EXT_BSSID_12, 3618c2ecf20Sopenharmony_ci EXT_BSSID_13, 3628c2ecf20Sopenharmony_ci EXT_BSSID_14, 3638c2ecf20Sopenharmony_ci EXT_BSSID_15, 3648c2ecf20Sopenharmony_ci EXT_BSSID_END 3658c2ecf20Sopenharmony_ci}; 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_cienum { 3688c2ecf20Sopenharmony_ci MT_RX_SEL0, 3698c2ecf20Sopenharmony_ci MT_RX_SEL1, 3708c2ecf20Sopenharmony_ci}; 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_cienum mt7615_rdd_cmd { 3738c2ecf20Sopenharmony_ci RDD_STOP, 3748c2ecf20Sopenharmony_ci RDD_START, 3758c2ecf20Sopenharmony_ci RDD_DET_MODE, 3768c2ecf20Sopenharmony_ci RDD_DET_STOP, 3778c2ecf20Sopenharmony_ci RDD_CAC_START, 3788c2ecf20Sopenharmony_ci RDD_CAC_END, 3798c2ecf20Sopenharmony_ci RDD_NORMAL_START, 3808c2ecf20Sopenharmony_ci RDD_DISABLE_DFS_CAL, 3818c2ecf20Sopenharmony_ci RDD_PULSE_DBG, 3828c2ecf20Sopenharmony_ci RDD_READ_PULSE, 3838c2ecf20Sopenharmony_ci RDD_RESUME_BF, 3848c2ecf20Sopenharmony_ci}; 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_cistatic inline struct mt7615_phy * 3878c2ecf20Sopenharmony_cimt7615_hw_phy(struct ieee80211_hw *hw) 3888c2ecf20Sopenharmony_ci{ 3898c2ecf20Sopenharmony_ci struct mt76_phy *phy = hw->priv; 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_ci return phy->priv; 3928c2ecf20Sopenharmony_ci} 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_cistatic inline struct mt7615_dev * 3958c2ecf20Sopenharmony_cimt7615_hw_dev(struct ieee80211_hw *hw) 3968c2ecf20Sopenharmony_ci{ 3978c2ecf20Sopenharmony_ci struct mt76_phy *phy = hw->priv; 3988c2ecf20Sopenharmony_ci 3998c2ecf20Sopenharmony_ci return container_of(phy->dev, struct mt7615_dev, mt76); 4008c2ecf20Sopenharmony_ci} 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_cistatic inline struct mt7615_phy * 4038c2ecf20Sopenharmony_cimt7615_ext_phy(struct mt7615_dev *dev) 4048c2ecf20Sopenharmony_ci{ 4058c2ecf20Sopenharmony_ci struct mt76_phy *phy = dev->mt76.phy2; 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_ci if (!phy) 4088c2ecf20Sopenharmony_ci return NULL; 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ci return phy->priv; 4118c2ecf20Sopenharmony_ci} 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_ciextern struct ieee80211_rate mt7615_rates[12]; 4148c2ecf20Sopenharmony_ciextern const struct ieee80211_ops mt7615_ops; 4158c2ecf20Sopenharmony_ciextern const u32 mt7615e_reg_map[__MT_BASE_MAX]; 4168c2ecf20Sopenharmony_ciextern const u32 mt7663e_reg_map[__MT_BASE_MAX]; 4178c2ecf20Sopenharmony_ciextern const u32 mt7663_usb_sdio_reg_map[__MT_BASE_MAX]; 4188c2ecf20Sopenharmony_ciextern struct pci_driver mt7615_pci_driver; 4198c2ecf20Sopenharmony_ciextern struct platform_driver mt7622_wmac_driver; 4208c2ecf20Sopenharmony_ciextern const struct mt76_testmode_ops mt7615_testmode_ops; 4218c2ecf20Sopenharmony_ci 4228c2ecf20Sopenharmony_ci#ifdef CONFIG_MT7622_WMAC 4238c2ecf20Sopenharmony_ciint mt7622_wmac_init(struct mt7615_dev *dev); 4248c2ecf20Sopenharmony_ci#else 4258c2ecf20Sopenharmony_cistatic inline int mt7622_wmac_init(struct mt7615_dev *dev) 4268c2ecf20Sopenharmony_ci{ 4278c2ecf20Sopenharmony_ci return 0; 4288c2ecf20Sopenharmony_ci} 4298c2ecf20Sopenharmony_ci#endif 4308c2ecf20Sopenharmony_ci 4318c2ecf20Sopenharmony_ciint mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base, 4328c2ecf20Sopenharmony_ci int irq, const u32 *map); 4338c2ecf20Sopenharmony_ciu32 mt7615_reg_map(struct mt7615_dev *dev, u32 addr); 4348c2ecf20Sopenharmony_ci 4358c2ecf20Sopenharmony_civoid mt7615_check_offload_capability(struct mt7615_dev *dev); 4368c2ecf20Sopenharmony_civoid mt7615_init_device(struct mt7615_dev *dev); 4378c2ecf20Sopenharmony_ciint mt7615_register_device(struct mt7615_dev *dev); 4388c2ecf20Sopenharmony_civoid mt7615_unregister_device(struct mt7615_dev *dev); 4398c2ecf20Sopenharmony_ciint mt7615_register_ext_phy(struct mt7615_dev *dev); 4408c2ecf20Sopenharmony_civoid mt7615_unregister_ext_phy(struct mt7615_dev *dev); 4418c2ecf20Sopenharmony_ciint mt7615_eeprom_init(struct mt7615_dev *dev, u32 addr); 4428c2ecf20Sopenharmony_ciint mt7615_eeprom_get_target_power_index(struct mt7615_dev *dev, 4438c2ecf20Sopenharmony_ci struct ieee80211_channel *chan, 4448c2ecf20Sopenharmony_ci u8 chain_idx); 4458c2ecf20Sopenharmony_ciint mt7615_eeprom_get_power_delta_index(struct mt7615_dev *dev, 4468c2ecf20Sopenharmony_ci enum nl80211_band band); 4478c2ecf20Sopenharmony_ciint mt7615_wait_pdma_busy(struct mt7615_dev *dev); 4488c2ecf20Sopenharmony_ciint mt7615_dma_init(struct mt7615_dev *dev); 4498c2ecf20Sopenharmony_civoid mt7615_dma_cleanup(struct mt7615_dev *dev); 4508c2ecf20Sopenharmony_ciint mt7615_mcu_init(struct mt7615_dev *dev); 4518c2ecf20Sopenharmony_cibool mt7615_wait_for_mcu_init(struct mt7615_dev *dev); 4528c2ecf20Sopenharmony_civoid mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta, 4538c2ecf20Sopenharmony_ci struct ieee80211_tx_rate *probe_rate, 4548c2ecf20Sopenharmony_ci struct ieee80211_tx_rate *rates); 4558c2ecf20Sopenharmony_ciint mt7615_pm_set_enable(struct mt7615_dev *dev, bool enable); 4568c2ecf20Sopenharmony_civoid mt7615_pm_wake_work(struct work_struct *work); 4578c2ecf20Sopenharmony_ciint mt7615_pm_wake(struct mt7615_dev *dev); 4588c2ecf20Sopenharmony_civoid mt7615_pm_power_save_sched(struct mt7615_dev *dev); 4598c2ecf20Sopenharmony_civoid mt7615_pm_power_save_work(struct work_struct *work); 4608c2ecf20Sopenharmony_ciint mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev); 4618c2ecf20Sopenharmony_ciint mt7615_mcu_set_chan_info(struct mt7615_phy *phy, int cmd); 4628c2ecf20Sopenharmony_ciint mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue, 4638c2ecf20Sopenharmony_ci const struct ieee80211_tx_queue_params *params); 4648c2ecf20Sopenharmony_civoid mt7615_mcu_rx_event(struct mt7615_dev *dev, struct sk_buff *skb); 4658c2ecf20Sopenharmony_ciint mt7615_mcu_rdd_cmd(struct mt7615_dev *dev, 4668c2ecf20Sopenharmony_ci enum mt7615_rdd_cmd cmd, u8 index, 4678c2ecf20Sopenharmony_ci u8 rx_sel, u8 val); 4688c2ecf20Sopenharmony_ciint mt7615_mcu_rdd_send_pattern(struct mt7615_dev *dev); 4698c2ecf20Sopenharmony_ciint mt7615_mcu_fw_log_2_host(struct mt7615_dev *dev, u8 ctrl); 4708c2ecf20Sopenharmony_ci 4718c2ecf20Sopenharmony_cistatic inline bool is_mt7622(struct mt76_dev *dev) 4728c2ecf20Sopenharmony_ci{ 4738c2ecf20Sopenharmony_ci if (!IS_ENABLED(CONFIG_MT7622_WMAC)) 4748c2ecf20Sopenharmony_ci return false; 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci return mt76_chip(dev) == 0x7622; 4778c2ecf20Sopenharmony_ci} 4788c2ecf20Sopenharmony_ci 4798c2ecf20Sopenharmony_cistatic inline bool is_mt7615(struct mt76_dev *dev) 4808c2ecf20Sopenharmony_ci{ 4818c2ecf20Sopenharmony_ci return mt76_chip(dev) == 0x7615 || mt76_chip(dev) == 0x7611; 4828c2ecf20Sopenharmony_ci} 4838c2ecf20Sopenharmony_ci 4848c2ecf20Sopenharmony_cistatic inline bool is_mt7663(struct mt76_dev *dev) 4858c2ecf20Sopenharmony_ci{ 4868c2ecf20Sopenharmony_ci return mt76_chip(dev) == 0x7663; 4878c2ecf20Sopenharmony_ci} 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_cistatic inline bool is_mt7611(struct mt76_dev *dev) 4908c2ecf20Sopenharmony_ci{ 4918c2ecf20Sopenharmony_ci return mt76_chip(dev) == 0x7611; 4928c2ecf20Sopenharmony_ci} 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_cistatic inline void mt7615_irq_enable(struct mt7615_dev *dev, u32 mask) 4958c2ecf20Sopenharmony_ci{ 4968c2ecf20Sopenharmony_ci mt76_set_irq_mask(&dev->mt76, 0, 0, mask); 4978c2ecf20Sopenharmony_ci 4988c2ecf20Sopenharmony_ci tasklet_schedule(&dev->irq_tasklet); 4998c2ecf20Sopenharmony_ci} 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_cistatic inline bool mt7615_firmware_offload(struct mt7615_dev *dev) 5028c2ecf20Sopenharmony_ci{ 5038c2ecf20Sopenharmony_ci return dev->fw_ver > MT7615_FIRMWARE_V2; 5048c2ecf20Sopenharmony_ci} 5058c2ecf20Sopenharmony_ci 5068c2ecf20Sopenharmony_cistatic inline u16 mt7615_wtbl_size(struct mt7615_dev *dev) 5078c2ecf20Sopenharmony_ci{ 5088c2ecf20Sopenharmony_ci if (is_mt7663(&dev->mt76) && mt7615_firmware_offload(dev)) 5098c2ecf20Sopenharmony_ci return MT7663_WTBL_SIZE; 5108c2ecf20Sopenharmony_ci else 5118c2ecf20Sopenharmony_ci return MT7615_WTBL_SIZE; 5128c2ecf20Sopenharmony_ci} 5138c2ecf20Sopenharmony_ci 5148c2ecf20Sopenharmony_cistatic inline void mt7615_mutex_acquire(struct mt7615_dev *dev) 5158c2ecf20Sopenharmony_ci __acquires(&dev->mt76.mutex) 5168c2ecf20Sopenharmony_ci{ 5178c2ecf20Sopenharmony_ci mutex_lock(&dev->mt76.mutex); 5188c2ecf20Sopenharmony_ci mt7615_pm_wake(dev); 5198c2ecf20Sopenharmony_ci} 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_cistatic inline void mt7615_mutex_release(struct mt7615_dev *dev) 5228c2ecf20Sopenharmony_ci __releases(&dev->mt76.mutex) 5238c2ecf20Sopenharmony_ci{ 5248c2ecf20Sopenharmony_ci mt7615_pm_power_save_sched(dev); 5258c2ecf20Sopenharmony_ci mutex_unlock(&dev->mt76.mutex); 5268c2ecf20Sopenharmony_ci} 5278c2ecf20Sopenharmony_ci 5288c2ecf20Sopenharmony_cistatic inline u8 mt7615_lmac_mapping(struct mt7615_dev *dev, u8 ac) 5298c2ecf20Sopenharmony_ci{ 5308c2ecf20Sopenharmony_ci static const u8 lmac_queue_map[] = { 5318c2ecf20Sopenharmony_ci [IEEE80211_AC_BK] = MT_LMAC_AC00, 5328c2ecf20Sopenharmony_ci [IEEE80211_AC_BE] = MT_LMAC_AC01, 5338c2ecf20Sopenharmony_ci [IEEE80211_AC_VI] = MT_LMAC_AC02, 5348c2ecf20Sopenharmony_ci [IEEE80211_AC_VO] = MT_LMAC_AC03, 5358c2ecf20Sopenharmony_ci }; 5368c2ecf20Sopenharmony_ci 5378c2ecf20Sopenharmony_ci if (WARN_ON_ONCE(ac >= ARRAY_SIZE(lmac_queue_map))) 5388c2ecf20Sopenharmony_ci return MT_LMAC_AC01; /* BE */ 5398c2ecf20Sopenharmony_ci 5408c2ecf20Sopenharmony_ci return lmac_queue_map[ac]; 5418c2ecf20Sopenharmony_ci} 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_cistatic inline u32 mt7615_tx_mcu_int_mask(struct mt7615_dev *dev) 5448c2ecf20Sopenharmony_ci{ 5458c2ecf20Sopenharmony_ci return MT_INT_TX_DONE(dev->mt76.q_tx[MT_TXQ_MCU]->hw_idx); 5468c2ecf20Sopenharmony_ci} 5478c2ecf20Sopenharmony_ci 5488c2ecf20Sopenharmony_civoid mt7615_dma_reset(struct mt7615_dev *dev); 5498c2ecf20Sopenharmony_civoid mt7615_scan_work(struct work_struct *work); 5508c2ecf20Sopenharmony_civoid mt7615_roc_work(struct work_struct *work); 5518c2ecf20Sopenharmony_civoid mt7615_roc_timer(struct timer_list *timer); 5528c2ecf20Sopenharmony_civoid mt7615_init_txpower(struct mt7615_dev *dev, 5538c2ecf20Sopenharmony_ci struct ieee80211_supported_band *sband); 5548c2ecf20Sopenharmony_civoid mt7615_phy_init(struct mt7615_dev *dev); 5558c2ecf20Sopenharmony_civoid mt7615_mac_init(struct mt7615_dev *dev); 5568c2ecf20Sopenharmony_ciint mt7615_set_channel(struct mt7615_phy *phy); 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ciint mt7615_mcu_restart(struct mt76_dev *dev); 5598c2ecf20Sopenharmony_civoid mt7615_update_channel(struct mt76_dev *mdev); 5608c2ecf20Sopenharmony_cibool mt7615_mac_wtbl_update(struct mt7615_dev *dev, int idx, u32 mask); 5618c2ecf20Sopenharmony_civoid mt7615_mac_reset_counters(struct mt7615_dev *dev); 5628c2ecf20Sopenharmony_civoid mt7615_mac_cca_stats_reset(struct mt7615_phy *phy); 5638c2ecf20Sopenharmony_civoid mt7615_mac_set_scs(struct mt7615_phy *phy, bool enable); 5648c2ecf20Sopenharmony_civoid mt7615_mac_enable_nf(struct mt7615_dev *dev, bool ext_phy); 5658c2ecf20Sopenharmony_civoid mt7615_mac_sta_poll(struct mt7615_dev *dev); 5668c2ecf20Sopenharmony_ciint mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi, 5678c2ecf20Sopenharmony_ci struct sk_buff *skb, struct mt76_wcid *wcid, 5688c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, int pid, 5698c2ecf20Sopenharmony_ci struct ieee80211_key_conf *key, bool beacon); 5708c2ecf20Sopenharmony_civoid mt7615_mac_set_timing(struct mt7615_phy *phy); 5718c2ecf20Sopenharmony_ciint mt7615_mac_wtbl_set_key(struct mt7615_dev *dev, struct mt76_wcid *wcid, 5728c2ecf20Sopenharmony_ci struct ieee80211_key_conf *key, 5738c2ecf20Sopenharmony_ci enum set_key_cmd cmd); 5748c2ecf20Sopenharmony_ciint mt7615_mac_wtbl_update_pk(struct mt7615_dev *dev, 5758c2ecf20Sopenharmony_ci struct mt76_wcid *wcid, 5768c2ecf20Sopenharmony_ci enum mt7615_cipher_type cipher, 5778c2ecf20Sopenharmony_ci int keyidx, enum set_key_cmd cmd); 5788c2ecf20Sopenharmony_civoid mt7615_mac_wtbl_update_cipher(struct mt7615_dev *dev, 5798c2ecf20Sopenharmony_ci struct mt76_wcid *wcid, 5808c2ecf20Sopenharmony_ci enum mt7615_cipher_type cipher, 5818c2ecf20Sopenharmony_ci enum set_key_cmd cmd); 5828c2ecf20Sopenharmony_ciint mt7615_mac_wtbl_update_key(struct mt7615_dev *dev, 5838c2ecf20Sopenharmony_ci struct mt76_wcid *wcid, 5848c2ecf20Sopenharmony_ci u8 *key, u8 keylen, 5858c2ecf20Sopenharmony_ci enum mt7615_cipher_type cipher, 5868c2ecf20Sopenharmony_ci enum set_key_cmd cmd); 5878c2ecf20Sopenharmony_civoid mt7615_mac_reset_work(struct work_struct *work); 5888c2ecf20Sopenharmony_ciu32 mt7615_mac_get_sta_tid_sn(struct mt7615_dev *dev, int wcid, u8 tid); 5898c2ecf20Sopenharmony_ci 5908c2ecf20Sopenharmony_ciint mt7615_mcu_wait_response(struct mt7615_dev *dev, int cmd, int seq); 5918c2ecf20Sopenharmony_ciint mt7615_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data, 5928c2ecf20Sopenharmony_ci int len, bool wait_resp); 5938c2ecf20Sopenharmony_ciu32 mt7615_rf_rr(struct mt7615_dev *dev, u32 wf, u32 reg); 5948c2ecf20Sopenharmony_ciint mt7615_rf_wr(struct mt7615_dev *dev, u32 wf, u32 reg, u32 val); 5958c2ecf20Sopenharmony_ciint mt7615_mcu_set_dbdc(struct mt7615_dev *dev); 5968c2ecf20Sopenharmony_ciint mt7615_mcu_set_eeprom(struct mt7615_dev *dev); 5978c2ecf20Sopenharmony_ciint mt7615_mcu_set_mac_enable(struct mt7615_dev *dev, int band, bool enable); 5988c2ecf20Sopenharmony_ciint mt7615_mcu_set_rts_thresh(struct mt7615_phy *phy, u32 val); 5998c2ecf20Sopenharmony_ciint mt7615_mcu_get_temperature(struct mt7615_dev *dev, int index); 6008c2ecf20Sopenharmony_ciint mt7615_mcu_set_tx_power(struct mt7615_phy *phy); 6018c2ecf20Sopenharmony_civoid mt7615_mcu_exit(struct mt7615_dev *dev); 6028c2ecf20Sopenharmony_civoid mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb, 6038c2ecf20Sopenharmony_ci int cmd, int *wait_seq); 6048c2ecf20Sopenharmony_ciint mt7615_mcu_set_channel_domain(struct mt7615_phy *phy); 6058c2ecf20Sopenharmony_ciint mt7615_mcu_hw_scan(struct mt7615_phy *phy, struct ieee80211_vif *vif, 6068c2ecf20Sopenharmony_ci struct ieee80211_scan_request *scan_req); 6078c2ecf20Sopenharmony_ciint mt7615_mcu_cancel_hw_scan(struct mt7615_phy *phy, 6088c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 6098c2ecf20Sopenharmony_ciint mt7615_mcu_sched_scan_req(struct mt7615_phy *phy, 6108c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 6118c2ecf20Sopenharmony_ci struct cfg80211_sched_scan_request *sreq); 6128c2ecf20Sopenharmony_ciint mt7615_mcu_sched_scan_enable(struct mt7615_phy *phy, 6138c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 6148c2ecf20Sopenharmony_ci bool enable); 6158c2ecf20Sopenharmony_ci 6168c2ecf20Sopenharmony_ciint mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, 6178c2ecf20Sopenharmony_ci enum mt76_txq_id qid, struct mt76_wcid *wcid, 6188c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, 6198c2ecf20Sopenharmony_ci struct mt76_tx_info *tx_info); 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_civoid mt7615_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e); 6228c2ecf20Sopenharmony_civoid mt7615_tx_token_put(struct mt7615_dev *dev); 6238c2ecf20Sopenharmony_civoid mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, 6248c2ecf20Sopenharmony_ci struct sk_buff *skb); 6258c2ecf20Sopenharmony_civoid mt7615_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps); 6268c2ecf20Sopenharmony_ciint mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, 6278c2ecf20Sopenharmony_ci struct ieee80211_sta *sta); 6288c2ecf20Sopenharmony_civoid mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, 6298c2ecf20Sopenharmony_ci struct ieee80211_sta *sta); 6308c2ecf20Sopenharmony_civoid mt7615_mac_work(struct work_struct *work); 6318c2ecf20Sopenharmony_civoid mt7615_txp_skb_unmap(struct mt76_dev *dev, 6328c2ecf20Sopenharmony_ci struct mt76_txwi_cache *txwi); 6338c2ecf20Sopenharmony_ciint mt7615_mcu_set_fcc5_lpn(struct mt7615_dev *dev, int val); 6348c2ecf20Sopenharmony_ciint mt7615_mcu_set_pulse_th(struct mt7615_dev *dev, 6358c2ecf20Sopenharmony_ci const struct mt7615_dfs_pulse *pulse); 6368c2ecf20Sopenharmony_ciint mt7615_mcu_set_radar_th(struct mt7615_dev *dev, int index, 6378c2ecf20Sopenharmony_ci const struct mt7615_dfs_pattern *pattern); 6388c2ecf20Sopenharmony_ciint mt7615_mcu_set_test_param(struct mt7615_dev *dev, u8 param, bool test_mode, 6398c2ecf20Sopenharmony_ci u32 val); 6408c2ecf20Sopenharmony_ciint mt7615_mcu_set_sku_en(struct mt7615_phy *phy, bool enable); 6418c2ecf20Sopenharmony_ciint mt7615_mcu_apply_rx_dcoc(struct mt7615_phy *phy); 6428c2ecf20Sopenharmony_ciint mt7615_mcu_apply_tx_dpd(struct mt7615_phy *phy); 6438c2ecf20Sopenharmony_ciint mt7615_mcu_set_vif_ps(struct mt7615_dev *dev, struct ieee80211_vif *vif); 6448c2ecf20Sopenharmony_ciint mt7615_dfs_init_radar_detector(struct mt7615_phy *phy); 6458c2ecf20Sopenharmony_ci 6468c2ecf20Sopenharmony_ciint mt7615_mcu_set_p2p_oppps(struct ieee80211_hw *hw, 6478c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 6488c2ecf20Sopenharmony_ciint mt7615_mcu_set_roc(struct mt7615_phy *phy, struct ieee80211_vif *vif, 6498c2ecf20Sopenharmony_ci struct ieee80211_channel *chan, int duration); 6508c2ecf20Sopenharmony_ci 6518c2ecf20Sopenharmony_ciint mt7615_init_debugfs(struct mt7615_dev *dev); 6528c2ecf20Sopenharmony_ciint mt7615_mcu_wait_response(struct mt7615_dev *dev, int cmd, int seq); 6538c2ecf20Sopenharmony_ci 6548c2ecf20Sopenharmony_ciint mt7615_mcu_set_bss_pm(struct mt7615_dev *dev, struct ieee80211_vif *vif, 6558c2ecf20Sopenharmony_ci bool enable); 6568c2ecf20Sopenharmony_ciint mt7615_mcu_set_hif_suspend(struct mt7615_dev *dev, bool suspend); 6578c2ecf20Sopenharmony_civoid mt7615_mcu_set_suspend_iter(void *priv, u8 *mac, 6588c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 6598c2ecf20Sopenharmony_ciint mt7615_mcu_update_gtk_rekey(struct ieee80211_hw *hw, 6608c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 6618c2ecf20Sopenharmony_ci struct cfg80211_gtk_rekey_data *key); 6628c2ecf20Sopenharmony_ciint mt7615_mcu_update_arp_filter(struct ieee80211_hw *hw, 6638c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 6648c2ecf20Sopenharmony_ci struct ieee80211_bss_conf *info); 6658c2ecf20Sopenharmony_ciint __mt7663_load_firmware(struct mt7615_dev *dev); 6668c2ecf20Sopenharmony_ciu32 mt7615_mcu_reg_rr(struct mt76_dev *dev, u32 offset); 6678c2ecf20Sopenharmony_civoid mt7615_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val); 6688c2ecf20Sopenharmony_ci 6698c2ecf20Sopenharmony_ci/* usb */ 6708c2ecf20Sopenharmony_ciint mt7663_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, 6718c2ecf20Sopenharmony_ci enum mt76_txq_id qid, struct mt76_wcid *wcid, 6728c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, 6738c2ecf20Sopenharmony_ci struct mt76_tx_info *tx_info); 6748c2ecf20Sopenharmony_cibool mt7663_usb_sdio_tx_status_data(struct mt76_dev *mdev, u8 *update); 6758c2ecf20Sopenharmony_civoid mt7663_usb_sdio_tx_complete_skb(struct mt76_dev *mdev, 6768c2ecf20Sopenharmony_ci struct mt76_queue_entry *e); 6778c2ecf20Sopenharmony_civoid mt7663_usb_sdio_wtbl_work(struct work_struct *work); 6788c2ecf20Sopenharmony_ciint mt7663_usb_sdio_register_device(struct mt7615_dev *dev); 6798c2ecf20Sopenharmony_ciint mt7663u_mcu_init(struct mt7615_dev *dev); 6808c2ecf20Sopenharmony_ci 6818c2ecf20Sopenharmony_ci/* sdio */ 6828c2ecf20Sopenharmony_ciu32 mt7663s_read_pcr(struct mt7615_dev *dev); 6838c2ecf20Sopenharmony_ciint mt7663s_mcu_init(struct mt7615_dev *dev); 6848c2ecf20Sopenharmony_civoid mt7663s_tx_work(struct work_struct *work); 6858c2ecf20Sopenharmony_civoid mt7663s_rx_work(struct work_struct *work); 6868c2ecf20Sopenharmony_civoid mt7663s_sdio_irq(struct sdio_func *func); 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_ci#endif 689