1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 #ifndef _BIT_TWIDDLE
54 #define _BIT_TWIDDLE
55
56 #define BIT(n) (((n) == 32) ? 0 : ((u_int32_t) 1 << (n)))
57
58
59 #define BITS(m, n) ((BIT(MAX((m), (n)) + 1) - 1) ^ (BIT(MIN((m), (n))) - 1))
60
61
62 #define LOWEST_SET_BIT(x) ((((x) - 1) & (x)) ^ (x))
63
64
65 #define GTEQ_POWER(x, p) (((u_long)(x) >> (p)) != 0)
66
67 #define MASK_TO_SHIFT2(m) (GTEQ_POWER(LOWEST_SET_BIT((m)), 1) ? 1 : 0)
68
69 #define MASK_TO_SHIFT4(m) \
70 (GTEQ_POWER(LOWEST_SET_BIT((m)), 2) \
71 ? 2 + MASK_TO_SHIFT2((m) >> 2) \
72 : MASK_TO_SHIFT2((m)))
73
74 #define MASK_TO_SHIFT8(m) \
75 (GTEQ_POWER(LOWEST_SET_BIT((m)), 4) \
76 ? 4 + MASK_TO_SHIFT4((m) >> 4) \
77 : MASK_TO_SHIFT4((m)))
78
79 #define MASK_TO_SHIFT16(m) \
80 (GTEQ_POWER(LOWEST_SET_BIT((m)), 8) \
81 ? 8 + MASK_TO_SHIFT8((m) >> 8) \
82 : MASK_TO_SHIFT8((m)))
83
84 #define MASK_TO_SHIFT(m) \
85 (GTEQ_POWER(LOWEST_SET_BIT((m)), 16) \
86 ? 16 + MASK_TO_SHIFT16((m) >> 16) \
87 : MASK_TO_SHIFT16((m)))
88
89 #define MASK_AND_RSHIFT(x, mask) (((x) & (mask)) >> MASK_TO_SHIFT(mask))
90 #define LSHIFT(x, mask) ((x) << MASK_TO_SHIFT(mask))
91 #define MASK_AND_REPLACE(reg, val, mask) ((reg & ~mask) | LSHIFT(val, mask))
92 #define PRESHIFT(m) MASK_AND_RSHIFT((m), (m))
93
94 #endif
95
96
97
98 #define ATW_PAR 0x00
99 #define ATW_FRCTL 0x04
100 #define ATW_TDR 0x08
101 #define ATW_WTDP 0x0C
102 #define ATW_RDR 0x10
103 #define ATW_WRDP 0x14
104 #define ATW_RDB 0x18
105 #define ATW_CSR3A 0x1C
106 #define ATW_C_TDBH 0x1C
107
108
109 #define ATW_TDBD 0x20
110 #define ATW_TDBP 0x24
111 #define ATW_STSR 0x28
112 #define ATW_CSR5A 0x2C
113 #define ATW_C_TDBB 0x2C
114
115
116 #define ATW_NAR 0x30
117 #define ATW_CSR6A 0x34
118 #define ATW_IER 0x38
119 #define ATW_CSR7A 0x3C
120 #define ATW_LPC 0x40
121 #define ATW_TEST1 0x44
122 #define ATW_SPR 0x48
123 #define ATW_TEST0 0x4C
124 #define ATW_WCSR 0x50
125 #define ATW_WPDR 0x54
126 #define ATW_GPTMR 0x58
127 #define ATW_GPIO 0x5C
128 #define ATW_BBPCTL 0x60
129 #define ATW_SYNCTL 0x64
130 #define ATW_PLCPHD 0x68
131 #define ATW_MMIWADDR 0x6C
132 #define ATW_MMIRADDR1 0x70
133 #define ATW_MMIRADDR2 0x74
134 #define ATW_TXBR 0x78
135 #define ATW_CSR15A 0x7C
136 #define ATW_ALCSTAT 0x80
137 #define ATW_TOFS2 0x84
138 #define ATW_CMDR 0x88
139 #define ATW_PCIC 0x8C
140 #define ATW_PMCSR 0x90
141 #define ATW_PAR0 0x94
142 #define ATW_PAR1 0x98
143 #define ATW_MAR0 0x9C
144 #define ATW_MAR1 0xA0
145 #define ATW_ATIMDA0 0xA4
146
147
148 #define ATW_ABDA1 0xA8
149
150
151 #define ATW_BSSID0 0xAC
152 #define ATW_TXLMT 0xB0
153
154
155 #define ATW_MIBCNT 0xB4
156 #define ATW_BCNT 0xB8
157 #define ATW_TSFTH 0xBC
158 #define ATW_TSC 0xC0
159 #define ATW_SYNRF 0xC4
160 #define ATW_BPLI 0xC8
161
162
163 #define ATW_CAP0 0xCC
164 #define ATW_CAP1 0xD0
165
166
167 #define ATW_RMD 0xD4
168 #define ATW_CFPP 0xD8
169 #define ATW_TOFS0 0xDC
170 #define ATW_TOFS1 0xE0
171 #define ATW_IFST 0xE4
172 #define ATW_RSPT 0xE8
173 #define ATW_TSFTL 0xEC
174 #define ATW_WEPCTL 0xF0
175 #define ATW_WESK 0xF4
176 #define ATW_WEPCNT 0xF8
177 #define ATW_MACTEST 0xFC
178
179 #define ATW_FER 0x100
180 #define ATW_FEMR 0x104
181 #define ATW_FPSR 0x108
182 #define ATW_FFER 0x10C
183
184
185 #define ATW_PAR_MWIE BIT(24)
186
187
188 #define ATW_PAR_MRLE BIT(23)
189 #define ATW_PAR_MRME BIT(21)
190
191
192 #define ATW_PAR_RAP_MASK BITS(17, 18)
193
194
195 #define ATW_PAR_CAL_MASK BITS(14, 15)
196 #define ATW_PAR_CAL_PBL 0x0
197
198 #define ATW_PAR_CAL_8DW LSHIFT(0x1, ATW_PAR_CAL_MASK)
199
200 #define ATW_PAR_CAL_16DW LSHIFT(0x2, ATW_PAR_CAL_MASK)
201
202 #define ATW_PAR_CAL_32DW LSHIFT(0x3, ATW_PAR_CAL_MASK)
203 #define ATW_PAR_PBL_MASK BITS(8, 13)
204 #define ATW_PAR_PBL_UNLIMITED 0x0
205 #define ATW_PAR_PBL_1DW LSHIFT(0x1, ATW_PAR_PBL_MASK)
206 #define ATW_PAR_PBL_2DW LSHIFT(0x2, ATW_PAR_PBL_MASK)
207 #define ATW_PAR_PBL_4DW LSHIFT(0x4, ATW_PAR_PBL_MASK)
208 #define ATW_PAR_PBL_8DW LSHIFT(0x8, ATW_PAR_PBL_MASK)
209 #define ATW_PAR_PBL_16DW LSHIFT(0x16, ATW_PAR_PBL_MASK)
210 #define ATW_PAR_PBL_32DW LSHIFT(0x32, ATW_PAR_PBL_MASK)
211 #define ATW_PAR_BLE BIT(7)
212 #define ATW_PAR_DSL_MASK BITS(2, 6)
213 #define ATW_PAR_BAR BIT(1)
214 #define ATW_PAR_SWR BIT(0)
215
216 #define ATW_FRCTL_PWRMGMT BIT(31)
217 #define ATW_FRCTL_VER_MASK BITS(29, 30)
218 #define ATW_FRCTL_ORDER BIT(28)
219 #define ATW_FRCTL_MAXPSP BIT(27)
220 #define ATW_C_FRCTL_PRSP BIT(26)
221
222
223
224 #define ATW_C_FRCTL_DRVBCON BIT(25)
225
226
227 #define ATW_C_FRCTL_DRVLINKCTRL BIT(24)
228
229
230 #define ATW_C_FRCTL_DRVLINKON BIT(23)
231
232
233 #define ATW_C_FRCTL_CTX_DATA BIT(22)
234
235
236 #define ATW_C_FRCTL_RSVFRM BIT(21)
237
238
239
240 #define ATW_C_FRCTL_CFEND BIT(19)
241
242
243 #define ATW_FRCTL_DOZEFRM BIT(18)
244 #define ATW_FRCTL_PSAWAKE BIT(17)
245 #define ATW_FRCTL_PSMODE BIT(16)
246 #define ATW_FRCTL_AID_MASK BITS(0, 15)
247
248 #define ATW_INTR_PCF BIT(31)
249 #define ATW_INTR_BCNTC BIT(30)
250 #define ATW_INTR_GPINT BIT(29)
251 #define ATW_INTR_LINKOFF BIT(28)
252 #define ATW_INTR_ATIMTC BIT(27)
253 #define ATW_INTR_TSFTF BIT(26)
254 #define ATW_INTR_TSCZ BIT(25)
255 #define ATW_INTR_LINKON BIT(24)
256 #define ATW_INTR_SQL BIT(23)
257 #define ATW_INTR_WEPTD BIT(22)
258 #define ATW_INTR_ATIME BIT(21)
259 #define ATW_INTR_TBTT BIT(20)
260
261
262 #define ATW_INTR_NISS BIT(16)
263
264
265
266 #define ATW_INTR_AISS BIT(15)
267
268
269
270
271 #define ATW_INTR_TEIS BIT(14)
272
273
274
275 #define ATW_INTR_FBE BIT(13)
276 #define ATW_INTR_REIS BIT(12)
277
278
279
280 #define ATW_INTR_GPTT BIT(11)
281 #define ATW_INTR_RPS BIT(8)
282 #define ATW_INTR_RDU BIT(7)
283
284
285 #define ATW_INTR_RCI BIT(6)
286 #define ATW_INTR_TUF BIT(5)
287 #define ATW_INTR_TRT BIT(4)
288
289
290 #define ATW_INTR_TLT BIT(3)
291 #define ATW_INTR_TDU BIT(2)
292
293
294 #define ATW_INTR_TPS BIT(1)
295 #define ATW_INTR_TCI BIT(0)
296 #define ATW_NAR_TXCF BIT(31)
297 #define ATW_NAR_HF BIT(30)
298 #define ATW_NAR_UTR BIT(29)
299 #define ATW_NAR_PCF BIT(28)
300
301
302 #define ATW_NAR_CFP BIT(27)
303
304
305 #define ATW_C_NAR_APSTA BIT(26)
306
307
308 #define ATW_C_NAR_TDBBE BIT(25)
309
310
311 #define ATW_C_NAR_TDBHE BIT(24)
312
313
314 #define ATW_C_NAR_TDBHT BIT(23)
315
316
317 #define ATW_NAR_SF BIT(21)
318
319
320 #define ATW_NAR_TR_MASK BITS(14, 15)
321 #define ATW_NAR_TR_L64 LSHIFT(0x0, ATW_NAR_TR_MASK)
322 #define ATW_NAR_TR_L160 LSHIFT(0x2, ATW_NAR_TR_MASK)
323 #define ATW_NAR_TR_L192 LSHIFT(0x3, ATW_NAR_TR_MASK)
324 #define ATW_NAR_TR_H96 LSHIFT(0x0, ATW_NAR_TR_MASK)
325 #define ATW_NAR_TR_H288 LSHIFT(0x2, ATW_NAR_TR_MASK)
326 #define ATW_NAR_TR_H544 LSHIFT(0x3, ATW_NAR_TR_MASK)
327 #define ATW_NAR_ST BIT(13)
328 #define ATW_NAR_OM_MASK BITS(10, 11)
329 #define ATW_NAR_OM_NORMAL 0x0
330 #define ATW_NAR_OM_LOOPBACK LSHIFT(0x1, ATW_NAR_OM_MASK)
331 #define ATW_NAR_MM BIT(7)
332 #define ATW_NAR_PR BIT(6)
333 #define ATW_NAR_EA BIT(5)
334 #define ATW_NAR_DISPCF BIT(4)
335
336
337 #define ATW_NAR_PB BIT(3)
338 #define ATW_NAR_STPDMA BIT(2)
339 #define ATW_NAR_SR BIT(1)
340 #define ATW_NAR_CTX BIT(0)
341
342
343 #if 0
344 #define ATW_IER_NIE BIT(16)
345 #define ATW_IER_AIE BIT(15)
346
347 #define ATW_IER_PCFIE BIT(31)
348 #define ATW_IER_BCNTCIE BIT(30)
349 #define ATW_IER_ATIMTCIE BIT(27)
350 #define ATW_IER_LINKONIE BIT(24)
351 #define ATW_IER_ATIMIE BIT(21)
352 #define ATW_IER_TBTTIE BIT(20)
353 #define ATW_IER_TEIE BIT(14)
354 #define ATW_IER_REIE BIT(12)
355
356
357 #define ATW_IER_RCIE BIT(6)
358 #define ATW_IER_TDUIE BIT(2)
359
360
361 #define ATW_IER_TCIE BIT(0)
362
363 #define ATW_IER_GPIE BIT(29)
364 #define ATW_IER_LINKOFFIE BIT(28)
365 #define ATW_IER_TSFTFIE BIT(26)
366 #define ATW_IER_TSCIE BIT(25)
367 #define ATW_IER_SQLIE BIT(23)
368 #define ATW_IER_WEPIE BIT(22)
369 #define ATW_IER_FBEIE BIT(13)
370 #define ATW_IER_GPTIE BIT(11)
371 #define ATW_IER_RPSIE BIT(8)
372 #define ATW_IER_RUIE BIT(7)
373 #define ATW_IER_TUIE BIT(5)
374 #define ATW_IER_TRTIE BIT(4)
375 #define ATW_IER_TLTTIE BIT(3)
376 #define ATW_IER_TPSIE BIT(1)
377 #endif
378
379 #define ATW_LPC_LPCO BIT(16)
380 #define ATW_LPC_LPC_MASK BITS(0, 15)
381
382 #define ATW_TEST1_CONTROL BIT(31)
383
384
385 #define ATW_TEST1_DBGREAD_MASK BITS(30,28)
386
387
388 #define ATW_TEST1_TXWP_MASK BITS(27,25)
389 #define ATW_TEST1_TXWP_TDBD LSHIFT(0x0, ATW_TEST1_TXWP_MASK)
390 #define ATW_TEST1_TXWP_TDBH LSHIFT(0x1, ATW_TEST1_TXWP_MASK)
391 #define ATW_TEST1_TXWP_TDBB LSHIFT(0x2, ATW_TEST1_TXWP_MASK)
392 #define ATW_TEST1_TXWP_TDBP LSHIFT(0x3, ATW_TEST1_TXWP_MASK)
393 #define ATW_TEST1_RSVD0_MASK BITS(24,6)
394 #define ATW_TEST1_TESTMODE_MASK BITS(5,4)
395
396 #define ATW_TEST1_TESTMODE_NORMAL LSHIFT(0x0, ATW_TEST1_TESTMODE_MASK)
397
398 #define ATW_TEST1_TESTMODE_MACONLY LSHIFT(0x1, ATW_TEST1_TESTMODE_MASK)
399
400 #define ATW_TEST1_TESTMODE_NORMAL2 LSHIFT(0x2, ATW_TEST1_TESTMODE_MASK)
401
402 #define ATW_TEST1_TESTMODE_MONITOR LSHIFT(0x3, ATW_TEST1_TESTMODE_MASK)
403
404 #define ATW_TEST1_DUMP_MASK BITS(3,0)
405
406
407
408 #define ATW_SPR_SRS BIT(11)
409 #define ATW_SPR_SDO BIT(3)
410 #define ATW_SPR_SDI BIT(2)
411 #define ATW_SPR_SCLK BIT(1)
412 #define ATW_SPR_SCS BIT(0)
413
414 #define ATW_TEST0_BE_MASK BITS(31, 29)
415 #define ATW_TEST0_TS_MASK BITS(28, 26)
416
417
418 #define ATW_TEST0_TS_STOPPED LSHIFT(0, ATW_TEST0_TS_MASK)
419
420 #define ATW_TEST0_TS_FETCH LSHIFT(1, ATW_TEST0_TS_MASK)
421
422 #define ATW_TEST0_TS_WAIT LSHIFT(2, ATW_TEST0_TS_MASK)
423
424 #define ATW_TEST0_TS_READING LSHIFT(3, ATW_TEST0_TS_MASK)
425 #define ATW_TEST0_TS_RESERVED1 LSHIFT(4, ATW_TEST0_TS_MASK)
426 #define ATW_TEST0_TS_RESERVED2 LSHIFT(5, ATW_TEST0_TS_MASK)
427
428 #define ATW_TEST0_TS_SUSPENDED LSHIFT(6, ATW_TEST0_TS_MASK)
429
430 #define ATW_TEST0_TS_CLOSE LSHIFT(7, ATW_TEST0_TS_MASK)
431
432
433
434 #define ATW_C_TEST0_TS_SUSPENDED LSHIFT(4, ATW_TEST0_TS_MASK)
435
436 #define ATW_C_TEST0_TS_CLOSE LSHIFT(5, ATW_TEST0_TS_MASK)
437
438 #define ATW_C_TEST0_TS_CLOSELAST LSHIFT(6, ATW_TEST0_TS_MASK)
439
440 #define ATW_C_TEST0_TS_FIFOFULL LSHIFT(7, ATW_TEST0_TS_MASK)
441
442 #define ATW_TEST0_RS_MASK BITS(25, 23)
443
444
445 #define ATW_TEST0_RS_STOPPED LSHIFT(0, ATW_TEST0_RS_MASK)
446
447 #define ATW_TEST0_RS_FETCH LSHIFT(1, ATW_TEST0_RS_MASK)
448
449 #define ATW_TEST0_RS_CHECK LSHIFT(2, ATW_TEST0_RS_MASK)
450
451 #define ATW_TEST0_RS_WAIT LSHIFT(3, ATW_TEST0_RS_MASK)
452
453 #define ATW_TEST0_RS_SUSPENDED LSHIFT(4, ATW_TEST0_RS_MASK)
454
455 #define ATW_TEST0_RS_CLOSE LSHIFT(5, ATW_TEST0_RS_MASK)
456
457 #define ATW_TEST0_RS_FLUSH LSHIFT(6, ATW_TEST0_RS_MASK)
458
459 #define ATW_TEST0_RS_QUEUE LSHIFT(7, ATW_TEST0_RS_MASK)
460
461 #define ATW_TEST0_EPNE BIT(18)
462 #define ATW_TEST0_EPSNM BIT(17)
463 #define ATW_TEST0_EPTYP_MASK BIT(16)
464
465
466
467 #define ATW_TEST0_EPTYP_93c66 ATW_TEST0_EPTYP_MASK
468 #define ATW_TEST0_EPTYP_93c46 0
469 #define ATW_TEST0_EPRLD BIT(15)
470
471 #define ATW_WCSR_CRCT BIT(30)
472 #define ATW_WCSR_WP1E BIT(29)
473 #define ATW_WCSR_WP2E BIT(28)
474 #define ATW_WCSR_WP3E BIT(27)
475 #define ATW_WCSR_WP4E BIT(26)
476 #define ATW_WCSR_WP5E BIT(25)
477 #define ATW_WCSR_BLN_MASK BITS(21, 23)
478
479
480 #define ATW_WCSR_TSFTWE BIT(20)
481
482
483 #define ATW_WCSR_TIMWE BIT(19)
484 #define ATW_WCSR_ATIMWE BIT(18)
485 #define ATW_WCSR_KEYWE BIT(17)
486 #define ATW_WCSR_WFRE BIT(10)
487 #define ATW_WCSR_MPRE BIT(9)
488 #define ATW_WCSR_LSOE BIT(8)
489
490 #define ATW_WCSR_KEYUP BIT(6)
491 #define ATW_WCSR_TSFTW BIT(5)
492 #define ATW_WCSR_TIMW BIT(4)
493 #define ATW_WCSR_ATIMW BIT(3)
494 #define ATW_WCSR_WFR BIT(2)
495 #define ATW_WCSR_MPR BIT(1)
496 #define ATW_WCSR_LSO BIT(0)
497
498 #define ATW_GPTMR_COM_MASK BIT(16)
499 #define ATW_GPTMR_GTV_MASK BITS(0, 15)
500
501 #define ATW_GPIO_EC1_MASK BITS(25, 24)
502 #define ATW_GPIO_LAT_MASK BITS(21, 20)
503 #define ATW_GPIO_INTEN_MASK BITS(19, 18)
504 #define ATW_GPIO_EN_MASK BITS(17, 12)
505 #define ATW_GPIO_O_MASK BITS(11, 6)
506 #define ATW_GPIO_I_MASK BITS(5, 0)
507
508 #define ATW_BBPCTL_TWI BIT(31)
509 #define ATW_BBPCTL_RF3KADDR_MASK BITS(30, 24)
510 #define ATW_BBPCTL_RF3KADDR_ADDR LSHIFT(0x20, ATW_BBPCTL_RF3KADDR_MASK)
511 #define ATW_BBPCTL_NEGEDGE_DO BIT(23)
512 #define ATW_BBPCTL_NEGEDGE_DI BIT(22)
513 #define ATW_BBPCTL_CCA_ACTLO BIT(21)
514 #define ATW_BBPCTL_TYPE_MASK BITS(20, 18)
515 #define ATW_BBPCTL_WR BIT(17)
516
517
518 #define ATW_BBPCTL_RD BIT(16)
519
520
521 #define ATW_BBPCTL_ADDR_MASK BITS(15, 8)
522 #define ATW_BBPCTL_DATA_MASK BITS(7, 0)
523
524 #define ATW_SYNCTL_WR BIT(31)
525
526
527 #define ATW_SYNCTL_RD BIT(30)
528
529
530 #define ATW_SYNCTL_CS0 BIT(29)
531 #define ATW_SYNCTL_CS1 BIT(28)
532 #define ATW_SYNCTL_CAL BIT(27)
533
534
535 #define ATW_SYNCTL_SELCAL BIT(26)
536
537
538
539 #define ATW_C_SYNCTL_MMICE BIT(25)
540
541
542
543
544 #define ATW_SYNCTL_RFTYPE_MASK BITS(24, 22)
545 #define ATW_SYNCTL_DATA_MASK BITS(21, 0)
546
547 #define ATW_PLCPHD_SIGNAL_MASK BITS(31, 24)
548
549
550
551 #define ATW_PLCPHD_SERVICE_MASK BITS(23, 16)
552
553
554
555
556 #define ATW_PLCPHD_PMBL BIT(15)
557
558 #define ATW_MMIWADDR_LENLO_MASK BITS(31,24)
559 #define ATW_MMIWADDR_LENHI_MASK BITS(23,16)
560 #define ATW_MMIWADDR_GAIN_MASK BITS(15,8)
561 #define ATW_MMIWADDR_RATE_MASK BITS(7,0)
562
563
564 #define ATW_MMIWADDR_INTERSIL \
565 (LSHIFT(0x0c, ATW_MMIWADDR_GAIN_MASK) | \
566 LSHIFT(0x0a, ATW_MMIWADDR_RATE_MASK) | \
567 LSHIFT(0x0e, ATW_MMIWADDR_LENHI_MASK) | \
568 LSHIFT(0x10, ATW_MMIWADDR_LENLO_MASK))
569
570
571
572
573
574
575
576 #define ATW_MMIWADDR_RFMD \
577 (LSHIFT(RF3000_TWI_AI|RF3000_GAINCTL, ATW_MMIWADDR_GAIN_MASK) | \
578 LSHIFT(RF3000_CTL, ATW_MMIWADDR_RATE_MASK))
579
580 #define ATW_MMIRADDR1_RSVD_MASK BITS(31, 24)
581 #define ATW_MMIRADDR1_PWRLVL_MASK BITS(23, 16)
582 #define ATW_MMIRADDR1_RSSI_MASK BITS(15, 8)
583 #define ATW_MMIRADDR1_RXSTAT_MASK BITS(7, 0)
584
585
586
587
588
589 #define ATW_MMIRADDR1_INTERSIL \
590 (LSHIFT(0x7c, ATW_MMIRADDR1_RSSI_MASK) | \
591 LSHIFT(0x7e, ATW_MMIRADDR1_RXSTAT_MASK))
592
593
594 #define ATW_MMIRADDR1_RFMD \
595 (LSHIFT(RF3000_RSSI, ATW_MMIRADDR1_RSSI_MASK) | \
596 LSHIFT(RF3000_RXSTAT, ATW_MMIRADDR1_RXSTAT_MASK))
597
598
599 #define ATW_MMIRADDR2_INTERSIL \
600 (LSHIFT(0x0, ATW_MMIRADDR2_ID_MASK) | \
601 LSHIFT(0x10, ATW_MMIRADDR2_RXPECNT_MASK))
602
603
604 #define ATW_MMIRADDR2_RFMD \
605 (LSHIFT(0x7e, ATW_MMIRADDR2_ID_MASK) | \
606 LSHIFT(0x10, ATW_MMIRADDR2_RXPECNT_MASK))
607
608 #define ATW_MMIRADDR2_ID_MASK BITS(31, 24)
609
610
611
612 #define ATW_MMIRADDR2_RXPECNT_MASK BITS(23, 16)
613 #define ATW_MMIRADDR2_PROREXT BIT(15)
614
615
616
617 #define ATW_MMIRADDR2_PRORLEN_MASK BITS(14, 0)
618
619
620
621 #define ATW_TXBR_ALCUPDATE_MASK BIT(31)
622 #define ATW_TXBR_TBCNT_MASK BITS(16, 20)
623 #define ATW_TXBR_ALCSET_MASK BITS(8, 15)
624 #define ATW_TXBR_ALCREF_MASK BITS(0, 7)
625
626 #define ATW_ALCSTAT_MCOV_MASK BIT(27)
627 #define ATW_ALCSTAT_ESOV_MASK BIT(26)
628 #define ATW_ALCSTAT_MCNT_MASK BITS(16, 25)
629 #define ATW_ALCSTAT_ERSUM_MASK BITS(0, 15)
630
631
632
633 #define ATW_TOFS2_PWR1UP_MASK BITS(31, 28)
634
635
636
637 #define ATW_TOFS2_PWR0PAPE_MASK BITS(27, 24)
638
639
640
641 #define ATW_TOFS2_PWR1PAPE_MASK BITS(23, 20)
642
643
644 #define ATW_TOFS2_PWR0TRSW_MASK BITS(19, 16)
645
646
647
648 #define ATW_TOFS2_PWR1TRSW_MASK BITS(15, 12)
649
650
651 #define ATW_TOFS2_PWR0PE2_MASK BITS(11, 8)
652
653
654
655 #define ATW_TOFS2_PWR1PE2_MASK BITS(7, 4)
656
657
658 #define ATW_TOFS2_PWR0TXPE_MASK BITS(3, 0)
659
660
661
662
663 #define ATW_CMDR_PM BIT(19)
664
665
666 #define ATW_CMDR_APM BIT(18)
667
668
669 #define ATW_CMDR_RTE BIT(4)
670 #define ATW_CMDR_DRT_MASK BITS(3, 2)
671
672 #define ATW_CMDR_DRT_8DW LSHIFT(0x0, ATW_CMDR_DRT_MASK)
673
674 #define ATW_CMDR_DRT_16DW LSHIFT(0x1, ATW_CMDR_DRT_MASK)
675
676 #define ATW_CMDR_DRT_SF LSHIFT(0x2, ATW_CMDR_DRT_MASK)
677
678 #define ATW_CMDR_DRT_RSVD LSHIFT(0x3, ATW_CMDR_DRT_MASK)
679 #define ATW_CMDR_SINT_MASK BIT(1)
680
681
682
683
684
685
686 #define ATW_PAR0_PAB0_MASK BITS(0, 7)
687 #define ATW_PAR0_PAB1_MASK BITS(8, 15)
688 #define ATW_PAR0_PAB2_MASK BITS(16, 23)
689 #define ATW_PAR0_PAB3_MASK BITS(24, 31)
690
691 #define ATW_C_PAR1_CTD BITS(16,31)
692 #define ATW_PAR1_PAB5_MASK BITS(8, 15)
693 #define ATW_PAR1_PAB4_MASK BITS(0, 7)
694
695 #define ATW_MAR0_MAB3_MASK BITS(31, 24)
696 #define ATW_MAR0_MAB2_MASK BITS(23, 16)
697 #define ATW_MAR0_MAB1_MASK BITS(15, 8)
698 #define ATW_MAR0_MAB0_MASK BITS(7, 0)
699
700 #define ATW_MAR1_MAB7_MASK BITS(31, 24)
701 #define ATW_MAR1_MAB6_MASK BITS(23, 16)
702 #define ATW_MAR1_MAB5_MASK BITS(15, 8)
703 #define ATW_MAR1_MAB4_MASK BITS(7, 0)
704
705
706 #define ATW_ATIMDA0_ATIMB3_MASK BITS(31,24)
707 #define ATW_ATIMDA0_ATIMB2_MASK BITS(23,16)
708 #define ATW_ATIMDA0_ATIMB1_MASK BITS(15,8)
709 #define ATW_ATIMDA0_ATIMB0_MASK BITS(7,0)
710
711
712 #define ATW_ABDA1_BSSIDB5_MASK BITS(31,24)
713 #define ATW_ABDA1_BSSIDB4_MASK BITS(23,16)
714 #define ATW_ABDA1_ATIMB5_MASK BITS(15,8)
715 #define ATW_ABDA1_ATIMB4_MASK BITS(7,0)
716
717
718 #define ATW_BSSID0_BSSIDB3_MASK BITS(31,24)
719 #define ATW_BSSID0_BSSIDB2_MASK BITS(23,16)
720 #define ATW_BSSID0_BSSIDB1_MASK BITS(15,8)
721 #define ATW_BSSID0_BSSIDB0_MASK BITS(7,0)
722
723 #define ATW_TXLMT_MTMLT_MASK BITS(31,16)
724 #define ATW_TXLMT_SRTYLIM_MASK BITS(7,0)
725
726 #define ATW_MIBCNT_FFCNT_MASK BITS(31,24)
727 #define ATW_MIBCNT_AFCNT_MASK BITS(23,16)
728 #define ATW_MIBCNT_RSCNT_MASK BITS(15,8)
729 #define ATW_MIBCNT_RFCNT_MASK BITS(7,0)
730
731 #define ATW_BCNT_PLCPH_MASK BITS(23,16)
732 #define ATW_BCNT_PLCPL_MASK BITS(15,8)
733 #define ATW_BCNT_BCNT_MASK BITS(7,0)
734
735
736
737 #define ATW_C_BCNT_EXTEN1 BIT(31)
738 #define ATW_C_BCNT_BEANLEN1 BITS(30,16)
739
740 #define ATW_C_BCNT_EXTEN0 BIT(15)
741 #define ATW_C_BCNT_BEANLEN0 BIT(14,0)
742
743 #define ATW_C_TSC_TIMOFS BITS(31,24)
744
745
746 #define ATW_C_TSC_TIMLEN BITS(21,12)
747 #define ATW_C_TSC_TIMTABSEL BIT(4)
748 #define ATW_TSC_TSC_MASK BITS(3,0)
749
750
751
752 #define ATW_SYNRF_SELSYN BIT(31)
753
754
755 #define ATW_SYNRF_SELRF BIT(30)
756
757
758 #define ATW_SYNRF_LERF BIT(29)
759
760
761 #define ATW_SYNRF_LEIF BIT(28)
762
763
764 #define ATW_SYNRF_SYNCLK BIT(27)
765
766
767 #define ATW_SYNRF_SYNDATA BIT(26)
768
769
770 #define ATW_SYNRF_PE1 BIT(25)
771
772
773 #define ATW_SYNRF_PE2 BIT(24)
774
775
776 #define ATW_SYNRF_PAPE BIT(23)
777
778
779 #define ATW_C_SYNRF_TRSW BIT(22)
780
781
782 #define ATW_C_SYNRF_TRSWN BIT(21)
783
784
785 #define ATW_SYNRF_INTERSIL_EN BIT(20)
786
787
788
789
790 #define ATW_SYNRF_PHYRST BIT(18)
791
792
793
794 #define ATW_C_SYNRF_RF2958PD ATW_SYNRF_PHYRST
795
796 #define ATW_BPLI_BP_MASK BITS(31,16)
797 #define ATW_BPLI_LI_MASK BITS(15,0)
798
799
800
801 #define ATW_C_CAP0_TIMLEN1 BITS(31,24)
802
803
804 #define ATW_C_CAP0_TIMLEN0 BITS(23,16)
805
806
807 #define ATW_C_CAP0_CWMAX BITS(11,8)
808
809
810
811
812 #define ATW_CAP0_RCVDTIM BIT(4)
813 #define ATW_CAP0_CHN_MASK BITS(3,0)
814
815 #define ATW_CAP1_CAPI_MASK BITS(31,16)
816 #define ATW_CAP1_ATIMW_MASK BITS(15,0)
817
818 #define ATW_RMD_ATIMST BIT(31)
819 #define ATW_RMD_CFP BIT(30)
820 #define ATW_RMD_PCNT BITS(27,16)
821
822
823 #define ATW_RMD_RMRD_MASK BITS(15,0)
824
825
826
827 #define ATW_CFPP_CFPP BITS(31,24)
828 #define ATW_CFPP_CFPMD BITS(23,8)
829 #define ATW_CFPP_DTIMP BITS(7,0)
830
831
832 #define ATW_TOFS0_USCNT_MASK BITS(29,24)
833
834
835
836 #define ATW_C_TOFS0_TUCNT_MASK BITS(14,10)
837 #define ATW_TOFS0_TUCNT_MASK BITS(9,0)
838
839
840 #define ATW_TOFS1_TSFTOFSR_MASK BITS(31,24)
841
842
843
844 #define ATW_TOFS1_TBTTPRE_MASK BITS(23,8)
845
846
847
848
849 #define ATW_TBTTPRE_MASK BITS(25, 10)
850 #define ATW_TOFS1_TBTTOFS_MASK BITS(7,0)
851
852
853 #define ATW_IFST_SLOT_MASK BITS(27,23)
854 #define ATW_IFST_SIFS_MASK BITS(22,15)
855 #define ATW_IFST_DIFS_MASK BITS(14,9)
856 #define ATW_IFST_EIFS_MASK BITS(8,0)
857
858 #define ATW_RSPT_MART_MASK BITS(31,16)
859 #define ATW_RSPT_MIRT_MASK BITS(15,8)
860 #define ATW_RSPT_TSFTOFST_MASK BITS(7,0)
861
862 #define ATW_WEPCTL_WEPENABLE BIT(31)
863 #define ATW_WEPCTL_AUTOSWITCH BIT(30)
864 #define ATW_WEPCTL_CURTBL BIT(29)
865 #define ATW_WEPCTL_WR BIT(28)
866 #define ATW_WEPCTL_RD BIT(27)
867 #define ATW_WEPCTL_WEPRXBYP BIT(25)
868 #define ATW_WEPCTL_SHKEY BIT(24)
869
870
871
872 #define ATW_WEPCTL_UNKNOWN0 BIT(23)
873
874
875
876
877 #define ATW_WEPCTL_TBLADD_MASK BITS(8,0)
878
879
880
881
882 #define ATW_WEP_ENABLED BIT(7)
883 #define ATW_WEP_104BIT BIT(6)
884
885 #define ATW_WESK_DATA_MASK BITS(15,0)
886 #define ATW_WEPCNT_WIEC_MASK BITS(15,0)
887
888 #define ATW_MACTEST_FORCE_IV BIT(23)
889 #define ATW_MACTEST_FORCE_KEYID BIT(22)
890 #define ATW_MACTEST_KEYID_MASK BITS(21,20)
891 #define ATW_MACTEST_MMI_USETXCLK BIT(11)
892
893
894
895 #define ATW_FER_INTR BIT(15)
896 #define ATW_FER_GWAKE BIT(4)
897
898 #define ATW_FEMR_INTR_EN BIT(15)
899 #define ATW_FEMR_WAKEUP_EN BIT(14)
900 #define ATW_FEMR_GWAKE_EN BIT(4)
901
902 #define ATW_FPSR_INTR_STATUS BIT(15)
903 #define ATW_FPSR_WAKEUP_STATUS BIT(4)
904 #define ATW_FFER_INTA_FORCE BIT(15)
905 #define ATW_FFER_GWAKE_FORCE BIT(4)
906
907
908 #define ATW_SR_CLASS_CODE (0x00/2)
909 #define ATW_SR_FORMAT_VERSION (0x02/2)
910 #define ATW_SR_MAJOR_MASK BITS(7, 0)
911 #define ATW_SR_MINOR_MASK BITS(15,8)
912 #define ATW_SR_MAC00 (0x08/2)
913 #define ATW_SR_MAC01 (0x0A/2)
914 #define ATW_SR_MAC10 (0x0C/2)
915 #define ATW_SR_CSR20 (0x16/2)
916 #define ATW_SR_ANT_MASK BITS(12, 10)
917 #define ATW_SR_PWRSCALE_MASK BITS(9, 8)
918 #define ATW_SR_CLKSAVE_MASK BITS(7, 6)
919 #define ATW_SR_RFTYPE_MASK BITS(5, 3)
920 #define ATW_SR_BBPTYPE_MASK BITS(2, 0)
921 #define ATW_SR_CR28_CR03 (0x18/2)
922 #define ATW_SR_CR28_MASK BITS(15,8)
923 #define ATW_SR_CR03_MASK BITS(7, 0)
924 #define ATW_SR_CTRY_CR29 (0x1A/2)
925 #define ATW_SR_CTRY_MASK BITS(15,8)
926 #define COUNTRY_FCC 0
927 #define COUNTRY_IC 1
928 #define COUNTRY_ETSI 2
929 #define COUNTRY_SPAIN 3
930 #define COUNTRY_FRANCE 4
931 #define COUNTRY_MMK 5
932 #define COUNTRY_MMK2 6
933 #define ATW_SR_CR29_MASK BITS(7, 0)
934 #define ATW_SR_PCI_DEVICE (0x20/2)
935 #define ATW_SR_PCI_VENDOR (0x22/2)
936 #define ATW_SR_SUB_DEVICE (0x24/2)
937 #define ATW_SR_SUB_VENDOR (0x26/2)
938 #define ATW_SR_CR15 (0x28/2)
939 #define ATW_SR_LOCISPTR (0x2A/2)
940 #define ATW_SR_HICISPTR (0x2C/2)
941 #define ATW_SR_CSR18 (0x2E/2)
942 #define ATW_SR_D0_D1_PWR (0x40/2)
943 #define ATW_SR_D2_D3_PWR (0x42/2)
944 #define ATW_SR_CIS_WORDS (0x52/2)
945
946 #define ATW_SR_TXPOWER(chnl) (0x54/2 + ((chnl) - 1)/2)
947
948 #define ATW_SR_LPF_CUTOFF(chnl) (0x62/2 + ((chnl) - 1)/2)
949
950 #define ATW_SR_LNA_GS_THRESH(chnl) (0x70/2 + ((chnl) - 1)/2)
951 #define ATW_SR_CHECKSUM (0x7e/2)
952 #define ATW_SR_CIS (0x80/2)
953
954
955 struct atw_txdesc {
956 u_int32_t at_ctl;
957 #define at_stat at_ctl
958 u_int32_t at_flags;
959 u_int32_t at_buf1;
960 u_int32_t at_buf2;
961 };
962
963 #define ATW_TXCTL_OWN BIT(31)
964 #define ATW_TXCTL_DONE BIT(30)
965 #define ATW_TXCTL_TXDR_MASK BITS(27,20)
966 #define ATW_TXCTL_TL_MASK BITS(19,0)
967
968 #define ATW_TXSTAT_OWN ATW_TXCTL_OWN
969 #define ATW_TXSTAT_DONE ATW_TXCTL_DONE
970 #define ATW_TXSTAT_ES BIT(29)
971 #define ATW_TXSTAT_TLT BIT(28)
972 #define ATW_TXSTAT_TRT BIT(27)
973 #define ATW_TXSTAT_TUF BIT(26)
974 #define ATW_TXSTAT_TRO BIT(25)
975 #define ATW_TXSTAT_SOFBR BIT(24)
976
977
978 #define ATW_TXSTAT_ARC_MASK BITS(11,0)
979
980 #define ATW_TXFLAG_IC BIT(31)
981 #define ATW_TXFLAG_LS BIT(30)
982 #define ATW_TXFLAG_FS BIT(29)
983 #define ATW_TXFLAG_TER BIT(25)
984 #define ATW_TXFLAG_TCH BIT(24)
985 #define ATW_TXFLAG_TBS2_MASK BITS(23,12)
986 #define ATW_TXFLAG_TBS1_MASK BITS(11,0)
987
988
989 struct atw_rxdesc {
990 u_int32_t ar_stat;
991 u_int32_t ar_ctl;
992 u_int32_t ar_buf1;
993 u_int32_t ar_buf2;
994 };
995
996 #define ar_rssi ar_ctl
997
998 #define ATW_RXCTL_RER BIT(25)
999 #define ATW_RXCTL_RCH BIT(24)
1000 #define ATW_RXCTL_RBS2_MASK BITS(23,12)
1001 #define ATW_RXCTL_RBS1_MASK BITS(11,0)
1002
1003 #define ATW_RXSTAT_OWN BIT(31)
1004 #define ATW_RXSTAT_ES BIT(30)
1005
1006
1007 #define ATW_RXSTAT_SQL BIT(29)
1008 #define ATW_RXSTAT_DE BIT(28)
1009
1010
1011
1012 #define ATW_RXSTAT_FS BIT(27)
1013 #define ATW_RXSTAT_LS BIT(26)
1014 #define ATW_RXSTAT_PCF BIT(25)
1015 #define ATW_RXSTAT_SFDE BIT(24)
1016 #define ATW_RXSTAT_SIGE BIT(23)
1017 #define ATW_RXSTAT_CRC16E BIT(22)
1018 #define ATW_RXSTAT_RXTOE BIT(21)
1019
1020
1021 #define ATW_RXSTAT_CRC32E BIT(20)
1022 #define ATW_RXSTAT_ICVE BIT(19)
1023 #define ATW_RXSTAT_DA1 BIT(17)
1024 #define ATW_RXSTAT_DA0 BIT(16)
1025 #define ATW_RXSTAT_RXDR_MASK BITS(15,12)
1026 #define ATW_RXSTAT_FL_MASK BITS(11,0)
1027
1028
1029
1030
1031
1032
1033 #define ATW_SRAM_ADDR_INDIVL_KEY 0x0
1034 #define ATW_SRAM_ADDR_SHARED_KEY (0x160 * 2)
1035 #define ATW_SRAM_ADDR_SSID (0x180 * 2)
1036 #define ATW_SRAM_ADDR_SUPRATES (0x191 * 2)
1037 #define ATW_SRAM_MAXSIZE (0x200 * 2)
1038 #define ATW_SRAM_A_SIZE ATW_SRAM_MAXSIZE
1039 #define ATW_SRAM_B_SIZE (0x1c0 * 2)
1040