Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi...
[deliverable/linux.git] / drivers / net / wireless / rt2x00 / rt2800.h
CommitLineData
b54f78a8 1/*
bc8a979e
ID
2 Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
3 Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
9c9a0d14
GW
4 Copyright (C) 2009 Alban Browaeys <prahal@yahoo.com>
5 Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
6 Copyright (C) 2009 Luis Correia <luis.f.correia@gmail.com>
7 Copyright (C) 2009 Mattias Nissler <mattias.nissler@gmx.de>
8 Copyright (C) 2009 Mark Asselstine <asselsm@gmail.com>
9 Copyright (C) 2009 Xose Vazquez Perez <xose.vazquez@gmail.com>
10 Copyright (C) 2009 Bart Zolnierkiewicz <bzolnier@gmail.com>
b54f78a8
BZ
11 <http://rt2x00.serialmonkey.com>
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the
25 Free Software Foundation, Inc.,
26 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29/*
30 Module: rt2800
31 Abstract: Data structures and registers for the rt2800 modules.
32 Supported chipsets: RT2800E, RT2800ED & RT2800U.
33 */
34
35#ifndef RT2800_H
36#define RT2800_H
37
38/*
39 * RF chip defines.
40 *
41 * RF2820 2.4G 2T3R
42 * RF2850 2.4G/5G 2T3R
43 * RF2720 2.4G 1T2R
44 * RF2750 2.4G/5G 1T2R
45 * RF3020 2.4G 1T1R
46 * RF2020 2.4G B/G
47 * RF3021 2.4G 1T2R
48 * RF3022 2.4G 2T2R
8d4ff3f3
RJH
49 * RF3052 2.4G/5G 2T2R
50 * RF2853 2.4G/5G 3T3R
51 * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390)
52 * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392)
7fbaf3ef 53 * RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662)
ccf91bd6 54 * RF5360 2.4G 1T1R
aca355b9 55 * RF5370 2.4G 1T1R
60687ba7 56 * RF5390 2.4G 1T1R
b54f78a8
BZ
57 */
58#define RF2820 0x0001
59#define RF2850 0x0002
60#define RF2720 0x0003
61#define RF2750 0x0004
62#define RF3020 0x0005
63#define RF2020 0x0006
64#define RF3021 0x0007
65#define RF3022 0x0008
66#define RF3052 0x0009
8d4ff3f3 67#define RF2853 0x000a
fab799c3 68#define RF3320 0x000b
8d4ff3f3 69#define RF3322 0x000c
7fbaf3ef 70#define RF3053 0x000d
ccf91bd6 71#define RF5360 0x5360
aca355b9 72#define RF5370 0x5370
2ed71884 73#define RF5372 0x5372
adde5882 74#define RF5390 0x5390
cff3d1f0 75#define RF5392 0x5392
b54f78a8
BZ
76
77/*
8d0c9b65 78 * Chipset revisions.
b54f78a8 79 */
8d0c9b65
GW
80#define REV_RT2860C 0x0100
81#define REV_RT2860D 0x0101
8d0c9b65
GW
82#define REV_RT2872E 0x0200
83#define REV_RT3070E 0x0200
84#define REV_RT3070F 0x0201
85#define REV_RT3071E 0x0211
86#define REV_RT3090E 0x0211
87#define REV_RT3390E 0x0211
adde5882 88#define REV_RT5390F 0x0502
0586a11b 89#define REV_RT5390R 0x1502
b54f78a8
BZ
90
91/*
92 * Signal information.
93 * Default offset is required for RSSI <-> dBm conversion.
94 */
74861922 95#define DEFAULT_RSSI_OFFSET 120
b54f78a8
BZ
96
97/*
98 * Register layout information.
99 */
100#define CSR_REG_BASE 0x1000
101#define CSR_REG_SIZE 0x0800
102#define EEPROM_BASE 0x0000
103#define EEPROM_SIZE 0x0110
104#define BBP_BASE 0x0000
0c0fdf6c 105#define BBP_SIZE 0x00ff
b54f78a8
BZ
106#define RF_BASE 0x0004
107#define RF_SIZE 0x0010
f2bd7f16
AA
108#define RFCSR_BASE 0x0000
109#define RFCSR_SIZE 0x0040
b54f78a8
BZ
110
111/*
112 * Number of TX queues.
113 */
114#define NUM_TX_QUEUES 4
115
116/*
fab799c3 117 * Registers.
b54f78a8
BZ
118 */
119
785c3c06
GW
120/*
121 * E2PROM_CSR: PCI EEPROM control register.
122 * RELOAD: Write 1 to reload eeprom content.
123 * TYPE: 0: 93c46, 1:93c66.
124 * LOAD_STATUS: 1:loading, 0:done.
125 */
126#define E2PROM_CSR 0x0004
127#define E2PROM_CSR_DATA_CLOCK FIELD32(0x00000001)
128#define E2PROM_CSR_CHIP_SELECT FIELD32(0x00000002)
129#define E2PROM_CSR_DATA_IN FIELD32(0x00000004)
130#define E2PROM_CSR_DATA_OUT FIELD32(0x00000008)
131#define E2PROM_CSR_TYPE FIELD32(0x00000030)
132#define E2PROM_CSR_LOAD_STATUS FIELD32(0x00000040)
133#define E2PROM_CSR_RELOAD FIELD32(0x00000080)
134
60687ba7
RST
135/*
136 * AUX_CTRL: Aux/PCI-E related configuration
137 */
adde5882
GJ
138#define AUX_CTRL 0x10c
139#define AUX_CTRL_WAKE_PCIE_EN FIELD32(0x00000002)
140#define AUX_CTRL_FORCE_PCIE_CLK FIELD32(0x00000400)
60687ba7 141
fab799c3
GW
142/*
143 * OPT_14: Unknown register used by rt3xxx devices.
144 */
145#define OPT_14_CSR 0x0114
146#define OPT_14_CSR_BIT0 FIELD32(0x00000001)
147
b54f78a8
BZ
148/*
149 * INT_SOURCE_CSR: Interrupt source register.
150 * Write one to clear corresponding bit.
0bdab171 151 * TX_FIFO_STATUS: FIFO Statistics is full, sw should read TX_STA_FIFO
b54f78a8
BZ
152 */
153#define INT_SOURCE_CSR 0x0200
154#define INT_SOURCE_CSR_RXDELAYINT FIELD32(0x00000001)
155#define INT_SOURCE_CSR_TXDELAYINT FIELD32(0x00000002)
156#define INT_SOURCE_CSR_RX_DONE FIELD32(0x00000004)
157#define INT_SOURCE_CSR_AC0_DMA_DONE FIELD32(0x00000008)
158#define INT_SOURCE_CSR_AC1_DMA_DONE FIELD32(0x00000010)
159#define INT_SOURCE_CSR_AC2_DMA_DONE FIELD32(0x00000020)
160#define INT_SOURCE_CSR_AC3_DMA_DONE FIELD32(0x00000040)
161#define INT_SOURCE_CSR_HCCA_DMA_DONE FIELD32(0x00000080)
162#define INT_SOURCE_CSR_MGMT_DMA_DONE FIELD32(0x00000100)
163#define INT_SOURCE_CSR_MCU_COMMAND FIELD32(0x00000200)
164#define INT_SOURCE_CSR_RXTX_COHERENT FIELD32(0x00000400)
165#define INT_SOURCE_CSR_TBTT FIELD32(0x00000800)
166#define INT_SOURCE_CSR_PRE_TBTT FIELD32(0x00001000)
167#define INT_SOURCE_CSR_TX_FIFO_STATUS FIELD32(0x00002000)
168#define INT_SOURCE_CSR_AUTO_WAKEUP FIELD32(0x00004000)
169#define INT_SOURCE_CSR_GPTIMER FIELD32(0x00008000)
170#define INT_SOURCE_CSR_RX_COHERENT FIELD32(0x00010000)
171#define INT_SOURCE_CSR_TX_COHERENT FIELD32(0x00020000)
172
173/*
174 * INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF.
175 */
176#define INT_MASK_CSR 0x0204
177#define INT_MASK_CSR_RXDELAYINT FIELD32(0x00000001)
178#define INT_MASK_CSR_TXDELAYINT FIELD32(0x00000002)
179#define INT_MASK_CSR_RX_DONE FIELD32(0x00000004)
180#define INT_MASK_CSR_AC0_DMA_DONE FIELD32(0x00000008)
181#define INT_MASK_CSR_AC1_DMA_DONE FIELD32(0x00000010)
182#define INT_MASK_CSR_AC2_DMA_DONE FIELD32(0x00000020)
183#define INT_MASK_CSR_AC3_DMA_DONE FIELD32(0x00000040)
184#define INT_MASK_CSR_HCCA_DMA_DONE FIELD32(0x00000080)
185#define INT_MASK_CSR_MGMT_DMA_DONE FIELD32(0x00000100)
186#define INT_MASK_CSR_MCU_COMMAND FIELD32(0x00000200)
187#define INT_MASK_CSR_RXTX_COHERENT FIELD32(0x00000400)
188#define INT_MASK_CSR_TBTT FIELD32(0x00000800)
189#define INT_MASK_CSR_PRE_TBTT FIELD32(0x00001000)
190#define INT_MASK_CSR_TX_FIFO_STATUS FIELD32(0x00002000)
191#define INT_MASK_CSR_AUTO_WAKEUP FIELD32(0x00004000)
192#define INT_MASK_CSR_GPTIMER FIELD32(0x00008000)
193#define INT_MASK_CSR_RX_COHERENT FIELD32(0x00010000)
194#define INT_MASK_CSR_TX_COHERENT FIELD32(0x00020000)
195
196/*
197 * WPDMA_GLO_CFG
198 */
199#define WPDMA_GLO_CFG 0x0208
200#define WPDMA_GLO_CFG_ENABLE_TX_DMA FIELD32(0x00000001)
201#define WPDMA_GLO_CFG_TX_DMA_BUSY FIELD32(0x00000002)
202#define WPDMA_GLO_CFG_ENABLE_RX_DMA FIELD32(0x00000004)
203#define WPDMA_GLO_CFG_RX_DMA_BUSY FIELD32(0x00000008)
204#define WPDMA_GLO_CFG_WP_DMA_BURST_SIZE FIELD32(0x00000030)
205#define WPDMA_GLO_CFG_TX_WRITEBACK_DONE FIELD32(0x00000040)
206#define WPDMA_GLO_CFG_BIG_ENDIAN FIELD32(0x00000080)
207#define WPDMA_GLO_CFG_RX_HDR_SCATTER FIELD32(0x0000ff00)
208#define WPDMA_GLO_CFG_HDR_SEG_LEN FIELD32(0xffff0000)
209
210/*
211 * WPDMA_RST_IDX
212 */
213#define WPDMA_RST_IDX 0x020c
214#define WPDMA_RST_IDX_DTX_IDX0 FIELD32(0x00000001)
215#define WPDMA_RST_IDX_DTX_IDX1 FIELD32(0x00000002)
216#define WPDMA_RST_IDX_DTX_IDX2 FIELD32(0x00000004)
217#define WPDMA_RST_IDX_DTX_IDX3 FIELD32(0x00000008)
218#define WPDMA_RST_IDX_DTX_IDX4 FIELD32(0x00000010)
219#define WPDMA_RST_IDX_DTX_IDX5 FIELD32(0x00000020)
220#define WPDMA_RST_IDX_DRX_IDX0 FIELD32(0x00010000)
221
222/*
223 * DELAY_INT_CFG
224 */
225#define DELAY_INT_CFG 0x0210
226#define DELAY_INT_CFG_RXMAX_PTIME FIELD32(0x000000ff)
227#define DELAY_INT_CFG_RXMAX_PINT FIELD32(0x00007f00)
228#define DELAY_INT_CFG_RXDLY_INT_EN FIELD32(0x00008000)
229#define DELAY_INT_CFG_TXMAX_PTIME FIELD32(0x00ff0000)
230#define DELAY_INT_CFG_TXMAX_PINT FIELD32(0x7f000000)
231#define DELAY_INT_CFG_TXDLY_INT_EN FIELD32(0x80000000)
232
233/*
234 * WMM_AIFSN_CFG: Aifsn for each EDCA AC
f615e9a3
ID
235 * AIFSN0: AC_VO
236 * AIFSN1: AC_VI
237 * AIFSN2: AC_BE
238 * AIFSN3: AC_BK
b54f78a8
BZ
239 */
240#define WMM_AIFSN_CFG 0x0214
241#define WMM_AIFSN_CFG_AIFSN0 FIELD32(0x0000000f)
242#define WMM_AIFSN_CFG_AIFSN1 FIELD32(0x000000f0)
243#define WMM_AIFSN_CFG_AIFSN2 FIELD32(0x00000f00)
244#define WMM_AIFSN_CFG_AIFSN3 FIELD32(0x0000f000)
245
246/*
247 * WMM_CWMIN_CSR: CWmin for each EDCA AC
f615e9a3
ID
248 * CWMIN0: AC_VO
249 * CWMIN1: AC_VI
250 * CWMIN2: AC_BE
251 * CWMIN3: AC_BK
b54f78a8
BZ
252 */
253#define WMM_CWMIN_CFG 0x0218
254#define WMM_CWMIN_CFG_CWMIN0 FIELD32(0x0000000f)
255#define WMM_CWMIN_CFG_CWMIN1 FIELD32(0x000000f0)
256#define WMM_CWMIN_CFG_CWMIN2 FIELD32(0x00000f00)
257#define WMM_CWMIN_CFG_CWMIN3 FIELD32(0x0000f000)
258
259/*
260 * WMM_CWMAX_CSR: CWmax for each EDCA AC
f615e9a3
ID
261 * CWMAX0: AC_VO
262 * CWMAX1: AC_VI
263 * CWMAX2: AC_BE
264 * CWMAX3: AC_BK
b54f78a8
BZ
265 */
266#define WMM_CWMAX_CFG 0x021c
267#define WMM_CWMAX_CFG_CWMAX0 FIELD32(0x0000000f)
268#define WMM_CWMAX_CFG_CWMAX1 FIELD32(0x000000f0)
269#define WMM_CWMAX_CFG_CWMAX2 FIELD32(0x00000f00)
270#define WMM_CWMAX_CFG_CWMAX3 FIELD32(0x0000f000)
271
272/*
f615e9a3
ID
273 * AC_TXOP0: AC_VO/AC_VI TXOP register
274 * AC0TXOP: AC_VO in unit of 32us
275 * AC1TXOP: AC_VI in unit of 32us
b54f78a8
BZ
276 */
277#define WMM_TXOP0_CFG 0x0220
278#define WMM_TXOP0_CFG_AC0TXOP FIELD32(0x0000ffff)
279#define WMM_TXOP0_CFG_AC1TXOP FIELD32(0xffff0000)
280
281/*
f615e9a3
ID
282 * AC_TXOP1: AC_BE/AC_BK TXOP register
283 * AC2TXOP: AC_BE in unit of 32us
284 * AC3TXOP: AC_BK in unit of 32us
b54f78a8
BZ
285 */
286#define WMM_TXOP1_CFG 0x0224
287#define WMM_TXOP1_CFG_AC2TXOP FIELD32(0x0000ffff)
288#define WMM_TXOP1_CFG_AC3TXOP FIELD32(0xffff0000)
289
290/*
291 * GPIO_CTRL_CFG:
d96aa640 292 * GPIOD: GPIO direction, 0: Output, 1: Input
b54f78a8
BZ
293 */
294#define GPIO_CTRL_CFG 0x0228
295#define GPIO_CTRL_CFG_BIT0 FIELD32(0x00000001)
296#define GPIO_CTRL_CFG_BIT1 FIELD32(0x00000002)
297#define GPIO_CTRL_CFG_BIT2 FIELD32(0x00000004)
298#define GPIO_CTRL_CFG_BIT3 FIELD32(0x00000008)
299#define GPIO_CTRL_CFG_BIT4 FIELD32(0x00000010)
300#define GPIO_CTRL_CFG_BIT5 FIELD32(0x00000020)
301#define GPIO_CTRL_CFG_BIT6 FIELD32(0x00000040)
302#define GPIO_CTRL_CFG_BIT7 FIELD32(0x00000080)
fe59147c
ST
303#define GPIO_CTRL_CFG_GPIOD_BIT0 FIELD32(0x00000100)
304#define GPIO_CTRL_CFG_GPIOD_BIT1 FIELD32(0x00000200)
305#define GPIO_CTRL_CFG_GPIOD_BIT2 FIELD32(0x00000400)
306#define GPIO_CTRL_CFG_GPIOD_BIT3 FIELD32(0x00000800)
307#define GPIO_CTRL_CFG_GPIOD_BIT4 FIELD32(0x00001000)
308#define GPIO_CTRL_CFG_GPIOD_BIT5 FIELD32(0x00002000)
309#define GPIO_CTRL_CFG_GPIOD_BIT6 FIELD32(0x00004000)
310#define GPIO_CTRL_CFG_GPIOD_BIT7 FIELD32(0x00008000)
b54f78a8
BZ
311
312/*
313 * MCU_CMD_CFG
314 */
315#define MCU_CMD_CFG 0x022c
316
317/*
f615e9a3 318 * AC_VO register offsets
b54f78a8
BZ
319 */
320#define TX_BASE_PTR0 0x0230
321#define TX_MAX_CNT0 0x0234
322#define TX_CTX_IDX0 0x0238
323#define TX_DTX_IDX0 0x023c
324
325/*
f615e9a3 326 * AC_VI register offsets
b54f78a8
BZ
327 */
328#define TX_BASE_PTR1 0x0240
329#define TX_MAX_CNT1 0x0244
330#define TX_CTX_IDX1 0x0248
331#define TX_DTX_IDX1 0x024c
332
333/*
f615e9a3 334 * AC_BE register offsets
b54f78a8
BZ
335 */
336#define TX_BASE_PTR2 0x0250
337#define TX_MAX_CNT2 0x0254
338#define TX_CTX_IDX2 0x0258
339#define TX_DTX_IDX2 0x025c
340
341/*
f615e9a3 342 * AC_BK register offsets
b54f78a8
BZ
343 */
344#define TX_BASE_PTR3 0x0260
345#define TX_MAX_CNT3 0x0264
346#define TX_CTX_IDX3 0x0268
347#define TX_DTX_IDX3 0x026c
348
349/*
350 * HCCA register offsets
351 */
352#define TX_BASE_PTR4 0x0270
353#define TX_MAX_CNT4 0x0274
354#define TX_CTX_IDX4 0x0278
355#define TX_DTX_IDX4 0x027c
356
357/*
358 * MGMT register offsets
359 */
360#define TX_BASE_PTR5 0x0280
361#define TX_MAX_CNT5 0x0284
362#define TX_CTX_IDX5 0x0288
363#define TX_DTX_IDX5 0x028c
364
365/*
366 * RX register offsets
367 */
368#define RX_BASE_PTR 0x0290
369#define RX_MAX_CNT 0x0294
370#define RX_CRX_IDX 0x0298
371#define RX_DRX_IDX 0x029c
372
785c3c06
GW
373/*
374 * USB_DMA_CFG
375 * RX_BULK_AGG_TIMEOUT: Rx Bulk Aggregation TimeOut in unit of 33ns.
376 * RX_BULK_AGG_LIMIT: Rx Bulk Aggregation Limit in unit of 256 bytes.
377 * PHY_CLEAR: phy watch dog enable.
378 * TX_CLEAR: Clear USB DMA TX path.
379 * TXOP_HALT: Halt TXOP count down when TX buffer is full.
380 * RX_BULK_AGG_EN: Enable Rx Bulk Aggregation.
381 * RX_BULK_EN: Enable USB DMA Rx.
382 * TX_BULK_EN: Enable USB DMA Tx.
383 * EP_OUT_VALID: OUT endpoint data valid.
384 * RX_BUSY: USB DMA RX FSM busy.
385 * TX_BUSY: USB DMA TX FSM busy.
386 */
387#define USB_DMA_CFG 0x02a0
388#define USB_DMA_CFG_RX_BULK_AGG_TIMEOUT FIELD32(0x000000ff)
389#define USB_DMA_CFG_RX_BULK_AGG_LIMIT FIELD32(0x0000ff00)
390#define USB_DMA_CFG_PHY_CLEAR FIELD32(0x00010000)
391#define USB_DMA_CFG_TX_CLEAR FIELD32(0x00080000)
392#define USB_DMA_CFG_TXOP_HALT FIELD32(0x00100000)
393#define USB_DMA_CFG_RX_BULK_AGG_EN FIELD32(0x00200000)
394#define USB_DMA_CFG_RX_BULK_EN FIELD32(0x00400000)
395#define USB_DMA_CFG_TX_BULK_EN FIELD32(0x00800000)
396#define USB_DMA_CFG_EP_OUT_VALID FIELD32(0x3f000000)
397#define USB_DMA_CFG_RX_BUSY FIELD32(0x40000000)
398#define USB_DMA_CFG_TX_BUSY FIELD32(0x80000000)
399
400/*
401 * US_CYC_CNT
c6fcc0e5
RJH
402 * BT_MODE_EN: Bluetooth mode enable
403 * CLOCK CYCLE: Clock cycle count in 1us.
404 * PCI:0x21, PCIE:0x7d, USB:0x1e
785c3c06
GW
405 */
406#define US_CYC_CNT 0x02a4
c6fcc0e5 407#define US_CYC_CNT_BT_MODE_EN FIELD32(0x00000100)
785c3c06
GW
408#define US_CYC_CNT_CLOCK_CYCLE FIELD32(0x000000ff)
409
b54f78a8
BZ
410/*
411 * PBF_SYS_CTRL
412 * HOST_RAM_WRITE: enable Host program ram write selection
413 */
414#define PBF_SYS_CTRL 0x0400
415#define PBF_SYS_CTRL_READY FIELD32(0x00000080)
416#define PBF_SYS_CTRL_HOST_RAM_WRITE FIELD32(0x00010000)
417
418/*
419 * HOST-MCU shared memory
420 */
421#define HOST_CMD_CSR 0x0404
422#define HOST_CMD_CSR_HOST_COMMAND FIELD32(0x000000ff)
423
424/*
425 * PBF registers
426 * Most are for debug. Driver doesn't touch PBF register.
427 */
428#define PBF_CFG 0x0408
429#define PBF_MAX_PCNT 0x040c
430#define PBF_CTRL 0x0410
431#define PBF_INT_STA 0x0414
432#define PBF_INT_ENA 0x0418
433
434/*
435 * BCN_OFFSET0:
436 */
437#define BCN_OFFSET0 0x042c
438#define BCN_OFFSET0_BCN0 FIELD32(0x000000ff)
439#define BCN_OFFSET0_BCN1 FIELD32(0x0000ff00)
440#define BCN_OFFSET0_BCN2 FIELD32(0x00ff0000)
441#define BCN_OFFSET0_BCN3 FIELD32(0xff000000)
442
443/*
444 * BCN_OFFSET1:
445 */
446#define BCN_OFFSET1 0x0430
447#define BCN_OFFSET1_BCN4 FIELD32(0x000000ff)
448#define BCN_OFFSET1_BCN5 FIELD32(0x0000ff00)
449#define BCN_OFFSET1_BCN6 FIELD32(0x00ff0000)
450#define BCN_OFFSET1_BCN7 FIELD32(0xff000000)
451
452/*
8c5765fd
ID
453 * TXRXQ_PCNT: PBF register
454 * PCNT_TX0Q: Page count for TX hardware queue 0
455 * PCNT_TX1Q: Page count for TX hardware queue 1
456 * PCNT_TX2Q: Page count for TX hardware queue 2
457 * PCNT_RX0Q: Page count for RX hardware queue
b54f78a8
BZ
458 */
459#define TXRXQ_PCNT 0x0438
8c5765fd
ID
460#define TXRXQ_PCNT_TX0Q FIELD32(0x000000ff)
461#define TXRXQ_PCNT_TX1Q FIELD32(0x0000ff00)
462#define TXRXQ_PCNT_TX2Q FIELD32(0x00ff0000)
463#define TXRXQ_PCNT_RX0Q FIELD32(0xff000000)
464
465/*
466 * PBF register
467 * Debug. Driver doesn't touch PBF register.
468 */
b54f78a8
BZ
469#define PBF_DBG 0x043c
470
471/*
472 * RF registers
473 */
474#define RF_CSR_CFG 0x0500
475#define RF_CSR_CFG_DATA FIELD32(0x000000ff)
adde5882 476#define RF_CSR_CFG_REGNUM FIELD32(0x00003f00)
b54f78a8
BZ
477#define RF_CSR_CFG_WRITE FIELD32(0x00010000)
478#define RF_CSR_CFG_BUSY FIELD32(0x00020000)
479
30e84034
BZ
480/*
481 * EFUSE_CSR: RT30x0 EEPROM
482 */
483#define EFUSE_CTRL 0x0580
484#define EFUSE_CTRL_ADDRESS_IN FIELD32(0x03fe0000)
485#define EFUSE_CTRL_MODE FIELD32(0x000000c0)
486#define EFUSE_CTRL_KICK FIELD32(0x40000000)
487#define EFUSE_CTRL_PRESENT FIELD32(0x80000000)
488
489/*
490 * EFUSE_DATA0
491 */
492#define EFUSE_DATA0 0x0590
493
494/*
495 * EFUSE_DATA1
496 */
497#define EFUSE_DATA1 0x0594
498
499/*
500 * EFUSE_DATA2
501 */
502#define EFUSE_DATA2 0x0598
503
504/*
505 * EFUSE_DATA3
506 */
507#define EFUSE_DATA3 0x059c
508
fab799c3
GW
509/*
510 * LDO_CFG0
511 */
512#define LDO_CFG0 0x05d4
513#define LDO_CFG0_DELAY3 FIELD32(0x000000ff)
514#define LDO_CFG0_DELAY2 FIELD32(0x0000ff00)
515#define LDO_CFG0_DELAY1 FIELD32(0x00ff0000)
516#define LDO_CFG0_BGSEL FIELD32(0x03000000)
517#define LDO_CFG0_LDO_CORE_VLEVEL FIELD32(0x1c000000)
518#define LD0_CFG0_LDO25_LEVEL FIELD32(0x60000000)
519#define LDO_CFG0_LDO25_LARGEA FIELD32(0x80000000)
520
521/*
522 * GPIO_SWITCH
523 */
524#define GPIO_SWITCH 0x05dc
525#define GPIO_SWITCH_0 FIELD32(0x00000001)
526#define GPIO_SWITCH_1 FIELD32(0x00000002)
527#define GPIO_SWITCH_2 FIELD32(0x00000004)
528#define GPIO_SWITCH_3 FIELD32(0x00000008)
529#define GPIO_SWITCH_4 FIELD32(0x00000010)
530#define GPIO_SWITCH_5 FIELD32(0x00000020)
531#define GPIO_SWITCH_6 FIELD32(0x00000040)
532#define GPIO_SWITCH_7 FIELD32(0x00000080)
533
b54f78a8
BZ
534/*
535 * MAC Control/Status Registers(CSR).
536 * Some values are set in TU, whereas 1 TU == 1024 us.
537 */
538
539/*
540 * MAC_CSR0: ASIC revision number.
541 * ASIC_REV: 0
542 * ASIC_VER: 2860 or 2870
543 */
544#define MAC_CSR0 0x1000
49e721ec
GW
545#define MAC_CSR0_REVISION FIELD32(0x0000ffff)
546#define MAC_CSR0_CHIPSET FIELD32(0xffff0000)
b54f78a8
BZ
547
548/*
549 * MAC_SYS_CTRL:
550 */
551#define MAC_SYS_CTRL 0x1004
552#define MAC_SYS_CTRL_RESET_CSR FIELD32(0x00000001)
553#define MAC_SYS_CTRL_RESET_BBP FIELD32(0x00000002)
554#define MAC_SYS_CTRL_ENABLE_TX FIELD32(0x00000004)
555#define MAC_SYS_CTRL_ENABLE_RX FIELD32(0x00000008)
556#define MAC_SYS_CTRL_CONTINUOUS_TX FIELD32(0x00000010)
557#define MAC_SYS_CTRL_LOOPBACK FIELD32(0x00000020)
558#define MAC_SYS_CTRL_WLAN_HALT FIELD32(0x00000040)
559#define MAC_SYS_CTRL_RX_TIMESTAMP FIELD32(0x00000080)
560
561/*
562 * MAC_ADDR_DW0: STA MAC register 0
563 */
564#define MAC_ADDR_DW0 0x1008
565#define MAC_ADDR_DW0_BYTE0 FIELD32(0x000000ff)
566#define MAC_ADDR_DW0_BYTE1 FIELD32(0x0000ff00)
567#define MAC_ADDR_DW0_BYTE2 FIELD32(0x00ff0000)
568#define MAC_ADDR_DW0_BYTE3 FIELD32(0xff000000)
569
570/*
571 * MAC_ADDR_DW1: STA MAC register 1
572 * UNICAST_TO_ME_MASK:
573 * Used to mask off bits from byte 5 of the MAC address
574 * to determine the UNICAST_TO_ME bit for RX frames.
575 * The full mask is complemented by BSS_ID_MASK:
576 * MASK = BSS_ID_MASK & UNICAST_TO_ME_MASK
577 */
578#define MAC_ADDR_DW1 0x100c
579#define MAC_ADDR_DW1_BYTE4 FIELD32(0x000000ff)
580#define MAC_ADDR_DW1_BYTE5 FIELD32(0x0000ff00)
581#define MAC_ADDR_DW1_UNICAST_TO_ME_MASK FIELD32(0x00ff0000)
582
583/*
584 * MAC_BSSID_DW0: BSSID register 0
585 */
586#define MAC_BSSID_DW0 0x1010
587#define MAC_BSSID_DW0_BYTE0 FIELD32(0x000000ff)
588#define MAC_BSSID_DW0_BYTE1 FIELD32(0x0000ff00)
589#define MAC_BSSID_DW0_BYTE2 FIELD32(0x00ff0000)
590#define MAC_BSSID_DW0_BYTE3 FIELD32(0xff000000)
591
592/*
593 * MAC_BSSID_DW1: BSSID register 1
594 * BSS_ID_MASK:
595 * 0: 1-BSSID mode (BSS index = 0)
596 * 1: 2-BSSID mode (BSS index: Byte5, bit 0)
597 * 2: 4-BSSID mode (BSS index: byte5, bit 0 - 1)
598 * 3: 8-BSSID mode (BSS index: byte5, bit 0 - 2)
599 * This mask is used to mask off bits 0, 1 and 2 of byte 5 of the
600 * BSSID. This will make sure that those bits will be ignored
601 * when determining the MY_BSS of RX frames.
602 */
603#define MAC_BSSID_DW1 0x1014
604#define MAC_BSSID_DW1_BYTE4 FIELD32(0x000000ff)
605#define MAC_BSSID_DW1_BYTE5 FIELD32(0x0000ff00)
606#define MAC_BSSID_DW1_BSS_ID_MASK FIELD32(0x00030000)
607#define MAC_BSSID_DW1_BSS_BCN_NUM FIELD32(0x001c0000)
608
609/*
610 * MAX_LEN_CFG: Maximum frame length register.
611 * MAX_MPDU: rt2860b max 16k bytes
612 * MAX_PSDU: Maximum PSDU length
613 * (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16
614 */
615#define MAX_LEN_CFG 0x1018
616#define MAX_LEN_CFG_MAX_MPDU FIELD32(0x00000fff)
617#define MAX_LEN_CFG_MAX_PSDU FIELD32(0x00003000)
618#define MAX_LEN_CFG_MIN_PSDU FIELD32(0x0000c000)
619#define MAX_LEN_CFG_MIN_MPDU FIELD32(0x000f0000)
620
621/*
622 * BBP_CSR_CFG: BBP serial control register
623 * VALUE: Register value to program into BBP
624 * REG_NUM: Selected BBP register
625 * READ_CONTROL: 0 write BBP, 1 read BBP
626 * BUSY: ASIC is busy executing BBP commands
627 * BBP_PAR_DUR: 0 4 MAC clocks, 1 8 MAC clocks
25985edc 628 * BBP_RW_MODE: 0 serial, 1 parallel
b54f78a8
BZ
629 */
630#define BBP_CSR_CFG 0x101c
631#define BBP_CSR_CFG_VALUE FIELD32(0x000000ff)
632#define BBP_CSR_CFG_REGNUM FIELD32(0x0000ff00)
633#define BBP_CSR_CFG_READ_CONTROL FIELD32(0x00010000)
634#define BBP_CSR_CFG_BUSY FIELD32(0x00020000)
635#define BBP_CSR_CFG_BBP_PAR_DUR FIELD32(0x00040000)
636#define BBP_CSR_CFG_BBP_RW_MODE FIELD32(0x00080000)
637
638/*
639 * RF_CSR_CFG0: RF control register
640 * REGID_AND_VALUE: Register value to program into RF
641 * BITWIDTH: Selected RF register
642 * STANDBYMODE: 0 high when standby, 1 low when standby
643 * SEL: 0 RF_LE0 activate, 1 RF_LE1 activate
644 * BUSY: ASIC is busy executing RF commands
645 */
646#define RF_CSR_CFG0 0x1020
647#define RF_CSR_CFG0_REGID_AND_VALUE FIELD32(0x00ffffff)
648#define RF_CSR_CFG0_BITWIDTH FIELD32(0x1f000000)
649#define RF_CSR_CFG0_REG_VALUE_BW FIELD32(0x1fffffff)
650#define RF_CSR_CFG0_STANDBYMODE FIELD32(0x20000000)
651#define RF_CSR_CFG0_SEL FIELD32(0x40000000)
652#define RF_CSR_CFG0_BUSY FIELD32(0x80000000)
653
654/*
655 * RF_CSR_CFG1: RF control register
656 * REGID_AND_VALUE: Register value to program into RF
657 * RFGAP: Gap between BB_CONTROL_RF and RF_LE
658 * 0: 3 system clock cycle (37.5usec)
659 * 1: 5 system clock cycle (62.5usec)
660 */
661#define RF_CSR_CFG1 0x1024
662#define RF_CSR_CFG1_REGID_AND_VALUE FIELD32(0x00ffffff)
663#define RF_CSR_CFG1_RFGAP FIELD32(0x1f000000)
664
665/*
666 * RF_CSR_CFG2: RF control register
667 * VALUE: Register value to program into RF
b54f78a8
BZ
668 */
669#define RF_CSR_CFG2 0x1028
670#define RF_CSR_CFG2_VALUE FIELD32(0x00ffffff)
671
672/*
673 * LED_CFG: LED control
0f287b74
HS
674 * ON_PERIOD: LED active time (ms) during TX (only used for LED mode 1)
675 * OFF_PERIOD: LED inactive time (ms) during TX (only used for LED mode 1)
676 * SLOW_BLINK_PERIOD: LED blink interval in seconds (only used for LED mode 2)
b54f78a8
BZ
677 * color LED's:
678 * 0: off
679 * 1: blinking upon TX2
680 * 2: periodic slow blinking
681 * 3: always on
682 * LED polarity:
683 * 0: active low
684 * 1: active high
685 */
686#define LED_CFG 0x102c
687#define LED_CFG_ON_PERIOD FIELD32(0x000000ff)
688#define LED_CFG_OFF_PERIOD FIELD32(0x0000ff00)
689#define LED_CFG_SLOW_BLINK_PERIOD FIELD32(0x003f0000)
690#define LED_CFG_R_LED_MODE FIELD32(0x03000000)
691#define LED_CFG_G_LED_MODE FIELD32(0x0c000000)
692#define LED_CFG_Y_LED_MODE FIELD32(0x30000000)
693#define LED_CFG_LED_POLAR FIELD32(0x40000000)
694
47ee3eb1
HS
695/*
696 * AMPDU_BA_WINSIZE: Force BlockAck window size
697 * FORCE_WINSIZE_ENABLE:
698 * 0: Disable forcing of BlockAck window size
699 * 1: Enable forcing of BlockAck window size, overwrites values BlockAck
700 * window size values in the TXWI
701 * FORCE_WINSIZE: BlockAck window size
702 */
703#define AMPDU_BA_WINSIZE 0x1040
704#define AMPDU_BA_WINSIZE_FORCE_WINSIZE_ENABLE FIELD32(0x00000020)
705#define AMPDU_BA_WINSIZE_FORCE_WINSIZE FIELD32(0x0000001f)
706
b54f78a8
BZ
707/*
708 * XIFS_TIME_CFG: MAC timing
709 * CCKM_SIFS_TIME: unit 1us. Applied after CCK RX/TX
710 * OFDM_SIFS_TIME: unit 1us. Applied after OFDM RX/TX
711 * OFDM_XIFS_TIME: unit 1us. Applied after OFDM RX
712 * when MAC doesn't reference BBP signal BBRXEND
713 * EIFS: unit 1us
714 * BB_RXEND_ENABLE: reference RXEND signal to begin XIFS defer
715 *
716 */
717#define XIFS_TIME_CFG 0x1100
718#define XIFS_TIME_CFG_CCKM_SIFS_TIME FIELD32(0x000000ff)
719#define XIFS_TIME_CFG_OFDM_SIFS_TIME FIELD32(0x0000ff00)
720#define XIFS_TIME_CFG_OFDM_XIFS_TIME FIELD32(0x000f0000)
721#define XIFS_TIME_CFG_EIFS FIELD32(0x1ff00000)
722#define XIFS_TIME_CFG_BB_RXEND_ENABLE FIELD32(0x20000000)
723
724/*
725 * BKOFF_SLOT_CFG:
726 */
727#define BKOFF_SLOT_CFG 0x1104
728#define BKOFF_SLOT_CFG_SLOT_TIME FIELD32(0x000000ff)
729#define BKOFF_SLOT_CFG_CC_DELAY_TIME FIELD32(0x0000ff00)
730
731/*
732 * NAV_TIME_CFG:
733 */
734#define NAV_TIME_CFG 0x1108
735#define NAV_TIME_CFG_SIFS FIELD32(0x000000ff)
736#define NAV_TIME_CFG_SLOT_TIME FIELD32(0x0000ff00)
737#define NAV_TIME_CFG_EIFS FIELD32(0x01ff0000)
738#define NAV_TIME_ZERO_SIFS FIELD32(0x02000000)
739
740/*
741 * CH_TIME_CFG: count as channel busy
977206d7
HS
742 * EIFS_BUSY: Count EIFS as channel busy
743 * NAV_BUSY: Count NAS as channel busy
744 * RX_BUSY: Count RX as channel busy
745 * TX_BUSY: Count TX as channel busy
746 * TMR_EN: Enable channel statistics timer
b54f78a8
BZ
747 */
748#define CH_TIME_CFG 0x110c
977206d7
HS
749#define CH_TIME_CFG_EIFS_BUSY FIELD32(0x00000010)
750#define CH_TIME_CFG_NAV_BUSY FIELD32(0x00000008)
751#define CH_TIME_CFG_RX_BUSY FIELD32(0x00000004)
752#define CH_TIME_CFG_TX_BUSY FIELD32(0x00000002)
753#define CH_TIME_CFG_TMR_EN FIELD32(0x00000001)
b54f78a8
BZ
754
755/*
756 * PBF_LIFE_TIMER: TX/RX MPDU timestamp timer (free run) Unit: 1us
757 */
758#define PBF_LIFE_TIMER 0x1110
759
760/*
761 * BCN_TIME_CFG:
762 * BEACON_INTERVAL: in unit of 1/16 TU
763 * TSF_TICKING: Enable TSF auto counting
764 * TSF_SYNC: Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode
765 * BEACON_GEN: Enable beacon generator
766 */
767#define BCN_TIME_CFG 0x1114
768#define BCN_TIME_CFG_BEACON_INTERVAL FIELD32(0x0000ffff)
769#define BCN_TIME_CFG_TSF_TICKING FIELD32(0x00010000)
770#define BCN_TIME_CFG_TSF_SYNC FIELD32(0x00060000)
771#define BCN_TIME_CFG_TBTT_ENABLE FIELD32(0x00080000)
772#define BCN_TIME_CFG_BEACON_GEN FIELD32(0x00100000)
773#define BCN_TIME_CFG_TX_TIME_COMPENSATE FIELD32(0xf0000000)
774
775/*
776 * TBTT_SYNC_CFG:
c4c18a9d
HS
777 * BCN_AIFSN: Beacon AIFSN after TBTT interrupt in slots
778 * BCN_CWMIN: Beacon CWMin after TBTT interrupt in slots
b54f78a8
BZ
779 */
780#define TBTT_SYNC_CFG 0x1118
c4c18a9d
HS
781#define TBTT_SYNC_CFG_TBTT_ADJUST FIELD32(0x000000ff)
782#define TBTT_SYNC_CFG_BCN_EXP_WIN FIELD32(0x0000ff00)
783#define TBTT_SYNC_CFG_BCN_AIFSN FIELD32(0x000f0000)
784#define TBTT_SYNC_CFG_BCN_CWMIN FIELD32(0x00f00000)
b54f78a8
BZ
785
786/*
787 * TSF_TIMER_DW0: Local lsb TSF timer, read-only
788 */
789#define TSF_TIMER_DW0 0x111c
790#define TSF_TIMER_DW0_LOW_WORD FIELD32(0xffffffff)
791
792/*
793 * TSF_TIMER_DW1: Local msb TSF timer, read-only
794 */
795#define TSF_TIMER_DW1 0x1120
796#define TSF_TIMER_DW1_HIGH_WORD FIELD32(0xffffffff)
797
798/*
799 * TBTT_TIMER: TImer remains till next TBTT, read-only
800 */
801#define TBTT_TIMER 0x1124
802
803/*
9f926fb5
HS
804 * INT_TIMER_CFG: timer configuration
805 * PRE_TBTT_TIMER: leadtime to tbtt for pretbtt interrupt in units of 1/16 TU
806 * GP_TIMER: period of general purpose timer in units of 1/16 TU
b54f78a8
BZ
807 */
808#define INT_TIMER_CFG 0x1128
9f926fb5
HS
809#define INT_TIMER_CFG_PRE_TBTT_TIMER FIELD32(0x0000ffff)
810#define INT_TIMER_CFG_GP_TIMER FIELD32(0xffff0000)
b54f78a8
BZ
811
812/*
813 * INT_TIMER_EN: GP-timer and pre-tbtt Int enable
814 */
815#define INT_TIMER_EN 0x112c
9f926fb5
HS
816#define INT_TIMER_EN_PRE_TBTT_TIMER FIELD32(0x00000001)
817#define INT_TIMER_EN_GP_TIMER FIELD32(0x00000002)
b54f78a8
BZ
818
819/*
d4ce3a5e 820 * CH_IDLE_STA: channel idle time (in us)
b54f78a8
BZ
821 */
822#define CH_IDLE_STA 0x1130
823
824/*
d4ce3a5e 825 * CH_BUSY_STA: channel busy time on primary channel (in us)
b54f78a8
BZ
826 */
827#define CH_BUSY_STA 0x1134
828
d4ce3a5e
HS
829/*
830 * CH_BUSY_STA_SEC: channel busy time on secondary channel in HT40 mode (in us)
831 */
832#define CH_BUSY_STA_SEC 0x1138
833
b54f78a8
BZ
834/*
835 * MAC_STATUS_CFG:
836 * BBP_RF_BUSY: When set to 0, BBP and RF are stable.
837 * if 1 or higher one of the 2 registers is busy.
838 */
839#define MAC_STATUS_CFG 0x1200
840#define MAC_STATUS_CFG_BBP_RF_BUSY FIELD32(0x00000003)
841
842/*
843 * PWR_PIN_CFG:
844 */
845#define PWR_PIN_CFG 0x1204
846
847/*
848 * AUTOWAKEUP_CFG: Manual power control / status register
849 * TBCN_BEFORE_WAKE: ForceWake has high privilege than PutToSleep when both set
850 * AUTOWAKE: 0:sleep, 1:awake
851 */
852#define AUTOWAKEUP_CFG 0x1208
853#define AUTOWAKEUP_CFG_AUTO_LEAD_TIME FIELD32(0x000000ff)
854#define AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE FIELD32(0x00007f00)
855#define AUTOWAKEUP_CFG_AUTOWAKE FIELD32(0x00008000)
856
857/*
858 * EDCA_AC0_CFG:
859 */
860#define EDCA_AC0_CFG 0x1300
861#define EDCA_AC0_CFG_TX_OP FIELD32(0x000000ff)
862#define EDCA_AC0_CFG_AIFSN FIELD32(0x00000f00)
863#define EDCA_AC0_CFG_CWMIN FIELD32(0x0000f000)
864#define EDCA_AC0_CFG_CWMAX FIELD32(0x000f0000)
865
866/*
867 * EDCA_AC1_CFG:
868 */
869#define EDCA_AC1_CFG 0x1304
870#define EDCA_AC1_CFG_TX_OP FIELD32(0x000000ff)
871#define EDCA_AC1_CFG_AIFSN FIELD32(0x00000f00)
872#define EDCA_AC1_CFG_CWMIN FIELD32(0x0000f000)
873#define EDCA_AC1_CFG_CWMAX FIELD32(0x000f0000)
874
875/*
876 * EDCA_AC2_CFG:
877 */
878#define EDCA_AC2_CFG 0x1308
879#define EDCA_AC2_CFG_TX_OP FIELD32(0x000000ff)
880#define EDCA_AC2_CFG_AIFSN FIELD32(0x00000f00)
881#define EDCA_AC2_CFG_CWMIN FIELD32(0x0000f000)
882#define EDCA_AC2_CFG_CWMAX FIELD32(0x000f0000)
883
884/*
885 * EDCA_AC3_CFG:
886 */
887#define EDCA_AC3_CFG 0x130c
888#define EDCA_AC3_CFG_TX_OP FIELD32(0x000000ff)
889#define EDCA_AC3_CFG_AIFSN FIELD32(0x00000f00)
890#define EDCA_AC3_CFG_CWMIN FIELD32(0x0000f000)
891#define EDCA_AC3_CFG_CWMAX FIELD32(0x000f0000)
892
893/*
894 * EDCA_TID_AC_MAP:
895 */
896#define EDCA_TID_AC_MAP 0x1310
897
5e846004
HS
898/*
899 * TX_PWR_CFG:
900 */
901#define TX_PWR_CFG_RATE0 FIELD32(0x0000000f)
902#define TX_PWR_CFG_RATE1 FIELD32(0x000000f0)
903#define TX_PWR_CFG_RATE2 FIELD32(0x00000f00)
904#define TX_PWR_CFG_RATE3 FIELD32(0x0000f000)
905#define TX_PWR_CFG_RATE4 FIELD32(0x000f0000)
906#define TX_PWR_CFG_RATE5 FIELD32(0x00f00000)
907#define TX_PWR_CFG_RATE6 FIELD32(0x0f000000)
908#define TX_PWR_CFG_RATE7 FIELD32(0xf0000000)
909
b54f78a8
BZ
910/*
911 * TX_PWR_CFG_0:
912 */
913#define TX_PWR_CFG_0 0x1314
914#define TX_PWR_CFG_0_1MBS FIELD32(0x0000000f)
915#define TX_PWR_CFG_0_2MBS FIELD32(0x000000f0)
916#define TX_PWR_CFG_0_55MBS FIELD32(0x00000f00)
917#define TX_PWR_CFG_0_11MBS FIELD32(0x0000f000)
918#define TX_PWR_CFG_0_6MBS FIELD32(0x000f0000)
919#define TX_PWR_CFG_0_9MBS FIELD32(0x00f00000)
920#define TX_PWR_CFG_0_12MBS FIELD32(0x0f000000)
921#define TX_PWR_CFG_0_18MBS FIELD32(0xf0000000)
922
923/*
924 * TX_PWR_CFG_1:
925 */
926#define TX_PWR_CFG_1 0x1318
927#define TX_PWR_CFG_1_24MBS FIELD32(0x0000000f)
928#define TX_PWR_CFG_1_36MBS FIELD32(0x000000f0)
929#define TX_PWR_CFG_1_48MBS FIELD32(0x00000f00)
930#define TX_PWR_CFG_1_54MBS FIELD32(0x0000f000)
931#define TX_PWR_CFG_1_MCS0 FIELD32(0x000f0000)
932#define TX_PWR_CFG_1_MCS1 FIELD32(0x00f00000)
933#define TX_PWR_CFG_1_MCS2 FIELD32(0x0f000000)
934#define TX_PWR_CFG_1_MCS3 FIELD32(0xf0000000)
935
936/*
937 * TX_PWR_CFG_2:
938 */
939#define TX_PWR_CFG_2 0x131c
940#define TX_PWR_CFG_2_MCS4 FIELD32(0x0000000f)
941#define TX_PWR_CFG_2_MCS5 FIELD32(0x000000f0)
942#define TX_PWR_CFG_2_MCS6 FIELD32(0x00000f00)
943#define TX_PWR_CFG_2_MCS7 FIELD32(0x0000f000)
944#define TX_PWR_CFG_2_MCS8 FIELD32(0x000f0000)
945#define TX_PWR_CFG_2_MCS9 FIELD32(0x00f00000)
946#define TX_PWR_CFG_2_MCS10 FIELD32(0x0f000000)
947#define TX_PWR_CFG_2_MCS11 FIELD32(0xf0000000)
948
949/*
950 * TX_PWR_CFG_3:
951 */
952#define TX_PWR_CFG_3 0x1320
953#define TX_PWR_CFG_3_MCS12 FIELD32(0x0000000f)
954#define TX_PWR_CFG_3_MCS13 FIELD32(0x000000f0)
955#define TX_PWR_CFG_3_MCS14 FIELD32(0x00000f00)
956#define TX_PWR_CFG_3_MCS15 FIELD32(0x0000f000)
957#define TX_PWR_CFG_3_UKNOWN1 FIELD32(0x000f0000)
958#define TX_PWR_CFG_3_UKNOWN2 FIELD32(0x00f00000)
959#define TX_PWR_CFG_3_UKNOWN3 FIELD32(0x0f000000)
960#define TX_PWR_CFG_3_UKNOWN4 FIELD32(0xf0000000)
961
962/*
963 * TX_PWR_CFG_4:
964 */
965#define TX_PWR_CFG_4 0x1324
966#define TX_PWR_CFG_4_UKNOWN5 FIELD32(0x0000000f)
967#define TX_PWR_CFG_4_UKNOWN6 FIELD32(0x000000f0)
968#define TX_PWR_CFG_4_UKNOWN7 FIELD32(0x00000f00)
969#define TX_PWR_CFG_4_UKNOWN8 FIELD32(0x0000f000)
970
971/*
972 * TX_PIN_CFG:
973 */
974#define TX_PIN_CFG 0x1328
2e9c43dd 975#define TX_PIN_CFG_PA_PE_DISABLE 0xfcfffff0
b54f78a8
BZ
976#define TX_PIN_CFG_PA_PE_A0_EN FIELD32(0x00000001)
977#define TX_PIN_CFG_PA_PE_G0_EN FIELD32(0x00000002)
978#define TX_PIN_CFG_PA_PE_A1_EN FIELD32(0x00000004)
979#define TX_PIN_CFG_PA_PE_G1_EN FIELD32(0x00000008)
980#define TX_PIN_CFG_PA_PE_A0_POL FIELD32(0x00000010)
981#define TX_PIN_CFG_PA_PE_G0_POL FIELD32(0x00000020)
982#define TX_PIN_CFG_PA_PE_A1_POL FIELD32(0x00000040)
983#define TX_PIN_CFG_PA_PE_G1_POL FIELD32(0x00000080)
984#define TX_PIN_CFG_LNA_PE_A0_EN FIELD32(0x00000100)
985#define TX_PIN_CFG_LNA_PE_G0_EN FIELD32(0x00000200)
986#define TX_PIN_CFG_LNA_PE_A1_EN FIELD32(0x00000400)
987#define TX_PIN_CFG_LNA_PE_G1_EN FIELD32(0x00000800)
988#define TX_PIN_CFG_LNA_PE_A0_POL FIELD32(0x00001000)
989#define TX_PIN_CFG_LNA_PE_G0_POL FIELD32(0x00002000)
990#define TX_PIN_CFG_LNA_PE_A1_POL FIELD32(0x00004000)
991#define TX_PIN_CFG_LNA_PE_G1_POL FIELD32(0x00008000)
992#define TX_PIN_CFG_RFTR_EN FIELD32(0x00010000)
993#define TX_PIN_CFG_RFTR_POL FIELD32(0x00020000)
994#define TX_PIN_CFG_TRSW_EN FIELD32(0x00040000)
995#define TX_PIN_CFG_TRSW_POL FIELD32(0x00080000)
2e9c43dd
JL
996#define TX_PIN_CFG_PA_PE_A2_EN FIELD32(0x01000000)
997#define TX_PIN_CFG_PA_PE_G2_EN FIELD32(0x02000000)
998#define TX_PIN_CFG_PA_PE_A2_POL FIELD32(0x04000000)
999#define TX_PIN_CFG_PA_PE_G2_POL FIELD32(0x08000000)
1000#define TX_PIN_CFG_LNA_PE_A2_EN FIELD32(0x10000000)
1001#define TX_PIN_CFG_LNA_PE_G2_EN FIELD32(0x20000000)
1002#define TX_PIN_CFG_LNA_PE_A2_POL FIELD32(0x40000000)
1003#define TX_PIN_CFG_LNA_PE_G2_POL FIELD32(0x80000000)
b54f78a8
BZ
1004
1005/*
1006 * TX_BAND_CFG: 0x1 use upper 20MHz, 0x0 use lower 20MHz
1007 */
1008#define TX_BAND_CFG 0x132c
a21ee724 1009#define TX_BAND_CFG_HT40_MINUS FIELD32(0x00000001)
b54f78a8
BZ
1010#define TX_BAND_CFG_A FIELD32(0x00000002)
1011#define TX_BAND_CFG_BG FIELD32(0x00000004)
1012
1013/*
1014 * TX_SW_CFG0:
1015 */
1016#define TX_SW_CFG0 0x1330
1017
1018/*
1019 * TX_SW_CFG1:
1020 */
1021#define TX_SW_CFG1 0x1334
1022
1023/*
1024 * TX_SW_CFG2:
1025 */
1026#define TX_SW_CFG2 0x1338
1027
1028/*
1029 * TXOP_THRES_CFG:
1030 */
1031#define TXOP_THRES_CFG 0x133c
1032
1033/*
1034 * TXOP_CTRL_CFG:
961621ab
HS
1035 * TIMEOUT_TRUN_EN: Enable/Disable TXOP timeout truncation
1036 * AC_TRUN_EN: Enable/Disable truncation for AC change
1037 * TXRATEGRP_TRUN_EN: Enable/Disable truncation for TX rate group change
1038 * USER_MODE_TRUN_EN: Enable/Disable truncation for user TXOP mode
1039 * MIMO_PS_TRUN_EN: Enable/Disable truncation for MIMO PS RTS/CTS
1040 * RESERVED_TRUN_EN: Reserved
1041 * LSIG_TXOP_EN: Enable/Disable L-SIG TXOP protection
1042 * EXT_CCA_EN: Enable/Disable extension channel CCA reference (Defer 40Mhz
1043 * transmissions if extension CCA is clear).
1044 * EXT_CCA_DLY: Extension CCA signal delay time (unit: us)
1045 * EXT_CWMIN: CwMin for extension channel backoff
1046 * 0: Disabled
1047 *
b54f78a8
BZ
1048 */
1049#define TXOP_CTRL_CFG 0x1340
961621ab
HS
1050#define TXOP_CTRL_CFG_TIMEOUT_TRUN_EN FIELD32(0x00000001)
1051#define TXOP_CTRL_CFG_AC_TRUN_EN FIELD32(0x00000002)
1052#define TXOP_CTRL_CFG_TXRATEGRP_TRUN_EN FIELD32(0x00000004)
1053#define TXOP_CTRL_CFG_USER_MODE_TRUN_EN FIELD32(0x00000008)
1054#define TXOP_CTRL_CFG_MIMO_PS_TRUN_EN FIELD32(0x00000010)
1055#define TXOP_CTRL_CFG_RESERVED_TRUN_EN FIELD32(0x00000020)
1056#define TXOP_CTRL_CFG_LSIG_TXOP_EN FIELD32(0x00000040)
1057#define TXOP_CTRL_CFG_EXT_CCA_EN FIELD32(0x00000080)
1058#define TXOP_CTRL_CFG_EXT_CCA_DLY FIELD32(0x0000ff00)
1059#define TXOP_CTRL_CFG_EXT_CWMIN FIELD32(0x000f0000)
b54f78a8
BZ
1060
1061/*
1062 * TX_RTS_CFG:
1063 * RTS_THRES: unit:byte
1064 * RTS_FBK_EN: enable rts rate fallback
1065 */
1066#define TX_RTS_CFG 0x1344
1067#define TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT FIELD32(0x000000ff)
1068#define TX_RTS_CFG_RTS_THRES FIELD32(0x00ffff00)
1069#define TX_RTS_CFG_RTS_FBK_EN FIELD32(0x01000000)
1070
1071/*
1072 * TX_TIMEOUT_CFG:
1073 * MPDU_LIFETIME: expiration time = 2^(9+MPDU LIFE TIME) us
1074 * RX_ACK_TIMEOUT: unit:slot. Used for TX procedure
1075 * TX_OP_TIMEOUT: TXOP timeout value for TXOP truncation.
1076 * it is recommended that:
1077 * (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT)
1078 */
1079#define TX_TIMEOUT_CFG 0x1348
1080#define TX_TIMEOUT_CFG_MPDU_LIFETIME FIELD32(0x000000f0)
1081#define TX_TIMEOUT_CFG_RX_ACK_TIMEOUT FIELD32(0x0000ff00)
1082#define TX_TIMEOUT_CFG_TX_OP_TIMEOUT FIELD32(0x00ff0000)
1083
1084/*
1085 * TX_RTY_CFG:
1086 * SHORT_RTY_LIMIT: short retry limit
1087 * LONG_RTY_LIMIT: long retry limit
1088 * LONG_RTY_THRE: Long retry threshoold
1089 * NON_AGG_RTY_MODE: Non-Aggregate MPDU retry mode
1090 * 0:expired by retry limit, 1: expired by mpdu life timer
1091 * AGG_RTY_MODE: Aggregate MPDU retry mode
1092 * 0:expired by retry limit, 1: expired by mpdu life timer
1093 * TX_AUTO_FB_ENABLE: Tx retry PHY rate auto fallback enable
1094 */
1095#define TX_RTY_CFG 0x134c
1096#define TX_RTY_CFG_SHORT_RTY_LIMIT FIELD32(0x000000ff)
1097#define TX_RTY_CFG_LONG_RTY_LIMIT FIELD32(0x0000ff00)
1098#define TX_RTY_CFG_LONG_RTY_THRE FIELD32(0x0fff0000)
1099#define TX_RTY_CFG_NON_AGG_RTY_MODE FIELD32(0x10000000)
1100#define TX_RTY_CFG_AGG_RTY_MODE FIELD32(0x20000000)
1101#define TX_RTY_CFG_TX_AUTO_FB_ENABLE FIELD32(0x40000000)
1102
1103/*
1104 * TX_LINK_CFG:
1105 * REMOTE_MFB_LIFETIME: remote MFB life time. unit: 32us
1106 * MFB_ENABLE: TX apply remote MFB 1:enable
1107 * REMOTE_UMFS_ENABLE: remote unsolicit MFB enable
1108 * 0: not apply remote remote unsolicit (MFS=7)
1109 * TX_MRQ_EN: MCS request TX enable
1110 * TX_RDG_EN: RDG TX enable
1111 * TX_CF_ACK_EN: Piggyback CF-ACK enable
1112 * REMOTE_MFB: remote MCS feedback
1113 * REMOTE_MFS: remote MCS feedback sequence number
1114 */
1115#define TX_LINK_CFG 0x1350
1116#define TX_LINK_CFG_REMOTE_MFB_LIFETIME FIELD32(0x000000ff)
1117#define TX_LINK_CFG_MFB_ENABLE FIELD32(0x00000100)
1118#define TX_LINK_CFG_REMOTE_UMFS_ENABLE FIELD32(0x00000200)
1119#define TX_LINK_CFG_TX_MRQ_EN FIELD32(0x00000400)
1120#define TX_LINK_CFG_TX_RDG_EN FIELD32(0x00000800)
1121#define TX_LINK_CFG_TX_CF_ACK_EN FIELD32(0x00001000)
1122#define TX_LINK_CFG_REMOTE_MFB FIELD32(0x00ff0000)
1123#define TX_LINK_CFG_REMOTE_MFS FIELD32(0xff000000)
1124
1125/*
1126 * HT_FBK_CFG0:
1127 */
1128#define HT_FBK_CFG0 0x1354
1129#define HT_FBK_CFG0_HTMCS0FBK FIELD32(0x0000000f)
1130#define HT_FBK_CFG0_HTMCS1FBK FIELD32(0x000000f0)
1131#define HT_FBK_CFG0_HTMCS2FBK FIELD32(0x00000f00)
1132#define HT_FBK_CFG0_HTMCS3FBK FIELD32(0x0000f000)
1133#define HT_FBK_CFG0_HTMCS4FBK FIELD32(0x000f0000)
1134#define HT_FBK_CFG0_HTMCS5FBK FIELD32(0x00f00000)
1135#define HT_FBK_CFG0_HTMCS6FBK FIELD32(0x0f000000)
1136#define HT_FBK_CFG0_HTMCS7FBK FIELD32(0xf0000000)
1137
1138/*
1139 * HT_FBK_CFG1:
1140 */
1141#define HT_FBK_CFG1 0x1358
1142#define HT_FBK_CFG1_HTMCS8FBK FIELD32(0x0000000f)
1143#define HT_FBK_CFG1_HTMCS9FBK FIELD32(0x000000f0)
1144#define HT_FBK_CFG1_HTMCS10FBK FIELD32(0x00000f00)
1145#define HT_FBK_CFG1_HTMCS11FBK FIELD32(0x0000f000)
1146#define HT_FBK_CFG1_HTMCS12FBK FIELD32(0x000f0000)
1147#define HT_FBK_CFG1_HTMCS13FBK FIELD32(0x00f00000)
1148#define HT_FBK_CFG1_HTMCS14FBK FIELD32(0x0f000000)
1149#define HT_FBK_CFG1_HTMCS15FBK FIELD32(0xf0000000)
1150
1151/*
1152 * LG_FBK_CFG0:
1153 */
1154#define LG_FBK_CFG0 0x135c
1155#define LG_FBK_CFG0_OFDMMCS0FBK FIELD32(0x0000000f)
1156#define LG_FBK_CFG0_OFDMMCS1FBK FIELD32(0x000000f0)
1157#define LG_FBK_CFG0_OFDMMCS2FBK FIELD32(0x00000f00)
1158#define LG_FBK_CFG0_OFDMMCS3FBK FIELD32(0x0000f000)
1159#define LG_FBK_CFG0_OFDMMCS4FBK FIELD32(0x000f0000)
1160#define LG_FBK_CFG0_OFDMMCS5FBK FIELD32(0x00f00000)
1161#define LG_FBK_CFG0_OFDMMCS6FBK FIELD32(0x0f000000)
1162#define LG_FBK_CFG0_OFDMMCS7FBK FIELD32(0xf0000000)
1163
1164/*
1165 * LG_FBK_CFG1:
1166 */
1167#define LG_FBK_CFG1 0x1360
1168#define LG_FBK_CFG0_CCKMCS0FBK FIELD32(0x0000000f)
1169#define LG_FBK_CFG0_CCKMCS1FBK FIELD32(0x000000f0)
1170#define LG_FBK_CFG0_CCKMCS2FBK FIELD32(0x00000f00)
1171#define LG_FBK_CFG0_CCKMCS3FBK FIELD32(0x0000f000)
1172
1173/*
1174 * CCK_PROT_CFG: CCK Protection
1175 * PROTECT_RATE: Protection control frame rate for CCK TX(RTS/CTS/CFEnd)
1176 * PROTECT_CTRL: Protection control frame type for CCK TX
1177 * 0:none, 1:RTS/CTS, 2:CTS-to-self
6f492b6d
ST
1178 * PROTECT_NAV_SHORT: TXOP protection type for CCK TX with short NAV
1179 * PROTECT_NAV_LONG: TXOP protection type for CCK TX with long NAV
b54f78a8
BZ
1180 * TX_OP_ALLOW_CCK: CCK TXOP allowance, 0:disallow
1181 * TX_OP_ALLOW_OFDM: CCK TXOP allowance, 0:disallow
1182 * TX_OP_ALLOW_MM20: CCK TXOP allowance, 0:disallow
1183 * TX_OP_ALLOW_MM40: CCK TXOP allowance, 0:disallow
1184 * TX_OP_ALLOW_GF20: CCK TXOP allowance, 0:disallow
1185 * TX_OP_ALLOW_GF40: CCK TXOP allowance, 0:disallow
1186 * RTS_TH_EN: RTS threshold enable on CCK TX
1187 */
1188#define CCK_PROT_CFG 0x1364
1189#define CCK_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1190#define CCK_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
6f492b6d
ST
1191#define CCK_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1192#define CCK_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
b54f78a8
BZ
1193#define CCK_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1194#define CCK_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1195#define CCK_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1196#define CCK_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1197#define CCK_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1198#define CCK_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1199#define CCK_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1200
1201/*
1202 * OFDM_PROT_CFG: OFDM Protection
1203 */
1204#define OFDM_PROT_CFG 0x1368
1205#define OFDM_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1206#define OFDM_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
6f492b6d
ST
1207#define OFDM_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1208#define OFDM_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
b54f78a8
BZ
1209#define OFDM_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1210#define OFDM_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1211#define OFDM_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1212#define OFDM_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1213#define OFDM_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1214#define OFDM_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1215#define OFDM_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1216
1217/*
1218 * MM20_PROT_CFG: MM20 Protection
1219 */
1220#define MM20_PROT_CFG 0x136c
1221#define MM20_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1222#define MM20_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
6f492b6d
ST
1223#define MM20_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1224#define MM20_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
b54f78a8
BZ
1225#define MM20_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1226#define MM20_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1227#define MM20_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1228#define MM20_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1229#define MM20_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1230#define MM20_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1231#define MM20_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1232
1233/*
1234 * MM40_PROT_CFG: MM40 Protection
1235 */
1236#define MM40_PROT_CFG 0x1370
1237#define MM40_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1238#define MM40_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
6f492b6d
ST
1239#define MM40_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1240#define MM40_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
b54f78a8
BZ
1241#define MM40_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1242#define MM40_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1243#define MM40_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1244#define MM40_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1245#define MM40_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1246#define MM40_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1247#define MM40_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1248
1249/*
1250 * GF20_PROT_CFG: GF20 Protection
1251 */
1252#define GF20_PROT_CFG 0x1374
1253#define GF20_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1254#define GF20_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
6f492b6d
ST
1255#define GF20_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1256#define GF20_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
b54f78a8
BZ
1257#define GF20_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1258#define GF20_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1259#define GF20_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1260#define GF20_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1261#define GF20_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1262#define GF20_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1263#define GF20_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1264
1265/*
1266 * GF40_PROT_CFG: GF40 Protection
1267 */
1268#define GF40_PROT_CFG 0x1378
1269#define GF40_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1270#define GF40_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
6f492b6d
ST
1271#define GF40_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1272#define GF40_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
b54f78a8
BZ
1273#define GF40_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1274#define GF40_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1275#define GF40_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1276#define GF40_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1277#define GF40_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1278#define GF40_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1279#define GF40_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1280
1281/*
1282 * EXP_CTS_TIME:
1283 */
1284#define EXP_CTS_TIME 0x137c
1285
1286/*
1287 * EXP_ACK_TIME:
1288 */
1289#define EXP_ACK_TIME 0x1380
1290
1291/*
1292 * RX_FILTER_CFG: RX configuration register.
1293 */
1294#define RX_FILTER_CFG 0x1400
1295#define RX_FILTER_CFG_DROP_CRC_ERROR FIELD32(0x00000001)
1296#define RX_FILTER_CFG_DROP_PHY_ERROR FIELD32(0x00000002)
1297#define RX_FILTER_CFG_DROP_NOT_TO_ME FIELD32(0x00000004)
1298#define RX_FILTER_CFG_DROP_NOT_MY_BSSD FIELD32(0x00000008)
1299#define RX_FILTER_CFG_DROP_VER_ERROR FIELD32(0x00000010)
1300#define RX_FILTER_CFG_DROP_MULTICAST FIELD32(0x00000020)
1301#define RX_FILTER_CFG_DROP_BROADCAST FIELD32(0x00000040)
1302#define RX_FILTER_CFG_DROP_DUPLICATE FIELD32(0x00000080)
1303#define RX_FILTER_CFG_DROP_CF_END_ACK FIELD32(0x00000100)
1304#define RX_FILTER_CFG_DROP_CF_END FIELD32(0x00000200)
1305#define RX_FILTER_CFG_DROP_ACK FIELD32(0x00000400)
1306#define RX_FILTER_CFG_DROP_CTS FIELD32(0x00000800)
1307#define RX_FILTER_CFG_DROP_RTS FIELD32(0x00001000)
1308#define RX_FILTER_CFG_DROP_PSPOLL FIELD32(0x00002000)
1309#define RX_FILTER_CFG_DROP_BA FIELD32(0x00004000)
1310#define RX_FILTER_CFG_DROP_BAR FIELD32(0x00008000)
1311#define RX_FILTER_CFG_DROP_CNTL FIELD32(0x00010000)
1312
1313/*
1314 * AUTO_RSP_CFG:
1315 * AUTORESPONDER: 0: disable, 1: enable
1316 * BAC_ACK_POLICY: 0:long, 1:short preamble
1317 * CTS_40_MMODE: Response CTS 40MHz duplicate mode
1318 * CTS_40_MREF: Response CTS 40MHz duplicate mode
1319 * AR_PREAMBLE: Auto responder preamble 0:long, 1:short preamble
1320 * DUAL_CTS_EN: Power bit value in control frame
1321 * ACK_CTS_PSM_BIT:Power bit value in control frame
1322 */
1323#define AUTO_RSP_CFG 0x1404
1324#define AUTO_RSP_CFG_AUTORESPONDER FIELD32(0x00000001)
1325#define AUTO_RSP_CFG_BAC_ACK_POLICY FIELD32(0x00000002)
1326#define AUTO_RSP_CFG_CTS_40_MMODE FIELD32(0x00000004)
1327#define AUTO_RSP_CFG_CTS_40_MREF FIELD32(0x00000008)
1328#define AUTO_RSP_CFG_AR_PREAMBLE FIELD32(0x00000010)
1329#define AUTO_RSP_CFG_DUAL_CTS_EN FIELD32(0x00000040)
1330#define AUTO_RSP_CFG_ACK_CTS_PSM_BIT FIELD32(0x00000080)
1331
1332/*
1333 * LEGACY_BASIC_RATE:
1334 */
1335#define LEGACY_BASIC_RATE 0x1408
1336
1337/*
1338 * HT_BASIC_RATE:
1339 */
1340#define HT_BASIC_RATE 0x140c
1341
1342/*
1343 * HT_CTRL_CFG:
1344 */
1345#define HT_CTRL_CFG 0x1410
1346
1347/*
1348 * SIFS_COST_CFG:
1349 */
1350#define SIFS_COST_CFG 0x1414
1351
1352/*
1353 * RX_PARSER_CFG:
1354 * Set NAV for all received frames
1355 */
1356#define RX_PARSER_CFG 0x1418
1357
1358/*
1359 * TX_SEC_CNT0:
1360 */
1361#define TX_SEC_CNT0 0x1500
1362
1363/*
1364 * RX_SEC_CNT0:
1365 */
1366#define RX_SEC_CNT0 0x1504
1367
1368/*
1369 * CCMP_FC_MUTE:
1370 */
1371#define CCMP_FC_MUTE 0x1508
1372
1373/*
1374 * TXOP_HLDR_ADDR0:
1375 */
1376#define TXOP_HLDR_ADDR0 0x1600
1377
1378/*
1379 * TXOP_HLDR_ADDR1:
1380 */
1381#define TXOP_HLDR_ADDR1 0x1604
1382
1383/*
1384 * TXOP_HLDR_ET:
1385 */
1386#define TXOP_HLDR_ET 0x1608
1387
1388/*
1389 * QOS_CFPOLL_RA_DW0:
1390 */
1391#define QOS_CFPOLL_RA_DW0 0x160c
1392
1393/*
1394 * QOS_CFPOLL_RA_DW1:
1395 */
1396#define QOS_CFPOLL_RA_DW1 0x1610
1397
1398/*
1399 * QOS_CFPOLL_QC:
1400 */
1401#define QOS_CFPOLL_QC 0x1614
1402
1403/*
1404 * RX_STA_CNT0: RX PLCP error count & RX CRC error count
1405 */
1406#define RX_STA_CNT0 0x1700
1407#define RX_STA_CNT0_CRC_ERR FIELD32(0x0000ffff)
1408#define RX_STA_CNT0_PHY_ERR FIELD32(0xffff0000)
1409
1410/*
1411 * RX_STA_CNT1: RX False CCA count & RX LONG frame count
1412 */
1413#define RX_STA_CNT1 0x1704
1414#define RX_STA_CNT1_FALSE_CCA FIELD32(0x0000ffff)
1415#define RX_STA_CNT1_PLCP_ERR FIELD32(0xffff0000)
1416
1417/*
1418 * RX_STA_CNT2:
1419 */
1420#define RX_STA_CNT2 0x1708
1421#define RX_STA_CNT2_RX_DUPLI_COUNT FIELD32(0x0000ffff)
1422#define RX_STA_CNT2_RX_FIFO_OVERFLOW FIELD32(0xffff0000)
1423
1424/*
1425 * TX_STA_CNT0: TX Beacon count
1426 */
1427#define TX_STA_CNT0 0x170c
1428#define TX_STA_CNT0_TX_FAIL_COUNT FIELD32(0x0000ffff)
1429#define TX_STA_CNT0_TX_BEACON_COUNT FIELD32(0xffff0000)
1430
1431/*
1432 * TX_STA_CNT1: TX tx count
1433 */
1434#define TX_STA_CNT1 0x1710
1435#define TX_STA_CNT1_TX_SUCCESS FIELD32(0x0000ffff)
1436#define TX_STA_CNT1_TX_RETRANSMIT FIELD32(0xffff0000)
1437
1438/*
1439 * TX_STA_CNT2: TX tx count
1440 */
1441#define TX_STA_CNT2 0x1714
1442#define TX_STA_CNT2_TX_ZERO_LEN_COUNT FIELD32(0x0000ffff)
1443#define TX_STA_CNT2_TX_UNDER_FLOW_COUNT FIELD32(0xffff0000)
1444
1445/*
0856d9c0
HS
1446 * TX_STA_FIFO: TX Result for specific PID status fifo register.
1447 *
1448 * This register is implemented as FIFO with 16 entries in the HW. Each
1449 * register read fetches the next tx result. If the FIFO is full because
1450 * it wasn't read fast enough after the according interrupt (TX_FIFO_STATUS)
1451 * triggered, the hw seems to simply drop further tx results.
1452 *
1453 * VALID: 1: this tx result is valid
1454 * 0: no valid tx result -> driver should stop reading
1455 * PID_TYPE: The PID latched from the PID field in the TXWI, can be used
1456 * to match a frame with its tx result (even though the PID is
1457 * only 4 bits wide).
bc8a979e
ID
1458 * PID_QUEUE: Part of PID_TYPE, this is the queue index number (0-3)
1459 * PID_ENTRY: Part of PID_TYPE, this is the queue entry index number (1-3)
1460 * This identification number is calculated by ((idx % 3) + 1).
0856d9c0
HS
1461 * TX_SUCCESS: Indicates tx success (1) or failure (0)
1462 * TX_AGGRE: Indicates if the frame was part of an aggregate (1) or not (0)
1463 * TX_ACK_REQUIRED: Indicates if the frame needed to get ack'ed (1) or not (0)
1464 * WCID: The wireless client ID.
1465 * MCS: The tx rate used during the last transmission of this frame, be it
1466 * successful or not.
1467 * PHYMODE: The phymode used for the transmission.
b54f78a8
BZ
1468 */
1469#define TX_STA_FIFO 0x1718
1470#define TX_STA_FIFO_VALID FIELD32(0x00000001)
1471#define TX_STA_FIFO_PID_TYPE FIELD32(0x0000001e)
bc8a979e
ID
1472#define TX_STA_FIFO_PID_QUEUE FIELD32(0x00000006)
1473#define TX_STA_FIFO_PID_ENTRY FIELD32(0x00000018)
b54f78a8
BZ
1474#define TX_STA_FIFO_TX_SUCCESS FIELD32(0x00000020)
1475#define TX_STA_FIFO_TX_AGGRE FIELD32(0x00000040)
1476#define TX_STA_FIFO_TX_ACK_REQUIRED FIELD32(0x00000080)
1477#define TX_STA_FIFO_WCID FIELD32(0x0000ff00)
1478#define TX_STA_FIFO_SUCCESS_RATE FIELD32(0xffff0000)
1479#define TX_STA_FIFO_MCS FIELD32(0x007f0000)
1480#define TX_STA_FIFO_PHYMODE FIELD32(0xc0000000)
1481
1482/*
1483 * TX_AGG_CNT: Debug counter
1484 */
1485#define TX_AGG_CNT 0x171c
1486#define TX_AGG_CNT_NON_AGG_TX_COUNT FIELD32(0x0000ffff)
1487#define TX_AGG_CNT_AGG_TX_COUNT FIELD32(0xffff0000)
1488
1489/*
1490 * TX_AGG_CNT0:
1491 */
1492#define TX_AGG_CNT0 0x1720
1493#define TX_AGG_CNT0_AGG_SIZE_1_COUNT FIELD32(0x0000ffff)
1494#define TX_AGG_CNT0_AGG_SIZE_2_COUNT FIELD32(0xffff0000)
1495
1496/*
1497 * TX_AGG_CNT1:
1498 */
1499#define TX_AGG_CNT1 0x1724
1500#define TX_AGG_CNT1_AGG_SIZE_3_COUNT FIELD32(0x0000ffff)
1501#define TX_AGG_CNT1_AGG_SIZE_4_COUNT FIELD32(0xffff0000)
1502
1503/*
1504 * TX_AGG_CNT2:
1505 */
1506#define TX_AGG_CNT2 0x1728
1507#define TX_AGG_CNT2_AGG_SIZE_5_COUNT FIELD32(0x0000ffff)
1508#define TX_AGG_CNT2_AGG_SIZE_6_COUNT FIELD32(0xffff0000)
1509
1510/*
1511 * TX_AGG_CNT3:
1512 */
1513#define TX_AGG_CNT3 0x172c
1514#define TX_AGG_CNT3_AGG_SIZE_7_COUNT FIELD32(0x0000ffff)
1515#define TX_AGG_CNT3_AGG_SIZE_8_COUNT FIELD32(0xffff0000)
1516
1517/*
1518 * TX_AGG_CNT4:
1519 */
1520#define TX_AGG_CNT4 0x1730
1521#define TX_AGG_CNT4_AGG_SIZE_9_COUNT FIELD32(0x0000ffff)
1522#define TX_AGG_CNT4_AGG_SIZE_10_COUNT FIELD32(0xffff0000)
1523
1524/*
1525 * TX_AGG_CNT5:
1526 */
1527#define TX_AGG_CNT5 0x1734
1528#define TX_AGG_CNT5_AGG_SIZE_11_COUNT FIELD32(0x0000ffff)
1529#define TX_AGG_CNT5_AGG_SIZE_12_COUNT FIELD32(0xffff0000)
1530
1531/*
1532 * TX_AGG_CNT6:
1533 */
1534#define TX_AGG_CNT6 0x1738
1535#define TX_AGG_CNT6_AGG_SIZE_13_COUNT FIELD32(0x0000ffff)
1536#define TX_AGG_CNT6_AGG_SIZE_14_COUNT FIELD32(0xffff0000)
1537
1538/*
1539 * TX_AGG_CNT7:
1540 */
1541#define TX_AGG_CNT7 0x173c
1542#define TX_AGG_CNT7_AGG_SIZE_15_COUNT FIELD32(0x0000ffff)
1543#define TX_AGG_CNT7_AGG_SIZE_16_COUNT FIELD32(0xffff0000)
1544
1545/*
1546 * MPDU_DENSITY_CNT:
1547 * TX_ZERO_DEL: TX zero length delimiter count
1548 * RX_ZERO_DEL: RX zero length delimiter count
1549 */
1550#define MPDU_DENSITY_CNT 0x1740
1551#define MPDU_DENSITY_CNT_TX_ZERO_DEL FIELD32(0x0000ffff)
1552#define MPDU_DENSITY_CNT_RX_ZERO_DEL FIELD32(0xffff0000)
1553
1554/*
1555 * Security key table memory.
2a0cfeb8
HS
1556 *
1557 * The pairwise key table shares some memory with the beacon frame
1558 * buffers 6 and 7. That basically means that when beacon 6 & 7
1559 * are used we should only use the reduced pairwise key table which
1560 * has a maximum of 222 entries.
1561 *
1562 * ---------------------------------------------
1563 * |0x4000 | Pairwise Key | Reduced Pairwise |
1564 * | | Table | Key Table |
1565 * | | Size: 256 * 32 | Size: 222 * 32 |
1566 * |0x5BC0 | |-------------------
1567 * | | | Beacon 6 |
1568 * |0x5DC0 | |-------------------
1569 * | | | Beacon 7 |
1570 * |0x5FC0 | |-------------------
1571 * |0x5FFF | |
1572 * --------------------------
1573 *
b54f78a8
BZ
1574 * MAC_WCID_BASE: 8-bytes (use only 6 bytes) * 256 entry
1575 * PAIRWISE_KEY_TABLE_BASE: 32-byte * 256 entry
1576 * MAC_IVEIV_TABLE_BASE: 8-byte * 256-entry
1577 * MAC_WCID_ATTRIBUTE_BASE: 4-byte * 256-entry
a4385213
BZ
1578 * SHARED_KEY_TABLE_BASE: 32-byte * 16-entry
1579 * SHARED_KEY_MODE_BASE: 4-byte * 16-entry
b54f78a8
BZ
1580 */
1581#define MAC_WCID_BASE 0x1800
1582#define PAIRWISE_KEY_TABLE_BASE 0x4000
1583#define MAC_IVEIV_TABLE_BASE 0x6000
1584#define MAC_WCID_ATTRIBUTE_BASE 0x6800
1585#define SHARED_KEY_TABLE_BASE 0x6c00
1586#define SHARED_KEY_MODE_BASE 0x7000
1587
1588#define MAC_WCID_ENTRY(__idx) \
fd8dab9a 1589 (MAC_WCID_BASE + ((__idx) * sizeof(struct mac_wcid_entry)))
b54f78a8 1590#define PAIRWISE_KEY_ENTRY(__idx) \
fd8dab9a 1591 (PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)))
b54f78a8 1592#define MAC_IVEIV_ENTRY(__idx) \
fd8dab9a 1593 (MAC_IVEIV_TABLE_BASE + ((__idx) * sizeof(struct mac_iveiv_entry)))
b54f78a8 1594#define MAC_WCID_ATTR_ENTRY(__idx) \
fd8dab9a 1595 (MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)))
b54f78a8 1596#define SHARED_KEY_ENTRY(__idx) \
fd8dab9a 1597 (SHARED_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)))
b54f78a8 1598#define SHARED_KEY_MODE_ENTRY(__idx) \
fd8dab9a 1599 (SHARED_KEY_MODE_BASE + ((__idx) * sizeof(u32)))
b54f78a8
BZ
1600
1601struct mac_wcid_entry {
1602 u8 mac[6];
1603 u8 reserved[2];
ba2d3587 1604} __packed;
b54f78a8
BZ
1605
1606struct hw_key_entry {
1607 u8 key[16];
1608 u8 tx_mic[8];
1609 u8 rx_mic[8];
ba2d3587 1610} __packed;
b54f78a8
BZ
1611
1612struct mac_iveiv_entry {
1613 u8 iv[8];
ba2d3587 1614} __packed;
b54f78a8
BZ
1615
1616/*
1617 * MAC_WCID_ATTRIBUTE:
1618 */
1619#define MAC_WCID_ATTRIBUTE_KEYTAB FIELD32(0x00000001)
1620#define MAC_WCID_ATTRIBUTE_CIPHER FIELD32(0x0000000e)
1621#define MAC_WCID_ATTRIBUTE_BSS_IDX FIELD32(0x00000070)
1622#define MAC_WCID_ATTRIBUTE_RX_WIUDF FIELD32(0x00000380)
e4a0ab34
ID
1623#define MAC_WCID_ATTRIBUTE_CIPHER_EXT FIELD32(0x00000400)
1624#define MAC_WCID_ATTRIBUTE_BSS_IDX_EXT FIELD32(0x00000800)
1625#define MAC_WCID_ATTRIBUTE_WAPI_MCBC FIELD32(0x00008000)
1626#define MAC_WCID_ATTRIBUTE_WAPI_KEY_IDX FIELD32(0xff000000)
b54f78a8
BZ
1627
1628/*
1629 * SHARED_KEY_MODE:
1630 */
1631#define SHARED_KEY_MODE_BSS0_KEY0 FIELD32(0x00000007)
1632#define SHARED_KEY_MODE_BSS0_KEY1 FIELD32(0x00000070)
1633#define SHARED_KEY_MODE_BSS0_KEY2 FIELD32(0x00000700)
1634#define SHARED_KEY_MODE_BSS0_KEY3 FIELD32(0x00007000)
1635#define SHARED_KEY_MODE_BSS1_KEY0 FIELD32(0x00070000)
1636#define SHARED_KEY_MODE_BSS1_KEY1 FIELD32(0x00700000)
1637#define SHARED_KEY_MODE_BSS1_KEY2 FIELD32(0x07000000)
1638#define SHARED_KEY_MODE_BSS1_KEY3 FIELD32(0x70000000)
1639
1640/*
1641 * HOST-MCU communication
1642 */
1643
1644/*
1645 * H2M_MAILBOX_CSR: Host-to-MCU Mailbox.
09a3311c 1646 * CMD_TOKEN: Command id, 0xff disable status reporting.
b54f78a8
BZ
1647 */
1648#define H2M_MAILBOX_CSR 0x7010
1649#define H2M_MAILBOX_CSR_ARG0 FIELD32(0x000000ff)
1650#define H2M_MAILBOX_CSR_ARG1 FIELD32(0x0000ff00)
1651#define H2M_MAILBOX_CSR_CMD_TOKEN FIELD32(0x00ff0000)
1652#define H2M_MAILBOX_CSR_OWNER FIELD32(0xff000000)
1653
1654/*
1655 * H2M_MAILBOX_CID:
09a3311c
JK
1656 * Free slots contain 0xff. MCU will store command's token to lowest free slot.
1657 * If all slots are occupied status will be dropped.
b54f78a8
BZ
1658 */
1659#define H2M_MAILBOX_CID 0x7014
1660#define H2M_MAILBOX_CID_CMD0 FIELD32(0x000000ff)
1661#define H2M_MAILBOX_CID_CMD1 FIELD32(0x0000ff00)
1662#define H2M_MAILBOX_CID_CMD2 FIELD32(0x00ff0000)
1663#define H2M_MAILBOX_CID_CMD3 FIELD32(0xff000000)
1664
1665/*
1666 * H2M_MAILBOX_STATUS:
09a3311c 1667 * Command status will be saved to same slot as command id.
b54f78a8
BZ
1668 */
1669#define H2M_MAILBOX_STATUS 0x701c
1670
1671/*
1672 * H2M_INT_SRC:
1673 */
1674#define H2M_INT_SRC 0x7024
1675
1676/*
1677 * H2M_BBP_AGENT:
1678 */
1679#define H2M_BBP_AGENT 0x7028
1680
1681/*
1682 * MCU_LEDCS: LED control for MCU Mailbox.
1683 */
1684#define MCU_LEDCS_LED_MODE FIELD8(0x1f)
1685#define MCU_LEDCS_POLARITY FIELD8(0x01)
1686
1687/*
1688 * HW_CS_CTS_BASE:
1689 * Carrier-sense CTS frame base address.
1690 * It's where mac stores carrier-sense frame for carrier-sense function.
1691 */
1692#define HW_CS_CTS_BASE 0x7700
1693
1694/*
1695 * HW_DFS_CTS_BASE:
a4385213 1696 * DFS CTS frame base address. It's where mac stores CTS frame for DFS.
b54f78a8
BZ
1697 */
1698#define HW_DFS_CTS_BASE 0x7780
1699
1700/*
1701 * TXRX control registers - base address 0x3000
1702 */
1703
1704/*
1705 * TXRX_CSR1:
1706 * rt2860b UNKNOWN reg use R/O Reg Addr 0x77d0 first..
1707 */
1708#define TXRX_CSR1 0x77d0
1709
1710/*
1711 * HW_DEBUG_SETTING_BASE:
1712 * since NULL frame won't be that long (256 byte)
1713 * We steal 16 tail bytes to save debugging settings
1714 */
1715#define HW_DEBUG_SETTING_BASE 0x77f0
1716#define HW_DEBUG_SETTING_BASE2 0x7770
1717
1718/*
1719 * HW_BEACON_BASE
1720 * In order to support maximum 8 MBSS and its maximum length
1721 * is 512 bytes for each beacon
1722 * Three section discontinue memory segments will be used.
1723 * 1. The original region for BCN 0~3
1724 * 2. Extract memory from FCE table for BCN 4~5
1725 * 3. Extract memory from Pair-wise key table for BCN 6~7
1726 * It occupied those memory of wcid 238~253 for BCN 6
2a0cfeb8
HS
1727 * and wcid 222~237 for BCN 7 (see Security key table memory
1728 * for more info).
b54f78a8
BZ
1729 *
1730 * IMPORTANT NOTE: Not sure why legacy driver does this,
1731 * but HW_BEACON_BASE7 is 0x0200 bytes below HW_BEACON_BASE6.
1732 */
1733#define HW_BEACON_BASE0 0x7800
1734#define HW_BEACON_BASE1 0x7a00
1735#define HW_BEACON_BASE2 0x7c00
1736#define HW_BEACON_BASE3 0x7e00
1737#define HW_BEACON_BASE4 0x7200
1738#define HW_BEACON_BASE5 0x7400
1739#define HW_BEACON_BASE6 0x5dc0
1740#define HW_BEACON_BASE7 0x5bc0
1741
1742#define HW_BEACON_OFFSET(__index) \
fd8dab9a
ME
1743 (((__index) < 4) ? (HW_BEACON_BASE0 + (__index * 0x0200)) : \
1744 (((__index) < 6) ? (HW_BEACON_BASE4 + ((__index - 4) * 0x0200)) : \
1745 (HW_BEACON_BASE6 - ((__index - 6) * 0x0200))))
b54f78a8
BZ
1746
1747/*
1748 * BBP registers.
1749 * The wordsize of the BBP is 8 bits.
1750 */
1751
1752/*
e90c54b2
RJH
1753 * BBP 1: TX Antenna & Power Control
1754 * POWER_CTRL:
1755 * 0 - normal,
1756 * 1 - drop tx power by 6dBm,
1757 * 2 - drop tx power by 12dBm,
1758 * 3 - increase tx power by 6dBm
1759 */
1760#define BBP1_TX_POWER_CTRL FIELD8(0x07)
b54f78a8
BZ
1761#define BBP1_TX_ANTENNA FIELD8(0x18)
1762
1763/*
1764 * BBP 3: RX Antenna
1765 */
872834df 1766#define BBP3_RX_ADC FIELD8(0x03)
b54f78a8 1767#define BBP3_RX_ANTENNA FIELD8(0x18)
a21ee724 1768#define BBP3_HT40_MINUS FIELD8(0x20)
b54f78a8
BZ
1769
1770/*
1771 * BBP 4: Bandwidth
1772 */
1773#define BBP4_TX_BF FIELD8(0x01)
1774#define BBP4_BANDWIDTH FIELD8(0x18)
adde5882 1775#define BBP4_MAC_IF_CTRL FIELD8(0x40)
60687ba7
RST
1776
1777/*
1778 * BBP 109
1779 */
adde5882
GJ
1780#define BBP109_TX0_POWER FIELD8(0x0f)
1781#define BBP109_TX1_POWER FIELD8(0xf0)
b54f78a8 1782
fab799c3
GW
1783/*
1784 * BBP 138: Unknown
1785 */
1786#define BBP138_RX_ADC1 FIELD8(0x02)
1787#define BBP138_RX_ADC2 FIELD8(0x04)
1788#define BBP138_TX_DAC1 FIELD8(0x20)
1789#define BBP138_TX_DAC2 FIELD8(0x40)
1790
60687ba7
RST
1791/*
1792 * BBP 152: Rx Ant
1793 */
adde5882 1794#define BBP152_RX_DEFAULT_ANT FIELD8(0x80)
60687ba7 1795
b54f78a8
BZ
1796/*
1797 * RFCSR registers
1798 * The wordsize of the RFCSR is 8 bits.
1799 */
1800
e148b4c8
GW
1801/*
1802 * RFCSR 1:
1803 */
1804#define RFCSR1_RF_BLOCK_EN FIELD8(0x01)
adde5882 1805#define RFCSR1_PLL_PD FIELD8(0x02)
e148b4c8
GW
1806#define RFCSR1_RX0_PD FIELD8(0x04)
1807#define RFCSR1_TX0_PD FIELD8(0x08)
1808#define RFCSR1_RX1_PD FIELD8(0x10)
1809#define RFCSR1_TX1_PD FIELD8(0x20)
872834df
GW
1810#define RFCSR1_RX2_PD FIELD8(0x40)
1811#define RFCSR1_TX2_PD FIELD8(0x80)
e148b4c8 1812
60687ba7
RST
1813/*
1814 * RFCSR 2:
1815 */
adde5882 1816#define RFCSR2_RESCAL_EN FIELD8(0x80)
60687ba7 1817
7f4666ab
SG
1818/*
1819 * RFCSR 3:
1820 */
1821#define RFCSR3_K FIELD8(0x0f)
268bd858
SG
1822/* Bits [7-4] for RF3320 (RT3370/RT3390), on other chipsets reserved */
1823#define RFCSR3_PA1_BIAS_CCK FIELD8(0x70);
1824#define RFCSR3_PA2_CASCODE_BIAS_CCKK FIELD8(0x80);
7f4666ab 1825
872834df
GW
1826/*
1827 * FRCSR 5:
1828 */
1829#define RFCSR5_R1 FIELD8(0x0c)
1830
b54f78a8
BZ
1831/*
1832 * RFCSR 6:
1833 */
fab799c3
GW
1834#define RFCSR6_R1 FIELD8(0x03)
1835#define RFCSR6_R2 FIELD8(0x40)
872834df 1836#define RFCSR6_TXDIV FIELD8(0x0c)
b54f78a8
BZ
1837
1838/*
1839 * RFCSR 7:
1840 */
1841#define RFCSR7_RF_TUNING FIELD8(0x01)
58b8ae14
GW
1842#define RFCSR7_BIT1 FIELD8(0x02)
1843#define RFCSR7_BIT2 FIELD8(0x04)
1844#define RFCSR7_BIT3 FIELD8(0x08)
1845#define RFCSR7_BIT4 FIELD8(0x10)
1846#define RFCSR7_BIT5 FIELD8(0x20)
1847#define RFCSR7_BITS67 FIELD8(0xc0)
b54f78a8 1848
60687ba7
RST
1849/*
1850 * RFCSR 11:
1851 */
adde5882 1852#define RFCSR11_R FIELD8(0x03)
60687ba7 1853
b54f78a8
BZ
1854/*
1855 * RFCSR 12:
1856 */
1857#define RFCSR12_TX_POWER FIELD8(0x1f)
872834df 1858#define RFCSR12_DR0 FIELD8(0xe0)
b54f78a8 1859
5a673964
HS
1860/*
1861 * RFCSR 13:
1862 */
1863#define RFCSR13_TX_POWER FIELD8(0x1f)
872834df 1864#define RFCSR13_DR0 FIELD8(0xe0)
5a673964 1865
e148b4c8
GW
1866/*
1867 * RFCSR 15:
1868 */
1869#define RFCSR15_TX_LO2_EN FIELD8(0x08)
1870
77c06c2c
GW
1871/*
1872 * RFCSR 16:
1873 */
1874#define RFCSR16_TXMIXER_GAIN FIELD8(0x07)
1875
fab799c3
GW
1876/*
1877 * RFCSR 17:
1878 */
e148b4c8
GW
1879#define RFCSR17_TXMIXER_GAIN FIELD8(0x07)
1880#define RFCSR17_TX_LO1_EN FIELD8(0x08)
1881#define RFCSR17_R FIELD8(0x20)
60687ba7 1882#define RFCSR17_CODE FIELD8(0x7f)
fab799c3 1883
e148b4c8
GW
1884/*
1885 * RFCSR 20:
1886 */
1887#define RFCSR20_RX_LO1_EN FIELD8(0x08)
1888
1889/*
1890 * RFCSR 21:
1891 */
1892#define RFCSR21_RX_LO2_EN FIELD8(0x08)
fab799c3 1893
b54f78a8
BZ
1894/*
1895 * RFCSR 22:
1896 */
1897#define RFCSR22_BASEBAND_LOOPBACK FIELD8(0x01)
1898
1899/*
1900 * RFCSR 23:
1901 */
1902#define RFCSR23_FREQ_OFFSET FIELD8(0x7f)
1903
f1f12f98
SG
1904/*
1905 * RFCSR 24:
1906 */
1907#define RFCSR24_TX_AGC_FC FIELD8(0x1f)
1908#define RFCSR24_TX_H20M FIELD8(0x20)
1909#define RFCSR24_TX_CALIB FIELD8(0x7f)
1910
e148b4c8
GW
1911/*
1912 * RFCSR 27:
1913 */
1914#define RFCSR27_R1 FIELD8(0x03)
1915#define RFCSR27_R2 FIELD8(0x04)
1916#define RFCSR27_R3 FIELD8(0x30)
1917#define RFCSR27_R4 FIELD8(0x40)
1918
b54f78a8
BZ
1919/*
1920 * RFCSR 30:
1921 */
adde5882
GJ
1922#define RFCSR30_TX_H20M FIELD8(0x02)
1923#define RFCSR30_RX_H20M FIELD8(0x04)
1924#define RFCSR30_RX_VCM FIELD8(0x18)
b54f78a8
BZ
1925#define RFCSR30_RF_CALIBRATION FIELD8(0x80)
1926
80d184e6
RJH
1927/*
1928 * RFCSR 31:
1929 */
1930#define RFCSR31_RX_AGC_FC FIELD8(0x1f)
1931#define RFCSR31_RX_H20M FIELD8(0x20)
f1f12f98 1932#define RFCSR31_RX_CALIB FIELD8(0x7f)
80d184e6 1933
60687ba7
RST
1934/*
1935 * RFCSR 38:
1936 */
adde5882 1937#define RFCSR38_RX_LO1_EN FIELD8(0x20)
60687ba7
RST
1938
1939/*
1940 * RFCSR 39:
1941 */
adde5882 1942#define RFCSR39_RX_LO2_EN FIELD8(0x80)
60687ba7
RST
1943
1944/*
1945 * RFCSR 49:
1946 */
adde5882 1947#define RFCSR49_TX FIELD8(0x3f)
60687ba7 1948
cff3d1f0
ZL
1949/*
1950 * RFCSR 50:
1951 */
1952#define RFCSR50_TX FIELD8(0x3f)
1953
b54f78a8
BZ
1954/*
1955 * RF registers
1956 */
1957
1958/*
1959 * RF 2
1960 */
1961#define RF2_ANTENNA_RX2 FIELD32(0x00000040)
1962#define RF2_ANTENNA_TX1 FIELD32(0x00004000)
1963#define RF2_ANTENNA_RX1 FIELD32(0x00020000)
1964
1965/*
1966 * RF 3
1967 */
1968#define RF3_TXPOWER_G FIELD32(0x00003e00)
1969#define RF3_TXPOWER_A_7DBM_BOOST FIELD32(0x00000200)
1970#define RF3_TXPOWER_A FIELD32(0x00003c00)
1971
1972/*
1973 * RF 4
1974 */
1975#define RF4_TXPOWER_G FIELD32(0x000007c0)
1976#define RF4_TXPOWER_A_7DBM_BOOST FIELD32(0x00000040)
1977#define RF4_TXPOWER_A FIELD32(0x00000780)
1978#define RF4_FREQ_OFFSET FIELD32(0x001f8000)
1979#define RF4_HT40 FIELD32(0x00200000)
1980
1981/*
1982 * EEPROM content.
1983 * The wordsize of the EEPROM is 16 bits.
1984 */
1985
60687ba7
RST
1986/*
1987 * Chip ID
1988 */
adde5882 1989#define EEPROM_CHIP_ID 0x0000
60687ba7 1990
b54f78a8
BZ
1991/*
1992 * EEPROM Version
1993 */
1994#define EEPROM_VERSION 0x0001
1995#define EEPROM_VERSION_FAE FIELD16(0x00ff)
1996#define EEPROM_VERSION_VERSION FIELD16(0xff00)
1997
1998/*
1999 * HW MAC address.
2000 */
2001#define EEPROM_MAC_ADDR_0 0x0002
2002#define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff)
2003#define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00)
2004#define EEPROM_MAC_ADDR_1 0x0003
2005#define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff)
2006#define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00)
2007#define EEPROM_MAC_ADDR_2 0x0004
2008#define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff)
2009#define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00)
2010
2011/*
38c8a566 2012 * EEPROM NIC Configuration 0
b54f78a8 2013 * RXPATH: 1: 1R, 2: 2R, 3: 3R
38c8a566
RJH
2014 * TXPATH: 1: 1T, 2: 2T, 3: 3T
2015 * RF_TYPE: RFIC type
2016 */
2017#define EEPROM_NIC_CONF0 0x001a
2018#define EEPROM_NIC_CONF0_RXPATH FIELD16(0x000f)
2019#define EEPROM_NIC_CONF0_TXPATH FIELD16(0x00f0)
2020#define EEPROM_NIC_CONF0_RF_TYPE FIELD16(0x0f00)
2021
2022/*
2023 * EEPROM NIC Configuration 1
2024 * HW_RADIO: 0: disable, 1: enable
2025 * EXTERNAL_TX_ALC: 0: disable, 1: enable
2026 * EXTERNAL_LNA_2G: 0: disable, 1: enable
2027 * EXTERNAL_LNA_5G: 0: disable, 1: enable
2028 * CARDBUS_ACCEL: 0: enable, 1: disable
2029 * BW40M_SB_2G: 0: disable, 1: enable
2030 * BW40M_SB_5G: 0: disable, 1: enable
2031 * WPS_PBC: 0: disable, 1: enable
2032 * BW40M_2G: 0: enable, 1: disable
2033 * BW40M_5G: 0: enable, 1: disable
2034 * BROADBAND_EXT_LNA: 0: disable, 1: enable
2035 * ANT_DIVERSITY: 00: Disable, 01: Diversity,
2036 * 10: Main antenna, 11: Aux antenna
2037 * INTERNAL_TX_ALC: 0: disable, 1: enable
2038 * BT_COEXIST: 0: disable, 1: enable
2039 * DAC_TEST: 0: disable, 1: enable
2040 */
2041#define EEPROM_NIC_CONF1 0x001b
2042#define EEPROM_NIC_CONF1_HW_RADIO FIELD16(0x0001)
2043#define EEPROM_NIC_CONF1_EXTERNAL_TX_ALC FIELD16(0x0002)
2044#define EEPROM_NIC_CONF1_EXTERNAL_LNA_2G FIELD16(0x0004)
2045#define EEPROM_NIC_CONF1_EXTERNAL_LNA_5G FIELD16(0x0008)
2046#define EEPROM_NIC_CONF1_CARDBUS_ACCEL FIELD16(0x0010)
2047#define EEPROM_NIC_CONF1_BW40M_SB_2G FIELD16(0x0020)
2048#define EEPROM_NIC_CONF1_BW40M_SB_5G FIELD16(0x0040)
2049#define EEPROM_NIC_CONF1_WPS_PBC FIELD16(0x0080)
2050#define EEPROM_NIC_CONF1_BW40M_2G FIELD16(0x0100)
2051#define EEPROM_NIC_CONF1_BW40M_5G FIELD16(0x0200)
2052#define EEPROM_NIC_CONF1_BROADBAND_EXT_LNA FIELD16(0x400)
2053#define EEPROM_NIC_CONF1_ANT_DIVERSITY FIELD16(0x1800)
2054#define EEPROM_NIC_CONF1_INTERNAL_TX_ALC FIELD16(0x2000)
2055#define EEPROM_NIC_CONF1_BT_COEXIST FIELD16(0x4000)
2056#define EEPROM_NIC_CONF1_DAC_TEST FIELD16(0x8000)
b54f78a8
BZ
2057
2058/*
2059 * EEPROM frequency
2060 */
2061#define EEPROM_FREQ 0x001d
2062#define EEPROM_FREQ_OFFSET FIELD16(0x00ff)
2063#define EEPROM_FREQ_LED_MODE FIELD16(0x7f00)
2064#define EEPROM_FREQ_LED_POLARITY FIELD16(0x1000)
2065
2066/*
2067 * EEPROM LED
2068 * POLARITY_RDY_G: Polarity RDY_G setting.
2069 * POLARITY_RDY_A: Polarity RDY_A setting.
2070 * POLARITY_ACT: Polarity ACT setting.
2071 * POLARITY_GPIO_0: Polarity GPIO0 setting.
2072 * POLARITY_GPIO_1: Polarity GPIO1 setting.
2073 * POLARITY_GPIO_2: Polarity GPIO2 setting.
2074 * POLARITY_GPIO_3: Polarity GPIO3 setting.
2075 * POLARITY_GPIO_4: Polarity GPIO4 setting.
2076 * LED_MODE: Led mode.
2077 */
38c8a566
RJH
2078#define EEPROM_LED_AG_CONF 0x001e
2079#define EEPROM_LED_ACT_CONF 0x001f
2080#define EEPROM_LED_POLARITY 0x0020
b54f78a8
BZ
2081#define EEPROM_LED_POLARITY_RDY_BG FIELD16(0x0001)
2082#define EEPROM_LED_POLARITY_RDY_A FIELD16(0x0002)
2083#define EEPROM_LED_POLARITY_ACT FIELD16(0x0004)
2084#define EEPROM_LED_POLARITY_GPIO_0 FIELD16(0x0008)
2085#define EEPROM_LED_POLARITY_GPIO_1 FIELD16(0x0010)
2086#define EEPROM_LED_POLARITY_GPIO_2 FIELD16(0x0020)
2087#define EEPROM_LED_POLARITY_GPIO_3 FIELD16(0x0040)
2088#define EEPROM_LED_POLARITY_GPIO_4 FIELD16(0x0080)
2089#define EEPROM_LED_LED_MODE FIELD16(0x1f00)
2090
38c8a566
RJH
2091/*
2092 * EEPROM NIC Configuration 2
2093 * RX_STREAM: 0: Reserved, 1: 1 Stream, 2: 2 Stream
2094 * TX_STREAM: 0: Reserved, 1: 1 Stream, 2: 2 Stream
2095 * CRYSTAL: 00: Reserved, 01: One crystal, 10: Two crystal, 11: Reserved
2096 */
2097#define EEPROM_NIC_CONF2 0x0021
2098#define EEPROM_NIC_CONF2_RX_STREAM FIELD16(0x000f)
2099#define EEPROM_NIC_CONF2_TX_STREAM FIELD16(0x00f0)
2100#define EEPROM_NIC_CONF2_CRYSTAL FIELD16(0x0600)
2101
b54f78a8
BZ
2102/*
2103 * EEPROM LNA
2104 */
2105#define EEPROM_LNA 0x0022
2106#define EEPROM_LNA_BG FIELD16(0x00ff)
2107#define EEPROM_LNA_A0 FIELD16(0xff00)
2108
2109/*
2110 * EEPROM RSSI BG offset
2111 */
2112#define EEPROM_RSSI_BG 0x0023
2113#define EEPROM_RSSI_BG_OFFSET0 FIELD16(0x00ff)
2114#define EEPROM_RSSI_BG_OFFSET1 FIELD16(0xff00)
2115
2116/*
2117 * EEPROM RSSI BG2 offset
2118 */
2119#define EEPROM_RSSI_BG2 0x0024
2120#define EEPROM_RSSI_BG2_OFFSET2 FIELD16(0x00ff)
2121#define EEPROM_RSSI_BG2_LNA_A1 FIELD16(0xff00)
2122
e148b4c8
GW
2123/*
2124 * EEPROM TXMIXER GAIN BG offset (note overlaps with EEPROM RSSI BG2).
2125 */
2126#define EEPROM_TXMIXER_GAIN_BG 0x0024
2127#define EEPROM_TXMIXER_GAIN_BG_VAL FIELD16(0x0007)
2128
b54f78a8
BZ
2129/*
2130 * EEPROM RSSI A offset
2131 */
2132#define EEPROM_RSSI_A 0x0025
2133#define EEPROM_RSSI_A_OFFSET0 FIELD16(0x00ff)
2134#define EEPROM_RSSI_A_OFFSET1 FIELD16(0xff00)
2135
2136/*
2137 * EEPROM RSSI A2 offset
2138 */
2139#define EEPROM_RSSI_A2 0x0026
2140#define EEPROM_RSSI_A2_OFFSET2 FIELD16(0x00ff)
2141#define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00)
2142
77c06c2c
GW
2143/*
2144 * EEPROM TXMIXER GAIN A offset (note overlaps with EEPROM RSSI A2).
2145 */
2146#define EEPROM_TXMIXER_GAIN_A 0x0026
2147#define EEPROM_TXMIXER_GAIN_A_VAL FIELD16(0x0007)
2148
8d1331b3 2149/*
e90c54b2 2150 * EEPROM EIRP Maximum TX power values(unit: dbm)
8d1331b3 2151 */
e90c54b2
RJH
2152#define EEPROM_EIRP_MAX_TX_POWER 0x0027
2153#define EEPROM_EIRP_MAX_TX_POWER_2GHZ FIELD16(0x00ff)
2154#define EEPROM_EIRP_MAX_TX_POWER_5GHZ FIELD16(0xff00)
8d1331b3 2155
b54f78a8
BZ
2156/*
2157 * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power.
38c8a566 2158 * This is delta in 40MHZ.
e90c54b2 2159 * VALUE: Tx Power dalta value, MAX=4(unit: dbm)
b54f78a8 2160 * TYPE: 1: Plus the delta value, 0: minus the delta value
e90c54b2 2161 * ENABLE: enable tx power compensation for 40BW
b54f78a8
BZ
2162 */
2163#define EEPROM_TXPOWER_DELTA 0x0028
e90c54b2
RJH
2164#define EEPROM_TXPOWER_DELTA_VALUE_2G FIELD16(0x003f)
2165#define EEPROM_TXPOWER_DELTA_TYPE_2G FIELD16(0x0040)
2166#define EEPROM_TXPOWER_DELTA_ENABLE_2G FIELD16(0x0080)
2167#define EEPROM_TXPOWER_DELTA_VALUE_5G FIELD16(0x3f00)
2168#define EEPROM_TXPOWER_DELTA_TYPE_5G FIELD16(0x4000)
2169#define EEPROM_TXPOWER_DELTA_ENABLE_5G FIELD16(0x8000)
b54f78a8
BZ
2170
2171/*
2172 * EEPROM TXPOWER 802.11BG
2173 */
2174#define EEPROM_TXPOWER_BG1 0x0029
2175#define EEPROM_TXPOWER_BG2 0x0030
2176#define EEPROM_TXPOWER_BG_SIZE 7
2177#define EEPROM_TXPOWER_BG_1 FIELD16(0x00ff)
2178#define EEPROM_TXPOWER_BG_2 FIELD16(0xff00)
2179
9e33a355
HS
2180/*
2181 * EEPROM temperature compensation boundaries 802.11BG
2182 * MINUS4: If the actual TSSI is below this boundary, tx power needs to be
2183 * reduced by (agc_step * -4)
2184 * MINUS3: If the actual TSSI is below this boundary, tx power needs to be
2185 * reduced by (agc_step * -3)
2186 */
2187#define EEPROM_TSSI_BOUND_BG1 0x0037
2188#define EEPROM_TSSI_BOUND_BG1_MINUS4 FIELD16(0x00ff)
2189#define EEPROM_TSSI_BOUND_BG1_MINUS3 FIELD16(0xff00)
2190
2191/*
2192 * EEPROM temperature compensation boundaries 802.11BG
2193 * MINUS2: If the actual TSSI is below this boundary, tx power needs to be
2194 * reduced by (agc_step * -2)
2195 * MINUS1: If the actual TSSI is below this boundary, tx power needs to be
2196 * reduced by (agc_step * -1)
2197 */
2198#define EEPROM_TSSI_BOUND_BG2 0x0038
2199#define EEPROM_TSSI_BOUND_BG2_MINUS2 FIELD16(0x00ff)
2200#define EEPROM_TSSI_BOUND_BG2_MINUS1 FIELD16(0xff00)
2201
2202/*
2203 * EEPROM temperature compensation boundaries 802.11BG
2204 * REF: Reference TSSI value, no tx power changes needed
2205 * PLUS1: If the actual TSSI is above this boundary, tx power needs to be
2206 * increased by (agc_step * 1)
2207 */
2208#define EEPROM_TSSI_BOUND_BG3 0x0039
2209#define EEPROM_TSSI_BOUND_BG3_REF FIELD16(0x00ff)
2210#define EEPROM_TSSI_BOUND_BG3_PLUS1 FIELD16(0xff00)
2211
2212/*
2213 * EEPROM temperature compensation boundaries 802.11BG
2214 * PLUS2: If the actual TSSI is above this boundary, tx power needs to be
2215 * increased by (agc_step * 2)
2216 * PLUS3: If the actual TSSI is above this boundary, tx power needs to be
2217 * increased by (agc_step * 3)
2218 */
2219#define EEPROM_TSSI_BOUND_BG4 0x003a
2220#define EEPROM_TSSI_BOUND_BG4_PLUS2 FIELD16(0x00ff)
2221#define EEPROM_TSSI_BOUND_BG4_PLUS3 FIELD16(0xff00)
2222
2223/*
2224 * EEPROM temperature compensation boundaries 802.11BG
2225 * PLUS4: If the actual TSSI is above this boundary, tx power needs to be
2226 * increased by (agc_step * 4)
2227 * AGC_STEP: Temperature compensation step.
2228 */
2229#define EEPROM_TSSI_BOUND_BG5 0x003b
2230#define EEPROM_TSSI_BOUND_BG5_PLUS4 FIELD16(0x00ff)
2231#define EEPROM_TSSI_BOUND_BG5_AGC_STEP FIELD16(0xff00)
2232
b54f78a8
BZ
2233/*
2234 * EEPROM TXPOWER 802.11A
2235 */
2236#define EEPROM_TXPOWER_A1 0x003c
2237#define EEPROM_TXPOWER_A2 0x0053
2238#define EEPROM_TXPOWER_A_SIZE 6
2239#define EEPROM_TXPOWER_A_1 FIELD16(0x00ff)
2240#define EEPROM_TXPOWER_A_2 FIELD16(0xff00)
2241
9e33a355
HS
2242/*
2243 * EEPROM temperature compensation boundaries 802.11A
2244 * MINUS4: If the actual TSSI is below this boundary, tx power needs to be
2245 * reduced by (agc_step * -4)
2246 * MINUS3: If the actual TSSI is below this boundary, tx power needs to be
2247 * reduced by (agc_step * -3)
2248 */
2249#define EEPROM_TSSI_BOUND_A1 0x006a
2250#define EEPROM_TSSI_BOUND_A1_MINUS4 FIELD16(0x00ff)
2251#define EEPROM_TSSI_BOUND_A1_MINUS3 FIELD16(0xff00)
2252
2253/*
2254 * EEPROM temperature compensation boundaries 802.11A
2255 * MINUS2: If the actual TSSI is below this boundary, tx power needs to be
2256 * reduced by (agc_step * -2)
2257 * MINUS1: If the actual TSSI is below this boundary, tx power needs to be
2258 * reduced by (agc_step * -1)
2259 */
2260#define EEPROM_TSSI_BOUND_A2 0x006b
2261#define EEPROM_TSSI_BOUND_A2_MINUS2 FIELD16(0x00ff)
2262#define EEPROM_TSSI_BOUND_A2_MINUS1 FIELD16(0xff00)
2263
2264/*
2265 * EEPROM temperature compensation boundaries 802.11A
2266 * REF: Reference TSSI value, no tx power changes needed
2267 * PLUS1: If the actual TSSI is above this boundary, tx power needs to be
2268 * increased by (agc_step * 1)
2269 */
2270#define EEPROM_TSSI_BOUND_A3 0x006c
2271#define EEPROM_TSSI_BOUND_A3_REF FIELD16(0x00ff)
2272#define EEPROM_TSSI_BOUND_A3_PLUS1 FIELD16(0xff00)
2273
2274/*
2275 * EEPROM temperature compensation boundaries 802.11A
2276 * PLUS2: If the actual TSSI is above this boundary, tx power needs to be
2277 * increased by (agc_step * 2)
2278 * PLUS3: If the actual TSSI is above this boundary, tx power needs to be
2279 * increased by (agc_step * 3)
2280 */
2281#define EEPROM_TSSI_BOUND_A4 0x006d
2282#define EEPROM_TSSI_BOUND_A4_PLUS2 FIELD16(0x00ff)
2283#define EEPROM_TSSI_BOUND_A4_PLUS3 FIELD16(0xff00)
2284
2285/*
2286 * EEPROM temperature compensation boundaries 802.11A
2287 * PLUS4: If the actual TSSI is above this boundary, tx power needs to be
2288 * increased by (agc_step * 4)
2289 * AGC_STEP: Temperature compensation step.
2290 */
2291#define EEPROM_TSSI_BOUND_A5 0x006e
2292#define EEPROM_TSSI_BOUND_A5_PLUS4 FIELD16(0x00ff)
2293#define EEPROM_TSSI_BOUND_A5_AGC_STEP FIELD16(0xff00)
2294
b54f78a8 2295/*
5e846004 2296 * EEPROM TXPOWER by rate: tx power per tx rate for HT20 mode
b54f78a8
BZ
2297 */
2298#define EEPROM_TXPOWER_BYRATE 0x006f
5e846004
HS
2299#define EEPROM_TXPOWER_BYRATE_SIZE 9
2300
2301#define EEPROM_TXPOWER_BYRATE_RATE0 FIELD16(0x000f)
2302#define EEPROM_TXPOWER_BYRATE_RATE1 FIELD16(0x00f0)
2303#define EEPROM_TXPOWER_BYRATE_RATE2 FIELD16(0x0f00)
2304#define EEPROM_TXPOWER_BYRATE_RATE3 FIELD16(0xf000)
b54f78a8
BZ
2305
2306/*
2307 * EEPROM BBP.
2308 */
2309#define EEPROM_BBP_START 0x0078
2310#define EEPROM_BBP_SIZE 16
2311#define EEPROM_BBP_VALUE FIELD16(0x00ff)
2312#define EEPROM_BBP_REG_ID FIELD16(0xff00)
2313
2314/*
2315 * MCU mailbox commands.
09a3311c
JK
2316 * MCU_SLEEP - go to power-save mode.
2317 * arg1: 1: save as much power as possible, 0: save less power.
2318 * status: 1: success, 2: already asleep,
2319 * 3: maybe MAC is busy so can't finish this task.
2320 * MCU_RADIO_OFF
2321 * arg0: 0: do power-saving, NOT turn off radio.
b54f78a8
BZ
2322 */
2323#define MCU_SLEEP 0x30
2324#define MCU_WAKEUP 0x31
2325#define MCU_RADIO_OFF 0x35
2326#define MCU_CURRENT 0x36
2327#define MCU_LED 0x50
2328#define MCU_LED_STRENGTH 0x51
38c8a566
RJH
2329#define MCU_LED_AG_CONF 0x52
2330#define MCU_LED_ACT_CONF 0x53
2331#define MCU_LED_LED_POLARITY 0x54
b54f78a8
BZ
2332#define MCU_RADAR 0x60
2333#define MCU_BOOT_SIGNAL 0x72
d96aa640 2334#define MCU_ANT_SELECT 0X73
b54f78a8
BZ
2335#define MCU_BBP_SIGNAL 0x80
2336#define MCU_POWER_SAVE 0x83
872834df 2337#define MCU_BAND_SELECT 0x91
b54f78a8
BZ
2338
2339/*
2340 * MCU mailbox tokens
2341 */
09a3311c
JK
2342#define TOKEN_SLEEP 1
2343#define TOKEN_RADIO_OFF 2
2344#define TOKEN_WAKEUP 3
2345
b54f78a8
BZ
2346
2347/*
2348 * DMA descriptor defines.
2349 */
fd8dab9a
ME
2350#define TXWI_DESC_SIZE (4 * sizeof(__le32))
2351#define RXWI_DESC_SIZE (4 * sizeof(__le32))
b54f78a8
BZ
2352
2353/*
2354 * TX WI structure
2355 */
2356
2357/*
2358 * Word0
2359 * FRAG: 1 To inform TKIP engine this is a fragment.
2360 * MIMO_PS: The remote peer is in dynamic MIMO-PS mode
2361 * TX_OP: 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs
cb753b72
HS
2362 * BW: Channel bandwidth 0:20MHz, 1:40 MHz (for legacy rates this will
2363 * duplicate the frame to both channels).
b54f78a8 2364 * STBC: 1: STBC support MCS =0-7, 2,3 : RESERVED
2035c0cf 2365 * AMPDU: 1: this frame is eligible for AMPDU aggregation, the hw will
74ee3802
HS
2366 * aggregate consecutive frames with the same RA and QoS TID. If
2367 * a frame A with the same RA and QoS TID but AMPDU=0 is queued
2368 * directly after a frame B with AMPDU=1, frame A might still
2369 * get aggregated into the AMPDU started by frame B. So, setting
2370 * AMPDU to 0 does _not_ necessarily mean the frame is sent as
2371 * MPDU, it can still end up in an AMPDU if the previous frame
2372 * was tagged as AMPDU.
b54f78a8
BZ
2373 */
2374#define TXWI_W0_FRAG FIELD32(0x00000001)
2375#define TXWI_W0_MIMO_PS FIELD32(0x00000002)
2376#define TXWI_W0_CF_ACK FIELD32(0x00000004)
2377#define TXWI_W0_TS FIELD32(0x00000008)
2378#define TXWI_W0_AMPDU FIELD32(0x00000010)
2379#define TXWI_W0_MPDU_DENSITY FIELD32(0x000000e0)
2380#define TXWI_W0_TX_OP FIELD32(0x00000300)
2381#define TXWI_W0_MCS FIELD32(0x007f0000)
2382#define TXWI_W0_BW FIELD32(0x00800000)
2383#define TXWI_W0_SHORT_GI FIELD32(0x01000000)
2384#define TXWI_W0_STBC FIELD32(0x06000000)
2385#define TXWI_W0_IFS FIELD32(0x08000000)
2386#define TXWI_W0_PHYMODE FIELD32(0xc0000000)
2387
2388/*
2389 * Word1
0856d9c0
HS
2390 * ACK: 0: No Ack needed, 1: Ack needed
2391 * NSEQ: 0: Don't assign hw sequence number, 1: Assign hw sequence number
2392 * BW_WIN_SIZE: BA windows size of the recipient
2393 * WIRELESS_CLI_ID: Client ID for WCID table access
2394 * MPDU_TOTAL_BYTE_COUNT: Length of 802.11 frame
2395 * PACKETID: Will be latched into the TX_STA_FIFO register once the according
2035c0cf
HS
2396 * frame was processed. If multiple frames are aggregated together
2397 * (AMPDU==1) the reported tx status will always contain the packet
2398 * id of the first frame. 0: Don't report tx status for this frame.
bc8a979e
ID
2399 * PACKETID_QUEUE: Part of PACKETID, This is the queue index (0-3)
2400 * PACKETID_ENTRY: Part of PACKETID, THis is the queue entry index (1-3)
2401 * This identification number is calculated by ((idx % 3) + 1).
2402 * The (+1) is required to prevent PACKETID to become 0.
b54f78a8
BZ
2403 */
2404#define TXWI_W1_ACK FIELD32(0x00000001)
2405#define TXWI_W1_NSEQ FIELD32(0x00000002)
2406#define TXWI_W1_BW_WIN_SIZE FIELD32(0x000000fc)
2407#define TXWI_W1_WIRELESS_CLI_ID FIELD32(0x0000ff00)
2408#define TXWI_W1_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000)
2409#define TXWI_W1_PACKETID FIELD32(0xf0000000)
bc8a979e
ID
2410#define TXWI_W1_PACKETID_QUEUE FIELD32(0x30000000)
2411#define TXWI_W1_PACKETID_ENTRY FIELD32(0xc0000000)
b54f78a8
BZ
2412
2413/*
2414 * Word2
2415 */
2416#define TXWI_W2_IV FIELD32(0xffffffff)
2417
2418/*
2419 * Word3
2420 */
2421#define TXWI_W3_EIV FIELD32(0xffffffff)
2422
2423/*
2424 * RX WI structure
2425 */
2426
2427/*
2428 * Word0
2429 */
2430#define RXWI_W0_WIRELESS_CLI_ID FIELD32(0x000000ff)
2431#define RXWI_W0_KEY_INDEX FIELD32(0x00000300)
2432#define RXWI_W0_BSSID FIELD32(0x00001c00)
2433#define RXWI_W0_UDF FIELD32(0x0000e000)
2434#define RXWI_W0_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000)
2435#define RXWI_W0_TID FIELD32(0xf0000000)
2436
2437/*
2438 * Word1
2439 */
2440#define RXWI_W1_FRAG FIELD32(0x0000000f)
2441#define RXWI_W1_SEQUENCE FIELD32(0x0000fff0)
2442#define RXWI_W1_MCS FIELD32(0x007f0000)
2443#define RXWI_W1_BW FIELD32(0x00800000)
2444#define RXWI_W1_SHORT_GI FIELD32(0x01000000)
2445#define RXWI_W1_STBC FIELD32(0x06000000)
2446#define RXWI_W1_PHYMODE FIELD32(0xc0000000)
2447
2448/*
2449 * Word2
2450 */
2451#define RXWI_W2_RSSI0 FIELD32(0x000000ff)
2452#define RXWI_W2_RSSI1 FIELD32(0x0000ff00)
2453#define RXWI_W2_RSSI2 FIELD32(0x00ff0000)
2454
2455/*
2456 * Word3
2457 */
2458#define RXWI_W3_SNR0 FIELD32(0x000000ff)
2459#define RXWI_W3_SNR1 FIELD32(0x0000ff00)
2460
2461/*
2462 * Macros for converting txpower from EEPROM to mac80211 value
2463 * and from mac80211 value to register value.
2464 */
2465#define MIN_G_TXPOWER 0
2466#define MIN_A_TXPOWER -7
2467#define MAX_G_TXPOWER 31
2468#define MAX_A_TXPOWER 15
2469#define DEFAULT_TXPOWER 5
2470
2471#define TXPOWER_G_FROM_DEV(__txpower) \
2472 ((__txpower) > MAX_G_TXPOWER) ? DEFAULT_TXPOWER : (__txpower)
2473
2474#define TXPOWER_G_TO_DEV(__txpower) \
2475 clamp_t(char, __txpower, MIN_G_TXPOWER, MAX_G_TXPOWER)
2476
2477#define TXPOWER_A_FROM_DEV(__txpower) \
2478 ((__txpower) > MAX_A_TXPOWER) ? DEFAULT_TXPOWER : (__txpower)
2479
2480#define TXPOWER_A_TO_DEV(__txpower) \
2481 clamp_t(char, __txpower, MIN_A_TXPOWER, MAX_A_TXPOWER)
2482
e90c54b2
RJH
2483/*
2484 * Board's maximun TX power limitation
2485 */
2486#define EIRP_MAX_TX_POWER_LIMIT 0x50
2487
290d6089
HS
2488/*
2489 * Number of TBTT intervals after which we have to adjust
2490 * the hw beacon timer.
2491 */
2492#define BCN_TBTT_OFFSET 64
2493
3a1c0128
GW
2494/*
2495 * RT2800 driver data structure
2496 */
2497struct rt2800_drv_data {
2498 u8 calibration_bw20;
2499 u8 calibration_bw40;
5d137dff
GW
2500 u8 bbp25;
2501 u8 bbp26;
77c06c2c
GW
2502 u8 txmixer_gain_24g;
2503 u8 txmixer_gain_5g;
290d6089 2504 unsigned int tbtt_tick;
3a1c0128
GW
2505};
2506
b54f78a8 2507#endif /* RT2800_H */
This page took 0.503227 seconds and 5 git commands to generate.