1 /* SPDX-License-Identifier: ISC */ 2 /* Copyright (C) 2020 MediaTek Inc. */ 3 4 #ifndef __MT7921_MCU_H 5 #define __MT7921_MCU_H 6 7 #include "../mt76_connac_mcu.h" 8 9 struct mt7921_mcu_tx_done_event { 10 u8 pid; 11 u8 status; 12 __le16 seq; 13 14 u8 wlan_idx; 15 u8 tx_cnt; 16 __le16 tx_rate; 17 18 u8 flag; 19 u8 tid; 20 u8 rsp_rate; 21 u8 mcs; 22 23 u8 bw; 24 u8 tx_pwr; 25 u8 reason; 26 u8 rsv0[1]; 27 28 __le32 delay; 29 __le32 timestamp; 30 __le32 applied_flag; 31 u8 txs[28]; 32 33 u8 rsv1[32]; 34 } __packed; 35 36 /* ext event table */ 37 enum { 38 MCU_EXT_EVENT_RATE_REPORT = 0x87, 39 }; 40 41 struct mt7921_mcu_eeprom_info { 42 __le32 addr; 43 __le32 valid; 44 u8 data[16]; 45 } __packed; 46 47 #define MT_RA_RATE_NSS GENMASK(8, 6) 48 #define MT_RA_RATE_MCS GENMASK(3, 0) 49 #define MT_RA_RATE_TX_MODE GENMASK(12, 9) 50 #define MT_RA_RATE_DCM_EN BIT(4) 51 #define MT_RA_RATE_BW GENMASK(14, 13) 52 53 struct mt7921_mcu_uni_event { 54 u8 cid; 55 u8 pad[3]; 56 __le32 status; /* 0: success, others: fail */ 57 } __packed; 58 59 enum { 60 MT_EBF = BIT(0), /* explicit beamforming */ 61 MT_IBF = BIT(1) /* implicit beamforming */ 62 }; 63 64 struct mt7921_mcu_reg_event { 65 __le32 reg; 66 __le32 val; 67 } __packed; 68 69 struct mt7921_mcu_ant_id_config { 70 u8 ant_id[4]; 71 } __packed; 72 73 struct mt7921_txpwr_req { 74 u8 ver; 75 u8 action; 76 __le16 len; 77 u8 dbdc_idx; 78 u8 rsv[3]; 79 } __packed; 80 81 struct mt7921_txpwr_event { 82 u8 ver; 83 u8 action; 84 __le16 len; 85 struct mt7921_txpwr txpwr; 86 } __packed; 87 88 enum { 89 TM_SWITCH_MODE, 90 TM_SET_AT_CMD, 91 TM_QUERY_AT_CMD, 92 }; 93 94 enum { 95 MT7921_TM_NORMAL, 96 MT7921_TM_TESTMODE, 97 MT7921_TM_ICAP, 98 MT7921_TM_ICAP_OVERLAP, 99 MT7921_TM_WIFISPECTRUM, 100 }; 101 102 struct mt7921_rftest_cmd { 103 u8 action; 104 u8 rsv[3]; 105 __le32 param0; 106 __le32 param1; 107 } __packed; 108 109 struct mt7921_rftest_evt { 110 __le32 param0; 111 __le32 param1; 112 } __packed; 113 #endif 114