/*
* Copyright (c) 2003 The NetBSD Foundation, Inc. All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Young.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* glossary */
/* DTIM Delivery Traffic Indication Map, sent by AP
* ATIM Ad Hoc Traffic Indication Map
* TU 1024 microseconds
* TSF time synchronization function
* TBTT target beacon transmission time
* DIFS distributed inter-frame space
* SIFS short inter-frame space
* EIFS extended inter-frame space
*/
#define ATW_WCSR_CRCT __BIT(30) /* CRC-16 type */
#define ATW_WCSR_WP1E __BIT(29) /* match wake-up pattern 1 */
#define ATW_WCSR_WP2E __BIT(28) /* match wake-up pattern 2 */
#define ATW_WCSR_WP3E __BIT(27) /* match wake-up pattern 3 */
#define ATW_WCSR_WP4E __BIT(26) /* match wake-up pattern 4 */
#define ATW_WCSR_WP5E __BIT(25) /* match wake-up pattern 5 */
#define ATW_WCSR_BLN_MASK __BITS(21, 23) /* lose link after BLN lost
* beacons
*/
#define ATW_WCSR_TSFTWE __BIT(20) /* wake up on TSFT out of
* range
*/
#define ATW_WCSR_TIMWE __BIT(19) /* wake up on TIM */
#define ATW_WCSR_ATIMWE __BIT(18) /* wake up on ATIM */
#define ATW_WCSR_KEYWE __BIT(17) /* wake up on key update */
#define ATW_WCSR_WFRE __BIT(10) /* wake up on wake-up frame */
#define ATW_WCSR_MPRE __BIT(9) /* wake up on magic packet */
#define ATW_WCSR_LSOE __BIT(8) /* wake up on link loss */
/* wake-up reasons correspond to enable bits */
#define ATW_WCSR_KEYUP __BIT(6) /* */
#define ATW_WCSR_TSFTW __BIT(5) /* */
#define ATW_WCSR_TIMW __BIT(4) /* */
#define ATW_WCSR_ATIMW __BIT(3) /* */
#define ATW_WCSR_WFR __BIT(2) /* */
#define ATW_WCSR_MPR __BIT(1) /* */
#define ATW_WCSR_LSO __BIT(0) /* */
#define ATW_GPTMR_COM_MASK __BIT(16) /* continuous operation mode */
#define ATW_GPTMR_GTV_MASK __BITS(0, 15) /* set countdown in 204us ticks */
/* Intersil 3-wire interface */
#define ATW_BBPCTL_TWI __BIT(31)
#define ATW_BBPCTL_RF3KADDR_MASK __BITS(30, 24) /* Address for RF3000 */
#define ATW_BBPCTL_RF3KADDR_ADDR __SHIFTIN(0x20, ATW_BBPCTL_RF3KADDR_MASK)
/* data-out on negative edge */
#define ATW_BBPCTL_NEGEDGE_DO __BIT(23)
/* data-in on negative edge */
#define ATW_BBPCTL_NEGEDGE_DI __BIT(22)
#define ATW_BBPCTL_CCA_ACTLO __BIT(21) /* 1: CCA signal is low
* when channel is busy,
* CCA signal is high
* when channel is
* clear.
* 0: vice-versa
* 1 is suitable for
* the embedded
* RFMD RF3000.
*/
#define ATW_BBPCTL_TYPE_MASK __BITS(20, 18) /* BBP type */
/* start write; reset on completion */
#define ATW_BBPCTL_WR __BIT(17)
#define ATW_BBPCTL_RD __BIT(16) /* start read; reset on
* completion
*/
#define ATW_BBPCTL_ADDR_MASK __BITS(15, 8) /* BBP address */
#define ATW_BBPCTL_DATA_MASK __BITS(7, 0) /* BBP data */
#define ATW_SYNCTL_WR __BIT(31) /* start write; reset on
* completion
*/
#define ATW_SYNCTL_RD __BIT(30) /* start read; reset on
* completion
*/
#define ATW_SYNCTL_CS0 __BIT(29) /* chip select */
#define ATW_SYNCTL_CS1 __BIT(28)
#define ATW_SYNCTL_CAL __BIT(27) /* generate RF CAL pulse after
* Rx
*/
#define ATW_SYNCTL_SELCAL __BIT(26) /* RF CAL source, 0: CAL bit,
* 1: MAC; needed by Intersil
* BBP
*/
#define ATW_C_SYNCTL_MMICE __BIT(25) /* ADM8211C/CR define this
* bit. 0: latch data on
* negative edge, 1: positive
* edge.
*/
#define ATW_SYNCTL_RFTYPE_MASK __BITS(24, 22) /* RF type */
#define ATW_SYNCTL_DATA_MASK __BITS(21, 0) /* synthesizer setting */
#define ATW_PLCPHD_SIGNAL_MASK __BITS(31, 24) /* signal field in PLCP header,
* only for beacon, ATIM, and
* RTS.
*/
#define ATW_PLCPHD_SERVICE_MASK __BITS(23, 16) /* service field in PLCP
* header; with RFMD BBP,
* sets Tx power for beacon,
* RTS, ATIM.
*/
#define ATW_PLCPHD_PMBL __BIT(15) /* 0: long preamble, 1: short */
#define ATW_MMIWADDR_LENLO_MASK __BITS(31,24) /* tx: written 4th */
#define ATW_MMIWADDR_LENHI_MASK __BITS(23,16) /* tx: written 3rd */
#define ATW_MMIWADDR_GAIN_MASK __BITS(15,8) /* tx: written 2nd */
#define ATW_MMIWADDR_RATE_MASK __BITS(7,0) /* tx: written 1st */
/* was magic 0x00009101
*
* ADMtek sets the AI bit on the ATW_MMIWADDR_GAIN_MASK address to
* put the RF3000 into auto-increment mode so that it can write Tx gain,
* Tx length (high) and Tx length (low) registers back-to-back.
*/
#define ATW_MMIWADDR_RFMD \
(__SHIFTIN(RF3000_TWI_AI|RF3000_GAINCTL, ATW_MMIWADDR_GAIN_MASK) | \
__SHIFTIN(RF3000_CTL, ATW_MMIWADDR_RATE_MASK))
#define ATW_TOFS2_PWR1UP_MASK __BITS(31, 28) /* delay of Tx/Rx from PE1,
* Radio, PHYRST change after
* power-up, in 2ms units
*/
#define ATW_TOFS2_PWR0PAPE_MASK __BITS(27, 24) /* delay of PAPE going low
* after internal data
* transmit end, in us
*/
#define ATW_TOFS2_PWR1PAPE_MASK __BITS(23, 20) /* delay of PAPE going high
* after TXPE asserted, in us
*/
#define ATW_TOFS2_PWR0TRSW_MASK __BITS(19, 16) /* delay of TRSW going low
* after internal data transmit
* end, in us
*/
#define ATW_TOFS2_PWR1TRSW_MASK __BITS(15, 12) /* delay of TRSW going high
* after TXPE asserted, in us
*/
#define ATW_TOFS2_PWR0PE2_MASK __BITS(11, 8) /* delay of PE2 going low
* after internal data transmit
* end, in us
*/
#define ATW_TOFS2_PWR1PE2_MASK __BITS(7, 4) /* delay of PE2 going high
* after TXPE asserted, in us
*/
#define ATW_TOFS2_PWR0TXPE_MASK __BITS(3, 0) /* delay of TXPE going low
* after internal data transmit
* end, in us
*/
/* For ADM8211C/CR */
/* ATW_C_TSC_TIMTABSEL = 1 */
#define ATW_C_BCNT_EXTEN1 __BIT(31) /* 11M beacon len. extension */
#define ATW_C_BCNT_BEANLEN1 __BITS(30,16) /* beacon length in us */
/* ATW_C_TSC_TIMTABSEL = 0 */
#define ATW_C_BCNT_EXTEN0 __BIT(15) /* 11M beacon len. extension */
#define ATW_C_BCNT_BEANLEN0 __BIT(14,0) /* beacon length in us */
#define ATW_C_TSC_TIMOFS __BITS(31,24) /* I think this is the
* SRAM offset for the TIM
*/
#define ATW_C_TSC_TIMLEN __BITS(21,12) /* length of TIM */
#define ATW_C_TSC_TIMTABSEL __BIT(4) /* select TIM table 0 or 1 */
#define ATW_TSC_TSC_MASK __BITS(3,0) /* TSFT countdown value, 0
* disables
*/
#define ATW_SYNRF_SELSYN __BIT(31) /* 0: MAC controls SYN IF pins,
* 1: ATW_SYNRF
* controls SYN IF
* pins.
*/
#define ATW_SYNRF_SELRF __BIT(30) /* 0: MAC controls RF IF pins,
* 1: ATW_SYNRF
* controls RF IF pins.
*/
#define ATW_SYNRF_LERF __BIT(29) /* if SELSYN = 1, direct control
* of LERF# pin
*/
#define ATW_SYNRF_LEIF __BIT(28) /* if SELSYN = 1, direct control
* of LEIF# pin
*/
#define ATW_SYNRF_SYNCLK __BIT(27) /* if SELSYN = 1, direct control
* of SYNCLK pin
*/
#define ATW_SYNRF_SYNDATA __BIT(26) /* if SELSYN = 1, direct control
* of SYNDATA pin
*/
#define ATW_SYNRF_PE1 __BIT(25) /* if SELRF = 1, direct control
* of PE1 pin
*/
#define ATW_SYNRF_PE2 __BIT(24) /* if SELRF = 1, direct control
* of PE2 pin
*/
#define ATW_SYNRF_PAPE __BIT(23) /* if SELRF = 1, direct control
* of PAPE pin
*/
#define ATW_C_SYNRF_TRSW __BIT(22) /* if SELRF = 1, direct control
* of TRSW pin
*/
#define ATW_C_SYNRF_TRSWN __BIT(21) /* if SELRF = 1, direct control
* of TRSWn pin
*/
#define ATW_SYNRF_INTERSIL_EN __BIT(20) /* if SELRF = 1, enables
* some signal used by the
* Intersil RF front-end?
* Undocumented.
*/
#define ATW_SYNRF_PHYRST __BIT(18) /* if SELRF = 1, direct control
* of PHYRST# pin
*/
/* 1: force TXPE = RXPE = 1 if ATW_CMDR[27] = 0. */
#define ATW_C_SYNRF_RF2958PD ATW_SYNRF_PHYRST
#define ATW_BPLI_BP_MASK __BITS(31,16) /* beacon interval in TU */
#define ATW_BPLI_LI_MASK __BITS(15,0) /* STA listen interval in
* beacon intervals
*/
#define ATW_C_CAP0_TIMLEN1 __BITS(31,24) /* TIM table 1 len in bytes
* including TIM ID (XXX huh?)
*/
#define ATW_C_CAP0_TIMLEN0 __BITS(23,16) /* TIM table 0 len in bytes,
* including TIM ID (XXX huh?)
*/
#define ATW_C_CAP0_CWMAX __BITS(11,8) /* 1 <= CWMAX <= 5 fixes CW?
* 5 < CWMAX <= 9 sets max?
* 10?
* default 0
*/
#define ATW_CAP0_RCVDTIM __BIT(4) /* receive every DTIM */
#define ATW_CAP0_CHN_MASK __BITS(3,0) /* current DSSS channel */
#define ATW_CAP1_CAPI_MASK __BITS(31,16) /* capability information */
#define ATW_CAP1_ATIMW_MASK __BITS(15,0) /* ATIM window in TU */
#define ATW_RMD_ATIMST __BIT(31) /* ATIM frame TX status */
#define ATW_RMD_CFP __BIT(30) /* CFP indicator */
#define ATW_RMD_PCNT __BITS(27,16) /* idle time between
* awake/ps mode, in seconds
*/
#define ATW_RMD_RMRD_MASK __BITS(15,0) /* max RX reception duration
* in us
*/
#define ATW_CFPP_CFPP __BITS(31,24) /* CFP unit DTIM */
#define ATW_CFPP_CFPMD __BITS(23,8) /* CFP max duration in TU */
#define ATW_CFPP_DTIMP __BITS(7,0) /* DTIM period in beacon
* intervals
*/
#define ATW_TOFS0_USCNT_MASK __BITS(29,24) /* number of system clocks
* in 1 microsecond.
* Depends PCI bus speed?
*/
#define ATW_C_TOFS0_TUCNT_MASK __BITS(14,10) /* PIFS (microseconds) */
#define ATW_TOFS0_TUCNT_MASK __BITS(9,0) /* TU counter in microseconds */
/* TBD TOFS1 */
#define ATW_TOFS1_TSFTOFSR_MASK __BITS(31,24) /* RX TSFT offset in
* microseconds: RF+BBP
* latency
*/
#define ATW_TOFS1_TBTTPRE_MASK __BITS(23,8) /* prediction time, (next
* Nth TBTT - TBTTOFS) in
* microseconds (huh?). To
* match TSFT[25:10] (huh?).
*/
#define ATW_TBTTPRE_MASK __BITS(25, 10)
#define ATW_TOFS1_TBTTOFS_MASK __BITS(7,0) /* wake-up time offset before
* TBTT in TU
*/
#define ATW_IFST_SLOT_MASK __BITS(27,23) /* SLOT time in us */
#define ATW_IFST_SIFS_MASK __BITS(22,15) /* SIFS time in us */
#define ATW_IFST_DIFS_MASK __BITS(14,9) /* DIFS time in us */
#define ATW_IFST_EIFS_MASK __BITS(8,0) /* EIFS time in us */
#define ATW_RSPT_MART_MASK __BITS(31,16) /* max response time in us */
#define ATW_RSPT_MIRT_MASK __BITS(15,8) /* min response time in us */
#define ATW_RSPT_TSFTOFST_MASK __BITS(7,0) /* TX TSFT offset in us */
#define ATW_WEPCTL_WEPENABLE __BIT(31) /* enable WEP engine */
#define ATW_WEPCTL_AUTOSWITCH __BIT(30) /* auto-switch enable (huh?) */
#define ATW_WEPCTL_CURTBL __BIT(29) /* current table in use */
#define ATW_WEPCTL_WR __BIT(28) /* */
#define ATW_WEPCTL_RD __BIT(27) /* */
#define ATW_WEPCTL_WEPRXBYP __BIT(25) /* bypass WEP on RX */
#define ATW_WEPCTL_SHKEY __BIT(24) /* 1: pass to host if tbl
* lookup fails, 0: use
* shared-key
*/
#define ATW_WEPCTL_UNKNOWN0 __BIT(23) /* has something to do with
* revision 0x20. Possibly
* selects a different WEP
* table.
*/
#define ATW_WEPCTL_TBLADD_MASK __BITS(8,0) /* add to table */
/* set these bits in the second byte of a SRAM shared key record to affect
* the use and interpretation of the key in the record.
*/
#define ATW_WEP_ENABLED __BIT(7)
#define ATW_WEP_104BIT __BIT(6)