18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ISC */ 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci#ifndef __MT7603_MAC_H 48c2ecf20Sopenharmony_ci#define __MT7603_MAC_H 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#define MT_RXD0_LENGTH GENMASK(15, 0) 78c2ecf20Sopenharmony_ci#define MT_RXD0_PKT_TYPE GENMASK(31, 29) 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define MT_RXD0_NORMAL_ETH_TYPE_OFS GENMASK(22, 16) 108c2ecf20Sopenharmony_ci#define MT_RXD0_NORMAL_IP_SUM BIT(23) 118c2ecf20Sopenharmony_ci#define MT_RXD0_NORMAL_UDP_TCP_SUM BIT(24) 128c2ecf20Sopenharmony_ci#define MT_RXD0_NORMAL_GROUP_1 BIT(25) 138c2ecf20Sopenharmony_ci#define MT_RXD0_NORMAL_GROUP_2 BIT(26) 148c2ecf20Sopenharmony_ci#define MT_RXD0_NORMAL_GROUP_3 BIT(27) 158c2ecf20Sopenharmony_ci#define MT_RXD0_NORMAL_GROUP_4 BIT(28) 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_cienum rx_pkt_type { 188c2ecf20Sopenharmony_ci PKT_TYPE_TXS = 0, 198c2ecf20Sopenharmony_ci PKT_TYPE_TXRXV = 1, 208c2ecf20Sopenharmony_ci PKT_TYPE_NORMAL = 2, 218c2ecf20Sopenharmony_ci PKT_TYPE_RX_DUP_RFB = 3, 228c2ecf20Sopenharmony_ci PKT_TYPE_RX_TMR = 4, 238c2ecf20Sopenharmony_ci PKT_TYPE_RETRIEVE = 5, 248c2ecf20Sopenharmony_ci PKT_TYPE_RX_EVENT = 7, 258c2ecf20Sopenharmony_ci}; 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_BSSID GENMASK(31, 26) 288c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_PAYLOAD_FORMAT GENMASK(25, 24) 298c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_HDR_TRANS BIT(23) 308c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_HDR_OFFSET BIT(22) 318c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_MAC_HDR_LEN GENMASK(21, 16) 328c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_CH_FREQ GENMASK(15, 8) 338c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_KEY_ID GENMASK(7, 6) 348c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_BEACON_UC BIT(5) 358c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_BEACON_MC BIT(4) 368c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_BCAST BIT(3) 378c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_MCAST BIT(2) 388c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_U2M BIT(1) 398c2ecf20Sopenharmony_ci#define MT_RXD1_NORMAL_HTC_VLD BIT(0) 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_NON_AMPDU BIT(31) 428c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_NON_AMPDU_SUB BIT(30) 438c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_NDATA BIT(29) 448c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_NULL_FRAME BIT(28) 458c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_FRAG BIT(27) 468c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_UDF_VALID BIT(26) 478c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_LLC_MIS BIT(25) 488c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_MAX_LEN_ERROR BIT(24) 498c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_AMSDU_ERR BIT(23) 508c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_LEN_MISMATCH BIT(22) 518c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_TKIP_MIC_ERR BIT(21) 528c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_ICV_ERR BIT(20) 538c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_CLM BIT(19) 548c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_CM BIT(18) 558c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_FCS_ERR BIT(17) 568c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_SW_BIT BIT(16) 578c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_SEC_MODE GENMASK(15, 12) 588c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_TID GENMASK(11, 8) 598c2ecf20Sopenharmony_ci#define MT_RXD2_NORMAL_WLAN_IDX GENMASK(7, 0) 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#define MT_RXD3_NORMAL_PF_STS GENMASK(31, 30) 628c2ecf20Sopenharmony_ci#define MT_RXD3_NORMAL_PF_MODE BIT(29) 638c2ecf20Sopenharmony_ci#define MT_RXD3_NORMAL_CLS_BITMAP GENMASK(28, 19) 648c2ecf20Sopenharmony_ci#define MT_RXD3_NORMAL_WOL GENMASK(18, 14) 658c2ecf20Sopenharmony_ci#define MT_RXD3_NORMAL_MAGIC_PKT BIT(13) 668c2ecf20Sopenharmony_ci#define MT_RXD3_NORMAL_OFLD GENMASK(12, 11) 678c2ecf20Sopenharmony_ci#define MT_RXD3_NORMAL_CLS BIT(10) 688c2ecf20Sopenharmony_ci#define MT_RXD3_NORMAL_PATTERN_DROP BIT(9) 698c2ecf20Sopenharmony_ci#define MT_RXD3_NORMAL_TSF_COMPARE_LOSS BIT(8) 708c2ecf20Sopenharmony_ci#define MT_RXD3_NORMAL_RXV_SEQ GENMASK(7, 0) 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#define MT_RXV1_VHTA1_B5_B4 GENMASK(31, 30) 738c2ecf20Sopenharmony_ci#define MT_RXV1_VHTA2_B8_B1 GENMASK(29, 22) 748c2ecf20Sopenharmony_ci#define MT_RXV1_HT_NO_SOUND BIT(21) 758c2ecf20Sopenharmony_ci#define MT_RXV1_HT_SMOOTH BIT(20) 768c2ecf20Sopenharmony_ci#define MT_RXV1_HT_SHORT_GI BIT(19) 778c2ecf20Sopenharmony_ci#define MT_RXV1_HT_AGGR BIT(18) 788c2ecf20Sopenharmony_ci#define MT_RXV1_VHTA1_B22 BIT(17) 798c2ecf20Sopenharmony_ci#define MT_RXV1_FRAME_MODE GENMASK(16, 15) 808c2ecf20Sopenharmony_ci#define MT_RXV1_TX_MODE GENMASK(14, 12) 818c2ecf20Sopenharmony_ci#define MT_RXV1_HT_EXT_LTF GENMASK(11, 10) 828c2ecf20Sopenharmony_ci#define MT_RXV1_HT_AD_CODE BIT(9) 838c2ecf20Sopenharmony_ci#define MT_RXV1_HT_STBC GENMASK(8, 7) 848c2ecf20Sopenharmony_ci#define MT_RXV1_TX_RATE GENMASK(6, 0) 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define MT_RXV2_VHTA1_B16_B6 GENMASK(31, 21) 878c2ecf20Sopenharmony_ci#define MT_RXV2_LENGTH GENMASK(20, 0) 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci#define MT_RXV3_F_AGC1_CAL_GAIN GENMASK(31, 29) 908c2ecf20Sopenharmony_ci#define MT_RXV3_F_AGC1_EQ_CAL BIT(28) 918c2ecf20Sopenharmony_ci#define MT_RXV3_RCPI1 GENMASK(27, 20) 928c2ecf20Sopenharmony_ci#define MT_RXV3_F_AGC0_CAL_GAIN GENMASK(19, 17) 938c2ecf20Sopenharmony_ci#define MT_RXV3_F_AGC0_EQ_CAL BIT(16) 948c2ecf20Sopenharmony_ci#define MT_RXV3_RCPI0 GENMASK(15, 8) 958c2ecf20Sopenharmony_ci#define MT_RXV3_SEL_ANT BIT(7) 968c2ecf20Sopenharmony_ci#define MT_RXV3_ACI_DET_X BIT(6) 978c2ecf20Sopenharmony_ci#define MT_RXV3_OFDM_FREQ_TRANS_DETECT BIT(5) 988c2ecf20Sopenharmony_ci#define MT_RXV3_VHTA1_B21_B17 GENMASK(4, 0) 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#define MT_RXV4_F_AGC_CAL_GAIN GENMASK(31, 29) 1018c2ecf20Sopenharmony_ci#define MT_RXV4_F_AGC2_EQ_CAL BIT(28) 1028c2ecf20Sopenharmony_ci#define MT_RXV4_IB_RSSI1 GENMASK(27, 20) 1038c2ecf20Sopenharmony_ci#define MT_RXV4_F_AGC_LPF_GAIN_X GENMASK(19, 16) 1048c2ecf20Sopenharmony_ci#define MT_RXV4_WB_RSSI_X GENMASK(15, 8) 1058c2ecf20Sopenharmony_ci#define MT_RXV4_IB_RSSI0 GENMASK(7, 0) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define MT_RXV5_LTF_SNR0 GENMASK(31, 26) 1088c2ecf20Sopenharmony_ci#define MT_RXV5_LTF_PROC_TIME GENMASK(25, 19) 1098c2ecf20Sopenharmony_ci#define MT_RXV5_FOE GENMASK(18, 7) 1108c2ecf20Sopenharmony_ci#define MT_RXV5_C_AGC_SATE GENMASK(6, 4) 1118c2ecf20Sopenharmony_ci#define MT_RXV5_F_AGC_LNA_GAIN_0 GENMASK(3, 2) 1128c2ecf20Sopenharmony_ci#define MT_RXV5_F_AGC_LNA_GAIN_1 GENMASK(1, 0) 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci#define MT_RXV6_C_AGC_STATE GENMASK(30, 28) 1158c2ecf20Sopenharmony_ci#define MT_RXV6_NS_TS_FIELD GENMASK(27, 25) 1168c2ecf20Sopenharmony_ci#define MT_RXV6_RX_VALID BIT(24) 1178c2ecf20Sopenharmony_ci#define MT_RXV6_NF2 GENMASK(23, 16) 1188c2ecf20Sopenharmony_ci#define MT_RXV6_NF1 GENMASK(15, 8) 1198c2ecf20Sopenharmony_ci#define MT_RXV6_NF0 GENMASK(7, 0) 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_cienum mt7603_tx_header_format { 1228c2ecf20Sopenharmony_ci MT_HDR_FORMAT_802_3, 1238c2ecf20Sopenharmony_ci MT_HDR_FORMAT_CMD, 1248c2ecf20Sopenharmony_ci MT_HDR_FORMAT_802_11, 1258c2ecf20Sopenharmony_ci MT_HDR_FORMAT_802_11_EXT, 1268c2ecf20Sopenharmony_ci}; 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci#define MT_TXD_SIZE (8 * 4) 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci#define MT_TXD0_P_IDX BIT(31) 1318c2ecf20Sopenharmony_ci#define MT_TXD0_Q_IDX GENMASK(30, 27) 1328c2ecf20Sopenharmony_ci#define MT_TXD0_UTXB BIT(26) 1338c2ecf20Sopenharmony_ci#define MT_TXD0_UNXV BIT(25) 1348c2ecf20Sopenharmony_ci#define MT_TXD0_UDP_TCP_SUM BIT(24) 1358c2ecf20Sopenharmony_ci#define MT_TXD0_IP_SUM BIT(23) 1368c2ecf20Sopenharmony_ci#define MT_TXD0_ETH_TYPE_OFFSET GENMASK(22, 16) 1378c2ecf20Sopenharmony_ci#define MT_TXD0_TX_BYTES GENMASK(15, 0) 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci#define MT_TXD1_OWN_MAC GENMASK(31, 26) 1408c2ecf20Sopenharmony_ci#define MT_TXD1_PROTECTED BIT(23) 1418c2ecf20Sopenharmony_ci#define MT_TXD1_TID GENMASK(22, 20) 1428c2ecf20Sopenharmony_ci#define MT_TXD1_NO_ACK BIT(19) 1438c2ecf20Sopenharmony_ci#define MT_TXD1_HDR_PAD GENMASK(18, 16) 1448c2ecf20Sopenharmony_ci#define MT_TXD1_LONG_FORMAT BIT(15) 1458c2ecf20Sopenharmony_ci#define MT_TXD1_HDR_FORMAT GENMASK(14, 13) 1468c2ecf20Sopenharmony_ci#define MT_TXD1_HDR_INFO GENMASK(12, 8) 1478c2ecf20Sopenharmony_ci#define MT_TXD1_WLAN_IDX GENMASK(7, 0) 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci#define MT_TXD2_FIX_RATE BIT(31) 1508c2ecf20Sopenharmony_ci#define MT_TXD2_TIMING_MEASURE BIT(30) 1518c2ecf20Sopenharmony_ci#define MT_TXD2_BA_DISABLE BIT(29) 1528c2ecf20Sopenharmony_ci#define MT_TXD2_POWER_OFFSET GENMASK(28, 24) 1538c2ecf20Sopenharmony_ci#define MT_TXD2_MAX_TX_TIME GENMASK(23, 16) 1548c2ecf20Sopenharmony_ci#define MT_TXD2_FRAG GENMASK(15, 14) 1558c2ecf20Sopenharmony_ci#define MT_TXD2_HTC_VLD BIT(13) 1568c2ecf20Sopenharmony_ci#define MT_TXD2_DURATION BIT(12) 1578c2ecf20Sopenharmony_ci#define MT_TXD2_BIP BIT(11) 1588c2ecf20Sopenharmony_ci#define MT_TXD2_MULTICAST BIT(10) 1598c2ecf20Sopenharmony_ci#define MT_TXD2_RTS BIT(9) 1608c2ecf20Sopenharmony_ci#define MT_TXD2_SOUNDING BIT(8) 1618c2ecf20Sopenharmony_ci#define MT_TXD2_NDPA BIT(7) 1628c2ecf20Sopenharmony_ci#define MT_TXD2_NDP BIT(6) 1638c2ecf20Sopenharmony_ci#define MT_TXD2_FRAME_TYPE GENMASK(5, 4) 1648c2ecf20Sopenharmony_ci#define MT_TXD2_SUB_TYPE GENMASK(3, 0) 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci#define MT_TXD3_SN_VALID BIT(31) 1678c2ecf20Sopenharmony_ci#define MT_TXD3_PN_VALID BIT(30) 1688c2ecf20Sopenharmony_ci#define MT_TXD3_SEQ GENMASK(27, 16) 1698c2ecf20Sopenharmony_ci#define MT_TXD3_REM_TX_COUNT GENMASK(15, 11) 1708c2ecf20Sopenharmony_ci#define MT_TXD3_TX_COUNT GENMASK(10, 6) 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci#define MT_TXD4_PN_LOW GENMASK(31, 0) 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci#define MT_TXD5_PN_HIGH GENMASK(31, 16) 1758c2ecf20Sopenharmony_ci#define MT_TXD5_SW_POWER_MGMT BIT(13) 1768c2ecf20Sopenharmony_ci#define MT_TXD5_BA_SEQ_CTRL BIT(12) 1778c2ecf20Sopenharmony_ci#define MT_TXD5_DA_SELECT BIT(11) 1788c2ecf20Sopenharmony_ci#define MT_TXD5_TX_STATUS_HOST BIT(10) 1798c2ecf20Sopenharmony_ci#define MT_TXD5_TX_STATUS_MCU BIT(9) 1808c2ecf20Sopenharmony_ci#define MT_TXD5_TX_STATUS_FMT BIT(8) 1818c2ecf20Sopenharmony_ci#define MT_TXD5_PID GENMASK(7, 0) 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci#define MT_TXD6_SGI BIT(31) 1848c2ecf20Sopenharmony_ci#define MT_TXD6_LDPC BIT(30) 1858c2ecf20Sopenharmony_ci#define MT_TXD6_TX_RATE GENMASK(29, 18) 1868c2ecf20Sopenharmony_ci#define MT_TXD6_I_TXBF BIT(17) 1878c2ecf20Sopenharmony_ci#define MT_TXD6_E_TXBF BIT(16) 1888c2ecf20Sopenharmony_ci#define MT_TXD6_DYN_BW BIT(15) 1898c2ecf20Sopenharmony_ci#define MT_TXD6_ANT_PRI GENMASK(14, 12) 1908c2ecf20Sopenharmony_ci#define MT_TXD6_SPE_EN BIT(11) 1918c2ecf20Sopenharmony_ci#define MT_TXD6_FIXED_BW BIT(10) 1928c2ecf20Sopenharmony_ci#define MT_TXD6_BW GENMASK(9, 8) 1938c2ecf20Sopenharmony_ci#define MT_TXD6_ANT_ID GENMASK(7, 2) 1948c2ecf20Sopenharmony_ci#define MT_TXD6_FIXED_RATE BIT(0) 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci#define MT_TX_RATE_STBC BIT(11) 1978c2ecf20Sopenharmony_ci#define MT_TX_RATE_NSS GENMASK(10, 9) 1988c2ecf20Sopenharmony_ci#define MT_TX_RATE_MODE GENMASK(8, 6) 1998c2ecf20Sopenharmony_ci#define MT_TX_RATE_IDX GENMASK(5, 0) 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci#define MT_TXS0_ANTENNA GENMASK(31, 26) 2028c2ecf20Sopenharmony_ci#define MT_TXS0_TID GENMASK(25, 22) 2038c2ecf20Sopenharmony_ci#define MT_TXS0_BA_ERROR BIT(22) 2048c2ecf20Sopenharmony_ci#define MT_TXS0_PS_FLAG BIT(21) 2058c2ecf20Sopenharmony_ci#define MT_TXS0_TXOP_TIMEOUT BIT(20) 2068c2ecf20Sopenharmony_ci#define MT_TXS0_BIP_ERROR BIT(19) 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci#define MT_TXS0_QUEUE_TIMEOUT BIT(18) 2098c2ecf20Sopenharmony_ci#define MT_TXS0_RTS_TIMEOUT BIT(17) 2108c2ecf20Sopenharmony_ci#define MT_TXS0_ACK_TIMEOUT BIT(16) 2118c2ecf20Sopenharmony_ci#define MT_TXS0_ACK_ERROR_MASK GENMASK(18, 16) 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci#define MT_TXS0_TX_STATUS_HOST BIT(15) 2148c2ecf20Sopenharmony_ci#define MT_TXS0_TX_STATUS_MCU BIT(14) 2158c2ecf20Sopenharmony_ci#define MT_TXS0_TXS_FORMAT BIT(13) 2168c2ecf20Sopenharmony_ci#define MT_TXS0_FIXED_RATE BIT(12) 2178c2ecf20Sopenharmony_ci#define MT_TXS0_TX_RATE GENMASK(11, 0) 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci#define MT_TXS1_F0_TIMESTAMP GENMASK(31, 0) 2208c2ecf20Sopenharmony_ci#define MT_TXS1_F1_NOISE_2 GENMASK(23, 16) 2218c2ecf20Sopenharmony_ci#define MT_TXS1_F1_NOISE_1 GENMASK(15, 8) 2228c2ecf20Sopenharmony_ci#define MT_TXS1_F1_NOISE_0 GENMASK(7, 0) 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci#define MT_TXS2_F0_FRONT_TIME GENMASK(24, 0) 2258c2ecf20Sopenharmony_ci#define MT_TXS2_F1_RCPI_2 GENMASK(23, 16) 2268c2ecf20Sopenharmony_ci#define MT_TXS2_F1_RCPI_1 GENMASK(15, 8) 2278c2ecf20Sopenharmony_ci#define MT_TXS2_F1_RCPI_0 GENMASK(7, 0) 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci#define MT_TXS3_WCID GENMASK(31, 24) 2308c2ecf20Sopenharmony_ci#define MT_TXS3_RXV_SEQNO GENMASK(23, 16) 2318c2ecf20Sopenharmony_ci#define MT_TXS3_TX_DELAY GENMASK(15, 0) 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci#define MT_TXS4_LAST_TX_RATE GENMASK(31, 29) 2348c2ecf20Sopenharmony_ci#define MT_TXS4_TX_COUNT GENMASK(28, 24) 2358c2ecf20Sopenharmony_ci#define MT_TXS4_AMPDU BIT(23) 2368c2ecf20Sopenharmony_ci#define MT_TXS4_ACKED_MPDU BIT(22) 2378c2ecf20Sopenharmony_ci#define MT_TXS4_PID GENMASK(21, 14) 2388c2ecf20Sopenharmony_ci#define MT_TXS4_BW GENMASK(13, 12) 2398c2ecf20Sopenharmony_ci#define MT_TXS4_F0_SEQNO GENMASK(11, 0) 2408c2ecf20Sopenharmony_ci#define MT_TXS4_F1_TSSI GENMASK(11, 0) 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci#endif 243