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" 31ceb26445SVasanthakumar Thiagarajan #include "ar9003_mac.h" 32203c4805SLuis R. Rodriguez 33203c4805SLuis R. Rodriguez #include "../regd.h" 34c46917bbSLuis R. Rodriguez #include "../debug.h" 35203c4805SLuis R. Rodriguez 36203c4805SLuis R. Rodriguez #define ATHEROS_VENDOR_ID 0x168c 377976b426SLuis R. Rodriguez 38203c4805SLuis R. Rodriguez #define AR5416_DEVID_PCI 0x0023 39203c4805SLuis R. Rodriguez #define AR5416_DEVID_PCIE 0x0024 40203c4805SLuis R. Rodriguez #define AR9160_DEVID_PCI 0x0027 41203c4805SLuis R. Rodriguez #define AR9280_DEVID_PCI 0x0029 42203c4805SLuis R. Rodriguez #define AR9280_DEVID_PCIE 0x002a 43203c4805SLuis R. Rodriguez #define AR9285_DEVID_PCIE 0x002b 445ffaf8a3SLuis R. Rodriguez #define AR2427_DEVID_PCIE 0x002c 45db3cc53aSSenthil Balasubramanian #define AR9287_DEVID_PCI 0x002d 46db3cc53aSSenthil Balasubramanian #define AR9287_DEVID_PCIE 0x002e 47db3cc53aSSenthil Balasubramanian #define AR9300_DEVID_PCIE 0x0030 487976b426SLuis R. Rodriguez 49203c4805SLuis R. Rodriguez #define AR5416_AR9100_DEVID 0x000b 507976b426SLuis R. Rodriguez 51203c4805SLuis R. Rodriguez #define AR_SUBVENDOR_ID_NOG 0x0e11 52203c4805SLuis R. Rodriguez #define AR_SUBVENDOR_ID_NEW_A 0x7065 53203c4805SLuis R. Rodriguez #define AR5416_MAGIC 0x19641014 54203c4805SLuis R. Rodriguez 55fe12946eSVasanthakumar Thiagarajan #define AR9280_COEX2WIRE_SUBSYSID 0x309b 56fe12946eSVasanthakumar Thiagarajan #define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa 57fe12946eSVasanthakumar Thiagarajan #define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab 58fe12946eSVasanthakumar Thiagarajan 59e3d01bfcSLuis R. Rodriguez #define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1) 60e3d01bfcSLuis R. Rodriguez 61cfe8cba9SLuis R. Rodriguez #define ATH_DEFAULT_NOISE_FLOOR -95 62cfe8cba9SLuis R. Rodriguez 6304658fbaSJohn W. Linville #define ATH9K_RSSI_BAD -128 64990b70abSLuis R. Rodriguez 65203c4805SLuis R. Rodriguez /* Register read/write primitives */ 669e4bffd2SLuis R. Rodriguez #define REG_WRITE(_ah, _reg, _val) \ 679e4bffd2SLuis R. Rodriguez ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) 689e4bffd2SLuis R. Rodriguez 699e4bffd2SLuis R. Rodriguez #define REG_READ(_ah, _reg) \ 709e4bffd2SLuis R. Rodriguez ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) 71203c4805SLuis R. Rodriguez 72203c4805SLuis R. Rodriguez #define SM(_v, _f) (((_v) << _f##_S) & _f) 73203c4805SLuis R. Rodriguez #define MS(_v, _f) (((_v) & _f) >> _f##_S) 74203c4805SLuis R. Rodriguez #define REG_RMW(_a, _r, _set, _clr) \ 75203c4805SLuis R. Rodriguez REG_WRITE(_a, _r, (REG_READ(_a, _r) & ~(_clr)) | (_set)) 76203c4805SLuis R. Rodriguez #define REG_RMW_FIELD(_a, _r, _f, _v) \ 77203c4805SLuis R. Rodriguez REG_WRITE(_a, _r, \ 78203c4805SLuis R. Rodriguez (REG_READ(_a, _r) & ~_f) | (((_v) << _f##_S) & _f)) 791547da37SLuis R. Rodriguez #define REG_READ_FIELD(_a, _r, _f) \ 801547da37SLuis R. Rodriguez (((REG_READ(_a, _r) & _f) >> _f##_S)) 81203c4805SLuis R. Rodriguez #define REG_SET_BIT(_a, _r, _f) \ 82203c4805SLuis R. Rodriguez REG_WRITE(_a, _r, REG_READ(_a, _r) | _f) 83203c4805SLuis R. Rodriguez #define REG_CLR_BIT(_a, _r, _f) \ 84203c4805SLuis R. Rodriguez REG_WRITE(_a, _r, REG_READ(_a, _r) & ~_f) 85203c4805SLuis R. Rodriguez 86203c4805SLuis R. Rodriguez #define DO_DELAY(x) do { \ 87203c4805SLuis R. Rodriguez if ((++(x) % 64) == 0) \ 88203c4805SLuis R. Rodriguez udelay(1); \ 89203c4805SLuis R. Rodriguez } while (0) 90203c4805SLuis R. Rodriguez 91203c4805SLuis R. Rodriguez #define REG_WRITE_ARRAY(iniarray, column, regWr) do { \ 92203c4805SLuis R. Rodriguez int r; \ 93203c4805SLuis R. Rodriguez for (r = 0; r < ((iniarray)->ia_rows); r++) { \ 94203c4805SLuis R. Rodriguez REG_WRITE(ah, INI_RA((iniarray), (r), 0), \ 95203c4805SLuis R. Rodriguez INI_RA((iniarray), r, (column))); \ 96203c4805SLuis R. Rodriguez DO_DELAY(regWr); \ 97203c4805SLuis R. Rodriguez } \ 98203c4805SLuis R. Rodriguez } while (0) 99203c4805SLuis R. Rodriguez 100203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0 101203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1 102203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED 2 103203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_TX_FRAME 3 1041773912bSVasanthakumar Thiagarajan #define AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL 4 105203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED 5 106203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED 6 107203c4805SLuis R. Rodriguez 108203c4805SLuis R. Rodriguez #define AR_GPIOD_MASK 0x00001FFF 109203c4805SLuis R. Rodriguez #define AR_GPIO_BIT(_gpio) (1 << (_gpio)) 110203c4805SLuis R. Rodriguez 111203c4805SLuis R. Rodriguez #define BASE_ACTIVATE_DELAY 100 11263a75b91SSenthil Balasubramanian #define RTC_PLL_SETTLE_DELAY 100 113203c4805SLuis R. Rodriguez #define COEF_SCALE_S 24 114203c4805SLuis R. Rodriguez #define HT40_CHANNEL_CENTER_SHIFT 10 115203c4805SLuis R. Rodriguez 116203c4805SLuis R. Rodriguez #define ATH9K_ANTENNA0_CHAINMASK 0x1 117203c4805SLuis R. Rodriguez #define ATH9K_ANTENNA1_CHAINMASK 0x2 118203c4805SLuis R. Rodriguez 119203c4805SLuis R. Rodriguez #define ATH9K_NUM_DMA_DEBUG_REGS 8 120203c4805SLuis R. Rodriguez #define ATH9K_NUM_QUEUES 10 121203c4805SLuis R. Rodriguez 122203c4805SLuis R. Rodriguez #define MAX_RATE_POWER 63 123203c4805SLuis R. Rodriguez #define AH_WAIT_TIMEOUT 100000 /* (us) */ 124f9b604f6SGabor Juhos #define AH_TSF_WRITE_TIMEOUT 100 /* (us) */ 125203c4805SLuis R. Rodriguez #define AH_TIME_QUANTUM 10 126203c4805SLuis R. Rodriguez #define AR_KEYTABLE_SIZE 128 127d8caa839SSujith #define POWER_UP_TIME 10000 128203c4805SLuis R. Rodriguez #define SPUR_RSSI_THRESH 40 129203c4805SLuis R. Rodriguez 130203c4805SLuis R. Rodriguez #define CAB_TIMEOUT_VAL 10 131203c4805SLuis R. Rodriguez #define BEACON_TIMEOUT_VAL 10 132203c4805SLuis R. Rodriguez #define MIN_BEACON_TIMEOUT_VAL 1 133203c4805SLuis R. Rodriguez #define SLEEP_SLOP 3 134203c4805SLuis R. Rodriguez 135203c4805SLuis R. Rodriguez #define INIT_CONFIG_STATUS 0x00000000 136203c4805SLuis R. Rodriguez #define INIT_RSSI_THR 0x00000700 137203c4805SLuis R. Rodriguez #define INIT_BCON_CNTRL_REG 0x00000000 138203c4805SLuis R. Rodriguez 139203c4805SLuis R. Rodriguez #define TU_TO_USEC(_tu) ((_tu) << 10) 140203c4805SLuis R. Rodriguez 141ceb26445SVasanthakumar Thiagarajan #define ATH9K_HW_RX_HP_QDEPTH 16 142ceb26445SVasanthakumar Thiagarajan #define ATH9K_HW_RX_LP_QDEPTH 128 143ceb26445SVasanthakumar Thiagarajan 14413ce3e99SLuis R. Rodriguez enum ath_ini_subsys { 14513ce3e99SLuis R. Rodriguez ATH_INI_PRE = 0, 14613ce3e99SLuis R. Rodriguez ATH_INI_CORE, 14713ce3e99SLuis R. Rodriguez ATH_INI_POST, 14813ce3e99SLuis R. Rodriguez ATH_INI_NUM_SPLIT, 14913ce3e99SLuis R. Rodriguez }; 15013ce3e99SLuis R. Rodriguez 151203c4805SLuis R. Rodriguez enum wireless_mode { 152203c4805SLuis R. Rodriguez ATH9K_MODE_11A = 0, 153b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11G, 154b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NA_HT20, 155b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NG_HT20, 156b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NA_HT40PLUS, 157b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NA_HT40MINUS, 158b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NG_HT40PLUS, 159b9b6e15aSLuis R. Rodriguez ATH9K_MODE_11NG_HT40MINUS, 160b9b6e15aSLuis R. Rodriguez ATH9K_MODE_MAX, 161203c4805SLuis R. Rodriguez }; 162203c4805SLuis R. Rodriguez 163203c4805SLuis R. Rodriguez enum ath9k_hw_caps { 164203c4805SLuis R. Rodriguez ATH9K_HW_CAP_MIC_AESCCM = BIT(0), 165203c4805SLuis R. Rodriguez ATH9K_HW_CAP_MIC_CKIP = BIT(1), 166203c4805SLuis R. Rodriguez ATH9K_HW_CAP_MIC_TKIP = BIT(2), 167203c4805SLuis R. Rodriguez ATH9K_HW_CAP_CIPHER_AESCCM = BIT(3), 168203c4805SLuis R. Rodriguez ATH9K_HW_CAP_CIPHER_CKIP = BIT(4), 169203c4805SLuis R. Rodriguez ATH9K_HW_CAP_CIPHER_TKIP = BIT(5), 170203c4805SLuis R. Rodriguez ATH9K_HW_CAP_VEOL = BIT(6), 171203c4805SLuis R. Rodriguez ATH9K_HW_CAP_BSSIDMASK = BIT(7), 172203c4805SLuis R. Rodriguez ATH9K_HW_CAP_MCAST_KEYSEARCH = BIT(8), 173203c4805SLuis R. Rodriguez ATH9K_HW_CAP_HT = BIT(9), 174203c4805SLuis R. Rodriguez ATH9K_HW_CAP_GTT = BIT(10), 175203c4805SLuis R. Rodriguez ATH9K_HW_CAP_FASTCC = BIT(11), 176203c4805SLuis R. Rodriguez ATH9K_HW_CAP_RFSILENT = BIT(12), 177203c4805SLuis R. Rodriguez ATH9K_HW_CAP_CST = BIT(13), 178203c4805SLuis R. Rodriguez ATH9K_HW_CAP_ENHANCEDPM = BIT(14), 179203c4805SLuis R. Rodriguez ATH9K_HW_CAP_AUTOSLEEP = BIT(15), 180203c4805SLuis R. Rodriguez ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(16), 1811adf02ffSVasanthakumar Thiagarajan ATH9K_HW_CAP_EDMA = BIT(17), 1826c84ce08SVasanthakumar Thiagarajan ATH9K_HW_CAP_RAC_SUPPORTED = BIT(18), 183203c4805SLuis R. Rodriguez }; 184203c4805SLuis R. Rodriguez 185203c4805SLuis R. Rodriguez enum ath9k_capability_type { 186203c4805SLuis R. Rodriguez ATH9K_CAP_CIPHER = 0, 187203c4805SLuis R. Rodriguez ATH9K_CAP_TKIP_MIC, 188203c4805SLuis R. Rodriguez ATH9K_CAP_TKIP_SPLIT, 189203c4805SLuis R. Rodriguez ATH9K_CAP_TXPOW, 190203c4805SLuis R. Rodriguez ATH9K_CAP_MCAST_KEYSRCH, 191203c4805SLuis R. Rodriguez ATH9K_CAP_DS 192203c4805SLuis R. Rodriguez }; 193203c4805SLuis R. Rodriguez 194203c4805SLuis R. Rodriguez struct ath9k_hw_capabilities { 195203c4805SLuis R. Rodriguez u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */ 196203c4805SLuis R. Rodriguez DECLARE_BITMAP(wireless_modes, ATH9K_MODE_MAX); /* ATH9K_MODE_* */ 197203c4805SLuis R. Rodriguez u16 total_queues; 198203c4805SLuis R. Rodriguez u16 keycache_size; 199203c4805SLuis R. Rodriguez u16 low_5ghz_chan, high_5ghz_chan; 200203c4805SLuis R. Rodriguez u16 low_2ghz_chan, high_2ghz_chan; 201203c4805SLuis R. Rodriguez u16 rts_aggr_limit; 202203c4805SLuis R. Rodriguez u8 tx_chainmask; 203203c4805SLuis R. Rodriguez u8 rx_chainmask; 204203c4805SLuis R. Rodriguez u16 tx_triglevel_max; 205203c4805SLuis R. Rodriguez u16 reg_cap; 206203c4805SLuis R. Rodriguez u8 num_gpio_pins; 207203c4805SLuis R. Rodriguez u8 num_antcfg_2ghz; 208203c4805SLuis R. Rodriguez u8 num_antcfg_5ghz; 209ceb26445SVasanthakumar Thiagarajan u8 rx_hp_qdepth; 210ceb26445SVasanthakumar Thiagarajan u8 rx_lp_qdepth; 211ceb26445SVasanthakumar Thiagarajan u8 rx_status_len; 212162c3be3SVasanthakumar Thiagarajan u8 tx_desc_len; 213203c4805SLuis R. Rodriguez }; 214203c4805SLuis R. Rodriguez 215203c4805SLuis R. Rodriguez struct ath9k_ops_config { 216203c4805SLuis R. Rodriguez int dma_beacon_response_time; 217203c4805SLuis R. Rodriguez int sw_beacon_response_time; 218203c4805SLuis R. Rodriguez int additional_swba_backoff; 219203c4805SLuis R. Rodriguez int ack_6mb; 220203c4805SLuis R. Rodriguez int cwm_ignore_extcca; 221203c4805SLuis R. Rodriguez u8 pcie_powersave_enable; 222203c4805SLuis R. Rodriguez u8 pcie_clock_req; 223203c4805SLuis R. Rodriguez u32 pcie_waen; 224203c4805SLuis R. Rodriguez u8 analog_shiftreg; 225203c4805SLuis R. Rodriguez u8 ht_enable; 226203c4805SLuis R. Rodriguez u32 ofdm_trig_low; 227203c4805SLuis R. Rodriguez u32 ofdm_trig_high; 228203c4805SLuis R. Rodriguez u32 cck_trig_high; 229203c4805SLuis R. Rodriguez u32 cck_trig_low; 230203c4805SLuis R. Rodriguez u32 enable_ani; 231203c4805SLuis R. Rodriguez int serialize_regmode; 2320ce024cbSSujith bool rx_intr_mitigation; 23355e82df4SVasanthakumar Thiagarajan bool tx_intr_mitigation; 234203c4805SLuis R. Rodriguez #define SPUR_DISABLE 0 235203c4805SLuis R. Rodriguez #define SPUR_ENABLE_IOCTL 1 236203c4805SLuis R. Rodriguez #define SPUR_ENABLE_EEPROM 2 237203c4805SLuis R. Rodriguez #define AR_EEPROM_MODAL_SPURS 5 238203c4805SLuis R. Rodriguez #define AR_SPUR_5413_1 1640 239203c4805SLuis R. Rodriguez #define AR_SPUR_5413_2 1200 240203c4805SLuis R. Rodriguez #define AR_NO_SPUR 0x8000 241203c4805SLuis R. Rodriguez #define AR_BASE_FREQ_2GHZ 2300 242203c4805SLuis R. Rodriguez #define AR_BASE_FREQ_5GHZ 4900 243203c4805SLuis R. Rodriguez #define AR_SPUR_FEEQ_BOUND_HT40 19 244203c4805SLuis R. Rodriguez #define AR_SPUR_FEEQ_BOUND_HT20 10 245203c4805SLuis R. Rodriguez int spurmode; 246203c4805SLuis R. Rodriguez u16 spurchans[AR_EEPROM_MODAL_SPURS][2]; 247f4709fdfSLuis R. Rodriguez u8 max_txtrig_level; 248203c4805SLuis R. Rodriguez }; 249203c4805SLuis R. Rodriguez 250203c4805SLuis R. Rodriguez enum ath9k_int { 251203c4805SLuis R. Rodriguez ATH9K_INT_RX = 0x00000001, 252203c4805SLuis R. Rodriguez ATH9K_INT_RXDESC = 0x00000002, 253b5c80475SFelix Fietkau ATH9K_INT_RXHP = 0x00000001, 254b5c80475SFelix Fietkau ATH9K_INT_RXLP = 0x00000002, 255203c4805SLuis R. Rodriguez ATH9K_INT_RXNOFRM = 0x00000008, 256203c4805SLuis R. Rodriguez ATH9K_INT_RXEOL = 0x00000010, 257203c4805SLuis R. Rodriguez ATH9K_INT_RXORN = 0x00000020, 258203c4805SLuis R. Rodriguez ATH9K_INT_TX = 0x00000040, 259203c4805SLuis R. Rodriguez ATH9K_INT_TXDESC = 0x00000080, 260203c4805SLuis R. Rodriguez ATH9K_INT_TIM_TIMER = 0x00000100, 261203c4805SLuis R. Rodriguez ATH9K_INT_TXURN = 0x00000800, 262203c4805SLuis R. Rodriguez ATH9K_INT_MIB = 0x00001000, 263203c4805SLuis R. Rodriguez ATH9K_INT_RXPHY = 0x00004000, 264203c4805SLuis R. Rodriguez ATH9K_INT_RXKCM = 0x00008000, 265203c4805SLuis R. Rodriguez ATH9K_INT_SWBA = 0x00010000, 266203c4805SLuis R. Rodriguez ATH9K_INT_BMISS = 0x00040000, 267203c4805SLuis R. Rodriguez ATH9K_INT_BNR = 0x00100000, 268203c4805SLuis R. Rodriguez ATH9K_INT_TIM = 0x00200000, 269203c4805SLuis R. Rodriguez ATH9K_INT_DTIM = 0x00400000, 270203c4805SLuis R. Rodriguez ATH9K_INT_DTIMSYNC = 0x00800000, 271203c4805SLuis R. Rodriguez ATH9K_INT_GPIO = 0x01000000, 272203c4805SLuis R. Rodriguez ATH9K_INT_CABEND = 0x02000000, 273203c4805SLuis R. Rodriguez ATH9K_INT_TSFOOR = 0x04000000, 274ff155a45SVasanthakumar Thiagarajan ATH9K_INT_GENTIMER = 0x08000000, 275203c4805SLuis R. Rodriguez ATH9K_INT_CST = 0x10000000, 276203c4805SLuis R. Rodriguez ATH9K_INT_GTT = 0x20000000, 277203c4805SLuis R. Rodriguez ATH9K_INT_FATAL = 0x40000000, 278203c4805SLuis R. Rodriguez ATH9K_INT_GLOBAL = 0x80000000, 279203c4805SLuis R. Rodriguez ATH9K_INT_BMISC = ATH9K_INT_TIM | 280203c4805SLuis R. Rodriguez ATH9K_INT_DTIM | 281203c4805SLuis R. Rodriguez ATH9K_INT_DTIMSYNC | 282203c4805SLuis R. Rodriguez ATH9K_INT_TSFOOR | 283203c4805SLuis R. Rodriguez ATH9K_INT_CABEND, 284203c4805SLuis R. Rodriguez ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM | 285203c4805SLuis R. Rodriguez ATH9K_INT_RXDESC | 286203c4805SLuis R. Rodriguez ATH9K_INT_RXEOL | 287203c4805SLuis R. Rodriguez ATH9K_INT_RXORN | 288203c4805SLuis R. Rodriguez ATH9K_INT_TXURN | 289203c4805SLuis R. Rodriguez ATH9K_INT_TXDESC | 290203c4805SLuis R. Rodriguez ATH9K_INT_MIB | 291203c4805SLuis R. Rodriguez ATH9K_INT_RXPHY | 292203c4805SLuis R. Rodriguez ATH9K_INT_RXKCM | 293203c4805SLuis R. Rodriguez ATH9K_INT_SWBA | 294203c4805SLuis R. Rodriguez ATH9K_INT_BMISS | 295203c4805SLuis R. Rodriguez ATH9K_INT_GPIO, 296203c4805SLuis R. Rodriguez ATH9K_INT_NOCARD = 0xffffffff 297203c4805SLuis R. Rodriguez }; 298203c4805SLuis R. Rodriguez 299203c4805SLuis R. Rodriguez #define CHANNEL_CW_INT 0x00002 300203c4805SLuis R. Rodriguez #define CHANNEL_CCK 0x00020 301203c4805SLuis R. Rodriguez #define CHANNEL_OFDM 0x00040 302203c4805SLuis R. Rodriguez #define CHANNEL_2GHZ 0x00080 303203c4805SLuis R. Rodriguez #define CHANNEL_5GHZ 0x00100 304203c4805SLuis R. Rodriguez #define CHANNEL_PASSIVE 0x00200 305203c4805SLuis R. Rodriguez #define CHANNEL_DYN 0x00400 306203c4805SLuis R. Rodriguez #define CHANNEL_HALF 0x04000 307203c4805SLuis R. Rodriguez #define CHANNEL_QUARTER 0x08000 308203c4805SLuis R. Rodriguez #define CHANNEL_HT20 0x10000 309203c4805SLuis R. Rodriguez #define CHANNEL_HT40PLUS 0x20000 310203c4805SLuis R. Rodriguez #define CHANNEL_HT40MINUS 0x40000 311203c4805SLuis R. Rodriguez 312203c4805SLuis R. Rodriguez #define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM) 313203c4805SLuis R. Rodriguez #define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK) 314203c4805SLuis R. Rodriguez #define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM) 315203c4805SLuis R. Rodriguez #define CHANNEL_G_HT20 (CHANNEL_2GHZ|CHANNEL_HT20) 316203c4805SLuis R. Rodriguez #define CHANNEL_A_HT20 (CHANNEL_5GHZ|CHANNEL_HT20) 317203c4805SLuis R. Rodriguez #define CHANNEL_G_HT40PLUS (CHANNEL_2GHZ|CHANNEL_HT40PLUS) 318203c4805SLuis R. Rodriguez #define CHANNEL_G_HT40MINUS (CHANNEL_2GHZ|CHANNEL_HT40MINUS) 319203c4805SLuis R. Rodriguez #define CHANNEL_A_HT40PLUS (CHANNEL_5GHZ|CHANNEL_HT40PLUS) 320203c4805SLuis R. Rodriguez #define CHANNEL_A_HT40MINUS (CHANNEL_5GHZ|CHANNEL_HT40MINUS) 321203c4805SLuis R. Rodriguez #define CHANNEL_ALL \ 322203c4805SLuis R. Rodriguez (CHANNEL_OFDM| \ 323203c4805SLuis R. Rodriguez CHANNEL_CCK| \ 324203c4805SLuis R. Rodriguez CHANNEL_2GHZ | \ 325203c4805SLuis R. Rodriguez CHANNEL_5GHZ | \ 326203c4805SLuis R. Rodriguez CHANNEL_HT20 | \ 327203c4805SLuis R. Rodriguez CHANNEL_HT40PLUS | \ 328203c4805SLuis R. Rodriguez CHANNEL_HT40MINUS) 329203c4805SLuis R. Rodriguez 330203c4805SLuis R. Rodriguez struct ath9k_channel { 331203c4805SLuis R. Rodriguez struct ieee80211_channel *chan; 332203c4805SLuis R. Rodriguez u16 channel; 333203c4805SLuis R. Rodriguez u32 channelFlags; 334203c4805SLuis R. Rodriguez u32 chanmode; 335203c4805SLuis R. Rodriguez int32_t CalValid; 336203c4805SLuis R. Rodriguez bool oneTimeCalsDone; 337203c4805SLuis R. Rodriguez int8_t iCoff; 338203c4805SLuis R. Rodriguez int8_t qCoff; 339203c4805SLuis R. Rodriguez int16_t rawNoiseFloor; 340203c4805SLuis R. Rodriguez }; 341203c4805SLuis R. Rodriguez 342203c4805SLuis R. Rodriguez #define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \ 343203c4805SLuis R. Rodriguez (((_c)->channelFlags & CHANNEL_G_HT20) == CHANNEL_G_HT20) || \ 344203c4805SLuis R. Rodriguez (((_c)->channelFlags & CHANNEL_G_HT40PLUS) == CHANNEL_G_HT40PLUS) || \ 345203c4805SLuis R. Rodriguez (((_c)->channelFlags & CHANNEL_G_HT40MINUS) == CHANNEL_G_HT40MINUS)) 346203c4805SLuis R. Rodriguez #define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0) 347203c4805SLuis R. Rodriguez #define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0) 348203c4805SLuis R. Rodriguez #define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0) 349203c4805SLuis R. Rodriguez #define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0) 350203c4805SLuis R. Rodriguez #define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0) 351203c4805SLuis R. Rodriguez #define IS_CHAN_A_5MHZ_SPACED(_c) \ 352203c4805SLuis R. Rodriguez ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) && \ 353203c4805SLuis R. Rodriguez (((_c)->channel % 20) != 0) && \ 354203c4805SLuis R. Rodriguez (((_c)->channel % 10) != 0)) 355203c4805SLuis R. Rodriguez 356203c4805SLuis R. Rodriguez /* These macros check chanmode and not channelFlags */ 357203c4805SLuis R. Rodriguez #define IS_CHAN_B(_c) ((_c)->chanmode == CHANNEL_B) 358203c4805SLuis R. Rodriguez #define IS_CHAN_HT20(_c) (((_c)->chanmode == CHANNEL_A_HT20) || \ 359203c4805SLuis R. Rodriguez ((_c)->chanmode == CHANNEL_G_HT20)) 360203c4805SLuis R. Rodriguez #define IS_CHAN_HT40(_c) (((_c)->chanmode == CHANNEL_A_HT40PLUS) || \ 361203c4805SLuis R. Rodriguez ((_c)->chanmode == CHANNEL_A_HT40MINUS) || \ 362203c4805SLuis R. Rodriguez ((_c)->chanmode == CHANNEL_G_HT40PLUS) || \ 363203c4805SLuis R. Rodriguez ((_c)->chanmode == CHANNEL_G_HT40MINUS)) 364203c4805SLuis R. Rodriguez #define IS_CHAN_HT(_c) (IS_CHAN_HT20((_c)) || IS_CHAN_HT40((_c))) 365203c4805SLuis R. Rodriguez 366203c4805SLuis R. Rodriguez enum ath9k_power_mode { 367203c4805SLuis R. Rodriguez ATH9K_PM_AWAKE = 0, 368203c4805SLuis R. Rodriguez ATH9K_PM_FULL_SLEEP, 369203c4805SLuis R. Rodriguez ATH9K_PM_NETWORK_SLEEP, 370203c4805SLuis R. Rodriguez ATH9K_PM_UNDEFINED 371203c4805SLuis R. Rodriguez }; 372203c4805SLuis R. Rodriguez 373203c4805SLuis R. Rodriguez enum ath9k_tp_scale { 374203c4805SLuis R. Rodriguez ATH9K_TP_SCALE_MAX = 0, 375203c4805SLuis R. Rodriguez ATH9K_TP_SCALE_50, 376203c4805SLuis R. Rodriguez ATH9K_TP_SCALE_25, 377203c4805SLuis R. Rodriguez ATH9K_TP_SCALE_12, 378203c4805SLuis R. Rodriguez ATH9K_TP_SCALE_MIN 379203c4805SLuis R. Rodriguez }; 380203c4805SLuis R. Rodriguez 381203c4805SLuis R. Rodriguez enum ser_reg_mode { 382203c4805SLuis R. Rodriguez SER_REG_MODE_OFF = 0, 383203c4805SLuis R. Rodriguez SER_REG_MODE_ON = 1, 384203c4805SLuis R. Rodriguez SER_REG_MODE_AUTO = 2, 385203c4805SLuis R. Rodriguez }; 386203c4805SLuis R. Rodriguez 387ad7b8060SVasanthakumar Thiagarajan enum ath9k_rx_qtype { 388ad7b8060SVasanthakumar Thiagarajan ATH9K_RX_QUEUE_HP, 389ad7b8060SVasanthakumar Thiagarajan ATH9K_RX_QUEUE_LP, 390ad7b8060SVasanthakumar Thiagarajan ATH9K_RX_QUEUE_MAX, 391ad7b8060SVasanthakumar Thiagarajan }; 392ad7b8060SVasanthakumar Thiagarajan 393203c4805SLuis R. Rodriguez struct ath9k_beacon_state { 394203c4805SLuis R. Rodriguez u32 bs_nexttbtt; 395203c4805SLuis R. Rodriguez u32 bs_nextdtim; 396203c4805SLuis R. Rodriguez u32 bs_intval; 397203c4805SLuis R. Rodriguez #define ATH9K_BEACON_PERIOD 0x0000ffff 398203c4805SLuis R. Rodriguez #define ATH9K_BEACON_ENA 0x00800000 399203c4805SLuis R. Rodriguez #define ATH9K_BEACON_RESET_TSF 0x01000000 400203c4805SLuis R. Rodriguez #define ATH9K_TSFOOR_THRESHOLD 0x00004240 /* 16k us */ 401203c4805SLuis R. Rodriguez u32 bs_dtimperiod; 402203c4805SLuis R. Rodriguez u16 bs_cfpperiod; 403203c4805SLuis R. Rodriguez u16 bs_cfpmaxduration; 404203c4805SLuis R. Rodriguez u32 bs_cfpnext; 405203c4805SLuis R. Rodriguez u16 bs_timoffset; 406203c4805SLuis R. Rodriguez u16 bs_bmissthreshold; 407203c4805SLuis R. Rodriguez u32 bs_sleepduration; 408203c4805SLuis R. Rodriguez u32 bs_tsfoor_threshold; 409203c4805SLuis R. Rodriguez }; 410203c4805SLuis R. Rodriguez 411203c4805SLuis R. Rodriguez struct chan_centers { 412203c4805SLuis R. Rodriguez u16 synth_center; 413203c4805SLuis R. Rodriguez u16 ctl_center; 414203c4805SLuis R. Rodriguez u16 ext_center; 415203c4805SLuis R. Rodriguez }; 416203c4805SLuis R. Rodriguez 417203c4805SLuis R. Rodriguez enum { 418203c4805SLuis R. Rodriguez ATH9K_RESET_POWER_ON, 419203c4805SLuis R. Rodriguez ATH9K_RESET_WARM, 420203c4805SLuis R. Rodriguez ATH9K_RESET_COLD, 421203c4805SLuis R. Rodriguez }; 422203c4805SLuis R. Rodriguez 423203c4805SLuis R. Rodriguez struct ath9k_hw_version { 424203c4805SLuis R. Rodriguez u32 magic; 425203c4805SLuis R. Rodriguez u16 devid; 426203c4805SLuis R. Rodriguez u16 subvendorid; 427203c4805SLuis R. Rodriguez u32 macVersion; 428203c4805SLuis R. Rodriguez u16 macRev; 429203c4805SLuis R. Rodriguez u16 phyRev; 430203c4805SLuis R. Rodriguez u16 analog5GhzRev; 431203c4805SLuis R. Rodriguez u16 analog2GhzRev; 432aeac355dSVasanthakumar Thiagarajan u16 subsysid; 433203c4805SLuis R. Rodriguez }; 434203c4805SLuis R. Rodriguez 435ff155a45SVasanthakumar Thiagarajan /* Generic TSF timer definitions */ 436ff155a45SVasanthakumar Thiagarajan 437ff155a45SVasanthakumar Thiagarajan #define ATH_MAX_GEN_TIMER 16 438ff155a45SVasanthakumar Thiagarajan 439ff155a45SVasanthakumar Thiagarajan #define AR_GENTMR_BIT(_index) (1 << (_index)) 440ff155a45SVasanthakumar Thiagarajan 441ff155a45SVasanthakumar Thiagarajan /* 442ff155a45SVasanthakumar Thiagarajan * Using de Bruijin sequence to to look up 1's index in a 32 bit number 443ff155a45SVasanthakumar Thiagarajan * debruijn32 = 0000 0111 0111 1100 1011 0101 0011 0001 444ff155a45SVasanthakumar Thiagarajan */ 445c90017ddSVasanthakumar Thiagarajan #define debruijn32 0x077CB531U 446ff155a45SVasanthakumar Thiagarajan 447ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer_configuration { 448ff155a45SVasanthakumar Thiagarajan u32 next_addr; 449ff155a45SVasanthakumar Thiagarajan u32 period_addr; 450ff155a45SVasanthakumar Thiagarajan u32 mode_addr; 451ff155a45SVasanthakumar Thiagarajan u32 mode_mask; 452ff155a45SVasanthakumar Thiagarajan }; 453ff155a45SVasanthakumar Thiagarajan 454ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer { 455ff155a45SVasanthakumar Thiagarajan void (*trigger)(void *arg); 456ff155a45SVasanthakumar Thiagarajan void (*overflow)(void *arg); 457ff155a45SVasanthakumar Thiagarajan void *arg; 458ff155a45SVasanthakumar Thiagarajan u8 index; 459ff155a45SVasanthakumar Thiagarajan }; 460ff155a45SVasanthakumar Thiagarajan 461ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer_table { 462ff155a45SVasanthakumar Thiagarajan u32 gen_timer_index[32]; 463ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer *timers[ATH_MAX_GEN_TIMER]; 464ff155a45SVasanthakumar Thiagarajan union { 465ff155a45SVasanthakumar Thiagarajan unsigned long timer_bits; 466ff155a45SVasanthakumar Thiagarajan u16 val; 467ff155a45SVasanthakumar Thiagarajan } timer_mask; 468ff155a45SVasanthakumar Thiagarajan }; 469ff155a45SVasanthakumar Thiagarajan 470d70357d5SLuis R. Rodriguez /** 471d70357d5SLuis R. Rodriguez * struct ath_hw_private_ops - callbacks used internally by hardware code 472d70357d5SLuis R. Rodriguez * 473d70357d5SLuis R. Rodriguez * This structure contains private callbacks designed to only be used internally 474d70357d5SLuis R. Rodriguez * by the hardware core. 475d70357d5SLuis R. Rodriguez * 476795f5e2cSLuis R. Rodriguez * @init_cal_settings: setup types of calibrations supported 477795f5e2cSLuis R. Rodriguez * @init_cal: starts actual calibration 478795f5e2cSLuis R. Rodriguez * 479d70357d5SLuis R. Rodriguez * @init_mode_regs: Initializes mode registers 480991312d8SLuis R. Rodriguez * @init_mode_gain_regs: Initialize TX/RX gain registers 481d70357d5SLuis R. Rodriguez * @macversion_supported: If this specific mac revision is supported 4828fe65368SLuis R. Rodriguez * 4838fe65368SLuis R. Rodriguez * @rf_set_freq: change frequency 4848fe65368SLuis R. Rodriguez * @spur_mitigate_freq: spur mitigation 4858fe65368SLuis R. Rodriguez * @rf_alloc_ext_banks: 4868fe65368SLuis R. Rodriguez * @rf_free_ext_banks: 4878fe65368SLuis R. Rodriguez * @set_rf_regs: 48864773964SLuis R. Rodriguez * @compute_pll_control: compute the PLL control value to use for 48964773964SLuis R. Rodriguez * AR_RTC_PLL_CONTROL for a given channel 490795f5e2cSLuis R. Rodriguez * @setup_calibration: set up calibration 491795f5e2cSLuis R. Rodriguez * @iscal_supported: used to query if a type of calibration is supported 49277d6d39aSLuis R. Rodriguez * @loadnf: load noise floor read from each chain on the CCA registers 493d70357d5SLuis R. Rodriguez */ 494d70357d5SLuis R. Rodriguez struct ath_hw_private_ops { 495795f5e2cSLuis R. Rodriguez /* Calibration ops */ 496d70357d5SLuis R. Rodriguez void (*init_cal_settings)(struct ath_hw *ah); 497795f5e2cSLuis R. Rodriguez bool (*init_cal)(struct ath_hw *ah, struct ath9k_channel *chan); 498795f5e2cSLuis R. Rodriguez 499d70357d5SLuis R. Rodriguez void (*init_mode_regs)(struct ath_hw *ah); 500991312d8SLuis R. Rodriguez void (*init_mode_gain_regs)(struct ath_hw *ah); 501d70357d5SLuis R. Rodriguez bool (*macversion_supported)(u32 macversion); 502795f5e2cSLuis R. Rodriguez void (*setup_calibration)(struct ath_hw *ah, 503795f5e2cSLuis R. Rodriguez struct ath9k_cal_list *currCal); 504795f5e2cSLuis R. Rodriguez bool (*iscal_supported)(struct ath_hw *ah, 505795f5e2cSLuis R. Rodriguez enum ath9k_cal_types calType); 5068fe65368SLuis R. Rodriguez 5078fe65368SLuis R. Rodriguez /* PHY ops */ 5088fe65368SLuis R. Rodriguez int (*rf_set_freq)(struct ath_hw *ah, 5098fe65368SLuis R. Rodriguez struct ath9k_channel *chan); 5108fe65368SLuis R. Rodriguez void (*spur_mitigate_freq)(struct ath_hw *ah, 5118fe65368SLuis R. Rodriguez struct ath9k_channel *chan); 5128fe65368SLuis R. Rodriguez int (*rf_alloc_ext_banks)(struct ath_hw *ah); 5138fe65368SLuis R. Rodriguez void (*rf_free_ext_banks)(struct ath_hw *ah); 5148fe65368SLuis R. Rodriguez bool (*set_rf_regs)(struct ath_hw *ah, 5158fe65368SLuis R. Rodriguez struct ath9k_channel *chan, 5168fe65368SLuis R. Rodriguez u16 modesIndex); 5178fe65368SLuis R. Rodriguez void (*set_channel_regs)(struct ath_hw *ah, struct ath9k_channel *chan); 5188fe65368SLuis R. Rodriguez void (*init_bb)(struct ath_hw *ah, 5198fe65368SLuis R. Rodriguez struct ath9k_channel *chan); 5208fe65368SLuis R. Rodriguez int (*process_ini)(struct ath_hw *ah, struct ath9k_channel *chan); 5218fe65368SLuis R. Rodriguez void (*olc_init)(struct ath_hw *ah); 5228fe65368SLuis R. Rodriguez void (*set_rfmode)(struct ath_hw *ah, struct ath9k_channel *chan); 5238fe65368SLuis R. Rodriguez void (*mark_phy_inactive)(struct ath_hw *ah); 5248fe65368SLuis R. Rodriguez void (*set_delta_slope)(struct ath_hw *ah, struct ath9k_channel *chan); 5258fe65368SLuis R. Rodriguez bool (*rfbus_req)(struct ath_hw *ah); 5268fe65368SLuis R. Rodriguez void (*rfbus_done)(struct ath_hw *ah); 5278fe65368SLuis R. Rodriguez void (*enable_rfkill)(struct ath_hw *ah); 5288fe65368SLuis R. Rodriguez void (*restore_chainmask)(struct ath_hw *ah); 5298fe65368SLuis R. Rodriguez void (*set_diversity)(struct ath_hw *ah, bool value); 53064773964SLuis R. Rodriguez u32 (*compute_pll_control)(struct ath_hw *ah, 53164773964SLuis R. Rodriguez struct ath9k_channel *chan); 532c16fcb49SFelix Fietkau bool (*ani_control)(struct ath_hw *ah, enum ath9k_ani_cmd cmd, 533c16fcb49SFelix Fietkau int param); 534641d9921SFelix Fietkau void (*do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS]); 53577d6d39aSLuis R. Rodriguez void (*loadnf)(struct ath_hw *ah, struct ath9k_channel *chan); 536d70357d5SLuis R. Rodriguez }; 537d70357d5SLuis R. Rodriguez 538d70357d5SLuis R. Rodriguez /** 539d70357d5SLuis R. Rodriguez * struct ath_hw_ops - callbacks used by hardware code and driver code 540d70357d5SLuis R. Rodriguez * 541d70357d5SLuis R. Rodriguez * This structure contains callbacks designed to to be used internally by 542d70357d5SLuis R. Rodriguez * hardware code and also by the lower level driver. 543d70357d5SLuis R. Rodriguez * 544d70357d5SLuis R. Rodriguez * @config_pci_powersave: 545795f5e2cSLuis R. Rodriguez * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC 546d70357d5SLuis R. Rodriguez */ 547d70357d5SLuis R. Rodriguez struct ath_hw_ops { 548d70357d5SLuis R. Rodriguez void (*config_pci_powersave)(struct ath_hw *ah, 549d70357d5SLuis R. Rodriguez int restore, 550d70357d5SLuis R. Rodriguez int power_off); 551cee1f625SVasanthakumar Thiagarajan void (*rx_enable)(struct ath_hw *ah); 55287d5efbbSVasanthakumar Thiagarajan void (*set_desc_link)(void *ds, u32 link); 55387d5efbbSVasanthakumar Thiagarajan void (*get_desc_link)(void *ds, u32 **link); 554795f5e2cSLuis R. Rodriguez bool (*calibrate)(struct ath_hw *ah, 555795f5e2cSLuis R. Rodriguez struct ath9k_channel *chan, 556795f5e2cSLuis R. Rodriguez u8 rxchainmask, 557795f5e2cSLuis R. Rodriguez bool longcal); 55855e82df4SVasanthakumar Thiagarajan bool (*get_isr)(struct ath_hw *ah, enum ath9k_int *masked); 559cc610ac0SVasanthakumar Thiagarajan void (*fill_txdesc)(struct ath_hw *ah, void *ds, u32 seglen, 560cc610ac0SVasanthakumar Thiagarajan bool is_firstseg, bool is_is_lastseg, 561cc610ac0SVasanthakumar Thiagarajan const void *ds0, dma_addr_t buf_addr, 562cc610ac0SVasanthakumar Thiagarajan unsigned int qcu); 563cc610ac0SVasanthakumar Thiagarajan int (*proc_txdesc)(struct ath_hw *ah, void *ds, 564cc610ac0SVasanthakumar Thiagarajan struct ath_tx_status *ts); 565cc610ac0SVasanthakumar Thiagarajan void (*set11n_txdesc)(struct ath_hw *ah, void *ds, 566cc610ac0SVasanthakumar Thiagarajan u32 pktLen, enum ath9k_pkt_type type, 567cc610ac0SVasanthakumar Thiagarajan u32 txPower, u32 keyIx, 568cc610ac0SVasanthakumar Thiagarajan enum ath9k_key_type keyType, 569cc610ac0SVasanthakumar Thiagarajan u32 flags); 570cc610ac0SVasanthakumar Thiagarajan void (*set11n_ratescenario)(struct ath_hw *ah, void *ds, 571cc610ac0SVasanthakumar Thiagarajan void *lastds, 572cc610ac0SVasanthakumar Thiagarajan u32 durUpdateEn, u32 rtsctsRate, 573cc610ac0SVasanthakumar Thiagarajan u32 rtsctsDuration, 574cc610ac0SVasanthakumar Thiagarajan struct ath9k_11n_rate_series series[], 575cc610ac0SVasanthakumar Thiagarajan u32 nseries, u32 flags); 576cc610ac0SVasanthakumar Thiagarajan void (*set11n_aggr_first)(struct ath_hw *ah, void *ds, 577cc610ac0SVasanthakumar Thiagarajan u32 aggrLen); 578cc610ac0SVasanthakumar Thiagarajan void (*set11n_aggr_middle)(struct ath_hw *ah, void *ds, 579cc610ac0SVasanthakumar Thiagarajan u32 numDelims); 580cc610ac0SVasanthakumar Thiagarajan void (*set11n_aggr_last)(struct ath_hw *ah, void *ds); 581cc610ac0SVasanthakumar Thiagarajan void (*clr11n_aggr)(struct ath_hw *ah, void *ds); 582cc610ac0SVasanthakumar Thiagarajan void (*set11n_burstduration)(struct ath_hw *ah, void *ds, 583cc610ac0SVasanthakumar Thiagarajan u32 burstDuration); 584cc610ac0SVasanthakumar Thiagarajan void (*set11n_virtualmorefrag)(struct ath_hw *ah, void *ds, 585cc610ac0SVasanthakumar Thiagarajan u32 vmf); 586d70357d5SLuis R. Rodriguez }; 587d70357d5SLuis R. Rodriguez 588203c4805SLuis R. Rodriguez struct ath_hw { 589b002a4a9SLuis R. Rodriguez struct ieee80211_hw *hw; 59027c51f1aSLuis R. Rodriguez struct ath_common common; 591203c4805SLuis R. Rodriguez struct ath9k_hw_version hw_version; 592203c4805SLuis R. Rodriguez struct ath9k_ops_config config; 593203c4805SLuis R. Rodriguez struct ath9k_hw_capabilities caps; 594203c4805SLuis R. Rodriguez struct ath9k_channel channels[38]; 595203c4805SLuis R. Rodriguez struct ath9k_channel *curchan; 596203c4805SLuis R. Rodriguez 597203c4805SLuis R. Rodriguez union { 598203c4805SLuis R. Rodriguez struct ar5416_eeprom_def def; 599203c4805SLuis R. Rodriguez struct ar5416_eeprom_4k map4k; 600475f5989SLuis R. Rodriguez struct ar9287_eeprom map9287; 60115c9ee7aSSenthil Balasubramanian struct ar9300_eeprom ar9300_eep; 602203c4805SLuis R. Rodriguez } eeprom; 603203c4805SLuis R. Rodriguez const struct eeprom_ops *eep_ops; 604203c4805SLuis R. Rodriguez 605203c4805SLuis R. Rodriguez bool sw_mgmt_crypto; 606203c4805SLuis R. Rodriguez bool is_pciexpress; 6072eb46d9bSPavel Roskin bool need_an_top2_fixup; 608203c4805SLuis R. Rodriguez u16 tx_trig_level; 609641d9921SFelix Fietkau s16 nf_2g_max; 610641d9921SFelix Fietkau s16 nf_2g_min; 611641d9921SFelix Fietkau s16 nf_5g_max; 612641d9921SFelix Fietkau s16 nf_5g_min; 613203c4805SLuis R. Rodriguez u16 rfsilent; 614203c4805SLuis R. Rodriguez u32 rfkill_gpio; 615203c4805SLuis R. Rodriguez u32 rfkill_polarity; 616203c4805SLuis R. Rodriguez u32 ah_flags; 617203c4805SLuis R. Rodriguez 618d7e7d229SLuis R. Rodriguez bool htc_reset_init; 619d7e7d229SLuis R. Rodriguez 620203c4805SLuis R. Rodriguez enum nl80211_iftype opmode; 621203c4805SLuis R. Rodriguez enum ath9k_power_mode power_mode; 622203c4805SLuis R. Rodriguez 623203c4805SLuis R. Rodriguez struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; 624a13883b0SSujith struct ath9k_pacal_info pacal_info; 625203c4805SLuis R. Rodriguez struct ar5416Stats stats; 626203c4805SLuis R. Rodriguez struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES]; 627203c4805SLuis R. Rodriguez 628203c4805SLuis R. Rodriguez int16_t curchan_rad_index; 6293069168cSPavel Roskin enum ath9k_int imask; 63074bad5cbSPavel Roskin u32 imrs2_reg; 631203c4805SLuis R. Rodriguez u32 txok_interrupt_mask; 632203c4805SLuis R. Rodriguez u32 txerr_interrupt_mask; 633203c4805SLuis R. Rodriguez u32 txdesc_interrupt_mask; 634203c4805SLuis R. Rodriguez u32 txeol_interrupt_mask; 635203c4805SLuis R. Rodriguez u32 txurn_interrupt_mask; 636203c4805SLuis R. Rodriguez bool chip_fullsleep; 637203c4805SLuis R. Rodriguez u32 atim_window; 638203c4805SLuis R. Rodriguez 639203c4805SLuis R. Rodriguez /* Calibration */ 640cbfe9468SSujith enum ath9k_cal_types supp_cals; 641cbfe9468SSujith struct ath9k_cal_list iq_caldata; 642cbfe9468SSujith struct ath9k_cal_list adcgain_caldata; 643cbfe9468SSujith struct ath9k_cal_list adcdc_calinitdata; 644cbfe9468SSujith struct ath9k_cal_list adcdc_caldata; 645df23acaaSLuis R. Rodriguez struct ath9k_cal_list tempCompCalData; 646cbfe9468SSujith struct ath9k_cal_list *cal_list; 647cbfe9468SSujith struct ath9k_cal_list *cal_list_last; 648cbfe9468SSujith struct ath9k_cal_list *cal_list_curr; 649203c4805SLuis R. Rodriguez #define totalPowerMeasI meas0.unsign 650203c4805SLuis R. Rodriguez #define totalPowerMeasQ meas1.unsign 651203c4805SLuis R. Rodriguez #define totalIqCorrMeas meas2.sign 652203c4805SLuis R. Rodriguez #define totalAdcIOddPhase meas0.unsign 653203c4805SLuis R. Rodriguez #define totalAdcIEvenPhase meas1.unsign 654203c4805SLuis R. Rodriguez #define totalAdcQOddPhase meas2.unsign 655203c4805SLuis R. Rodriguez #define totalAdcQEvenPhase meas3.unsign 656203c4805SLuis R. Rodriguez #define totalAdcDcOffsetIOddPhase meas0.sign 657203c4805SLuis R. Rodriguez #define totalAdcDcOffsetIEvenPhase meas1.sign 658203c4805SLuis R. Rodriguez #define totalAdcDcOffsetQOddPhase meas2.sign 659203c4805SLuis R. Rodriguez #define totalAdcDcOffsetQEvenPhase meas3.sign 660203c4805SLuis R. Rodriguez union { 661203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 662203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 663203c4805SLuis R. Rodriguez } meas0; 664203c4805SLuis R. Rodriguez union { 665203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 666203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 667203c4805SLuis R. Rodriguez } meas1; 668203c4805SLuis R. Rodriguez union { 669203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 670203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 671203c4805SLuis R. Rodriguez } meas2; 672203c4805SLuis R. Rodriguez union { 673203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 674203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 675203c4805SLuis R. Rodriguez } meas3; 676203c4805SLuis R. Rodriguez u16 cal_samples; 677203c4805SLuis R. Rodriguez 678203c4805SLuis R. Rodriguez u32 sta_id1_defaults; 679203c4805SLuis R. Rodriguez u32 misc_mode; 680203c4805SLuis R. Rodriguez enum { 681203c4805SLuis R. Rodriguez AUTO_32KHZ, 682203c4805SLuis R. Rodriguez USE_32KHZ, 683203c4805SLuis R. Rodriguez DONT_USE_32KHZ, 684203c4805SLuis R. Rodriguez } enable_32kHz_clock; 685203c4805SLuis R. Rodriguez 686d70357d5SLuis R. Rodriguez /* Private to hardware code */ 687d70357d5SLuis R. Rodriguez struct ath_hw_private_ops private_ops; 688d70357d5SLuis R. Rodriguez /* Accessed by the lower level driver */ 689d70357d5SLuis R. Rodriguez struct ath_hw_ops ops; 690d70357d5SLuis R. Rodriguez 691e68a060bSLuis R. Rodriguez /* Used to program the radio on non single-chip devices */ 692203c4805SLuis R. Rodriguez u32 *analogBank0Data; 693203c4805SLuis R. Rodriguez u32 *analogBank1Data; 694203c4805SLuis R. Rodriguez u32 *analogBank2Data; 695203c4805SLuis R. Rodriguez u32 *analogBank3Data; 696203c4805SLuis R. Rodriguez u32 *analogBank6Data; 697203c4805SLuis R. Rodriguez u32 *analogBank6TPCData; 698203c4805SLuis R. Rodriguez u32 *analogBank7Data; 699203c4805SLuis R. Rodriguez u32 *addac5416_21; 700203c4805SLuis R. Rodriguez u32 *bank6Temp; 701203c4805SLuis R. Rodriguez 702203c4805SLuis R. Rodriguez int16_t txpower_indexoffset; 703e239d859SFelix Fietkau int coverage_class; 704203c4805SLuis R. Rodriguez u32 beacon_interval; 705203c4805SLuis R. Rodriguez u32 slottime; 706203c4805SLuis R. Rodriguez u32 globaltxtimeout; 707203c4805SLuis R. Rodriguez 708203c4805SLuis R. Rodriguez /* ANI */ 709203c4805SLuis R. Rodriguez u32 proc_phyerr; 710203c4805SLuis R. Rodriguez u32 aniperiod; 711203c4805SLuis R. Rodriguez struct ar5416AniState *curani; 712203c4805SLuis R. Rodriguez struct ar5416AniState ani[255]; 713203c4805SLuis R. Rodriguez int totalSizeDesired[5]; 714203c4805SLuis R. Rodriguez int coarse_high[5]; 715203c4805SLuis R. Rodriguez int coarse_low[5]; 716203c4805SLuis R. Rodriguez int firpwr[5]; 717203c4805SLuis R. Rodriguez enum ath9k_ani_cmd ani_function; 718203c4805SLuis R. Rodriguez 719af03abecSLuis R. Rodriguez /* Bluetooth coexistance */ 720766ec4a9SLuis R. Rodriguez struct ath_btcoex_hw btcoex_hw; 721af03abecSLuis R. Rodriguez 722203c4805SLuis R. Rodriguez u32 intr_txqs; 723203c4805SLuis R. Rodriguez u8 txchainmask; 724203c4805SLuis R. Rodriguez u8 rxchainmask; 725203c4805SLuis R. Rodriguez 726203c4805SLuis R. Rodriguez u32 originalGain[22]; 727203c4805SLuis R. Rodriguez int initPDADC; 728203c4805SLuis R. Rodriguez int PDADCdelta; 72908fc5c1bSVivek Natarajan u8 led_pin; 730203c4805SLuis R. Rodriguez 731203c4805SLuis R. Rodriguez struct ar5416IniArray iniModes; 732203c4805SLuis R. Rodriguez struct ar5416IniArray iniCommon; 733203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank0; 734203c4805SLuis R. Rodriguez struct ar5416IniArray iniBB_RfGain; 735203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank1; 736203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank2; 737203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank3; 738203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank6; 739203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank6TPC; 740203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank7; 741203c4805SLuis R. Rodriguez struct ar5416IniArray iniAddac; 742203c4805SLuis R. Rodriguez struct ar5416IniArray iniPcieSerdes; 74313ce3e99SLuis R. Rodriguez struct ar5416IniArray iniPcieSerdesLowPower; 744203c4805SLuis R. Rodriguez struct ar5416IniArray iniModesAdditional; 745203c4805SLuis R. Rodriguez struct ar5416IniArray iniModesRxGain; 746203c4805SLuis R. Rodriguez struct ar5416IniArray iniModesTxGain; 7478564328dSLuis R. Rodriguez struct ar5416IniArray iniModes_9271_1_0_only; 748193cd458SSujith struct ar5416IniArray iniCckfirNormal; 749193cd458SSujith struct ar5416IniArray iniCckfirJapan2484; 75070807e99SSujith struct ar5416IniArray iniCommon_normal_cck_fir_coeff_9271; 75170807e99SSujith struct ar5416IniArray iniCommon_japan_2484_cck_fir_coeff_9271; 75270807e99SSujith struct ar5416IniArray iniModes_9271_ANI_reg; 75370807e99SSujith struct ar5416IniArray iniModes_high_power_tx_gain_9271; 75470807e99SSujith struct ar5416IniArray iniModes_normal_power_tx_gain_9271; 755ff155a45SVasanthakumar Thiagarajan 75613ce3e99SLuis R. Rodriguez struct ar5416IniArray iniMac[ATH_INI_NUM_SPLIT]; 75713ce3e99SLuis R. Rodriguez struct ar5416IniArray iniBB[ATH_INI_NUM_SPLIT]; 75813ce3e99SLuis R. Rodriguez struct ar5416IniArray iniRadio[ATH_INI_NUM_SPLIT]; 75913ce3e99SLuis R. Rodriguez struct ar5416IniArray iniSOC[ATH_INI_NUM_SPLIT]; 76013ce3e99SLuis R. Rodriguez 761ff155a45SVasanthakumar Thiagarajan u32 intr_gen_timer_trigger; 762ff155a45SVasanthakumar Thiagarajan u32 intr_gen_timer_thresh; 763ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer_table hw_gen_timers; 764*744d4025SVasanthakumar Thiagarajan 765*744d4025SVasanthakumar Thiagarajan struct ar9003_txs *ts_ring; 766*744d4025SVasanthakumar Thiagarajan void *ts_start; 767*744d4025SVasanthakumar Thiagarajan u32 ts_paddr_start; 768*744d4025SVasanthakumar Thiagarajan u32 ts_paddr_end; 769*744d4025SVasanthakumar Thiagarajan u16 ts_tail; 770*744d4025SVasanthakumar Thiagarajan u8 ts_size; 771203c4805SLuis R. Rodriguez }; 772203c4805SLuis R. Rodriguez 7739e4bffd2SLuis R. Rodriguez static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) 7749e4bffd2SLuis R. Rodriguez { 7759e4bffd2SLuis R. Rodriguez return &ah->common; 7769e4bffd2SLuis R. Rodriguez } 7779e4bffd2SLuis R. Rodriguez 7789e4bffd2SLuis R. Rodriguez static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah) 7799e4bffd2SLuis R. Rodriguez { 7809e4bffd2SLuis R. Rodriguez return &(ath9k_hw_common(ah)->regulatory); 7819e4bffd2SLuis R. Rodriguez } 7829e4bffd2SLuis R. Rodriguez 783d70357d5SLuis R. Rodriguez static inline struct ath_hw_private_ops *ath9k_hw_private_ops(struct ath_hw *ah) 784d70357d5SLuis R. Rodriguez { 785d70357d5SLuis R. Rodriguez return &ah->private_ops; 786d70357d5SLuis R. Rodriguez } 787d70357d5SLuis R. Rodriguez 788d70357d5SLuis R. Rodriguez static inline struct ath_hw_ops *ath9k_hw_ops(struct ath_hw *ah) 789d70357d5SLuis R. Rodriguez { 790d70357d5SLuis R. Rodriguez return &ah->ops; 791d70357d5SLuis R. Rodriguez } 792d70357d5SLuis R. Rodriguez 793f637cfd6SLuis R. Rodriguez /* Initialization, Detach, Reset */ 794203c4805SLuis R. Rodriguez const char *ath9k_hw_probe(u16 vendorid, u16 devid); 795285f2ddaSSujith void ath9k_hw_deinit(struct ath_hw *ah); 796f637cfd6SLuis R. Rodriguez int ath9k_hw_init(struct ath_hw *ah); 797203c4805SLuis R. Rodriguez int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, 798203c4805SLuis R. Rodriguez bool bChannelChange); 799a9a29ce6SGabor Juhos int ath9k_hw_fill_cap_info(struct ath_hw *ah); 800203c4805SLuis R. Rodriguez bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type, 801203c4805SLuis R. Rodriguez u32 capability, u32 *result); 802203c4805SLuis R. Rodriguez bool ath9k_hw_setcapability(struct ath_hw *ah, enum ath9k_capability_type type, 803203c4805SLuis R. Rodriguez u32 capability, u32 setting, int *status); 8048fe65368SLuis R. Rodriguez u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan); 805203c4805SLuis R. Rodriguez 806203c4805SLuis R. Rodriguez /* Key Cache Management */ 807203c4805SLuis R. Rodriguez bool ath9k_hw_keyreset(struct ath_hw *ah, u16 entry); 808203c4805SLuis R. Rodriguez bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac); 809203c4805SLuis R. Rodriguez bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry, 810203c4805SLuis R. Rodriguez const struct ath9k_keyval *k, 811203c4805SLuis R. Rodriguez const u8 *mac); 812203c4805SLuis R. Rodriguez bool ath9k_hw_keyisvalid(struct ath_hw *ah, u16 entry); 813203c4805SLuis R. Rodriguez 814203c4805SLuis R. Rodriguez /* GPIO / RFKILL / Antennae */ 815203c4805SLuis R. Rodriguez void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio); 816203c4805SLuis R. Rodriguez u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio); 817203c4805SLuis R. Rodriguez void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, 818203c4805SLuis R. Rodriguez u32 ah_signal_type); 819203c4805SLuis R. Rodriguez void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); 820203c4805SLuis R. Rodriguez u32 ath9k_hw_getdefantenna(struct ath_hw *ah); 821203c4805SLuis R. Rodriguez void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); 822203c4805SLuis R. Rodriguez 823203c4805SLuis R. Rodriguez /* General Operation */ 824203c4805SLuis R. Rodriguez bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); 825203c4805SLuis R. Rodriguez u32 ath9k_hw_reverse_bits(u32 val, u32 n); 826203c4805SLuis R. Rodriguez bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high); 8274f0fc7c3SLuis R. Rodriguez u16 ath9k_hw_computetxtime(struct ath_hw *ah, 828545750d3SFelix Fietkau u8 phy, int kbps, 829203c4805SLuis R. Rodriguez u32 frameLen, u16 rateix, bool shortPreamble); 830203c4805SLuis R. Rodriguez void ath9k_hw_get_channel_centers(struct ath_hw *ah, 831203c4805SLuis R. Rodriguez struct ath9k_channel *chan, 832203c4805SLuis R. Rodriguez struct chan_centers *centers); 833203c4805SLuis R. Rodriguez u32 ath9k_hw_getrxfilter(struct ath_hw *ah); 834203c4805SLuis R. Rodriguez void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits); 835203c4805SLuis R. Rodriguez bool ath9k_hw_phy_disable(struct ath_hw *ah); 836203c4805SLuis R. Rodriguez bool ath9k_hw_disable(struct ath_hw *ah); 8378fbff4b8SVasanthakumar Thiagarajan void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit); 838203c4805SLuis R. Rodriguez void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac); 839203c4805SLuis R. Rodriguez void ath9k_hw_setopmode(struct ath_hw *ah); 840203c4805SLuis R. Rodriguez void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); 841f2b2143eSLuis R. Rodriguez void ath9k_hw_setbssidmask(struct ath_hw *ah); 842f2b2143eSLuis R. Rodriguez void ath9k_hw_write_associd(struct ath_hw *ah); 843203c4805SLuis R. Rodriguez u64 ath9k_hw_gettsf64(struct ath_hw *ah); 844203c4805SLuis R. Rodriguez void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); 845203c4805SLuis R. Rodriguez void ath9k_hw_reset_tsf(struct ath_hw *ah); 84654e4cec6SSujith void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); 84730cbd422SLuis R. Rodriguez u64 ath9k_hw_extend_tsf(struct ath_hw *ah, u32 rstamp); 8480005baf4SFelix Fietkau void ath9k_hw_init_global_settings(struct ath_hw *ah); 84925c56eecSLuis R. Rodriguez void ath9k_hw_set11nmac2040(struct ath_hw *ah); 850203c4805SLuis R. Rodriguez void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); 851203c4805SLuis R. Rodriguez void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, 852203c4805SLuis R. Rodriguez const struct ath9k_beacon_state *bs); 853a91d75aeSLuis R. Rodriguez 8549ecdef4bSLuis R. Rodriguez bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); 855a91d75aeSLuis R. Rodriguez 856ff155a45SVasanthakumar Thiagarajan /* Generic hw timer primitives */ 857ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, 858ff155a45SVasanthakumar Thiagarajan void (*trigger)(void *), 859ff155a45SVasanthakumar Thiagarajan void (*overflow)(void *), 860ff155a45SVasanthakumar Thiagarajan void *arg, 861ff155a45SVasanthakumar Thiagarajan u8 timer_index); 862cd9bf689SLuis R. Rodriguez void ath9k_hw_gen_timer_start(struct ath_hw *ah, 863cd9bf689SLuis R. Rodriguez struct ath_gen_timer *timer, 864cd9bf689SLuis R. Rodriguez u32 timer_next, 865cd9bf689SLuis R. Rodriguez u32 timer_period); 866cd9bf689SLuis R. Rodriguez void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer); 867cd9bf689SLuis R. Rodriguez 868ff155a45SVasanthakumar Thiagarajan void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer); 869ff155a45SVasanthakumar Thiagarajan void ath_gen_timer_isr(struct ath_hw *hw); 8701773912bSVasanthakumar Thiagarajan u32 ath9k_hw_gettsf32(struct ath_hw *ah); 871ff155a45SVasanthakumar Thiagarajan 872f934c4d9SLuis R. Rodriguez void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len); 8732da4f01aSLuis R. Rodriguez 87405020d23SSujith /* HTC */ 87505020d23SSujith void ath9k_hw_htc_resetinit(struct ath_hw *ah); 87605020d23SSujith 8778fe65368SLuis R. Rodriguez /* PHY */ 8788fe65368SLuis R. Rodriguez void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, 8798fe65368SLuis R. Rodriguez u32 *coef_mantissa, u32 *coef_exponent); 8808fe65368SLuis R. Rodriguez 881ebd5a14aSLuis R. Rodriguez /* 882ebd5a14aSLuis R. Rodriguez * Code Specific to AR5008, AR9001 or AR9002, 883ebd5a14aSLuis R. Rodriguez * we stuff these here to avoid callbacks for AR9003. 884ebd5a14aSLuis R. Rodriguez */ 885d8f492b7SLuis R. Rodriguez void ar9002_hw_cck_chan14_spread(struct ath_hw *ah); 886ebd5a14aSLuis R. Rodriguez int ar9002_hw_rf_claim(struct ath_hw *ah); 88778ec2677SLuis R. Rodriguez void ar9002_hw_enable_async_fifo(struct ath_hw *ah); 8886c94fdc9SLuis R. Rodriguez void ar9002_hw_enable_wep_aggregation(struct ath_hw *ah); 889d8f492b7SLuis R. Rodriguez 890641d9921SFelix Fietkau /* 891641d9921SFelix Fietkau * Code specifric to AR9003, we stuff these here to avoid callbacks 892641d9921SFelix Fietkau * for older families 893641d9921SFelix Fietkau */ 894641d9921SFelix Fietkau void ar9003_hw_set_nf_limits(struct ath_hw *ah); 895641d9921SFelix Fietkau 896641d9921SFelix Fietkau /* Hardware family op attach helpers */ 8978fe65368SLuis R. Rodriguez void ar5008_hw_attach_phy_ops(struct ath_hw *ah); 8988525f280SLuis R. Rodriguez void ar9002_hw_attach_phy_ops(struct ath_hw *ah); 8998525f280SLuis R. Rodriguez void ar9003_hw_attach_phy_ops(struct ath_hw *ah); 9008fe65368SLuis R. Rodriguez 901795f5e2cSLuis R. Rodriguez void ar9002_hw_attach_calib_ops(struct ath_hw *ah); 902795f5e2cSLuis R. Rodriguez void ar9003_hw_attach_calib_ops(struct ath_hw *ah); 903795f5e2cSLuis R. Rodriguez 904b3950e6aSLuis R. Rodriguez void ar9002_hw_attach_ops(struct ath_hw *ah); 905b3950e6aSLuis R. Rodriguez void ar9003_hw_attach_ops(struct ath_hw *ah); 906b3950e6aSLuis R. Rodriguez 9077b6840abSVasanthakumar Thiagarajan #define ATH_PCIE_CAP_LINK_CTRL 0x70 9087b6840abSVasanthakumar Thiagarajan #define ATH_PCIE_CAP_LINK_L0S 1 9097b6840abSVasanthakumar Thiagarajan #define ATH_PCIE_CAP_LINK_L1 2 9107b6840abSVasanthakumar Thiagarajan 911203c4805SLuis R. Rodriguez #endif 912