#ifndef _DEV_ATH_AR5210REG_H
#define _DEV_ATH_AR5210REG_H
#ifndef PCI_VENDOR_ATHEROS
#define PCI_VENDOR_ATHEROS 0x168c
#endif
#define PCI_PRODUCT_ATHEROS_AR5210 0x0007
#define PCI_PRODUCT_ATHEROS_AR5210_OLD 0x0004
#define AR_TXDP0 0x0000
#define AR_TXDP1 0x0004
#define AR_CR 0x0008
#define AR_RXDP 0x000c
#define AR_CFG 0x0014
#define AR_ISR 0x001c
#define AR_IMR 0x0020
#define AR_IER 0x0024
#define AR_BCR 0x0028
#define AR_BSR 0x002c
#define AR_TXCFG 0x0030
#define AR_RXCFG 0x0034
#define AR_MIBC 0x0040
#define AR_TOPS 0x0044
#define AR_RXNOFRM 0x0048
#define AR_TXNOFRM 0x004c
#define AR_RPGTO 0x0050
#define AR_RFCNT 0x0054
#define AR_MISC 0x0058
#define AR_RC 0x4000
#define AR_SCR 0x4004
#define AR_INTPEND 0x4008
#define AR_SFR 0x400c
#define AR_PCICFG 0x4010
#define AR_GPIOCR 0x4014
#define AR_GPIODO 0x4018
#define AR_GPIODI 0x401c
#define AR_SREV 0x4020
#define AR_EP_AIR_BASE 0x6000
#define AR_EP_AIR(n) (AR_EP_AIR_BASE + (n)*4)
#define AR_EP_RDATA 0x6800
#define AR_EP_STA 0x6c00
#define AR_STA_ID0 0x8000
#define AR_STA_ID1 0x8004
#define AR_BSS_ID0 0x8008
#define AR_BSS_ID1 0x800c
#define AR_SLOT_TIME 0x8010
#define AR_TIME_OUT 0x8014
#define AR_RSSI_THR 0x8018
#define AR_RETRY_LMT 0x801c
#define AR_USEC 0x8020
#define AR_BEACON 0x8024
#define AR_CFP_PERIOD 0x8028
#define AR_TIMER0 0x802c
#define AR_TIMER1 0x8030
#define AR_TIMER2 0x8034
#define AR_TIMER3 0x8038
#define AR_IFS0 0x8040
#define AR_IFS1 0x8044
#define AR_CFP_DUR 0x8048
#define AR_RX_FILTER 0x804c
#define AR_MCAST_FIL0 0x8050
#define AR_MCAST_FIL1 0x8054
#define AR_TX_MASK0 0x8058
#define AR_TX_MASK1 0x805c
#define AR_CLR_TMASK 0x8060
#define AR_TRIG_LEV 0x8064
#define AR_DIAG_SW 0x8068
#define AR_TSF_L32 0x806c
#define AR_TSF_U32 0x8070
#define AR_LAST_TSTP 0x8080
#define AR_RETRY_CNT 0x8084
#define AR_BACKOFF 0x8088
#define AR_NAV 0x808c
#define AR_RTS_OK 0x8090
#define AR_RTS_FAIL 0x8094
#define AR_ACK_FAIL 0x8098
#define AR_FCS_FAIL 0x809c
#define AR_BEACON_CNT 0x80a0
#define AR_KEYTABLE_0 0x9000
#define AR_KEYTABLE(n) (AR_KEYTABLE_0 + ((n)*32))
#define AR_CR_TXE0 0x00000001
#define AR_CR_TXE1 0x00000002
#define AR_CR_RXE 0x00000004
#define AR_CR_TXD0 0x00000008
#define AR_CR_TXD1 0x00000010
#define AR_CR_RXD 0x00000020
#define AR_CR_SWI 0x00000040
#define AR_CR_BITS \
"\20\1TXE0\2TXE1\3RXE\4TXD0\5TXD1\6RXD\7SWI"
#define AR_CFG_SWTD 0x00000001
#define AR_CFG_SWTB 0x00000002
#define AR_CFG_SWRD 0x00000004
#define AR_CFG_SWRB 0x00000008
#define AR_CFG_SWRG 0x00000010
#define AR_CFG_EEBS 0x00000200
#define AR_CFG_TXCNT 0x00007800
#define AR_CFG_TXCNT_S 11
#define AR_CFG_TXFSTAT 0x00008000
#define AR_CFG_TXFSTRT 0x00010000
#define AR_CFG_BITS \
"\20\1SWTD\2SWTB\3SWRD\4SWRB\5SWRG\14EEBS\17TXFSTAT\20TXFSTRT"
#define AR_ISR_RXOK_INT 0x00000001
#define AR_ISR_RXDESC_INT 0x00000002
#define AR_ISR_RXERR_INT 0x00000004
#define AR_ISR_RXNOFRM_INT 0x00000008
#define AR_ISR_RXEOL_INT 0x00000010
#define AR_ISR_RXORN_INT 0x00000020
#define AR_ISR_TXOK_INT 0x00000040
#define AR_ISR_TXDESC_INT 0x00000080
#define AR_ISR_TXERR_INT 0x00000100
#define AR_ISR_TXNOFRM_INT 0x00000200
#define AR_ISR_TXEOL_INT 0x00000400
#define AR_ISR_TXURN_INT 0x00000800
#define AR_ISR_MIB_INT 0x00001000
#define AR_ISR_SWI_INT 0x00002000
#define AR_ISR_RXPHY_INT 0x00004000
#define AR_ISR_RXKCM_INT 0x00008000
#define AR_ISR_SWBA_INT 0x00010000
#define AR_ISR_BRSSI_INT 0x00020000
#define AR_ISR_BMISS_INT 0x00040000
#define AR_ISR_MCABT_INT 0x00100000
#define AR_ISR_SSERR_INT 0x00200000
#define AR_ISR_DPERR_INT 0x00400000
#define AR_ISR_GPIO_INT 0x01000000
#define AR_ISR_BITS \
"\20\1RXOK\2RXDESC\3RXERR\4RXNOFM\5RXEOL\6RXORN\7TXOK\10TXDESC"\
"\11TXERR\12TXNOFRM\13TXEOL\14TXURN\15MIB\16SWI\17RXPHY\20RXKCM"\
"\21SWBA\22BRSSI\23BMISS\24MCABT\25SSERR\26DPERR\27GPIO"
#define AR_IMR_RXOK_INT 0x00000001
#define AR_IMR_RXDESC_INT 0x00000002
#define AR_IMR_RXERR_INT 0x00000004
#define AR_IMR_RXNOFRM_INT 0x00000008
#define AR_IMR_RXEOL_INT 0x00000010
#define AR_IMR_RXORN_INT 0x00000020
#define AR_IMR_TXOK_INT 0x00000040
#define AR_IMR_TXDESC_INT 0x00000080
#define AR_IMR_TXERR_INT 0x00000100
#define AR_IMR_TXNOFRM_INT 0x00000200
#define AR_IMR_TXEOL_INT 0x00000400
#define AR_IMR_TXURN_INT 0x00000800
#define AR_IMR_MIB_INT 0x00001000
#define AR_IMR_SWI_INT 0x00002000
#define AR_IMR_RXPHY_INT 0x00004000
#define AR_IMR_RXKCM_INT 0x00008000
#define AR_IMR_SWBA_INT 0x00010000
#define AR_IMR_BRSSI_INT 0x00020000
#define AR_IMR_BMISS_INT 0x00040000
#define AR_IMR_MCABT_INT 0x00100000
#define AR_IMR_SSERR_INT 0x00200000
#define AR_IMR_DPERR_INT 0x00400000
#define AR_IMR_GPIO_INT 0x01000000
#define AR_IMR_BITS AR_ISR_BITS
#define AR_IER_DISABLE 0x00000000
#define AR_IER_ENABLE 0x00000001
#define AR_IER_BITS "\20\1ENABLE"
#define AR_BCR_BCMD 0x00000001
#define AR_BCR_BDMAE 0x00000002
#define AR_BCR_TQ1FV 0x00000004
#define AR_BCR_TQ1V 0x00000008
#define AR_BCR_BCGET 0x00000010
#define AR_BCR_BITS "\20\1BCMD\2BDMAE\3TQ1FV\4TQ1V\5BCGET"
#define AR_BSR_BDLYSW 0x00000001
#define AR_BSR_BDLYDMA 0x00000002
#define AR_BSR_TXQ1F 0x00000004
#define AR_BSR_ATIMDLY 0x00000008
#define AR_BSR_SNPBCMD 0x00000100
#define AR_BSR_SNPBDMAE 0x00000200
#define AR_BSR_SNPTQ1FV 0x00000400
#define AR_BSR_SNPTQ1V 0x00000800
#define AR_BSR_SNAPPEDBCRVALID 0x00001000
#define AR_BSR_SWBA_CNT 0x00ff0000
#define AR_BSR_BITS \
"\20\1BDLYSW\2BDLYDMA\3TXQ1F\4ATIMDLY\11SNPBCMD\12SNPBDMAE"\
"\13SNPTQ1FV\14SNPTQ1V\15SNAPPEDBCRVALID"
#define AR_TXCFG_SDMAMR 0x00000007
#define AR_TXCFG_TXFSTP 0x00000008
#define AR_TXCFG_TXFULL 0x00000070
#define AR_TXCFG_TXCONT_EN 0x00000080
#define AR_TXCFG_BITS "\20\3TXFSTP\7TXCONT_EN"
#define AR_RXCFG_SDMAMW 0x00000007
#define AR_RXCFG_ZLFDMA 0x00000010
#define AR_DMASIZE_4B 0
#define AR_DMASIZE_8B 1
#define AR_DMASIZE_16B 2
#define AR_DMASIZE_32B 3
#define AR_DMASIZE_64B 4
#define AR_DMASIZE_128B 5
#define AR_DMASIZE_256B 6
#define AR_DMASIZE_512B 7
#define AR_MIBC_COW 0x00000001
#define AR_MIBC_FMC 0x00000002
#define AR_MIBC_CMC 0x00000004
#define AR_MIBC_MCS 0x00000008
#define AR_RFCNT_RFCL 0x0000000f
#define AR_MISC_LED_DECAY 0x001c0000
#define AR_MISC_LED_BLINK 0x00e00000
#define AR_RC_RPCU 0x00000001
#define AR_RC_RDMA 0x00000002
#define AR_RC_RMAC 0x00000004
#define AR_RC_RPHY 0x00000008
#define AR_RC_RPCI 0x00000010
#define AR_RC_BITS "\20\1RPCU\2RDMA\3RMAC\4RPHY\5RPCI"
#define AR_SCR_SLDUR 0x0000ffff
#define AR_SCR_SLE 0x00030000
#define AR_SCR_SLE_S 16
#define AR_SCR_SLE_WAKE 0
#define AR_SCR_SLE_SLP 1
#define AR_SCR_SLE_ALLOW 2
#define AR_SCR_BITS "\20\20SLE_SLP\21SLE_ALLOW"
#define AR_INTPEND_IP 0x00000001
#define AR_INTPEND_BITS "\20\1IP"
#define AR_SFR_SF 0x00000001
#define AR_PCICFG_EEPROMSEL 0x00000001
#define AR_PCICFG_CLKRUNEN 0x00000004
#define AR_PCICFG_LED_PEND 0x00000020
#define AR_PCICFG_LED_ACT 0x00000040
#define AR_PCICFG_SL_INTEN 0x00000800
#define AR_PCICFG_LED_BCTL 0x00001000
#define AR_PCICFG_SL_INPEN 0x00002800
#define AR_PCICFG_SPWR_DN 0x00010000
#define AR_PCICFG_BITS \
"\20\1EEPROMSEL\3CLKRUNEN\5LED_PEND\6LED_ACT\13SL_INTEN"\
"\14LED_BCTL\20SPWR_DN"
#define AR_GPIOCR_IN(n) (0<<((n)*2))
#define AR_GPIOCR_OUT0(n) (1<<((n)*2))
#define AR_GPIOCR_OUT1(n) (2<<((n)*2))
#define AR_GPIOCR_OUT(n) (3<<((n)*2))
#define AR_GPIOCR_ALL(n) (3<<((n)*2))
#define AR_GPIOCR_INT_SEL(n) ((n)<<12)
#define AR_GPIOCR_INT_ENA 0x00008000
#define AR_GPIOCR_INT_SELL 0x00000000
#define AR_GPIOCR_INT_SELH 0x00010000
#define AR_SREV_CRETE 4
#define AR_SREV_CRETE_MS 5
#define AR_SREV_CRETE_23 8
#define AR_EP_STA_RDERR 0x00000001
#define AR_EP_STA_RDCMPLT 0x00000002
#define AR_EP_STA_WRERR 0x00000004
#define AR_EP_STA_WRCMPLT 0x00000008
#define AR_EP_STA_BITS \
"\20\1RDERR\2RDCMPLT\3WRERR\4WRCMPLT"
#define AR_STA_ID1_AP 0x00010000
#define AR_STA_ID1_ADHOC 0x00020000
#define AR_STA_ID1_PWR_SV 0x00040000
#define AR_STA_ID1_NO_KEYSRCH 0x00080000
#define AR_STA_ID1_NO_PSPOLL 0x00100000
#define AR_STA_ID1_PCF 0x00200000
#define AR_STA_ID1_DESC_ANTENNA 0x00400000
#define AR_STA_ID1_DEFAULT_ANTENNA 0x00800000
#define AR_STA_ID1_ACKCTS_6MB 0x01000000
#define AR_STA_ID1_BITS \
"\20\20AP\21ADHOC\22PWR_SV\23NO_KEYSRCH\24NO_PSPOLL\25PCF"\
"\26DESC_ANTENNA\27DEFAULT_ANTENNA\30ACKCTS_6MB"
#define AR_BSS_ID1_AID 0xffff0000
#define AR_BSS_ID1_AID_S 16
#define AR_TIME_OUT_ACK 0x00001fff
#define AR_TIME_OUT_ACK_S 0
#define AR_TIME_OUT_CTS 0x1fff0000
#define AR_TIME_OUT_CTS_S 16
#define AR_RSSI_THR_BM_THR 0x00000700
#define AR_RSSI_THR_BM_THR_S 8
#define AR_RETRY_LMT_SH_RETRY 0x0000000f
#define AR_RETRY_LMT_SH_RETRY_S 0
#define AR_RETRY_LMT_LG_RETRY 0x000000f0
#define AR_RETRY_LMT_LG_RETRY_S 4
#define AR_RETRY_LMT_SSH_RETRY 0x00003f00
#define AR_RETRY_LMT_SSH_RETRY_S 8
#define AR_RETRY_LMT_SLG_RETRY 0x000fc000
#define AR_RETRY_LMT_SLG_RETRY_S 14
#define AR_RETRY_LMT_CW_MIN 0x3ff00000
#define AR_RETRY_LMT_CW_MIN_S 20
#define AR_USEC_1 0x0000007f
#define AR_USEC_1_S 0
#define AR_USEC_32 0x00003f80
#define AR_USEC_32_S 7
#define AR_USEC_TX_LATENCY 0x000fc000
#define AR_USEC_TX_LATENCY_S 14
#define AR_USEC_RX_LATENCY 0x03f00000
#define AR_USEC_RX_LATENCY_S 20
#define AR_BEACON_PERIOD 0x0000ffff
#define AR_BEACON_PERIOD_S 0
#define AR_BEACON_TIM 0x007f0000
#define AR_BEACON_TIM_S 16
#define AR_BEACON_EN 0x00800000
#define AR_BEACON_RESET_TSF 0x01000000
#define AR_BEACON_BITS "\20\27ENABLE\30RESET_TSF"
#define AR_IFS0_SIFS 0x000007ff
#define AR_IFS0_SIFS_S 0
#define AR_IFS0_DIFS 0x007ff800
#define AR_IFS0_DIFS_S 11
#define AR_IFS1_PIFS 0x00000fff
#define AR_IFS1_PIFS_S 0
#define AR_IFS1_EIFS 0x03fff000
#define AR_IFS1_EIFS_S 12
#define AR_IFS1_CS_EN 0x04000000
#define AR_RX_FILTER_UNICAST 0x00000001
#define AR_RX_FILTER_MULTICAST 0x00000002
#define AR_RX_FILTER_BROADCAST 0x00000004
#define AR_RX_FILTER_CONTROL 0x00000008
#define AR_RX_FILTER_BEACON 0x00000010
#define AR_RX_FILTER_PROMISCUOUS 0x00000020
#define AR_RX_FILTER_BITS \
"\20\1UCAST\2MCAST\3BCAST\4CONTROL\5BEACON\6PROMISC"
#define AR_DIAG_SW_DIS_WEP_ACK 0x00000001
#define AR_DIAG_SW_DIS_ACK 0x00000002
#define AR_DIAG_SW_DIS_CTS 0x00000004
#define AR_DIAG_SW_DIS_ENC 0x00000008
#define AR_DIAG_SW_DIS_DEC 0x00000010
#define AR_DIAG_SW_DIS_TX 0x00000020
#define AR_DIAG_SW_DIS_RX 0x00000040
#define AR_DIAG_SW_LOOP_BACK 0x00000080
#define AR_DIAG_SW_CORR_FCS 0x00000100
#define AR_DIAG_SW_CHAN_INFO 0x00000200
#define AR_DIAG_SW_EN_SCRAM_SEED 0x00000400
#define AR_DIAG_SW_SCVRAM_SEED 0x0003f800
#define AR_DIAG_SW_DIS_SEQ_INC 0x00040000
#define AR_DIAG_SW_FRAME_NV0 0x00080000
#define AR_DIAG_SW_DIS_CRYPTO (AR_DIAG_SW_DIS_ENC | AR_DIAG_SW_DIS_DEC)
#define AR_DIAG_SW_BITS \
"\20\1DIS_WEP_ACK\2DIS_ACK\3DIS_CTS\4DIS_ENC\5DIS_DEC\6DIS_TX"\
"\7DIS_RX\10LOOP_BACK\11CORR_FCS\12CHAN_INFO\13EN_SCRAM_SEED"\
"\22DIS_SEQ_INC\24FRAME_NV0"
#define AR_RETRY_CNT_SSH 0x0000003f
#define AR_RETRY_CNT_SLG 0x00000fc0
#define AR_BACKOFF_CW 0x000003ff
#define AR_BACKOFF_CNT 0x03ff0000
#define AR_KEYTABLE_KEY0(n) (AR_KEYTABLE(n) + 0)
#define AR_KEYTABLE_KEY1(n) (AR_KEYTABLE(n) + 4)
#define AR_KEYTABLE_KEY2(n) (AR_KEYTABLE(n) + 8)
#define AR_KEYTABLE_KEY3(n) (AR_KEYTABLE(n) + 12)
#define AR_KEYTABLE_KEY4(n) (AR_KEYTABLE(n) + 16)
#define AR_KEYTABLE_TYPE(n) (AR_KEYTABLE(n) + 20)
#define AR_KEYTABLE_TYPE_40 0x00000000
#define AR_KEYTABLE_TYPE_104 0x00000001
#define AR_KEYTABLE_TYPE_128 0x00000003
#define AR_KEYTABLE_MAC0(n) (AR_KEYTABLE(n) + 24)
#define AR_KEYTABLE_MAC1(n) (AR_KEYTABLE(n) + 28)
#define AR_KEYTABLE_VALID 0x00008000
#endif