1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#ifndef __MT76x2_REGS_H
18#define __MT76x2_REGS_H
19
20#define MT_ASIC_VERSION 0x0000
21
22#define MT76XX_REV_E3 0x22
23#define MT76XX_REV_E4 0x33
24
25#define MT_CMB_CTRL 0x0020
26#define MT_CMB_CTRL_XTAL_RDY BIT(22)
27#define MT_CMB_CTRL_PLL_LD BIT(23)
28
29#define MT_EFUSE_CTRL 0x0024
30#define MT_EFUSE_CTRL_AOUT GENMASK(5, 0)
31#define MT_EFUSE_CTRL_MODE GENMASK(7, 6)
32#define MT_EFUSE_CTRL_LDO_OFF_TIME GENMASK(13, 8)
33#define MT_EFUSE_CTRL_LDO_ON_TIME GENMASK(15, 14)
34#define MT_EFUSE_CTRL_AIN GENMASK(25, 16)
35#define MT_EFUSE_CTRL_KICK BIT(30)
36#define MT_EFUSE_CTRL_SEL BIT(31)
37
38#define MT_EFUSE_DATA_BASE 0x0028
39#define MT_EFUSE_DATA(_n) (MT_EFUSE_DATA_BASE + ((_n) << 2))
40
41#define MT_COEXCFG0 0x0040
42#define MT_COEXCFG0_COEX_EN BIT(0)
43
44#define MT_WLAN_FUN_CTRL 0x0080
45#define MT_WLAN_FUN_CTRL_WLAN_EN BIT(0)
46#define MT_WLAN_FUN_CTRL_WLAN_CLK_EN BIT(1)
47#define MT_WLAN_FUN_CTRL_WLAN_RESET_RF BIT(2)
48
49#define MT_WLAN_FUN_CTRL_WLAN_RESET BIT(3)
50#define MT_WLAN_FUN_CTRL_CSR_F20M_CKEN BIT(3)
51
52#define MT_WLAN_FUN_CTRL_PCIE_CLK_REQ BIT(4)
53#define MT_WLAN_FUN_CTRL_FRC_WL_ANT_SEL BIT(5)
54#define MT_WLAN_FUN_CTRL_INV_ANT_SEL BIT(6)
55#define MT_WLAN_FUN_CTRL_WAKE_HOST BIT(7)
56
57#define MT_WLAN_FUN_CTRL_THERM_RST BIT(8)
58#define MT_WLAN_FUN_CTRL_THERM_CKEN BIT(9)
59
60#define MT_WLAN_FUN_CTRL_GPIO_IN GENMASK(15, 8)
61#define MT_WLAN_FUN_CTRL_GPIO_OUT GENMASK(23, 16)
62#define MT_WLAN_FUN_CTRL_GPIO_OUT_EN GENMASK(31, 24)
63
64#define MT_XO_CTRL0 0x0100
65#define MT_XO_CTRL1 0x0104
66#define MT_XO_CTRL2 0x0108
67#define MT_XO_CTRL3 0x010c
68#define MT_XO_CTRL4 0x0110
69
70#define MT_XO_CTRL5 0x0114
71#define MT_XO_CTRL5_C2_VAL GENMASK(14, 8)
72
73#define MT_XO_CTRL6 0x0118
74#define MT_XO_CTRL6_C2_CTRL GENMASK(14, 8)
75
76#define MT_XO_CTRL7 0x011c
77
78#define MT_WLAN_MTC_CTRL 0x10148
79#define MT_WLAN_MTC_CTRL_MTCMOS_PWR_UP BIT(0)
80#define MT_WLAN_MTC_CTRL_PWR_ACK BIT(12)
81#define MT_WLAN_MTC_CTRL_PWR_ACK_S BIT(13)
82#define MT_WLAN_MTC_CTRL_BBP_MEM_PD GENMASK(19, 16)
83#define MT_WLAN_MTC_CTRL_PBF_MEM_PD BIT(20)
84#define MT_WLAN_MTC_CTRL_FCE_MEM_PD BIT(21)
85#define MT_WLAN_MTC_CTRL_TSO_MEM_PD BIT(22)
86#define MT_WLAN_MTC_CTRL_BBP_MEM_RB BIT(24)
87#define MT_WLAN_MTC_CTRL_PBF_MEM_RB BIT(25)
88#define MT_WLAN_MTC_CTRL_FCE_MEM_RB BIT(26)
89#define MT_WLAN_MTC_CTRL_TSO_MEM_RB BIT(27)
90#define MT_WLAN_MTC_CTRL_STATE_UP BIT(28)
91
92#define MT_INT_SOURCE_CSR 0x0200
93#define MT_INT_MASK_CSR 0x0204
94
95#define MT_INT_RX_DONE(_n) BIT(_n)
96#define MT_INT_RX_DONE_ALL GENMASK(1, 0)
97#define MT_INT_TX_DONE_ALL GENMASK(13, 4)
98#define MT_INT_TX_DONE(_n) BIT(_n + 4)
99#define MT_INT_RX_COHERENT BIT(16)
100#define MT_INT_TX_COHERENT BIT(17)
101#define MT_INT_ANY_COHERENT BIT(18)
102#define MT_INT_MCU_CMD BIT(19)
103#define MT_INT_TBTT BIT(20)
104#define MT_INT_PRE_TBTT BIT(21)
105#define MT_INT_TX_STAT BIT(22)
106#define MT_INT_AUTO_WAKEUP BIT(23)
107#define MT_INT_GPTIMER BIT(24)
108#define MT_INT_RXDELAYINT BIT(26)
109#define MT_INT_TXDELAYINT BIT(27)
110
111#define MT_WPDMA_GLO_CFG 0x0208
112#define MT_WPDMA_GLO_CFG_TX_DMA_EN BIT(0)
113#define MT_WPDMA_GLO_CFG_TX_DMA_BUSY BIT(1)
114#define MT_WPDMA_GLO_CFG_RX_DMA_EN BIT(2)
115#define MT_WPDMA_GLO_CFG_RX_DMA_BUSY BIT(3)
116#define MT_WPDMA_GLO_CFG_DMA_BURST_SIZE GENMASK(5, 4)
117#define MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE BIT(6)
118#define MT_WPDMA_GLO_CFG_BIG_ENDIAN BIT(7)
119#define MT_WPDMA_GLO_CFG_HDR_SEG_LEN GENMASK(15, 8)
120#define MT_WPDMA_GLO_CFG_CLK_GATE_DIS BIT(30)
121#define MT_WPDMA_GLO_CFG_RX_2B_OFFSET BIT(31)
122
123#define MT_WPDMA_RST_IDX 0x020c
124
125#define MT_WPDMA_DELAY_INT_CFG 0x0210
126
127#define MT_WMM_AIFSN 0x0214
128#define MT_WMM_AIFSN_MASK GENMASK(3, 0)
129#define MT_WMM_AIFSN_SHIFT(_n) ((_n) * 4)
130
131#define MT_WMM_CWMIN 0x0218
132#define MT_WMM_CWMIN_MASK GENMASK(3, 0)
133#define MT_WMM_CWMIN_SHIFT(_n) ((_n) * 4)
134
135#define MT_WMM_CWMAX 0x021c
136#define MT_WMM_CWMAX_MASK GENMASK(3, 0)
137#define MT_WMM_CWMAX_SHIFT(_n) ((_n) * 4)
138
139#define MT_WMM_TXOP_BASE 0x0220
140#define MT_WMM_TXOP(_n) (MT_WMM_TXOP_BASE + (((_n) / 2) << 2))
141#define MT_WMM_TXOP_SHIFT(_n) ((_n & 1) * 16)
142#define MT_WMM_TXOP_MASK GENMASK(15, 0)
143
144#define MT_TSO_CTRL 0x0250
145#define MT_HEADER_TRANS_CTRL_REG 0x0260
146
147#define MT_TX_RING_BASE 0x0300
148#define MT_RX_RING_BASE 0x03c0
149
150#define MT_TX_HW_QUEUE_MCU 8
151#define MT_TX_HW_QUEUE_MGMT 9
152
153#define MT_PBF_SYS_CTRL 0x0400
154#define MT_PBF_SYS_CTRL_MCU_RESET BIT(0)
155#define MT_PBF_SYS_CTRL_DMA_RESET BIT(1)
156#define MT_PBF_SYS_CTRL_MAC_RESET BIT(2)
157#define MT_PBF_SYS_CTRL_PBF_RESET BIT(3)
158#define MT_PBF_SYS_CTRL_ASY_RESET BIT(4)
159
160#define MT_PBF_CFG 0x0404
161#define MT_PBF_CFG_TX0Q_EN BIT(0)
162#define MT_PBF_CFG_TX1Q_EN BIT(1)
163#define MT_PBF_CFG_TX2Q_EN BIT(2)
164#define MT_PBF_CFG_TX3Q_EN BIT(3)
165#define MT_PBF_CFG_RX0Q_EN BIT(4)
166#define MT_PBF_CFG_RX_DROP_EN BIT(8)
167
168#define MT_PBF_TX_MAX_PCNT 0x0408
169#define MT_PBF_RX_MAX_PCNT 0x040c
170
171#define MT_BCN_OFFSET_BASE 0x041c
172#define MT_BCN_OFFSET(_n) (MT_BCN_OFFSET_BASE + ((_n) << 2))
173
174#define MT_RF_BYPASS_0 0x0504
175#define MT_RF_BYPASS_1 0x0508
176#define MT_RF_SETTING_0 0x050c
177
178#define MT_RF_DATA_WRITE 0x0524
179
180#define MT_RF_CTRL 0x0528
181#define MT_RF_CTRL_ADDR GENMASK(11, 0)
182#define MT_RF_CTRL_WRITE BIT(12)
183#define MT_RF_CTRL_BUSY BIT(13)
184#define MT_RF_CTRL_IDX BIT(16)
185
186#define MT_RF_DATA_READ 0x052c
187
188#define MT_FCE_PSE_CTRL 0x0800
189#define MT_FCE_PARAMETERS 0x0804
190#define MT_FCE_CSO 0x0808
191
192#define MT_FCE_L2_STUFF 0x080c
193#define MT_FCE_L2_STUFF_HT_L2_EN BIT(0)
194#define MT_FCE_L2_STUFF_QOS_L2_EN BIT(1)
195#define MT_FCE_L2_STUFF_RX_STUFF_EN BIT(2)
196#define MT_FCE_L2_STUFF_TX_STUFF_EN BIT(3)
197#define MT_FCE_L2_STUFF_WR_MPDU_LEN_EN BIT(4)
198#define MT_FCE_L2_STUFF_MVINV_BSWAP BIT(5)
199#define MT_FCE_L2_STUFF_TS_CMD_QSEL_EN GENMASK(15, 8)
200#define MT_FCE_L2_STUFF_TS_LEN_EN GENMASK(23, 16)
201#define MT_FCE_L2_STUFF_OTHER_PORT GENMASK(25, 24)
202
203#define MT_FCE_WLAN_FLOW_CONTROL1 0x0824
204
205#define MT_PAUSE_ENABLE_CONTROL1 0x0a38
206
207#define MT_MAC_CSR0 0x1000
208
209#define MT_MAC_SYS_CTRL 0x1004
210#define MT_MAC_SYS_CTRL_RESET_CSR BIT(0)
211#define MT_MAC_SYS_CTRL_RESET_BBP BIT(1)
212#define MT_MAC_SYS_CTRL_ENABLE_TX BIT(2)
213#define MT_MAC_SYS_CTRL_ENABLE_RX BIT(3)
214
215#define MT_MAC_ADDR_DW0 0x1008
216#define MT_MAC_ADDR_DW1 0x100c
217
218#define MT_MAC_BSSID_DW0 0x1010
219#define MT_MAC_BSSID_DW1 0x1014
220#define MT_MAC_BSSID_DW1_ADDR GENMASK(15, 0)
221#define MT_MAC_BSSID_DW1_MBSS_MODE GENMASK(17, 16)
222#define MT_MAC_BSSID_DW1_MBEACON_N GENMASK(20, 18)
223#define MT_MAC_BSSID_DW1_MBSS_LOCAL_BIT BIT(21)
224#define MT_MAC_BSSID_DW1_MBSS_MODE_B2 BIT(22)
225#define MT_MAC_BSSID_DW1_MBEACON_N_B3 BIT(23)
226#define MT_MAC_BSSID_DW1_MBSS_IDX_BYTE GENMASK(26, 24)
227
228#define MT_MAX_LEN_CFG 0x1018
229
230#define MT_AMPDU_MAX_LEN_20M1S 0x1030
231#define MT_AMPDU_MAX_LEN_20M2S 0x1034
232#define MT_AMPDU_MAX_LEN_40M1S 0x1038
233#define MT_AMPDU_MAX_LEN_40M2S 0x103c
234#define MT_AMPDU_MAX_LEN 0x1040
235
236#define MT_WCID_DROP_BASE 0x106c
237#define MT_WCID_DROP(_n) (MT_WCID_DROP_BASE + ((_n) >> 5) * 4)
238#define MT_WCID_DROP_MASK(_n) BIT((_n) % 32)
239
240#define MT_BCN_BYPASS_MASK 0x108c
241
242#define MT_MAC_APC_BSSID_BASE 0x1090
243#define MT_MAC_APC_BSSID_L(_n) (MT_MAC_APC_BSSID_BASE + ((_n) * 8))
244#define MT_MAC_APC_BSSID_H(_n) (MT_MAC_APC_BSSID_BASE + ((_n) * 8 + 4))
245#define MT_MAC_APC_BSSID_H_ADDR GENMASK(15, 0)
246#define MT_MAC_APC_BSSID0_H_EN BIT(16)
247
248#define MT_XIFS_TIME_CFG 0x1100
249#define MT_XIFS_TIME_CFG_CCK_SIFS GENMASK(7, 0)
250#define MT_XIFS_TIME_CFG_OFDM_SIFS GENMASK(15, 8)
251#define MT_XIFS_TIME_CFG_OFDM_XIFS GENMASK(19, 16)
252#define MT_XIFS_TIME_CFG_EIFS GENMASK(28, 20)
253#define MT_XIFS_TIME_CFG_BB_RXEND_EN BIT(29)
254
255#define MT_BKOFF_SLOT_CFG 0x1104
256#define MT_BKOFF_SLOT_CFG_SLOTTIME GENMASK(7, 0)
257#define MT_BKOFF_SLOT_CFG_CC_DELAY GENMASK(11, 8)
258
259#define MT_CH_TIME_CFG 0x110c
260#define MT_CH_TIME_CFG_TIMER_EN BIT(0)
261#define MT_CH_TIME_CFG_TX_AS_BUSY BIT(1)
262#define MT_CH_TIME_CFG_RX_AS_BUSY BIT(2)
263#define MT_CH_TIME_CFG_NAV_AS_BUSY BIT(3)
264#define MT_CH_TIME_CFG_EIFS_AS_BUSY BIT(4)
265#define MT_CH_TIME_CFG_MDRDY_CNT_EN BIT(5)
266#define MT_CH_TIME_CFG_CH_TIMER_CLR GENMASK(9, 8)
267#define MT_CH_TIME_CFG_MDRDY_CLR GENMASK(11, 10)
268
269#define MT_PBF_LIFE_TIMER 0x1110
270
271#define MT_BEACON_TIME_CFG 0x1114
272#define MT_BEACON_TIME_CFG_INTVAL GENMASK(15, 0)
273#define MT_BEACON_TIME_CFG_TIMER_EN BIT(16)
274#define MT_BEACON_TIME_CFG_SYNC_MODE GENMASK(18, 17)
275#define MT_BEACON_TIME_CFG_TBTT_EN BIT(19)
276#define MT_BEACON_TIME_CFG_BEACON_TX BIT(20)
277#define MT_BEACON_TIME_CFG_TSF_COMP GENMASK(31, 24)
278
279#define MT_TBTT_SYNC_CFG 0x1118
280#define MT_TBTT_TIMER_CFG 0x1124
281
282#define MT_INT_TIMER_CFG 0x1128
283#define MT_INT_TIMER_CFG_PRE_TBTT GENMASK(15, 0)
284#define MT_INT_TIMER_CFG_GP_TIMER GENMASK(31, 16)
285
286#define MT_INT_TIMER_EN 0x112c
287#define MT_INT_TIMER_EN_PRE_TBTT_EN BIT(0)
288#define MT_INT_TIMER_EN_GP_TIMER_EN BIT(1)
289
290#define MT_CH_IDLE 0x1130
291#define MT_CH_BUSY 0x1134
292#define MT_EXT_CH_BUSY 0x1138
293#define MT_ED_CCA_TIMER 0x1140
294
295#define MT_MAC_STATUS 0x1200
296#define MT_MAC_STATUS_TX BIT(0)
297#define MT_MAC_STATUS_RX BIT(1)
298
299#define MT_PWR_PIN_CFG 0x1204
300#define MT_AUX_CLK_CFG 0x120c
301
302#define MT_BB_PA_MODE_CFG0 0x1214
303#define MT_BB_PA_MODE_CFG1 0x1218
304#define MT_RF_PA_MODE_CFG0 0x121c
305#define MT_RF_PA_MODE_CFG1 0x1220
306
307#define MT_RF_PA_MODE_ADJ0 0x1228
308#define MT_RF_PA_MODE_ADJ1 0x122c
309
310#define MT_DACCLK_EN_DLY_CFG 0x1264
311
312#define MT_EDCA_CFG_BASE 0x1300
313#define MT_EDCA_CFG_AC(_n) (MT_EDCA_CFG_BASE + ((_n) << 2))
314#define MT_EDCA_CFG_TXOP GENMASK(7, 0)
315#define MT_EDCA_CFG_AIFSN GENMASK(11, 8)
316#define MT_EDCA_CFG_CWMIN GENMASK(15, 12)
317#define MT_EDCA_CFG_CWMAX GENMASK(19, 16)
318
319#define MT_TX_PWR_CFG_0 0x1314
320#define MT_TX_PWR_CFG_1 0x1318
321#define MT_TX_PWR_CFG_2 0x131c
322#define MT_TX_PWR_CFG_3 0x1320
323#define MT_TX_PWR_CFG_4 0x1324
324#define MT_TX_PIN_CFG 0x1328
325#define MT_TX_PIN_CFG_TXANT GENMASK(3, 0)
326
327#define MT_TX_BAND_CFG 0x132c
328#define MT_TX_BAND_CFG_UPPER_40M BIT(0)
329#define MT_TX_BAND_CFG_5G BIT(1)
330#define MT_TX_BAND_CFG_2G BIT(2)
331
332#define MT_HT_FBK_TO_LEGACY 0x1384
333#define MT_TX_MPDU_ADJ_INT 0x1388
334
335#define MT_TX_PWR_CFG_7 0x13d4
336#define MT_TX_PWR_CFG_8 0x13d8
337#define MT_TX_PWR_CFG_9 0x13dc
338
339#define MT_TX_SW_CFG0 0x1330
340#define MT_TX_SW_CFG1 0x1334
341#define MT_TX_SW_CFG2 0x1338
342
343#define MT_TXOP_CTRL_CFG 0x1340
344
345#define MT_TX_RTS_CFG 0x1344
346#define MT_TX_RTS_CFG_RETRY_LIMIT GENMASK(7, 0)
347#define MT_TX_RTS_CFG_THRESH GENMASK(23, 8)
348#define MT_TX_RTS_FALLBACK BIT(24)
349
350#define MT_TX_TIMEOUT_CFG 0x1348
351#define MT_TX_TIMEOUT_CFG_ACKTO GENMASK(15, 8)
352
353#define MT_TX_RETRY_CFG 0x134c
354#define MT_VHT_HT_FBK_CFG1 0x1358
355
356#define MT_PROT_CFG_RATE GENMASK(15, 0)
357#define MT_PROT_CFG_CTRL GENMASK(17, 16)
358#define MT_PROT_CFG_NAV GENMASK(19, 18)
359#define MT_PROT_CFG_TXOP_ALLOW GENMASK(25, 20)
360#define MT_PROT_CFG_RTS_THRESH BIT(26)
361
362#define MT_CCK_PROT_CFG 0x1364
363#define MT_OFDM_PROT_CFG 0x1368
364#define MT_MM20_PROT_CFG 0x136c
365#define MT_MM40_PROT_CFG 0x1370
366#define MT_GF20_PROT_CFG 0x1374
367#define MT_GF40_PROT_CFG 0x1378
368
369#define MT_EXP_ACK_TIME 0x1380
370
371#define MT_TX_PWR_CFG_0_EXT 0x1390
372#define MT_TX_PWR_CFG_1_EXT 0x1394
373
374#define MT_TX_FBK_LIMIT 0x1398
375#define MT_TX_FBK_LIMIT_MPDU_FBK GENMASK(7, 0)
376#define MT_TX_FBK_LIMIT_AMPDU_FBK GENMASK(15, 8)
377#define MT_TX_FBK_LIMIT_MPDU_UP_CLEAR BIT(16)
378#define MT_TX_FBK_LIMIT_AMPDU_UP_CLEAR BIT(17)
379#define MT_TX_FBK_LIMIT_RATE_LUT BIT(18)
380
381#define MT_TX0_RF_GAIN_CORR 0x13a0
382#define MT_TX1_RF_GAIN_CORR 0x13a4
383
384#define MT_TX_ALC_CFG_0 0x13b0
385#define MT_TX_ALC_CFG_0_CH_INIT_0 GENMASK(5, 0)
386#define MT_TX_ALC_CFG_0_CH_INIT_1 GENMASK(13, 8)
387#define MT_TX_ALC_CFG_0_LIMIT_0 GENMASK(21, 16)
388#define MT_TX_ALC_CFG_0_LIMIT_1 GENMASK(29, 24)
389
390#define MT_TX_ALC_CFG_1 0x13b4
391#define MT_TX_ALC_CFG_1_TEMP_COMP GENMASK(5, 0)
392
393#define MT_TX_ALC_CFG_2 0x13a8
394#define MT_TX_ALC_CFG_2_TEMP_COMP GENMASK(5, 0)
395
396#define MT_TX_ALC_CFG_3 0x13ac
397#define MT_TX_ALC_CFG_4 0x13c0
398#define MT_TX_ALC_CFG_4_LOWGAIN_CH_EN BIT(31)
399
400#define MT_TX_ALC_VGA3 0x13c8
401
402#define MT_TX_PROT_CFG6 0x13e0
403#define MT_TX_PROT_CFG7 0x13e4
404#define MT_TX_PROT_CFG8 0x13e8
405
406#define MT_PIFS_TX_CFG 0x13ec
407
408#define MT_RX_FILTR_CFG 0x1400
409
410#define MT_RX_FILTR_CFG_CRC_ERR BIT(0)
411#define MT_RX_FILTR_CFG_PHY_ERR BIT(1)
412#define MT_RX_FILTR_CFG_PROMISC BIT(2)
413#define MT_RX_FILTR_CFG_OTHER_BSS BIT(3)
414#define MT_RX_FILTR_CFG_VER_ERR BIT(4)
415#define MT_RX_FILTR_CFG_MCAST BIT(5)
416#define MT_RX_FILTR_CFG_BCAST BIT(6)
417#define MT_RX_FILTR_CFG_DUP BIT(7)
418#define MT_RX_FILTR_CFG_CFACK BIT(8)
419#define MT_RX_FILTR_CFG_CFEND BIT(9)
420#define MT_RX_FILTR_CFG_ACK BIT(10)
421#define MT_RX_FILTR_CFG_CTS BIT(11)
422#define MT_RX_FILTR_CFG_RTS BIT(12)
423#define MT_RX_FILTR_CFG_PSPOLL BIT(13)
424#define MT_RX_FILTR_CFG_BA BIT(14)
425#define MT_RX_FILTR_CFG_BAR BIT(15)
426#define MT_RX_FILTR_CFG_CTRL_RSV BIT(16)
427
428#define MT_LEGACY_BASIC_RATE 0x1408
429#define MT_HT_BASIC_RATE 0x140c
430
431#define MT_HT_CTRL_CFG 0x1410
432
433#define MT_EXT_CCA_CFG 0x141c
434#define MT_EXT_CCA_CFG_CCA0 GENMASK(1, 0)
435#define MT_EXT_CCA_CFG_CCA1 GENMASK(3, 2)
436#define MT_EXT_CCA_CFG_CCA2 GENMASK(5, 4)
437#define MT_EXT_CCA_CFG_CCA3 GENMASK(7, 6)
438#define MT_EXT_CCA_CFG_CCA_MASK GENMASK(11, 8)
439#define MT_EXT_CCA_CFG_ED_CCA_MASK GENMASK(15, 12)
440
441#define MT_TX_SW_CFG3 0x1478
442
443#define MT_PN_PAD_MODE 0x150c
444
445#define MT_TXOP_HLDR_ET 0x1608
446
447#define MT_PROT_AUTO_TX_CFG 0x1648
448#define MT_PROT_AUTO_TX_CFG_PROT_PADJ GENMASK(11, 8)
449#define MT_PROT_AUTO_TX_CFG_AUTO_PADJ GENMASK(27, 24)
450
451#define MT_RX_STAT_0 0x1700
452#define MT_RX_STAT_0_CRC_ERRORS GENMASK(15, 0)
453#define MT_RX_STAT_0_PHY_ERRORS GENMASK(31, 16)
454
455#define MT_RX_STAT_1 0x1704
456#define MT_RX_STAT_1_CCA_ERRORS GENMASK(15, 0)
457#define MT_RX_STAT_1_PLCP_ERRORS GENMASK(31, 16)
458
459#define MT_RX_STAT_2 0x1708
460#define MT_RX_STAT_2_DUP_ERRORS GENMASK(15, 0)
461#define MT_RX_STAT_2_OVERFLOW_ERRORS GENMASK(31, 16)
462
463#define MT_TX_STAT_FIFO 0x1718
464#define MT_TX_STAT_FIFO_VALID BIT(0)
465#define MT_TX_STAT_FIFO_SUCCESS BIT(5)
466#define MT_TX_STAT_FIFO_AGGR BIT(6)
467#define MT_TX_STAT_FIFO_ACKREQ BIT(7)
468#define MT_TX_STAT_FIFO_WCID GENMASK(15, 8)
469#define MT_TX_STAT_FIFO_RATE GENMASK(31, 16)
470
471#define MT_TX_AGG_CNT_BASE0 0x1720
472#define MT_TX_AGG_CNT_BASE1 0x174c
473
474#define MT_TX_AGG_CNT(_id) ((_id) < 8 ? \
475 MT_TX_AGG_CNT_BASE0 + ((_id) << 2) : \
476 MT_TX_AGG_CNT_BASE1 + ((_id - 8) << 2))
477
478#define MT_TX_STAT_FIFO_EXT 0x1798
479#define MT_TX_STAT_FIFO_EXT_RETRY GENMASK(7, 0)
480#define MT_TX_STAT_FIFO_EXT_PKTID GENMASK(15, 8)
481
482#define MT_WCID_TX_RATE_BASE 0x1c00
483#define MT_WCID_TX_RATE(_i) (MT_WCID_TX_RATE_BASE + ((_i) << 3))
484
485#define MT_BBP_CORE_BASE 0x2000
486#define MT_BBP_IBI_BASE 0x2100
487#define MT_BBP_AGC_BASE 0x2300
488#define MT_BBP_TXC_BASE 0x2400
489#define MT_BBP_RXC_BASE 0x2500
490#define MT_BBP_TXO_BASE 0x2600
491#define MT_BBP_TXBE_BASE 0x2700
492#define MT_BBP_RXFE_BASE 0x2800
493#define MT_BBP_RXO_BASE 0x2900
494#define MT_BBP_DFS_BASE 0x2a00
495#define MT_BBP_TR_BASE 0x2b00
496#define MT_BBP_CAL_BASE 0x2c00
497#define MT_BBP_DSC_BASE 0x2e00
498#define MT_BBP_PFMU_BASE 0x2f00
499
500#define MT_BBP(_type, _n) (MT_BBP_##_type##_BASE + ((_n) << 2))
501
502#define MT_BBP_CORE_R1_BW GENMASK(4, 3)
503
504#define MT_BBP_AGC_R0_CTRL_CHAN GENMASK(9, 8)
505#define MT_BBP_AGC_R0_BW GENMASK(14, 12)
506
507
508#define MT_BBP_AGC_LNA_HIGH_GAIN GENMASK(21, 16)
509#define MT_BBP_AGC_LNA_MID_GAIN GENMASK(13, 8)
510#define MT_BBP_AGC_LNA_LOW_GAIN GENMASK(5, 0)
511
512
513#define MT_BBP_AGC_LNA_ULOW_GAIN GENMASK(5, 0)
514
515
516#define MT_BBP_AGC_LNA_GAIN_MODE GENMASK(7, 6)
517#define MT_BBP_AGC_GAIN GENMASK(14, 8)
518
519#define MT_BBP_AGC20_RSSI0 GENMASK(7, 0)
520#define MT_BBP_AGC20_RSSI1 GENMASK(15, 8)
521
522#define MT_BBP_TXBE_R0_CTRL_CHAN GENMASK(1, 0)
523
524#define MT_WCID_ADDR_BASE 0x1800
525#define MT_WCID_ADDR(_n) (MT_WCID_ADDR_BASE + (_n) * 8)
526
527#define MT_SRAM_BASE 0x4000
528
529#define MT_WCID_KEY_BASE 0x8000
530#define MT_WCID_KEY(_n) (MT_WCID_KEY_BASE + (_n) * 32)
531
532#define MT_WCID_IV_BASE 0xa000
533#define MT_WCID_IV(_n) (MT_WCID_IV_BASE + (_n) * 8)
534
535#define MT_WCID_ATTR_BASE 0xa800
536#define MT_WCID_ATTR(_n) (MT_WCID_ATTR_BASE + (_n) * 4)
537
538#define MT_WCID_ATTR_PAIRWISE BIT(0)
539#define MT_WCID_ATTR_PKEY_MODE GENMASK(3, 1)
540#define MT_WCID_ATTR_BSS_IDX GENMASK(6, 4)
541#define MT_WCID_ATTR_RXWI_UDF GENMASK(9, 7)
542#define MT_WCID_ATTR_PKEY_MODE_EXT BIT(10)
543#define MT_WCID_ATTR_BSS_IDX_EXT BIT(11)
544#define MT_WCID_ATTR_WAPI_MCBC BIT(15)
545#define MT_WCID_ATTR_WAPI_KEYID GENMASK(31, 24)
546
547#define MT_SKEY_BASE_0 0xac00
548#define MT_SKEY_BASE_1 0xb400
549#define MT_SKEY_0(_bss, _idx) (MT_SKEY_BASE_0 + (4 * (_bss) + _idx) * 32)
550#define MT_SKEY_1(_bss, _idx) (MT_SKEY_BASE_1 + (4 * ((_bss) & 7) + _idx) * 32)
551#define MT_SKEY(_bss, _idx) ((_bss & 8) ? MT_SKEY_1(_bss, _idx) : MT_SKEY_0(_bss, _idx))
552
553#define MT_SKEY_MODE_BASE_0 0xb000
554#define MT_SKEY_MODE_BASE_1 0xb3f0
555#define MT_SKEY_MODE_0(_bss) (MT_SKEY_MODE_BASE_0 + ((_bss / 2) << 2))
556#define MT_SKEY_MODE_1(_bss) (MT_SKEY_MODE_BASE_1 + ((((_bss) & 7) / 2) << 2))
557#define MT_SKEY_MODE(_bss) ((_bss & 8) ? MT_SKEY_MODE_1(_bss) : MT_SKEY_MODE_0(_bss))
558#define MT_SKEY_MODE_MASK GENMASK(3, 0)
559#define MT_SKEY_MODE_SHIFT(_bss, _idx) (4 * ((_idx) + 4 * (_bss & 1)))
560
561#define MT_BEACON_BASE 0xc000
562
563#define MT_TEMP_SENSOR 0x1d000
564#define MT_TEMP_SENSOR_VAL GENMASK(6, 0)
565
566struct mt76_wcid_addr {
567 u8 macaddr[6];
568 __le16 ba_mask;
569} __packed __aligned(4);
570
571struct mt76_wcid_key {
572 u8 key[16];
573 u8 tx_mic[8];
574 u8 rx_mic[8];
575} __packed __aligned(4);
576
577enum mt76x2_cipher_type {
578 MT_CIPHER_NONE,
579 MT_CIPHER_WEP40,
580 MT_CIPHER_WEP104,
581 MT_CIPHER_TKIP,
582 MT_CIPHER_AES_CCMP,
583 MT_CIPHER_CKIP40,
584 MT_CIPHER_CKIP104,
585 MT_CIPHER_CKIP128,
586 MT_CIPHER_WAPI,
587};
588
589#endif
590