18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ISC */
28c2ecf20Sopenharmony_ci/* Copyright (C) 2020 MediaTek Inc. */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef __MT7915_REGS_H
58c2ecf20Sopenharmony_ci#define __MT7915_REGS_H
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/* MCU WFDMA1 */
88c2ecf20Sopenharmony_ci#define MT_MCU_WFDMA1_BASE		0x3000
98c2ecf20Sopenharmony_ci#define MT_MCU_WFDMA1(ofs)		(MT_MCU_WFDMA1_BASE + (ofs))
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define MT_MCU_INT_EVENT		MT_MCU_WFDMA1(0x108)
128c2ecf20Sopenharmony_ci#define MT_MCU_INT_EVENT_DMA_STOPPED	BIT(0)
138c2ecf20Sopenharmony_ci#define MT_MCU_INT_EVENT_DMA_INIT	BIT(1)
148c2ecf20Sopenharmony_ci#define MT_MCU_INT_EVENT_SER_TRIGGER	BIT(2)
158c2ecf20Sopenharmony_ci#define MT_MCU_INT_EVENT_RESET_DONE	BIT(3)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define MT_PLE_BASE			0x8000
188c2ecf20Sopenharmony_ci#define MT_PLE(ofs)			(MT_PLE_BASE + (ofs))
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define MT_PLE_FL_Q0_CTRL		MT_PLE(0x1b0)
218c2ecf20Sopenharmony_ci#define MT_PLE_FL_Q1_CTRL		MT_PLE(0x1b4)
228c2ecf20Sopenharmony_ci#define MT_PLE_FL_Q2_CTRL		MT_PLE(0x1b8)
238c2ecf20Sopenharmony_ci#define MT_PLE_FL_Q3_CTRL		MT_PLE(0x1bc)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define MT_PLE_AC_QEMPTY(ac, n)		MT_PLE(0x300 + 0x10 * (ac) + \
268c2ecf20Sopenharmony_ci					       ((n) << 2))
278c2ecf20Sopenharmony_ci#define MT_PLE_AMSDU_PACK_MSDU_CNT(n)	MT_PLE(0x10e0 + ((n) << 2))
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define MT_MDP_BASE			0xf000
308c2ecf20Sopenharmony_ci#define MT_MDP(ofs)			(MT_MDP_BASE + (ofs))
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define MT_MDP_DCR0			MT_MDP(0x000)
338c2ecf20Sopenharmony_ci#define MT_MDP_DCR0_DAMSDU_EN		BIT(15)
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define MT_MDP_DCR1			MT_MDP(0x004)
368c2ecf20Sopenharmony_ci#define MT_MDP_DCR1_MAX_RX_LEN		GENMASK(15, 3)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define MT_MDP_BNRCFR0(_band)		MT_MDP(0x070 + ((_band) << 8))
398c2ecf20Sopenharmony_ci#define MT_MDP_RCFR0_MCU_RX_MGMT	GENMASK(5, 4)
408c2ecf20Sopenharmony_ci#define MT_MDP_RCFR0_MCU_RX_CTL_NON_BAR	GENMASK(7, 6)
418c2ecf20Sopenharmony_ci#define MT_MDP_RCFR0_MCU_RX_CTL_BAR	GENMASK(9, 8)
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define MT_MDP_BNRCFR1(_band)		MT_MDP(0x074 + ((_band) << 8))
448c2ecf20Sopenharmony_ci#define MT_MDP_RCFR1_MCU_RX_BYPASS	GENMASK(23, 22)
458c2ecf20Sopenharmony_ci#define MT_MDP_RCFR1_RX_DROPPED_UCAST	GENMASK(28, 27)
468c2ecf20Sopenharmony_ci#define MT_MDP_RCFR1_RX_DROPPED_MCAST	GENMASK(30, 29)
478c2ecf20Sopenharmony_ci#define MT_MDP_TO_HIF			0
488c2ecf20Sopenharmony_ci#define MT_MDP_TO_WM			1
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/* TMAC: band 0(0x21000), band 1(0xa1000) */
518c2ecf20Sopenharmony_ci#define MT_WF_TMAC_BASE(_band)		((_band) ? 0xa1000 : 0x21000)
528c2ecf20Sopenharmony_ci#define MT_WF_TMAC(_band, ofs)		(MT_WF_TMAC_BASE(_band) + (ofs))
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define MT_TMAC_CDTR(_band)		MT_WF_TMAC(_band, 0x090)
558c2ecf20Sopenharmony_ci#define MT_TMAC_ODTR(_band)		MT_WF_TMAC(_band, 0x094)
568c2ecf20Sopenharmony_ci#define MT_TIMEOUT_VAL_PLCP		GENMASK(15, 0)
578c2ecf20Sopenharmony_ci#define MT_TIMEOUT_VAL_CCA		GENMASK(31, 16)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define MT_TMAC_ICR0(_band)		MT_WF_TMAC(_band, 0x0a4)
608c2ecf20Sopenharmony_ci#define MT_IFS_EIFS			GENMASK(8, 0)
618c2ecf20Sopenharmony_ci#define MT_IFS_RIFS			GENMASK(14, 10)
628c2ecf20Sopenharmony_ci#define MT_IFS_SIFS			GENMASK(22, 16)
638c2ecf20Sopenharmony_ci#define MT_IFS_SLOT			GENMASK(30, 24)
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define MT_TMAC_CTCR0(_band)			MT_WF_TMAC(_band, 0x0f4)
668c2ecf20Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_REFTIME		GENMASK(5, 0)
678c2ecf20Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_EN		BIT(17)
688c2ecf20Sopenharmony_ci#define MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN	BIT(18)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* DMA Band 0 */
718c2ecf20Sopenharmony_ci#define MT_WF_DMA_BASE			0x21e00
728c2ecf20Sopenharmony_ci#define MT_WF_DMA(ofs)			(MT_WF_DMA_BASE + (ofs))
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#define MT_DMA_DCR0			MT_WF_DMA(0x000)
758c2ecf20Sopenharmony_ci#define MT_DMA_DCR0_MAX_RX_LEN		GENMASK(15, 3)
768c2ecf20Sopenharmony_ci#define MT_DMA_DCR0_RXD_G5_EN		BIT(23)
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci/* ETBF: band 0(0x24000), band 1(0xa4000) */
798c2ecf20Sopenharmony_ci#define MT_WF_ETBF_BASE(_band)		((_band) ? 0xa4000 : 0x24000)
808c2ecf20Sopenharmony_ci#define MT_WF_ETBF(_band, ofs)		(MT_WF_ETBF_BASE(_band) + (ofs))
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define MT_ETBF_TX_NDP_BFRP(_band)	MT_WF_ETBF(_band, 0x040)
838c2ecf20Sopenharmony_ci#define MT_ETBF_TX_FB_CPL		GENMASK(31, 16)
848c2ecf20Sopenharmony_ci#define MT_ETBF_TX_FB_TRI		GENMASK(15, 0)
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#define MT_ETBF_TX_APP_CNT(_band)	MT_WF_ETBF(_band, 0x0f0)
878c2ecf20Sopenharmony_ci#define MT_ETBF_TX_IBF_CNT		GENMASK(31, 16)
888c2ecf20Sopenharmony_ci#define MT_ETBF_TX_EBF_CNT		GENMASK(15, 0)
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define MT_ETBF_RX_FB_CNT(_band)	MT_WF_ETBF(_band, 0x0f8)
918c2ecf20Sopenharmony_ci#define MT_ETBF_RX_FB_ALL		GENMASK(31, 24)
928c2ecf20Sopenharmony_ci#define MT_ETBF_RX_FB_HE		GENMASK(23, 16)
938c2ecf20Sopenharmony_ci#define MT_ETBF_RX_FB_VHT		GENMASK(15, 8)
948c2ecf20Sopenharmony_ci#define MT_ETBF_RX_FB_HT		GENMASK(7, 0)
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci/* LPON: band 0(0x24200), band 1(0xa4200) */
978c2ecf20Sopenharmony_ci#define MT_WF_LPON_BASE(_band)		((_band) ? 0xa4200 : 0x24200)
988c2ecf20Sopenharmony_ci#define MT_WF_LPON(_band, ofs)		(MT_WF_LPON_BASE(_band) + (ofs))
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci#define MT_LPON_UTTR0(_band)		MT_WF_LPON(_band, 0x080)
1018c2ecf20Sopenharmony_ci#define MT_LPON_UTTR1(_band)		MT_WF_LPON(_band, 0x084)
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#define MT_LPON_TCR(_band, n)		MT_WF_LPON(_band, 0x0a8 + (n) * 4)
1048c2ecf20Sopenharmony_ci#define MT_LPON_TCR_SW_MODE		GENMASK(1, 0)
1058c2ecf20Sopenharmony_ci#define MT_LPON_TCR_SW_WRITE		BIT(0)
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci/* MIB: band 0(0x24800), band 1(0xa4800) */
1088c2ecf20Sopenharmony_ci#define MT_WF_MIB_BASE(_band)		((_band) ? 0xa4800 : 0x24800)
1098c2ecf20Sopenharmony_ci#define MT_WF_MIB(_band, ofs)		(MT_WF_MIB_BASE(_band) + (ofs))
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#define MT_MIB_SDR3(_band)		MT_WF_MIB(_band, 0x014)
1128c2ecf20Sopenharmony_ci#define MT_MIB_SDR3_FCS_ERR_MASK	GENMASK(15, 0)
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci#define MT_MIB_SDR9(_band)		MT_WF_MIB(_band, 0x02c)
1158c2ecf20Sopenharmony_ci#define MT_MIB_SDR9_BUSY_MASK		GENMASK(23, 0)
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci#define MT_MIB_SDR16(_band)		MT_WF_MIB(_band, 0x048)
1188c2ecf20Sopenharmony_ci#define MT_MIB_SDR16_BUSY_MASK		GENMASK(23, 0)
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#define MT_MIB_SDR34(_band)		MT_WF_MIB(_band, 0x090)
1218c2ecf20Sopenharmony_ci#define MT_MIB_MU_BF_TX_CNT		GENMASK(15, 0)
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci#define MT_MIB_SDR36(_band)		MT_WF_MIB(_band, 0x098)
1248c2ecf20Sopenharmony_ci#define MT_MIB_SDR36_TXTIME_MASK	GENMASK(23, 0)
1258c2ecf20Sopenharmony_ci#define MT_MIB_SDR37(_band)		MT_WF_MIB(_band, 0x09c)
1268c2ecf20Sopenharmony_ci#define MT_MIB_SDR37_RXTIME_MASK	GENMASK(23, 0)
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci#define MT_MIB_DR8(_band)		MT_WF_MIB(_band, 0x0c0)
1298c2ecf20Sopenharmony_ci#define MT_MIB_DR9(_band)		MT_WF_MIB(_band, 0x0c4)
1308c2ecf20Sopenharmony_ci#define MT_MIB_DR11(_band)		MT_WF_MIB(_band, 0x0cc)
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci#define MT_MIB_MB_SDR0(_band, n)	MT_WF_MIB(_band, 0x100 + ((n) << 4))
1338c2ecf20Sopenharmony_ci#define MT_MIB_RTS_RETRIES_COUNT_MASK	GENMASK(31, 16)
1348c2ecf20Sopenharmony_ci#define MT_MIB_RTS_COUNT_MASK		GENMASK(15, 0)
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci#define MT_MIB_MB_SDR1(_band, n)	MT_WF_MIB(_band, 0x104 + ((n) << 4))
1378c2ecf20Sopenharmony_ci#define MT_MIB_BA_MISS_COUNT_MASK	GENMASK(15, 0)
1388c2ecf20Sopenharmony_ci#define MT_MIB_ACK_FAIL_COUNT_MASK	GENMASK(31, 16)
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci#define MT_MIB_MB_SDR2(_band, n)	MT_WF_MIB(_band, 0x108 + ((n) << 4))
1418c2ecf20Sopenharmony_ci#define MT_MIB_FRAME_RETRIES_COUNT_MASK	GENMASK(15, 0)
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci#define MT_TX_AGG_CNT(_band, n)		MT_WF_MIB(_band, 0x0a8 + ((n) << 2))
1448c2ecf20Sopenharmony_ci#define MT_TX_AGG_CNT2(_band, n)	MT_WF_MIB(_band, 0x164 + ((n) << 2))
1458c2ecf20Sopenharmony_ci#define MT_MIB_ARNG(_band, n)		MT_WF_MIB(_band, 0x4b8 + ((n) << 2))
1468c2ecf20Sopenharmony_ci#define MT_MIB_ARNCR_RANGE(val, n)	(((val) >> ((n) << 3)) & GENMASK(7, 0))
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci#define MT_WTBLON_TOP_BASE		0x34000
1498c2ecf20Sopenharmony_ci#define MT_WTBLON_TOP(ofs)		(MT_WTBLON_TOP_BASE + (ofs))
1508c2ecf20Sopenharmony_ci#define MT_WTBLON_TOP_WDUCR		MT_WTBLON_TOP(0x0)
1518c2ecf20Sopenharmony_ci#define MT_WTBLON_TOP_WDUCR_GROUP	GENMASK(2, 0)
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci#define MT_WTBL_UPDATE			MT_WTBLON_TOP(0x030)
1548c2ecf20Sopenharmony_ci#define MT_WTBL_UPDATE_WLAN_IDX		GENMASK(9, 0)
1558c2ecf20Sopenharmony_ci#define MT_WTBL_UPDATE_ADM_COUNT_CLEAR	BIT(12)
1568c2ecf20Sopenharmony_ci#define MT_WTBL_UPDATE_BUSY		BIT(31)
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci#define MT_WTBL_BASE			0x38000
1598c2ecf20Sopenharmony_ci#define MT_WTBL_LMAC_ID			GENMASK(14, 8)
1608c2ecf20Sopenharmony_ci#define MT_WTBL_LMAC_DW			GENMASK(7, 2)
1618c2ecf20Sopenharmony_ci#define MT_WTBL_LMAC_OFFS(_id, _dw)	(MT_WTBL_BASE | \
1628c2ecf20Sopenharmony_ci					FIELD_PREP(MT_WTBL_LMAC_ID, _id) | \
1638c2ecf20Sopenharmony_ci					FIELD_PREP(MT_WTBL_LMAC_DW, _dw))
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/* AGG: band 0(0x20800), band 1(0xa0800) */
1668c2ecf20Sopenharmony_ci#define MT_WF_AGG_BASE(_band)		((_band) ? 0xa0800 : 0x20800)
1678c2ecf20Sopenharmony_ci#define MT_WF_AGG(_band, ofs)		(MT_WF_AGG_BASE(_band) + (ofs))
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci#define MT_AGG_ACR0(_band)		MT_WF_AGG(_band, 0x084)
1708c2ecf20Sopenharmony_ci#define MT_AGG_ACR_CFEND_RATE		GENMASK(13, 0)
1718c2ecf20Sopenharmony_ci#define MT_AGG_ACR_BAR_RATE		GENMASK(29, 16)
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci/* ARB: band 0(0x20c00), band 1(0xa0c00) */
1748c2ecf20Sopenharmony_ci#define MT_WF_ARB_BASE(_band)		((_band) ? 0xa0c00 : 0x20c00)
1758c2ecf20Sopenharmony_ci#define MT_WF_ARB(_band, ofs)		(MT_WF_ARB_BASE(_band) + (ofs))
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci#define MT_ARB_SCR(_band)		MT_WF_ARB(_band, 0x080)
1788c2ecf20Sopenharmony_ci#define MT_ARB_SCR_TX_DISABLE		BIT(8)
1798c2ecf20Sopenharmony_ci#define MT_ARB_SCR_RX_DISABLE		BIT(9)
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/* RMAC: band 0(0x21400), band 1(0xa1400) */
1828c2ecf20Sopenharmony_ci#define MT_WF_RMAC_BASE(_band)		((_band) ? 0xa1400 : 0x21400)
1838c2ecf20Sopenharmony_ci#define MT_WF_RMAC(_band, ofs)		(MT_WF_RMAC_BASE(_band) + (ofs))
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci#define MT_WF_RFCR(_band)		MT_WF_RMAC(_band, 0x000)
1868c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_STBC_MULTI	BIT(0)
1878c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_FCSFAIL		BIT(1)
1888c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_VERSION		BIT(3)
1898c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_PROBEREQ	BIT(4)
1908c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_MCAST		BIT(5)
1918c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_BCAST		BIT(6)
1928c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_MCAST_FILTERED	BIT(7)
1938c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_A3_MAC		BIT(8)
1948c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_A3_BSSID	BIT(9)
1958c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_A2_BSSID	BIT(10)
1968c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_BEACON	BIT(11)
1978c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_FRAME_REPORT	BIT(12)
1988c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_CTL_RSV		BIT(13)
1998c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_CTS		BIT(14)
2008c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_RTS		BIT(15)
2018c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_DUPLICATE	BIT(16)
2028c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_BSS	BIT(17)
2038c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_UC	BIT(18)
2048c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_OTHER_TIM	BIT(19)
2058c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_NDPA		BIT(20)
2068c2ecf20Sopenharmony_ci#define MT_WF_RFCR_DROP_UNWANTED_CTL	BIT(21)
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci#define MT_WF_RFCR1(_band)		MT_WF_RMAC(_band, 0x004)
2098c2ecf20Sopenharmony_ci#define MT_WF_RFCR1_DROP_ACK		BIT(4)
2108c2ecf20Sopenharmony_ci#define MT_WF_RFCR1_DROP_BF_POLL	BIT(5)
2118c2ecf20Sopenharmony_ci#define MT_WF_RFCR1_DROP_BA		BIT(6)
2128c2ecf20Sopenharmony_ci#define MT_WF_RFCR1_DROP_CFEND		BIT(7)
2138c2ecf20Sopenharmony_ci#define MT_WF_RFCR1_DROP_CFACK		BIT(8)
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci#define MT_WF_RMAC_MIB_TIME0(_band)	MT_WF_RMAC(_band, 0x03c4)
2168c2ecf20Sopenharmony_ci#define MT_WF_RMAC_MIB_RXTIME_CLR	BIT(31)
2178c2ecf20Sopenharmony_ci#define MT_WF_RMAC_MIB_RXTIME_EN	BIT(30)
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME14(_band)	MT_WF_RMAC(_band, 0x03b8)
2208c2ecf20Sopenharmony_ci#define MT_MIB_OBSSTIME_MASK		GENMASK(23, 0)
2218c2ecf20Sopenharmony_ci#define MT_WF_RMAC_MIB_AIRTIME0(_band)	MT_WF_RMAC(_band, 0x0380)
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci/* WFDMA0 */
2248c2ecf20Sopenharmony_ci#define MT_WFDMA0_BASE			0xd4000
2258c2ecf20Sopenharmony_ci#define MT_WFDMA0(ofs)			(MT_WFDMA0_BASE + (ofs))
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci#define MT_WFDMA0_RST			MT_WFDMA0(0x100)
2288c2ecf20Sopenharmony_ci#define MT_WFDMA0_RST_LOGIC_RST		BIT(4)
2298c2ecf20Sopenharmony_ci#define MT_WFDMA0_RST_DMASHDL_ALL_RST	BIT(5)
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA		MT_WFDMA0(0x13c)
2328c2ecf20Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA_TX_FIFO0	BIT(0)
2338c2ecf20Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA_TX_FIFO1	BIT(1)
2348c2ecf20Sopenharmony_ci#define MT_WFDMA0_BUSY_ENA_RX_FIFO	BIT(2)
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci#define MT_WFDMA0_GLO_CFG		MT_WFDMA0(0x208)
2378c2ecf20Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_TX_DMA_EN	BIT(0)
2388c2ecf20Sopenharmony_ci#define MT_WFDMA0_GLO_CFG_RX_DMA_EN	BIT(2)
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci#define MT_WFDMA0_RST_DTX_PTR		MT_WFDMA0(0x20c)
2418c2ecf20Sopenharmony_ci#define MT_WFDMA0_PRI_DLY_INT_CFG0	MT_WFDMA0(0x2f0)
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci#define MT_RX_DATA_RING_BASE		MT_WFDMA0(0x500)
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci#define MT_WFDMA0_RX_RING0_EXT_CTRL	MT_WFDMA0(0x680)
2468c2ecf20Sopenharmony_ci#define MT_WFDMA0_RX_RING1_EXT_CTRL	MT_WFDMA0(0x684)
2478c2ecf20Sopenharmony_ci#define MT_WFDMA0_RX_RING2_EXT_CTRL	MT_WFDMA0(0x688)
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci/* WFDMA1 */
2508c2ecf20Sopenharmony_ci#define MT_WFDMA1_BASE			0xd5000
2518c2ecf20Sopenharmony_ci#define MT_WFDMA1(ofs)			(MT_WFDMA1_BASE + (ofs))
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci#define MT_WFDMA1_RST			MT_WFDMA1(0x100)
2548c2ecf20Sopenharmony_ci#define MT_WFDMA1_RST_LOGIC_RST		BIT(4)
2558c2ecf20Sopenharmony_ci#define MT_WFDMA1_RST_DMASHDL_ALL_RST	BIT(5)
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci#define MT_WFDMA1_BUSY_ENA		MT_WFDMA1(0x13c)
2588c2ecf20Sopenharmony_ci#define MT_WFDMA1_BUSY_ENA_TX_FIFO0	BIT(0)
2598c2ecf20Sopenharmony_ci#define MT_WFDMA1_BUSY_ENA_TX_FIFO1	BIT(1)
2608c2ecf20Sopenharmony_ci#define MT_WFDMA1_BUSY_ENA_RX_FIFO	BIT(2)
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci#define MT_MCU_CMD			MT_WFDMA1(0x1f0)
2638c2ecf20Sopenharmony_ci#define MT_MCU_CMD_STOP_DMA_FW_RELOAD	BIT(1)
2648c2ecf20Sopenharmony_ci#define MT_MCU_CMD_STOP_DMA		BIT(2)
2658c2ecf20Sopenharmony_ci#define MT_MCU_CMD_RESET_DONE		BIT(3)
2668c2ecf20Sopenharmony_ci#define MT_MCU_CMD_RECOVERY_DONE	BIT(4)
2678c2ecf20Sopenharmony_ci#define MT_MCU_CMD_NORMAL_STATE		BIT(5)
2688c2ecf20Sopenharmony_ci#define MT_MCU_CMD_ERROR_MASK		GENMASK(5, 1)
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ci#define MT_WFDMA1_GLO_CFG		MT_WFDMA1(0x208)
2718c2ecf20Sopenharmony_ci#define MT_WFDMA1_GLO_CFG_TX_DMA_EN	BIT(0)
2728c2ecf20Sopenharmony_ci#define MT_WFDMA1_GLO_CFG_RX_DMA_EN	BIT(2)
2738c2ecf20Sopenharmony_ci#define MT_WFDMA1_GLO_CFG_OMIT_TX_INFO	BIT(28)
2748c2ecf20Sopenharmony_ci#define MT_WFDMA1_GLO_CFG_OMIT_RX_INFO	BIT(27)
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci#define MT_WFDMA1_RST_DTX_PTR		MT_WFDMA1(0x20c)
2778c2ecf20Sopenharmony_ci#define MT_WFDMA1_PRI_DLY_INT_CFG0	MT_WFDMA1(0x2f0)
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci#define MT_TX_RING_BASE			MT_WFDMA1(0x300)
2808c2ecf20Sopenharmony_ci#define MT_RX_EVENT_RING_BASE		MT_WFDMA1(0x500)
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING0_EXT_CTRL	MT_WFDMA1(0x600)
2838c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING1_EXT_CTRL	MT_WFDMA1(0x604)
2848c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING2_EXT_CTRL	MT_WFDMA1(0x608)
2858c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING3_EXT_CTRL	MT_WFDMA1(0x60c)
2868c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING4_EXT_CTRL	MT_WFDMA1(0x610)
2878c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING5_EXT_CTRL	MT_WFDMA1(0x614)
2888c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING6_EXT_CTRL	MT_WFDMA1(0x618)
2898c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING7_EXT_CTRL	MT_WFDMA1(0x61c)
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING16_EXT_CTRL	MT_WFDMA1(0x640)
2928c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING17_EXT_CTRL	MT_WFDMA1(0x644)
2938c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING18_EXT_CTRL	MT_WFDMA1(0x648)
2948c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING19_EXT_CTRL	MT_WFDMA1(0x64c)
2958c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING20_EXT_CTRL	MT_WFDMA1(0x650)
2968c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING21_EXT_CTRL	MT_WFDMA1(0x654)
2978c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING22_EXT_CTRL	MT_WFDMA1(0x658)
2988c2ecf20Sopenharmony_ci#define MT_WFDMA1_TX_RING23_EXT_CTRL	MT_WFDMA1(0x65c)
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci#define MT_WFDMA1_RX_RING0_EXT_CTRL	MT_WFDMA1(0x680)
3018c2ecf20Sopenharmony_ci#define MT_WFDMA1_RX_RING1_EXT_CTRL	MT_WFDMA1(0x684)
3028c2ecf20Sopenharmony_ci#define MT_WFDMA1_RX_RING2_EXT_CTRL	MT_WFDMA1(0x688)
3038c2ecf20Sopenharmony_ci#define MT_WFDMA1_RX_RING3_EXT_CTRL	MT_WFDMA1(0x68c)
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci/* WFDMA CSR */
3068c2ecf20Sopenharmony_ci#define MT_WFDMA_EXT_CSR_BASE		0xd7000
3078c2ecf20Sopenharmony_ci#define MT_WFDMA_EXT_CSR(ofs)		(MT_WFDMA_EXT_CSR_BASE + (ofs))
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci#define MT_INT_SOURCE_CSR		MT_WFDMA_EXT_CSR(0x10)
3108c2ecf20Sopenharmony_ci#define MT_INT_MASK_CSR			MT_WFDMA_EXT_CSR(0x14)
3118c2ecf20Sopenharmony_ci#define MT_INT_RX_DONE_DATA		BIT(16)
3128c2ecf20Sopenharmony_ci#define MT_INT_RX_DONE_WM		BIT(0)
3138c2ecf20Sopenharmony_ci#define MT_INT_RX_DONE_WA		BIT(1)
3148c2ecf20Sopenharmony_ci#define MT_INT_RX_DONE(_n)		((_n) ? BIT((_n) - 1) : BIT(16))
3158c2ecf20Sopenharmony_ci#define MT_INT_RX_DONE_ALL		(BIT(0) | BIT(1) | BIT(16))
3168c2ecf20Sopenharmony_ci#define MT_INT_TX_DONE_MCU_WA		BIT(15)
3178c2ecf20Sopenharmony_ci#define MT_INT_TX_DONE_FWDL		BIT(26)
3188c2ecf20Sopenharmony_ci#define MT_INT_TX_DONE_MCU_WM		BIT(27)
3198c2ecf20Sopenharmony_ci#define MT_INT_TX_DONE_BAND0		BIT(30)
3208c2ecf20Sopenharmony_ci#define MT_INT_TX_DONE_BAND1		BIT(31)
3218c2ecf20Sopenharmony_ci#define MT_INT_MCU_CMD			BIT(29)
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci#define MT_INT_TX_DONE_MCU		(MT_INT_TX_DONE_MCU_WA |	\
3248c2ecf20Sopenharmony_ci					 MT_INT_TX_DONE_MCU_WM |	\
3258c2ecf20Sopenharmony_ci					 MT_INT_TX_DONE_FWDL)
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci#define MT_WFDMA_EXT_CSR_HIF_MISC	MT_WFDMA_EXT_CSR(0x44)
3288c2ecf20Sopenharmony_ci#define MT_WFDMA_EXT_CSR_HIF_MISC_BUSY	BIT(0)
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci/* WFDMA0 PCIE1 */
3318c2ecf20Sopenharmony_ci#define MT_WFDMA0_PCIE1_BASE			0xd8000
3328c2ecf20Sopenharmony_ci#define MT_WFDMA0_PCIE1(ofs)			(MT_WFDMA0_PCIE1_BASE + (ofs))
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA		MT_WFDMA0_PCIE1(0x13c)
3358c2ecf20Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA_TX_FIFO0	BIT(0)
3368c2ecf20Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA_TX_FIFO1	BIT(1)
3378c2ecf20Sopenharmony_ci#define MT_WFDMA0_PCIE1_BUSY_ENA_RX_FIFO	BIT(2)
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci/* WFDMA1 PCIE1 */
3408c2ecf20Sopenharmony_ci#define MT_WFDMA1_PCIE1_BASE			0xd9000
3418c2ecf20Sopenharmony_ci#define MT_WFDMA1_PCIE1(ofs)			(MT_WFDMA0_PCIE1_BASE + (ofs))
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci#define MT_WFDMA1_PCIE1_BUSY_ENA		MT_WFDMA1_PCIE1(0x13c)
3448c2ecf20Sopenharmony_ci#define MT_WFDMA1_PCIE1_BUSY_ENA_TX_FIFO0	BIT(0)
3458c2ecf20Sopenharmony_ci#define MT_WFDMA1_PCIE1_BUSY_ENA_TX_FIFO1	BIT(1)
3468c2ecf20Sopenharmony_ci#define MT_WFDMA1_PCIE1_BUSY_ENA_RX_FIFO	BIT(2)
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci#define MT_INFRA_CFG_BASE		0xf1000
3498c2ecf20Sopenharmony_ci#define MT_INFRA(ofs)			(MT_INFRA_CFG_BASE + (ofs))
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci#define MT_HIF_REMAP_L1			MT_INFRA(0x1ac)
3528c2ecf20Sopenharmony_ci#define MT_HIF_REMAP_L1_MASK		GENMASK(15, 0)
3538c2ecf20Sopenharmony_ci#define MT_HIF_REMAP_L1_OFFSET		GENMASK(15, 0)
3548c2ecf20Sopenharmony_ci#define MT_HIF_REMAP_L1_BASE		GENMASK(31, 16)
3558c2ecf20Sopenharmony_ci#define MT_HIF_REMAP_BASE_L1		0xe0000
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci#define MT_HIF_REMAP_L2			MT_INFRA(0x1b0)
3588c2ecf20Sopenharmony_ci#define MT_HIF_REMAP_L2_MASK		GENMASK(19, 0)
3598c2ecf20Sopenharmony_ci#define MT_HIF_REMAP_L2_OFFSET		GENMASK(11, 0)
3608c2ecf20Sopenharmony_ci#define MT_HIF_REMAP_L2_BASE		GENMASK(31, 12)
3618c2ecf20Sopenharmony_ci#define MT_HIF_REMAP_BASE_L2		0x00000
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci#define MT_SWDEF_BASE			0x41f200
3648c2ecf20Sopenharmony_ci#define MT_SWDEF(ofs)			(MT_SWDEF_BASE + (ofs))
3658c2ecf20Sopenharmony_ci#define MT_SWDEF_MODE			MT_SWDEF(0x3c)
3668c2ecf20Sopenharmony_ci#define MT_SWDEF_NORMAL_MODE		0
3678c2ecf20Sopenharmony_ci#define MT_SWDEF_ICAP_MODE		1
3688c2ecf20Sopenharmony_ci#define MT_SWDEF_SPECTRUM_MODE		2
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci#define MT_TOP_BASE			0x18060000
3718c2ecf20Sopenharmony_ci#define MT_TOP(ofs)			(MT_TOP_BASE + (ofs))
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci#define MT_TOP_LPCR_HOST_BAND0		MT_TOP(0x10)
3748c2ecf20Sopenharmony_ci#define MT_TOP_LPCR_HOST_FW_OWN		BIT(0)
3758c2ecf20Sopenharmony_ci#define MT_TOP_LPCR_HOST_DRV_OWN	BIT(1)
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci#define MT_TOP_MISC			MT_TOP(0xf0)
3788c2ecf20Sopenharmony_ci#define MT_TOP_MISC_FW_STATE		GENMASK(2, 0)
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci#define MT_HW_BOUND			0x70010020
3818c2ecf20Sopenharmony_ci#define MT_HW_CHIPID			0x70010200
3828c2ecf20Sopenharmony_ci#define MT_HW_REV			0x70010204
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci#define MT_PCIE_MAC_BASE		0x74030000
3858c2ecf20Sopenharmony_ci#define MT_PCIE_MAC(ofs)		(MT_PCIE_MAC_BASE + (ofs))
3868c2ecf20Sopenharmony_ci#define MT_PCIE_MAC_INT_ENABLE		MT_PCIE_MAC(0x188)
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci/* PHY: band 0(0x83080000), band 1(0x83090000) */
3898c2ecf20Sopenharmony_ci#define MT_WF_PHY_BASE			0x83080000
3908c2ecf20Sopenharmony_ci#define MT_WF_PHY(ofs)			(MT_WF_PHY_BASE + (ofs))
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci#define MT_WF_PHY_RX_CTRL1(_phy)	MT_WF_PHY(0x2004 + ((_phy) << 16))
3938c2ecf20Sopenharmony_ci#define MT_WF_PHY_RX_CTRL1_STSCNT_EN	GENMASK(11, 9)
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci#endif
396