1203c4805SLuis R. Rodriguez /* 2b3950e6aSLuis R. Rodriguez * Copyright (c) 2008-2010 Atheros Communications Inc. 3203c4805SLuis R. Rodriguez * 4203c4805SLuis R. Rodriguez * Permission to use, copy, modify, and/or distribute this software for any 5203c4805SLuis R. Rodriguez * purpose with or without fee is hereby granted, provided that the above 6203c4805SLuis R. Rodriguez * copyright notice and this permission notice appear in all copies. 7203c4805SLuis R. Rodriguez * 8203c4805SLuis R. Rodriguez * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9203c4805SLuis R. Rodriguez * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10203c4805SLuis R. Rodriguez * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11203c4805SLuis R. Rodriguez * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12203c4805SLuis R. Rodriguez * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13203c4805SLuis R. Rodriguez * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14203c4805SLuis R. Rodriguez * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15203c4805SLuis R. Rodriguez */ 16203c4805SLuis R. Rodriguez 17203c4805SLuis R. Rodriguez #ifndef HW_H 18203c4805SLuis R. Rodriguez #define HW_H 19203c4805SLuis R. Rodriguez 20203c4805SLuis R. Rodriguez #include <linux/if_ether.h> 21203c4805SLuis R. Rodriguez #include <linux/delay.h> 22203c4805SLuis R. Rodriguez #include <linux/io.h> 23203c4805SLuis R. Rodriguez 24203c4805SLuis R. Rodriguez #include "mac.h" 25203c4805SLuis R. Rodriguez #include "ani.h" 26203c4805SLuis R. Rodriguez #include "eeprom.h" 27203c4805SLuis R. Rodriguez #include "calib.h" 28203c4805SLuis R. Rodriguez #include "reg.h" 29203c4805SLuis R. Rodriguez #include "phy.h" 30af03abecSLuis R. Rodriguez #include "btcoex.h" 31203c4805SLuis R. Rodriguez 32203c4805SLuis R. Rodriguez #include "../regd.h" 33c46917bbSLuis R. Rodriguez #include "../debug.h" 34203c4805SLuis R. Rodriguez 35203c4805SLuis R. Rodriguez #define ATHEROS_VENDOR_ID 0x168c 367976b426SLuis R. Rodriguez 37203c4805SLuis R. Rodriguez #define AR5416_DEVID_PCI 0x0023 38203c4805SLuis R. Rodriguez #define AR5416_DEVID_PCIE 0x0024 39203c4805SLuis R. Rodriguez #define AR9160_DEVID_PCI 0x0027 40203c4805SLuis R. Rodriguez #define AR9280_DEVID_PCI 0x0029 41203c4805SLuis R. Rodriguez #define AR9280_DEVID_PCIE 0x002a 42203c4805SLuis R. Rodriguez #define AR9285_DEVID_PCIE 0x002b 435ffaf8a3SLuis R. Rodriguez #define AR2427_DEVID_PCIE 0x002c 44db3cc53aSSenthil Balasubramanian #define AR9287_DEVID_PCI 0x002d 45db3cc53aSSenthil Balasubramanian #define AR9287_DEVID_PCIE 0x002e 46db3cc53aSSenthil Balasubramanian #define AR9300_DEVID_PCIE 0x0030 477976b426SLuis R. Rodriguez 48203c4805SLuis R. Rodriguez #define AR5416_AR9100_DEVID 0x000b 497976b426SLuis R. Rodriguez 50203c4805SLuis R. Rodriguez #define AR_SUBVENDOR_ID_NOG 0x0e11 51203c4805SLuis R. Rodriguez #define AR_SUBVENDOR_ID_NEW_A 0x7065 52203c4805SLuis R. Rodriguez #define AR5416_MAGIC 0x19641014 53203c4805SLuis R. Rodriguez 54fe12946eSVasanthakumar Thiagarajan #define AR9280_COEX2WIRE_SUBSYSID 0x309b 55fe12946eSVasanthakumar Thiagarajan #define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa 56fe12946eSVasanthakumar Thiagarajan #define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab 57fe12946eSVasanthakumar Thiagarajan 58e3d01bfcSLuis R. Rodriguez #define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1) 59e3d01bfcSLuis R. Rodriguez 60cfe8cba9SLuis R. Rodriguez #define ATH_DEFAULT_NOISE_FLOOR -95 61cfe8cba9SLuis R. Rodriguez 6204658fbaSJohn W. Linville #define ATH9K_RSSI_BAD -128 63990b70abSLuis R. Rodriguez 64203c4805SLuis R. Rodriguez /* Register read/write primitives */ 659e4bffd2SLuis R. Rodriguez #define REG_WRITE(_ah, _reg, _val) \ 669e4bffd2SLuis R. Rodriguez ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) 679e4bffd2SLuis R. Rodriguez 689e4bffd2SLuis R. Rodriguez #define REG_READ(_ah, _reg) \ 699e4bffd2SLuis R. Rodriguez ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) 70203c4805SLuis R. Rodriguez 7120b3efd9SSujith #define ENABLE_REGWRITE_BUFFER(_ah) \ 7220b3efd9SSujith do { \ 7320b3efd9SSujith if (AR_SREV_9271(_ah)) \ 7420b3efd9SSujith ath9k_hw_common(_ah)->ops->enable_write_buffer((_ah)); \ 7520b3efd9SSujith } while (0) 7620b3efd9SSujith 7720b3efd9SSujith #define DISABLE_REGWRITE_BUFFER(_ah) \ 7820b3efd9SSujith do { \ 7920b3efd9SSujith if (AR_SREV_9271(_ah)) \ 8020b3efd9SSujith ath9k_hw_common(_ah)->ops->disable_write_buffer((_ah)); \ 8120b3efd9SSujith } while (0) 8220b3efd9SSujith 8320b3efd9SSujith #define REGWRITE_BUFFER_FLUSH(_ah) \ 8420b3efd9SSujith do { \ 8520b3efd9SSujith if (AR_SREV_9271(_ah)) \ 8620b3efd9SSujith ath9k_hw_common(_ah)->ops->write_flush((_ah)); \ 8720b3efd9SSujith } while (0) 8820b3efd9SSujith 89203c4805SLuis R. Rodriguez #define SM(_v, _f) (((_v) << _f##_S) & _f) 90203c4805SLuis R. Rodriguez #define MS(_v, _f) (((_v) & _f) >> _f##_S) 91203c4805SLuis R. Rodriguez #define REG_RMW(_a, _r, _set, _clr) \ 92203c4805SLuis R. Rodriguez REG_WRITE(_a, _r, (REG_READ(_a, _r) & ~(_clr)) | (_set)) 93203c4805SLuis R. Rodriguez #define REG_RMW_FIELD(_a, _r, _f, _v) \ 94203c4805SLuis R. Rodriguez REG_WRITE(_a, _r, \ 95203c4805SLuis R. Rodriguez (REG_READ(_a, _r) & ~_f) | (((_v) << _f##_S) & _f)) 961547da37SLuis R. Rodriguez #define REG_READ_FIELD(_a, _r, _f) \ 971547da37SLuis R. Rodriguez (((REG_READ(_a, _r) & _f) >> _f##_S)) 98203c4805SLuis R. Rodriguez #define REG_SET_BIT(_a, _r, _f) \ 99203c4805SLuis R. Rodriguez REG_WRITE(_a, _r, REG_READ(_a, _r) | _f) 100203c4805SLuis R. Rodriguez #define REG_CLR_BIT(_a, _r, _f) \ 101203c4805SLuis R. Rodriguez REG_WRITE(_a, _r, REG_READ(_a, _r) & ~_f) 102203c4805SLuis R. Rodriguez 103203c4805SLuis R. Rodriguez #define DO_DELAY(x) do { \ 104203c4805SLuis R. Rodriguez if ((++(x) % 64) == 0) \ 105203c4805SLuis R. Rodriguez udelay(1); \ 106203c4805SLuis R. Rodriguez } while (0) 107203c4805SLuis R. Rodriguez 108203c4805SLuis R. Rodriguez #define REG_WRITE_ARRAY(iniarray, column, regWr) do { \ 109203c4805SLuis R. Rodriguez int r; \ 110203c4805SLuis R. Rodriguez for (r = 0; r < ((iniarray)->ia_rows); r++) { \ 111203c4805SLuis R. Rodriguez REG_WRITE(ah, INI_RA((iniarray), (r), 0), \ 112203c4805SLuis R. Rodriguez INI_RA((iniarray), r, (column))); \ 113203c4805SLuis R. Rodriguez DO_DELAY(regWr); \ 114203c4805SLuis R. Rodriguez } \ 115203c4805SLuis R. Rodriguez } while (0) 116203c4805SLuis R. Rodriguez 117203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0 118203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1 119203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED 2 120203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_TX_FRAME 3 1211773912bSVasanthakumar Thiagarajan #define AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL 4 122203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED 5 123203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED 6 124203c4805SLuis R. Rodriguez 125203c4805SLuis R. Rodriguez #define AR_GPIOD_MASK 0x00001FFF 126203c4805SLuis R. Rodriguez #define AR_GPIO_BIT(_gpio) (1 << (_gpio)) 127203c4805SLuis R. Rodriguez 128203c4805SLuis R. Rodriguez #define BASE_ACTIVATE_DELAY 100 12963a75b91SSenthil Balasubramanian #define RTC_PLL_SETTLE_DELAY 100 130203c4805SLuis R. Rodriguez #define COEF_SCALE_S 24 131203c4805SLuis R. Rodriguez #define HT40_CHANNEL_CENTER_SHIFT 10 132203c4805SLuis R. Rodriguez 133203c4805SLuis R. Rodriguez #define ATH9K_ANTENNA0_CHAINMASK 0x1 134203c4805SLuis R. Rodriguez #define ATH9K_ANTENNA1_CHAINMASK 0x2 135203c4805SLuis R. Rodriguez 136203c4805SLuis R. Rodriguez #define ATH9K_NUM_DMA_DEBUG_REGS 8 137203c4805SLuis R. Rodriguez #define ATH9K_NUM_QUEUES 10 138203c4805SLuis R. Rodriguez 139203c4805SLuis R. Rodriguez #define MAX_RATE_POWER 63 140203c4805SLuis R. Rodriguez #define AH_WAIT_TIMEOUT 100000 /* (us) */ 141f9b604f6SGabor Juhos #define AH_TSF_WRITE_TIMEOUT 100 /* (us) */ 142203c4805SLuis R. Rodriguez #define AH_TIME_QUANTUM 10 143203c4805SLuis R. Rodriguez #define AR_KEYTABLE_SIZE 128 144d8caa839SSujith #define POWER_UP_TIME 10000 145203c4805SLuis R. Rodriguez #define SPUR_RSSI_THRESH 40 146203c4805SLuis R. Rodriguez 147203c4805SLuis R. Rodriguez #define CAB_TIMEOUT_VAL 10 148203c4805SLuis R. Rodriguez #define BEACON_TIMEOUT_VAL 10 149203c4805SLuis R. Rodriguez #define MIN_BEACON_TIMEOUT_VAL 1 150203c4805SLuis R. Rodriguez #define SLEEP_SLOP 3 151203c4805SLuis R. Rodriguez 152203c4805SLuis R. Rodriguez #define INIT_CONFIG_STATUS 0x00000000 153203c4805SLuis R. Rodriguez #define INIT_RSSI_THR 0x00000700 154203c4805SLuis R. Rodriguez #define INIT_BCON_CNTRL_REG 0x00000000 155203c4805SLuis R. Rodriguez 156203c4805SLuis R. Rodriguez #define TU_TO_USEC(_tu) ((_tu) << 10) 157203c4805SLuis R. Rodriguez 158ceb26445SVasanthakumar Thiagarajan #define ATH9K_HW_RX_HP_QDEPTH 16 159ceb26445SVasanthakumar Thiagarajan #define ATH9K_HW_RX_LP_QDEPTH 128 160ceb26445SVasanthakumar Thiagarajan 16113ce3e99SLuis R. Rodriguez enum ath_ini_subsys { 16213ce3e99SLuis R. Rodriguez ATH_INI_PRE = 0, 16313ce3e99SLuis R. Rodriguez ATH_INI_CORE, 16413ce3e99SLuis R. Rodriguez ATH_INI_POST, 16513ce3e99SLuis R. Rodriguez ATH_INI_NUM_SPLIT, 16613ce3e99SLuis R. Rodriguez }; 16713ce3e99SLuis R. Rodriguez 168203c4805SLuis R. Rodriguez enum wireless_mode { 169203c4805SLuis R. Rodriguez ATH9K_MODE_11A = 0, 170b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11G, 171b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NA_HT20, 172b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NG_HT20, 173b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NA_HT40PLUS, 174b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NA_HT40MINUS, 175b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NG_HT40PLUS, 176b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NG_HT40MINUS, 177b9b6e15aSLuis R. Rodriguez ATH9K_MODE_MAX, 178203c4805SLuis R. Rodriguez }; 179203c4805SLuis R. Rodriguez 180203c4805SLuis R. Rodriguez enum ath9k_hw_caps { 181203c4805SLuis R. Rodriguez ATH9K_HW_CAP_MIC_AESCCM = BIT(0), 182203c4805SLuis R. Rodriguez ATH9K_HW_CAP_MIC_CKIP = BIT(1), 183203c4805SLuis R. Rodriguez ATH9K_HW_CAP_MIC_TKIP = BIT(2), 184203c4805SLuis R. Rodriguez ATH9K_HW_CAP_CIPHER_AESCCM = BIT(3), 185203c4805SLuis R. Rodriguez ATH9K_HW_CAP_CIPHER_CKIP = BIT(4), 186203c4805SLuis R. Rodriguez ATH9K_HW_CAP_CIPHER_TKIP = BIT(5), 187203c4805SLuis R. Rodriguez ATH9K_HW_CAP_VEOL = BIT(6), 188203c4805SLuis R. Rodriguez ATH9K_HW_CAP_BSSIDMASK = BIT(7), 189203c4805SLuis R. Rodriguez ATH9K_HW_CAP_MCAST_KEYSEARCH = BIT(8), 190203c4805SLuis R. Rodriguez ATH9K_HW_CAP_HT = BIT(9), 191203c4805SLuis R. Rodriguez ATH9K_HW_CAP_GTT = BIT(10), 192203c4805SLuis R. Rodriguez ATH9K_HW_CAP_FASTCC = BIT(11), 193203c4805SLuis R. Rodriguez ATH9K_HW_CAP_RFSILENT = BIT(12), 194203c4805SLuis R. Rodriguez ATH9K_HW_CAP_CST = BIT(13), 195203c4805SLuis R. Rodriguez ATH9K_HW_CAP_ENHANCEDPM = BIT(14), 196203c4805SLuis R. Rodriguez ATH9K_HW_CAP_AUTOSLEEP = BIT(15), 197203c4805SLuis R. Rodriguez ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(16), 1981adf02ffSVasanthakumar Thiagarajan ATH9K_HW_CAP_EDMA = BIT(17), 1996c84ce08SVasanthakumar Thiagarajan ATH9K_HW_CAP_RAC_SUPPORTED = BIT(18), 200ce01805aSLuis R. Rodriguez ATH9K_HW_CAP_LDPC = BIT(19), 201e5553724SVasanthakumar Thiagarajan ATH9K_HW_CAP_FASTCLOCK = BIT(20), 2026473d24dSVasanthakumar Thiagarajan ATH9K_HW_CAP_SGI_20 = BIT(21), 203203c4805SLuis R. Rodriguez }; 204203c4805SLuis R. Rodriguez 205203c4805SLuis R. Rodriguez enum ath9k_capability_type { 206203c4805SLuis R. Rodriguez ATH9K_CAP_CIPHER = 0, 207203c4805SLuis R. Rodriguez ATH9K_CAP_TKIP_MIC, 208203c4805SLuis R. Rodriguez ATH9K_CAP_TKIP_SPLIT, 209203c4805SLuis R. Rodriguez ATH9K_CAP_TXPOW, 210203c4805SLuis R. Rodriguez ATH9K_CAP_MCAST_KEYSRCH, 211203c4805SLuis R. Rodriguez ATH9K_CAP_DS 212203c4805SLuis R. Rodriguez }; 213203c4805SLuis R. Rodriguez 214203c4805SLuis R. Rodriguez struct ath9k_hw_capabilities { 215203c4805SLuis R. Rodriguez u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */ 216203c4805SLuis R. Rodriguez DECLARE_BITMAP(wireless_modes, ATH9K_MODE_MAX); /* ATH9K_MODE_* */ 217203c4805SLuis R. Rodriguez u16 total_queues; 218203c4805SLuis R. Rodriguez u16 keycache_size; 219203c4805SLuis R. Rodriguez u16 low_5ghz_chan, high_5ghz_chan; 220203c4805SLuis R. Rodriguez u16 low_2ghz_chan, high_2ghz_chan; 221203c4805SLuis R. Rodriguez u16 rts_aggr_limit; 222203c4805SLuis R. Rodriguez u8 tx_chainmask; 223203c4805SLuis R. Rodriguez u8 rx_chainmask; 224203c4805SLuis R. Rodriguez u16 tx_triglevel_max; 225203c4805SLuis R. Rodriguez u16 reg_cap; 226203c4805SLuis R. Rodriguez u8 num_gpio_pins; 227203c4805SLuis R. Rodriguez u8 num_antcfg_2ghz; 228203c4805SLuis R. Rodriguez u8 num_antcfg_5ghz; 229ceb26445SVasanthakumar Thiagarajan u8 rx_hp_qdepth; 230ceb26445SVasanthakumar Thiagarajan u8 rx_lp_qdepth; 231ceb26445SVasanthakumar Thiagarajan u8 rx_status_len; 232162c3be3SVasanthakumar Thiagarajan u8 tx_desc_len; 2335088c2f1SVasanthakumar Thiagarajan u8 txs_len; 234203c4805SLuis R. Rodriguez }; 235203c4805SLuis R. Rodriguez 236203c4805SLuis R. Rodriguez struct ath9k_ops_config { 237203c4805SLuis R. Rodriguez int dma_beacon_response_time; 238203c4805SLuis R. Rodriguez int sw_beacon_response_time; 239203c4805SLuis R. Rodriguez int additional_swba_backoff; 240203c4805SLuis R. Rodriguez int ack_6mb; 241203c4805SLuis R. Rodriguez int cwm_ignore_extcca; 242203c4805SLuis R. Rodriguez u8 pcie_powersave_enable; 243203c4805SLuis R. Rodriguez u8 pcie_clock_req; 244203c4805SLuis R. Rodriguez u32 pcie_waen; 245203c4805SLuis R. Rodriguez u8 analog_shiftreg; 246203c4805SLuis R. Rodriguez u8 ht_enable; 247203c4805SLuis R. Rodriguez u32 ofdm_trig_low; 248203c4805SLuis R. Rodriguez u32 ofdm_trig_high; 249203c4805SLuis R. Rodriguez u32 cck_trig_high; 250203c4805SLuis R. Rodriguez u32 cck_trig_low; 251203c4805SLuis R. Rodriguez u32 enable_ani; 252203c4805SLuis R. Rodriguez int serialize_regmode; 2530ce024cbSSujith bool rx_intr_mitigation; 25455e82df4SVasanthakumar Thiagarajan bool tx_intr_mitigation; 255203c4805SLuis R. Rodriguez #define SPUR_DISABLE 0 256203c4805SLuis R. Rodriguez #define SPUR_ENABLE_IOCTL 1 257203c4805SLuis R. Rodriguez #define SPUR_ENABLE_EEPROM 2 258203c4805SLuis R. Rodriguez #define AR_EEPROM_MODAL_SPURS 5 259203c4805SLuis R. Rodriguez #define AR_SPUR_5413_1 1640 260203c4805SLuis R. Rodriguez #define AR_SPUR_5413_2 1200 261203c4805SLuis R. Rodriguez #define AR_NO_SPUR 0x8000 262203c4805SLuis R. Rodriguez #define AR_BASE_FREQ_2GHZ 2300 263203c4805SLuis R. Rodriguez #define AR_BASE_FREQ_5GHZ 4900 264203c4805SLuis R. Rodriguez #define AR_SPUR_FEEQ_BOUND_HT40 19 265203c4805SLuis R. Rodriguez #define AR_SPUR_FEEQ_BOUND_HT20 10 266203c4805SLuis R. Rodriguez int spurmode; 267203c4805SLuis R. Rodriguez u16 spurchans[AR_EEPROM_MODAL_SPURS][2]; 268f4709fdfSLuis R. Rodriguez u8 max_txtrig_level; 269203c4805SLuis R. Rodriguez }; 270203c4805SLuis R. Rodriguez 271203c4805SLuis R. Rodriguez enum ath9k_int { 272203c4805SLuis R. Rodriguez ATH9K_INT_RX = 0x00000001, 273203c4805SLuis R. Rodriguez ATH9K_INT_RXDESC = 0x00000002, 274b5c80475SFelix Fietkau ATH9K_INT_RXHP = 0x00000001, 275b5c80475SFelix Fietkau ATH9K_INT_RXLP = 0x00000002, 276203c4805SLuis R. Rodriguez ATH9K_INT_RXNOFRM = 0x00000008, 277203c4805SLuis R. Rodriguez ATH9K_INT_RXEOL = 0x00000010, 278203c4805SLuis R. Rodriguez ATH9K_INT_RXORN = 0x00000020, 279203c4805SLuis R. Rodriguez ATH9K_INT_TX = 0x00000040, 280203c4805SLuis R. Rodriguez ATH9K_INT_TXDESC = 0x00000080, 281203c4805SLuis R. Rodriguez ATH9K_INT_TIM_TIMER = 0x00000100, 282aea702b7SLuis R. Rodriguez ATH9K_INT_BB_WATCHDOG = 0x00000400, 283203c4805SLuis R. Rodriguez ATH9K_INT_TXURN = 0x00000800, 284203c4805SLuis R. Rodriguez ATH9K_INT_MIB = 0x00001000, 285203c4805SLuis R. Rodriguez ATH9K_INT_RXPHY = 0x00004000, 286203c4805SLuis R. Rodriguez ATH9K_INT_RXKCM = 0x00008000, 287203c4805SLuis R. Rodriguez ATH9K_INT_SWBA = 0x00010000, 288203c4805SLuis R. Rodriguez ATH9K_INT_BMISS = 0x00040000, 289203c4805SLuis R. Rodriguez ATH9K_INT_BNR = 0x00100000, 290203c4805SLuis R. Rodriguez ATH9K_INT_TIM = 0x00200000, 291203c4805SLuis R. Rodriguez ATH9K_INT_DTIM = 0x00400000, 292203c4805SLuis R. Rodriguez ATH9K_INT_DTIMSYNC = 0x00800000, 293203c4805SLuis R. Rodriguez ATH9K_INT_GPIO = 0x01000000, 294203c4805SLuis R. Rodriguez ATH9K_INT_CABEND = 0x02000000, 295203c4805SLuis R. Rodriguez ATH9K_INT_TSFOOR = 0x04000000, 296ff155a45SVasanthakumar Thiagarajan ATH9K_INT_GENTIMER = 0x08000000, 297203c4805SLuis R. Rodriguez ATH9K_INT_CST = 0x10000000, 298203c4805SLuis R. Rodriguez ATH9K_INT_GTT = 0x20000000, 299203c4805SLuis R. Rodriguez ATH9K_INT_FATAL = 0x40000000, 300203c4805SLuis R. Rodriguez ATH9K_INT_GLOBAL = 0x80000000, 301203c4805SLuis R. Rodriguez ATH9K_INT_BMISC = ATH9K_INT_TIM | 302203c4805SLuis R. Rodriguez ATH9K_INT_DTIM | 303203c4805SLuis R. Rodriguez ATH9K_INT_DTIMSYNC | 304203c4805SLuis R. Rodriguez ATH9K_INT_TSFOOR | 305203c4805SLuis R. Rodriguez ATH9K_INT_CABEND, 306203c4805SLuis R. Rodriguez ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM | 307203c4805SLuis R. Rodriguez ATH9K_INT_RXDESC | 308203c4805SLuis R. Rodriguez ATH9K_INT_RXEOL | 309203c4805SLuis R. Rodriguez ATH9K_INT_RXORN | 310203c4805SLuis R. Rodriguez ATH9K_INT_TXURN | 311203c4805SLuis R. Rodriguez ATH9K_INT_TXDESC | 312203c4805SLuis R. Rodriguez ATH9K_INT_MIB | 313203c4805SLuis R. Rodriguez ATH9K_INT_RXPHY | 314203c4805SLuis R. Rodriguez ATH9K_INT_RXKCM | 315203c4805SLuis R. Rodriguez ATH9K_INT_SWBA | 316203c4805SLuis R. Rodriguez ATH9K_INT_BMISS | 317203c4805SLuis R. Rodriguez ATH9K_INT_GPIO, 318203c4805SLuis R. Rodriguez ATH9K_INT_NOCARD = 0xffffffff 319203c4805SLuis R. Rodriguez }; 320203c4805SLuis R. Rodriguez 321203c4805SLuis R. Rodriguez #define CHANNEL_CW_INT 0x00002 322203c4805SLuis R. Rodriguez #define CHANNEL_CCK 0x00020 323203c4805SLuis R. Rodriguez #define CHANNEL_OFDM 0x00040 324203c4805SLuis R. Rodriguez #define CHANNEL_2GHZ 0x00080 325203c4805SLuis R. Rodriguez #define CHANNEL_5GHZ 0x00100 326203c4805SLuis R. Rodriguez #define CHANNEL_PASSIVE 0x00200 327203c4805SLuis R. Rodriguez #define CHANNEL_DYN 0x00400 328203c4805SLuis R. Rodriguez #define CHANNEL_HALF 0x04000 329203c4805SLuis R. Rodriguez #define CHANNEL_QUARTER 0x08000 330203c4805SLuis R. Rodriguez #define CHANNEL_HT20 0x10000 331203c4805SLuis R. Rodriguez #define CHANNEL_HT40PLUS 0x20000 332203c4805SLuis R. Rodriguez #define CHANNEL_HT40MINUS 0x40000 333203c4805SLuis R. Rodriguez 334203c4805SLuis R. Rodriguez #define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM) 335203c4805SLuis R. Rodriguez #define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK) 336203c4805SLuis R. Rodriguez #define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM) 337203c4805SLuis R. Rodriguez #define CHANNEL_G_HT20 (CHANNEL_2GHZ|CHANNEL_HT20) 338203c4805SLuis R. Rodriguez #define CHANNEL_A_HT20 (CHANNEL_5GHZ|CHANNEL_HT20) 339203c4805SLuis R. Rodriguez #define CHANNEL_G_HT40PLUS (CHANNEL_2GHZ|CHANNEL_HT40PLUS) 340203c4805SLuis R. Rodriguez #define CHANNEL_G_HT40MINUS (CHANNEL_2GHZ|CHANNEL_HT40MINUS) 341203c4805SLuis R. Rodriguez #define CHANNEL_A_HT40PLUS (CHANNEL_5GHZ|CHANNEL_HT40PLUS) 342203c4805SLuis R. Rodriguez #define CHANNEL_A_HT40MINUS (CHANNEL_5GHZ|CHANNEL_HT40MINUS) 343203c4805SLuis R. Rodriguez #define CHANNEL_ALL \ 344203c4805SLuis R. Rodriguez (CHANNEL_OFDM| \ 345203c4805SLuis R. Rodriguez CHANNEL_CCK| \ 346203c4805SLuis R. Rodriguez CHANNEL_2GHZ | \ 347203c4805SLuis R. Rodriguez CHANNEL_5GHZ | \ 348203c4805SLuis R. Rodriguez CHANNEL_HT20 | \ 349203c4805SLuis R. Rodriguez CHANNEL_HT40PLUS | \ 350203c4805SLuis R. Rodriguez CHANNEL_HT40MINUS) 351203c4805SLuis R. Rodriguez 352203c4805SLuis R. Rodriguez struct ath9k_channel { 353203c4805SLuis R. Rodriguez struct ieee80211_channel *chan; 354203c4805SLuis R. Rodriguez u16 channel; 355203c4805SLuis R. Rodriguez u32 channelFlags; 356203c4805SLuis R. Rodriguez u32 chanmode; 357203c4805SLuis R. Rodriguez int32_t CalValid; 358203c4805SLuis R. Rodriguez bool oneTimeCalsDone; 359203c4805SLuis R. Rodriguez int8_t iCoff; 360203c4805SLuis R. Rodriguez int8_t qCoff; 361203c4805SLuis R. Rodriguez int16_t rawNoiseFloor; 362203c4805SLuis R. Rodriguez }; 363203c4805SLuis R. Rodriguez 364203c4805SLuis R. Rodriguez #define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \ 365203c4805SLuis R. Rodriguez (((_c)->channelFlags & CHANNEL_G_HT20) == CHANNEL_G_HT20) || \ 366203c4805SLuis R. Rodriguez (((_c)->channelFlags & CHANNEL_G_HT40PLUS) == CHANNEL_G_HT40PLUS) || \ 367203c4805SLuis R. Rodriguez (((_c)->channelFlags & CHANNEL_G_HT40MINUS) == CHANNEL_G_HT40MINUS)) 368203c4805SLuis R. Rodriguez #define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0) 369203c4805SLuis R. Rodriguez #define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0) 370203c4805SLuis R. Rodriguez #define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0) 371203c4805SLuis R. Rodriguez #define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0) 372203c4805SLuis R. Rodriguez #define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0) 3736b42e8d0SFelix Fietkau #define IS_CHAN_A_FAST_CLOCK(_ah, _c) \ 374203c4805SLuis R. Rodriguez ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) && \ 3756b42e8d0SFelix Fietkau ((_ah)->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK)) 376203c4805SLuis R. Rodriguez 377203c4805SLuis R. Rodriguez /* These macros check chanmode and not channelFlags */ 378203c4805SLuis R. Rodriguez #define IS_CHAN_B(_c) ((_c)->chanmode == CHANNEL_B) 379203c4805SLuis R. Rodriguez #define IS_CHAN_HT20(_c) (((_c)->chanmode == CHANNEL_A_HT20) || \ 380203c4805SLuis R. Rodriguez ((_c)->chanmode == CHANNEL_G_HT20)) 381203c4805SLuis R. Rodriguez #define IS_CHAN_HT40(_c) (((_c)->chanmode == CHANNEL_A_HT40PLUS) || \ 382203c4805SLuis R. Rodriguez ((_c)->chanmode == CHANNEL_A_HT40MINUS) || \ 383203c4805SLuis R. Rodriguez ((_c)->chanmode == CHANNEL_G_HT40PLUS) || \ 384203c4805SLuis R. Rodriguez ((_c)->chanmode == CHANNEL_G_HT40MINUS)) 385203c4805SLuis R. Rodriguez #define IS_CHAN_HT(_c) (IS_CHAN_HT20((_c)) || IS_CHAN_HT40((_c))) 386203c4805SLuis R. Rodriguez 387203c4805SLuis R. Rodriguez enum ath9k_power_mode { 388203c4805SLuis R. Rodriguez ATH9K_PM_AWAKE = 0, 389203c4805SLuis R. Rodriguez ATH9K_PM_FULL_SLEEP, 390203c4805SLuis R. Rodriguez ATH9K_PM_NETWORK_SLEEP, 391203c4805SLuis R. Rodriguez ATH9K_PM_UNDEFINED 392203c4805SLuis R. Rodriguez }; 393203c4805SLuis R. Rodriguez 394203c4805SLuis R. Rodriguez enum ath9k_tp_scale { 395203c4805SLuis R. Rodriguez ATH9K_TP_SCALE_MAX = 0, 396203c4805SLuis R. Rodriguez ATH9K_TP_SCALE_50, 397203c4805SLuis R. Rodriguez ATH9K_TP_SCALE_25, 398203c4805SLuis R. Rodriguez ATH9K_TP_SCALE_12, 399203c4805SLuis R. Rodriguez ATH9K_TP_SCALE_MIN 400203c4805SLuis R. Rodriguez }; 401203c4805SLuis R. Rodriguez 402203c4805SLuis R. Rodriguez enum ser_reg_mode { 403203c4805SLuis R. Rodriguez SER_REG_MODE_OFF = 0, 404203c4805SLuis R. Rodriguez SER_REG_MODE_ON = 1, 405203c4805SLuis R. Rodriguez SER_REG_MODE_AUTO = 2, 406203c4805SLuis R. Rodriguez }; 407203c4805SLuis R. Rodriguez 408ad7b8060SVasanthakumar Thiagarajan enum ath9k_rx_qtype { 409ad7b8060SVasanthakumar Thiagarajan ATH9K_RX_QUEUE_HP, 410ad7b8060SVasanthakumar Thiagarajan ATH9K_RX_QUEUE_LP, 411ad7b8060SVasanthakumar Thiagarajan ATH9K_RX_QUEUE_MAX, 412ad7b8060SVasanthakumar Thiagarajan }; 413ad7b8060SVasanthakumar Thiagarajan 414203c4805SLuis R. Rodriguez struct ath9k_beacon_state { 415203c4805SLuis R. Rodriguez u32 bs_nexttbtt; 416203c4805SLuis R. Rodriguez u32 bs_nextdtim; 417203c4805SLuis R. Rodriguez u32 bs_intval; 418203c4805SLuis R. Rodriguez #define ATH9K_BEACON_PERIOD 0x0000ffff 419203c4805SLuis R. Rodriguez #define ATH9K_BEACON_ENA 0x00800000 420203c4805SLuis R. Rodriguez #define ATH9K_BEACON_RESET_TSF 0x01000000 421203c4805SLuis R. Rodriguez #define ATH9K_TSFOOR_THRESHOLD 0x00004240 /* 16k us */ 422203c4805SLuis R. Rodriguez u32 bs_dtimperiod; 423203c4805SLuis R. Rodriguez u16 bs_cfpperiod; 424203c4805SLuis R. Rodriguez u16 bs_cfpmaxduration; 425203c4805SLuis R. Rodriguez u32 bs_cfpnext; 426203c4805SLuis R. Rodriguez u16 bs_timoffset; 427203c4805SLuis R. Rodriguez u16 bs_bmissthreshold; 428203c4805SLuis R. Rodriguez u32 bs_sleepduration; 429203c4805SLuis R. Rodriguez u32 bs_tsfoor_threshold; 430203c4805SLuis R. Rodriguez }; 431203c4805SLuis R. Rodriguez 432203c4805SLuis R. Rodriguez struct chan_centers { 433203c4805SLuis R. Rodriguez u16 synth_center; 434203c4805SLuis R. Rodriguez u16 ctl_center; 435203c4805SLuis R. Rodriguez u16 ext_center; 436203c4805SLuis R. Rodriguez }; 437203c4805SLuis R. Rodriguez 438203c4805SLuis R. Rodriguez enum { 439203c4805SLuis R. Rodriguez ATH9K_RESET_POWER_ON, 440203c4805SLuis R. Rodriguez ATH9K_RESET_WARM, 441203c4805SLuis R. Rodriguez ATH9K_RESET_COLD, 442203c4805SLuis R. Rodriguez }; 443203c4805SLuis R. Rodriguez 444203c4805SLuis R. Rodriguez struct ath9k_hw_version { 445203c4805SLuis R. Rodriguez u32 magic; 446203c4805SLuis R. Rodriguez u16 devid; 447203c4805SLuis R. Rodriguez u16 subvendorid; 448203c4805SLuis R. Rodriguez u32 macVersion; 449203c4805SLuis R. Rodriguez u16 macRev; 450203c4805SLuis R. Rodriguez u16 phyRev; 451203c4805SLuis R. Rodriguez u16 analog5GhzRev; 452203c4805SLuis R. Rodriguez u16 analog2GhzRev; 453aeac355dSVasanthakumar Thiagarajan u16 subsysid; 454203c4805SLuis R. Rodriguez }; 455203c4805SLuis R. Rodriguez 456ff155a45SVasanthakumar Thiagarajan /* Generic TSF timer definitions */ 457ff155a45SVasanthakumar Thiagarajan 458ff155a45SVasanthakumar Thiagarajan #define ATH_MAX_GEN_TIMER 16 459ff155a45SVasanthakumar Thiagarajan 460ff155a45SVasanthakumar Thiagarajan #define AR_GENTMR_BIT(_index) (1 << (_index)) 461ff155a45SVasanthakumar Thiagarajan 462ff155a45SVasanthakumar Thiagarajan /* 46377c2061dSWalter Goldens * Using de Bruijin sequence to look up 1's index in a 32 bit number 464ff155a45SVasanthakumar Thiagarajan * debruijn32 = 0000 0111 0111 1100 1011 0101 0011 0001 465ff155a45SVasanthakumar Thiagarajan */ 466c90017ddSVasanthakumar Thiagarajan #define debruijn32 0x077CB531U 467ff155a45SVasanthakumar Thiagarajan 468ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer_configuration { 469ff155a45SVasanthakumar Thiagarajan u32 next_addr; 470ff155a45SVasanthakumar Thiagarajan u32 period_addr; 471ff155a45SVasanthakumar Thiagarajan u32 mode_addr; 472ff155a45SVasanthakumar Thiagarajan u32 mode_mask; 473ff155a45SVasanthakumar Thiagarajan }; 474ff155a45SVasanthakumar Thiagarajan 475ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer { 476ff155a45SVasanthakumar Thiagarajan void (*trigger)(void *arg); 477ff155a45SVasanthakumar Thiagarajan void (*overflow)(void *arg); 478ff155a45SVasanthakumar Thiagarajan void *arg; 479ff155a45SVasanthakumar Thiagarajan u8 index; 480ff155a45SVasanthakumar Thiagarajan }; 481ff155a45SVasanthakumar Thiagarajan 482ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer_table { 483ff155a45SVasanthakumar Thiagarajan u32 gen_timer_index[32]; 484ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer *timers[ATH_MAX_GEN_TIMER]; 485ff155a45SVasanthakumar Thiagarajan union { 486ff155a45SVasanthakumar Thiagarajan unsigned long timer_bits; 487ff155a45SVasanthakumar Thiagarajan u16 val; 488ff155a45SVasanthakumar Thiagarajan } timer_mask; 489ff155a45SVasanthakumar Thiagarajan }; 490ff155a45SVasanthakumar Thiagarajan 491d70357d5SLuis R. Rodriguez /** 492d70357d5SLuis R. Rodriguez * struct ath_hw_private_ops - callbacks used internally by hardware code 493d70357d5SLuis R. Rodriguez * 494d70357d5SLuis R. Rodriguez * This structure contains private callbacks designed to only be used internally 495d70357d5SLuis R. Rodriguez * by the hardware core. 496d70357d5SLuis R. Rodriguez * 497795f5e2cSLuis R. Rodriguez * @init_cal_settings: setup types of calibrations supported 498795f5e2cSLuis R. Rodriguez * @init_cal: starts actual calibration 499795f5e2cSLuis R. Rodriguez * 500d70357d5SLuis R. Rodriguez * @init_mode_regs: Initializes mode registers 501991312d8SLuis R. Rodriguez * @init_mode_gain_regs: Initialize TX/RX gain registers 502d70357d5SLuis R. Rodriguez * @macversion_supported: If this specific mac revision is supported 5038fe65368SLuis R. Rodriguez * 5048fe65368SLuis R. Rodriguez * @rf_set_freq: change frequency 5058fe65368SLuis R. Rodriguez * @spur_mitigate_freq: spur mitigation 5068fe65368SLuis R. Rodriguez * @rf_alloc_ext_banks: 5078fe65368SLuis R. Rodriguez * @rf_free_ext_banks: 5088fe65368SLuis R. Rodriguez * @set_rf_regs: 50964773964SLuis R. Rodriguez * @compute_pll_control: compute the PLL control value to use for 51064773964SLuis R. Rodriguez * AR_RTC_PLL_CONTROL for a given channel 511795f5e2cSLuis R. Rodriguez * @setup_calibration: set up calibration 512795f5e2cSLuis R. Rodriguez * @iscal_supported: used to query if a type of calibration is supported 51377d6d39aSLuis R. Rodriguez * @loadnf: load noise floor read from each chain on the CCA registers 514*ac0bb767SLuis R. Rodriguez * 515*ac0bb767SLuis R. Rodriguez * @ani_reset: reset ANI parameters to default values 516*ac0bb767SLuis R. Rodriguez * @ani_lower_immunity: lower the noise immunity level. The level controls 517*ac0bb767SLuis R. Rodriguez * the power-based packet detection on hardware. If a power jump is 518*ac0bb767SLuis R. Rodriguez * detected the adapter takes it as an indication that a packet has 519*ac0bb767SLuis R. Rodriguez * arrived. The level ranges from 0-5. Each level corresponds to a 520*ac0bb767SLuis R. Rodriguez * few dB more of noise immunity. If you have a strong time-varying 521*ac0bb767SLuis R. Rodriguez * interference that is causing false detections (OFDM timing errors or 522*ac0bb767SLuis R. Rodriguez * CCK timing errors) the level can be increased. 523d70357d5SLuis R. Rodriguez */ 524d70357d5SLuis R. Rodriguez struct ath_hw_private_ops { 525795f5e2cSLuis R. Rodriguez /* Calibration ops */ 526d70357d5SLuis R. Rodriguez void (*init_cal_settings)(struct ath_hw *ah); 527795f5e2cSLuis R. Rodriguez bool (*init_cal)(struct ath_hw *ah, struct ath9k_channel *chan); 528795f5e2cSLuis R. Rodriguez 529d70357d5SLuis R. Rodriguez void (*init_mode_regs)(struct ath_hw *ah); 530991312d8SLuis R. Rodriguez void (*init_mode_gain_regs)(struct ath_hw *ah); 531d70357d5SLuis R. Rodriguez bool (*macversion_supported)(u32 macversion); 532795f5e2cSLuis R. Rodriguez void (*setup_calibration)(struct ath_hw *ah, 533795f5e2cSLuis R. Rodriguez struct ath9k_cal_list *currCal); 534795f5e2cSLuis R. Rodriguez bool (*iscal_supported)(struct ath_hw *ah, 535795f5e2cSLuis R. Rodriguez enum ath9k_cal_types calType); 5368fe65368SLuis R. Rodriguez 5378fe65368SLuis R. Rodriguez /* PHY ops */ 5388fe65368SLuis R. Rodriguez int (*rf_set_freq)(struct ath_hw *ah, 5398fe65368SLuis R. Rodriguez struct ath9k_channel *chan); 5408fe65368SLuis R. Rodriguez void (*spur_mitigate_freq)(struct ath_hw *ah, 5418fe65368SLuis R. Rodriguez struct ath9k_channel *chan); 5428fe65368SLuis R. Rodriguez int (*rf_alloc_ext_banks)(struct ath_hw *ah); 5438fe65368SLuis R. Rodriguez void (*rf_free_ext_banks)(struct ath_hw *ah); 5448fe65368SLuis R. Rodriguez bool (*set_rf_regs)(struct ath_hw *ah, 5458fe65368SLuis R. Rodriguez struct ath9k_channel *chan, 5468fe65368SLuis R. Rodriguez u16 modesIndex); 5478fe65368SLuis R. Rodriguez void (*set_channel_regs)(struct ath_hw *ah, struct ath9k_channel *chan); 5488fe65368SLuis R. Rodriguez void (*init_bb)(struct ath_hw *ah, 5498fe65368SLuis R. Rodriguez struct ath9k_channel *chan); 5508fe65368SLuis R. Rodriguez int (*process_ini)(struct ath_hw *ah, struct ath9k_channel *chan); 5518fe65368SLuis R. Rodriguez void (*olc_init)(struct ath_hw *ah); 5528fe65368SLuis R. Rodriguez void (*set_rfmode)(struct ath_hw *ah, struct ath9k_channel *chan); 5538fe65368SLuis R. Rodriguez void (*mark_phy_inactive)(struct ath_hw *ah); 5548fe65368SLuis R. Rodriguez void (*set_delta_slope)(struct ath_hw *ah, struct ath9k_channel *chan); 5558fe65368SLuis R. Rodriguez bool (*rfbus_req)(struct ath_hw *ah); 5568fe65368SLuis R. Rodriguez void (*rfbus_done)(struct ath_hw *ah); 5578fe65368SLuis R. Rodriguez void (*enable_rfkill)(struct ath_hw *ah); 5588fe65368SLuis R. Rodriguez void (*restore_chainmask)(struct ath_hw *ah); 5598fe65368SLuis R. Rodriguez void (*set_diversity)(struct ath_hw *ah, bool value); 56064773964SLuis R. Rodriguez u32 (*compute_pll_control)(struct ath_hw *ah, 56164773964SLuis R. Rodriguez struct ath9k_channel *chan); 562c16fcb49SFelix Fietkau bool (*ani_control)(struct ath_hw *ah, enum ath9k_ani_cmd cmd, 563c16fcb49SFelix Fietkau int param); 564641d9921SFelix Fietkau void (*do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS]); 56577d6d39aSLuis R. Rodriguez void (*loadnf)(struct ath_hw *ah, struct ath9k_channel *chan); 566*ac0bb767SLuis R. Rodriguez 567*ac0bb767SLuis R. Rodriguez /* ANI */ 568*ac0bb767SLuis R. Rodriguez void (*ani_reset)(struct ath_hw *ah); 569*ac0bb767SLuis R. Rodriguez void (*ani_lower_immunity)(struct ath_hw *ah); 570d70357d5SLuis R. Rodriguez }; 571d70357d5SLuis R. Rodriguez 572d70357d5SLuis R. Rodriguez /** 573d70357d5SLuis R. Rodriguez * struct ath_hw_ops - callbacks used by hardware code and driver code 574d70357d5SLuis R. Rodriguez * 575d70357d5SLuis R. Rodriguez * This structure contains callbacks designed to to be used internally by 576d70357d5SLuis R. Rodriguez * hardware code and also by the lower level driver. 577d70357d5SLuis R. Rodriguez * 578d70357d5SLuis R. Rodriguez * @config_pci_powersave: 579795f5e2cSLuis R. Rodriguez * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC 580*ac0bb767SLuis R. Rodriguez * 581*ac0bb767SLuis R. Rodriguez * @ani_proc_mib_event: process MIB events, this would happen upon specific ANI 582*ac0bb767SLuis R. Rodriguez * thresholds being reached or having overflowed. 583*ac0bb767SLuis R. Rodriguez * @ani_monitor: called periodically by the core driver to collect 584*ac0bb767SLuis R. Rodriguez * MIB stats and adjust ANI if specific thresholds have been reached. 585d70357d5SLuis R. Rodriguez */ 586d70357d5SLuis R. Rodriguez struct ath_hw_ops { 587d70357d5SLuis R. Rodriguez void (*config_pci_powersave)(struct ath_hw *ah, 588d70357d5SLuis R. Rodriguez int restore, 589d70357d5SLuis R. Rodriguez int power_off); 590cee1f625SVasanthakumar Thiagarajan void (*rx_enable)(struct ath_hw *ah); 59187d5efbbSVasanthakumar Thiagarajan void (*set_desc_link)(void *ds, u32 link); 59287d5efbbSVasanthakumar Thiagarajan void (*get_desc_link)(void *ds, u32 **link); 593795f5e2cSLuis R. Rodriguez bool (*calibrate)(struct ath_hw *ah, 594795f5e2cSLuis R. Rodriguez struct ath9k_channel *chan, 595795f5e2cSLuis R. Rodriguez u8 rxchainmask, 596795f5e2cSLuis R. Rodriguez bool longcal); 59755e82df4SVasanthakumar Thiagarajan bool (*get_isr)(struct ath_hw *ah, enum ath9k_int *masked); 598cc610ac0SVasanthakumar Thiagarajan void (*fill_txdesc)(struct ath_hw *ah, void *ds, u32 seglen, 599cc610ac0SVasanthakumar Thiagarajan bool is_firstseg, bool is_is_lastseg, 600cc610ac0SVasanthakumar Thiagarajan const void *ds0, dma_addr_t buf_addr, 601cc610ac0SVasanthakumar Thiagarajan unsigned int qcu); 602cc610ac0SVasanthakumar Thiagarajan int (*proc_txdesc)(struct ath_hw *ah, void *ds, 603cc610ac0SVasanthakumar Thiagarajan struct ath_tx_status *ts); 604cc610ac0SVasanthakumar Thiagarajan void (*set11n_txdesc)(struct ath_hw *ah, void *ds, 605cc610ac0SVasanthakumar Thiagarajan u32 pktLen, enum ath9k_pkt_type type, 606cc610ac0SVasanthakumar Thiagarajan u32 txPower, u32 keyIx, 607cc610ac0SVasanthakumar Thiagarajan enum ath9k_key_type keyType, 608cc610ac0SVasanthakumar Thiagarajan u32 flags); 609cc610ac0SVasanthakumar Thiagarajan void (*set11n_ratescenario)(struct ath_hw *ah, void *ds, 610cc610ac0SVasanthakumar Thiagarajan void *lastds, 611cc610ac0SVasanthakumar Thiagarajan u32 durUpdateEn, u32 rtsctsRate, 612cc610ac0SVasanthakumar Thiagarajan u32 rtsctsDuration, 613cc610ac0SVasanthakumar Thiagarajan struct ath9k_11n_rate_series series[], 614cc610ac0SVasanthakumar Thiagarajan u32 nseries, u32 flags); 615cc610ac0SVasanthakumar Thiagarajan void (*set11n_aggr_first)(struct ath_hw *ah, void *ds, 616cc610ac0SVasanthakumar Thiagarajan u32 aggrLen); 617cc610ac0SVasanthakumar Thiagarajan void (*set11n_aggr_middle)(struct ath_hw *ah, void *ds, 618cc610ac0SVasanthakumar Thiagarajan u32 numDelims); 619cc610ac0SVasanthakumar Thiagarajan void (*set11n_aggr_last)(struct ath_hw *ah, void *ds); 620cc610ac0SVasanthakumar Thiagarajan void (*clr11n_aggr)(struct ath_hw *ah, void *ds); 621cc610ac0SVasanthakumar Thiagarajan void (*set11n_burstduration)(struct ath_hw *ah, void *ds, 622cc610ac0SVasanthakumar Thiagarajan u32 burstDuration); 623cc610ac0SVasanthakumar Thiagarajan void (*set11n_virtualmorefrag)(struct ath_hw *ah, void *ds, 624cc610ac0SVasanthakumar Thiagarajan u32 vmf); 625*ac0bb767SLuis R. Rodriguez 626*ac0bb767SLuis R. Rodriguez void (*ani_proc_mib_event)(struct ath_hw *ah); 627*ac0bb767SLuis R. Rodriguez void (*ani_monitor)(struct ath_hw *ah, struct ath9k_channel *chan); 628d70357d5SLuis R. Rodriguez }; 629d70357d5SLuis R. Rodriguez 630203c4805SLuis R. Rodriguez struct ath_hw { 631b002a4a9SLuis R. Rodriguez struct ieee80211_hw *hw; 63227c51f1aSLuis R. Rodriguez struct ath_common common; 633203c4805SLuis R. Rodriguez struct ath9k_hw_version hw_version; 634203c4805SLuis R. Rodriguez struct ath9k_ops_config config; 635203c4805SLuis R. Rodriguez struct ath9k_hw_capabilities caps; 636203c4805SLuis R. Rodriguez struct ath9k_channel channels[38]; 637203c4805SLuis R. Rodriguez struct ath9k_channel *curchan; 638203c4805SLuis R. Rodriguez 639203c4805SLuis R. Rodriguez union { 640203c4805SLuis R. Rodriguez struct ar5416_eeprom_def def; 641203c4805SLuis R. Rodriguez struct ar5416_eeprom_4k map4k; 642475f5989SLuis R. Rodriguez struct ar9287_eeprom map9287; 64315c9ee7aSSenthil Balasubramanian struct ar9300_eeprom ar9300_eep; 644203c4805SLuis R. Rodriguez } eeprom; 645203c4805SLuis R. Rodriguez const struct eeprom_ops *eep_ops; 646203c4805SLuis R. Rodriguez 647203c4805SLuis R. Rodriguez bool sw_mgmt_crypto; 648203c4805SLuis R. Rodriguez bool is_pciexpress; 6492eb46d9bSPavel Roskin bool need_an_top2_fixup; 650203c4805SLuis R. Rodriguez u16 tx_trig_level; 651641d9921SFelix Fietkau s16 nf_2g_max; 652641d9921SFelix Fietkau s16 nf_2g_min; 653641d9921SFelix Fietkau s16 nf_5g_max; 654641d9921SFelix Fietkau s16 nf_5g_min; 655203c4805SLuis R. Rodriguez u16 rfsilent; 656203c4805SLuis R. Rodriguez u32 rfkill_gpio; 657203c4805SLuis R. Rodriguez u32 rfkill_polarity; 658203c4805SLuis R. Rodriguez u32 ah_flags; 659203c4805SLuis R. Rodriguez 660d7e7d229SLuis R. Rodriguez bool htc_reset_init; 661d7e7d229SLuis R. Rodriguez 662203c4805SLuis R. Rodriguez enum nl80211_iftype opmode; 663203c4805SLuis R. Rodriguez enum ath9k_power_mode power_mode; 664203c4805SLuis R. Rodriguez 665203c4805SLuis R. Rodriguez struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; 666a13883b0SSujith struct ath9k_pacal_info pacal_info; 667203c4805SLuis R. Rodriguez struct ar5416Stats stats; 668203c4805SLuis R. Rodriguez struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES]; 669203c4805SLuis R. Rodriguez 670203c4805SLuis R. Rodriguez int16_t curchan_rad_index; 6713069168cSPavel Roskin enum ath9k_int imask; 67274bad5cbSPavel Roskin u32 imrs2_reg; 673203c4805SLuis R. Rodriguez u32 txok_interrupt_mask; 674203c4805SLuis R. Rodriguez u32 txerr_interrupt_mask; 675203c4805SLuis R. Rodriguez u32 txdesc_interrupt_mask; 676203c4805SLuis R. Rodriguez u32 txeol_interrupt_mask; 677203c4805SLuis R. Rodriguez u32 txurn_interrupt_mask; 678203c4805SLuis R. Rodriguez bool chip_fullsleep; 679203c4805SLuis R. Rodriguez u32 atim_window; 680203c4805SLuis R. Rodriguez 681203c4805SLuis R. Rodriguez /* Calibration */ 682cbfe9468SSujith enum ath9k_cal_types supp_cals; 683cbfe9468SSujith struct ath9k_cal_list iq_caldata; 684cbfe9468SSujith struct ath9k_cal_list adcgain_caldata; 685cbfe9468SSujith struct ath9k_cal_list adcdc_calinitdata; 686cbfe9468SSujith struct ath9k_cal_list adcdc_caldata; 687df23acaaSLuis R. Rodriguez struct ath9k_cal_list tempCompCalData; 688cbfe9468SSujith struct ath9k_cal_list *cal_list; 689cbfe9468SSujith struct ath9k_cal_list *cal_list_last; 690cbfe9468SSujith struct ath9k_cal_list *cal_list_curr; 691203c4805SLuis R. Rodriguez #define totalPowerMeasI meas0.unsign 692203c4805SLuis R. Rodriguez #define totalPowerMeasQ meas1.unsign 693203c4805SLuis R. Rodriguez #define totalIqCorrMeas meas2.sign 694203c4805SLuis R. Rodriguez #define totalAdcIOddPhase meas0.unsign 695203c4805SLuis R. Rodriguez #define totalAdcIEvenPhase meas1.unsign 696203c4805SLuis R. Rodriguez #define totalAdcQOddPhase meas2.unsign 697203c4805SLuis R. Rodriguez #define totalAdcQEvenPhase meas3.unsign 698203c4805SLuis R. Rodriguez #define totalAdcDcOffsetIOddPhase meas0.sign 699203c4805SLuis R. Rodriguez #define totalAdcDcOffsetIEvenPhase meas1.sign 700203c4805SLuis R. Rodriguez #define totalAdcDcOffsetQOddPhase meas2.sign 701203c4805SLuis R. Rodriguez #define totalAdcDcOffsetQEvenPhase meas3.sign 702203c4805SLuis R. Rodriguez union { 703203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 704203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 705203c4805SLuis R. Rodriguez } meas0; 706203c4805SLuis R. Rodriguez union { 707203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 708203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 709203c4805SLuis R. Rodriguez } meas1; 710203c4805SLuis R. Rodriguez union { 711203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 712203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 713203c4805SLuis R. Rodriguez } meas2; 714203c4805SLuis R. Rodriguez union { 715203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 716203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 717203c4805SLuis R. Rodriguez } meas3; 718203c4805SLuis R. Rodriguez u16 cal_samples; 719203c4805SLuis R. Rodriguez 720203c4805SLuis R. Rodriguez u32 sta_id1_defaults; 721203c4805SLuis R. Rodriguez u32 misc_mode; 722203c4805SLuis R. Rodriguez enum { 723203c4805SLuis R. Rodriguez AUTO_32KHZ, 724203c4805SLuis R. Rodriguez USE_32KHZ, 725203c4805SLuis R. Rodriguez DONT_USE_32KHZ, 726203c4805SLuis R. Rodriguez } enable_32kHz_clock; 727203c4805SLuis R. Rodriguez 728d70357d5SLuis R. Rodriguez /* Private to hardware code */ 729d70357d5SLuis R. Rodriguez struct ath_hw_private_ops private_ops; 730d70357d5SLuis R. Rodriguez /* Accessed by the lower level driver */ 731d70357d5SLuis R. Rodriguez struct ath_hw_ops ops; 732d70357d5SLuis R. Rodriguez 733e68a060bSLuis R. Rodriguez /* Used to program the radio on non single-chip devices */ 734203c4805SLuis R. Rodriguez u32 *analogBank0Data; 735203c4805SLuis R. Rodriguez u32 *analogBank1Data; 736203c4805SLuis R. Rodriguez u32 *analogBank2Data; 737203c4805SLuis R. Rodriguez u32 *analogBank3Data; 738203c4805SLuis R. Rodriguez u32 *analogBank6Data; 739203c4805SLuis R. Rodriguez u32 *analogBank6TPCData; 740203c4805SLuis R. Rodriguez u32 *analogBank7Data; 741203c4805SLuis R. Rodriguez u32 *addac5416_21; 742203c4805SLuis R. Rodriguez u32 *bank6Temp; 743203c4805SLuis R. Rodriguez 744597a94b3SFelix Fietkau u8 txpower_limit; 745203c4805SLuis R. Rodriguez int16_t txpower_indexoffset; 746e239d859SFelix Fietkau int coverage_class; 747203c4805SLuis R. Rodriguez u32 beacon_interval; 748203c4805SLuis R. Rodriguez u32 slottime; 749203c4805SLuis R. Rodriguez u32 globaltxtimeout; 750203c4805SLuis R. Rodriguez 751203c4805SLuis R. Rodriguez /* ANI */ 752203c4805SLuis R. Rodriguez u32 proc_phyerr; 753203c4805SLuis R. Rodriguez u32 aniperiod; 754203c4805SLuis R. Rodriguez struct ar5416AniState *curani; 755203c4805SLuis R. Rodriguez struct ar5416AniState ani[255]; 756203c4805SLuis R. Rodriguez int totalSizeDesired[5]; 757203c4805SLuis R. Rodriguez int coarse_high[5]; 758203c4805SLuis R. Rodriguez int coarse_low[5]; 759203c4805SLuis R. Rodriguez int firpwr[5]; 760203c4805SLuis R. Rodriguez enum ath9k_ani_cmd ani_function; 761203c4805SLuis R. Rodriguez 762af03abecSLuis R. Rodriguez /* Bluetooth coexistance */ 763766ec4a9SLuis R. Rodriguez struct ath_btcoex_hw btcoex_hw; 764af03abecSLuis R. Rodriguez 765203c4805SLuis R. Rodriguez u32 intr_txqs; 766203c4805SLuis R. Rodriguez u8 txchainmask; 767203c4805SLuis R. Rodriguez u8 rxchainmask; 768203c4805SLuis R. Rodriguez 769203c4805SLuis R. Rodriguez u32 originalGain[22]; 770203c4805SLuis R. Rodriguez int initPDADC; 771203c4805SLuis R. Rodriguez int PDADCdelta; 77208fc5c1bSVivek Natarajan u8 led_pin; 773203c4805SLuis R. Rodriguez 774203c4805SLuis R. Rodriguez struct ar5416IniArray iniModes; 775203c4805SLuis R. Rodriguez struct ar5416IniArray iniCommon; 776203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank0; 777203c4805SLuis R. Rodriguez struct ar5416IniArray iniBB_RfGain; 778203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank1; 779203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank2; 780203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank3; 781203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank6; 782203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank6TPC; 783203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank7; 784203c4805SLuis R. Rodriguez struct ar5416IniArray iniAddac; 785203c4805SLuis R. Rodriguez struct ar5416IniArray iniPcieSerdes; 78613ce3e99SLuis R. Rodriguez struct ar5416IniArray iniPcieSerdesLowPower; 787203c4805SLuis R. Rodriguez struct ar5416IniArray iniModesAdditional; 788203c4805SLuis R. Rodriguez struct ar5416IniArray iniModesRxGain; 789203c4805SLuis R. Rodriguez struct ar5416IniArray iniModesTxGain; 7908564328dSLuis R. Rodriguez struct ar5416IniArray iniModes_9271_1_0_only; 791193cd458SSujith struct ar5416IniArray iniCckfirNormal; 792193cd458SSujith struct ar5416IniArray iniCckfirJapan2484; 79370807e99SSujith struct ar5416IniArray iniCommon_normal_cck_fir_coeff_9271; 79470807e99SSujith struct ar5416IniArray iniCommon_japan_2484_cck_fir_coeff_9271; 79570807e99SSujith struct ar5416IniArray iniModes_9271_ANI_reg; 79670807e99SSujith struct ar5416IniArray iniModes_high_power_tx_gain_9271; 79770807e99SSujith struct ar5416IniArray iniModes_normal_power_tx_gain_9271; 798ff155a45SVasanthakumar Thiagarajan 79913ce3e99SLuis R. Rodriguez struct ar5416IniArray iniMac[ATH_INI_NUM_SPLIT]; 80013ce3e99SLuis R. Rodriguez struct ar5416IniArray iniBB[ATH_INI_NUM_SPLIT]; 80113ce3e99SLuis R. Rodriguez struct ar5416IniArray iniRadio[ATH_INI_NUM_SPLIT]; 80213ce3e99SLuis R. Rodriguez struct ar5416IniArray iniSOC[ATH_INI_NUM_SPLIT]; 80313ce3e99SLuis R. Rodriguez 804ff155a45SVasanthakumar Thiagarajan u32 intr_gen_timer_trigger; 805ff155a45SVasanthakumar Thiagarajan u32 intr_gen_timer_thresh; 806ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer_table hw_gen_timers; 807744d4025SVasanthakumar Thiagarajan 808744d4025SVasanthakumar Thiagarajan struct ar9003_txs *ts_ring; 809744d4025SVasanthakumar Thiagarajan void *ts_start; 810744d4025SVasanthakumar Thiagarajan u32 ts_paddr_start; 811744d4025SVasanthakumar Thiagarajan u32 ts_paddr_end; 812744d4025SVasanthakumar Thiagarajan u16 ts_tail; 813744d4025SVasanthakumar Thiagarajan u8 ts_size; 814aea702b7SLuis R. Rodriguez 815aea702b7SLuis R. Rodriguez u32 bb_watchdog_last_status; 816aea702b7SLuis R. Rodriguez u32 bb_watchdog_timeout_ms; /* in ms, 0 to disable */ 817203c4805SLuis R. Rodriguez }; 818203c4805SLuis R. Rodriguez 8199e4bffd2SLuis R. Rodriguez static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) 8209e4bffd2SLuis R. Rodriguez { 8219e4bffd2SLuis R. Rodriguez return &ah->common; 8229e4bffd2SLuis R. Rodriguez } 8239e4bffd2SLuis R. Rodriguez 8249e4bffd2SLuis R. Rodriguez static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah) 8259e4bffd2SLuis R. Rodriguez { 8269e4bffd2SLuis R. Rodriguez return &(ath9k_hw_common(ah)->regulatory); 8279e4bffd2SLuis R. Rodriguez } 8289e4bffd2SLuis R. Rodriguez 829d70357d5SLuis R. Rodriguez static inline struct ath_hw_private_ops *ath9k_hw_private_ops(struct ath_hw *ah) 830d70357d5SLuis R. Rodriguez { 831d70357d5SLuis R. Rodriguez return &ah->private_ops; 832d70357d5SLuis R. Rodriguez } 833d70357d5SLuis R. Rodriguez 834d70357d5SLuis R. Rodriguez static inline struct ath_hw_ops *ath9k_hw_ops(struct ath_hw *ah) 835d70357d5SLuis R. Rodriguez { 836d70357d5SLuis R. Rodriguez return &ah->ops; 837d70357d5SLuis R. Rodriguez } 838d70357d5SLuis R. Rodriguez 839f637cfd6SLuis R. Rodriguez /* Initialization, Detach, Reset */ 840203c4805SLuis R. Rodriguez const char *ath9k_hw_probe(u16 vendorid, u16 devid); 841285f2ddaSSujith void ath9k_hw_deinit(struct ath_hw *ah); 842f637cfd6SLuis R. Rodriguez int ath9k_hw_init(struct ath_hw *ah); 843203c4805SLuis R. Rodriguez int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, 844203c4805SLuis R. Rodriguez bool bChannelChange); 845a9a29ce6SGabor Juhos int ath9k_hw_fill_cap_info(struct ath_hw *ah); 846203c4805SLuis R. Rodriguez bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type, 847203c4805SLuis R. Rodriguez u32 capability, u32 *result); 848203c4805SLuis R. Rodriguez bool ath9k_hw_setcapability(struct ath_hw *ah, enum ath9k_capability_type type, 849203c4805SLuis R. Rodriguez u32 capability, u32 setting, int *status); 8508fe65368SLuis R. Rodriguez u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan); 851203c4805SLuis R. Rodriguez 852203c4805SLuis R. Rodriguez /* Key Cache Management */ 853203c4805SLuis R. Rodriguez bool ath9k_hw_keyreset(struct ath_hw *ah, u16 entry); 854203c4805SLuis R. Rodriguez bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac); 855203c4805SLuis R. Rodriguez bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry, 856203c4805SLuis R. Rodriguez const struct ath9k_keyval *k, 857203c4805SLuis R. Rodriguez const u8 *mac); 858203c4805SLuis R. Rodriguez bool ath9k_hw_keyisvalid(struct ath_hw *ah, u16 entry); 859203c4805SLuis R. Rodriguez 860203c4805SLuis R. Rodriguez /* GPIO / RFKILL / Antennae */ 861203c4805SLuis R. Rodriguez void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio); 862203c4805SLuis R. Rodriguez u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio); 863203c4805SLuis R. Rodriguez void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, 864203c4805SLuis R. Rodriguez u32 ah_signal_type); 865203c4805SLuis R. Rodriguez void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); 866203c4805SLuis R. Rodriguez u32 ath9k_hw_getdefantenna(struct ath_hw *ah); 867203c4805SLuis R. Rodriguez void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); 868203c4805SLuis R. Rodriguez 869203c4805SLuis R. Rodriguez /* General Operation */ 870203c4805SLuis R. Rodriguez bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); 871203c4805SLuis R. Rodriguez u32 ath9k_hw_reverse_bits(u32 val, u32 n); 872203c4805SLuis R. Rodriguez bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high); 8734f0fc7c3SLuis R. Rodriguez u16 ath9k_hw_computetxtime(struct ath_hw *ah, 874545750d3SFelix Fietkau u8 phy, int kbps, 875203c4805SLuis R. Rodriguez u32 frameLen, u16 rateix, bool shortPreamble); 876203c4805SLuis R. Rodriguez void ath9k_hw_get_channel_centers(struct ath_hw *ah, 877203c4805SLuis R. Rodriguez struct ath9k_channel *chan, 878203c4805SLuis R. Rodriguez struct chan_centers *centers); 879203c4805SLuis R. Rodriguez u32 ath9k_hw_getrxfilter(struct ath_hw *ah); 880203c4805SLuis R. Rodriguez void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits); 881203c4805SLuis R. Rodriguez bool ath9k_hw_phy_disable(struct ath_hw *ah); 882203c4805SLuis R. Rodriguez bool ath9k_hw_disable(struct ath_hw *ah); 8838fbff4b8SVasanthakumar Thiagarajan void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit); 884203c4805SLuis R. Rodriguez void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac); 885203c4805SLuis R. Rodriguez void ath9k_hw_setopmode(struct ath_hw *ah); 886203c4805SLuis R. Rodriguez void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); 887f2b2143eSLuis R. Rodriguez void ath9k_hw_setbssidmask(struct ath_hw *ah); 888f2b2143eSLuis R. Rodriguez void ath9k_hw_write_associd(struct ath_hw *ah); 889203c4805SLuis R. Rodriguez u64 ath9k_hw_gettsf64(struct ath_hw *ah); 890203c4805SLuis R. Rodriguez void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); 891203c4805SLuis R. Rodriguez void ath9k_hw_reset_tsf(struct ath_hw *ah); 89254e4cec6SSujith void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); 89330cbd422SLuis R. Rodriguez u64 ath9k_hw_extend_tsf(struct ath_hw *ah, u32 rstamp); 8940005baf4SFelix Fietkau void ath9k_hw_init_global_settings(struct ath_hw *ah); 89525c56eecSLuis R. Rodriguez void ath9k_hw_set11nmac2040(struct ath_hw *ah); 896203c4805SLuis R. Rodriguez void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); 897203c4805SLuis R. Rodriguez void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, 898203c4805SLuis R. Rodriguez const struct ath9k_beacon_state *bs); 899c9c99e5eSFelix Fietkau bool ath9k_hw_check_alive(struct ath_hw *ah); 900a91d75aeSLuis R. Rodriguez 9019ecdef4bSLuis R. Rodriguez bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); 902a91d75aeSLuis R. Rodriguez 903ff155a45SVasanthakumar Thiagarajan /* Generic hw timer primitives */ 904ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, 905ff155a45SVasanthakumar Thiagarajan void (*trigger)(void *), 906ff155a45SVasanthakumar Thiagarajan void (*overflow)(void *), 907ff155a45SVasanthakumar Thiagarajan void *arg, 908ff155a45SVasanthakumar Thiagarajan u8 timer_index); 909cd9bf689SLuis R. Rodriguez void ath9k_hw_gen_timer_start(struct ath_hw *ah, 910cd9bf689SLuis R. Rodriguez struct ath_gen_timer *timer, 911cd9bf689SLuis R. Rodriguez u32 timer_next, 912cd9bf689SLuis R. Rodriguez u32 timer_period); 913cd9bf689SLuis R. Rodriguez void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer); 914cd9bf689SLuis R. Rodriguez 915ff155a45SVasanthakumar Thiagarajan void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer); 916ff155a45SVasanthakumar Thiagarajan void ath_gen_timer_isr(struct ath_hw *hw); 9171773912bSVasanthakumar Thiagarajan u32 ath9k_hw_gettsf32(struct ath_hw *ah); 918ff155a45SVasanthakumar Thiagarajan 919f934c4d9SLuis R. Rodriguez void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len); 9202da4f01aSLuis R. Rodriguez 92105020d23SSujith /* HTC */ 92205020d23SSujith void ath9k_hw_htc_resetinit(struct ath_hw *ah); 92305020d23SSujith 9248fe65368SLuis R. Rodriguez /* PHY */ 9258fe65368SLuis R. Rodriguez void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, 9268fe65368SLuis R. Rodriguez u32 *coef_mantissa, u32 *coef_exponent); 9278fe65368SLuis R. Rodriguez 928ebd5a14aSLuis R. Rodriguez /* 929ebd5a14aSLuis R. Rodriguez * Code Specific to AR5008, AR9001 or AR9002, 930ebd5a14aSLuis R. Rodriguez * we stuff these here to avoid callbacks for AR9003. 931ebd5a14aSLuis R. Rodriguez */ 932d8f492b7SLuis R. Rodriguez void ar9002_hw_cck_chan14_spread(struct ath_hw *ah); 933ebd5a14aSLuis R. Rodriguez int ar9002_hw_rf_claim(struct ath_hw *ah); 93478ec2677SLuis R. Rodriguez void ar9002_hw_enable_async_fifo(struct ath_hw *ah); 935e9141f71SSujith void ar9002_hw_update_async_fifo(struct ath_hw *ah); 9366c94fdc9SLuis R. Rodriguez void ar9002_hw_enable_wep_aggregation(struct ath_hw *ah); 937d8f492b7SLuis R. Rodriguez 938641d9921SFelix Fietkau /* 939aea702b7SLuis R. Rodriguez * Code specific to AR9003, we stuff these here to avoid callbacks 940641d9921SFelix Fietkau * for older families 941641d9921SFelix Fietkau */ 942641d9921SFelix Fietkau void ar9003_hw_set_nf_limits(struct ath_hw *ah); 943aea702b7SLuis R. Rodriguez void ar9003_hw_bb_watchdog_config(struct ath_hw *ah); 944aea702b7SLuis R. Rodriguez void ar9003_hw_bb_watchdog_read(struct ath_hw *ah); 945aea702b7SLuis R. Rodriguez void ar9003_hw_bb_watchdog_dbg_info(struct ath_hw *ah); 946641d9921SFelix Fietkau 947641d9921SFelix Fietkau /* Hardware family op attach helpers */ 9488fe65368SLuis R. Rodriguez void ar5008_hw_attach_phy_ops(struct ath_hw *ah); 9498525f280SLuis R. Rodriguez void ar9002_hw_attach_phy_ops(struct ath_hw *ah); 9508525f280SLuis R. Rodriguez void ar9003_hw_attach_phy_ops(struct ath_hw *ah); 9518fe65368SLuis R. Rodriguez 952795f5e2cSLuis R. Rodriguez void ar9002_hw_attach_calib_ops(struct ath_hw *ah); 953795f5e2cSLuis R. Rodriguez void ar9003_hw_attach_calib_ops(struct ath_hw *ah); 954795f5e2cSLuis R. Rodriguez 955b3950e6aSLuis R. Rodriguez void ar9002_hw_attach_ops(struct ath_hw *ah); 956b3950e6aSLuis R. Rodriguez void ar9003_hw_attach_ops(struct ath_hw *ah); 957b3950e6aSLuis R. Rodriguez 958*ac0bb767SLuis R. Rodriguez /* 959*ac0bb767SLuis R. Rodriguez * ANI work can be shared between all families but a next 960*ac0bb767SLuis R. Rodriguez * generation implementation of ANI will be used only for AR9003 only 961*ac0bb767SLuis R. Rodriguez * for now as the other families still need to be tested with the same 962*ac0bb767SLuis R. Rodriguez * next generation ANI. 963*ac0bb767SLuis R. Rodriguez */ 964*ac0bb767SLuis R. Rodriguez void ath9k_hw_attach_ani_ops_old(struct ath_hw *ah); 965*ac0bb767SLuis R. Rodriguez 9667b6840abSVasanthakumar Thiagarajan #define ATH_PCIE_CAP_LINK_CTRL 0x70 9677b6840abSVasanthakumar Thiagarajan #define ATH_PCIE_CAP_LINK_L0S 1 9687b6840abSVasanthakumar Thiagarajan #define ATH_PCIE_CAP_LINK_L1 2 9697b6840abSVasanthakumar Thiagarajan 97073377256SLuis R. Rodriguez #define ATH9K_CLOCK_RATE_CCK 22 97173377256SLuis R. Rodriguez #define ATH9K_CLOCK_RATE_5GHZ_OFDM 40 97273377256SLuis R. Rodriguez #define ATH9K_CLOCK_RATE_2GHZ_OFDM 44 97373377256SLuis R. Rodriguez #define ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM 44 97473377256SLuis R. Rodriguez 975203c4805SLuis R. Rodriguez #endif 976