blob: 591ac32b014e898ae88054720326ac550a6ed8c8 [file] [log] [blame]
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001/*
Ivo van Doornbc8a9792010-10-02 11:32:43 +02002 Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
3 Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
Gertjan van Wingerde9c9a0d12009-11-08 16:39:55 +01004 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>
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +010011 <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
RA-Jay Hung8d4ff3f2010-12-13 12:32:22 +010049 * 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)
53 * RF3853 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +010054 */
55#define RF2820 0x0001
56#define RF2850 0x0002
57#define RF2720 0x0003
58#define RF2750 0x0004
59#define RF3020 0x0005
60#define RF2020 0x0006
61#define RF3021 0x0007
62#define RF3022 0x0008
63#define RF3052 0x0009
RA-Jay Hung8d4ff3f2010-12-13 12:32:22 +010064#define RF2853 0x000a
Gertjan van Wingerdefab799c2010-04-11 14:31:08 +020065#define RF3320 0x000b
RA-Jay Hung8d4ff3f2010-12-13 12:32:22 +010066#define RF3322 0x000c
67#define RF3853 0x000d
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +010068
69/*
Gertjan van Wingerde8d0c9b62010-04-11 14:31:10 +020070 * Chipset revisions.
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +010071 */
Gertjan van Wingerde8d0c9b62010-04-11 14:31:10 +020072#define REV_RT2860C 0x0100
73#define REV_RT2860D 0x0101
Gertjan van Wingerde8d0c9b62010-04-11 14:31:10 +020074#define REV_RT2872E 0x0200
75#define REV_RT3070E 0x0200
76#define REV_RT3070F 0x0201
77#define REV_RT3071E 0x0211
78#define REV_RT3090E 0x0211
79#define REV_RT3390E 0x0211
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +010080
81/*
82 * Signal information.
83 * Default offset is required for RSSI <-> dBm conversion.
84 */
Ivo van Doorn74861922010-07-11 12:23:50 +020085#define DEFAULT_RSSI_OFFSET 120
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +010086
87/*
88 * Register layout information.
89 */
90#define CSR_REG_BASE 0x1000
91#define CSR_REG_SIZE 0x0800
92#define EEPROM_BASE 0x0000
93#define EEPROM_SIZE 0x0110
94#define BBP_BASE 0x0000
95#define BBP_SIZE 0x0080
96#define RF_BASE 0x0004
97#define RF_SIZE 0x0010
98
99/*
100 * Number of TX queues.
101 */
102#define NUM_TX_QUEUES 4
103
104/*
Gertjan van Wingerdefab799c2010-04-11 14:31:08 +0200105 * Registers.
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100106 */
107
108/*
Gertjan van Wingerde785c3c02010-06-03 10:51:59 +0200109 * E2PROM_CSR: PCI EEPROM control register.
110 * RELOAD: Write 1 to reload eeprom content.
111 * TYPE: 0: 93c46, 1:93c66.
112 * LOAD_STATUS: 1:loading, 0:done.
113 */
114#define E2PROM_CSR 0x0004
115#define E2PROM_CSR_DATA_CLOCK FIELD32(0x00000001)
116#define E2PROM_CSR_CHIP_SELECT FIELD32(0x00000002)
117#define E2PROM_CSR_DATA_IN FIELD32(0x00000004)
118#define E2PROM_CSR_DATA_OUT FIELD32(0x00000008)
119#define E2PROM_CSR_TYPE FIELD32(0x00000030)
120#define E2PROM_CSR_LOAD_STATUS FIELD32(0x00000040)
121#define E2PROM_CSR_RELOAD FIELD32(0x00000080)
122
123/*
Gertjan van Wingerdefab799c2010-04-11 14:31:08 +0200124 * OPT_14: Unknown register used by rt3xxx devices.
125 */
126#define OPT_14_CSR 0x0114
127#define OPT_14_CSR_BIT0 FIELD32(0x00000001)
128
129/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100130 * INT_SOURCE_CSR: Interrupt source register.
131 * Write one to clear corresponding bit.
Helmut Schaa0bdab172010-04-26 10:18:08 +0200132 * TX_FIFO_STATUS: FIFO Statistics is full, sw should read TX_STA_FIFO
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100133 */
134#define INT_SOURCE_CSR 0x0200
135#define INT_SOURCE_CSR_RXDELAYINT FIELD32(0x00000001)
136#define INT_SOURCE_CSR_TXDELAYINT FIELD32(0x00000002)
137#define INT_SOURCE_CSR_RX_DONE FIELD32(0x00000004)
138#define INT_SOURCE_CSR_AC0_DMA_DONE FIELD32(0x00000008)
139#define INT_SOURCE_CSR_AC1_DMA_DONE FIELD32(0x00000010)
140#define INT_SOURCE_CSR_AC2_DMA_DONE FIELD32(0x00000020)
141#define INT_SOURCE_CSR_AC3_DMA_DONE FIELD32(0x00000040)
142#define INT_SOURCE_CSR_HCCA_DMA_DONE FIELD32(0x00000080)
143#define INT_SOURCE_CSR_MGMT_DMA_DONE FIELD32(0x00000100)
144#define INT_SOURCE_CSR_MCU_COMMAND FIELD32(0x00000200)
145#define INT_SOURCE_CSR_RXTX_COHERENT FIELD32(0x00000400)
146#define INT_SOURCE_CSR_TBTT FIELD32(0x00000800)
147#define INT_SOURCE_CSR_PRE_TBTT FIELD32(0x00001000)
148#define INT_SOURCE_CSR_TX_FIFO_STATUS FIELD32(0x00002000)
149#define INT_SOURCE_CSR_AUTO_WAKEUP FIELD32(0x00004000)
150#define INT_SOURCE_CSR_GPTIMER FIELD32(0x00008000)
151#define INT_SOURCE_CSR_RX_COHERENT FIELD32(0x00010000)
152#define INT_SOURCE_CSR_TX_COHERENT FIELD32(0x00020000)
153
154/*
155 * INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF.
156 */
157#define INT_MASK_CSR 0x0204
158#define INT_MASK_CSR_RXDELAYINT FIELD32(0x00000001)
159#define INT_MASK_CSR_TXDELAYINT FIELD32(0x00000002)
160#define INT_MASK_CSR_RX_DONE FIELD32(0x00000004)
161#define INT_MASK_CSR_AC0_DMA_DONE FIELD32(0x00000008)
162#define INT_MASK_CSR_AC1_DMA_DONE FIELD32(0x00000010)
163#define INT_MASK_CSR_AC2_DMA_DONE FIELD32(0x00000020)
164#define INT_MASK_CSR_AC3_DMA_DONE FIELD32(0x00000040)
165#define INT_MASK_CSR_HCCA_DMA_DONE FIELD32(0x00000080)
166#define INT_MASK_CSR_MGMT_DMA_DONE FIELD32(0x00000100)
167#define INT_MASK_CSR_MCU_COMMAND FIELD32(0x00000200)
168#define INT_MASK_CSR_RXTX_COHERENT FIELD32(0x00000400)
169#define INT_MASK_CSR_TBTT FIELD32(0x00000800)
170#define INT_MASK_CSR_PRE_TBTT FIELD32(0x00001000)
171#define INT_MASK_CSR_TX_FIFO_STATUS FIELD32(0x00002000)
172#define INT_MASK_CSR_AUTO_WAKEUP FIELD32(0x00004000)
173#define INT_MASK_CSR_GPTIMER FIELD32(0x00008000)
174#define INT_MASK_CSR_RX_COHERENT FIELD32(0x00010000)
175#define INT_MASK_CSR_TX_COHERENT FIELD32(0x00020000)
176
177/*
178 * WPDMA_GLO_CFG
179 */
180#define WPDMA_GLO_CFG 0x0208
181#define WPDMA_GLO_CFG_ENABLE_TX_DMA FIELD32(0x00000001)
182#define WPDMA_GLO_CFG_TX_DMA_BUSY FIELD32(0x00000002)
183#define WPDMA_GLO_CFG_ENABLE_RX_DMA FIELD32(0x00000004)
184#define WPDMA_GLO_CFG_RX_DMA_BUSY FIELD32(0x00000008)
185#define WPDMA_GLO_CFG_WP_DMA_BURST_SIZE FIELD32(0x00000030)
186#define WPDMA_GLO_CFG_TX_WRITEBACK_DONE FIELD32(0x00000040)
187#define WPDMA_GLO_CFG_BIG_ENDIAN FIELD32(0x00000080)
188#define WPDMA_GLO_CFG_RX_HDR_SCATTER FIELD32(0x0000ff00)
189#define WPDMA_GLO_CFG_HDR_SEG_LEN FIELD32(0xffff0000)
190
191/*
192 * WPDMA_RST_IDX
193 */
194#define WPDMA_RST_IDX 0x020c
195#define WPDMA_RST_IDX_DTX_IDX0 FIELD32(0x00000001)
196#define WPDMA_RST_IDX_DTX_IDX1 FIELD32(0x00000002)
197#define WPDMA_RST_IDX_DTX_IDX2 FIELD32(0x00000004)
198#define WPDMA_RST_IDX_DTX_IDX3 FIELD32(0x00000008)
199#define WPDMA_RST_IDX_DTX_IDX4 FIELD32(0x00000010)
200#define WPDMA_RST_IDX_DTX_IDX5 FIELD32(0x00000020)
201#define WPDMA_RST_IDX_DRX_IDX0 FIELD32(0x00010000)
202
203/*
204 * DELAY_INT_CFG
205 */
206#define DELAY_INT_CFG 0x0210
207#define DELAY_INT_CFG_RXMAX_PTIME FIELD32(0x000000ff)
208#define DELAY_INT_CFG_RXMAX_PINT FIELD32(0x00007f00)
209#define DELAY_INT_CFG_RXDLY_INT_EN FIELD32(0x00008000)
210#define DELAY_INT_CFG_TXMAX_PTIME FIELD32(0x00ff0000)
211#define DELAY_INT_CFG_TXMAX_PINT FIELD32(0x7f000000)
212#define DELAY_INT_CFG_TXDLY_INT_EN FIELD32(0x80000000)
213
214/*
215 * WMM_AIFSN_CFG: Aifsn for each EDCA AC
Ivo van Doornf615e9a2010-12-13 12:36:38 +0100216 * AIFSN0: AC_VO
217 * AIFSN1: AC_VI
218 * AIFSN2: AC_BE
219 * AIFSN3: AC_BK
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100220 */
221#define WMM_AIFSN_CFG 0x0214
222#define WMM_AIFSN_CFG_AIFSN0 FIELD32(0x0000000f)
223#define WMM_AIFSN_CFG_AIFSN1 FIELD32(0x000000f0)
224#define WMM_AIFSN_CFG_AIFSN2 FIELD32(0x00000f00)
225#define WMM_AIFSN_CFG_AIFSN3 FIELD32(0x0000f000)
226
227/*
228 * WMM_CWMIN_CSR: CWmin for each EDCA AC
Ivo van Doornf615e9a2010-12-13 12:36:38 +0100229 * CWMIN0: AC_VO
230 * CWMIN1: AC_VI
231 * CWMIN2: AC_BE
232 * CWMIN3: AC_BK
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100233 */
234#define WMM_CWMIN_CFG 0x0218
235#define WMM_CWMIN_CFG_CWMIN0 FIELD32(0x0000000f)
236#define WMM_CWMIN_CFG_CWMIN1 FIELD32(0x000000f0)
237#define WMM_CWMIN_CFG_CWMIN2 FIELD32(0x00000f00)
238#define WMM_CWMIN_CFG_CWMIN3 FIELD32(0x0000f000)
239
240/*
241 * WMM_CWMAX_CSR: CWmax for each EDCA AC
Ivo van Doornf615e9a2010-12-13 12:36:38 +0100242 * CWMAX0: AC_VO
243 * CWMAX1: AC_VI
244 * CWMAX2: AC_BE
245 * CWMAX3: AC_BK
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100246 */
247#define WMM_CWMAX_CFG 0x021c
248#define WMM_CWMAX_CFG_CWMAX0 FIELD32(0x0000000f)
249#define WMM_CWMAX_CFG_CWMAX1 FIELD32(0x000000f0)
250#define WMM_CWMAX_CFG_CWMAX2 FIELD32(0x00000f00)
251#define WMM_CWMAX_CFG_CWMAX3 FIELD32(0x0000f000)
252
253/*
Ivo van Doornf615e9a2010-12-13 12:36:38 +0100254 * AC_TXOP0: AC_VO/AC_VI TXOP register
255 * AC0TXOP: AC_VO in unit of 32us
256 * AC1TXOP: AC_VI in unit of 32us
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100257 */
258#define WMM_TXOP0_CFG 0x0220
259#define WMM_TXOP0_CFG_AC0TXOP FIELD32(0x0000ffff)
260#define WMM_TXOP0_CFG_AC1TXOP FIELD32(0xffff0000)
261
262/*
Ivo van Doornf615e9a2010-12-13 12:36:38 +0100263 * AC_TXOP1: AC_BE/AC_BK TXOP register
264 * AC2TXOP: AC_BE in unit of 32us
265 * AC3TXOP: AC_BK in unit of 32us
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100266 */
267#define WMM_TXOP1_CFG 0x0224
268#define WMM_TXOP1_CFG_AC2TXOP FIELD32(0x0000ffff)
269#define WMM_TXOP1_CFG_AC3TXOP FIELD32(0xffff0000)
270
271/*
272 * GPIO_CTRL_CFG:
RA-Jay Hungd96aa642011-02-20 13:54:52 +0100273 * GPIOD: GPIO direction, 0: Output, 1: Input
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100274 */
275#define GPIO_CTRL_CFG 0x0228
276#define GPIO_CTRL_CFG_BIT0 FIELD32(0x00000001)
277#define GPIO_CTRL_CFG_BIT1 FIELD32(0x00000002)
278#define GPIO_CTRL_CFG_BIT2 FIELD32(0x00000004)
279#define GPIO_CTRL_CFG_BIT3 FIELD32(0x00000008)
280#define GPIO_CTRL_CFG_BIT4 FIELD32(0x00000010)
281#define GPIO_CTRL_CFG_BIT5 FIELD32(0x00000020)
282#define GPIO_CTRL_CFG_BIT6 FIELD32(0x00000040)
283#define GPIO_CTRL_CFG_BIT7 FIELD32(0x00000080)
Shiang Tufe591472011-02-20 13:57:22 +0100284#define GPIO_CTRL_CFG_GPIOD_BIT0 FIELD32(0x00000100)
285#define GPIO_CTRL_CFG_GPIOD_BIT1 FIELD32(0x00000200)
286#define GPIO_CTRL_CFG_GPIOD_BIT2 FIELD32(0x00000400)
287#define GPIO_CTRL_CFG_GPIOD_BIT3 FIELD32(0x00000800)
288#define GPIO_CTRL_CFG_GPIOD_BIT4 FIELD32(0x00001000)
289#define GPIO_CTRL_CFG_GPIOD_BIT5 FIELD32(0x00002000)
290#define GPIO_CTRL_CFG_GPIOD_BIT6 FIELD32(0x00004000)
291#define GPIO_CTRL_CFG_GPIOD_BIT7 FIELD32(0x00008000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100292
293/*
294 * MCU_CMD_CFG
295 */
296#define MCU_CMD_CFG 0x022c
297
298/*
Ivo van Doornf615e9a2010-12-13 12:36:38 +0100299 * AC_VO register offsets
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100300 */
301#define TX_BASE_PTR0 0x0230
302#define TX_MAX_CNT0 0x0234
303#define TX_CTX_IDX0 0x0238
304#define TX_DTX_IDX0 0x023c
305
306/*
Ivo van Doornf615e9a2010-12-13 12:36:38 +0100307 * AC_VI register offsets
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100308 */
309#define TX_BASE_PTR1 0x0240
310#define TX_MAX_CNT1 0x0244
311#define TX_CTX_IDX1 0x0248
312#define TX_DTX_IDX1 0x024c
313
314/*
Ivo van Doornf615e9a2010-12-13 12:36:38 +0100315 * AC_BE register offsets
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100316 */
317#define TX_BASE_PTR2 0x0250
318#define TX_MAX_CNT2 0x0254
319#define TX_CTX_IDX2 0x0258
320#define TX_DTX_IDX2 0x025c
321
322/*
Ivo van Doornf615e9a2010-12-13 12:36:38 +0100323 * AC_BK register offsets
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100324 */
325#define TX_BASE_PTR3 0x0260
326#define TX_MAX_CNT3 0x0264
327#define TX_CTX_IDX3 0x0268
328#define TX_DTX_IDX3 0x026c
329
330/*
331 * HCCA register offsets
332 */
333#define TX_BASE_PTR4 0x0270
334#define TX_MAX_CNT4 0x0274
335#define TX_CTX_IDX4 0x0278
336#define TX_DTX_IDX4 0x027c
337
338/*
339 * MGMT register offsets
340 */
341#define TX_BASE_PTR5 0x0280
342#define TX_MAX_CNT5 0x0284
343#define TX_CTX_IDX5 0x0288
344#define TX_DTX_IDX5 0x028c
345
346/*
347 * RX register offsets
348 */
349#define RX_BASE_PTR 0x0290
350#define RX_MAX_CNT 0x0294
351#define RX_CRX_IDX 0x0298
352#define RX_DRX_IDX 0x029c
353
354/*
Gertjan van Wingerde785c3c02010-06-03 10:51:59 +0200355 * USB_DMA_CFG
356 * RX_BULK_AGG_TIMEOUT: Rx Bulk Aggregation TimeOut in unit of 33ns.
357 * RX_BULK_AGG_LIMIT: Rx Bulk Aggregation Limit in unit of 256 bytes.
358 * PHY_CLEAR: phy watch dog enable.
359 * TX_CLEAR: Clear USB DMA TX path.
360 * TXOP_HALT: Halt TXOP count down when TX buffer is full.
361 * RX_BULK_AGG_EN: Enable Rx Bulk Aggregation.
362 * RX_BULK_EN: Enable USB DMA Rx.
363 * TX_BULK_EN: Enable USB DMA Tx.
364 * EP_OUT_VALID: OUT endpoint data valid.
365 * RX_BUSY: USB DMA RX FSM busy.
366 * TX_BUSY: USB DMA TX FSM busy.
367 */
368#define USB_DMA_CFG 0x02a0
369#define USB_DMA_CFG_RX_BULK_AGG_TIMEOUT FIELD32(0x000000ff)
370#define USB_DMA_CFG_RX_BULK_AGG_LIMIT FIELD32(0x0000ff00)
371#define USB_DMA_CFG_PHY_CLEAR FIELD32(0x00010000)
372#define USB_DMA_CFG_TX_CLEAR FIELD32(0x00080000)
373#define USB_DMA_CFG_TXOP_HALT FIELD32(0x00100000)
374#define USB_DMA_CFG_RX_BULK_AGG_EN FIELD32(0x00200000)
375#define USB_DMA_CFG_RX_BULK_EN FIELD32(0x00400000)
376#define USB_DMA_CFG_TX_BULK_EN FIELD32(0x00800000)
377#define USB_DMA_CFG_EP_OUT_VALID FIELD32(0x3f000000)
378#define USB_DMA_CFG_RX_BUSY FIELD32(0x40000000)
379#define USB_DMA_CFG_TX_BUSY FIELD32(0x80000000)
380
381/*
382 * US_CYC_CNT
RA-Jay Hungc6fcc0e2011-01-30 13:21:22 +0100383 * BT_MODE_EN: Bluetooth mode enable
384 * CLOCK CYCLE: Clock cycle count in 1us.
385 * PCI:0x21, PCIE:0x7d, USB:0x1e
Gertjan van Wingerde785c3c02010-06-03 10:51:59 +0200386 */
387#define US_CYC_CNT 0x02a4
RA-Jay Hungc6fcc0e2011-01-30 13:21:22 +0100388#define US_CYC_CNT_BT_MODE_EN FIELD32(0x00000100)
Gertjan van Wingerde785c3c02010-06-03 10:51:59 +0200389#define US_CYC_CNT_CLOCK_CYCLE FIELD32(0x000000ff)
390
391/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100392 * PBF_SYS_CTRL
393 * HOST_RAM_WRITE: enable Host program ram write selection
394 */
395#define PBF_SYS_CTRL 0x0400
396#define PBF_SYS_CTRL_READY FIELD32(0x00000080)
397#define PBF_SYS_CTRL_HOST_RAM_WRITE FIELD32(0x00010000)
398
399/*
400 * HOST-MCU shared memory
401 */
402#define HOST_CMD_CSR 0x0404
403#define HOST_CMD_CSR_HOST_COMMAND FIELD32(0x000000ff)
404
405/*
406 * PBF registers
407 * Most are for debug. Driver doesn't touch PBF register.
408 */
409#define PBF_CFG 0x0408
410#define PBF_MAX_PCNT 0x040c
411#define PBF_CTRL 0x0410
412#define PBF_INT_STA 0x0414
413#define PBF_INT_ENA 0x0418
414
415/*
416 * BCN_OFFSET0:
417 */
418#define BCN_OFFSET0 0x042c
419#define BCN_OFFSET0_BCN0 FIELD32(0x000000ff)
420#define BCN_OFFSET0_BCN1 FIELD32(0x0000ff00)
421#define BCN_OFFSET0_BCN2 FIELD32(0x00ff0000)
422#define BCN_OFFSET0_BCN3 FIELD32(0xff000000)
423
424/*
425 * BCN_OFFSET1:
426 */
427#define BCN_OFFSET1 0x0430
428#define BCN_OFFSET1_BCN4 FIELD32(0x000000ff)
429#define BCN_OFFSET1_BCN5 FIELD32(0x0000ff00)
430#define BCN_OFFSET1_BCN6 FIELD32(0x00ff0000)
431#define BCN_OFFSET1_BCN7 FIELD32(0xff000000)
432
433/*
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100434 * TXRXQ_PCNT: PBF register
435 * PCNT_TX0Q: Page count for TX hardware queue 0
436 * PCNT_TX1Q: Page count for TX hardware queue 1
437 * PCNT_TX2Q: Page count for TX hardware queue 2
438 * PCNT_RX0Q: Page count for RX hardware queue
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100439 */
440#define TXRXQ_PCNT 0x0438
Ivo van Doorn8c5765f2010-11-06 15:49:01 +0100441#define TXRXQ_PCNT_TX0Q FIELD32(0x000000ff)
442#define TXRXQ_PCNT_TX1Q FIELD32(0x0000ff00)
443#define TXRXQ_PCNT_TX2Q FIELD32(0x00ff0000)
444#define TXRXQ_PCNT_RX0Q FIELD32(0xff000000)
445
446/*
447 * PBF register
448 * Debug. Driver doesn't touch PBF register.
449 */
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100450#define PBF_DBG 0x043c
451
452/*
453 * RF registers
454 */
455#define RF_CSR_CFG 0x0500
456#define RF_CSR_CFG_DATA FIELD32(0x000000ff)
457#define RF_CSR_CFG_REGNUM FIELD32(0x00001f00)
458#define RF_CSR_CFG_WRITE FIELD32(0x00010000)
459#define RF_CSR_CFG_BUSY FIELD32(0x00020000)
460
461/*
Bartlomiej Zolnierkiewicz30e84032009-11-08 14:39:48 +0100462 * EFUSE_CSR: RT30x0 EEPROM
463 */
464#define EFUSE_CTRL 0x0580
465#define EFUSE_CTRL_ADDRESS_IN FIELD32(0x03fe0000)
466#define EFUSE_CTRL_MODE FIELD32(0x000000c0)
467#define EFUSE_CTRL_KICK FIELD32(0x40000000)
468#define EFUSE_CTRL_PRESENT FIELD32(0x80000000)
469
470/*
471 * EFUSE_DATA0
472 */
473#define EFUSE_DATA0 0x0590
474
475/*
476 * EFUSE_DATA1
477 */
478#define EFUSE_DATA1 0x0594
479
480/*
481 * EFUSE_DATA2
482 */
483#define EFUSE_DATA2 0x0598
484
485/*
486 * EFUSE_DATA3
487 */
488#define EFUSE_DATA3 0x059c
489
490/*
Gertjan van Wingerdefab799c2010-04-11 14:31:08 +0200491 * LDO_CFG0
492 */
493#define LDO_CFG0 0x05d4
494#define LDO_CFG0_DELAY3 FIELD32(0x000000ff)
495#define LDO_CFG0_DELAY2 FIELD32(0x0000ff00)
496#define LDO_CFG0_DELAY1 FIELD32(0x00ff0000)
497#define LDO_CFG0_BGSEL FIELD32(0x03000000)
498#define LDO_CFG0_LDO_CORE_VLEVEL FIELD32(0x1c000000)
499#define LD0_CFG0_LDO25_LEVEL FIELD32(0x60000000)
500#define LDO_CFG0_LDO25_LARGEA FIELD32(0x80000000)
501
502/*
503 * GPIO_SWITCH
504 */
505#define GPIO_SWITCH 0x05dc
506#define GPIO_SWITCH_0 FIELD32(0x00000001)
507#define GPIO_SWITCH_1 FIELD32(0x00000002)
508#define GPIO_SWITCH_2 FIELD32(0x00000004)
509#define GPIO_SWITCH_3 FIELD32(0x00000008)
510#define GPIO_SWITCH_4 FIELD32(0x00000010)
511#define GPIO_SWITCH_5 FIELD32(0x00000020)
512#define GPIO_SWITCH_6 FIELD32(0x00000040)
513#define GPIO_SWITCH_7 FIELD32(0x00000080)
514
515/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100516 * MAC Control/Status Registers(CSR).
517 * Some values are set in TU, whereas 1 TU == 1024 us.
518 */
519
520/*
521 * MAC_CSR0: ASIC revision number.
522 * ASIC_REV: 0
523 * ASIC_VER: 2860 or 2870
524 */
525#define MAC_CSR0 0x1000
Gertjan van Wingerde49e721e2010-02-13 20:55:49 +0100526#define MAC_CSR0_REVISION FIELD32(0x0000ffff)
527#define MAC_CSR0_CHIPSET FIELD32(0xffff0000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100528
529/*
530 * MAC_SYS_CTRL:
531 */
532#define MAC_SYS_CTRL 0x1004
533#define MAC_SYS_CTRL_RESET_CSR FIELD32(0x00000001)
534#define MAC_SYS_CTRL_RESET_BBP FIELD32(0x00000002)
535#define MAC_SYS_CTRL_ENABLE_TX FIELD32(0x00000004)
536#define MAC_SYS_CTRL_ENABLE_RX FIELD32(0x00000008)
537#define MAC_SYS_CTRL_CONTINUOUS_TX FIELD32(0x00000010)
538#define MAC_SYS_CTRL_LOOPBACK FIELD32(0x00000020)
539#define MAC_SYS_CTRL_WLAN_HALT FIELD32(0x00000040)
540#define MAC_SYS_CTRL_RX_TIMESTAMP FIELD32(0x00000080)
541
542/*
543 * MAC_ADDR_DW0: STA MAC register 0
544 */
545#define MAC_ADDR_DW0 0x1008
546#define MAC_ADDR_DW0_BYTE0 FIELD32(0x000000ff)
547#define MAC_ADDR_DW0_BYTE1 FIELD32(0x0000ff00)
548#define MAC_ADDR_DW0_BYTE2 FIELD32(0x00ff0000)
549#define MAC_ADDR_DW0_BYTE3 FIELD32(0xff000000)
550
551/*
552 * MAC_ADDR_DW1: STA MAC register 1
553 * UNICAST_TO_ME_MASK:
554 * Used to mask off bits from byte 5 of the MAC address
555 * to determine the UNICAST_TO_ME bit for RX frames.
556 * The full mask is complemented by BSS_ID_MASK:
557 * MASK = BSS_ID_MASK & UNICAST_TO_ME_MASK
558 */
559#define MAC_ADDR_DW1 0x100c
560#define MAC_ADDR_DW1_BYTE4 FIELD32(0x000000ff)
561#define MAC_ADDR_DW1_BYTE5 FIELD32(0x0000ff00)
562#define MAC_ADDR_DW1_UNICAST_TO_ME_MASK FIELD32(0x00ff0000)
563
564/*
565 * MAC_BSSID_DW0: BSSID register 0
566 */
567#define MAC_BSSID_DW0 0x1010
568#define MAC_BSSID_DW0_BYTE0 FIELD32(0x000000ff)
569#define MAC_BSSID_DW0_BYTE1 FIELD32(0x0000ff00)
570#define MAC_BSSID_DW0_BYTE2 FIELD32(0x00ff0000)
571#define MAC_BSSID_DW0_BYTE3 FIELD32(0xff000000)
572
573/*
574 * MAC_BSSID_DW1: BSSID register 1
575 * BSS_ID_MASK:
576 * 0: 1-BSSID mode (BSS index = 0)
577 * 1: 2-BSSID mode (BSS index: Byte5, bit 0)
578 * 2: 4-BSSID mode (BSS index: byte5, bit 0 - 1)
579 * 3: 8-BSSID mode (BSS index: byte5, bit 0 - 2)
580 * This mask is used to mask off bits 0, 1 and 2 of byte 5 of the
581 * BSSID. This will make sure that those bits will be ignored
582 * when determining the MY_BSS of RX frames.
583 */
584#define MAC_BSSID_DW1 0x1014
585#define MAC_BSSID_DW1_BYTE4 FIELD32(0x000000ff)
586#define MAC_BSSID_DW1_BYTE5 FIELD32(0x0000ff00)
587#define MAC_BSSID_DW1_BSS_ID_MASK FIELD32(0x00030000)
588#define MAC_BSSID_DW1_BSS_BCN_NUM FIELD32(0x001c0000)
589
590/*
591 * MAX_LEN_CFG: Maximum frame length register.
592 * MAX_MPDU: rt2860b max 16k bytes
593 * MAX_PSDU: Maximum PSDU length
594 * (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16
595 */
596#define MAX_LEN_CFG 0x1018
597#define MAX_LEN_CFG_MAX_MPDU FIELD32(0x00000fff)
598#define MAX_LEN_CFG_MAX_PSDU FIELD32(0x00003000)
599#define MAX_LEN_CFG_MIN_PSDU FIELD32(0x0000c000)
600#define MAX_LEN_CFG_MIN_MPDU FIELD32(0x000f0000)
601
602/*
603 * BBP_CSR_CFG: BBP serial control register
604 * VALUE: Register value to program into BBP
605 * REG_NUM: Selected BBP register
606 * READ_CONTROL: 0 write BBP, 1 read BBP
607 * BUSY: ASIC is busy executing BBP commands
608 * BBP_PAR_DUR: 0 4 MAC clocks, 1 8 MAC clocks
609 * BBP_RW_MODE: 0 serial, 1 paralell
610 */
611#define BBP_CSR_CFG 0x101c
612#define BBP_CSR_CFG_VALUE FIELD32(0x000000ff)
613#define BBP_CSR_CFG_REGNUM FIELD32(0x0000ff00)
614#define BBP_CSR_CFG_READ_CONTROL FIELD32(0x00010000)
615#define BBP_CSR_CFG_BUSY FIELD32(0x00020000)
616#define BBP_CSR_CFG_BBP_PAR_DUR FIELD32(0x00040000)
617#define BBP_CSR_CFG_BBP_RW_MODE FIELD32(0x00080000)
618
619/*
620 * RF_CSR_CFG0: RF control register
621 * REGID_AND_VALUE: Register value to program into RF
622 * BITWIDTH: Selected RF register
623 * STANDBYMODE: 0 high when standby, 1 low when standby
624 * SEL: 0 RF_LE0 activate, 1 RF_LE1 activate
625 * BUSY: ASIC is busy executing RF commands
626 */
627#define RF_CSR_CFG0 0x1020
628#define RF_CSR_CFG0_REGID_AND_VALUE FIELD32(0x00ffffff)
629#define RF_CSR_CFG0_BITWIDTH FIELD32(0x1f000000)
630#define RF_CSR_CFG0_REG_VALUE_BW FIELD32(0x1fffffff)
631#define RF_CSR_CFG0_STANDBYMODE FIELD32(0x20000000)
632#define RF_CSR_CFG0_SEL FIELD32(0x40000000)
633#define RF_CSR_CFG0_BUSY FIELD32(0x80000000)
634
635/*
636 * RF_CSR_CFG1: RF control register
637 * REGID_AND_VALUE: Register value to program into RF
638 * RFGAP: Gap between BB_CONTROL_RF and RF_LE
639 * 0: 3 system clock cycle (37.5usec)
640 * 1: 5 system clock cycle (62.5usec)
641 */
642#define RF_CSR_CFG1 0x1024
643#define RF_CSR_CFG1_REGID_AND_VALUE FIELD32(0x00ffffff)
644#define RF_CSR_CFG1_RFGAP FIELD32(0x1f000000)
645
646/*
647 * RF_CSR_CFG2: RF control register
648 * VALUE: Register value to program into RF
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100649 */
650#define RF_CSR_CFG2 0x1028
651#define RF_CSR_CFG2_VALUE FIELD32(0x00ffffff)
652
653/*
654 * LED_CFG: LED control
655 * color LED's:
656 * 0: off
657 * 1: blinking upon TX2
658 * 2: periodic slow blinking
659 * 3: always on
660 * LED polarity:
661 * 0: active low
662 * 1: active high
663 */
664#define LED_CFG 0x102c
665#define LED_CFG_ON_PERIOD FIELD32(0x000000ff)
666#define LED_CFG_OFF_PERIOD FIELD32(0x0000ff00)
667#define LED_CFG_SLOW_BLINK_PERIOD FIELD32(0x003f0000)
668#define LED_CFG_R_LED_MODE FIELD32(0x03000000)
669#define LED_CFG_G_LED_MODE FIELD32(0x0c000000)
670#define LED_CFG_Y_LED_MODE FIELD32(0x30000000)
671#define LED_CFG_LED_POLAR FIELD32(0x40000000)
672
673/*
Helmut Schaa47ee3eb2010-09-08 20:56:04 +0200674 * AMPDU_BA_WINSIZE: Force BlockAck window size
675 * FORCE_WINSIZE_ENABLE:
676 * 0: Disable forcing of BlockAck window size
677 * 1: Enable forcing of BlockAck window size, overwrites values BlockAck
678 * window size values in the TXWI
679 * FORCE_WINSIZE: BlockAck window size
680 */
681#define AMPDU_BA_WINSIZE 0x1040
682#define AMPDU_BA_WINSIZE_FORCE_WINSIZE_ENABLE FIELD32(0x00000020)
683#define AMPDU_BA_WINSIZE_FORCE_WINSIZE FIELD32(0x0000001f)
684
685/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100686 * XIFS_TIME_CFG: MAC timing
687 * CCKM_SIFS_TIME: unit 1us. Applied after CCK RX/TX
688 * OFDM_SIFS_TIME: unit 1us. Applied after OFDM RX/TX
689 * OFDM_XIFS_TIME: unit 1us. Applied after OFDM RX
690 * when MAC doesn't reference BBP signal BBRXEND
691 * EIFS: unit 1us
692 * BB_RXEND_ENABLE: reference RXEND signal to begin XIFS defer
693 *
694 */
695#define XIFS_TIME_CFG 0x1100
696#define XIFS_TIME_CFG_CCKM_SIFS_TIME FIELD32(0x000000ff)
697#define XIFS_TIME_CFG_OFDM_SIFS_TIME FIELD32(0x0000ff00)
698#define XIFS_TIME_CFG_OFDM_XIFS_TIME FIELD32(0x000f0000)
699#define XIFS_TIME_CFG_EIFS FIELD32(0x1ff00000)
700#define XIFS_TIME_CFG_BB_RXEND_ENABLE FIELD32(0x20000000)
701
702/*
703 * BKOFF_SLOT_CFG:
704 */
705#define BKOFF_SLOT_CFG 0x1104
706#define BKOFF_SLOT_CFG_SLOT_TIME FIELD32(0x000000ff)
707#define BKOFF_SLOT_CFG_CC_DELAY_TIME FIELD32(0x0000ff00)
708
709/*
710 * NAV_TIME_CFG:
711 */
712#define NAV_TIME_CFG 0x1108
713#define NAV_TIME_CFG_SIFS FIELD32(0x000000ff)
714#define NAV_TIME_CFG_SLOT_TIME FIELD32(0x0000ff00)
715#define NAV_TIME_CFG_EIFS FIELD32(0x01ff0000)
716#define NAV_TIME_ZERO_SIFS FIELD32(0x02000000)
717
718/*
719 * CH_TIME_CFG: count as channel busy
Helmut Schaa977206d2010-12-13 12:31:58 +0100720 * EIFS_BUSY: Count EIFS as channel busy
721 * NAV_BUSY: Count NAS as channel busy
722 * RX_BUSY: Count RX as channel busy
723 * TX_BUSY: Count TX as channel busy
724 * TMR_EN: Enable channel statistics timer
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100725 */
726#define CH_TIME_CFG 0x110c
Helmut Schaa977206d2010-12-13 12:31:58 +0100727#define CH_TIME_CFG_EIFS_BUSY FIELD32(0x00000010)
728#define CH_TIME_CFG_NAV_BUSY FIELD32(0x00000008)
729#define CH_TIME_CFG_RX_BUSY FIELD32(0x00000004)
730#define CH_TIME_CFG_TX_BUSY FIELD32(0x00000002)
731#define CH_TIME_CFG_TMR_EN FIELD32(0x00000001)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100732
733/*
734 * PBF_LIFE_TIMER: TX/RX MPDU timestamp timer (free run) Unit: 1us
735 */
736#define PBF_LIFE_TIMER 0x1110
737
738/*
739 * BCN_TIME_CFG:
740 * BEACON_INTERVAL: in unit of 1/16 TU
741 * TSF_TICKING: Enable TSF auto counting
742 * TSF_SYNC: Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode
743 * BEACON_GEN: Enable beacon generator
744 */
745#define BCN_TIME_CFG 0x1114
746#define BCN_TIME_CFG_BEACON_INTERVAL FIELD32(0x0000ffff)
747#define BCN_TIME_CFG_TSF_TICKING FIELD32(0x00010000)
748#define BCN_TIME_CFG_TSF_SYNC FIELD32(0x00060000)
749#define BCN_TIME_CFG_TBTT_ENABLE FIELD32(0x00080000)
750#define BCN_TIME_CFG_BEACON_GEN FIELD32(0x00100000)
751#define BCN_TIME_CFG_TX_TIME_COMPENSATE FIELD32(0xf0000000)
752
753/*
754 * TBTT_SYNC_CFG:
Helmut Schaac4c18a92010-10-02 11:31:05 +0200755 * BCN_AIFSN: Beacon AIFSN after TBTT interrupt in slots
756 * BCN_CWMIN: Beacon CWMin after TBTT interrupt in slots
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100757 */
758#define TBTT_SYNC_CFG 0x1118
Helmut Schaac4c18a92010-10-02 11:31:05 +0200759#define TBTT_SYNC_CFG_TBTT_ADJUST FIELD32(0x000000ff)
760#define TBTT_SYNC_CFG_BCN_EXP_WIN FIELD32(0x0000ff00)
761#define TBTT_SYNC_CFG_BCN_AIFSN FIELD32(0x000f0000)
762#define TBTT_SYNC_CFG_BCN_CWMIN FIELD32(0x00f00000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100763
764/*
765 * TSF_TIMER_DW0: Local lsb TSF timer, read-only
766 */
767#define TSF_TIMER_DW0 0x111c
768#define TSF_TIMER_DW0_LOW_WORD FIELD32(0xffffffff)
769
770/*
771 * TSF_TIMER_DW1: Local msb TSF timer, read-only
772 */
773#define TSF_TIMER_DW1 0x1120
774#define TSF_TIMER_DW1_HIGH_WORD FIELD32(0xffffffff)
775
776/*
777 * TBTT_TIMER: TImer remains till next TBTT, read-only
778 */
779#define TBTT_TIMER 0x1124
780
781/*
Helmut Schaa9f926fb2010-07-11 12:28:23 +0200782 * INT_TIMER_CFG: timer configuration
783 * PRE_TBTT_TIMER: leadtime to tbtt for pretbtt interrupt in units of 1/16 TU
784 * GP_TIMER: period of general purpose timer in units of 1/16 TU
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100785 */
786#define INT_TIMER_CFG 0x1128
Helmut Schaa9f926fb2010-07-11 12:28:23 +0200787#define INT_TIMER_CFG_PRE_TBTT_TIMER FIELD32(0x0000ffff)
788#define INT_TIMER_CFG_GP_TIMER FIELD32(0xffff0000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100789
790/*
791 * INT_TIMER_EN: GP-timer and pre-tbtt Int enable
792 */
793#define INT_TIMER_EN 0x112c
Helmut Schaa9f926fb2010-07-11 12:28:23 +0200794#define INT_TIMER_EN_PRE_TBTT_TIMER FIELD32(0x00000001)
795#define INT_TIMER_EN_GP_TIMER FIELD32(0x00000002)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100796
797/*
Helmut Schaad4ce3a52010-10-02 11:30:42 +0200798 * CH_IDLE_STA: channel idle time (in us)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100799 */
800#define CH_IDLE_STA 0x1130
801
802/*
Helmut Schaad4ce3a52010-10-02 11:30:42 +0200803 * CH_BUSY_STA: channel busy time on primary channel (in us)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100804 */
805#define CH_BUSY_STA 0x1134
806
807/*
Helmut Schaad4ce3a52010-10-02 11:30:42 +0200808 * CH_BUSY_STA_SEC: channel busy time on secondary channel in HT40 mode (in us)
809 */
810#define CH_BUSY_STA_SEC 0x1138
811
812/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100813 * MAC_STATUS_CFG:
814 * BBP_RF_BUSY: When set to 0, BBP and RF are stable.
815 * if 1 or higher one of the 2 registers is busy.
816 */
817#define MAC_STATUS_CFG 0x1200
818#define MAC_STATUS_CFG_BBP_RF_BUSY FIELD32(0x00000003)
819
820/*
821 * PWR_PIN_CFG:
822 */
823#define PWR_PIN_CFG 0x1204
824
825/*
826 * AUTOWAKEUP_CFG: Manual power control / status register
827 * TBCN_BEFORE_WAKE: ForceWake has high privilege than PutToSleep when both set
828 * AUTOWAKE: 0:sleep, 1:awake
829 */
830#define AUTOWAKEUP_CFG 0x1208
831#define AUTOWAKEUP_CFG_AUTO_LEAD_TIME FIELD32(0x000000ff)
832#define AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE FIELD32(0x00007f00)
833#define AUTOWAKEUP_CFG_AUTOWAKE FIELD32(0x00008000)
834
835/*
836 * EDCA_AC0_CFG:
837 */
838#define EDCA_AC0_CFG 0x1300
839#define EDCA_AC0_CFG_TX_OP FIELD32(0x000000ff)
840#define EDCA_AC0_CFG_AIFSN FIELD32(0x00000f00)
841#define EDCA_AC0_CFG_CWMIN FIELD32(0x0000f000)
842#define EDCA_AC0_CFG_CWMAX FIELD32(0x000f0000)
843
844/*
845 * EDCA_AC1_CFG:
846 */
847#define EDCA_AC1_CFG 0x1304
848#define EDCA_AC1_CFG_TX_OP FIELD32(0x000000ff)
849#define EDCA_AC1_CFG_AIFSN FIELD32(0x00000f00)
850#define EDCA_AC1_CFG_CWMIN FIELD32(0x0000f000)
851#define EDCA_AC1_CFG_CWMAX FIELD32(0x000f0000)
852
853/*
854 * EDCA_AC2_CFG:
855 */
856#define EDCA_AC2_CFG 0x1308
857#define EDCA_AC2_CFG_TX_OP FIELD32(0x000000ff)
858#define EDCA_AC2_CFG_AIFSN FIELD32(0x00000f00)
859#define EDCA_AC2_CFG_CWMIN FIELD32(0x0000f000)
860#define EDCA_AC2_CFG_CWMAX FIELD32(0x000f0000)
861
862/*
863 * EDCA_AC3_CFG:
864 */
865#define EDCA_AC3_CFG 0x130c
866#define EDCA_AC3_CFG_TX_OP FIELD32(0x000000ff)
867#define EDCA_AC3_CFG_AIFSN FIELD32(0x00000f00)
868#define EDCA_AC3_CFG_CWMIN FIELD32(0x0000f000)
869#define EDCA_AC3_CFG_CWMAX FIELD32(0x000f0000)
870
871/*
872 * EDCA_TID_AC_MAP:
873 */
874#define EDCA_TID_AC_MAP 0x1310
875
876/*
Helmut Schaa5e846002010-07-11 12:23:09 +0200877 * TX_PWR_CFG:
878 */
879#define TX_PWR_CFG_RATE0 FIELD32(0x0000000f)
880#define TX_PWR_CFG_RATE1 FIELD32(0x000000f0)
881#define TX_PWR_CFG_RATE2 FIELD32(0x00000f00)
882#define TX_PWR_CFG_RATE3 FIELD32(0x0000f000)
883#define TX_PWR_CFG_RATE4 FIELD32(0x000f0000)
884#define TX_PWR_CFG_RATE5 FIELD32(0x00f00000)
885#define TX_PWR_CFG_RATE6 FIELD32(0x0f000000)
886#define TX_PWR_CFG_RATE7 FIELD32(0xf0000000)
887
888/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100889 * TX_PWR_CFG_0:
890 */
891#define TX_PWR_CFG_0 0x1314
892#define TX_PWR_CFG_0_1MBS FIELD32(0x0000000f)
893#define TX_PWR_CFG_0_2MBS FIELD32(0x000000f0)
894#define TX_PWR_CFG_0_55MBS FIELD32(0x00000f00)
895#define TX_PWR_CFG_0_11MBS FIELD32(0x0000f000)
896#define TX_PWR_CFG_0_6MBS FIELD32(0x000f0000)
897#define TX_PWR_CFG_0_9MBS FIELD32(0x00f00000)
898#define TX_PWR_CFG_0_12MBS FIELD32(0x0f000000)
899#define TX_PWR_CFG_0_18MBS FIELD32(0xf0000000)
900
901/*
902 * TX_PWR_CFG_1:
903 */
904#define TX_PWR_CFG_1 0x1318
905#define TX_PWR_CFG_1_24MBS FIELD32(0x0000000f)
906#define TX_PWR_CFG_1_36MBS FIELD32(0x000000f0)
907#define TX_PWR_CFG_1_48MBS FIELD32(0x00000f00)
908#define TX_PWR_CFG_1_54MBS FIELD32(0x0000f000)
909#define TX_PWR_CFG_1_MCS0 FIELD32(0x000f0000)
910#define TX_PWR_CFG_1_MCS1 FIELD32(0x00f00000)
911#define TX_PWR_CFG_1_MCS2 FIELD32(0x0f000000)
912#define TX_PWR_CFG_1_MCS3 FIELD32(0xf0000000)
913
914/*
915 * TX_PWR_CFG_2:
916 */
917#define TX_PWR_CFG_2 0x131c
918#define TX_PWR_CFG_2_MCS4 FIELD32(0x0000000f)
919#define TX_PWR_CFG_2_MCS5 FIELD32(0x000000f0)
920#define TX_PWR_CFG_2_MCS6 FIELD32(0x00000f00)
921#define TX_PWR_CFG_2_MCS7 FIELD32(0x0000f000)
922#define TX_PWR_CFG_2_MCS8 FIELD32(0x000f0000)
923#define TX_PWR_CFG_2_MCS9 FIELD32(0x00f00000)
924#define TX_PWR_CFG_2_MCS10 FIELD32(0x0f000000)
925#define TX_PWR_CFG_2_MCS11 FIELD32(0xf0000000)
926
927/*
928 * TX_PWR_CFG_3:
929 */
930#define TX_PWR_CFG_3 0x1320
931#define TX_PWR_CFG_3_MCS12 FIELD32(0x0000000f)
932#define TX_PWR_CFG_3_MCS13 FIELD32(0x000000f0)
933#define TX_PWR_CFG_3_MCS14 FIELD32(0x00000f00)
934#define TX_PWR_CFG_3_MCS15 FIELD32(0x0000f000)
935#define TX_PWR_CFG_3_UKNOWN1 FIELD32(0x000f0000)
936#define TX_PWR_CFG_3_UKNOWN2 FIELD32(0x00f00000)
937#define TX_PWR_CFG_3_UKNOWN3 FIELD32(0x0f000000)
938#define TX_PWR_CFG_3_UKNOWN4 FIELD32(0xf0000000)
939
940/*
941 * TX_PWR_CFG_4:
942 */
943#define TX_PWR_CFG_4 0x1324
944#define TX_PWR_CFG_4_UKNOWN5 FIELD32(0x0000000f)
945#define TX_PWR_CFG_4_UKNOWN6 FIELD32(0x000000f0)
946#define TX_PWR_CFG_4_UKNOWN7 FIELD32(0x00000f00)
947#define TX_PWR_CFG_4_UKNOWN8 FIELD32(0x0000f000)
948
949/*
950 * TX_PIN_CFG:
951 */
952#define TX_PIN_CFG 0x1328
953#define TX_PIN_CFG_PA_PE_A0_EN FIELD32(0x00000001)
954#define TX_PIN_CFG_PA_PE_G0_EN FIELD32(0x00000002)
955#define TX_PIN_CFG_PA_PE_A1_EN FIELD32(0x00000004)
956#define TX_PIN_CFG_PA_PE_G1_EN FIELD32(0x00000008)
957#define TX_PIN_CFG_PA_PE_A0_POL FIELD32(0x00000010)
958#define TX_PIN_CFG_PA_PE_G0_POL FIELD32(0x00000020)
959#define TX_PIN_CFG_PA_PE_A1_POL FIELD32(0x00000040)
960#define TX_PIN_CFG_PA_PE_G1_POL FIELD32(0x00000080)
961#define TX_PIN_CFG_LNA_PE_A0_EN FIELD32(0x00000100)
962#define TX_PIN_CFG_LNA_PE_G0_EN FIELD32(0x00000200)
963#define TX_PIN_CFG_LNA_PE_A1_EN FIELD32(0x00000400)
964#define TX_PIN_CFG_LNA_PE_G1_EN FIELD32(0x00000800)
965#define TX_PIN_CFG_LNA_PE_A0_POL FIELD32(0x00001000)
966#define TX_PIN_CFG_LNA_PE_G0_POL FIELD32(0x00002000)
967#define TX_PIN_CFG_LNA_PE_A1_POL FIELD32(0x00004000)
968#define TX_PIN_CFG_LNA_PE_G1_POL FIELD32(0x00008000)
969#define TX_PIN_CFG_RFTR_EN FIELD32(0x00010000)
970#define TX_PIN_CFG_RFTR_POL FIELD32(0x00020000)
971#define TX_PIN_CFG_TRSW_EN FIELD32(0x00040000)
972#define TX_PIN_CFG_TRSW_POL FIELD32(0x00080000)
973
974/*
975 * TX_BAND_CFG: 0x1 use upper 20MHz, 0x0 use lower 20MHz
976 */
977#define TX_BAND_CFG 0x132c
Gertjan van Wingerdea21ee722010-05-03 22:43:04 +0200978#define TX_BAND_CFG_HT40_MINUS FIELD32(0x00000001)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +0100979#define TX_BAND_CFG_A FIELD32(0x00000002)
980#define TX_BAND_CFG_BG FIELD32(0x00000004)
981
982/*
983 * TX_SW_CFG0:
984 */
985#define TX_SW_CFG0 0x1330
986
987/*
988 * TX_SW_CFG1:
989 */
990#define TX_SW_CFG1 0x1334
991
992/*
993 * TX_SW_CFG2:
994 */
995#define TX_SW_CFG2 0x1338
996
997/*
998 * TXOP_THRES_CFG:
999 */
1000#define TXOP_THRES_CFG 0x133c
1001
1002/*
1003 * TXOP_CTRL_CFG:
Helmut Schaa961621a2010-11-04 20:36:59 +01001004 * TIMEOUT_TRUN_EN: Enable/Disable TXOP timeout truncation
1005 * AC_TRUN_EN: Enable/Disable truncation for AC change
1006 * TXRATEGRP_TRUN_EN: Enable/Disable truncation for TX rate group change
1007 * USER_MODE_TRUN_EN: Enable/Disable truncation for user TXOP mode
1008 * MIMO_PS_TRUN_EN: Enable/Disable truncation for MIMO PS RTS/CTS
1009 * RESERVED_TRUN_EN: Reserved
1010 * LSIG_TXOP_EN: Enable/Disable L-SIG TXOP protection
1011 * EXT_CCA_EN: Enable/Disable extension channel CCA reference (Defer 40Mhz
1012 * transmissions if extension CCA is clear).
1013 * EXT_CCA_DLY: Extension CCA signal delay time (unit: us)
1014 * EXT_CWMIN: CwMin for extension channel backoff
1015 * 0: Disabled
1016 *
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001017 */
1018#define TXOP_CTRL_CFG 0x1340
Helmut Schaa961621a2010-11-04 20:36:59 +01001019#define TXOP_CTRL_CFG_TIMEOUT_TRUN_EN FIELD32(0x00000001)
1020#define TXOP_CTRL_CFG_AC_TRUN_EN FIELD32(0x00000002)
1021#define TXOP_CTRL_CFG_TXRATEGRP_TRUN_EN FIELD32(0x00000004)
1022#define TXOP_CTRL_CFG_USER_MODE_TRUN_EN FIELD32(0x00000008)
1023#define TXOP_CTRL_CFG_MIMO_PS_TRUN_EN FIELD32(0x00000010)
1024#define TXOP_CTRL_CFG_RESERVED_TRUN_EN FIELD32(0x00000020)
1025#define TXOP_CTRL_CFG_LSIG_TXOP_EN FIELD32(0x00000040)
1026#define TXOP_CTRL_CFG_EXT_CCA_EN FIELD32(0x00000080)
1027#define TXOP_CTRL_CFG_EXT_CCA_DLY FIELD32(0x0000ff00)
1028#define TXOP_CTRL_CFG_EXT_CWMIN FIELD32(0x000f0000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001029
1030/*
1031 * TX_RTS_CFG:
1032 * RTS_THRES: unit:byte
1033 * RTS_FBK_EN: enable rts rate fallback
1034 */
1035#define TX_RTS_CFG 0x1344
1036#define TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT FIELD32(0x000000ff)
1037#define TX_RTS_CFG_RTS_THRES FIELD32(0x00ffff00)
1038#define TX_RTS_CFG_RTS_FBK_EN FIELD32(0x01000000)
1039
1040/*
1041 * TX_TIMEOUT_CFG:
1042 * MPDU_LIFETIME: expiration time = 2^(9+MPDU LIFE TIME) us
1043 * RX_ACK_TIMEOUT: unit:slot. Used for TX procedure
1044 * TX_OP_TIMEOUT: TXOP timeout value for TXOP truncation.
1045 * it is recommended that:
1046 * (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT)
1047 */
1048#define TX_TIMEOUT_CFG 0x1348
1049#define TX_TIMEOUT_CFG_MPDU_LIFETIME FIELD32(0x000000f0)
1050#define TX_TIMEOUT_CFG_RX_ACK_TIMEOUT FIELD32(0x0000ff00)
1051#define TX_TIMEOUT_CFG_TX_OP_TIMEOUT FIELD32(0x00ff0000)
1052
1053/*
1054 * TX_RTY_CFG:
1055 * SHORT_RTY_LIMIT: short retry limit
1056 * LONG_RTY_LIMIT: long retry limit
1057 * LONG_RTY_THRE: Long retry threshoold
1058 * NON_AGG_RTY_MODE: Non-Aggregate MPDU retry mode
1059 * 0:expired by retry limit, 1: expired by mpdu life timer
1060 * AGG_RTY_MODE: Aggregate MPDU retry mode
1061 * 0:expired by retry limit, 1: expired by mpdu life timer
1062 * TX_AUTO_FB_ENABLE: Tx retry PHY rate auto fallback enable
1063 */
1064#define TX_RTY_CFG 0x134c
1065#define TX_RTY_CFG_SHORT_RTY_LIMIT FIELD32(0x000000ff)
1066#define TX_RTY_CFG_LONG_RTY_LIMIT FIELD32(0x0000ff00)
1067#define TX_RTY_CFG_LONG_RTY_THRE FIELD32(0x0fff0000)
1068#define TX_RTY_CFG_NON_AGG_RTY_MODE FIELD32(0x10000000)
1069#define TX_RTY_CFG_AGG_RTY_MODE FIELD32(0x20000000)
1070#define TX_RTY_CFG_TX_AUTO_FB_ENABLE FIELD32(0x40000000)
1071
1072/*
1073 * TX_LINK_CFG:
1074 * REMOTE_MFB_LIFETIME: remote MFB life time. unit: 32us
1075 * MFB_ENABLE: TX apply remote MFB 1:enable
1076 * REMOTE_UMFS_ENABLE: remote unsolicit MFB enable
1077 * 0: not apply remote remote unsolicit (MFS=7)
1078 * TX_MRQ_EN: MCS request TX enable
1079 * TX_RDG_EN: RDG TX enable
1080 * TX_CF_ACK_EN: Piggyback CF-ACK enable
1081 * REMOTE_MFB: remote MCS feedback
1082 * REMOTE_MFS: remote MCS feedback sequence number
1083 */
1084#define TX_LINK_CFG 0x1350
1085#define TX_LINK_CFG_REMOTE_MFB_LIFETIME FIELD32(0x000000ff)
1086#define TX_LINK_CFG_MFB_ENABLE FIELD32(0x00000100)
1087#define TX_LINK_CFG_REMOTE_UMFS_ENABLE FIELD32(0x00000200)
1088#define TX_LINK_CFG_TX_MRQ_EN FIELD32(0x00000400)
1089#define TX_LINK_CFG_TX_RDG_EN FIELD32(0x00000800)
1090#define TX_LINK_CFG_TX_CF_ACK_EN FIELD32(0x00001000)
1091#define TX_LINK_CFG_REMOTE_MFB FIELD32(0x00ff0000)
1092#define TX_LINK_CFG_REMOTE_MFS FIELD32(0xff000000)
1093
1094/*
1095 * HT_FBK_CFG0:
1096 */
1097#define HT_FBK_CFG0 0x1354
1098#define HT_FBK_CFG0_HTMCS0FBK FIELD32(0x0000000f)
1099#define HT_FBK_CFG0_HTMCS1FBK FIELD32(0x000000f0)
1100#define HT_FBK_CFG0_HTMCS2FBK FIELD32(0x00000f00)
1101#define HT_FBK_CFG0_HTMCS3FBK FIELD32(0x0000f000)
1102#define HT_FBK_CFG0_HTMCS4FBK FIELD32(0x000f0000)
1103#define HT_FBK_CFG0_HTMCS5FBK FIELD32(0x00f00000)
1104#define HT_FBK_CFG0_HTMCS6FBK FIELD32(0x0f000000)
1105#define HT_FBK_CFG0_HTMCS7FBK FIELD32(0xf0000000)
1106
1107/*
1108 * HT_FBK_CFG1:
1109 */
1110#define HT_FBK_CFG1 0x1358
1111#define HT_FBK_CFG1_HTMCS8FBK FIELD32(0x0000000f)
1112#define HT_FBK_CFG1_HTMCS9FBK FIELD32(0x000000f0)
1113#define HT_FBK_CFG1_HTMCS10FBK FIELD32(0x00000f00)
1114#define HT_FBK_CFG1_HTMCS11FBK FIELD32(0x0000f000)
1115#define HT_FBK_CFG1_HTMCS12FBK FIELD32(0x000f0000)
1116#define HT_FBK_CFG1_HTMCS13FBK FIELD32(0x00f00000)
1117#define HT_FBK_CFG1_HTMCS14FBK FIELD32(0x0f000000)
1118#define HT_FBK_CFG1_HTMCS15FBK FIELD32(0xf0000000)
1119
1120/*
1121 * LG_FBK_CFG0:
1122 */
1123#define LG_FBK_CFG0 0x135c
1124#define LG_FBK_CFG0_OFDMMCS0FBK FIELD32(0x0000000f)
1125#define LG_FBK_CFG0_OFDMMCS1FBK FIELD32(0x000000f0)
1126#define LG_FBK_CFG0_OFDMMCS2FBK FIELD32(0x00000f00)
1127#define LG_FBK_CFG0_OFDMMCS3FBK FIELD32(0x0000f000)
1128#define LG_FBK_CFG0_OFDMMCS4FBK FIELD32(0x000f0000)
1129#define LG_FBK_CFG0_OFDMMCS5FBK FIELD32(0x00f00000)
1130#define LG_FBK_CFG0_OFDMMCS6FBK FIELD32(0x0f000000)
1131#define LG_FBK_CFG0_OFDMMCS7FBK FIELD32(0xf0000000)
1132
1133/*
1134 * LG_FBK_CFG1:
1135 */
1136#define LG_FBK_CFG1 0x1360
1137#define LG_FBK_CFG0_CCKMCS0FBK FIELD32(0x0000000f)
1138#define LG_FBK_CFG0_CCKMCS1FBK FIELD32(0x000000f0)
1139#define LG_FBK_CFG0_CCKMCS2FBK FIELD32(0x00000f00)
1140#define LG_FBK_CFG0_CCKMCS3FBK FIELD32(0x0000f000)
1141
1142/*
1143 * CCK_PROT_CFG: CCK Protection
1144 * PROTECT_RATE: Protection control frame rate for CCK TX(RTS/CTS/CFEnd)
1145 * PROTECT_CTRL: Protection control frame type for CCK TX
1146 * 0:none, 1:RTS/CTS, 2:CTS-to-self
Shiang Tu6f492b62011-02-20 13:56:54 +01001147 * PROTECT_NAV_SHORT: TXOP protection type for CCK TX with short NAV
1148 * PROTECT_NAV_LONG: TXOP protection type for CCK TX with long NAV
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001149 * TX_OP_ALLOW_CCK: CCK TXOP allowance, 0:disallow
1150 * TX_OP_ALLOW_OFDM: CCK TXOP allowance, 0:disallow
1151 * TX_OP_ALLOW_MM20: CCK TXOP allowance, 0:disallow
1152 * TX_OP_ALLOW_MM40: CCK TXOP allowance, 0:disallow
1153 * TX_OP_ALLOW_GF20: CCK TXOP allowance, 0:disallow
1154 * TX_OP_ALLOW_GF40: CCK TXOP allowance, 0:disallow
1155 * RTS_TH_EN: RTS threshold enable on CCK TX
1156 */
1157#define CCK_PROT_CFG 0x1364
1158#define CCK_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1159#define CCK_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
Shiang Tu6f492b62011-02-20 13:56:54 +01001160#define CCK_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1161#define CCK_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001162#define CCK_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1163#define CCK_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1164#define CCK_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1165#define CCK_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1166#define CCK_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1167#define CCK_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1168#define CCK_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1169
1170/*
1171 * OFDM_PROT_CFG: OFDM Protection
1172 */
1173#define OFDM_PROT_CFG 0x1368
1174#define OFDM_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1175#define OFDM_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
Shiang Tu6f492b62011-02-20 13:56:54 +01001176#define OFDM_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1177#define OFDM_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001178#define OFDM_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1179#define OFDM_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1180#define OFDM_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1181#define OFDM_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1182#define OFDM_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1183#define OFDM_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1184#define OFDM_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1185
1186/*
1187 * MM20_PROT_CFG: MM20 Protection
1188 */
1189#define MM20_PROT_CFG 0x136c
1190#define MM20_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1191#define MM20_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
Shiang Tu6f492b62011-02-20 13:56:54 +01001192#define MM20_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1193#define MM20_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001194#define MM20_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1195#define MM20_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1196#define MM20_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1197#define MM20_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1198#define MM20_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1199#define MM20_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1200#define MM20_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1201
1202/*
1203 * MM40_PROT_CFG: MM40 Protection
1204 */
1205#define MM40_PROT_CFG 0x1370
1206#define MM40_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1207#define MM40_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
Shiang Tu6f492b62011-02-20 13:56:54 +01001208#define MM40_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1209#define MM40_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001210#define MM40_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1211#define MM40_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1212#define MM40_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1213#define MM40_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1214#define MM40_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1215#define MM40_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1216#define MM40_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1217
1218/*
1219 * GF20_PROT_CFG: GF20 Protection
1220 */
1221#define GF20_PROT_CFG 0x1374
1222#define GF20_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1223#define GF20_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
Shiang Tu6f492b62011-02-20 13:56:54 +01001224#define GF20_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1225#define GF20_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001226#define GF20_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1227#define GF20_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1228#define GF20_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1229#define GF20_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1230#define GF20_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1231#define GF20_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1232#define GF20_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1233
1234/*
1235 * GF40_PROT_CFG: GF40 Protection
1236 */
1237#define GF40_PROT_CFG 0x1378
1238#define GF40_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff)
1239#define GF40_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000)
Shiang Tu6f492b62011-02-20 13:56:54 +01001240#define GF40_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000)
1241#define GF40_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001242#define GF40_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000)
1243#define GF40_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000)
1244#define GF40_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000)
1245#define GF40_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000)
1246#define GF40_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000)
1247#define GF40_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000)
1248#define GF40_PROT_CFG_RTS_TH_EN FIELD32(0x04000000)
1249
1250/*
1251 * EXP_CTS_TIME:
1252 */
1253#define EXP_CTS_TIME 0x137c
1254
1255/*
1256 * EXP_ACK_TIME:
1257 */
1258#define EXP_ACK_TIME 0x1380
1259
1260/*
1261 * RX_FILTER_CFG: RX configuration register.
1262 */
1263#define RX_FILTER_CFG 0x1400
1264#define RX_FILTER_CFG_DROP_CRC_ERROR FIELD32(0x00000001)
1265#define RX_FILTER_CFG_DROP_PHY_ERROR FIELD32(0x00000002)
1266#define RX_FILTER_CFG_DROP_NOT_TO_ME FIELD32(0x00000004)
1267#define RX_FILTER_CFG_DROP_NOT_MY_BSSD FIELD32(0x00000008)
1268#define RX_FILTER_CFG_DROP_VER_ERROR FIELD32(0x00000010)
1269#define RX_FILTER_CFG_DROP_MULTICAST FIELD32(0x00000020)
1270#define RX_FILTER_CFG_DROP_BROADCAST FIELD32(0x00000040)
1271#define RX_FILTER_CFG_DROP_DUPLICATE FIELD32(0x00000080)
1272#define RX_FILTER_CFG_DROP_CF_END_ACK FIELD32(0x00000100)
1273#define RX_FILTER_CFG_DROP_CF_END FIELD32(0x00000200)
1274#define RX_FILTER_CFG_DROP_ACK FIELD32(0x00000400)
1275#define RX_FILTER_CFG_DROP_CTS FIELD32(0x00000800)
1276#define RX_FILTER_CFG_DROP_RTS FIELD32(0x00001000)
1277#define RX_FILTER_CFG_DROP_PSPOLL FIELD32(0x00002000)
1278#define RX_FILTER_CFG_DROP_BA FIELD32(0x00004000)
1279#define RX_FILTER_CFG_DROP_BAR FIELD32(0x00008000)
1280#define RX_FILTER_CFG_DROP_CNTL FIELD32(0x00010000)
1281
1282/*
1283 * AUTO_RSP_CFG:
1284 * AUTORESPONDER: 0: disable, 1: enable
1285 * BAC_ACK_POLICY: 0:long, 1:short preamble
1286 * CTS_40_MMODE: Response CTS 40MHz duplicate mode
1287 * CTS_40_MREF: Response CTS 40MHz duplicate mode
1288 * AR_PREAMBLE: Auto responder preamble 0:long, 1:short preamble
1289 * DUAL_CTS_EN: Power bit value in control frame
1290 * ACK_CTS_PSM_BIT:Power bit value in control frame
1291 */
1292#define AUTO_RSP_CFG 0x1404
1293#define AUTO_RSP_CFG_AUTORESPONDER FIELD32(0x00000001)
1294#define AUTO_RSP_CFG_BAC_ACK_POLICY FIELD32(0x00000002)
1295#define AUTO_RSP_CFG_CTS_40_MMODE FIELD32(0x00000004)
1296#define AUTO_RSP_CFG_CTS_40_MREF FIELD32(0x00000008)
1297#define AUTO_RSP_CFG_AR_PREAMBLE FIELD32(0x00000010)
1298#define AUTO_RSP_CFG_DUAL_CTS_EN FIELD32(0x00000040)
1299#define AUTO_RSP_CFG_ACK_CTS_PSM_BIT FIELD32(0x00000080)
1300
1301/*
1302 * LEGACY_BASIC_RATE:
1303 */
1304#define LEGACY_BASIC_RATE 0x1408
1305
1306/*
1307 * HT_BASIC_RATE:
1308 */
1309#define HT_BASIC_RATE 0x140c
1310
1311/*
1312 * HT_CTRL_CFG:
1313 */
1314#define HT_CTRL_CFG 0x1410
1315
1316/*
1317 * SIFS_COST_CFG:
1318 */
1319#define SIFS_COST_CFG 0x1414
1320
1321/*
1322 * RX_PARSER_CFG:
1323 * Set NAV for all received frames
1324 */
1325#define RX_PARSER_CFG 0x1418
1326
1327/*
1328 * TX_SEC_CNT0:
1329 */
1330#define TX_SEC_CNT0 0x1500
1331
1332/*
1333 * RX_SEC_CNT0:
1334 */
1335#define RX_SEC_CNT0 0x1504
1336
1337/*
1338 * CCMP_FC_MUTE:
1339 */
1340#define CCMP_FC_MUTE 0x1508
1341
1342/*
1343 * TXOP_HLDR_ADDR0:
1344 */
1345#define TXOP_HLDR_ADDR0 0x1600
1346
1347/*
1348 * TXOP_HLDR_ADDR1:
1349 */
1350#define TXOP_HLDR_ADDR1 0x1604
1351
1352/*
1353 * TXOP_HLDR_ET:
1354 */
1355#define TXOP_HLDR_ET 0x1608
1356
1357/*
1358 * QOS_CFPOLL_RA_DW0:
1359 */
1360#define QOS_CFPOLL_RA_DW0 0x160c
1361
1362/*
1363 * QOS_CFPOLL_RA_DW1:
1364 */
1365#define QOS_CFPOLL_RA_DW1 0x1610
1366
1367/*
1368 * QOS_CFPOLL_QC:
1369 */
1370#define QOS_CFPOLL_QC 0x1614
1371
1372/*
1373 * RX_STA_CNT0: RX PLCP error count & RX CRC error count
1374 */
1375#define RX_STA_CNT0 0x1700
1376#define RX_STA_CNT0_CRC_ERR FIELD32(0x0000ffff)
1377#define RX_STA_CNT0_PHY_ERR FIELD32(0xffff0000)
1378
1379/*
1380 * RX_STA_CNT1: RX False CCA count & RX LONG frame count
1381 */
1382#define RX_STA_CNT1 0x1704
1383#define RX_STA_CNT1_FALSE_CCA FIELD32(0x0000ffff)
1384#define RX_STA_CNT1_PLCP_ERR FIELD32(0xffff0000)
1385
1386/*
1387 * RX_STA_CNT2:
1388 */
1389#define RX_STA_CNT2 0x1708
1390#define RX_STA_CNT2_RX_DUPLI_COUNT FIELD32(0x0000ffff)
1391#define RX_STA_CNT2_RX_FIFO_OVERFLOW FIELD32(0xffff0000)
1392
1393/*
1394 * TX_STA_CNT0: TX Beacon count
1395 */
1396#define TX_STA_CNT0 0x170c
1397#define TX_STA_CNT0_TX_FAIL_COUNT FIELD32(0x0000ffff)
1398#define TX_STA_CNT0_TX_BEACON_COUNT FIELD32(0xffff0000)
1399
1400/*
1401 * TX_STA_CNT1: TX tx count
1402 */
1403#define TX_STA_CNT1 0x1710
1404#define TX_STA_CNT1_TX_SUCCESS FIELD32(0x0000ffff)
1405#define TX_STA_CNT1_TX_RETRANSMIT FIELD32(0xffff0000)
1406
1407/*
1408 * TX_STA_CNT2: TX tx count
1409 */
1410#define TX_STA_CNT2 0x1714
1411#define TX_STA_CNT2_TX_ZERO_LEN_COUNT FIELD32(0x0000ffff)
1412#define TX_STA_CNT2_TX_UNDER_FLOW_COUNT FIELD32(0xffff0000)
1413
1414/*
Helmut Schaa0856d9c2010-08-06 20:48:27 +02001415 * TX_STA_FIFO: TX Result for specific PID status fifo register.
1416 *
1417 * This register is implemented as FIFO with 16 entries in the HW. Each
1418 * register read fetches the next tx result. If the FIFO is full because
1419 * it wasn't read fast enough after the according interrupt (TX_FIFO_STATUS)
1420 * triggered, the hw seems to simply drop further tx results.
1421 *
1422 * VALID: 1: this tx result is valid
1423 * 0: no valid tx result -> driver should stop reading
1424 * PID_TYPE: The PID latched from the PID field in the TXWI, can be used
1425 * to match a frame with its tx result (even though the PID is
1426 * only 4 bits wide).
Ivo van Doornbc8a9792010-10-02 11:32:43 +02001427 * PID_QUEUE: Part of PID_TYPE, this is the queue index number (0-3)
1428 * PID_ENTRY: Part of PID_TYPE, this is the queue entry index number (1-3)
1429 * This identification number is calculated by ((idx % 3) + 1).
Helmut Schaa0856d9c2010-08-06 20:48:27 +02001430 * TX_SUCCESS: Indicates tx success (1) or failure (0)
1431 * TX_AGGRE: Indicates if the frame was part of an aggregate (1) or not (0)
1432 * TX_ACK_REQUIRED: Indicates if the frame needed to get ack'ed (1) or not (0)
1433 * WCID: The wireless client ID.
1434 * MCS: The tx rate used during the last transmission of this frame, be it
1435 * successful or not.
1436 * PHYMODE: The phymode used for the transmission.
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001437 */
1438#define TX_STA_FIFO 0x1718
1439#define TX_STA_FIFO_VALID FIELD32(0x00000001)
1440#define TX_STA_FIFO_PID_TYPE FIELD32(0x0000001e)
Ivo van Doornbc8a9792010-10-02 11:32:43 +02001441#define TX_STA_FIFO_PID_QUEUE FIELD32(0x00000006)
1442#define TX_STA_FIFO_PID_ENTRY FIELD32(0x00000018)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001443#define TX_STA_FIFO_TX_SUCCESS FIELD32(0x00000020)
1444#define TX_STA_FIFO_TX_AGGRE FIELD32(0x00000040)
1445#define TX_STA_FIFO_TX_ACK_REQUIRED FIELD32(0x00000080)
1446#define TX_STA_FIFO_WCID FIELD32(0x0000ff00)
1447#define TX_STA_FIFO_SUCCESS_RATE FIELD32(0xffff0000)
1448#define TX_STA_FIFO_MCS FIELD32(0x007f0000)
1449#define TX_STA_FIFO_PHYMODE FIELD32(0xc0000000)
1450
1451/*
1452 * TX_AGG_CNT: Debug counter
1453 */
1454#define TX_AGG_CNT 0x171c
1455#define TX_AGG_CNT_NON_AGG_TX_COUNT FIELD32(0x0000ffff)
1456#define TX_AGG_CNT_AGG_TX_COUNT FIELD32(0xffff0000)
1457
1458/*
1459 * TX_AGG_CNT0:
1460 */
1461#define TX_AGG_CNT0 0x1720
1462#define TX_AGG_CNT0_AGG_SIZE_1_COUNT FIELD32(0x0000ffff)
1463#define TX_AGG_CNT0_AGG_SIZE_2_COUNT FIELD32(0xffff0000)
1464
1465/*
1466 * TX_AGG_CNT1:
1467 */
1468#define TX_AGG_CNT1 0x1724
1469#define TX_AGG_CNT1_AGG_SIZE_3_COUNT FIELD32(0x0000ffff)
1470#define TX_AGG_CNT1_AGG_SIZE_4_COUNT FIELD32(0xffff0000)
1471
1472/*
1473 * TX_AGG_CNT2:
1474 */
1475#define TX_AGG_CNT2 0x1728
1476#define TX_AGG_CNT2_AGG_SIZE_5_COUNT FIELD32(0x0000ffff)
1477#define TX_AGG_CNT2_AGG_SIZE_6_COUNT FIELD32(0xffff0000)
1478
1479/*
1480 * TX_AGG_CNT3:
1481 */
1482#define TX_AGG_CNT3 0x172c
1483#define TX_AGG_CNT3_AGG_SIZE_7_COUNT FIELD32(0x0000ffff)
1484#define TX_AGG_CNT3_AGG_SIZE_8_COUNT FIELD32(0xffff0000)
1485
1486/*
1487 * TX_AGG_CNT4:
1488 */
1489#define TX_AGG_CNT4 0x1730
1490#define TX_AGG_CNT4_AGG_SIZE_9_COUNT FIELD32(0x0000ffff)
1491#define TX_AGG_CNT4_AGG_SIZE_10_COUNT FIELD32(0xffff0000)
1492
1493/*
1494 * TX_AGG_CNT5:
1495 */
1496#define TX_AGG_CNT5 0x1734
1497#define TX_AGG_CNT5_AGG_SIZE_11_COUNT FIELD32(0x0000ffff)
1498#define TX_AGG_CNT5_AGG_SIZE_12_COUNT FIELD32(0xffff0000)
1499
1500/*
1501 * TX_AGG_CNT6:
1502 */
1503#define TX_AGG_CNT6 0x1738
1504#define TX_AGG_CNT6_AGG_SIZE_13_COUNT FIELD32(0x0000ffff)
1505#define TX_AGG_CNT6_AGG_SIZE_14_COUNT FIELD32(0xffff0000)
1506
1507/*
1508 * TX_AGG_CNT7:
1509 */
1510#define TX_AGG_CNT7 0x173c
1511#define TX_AGG_CNT7_AGG_SIZE_15_COUNT FIELD32(0x0000ffff)
1512#define TX_AGG_CNT7_AGG_SIZE_16_COUNT FIELD32(0xffff0000)
1513
1514/*
1515 * MPDU_DENSITY_CNT:
1516 * TX_ZERO_DEL: TX zero length delimiter count
1517 * RX_ZERO_DEL: RX zero length delimiter count
1518 */
1519#define MPDU_DENSITY_CNT 0x1740
1520#define MPDU_DENSITY_CNT_TX_ZERO_DEL FIELD32(0x0000ffff)
1521#define MPDU_DENSITY_CNT_RX_ZERO_DEL FIELD32(0xffff0000)
1522
1523/*
1524 * Security key table memory.
Helmut Schaa2a0cfeb2010-10-02 11:26:17 +02001525 *
1526 * The pairwise key table shares some memory with the beacon frame
1527 * buffers 6 and 7. That basically means that when beacon 6 & 7
1528 * are used we should only use the reduced pairwise key table which
1529 * has a maximum of 222 entries.
1530 *
1531 * ---------------------------------------------
1532 * |0x4000 | Pairwise Key | Reduced Pairwise |
1533 * | | Table | Key Table |
1534 * | | Size: 256 * 32 | Size: 222 * 32 |
1535 * |0x5BC0 | |-------------------
1536 * | | | Beacon 6 |
1537 * |0x5DC0 | |-------------------
1538 * | | | Beacon 7 |
1539 * |0x5FC0 | |-------------------
1540 * |0x5FFF | |
1541 * --------------------------
1542 *
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001543 * MAC_WCID_BASE: 8-bytes (use only 6 bytes) * 256 entry
1544 * PAIRWISE_KEY_TABLE_BASE: 32-byte * 256 entry
1545 * MAC_IVEIV_TABLE_BASE: 8-byte * 256-entry
1546 * MAC_WCID_ATTRIBUTE_BASE: 4-byte * 256-entry
Bartlomiej Zolnierkiewicza4385212009-11-04 18:36:02 +01001547 * SHARED_KEY_TABLE_BASE: 32-byte * 16-entry
1548 * SHARED_KEY_MODE_BASE: 4-byte * 16-entry
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001549 */
1550#define MAC_WCID_BASE 0x1800
1551#define PAIRWISE_KEY_TABLE_BASE 0x4000
1552#define MAC_IVEIV_TABLE_BASE 0x6000
1553#define MAC_WCID_ATTRIBUTE_BASE 0x6800
1554#define SHARED_KEY_TABLE_BASE 0x6c00
1555#define SHARED_KEY_MODE_BASE 0x7000
1556
1557#define MAC_WCID_ENTRY(__idx) \
Mark Einonfd8dab92010-11-06 15:44:52 +01001558 (MAC_WCID_BASE + ((__idx) * sizeof(struct mac_wcid_entry)))
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001559#define PAIRWISE_KEY_ENTRY(__idx) \
Mark Einonfd8dab92010-11-06 15:44:52 +01001560 (PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)))
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001561#define MAC_IVEIV_ENTRY(__idx) \
Mark Einonfd8dab92010-11-06 15:44:52 +01001562 (MAC_IVEIV_TABLE_BASE + ((__idx) * sizeof(struct mac_iveiv_entry)))
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001563#define MAC_WCID_ATTR_ENTRY(__idx) \
Mark Einonfd8dab92010-11-06 15:44:52 +01001564 (MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)))
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001565#define SHARED_KEY_ENTRY(__idx) \
Mark Einonfd8dab92010-11-06 15:44:52 +01001566 (SHARED_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)))
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001567#define SHARED_KEY_MODE_ENTRY(__idx) \
Mark Einonfd8dab92010-11-06 15:44:52 +01001568 (SHARED_KEY_MODE_BASE + ((__idx) * sizeof(u32)))
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001569
1570struct mac_wcid_entry {
1571 u8 mac[6];
1572 u8 reserved[2];
Eric Dumazetba2d3582010-06-02 18:10:09 +00001573} __packed;
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001574
1575struct hw_key_entry {
1576 u8 key[16];
1577 u8 tx_mic[8];
1578 u8 rx_mic[8];
Eric Dumazetba2d3582010-06-02 18:10:09 +00001579} __packed;
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001580
1581struct mac_iveiv_entry {
1582 u8 iv[8];
Eric Dumazetba2d3582010-06-02 18:10:09 +00001583} __packed;
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001584
1585/*
1586 * MAC_WCID_ATTRIBUTE:
1587 */
1588#define MAC_WCID_ATTRIBUTE_KEYTAB FIELD32(0x00000001)
1589#define MAC_WCID_ATTRIBUTE_CIPHER FIELD32(0x0000000e)
1590#define MAC_WCID_ATTRIBUTE_BSS_IDX FIELD32(0x00000070)
1591#define MAC_WCID_ATTRIBUTE_RX_WIUDF FIELD32(0x00000380)
Ivo van Doorne4a0ab32010-06-14 22:14:19 +02001592#define MAC_WCID_ATTRIBUTE_CIPHER_EXT FIELD32(0x00000400)
1593#define MAC_WCID_ATTRIBUTE_BSS_IDX_EXT FIELD32(0x00000800)
1594#define MAC_WCID_ATTRIBUTE_WAPI_MCBC FIELD32(0x00008000)
1595#define MAC_WCID_ATTRIBUTE_WAPI_KEY_IDX FIELD32(0xff000000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001596
1597/*
1598 * SHARED_KEY_MODE:
1599 */
1600#define SHARED_KEY_MODE_BSS0_KEY0 FIELD32(0x00000007)
1601#define SHARED_KEY_MODE_BSS0_KEY1 FIELD32(0x00000070)
1602#define SHARED_KEY_MODE_BSS0_KEY2 FIELD32(0x00000700)
1603#define SHARED_KEY_MODE_BSS0_KEY3 FIELD32(0x00007000)
1604#define SHARED_KEY_MODE_BSS1_KEY0 FIELD32(0x00070000)
1605#define SHARED_KEY_MODE_BSS1_KEY1 FIELD32(0x00700000)
1606#define SHARED_KEY_MODE_BSS1_KEY2 FIELD32(0x07000000)
1607#define SHARED_KEY_MODE_BSS1_KEY3 FIELD32(0x70000000)
1608
1609/*
1610 * HOST-MCU communication
1611 */
1612
1613/*
1614 * H2M_MAILBOX_CSR: Host-to-MCU Mailbox.
1615 */
1616#define H2M_MAILBOX_CSR 0x7010
1617#define H2M_MAILBOX_CSR_ARG0 FIELD32(0x000000ff)
1618#define H2M_MAILBOX_CSR_ARG1 FIELD32(0x0000ff00)
1619#define H2M_MAILBOX_CSR_CMD_TOKEN FIELD32(0x00ff0000)
1620#define H2M_MAILBOX_CSR_OWNER FIELD32(0xff000000)
1621
1622/*
1623 * H2M_MAILBOX_CID:
1624 */
1625#define H2M_MAILBOX_CID 0x7014
1626#define H2M_MAILBOX_CID_CMD0 FIELD32(0x000000ff)
1627#define H2M_MAILBOX_CID_CMD1 FIELD32(0x0000ff00)
1628#define H2M_MAILBOX_CID_CMD2 FIELD32(0x00ff0000)
1629#define H2M_MAILBOX_CID_CMD3 FIELD32(0xff000000)
1630
1631/*
1632 * H2M_MAILBOX_STATUS:
1633 */
1634#define H2M_MAILBOX_STATUS 0x701c
1635
1636/*
1637 * H2M_INT_SRC:
1638 */
1639#define H2M_INT_SRC 0x7024
1640
1641/*
1642 * H2M_BBP_AGENT:
1643 */
1644#define H2M_BBP_AGENT 0x7028
1645
1646/*
1647 * MCU_LEDCS: LED control for MCU Mailbox.
1648 */
1649#define MCU_LEDCS_LED_MODE FIELD8(0x1f)
1650#define MCU_LEDCS_POLARITY FIELD8(0x01)
1651
1652/*
1653 * HW_CS_CTS_BASE:
1654 * Carrier-sense CTS frame base address.
1655 * It's where mac stores carrier-sense frame for carrier-sense function.
1656 */
1657#define HW_CS_CTS_BASE 0x7700
1658
1659/*
1660 * HW_DFS_CTS_BASE:
Bartlomiej Zolnierkiewicza4385212009-11-04 18:36:02 +01001661 * DFS CTS frame base address. It's where mac stores CTS frame for DFS.
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001662 */
1663#define HW_DFS_CTS_BASE 0x7780
1664
1665/*
1666 * TXRX control registers - base address 0x3000
1667 */
1668
1669/*
1670 * TXRX_CSR1:
1671 * rt2860b UNKNOWN reg use R/O Reg Addr 0x77d0 first..
1672 */
1673#define TXRX_CSR1 0x77d0
1674
1675/*
1676 * HW_DEBUG_SETTING_BASE:
1677 * since NULL frame won't be that long (256 byte)
1678 * We steal 16 tail bytes to save debugging settings
1679 */
1680#define HW_DEBUG_SETTING_BASE 0x77f0
1681#define HW_DEBUG_SETTING_BASE2 0x7770
1682
1683/*
1684 * HW_BEACON_BASE
1685 * In order to support maximum 8 MBSS and its maximum length
1686 * is 512 bytes for each beacon
1687 * Three section discontinue memory segments will be used.
1688 * 1. The original region for BCN 0~3
1689 * 2. Extract memory from FCE table for BCN 4~5
1690 * 3. Extract memory from Pair-wise key table for BCN 6~7
1691 * It occupied those memory of wcid 238~253 for BCN 6
Helmut Schaa2a0cfeb2010-10-02 11:26:17 +02001692 * and wcid 222~237 for BCN 7 (see Security key table memory
1693 * for more info).
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001694 *
1695 * IMPORTANT NOTE: Not sure why legacy driver does this,
1696 * but HW_BEACON_BASE7 is 0x0200 bytes below HW_BEACON_BASE6.
1697 */
1698#define HW_BEACON_BASE0 0x7800
1699#define HW_BEACON_BASE1 0x7a00
1700#define HW_BEACON_BASE2 0x7c00
1701#define HW_BEACON_BASE3 0x7e00
1702#define HW_BEACON_BASE4 0x7200
1703#define HW_BEACON_BASE5 0x7400
1704#define HW_BEACON_BASE6 0x5dc0
1705#define HW_BEACON_BASE7 0x5bc0
1706
1707#define HW_BEACON_OFFSET(__index) \
Mark Einonfd8dab92010-11-06 15:44:52 +01001708 (((__index) < 4) ? (HW_BEACON_BASE0 + (__index * 0x0200)) : \
1709 (((__index) < 6) ? (HW_BEACON_BASE4 + ((__index - 4) * 0x0200)) : \
1710 (HW_BEACON_BASE6 - ((__index - 6) * 0x0200))))
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001711
1712/*
1713 * BBP registers.
1714 * The wordsize of the BBP is 8 bits.
1715 */
1716
1717/*
RA-Jay Hunge90c54b2011-02-20 13:55:25 +01001718 * BBP 1: TX Antenna & Power Control
1719 * POWER_CTRL:
1720 * 0 - normal,
1721 * 1 - drop tx power by 6dBm,
1722 * 2 - drop tx power by 12dBm,
1723 * 3 - increase tx power by 6dBm
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001724 */
RA-Jay Hunge90c54b2011-02-20 13:55:25 +01001725#define BBP1_TX_POWER_CTRL FIELD8(0x07)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001726#define BBP1_TX_ANTENNA FIELD8(0x18)
1727
1728/*
1729 * BBP 3: RX Antenna
1730 */
1731#define BBP3_RX_ANTENNA FIELD8(0x18)
Gertjan van Wingerdea21ee722010-05-03 22:43:04 +02001732#define BBP3_HT40_MINUS FIELD8(0x20)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001733
1734/*
1735 * BBP 4: Bandwidth
1736 */
1737#define BBP4_TX_BF FIELD8(0x01)
1738#define BBP4_BANDWIDTH FIELD8(0x18)
1739
1740/*
Gertjan van Wingerdefab799c2010-04-11 14:31:08 +02001741 * BBP 138: Unknown
1742 */
1743#define BBP138_RX_ADC1 FIELD8(0x02)
1744#define BBP138_RX_ADC2 FIELD8(0x04)
1745#define BBP138_TX_DAC1 FIELD8(0x20)
1746#define BBP138_TX_DAC2 FIELD8(0x40)
1747
1748/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001749 * RFCSR registers
1750 * The wordsize of the RFCSR is 8 bits.
1751 */
1752
1753/*
Gertjan van Wingerdee148b4c2010-04-11 14:31:09 +02001754 * RFCSR 1:
1755 */
1756#define RFCSR1_RF_BLOCK_EN FIELD8(0x01)
1757#define RFCSR1_RX0_PD FIELD8(0x04)
1758#define RFCSR1_TX0_PD FIELD8(0x08)
1759#define RFCSR1_RX1_PD FIELD8(0x10)
1760#define RFCSR1_TX1_PD FIELD8(0x20)
1761
1762/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001763 * RFCSR 6:
1764 */
Gertjan van Wingerdefab799c2010-04-11 14:31:08 +02001765#define RFCSR6_R1 FIELD8(0x03)
1766#define RFCSR6_R2 FIELD8(0x40)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001767
1768/*
1769 * RFCSR 7:
1770 */
1771#define RFCSR7_RF_TUNING FIELD8(0x01)
1772
1773/*
1774 * RFCSR 12:
1775 */
1776#define RFCSR12_TX_POWER FIELD8(0x1f)
1777
1778/*
Helmut Schaa5a673962010-04-23 15:54:43 +02001779 * RFCSR 13:
1780 */
1781#define RFCSR13_TX_POWER FIELD8(0x1f)
1782
1783/*
Gertjan van Wingerdee148b4c2010-04-11 14:31:09 +02001784 * RFCSR 15:
1785 */
1786#define RFCSR15_TX_LO2_EN FIELD8(0x08)
1787
1788/*
Gertjan van Wingerdefab799c2010-04-11 14:31:08 +02001789 * RFCSR 17:
1790 */
Gertjan van Wingerdee148b4c2010-04-11 14:31:09 +02001791#define RFCSR17_TXMIXER_GAIN FIELD8(0x07)
1792#define RFCSR17_TX_LO1_EN FIELD8(0x08)
1793#define RFCSR17_R FIELD8(0x20)
Gertjan van Wingerdefab799c2010-04-11 14:31:08 +02001794
Gertjan van Wingerdee148b4c2010-04-11 14:31:09 +02001795/*
1796 * RFCSR 20:
1797 */
1798#define RFCSR20_RX_LO1_EN FIELD8(0x08)
1799
1800/*
1801 * RFCSR 21:
1802 */
1803#define RFCSR21_RX_LO2_EN FIELD8(0x08)
Gertjan van Wingerdefab799c2010-04-11 14:31:08 +02001804
1805/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001806 * RFCSR 22:
1807 */
1808#define RFCSR22_BASEBAND_LOOPBACK FIELD8(0x01)
1809
1810/*
1811 * RFCSR 23:
1812 */
1813#define RFCSR23_FREQ_OFFSET FIELD8(0x7f)
1814
1815/*
Gertjan van Wingerdee148b4c2010-04-11 14:31:09 +02001816 * RFCSR 27:
1817 */
1818#define RFCSR27_R1 FIELD8(0x03)
1819#define RFCSR27_R2 FIELD8(0x04)
1820#define RFCSR27_R3 FIELD8(0x30)
1821#define RFCSR27_R4 FIELD8(0x40)
1822
1823/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001824 * RFCSR 30:
1825 */
1826#define RFCSR30_RF_CALIBRATION FIELD8(0x80)
1827
1828/*
RA-Jay Hung80d184e2011-01-10 11:28:10 +01001829 * RFCSR 31:
1830 */
1831#define RFCSR31_RX_AGC_FC FIELD8(0x1f)
1832#define RFCSR31_RX_H20M FIELD8(0x20)
1833
1834/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001835 * RF registers
1836 */
1837
1838/*
1839 * RF 2
1840 */
1841#define RF2_ANTENNA_RX2 FIELD32(0x00000040)
1842#define RF2_ANTENNA_TX1 FIELD32(0x00004000)
1843#define RF2_ANTENNA_RX1 FIELD32(0x00020000)
1844
1845/*
1846 * RF 3
1847 */
1848#define RF3_TXPOWER_G FIELD32(0x00003e00)
1849#define RF3_TXPOWER_A_7DBM_BOOST FIELD32(0x00000200)
1850#define RF3_TXPOWER_A FIELD32(0x00003c00)
1851
1852/*
1853 * RF 4
1854 */
1855#define RF4_TXPOWER_G FIELD32(0x000007c0)
1856#define RF4_TXPOWER_A_7DBM_BOOST FIELD32(0x00000040)
1857#define RF4_TXPOWER_A FIELD32(0x00000780)
1858#define RF4_FREQ_OFFSET FIELD32(0x001f8000)
1859#define RF4_HT40 FIELD32(0x00200000)
1860
1861/*
1862 * EEPROM content.
1863 * The wordsize of the EEPROM is 16 bits.
1864 */
1865
1866/*
1867 * EEPROM Version
1868 */
1869#define EEPROM_VERSION 0x0001
1870#define EEPROM_VERSION_FAE FIELD16(0x00ff)
1871#define EEPROM_VERSION_VERSION FIELD16(0xff00)
1872
1873/*
1874 * HW MAC address.
1875 */
1876#define EEPROM_MAC_ADDR_0 0x0002
1877#define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff)
1878#define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00)
1879#define EEPROM_MAC_ADDR_1 0x0003
1880#define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff)
1881#define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00)
1882#define EEPROM_MAC_ADDR_2 0x0004
1883#define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff)
1884#define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00)
1885
1886/*
RA-Jay Hung38c8a562010-12-13 12:31:27 +01001887 * EEPROM NIC Configuration 0
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001888 * RXPATH: 1: 1R, 2: 2R, 3: 3R
RA-Jay Hung38c8a562010-12-13 12:31:27 +01001889 * TXPATH: 1: 1T, 2: 2T, 3: 3T
1890 * RF_TYPE: RFIC type
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001891 */
RA-Jay Hung38c8a562010-12-13 12:31:27 +01001892#define EEPROM_NIC_CONF0 0x001a
1893#define EEPROM_NIC_CONF0_RXPATH FIELD16(0x000f)
1894#define EEPROM_NIC_CONF0_TXPATH FIELD16(0x00f0)
1895#define EEPROM_NIC_CONF0_RF_TYPE FIELD16(0x0f00)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001896
1897/*
RA-Jay Hung38c8a562010-12-13 12:31:27 +01001898 * EEPROM NIC Configuration 1
1899 * HW_RADIO: 0: disable, 1: enable
1900 * EXTERNAL_TX_ALC: 0: disable, 1: enable
1901 * EXTERNAL_LNA_2G: 0: disable, 1: enable
1902 * EXTERNAL_LNA_5G: 0: disable, 1: enable
1903 * CARDBUS_ACCEL: 0: enable, 1: disable
1904 * BW40M_SB_2G: 0: disable, 1: enable
1905 * BW40M_SB_5G: 0: disable, 1: enable
1906 * WPS_PBC: 0: disable, 1: enable
1907 * BW40M_2G: 0: enable, 1: disable
1908 * BW40M_5G: 0: enable, 1: disable
1909 * BROADBAND_EXT_LNA: 0: disable, 1: enable
1910 * ANT_DIVERSITY: 00: Disable, 01: Diversity,
1911 * 10: Main antenna, 11: Aux antenna
1912 * INTERNAL_TX_ALC: 0: disable, 1: enable
1913 * BT_COEXIST: 0: disable, 1: enable
1914 * DAC_TEST: 0: disable, 1: enable
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001915 */
RA-Jay Hung38c8a562010-12-13 12:31:27 +01001916#define EEPROM_NIC_CONF1 0x001b
1917#define EEPROM_NIC_CONF1_HW_RADIO FIELD16(0x0001)
1918#define EEPROM_NIC_CONF1_EXTERNAL_TX_ALC FIELD16(0x0002)
1919#define EEPROM_NIC_CONF1_EXTERNAL_LNA_2G FIELD16(0x0004)
1920#define EEPROM_NIC_CONF1_EXTERNAL_LNA_5G FIELD16(0x0008)
1921#define EEPROM_NIC_CONF1_CARDBUS_ACCEL FIELD16(0x0010)
1922#define EEPROM_NIC_CONF1_BW40M_SB_2G FIELD16(0x0020)
1923#define EEPROM_NIC_CONF1_BW40M_SB_5G FIELD16(0x0040)
1924#define EEPROM_NIC_CONF1_WPS_PBC FIELD16(0x0080)
1925#define EEPROM_NIC_CONF1_BW40M_2G FIELD16(0x0100)
1926#define EEPROM_NIC_CONF1_BW40M_5G FIELD16(0x0200)
1927#define EEPROM_NIC_CONF1_BROADBAND_EXT_LNA FIELD16(0x400)
1928#define EEPROM_NIC_CONF1_ANT_DIVERSITY FIELD16(0x1800)
1929#define EEPROM_NIC_CONF1_INTERNAL_TX_ALC FIELD16(0x2000)
1930#define EEPROM_NIC_CONF1_BT_COEXIST FIELD16(0x4000)
1931#define EEPROM_NIC_CONF1_DAC_TEST FIELD16(0x8000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001932
1933/*
1934 * EEPROM frequency
1935 */
1936#define EEPROM_FREQ 0x001d
1937#define EEPROM_FREQ_OFFSET FIELD16(0x00ff)
1938#define EEPROM_FREQ_LED_MODE FIELD16(0x7f00)
1939#define EEPROM_FREQ_LED_POLARITY FIELD16(0x1000)
1940
1941/*
1942 * EEPROM LED
1943 * POLARITY_RDY_G: Polarity RDY_G setting.
1944 * POLARITY_RDY_A: Polarity RDY_A setting.
1945 * POLARITY_ACT: Polarity ACT setting.
1946 * POLARITY_GPIO_0: Polarity GPIO0 setting.
1947 * POLARITY_GPIO_1: Polarity GPIO1 setting.
1948 * POLARITY_GPIO_2: Polarity GPIO2 setting.
1949 * POLARITY_GPIO_3: Polarity GPIO3 setting.
1950 * POLARITY_GPIO_4: Polarity GPIO4 setting.
1951 * LED_MODE: Led mode.
1952 */
RA-Jay Hung38c8a562010-12-13 12:31:27 +01001953#define EEPROM_LED_AG_CONF 0x001e
1954#define EEPROM_LED_ACT_CONF 0x001f
1955#define EEPROM_LED_POLARITY 0x0020
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001956#define EEPROM_LED_POLARITY_RDY_BG FIELD16(0x0001)
1957#define EEPROM_LED_POLARITY_RDY_A FIELD16(0x0002)
1958#define EEPROM_LED_POLARITY_ACT FIELD16(0x0004)
1959#define EEPROM_LED_POLARITY_GPIO_0 FIELD16(0x0008)
1960#define EEPROM_LED_POLARITY_GPIO_1 FIELD16(0x0010)
1961#define EEPROM_LED_POLARITY_GPIO_2 FIELD16(0x0020)
1962#define EEPROM_LED_POLARITY_GPIO_3 FIELD16(0x0040)
1963#define EEPROM_LED_POLARITY_GPIO_4 FIELD16(0x0080)
1964#define EEPROM_LED_LED_MODE FIELD16(0x1f00)
1965
1966/*
RA-Jay Hung38c8a562010-12-13 12:31:27 +01001967 * EEPROM NIC Configuration 2
1968 * RX_STREAM: 0: Reserved, 1: 1 Stream, 2: 2 Stream
1969 * TX_STREAM: 0: Reserved, 1: 1 Stream, 2: 2 Stream
1970 * CRYSTAL: 00: Reserved, 01: One crystal, 10: Two crystal, 11: Reserved
1971 */
1972#define EEPROM_NIC_CONF2 0x0021
1973#define EEPROM_NIC_CONF2_RX_STREAM FIELD16(0x000f)
1974#define EEPROM_NIC_CONF2_TX_STREAM FIELD16(0x00f0)
1975#define EEPROM_NIC_CONF2_CRYSTAL FIELD16(0x0600)
1976
1977/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01001978 * EEPROM LNA
1979 */
1980#define EEPROM_LNA 0x0022
1981#define EEPROM_LNA_BG FIELD16(0x00ff)
1982#define EEPROM_LNA_A0 FIELD16(0xff00)
1983
1984/*
1985 * EEPROM RSSI BG offset
1986 */
1987#define EEPROM_RSSI_BG 0x0023
1988#define EEPROM_RSSI_BG_OFFSET0 FIELD16(0x00ff)
1989#define EEPROM_RSSI_BG_OFFSET1 FIELD16(0xff00)
1990
1991/*
1992 * EEPROM RSSI BG2 offset
1993 */
1994#define EEPROM_RSSI_BG2 0x0024
1995#define EEPROM_RSSI_BG2_OFFSET2 FIELD16(0x00ff)
1996#define EEPROM_RSSI_BG2_LNA_A1 FIELD16(0xff00)
1997
1998/*
Gertjan van Wingerdee148b4c2010-04-11 14:31:09 +02001999 * EEPROM TXMIXER GAIN BG offset (note overlaps with EEPROM RSSI BG2).
2000 */
2001#define EEPROM_TXMIXER_GAIN_BG 0x0024
2002#define EEPROM_TXMIXER_GAIN_BG_VAL FIELD16(0x0007)
2003
2004/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002005 * EEPROM RSSI A offset
2006 */
2007#define EEPROM_RSSI_A 0x0025
2008#define EEPROM_RSSI_A_OFFSET0 FIELD16(0x00ff)
2009#define EEPROM_RSSI_A_OFFSET1 FIELD16(0xff00)
2010
2011/*
2012 * EEPROM RSSI A2 offset
2013 */
2014#define EEPROM_RSSI_A2 0x0026
2015#define EEPROM_RSSI_A2_OFFSET2 FIELD16(0x00ff)
2016#define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00)
2017
2018/*
RA-Jay Hunge90c54b2011-02-20 13:55:25 +01002019 * EEPROM EIRP Maximum TX power values(unit: dbm)
Ivo van Doorn8d1331b2010-08-23 19:56:07 +02002020 */
RA-Jay Hunge90c54b2011-02-20 13:55:25 +01002021#define EEPROM_EIRP_MAX_TX_POWER 0x0027
2022#define EEPROM_EIRP_MAX_TX_POWER_2GHZ FIELD16(0x00ff)
2023#define EEPROM_EIRP_MAX_TX_POWER_5GHZ FIELD16(0xff00)
Ivo van Doorn8d1331b2010-08-23 19:56:07 +02002024
2025/*
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002026 * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power.
RA-Jay Hung38c8a562010-12-13 12:31:27 +01002027 * This is delta in 40MHZ.
RA-Jay Hunge90c54b2011-02-20 13:55:25 +01002028 * VALUE: Tx Power dalta value, MAX=4(unit: dbm)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002029 * TYPE: 1: Plus the delta value, 0: minus the delta value
RA-Jay Hunge90c54b2011-02-20 13:55:25 +01002030 * ENABLE: enable tx power compensation for 40BW
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002031 */
2032#define EEPROM_TXPOWER_DELTA 0x0028
RA-Jay Hunge90c54b2011-02-20 13:55:25 +01002033#define EEPROM_TXPOWER_DELTA_VALUE_2G FIELD16(0x003f)
2034#define EEPROM_TXPOWER_DELTA_TYPE_2G FIELD16(0x0040)
2035#define EEPROM_TXPOWER_DELTA_ENABLE_2G FIELD16(0x0080)
2036#define EEPROM_TXPOWER_DELTA_VALUE_5G FIELD16(0x3f00)
2037#define EEPROM_TXPOWER_DELTA_TYPE_5G FIELD16(0x4000)
2038#define EEPROM_TXPOWER_DELTA_ENABLE_5G FIELD16(0x8000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002039
2040/*
2041 * EEPROM TXPOWER 802.11BG
2042 */
2043#define EEPROM_TXPOWER_BG1 0x0029
2044#define EEPROM_TXPOWER_BG2 0x0030
2045#define EEPROM_TXPOWER_BG_SIZE 7
2046#define EEPROM_TXPOWER_BG_1 FIELD16(0x00ff)
2047#define EEPROM_TXPOWER_BG_2 FIELD16(0xff00)
2048
2049/*
2050 * EEPROM TXPOWER 802.11A
2051 */
2052#define EEPROM_TXPOWER_A1 0x003c
2053#define EEPROM_TXPOWER_A2 0x0053
2054#define EEPROM_TXPOWER_A_SIZE 6
2055#define EEPROM_TXPOWER_A_1 FIELD16(0x00ff)
2056#define EEPROM_TXPOWER_A_2 FIELD16(0xff00)
2057
2058/*
Helmut Schaa5e846002010-07-11 12:23:09 +02002059 * EEPROM TXPOWER by rate: tx power per tx rate for HT20 mode
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002060 */
2061#define EEPROM_TXPOWER_BYRATE 0x006f
Helmut Schaa5e846002010-07-11 12:23:09 +02002062#define EEPROM_TXPOWER_BYRATE_SIZE 9
2063
2064#define EEPROM_TXPOWER_BYRATE_RATE0 FIELD16(0x000f)
2065#define EEPROM_TXPOWER_BYRATE_RATE1 FIELD16(0x00f0)
2066#define EEPROM_TXPOWER_BYRATE_RATE2 FIELD16(0x0f00)
2067#define EEPROM_TXPOWER_BYRATE_RATE3 FIELD16(0xf000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002068
2069/*
2070 * EEPROM BBP.
2071 */
2072#define EEPROM_BBP_START 0x0078
2073#define EEPROM_BBP_SIZE 16
2074#define EEPROM_BBP_VALUE FIELD16(0x00ff)
2075#define EEPROM_BBP_REG_ID FIELD16(0xff00)
2076
2077/*
2078 * MCU mailbox commands.
2079 */
2080#define MCU_SLEEP 0x30
2081#define MCU_WAKEUP 0x31
2082#define MCU_RADIO_OFF 0x35
2083#define MCU_CURRENT 0x36
2084#define MCU_LED 0x50
2085#define MCU_LED_STRENGTH 0x51
RA-Jay Hung38c8a562010-12-13 12:31:27 +01002086#define MCU_LED_AG_CONF 0x52
2087#define MCU_LED_ACT_CONF 0x53
2088#define MCU_LED_LED_POLARITY 0x54
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002089#define MCU_RADAR 0x60
2090#define MCU_BOOT_SIGNAL 0x72
RA-Jay Hungd96aa642011-02-20 13:54:52 +01002091#define MCU_ANT_SELECT 0X73
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002092#define MCU_BBP_SIGNAL 0x80
2093#define MCU_POWER_SAVE 0x83
2094
2095/*
2096 * MCU mailbox tokens
2097 */
2098#define TOKEN_WAKUP 3
2099
2100/*
2101 * DMA descriptor defines.
2102 */
Mark Einonfd8dab92010-11-06 15:44:52 +01002103#define TXWI_DESC_SIZE (4 * sizeof(__le32))
2104#define RXWI_DESC_SIZE (4 * sizeof(__le32))
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002105
2106/*
2107 * TX WI structure
2108 */
2109
2110/*
2111 * Word0
2112 * FRAG: 1 To inform TKIP engine this is a fragment.
2113 * MIMO_PS: The remote peer is in dynamic MIMO-PS mode
2114 * TX_OP: 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs
Helmut Schaacb753b72010-10-02 11:29:59 +02002115 * BW: Channel bandwidth 0:20MHz, 1:40 MHz (for legacy rates this will
2116 * duplicate the frame to both channels).
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002117 * STBC: 1: STBC support MCS =0-7, 2,3 : RESERVED
Helmut Schaa2035c0c2010-08-30 21:12:47 +02002118 * AMPDU: 1: this frame is eligible for AMPDU aggregation, the hw will
Helmut Schaa74ee3802010-10-02 11:33:42 +02002119 * aggregate consecutive frames with the same RA and QoS TID. If
2120 * a frame A with the same RA and QoS TID but AMPDU=0 is queued
2121 * directly after a frame B with AMPDU=1, frame A might still
2122 * get aggregated into the AMPDU started by frame B. So, setting
2123 * AMPDU to 0 does _not_ necessarily mean the frame is sent as
2124 * MPDU, it can still end up in an AMPDU if the previous frame
2125 * was tagged as AMPDU.
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002126 */
2127#define TXWI_W0_FRAG FIELD32(0x00000001)
2128#define TXWI_W0_MIMO_PS FIELD32(0x00000002)
2129#define TXWI_W0_CF_ACK FIELD32(0x00000004)
2130#define TXWI_W0_TS FIELD32(0x00000008)
2131#define TXWI_W0_AMPDU FIELD32(0x00000010)
2132#define TXWI_W0_MPDU_DENSITY FIELD32(0x000000e0)
2133#define TXWI_W0_TX_OP FIELD32(0x00000300)
2134#define TXWI_W0_MCS FIELD32(0x007f0000)
2135#define TXWI_W0_BW FIELD32(0x00800000)
2136#define TXWI_W0_SHORT_GI FIELD32(0x01000000)
2137#define TXWI_W0_STBC FIELD32(0x06000000)
2138#define TXWI_W0_IFS FIELD32(0x08000000)
2139#define TXWI_W0_PHYMODE FIELD32(0xc0000000)
2140
2141/*
2142 * Word1
Helmut Schaa0856d9c2010-08-06 20:48:27 +02002143 * ACK: 0: No Ack needed, 1: Ack needed
2144 * NSEQ: 0: Don't assign hw sequence number, 1: Assign hw sequence number
2145 * BW_WIN_SIZE: BA windows size of the recipient
2146 * WIRELESS_CLI_ID: Client ID for WCID table access
2147 * MPDU_TOTAL_BYTE_COUNT: Length of 802.11 frame
2148 * PACKETID: Will be latched into the TX_STA_FIFO register once the according
Helmut Schaa2035c0c2010-08-30 21:12:47 +02002149 * frame was processed. If multiple frames are aggregated together
2150 * (AMPDU==1) the reported tx status will always contain the packet
2151 * id of the first frame. 0: Don't report tx status for this frame.
Ivo van Doornbc8a9792010-10-02 11:32:43 +02002152 * PACKETID_QUEUE: Part of PACKETID, This is the queue index (0-3)
2153 * PACKETID_ENTRY: Part of PACKETID, THis is the queue entry index (1-3)
2154 * This identification number is calculated by ((idx % 3) + 1).
2155 * The (+1) is required to prevent PACKETID to become 0.
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002156 */
2157#define TXWI_W1_ACK FIELD32(0x00000001)
2158#define TXWI_W1_NSEQ FIELD32(0x00000002)
2159#define TXWI_W1_BW_WIN_SIZE FIELD32(0x000000fc)
2160#define TXWI_W1_WIRELESS_CLI_ID FIELD32(0x0000ff00)
2161#define TXWI_W1_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000)
2162#define TXWI_W1_PACKETID FIELD32(0xf0000000)
Ivo van Doornbc8a9792010-10-02 11:32:43 +02002163#define TXWI_W1_PACKETID_QUEUE FIELD32(0x30000000)
2164#define TXWI_W1_PACKETID_ENTRY FIELD32(0xc0000000)
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002165
2166/*
2167 * Word2
2168 */
2169#define TXWI_W2_IV FIELD32(0xffffffff)
2170
2171/*
2172 * Word3
2173 */
2174#define TXWI_W3_EIV FIELD32(0xffffffff)
2175
2176/*
2177 * RX WI structure
2178 */
2179
2180/*
2181 * Word0
2182 */
2183#define RXWI_W0_WIRELESS_CLI_ID FIELD32(0x000000ff)
2184#define RXWI_W0_KEY_INDEX FIELD32(0x00000300)
2185#define RXWI_W0_BSSID FIELD32(0x00001c00)
2186#define RXWI_W0_UDF FIELD32(0x0000e000)
2187#define RXWI_W0_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000)
2188#define RXWI_W0_TID FIELD32(0xf0000000)
2189
2190/*
2191 * Word1
2192 */
2193#define RXWI_W1_FRAG FIELD32(0x0000000f)
2194#define RXWI_W1_SEQUENCE FIELD32(0x0000fff0)
2195#define RXWI_W1_MCS FIELD32(0x007f0000)
2196#define RXWI_W1_BW FIELD32(0x00800000)
2197#define RXWI_W1_SHORT_GI FIELD32(0x01000000)
2198#define RXWI_W1_STBC FIELD32(0x06000000)
2199#define RXWI_W1_PHYMODE FIELD32(0xc0000000)
2200
2201/*
2202 * Word2
2203 */
2204#define RXWI_W2_RSSI0 FIELD32(0x000000ff)
2205#define RXWI_W2_RSSI1 FIELD32(0x0000ff00)
2206#define RXWI_W2_RSSI2 FIELD32(0x00ff0000)
2207
2208/*
2209 * Word3
2210 */
2211#define RXWI_W3_SNR0 FIELD32(0x000000ff)
2212#define RXWI_W3_SNR1 FIELD32(0x0000ff00)
2213
2214/*
2215 * Macros for converting txpower from EEPROM to mac80211 value
2216 * and from mac80211 value to register value.
2217 */
2218#define MIN_G_TXPOWER 0
2219#define MIN_A_TXPOWER -7
2220#define MAX_G_TXPOWER 31
2221#define MAX_A_TXPOWER 15
2222#define DEFAULT_TXPOWER 5
2223
2224#define TXPOWER_G_FROM_DEV(__txpower) \
2225 ((__txpower) > MAX_G_TXPOWER) ? DEFAULT_TXPOWER : (__txpower)
2226
2227#define TXPOWER_G_TO_DEV(__txpower) \
2228 clamp_t(char, __txpower, MIN_G_TXPOWER, MAX_G_TXPOWER)
2229
2230#define TXPOWER_A_FROM_DEV(__txpower) \
2231 ((__txpower) > MAX_A_TXPOWER) ? DEFAULT_TXPOWER : (__txpower)
2232
2233#define TXPOWER_A_TO_DEV(__txpower) \
2234 clamp_t(char, __txpower, MIN_A_TXPOWER, MAX_A_TXPOWER)
2235
RA-Jay Hunge90c54b2011-02-20 13:55:25 +01002236/*
2237 * Board's maximun TX power limitation
2238 */
2239#define EIRP_MAX_TX_POWER_LIMIT 0x50
2240
Bartlomiej Zolnierkiewiczb54f78a2009-11-04 18:35:54 +01002241#endif /* RT2800_H */