104b8e659SRyder Lee /* SPDX-License-Identifier: ISC */
204b8e659SRyder Lee /* Copyright (C) 2019 MediaTek Inc. */
304b8e659SRyder Lee 
404b8e659SRyder Lee #ifndef __MT7615_MAC_H
504b8e659SRyder Lee #define __MT7615_MAC_H
604b8e659SRyder Lee 
704b8e659SRyder Lee #define MT_CT_PARSE_LEN			72
804b8e659SRyder Lee #define MT_CT_DMA_BUF_NUM		2
904b8e659SRyder Lee 
1004b8e659SRyder Lee #define MT_RXD0_LENGTH			GENMASK(15, 0)
1104b8e659SRyder Lee #define MT_RXD0_PKT_TYPE		GENMASK(31, 29)
1204b8e659SRyder Lee 
1304b8e659SRyder Lee #define MT_RXD0_NORMAL_ETH_TYPE_OFS	GENMASK(22, 16)
1404b8e659SRyder Lee #define MT_RXD0_NORMAL_IP_SUM		BIT(23)
1504b8e659SRyder Lee #define MT_RXD0_NORMAL_UDP_TCP_SUM	BIT(24)
1604b8e659SRyder Lee #define MT_RXD0_NORMAL_GROUP_1		BIT(25)
1704b8e659SRyder Lee #define MT_RXD0_NORMAL_GROUP_2		BIT(26)
1804b8e659SRyder Lee #define MT_RXD0_NORMAL_GROUP_3		BIT(27)
1904b8e659SRyder Lee #define MT_RXD0_NORMAL_GROUP_4		BIT(28)
2004b8e659SRyder Lee 
2104b8e659SRyder Lee enum rx_pkt_type {
2204b8e659SRyder Lee 	PKT_TYPE_TXS,
2304b8e659SRyder Lee 	PKT_TYPE_TXRXV,
2404b8e659SRyder Lee 	PKT_TYPE_NORMAL,
2504b8e659SRyder Lee 	PKT_TYPE_RX_DUP_RFB,
2604b8e659SRyder Lee 	PKT_TYPE_RX_TMR,
2704b8e659SRyder Lee 	PKT_TYPE_RETRIEVE,
2804b8e659SRyder Lee 	PKT_TYPE_TXRX_NOTIFY,
2904b8e659SRyder Lee 	PKT_TYPE_RX_EVENT
3004b8e659SRyder Lee };
3104b8e659SRyder Lee 
3204b8e659SRyder Lee #define MT_RXD1_NORMAL_BSSID		GENMASK(31, 26)
3304b8e659SRyder Lee #define MT_RXD1_NORMAL_PAYLOAD_FORMAT	GENMASK(25, 24)
3404b8e659SRyder Lee #define MT_RXD1_NORMAL_HDR_TRANS	BIT(23)
3504b8e659SRyder Lee #define MT_RXD1_NORMAL_HDR_OFFSET	BIT(22)
3604b8e659SRyder Lee #define MT_RXD1_NORMAL_MAC_HDR_LEN	GENMASK(21, 16)
3704b8e659SRyder Lee #define MT_RXD1_NORMAL_CH_FREQ		GENMASK(15, 8)
3804b8e659SRyder Lee #define MT_RXD1_NORMAL_KEY_ID		GENMASK(7, 6)
3904b8e659SRyder Lee #define MT_RXD1_NORMAL_BEACON_UC	BIT(5)
4004b8e659SRyder Lee #define MT_RXD1_NORMAL_BEACON_MC	BIT(4)
4104b8e659SRyder Lee #define MT_RXD1_NORMAL_BF_REPORT	BIT(3)
4204b8e659SRyder Lee #define MT_RXD1_NORMAL_ADDR_TYPE	GENMASK(2, 1)
4304b8e659SRyder Lee #define MT_RXD1_NORMAL_BCAST		GENMASK(2, 1)
4404b8e659SRyder Lee #define MT_RXD1_NORMAL_MCAST		BIT(2)
4504b8e659SRyder Lee #define MT_RXD1_NORMAL_U2M		BIT(1)
4604b8e659SRyder Lee #define MT_RXD1_NORMAL_HTC_VLD		BIT(0)
4704b8e659SRyder Lee 
4804b8e659SRyder Lee #define MT_RXD2_NORMAL_NON_AMPDU	BIT(31)
4904b8e659SRyder Lee #define MT_RXD2_NORMAL_NON_AMPDU_SUB	BIT(30)
5004b8e659SRyder Lee #define MT_RXD2_NORMAL_NDATA		BIT(29)
5104b8e659SRyder Lee #define MT_RXD2_NORMAL_NULL_FRAME	BIT(28)
5204b8e659SRyder Lee #define MT_RXD2_NORMAL_FRAG		BIT(27)
5304b8e659SRyder Lee #define MT_RXD2_NORMAL_INT_FRAME	BIT(26)
5404b8e659SRyder Lee #define MT_RXD2_NORMAL_HDR_TRANS_ERROR	BIT(25)
5504b8e659SRyder Lee #define MT_RXD2_NORMAL_MAX_LEN_ERROR	BIT(24)
5604b8e659SRyder Lee #define MT_RXD2_NORMAL_AMSDU_ERR	BIT(23)
5704b8e659SRyder Lee #define MT_RXD2_NORMAL_LEN_MISMATCH	BIT(22)
5804b8e659SRyder Lee #define MT_RXD2_NORMAL_TKIP_MIC_ERR	BIT(21)
5904b8e659SRyder Lee #define MT_RXD2_NORMAL_ICV_ERR		BIT(20)
6004b8e659SRyder Lee #define MT_RXD2_NORMAL_CLM		BIT(19)
6104b8e659SRyder Lee #define MT_RXD2_NORMAL_CM		BIT(18)
6204b8e659SRyder Lee #define MT_RXD2_NORMAL_FCS_ERR		BIT(17)
6304b8e659SRyder Lee #define MT_RXD2_NORMAL_SW_BIT		BIT(16)
6404b8e659SRyder Lee #define MT_RXD2_NORMAL_SEC_MODE		GENMASK(15, 12)
6504b8e659SRyder Lee #define MT_RXD2_NORMAL_TID		GENMASK(11, 8)
6604b8e659SRyder Lee #define MT_RXD2_NORMAL_WLAN_IDX		GENMASK(7, 0)
6704b8e659SRyder Lee 
6804b8e659SRyder Lee #define MT_RXD3_NORMAL_PF_STS		GENMASK(31, 30)
6904b8e659SRyder Lee #define MT_RXD3_NORMAL_PF_MODE		BIT(29)
7004b8e659SRyder Lee #define MT_RXD3_NORMAL_CLS_BITMAP	GENMASK(28, 19)
7104b8e659SRyder Lee #define MT_RXD3_NORMAL_WOL		GENMASK(18, 14)
7204b8e659SRyder Lee #define MT_RXD3_NORMAL_MAGIC_PKT	BIT(13)
7304b8e659SRyder Lee #define MT_RXD3_NORMAL_OFLD		GENMASK(12, 11)
7404b8e659SRyder Lee #define MT_RXD3_NORMAL_CLS		BIT(10)
7504b8e659SRyder Lee #define MT_RXD3_NORMAL_PATTERN_DROP	BIT(9)
7604b8e659SRyder Lee #define MT_RXD3_NORMAL_TSF_COMPARE_LOSS	BIT(8)
7704b8e659SRyder Lee #define MT_RXD3_NORMAL_RXV_SEQ		GENMASK(7, 0)
7804b8e659SRyder Lee 
7904b8e659SRyder Lee #define MT_RXV1_ACID_DET_H		BIT(31)
8004b8e659SRyder Lee #define MT_RXV1_ACID_DET_L		BIT(30)
8104b8e659SRyder Lee #define MT_RXV1_VHTA2_B8_B3		GENMASK(29, 24)
8204b8e659SRyder Lee #define MT_RXV1_NUM_RX			GENMASK(23, 22)
8304b8e659SRyder Lee #define MT_RXV1_HT_NO_SOUND		BIT(21)
8404b8e659SRyder Lee #define MT_RXV1_HT_SMOOTH		BIT(20)
8504b8e659SRyder Lee #define MT_RXV1_HT_SHORT_GI		BIT(19)
8604b8e659SRyder Lee #define MT_RXV1_HT_AGGR			BIT(18)
8704b8e659SRyder Lee #define MT_RXV1_VHTA1_B22		BIT(17)
8804b8e659SRyder Lee #define MT_RXV1_FRAME_MODE		GENMASK(16, 15)
8904b8e659SRyder Lee #define MT_RXV1_TX_MODE			GENMASK(14, 12)
9004b8e659SRyder Lee #define MT_RXV1_HT_EXT_LTF		GENMASK(11, 10)
9104b8e659SRyder Lee #define MT_RXV1_HT_AD_CODE		BIT(9)
9204b8e659SRyder Lee #define MT_RXV1_HT_STBC			GENMASK(8, 7)
9304b8e659SRyder Lee #define MT_RXV1_TX_RATE			GENMASK(6, 0)
9404b8e659SRyder Lee 
9504b8e659SRyder Lee #define MT_RXV2_SEL_ANT			BIT(31)
9604b8e659SRyder Lee #define MT_RXV2_VALID_BIT		BIT(30)
9704b8e659SRyder Lee #define MT_RXV2_NSTS			GENMASK(29, 27)
9804b8e659SRyder Lee #define MT_RXV2_GROUP_ID		GENMASK(26, 21)
9904b8e659SRyder Lee #define MT_RXV2_LENGTH			GENMASK(20, 0)
10004b8e659SRyder Lee 
101bf92e768SRyder Lee #define MT_RXV4_RCPI3			GENMASK(31, 24)
102bf92e768SRyder Lee #define MT_RXV4_RCPI2			GENMASK(23, 16)
103bf92e768SRyder Lee #define MT_RXV4_RCPI1			GENMASK(15, 8)
104bf92e768SRyder Lee #define MT_RXV4_RCPI0			GENMASK(7, 0)
105bf92e768SRyder Lee 
10604b8e659SRyder Lee enum tx_header_format {
10704b8e659SRyder Lee 	MT_HDR_FORMAT_802_3,
10804b8e659SRyder Lee 	MT_HDR_FORMAT_CMD,
10904b8e659SRyder Lee 	MT_HDR_FORMAT_802_11,
11004b8e659SRyder Lee 	MT_HDR_FORMAT_802_11_EXT,
11104b8e659SRyder Lee };
11204b8e659SRyder Lee 
11304b8e659SRyder Lee enum tx_pkt_type {
11404b8e659SRyder Lee 	MT_TX_TYPE_CT,
11504b8e659SRyder Lee 	MT_TX_TYPE_SF,
11604b8e659SRyder Lee 	MT_TX_TYPE_CMD,
11704b8e659SRyder Lee 	MT_TX_TYPE_FW,
11804b8e659SRyder Lee };
11904b8e659SRyder Lee 
12004b8e659SRyder Lee enum tx_pkt_queue_idx {
12104b8e659SRyder Lee 	MT_LMAC_AC00,
12204b8e659SRyder Lee 	MT_LMAC_AC01,
12304b8e659SRyder Lee 	MT_LMAC_AC02,
12404b8e659SRyder Lee 	MT_LMAC_AC03,
12504b8e659SRyder Lee 	MT_LMAC_ALTX0 = 0x10,
12604b8e659SRyder Lee 	MT_LMAC_BMC0,
12704b8e659SRyder Lee 	MT_LMAC_BCN0,
12804b8e659SRyder Lee 	MT_LMAC_PSMP0,
1299ce2f7faSFelix Fietkau 	MT_LMAC_ALTX1,
1309ce2f7faSFelix Fietkau 	MT_LMAC_BMC1,
1319ce2f7faSFelix Fietkau 	MT_LMAC_BCN1,
1329ce2f7faSFelix Fietkau 	MT_LMAC_PSMP1,
13304b8e659SRyder Lee };
13404b8e659SRyder Lee 
13504b8e659SRyder Lee enum tx_port_idx {
13604b8e659SRyder Lee 	MT_TX_PORT_IDX_LMAC,
13704b8e659SRyder Lee 	MT_TX_PORT_IDX_MCU
13804b8e659SRyder Lee };
13904b8e659SRyder Lee 
14004b8e659SRyder Lee enum tx_mcu_port_q_idx {
14104b8e659SRyder Lee 	MT_TX_MCU_PORT_RX_Q0 = 0,
14204b8e659SRyder Lee 	MT_TX_MCU_PORT_RX_Q1,
14304b8e659SRyder Lee 	MT_TX_MCU_PORT_RX_Q2,
14404b8e659SRyder Lee 	MT_TX_MCU_PORT_RX_Q3,
14504b8e659SRyder Lee 	MT_TX_MCU_PORT_RX_FWDL = 0x1e
14604b8e659SRyder Lee };
14704b8e659SRyder Lee 
14804b8e659SRyder Lee enum tx_phy_bandwidth {
14904b8e659SRyder Lee 	MT_PHY_BW_20,
15004b8e659SRyder Lee 	MT_PHY_BW_40,
15104b8e659SRyder Lee 	MT_PHY_BW_80,
15204b8e659SRyder Lee 	MT_PHY_BW_160,
15304b8e659SRyder Lee };
15404b8e659SRyder Lee 
15504b8e659SRyder Lee #define MT_CT_INFO_APPLY_TXD		BIT(0)
15604b8e659SRyder Lee #define MT_CT_INFO_COPY_HOST_TXD_ALL	BIT(1)
15704b8e659SRyder Lee #define MT_CT_INFO_MGMT_FRAME		BIT(2)
15804b8e659SRyder Lee #define MT_CT_INFO_NONE_CIPHER_FRAME	BIT(3)
15904b8e659SRyder Lee #define MT_CT_INFO_HSR2_TX		BIT(4)
16004b8e659SRyder Lee 
16104b8e659SRyder Lee #define MT_TXD_SIZE			(8 * 4)
16204b8e659SRyder Lee 
16304b8e659SRyder Lee #define MT_TXD0_P_IDX			BIT(31)
16404b8e659SRyder Lee #define MT_TXD0_Q_IDX			GENMASK(30, 26)
16504b8e659SRyder Lee #define MT_TXD0_UDP_TCP_SUM		BIT(24)
16604b8e659SRyder Lee #define MT_TXD0_IP_SUM			BIT(23)
16704b8e659SRyder Lee #define MT_TXD0_ETH_TYPE_OFFSET		GENMASK(22, 16)
16804b8e659SRyder Lee #define MT_TXD0_TX_BYTES		GENMASK(15, 0)
16904b8e659SRyder Lee 
17004b8e659SRyder Lee #define MT_TXD1_OWN_MAC			GENMASK(31, 26)
17104b8e659SRyder Lee #define MT_TXD1_PKT_FMT			GENMASK(25, 24)
17204b8e659SRyder Lee #define MT_TXD1_TID			GENMASK(23, 21)
17304b8e659SRyder Lee #define MT_TXD1_AMSDU			BIT(20)
17404b8e659SRyder Lee #define MT_TXD1_UNXV			BIT(19)
17504b8e659SRyder Lee #define MT_TXD1_HDR_PAD			GENMASK(18, 17)
17604b8e659SRyder Lee #define MT_TXD1_TXD_LEN			BIT(16)
17704b8e659SRyder Lee #define MT_TXD1_LONG_FORMAT		BIT(15)
17804b8e659SRyder Lee #define MT_TXD1_HDR_FORMAT		GENMASK(14, 13)
17904b8e659SRyder Lee #define MT_TXD1_HDR_INFO		GENMASK(12, 8)
18004b8e659SRyder Lee #define MT_TXD1_WLAN_IDX		GENMASK(7, 0)
18104b8e659SRyder Lee 
18204b8e659SRyder Lee #define MT_TXD2_FIX_RATE		BIT(31)
18304b8e659SRyder Lee #define MT_TXD2_TIMING_MEASURE		BIT(30)
18404b8e659SRyder Lee #define MT_TXD2_BA_DISABLE		BIT(29)
18504b8e659SRyder Lee #define MT_TXD2_POWER_OFFSET		GENMASK(28, 24)
18604b8e659SRyder Lee #define MT_TXD2_MAX_TX_TIME		GENMASK(23, 16)
18704b8e659SRyder Lee #define MT_TXD2_FRAG			GENMASK(15, 14)
18804b8e659SRyder Lee #define MT_TXD2_HTC_VLD			BIT(13)
18904b8e659SRyder Lee #define MT_TXD2_DURATION		BIT(12)
19004b8e659SRyder Lee #define MT_TXD2_BIP			BIT(11)
19104b8e659SRyder Lee #define MT_TXD2_MULTICAST		BIT(10)
19204b8e659SRyder Lee #define MT_TXD2_RTS			BIT(9)
19304b8e659SRyder Lee #define MT_TXD2_SOUNDING		BIT(8)
19404b8e659SRyder Lee #define MT_TXD2_NDPA			BIT(7)
19504b8e659SRyder Lee #define MT_TXD2_NDP			BIT(6)
19604b8e659SRyder Lee #define MT_TXD2_FRAME_TYPE		GENMASK(5, 4)
19704b8e659SRyder Lee #define MT_TXD2_SUB_TYPE		GENMASK(3, 0)
19804b8e659SRyder Lee 
19904b8e659SRyder Lee #define MT_TXD3_SN_VALID		BIT(31)
20004b8e659SRyder Lee #define MT_TXD3_PN_VALID		BIT(30)
20104b8e659SRyder Lee #define MT_TXD3_SEQ			GENMASK(27, 16)
20204b8e659SRyder Lee #define MT_TXD3_REM_TX_COUNT		GENMASK(15, 11)
20304b8e659SRyder Lee #define MT_TXD3_TX_COUNT		GENMASK(10, 6)
20404b8e659SRyder Lee #define MT_TXD3_PROTECT_FRAME		BIT(1)
20504b8e659SRyder Lee #define MT_TXD3_NO_ACK			BIT(0)
20604b8e659SRyder Lee 
20704b8e659SRyder Lee #define MT_TXD4_PN_LOW			GENMASK(31, 0)
20804b8e659SRyder Lee 
20904b8e659SRyder Lee #define MT_TXD5_PN_HIGH			GENMASK(31, 16)
21004b8e659SRyder Lee #define MT_TXD5_SW_POWER_MGMT		BIT(13)
21104b8e659SRyder Lee #define MT_TXD5_DA_SELECT		BIT(11)
21204b8e659SRyder Lee #define MT_TXD5_TX_STATUS_HOST		BIT(10)
21304b8e659SRyder Lee #define MT_TXD5_TX_STATUS_MCU		BIT(9)
21404b8e659SRyder Lee #define MT_TXD5_TX_STATUS_FMT		BIT(8)
21504b8e659SRyder Lee #define MT_TXD5_PID			GENMASK(7, 0)
21604b8e659SRyder Lee 
21704b8e659SRyder Lee #define MT_TXD6_FIXED_RATE		BIT(31)
21804b8e659SRyder Lee #define MT_TXD6_SGI			BIT(30)
21904b8e659SRyder Lee #define MT_TXD6_LDPC			BIT(29)
22004b8e659SRyder Lee #define MT_TXD6_TX_BF			BIT(28)
22104b8e659SRyder Lee #define MT_TXD6_TX_RATE			GENMASK(27, 16)
22204b8e659SRyder Lee #define MT_TXD6_ANT_ID			GENMASK(15, 4)
22304b8e659SRyder Lee #define MT_TXD6_DYN_BW			BIT(3)
22404b8e659SRyder Lee #define MT_TXD6_FIXED_BW		BIT(2)
22504b8e659SRyder Lee #define MT_TXD6_BW			GENMASK(1, 0)
22604b8e659SRyder Lee 
22704b8e659SRyder Lee #define MT_TXD7_TYPE			GENMASK(21, 20)
22804b8e659SRyder Lee #define MT_TXD7_SUB_TYPE		GENMASK(19, 16)
22904b8e659SRyder Lee 
23004b8e659SRyder Lee #define MT_TX_RATE_STBC			BIT(11)
23104b8e659SRyder Lee #define MT_TX_RATE_NSS			GENMASK(10, 9)
23204b8e659SRyder Lee #define MT_TX_RATE_MODE			GENMASK(8, 6)
23304b8e659SRyder Lee #define MT_TX_RATE_IDX			GENMASK(5, 0)
23404b8e659SRyder Lee 
23504b8e659SRyder Lee #define MT_TXP_MAX_BUF_NUM		6
23604b8e659SRyder Lee 
23704b8e659SRyder Lee struct mt7615_txp {
23804b8e659SRyder Lee 	__le16 flags;
23904b8e659SRyder Lee 	__le16 token;
24004b8e659SRyder Lee 	u8 bss_idx;
24104b8e659SRyder Lee 	u8 rept_wds_wcid;
24204b8e659SRyder Lee 	u8 rsv;
24304b8e659SRyder Lee 	u8 nbuf;
24404b8e659SRyder Lee 	__le32 buf[MT_TXP_MAX_BUF_NUM];
24504b8e659SRyder Lee 	__le16 len[MT_TXP_MAX_BUF_NUM];
24604b8e659SRyder Lee } __packed;
24704b8e659SRyder Lee 
24804b8e659SRyder Lee struct mt7615_tx_free {
24904b8e659SRyder Lee 	__le16 rx_byte_cnt;
25004b8e659SRyder Lee 	__le16 ctrl;
25104b8e659SRyder Lee 	u8 txd_cnt;
25204b8e659SRyder Lee 	u8 rsv[3];
25304b8e659SRyder Lee 	__le16 token[];
25404b8e659SRyder Lee } __packed;
25504b8e659SRyder Lee 
25604b8e659SRyder Lee #define MT_TX_FREE_MSDU_ID_CNT		GENMASK(6, 0)
25704b8e659SRyder Lee 
25804b8e659SRyder Lee #define MT_TXS0_PID			GENMASK(31, 24)
25904b8e659SRyder Lee #define MT_TXS0_BA_ERROR		BIT(22)
26004b8e659SRyder Lee #define MT_TXS0_PS_FLAG			BIT(21)
26104b8e659SRyder Lee #define MT_TXS0_TXOP_TIMEOUT		BIT(20)
26204b8e659SRyder Lee #define MT_TXS0_BIP_ERROR		BIT(19)
26304b8e659SRyder Lee 
26404b8e659SRyder Lee #define MT_TXS0_QUEUE_TIMEOUT		BIT(18)
26504b8e659SRyder Lee #define MT_TXS0_RTS_TIMEOUT		BIT(17)
26604b8e659SRyder Lee #define MT_TXS0_ACK_TIMEOUT		BIT(16)
26704b8e659SRyder Lee #define MT_TXS0_ACK_ERROR_MASK		GENMASK(18, 16)
26804b8e659SRyder Lee 
26904b8e659SRyder Lee #define MT_TXS0_TX_STATUS_HOST		BIT(15)
27004b8e659SRyder Lee #define MT_TXS0_TX_STATUS_MCU		BIT(14)
27104b8e659SRyder Lee #define MT_TXS0_TXS_FORMAT		BIT(13)
27204b8e659SRyder Lee #define MT_TXS0_FIXED_RATE		BIT(12)
27304b8e659SRyder Lee #define MT_TXS0_TX_RATE			GENMASK(11, 0)
27404b8e659SRyder Lee 
27504b8e659SRyder Lee #define MT_TXS1_ANT_ID			GENMASK(31, 20)
27604b8e659SRyder Lee #define MT_TXS1_RESP_RATE		GENMASK(19, 16)
27704b8e659SRyder Lee #define MT_TXS1_BW			GENMASK(15, 14)
27804b8e659SRyder Lee #define MT_TXS1_I_TXBF			BIT(13)
27904b8e659SRyder Lee #define MT_TXS1_E_TXBF			BIT(12)
28004b8e659SRyder Lee #define MT_TXS1_TID			GENMASK(11, 9)
28104b8e659SRyder Lee #define MT_TXS1_AMPDU			BIT(8)
28204b8e659SRyder Lee #define MT_TXS1_ACKED_MPDU		BIT(7)
28304b8e659SRyder Lee #define MT_TXS1_TX_POWER_DBM		GENMASK(6, 0)
28404b8e659SRyder Lee 
28504b8e659SRyder Lee #define MT_TXS2_WCID			GENMASK(31, 24)
28604b8e659SRyder Lee #define MT_TXS2_RXV_SEQNO		GENMASK(23, 16)
28704b8e659SRyder Lee #define MT_TXS2_TX_DELAY		GENMASK(15, 0)
28804b8e659SRyder Lee 
28904b8e659SRyder Lee #define MT_TXS3_LAST_TX_RATE		GENMASK(31, 29)
29004b8e659SRyder Lee #define MT_TXS3_TX_COUNT		GENMASK(28, 24)
29104b8e659SRyder Lee #define MT_TXS3_F1_TSSI1		GENMASK(23, 12)
29204b8e659SRyder Lee #define MT_TXS3_F1_TSSI0		GENMASK(11, 0)
29304b8e659SRyder Lee #define MT_TXS3_F0_SEQNO		GENMASK(11, 0)
29404b8e659SRyder Lee 
29504b8e659SRyder Lee #define MT_TXS4_F0_TIMESTAMP		GENMASK(31, 0)
29604b8e659SRyder Lee #define MT_TXS4_F1_TSSI3		GENMASK(23, 12)
29704b8e659SRyder Lee #define MT_TXS4_F1_TSSI2		GENMASK(11, 0)
29804b8e659SRyder Lee 
29904b8e659SRyder Lee #define MT_TXS5_F0_FRONT_TIME		GENMASK(24, 0)
30004b8e659SRyder Lee #define MT_TXS5_F1_NOISE_2		GENMASK(23, 16)
30104b8e659SRyder Lee #define MT_TXS5_F1_NOISE_1		GENMASK(15, 8)
30204b8e659SRyder Lee #define MT_TXS5_F1_NOISE_0		GENMASK(7, 0)
30304b8e659SRyder Lee 
30404b8e659SRyder Lee #define MT_TXS6_F1_RCPI_3		GENMASK(31, 24)
30504b8e659SRyder Lee #define MT_TXS6_F1_RCPI_2		GENMASK(23, 16)
30604b8e659SRyder Lee #define MT_TXS6_F1_RCPI_1		GENMASK(15, 8)
30704b8e659SRyder Lee #define MT_TXS6_F1_RCPI_0		GENMASK(7, 0)
30804b8e659SRyder Lee 
3092ce73efeSLorenzo Bianconi struct mt7615_dfs_pulse {
3102ce73efeSLorenzo Bianconi 	u32 max_width;		/* us */
3112ce73efeSLorenzo Bianconi 	int max_pwr;		/* dbm */
3122ce73efeSLorenzo Bianconi 	int min_pwr;		/* dbm */
3132ce73efeSLorenzo Bianconi 	u32 min_stgr_pri;	/* us */
3142ce73efeSLorenzo Bianconi 	u32 max_stgr_pri;	/* us */
3152ce73efeSLorenzo Bianconi 	u32 min_cr_pri;		/* us */
3162ce73efeSLorenzo Bianconi 	u32 max_cr_pri;		/* us */
3172ce73efeSLorenzo Bianconi };
3182ce73efeSLorenzo Bianconi 
3192ce73efeSLorenzo Bianconi struct mt7615_dfs_pattern {
3202ce73efeSLorenzo Bianconi 	u8 enb;
3212ce73efeSLorenzo Bianconi 	u8 stgr;
3222ce73efeSLorenzo Bianconi 	u8 min_crpn;
3232ce73efeSLorenzo Bianconi 	u8 max_crpn;
3242ce73efeSLorenzo Bianconi 	u8 min_crpr;
3252ce73efeSLorenzo Bianconi 	u8 min_pw;
3262ce73efeSLorenzo Bianconi 	u8 max_pw;
3272ce73efeSLorenzo Bianconi 	u32 min_pri;
3282ce73efeSLorenzo Bianconi 	u32 max_pri;
3292ce73efeSLorenzo Bianconi 	u8 min_crbn;
3302ce73efeSLorenzo Bianconi 	u8 max_crbn;
3312ce73efeSLorenzo Bianconi 	u8 min_stgpn;
3322ce73efeSLorenzo Bianconi 	u8 max_stgpn;
3332ce73efeSLorenzo Bianconi 	u8 min_stgpr;
3342ce73efeSLorenzo Bianconi };
3352ce73efeSLorenzo Bianconi 
3362ce73efeSLorenzo Bianconi struct mt7615_dfs_radar_spec {
3372ce73efeSLorenzo Bianconi 	struct mt7615_dfs_pulse pulse_th;
3382ce73efeSLorenzo Bianconi 	struct mt7615_dfs_pattern radar_pattern[16];
3392ce73efeSLorenzo Bianconi };
3402ce73efeSLorenzo Bianconi 
34192671eb9SLorenzo Bianconi enum mt7615_cipher_type {
34292671eb9SLorenzo Bianconi 	MT_CIPHER_NONE,
34392671eb9SLorenzo Bianconi 	MT_CIPHER_WEP40,
34492671eb9SLorenzo Bianconi 	MT_CIPHER_TKIP,
34592671eb9SLorenzo Bianconi 	MT_CIPHER_TKIP_NO_MIC,
34692671eb9SLorenzo Bianconi 	MT_CIPHER_AES_CCMP,
34792671eb9SLorenzo Bianconi 	MT_CIPHER_WEP104,
34892671eb9SLorenzo Bianconi 	MT_CIPHER_BIP_CMAC_128,
34992671eb9SLorenzo Bianconi 	MT_CIPHER_WEP128,
35092671eb9SLorenzo Bianconi 	MT_CIPHER_WAPI,
35192671eb9SLorenzo Bianconi 	MT_CIPHER_CCMP_256 = 10,
35292671eb9SLorenzo Bianconi 	MT_CIPHER_GCMP,
35392671eb9SLorenzo Bianconi 	MT_CIPHER_GCMP_256,
35492671eb9SLorenzo Bianconi };
35592671eb9SLorenzo Bianconi 
356373a9a13SLorenzo Bianconi static inline struct mt7615_txp *
357373a9a13SLorenzo Bianconi mt7615_txwi_to_txp(struct mt76_dev *dev, struct mt76_txwi_cache *t)
358373a9a13SLorenzo Bianconi {
359373a9a13SLorenzo Bianconi 	u8 *txwi;
360373a9a13SLorenzo Bianconi 
361373a9a13SLorenzo Bianconi 	if (!t)
362373a9a13SLorenzo Bianconi 		return NULL;
363373a9a13SLorenzo Bianconi 
364373a9a13SLorenzo Bianconi 	txwi = mt76_get_txwi_ptr(dev, t);
365373a9a13SLorenzo Bianconi 
366373a9a13SLorenzo Bianconi 	return (struct mt7615_txp *)(txwi + MT_TXD_SIZE);
367373a9a13SLorenzo Bianconi }
368373a9a13SLorenzo Bianconi 
36904b8e659SRyder Lee #endif
370