3 * Copyright (c) 2009-2010 Alexander Egorenkov <egorenar@gmail.com>
4 * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #ifndef _RT2860_REG_H_
20 #define _RT2860_REG_H_
22 #define RT2860_REG_EEPROM_CSR 0x0004
24 #define RT2860_REG_SCHDMA_INT_STATUS 0x0200
25 #define RT2860_REG_SCHDMA_INT_MASK 0x0204
26 #define RT2860_REG_SCHDMA_WPDMA_GLO_CFG 0x0208
27 #define RT2860_REG_SCHDMA_WPDMA_RST_IDX 0x020c
28 #define RT2860_REG_SCHDMA_DELAY_INT_CFG 0x0210
29 #define RT2860_REG_SCHDMA_WMM_AIFSN_CFG 0x0214
30 #define RT2860_REG_SCHDMA_WMM_CWMIN_CFG 0x0218
31 #define RT2860_REG_SCHDMA_WMM_CWMAX_CFG 0x021c
32 #define RT2860_REG_SCHDMA_WMM_TXOP0_CFG 0x0220
33 #define RT2860_REG_SCHDMA_WMM_TXOP1_CFG 0x0224
34 #define RT2860_REG_SCHDMA_GPIO_CTRL_CFG 0x0228
35 #define RT2860_REG_SCHDMA_RX_BASE_PTR 0x0290
36 #define RT2860_REG_SCHDMA_RX_MAX_CNT 0x0294
37 #define RT2860_REG_SCHDMA_RX_CALC_IDX 0x0298
38 #define RT2860_REG_SCHDMA_RX_DRX_IDX 0x029c
39 #define RT2860_REG_SCHDMA_TX_BASE_PTR(qid) (0x0230 + (qid) * 16)
40 #define RT2860_REG_SCHDMA_TX_MAX_CNT(qid) (0x0234 + (qid) * 16)
41 #define RT2860_REG_SCHDMA_TX_CTX_IDX(qid) (0x0238 + (qid) * 16)
42 #define RT2860_REG_SCHDMA_TX_DTX_IDX(qid) (0x023c + (qid) * 16)
44 #define RT2860_REG_PBF_SYS_CTRL 0x0400
45 #define RT2860_REG_PBF_CFG 0x0408
46 #define RT2860_REG_PBF_MAX_PCNT 0x040c
47 #define RT2860_REG_PBF_BCN_OFFSET0 0x042c
48 #define RT2860_REG_PBF_BCN_OFFSET1 0x0430
49 #define RT2860_REG_PBF_TXRXQ_PCNT 0x0438
51 #define RT2860_REG_MAC_CSR0 0x1000
52 #define RT2860_REG_SYS_CTRL 0x1004
53 #define RT2860_REG_ADDR_DW0 0x1008
54 #define RT2860_REG_ADDR_DW1 0x100c
55 #define RT2860_REG_BSSID_DW0 0x1010
56 #define RT2860_REG_BSSID_DW1 0x1014
57 #define RT2860_REG_MAX_LEN_CFG 0x1018
58 #define RT2860_REG_BBP_CSR_CFG 0x101c
59 #define RT2860_REG_RF_CSR_CFG0 0x1020
60 #define RT2860_REG_LED_CFG 0x102c
62 #define RT2860_REG_XIFS_TIME_CFG 0x1100
63 #define RT2860_REG_BKOFF_SLOT_CFG 0x1104
64 #define RT2860_REG_BCN_TIME_CFG 0x1114
66 #define RT2860_REG_STATUS_CFG 0x1200
67 #define RT2860_REG_PWR_PIN_CFG 0x1204
68 #define RT2860_REG_AUTO_WAKEUP_CFG 0x1208
70 #define RT2860_REG_TX_EDCA_AC_CFG(aci) (0x1300 + (aci) * 4)
71 #define RT2860_REG_TX_PWR_CFG(ridx) (0x1314 + (ridx) * 4)
72 #define RT2860_REG_TX_PIN_CFG 0x1328
73 #define RT2860_REG_TX_BAND_CFG 0x132c
74 #define RT2860_REG_TX_SW_CFG0 0x1330
75 #define RT2860_REG_TX_SW_CFG1 0x1334
76 #define RT2860_REG_TX_TXOP_CTRL_CFG 0x1340
77 #define RT2860_REG_TX_RTS_CFG 0x1344
78 #define RT2860_REG_TX_TIMEOUT_CFG 0x1348
79 #define RT2860_REG_TX_RTY_CFG 0x134c
80 #define RT2860_REG_TX_LINK_CFG 0x1350
81 #define RT2860_REG_TX_HT_FBK_CFG0 0x1354
82 #define RT2860_REG_TX_HT_FBK_CFG1 0x1358
83 #define RT2860_REG_TX_LG_FBK_CFG0 0x135c
84 #define RT2860_REG_TX_LG_FBK_CFG1 0x1360
85 #define RT2860_REG_TX_CCK_PROT_CFG 0x1364
86 #define RT2860_REG_TX_OFDM_PROT_CFG 0x1368
87 #define RT2860_REG_TX_MM20_PROT_CFG 0x136c
88 #define RT2860_REG_TX_MM40_PROT_CFG 0x1370
89 #define RT2860_REG_TX_GF20_PROT_CFG 0x1374
90 #define RT2860_REG_TX_GF40_PROT_CFG 0x1378
91 #define RT2860_REG_TX_EXP_ACK_TIME 0x1380
93 #define RT2860_REG_RX_FILTER_CFG 0x1400
94 #define RT2860_REG_AUTO_RSP_CFG 0x1404
95 #define RT2860_REG_LEGACY_BASIC_RATE 0x1408
96 #define RT2860_REG_HT_BASIC_RATE 0x140c
98 #define RT2860_REG_HCCAPSMP_TXOP_HLDR_ET 0x1608
100 #define RT2860_REG_RX_STA_CNT0 0x1700
101 #define RT2860_REG_RX_STA_CNT1 0x1704
102 #define RT2860_REG_RX_STA_CNT2 0x1708
103 #define RT2860_REG_TX_STA_CNT0 0x170c
104 #define RT2860_REG_TX_STA_CNT1 0x1710
105 #define RT2860_REG_TX_STA_CNT2 0x1714
106 #define RT2860_REG_TX_STA_FIFO 0x1718
108 #define RT2860_REG_WCID(wcid) (0x1800 + (wcid) * 8)
109 #define RT2860_REG_PKEY(wcid) (0x4000 + (wcid) * 32)
110 #define RT2860_REG_IVEIV(wcid) (0x6000 + (wcid) * 8)
111 #define RT2860_REG_WCID_ATTR(wcid) (0x6800 + (wcid) * 4)
112 #define RT2860_REG_SKEY(vap, kidx) (0x6c00 + ((vap) * 4 + (kidx)) * 32)
113 #define RT2860_REG_SKEY_MODE(vap) (0x7000 + ((vap) / 2) * 4)
115 #define RT2860_REG_MCU_UCODE_BASE 0x2000
117 #define RT2860_REG_H2M_HOST_CMD 0x0404
118 #define RT2860_REG_H2M_MAILBOX 0x7010
119 #define RT2860_REG_H2M_MAILBOX_CID 0x7014
120 #define RT2860_REG_H2M_MAILBOX_STATUS 0x701c
121 #define RT2860_REG_H2M_MAILBOX_BBP_AGENT 0x7028
123 #define RT2860_REG_BEACON_BASE(vap) (0x7800 + (vap) * 512)
125 #define RT2860_REG_RF_R1 0
126 #define RT2860_REG_RF_R2 1
127 #define RT2860_REG_RF_R3 2
128 #define RT2860_REG_RF_R4 3
131 * RT2860_REG_EEPROM_CSR flags
133 #define RT2860_REG_EERL (1 << 7)
134 #define RT2860_REG_EEDO (1 << 3)
135 #define RT2860_REG_EEDI (1 << 2)
136 #define RT2860_REG_EECS (1 << 1)
137 #define RT2860_REG_EESK (1 << 0)
138 #define RT2860_REG_EEOP_READ 0x6
141 * RT2860_REG_SCHDMA_INT_STATUS
142 * RT2860_REG_SCHDMA_INT_MASK flags
144 #define RT2860_REG_INT_TX_COHERENT (1 << 17)
145 #define RT2860_REG_INT_RX_COHERENT (1 << 16)
146 #define RT2860_REG_INT_GP_TIMER (1 << 15)
147 #define RT2860_REG_INT_AUTO_WAKEUP (1 << 14)
148 #define RT2860_REG_INT_FIFO_STA_FULL (1 << 13)
149 #define RT2860_REG_INT_PRE_TBTT (1 << 12)
150 #define RT2860_REG_INT_TBTT (1 << 11)
151 #define RT2860_REG_INT_TXRX_COHERENT (1 << 10)
152 #define RT2860_REG_INT_MCU_CMD (1 << 9)
153 #define RT2860_REG_INT_TX_MGMT_DONE (1 << 8)
154 #define RT2860_REG_INT_TX_HCCA_DONE (1 << 7)
155 #define RT2860_REG_INT_TX_AC3_DONE (1 << 6)
156 #define RT2860_REG_INT_TX_AC2_DONE (1 << 5)
157 #define RT2860_REG_INT_TX_AC1_DONE (1 << 4)
158 #define RT2860_REG_INT_TX_AC0_DONE (1 << 3)
159 #define RT2860_REG_INT_RX_DONE (1 << 2)
160 #define RT2860_REG_INT_TX_DELAY_DONE (1 << 1)
161 #define RT2860_REG_INT_RX_DELAY_DONE (1 << 0)
164 * RT2860_REG_SCHDMA_WPDMA_GLO_CFG flags
166 #define RT2860_REG_TX_WB_DDONE (1 << 6)
167 #define RT2860_REG_RX_DMA_BUSY (1 << 3)
168 #define RT2860_REG_RX_DMA_ENABLE (1 << 2)
169 #define RT2860_REG_TX_DMA_BUSY (1 << 1)
170 #define RT2860_REG_TX_DMA_ENABLE (1 << 0)
171 #define RT2860_REG_WPDMA_BT_SIZE_SHIFT 4
172 #define RT2860_REG_WPDMA_BT_SIZE16 0
173 #define RT2860_REG_WPDMA_BT_SIZE32 1
174 #define RT2860_REG_WPDMA_BT_SIZE64 2
175 #define RT2860_REG_WPDMA_BT_SIZE128 3
178 * RT2860_REG_SCHDMA_WPDMA_RST_IDX flags
180 #define RT2860_REG_RST_IDX_RX (1 << 16)
181 #define RT2860_REG_RST_IDX_TX_MGMT (1 << 5)
182 #define RT2860_REG_RST_IDX_TX_HCCA (1 << 4)
183 #define RT2860_REG_RST_IDX_TX_AC3 (1 << 3)
184 #define RT2860_REG_RST_IDX_TX_AC2 (1 << 2)
185 #define RT2860_REG_RST_IDX_TX_AC1 (1 << 1)
186 #define RT2860_REG_RST_IDX_TX_AC0 (1 << 0)
189 * RT2860_REG_SCHDMA_DELAY_INT_CFG flags
191 #define RT2860_REG_INT_TX_DELAY_ENABLE (1 << 31)
192 #define RT2860_REG_INT_TX_MAX_PINT_SHIFT 24
193 #define RT2860_REG_INT_TX_MAX_PINT_MASK 0x7
194 #define RT2860_REG_INT_TX_MAX_PTIME_SHIFT 16
195 #define RT2860_REG_INT_TX_MAX_PTIME_MASK 0x8
196 #define RT2860_REG_INT_RX_DELAY_ENABLE (1 << 15)
197 #define RT2860_REG_INT_RX_MAX_PINT_SHIFT 8
198 #define RT2860_REG_INT_RX_MAX_PINT_MASK 0x7
199 #define RT2860_REG_INT_RX_MAX_PTIME_SHIFT 0
200 #define RT2860_REG_INT_RX_MAX_PTIME_MASK 0x8
203 * RT2860_REG_PBF_SYS_CTRL flags
205 #define RT2860_REG_HST_PM_SEL (1 << 16)
206 #define RT2860_REG_MCU_READY (1 << 7)
207 #define RT2860_REG_MCU_RESET (1 << 0)
210 * RT2860_REG_PBF_TXRXQ_PCNT flags
212 #define RT2860_REG_RXQ_PCNT_SHIFT 24
213 #define RT2860_REG_RXQ_PCNT_MASK 0xff
214 #define RT2860_REG_TX2Q_PCNT_SHIFT 16
215 #define RT2860_REG_TX2Q_PCNT_MASK 0xff
216 #define RT2860_REG_TX1Q_PCNT_SHIFT 8
217 #define RT2860_REG_TX1Q_PCNT_MASK 0xff
218 #define RT2860_REG_TX0Q_PCNT_SHIFT 0
219 #define RT2860_REG_TX0Q_PCNT_MASK 0xff
222 * RT2860_REG_SYS_CTRL flags
224 #define RT2860_REG_RX_ENABLE (1 << 3)
225 #define RT2860_REG_TX_ENABLE (1 << 2)
226 #define RT2860_REG_BBP_HRST (1 << 1)
227 #define RT2860_REG_MAC_SRST (1 << 0)
230 * RT2860_REG_BBP_CSR_CFG flags
232 #define RT2860_REG_BBP_RW_MODE_PARALLEL (1 << 19)
233 #define RT2860_REG_BBP_CSR_BUSY (1 << 17)
234 #define RT2860_REG_BBP_CSR_READ (1 << 16)
235 #define RT2860_REG_BBP_REG_SHIFT 8
236 #define RT2860_REG_BBP_REG_MASK 0xff
237 #define RT2860_REG_BBP_VAL_SHIFT 0
238 #define RT2860_REG_BBP_VAL_MASK 0xff
241 * RT2860_REG_RF_CSR_CFG0 flags
243 #define RT2860_REG_RF_BUSY (1 << 31)
246 * RT2860_REG_BCN_TIME_CFG flags
248 #define RT2860_REG_BCN_TX_ENABLE (1 << 20)
249 #define RT2860_REG_TBTT_TIMER_ENABLE (1 << 19)
250 #define RT2860_REG_TSF_TIMER_ENABLE (1 << 16)
251 #define RT2860_REG_TSF_SYNC_MODE_SHIFT 17
252 #define RT2860_REG_TSF_SYNC_MODE_MASK 0x3
253 #define RT2860_REG_TSF_SYNC_MODE_DISABLE 0
254 #define RT2860_REG_TSF_SYNC_MODE_STA 1
255 #define RT2860_REG_TSF_SYNC_MODE_IBSS 2
256 #define RT2860_REG_TSF_SYNC_MODE_HOSTAP 3
259 * RT2860_REG_STATUS_CFG flags
261 #define RT2860_REG_STATUS_RX_BUSY (1 << 1)
262 #define RT2860_REG_STATUS_TX_BUSY (1 << 0)
265 * RT2860_REG_TX_PIN_CFG flags
267 #define RT2860_REG_TRSW_ENABLE (1 << 18)
268 #define RT2860_REG_RFTR_ENABLE (1 << 16)
269 #define RT2860_REG_LNA_PE_G1_ENABLE (1 << 11)
270 #define RT2860_REG_LNA_PE_A1_ENABLE (1 << 10)
271 #define RT2860_REG_LNA_PE_G0_ENABLE (1 << 9)
272 #define RT2860_REG_LNA_PE_A0_ENABLE (1 << 8)
273 #define RT2860_REG_PA_PE_G1_ENABLE (1 << 3)
274 #define RT2860_REG_PA_PE_A1_ENABLE (1 << 2)
275 #define RT2860_REG_PA_PE_G0_ENABLE (1 << 1)
276 #define RT2860_REG_PA_PE_A0_ENABLE (1 << 0)
279 * RT2860_REG_TX_BAND_CFG flags
281 #define RT2860_REG_TX_BAND_BG (1 << 2)
282 #define RT2860_REG_TX_BAND_A (1 << 1)
283 #define RT2860_REG_TX_BAND_HT40_ABOVE (1 << 0)
284 #define RT2860_REG_TX_BAND_HT40_BELOW (0 << 0)
287 * RT2860_REG_TX_RTS_CFG flags
289 #define RT2860_REG_TX_RTS_THRESHOLD_SHIFT 8
290 #define RT2860_REG_TX_RTS_THRESHOLD_MASK 0xffff
293 * RT2860_REG_TX_CCK_PROT_CFG
294 * RT2860_REG_TX_OFDM_PROT_CFG
295 * RT2860_REG_TX_MM20_PROT_CFG
296 * RT2860_REG_TX_MM40_PROT_CFG
297 * RT2860_REG_TX_GF20_PROT_CFG
298 * RT2860_REG_TX_GF40_PROT_CFG flags
300 #define RT2860_REG_RTSTH_ENABLE (1 << 26)
301 #define RT2860_REG_TXOP_ALLOW_GF40 (1 << 25)
302 #define RT2860_REG_TXOP_ALLOW_GF20 (1 << 24)
303 #define RT2860_REG_TXOP_ALLOW_MM40 (1 << 23)
304 #define RT2860_REG_TXOP_ALLOW_MM20 (1 << 22)
305 #define RT2860_REG_TXOP_ALLOW_OFDM (1 << 21)
306 #define RT2860_REG_TXOP_ALLOW_CCK (1 << 20)
307 #define RT2860_REG_TXOP_ALLOW_ALL (0x3f << 20)
308 #define RT2860_REG_PROT_NAV_NONE (0 << 18)
309 #define RT2860_REG_PROT_NAV_SHORT (1 << 18)
310 #define RT2860_REG_PROT_NAV_LONG (2 << 18)
311 #define RT2860_REG_PROT_CTRL_NONE (0 << 16)
312 #define RT2860_REG_PROT_CTRL_RTS_CTS (1 << 16)
313 #define RT2860_REG_PROT_CTRL_CTS (2 << 16)
314 #define RT2860_REG_PROT_PHYMODE_SHIFT 14
315 #define RT2860_REG_PROT_PHYMODE_MASK 0x3
316 #define RT2860_REG_PROT_PHYMODE_CCK 0
317 #define RT2860_REG_PROT_PHYMODE_OFDM 1
318 #define RT2860_REG_PROT_MCS_SHIFT 0
319 #define RT2860_REG_PROT_MCS_MASK 0x7f
322 * RT2860_REG_RX_FILTER_CFG flags
324 #define RT2860_REG_RX_FILTER_DROP_CTRL_RSV (1 << 16)
325 #define RT2860_REG_RX_FILTER_DROP_BAR (1 << 15)
326 #define RT2860_REG_RX_FILTER_DROP_BA (1 << 14)
327 #define RT2860_REG_RX_FILTER_DROP_PSPOLL (1 << 13)
328 #define RT2860_REG_RX_FILTER_DROP_RTS (1 << 12)
329 #define RT2860_REG_RX_FILTER_DROP_CTS (1 << 11)
330 #define RT2860_REG_RX_FILTER_DROP_ACK (1 << 10)
331 #define RT2860_REG_RX_FILTER_DROP_CFEND (1 << 9)
332 #define RT2860_REG_RX_FILTER_DROP_CFACK (1 << 8)
333 #define RT2860_REG_RX_FILTER_DROP_DUPL (1 << 7)
334 #define RT2860_REG_RX_FILTER_DROP_BCAST (1 << 6)
335 #define RT2860_REG_RX_FILTER_DROP_MCAST (1 << 5)
336 #define RT2860_REG_RX_FILTER_DROP_VER_ERR (1 << 4)
337 #define RT2860_REG_RX_FILTER_DROP_NOT_MYBSS (1 << 3)
338 #define RT2860_REG_RX_FILTER_DROP_UC_NOME (1 << 2)
339 #define RT2860_REG_RX_FILTER_DROP_PHY_ERR (1 << 1)
340 #define RT2860_REG_RX_FILTER_DROP_CRC_ERR (1 << 0)
343 * RT2860_REG_AUTO_RSP_CFG flags
345 #define RT2860_REG_CCK_SHORT_ENABLE (1 << 4)
348 * RT2860_REG_TX_STA_FIFO flags
350 #define RT2860_REG_TX_STA_FIFO_MCS_SHIFT 16
351 #define RT2860_REG_TX_STA_FIFO_MCS_MASK 0x7f
352 #define RT2860_REG_TX_STA_FIFO_WCID_SHIFT 8
353 #define RT2860_REG_TX_STA_FIFO_WCID_MASK 0xff
354 #define RT2860_REG_TX_STA_FIFO_PID_SHIFT 1
355 #define RT2860_REG_TX_STA_FIFO_PID_MASK 0xf
356 #define RT2860_REG_TX_STA_FIFO_ACK_REQ (1 << 7)
357 #define RT2860_REG_TX_STA_FIFO_AGG (1 << 6)
358 #define RT2860_REG_TX_STA_FIFO_TX_OK (1 << 5)
359 #define RT2860_REG_TX_STA_FIFO_VALID (1 << 0)
362 * RT2860_REG_WCID_ATTR flags
364 #define RT2860_REG_VAP_SHIFT 4
365 #define RT2860_REG_VAP_MASK 0x7
366 #define RT2860_REG_CIPHER_MODE_SHIFT 1
367 #define RT2860_REG_CIPHER_MODE_MASK 0x7
368 #define RT2860_REG_CIPHER_MODE_NONE 0
369 #define RT2860_REG_CIPHER_MODE_WEP40 1
370 #define RT2860_REG_CIPHER_MODE_WEP104 2
371 #define RT2860_REG_CIPHER_MODE_TKIP 3
372 #define RT2860_REG_CIPHER_MODE_AES_CCMP 4
373 #define RT2860_REG_CIPHER_MODE_CKIP40 5
374 #define RT2860_REG_CIPHER_MODE_CKIP104 6
375 #define RT2860_REG_CIPHER_MODE_CKIP128 7
376 #define RT2860_REG_PKEY_ENABLE (1 << 0)
379 * RT2860_REG_H2M_MAILBOX flags
381 #define RT2860_REG_H2M_BUSY (1 << 24)
382 #define RT2860_REG_H2M_TOKEN_POWERSAVE 1
383 #define RT2860_REG_H2M_TOKEN_RADIOOFF 2
384 #define RT2860_REG_H2M_TOKEN_WAKEUP 3
385 #define RT2860_REG_H2M_TOKEN_NO_INTR 0xff
388 * RT2860_REG_H2M_MAILBOX_CID flags
390 #define RT2860_REG_H2M_CID0_SHIFT 0
391 #define RT2860_REG_H2M_CID1_SHIFT 8
392 #define RT2860_REG_H2M_CID2_SHIFT 16
393 #define RT2860_REG_H2M_CID3_SHIFT 24
394 #define RT2860_REG_H2M_CID_MASK 0xff
396 #endif /* #ifndef _RT2860_REG_H_ */