xref: /openbmc/linux/drivers/net/wireless/mediatek/mt7601u/regs.h (revision 05db221e30a924f5f80cbef34eb9f210522ceb84)
1c869f77dSJakub Kicinski /*
2c869f77dSJakub Kicinski  * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
3c869f77dSJakub Kicinski  * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
4c869f77dSJakub Kicinski  *
5c869f77dSJakub Kicinski  * This program is free software; you can redistribute it and/or modify
6c869f77dSJakub Kicinski  * it under the terms of the GNU General Public License version 2
7c869f77dSJakub Kicinski  * as published by the Free Software Foundation
8c869f77dSJakub Kicinski  *
9c869f77dSJakub Kicinski  * This program is distributed in the hope that it will be useful,
10c869f77dSJakub Kicinski  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11c869f77dSJakub Kicinski  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12c869f77dSJakub Kicinski  * GNU General Public License for more details.
13c869f77dSJakub Kicinski  */
14c869f77dSJakub Kicinski 
15c869f77dSJakub Kicinski #ifndef __MT76_REGS_H
16c869f77dSJakub Kicinski #define __MT76_REGS_H
17c869f77dSJakub Kicinski 
18c869f77dSJakub Kicinski #include <linux/bitops.h>
19c869f77dSJakub Kicinski 
20c869f77dSJakub Kicinski #define MT_ASIC_VERSION			0x0000
21c869f77dSJakub Kicinski 
22c869f77dSJakub Kicinski #define MT76XX_REV_E3		0x22
23c869f77dSJakub Kicinski #define MT76XX_REV_E4		0x33
24c869f77dSJakub Kicinski 
25c869f77dSJakub Kicinski #define MT_CMB_CTRL			0x0020
26c869f77dSJakub Kicinski #define MT_CMB_CTRL_XTAL_RDY		BIT(22)
27c869f77dSJakub Kicinski #define MT_CMB_CTRL_PLL_LD		BIT(23)
28c869f77dSJakub Kicinski 
29c869f77dSJakub Kicinski #define MT_EFUSE_CTRL			0x0024
30c869f77dSJakub Kicinski #define MT_EFUSE_CTRL_AOUT		GENMASK(5, 0)
31c869f77dSJakub Kicinski #define MT_EFUSE_CTRL_MODE		GENMASK(7, 6)
32c869f77dSJakub Kicinski #define MT_EFUSE_CTRL_LDO_OFF_TIME	GENMASK(13, 8)
33c869f77dSJakub Kicinski #define MT_EFUSE_CTRL_LDO_ON_TIME	GENMASK(15, 14)
34c869f77dSJakub Kicinski #define MT_EFUSE_CTRL_AIN		GENMASK(25, 16)
35c869f77dSJakub Kicinski #define MT_EFUSE_CTRL_KICK		BIT(30)
36c869f77dSJakub Kicinski #define MT_EFUSE_CTRL_SEL		BIT(31)
37c869f77dSJakub Kicinski 
38c869f77dSJakub Kicinski #define MT_EFUSE_DATA_BASE		0x0028
39c869f77dSJakub Kicinski #define MT_EFUSE_DATA(_n)		(MT_EFUSE_DATA_BASE + ((_n) << 2))
40c869f77dSJakub Kicinski 
41c869f77dSJakub Kicinski #define MT_COEXCFG0			0x0040
42c869f77dSJakub Kicinski #define MT_COEXCFG0_COEX_EN		BIT(0)
43c869f77dSJakub Kicinski 
44c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL		0x0080
45c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_WLAN_EN	BIT(0)
46c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_WLAN_CLK_EN	BIT(1)
47c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_WLAN_RESET_RF	BIT(2)
48c869f77dSJakub Kicinski 
49c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_WLAN_RESET	BIT(3) /* MT76x0 */
50c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_CSR_F20M_CKEN	BIT(3) /* MT76x2 */
51c869f77dSJakub Kicinski 
52c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_PCIE_CLK_REQ	BIT(4)
53c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_FRC_WL_ANT_SEL	BIT(5)
54c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_INV_ANT_SEL	BIT(6)
55c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_WAKE_HOST	BIT(7)
56c869f77dSJakub Kicinski 
57c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_THERM_RST	BIT(8) /* MT76x2 */
58c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_THERM_CKEN	BIT(9) /* MT76x2 */
59c869f77dSJakub Kicinski 
60c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_GPIO_IN	GENMASK(15, 8) /* MT76x0 */
61c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_GPIO_OUT	GENMASK(23, 16) /* MT76x0 */
62c869f77dSJakub Kicinski #define MT_WLAN_FUN_CTRL_GPIO_OUT_EN	GENMASK(31, 24) /* MT76x0 */
63c869f77dSJakub Kicinski 
64c869f77dSJakub Kicinski #define MT_XO_CTRL0			0x0100
65c869f77dSJakub Kicinski #define MT_XO_CTRL1			0x0104
66c869f77dSJakub Kicinski #define MT_XO_CTRL2			0x0108
67c869f77dSJakub Kicinski #define MT_XO_CTRL3			0x010c
68c869f77dSJakub Kicinski #define MT_XO_CTRL4			0x0110
69c869f77dSJakub Kicinski 
70c869f77dSJakub Kicinski #define MT_XO_CTRL5			0x0114
71c869f77dSJakub Kicinski #define MT_XO_CTRL5_C2_VAL		GENMASK(14, 8)
72c869f77dSJakub Kicinski 
73c869f77dSJakub Kicinski #define MT_XO_CTRL6			0x0118
74c869f77dSJakub Kicinski #define MT_XO_CTRL6_C2_CTRL		GENMASK(14, 8)
75c869f77dSJakub Kicinski 
76c869f77dSJakub Kicinski #define MT_XO_CTRL7			0x011c
77c869f77dSJakub Kicinski 
78c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL		0x10148
79c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_MTCMOS_PWR_UP	BIT(0)
80c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_PWR_ACK	BIT(12)
81c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_PWR_ACK_S	BIT(13)
82c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_BBP_MEM_PD	GENMASK(19, 16)
83c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_PBF_MEM_PD	BIT(20)
84c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_FCE_MEM_PD	BIT(21)
85c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_TSO_MEM_PD	BIT(22)
86c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_BBP_MEM_RB	BIT(24)
87c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_PBF_MEM_RB	BIT(25)
88c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_FCE_MEM_RB	BIT(26)
89c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_TSO_MEM_RB	BIT(27)
90c869f77dSJakub Kicinski #define MT_WLAN_MTC_CTRL_STATE_UP	BIT(28)
91c869f77dSJakub Kicinski 
92c869f77dSJakub Kicinski #define MT_INT_SOURCE_CSR		0x0200
93c869f77dSJakub Kicinski #define MT_INT_MASK_CSR			0x0204
94c869f77dSJakub Kicinski 
95c869f77dSJakub Kicinski #define MT_INT_RX_DONE(_n)		BIT(_n)
96c869f77dSJakub Kicinski #define MT_INT_RX_DONE_ALL		GENMASK(1, 0)
97c869f77dSJakub Kicinski #define MT_INT_TX_DONE_ALL		GENMASK(13, 4)
98c869f77dSJakub Kicinski #define MT_INT_TX_DONE(_n)		BIT(_n + 4)
99c869f77dSJakub Kicinski #define MT_INT_RX_COHERENT		BIT(16)
100c869f77dSJakub Kicinski #define MT_INT_TX_COHERENT		BIT(17)
101c869f77dSJakub Kicinski #define MT_INT_ANY_COHERENT		BIT(18)
102c869f77dSJakub Kicinski #define MT_INT_MCU_CMD			BIT(19)
103c869f77dSJakub Kicinski #define MT_INT_TBTT			BIT(20)
104c869f77dSJakub Kicinski #define MT_INT_PRE_TBTT			BIT(21)
105c869f77dSJakub Kicinski #define MT_INT_TX_STAT			BIT(22)
106c869f77dSJakub Kicinski #define MT_INT_AUTO_WAKEUP		BIT(23)
107c869f77dSJakub Kicinski #define MT_INT_GPTIMER			BIT(24)
108c869f77dSJakub Kicinski #define MT_INT_RXDELAYINT		BIT(26)
109c869f77dSJakub Kicinski #define MT_INT_TXDELAYINT		BIT(27)
110c869f77dSJakub Kicinski 
111c869f77dSJakub Kicinski #define MT_WPDMA_GLO_CFG		0x0208
112c869f77dSJakub Kicinski #define MT_WPDMA_GLO_CFG_TX_DMA_EN	BIT(0)
113c869f77dSJakub Kicinski #define MT_WPDMA_GLO_CFG_TX_DMA_BUSY	BIT(1)
114c869f77dSJakub Kicinski #define MT_WPDMA_GLO_CFG_RX_DMA_EN	BIT(2)
115c869f77dSJakub Kicinski #define MT_WPDMA_GLO_CFG_RX_DMA_BUSY	BIT(3)
116c869f77dSJakub Kicinski #define MT_WPDMA_GLO_CFG_DMA_BURST_SIZE	GENMASK(5, 4)
117c869f77dSJakub Kicinski #define MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE	BIT(6)
118c869f77dSJakub Kicinski #define MT_WPDMA_GLO_CFG_BIG_ENDIAN	BIT(7)
119c869f77dSJakub Kicinski #define MT_WPDMA_GLO_CFG_HDR_SEG_LEN	GENMASK(15, 8)
120c869f77dSJakub Kicinski #define MT_WPDMA_GLO_CFG_CLK_GATE_DIS	BIT(30)
121c869f77dSJakub Kicinski #define MT_WPDMA_GLO_CFG_RX_2B_OFFSET	BIT(31)
122c869f77dSJakub Kicinski 
123c869f77dSJakub Kicinski #define MT_WPDMA_RST_IDX		0x020c
124c869f77dSJakub Kicinski 
125c869f77dSJakub Kicinski #define MT_WPDMA_DELAY_INT_CFG		0x0210
126c869f77dSJakub Kicinski 
127c869f77dSJakub Kicinski #define MT_WMM_AIFSN		0x0214
128c869f77dSJakub Kicinski #define MT_WMM_AIFSN_MASK		GENMASK(3, 0)
129c869f77dSJakub Kicinski #define MT_WMM_AIFSN_SHIFT(_n)		((_n) * 4)
130c869f77dSJakub Kicinski 
131c869f77dSJakub Kicinski #define MT_WMM_CWMIN		0x0218
132c869f77dSJakub Kicinski #define MT_WMM_CWMIN_MASK		GENMASK(3, 0)
133c869f77dSJakub Kicinski #define MT_WMM_CWMIN_SHIFT(_n)		((_n) * 4)
134c869f77dSJakub Kicinski 
135c869f77dSJakub Kicinski #define MT_WMM_CWMAX		0x021c
136c869f77dSJakub Kicinski #define MT_WMM_CWMAX_MASK		GENMASK(3, 0)
137c869f77dSJakub Kicinski #define MT_WMM_CWMAX_SHIFT(_n)		((_n) * 4)
138c869f77dSJakub Kicinski 
139c869f77dSJakub Kicinski #define MT_WMM_TXOP_BASE		0x0220
140c869f77dSJakub Kicinski #define MT_WMM_TXOP(_n)			(MT_WMM_TXOP_BASE + (((_n) / 2) << 2))
141c869f77dSJakub Kicinski #define MT_WMM_TXOP_SHIFT(_n)		((_n & 1) * 16)
142c869f77dSJakub Kicinski #define MT_WMM_TXOP_MASK		GENMASK(15, 0)
143c869f77dSJakub Kicinski 
144c869f77dSJakub Kicinski #define MT_FCE_DMA_ADDR			0x0230
145c869f77dSJakub Kicinski #define MT_FCE_DMA_LEN			0x0234
146c869f77dSJakub Kicinski 
147c869f77dSJakub Kicinski #define MT_USB_DMA_CFG			0x238
148c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_RX_BULK_AGG_TOUT	GENMASK(7, 0)
149c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_RX_BULK_AGG_LMT	GENMASK(15, 8)
150c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_PHY_CLR		BIT(16)
151c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_TX_CLR		BIT(19)
152c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_TXOP_HALT	BIT(20)
153c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_RX_BULK_AGG_EN	BIT(21)
154c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_RX_BULK_EN	BIT(22)
155c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_TX_BULK_EN	BIT(23)
156c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_UDMA_RX_WL_DROP	BIT(25)
157c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_EP_OUT_VALID	GENMASK(29, 27)
158c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_RX_BUSY		BIT(30)
159c869f77dSJakub Kicinski #define MT_USB_DMA_CFG_TX_BUSY		BIT(31)
160c869f77dSJakub Kicinski 
161c869f77dSJakub Kicinski #define MT_TSO_CTRL			0x0250
162c869f77dSJakub Kicinski #define MT_HEADER_TRANS_CTRL_REG	0x0260
163c869f77dSJakub Kicinski 
164c869f77dSJakub Kicinski #define MT_US_CYC_CFG			0x02a4
165c869f77dSJakub Kicinski #define MT_US_CYC_CNT			GENMASK(7, 0)
166c869f77dSJakub Kicinski 
167c869f77dSJakub Kicinski #define MT_TX_RING_BASE			0x0300
168c869f77dSJakub Kicinski #define MT_RX_RING_BASE			0x03c0
169c869f77dSJakub Kicinski #define MT_RING_SIZE			0x10
170c869f77dSJakub Kicinski 
171c869f77dSJakub Kicinski #define MT_TX_HW_QUEUE_MCU		8
172c869f77dSJakub Kicinski #define MT_TX_HW_QUEUE_MGMT		9
173c869f77dSJakub Kicinski 
174c869f77dSJakub Kicinski #define MT_PBF_SYS_CTRL			0x0400
175c869f77dSJakub Kicinski #define MT_PBF_SYS_CTRL_MCU_RESET	BIT(0)
176c869f77dSJakub Kicinski #define MT_PBF_SYS_CTRL_DMA_RESET	BIT(1)
177c869f77dSJakub Kicinski #define MT_PBF_SYS_CTRL_MAC_RESET	BIT(2)
178c869f77dSJakub Kicinski #define MT_PBF_SYS_CTRL_PBF_RESET	BIT(3)
179c869f77dSJakub Kicinski #define MT_PBF_SYS_CTRL_ASY_RESET	BIT(4)
180c869f77dSJakub Kicinski 
181c869f77dSJakub Kicinski #define MT_PBF_CFG			0x0404
182c869f77dSJakub Kicinski #define MT_PBF_CFG_TX0Q_EN		BIT(0)
183c869f77dSJakub Kicinski #define MT_PBF_CFG_TX1Q_EN		BIT(1)
184c869f77dSJakub Kicinski #define MT_PBF_CFG_TX2Q_EN		BIT(2)
185c869f77dSJakub Kicinski #define MT_PBF_CFG_TX3Q_EN		BIT(3)
186c869f77dSJakub Kicinski #define MT_PBF_CFG_RX0Q_EN		BIT(4)
187c869f77dSJakub Kicinski #define MT_PBF_CFG_RX_DROP_EN		BIT(8)
188c869f77dSJakub Kicinski 
189c869f77dSJakub Kicinski #define MT_PBF_TX_MAX_PCNT		0x0408
190c869f77dSJakub Kicinski #define MT_PBF_RX_MAX_PCNT		0x040c
191c869f77dSJakub Kicinski 
192c869f77dSJakub Kicinski #define MT_BCN_OFFSET_BASE		0x041c
193c869f77dSJakub Kicinski #define MT_BCN_OFFSET(_n)		(MT_BCN_OFFSET_BASE + ((_n) << 2))
194c869f77dSJakub Kicinski 
195*05db221eSAnthony Romano #define MT_RXQ_STA			0x0430
196*05db221eSAnthony Romano #define MT_TXQ_STA			0x0434
197*05db221eSAnthony Romano 
198c869f77dSJakub Kicinski #define	MT_RF_CSR_CFG			0x0500
199c869f77dSJakub Kicinski #define MT_RF_CSR_CFG_DATA		GENMASK(7, 0)
200c869f77dSJakub Kicinski #define MT_RF_CSR_CFG_REG_ID		GENMASK(13, 8)
201c869f77dSJakub Kicinski #define MT_RF_CSR_CFG_REG_BANK		GENMASK(17, 14)
202c869f77dSJakub Kicinski #define MT_RF_CSR_CFG_WR		BIT(30)
203c869f77dSJakub Kicinski #define MT_RF_CSR_CFG_KICK		BIT(31)
204c869f77dSJakub Kicinski 
205c869f77dSJakub Kicinski #define MT_RF_BYPASS_0			0x0504
206c869f77dSJakub Kicinski #define MT_RF_BYPASS_1			0x0508
207c869f77dSJakub Kicinski #define MT_RF_SETTING_0			0x050c
208c869f77dSJakub Kicinski 
209c869f77dSJakub Kicinski #define MT_RF_DATA_WRITE		0x0524
210c869f77dSJakub Kicinski 
211c869f77dSJakub Kicinski #define MT_RF_CTRL			0x0528
212c869f77dSJakub Kicinski #define MT_RF_CTRL_ADDR			GENMASK(11, 0)
213c869f77dSJakub Kicinski #define MT_RF_CTRL_WRITE		BIT(12)
214c869f77dSJakub Kicinski #define MT_RF_CTRL_BUSY			BIT(13)
215c869f77dSJakub Kicinski #define MT_RF_CTRL_IDX			BIT(16)
216c869f77dSJakub Kicinski 
217c869f77dSJakub Kicinski #define MT_RF_DATA_READ			0x052c
218c869f77dSJakub Kicinski 
219c869f77dSJakub Kicinski #define MT_FCE_PSE_CTRL			0x0800
220c869f77dSJakub Kicinski #define MT_FCE_PARAMETERS		0x0804
221c869f77dSJakub Kicinski #define MT_FCE_CSO			0x0808
222c869f77dSJakub Kicinski 
223c869f77dSJakub Kicinski #define MT_FCE_L2_STUFF			0x080c
224c869f77dSJakub Kicinski #define MT_FCE_L2_STUFF_HT_L2_EN	BIT(0)
225c869f77dSJakub Kicinski #define MT_FCE_L2_STUFF_QOS_L2_EN	BIT(1)
226c869f77dSJakub Kicinski #define MT_FCE_L2_STUFF_RX_STUFF_EN	BIT(2)
227c869f77dSJakub Kicinski #define MT_FCE_L2_STUFF_TX_STUFF_EN	BIT(3)
228c869f77dSJakub Kicinski #define MT_FCE_L2_STUFF_WR_MPDU_LEN_EN	BIT(4)
229c869f77dSJakub Kicinski #define MT_FCE_L2_STUFF_MVINV_BSWAP	BIT(5)
230c869f77dSJakub Kicinski #define MT_FCE_L2_STUFF_TS_CMD_QSEL_EN	GENMASK(15, 8)
231c869f77dSJakub Kicinski #define MT_FCE_L2_STUFF_TS_LEN_EN	GENMASK(23, 16)
232c869f77dSJakub Kicinski #define MT_FCE_L2_STUFF_OTHER_PORT	GENMASK(25, 24)
233c869f77dSJakub Kicinski 
234c869f77dSJakub Kicinski #define MT_FCE_WLAN_FLOW_CONTROL1	0x0824
235c869f77dSJakub Kicinski 
236c869f77dSJakub Kicinski #define MT_TX_CPU_FROM_FCE_BASE_PTR	0x09a0
237c869f77dSJakub Kicinski #define MT_TX_CPU_FROM_FCE_MAX_COUNT	0x09a4
238c869f77dSJakub Kicinski #define MT_TX_CPU_FROM_FCE_CPU_DESC_IDX	0x09a8
239c869f77dSJakub Kicinski 
240c869f77dSJakub Kicinski #define MT_FCE_PDMA_GLOBAL_CONF		0x09c4
241c869f77dSJakub Kicinski 
242c869f77dSJakub Kicinski #define MT_PAUSE_ENABLE_CONTROL1	0x0a38
243c869f77dSJakub Kicinski 
244c869f77dSJakub Kicinski #define MT_FCE_SKIP_FS			0x0a6c
245c869f77dSJakub Kicinski 
246c869f77dSJakub Kicinski #define MT_MAC_CSR0			0x1000
247c869f77dSJakub Kicinski 
248c869f77dSJakub Kicinski #define MT_MAC_SYS_CTRL			0x1004
249c869f77dSJakub Kicinski #define MT_MAC_SYS_CTRL_RESET_CSR	BIT(0)
250c869f77dSJakub Kicinski #define MT_MAC_SYS_CTRL_RESET_BBP	BIT(1)
251c869f77dSJakub Kicinski #define MT_MAC_SYS_CTRL_ENABLE_TX	BIT(2)
252c869f77dSJakub Kicinski #define MT_MAC_SYS_CTRL_ENABLE_RX	BIT(3)
253c869f77dSJakub Kicinski 
254c869f77dSJakub Kicinski #define MT_MAC_ADDR_DW0			0x1008
255c869f77dSJakub Kicinski #define MT_MAC_ADDR_DW1			0x100c
256c869f77dSJakub Kicinski #define MT_MAC_ADDR_DW1_U2ME_MASK	GENMASK(23, 16)
257c869f77dSJakub Kicinski 
258c869f77dSJakub Kicinski #define MT_MAC_BSSID_DW0		0x1010
259c869f77dSJakub Kicinski #define MT_MAC_BSSID_DW1		0x1014
260c869f77dSJakub Kicinski #define MT_MAC_BSSID_DW1_ADDR		GENMASK(15, 0)
261c869f77dSJakub Kicinski #define MT_MAC_BSSID_DW1_MBSS_MODE	GENMASK(17, 16)
262c869f77dSJakub Kicinski #define MT_MAC_BSSID_DW1_MBEACON_N	GENMASK(20, 18)
263c869f77dSJakub Kicinski #define MT_MAC_BSSID_DW1_MBSS_LOCAL_BIT	BIT(21)
264c869f77dSJakub Kicinski #define MT_MAC_BSSID_DW1_MBSS_MODE_B2	BIT(22)
265c869f77dSJakub Kicinski #define MT_MAC_BSSID_DW1_MBEACON_N_B3	BIT(23)
266c869f77dSJakub Kicinski #define MT_MAC_BSSID_DW1_MBSS_IDX_BYTE	GENMASK(26, 24)
267c869f77dSJakub Kicinski 
268c869f77dSJakub Kicinski #define MT_MAX_LEN_CFG			0x1018
269c869f77dSJakub Kicinski #define MT_MAX_LEN_CFG_AMPDU		GENMASK(13, 12)
270c869f77dSJakub Kicinski 
271c869f77dSJakub Kicinski #define MT_BBP_CSR_CFG			0x101c
272c869f77dSJakub Kicinski #define MT_BBP_CSR_CFG_VAL		GENMASK(7, 0)
273c869f77dSJakub Kicinski #define MT_BBP_CSR_CFG_REG_NUM		GENMASK(15, 8)
274c869f77dSJakub Kicinski #define MT_BBP_CSR_CFG_READ		BIT(16)
275c869f77dSJakub Kicinski #define MT_BBP_CSR_CFG_BUSY		BIT(17)
276c869f77dSJakub Kicinski #define MT_BBP_CSR_CFG_PAR_DUR		BIT(18)
277c869f77dSJakub Kicinski #define MT_BBP_CSR_CFG_RW_MODE		BIT(19)
278c869f77dSJakub Kicinski 
279c869f77dSJakub Kicinski #define MT_AMPDU_MAX_LEN_20M1S		0x1030
280c869f77dSJakub Kicinski #define MT_AMPDU_MAX_LEN_20M2S		0x1034
281c869f77dSJakub Kicinski #define MT_AMPDU_MAX_LEN_40M1S		0x1038
282c869f77dSJakub Kicinski #define MT_AMPDU_MAX_LEN_40M2S		0x103c
283c869f77dSJakub Kicinski #define MT_AMPDU_MAX_LEN		0x1040
284c869f77dSJakub Kicinski 
285c869f77dSJakub Kicinski #define MT_WCID_DROP_BASE		0x106c
286c869f77dSJakub Kicinski #define MT_WCID_DROP(_n)		(MT_WCID_DROP_BASE + ((_n) >> 5) * 4)
287c869f77dSJakub Kicinski #define MT_WCID_DROP_MASK(_n)		BIT((_n) % 32)
288c869f77dSJakub Kicinski 
289c869f77dSJakub Kicinski #define MT_BCN_BYPASS_MASK		0x108c
290c869f77dSJakub Kicinski 
291c869f77dSJakub Kicinski #define MT_MAC_APC_BSSID_BASE		0x1090
292c869f77dSJakub Kicinski #define MT_MAC_APC_BSSID_L(_n)		(MT_MAC_APC_BSSID_BASE + ((_n) * 8))
293c869f77dSJakub Kicinski #define MT_MAC_APC_BSSID_H(_n)		(MT_MAC_APC_BSSID_BASE + ((_n) * 8 + 4))
294c869f77dSJakub Kicinski #define MT_MAC_APC_BSSID_H_ADDR		GENMASK(15, 0)
295c869f77dSJakub Kicinski #define MT_MAC_APC_BSSID0_H_EN		BIT(16)
296c869f77dSJakub Kicinski 
297c869f77dSJakub Kicinski #define MT_XIFS_TIME_CFG		0x1100
298c869f77dSJakub Kicinski #define MT_XIFS_TIME_CFG_CCK_SIFS	GENMASK(7, 0)
299c869f77dSJakub Kicinski #define MT_XIFS_TIME_CFG_OFDM_SIFS	GENMASK(15, 8)
300c869f77dSJakub Kicinski #define MT_XIFS_TIME_CFG_OFDM_XIFS	GENMASK(19, 16)
301c869f77dSJakub Kicinski #define MT_XIFS_TIME_CFG_EIFS		GENMASK(28, 20)
302c869f77dSJakub Kicinski #define MT_XIFS_TIME_CFG_BB_RXEND_EN	BIT(29)
303c869f77dSJakub Kicinski 
304c869f77dSJakub Kicinski #define MT_BKOFF_SLOT_CFG		0x1104
305c869f77dSJakub Kicinski #define MT_BKOFF_SLOT_CFG_SLOTTIME	GENMASK(7, 0)
306c869f77dSJakub Kicinski #define MT_BKOFF_SLOT_CFG_CC_DELAY	GENMASK(11, 8)
307c869f77dSJakub Kicinski 
308c869f77dSJakub Kicinski #define MT_BEACON_TIME_CFG		0x1114
309c869f77dSJakub Kicinski #define MT_BEACON_TIME_CFG_INTVAL	GENMASK(15, 0)
310c869f77dSJakub Kicinski #define MT_BEACON_TIME_CFG_TIMER_EN	BIT(16)
311c869f77dSJakub Kicinski #define MT_BEACON_TIME_CFG_SYNC_MODE	GENMASK(18, 17)
312c869f77dSJakub Kicinski #define MT_BEACON_TIME_CFG_TBTT_EN	BIT(19)
313c869f77dSJakub Kicinski #define MT_BEACON_TIME_CFG_BEACON_TX	BIT(20)
314c869f77dSJakub Kicinski #define MT_BEACON_TIME_CFG_TSF_COMP	GENMASK(31, 24)
315c869f77dSJakub Kicinski 
316c869f77dSJakub Kicinski #define MT_TBTT_SYNC_CFG		0x1118
317c869f77dSJakub Kicinski #define MT_TBTT_TIMER_CFG		0x1124
318c869f77dSJakub Kicinski 
319c869f77dSJakub Kicinski #define MT_INT_TIMER_CFG		0x1128
320c869f77dSJakub Kicinski #define MT_INT_TIMER_CFG_PRE_TBTT	GENMASK(15, 0)
321c869f77dSJakub Kicinski #define MT_INT_TIMER_CFG_GP_TIMER	GENMASK(31, 16)
322c869f77dSJakub Kicinski 
323c869f77dSJakub Kicinski #define MT_INT_TIMER_EN			0x112c
324c869f77dSJakub Kicinski #define MT_INT_TIMER_EN_PRE_TBTT_EN	BIT(0)
325c869f77dSJakub Kicinski #define MT_INT_TIMER_EN_GP_TIMER_EN	BIT(1)
326c869f77dSJakub Kicinski 
327c869f77dSJakub Kicinski #define MT_MAC_STATUS			0x1200
328c869f77dSJakub Kicinski #define MT_MAC_STATUS_TX		BIT(0)
329c869f77dSJakub Kicinski #define MT_MAC_STATUS_RX		BIT(1)
330c869f77dSJakub Kicinski 
331c869f77dSJakub Kicinski #define MT_PWR_PIN_CFG			0x1204
332c869f77dSJakub Kicinski #define MT_AUX_CLK_CFG			0x120c
333c869f77dSJakub Kicinski 
334c869f77dSJakub Kicinski #define MT_BB_PA_MODE_CFG0		0x1214
335c869f77dSJakub Kicinski #define MT_BB_PA_MODE_CFG1		0x1218
336c869f77dSJakub Kicinski #define MT_RF_PA_MODE_CFG0		0x121c
337c869f77dSJakub Kicinski #define MT_RF_PA_MODE_CFG1		0x1220
338c869f77dSJakub Kicinski 
339c869f77dSJakub Kicinski #define MT_RF_PA_MODE_ADJ0		0x1228
340c869f77dSJakub Kicinski #define MT_RF_PA_MODE_ADJ1		0x122c
341c869f77dSJakub Kicinski 
342c869f77dSJakub Kicinski #define MT_DACCLK_EN_DLY_CFG		0x1264
343c869f77dSJakub Kicinski 
344c869f77dSJakub Kicinski #define MT_EDCA_CFG_BASE		0x1300
345c869f77dSJakub Kicinski #define MT_EDCA_CFG_AC(_n)		(MT_EDCA_CFG_BASE + ((_n) << 2))
346c869f77dSJakub Kicinski #define MT_EDCA_CFG_TXOP		GENMASK(7, 0)
347c869f77dSJakub Kicinski #define MT_EDCA_CFG_AIFSN		GENMASK(11, 8)
348c869f77dSJakub Kicinski #define MT_EDCA_CFG_CWMIN		GENMASK(15, 12)
349c869f77dSJakub Kicinski #define MT_EDCA_CFG_CWMAX		GENMASK(19, 16)
350c869f77dSJakub Kicinski 
351c869f77dSJakub Kicinski #define MT_TX_PWR_CFG_0			0x1314
352c869f77dSJakub Kicinski #define MT_TX_PWR_CFG_1			0x1318
353c869f77dSJakub Kicinski #define MT_TX_PWR_CFG_2			0x131c
354c869f77dSJakub Kicinski #define MT_TX_PWR_CFG_3			0x1320
355c869f77dSJakub Kicinski #define MT_TX_PWR_CFG_4			0x1324
356c869f77dSJakub Kicinski 
357c869f77dSJakub Kicinski #define MT_TX_BAND_CFG			0x132c
358c869f77dSJakub Kicinski #define MT_TX_BAND_CFG_UPPER_40M	BIT(0)
359c869f77dSJakub Kicinski #define MT_TX_BAND_CFG_5G		BIT(1)
360c869f77dSJakub Kicinski #define MT_TX_BAND_CFG_2G		BIT(2)
361c869f77dSJakub Kicinski 
362c869f77dSJakub Kicinski #define MT_HT_FBK_TO_LEGACY		0x1384
363c869f77dSJakub Kicinski #define MT_TX_MPDU_ADJ_INT		0x1388
364c869f77dSJakub Kicinski 
365c869f77dSJakub Kicinski #define MT_TX_PWR_CFG_7			0x13d4
366c869f77dSJakub Kicinski #define MT_TX_PWR_CFG_8			0x13d8
367c869f77dSJakub Kicinski #define MT_TX_PWR_CFG_9			0x13dc
368c869f77dSJakub Kicinski 
369c869f77dSJakub Kicinski #define MT_TX_SW_CFG0			0x1330
370c869f77dSJakub Kicinski #define MT_TX_SW_CFG1			0x1334
371c869f77dSJakub Kicinski #define MT_TX_SW_CFG2			0x1338
372c869f77dSJakub Kicinski 
373c869f77dSJakub Kicinski #define MT_TXOP_CTRL_CFG		0x1340
374c869f77dSJakub Kicinski #define MT_TXOP_TRUN_EN			GENMASK(5, 0)
375c869f77dSJakub Kicinski #define MT_TXOP_EXT_CCA_DLY		GENMASK(15, 8)
376c869f77dSJakub Kicinski #define MT_TXOP_CTRL
377c869f77dSJakub Kicinski 
378c869f77dSJakub Kicinski #define MT_TX_RTS_CFG			0x1344
379c869f77dSJakub Kicinski #define MT_TX_RTS_CFG_RETRY_LIMIT	GENMASK(7, 0)
380c869f77dSJakub Kicinski #define MT_TX_RTS_CFG_THRESH		GENMASK(23, 8)
381c869f77dSJakub Kicinski #define MT_TX_RTS_FALLBACK		BIT(24)
382c869f77dSJakub Kicinski 
383c869f77dSJakub Kicinski #define MT_TX_TIMEOUT_CFG		0x1348
384c869f77dSJakub Kicinski #define MT_TX_RETRY_CFG			0x134c
385c869f77dSJakub Kicinski #define MT_TX_LINK_CFG			0x1350
386c869f77dSJakub Kicinski #define MT_HT_FBK_CFG0			0x1354
387c869f77dSJakub Kicinski #define MT_HT_FBK_CFG1			0x1358
388c869f77dSJakub Kicinski #define MT_LG_FBK_CFG0			0x135c
389c869f77dSJakub Kicinski #define MT_LG_FBK_CFG1			0x1360
390c869f77dSJakub Kicinski 
391c869f77dSJakub Kicinski #define MT_CCK_PROT_CFG			0x1364
392c869f77dSJakub Kicinski #define MT_OFDM_PROT_CFG		0x1368
393c869f77dSJakub Kicinski #define MT_MM20_PROT_CFG		0x136c
394c869f77dSJakub Kicinski #define MT_MM40_PROT_CFG		0x1370
395c869f77dSJakub Kicinski #define MT_GF20_PROT_CFG		0x1374
396c869f77dSJakub Kicinski #define MT_GF40_PROT_CFG		0x1378
397c869f77dSJakub Kicinski 
398c869f77dSJakub Kicinski #define MT_PROT_RATE			GENMASK(15, 0)
399c869f77dSJakub Kicinski #define MT_PROT_CTRL_RTS_CTS		BIT(16)
400c869f77dSJakub Kicinski #define MT_PROT_CTRL_CTS2SELF		BIT(17)
401c869f77dSJakub Kicinski #define MT_PROT_NAV_SHORT		BIT(18)
402c869f77dSJakub Kicinski #define MT_PROT_NAV_LONG		BIT(19)
403c869f77dSJakub Kicinski #define MT_PROT_TXOP_ALLOW_CCK		BIT(20)
404c869f77dSJakub Kicinski #define MT_PROT_TXOP_ALLOW_OFDM		BIT(21)
405c869f77dSJakub Kicinski #define MT_PROT_TXOP_ALLOW_MM20		BIT(22)
406c869f77dSJakub Kicinski #define MT_PROT_TXOP_ALLOW_MM40		BIT(23)
407c869f77dSJakub Kicinski #define MT_PROT_TXOP_ALLOW_GF20		BIT(24)
408c869f77dSJakub Kicinski #define MT_PROT_TXOP_ALLOW_GF40		BIT(25)
409c869f77dSJakub Kicinski #define MT_PROT_RTS_THR_EN		BIT(26)
410c869f77dSJakub Kicinski #define MT_PROT_RATE_CCK_11		0x0003
411c869f77dSJakub Kicinski #define MT_PROT_RATE_OFDM_6		0x4000
412c869f77dSJakub Kicinski #define MT_PROT_RATE_OFDM_24		0x4004
413c869f77dSJakub Kicinski #define MT_PROT_RATE_DUP_OFDM_24	0x4084
414c869f77dSJakub Kicinski #define MT_PROT_TXOP_ALLOW_ALL		GENMASK(25, 20)
415c869f77dSJakub Kicinski #define MT_PROT_TXOP_ALLOW_BW20		(MT_PROT_TXOP_ALLOW_ALL &	\
416c869f77dSJakub Kicinski 					 ~MT_PROT_TXOP_ALLOW_MM40 &	\
417c869f77dSJakub Kicinski 					 ~MT_PROT_TXOP_ALLOW_GF40)
418c869f77dSJakub Kicinski 
419c869f77dSJakub Kicinski #define MT_EXP_ACK_TIME			0x1380
420c869f77dSJakub Kicinski 
421c869f77dSJakub Kicinski #define MT_TX_PWR_CFG_0_EXT		0x1390
422c869f77dSJakub Kicinski #define MT_TX_PWR_CFG_1_EXT		0x1394
423c869f77dSJakub Kicinski 
424c869f77dSJakub Kicinski #define MT_TX_FBK_LIMIT			0x1398
425c869f77dSJakub Kicinski #define MT_TX_FBK_LIMIT_MPDU_FBK	GENMASK(7, 0)
426c869f77dSJakub Kicinski #define MT_TX_FBK_LIMIT_AMPDU_FBK	GENMASK(15, 8)
427c869f77dSJakub Kicinski #define MT_TX_FBK_LIMIT_MPDU_UP_CLEAR	BIT(16)
428c869f77dSJakub Kicinski #define MT_TX_FBK_LIMIT_AMPDU_UP_CLEAR	BIT(17)
429c869f77dSJakub Kicinski #define MT_TX_FBK_LIMIT_RATE_LUT	BIT(18)
430c869f77dSJakub Kicinski 
431c869f77dSJakub Kicinski #define MT_TX0_RF_GAIN_CORR		0x13a0
432c869f77dSJakub Kicinski #define MT_TX1_RF_GAIN_CORR		0x13a4
433c869f77dSJakub Kicinski #define MT_TX0_RF_GAIN_ATTEN		0x13a8
434c869f77dSJakub Kicinski 
435c869f77dSJakub Kicinski #define MT_TX_ALC_CFG_0			0x13b0
436c869f77dSJakub Kicinski #define MT_TX_ALC_CFG_0_CH_INIT_0	GENMASK(5, 0)
437c869f77dSJakub Kicinski #define MT_TX_ALC_CFG_0_CH_INIT_1	GENMASK(13, 8)
438c869f77dSJakub Kicinski #define MT_TX_ALC_CFG_0_LIMIT_0		GENMASK(21, 16)
439c869f77dSJakub Kicinski #define MT_TX_ALC_CFG_0_LIMIT_1		GENMASK(29, 24)
440c869f77dSJakub Kicinski 
441c869f77dSJakub Kicinski #define MT_TX_ALC_CFG_1			0x13b4
442c869f77dSJakub Kicinski #define MT_TX_ALC_CFG_1_TEMP_COMP	GENMASK(5, 0)
443c869f77dSJakub Kicinski 
444c869f77dSJakub Kicinski #define MT_TX_ALC_CFG_2			0x13a8
445c869f77dSJakub Kicinski #define MT_TX_ALC_CFG_2_TEMP_COMP	GENMASK(5, 0)
446c869f77dSJakub Kicinski 
447c869f77dSJakub Kicinski #define MT_TX0_BB_GAIN_ATTEN		0x13c0
448c869f77dSJakub Kicinski 
449c869f77dSJakub Kicinski #define MT_TX_ALC_VGA3			0x13c8
450c869f77dSJakub Kicinski 
451c869f77dSJakub Kicinski #define MT_TX_PROT_CFG6			0x13e0
452c869f77dSJakub Kicinski #define MT_TX_PROT_CFG7			0x13e4
453c869f77dSJakub Kicinski #define MT_TX_PROT_CFG8			0x13e8
454c869f77dSJakub Kicinski 
455c869f77dSJakub Kicinski #define MT_PIFS_TX_CFG			0x13ec
456c869f77dSJakub Kicinski 
457c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG			0x1400
458c869f77dSJakub Kicinski 
459c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_CRC_ERR		BIT(0)
460c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_PHY_ERR		BIT(1)
461c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_PROMISC		BIT(2)
462c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_OTHER_BSS	BIT(3)
463c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_VER_ERR		BIT(4)
464c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_MCAST		BIT(5)
465c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_BCAST		BIT(6)
466c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_DUP		BIT(7)
467c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_CFACK		BIT(8)
468c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_CFEND		BIT(9)
469c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_ACK		BIT(10)
470c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_CTS		BIT(11)
471c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_RTS		BIT(12)
472c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_PSPOLL		BIT(13)
473c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_BA		BIT(14)
474c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_BAR		BIT(15)
475c869f77dSJakub Kicinski #define MT_RX_FILTR_CFG_CTRL_RSV	BIT(16)
476c869f77dSJakub Kicinski 
477c869f77dSJakub Kicinski #define MT_AUTO_RSP_CFG			0x1404
478c869f77dSJakub Kicinski 
479c869f77dSJakub Kicinski #define MT_AUTO_RSP_PREAMB_SHORT	BIT(4)
480c869f77dSJakub Kicinski 
481c869f77dSJakub Kicinski #define MT_LEGACY_BASIC_RATE		0x1408
482c869f77dSJakub Kicinski #define MT_HT_BASIC_RATE		0x140c
483c869f77dSJakub Kicinski 
484c869f77dSJakub Kicinski #define MT_RX_PARSER_CFG		0x1418
485c869f77dSJakub Kicinski #define MT_RX_PARSER_RX_SET_NAV_ALL	BIT(0)
486c869f77dSJakub Kicinski 
487c869f77dSJakub Kicinski #define MT_EXT_CCA_CFG			0x141c
488c869f77dSJakub Kicinski #define MT_EXT_CCA_CFG_CCA0		GENMASK(1, 0)
489c869f77dSJakub Kicinski #define MT_EXT_CCA_CFG_CCA1		GENMASK(3, 2)
490c869f77dSJakub Kicinski #define MT_EXT_CCA_CFG_CCA2		GENMASK(5, 4)
491c869f77dSJakub Kicinski #define MT_EXT_CCA_CFG_CCA3		GENMASK(7, 6)
492c869f77dSJakub Kicinski #define MT_EXT_CCA_CFG_CCA_MASK		GENMASK(11, 8)
493c869f77dSJakub Kicinski #define MT_EXT_CCA_CFG_ED_CCA_MASK	GENMASK(15, 12)
494c869f77dSJakub Kicinski 
495c869f77dSJakub Kicinski #define MT_TX_SW_CFG3			0x1478
496c869f77dSJakub Kicinski 
497c869f77dSJakub Kicinski #define MT_PN_PAD_MODE			0x150c
498c869f77dSJakub Kicinski 
499c869f77dSJakub Kicinski #define MT_TXOP_HLDR_ET			0x1608
500c869f77dSJakub Kicinski 
501c869f77dSJakub Kicinski #define MT_PROT_AUTO_TX_CFG		0x1648
502c869f77dSJakub Kicinski 
503c869f77dSJakub Kicinski #define MT_RX_STA_CNT0			0x1700
504c869f77dSJakub Kicinski #define MT_RX_STA_CNT1			0x1704
505c869f77dSJakub Kicinski #define MT_RX_STA_CNT2			0x1708
506c869f77dSJakub Kicinski #define MT_TX_STA_CNT0			0x170c
507c869f77dSJakub Kicinski #define MT_TX_STA_CNT1			0x1710
508c869f77dSJakub Kicinski #define MT_TX_STA_CNT2			0x1714
509c869f77dSJakub Kicinski 
510c869f77dSJakub Kicinski /* Vendor driver defines content of the second word of STAT_FIFO as follows:
511c869f77dSJakub Kicinski  *	MT_TX_STAT_FIFO_RATE		GENMASK(26, 16)
512c869f77dSJakub Kicinski  *	MT_TX_STAT_FIFO_ETXBF		BIT(27)
513c869f77dSJakub Kicinski  *	MT_TX_STAT_FIFO_SND		BIT(28)
514c869f77dSJakub Kicinski  *	MT_TX_STAT_FIFO_ITXBF		BIT(29)
515c869f77dSJakub Kicinski  * However, tests show that b16-31 have the same layout as TXWI rate_ctl
516c869f77dSJakub Kicinski  * with rate set to rate at which frame was acked.
517c869f77dSJakub Kicinski  */
518c869f77dSJakub Kicinski #define MT_TX_STAT_FIFO			0x1718
519c869f77dSJakub Kicinski #define MT_TX_STAT_FIFO_VALID		BIT(0)
520c869f77dSJakub Kicinski #define MT_TX_STAT_FIFO_PID_TYPE	GENMASK(4, 1)
521c869f77dSJakub Kicinski #define MT_TX_STAT_FIFO_SUCCESS		BIT(5)
522c869f77dSJakub Kicinski #define MT_TX_STAT_FIFO_AGGR		BIT(6)
523c869f77dSJakub Kicinski #define MT_TX_STAT_FIFO_ACKREQ		BIT(7)
524c869f77dSJakub Kicinski #define MT_TX_STAT_FIFO_WCID		GENMASK(15, 8)
525c869f77dSJakub Kicinski #define MT_TX_STAT_FIFO_RATE		GENMASK(31, 16)
526c869f77dSJakub Kicinski 
527c869f77dSJakub Kicinski #define MT_TX_AGG_STAT			0x171c
528c869f77dSJakub Kicinski 
529c869f77dSJakub Kicinski #define MT_TX_AGG_CNT_BASE0		0x1720
530c869f77dSJakub Kicinski 
531c869f77dSJakub Kicinski #define MT_MPDU_DENSITY_CNT		0x1740
532c869f77dSJakub Kicinski 
533c869f77dSJakub Kicinski #define MT_TX_AGG_CNT_BASE1		0x174c
534c869f77dSJakub Kicinski 
535c869f77dSJakub Kicinski #define MT_TX_AGG_CNT(_id)		((_id) < 8 ?			\
536c869f77dSJakub Kicinski 					 MT_TX_AGG_CNT_BASE0 + ((_id) << 2) : \
537c869f77dSJakub Kicinski 					 MT_TX_AGG_CNT_BASE1 + ((_id - 8) << 2))
538c869f77dSJakub Kicinski 
539c869f77dSJakub Kicinski #define MT_TX_STAT_FIFO_EXT		0x1798
540c869f77dSJakub Kicinski #define MT_TX_STAT_FIFO_EXT_RETRY	GENMASK(7, 0)
541c869f77dSJakub Kicinski 
542c869f77dSJakub Kicinski #define MT_BBP_CORE_BASE		0x2000
543c869f77dSJakub Kicinski #define MT_BBP_IBI_BASE			0x2100
544c869f77dSJakub Kicinski #define MT_BBP_AGC_BASE			0x2300
545c869f77dSJakub Kicinski #define MT_BBP_TXC_BASE			0x2400
546c869f77dSJakub Kicinski #define MT_BBP_RXC_BASE			0x2500
547c869f77dSJakub Kicinski #define MT_BBP_TXO_BASE			0x2600
548c869f77dSJakub Kicinski #define MT_BBP_TXBE_BASE		0x2700
549c869f77dSJakub Kicinski #define MT_BBP_RXFE_BASE		0x2800
550c869f77dSJakub Kicinski #define MT_BBP_RXO_BASE			0x2900
551c869f77dSJakub Kicinski #define MT_BBP_DFS_BASE			0x2a00
552c869f77dSJakub Kicinski #define MT_BBP_TR_BASE			0x2b00
553c869f77dSJakub Kicinski #define MT_BBP_CAL_BASE			0x2c00
554c869f77dSJakub Kicinski #define MT_BBP_DSC_BASE			0x2e00
555c869f77dSJakub Kicinski #define MT_BBP_PFMU_BASE		0x2f00
556c869f77dSJakub Kicinski 
557c869f77dSJakub Kicinski #define MT_BBP(_type, _n)		(MT_BBP_##_type##_BASE + ((_n) << 2))
558c869f77dSJakub Kicinski 
559c869f77dSJakub Kicinski #define MT_BBP_CORE_R1_BW		GENMASK(4, 3)
560c869f77dSJakub Kicinski 
561c869f77dSJakub Kicinski #define MT_BBP_AGC_R0_CTRL_CHAN		GENMASK(9, 8)
562c869f77dSJakub Kicinski #define MT_BBP_AGC_R0_BW		GENMASK(14, 12)
563c869f77dSJakub Kicinski 
564c869f77dSJakub Kicinski /* AGC, R4/R5 */
565c869f77dSJakub Kicinski #define MT_BBP_AGC_LNA_GAIN		GENMASK(21, 16)
566c869f77dSJakub Kicinski 
567c869f77dSJakub Kicinski /* AGC, R8/R9 */
568c869f77dSJakub Kicinski #define MT_BBP_AGC_GAIN			GENMASK(14, 8)
569c869f77dSJakub Kicinski 
570c869f77dSJakub Kicinski #define MT_BBP_AGC20_RSSI0		GENMASK(7, 0)
571c869f77dSJakub Kicinski #define MT_BBP_AGC20_RSSI1		GENMASK(15, 8)
572c869f77dSJakub Kicinski 
573c869f77dSJakub Kicinski #define MT_BBP_TXBE_R0_CTRL_CHAN	GENMASK(1, 0)
574c869f77dSJakub Kicinski 
575c869f77dSJakub Kicinski #define MT_WCID_ADDR_BASE		0x1800
576c869f77dSJakub Kicinski #define MT_WCID_ADDR(_n)		(MT_WCID_ADDR_BASE + (_n) * 8)
577c869f77dSJakub Kicinski 
578c869f77dSJakub Kicinski #define MT_SRAM_BASE			0x4000
579c869f77dSJakub Kicinski 
580c869f77dSJakub Kicinski #define MT_WCID_KEY_BASE		0x8000
581c869f77dSJakub Kicinski #define MT_WCID_KEY(_n)			(MT_WCID_KEY_BASE + (_n) * 32)
582c869f77dSJakub Kicinski 
583c869f77dSJakub Kicinski #define MT_WCID_IV_BASE			0xa000
584c869f77dSJakub Kicinski #define MT_WCID_IV(_n)			(MT_WCID_IV_BASE + (_n) * 8)
585c869f77dSJakub Kicinski 
586c869f77dSJakub Kicinski #define MT_WCID_ATTR_BASE		0xa800
587c869f77dSJakub Kicinski #define MT_WCID_ATTR(_n)		(MT_WCID_ATTR_BASE + (_n) * 4)
588c869f77dSJakub Kicinski 
589c869f77dSJakub Kicinski #define MT_WCID_ATTR_PAIRWISE		BIT(0)
590c869f77dSJakub Kicinski #define MT_WCID_ATTR_PKEY_MODE		GENMASK(3, 1)
591c869f77dSJakub Kicinski #define MT_WCID_ATTR_BSS_IDX		GENMASK(6, 4)
592c869f77dSJakub Kicinski #define MT_WCID_ATTR_RXWI_UDF		GENMASK(9, 7)
593c869f77dSJakub Kicinski #define MT_WCID_ATTR_PKEY_MODE_EXT	BIT(10)
594c869f77dSJakub Kicinski #define MT_WCID_ATTR_BSS_IDX_EXT	BIT(11)
595c869f77dSJakub Kicinski #define MT_WCID_ATTR_WAPI_MCBC		BIT(15)
596c869f77dSJakub Kicinski #define MT_WCID_ATTR_WAPI_KEYID		GENMASK(31, 24)
597c869f77dSJakub Kicinski 
598c869f77dSJakub Kicinski #define MT_SKEY_BASE_0			0xac00
599c869f77dSJakub Kicinski #define MT_SKEY_BASE_1			0xb400
600c869f77dSJakub Kicinski #define MT_SKEY_0(_bss, _idx)		\
601c869f77dSJakub Kicinski 	(MT_SKEY_BASE_0 + (4 * (_bss) + _idx) * 32)
602c869f77dSJakub Kicinski #define MT_SKEY_1(_bss, _idx)		\
603c869f77dSJakub Kicinski 	(MT_SKEY_BASE_1 + (4 * ((_bss) & 7) + _idx) * 32)
604c869f77dSJakub Kicinski #define MT_SKEY(_bss, _idx)		\
605c869f77dSJakub Kicinski 	((_bss & 8) ? MT_SKEY_1(_bss, _idx) : MT_SKEY_0(_bss, _idx))
606c869f77dSJakub Kicinski 
607c869f77dSJakub Kicinski #define MT_SKEY_MODE_BASE_0		0xb000
608c869f77dSJakub Kicinski #define MT_SKEY_MODE_BASE_1		0xb3f0
609c869f77dSJakub Kicinski #define MT_SKEY_MODE_0(_bss)		\
610c869f77dSJakub Kicinski 	(MT_SKEY_MODE_BASE_0 + ((_bss / 2) << 2))
611c869f77dSJakub Kicinski #define MT_SKEY_MODE_1(_bss)		\
612c869f77dSJakub Kicinski 	(MT_SKEY_MODE_BASE_1 + ((((_bss) & 7) / 2) << 2))
613c869f77dSJakub Kicinski #define MT_SKEY_MODE(_bss)		\
614c869f77dSJakub Kicinski 	((_bss & 8) ? MT_SKEY_MODE_1(_bss) : MT_SKEY_MODE_0(_bss))
615c869f77dSJakub Kicinski #define MT_SKEY_MODE_MASK		GENMASK(3, 0)
616c869f77dSJakub Kicinski #define MT_SKEY_MODE_SHIFT(_bss, _idx)	(4 * ((_idx) + 4 * (_bss & 1)))
617c869f77dSJakub Kicinski 
618c869f77dSJakub Kicinski #define MT_BEACON_BASE			0xc000
619c869f77dSJakub Kicinski 
620c869f77dSJakub Kicinski #define MT_TEMP_SENSOR			0x1d000
621c869f77dSJakub Kicinski #define MT_TEMP_SENSOR_VAL		GENMASK(6, 0)
622c869f77dSJakub Kicinski 
623c869f77dSJakub Kicinski enum mt76_cipher_type {
624c869f77dSJakub Kicinski 	MT_CIPHER_NONE,
625c869f77dSJakub Kicinski 	MT_CIPHER_WEP40,
626c869f77dSJakub Kicinski 	MT_CIPHER_WEP104,
627c869f77dSJakub Kicinski 	MT_CIPHER_TKIP,
628c869f77dSJakub Kicinski 	MT_CIPHER_AES_CCMP,
629c869f77dSJakub Kicinski 	MT_CIPHER_CKIP40,
630c869f77dSJakub Kicinski 	MT_CIPHER_CKIP104,
631c869f77dSJakub Kicinski 	MT_CIPHER_CKIP128,
632c869f77dSJakub Kicinski 	MT_CIPHER_WAPI,
633c869f77dSJakub Kicinski };
634c869f77dSJakub Kicinski 
635c869f77dSJakub Kicinski #endif
636