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 #ifndef _BIT_TWIDDLE
37 #define _BIT_TWIDDLE
38
39 #define BIT(n) (((n) == 32) ? 0 : ((u_int32_t)1 << (n)))
40
41
42 #define BITS(m, n) ((BIT(MAX((m), (n)) + 1) - 1) ^ (BIT(MIN((m), (n))) - 1))
43
44
45 #define LOWEST_SET_BIT(x) ((((x) - 1) & (x)) ^ (x))
46
47
48
49
50 #define GTEQ_POWER(x, p) (((u_long)(x) >> (p)) != 0)
51
52 #define MASK_TO_SHIFT2(m) (GTEQ_POWER(LOWEST_SET_BIT((m)), 1) ? 1 : 0)
53
54 #define MASK_TO_SHIFT4(m) \
55 (GTEQ_POWER(LOWEST_SET_BIT((m)), 2) \
56 ? 2 + MASK_TO_SHIFT2((m) >> 2) \
57 : MASK_TO_SHIFT2((m)))
58
59 #define MASK_TO_SHIFT8(m) \
60 (GTEQ_POWER(LOWEST_SET_BIT((m)), 4) \
61 ? 4 + MASK_TO_SHIFT4((m) >> 4) \
62 : MASK_TO_SHIFT4((m)))
63
64 #define MASK_TO_SHIFT16(m) \
65 (GTEQ_POWER(LOWEST_SET_BIT((m)), 8) \
66 ? 8 + MASK_TO_SHIFT8((m) >> 8) \
67 : MASK_TO_SHIFT8((m)))
68
69 #define MASK_TO_SHIFT(m) \
70 (GTEQ_POWER(LOWEST_SET_BIT((m)), 16) \
71 ? 16 + MASK_TO_SHIFT16((m) >> 16) \
72 : MASK_TO_SHIFT16((m)))
73
74 #define MASK_AND_RSHIFT(x, mask) (((x) & (mask)) >> MASK_TO_SHIFT(mask))
75 #define LSHIFT(x, mask) ((x) << MASK_TO_SHIFT(mask))
76 #define MASK_AND_REPLACE(reg, val, mask) ((reg & ~mask) | LSHIFT(val, mask))
77 #define PRESHIFT(m) MASK_AND_RSHIFT((m), (m))
78
79 #endif
80
81
82
83 #define RTW_IDR0 0x00
84
85
86
87
88 #define RTW_IDR1 0x04
89
90 #define RTW_MAR0 0x08
91 #define RTW_MAR1 0x0c
92
93 #define RTW_TSFTRL 0x18
94
95
96 #define RTW_TSFTRH 0x1c
97 #define RTW_TLPDA 0x20
98
99
100 #define RTW_TNPDA 0x24
101
102
103 #define RTW_THPDA 0x28
104
105
106
107 #define RTW_BRSR 0x2c
108 #define RTW8180_BRSR_BPLCP BIT(8)
109 #define RTW8180_BRSR_MBR_MASK BITS(1,0)
110 #define RTW8180_BRSR_MBR_1MBPS LSHIFT(0, RTW8180_BRSR_MBR_MASK)
111 #define RTW8180_BRSR_MBR_2MBPS LSHIFT(1, RTW8180_BRSR_MBR_MASK)
112 #define RTW8180_BRSR_MBR_5MBPS LSHIFT(2, RTW8180_BRSR_MBR_MASK)
113 #define RTW8180_BRSR_MBR_11MBPS LSHIFT(3, RTW8180_BRSR_MBR_MASK)
114 #define RTW8185_BRSR_MBR_MASK BITS(11, 0)
115 #define RTW8185_BRSR_MBR_1MBPS BIT(0)
116 #define RTW8185_BRSR_MBR_2MBPS BIT(1)
117 #define RTW8185_BRSR_MBR_5MBPS BIT(2)
118 #define RTW8185_BRSR_MBR_11MBPS BIT(3)
119 #define RTW8185_BRSR_MBR_6MBPS BIT(4)
120 #define RTW8185_BRSR_MBR_9MBPS BIT(5)
121 #define RTW8185_BRSR_MBR_12MBPS BIT(6)
122 #define RTW8185_BRSR_MBR_18MBPS BIT(7)
123 #define RTW8185_BRSR_MBR_24MBPS BIT(8)
124 #define RTW8185_BRSR_MBR_36MBPS BIT(9)
125 #define RTW8185_BRSR_MBR_48MBPS BIT(10)
126 #define RTW8185_BRSR_MBR_54MBPS BIT(11)
127
128 #define RTW_BSSID 0x2e
129
130 #define RTW_BSSID16 0x2e
131 #define RTW_BSSID32 (0x2e + 4)
132 #define RTW_BSSID0 RTW_BSSID16
133 #define RTW_BSSID1 (RTW_BSSID0 + 1)
134 #define RTW_BSSID2 (RTW_BSSID1 + 1)
135 #define RTW_BSSID3 (RTW_BSSID2 + 1)
136 #define RTW_BSSID4 (RTW_BSSID3 + 1)
137 #define RTW_BSSID5 (RTW_BSSID4 + 1)
138
139 #define RTW8185_RR 0x34
140 #define RTW8185_RR_MAX BIT(7, 4)
141 #define RTW8185_RR_MAX_1MPBS LSHIFT(0, RTW8185_RR_MAX_MASK)
142 #define RTW8185_RR_MAX_2MPBS LSHIFT(1, RTW8185_RR_MAX_MASK)
143 #define RTW8185_RR_MAX_5MPBS LSHIFT(2, RTW8185_RR_MAX_MASK)
144 #define RTW8185_RR_MAX_11MPBS LSHIFT(3, RTW8185_RR_MAX_MASK)
145 #define RTW8185_RR_MAX_6MPBS LSHIFT(4, RTW8185_RR_MAX_MASK)
146 #define RTW8185_RR_MAX_9MPBS LSHIFT(5, RTW8185_RR_MAX_MASK)
147 #define RTW8185_RR_MAX_12MPBS LSHIFT(6, RTW8185_RR_MAX_MASK)
148 #define RTW8185_RR_MAX_18MPBS LSHIFT(7, RTW8185_RR_MAX_MASK)
149 #define RTW8185_RR_MAX_24MPBS LSHIFT(8, RTW8185_RR_MAX_MASK)
150 #define RTW8185_RR_MAX_36MPBS LSHIFT(9, RTW8185_RR_MAX_MASK)
151 #define RTW8185_RR_MAX_48MPBS LSHIFT(10, RTW8185_RR_MAX_MASK)
152 #define RTW8185_RR_MAX_54MPBS LSHIFT(11, RTW8185_RR_MAX_MASK)
153 #define RTW8185_RR_MIN_MASK BIT(3, 0)
154 #define RTW8185_RR_MIN_1MPBS LSHIFT(0, RTW8185_RR_MIN_MASK)
155 #define RTW8185_RR_MIN_2MPBS LSHIFT(1, RTW8185_RR_MIN_MASK)
156 #define RTW8185_RR_MIN_5MPBS LSHIFT(2, RTW8185_RR_MIN_MASK)
157 #define RTW8185_RR_MIN_11MPBS LSHIFT(3, RTW8185_RR_MIN_MASK)
158 #define RTW8185_RR_MIN_6MPBS LSHIFT(4, RTW8185_RR_MIN_MASK)
159 #define RTW8185_RR_MIN_9MPBS LSHIFT(5, RTW8185_RR_MIN_MASK)
160 #define RTW8185_RR_MIN_12MPBS LSHIFT(6, RTW8185_RR_MIN_MASK)
161 #define RTW8185_RR_MIN_18MPBS LSHIFT(7, RTW8185_RR_MIN_MASK)
162 #define RTW8185_RR_MIN_24MPBS LSHIFT(8, RTW8185_RR_MIN_MASK)
163 #define RTW8185_RR_MIN_36MPBS LSHIFT(9, RTW8185_RR_MIN_MASK)
164 #define RTW8185_RR_MIN_48MPBS LSHIFT(10, RTW8185_RR_MIN_MASK)
165 #define RTW8185_RR_MIN_54MPBS LSHIFT(11, RTW8185_RR_MIN_MASK)
166
167 #define RTW8185_EIFS_TIMER 0x35
168
169 #define RTW_CR 0x37
170 #define RTW_CR_RST BIT(4)
171
172
173
174 #define RTW_CR_RE BIT(3)
175
176
177
178
179 #define RTW_CR_TE BIT(2)
180
181
182
183
184 #define RTW_CR_MULRW BIT(0)
185
186
187
188 #define RTW_IMR 0x3c
189 #define RTW_ISR 0x3e
190
191 #define RTW_INTR_TXFOVW BIT(15)
192 #define RTW_INTR_TIMEOUT BIT(14)
193
194
195 #define RTW_INTR_BCNINT BIT(13)
196
197
198
199
200 #define RTW_INTR_ATIMINT BIT(12)
201
202
203
204
205 #define RTW_INTR_TBDER BIT(11)
206
207
208
209 #define RTW_INTR_TBDOK BIT(10)
210 #define RTW_INTR_THPDER BIT(9)
211
212
213 #define RTW_INTR_THPDOK BIT(8)
214 #define RTW_INTR_TNPDER BIT(7)
215
216
217 #define RTW_INTR_TNPDOK BIT(6)
218 #define RTW_INTR_RXFOVW BIT(5)
219
220
221 #define RTW_INTR_RDU BIT(4)
222 #define RTW_INTR_TLPDER BIT(3)
223
224
225 #define RTW_INTR_TLPDOK BIT(2)
226 #define RTW_INTR_RER BIT(1)
227 #define RTW_INTR_ROK BIT(0)
228
229
230 #define RTW_INTR_RX (RTW_INTR_RER|RTW_INTR_ROK)
231 #define RTW_INTR_TX (RTW_INTR_TLPDER|RTW_INTR_TLPDOK|RTW_INTR_THPDER|\
232 RTW_INTR_THPDOK|RTW_INTR_TNPDER|RTW_INTR_TNPDOK|\
233 RTW_INTR_TBDER|RTW_INTR_TBDOK)
234 #define RTW_INTR_BEACON (RTW_INTR_BCNINT|RTW_INTR_TBDER|RTW_INTR_TBDOK)
235 #define RTW_INTR_IOERROR (RTW_INTR_TXFOVW|RTW_INTR_RXFOVW|RTW_INTR_RDU)
236
237 #define RTW_TCR 0x40
238 #define RTW_TCR_CWMIN BIT(31)
239 #define RTW_TCR_SWSEQ BIT(30)
240
241
242 #define RTW8185_TCR_NOPROBERSPTO BIT(29)
243
244 #define RTW_TCR_HWVERID_MASK BITS(27, 25)
245 #define RTW_TCR_HWVERID_RTL8180D BIT(26)
246 #define RTW_TCR_HWVERID_RTL8180F BITS(26, 25)
247 #define RTW_TCR_HWVERID_RTL8185 (BIT(27) | BIT(25))
248
249
250
251
252 #define RTW8180_TCR_SAT BIT(24)
253
254
255
256 #define RTW8185_TCR_PLCPLENGTH BIT(24)
257
258 #define RTW_TCR_MXDMA_MASK BITS(23,21)
259 #define RTW_TCR_MXDMA_16 LSHIFT(0, RTW_TCR_MXDMA_MASK)
260 #define RTW_TCR_MXDMA_32 LSHIFT(1, RTW_TCR_MXDMA_MASK)
261 #define RTW_TCR_MXDMA_64 LSHIFT(2, RTW_TCR_MXDMA_MASK)
262 #define RTW_TCR_MXDMA_128 LSHIFT(3, RTW_TCR_MXDMA_MASK)
263 #define RTW_TCR_MXDMA_256 LSHIFT(4, RTW_TCR_MXDMA_MASK)
264 #define RTW_TCR_MXDMA_512 LSHIFT(5, RTW_TCR_MXDMA_MASK)
265 #define RTW_TCR_MXDMA_1024 LSHIFT(6, RTW_TCR_MXDMA_MASK)
266 #define RTW_TCR_MXDMA_2048 LSHIFT(7, RTW_TCR_MXDMA_MASK)
267
268 #define RTW_TCR_DISCW BIT(20)
269
270 #define RTW_TCR_ICV BIT(19)
271
272
273
274
275 #define RTW_TCR_LBK_MASK BITS(18,17)
276 #define RTW_TCR_LBK_NORMAL LSHIFT(0, RTW_TCR_LBK_MASK)
277 #define RTW_TCR_LBK_MAC LSHIFT(1, RTW_TCR_LBK_MASK)
278 #define RTW_TCR_LBK_BBP LSHIFT(2, RTW_TCR_LBK_MASK)
279 #define RTW_TCR_LBK_CONT LSHIFT(3, RTW_TCR_LBK_MASK)
280
281 #define RTW_TCR_CRC BIT(16)
282
283
284
285
286
287
288
289 #define RTW_TCR_SRL_MASK BITS(15,8)
290 #define RTW_TCR_LRL_MASK BITS(7,0)
291
292 #define RTW_RCR 0x44
293 #define RTW_RCR_ONLYERLPKT BIT(31)
294
295
296 #define RTW_RCR_ENCS2 BIT(30)
297 #define RTW_RCR_ENCS1 BIT(29)
298 #define RTW_RCR_ENMARP BIT(28)
299 #define RTW_RCR_CBSSID BIT(23)
300
301
302
303
304
305 #define RTW_RCR_APWRMGT BIT(22)
306 #define RTW_RCR_ADD3 BIT(21)
307
308
309
310
311 #define RTW_RCR_AMF BIT(20)
312 #define RTW_RCR_ACF BIT(19)
313 #define RTW_RCR_ADF BIT(18)
314
315
316
317 #define RTW8180_RCR_RXFTH_MASK BITS(15,13)
318 #define RTW8180_RCR_RXFTH_64 LSHIFT(2, RTW8180_RCR_RXFTH_MASK)
319 #define RTW8180_RCR_RXFTH_128 LSHIFT(3, RTW8180_RCR_RXFTH_MASK)
320 #define RTW8180_RCR_RXFTH_256 LSHIFT(4, RTW8180_RCR_RXFTH_MASK)
321 #define RTW8180_RCR_RXFTH_512 LSHIFT(5, RTW8180_RCR_RXFTH_MASK)
322 #define RTW8180_RCR_RXFTH_1024 LSHIFT(6, RTW8180_RCR_RXFTH_MASK)
323 #define RTW8180_RCR_RXFTH_WHOLE LSHIFT(7, RTW8180_RCR_RXFTH_MASK)
324
325 #define RTW_RCR_AICV BIT(12)
326
327
328 #define RTW_RCR_MXDMA_MASK BITS(10,8)
329 #define RTW_RCR_MXDMA_16 LSHIFT(0, RTW_RCR_MXDMA_MASK)
330 #define RTW_RCR_MXDMA_32 LSHIFT(1, RTW_RCR_MXDMA_MASK)
331 #define RTW_RCR_MXDMA_64 LSHIFT(2, RTW_RCR_MXDMA_MASK)
332 #define RTW_RCR_MXDMA_128 LSHIFT(3, RTW_RCR_MXDMA_MASK)
333 #define RTW_RCR_MXDMA_256 LSHIFT(4, RTW_RCR_MXDMA_MASK)
334 #define RTW_RCR_MXDMA_512 LSHIFT(5, RTW_RCR_MXDMA_MASK)
335 #define RTW_RCR_MXDMA_1024 LSHIFT(6, RTW_RCR_MXDMA_MASK)
336 #define RTW_RCR_MXDMA_UNLIMITED LSHIFT(7, RTW_RCR_MXDMA_MASK)
337
338
339 #define RTW_RCR_9356SEL BIT(6)
340
341 #define RTW_RCR_ACRC32 BIT(5)
342 #define RTW_RCR_AB BIT(3)
343 #define RTW_RCR_AM BIT(2)
344
345 #define RTW_RCR_APM BIT(1)
346 #define RTW_RCR_AAP BIT(0)
347
348
349 #define RTW_RCR_MONITOR ( \
350 RTW_RCR_AAP | \
351 RTW_RCR_ACF | \
352 RTW_RCR_ACRC32 | \
353 RTW_RCR_AICV | \
354 0)
355
356
357 #define RTW_RCR_PKTFILTER_MASK (\
358 RTW_RCR_AAP | \
359 RTW_RCR_AB | \
360 RTW_RCR_ACF | \
361 RTW_RCR_ACRC32 | \
362 RTW_RCR_ADD3 | \
363 RTW_RCR_ADF | \
364 RTW_RCR_AICV | \
365 RTW_RCR_AM | \
366 RTW_RCR_AMF | \
367 RTW_RCR_APM | \
368 RTW_RCR_APWRMGT | \
369 0)
370
371
372 #define RTW_RCR_PKTFILTER_DEFAULT ( \
373 RTW_RCR_ADF | \
374 RTW_RCR_AMF | \
375 RTW_RCR_APM | \
376 RTW_RCR_APWRMGT | \
377 0)
378
379 #define RTW_TINT 0x48
380 #define RTW_TBDA 0x4c
381
382
383 #define RTW_9346CR 0x50
384 #define RTW_9346CR_EEM_MASK BITS(7,6)
385 #define RTW_9346CR_EEM_NORMAL LSHIFT(0, RTW_9346CR_EEM_MASK)
386
387
388
389
390 #define RTW_9346CR_EEM_AUTOLOAD LSHIFT(1, RTW_9346CR_EEM_MASK)
391
392
393
394
395 #define RTW_9346CR_EEM_PROGRAM LSHIFT(2, RTW_9346CR_EEM_MASK)
396
397 #define RTW_9346CR_EEM_CONFIG LSHIFT(3, RTW_9346CR_EEM_MASK)
398
399
400
401 #define RTW_9346CR_EECS BIT(3)
402 #define RTW_9346CR_EESK BIT(2)
403 #define RTW_9346CR_EEDI BIT(1)
404 #define RTW_9346CR_EEDO BIT(0)
405
406 #define RTW_CONFIG0 0x51
407 #define RTW8180_CONFIG0_WEP40 BIT(7)
408
409 #define RTW8180_CONFIG0_WEP104 BIT(6)
410
411
412 #define RTW8180_CONFIG0_LEDGPOEN BIT(4)
413
414
415
416
417
418 #define RTW_CONFIG0_AUXPWR BIT(3)
419
420 #define RTW8180_CONFIG0_GL_MASK BITS(1,0)
421 #define RTW8180_CONFIG0_GL_USA LSHIFT(3, RTW8180_CONFIG0_GL_MASK)
422 #define RTW8180_CONFIG0_GL_EUROPE LSHIFT(2, RTW8180_CONFIG0_GL_MASK)
423 #define RTW8180_CONFIG0_GL_JAPAN LSHIFT(1, RTW8180_CONFIG0_GL_MASK)
424 #define RTW8180_CONFIG0_GL_JAPAN2 LSHIFT(0, RTW8180_CONFIG0_GL_MASK)
425
426
427 #define RTW_CONFIG1 0x52
428
429
430
431
432
433
434
435
436
437
438 #define RTW_CONFIG1_LEDS_MASK BITS(7,6)
439 #define RTW_CONFIG1_LEDS_ACT_INFRA LSHIFT(0, RTW_CONFIG1_LEDS_MASK)
440 #define RTW_CONFIG1_LEDS_ACT_LINK LSHIFT(1, RTW_CONFIG1_LEDS_MASK)
441 #define RTW_CONFIG1_LEDS_TX_RX LSHIFT(2, RTW_CONFIG1_LEDS_MASK)
442 #define RTW_CONFIG1_LEDS_LINKACT_INFRA LSHIFT(3, RTW_CONFIG1_LEDS_MASK)
443
444
445
446
447
448
449
450
451 #define RTW_CONFIG1_LWACT BIT(4)
452
453 #define RTW_CONFIG1_MEMMAP BIT(3)
454 #define RTW_CONFIG1_IOMAP BIT(2)
455 #define RTW_CONFIG1_VPD BIT(1)
456
457
458
459
460 #define RTW_CONFIG1_PMEN BIT(0)
461
462 #define RTW_CONFIG2 0x53
463 #define RTW_CONFIG2_LCK BIT(7)
464
465
466
467 #define RTW8180_CONFIG2_ANT BIT(6)
468 #define RTW_CONFIG2_DPS BIT(3)
469
470
471 #define RTW_CONFIG2_PAPESIGN BIT(2)
472 #define RTW_CONFIG2_PAPETIME_MASK BITS(1,0)
473
474 #define RTW_ANAPARM_0 0x54
475 #define RTW8185_ANAPARM_1 0x60
476
477 #define RTW_ANAPARM_RFPOW0_MASK BITS(30,28)
478
479
480
481
482
483 #define RTW_ANAPARM_RFPOW_MASK \
484 (RTW_ANAPARM_RFPOW0_MASK|RTW_ANAPARM_RFPOW1_MASK)
485
486 #define RTW_ANAPARM_TXDACOFF BIT(27)
487
488
489 #define RTW_ANAPARM_RFPOW1_MASK BITS(26,20)
490
491
492
493
494
495
496
497
498
499 #define RTW_ANAPARM_RFPOW_MAXIM_ON LSHIFT(0x8, RTW_ANAPARM_RFPOW1_MASK)
500
501
502 #define RTW_ANAPARM_RFPOW_MAXIM_SLEEP LSHIFT(0x378, RTW_ANAPARM_RFPOW1_MASK)
503
504
505 #define RTW_ANAPARM_RFPOW_MAXIM_OFF LSHIFT(0x379, RTW_ANAPARM_RFPOW1_MASK)
506
507
508
509
510 #define RTW_ANAPARM_RFPOW_RFMD_ON LSHIFT(0x408, RTW_ANAPARM_RFPOW1_MASK)
511
512
513 #define RTW_ANAPARM_RFPOW_RFMD_SLEEP LSHIFT(0x378, RTW_ANAPARM_RFPOW1_MASK)
514
515
516 #define RTW_ANAPARM_RFPOW_RFMD_OFF LSHIFT(0x379, RTW_ANAPARM_RFPOW1_MASK)
517
518
519
520
521 #define RTW_ANAPARM_RFPOW_ANA_PHILIPS_ON \
522 LSHIFT(0x328, RTW_ANAPARM_RFPOW1_MASK)
523 #define RTW_ANAPARM_RFPOW_DIG_PHILIPS_ON \
524 LSHIFT(0x008, RTW_ANAPARM_RFPOW1_MASK)
525
526
527 #define RTW_ANAPARM_RFPOW_PHILIPS_SLEEP\
528 LSHIFT(0x378, RTW_ANAPARM_RFPOW1_MASK)
529
530
531 #define RTW_ANAPARM_RFPOW_PHILIPS_OFF\
532 LSHIFT(0x379, RTW_ANAPARM_RFPOW1_MASK)
533
534 #define RTW_ANAPARM_RFPOW_PHILIPS_ON LSHIFT(0x328, RTW_ANAPARM_RFPOW1_MASK)
535
536 #define RTW_ANAPARM_CARDSP_MASK BITS(19,0)
537
538
539
540
541
542 #define RTW_MSR 0x58
543
544 #define RTW_MSR_NETYPE_MASK BITS(3,2)
545
546 #define RTW_MSR_NETYPE_AP_OK LSHIFT(3, RTW_MSR_NETYPE_MASK)
547
548 #define RTW_MSR_NETYPE_INFRA_OK LSHIFT(2, RTW_MSR_NETYPE_MASK)
549
550 #define RTW_MSR_NETYPE_ADHOC_OK LSHIFT(1, RTW_MSR_NETYPE_MASK)
551
552 #define RTW_MSR_NETYPE_NOLINK LSHIFT(0, RTW_MSR_NETYPE_MASK)
553
554 #define RTW_CONFIG3 0x59
555 #define RTW_CONFIG3_GNTSEL BIT(7)
556 #define RTW_CONFIG3_PARMEN BIT(6)
557
558
559
560 #define RTW_CONFIG3_MAGIC BIT(5)
561
562
563
564 #define RTW_CONFIG3_CARDBEN BIT(3)
565
566
567
568 #define RTW_CONFIG3_CLKRUNEN BIT(2)
569
570
571 #define RTW_CONFIG3_FUNCREGEN BIT(1)
572
573
574 #define RTW_CONFIG3_FBTBEN BIT(0)
575
576
577 #define RTW_CONFIG4 0x5A
578 #define RTW_CONFIG4_VCOPDN BIT(7)
579
580
581
582
583
584 #define RTW_CONFIG4_PWROFF BIT(6)
585
586
587
588
589
590
591
592
593 #define RTW_CONFIG4_PWRMGT BIT(5)
594
595
596
597
598 #define RTW_CONFIG4_LWPME BIT(4)
599
600
601
602
603
604
605
606 #define RTW_CONFIG4_LWPTN BIT(2)
607
608
609
610 #define RTW_CONFIG4_RFTYPE_MASK BITS(1,0)
611 #define RTW_CONFIG4_RFTYPE_INTERSIL LSHIFT(1, RTW_CONFIG4_RFTYPE_MASK)
612 #define RTW_CONFIG4_RFTYPE_RFMD LSHIFT(2, RTW_CONFIG4_RFTYPE_MASK)
613 #define RTW_CONFIG4_RFTYPE_PHILIPS LSHIFT(3, RTW_CONFIG4_RFTYPE_MASK)
614
615 #define RTW_TESTR 0x5B
616
617 #define RTW_PSR 0x5e
618 #define RTW_PSR_GPO BIT(7)
619 #define RTW_PSR_GPI BIT(6)
620 #define RTW_PSR_LEDGPO1 BIT(5)
621
622
623 #define RTW_PSR_LEDGPO0 BIT(4)
624
625
626 #define RTW_PSR_UWF BIT(1)
627 #define RTW_PSR_PSEN BIT(0)
628
629 #define RTW8180_SCR 0x5f
630 #define RTW8180_SCR_KM_MASK BITS(5,4)
631 #define RTW8180_SCR_KM_WEP104 LSHIFT(1, RTW8180_SCR_KM_MASK)
632 #define RTW8180_SCR_KM_WEP40 LSHIFT(0, RTW8180_SCR_KM_MASK)
633 #define RTW8180_SCR_TXSECON BIT(1)
634
635
636
637 #define RTW8180_SCR_RXSECON BIT(0)
638
639
640
641
642 #define RTW8185_RFPARM 0x60
643
644 #define RTW_BCNITV 0x70
645 #define RTW_BCNITV_BCNITV_MASK BITS(9,0)
646
647
648 #define RTW_ATIMWND 0x72
649 #define RTW_ATIMWND_ATIMWND BITS(9,0)
650
651
652
653 #define RTW_BINTRITV 0x74
654 #define RTW_BINTRITV_BINTRITV BITS(9,0)
655
656
657
658 #define RTW_ATIMTRITV 0x76
659 #define RTW_ATIMTRITV_ATIMTRITV BITS(9,0)
660
661
662
663
664
665 #define RTW_PHYDELAY 0x78
666 #define RTW_PHYDELAY_REVC_MAGIC BIT(3)
667
668
669 #define RTW_PHYDELAY_PHYDELAY BITS(2,0)
670
671
672 #define RTW_CRCOUNT 0x79
673 #define RTW_CRCOUNT_MAGIC 0x4c
674
675 #define RTW_CRC16ERR 0x7a
676
677 #define RTW_BB 0x7c
678
679 #define RTW_BB_RD_MASK BITS(23,16)
680 #define RTW_BB_WR_MASK BITS(15,8)
681 #define RTW_BB_WREN BIT(7)
682 #define RTW_BB_ADDR_MASK BITS(6,0)
683
684 #define RTW_PHYADDR 0x7c
685 #define RTW_PHYDATAW 0x7d
686 #define RTW_PHYDATAR 0x7e
687
688 #define RTW8180_PHYCFG 0x80
689 #define RTW8180_PHYCFG_MAC_POLL BIT(31)
690
691
692
693 #define RTW8180_PHYCFG_HST BIT(30)
694
695
696 #define RTW8180_PHYCFG_MAC_RFTYPE_MASK BITS(29,28)
697 #define RTW8180_PHYCFG_MAC_RFTYPE_INTERSIL \
698 LSHIFT(0, RTW8180_PHYCFG_MAC_RFTYPE_MASK)
699 #define RTW8180_PHYCFG_MAC_RFTYPE_RFMD \
700 LSHIFT(1, RTW8180_PHYCFG_MAC_RFTYPE_MASK)
701 #define RTW8180_PHYCFG_MAC_RFTYPE_GCT \
702 RTW8180_PHYCFG_MAC_RFTYPE_RFMD
703 #define RTW8180_PHYCFG_MAC_RFTYPE_PHILIPS \
704 LSHIFT(3, RTW8180_PHYCFG_MAC_RFTYPE_MASK)
705 #define RTW8180_PHYCFG_MAC_PHILIPS_ADDR_MASK BITS(27,24)
706 #define RTW8180_PHYCFG_MAC_PHILIPS_DATA_MASK BITS(23,0)
707 #define RTW8180_PHYCFG_MAC_MAXIM_LODATA_MASK BITS(27,24)
708 #define RTW8180_PHYCFG_MAC_MAXIM_ADDR_MASK BITS(11,8)
709 #define RTW8180_PHYCFG_MAC_MAXIM_HIDATA_MASK BITS(7,0)
710 #define RTW8180_PHYCFG_HST_EN BIT(2)
711 #define RTW8180_PHYCFG_HST_CLK BIT(1)
712 #define RTW8180_PHYCFG_HST_DATA BIT(0)
713
714 #define RTW8185_RFPINSOUTPUT 0x80
715 #define RTW8185_RFPINSOUTPUT_MASK 0xfff3
716
717 #define RTW8185_RFPINSENABLE 0x82
718 #define RTW8185_RFPINSENABLE_ENABLE 0x0007
719
720 #define RTW8185_INSSELECT 0x84
721 #define RTW8185_SW_GPIO 0x400
722
723 #define RTW_MAXIM_HIDATA_MASK BITS(11,4)
724 #define RTW_MAXIM_LODATA_MASK BITS(3,0)
725
726
727
728
729
730 #define RTW_WAKEUP0L 0x84
731 #define RTW_WAKEUP0H 0x88
732
733 #define RTW_WAKEUP1L 0x8c
734 #define RTW_WAKEUP1H 0x90
735
736 #define RTW_WAKEUP2LL 0x94
737 #define RTW_WAKEUP2LH 0x98
738
739 #define RTW_WAKEUP2HL 0x9c
740 #define RTW_WAKEUP2HH 0xa0
741
742 #define RTW_WAKEUP3LL 0xa4
743 #define RTW_WAKEUP3LH 0xa8
744
745 #define RTW_WAKEUP3HL 0xac
746 #define RTW_WAKEUP3HH 0xb0
747
748 #define RTW_WAKEUP4LL 0xb4
749 #define RTW_WAKEUP4LH 0xb8
750
751 #define RTW_WAKEUP4HL 0xbc
752 #define RTW_WAKEUP4HH 0xc0
753
754 #define RTW_CRC0 0xc4
755 #define RTW_CRC1 0xc6
756 #define RTW_CRC2 0xc8
757 #define RTW_CRC3 0xca
758 #define RTW_CRC4 0xcc
759
760
761
762
763
764
765
766
767
768
769 #define RTW8180_DK0 0x90
770 #define RTW8180_DK1 0xa0
771 #define RTW8180_DK2 0xb0
772 #define RTW8180_DK3 0xc0
773
774 #define RTW8185_RFPINSSELECT 0x84
775 #define RTW8185_RFPINSSELECT_ENABLE 0x0007
776
777 #define RTW8185_RFPINSINPUT 0x86
778 #define RTW8185_RFPARA 0x88
779 #define RTW8185_RFTIMING 0x8c
780 #define RTW8185_GPO 0x90
781 #define RTW8185_GPE 0x91
782 #define RTW8185_GPI 0x92
783 #define RTW8185_TXAGCCTL 0x9c
784 #define RTW8185_CCKTXAGC 0x9d
785 #define RTW8185_OFDMTXAGC 0x9e
786 #define RTW8185_ANTSEL 0x9f
787
788 #define RTW8185_CAMRW 0xa0
789 #define RTW8185_CAMRW_POOLING BIT(31)
790 #define RTW8185_CAMRW_WRITE BIT(16)
791 #define RTW8185_CAMRW_ADDRESS BITS(6, 0)
792
793 #define RTW8185_CAMOUTPUT 0xa4
794 #define RTW8185_CAMINPUT 0xa8
795
796 #define RTW8185_CAMDEBUG 0xac
797 #define RTW8185_CAMDEBUG_SELTXRXINFO BIT(31)
798 #define RTW8185_CAMDEBUG_KEYFOUND BIT(30)
799 #define RTW8185_CAMDEBUG_WPACONFIG BITS(29, 24)
800 #define RTW8185_CAMDEBUG_CAMKEY BITS(23, 0)
801
802 #define RTW8185_WPACONFIG 0xb0
803 #define RTW8185_WPACONFIG_RXWPADUMMY BIT(8)
804 #define RTW8185_WPACONFIG_DISRX_AESMIC BIT(3)
805 #define RTW8185_WPACONFIG_RXDECRYPT BIT(2)
806 #define RTW8185_WPACONFIG_TXENCRYPT BIT(1)
807 #define RTW8185_WPACONFIG_USEDEFAULTKEY BIT(0)
808
809 #define RTW8185_AESMASK 0xb2
810 #define RTW8185_SIFS 0xb4
811 #define RTW8185_DIFS 0xb5
812 #define RTW8185_SLOTTIME 0xb6
813 #define RTW8185_UTUNE 0xb7
814
815 #define RTW8185_CWCONFIG 0xbc
816 #define RTW8185_CWCONFIG_PPRETRYLIMIT BIT(1)
817 #define RTW8185_CWCONFIG_PPCW BIT(1)
818
819 #define RTW8185_CWVALUES 0xbd
820 #define RTW8185_CWVALUES_CWMAX BITS(7, 4)
821 #define RTW8185_CWVALUES_CWMIN BITS(3, 0)
822
823 #define RTW8185_RATEFALLBACKCTL 0xbe
824 #define RTW8185_RATEFALLBACKCTL_ENABLE BIT(7)
825 #define RTW8185_RATEFALLBACKCTL_STEP BITS(1, 0)
826
827 #define RTW_CONFIG5 0xd8
828 #define RTW_CONFIG5_TXFIFOOK BIT(7)
829 #define RTW_CONFIG5_RXFIFOOK BIT(6)
830 #define RTW_CONFIG5_CALON BIT(5)
831
832
833
834 #define RTW_CONFIG5_EACPI BIT(2)
835 #define RTW_CONFIG5_LANWAKE BIT(1)
836
837
838 #define RTW_CONFIG5_PMESTS BIT(0)
839
840
841
842
843
844
845 #define RTW_TPPOLL 0xd9
846
847
848 #define RTW_TPPOLL_BQ BIT(7)
849
850
851 #define RTW_TPPOLL_HPQ BIT(6)
852
853
854
855 #define RTW_TPPOLL_NPQ BIT(5)
856
857
858
859
860
861
862
863
864 #define RTW_TPPOLL_LPQ BIT(4)
865
866
867
868 #define RTW_TPPOLL_SBQ BIT(3)
869
870
871
872 #define RTW_TPPOLL_SHPQ BIT(2)
873
874
875 #define RTW_TPPOLL_SNPQ BIT(1)
876
877
878
879 #define RTW_TPPOLL_SLPQ BIT(0)
880
881
882
883
884 #define RTW_TPPOLL_ALL (RTW_TPPOLL_BQ | RTW_TPPOLL_HPQ | \
885 RTW_TPPOLL_NPQ | RTW_TPPOLL_LPQ)
886
887 #define RTW_TPPOLL_ACTIVE RTW_TPPOLL_ALL
888
889 #define RTW_TPPOLL_SALL (RTW_TPPOLL_SBQ | RTW_TPPOLL_SHPQ | \
890 RTW_TPPOLL_SNPQ | RTW_TPPOLL_SLPQ)
891
892 #define RTW_CWR 0xdc
893
894
895 #define RTW_CWR_CW BITS(9,0)
896
897
898 #define RTW_RETRYCTR 0xde
899
900 #define RTW_RETRYCTR_RETRYCT BITS(7,0)
901
902 #define RTW_RDSAR 0xe4
903
904
905
906
907
908 #define RTW_FER 0xf0
909 #define RTW_FER_INTR BIT(15)
910 #define RTW_FER_GWAKE BIT(4)
911
912
913
914 #define RTW_FEMR 0xf4
915 #define RTW_FEMR_INTR BIT(15)
916 #define RTW_FEMR_WKUP BIT(14)
917 #define RTW_FEMR_GWAKE BIT(4)
918
919
920
921
922 #define RTW_FPSR 0xf8
923 #define RTW_FPSR_INTR BIT(15)
924 #define RTW_FPSR_GWAKE BIT(4)
925
926
927
928
929 #define RTW_FFER 0xfc
930 #define RTW_FFER_INTR BIT(15)
931 #define RTW_FFER_GWAKE BIT(4)
932
933
934 #define RTW_SR_ID 0x00
935 #define RTW_SR_VID 0x02
936 #define RTW_SR_DID 0x04
937 #define RTW_SR_SVID 0x06
938 #define RTW_SR_SMID 0x08
939 #define RTW_SR_MNGNT 0x0a
940 #define RTW_SR_MXLAT 0x0b
941 #define RTW_SR_RFCHIPID 0x0c
942 #define RTW_SR_CONFIG3 0x0d
943 #define RTW_SR_MAC 0x0e
944 #define RTW_SR_CONFIG0 0x14
945 #define RTW_SR_CONFIG1 0x15
946 #define RTW_SR_PMC 0x16
947 #define RTW_SR_CONFIG2 0x18
948 #define RTW_SR_CONFIG4 0x19
949 #define RTW_SR_ANAPARM 0x1a
950 #define RTW_SR_TESTR 0x1e
951 #define RTW_SR_CONFIG5 0x1f
952 #define RTW_SR_TXPOWER1 0x20
953 #define RTW_SR_TXPOWER2 0x21
954 #define RTW_SR_TXPOWER3 0x22
955 #define RTW_SR_TXPOWER4 0x23
956 #define RTW_SR_TXPOWER5 0x24
957 #define RTW_SR_TXPOWER6 0x25
958 #define RTW_SR_TXPOWER7 0x26
959 #define RTW_SR_TXPOWER8 0x27
960 #define RTW_SR_TXPOWER9 0x28
961 #define RTW_SR_TXPOWER10 0x29
962 #define RTW_SR_TXPOWER11 0x2a
963 #define RTW_SR_TXPOWER12 0x2b
964 #define RTW_SR_TXPOWER13 0x2c
965 #define RTW_SR_TXPOWER14 0x2d
966 #define RTW_SR_CHANNELPLAN 0x2e
967 #define RTW_SR_ENERGYDETTHR 0x2f
968 #define RTW_SR_ENERGYDETTHR_DEFAULT 0x0c
969 #define RTW_SR_CISPOINTER 0x30
970 #define RTW_SR_RFPARM 0x32
971 #define RTW_SR_RFPARM_DIGPHY BIT(0)
972 #define RTW_SR_RFPARM_DFLANTB BIT(1)
973 #define RTW_SR_RFPARM_CS_MASK BITS(2,3)
974 #define RTW_SR_VERSION 0x3c
975 #define RTW_SR_CRC 0x3e
976 #define RTW_SR_VPD 0x40
977 #define RTW_SR_CIS 0x80
978
979
980
981
982
983
984 #define RTW_DESC_ALIGNMENT 256
985
986
987 struct rtw_txdesc {
988 u_int32_t td_ctl0;
989 u_int32_t td_ctl1;
990 u_int32_t td_buf;
991 u_int32_t td_len;
992 u_int32_t td_next;
993 u_int32_t td_rsvd[3];
994 };
995
996 #define td_stat td_ctl0
997
998 #define RTW_TXCTL0_OWN BIT(31)
999 #define RTW_TXCTL0_RSVD0 BIT(30)
1000 #define RTW_TXCTL0_FS BIT(29)
1001 #define RTW_TXCTL0_LS BIT(28)
1002
1003 #define RTW_TXCTL0_RATE_MASK BITS(27,24)
1004 #define RTW_TXCTL0_RATE_1MBPS LSHIFT(0, RTW_TXCTL0_RATE_MASK)
1005 #define RTW_TXCTL0_RATE_2MBPS LSHIFT(1, RTW_TXCTL0_RATE_MASK)
1006 #define RTW_TXCTL0_RATE_5MBPS LSHIFT(2, RTW_TXCTL0_RATE_MASK)
1007 #define RTW_TXCTL0_RATE_11MBPS LSHIFT(3, RTW_TXCTL0_RATE_MASK)
1008
1009 #define RTW_TXCTL0_RTSEN BIT(23)
1010
1011 #define RTW_TXCTL0_RTSRATE_MASK BITS(22,19)
1012 #define RTW_TXCTL0_RTSRATE_1MBPS LSHIFT(0, RTW_TXCTL0_RTSRATE_MASK)
1013 #define RTW_TXCTL0_RTSRATE_2MBPS LSHIFT(1, RTW_TXCTL0_RTSRATE_MASK)
1014 #define RTW_TXCTL0_RTSRATE_5MBPS LSHIFT(2, RTW_TXCTL0_RTSRATE_MASK)
1015 #define RTW_TXCTL0_RTSRATE_11MBPS LSHIFT(3, RTW_TXCTL0_RTSRATE_MASK)
1016
1017 #define RTW_TXCTL0_BEACON BIT(18)
1018 #define RTW_TXCTL0_MOREFRAG BIT(17)
1019 #define RTW_TXCTL0_SPLCP BIT(16)
1020
1021
1022 #define RTW_TXCTL0_KEYID_MASK BITS(15,14)
1023 #define RTW_TXCTL0_RSVD1_MASK BITS(13,12)
1024 #define RTW_TXCTL0_TPKTSIZE_MASK BITS(11,0)
1025
1026
1027
1028 #define RTW_TXSTAT_OWN RTW_TXCTL0_OWN
1029 #define RTW_TXSTAT_RSVD0 RTW_TXCTL0_RSVD0
1030 #define RTW_TXSTAT_FS RTW_TXCTL0_FS
1031 #define RTW_TXSTAT_LS RTW_TXCTL0_LS
1032 #define RTW_TXSTAT_RSVD1_MASK BITS(27,16)
1033 #define RTW_TXSTAT_TOK BIT(15)
1034 #define RTW_TXSTAT_RTSRETRY_MASK BITS(14,8)
1035 #define RTW_TXSTAT_DRC_MASK BITS(7,0)
1036
1037 #define RTW_TXCTL1_LENGEXT BIT(31)
1038
1039
1040
1041 #define RTW_TXCTL1_LENGTH_MASK BITS(30,16)
1042 #define RTW_TXCTL1_RTSDUR_MASK BITS(15,0)
1043
1044
1045
1046 #define RTW_TXLEN_LENGTH_MASK BITS(11,0)
1047
1048
1049 struct rtw_rxdesc {
1050 u_int32_t rd_ctl;
1051 u_int32_t rd_rsvd0;
1052 u_int32_t rd_buf;
1053 u_int32_t rd_rsvd1;
1054 };
1055
1056 #define rd_stat rd_ctl
1057 #define rd_rssi rd_rsvd0
1058 #define rd_tsftl rd_buf
1059 #define rd_tsfth rd_rsvd1
1060
1061 #define RTW_RXCTL_OWN BIT(31)
1062 #define RTW_RXCTL_EOR BIT(30)
1063 #define RTW_RXCTL_FS BIT(29)
1064 #define RTW_RXCTL_LS BIT(28)
1065 #define RTW_RXCTL_RSVD0_MASK BITS(29,12)
1066 #define RTW_RXCTL_LENGTH_MASK BITS(11,0)
1067
1068 #define RTW_RXSTAT_OWN RTW_RXCTL_OWN
1069 #define RTW_RXSTAT_EOR RTW_RXCTL_EOR
1070 #define RTW_RXSTAT_FS RTW_RXCTL_FS
1071 #define RTW_RXSTAT_LS RTW_RXCTL_LS
1072 #define RTW_RXSTAT_DMAFAIL BIT(27)
1073 #define RTW_RXSTAT_BOVF BIT(26)
1074
1075
1076 #define RTW_RXSTAT_SPLCP BIT(25)
1077
1078
1079 #define RTW_RXSTAT_RSVD1 BIT(24)
1080 #define RTW_RXSTAT_RATE_MASK BITS(23,20)
1081 #define RTW_RXSTAT_RATE_1MBPS LSHIFT(0, RTW_RXSTAT_RATE_MASK)
1082 #define RTW_RXSTAT_RATE_2MBPS LSHIFT(1, RTW_RXSTAT_RATE_MASK)
1083 #define RTW_RXSTAT_RATE_5MBPS LSHIFT(2, RTW_RXSTAT_RATE_MASK)
1084 #define RTW_RXSTAT_RATE_11MBPS LSHIFT(3, RTW_RXSTAT_RATE_MASK)
1085 #define RTW_RXSTAT_MIC BIT(19)
1086 #define RTW_RXSTAT_MAR BIT(18)
1087 #define RTW_RXSTAT_PAR BIT(17)
1088 #define RTW_RXSTAT_BAR BIT(16)
1089 #define RTW_RXSTAT_RES BIT(15)
1090
1091
1092
1093
1094 #define RTW_RXSTAT_PWRMGT BIT(14)
1095 #define RTW_RXSTAT_CRC16 BIT(14)
1096
1097
1098 #define RTW_RXSTAT_CRC32 BIT(13)
1099 #define RTW_RXSTAT_ICV BIT(12)
1100 #define RTW_RXSTAT_LENGTH_MASK BITS(11,0)
1101
1102
1103
1104
1105 #define RTW_RXSTAT_ONESEG (RTW_RXSTAT_FS|RTW_RXSTAT_LS)
1106
1107 #define RTW_RXSTAT_IOERROR (RTW_RXSTAT_DMAFAIL|RTW_RXSTAT_BOVF)
1108 #define RTW_RXSTAT_DEBUG (RTW_RXSTAT_SPLCP|RTW_RXSTAT_MAR|\
1109 RTW_RXSTAT_PAR|RTW_RXSTAT_BAR|\
1110 RTW_RXSTAT_PWRMGT|RTW_RXSTAT_CRC32|\
1111 RTW_RXSTAT_ICV)
1112
1113
1114 #define RTW_RXRSSI_VLAN BITS(32,16)
1115
1116 #define RTW_RXRSSI_RSSI BITS(15,8)
1117
1118 #define RTW_RXRSSI_IMR_RSSI BITS(15,9)
1119 #define RTW_RXRSSI_IMR_LNA BIT(8)
1120 #define RTW_RXRSSI_SQ BITS(7,0)
1121
1122 #define RTW_READ8(regs, ofs) \
1123 ((*(regs)->r_read8)(regs, ofs))
1124
1125 #define RTW_READ16(regs, ofs) \
1126 ((*(regs)->r_read16)(regs, ofs))
1127
1128 #define RTW_READ(regs, ofs) \
1129 ((*(regs)->r_read32)(regs, ofs))
1130
1131 #define RTW_WRITE8(regs, ofs, val) \
1132 ((*(regs)->r_write8)(regs, ofs, val))
1133
1134 #define RTW_WRITE16(regs, ofs, val) \
1135 ((*(regs)->r_write16)(regs, ofs, val))
1136
1137 #define RTW_WRITE(regs, ofs, val) \
1138 ((*(regs)->r_write32)(regs, ofs, val))
1139
1140 #define RTW_ISSET(regs, reg, mask) \
1141 (RTW_READ((regs), (reg)) & (mask))
1142
1143 #define RTW_CLR(regs, reg, mask) \
1144 RTW_WRITE((regs), (reg), RTW_READ((regs), (reg)) & ~(mask))
1145
1146
1147 #ifndef BUS_SPACE_BARRIER_SYNC
1148 #define BUS_SPACE_BARRIER_SYNC (BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE)
1149 #endif
1150
1151 #ifndef BUS_SPACE_BARRIER_READ_BEFORE_READ
1152 #define BUS_SPACE_BARRIER_READ_BEFORE_READ BUS_SPACE_BARRIER_READ
1153 #endif
1154
1155 #ifndef BUS_SPACE_BARRIER_READ_BEFORE_WRITE
1156 #define BUS_SPACE_BARRIER_READ_BEFORE_WRITE BUS_SPACE_BARRIER_READ
1157 #endif
1158
1159 #ifndef BUS_SPACE_BARRIER_WRITE_BEFORE_READ
1160 #define BUS_SPACE_BARRIER_WRITE_BEFORE_READ BUS_SPACE_BARRIER_WRITE
1161 #endif
1162
1163 #ifndef BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE
1164 #define BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE BUS_SPACE_BARRIER_WRITE
1165 #endif
1166
1167
1168
1169
1170
1171
1172
1173
1174 #define RTW_BARRIER(regs, reg0, reg1, flags) \
1175 ((*(regs)->r_barrier)(regs, reg0, reg1, flags))
1176
1177
1178
1179
1180
1181 #define RTW_SYNC(regs, reg0, reg1) \
1182 RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_SYNC)
1183
1184
1185 #define RTW_WBW(regs, reg0, reg1) \
1186 RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE)
1187
1188
1189 #define RTW_WBR(regs, reg0, reg1) \
1190 RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_READ)
1191
1192
1193 #define RTW_RBR(regs, reg0, reg1) \
1194 RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_READ)
1195
1196
1197 #define RTW_RBW(regs, reg0, reg1) \
1198 RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_WRITE)
1199
1200 #define RTW_WBRW(regs, reg0, reg1) \
1201 RTW_BARRIER(regs, reg0, reg1, \
1202 BUS_SPACE_BARRIER_WRITE_BEFORE_READ | \
1203 BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE)
1204
1205
1206
1207
1208 #define RTW_BBP_SYS1 0x00
1209 #define RTW_BBP_TXAGC 0x03
1210 #define RTW_BBP_LNADET 0x04
1211
1212
1213 #define RTW_BBP_IFAGCINI 0x05
1214
1215
1216 #define RTW_BBP_IFAGCLIMIT 0x06
1217 #define RTW_BBP_IFAGCDET 0x07
1218
1219
1220
1221 #define RTW_BBP_ANTATTEN 0x10
1222 #define RTW_BBP_ANTATTEN_PHILIPS_MAGIC 0x91
1223 #define RTW_BBP_ANTATTEN_INTERSIL_MAGIC 0x92
1224 #define RTW_BBP_ANTATTEN_RFMD_MAGIC 0x93
1225 #define RTW_BBP_ANTATTEN_GCT_MAGIC 0xa3
1226 #define RTW_BBP_ANTATTEN_MAXIM_MAGIC 0xb3
1227 #define RTW_BBP_ANTATTEN_DFLANTB 0x40
1228 #define RTW_BBP_ANTATTEN_CHAN14 0x0c
1229
1230 #define RTW_BBP_TRL 0x11
1231
1232
1233 #define RTW_BBP_SYS2 0x12
1234 #define RTW_BBP_SYS2_ANTDIV 0x80
1235 #define RTW_BBP_SYS2_RATE_MASK BITS(5,4)
1236
1237
1238
1239
1240
1241 #define RTW_BBP_SYS3 0x13
1242
1243 #define RTW_BBP_SYS3_CSTHRESH_MASK BITS(0,3)
1244 #define RTW_BBP_CHESTLIM 0x19
1245
1246
1247 #define RTW_BBP_CHSQLIM 0x1a
1248
1249