xref: /freebsd/sys/contrib/dev/mediatek/mt76/mt7921/regs.h (revision cbb3ec25236ba72f91cbdf23f8b78b9d1af0cedf)
16c92544dSBjoern A. Zeeb /* SPDX-License-Identifier: ISC */
26c92544dSBjoern A. Zeeb /* Copyright (C) 2020 MediaTek Inc. */
36c92544dSBjoern A. Zeeb 
46c92544dSBjoern A. Zeeb #ifndef __MT7921_REGS_H
56c92544dSBjoern A. Zeeb #define __MT7921_REGS_H
66c92544dSBjoern A. Zeeb 
7*cbb3ec25SBjoern A. Zeeb #include "../mt792x_regs.h"
86c92544dSBjoern A. Zeeb 
96c92544dSBjoern A. Zeeb #define MT_MDP_BASE			0x820cd000
106c92544dSBjoern A. Zeeb #define MT_MDP(ofs)			(MT_MDP_BASE + (ofs))
116c92544dSBjoern A. Zeeb 
126c92544dSBjoern A. Zeeb #define MT_MDP_DCR0			MT_MDP(0x000)
136c92544dSBjoern A. Zeeb #define MT_MDP_DCR0_DAMSDU_EN		BIT(15)
146c92544dSBjoern A. Zeeb #define MT_MDP_DCR0_RX_HDR_TRANS_EN	BIT(19)
156c92544dSBjoern A. Zeeb 
166c92544dSBjoern A. Zeeb #define MT_MDP_DCR1			MT_MDP(0x004)
176c92544dSBjoern A. Zeeb #define MT_MDP_DCR1_MAX_RX_LEN		GENMASK(15, 3)
186c92544dSBjoern A. Zeeb 
196c92544dSBjoern A. Zeeb #define MT_MDP_BNRCFR0(_band)		MT_MDP(0x070 + ((_band) << 8))
206c92544dSBjoern A. Zeeb #define MT_MDP_RCFR0_MCU_RX_MGMT	GENMASK(5, 4)
216c92544dSBjoern A. Zeeb #define MT_MDP_RCFR0_MCU_RX_CTL_NON_BAR	GENMASK(7, 6)
226c92544dSBjoern A. Zeeb #define MT_MDP_RCFR0_MCU_RX_CTL_BAR	GENMASK(9, 8)
236c92544dSBjoern A. Zeeb 
246c92544dSBjoern A. Zeeb #define MT_MDP_BNRCFR1(_band)		MT_MDP(0x074 + ((_band) << 8))
256c92544dSBjoern A. Zeeb #define MT_MDP_RCFR1_MCU_RX_BYPASS	GENMASK(23, 22)
266c92544dSBjoern A. Zeeb #define MT_MDP_RCFR1_RX_DROPPED_UCAST	GENMASK(28, 27)
276c92544dSBjoern A. Zeeb #define MT_MDP_RCFR1_RX_DROPPED_MCAST	GENMASK(30, 29)
286c92544dSBjoern A. Zeeb #define MT_MDP_TO_HIF			0
296c92544dSBjoern A. Zeeb #define MT_MDP_TO_WM			1
306c92544dSBjoern A. Zeeb 
316c92544dSBjoern A. Zeeb #define MT_WFDMA0_HOST_INT_ENA		MT_WFDMA0(0x204)
326c92544dSBjoern A. Zeeb #define HOST_TX_DONE_INT_ENA8		BIT(12)
336c92544dSBjoern A. Zeeb #define HOST_TX_DONE_INT_ENA9		BIT(13)
346c92544dSBjoern A. Zeeb #define HOST_TX_DONE_INT_ENA10		BIT(14)
356c92544dSBjoern A. Zeeb #define HOST_TX_DONE_INT_ENA11		BIT(15)
366c92544dSBjoern A. Zeeb #define HOST_TX_DONE_INT_ENA12		BIT(16)
376c92544dSBjoern A. Zeeb #define HOST_TX_DONE_INT_ENA13		BIT(17)
386c92544dSBjoern A. Zeeb #define HOST_TX_DONE_INT_ENA14		BIT(18)
396c92544dSBjoern A. Zeeb #define HOST_RX_DONE_INT_ENA4		BIT(22)
406c92544dSBjoern A. Zeeb #define HOST_RX_DONE_INT_ENA5		BIT(23)
416c92544dSBjoern A. Zeeb #define HOST_TX_DONE_INT_ENA16		BIT(26)
426c92544dSBjoern A. Zeeb #define HOST_TX_DONE_INT_ENA17		BIT(27)
436c92544dSBjoern A. Zeeb 
446c92544dSBjoern A. Zeeb /* WFDMA interrupt */
456c92544dSBjoern A. Zeeb #define MT_INT_RX_DONE_DATA		HOST_RX_DONE_INT_ENA2
466c92544dSBjoern A. Zeeb #define MT_INT_RX_DONE_WM		HOST_RX_DONE_INT_ENA0
476c92544dSBjoern A. Zeeb #define MT_INT_RX_DONE_WM2		HOST_RX_DONE_INT_ENA4
486c92544dSBjoern A. Zeeb #define MT_INT_RX_DONE_ALL		(MT_INT_RX_DONE_DATA | \
496c92544dSBjoern A. Zeeb 					 MT_INT_RX_DONE_WM | \
506c92544dSBjoern A. Zeeb 					 MT_INT_RX_DONE_WM2)
516c92544dSBjoern A. Zeeb #define MT_INT_TX_DONE_MCU_WM		HOST_TX_DONE_INT_ENA17
526c92544dSBjoern A. Zeeb #define MT_INT_TX_DONE_FWDL		HOST_TX_DONE_INT_ENA16
536c92544dSBjoern A. Zeeb #define MT_INT_TX_DONE_BAND0		HOST_TX_DONE_INT_ENA0
546c92544dSBjoern A. Zeeb 
556c92544dSBjoern A. Zeeb #define MT_INT_TX_DONE_MCU		(MT_INT_TX_DONE_MCU_WM |	\
566c92544dSBjoern A. Zeeb 					 MT_INT_TX_DONE_FWDL)
576c92544dSBjoern A. Zeeb #define MT_INT_TX_DONE_ALL		(MT_INT_TX_DONE_MCU_WM |	\
586c92544dSBjoern A. Zeeb 					 MT_INT_TX_DONE_BAND0 |	\
596c92544dSBjoern A. Zeeb 					GENMASK(18, 4))
606c92544dSBjoern A. Zeeb 
616c92544dSBjoern A. Zeeb #define MT_RX_DATA_RING_BASE		MT_WFDMA0(0x520)
626c92544dSBjoern A. Zeeb 
636c92544dSBjoern A. Zeeb #define MT_INFRA_CFG_BASE		0xfe000
646c92544dSBjoern A. Zeeb #define MT_INFRA(ofs)			(MT_INFRA_CFG_BASE + (ofs))
656c92544dSBjoern A. Zeeb 
666c92544dSBjoern A. Zeeb #define MT_HIF_REMAP_L1			MT_INFRA(0x24c)
676c92544dSBjoern A. Zeeb #define MT_HIF_REMAP_L1_MASK		GENMASK(15, 0)
686c92544dSBjoern A. Zeeb #define MT_HIF_REMAP_L1_OFFSET		GENMASK(15, 0)
696c92544dSBjoern A. Zeeb #define MT_HIF_REMAP_L1_BASE		GENMASK(31, 16)
706c92544dSBjoern A. Zeeb #define MT_HIF_REMAP_BASE_L1		0x40000
716c92544dSBjoern A. Zeeb 
726c92544dSBjoern A. Zeeb #define MT_WFSYS_SW_RST_B		0x18000140
736c92544dSBjoern A. Zeeb 
74*cbb3ec25SBjoern A. Zeeb #define MT_WTBLON_TOP_WDUCR		MT_WTBLON_TOP(0x200)
75*cbb3ec25SBjoern A. Zeeb #define MT_WTBLON_TOP_WDUCR_GROUP	GENMASK(2, 0)
766c92544dSBjoern A. Zeeb 
77*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_UPDATE			MT_WTBLON_TOP(0x230)
78*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_UPDATE_WLAN_IDX		GENMASK(9, 0)
79*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_UPDATE_ADM_COUNT_CLEAR	BIT(12)
806c92544dSBjoern A. Zeeb 
816c92544dSBjoern A. Zeeb #endif
82