1 /* SPDX-License-Identifier: ISC */
2 /* Copyright (C) 2020 MediaTek Inc. */
4 #ifndef __MT76_CONNAC_MCU_H
5 #define __MT76_CONNAC_MCU_H
7 #include "mt76_connac.h"
9 #define FW_FEATURE_SET_ENCRYPT BIT(0)
10 #define FW_FEATURE_SET_KEY_IDX GENMASK(2, 1)
11 #define FW_FEATURE_ENCRY_MODE BIT(4)
12 #define FW_FEATURE_OVERRIDE_ADDR BIT(5)
13 #define FW_FEATURE_NON_DL BIT(6)
15 #define DL_MODE_ENCRYPT BIT(0)
16 #define DL_MODE_KEY_IDX GENMASK(2, 1)
17 #define DL_MODE_RESET_SEC_IV BIT(3)
18 #define DL_MODE_WORKING_PDA_CR4 BIT(4)
19 #define DL_MODE_VALID_RAM_ENTRY BIT(5)
20 #define DL_CONFIG_ENCRY_MODE_SEL BIT(6)
21 #define DL_MODE_NEED_RSP BIT(31)
23 #define FW_START_OVERRIDE BIT(0)
24 #define FW_START_WORKING_PDA_CR4 BIT(2)
25 #define FW_START_WORKING_PDA_DSP BIT(3)
27 #define PATCH_SEC_NOT_SUPPORT GENMASK(31, 0)
28 #define PATCH_SEC_TYPE_MASK GENMASK(15, 0)
29 #define PATCH_SEC_TYPE_INFO 0x2
31 #define PATCH_SEC_ENC_TYPE_MASK GENMASK(31, 24)
32 #define PATCH_SEC_ENC_TYPE_PLAIN 0x00
33 #define PATCH_SEC_ENC_TYPE_AES 0x01
34 #define PATCH_SEC_ENC_TYPE_SCRAMBLE 0x02
35 #define PATCH_SEC_ENC_SCRAMBLE_INFO_MASK GENMASK(15, 0)
36 #define PATCH_SEC_ENC_AES_KEY_MASK GENMASK(7, 0)
44 #define MCU_PQ_ID(p, q) (((p) << 15) | ((q) << 10))
45 #define MCU_PKT_ID 0xa0
47 struct mt76_connac2_mcu_txd
{
55 u8 set_query
; /* FW don't care */
64 } __packed
__aligned(4);
67 * struct mt76_connac2_mcu_uni_txd - mcu command descriptor for connac2 and connac3
68 * @txd: hardware descriptor
69 * @len: total length not including txd
70 * @cid: command identifier
71 * @pkt_type: must be 0xa0 (cmd packet by long format)
72 * @frag_n: fragment number
73 * @seq: sequence number
74 * @checksum: 0 mean there is no checksum
75 * @s2d_index: index for command source and destination
76 * Definition | value | note
77 * CMD_S2D_IDX_H2N | 0x00 | command from HOST to WM
78 * CMD_S2D_IDX_C2N | 0x01 | command from WA to WM
79 * CMD_S2D_IDX_H2C | 0x02 | command from HOST to WA
80 * CMD_S2D_IDX_H2N_AND_H2C | 0x03 | command from HOST to WA and WM
82 * @option: command option
83 * BIT[0]: UNI_CMD_OPT_BIT_ACK
84 * set to 1 to request a fw reply
85 * if UNI_CMD_OPT_BIT_0_ACK is set and UNI_CMD_OPT_BIT_2_SET_QUERY
86 * is set, mcu firmware will send response event EID = 0x01
87 * (UNI_EVENT_ID_CMD_RESULT) to the host.
88 * BIT[1]: UNI_CMD_OPT_BIT_UNI_CMD
91 * BIT[2]: UNI_CMD_OPT_BIT_SET_QUERY
95 struct mt76_connac2_mcu_uni_txd
{
115 } __packed
__aligned(4);
117 struct mt76_connac2_mcu_rxd
{
118 /* New members MUST be added within the struct_group() macro below. */
119 struct_group_tagged(mt76_connac2_mcu_rxd_hdr
, hdr
,
136 static_assert(offsetof(struct mt76_connac2_mcu_rxd
, tlv
) == sizeof(struct mt76_connac2_mcu_rxd_hdr
),
137 "struct member likely outside of struct_group_tagged()");
139 struct mt76_connac2_patch_hdr
{
156 struct mt76_connac2_patch_sec
{
172 struct mt76_connac2_fw_trailer
{
184 struct mt76_connac2_fw_region
{
187 __le32 decomp_blk_sz
;
202 struct bss_info_omac
{
213 struct bss_info_basic
{
226 u8 max_bssid
; /* max BSSID. range: 1 ~ 8, 0: MBSSID disabled */
227 u8 non_tx_bssid
;/* non-transmitted BSSID, 0: transmitted BSSID */
228 u8 bmc_wcid_hi
; /* high Byte and version */
232 struct bss_info_rf_ch
{
239 u8 he_ru26_block
; /* 1: don't send HETB in RU26, 0: allow */
240 u8 he_all_disable
; /* 1: disallow all HETB, 0: allow */
244 struct bss_info_ext_bss
{
247 __le32 mbss_tsf_offset
; /* in unit of us */
254 BSS_INFO_RF_CH
, /* optional, for BT/LTE coex */
255 BSS_INFO_PM
, /* sta only */
256 BSS_INFO_UAPSD
, /* sta only */
257 BSS_INFO_ROAM_DETECT
, /* obsoleted */
258 BSS_INFO_LQ_RM
, /* obsoleted */
260 BSS_INFO_BMC_RATE
, /* for bmc rate control in CR4 */
261 BSS_INFO_SYNC_MODE
, /* obsoleted */
266 BSS_INFO_PROTECT_INFO
,
274 struct sta_ntlv_hdr
{
289 struct sta_rec_basic
{
296 u8 peer_addr
[ETH_ALEN
];
297 #define EXTRA_INFO_VER BIT(0)
298 #define EXTRA_INFO_NEW BIT(1)
313 __le16 vht_rx_mcs_map
;
314 __le16 vht_tx_mcs_map
;
315 /* mt7915 - mt7921 */
320 struct sta_rec_uapsd
{
327 __le16 listen_interval
;
361 __le16 max_nss_mcs
[CMD_HE_MCS_BW_NUM
];
366 struct sta_rec_he_v2
{
372 /* 0: BW80, 1: BW160, 2: BW8080 */
373 __le16 max_nss_mcs
[CMD_HE_MCS_BW_NUM
];
376 struct sta_rec_amsdu
{
385 struct sta_rec_state
{
395 #define RA_LEGACY_OFDM GENMASK(13, 6)
396 #define RA_LEGACY_CCK GENMASK(3, 0)
397 #define HT_MCS_MASK_NUM 10
398 struct sta_rec_ra_info
{
402 u8 rx_mcs_bitmask
[HT_MCS_MASK_NUM
];
413 u8 max_ampdu_len
; /* connac3 */
417 struct sta_rec_he_6g_capa
{
424 struct sta_rec_pn_info
{
447 struct sec_key key
[2];
454 __le16 pfmu
; /* 0xffff: no access right for PFMU */
455 bool su_mu
; /* 0: SU, 1: MU */
456 u8 bf_cap
; /* 0: iBF, 1: eBF */
457 u8 sounding_phy
; /* 0: legacy, 1: OFDM, 2: HT, 4: VHT */
461 u8 tx_mode
; /* 0: legacy, 1: OFDM, 2: HT, 4: VHT ... */
464 u8 bw
; /* 0: 20M, 1: 40M, 2: 80M, 3: 160M */
470 u8 col
: 6, row_msb
: 2;
475 u8 auto_sounding
; /* b7: low traffic indicator
476 * b6: Stop sounding for this entry
477 * b5 ~ b0: postpone sounding
499 struct sta_rec_bfee
{
502 bool fb_identity_matrix
; /* 1: feedback identity matrix */
503 bool ignore_feedback
; /* 1: ignore */
507 struct sta_rec_muru
{
521 bool he_20m_in_40m_2g
;
525 bool rx_su_comp_sigb
;
526 bool rx_su_non_comp_sigb
;
536 u8 rx_ctrl_frame_to_mbss
;
542 bool partial_bw_dl_mimo
;
548 bool partial_ul_mimo
;
553 struct sta_rec_remove
{
595 __le16 supp_vht_mcs
[4];
598 u8 op_vht_chan_width
;
600 u8 op_vht_rx_nss_type
;
607 struct sta_rec_ra_fixed
{
613 u8 op_vht_chan_width
;
615 u8 op_vht_rx_nss_type
;
625 struct sta_rec_tx_proc
{
633 struct wtbl_req_hdr
{
641 struct wtbl_generic
{
644 u8 peer_addr
[ETH_ALEN
];
693 struct wtbl_hdr_trans
{
709 /* originator only */
713 /* originator & recipient */
716 u8 peer_addr
[ETH_ALEN
];
769 #define MT76_CONNAC_WTBL_UPDATE_MAX_SIZE (sizeof(struct wtbl_req_hdr) + \
770 sizeof(struct wtbl_generic) + \
771 sizeof(struct wtbl_rx) + \
772 sizeof(struct wtbl_ht) + \
773 sizeof(struct wtbl_vht) + \
774 sizeof(struct wtbl_tx_ps) + \
775 sizeof(struct wtbl_hdr_trans) +\
776 sizeof(struct wtbl_ba) + \
777 sizeof(struct wtbl_bf) + \
778 sizeof(struct wtbl_smps) + \
779 sizeof(struct wtbl_pn) + \
780 sizeof(struct wtbl_spe))
782 #define MT76_CONNAC_STA_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \
783 sizeof(struct sta_rec_basic) + \
784 sizeof(struct sta_rec_bf) + \
785 sizeof(struct sta_rec_ht) + \
786 sizeof(struct sta_rec_he) + \
787 sizeof(struct sta_rec_ba) + \
788 sizeof(struct sta_rec_vht) + \
789 sizeof(struct sta_rec_uapsd) + \
790 sizeof(struct sta_rec_amsdu) + \
791 sizeof(struct sta_rec_muru) + \
792 sizeof(struct sta_rec_bfee) + \
793 sizeof(struct sta_rec_ra) + \
794 sizeof(struct sta_rec_sec) + \
795 sizeof(struct sta_rec_ra_fixed) + \
796 sizeof(struct sta_rec_he_6g_capa) + \
797 sizeof(struct sta_rec_pn_info) + \
798 sizeof(struct sta_rec_tx_proc) + \
799 sizeof(struct tlv) + \
800 MT76_CONNAC_WTBL_UPDATE_MAX_SIZE)
811 STA_REC_TX_PROC
, /* for hdr trans and CSO in CR4 */
825 STA_REC_HE_6G
= 0x17,
826 STA_REC_HE_V2
= 0x19,
828 STA_REC_EHT_MLD
= 0x21,
830 STA_REC_MLD_OFF
= 0x23,
831 STA_REC_REMOVE
= 0x25,
832 STA_REC_PN_INFO
= 0x26,
833 STA_REC_KEY_V3
= 0x27,
835 STA_REC_HDR_TRANS
= 0x2B,
844 WTBL_PEER_PS
, /* not used */
849 WTBL_RDG
, /* obsoleted */
850 WTBL_PROTECT
, /* not used */
851 WTBL_CLEAR
, /* not used */
854 WTBL_RAW_DATA
, /* debug only */
860 #define STA_TYPE_STA BIT(0)
861 #define STA_TYPE_AP BIT(1)
862 #define STA_TYPE_ADHOC BIT(2)
863 #define STA_TYPE_WDS BIT(4)
864 #define STA_TYPE_BC BIT(5)
866 #define NETWORK_INFRA BIT(16)
867 #define NETWORK_P2P BIT(17)
868 #define NETWORK_IBSS BIT(18)
869 #define NETWORK_WDS BIT(21)
871 #define SCAN_FUNC_RANDOM_MAC BIT(0)
872 #define SCAN_FUNC_SPLIT_SCAN BIT(5)
874 #define CONNECTION_INFRA_STA (STA_TYPE_STA | NETWORK_INFRA)
875 #define CONNECTION_INFRA_AP (STA_TYPE_AP | NETWORK_INFRA)
876 #define CONNECTION_P2P_GC (STA_TYPE_STA | NETWORK_P2P)
877 #define CONNECTION_P2P_GO (STA_TYPE_AP | NETWORK_P2P)
878 #define CONNECTION_IBSS_ADHOC (STA_TYPE_ADHOC | NETWORK_IBSS)
879 #define CONNECTION_WDS (STA_TYPE_WDS | NETWORK_WDS)
880 #define CONNECTION_INFRA_BC (STA_TYPE_BC | NETWORK_INFRA)
882 #define CONN_STATE_DISCONNECT 0
883 #define CONN_STATE_CONNECT 1
884 #define CONN_STATE_PORT_SECURE 2
887 #define STA_REC_HE_CAP_HTC BIT(0)
888 #define STA_REC_HE_CAP_BQR BIT(1)
889 #define STA_REC_HE_CAP_BSR BIT(2)
890 #define STA_REC_HE_CAP_OM BIT(3)
891 #define STA_REC_HE_CAP_AMSDU_IN_AMPDU BIT(4)
893 #define STA_REC_HE_CAP_DUAL_BAND BIT(5)
894 #define STA_REC_HE_CAP_LDPC BIT(6)
895 #define STA_REC_HE_CAP_TRIG_CQI_FK BIT(7)
896 #define STA_REC_HE_CAP_PARTIAL_BW_EXT_RANGE BIT(8)
898 #define STA_REC_HE_CAP_LE_EQ_80M_TX_STBC BIT(9)
899 #define STA_REC_HE_CAP_LE_EQ_80M_RX_STBC BIT(10)
900 #define STA_REC_HE_CAP_GT_80M_TX_STBC BIT(11)
901 #define STA_REC_HE_CAP_GT_80M_RX_STBC BIT(12)
903 #define STA_REC_HE_CAP_SU_PPDU_1LTF_8US_GI BIT(13)
904 #define STA_REC_HE_CAP_SU_MU_PPDU_4LTF_8US_GI BIT(14)
905 #define STA_REC_HE_CAP_ER_SU_PPDU_1LTF_8US_GI BIT(15)
906 #define STA_REC_HE_CAP_ER_SU_PPDU_4LTF_8US_GI BIT(16)
907 #define STA_REC_HE_CAP_NDP_4LTF_3DOT2MS_GI BIT(17)
909 #define STA_REC_HE_CAP_BW20_RU242_SUPPORT BIT(18)
910 #define STA_REC_HE_CAP_TX_1024QAM_UNDER_RU242 BIT(19)
911 #define STA_REC_HE_CAP_RX_1024QAM_UNDER_RU242 BIT(20)
913 #define PHY_MODE_A BIT(0)
914 #define PHY_MODE_B BIT(1)
915 #define PHY_MODE_G BIT(2)
916 #define PHY_MODE_GN BIT(3)
917 #define PHY_MODE_AN BIT(4)
918 #define PHY_MODE_AC BIT(5)
919 #define PHY_MODE_AX_24G BIT(6)
920 #define PHY_MODE_AX_5G BIT(7)
922 #define PHY_MODE_AX_6G BIT(0) /* phymode_ext */
923 #define PHY_MODE_BE_24G BIT(1)
924 #define PHY_MODE_BE_5G BIT(2)
925 #define PHY_MODE_BE_6G BIT(3)
927 #define MODE_CCK BIT(0)
928 #define MODE_OFDM BIT(1)
929 #define MODE_HT BIT(2)
930 #define MODE_VHT BIT(3)
931 #define MODE_HE BIT(4)
932 #define MODE_EHT BIT(5)
934 #define STA_CAP_WMM BIT(0)
935 #define STA_CAP_SGI_20 BIT(4)
936 #define STA_CAP_SGI_40 BIT(5)
937 #define STA_CAP_TX_STBC BIT(6)
938 #define STA_CAP_RX_STBC BIT(7)
939 #define STA_CAP_VHT_SGI_80 BIT(16)
940 #define STA_CAP_VHT_SGI_160 BIT(17)
941 #define STA_CAP_VHT_TX_STBC BIT(18)
942 #define STA_CAP_VHT_RX_STBC BIT(19)
943 #define STA_CAP_VHT_LDPC BIT(23)
944 #define STA_CAP_LDPC BIT(24)
945 #define STA_CAP_HT BIT(26)
946 #define STA_CAP_VHT BIT(27)
947 #define STA_CAP_HE BIT(28)
950 PHY_TYPE_HR_DSSS_INDEX
= 0,
952 PHY_TYPE_ERP_P2P_INDEX
,
961 #define HR_DSSS_ERP_BASIC_RATE GENMASK(3, 0)
962 #define OFDM_BASIC_RATE (BIT(6) | BIT(8) | BIT(10))
964 #define PHY_TYPE_BIT_HR_DSSS BIT(PHY_TYPE_HR_DSSS_INDEX)
965 #define PHY_TYPE_BIT_ERP BIT(PHY_TYPE_ERP_INDEX)
966 #define PHY_TYPE_BIT_OFDM BIT(PHY_TYPE_OFDM_INDEX)
967 #define PHY_TYPE_BIT_HT BIT(PHY_TYPE_HT_INDEX)
968 #define PHY_TYPE_BIT_VHT BIT(PHY_TYPE_VHT_INDEX)
969 #define PHY_TYPE_BIT_HE BIT(PHY_TYPE_HE_INDEX)
970 #define PHY_TYPE_BIT_BE BIT(PHY_TYPE_BE_INDEX)
972 #define MT_WTBL_RATE_TX_MODE GENMASK(9, 6)
973 #define MT_WTBL_RATE_MCS GENMASK(5, 0)
974 #define MT_WTBL_RATE_NSS GENMASK(12, 10)
975 #define MT_WTBL_RATE_HE_GI GENMASK(7, 4)
976 #define MT_WTBL_RATE_GI GENMASK(3, 0)
978 #define MT_WTBL_W5_CHANGE_BW_RATE GENMASK(7, 5)
979 #define MT_WTBL_W5_SHORT_GI_20 BIT(8)
980 #define MT_WTBL_W5_SHORT_GI_40 BIT(9)
981 #define MT_WTBL_W5_SHORT_GI_80 BIT(10)
982 #define MT_WTBL_W5_SHORT_GI_160 BIT(11)
983 #define MT_WTBL_W5_BW_CAP GENMASK(13, 12)
984 #define MT_WTBL_W5_MPDU_FAIL_COUNT GENMASK(25, 23)
985 #define MT_WTBL_W5_MPDU_OK_COUNT GENMASK(28, 26)
986 #define MT_WTBL_W5_RATE_IDX GENMASK(31, 29)
989 WTBL_RESET_AND_SET
= 1,
997 MT_BA_TYPE_ORIGINATOR
,
1002 RST_BA_MAC_TID_MATCH
,
1014 MCU_EVENT_TARGET_ADDRESS_LEN
= 0x01,
1015 MCU_EVENT_FW_START
= 0x01,
1016 MCU_EVENT_GENERIC
= 0x01,
1017 MCU_EVENT_ACCESS_REG
= 0x02,
1018 MCU_EVENT_MT_PATCH_SEM
= 0x04,
1019 MCU_EVENT_REG_ACCESS
= 0x05,
1020 MCU_EVENT_LP_INFO
= 0x07,
1021 MCU_EVENT_SCAN_DONE
= 0x0d,
1022 MCU_EVENT_TX_DONE
= 0x0f,
1023 MCU_EVENT_ROC
= 0x10,
1024 MCU_EVENT_BSS_ABSENCE
= 0x11,
1025 MCU_EVENT_BSS_BEACON_LOSS
= 0x13,
1026 MCU_EVENT_CH_PRIVILEGE
= 0x18,
1027 MCU_EVENT_SCHED_SCAN_DONE
= 0x23,
1028 MCU_EVENT_DBG_MSG
= 0x27,
1029 MCU_EVENT_RSSI_NOTIFY
= 0x96,
1030 MCU_EVENT_TXPWR
= 0xd0,
1031 MCU_EVENT_EXT
= 0xed,
1032 MCU_EVENT_RESTART_DL
= 0xef,
1033 MCU_EVENT_COREDUMP
= 0xf0,
1036 /* ext event table */
1038 MCU_EXT_EVENT_PS_SYNC
= 0x5,
1039 MCU_EXT_EVENT_FW_LOG_2_HOST
= 0x13,
1040 MCU_EXT_EVENT_THERMAL_PROTECT
= 0x22,
1041 MCU_EXT_EVENT_ASSERT_DUMP
= 0x23,
1042 MCU_EXT_EVENT_RDD_REPORT
= 0x3a,
1043 MCU_EXT_EVENT_CSA_NOTIFY
= 0x4f,
1044 MCU_EXT_EVENT_WA_TX_STAT
= 0x74,
1045 MCU_EXT_EVENT_BCC_NOTIFY
= 0x75,
1046 MCU_EXT_EVENT_MURU_CTRL
= 0x9f,
1049 /* unified event table */
1051 MCU_UNI_EVENT_RESULT
= 0x01,
1052 MCU_UNI_EVENT_FW_LOG_2_HOST
= 0x04,
1053 MCU_UNI_EVENT_ACCESS_REG
= 0x6,
1054 MCU_UNI_EVENT_IE_COUNTDOWN
= 0x09,
1055 MCU_UNI_EVENT_COREDUMP
= 0x0a,
1056 MCU_UNI_EVENT_BSS_BEACON_LOSS
= 0x0c,
1057 MCU_UNI_EVENT_SCAN_DONE
= 0x0e,
1058 MCU_UNI_EVENT_RDD_REPORT
= 0x11,
1059 MCU_UNI_EVENT_ROC
= 0x27,
1060 MCU_UNI_EVENT_TX_DONE
= 0x2d,
1061 MCU_UNI_EVENT_THERMAL
= 0x35,
1062 MCU_UNI_EVENT_NIC_CAPAB
= 0x43,
1063 MCU_UNI_EVENT_WED_RRO
= 0x57,
1064 MCU_UNI_EVENT_PER_STA_INFO
= 0x6d,
1065 MCU_UNI_EVENT_ALL_STA_INFO
= 0x6e,
1068 #define MCU_UNI_CMD_EVENT BIT(1)
1069 #define MCU_UNI_CMD_UNSOLICITED_EVENT BIT(2)
1086 PATCH_NOT_DL_SEM_FAIL
,
1088 PATCH_NOT_DL_SEM_SUCCESS
,
1089 PATCH_REL_SEM_SUCCESS
1094 FW_STATE_FW_DOWNLOAD
,
1095 FW_STATE_NORMAL_OPERATION
,
1096 FW_STATE_NORMAL_TRX
,
1101 CH_SWITCH_NORMAL
= 0,
1105 CH_SWITCH_BACKGROUND_SCAN_START
= 6,
1106 CH_SWITCH_BACKGROUND_SCAN_RUNNING
= 7,
1107 CH_SWITCH_BACKGROUND_SCAN_STOP
= 8,
1108 CH_SWITCH_SCAN_BYPASS_DPD
= 9
1112 THERMAL_SENSOR_TEMP_QUERY
,
1113 THERMAL_SENSOR_MANUAL_CTRL
,
1114 THERMAL_SENSOR_INFO_QUERY
,
1115 THERMAL_SENSOR_TASK_CTRL
,
1118 enum mcu_cipher_type
{
1119 MCU_CIPHER_NONE
= 0,
1124 MCU_CIPHER_AES_CCMP
,
1125 MCU_CIPHER_CCMP_256
,
1127 MCU_CIPHER_GCMP_256
,
1129 MCU_CIPHER_BIP_CMAC_128
,
1130 MCU_CIPHER_BIP_CMAC_256
,
1131 MCU_CIPHER_BCN_PROT_CMAC_128
,
1132 MCU_CIPHER_BCN_PROT_CMAC_256
,
1133 MCU_CIPHER_BCN_PROT_GMAC_128
,
1134 MCU_CIPHER_BCN_PROT_GMAC_256
,
1135 MCU_CIPHER_BIP_GMAC_128
,
1136 MCU_CIPHER_BIP_GMAC_256
,
1151 MCU_PHY_STATE_TX_RATE
,
1152 MCU_PHY_STATE_RX_RATE
,
1154 MCU_PHY_STATE_CONTENTION_RX_RATE
,
1155 MCU_PHY_STATE_OFDMLQ_CNINFO
,
1158 #define MCU_CMD_ACK BIT(0)
1159 #define MCU_CMD_UNI BIT(1)
1160 #define MCU_CMD_SET BIT(2)
1162 #define MCU_CMD_UNI_EXT_ACK (MCU_CMD_ACK | MCU_CMD_UNI | \
1164 #define MCU_CMD_UNI_QUERY_ACK (MCU_CMD_ACK | MCU_CMD_UNI)
1166 #define __MCU_CMD_FIELD_ID GENMASK(7, 0)
1167 #define __MCU_CMD_FIELD_EXT_ID GENMASK(15, 8)
1168 #define __MCU_CMD_FIELD_QUERY BIT(16)
1169 #define __MCU_CMD_FIELD_UNI BIT(17)
1170 #define __MCU_CMD_FIELD_CE BIT(18)
1171 #define __MCU_CMD_FIELD_WA BIT(19)
1172 #define __MCU_CMD_FIELD_WM BIT(20)
1174 #define MCU_CMD(_t) FIELD_PREP(__MCU_CMD_FIELD_ID, \
1176 #define MCU_EXT_CMD(_t) (MCU_CMD(EXT_CID) | \
1177 FIELD_PREP(__MCU_CMD_FIELD_EXT_ID, \
1179 #define MCU_EXT_QUERY(_t) (MCU_EXT_CMD(_t) | __MCU_CMD_FIELD_QUERY)
1180 #define MCU_UNI_CMD(_t) (__MCU_CMD_FIELD_UNI | \
1181 FIELD_PREP(__MCU_CMD_FIELD_ID, \
1183 #define MCU_CE_CMD(_t) (__MCU_CMD_FIELD_CE | \
1184 FIELD_PREP(__MCU_CMD_FIELD_ID, \
1186 #define MCU_CE_QUERY(_t) (MCU_CE_CMD(_t) | __MCU_CMD_FIELD_QUERY)
1188 #define MCU_WA_CMD(_t) (MCU_CMD(_t) | __MCU_CMD_FIELD_WA)
1189 #define MCU_WA_EXT_CMD(_t) (MCU_EXT_CMD(_t) | __MCU_CMD_FIELD_WA)
1190 #define MCU_WA_PARAM_CMD(_t) (MCU_WA_CMD(WA_PARAM) | \
1191 FIELD_PREP(__MCU_CMD_FIELD_EXT_ID, \
1192 MCU_WA_PARAM_CMD_##_t))
1194 #define MCU_WM_UNI_CMD(_t) (MCU_UNI_CMD(_t) | \
1196 #define MCU_WM_UNI_CMD_QUERY(_t) (MCU_UNI_CMD(_t) | \
1197 __MCU_CMD_FIELD_QUERY | \
1199 #define MCU_WA_UNI_CMD(_t) (MCU_UNI_CMD(_t) | \
1201 #define MCU_WMWA_UNI_CMD(_t) (MCU_WM_UNI_CMD(_t) | \
1205 MCU_EXT_CMD_EFUSE_ACCESS
= 0x01,
1206 MCU_EXT_CMD_RF_REG_ACCESS
= 0x02,
1207 MCU_EXT_CMD_RF_TEST
= 0x04,
1208 MCU_EXT_CMD_ID_RADIO_ON_OFF_CTRL
= 0x05,
1209 MCU_EXT_CMD_PM_STATE_CTRL
= 0x07,
1210 MCU_EXT_CMD_CHANNEL_SWITCH
= 0x08,
1211 MCU_EXT_CMD_SET_TX_POWER_CTRL
= 0x11,
1212 MCU_EXT_CMD_FW_LOG_2_HOST
= 0x13,
1213 MCU_EXT_CMD_TXBF_ACTION
= 0x1e,
1214 MCU_EXT_CMD_EFUSE_BUFFER_MODE
= 0x21,
1215 MCU_EXT_CMD_THERMAL_PROT
= 0x23,
1216 MCU_EXT_CMD_STA_REC_UPDATE
= 0x25,
1217 MCU_EXT_CMD_BSS_INFO_UPDATE
= 0x26,
1218 MCU_EXT_CMD_EDCA_UPDATE
= 0x27,
1219 MCU_EXT_CMD_DEV_INFO_UPDATE
= 0x2A,
1220 MCU_EXT_CMD_THERMAL_CTRL
= 0x2c,
1221 MCU_EXT_CMD_WTBL_UPDATE
= 0x32,
1222 MCU_EXT_CMD_SET_DRR_CTRL
= 0x36,
1223 MCU_EXT_CMD_SET_RDD_CTRL
= 0x3a,
1224 MCU_EXT_CMD_ATE_CTRL
= 0x3d,
1225 MCU_EXT_CMD_PROTECT_CTRL
= 0x3e,
1226 MCU_EXT_CMD_DBDC_CTRL
= 0x45,
1227 MCU_EXT_CMD_MAC_INIT_CTRL
= 0x46,
1228 MCU_EXT_CMD_RX_HDR_TRANS
= 0x47,
1229 MCU_EXT_CMD_MUAR_UPDATE
= 0x48,
1230 MCU_EXT_CMD_BCN_OFFLOAD
= 0x49,
1231 MCU_EXT_CMD_RX_AIRTIME_CTRL
= 0x4a,
1232 MCU_EXT_CMD_SET_RX_PATH
= 0x4e,
1233 MCU_EXT_CMD_EFUSE_FREE_BLOCK
= 0x4f,
1234 MCU_EXT_CMD_TX_POWER_FEATURE_CTRL
= 0x58,
1235 MCU_EXT_CMD_RXDCOC_CAL
= 0x59,
1236 MCU_EXT_CMD_GET_MIB_INFO
= 0x5a,
1237 MCU_EXT_CMD_TXDPD_CAL
= 0x60,
1238 MCU_EXT_CMD_CAL_CACHE
= 0x67,
1239 MCU_EXT_CMD_RED_ENABLE
= 0x68,
1240 MCU_EXT_CMD_CP_SUPPORT
= 0x75,
1241 MCU_EXT_CMD_SET_RADAR_TH
= 0x7c,
1242 MCU_EXT_CMD_SET_RDD_PATTERN
= 0x7d,
1243 MCU_EXT_CMD_MWDS_SUPPORT
= 0x80,
1244 MCU_EXT_CMD_SET_SER_TRIGGER
= 0x81,
1245 MCU_EXT_CMD_TWT_AGRT_UPDATE
= 0x94,
1246 MCU_EXT_CMD_FW_DBG_CTRL
= 0x95,
1247 MCU_EXT_CMD_OFFCH_SCAN_CTRL
= 0x9a,
1248 MCU_EXT_CMD_SET_RDD_TH
= 0x9d,
1249 MCU_EXT_CMD_MURU_CTRL
= 0x9f,
1250 MCU_EXT_CMD_SET_SPR
= 0xa8,
1251 MCU_EXT_CMD_GROUP_PRE_CAL_INFO
= 0xab,
1252 MCU_EXT_CMD_DPD_PRE_CAL_INFO
= 0xac,
1253 MCU_EXT_CMD_PHY_STAT_INFO
= 0xad,
1257 MCU_UNI_CMD_DEV_INFO_UPDATE
= 0x01,
1258 MCU_UNI_CMD_BSS_INFO_UPDATE
= 0x02,
1259 MCU_UNI_CMD_STA_REC_UPDATE
= 0x03,
1260 MCU_UNI_CMD_EDCA_UPDATE
= 0x04,
1261 MCU_UNI_CMD_SUSPEND
= 0x05,
1262 MCU_UNI_CMD_OFFLOAD
= 0x06,
1263 MCU_UNI_CMD_HIF_CTRL
= 0x07,
1264 MCU_UNI_CMD_BAND_CONFIG
= 0x08,
1265 MCU_UNI_CMD_REPT_MUAR
= 0x09,
1266 MCU_UNI_CMD_WSYS_CONFIG
= 0x0b,
1267 MCU_UNI_CMD_REG_ACCESS
= 0x0d,
1268 MCU_UNI_CMD_CHIP_CONFIG
= 0x0e,
1269 MCU_UNI_CMD_POWER_CTRL
= 0x0f,
1270 MCU_UNI_CMD_RX_HDR_TRANS
= 0x12,
1271 MCU_UNI_CMD_SER
= 0x13,
1272 MCU_UNI_CMD_TWT
= 0x14,
1273 MCU_UNI_CMD_SET_DOMAIN_INFO
= 0x15,
1274 MCU_UNI_CMD_SCAN_REQ
= 0x16,
1275 MCU_UNI_CMD_RDD_CTRL
= 0x19,
1276 MCU_UNI_CMD_GET_MIB_INFO
= 0x22,
1277 MCU_UNI_CMD_GET_STAT_INFO
= 0x23,
1278 MCU_UNI_CMD_SNIFFER
= 0x24,
1279 MCU_UNI_CMD_SR
= 0x25,
1280 MCU_UNI_CMD_ROC
= 0x27,
1281 MCU_UNI_CMD_SET_DBDC_PARMS
= 0x28,
1282 MCU_UNI_CMD_TXPOWER
= 0x2b,
1283 MCU_UNI_CMD_SET_POWER_LIMIT
= 0x2c,
1284 MCU_UNI_CMD_EFUSE_CTRL
= 0x2d,
1285 MCU_UNI_CMD_RA
= 0x2f,
1286 MCU_UNI_CMD_MURU
= 0x31,
1287 MCU_UNI_CMD_BF
= 0x33,
1288 MCU_UNI_CMD_CHANNEL_SWITCH
= 0x34,
1289 MCU_UNI_CMD_THERMAL
= 0x35,
1290 MCU_UNI_CMD_VOW
= 0x37,
1291 MCU_UNI_CMD_FIXED_RATE_TABLE
= 0x40,
1292 MCU_UNI_CMD_RRO
= 0x57,
1293 MCU_UNI_CMD_OFFCH_SCAN_CTRL
= 0x58,
1294 MCU_UNI_CMD_PER_STA_INFO
= 0x6d,
1295 MCU_UNI_CMD_ALL_STA_INFO
= 0x6e,
1296 MCU_UNI_CMD_ASSERT_DUMP
= 0x6f,
1300 MCU_CMD_TARGET_ADDRESS_LEN_REQ
= 0x01,
1301 MCU_CMD_FW_START_REQ
= 0x02,
1302 MCU_CMD_INIT_ACCESS_REG
= 0x3,
1303 MCU_CMD_NIC_POWER_CTRL
= 0x4,
1304 MCU_CMD_PATCH_START_REQ
= 0x05,
1305 MCU_CMD_PATCH_FINISH_REQ
= 0x07,
1306 MCU_CMD_PATCH_SEM_CONTROL
= 0x10,
1307 MCU_CMD_WA_PARAM
= 0xc4,
1308 MCU_CMD_EXT_CID
= 0xed,
1309 MCU_CMD_FW_SCATTER
= 0xee,
1310 MCU_CMD_RESTART_DL_REQ
= 0xef,
1313 /* offload mcu commands */
1315 MCU_CE_CMD_TEST_CTRL
= 0x01,
1316 MCU_CE_CMD_START_HW_SCAN
= 0x03,
1317 MCU_CE_CMD_SET_PS_PROFILE
= 0x05,
1318 MCU_CE_CMD_SET_RX_FILTER
= 0x0a,
1319 MCU_CE_CMD_SET_CHAN_DOMAIN
= 0x0f,
1320 MCU_CE_CMD_SET_BSS_CONNECTED
= 0x16,
1321 MCU_CE_CMD_SET_BSS_ABORT
= 0x17,
1322 MCU_CE_CMD_CANCEL_HW_SCAN
= 0x1b,
1323 MCU_CE_CMD_SET_ROC
= 0x1c,
1324 MCU_CE_CMD_SET_EDCA_PARMS
= 0x1d,
1325 MCU_CE_CMD_SET_P2P_OPPPS
= 0x33,
1326 MCU_CE_CMD_SET_CLC
= 0x5c,
1327 MCU_CE_CMD_SET_RATE_TX_POWER
= 0x5d,
1328 MCU_CE_CMD_SCHED_SCAN_ENABLE
= 0x61,
1329 MCU_CE_CMD_SCHED_SCAN_REQ
= 0x62,
1330 MCU_CE_CMD_GET_NIC_CAPAB
= 0x8a,
1331 MCU_CE_CMD_RSSI_MONITOR
= 0xa1,
1332 MCU_CE_CMD_SET_MU_EDCA_PARMS
= 0xb0,
1333 MCU_CE_CMD_REG_WRITE
= 0xc0,
1334 MCU_CE_CMD_REG_READ
= 0xc0,
1335 MCU_CE_CMD_CHIP_CONFIG
= 0xca,
1336 MCU_CE_CMD_FWLOG_2_HOST
= 0xc5,
1337 MCU_CE_CMD_GET_WTBL
= 0xcd,
1338 MCU_CE_CMD_GET_TXPWR
= 0xd0,
1347 UNI_BSS_INFO_BASIC
= 0,
1348 UNI_BSS_INFO_RA
= 1,
1349 UNI_BSS_INFO_RLM
= 2,
1350 UNI_BSS_INFO_BSS_COLOR
= 4,
1351 UNI_BSS_INFO_HE_BASIC
= 5,
1352 UNI_BSS_INFO_11V_MBSSID
= 6,
1353 UNI_BSS_INFO_BCN_CONTENT
= 7,
1354 UNI_BSS_INFO_BCN_CSA
= 8,
1355 UNI_BSS_INFO_BCN_BCC
= 9,
1356 UNI_BSS_INFO_BCN_MBSSID
= 10,
1357 UNI_BSS_INFO_RATE
= 11,
1358 UNI_BSS_INFO_QBSS
= 15,
1359 UNI_BSS_INFO_SEC
= 16,
1360 UNI_BSS_INFO_BCN_PROT
= 17,
1361 UNI_BSS_INFO_TXCMD
= 18,
1362 UNI_BSS_INFO_UAPSD
= 19,
1363 UNI_BSS_INFO_PS
= 21,
1364 UNI_BSS_INFO_BCNFT
= 22,
1365 UNI_BSS_INFO_IFS_TIME
= 23,
1366 UNI_BSS_INFO_OFFLOAD
= 25,
1367 UNI_BSS_INFO_MLD
= 26,
1368 UNI_BSS_INFO_PM_DISABLE
= 27,
1372 UNI_OFFLOAD_OFFLOAD_ARP
,
1373 UNI_OFFLOAD_OFFLOAD_ND
,
1374 UNI_OFFLOAD_OFFLOAD_GTK_REKEY
,
1375 UNI_OFFLOAD_OFFLOAD_BMC_RPY_DETECT
,
1378 enum UNI_ALL_STA_INFO_TAG
{
1379 UNI_ALL_STA_TXRX_RATE
,
1380 UNI_ALL_STA_TX_STAT
,
1381 UNI_ALL_STA_TXRX_ADM_STAT
,
1382 UNI_ALL_STA_TXRX_AIR_TIME
,
1383 UNI_ALL_STA_DATA_TX_RETRY_COUNT
,
1384 UNI_ALL_STA_GI_MODE
,
1385 UNI_ALL_STA_TXRX_MSDU_COUNT
,
1390 MT_NIC_CAP_TX_RESOURCE
,
1391 MT_NIC_CAP_TX_EFUSE_ADDR
,
1393 MT_NIC_CAP_SINGLE_SKU
,
1394 MT_NIC_CAP_CSUM_OFFLOAD
,
1397 MT_NIC_CAP_MAC_ADDR
,
1400 MT_NIC_CAP_FRAME_BUF
,
1401 MT_NIC_CAP_BEAM_FORM
,
1402 MT_NIC_CAP_LOCATION
,
1404 MT_NIC_CAP_BUFFER_MODE_INFO
,
1405 MT_NIC_CAP_HW_ADIE_VERSION
= 0x14,
1406 MT_NIC_CAP_ANTSWP
= 0x16,
1407 MT_NIC_CAP_WFDMA_REALLOC
,
1409 MT_NIC_CAP_CHIP_CAP
= 0x20,
1410 MT_NIC_CAP_EML_CAP
= 0x22,
1413 #define UNI_WOW_DETECT_TYPE_MAGIC BIT(0)
1414 #define UNI_WOW_DETECT_TYPE_ANY BIT(1)
1415 #define UNI_WOW_DETECT_TYPE_DISCONNECT BIT(2)
1416 #define UNI_WOW_DETECT_TYPE_GTK_REKEY_FAIL BIT(3)
1417 #define UNI_WOW_DETECT_TYPE_BCN_LOST BIT(4)
1418 #define UNI_WOW_DETECT_TYPE_SCH_SCAN_HIT BIT(5)
1419 #define UNI_WOW_DETECT_TYPE_BITMAP BIT(6)
1422 UNI_SUSPEND_MODE_SETTING
,
1423 UNI_SUSPEND_WOW_CTRL
,
1424 UNI_SUSPEND_WOW_GPIO_PARAM
,
1425 UNI_SUSPEND_WOW_WAKEUP_PORT
,
1426 UNI_SUSPEND_WOW_PATTERN
,
1435 struct mt76_connac_bss_basic_tlv
{
1446 __le16 bmc_tx_wlan_idx
;
1447 __le16 bcn_interval
;
1449 u8 phymode
; /* bit(0): A
1460 __le16 nonht_basic_phy
;
1461 u8 phymode_ext
; /* bit(0) AX_6G */
1465 struct mt76_connac_bss_qos_tlv
{
1472 struct mt76_connac_beacon_loss_event
{
1478 struct mt76_connac_rssi_notify_event
{
1482 struct mt76_connac_mcu_bss_event
{
1489 struct mt76_connac_mcu_scan_ssid
{
1491 u8 ssid
[IEEE80211_MAX_SSID_LEN
];
1494 struct mt76_connac_mcu_scan_channel
{
1495 u8 band
; /* 1: 2.4GHz
1502 struct mt76_connac_mcu_scan_match
{
1504 u8 ssid
[IEEE80211_MAX_SSID_LEN
];
1509 struct mt76_connac_hw_scan_req
{
1512 u8 scan_type
; /* 0: PASSIVE SCAN
1515 u8 ssid_type
; /* BIT(0) wildcard SSID
1516 * BIT(1) P2P wildcard SSID
1517 * BIT(2) specified SSID + wildcard SSID
1518 * BIT(2) + ssid_type_ext BIT(0) specified SSID only
1521 u8 probe_req_num
; /* Number of probe request for each SSID */
1522 u8 scan_func
; /* BIT(0) Enable random MAC scan
1523 * BIT(1) Disable DBDC scan type 1~3.
1524 * BIT(2) Use DBDC scan type 3 (dedicated one RF to scan).
1526 u8 version
; /* 0: Not support fields after ies.
1527 * 1: Support fields after ies.
1529 struct mt76_connac_mcu_scan_ssid ssids
[4];
1530 __le16 probe_delay_time
;
1531 __le16 channel_dwell_time
; /* channel Dwell interval */
1532 __le16 timeout_value
;
1533 u8 channel_type
; /* 0: Full channels
1534 * 1: Only 2.4GHz channels
1535 * 2: Only 5GHz channels
1536 * 3: P2P social channel only (channel #1, #6 and #11)
1537 * 4: Specified channels
1540 u8 channels_num
; /* valid when channel_type is 4 */
1541 /* valid when channels_num is set */
1542 struct mt76_connac_mcu_scan_channel channels
[32];
1544 u8 ies
[MT76_CONNAC_SCAN_IE_LEN
];
1545 /* following fields are valid if version > 0 */
1546 u8 ext_channels_num
;
1548 __le16 channel_min_dwell_time
;
1549 struct mt76_connac_mcu_scan_channel ext_channels
[32];
1550 struct mt76_connac_mcu_scan_ssid ext_ssids
[6];
1552 u8 random_mac
[ETH_ALEN
]; /* valid when BIT(1) in scan_func is set. */
1557 #define MT76_CONNAC_SCAN_DONE_EVENT_MAX_CHANNEL_NUM 64
1559 struct mt76_connac_hw_scan_done
{
1561 u8 sparse_channel_num
;
1562 struct mt76_connac_mcu_scan_channel sparse_channel
;
1563 u8 complete_channel_num
;
1567 __le32 beacon_scan_num
;
1570 u8 sparse_channel_valid_num
;
1572 u8 channel_num
[MT76_CONNAC_SCAN_DONE_EVENT_MAX_CHANNEL_NUM
];
1573 /* idle format for channel_idle_time
1574 * 0: first bytes: idle time(ms) 2nd byte: dwell time(ms)
1575 * 1: first bytes: idle time(8ms) 2nd byte: dwell time(8ms)
1576 * 2: dwell time (16us)
1578 __le16 channel_idle_time
[MT76_CONNAC_SCAN_DONE_EVENT_MAX_CHANNEL_NUM
];
1579 /* beacon and probe response count */
1580 u8 beacon_probe_num
[MT76_CONNAC_SCAN_DONE_EVENT_MAX_CHANNEL_NUM
];
1581 u8 mdrdy_count
[MT76_CONNAC_SCAN_DONE_EVENT_MAX_CHANNEL_NUM
];
1582 __le32 beacon_2g_num
;
1583 __le32 beacon_5g_num
;
1586 struct mt76_connac_sched_scan_req
{
1594 struct mt76_connac_mcu_scan_ssid ssids
[MT76_CONNAC_MAX_SCHED_SCAN_SSID
];
1595 struct mt76_connac_mcu_scan_match match
[MT76_CONNAC_MAX_SCAN_MATCH
];
1599 u8 scan_func
; /* MT7663: BIT(0) eable random mac address */
1600 struct mt76_connac_mcu_scan_channel channels
[64];
1601 __le16 intervals
[MT76_CONNAC_MAX_NUM_SCHED_SCAN_INTERVAL
];
1604 u8 random_mac
[ETH_ALEN
];
1612 u8 random_mac
[ETH_ALEN
];
1618 struct mt76_connac_sched_scan_done
{
1620 u8 status
; /* 0: ssid found */
1624 struct bss_info_uni_bss_color
{
1632 struct bss_info_uni_he
{
1635 __le16 he_rts_thres
;
1638 __le16 max_nss_mcs
[CMD_HE_MCS_BW_NUM
];
1642 struct bss_info_uni_mbssid
{
1651 struct mt76_connac_gtk_rekey_tlv
{
1654 u8 kek
[NL80211_KEK_LEN
];
1655 u8 kck
[NL80211_KCK_LEN
];
1656 u8 replay_ctr
[NL80211_REPLAY_CTR_LEN
];
1657 u8 rekey_mode
; /* 0: rekey offload enable
1658 * 1: rekey offload disable
1662 u8 option
; /* 1: rekey data update without enabling offload */
1664 __le32 proto
; /* WPA-RSN-WAPI-OPSN */
1665 __le32 pairwise_cipher
;
1666 __le32 group_cipher
;
1667 __le32 key_mgmt
; /* NONE-PSK-IEEE802.1X */
1668 __le32 mgmt_group_cipher
;
1672 #define MT76_CONNAC_WOW_MASK_MAX_LEN 16
1673 #define MT76_CONNAC_WOW_PATTEN_MAX_LEN 128
1675 struct mt76_connac_wow_pattern_tlv
{
1678 u8 index
; /* pattern index */
1679 u8 enable
; /* 0: disable
1682 u8 data_len
; /* pattern length */
1684 u8 mask
[MT76_CONNAC_WOW_MASK_MAX_LEN
];
1685 u8 pattern
[MT76_CONNAC_WOW_PATTEN_MAX_LEN
];
1689 struct mt76_connac_wow_ctrl_tlv
{
1692 u8 cmd
; /* 0x1: PM_WOWLAN_REQ_START
1693 * 0x2: PM_WOWLAN_REQ_STOP
1694 * 0x3: PM_WOWLAN_PARAM_CLEAR
1696 u8 trigger
; /* 0: NONE
1697 * BIT(0): NL80211_WOWLAN_TRIG_MAGIC_PKT
1698 * BIT(1): NL80211_WOWLAN_TRIG_ANY
1699 * BIT(2): NL80211_WOWLAN_TRIG_DISCONNECT
1700 * BIT(3): NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE
1701 * BIT(4): BEACON_LOST
1702 * BIT(5): NL80211_WOWLAN_TRIG_NET_DETECT
1704 u8 wakeup_hif
; /* 0x0: HIF_SDIO
1713 struct mt76_connac_wow_gpio_param_tlv
{
1719 __le32 gpio_interval
;
1723 struct mt76_connac_arpns_tlv
{
1732 struct mt76_connac_suspend_tlv
{
1735 u8 enable
; /* 0: suspend mode disabled
1736 * 1: suspend mode enabled
1738 u8 mdtim
; /* LP parameter */
1739 u8 wow_suspend
; /* 0: update by origin policy
1740 * 1: update by wow dtim
1745 enum mt76_sta_info_state
{
1746 MT76_STA_INFO_STATE_NONE
,
1747 MT76_STA_INFO_STATE_AUTH
,
1748 MT76_STA_INFO_STATE_ASSOC
1751 struct mt76_sta_cmd_info
{
1753 struct ieee80211_sta
*sta
;
1754 struct ieee80211_link_sta
*link_sta
;
1756 struct mt76_wcid
*wcid
;
1758 struct ieee80211_vif
*vif
;
1768 #define MT_SKU_POWER_LIMIT 161
1770 struct mt76_connac_sku_tlv
{
1772 s8 pwr_limit
[MT_SKU_POWER_LIMIT
];
1775 struct mt76_connac_tx_power_limit_tlv
{
1776 /* DW0 - common info*/
1780 /* DW1 - cmd hint */
1781 u8 n_chan
; /* # channel */
1782 u8 band
; /* 2.4GHz - 5GHz - 6GHz */
1786 u8 alpha2
[4]; /* regulatory_request.alpha2 */
1790 struct mt76_connac_config
{
1799 struct mt76_connac_mcu_uni_event
{
1802 __le32 status
; /* 0: success, others: fail */
1805 struct mt76_connac_mcu_reg_event
{
1810 static inline enum mcu_cipher_type
1811 mt76_connac_mcu_get_cipher(int cipher
)
1814 case WLAN_CIPHER_SUITE_WEP40
:
1815 return MCU_CIPHER_WEP40
;
1816 case WLAN_CIPHER_SUITE_WEP104
:
1817 return MCU_CIPHER_WEP104
;
1818 case WLAN_CIPHER_SUITE_TKIP
:
1819 return MCU_CIPHER_TKIP
;
1820 case WLAN_CIPHER_SUITE_AES_CMAC
:
1821 return MCU_CIPHER_BIP_CMAC_128
;
1822 case WLAN_CIPHER_SUITE_CCMP
:
1823 return MCU_CIPHER_AES_CCMP
;
1824 case WLAN_CIPHER_SUITE_CCMP_256
:
1825 return MCU_CIPHER_CCMP_256
;
1826 case WLAN_CIPHER_SUITE_GCMP
:
1827 return MCU_CIPHER_GCMP
;
1828 case WLAN_CIPHER_SUITE_GCMP_256
:
1829 return MCU_CIPHER_GCMP_256
;
1830 case WLAN_CIPHER_SUITE_BIP_GMAC_128
:
1831 return MCU_CIPHER_BIP_GMAC_128
;
1832 case WLAN_CIPHER_SUITE_BIP_GMAC_256
:
1833 return MCU_CIPHER_BIP_GMAC_256
;
1834 case WLAN_CIPHER_SUITE_BIP_CMAC_256
:
1835 return MCU_CIPHER_BIP_CMAC_256
;
1836 case WLAN_CIPHER_SUITE_SMS4
:
1837 return MCU_CIPHER_WAPI
;
1839 return MCU_CIPHER_NONE
;
1844 mt76_connac_mcu_gen_dl_mode(struct mt76_dev
*dev
, u8 feature_set
, bool is_wa
)
1848 ret
|= feature_set
& FW_FEATURE_SET_ENCRYPT
?
1849 DL_MODE_ENCRYPT
| DL_MODE_RESET_SEC_IV
: 0;
1850 if (is_mt7921(dev
) || is_mt7925(dev
))
1851 ret
|= feature_set
& FW_FEATURE_ENCRY_MODE
?
1852 DL_CONFIG_ENCRY_MODE_SEL
: 0;
1853 ret
|= FIELD_PREP(DL_MODE_KEY_IDX
,
1854 FIELD_GET(FW_FEATURE_SET_KEY_IDX
, feature_set
));
1855 ret
|= DL_MODE_NEED_RSP
;
1856 ret
|= is_wa
? DL_MODE_WORKING_PDA_CR4
: 0;
1861 #define to_wcid_lo(id) FIELD_GET(GENMASK(7, 0), (u16)id)
1862 #define to_wcid_hi(id) FIELD_GET(GENMASK(10, 8), (u16)id)
1865 mt76_connac_mcu_get_wlan_idx(struct mt76_dev
*dev
, struct mt76_wcid
*wcid
,
1866 u8
*wlan_idx_lo
, u8
*wlan_idx_hi
)
1870 if (!is_connac_v1(dev
)) {
1871 *wlan_idx_lo
= wcid
? to_wcid_lo(wcid
->idx
) : 0;
1872 *wlan_idx_hi
= wcid
? to_wcid_hi(wcid
->idx
) : 0;
1874 *wlan_idx_lo
= wcid
? wcid
->idx
: 0;
1879 __mt76_connac_mcu_alloc_sta_req(struct mt76_dev
*dev
, struct mt76_vif
*mvif
,
1880 struct mt76_wcid
*wcid
, int len
);
1881 static inline struct sk_buff
*
1882 mt76_connac_mcu_alloc_sta_req(struct mt76_dev
*dev
, struct mt76_vif
*mvif
,
1883 struct mt76_wcid
*wcid
)
1885 return __mt76_connac_mcu_alloc_sta_req(dev
, mvif
, wcid
,
1886 MT76_CONNAC_STA_UPDATE_MAX_SIZE
);
1889 struct wtbl_req_hdr
*
1890 mt76_connac_mcu_alloc_wtbl_req(struct mt76_dev
*dev
, struct mt76_wcid
*wcid
,
1891 int cmd
, void *sta_wtbl
, struct sk_buff
**skb
);
1892 struct tlv
*mt76_connac_mcu_add_nested_tlv(struct sk_buff
*skb
, int tag
,
1893 int len
, void *sta_ntlv
,
1895 static inline struct tlv
*
1896 mt76_connac_mcu_add_tlv(struct sk_buff
*skb
, int tag
, int len
)
1898 return mt76_connac_mcu_add_nested_tlv(skb
, tag
, len
, skb
->data
, NULL
);
1901 int mt76_connac_mcu_set_channel_domain(struct mt76_phy
*phy
);
1902 int mt76_connac_mcu_set_vif_ps(struct mt76_dev
*dev
, struct ieee80211_vif
*vif
);
1903 void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev
*dev
, struct sk_buff
*skb
,
1904 struct ieee80211_vif
*vif
,
1905 struct ieee80211_link_sta
*link_sta
,
1906 int state
, bool newly
);
1907 void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev
*dev
, struct sk_buff
*skb
,
1908 struct ieee80211_vif
*vif
,
1909 struct ieee80211_sta
*sta
, void *sta_wtbl
,
1911 void mt76_connac_mcu_wtbl_hdr_trans_tlv(struct sk_buff
*skb
,
1912 struct ieee80211_vif
*vif
,
1913 struct mt76_wcid
*wcid
,
1914 void *sta_wtbl
, void *wtbl_tlv
);
1915 int mt76_connac_mcu_sta_update_hdr_trans(struct mt76_dev
*dev
,
1916 struct ieee80211_vif
*vif
,
1917 struct mt76_wcid
*wcid
, int cmd
);
1918 void mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff
*skb
, struct ieee80211_sta
*sta
);
1919 u8
mt76_connac_get_phy_mode_v2(struct mt76_phy
*mphy
, struct ieee80211_vif
*vif
,
1920 enum nl80211_band band
,
1921 struct ieee80211_link_sta
*link_sta
);
1922 int mt76_connac_mcu_wtbl_update_hdr_trans(struct mt76_dev
*dev
,
1923 struct ieee80211_vif
*vif
,
1924 struct ieee80211_sta
*sta
);
1925 void mt76_connac_mcu_sta_tlv(struct mt76_phy
*mphy
, struct sk_buff
*skb
,
1926 struct ieee80211_sta
*sta
,
1927 struct ieee80211_vif
*vif
,
1929 void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev
*dev
, struct sk_buff
*skb
,
1930 struct ieee80211_sta
*sta
, void *sta_wtbl
,
1931 void *wtbl_tlv
, bool ht_ldpc
, bool vht_ldpc
);
1932 void mt76_connac_mcu_wtbl_ba_tlv(struct mt76_dev
*dev
, struct sk_buff
*skb
,
1933 struct ieee80211_ampdu_params
*params
,
1934 bool enable
, bool tx
, void *sta_wtbl
,
1936 void mt76_connac_mcu_sta_ba_tlv(struct sk_buff
*skb
,
1937 struct ieee80211_ampdu_params
*params
,
1938 bool enable
, bool tx
);
1939 int mt76_connac_mcu_uni_add_dev(struct mt76_phy
*phy
,
1940 struct ieee80211_bss_conf
*bss_conf
,
1941 struct mt76_wcid
*wcid
,
1943 int mt76_connac_mcu_sta_ba(struct mt76_dev
*dev
, struct mt76_vif
*mvif
,
1944 struct ieee80211_ampdu_params
*params
,
1945 int cmd
, bool enable
, bool tx
);
1946 int mt76_connac_mcu_uni_set_chctx(struct mt76_phy
*phy
,
1947 struct mt76_vif
*vif
,
1948 struct ieee80211_chanctx_conf
*ctx
);
1949 int mt76_connac_mcu_uni_add_bss(struct mt76_phy
*phy
,
1950 struct ieee80211_vif
*vif
,
1951 struct mt76_wcid
*wcid
,
1953 struct ieee80211_chanctx_conf
*ctx
);
1954 int mt76_connac_mcu_sta_cmd(struct mt76_phy
*phy
,
1955 struct mt76_sta_cmd_info
*info
);
1956 void mt76_connac_mcu_beacon_loss_iter(void *priv
, u8
*mac
,
1957 struct ieee80211_vif
*vif
);
1958 int mt76_connac_mcu_set_rts_thresh(struct mt76_dev
*dev
, u32 val
, u8 band
);
1959 int mt76_connac_mcu_set_mac_enable(struct mt76_dev
*dev
, int band
, bool enable
,
1961 int mt76_connac_mcu_init_download(struct mt76_dev
*dev
, u32 addr
, u32 len
,
1963 int mt76_connac_mcu_start_patch(struct mt76_dev
*dev
);
1964 int mt76_connac_mcu_patch_sem_ctrl(struct mt76_dev
*dev
, bool get
);
1965 int mt76_connac_mcu_start_firmware(struct mt76_dev
*dev
, u32 addr
, u32 option
);
1967 int mt76_connac_mcu_hw_scan(struct mt76_phy
*phy
, struct ieee80211_vif
*vif
,
1968 struct ieee80211_scan_request
*scan_req
);
1969 int mt76_connac_mcu_cancel_hw_scan(struct mt76_phy
*phy
,
1970 struct ieee80211_vif
*vif
);
1971 int mt76_connac_mcu_sched_scan_req(struct mt76_phy
*phy
,
1972 struct ieee80211_vif
*vif
,
1973 struct cfg80211_sched_scan_request
*sreq
);
1974 int mt76_connac_mcu_sched_scan_enable(struct mt76_phy
*phy
,
1975 struct ieee80211_vif
*vif
,
1977 int mt76_connac_mcu_update_arp_filter(struct mt76_dev
*dev
,
1978 struct mt76_vif
*vif
,
1979 struct ieee80211_bss_conf
*info
);
1980 int mt76_connac_mcu_set_gtk_rekey(struct mt76_dev
*dev
, struct ieee80211_vif
*vif
,
1982 int mt76_connac_mcu_set_wow_ctrl(struct mt76_phy
*phy
, struct ieee80211_vif
*vif
,
1983 bool suspend
, struct cfg80211_wowlan
*wowlan
);
1984 int mt76_connac_mcu_update_gtk_rekey(struct ieee80211_hw
*hw
,
1985 struct ieee80211_vif
*vif
,
1986 struct cfg80211_gtk_rekey_data
*key
);
1987 int mt76_connac_mcu_set_suspend_mode(struct mt76_dev
*dev
,
1988 struct ieee80211_vif
*vif
,
1989 bool enable
, u8 mdtim
,
1991 int mt76_connac_mcu_set_hif_suspend(struct mt76_dev
*dev
, bool suspend
);
1992 void mt76_connac_mcu_set_suspend_iter(void *priv
, u8
*mac
,
1993 struct ieee80211_vif
*vif
);
1994 int mt76_connac_sta_state_dp(struct mt76_dev
*dev
,
1995 enum ieee80211_sta_state old_state
,
1996 enum ieee80211_sta_state new_state
);
1997 int mt76_connac_mcu_chip_config(struct mt76_dev
*dev
);
1998 int mt76_connac_mcu_set_deep_sleep(struct mt76_dev
*dev
, bool enable
);
1999 void mt76_connac_mcu_coredump_event(struct mt76_dev
*dev
, struct sk_buff
*skb
,
2000 struct mt76_connac_coredump
*coredump
);
2001 s8
mt76_connac_get_ch_power(struct mt76_phy
*phy
,
2002 struct ieee80211_channel
*chan
,
2004 int mt76_connac_mcu_set_rate_txpower(struct mt76_phy
*phy
);
2005 int mt76_connac_mcu_set_p2p_oppps(struct ieee80211_hw
*hw
,
2006 struct ieee80211_vif
*vif
);
2007 u32
mt76_connac_mcu_reg_rr(struct mt76_dev
*dev
, u32 offset
);
2008 void mt76_connac_mcu_reg_wr(struct mt76_dev
*dev
, u32 offset
, u32 val
);
2010 const struct ieee80211_sta_he_cap
*
2011 mt76_connac_get_he_phy_cap(struct mt76_phy
*phy
, struct ieee80211_vif
*vif
);
2012 const struct ieee80211_sta_eht_cap
*
2013 mt76_connac_get_eht_phy_cap(struct mt76_phy
*phy
, struct ieee80211_vif
*vif
);
2014 u8
mt76_connac_get_phy_mode(struct mt76_phy
*phy
, struct ieee80211_vif
*vif
,
2015 enum nl80211_band band
,
2016 struct ieee80211_link_sta
*sta
);
2017 u8
mt76_connac_get_phy_mode_ext(struct mt76_phy
*phy
, struct ieee80211_vif
*vif
,
2018 enum nl80211_band band
);
2020 int mt76_connac_mcu_add_key(struct mt76_dev
*dev
, struct ieee80211_vif
*vif
,
2021 struct mt76_connac_sta_key_conf
*sta_key_conf
,
2022 struct ieee80211_key_conf
*key
, int mcu_cmd
,
2023 struct mt76_wcid
*wcid
, enum set_key_cmd cmd
);
2025 void mt76_connac_mcu_bss_ext_tlv(struct sk_buff
*skb
, struct mt76_vif
*mvif
);
2026 void mt76_connac_mcu_bss_omac_tlv(struct sk_buff
*skb
,
2027 struct ieee80211_vif
*vif
);
2028 int mt76_connac_mcu_bss_basic_tlv(struct sk_buff
*skb
,
2029 struct ieee80211_vif
*vif
,
2030 struct ieee80211_sta
*sta
,
2031 struct mt76_phy
*phy
, u16 wlan_idx
,
2033 void mt76_connac_mcu_sta_uapsd(struct sk_buff
*skb
, struct ieee80211_vif
*vif
,
2034 struct ieee80211_sta
*sta
);
2035 void mt76_connac_mcu_wtbl_smps_tlv(struct sk_buff
*skb
,
2036 struct ieee80211_sta
*sta
,
2037 void *sta_wtbl
, void *wtbl_tlv
);
2038 int mt76_connac_mcu_set_pm(struct mt76_dev
*dev
, int band
, int enter
);
2039 int mt76_connac_mcu_restart(struct mt76_dev
*dev
);
2040 int mt76_connac_mcu_del_wtbl_all(struct mt76_dev
*dev
);
2041 int mt76_connac_mcu_rdd_cmd(struct mt76_dev
*dev
, int cmd
, u8 index
,
2043 int mt76_connac_mcu_sta_wed_update(struct mt76_dev
*dev
, struct sk_buff
*skb
);
2044 int mt76_connac2_load_ram(struct mt76_dev
*dev
, const char *fw_wm
,
2046 int mt76_connac2_load_patch(struct mt76_dev
*dev
, const char *fw_name
);
2047 int mt76_connac2_mcu_fill_message(struct mt76_dev
*mdev
, struct sk_buff
*skb
,
2048 int cmd
, int *wait_seq
);
2049 #endif /* __MT76_CONNAC_MCU_H */