1*40db2e2bSzf162725 /* 2*40db2e2bSzf162725 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 3*40db2e2bSzf162725 * Use is subject to license terms. 4*40db2e2bSzf162725 */ 5*40db2e2bSzf162725 6*40db2e2bSzf162725 /* 7*40db2e2bSzf162725 * Copyright (c) 2005, 2006 8*40db2e2bSzf162725 * Damien Bergamini <damien.bergamini@free.fr> 9*40db2e2bSzf162725 * 10*40db2e2bSzf162725 * Permission to use, copy, modify, and distribute this software for any 11*40db2e2bSzf162725 * purpose with or without fee is hereby granted, provided that the above 12*40db2e2bSzf162725 * copyright notice and this permission notice appear in all copies. 13*40db2e2bSzf162725 * 14*40db2e2bSzf162725 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 15*40db2e2bSzf162725 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 16*40db2e2bSzf162725 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 17*40db2e2bSzf162725 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 18*40db2e2bSzf162725 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 19*40db2e2bSzf162725 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 20*40db2e2bSzf162725 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 21*40db2e2bSzf162725 */ 22*40db2e2bSzf162725 #ifndef _URAL_REG_H 23*40db2e2bSzf162725 #define _URAL_REG_H 24*40db2e2bSzf162725 25*40db2e2bSzf162725 #pragma ident "%Z%%M% %I% %E% SMI" 26*40db2e2bSzf162725 27*40db2e2bSzf162725 #ifdef __cplusplus 28*40db2e2bSzf162725 extern "C" { 29*40db2e2bSzf162725 #endif 30*40db2e2bSzf162725 31*40db2e2bSzf162725 #define RAL_RX_DESC_SIZE (sizeof (struct ural_rx_desc)) 32*40db2e2bSzf162725 #define RAL_TX_DESC_SIZE (sizeof (struct ural_tx_desc)) 33*40db2e2bSzf162725 34*40db2e2bSzf162725 #define RAL_CONFIG_NO 1 35*40db2e2bSzf162725 #define RAL_IFACE_INDEX 0 36*40db2e2bSzf162725 37*40db2e2bSzf162725 #define RAL_VENDOR_REQUEST 0x01 38*40db2e2bSzf162725 #define RAL_WRITE_MAC 0x02 39*40db2e2bSzf162725 #define RAL_READ_MAC 0x03 40*40db2e2bSzf162725 #define RAL_WRITE_MULTI_MAC 0x06 41*40db2e2bSzf162725 #define RAL_READ_MULTI_MAC 0x07 42*40db2e2bSzf162725 #define RAL_READ_EEPROM 0x09 43*40db2e2bSzf162725 44*40db2e2bSzf162725 /* 45*40db2e2bSzf162725 * MAC registers. 46*40db2e2bSzf162725 */ 47*40db2e2bSzf162725 #define RAL_MAC_CSR0 0x0400 /* ASIC Version */ 48*40db2e2bSzf162725 #define RAL_MAC_CSR1 0x0402 /* System control */ 49*40db2e2bSzf162725 #define RAL_MAC_CSR2 0x0404 /* MAC addr0 */ 50*40db2e2bSzf162725 #define RAL_MAC_CSR3 0x0406 /* MAC addr1 */ 51*40db2e2bSzf162725 #define RAL_MAC_CSR4 0x0408 /* MAC addr2 */ 52*40db2e2bSzf162725 #define RAL_MAC_CSR5 0x040a /* BSSID0 */ 53*40db2e2bSzf162725 #define RAL_MAC_CSR6 0x040c /* BSSID1 */ 54*40db2e2bSzf162725 #define RAL_MAC_CSR7 0x040e /* BSSID2 */ 55*40db2e2bSzf162725 #define RAL_MAC_CSR8 0x0410 /* Max frame length */ 56*40db2e2bSzf162725 #define RAL_MAC_CSR9 0x0412 /* Timer control */ 57*40db2e2bSzf162725 #define RAL_MAC_CSR10 0x0414 /* Slot time */ 58*40db2e2bSzf162725 #define RAL_MAC_CSR11 0x0416 /* IFS */ 59*40db2e2bSzf162725 #define RAL_MAC_CSR12 0x0418 /* EIFS */ 60*40db2e2bSzf162725 #define RAL_MAC_CSR13 0x041a /* Power mode0 */ 61*40db2e2bSzf162725 #define RAL_MAC_CSR14 0x041c /* Power mode1 */ 62*40db2e2bSzf162725 #define RAL_MAC_CSR15 0x041e /* Power saving transition0 */ 63*40db2e2bSzf162725 #define RAL_MAC_CSR16 0x0420 /* Power saving transition1 */ 64*40db2e2bSzf162725 #define RAL_MAC_CSR17 0x0422 /* Power state control */ 65*40db2e2bSzf162725 #define RAL_MAC_CSR18 0x0424 /* Auto wake-up control */ 66*40db2e2bSzf162725 #define RAL_MAC_CSR19 0x0426 /* GPIO control */ 67*40db2e2bSzf162725 #define RAL_MAC_CSR20 0x0428 /* LED control0 */ 68*40db2e2bSzf162725 #define RAL_MAC_CSR22 0x042c /* Not documented */ 69*40db2e2bSzf162725 70*40db2e2bSzf162725 /* 71*40db2e2bSzf162725 * Tx/Rx Registers. 72*40db2e2bSzf162725 */ 73*40db2e2bSzf162725 #define RAL_TXRX_CSR0 0x0440 /* Security control */ 74*40db2e2bSzf162725 #define RAL_TXRX_CSR2 0x0444 /* Rx control */ 75*40db2e2bSzf162725 #define RAL_TXRX_CSR5 0x044a /* CCK Tx BBP ID0 */ 76*40db2e2bSzf162725 #define RAL_TXRX_CSR6 0x044c /* CCK Tx BBP ID1 */ 77*40db2e2bSzf162725 #define RAL_TXRX_CSR7 0x044e /* OFDM Tx BBP ID0 */ 78*40db2e2bSzf162725 #define RAL_TXRX_CSR8 0x0450 /* OFDM Tx BBP ID1 */ 79*40db2e2bSzf162725 #define RAL_TXRX_CSR10 0x0454 /* Auto responder control */ 80*40db2e2bSzf162725 #define RAL_TXRX_CSR11 0x0456 /* Auto responder basic rate */ 81*40db2e2bSzf162725 #define RAL_TXRX_CSR18 0x0464 /* Beacon interval */ 82*40db2e2bSzf162725 #define RAL_TXRX_CSR19 0x0466 /* Beacon/sync control */ 83*40db2e2bSzf162725 #define RAL_TXRX_CSR20 0x0468 /* Beacon alignment */ 84*40db2e2bSzf162725 #define RAL_TXRX_CSR21 0x046a /* Not documented */ 85*40db2e2bSzf162725 86*40db2e2bSzf162725 /* 87*40db2e2bSzf162725 * Security registers. 88*40db2e2bSzf162725 */ 89*40db2e2bSzf162725 #define RAL_SEC_CSR0 0x0480 /* Shared key 0, word 0 */ 90*40db2e2bSzf162725 91*40db2e2bSzf162725 /* 92*40db2e2bSzf162725 * PHY registers. 93*40db2e2bSzf162725 */ 94*40db2e2bSzf162725 #define RAL_PHY_CSR2 0x04c4 /* Tx MAC configuration */ 95*40db2e2bSzf162725 #define RAL_PHY_CSR4 0x04c8 /* Interface configuration */ 96*40db2e2bSzf162725 #define RAL_PHY_CSR5 0x04ca /* BBP Pre-Tx CCK */ 97*40db2e2bSzf162725 #define RAL_PHY_CSR6 0x04cc /* BBP Pre-Tx OFDM */ 98*40db2e2bSzf162725 #define RAL_PHY_CSR7 0x04ce /* BBP serial control */ 99*40db2e2bSzf162725 #define RAL_PHY_CSR8 0x04d0 /* BBP serial status */ 100*40db2e2bSzf162725 #define RAL_PHY_CSR9 0x04d2 /* RF serial control0 */ 101*40db2e2bSzf162725 #define RAL_PHY_CSR10 0x04d4 /* RF serial control1 */ 102*40db2e2bSzf162725 103*40db2e2bSzf162725 /* 104*40db2e2bSzf162725 * Statistics registers. 105*40db2e2bSzf162725 */ 106*40db2e2bSzf162725 #define RAL_STA_CSR0 0x04e0 /* FCS error */ 107*40db2e2bSzf162725 108*40db2e2bSzf162725 109*40db2e2bSzf162725 #define RAL_DISABLE_RX (1 << 0) 110*40db2e2bSzf162725 #define RAL_DROP_CRC (1 << 1) 111*40db2e2bSzf162725 #define RAL_DROP_PHY (1 << 2) 112*40db2e2bSzf162725 #define RAL_DROP_CTL (1 << 3) 113*40db2e2bSzf162725 #define RAL_DROP_NOT_TO_ME (1 << 4) 114*40db2e2bSzf162725 #define RAL_DROP_TODS (1 << 5) 115*40db2e2bSzf162725 #define RAL_DROP_BAD_VERSION (1 << 6) 116*40db2e2bSzf162725 #define RAL_DROP_MULTICAST (1 << 9) 117*40db2e2bSzf162725 #define RAL_DROP_BROADCAST (1 << 10) 118*40db2e2bSzf162725 119*40db2e2bSzf162725 #define RAL_SHORT_PREAMBLE (1 << 2) 120*40db2e2bSzf162725 121*40db2e2bSzf162725 #define RAL_RESET_ASIC (1 << 0) 122*40db2e2bSzf162725 #define RAL_RESET_BBP (1 << 1) 123*40db2e2bSzf162725 #define RAL_HOST_READY (1 << 2) 124*40db2e2bSzf162725 125*40db2e2bSzf162725 #define RAL_ENABLE_TSF (1 << 0) 126*40db2e2bSzf162725 #define RAL_ENABLE_TSF_SYNC(x) (((x) & 0x3) << 1) 127*40db2e2bSzf162725 #define RAL_ENABLE_TBCN (1 << 3) 128*40db2e2bSzf162725 #define RAL_ENABLE_BEACON_GENERATOR (1 << 4) 129*40db2e2bSzf162725 130*40db2e2bSzf162725 #define RAL_RF_AWAKE (3 << 7) 131*40db2e2bSzf162725 #define RAL_BBP_AWAKE (3 << 5) 132*40db2e2bSzf162725 133*40db2e2bSzf162725 #define RAL_BBP_WRITE (1 << 15) 134*40db2e2bSzf162725 #define RAL_BBP_BUSY (1 << 0) 135*40db2e2bSzf162725 136*40db2e2bSzf162725 #define RAL_RF1_AUTOTUNE 0x08000 137*40db2e2bSzf162725 #define RAL_RF3_AUTOTUNE 0x00040 138*40db2e2bSzf162725 139*40db2e2bSzf162725 #define RAL_RF_2522 0x00 140*40db2e2bSzf162725 #define RAL_RF_2523 0x01 141*40db2e2bSzf162725 #define RAL_RF_2524 0x02 142*40db2e2bSzf162725 #define RAL_RF_2525 0x03 143*40db2e2bSzf162725 #define RAL_RF_2525E 0x04 144*40db2e2bSzf162725 #define RAL_RF_2526 0x05 145*40db2e2bSzf162725 /* dual-band RF */ 146*40db2e2bSzf162725 #define RAL_RF_5222 0x10 147*40db2e2bSzf162725 148*40db2e2bSzf162725 #define RAL_BBP_VERSION 0 149*40db2e2bSzf162725 #define RAL_BBP_TX 2 150*40db2e2bSzf162725 #define RAL_BBP_RX 14 151*40db2e2bSzf162725 152*40db2e2bSzf162725 #define RAL_BBP_ANTA 0x00 153*40db2e2bSzf162725 #define RAL_BBP_DIVERSITY 0x01 154*40db2e2bSzf162725 #define RAL_BBP_ANTB 0x02 155*40db2e2bSzf162725 #define RAL_BBP_ANTMASK 0x03 156*40db2e2bSzf162725 #define RAL_BBP_FLIPIQ 0x04 157*40db2e2bSzf162725 158*40db2e2bSzf162725 #define RAL_JAPAN_FILTER 0x08 159*40db2e2bSzf162725 160*40db2e2bSzf162725 #pragma pack(1) 161*40db2e2bSzf162725 struct ural_tx_desc { 162*40db2e2bSzf162725 uint32_t flags; 163*40db2e2bSzf162725 #define RAL_TX_RETRY(x) ((x) << 4) 164*40db2e2bSzf162725 #define RAL_TX_MORE_FRAG (1 << 8) 165*40db2e2bSzf162725 #define RAL_TX_ACK (1 << 9) 166*40db2e2bSzf162725 #define RAL_TX_TIMESTAMP (1 << 10) 167*40db2e2bSzf162725 #define RAL_TX_OFDM (1 << 11) 168*40db2e2bSzf162725 #define RAL_TX_NEWSEQ (1 << 12) 169*40db2e2bSzf162725 170*40db2e2bSzf162725 #define RAL_TX_IFS_MASK 0x00006000 171*40db2e2bSzf162725 #define RAL_TX_IFS_BACKOFF (0 << 13) 172*40db2e2bSzf162725 #define RAL_TX_IFS_SIFS (1 << 13) 173*40db2e2bSzf162725 #define RAL_TX_IFS_NEWBACKOFF (2 << 13) 174*40db2e2bSzf162725 #define RAL_TX_IFS_NONE (3 << 13) 175*40db2e2bSzf162725 176*40db2e2bSzf162725 uint16_t wme; 177*40db2e2bSzf162725 #define RAL_LOGCWMAX(x) (((x) & 0xf) << 12) 178*40db2e2bSzf162725 #define RAL_LOGCWMIN(x) (((x) & 0xf) << 8) 179*40db2e2bSzf162725 #define RAL_AIFSN(x) (((x) & 0x3) << 6) 180*40db2e2bSzf162725 #define RAL_IVOFFSET(x) (((x) & 0x3f)) 181*40db2e2bSzf162725 182*40db2e2bSzf162725 uint16_t reserved1; 183*40db2e2bSzf162725 uint8_t plcp_signal; 184*40db2e2bSzf162725 uint8_t plcp_service; 185*40db2e2bSzf162725 #define RAL_PLCP_LENGEXT 0x80 186*40db2e2bSzf162725 187*40db2e2bSzf162725 uint8_t plcp_length_lo; 188*40db2e2bSzf162725 uint8_t plcp_length_hi; 189*40db2e2bSzf162725 uint32_t iv; 190*40db2e2bSzf162725 uint32_t eiv; 191*40db2e2bSzf162725 }; 192*40db2e2bSzf162725 #pragma pack() 193*40db2e2bSzf162725 194*40db2e2bSzf162725 #pragma pack(1) 195*40db2e2bSzf162725 struct ural_rx_desc { 196*40db2e2bSzf162725 uint32_t flags; 197*40db2e2bSzf162725 #define RAL_RX_CRC_ERROR (1 << 5) 198*40db2e2bSzf162725 #define RAL_RX_OFDM (1 << 6) 199*40db2e2bSzf162725 #define RAL_RX_PHY_ERROR (1 << 7) 200*40db2e2bSzf162725 201*40db2e2bSzf162725 uint8_t rssi; 202*40db2e2bSzf162725 uint8_t rate; 203*40db2e2bSzf162725 uint16_t reserved; 204*40db2e2bSzf162725 205*40db2e2bSzf162725 uint32_t iv; 206*40db2e2bSzf162725 uint32_t eiv; 207*40db2e2bSzf162725 }; 208*40db2e2bSzf162725 #pragma pack() 209*40db2e2bSzf162725 210*40db2e2bSzf162725 #define RAL_RF_LOBUSY (1 << 15) 211*40db2e2bSzf162725 #define RAL_RF_BUSY ((uint32_t)1 << 31) 212*40db2e2bSzf162725 #define RAL_RF_20BIT (20 << 24) 213*40db2e2bSzf162725 214*40db2e2bSzf162725 #define RAL_RF1 0 215*40db2e2bSzf162725 #define RAL_RF2 2 216*40db2e2bSzf162725 #define RAL_RF3 1 217*40db2e2bSzf162725 #define RAL_RF4 3 218*40db2e2bSzf162725 219*40db2e2bSzf162725 #define RAL_EEPROM_ADDRESS 0x0004 220*40db2e2bSzf162725 #define RAL_EEPROM_TXPOWER 0x003c 221*40db2e2bSzf162725 #define RAL_EEPROM_CONFIG0 0x0016 222*40db2e2bSzf162725 #define RAL_EEPROM_BBP_BASE 0x001c 223*40db2e2bSzf162725 224*40db2e2bSzf162725 #ifdef __cplusplus 225*40db2e2bSzf162725 } 226*40db2e2bSzf162725 #endif 227*40db2e2bSzf162725 228*40db2e2bSzf162725 #endif /* _URAL_REG_H */ 229