rtwreg.h revision 9aa73b6813b3fd35e78fcc44fd17535e765e504c
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
9aa73b6813b3fd35e78fcc44fd17535e765e504cQin Michael Li * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Use is subject to license terms.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Copyright (c) 2004, 2005 David Young. All rights reserved.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql *
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Programmed for NetBSD by David Young.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql *
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Redistribution and use in source and binary forms, with or without
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * modification, are permitted provided that the following conditions
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * are met:
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1. Redistributions of source code must retain the above copyright
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * notice, this list of conditions and the following disclaimer.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 2. Redistributions in binary form must reproduce the above copyright
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * notice, this list of conditions and the following disclaimer in the
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * documentation and/or other materials provided with the distribution.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 3. The name of David Young may not be used to endorse or promote
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * products derived from this software without specific prior
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * written permission.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql *
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * OF SUCH DAMAGE.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/* Macros for bit twiddling. */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#ifndef _RTW_REG_H_
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define _RTW_REG_H_
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
9aa73b6813b3fd35e78fcc44fd17535e765e504cQin Michael Li#ifdef __cplusplus
9aa73b6813b3fd35e78fcc44fd17535e765e504cQin Michael Liextern "C" {
9aa73b6813b3fd35e78fcc44fd17535e765e504cQin Michael Li#endif
9aa73b6813b3fd35e78fcc44fd17535e765e504cQin Michael Li
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#ifndef _BIT_TWIDDLE
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define _BIT_TWIDDLE
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * nth bit, BIT(0) == 0x1.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define BIT(n) (((n) == 32) ? 0 : ((uint32_t)1 << (n)))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * bits m through n, m < n.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define BITS(m, n) ((BIT(MAX((m), (n)) + 1) - 1) ^ (BIT(MIN((m), (n))) - 1))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * find least significant bit that is set
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define LOWEST_SET_BIT(x) ((((x) - 1) & (x)) ^ (x))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * for x a power of two and p a non-negative integer, is x a greater
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * power than 2**p?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define GTEQ_POWER(x, p) (((ulong_t)(x) >> (p)) != 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define MASK_TO_SHIFT2(m) (GTEQ_POWER(LOWEST_SET_BIT((m)), 1) ? 1 : 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define MASK_TO_SHIFT4(m) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql (GTEQ_POWER(LOWEST_SET_BIT((m)), 2) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql ? 2 + MASK_TO_SHIFT2((m) >> 2) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql : MASK_TO_SHIFT2((m)))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define MASK_TO_SHIFT8(m) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql (GTEQ_POWER(LOWEST_SET_BIT((m)), 4) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql ? 4 + MASK_TO_SHIFT4((m) >> 4) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql : MASK_TO_SHIFT4((m)))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define MASK_TO_SHIFT16(m) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql (GTEQ_POWER(LOWEST_SET_BIT((m)), 8) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql ? 8 + MASK_TO_SHIFT8((m) >> 8) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql : MASK_TO_SHIFT8((m)))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define MASK_TO_SHIFT(m) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql (GTEQ_POWER(LOWEST_SET_BIT((m)), 16) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql ? 16 + MASK_TO_SHIFT16((m) >> 16) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql : MASK_TO_SHIFT16((m)))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define MASK_AND_RSHIFT(x, mask) (((x) & (mask)) >> MASK_TO_SHIFT(mask))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define LSHIFT(x, mask) ((x) << MASK_TO_SHIFT(mask))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define MASK_AND_REPLACE(reg, val, mask) ((reg & ~mask) | LSHIFT(val, mask))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define PRESHIFT(m) MASK_AND_RSHIFT((m), (m))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#endif /* _BIT_TWIDDLE */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/* RTL8180L Host Control and Status Registers */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * ID Register: MAC addr, 6 bytes.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Auto-loaded from EEPROM. Read by byte, by word, or by double word,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * but write only by double word.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_IDR0 0x00
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_IDR1 0x04
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_MAR0 0x08 /* Multicast filter, 64b. */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_MAR1 0x0c
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Timing Synchronization Function Timer Register,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * low word, 32b, read-only.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TSFTRL 0x18
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TSFTRH 0x1c /* High word, 32b, read-only. */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Transmit Low Priority Descriptors Start Address,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 32b, 256-byte alignment.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TLPDA 0x20
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Transmit Normal Priority Descriptors Start Address,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 32b, 256-byte alignment.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TNPDA 0x24
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Transmit High Priority Descriptors Start Address,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 32b, 256-byte alignment.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_THPDA 0x28
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BRSR 0x2c /* Basic Rate Set Register, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: use short PLCP header for CTS/ACK packet,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: use long PLCP header
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BRSR_BPLCP BIT(8)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BRSR_MBR8180_MASK BITS(1, 0) /* Maximum Basic Service Rate */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BRSR_MBR8180_1MBPS LSHIFT(0, RTW_BRSR_MBR8180_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BRSR_MBR8180_2MBPS LSHIFT(1, RTW_BRSR_MBR8180_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BRSR_MBR8180_5MBPS LSHIFT(2, RTW_BRSR_MBR8180_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BRSR_MBR8180_11MBPS LSHIFT(3, RTW_BRSR_MBR8180_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 8181 and 8180 docs conflict!
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BRSR_MBR8181_1MBPS BIT(0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BRSR_MBR8181_2MBPS BIT(1)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BRSR_MBR8181_5MBPS BIT(2)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BRSR_MBR8181_11MBPS BIT(3)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BSSID 0x2e
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * BSSID, 6 bytes
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BSSID16 0x2e /* first two bytes */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BSSID32 (0x2e + 4) /* remaining four bytes */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BSSID0 RTW_BSSID16 /* BSSID[0], 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BSSID1 (RTW_BSSID0 + 1) /* BSSID[1], 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BSSID2 (RTW_BSSID1 + 1) /* BSSID[2], 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BSSID3 (RTW_BSSID2 + 1) /* BSSID[3], 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BSSID4 (RTW_BSSID3 + 1) /* BSSID[4], 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BSSID5 (RTW_BSSID4 + 1) /* BSSID[5], 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CR 0x37 /* Command Register, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Reset: host sets to 1 to disable
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * transmitter & receiver, reinitialize FIFO.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTL8180L sets to 0 to signal completion.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CR_RST BIT(4)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Receiver Enable: host enables receiver
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * by writing 1. RTL8180L indicates receiver
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * is active with 1. After power-up, host
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * must wait for reset before writing.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CR_RE BIT(3)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Transmitter Enable: host enables transmitter
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * by writing 1. RTL8180L indicates transmitter
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * is active with 1. After power-up, host
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * must wait for reset before writing.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CR_TE BIT(2)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * PCI Multiple Read/Write enable:
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1 enables,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0 disables. XXX RTL8180, only?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CR_MULRW BIT(0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_IMR 0x3c /* Interrupt Mask Register, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ISR 0x3e /* Interrupt status register, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_TXFOVW BIT(15) /* Tx FIFO Overflow */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Time Out: 1 indicates RTW_TSFTR[0:31] = RTW_TINT
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_TIMEOUT BIT(14)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Beacon Time Out: time for host to prepare beacon:
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTW_TSFTR % (RTW_BCNITV_BCNITV * TU) =
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * (RTW_BCNITV_BCNITV * TU - RTW_BINTRITV)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_BCNINT BIT(13)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * ATIM Time Out: ATIM interval will pass,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTW_TSFTR % (RTW_BCNITV_BCNITV * TU) =
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * (RTW_ATIMWND_ATIMWND * TU - RTW_ATIMTRITV)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_ATIMINT BIT(12)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Tx Beacon Descriptor Error:
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * beacon transmission aborted because
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * frame Rx'd
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_TBDER BIT(11)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_TBDOK BIT(10) /* Tx Beacon Descriptor OK */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Tx High Priority Descriptor Error:
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * reached short/long retry limit
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_THPDER BIT(9)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_THPDOK BIT(8) /* Tx High Priority Descriptor OK */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Tx Normal Priority Descriptor Error:
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * reached short/long retry limit
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_TNPDER BIT(7)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_TNPDOK BIT(6) /* Tx Normal Priority Descriptor OK */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Rx FIFO Overflow: either RDU (see below)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * or PCI bus too slow/busy
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_RXFOVW BIT(5)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_RDU BIT(4) /* Rx Descriptor Unavailable */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Tx Low Priority Descriptor Error
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * reached short/long retry limit
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_TLPDER BIT(3)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_TLPDOK BIT(2) /* Tx Low Priority Descriptor OK */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_RER BIT(1) /* Rx Error: CRC32 or ICV error */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_ROK BIT(0) /* Rx OK */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Convenient interrupt conjunctions.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_RX (RTW_INTR_RER|RTW_INTR_ROK | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_INTR_RDU |RTW_INTR_RXFOVW)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_TX (RTW_INTR_TLPDER|RTW_INTR_TLPDOK|RTW_INTR_THPDER|\
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_INTR_THPDOK|RTW_INTR_TNPDER|RTW_INTR_TNPDOK|\
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_INTR_TBDER|RTW_INTR_TBDOK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_BEACON (RTW_INTR_BCNINT)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_INTR_IOERROR (RTW_INTR_TXFOVW|RTW_INTR_RXFOVW|RTW_INTR_RDU)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR 0x40 /* Transmit Configuration Register, 32b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_CWMIN BIT(31) /* 1: CWmin = 8, 0: CWmin = 32. */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: host assigns 802.11 sequence number,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: hardware assigns sequence number
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_SWSEQ BIT(30)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/* Hardware version ID, read-only */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_HWVERID_MASK BITS(29, 25)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_HWVERID_D LSHIFT(26, RTW_TCR_HWVERID_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_HWVERID_F LSHIFT(27, RTW_TCR_HWVERID_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_HWVERID_RTL8180 RTW_TCR_HWVERID_F
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Set ACK/CTS Timeout (EIFS).
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: ACK rate = max(RTW_BRSR_MBR, Rx rate) (XXX not min? typo in datasheet?)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: ACK rate = 1Mbps
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_SAT BIT(24)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/* Max DMA Burst Size per Tx DMA Burst */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_MXDMA_MASK BITS(23, 21)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_MXDMA_16 LSHIFT(0, RTW_TCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_MXDMA_32 LSHIFT(1, RTW_TCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_MXDMA_64 LSHIFT(2, RTW_TCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_MXDMA_128 LSHIFT(3, RTW_TCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_MXDMA_256 LSHIFT(4, RTW_TCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_MXDMA_512 LSHIFT(5, RTW_TCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_MXDMA_1024 LSHIFT(6, RTW_TCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_MXDMA_2048 LSHIFT(7, RTW_TCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_DISCW BIT(20) /* disable 802.11 random backoff */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * host lets RTL8180 append ICV to WEP packets
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_ICV BIT(19)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Loopback Test: disables TXI/TXQ outputs.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_LBK_MASK BITS(18, 17)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_LBK_NORMAL LSHIFT(0, RTW_TCR_LBK_MASK) /* normal ops */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_LBK_MAC LSHIFT(1, RTW_TCR_LBK_MASK) /* MAC loopback */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_LBK_BBP LSHIFT(2, RTW_TCR_LBK_MASK) /* baseband loop. */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_LBK_CONT LSHIFT(3, RTW_TCR_LBK_MASK) /* continuous Tx */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: RTL8180 appends CRC32
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: host appends CRC32
a72f7ea693101cc48bafbb4db6bb437d828011c4ql *
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * (I *think* this is right. The docs have a mysterious
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * description in the passive voice.)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_CRC BIT(16)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_SRL_MASK BITS(15, 8) /* Short Retry Limit */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TCR_LRL_MASK BITS(7, 0) /* Long Retry Limit */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR 0x44 /* Receive Configuration Register, 32b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * only do Early Rx on packets longer than 1536 bytes
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_ONLYERLPKT BIT(31)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_ENCS2 BIT(30) /* enable carrier sense method 2 */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_ENCS1 BIT(29) /* enable carrier sense method 1 */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_ENMARP BIT(28) /* enable MAC auto-reset PHY */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Check BSSID/ToDS/FromDS: set "Link On" when received BSSID
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * matches RTW_BSSID and received ToDS/FromDS are appropriate
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * according to RTW_MSR_NETYPE.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_CBSSID BIT(23)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_APWRMGT BIT(22) /* accept packets w/ PWRMGMT bit set */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * when RTW_MSR_NETYPE == RTW_MSR_NETYPE_INFRA_OK, accept
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * broadcast/multicast packets whose 3rd address matches RTL8180's MAC.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_ADD3 BIT(21)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_AMF BIT(20) /* accept management frames */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_ACF BIT(19) /* accept control frames */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_ADF BIT(18) /* accept data frames */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Rx FIFO Threshold: RTL8180 begins PCI transfer when this many data
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * bytes are received
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_RXFTH_MASK BITS(15, 13)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_RXFTH_64 LSHIFT(2, RTW_RCR_RXFTH_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_RXFTH_128 LSHIFT(3, RTW_RCR_RXFTH_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_RXFTH_256 LSHIFT(4, RTW_RCR_RXFTH_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_RXFTH_512 LSHIFT(5, RTW_RCR_RXFTH_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_RXFTH_1024 LSHIFT(6, RTW_RCR_RXFTH_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_RXFTH_WHOLE LSHIFT(7, RTW_RCR_RXFTH_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_AICV BIT(12) /* accept frames w/ ICV errors */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Max DMA Burst Size per Rx DMA Burst
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_MXDMA_MASK BITS(10, 8)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_MXDMA_16 LSHIFT(0, RTW_RCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_MXDMA_32 LSHIFT(1, RTW_RCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_MXDMA_64 LSHIFT(2, RTW_RCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_MXDMA_128 LSHIFT(3, RTW_RCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_MXDMA_256 LSHIFT(4, RTW_RCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_MXDMA_512 LSHIFT(5, RTW_RCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_MXDMA_1024 LSHIFT(6, RTW_RCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_MXDMA_UNLIMITED LSHIFT(7, RTW_RCR_MXDMA_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * EEPROM type, read-only. 1: EEPROM is 93c56, 0: 93c46
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_9356SEL BIT(6)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_ACRC32 BIT(5) /* accept frames w/ CRC32 errors */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_AB BIT(3) /* accept broadcast frames */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_AM BIT(2) /* accept multicast frames */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * accept physical match frames. XXX means PLCP header ok?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_APM BIT(1)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_AAP BIT(0) /* accept frames w/ destination */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Additional bits to set in monitor mode.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_MONITOR ( \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_AAP | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_ACF | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_ACRC32 | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_AICV | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * The packet filter bits.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_PKTFILTER_MASK (\
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_ENCS1|RTW_RCR_ENCS2|\
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_AAP | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_AB | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_ACF | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_ACRC32 | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_ADD3 | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_ADF | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_AICV | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_AM | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_AMF | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_APM | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_APWRMGT | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Receive power-management frames and mgmt/ctrl/data frames.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_PKTFILTER_DEFAULT ( \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_ONLYERLPKT | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_ENCS1 | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_CBSSID | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_ADF | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_AMF | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_APM | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_AM | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_AB | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RCR_PROMIC ( \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RCR_AAP | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TINT 0x48 /* Timer Interrupt Register, 32b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Transmit Beacon Descriptor Start Address,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 32b, 256-byte alignment
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TBDA 0x4c
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_9346CR 0x50 /* 93c46/93c56 Command Register, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_9346CR_EEM_MASK BITS(7, 6) /* Operating Mode */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_9346CR_EEM_NORMAL LSHIFT(0, RTW_9346CR_EEM_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Load the EEPROM. Reset registers to defaults.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Takes ~2ms. RTL8180 indicates completion with RTW_9346CR_EEM_NORMAL.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * XXX RTL8180 only?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_9346CR_EEM_AUTOLOAD LSHIFT(1, RTW_9346CR_EEM_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Disable network & bus-master operations and enable
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * _EECS, _EESK, _EEDI, _EEDO.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * XXX RTL8180 only?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_9346CR_EEM_PROGRAM LSHIFT(2, RTW_9346CR_EEM_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/* Enable RTW_CONFIG[0123] registers. */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_9346CR_EEM_CONFIG LSHIFT(3, RTW_9346CR_EEM_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * EEPROM pin status/control in _EEM_CONFIG, _EEM_AUTOLOAD modes.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * XXX RTL8180 only?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_9346CR_EECS BIT(3)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_9346CR_EESK BIT(2)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_9346CR_EEDI BIT(1)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_9346CR_EEDO BIT(0) /* read-only */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG0 0x51 /* Configuration Register 0, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * implements 40-bit WEP, XXX RTL8180 only?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG0_WEP40 BIT(7)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * implements 104-bit WEP, from EEPROM, read-only XXX RTL8180 only?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG0_WEP104 BIT(6)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: RTW_PSR_LEDGPO[01] control LED[01] pins.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: LED behavior defined by RTW_CONFIG1_LEDS10_MASK
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * XXX RTL8180 only?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG0_LEDGPOEN BIT(4)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * auxiliary power is present, read-only
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG0_AUXPWR BIT(3)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Geographic Location, read-only
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG0_GL_MASK BITS(1, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * _RTW_CONFIG0_GL_* is what the datasheet says, but RTW_CONFIG0_GL_*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * work.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define _RTW_CONFIG0_GL_USA LSHIFT(3, RTW_CONFIG0_GL_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG0_GL_EUROPE LSHIFT(2, RTW_CONFIG0_GL_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG0_GL_JAPAN LSHIFT(1, RTW_CONFIG0_GL_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG0_GL_USA LSHIFT(0, RTW_CONFIG0_GL_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTL8181 datasheet says RTW_CONFIG0_GL_JAPAN = 0.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG1 0x52 /* Configuration Register 1, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * LED configuration. From EEPROM. Read/write.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql *
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Setting LED0 LED1
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * ------- ---- ----
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTW_CONFIG1_LEDS_ACT_INFRA Activity Infrastructure
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTW_CONFIG1_LEDS_ACT_LINK Activity Link
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTW_CONFIG1_LEDS_TX_RX Tx Rx
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTW_CONFIG1_LEDS_LINKACT_INFRA Link/Activity Infrastructure
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG1_LEDS_MASK BITS(7, 6)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG1_LEDS_ACT_INFRA LSHIFT(0, RTW_CONFIG1_LEDS_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG1_LEDS_ACT_LINK LSHIFT(1, RTW_CONFIG1_LEDS_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG1_LEDS_TX_RX LSHIFT(2, RTW_CONFIG1_LEDS_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG1_LEDS_LINKACT_INFRA LSHIFT(3, RTW_CONFIG1_LEDS_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * LWAKE Output Signal. Only applicable to Cardbus. Pulse width is 150ms.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql *
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTW_CONFIG1_LWACT
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0 1
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTW_CONFIG4_LWPTN 0 active high active low
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1 positive pulse negative pulse
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG1_LWACT BIT(4)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG1_MEMMAP BIT(3) /* using PCI memory space, read-only */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG1_IOMAP BIT(2) /* using PCI I/O space, read-only */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * if set, VPD from offsets 0x40-0x7f in EEPROM are at
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * registers 0x60-0x67 of PCI Configuration Space ( XXX huh? )
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG1_VPD BIT(1)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG1_PMEN BIT(0) /* Power Management Enable: TBD */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG2 0x53 /* Configuration Register 2, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * clocks are locked, read-only:
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Tx frequency & symbol clocks are derived from the same OSC
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG2_LCK BIT(7)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG2_ANT BIT(6) /* diversity enabled, read-only */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Descriptor Polling State: enable test mode.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG2_DPS BIT(3)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG2_PAPESIGN BIT(2) /* TBD, from EEPROM */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG2_PAPETIME_MASK BITS(1, 0) /* TBD, from EEPROM */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM 0x54 /* Analog parameter, 32b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * undocumented bits which appear to control the power state of the RF
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * components
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW0_MASK BITS(30, 28)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_MASK \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql (RTW_ANAPARM_RFPOW0_MASK|RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: disable Tx DAC,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: enable
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_TXDACOFF BIT(27)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * undocumented bits which appear to control the power state of the RF
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * components
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW1_MASK BITS(26, 20)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Maxim On/Sleep/Off control
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_MAXIM_ON LSHIFT(0x8, RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_MAXIM_SLEEP LSHIFT(0x378, RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_MAXIM_OFF LSHIFT(0x379, RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RFMD On/Sleep/Off control
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_RFMD_ON LSHIFT(0x408, RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_RFMD_SLEEP LSHIFT(0x378, RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_RFMD_OFF LSHIFT(0x379, RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Philips On/Sleep/Off control
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_ANA_PHILIPS_ON \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql LSHIFT(0x328, RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_DIG_PHILIPS_ON \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql LSHIFT(0x008, RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_PHILIPS_SLEEP\
a72f7ea693101cc48bafbb4db6bb437d828011c4ql LSHIFT(0x378, RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * reg[RTW_ANAPARM] |= RTW_ANAPARM_TXDACOFF;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_PHILIPS_OFF\
a72f7ea693101cc48bafbb4db6bb437d828011c4ql LSHIFT(0x379, RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_RFPOW_PHILIPS_ON LSHIFT(0x328, RTW_ANAPARM_RFPOW1_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * undocumented card-specific bits from the EEPROM.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ANAPARM_CARDSP_MASK BITS(19, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_MSR 0x58 /* Media Status Register, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Network Type and Link Status
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_MSR_NETYPE_MASK BITS(3, 2)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * AP, XXX RTL8181 only?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_MSR_NETYPE_AP_OK LSHIFT(3, RTW_MSR_NETYPE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * infrastructure link ok
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_MSR_NETYPE_INFRA_OK LSHIFT(2, RTW_MSR_NETYPE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * ad-hoc link ok
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_MSR_NETYPE_ADHOC_OK LSHIFT(1, RTW_MSR_NETYPE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * no link
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_MSR_NETYPE_NOLINK LSHIFT(0, RTW_MSR_NETYPE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG3 0x59 /* Configuration Register 3, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG3_GNTSEL BIT(7) /* Grant Select, read-only */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Set RTW_CONFIG3_PARMEN and RTW_9346CR_EEM_CONFIG to
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * allow RTW_ANAPARM writes.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG3_PARMEN BIT(6)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Valid when RTW_CONFIG1_PMEN is set. If set, RTL8180 wakes up
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * OS when Magic Packet is Rx'd.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG3_MAGIC BIT(5)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Cardbus-related registers and functions are enabled,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * read-only. XXX RTL8180 only.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG3_CARDBEN BIT(3)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * CLKRUN enabled, read-only. XXX RTL8180 only.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG3_CLKRUNEN BIT(2)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Function Registers Enabled, read-only. XXX RTL8180 only.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG3_FUNCREGEN BIT(1)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Fast back-to-back enabled, read-only.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG3_FBTBEN BIT(0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG4 0x5A /* Configuration Register 4, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * VCO Power Down
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: normal operation
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * (power-on default)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: power-down VCO, RF front-end,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * and most RTL8180 components.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG4_VCOPDN BIT(7)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Power Off
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: normal operation
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * (power-on default)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: power-down RF front-end,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * and most RTL8180 components,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * but leave VCO on.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql *
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * XXX RFMD front-end only?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG4_PWROFF BIT(6)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Power Management
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: normal operation
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * (power-on default)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: set Tx packet's PWRMGMT bit.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG4_PWRMGT BIT(5)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * LANWAKE vs. PMEB: Cardbus-only
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: LWAKE & PMEB asserted
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * simultaneously
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: LWAKE asserted only if
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * both PMEB is asserted and
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * ISOLATEB is low.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * XXX RTL8180 only.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG4_LWPME BIT(4)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * see RTW_CONFIG1_LWACT XXX RTL8180 only.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG4_LWPTN BIT(2)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Radio Front-End Programming Method
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG4_RFTYPE_MASK BITS(1, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG4_RFTYPE_INTERSIL LSHIFT(1, RTW_CONFIG4_RFTYPE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG4_RFTYPE_RFMD LSHIFT(2, RTW_CONFIG4_RFTYPE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG4_RFTYPE_PHILIPS LSHIFT(3, RTW_CONFIG4_RFTYPE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TESTR 0x5B /* TEST mode register, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PSR 0x5e /* Page Select Register, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PSR_GPO BIT(7) /* Control/status of pin 52. */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PSR_GPI BIT(6) /* Status of pin 64. */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Status/control of LED1 pin if RTW_CONFIG0_LEDGPOEN is set.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PSR_LEDGPO1 BIT(5)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Status/control of LED0 pin if RTW_CONFIG0_LEDGPOEN is set.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PSR_LEDGPO0 BIT(4)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PSR_UWF BIT(1) /* Enable Unicast Wakeup Frame */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PSR_PSEN BIT(0) /* 1: page 1, 0: page 0 */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SCR 0x5f /* Security Configuration Register, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SCR_KM_MASK BITS(5, 4) /* Key Mode */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SCR_KM_WEP104 LSHIFT(1, RTW_SCR_KM_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SCR_KM_WEP40 LSHIFT(0, RTW_SCR_KM_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Enable Tx WEP. Invalid if neither RTW_CONFIG0_WEP40 nor
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTW_CONFIG0_WEP104 is set.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SCR_TXSECON BIT(1)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Enable Rx WEP. Invalid if neither RTW_CONFIG0_WEP40 nor
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTW_CONFIG0_WEP104 is set.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SCR_RXSECON BIT(0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BCNITV 0x70 /* Beacon Interval Register, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * TU between TBTT, written by host.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BCNITV_BCNITV_MASK BITS(9, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ATIMWND 0x72 /* ATIM Window Register, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * ATIM Window length in TU, written by host.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ATIMWND_ATIMWND BITS(9, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BINTRITV 0x74 /* Beacon Interrupt Interval Register, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTL8180 wakes host with RTW_INTR_BCNINT at BINTRITV
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * microseconds before TBTT
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BINTRITV_BINTRITV BITS(9, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ATIMTRITV 0x76 /* ATIM Interrupt Interval Register, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTL8180 wakes host with RTW_INTR_ATIMINT at ATIMTRITV
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * microseconds before end of ATIM Window
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ATIMTRITV_ATIMTRITV BITS(9, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYDELAY 0x78 /* PHY Delay Register, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Rev. C magic from reference driver
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYDELAY_REVC_MAGIC BIT(3)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * microsecond Tx delay between MAC and RF front-end
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYDELAY_PHYDELAY BITS(2, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CRCOUNT 0x79 /* Carrier Sense Counter, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CRCOUNT_MAGIC 0x4c
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CRC16ERR 0x7a /* CRC16 error count, 16b, XXX RTL8181 only? */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BB 0x7c /* Baseband interface, 32b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * used for writing RTL8180's integrated baseband processor
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BB_RD_MASK BITS(23, 16) /* data to read */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BB_WR_MASK BITS(15, 8) /* data to write */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BB_WREN BIT(7) /* write enable */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BB_ADDR_MASK BITS(6, 0) /* address */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYADDR 0x7c /* Address register for PHY interface, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYDATAW 0x7d /* Write data to PHY, 8b, write-only */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYDATAR 0x7e /* Read data from PHY, 8b (?), read-only */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG 0x80 /* PHY Configuration Register, 32b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * if !RTW_PHYCFG_HST, host sets. MAC clears after banging bits.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_MAC_POLL BIT(31)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: host bangs bits
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: MAC bangs bits
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_HST BIT(30)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_MAC_RFTYPE_MASK BITS(29, 28)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_MAC_RFTYPE_INTERSIL LSHIFT(0, RTW_PHYCFG_MAC_RFTYPE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_MAC_RFTYPE_RFMD LSHIFT(1, RTW_PHYCFG_MAC_RFTYPE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_MAC_RFTYPE_GCT RTW_PHYCFG_MAC_RFTYPE_RFMD
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_MAC_RFTYPE_PHILIPS LSHIFT(3, RTW_PHYCFG_MAC_RFTYPE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_MAC_PHILIPS_ADDR_MASK BITS(27, 24)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_MAC_PHILIPS_DATA_MASK BITS(23, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_MAC_MAXIM_LODATA_MASK BITS(27, 24)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_MAC_MAXIM_ADDR_MASK BITS(11, 8)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_MAC_MAXIM_HIDATA_MASK BITS(7, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_HST_EN BIT(2)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_HST_CLK BIT(1)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_PHYCFG_HST_DATA BIT(0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_MAXIM_HIDATA_MASK BITS(11, 4)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_MAXIM_LODATA_MASK BITS(3, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0x84 - 0xD3, page 1, selected when RTW_PSR[PSEN] == 1.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP0L 0x84 /* Power Management Wakeup Frame */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP0H 0x88 /* 32b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP1L 0x8c
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP1H 0x90
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP2LL 0x94
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP2LH 0x98
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP2HL 0x9c
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP2HH 0xa0
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP3LL 0xa4
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP3LH 0xa8
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP3HL 0xac
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP3HH 0xb0
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP4LL 0xb4
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP4LH 0xb8
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP4HL 0xbc
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WAKEUP4HH 0xc0
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CRC0 0xc4 /* CRC of wakeup frame 0, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CRC1 0xc6 /* CRC of wakeup frame 1, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CRC2 0xc8 /* CRC of wakeup frame 2, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CRC3 0xca /* CRC of wakeup frame 3, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CRC4 0xcc /* CRC of wakeup frame 4, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0x84 - 0xD3, page 0, selected when RTW_PSR[PSEN] == 0.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Default Key Registers, each 128b
a72f7ea693101cc48bafbb4db6bb437d828011c4ql *
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * If RTW_SCR_KM_WEP104, 104 lsb are the key.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * If RTW_SCR_KM_WEP40, 40 lsb are the key.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_DK0 0x90 /* Default Key 0 Register, 128b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_DK1 0xa0 /* Default Key 1 Register, 128b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_DK2 0xb0 /* Default Key 2 Register, 128b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_DK3 0xc0 /* Default Key 3 Register, 128b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG5 0xd8 /* Configuration Register 5, 8b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG5_TXFIFOOK BIT(7) /* Tx FIFO self-test pass, read-only */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG5_RXFIFOOK BIT(6) /* Rx FIFO self-test pass, read-only */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: start calibration cycle and raise AGCRESET pin.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: lower AGCRESET pin
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG5_CALON BIT(5)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG5_EACPI BIT(2) /* Enable ACPI Wake up, default 0 */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Enable LAN Wake signal, from EEPROM
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG5_LANWAKE BIT(1)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: both software & PCI Reset reset PME_Status
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: only software resets PME_Status
a72f7ea693101cc48bafbb4db6bb437d828011c4ql *
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * From EEPROM.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG5_PMESTS BIT(0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Transmit Priority Polling Register, 8b, write-only.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL 0xd9
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTL8180 clears to notify host of a beacon
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Tx. Host writes have no effect.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL_BQ BIT(7)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Host writes 1 to notify RTL8180 of high-priority Tx packets, RTL8180 clears
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * to after high-priority Tx is complete.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL_HPQ BIT(6)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * If RTW_CONFIG2_DPS is set, host writes 1 to notify RTL8180 of
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * normal-priority Tx packets, RTL8180 clears
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * after normal-priority Tx is complete.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql *
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * If RTW_CONFIG2_DPS is clear, host writes have no effect. RTL8180 clears after
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * normal-priority Tx is complete.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL_NPQ BIT(5)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Host writes 1 to notify RTL8180 of low-priority Tx packets, RTL8180 clears
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * after low-priority Tx is complete.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL_LPQ BIT(4)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Host writes 1 to tell RTL8180 to stop beacon DMA. This bit is invalid
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * when RTW_CONFIG2_DPS is set.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL_SBQ BIT(3)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Host writes 1 to tell RTL8180 to stop high-priority DMA.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL_SHPQ BIT(2)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Host writes 1 to tell RTL8180 to stop normal-priority DMA.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * This bit is invalid when RTW_CONFIG2_DPS is set.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL_SNPQ BIT(1)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Host writes 1 to tell RTL8180 to stop low-priority DMA.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL_SLPQ BIT(0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/* Start all queues. */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL_ALL (RTW_TPPOLL_BQ | RTW_TPPOLL_HPQ | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_TPPOLL_NPQ | RTW_TPPOLL_LPQ)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/* Start queues solaris required. */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL_LN (RTW_TPPOLL_NPQ | RTW_TPPOLL_LPQ)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/* Stop all queues. */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TPPOLL_SALL (RTW_TPPOLL_SBQ | RTW_TPPOLL_SHPQ | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_TPPOLL_SNPQ | RTW_TPPOLL_SLPQ)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CWR 0xdc /* Contention Window Register, 16b, read-only */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Contention Window: indicates number of contention windows before Tx
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CWR_CW BITS(9, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Retry Count Register, 16b, read-only
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RETRYCTR 0xde
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Retry Count: indicates number of retries after Tx
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RETRYCTR_RETRYCT BITS(7, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Receive descriptor Start Address Register,
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 32b, 256-byte alignment.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RDSAR 0xe4
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Function Event Register, 32b, Cardbus only. Only valid when
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * both RTW_CONFIG3_CARDBEN and RTW_CONFIG3_FUNCREGEN are set.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FER 0xf0
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FER_INTR BIT(15) /* set when RTW_FFER_INTR is set */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FER_GWAKE BIT(4) /* General Wakeup */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Function Event Mask Register, 32b, Cardbus only. Only valid when
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * both RTW_CONFIG3_CARDBEN and RTW_CONFIG3_FUNCREGEN are set.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FEMR 0xf4
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FEMR_INTR BIT(15) /* set when RTW_FFER_INTR is set */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FEMR_WKUP BIT(14) /* Wakeup Mask */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FEMR_GWAKE BIT(4) /* General Wakeup */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Function Present State Register, 32b, read-only, Cardbus only.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Only valid when both RTW_CONFIG3_CARDBEN and RTW_CONFIG3_FUNCREGEN
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * are set.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FPSR 0xf8
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FPSR_INTR BIT(15) /* TBD */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FPSR_GWAKE BIT(4) /* General Wakeup: TBD */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Function Force Event Register, 32b, write-only, Cardbus only.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Only valid when both RTW_CONFIG3_CARDBEN and RTW_CONFIG3_FUNCREGEN
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * are set.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FFER 0xfc
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FFER_INTR BIT(15) /* TBD */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_FFER_GWAKE BIT(4) /* General Wakeup: TBD */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Serial EEPROM offsets
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_ID 0x00 /* 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_VID 0x02 /* 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_DID 0x04 /* 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_SVID 0x06 /* 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_SMID 0x08 /* 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_MNGNT 0x0a
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_MXLAT 0x0b
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_RFCHIPID 0x0c
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_CONFIG3 0x0d
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_MAC 0x0e /* 6 bytes */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_CONFIG0 0x14
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_CONFIG1 0x15
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_PMC 0x16 /* Power Management Capabilities, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_CONFIG2 0x18
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_CONFIG4 0x19
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_ANAPARM 0x1a /* Analog Parameters, 32b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TESTR 0x1e
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_CONFIG5 0x1f
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER1 0x20
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER2 0x21
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER3 0x22
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER4 0x23
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER5 0x24
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER6 0x25
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER7 0x26
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER8 0x27
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER9 0x28
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER10 0x29
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER11 0x2a
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER12 0x2b
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER13 0x2c
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_TXPOWER14 0x2d
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_CHANNELPLAN 0x2e /* bitmap of channels to scan */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_ENERGYDETTHR 0x2f /* energy-detect threshold */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_ENERGYDETTHR_DEFAULT 0x0c /* use this if old SROM */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_CISPOINTER 0x30 /* 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_RFPARM 0x32 /* RF-specific parameter */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_RFPARM_DIGPHY BIT(0) /* 1: digital PHY */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_RFPARM_DFLANTB BIT(1) /* 1: antenna B is default */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_RFPARM_CS_MASK BITS(2, 3) /* carrier-sense type */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_VERSION 0x3c /* EEPROM content version, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_CRC 0x3e /* EEPROM content CRC, 16b */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_VPD 0x40 /* Vital Product Data, 64 bytes */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SR_CIS 0x80 /* CIS Data, 93c56 only, 128 bytes */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTL8180 Transmit/Receive Descriptors
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * the first descriptor in each ring must be on a 256-byte boundary
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_DESC_ALIGNMENT 256
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Tx descriptor
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4qlstruct rtw_txdesc {
a72f7ea693101cc48bafbb4db6bb437d828011c4ql uint32_t td_ctl0;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql uint32_t td_ctl1;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql uint32_t td_buf;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql uint32_t td_len;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql uint32_t td_next;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql uint32_t td_rsvd[3];
a72f7ea693101cc48bafbb4db6bb437d828011c4ql};
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define td_stat td_ctl0
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_OWN BIT(31) /* 1: ready to Tx */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RSVD0 BIT(30) /* reserved */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_FS BIT(29) /* first segment */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_LS BIT(28) /* last segment */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RATE_MASK BITS(27, 24) /* Tx rate */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RATE_1MBPS LSHIFT(0, RTW_TXCTL0_RATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RATE_2MBPS LSHIFT(1, RTW_TXCTL0_RATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RATE_5MBPS LSHIFT(2, RTW_TXCTL0_RATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RATE_11MBPS LSHIFT(3, RTW_TXCTL0_RATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RTSEN BIT(23) /* RTS Enable */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RTSRATE_MASK BITS(22, 19) /* Tx rate */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RTSRATE_1MBPS LSHIFT(0, RTW_TXCTL0_RTSRATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RTSRATE_2MBPS LSHIFT(1, RTW_TXCTL0_RTSRATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RTSRATE_5MBPS LSHIFT(2, RTW_TXCTL0_RTSRATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RTSRATE_11MBPS LSHIFT(3, RTW_TXCTL0_RTSRATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_BEACON BIT(18) /* packet is a beacon */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_MOREFRAG BIT(17) /* another fragment follows */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * add short PLCP preamble and header
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_SPLCP BIT(16)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_KEYID_MASK BITS(15, 14) /* default key id */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_RSVD1_MASK BITS(13, 12) /* reserved */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Tx packet size in bytes
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL0_TPKTSIZE_MASK BITS(11, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXSTAT_OWN RTW_TXCTL0_OWN
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXSTAT_RSVD0 RTW_TXCTL0_RSVD0
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXSTAT_FS RTW_TXCTL0_FS
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXSTAT_LS RTW_TXCTL0_LS
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXSTAT_RSVD1_MASK BITS(27, 16)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXSTAT_TOK BIT(15)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXSTAT_RTSRETRY_MASK BITS(14, 8) /* RTS retry count */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXSTAT_DRC_MASK BITS(7, 0) /* Data retry count */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * supplements _LENGTH in packets sent 5.5Mb/s or faster
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL1_LENGEXT BIT(31)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL1_LENGTH_MASK BITS(30, 16) /* PLCP length (microseconds) */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * RTS Duration (microseconds)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXCTL1_RTSDUR_MASK BITS(15, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TXLEN_LENGTH_MASK BITS(11, 0) /* Tx buffer length in bytes */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Rx descriptor
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4qlstruct rtw_rxdesc {
a72f7ea693101cc48bafbb4db6bb437d828011c4ql uint32_t rd_ctl;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql uint32_t rd_rsvd0;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql uint32_t rd_buf;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql uint32_t rd_rsvd1;
a72f7ea693101cc48bafbb4db6bb437d828011c4ql};
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define rd_stat rd_ctl
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define rd_rssi rd_rsvd0
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define rd_tsftl rd_buf /* valid only when RTW_RXSTAT_LS is set */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define rd_tsfth rd_rsvd1 /* valid only when RTW_RXSTAT_LS is set */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXCTL_OWN BIT(31) /* 1: owned by NIC */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXCTL_EOR BIT(30) /* end of ring */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXCTL_FS BIT(29) /* first segment */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXCTL_LS BIT(28) /* last segment */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXCTL_RSVD0_MASK BITS(29, 12) /* reserved */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXCTL_LENGTH_MASK BITS(11, 0) /* Rx buffer length */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_OWN RTW_RXCTL_OWN
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_EOR RTW_RXCTL_EOR
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_FS RTW_RXCTL_FS /* first segment */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_LS RTW_RXCTL_LS /* last segment */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_DMAFAIL BIT(27) /* DMA failure on this pkt */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * buffer overflow XXX means FIFO exhausted?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_BOVF BIT(26)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Rx'd with short preamble and PLCP header
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_SPLCP BIT(25)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_RSVD1 BIT(24) /* reserved */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_RATE_MASK BITS(23, 20) /* Rx rate */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_RATE_1MBPS LSHIFT(0, RTW_RXSTAT_RATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_RATE_2MBPS LSHIFT(1, RTW_RXSTAT_RATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_RATE_5MBPS LSHIFT(2, RTW_RXSTAT_RATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_RATE_11MBPS LSHIFT(3, RTW_RXSTAT_RATE_MASK)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_MIC BIT(19) /* XXX from reference driver */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_MAR BIT(18) /* is multicast */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_PAR BIT(17) /* matches RTL8180's MAC */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_BAR BIT(16) /* is broadcast */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * error summary. valid when RTW_RXSTAT_LS set. indicates
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * that either RTW_RXSTAT_CRC32 or RTW_RXSTAT_ICV is set.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_RES BIT(15)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_PWRMGT BIT(14) /* 802.11 PWRMGMT bit is set */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * XXX CRC16 error, from reference driver
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_CRC16 BIT(14)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_CRC32 BIT(13) /* CRC32 error */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_ICV BIT(12) /* ICV error */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * frame length, including CRC32
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_LENGTH_MASK BITS(11, 0)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Convenient status conjunction.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_ONESEG (RTW_RXSTAT_FS|RTW_RXSTAT_LS)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Convenient status disjunctions.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_IOERROR (RTW_RXSTAT_DMAFAIL|RTW_RXSTAT_BOVF)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXSTAT_DEBUG (RTW_RXSTAT_SPLCP|RTW_RXSTAT_MAR|\
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RXSTAT_PAR|RTW_RXSTAT_BAR|\
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RXSTAT_PWRMGT|RTW_RXSTAT_CRC32|\
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_RXSTAT_ICV)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXRSSI_VLAN BITS(32, 16) /* XXX from reference driver */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * for Philips RF front-ends
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXRSSI_RSSI BITS(15, 8) /* RF energy at the PHY */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * for RF front-ends by Intersil, Maxim, RFMD
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXRSSI_IMR_RSSI BITS(15, 9) /* RF energy at the PHY */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXRSSI_IMR_LNA BIT(8) /* 1: LNA activated */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RXRSSI_SQ BITS(7, 0) /* Barker code-lock quality */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_READ8(regs, ofs) \
020c47705d28102a8df83a43ddf08e34dde21f22ql ddi_get8((regs)->r_handle, \
020c47705d28102a8df83a43ddf08e34dde21f22ql (uint8_t *)((regs)->r_base + (ofs)))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_READ16(regs, ofs) \
020c47705d28102a8df83a43ddf08e34dde21f22ql ddi_get16((regs)->r_handle, \
020c47705d28102a8df83a43ddf08e34dde21f22ql (uint16_t *)((uintptr_t)(regs)->r_base + (ofs)))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_READ(regs, ofs) \
020c47705d28102a8df83a43ddf08e34dde21f22ql ddi_get32((regs)->r_handle, \
020c47705d28102a8df83a43ddf08e34dde21f22ql (uint32_t *)((uintptr_t)(regs)->r_base + (ofs)))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WRITE8(regs, ofs, val) \
020c47705d28102a8df83a43ddf08e34dde21f22ql ddi_put8((regs)->r_handle, \
020c47705d28102a8df83a43ddf08e34dde21f22ql (uint8_t *)((regs)->r_base + (ofs)), val)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WRITE16(regs, ofs, val) \
020c47705d28102a8df83a43ddf08e34dde21f22ql ddi_put16((regs)->r_handle, \
020c47705d28102a8df83a43ddf08e34dde21f22ql (uint16_t *)((uintptr_t)(regs)->r_base + (ofs)), val)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WRITE(regs, ofs, val) \
020c47705d28102a8df83a43ddf08e34dde21f22ql ddi_put32((regs)->r_handle, \
020c47705d28102a8df83a43ddf08e34dde21f22ql (uint32_t *)((uintptr_t)(regs)->r_base + (ofs)), val)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_ISSET(regs, reg, mask) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql (RTW_READ((regs), (reg)) & (mask))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CLR(regs, reg, mask) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_WRITE((regs), (reg), RTW_READ((regs), (reg)) & ~(mask))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * bus_space(9) lied?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#ifndef BUS_SPACE_BARRIER_SYNC
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define BUS_SPACE_BARRIER_SYNC (BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#endif
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#ifndef BUS_SPACE_BARRIER_READ_BEFORE_READ
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define BUS_SPACE_BARRIER_READ_BEFORE_READ BUS_SPACE_BARRIER_READ
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#endif
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#ifndef BUS_SPACE_BARRIER_READ_BEFORE_WRITE
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define BUS_SPACE_BARRIER_READ_BEFORE_WRITE BUS_SPACE_BARRIER_READ
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#endif
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#ifndef BUS_SPACE_BARRIER_WRITE_BEFORE_READ
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define BUS_SPACE_BARRIER_WRITE_BEFORE_READ BUS_SPACE_BARRIER_WRITE
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#endif
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#ifndef BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE BUS_SPACE_BARRIER_WRITE
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#endif
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Bus barrier
a72f7ea693101cc48bafbb4db6bb437d828011c4ql *
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Complete outstanding read and/or write ops on [reg0, reg1]
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * ([reg1, reg0]) before starting new ops on the same region. See
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * acceptable bus_space_barrier(9) for the flag definitions.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BARRIER(regs, reg0, reg1, flags)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * ***just define a dummy macro here in solaris***
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * bus_space_barrier((regs)->r_bh, (regs)->r_bt, \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * MIN(reg0, reg1), MAX(reg0, reg1) - MIN(reg0, reg1) + 4, flags)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Barrier convenience macros.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * sync
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_SYNC(regs, reg0, reg1) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_SYNC)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * write-before-write
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WBW(regs, reg0, reg1) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * write-before-read
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WBR(regs, reg0, reg1) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_WRITE_BEFORE_READ)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * read-before-read
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RBR(regs, reg0, reg1) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_READ)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * read-before-read
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_RBW(regs, reg0, reg1) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_BARRIER(regs, reg0, reg1, BUS_SPACE_BARRIER_READ_BEFORE_WRITE)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_WBRW(regs, reg0, reg1) \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql RTW_BARRIER(regs, reg0, reg1, \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql BUS_SPACE_BARRIER_WRITE_BEFORE_READ | \
a72f7ea693101cc48bafbb4db6bb437d828011c4ql BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * Registers for RTL8180L's built-in baseband modem.
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_SYS1 0x00
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_TXAGC 0x03 /* guess: transmit auto gain control */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * guess: low-noise amplifier activation threshold
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_LNADET 0x04
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * guess: intermediate frequency (IF)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * auto-gain control (AGC) initial value
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_IFAGCINI 0x05
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_IFAGCLIMIT 0x06 /* guess: IF AGC maximum value */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * guess: activation threshold for IF AGC loop
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_IFAGCDET 0x07
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_ANTATTEN 0x10 /* guess: antenna & attenuation */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_ANTATTEN_PHILIPS_MAGIC 0x91
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_ANTATTEN_INTERSIL_MAGIC 0x92
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_ANTATTEN_RFMD_MAGIC 0x93
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_ANTATTEN_MAXIM_MAGIC 0xb3
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_ANTATTEN_DFLANTB 0x40
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_ANTATTEN_CHAN14 0x0c
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * guess: transmit/receive switch latency
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_TRL 0x11
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_SYS2 0x12
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_SYS2_ANTDIV 0x80 /* enable antenna diversity */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * loopback rate?
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 0: 1Mbps
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 1: 2Mbps
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 2: 5.5Mbps
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * 3: 11Mbps
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_SYS2_RATE_MASK BITS(5, 4)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_SYS3 0x13
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * carrier-sense threshold
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_SYS3_CSTHRESH_MASK BITS(0, 3)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * guess: channel energy-detect threshold
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_CHESTLIM 0x19
a72f7ea693101cc48bafbb4db6bb437d828011c4ql/*
a72f7ea693101cc48bafbb4db6bb437d828011c4ql * guess: channel signal-quality threshold
a72f7ea693101cc48bafbb4db6bb437d828011c4ql */
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_BBP_CHSQLIM 0x1a
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6))
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_EPROM_CMD_OPERATING_MODE_SHIFT 6
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_EPROM_CS_SHIFT 3
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_EPROM_CK_SHIFT 2
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_EPROM_CMD_CONFIG 0x3
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_EPROM_CMD_NORMAL 0
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_EPROM_CMD_LOAD 1
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TX_DMA_POLLING_HIPRIORITY_SHIFT 6
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TX_DMA_POLLING_NORMPRIORITY_SHIFT 5
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TX_DMA_POLLING_LOWPRIORITY_SHIFT 4
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CONFIG2_DMA_POLLING_MODE_SHIFT 3
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_CMD_RST_SHIFT (4)
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#define RTW_TX_DMA_STOP_BEACON_SHIFT 3
9aa73b6813b3fd35e78fcc44fd17535e765e504cQin Michael Li#ifdef __cplusplus
9aa73b6813b3fd35e78fcc44fd17535e765e504cQin Michael Li}
9aa73b6813b3fd35e78fcc44fd17535e765e504cQin Michael Li#endif
a72f7ea693101cc48bafbb4db6bb437d828011c4ql
a72f7ea693101cc48bafbb4db6bb437d828011c4ql#endif /* _RTW_REG_H_ */