1 /* SPDX-License-Identifier: ISC */
2 /* Copyright (C) 2023 MediaTek Inc. */
7 #include "../mt76_connac_mcu.h"
11 MCU_EXT_EVENT_RATE_REPORT
= 0x87,
14 struct mt7925_mcu_eeprom_info
{
17 u8 data
[MT7925_EEPROM_BLOCK_SIZE
];
20 #define MT_RA_RATE_NSS GENMASK(8, 6)
21 #define MT_RA_RATE_MCS GENMASK(3, 0)
22 #define MT_RA_RATE_TX_MODE GENMASK(12, 9)
23 #define MT_RA_RATE_DCM_EN BIT(4)
24 #define MT_RA_RATE_BW GENMASK(14, 13)
26 struct mt7925_mcu_rxd
{
44 struct mt7925_mcu_uni_event
{
47 __le32 status
; /* 0: success, others: fail */
51 MT_EBF
= BIT(0), /* explicit beamforming */
52 MT_IBF
= BIT(1) /* implicit beamforming */
55 struct mt7925_mcu_reg_event
{
60 struct mt7925_mcu_ant_id_config
{
64 struct mt7925_txpwr_req
{
75 struct mt7925_txpwr_event
{
83 u8 format
; /* 0:Legacy, 1:HE */
86 struct mt7925_txpwr txpwr
;
103 MT7925_TM_ICAP_OVERLAP
,
104 MT7925_TM_WIFISPECTRUM
,
107 struct mt7925_rftest_cmd
{
114 struct mt7925_rftest_evt
{
125 UNI_CHIP_CONFIG_CHIP_CFG
= 0x2,
126 UNI_CHIP_CONFIG_NIC_CAPA
= 0x3,
130 UNI_BAND_CONFIG_RADIO_ENABLE
,
131 UNI_BAND_CONFIG_RTS_THRESHOLD
= 0x08,
132 UNI_BAND_CONFIG_SET_MAC80211_RX_FILTER
= 0x0C,
136 UNI_WSYS_CONFIG_FW_LOG_CTRL
,
137 UNI_WSYS_CONFIG_FW_DBG_CTRL
,
141 UNI_EFUSE_ACCESS
= 1,
142 UNI_EFUSE_BUFFER_MODE
,
143 UNI_EFUSE_FREE_BLOCK
,
148 UNI_CMD_ACCESS_REG_BASIC
= 0x0,
149 UNI_CMD_ACCESS_RF_REG_BASIC
,
157 UNI_EVENT_SCAN_DONE_BASIC
= 0,
158 UNI_EVENT_SCAN_DONE_CHNLINFO
= 2,
159 UNI_EVENT_SCAN_DONE_NLO
= 3,
162 enum connac3_mcu_cipher_type
{
163 CONNAC3_CIPHER_NONE
= 0,
164 CONNAC3_CIPHER_WEP40
= 1,
165 CONNAC3_CIPHER_TKIP
= 2,
166 CONNAC3_CIPHER_AES_CCMP
= 4,
167 CONNAC3_CIPHER_WEP104
= 5,
168 CONNAC3_CIPHER_BIP_CMAC_128
= 6,
169 CONNAC3_CIPHER_WEP128
= 7,
170 CONNAC3_CIPHER_WAPI
= 8,
171 CONNAC3_CIPHER_CCMP_256
= 10,
172 CONNAC3_CIPHER_GCMP
= 11,
173 CONNAC3_CIPHER_GCMP_256
= 12,
176 struct mt7925_mcu_scan_chinfo_event
{
184 UNI_SCAN_SCHED_REQ
= 3,
185 UNI_SCAN_SCHED_ENABLE
= 4,
191 UNI_SCAN_SSID_MATCH_SETS
,
199 struct scan_hdr_tlv
{
208 struct scan_req_tlv
{
212 u8 scan_type
; /* 0: PASSIVE SCAN
215 u8 probe_req_num
; /* Number of probe request for each SSID */
216 u8 scan_func
; /* BIT(0) Enable random MAC scan
217 * BIT(1) Disable DBDC scan type 1~3.
218 * BIT(2) Use DBDC scan type 3 (dedicated one RF to scan).
221 __le16 channel_min_dwell_time
;
222 __le16 channel_dwell_time
; /* channel Dwell interval */
223 __le16 timeout_value
;
224 __le16 probe_delay_time
;
225 __le32 func_mask_ext
;
228 struct scan_ssid_tlv
{
232 u8 ssid_type
; /* BIT(0) wildcard SSID
233 * BIT(1) P2P wildcard SSID
234 * BIT(2) specified SSID + wildcard SSID
235 * BIT(2) + ssid_type_ext BIT(0) specified SSID only
239 struct mt76_connac_mcu_scan_ssid ssids
[4];
242 struct scan_bssid_tlv
{
253 struct scan_chan_info_tlv
{
257 u8 channel_type
; /* 0: Full channels
258 * 1: Only 2.4GHz channels
259 * 2: Only 5GHz channels
260 * 3: P2P social channel only (channel #1, #6 and #11)
261 * 4: Specified channels
264 u8 channels_num
; /* valid when channel_type is 4 */
266 struct mt76_connac_mcu_scan_channel channels
[64];
276 u8 ies
[MT76_CONNAC_SCAN_IE_LEN
];
279 struct scan_misc_tlv
{
283 u8 random_mac
[ETH_ALEN
];
287 struct scan_sched_req
{
295 __le16 intervals
[MT76_CONNAC_MAX_NUM_SCHED_SCAN_INTERVAL
];
298 struct scan_sched_ssid_match_sets
{
305 struct mt76_connac_mcu_scan_match match
[MT76_CONNAC_MAX_SCAN_MATCH
];
308 struct scan_sched_enable
{
316 struct mbmc_set_req
{
321 struct mbmc_conf_tlv
{
348 struct bss_rate_tlv
{
366 u8 mac_addr
[ETH_ALEN
];
375 struct sta_rec_ba_uni
{
403 struct sta_rec_sec_uni
{
421 struct sta_rec_hdr_trans
{
433 u8 mac_addr
[ETH_ALEN
];
446 struct sta_rec_eht_mld
{
457 struct bss_ifs_time_tlv
{
470 __le16 eifs_cck_time
;
488 #define MT7925_STA_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \
489 sizeof(struct sta_rec_basic) + \
490 sizeof(struct sta_rec_bf) + \
491 sizeof(struct sta_rec_ht) + \
492 sizeof(struct sta_rec_he_v2) + \
493 sizeof(struct sta_rec_ba_uni) + \
494 sizeof(struct sta_rec_vht) + \
495 sizeof(struct sta_rec_uapsd) + \
496 sizeof(struct sta_rec_amsdu) + \
497 sizeof(struct sta_rec_bfee) + \
498 sizeof(struct sta_rec_phy) + \
499 sizeof(struct sta_rec_ra) + \
500 sizeof(struct sta_rec_sec_uni) + \
501 sizeof(struct sta_rec_ra_fixed) + \
502 sizeof(struct sta_rec_he_6g_capa) + \
503 sizeof(struct sta_rec_eht) + \
504 sizeof(struct sta_rec_hdr_trans) + \
505 sizeof(struct sta_rec_mld) + \
506 sizeof(struct tlv) * 2 + \
507 sizeof(struct sta_rec_remove))
509 #define MT7925_BSS_UPDATE_MAX_SIZE (sizeof(struct bss_req_hdr) + \
510 sizeof(struct mt76_connac_bss_basic_tlv) + \
511 sizeof(struct mt76_connac_bss_qos_tlv) + \
512 sizeof(struct bss_rate_tlv) + \
513 sizeof(struct bss_mld_tlv) + \
514 sizeof(struct bss_info_uni_he) + \
515 sizeof(struct bss_info_uni_bss_color) + \
516 sizeof(struct bss_ifs_time_tlv) + \
517 sizeof(struct bss_rlm_tlv) + \
520 #define MT_CONNAC3_SKU_POWER_LIMIT 449
521 struct mt7925_sku_tlv
{
523 s8 pwr_limit
[MT_CONNAC3_SKU_POWER_LIMIT
];
526 struct mt7925_tx_power_limit_tlv
{
532 /* DW0 - common info*/
537 u8 n_chan
; /* # channel */
538 u8 band
; /* 2.4GHz - 5GHz - 6GHz */
542 u8 alpha2
[4]; /* regulatory_request.alpha2 */
548 struct mt7925_arpns_tlv
{
557 struct mt7925_wow_pattern_tlv
{
561 u8 index
; /* pattern index */
562 u8 enable
; /* 0: disable
565 u8 data_len
; /* pattern length */
567 u8 mask
[MT76_CONNAC_WOW_MASK_MAX_LEN
];
568 u8 pattern
[MT76_CONNAC_WOW_PATTEN_MAX_LEN
];
572 struct roc_acquire_tlv
{
584 u8 center_chan_from_ap
;
585 u8 center_chan2_from_ap
;
592 static inline enum connac3_mcu_cipher_type
593 mt7925_mcu_get_cipher(int cipher
)
596 case WLAN_CIPHER_SUITE_WEP40
:
597 return CONNAC3_CIPHER_WEP40
;
598 case WLAN_CIPHER_SUITE_WEP104
:
599 return CONNAC3_CIPHER_WEP104
;
600 case WLAN_CIPHER_SUITE_TKIP
:
601 return CONNAC3_CIPHER_TKIP
;
602 case WLAN_CIPHER_SUITE_AES_CMAC
:
603 return CONNAC3_CIPHER_BIP_CMAC_128
;
604 case WLAN_CIPHER_SUITE_CCMP
:
605 return CONNAC3_CIPHER_AES_CCMP
;
606 case WLAN_CIPHER_SUITE_CCMP_256
:
607 return CONNAC3_CIPHER_CCMP_256
;
608 case WLAN_CIPHER_SUITE_GCMP
:
609 return CONNAC3_CIPHER_GCMP
;
610 case WLAN_CIPHER_SUITE_GCMP_256
:
611 return CONNAC3_CIPHER_GCMP_256
;
612 case WLAN_CIPHER_SUITE_SMS4
:
613 return CONNAC3_CIPHER_WAPI
;
615 return CONNAC3_CIPHER_NONE
;
619 int mt7925_mcu_set_dbdc(struct mt76_phy
*phy
);
620 int mt7925_mcu_hw_scan(struct mt76_phy
*phy
, struct ieee80211_vif
*vif
,
621 struct ieee80211_scan_request
*scan_req
);
622 int mt7925_mcu_cancel_hw_scan(struct mt76_phy
*phy
,
623 struct ieee80211_vif
*vif
);
624 int mt7925_mcu_sched_scan_req(struct mt76_phy
*phy
,
625 struct ieee80211_vif
*vif
,
626 struct cfg80211_sched_scan_request
*sreq
);
627 int mt7925_mcu_sched_scan_enable(struct mt76_phy
*phy
,
628 struct ieee80211_vif
*vif
,
630 int mt7925_mcu_add_bss_info(struct mt792x_phy
*phy
,
631 struct ieee80211_chanctx_conf
*ctx
,
632 struct ieee80211_bss_conf
*link_conf
,
633 struct ieee80211_link_sta
*link_sta
,
635 int mt7925_mcu_set_timing(struct mt792x_phy
*phy
,
636 struct ieee80211_bss_conf
*link_conf
);
637 int mt7925_mcu_set_deep_sleep(struct mt792x_dev
*dev
, bool enable
);
638 int mt7925_mcu_set_channel_domain(struct mt76_phy
*phy
);
639 int mt7925_mcu_set_radio_en(struct mt792x_phy
*phy
, bool enable
);
640 int mt7925_mcu_set_chctx(struct mt76_phy
*phy
, struct mt76_vif
*mvif
,
641 struct ieee80211_bss_conf
*link_conf
,
642 struct ieee80211_chanctx_conf
*ctx
);
643 int mt7925_mcu_set_rate_txpower(struct mt76_phy
*phy
);
644 int mt7925_mcu_update_arp_filter(struct mt76_dev
*dev
,
645 struct ieee80211_bss_conf
*link_conf
);