1a72f7ea6Sql147931 /* 2*9aa73b68SQin Michael Li * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 3a72f7ea6Sql147931 * Use is subject to license terms. 4a72f7ea6Sql147931 */ 5a72f7ea6Sql147931 /* 6a72f7ea6Sql147931 * Copyright (c) 2004, 2005 David Young. All rights reserved. 7a72f7ea6Sql147931 * 8a72f7ea6Sql147931 * Programmed for NetBSD by David Young. 9a72f7ea6Sql147931 * 10a72f7ea6Sql147931 * Redistribution and use in source and binary forms, with or without 11a72f7ea6Sql147931 * modification, are permitted provided that the following conditions 12a72f7ea6Sql147931 * are met: 13a72f7ea6Sql147931 * 1. Redistributions of source code must retain the above copyright 14a72f7ea6Sql147931 * notice, this list of conditions and the following disclaimer. 15a72f7ea6Sql147931 * 2. Redistributions in binary form must reproduce the above copyright 16a72f7ea6Sql147931 * notice, this list of conditions and the following disclaimer in the 17a72f7ea6Sql147931 * documentation and/or other materials provided with the distribution. 18a72f7ea6Sql147931 * 3. The name of David Young may not be used to endorse or promote 19a72f7ea6Sql147931 * products derived from this software without specific prior 20a72f7ea6Sql147931 * written permission. 21a72f7ea6Sql147931 * 22a72f7ea6Sql147931 * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY 23a72f7ea6Sql147931 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24a72f7ea6Sql147931 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25a72f7ea6Sql147931 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David 26a72f7ea6Sql147931 * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27a72f7ea6Sql147931 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28a72f7ea6Sql147931 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29a72f7ea6Sql147931 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30a72f7ea6Sql147931 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 31a72f7ea6Sql147931 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32a72f7ea6Sql147931 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33a72f7ea6Sql147931 * OF SUCH DAMAGE. 34a72f7ea6Sql147931 */ 35a72f7ea6Sql147931 /* Macros for bit twiddling. */ 36a72f7ea6Sql147931 37a72f7ea6Sql147931 #ifndef _RTW_REG_H_ 38a72f7ea6Sql147931 #define _RTW_REG_H_ 39a72f7ea6Sql147931 40*9aa73b68SQin Michael Li #ifdef __cplusplus 41*9aa73b68SQin Michael Li extern "C" { 42*9aa73b68SQin Michael Li #endif 43*9aa73b68SQin Michael Li 44a72f7ea6Sql147931 #ifndef _BIT_TWIDDLE 45a72f7ea6Sql147931 #define _BIT_TWIDDLE 46a72f7ea6Sql147931 /* 47a72f7ea6Sql147931 * nth bit, BIT(0) == 0x1. 48a72f7ea6Sql147931 */ 49a72f7ea6Sql147931 #define BIT(n) (((n) == 32) ? 0 : ((uint32_t)1 << (n))) 50a72f7ea6Sql147931 51a72f7ea6Sql147931 /* 52a72f7ea6Sql147931 * bits m through n, m < n. 53a72f7ea6Sql147931 */ 54a72f7ea6Sql147931 #define BITS(m, n) ((BIT(MAX((m), (n)) + 1) - 1) ^ (BIT(MIN((m), (n))) - 1)) 55a72f7ea6Sql147931 56a72f7ea6Sql147931 /* 57a72f7ea6Sql147931 * find least significant bit that is set 58a72f7ea6Sql147931 */ 59a72f7ea6Sql147931 #define LOWEST_SET_BIT(x) ((((x) - 1) & (x)) ^ (x)) 60a72f7ea6Sql147931 61a72f7ea6Sql147931 /* 62a72f7ea6Sql147931 * for x a power of two and p a non-negative integer, is x a greater 63a72f7ea6Sql147931 * power than 2**p? 64a72f7ea6Sql147931 */ 65a72f7ea6Sql147931 #define GTEQ_POWER(x, p) (((ulong_t)(x) >> (p)) != 0) 66a72f7ea6Sql147931 67a72f7ea6Sql147931 #define MASK_TO_SHIFT2(m) (GTEQ_POWER(LOWEST_SET_BIT((m)), 1) ? 1 : 0) 68a72f7ea6Sql147931 69a72f7ea6Sql147931 #define MASK_TO_SHIFT4(m) \ 70a72f7ea6Sql147931 (GTEQ_POWER(LOWEST_SET_BIT((m)), 2) \ 71a72f7ea6Sql147931 ? 2 + MASK_TO_SHIFT2((m) >> 2) \ 72a72f7ea6Sql147931 : MASK_TO_SHIFT2((m))) 73a72f7ea6Sql147931 74a72f7ea6Sql147931 #define MASK_TO_SHIFT8(m) \ 75a72f7ea6Sql147931 (GTEQ_POWER(LOWEST_SET_BIT((m)), 4) \ 76a72f7ea6Sql147931 ? 4 + MASK_TO_SHIFT4((m) >> 4) \ 77a72f7ea6Sql147931 : MASK_TO_SHIFT4((m))) 78a72f7ea6Sql147931 79a72f7ea6Sql147931 #define MASK_TO_SHIFT16(m) \ 80a72f7ea6Sql147931 (GTEQ_POWER(LOWEST_SET_BIT((m)), 8) \ 81a72f7ea6Sql147931 ? 8 + MASK_TO_SHIFT8((m) >> 8) \ 82a72f7ea6Sql147931 : MASK_TO_SHIFT8((m))) 83a72f7ea6Sql147931 84a72f7ea6Sql147931 #define MASK_TO_SHIFT(m) \ 85a72f7ea6Sql147931 (GTEQ_POWER(LOWEST_SET_BIT((m)), 16) \ 86a72f7ea6Sql147931 ? 16 + MASK_TO_SHIFT16((m) >> 16) \ 87a72f7ea6Sql147931 : MASK_TO_SHIFT16((m))) 88a72f7ea6Sql147931 89a72f7ea6Sql147931 #define MASK_AND_RSHIFT(x, mask) (((x) & (mask)) >> MASK_TO_SHIFT(mask)) 90a72f7ea6Sql147931 #define LSHIFT(x, mask) ((x) << MASK_TO_SHIFT(mask)) 91a72f7ea6Sql147931 #define MASK_AND_REPLACE(reg, val, mask) ((reg & ~mask) | LSHIFT(val, mask)) 92a72f7ea6Sql147931 #define PRESHIFT(m) MASK_AND_RSHIFT((m), (m)) 93a72f7ea6Sql147931 94a72f7ea6Sql147931 #endif /* _BIT_TWIDDLE */ 95a72f7ea6Sql147931 96a72f7ea6Sql147931 /* RTL8180L Host Control and Status Registers */ 97a72f7ea6Sql147931 98a72f7ea6Sql147931 /* 99a72f7ea6Sql147931 * ID Register: MAC addr, 6 bytes. 100a72f7ea6Sql147931 * Auto-loaded from EEPROM. Read by byte, by word, or by double word, 101a72f7ea6Sql147931 * but write only by double word. 102a72f7ea6Sql147931 */ 103a72f7ea6Sql147931 #define RTW_IDR0 0x00 104a72f7ea6Sql147931 #define RTW_IDR1 0x04 105a72f7ea6Sql147931 106a72f7ea6Sql147931 #define RTW_MAR0 0x08 /* Multicast filter, 64b. */ 107a72f7ea6Sql147931 #define RTW_MAR1 0x0c 108a72f7ea6Sql147931 109a72f7ea6Sql147931 /* 110a72f7ea6Sql147931 * Timing Synchronization Function Timer Register, 111a72f7ea6Sql147931 * low word, 32b, read-only. 112a72f7ea6Sql147931 */ 113a72f7ea6Sql147931 #define RTW_TSFTRL 0x18 114a72f7ea6Sql147931 #define RTW_TSFTRH 0x1c /* High word, 32b, read-only. */ 115a72f7ea6Sql147931 /* 116a72f7ea6Sql147931 * Transmit Low Priority Descriptors Start Address, 117a72f7ea6Sql147931 * 32b, 256-byte alignment. 118a72f7ea6Sql147931 */ 119a72f7ea6Sql147931 #define RTW_TLPDA 0x20 120a72f7ea6Sql147931 /* 121a72f7ea6Sql147931 * Transmit Normal Priority Descriptors Start Address, 122a72f7ea6Sql147931 * 32b, 256-byte alignment. 123a72f7ea6Sql147931 */ 124a72f7ea6Sql147931 #define RTW_TNPDA 0x24 125a72f7ea6Sql147931 /* 126a72f7ea6Sql147931 * Transmit High Priority Descriptors Start Address, 127a72f7ea6Sql147931 * 32b, 256-byte alignment. 128a72f7ea6Sql147931 */ 129a72f7ea6Sql147931 #define RTW_THPDA 0x28 130a72f7ea6Sql147931 131a72f7ea6Sql147931 #define RTW_BRSR 0x2c /* Basic Rate Set Register, 16b */ 132a72f7ea6Sql147931 /* 133a72f7ea6Sql147931 * 1: use short PLCP header for CTS/ACK packet, 134a72f7ea6Sql147931 * 0: use long PLCP header 135a72f7ea6Sql147931 */ 136a72f7ea6Sql147931 #define RTW_BRSR_BPLCP BIT(8) 137a72f7ea6Sql147931 #define RTW_BRSR_MBR8180_MASK BITS(1, 0) /* Maximum Basic Service Rate */ 138a72f7ea6Sql147931 #define RTW_BRSR_MBR8180_1MBPS LSHIFT(0, RTW_BRSR_MBR8180_MASK) 139a72f7ea6Sql147931 #define RTW_BRSR_MBR8180_2MBPS LSHIFT(1, RTW_BRSR_MBR8180_MASK) 140a72f7ea6Sql147931 #define RTW_BRSR_MBR8180_5MBPS LSHIFT(2, RTW_BRSR_MBR8180_MASK) 141a72f7ea6Sql147931 #define RTW_BRSR_MBR8180_11MBPS LSHIFT(3, RTW_BRSR_MBR8180_MASK) 142a72f7ea6Sql147931 143a72f7ea6Sql147931 /* 144a72f7ea6Sql147931 * 8181 and 8180 docs conflict! 145a72f7ea6Sql147931 */ 146a72f7ea6Sql147931 #define RTW_BRSR_MBR8181_1MBPS BIT(0) 147a72f7ea6Sql147931 #define RTW_BRSR_MBR8181_2MBPS BIT(1) 148a72f7ea6Sql147931 #define RTW_BRSR_MBR8181_5MBPS BIT(2) 149a72f7ea6Sql147931 #define RTW_BRSR_MBR8181_11MBPS BIT(3) 150a72f7ea6Sql147931 151a72f7ea6Sql147931 #define RTW_BSSID 0x2e 152a72f7ea6Sql147931 /* 153a72f7ea6Sql147931 * BSSID, 6 bytes 154a72f7ea6Sql147931 */ 155a72f7ea6Sql147931 #define RTW_BSSID16 0x2e /* first two bytes */ 156a72f7ea6Sql147931 #define RTW_BSSID32 (0x2e + 4) /* remaining four bytes */ 157a72f7ea6Sql147931 #define RTW_BSSID0 RTW_BSSID16 /* BSSID[0], 8b */ 158a72f7ea6Sql147931 #define RTW_BSSID1 (RTW_BSSID0 + 1) /* BSSID[1], 8b */ 159a72f7ea6Sql147931 #define RTW_BSSID2 (RTW_BSSID1 + 1) /* BSSID[2], 8b */ 160a72f7ea6Sql147931 #define RTW_BSSID3 (RTW_BSSID2 + 1) /* BSSID[3], 8b */ 161a72f7ea6Sql147931 #define RTW_BSSID4 (RTW_BSSID3 + 1) /* BSSID[4], 8b */ 162a72f7ea6Sql147931 #define RTW_BSSID5 (RTW_BSSID4 + 1) /* BSSID[5], 8b */ 163a72f7ea6Sql147931 164a72f7ea6Sql147931 #define RTW_CR 0x37 /* Command Register, 8b */ 165a72f7ea6Sql147931 /* 166a72f7ea6Sql147931 * Reset: host sets to 1 to disable 167a72f7ea6Sql147931 * transmitter & receiver, reinitialize FIFO. 168a72f7ea6Sql147931 * RTL8180L sets to 0 to signal completion. 169a72f7ea6Sql147931 */ 170a72f7ea6Sql147931 #define RTW_CR_RST BIT(4) 171a72f7ea6Sql147931 /* 172a72f7ea6Sql147931 * Receiver Enable: host enables receiver 173a72f7ea6Sql147931 * by writing 1. RTL8180L indicates receiver 174a72f7ea6Sql147931 * is active with 1. After power-up, host 175a72f7ea6Sql147931 * must wait for reset before writing. 176a72f7ea6Sql147931 */ 177a72f7ea6Sql147931 #define RTW_CR_RE BIT(3) 178a72f7ea6Sql147931 /* 179a72f7ea6Sql147931 * Transmitter Enable: host enables transmitter 180a72f7ea6Sql147931 * by writing 1. RTL8180L indicates transmitter 181a72f7ea6Sql147931 * is active with 1. After power-up, host 182a72f7ea6Sql147931 * must wait for reset before writing. 183a72f7ea6Sql147931 */ 184a72f7ea6Sql147931 #define RTW_CR_TE BIT(2) 185a72f7ea6Sql147931 /* 186a72f7ea6Sql147931 * PCI Multiple Read/Write enable: 187a72f7ea6Sql147931 * 1 enables, 188a72f7ea6Sql147931 * 0 disables. XXX RTL8180, only? 189a72f7ea6Sql147931 */ 190a72f7ea6Sql147931 #define RTW_CR_MULRW BIT(0) 191a72f7ea6Sql147931 192a72f7ea6Sql147931 #define RTW_IMR 0x3c /* Interrupt Mask Register, 16b */ 193a72f7ea6Sql147931 #define RTW_ISR 0x3e /* Interrupt status register, 16b */ 194a72f7ea6Sql147931 195a72f7ea6Sql147931 #define RTW_INTR_TXFOVW BIT(15) /* Tx FIFO Overflow */ 196a72f7ea6Sql147931 /* 197a72f7ea6Sql147931 * Time Out: 1 indicates RTW_TSFTR[0:31] = RTW_TINT 198a72f7ea6Sql147931 */ 199a72f7ea6Sql147931 #define RTW_INTR_TIMEOUT BIT(14) 200a72f7ea6Sql147931 /* 201a72f7ea6Sql147931 * Beacon Time Out: time for host to prepare beacon: 202a72f7ea6Sql147931 * RTW_TSFTR % (RTW_BCNITV_BCNITV * TU) = 203a72f7ea6Sql147931 * (RTW_BCNITV_BCNITV * TU - RTW_BINTRITV) 204a72f7ea6Sql147931 */ 205a72f7ea6Sql147931 #define RTW_INTR_BCNINT BIT(13) 206a72f7ea6Sql147931 /* 207a72f7ea6Sql147931 * ATIM Time Out: ATIM interval will pass, 208a72f7ea6Sql147931 * RTW_TSFTR % (RTW_BCNITV_BCNITV * TU) = 209a72f7ea6Sql147931 * (RTW_ATIMWND_ATIMWND * TU - RTW_ATIMTRITV) 210a72f7ea6Sql147931 */ 211a72f7ea6Sql147931 #define RTW_INTR_ATIMINT BIT(12) 212a72f7ea6Sql147931 /* 213a72f7ea6Sql147931 * Tx Beacon Descriptor Error: 214a72f7ea6Sql147931 * beacon transmission aborted because 215a72f7ea6Sql147931 * frame Rx'd 216a72f7ea6Sql147931 */ 217a72f7ea6Sql147931 #define RTW_INTR_TBDER BIT(11) 218a72f7ea6Sql147931 #define RTW_INTR_TBDOK BIT(10) /* Tx Beacon Descriptor OK */ 219a72f7ea6Sql147931 /* 220a72f7ea6Sql147931 * Tx High Priority Descriptor Error: 221a72f7ea6Sql147931 * reached short/long retry limit 222a72f7ea6Sql147931 */ 223a72f7ea6Sql147931 #define RTW_INTR_THPDER BIT(9) 224a72f7ea6Sql147931 #define RTW_INTR_THPDOK BIT(8) /* Tx High Priority Descriptor OK */ 225a72f7ea6Sql147931 /* 226a72f7ea6Sql147931 * Tx Normal Priority Descriptor Error: 227a72f7ea6Sql147931 * reached short/long retry limit 228a72f7ea6Sql147931 */ 229a72f7ea6Sql147931 #define RTW_INTR_TNPDER BIT(7) 230a72f7ea6Sql147931 #define RTW_INTR_TNPDOK BIT(6) /* Tx Normal Priority Descriptor OK */ 231a72f7ea6Sql147931 /* 232a72f7ea6Sql147931 * Rx FIFO Overflow: either RDU (see below) 233a72f7ea6Sql147931 * or PCI bus too slow/busy 234a72f7ea6Sql147931 */ 235a72f7ea6Sql147931 #define RTW_INTR_RXFOVW BIT(5) 236a72f7ea6Sql147931 #define RTW_INTR_RDU BIT(4) /* Rx Descriptor Unavailable */ 237a72f7ea6Sql147931 /* 238a72f7ea6Sql147931 * Tx Low Priority Descriptor Error 239a72f7ea6Sql147931 * reached short/long retry limit 240a72f7ea6Sql147931 */ 241a72f7ea6Sql147931 #define RTW_INTR_TLPDER BIT(3) 242a72f7ea6Sql147931 #define RTW_INTR_TLPDOK BIT(2) /* Tx Low Priority Descriptor OK */ 243a72f7ea6Sql147931 #define RTW_INTR_RER BIT(1) /* Rx Error: CRC32 or ICV error */ 244a72f7ea6Sql147931 #define RTW_INTR_ROK BIT(0) /* Rx OK */ 245a72f7ea6Sql147931 246a72f7ea6Sql147931 /* 247a72f7ea6Sql147931 * Convenient interrupt conjunctions. 248a72f7ea6Sql147931 */ 249a72f7ea6Sql147931 #define RTW_INTR_RX (RTW_INTR_RER|RTW_INTR_ROK | \ 250a72f7ea6Sql147931 RTW_INTR_RDU |RTW_INTR_RXFOVW) 251a72f7ea6Sql147931 #define RTW_INTR_TX (RTW_INTR_TLPDER|RTW_INTR_TLPDOK|RTW_INTR_THPDER|\ 252a72f7ea6Sql147931 RTW_INTR_THPDOK|RTW_INTR_TNPDER|RTW_INTR_TNPDOK|\ 253a72f7ea6Sql147931 RTW_INTR_TBDER|RTW_INTR_TBDOK) 254a72f7ea6Sql147931 #define RTW_INTR_BEACON (RTW_INTR_BCNINT) 255a72f7ea6Sql147931 #define RTW_INTR_IOERROR (RTW_INTR_TXFOVW|RTW_INTR_RXFOVW|RTW_INTR_RDU) 256a72f7ea6Sql147931 257a72f7ea6Sql147931 #define RTW_TCR 0x40 /* Transmit Configuration Register, 32b */ 258a72f7ea6Sql147931 #define RTW_TCR_CWMIN BIT(31) /* 1: CWmin = 8, 0: CWmin = 32. */ 259a72f7ea6Sql147931 /* 260a72f7ea6Sql147931 * 1: host assigns 802.11 sequence number, 261a72f7ea6Sql147931 * 0: hardware assigns sequence number 262a72f7ea6Sql147931 */ 263a72f7ea6Sql147931 #define RTW_TCR_SWSEQ BIT(30) 264a72f7ea6Sql147931 /* Hardware version ID, read-only */ 265a72f7ea6Sql147931 #define RTW_TCR_HWVERID_MASK BITS(29, 25) 266a72f7ea6Sql147931 #define RTW_TCR_HWVERID_D LSHIFT(26, RTW_TCR_HWVERID_MASK) 267a72f7ea6Sql147931 #define RTW_TCR_HWVERID_F LSHIFT(27, RTW_TCR_HWVERID_MASK) 268a72f7ea6Sql147931 #define RTW_TCR_HWVERID_RTL8180 RTW_TCR_HWVERID_F 269a72f7ea6Sql147931 270a72f7ea6Sql147931 /* 271a72f7ea6Sql147931 * Set ACK/CTS Timeout (EIFS). 272a72f7ea6Sql147931 * 1: ACK rate = max(RTW_BRSR_MBR, Rx rate) (XXX not min? typo in datasheet?) 273a72f7ea6Sql147931 * 0: ACK rate = 1Mbps 274a72f7ea6Sql147931 */ 275a72f7ea6Sql147931 #define RTW_TCR_SAT BIT(24) 276a72f7ea6Sql147931 /* Max DMA Burst Size per Tx DMA Burst */ 277a72f7ea6Sql147931 #define RTW_TCR_MXDMA_MASK BITS(23, 21) 278a72f7ea6Sql147931 #define RTW_TCR_MXDMA_16 LSHIFT(0, RTW_TCR_MXDMA_MASK) 279a72f7ea6Sql147931 #define RTW_TCR_MXDMA_32 LSHIFT(1, RTW_TCR_MXDMA_MASK) 280a72f7ea6Sql147931 #define RTW_TCR_MXDMA_64 LSHIFT(2, RTW_TCR_MXDMA_MASK) 281a72f7ea6Sql147931 #define RTW_TCR_MXDMA_128 LSHIFT(3, RTW_TCR_MXDMA_MASK) 282a72f7ea6Sql147931 #define RTW_TCR_MXDMA_256 LSHIFT(4, RTW_TCR_MXDMA_MASK) 283a72f7ea6Sql147931 #define RTW_TCR_MXDMA_512 LSHIFT(5, RTW_TCR_MXDMA_MASK) 284a72f7ea6Sql147931 #define RTW_TCR_MXDMA_1024 LSHIFT(6, RTW_TCR_MXDMA_MASK) 285a72f7ea6Sql147931 #define RTW_TCR_MXDMA_2048 LSHIFT(7, RTW_TCR_MXDMA_MASK) 286a72f7ea6Sql147931 287a72f7ea6Sql147931 #define RTW_TCR_DISCW BIT(20) /* disable 802.11 random backoff */ 288a72f7ea6Sql147931 289a72f7ea6Sql147931 /* 290a72f7ea6Sql147931 * host lets RTL8180 append ICV to WEP packets 291a72f7ea6Sql147931 */ 292a72f7ea6Sql147931 #define RTW_TCR_ICV BIT(19) 293a72f7ea6Sql147931 294a72f7ea6Sql147931 /* 295a72f7ea6Sql147931 * Loopback Test: disables TXI/TXQ outputs. 296a72f7ea6Sql147931 */ 297a72f7ea6Sql147931 #define RTW_TCR_LBK_MASK BITS(18, 17) 298a72f7ea6Sql147931 #define RTW_TCR_LBK_NORMAL LSHIFT(0, RTW_TCR_LBK_MASK) /* normal ops */ 299a72f7ea6Sql147931 #define RTW_TCR_LBK_MAC LSHIFT(1, RTW_TCR_LBK_MASK) /* MAC loopback */ 300a72f7ea6Sql147931 #define RTW_TCR_LBK_BBP LSHIFT(2, RTW_TCR_LBK_MASK) /* baseband loop. */ 301a72f7ea6Sql147931 #define RTW_TCR_LBK_CONT LSHIFT(3, RTW_TCR_LBK_MASK) /* continuous Tx */ 302a72f7ea6Sql147931 303a72f7ea6Sql147931 /* 304a72f7ea6Sql147931 * 0: RTL8180 appends CRC32 305a72f7ea6Sql147931 * 1: host appends CRC32 306a72f7ea6Sql147931 * 307a72f7ea6Sql147931 * (I *think* this is right. The docs have a mysterious 308a72f7ea6Sql147931 * description in the passive voice.) 309a72f7ea6Sql147931 */ 310a72f7ea6Sql147931 #define RTW_TCR_CRC BIT(16) 311a72f7ea6Sql147931 #define RTW_TCR_SRL_MASK BITS(15, 8) /* Short Retry Limit */ 312a72f7ea6Sql147931 #define RTW_TCR_LRL_MASK BITS(7, 0) /* Long Retry Limit */ 313a72f7ea6Sql147931 314a72f7ea6Sql147931 #define RTW_RCR 0x44 /* Receive Configuration Register, 32b */ 315a72f7ea6Sql147931 /* 316a72f7ea6Sql147931 * only do Early Rx on packets longer than 1536 bytes 317a72f7ea6Sql147931 */ 318a72f7ea6Sql147931 #define RTW_RCR_ONLYERLPKT BIT(31) 319a72f7ea6Sql147931 #define RTW_RCR_ENCS2 BIT(30) /* enable carrier sense method 2 */ 320a72f7ea6Sql147931 #define RTW_RCR_ENCS1 BIT(29) /* enable carrier sense method 1 */ 321a72f7ea6Sql147931 #define RTW_RCR_ENMARP BIT(28) /* enable MAC auto-reset PHY */ 322a72f7ea6Sql147931 /* 323a72f7ea6Sql147931 * Check BSSID/ToDS/FromDS: set "Link On" when received BSSID 324a72f7ea6Sql147931 * matches RTW_BSSID and received ToDS/FromDS are appropriate 325a72f7ea6Sql147931 * according to RTW_MSR_NETYPE. 326a72f7ea6Sql147931 */ 327a72f7ea6Sql147931 #define RTW_RCR_CBSSID BIT(23) 328a72f7ea6Sql147931 #define RTW_RCR_APWRMGT BIT(22) /* accept packets w/ PWRMGMT bit set */ 329a72f7ea6Sql147931 /* 330a72f7ea6Sql147931 * when RTW_MSR_NETYPE == RTW_MSR_NETYPE_INFRA_OK, accept 331a72f7ea6Sql147931 * broadcast/multicast packets whose 3rd address matches RTL8180's MAC. 332a72f7ea6Sql147931 */ 333a72f7ea6Sql147931 #define RTW_RCR_ADD3 BIT(21) 334a72f7ea6Sql147931 #define RTW_RCR_AMF BIT(20) /* accept management frames */ 335a72f7ea6Sql147931 #define RTW_RCR_ACF BIT(19) /* accept control frames */ 336a72f7ea6Sql147931 #define RTW_RCR_ADF BIT(18) /* accept data frames */ 337a72f7ea6Sql147931 /* 338a72f7ea6Sql147931 * Rx FIFO Threshold: RTL8180 begins PCI transfer when this many data 339a72f7ea6Sql147931 * bytes are received 340a72f7ea6Sql147931 */ 341a72f7ea6Sql147931 #define RTW_RCR_RXFTH_MASK BITS(15, 13) 342a72f7ea6Sql147931 #define RTW_RCR_RXFTH_64 LSHIFT(2, RTW_RCR_RXFTH_MASK) 343a72f7ea6Sql147931 #define RTW_RCR_RXFTH_128 LSHIFT(3, RTW_RCR_RXFTH_MASK) 344a72f7ea6Sql147931 #define RTW_RCR_RXFTH_256 LSHIFT(4, RTW_RCR_RXFTH_MASK) 345a72f7ea6Sql147931 #define RTW_RCR_RXFTH_512 LSHIFT(5, RTW_RCR_RXFTH_MASK) 346a72f7ea6Sql147931 #define RTW_RCR_RXFTH_1024 LSHIFT(6, RTW_RCR_RXFTH_MASK) 347a72f7ea6Sql147931 #define RTW_RCR_RXFTH_WHOLE LSHIFT(7, RTW_RCR_RXFTH_MASK) 348a72f7ea6Sql147931 349a72f7ea6Sql147931 #define RTW_RCR_AICV BIT(12) /* accept frames w/ ICV errors */ 350a72f7ea6Sql147931 351a72f7ea6Sql147931 /* 352a72f7ea6Sql147931 * Max DMA Burst Size per Rx DMA Burst 353a72f7ea6Sql147931 */ 354a72f7ea6Sql147931 #define RTW_RCR_MXDMA_MASK BITS(10, 8) 355a72f7ea6Sql147931 #define RTW_RCR_MXDMA_16 LSHIFT(0, RTW_RCR_MXDMA_MASK) 356a72f7ea6Sql147931 #define RTW_RCR_MXDMA_32 LSHIFT(1, RTW_RCR_MXDMA_MASK) 357a72f7ea6Sql147931 #define RTW_RCR_MXDMA_64 LSHIFT(2, RTW_RCR_MXDMA_MASK) 358a72f7ea6Sql147931 #define RTW_RCR_MXDMA_128 LSHIFT(3, RTW_RCR_MXDMA_MASK) 359a72f7ea6Sql147931 #define RTW_RCR_MXDMA_256 LSHIFT(4, RTW_RCR_MXDMA_MASK) 360a72f7ea6Sql147931 #define RTW_RCR_MXDMA_512 LSHIFT(5, RTW_RCR_MXDMA_MASK) 361a72f7ea6Sql147931 #define RTW_RCR_MXDMA_1024 LSHIFT(6, RTW_RCR_MXDMA_MASK) 362a72f7ea6Sql147931 #define RTW_RCR_MXDMA_UNLIMITED LSHIFT(7, RTW_RCR_MXDMA_MASK) 363a72f7ea6Sql147931 364a72f7ea6Sql147931 /* 365a72f7ea6Sql147931 * EEPROM type, read-only. 1: EEPROM is 93c56, 0: 93c46 366a72f7ea6Sql147931 */ 367a72f7ea6Sql147931 #define RTW_RCR_9356SEL BIT(6) 368a72f7ea6Sql147931 369a72f7ea6Sql147931 #define RTW_RCR_ACRC32 BIT(5) /* accept frames w/ CRC32 errors */ 370a72f7ea6Sql147931 #define RTW_RCR_AB BIT(3) /* accept broadcast frames */ 371a72f7ea6Sql147931 #define RTW_RCR_AM BIT(2) /* accept multicast frames */ 372a72f7ea6Sql147931 /* 373a72f7ea6Sql147931 * accept physical match frames. XXX means PLCP header ok? 374a72f7ea6Sql147931 */ 375a72f7ea6Sql147931 #define RTW_RCR_APM BIT(1) 376a72f7ea6Sql147931 #define RTW_RCR_AAP BIT(0) /* accept frames w/ destination */ 377a72f7ea6Sql147931 378a72f7ea6Sql147931 /* 379a72f7ea6Sql147931 * Additional bits to set in monitor mode. 380a72f7ea6Sql147931 */ 381a72f7ea6Sql147931 #define RTW_RCR_MONITOR ( \ 382a72f7ea6Sql147931 RTW_RCR_AAP | \ 383a72f7ea6Sql147931 RTW_RCR_ACF | \ 384a72f7ea6Sql147931 RTW_RCR_ACRC32 | \ 385a72f7ea6Sql147931 RTW_RCR_AICV | \ 386a72f7ea6Sql147931 0) 387a72f7ea6Sql147931 388a72f7ea6Sql147931 /* 389a72f7ea6Sql147931 * The packet filter bits. 390a72f7ea6Sql147931 */ 391a72f7ea6Sql147931 #define RTW_RCR_PKTFILTER_MASK (\ 392a72f7ea6Sql147931 RTW_RCR_ENCS1|RTW_RCR_ENCS2|\ 393a72f7ea6Sql147931 RTW_RCR_AAP | \ 394a72f7ea6Sql147931 RTW_RCR_AB | \ 395a72f7ea6Sql147931 RTW_RCR_ACF | \ 396a72f7ea6Sql147931 RTW_RCR_ACRC32 | \ 397a72f7ea6Sql147931 RTW_RCR_ADD3 | \ 398a72f7ea6Sql147931 RTW_RCR_ADF | \ 399a72f7ea6Sql147931 RTW_RCR_AICV | \ 400a72f7ea6Sql147931 RTW_RCR_AM | \ 401a72f7ea6Sql147931 RTW_RCR_AMF | \ 402a72f7ea6Sql147931 RTW_RCR_APM | \ 403a72f7ea6Sql147931 RTW_RCR_APWRMGT | \ 404a72f7ea6Sql147931 0) 405a72f7ea6Sql147931 406a72f7ea6Sql147931 /* 407a72f7ea6Sql147931 * Receive power-management frames and mgmt/ctrl/data frames. 408a72f7ea6Sql147931 */ 409a72f7ea6Sql147931 #define RTW_RCR_PKTFILTER_DEFAULT ( \ 410a72f7ea6Sql147931 RTW_RCR_ONLYERLPKT | \ 411a72f7ea6Sql147931 RTW_RCR_ENCS1 | \ 412a72f7ea6Sql147931 RTW_RCR_CBSSID | \ 413a72f7ea6Sql147931 RTW_RCR_ADF | \ 414a72f7ea6Sql147931 RTW_RCR_AMF | \ 415a72f7ea6Sql147931 RTW_RCR_APM | \ 416a72f7ea6Sql147931 RTW_RCR_AM | \ 417a72f7ea6Sql147931 RTW_RCR_AB | \ 418a72f7ea6Sql147931 0) 419a72f7ea6Sql147931 #define RTW_RCR_PROMIC ( \ 420a72f7ea6Sql147931 RTW_RCR_AAP | \ 421a72f7ea6Sql147931 0) 422a72f7ea6Sql147931 423a72f7ea6Sql147931 #define RTW_TINT 0x48 /* Timer Interrupt Register, 32b */ 424a72f7ea6Sql147931 /* 425a72f7ea6Sql147931 * Transmit Beacon Descriptor Start Address, 426a72f7ea6Sql147931 * 32b, 256-byte alignment 427a72f7ea6Sql147931 */ 428a72f7ea6Sql147931 #define RTW_TBDA 0x4c 429a72f7ea6Sql147931 #define RTW_9346CR 0x50 /* 93c46/93c56 Command Register, 8b */ 430a72f7ea6Sql147931 #define RTW_9346CR_EEM_MASK BITS(7, 6) /* Operating Mode */ 431a72f7ea6Sql147931 #define RTW_9346CR_EEM_NORMAL LSHIFT(0, RTW_9346CR_EEM_MASK) 432a72f7ea6Sql147931 /* 433a72f7ea6Sql147931 * Load the EEPROM. Reset registers to defaults. 434a72f7ea6Sql147931 * Takes ~2ms. RTL8180 indicates completion with RTW_9346CR_EEM_NORMAL. 435a72f7ea6Sql147931 * XXX RTL8180 only? 436a72f7ea6Sql147931 */ 437a72f7ea6Sql147931 #define RTW_9346CR_EEM_AUTOLOAD LSHIFT(1, RTW_9346CR_EEM_MASK) 438a72f7ea6Sql147931 /* 439a72f7ea6Sql147931 * Disable network & bus-master operations and enable 440a72f7ea6Sql147931 * _EECS, _EESK, _EEDI, _EEDO. 441a72f7ea6Sql147931 * XXX RTL8180 only? 442a72f7ea6Sql147931 */ 443a72f7ea6Sql147931 #define RTW_9346CR_EEM_PROGRAM LSHIFT(2, RTW_9346CR_EEM_MASK) 444a72f7ea6Sql147931 /* Enable RTW_CONFIG[0123] registers. */ 445a72f7ea6Sql147931 #define RTW_9346CR_EEM_CONFIG LSHIFT(3, RTW_9346CR_EEM_MASK) 446a72f7ea6Sql147931 /* 447a72f7ea6Sql147931 * EEPROM pin status/control in _EEM_CONFIG, _EEM_AUTOLOAD modes. 448a72f7ea6Sql147931 * XXX RTL8180 only? 449a72f7ea6Sql147931 */ 450a72f7ea6Sql147931 #define RTW_9346CR_EECS BIT(3) 451a72f7ea6Sql147931 #define RTW_9346CR_EESK BIT(2) 452a72f7ea6Sql147931 #define RTW_9346CR_EEDI BIT(1) 453a72f7ea6Sql147931 #define RTW_9346CR_EEDO BIT(0) /* read-only */ 454a72f7ea6Sql147931 455a72f7ea6Sql147931 #define RTW_CONFIG0 0x51 /* Configuration Register 0, 8b */ 456a72f7ea6Sql147931 /* 457a72f7ea6Sql147931 * implements 40-bit WEP, XXX RTL8180 only? 458a72f7ea6Sql147931 */ 459a72f7ea6Sql147931 #define RTW_CONFIG0_WEP40 BIT(7) 460a72f7ea6Sql147931 /* 461a72f7ea6Sql147931 * implements 104-bit WEP, from EEPROM, read-only XXX RTL8180 only? 462a72f7ea6Sql147931 */ 463a72f7ea6Sql147931 #define RTW_CONFIG0_WEP104 BIT(6) 464a72f7ea6Sql147931 /* 465a72f7ea6Sql147931 * 1: RTW_PSR_LEDGPO[01] control LED[01] pins. 466a72f7ea6Sql147931 * 0: LED behavior defined by RTW_CONFIG1_LEDS10_MASK 467a72f7ea6Sql147931 * XXX RTL8180 only? 468a72f7ea6Sql147931 */ 469a72f7ea6Sql147931 #define RTW_CONFIG0_LEDGPOEN BIT(4) 470a72f7ea6Sql147931 /* 471a72f7ea6Sql147931 * auxiliary power is present, read-only 472a72f7ea6Sql147931 */ 473a72f7ea6Sql147931 #define RTW_CONFIG0_AUXPWR BIT(3) 474a72f7ea6Sql147931 /* 475a72f7ea6Sql147931 * Geographic Location, read-only 476a72f7ea6Sql147931 */ 477a72f7ea6Sql147931 #define RTW_CONFIG0_GL_MASK BITS(1, 0) 478a72f7ea6Sql147931 /* 479a72f7ea6Sql147931 * _RTW_CONFIG0_GL_* is what the datasheet says, but RTW_CONFIG0_GL_* 480a72f7ea6Sql147931 * work. 481a72f7ea6Sql147931 */ 482a72f7ea6Sql147931 #define _RTW_CONFIG0_GL_USA LSHIFT(3, RTW_CONFIG0_GL_MASK) 483a72f7ea6Sql147931 #define RTW_CONFIG0_GL_EUROPE LSHIFT(2, RTW_CONFIG0_GL_MASK) 484a72f7ea6Sql147931 #define RTW_CONFIG0_GL_JAPAN LSHIFT(1, RTW_CONFIG0_GL_MASK) 485a72f7ea6Sql147931 #define RTW_CONFIG0_GL_USA LSHIFT(0, RTW_CONFIG0_GL_MASK) 486a72f7ea6Sql147931 /* 487a72f7ea6Sql147931 * RTL8181 datasheet says RTW_CONFIG0_GL_JAPAN = 0. 488a72f7ea6Sql147931 */ 489a72f7ea6Sql147931 490a72f7ea6Sql147931 #define RTW_CONFIG1 0x52 /* Configuration Register 1, 8b */ 491a72f7ea6Sql147931 492a72f7ea6Sql147931 /* 493a72f7ea6Sql147931 * LED configuration. From EEPROM. Read/write. 494a72f7ea6Sql147931 * 495a72f7ea6Sql147931 * Setting LED0 LED1 496a72f7ea6Sql147931 * ------- ---- ---- 497a72f7ea6Sql147931 * RTW_CONFIG1_LEDS_ACT_INFRA Activity Infrastructure 498a72f7ea6Sql147931 * RTW_CONFIG1_LEDS_ACT_LINK Activity Link 499a72f7ea6Sql147931 * RTW_CONFIG1_LEDS_TX_RX Tx Rx 500a72f7ea6Sql147931 * RTW_CONFIG1_LEDS_LINKACT_INFRA Link/Activity Infrastructure 501a72f7ea6Sql147931 */ 502a72f7ea6Sql147931 #define RTW_CONFIG1_LEDS_MASK BITS(7, 6) 503a72f7ea6Sql147931 #define RTW_CONFIG1_LEDS_ACT_INFRA LSHIFT(0, RTW_CONFIG1_LEDS_MASK) 504a72f7ea6Sql147931 #define RTW_CONFIG1_LEDS_ACT_LINK LSHIFT(1, RTW_CONFIG1_LEDS_MASK) 505a72f7ea6Sql147931 #define RTW_CONFIG1_LEDS_TX_RX LSHIFT(2, RTW_CONFIG1_LEDS_MASK) 506a72f7ea6Sql147931 #define RTW_CONFIG1_LEDS_LINKACT_INFRA LSHIFT(3, RTW_CONFIG1_LEDS_MASK) 507a72f7ea6Sql147931 508a72f7ea6Sql147931 /* 509a72f7ea6Sql147931 * LWAKE Output Signal. Only applicable to Cardbus. Pulse width is 150ms. 510a72f7ea6Sql147931 * 511a72f7ea6Sql147931 * RTW_CONFIG1_LWACT 512a72f7ea6Sql147931 * 0 1 513a72f7ea6Sql147931 * RTW_CONFIG4_LWPTN 0 active high active low 514a72f7ea6Sql147931 * 1 positive pulse negative pulse 515a72f7ea6Sql147931 */ 516a72f7ea6Sql147931 #define RTW_CONFIG1_LWACT BIT(4) 517a72f7ea6Sql147931 518a72f7ea6Sql147931 #define RTW_CONFIG1_MEMMAP BIT(3) /* using PCI memory space, read-only */ 519a72f7ea6Sql147931 #define RTW_CONFIG1_IOMAP BIT(2) /* using PCI I/O space, read-only */ 520a72f7ea6Sql147931 /* 521a72f7ea6Sql147931 * if set, VPD from offsets 0x40-0x7f in EEPROM are at 522a72f7ea6Sql147931 * registers 0x60-0x67 of PCI Configuration Space ( XXX huh? ) 523a72f7ea6Sql147931 */ 524a72f7ea6Sql147931 #define RTW_CONFIG1_VPD BIT(1) 525a72f7ea6Sql147931 #define RTW_CONFIG1_PMEN BIT(0) /* Power Management Enable: TBD */ 526a72f7ea6Sql147931 527a72f7ea6Sql147931 #define RTW_CONFIG2 0x53 /* Configuration Register 2, 8b */ 528a72f7ea6Sql147931 /* 529a72f7ea6Sql147931 * clocks are locked, read-only: 530a72f7ea6Sql147931 * Tx frequency & symbol clocks are derived from the same OSC 531a72f7ea6Sql147931 */ 532a72f7ea6Sql147931 #define RTW_CONFIG2_LCK BIT(7) 533a72f7ea6Sql147931 #define RTW_CONFIG2_ANT BIT(6) /* diversity enabled, read-only */ 534a72f7ea6Sql147931 /* 535a72f7ea6Sql147931 * Descriptor Polling State: enable test mode. 536a72f7ea6Sql147931 */ 537a72f7ea6Sql147931 #define RTW_CONFIG2_DPS BIT(3) 538a72f7ea6Sql147931 #define RTW_CONFIG2_PAPESIGN BIT(2) /* TBD, from EEPROM */ 539a72f7ea6Sql147931 #define RTW_CONFIG2_PAPETIME_MASK BITS(1, 0) /* TBD, from EEPROM */ 540a72f7ea6Sql147931 541a72f7ea6Sql147931 #define RTW_ANAPARM 0x54 /* Analog parameter, 32b */ 542a72f7ea6Sql147931 /* 543a72f7ea6Sql147931 * undocumented bits which appear to control the power state of the RF 544a72f7ea6Sql147931 * components 545a72f7ea6Sql147931 */ 546a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW0_MASK BITS(30, 28) 547a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_MASK \ 548a72f7ea6Sql147931 (RTW_ANAPARM_RFPOW0_MASK|RTW_ANAPARM_RFPOW1_MASK) 549a72f7ea6Sql147931 550a72f7ea6Sql147931 /* 551a72f7ea6Sql147931 * 1: disable Tx DAC, 552a72f7ea6Sql147931 * 0: enable 553a72f7ea6Sql147931 */ 554a72f7ea6Sql147931 #define RTW_ANAPARM_TXDACOFF BIT(27) 555a72f7ea6Sql147931 /* 556a72f7ea6Sql147931 * undocumented bits which appear to control the power state of the RF 557a72f7ea6Sql147931 * components 558a72f7ea6Sql147931 */ 559a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW1_MASK BITS(26, 20) 560a72f7ea6Sql147931 561a72f7ea6Sql147931 /* 562a72f7ea6Sql147931 * Maxim On/Sleep/Off control 563a72f7ea6Sql147931 */ 564a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_MAXIM_ON LSHIFT(0x8, RTW_ANAPARM_RFPOW1_MASK) 565a72f7ea6Sql147931 566a72f7ea6Sql147931 /* 567a72f7ea6Sql147931 * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF; 568a72f7ea6Sql147931 */ 569a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_MAXIM_SLEEP LSHIFT(0x378, RTW_ANAPARM_RFPOW1_MASK) 570a72f7ea6Sql147931 571a72f7ea6Sql147931 /* 572a72f7ea6Sql147931 * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF; 573a72f7ea6Sql147931 */ 574a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_MAXIM_OFF LSHIFT(0x379, RTW_ANAPARM_RFPOW1_MASK) 575a72f7ea6Sql147931 576a72f7ea6Sql147931 /* 577a72f7ea6Sql147931 * RFMD On/Sleep/Off control 578a72f7ea6Sql147931 */ 579a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_RFMD_ON LSHIFT(0x408, RTW_ANAPARM_RFPOW1_MASK) 580a72f7ea6Sql147931 581a72f7ea6Sql147931 /* 582a72f7ea6Sql147931 * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF; 583a72f7ea6Sql147931 */ 584a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_RFMD_SLEEP LSHIFT(0x378, RTW_ANAPARM_RFPOW1_MASK) 585a72f7ea6Sql147931 586a72f7ea6Sql147931 /* 587a72f7ea6Sql147931 * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF; 588a72f7ea6Sql147931 */ 589a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_RFMD_OFF LSHIFT(0x379, RTW_ANAPARM_RFPOW1_MASK) 590a72f7ea6Sql147931 591a72f7ea6Sql147931 /* 592a72f7ea6Sql147931 * Philips On/Sleep/Off control 593a72f7ea6Sql147931 */ 594a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_ANA_PHILIPS_ON \ 595a72f7ea6Sql147931 LSHIFT(0x328, RTW_ANAPARM_RFPOW1_MASK) 596a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_DIG_PHILIPS_ON \ 597a72f7ea6Sql147931 LSHIFT(0x008, RTW_ANAPARM_RFPOW1_MASK) 598a72f7ea6Sql147931 599a72f7ea6Sql147931 /* 600a72f7ea6Sql147931 * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF; 601a72f7ea6Sql147931 */ 602a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_PHILIPS_SLEEP\ 603a72f7ea6Sql147931 LSHIFT(0x378, RTW_ANAPARM_RFPOW1_MASK) 604a72f7ea6Sql147931 605a72f7ea6Sql147931 /* 606a72f7ea6Sql147931 * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF; 607a72f7ea6Sql147931 */ 608a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_PHILIPS_OFF\ 609a72f7ea6Sql147931 LSHIFT(0x379, RTW_ANAPARM_RFPOW1_MASK) 610a72f7ea6Sql147931 611a72f7ea6Sql147931 #define RTW_ANAPARM_RFPOW_PHILIPS_ON LSHIFT(0x328, RTW_ANAPARM_RFPOW1_MASK) 612a72f7ea6Sql147931 613a72f7ea6Sql147931 /* 614a72f7ea6Sql147931 * undocumented card-specific bits from the EEPROM. 615a72f7ea6Sql147931 */ 616a72f7ea6Sql147931 #define RTW_ANAPARM_CARDSP_MASK BITS(19, 0) 617a72f7ea6Sql147931 618a72f7ea6Sql147931 #define RTW_MSR 0x58 /* Media Status Register, 8b */ 619a72f7ea6Sql147931 /* 620a72f7ea6Sql147931 * Network Type and Link Status 621a72f7ea6Sql147931 */ 622a72f7ea6Sql147931 #define RTW_MSR_NETYPE_MASK BITS(3, 2) 623a72f7ea6Sql147931 /* 624a72f7ea6Sql147931 * AP, XXX RTL8181 only? 625a72f7ea6Sql147931 */ 626a72f7ea6Sql147931 #define RTW_MSR_NETYPE_AP_OK LSHIFT(3, RTW_MSR_NETYPE_MASK) 627a72f7ea6Sql147931 /* 628a72f7ea6Sql147931 * infrastructure link ok 629a72f7ea6Sql147931 */ 630a72f7ea6Sql147931 #define RTW_MSR_NETYPE_INFRA_OK LSHIFT(2, RTW_MSR_NETYPE_MASK) 631a72f7ea6Sql147931 /* 632a72f7ea6Sql147931 * ad-hoc link ok 633a72f7ea6Sql147931 */ 634a72f7ea6Sql147931 #define RTW_MSR_NETYPE_ADHOC_OK LSHIFT(1, RTW_MSR_NETYPE_MASK) 635a72f7ea6Sql147931 /* 636a72f7ea6Sql147931 * no link 637a72f7ea6Sql147931 */ 638a72f7ea6Sql147931 #define RTW_MSR_NETYPE_NOLINK LSHIFT(0, RTW_MSR_NETYPE_MASK) 639a72f7ea6Sql147931 640a72f7ea6Sql147931 #define RTW_CONFIG3 0x59 /* Configuration Register 3, 8b */ 641a72f7ea6Sql147931 #define RTW_CONFIG3_GNTSEL BIT(7) /* Grant Select, read-only */ 642a72f7ea6Sql147931 /* 643a72f7ea6Sql147931 * Set RTW_CONFIG3_PARMEN and RTW_9346CR_EEM_CONFIG to 644a72f7ea6Sql147931 * allow RTW_ANAPARM writes. 645a72f7ea6Sql147931 */ 646a72f7ea6Sql147931 #define RTW_CONFIG3_PARMEN BIT(6) 647a72f7ea6Sql147931 /* 648a72f7ea6Sql147931 * Valid when RTW_CONFIG1_PMEN is set. If set, RTL8180 wakes up 649a72f7ea6Sql147931 * OS when Magic Packet is Rx'd. 650a72f7ea6Sql147931 */ 651a72f7ea6Sql147931 #define RTW_CONFIG3_MAGIC BIT(5) 652a72f7ea6Sql147931 /* 653a72f7ea6Sql147931 * Cardbus-related registers and functions are enabled, 654a72f7ea6Sql147931 * read-only. XXX RTL8180 only. 655a72f7ea6Sql147931 */ 656a72f7ea6Sql147931 #define RTW_CONFIG3_CARDBEN BIT(3) 657a72f7ea6Sql147931 /* 658a72f7ea6Sql147931 * CLKRUN enabled, read-only. XXX RTL8180 only. 659a72f7ea6Sql147931 */ 660a72f7ea6Sql147931 #define RTW_CONFIG3_CLKRUNEN BIT(2) 661a72f7ea6Sql147931 /* 662a72f7ea6Sql147931 * Function Registers Enabled, read-only. XXX RTL8180 only. 663a72f7ea6Sql147931 */ 664a72f7ea6Sql147931 #define RTW_CONFIG3_FUNCREGEN BIT(1) 665a72f7ea6Sql147931 /* 666a72f7ea6Sql147931 * Fast back-to-back enabled, read-only. 667a72f7ea6Sql147931 */ 668a72f7ea6Sql147931 #define RTW_CONFIG3_FBTBEN BIT(0) 669a72f7ea6Sql147931 #define RTW_CONFIG4 0x5A /* Configuration Register 4, 8b */ 670a72f7ea6Sql147931 /* 671a72f7ea6Sql147931 * VCO Power Down 672a72f7ea6Sql147931 * 0: normal operation 673a72f7ea6Sql147931 * (power-on default) 674a72f7ea6Sql147931 * 1: power-down VCO, RF front-end, 675a72f7ea6Sql147931 * and most RTL8180 components. 676a72f7ea6Sql147931 */ 677a72f7ea6Sql147931 #define RTW_CONFIG4_VCOPDN BIT(7) 678a72f7ea6Sql147931 /* 679a72f7ea6Sql147931 * Power Off 680a72f7ea6Sql147931 * 0: normal operation 681a72f7ea6Sql147931 * (power-on default) 682a72f7ea6Sql147931 * 1: power-down RF front-end, 683a72f7ea6Sql147931 * and most RTL8180 components, 684a72f7ea6Sql147931 * but leave VCO on. 685a72f7ea6Sql147931 * 686a72f7ea6Sql147931 * XXX RFMD front-end only? 687a72f7ea6Sql147931 */ 688a72f7ea6Sql147931 #define RTW_CONFIG4_PWROFF BIT(6) 689a72f7ea6Sql147931 /* 690a72f7ea6Sql147931 * Power Management 691a72f7ea6Sql147931 * 0: normal operation 692a72f7ea6Sql147931 * (power-on default) 693a72f7ea6Sql147931 * 1: set Tx packet's PWRMGMT bit. 694a72f7ea6Sql147931 */ 695a72f7ea6Sql147931 #define RTW_CONFIG4_PWRMGT BIT(5) 696a72f7ea6Sql147931 /* 697a72f7ea6Sql147931 * LANWAKE vs. PMEB: Cardbus-only 698a72f7ea6Sql147931 * 0: LWAKE & PMEB asserted 699a72f7ea6Sql147931 * simultaneously 700a72f7ea6Sql147931 * 1: LWAKE asserted only if 701a72f7ea6Sql147931 * both PMEB is asserted and 702a72f7ea6Sql147931 * ISOLATEB is low. 703a72f7ea6Sql147931 * XXX RTL8180 only. 704a72f7ea6Sql147931 */ 705a72f7ea6Sql147931 #define RTW_CONFIG4_LWPME BIT(4) 706a72f7ea6Sql147931 /* 707a72f7ea6Sql147931 * see RTW_CONFIG1_LWACT XXX RTL8180 only. 708a72f7ea6Sql147931 */ 709a72f7ea6Sql147931 #define RTW_CONFIG4_LWPTN BIT(2) 710a72f7ea6Sql147931 /* 711a72f7ea6Sql147931 * Radio Front-End Programming Method 712a72f7ea6Sql147931 */ 713a72f7ea6Sql147931 #define RTW_CONFIG4_RFTYPE_MASK BITS(1, 0) 714a72f7ea6Sql147931 #define RTW_CONFIG4_RFTYPE_INTERSIL LSHIFT(1, RTW_CONFIG4_RFTYPE_MASK) 715a72f7ea6Sql147931 #define RTW_CONFIG4_RFTYPE_RFMD LSHIFT(2, RTW_CONFIG4_RFTYPE_MASK) 716a72f7ea6Sql147931 #define RTW_CONFIG4_RFTYPE_PHILIPS LSHIFT(3, RTW_CONFIG4_RFTYPE_MASK) 717a72f7ea6Sql147931 718a72f7ea6Sql147931 #define RTW_TESTR 0x5B /* TEST mode register, 8b */ 719a72f7ea6Sql147931 720a72f7ea6Sql147931 #define RTW_PSR 0x5e /* Page Select Register, 8b */ 721a72f7ea6Sql147931 #define RTW_PSR_GPO BIT(7) /* Control/status of pin 52. */ 722a72f7ea6Sql147931 #define RTW_PSR_GPI BIT(6) /* Status of pin 64. */ 723a72f7ea6Sql147931 /* 724a72f7ea6Sql147931 * Status/control of LED1 pin if RTW_CONFIG0_LEDGPOEN is set. 725a72f7ea6Sql147931 */ 726a72f7ea6Sql147931 #define RTW_PSR_LEDGPO1 BIT(5) 727a72f7ea6Sql147931 /* 728a72f7ea6Sql147931 * Status/control of LED0 pin if RTW_CONFIG0_LEDGPOEN is set. 729a72f7ea6Sql147931 */ 730a72f7ea6Sql147931 #define RTW_PSR_LEDGPO0 BIT(4) 731a72f7ea6Sql147931 #define RTW_PSR_UWF BIT(1) /* Enable Unicast Wakeup Frame */ 732a72f7ea6Sql147931 #define RTW_PSR_PSEN BIT(0) /* 1: page 1, 0: page 0 */ 733a72f7ea6Sql147931 734a72f7ea6Sql147931 #define RTW_SCR 0x5f /* Security Configuration Register, 8b */ 735a72f7ea6Sql147931 #define RTW_SCR_KM_MASK BITS(5, 4) /* Key Mode */ 736a72f7ea6Sql147931 #define RTW_SCR_KM_WEP104 LSHIFT(1, RTW_SCR_KM_MASK) 737a72f7ea6Sql147931 #define RTW_SCR_KM_WEP40 LSHIFT(0, RTW_SCR_KM_MASK) 738a72f7ea6Sql147931 /* 739a72f7ea6Sql147931 * Enable Tx WEP. Invalid if neither RTW_CONFIG0_WEP40 nor 740a72f7ea6Sql147931 * RTW_CONFIG0_WEP104 is set. 741a72f7ea6Sql147931 */ 742a72f7ea6Sql147931 #define RTW_SCR_TXSECON BIT(1) 743a72f7ea6Sql147931 /* 744a72f7ea6Sql147931 * Enable Rx WEP. Invalid if neither RTW_CONFIG0_WEP40 nor 745a72f7ea6Sql147931 * RTW_CONFIG0_WEP104 is set. 746a72f7ea6Sql147931 */ 747a72f7ea6Sql147931 #define RTW_SCR_RXSECON BIT(0) 748a72f7ea6Sql147931 749a72f7ea6Sql147931 #define RTW_BCNITV 0x70 /* Beacon Interval Register, 16b */ 750a72f7ea6Sql147931 /* 751a72f7ea6Sql147931 * TU between TBTT, written by host. 752a72f7ea6Sql147931 */ 753a72f7ea6Sql147931 #define RTW_BCNITV_BCNITV_MASK BITS(9, 0) 754a72f7ea6Sql147931 #define RTW_ATIMWND 0x72 /* ATIM Window Register, 16b */ 755a72f7ea6Sql147931 /* 756a72f7ea6Sql147931 * ATIM Window length in TU, written by host. 757a72f7ea6Sql147931 */ 758a72f7ea6Sql147931 #define RTW_ATIMWND_ATIMWND BITS(9, 0) 759a72f7ea6Sql147931 760a72f7ea6Sql147931 #define RTW_BINTRITV 0x74 /* Beacon Interrupt Interval Register, 16b */ 761a72f7ea6Sql147931 /* 762a72f7ea6Sql147931 * RTL8180 wakes host with RTW_INTR_BCNINT at BINTRITV 763a72f7ea6Sql147931 * microseconds before TBTT 764a72f7ea6Sql147931 */ 765a72f7ea6Sql147931 #define RTW_BINTRITV_BINTRITV BITS(9, 0) 766a72f7ea6Sql147931 #define RTW_ATIMTRITV 0x76 /* ATIM Interrupt Interval Register, 16b */ 767a72f7ea6Sql147931 /* 768a72f7ea6Sql147931 * RTL8180 wakes host with RTW_INTR_ATIMINT at ATIMTRITV 769a72f7ea6Sql147931 * microseconds before end of ATIM Window 770a72f7ea6Sql147931 */ 771a72f7ea6Sql147931 #define RTW_ATIMTRITV_ATIMTRITV BITS(9, 0) 772a72f7ea6Sql147931 773a72f7ea6Sql147931 #define RTW_PHYDELAY 0x78 /* PHY Delay Register, 8b */ 774a72f7ea6Sql147931 /* 775a72f7ea6Sql147931 * Rev. C magic from reference driver 776a72f7ea6Sql147931 */ 777a72f7ea6Sql147931 #define RTW_PHYDELAY_REVC_MAGIC BIT(3) 778a72f7ea6Sql147931 /* 779a72f7ea6Sql147931 * microsecond Tx delay between MAC and RF front-end 780a72f7ea6Sql147931 */ 781a72f7ea6Sql147931 #define RTW_PHYDELAY_PHYDELAY BITS(2, 0) 782a72f7ea6Sql147931 #define RTW_CRCOUNT 0x79 /* Carrier Sense Counter, 8b */ 783a72f7ea6Sql147931 #define RTW_CRCOUNT_MAGIC 0x4c 784a72f7ea6Sql147931 785a72f7ea6Sql147931 #define RTW_CRC16ERR 0x7a /* CRC16 error count, 16b, XXX RTL8181 only? */ 786a72f7ea6Sql147931 787a72f7ea6Sql147931 #define RTW_BB 0x7c /* Baseband interface, 32b */ 788a72f7ea6Sql147931 /* 789a72f7ea6Sql147931 * used for writing RTL8180's integrated baseband processor 790a72f7ea6Sql147931 */ 791a72f7ea6Sql147931 #define RTW_BB_RD_MASK BITS(23, 16) /* data to read */ 792a72f7ea6Sql147931 #define RTW_BB_WR_MASK BITS(15, 8) /* data to write */ 793a72f7ea6Sql147931 #define RTW_BB_WREN BIT(7) /* write enable */ 794a72f7ea6Sql147931 #define RTW_BB_ADDR_MASK BITS(6, 0) /* address */ 795a72f7ea6Sql147931 796a72f7ea6Sql147931 #define RTW_PHYADDR 0x7c /* Address register for PHY interface, 8b */ 797a72f7ea6Sql147931 #define RTW_PHYDATAW 0x7d /* Write data to PHY, 8b, write-only */ 798a72f7ea6Sql147931 #define RTW_PHYDATAR 0x7e /* Read data from PHY, 8b (?), read-only */ 799a72f7ea6Sql147931 800a72f7ea6Sql147931 #define RTW_PHYCFG 0x80 /* PHY Configuration Register, 32b */ 801a72f7ea6Sql147931 /* 802a72f7ea6Sql147931 * if !RTW_PHYCFG_HST, host sets. MAC clears after banging bits. 803a72f7ea6Sql147931 */ 804a72f7ea6Sql147931 #define RTW_PHYCFG_MAC_POLL BIT(31) 805a72f7ea6Sql147931 /* 806a72f7ea6Sql147931 * 1: host bangs bits 807a72f7ea6Sql147931 * 0: MAC bangs bits 808a72f7ea6Sql147931 */ 809a72f7ea6Sql147931 #define RTW_PHYCFG_HST BIT(30) 810a72f7ea6Sql147931 #define RTW_PHYCFG_MAC_RFTYPE_MASK BITS(29, 28) 811a72f7ea6Sql147931 #define RTW_PHYCFG_MAC_RFTYPE_INTERSIL LSHIFT(0, RTW_PHYCFG_MAC_RFTYPE_MASK) 812a72f7ea6Sql147931 #define RTW_PHYCFG_MAC_RFTYPE_RFMD LSHIFT(1, RTW_PHYCFG_MAC_RFTYPE_MASK) 813a72f7ea6Sql147931 #define RTW_PHYCFG_MAC_RFTYPE_GCT RTW_PHYCFG_MAC_RFTYPE_RFMD 814a72f7ea6Sql147931 #define RTW_PHYCFG_MAC_RFTYPE_PHILIPS LSHIFT(3, RTW_PHYCFG_MAC_RFTYPE_MASK) 815a72f7ea6Sql147931 #define RTW_PHYCFG_MAC_PHILIPS_ADDR_MASK BITS(27, 24) 816a72f7ea6Sql147931 #define RTW_PHYCFG_MAC_PHILIPS_DATA_MASK BITS(23, 0) 817a72f7ea6Sql147931 #define RTW_PHYCFG_MAC_MAXIM_LODATA_MASK BITS(27, 24) 818a72f7ea6Sql147931 #define RTW_PHYCFG_MAC_MAXIM_ADDR_MASK BITS(11, 8) 819a72f7ea6Sql147931 #define RTW_PHYCFG_MAC_MAXIM_HIDATA_MASK BITS(7, 0) 820a72f7ea6Sql147931 #define RTW_PHYCFG_HST_EN BIT(2) 821a72f7ea6Sql147931 #define RTW_PHYCFG_HST_CLK BIT(1) 822a72f7ea6Sql147931 #define RTW_PHYCFG_HST_DATA BIT(0) 823a72f7ea6Sql147931 824a72f7ea6Sql147931 #define RTW_MAXIM_HIDATA_MASK BITS(11, 4) 825a72f7ea6Sql147931 #define RTW_MAXIM_LODATA_MASK BITS(3, 0) 826a72f7ea6Sql147931 827a72f7ea6Sql147931 /* 828a72f7ea6Sql147931 * 0x84 - 0xD3, page 1, selected when RTW_PSR[PSEN] == 1. 829a72f7ea6Sql147931 */ 830a72f7ea6Sql147931 831a72f7ea6Sql147931 #define RTW_WAKEUP0L 0x84 /* Power Management Wakeup Frame */ 832a72f7ea6Sql147931 #define RTW_WAKEUP0H 0x88 /* 32b */ 833a72f7ea6Sql147931 834a72f7ea6Sql147931 #define RTW_WAKEUP1L 0x8c 835a72f7ea6Sql147931 #define RTW_WAKEUP1H 0x90 836a72f7ea6Sql147931 837a72f7ea6Sql147931 #define RTW_WAKEUP2LL 0x94 838a72f7ea6Sql147931 #define RTW_WAKEUP2LH 0x98 839a72f7ea6Sql147931 840a72f7ea6Sql147931 #define RTW_WAKEUP2HL 0x9c 841a72f7ea6Sql147931 #define RTW_WAKEUP2HH 0xa0 842a72f7ea6Sql147931 843a72f7ea6Sql147931 #define RTW_WAKEUP3LL 0xa4 844a72f7ea6Sql147931 #define RTW_WAKEUP3LH 0xa8 845a72f7ea6Sql147931 846a72f7ea6Sql147931 #define RTW_WAKEUP3HL 0xac 847a72f7ea6Sql147931 #define RTW_WAKEUP3HH 0xb0 848a72f7ea6Sql147931 849a72f7ea6Sql147931 #define RTW_WAKEUP4LL 0xb4 850a72f7ea6Sql147931 #define RTW_WAKEUP4LH 0xb8 851a72f7ea6Sql147931 852a72f7ea6Sql147931 #define RTW_WAKEUP4HL 0xbc 853a72f7ea6Sql147931 #define RTW_WAKEUP4HH 0xc0 854a72f7ea6Sql147931 855a72f7ea6Sql147931 #define RTW_CRC0 0xc4 /* CRC of wakeup frame 0, 16b */ 856a72f7ea6Sql147931 #define RTW_CRC1 0xc6 /* CRC of wakeup frame 1, 16b */ 857a72f7ea6Sql147931 #define RTW_CRC2 0xc8 /* CRC of wakeup frame 2, 16b */ 858a72f7ea6Sql147931 #define RTW_CRC3 0xca /* CRC of wakeup frame 3, 16b */ 859a72f7ea6Sql147931 #define RTW_CRC4 0xcc /* CRC of wakeup frame 4, 16b */ 860a72f7ea6Sql147931 861a72f7ea6Sql147931 /* 862a72f7ea6Sql147931 * 0x84 - 0xD3, page 0, selected when RTW_PSR[PSEN] == 0. 863a72f7ea6Sql147931 */ 864a72f7ea6Sql147931 865a72f7ea6Sql147931 /* 866a72f7ea6Sql147931 * Default Key Registers, each 128b 867a72f7ea6Sql147931 * 868a72f7ea6Sql147931 * If RTW_SCR_KM_WEP104, 104 lsb are the key. 869a72f7ea6Sql147931 * If RTW_SCR_KM_WEP40, 40 lsb are the key. 870a72f7ea6Sql147931 */ 871a72f7ea6Sql147931 #define RTW_DK0 0x90 /* Default Key 0 Register, 128b */ 872a72f7ea6Sql147931 #define RTW_DK1 0xa0 /* Default Key 1 Register, 128b */ 873a72f7ea6Sql147931 #define RTW_DK2 0xb0 /* Default Key 2 Register, 128b */ 874a72f7ea6Sql147931 #define RTW_DK3 0xc0 /* Default Key 3 Register, 128b */ 875a72f7ea6Sql147931 876a72f7ea6Sql147931 #define RTW_CONFIG5 0xd8 /* Configuration Register 5, 8b */ 877a72f7ea6Sql147931 #define RTW_CONFIG5_TXFIFOOK BIT(7) /* Tx FIFO self-test pass, read-only */ 878a72f7ea6Sql147931 #define RTW_CONFIG5_RXFIFOOK BIT(6) /* Rx FIFO self-test pass, read-only */ 879a72f7ea6Sql147931 /* 880a72f7ea6Sql147931 * 1: start calibration cycle and raise AGCRESET pin. 881a72f7ea6Sql147931 * 0: lower AGCRESET pin 882a72f7ea6Sql147931 */ 883a72f7ea6Sql147931 #define RTW_CONFIG5_CALON BIT(5) 884a72f7ea6Sql147931 #define RTW_CONFIG5_EACPI BIT(2) /* Enable ACPI Wake up, default 0 */ 885a72f7ea6Sql147931 /* 886a72f7ea6Sql147931 * Enable LAN Wake signal, from EEPROM 887a72f7ea6Sql147931 */ 888a72f7ea6Sql147931 #define RTW_CONFIG5_LANWAKE BIT(1) 889a72f7ea6Sql147931 /* 890a72f7ea6Sql147931 * 1: both software & PCI Reset reset PME_Status 891a72f7ea6Sql147931 * 0: only software resets PME_Status 892a72f7ea6Sql147931 * 893a72f7ea6Sql147931 * From EEPROM. 894a72f7ea6Sql147931 */ 895a72f7ea6Sql147931 #define RTW_CONFIG5_PMESTS BIT(0) 896a72f7ea6Sql147931 897a72f7ea6Sql147931 /* 898a72f7ea6Sql147931 * Transmit Priority Polling Register, 8b, write-only. 899a72f7ea6Sql147931 */ 900a72f7ea6Sql147931 #define RTW_TPPOLL 0xd9 901a72f7ea6Sql147931 /* 902a72f7ea6Sql147931 * RTL8180 clears to notify host of a beacon 903a72f7ea6Sql147931 * Tx. Host writes have no effect. 904a72f7ea6Sql147931 */ 905a72f7ea6Sql147931 #define RTW_TPPOLL_BQ BIT(7) 906a72f7ea6Sql147931 /* 907a72f7ea6Sql147931 * Host writes 1 to notify RTL8180 of high-priority Tx packets, RTL8180 clears 908a72f7ea6Sql147931 * to after high-priority Tx is complete. 909a72f7ea6Sql147931 */ 910a72f7ea6Sql147931 #define RTW_TPPOLL_HPQ BIT(6) 911a72f7ea6Sql147931 /* 912a72f7ea6Sql147931 * If RTW_CONFIG2_DPS is set, host writes 1 to notify RTL8180 of 913a72f7ea6Sql147931 * normal-priority Tx packets, RTL8180 clears 914a72f7ea6Sql147931 * after normal-priority Tx is complete. 915a72f7ea6Sql147931 * 916a72f7ea6Sql147931 * If RTW_CONFIG2_DPS is clear, host writes have no effect. RTL8180 clears after 917a72f7ea6Sql147931 * normal-priority Tx is complete. 918a72f7ea6Sql147931 */ 919a72f7ea6Sql147931 #define RTW_TPPOLL_NPQ BIT(5) 920a72f7ea6Sql147931 /* 921a72f7ea6Sql147931 * Host writes 1 to notify RTL8180 of low-priority Tx packets, RTL8180 clears 922a72f7ea6Sql147931 * after low-priority Tx is complete. 923a72f7ea6Sql147931 */ 924a72f7ea6Sql147931 #define RTW_TPPOLL_LPQ BIT(4) 925a72f7ea6Sql147931 /* 926a72f7ea6Sql147931 * Host writes 1 to tell RTL8180 to stop beacon DMA. This bit is invalid 927a72f7ea6Sql147931 * when RTW_CONFIG2_DPS is set. 928a72f7ea6Sql147931 */ 929a72f7ea6Sql147931 #define RTW_TPPOLL_SBQ BIT(3) 930a72f7ea6Sql147931 /* 931a72f7ea6Sql147931 * Host writes 1 to tell RTL8180 to stop high-priority DMA. 932a72f7ea6Sql147931 */ 933a72f7ea6Sql147931 #define RTW_TPPOLL_SHPQ BIT(2) 934a72f7ea6Sql147931 /* 935a72f7ea6Sql147931 * Host writes 1 to tell RTL8180 to stop normal-priority DMA. 936a72f7ea6Sql147931 * This bit is invalid when RTW_CONFIG2_DPS is set. 937a72f7ea6Sql147931 */ 938a72f7ea6Sql147931 #define RTW_TPPOLL_SNPQ BIT(1) 939a72f7ea6Sql147931 /* 940a72f7ea6Sql147931 * Host writes 1 to tell RTL8180 to stop low-priority DMA. 941a72f7ea6Sql147931 */ 942a72f7ea6Sql147931 #define RTW_TPPOLL_SLPQ BIT(0) 943a72f7ea6Sql147931 944a72f7ea6Sql147931 /* Start all queues. */ 945a72f7ea6Sql147931 #define RTW_TPPOLL_ALL (RTW_TPPOLL_BQ | RTW_TPPOLL_HPQ | \ 946a72f7ea6Sql147931 RTW_TPPOLL_NPQ | RTW_TPPOLL_LPQ) 947a72f7ea6Sql147931 948a72f7ea6Sql147931 /* Start queues solaris required. */ 949a72f7ea6Sql147931 #define RTW_TPPOLL_LN (RTW_TPPOLL_NPQ | RTW_TPPOLL_LPQ) 950a72f7ea6Sql147931 951a72f7ea6Sql147931 /* Stop all queues. */ 952a72f7ea6Sql147931 #define RTW_TPPOLL_SALL (RTW_TPPOLL_SBQ | RTW_TPPOLL_SHPQ | \ 953a72f7ea6Sql147931 RTW_TPPOLL_SNPQ | RTW_TPPOLL_SLPQ) 954a72f7ea6Sql147931 955a72f7ea6Sql147931 #define RTW_CWR 0xdc /* Contention Window Register, 16b, read-only */ 956a72f7ea6Sql147931 /* 957a72f7ea6Sql147931 * Contention Window: indicates number of contention windows before Tx 958a72f7ea6Sql147931 */ 959a72f7ea6Sql147931 #define RTW_CWR_CW BITS(9, 0) 960a72f7ea6Sql147931 961a72f7ea6Sql147931 /* 962a72f7ea6Sql147931 * Retry Count Register, 16b, read-only 963a72f7ea6Sql147931 */ 964a72f7ea6Sql147931 #define RTW_RETRYCTR 0xde 965a72f7ea6Sql147931 /* 966a72f7ea6Sql147931 * Retry Count: indicates number of retries after Tx 967a72f7ea6Sql147931 */ 968a72f7ea6Sql147931 #define RTW_RETRYCTR_RETRYCT BITS(7, 0) 969a72f7ea6Sql147931 970a72f7ea6Sql147931 /* 971a72f7ea6Sql147931 * Receive descriptor Start Address Register, 972a72f7ea6Sql147931 * 32b, 256-byte alignment. 973a72f7ea6Sql147931 */ 974a72f7ea6Sql147931 #define RTW_RDSAR 0xe4 975a72f7ea6Sql147931 /* 976a72f7ea6Sql147931 * Function Event Register, 32b, Cardbus only. Only valid when 977a72f7ea6Sql147931 * both RTW_CONFIG3_CARDBEN and RTW_CONFIG3_FUNCREGEN are set. 978a72f7ea6Sql147931 */ 979a72f7ea6Sql147931 #define RTW_FER 0xf0 980a72f7ea6Sql147931 #define RTW_FER_INTR BIT(15) /* set when RTW_FFER_INTR is set */ 981a72f7ea6Sql147931 #define RTW_FER_GWAKE BIT(4) /* General Wakeup */ 982a72f7ea6Sql147931 /* 983a72f7ea6Sql147931 * Function Event Mask Register, 32b, Cardbus only. Only valid when 984a72f7ea6Sql147931 * both RTW_CONFIG3_CARDBEN and RTW_CONFIG3_FUNCREGEN are set. 985a72f7ea6Sql147931 */ 986a72f7ea6Sql147931 #define RTW_FEMR 0xf4 987a72f7ea6Sql147931 #define RTW_FEMR_INTR BIT(15) /* set when RTW_FFER_INTR is set */ 988a72f7ea6Sql147931 #define RTW_FEMR_WKUP BIT(14) /* Wakeup Mask */ 989a72f7ea6Sql147931 #define RTW_FEMR_GWAKE BIT(4) /* General Wakeup */ 990a72f7ea6Sql147931 /* 991a72f7ea6Sql147931 * Function Present State Register, 32b, read-only, Cardbus only. 992a72f7ea6Sql147931 * Only valid when both RTW_CONFIG3_CARDBEN and RTW_CONFIG3_FUNCREGEN 993a72f7ea6Sql147931 * are set. 994a72f7ea6Sql147931 */ 995a72f7ea6Sql147931 #define RTW_FPSR 0xf8 996a72f7ea6Sql147931 #define RTW_FPSR_INTR BIT(15) /* TBD */ 997a72f7ea6Sql147931 #define RTW_FPSR_GWAKE BIT(4) /* General Wakeup: TBD */ 998a72f7ea6Sql147931 /* 999a72f7ea6Sql147931 * Function Force Event Register, 32b, write-only, Cardbus only. 1000a72f7ea6Sql147931 * Only valid when both RTW_CONFIG3_CARDBEN and RTW_CONFIG3_FUNCREGEN 1001a72f7ea6Sql147931 * are set. 1002a72f7ea6Sql147931 */ 1003a72f7ea6Sql147931 #define RTW_FFER 0xfc 1004a72f7ea6Sql147931 #define RTW_FFER_INTR BIT(15) /* TBD */ 1005a72f7ea6Sql147931 #define RTW_FFER_GWAKE BIT(4) /* General Wakeup: TBD */ 1006a72f7ea6Sql147931 1007a72f7ea6Sql147931 /* 1008a72f7ea6Sql147931 * Serial EEPROM offsets 1009a72f7ea6Sql147931 */ 1010a72f7ea6Sql147931 #define RTW_SR_ID 0x00 /* 16b */ 1011a72f7ea6Sql147931 #define RTW_SR_VID 0x02 /* 16b */ 1012a72f7ea6Sql147931 #define RTW_SR_DID 0x04 /* 16b */ 1013a72f7ea6Sql147931 #define RTW_SR_SVID 0x06 /* 16b */ 1014a72f7ea6Sql147931 #define RTW_SR_SMID 0x08 /* 16b */ 1015a72f7ea6Sql147931 #define RTW_SR_MNGNT 0x0a 1016a72f7ea6Sql147931 #define RTW_SR_MXLAT 0x0b 1017a72f7ea6Sql147931 #define RTW_SR_RFCHIPID 0x0c 1018a72f7ea6Sql147931 #define RTW_SR_CONFIG3 0x0d 1019a72f7ea6Sql147931 #define RTW_SR_MAC 0x0e /* 6 bytes */ 1020a72f7ea6Sql147931 #define RTW_SR_CONFIG0 0x14 1021a72f7ea6Sql147931 #define RTW_SR_CONFIG1 0x15 1022a72f7ea6Sql147931 #define RTW_SR_PMC 0x16 /* Power Management Capabilities, 16b */ 1023a72f7ea6Sql147931 #define RTW_SR_CONFIG2 0x18 1024a72f7ea6Sql147931 #define RTW_SR_CONFIG4 0x19 1025a72f7ea6Sql147931 #define RTW_SR_ANAPARM 0x1a /* Analog Parameters, 32b */ 1026a72f7ea6Sql147931 #define RTW_SR_TESTR 0x1e 1027a72f7ea6Sql147931 #define RTW_SR_CONFIG5 0x1f 1028a72f7ea6Sql147931 #define RTW_SR_TXPOWER1 0x20 1029a72f7ea6Sql147931 #define RTW_SR_TXPOWER2 0x21 1030a72f7ea6Sql147931 #define RTW_SR_TXPOWER3 0x22 1031a72f7ea6Sql147931 #define RTW_SR_TXPOWER4 0x23 1032a72f7ea6Sql147931 #define RTW_SR_TXPOWER5 0x24 1033a72f7ea6Sql147931 #define RTW_SR_TXPOWER6 0x25 1034a72f7ea6Sql147931 #define RTW_SR_TXPOWER7 0x26 1035a72f7ea6Sql147931 #define RTW_SR_TXPOWER8 0x27 1036a72f7ea6Sql147931 #define RTW_SR_TXPOWER9 0x28 1037a72f7ea6Sql147931 #define RTW_SR_TXPOWER10 0x29 1038a72f7ea6Sql147931 #define RTW_SR_TXPOWER11 0x2a 1039a72f7ea6Sql147931 #define RTW_SR_TXPOWER12 0x2b 1040a72f7ea6Sql147931 #define RTW_SR_TXPOWER13 0x2c 1041a72f7ea6Sql147931 #define RTW_SR_TXPOWER14 0x2d 1042a72f7ea6Sql147931 #define RTW_SR_CHANNELPLAN 0x2e /* bitmap of channels to scan */ 1043a72f7ea6Sql147931 #define RTW_SR_ENERGYDETTHR 0x2f /* energy-detect threshold */ 1044a72f7ea6Sql147931 #define RTW_SR_ENERGYDETTHR_DEFAULT 0x0c /* use this if old SROM */ 1045a72f7ea6Sql147931 #define RTW_SR_CISPOINTER 0x30 /* 16b */ 1046a72f7ea6Sql147931 #define RTW_SR_RFPARM 0x32 /* RF-specific parameter */ 1047a72f7ea6Sql147931 #define RTW_SR_RFPARM_DIGPHY BIT(0) /* 1: digital PHY */ 1048a72f7ea6Sql147931 #define RTW_SR_RFPARM_DFLANTB BIT(1) /* 1: antenna B is default */ 1049a72f7ea6Sql147931 #define RTW_SR_RFPARM_CS_MASK BITS(2, 3) /* carrier-sense type */ 1050a72f7ea6Sql147931 #define RTW_SR_VERSION 0x3c /* EEPROM content version, 16b */ 1051a72f7ea6Sql147931 #define RTW_SR_CRC 0x3e /* EEPROM content CRC, 16b */ 1052a72f7ea6Sql147931 #define RTW_SR_VPD 0x40 /* Vital Product Data, 64 bytes */ 1053a72f7ea6Sql147931 #define RTW_SR_CIS 0x80 /* CIS Data, 93c56 only, 128 bytes */ 1054a72f7ea6Sql147931 1055a72f7ea6Sql147931 /* 1056a72f7ea6Sql147931 * RTL8180 Transmit/Receive Descriptors 1057a72f7ea6Sql147931 */ 1058a72f7ea6Sql147931 1059a72f7ea6Sql147931 /* 1060a72f7ea6Sql147931 * the first descriptor in each ring must be on a 256-byte boundary 1061a72f7ea6Sql147931 */ 1062a72f7ea6Sql147931 #define RTW_DESC_ALIGNMENT 256 1063a72f7ea6Sql147931 1064a72f7ea6Sql147931 /* 1065a72f7ea6Sql147931 * Tx descriptor 1066a72f7ea6Sql147931 */ 1067a72f7ea6Sql147931 struct rtw_txdesc { 1068a72f7ea6Sql147931 uint32_t td_ctl0; 1069a72f7ea6Sql147931 uint32_t td_ctl1; 1070a72f7ea6Sql147931 uint32_t td_buf; 1071a72f7ea6Sql147931 uint32_t td_len; 1072a72f7ea6Sql147931 uint32_t td_next; 1073a72f7ea6Sql147931 uint32_t td_rsvd[3]; 1074a72f7ea6Sql147931 }; 1075a72f7ea6Sql147931 1076a72f7ea6Sql147931 #define td_stat td_ctl0 1077a72f7ea6Sql147931 1078a72f7ea6Sql147931 #define RTW_TXCTL0_OWN BIT(31) /* 1: ready to Tx */ 1079a72f7ea6Sql147931 #define RTW_TXCTL0_RSVD0 BIT(30) /* reserved */ 1080a72f7ea6Sql147931 #define RTW_TXCTL0_FS BIT(29) /* first segment */ 1081a72f7ea6Sql147931 #define RTW_TXCTL0_LS BIT(28) /* last segment */ 1082a72f7ea6Sql147931 1083a72f7ea6Sql147931 #define RTW_TXCTL0_RATE_MASK BITS(27, 24) /* Tx rate */ 1084a72f7ea6Sql147931 #define RTW_TXCTL0_RATE_1MBPS LSHIFT(0, RTW_TXCTL0_RATE_MASK) 1085a72f7ea6Sql147931 #define RTW_TXCTL0_RATE_2MBPS LSHIFT(1, RTW_TXCTL0_RATE_MASK) 1086a72f7ea6Sql147931 #define RTW_TXCTL0_RATE_5MBPS LSHIFT(2, RTW_TXCTL0_RATE_MASK) 1087a72f7ea6Sql147931 #define RTW_TXCTL0_RATE_11MBPS LSHIFT(3, RTW_TXCTL0_RATE_MASK) 1088a72f7ea6Sql147931 1089a72f7ea6Sql147931 #define RTW_TXCTL0_RTSEN BIT(23) /* RTS Enable */ 1090a72f7ea6Sql147931 1091a72f7ea6Sql147931 #define RTW_TXCTL0_RTSRATE_MASK BITS(22, 19) /* Tx rate */ 1092a72f7ea6Sql147931 #define RTW_TXCTL0_RTSRATE_1MBPS LSHIFT(0, RTW_TXCTL0_RTSRATE_MASK) 1093a72f7ea6Sql147931 #define RTW_TXCTL0_RTSRATE_2MBPS LSHIFT(1, RTW_TXCTL0_RTSRATE_MASK) 1094a72f7ea6Sql147931 #define RTW_TXCTL0_RTSRATE_5MBPS LSHIFT(2, RTW_TXCTL0_RTSRATE_MASK) 1095a72f7ea6Sql147931 #define RTW_TXCTL0_RTSRATE_11MBPS LSHIFT(3, RTW_TXCTL0_RTSRATE_MASK) 1096a72f7ea6Sql147931 1097a72f7ea6Sql147931 #define RTW_TXCTL0_BEACON BIT(18) /* packet is a beacon */ 1098a72f7ea6Sql147931 #define RTW_TXCTL0_MOREFRAG BIT(17) /* another fragment follows */ 1099a72f7ea6Sql147931 /* 1100a72f7ea6Sql147931 * add short PLCP preamble and header 1101a72f7ea6Sql147931 */ 1102a72f7ea6Sql147931 #define RTW_TXCTL0_SPLCP BIT(16) 1103a72f7ea6Sql147931 #define RTW_TXCTL0_KEYID_MASK BITS(15, 14) /* default key id */ 1104a72f7ea6Sql147931 #define RTW_TXCTL0_RSVD1_MASK BITS(13, 12) /* reserved */ 1105a72f7ea6Sql147931 /* 1106a72f7ea6Sql147931 * Tx packet size in bytes 1107a72f7ea6Sql147931 */ 1108a72f7ea6Sql147931 #define RTW_TXCTL0_TPKTSIZE_MASK BITS(11, 0) 1109a72f7ea6Sql147931 1110a72f7ea6Sql147931 #define RTW_TXSTAT_OWN RTW_TXCTL0_OWN 1111a72f7ea6Sql147931 #define RTW_TXSTAT_RSVD0 RTW_TXCTL0_RSVD0 1112a72f7ea6Sql147931 #define RTW_TXSTAT_FS RTW_TXCTL0_FS 1113a72f7ea6Sql147931 #define RTW_TXSTAT_LS RTW_TXCTL0_LS 1114a72f7ea6Sql147931 #define RTW_TXSTAT_RSVD1_MASK BITS(27, 16) 1115a72f7ea6Sql147931 #define RTW_TXSTAT_TOK BIT(15) 1116a72f7ea6Sql147931 #define RTW_TXSTAT_RTSRETRY_MASK BITS(14, 8) /* RTS retry count */ 1117a72f7ea6Sql147931 #define RTW_TXSTAT_DRC_MASK BITS(7, 0) /* Data retry count */ 1118a72f7ea6Sql147931 1119a72f7ea6Sql147931 /* 1120a72f7ea6Sql147931 * supplements _LENGTH in packets sent 5.5Mb/s or faster 1121a72f7ea6Sql147931 */ 1122a72f7ea6Sql147931 #define RTW_TXCTL1_LENGEXT BIT(31) 1123a72f7ea6Sql147931 #define RTW_TXCTL1_LENGTH_MASK BITS(30, 16) /* PLCP length (microseconds) */ 1124a72f7ea6Sql147931 /* 1125a72f7ea6Sql147931 * RTS Duration (microseconds) 1126a72f7ea6Sql147931 */ 1127a72f7ea6Sql147931 #define RTW_TXCTL1_RTSDUR_MASK BITS(15, 0) 1128a72f7ea6Sql147931 1129a72f7ea6Sql147931 #define RTW_TXLEN_LENGTH_MASK BITS(11, 0) /* Tx buffer length in bytes */ 1130a72f7ea6Sql147931 1131a72f7ea6Sql147931 /* 1132a72f7ea6Sql147931 * Rx descriptor 1133a72f7ea6Sql147931 */ 1134a72f7ea6Sql147931 struct rtw_rxdesc { 1135a72f7ea6Sql147931 uint32_t rd_ctl; 1136a72f7ea6Sql147931 uint32_t rd_rsvd0; 1137a72f7ea6Sql147931 uint32_t rd_buf; 1138a72f7ea6Sql147931 uint32_t rd_rsvd1; 1139a72f7ea6Sql147931 }; 1140a72f7ea6Sql147931 1141a72f7ea6Sql147931 #define rd_stat rd_ctl 1142a72f7ea6Sql147931 #define rd_rssi rd_rsvd0 1143a72f7ea6Sql147931 #define rd_tsftl rd_buf /* valid only when RTW_RXSTAT_LS is set */ 1144a72f7ea6Sql147931 #define rd_tsfth rd_rsvd1 /* valid only when RTW_RXSTAT_LS is set */ 1145a72f7ea6Sql147931 1146a72f7ea6Sql147931 #define RTW_RXCTL_OWN BIT(31) /* 1: owned by NIC */ 1147a72f7ea6Sql147931 #define RTW_RXCTL_EOR BIT(30) /* end of ring */ 1148a72f7ea6Sql147931 #define RTW_RXCTL_FS BIT(29) /* first segment */ 1149a72f7ea6Sql147931 #define RTW_RXCTL_LS BIT(28) /* last segment */ 1150a72f7ea6Sql147931 #define RTW_RXCTL_RSVD0_MASK BITS(29, 12) /* reserved */ 1151a72f7ea6Sql147931 #define RTW_RXCTL_LENGTH_MASK BITS(11, 0) /* Rx buffer length */ 1152a72f7ea6Sql147931 1153a72f7ea6Sql147931 #define RTW_RXSTAT_OWN RTW_RXCTL_OWN 1154a72f7ea6Sql147931 #define RTW_RXSTAT_EOR RTW_RXCTL_EOR 1155a72f7ea6Sql147931 #define RTW_RXSTAT_FS RTW_RXCTL_FS /* first segment */ 1156a72f7ea6Sql147931 #define RTW_RXSTAT_LS RTW_RXCTL_LS /* last segment */ 1157a72f7ea6Sql147931 #define RTW_RXSTAT_DMAFAIL BIT(27) /* DMA failure on this pkt */ 1158a72f7ea6Sql147931 /* 1159a72f7ea6Sql147931 * buffer overflow XXX means FIFO exhausted? 1160a72f7ea6Sql147931 */ 1161a72f7ea6Sql147931 #define RTW_RXSTAT_BOVF BIT(26) 1162a72f7ea6Sql147931 /* 1163a72f7ea6Sql147931 * Rx'd with short preamble and PLCP header 1164a72f7ea6Sql147931 */ 1165a72f7ea6Sql147931 #define RTW_RXSTAT_SPLCP BIT(25) 1166a72f7ea6Sql147931 #define RTW_RXSTAT_RSVD1 BIT(24) /* reserved */ 1167a72f7ea6Sql147931 #define RTW_RXSTAT_RATE_MASK BITS(23, 20) /* Rx rate */ 1168a72f7ea6Sql147931 #define RTW_RXSTAT_RATE_1MBPS LSHIFT(0, RTW_RXSTAT_RATE_MASK) 1169a72f7ea6Sql147931 #define RTW_RXSTAT_RATE_2MBPS LSHIFT(1, RTW_RXSTAT_RATE_MASK) 1170a72f7ea6Sql147931 #define RTW_RXSTAT_RATE_5MBPS LSHIFT(2, RTW_RXSTAT_RATE_MASK) 1171a72f7ea6Sql147931 #define RTW_RXSTAT_RATE_11MBPS LSHIFT(3, RTW_RXSTAT_RATE_MASK) 1172a72f7ea6Sql147931 #define RTW_RXSTAT_MIC BIT(19) /* XXX from reference driver */ 1173a72f7ea6Sql147931 #define RTW_RXSTAT_MAR BIT(18) /* is multicast */ 1174a72f7ea6Sql147931 #define RTW_RXSTAT_PAR BIT(17) /* matches RTL8180's MAC */ 1175a72f7ea6Sql147931 #define RTW_RXSTAT_BAR BIT(16) /* is broadcast */ 1176a72f7ea6Sql147931 /* 1177a72f7ea6Sql147931 * error summary. valid when RTW_RXSTAT_LS set. indicates 1178a72f7ea6Sql147931 * that either RTW_RXSTAT_CRC32 or RTW_RXSTAT_ICV is set. 1179a72f7ea6Sql147931 */ 1180a72f7ea6Sql147931 #define RTW_RXSTAT_RES BIT(15) 1181a72f7ea6Sql147931 #define RTW_RXSTAT_PWRMGT BIT(14) /* 802.11 PWRMGMT bit is set */ 1182a72f7ea6Sql147931 /* 1183a72f7ea6Sql147931 * XXX CRC16 error, from reference driver 1184a72f7ea6Sql147931 */ 1185a72f7ea6Sql147931 #define RTW_RXSTAT_CRC16 BIT(14) 1186a72f7ea6Sql147931 #define RTW_RXSTAT_CRC32 BIT(13) /* CRC32 error */ 1187a72f7ea6Sql147931 #define RTW_RXSTAT_ICV BIT(12) /* ICV error */ 1188a72f7ea6Sql147931 /* 1189a72f7ea6Sql147931 * frame length, including CRC32 1190a72f7ea6Sql147931 */ 1191a72f7ea6Sql147931 #define RTW_RXSTAT_LENGTH_MASK BITS(11, 0) 1192a72f7ea6Sql147931 1193a72f7ea6Sql147931 /* 1194a72f7ea6Sql147931 * Convenient status conjunction. 1195a72f7ea6Sql147931 */ 1196a72f7ea6Sql147931 #define RTW_RXSTAT_ONESEG (RTW_RXSTAT_FS|RTW_RXSTAT_LS) 1197a72f7ea6Sql147931 /* 1198a72f7ea6Sql147931 * Convenient status disjunctions. 1199a72f7ea6Sql147931 */ 1200a72f7ea6Sql147931 #define RTW_RXSTAT_IOERROR (RTW_RXSTAT_DMAFAIL|RTW_RXSTAT_BOVF) 1201a72f7ea6Sql147931 #define RTW_RXSTAT_DEBUG (RTW_RXSTAT_SPLCP|RTW_RXSTAT_MAR|\ 1202a72f7ea6Sql147931 RTW_RXSTAT_PAR|RTW_RXSTAT_BAR|\ 1203a72f7ea6Sql147931 RTW_RXSTAT_PWRMGT|RTW_RXSTAT_CRC32|\ 1204a72f7ea6Sql147931 RTW_RXSTAT_ICV) 1205a72f7ea6Sql147931 1206a72f7ea6Sql147931 1207a72f7ea6Sql147931 #define RTW_RXRSSI_VLAN BITS(32, 16) /* XXX from reference driver */ 1208a72f7ea6Sql147931 /* 1209a72f7ea6Sql147931 * for Philips RF front-ends 1210a72f7ea6Sql147931 */ 1211a72f7ea6Sql147931 #define RTW_RXRSSI_RSSI BITS(15, 8) /* RF energy at the PHY */ 1212a72f7ea6Sql147931 /* 1213a72f7ea6Sql147931 * for RF front-ends by Intersil, Maxim, RFMD 1214a72f7ea6Sql147931 */ 1215a72f7ea6Sql147931 #define RTW_RXRSSI_IMR_RSSI BITS(15, 9) /* RF energy at the PHY */ 1216a72f7ea6Sql147931 #define RTW_RXRSSI_IMR_LNA BIT(8) /* 1: LNA activated */ 1217a72f7ea6Sql147931 #define RTW_RXRSSI_SQ BITS(7, 0) /* Barker code-lock quality */ 1218a72f7ea6Sql147931 1219a72f7ea6Sql147931 #define RTW_READ8(regs, ofs) \ 1220020c4770Sql147931 ddi_get8((regs)->r_handle, \ 1221020c4770Sql147931 (uint8_t *)((regs)->r_base + (ofs))) 1222a72f7ea6Sql147931 1223a72f7ea6Sql147931 #define RTW_READ16(regs, ofs) \ 1224020c4770Sql147931 ddi_get16((regs)->r_handle, \ 1225020c4770Sql147931 (uint16_t *)((uintptr_t)(regs)->r_base + (ofs))) 1226a72f7ea6Sql147931 1227a72f7ea6Sql147931 #define RTW_READ(regs, ofs) \ 1228020c4770Sql147931 ddi_get32((regs)->r_handle, \ 1229020c4770Sql147931 (uint32_t *)((uintptr_t)(regs)->r_base + (ofs))) 1230a72f7ea6Sql147931 1231a72f7ea6Sql147931 #define RTW_WRITE8(regs, ofs, val) \ 1232020c4770Sql147931 ddi_put8((regs)->r_handle, \ 1233020c4770Sql147931 (uint8_t *)((regs)->r_base + (ofs)), val) 1234a72f7ea6Sql147931 1235a72f7ea6Sql147931 #define RTW_WRITE16(regs, ofs, val) \ 1236020c4770Sql147931 ddi_put16((regs)->r_handle, \ 1237020c4770Sql147931 (uint16_t *)((uintptr_t)(regs)->r_base + (ofs)), val) 1238a72f7ea6Sql147931 1239a72f7ea6Sql147931 #define RTW_WRITE(regs, ofs, val) \ 1240020c4770Sql147931 ddi_put32((regs)->r_handle, \ 1241020c4770Sql147931 (uint32_t *)((uintptr_t)(regs)->r_base + (ofs)), val) 1242a72f7ea6Sql147931 1243a72f7ea6Sql147931 #define RTW_ISSET(regs, reg, mask) \ 1244a72f7ea6Sql147931 (RTW_READ((regs), (reg)) & (mask)) 1245a72f7ea6Sql147931 1246a72f7ea6Sql147931 #define RTW_CLR(regs, reg, mask) \ 1247a72f7ea6Sql147931 RTW_WRITE((regs), (reg), RTW_READ((regs), (reg)) & ~(mask)) 1248a72f7ea6Sql147931 1249a72f7ea6Sql147931 /* 1250a72f7ea6Sql147931 * bus_space(9) lied? 1251a72f7ea6Sql147931 */ 1252a72f7ea6Sql147931 #ifndef BUS_SPACE_BARRIER_SYNC 1253a72f7ea6Sql147931 #define BUS_SPACE_BARRIER_SYNC (BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE) 1254a72f7ea6Sql147931 #endif 1255a72f7ea6Sql147931 1256a72f7ea6Sql147931 #ifndef BUS_SPACE_BARRIER_READ_BEFORE_READ 1257a72f7ea6Sql147931 #define BUS_SPACE_BARRIER_READ_BEFORE_READ BUS_SPACE_BARRIER_READ 1258a72f7ea6Sql147931 #endif 1259a72f7ea6Sql147931 1260a72f7ea6Sql147931 #ifndef BUS_SPACE_BARRIER_READ_BEFORE_WRITE 1261a72f7ea6Sql147931 #define BUS_SPACE_BARRIER_READ_BEFORE_WRITE BUS_SPACE_BARRIER_READ 1262a72f7ea6Sql147931 #endif 1263a72f7ea6Sql147931 1264a72f7ea6Sql147931 #ifndef BUS_SPACE_BARRIER_WRITE_BEFORE_READ 1265a72f7ea6Sql147931 #define BUS_SPACE_BARRIER_WRITE_BEFORE_READ BUS_SPACE_BARRIER_WRITE 1266a72f7ea6Sql147931 #endif 1267a72f7ea6Sql147931 1268a72f7ea6Sql147931 #ifndef BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE 1269a72f7ea6Sql147931 #define BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE BUS_SPACE_BARRIER_WRITE 1270a72f7ea6Sql147931 #endif 1271a72f7ea6Sql147931 1272a72f7ea6Sql147931 /* 1273a72f7ea6Sql147931 * Bus barrier 1274a72f7ea6Sql147931 * 1275a72f7ea6Sql147931 * Complete outstanding read and/or write ops on [reg0, reg1] 1276a72f7ea6Sql147931 * ([reg1, reg0]) before starting new ops on the same region. See 1277a72f7ea6Sql147931 * acceptable bus_space_barrier(9) for the flag definitions. 1278a72f7ea6Sql147931 */ 1279a72f7ea6Sql147931 #define RTW_BARRIER(regs, reg0, reg1, flags) 1280a72f7ea6Sql147931 /* 1281a72f7ea6Sql147931 * ***just define a dummy macro here in solaris*** 1282a72f7ea6Sql147931 * bus_space_barrier((regs)->r_bh, (regs)->r_bt, \ 1283a72f7ea6Sql147931 * MIN(reg0, reg1), MAX(reg0, reg1) - MIN(reg0, reg1) + 4, flags) 1284a72f7ea6Sql147931 */ 1285a72f7ea6Sql147931 /* 1286a72f7ea6Sql147931 * Barrier convenience macros. 1287a72f7ea6Sql147931 */ 1288a72f7ea6Sql147931 /* 1289a72f7ea6Sql147931 * sync 1290a72f7ea6Sql147931 */ 1291a72f7ea6Sql147931 #define RTW_SYNC(regs, reg0, reg1) \ 1292a72f7ea6Sql147931 RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_SYNC) 1293a72f7ea6Sql147931 1294a72f7ea6Sql147931 /* 1295a72f7ea6Sql147931 * write-before-write 1296a72f7ea6Sql147931 */ 1297a72f7ea6Sql147931 #define RTW_WBW(regs, reg0, reg1) \ 1298a72f7ea6Sql147931 RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE) 1299a72f7ea6Sql147931 1300a72f7ea6Sql147931 /* 1301a72f7ea6Sql147931 * write-before-read 1302a72f7ea6Sql147931 */ 1303a72f7ea6Sql147931 #define RTW_WBR(regs, reg0, reg1) \ 1304a72f7ea6Sql147931 RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_READ) 1305a72f7ea6Sql147931 1306a72f7ea6Sql147931 /* 1307a72f7ea6Sql147931 * read-before-read 1308a72f7ea6Sql147931 */ 1309a72f7ea6Sql147931 #define RTW_RBR(regs, reg0, reg1) \ 1310a72f7ea6Sql147931 RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_READ) 1311a72f7ea6Sql147931 1312a72f7ea6Sql147931 /* 1313a72f7ea6Sql147931 * read-before-read 1314a72f7ea6Sql147931 */ 1315a72f7ea6Sql147931 #define RTW_RBW(regs, reg0, reg1) \ 1316a72f7ea6Sql147931 RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_WRITE) 1317a72f7ea6Sql147931 1318a72f7ea6Sql147931 #define RTW_WBRW(regs, reg0, reg1) \ 1319a72f7ea6Sql147931 RTW_BARRIER(regs, reg0, reg1, \ 1320a72f7ea6Sql147931 BUS_SPACE_BARRIER_WRITE_BEFORE_READ | \ 1321a72f7ea6Sql147931 BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE) 1322a72f7ea6Sql147931 1323a72f7ea6Sql147931 /* 1324a72f7ea6Sql147931 * Registers for RTL8180L's built-in baseband modem. 1325a72f7ea6Sql147931 */ 1326a72f7ea6Sql147931 #define RTW_BBP_SYS1 0x00 1327a72f7ea6Sql147931 #define RTW_BBP_TXAGC 0x03 /* guess: transmit auto gain control */ 1328a72f7ea6Sql147931 /* 1329a72f7ea6Sql147931 * guess: low-noise amplifier activation threshold 1330a72f7ea6Sql147931 */ 1331a72f7ea6Sql147931 #define RTW_BBP_LNADET 0x04 1332a72f7ea6Sql147931 /* 1333a72f7ea6Sql147931 * guess: intermediate frequency (IF) 1334a72f7ea6Sql147931 * auto-gain control (AGC) initial value 1335a72f7ea6Sql147931 */ 1336a72f7ea6Sql147931 #define RTW_BBP_IFAGCINI 0x05 1337a72f7ea6Sql147931 #define RTW_BBP_IFAGCLIMIT 0x06 /* guess: IF AGC maximum value */ 1338a72f7ea6Sql147931 /* 1339a72f7ea6Sql147931 * guess: activation threshold for IF AGC loop 1340a72f7ea6Sql147931 */ 1341a72f7ea6Sql147931 #define RTW_BBP_IFAGCDET 0x07 1342a72f7ea6Sql147931 1343a72f7ea6Sql147931 #define RTW_BBP_ANTATTEN 0x10 /* guess: antenna & attenuation */ 1344a72f7ea6Sql147931 #define RTW_BBP_ANTATTEN_PHILIPS_MAGIC 0x91 1345a72f7ea6Sql147931 #define RTW_BBP_ANTATTEN_INTERSIL_MAGIC 0x92 1346a72f7ea6Sql147931 #define RTW_BBP_ANTATTEN_RFMD_MAGIC 0x93 1347a72f7ea6Sql147931 #define RTW_BBP_ANTATTEN_MAXIM_MAGIC 0xb3 1348a72f7ea6Sql147931 #define RTW_BBP_ANTATTEN_DFLANTB 0x40 1349a72f7ea6Sql147931 #define RTW_BBP_ANTATTEN_CHAN14 0x0c 1350a72f7ea6Sql147931 1351a72f7ea6Sql147931 /* 1352a72f7ea6Sql147931 * guess: transmit/receive switch latency 1353a72f7ea6Sql147931 */ 1354a72f7ea6Sql147931 #define RTW_BBP_TRL 0x11 1355a72f7ea6Sql147931 #define RTW_BBP_SYS2 0x12 1356a72f7ea6Sql147931 #define RTW_BBP_SYS2_ANTDIV 0x80 /* enable antenna diversity */ 1357a72f7ea6Sql147931 /* 1358a72f7ea6Sql147931 * loopback rate? 1359a72f7ea6Sql147931 * 0: 1Mbps 1360a72f7ea6Sql147931 * 1: 2Mbps 1361a72f7ea6Sql147931 * 2: 5.5Mbps 1362a72f7ea6Sql147931 * 3: 11Mbps 1363a72f7ea6Sql147931 */ 1364a72f7ea6Sql147931 #define RTW_BBP_SYS2_RATE_MASK BITS(5, 4) 1365a72f7ea6Sql147931 #define RTW_BBP_SYS3 0x13 1366a72f7ea6Sql147931 /* 1367a72f7ea6Sql147931 * carrier-sense threshold 1368a72f7ea6Sql147931 */ 1369a72f7ea6Sql147931 #define RTW_BBP_SYS3_CSTHRESH_MASK BITS(0, 3) 1370a72f7ea6Sql147931 /* 1371a72f7ea6Sql147931 * guess: channel energy-detect threshold 1372a72f7ea6Sql147931 */ 1373a72f7ea6Sql147931 #define RTW_BBP_CHESTLIM 0x19 1374a72f7ea6Sql147931 /* 1375a72f7ea6Sql147931 * guess: channel signal-quality threshold 1376a72f7ea6Sql147931 */ 1377a72f7ea6Sql147931 #define RTW_BBP_CHSQLIM 0x1a 1378a72f7ea6Sql147931 1379a72f7ea6Sql147931 #define RTW_EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6)) 1380a72f7ea6Sql147931 #define RTW_EPROM_CMD_OPERATING_MODE_SHIFT 6 1381a72f7ea6Sql147931 #define RTW_EPROM_CS_SHIFT 3 1382a72f7ea6Sql147931 #define RTW_EPROM_CK_SHIFT 2 1383a72f7ea6Sql147931 #define RTW_EPROM_CMD_CONFIG 0x3 1384a72f7ea6Sql147931 #define RTW_EPROM_CMD_NORMAL 0 1385a72f7ea6Sql147931 #define RTW_EPROM_CMD_LOAD 1 1386a72f7ea6Sql147931 #define RTW_TX_DMA_POLLING_HIPRIORITY_SHIFT 6 1387a72f7ea6Sql147931 #define RTW_TX_DMA_POLLING_NORMPRIORITY_SHIFT 5 1388a72f7ea6Sql147931 #define RTW_TX_DMA_POLLING_LOWPRIORITY_SHIFT 4 1389a72f7ea6Sql147931 #define RTW_CONFIG2_DMA_POLLING_MODE_SHIFT 3 1390a72f7ea6Sql147931 1391a72f7ea6Sql147931 #define RTW_CMD_RST_SHIFT (4) 1392a72f7ea6Sql147931 #define RTW_TX_DMA_STOP_BEACON_SHIFT 3 1393*9aa73b68SQin Michael Li #ifdef __cplusplus 1394*9aa73b68SQin Michael Li } 1395*9aa73b68SQin Michael Li #endif 1396a72f7ea6Sql147931 1397a72f7ea6Sql147931 #endif /* _RTW_REG_H_ */ 1398