reg.h
Go to the documentation of this file.
00001 /*------------------------------------------------------------------------------
00002  *-------------------------        ATH5K Driver          -----------------------
00003  *------------------------------------------------------------------------------
00004  *                                                           V1.0  08/02/2010
00005  *
00006  *
00007  *  Feb 2010 - Samuel Cabrero <samuelcabrero@gmail.com>
00008  *              Initial release
00009  *
00010  *  ----------------------------------------------------------------------------
00011  *  Copyright (C) 2000-2010, Universidad de Zaragoza, SPAIN
00012  *
00013  *  Autors:
00014  *              Samuel Cabrero        <samuelcabrero@gmail.com>
00015  *              Danilo Tardioli       <dantard@unizar.es>
00016  *              Jose Luis Villarroel  <jlvilla@unizar.es>
00017  *
00018  *  This is a simplified version of the original ath5k driver. It should work 
00019  *  with all Atheros 5xxx WLAN cards. The 802.11 layer have been removed so it
00020  *  just send and receive frames over the air, as if it were an Ethernet bus
00021  *  interface.
00022  *
00023  *  Please read ath5k_interface.h for instructions.
00024  *
00025  *  This program is distributed under the terms of GPL version 2 and in the 
00026  *  hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 
00027  *  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00028  *  See the GNU General Public License for more details.
00029  *
00030  *----------------------------------------------------------------------------*/
00031 
00032 /*
00033  * Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com>
00034  * Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org>
00035  * Copyright (c) 2007-2008 Michael Taylor <mike.taylor@apprion.com>
00036  *
00037  * Permission to use, copy, modify, and distribute this software for any
00038  * purpose with or without fee is hereby granted, provided that the above
00039  * copyright notice and this permission notice appear in all copies.
00040  *
00041  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00042  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00043  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
00044  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00045  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00046  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00047  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00048  *
00049  */
00050 
00051 /*
00052  * Register values for Atheros 5210/5211/5212 cards from OpenBSD's ar5k
00053  * maintained by Reyk Floeter
00054  *
00055  * I tried to document those registers by looking at ar5k code, some
00056  * 802.11 (802.11e mostly) papers and by reading various public available
00057  * Atheros presentations and papers like these:
00058  *
00059  * 5210 - http://nova.stanford.edu/~bbaas/ps/isscc2002_slides.pdf
00060  *        http://www.it.iitb.ac.in/~janak/wifire/01222734.pdf
00061  *
00062  * 5211 - http://www.hotchips.org/archives/hc14/3_Tue/16_mcfarland.pdf
00063  *
00064  * This file also contains register values found on a memory dump of
00065  * Atheros's ART program (Atheros Radio Test), on ath9k, on legacy-hal
00066  * released by Atheros and on various debug messages found on the net.
00067  */
00068 
00069 
00070 
00071 /*====MAC DMA REGISTERS====*/
00072 
00073 /*
00074  * AR5210-Specific TXDP registers
00075  * 5210 has only 2 transmit queues so no DCU/QCU, just
00076  * 2 transmit descriptor pointers...
00077  */
00078 #define AR5K_NOQCU_TXDP0        0x0000          /* Queue 0 - data */
00079 #define AR5K_NOQCU_TXDP1        0x0004          /* Queue 1 - beacons */
00080 
00081 /*
00082  * Mac Control Register
00083  */
00084 #define AR5K_CR         0x0008                  /* Register Address */
00085 #define AR5K_CR_TXE0    0x00000001      /* TX Enable for queue 0 on 5210 */
00086 #define AR5K_CR_TXE1    0x00000002      /* TX Enable for queue 1 on 5210 */
00087 #define AR5K_CR_RXE     0x00000004      /* RX Enable */
00088 #define AR5K_CR_TXD0    0x00000008      /* TX Disable for queue 0 on 5210 */
00089 #define AR5K_CR_TXD1    0x00000010      /* TX Disable for queue 1 on 5210 */
00090 #define AR5K_CR_RXD     0x00000020      /* RX Disable */
00091 #define AR5K_CR_SWI     0x00000040      /* Software Interrupt */
00092 
00093 /*
00094  * RX Descriptor Pointer register
00095  */
00096 #define AR5K_RXDP       0x000c
00097 
00098 /*
00099  * Configuration and status register
00100  */
00101 #define AR5K_CFG                0x0014                  /* Register Address */
00102 #define AR5K_CFG_SWTD           0x00000001      /* Byte-swap TX descriptor (for big endian archs) */
00103 #define AR5K_CFG_SWTB           0x00000002      /* Byte-swap TX buffer */
00104 #define AR5K_CFG_SWRD           0x00000004      /* Byte-swap RX descriptor */
00105 #define AR5K_CFG_SWRB           0x00000008      /* Byte-swap RX buffer */
00106 #define AR5K_CFG_SWRG           0x00000010      /* Byte-swap Register access */
00107 #define AR5K_CFG_IBSS           0x00000020      /* 0-BSS, 1-IBSS [5211+] */
00108 #define AR5K_CFG_PHY_OK         0x00000100      /* [5211+] */
00109 #define AR5K_CFG_EEBS           0x00000200      /* EEPROM is busy */
00110 #define AR5K_CFG_CLKGD          0x00000400      /* Clock gated (Disable dynamic clock) */
00111 #define AR5K_CFG_TXCNT          0x00007800      /* Tx frame count (?) [5210] */
00112 #define AR5K_CFG_TXCNT_S        11
00113 #define AR5K_CFG_TXFSTAT        0x00008000      /* Tx frame status (?) [5210] */
00114 #define AR5K_CFG_TXFSTRT        0x00010000      /* [5210] */
00115 #define AR5K_CFG_PCI_THRES      0x00060000      /* PCI Master req q threshold [5211+] */
00116 #define AR5K_CFG_PCI_THRES_S    17
00117 
00118 /*
00119  * Interrupt enable register
00120  */
00121 #define AR5K_IER                0x0024          /* Register Address */
00122 #define AR5K_IER_DISABLE        0x00000000      /* Disable card interrupts */
00123 #define AR5K_IER_ENABLE         0x00000001      /* Enable card interrupts */
00124 
00125 
00126 /*
00127  * 0x0028 is Beacon Control Register on 5210
00128  * and first RTS duration register on 5211
00129  */
00130 
00131 /*
00132  * Beacon control register [5210]
00133  */
00134 #define AR5K_BCR                0x0028          /* Register Address */
00135 #define AR5K_BCR_AP             0x00000000      /* AP mode */
00136 #define AR5K_BCR_ADHOC          0x00000001      /* Ad-Hoc mode */
00137 #define AR5K_BCR_BDMAE          0x00000002      /* DMA enable */
00138 #define AR5K_BCR_TQ1FV          0x00000004      /* Use Queue1 for CAB traffic */
00139 #define AR5K_BCR_TQ1V           0x00000008      /* Use Queue1 for Beacon traffic */
00140 #define AR5K_BCR_BCGET          0x00000010
00141 
00142 /*
00143  * First RTS duration register [5211]
00144  */
00145 #define AR5K_RTSD0              0x0028          /* Register Address */
00146 #define AR5K_RTSD0_6            0x000000ff      /* 6Mb RTS duration mask (?) */
00147 #define AR5K_RTSD0_6_S          0               /* 6Mb RTS duration shift (?) */
00148 #define AR5K_RTSD0_9            0x0000ff00      /* 9Mb*/
00149 #define AR5K_RTSD0_9_S          8
00150 #define AR5K_RTSD0_12           0x00ff0000      /* 12Mb*/
00151 #define AR5K_RTSD0_12_S         16
00152 #define AR5K_RTSD0_18           0xff000000      /* 16Mb*/
00153 #define AR5K_RTSD0_18_S         24
00154 
00155 
00156 /*
00157  * 0x002c is Beacon Status Register on 5210
00158  * and second RTS duration register on 5211
00159  */
00160 
00161 /*
00162  * Beacon status register [5210]
00163  *
00164  * As i can see in ar5k_ar5210_tx_start Reyk uses some of the values of BCR
00165  * for this register, so i guess TQ1V,TQ1FV and BDMAE have the same meaning
00166  * here and SNP/SNAP means "snapshot" (so this register gets synced with BCR).
00167  * So SNAPPEDBCRVALID sould also stand for "snapped BCR -values- valid", so i
00168  * renamed it to SNAPSHOTSVALID to make more sense. I realy have no idea what
00169  * else can it be. I also renamed SNPBCMD to SNPADHOC to match BCR.
00170  */
00171 #define AR5K_BSR                0x002c                  /* Register Address */
00172 #define AR5K_BSR_BDLYSW         0x00000001      /* SW Beacon delay (?) */
00173 #define AR5K_BSR_BDLYDMA        0x00000002      /* DMA Beacon delay (?) */
00174 #define AR5K_BSR_TXQ1F          0x00000004      /* Beacon queue (1) finished */
00175 #define AR5K_BSR_ATIMDLY        0x00000008      /* ATIM delay (?) */
00176 #define AR5K_BSR_SNPADHOC       0x00000100      /* Ad-hoc mode set (?) */
00177 #define AR5K_BSR_SNPBDMAE       0x00000200      /* Beacon DMA enabled (?) */
00178 #define AR5K_BSR_SNPTQ1FV       0x00000400      /* Queue1 is used for CAB traffic (?) */
00179 #define AR5K_BSR_SNPTQ1V        0x00000800      /* Queue1 is used for Beacon traffic (?) */
00180 #define AR5K_BSR_SNAPSHOTSVALID 0x00001000      /* BCR snapshots are valid (?) */
00181 #define AR5K_BSR_SWBA_CNT       0x00ff0000
00182 
00183 /*
00184  * Second RTS duration register [5211]
00185  */
00186 #define AR5K_RTSD1              0x002c                  /* Register Address */
00187 #define AR5K_RTSD1_24           0x000000ff      /* 24Mb */
00188 #define AR5K_RTSD1_24_S         0
00189 #define AR5K_RTSD1_36           0x0000ff00      /* 36Mb */
00190 #define AR5K_RTSD1_36_S         8
00191 #define AR5K_RTSD1_48           0x00ff0000      /* 48Mb */
00192 #define AR5K_RTSD1_48_S         16
00193 #define AR5K_RTSD1_54           0xff000000      /* 54Mb */
00194 #define AR5K_RTSD1_54_S         24
00195 
00196 
00197 /*
00198  * Transmit configuration register
00199  */
00200 #define AR5K_TXCFG                      0x0030                  /* Register Address */
00201 #define AR5K_TXCFG_SDMAMR               0x00000007      /* DMA size (read) */
00202 #define AR5K_TXCFG_SDMAMR_S             0
00203 #define AR5K_TXCFG_B_MODE               0x00000008      /* Set b mode for 5111 (enable 2111) */
00204 #define AR5K_TXCFG_TXFSTP               0x00000008      /* TX DMA full Stop [5210] */
00205 #define AR5K_TXCFG_TXFULL               0x000003f0      /* TX Triger level mask */
00206 #define AR5K_TXCFG_TXFULL_S             4
00207 #define AR5K_TXCFG_TXFULL_0B            0x00000000
00208 #define AR5K_TXCFG_TXFULL_64B           0x00000010
00209 #define AR5K_TXCFG_TXFULL_128B          0x00000020
00210 #define AR5K_TXCFG_TXFULL_192B          0x00000030
00211 #define AR5K_TXCFG_TXFULL_256B          0x00000040
00212 #define AR5K_TXCFG_TXCONT_EN            0x00000080
00213 #define AR5K_TXCFG_DMASIZE              0x00000100      /* Flag for passing DMA size [5210] */
00214 #define AR5K_TXCFG_JUMBO_DESC_EN        0x00000400      /* Enable jumbo tx descriptors [5211+] */
00215 #define AR5K_TXCFG_ADHOC_BCN_ATIM       0x00000800      /* Adhoc Beacon ATIM Policy */
00216 #define AR5K_TXCFG_ATIM_WINDOW_DEF_DIS  0x00001000      /* Disable ATIM window defer [5211+] */
00217 #define AR5K_TXCFG_RTSRND               0x00001000      /* [5211+] */
00218 #define AR5K_TXCFG_FRMPAD_DIS           0x00002000      /* [5211+] */
00219 #define AR5K_TXCFG_RDY_CBR_DIS          0x00004000      /* Ready time CBR disable [5211+] */
00220 #define AR5K_TXCFG_JUMBO_FRM_MODE       0x00008000      /* Jumbo frame mode [5211+] */
00221 #define AR5K_TXCFG_DCU_DBL_BUF_DIS      0x00008000      /* Disable double buffering on DCU */
00222 #define AR5K_TXCFG_DCU_CACHING_DIS      0x00010000      /* Disable DCU caching */
00223 
00224 /*
00225  * Receive configuration register
00226  */
00227 #define AR5K_RXCFG              0x0034                  /* Register Address */
00228 #define AR5K_RXCFG_SDMAMW       0x00000007      /* DMA size (write) */
00229 #define AR5K_RXCFG_SDMAMW_S     0
00230 #define AR5K_RXCFG_ZLFDMA       0x00000008      /* Enable Zero-length frame DMA */
00231 #define AR5K_RXCFG_DEF_ANTENNA  0x00000010      /* Default antenna (?) */
00232 #define AR5K_RXCFG_JUMBO_RXE    0x00000020      /* Enable jumbo rx descriptors [5211+] */
00233 #define AR5K_RXCFG_JUMBO_WRAP   0x00000040      /* Wrap jumbo frames [5211+] */
00234 #define AR5K_RXCFG_SLE_ENTRY    0x00000080      /* Sleep entry policy */
00235 
00236 /*
00237  * Receive jumbo descriptor last address register
00238  * Only found in 5211 (?)
00239  */
00240 #define AR5K_RXJLA              0x0038
00241 
00242 /*
00243  * MIB control register
00244  */
00245 #define AR5K_MIBC               0x0040                  /* Register Address */
00246 #define AR5K_MIBC_COW           0x00000001      /* Warn test indicator */
00247 #define AR5K_MIBC_FMC           0x00000002      /* Freeze MIB Counters  */
00248 #define AR5K_MIBC_CMC           0x00000004      /* Clean MIB Counters  */
00249 #define AR5K_MIBC_MCS           0x00000008      /* MIB counter strobe */
00250 
00251 /*
00252  * Timeout prescale register
00253  */
00254 #define AR5K_TOPS               0x0044
00255 #define AR5K_TOPS_M             0x0000ffff
00256 
00257 /*
00258  * Receive timeout register (no frame received)
00259  */
00260 #define AR5K_RXNOFRM            0x0048
00261 #define AR5K_RXNOFRM_M          0x000003ff
00262 
00263 /*
00264  * Transmit timeout register (no frame sent)
00265  */
00266 #define AR5K_TXNOFRM            0x004c
00267 #define AR5K_TXNOFRM_M          0x000003ff
00268 #define AR5K_TXNOFRM_QCU        0x000ffc00
00269 #define AR5K_TXNOFRM_QCU_S      10
00270 
00271 /*
00272  * Receive frame gap timeout register
00273  */
00274 #define AR5K_RPGTO              0x0050
00275 #define AR5K_RPGTO_M            0x000003ff
00276 
00277 /*
00278  * Receive frame count limit register
00279  */
00280 #define AR5K_RFCNT              0x0054
00281 #define AR5K_RFCNT_M            0x0000001f      /* [5211+] (?) */
00282 #define AR5K_RFCNT_RFCL         0x0000000f      /* [5210] */
00283 
00284 /*
00285  * Misc settings register
00286  * (reserved0-3)
00287  */
00288 #define AR5K_MISC               0x0058                  /* Register Address */
00289 #define AR5K_MISC_DMA_OBS_M     0x000001e0
00290 #define AR5K_MISC_DMA_OBS_S     5
00291 #define AR5K_MISC_MISC_OBS_M    0x00000e00
00292 #define AR5K_MISC_MISC_OBS_S    9
00293 #define AR5K_MISC_MAC_OBS_LSB_M 0x00007000
00294 #define AR5K_MISC_MAC_OBS_LSB_S 12
00295 #define AR5K_MISC_MAC_OBS_MSB_M 0x00038000
00296 #define AR5K_MISC_MAC_OBS_MSB_S 15
00297 #define AR5K_MISC_LED_DECAY     0x001c0000      /* [5210] */
00298 #define AR5K_MISC_LED_BLINK     0x00e00000      /* [5210] */
00299 
00300 /*
00301  * QCU/DCU clock gating register (5311)
00302  * (reserved4-5)
00303  */
00304 #define AR5K_QCUDCU_CLKGT       0x005c                  /* Register Address (?) */
00305 #define AR5K_QCUDCU_CLKGT_QCU   0x0000ffff      /* Mask for QCU clock */
00306 #define AR5K_QCUDCU_CLKGT_DCU   0x07ff0000      /* Mask for DCU clock */
00307 
00308 /*
00309  * Interrupt Status Registers
00310  *
00311  * For 5210 there is only one status register but for
00312  * 5211/5212 we have one primary and 4 secondary registers.
00313  * So we have AR5K_ISR for 5210 and AR5K_PISR /SISRx for 5211/5212.
00314  * Most of these bits are common for all chipsets.
00315  */
00316 #define AR5K_ISR                0x001c                  /* Register Address [5210] */
00317 #define AR5K_PISR               0x0080                  /* Register Address [5211+] */
00318 #define AR5K_ISR_RXOK           0x00000001      /* Frame successfuly recieved */
00319 #define AR5K_ISR_RXDESC         0x00000002      /* RX descriptor request */
00320 #define AR5K_ISR_RXERR          0x00000004      /* Receive error */
00321 #define AR5K_ISR_RXNOFRM        0x00000008      /* No frame received (receive timeout) */
00322 #define AR5K_ISR_RXEOL          0x00000010      /* Empty RX descriptor */
00323 #define AR5K_ISR_RXORN          0x00000020      /* Receive FIFO overrun */
00324 #define AR5K_ISR_TXOK           0x00000040      /* Frame successfuly transmited */
00325 #define AR5K_ISR_TXDESC         0x00000080      /* TX descriptor request */
00326 #define AR5K_ISR_TXERR          0x00000100      /* Transmit error */
00327 #define AR5K_ISR_TXNOFRM        0x00000200      /* No frame transmited (transmit timeout) */
00328 #define AR5K_ISR_TXEOL          0x00000400      /* Empty TX descriptor */
00329 #define AR5K_ISR_TXURN          0x00000800      /* Transmit FIFO underrun */
00330 #define AR5K_ISR_MIB            0x00001000      /* Update MIB counters */
00331 #define AR5K_ISR_SWI            0x00002000      /* Software interrupt */
00332 #define AR5K_ISR_RXPHY          0x00004000      /* PHY error */
00333 #define AR5K_ISR_RXKCM          0x00008000      /* RX Key cache miss */
00334 #define AR5K_ISR_SWBA           0x00010000      /* Software beacon alert */
00335 #define AR5K_ISR_BRSSI          0x00020000      /* Beacon rssi below threshold (?) */
00336 #define AR5K_ISR_BMISS          0x00040000      /* Beacon missed */
00337 #define AR5K_ISR_HIUERR         0x00080000      /* Host Interface Unit error [5211+] */
00338 #define AR5K_ISR_BNR            0x00100000      /* Beacon not ready [5211+] */
00339 #define AR5K_ISR_MCABT          0x00100000      /* Master Cycle Abort [5210] */
00340 #define AR5K_ISR_RXCHIRP        0x00200000      /* CHIRP Received [5212+] */
00341 #define AR5K_ISR_SSERR          0x00200000      /* Signaled System Error [5210] */
00342 #define AR5K_ISR_DPERR          0x00400000      /* Det par Error (?) [5210] */
00343 #define AR5K_ISR_RXDOPPLER      0x00400000      /* Doppler chirp received [5212+] */
00344 #define AR5K_ISR_TIM            0x00800000      /* [5211+] */
00345 #define AR5K_ISR_BCNMISC        0x00800000      /* 'or' of TIM, CAB_END, DTIM_SYNC, BCN_TIMEOUT,
00346                                                 CAB_TIMEOUT and DTIM bits from SISR2 [5212+] */
00347 #define AR5K_ISR_GPIO           0x01000000      /* GPIO (rf kill) */
00348 #define AR5K_ISR_QCBRORN        0x02000000      /* QCU CBR overrun [5211+] */
00349 #define AR5K_ISR_QCBRURN        0x04000000      /* QCU CBR underrun [5211+] */
00350 #define AR5K_ISR_QTRIG          0x08000000      /* QCU scheduling trigger [5211+] */
00351 
00352 /*
00353  * Secondary status registers [5211+] (0 - 4)
00354  *
00355  * These give the status for each QCU, only QCUs 0-9 are
00356  * represented.
00357  */
00358 #define AR5K_SISR0              0x0084                  /* Register Address [5211+] */
00359 #define AR5K_SISR0_QCU_TXOK     0x000003ff      /* Mask for QCU_TXOK */
00360 #define AR5K_SISR0_QCU_TXOK_S   0
00361 #define AR5K_SISR0_QCU_TXDESC   0x03ff0000      /* Mask for QCU_TXDESC */
00362 #define AR5K_SISR0_QCU_TXDESC_S 16
00363 
00364 #define AR5K_SISR1              0x0088                  /* Register Address [5211+] */
00365 #define AR5K_SISR1_QCU_TXERR    0x000003ff      /* Mask for QCU_TXERR */
00366 #define AR5K_SISR1_QCU_TXERR_S  0
00367 #define AR5K_SISR1_QCU_TXEOL    0x03ff0000      /* Mask for QCU_TXEOL */
00368 #define AR5K_SISR1_QCU_TXEOL_S  16
00369 
00370 #define AR5K_SISR2              0x008c                  /* Register Address [5211+] */
00371 #define AR5K_SISR2_QCU_TXURN    0x000003ff      /* Mask for QCU_TXURN */
00372 #define AR5K_SISR2_QCU_TXURN_S  0
00373 #define AR5K_SISR2_MCABT        0x00010000      /* Master Cycle Abort */
00374 #define AR5K_SISR2_SSERR        0x00020000      /* Signaled System Error */
00375 #define AR5K_SISR2_DPERR        0x00040000      /* Bus parity error */
00376 #define AR5K_SISR2_TIM          0x01000000      /* [5212+] */
00377 #define AR5K_SISR2_CAB_END      0x02000000      /* [5212+] */
00378 #define AR5K_SISR2_DTIM_SYNC    0x04000000      /* DTIM sync lost [5212+] */
00379 #define AR5K_SISR2_BCN_TIMEOUT  0x08000000      /* Beacon Timeout [5212+] */
00380 #define AR5K_SISR2_CAB_TIMEOUT  0x10000000      /* CAB Timeout [5212+] */
00381 #define AR5K_SISR2_DTIM         0x20000000      /* [5212+] */
00382 #define AR5K_SISR2_TSFOOR       0x80000000      /* TSF OOR (?) */
00383 
00384 #define AR5K_SISR3              0x0090                  /* Register Address [5211+] */
00385 #define AR5K_SISR3_QCBRORN      0x000003ff      /* Mask for QCBRORN */
00386 #define AR5K_SISR3_QCBRORN_S    0
00387 #define AR5K_SISR3_QCBRURN      0x03ff0000      /* Mask for QCBRURN */
00388 #define AR5K_SISR3_QCBRURN_S    16
00389 
00390 #define AR5K_SISR4              0x0094                  /* Register Address [5211+] */
00391 #define AR5K_SISR4_QTRIG        0x000003ff      /* Mask for QTRIG */
00392 #define AR5K_SISR4_QTRIG_S      0
00393 
00394 /*
00395  * Shadow read-and-clear interrupt status registers [5211+]
00396  */
00397 #define AR5K_RAC_PISR           0x00c0          /* Read and clear PISR */
00398 #define AR5K_RAC_SISR0          0x00c4          /* Read and clear SISR0 */
00399 #define AR5K_RAC_SISR1          0x00c8          /* Read and clear SISR1 */
00400 #define AR5K_RAC_SISR2          0x00cc          /* Read and clear SISR2 */
00401 #define AR5K_RAC_SISR3          0x00d0          /* Read and clear SISR3 */
00402 #define AR5K_RAC_SISR4          0x00d4          /* Read and clear SISR4 */
00403 
00404 /*
00405  * Interrupt Mask Registers
00406  *
00407  * As whith ISRs 5210 has one IMR (AR5K_IMR) and 5211/5212 has one primary
00408  * (AR5K_PIMR) and 4 secondary IMRs (AR5K_SIMRx). Note that ISR/IMR flags match.
00409  */
00410 #define AR5K_IMR                0x0020                  /* Register Address [5210] */
00411 #define AR5K_PIMR               0x00a0                  /* Register Address [5211+] */
00412 #define AR5K_IMR_RXOK           0x00000001      /* Frame successfuly recieved*/
00413 #define AR5K_IMR_RXDESC         0x00000002      /* RX descriptor request*/
00414 #define AR5K_IMR_RXERR          0x00000004      /* Receive error*/
00415 #define AR5K_IMR_RXNOFRM        0x00000008      /* No frame received (receive timeout)*/
00416 #define AR5K_IMR_RXEOL          0x00000010      /* Empty RX descriptor*/
00417 #define AR5K_IMR_RXORN          0x00000020      /* Receive FIFO overrun*/
00418 #define AR5K_IMR_TXOK           0x00000040      /* Frame successfuly transmited*/
00419 #define AR5K_IMR_TXDESC         0x00000080      /* TX descriptor request*/
00420 #define AR5K_IMR_TXERR          0x00000100      /* Transmit error*/
00421 #define AR5K_IMR_TXNOFRM        0x00000200      /* No frame transmited (transmit timeout)*/
00422 #define AR5K_IMR_TXEOL          0x00000400      /* Empty TX descriptor*/
00423 #define AR5K_IMR_TXURN          0x00000800      /* Transmit FIFO underrun*/
00424 #define AR5K_IMR_MIB            0x00001000      /* Update MIB counters*/
00425 #define AR5K_IMR_SWI            0x00002000      /* Software interrupt */
00426 #define AR5K_IMR_RXPHY          0x00004000      /* PHY error*/
00427 #define AR5K_IMR_RXKCM          0x00008000      /* RX Key cache miss */
00428 #define AR5K_IMR_SWBA           0x00010000      /* Software beacon alert*/
00429 #define AR5K_IMR_BRSSI          0x00020000      /* Beacon rssi below threshold (?) */
00430 #define AR5K_IMR_BMISS          0x00040000      /* Beacon missed*/
00431 #define AR5K_IMR_HIUERR         0x00080000      /* Host Interface Unit error [5211+] */
00432 #define AR5K_IMR_BNR            0x00100000      /* Beacon not ready [5211+] */
00433 #define AR5K_IMR_MCABT          0x00100000      /* Master Cycle Abort [5210] */
00434 #define AR5K_IMR_RXCHIRP        0x00200000      /* CHIRP Received [5212+]*/
00435 #define AR5K_IMR_SSERR          0x00200000      /* Signaled System Error [5210] */
00436 #define AR5K_IMR_DPERR          0x00400000      /* Det par Error (?) [5210] */
00437 #define AR5K_IMR_RXDOPPLER      0x00400000      /* Doppler chirp received [5212+] */
00438 #define AR5K_IMR_TIM            0x00800000      /* [5211+] */
00439 #define AR5K_IMR_BCNMISC        0x00800000      /* 'or' of TIM, CAB_END, DTIM_SYNC, BCN_TIMEOUT,
00440                                                 CAB_TIMEOUT and DTIM bits from SISR2 [5212+] */
00441 #define AR5K_IMR_GPIO           0x01000000      /* GPIO (rf kill)*/
00442 #define AR5K_IMR_QCBRORN        0x02000000      /* QCU CBR overrun (?) [5211+] */
00443 #define AR5K_IMR_QCBRURN        0x04000000      /* QCU CBR underrun (?) [5211+] */
00444 #define AR5K_IMR_QTRIG          0x08000000      /* QCU scheduling trigger [5211+] */
00445 
00446 /*
00447  * Secondary interrupt mask registers [5211+] (0 - 4)
00448  */
00449 #define AR5K_SIMR0              0x00a4                  /* Register Address [5211+] */
00450 #define AR5K_SIMR0_QCU_TXOK     0x000003ff      /* Mask for QCU_TXOK */
00451 #define AR5K_SIMR0_QCU_TXOK_S   0
00452 #define AR5K_SIMR0_QCU_TXDESC   0x03ff0000      /* Mask for QCU_TXDESC */
00453 #define AR5K_SIMR0_QCU_TXDESC_S 16
00454 
00455 #define AR5K_SIMR1              0x00a8                  /* Register Address [5211+] */
00456 #define AR5K_SIMR1_QCU_TXERR    0x000003ff      /* Mask for QCU_TXERR */
00457 #define AR5K_SIMR1_QCU_TXERR_S  0
00458 #define AR5K_SIMR1_QCU_TXEOL    0x03ff0000      /* Mask for QCU_TXEOL */
00459 #define AR5K_SIMR1_QCU_TXEOL_S  16
00460 
00461 #define AR5K_SIMR2              0x00ac                  /* Register Address [5211+] */
00462 #define AR5K_SIMR2_QCU_TXURN    0x000003ff      /* Mask for QCU_TXURN */
00463 #define AR5K_SIMR2_QCU_TXURN_S  0
00464 #define AR5K_SIMR2_MCABT        0x00010000      /* Master Cycle Abort */
00465 #define AR5K_SIMR2_SSERR        0x00020000      /* Signaled System Error */
00466 #define AR5K_SIMR2_DPERR        0x00040000      /* Bus parity error */
00467 #define AR5K_SIMR2_TIM          0x01000000      /* [5212+] */
00468 #define AR5K_SIMR2_CAB_END      0x02000000      /* [5212+] */
00469 #define AR5K_SIMR2_DTIM_SYNC    0x04000000      /* DTIM Sync lost [5212+] */
00470 #define AR5K_SIMR2_BCN_TIMEOUT  0x08000000      /* Beacon Timeout [5212+] */
00471 #define AR5K_SIMR2_CAB_TIMEOUT  0x10000000      /* CAB Timeout [5212+] */
00472 #define AR5K_SIMR2_DTIM         0x20000000      /* [5212+] */
00473 #define AR5K_SIMR2_TSFOOR       0x80000000      /* TSF OOR (?) */
00474 
00475 #define AR5K_SIMR3              0x00b0                  /* Register Address [5211+] */
00476 #define AR5K_SIMR3_QCBRORN      0x000003ff      /* Mask for QCBRORN */
00477 #define AR5K_SIMR3_QCBRORN_S    0
00478 #define AR5K_SIMR3_QCBRURN      0x03ff0000      /* Mask for QCBRURN */
00479 #define AR5K_SIMR3_QCBRURN_S    16
00480 
00481 #define AR5K_SIMR4              0x00b4                  /* Register Address [5211+] */
00482 #define AR5K_SIMR4_QTRIG        0x000003ff      /* Mask for QTRIG */
00483 #define AR5K_SIMR4_QTRIG_S      0
00484 
00485 /*
00486  * DMA Debug registers 0-7
00487  * 0xe0 - 0xfc
00488  */
00489 
00490 /*
00491  * Decompression mask registers [5212+]
00492  */
00493 #define AR5K_DCM_ADDR           0x0400          /*Decompression mask address (index) */
00494 #define AR5K_DCM_DATA           0x0404          /*Decompression mask data */
00495 
00496 /*
00497  * Wake On Wireless pattern control register [5212+]
00498  */
00499 #define AR5K_WOW_PCFG                   0x0410                  /* Register Address */
00500 #define AR5K_WOW_PCFG_PAT_MATCH_EN      0x00000001      /* Pattern match enable */
00501 #define AR5K_WOW_PCFG_LONG_FRAME_POL    0x00000002      /* Long frame policy */
00502 #define AR5K_WOW_PCFG_WOBMISS           0x00000004      /* Wake on bea(con) miss (?) */
00503 #define AR5K_WOW_PCFG_PAT_0_EN          0x00000100      /* Enable pattern 0 */
00504 #define AR5K_WOW_PCFG_PAT_1_EN          0x00000200      /* Enable pattern 1 */
00505 #define AR5K_WOW_PCFG_PAT_2_EN          0x00000400      /* Enable pattern 2 */
00506 #define AR5K_WOW_PCFG_PAT_3_EN          0x00000800      /* Enable pattern 3 */
00507 #define AR5K_WOW_PCFG_PAT_4_EN          0x00001000      /* Enable pattern 4 */
00508 #define AR5K_WOW_PCFG_PAT_5_EN          0x00002000      /* Enable pattern 5 */
00509 
00510 /*
00511  * Wake On Wireless pattern index register (?) [5212+]
00512  */
00513 #define AR5K_WOW_PAT_IDX        0x0414
00514 
00515 /*
00516  * Wake On Wireless pattern data register [5212+]
00517  */
00518 #define AR5K_WOW_PAT_DATA       0x0418                  /* Register Address */
00519 #define AR5K_WOW_PAT_DATA_0_3_V 0x00000001      /* Pattern 0, 3 value */
00520 #define AR5K_WOW_PAT_DATA_1_4_V 0x00000100      /* Pattern 1, 4 value */
00521 #define AR5K_WOW_PAT_DATA_2_5_V 0x00010000      /* Pattern 2, 5 value */
00522 #define AR5K_WOW_PAT_DATA_0_3_M 0x01000000      /* Pattern 0, 3 mask */
00523 #define AR5K_WOW_PAT_DATA_1_4_M 0x04000000      /* Pattern 1, 4 mask */
00524 #define AR5K_WOW_PAT_DATA_2_5_M 0x10000000      /* Pattern 2, 5 mask */
00525 
00526 /*
00527  * Decompression configuration registers [5212+]
00528  */
00529 #define AR5K_DCCFG              0x0420                  /* Register Address */
00530 #define AR5K_DCCFG_GLOBAL_EN    0x00000001      /* Enable decompression on all queues */
00531 #define AR5K_DCCFG_BYPASS_EN    0x00000002      /* Bypass decompression */
00532 #define AR5K_DCCFG_BCAST_EN     0x00000004      /* Enable decompression for bcast frames */
00533 #define AR5K_DCCFG_MCAST_EN     0x00000008      /* Enable decompression for mcast frames */
00534 
00535 /*
00536  * Compression configuration registers [5212+]
00537  */
00538 #define AR5K_CCFG               0x0600                  /* Register Address */
00539 #define AR5K_CCFG_WINDOW_SIZE   0x00000007      /* Compression window size */
00540 #define AR5K_CCFG_CPC_EN        0x00000008      /* Enable performance counters */
00541 
00542 #define AR5K_CCFG_CCU           0x0604                  /* Register Address */
00543 #define AR5K_CCFG_CCU_CUP_EN    0x00000001      /* CCU Catchup enable */
00544 #define AR5K_CCFG_CCU_CREDIT    0x00000002      /* CCU Credit (field) */
00545 #define AR5K_CCFG_CCU_CD_THRES  0x00000080      /* CCU Cyc(lic?) debt threshold (field) */
00546 #define AR5K_CCFG_CCU_CUP_LCNT  0x00010000      /* CCU Catchup lit(?) count */
00547 #define AR5K_CCFG_CCU_INIT      0x00100200      /* Initial value during reset */
00548 
00549 /*
00550  * Compression performance counter registers [5212+]
00551  */
00552 #define AR5K_CPC0               0x0610          /* Compression performance counter 0 */
00553 #define AR5K_CPC1               0x0614          /* Compression performance counter 1*/
00554 #define AR5K_CPC2               0x0618          /* Compression performance counter 2 */
00555 #define AR5K_CPC3               0x061c          /* Compression performance counter 3 */
00556 #define AR5K_CPCOVF             0x0620          /* Compression performance overflow */
00557 
00558 
00559 /*
00560  * Queue control unit (QCU) registers [5211+]
00561  *
00562  * Card has 12 TX Queues but i see that only 0-9 are used (?)
00563  * both in binary HAL (see ah.h) and ar5k. Each queue has it's own
00564  * TXDP at addresses 0x0800 - 0x082c, a CBR (Constant Bit Rate)
00565  * configuration register (0x08c0 - 0x08ec), a ready time configuration
00566  * register (0x0900 - 0x092c), a misc configuration register (0x09c0 -
00567  * 0x09ec) and a status register (0x0a00 - 0x0a2c). We also have some
00568  * global registers, QCU transmit enable/disable and "one shot arm (?)"
00569  * set/clear, which contain status for all queues (we shift by 1 for each
00570  * queue). To access these registers easily we define some macros here
00571  * that are used inside HAL. For more infos check out *_tx_queue functs.
00572  */
00573 
00574 /*
00575  * Generic QCU Register access macros
00576  */
00577 #define AR5K_QUEUE_REG(_r, _q)          (((_q) << 2) + _r)
00578 #define AR5K_QCU_GLOBAL_READ(_r, _q)    (AR5K_REG_READ(_r) & (1 << _q))
00579 #define AR5K_QCU_GLOBAL_WRITE(_r, _q)   AR5K_REG_WRITE(_r, (1 << _q))
00580 
00581 /*
00582  * QCU Transmit descriptor pointer registers
00583  */
00584 #define AR5K_QCU_TXDP_BASE      0x0800          /* Register Address - Queue0 TXDP */
00585 #define AR5K_QUEUE_TXDP(_q)     AR5K_QUEUE_REG(AR5K_QCU_TXDP_BASE, _q)
00586 
00587 /*
00588  * QCU Transmit enable register
00589  */
00590 #define AR5K_QCU_TXE            0x0840
00591 #define AR5K_ENABLE_QUEUE(_q)   AR5K_QCU_GLOBAL_WRITE(AR5K_QCU_TXE, _q)
00592 #define AR5K_QUEUE_ENABLED(_q)  AR5K_QCU_GLOBAL_READ(AR5K_QCU_TXE, _q)
00593 
00594 /*
00595  * QCU Transmit disable register
00596  */
00597 #define AR5K_QCU_TXD            0x0880
00598 #define AR5K_DISABLE_QUEUE(_q)  AR5K_QCU_GLOBAL_WRITE(AR5K_QCU_TXD, _q)
00599 #define AR5K_QUEUE_DISABLED(_q) AR5K_QCU_GLOBAL_READ(AR5K_QCU_TXD, _q)
00600 
00601 /*
00602  * QCU Constant Bit Rate configuration registers
00603  */
00604 #define AR5K_QCU_CBRCFG_BASE            0x08c0  /* Register Address - Queue0 CBRCFG */
00605 #define AR5K_QCU_CBRCFG_INTVAL          0x00ffffff      /* CBR Interval mask */
00606 #define AR5K_QCU_CBRCFG_INTVAL_S        0
00607 #define AR5K_QCU_CBRCFG_ORN_THRES       0xff000000      /* CBR overrun threshold mask */
00608 #define AR5K_QCU_CBRCFG_ORN_THRES_S     24
00609 #define AR5K_QUEUE_CBRCFG(_q)           AR5K_QUEUE_REG(AR5K_QCU_CBRCFG_BASE, _q)
00610 
00611 /*
00612  * QCU Ready time configuration registers
00613  */
00614 #define AR5K_QCU_RDYTIMECFG_BASE        0x0900  /* Register Address - Queue0 RDYTIMECFG */
00615 #define AR5K_QCU_RDYTIMECFG_INTVAL      0x00ffffff      /* Ready time interval mask */
00616 #define AR5K_QCU_RDYTIMECFG_INTVAL_S    0
00617 #define AR5K_QCU_RDYTIMECFG_ENABLE      0x01000000      /* Ready time enable mask */
00618 #define AR5K_QUEUE_RDYTIMECFG(_q)       AR5K_QUEUE_REG(AR5K_QCU_RDYTIMECFG_BASE, _q)
00619 
00620 /*
00621  * QCU one shot arm set registers
00622  */
00623 #define AR5K_QCU_ONESHOTARM_SET         0x0940  /* Register Address -QCU "one shot arm set (?)" */
00624 #define AR5K_QCU_ONESHOTARM_SET_M       0x0000ffff
00625 
00626 /*
00627  * QCU one shot arm clear registers
00628  */
00629 #define AR5K_QCU_ONESHOTARM_CLEAR       0x0980  /* Register Address -QCU "one shot arm clear (?)" */
00630 #define AR5K_QCU_ONESHOTARM_CLEAR_M     0x0000ffff
00631 
00632 /*
00633  * QCU misc registers
00634  */
00635 #define AR5K_QCU_MISC_BASE              0x09c0                  /* Register Address -Queue0 MISC */
00636 #define AR5K_QCU_MISC_FRSHED_M          0x0000000f      /* Frame sheduling mask */
00637 #define AR5K_QCU_MISC_FRSHED_ASAP               0       /* ASAP */
00638 #define AR5K_QCU_MISC_FRSHED_CBR                1       /* Constant Bit Rate */
00639 #define AR5K_QCU_MISC_FRSHED_DBA_GT             2       /* DMA Beacon alert gated */
00640 #define AR5K_QCU_MISC_FRSHED_TIM_GT             3       /* TIMT gated */
00641 #define AR5K_QCU_MISC_FRSHED_BCN_SENT_GT        4       /* Beacon sent gated */
00642 #define AR5K_QCU_MISC_ONESHOT_ENABLE    0x00000010      /* Oneshot enable */
00643 #define AR5K_QCU_MISC_CBREXP_DIS        0x00000020      /* Disable CBR expired counter (normal queue) */
00644 #define AR5K_QCU_MISC_CBREXP_BCN_DIS    0x00000040      /* Disable CBR expired counter (beacon queue) */
00645 #define AR5K_QCU_MISC_BCN_ENABLE        0x00000080      /* Enable Beacon use */
00646 #define AR5K_QCU_MISC_CBR_THRES_ENABLE  0x00000100      /* CBR expired threshold enabled */
00647 #define AR5K_QCU_MISC_RDY_VEOL_POLICY   0x00000200      /* TXE reset when RDYTIME expired or VEOL */
00648 #define AR5K_QCU_MISC_CBR_RESET_CNT     0x00000400      /* CBR threshold (counter) reset */
00649 #define AR5K_QCU_MISC_DCU_EARLY         0x00000800      /* DCU early termination */
00650 #define AR5K_QCU_MISC_DCU_CMP_EN        0x00001000      /* Enable frame compression */
00651 #define AR5K_QUEUE_MISC(_q)             AR5K_QUEUE_REG(AR5K_QCU_MISC_BASE, _q)
00652 
00653 
00654 /*
00655  * QCU status registers
00656  */
00657 #define AR5K_QCU_STS_BASE       0x0a00                  /* Register Address - Queue0 STS */
00658 #define AR5K_QCU_STS_FRMPENDCNT 0x00000003      /* Frames pending counter */
00659 #define AR5K_QCU_STS_CBREXPCNT  0x0000ff00      /* CBR expired counter */
00660 #define AR5K_QUEUE_STATUS(_q)   AR5K_QUEUE_REG(AR5K_QCU_STS_BASE, _q)
00661 
00662 /*
00663  * QCU ready time shutdown register
00664  */
00665 #define AR5K_QCU_RDYTIMESHDN    0x0a40
00666 #define AR5K_QCU_RDYTIMESHDN_M  0x000003ff
00667 
00668 /*
00669  * QCU compression buffer base registers [5212+]
00670  */
00671 #define AR5K_QCU_CBB_SELECT     0x0b00
00672 #define AR5K_QCU_CBB_ADDR       0x0b04
00673 #define AR5K_QCU_CBB_ADDR_S     9
00674 
00675 /*
00676  * QCU compression buffer configuration register [5212+]
00677  * (buffer size)
00678  */
00679 #define AR5K_QCU_CBCFG          0x0b08
00680 
00681 
00682 
00683 /*
00684  * Distributed Coordination Function (DCF) control unit (DCU)
00685  * registers [5211+]
00686  *
00687  * These registers control the various characteristics of each queue
00688  * for 802.11e (WME) combatibility so they go together with
00689  * QCU registers in pairs. For each queue we have a QCU mask register,
00690  * (0x1000 - 0x102c), a local-IFS settings register (0x1040 - 0x106c),
00691  * a retry limit register (0x1080 - 0x10ac), a channel time register
00692  * (0x10c0 - 0x10ec), a misc-settings register (0x1100 - 0x112c) and
00693  * a sequence number register (0x1140 - 0x116c). It seems that "global"
00694  * registers here afect all queues (see use of DCU_GBL_IFS_SLOT in ar5k).
00695  * We use the same macros here for easier register access.
00696  *
00697  */
00698 
00699 /*
00700  * DCU QCU mask registers
00701  */
00702 #define AR5K_DCU_QCUMASK_BASE   0x1000          /* Register Address -Queue0 DCU_QCUMASK */
00703 #define AR5K_DCU_QCUMASK_M      0x000003ff
00704 #define AR5K_QUEUE_QCUMASK(_q)  AR5K_QUEUE_REG(AR5K_DCU_QCUMASK_BASE, _q)
00705 
00706 /*
00707  * DCU local Inter Frame Space settings register
00708  */
00709 #define AR5K_DCU_LCL_IFS_BASE           0x1040                  /* Register Address -Queue0 DCU_LCL_IFS */
00710 #define AR5K_DCU_LCL_IFS_CW_MIN         0x000003ff      /* Minimum Contention Window */
00711 #define AR5K_DCU_LCL_IFS_CW_MIN_S       0
00712 #define AR5K_DCU_LCL_IFS_CW_MAX         0x000ffc00      /* Maximum Contention Window */
00713 #define AR5K_DCU_LCL_IFS_CW_MAX_S       10
00714 #define AR5K_DCU_LCL_IFS_AIFS           0x0ff00000      /* Arbitrated Interframe Space */
00715 #define AR5K_DCU_LCL_IFS_AIFS_S         20
00716 #define AR5K_DCU_LCL_IFS_AIFS_MAX       0xfc            /* Anything above that can cause DCU to hang */
00717 #define AR5K_QUEUE_DFS_LOCAL_IFS(_q)    AR5K_QUEUE_REG(AR5K_DCU_LCL_IFS_BASE, _q)
00718 
00719 /*
00720  * DCU retry limit registers
00721  */
00722 #define AR5K_DCU_RETRY_LMT_BASE         0x1080                  /* Register Address -Queue0 DCU_RETRY_LMT */
00723 #define AR5K_DCU_RETRY_LMT_SH_RETRY     0x0000000f      /* Short retry limit mask */
00724 #define AR5K_DCU_RETRY_LMT_SH_RETRY_S   0
00725 #define AR5K_DCU_RETRY_LMT_LG_RETRY     0x000000f0      /* Long retry limit mask */
00726 #define AR5K_DCU_RETRY_LMT_LG_RETRY_S   4
00727 #define AR5K_DCU_RETRY_LMT_SSH_RETRY    0x00003f00      /* Station short retry limit mask (?) */
00728 #define AR5K_DCU_RETRY_LMT_SSH_RETRY_S  8
00729 #define AR5K_DCU_RETRY_LMT_SLG_RETRY    0x000fc000      /* Station long retry limit mask (?) */
00730 #define AR5K_DCU_RETRY_LMT_SLG_RETRY_S  14
00731 #define AR5K_QUEUE_DFS_RETRY_LIMIT(_q)  AR5K_QUEUE_REG(AR5K_DCU_RETRY_LMT_BASE, _q)
00732 
00733 /*
00734  * DCU channel time registers
00735  */
00736 #define AR5K_DCU_CHAN_TIME_BASE         0x10c0                  /* Register Address -Queue0 DCU_CHAN_TIME */
00737 #define AR5K_DCU_CHAN_TIME_DUR          0x000fffff      /* Channel time duration */
00738 #define AR5K_DCU_CHAN_TIME_DUR_S        0
00739 #define AR5K_DCU_CHAN_TIME_ENABLE       0x00100000      /* Enable channel time */
00740 #define AR5K_QUEUE_DFS_CHANNEL_TIME(_q) AR5K_QUEUE_REG(AR5K_DCU_CHAN_TIME_BASE, _q)
00741 
00742 /*
00743  * DCU misc registers [5211+]
00744  *
00745  * Note: Arbiter lockout control controls the
00746  * behaviour on low priority queues when we have multiple queues
00747  * with pending frames. Intra-frame lockout means we wait until
00748  * the queue's current frame transmits (with post frame backoff and bursting)
00749  * before we transmit anything else and global lockout means we
00750  * wait for the whole queue to finish before higher priority queues
00751  * can transmit (this is used on beacon and CAB queues).
00752  * No lockout means there is no special handling.
00753  */
00754 #define AR5K_DCU_MISC_BASE              0x1100                  /* Register Address -Queue0 DCU_MISC */
00755 #define AR5K_DCU_MISC_BACKOFF           0x0000003f      /* Mask for backoff threshold */
00756 #define AR5K_DCU_MISC_ETS_RTS_POL       0x00000040      /* End of transmission series
00757                                                         station RTS/data failure count
00758                                                         reset policy (?) */
00759 #define AR5K_DCU_MISC_ETS_CW_POL        0x00000080      /* End of transmission series
00760                                                         CW reset policy */
00761 #define AR5K_DCU_MISC_FRAG_WAIT         0x00000100      /* Wait for next fragment */
00762 #define AR5K_DCU_MISC_BACKOFF_FRAG      0x00000200      /* Enable backoff while bursting */
00763 #define AR5K_DCU_MISC_HCFPOLL_ENABLE    0x00000800      /* CF - Poll enable */
00764 #define AR5K_DCU_MISC_BACKOFF_PERSIST   0x00001000      /* Persistent backoff */
00765 #define AR5K_DCU_MISC_FRMPRFTCH_ENABLE  0x00002000      /* Enable frame pre-fetch */
00766 #define AR5K_DCU_MISC_VIRTCOL           0x0000c000      /* Mask for Virtual Collision (?) */
00767 #define AR5K_DCU_MISC_VIRTCOL_NORMAL    0
00768 #define AR5K_DCU_MISC_VIRTCOL_IGNORE    1
00769 #define AR5K_DCU_MISC_BCN_ENABLE        0x00010000      /* Enable Beacon use */
00770 #define AR5K_DCU_MISC_ARBLOCK_CTL       0x00060000      /* Arbiter lockout control mask */
00771 #define AR5K_DCU_MISC_ARBLOCK_CTL_S     17
00772 #define AR5K_DCU_MISC_ARBLOCK_CTL_NONE          0       /* No arbiter lockout */
00773 #define AR5K_DCU_MISC_ARBLOCK_CTL_INTFRM        1       /* Intra-frame lockout */
00774 #define AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL        2       /* Global lockout */
00775 #define AR5K_DCU_MISC_ARBLOCK_IGNORE    0x00080000      /* Ignore Arbiter lockout */
00776 #define AR5K_DCU_MISC_SEQ_NUM_INCR_DIS  0x00100000      /* Disable sequence number increment */
00777 #define AR5K_DCU_MISC_POST_FR_BKOFF_DIS 0x00200000      /* Disable post-frame backoff */
00778 #define AR5K_DCU_MISC_VIRT_COLL_POLICY  0x00400000      /* Virtual Collision cw policy */
00779 #define AR5K_DCU_MISC_BLOWN_IFS_POLICY  0x00800000      /* Blown IFS policy (?) */
00780 #define AR5K_DCU_MISC_SEQNUM_CTL        0x01000000      /* Sequence number control (?) */
00781 #define AR5K_QUEUE_DFS_MISC(_q)         AR5K_QUEUE_REG(AR5K_DCU_MISC_BASE, _q)
00782 
00783 /*
00784  * DCU frame sequence number registers
00785  */
00786 #define AR5K_DCU_SEQNUM_BASE            0x1140
00787 #define AR5K_DCU_SEQNUM_M               0x00000fff
00788 #define AR5K_QUEUE_DCU_SEQNUM(_q)       AR5K_QUEUE_REG(AR5K_DCU_SEQNUM_BASE, _q)
00789 
00790 /*
00791  * DCU global IFS SIFS register
00792  */
00793 #define AR5K_DCU_GBL_IFS_SIFS   0x1030
00794 #define AR5K_DCU_GBL_IFS_SIFS_M 0x0000ffff
00795 
00796 /*
00797  * DCU global IFS slot interval register
00798  */
00799 #define AR5K_DCU_GBL_IFS_SLOT   0x1070
00800 #define AR5K_DCU_GBL_IFS_SLOT_M 0x0000ffff
00801 
00802 /*
00803  * DCU global IFS EIFS register
00804  */
00805 #define AR5K_DCU_GBL_IFS_EIFS   0x10b0
00806 #define AR5K_DCU_GBL_IFS_EIFS_M 0x0000ffff
00807 
00808 /*
00809  * DCU global IFS misc register
00810  *
00811  * LFSR stands for Linear Feedback Shift Register
00812  * and it's used for generating pseudo-random
00813  * number sequences.
00814  *
00815  * (If i understand corectly, random numbers are
00816  * used for idle sensing -multiplied with cwmin/max etc-)
00817  */
00818 #define AR5K_DCU_GBL_IFS_MISC                   0x10f0                  /* Register Address */
00819 #define AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE        0x00000007      /* LFSR Slice Select */
00820 #define AR5K_DCU_GBL_IFS_MISC_TURBO_MODE        0x00000008      /* Turbo mode */
00821 #define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC     0x000003f0      /* SIFS Duration mask */
00822 #define AR5K_DCU_GBL_IFS_MISC_USEC_DUR          0x000ffc00      /* USEC Duration mask */
00823 #define AR5K_DCU_GBL_IFS_MISC_USEC_DUR_S        10
00824 #define AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY     0x00300000      /* DCU Arbiter delay mask */
00825 #define AR5K_DCU_GBL_IFS_MISC_SIFS_CNT_RST      0x00400000      /* SIFS cnt reset policy (?) */
00826 #define AR5K_DCU_GBL_IFS_MISC_AIFS_CNT_RST      0x00800000      /* AIFS cnt reset policy (?) */
00827 #define AR5K_DCU_GBL_IFS_MISC_RND_LFSR_SL_DIS   0x01000000      /* Disable random LFSR slice */
00828 
00829 /*
00830  * DCU frame prefetch control register
00831  */
00832 #define AR5K_DCU_FP                     0x1230                  /* Register Address */
00833 #define AR5K_DCU_FP_NOBURST_DCU_EN      0x00000001      /* Enable non-burst prefetch on DCU (?) */
00834 #define AR5K_DCU_FP_NOBURST_EN          0x00000010      /* Enable non-burst prefetch (?) */
00835 #define AR5K_DCU_FP_BURST_DCU_EN        0x00000020      /* Enable burst prefetch on DCU (?) */
00836 
00837 /*
00838  * DCU transmit pause control/status register
00839  */
00840 #define AR5K_DCU_TXP            0x1270                  /* Register Address */
00841 #define AR5K_DCU_TXP_M          0x000003ff      /* Tx pause mask */
00842 #define AR5K_DCU_TXP_STATUS     0x00010000      /* Tx pause status */
00843 
00844 /*
00845  * DCU transmit filter table 0 (32 entries)
00846  * each entry contains a 32bit slice of the
00847  * 128bit tx filter for each DCU (4 slices per DCU)
00848  */
00849 #define AR5K_DCU_TX_FILTER_0_BASE       0x1038
00850 #define AR5K_DCU_TX_FILTER_0(_n)        (AR5K_DCU_TX_FILTER_0_BASE + (_n * 64))
00851 
00852 /*
00853  * DCU transmit filter table 1 (16 entries)
00854  */
00855 #define AR5K_DCU_TX_FILTER_1_BASE       0x103c
00856 #define AR5K_DCU_TX_FILTER_1(_n)        (AR5K_DCU_TX_FILTER_1_BASE + (_n * 64))
00857 
00858 /*
00859  * DCU clear transmit filter register
00860  */
00861 #define AR5K_DCU_TX_FILTER_CLR  0x143c
00862 
00863 /*
00864  * DCU set transmit filter register
00865  */
00866 #define AR5K_DCU_TX_FILTER_SET  0x147c
00867 
00868 /*
00869  * Reset control register
00870  */
00871 #define AR5K_RESET_CTL          0x4000                  /* Register Address */
00872 #define AR5K_RESET_CTL_PCU      0x00000001      /* Protocol Control Unit reset */
00873 #define AR5K_RESET_CTL_DMA      0x00000002      /* DMA (Rx/Tx) reset [5210] */
00874 #define AR5K_RESET_CTL_BASEBAND 0x00000002      /* Baseband reset [5211+] */
00875 #define AR5K_RESET_CTL_MAC      0x00000004      /* MAC reset (PCU+Baseband ?) [5210] */
00876 #define AR5K_RESET_CTL_PHY      0x00000008      /* PHY reset [5210] */
00877 #define AR5K_RESET_CTL_PCI      0x00000010      /* PCI Core reset (interrupts etc) */
00878 
00879 /*
00880  * Sleep control register
00881  */
00882 #define AR5K_SLEEP_CTL                  0x4004                  /* Register Address */
00883 #define AR5K_SLEEP_CTL_SLDUR            0x0000ffff      /* Sleep duration mask */
00884 #define AR5K_SLEEP_CTL_SLDUR_S          0
00885 #define AR5K_SLEEP_CTL_SLE              0x00030000      /* Sleep enable mask */
00886 #define AR5K_SLEEP_CTL_SLE_S            16
00887 #define AR5K_SLEEP_CTL_SLE_WAKE         0x00000000      /* Force chip awake */
00888 #define AR5K_SLEEP_CTL_SLE_SLP          0x00010000      /* Force chip sleep */
00889 #define AR5K_SLEEP_CTL_SLE_ALLOW        0x00020000      /* Normal sleep policy */
00890 #define AR5K_SLEEP_CTL_SLE_UNITS        0x00000008      /* [5211+] */
00891 #define AR5K_SLEEP_CTL_DUR_TIM_POL      0x00040000      /* Sleep duration timing policy */
00892 #define AR5K_SLEEP_CTL_DUR_WRITE_POL    0x00080000      /* Sleep duration write policy */
00893 #define AR5K_SLEEP_CTL_SLE_POL          0x00100000      /* Sleep policy mode */
00894 
00895 /*
00896  * Interrupt pending register
00897  */
00898 #define AR5K_INTPEND    0x4008
00899 #define AR5K_INTPEND_M  0x00000001
00900 
00901 /*
00902  * Sleep force register
00903  */
00904 #define AR5K_SFR        0x400c
00905 #define AR5K_SFR_EN     0x00000001
00906 
00907 /*
00908  * PCI configuration register
00909  * TODO: Fix LED stuff
00910  */
00911 #define AR5K_PCICFG                     0x4010                  /* Register Address */
00912 #define AR5K_PCICFG_EEAE                0x00000001      /* Eeprom access enable [5210] */
00913 #define AR5K_PCICFG_SLEEP_CLOCK_EN      0x00000002      /* Enable sleep clock */
00914 #define AR5K_PCICFG_CLKRUNEN            0x00000004      /* CLKRUN enable [5211+] */
00915 #define AR5K_PCICFG_EESIZE              0x00000018      /* Mask for EEPROM size [5211+] */
00916 #define AR5K_PCICFG_EESIZE_S            3
00917 #define AR5K_PCICFG_EESIZE_4K           0               /* 4K */
00918 #define AR5K_PCICFG_EESIZE_8K           1               /* 8K */
00919 #define AR5K_PCICFG_EESIZE_16K          2               /* 16K */
00920 #define AR5K_PCICFG_EESIZE_FAIL         3               /* Failed to get size [5211+] */
00921 #define AR5K_PCICFG_LED                 0x00000060      /* Led status [5211+] */
00922 #define AR5K_PCICFG_LED_NONE            0x00000000      /* Default [5211+] */
00923 #define AR5K_PCICFG_LED_PEND            0x00000020      /* Scan / Auth pending */
00924 #define AR5K_PCICFG_LED_ASSOC           0x00000040      /* Associated */
00925 #define AR5K_PCICFG_BUS_SEL             0x00000380      /* Mask for "bus select" [5211+] (?) */
00926 #define AR5K_PCICFG_CBEFIX_DIS          0x00000400      /* Disable CBE fix */
00927 #define AR5K_PCICFG_SL_INTEN            0x00000800      /* Enable interrupts when asleep */
00928 #define AR5K_PCICFG_LED_BCTL            0x00001000      /* Led blink (?) [5210] */
00929 #define AR5K_PCICFG_RETRY_FIX           0x00001000      /* Enable pci core retry fix */
00930 #define AR5K_PCICFG_SL_INPEN            0x00002000      /* Sleep even whith pending interrupts*/
00931 #define AR5K_PCICFG_SPWR_DN             0x00010000      /* Mask for power status */
00932 #define AR5K_PCICFG_LEDMODE             0x000e0000      /* Ledmode [5211+] */
00933 #define AR5K_PCICFG_LEDMODE_PROP        0x00000000      /* Blink on standard traffic [5211+] */
00934 #define AR5K_PCICFG_LEDMODE_PROM        0x00020000      /* Default mode (blink on any traffic) [5211+] */
00935 #define AR5K_PCICFG_LEDMODE_PWR         0x00040000      /* Some other blinking mode  (?) [5211+] */
00936 #define AR5K_PCICFG_LEDMODE_RAND        0x00060000      /* Random blinking (?) [5211+] */
00937 #define AR5K_PCICFG_LEDBLINK            0x00700000      /* Led blink rate */
00938 #define AR5K_PCICFG_LEDBLINK_S          20
00939 #define AR5K_PCICFG_LEDSLOW             0x00800000      /* Slowest led blink rate [5211+] */
00940 #define AR5K_PCICFG_LEDSTATE                            \
00941         (AR5K_PCICFG_LED | AR5K_PCICFG_LEDMODE |        \
00942         AR5K_PCICFG_LEDBLINK | AR5K_PCICFG_LEDSLOW)
00943 #define AR5K_PCICFG_SLEEP_CLOCK_RATE    0x03000000      /* Sleep clock rate */
00944 #define AR5K_PCICFG_SLEEP_CLOCK_RATE_S  24
00945 
00946 /*
00947  * "General Purpose Input/Output" (GPIO) control register
00948  *
00949  * I'm not sure about this but after looking at the code
00950  * for all chipsets here is what i got.
00951  *
00952  * We have 6 GPIOs (pins), each GPIO has 4 modes (2 bits)
00953  * Mode 0 -> always input
00954  * Mode 1 -> output when GPIODO for this GPIO is set to 0
00955  * Mode 2 -> output when GPIODO for this GPIO is set to 1
00956  * Mode 3 -> always output
00957  *
00958  * For more infos check out get_gpio/set_gpio and
00959  * set_gpio_input/set_gpio_output functs.
00960  * For more infos on gpio interrupt check out set_gpio_intr.
00961  */
00962 #define AR5K_NUM_GPIO   6
00963 
00964 #define AR5K_GPIOCR             0x4014                          /* Register Address */
00965 #define AR5K_GPIOCR_INT_ENA     0x00008000              /* Enable GPIO interrupt */
00966 #define AR5K_GPIOCR_INT_SELL    0x00000000              /* Generate interrupt when pin is low */
00967 #define AR5K_GPIOCR_INT_SELH    0x00010000              /* Generate interrupt when pin is high */
00968 #define AR5K_GPIOCR_IN(n)       (0 << ((n) * 2))        /* Mode 0 for pin n */
00969 #define AR5K_GPIOCR_OUT0(n)     (1 << ((n) * 2))        /* Mode 1 for pin n */
00970 #define AR5K_GPIOCR_OUT1(n)     (2 << ((n) * 2))        /* Mode 2 for pin n */
00971 #define AR5K_GPIOCR_OUT(n)      (3 << ((n) * 2))        /* Mode 3 for pin n */
00972 #define AR5K_GPIOCR_INT_SEL(n)  ((n) << 12)             /* Interrupt for GPIO pin n */
00973 
00974 /*
00975  * "General Purpose Input/Output" (GPIO) data output register
00976  */
00977 #define AR5K_GPIODO     0x4018
00978 
00979 /*
00980  * "General Purpose Input/Output" (GPIO) data input register
00981  */
00982 #define AR5K_GPIODI     0x401c
00983 #define AR5K_GPIODI_M   0x0000002f
00984 
00985 /*
00986  * Silicon revision register
00987  */
00988 #define AR5K_SREV               0x4020                  /* Register Address */
00989 #define AR5K_SREV_REV           0x0000000f      /* Mask for revision */
00990 #define AR5K_SREV_REV_S         0
00991 #define AR5K_SREV_VER           0x000000ff      /* Mask for version */
00992 #define AR5K_SREV_VER_S         4
00993 
00994 /*
00995  * TXE write posting register
00996  */
00997 #define AR5K_TXEPOST    0x4028
00998 
00999 /*
01000  * QCU sleep mask
01001  */
01002 #define AR5K_QCU_SLEEP_MASK     0x402c
01003 
01004 /* 0x4068 is compression buffer configuration
01005  * register on 5414 and pm configuration register
01006  * on 5424 and newer pci-e chips. */
01007 
01008 /*
01009  * Compression buffer configuration
01010  * register (enable/disable) [5414]
01011  */
01012 #define AR5K_5414_CBCFG         0x4068
01013 #define AR5K_5414_CBCFG_BUF_DIS 0x10    /* Disable buffer */
01014 
01015 /*
01016  * PCI-E Power management configuration
01017  * and status register [5424+]
01018  */
01019 #define AR5K_PCIE_PM_CTL                0x4068                  /* Register address */
01020 /* Only 5424 */
01021 #define AR5K_PCIE_PM_CTL_L1_WHEN_D2     0x00000001      /* enable PCIe core enter L1
01022                                                         when d2_sleep_en is asserted */
01023 #define AR5K_PCIE_PM_CTL_L0_L0S_CLEAR   0x00000002      /* Clear L0 and L0S counters */
01024 #define AR5K_PCIE_PM_CTL_L0_L0S_EN      0x00000004      /* Start L0 nd L0S counters */
01025 #define AR5K_PCIE_PM_CTL_LDRESET_EN     0x00000008      /* Enable reset when link goes
01026                                                         down */
01027 /* Wake On Wireless */
01028 #define AR5K_PCIE_PM_CTL_PME_EN         0x00000010      /* PME Enable */
01029 #define AR5K_PCIE_PM_CTL_AUX_PWR_DET    0x00000020      /* Aux power detect */
01030 #define AR5K_PCIE_PM_CTL_PME_CLEAR      0x00000040      /* Clear PME */
01031 #define AR5K_PCIE_PM_CTL_PSM_D0         0x00000080
01032 #define AR5K_PCIE_PM_CTL_PSM_D1         0x00000100
01033 #define AR5K_PCIE_PM_CTL_PSM_D2         0x00000200
01034 #define AR5K_PCIE_PM_CTL_PSM_D3         0x00000400
01035 
01036 /*
01037  * PCI-E Workaround enable register
01038  */
01039 #define AR5K_PCIE_WAEN  0x407c
01040 
01041 /*
01042  * PCI-E Serializer/Desirializer
01043  * registers
01044  */
01045 #define AR5K_PCIE_SERDES        0x4080
01046 #define AR5K_PCIE_SERDES_RESET  0x4084
01047 
01048 /*====EEPROM REGISTERS====*/
01049 
01050 /*
01051  * EEPROM access registers
01052  *
01053  * Here we got a difference between 5210/5211-12
01054  * read data register for 5210 is at 0x6800 and
01055  * status register is at 0x6c00. There is also
01056  * no eeprom command register on 5210 and the
01057  * offsets are different.
01058  *
01059  * To read eeprom data for a specific offset:
01060  * 5210 - enable eeprom access (AR5K_PCICFG_EEAE)
01061  *        read AR5K_EEPROM_BASE +(4 * offset)
01062  *        check the eeprom status register
01063  *        and read eeprom data register.
01064  *
01065  * 5211 - write offset to AR5K_EEPROM_BASE
01066  * 5212   write AR5K_EEPROM_CMD_READ on AR5K_EEPROM_CMD
01067  *        check the eeprom status register
01068  *        and read eeprom data register.
01069  *
01070  * To write eeprom data for a specific offset:
01071  * 5210 - enable eeprom access (AR5K_PCICFG_EEAE)
01072  *        write data to AR5K_EEPROM_BASE +(4 * offset)
01073  *        check the eeprom status register
01074  * 5211 - write AR5K_EEPROM_CMD_RESET on AR5K_EEPROM_CMD
01075  * 5212   write offset to AR5K_EEPROM_BASE
01076  *        write data to data register
01077  *        write AR5K_EEPROM_CMD_WRITE on AR5K_EEPROM_CMD
01078  *        check the eeprom status register
01079  *
01080  * For more infos check eeprom_* functs and the ar5k.c
01081  * file posted in madwifi-devel mailing list.
01082  * http://sourceforge.net/mailarchive/message.php?msg_id=8966525
01083  *
01084  */
01085 #define AR5K_EEPROM_BASE        0x6000
01086 
01087 /*
01088  * EEPROM data register
01089  */
01090 #define AR5K_EEPROM_DATA_5211   0x6004
01091 #define AR5K_EEPROM_DATA_5210   0x6800
01092 #define AR5K_EEPROM_DATA        (ah->ah_version == AR5K_AR5210 ? \
01093                                 AR5K_EEPROM_DATA_5210 : AR5K_EEPROM_DATA_5211)
01094 
01095 /*
01096  * EEPROM command register
01097  */
01098 #define AR5K_EEPROM_CMD         0x6008                  /* Register Addres */
01099 #define AR5K_EEPROM_CMD_READ    0x00000001      /* EEPROM read */
01100 #define AR5K_EEPROM_CMD_WRITE   0x00000002      /* EEPROM write */
01101 #define AR5K_EEPROM_CMD_RESET   0x00000004      /* EEPROM reset */
01102 
01103 /*
01104  * EEPROM status register
01105  */
01106 #define AR5K_EEPROM_STAT_5210   0x6c00                  /* Register Address [5210] */
01107 #define AR5K_EEPROM_STAT_5211   0x600c                  /* Register Address [5211+] */
01108 #define AR5K_EEPROM_STATUS      (ah->ah_version == AR5K_AR5210 ? \
01109                                 AR5K_EEPROM_STAT_5210 : AR5K_EEPROM_STAT_5211)
01110 #define AR5K_EEPROM_STAT_RDERR  0x00000001      /* EEPROM read failed */
01111 #define AR5K_EEPROM_STAT_RDDONE 0x00000002      /* EEPROM read successful */
01112 #define AR5K_EEPROM_STAT_WRERR  0x00000004      /* EEPROM write failed */
01113 #define AR5K_EEPROM_STAT_WRDONE 0x00000008      /* EEPROM write successful */
01114 
01115 /*
01116  * EEPROM config register
01117  */
01118 #define AR5K_EEPROM_CFG                 0x6010                  /* Register Addres */
01119 #define AR5K_EEPROM_CFG_SIZE            0x00000003              /* Size determination override */
01120 #define AR5K_EEPROM_CFG_SIZE_AUTO       0
01121 #define AR5K_EEPROM_CFG_SIZE_4KBIT      1
01122 #define AR5K_EEPROM_CFG_SIZE_8KBIT      2
01123 #define AR5K_EEPROM_CFG_SIZE_16KBIT     3
01124 #define AR5K_EEPROM_CFG_WR_WAIT_DIS     0x00000004      /* Disable write wait */
01125 #define AR5K_EEPROM_CFG_CLK_RATE        0x00000018      /* Clock rate */
01126 #define AR5K_EEPROM_CFG_CLK_RATE_S              3
01127 #define AR5K_EEPROM_CFG_CLK_RATE_156KHZ 0
01128 #define AR5K_EEPROM_CFG_CLK_RATE_312KHZ 1
01129 #define AR5K_EEPROM_CFG_CLK_RATE_625KHZ 2
01130 #define AR5K_EEPROM_CFG_PROT_KEY        0x00ffff00      /* Protection key */
01131 #define AR5K_EEPROM_CFG_PROT_KEY_S      8
01132 #define AR5K_EEPROM_CFG_LIND_EN         0x01000000      /* Enable length indicator (?) */
01133 
01134 
01135 /*
01136  * TODO: Wake On Wireless registers
01137  * Range 0x7000 - 0x7ce0
01138  */
01139 
01140 /*
01141  * Protocol Control Unit (PCU) registers
01142  */
01143 /*
01144  * Used for checking initial register writes
01145  * during channel reset (see reset func)
01146  */
01147 #define AR5K_PCU_MIN    0x8000
01148 #define AR5K_PCU_MAX    0x8fff
01149 
01150 /*
01151  * First station id register (Lower 32 bits of MAC address)
01152  */
01153 #define AR5K_STA_ID0            0x8000
01154 #define AR5K_STA_ID0_ARRD_L32   0xffffffff
01155 
01156 /*
01157  * Second station id register (Upper 16 bits of MAC address + PCU settings)
01158  */
01159 #define AR5K_STA_ID1                    0x8004                  /* Register Address */
01160 #define AR5K_STA_ID1_ADDR_U16           0x0000ffff      /* Upper 16 bits of MAC addres */
01161 #define AR5K_STA_ID1_AP                 0x00010000      /* Set AP mode */
01162 #define AR5K_STA_ID1_ADHOC              0x00020000      /* Set Ad-Hoc mode */
01163 #define AR5K_STA_ID1_PWR_SV             0x00040000      /* Power save reporting */
01164 #define AR5K_STA_ID1_NO_KEYSRCH         0x00080000      /* No key search */
01165 #define AR5K_STA_ID1_NO_PSPOLL          0x00100000      /* No power save polling [5210] */
01166 #define AR5K_STA_ID1_PCF_5211           0x00100000      /* Enable PCF on [5211+] */
01167 #define AR5K_STA_ID1_PCF_5210           0x00200000      /* Enable PCF on [5210]*/
01168 #define AR5K_STA_ID1_PCF                (ah->ah_version == AR5K_AR5210 ? \
01169                                         AR5K_STA_ID1_PCF_5210 : AR5K_STA_ID1_PCF_5211)
01170 #define AR5K_STA_ID1_DEFAULT_ANTENNA    0x00200000      /* Use default antenna */
01171 #define AR5K_STA_ID1_DESC_ANTENNA       0x00400000      /* Update antenna from descriptor */
01172 #define AR5K_STA_ID1_RTS_DEF_ANTENNA    0x00800000      /* Use default antenna for RTS */
01173 #define AR5K_STA_ID1_ACKCTS_6MB         0x01000000      /* Use 6Mbit/s for ACK/CTS */
01174 #define AR5K_STA_ID1_BASE_RATE_11B      0x02000000      /* Use 11b base rate for ACK/CTS [5211+] */
01175 #define AR5K_STA_ID1_SELFGEN_DEF_ANT    0x04000000      /* Use def. antenna for self generated frames */
01176 #define AR5K_STA_ID1_CRYPT_MIC_EN       0x08000000      /* Enable MIC */
01177 #define AR5K_STA_ID1_KEYSRCH_MODE       0x10000000      /* Look up key when key id != 0 */
01178 #define AR5K_STA_ID1_PRESERVE_SEQ_NUM   0x20000000      /* Preserve sequence number */
01179 #define AR5K_STA_ID1_CBCIV_ENDIAN       0x40000000      /* ??? */
01180 #define AR5K_STA_ID1_KEYSRCH_MCAST      0x80000000      /* Do key cache search for mcast frames */
01181 
01182 #define AR5K_STA_ID1_ANTENNA_SETTINGS   (AR5K_STA_ID1_DEFAULT_ANTENNA | \
01183                                         AR5K_STA_ID1_DESC_ANTENNA | \
01184                                         AR5K_STA_ID1_RTS_DEF_ANTENNA | \
01185                                         AR5K_STA_ID1_SELFGEN_DEF_ANT)
01186 
01187 /*
01188  * First BSSID register (MAC address, lower 32bits)
01189  */
01190 #define AR5K_BSS_ID0    0x8008
01191 
01192 /*
01193  * Second BSSID register (MAC address in upper 16 bits)
01194  *
01195  * AID: Association ID
01196  */
01197 #define AR5K_BSS_ID1            0x800c
01198 #define AR5K_BSS_ID1_AID        0xffff0000
01199 #define AR5K_BSS_ID1_AID_S      16
01200 
01201 /*
01202  * Backoff slot time register
01203  */
01204 #define AR5K_SLOT_TIME  0x8010
01205 
01206 /*
01207  * ACK/CTS timeout register
01208  */
01209 #define AR5K_TIME_OUT           0x8014                  /* Register Address */
01210 #define AR5K_TIME_OUT_ACK       0x00001fff      /* ACK timeout mask */
01211 #define AR5K_TIME_OUT_ACK_S     0
01212 #define AR5K_TIME_OUT_CTS       0x1fff0000      /* CTS timeout mask */
01213 #define AR5K_TIME_OUT_CTS_S     16
01214 
01215 /*
01216  * RSSI threshold register
01217  */
01218 #define AR5K_RSSI_THR                   0x8018          /* Register Address */
01219 #define AR5K_RSSI_THR_M                 0x000000ff      /* Mask for RSSI threshold [5211+] */
01220 #define AR5K_RSSI_THR_BMISS_5210        0x00000700      /* Mask for Beacon Missed threshold [5210] */
01221 #define AR5K_RSSI_THR_BMISS_5210_S      8
01222 #define AR5K_RSSI_THR_BMISS_5211        0x0000ff00      /* Mask for Beacon Missed threshold [5211+] */
01223 #define AR5K_RSSI_THR_BMISS_5211_S      8
01224 #define AR5K_RSSI_THR_BMISS             (ah->ah_version == AR5K_AR5210 ? \
01225                                         AR5K_RSSI_THR_BMISS_5210 : AR5K_RSSI_THR_BMISS_5211)
01226 #define AR5K_RSSI_THR_BMISS_S           8
01227 
01228 /*
01229  * 5210 has more PCU registers because there is no QCU/DCU
01230  * so queue parameters are set here, this way a lot common
01231  * registers have different address for 5210. To make things
01232  * easier we define a macro based on ah->ah_version for common
01233  * registers with different addresses and common flags.
01234  */
01235 
01236 /*
01237  * Retry limit register
01238  *
01239  * Retry limit register for 5210 (no QCU/DCU so it's done in PCU)
01240  */
01241 #define AR5K_NODCU_RETRY_LMT            0x801c                  /* Register Address */
01242 #define AR5K_NODCU_RETRY_LMT_SH_RETRY   0x0000000f      /* Short retry limit mask */
01243 #define AR5K_NODCU_RETRY_LMT_SH_RETRY_S 0
01244 #define AR5K_NODCU_RETRY_LMT_LG_RETRY   0x000000f0      /* Long retry mask */
01245 #define AR5K_NODCU_RETRY_LMT_LG_RETRY_S 4
01246 #define AR5K_NODCU_RETRY_LMT_SSH_RETRY  0x00003f00      /* Station short retry limit mask */
01247 #define AR5K_NODCU_RETRY_LMT_SSH_RETRY_S        8
01248 #define AR5K_NODCU_RETRY_LMT_SLG_RETRY  0x000fc000      /* Station long retry limit mask */
01249 #define AR5K_NODCU_RETRY_LMT_SLG_RETRY_S        14
01250 #define AR5K_NODCU_RETRY_LMT_CW_MIN     0x3ff00000      /* Minimum contention window mask */
01251 #define AR5K_NODCU_RETRY_LMT_CW_MIN_S   20
01252 
01253 /*
01254  * Transmit latency register
01255  */
01256 #define AR5K_USEC_5210                  0x8020                  /* Register Address [5210] */
01257 #define AR5K_USEC_5211                  0x801c                  /* Register Address [5211+] */
01258 #define AR5K_USEC                       (ah->ah_version == AR5K_AR5210 ? \
01259                                         AR5K_USEC_5210 : AR5K_USEC_5211)
01260 #define AR5K_USEC_1                     0x0000007f      /* clock cycles for 1us */
01261 #define AR5K_USEC_1_S                   0
01262 #define AR5K_USEC_32                    0x00003f80      /* clock cycles for 1us while on 32Mhz clock */
01263 #define AR5K_USEC_32_S                  7
01264 #define AR5K_USEC_TX_LATENCY_5211       0x007fc000
01265 #define AR5K_USEC_TX_LATENCY_5211_S     14
01266 #define AR5K_USEC_RX_LATENCY_5211       0x1f800000
01267 #define AR5K_USEC_RX_LATENCY_5211_S     23
01268 #define AR5K_USEC_TX_LATENCY_5210       0x000fc000      /* also for 5311 */
01269 #define AR5K_USEC_TX_LATENCY_5210_S     14
01270 #define AR5K_USEC_RX_LATENCY_5210       0x03f00000      /* also for 5311 */
01271 #define AR5K_USEC_RX_LATENCY_5210_S     20
01272 
01273 /*
01274  * PCU beacon control register
01275  */
01276 #define AR5K_BEACON_5210        0x8024                  /*Register Address [5210] */
01277 #define AR5K_BEACON_5211        0x8020                  /*Register Address [5211+] */
01278 #define AR5K_BEACON             (ah->ah_version == AR5K_AR5210 ? \
01279                                 AR5K_BEACON_5210 : AR5K_BEACON_5211)
01280 #define AR5K_BEACON_PERIOD      0x0000ffff      /* Mask for beacon period */
01281 #define AR5K_BEACON_PERIOD_S    0
01282 #define AR5K_BEACON_TIM         0x007f0000      /* Mask for TIM offset */
01283 #define AR5K_BEACON_TIM_S       16
01284 #define AR5K_BEACON_ENABLE      0x00800000      /* Enable beacons */
01285 #define AR5K_BEACON_RESET_TSF   0x01000000      /* Force TSF reset */
01286 
01287 /*
01288  * CFP period register
01289  */
01290 #define AR5K_CFP_PERIOD_5210    0x8028
01291 #define AR5K_CFP_PERIOD_5211    0x8024
01292 #define AR5K_CFP_PERIOD         (ah->ah_version == AR5K_AR5210 ? \
01293                                 AR5K_CFP_PERIOD_5210 : AR5K_CFP_PERIOD_5211)
01294 
01295 /*
01296  * Next beacon time register
01297  */
01298 #define AR5K_TIMER0_5210        0x802c
01299 #define AR5K_TIMER0_5211        0x8028
01300 #define AR5K_TIMER0             (ah->ah_version == AR5K_AR5210 ? \
01301                                 AR5K_TIMER0_5210 : AR5K_TIMER0_5211)
01302 
01303 /*
01304  * Next DMA beacon alert register
01305  */
01306 #define AR5K_TIMER1_5210        0x8030
01307 #define AR5K_TIMER1_5211        0x802c
01308 #define AR5K_TIMER1             (ah->ah_version == AR5K_AR5210 ? \
01309                                 AR5K_TIMER1_5210 : AR5K_TIMER1_5211)
01310 
01311 /*
01312  * Next software beacon alert register
01313  */
01314 #define AR5K_TIMER2_5210        0x8034
01315 #define AR5K_TIMER2_5211        0x8030
01316 #define AR5K_TIMER2             (ah->ah_version == AR5K_AR5210 ? \
01317                                 AR5K_TIMER2_5210 : AR5K_TIMER2_5211)
01318 
01319 /*
01320  * Next ATIM window time register
01321  */
01322 #define AR5K_TIMER3_5210        0x8038
01323 #define AR5K_TIMER3_5211        0x8034
01324 #define AR5K_TIMER3             (ah->ah_version == AR5K_AR5210 ? \
01325                                 AR5K_TIMER3_5210 : AR5K_TIMER3_5211)
01326 
01327 
01328 /*
01329  * 5210 First inter frame spacing register (IFS)
01330  */
01331 #define AR5K_IFS0               0x8040
01332 #define AR5K_IFS0_SIFS          0x000007ff
01333 #define AR5K_IFS0_SIFS_S        0
01334 #define AR5K_IFS0_DIFS          0x007ff800
01335 #define AR5K_IFS0_DIFS_S        11
01336 
01337 /*
01338  * 5210 Second inter frame spacing register (IFS)
01339  */
01340 #define AR5K_IFS1               0x8044
01341 #define AR5K_IFS1_PIFS          0x00000fff
01342 #define AR5K_IFS1_PIFS_S        0
01343 #define AR5K_IFS1_EIFS          0x03fff000
01344 #define AR5K_IFS1_EIFS_S        12
01345 #define AR5K_IFS1_CS_EN         0x04000000
01346 
01347 
01348 /*
01349  * CFP duration register
01350  */
01351 #define AR5K_CFP_DUR_5210       0x8048
01352 #define AR5K_CFP_DUR_5211       0x8038
01353 #define AR5K_CFP_DUR            (ah->ah_version == AR5K_AR5210 ? \
01354                                 AR5K_CFP_DUR_5210 : AR5K_CFP_DUR_5211)
01355 
01356 /*
01357  * Receive filter register
01358  */
01359 #define AR5K_RX_FILTER_5210     0x804c                  /* Register Address [5210] */
01360 #define AR5K_RX_FILTER_5211     0x803c                  /* Register Address [5211+] */
01361 #define AR5K_RX_FILTER          (ah->ah_version == AR5K_AR5210 ? \
01362                                 AR5K_RX_FILTER_5210 : AR5K_RX_FILTER_5211)
01363 #define AR5K_RX_FILTER_UCAST    0x00000001      /* Don't filter unicast frames */
01364 #define AR5K_RX_FILTER_MCAST    0x00000002      /* Don't filter multicast frames */
01365 #define AR5K_RX_FILTER_BCAST    0x00000004      /* Don't filter broadcast frames */
01366 #define AR5K_RX_FILTER_CONTROL  0x00000008      /* Don't filter control frames */
01367 #define AR5K_RX_FILTER_BEACON   0x00000010      /* Don't filter beacon frames */
01368 #define AR5K_RX_FILTER_PROM     0x00000020      /* Set promiscuous mode */
01369 #define AR5K_RX_FILTER_XRPOLL   0x00000040      /* Don't filter XR poll frame [5212+] */
01370 #define AR5K_RX_FILTER_PROBEREQ 0x00000080      /* Don't filter probe requests [5212+] */
01371 #define AR5K_RX_FILTER_PHYERR_5212      0x00000100      /* Don't filter phy errors [5212+] */
01372 #define AR5K_RX_FILTER_RADARERR_5212    0x00000200      /* Don't filter phy radar errors [5212+] */
01373 #define AR5K_RX_FILTER_PHYERR_5211      0x00000040      /* [5211] */
01374 #define AR5K_RX_FILTER_RADARERR_5211    0x00000080      /* [5211] */
01375 #define AR5K_RX_FILTER_PHYERR  \
01376         ((ah->ah_version == AR5K_AR5211 ? \
01377         AR5K_RX_FILTER_PHYERR_5211 : AR5K_RX_FILTER_PHYERR_5212))
01378 #define        AR5K_RX_FILTER_RADARERR \
01379         ((ah->ah_version == AR5K_AR5211 ? \
01380         AR5K_RX_FILTER_RADARERR_5211 : AR5K_RX_FILTER_RADARERR_5212))
01381 
01382 /*
01383  * Multicast filter register (lower 32 bits)
01384  */
01385 #define AR5K_MCAST_FILTER0_5210 0x8050
01386 #define AR5K_MCAST_FILTER0_5211 0x8040
01387 #define AR5K_MCAST_FILTER0      (ah->ah_version == AR5K_AR5210 ? \
01388                                 AR5K_MCAST_FILTER0_5210 : AR5K_MCAST_FILTER0_5211)
01389 
01390 /*
01391  * Multicast filter register (higher 16 bits)
01392  */
01393 #define AR5K_MCAST_FILTER1_5210 0x8054
01394 #define AR5K_MCAST_FILTER1_5211 0x8044
01395 #define AR5K_MCAST_FILTER1      (ah->ah_version == AR5K_AR5210 ? \
01396                                 AR5K_MCAST_FILTER1_5210 : AR5K_MCAST_FILTER1_5211)
01397 
01398 
01399 /*
01400  * Transmit mask register (lower 32 bits) [5210]
01401  */
01402 #define AR5K_TX_MASK0   0x8058
01403 
01404 /*
01405  * Transmit mask register (higher 16 bits) [5210]
01406  */
01407 #define AR5K_TX_MASK1   0x805c
01408 
01409 /*
01410  * Clear transmit mask [5210]
01411  */
01412 #define AR5K_CLR_TMASK  0x8060
01413 
01414 /*
01415  * Trigger level register (before transmission) [5210]
01416  */
01417 #define AR5K_TRIG_LVL   0x8064
01418 
01419 
01420 /*
01421  * PCU control register
01422  *
01423  * Only DIS_RX is used in the code, the rest i guess are
01424  * for tweaking/diagnostics.
01425  */
01426 #define AR5K_DIAG_SW_5210               0x8068                  /* Register Address [5210] */
01427 #define AR5K_DIAG_SW_5211               0x8048                  /* Register Address [5211+] */
01428 #define AR5K_DIAG_SW                    (ah->ah_version == AR5K_AR5210 ? \
01429                                         AR5K_DIAG_SW_5210 : AR5K_DIAG_SW_5211)
01430 #define AR5K_DIAG_SW_DIS_WEP_ACK        0x00000001      /* Disable ACKs if WEP key is invalid */
01431 #define AR5K_DIAG_SW_DIS_ACK            0x00000002      /* Disable ACKs */
01432 #define AR5K_DIAG_SW_DIS_CTS            0x00000004      /* Disable CTSs */
01433 #define AR5K_DIAG_SW_DIS_ENC            0x00000008      /* Disable encryption */
01434 #define AR5K_DIAG_SW_DIS_DEC            0x00000010      /* Disable decryption */
01435 #define AR5K_DIAG_SW_DIS_TX             0x00000020      /* Disable transmit [5210] */
01436 #define AR5K_DIAG_SW_DIS_RX_5210        0x00000040      /* Disable recieve */
01437 #define AR5K_DIAG_SW_DIS_RX_5211        0x00000020
01438 #define AR5K_DIAG_SW_DIS_RX             (ah->ah_version == AR5K_AR5210 ? \
01439                                         AR5K_DIAG_SW_DIS_RX_5210 : AR5K_DIAG_SW_DIS_RX_5211)
01440 #define AR5K_DIAG_SW_LOOP_BACK_5210     0x00000080      /* Loopback (i guess it goes with DIS_TX) [5210] */
01441 #define AR5K_DIAG_SW_LOOP_BACK_5211     0x00000040
01442 #define AR5K_DIAG_SW_LOOP_BACK          (ah->ah_version == AR5K_AR5210 ? \
01443                                         AR5K_DIAG_SW_LOOP_BACK_5210 : AR5K_DIAG_SW_LOOP_BACK_5211)
01444 #define AR5K_DIAG_SW_CORR_FCS_5210      0x00000100      /* Corrupted FCS */
01445 #define AR5K_DIAG_SW_CORR_FCS_5211      0x00000080
01446 #define AR5K_DIAG_SW_CORR_FCS           (ah->ah_version == AR5K_AR5210 ? \
01447                                         AR5K_DIAG_SW_CORR_FCS_5210 : AR5K_DIAG_SW_CORR_FCS_5211)
01448 #define AR5K_DIAG_SW_CHAN_INFO_5210     0x00000200      /* Dump channel info */
01449 #define AR5K_DIAG_SW_CHAN_INFO_5211     0x00000100
01450 #define AR5K_DIAG_SW_CHAN_INFO          (ah->ah_version == AR5K_AR5210 ? \
01451                                         AR5K_DIAG_SW_CHAN_INFO_5210 : AR5K_DIAG_SW_CHAN_INFO_5211)
01452 #define AR5K_DIAG_SW_EN_SCRAM_SEED_5210 0x00000400      /* Enable fixed scrambler seed */
01453 #define AR5K_DIAG_SW_EN_SCRAM_SEED_5211 0x00000200
01454 #define AR5K_DIAG_SW_EN_SCRAM_SEED      (ah->ah_version == AR5K_AR5210 ? \
01455                                         AR5K_DIAG_SW_EN_SCRAM_SEED_5210 : AR5K_DIAG_SW_EN_SCRAM_SEED_5211)
01456 #define AR5K_DIAG_SW_ECO_ENABLE         0x00000400      /* [5211+] */
01457 #define AR5K_DIAG_SW_SCVRAM_SEED        0x0003f800      /* [5210] */
01458 #define AR5K_DIAG_SW_SCRAM_SEED_M       0x0001fc00      /* Scrambler seed mask */
01459 #define AR5K_DIAG_SW_SCRAM_SEED_S       10
01460 #define AR5K_DIAG_SW_DIS_SEQ_INC        0x00040000      /* Disable seqnum increment (?)[5210] */
01461 #define AR5K_DIAG_SW_FRAME_NV0_5210     0x00080000
01462 #define AR5K_DIAG_SW_FRAME_NV0_5211     0x00020000      /* Accept frames of non-zero protocol number */
01463 #define AR5K_DIAG_SW_FRAME_NV0          (ah->ah_version == AR5K_AR5210 ? \
01464                                         AR5K_DIAG_SW_FRAME_NV0_5210 : AR5K_DIAG_SW_FRAME_NV0_5211)
01465 #define AR5K_DIAG_SW_OBSPT_M            0x000c0000      /* Observation point select (?) */
01466 #define AR5K_DIAG_SW_OBSPT_S            18
01467 #define AR5K_DIAG_SW_RX_CLEAR_HIGH      0x0010000       /* Force RX Clear high */
01468 #define AR5K_DIAG_SW_IGNORE_CARR_SENSE  0x0020000       /* Ignore virtual carrier sense */
01469 #define AR5K_DIAG_SW_CHANEL_IDLE_HIGH   0x0040000       /* Force channel idle high */
01470 #define AR5K_DIAG_SW_PHEAR_ME           0x0080000       /* ??? */
01471 
01472 /*
01473  * TSF (clock) register (lower 32 bits)
01474  */
01475 #define AR5K_TSF_L32_5210       0x806c
01476 #define AR5K_TSF_L32_5211       0x804c
01477 #define AR5K_TSF_L32            (ah->ah_version == AR5K_AR5210 ? \
01478                                 AR5K_TSF_L32_5210 : AR5K_TSF_L32_5211)
01479 
01480 /*
01481  * TSF (clock) register (higher 32 bits)
01482  */
01483 #define AR5K_TSF_U32_5210       0x8070
01484 #define AR5K_TSF_U32_5211       0x8050
01485 #define AR5K_TSF_U32            (ah->ah_version == AR5K_AR5210 ? \
01486                                 AR5K_TSF_U32_5210 : AR5K_TSF_U32_5211)
01487 
01488 /*
01489  * Last beacon timestamp register (Read Only)
01490  */
01491 #define AR5K_LAST_TSTP  0x8080
01492 
01493 /*
01494  * ADDAC test register [5211+]
01495  */
01496 #define AR5K_ADDAC_TEST                 0x8054                  /* Register Address */
01497 #define AR5K_ADDAC_TEST_TXCONT          0x00000001      /* Test continuous tx */
01498 #define AR5K_ADDAC_TEST_TST_MODE        0x00000002      /* Test mode */
01499 #define AR5K_ADDAC_TEST_LOOP_EN         0x00000004      /* Enable loop */
01500 #define AR5K_ADDAC_TEST_LOOP_LEN        0x00000008      /* Loop length (field) */
01501 #define AR5K_ADDAC_TEST_USE_U8          0x00004000      /* Use upper 8 bits */
01502 #define AR5K_ADDAC_TEST_MSB             0x00008000      /* State of MSB */
01503 #define AR5K_ADDAC_TEST_TRIG_SEL        0x00010000      /* Trigger select */
01504 #define AR5K_ADDAC_TEST_TRIG_PTY        0x00020000      /* Trigger polarity */
01505 #define AR5K_ADDAC_TEST_RXCONT          0x00040000      /* Continuous capture */
01506 #define AR5K_ADDAC_TEST_CAPTURE         0x00080000      /* Begin capture */
01507 #define AR5K_ADDAC_TEST_TST_ARM         0x00100000      /* ARM rx buffer for capture */
01508 
01509 /*
01510  * Default antenna register [5211+]
01511  */
01512 #define AR5K_DEFAULT_ANTENNA    0x8058
01513 
01514 /*
01515  * Frame control QoS mask register (?) [5211+]
01516  * (FC_QOS_MASK)
01517  */
01518 #define AR5K_FRAME_CTL_QOSM     0x805c
01519 
01520 /*
01521  * Seq mask register (?) [5211+]
01522  */
01523 #define AR5K_SEQ_MASK   0x8060
01524 
01525 /*
01526  * Retry count register [5210]
01527  */
01528 #define AR5K_RETRY_CNT          0x8084                  /* Register Address [5210] */
01529 #define AR5K_RETRY_CNT_SSH      0x0000003f      /* Station short retry count (?) */
01530 #define AR5K_RETRY_CNT_SLG      0x00000fc0      /* Station long retry count (?) */
01531 
01532 /*
01533  * Back-off status register [5210]
01534  */
01535 #define AR5K_BACKOFF            0x8088                  /* Register Address [5210] */
01536 #define AR5K_BACKOFF_CW         0x000003ff      /* Backoff Contention Window (?) */
01537 #define AR5K_BACKOFF_CNT        0x03ff0000      /* Backoff count (?) */
01538 
01539 
01540 
01541 /*
01542  * NAV register (current)
01543  */
01544 #define AR5K_NAV_5210           0x808c
01545 #define AR5K_NAV_5211           0x8084
01546 #define AR5K_NAV                (ah->ah_version == AR5K_AR5210 ? \
01547                                 AR5K_NAV_5210 : AR5K_NAV_5211)
01548 
01549 /*
01550  * RTS success register
01551  */
01552 #define AR5K_RTS_OK_5210        0x8090
01553 #define AR5K_RTS_OK_5211        0x8088
01554 #define AR5K_RTS_OK             (ah->ah_version == AR5K_AR5210 ? \
01555                                 AR5K_RTS_OK_5210 : AR5K_RTS_OK_5211)
01556 
01557 /*
01558  * RTS failure register
01559  */
01560 #define AR5K_RTS_FAIL_5210      0x8094
01561 #define AR5K_RTS_FAIL_5211      0x808c
01562 #define AR5K_RTS_FAIL           (ah->ah_version == AR5K_AR5210 ? \
01563                                 AR5K_RTS_FAIL_5210 : AR5K_RTS_FAIL_5211)
01564 
01565 /*
01566  * ACK failure register
01567  */
01568 #define AR5K_ACK_FAIL_5210      0x8098
01569 #define AR5K_ACK_FAIL_5211      0x8090
01570 #define AR5K_ACK_FAIL           (ah->ah_version == AR5K_AR5210 ? \
01571                                 AR5K_ACK_FAIL_5210 : AR5K_ACK_FAIL_5211)
01572 
01573 /*
01574  * FCS failure register
01575  */
01576 #define AR5K_FCS_FAIL_5210      0x809c
01577 #define AR5K_FCS_FAIL_5211      0x8094
01578 #define AR5K_FCS_FAIL           (ah->ah_version == AR5K_AR5210 ? \
01579                                 AR5K_FCS_FAIL_5210 : AR5K_FCS_FAIL_5211)
01580 
01581 /*
01582  * Beacon count register
01583  */
01584 #define AR5K_BEACON_CNT_5210    0x80a0
01585 #define AR5K_BEACON_CNT_5211    0x8098
01586 #define AR5K_BEACON_CNT         (ah->ah_version == AR5K_AR5210 ? \
01587                                 AR5K_BEACON_CNT_5210 : AR5K_BEACON_CNT_5211)
01588 
01589 
01590 /*===5212 Specific PCU registers===*/
01591 
01592 /*
01593  * Transmit power control register
01594  */
01595 #define AR5K_TPC                        0x80e8
01596 #define AR5K_TPC_ACK                    0x0000003f      /* ack frames */
01597 #define AR5K_TPC_ACK_S                  0
01598 #define AR5K_TPC_CTS                    0x00003f00      /* cts frames */
01599 #define AR5K_TPC_CTS_S                  8
01600 #define AR5K_TPC_CHIRP                  0x003f0000      /* chirp frames */
01601 #define AR5K_TPC_CHIRP_S                16
01602 #define AR5K_TPC_DOPPLER                0x0f000000      /* doppler chirp span */
01603 #define AR5K_TPC_DOPPLER_S              24
01604 
01605 /*
01606  * XR (eXtended Range) mode register
01607  */
01608 #define AR5K_XRMODE                     0x80c0                  /* Register Address */
01609 #define AR5K_XRMODE_POLL_TYPE_M         0x0000003f      /* Mask for Poll type (?) */
01610 #define AR5K_XRMODE_POLL_TYPE_S         0
01611 #define AR5K_XRMODE_POLL_SUBTYPE_M      0x0000003c      /* Mask for Poll subtype (?) */
01612 #define AR5K_XRMODE_POLL_SUBTYPE_S      2
01613 #define AR5K_XRMODE_POLL_WAIT_ALL       0x00000080      /* Wait for poll */
01614 #define AR5K_XRMODE_SIFS_DELAY          0x000fff00      /* Mask for SIFS delay */
01615 #define AR5K_XRMODE_FRAME_HOLD_M        0xfff00000      /* Mask for frame hold (?) */
01616 #define AR5K_XRMODE_FRAME_HOLD_S        20
01617 
01618 /*
01619  * XR delay register
01620  */
01621 #define AR5K_XRDELAY                    0x80c4                  /* Register Address */
01622 #define AR5K_XRDELAY_SLOT_DELAY_M       0x0000ffff      /* Mask for slot delay */
01623 #define AR5K_XRDELAY_SLOT_DELAY_S       0
01624 #define AR5K_XRDELAY_CHIRP_DELAY_M      0xffff0000      /* Mask for CHIRP data delay */
01625 #define AR5K_XRDELAY_CHIRP_DELAY_S      16
01626 
01627 /*
01628  * XR timeout register
01629  */
01630 #define AR5K_XRTIMEOUT                  0x80c8                  /* Register Address */
01631 #define AR5K_XRTIMEOUT_CHIRP_M          0x0000ffff      /* Mask for CHIRP timeout */
01632 #define AR5K_XRTIMEOUT_CHIRP_S          0
01633 #define AR5K_XRTIMEOUT_POLL_M           0xffff0000      /* Mask for Poll timeout */
01634 #define AR5K_XRTIMEOUT_POLL_S           16
01635 
01636 /*
01637  * XR chirp register
01638  */
01639 #define AR5K_XRCHIRP                    0x80cc                  /* Register Address */
01640 #define AR5K_XRCHIRP_SEND               0x00000001      /* Send CHIRP */
01641 #define AR5K_XRCHIRP_GAP                0xffff0000      /* Mask for CHIRP gap (?) */
01642 
01643 /*
01644  * XR stomp register
01645  */
01646 #define AR5K_XRSTOMP                    0x80d0                  /* Register Address */
01647 #define AR5K_XRSTOMP_TX                 0x00000001      /* Stomp Tx (?) */
01648 #define AR5K_XRSTOMP_RX                 0x00000002      /* Stomp Rx (?) */
01649 #define AR5K_XRSTOMP_TX_RSSI            0x00000004      /* Stomp Tx RSSI (?) */
01650 #define AR5K_XRSTOMP_TX_BSSID           0x00000008      /* Stomp Tx BSSID (?) */
01651 #define AR5K_XRSTOMP_DATA               0x00000010      /* Stomp data (?)*/
01652 #define AR5K_XRSTOMP_RSSI_THRES         0x0000ff00      /* Mask for XR RSSI threshold */
01653 
01654 /*
01655  * First enhanced sleep register
01656  */
01657 #define AR5K_SLEEP0                     0x80d4                  /* Register Address */
01658 #define AR5K_SLEEP0_NEXT_DTIM           0x0007ffff      /* Mask for next DTIM (?) */
01659 #define AR5K_SLEEP0_NEXT_DTIM_S         0
01660 #define AR5K_SLEEP0_ASSUME_DTIM         0x00080000      /* Assume DTIM */
01661 #define AR5K_SLEEP0_ENH_SLEEP_EN        0x00100000      /* Enable enchanced sleep control */
01662 #define AR5K_SLEEP0_CABTO               0xff000000      /* Mask for CAB Time Out */
01663 #define AR5K_SLEEP0_CABTO_S             24
01664 
01665 /*
01666  * Second enhanced sleep register
01667  */
01668 #define AR5K_SLEEP1                     0x80d8                  /* Register Address */
01669 #define AR5K_SLEEP1_NEXT_TIM            0x0007ffff      /* Mask for next TIM (?) */
01670 #define AR5K_SLEEP1_NEXT_TIM_S          0
01671 #define AR5K_SLEEP1_BEACON_TO           0xff000000      /* Mask for Beacon Time Out */
01672 #define AR5K_SLEEP1_BEACON_TO_S         24
01673 
01674 /*
01675  * Third enhanced sleep register
01676  */
01677 #define AR5K_SLEEP2                     0x80dc                  /* Register Address */
01678 #define AR5K_SLEEP2_TIM_PER             0x0000ffff      /* Mask for TIM period (?) */
01679 #define AR5K_SLEEP2_TIM_PER_S           0
01680 #define AR5K_SLEEP2_DTIM_PER            0xffff0000      /* Mask for DTIM period (?) */
01681 #define AR5K_SLEEP2_DTIM_PER_S          16
01682 
01683 /*
01684  * BSSID mask registers
01685  */
01686 #define AR5K_BSS_IDM0                   0x80e0  /* Upper bits */
01687 #define AR5K_BSS_IDM1                   0x80e4  /* Lower bits */
01688 
01689 /*
01690  * TX power control (TPC) register
01691  *
01692  * XXX: PCDAC steps (0.5dbm) or DBM ?
01693  *
01694  */
01695 #define AR5K_TXPC                       0x80e8                  /* Register Address */
01696 #define AR5K_TXPC_ACK_M                 0x0000003f      /* ACK tx power */
01697 #define AR5K_TXPC_ACK_S                 0
01698 #define AR5K_TXPC_CTS_M                 0x00003f00      /* CTS tx power */
01699 #define AR5K_TXPC_CTS_S                 8
01700 #define AR5K_TXPC_CHIRP_M               0x003f0000      /* CHIRP tx power */
01701 #define AR5K_TXPC_CHIRP_S               16
01702 #define AR5K_TXPC_DOPPLER               0x0f000000      /* Doppler chirp span (?) */
01703 #define AR5K_TXPC_DOPPLER_S             24
01704 
01705 /*
01706  * Profile count registers
01707  */
01708 #define AR5K_PROFCNT_TX                 0x80ec  /* Tx count */
01709 #define AR5K_PROFCNT_RX                 0x80f0  /* Rx count */
01710 #define AR5K_PROFCNT_RXCLR              0x80f4  /* Clear Rx count */
01711 #define AR5K_PROFCNT_CYCLE              0x80f8  /* Cycle count (?) */
01712 
01713 /*
01714  * Quiet period control registers
01715  */
01716 #define AR5K_QUIET_CTL1                 0x80fc                  /* Register Address */
01717 #define AR5K_QUIET_CTL1_NEXT_QT_TSF     0x0000ffff      /* Next quiet period TSF (TU) */
01718 #define AR5K_QUIET_CTL1_NEXT_QT_TSF_S   0
01719 #define AR5K_QUIET_CTL1_QT_EN           0x00010000      /* Enable quiet period */
01720 #define AR5K_QUIET_CTL1_ACK_CTS_EN      0x00020000      /* Send ACK/CTS during quiet period */
01721 
01722 #define AR5K_QUIET_CTL2                 0x8100                  /* Register Address */
01723 #define AR5K_QUIET_CTL2_QT_PER          0x0000ffff      /* Mask for quiet period periodicity */
01724 #define AR5K_QUIET_CTL2_QT_PER_S        0
01725 #define AR5K_QUIET_CTL2_QT_DUR          0xffff0000      /* Mask for quiet period duration */
01726 #define AR5K_QUIET_CTL2_QT_DUR_S        16
01727 
01728 /*
01729  * TSF parameter register
01730  */
01731 #define AR5K_TSF_PARM                   0x8104                  /* Register Address */
01732 #define AR5K_TSF_PARM_INC               0x000000ff      /* Mask for TSF increment */
01733 #define AR5K_TSF_PARM_INC_S             0
01734 
01735 /*
01736  * QoS NOACK policy
01737  */
01738 #define AR5K_QOS_NOACK                  0x8108                  /* Register Address */
01739 #define AR5K_QOS_NOACK_2BIT_VALUES      0x0000000f      /* ??? */
01740 #define AR5K_QOS_NOACK_2BIT_VALUES_S    0
01741 #define AR5K_QOS_NOACK_BIT_OFFSET       0x00000070      /* ??? */
01742 #define AR5K_QOS_NOACK_BIT_OFFSET_S     4
01743 #define AR5K_QOS_NOACK_BYTE_OFFSET      0x00000180      /* ??? */
01744 #define AR5K_QOS_NOACK_BYTE_OFFSET_S    7
01745 
01746 /*
01747  * PHY error filter register
01748  */
01749 #define AR5K_PHY_ERR_FIL                0x810c
01750 #define AR5K_PHY_ERR_FIL_RADAR          0x00000020      /* Radar signal */
01751 #define AR5K_PHY_ERR_FIL_OFDM           0x00020000      /* OFDM false detect (ANI) */
01752 #define AR5K_PHY_ERR_FIL_CCK            0x02000000      /* CCK false detect (ANI) */
01753 
01754 /*
01755  * XR latency register
01756  */
01757 #define AR5K_XRLAT_TX           0x8110
01758 
01759 /*
01760  * ACK SIFS register
01761  */
01762 #define AR5K_ACKSIFS            0x8114                  /* Register Address */
01763 #define AR5K_ACKSIFS_INC        0x00000000      /* ACK SIFS Increment (field) */
01764 
01765 /*
01766  * MIC QoS control register (?)
01767  */
01768 #define AR5K_MIC_QOS_CTL                0x8118                  /* Register Address */
01769 #define AR5K_MIC_QOS_CTL_OFF(_n)        (1 << (_n * 2))
01770 #define AR5K_MIC_QOS_CTL_MQ_EN          0x00010000      /* Enable MIC QoS */
01771 
01772 /*
01773  * MIC QoS select register (?)
01774  */
01775 #define AR5K_MIC_QOS_SEL                0x811c
01776 #define AR5K_MIC_QOS_SEL_OFF(_n)        (1 << (_n * 4))
01777 
01778 /*
01779  * Misc mode control register (?)
01780  */
01781 #define AR5K_MISC_MODE                  0x8120                  /* Register Address */
01782 #define AR5K_MISC_MODE_FBSSID_MATCH     0x00000001      /* Force BSSID match */
01783 #define AR5K_MISC_MODE_ACKSIFS_MEM      0x00000002      /* ACK SIFS memory (?) */
01784 #define AR5K_MISC_MODE_COMBINED_MIC     0x00000004      /* use rx/tx MIC key */
01785 /* more bits */
01786 
01787 /*
01788  * OFDM Filter counter
01789  */
01790 #define AR5K_OFDM_FIL_CNT               0x8124
01791 
01792 /*
01793  * CCK Filter counter
01794  */
01795 #define AR5K_CCK_FIL_CNT                0x8128
01796 
01797 /*
01798  * PHY Error Counters (?)
01799  */
01800 #define AR5K_PHYERR_CNT1                0x812c
01801 #define AR5K_PHYERR_CNT1_MASK           0x8130
01802 
01803 #define AR5K_PHYERR_CNT2                0x8134
01804 #define AR5K_PHYERR_CNT2_MASK           0x8138
01805 
01806 /*
01807  * TSF Threshold register (?)
01808  */
01809 #define AR5K_TSF_THRES                  0x813c
01810 
01811 /*
01812  * TODO: Wake On Wireless registers
01813  * Range: 0x8147 - 0x818c
01814  */
01815 
01816 /*
01817  * Rate -> ACK SIFS mapping table (32 entries)
01818  */
01819 #define AR5K_RATE_ACKSIFS_BASE          0x8680                  /* Register Address */
01820 #define AR5K_RATE_ACKSIFS(_n)           (AR5K_RATE_ACKSIFS_BSE + ((_n) << 2))
01821 #define AR5K_RATE_ACKSIFS_NORMAL        0x00000001      /* Normal SIFS (field) */
01822 #define AR5K_RATE_ACKSIFS_TURBO         0x00000400      /* Turbo SIFS (field) */
01823 
01824 /*
01825  * Rate -> duration mapping table (32 entries)
01826  */
01827 #define AR5K_RATE_DUR_BASE              0x8700
01828 #define AR5K_RATE_DUR(_n)               (AR5K_RATE_DUR_BASE + ((_n) << 2))
01829 
01830 /*
01831  * Rate -> db mapping table
01832  * (8 entries, each one has 4 8bit fields)
01833  */
01834 #define AR5K_RATE2DB_BASE               0x87c0
01835 #define AR5K_RATE2DB(_n)                (AR5K_RATE2DB_BASE + ((_n) << 2))
01836 
01837 /*
01838  * db -> Rate mapping table
01839  * (8 entries, each one has 4 8bit fields)
01840  */
01841 #define AR5K_DB2RATE_BASE               0x87e0
01842 #define AR5K_DB2RATE(_n)                (AR5K_DB2RATE_BASE + ((_n) << 2))
01843 
01844 /*===5212 end===*/
01845 
01846 /*
01847  * Key table (WEP) register
01848  */
01849 #define AR5K_KEYTABLE_0_5210            0x9000
01850 #define AR5K_KEYTABLE_0_5211            0x8800
01851 #define AR5K_KEYTABLE_5210(_n)          (AR5K_KEYTABLE_0_5210 + ((_n) << 5))
01852 #define AR5K_KEYTABLE_5211(_n)          (AR5K_KEYTABLE_0_5211 + ((_n) << 5))
01853 #define AR5K_KEYTABLE(_n)               (ah->ah_version == AR5K_AR5210 ? \
01854                                         AR5K_KEYTABLE_5210(_n) : AR5K_KEYTABLE_5211(_n))
01855 #define AR5K_KEYTABLE_OFF(_n, x)        (AR5K_KEYTABLE(_n) + (x << 2))
01856 #define AR5K_KEYTABLE_TYPE(_n)          AR5K_KEYTABLE_OFF(_n, 5)
01857 #define AR5K_KEYTABLE_TYPE_40           0x00000000
01858 #define AR5K_KEYTABLE_TYPE_104          0x00000001
01859 #define AR5K_KEYTABLE_TYPE_128          0x00000003
01860 #define AR5K_KEYTABLE_TYPE_TKIP         0x00000004      /* [5212+] */
01861 #define AR5K_KEYTABLE_TYPE_AES          0x00000005      /* [5211+] */
01862 #define AR5K_KEYTABLE_TYPE_CCM          0x00000006      /* [5212+] */
01863 #define AR5K_KEYTABLE_TYPE_NULL         0x00000007      /* [5211+] */
01864 #define AR5K_KEYTABLE_ANTENNA           0x00000008      /* [5212+] */
01865 #define AR5K_KEYTABLE_MAC0(_n)          AR5K_KEYTABLE_OFF(_n, 6)
01866 #define AR5K_KEYTABLE_MAC1(_n)          AR5K_KEYTABLE_OFF(_n, 7)
01867 #define AR5K_KEYTABLE_VALID             0x00008000
01868 
01869 /* If key type is TKIP and MIC is enabled
01870  * MIC key goes in offset entry + 64 */
01871 #define AR5K_KEYTABLE_MIC_OFFSET        64
01872 
01873 /* WEP 40-bit   = 40-bit  entered key + 24 bit IV = 64-bit
01874  * WEP 104-bit  = 104-bit entered key + 24-bit IV = 128-bit
01875  * WEP 128-bit  = 128-bit entered key + 24 bit IV = 152-bit
01876  *
01877  * Some vendors have introduced bigger WEP keys to address
01878  * security vulnerabilities in WEP. This includes:
01879  *
01880  * WEP 232-bit = 232-bit entered key + 24 bit IV = 256-bit
01881  *
01882  * We can expand this if we find ar5k Atheros cards with a larger
01883  * key table size.
01884  */
01885 #define AR5K_KEYTABLE_SIZE_5210         64
01886 #define AR5K_KEYTABLE_SIZE_5211         128
01887 #define AR5K_KEYTABLE_SIZE              (ah->ah_version == AR5K_AR5210 ? \
01888                                         AR5K_KEYTABLE_SIZE_5210 : AR5K_KEYTABLE_SIZE_5211)
01889 
01890 
01891 /*===PHY REGISTERS===*/
01892 
01893 /*
01894  * PHY registers start
01895  */
01896 #define AR5K_PHY_BASE                   0x9800
01897 #define AR5K_PHY(_n)                    (AR5K_PHY_BASE + ((_n) << 2))
01898 
01899 /*
01900  * TST_2 (Misc config parameters)
01901  */
01902 #define AR5K_PHY_TST2                   0x9800                  /* Register Address */
01903 #define AR5K_PHY_TST2_TRIG_SEL          0x00000007      /* Trigger select (?)*/
01904 #define AR5K_PHY_TST2_TRIG              0x00000010      /* Trigger (?) */
01905 #define AR5K_PHY_TST2_CBUS_MODE         0x00000060      /* Cardbus mode (?) */
01906 #define AR5K_PHY_TST2_CLK32             0x00000400      /* CLK_OUT is CLK32 (32Khz external) */
01907 #define AR5K_PHY_TST2_CHANCOR_DUMP_EN   0x00000800      /* Enable Chancor dump (?) */
01908 #define AR5K_PHY_TST2_EVEN_CHANCOR_DUMP 0x00001000      /* Even Chancor dump (?) */
01909 #define AR5K_PHY_TST2_RFSILENT_EN       0x00002000      /* Enable RFSILENT */
01910 #define AR5K_PHY_TST2_ALT_RFDATA        0x00004000      /* Alternate RFDATA (5-2GHz switch ?) */
01911 #define AR5K_PHY_TST2_MINI_OBS_EN       0x00008000      /* Enable mini OBS (?) */
01912 #define AR5K_PHY_TST2_RX2_IS_RX5_INV    0x00010000      /* 2GHz rx path is the 5GHz path inverted (?) */
01913 #define AR5K_PHY_TST2_SLOW_CLK160       0x00020000      /* Slow CLK160 (?) */
01914 #define AR5K_PHY_TST2_AGC_OBS_SEL_3     0x00040000      /* AGC OBS Select 3 (?) */
01915 #define AR5K_PHY_TST2_BBB_OBS_SEL       0x00080000      /* BB OBS Select (field ?) */
01916 #define AR5K_PHY_TST2_ADC_OBS_SEL       0x00800000      /* ADC OBS Select (field ?) */
01917 #define AR5K_PHY_TST2_RX_CLR_SEL        0x08000000      /* RX Clear Select (?) */
01918 #define AR5K_PHY_TST2_FORCE_AGC_CLR     0x10000000      /* Force AGC clear (?) */
01919 #define AR5K_PHY_SHIFT_2GHZ             0x00004007      /* Used to access 2GHz radios */
01920 #define AR5K_PHY_SHIFT_5GHZ             0x00000007      /* Used to access 5GHz radios (default) */
01921 
01922 /*
01923  * PHY frame control register [5110] /turbo mode register [5111+]
01924  *
01925  * There is another frame control register for [5111+]
01926  * at address 0x9944 (see below) but the 2 first flags
01927  * are common here between 5110 frame control register
01928  * and [5111+] turbo mode register, so this also works as
01929  * a "turbo mode register" for 5110. We treat this one as
01930  * a frame control register for 5110 below.
01931  */
01932 #define AR5K_PHY_TURBO                  0x9804                  /* Register Address */
01933 #define AR5K_PHY_TURBO_MODE             0x00000001      /* Enable turbo mode */
01934 #define AR5K_PHY_TURBO_SHORT            0x00000002      /* Set short symbols to turbo mode */
01935 #define AR5K_PHY_TURBO_MIMO             0x00000004      /* Set turbo for mimo mimo */
01936 
01937 /*
01938  * PHY agility command register
01939  * (aka TST_1)
01940  */
01941 #define AR5K_PHY_AGC                    0x9808                  /* Register Address */
01942 #define AR5K_PHY_TST1                   0x9808
01943 #define AR5K_PHY_AGC_DISABLE            0x08000000      /* Disable AGC to A2 (?)*/
01944 #define AR5K_PHY_TST1_TXHOLD            0x00003800      /* Set tx hold (?) */
01945 #define AR5K_PHY_TST1_TXSRC_SRC         0x00000002      /* Used with bit 7 (?) */
01946 #define AR5K_PHY_TST1_TXSRC_SRC_S       1
01947 #define AR5K_PHY_TST1_TXSRC_ALT         0x00000080      /* Set input to tsdac (?) */
01948 #define AR5K_PHY_TST1_TXSRC_ALT_S       7
01949 
01950 
01951 /*
01952  * PHY timing register 3 [5112+]
01953  */
01954 #define AR5K_PHY_TIMING_3               0x9814
01955 #define AR5K_PHY_TIMING_3_DSC_MAN       0xfffe0000
01956 #define AR5K_PHY_TIMING_3_DSC_MAN_S     17
01957 #define AR5K_PHY_TIMING_3_DSC_EXP       0x0001e000
01958 #define AR5K_PHY_TIMING_3_DSC_EXP_S     13
01959 
01960 /*
01961  * PHY chip revision register
01962  */
01963 #define AR5K_PHY_CHIP_ID                0x9818
01964 
01965 /*
01966  * PHY activation register
01967  */
01968 #define AR5K_PHY_ACT                    0x981c                  /* Register Address */
01969 #define AR5K_PHY_ACT_ENABLE             0x00000001      /* Activate PHY */
01970 #define AR5K_PHY_ACT_DISABLE            0x00000002      /* Deactivate PHY */
01971 
01972 /*
01973  * PHY RF control registers
01974  */
01975 #define AR5K_PHY_RF_CTL2                0x9824                  /* Register Address */
01976 #define AR5K_PHY_RF_CTL2_TXF2TXD_START  0x0000000f      /* TX frame to TX data start */
01977 #define AR5K_PHY_RF_CTL2_TXF2TXD_START_S        0
01978 
01979 #define AR5K_PHY_RF_CTL3                0x9828                  /* Register Address */
01980 #define AR5K_PHY_RF_CTL3_TXE2XLNA_ON    0x0000ff00      /* TX end to XLNA on */
01981 #define AR5K_PHY_RF_CTL3_TXE2XLNA_ON_S  8
01982 
01983 #define AR5K_PHY_ADC_CTL                        0x982c
01984 #define AR5K_PHY_ADC_CTL_INBUFGAIN_OFF          0x00000003
01985 #define AR5K_PHY_ADC_CTL_INBUFGAIN_OFF_S        0
01986 #define AR5K_PHY_ADC_CTL_PWD_DAC_OFF            0x00002000
01987 #define AR5K_PHY_ADC_CTL_PWD_BAND_GAP_OFF       0x00004000
01988 #define AR5K_PHY_ADC_CTL_PWD_ADC_OFF            0x00008000
01989 #define AR5K_PHY_ADC_CTL_INBUFGAIN_ON           0x00030000
01990 #define AR5K_PHY_ADC_CTL_INBUFGAIN_ON_S         16
01991 
01992 #define AR5K_PHY_RF_CTL4                0x9834                  /* Register Address */
01993 #define AR5K_PHY_RF_CTL4_TXF2XPA_A_ON   0x00000001      /* TX frame to XPA A on (field) */
01994 #define AR5K_PHY_RF_CTL4_TXF2XPA_B_ON   0x00000100      /* TX frame to XPA B on (field) */
01995 #define AR5K_PHY_RF_CTL4_TXE2XPA_A_OFF  0x00010000      /* TX end to XPA A off (field) */
01996 #define AR5K_PHY_RF_CTL4_TXE2XPA_B_OFF  0x01000000      /* TX end to XPA B off (field) */
01997 
01998 /*
01999  * Pre-Amplifier control register
02000  * (XPA -> external pre-amplifier)
02001  */
02002 #define AR5K_PHY_PA_CTL                 0x9838                  /* Register Address */
02003 #define AR5K_PHY_PA_CTL_XPA_A_HI        0x00000001      /* XPA A high (?) */
02004 #define AR5K_PHY_PA_CTL_XPA_B_HI        0x00000002      /* XPA B high (?) */
02005 #define AR5K_PHY_PA_CTL_XPA_A_EN        0x00000004      /* Enable XPA A */
02006 #define AR5K_PHY_PA_CTL_XPA_B_EN        0x00000008      /* Enable XPA B */
02007 
02008 /*
02009  * PHY settling register
02010  */
02011 #define AR5K_PHY_SETTLING               0x9844                  /* Register Address */
02012 #define AR5K_PHY_SETTLING_AGC           0x0000007f      /* AGC settling time */
02013 #define AR5K_PHY_SETTLING_AGC_S         0
02014 #define AR5K_PHY_SETTLING_SWITCH        0x00003f80      /* Switch settlig time */
02015 #define AR5K_PHY_SETTLING_SWITCH_S      7
02016 
02017 /*
02018  * PHY Gain registers
02019  */
02020 #define AR5K_PHY_GAIN                   0x9848                  /* Register Address */
02021 #define AR5K_PHY_GAIN_TXRX_ATTEN        0x0003f000      /* TX-RX Attenuation */
02022 #define AR5K_PHY_GAIN_TXRX_ATTEN_S      12
02023 #define AR5K_PHY_GAIN_TXRX_RF_MAX       0x007c0000
02024 #define AR5K_PHY_GAIN_TXRX_RF_MAX_S     18
02025 
02026 #define AR5K_PHY_GAIN_OFFSET            0x984c                  /* Register Address */
02027 #define AR5K_PHY_GAIN_OFFSET_RXTX_FLAG  0x00020000      /* RX-TX flag (?) */
02028 
02029 /*
02030  * Desired ADC/PGA size register
02031  * (for more infos read ANI patent)
02032  */
02033 #define AR5K_PHY_DESIRED_SIZE           0x9850                  /* Register Address */
02034 #define AR5K_PHY_DESIRED_SIZE_ADC       0x000000ff      /* ADC desired size */
02035 #define AR5K_PHY_DESIRED_SIZE_ADC_S     0
02036 #define AR5K_PHY_DESIRED_SIZE_PGA       0x0000ff00      /* PGA desired size */
02037 #define AR5K_PHY_DESIRED_SIZE_PGA_S     8
02038 #define AR5K_PHY_DESIRED_SIZE_TOT       0x0ff00000      /* Total desired size */
02039 #define AR5K_PHY_DESIRED_SIZE_TOT_S     20
02040 
02041 /*
02042  * PHY signal register
02043  * (for more infos read ANI patent)
02044  */
02045 #define AR5K_PHY_SIG                    0x9858                  /* Register Address */
02046 #define AR5K_PHY_SIG_FIRSTEP            0x0003f000      /* FIRSTEP */
02047 #define AR5K_PHY_SIG_FIRSTEP_S          12
02048 #define AR5K_PHY_SIG_FIRPWR             0x03fc0000      /* FIPWR */
02049 #define AR5K_PHY_SIG_FIRPWR_S           18
02050 
02051 /*
02052  * PHY coarse agility control register
02053  * (for more infos read ANI patent)
02054  */
02055 #define AR5K_PHY_AGCCOARSE              0x985c                  /* Register Address */
02056 #define AR5K_PHY_AGCCOARSE_LO           0x00007f80      /* AGC Coarse low */
02057 #define AR5K_PHY_AGCCOARSE_LO_S         7
02058 #define AR5K_PHY_AGCCOARSE_HI           0x003f8000      /* AGC Coarse high */
02059 #define AR5K_PHY_AGCCOARSE_HI_S         15
02060 
02061 /*
02062  * PHY agility control register
02063  */
02064 #define AR5K_PHY_AGCCTL                 0x9860                  /* Register address */
02065 #define AR5K_PHY_AGCCTL_CAL             0x00000001      /* Enable PHY calibration */
02066 #define AR5K_PHY_AGCCTL_NF              0x00000002      /* Enable Noise Floor calibration */
02067 #define AR5K_PHY_AGCCTL_OFDM_DIV_DIS    0x00000008      /* Disable antenna diversity on OFDM modes */
02068 #define AR5K_PHY_AGCCTL_NF_EN           0x00008000      /* Enable nf calibration to happen (?) */
02069 #define AR5K_PHY_AGCTL_FLTR_CAL         0x00010000      /* Allow filter calibration (?) */
02070 #define AR5K_PHY_AGCCTL_NF_NOUPDATE     0x00020000      /* Don't update nf automaticaly */
02071 
02072 /*
02073  * PHY noise floor status register
02074  */
02075 #define AR5K_PHY_NF                     0x9864                  /* Register address */
02076 #define AR5K_PHY_NF_M                   0x000001ff      /* Noise floor mask */
02077 #define AR5K_PHY_NF_ACTIVE              0x00000100      /* Noise floor calibration still active */
02078 #define AR5K_PHY_NF_RVAL(_n)            (((_n) >> 19) & AR5K_PHY_NF_M)
02079 #define AR5K_PHY_NF_AVAL(_n)            (-((_n) ^ AR5K_PHY_NF_M) + 1)
02080 #define AR5K_PHY_NF_SVAL(_n)            (((_n) & AR5K_PHY_NF_M) | (1 << 9))
02081 #define AR5K_PHY_NF_THRESH62            0x0007f000      /* Thresh62 -check ANI patent- (field) */
02082 #define AR5K_PHY_NF_THRESH62_S          12
02083 #define AR5K_PHY_NF_MINCCA_PWR          0x0ff80000      /* ??? */
02084 #define AR5K_PHY_NF_MINCCA_PWR_S        19
02085 
02086 /*
02087  * PHY ADC saturation register [5110]
02088  */
02089 #define AR5K_PHY_ADCSAT                 0x9868
02090 #define AR5K_PHY_ADCSAT_ICNT            0x0001f800
02091 #define AR5K_PHY_ADCSAT_ICNT_S          11
02092 #define AR5K_PHY_ADCSAT_THR             0x000007e0
02093 #define AR5K_PHY_ADCSAT_THR_S           5
02094 
02095 /*
02096  * PHY Weak ofdm signal detection threshold registers (ANI) [5212+]
02097  */
02098 
02099 /* High thresholds */
02100 #define AR5K_PHY_WEAK_OFDM_HIGH_THR             0x9868
02101 #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT    0x0000001f
02102 #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT_S  0
02103 #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1          0x00fe0000
02104 #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1_S        17
02105 #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2          0x7f000000
02106 #define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_S        24
02107 
02108 /* Low thresholds */
02109 #define AR5K_PHY_WEAK_OFDM_LOW_THR              0x986c
02110 #define AR5K_PHY_WEAK_OFDM_LOW_THR_SELFCOR_EN   0x00000001
02111 #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT     0x00003f00
02112 #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT_S   8
02113 #define AR5K_PHY_WEAK_OFDM_LOW_THR_M1           0x001fc000
02114 #define AR5K_PHY_WEAK_OFDM_LOW_THR_M1_S         14
02115 #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2           0x0fe00000
02116 #define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_S         21
02117 
02118 
02119 /*
02120  * PHY sleep registers [5112+]
02121  */
02122 #define AR5K_PHY_SCR                    0x9870
02123 
02124 #define AR5K_PHY_SLMT                   0x9874
02125 #define AR5K_PHY_SLMT_32MHZ             0x0000007f
02126 
02127 #define AR5K_PHY_SCAL                   0x9878
02128 #define AR5K_PHY_SCAL_32MHZ             0x0000000e
02129 #define AR5K_PHY_SCAL_32MHZ_2417        0x0000000a
02130 #define AR5K_PHY_SCAL_32MHZ_HB63        0x00000032
02131 
02132 /*
02133  * PHY PLL (Phase Locked Loop) control register
02134  */
02135 #define AR5K_PHY_PLL                    0x987c
02136 #define AR5K_PHY_PLL_20MHZ              0x00000013      /* For half rate (?) */
02137 /* 40MHz -> 5GHz band */
02138 #define AR5K_PHY_PLL_40MHZ_5211         0x00000018
02139 #define AR5K_PHY_PLL_40MHZ_5212         0x000000aa
02140 #define AR5K_PHY_PLL_40MHZ_5413         0x00000004
02141 #define AR5K_PHY_PLL_40MHZ              (ah->ah_version == AR5K_AR5211 ? \
02142                                         AR5K_PHY_PLL_40MHZ_5211 : AR5K_PHY_PLL_40MHZ_5212)
02143 /* 44MHz -> 2.4GHz band */
02144 #define AR5K_PHY_PLL_44MHZ_5211         0x00000019
02145 #define AR5K_PHY_PLL_44MHZ_5212         0x000000ab
02146 #define AR5K_PHY_PLL_44MHZ              (ah->ah_version == AR5K_AR5211 ? \
02147                                         AR5K_PHY_PLL_44MHZ_5211 : AR5K_PHY_PLL_44MHZ_5212)
02148 
02149 #define AR5K_PHY_PLL_RF5111             0x00000000
02150 #define AR5K_PHY_PLL_RF5112             0x00000040
02151 #define AR5K_PHY_PLL_HALF_RATE          0x00000100
02152 #define AR5K_PHY_PLL_QUARTER_RATE       0x00000200
02153 
02154 /*
02155  * RF Buffer register
02156  *
02157  * It's obvious from the code that 0x989c is the buffer register but
02158  * for the other special registers that we write to after sending each
02159  * packet, i have no idea. So i'll name them BUFFER_CONTROL_X registers
02160  * for now. It's interesting that they are also used for some other operations.
02161  */
02162 
02163 #define AR5K_RF_BUFFER                  0x989c
02164 #define AR5K_RF_BUFFER_CONTROL_0        0x98c0  /* Channel on 5110 */
02165 #define AR5K_RF_BUFFER_CONTROL_1        0x98c4  /* Bank 7 on 5112 */
02166 #define AR5K_RF_BUFFER_CONTROL_2        0x98cc  /* Bank 7 on 5111 */
02167 
02168 #define AR5K_RF_BUFFER_CONTROL_3        0x98d0  /* Bank 2 on 5112 */
02169                                                 /* Channel set on 5111 */
02170                                                 /* Used to read radio revision*/
02171 
02172 #define AR5K_RF_BUFFER_CONTROL_4        0x98d4  /* RF Stage register on 5110 */
02173                                                 /* Bank 0,1,2,6 on 5111 */
02174                                                 /* Bank 1 on 5112 */
02175                                                 /* Used during activation on 5111 */
02176 
02177 #define AR5K_RF_BUFFER_CONTROL_5        0x98d8  /* Bank 3 on 5111 */
02178                                                 /* Used during activation on 5111 */
02179                                                 /* Channel on 5112 */
02180                                                 /* Bank 6 on 5112 */
02181 
02182 #define AR5K_RF_BUFFER_CONTROL_6        0x98dc  /* Bank 3 on 5112 */
02183 
02184 /*
02185  * PHY RF stage register [5210]
02186  */
02187 #define AR5K_PHY_RFSTG                  0x98d4
02188 #define AR5K_PHY_RFSTG_DISABLE          0x00000021
02189 
02190 /*
02191  * BIN masks (?)
02192  */
02193 #define AR5K_PHY_BIN_MASK_1     0x9900
02194 #define AR5K_PHY_BIN_MASK_2     0x9904
02195 #define AR5K_PHY_BIN_MASK_3     0x9908
02196 
02197 #define AR5K_PHY_BIN_MASK_CTL           0x990c
02198 #define AR5K_PHY_BIN_MASK_CTL_MASK_4    0x00003fff
02199 #define AR5K_PHY_BIN_MASK_CTL_MASK_4_S  0
02200 #define AR5K_PHY_BIN_MASK_CTL_RATE      0xff000000
02201 #define AR5K_PHY_BIN_MASK_CTL_RATE_S    24
02202 
02203 /*
02204  * PHY Antenna control register
02205  */
02206 #define AR5K_PHY_ANT_CTL                0x9910                  /* Register Address */
02207 #define AR5K_PHY_ANT_CTL_TXRX_EN        0x00000001      /* Enable TX/RX (?) */
02208 #define AR5K_PHY_ANT_CTL_SECTORED_ANT   0x00000004      /* Sectored Antenna */
02209 #define AR5K_PHY_ANT_CTL_HITUNE5        0x00000008      /* Hitune5 (?) */
02210 #define AR5K_PHY_ANT_CTL_SWTABLE_IDLE   0x000003f0      /* Switch table idle (?) */
02211 #define AR5K_PHY_ANT_CTL_SWTABLE_IDLE_S 4
02212 
02213 /*
02214  * PHY receiver delay register [5111+]
02215  */
02216 #define AR5K_PHY_RX_DELAY               0x9914                  /* Register Address */
02217 #define AR5K_PHY_RX_DELAY_M             0x00003fff      /* Mask for RX activate to receive delay (/100ns) */
02218 
02219 /*
02220  * PHY max rx length register (?) [5111]
02221  */
02222 #define AR5K_PHY_MAX_RX_LEN             0x991c
02223 
02224 /*
02225  * PHY timing register 4
02226  * I(nphase)/Q(adrature) calibration register [5111+]
02227  */
02228 #define AR5K_PHY_IQ                     0x9920                  /* Register Address */
02229 #define AR5K_PHY_IQ_CORR_Q_Q_COFF       0x0000001f      /* Mask for q correction info */
02230 #define AR5K_PHY_IQ_CORR_Q_I_COFF       0x000007e0      /* Mask for i correction info */
02231 #define AR5K_PHY_IQ_CORR_Q_I_COFF_S     5
02232 #define AR5K_PHY_IQ_CORR_ENABLE         0x00000800      /* Enable i/q correction */
02233 #define AR5K_PHY_IQ_CAL_NUM_LOG_MAX     0x0000f000      /* Mask for max number of samples in log scale */
02234 #define AR5K_PHY_IQ_CAL_NUM_LOG_MAX_S   12
02235 #define AR5K_PHY_IQ_RUN                 0x00010000      /* Run i/q calibration */
02236 #define AR5K_PHY_IQ_USE_PT_DF           0x00020000      /* Use pilot track df (?) */
02237 #define AR5K_PHY_IQ_EARLY_TRIG_THR      0x00200000      /* Early trigger threshold (?) (field) */
02238 #define AR5K_PHY_IQ_PILOT_MASK_EN       0x10000000      /* Enable pilot mask (?) */
02239 #define AR5K_PHY_IQ_CHAN_MASK_EN        0x20000000      /* Enable channel mask (?) */
02240 #define AR5K_PHY_IQ_SPUR_FILT_EN        0x40000000      /* Enable spur filter */
02241 #define AR5K_PHY_IQ_SPUR_RSSI_EN        0x80000000      /* Enable spur rssi */
02242 
02243 /*
02244  * PHY timing register 5
02245  * OFDM Self-correlator Cyclic RSSI threshold params
02246  * (Check out bb_cycpwr_thr1 on ANI patent)
02247  */
02248 #define AR5K_PHY_OFDM_SELFCORR                  0x9924                  /* Register Address */
02249 #define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_EN    0x00000001      /* Enable cyclic RSSI thr 1 */
02250 #define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1       0x000000fe      /* Mask for Cyclic RSSI threshold 1 */
02251 #define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_S     1
02252 #define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR3       0x00000100      /* Cyclic RSSI threshold 3 (field) (?) */
02253 #define AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR_EN    0x00008000      /* Enable 1A RSSI threshold (?) */
02254 #define AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR       0x00010000      /* 1A RSSI threshold (field) (?) */
02255 #define AR5K_PHY_OFDM_SELFCORR_LSCTHR_HIRSSI    0x00800000      /* Long sc threshold hi rssi (?) */
02256 
02257 /*
02258  * PHY-only warm reset register
02259  */
02260 #define AR5K_PHY_WARM_RESET             0x9928
02261 
02262 /*
02263  * PHY-only control register
02264  */
02265 #define AR5K_PHY_CTL                    0x992c                  /* Register Address */
02266 #define AR5K_PHY_CTL_RX_DRAIN_RATE      0x00000001      /* RX drain rate (?) */
02267 #define AR5K_PHY_CTL_LATE_TX_SIG_SYM    0x00000002      /* Late tx signal symbol (?) */
02268 #define AR5K_PHY_CTL_GEN_SCRAMBLER      0x00000004      /* Generate scrambler */
02269 #define AR5K_PHY_CTL_TX_ANT_SEL         0x00000008      /* TX antenna select */
02270 #define AR5K_PHY_CTL_TX_ANT_STATIC      0x00000010      /* Static TX antenna */
02271 #define AR5K_PHY_CTL_RX_ANT_SEL         0x00000020      /* RX antenna select */
02272 #define AR5K_PHY_CTL_RX_ANT_STATIC      0x00000040      /* Static RX antenna */
02273 #define AR5K_PHY_CTL_LOW_FREQ_SLE_EN    0x00000080      /* Enable low freq sleep */
02274 
02275 /*
02276  * PHY PAPD probe register [5111+]
02277  */
02278 #define AR5K_PHY_PAPD_PROBE             0x9930
02279 #define AR5K_PHY_PAPD_PROBE_SH_HI_PAR   0x00000001
02280 #define AR5K_PHY_PAPD_PROBE_PCDAC_BIAS  0x00000002
02281 #define AR5K_PHY_PAPD_PROBE_COMP_GAIN   0x00000040
02282 #define AR5K_PHY_PAPD_PROBE_TXPOWER     0x00007e00
02283 #define AR5K_PHY_PAPD_PROBE_TXPOWER_S   9
02284 #define AR5K_PHY_PAPD_PROBE_TX_NEXT     0x00008000
02285 #define AR5K_PHY_PAPD_PROBE_PREDIST_EN  0x00010000
02286 #define AR5K_PHY_PAPD_PROBE_TYPE        0x01800000      /* [5112+] */
02287 #define AR5K_PHY_PAPD_PROBE_TYPE_S      23
02288 #define AR5K_PHY_PAPD_PROBE_TYPE_OFDM   0
02289 #define AR5K_PHY_PAPD_PROBE_TYPE_XR     1
02290 #define AR5K_PHY_PAPD_PROBE_TYPE_CCK    2
02291 #define AR5K_PHY_PAPD_PROBE_GAINF       0xfe000000
02292 #define AR5K_PHY_PAPD_PROBE_GAINF_S     25
02293 #define AR5K_PHY_PAPD_PROBE_INI_5111    0x00004883      /* [5212+] */
02294 #define AR5K_PHY_PAPD_PROBE_INI_5112    0x00004882      /* [5212+] */
02295 
02296 /*
02297  * PHY TX rate power registers [5112+]
02298  */
02299 #define AR5K_PHY_TXPOWER_RATE1                  0x9934
02300 #define AR5K_PHY_TXPOWER_RATE2                  0x9938
02301 #define AR5K_PHY_TXPOWER_RATE_MAX               0x993c
02302 #define AR5K_PHY_TXPOWER_RATE_MAX_TPC_ENABLE    0x00000040
02303 #define AR5K_PHY_TXPOWER_RATE3                  0xa234
02304 #define AR5K_PHY_TXPOWER_RATE4                  0xa238
02305 
02306 /*
02307  * PHY frame control register [5111+]
02308  */
02309 #define AR5K_PHY_FRAME_CTL_5210         0x9804
02310 #define AR5K_PHY_FRAME_CTL_5211         0x9944
02311 #define AR5K_PHY_FRAME_CTL              (ah->ah_version == AR5K_AR5210 ? \
02312                                         AR5K_PHY_FRAME_CTL_5210 : AR5K_PHY_FRAME_CTL_5211)
02313 /*---[5111+]---*/
02314 #define AR5K_PHY_FRAME_CTL_TX_CLIP      0x00000038      /* Mask for tx clip (?) */
02315 #define AR5K_PHY_FRAME_CTL_TX_CLIP_S    3
02316 #define AR5K_PHY_FRAME_CTL_PREP_CHINFO  0x00010000      /* Prepend chan info */
02317 #define AR5K_PHY_FRAME_CTL_EMU          0x80000000
02318 #define AR5K_PHY_FRAME_CTL_EMU_S        31
02319 /*---[5110/5111]---*/
02320 #define AR5K_PHY_FRAME_CTL_TIMING_ERR   0x01000000      /* PHY timing error */
02321 #define AR5K_PHY_FRAME_CTL_PARITY_ERR   0x02000000      /* Parity error */
02322 #define AR5K_PHY_FRAME_CTL_ILLRATE_ERR  0x04000000      /* Illegal rate */
02323 #define AR5K_PHY_FRAME_CTL_ILLLEN_ERR   0x08000000      /* Illegal length */
02324 #define AR5K_PHY_FRAME_CTL_SERVICE_ERR  0x20000000
02325 #define AR5K_PHY_FRAME_CTL_TXURN_ERR    0x40000000      /* TX underrun */
02326 #define AR5K_PHY_FRAME_CTL_INI          AR5K_PHY_FRAME_CTL_SERVICE_ERR | \
02327                         AR5K_PHY_FRAME_CTL_TXURN_ERR | \
02328                         AR5K_PHY_FRAME_CTL_ILLLEN_ERR | \
02329                         AR5K_PHY_FRAME_CTL_ILLRATE_ERR | \
02330                         AR5K_PHY_FRAME_CTL_PARITY_ERR | \
02331                         AR5K_PHY_FRAME_CTL_TIMING_ERR
02332 
02333 /*
02334  * PHY Tx Power adjustment register [5212A+]
02335  */
02336 #define AR5K_PHY_TX_PWR_ADJ                     0x994c
02337 #define AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA      0x00000fc0
02338 #define AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA_S    6
02339 #define AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX     0x00fc0000
02340 #define AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX_S   18
02341 
02342 /*
02343  * PHY radar detection register [5111+]
02344  */
02345 #define AR5K_PHY_RADAR                  0x9954
02346 #define AR5K_PHY_RADAR_ENABLE           0x00000001
02347 #define AR5K_PHY_RADAR_DISABLE          0x00000000
02348 #define AR5K_PHY_RADAR_INBANDTHR        0x0000003e      /* Inband threshold
02349                                                         5-bits, units unknown {0..31}
02350                                                         (? MHz ?) */
02351 #define AR5K_PHY_RADAR_INBANDTHR_S      1
02352 
02353 #define AR5K_PHY_RADAR_PRSSI_THR        0x00000fc0      /* Pulse RSSI/SNR threshold
02354                                                         6-bits, dBm range {0..63}
02355                                                         in dBm units. */
02356 #define AR5K_PHY_RADAR_PRSSI_THR_S      6
02357 
02358 #define AR5K_PHY_RADAR_PHEIGHT_THR      0x0003f000      /* Pulse height threshold
02359                                                         6-bits, dBm range {0..63}
02360                                                         in dBm units. */
02361 #define AR5K_PHY_RADAR_PHEIGHT_THR_S    12
02362 
02363 #define AR5K_PHY_RADAR_RSSI_THR         0x00fc0000      /* Radar RSSI/SNR threshold.
02364                                                         6-bits, dBm range {0..63}
02365                                                         in dBm units. */
02366 #define AR5K_PHY_RADAR_RSSI_THR_S       18
02367 
02368 #define AR5K_PHY_RADAR_FIRPWR_THR       0x7f000000      /* Finite Impulse Response
02369                                                         filter power out threshold.
02370                                                         7-bits, standard power range
02371                                                         {0..127} in 1/2 dBm units. */
02372 #define AR5K_PHY_RADAR_FIRPWR_THRS      24
02373 
02374 /*
02375  * PHY antenna switch table registers
02376  */
02377 #define AR5K_PHY_ANT_SWITCH_TABLE_0     0x9960
02378 #define AR5K_PHY_ANT_SWITCH_TABLE_1     0x9964
02379 
02380 /*
02381  * PHY Noise floor threshold
02382  */
02383 #define AR5K_PHY_NFTHRES                0x9968
02384 
02385 /*
02386  * Sigma Delta register (?) [5213]
02387  */
02388 #define AR5K_PHY_SIGMA_DELTA            0x996C
02389 #define AR5K_PHY_SIGMA_DELTA_ADC_SEL    0x00000003
02390 #define AR5K_PHY_SIGMA_DELTA_ADC_SEL_S  0
02391 #define AR5K_PHY_SIGMA_DELTA_FILT2      0x000000f8
02392 #define AR5K_PHY_SIGMA_DELTA_FILT2_S    3
02393 #define AR5K_PHY_SIGMA_DELTA_FILT1      0x00001f00
02394 #define AR5K_PHY_SIGMA_DELTA_FILT1_S    8
02395 #define AR5K_PHY_SIGMA_DELTA_ADC_CLIP   0x01ffe000
02396 #define AR5K_PHY_SIGMA_DELTA_ADC_CLIP_S 13
02397 
02398 /*
02399  * RF restart register [5112+] (?)
02400  */
02401 #define AR5K_PHY_RESTART                0x9970          /* restart */
02402 #define AR5K_PHY_RESTART_DIV_GC         0x001c0000      /* Fast diversity gc_limit (?) */
02403 #define AR5K_PHY_RESTART_DIV_GC_S       18
02404 
02405 /*
02406  * RF Bus access request register (for synth-oly channel switching)
02407  */
02408 #define AR5K_PHY_RFBUS_REQ              0x997C
02409 #define AR5K_PHY_RFBUS_REQ_REQUEST      0x00000001
02410 
02411 /*
02412  * Spur mitigation masks (?)
02413  */
02414 #define AR5K_PHY_TIMING_7               0x9980
02415 #define AR5K_PHY_TIMING_8               0x9984
02416 #define AR5K_PHY_TIMING_8_PILOT_MASK_2          0x000fffff
02417 #define AR5K_PHY_TIMING_8_PILOT_MASK_2_S        0
02418 
02419 #define AR5K_PHY_BIN_MASK2_1            0x9988
02420 #define AR5K_PHY_BIN_MASK2_2            0x998c
02421 #define AR5K_PHY_BIN_MASK2_3            0x9990
02422 
02423 #define AR5K_PHY_BIN_MASK2_4            0x9994
02424 #define AR5K_PHY_BIN_MASK2_4_MASK_4     0x00003fff
02425 #define AR5K_PHY_BIN_MASK2_4_MASK_4_S   0
02426 
02427 #define AR5K_PHY_TIMING_9                       0x9998
02428 #define AR5K_PHY_TIMING_10                      0x999c
02429 #define AR5K_PHY_TIMING_10_PILOT_MASK_2         0x000fffff
02430 #define AR5K_PHY_TIMING_10_PILOT_MASK_2_S       0
02431 
02432 /*
02433  * Spur mitigation control
02434  */
02435 #define AR5K_PHY_TIMING_11                      0x99a0          /* Register address */
02436 #define AR5K_PHY_TIMING_11_SPUR_DELTA_PHASE     0x000fffff      /* Spur delta phase */
02437 #define AR5K_PHY_TIMING_11_SPUR_DELTA_PHASE_S   0
02438 #define AR5K_PHY_TIMING_11_SPUR_FREQ_SD         0x3ff00000      /* Freq sigma delta */
02439 #define AR5K_PHY_TIMING_11_SPUR_FREQ_SD_S       20
02440 #define AR5K_PHY_TIMING_11_USE_SPUR_IN_AGC      0x40000000      /* Spur filter in AGC detector */
02441 #define AR5K_PHY_TIMING_11_USE_SPUR_IN_SELFCOR  0x80000000      /* Spur filter in OFDM self correlator */
02442 
02443 /*
02444  * Gain tables
02445  */
02446 #define AR5K_BB_GAIN_BASE               0x9b00  /* BaseBand Amplifier Gain table base address */
02447 #define AR5K_BB_GAIN(_n)                (AR5K_BB_GAIN_BASE + ((_n) << 2))
02448 #define AR5K_RF_GAIN_BASE               0x9a00  /* RF Amplrifier Gain table base address */
02449 #define AR5K_RF_GAIN(_n)                (AR5K_RF_GAIN_BASE + ((_n) << 2))
02450 
02451 /*
02452  * PHY timing IQ calibration result register [5111+]
02453  */
02454 #define AR5K_PHY_IQRES_CAL_PWR_I        0x9c10  /* I (Inphase) power value */
02455 #define AR5K_PHY_IQRES_CAL_PWR_Q        0x9c14  /* Q (Quadrature) power value */
02456 #define AR5K_PHY_IQRES_CAL_CORR         0x9c18  /* I/Q Correlation */
02457 
02458 /*
02459  * PHY current RSSI register [5111+]
02460  */
02461 #define AR5K_PHY_CURRENT_RSSI   0x9c1c
02462 
02463 /*
02464  * PHY RF Bus grant register
02465  */
02466 #define AR5K_PHY_RFBUS_GRANT    0x9c20
02467 #define AR5K_PHY_RFBUS_GRANT_OK 0x00000001
02468 
02469 /*
02470  * PHY ADC test register
02471  */
02472 #define AR5K_PHY_ADC_TEST       0x9c24
02473 #define AR5K_PHY_ADC_TEST_I     0x00000001
02474 #define AR5K_PHY_ADC_TEST_Q     0x00000200
02475 
02476 /*
02477  * PHY DAC test register
02478  */
02479 #define AR5K_PHY_DAC_TEST       0x9c28
02480 #define AR5K_PHY_DAC_TEST_I     0x00000001
02481 #define AR5K_PHY_DAC_TEST_Q     0x00000200
02482 
02483 /*
02484  * PHY PTAT register (?)
02485  */
02486 #define AR5K_PHY_PTAT           0x9c2c
02487 
02488 /*
02489  * PHY Illegal TX rate register [5112+]
02490  */
02491 #define AR5K_PHY_BAD_TX_RATE    0x9c30
02492 
02493 /*
02494  * PHY SPUR Power register [5112+]
02495  */
02496 #define AR5K_PHY_SPUR_PWR       0x9c34                  /* Register Address */
02497 #define AR5K_PHY_SPUR_PWR_I     0x00000001      /* SPUR Power estimate for I (field) */
02498 #define AR5K_PHY_SPUR_PWR_Q     0x00000100      /* SPUR Power estimate for Q (field) */
02499 #define AR5K_PHY_SPUR_PWR_FILT  0x00010000      /* Power with SPUR removed (field) */
02500 
02501 /*
02502  * PHY Channel status register [5112+] (?)
02503  */
02504 #define AR5K_PHY_CHAN_STATUS            0x9c38
02505 #define AR5K_PHY_CHAN_STATUS_BT_ACT     0x00000001
02506 #define AR5K_PHY_CHAN_STATUS_RX_CLR_RAW 0x00000002
02507 #define AR5K_PHY_CHAN_STATUS_RX_CLR_MAC 0x00000004
02508 #define AR5K_PHY_CHAN_STATUS_RX_CLR_PAP 0x00000008
02509 
02510 /*
02511  * Heavy clip enable register
02512  */
02513 #define AR5K_PHY_HEAVY_CLIP_ENABLE      0x99e0
02514 
02515 /*
02516  * PHY clock sleep registers [5112+]
02517  */
02518 #define AR5K_PHY_SCLOCK                 0x99f0
02519 #define AR5K_PHY_SCLOCK_32MHZ           0x0000000c
02520 #define AR5K_PHY_SDELAY                 0x99f4
02521 #define AR5K_PHY_SDELAY_32MHZ           0x000000ff
02522 #define AR5K_PHY_SPENDING               0x99f8
02523 
02524 
02525 /*
02526  * PHY PAPD I (power?) table (?)
02527  * (92! entries)
02528  */
02529 #define AR5K_PHY_PAPD_I_BASE    0xa000
02530 #define AR5K_PHY_PAPD_I(_n)     (AR5K_PHY_PAPD_I_BASE + ((_n) << 2))
02531 
02532 /*
02533  * PHY PCDAC TX power table
02534  */
02535 #define AR5K_PHY_PCDAC_TXPOWER_BASE     0xa180
02536 #define AR5K_PHY_PCDAC_TXPOWER(_n)      (AR5K_PHY_PCDAC_TXPOWER_BASE + ((_n) << 2))
02537 
02538 /*
02539  * PHY mode register [5111+]
02540  */
02541 #define AR5K_PHY_MODE                   0x0a200                 /* Register Address */
02542 #define AR5K_PHY_MODE_MOD               0x00000001      /* PHY Modulation bit */
02543 #define AR5K_PHY_MODE_MOD_OFDM          0
02544 #define AR5K_PHY_MODE_MOD_CCK           1
02545 #define AR5K_PHY_MODE_FREQ              0x00000002      /* Freq mode bit */
02546 #define AR5K_PHY_MODE_FREQ_5GHZ         0
02547 #define AR5K_PHY_MODE_FREQ_2GHZ         2
02548 #define AR5K_PHY_MODE_MOD_DYN           0x00000004      /* Enable Dynamic OFDM/CCK mode [5112+] */
02549 #define AR5K_PHY_MODE_RAD               0x00000008      /* [5212+] */
02550 #define AR5K_PHY_MODE_RAD_RF5111        0
02551 #define AR5K_PHY_MODE_RAD_RF5112        8
02552 #define AR5K_PHY_MODE_XR                0x00000010      /* Enable XR mode [5112+] */
02553 #define AR5K_PHY_MODE_HALF_RATE         0x00000020      /* Enable Half rate (test) */
02554 #define AR5K_PHY_MODE_QUARTER_RATE      0x00000040      /* Enable Quarter rat (test) */
02555 
02556 /*
02557  * PHY CCK transmit control register [5111+ (?)]
02558  */
02559 #define AR5K_PHY_CCKTXCTL               0xa204
02560 #define AR5K_PHY_CCKTXCTL_WORLD         0x00000000
02561 #define AR5K_PHY_CCKTXCTL_JAPAN         0x00000010
02562 #define AR5K_PHY_CCKTXCTL_SCRAMBLER_DIS 0x00000001
02563 #define AR5K_PHY_CCKTXCTK_DAC_SCALE     0x00000004
02564 
02565 /*
02566  * PHY CCK Cross-correlator Barker RSSI threshold register [5212+]
02567  */
02568 #define AR5K_PHY_CCK_CROSSCORR                  0xa208
02569 #define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR     0x0000003f
02570 #define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR_S   0
02571 
02572 /* Same address is used for antenna diversity activation */
02573 #define AR5K_PHY_FAST_ANT_DIV           0xa208
02574 #define AR5K_PHY_FAST_ANT_DIV_EN        0x00002000
02575 
02576 /*
02577  * PHY 2GHz gain register [5111+]
02578  */
02579 #define AR5K_PHY_GAIN_2GHZ                      0xa20c
02580 #define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX          0x00fc0000
02581 #define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX_S        18
02582 #define AR5K_PHY_GAIN_2GHZ_INI_5111             0x6480416c
02583 
02584 #define AR5K_PHY_CCK_RX_CTL_4                   0xa21c
02585 #define AR5K_PHY_CCK_RX_CTL_4_FREQ_EST_SHORT    0x01f80000
02586 #define AR5K_PHY_CCK_RX_CTL_4_FREQ_EST_SHORT_S  19
02587 
02588 #define AR5K_PHY_DAG_CCK_CTL                    0xa228
02589 #define AR5K_PHY_DAG_CCK_CTL_EN_RSSI_THR        0x00000200
02590 #define AR5K_PHY_DAG_CCK_CTL_RSSI_THR           0x0001fc00
02591 #define AR5K_PHY_DAG_CCK_CTL_RSSI_THR_S         10
02592 
02593 #define AR5K_PHY_FAST_ADC       0xa24c
02594 
02595 #define AR5K_PHY_BLUETOOTH      0xa254
02596 
02597 /*
02598  * Transmit Power Control register
02599  * [2413+]
02600  */
02601 #define AR5K_PHY_TPC_RG1                0xa258
02602 #define AR5K_PHY_TPC_RG1_NUM_PD_GAIN    0x0000c000
02603 #define AR5K_PHY_TPC_RG1_NUM_PD_GAIN_S  14
02604 #define AR5K_PHY_TPC_RG1_PDGAIN_1       0x00030000
02605 #define AR5K_PHY_TPC_RG1_PDGAIN_1_S     16
02606 #define AR5K_PHY_TPC_RG1_PDGAIN_2       0x000c0000
02607 #define AR5K_PHY_TPC_RG1_PDGAIN_2_S     18
02608 #define AR5K_PHY_TPC_RG1_PDGAIN_3       0x00300000
02609 #define AR5K_PHY_TPC_RG1_PDGAIN_3_S     20
02610 
02611 #define AR5K_PHY_TPC_RG5                        0xa26C
02612 #define AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP        0x0000000F
02613 #define AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP_S      0
02614 #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1     0x000003F0
02615 #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1_S   4
02616 #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2     0x0000FC00
02617 #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2_S   10
02618 #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3     0x003F0000
02619 #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3_S   16
02620 #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4     0x0FC00000
02621 #define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4_S   22
02622 
02623 /*
02624  * PHY PDADC Tx power table
02625  */
02626 #define AR5K_PHY_PDADC_TXPOWER_BASE     0xa280
02627 #define AR5K_PHY_PDADC_TXPOWER(_n)      (AR5K_PHY_PDADC_TXPOWER_BASE + ((_n) << 2))


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Fri Jan 3 2014 12:07:55