xref: /freebsd/sys/contrib/dev/mediatek/mt76/mt7996/regs.h (revision cbb3ec25236ba72f91cbdf23f8b78b9d1af0cedf)
1*cbb3ec25SBjoern A. Zeeb /* SPDX-License-Identifier: ISC */
2*cbb3ec25SBjoern A. Zeeb /*
3*cbb3ec25SBjoern A. Zeeb  * Copyright (C) 2022 MediaTek Inc.
4*cbb3ec25SBjoern A. Zeeb  */
5*cbb3ec25SBjoern A. Zeeb 
6*cbb3ec25SBjoern A. Zeeb #ifndef __MT7996_REGS_H
7*cbb3ec25SBjoern A. Zeeb #define __MT7996_REGS_H
8*cbb3ec25SBjoern A. Zeeb 
9*cbb3ec25SBjoern A. Zeeb struct __map {
10*cbb3ec25SBjoern A. Zeeb 	u32 phys;
11*cbb3ec25SBjoern A. Zeeb 	u32 mapped;
12*cbb3ec25SBjoern A. Zeeb 	u32 size;
13*cbb3ec25SBjoern A. Zeeb };
14*cbb3ec25SBjoern A. Zeeb 
15*cbb3ec25SBjoern A. Zeeb struct __base {
16*cbb3ec25SBjoern A. Zeeb 	u32 band_base[__MT_MAX_BAND];
17*cbb3ec25SBjoern A. Zeeb };
18*cbb3ec25SBjoern A. Zeeb 
19*cbb3ec25SBjoern A. Zeeb /* used to differentiate between generations */
20*cbb3ec25SBjoern A. Zeeb struct mt7996_reg_desc {
21*cbb3ec25SBjoern A. Zeeb 	const struct __base *base;
22*cbb3ec25SBjoern A. Zeeb 	const struct __map *map;
23*cbb3ec25SBjoern A. Zeeb 	u32 map_size;
24*cbb3ec25SBjoern A. Zeeb };
25*cbb3ec25SBjoern A. Zeeb 
26*cbb3ec25SBjoern A. Zeeb enum base_rev {
27*cbb3ec25SBjoern A. Zeeb 	WF_AGG_BASE,
28*cbb3ec25SBjoern A. Zeeb 	WF_ARB_BASE,
29*cbb3ec25SBjoern A. Zeeb 	WF_TMAC_BASE,
30*cbb3ec25SBjoern A. Zeeb 	WF_RMAC_BASE,
31*cbb3ec25SBjoern A. Zeeb 	WF_DMA_BASE,
32*cbb3ec25SBjoern A. Zeeb 	WF_WTBLOFF_BASE,
33*cbb3ec25SBjoern A. Zeeb 	WF_ETBF_BASE,
34*cbb3ec25SBjoern A. Zeeb 	WF_LPON_BASE,
35*cbb3ec25SBjoern A. Zeeb 	WF_MIB_BASE,
36*cbb3ec25SBjoern A. Zeeb 	WF_RATE_BASE,
37*cbb3ec25SBjoern A. Zeeb 	__MT_REG_BASE_MAX,
38*cbb3ec25SBjoern A. Zeeb };
39*cbb3ec25SBjoern A. Zeeb 
40*cbb3ec25SBjoern A. Zeeb #define __BASE(_id, _band)			(dev->reg.base[(_id)].band_base[(_band)])
41*cbb3ec25SBjoern A. Zeeb 
42*cbb3ec25SBjoern A. Zeeb #define MT_MCU_INT_EVENT			0x2108
43*cbb3ec25SBjoern A. Zeeb #define MT_MCU_INT_EVENT_DMA_STOPPED		BIT(0)
44*cbb3ec25SBjoern A. Zeeb #define MT_MCU_INT_EVENT_DMA_INIT		BIT(1)
45*cbb3ec25SBjoern A. Zeeb #define MT_MCU_INT_EVENT_RESET_DONE		BIT(3)
46*cbb3ec25SBjoern A. Zeeb 
47*cbb3ec25SBjoern A. Zeeb /* PLE */
48*cbb3ec25SBjoern A. Zeeb #define MT_PLE_BASE				0x820c0000
49*cbb3ec25SBjoern A. Zeeb #define MT_PLE(ofs)				(MT_PLE_BASE + (ofs))
50*cbb3ec25SBjoern A. Zeeb 
51*cbb3ec25SBjoern A. Zeeb #define MT_FL_Q_EMPTY				MT_PLE(0x360)
52*cbb3ec25SBjoern A. Zeeb #define MT_FL_Q0_CTRL				MT_PLE(0x3e0)
53*cbb3ec25SBjoern A. Zeeb #define MT_FL_Q2_CTRL				MT_PLE(0x3e8)
54*cbb3ec25SBjoern A. Zeeb #define MT_FL_Q3_CTRL				MT_PLE(0x3ec)
55*cbb3ec25SBjoern A. Zeeb 
56*cbb3ec25SBjoern A. Zeeb #define MT_PLE_FREEPG_CNT			MT_PLE(0x380)
57*cbb3ec25SBjoern A. Zeeb #define MT_PLE_FREEPG_HEAD_TAIL			MT_PLE(0x384)
58*cbb3ec25SBjoern A. Zeeb #define MT_PLE_PG_HIF_GROUP			MT_PLE(0x00c)
59*cbb3ec25SBjoern A. Zeeb #define MT_PLE_HIF_PG_INFO			MT_PLE(0x388)
60*cbb3ec25SBjoern A. Zeeb 
61*cbb3ec25SBjoern A. Zeeb #define MT_PLE_AC_QEMPTY(ac, n)			MT_PLE(0x600 +	0x80 * (ac) + ((n) << 2))
62*cbb3ec25SBjoern A. Zeeb #define MT_PLE_AMSDU_PACK_MSDU_CNT(n)		MT_PLE(0x10e0 + ((n) << 2))
63*cbb3ec25SBjoern A. Zeeb 
64*cbb3ec25SBjoern A. Zeeb /* WF MDP TOP */
65*cbb3ec25SBjoern A. Zeeb #define MT_MDP_BASE				0x820cc000
66*cbb3ec25SBjoern A. Zeeb #define MT_MDP(ofs)				(MT_MDP_BASE + (ofs))
67*cbb3ec25SBjoern A. Zeeb 
68*cbb3ec25SBjoern A. Zeeb #define MT_MDP_DCR2				MT_MDP(0x8e8)
69*cbb3ec25SBjoern A. Zeeb #define MT_MDP_DCR2_RX_TRANS_SHORT		BIT(2)
70*cbb3ec25SBjoern A. Zeeb 
71*cbb3ec25SBjoern A. Zeeb /* TMAC: band 0(0x820e4000), band 1(0x820f4000), band 2(0x830e4000) */
72*cbb3ec25SBjoern A. Zeeb #define MT_WF_TMAC_BASE(_band)			__BASE(WF_TMAC_BASE, (_band))
73*cbb3ec25SBjoern A. Zeeb #define MT_WF_TMAC(_band, ofs)			(MT_WF_TMAC_BASE(_band) + (ofs))
74*cbb3ec25SBjoern A. Zeeb 
75*cbb3ec25SBjoern A. Zeeb #define MT_TMAC_TCR0(_band)			MT_WF_TMAC(_band, 0)
76*cbb3ec25SBjoern A. Zeeb #define MT_TMAC_TCR0_TX_BLINK			GENMASK(7, 6)
77*cbb3ec25SBjoern A. Zeeb 
78*cbb3ec25SBjoern A. Zeeb #define MT_TMAC_CDTR(_band)			MT_WF_TMAC(_band, 0x0c8)
79*cbb3ec25SBjoern A. Zeeb #define MT_TMAC_ODTR(_band)			MT_WF_TMAC(_band, 0x0cc)
80*cbb3ec25SBjoern A. Zeeb #define MT_TIMEOUT_VAL_PLCP			GENMASK(15, 0)
81*cbb3ec25SBjoern A. Zeeb #define MT_TIMEOUT_VAL_CCA			GENMASK(31, 16)
82*cbb3ec25SBjoern A. Zeeb 
83*cbb3ec25SBjoern A. Zeeb #define MT_TMAC_ICR0(_band)			MT_WF_TMAC(_band, 0x014)
84*cbb3ec25SBjoern A. Zeeb #define MT_IFS_EIFS_OFDM			GENMASK(8, 0)
85*cbb3ec25SBjoern A. Zeeb #define MT_IFS_RIFS				GENMASK(14, 10)
86*cbb3ec25SBjoern A. Zeeb #define MT_IFS_SIFS				GENMASK(22, 16)
87*cbb3ec25SBjoern A. Zeeb #define MT_IFS_SLOT				GENMASK(30, 24)
88*cbb3ec25SBjoern A. Zeeb 
89*cbb3ec25SBjoern A. Zeeb #define MT_TMAC_ICR1(_band)			MT_WF_TMAC(_band, 0x018)
90*cbb3ec25SBjoern A. Zeeb #define MT_IFS_EIFS_CCK				GENMASK(8, 0)
91*cbb3ec25SBjoern A. Zeeb 
92*cbb3ec25SBjoern A. Zeeb /* WF DMA TOP: band 0(0x820e7000), band 1(0x820f7000), band 2(0x830e7000) */
93*cbb3ec25SBjoern A. Zeeb #define MT_WF_DMA_BASE(_band)			__BASE(WF_DMA_BASE, (_band))
94*cbb3ec25SBjoern A. Zeeb #define MT_WF_DMA(_band, ofs)			(MT_WF_DMA_BASE(_band) + (ofs))
95*cbb3ec25SBjoern A. Zeeb 
96*cbb3ec25SBjoern A. Zeeb #define MT_DMA_DCR0(_band)			MT_WF_DMA(_band, 0x000)
97*cbb3ec25SBjoern A. Zeeb #define MT_DMA_DCR0_RXD_G5_EN			BIT(23)
98*cbb3ec25SBjoern A. Zeeb 
99*cbb3ec25SBjoern A. Zeeb #define MT_DMA_TCRF1(_band)			MT_WF_DMA(_band, 0x054)
100*cbb3ec25SBjoern A. Zeeb #define MT_DMA_TCRF1_QIDX			GENMASK(15, 13)
101*cbb3ec25SBjoern A. Zeeb 
102*cbb3ec25SBjoern A. Zeeb /* WTBLOFF TOP: band 0(0x820e9000), band 1(0x820f9000), band 2(0x830e9000) */
103*cbb3ec25SBjoern A. Zeeb #define MT_WTBLOFF_BASE(_band)			__BASE(WF_WTBLOFF_BASE, (_band))
104*cbb3ec25SBjoern A. Zeeb #define MT_WTBLOFF(_band, ofs)			(MT_WTBLOFF_BASE(_band) + (ofs))
105*cbb3ec25SBjoern A. Zeeb 
106*cbb3ec25SBjoern A. Zeeb #define MT_WTBLOFF_RSCR(_band)			MT_WTBLOFF(_band, 0x008)
107*cbb3ec25SBjoern A. Zeeb #define MT_WTBLOFF_RSCR_RCPI_MODE		GENMASK(31, 30)
108*cbb3ec25SBjoern A. Zeeb #define MT_WTBLOFF_RSCR_RCPI_PARAM		GENMASK(25, 24)
109*cbb3ec25SBjoern A. Zeeb 
110*cbb3ec25SBjoern A. Zeeb /* ETBF: band 0(0x820ea000), band 1(0x820fa000), band 2(0x830ea000) */
111*cbb3ec25SBjoern A. Zeeb #define MT_WF_ETBF_BASE(_band)			__BASE(WF_ETBF_BASE, (_band))
112*cbb3ec25SBjoern A. Zeeb #define MT_WF_ETBF(_band, ofs)			(MT_WF_ETBF_BASE(_band) + (ofs))
113*cbb3ec25SBjoern A. Zeeb 
114*cbb3ec25SBjoern A. Zeeb #define MT_ETBF_RX_FB_CONT(_band)		MT_WF_ETBF(_band, 0x100)
115*cbb3ec25SBjoern A. Zeeb #define MT_ETBF_RX_FB_BW			GENMASK(10, 8)
116*cbb3ec25SBjoern A. Zeeb #define MT_ETBF_RX_FB_NC			GENMASK(7, 4)
117*cbb3ec25SBjoern A. Zeeb #define MT_ETBF_RX_FB_NR			GENMASK(3, 0)
118*cbb3ec25SBjoern A. Zeeb 
119*cbb3ec25SBjoern A. Zeeb /* LPON: band 0(0x820eb000), band 1(0x820fb000), band 2(0x830eb000) */
120*cbb3ec25SBjoern A. Zeeb #define MT_WF_LPON_BASE(_band)			__BASE(WF_LPON_BASE, (_band))
121*cbb3ec25SBjoern A. Zeeb #define MT_WF_LPON(_band, ofs)			(MT_WF_LPON_BASE(_band) + (ofs))
122*cbb3ec25SBjoern A. Zeeb 
123*cbb3ec25SBjoern A. Zeeb #define MT_LPON_UTTR0(_band)			MT_WF_LPON(_band, 0x360)
124*cbb3ec25SBjoern A. Zeeb #define MT_LPON_UTTR1(_band)			MT_WF_LPON(_band, 0x364)
125*cbb3ec25SBjoern A. Zeeb #define MT_LPON_FRCR(_band)			MT_WF_LPON(_band, 0x37c)
126*cbb3ec25SBjoern A. Zeeb 
127*cbb3ec25SBjoern A. Zeeb #define MT_LPON_TCR(_band, n)			MT_WF_LPON(_band, 0x0a8 + (((n) * 4) << 4))
128*cbb3ec25SBjoern A. Zeeb #define MT_LPON_TCR_SW_MODE			GENMASK(1, 0)
129*cbb3ec25SBjoern A. Zeeb #define MT_LPON_TCR_SW_WRITE			BIT(0)
130*cbb3ec25SBjoern A. Zeeb #define MT_LPON_TCR_SW_ADJUST			BIT(1)
131*cbb3ec25SBjoern A. Zeeb #define MT_LPON_TCR_SW_READ			GENMASK(1, 0)
132*cbb3ec25SBjoern A. Zeeb 
133*cbb3ec25SBjoern A. Zeeb /* MIB: band 0(0x820ed000), band 1(0x820fd000), band 2(0x830ed000)*/
134*cbb3ec25SBjoern A. Zeeb /* These counters are (mostly?) clear-on-read.  So, some should not
135*cbb3ec25SBjoern A. Zeeb  * be read at all in case firmware is already reading them.  These
136*cbb3ec25SBjoern A. Zeeb  * are commented with 'DNR' below. The DNR stats will be read by querying
137*cbb3ec25SBjoern A. Zeeb  * the firmware API for the appropriate message.  For counters the driver
138*cbb3ec25SBjoern A. Zeeb  * does read, the driver should accumulate the counters.
139*cbb3ec25SBjoern A. Zeeb  */
140*cbb3ec25SBjoern A. Zeeb #define MT_WF_MIB_BASE(_band)			__BASE(WF_MIB_BASE, (_band))
141*cbb3ec25SBjoern A. Zeeb #define MT_WF_MIB(_band, ofs)			(MT_WF_MIB_BASE(_band) + (ofs))
142*cbb3ec25SBjoern A. Zeeb 
143*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BSCR0(_band)			MT_WF_MIB(_band, 0x9cc)
144*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BSCR1(_band)			MT_WF_MIB(_band, 0x9d0)
145*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BSCR2(_band)			MT_WF_MIB(_band, 0x9d4)
146*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BSCR3(_band)			MT_WF_MIB(_band, 0x9d8)
147*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BSCR4(_band)			MT_WF_MIB(_band, 0x9dc)
148*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BSCR5(_band)			MT_WF_MIB(_band, 0x9e0)
149*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BSCR6(_band)			MT_WF_MIB(_band, 0x9e4)
150*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BSCR7(_band)			MT_WF_MIB(_band, 0x9e8)
151*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BSCR17(_band)			MT_WF_MIB(_band, 0xa10)
152*cbb3ec25SBjoern A. Zeeb 
153*cbb3ec25SBjoern A. Zeeb #define MT_MIB_TSCR5(_band)			MT_WF_MIB(_band, 0x6c4)
154*cbb3ec25SBjoern A. Zeeb #define MT_MIB_TSCR6(_band)			MT_WF_MIB(_band, 0x6c8)
155*cbb3ec25SBjoern A. Zeeb #define MT_MIB_TSCR7(_band)			MT_WF_MIB(_band, 0x6d0)
156*cbb3ec25SBjoern A. Zeeb 
157*cbb3ec25SBjoern A. Zeeb #define MT_MIB_RSCR1(_band)			MT_WF_MIB(_band, 0x7ac)
158*cbb3ec25SBjoern A. Zeeb /* rx mpdu counter, full 32 bits */
159*cbb3ec25SBjoern A. Zeeb #define MT_MIB_RSCR31(_band)			MT_WF_MIB(_band, 0x964)
160*cbb3ec25SBjoern A. Zeeb #define MT_MIB_RSCR33(_band)			MT_WF_MIB(_band, 0x96c)
161*cbb3ec25SBjoern A. Zeeb 
162*cbb3ec25SBjoern A. Zeeb #define MT_MIB_SDR6(_band)			MT_WF_MIB(_band, 0x020)
163*cbb3ec25SBjoern A. Zeeb #define MT_MIB_SDR6_CHANNEL_IDL_CNT_MASK	GENMASK(15, 0)
164*cbb3ec25SBjoern A. Zeeb 
165*cbb3ec25SBjoern A. Zeeb #define MT_MIB_RVSR0(_band)			MT_WF_MIB(_band, 0x720)
166*cbb3ec25SBjoern A. Zeeb 
167*cbb3ec25SBjoern A. Zeeb #define MT_MIB_RSCR35(_band)			MT_WF_MIB(_band, 0x974)
168*cbb3ec25SBjoern A. Zeeb #define MT_MIB_RSCR36(_band)			MT_WF_MIB(_band, 0x978)
169*cbb3ec25SBjoern A. Zeeb 
170*cbb3ec25SBjoern A. Zeeb /* tx ampdu cnt, full 32 bits */
171*cbb3ec25SBjoern A. Zeeb #define MT_MIB_TSCR0(_band)			MT_WF_MIB(_band, 0x6b0)
172*cbb3ec25SBjoern A. Zeeb #define MT_MIB_TSCR2(_band)			MT_WF_MIB(_band, 0x6b8)
173*cbb3ec25SBjoern A. Zeeb 
174*cbb3ec25SBjoern A. Zeeb /* counts all mpdus in ampdu, regardless of success */
175*cbb3ec25SBjoern A. Zeeb #define MT_MIB_TSCR3(_band)			MT_WF_MIB(_band, 0x6bc)
176*cbb3ec25SBjoern A. Zeeb 
177*cbb3ec25SBjoern A. Zeeb /* counts all successfully tx'd mpdus in ampdu */
178*cbb3ec25SBjoern A. Zeeb #define MT_MIB_TSCR4(_band)			MT_WF_MIB(_band, 0x6c0)
179*cbb3ec25SBjoern A. Zeeb 
180*cbb3ec25SBjoern A. Zeeb /* rx ampdu count, 32-bit */
181*cbb3ec25SBjoern A. Zeeb #define MT_MIB_RSCR27(_band)			MT_WF_MIB(_band, 0x954)
182*cbb3ec25SBjoern A. Zeeb 
183*cbb3ec25SBjoern A. Zeeb /* rx ampdu bytes count, 32-bit */
184*cbb3ec25SBjoern A. Zeeb #define MT_MIB_RSCR28(_band)			MT_WF_MIB(_band, 0x958)
185*cbb3ec25SBjoern A. Zeeb 
186*cbb3ec25SBjoern A. Zeeb /* rx ampdu valid subframe count */
187*cbb3ec25SBjoern A. Zeeb #define MT_MIB_RSCR29(_band)			MT_WF_MIB(_band, 0x95c)
188*cbb3ec25SBjoern A. Zeeb 
189*cbb3ec25SBjoern A. Zeeb /* rx ampdu valid subframe bytes count, 32bits */
190*cbb3ec25SBjoern A. Zeeb #define MT_MIB_RSCR30(_band)			MT_WF_MIB(_band, 0x960)
191*cbb3ec25SBjoern A. Zeeb 
192*cbb3ec25SBjoern A. Zeeb /* remaining windows protected stats */
193*cbb3ec25SBjoern A. Zeeb #define MT_MIB_SDR27(_band)			MT_WF_MIB(_band, 0x080)
194*cbb3ec25SBjoern A. Zeeb #define MT_MIB_SDR27_TX_RWP_FAIL_CNT		GENMASK(15, 0)
195*cbb3ec25SBjoern A. Zeeb 
196*cbb3ec25SBjoern A. Zeeb #define MT_MIB_SDR28(_band)			MT_WF_MIB(_band, 0x084)
197*cbb3ec25SBjoern A. Zeeb #define MT_MIB_SDR28_TX_RWP_NEED_CNT		GENMASK(15, 0)
198*cbb3ec25SBjoern A. Zeeb 
199*cbb3ec25SBjoern A. Zeeb #define MT_MIB_RVSR1(_band)			MT_WF_MIB(_band, 0x724)
200*cbb3ec25SBjoern A. Zeeb 
201*cbb3ec25SBjoern A. Zeeb /* rx blockack count, 32 bits */
202*cbb3ec25SBjoern A. Zeeb #define MT_MIB_TSCR1(_band)			MT_WF_MIB(_band, 0x6b4)
203*cbb3ec25SBjoern A. Zeeb 
204*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BTSCR0(_band)			MT_WF_MIB(_band, 0x5e0)
205*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BTSCR5(_band)			MT_WF_MIB(_band, 0x788)
206*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BTSCR6(_band)			MT_WF_MIB(_band, 0x798)
207*cbb3ec25SBjoern A. Zeeb 
208*cbb3ec25SBjoern A. Zeeb #define MT_MIB_BFTFCR(_band)			MT_WF_MIB(_band, 0x5d0)
209*cbb3ec25SBjoern A. Zeeb 
210*cbb3ec25SBjoern A. Zeeb #define MT_TX_AGG_CNT(_band, n)			MT_WF_MIB(_band, 0xa28 + ((n) << 2))
211*cbb3ec25SBjoern A. Zeeb #define MT_MIB_ARNG(_band, n)			MT_WF_MIB(_band, 0x0b0 + ((n) << 2))
212*cbb3ec25SBjoern A. Zeeb #define MT_MIB_ARNCR_RANGE(val, n)		(((val) >> ((n) << 4)) & GENMASK(9, 0))
213*cbb3ec25SBjoern A. Zeeb 
214*cbb3ec25SBjoern A. Zeeb /* UMIB */
215*cbb3ec25SBjoern A. Zeeb #define MT_WF_UMIB_BASE				0x820cd000
216*cbb3ec25SBjoern A. Zeeb #define MT_WF_UMIB(ofs)				(MT_WF_UMIB_BASE + (ofs))
217*cbb3ec25SBjoern A. Zeeb 
218*cbb3ec25SBjoern A. Zeeb #define MT_UMIB_RPDCR(_band)			(MT_WF_UMIB(0x594) + (_band) * 0x164)
219*cbb3ec25SBjoern A. Zeeb 
220*cbb3ec25SBjoern A. Zeeb /* WTBLON TOP */
221*cbb3ec25SBjoern A. Zeeb #define MT_WTBLON_TOP_BASE			0x820d4000
222*cbb3ec25SBjoern A. Zeeb #define MT_WTBLON_TOP(ofs)			(MT_WTBLON_TOP_BASE + (ofs))
223*cbb3ec25SBjoern A. Zeeb #define MT_WTBLON_TOP_WDUCR			MT_WTBLON_TOP(0x370)
224*cbb3ec25SBjoern A. Zeeb #define MT_WTBLON_TOP_WDUCR_GROUP		GENMASK(4, 0)
225*cbb3ec25SBjoern A. Zeeb 
226*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_UPDATE				MT_WTBLON_TOP(0x380)
227*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_UPDATE_WLAN_IDX			GENMASK(11, 0)
228*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_UPDATE_ADM_COUNT_CLEAR		BIT(14)
229*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_UPDATE_BUSY			BIT(31)
230*cbb3ec25SBjoern A. Zeeb 
231*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_ITCR				MT_WTBLON_TOP(0x3b0)
232*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_ITCR_WR				BIT(16)
233*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_ITCR_EXEC			BIT(31)
234*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_ITDR0				MT_WTBLON_TOP(0x3b8)
235*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_ITDR1				MT_WTBLON_TOP(0x3bc)
236*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_SPE_IDX_SEL			BIT(6)
237*cbb3ec25SBjoern A. Zeeb 
238*cbb3ec25SBjoern A. Zeeb /* WTBL */
239*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_BASE				0x820d8000
240*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_LMAC_ID				GENMASK(14, 8)
241*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_LMAC_DW				GENMASK(7, 2)
242*cbb3ec25SBjoern A. Zeeb #define MT_WTBL_LMAC_OFFS(_id, _dw)		(MT_WTBL_BASE | \
243*cbb3ec25SBjoern A. Zeeb 						 FIELD_PREP(MT_WTBL_LMAC_ID, _id) | \
244*cbb3ec25SBjoern A. Zeeb 						 FIELD_PREP(MT_WTBL_LMAC_DW, _dw))
245*cbb3ec25SBjoern A. Zeeb 
246*cbb3ec25SBjoern A. Zeeb /* ARB: band 0(0x820e3000), band 1(0x820f3000), band 2(0x830e3000) */
247*cbb3ec25SBjoern A. Zeeb #define MT_WF_ARB_BASE(_band)			__BASE(WF_ARB_BASE, (_band))
248*cbb3ec25SBjoern A. Zeeb #define MT_WF_ARB(_band, ofs)			(MT_WF_ARB_BASE(_band) + (ofs))
249*cbb3ec25SBjoern A. Zeeb 
250*cbb3ec25SBjoern A. Zeeb #define MT_ARB_SCR(_band)			MT_WF_ARB(_band, 0x000)
251*cbb3ec25SBjoern A. Zeeb #define MT_ARB_SCR_TX_DISABLE			BIT(8)
252*cbb3ec25SBjoern A. Zeeb #define MT_ARB_SCR_RX_DISABLE			BIT(9)
253*cbb3ec25SBjoern A. Zeeb 
254*cbb3ec25SBjoern A. Zeeb /* RMAC: band 0(0x820e5000), band 1(0x820f5000), band 2(0x830e5000), */
255*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_BASE(_band)			__BASE(WF_RMAC_BASE, (_band))
256*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC(_band, ofs)			(MT_WF_RMAC_BASE(_band) + (ofs))
257*cbb3ec25SBjoern A. Zeeb 
258*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR(_band)			MT_WF_RMAC(_band, 0x000)
259*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_STBC_MULTI		BIT(0)
260*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_FCSFAIL			BIT(1)
261*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_PROBEREQ		BIT(4)
262*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_MCAST			BIT(5)
263*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_BCAST			BIT(6)
264*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_MCAST_FILTERED		BIT(7)
265*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_A3_MAC			BIT(8)
266*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_A3_BSSID		BIT(9)
267*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_A2_BSSID		BIT(10)
268*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_OTHER_BEACON		BIT(11)
269*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_FRAME_REPORT		BIT(12)
270*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_CTL_RSV			BIT(13)
271*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_CTS			BIT(14)
272*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_RTS			BIT(15)
273*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_DUPLICATE		BIT(16)
274*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_OTHER_BSS		BIT(17)
275*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_OTHER_UC		BIT(18)
276*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_OTHER_TIM		BIT(19)
277*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_NDPA			BIT(20)
278*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR_DROP_UNWANTED_CTL		BIT(21)
279*cbb3ec25SBjoern A. Zeeb 
280*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR1(_band)			MT_WF_RMAC(_band, 0x004)
281*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR1_DROP_ACK			BIT(4)
282*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR1_DROP_BF_POLL		BIT(5)
283*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR1_DROP_BA			BIT(6)
284*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR1_DROP_CFEND			BIT(7)
285*cbb3ec25SBjoern A. Zeeb #define MT_WF_RFCR1_DROP_CFACK			BIT(8)
286*cbb3ec25SBjoern A. Zeeb 
287*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_MIB_AIRTIME0(_band)		MT_WF_RMAC(_band, 0x0380)
288*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_MIB_RXTIME_CLR		BIT(31)
289*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_MIB_ED_OFFSET		GENMASK(20, 16)
290*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_MIB_OBSS_BACKOFF		GENMASK(15, 0)
291*cbb3ec25SBjoern A. Zeeb 
292*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_MIB_AIRTIME1(_band)		MT_WF_RMAC(_band, 0x0384)
293*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_MIB_NONQOSD_BACKOFF		GENMASK(31, 16)
294*cbb3ec25SBjoern A. Zeeb 
295*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_MIB_AIRTIME3(_band)		MT_WF_RMAC(_band, 0x038c)
296*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_MIB_QOS01_BACKOFF		GENMASK(31, 0)
297*cbb3ec25SBjoern A. Zeeb 
298*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_MIB_AIRTIME4(_band)		MT_WF_RMAC(_band, 0x0390)
299*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_MIB_QOS23_BACKOFF		GENMASK(31, 0)
300*cbb3ec25SBjoern A. Zeeb 
301*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_RSVD0(_band)			MT_WF_RMAC(_band, 0x03e0)
302*cbb3ec25SBjoern A. Zeeb #define MT_WF_RMAC_RSVD0_EIFS_CLR		BIT(21)
303*cbb3ec25SBjoern A. Zeeb 
304*cbb3ec25SBjoern A. Zeeb /* RATE: band 0(0x820ee000), band 1(0x820fe000), band 2(0x830ee000) */
305*cbb3ec25SBjoern A. Zeeb #define MT_WF_RATE_BASE(_band)			__BASE(WF_RATE_BASE, (_band))
306*cbb3ec25SBjoern A. Zeeb #define MT_WF_RATE(_band, ofs)			(MT_WF_RATE_BASE(_band) + (ofs))
307*cbb3ec25SBjoern A. Zeeb 
308*cbb3ec25SBjoern A. Zeeb #define MT_RATE_HRCR0(_band)			MT_WF_RATE(_band, 0x050)
309*cbb3ec25SBjoern A. Zeeb #define MT_RATE_HRCR0_CFEND_RATE		GENMASK(14, 0)
310*cbb3ec25SBjoern A. Zeeb 
311*cbb3ec25SBjoern A. Zeeb /* WFDMA0 */
312*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_BASE				0xd4000
313*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0(ofs)				(MT_WFDMA0_BASE + (ofs))
314*cbb3ec25SBjoern A. Zeeb 
315*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_RST				MT_WFDMA0(0x100)
316*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_RST_LOGIC_RST			BIT(4)
317*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_RST_DMASHDL_ALL_RST		BIT(5)
318*cbb3ec25SBjoern A. Zeeb 
319*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_BUSY_ENA			MT_WFDMA0(0x13c)
320*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_BUSY_ENA_TX_FIFO0		BIT(0)
321*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_BUSY_ENA_TX_FIFO1		BIT(1)
322*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_BUSY_ENA_RX_FIFO		BIT(2)
323*cbb3ec25SBjoern A. Zeeb 
324*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_RX_INT_PCIE_SEL		MT_WFDMA0(0x154)
325*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_RX_INT_SEL_RING3		BIT(3)
326*cbb3ec25SBjoern A. Zeeb 
327*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_MCU_HOST_INT_ENA		MT_WFDMA0(0x1f4)
328*cbb3ec25SBjoern A. Zeeb 
329*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_GLO_CFG			MT_WFDMA0(0x208)
330*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_GLO_CFG_TX_DMA_EN		BIT(0)
331*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_GLO_CFG_RX_DMA_EN		BIT(2)
332*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_GLO_CFG_OMIT_TX_INFO		BIT(28)
333*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_GLO_CFG_OMIT_RX_INFO		BIT(27)
334*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2	BIT(21)
335*cbb3ec25SBjoern A. Zeeb 
336*cbb3ec25SBjoern A. Zeeb #define WF_WFDMA0_GLO_CFG_EXT0			MT_WFDMA0(0x2b0)
337*cbb3ec25SBjoern A. Zeeb #define WF_WFDMA0_GLO_CFG_EXT0_RX_WB_RXD	BIT(18)
338*cbb3ec25SBjoern A. Zeeb #define WF_WFDMA0_GLO_CFG_EXT0_WED_MERGE_MODE	BIT(14)
339*cbb3ec25SBjoern A. Zeeb 
340*cbb3ec25SBjoern A. Zeeb #define WF_WFDMA0_GLO_CFG_EXT1			MT_WFDMA0(0x2b4)
341*cbb3ec25SBjoern A. Zeeb #define WF_WFDMA0_GLO_CFG_EXT1_CALC_MODE	BIT(31)
342*cbb3ec25SBjoern A. Zeeb #define WF_WFDMA0_GLO_CFG_EXT1_TX_FCTRL_MODE	BIT(28)
343*cbb3ec25SBjoern A. Zeeb 
344*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_RST_DTX_PTR			MT_WFDMA0(0x20c)
345*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_PRI_DLY_INT_CFG0		MT_WFDMA0(0x2f0)
346*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_PRI_DLY_INT_CFG1		MT_WFDMA0(0x2f4)
347*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_PRI_DLY_INT_CFG2		MT_WFDMA0(0x2f8)
348*cbb3ec25SBjoern A. Zeeb 
349*cbb3ec25SBjoern A. Zeeb /* WFDMA1 */
350*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA1_BASE				0xd5000
351*cbb3ec25SBjoern A. Zeeb 
352*cbb3ec25SBjoern A. Zeeb /* WFDMA CSR */
353*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA_EXT_CSR_BASE			0xd7000
354*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA_EXT_CSR(ofs)			(MT_WFDMA_EXT_CSR_BASE + (ofs))
355*cbb3ec25SBjoern A. Zeeb 
356*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA_HOST_CONFIG			MT_WFDMA_EXT_CSR(0x30)
357*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA_HOST_CONFIG_PDMA_BAND		BIT(0)
358*cbb3ec25SBjoern A. Zeeb 
359*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA_EXT_CSR_HIF_MISC		MT_WFDMA_EXT_CSR(0x44)
360*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA_EXT_CSR_HIF_MISC_BUSY		BIT(0)
361*cbb3ec25SBjoern A. Zeeb 
362*cbb3ec25SBjoern A. Zeeb #define MT_PCIE_RECOG_ID			0xd7090
363*cbb3ec25SBjoern A. Zeeb #define MT_PCIE_RECOG_ID_MASK			GENMASK(30, 0)
364*cbb3ec25SBjoern A. Zeeb #define MT_PCIE_RECOG_ID_SEM			BIT(31)
365*cbb3ec25SBjoern A. Zeeb 
366*cbb3ec25SBjoern A. Zeeb /* WFDMA0 PCIE1 */
367*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_PCIE1_BASE			0xd8000
368*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_PCIE1(ofs)			(MT_WFDMA0_PCIE1_BASE + (ofs))
369*cbb3ec25SBjoern A. Zeeb 
370*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_PCIE1_BUSY_ENA		MT_WFDMA0_PCIE1(0x13c)
371*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_PCIE1_BUSY_ENA_TX_FIFO0	BIT(0)
372*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_PCIE1_BUSY_ENA_TX_FIFO1	BIT(1)
373*cbb3ec25SBjoern A. Zeeb #define MT_WFDMA0_PCIE1_BUSY_ENA_RX_FIFO	BIT(2)
374*cbb3ec25SBjoern A. Zeeb 
375*cbb3ec25SBjoern A. Zeeb /* WFDMA COMMON */
376*cbb3ec25SBjoern A. Zeeb #define __RXQ(q)				((q) + __MT_MCUQ_MAX)
377*cbb3ec25SBjoern A. Zeeb #define __TXQ(q)				(__RXQ(q) + __MT_RXQ_MAX)
378*cbb3ec25SBjoern A. Zeeb 
379*cbb3ec25SBjoern A. Zeeb #define MT_Q_ID(q)				(dev->q_id[(q)])
380*cbb3ec25SBjoern A. Zeeb #define MT_Q_BASE(q)				((dev->q_wfdma_mask >> (q)) & 0x1 ?	\
381*cbb3ec25SBjoern A. Zeeb 						 MT_WFDMA1_BASE : MT_WFDMA0_BASE)
382*cbb3ec25SBjoern A. Zeeb 
383*cbb3ec25SBjoern A. Zeeb #define MT_MCUQ_ID(q)				MT_Q_ID(q)
384*cbb3ec25SBjoern A. Zeeb #define MT_TXQ_ID(q)				MT_Q_ID(__TXQ(q))
385*cbb3ec25SBjoern A. Zeeb #define MT_RXQ_ID(q)				MT_Q_ID(__RXQ(q))
386*cbb3ec25SBjoern A. Zeeb 
387*cbb3ec25SBjoern A. Zeeb #define MT_MCUQ_RING_BASE(q)			(MT_Q_BASE(q) + 0x300)
388*cbb3ec25SBjoern A. Zeeb #define MT_TXQ_RING_BASE(q)			(MT_Q_BASE(__TXQ(q)) + 0x300)
389*cbb3ec25SBjoern A. Zeeb #define MT_RXQ_RING_BASE(q)			(MT_Q_BASE(__RXQ(q)) + 0x500)
390*cbb3ec25SBjoern A. Zeeb 
391*cbb3ec25SBjoern A. Zeeb #define MT_MCUQ_EXT_CTRL(q)			(MT_Q_BASE(q) +	0x600 +	\
392*cbb3ec25SBjoern A. Zeeb 						 MT_MCUQ_ID(q) * 0x4)
393*cbb3ec25SBjoern A. Zeeb #define MT_RXQ_BAND1_CTRL(q)			(MT_Q_BASE(__RXQ(q)) + 0x680 +	\
394*cbb3ec25SBjoern A. Zeeb 						 MT_RXQ_ID(q) * 0x4)
395*cbb3ec25SBjoern A. Zeeb #define MT_TXQ_EXT_CTRL(q)			(MT_Q_BASE(__TXQ(q)) + 0x600 +	\
396*cbb3ec25SBjoern A. Zeeb 						 MT_TXQ_ID(q) * 0x4)
397*cbb3ec25SBjoern A. Zeeb 
398*cbb3ec25SBjoern A. Zeeb #define MT_INT_SOURCE_CSR			MT_WFDMA0(0x200)
399*cbb3ec25SBjoern A. Zeeb #define MT_INT_MASK_CSR				MT_WFDMA0(0x204)
400*cbb3ec25SBjoern A. Zeeb 
401*cbb3ec25SBjoern A. Zeeb #define MT_INT1_SOURCE_CSR			MT_WFDMA0_PCIE1(0x200)
402*cbb3ec25SBjoern A. Zeeb #define MT_INT1_MASK_CSR			MT_WFDMA0_PCIE1(0x204)
403*cbb3ec25SBjoern A. Zeeb 
404*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_DONE_BAND0			BIT(12)
405*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_DONE_BAND1			BIT(12)
406*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_DONE_BAND2			BIT(13)
407*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_DONE_WM			BIT(0)
408*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_DONE_WA			BIT(1)
409*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_DONE_WA_MAIN			BIT(2)
410*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_DONE_WA_EXT			BIT(2)
411*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_DONE_WA_TRI			BIT(3)
412*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_TXFREE_MAIN			BIT(17)
413*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_TXFREE_TRI			BIT(15)
414*cbb3ec25SBjoern A. Zeeb #define MT_INT_MCU_CMD				BIT(29)
415*cbb3ec25SBjoern A. Zeeb 
416*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX(q)				(dev->q_int_mask[__RXQ(q)])
417*cbb3ec25SBjoern A. Zeeb #define MT_INT_TX_MCU(q)			(dev->q_int_mask[(q)])
418*cbb3ec25SBjoern A. Zeeb 
419*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_DONE_MCU			(MT_INT_RX(MT_RXQ_MCU) |	\
420*cbb3ec25SBjoern A. Zeeb 						 MT_INT_RX(MT_RXQ_MCU_WA))
421*cbb3ec25SBjoern A. Zeeb 
422*cbb3ec25SBjoern A. Zeeb #define MT_INT_BAND0_RX_DONE			(MT_INT_RX(MT_RXQ_MAIN) |	\
423*cbb3ec25SBjoern A. Zeeb 						 MT_INT_RX(MT_RXQ_MAIN_WA))
424*cbb3ec25SBjoern A. Zeeb 
425*cbb3ec25SBjoern A. Zeeb #define MT_INT_BAND1_RX_DONE			(MT_INT_RX(MT_RXQ_BAND1) |	\
426*cbb3ec25SBjoern A. Zeeb 						 MT_INT_RX(MT_RXQ_BAND1_WA) |	\
427*cbb3ec25SBjoern A. Zeeb 						 MT_INT_RX(MT_RXQ_MAIN_WA))
428*cbb3ec25SBjoern A. Zeeb 
429*cbb3ec25SBjoern A. Zeeb #define MT_INT_BAND2_RX_DONE			(MT_INT_RX(MT_RXQ_BAND2) |	\
430*cbb3ec25SBjoern A. Zeeb 						 MT_INT_RX(MT_RXQ_BAND2_WA) |	\
431*cbb3ec25SBjoern A. Zeeb 						 MT_INT_RX(MT_RXQ_MAIN_WA))
432*cbb3ec25SBjoern A. Zeeb 
433*cbb3ec25SBjoern A. Zeeb #define MT_INT_RX_DONE_ALL			(MT_INT_RX_DONE_MCU |		\
434*cbb3ec25SBjoern A. Zeeb 						 MT_INT_BAND0_RX_DONE |		\
435*cbb3ec25SBjoern A. Zeeb 						 MT_INT_BAND1_RX_DONE |		\
436*cbb3ec25SBjoern A. Zeeb 						 MT_INT_BAND2_RX_DONE)
437*cbb3ec25SBjoern A. Zeeb 
438*cbb3ec25SBjoern A. Zeeb #define MT_INT_TX_DONE_FWDL			BIT(26)
439*cbb3ec25SBjoern A. Zeeb #define MT_INT_TX_DONE_MCU_WM			BIT(27)
440*cbb3ec25SBjoern A. Zeeb #define MT_INT_TX_DONE_MCU_WA			BIT(22)
441*cbb3ec25SBjoern A. Zeeb #define MT_INT_TX_DONE_BAND0			BIT(30)
442*cbb3ec25SBjoern A. Zeeb #define MT_INT_TX_DONE_BAND1			BIT(31)
443*cbb3ec25SBjoern A. Zeeb #define MT_INT_TX_DONE_BAND2			BIT(15)
444*cbb3ec25SBjoern A. Zeeb 
445*cbb3ec25SBjoern A. Zeeb #define MT_INT_TX_DONE_MCU			(MT_INT_TX_MCU(MT_MCUQ_WA) |	\
446*cbb3ec25SBjoern A. Zeeb 						 MT_INT_TX_MCU(MT_MCUQ_WM) |	\
447*cbb3ec25SBjoern A. Zeeb 						 MT_INT_TX_MCU(MT_MCUQ_FWDL))
448*cbb3ec25SBjoern A. Zeeb 
449*cbb3ec25SBjoern A. Zeeb #define MT_MCU_CMD				MT_WFDMA0(0x1f0)
450*cbb3ec25SBjoern A. Zeeb #define MT_MCU_CMD_STOP_DMA			BIT(2)
451*cbb3ec25SBjoern A. Zeeb #define MT_MCU_CMD_RESET_DONE			BIT(3)
452*cbb3ec25SBjoern A. Zeeb #define MT_MCU_CMD_RECOVERY_DONE		BIT(4)
453*cbb3ec25SBjoern A. Zeeb #define MT_MCU_CMD_NORMAL_STATE			BIT(5)
454*cbb3ec25SBjoern A. Zeeb #define MT_MCU_CMD_ERROR_MASK			GENMASK(5, 1)
455*cbb3ec25SBjoern A. Zeeb 
456*cbb3ec25SBjoern A. Zeeb #define MT_MCU_CMD_WA_WDT			BIT(31)
457*cbb3ec25SBjoern A. Zeeb #define MT_MCU_CMD_WM_WDT			BIT(30)
458*cbb3ec25SBjoern A. Zeeb #define MT_MCU_CMD_WDT_MASK			GENMASK(31, 30)
459*cbb3ec25SBjoern A. Zeeb 
460*cbb3ec25SBjoern A. Zeeb /* l1/l2 remap */
461*cbb3ec25SBjoern A. Zeeb #define MT_HIF_REMAP_L1				0x155024
462*cbb3ec25SBjoern A. Zeeb #define MT_HIF_REMAP_L1_MASK			GENMASK(31, 16)
463*cbb3ec25SBjoern A. Zeeb #define MT_HIF_REMAP_L1_OFFSET			GENMASK(15, 0)
464*cbb3ec25SBjoern A. Zeeb #define MT_HIF_REMAP_L1_BASE			GENMASK(31, 16)
465*cbb3ec25SBjoern A. Zeeb #define MT_HIF_REMAP_BASE_L1			0x130000
466*cbb3ec25SBjoern A. Zeeb 
467*cbb3ec25SBjoern A. Zeeb #define MT_HIF_REMAP_L2				0x1b4
468*cbb3ec25SBjoern A. Zeeb #define MT_HIF_REMAP_L2_MASK			GENMASK(19, 0)
469*cbb3ec25SBjoern A. Zeeb #define MT_HIF_REMAP_L2_OFFSET			GENMASK(11, 0)
470*cbb3ec25SBjoern A. Zeeb #define MT_HIF_REMAP_L2_BASE			GENMASK(31, 12)
471*cbb3ec25SBjoern A. Zeeb #define MT_HIF_REMAP_BASE_L2			0x1000
472*cbb3ec25SBjoern A. Zeeb 
473*cbb3ec25SBjoern A. Zeeb #define MT_INFRA_BASE				0x18000000
474*cbb3ec25SBjoern A. Zeeb #define MT_WFSYS0_PHY_START			0x18400000
475*cbb3ec25SBjoern A. Zeeb #define MT_WFSYS1_PHY_START			0x18800000
476*cbb3ec25SBjoern A. Zeeb #define MT_WFSYS1_PHY_END			0x18bfffff
477*cbb3ec25SBjoern A. Zeeb #define MT_CBTOP1_PHY_START			0x70000000
478*cbb3ec25SBjoern A. Zeeb #define MT_CBTOP1_PHY_END			0x77ffffff
479*cbb3ec25SBjoern A. Zeeb #define MT_CBTOP2_PHY_START			0xf0000000
480*cbb3ec25SBjoern A. Zeeb #define MT_INFRA_MCU_START			0x7c000000
481*cbb3ec25SBjoern A. Zeeb #define MT_INFRA_MCU_END			0x7c3fffff
482*cbb3ec25SBjoern A. Zeeb 
483*cbb3ec25SBjoern A. Zeeb /* FW MODE SYNC */
484*cbb3ec25SBjoern A. Zeeb #define MT_FW_ASSERT_CNT			0x02208274
485*cbb3ec25SBjoern A. Zeeb #define MT_FW_DUMP_STATE			0x02209e90
486*cbb3ec25SBjoern A. Zeeb 
487*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_BASE				0x00401400
488*cbb3ec25SBjoern A. Zeeb 
489*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF(ofs)				(MT_SWDEF_BASE + (ofs))
490*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_MODE				MT_SWDEF(0x3c)
491*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_NORMAL_MODE			0
492*cbb3ec25SBjoern A. Zeeb 
493*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_SER_STATS			MT_SWDEF(0x040)
494*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_PLE_STATS			MT_SWDEF(0x044)
495*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_PLE1_STATS			MT_SWDEF(0x048)
496*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_PLE_AMSDU_STATS		MT_SWDEF(0x04c)
497*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_PSE_STATS			MT_SWDEF(0x050)
498*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_PSE1_STATS			MT_SWDEF(0x054)
499*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_LAMC_WISR6_BN0_STATS		MT_SWDEF(0x058)
500*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_LAMC_WISR6_BN1_STATS		MT_SWDEF(0x05c)
501*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_LAMC_WISR6_BN2_STATS		MT_SWDEF(0x060)
502*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_LAMC_WISR7_BN0_STATS		MT_SWDEF(0x064)
503*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_LAMC_WISR7_BN1_STATS		MT_SWDEF(0x068)
504*cbb3ec25SBjoern A. Zeeb #define MT_SWDEF_LAMC_WISR7_BN2_STATS		MT_SWDEF(0x06c)
505*cbb3ec25SBjoern A. Zeeb 
506*cbb3ec25SBjoern A. Zeeb /* LED */
507*cbb3ec25SBjoern A. Zeeb #define MT_LED_TOP_BASE				0x18013000
508*cbb3ec25SBjoern A. Zeeb #define MT_LED_PHYS(_n)				(MT_LED_TOP_BASE + (_n))
509*cbb3ec25SBjoern A. Zeeb 
510*cbb3ec25SBjoern A. Zeeb #define MT_LED_CTRL(_n)				MT_LED_PHYS(0x00 + ((_n) * 4))
511*cbb3ec25SBjoern A. Zeeb #define MT_LED_CTRL_KICK			BIT(7)
512*cbb3ec25SBjoern A. Zeeb #define MT_LED_CTRL_BLINK_MODE			BIT(2)
513*cbb3ec25SBjoern A. Zeeb #define MT_LED_CTRL_POLARITY			BIT(1)
514*cbb3ec25SBjoern A. Zeeb 
515*cbb3ec25SBjoern A. Zeeb #define MT_LED_TX_BLINK(_n)			MT_LED_PHYS(0x10 + ((_n) * 4))
516*cbb3ec25SBjoern A. Zeeb #define MT_LED_TX_BLINK_ON_MASK			GENMASK(7, 0)
517*cbb3ec25SBjoern A. Zeeb #define MT_LED_TX_BLINK_OFF_MASK		GENMASK(15, 8)
518*cbb3ec25SBjoern A. Zeeb 
519*cbb3ec25SBjoern A. Zeeb #define MT_LED_EN(_n)				MT_LED_PHYS(0x40 + ((_n) * 4))
520*cbb3ec25SBjoern A. Zeeb 
521*cbb3ec25SBjoern A. Zeeb /* CONN DBG */
522*cbb3ec25SBjoern A. Zeeb #define MT_CONN_DBG_CTL_BASE			0x18023000
523*cbb3ec25SBjoern A. Zeeb #define MT_CONN_DBG_CTL(ofs)			(MT_CONN_DBG_CTL_BASE + (ofs))
524*cbb3ec25SBjoern A. Zeeb #define MT_CONN_DBG_CTL_OUT_SEL			MT_CONN_DBG_CTL(0x604)
525*cbb3ec25SBjoern A. Zeeb #define MT_CONN_DBG_CTL_PC_LOG_SEL		MT_CONN_DBG_CTL(0x60c)
526*cbb3ec25SBjoern A. Zeeb #define MT_CONN_DBG_CTL_PC_LOG			MT_CONN_DBG_CTL(0x610)
527*cbb3ec25SBjoern A. Zeeb 
528*cbb3ec25SBjoern A. Zeeb #define MT_LED_GPIO_MUX2			0x70005058 /* GPIO 18 */
529*cbb3ec25SBjoern A. Zeeb #define MT_LED_GPIO_MUX3			0x7000505C /* GPIO 26 */
530*cbb3ec25SBjoern A. Zeeb #define MT_LED_GPIO_SEL_MASK			GENMASK(11, 8)
531*cbb3ec25SBjoern A. Zeeb 
532*cbb3ec25SBjoern A. Zeeb /* MT TOP */
533*cbb3ec25SBjoern A. Zeeb #define MT_TOP_BASE				0xe0000
534*cbb3ec25SBjoern A. Zeeb #define MT_TOP(ofs)				(MT_TOP_BASE + (ofs))
535*cbb3ec25SBjoern A. Zeeb 
536*cbb3ec25SBjoern A. Zeeb #define MT_TOP_LPCR_HOST_BAND(_band)		MT_TOP(0x10 + ((_band) * 0x10))
537*cbb3ec25SBjoern A. Zeeb #define MT_TOP_LPCR_HOST_FW_OWN			BIT(0)
538*cbb3ec25SBjoern A. Zeeb #define MT_TOP_LPCR_HOST_DRV_OWN		BIT(1)
539*cbb3ec25SBjoern A. Zeeb #define MT_TOP_LPCR_HOST_FW_OWN_STAT		BIT(2)
540*cbb3ec25SBjoern A. Zeeb 
541*cbb3ec25SBjoern A. Zeeb #define MT_TOP_LPCR_HOST_BAND_IRQ_STAT(_band)	MT_TOP(0x14 + ((_band) * 0x10))
542*cbb3ec25SBjoern A. Zeeb #define MT_TOP_LPCR_HOST_BAND_STAT		BIT(0)
543*cbb3ec25SBjoern A. Zeeb 
544*cbb3ec25SBjoern A. Zeeb #define MT_TOP_MISC				MT_TOP(0xf0)
545*cbb3ec25SBjoern A. Zeeb #define MT_TOP_MISC_FW_STATE			GENMASK(2, 0)
546*cbb3ec25SBjoern A. Zeeb 
547*cbb3ec25SBjoern A. Zeeb #define MT_HW_REV				0x70010204
548*cbb3ec25SBjoern A. Zeeb #define MT_WF_SUBSYS_RST			0x70028600
549*cbb3ec25SBjoern A. Zeeb 
550*cbb3ec25SBjoern A. Zeeb /* PCIE MAC */
551*cbb3ec25SBjoern A. Zeeb #define MT_PCIE_MAC_BASE			0x74030000
552*cbb3ec25SBjoern A. Zeeb #define MT_PCIE_MAC(ofs)			(MT_PCIE_MAC_BASE + (ofs))
553*cbb3ec25SBjoern A. Zeeb #define MT_PCIE_MAC_INT_ENABLE			MT_PCIE_MAC(0x188)
554*cbb3ec25SBjoern A. Zeeb 
555*cbb3ec25SBjoern A. Zeeb #define MT_PCIE1_MAC_BASE			0x74090000
556*cbb3ec25SBjoern A. Zeeb #define MT_PCIE1_MAC(ofs)			(MT_PCIE1_MAC_BASE + (ofs))
557*cbb3ec25SBjoern A. Zeeb 
558*cbb3ec25SBjoern A. Zeeb #define MT_PCIE1_MAC_INT_ENABLE			MT_PCIE1_MAC(0x188)
559*cbb3ec25SBjoern A. Zeeb 
560*cbb3ec25SBjoern A. Zeeb /* PHYRX CSD */
561*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_CSD_BASE			0x83000000
562*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_CSD(_band, _wf, ofs)	(MT_WF_PHYRX_CSD_BASE + \
563*cbb3ec25SBjoern A. Zeeb 						 ((_band) << 20) + \
564*cbb3ec25SBjoern A. Zeeb 						 ((_wf) << 16) + (ofs))
565*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_CSD_IRPI(_band, _wf)	MT_WF_PHYRX_CSD(_band, _wf, 0x1000)
566*cbb3ec25SBjoern A. Zeeb 
567*cbb3ec25SBjoern A. Zeeb /* PHYRX CTRL */
568*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_BAND_BASE			0x83080000
569*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_BAND(_band, ofs)		(MT_WF_PHYRX_BAND_BASE + \
570*cbb3ec25SBjoern A. Zeeb 						 ((_band) << 20) + (ofs))
571*cbb3ec25SBjoern A. Zeeb 
572*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_BAND_GID_TAB_VLD0(_band)	MT_WF_PHYRX_BAND(_band, 0x1054)
573*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_BAND_GID_TAB_VLD1(_band)	MT_WF_PHYRX_BAND(_band, 0x1058)
574*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_BAND_GID_TAB_POS0(_band)	MT_WF_PHYRX_BAND(_band, 0x105c)
575*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_BAND_GID_TAB_POS1(_band)	MT_WF_PHYRX_BAND(_band, 0x1060)
576*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_BAND_GID_TAB_POS2(_band)	MT_WF_PHYRX_BAND(_band, 0x1064)
577*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_BAND_GID_TAB_POS3(_band)	MT_WF_PHYRX_BAND(_band, 0x1068)
578*cbb3ec25SBjoern A. Zeeb 
579*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_BAND_RX_CTRL1(_band)	MT_WF_PHYRX_BAND(_band, 0x2004)
580*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_BAND_RX_CTRL1_IPI_EN	GENMASK(2, 0)
581*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_BAND_RX_CTRL1_STSCNT_EN	GENMASK(11, 9)
582*cbb3ec25SBjoern A. Zeeb 
583*cbb3ec25SBjoern A. Zeeb /* PHYRX CSD BAND */
584*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_CSD_BAND_RXTD12(_band)		MT_WF_PHYRX_BAND(_band, 0x8230)
585*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_CSD_BAND_RXTD12_IRPI_SW_CLR_ONLY	BIT(18)
586*cbb3ec25SBjoern A. Zeeb #define MT_WF_PHYRX_CSD_BAND_RXTD12_IRPI_SW_CLR		BIT(29)
587*cbb3ec25SBjoern A. Zeeb 
588*cbb3ec25SBjoern A. Zeeb /* CONN MCU EXCP CON */
589*cbb3ec25SBjoern A. Zeeb #define MT_MCU_WM_EXCP_BASE			0x89050000
590*cbb3ec25SBjoern A. Zeeb #define MT_MCU_WM_EXCP(ofs)			(MT_MCU_WM_EXCP_BASE + (ofs))
591*cbb3ec25SBjoern A. Zeeb #define MT_MCU_WM_EXCP_PC_CTRL			MT_MCU_WM_EXCP(0x100)
592*cbb3ec25SBjoern A. Zeeb #define MT_MCU_WM_EXCP_PC_LOG			MT_MCU_WM_EXCP(0x104)
593*cbb3ec25SBjoern A. Zeeb #define MT_MCU_WM_EXCP_LR_CTRL			MT_MCU_WM_EXCP(0x200)
594*cbb3ec25SBjoern A. Zeeb #define MT_MCU_WM_EXCP_LR_LOG			MT_MCU_WM_EXCP(0x204)
595*cbb3ec25SBjoern A. Zeeb 
596*cbb3ec25SBjoern A. Zeeb #endif
597