162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com> 362306a36Sopenharmony_ci * Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org> 462306a36Sopenharmony_ci * Copyright (c) 2007-2008 Michael Taylor <mike.taylor@apprion.com> 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Permission to use, copy, modify, and distribute this software for any 762306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 862306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 962306a36Sopenharmony_ci * 1062306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 1162306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1262306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1362306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1462306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1562306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1662306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1762306a36Sopenharmony_ci * 1862306a36Sopenharmony_ci */ 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci/* 2162306a36Sopenharmony_ci * Register values for Atheros 5210/5211/5212 cards from OpenBSD's ar5k 2262306a36Sopenharmony_ci * maintained by Reyk Floeter 2362306a36Sopenharmony_ci * 2462306a36Sopenharmony_ci * I tried to document those registers by looking at ar5k code, some 2562306a36Sopenharmony_ci * 802.11 (802.11e mostly) papers and by reading various public available 2662306a36Sopenharmony_ci * Atheros presentations and papers like these: 2762306a36Sopenharmony_ci * 2862306a36Sopenharmony_ci * 5210 - http://nova.stanford.edu/~bbaas/ps/isscc2002_slides.pdf 2962306a36Sopenharmony_ci * 3062306a36Sopenharmony_ci * 5211 - http://www.hotchips.org/archives/hc14/3_Tue/16_mcfarland.pdf 3162306a36Sopenharmony_ci * 3262306a36Sopenharmony_ci * This file also contains register values found on a memory dump of 3362306a36Sopenharmony_ci * Atheros's ART program (Atheros Radio Test), on ath9k, on legacy-hal 3462306a36Sopenharmony_ci * released by Atheros and on various debug messages found on the net. 3562306a36Sopenharmony_ci */ 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#include "../reg.h" 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci/*====MAC DMA REGISTERS====*/ 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci/* 4262306a36Sopenharmony_ci * AR5210-Specific TXDP registers 4362306a36Sopenharmony_ci * 5210 has only 2 transmit queues so no DCU/QCU, just 4462306a36Sopenharmony_ci * 2 transmit descriptor pointers... 4562306a36Sopenharmony_ci */ 4662306a36Sopenharmony_ci#define AR5K_NOQCU_TXDP0 0x0000 /* Queue 0 - data */ 4762306a36Sopenharmony_ci#define AR5K_NOQCU_TXDP1 0x0004 /* Queue 1 - beacons */ 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci/* 5062306a36Sopenharmony_ci * Mac Control Register 5162306a36Sopenharmony_ci */ 5262306a36Sopenharmony_ci#define AR5K_CR 0x0008 /* Register Address */ 5362306a36Sopenharmony_ci#define AR5K_CR_TXE0 0x00000001 /* TX Enable for queue 0 on 5210 */ 5462306a36Sopenharmony_ci#define AR5K_CR_TXE1 0x00000002 /* TX Enable for queue 1 on 5210 */ 5562306a36Sopenharmony_ci#define AR5K_CR_RXE 0x00000004 /* RX Enable */ 5662306a36Sopenharmony_ci#define AR5K_CR_TXD0 0x00000008 /* TX Disable for queue 0 on 5210 */ 5762306a36Sopenharmony_ci#define AR5K_CR_TXD1 0x00000010 /* TX Disable for queue 1 on 5210 */ 5862306a36Sopenharmony_ci#define AR5K_CR_RXD 0x00000020 /* RX Disable */ 5962306a36Sopenharmony_ci#define AR5K_CR_SWI 0x00000040 /* Software Interrupt */ 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* 6262306a36Sopenharmony_ci * RX Descriptor Pointer register 6362306a36Sopenharmony_ci */ 6462306a36Sopenharmony_ci#define AR5K_RXDP 0x000c 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci/* 6762306a36Sopenharmony_ci * Configuration and status register 6862306a36Sopenharmony_ci */ 6962306a36Sopenharmony_ci#define AR5K_CFG 0x0014 /* Register Address */ 7062306a36Sopenharmony_ci#define AR5K_CFG_SWTD 0x00000001 /* Byte-swap TX descriptor (for big endian archs) */ 7162306a36Sopenharmony_ci#define AR5K_CFG_SWTB 0x00000002 /* Byte-swap TX buffer */ 7262306a36Sopenharmony_ci#define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */ 7362306a36Sopenharmony_ci#define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */ 7462306a36Sopenharmony_ci#define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */ 7562306a36Sopenharmony_ci#define AR5K_CFG_IBSS 0x00000020 /* 0-BSS, 1-IBSS [5211+] */ 7662306a36Sopenharmony_ci#define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */ 7762306a36Sopenharmony_ci#define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */ 7862306a36Sopenharmony_ci#define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */ 7962306a36Sopenharmony_ci#define AR5K_CFG_TXCNT 0x00007800 /* Tx frame count (?) [5210] */ 8062306a36Sopenharmony_ci#define AR5K_CFG_TXCNT_S 11 8162306a36Sopenharmony_ci#define AR5K_CFG_TXFSTAT 0x00008000 /* Tx frame status (?) [5210] */ 8262306a36Sopenharmony_ci#define AR5K_CFG_TXFSTRT 0x00010000 /* [5210] */ 8362306a36Sopenharmony_ci#define AR5K_CFG_PCI_THRES 0x00060000 /* PCI Master req q threshold [5211+] */ 8462306a36Sopenharmony_ci#define AR5K_CFG_PCI_THRES_S 17 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci/* 8762306a36Sopenharmony_ci * Interrupt enable register 8862306a36Sopenharmony_ci */ 8962306a36Sopenharmony_ci#define AR5K_IER 0x0024 /* Register Address */ 9062306a36Sopenharmony_ci#define AR5K_IER_DISABLE 0x00000000 /* Disable card interrupts */ 9162306a36Sopenharmony_ci#define AR5K_IER_ENABLE 0x00000001 /* Enable card interrupts */ 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci/* 9562306a36Sopenharmony_ci * 0x0028 is Beacon Control Register on 5210 9662306a36Sopenharmony_ci * and first RTS duration register on 5211 9762306a36Sopenharmony_ci */ 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci/* 10062306a36Sopenharmony_ci * Beacon control register [5210] 10162306a36Sopenharmony_ci */ 10262306a36Sopenharmony_ci#define AR5K_BCR 0x0028 /* Register Address */ 10362306a36Sopenharmony_ci#define AR5K_BCR_AP 0x00000000 /* AP mode */ 10462306a36Sopenharmony_ci#define AR5K_BCR_ADHOC 0x00000001 /* Ad-Hoc mode */ 10562306a36Sopenharmony_ci#define AR5K_BCR_BDMAE 0x00000002 /* DMA enable */ 10662306a36Sopenharmony_ci#define AR5K_BCR_TQ1FV 0x00000004 /* Use Queue1 for CAB traffic */ 10762306a36Sopenharmony_ci#define AR5K_BCR_TQ1V 0x00000008 /* Use Queue1 for Beacon traffic */ 10862306a36Sopenharmony_ci#define AR5K_BCR_BCGET 0x00000010 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci/* 11162306a36Sopenharmony_ci * First RTS duration register [5211] 11262306a36Sopenharmony_ci */ 11362306a36Sopenharmony_ci#define AR5K_RTSD0 0x0028 /* Register Address */ 11462306a36Sopenharmony_ci#define AR5K_RTSD0_6 0x000000ff /* 6Mb RTS duration mask (?) */ 11562306a36Sopenharmony_ci#define AR5K_RTSD0_6_S 0 /* 6Mb RTS duration shift (?) */ 11662306a36Sopenharmony_ci#define AR5K_RTSD0_9 0x0000ff00 /* 9Mb*/ 11762306a36Sopenharmony_ci#define AR5K_RTSD0_9_S 8 11862306a36Sopenharmony_ci#define AR5K_RTSD0_12 0x00ff0000 /* 12Mb*/ 11962306a36Sopenharmony_ci#define AR5K_RTSD0_12_S 16 12062306a36Sopenharmony_ci#define AR5K_RTSD0_18 0xff000000 /* 16Mb*/ 12162306a36Sopenharmony_ci#define AR5K_RTSD0_18_S 24 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci/* 12562306a36Sopenharmony_ci * 0x002c is Beacon Status Register on 5210 12662306a36Sopenharmony_ci * and second RTS duration register on 5211 12762306a36Sopenharmony_ci */ 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci/* 13062306a36Sopenharmony_ci * Beacon status register [5210] 13162306a36Sopenharmony_ci * 13262306a36Sopenharmony_ci * As i can see in ar5k_ar5210_tx_start Reyk uses some of the values of BCR 13362306a36Sopenharmony_ci * for this register, so i guess TQ1V,TQ1FV and BDMAE have the same meaning 13462306a36Sopenharmony_ci * here and SNP/SNAP means "snapshot" (so this register gets synced with BCR). 13562306a36Sopenharmony_ci * So SNAPPEDBCRVALID should also stand for "snapped BCR -values- valid", so i 13662306a36Sopenharmony_ci * renamed it to SNAPSHOTSVALID to make more sense. I really have no idea what 13762306a36Sopenharmony_ci * else can it be. I also renamed SNPBCMD to SNPADHOC to match BCR. 13862306a36Sopenharmony_ci */ 13962306a36Sopenharmony_ci#define AR5K_BSR 0x002c /* Register Address */ 14062306a36Sopenharmony_ci#define AR5K_BSR_BDLYSW 0x00000001 /* SW Beacon delay (?) */ 14162306a36Sopenharmony_ci#define AR5K_BSR_BDLYDMA 0x00000002 /* DMA Beacon delay (?) */ 14262306a36Sopenharmony_ci#define AR5K_BSR_TXQ1F 0x00000004 /* Beacon queue (1) finished */ 14362306a36Sopenharmony_ci#define AR5K_BSR_ATIMDLY 0x00000008 /* ATIM delay (?) */ 14462306a36Sopenharmony_ci#define AR5K_BSR_SNPADHOC 0x00000100 /* Ad-hoc mode set (?) */ 14562306a36Sopenharmony_ci#define AR5K_BSR_SNPBDMAE 0x00000200 /* Beacon DMA enabled (?) */ 14662306a36Sopenharmony_ci#define AR5K_BSR_SNPTQ1FV 0x00000400 /* Queue1 is used for CAB traffic (?) */ 14762306a36Sopenharmony_ci#define AR5K_BSR_SNPTQ1V 0x00000800 /* Queue1 is used for Beacon traffic (?) */ 14862306a36Sopenharmony_ci#define AR5K_BSR_SNAPSHOTSVALID 0x00001000 /* BCR snapshots are valid (?) */ 14962306a36Sopenharmony_ci#define AR5K_BSR_SWBA_CNT 0x00ff0000 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci/* 15262306a36Sopenharmony_ci * Second RTS duration register [5211] 15362306a36Sopenharmony_ci */ 15462306a36Sopenharmony_ci#define AR5K_RTSD1 0x002c /* Register Address */ 15562306a36Sopenharmony_ci#define AR5K_RTSD1_24 0x000000ff /* 24Mb */ 15662306a36Sopenharmony_ci#define AR5K_RTSD1_24_S 0 15762306a36Sopenharmony_ci#define AR5K_RTSD1_36 0x0000ff00 /* 36Mb */ 15862306a36Sopenharmony_ci#define AR5K_RTSD1_36_S 8 15962306a36Sopenharmony_ci#define AR5K_RTSD1_48 0x00ff0000 /* 48Mb */ 16062306a36Sopenharmony_ci#define AR5K_RTSD1_48_S 16 16162306a36Sopenharmony_ci#define AR5K_RTSD1_54 0xff000000 /* 54Mb */ 16262306a36Sopenharmony_ci#define AR5K_RTSD1_54_S 24 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci/* 16662306a36Sopenharmony_ci * Transmit configuration register 16762306a36Sopenharmony_ci */ 16862306a36Sopenharmony_ci#define AR5K_TXCFG 0x0030 /* Register Address */ 16962306a36Sopenharmony_ci#define AR5K_TXCFG_SDMAMR 0x00000007 /* DMA size (read) */ 17062306a36Sopenharmony_ci#define AR5K_TXCFG_SDMAMR_S 0 17162306a36Sopenharmony_ci#define AR5K_TXCFG_B_MODE 0x00000008 /* Set b mode for 5111 (enable 2111) */ 17262306a36Sopenharmony_ci#define AR5K_TXCFG_TXFSTP 0x00000008 /* TX DMA full Stop [5210] */ 17362306a36Sopenharmony_ci#define AR5K_TXCFG_TXFULL 0x000003f0 /* TX Trigger level mask */ 17462306a36Sopenharmony_ci#define AR5K_TXCFG_TXFULL_S 4 17562306a36Sopenharmony_ci#define AR5K_TXCFG_TXFULL_0B 0x00000000 17662306a36Sopenharmony_ci#define AR5K_TXCFG_TXFULL_64B 0x00000010 17762306a36Sopenharmony_ci#define AR5K_TXCFG_TXFULL_128B 0x00000020 17862306a36Sopenharmony_ci#define AR5K_TXCFG_TXFULL_192B 0x00000030 17962306a36Sopenharmony_ci#define AR5K_TXCFG_TXFULL_256B 0x00000040 18062306a36Sopenharmony_ci#define AR5K_TXCFG_TXCONT_EN 0x00000080 18162306a36Sopenharmony_ci#define AR5K_TXCFG_DMASIZE 0x00000100 /* Flag for passing DMA size [5210] */ 18262306a36Sopenharmony_ci#define AR5K_TXCFG_JUMBO_DESC_EN 0x00000400 /* Enable jumbo tx descriptors [5211+] */ 18362306a36Sopenharmony_ci#define AR5K_TXCFG_ADHOC_BCN_ATIM 0x00000800 /* Adhoc Beacon ATIM Policy */ 18462306a36Sopenharmony_ci#define AR5K_TXCFG_ATIM_WINDOW_DEF_DIS 0x00001000 /* Disable ATIM window defer [5211+] */ 18562306a36Sopenharmony_ci#define AR5K_TXCFG_RTSRND 0x00001000 /* [5211+] */ 18662306a36Sopenharmony_ci#define AR5K_TXCFG_FRMPAD_DIS 0x00002000 /* [5211+] */ 18762306a36Sopenharmony_ci#define AR5K_TXCFG_RDY_CBR_DIS 0x00004000 /* Ready time CBR disable [5211+] */ 18862306a36Sopenharmony_ci#define AR5K_TXCFG_JUMBO_FRM_MODE 0x00008000 /* Jumbo frame mode [5211+] */ 18962306a36Sopenharmony_ci#define AR5K_TXCFG_DCU_DBL_BUF_DIS 0x00008000 /* Disable double buffering on DCU */ 19062306a36Sopenharmony_ci#define AR5K_TXCFG_DCU_CACHING_DIS 0x00010000 /* Disable DCU caching */ 19162306a36Sopenharmony_ci 19262306a36Sopenharmony_ci/* 19362306a36Sopenharmony_ci * Receive configuration register 19462306a36Sopenharmony_ci */ 19562306a36Sopenharmony_ci#define AR5K_RXCFG 0x0034 /* Register Address */ 19662306a36Sopenharmony_ci#define AR5K_RXCFG_SDMAMW 0x00000007 /* DMA size (write) */ 19762306a36Sopenharmony_ci#define AR5K_RXCFG_SDMAMW_S 0 19862306a36Sopenharmony_ci#define AR5K_RXCFG_ZLFDMA 0x00000008 /* Enable Zero-length frame DMA */ 19962306a36Sopenharmony_ci#define AR5K_RXCFG_DEF_ANTENNA 0x00000010 /* Default antenna (?) */ 20062306a36Sopenharmony_ci#define AR5K_RXCFG_JUMBO_RXE 0x00000020 /* Enable jumbo rx descriptors [5211+] */ 20162306a36Sopenharmony_ci#define AR5K_RXCFG_JUMBO_WRAP 0x00000040 /* Wrap jumbo frames [5211+] */ 20262306a36Sopenharmony_ci#define AR5K_RXCFG_SLE_ENTRY 0x00000080 /* Sleep entry policy */ 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_ci/* 20562306a36Sopenharmony_ci * Receive jumbo descriptor last address register 20662306a36Sopenharmony_ci * Only found in 5211 (?) 20762306a36Sopenharmony_ci */ 20862306a36Sopenharmony_ci#define AR5K_RXJLA 0x0038 20962306a36Sopenharmony_ci 21062306a36Sopenharmony_ci/* 21162306a36Sopenharmony_ci * MIB control register 21262306a36Sopenharmony_ci */ 21362306a36Sopenharmony_ci#define AR5K_MIBC 0x0040 /* Register Address */ 21462306a36Sopenharmony_ci#define AR5K_MIBC_COW 0x00000001 /* Counter Overflow Warning */ 21562306a36Sopenharmony_ci#define AR5K_MIBC_FMC 0x00000002 /* Freeze MIB Counters */ 21662306a36Sopenharmony_ci#define AR5K_MIBC_CMC 0x00000004 /* Clear MIB Counters */ 21762306a36Sopenharmony_ci#define AR5K_MIBC_MCS 0x00000008 /* MIB counter strobe, increment all */ 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci/* 22062306a36Sopenharmony_ci * Timeout prescale register 22162306a36Sopenharmony_ci */ 22262306a36Sopenharmony_ci#define AR5K_TOPS 0x0044 22362306a36Sopenharmony_ci#define AR5K_TOPS_M 0x0000ffff 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ci/* 22662306a36Sopenharmony_ci * Receive timeout register (no frame received) 22762306a36Sopenharmony_ci */ 22862306a36Sopenharmony_ci#define AR5K_RXNOFRM 0x0048 22962306a36Sopenharmony_ci#define AR5K_RXNOFRM_M 0x000003ff 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci/* 23262306a36Sopenharmony_ci * Transmit timeout register (no frame sent) 23362306a36Sopenharmony_ci */ 23462306a36Sopenharmony_ci#define AR5K_TXNOFRM 0x004c 23562306a36Sopenharmony_ci#define AR5K_TXNOFRM_M 0x000003ff 23662306a36Sopenharmony_ci#define AR5K_TXNOFRM_QCU 0x000ffc00 23762306a36Sopenharmony_ci#define AR5K_TXNOFRM_QCU_S 10 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ci/* 24062306a36Sopenharmony_ci * Receive frame gap timeout register 24162306a36Sopenharmony_ci */ 24262306a36Sopenharmony_ci#define AR5K_RPGTO 0x0050 24362306a36Sopenharmony_ci#define AR5K_RPGTO_M 0x000003ff 24462306a36Sopenharmony_ci 24562306a36Sopenharmony_ci/* 24662306a36Sopenharmony_ci * Receive frame count limit register 24762306a36Sopenharmony_ci */ 24862306a36Sopenharmony_ci#define AR5K_RFCNT 0x0054 24962306a36Sopenharmony_ci#define AR5K_RFCNT_M 0x0000001f /* [5211+] (?) */ 25062306a36Sopenharmony_ci#define AR5K_RFCNT_RFCL 0x0000000f /* [5210] */ 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_ci/* 25362306a36Sopenharmony_ci * Misc settings register 25462306a36Sopenharmony_ci * (reserved0-3) 25562306a36Sopenharmony_ci */ 25662306a36Sopenharmony_ci#define AR5K_MISC 0x0058 /* Register Address */ 25762306a36Sopenharmony_ci#define AR5K_MISC_DMA_OBS_M 0x000001e0 25862306a36Sopenharmony_ci#define AR5K_MISC_DMA_OBS_S 5 25962306a36Sopenharmony_ci#define AR5K_MISC_MISC_OBS_M 0x00000e00 26062306a36Sopenharmony_ci#define AR5K_MISC_MISC_OBS_S 9 26162306a36Sopenharmony_ci#define AR5K_MISC_MAC_OBS_LSB_M 0x00007000 26262306a36Sopenharmony_ci#define AR5K_MISC_MAC_OBS_LSB_S 12 26362306a36Sopenharmony_ci#define AR5K_MISC_MAC_OBS_MSB_M 0x00038000 26462306a36Sopenharmony_ci#define AR5K_MISC_MAC_OBS_MSB_S 15 26562306a36Sopenharmony_ci#define AR5K_MISC_LED_DECAY 0x001c0000 /* [5210] */ 26662306a36Sopenharmony_ci#define AR5K_MISC_LED_BLINK 0x00e00000 /* [5210] */ 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci/* 26962306a36Sopenharmony_ci * QCU/DCU clock gating register (5311) 27062306a36Sopenharmony_ci * (reserved4-5) 27162306a36Sopenharmony_ci */ 27262306a36Sopenharmony_ci#define AR5K_QCUDCU_CLKGT 0x005c /* Register Address (?) */ 27362306a36Sopenharmony_ci#define AR5K_QCUDCU_CLKGT_QCU 0x0000ffff /* Mask for QCU clock */ 27462306a36Sopenharmony_ci#define AR5K_QCUDCU_CLKGT_DCU 0x07ff0000 /* Mask for DCU clock */ 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_ci/* 27762306a36Sopenharmony_ci * Interrupt Status Registers 27862306a36Sopenharmony_ci * 27962306a36Sopenharmony_ci * For 5210 there is only one status register but for 28062306a36Sopenharmony_ci * 5211/5212 we have one primary and 4 secondary registers. 28162306a36Sopenharmony_ci * So we have AR5K_ISR for 5210 and AR5K_PISR /SISRx for 5211/5212. 28262306a36Sopenharmony_ci * Most of these bits are common for all chipsets. 28362306a36Sopenharmony_ci * 28462306a36Sopenharmony_ci * NOTE: On 5211+ TXOK, TXDESC, TXERR, TXEOL and TXURN contain 28562306a36Sopenharmony_ci * the logical OR from per-queue interrupt bits found on SISR registers 28662306a36Sopenharmony_ci * (see below). 28762306a36Sopenharmony_ci */ 28862306a36Sopenharmony_ci#define AR5K_ISR 0x001c /* Register Address [5210] */ 28962306a36Sopenharmony_ci#define AR5K_PISR 0x0080 /* Register Address [5211+] */ 29062306a36Sopenharmony_ci#define AR5K_ISR_RXOK 0x00000001 /* Frame successfully received */ 29162306a36Sopenharmony_ci#define AR5K_ISR_RXDESC 0x00000002 /* RX descriptor request */ 29262306a36Sopenharmony_ci#define AR5K_ISR_RXERR 0x00000004 /* Receive error */ 29362306a36Sopenharmony_ci#define AR5K_ISR_RXNOFRM 0x00000008 /* No frame received (receive timeout) */ 29462306a36Sopenharmony_ci#define AR5K_ISR_RXEOL 0x00000010 /* Empty RX descriptor */ 29562306a36Sopenharmony_ci#define AR5K_ISR_RXORN 0x00000020 /* Receive FIFO overrun */ 29662306a36Sopenharmony_ci#define AR5K_ISR_TXOK 0x00000040 /* Frame successfully transmitted */ 29762306a36Sopenharmony_ci#define AR5K_ISR_TXDESC 0x00000080 /* TX descriptor request */ 29862306a36Sopenharmony_ci#define AR5K_ISR_TXERR 0x00000100 /* Transmit error */ 29962306a36Sopenharmony_ci#define AR5K_ISR_TXNOFRM 0x00000200 /* No frame transmitted (transmit timeout) 30062306a36Sopenharmony_ci * NOTE: We don't have per-queue info for this 30162306a36Sopenharmony_ci * one, but we can enable it per-queue through 30262306a36Sopenharmony_ci * TXNOFRM_QCU field on TXNOFRM register */ 30362306a36Sopenharmony_ci#define AR5K_ISR_TXEOL 0x00000400 /* Empty TX descriptor */ 30462306a36Sopenharmony_ci#define AR5K_ISR_TXURN 0x00000800 /* Transmit FIFO underrun */ 30562306a36Sopenharmony_ci#define AR5K_ISR_MIB 0x00001000 /* Update MIB counters */ 30662306a36Sopenharmony_ci#define AR5K_ISR_SWI 0x00002000 /* Software interrupt */ 30762306a36Sopenharmony_ci#define AR5K_ISR_RXPHY 0x00004000 /* PHY error */ 30862306a36Sopenharmony_ci#define AR5K_ISR_RXKCM 0x00008000 /* RX Key cache miss */ 30962306a36Sopenharmony_ci#define AR5K_ISR_SWBA 0x00010000 /* Software beacon alert */ 31062306a36Sopenharmony_ci#define AR5K_ISR_BRSSI 0x00020000 /* Beacon rssi below threshold (?) */ 31162306a36Sopenharmony_ci#define AR5K_ISR_BMISS 0x00040000 /* Beacon missed */ 31262306a36Sopenharmony_ci#define AR5K_ISR_HIUERR 0x00080000 /* Host Interface Unit error [5211+] 31362306a36Sopenharmony_ci * 'or' of MCABT, SSERR, DPERR from SISR2 */ 31462306a36Sopenharmony_ci#define AR5K_ISR_BNR 0x00100000 /* Beacon not ready [5211+] */ 31562306a36Sopenharmony_ci#define AR5K_ISR_MCABT 0x00100000 /* Master Cycle Abort [5210] */ 31662306a36Sopenharmony_ci#define AR5K_ISR_RXCHIRP 0x00200000 /* CHIRP Received [5212+] */ 31762306a36Sopenharmony_ci#define AR5K_ISR_SSERR 0x00200000 /* Signaled System Error [5210] */ 31862306a36Sopenharmony_ci#define AR5K_ISR_DPERR 0x00400000 /* Bus parity error [5210] */ 31962306a36Sopenharmony_ci#define AR5K_ISR_RXDOPPLER 0x00400000 /* Doppler chirp received [5212+] */ 32062306a36Sopenharmony_ci#define AR5K_ISR_TIM 0x00800000 /* [5211+] */ 32162306a36Sopenharmony_ci#define AR5K_ISR_BCNMISC 0x00800000 /* Misc beacon related interrupt 32262306a36Sopenharmony_ci * 'or' of TIM, CAB_END, DTIM_SYNC, BCN_TIMEOUT, 32362306a36Sopenharmony_ci * CAB_TIMEOUT and DTIM bits from SISR2 [5212+] */ 32462306a36Sopenharmony_ci#define AR5K_ISR_GPIO 0x01000000 /* GPIO (rf kill) */ 32562306a36Sopenharmony_ci#define AR5K_ISR_QCBRORN 0x02000000 /* QCU CBR overrun [5211+] */ 32662306a36Sopenharmony_ci#define AR5K_ISR_QCBRURN 0x04000000 /* QCU CBR underrun [5211+] */ 32762306a36Sopenharmony_ci#define AR5K_ISR_QTRIG 0x08000000 /* QCU scheduling trigger [5211+] */ 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci#define AR5K_ISR_BITS_FROM_SISRS (AR5K_ISR_TXOK | AR5K_ISR_TXDESC |\ 33062306a36Sopenharmony_ci AR5K_ISR_TXERR | AR5K_ISR_TXEOL |\ 33162306a36Sopenharmony_ci AR5K_ISR_TXURN | AR5K_ISR_HIUERR |\ 33262306a36Sopenharmony_ci AR5K_ISR_BCNMISC | AR5K_ISR_QCBRORN |\ 33362306a36Sopenharmony_ci AR5K_ISR_QCBRURN | AR5K_ISR_QTRIG) 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci/* 33662306a36Sopenharmony_ci * Secondary status registers [5211+] (0 - 4) 33762306a36Sopenharmony_ci * 33862306a36Sopenharmony_ci * These give the status for each QCU, only QCUs 0-9 are 33962306a36Sopenharmony_ci * represented. 34062306a36Sopenharmony_ci */ 34162306a36Sopenharmony_ci#define AR5K_SISR0 0x0084 /* Register Address [5211+] */ 34262306a36Sopenharmony_ci#define AR5K_SISR0_QCU_TXOK 0x000003ff /* Mask for QCU_TXOK */ 34362306a36Sopenharmony_ci#define AR5K_SISR0_QCU_TXOK_S 0 34462306a36Sopenharmony_ci#define AR5K_SISR0_QCU_TXDESC 0x03ff0000 /* Mask for QCU_TXDESC */ 34562306a36Sopenharmony_ci#define AR5K_SISR0_QCU_TXDESC_S 16 34662306a36Sopenharmony_ci 34762306a36Sopenharmony_ci#define AR5K_SISR1 0x0088 /* Register Address [5211+] */ 34862306a36Sopenharmony_ci#define AR5K_SISR1_QCU_TXERR 0x000003ff /* Mask for QCU_TXERR */ 34962306a36Sopenharmony_ci#define AR5K_SISR1_QCU_TXERR_S 0 35062306a36Sopenharmony_ci#define AR5K_SISR1_QCU_TXEOL 0x03ff0000 /* Mask for QCU_TXEOL */ 35162306a36Sopenharmony_ci#define AR5K_SISR1_QCU_TXEOL_S 16 35262306a36Sopenharmony_ci 35362306a36Sopenharmony_ci#define AR5K_SISR2 0x008c /* Register Address [5211+] */ 35462306a36Sopenharmony_ci#define AR5K_SISR2_QCU_TXURN 0x000003ff /* Mask for QCU_TXURN */ 35562306a36Sopenharmony_ci#define AR5K_SISR2_QCU_TXURN_S 0 35662306a36Sopenharmony_ci#define AR5K_SISR2_MCABT 0x00010000 /* Master Cycle Abort */ 35762306a36Sopenharmony_ci#define AR5K_SISR2_SSERR 0x00020000 /* Signaled System Error */ 35862306a36Sopenharmony_ci#define AR5K_SISR2_DPERR 0x00040000 /* Bus parity error */ 35962306a36Sopenharmony_ci#define AR5K_SISR2_TIM 0x01000000 /* [5212+] */ 36062306a36Sopenharmony_ci#define AR5K_SISR2_CAB_END 0x02000000 /* [5212+] */ 36162306a36Sopenharmony_ci#define AR5K_SISR2_DTIM_SYNC 0x04000000 /* DTIM sync lost [5212+] */ 36262306a36Sopenharmony_ci#define AR5K_SISR2_BCN_TIMEOUT 0x08000000 /* Beacon Timeout [5212+] */ 36362306a36Sopenharmony_ci#define AR5K_SISR2_CAB_TIMEOUT 0x10000000 /* CAB Timeout [5212+] */ 36462306a36Sopenharmony_ci#define AR5K_SISR2_DTIM 0x20000000 /* [5212+] */ 36562306a36Sopenharmony_ci#define AR5K_SISR2_TSFOOR 0x80000000 /* TSF Out of range */ 36662306a36Sopenharmony_ci 36762306a36Sopenharmony_ci#define AR5K_SISR3 0x0090 /* Register Address [5211+] */ 36862306a36Sopenharmony_ci#define AR5K_SISR3_QCBRORN 0x000003ff /* Mask for QCBRORN */ 36962306a36Sopenharmony_ci#define AR5K_SISR3_QCBRORN_S 0 37062306a36Sopenharmony_ci#define AR5K_SISR3_QCBRURN 0x03ff0000 /* Mask for QCBRURN */ 37162306a36Sopenharmony_ci#define AR5K_SISR3_QCBRURN_S 16 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci#define AR5K_SISR4 0x0094 /* Register Address [5211+] */ 37462306a36Sopenharmony_ci#define AR5K_SISR4_QTRIG 0x000003ff /* Mask for QTRIG */ 37562306a36Sopenharmony_ci#define AR5K_SISR4_QTRIG_S 0 37662306a36Sopenharmony_ci 37762306a36Sopenharmony_ci/* 37862306a36Sopenharmony_ci * Shadow read-and-clear interrupt status registers [5211+] 37962306a36Sopenharmony_ci */ 38062306a36Sopenharmony_ci#define AR5K_RAC_PISR 0x00c0 /* Read and clear PISR */ 38162306a36Sopenharmony_ci#define AR5K_RAC_SISR0 0x00c4 /* Read and clear SISR0 */ 38262306a36Sopenharmony_ci#define AR5K_RAC_SISR1 0x00c8 /* Read and clear SISR1 */ 38362306a36Sopenharmony_ci#define AR5K_RAC_SISR2 0x00cc /* Read and clear SISR2 */ 38462306a36Sopenharmony_ci#define AR5K_RAC_SISR3 0x00d0 /* Read and clear SISR3 */ 38562306a36Sopenharmony_ci#define AR5K_RAC_SISR4 0x00d4 /* Read and clear SISR4 */ 38662306a36Sopenharmony_ci 38762306a36Sopenharmony_ci/* 38862306a36Sopenharmony_ci * Interrupt Mask Registers 38962306a36Sopenharmony_ci * 39062306a36Sopenharmony_ci * As with ISRs 5210 has one IMR (AR5K_IMR) and 5211/5212 has one primary 39162306a36Sopenharmony_ci * (AR5K_PIMR) and 4 secondary IMRs (AR5K_SIMRx). Note that ISR/IMR flags match. 39262306a36Sopenharmony_ci */ 39362306a36Sopenharmony_ci#define AR5K_IMR 0x0020 /* Register Address [5210] */ 39462306a36Sopenharmony_ci#define AR5K_PIMR 0x00a0 /* Register Address [5211+] */ 39562306a36Sopenharmony_ci#define AR5K_IMR_RXOK 0x00000001 /* Frame successfully received*/ 39662306a36Sopenharmony_ci#define AR5K_IMR_RXDESC 0x00000002 /* RX descriptor request*/ 39762306a36Sopenharmony_ci#define AR5K_IMR_RXERR 0x00000004 /* Receive error*/ 39862306a36Sopenharmony_ci#define AR5K_IMR_RXNOFRM 0x00000008 /* No frame received (receive timeout)*/ 39962306a36Sopenharmony_ci#define AR5K_IMR_RXEOL 0x00000010 /* Empty RX descriptor*/ 40062306a36Sopenharmony_ci#define AR5K_IMR_RXORN 0x00000020 /* Receive FIFO overrun*/ 40162306a36Sopenharmony_ci#define AR5K_IMR_TXOK 0x00000040 /* Frame successfully transmitted*/ 40262306a36Sopenharmony_ci#define AR5K_IMR_TXDESC 0x00000080 /* TX descriptor request*/ 40362306a36Sopenharmony_ci#define AR5K_IMR_TXERR 0x00000100 /* Transmit error*/ 40462306a36Sopenharmony_ci#define AR5K_IMR_TXNOFRM 0x00000200 /* No frame transmitted (transmit timeout)*/ 40562306a36Sopenharmony_ci#define AR5K_IMR_TXEOL 0x00000400 /* Empty TX descriptor*/ 40662306a36Sopenharmony_ci#define AR5K_IMR_TXURN 0x00000800 /* Transmit FIFO underrun*/ 40762306a36Sopenharmony_ci#define AR5K_IMR_MIB 0x00001000 /* Update MIB counters*/ 40862306a36Sopenharmony_ci#define AR5K_IMR_SWI 0x00002000 /* Software interrupt */ 40962306a36Sopenharmony_ci#define AR5K_IMR_RXPHY 0x00004000 /* PHY error*/ 41062306a36Sopenharmony_ci#define AR5K_IMR_RXKCM 0x00008000 /* RX Key cache miss */ 41162306a36Sopenharmony_ci#define AR5K_IMR_SWBA 0x00010000 /* Software beacon alert*/ 41262306a36Sopenharmony_ci#define AR5K_IMR_BRSSI 0x00020000 /* Beacon rssi below threshold (?) */ 41362306a36Sopenharmony_ci#define AR5K_IMR_BMISS 0x00040000 /* Beacon missed*/ 41462306a36Sopenharmony_ci#define AR5K_IMR_HIUERR 0x00080000 /* Host Interface Unit error [5211+] */ 41562306a36Sopenharmony_ci#define AR5K_IMR_BNR 0x00100000 /* Beacon not ready [5211+] */ 41662306a36Sopenharmony_ci#define AR5K_IMR_MCABT 0x00100000 /* Master Cycle Abort [5210] */ 41762306a36Sopenharmony_ci#define AR5K_IMR_RXCHIRP 0x00200000 /* CHIRP Received [5212+]*/ 41862306a36Sopenharmony_ci#define AR5K_IMR_SSERR 0x00200000 /* Signaled System Error [5210] */ 41962306a36Sopenharmony_ci#define AR5K_IMR_DPERR 0x00400000 /* Det par Error (?) [5210] */ 42062306a36Sopenharmony_ci#define AR5K_IMR_RXDOPPLER 0x00400000 /* Doppler chirp received [5212+] */ 42162306a36Sopenharmony_ci#define AR5K_IMR_TIM 0x00800000 /* [5211+] */ 42262306a36Sopenharmony_ci#define AR5K_IMR_BCNMISC 0x00800000 /* 'or' of TIM, CAB_END, DTIM_SYNC, BCN_TIMEOUT, 42362306a36Sopenharmony_ci CAB_TIMEOUT and DTIM bits from SISR2 [5212+] */ 42462306a36Sopenharmony_ci#define AR5K_IMR_GPIO 0x01000000 /* GPIO (rf kill)*/ 42562306a36Sopenharmony_ci#define AR5K_IMR_QCBRORN 0x02000000 /* QCU CBR overrun (?) [5211+] */ 42662306a36Sopenharmony_ci#define AR5K_IMR_QCBRURN 0x04000000 /* QCU CBR underrun (?) [5211+] */ 42762306a36Sopenharmony_ci#define AR5K_IMR_QTRIG 0x08000000 /* QCU scheduling trigger [5211+] */ 42862306a36Sopenharmony_ci 42962306a36Sopenharmony_ci/* 43062306a36Sopenharmony_ci * Secondary interrupt mask registers [5211+] (0 - 4) 43162306a36Sopenharmony_ci */ 43262306a36Sopenharmony_ci#define AR5K_SIMR0 0x00a4 /* Register Address [5211+] */ 43362306a36Sopenharmony_ci#define AR5K_SIMR0_QCU_TXOK 0x000003ff /* Mask for QCU_TXOK */ 43462306a36Sopenharmony_ci#define AR5K_SIMR0_QCU_TXOK_S 0 43562306a36Sopenharmony_ci#define AR5K_SIMR0_QCU_TXDESC 0x03ff0000 /* Mask for QCU_TXDESC */ 43662306a36Sopenharmony_ci#define AR5K_SIMR0_QCU_TXDESC_S 16 43762306a36Sopenharmony_ci 43862306a36Sopenharmony_ci#define AR5K_SIMR1 0x00a8 /* Register Address [5211+] */ 43962306a36Sopenharmony_ci#define AR5K_SIMR1_QCU_TXERR 0x000003ff /* Mask for QCU_TXERR */ 44062306a36Sopenharmony_ci#define AR5K_SIMR1_QCU_TXERR_S 0 44162306a36Sopenharmony_ci#define AR5K_SIMR1_QCU_TXEOL 0x03ff0000 /* Mask for QCU_TXEOL */ 44262306a36Sopenharmony_ci#define AR5K_SIMR1_QCU_TXEOL_S 16 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci#define AR5K_SIMR2 0x00ac /* Register Address [5211+] */ 44562306a36Sopenharmony_ci#define AR5K_SIMR2_QCU_TXURN 0x000003ff /* Mask for QCU_TXURN */ 44662306a36Sopenharmony_ci#define AR5K_SIMR2_QCU_TXURN_S 0 44762306a36Sopenharmony_ci#define AR5K_SIMR2_MCABT 0x00010000 /* Master Cycle Abort */ 44862306a36Sopenharmony_ci#define AR5K_SIMR2_SSERR 0x00020000 /* Signaled System Error */ 44962306a36Sopenharmony_ci#define AR5K_SIMR2_DPERR 0x00040000 /* Bus parity error */ 45062306a36Sopenharmony_ci#define AR5K_SIMR2_TIM 0x01000000 /* [5212+] */ 45162306a36Sopenharmony_ci#define AR5K_SIMR2_CAB_END 0x02000000 /* [5212+] */ 45262306a36Sopenharmony_ci#define AR5K_SIMR2_DTIM_SYNC 0x04000000 /* DTIM Sync lost [5212+] */ 45362306a36Sopenharmony_ci#define AR5K_SIMR2_BCN_TIMEOUT 0x08000000 /* Beacon Timeout [5212+] */ 45462306a36Sopenharmony_ci#define AR5K_SIMR2_CAB_TIMEOUT 0x10000000 /* CAB Timeout [5212+] */ 45562306a36Sopenharmony_ci#define AR5K_SIMR2_DTIM 0x20000000 /* [5212+] */ 45662306a36Sopenharmony_ci#define AR5K_SIMR2_TSFOOR 0x80000000 /* TSF OOR (?) */ 45762306a36Sopenharmony_ci 45862306a36Sopenharmony_ci#define AR5K_SIMR3 0x00b0 /* Register Address [5211+] */ 45962306a36Sopenharmony_ci#define AR5K_SIMR3_QCBRORN 0x000003ff /* Mask for QCBRORN */ 46062306a36Sopenharmony_ci#define AR5K_SIMR3_QCBRORN_S 0 46162306a36Sopenharmony_ci#define AR5K_SIMR3_QCBRURN 0x03ff0000 /* Mask for QCBRURN */ 46262306a36Sopenharmony_ci#define AR5K_SIMR3_QCBRURN_S 16 46362306a36Sopenharmony_ci 46462306a36Sopenharmony_ci#define AR5K_SIMR4 0x00b4 /* Register Address [5211+] */ 46562306a36Sopenharmony_ci#define AR5K_SIMR4_QTRIG 0x000003ff /* Mask for QTRIG */ 46662306a36Sopenharmony_ci#define AR5K_SIMR4_QTRIG_S 0 46762306a36Sopenharmony_ci 46862306a36Sopenharmony_ci/* 46962306a36Sopenharmony_ci * DMA Debug registers 0-7 47062306a36Sopenharmony_ci * 0xe0 - 0xfc 47162306a36Sopenharmony_ci */ 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_ci/* 47462306a36Sopenharmony_ci * Decompression mask registers [5212+] 47562306a36Sopenharmony_ci */ 47662306a36Sopenharmony_ci#define AR5K_DCM_ADDR 0x0400 /*Decompression mask address (index) */ 47762306a36Sopenharmony_ci#define AR5K_DCM_DATA 0x0404 /*Decompression mask data */ 47862306a36Sopenharmony_ci 47962306a36Sopenharmony_ci/* 48062306a36Sopenharmony_ci * Wake On Wireless pattern control register [5212+] 48162306a36Sopenharmony_ci */ 48262306a36Sopenharmony_ci#define AR5K_WOW_PCFG 0x0410 /* Register Address */ 48362306a36Sopenharmony_ci#define AR5K_WOW_PCFG_PAT_MATCH_EN 0x00000001 /* Pattern match enable */ 48462306a36Sopenharmony_ci#define AR5K_WOW_PCFG_LONG_FRAME_POL 0x00000002 /* Long frame policy */ 48562306a36Sopenharmony_ci#define AR5K_WOW_PCFG_WOBMISS 0x00000004 /* Wake on bea(con) miss (?) */ 48662306a36Sopenharmony_ci#define AR5K_WOW_PCFG_PAT_0_EN 0x00000100 /* Enable pattern 0 */ 48762306a36Sopenharmony_ci#define AR5K_WOW_PCFG_PAT_1_EN 0x00000200 /* Enable pattern 1 */ 48862306a36Sopenharmony_ci#define AR5K_WOW_PCFG_PAT_2_EN 0x00000400 /* Enable pattern 2 */ 48962306a36Sopenharmony_ci#define AR5K_WOW_PCFG_PAT_3_EN 0x00000800 /* Enable pattern 3 */ 49062306a36Sopenharmony_ci#define AR5K_WOW_PCFG_PAT_4_EN 0x00001000 /* Enable pattern 4 */ 49162306a36Sopenharmony_ci#define AR5K_WOW_PCFG_PAT_5_EN 0x00002000 /* Enable pattern 5 */ 49262306a36Sopenharmony_ci 49362306a36Sopenharmony_ci/* 49462306a36Sopenharmony_ci * Wake On Wireless pattern index register (?) [5212+] 49562306a36Sopenharmony_ci */ 49662306a36Sopenharmony_ci#define AR5K_WOW_PAT_IDX 0x0414 49762306a36Sopenharmony_ci 49862306a36Sopenharmony_ci/* 49962306a36Sopenharmony_ci * Wake On Wireless pattern data register [5212+] 50062306a36Sopenharmony_ci */ 50162306a36Sopenharmony_ci#define AR5K_WOW_PAT_DATA 0x0418 /* Register Address */ 50262306a36Sopenharmony_ci#define AR5K_WOW_PAT_DATA_0_3_V 0x00000001 /* Pattern 0, 3 value */ 50362306a36Sopenharmony_ci#define AR5K_WOW_PAT_DATA_1_4_V 0x00000100 /* Pattern 1, 4 value */ 50462306a36Sopenharmony_ci#define AR5K_WOW_PAT_DATA_2_5_V 0x00010000 /* Pattern 2, 5 value */ 50562306a36Sopenharmony_ci#define AR5K_WOW_PAT_DATA_0_3_M 0x01000000 /* Pattern 0, 3 mask */ 50662306a36Sopenharmony_ci#define AR5K_WOW_PAT_DATA_1_4_M 0x04000000 /* Pattern 1, 4 mask */ 50762306a36Sopenharmony_ci#define AR5K_WOW_PAT_DATA_2_5_M 0x10000000 /* Pattern 2, 5 mask */ 50862306a36Sopenharmony_ci 50962306a36Sopenharmony_ci/* 51062306a36Sopenharmony_ci * Decompression configuration registers [5212+] 51162306a36Sopenharmony_ci */ 51262306a36Sopenharmony_ci#define AR5K_DCCFG 0x0420 /* Register Address */ 51362306a36Sopenharmony_ci#define AR5K_DCCFG_GLOBAL_EN 0x00000001 /* Enable decompression on all queues */ 51462306a36Sopenharmony_ci#define AR5K_DCCFG_BYPASS_EN 0x00000002 /* Bypass decompression */ 51562306a36Sopenharmony_ci#define AR5K_DCCFG_BCAST_EN 0x00000004 /* Enable decompression for bcast frames */ 51662306a36Sopenharmony_ci#define AR5K_DCCFG_MCAST_EN 0x00000008 /* Enable decompression for mcast frames */ 51762306a36Sopenharmony_ci 51862306a36Sopenharmony_ci/* 51962306a36Sopenharmony_ci * Compression configuration registers [5212+] 52062306a36Sopenharmony_ci */ 52162306a36Sopenharmony_ci#define AR5K_CCFG 0x0600 /* Register Address */ 52262306a36Sopenharmony_ci#define AR5K_CCFG_WINDOW_SIZE 0x00000007 /* Compression window size */ 52362306a36Sopenharmony_ci#define AR5K_CCFG_CPC_EN 0x00000008 /* Enable performance counters */ 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci#define AR5K_CCFG_CCU 0x0604 /* Register Address */ 52662306a36Sopenharmony_ci#define AR5K_CCFG_CCU_CUP_EN 0x00000001 /* CCU Catchup enable */ 52762306a36Sopenharmony_ci#define AR5K_CCFG_CCU_CREDIT 0x00000002 /* CCU Credit (field) */ 52862306a36Sopenharmony_ci#define AR5K_CCFG_CCU_CD_THRES 0x00000080 /* CCU Cyc(lic?) debt threshold (field) */ 52962306a36Sopenharmony_ci#define AR5K_CCFG_CCU_CUP_LCNT 0x00010000 /* CCU Catchup lit(?) count */ 53062306a36Sopenharmony_ci#define AR5K_CCFG_CCU_INIT 0x00100200 /* Initial value during reset */ 53162306a36Sopenharmony_ci 53262306a36Sopenharmony_ci/* 53362306a36Sopenharmony_ci * Compression performance counter registers [5212+] 53462306a36Sopenharmony_ci */ 53562306a36Sopenharmony_ci#define AR5K_CPC0 0x0610 /* Compression performance counter 0 */ 53662306a36Sopenharmony_ci#define AR5K_CPC1 0x0614 /* Compression performance counter 1*/ 53762306a36Sopenharmony_ci#define AR5K_CPC2 0x0618 /* Compression performance counter 2 */ 53862306a36Sopenharmony_ci#define AR5K_CPC3 0x061c /* Compression performance counter 3 */ 53962306a36Sopenharmony_ci#define AR5K_CPCOVF 0x0620 /* Compression performance overflow */ 54062306a36Sopenharmony_ci 54162306a36Sopenharmony_ci 54262306a36Sopenharmony_ci/* 54362306a36Sopenharmony_ci * Queue control unit (QCU) registers [5211+] 54462306a36Sopenharmony_ci * 54562306a36Sopenharmony_ci * Card has 12 TX Queues but i see that only 0-9 are used (?) 54662306a36Sopenharmony_ci * both in binary HAL (see ah.h) and ar5k. Each queue has it's own 54762306a36Sopenharmony_ci * TXDP at addresses 0x0800 - 0x082c, a CBR (Constant Bit Rate) 54862306a36Sopenharmony_ci * configuration register (0x08c0 - 0x08ec), a ready time configuration 54962306a36Sopenharmony_ci * register (0x0900 - 0x092c), a misc configuration register (0x09c0 - 55062306a36Sopenharmony_ci * 0x09ec) and a status register (0x0a00 - 0x0a2c). We also have some 55162306a36Sopenharmony_ci * global registers, QCU transmit enable/disable and "one shot arm (?)" 55262306a36Sopenharmony_ci * set/clear, which contain status for all queues (we shift by 1 for each 55362306a36Sopenharmony_ci * queue). To access these registers easily we define some macros here 55462306a36Sopenharmony_ci * that are used inside HAL. For more infos check out *_tx_queue functs. 55562306a36Sopenharmony_ci */ 55662306a36Sopenharmony_ci 55762306a36Sopenharmony_ci/* 55862306a36Sopenharmony_ci * Generic QCU Register access macros 55962306a36Sopenharmony_ci */ 56062306a36Sopenharmony_ci#define AR5K_QUEUE_REG(_r, _q) (((_q) << 2) + _r) 56162306a36Sopenharmony_ci#define AR5K_QCU_GLOBAL_READ(_r, _q) (AR5K_REG_READ(_r) & (1 << _q)) 56262306a36Sopenharmony_ci#define AR5K_QCU_GLOBAL_WRITE(_r, _q) AR5K_REG_WRITE(_r, (1 << _q)) 56362306a36Sopenharmony_ci 56462306a36Sopenharmony_ci/* 56562306a36Sopenharmony_ci * QCU Transmit descriptor pointer registers 56662306a36Sopenharmony_ci */ 56762306a36Sopenharmony_ci#define AR5K_QCU_TXDP_BASE 0x0800 /* Register Address - Queue0 TXDP */ 56862306a36Sopenharmony_ci#define AR5K_QUEUE_TXDP(_q) AR5K_QUEUE_REG(AR5K_QCU_TXDP_BASE, _q) 56962306a36Sopenharmony_ci 57062306a36Sopenharmony_ci/* 57162306a36Sopenharmony_ci * QCU Transmit enable register 57262306a36Sopenharmony_ci */ 57362306a36Sopenharmony_ci#define AR5K_QCU_TXE 0x0840 57462306a36Sopenharmony_ci#define AR5K_ENABLE_QUEUE(_q) AR5K_QCU_GLOBAL_WRITE(AR5K_QCU_TXE, _q) 57562306a36Sopenharmony_ci#define AR5K_QUEUE_ENABLED(_q) AR5K_QCU_GLOBAL_READ(AR5K_QCU_TXE, _q) 57662306a36Sopenharmony_ci 57762306a36Sopenharmony_ci/* 57862306a36Sopenharmony_ci * QCU Transmit disable register 57962306a36Sopenharmony_ci */ 58062306a36Sopenharmony_ci#define AR5K_QCU_TXD 0x0880 58162306a36Sopenharmony_ci#define AR5K_DISABLE_QUEUE(_q) AR5K_QCU_GLOBAL_WRITE(AR5K_QCU_TXD, _q) 58262306a36Sopenharmony_ci#define AR5K_QUEUE_DISABLED(_q) AR5K_QCU_GLOBAL_READ(AR5K_QCU_TXD, _q) 58362306a36Sopenharmony_ci 58462306a36Sopenharmony_ci/* 58562306a36Sopenharmony_ci * QCU Constant Bit Rate configuration registers 58662306a36Sopenharmony_ci */ 58762306a36Sopenharmony_ci#define AR5K_QCU_CBRCFG_BASE 0x08c0 /* Register Address - Queue0 CBRCFG */ 58862306a36Sopenharmony_ci#define AR5K_QCU_CBRCFG_INTVAL 0x00ffffff /* CBR Interval mask */ 58962306a36Sopenharmony_ci#define AR5K_QCU_CBRCFG_INTVAL_S 0 59062306a36Sopenharmony_ci#define AR5K_QCU_CBRCFG_ORN_THRES 0xff000000 /* CBR overrun threshold mask */ 59162306a36Sopenharmony_ci#define AR5K_QCU_CBRCFG_ORN_THRES_S 24 59262306a36Sopenharmony_ci#define AR5K_QUEUE_CBRCFG(_q) AR5K_QUEUE_REG(AR5K_QCU_CBRCFG_BASE, _q) 59362306a36Sopenharmony_ci 59462306a36Sopenharmony_ci/* 59562306a36Sopenharmony_ci * QCU Ready time configuration registers 59662306a36Sopenharmony_ci */ 59762306a36Sopenharmony_ci#define AR5K_QCU_RDYTIMECFG_BASE 0x0900 /* Register Address - Queue0 RDYTIMECFG */ 59862306a36Sopenharmony_ci#define AR5K_QCU_RDYTIMECFG_INTVAL 0x00ffffff /* Ready time interval mask */ 59962306a36Sopenharmony_ci#define AR5K_QCU_RDYTIMECFG_INTVAL_S 0 60062306a36Sopenharmony_ci#define AR5K_QCU_RDYTIMECFG_ENABLE 0x01000000 /* Ready time enable mask */ 60162306a36Sopenharmony_ci#define AR5K_QUEUE_RDYTIMECFG(_q) AR5K_QUEUE_REG(AR5K_QCU_RDYTIMECFG_BASE, _q) 60262306a36Sopenharmony_ci 60362306a36Sopenharmony_ci/* 60462306a36Sopenharmony_ci * QCU one shot arm set registers 60562306a36Sopenharmony_ci */ 60662306a36Sopenharmony_ci#define AR5K_QCU_ONESHOTARM_SET 0x0940 /* Register Address -QCU "one shot arm set (?)" */ 60762306a36Sopenharmony_ci#define AR5K_QCU_ONESHOTARM_SET_M 0x0000ffff 60862306a36Sopenharmony_ci 60962306a36Sopenharmony_ci/* 61062306a36Sopenharmony_ci * QCU one shot arm clear registers 61162306a36Sopenharmony_ci */ 61262306a36Sopenharmony_ci#define AR5K_QCU_ONESHOTARM_CLEAR 0x0980 /* Register Address -QCU "one shot arm clear (?)" */ 61362306a36Sopenharmony_ci#define AR5K_QCU_ONESHOTARM_CLEAR_M 0x0000ffff 61462306a36Sopenharmony_ci 61562306a36Sopenharmony_ci/* 61662306a36Sopenharmony_ci * QCU misc registers 61762306a36Sopenharmony_ci */ 61862306a36Sopenharmony_ci#define AR5K_QCU_MISC_BASE 0x09c0 /* Register Address -Queue0 MISC */ 61962306a36Sopenharmony_ci#define AR5K_QCU_MISC_FRSHED_M 0x0000000f /* Frame scheduling mask */ 62062306a36Sopenharmony_ci#define AR5K_QCU_MISC_FRSHED_ASAP 0 /* ASAP */ 62162306a36Sopenharmony_ci#define AR5K_QCU_MISC_FRSHED_CBR 1 /* Constant Bit Rate */ 62262306a36Sopenharmony_ci#define AR5K_QCU_MISC_FRSHED_DBA_GT 2 /* DMA Beacon alert gated */ 62362306a36Sopenharmony_ci#define AR5K_QCU_MISC_FRSHED_TIM_GT 3 /* TIMT gated */ 62462306a36Sopenharmony_ci#define AR5K_QCU_MISC_FRSHED_BCN_SENT_GT 4 /* Beacon sent gated */ 62562306a36Sopenharmony_ci#define AR5K_QCU_MISC_ONESHOT_ENABLE 0x00000010 /* Oneshot enable */ 62662306a36Sopenharmony_ci#define AR5K_QCU_MISC_CBREXP_DIS 0x00000020 /* Disable CBR expired counter (normal queue) */ 62762306a36Sopenharmony_ci#define AR5K_QCU_MISC_CBREXP_BCN_DIS 0x00000040 /* Disable CBR expired counter (beacon queue) */ 62862306a36Sopenharmony_ci#define AR5K_QCU_MISC_BCN_ENABLE 0x00000080 /* Enable Beacon use */ 62962306a36Sopenharmony_ci#define AR5K_QCU_MISC_CBR_THRES_ENABLE 0x00000100 /* CBR expired threshold enabled */ 63062306a36Sopenharmony_ci#define AR5K_QCU_MISC_RDY_VEOL_POLICY 0x00000200 /* TXE reset when RDYTIME expired or VEOL */ 63162306a36Sopenharmony_ci#define AR5K_QCU_MISC_CBR_RESET_CNT 0x00000400 /* CBR threshold (counter) reset */ 63262306a36Sopenharmony_ci#define AR5K_QCU_MISC_DCU_EARLY 0x00000800 /* DCU early termination */ 63362306a36Sopenharmony_ci#define AR5K_QCU_MISC_DCU_CMP_EN 0x00001000 /* Enable frame compression */ 63462306a36Sopenharmony_ci#define AR5K_QUEUE_MISC(_q) AR5K_QUEUE_REG(AR5K_QCU_MISC_BASE, _q) 63562306a36Sopenharmony_ci 63662306a36Sopenharmony_ci 63762306a36Sopenharmony_ci/* 63862306a36Sopenharmony_ci * QCU status registers 63962306a36Sopenharmony_ci */ 64062306a36Sopenharmony_ci#define AR5K_QCU_STS_BASE 0x0a00 /* Register Address - Queue0 STS */ 64162306a36Sopenharmony_ci#define AR5K_QCU_STS_FRMPENDCNT 0x00000003 /* Frames pending counter */ 64262306a36Sopenharmony_ci#define AR5K_QCU_STS_CBREXPCNT 0x0000ff00 /* CBR expired counter */ 64362306a36Sopenharmony_ci#define AR5K_QUEUE_STATUS(_q) AR5K_QUEUE_REG(AR5K_QCU_STS_BASE, _q) 64462306a36Sopenharmony_ci 64562306a36Sopenharmony_ci/* 64662306a36Sopenharmony_ci * QCU ready time shutdown register 64762306a36Sopenharmony_ci */ 64862306a36Sopenharmony_ci#define AR5K_QCU_RDYTIMESHDN 0x0a40 64962306a36Sopenharmony_ci#define AR5K_QCU_RDYTIMESHDN_M 0x000003ff 65062306a36Sopenharmony_ci 65162306a36Sopenharmony_ci/* 65262306a36Sopenharmony_ci * QCU compression buffer base registers [5212+] 65362306a36Sopenharmony_ci */ 65462306a36Sopenharmony_ci#define AR5K_QCU_CBB_SELECT 0x0b00 65562306a36Sopenharmony_ci#define AR5K_QCU_CBB_ADDR 0x0b04 65662306a36Sopenharmony_ci#define AR5K_QCU_CBB_ADDR_S 9 65762306a36Sopenharmony_ci 65862306a36Sopenharmony_ci/* 65962306a36Sopenharmony_ci * QCU compression buffer configuration register [5212+] 66062306a36Sopenharmony_ci * (buffer size) 66162306a36Sopenharmony_ci */ 66262306a36Sopenharmony_ci#define AR5K_QCU_CBCFG 0x0b08 66362306a36Sopenharmony_ci 66462306a36Sopenharmony_ci 66562306a36Sopenharmony_ci 66662306a36Sopenharmony_ci/* 66762306a36Sopenharmony_ci * Distributed Coordination Function (DCF) control unit (DCU) 66862306a36Sopenharmony_ci * registers [5211+] 66962306a36Sopenharmony_ci * 67062306a36Sopenharmony_ci * These registers control the various characteristics of each queue 67162306a36Sopenharmony_ci * for 802.11e (WME) compatibility so they go together with 67262306a36Sopenharmony_ci * QCU registers in pairs. For each queue we have a QCU mask register, 67362306a36Sopenharmony_ci * (0x1000 - 0x102c), a local-IFS settings register (0x1040 - 0x106c), 67462306a36Sopenharmony_ci * a retry limit register (0x1080 - 0x10ac), a channel time register 67562306a36Sopenharmony_ci * (0x10c0 - 0x10ec), a misc-settings register (0x1100 - 0x112c) and 67662306a36Sopenharmony_ci * a sequence number register (0x1140 - 0x116c). It seems that "global" 67762306a36Sopenharmony_ci * registers here affect all queues (see use of DCU_GBL_IFS_SLOT in ar5k). 67862306a36Sopenharmony_ci * We use the same macros here for easier register access. 67962306a36Sopenharmony_ci * 68062306a36Sopenharmony_ci */ 68162306a36Sopenharmony_ci 68262306a36Sopenharmony_ci/* 68362306a36Sopenharmony_ci * DCU QCU mask registers 68462306a36Sopenharmony_ci */ 68562306a36Sopenharmony_ci#define AR5K_DCU_QCUMASK_BASE 0x1000 /* Register Address -Queue0 DCU_QCUMASK */ 68662306a36Sopenharmony_ci#define AR5K_DCU_QCUMASK_M 0x000003ff 68762306a36Sopenharmony_ci#define AR5K_QUEUE_QCUMASK(_q) AR5K_QUEUE_REG(AR5K_DCU_QCUMASK_BASE, _q) 68862306a36Sopenharmony_ci 68962306a36Sopenharmony_ci/* 69062306a36Sopenharmony_ci * DCU local Inter Frame Space settings register 69162306a36Sopenharmony_ci */ 69262306a36Sopenharmony_ci#define AR5K_DCU_LCL_IFS_BASE 0x1040 /* Register Address -Queue0 DCU_LCL_IFS */ 69362306a36Sopenharmony_ci#define AR5K_DCU_LCL_IFS_CW_MIN 0x000003ff /* Minimum Contention Window */ 69462306a36Sopenharmony_ci#define AR5K_DCU_LCL_IFS_CW_MIN_S 0 69562306a36Sopenharmony_ci#define AR5K_DCU_LCL_IFS_CW_MAX 0x000ffc00 /* Maximum Contention Window */ 69662306a36Sopenharmony_ci#define AR5K_DCU_LCL_IFS_CW_MAX_S 10 69762306a36Sopenharmony_ci#define AR5K_DCU_LCL_IFS_AIFS 0x0ff00000 /* Arbitrated Interframe Space */ 69862306a36Sopenharmony_ci#define AR5K_DCU_LCL_IFS_AIFS_S 20 69962306a36Sopenharmony_ci#define AR5K_DCU_LCL_IFS_AIFS_MAX 0xfc /* Anything above that can cause DCU to hang */ 70062306a36Sopenharmony_ci#define AR5K_QUEUE_DFS_LOCAL_IFS(_q) AR5K_QUEUE_REG(AR5K_DCU_LCL_IFS_BASE, _q) 70162306a36Sopenharmony_ci 70262306a36Sopenharmony_ci/* 70362306a36Sopenharmony_ci * DCU retry limit registers 70462306a36Sopenharmony_ci * all these fields don't allow zero values 70562306a36Sopenharmony_ci */ 70662306a36Sopenharmony_ci#define AR5K_DCU_RETRY_LMT_BASE 0x1080 /* Register Address -Queue0 DCU_RETRY_LMT */ 70762306a36Sopenharmony_ci#define AR5K_DCU_RETRY_LMT_RTS 0x0000000f /* RTS failure limit. Transmission fails if no CTS is received for this number of times */ 70862306a36Sopenharmony_ci#define AR5K_DCU_RETRY_LMT_RTS_S 0 70962306a36Sopenharmony_ci#define AR5K_DCU_RETRY_LMT_STA_RTS 0x00003f00 /* STA RTS failure limit. If exceeded CW reset */ 71062306a36Sopenharmony_ci#define AR5K_DCU_RETRY_LMT_STA_RTS_S 8 71162306a36Sopenharmony_ci#define AR5K_DCU_RETRY_LMT_STA_DATA 0x000fc000 /* STA data failure limit. If exceeded CW reset. */ 71262306a36Sopenharmony_ci#define AR5K_DCU_RETRY_LMT_STA_DATA_S 14 71362306a36Sopenharmony_ci#define AR5K_QUEUE_DFS_RETRY_LIMIT(_q) AR5K_QUEUE_REG(AR5K_DCU_RETRY_LMT_BASE, _q) 71462306a36Sopenharmony_ci 71562306a36Sopenharmony_ci/* 71662306a36Sopenharmony_ci * DCU channel time registers 71762306a36Sopenharmony_ci */ 71862306a36Sopenharmony_ci#define AR5K_DCU_CHAN_TIME_BASE 0x10c0 /* Register Address -Queue0 DCU_CHAN_TIME */ 71962306a36Sopenharmony_ci#define AR5K_DCU_CHAN_TIME_DUR 0x000fffff /* Channel time duration */ 72062306a36Sopenharmony_ci#define AR5K_DCU_CHAN_TIME_DUR_S 0 72162306a36Sopenharmony_ci#define AR5K_DCU_CHAN_TIME_ENABLE 0x00100000 /* Enable channel time */ 72262306a36Sopenharmony_ci#define AR5K_QUEUE_DFS_CHANNEL_TIME(_q) AR5K_QUEUE_REG(AR5K_DCU_CHAN_TIME_BASE, _q) 72362306a36Sopenharmony_ci 72462306a36Sopenharmony_ci/* 72562306a36Sopenharmony_ci * DCU misc registers [5211+] 72662306a36Sopenharmony_ci * 72762306a36Sopenharmony_ci * Note: Arbiter lockout control controls the 72862306a36Sopenharmony_ci * behaviour on low priority queues when we have multiple queues 72962306a36Sopenharmony_ci * with pending frames. Intra-frame lockout means we wait until 73062306a36Sopenharmony_ci * the queue's current frame transmits (with post frame backoff and bursting) 73162306a36Sopenharmony_ci * before we transmit anything else and global lockout means we 73262306a36Sopenharmony_ci * wait for the whole queue to finish before higher priority queues 73362306a36Sopenharmony_ci * can transmit (this is used on beacon and CAB queues). 73462306a36Sopenharmony_ci * No lockout means there is no special handling. 73562306a36Sopenharmony_ci */ 73662306a36Sopenharmony_ci#define AR5K_DCU_MISC_BASE 0x1100 /* Register Address -Queue0 DCU_MISC */ 73762306a36Sopenharmony_ci#define AR5K_DCU_MISC_BACKOFF 0x0000003f /* Mask for backoff threshold */ 73862306a36Sopenharmony_ci#define AR5K_DCU_MISC_ETS_RTS_POL 0x00000040 /* End of transmission series 73962306a36Sopenharmony_ci station RTS/data failure count 74062306a36Sopenharmony_ci reset policy (?) */ 74162306a36Sopenharmony_ci#define AR5K_DCU_MISC_ETS_CW_POL 0x00000080 /* End of transmission series 74262306a36Sopenharmony_ci CW reset policy */ 74362306a36Sopenharmony_ci#define AR5K_DCU_MISC_FRAG_WAIT 0x00000100 /* Wait for next fragment */ 74462306a36Sopenharmony_ci#define AR5K_DCU_MISC_BACKOFF_FRAG 0x00000200 /* Enable backoff while bursting */ 74562306a36Sopenharmony_ci#define AR5K_DCU_MISC_HCFPOLL_ENABLE 0x00000800 /* CF - Poll enable */ 74662306a36Sopenharmony_ci#define AR5K_DCU_MISC_BACKOFF_PERSIST 0x00001000 /* Persistent backoff */ 74762306a36Sopenharmony_ci#define AR5K_DCU_MISC_FRMPRFTCH_ENABLE 0x00002000 /* Enable frame pre-fetch */ 74862306a36Sopenharmony_ci#define AR5K_DCU_MISC_VIRTCOL 0x0000c000 /* Mask for Virtual Collision (?) */ 74962306a36Sopenharmony_ci#define AR5K_DCU_MISC_VIRTCOL_NORMAL 0 75062306a36Sopenharmony_ci#define AR5K_DCU_MISC_VIRTCOL_IGNORE 1 75162306a36Sopenharmony_ci#define AR5K_DCU_MISC_BCN_ENABLE 0x00010000 /* Enable Beacon use */ 75262306a36Sopenharmony_ci#define AR5K_DCU_MISC_ARBLOCK_CTL 0x00060000 /* Arbiter lockout control mask */ 75362306a36Sopenharmony_ci#define AR5K_DCU_MISC_ARBLOCK_CTL_S 17 75462306a36Sopenharmony_ci#define AR5K_DCU_MISC_ARBLOCK_CTL_NONE 0 /* No arbiter lockout */ 75562306a36Sopenharmony_ci#define AR5K_DCU_MISC_ARBLOCK_CTL_INTFRM 1 /* Intra-frame lockout */ 75662306a36Sopenharmony_ci#define AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL 2 /* Global lockout */ 75762306a36Sopenharmony_ci#define AR5K_DCU_MISC_ARBLOCK_IGNORE 0x00080000 /* Ignore Arbiter lockout */ 75862306a36Sopenharmony_ci#define AR5K_DCU_MISC_SEQ_NUM_INCR_DIS 0x00100000 /* Disable sequence number increment */ 75962306a36Sopenharmony_ci#define AR5K_DCU_MISC_POST_FR_BKOFF_DIS 0x00200000 /* Disable post-frame backoff */ 76062306a36Sopenharmony_ci#define AR5K_DCU_MISC_VIRT_COLL_POLICY 0x00400000 /* Virtual Collision cw policy */ 76162306a36Sopenharmony_ci#define AR5K_DCU_MISC_BLOWN_IFS_POLICY 0x00800000 /* Blown IFS policy (?) */ 76262306a36Sopenharmony_ci#define AR5K_DCU_MISC_SEQNUM_CTL 0x01000000 /* Sequence number control (?) */ 76362306a36Sopenharmony_ci#define AR5K_QUEUE_DFS_MISC(_q) AR5K_QUEUE_REG(AR5K_DCU_MISC_BASE, _q) 76462306a36Sopenharmony_ci 76562306a36Sopenharmony_ci/* 76662306a36Sopenharmony_ci * DCU frame sequence number registers 76762306a36Sopenharmony_ci */ 76862306a36Sopenharmony_ci#define AR5K_DCU_SEQNUM_BASE 0x1140 76962306a36Sopenharmony_ci#define AR5K_DCU_SEQNUM_M 0x00000fff 77062306a36Sopenharmony_ci#define AR5K_QUEUE_DCU_SEQNUM(_q) AR5K_QUEUE_REG(AR5K_DCU_SEQNUM_BASE, _q) 77162306a36Sopenharmony_ci 77262306a36Sopenharmony_ci/* 77362306a36Sopenharmony_ci * DCU global IFS SIFS register 77462306a36Sopenharmony_ci */ 77562306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_SIFS 0x1030 77662306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_SIFS_M 0x0000ffff 77762306a36Sopenharmony_ci 77862306a36Sopenharmony_ci/* 77962306a36Sopenharmony_ci * DCU global IFS slot interval register 78062306a36Sopenharmony_ci */ 78162306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_SLOT 0x1070 78262306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_SLOT_M 0x0000ffff 78362306a36Sopenharmony_ci 78462306a36Sopenharmony_ci/* 78562306a36Sopenharmony_ci * DCU global IFS EIFS register 78662306a36Sopenharmony_ci */ 78762306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_EIFS 0x10b0 78862306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_EIFS_M 0x0000ffff 78962306a36Sopenharmony_ci 79062306a36Sopenharmony_ci/* 79162306a36Sopenharmony_ci * DCU global IFS misc register 79262306a36Sopenharmony_ci * 79362306a36Sopenharmony_ci * LFSR stands for Linear Feedback Shift Register 79462306a36Sopenharmony_ci * and it's used for generating pseudo-random 79562306a36Sopenharmony_ci * number sequences. 79662306a36Sopenharmony_ci * 79762306a36Sopenharmony_ci * (If i understand correctly, random numbers are 79862306a36Sopenharmony_ci * used for idle sensing -multiplied with cwmin/max etc-) 79962306a36Sopenharmony_ci */ 80062306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_MISC 0x10f0 /* Register Address */ 80162306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE 0x00000007 /* LFSR Slice Select */ 80262306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_MISC_TURBO_MODE 0x00000008 /* Turbo mode */ 80362306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC 0x000003f0 /* SIFS Duration mask */ 80462306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC_S 4 80562306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_MISC_USEC_DUR 0x000ffc00 /* USEC Duration mask */ 80662306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_MISC_USEC_DUR_S 10 80762306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY 0x00300000 /* DCU Arbiter delay mask */ 80862306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_MISC_SIFS_CNT_RST 0x00400000 /* SIFS cnt reset policy (?) */ 80962306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_MISC_AIFS_CNT_RST 0x00800000 /* AIFS cnt reset policy (?) */ 81062306a36Sopenharmony_ci#define AR5K_DCU_GBL_IFS_MISC_RND_LFSR_SL_DIS 0x01000000 /* Disable random LFSR slice */ 81162306a36Sopenharmony_ci 81262306a36Sopenharmony_ci/* 81362306a36Sopenharmony_ci * DCU frame prefetch control register 81462306a36Sopenharmony_ci */ 81562306a36Sopenharmony_ci#define AR5K_DCU_FP 0x1230 /* Register Address */ 81662306a36Sopenharmony_ci#define AR5K_DCU_FP_NOBURST_DCU_EN 0x00000001 /* Enable non-burst prefetch on DCU (?) */ 81762306a36Sopenharmony_ci#define AR5K_DCU_FP_NOBURST_EN 0x00000010 /* Enable non-burst prefetch (?) */ 81862306a36Sopenharmony_ci#define AR5K_DCU_FP_BURST_DCU_EN 0x00000020 /* Enable burst prefetch on DCU (?) */ 81962306a36Sopenharmony_ci 82062306a36Sopenharmony_ci/* 82162306a36Sopenharmony_ci * DCU transmit pause control/status register 82262306a36Sopenharmony_ci */ 82362306a36Sopenharmony_ci#define AR5K_DCU_TXP 0x1270 /* Register Address */ 82462306a36Sopenharmony_ci#define AR5K_DCU_TXP_M 0x000003ff /* Tx pause mask */ 82562306a36Sopenharmony_ci#define AR5K_DCU_TXP_STATUS 0x00010000 /* Tx pause status */ 82662306a36Sopenharmony_ci 82762306a36Sopenharmony_ci/* 82862306a36Sopenharmony_ci * DCU transmit filter table 0 (32 entries) 82962306a36Sopenharmony_ci * each entry contains a 32bit slice of the 83062306a36Sopenharmony_ci * 128bit tx filter for each DCU (4 slices per DCU) 83162306a36Sopenharmony_ci */ 83262306a36Sopenharmony_ci#define AR5K_DCU_TX_FILTER_0_BASE 0x1038 83362306a36Sopenharmony_ci#define AR5K_DCU_TX_FILTER_0(_n) (AR5K_DCU_TX_FILTER_0_BASE + (_n * 64)) 83462306a36Sopenharmony_ci 83562306a36Sopenharmony_ci/* 83662306a36Sopenharmony_ci * DCU transmit filter table 1 (16 entries) 83762306a36Sopenharmony_ci */ 83862306a36Sopenharmony_ci#define AR5K_DCU_TX_FILTER_1_BASE 0x103c 83962306a36Sopenharmony_ci#define AR5K_DCU_TX_FILTER_1(_n) (AR5K_DCU_TX_FILTER_1_BASE + (_n * 64)) 84062306a36Sopenharmony_ci 84162306a36Sopenharmony_ci/* 84262306a36Sopenharmony_ci * DCU clear transmit filter register 84362306a36Sopenharmony_ci */ 84462306a36Sopenharmony_ci#define AR5K_DCU_TX_FILTER_CLR 0x143c 84562306a36Sopenharmony_ci 84662306a36Sopenharmony_ci/* 84762306a36Sopenharmony_ci * DCU set transmit filter register 84862306a36Sopenharmony_ci */ 84962306a36Sopenharmony_ci#define AR5K_DCU_TX_FILTER_SET 0x147c 85062306a36Sopenharmony_ci 85162306a36Sopenharmony_ci/* 85262306a36Sopenharmony_ci * Reset control register 85362306a36Sopenharmony_ci */ 85462306a36Sopenharmony_ci#define AR5K_RESET_CTL 0x4000 /* Register Address */ 85562306a36Sopenharmony_ci#define AR5K_RESET_CTL_PCU 0x00000001 /* Protocol Control Unit reset */ 85662306a36Sopenharmony_ci#define AR5K_RESET_CTL_DMA 0x00000002 /* DMA (Rx/Tx) reset [5210] */ 85762306a36Sopenharmony_ci#define AR5K_RESET_CTL_BASEBAND 0x00000002 /* Baseband reset [5211+] */ 85862306a36Sopenharmony_ci#define AR5K_RESET_CTL_MAC 0x00000004 /* MAC reset (PCU+Baseband ?) [5210] */ 85962306a36Sopenharmony_ci#define AR5K_RESET_CTL_PHY 0x00000008 /* PHY reset [5210] */ 86062306a36Sopenharmony_ci#define AR5K_RESET_CTL_PCI 0x00000010 /* PCI Core reset (interrupts etc) */ 86162306a36Sopenharmony_ci 86262306a36Sopenharmony_ci/* 86362306a36Sopenharmony_ci * Sleep control register 86462306a36Sopenharmony_ci */ 86562306a36Sopenharmony_ci#define AR5K_SLEEP_CTL 0x4004 /* Register Address */ 86662306a36Sopenharmony_ci#define AR5K_SLEEP_CTL_SLDUR 0x0000ffff /* Sleep duration mask */ 86762306a36Sopenharmony_ci#define AR5K_SLEEP_CTL_SLDUR_S 0 86862306a36Sopenharmony_ci#define AR5K_SLEEP_CTL_SLE 0x00030000 /* Sleep enable mask */ 86962306a36Sopenharmony_ci#define AR5K_SLEEP_CTL_SLE_S 16 87062306a36Sopenharmony_ci#define AR5K_SLEEP_CTL_SLE_WAKE 0x00000000 /* Force chip awake */ 87162306a36Sopenharmony_ci#define AR5K_SLEEP_CTL_SLE_SLP 0x00010000 /* Force chip sleep */ 87262306a36Sopenharmony_ci#define AR5K_SLEEP_CTL_SLE_ALLOW 0x00020000 /* Normal sleep policy */ 87362306a36Sopenharmony_ci#define AR5K_SLEEP_CTL_SLE_UNITS 0x00000008 /* [5211+] */ 87462306a36Sopenharmony_ci#define AR5K_SLEEP_CTL_DUR_TIM_POL 0x00040000 /* Sleep duration timing policy */ 87562306a36Sopenharmony_ci#define AR5K_SLEEP_CTL_DUR_WRITE_POL 0x00080000 /* Sleep duration write policy */ 87662306a36Sopenharmony_ci#define AR5K_SLEEP_CTL_SLE_POL 0x00100000 /* Sleep policy mode */ 87762306a36Sopenharmony_ci 87862306a36Sopenharmony_ci/* 87962306a36Sopenharmony_ci * Interrupt pending register 88062306a36Sopenharmony_ci */ 88162306a36Sopenharmony_ci#define AR5K_INTPEND 0x4008 88262306a36Sopenharmony_ci#define AR5K_INTPEND_M 0x00000001 88362306a36Sopenharmony_ci 88462306a36Sopenharmony_ci/* 88562306a36Sopenharmony_ci * Sleep force register 88662306a36Sopenharmony_ci */ 88762306a36Sopenharmony_ci#define AR5K_SFR 0x400c 88862306a36Sopenharmony_ci#define AR5K_SFR_EN 0x00000001 88962306a36Sopenharmony_ci 89062306a36Sopenharmony_ci/* 89162306a36Sopenharmony_ci * PCI configuration register 89262306a36Sopenharmony_ci * TODO: Fix LED stuff 89362306a36Sopenharmony_ci */ 89462306a36Sopenharmony_ci#define AR5K_PCICFG 0x4010 /* Register Address */ 89562306a36Sopenharmony_ci#define AR5K_PCICFG_EEAE 0x00000001 /* Eeprom access enable [5210] */ 89662306a36Sopenharmony_ci#define AR5K_PCICFG_SLEEP_CLOCK_EN 0x00000002 /* Enable sleep clock */ 89762306a36Sopenharmony_ci#define AR5K_PCICFG_CLKRUNEN 0x00000004 /* CLKRUN enable [5211+] */ 89862306a36Sopenharmony_ci#define AR5K_PCICFG_EESIZE 0x00000018 /* Mask for EEPROM size [5211+] */ 89962306a36Sopenharmony_ci#define AR5K_PCICFG_EESIZE_S 3 90062306a36Sopenharmony_ci#define AR5K_PCICFG_EESIZE_4K 0 /* 4K */ 90162306a36Sopenharmony_ci#define AR5K_PCICFG_EESIZE_8K 1 /* 8K */ 90262306a36Sopenharmony_ci#define AR5K_PCICFG_EESIZE_16K 2 /* 16K */ 90362306a36Sopenharmony_ci#define AR5K_PCICFG_EESIZE_FAIL 3 /* Failed to get size [5211+] */ 90462306a36Sopenharmony_ci#define AR5K_PCICFG_LED 0x00000060 /* Led status [5211+] */ 90562306a36Sopenharmony_ci#define AR5K_PCICFG_LED_NONE 0x00000000 /* Default [5211+] */ 90662306a36Sopenharmony_ci#define AR5K_PCICFG_LED_PEND 0x00000020 /* Scan / Auth pending */ 90762306a36Sopenharmony_ci#define AR5K_PCICFG_LED_ASSOC 0x00000040 /* Associated */ 90862306a36Sopenharmony_ci#define AR5K_PCICFG_BUS_SEL 0x00000380 /* Mask for "bus select" [5211+] (?) */ 90962306a36Sopenharmony_ci#define AR5K_PCICFG_CBEFIX_DIS 0x00000400 /* Disable CBE fix */ 91062306a36Sopenharmony_ci#define AR5K_PCICFG_SL_INTEN 0x00000800 /* Enable interrupts when asleep */ 91162306a36Sopenharmony_ci#define AR5K_PCICFG_LED_BCTL 0x00001000 /* Led blink (?) [5210] */ 91262306a36Sopenharmony_ci#define AR5K_PCICFG_RETRY_FIX 0x00001000 /* Enable pci core retry fix */ 91362306a36Sopenharmony_ci#define AR5K_PCICFG_SL_INPEN 0x00002000 /* Sleep even with pending interrupts*/ 91462306a36Sopenharmony_ci#define AR5K_PCICFG_SPWR_DN 0x00010000 /* Mask for power status */ 91562306a36Sopenharmony_ci#define AR5K_PCICFG_LEDMODE 0x000e0000 /* Ledmode [5211+] */ 91662306a36Sopenharmony_ci#define AR5K_PCICFG_LEDMODE_PROP 0x00000000 /* Blink on standard traffic [5211+] */ 91762306a36Sopenharmony_ci#define AR5K_PCICFG_LEDMODE_PROM 0x00020000 /* Default mode (blink on any traffic) [5211+] */ 91862306a36Sopenharmony_ci#define AR5K_PCICFG_LEDMODE_PWR 0x00040000 /* Some other blinking mode (?) [5211+] */ 91962306a36Sopenharmony_ci#define AR5K_PCICFG_LEDMODE_RAND 0x00060000 /* Random blinking (?) [5211+] */ 92062306a36Sopenharmony_ci#define AR5K_PCICFG_LEDBLINK 0x00700000 /* Led blink rate */ 92162306a36Sopenharmony_ci#define AR5K_PCICFG_LEDBLINK_S 20 92262306a36Sopenharmony_ci#define AR5K_PCICFG_LEDSLOW 0x00800000 /* Slowest led blink rate [5211+] */ 92362306a36Sopenharmony_ci#define AR5K_PCICFG_LEDSTATE \ 92462306a36Sopenharmony_ci (AR5K_PCICFG_LED | AR5K_PCICFG_LEDMODE | \ 92562306a36Sopenharmony_ci AR5K_PCICFG_LEDBLINK | AR5K_PCICFG_LEDSLOW) 92662306a36Sopenharmony_ci#define AR5K_PCICFG_SLEEP_CLOCK_RATE 0x03000000 /* Sleep clock rate */ 92762306a36Sopenharmony_ci#define AR5K_PCICFG_SLEEP_CLOCK_RATE_S 24 92862306a36Sopenharmony_ci 92962306a36Sopenharmony_ci/* 93062306a36Sopenharmony_ci * "General Purpose Input/Output" (GPIO) control register 93162306a36Sopenharmony_ci * 93262306a36Sopenharmony_ci * I'm not sure about this but after looking at the code 93362306a36Sopenharmony_ci * for all chipsets here is what i got. 93462306a36Sopenharmony_ci * 93562306a36Sopenharmony_ci * We have 6 GPIOs (pins), each GPIO has 4 modes (2 bits) 93662306a36Sopenharmony_ci * Mode 0 -> always input 93762306a36Sopenharmony_ci * Mode 1 -> output when GPIODO for this GPIO is set to 0 93862306a36Sopenharmony_ci * Mode 2 -> output when GPIODO for this GPIO is set to 1 93962306a36Sopenharmony_ci * Mode 3 -> always output 94062306a36Sopenharmony_ci * 94162306a36Sopenharmony_ci * For more infos check out get_gpio/set_gpio and 94262306a36Sopenharmony_ci * set_gpio_input/set_gpio_output functs. 94362306a36Sopenharmony_ci * For more infos on gpio interrupt check out set_gpio_intr. 94462306a36Sopenharmony_ci */ 94562306a36Sopenharmony_ci#define AR5K_NUM_GPIO 6 94662306a36Sopenharmony_ci 94762306a36Sopenharmony_ci#define AR5K_GPIOCR 0x4014 /* Register Address */ 94862306a36Sopenharmony_ci#define AR5K_GPIOCR_INT_ENA 0x00008000 /* Enable GPIO interrupt */ 94962306a36Sopenharmony_ci#define AR5K_GPIOCR_INT_SELL 0x00000000 /* Generate interrupt when pin is low */ 95062306a36Sopenharmony_ci#define AR5K_GPIOCR_INT_SELH 0x00010000 /* Generate interrupt when pin is high */ 95162306a36Sopenharmony_ci#define AR5K_GPIOCR_IN(n) (0 << ((n) * 2)) /* Mode 0 for pin n */ 95262306a36Sopenharmony_ci#define AR5K_GPIOCR_OUT0(n) (1 << ((n) * 2)) /* Mode 1 for pin n */ 95362306a36Sopenharmony_ci#define AR5K_GPIOCR_OUT1(n) (2 << ((n) * 2)) /* Mode 2 for pin n */ 95462306a36Sopenharmony_ci#define AR5K_GPIOCR_OUT(n) (3 << ((n) * 2)) /* Mode 3 for pin n */ 95562306a36Sopenharmony_ci#define AR5K_GPIOCR_INT_SEL(n) ((n) << 12) /* Interrupt for GPIO pin n */ 95662306a36Sopenharmony_ci 95762306a36Sopenharmony_ci/* 95862306a36Sopenharmony_ci * "General Purpose Input/Output" (GPIO) data output register 95962306a36Sopenharmony_ci */ 96062306a36Sopenharmony_ci#define AR5K_GPIODO 0x4018 96162306a36Sopenharmony_ci 96262306a36Sopenharmony_ci/* 96362306a36Sopenharmony_ci * "General Purpose Input/Output" (GPIO) data input register 96462306a36Sopenharmony_ci */ 96562306a36Sopenharmony_ci#define AR5K_GPIODI 0x401c 96662306a36Sopenharmony_ci#define AR5K_GPIODI_M 0x0000002f 96762306a36Sopenharmony_ci 96862306a36Sopenharmony_ci/* 96962306a36Sopenharmony_ci * Silicon revision register 97062306a36Sopenharmony_ci */ 97162306a36Sopenharmony_ci#define AR5K_SREV 0x4020 /* Register Address */ 97262306a36Sopenharmony_ci#define AR5K_SREV_REV 0x0000000f /* Mask for revision */ 97362306a36Sopenharmony_ci#define AR5K_SREV_REV_S 0 97462306a36Sopenharmony_ci#define AR5K_SREV_VER 0x000000ff /* Mask for version */ 97562306a36Sopenharmony_ci#define AR5K_SREV_VER_S 4 97662306a36Sopenharmony_ci 97762306a36Sopenharmony_ci/* 97862306a36Sopenharmony_ci * TXE write posting register 97962306a36Sopenharmony_ci */ 98062306a36Sopenharmony_ci#define AR5K_TXEPOST 0x4028 98162306a36Sopenharmony_ci 98262306a36Sopenharmony_ci/* 98362306a36Sopenharmony_ci * QCU sleep mask 98462306a36Sopenharmony_ci */ 98562306a36Sopenharmony_ci#define AR5K_QCU_SLEEP_MASK 0x402c 98662306a36Sopenharmony_ci 98762306a36Sopenharmony_ci/* 0x4068 is compression buffer configuration 98862306a36Sopenharmony_ci * register on 5414 and pm configuration register 98962306a36Sopenharmony_ci * on 5424 and newer pci-e chips. */ 99062306a36Sopenharmony_ci 99162306a36Sopenharmony_ci/* 99262306a36Sopenharmony_ci * Compression buffer configuration 99362306a36Sopenharmony_ci * register (enable/disable) [5414] 99462306a36Sopenharmony_ci */ 99562306a36Sopenharmony_ci#define AR5K_5414_CBCFG 0x4068 99662306a36Sopenharmony_ci#define AR5K_5414_CBCFG_BUF_DIS 0x10 /* Disable buffer */ 99762306a36Sopenharmony_ci 99862306a36Sopenharmony_ci/* 99962306a36Sopenharmony_ci * PCI-E Power management configuration 100062306a36Sopenharmony_ci * and status register [5424+] 100162306a36Sopenharmony_ci */ 100262306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL 0x4068 /* Register address */ 100362306a36Sopenharmony_ci/* Only 5424 */ 100462306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL_L1_WHEN_D2 0x00000001 /* enable PCIe core enter L1 100562306a36Sopenharmony_ci when d2_sleep_en is asserted */ 100662306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL_L0_L0S_CLEAR 0x00000002 /* Clear L0 and L0S counters */ 100762306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL_L0_L0S_EN 0x00000004 /* Start L0 nd L0S counters */ 100862306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL_LDRESET_EN 0x00000008 /* Enable reset when link goes 100962306a36Sopenharmony_ci down */ 101062306a36Sopenharmony_ci/* Wake On Wireless */ 101162306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL_PME_EN 0x00000010 /* PME Enable */ 101262306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL_AUX_PWR_DET 0x00000020 /* Aux power detect */ 101362306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL_PME_CLEAR 0x00000040 /* Clear PME */ 101462306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL_PSM_D0 0x00000080 101562306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL_PSM_D1 0x00000100 101662306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL_PSM_D2 0x00000200 101762306a36Sopenharmony_ci#define AR5K_PCIE_PM_CTL_PSM_D3 0x00000400 101862306a36Sopenharmony_ci 101962306a36Sopenharmony_ci/* 102062306a36Sopenharmony_ci * PCI-E Workaround enable register 102162306a36Sopenharmony_ci */ 102262306a36Sopenharmony_ci#define AR5K_PCIE_WAEN 0x407c 102362306a36Sopenharmony_ci 102462306a36Sopenharmony_ci/* 102562306a36Sopenharmony_ci * PCI-E Serializer/Deserializer 102662306a36Sopenharmony_ci * registers 102762306a36Sopenharmony_ci */ 102862306a36Sopenharmony_ci#define AR5K_PCIE_SERDES 0x4080 102962306a36Sopenharmony_ci#define AR5K_PCIE_SERDES_RESET 0x4084 103062306a36Sopenharmony_ci 103162306a36Sopenharmony_ci/*====EEPROM REGISTERS====*/ 103262306a36Sopenharmony_ci 103362306a36Sopenharmony_ci/* 103462306a36Sopenharmony_ci * EEPROM access registers 103562306a36Sopenharmony_ci * 103662306a36Sopenharmony_ci * Here we got a difference between 5210/5211-12 103762306a36Sopenharmony_ci * read data register for 5210 is at 0x6800 and 103862306a36Sopenharmony_ci * status register is at 0x6c00. There is also 103962306a36Sopenharmony_ci * no eeprom command register on 5210 and the 104062306a36Sopenharmony_ci * offsets are different. 104162306a36Sopenharmony_ci * 104262306a36Sopenharmony_ci * To read eeprom data for a specific offset: 104362306a36Sopenharmony_ci * 5210 - enable eeprom access (AR5K_PCICFG_EEAE) 104462306a36Sopenharmony_ci * read AR5K_EEPROM_BASE +(4 * offset) 104562306a36Sopenharmony_ci * check the eeprom status register 104662306a36Sopenharmony_ci * and read eeprom data register. 104762306a36Sopenharmony_ci * 104862306a36Sopenharmony_ci * 5211 - write offset to AR5K_EEPROM_BASE 104962306a36Sopenharmony_ci * 5212 write AR5K_EEPROM_CMD_READ on AR5K_EEPROM_CMD 105062306a36Sopenharmony_ci * check the eeprom status register 105162306a36Sopenharmony_ci * and read eeprom data register. 105262306a36Sopenharmony_ci * 105362306a36Sopenharmony_ci * To write eeprom data for a specific offset: 105462306a36Sopenharmony_ci * 5210 - enable eeprom access (AR5K_PCICFG_EEAE) 105562306a36Sopenharmony_ci * write data to AR5K_EEPROM_BASE +(4 * offset) 105662306a36Sopenharmony_ci * check the eeprom status register 105762306a36Sopenharmony_ci * 5211 - write AR5K_EEPROM_CMD_RESET on AR5K_EEPROM_CMD 105862306a36Sopenharmony_ci * 5212 write offset to AR5K_EEPROM_BASE 105962306a36Sopenharmony_ci * write data to data register 106062306a36Sopenharmony_ci * write AR5K_EEPROM_CMD_WRITE on AR5K_EEPROM_CMD 106162306a36Sopenharmony_ci * check the eeprom status register 106262306a36Sopenharmony_ci * 106362306a36Sopenharmony_ci * For more infos check eeprom_* functs and the ar5k.c 106462306a36Sopenharmony_ci * file posted in madwifi-devel mailing list. 106562306a36Sopenharmony_ci * http://sourceforge.net/mailarchive/message.php?msg_id=8966525 106662306a36Sopenharmony_ci * 106762306a36Sopenharmony_ci */ 106862306a36Sopenharmony_ci#define AR5K_EEPROM_BASE 0x6000 106962306a36Sopenharmony_ci 107062306a36Sopenharmony_ci/* 107162306a36Sopenharmony_ci * EEPROM data register 107262306a36Sopenharmony_ci */ 107362306a36Sopenharmony_ci#define AR5K_EEPROM_DATA_5211 0x6004 107462306a36Sopenharmony_ci#define AR5K_EEPROM_DATA_5210 0x6800 107562306a36Sopenharmony_ci#define AR5K_EEPROM_DATA (ah->ah_version == AR5K_AR5210 ? \ 107662306a36Sopenharmony_ci AR5K_EEPROM_DATA_5210 : AR5K_EEPROM_DATA_5211) 107762306a36Sopenharmony_ci 107862306a36Sopenharmony_ci/* 107962306a36Sopenharmony_ci * EEPROM command register 108062306a36Sopenharmony_ci */ 108162306a36Sopenharmony_ci#define AR5K_EEPROM_CMD 0x6008 /* Register Address */ 108262306a36Sopenharmony_ci#define AR5K_EEPROM_CMD_READ 0x00000001 /* EEPROM read */ 108362306a36Sopenharmony_ci#define AR5K_EEPROM_CMD_WRITE 0x00000002 /* EEPROM write */ 108462306a36Sopenharmony_ci#define AR5K_EEPROM_CMD_RESET 0x00000004 /* EEPROM reset */ 108562306a36Sopenharmony_ci 108662306a36Sopenharmony_ci/* 108762306a36Sopenharmony_ci * EEPROM status register 108862306a36Sopenharmony_ci */ 108962306a36Sopenharmony_ci#define AR5K_EEPROM_STAT_5210 0x6c00 /* Register Address [5210] */ 109062306a36Sopenharmony_ci#define AR5K_EEPROM_STAT_5211 0x600c /* Register Address [5211+] */ 109162306a36Sopenharmony_ci#define AR5K_EEPROM_STATUS (ah->ah_version == AR5K_AR5210 ? \ 109262306a36Sopenharmony_ci AR5K_EEPROM_STAT_5210 : AR5K_EEPROM_STAT_5211) 109362306a36Sopenharmony_ci#define AR5K_EEPROM_STAT_RDERR 0x00000001 /* EEPROM read failed */ 109462306a36Sopenharmony_ci#define AR5K_EEPROM_STAT_RDDONE 0x00000002 /* EEPROM read successful */ 109562306a36Sopenharmony_ci#define AR5K_EEPROM_STAT_WRERR 0x00000004 /* EEPROM write failed */ 109662306a36Sopenharmony_ci#define AR5K_EEPROM_STAT_WRDONE 0x00000008 /* EEPROM write successful */ 109762306a36Sopenharmony_ci 109862306a36Sopenharmony_ci/* 109962306a36Sopenharmony_ci * EEPROM config register 110062306a36Sopenharmony_ci */ 110162306a36Sopenharmony_ci#define AR5K_EEPROM_CFG 0x6010 /* Register Address */ 110262306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_SIZE 0x00000003 /* Size determination override */ 110362306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_SIZE_AUTO 0 110462306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_SIZE_4KBIT 1 110562306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_SIZE_8KBIT 2 110662306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_SIZE_16KBIT 3 110762306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_WR_WAIT_DIS 0x00000004 /* Disable write wait */ 110862306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_CLK_RATE 0x00000018 /* Clock rate */ 110962306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_CLK_RATE_S 3 111062306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_CLK_RATE_156KHZ 0 111162306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_CLK_RATE_312KHZ 1 111262306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_CLK_RATE_625KHZ 2 111362306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_PROT_KEY 0x00ffff00 /* Protection key */ 111462306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_PROT_KEY_S 8 111562306a36Sopenharmony_ci#define AR5K_EEPROM_CFG_LIND_EN 0x01000000 /* Enable length indicator (?) */ 111662306a36Sopenharmony_ci 111762306a36Sopenharmony_ci 111862306a36Sopenharmony_ci/* 111962306a36Sopenharmony_ci * TODO: Wake On Wireless registers 112062306a36Sopenharmony_ci * Range 0x7000 - 0x7ce0 112162306a36Sopenharmony_ci */ 112262306a36Sopenharmony_ci 112362306a36Sopenharmony_ci/* 112462306a36Sopenharmony_ci * Protocol Control Unit (PCU) registers 112562306a36Sopenharmony_ci */ 112662306a36Sopenharmony_ci/* 112762306a36Sopenharmony_ci * Used for checking initial register writes 112862306a36Sopenharmony_ci * during channel reset (see reset func) 112962306a36Sopenharmony_ci */ 113062306a36Sopenharmony_ci#define AR5K_PCU_MIN 0x8000 113162306a36Sopenharmony_ci#define AR5K_PCU_MAX 0x8fff 113262306a36Sopenharmony_ci 113362306a36Sopenharmony_ci/* 113462306a36Sopenharmony_ci * First station id register (Lower 32 bits of MAC address) 113562306a36Sopenharmony_ci */ 113662306a36Sopenharmony_ci#define AR5K_STA_ID0 0x8000 113762306a36Sopenharmony_ci#define AR5K_STA_ID0_ARRD_L32 0xffffffff 113862306a36Sopenharmony_ci 113962306a36Sopenharmony_ci/* 114062306a36Sopenharmony_ci * Second station id register (Upper 16 bits of MAC address + PCU settings) 114162306a36Sopenharmony_ci */ 114262306a36Sopenharmony_ci#define AR5K_STA_ID1 0x8004 /* Register Address */ 114362306a36Sopenharmony_ci#define AR5K_STA_ID1_ADDR_U16 0x0000ffff /* Upper 16 bits of MAC address */ 114462306a36Sopenharmony_ci#define AR5K_STA_ID1_AP 0x00010000 /* Set AP mode */ 114562306a36Sopenharmony_ci#define AR5K_STA_ID1_ADHOC 0x00020000 /* Set Ad-Hoc mode */ 114662306a36Sopenharmony_ci#define AR5K_STA_ID1_PWR_SV 0x00040000 /* Power save reporting */ 114762306a36Sopenharmony_ci#define AR5K_STA_ID1_NO_KEYSRCH 0x00080000 /* No key search */ 114862306a36Sopenharmony_ci#define AR5K_STA_ID1_NO_PSPOLL 0x00100000 /* No power save polling [5210] */ 114962306a36Sopenharmony_ci#define AR5K_STA_ID1_PCF_5211 0x00100000 /* Enable PCF on [5211+] */ 115062306a36Sopenharmony_ci#define AR5K_STA_ID1_PCF_5210 0x00200000 /* Enable PCF on [5210]*/ 115162306a36Sopenharmony_ci#define AR5K_STA_ID1_PCF (ah->ah_version == AR5K_AR5210 ? \ 115262306a36Sopenharmony_ci AR5K_STA_ID1_PCF_5210 : AR5K_STA_ID1_PCF_5211) 115362306a36Sopenharmony_ci#define AR5K_STA_ID1_DEFAULT_ANTENNA 0x00200000 /* Use default antenna */ 115462306a36Sopenharmony_ci#define AR5K_STA_ID1_DESC_ANTENNA 0x00400000 /* Update antenna from descriptor */ 115562306a36Sopenharmony_ci#define AR5K_STA_ID1_RTS_DEF_ANTENNA 0x00800000 /* Use default antenna for RTS */ 115662306a36Sopenharmony_ci#define AR5K_STA_ID1_ACKCTS_6MB 0x01000000 /* Rate to use for ACK/CTS. 0: highest mandatory rate <= RX rate; 1: 1Mbps in B mode */ 115762306a36Sopenharmony_ci#define AR5K_STA_ID1_BASE_RATE_11B 0x02000000 /* 802.11b base rate. 0: 1, 2, 5.5 and 11Mbps; 1: 1 and 2Mbps. [5211+] */ 115862306a36Sopenharmony_ci#define AR5K_STA_ID1_SELFGEN_DEF_ANT 0x04000000 /* Use def. antenna for self generated frames */ 115962306a36Sopenharmony_ci#define AR5K_STA_ID1_CRYPT_MIC_EN 0x08000000 /* Enable MIC */ 116062306a36Sopenharmony_ci#define AR5K_STA_ID1_KEYSRCH_MODE 0x10000000 /* Look up key when key id != 0 */ 116162306a36Sopenharmony_ci#define AR5K_STA_ID1_PRESERVE_SEQ_NUM 0x20000000 /* Preserve sequence number */ 116262306a36Sopenharmony_ci#define AR5K_STA_ID1_CBCIV_ENDIAN 0x40000000 /* ??? */ 116362306a36Sopenharmony_ci#define AR5K_STA_ID1_KEYSRCH_MCAST 0x80000000 /* Do key cache search for mcast frames */ 116462306a36Sopenharmony_ci 116562306a36Sopenharmony_ci#define AR5K_STA_ID1_ANTENNA_SETTINGS (AR5K_STA_ID1_DEFAULT_ANTENNA | \ 116662306a36Sopenharmony_ci AR5K_STA_ID1_DESC_ANTENNA | \ 116762306a36Sopenharmony_ci AR5K_STA_ID1_RTS_DEF_ANTENNA | \ 116862306a36Sopenharmony_ci AR5K_STA_ID1_SELFGEN_DEF_ANT) 116962306a36Sopenharmony_ci 117062306a36Sopenharmony_ci/* 117162306a36Sopenharmony_ci * First BSSID register (MAC address, lower 32bits) 117262306a36Sopenharmony_ci */ 117362306a36Sopenharmony_ci#define AR5K_BSS_ID0 0x8008 117462306a36Sopenharmony_ci 117562306a36Sopenharmony_ci/* 117662306a36Sopenharmony_ci * Second BSSID register (MAC address in upper 16 bits) 117762306a36Sopenharmony_ci * 117862306a36Sopenharmony_ci * AID: Association ID 117962306a36Sopenharmony_ci */ 118062306a36Sopenharmony_ci#define AR5K_BSS_ID1 0x800c 118162306a36Sopenharmony_ci#define AR5K_BSS_ID1_AID 0xffff0000 118262306a36Sopenharmony_ci#define AR5K_BSS_ID1_AID_S 16 118362306a36Sopenharmony_ci 118462306a36Sopenharmony_ci/* 118562306a36Sopenharmony_ci * Backoff slot time register 118662306a36Sopenharmony_ci */ 118762306a36Sopenharmony_ci#define AR5K_SLOT_TIME 0x8010 118862306a36Sopenharmony_ci 118962306a36Sopenharmony_ci/* 119062306a36Sopenharmony_ci * ACK/CTS timeout register 119162306a36Sopenharmony_ci */ 119262306a36Sopenharmony_ci#define AR5K_TIME_OUT 0x8014 /* Register Address */ 119362306a36Sopenharmony_ci#define AR5K_TIME_OUT_ACK 0x00001fff /* ACK timeout mask */ 119462306a36Sopenharmony_ci#define AR5K_TIME_OUT_ACK_S 0 119562306a36Sopenharmony_ci#define AR5K_TIME_OUT_CTS 0x1fff0000 /* CTS timeout mask */ 119662306a36Sopenharmony_ci#define AR5K_TIME_OUT_CTS_S 16 119762306a36Sopenharmony_ci 119862306a36Sopenharmony_ci/* 119962306a36Sopenharmony_ci * RSSI threshold register 120062306a36Sopenharmony_ci */ 120162306a36Sopenharmony_ci#define AR5K_RSSI_THR 0x8018 /* Register Address */ 120262306a36Sopenharmony_ci#define AR5K_RSSI_THR_M 0x000000ff /* Mask for RSSI threshold [5211+] */ 120362306a36Sopenharmony_ci#define AR5K_RSSI_THR_BMISS_5210 0x00000700 /* Mask for Beacon Missed threshold [5210] */ 120462306a36Sopenharmony_ci#define AR5K_RSSI_THR_BMISS_5210_S 8 120562306a36Sopenharmony_ci#define AR5K_RSSI_THR_BMISS_5211 0x0000ff00 /* Mask for Beacon Missed threshold [5211+] */ 120662306a36Sopenharmony_ci#define AR5K_RSSI_THR_BMISS_5211_S 8 120762306a36Sopenharmony_ci#define AR5K_RSSI_THR_BMISS (ah->ah_version == AR5K_AR5210 ? \ 120862306a36Sopenharmony_ci AR5K_RSSI_THR_BMISS_5210 : AR5K_RSSI_THR_BMISS_5211) 120962306a36Sopenharmony_ci#define AR5K_RSSI_THR_BMISS_S 8 121062306a36Sopenharmony_ci 121162306a36Sopenharmony_ci/* 121262306a36Sopenharmony_ci * 5210 has more PCU registers because there is no QCU/DCU 121362306a36Sopenharmony_ci * so queue parameters are set here, this way a lot common 121462306a36Sopenharmony_ci * registers have different address for 5210. To make things 121562306a36Sopenharmony_ci * easier we define a macro based on ah->ah_version for common 121662306a36Sopenharmony_ci * registers with different addresses and common flags. 121762306a36Sopenharmony_ci */ 121862306a36Sopenharmony_ci 121962306a36Sopenharmony_ci/* 122062306a36Sopenharmony_ci * Retry limit register 122162306a36Sopenharmony_ci * 122262306a36Sopenharmony_ci * Retry limit register for 5210 (no QCU/DCU so it's done in PCU) 122362306a36Sopenharmony_ci */ 122462306a36Sopenharmony_ci#define AR5K_NODCU_RETRY_LMT 0x801c /* Register Address */ 122562306a36Sopenharmony_ci#define AR5K_NODCU_RETRY_LMT_SH_RETRY 0x0000000f /* Short retry limit mask */ 122662306a36Sopenharmony_ci#define AR5K_NODCU_RETRY_LMT_SH_RETRY_S 0 122762306a36Sopenharmony_ci#define AR5K_NODCU_RETRY_LMT_LG_RETRY 0x000000f0 /* Long retry mask */ 122862306a36Sopenharmony_ci#define AR5K_NODCU_RETRY_LMT_LG_RETRY_S 4 122962306a36Sopenharmony_ci#define AR5K_NODCU_RETRY_LMT_SSH_RETRY 0x00003f00 /* Station short retry limit mask */ 123062306a36Sopenharmony_ci#define AR5K_NODCU_RETRY_LMT_SSH_RETRY_S 8 123162306a36Sopenharmony_ci#define AR5K_NODCU_RETRY_LMT_SLG_RETRY 0x000fc000 /* Station long retry limit mask */ 123262306a36Sopenharmony_ci#define AR5K_NODCU_RETRY_LMT_SLG_RETRY_S 14 123362306a36Sopenharmony_ci#define AR5K_NODCU_RETRY_LMT_CW_MIN 0x3ff00000 /* Minimum contention window mask */ 123462306a36Sopenharmony_ci#define AR5K_NODCU_RETRY_LMT_CW_MIN_S 20 123562306a36Sopenharmony_ci 123662306a36Sopenharmony_ci/* 123762306a36Sopenharmony_ci * Transmit latency register 123862306a36Sopenharmony_ci */ 123962306a36Sopenharmony_ci#define AR5K_USEC_5210 0x8020 /* Register Address [5210] */ 124062306a36Sopenharmony_ci#define AR5K_USEC_5211 0x801c /* Register Address [5211+] */ 124162306a36Sopenharmony_ci#define AR5K_USEC (ah->ah_version == AR5K_AR5210 ? \ 124262306a36Sopenharmony_ci AR5K_USEC_5210 : AR5K_USEC_5211) 124362306a36Sopenharmony_ci#define AR5K_USEC_1 0x0000007f /* clock cycles for 1us */ 124462306a36Sopenharmony_ci#define AR5K_USEC_1_S 0 124562306a36Sopenharmony_ci#define AR5K_USEC_32 0x00003f80 /* clock cycles for 1us while on 32MHz clock */ 124662306a36Sopenharmony_ci#define AR5K_USEC_32_S 7 124762306a36Sopenharmony_ci#define AR5K_USEC_TX_LATENCY_5211 0x007fc000 124862306a36Sopenharmony_ci#define AR5K_USEC_TX_LATENCY_5211_S 14 124962306a36Sopenharmony_ci#define AR5K_USEC_RX_LATENCY_5211 0x1f800000 125062306a36Sopenharmony_ci#define AR5K_USEC_RX_LATENCY_5211_S 23 125162306a36Sopenharmony_ci#define AR5K_USEC_TX_LATENCY_5210 0x000fc000 /* also for 5311 */ 125262306a36Sopenharmony_ci#define AR5K_USEC_TX_LATENCY_5210_S 14 125362306a36Sopenharmony_ci#define AR5K_USEC_RX_LATENCY_5210 0x03f00000 /* also for 5311 */ 125462306a36Sopenharmony_ci#define AR5K_USEC_RX_LATENCY_5210_S 20 125562306a36Sopenharmony_ci 125662306a36Sopenharmony_ci/* 125762306a36Sopenharmony_ci * PCU beacon control register 125862306a36Sopenharmony_ci */ 125962306a36Sopenharmony_ci#define AR5K_BEACON_5210 0x8024 /*Register Address [5210] */ 126062306a36Sopenharmony_ci#define AR5K_BEACON_5211 0x8020 /*Register Address [5211+] */ 126162306a36Sopenharmony_ci#define AR5K_BEACON (ah->ah_version == AR5K_AR5210 ? \ 126262306a36Sopenharmony_ci AR5K_BEACON_5210 : AR5K_BEACON_5211) 126362306a36Sopenharmony_ci#define AR5K_BEACON_PERIOD 0x0000ffff /* Mask for beacon period */ 126462306a36Sopenharmony_ci#define AR5K_BEACON_PERIOD_S 0 126562306a36Sopenharmony_ci#define AR5K_BEACON_TIM 0x007f0000 /* Mask for TIM offset */ 126662306a36Sopenharmony_ci#define AR5K_BEACON_TIM_S 16 126762306a36Sopenharmony_ci#define AR5K_BEACON_ENABLE 0x00800000 /* Enable beacons */ 126862306a36Sopenharmony_ci#define AR5K_BEACON_RESET_TSF 0x01000000 /* Force TSF reset */ 126962306a36Sopenharmony_ci 127062306a36Sopenharmony_ci/* 127162306a36Sopenharmony_ci * CFP period register 127262306a36Sopenharmony_ci */ 127362306a36Sopenharmony_ci#define AR5K_CFP_PERIOD_5210 0x8028 127462306a36Sopenharmony_ci#define AR5K_CFP_PERIOD_5211 0x8024 127562306a36Sopenharmony_ci#define AR5K_CFP_PERIOD (ah->ah_version == AR5K_AR5210 ? \ 127662306a36Sopenharmony_ci AR5K_CFP_PERIOD_5210 : AR5K_CFP_PERIOD_5211) 127762306a36Sopenharmony_ci 127862306a36Sopenharmony_ci/* 127962306a36Sopenharmony_ci * Next beacon time register 128062306a36Sopenharmony_ci */ 128162306a36Sopenharmony_ci#define AR5K_TIMER0_5210 0x802c 128262306a36Sopenharmony_ci#define AR5K_TIMER0_5211 0x8028 128362306a36Sopenharmony_ci#define AR5K_TIMER0 (ah->ah_version == AR5K_AR5210 ? \ 128462306a36Sopenharmony_ci AR5K_TIMER0_5210 : AR5K_TIMER0_5211) 128562306a36Sopenharmony_ci 128662306a36Sopenharmony_ci/* 128762306a36Sopenharmony_ci * Next DMA beacon alert register 128862306a36Sopenharmony_ci */ 128962306a36Sopenharmony_ci#define AR5K_TIMER1_5210 0x8030 129062306a36Sopenharmony_ci#define AR5K_TIMER1_5211 0x802c 129162306a36Sopenharmony_ci#define AR5K_TIMER1 (ah->ah_version == AR5K_AR5210 ? \ 129262306a36Sopenharmony_ci AR5K_TIMER1_5210 : AR5K_TIMER1_5211) 129362306a36Sopenharmony_ci 129462306a36Sopenharmony_ci/* 129562306a36Sopenharmony_ci * Next software beacon alert register 129662306a36Sopenharmony_ci */ 129762306a36Sopenharmony_ci#define AR5K_TIMER2_5210 0x8034 129862306a36Sopenharmony_ci#define AR5K_TIMER2_5211 0x8030 129962306a36Sopenharmony_ci#define AR5K_TIMER2 (ah->ah_version == AR5K_AR5210 ? \ 130062306a36Sopenharmony_ci AR5K_TIMER2_5210 : AR5K_TIMER2_5211) 130162306a36Sopenharmony_ci 130262306a36Sopenharmony_ci/* 130362306a36Sopenharmony_ci * Next ATIM window time register 130462306a36Sopenharmony_ci */ 130562306a36Sopenharmony_ci#define AR5K_TIMER3_5210 0x8038 130662306a36Sopenharmony_ci#define AR5K_TIMER3_5211 0x8034 130762306a36Sopenharmony_ci#define AR5K_TIMER3 (ah->ah_version == AR5K_AR5210 ? \ 130862306a36Sopenharmony_ci AR5K_TIMER3_5210 : AR5K_TIMER3_5211) 130962306a36Sopenharmony_ci 131062306a36Sopenharmony_ci 131162306a36Sopenharmony_ci/* 131262306a36Sopenharmony_ci * 5210 First inter frame spacing register (IFS) 131362306a36Sopenharmony_ci */ 131462306a36Sopenharmony_ci#define AR5K_IFS0 0x8040 131562306a36Sopenharmony_ci#define AR5K_IFS0_SIFS 0x000007ff 131662306a36Sopenharmony_ci#define AR5K_IFS0_SIFS_S 0 131762306a36Sopenharmony_ci#define AR5K_IFS0_DIFS 0x007ff800 131862306a36Sopenharmony_ci#define AR5K_IFS0_DIFS_S 11 131962306a36Sopenharmony_ci 132062306a36Sopenharmony_ci/* 132162306a36Sopenharmony_ci * 5210 Second inter frame spacing register (IFS) 132262306a36Sopenharmony_ci */ 132362306a36Sopenharmony_ci#define AR5K_IFS1 0x8044 132462306a36Sopenharmony_ci#define AR5K_IFS1_PIFS 0x00000fff 132562306a36Sopenharmony_ci#define AR5K_IFS1_PIFS_S 0 132662306a36Sopenharmony_ci#define AR5K_IFS1_EIFS 0x03fff000 132762306a36Sopenharmony_ci#define AR5K_IFS1_EIFS_S 12 132862306a36Sopenharmony_ci#define AR5K_IFS1_CS_EN 0x04000000 132962306a36Sopenharmony_ci#define AR5K_IFS1_CS_EN_S 26 133062306a36Sopenharmony_ci 133162306a36Sopenharmony_ci/* 133262306a36Sopenharmony_ci * CFP duration register 133362306a36Sopenharmony_ci */ 133462306a36Sopenharmony_ci#define AR5K_CFP_DUR_5210 0x8048 133562306a36Sopenharmony_ci#define AR5K_CFP_DUR_5211 0x8038 133662306a36Sopenharmony_ci#define AR5K_CFP_DUR (ah->ah_version == AR5K_AR5210 ? \ 133762306a36Sopenharmony_ci AR5K_CFP_DUR_5210 : AR5K_CFP_DUR_5211) 133862306a36Sopenharmony_ci 133962306a36Sopenharmony_ci/* 134062306a36Sopenharmony_ci * Receive filter register 134162306a36Sopenharmony_ci */ 134262306a36Sopenharmony_ci#define AR5K_RX_FILTER_5210 0x804c /* Register Address [5210] */ 134362306a36Sopenharmony_ci#define AR5K_RX_FILTER_5211 0x803c /* Register Address [5211+] */ 134462306a36Sopenharmony_ci#define AR5K_RX_FILTER (ah->ah_version == AR5K_AR5210 ? \ 134562306a36Sopenharmony_ci AR5K_RX_FILTER_5210 : AR5K_RX_FILTER_5211) 134662306a36Sopenharmony_ci#define AR5K_RX_FILTER_UCAST 0x00000001 /* Don't filter unicast frames */ 134762306a36Sopenharmony_ci#define AR5K_RX_FILTER_MCAST 0x00000002 /* Don't filter multicast frames */ 134862306a36Sopenharmony_ci#define AR5K_RX_FILTER_BCAST 0x00000004 /* Don't filter broadcast frames */ 134962306a36Sopenharmony_ci#define AR5K_RX_FILTER_CONTROL 0x00000008 /* Don't filter control frames */ 135062306a36Sopenharmony_ci#define AR5K_RX_FILTER_BEACON 0x00000010 /* Don't filter beacon frames */ 135162306a36Sopenharmony_ci#define AR5K_RX_FILTER_PROM 0x00000020 /* Set promiscuous mode */ 135262306a36Sopenharmony_ci#define AR5K_RX_FILTER_XRPOLL 0x00000040 /* Don't filter XR poll frame [5212+] */ 135362306a36Sopenharmony_ci#define AR5K_RX_FILTER_PROBEREQ 0x00000080 /* Don't filter probe requests [5212+] */ 135462306a36Sopenharmony_ci#define AR5K_RX_FILTER_PHYERR_5212 0x00000100 /* Don't filter phy errors [5212+] */ 135562306a36Sopenharmony_ci#define AR5K_RX_FILTER_RADARERR_5212 0x00000200 /* Don't filter phy radar errors [5212+] */ 135662306a36Sopenharmony_ci#define AR5K_RX_FILTER_PHYERR_5211 0x00000040 /* [5211] */ 135762306a36Sopenharmony_ci#define AR5K_RX_FILTER_RADARERR_5211 0x00000080 /* [5211] */ 135862306a36Sopenharmony_ci#define AR5K_RX_FILTER_PHYERR \ 135962306a36Sopenharmony_ci ((ah->ah_version == AR5K_AR5211 ? \ 136062306a36Sopenharmony_ci AR5K_RX_FILTER_PHYERR_5211 : AR5K_RX_FILTER_PHYERR_5212)) 136162306a36Sopenharmony_ci#define AR5K_RX_FILTER_RADARERR \ 136262306a36Sopenharmony_ci ((ah->ah_version == AR5K_AR5211 ? \ 136362306a36Sopenharmony_ci AR5K_RX_FILTER_RADARERR_5211 : AR5K_RX_FILTER_RADARERR_5212)) 136462306a36Sopenharmony_ci 136562306a36Sopenharmony_ci/* 136662306a36Sopenharmony_ci * Multicast filter register (lower 32 bits) 136762306a36Sopenharmony_ci */ 136862306a36Sopenharmony_ci#define AR5K_MCAST_FILTER0_5210 0x8050 136962306a36Sopenharmony_ci#define AR5K_MCAST_FILTER0_5211 0x8040 137062306a36Sopenharmony_ci#define AR5K_MCAST_FILTER0 (ah->ah_version == AR5K_AR5210 ? \ 137162306a36Sopenharmony_ci AR5K_MCAST_FILTER0_5210 : AR5K_MCAST_FILTER0_5211) 137262306a36Sopenharmony_ci 137362306a36Sopenharmony_ci/* 137462306a36Sopenharmony_ci * Multicast filter register (higher 16 bits) 137562306a36Sopenharmony_ci */ 137662306a36Sopenharmony_ci#define AR5K_MCAST_FILTER1_5210 0x8054 137762306a36Sopenharmony_ci#define AR5K_MCAST_FILTER1_5211 0x8044 137862306a36Sopenharmony_ci#define AR5K_MCAST_FILTER1 (ah->ah_version == AR5K_AR5210 ? \ 137962306a36Sopenharmony_ci AR5K_MCAST_FILTER1_5210 : AR5K_MCAST_FILTER1_5211) 138062306a36Sopenharmony_ci 138162306a36Sopenharmony_ci 138262306a36Sopenharmony_ci/* 138362306a36Sopenharmony_ci * Transmit mask register (lower 32 bits) [5210] 138462306a36Sopenharmony_ci */ 138562306a36Sopenharmony_ci#define AR5K_TX_MASK0 0x8058 138662306a36Sopenharmony_ci 138762306a36Sopenharmony_ci/* 138862306a36Sopenharmony_ci * Transmit mask register (higher 16 bits) [5210] 138962306a36Sopenharmony_ci */ 139062306a36Sopenharmony_ci#define AR5K_TX_MASK1 0x805c 139162306a36Sopenharmony_ci 139262306a36Sopenharmony_ci/* 139362306a36Sopenharmony_ci * Clear transmit mask [5210] 139462306a36Sopenharmony_ci */ 139562306a36Sopenharmony_ci#define AR5K_CLR_TMASK 0x8060 139662306a36Sopenharmony_ci 139762306a36Sopenharmony_ci/* 139862306a36Sopenharmony_ci * Trigger level register (before transmission) [5210] 139962306a36Sopenharmony_ci */ 140062306a36Sopenharmony_ci#define AR5K_TRIG_LVL 0x8064 140162306a36Sopenharmony_ci 140262306a36Sopenharmony_ci 140362306a36Sopenharmony_ci/* 140462306a36Sopenharmony_ci * PCU Diagnostic register 140562306a36Sopenharmony_ci * 140662306a36Sopenharmony_ci * Used for tweaking/diagnostics. 140762306a36Sopenharmony_ci */ 140862306a36Sopenharmony_ci#define AR5K_DIAG_SW_5210 0x8068 /* Register Address [5210] */ 140962306a36Sopenharmony_ci#define AR5K_DIAG_SW_5211 0x8048 /* Register Address [5211+] */ 141062306a36Sopenharmony_ci#define AR5K_DIAG_SW (ah->ah_version == AR5K_AR5210 ? \ 141162306a36Sopenharmony_ci AR5K_DIAG_SW_5210 : AR5K_DIAG_SW_5211) 141262306a36Sopenharmony_ci#define AR5K_DIAG_SW_DIS_WEP_ACK 0x00000001 /* Disable ACKs if WEP key is invalid */ 141362306a36Sopenharmony_ci#define AR5K_DIAG_SW_DIS_ACK 0x00000002 /* Disable ACKs */ 141462306a36Sopenharmony_ci#define AR5K_DIAG_SW_DIS_CTS 0x00000004 /* Disable CTSs */ 141562306a36Sopenharmony_ci#define AR5K_DIAG_SW_DIS_ENC 0x00000008 /* Disable HW encryption */ 141662306a36Sopenharmony_ci#define AR5K_DIAG_SW_DIS_DEC 0x00000010 /* Disable HW decryption */ 141762306a36Sopenharmony_ci#define AR5K_DIAG_SW_DIS_TX_5210 0x00000020 /* Disable transmit [5210] */ 141862306a36Sopenharmony_ci#define AR5K_DIAG_SW_DIS_RX_5210 0x00000040 /* Disable receive */ 141962306a36Sopenharmony_ci#define AR5K_DIAG_SW_DIS_RX_5211 0x00000020 142062306a36Sopenharmony_ci#define AR5K_DIAG_SW_DIS_RX (ah->ah_version == AR5K_AR5210 ? \ 142162306a36Sopenharmony_ci AR5K_DIAG_SW_DIS_RX_5210 : AR5K_DIAG_SW_DIS_RX_5211) 142262306a36Sopenharmony_ci#define AR5K_DIAG_SW_LOOP_BACK_5210 0x00000080 /* TX Data Loopback (i guess it goes with DIS_TX) [5210] */ 142362306a36Sopenharmony_ci#define AR5K_DIAG_SW_LOOP_BACK_5211 0x00000040 142462306a36Sopenharmony_ci#define AR5K_DIAG_SW_LOOP_BACK (ah->ah_version == AR5K_AR5210 ? \ 142562306a36Sopenharmony_ci AR5K_DIAG_SW_LOOP_BACK_5210 : AR5K_DIAG_SW_LOOP_BACK_5211) 142662306a36Sopenharmony_ci#define AR5K_DIAG_SW_CORR_FCS_5210 0x00000100 /* Generate invalid TX FCS */ 142762306a36Sopenharmony_ci#define AR5K_DIAG_SW_CORR_FCS_5211 0x00000080 142862306a36Sopenharmony_ci#define AR5K_DIAG_SW_CORR_FCS (ah->ah_version == AR5K_AR5210 ? \ 142962306a36Sopenharmony_ci AR5K_DIAG_SW_CORR_FCS_5210 : AR5K_DIAG_SW_CORR_FCS_5211) 143062306a36Sopenharmony_ci#define AR5K_DIAG_SW_CHAN_INFO_5210 0x00000200 /* Add 56 bytes of channel info before the frame data in the RX buffer */ 143162306a36Sopenharmony_ci#define AR5K_DIAG_SW_CHAN_INFO_5211 0x00000100 143262306a36Sopenharmony_ci#define AR5K_DIAG_SW_CHAN_INFO (ah->ah_version == AR5K_AR5210 ? \ 143362306a36Sopenharmony_ci AR5K_DIAG_SW_CHAN_INFO_5210 : AR5K_DIAG_SW_CHAN_INFO_5211) 143462306a36Sopenharmony_ci#define AR5K_DIAG_SW_EN_SCRAM_SEED_5210 0x00000400 /* Enable fixed scrambler seed */ 143562306a36Sopenharmony_ci#define AR5K_DIAG_SW_EN_SCRAM_SEED_5211 0x00000200 143662306a36Sopenharmony_ci#define AR5K_DIAG_SW_EN_SCRAM_SEED (ah->ah_version == AR5K_AR5210 ? \ 143762306a36Sopenharmony_ci AR5K_DIAG_SW_EN_SCRAM_SEED_5210 : AR5K_DIAG_SW_EN_SCRAM_SEED_5211) 143862306a36Sopenharmony_ci#define AR5K_DIAG_SW_ECO_ENABLE 0x00000400 /* [5211+] */ 143962306a36Sopenharmony_ci#define AR5K_DIAG_SW_SCVRAM_SEED 0x0003f800 /* [5210] */ 144062306a36Sopenharmony_ci#define AR5K_DIAG_SW_SCRAM_SEED_M 0x0001fc00 /* Scrambler seed mask */ 144162306a36Sopenharmony_ci#define AR5K_DIAG_SW_SCRAM_SEED_S 10 144262306a36Sopenharmony_ci#define AR5K_DIAG_SW_DIS_SEQ_INC_5210 0x00040000 /* Disable seqnum increment (?)[5210] */ 144362306a36Sopenharmony_ci#define AR5K_DIAG_SW_FRAME_NV0_5210 0x00080000 144462306a36Sopenharmony_ci#define AR5K_DIAG_SW_FRAME_NV0_5211 0x00020000 /* Accept frames of non-zero protocol number */ 144562306a36Sopenharmony_ci#define AR5K_DIAG_SW_FRAME_NV0 (ah->ah_version == AR5K_AR5210 ? \ 144662306a36Sopenharmony_ci AR5K_DIAG_SW_FRAME_NV0_5210 : AR5K_DIAG_SW_FRAME_NV0_5211) 144762306a36Sopenharmony_ci#define AR5K_DIAG_SW_OBSPT_M 0x000c0000 /* Observation point select (?) */ 144862306a36Sopenharmony_ci#define AR5K_DIAG_SW_OBSPT_S 18 144962306a36Sopenharmony_ci#define AR5K_DIAG_SW_RX_CLEAR_HIGH 0x00100000 /* Ignore carrier sense */ 145062306a36Sopenharmony_ci#define AR5K_DIAG_SW_IGNORE_CARR_SENSE 0x00200000 /* Ignore virtual carrier sense */ 145162306a36Sopenharmony_ci#define AR5K_DIAG_SW_CHANNEL_IDLE_HIGH 0x00400000 /* Force channel idle high */ 145262306a36Sopenharmony_ci#define AR5K_DIAG_SW_PHEAR_ME 0x00800000 /* ??? */ 145362306a36Sopenharmony_ci 145462306a36Sopenharmony_ci/* 145562306a36Sopenharmony_ci * TSF (clock) register (lower 32 bits) 145662306a36Sopenharmony_ci */ 145762306a36Sopenharmony_ci#define AR5K_TSF_L32_5210 0x806c 145862306a36Sopenharmony_ci#define AR5K_TSF_L32_5211 0x804c 145962306a36Sopenharmony_ci#define AR5K_TSF_L32 (ah->ah_version == AR5K_AR5210 ? \ 146062306a36Sopenharmony_ci AR5K_TSF_L32_5210 : AR5K_TSF_L32_5211) 146162306a36Sopenharmony_ci 146262306a36Sopenharmony_ci/* 146362306a36Sopenharmony_ci * TSF (clock) register (higher 32 bits) 146462306a36Sopenharmony_ci */ 146562306a36Sopenharmony_ci#define AR5K_TSF_U32_5210 0x8070 146662306a36Sopenharmony_ci#define AR5K_TSF_U32_5211 0x8050 146762306a36Sopenharmony_ci#define AR5K_TSF_U32 (ah->ah_version == AR5K_AR5210 ? \ 146862306a36Sopenharmony_ci AR5K_TSF_U32_5210 : AR5K_TSF_U32_5211) 146962306a36Sopenharmony_ci 147062306a36Sopenharmony_ci/* 147162306a36Sopenharmony_ci * Last beacon timestamp register (Read Only) 147262306a36Sopenharmony_ci */ 147362306a36Sopenharmony_ci#define AR5K_LAST_TSTP 0x8080 147462306a36Sopenharmony_ci 147562306a36Sopenharmony_ci/* 147662306a36Sopenharmony_ci * ADDAC test register [5211+] 147762306a36Sopenharmony_ci */ 147862306a36Sopenharmony_ci#define AR5K_ADDAC_TEST 0x8054 /* Register Address */ 147962306a36Sopenharmony_ci#define AR5K_ADDAC_TEST_TXCONT 0x00000001 /* Test continuous tx */ 148062306a36Sopenharmony_ci#define AR5K_ADDAC_TEST_TST_MODE 0x00000002 /* Test mode */ 148162306a36Sopenharmony_ci#define AR5K_ADDAC_TEST_LOOP_EN 0x00000004 /* Enable loop */ 148262306a36Sopenharmony_ci#define AR5K_ADDAC_TEST_LOOP_LEN 0x00000008 /* Loop length (field) */ 148362306a36Sopenharmony_ci#define AR5K_ADDAC_TEST_USE_U8 0x00004000 /* Use upper 8 bits */ 148462306a36Sopenharmony_ci#define AR5K_ADDAC_TEST_MSB 0x00008000 /* State of MSB */ 148562306a36Sopenharmony_ci#define AR5K_ADDAC_TEST_TRIG_SEL 0x00010000 /* Trigger select */ 148662306a36Sopenharmony_ci#define AR5K_ADDAC_TEST_TRIG_PTY 0x00020000 /* Trigger polarity */ 148762306a36Sopenharmony_ci#define AR5K_ADDAC_TEST_RXCONT 0x00040000 /* Continuous capture */ 148862306a36Sopenharmony_ci#define AR5K_ADDAC_TEST_CAPTURE 0x00080000 /* Begin capture */ 148962306a36Sopenharmony_ci#define AR5K_ADDAC_TEST_TST_ARM 0x00100000 /* ARM rx buffer for capture */ 149062306a36Sopenharmony_ci 149162306a36Sopenharmony_ci/* 149262306a36Sopenharmony_ci * Default antenna register [5211+] 149362306a36Sopenharmony_ci */ 149462306a36Sopenharmony_ci#define AR5K_DEFAULT_ANTENNA 0x8058 149562306a36Sopenharmony_ci 149662306a36Sopenharmony_ci/* 149762306a36Sopenharmony_ci * Frame control QoS mask register (?) [5211+] 149862306a36Sopenharmony_ci * (FC_QOS_MASK) 149962306a36Sopenharmony_ci */ 150062306a36Sopenharmony_ci#define AR5K_FRAME_CTL_QOSM 0x805c 150162306a36Sopenharmony_ci 150262306a36Sopenharmony_ci/* 150362306a36Sopenharmony_ci * Seq mask register (?) [5211+] 150462306a36Sopenharmony_ci */ 150562306a36Sopenharmony_ci#define AR5K_SEQ_MASK 0x8060 150662306a36Sopenharmony_ci 150762306a36Sopenharmony_ci/* 150862306a36Sopenharmony_ci * Retry count register [5210] 150962306a36Sopenharmony_ci */ 151062306a36Sopenharmony_ci#define AR5K_RETRY_CNT 0x8084 /* Register Address [5210] */ 151162306a36Sopenharmony_ci#define AR5K_RETRY_CNT_SSH 0x0000003f /* Station short retry count (?) */ 151262306a36Sopenharmony_ci#define AR5K_RETRY_CNT_SLG 0x00000fc0 /* Station long retry count (?) */ 151362306a36Sopenharmony_ci 151462306a36Sopenharmony_ci/* 151562306a36Sopenharmony_ci * Back-off status register [5210] 151662306a36Sopenharmony_ci */ 151762306a36Sopenharmony_ci#define AR5K_BACKOFF 0x8088 /* Register Address [5210] */ 151862306a36Sopenharmony_ci#define AR5K_BACKOFF_CW 0x000003ff /* Backoff Contention Window (?) */ 151962306a36Sopenharmony_ci#define AR5K_BACKOFF_CNT 0x03ff0000 /* Backoff count (?) */ 152062306a36Sopenharmony_ci 152162306a36Sopenharmony_ci 152262306a36Sopenharmony_ci 152362306a36Sopenharmony_ci/* 152462306a36Sopenharmony_ci * NAV register (current) 152562306a36Sopenharmony_ci */ 152662306a36Sopenharmony_ci#define AR5K_NAV_5210 0x808c 152762306a36Sopenharmony_ci#define AR5K_NAV_5211 0x8084 152862306a36Sopenharmony_ci#define AR5K_NAV (ah->ah_version == AR5K_AR5210 ? \ 152962306a36Sopenharmony_ci AR5K_NAV_5210 : AR5K_NAV_5211) 153062306a36Sopenharmony_ci 153162306a36Sopenharmony_ci/* 153262306a36Sopenharmony_ci * MIB counters: 153362306a36Sopenharmony_ci * 153462306a36Sopenharmony_ci * max value is 0xc000, if this is reached we get a MIB interrupt. 153562306a36Sopenharmony_ci * they can be controlled via AR5K_MIBC and are cleared on read. 153662306a36Sopenharmony_ci */ 153762306a36Sopenharmony_ci 153862306a36Sopenharmony_ci/* 153962306a36Sopenharmony_ci * RTS success (MIB counter) 154062306a36Sopenharmony_ci */ 154162306a36Sopenharmony_ci#define AR5K_RTS_OK_5210 0x8090 154262306a36Sopenharmony_ci#define AR5K_RTS_OK_5211 0x8088 154362306a36Sopenharmony_ci#define AR5K_RTS_OK (ah->ah_version == AR5K_AR5210 ? \ 154462306a36Sopenharmony_ci AR5K_RTS_OK_5210 : AR5K_RTS_OK_5211) 154562306a36Sopenharmony_ci 154662306a36Sopenharmony_ci/* 154762306a36Sopenharmony_ci * RTS failure (MIB counter) 154862306a36Sopenharmony_ci */ 154962306a36Sopenharmony_ci#define AR5K_RTS_FAIL_5210 0x8094 155062306a36Sopenharmony_ci#define AR5K_RTS_FAIL_5211 0x808c 155162306a36Sopenharmony_ci#define AR5K_RTS_FAIL (ah->ah_version == AR5K_AR5210 ? \ 155262306a36Sopenharmony_ci AR5K_RTS_FAIL_5210 : AR5K_RTS_FAIL_5211) 155362306a36Sopenharmony_ci 155462306a36Sopenharmony_ci/* 155562306a36Sopenharmony_ci * ACK failure (MIB counter) 155662306a36Sopenharmony_ci */ 155762306a36Sopenharmony_ci#define AR5K_ACK_FAIL_5210 0x8098 155862306a36Sopenharmony_ci#define AR5K_ACK_FAIL_5211 0x8090 155962306a36Sopenharmony_ci#define AR5K_ACK_FAIL (ah->ah_version == AR5K_AR5210 ? \ 156062306a36Sopenharmony_ci AR5K_ACK_FAIL_5210 : AR5K_ACK_FAIL_5211) 156162306a36Sopenharmony_ci 156262306a36Sopenharmony_ci/* 156362306a36Sopenharmony_ci * FCS failure (MIB counter) 156462306a36Sopenharmony_ci */ 156562306a36Sopenharmony_ci#define AR5K_FCS_FAIL_5210 0x809c 156662306a36Sopenharmony_ci#define AR5K_FCS_FAIL_5211 0x8094 156762306a36Sopenharmony_ci#define AR5K_FCS_FAIL (ah->ah_version == AR5K_AR5210 ? \ 156862306a36Sopenharmony_ci AR5K_FCS_FAIL_5210 : AR5K_FCS_FAIL_5211) 156962306a36Sopenharmony_ci 157062306a36Sopenharmony_ci/* 157162306a36Sopenharmony_ci * Beacon count register 157262306a36Sopenharmony_ci */ 157362306a36Sopenharmony_ci#define AR5K_BEACON_CNT_5210 0x80a0 157462306a36Sopenharmony_ci#define AR5K_BEACON_CNT_5211 0x8098 157562306a36Sopenharmony_ci#define AR5K_BEACON_CNT (ah->ah_version == AR5K_AR5210 ? \ 157662306a36Sopenharmony_ci AR5K_BEACON_CNT_5210 : AR5K_BEACON_CNT_5211) 157762306a36Sopenharmony_ci 157862306a36Sopenharmony_ci 157962306a36Sopenharmony_ci/*===5212 Specific PCU registers===*/ 158062306a36Sopenharmony_ci 158162306a36Sopenharmony_ci/* 158262306a36Sopenharmony_ci * Transmit power control register 158362306a36Sopenharmony_ci */ 158462306a36Sopenharmony_ci#define AR5K_TPC 0x80e8 158562306a36Sopenharmony_ci#define AR5K_TPC_ACK 0x0000003f /* ack frames */ 158662306a36Sopenharmony_ci#define AR5K_TPC_ACK_S 0 158762306a36Sopenharmony_ci#define AR5K_TPC_CTS 0x00003f00 /* cts frames */ 158862306a36Sopenharmony_ci#define AR5K_TPC_CTS_S 8 158962306a36Sopenharmony_ci#define AR5K_TPC_CHIRP 0x003f0000 /* chirp frames */ 159062306a36Sopenharmony_ci#define AR5K_TPC_CHIRP_S 16 159162306a36Sopenharmony_ci#define AR5K_TPC_DOPPLER 0x0f000000 /* doppler chirp span */ 159262306a36Sopenharmony_ci#define AR5K_TPC_DOPPLER_S 24 159362306a36Sopenharmony_ci 159462306a36Sopenharmony_ci/* 159562306a36Sopenharmony_ci * XR (eXtended Range) mode register 159662306a36Sopenharmony_ci */ 159762306a36Sopenharmony_ci#define AR5K_XRMODE 0x80c0 /* Register Address */ 159862306a36Sopenharmony_ci#define AR5K_XRMODE_POLL_TYPE_M 0x0000003f /* Mask for Poll type (?) */ 159962306a36Sopenharmony_ci#define AR5K_XRMODE_POLL_TYPE_S 0 160062306a36Sopenharmony_ci#define AR5K_XRMODE_POLL_SUBTYPE_M 0x0000003c /* Mask for Poll subtype (?) */ 160162306a36Sopenharmony_ci#define AR5K_XRMODE_POLL_SUBTYPE_S 2 160262306a36Sopenharmony_ci#define AR5K_XRMODE_POLL_WAIT_ALL 0x00000080 /* Wait for poll */ 160362306a36Sopenharmony_ci#define AR5K_XRMODE_SIFS_DELAY 0x000fff00 /* Mask for SIFS delay */ 160462306a36Sopenharmony_ci#define AR5K_XRMODE_FRAME_HOLD_M 0xfff00000 /* Mask for frame hold (?) */ 160562306a36Sopenharmony_ci#define AR5K_XRMODE_FRAME_HOLD_S 20 160662306a36Sopenharmony_ci 160762306a36Sopenharmony_ci/* 160862306a36Sopenharmony_ci * XR delay register 160962306a36Sopenharmony_ci */ 161062306a36Sopenharmony_ci#define AR5K_XRDELAY 0x80c4 /* Register Address */ 161162306a36Sopenharmony_ci#define AR5K_XRDELAY_SLOT_DELAY_M 0x0000ffff /* Mask for slot delay */ 161262306a36Sopenharmony_ci#define AR5K_XRDELAY_SLOT_DELAY_S 0 161362306a36Sopenharmony_ci#define AR5K_XRDELAY_CHIRP_DELAY_M 0xffff0000 /* Mask for CHIRP data delay */ 161462306a36Sopenharmony_ci#define AR5K_XRDELAY_CHIRP_DELAY_S 16 161562306a36Sopenharmony_ci 161662306a36Sopenharmony_ci/* 161762306a36Sopenharmony_ci * XR timeout register 161862306a36Sopenharmony_ci */ 161962306a36Sopenharmony_ci#define AR5K_XRTIMEOUT 0x80c8 /* Register Address */ 162062306a36Sopenharmony_ci#define AR5K_XRTIMEOUT_CHIRP_M 0x0000ffff /* Mask for CHIRP timeout */ 162162306a36Sopenharmony_ci#define AR5K_XRTIMEOUT_CHIRP_S 0 162262306a36Sopenharmony_ci#define AR5K_XRTIMEOUT_POLL_M 0xffff0000 /* Mask for Poll timeout */ 162362306a36Sopenharmony_ci#define AR5K_XRTIMEOUT_POLL_S 16 162462306a36Sopenharmony_ci 162562306a36Sopenharmony_ci/* 162662306a36Sopenharmony_ci * XR chirp register 162762306a36Sopenharmony_ci */ 162862306a36Sopenharmony_ci#define AR5K_XRCHIRP 0x80cc /* Register Address */ 162962306a36Sopenharmony_ci#define AR5K_XRCHIRP_SEND 0x00000001 /* Send CHIRP */ 163062306a36Sopenharmony_ci#define AR5K_XRCHIRP_GAP 0xffff0000 /* Mask for CHIRP gap (?) */ 163162306a36Sopenharmony_ci 163262306a36Sopenharmony_ci/* 163362306a36Sopenharmony_ci * XR stomp register 163462306a36Sopenharmony_ci */ 163562306a36Sopenharmony_ci#define AR5K_XRSTOMP 0x80d0 /* Register Address */ 163662306a36Sopenharmony_ci#define AR5K_XRSTOMP_TX 0x00000001 /* Stomp Tx (?) */ 163762306a36Sopenharmony_ci#define AR5K_XRSTOMP_RX 0x00000002 /* Stomp Rx (?) */ 163862306a36Sopenharmony_ci#define AR5K_XRSTOMP_TX_RSSI 0x00000004 /* Stomp Tx RSSI (?) */ 163962306a36Sopenharmony_ci#define AR5K_XRSTOMP_TX_BSSID 0x00000008 /* Stomp Tx BSSID (?) */ 164062306a36Sopenharmony_ci#define AR5K_XRSTOMP_DATA 0x00000010 /* Stomp data (?)*/ 164162306a36Sopenharmony_ci#define AR5K_XRSTOMP_RSSI_THRES 0x0000ff00 /* Mask for XR RSSI threshold */ 164262306a36Sopenharmony_ci 164362306a36Sopenharmony_ci/* 164462306a36Sopenharmony_ci * First enhanced sleep register 164562306a36Sopenharmony_ci */ 164662306a36Sopenharmony_ci#define AR5K_SLEEP0 0x80d4 /* Register Address */ 164762306a36Sopenharmony_ci#define AR5K_SLEEP0_NEXT_DTIM 0x0007ffff /* Mask for next DTIM (?) */ 164862306a36Sopenharmony_ci#define AR5K_SLEEP0_NEXT_DTIM_S 0 164962306a36Sopenharmony_ci#define AR5K_SLEEP0_ASSUME_DTIM 0x00080000 /* Assume DTIM */ 165062306a36Sopenharmony_ci#define AR5K_SLEEP0_ENH_SLEEP_EN 0x00100000 /* Enable enhanced sleep control */ 165162306a36Sopenharmony_ci#define AR5K_SLEEP0_CABTO 0xff000000 /* Mask for CAB Time Out */ 165262306a36Sopenharmony_ci#define AR5K_SLEEP0_CABTO_S 24 165362306a36Sopenharmony_ci 165462306a36Sopenharmony_ci/* 165562306a36Sopenharmony_ci * Second enhanced sleep register 165662306a36Sopenharmony_ci */ 165762306a36Sopenharmony_ci#define AR5K_SLEEP1 0x80d8 /* Register Address */ 165862306a36Sopenharmony_ci#define AR5K_SLEEP1_NEXT_TIM 0x0007ffff /* Mask for next TIM (?) */ 165962306a36Sopenharmony_ci#define AR5K_SLEEP1_NEXT_TIM_S 0 166062306a36Sopenharmony_ci#define AR5K_SLEEP1_BEACON_TO 0xff000000 /* Mask for Beacon Time Out */ 166162306a36Sopenharmony_ci#define AR5K_SLEEP1_BEACON_TO_S 24 166262306a36Sopenharmony_ci 166362306a36Sopenharmony_ci/* 166462306a36Sopenharmony_ci * Third enhanced sleep register 166562306a36Sopenharmony_ci */ 166662306a36Sopenharmony_ci#define AR5K_SLEEP2 0x80dc /* Register Address */ 166762306a36Sopenharmony_ci#define AR5K_SLEEP2_TIM_PER 0x0000ffff /* Mask for TIM period (?) */ 166862306a36Sopenharmony_ci#define AR5K_SLEEP2_TIM_PER_S 0 166962306a36Sopenharmony_ci#define AR5K_SLEEP2_DTIM_PER 0xffff0000 /* Mask for DTIM period (?) */ 167062306a36Sopenharmony_ci#define AR5K_SLEEP2_DTIM_PER_S 16 167162306a36Sopenharmony_ci 167262306a36Sopenharmony_ci/* 167362306a36Sopenharmony_ci * TX power control (TPC) register 167462306a36Sopenharmony_ci * 167562306a36Sopenharmony_ci * XXX: PCDAC steps (0.5dBm) or dBm ? 167662306a36Sopenharmony_ci * 167762306a36Sopenharmony_ci */ 167862306a36Sopenharmony_ci#define AR5K_TXPC 0x80e8 /* Register Address */ 167962306a36Sopenharmony_ci#define AR5K_TXPC_ACK_M 0x0000003f /* ACK tx power */ 168062306a36Sopenharmony_ci#define AR5K_TXPC_ACK_S 0 168162306a36Sopenharmony_ci#define AR5K_TXPC_CTS_M 0x00003f00 /* CTS tx power */ 168262306a36Sopenharmony_ci#define AR5K_TXPC_CTS_S 8 168362306a36Sopenharmony_ci#define AR5K_TXPC_CHIRP_M 0x003f0000 /* CHIRP tx power */ 168462306a36Sopenharmony_ci#define AR5K_TXPC_CHIRP_S 16 168562306a36Sopenharmony_ci#define AR5K_TXPC_DOPPLER 0x0f000000 /* Doppler chirp span (?) */ 168662306a36Sopenharmony_ci#define AR5K_TXPC_DOPPLER_S 24 168762306a36Sopenharmony_ci 168862306a36Sopenharmony_ci/* 168962306a36Sopenharmony_ci * Profile count registers 169062306a36Sopenharmony_ci * 169162306a36Sopenharmony_ci * These registers can be cleared and frozen with ATH5K_MIBC, but they do not 169262306a36Sopenharmony_ci * generate a MIB interrupt. 169362306a36Sopenharmony_ci * Instead of overflowing, they shift by one bit to the right. All registers 169462306a36Sopenharmony_ci * shift together, i.e. when one reaches the max, all shift at the same time by 169562306a36Sopenharmony_ci * one bit to the right. This way we should always get consistent values. 169662306a36Sopenharmony_ci */ 169762306a36Sopenharmony_ci#define AR5K_PROFCNT_TX 0x80ec /* Tx count */ 169862306a36Sopenharmony_ci#define AR5K_PROFCNT_RX 0x80f0 /* Rx count */ 169962306a36Sopenharmony_ci#define AR5K_PROFCNT_RXCLR 0x80f4 /* Busy count */ 170062306a36Sopenharmony_ci#define AR5K_PROFCNT_CYCLE 0x80f8 /* Cycle counter */ 170162306a36Sopenharmony_ci 170262306a36Sopenharmony_ci/* 170362306a36Sopenharmony_ci * Quiet period control registers 170462306a36Sopenharmony_ci */ 170562306a36Sopenharmony_ci#define AR5K_QUIET_CTL1 0x80fc /* Register Address */ 170662306a36Sopenharmony_ci#define AR5K_QUIET_CTL1_NEXT_QT_TSF 0x0000ffff /* Next quiet period TSF (TU) */ 170762306a36Sopenharmony_ci#define AR5K_QUIET_CTL1_NEXT_QT_TSF_S 0 170862306a36Sopenharmony_ci#define AR5K_QUIET_CTL1_QT_EN 0x00010000 /* Enable quiet period */ 170962306a36Sopenharmony_ci#define AR5K_QUIET_CTL1_ACK_CTS_EN 0x00020000 /* Send ACK/CTS during quiet period */ 171062306a36Sopenharmony_ci 171162306a36Sopenharmony_ci#define AR5K_QUIET_CTL2 0x8100 /* Register Address */ 171262306a36Sopenharmony_ci#define AR5K_QUIET_CTL2_QT_PER 0x0000ffff /* Mask for quiet period periodicity */ 171362306a36Sopenharmony_ci#define AR5K_QUIET_CTL2_QT_PER_S 0 171462306a36Sopenharmony_ci#define AR5K_QUIET_CTL2_QT_DUR 0xffff0000 /* Mask for quiet period duration */ 171562306a36Sopenharmony_ci#define AR5K_QUIET_CTL2_QT_DUR_S 16 171662306a36Sopenharmony_ci 171762306a36Sopenharmony_ci/* 171862306a36Sopenharmony_ci * TSF parameter register 171962306a36Sopenharmony_ci */ 172062306a36Sopenharmony_ci#define AR5K_TSF_PARM 0x8104 /* Register Address */ 172162306a36Sopenharmony_ci#define AR5K_TSF_PARM_INC 0x000000ff /* Mask for TSF increment */ 172262306a36Sopenharmony_ci#define AR5K_TSF_PARM_INC_S 0 172362306a36Sopenharmony_ci 172462306a36Sopenharmony_ci/* 172562306a36Sopenharmony_ci * QoS NOACK policy 172662306a36Sopenharmony_ci */ 172762306a36Sopenharmony_ci#define AR5K_QOS_NOACK 0x8108 /* Register Address */ 172862306a36Sopenharmony_ci#define AR5K_QOS_NOACK_2BIT_VALUES 0x0000000f /* ??? */ 172962306a36Sopenharmony_ci#define AR5K_QOS_NOACK_2BIT_VALUES_S 0 173062306a36Sopenharmony_ci#define AR5K_QOS_NOACK_BIT_OFFSET 0x00000070 /* ??? */ 173162306a36Sopenharmony_ci#define AR5K_QOS_NOACK_BIT_OFFSET_S 4 173262306a36Sopenharmony_ci#define AR5K_QOS_NOACK_BYTE_OFFSET 0x00000180 /* ??? */ 173362306a36Sopenharmony_ci#define AR5K_QOS_NOACK_BYTE_OFFSET_S 7 173462306a36Sopenharmony_ci 173562306a36Sopenharmony_ci/* 173662306a36Sopenharmony_ci * PHY error filter register 173762306a36Sopenharmony_ci */ 173862306a36Sopenharmony_ci#define AR5K_PHY_ERR_FIL 0x810c 173962306a36Sopenharmony_ci#define AR5K_PHY_ERR_FIL_RADAR 0x00000020 /* Radar signal */ 174062306a36Sopenharmony_ci#define AR5K_PHY_ERR_FIL_OFDM 0x00020000 /* OFDM false detect (ANI) */ 174162306a36Sopenharmony_ci#define AR5K_PHY_ERR_FIL_CCK 0x02000000 /* CCK false detect (ANI) */ 174262306a36Sopenharmony_ci 174362306a36Sopenharmony_ci/* 174462306a36Sopenharmony_ci * XR latency register 174562306a36Sopenharmony_ci */ 174662306a36Sopenharmony_ci#define AR5K_XRLAT_TX 0x8110 174762306a36Sopenharmony_ci 174862306a36Sopenharmony_ci/* 174962306a36Sopenharmony_ci * ACK SIFS register 175062306a36Sopenharmony_ci */ 175162306a36Sopenharmony_ci#define AR5K_ACKSIFS 0x8114 /* Register Address */ 175262306a36Sopenharmony_ci#define AR5K_ACKSIFS_INC 0x00000000 /* ACK SIFS Increment (field) */ 175362306a36Sopenharmony_ci 175462306a36Sopenharmony_ci/* 175562306a36Sopenharmony_ci * MIC QoS control register (?) 175662306a36Sopenharmony_ci */ 175762306a36Sopenharmony_ci#define AR5K_MIC_QOS_CTL 0x8118 /* Register Address */ 175862306a36Sopenharmony_ci#define AR5K_MIC_QOS_CTL_OFF(_n) (1 << (_n * 2)) 175962306a36Sopenharmony_ci#define AR5K_MIC_QOS_CTL_MQ_EN 0x00010000 /* Enable MIC QoS */ 176062306a36Sopenharmony_ci 176162306a36Sopenharmony_ci/* 176262306a36Sopenharmony_ci * MIC QoS select register (?) 176362306a36Sopenharmony_ci */ 176462306a36Sopenharmony_ci#define AR5K_MIC_QOS_SEL 0x811c 176562306a36Sopenharmony_ci#define AR5K_MIC_QOS_SEL_OFF(_n) (1 << (_n * 4)) 176662306a36Sopenharmony_ci 176762306a36Sopenharmony_ci/* 176862306a36Sopenharmony_ci * Misc mode control register (?) 176962306a36Sopenharmony_ci */ 177062306a36Sopenharmony_ci#define AR5K_MISC_MODE 0x8120 /* Register Address */ 177162306a36Sopenharmony_ci#define AR5K_MISC_MODE_FBSSID_MATCH 0x00000001 /* Force BSSID match */ 177262306a36Sopenharmony_ci#define AR5K_MISC_MODE_ACKSIFS_MEM 0x00000002 /* ACK SIFS memory (?) */ 177362306a36Sopenharmony_ci#define AR5K_MISC_MODE_COMBINED_MIC 0x00000004 /* use rx/tx MIC key */ 177462306a36Sopenharmony_ci/* more bits */ 177562306a36Sopenharmony_ci 177662306a36Sopenharmony_ci/* 177762306a36Sopenharmony_ci * OFDM Filter counter 177862306a36Sopenharmony_ci */ 177962306a36Sopenharmony_ci#define AR5K_OFDM_FIL_CNT 0x8124 178062306a36Sopenharmony_ci 178162306a36Sopenharmony_ci/* 178262306a36Sopenharmony_ci * CCK Filter counter 178362306a36Sopenharmony_ci */ 178462306a36Sopenharmony_ci#define AR5K_CCK_FIL_CNT 0x8128 178562306a36Sopenharmony_ci 178662306a36Sopenharmony_ci/* 178762306a36Sopenharmony_ci * PHY Error Counters (same masks as AR5K_PHY_ERR_FIL) 178862306a36Sopenharmony_ci */ 178962306a36Sopenharmony_ci#define AR5K_PHYERR_CNT1 0x812c 179062306a36Sopenharmony_ci#define AR5K_PHYERR_CNT1_MASK 0x8130 179162306a36Sopenharmony_ci 179262306a36Sopenharmony_ci#define AR5K_PHYERR_CNT2 0x8134 179362306a36Sopenharmony_ci#define AR5K_PHYERR_CNT2_MASK 0x8138 179462306a36Sopenharmony_ci 179562306a36Sopenharmony_ci/* if the PHY Error Counters reach this maximum, we get MIB interrupts */ 179662306a36Sopenharmony_ci#define ATH5K_PHYERR_CNT_MAX 0x00c00000 179762306a36Sopenharmony_ci 179862306a36Sopenharmony_ci/* 179962306a36Sopenharmony_ci * TSF Threshold register (?) 180062306a36Sopenharmony_ci */ 180162306a36Sopenharmony_ci#define AR5K_TSF_THRES 0x813c 180262306a36Sopenharmony_ci 180362306a36Sopenharmony_ci/* 180462306a36Sopenharmony_ci * TODO: Wake On Wireless registers 180562306a36Sopenharmony_ci * Range: 0x8147 - 0x818c 180662306a36Sopenharmony_ci */ 180762306a36Sopenharmony_ci 180862306a36Sopenharmony_ci/* 180962306a36Sopenharmony_ci * Rate -> ACK SIFS mapping table (32 entries) 181062306a36Sopenharmony_ci */ 181162306a36Sopenharmony_ci#define AR5K_RATE_ACKSIFS_BASE 0x8680 /* Register Address */ 181262306a36Sopenharmony_ci#define AR5K_RATE_ACKSIFS(_n) (AR5K_RATE_ACKSIFS_BSE + ((_n) << 2)) 181362306a36Sopenharmony_ci#define AR5K_RATE_ACKSIFS_NORMAL 0x00000001 /* Normal SIFS (field) */ 181462306a36Sopenharmony_ci#define AR5K_RATE_ACKSIFS_TURBO 0x00000400 /* Turbo SIFS (field) */ 181562306a36Sopenharmony_ci 181662306a36Sopenharmony_ci/* 181762306a36Sopenharmony_ci * Rate -> duration mapping table (32 entries) 181862306a36Sopenharmony_ci */ 181962306a36Sopenharmony_ci#define AR5K_RATE_DUR_BASE 0x8700 182062306a36Sopenharmony_ci#define AR5K_RATE_DUR(_n) (AR5K_RATE_DUR_BASE + ((_n) << 2)) 182162306a36Sopenharmony_ci 182262306a36Sopenharmony_ci/* 182362306a36Sopenharmony_ci * Rate -> db mapping table 182462306a36Sopenharmony_ci * (8 entries, each one has 4 8bit fields) 182562306a36Sopenharmony_ci */ 182662306a36Sopenharmony_ci#define AR5K_RATE2DB_BASE 0x87c0 182762306a36Sopenharmony_ci#define AR5K_RATE2DB(_n) (AR5K_RATE2DB_BASE + ((_n) << 2)) 182862306a36Sopenharmony_ci 182962306a36Sopenharmony_ci/* 183062306a36Sopenharmony_ci * db -> Rate mapping table 183162306a36Sopenharmony_ci * (8 entries, each one has 4 8bit fields) 183262306a36Sopenharmony_ci */ 183362306a36Sopenharmony_ci#define AR5K_DB2RATE_BASE 0x87e0 183462306a36Sopenharmony_ci#define AR5K_DB2RATE(_n) (AR5K_DB2RATE_BASE + ((_n) << 2)) 183562306a36Sopenharmony_ci 183662306a36Sopenharmony_ci/*===5212 end===*/ 183762306a36Sopenharmony_ci 183862306a36Sopenharmony_ci#define AR5K_KEYTABLE_SIZE_5210 64 183962306a36Sopenharmony_ci#define AR5K_KEYTABLE_SIZE_5211 128 184062306a36Sopenharmony_ci 184162306a36Sopenharmony_ci/*===PHY REGISTERS===*/ 184262306a36Sopenharmony_ci 184362306a36Sopenharmony_ci/* 184462306a36Sopenharmony_ci * PHY registers start 184562306a36Sopenharmony_ci */ 184662306a36Sopenharmony_ci#define AR5K_PHY_BASE 0x9800 184762306a36Sopenharmony_ci#define AR5K_PHY(_n) (AR5K_PHY_BASE + ((_n) << 2)) 184862306a36Sopenharmony_ci 184962306a36Sopenharmony_ci/* 185062306a36Sopenharmony_ci * TST_2 (Misc config parameters) 185162306a36Sopenharmony_ci */ 185262306a36Sopenharmony_ci#define AR5K_PHY_TST2 0x9800 /* Register Address */ 185362306a36Sopenharmony_ci#define AR5K_PHY_TST2_TRIG_SEL 0x00000007 /* Trigger select (?)*/ 185462306a36Sopenharmony_ci#define AR5K_PHY_TST2_TRIG 0x00000010 /* Trigger (?) */ 185562306a36Sopenharmony_ci#define AR5K_PHY_TST2_CBUS_MODE 0x00000060 /* Cardbus mode (?) */ 185662306a36Sopenharmony_ci#define AR5K_PHY_TST2_CLK32 0x00000400 /* CLK_OUT is CLK32 (32kHz external) */ 185762306a36Sopenharmony_ci#define AR5K_PHY_TST2_CHANCOR_DUMP_EN 0x00000800 /* Enable Chancor dump (?) */ 185862306a36Sopenharmony_ci#define AR5K_PHY_TST2_EVEN_CHANCOR_DUMP 0x00001000 /* Even Chancor dump (?) */ 185962306a36Sopenharmony_ci#define AR5K_PHY_TST2_RFSILENT_EN 0x00002000 /* Enable RFSILENT */ 186062306a36Sopenharmony_ci#define AR5K_PHY_TST2_ALT_RFDATA 0x00004000 /* Alternate RFDATA (5-2GHz switch ?) */ 186162306a36Sopenharmony_ci#define AR5K_PHY_TST2_MINI_OBS_EN 0x00008000 /* Enable mini OBS (?) */ 186262306a36Sopenharmony_ci#define AR5K_PHY_TST2_RX2_IS_RX5_INV 0x00010000 /* 2GHz rx path is the 5GHz path inverted (?) */ 186362306a36Sopenharmony_ci#define AR5K_PHY_TST2_SLOW_CLK160 0x00020000 /* Slow CLK160 (?) */ 186462306a36Sopenharmony_ci#define AR5K_PHY_TST2_AGC_OBS_SEL_3 0x00040000 /* AGC OBS Select 3 (?) */ 186562306a36Sopenharmony_ci#define AR5K_PHY_TST2_BBB_OBS_SEL 0x00080000 /* BB OBS Select (field ?) */ 186662306a36Sopenharmony_ci#define AR5K_PHY_TST2_ADC_OBS_SEL 0x00800000 /* ADC OBS Select (field ?) */ 186762306a36Sopenharmony_ci#define AR5K_PHY_TST2_RX_CLR_SEL 0x08000000 /* RX Clear Select (?) */ 186862306a36Sopenharmony_ci#define AR5K_PHY_TST2_FORCE_AGC_CLR 0x10000000 /* Force AGC clear (?) */ 186962306a36Sopenharmony_ci#define AR5K_PHY_SHIFT_2GHZ 0x00004007 /* Used to access 2GHz radios */ 187062306a36Sopenharmony_ci#define AR5K_PHY_SHIFT_5GHZ 0x00000007 /* Used to access 5GHz radios (default) */ 187162306a36Sopenharmony_ci 187262306a36Sopenharmony_ci/* 187362306a36Sopenharmony_ci * PHY frame control register [5110] /turbo mode register [5111+] 187462306a36Sopenharmony_ci * 187562306a36Sopenharmony_ci * There is another frame control register for [5111+] 187662306a36Sopenharmony_ci * at address 0x9944 (see below) but the 2 first flags 187762306a36Sopenharmony_ci * are common here between 5110 frame control register 187862306a36Sopenharmony_ci * and [5111+] turbo mode register, so this also works as 187962306a36Sopenharmony_ci * a "turbo mode register" for 5110. We treat this one as 188062306a36Sopenharmony_ci * a frame control register for 5110 below. 188162306a36Sopenharmony_ci */ 188262306a36Sopenharmony_ci#define AR5K_PHY_TURBO 0x9804 /* Register Address */ 188362306a36Sopenharmony_ci#define AR5K_PHY_TURBO_MODE 0x00000001 /* Enable turbo mode */ 188462306a36Sopenharmony_ci#define AR5K_PHY_TURBO_SHORT 0x00000002 /* Set short symbols to turbo mode */ 188562306a36Sopenharmony_ci#define AR5K_PHY_TURBO_MIMO 0x00000004 /* Set turbo for mimo */ 188662306a36Sopenharmony_ci 188762306a36Sopenharmony_ci/* 188862306a36Sopenharmony_ci * PHY agility command register 188962306a36Sopenharmony_ci * (aka TST_1) 189062306a36Sopenharmony_ci */ 189162306a36Sopenharmony_ci#define AR5K_PHY_AGC 0x9808 /* Register Address */ 189262306a36Sopenharmony_ci#define AR5K_PHY_TST1 0x9808 189362306a36Sopenharmony_ci#define AR5K_PHY_AGC_DISABLE 0x08000000 /* Disable AGC to A2 (?)*/ 189462306a36Sopenharmony_ci#define AR5K_PHY_TST1_TXHOLD 0x00003800 /* Set tx hold (?) */ 189562306a36Sopenharmony_ci#define AR5K_PHY_TST1_TXSRC_SRC 0x00000002 /* Used with bit 7 (?) */ 189662306a36Sopenharmony_ci#define AR5K_PHY_TST1_TXSRC_SRC_S 1 189762306a36Sopenharmony_ci#define AR5K_PHY_TST1_TXSRC_ALT 0x00000080 /* Set input to tsdac (?) */ 189862306a36Sopenharmony_ci#define AR5K_PHY_TST1_TXSRC_ALT_S 7 189962306a36Sopenharmony_ci 190062306a36Sopenharmony_ci 190162306a36Sopenharmony_ci/* 190262306a36Sopenharmony_ci * PHY timing register 3 [5112+] 190362306a36Sopenharmony_ci */ 190462306a36Sopenharmony_ci#define AR5K_PHY_TIMING_3 0x9814 190562306a36Sopenharmony_ci#define AR5K_PHY_TIMING_3_DSC_MAN 0xfffe0000 190662306a36Sopenharmony_ci#define AR5K_PHY_TIMING_3_DSC_MAN_S 17 190762306a36Sopenharmony_ci#define AR5K_PHY_TIMING_3_DSC_EXP 0x0001e000 190862306a36Sopenharmony_ci#define AR5K_PHY_TIMING_3_DSC_EXP_S 13 190962306a36Sopenharmony_ci 191062306a36Sopenharmony_ci/* 191162306a36Sopenharmony_ci * PHY chip revision register 191262306a36Sopenharmony_ci */ 191362306a36Sopenharmony_ci#define AR5K_PHY_CHIP_ID 0x9818 191462306a36Sopenharmony_ci 191562306a36Sopenharmony_ci/* 191662306a36Sopenharmony_ci * PHY activation register 191762306a36Sopenharmony_ci */ 191862306a36Sopenharmony_ci#define AR5K_PHY_ACT 0x981c /* Register Address */ 191962306a36Sopenharmony_ci#define AR5K_PHY_ACT_ENABLE 0x00000001 /* Activate PHY */ 192062306a36Sopenharmony_ci#define AR5K_PHY_ACT_DISABLE 0x00000002 /* Deactivate PHY */ 192162306a36Sopenharmony_ci 192262306a36Sopenharmony_ci/* 192362306a36Sopenharmony_ci * PHY RF control registers 192462306a36Sopenharmony_ci */ 192562306a36Sopenharmony_ci#define AR5K_PHY_RF_CTL2 0x9824 /* Register Address */ 192662306a36Sopenharmony_ci#define AR5K_PHY_RF_CTL2_TXF2TXD_START 0x0000000f /* TX frame to TX data start */ 192762306a36Sopenharmony_ci#define AR5K_PHY_RF_CTL2_TXF2TXD_START_S 0 192862306a36Sopenharmony_ci 192962306a36Sopenharmony_ci#define AR5K_PHY_RF_CTL3 0x9828 /* Register Address */ 193062306a36Sopenharmony_ci#define AR5K_PHY_RF_CTL3_TXE2XLNA_ON 0x0000ff00 /* TX end to XLNA on */ 193162306a36Sopenharmony_ci#define AR5K_PHY_RF_CTL3_TXE2XLNA_ON_S 8 193262306a36Sopenharmony_ci 193362306a36Sopenharmony_ci#define AR5K_PHY_ADC_CTL 0x982c 193462306a36Sopenharmony_ci#define AR5K_PHY_ADC_CTL_INBUFGAIN_OFF 0x00000003 193562306a36Sopenharmony_ci#define AR5K_PHY_ADC_CTL_INBUFGAIN_OFF_S 0 193662306a36Sopenharmony_ci#define AR5K_PHY_ADC_CTL_PWD_DAC_OFF 0x00002000 193762306a36Sopenharmony_ci#define AR5K_PHY_ADC_CTL_PWD_BAND_GAP_OFF 0x00004000 193862306a36Sopenharmony_ci#define AR5K_PHY_ADC_CTL_PWD_ADC_OFF 0x00008000 193962306a36Sopenharmony_ci#define AR5K_PHY_ADC_CTL_INBUFGAIN_ON 0x00030000 194062306a36Sopenharmony_ci#define AR5K_PHY_ADC_CTL_INBUFGAIN_ON_S 16 194162306a36Sopenharmony_ci 194262306a36Sopenharmony_ci#define AR5K_PHY_RF_CTL4 0x9834 /* Register Address */ 194362306a36Sopenharmony_ci#define AR5K_PHY_RF_CTL4_TXF2XPA_A_ON 0x00000001 /* TX frame to XPA A on (field) */ 194462306a36Sopenharmony_ci#define AR5K_PHY_RF_CTL4_TXF2XPA_B_ON 0x00000100 /* TX frame to XPA B on (field) */ 194562306a36Sopenharmony_ci#define AR5K_PHY_RF_CTL4_TXE2XPA_A_OFF 0x00010000 /* TX end to XPA A off (field) */ 194662306a36Sopenharmony_ci#define AR5K_PHY_RF_CTL4_TXE2XPA_B_OFF 0x01000000 /* TX end to XPA B off (field) */ 194762306a36Sopenharmony_ci 194862306a36Sopenharmony_ci/* 194962306a36Sopenharmony_ci * Pre-Amplifier control register 195062306a36Sopenharmony_ci * (XPA -> external pre-amplifier) 195162306a36Sopenharmony_ci */ 195262306a36Sopenharmony_ci#define AR5K_PHY_PA_CTL 0x9838 /* Register Address */ 195362306a36Sopenharmony_ci#define AR5K_PHY_PA_CTL_XPA_A_HI 0x00000001 /* XPA A high (?) */ 195462306a36Sopenharmony_ci#define AR5K_PHY_PA_CTL_XPA_B_HI 0x00000002 /* XPA B high (?) */ 195562306a36Sopenharmony_ci#define AR5K_PHY_PA_CTL_XPA_A_EN 0x00000004 /* Enable XPA A */ 195662306a36Sopenharmony_ci#define AR5K_PHY_PA_CTL_XPA_B_EN 0x00000008 /* Enable XPA B */ 195762306a36Sopenharmony_ci 195862306a36Sopenharmony_ci/* 195962306a36Sopenharmony_ci * PHY settling register 196062306a36Sopenharmony_ci */ 196162306a36Sopenharmony_ci#define AR5K_PHY_SETTLING 0x9844 /* Register Address */ 196262306a36Sopenharmony_ci#define AR5K_PHY_SETTLING_AGC 0x0000007f /* AGC settling time */ 196362306a36Sopenharmony_ci#define AR5K_PHY_SETTLING_AGC_S 0 196462306a36Sopenharmony_ci#define AR5K_PHY_SETTLING_SWITCH 0x00003f80 /* Switch settling time */ 196562306a36Sopenharmony_ci#define AR5K_PHY_SETTLING_SWITCH_S 7 196662306a36Sopenharmony_ci 196762306a36Sopenharmony_ci/* 196862306a36Sopenharmony_ci * PHY Gain registers 196962306a36Sopenharmony_ci */ 197062306a36Sopenharmony_ci#define AR5K_PHY_GAIN 0x9848 /* Register Address */ 197162306a36Sopenharmony_ci#define AR5K_PHY_GAIN_TXRX_ATTEN 0x0003f000 /* TX-RX Attenuation */ 197262306a36Sopenharmony_ci#define AR5K_PHY_GAIN_TXRX_ATTEN_S 12 197362306a36Sopenharmony_ci#define AR5K_PHY_GAIN_TXRX_RF_MAX 0x007c0000 197462306a36Sopenharmony_ci#define AR5K_PHY_GAIN_TXRX_RF_MAX_S 18 197562306a36Sopenharmony_ci 197662306a36Sopenharmony_ci#define AR5K_PHY_GAIN_OFFSET 0x984c /* Register Address */ 197762306a36Sopenharmony_ci#define AR5K_PHY_GAIN_OFFSET_RXTX_FLAG 0x00020000 /* RX-TX flag (?) */ 197862306a36Sopenharmony_ci 197962306a36Sopenharmony_ci/* 198062306a36Sopenharmony_ci * Desired ADC/PGA size register 198162306a36Sopenharmony_ci * (for more infos read ANI patent) 198262306a36Sopenharmony_ci */ 198362306a36Sopenharmony_ci#define AR5K_PHY_DESIRED_SIZE 0x9850 /* Register Address */ 198462306a36Sopenharmony_ci#define AR5K_PHY_DESIRED_SIZE_ADC 0x000000ff /* ADC desired size */ 198562306a36Sopenharmony_ci#define AR5K_PHY_DESIRED_SIZE_ADC_S 0 198662306a36Sopenharmony_ci#define AR5K_PHY_DESIRED_SIZE_PGA 0x0000ff00 /* PGA desired size */ 198762306a36Sopenharmony_ci#define AR5K_PHY_DESIRED_SIZE_PGA_S 8 198862306a36Sopenharmony_ci#define AR5K_PHY_DESIRED_SIZE_TOT 0x0ff00000 /* Total desired size */ 198962306a36Sopenharmony_ci#define AR5K_PHY_DESIRED_SIZE_TOT_S 20 199062306a36Sopenharmony_ci 199162306a36Sopenharmony_ci/* 199262306a36Sopenharmony_ci * PHY signal register 199362306a36Sopenharmony_ci * (for more infos read ANI patent) 199462306a36Sopenharmony_ci */ 199562306a36Sopenharmony_ci#define AR5K_PHY_SIG 0x9858 /* Register Address */ 199662306a36Sopenharmony_ci#define AR5K_PHY_SIG_FIRSTEP 0x0003f000 /* FIRSTEP */ 199762306a36Sopenharmony_ci#define AR5K_PHY_SIG_FIRSTEP_S 12 199862306a36Sopenharmony_ci#define AR5K_PHY_SIG_FIRPWR 0x03fc0000 /* FIPWR */ 199962306a36Sopenharmony_ci#define AR5K_PHY_SIG_FIRPWR_S 18 200062306a36Sopenharmony_ci 200162306a36Sopenharmony_ci/* 200262306a36Sopenharmony_ci * PHY coarse agility control register 200362306a36Sopenharmony_ci * (for more infos read ANI patent) 200462306a36Sopenharmony_ci */ 200562306a36Sopenharmony_ci#define AR5K_PHY_AGCCOARSE 0x985c /* Register Address */ 200662306a36Sopenharmony_ci#define AR5K_PHY_AGCCOARSE_LO 0x00007f80 /* AGC Coarse low */ 200762306a36Sopenharmony_ci#define AR5K_PHY_AGCCOARSE_LO_S 7 200862306a36Sopenharmony_ci#define AR5K_PHY_AGCCOARSE_HI 0x003f8000 /* AGC Coarse high */ 200962306a36Sopenharmony_ci#define AR5K_PHY_AGCCOARSE_HI_S 15 201062306a36Sopenharmony_ci 201162306a36Sopenharmony_ci/* 201262306a36Sopenharmony_ci * PHY agility control register 201362306a36Sopenharmony_ci */ 201462306a36Sopenharmony_ci#define AR5K_PHY_AGCCTL 0x9860 /* Register address */ 201562306a36Sopenharmony_ci#define AR5K_PHY_AGCCTL_CAL 0x00000001 /* Enable PHY calibration */ 201662306a36Sopenharmony_ci#define AR5K_PHY_AGCCTL_NF 0x00000002 /* Enable Noise Floor calibration */ 201762306a36Sopenharmony_ci#define AR5K_PHY_AGCCTL_OFDM_DIV_DIS 0x00000008 /* Disable antenna diversity on OFDM modes */ 201862306a36Sopenharmony_ci#define AR5K_PHY_AGCCTL_NF_EN 0x00008000 /* Enable nf calibration to happen (?) */ 201962306a36Sopenharmony_ci#define AR5K_PHY_AGCTL_FLTR_CAL 0x00010000 /* Allow filter calibration (?) */ 202062306a36Sopenharmony_ci#define AR5K_PHY_AGCCTL_NF_NOUPDATE 0x00020000 /* Don't update nf automatically */ 202162306a36Sopenharmony_ci 202262306a36Sopenharmony_ci/* 202362306a36Sopenharmony_ci * PHY noise floor status register (CCA = Clear Channel Assessment) 202462306a36Sopenharmony_ci */ 202562306a36Sopenharmony_ci#define AR5K_PHY_NF 0x9864 /* Register address */ 202662306a36Sopenharmony_ci#define AR5K_PHY_NF_M 0x000001ff /* Noise floor, written to hardware in 1/2 dBm units */ 202762306a36Sopenharmony_ci#define AR5K_PHY_NF_SVAL(_n) (((_n) & AR5K_PHY_NF_M) | (1 << 9)) 202862306a36Sopenharmony_ci#define AR5K_PHY_NF_THRESH62 0x0007f000 /* Thresh62 -check ANI patent- (field) */ 202962306a36Sopenharmony_ci#define AR5K_PHY_NF_THRESH62_S 12 203062306a36Sopenharmony_ci#define AR5K_PHY_NF_MINCCA_PWR 0x0ff80000 /* Minimum measured noise level, read from hardware in 1 dBm units */ 203162306a36Sopenharmony_ci#define AR5K_PHY_NF_MINCCA_PWR_S 19 203262306a36Sopenharmony_ci 203362306a36Sopenharmony_ci/* 203462306a36Sopenharmony_ci * PHY ADC saturation register [5110] 203562306a36Sopenharmony_ci */ 203662306a36Sopenharmony_ci#define AR5K_PHY_ADCSAT 0x9868 203762306a36Sopenharmony_ci#define AR5K_PHY_ADCSAT_ICNT 0x0001f800 203862306a36Sopenharmony_ci#define AR5K_PHY_ADCSAT_ICNT_S 11 203962306a36Sopenharmony_ci#define AR5K_PHY_ADCSAT_THR 0x000007e0 204062306a36Sopenharmony_ci#define AR5K_PHY_ADCSAT_THR_S 5 204162306a36Sopenharmony_ci 204262306a36Sopenharmony_ci/* 204362306a36Sopenharmony_ci * PHY Weak ofdm signal detection threshold registers (ANI) [5212+] 204462306a36Sopenharmony_ci */ 204562306a36Sopenharmony_ci 204662306a36Sopenharmony_ci/* High thresholds */ 204762306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_HIGH_THR 0x9868 204862306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT 0x0000001f 204962306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT_S 0 205062306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1 0x00fe0000 205162306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1_S 17 205262306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2 0x7f000000 205362306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_S 24 205462306a36Sopenharmony_ci 205562306a36Sopenharmony_ci/* Low thresholds */ 205662306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_LOW_THR 0x986c 205762306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_LOW_THR_SELFCOR_EN 0x00000001 205862306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT 0x00003f00 205962306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT_S 8 206062306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_LOW_THR_M1 0x001fc000 206162306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_LOW_THR_M1_S 14 206262306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2 0x0fe00000 206362306a36Sopenharmony_ci#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_S 21 206462306a36Sopenharmony_ci 206562306a36Sopenharmony_ci 206662306a36Sopenharmony_ci/* 206762306a36Sopenharmony_ci * PHY sleep registers [5112+] 206862306a36Sopenharmony_ci */ 206962306a36Sopenharmony_ci#define AR5K_PHY_SCR 0x9870 207062306a36Sopenharmony_ci 207162306a36Sopenharmony_ci#define AR5K_PHY_SLMT 0x9874 207262306a36Sopenharmony_ci#define AR5K_PHY_SLMT_32MHZ 0x0000007f 207362306a36Sopenharmony_ci 207462306a36Sopenharmony_ci#define AR5K_PHY_SCAL 0x9878 207562306a36Sopenharmony_ci#define AR5K_PHY_SCAL_32MHZ 0x0000000e 207662306a36Sopenharmony_ci#define AR5K_PHY_SCAL_32MHZ_5311 0x00000008 207762306a36Sopenharmony_ci#define AR5K_PHY_SCAL_32MHZ_2417 0x0000000a 207862306a36Sopenharmony_ci#define AR5K_PHY_SCAL_32MHZ_HB63 0x00000032 207962306a36Sopenharmony_ci 208062306a36Sopenharmony_ci/* 208162306a36Sopenharmony_ci * PHY PLL (Phase Locked Loop) control register 208262306a36Sopenharmony_ci */ 208362306a36Sopenharmony_ci#define AR5K_PHY_PLL 0x987c 208462306a36Sopenharmony_ci#define AR5K_PHY_PLL_20MHZ 0x00000013 /* For half rate (?) */ 208562306a36Sopenharmony_ci/* 40MHz -> 5GHz band */ 208662306a36Sopenharmony_ci#define AR5K_PHY_PLL_40MHZ_5211 0x00000018 208762306a36Sopenharmony_ci#define AR5K_PHY_PLL_40MHZ_5212 0x000000aa 208862306a36Sopenharmony_ci#define AR5K_PHY_PLL_40MHZ_5413 0x00000004 208962306a36Sopenharmony_ci#define AR5K_PHY_PLL_40MHZ (ah->ah_version == AR5K_AR5211 ? \ 209062306a36Sopenharmony_ci AR5K_PHY_PLL_40MHZ_5211 : AR5K_PHY_PLL_40MHZ_5212) 209162306a36Sopenharmony_ci/* 44MHz -> 2.4GHz band */ 209262306a36Sopenharmony_ci#define AR5K_PHY_PLL_44MHZ_5211 0x00000019 209362306a36Sopenharmony_ci#define AR5K_PHY_PLL_44MHZ_5212 0x000000ab 209462306a36Sopenharmony_ci#define AR5K_PHY_PLL_44MHZ (ah->ah_version == AR5K_AR5211 ? \ 209562306a36Sopenharmony_ci AR5K_PHY_PLL_44MHZ_5211 : AR5K_PHY_PLL_44MHZ_5212) 209662306a36Sopenharmony_ci 209762306a36Sopenharmony_ci#define AR5K_PHY_PLL_RF5111 0x00000000 209862306a36Sopenharmony_ci#define AR5K_PHY_PLL_RF5112 0x00000040 209962306a36Sopenharmony_ci#define AR5K_PHY_PLL_HALF_RATE 0x00000100 210062306a36Sopenharmony_ci#define AR5K_PHY_PLL_QUARTER_RATE 0x00000200 210162306a36Sopenharmony_ci 210262306a36Sopenharmony_ci/* 210362306a36Sopenharmony_ci * RF Buffer register 210462306a36Sopenharmony_ci * 210562306a36Sopenharmony_ci * It's obvious from the code that 0x989c is the buffer register but 210662306a36Sopenharmony_ci * for the other special registers that we write to after sending each 210762306a36Sopenharmony_ci * packet, i have no idea. So I'll name them BUFFER_CONTROL_X registers 210862306a36Sopenharmony_ci * for now. It's interesting that they are also used for some other operations. 210962306a36Sopenharmony_ci */ 211062306a36Sopenharmony_ci 211162306a36Sopenharmony_ci#define AR5K_RF_BUFFER 0x989c 211262306a36Sopenharmony_ci#define AR5K_RF_BUFFER_CONTROL_0 0x98c0 /* Channel on 5110 */ 211362306a36Sopenharmony_ci#define AR5K_RF_BUFFER_CONTROL_1 0x98c4 /* Bank 7 on 5112 */ 211462306a36Sopenharmony_ci#define AR5K_RF_BUFFER_CONTROL_2 0x98cc /* Bank 7 on 5111 */ 211562306a36Sopenharmony_ci 211662306a36Sopenharmony_ci#define AR5K_RF_BUFFER_CONTROL_3 0x98d0 /* Bank 2 on 5112 */ 211762306a36Sopenharmony_ci /* Channel set on 5111 */ 211862306a36Sopenharmony_ci /* Used to read radio revision*/ 211962306a36Sopenharmony_ci 212062306a36Sopenharmony_ci#define AR5K_RF_BUFFER_CONTROL_4 0x98d4 /* RF Stage register on 5110 */ 212162306a36Sopenharmony_ci /* Bank 0,1,2,6 on 5111 */ 212262306a36Sopenharmony_ci /* Bank 1 on 5112 */ 212362306a36Sopenharmony_ci /* Used during activation on 5111 */ 212462306a36Sopenharmony_ci 212562306a36Sopenharmony_ci#define AR5K_RF_BUFFER_CONTROL_5 0x98d8 /* Bank 3 on 5111 */ 212662306a36Sopenharmony_ci /* Used during activation on 5111 */ 212762306a36Sopenharmony_ci /* Channel on 5112 */ 212862306a36Sopenharmony_ci /* Bank 6 on 5112 */ 212962306a36Sopenharmony_ci 213062306a36Sopenharmony_ci#define AR5K_RF_BUFFER_CONTROL_6 0x98dc /* Bank 3 on 5112 */ 213162306a36Sopenharmony_ci 213262306a36Sopenharmony_ci/* 213362306a36Sopenharmony_ci * PHY RF stage register [5210] 213462306a36Sopenharmony_ci */ 213562306a36Sopenharmony_ci#define AR5K_PHY_RFSTG 0x98d4 213662306a36Sopenharmony_ci#define AR5K_PHY_RFSTG_DISABLE 0x00000021 213762306a36Sopenharmony_ci 213862306a36Sopenharmony_ci/* 213962306a36Sopenharmony_ci * BIN masks (?) 214062306a36Sopenharmony_ci */ 214162306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK_1 0x9900 214262306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK_2 0x9904 214362306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK_3 0x9908 214462306a36Sopenharmony_ci 214562306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK_CTL 0x990c 214662306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK_CTL_MASK_4 0x00003fff 214762306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK_CTL_MASK_4_S 0 214862306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK_CTL_RATE 0xff000000 214962306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK_CTL_RATE_S 24 215062306a36Sopenharmony_ci 215162306a36Sopenharmony_ci/* 215262306a36Sopenharmony_ci * PHY Antenna control register 215362306a36Sopenharmony_ci */ 215462306a36Sopenharmony_ci#define AR5K_PHY_ANT_CTL 0x9910 /* Register Address */ 215562306a36Sopenharmony_ci#define AR5K_PHY_ANT_CTL_TXRX_EN 0x00000001 /* Enable TX/RX (?) */ 215662306a36Sopenharmony_ci#define AR5K_PHY_ANT_CTL_SECTORED_ANT 0x00000004 /* Sectored Antenna */ 215762306a36Sopenharmony_ci#define AR5K_PHY_ANT_CTL_HITUNE5 0x00000008 /* Hitune5 (?) */ 215862306a36Sopenharmony_ci#define AR5K_PHY_ANT_CTL_SWTABLE_IDLE 0x000003f0 /* Switch table idle (?) */ 215962306a36Sopenharmony_ci#define AR5K_PHY_ANT_CTL_SWTABLE_IDLE_S 4 216062306a36Sopenharmony_ci 216162306a36Sopenharmony_ci/* 216262306a36Sopenharmony_ci * PHY receiver delay register [5111+] 216362306a36Sopenharmony_ci */ 216462306a36Sopenharmony_ci#define AR5K_PHY_RX_DELAY 0x9914 /* Register Address */ 216562306a36Sopenharmony_ci#define AR5K_PHY_RX_DELAY_M 0x00003fff /* Mask for RX activate to receive delay (/100ns) */ 216662306a36Sopenharmony_ci 216762306a36Sopenharmony_ci/* 216862306a36Sopenharmony_ci * PHY max rx length register (?) [5111] 216962306a36Sopenharmony_ci */ 217062306a36Sopenharmony_ci#define AR5K_PHY_MAX_RX_LEN 0x991c 217162306a36Sopenharmony_ci 217262306a36Sopenharmony_ci/* 217362306a36Sopenharmony_ci * PHY timing register 4 217462306a36Sopenharmony_ci * I(nphase)/Q(adrature) calibration register [5111+] 217562306a36Sopenharmony_ci */ 217662306a36Sopenharmony_ci#define AR5K_PHY_IQ 0x9920 /* Register Address */ 217762306a36Sopenharmony_ci#define AR5K_PHY_IQ_CORR_Q_Q_COFF 0x0000001f /* Mask for q correction info */ 217862306a36Sopenharmony_ci#define AR5K_PHY_IQ_CORR_Q_Q_COFF_S 0 217962306a36Sopenharmony_ci#define AR5K_PHY_IQ_CORR_Q_I_COFF 0x000007e0 /* Mask for i correction info */ 218062306a36Sopenharmony_ci#define AR5K_PHY_IQ_CORR_Q_I_COFF_S 5 218162306a36Sopenharmony_ci#define AR5K_PHY_IQ_CORR_ENABLE 0x00000800 /* Enable i/q correction */ 218262306a36Sopenharmony_ci#define AR5K_PHY_IQ_CAL_NUM_LOG_MAX 0x0000f000 /* Mask for max number of samples in log scale */ 218362306a36Sopenharmony_ci#define AR5K_PHY_IQ_CAL_NUM_LOG_MAX_S 12 218462306a36Sopenharmony_ci#define AR5K_PHY_IQ_RUN 0x00010000 /* Run i/q calibration */ 218562306a36Sopenharmony_ci#define AR5K_PHY_IQ_USE_PT_DF 0x00020000 /* Use pilot track df (?) */ 218662306a36Sopenharmony_ci#define AR5K_PHY_IQ_EARLY_TRIG_THR 0x00200000 /* Early trigger threshold (?) (field) */ 218762306a36Sopenharmony_ci#define AR5K_PHY_IQ_PILOT_MASK_EN 0x10000000 /* Enable pilot mask (?) */ 218862306a36Sopenharmony_ci#define AR5K_PHY_IQ_CHAN_MASK_EN 0x20000000 /* Enable channel mask (?) */ 218962306a36Sopenharmony_ci#define AR5K_PHY_IQ_SPUR_FILT_EN 0x40000000 /* Enable spur filter */ 219062306a36Sopenharmony_ci#define AR5K_PHY_IQ_SPUR_RSSI_EN 0x80000000 /* Enable spur rssi */ 219162306a36Sopenharmony_ci 219262306a36Sopenharmony_ci/* 219362306a36Sopenharmony_ci * PHY timing register 5 219462306a36Sopenharmony_ci * OFDM Self-correlator Cyclic RSSI threshold params 219562306a36Sopenharmony_ci * (Check out bb_cycpwr_thr1 on ANI patent) 219662306a36Sopenharmony_ci */ 219762306a36Sopenharmony_ci#define AR5K_PHY_OFDM_SELFCORR 0x9924 /* Register Address */ 219862306a36Sopenharmony_ci#define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_EN 0x00000001 /* Enable cyclic RSSI thr 1 */ 219962306a36Sopenharmony_ci#define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1 0x000000fe /* Mask for Cyclic RSSI threshold 1 */ 220062306a36Sopenharmony_ci#define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_S 1 220162306a36Sopenharmony_ci#define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR3 0x00000100 /* Cyclic RSSI threshold 3 (field) (?) */ 220262306a36Sopenharmony_ci#define AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR_EN 0x00008000 /* Enable 1A RSSI threshold (?) */ 220362306a36Sopenharmony_ci#define AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR 0x00010000 /* 1A RSSI threshold (field) (?) */ 220462306a36Sopenharmony_ci#define AR5K_PHY_OFDM_SELFCORR_LSCTHR_HIRSSI 0x00800000 /* Long sc threshold hi rssi (?) */ 220562306a36Sopenharmony_ci 220662306a36Sopenharmony_ci/* 220762306a36Sopenharmony_ci * PHY-only warm reset register 220862306a36Sopenharmony_ci */ 220962306a36Sopenharmony_ci#define AR5K_PHY_WARM_RESET 0x9928 221062306a36Sopenharmony_ci 221162306a36Sopenharmony_ci/* 221262306a36Sopenharmony_ci * PHY-only control register 221362306a36Sopenharmony_ci */ 221462306a36Sopenharmony_ci#define AR5K_PHY_CTL 0x992c /* Register Address */ 221562306a36Sopenharmony_ci#define AR5K_PHY_CTL_RX_DRAIN_RATE 0x00000001 /* RX drain rate (?) */ 221662306a36Sopenharmony_ci#define AR5K_PHY_CTL_LATE_TX_SIG_SYM 0x00000002 /* Late tx signal symbol (?) */ 221762306a36Sopenharmony_ci#define AR5K_PHY_CTL_GEN_SCRAMBLER 0x00000004 /* Generate scrambler */ 221862306a36Sopenharmony_ci#define AR5K_PHY_CTL_TX_ANT_SEL 0x00000008 /* TX antenna select */ 221962306a36Sopenharmony_ci#define AR5K_PHY_CTL_TX_ANT_STATIC 0x00000010 /* Static TX antenna */ 222062306a36Sopenharmony_ci#define AR5K_PHY_CTL_RX_ANT_SEL 0x00000020 /* RX antenna select */ 222162306a36Sopenharmony_ci#define AR5K_PHY_CTL_RX_ANT_STATIC 0x00000040 /* Static RX antenna */ 222262306a36Sopenharmony_ci#define AR5K_PHY_CTL_LOW_FREQ_SLE_EN 0x00000080 /* Enable low freq sleep */ 222362306a36Sopenharmony_ci 222462306a36Sopenharmony_ci/* 222562306a36Sopenharmony_ci * PHY PAPD probe register [5111+] 222662306a36Sopenharmony_ci */ 222762306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE 0x9930 222862306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_SH_HI_PAR 0x00000001 222962306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_PCDAC_BIAS 0x00000002 223062306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_COMP_GAIN 0x00000040 223162306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_TXPOWER 0x00007e00 223262306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_TXPOWER_S 9 223362306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_TX_NEXT 0x00008000 223462306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_PREDIST_EN 0x00010000 223562306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_TYPE 0x01800000 /* [5112+] */ 223662306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_TYPE_S 23 223762306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_TYPE_OFDM 0 223862306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_TYPE_XR 1 223962306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_TYPE_CCK 2 224062306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_GAINF 0xfe000000 224162306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_GAINF_S 25 224262306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_INI_5111 0x00004883 /* [5212+] */ 224362306a36Sopenharmony_ci#define AR5K_PHY_PAPD_PROBE_INI_5112 0x00004882 /* [5212+] */ 224462306a36Sopenharmony_ci 224562306a36Sopenharmony_ci/* 224662306a36Sopenharmony_ci * PHY TX rate power registers [5112+] 224762306a36Sopenharmony_ci */ 224862306a36Sopenharmony_ci#define AR5K_PHY_TXPOWER_RATE1 0x9934 224962306a36Sopenharmony_ci#define AR5K_PHY_TXPOWER_RATE2 0x9938 225062306a36Sopenharmony_ci#define AR5K_PHY_TXPOWER_RATE_MAX 0x993c 225162306a36Sopenharmony_ci#define AR5K_PHY_TXPOWER_RATE_MAX_TPC_ENABLE 0x00000040 225262306a36Sopenharmony_ci#define AR5K_PHY_TXPOWER_RATE3 0xa234 225362306a36Sopenharmony_ci#define AR5K_PHY_TXPOWER_RATE4 0xa238 225462306a36Sopenharmony_ci 225562306a36Sopenharmony_ci/* 225662306a36Sopenharmony_ci * PHY frame control register [5111+] 225762306a36Sopenharmony_ci */ 225862306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_5210 0x9804 225962306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_5211 0x9944 226062306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL (ah->ah_version == AR5K_AR5210 ? \ 226162306a36Sopenharmony_ci AR5K_PHY_FRAME_CTL_5210 : AR5K_PHY_FRAME_CTL_5211) 226262306a36Sopenharmony_ci/*---[5111+]---*/ 226362306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_WIN_LEN 0x00000003 /* Force window length (?) */ 226462306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_WIN_LEN_S 0 226562306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_TX_CLIP 0x00000038 /* Mask for tx clip (?) */ 226662306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_TX_CLIP_S 3 226762306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_PREP_CHINFO 0x00010000 /* Prepend chan info */ 226862306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_EMU 0x80000000 226962306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_EMU_S 31 227062306a36Sopenharmony_ci/*---[5110/5111]---*/ 227162306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_TIMING_ERR 0x01000000 /* PHY timing error */ 227262306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_PARITY_ERR 0x02000000 /* Parity error */ 227362306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_ILLRATE_ERR 0x04000000 /* Illegal rate */ 227462306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_ILLLEN_ERR 0x08000000 /* Illegal length */ 227562306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_SERVICE_ERR 0x20000000 227662306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_TXURN_ERR 0x40000000 /* TX underrun */ 227762306a36Sopenharmony_ci#define AR5K_PHY_FRAME_CTL_INI \ 227862306a36Sopenharmony_ci (AR5K_PHY_FRAME_CTL_SERVICE_ERR | \ 227962306a36Sopenharmony_ci AR5K_PHY_FRAME_CTL_TXURN_ERR | \ 228062306a36Sopenharmony_ci AR5K_PHY_FRAME_CTL_ILLLEN_ERR | \ 228162306a36Sopenharmony_ci AR5K_PHY_FRAME_CTL_ILLRATE_ERR | \ 228262306a36Sopenharmony_ci AR5K_PHY_FRAME_CTL_PARITY_ERR | \ 228362306a36Sopenharmony_ci AR5K_PHY_FRAME_CTL_TIMING_ERR) 228462306a36Sopenharmony_ci 228562306a36Sopenharmony_ci/* 228662306a36Sopenharmony_ci * PHY Tx Power adjustment register [5212A+] 228762306a36Sopenharmony_ci */ 228862306a36Sopenharmony_ci#define AR5K_PHY_TX_PWR_ADJ 0x994c 228962306a36Sopenharmony_ci#define AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA 0x00000fc0 229062306a36Sopenharmony_ci#define AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA_S 6 229162306a36Sopenharmony_ci#define AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX 0x00fc0000 229262306a36Sopenharmony_ci#define AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX_S 18 229362306a36Sopenharmony_ci 229462306a36Sopenharmony_ci/* 229562306a36Sopenharmony_ci * PHY radar detection register [5111+] 229662306a36Sopenharmony_ci */ 229762306a36Sopenharmony_ci#define AR5K_PHY_RADAR 0x9954 229862306a36Sopenharmony_ci#define AR5K_PHY_RADAR_ENABLE 0x00000001 229962306a36Sopenharmony_ci#define AR5K_PHY_RADAR_DISABLE 0x00000000 230062306a36Sopenharmony_ci#define AR5K_PHY_RADAR_INBANDTHR 0x0000003e /* Inband threshold 230162306a36Sopenharmony_ci 5-bits, units unknown {0..31} 230262306a36Sopenharmony_ci (? MHz ?) */ 230362306a36Sopenharmony_ci#define AR5K_PHY_RADAR_INBANDTHR_S 1 230462306a36Sopenharmony_ci 230562306a36Sopenharmony_ci#define AR5K_PHY_RADAR_PRSSI_THR 0x00000fc0 /* Pulse RSSI/SNR threshold 230662306a36Sopenharmony_ci 6-bits, dBm range {0..63} 230762306a36Sopenharmony_ci in dBm units. */ 230862306a36Sopenharmony_ci#define AR5K_PHY_RADAR_PRSSI_THR_S 6 230962306a36Sopenharmony_ci 231062306a36Sopenharmony_ci#define AR5K_PHY_RADAR_PHEIGHT_THR 0x0003f000 /* Pulse height threshold 231162306a36Sopenharmony_ci 6-bits, dBm range {0..63} 231262306a36Sopenharmony_ci in dBm units. */ 231362306a36Sopenharmony_ci#define AR5K_PHY_RADAR_PHEIGHT_THR_S 12 231462306a36Sopenharmony_ci 231562306a36Sopenharmony_ci#define AR5K_PHY_RADAR_RSSI_THR 0x00fc0000 /* Radar RSSI/SNR threshold. 231662306a36Sopenharmony_ci 6-bits, dBm range {0..63} 231762306a36Sopenharmony_ci in dBm units. */ 231862306a36Sopenharmony_ci#define AR5K_PHY_RADAR_RSSI_THR_S 18 231962306a36Sopenharmony_ci 232062306a36Sopenharmony_ci#define AR5K_PHY_RADAR_FIRPWR_THR 0x7f000000 /* Finite Impulse Response 232162306a36Sopenharmony_ci filter power out threshold. 232262306a36Sopenharmony_ci 7-bits, standard power range 232362306a36Sopenharmony_ci {0..127} in 1/2 dBm units. */ 232462306a36Sopenharmony_ci#define AR5K_PHY_RADAR_FIRPWR_THRS 24 232562306a36Sopenharmony_ci 232662306a36Sopenharmony_ci/* 232762306a36Sopenharmony_ci * PHY antenna switch table registers 232862306a36Sopenharmony_ci */ 232962306a36Sopenharmony_ci#define AR5K_PHY_ANT_SWITCH_TABLE_0 0x9960 233062306a36Sopenharmony_ci#define AR5K_PHY_ANT_SWITCH_TABLE_1 0x9964 233162306a36Sopenharmony_ci 233262306a36Sopenharmony_ci/* 233362306a36Sopenharmony_ci * PHY Noise floor threshold 233462306a36Sopenharmony_ci */ 233562306a36Sopenharmony_ci#define AR5K_PHY_NFTHRES 0x9968 233662306a36Sopenharmony_ci 233762306a36Sopenharmony_ci/* 233862306a36Sopenharmony_ci * Sigma Delta register (?) [5213] 233962306a36Sopenharmony_ci */ 234062306a36Sopenharmony_ci#define AR5K_PHY_SIGMA_DELTA 0x996C 234162306a36Sopenharmony_ci#define AR5K_PHY_SIGMA_DELTA_ADC_SEL 0x00000003 234262306a36Sopenharmony_ci#define AR5K_PHY_SIGMA_DELTA_ADC_SEL_S 0 234362306a36Sopenharmony_ci#define AR5K_PHY_SIGMA_DELTA_FILT2 0x000000f8 234462306a36Sopenharmony_ci#define AR5K_PHY_SIGMA_DELTA_FILT2_S 3 234562306a36Sopenharmony_ci#define AR5K_PHY_SIGMA_DELTA_FILT1 0x00001f00 234662306a36Sopenharmony_ci#define AR5K_PHY_SIGMA_DELTA_FILT1_S 8 234762306a36Sopenharmony_ci#define AR5K_PHY_SIGMA_DELTA_ADC_CLIP 0x01ffe000 234862306a36Sopenharmony_ci#define AR5K_PHY_SIGMA_DELTA_ADC_CLIP_S 13 234962306a36Sopenharmony_ci 235062306a36Sopenharmony_ci/* 235162306a36Sopenharmony_ci * RF restart register [5112+] (?) 235262306a36Sopenharmony_ci */ 235362306a36Sopenharmony_ci#define AR5K_PHY_RESTART 0x9970 /* restart */ 235462306a36Sopenharmony_ci#define AR5K_PHY_RESTART_DIV_GC 0x001c0000 /* Fast diversity gc_limit (?) */ 235562306a36Sopenharmony_ci#define AR5K_PHY_RESTART_DIV_GC_S 18 235662306a36Sopenharmony_ci 235762306a36Sopenharmony_ci/* 235862306a36Sopenharmony_ci * RF Bus access request register (for synth-only channel switching) 235962306a36Sopenharmony_ci */ 236062306a36Sopenharmony_ci#define AR5K_PHY_RFBUS_REQ 0x997C 236162306a36Sopenharmony_ci#define AR5K_PHY_RFBUS_REQ_REQUEST 0x00000001 236262306a36Sopenharmony_ci 236362306a36Sopenharmony_ci/* 236462306a36Sopenharmony_ci * Spur mitigation masks (?) 236562306a36Sopenharmony_ci */ 236662306a36Sopenharmony_ci#define AR5K_PHY_TIMING_7 0x9980 236762306a36Sopenharmony_ci#define AR5K_PHY_TIMING_8 0x9984 236862306a36Sopenharmony_ci#define AR5K_PHY_TIMING_8_PILOT_MASK_2 0x000fffff 236962306a36Sopenharmony_ci#define AR5K_PHY_TIMING_8_PILOT_MASK_2_S 0 237062306a36Sopenharmony_ci 237162306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK2_1 0x9988 237262306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK2_2 0x998c 237362306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK2_3 0x9990 237462306a36Sopenharmony_ci 237562306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK2_4 0x9994 237662306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK2_4_MASK_4 0x00003fff 237762306a36Sopenharmony_ci#define AR5K_PHY_BIN_MASK2_4_MASK_4_S 0 237862306a36Sopenharmony_ci 237962306a36Sopenharmony_ci#define AR5K_PHY_TIMING_9 0x9998 238062306a36Sopenharmony_ci#define AR5K_PHY_TIMING_10 0x999c 238162306a36Sopenharmony_ci#define AR5K_PHY_TIMING_10_PILOT_MASK_2 0x000fffff 238262306a36Sopenharmony_ci#define AR5K_PHY_TIMING_10_PILOT_MASK_2_S 0 238362306a36Sopenharmony_ci 238462306a36Sopenharmony_ci/* 238562306a36Sopenharmony_ci * Spur mitigation control 238662306a36Sopenharmony_ci */ 238762306a36Sopenharmony_ci#define AR5K_PHY_TIMING_11 0x99a0 /* Register address */ 238862306a36Sopenharmony_ci#define AR5K_PHY_TIMING_11_SPUR_DELTA_PHASE 0x000fffff /* Spur delta phase */ 238962306a36Sopenharmony_ci#define AR5K_PHY_TIMING_11_SPUR_DELTA_PHASE_S 0 239062306a36Sopenharmony_ci#define AR5K_PHY_TIMING_11_SPUR_FREQ_SD 0x3ff00000 /* Freq sigma delta */ 239162306a36Sopenharmony_ci#define AR5K_PHY_TIMING_11_SPUR_FREQ_SD_S 20 239262306a36Sopenharmony_ci#define AR5K_PHY_TIMING_11_USE_SPUR_IN_AGC 0x40000000 /* Spur filter in AGC detector */ 239362306a36Sopenharmony_ci#define AR5K_PHY_TIMING_11_USE_SPUR_IN_SELFCOR 0x80000000 /* Spur filter in OFDM self correlator */ 239462306a36Sopenharmony_ci 239562306a36Sopenharmony_ci/* 239662306a36Sopenharmony_ci * Gain tables 239762306a36Sopenharmony_ci */ 239862306a36Sopenharmony_ci#define AR5K_BB_GAIN_BASE 0x9b00 /* BaseBand Amplifier Gain table base address */ 239962306a36Sopenharmony_ci#define AR5K_BB_GAIN(_n) (AR5K_BB_GAIN_BASE + ((_n) << 2)) 240062306a36Sopenharmony_ci#define AR5K_RF_GAIN_BASE 0x9a00 /* RF Amplifier Gain table base address */ 240162306a36Sopenharmony_ci#define AR5K_RF_GAIN(_n) (AR5K_RF_GAIN_BASE + ((_n) << 2)) 240262306a36Sopenharmony_ci 240362306a36Sopenharmony_ci/* 240462306a36Sopenharmony_ci * PHY timing IQ calibration result register [5111+] 240562306a36Sopenharmony_ci */ 240662306a36Sopenharmony_ci#define AR5K_PHY_IQRES_CAL_PWR_I 0x9c10 /* I (Inphase) power value */ 240762306a36Sopenharmony_ci#define AR5K_PHY_IQRES_CAL_PWR_Q 0x9c14 /* Q (Quadrature) power value */ 240862306a36Sopenharmony_ci#define AR5K_PHY_IQRES_CAL_CORR 0x9c18 /* I/Q Correlation */ 240962306a36Sopenharmony_ci 241062306a36Sopenharmony_ci/* 241162306a36Sopenharmony_ci * PHY current RSSI register [5111+] 241262306a36Sopenharmony_ci */ 241362306a36Sopenharmony_ci#define AR5K_PHY_CURRENT_RSSI 0x9c1c 241462306a36Sopenharmony_ci 241562306a36Sopenharmony_ci/* 241662306a36Sopenharmony_ci * PHY RF Bus grant register 241762306a36Sopenharmony_ci */ 241862306a36Sopenharmony_ci#define AR5K_PHY_RFBUS_GRANT 0x9c20 241962306a36Sopenharmony_ci#define AR5K_PHY_RFBUS_GRANT_OK 0x00000001 242062306a36Sopenharmony_ci 242162306a36Sopenharmony_ci/* 242262306a36Sopenharmony_ci * PHY ADC test register 242362306a36Sopenharmony_ci */ 242462306a36Sopenharmony_ci#define AR5K_PHY_ADC_TEST 0x9c24 242562306a36Sopenharmony_ci#define AR5K_PHY_ADC_TEST_I 0x00000001 242662306a36Sopenharmony_ci#define AR5K_PHY_ADC_TEST_Q 0x00000200 242762306a36Sopenharmony_ci 242862306a36Sopenharmony_ci/* 242962306a36Sopenharmony_ci * PHY DAC test register 243062306a36Sopenharmony_ci */ 243162306a36Sopenharmony_ci#define AR5K_PHY_DAC_TEST 0x9c28 243262306a36Sopenharmony_ci#define AR5K_PHY_DAC_TEST_I 0x00000001 243362306a36Sopenharmony_ci#define AR5K_PHY_DAC_TEST_Q 0x00000200 243462306a36Sopenharmony_ci 243562306a36Sopenharmony_ci/* 243662306a36Sopenharmony_ci * PHY PTAT register (?) 243762306a36Sopenharmony_ci */ 243862306a36Sopenharmony_ci#define AR5K_PHY_PTAT 0x9c2c 243962306a36Sopenharmony_ci 244062306a36Sopenharmony_ci/* 244162306a36Sopenharmony_ci * PHY Illegal TX rate register [5112+] 244262306a36Sopenharmony_ci */ 244362306a36Sopenharmony_ci#define AR5K_PHY_BAD_TX_RATE 0x9c30 244462306a36Sopenharmony_ci 244562306a36Sopenharmony_ci/* 244662306a36Sopenharmony_ci * PHY SPUR Power register [5112+] 244762306a36Sopenharmony_ci */ 244862306a36Sopenharmony_ci#define AR5K_PHY_SPUR_PWR 0x9c34 /* Register Address */ 244962306a36Sopenharmony_ci#define AR5K_PHY_SPUR_PWR_I 0x00000001 /* SPUR Power estimate for I (field) */ 245062306a36Sopenharmony_ci#define AR5K_PHY_SPUR_PWR_Q 0x00000100 /* SPUR Power estimate for Q (field) */ 245162306a36Sopenharmony_ci#define AR5K_PHY_SPUR_PWR_FILT 0x00010000 /* Power with SPUR removed (field) */ 245262306a36Sopenharmony_ci 245362306a36Sopenharmony_ci/* 245462306a36Sopenharmony_ci * PHY Channel status register [5112+] (?) 245562306a36Sopenharmony_ci */ 245662306a36Sopenharmony_ci#define AR5K_PHY_CHAN_STATUS 0x9c38 245762306a36Sopenharmony_ci#define AR5K_PHY_CHAN_STATUS_BT_ACT 0x00000001 245862306a36Sopenharmony_ci#define AR5K_PHY_CHAN_STATUS_RX_CLR_RAW 0x00000002 245962306a36Sopenharmony_ci#define AR5K_PHY_CHAN_STATUS_RX_CLR_MAC 0x00000004 246062306a36Sopenharmony_ci#define AR5K_PHY_CHAN_STATUS_RX_CLR_PAP 0x00000008 246162306a36Sopenharmony_ci 246262306a36Sopenharmony_ci/* 246362306a36Sopenharmony_ci * Heavy clip enable register 246462306a36Sopenharmony_ci */ 246562306a36Sopenharmony_ci#define AR5K_PHY_HEAVY_CLIP_ENABLE 0x99e0 246662306a36Sopenharmony_ci 246762306a36Sopenharmony_ci/* 246862306a36Sopenharmony_ci * PHY clock sleep registers [5112+] 246962306a36Sopenharmony_ci */ 247062306a36Sopenharmony_ci#define AR5K_PHY_SCLOCK 0x99f0 247162306a36Sopenharmony_ci#define AR5K_PHY_SCLOCK_32MHZ 0x0000000c 247262306a36Sopenharmony_ci#define AR5K_PHY_SDELAY 0x99f4 247362306a36Sopenharmony_ci#define AR5K_PHY_SDELAY_32MHZ 0x000000ff 247462306a36Sopenharmony_ci#define AR5K_PHY_SPENDING 0x99f8 247562306a36Sopenharmony_ci 247662306a36Sopenharmony_ci 247762306a36Sopenharmony_ci/* 247862306a36Sopenharmony_ci * PHY PAPD I (power?) table (?) 247962306a36Sopenharmony_ci * (92! entries) 248062306a36Sopenharmony_ci */ 248162306a36Sopenharmony_ci#define AR5K_PHY_PAPD_I_BASE 0xa000 248262306a36Sopenharmony_ci#define AR5K_PHY_PAPD_I(_n) (AR5K_PHY_PAPD_I_BASE + ((_n) << 2)) 248362306a36Sopenharmony_ci 248462306a36Sopenharmony_ci/* 248562306a36Sopenharmony_ci * PHY PCDAC TX power table 248662306a36Sopenharmony_ci */ 248762306a36Sopenharmony_ci#define AR5K_PHY_PCDAC_TXPOWER_BASE 0xa180 248862306a36Sopenharmony_ci#define AR5K_PHY_PCDAC_TXPOWER(_n) (AR5K_PHY_PCDAC_TXPOWER_BASE + ((_n) << 2)) 248962306a36Sopenharmony_ci 249062306a36Sopenharmony_ci/* 249162306a36Sopenharmony_ci * PHY mode register [5111+] 249262306a36Sopenharmony_ci */ 249362306a36Sopenharmony_ci#define AR5K_PHY_MODE 0x0a200 /* Register Address */ 249462306a36Sopenharmony_ci#define AR5K_PHY_MODE_MOD 0x00000001 /* PHY Modulation bit */ 249562306a36Sopenharmony_ci#define AR5K_PHY_MODE_MOD_OFDM 0 249662306a36Sopenharmony_ci#define AR5K_PHY_MODE_MOD_CCK 1 249762306a36Sopenharmony_ci#define AR5K_PHY_MODE_FREQ 0x00000002 /* Freq mode bit */ 249862306a36Sopenharmony_ci#define AR5K_PHY_MODE_FREQ_5GHZ 0 249962306a36Sopenharmony_ci#define AR5K_PHY_MODE_FREQ_2GHZ 2 250062306a36Sopenharmony_ci#define AR5K_PHY_MODE_MOD_DYN 0x00000004 /* Enable Dynamic OFDM/CCK mode [5112+] */ 250162306a36Sopenharmony_ci#define AR5K_PHY_MODE_RAD 0x00000008 /* [5212+] */ 250262306a36Sopenharmony_ci#define AR5K_PHY_MODE_RAD_RF5111 0 250362306a36Sopenharmony_ci#define AR5K_PHY_MODE_RAD_RF5112 8 250462306a36Sopenharmony_ci#define AR5K_PHY_MODE_XR 0x00000010 /* Enable XR mode [5112+] */ 250562306a36Sopenharmony_ci#define AR5K_PHY_MODE_HALF_RATE 0x00000020 /* Enable Half rate (test) */ 250662306a36Sopenharmony_ci#define AR5K_PHY_MODE_QUARTER_RATE 0x00000040 /* Enable Quarter rat (test) */ 250762306a36Sopenharmony_ci 250862306a36Sopenharmony_ci/* 250962306a36Sopenharmony_ci * PHY CCK transmit control register [5111+ (?)] 251062306a36Sopenharmony_ci */ 251162306a36Sopenharmony_ci#define AR5K_PHY_CCKTXCTL 0xa204 251262306a36Sopenharmony_ci#define AR5K_PHY_CCKTXCTL_WORLD 0x00000000 251362306a36Sopenharmony_ci#define AR5K_PHY_CCKTXCTL_JAPAN 0x00000010 251462306a36Sopenharmony_ci#define AR5K_PHY_CCKTXCTL_SCRAMBLER_DIS 0x00000001 251562306a36Sopenharmony_ci#define AR5K_PHY_CCKTXCTK_DAC_SCALE 0x00000004 251662306a36Sopenharmony_ci 251762306a36Sopenharmony_ci/* 251862306a36Sopenharmony_ci * PHY CCK Cross-correlator Barker RSSI threshold register [5212+] 251962306a36Sopenharmony_ci */ 252062306a36Sopenharmony_ci#define AR5K_PHY_CCK_CROSSCORR 0xa208 252162306a36Sopenharmony_ci#define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR 0x0000003f 252262306a36Sopenharmony_ci#define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR_S 0 252362306a36Sopenharmony_ci 252462306a36Sopenharmony_ci/* Same address is used for antenna diversity activation */ 252562306a36Sopenharmony_ci#define AR5K_PHY_FAST_ANT_DIV 0xa208 252662306a36Sopenharmony_ci#define AR5K_PHY_FAST_ANT_DIV_EN 0x00002000 252762306a36Sopenharmony_ci 252862306a36Sopenharmony_ci/* 252962306a36Sopenharmony_ci * PHY 2GHz gain register [5111+] 253062306a36Sopenharmony_ci */ 253162306a36Sopenharmony_ci#define AR5K_PHY_GAIN_2GHZ 0xa20c 253262306a36Sopenharmony_ci#define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX 0x00fc0000 253362306a36Sopenharmony_ci#define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX_S 18 253462306a36Sopenharmony_ci#define AR5K_PHY_GAIN_2GHZ_INI_5111 0x6480416c 253562306a36Sopenharmony_ci 253662306a36Sopenharmony_ci#define AR5K_PHY_CCK_RX_CTL_4 0xa21c 253762306a36Sopenharmony_ci#define AR5K_PHY_CCK_RX_CTL_4_FREQ_EST_SHORT 0x01f80000 253862306a36Sopenharmony_ci#define AR5K_PHY_CCK_RX_CTL_4_FREQ_EST_SHORT_S 19 253962306a36Sopenharmony_ci 254062306a36Sopenharmony_ci#define AR5K_PHY_DAG_CCK_CTL 0xa228 254162306a36Sopenharmony_ci#define AR5K_PHY_DAG_CCK_CTL_EN_RSSI_THR 0x00000200 254262306a36Sopenharmony_ci#define AR5K_PHY_DAG_CCK_CTL_RSSI_THR 0x0001fc00 254362306a36Sopenharmony_ci#define AR5K_PHY_DAG_CCK_CTL_RSSI_THR_S 10 254462306a36Sopenharmony_ci 254562306a36Sopenharmony_ci#define AR5K_PHY_FAST_ADC 0xa24c 254662306a36Sopenharmony_ci 254762306a36Sopenharmony_ci#define AR5K_PHY_BLUETOOTH 0xa254 254862306a36Sopenharmony_ci 254962306a36Sopenharmony_ci/* 255062306a36Sopenharmony_ci * Transmit Power Control register 255162306a36Sopenharmony_ci * [2413+] 255262306a36Sopenharmony_ci */ 255362306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG1 0xa258 255462306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG1_NUM_PD_GAIN 0x0000c000 255562306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG1_NUM_PD_GAIN_S 14 255662306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG1_PDGAIN_1 0x00030000 255762306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG1_PDGAIN_1_S 16 255862306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG1_PDGAIN_2 0x000c0000 255962306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG1_PDGAIN_2_S 18 256062306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG1_PDGAIN_3 0x00300000 256162306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG1_PDGAIN_3_S 20 256262306a36Sopenharmony_ci 256362306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG5 0xa26C 256462306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP 0x0000000F 256562306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP_S 0 256662306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1 0x000003F0 256762306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1_S 4 256862306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2 0x0000FC00 256962306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2_S 10 257062306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3 0x003F0000 257162306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3_S 16 257262306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4 0x0FC00000 257362306a36Sopenharmony_ci#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4_S 22 257462306a36Sopenharmony_ci 257562306a36Sopenharmony_ci/* 257662306a36Sopenharmony_ci * PHY PDADC Tx power table 257762306a36Sopenharmony_ci */ 257862306a36Sopenharmony_ci#define AR5K_PHY_PDADC_TXPOWER_BASE 0xa280 257962306a36Sopenharmony_ci#define AR5K_PHY_PDADC_TXPOWER(_n) (AR5K_PHY_PDADC_TXPOWER_BASE + ((_n) << 2)) 258062306a36Sopenharmony_ci 258162306a36Sopenharmony_ci/* 258262306a36Sopenharmony_ci * Platform registers for WiSoC 258362306a36Sopenharmony_ci */ 258462306a36Sopenharmony_ci#define AR5K_AR5312_RESET 0xbc003020 258562306a36Sopenharmony_ci#define AR5K_AR5312_RESET_BB0_COLD 0x00000004 258662306a36Sopenharmony_ci#define AR5K_AR5312_RESET_BB1_COLD 0x00000200 258762306a36Sopenharmony_ci#define AR5K_AR5312_RESET_WMAC0 0x00002000 258862306a36Sopenharmony_ci#define AR5K_AR5312_RESET_BB0_WARM 0x00004000 258962306a36Sopenharmony_ci#define AR5K_AR5312_RESET_WMAC1 0x00020000 259062306a36Sopenharmony_ci#define AR5K_AR5312_RESET_BB1_WARM 0x00040000 259162306a36Sopenharmony_ci 259262306a36Sopenharmony_ci#define AR5K_AR5312_ENABLE 0xbc003080 259362306a36Sopenharmony_ci#define AR5K_AR5312_ENABLE_WLAN0 0x00000001 259462306a36Sopenharmony_ci#define AR5K_AR5312_ENABLE_WLAN1 0x00000008 259562306a36Sopenharmony_ci 259662306a36Sopenharmony_ci#define AR5K_AR2315_RESET 0xb1000004 259762306a36Sopenharmony_ci#define AR5K_AR2315_RESET_WMAC 0x00000001 259862306a36Sopenharmony_ci#define AR5K_AR2315_RESET_BB_WARM 0x00000002 259962306a36Sopenharmony_ci 260062306a36Sopenharmony_ci#define AR5K_AR2315_AHB_ARB_CTL 0xb1000008 260162306a36Sopenharmony_ci#define AR5K_AR2315_AHB_ARB_CTL_WLAN 0x00000002 260262306a36Sopenharmony_ci 260362306a36Sopenharmony_ci#define AR5K_AR2315_BYTESWAP 0xb100000c 260462306a36Sopenharmony_ci#define AR5K_AR2315_BYTESWAP_WMAC 0x00000002 2605