1203c4805SLuis R. Rodriguez /* 25b68138eSSujith Manoharan * Copyright (c) 2008-2011 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> 23ab5c4f71SGabor Juhos #include <linux/firmware.h> 24203c4805SLuis R. Rodriguez 25203c4805SLuis R. Rodriguez #include "mac.h" 26203c4805SLuis R. Rodriguez #include "ani.h" 27203c4805SLuis R. Rodriguez #include "eeprom.h" 28203c4805SLuis R. Rodriguez #include "calib.h" 29203c4805SLuis R. Rodriguez #include "reg.h" 30ae55099fSSujith Manoharan #include "reg_mci.h" 31203c4805SLuis R. Rodriguez #include "phy.h" 32af03abecSLuis R. Rodriguez #include "btcoex.h" 33c774d57fSLorenzo Bianconi #include "dynack.h" 34203c4805SLuis R. Rodriguez 35203c4805SLuis R. Rodriguez #include "../regd.h" 36203c4805SLuis R. Rodriguez 37203c4805SLuis R. Rodriguez #define ATHEROS_VENDOR_ID 0x168c 387976b426SLuis R. Rodriguez 39203c4805SLuis R. Rodriguez #define AR5416_DEVID_PCI 0x0023 40203c4805SLuis R. Rodriguez #define AR5416_DEVID_PCIE 0x0024 41203c4805SLuis R. Rodriguez #define AR9160_DEVID_PCI 0x0027 42203c4805SLuis R. Rodriguez #define AR9280_DEVID_PCI 0x0029 43203c4805SLuis R. Rodriguez #define AR9280_DEVID_PCIE 0x002a 44203c4805SLuis R. Rodriguez #define AR9285_DEVID_PCIE 0x002b 455ffaf8a3SLuis R. Rodriguez #define AR2427_DEVID_PCIE 0x002c 46db3cc53aSSenthil Balasubramanian #define AR9287_DEVID_PCI 0x002d 47db3cc53aSSenthil Balasubramanian #define AR9287_DEVID_PCIE 0x002e 48db3cc53aSSenthil Balasubramanian #define AR9300_DEVID_PCIE 0x0030 49b99a7be4SVasanthakumar Thiagarajan #define AR9300_DEVID_AR9340 0x0031 503050c914SVasanthakumar Thiagarajan #define AR9300_DEVID_AR9485_PCIE 0x0032 515a63ef0fSLuis R. Rodriguez #define AR9300_DEVID_AR9580 0x0033 52423e38e8SRajkumar Manoharan #define AR9300_DEVID_AR9462 0x0034 5303689301SGabor Juhos #define AR9300_DEVID_AR9330 0x0035 54b1233779SGabor Juhos #define AR9300_DEVID_QCA955X 0x0038 55d4e5979cSMohammed Shafi Shajakhan #define AR9485_DEVID_AR1111 0x0037 5677fac465SSujith Manoharan #define AR9300_DEVID_AR9565 0x0036 57e6b1e46eSSujith Manoharan #define AR9300_DEVID_AR953X 0x003d 582131fabbSMiaoqing Pan #define AR9300_DEVID_QCA956X 0x003f 597976b426SLuis R. Rodriguez 60203c4805SLuis R. Rodriguez #define AR5416_AR9100_DEVID 0x000b 617976b426SLuis R. Rodriguez 62203c4805SLuis R. Rodriguez #define AR_SUBVENDOR_ID_NOG 0x0e11 63203c4805SLuis R. Rodriguez #define AR_SUBVENDOR_ID_NEW_A 0x7065 64203c4805SLuis R. Rodriguez #define AR5416_MAGIC 0x19641014 65203c4805SLuis R. Rodriguez 66fe12946eSVasanthakumar Thiagarajan #define AR9280_COEX2WIRE_SUBSYSID 0x309b 67fe12946eSVasanthakumar Thiagarajan #define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa 68fe12946eSVasanthakumar Thiagarajan #define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab 69fe12946eSVasanthakumar Thiagarajan 70e3d01bfcSLuis R. Rodriguez #define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1) 71e3d01bfcSLuis R. Rodriguez 72cfe8cba9SLuis R. Rodriguez #define ATH_DEFAULT_NOISE_FLOOR -95 73cfe8cba9SLuis R. Rodriguez 7404658fbaSJohn W. Linville #define ATH9K_RSSI_BAD -128 75990b70abSLuis R. Rodriguez 76cac4220bSFelix Fietkau #define ATH9K_NUM_CHANNELS 38 77cac4220bSFelix Fietkau 78203c4805SLuis R. Rodriguez /* Register read/write primitives */ 799e4bffd2SLuis R. Rodriguez #define REG_WRITE(_ah, _reg, _val) \ 80f9f84e96SFelix Fietkau (_ah)->reg_ops.write((_ah), (_val), (_reg)) 819e4bffd2SLuis R. Rodriguez 829e4bffd2SLuis R. Rodriguez #define REG_READ(_ah, _reg) \ 83f9f84e96SFelix Fietkau (_ah)->reg_ops.read((_ah), (_reg)) 84203c4805SLuis R. Rodriguez 8509a525d3SSujith Manoharan #define REG_READ_MULTI(_ah, _addr, _val, _cnt) \ 86f9f84e96SFelix Fietkau (_ah)->reg_ops.multi_read((_ah), (_addr), (_val), (_cnt)) 8709a525d3SSujith Manoharan 88845e03c9SFelix Fietkau #define REG_RMW(_ah, _reg, _set, _clr) \ 89845e03c9SFelix Fietkau (_ah)->reg_ops.rmw((_ah), (_reg), (_set), (_clr)) 90845e03c9SFelix Fietkau 9120b3efd9SSujith #define ENABLE_REGWRITE_BUFFER(_ah) \ 9220b3efd9SSujith do { \ 93f9f84e96SFelix Fietkau if ((_ah)->reg_ops.enable_write_buffer) \ 94f9f84e96SFelix Fietkau (_ah)->reg_ops.enable_write_buffer((_ah)); \ 9520b3efd9SSujith } while (0) 9620b3efd9SSujith 9720b3efd9SSujith #define REGWRITE_BUFFER_FLUSH(_ah) \ 9820b3efd9SSujith do { \ 99f9f84e96SFelix Fietkau if ((_ah)->reg_ops.write_flush) \ 100f9f84e96SFelix Fietkau (_ah)->reg_ops.write_flush((_ah)); \ 10120b3efd9SSujith } while (0) 10220b3efd9SSujith 1038badb50cSOleksij Rempel #define ENABLE_REG_RMW_BUFFER(_ah) \ 1048badb50cSOleksij Rempel do { \ 1058badb50cSOleksij Rempel if ((_ah)->reg_ops.enable_rmw_buffer) \ 1068badb50cSOleksij Rempel (_ah)->reg_ops.enable_rmw_buffer((_ah)); \ 1078badb50cSOleksij Rempel } while (0) 1088badb50cSOleksij Rempel 1098badb50cSOleksij Rempel #define REG_RMW_BUFFER_FLUSH(_ah) \ 1108badb50cSOleksij Rempel do { \ 1118badb50cSOleksij Rempel if ((_ah)->reg_ops.rmw_flush) \ 1128badb50cSOleksij Rempel (_ah)->reg_ops.rmw_flush((_ah)); \ 1138badb50cSOleksij Rempel } while (0) 1148badb50cSOleksij Rempel 11526526202SRajkumar Manoharan #define PR_EEP(_s, _val) \ 11626526202SRajkumar Manoharan do { \ 1175e88ba62SZefir Kurtisi len += scnprintf(buf + len, size - len, "%20s : %10d\n",\ 11826526202SRajkumar Manoharan _s, (_val)); \ 11926526202SRajkumar Manoharan } while (0) 12026526202SRajkumar Manoharan 121203c4805SLuis R. Rodriguez #define SM(_v, _f) (((_v) << _f##_S) & _f) 122203c4805SLuis R. Rodriguez #define MS(_v, _f) (((_v) & _f) >> _f##_S) 123203c4805SLuis R. Rodriguez #define REG_RMW_FIELD(_a, _r, _f, _v) \ 124845e03c9SFelix Fietkau REG_RMW(_a, _r, (((_v) << _f##_S) & _f), (_f)) 1251547da37SLuis R. Rodriguez #define REG_READ_FIELD(_a, _r, _f) \ 1261547da37SLuis R. Rodriguez (((REG_READ(_a, _r) & _f) >> _f##_S)) 127203c4805SLuis R. Rodriguez #define REG_SET_BIT(_a, _r, _f) \ 128845e03c9SFelix Fietkau REG_RMW(_a, _r, (_f), 0) 129203c4805SLuis R. Rodriguez #define REG_CLR_BIT(_a, _r, _f) \ 130845e03c9SFelix Fietkau REG_RMW(_a, _r, 0, (_f)) 131203c4805SLuis R. Rodriguez 132203c4805SLuis R. Rodriguez #define DO_DELAY(x) do { \ 133e7fc6338SRajkumar Manoharan if (((++(x) % 64) == 0) && \ 134e7fc6338SRajkumar Manoharan (ath9k_hw_common(ah)->bus_ops->ath_bus_type \ 135e7fc6338SRajkumar Manoharan != ATH_USB)) \ 136203c4805SLuis R. Rodriguez udelay(1); \ 137203c4805SLuis R. Rodriguez } while (0) 138203c4805SLuis R. Rodriguez 139a9b6b256SFelix Fietkau #define REG_WRITE_ARRAY(iniarray, column, regWr) \ 140a9b6b256SFelix Fietkau ath9k_hw_write_array(ah, iniarray, column, &(regWr)) 141a57cb45aSOleksij Rempel #define REG_READ_ARRAY(ah, array, size) \ 142a57cb45aSOleksij Rempel ath9k_hw_read_array(ah, array, size) 143203c4805SLuis R. Rodriguez 144203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0 145203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1 146203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED 2 147203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_TX_FRAME 3 1481773912bSVasanthakumar Thiagarajan #define AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL 4 149203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED 5 150203c4805SLuis R. Rodriguez #define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED 6 15193d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_DATA 0x16 15293d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_CLK 0x17 15393d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_MCI_BT_DATA 0x18 15493d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_MCI_BT_CLK 0x19 15593d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_WL_IN_TX 0x14 15693d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_WL_IN_RX 0x13 15793d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_BT_IN_TX 9 15893d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_BT_IN_RX 8 15993d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_RUCKUS_STROBE 0x1d 16093d36e99SMohammed Shafi Shajakhan #define AR_GPIO_OUTPUT_MUX_AS_RUCKUS_DATA 0x1e 161203c4805SLuis R. Rodriguez 162203c4805SLuis R. Rodriguez #define AR_GPIOD_MASK 0x00001FFF 163203c4805SLuis R. Rodriguez #define AR_GPIO_BIT(_gpio) (1 << (_gpio)) 164203c4805SLuis R. Rodriguez 165203c4805SLuis R. Rodriguez #define BASE_ACTIVATE_DELAY 100 1660b488ac6SVasanthakumar Thiagarajan #define RTC_PLL_SETTLE_DELAY (AR_SREV_9340(ah) ? 1000 : 100) 167203c4805SLuis R. Rodriguez #define COEF_SCALE_S 24 168203c4805SLuis R. Rodriguez #define HT40_CHANNEL_CENTER_SHIFT 10 169203c4805SLuis R. Rodriguez 170203c4805SLuis R. Rodriguez #define ATH9K_ANTENNA0_CHAINMASK 0x1 171203c4805SLuis R. Rodriguez #define ATH9K_ANTENNA1_CHAINMASK 0x2 172203c4805SLuis R. Rodriguez 173203c4805SLuis R. Rodriguez #define ATH9K_NUM_DMA_DEBUG_REGS 8 174203c4805SLuis R. Rodriguez #define ATH9K_NUM_QUEUES 10 175203c4805SLuis R. Rodriguez 176203c4805SLuis R. Rodriguez #define MAX_RATE_POWER 63 177203c4805SLuis R. Rodriguez #define AH_WAIT_TIMEOUT 100000 /* (us) */ 178f9b604f6SGabor Juhos #define AH_TSF_WRITE_TIMEOUT 100 /* (us) */ 179203c4805SLuis R. Rodriguez #define AH_TIME_QUANTUM 10 180203c4805SLuis R. Rodriguez #define AR_KEYTABLE_SIZE 128 181d8caa839SSujith #define POWER_UP_TIME 10000 182203c4805SLuis R. Rodriguez #define SPUR_RSSI_THRESH 40 183331c5ea2SMohammed Shafi Shajakhan #define UPPER_5G_SUB_BAND_START 5700 184331c5ea2SMohammed Shafi Shajakhan #define MID_5G_SUB_BAND_START 5400 185203c4805SLuis R. Rodriguez 186203c4805SLuis R. Rodriguez #define CAB_TIMEOUT_VAL 10 187203c4805SLuis R. Rodriguez #define BEACON_TIMEOUT_VAL 10 188203c4805SLuis R. Rodriguez #define MIN_BEACON_TIMEOUT_VAL 1 1894ed15762SFelix Fietkau #define SLEEP_SLOP TU_TO_USEC(3) 190203c4805SLuis R. Rodriguez 191203c4805SLuis R. Rodriguez #define INIT_CONFIG_STATUS 0x00000000 192203c4805SLuis R. Rodriguez #define INIT_RSSI_THR 0x00000700 193203c4805SLuis R. Rodriguez #define INIT_BCON_CNTRL_REG 0x00000000 194203c4805SLuis R. Rodriguez 195203c4805SLuis R. Rodriguez #define TU_TO_USEC(_tu) ((_tu) << 10) 196203c4805SLuis R. Rodriguez 197ceb26445SVasanthakumar Thiagarajan #define ATH9K_HW_RX_HP_QDEPTH 16 198ceb26445SVasanthakumar Thiagarajan #define ATH9K_HW_RX_LP_QDEPTH 128 199ceb26445SVasanthakumar Thiagarajan 200717f6bedSFelix Fietkau #define PAPRD_GAIN_TABLE_ENTRIES 32 201717f6bedSFelix Fietkau #define PAPRD_TABLE_SZ 24 2020e44d48cSMohammed Shafi Shajakhan #define PAPRD_IDEAL_AGC2_PWR_RANGE 0xe0 203717f6bedSFelix Fietkau 20401c78533SMohammed Shafi Shajakhan /* 20501c78533SMohammed Shafi Shajakhan * Wake on Wireless 20601c78533SMohammed Shafi Shajakhan */ 20701c78533SMohammed Shafi Shajakhan 20801c78533SMohammed Shafi Shajakhan /* Keep Alive Frame */ 20901c78533SMohammed Shafi Shajakhan #define KAL_FRAME_LEN 28 21001c78533SMohammed Shafi Shajakhan #define KAL_FRAME_TYPE 0x2 /* data frame */ 21101c78533SMohammed Shafi Shajakhan #define KAL_FRAME_SUB_TYPE 0x4 /* null data frame */ 21201c78533SMohammed Shafi Shajakhan #define KAL_DURATION_ID 0x3d 21301c78533SMohammed Shafi Shajakhan #define KAL_NUM_DATA_WORDS 6 21401c78533SMohammed Shafi Shajakhan #define KAL_NUM_DESC_WORDS 12 21501c78533SMohammed Shafi Shajakhan #define KAL_ANTENNA_MODE 1 21601c78533SMohammed Shafi Shajakhan #define KAL_TO_DS 1 21701c78533SMohammed Shafi Shajakhan #define KAL_DELAY 4 /* delay of 4ms between 2 KAL frames */ 21801c78533SMohammed Shafi Shajakhan #define KAL_TIMEOUT 900 21901c78533SMohammed Shafi Shajakhan 22001c78533SMohammed Shafi Shajakhan #define MAX_PATTERN_SIZE 256 22101c78533SMohammed Shafi Shajakhan #define MAX_PATTERN_MASK_SIZE 32 22212a44422SSujith Manoharan #define MAX_NUM_PATTERN 16 22312a44422SSujith Manoharan #define MAX_NUM_PATTERN_LEGACY 8 22401c78533SMohammed Shafi Shajakhan #define MAX_NUM_USER_PATTERN 6 /* deducting the disassociate and 22501c78533SMohammed Shafi Shajakhan deauthenticate packets */ 22601c78533SMohammed Shafi Shajakhan 22701c78533SMohammed Shafi Shajakhan /* 22801c78533SMohammed Shafi Shajakhan * WoW trigger mapping to hardware code 22901c78533SMohammed Shafi Shajakhan */ 23001c78533SMohammed Shafi Shajakhan 23101c78533SMohammed Shafi Shajakhan #define AH_WOW_USER_PATTERN_EN BIT(0) 23201c78533SMohammed Shafi Shajakhan #define AH_WOW_MAGIC_PATTERN_EN BIT(1) 23301c78533SMohammed Shafi Shajakhan #define AH_WOW_LINK_CHANGE BIT(2) 23401c78533SMohammed Shafi Shajakhan #define AH_WOW_BEACON_MISS BIT(3) 23501c78533SMohammed Shafi Shajakhan 236066dae93SFelix Fietkau enum ath_hw_txq_subtype { 23778063d81SFelix Fietkau ATH_TXQ_AC_BK = 0, 23878063d81SFelix Fietkau ATH_TXQ_AC_BE = 1, 239066dae93SFelix Fietkau ATH_TXQ_AC_VI = 2, 240066dae93SFelix Fietkau ATH_TXQ_AC_VO = 3, 241066dae93SFelix Fietkau }; 242066dae93SFelix Fietkau 24313ce3e99SLuis R. Rodriguez enum ath_ini_subsys { 24413ce3e99SLuis R. Rodriguez ATH_INI_PRE = 0, 24513ce3e99SLuis R. Rodriguez ATH_INI_CORE, 24613ce3e99SLuis R. Rodriguez ATH_INI_POST, 24713ce3e99SLuis R. Rodriguez ATH_INI_NUM_SPLIT, 24813ce3e99SLuis R. Rodriguez }; 24913ce3e99SLuis R. Rodriguez 250203c4805SLuis R. Rodriguez enum ath9k_hw_caps { 251364734faSFelix Fietkau ATH9K_HW_CAP_HT = BIT(0), 252364734faSFelix Fietkau ATH9K_HW_CAP_RFSILENT = BIT(1), 2531b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_AUTOSLEEP = BIT(2), 2541b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(3), 2551b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_EDMA = BIT(4), 2561b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_RAC_SUPPORTED = BIT(5), 2571b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_LDPC = BIT(6), 2581b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_FASTCLOCK = BIT(7), 2591b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_SGI_20 = BIT(8), 2601b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_ANT_DIV_COMB = BIT(10), 2611b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_2GHZ = BIT(11), 2621b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_5GHZ = BIT(12), 2631b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_APM = BIT(13), 264935477edSFelix Fietkau #ifdef CONFIG_ATH9K_PCOEM 2651b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_RTT = BIT(14), 2661b2538b2SMohammed Shafi Shajakhan ATH9K_HW_CAP_MCI = BIT(15), 267935477edSFelix Fietkau ATH9K_HW_CAP_BT_ANT_DIV = BIT(17), 268935477edSFelix Fietkau #else 269935477edSFelix Fietkau ATH9K_HW_CAP_RTT = 0, 270935477edSFelix Fietkau ATH9K_HW_CAP_MCI = 0, 271935477edSFelix Fietkau ATH9K_HW_CAP_BT_ANT_DIV = 0, 272935477edSFelix Fietkau #endif 273935477edSFelix Fietkau ATH9K_HW_CAP_DFS = BIT(18), 274935477edSFelix Fietkau ATH9K_HW_CAP_PAPRD = BIT(19), 275935477edSFelix Fietkau ATH9K_HW_CAP_FCC_BAND_SWITCH = BIT(20), 276203c4805SLuis R. Rodriguez }; 277203c4805SLuis R. Rodriguez 2788e981389SMohammed Shafi Shajakhan /* 2798e981389SMohammed Shafi Shajakhan * WoW device capabilities 2808e981389SMohammed Shafi Shajakhan * @ATH9K_HW_WOW_DEVICE_CAPABLE: device revision is capable of WoW. 2818e981389SMohammed Shafi Shajakhan * @ATH9K_HW_WOW_PATTERN_MATCH_EXACT: device is capable of matching 2828e981389SMohammed Shafi Shajakhan * an exact user defined pattern or de-authentication/disassoc pattern. 2838e981389SMohammed Shafi Shajakhan * @ATH9K_HW_WOW_PATTERN_MATCH_DWORD: device requires the first four 2848e981389SMohammed Shafi Shajakhan * bytes of the pattern for user defined pattern, de-authentication and 2858e981389SMohammed Shafi Shajakhan * disassociation patterns for all types of possible frames recieved 2868e981389SMohammed Shafi Shajakhan * of those types. 2878e981389SMohammed Shafi Shajakhan */ 2888e981389SMohammed Shafi Shajakhan 28941fe8837SSujith Manoharan struct ath9k_hw_wow { 29041fe8837SSujith Manoharan u32 wow_event_mask; 291a28815dbSSujith Manoharan u32 wow_event_mask2; 29212a44422SSujith Manoharan u8 max_patterns; 29341fe8837SSujith Manoharan }; 29441fe8837SSujith Manoharan 295203c4805SLuis R. Rodriguez struct ath9k_hw_capabilities { 296203c4805SLuis R. Rodriguez u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */ 297203c4805SLuis R. Rodriguez u16 rts_aggr_limit; 298203c4805SLuis R. Rodriguez u8 tx_chainmask; 299203c4805SLuis R. Rodriguez u8 rx_chainmask; 300ee79ccd9SSujith Manoharan u8 chip_chainmask; 30147c80de6SVasanthakumar Thiagarajan u8 max_txchains; 30247c80de6SVasanthakumar Thiagarajan u8 max_rxchains; 303203c4805SLuis R. Rodriguez u8 num_gpio_pins; 304*a01ab81bSMiaoqing Pan u32 gpio_mask; 305ceb26445SVasanthakumar Thiagarajan u8 rx_hp_qdepth; 306ceb26445SVasanthakumar Thiagarajan u8 rx_lp_qdepth; 307ceb26445SVasanthakumar Thiagarajan u8 rx_status_len; 308162c3be3SVasanthakumar Thiagarajan u8 tx_desc_len; 3095088c2f1SVasanthakumar Thiagarajan u8 txs_len; 310203c4805SLuis R. Rodriguez }; 311203c4805SLuis R. Rodriguez 3124598702dSSujith Manoharan #define AR_NO_SPUR 0x8000 3134598702dSSujith Manoharan #define AR_BASE_FREQ_2GHZ 2300 3144598702dSSujith Manoharan #define AR_BASE_FREQ_5GHZ 4900 3154598702dSSujith Manoharan #define AR_SPUR_FEEQ_BOUND_HT40 19 3164598702dSSujith Manoharan #define AR_SPUR_FEEQ_BOUND_HT20 10 3174598702dSSujith Manoharan 3184598702dSSujith Manoharan enum ath9k_hw_hang_checks { 3194598702dSSujith Manoharan HW_BB_WATCHDOG = BIT(0), 3204598702dSSujith Manoharan HW_PHYRESTART_CLC_WAR = BIT(1), 3214598702dSSujith Manoharan HW_BB_RIFS_HANG = BIT(2), 3224598702dSSujith Manoharan HW_BB_DFS_HANG = BIT(3), 3234598702dSSujith Manoharan HW_BB_RX_CLEAR_STUCK_HANG = BIT(4), 3244598702dSSujith Manoharan HW_MAC_HANG = BIT(5), 3254598702dSSujith Manoharan }; 3264598702dSSujith Manoharan 327e519f78fSSujith Manoharan #define AR_PCIE_PLL_PWRSAVE_CONTROL BIT(0) 328e519f78fSSujith Manoharan #define AR_PCIE_PLL_PWRSAVE_ON_D3 BIT(1) 329e519f78fSSujith Manoharan #define AR_PCIE_PLL_PWRSAVE_ON_D0 BIT(2) 330e519f78fSSujith Manoharan #define AR_PCIE_CDR_PWRSAVE_ON_D3 BIT(3) 331e519f78fSSujith Manoharan #define AR_PCIE_CDR_PWRSAVE_ON_D0 BIT(4) 332e519f78fSSujith Manoharan 333203c4805SLuis R. Rodriguez struct ath9k_ops_config { 334203c4805SLuis R. Rodriguez int dma_beacon_response_time; 335203c4805SLuis R. Rodriguez int sw_beacon_response_time; 336621a5f7aSViresh Kumar bool cwm_ignore_extcca; 337203c4805SLuis R. Rodriguez u32 pcie_waen; 338203c4805SLuis R. Rodriguez u8 analog_shiftreg; 339203c4805SLuis R. Rodriguez u32 ofdm_trig_low; 340203c4805SLuis R. Rodriguez u32 ofdm_trig_high; 341203c4805SLuis R. Rodriguez u32 cck_trig_high; 342203c4805SLuis R. Rodriguez u32 cck_trig_low; 343621a5f7aSViresh Kumar bool enable_paprd; 344203c4805SLuis R. Rodriguez int serialize_regmode; 3450ce024cbSSujith bool rx_intr_mitigation; 34655e82df4SVasanthakumar Thiagarajan bool tx_intr_mitigation; 347f4709fdfSLuis R. Rodriguez u8 max_txtrig_level; 348e36b27afSLuis R. Rodriguez u16 ani_poll_interval; /* ANI poll interval in ms */ 3494598702dSSujith Manoharan u16 hw_hang_checks; 350a64e1a45SSujith Manoharan u16 rimt_first; 351a64e1a45SSujith Manoharan u16 rimt_last; 3529b60b64bSSujith Manoharan 3539b60b64bSSujith Manoharan /* Platform specific config */ 354b380a43bSSujith Manoharan u32 aspm_l1_fix; 3559b60b64bSSujith Manoharan u32 xlna_gpio; 35631fd216dSSujith Manoharan u32 ant_ctrl_comm2g_switch_enable; 3579b60b64bSSujith Manoharan bool xatten_margin_cfg; 358e083a42eSSujith Manoharan bool alt_mingainidx; 359656cd75cSSujith Manoharan u8 pll_pwrsave; 3600f978bfaSSujith Manoharan bool tx_gain_buffalo; 361aeeb2065SSujith Manoharan bool led_active_high; 362203c4805SLuis R. Rodriguez }; 363203c4805SLuis R. Rodriguez 364203c4805SLuis R. Rodriguez enum ath9k_int { 365203c4805SLuis R. Rodriguez ATH9K_INT_RX = 0x00000001, 366203c4805SLuis R. Rodriguez ATH9K_INT_RXDESC = 0x00000002, 367b5c80475SFelix Fietkau ATH9K_INT_RXHP = 0x00000001, 368b5c80475SFelix Fietkau ATH9K_INT_RXLP = 0x00000002, 369203c4805SLuis R. Rodriguez ATH9K_INT_RXNOFRM = 0x00000008, 370203c4805SLuis R. Rodriguez ATH9K_INT_RXEOL = 0x00000010, 371203c4805SLuis R. Rodriguez ATH9K_INT_RXORN = 0x00000020, 372203c4805SLuis R. Rodriguez ATH9K_INT_TX = 0x00000040, 373203c4805SLuis R. Rodriguez ATH9K_INT_TXDESC = 0x00000080, 374203c4805SLuis R. Rodriguez ATH9K_INT_TIM_TIMER = 0x00000100, 3752ee4bd1eSMohammed Shafi Shajakhan ATH9K_INT_MCI = 0x00000200, 376aea702b7SLuis R. Rodriguez ATH9K_INT_BB_WATCHDOG = 0x00000400, 377203c4805SLuis R. Rodriguez ATH9K_INT_TXURN = 0x00000800, 378203c4805SLuis R. Rodriguez ATH9K_INT_MIB = 0x00001000, 379203c4805SLuis R. Rodriguez ATH9K_INT_RXPHY = 0x00004000, 380203c4805SLuis R. Rodriguez ATH9K_INT_RXKCM = 0x00008000, 381203c4805SLuis R. Rodriguez ATH9K_INT_SWBA = 0x00010000, 382203c4805SLuis R. Rodriguez ATH9K_INT_BMISS = 0x00040000, 383203c4805SLuis R. Rodriguez ATH9K_INT_BNR = 0x00100000, 384203c4805SLuis R. Rodriguez ATH9K_INT_TIM = 0x00200000, 385203c4805SLuis R. Rodriguez ATH9K_INT_DTIM = 0x00400000, 386203c4805SLuis R. Rodriguez ATH9K_INT_DTIMSYNC = 0x00800000, 387203c4805SLuis R. Rodriguez ATH9K_INT_GPIO = 0x01000000, 388203c4805SLuis R. Rodriguez ATH9K_INT_CABEND = 0x02000000, 389203c4805SLuis R. Rodriguez ATH9K_INT_TSFOOR = 0x04000000, 390ff155a45SVasanthakumar Thiagarajan ATH9K_INT_GENTIMER = 0x08000000, 391203c4805SLuis R. Rodriguez ATH9K_INT_CST = 0x10000000, 392203c4805SLuis R. Rodriguez ATH9K_INT_GTT = 0x20000000, 393203c4805SLuis R. Rodriguez ATH9K_INT_FATAL = 0x40000000, 394203c4805SLuis R. Rodriguez ATH9K_INT_GLOBAL = 0x80000000, 395203c4805SLuis R. Rodriguez ATH9K_INT_BMISC = ATH9K_INT_TIM | 396203c4805SLuis R. Rodriguez ATH9K_INT_DTIM | 397203c4805SLuis R. Rodriguez ATH9K_INT_DTIMSYNC | 398203c4805SLuis R. Rodriguez ATH9K_INT_TSFOOR | 399203c4805SLuis R. Rodriguez ATH9K_INT_CABEND, 400203c4805SLuis R. Rodriguez ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM | 401203c4805SLuis R. Rodriguez ATH9K_INT_RXDESC | 402203c4805SLuis R. Rodriguez ATH9K_INT_RXEOL | 403203c4805SLuis R. Rodriguez ATH9K_INT_RXORN | 404203c4805SLuis R. Rodriguez ATH9K_INT_TXURN | 405203c4805SLuis R. Rodriguez ATH9K_INT_TXDESC | 406203c4805SLuis R. Rodriguez ATH9K_INT_MIB | 407203c4805SLuis R. Rodriguez ATH9K_INT_RXPHY | 408203c4805SLuis R. Rodriguez ATH9K_INT_RXKCM | 409203c4805SLuis R. Rodriguez ATH9K_INT_SWBA | 410203c4805SLuis R. Rodriguez ATH9K_INT_BMISS | 411203c4805SLuis R. Rodriguez ATH9K_INT_GPIO, 412203c4805SLuis R. Rodriguez ATH9K_INT_NOCARD = 0xffffffff 413203c4805SLuis R. Rodriguez }; 414203c4805SLuis R. Rodriguez 415324c74adSRajkumar Manoharan #define MAX_RTT_TABLE_ENTRY 6 4165f0c04eaSRajkumar Manoharan #define MAX_IQCAL_MEASUREMENT 8 41777a5a664SRajkumar Manoharan #define MAX_CL_TAB_ENTRY 16 41896da6fddSSujith Manoharan #define CL_TAB_ENTRY(reg_base) (reg_base + (4 * j)) 4195f0c04eaSRajkumar Manoharan 4204b9b42bfSSujith Manoharan enum ath9k_cal_flags { 4214b9b42bfSSujith Manoharan RTT_DONE, 4224b9b42bfSSujith Manoharan PAPRD_PACKET_SENT, 4234b9b42bfSSujith Manoharan PAPRD_DONE, 4244b9b42bfSSujith Manoharan NFCAL_PENDING, 4254b9b42bfSSujith Manoharan NFCAL_INTF, 4264b9b42bfSSujith Manoharan TXIQCAL_DONE, 4274b9b42bfSSujith Manoharan TXCLCAL_DONE, 4283001f0d0SSujith Manoharan SW_PKDET_DONE, 4294b9b42bfSSujith Manoharan }; 4304b9b42bfSSujith Manoharan 43120bd2a09SFelix Fietkau struct ath9k_hw_cal_data { 432203c4805SLuis R. Rodriguez u16 channel; 4336b21fd20SFelix Fietkau u16 channelFlags; 4344b9b42bfSSujith Manoharan unsigned long cal_flags; 435203c4805SLuis R. Rodriguez int32_t CalValid; 436203c4805SLuis R. Rodriguez int8_t iCoff; 437203c4805SLuis R. Rodriguez int8_t qCoff; 4383001f0d0SSujith Manoharan u8 caldac[2]; 439717f6bedSFelix Fietkau u16 small_signal_gain[AR9300_MAX_CHAINS]; 440717f6bedSFelix Fietkau u32 pa_table[AR9300_MAX_CHAINS][PAPRD_TABLE_SZ]; 4415f0c04eaSRajkumar Manoharan u32 num_measures[AR9300_MAX_CHAINS]; 4425f0c04eaSRajkumar Manoharan int tx_corr_coeff[MAX_IQCAL_MEASUREMENT][AR9300_MAX_CHAINS]; 44377a5a664SRajkumar Manoharan u32 tx_clcal[AR9300_MAX_CHAINS][MAX_CL_TAB_ENTRY]; 4448a90555fSSujith Manoharan u32 rtt_table[AR9300_MAX_CHAINS][MAX_RTT_TABLE_ENTRY]; 44520bd2a09SFelix Fietkau struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; 44620bd2a09SFelix Fietkau }; 44720bd2a09SFelix Fietkau 44820bd2a09SFelix Fietkau struct ath9k_channel { 44920bd2a09SFelix Fietkau struct ieee80211_channel *chan; 45020bd2a09SFelix Fietkau u16 channel; 4516b21fd20SFelix Fietkau u16 channelFlags; 452d9891c78SFelix Fietkau s16 noisefloor; 453203c4805SLuis R. Rodriguez }; 454203c4805SLuis R. Rodriguez 4556b21fd20SFelix Fietkau #define CHANNEL_5GHZ BIT(0) 4566b21fd20SFelix Fietkau #define CHANNEL_HALF BIT(1) 4576b21fd20SFelix Fietkau #define CHANNEL_QUARTER BIT(2) 4586b21fd20SFelix Fietkau #define CHANNEL_HT BIT(3) 4596b21fd20SFelix Fietkau #define CHANNEL_HT40PLUS BIT(4) 4606b21fd20SFelix Fietkau #define CHANNEL_HT40MINUS BIT(5) 461203c4805SLuis R. Rodriguez 4626b21fd20SFelix Fietkau #define IS_CHAN_5GHZ(_c) (!!((_c)->channelFlags & CHANNEL_5GHZ)) 4636b21fd20SFelix Fietkau #define IS_CHAN_2GHZ(_c) (!IS_CHAN_5GHZ(_c)) 4646b21fd20SFelix Fietkau 4656b21fd20SFelix Fietkau #define IS_CHAN_HALF_RATE(_c) (!!((_c)->channelFlags & CHANNEL_HALF)) 4666b21fd20SFelix Fietkau #define IS_CHAN_QUARTER_RATE(_c) (!!((_c)->channelFlags & CHANNEL_QUARTER)) 4676b21fd20SFelix Fietkau #define IS_CHAN_A_FAST_CLOCK(_ah, _c) \ 4686b21fd20SFelix Fietkau (IS_CHAN_5GHZ(_c) && ((_ah)->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK)) 4696b21fd20SFelix Fietkau 4706b21fd20SFelix Fietkau #define IS_CHAN_HT(_c) ((_c)->channelFlags & CHANNEL_HT) 4716b21fd20SFelix Fietkau 4726b21fd20SFelix Fietkau #define IS_CHAN_HT20(_c) (IS_CHAN_HT(_c) && !IS_CHAN_HT40(_c)) 4736b21fd20SFelix Fietkau 4746b21fd20SFelix Fietkau #define IS_CHAN_HT40(_c) \ 4756b21fd20SFelix Fietkau (!!((_c)->channelFlags & (CHANNEL_HT40PLUS | CHANNEL_HT40MINUS))) 4766b21fd20SFelix Fietkau 4776b21fd20SFelix Fietkau #define IS_CHAN_HT40PLUS(_c) ((_c)->channelFlags & CHANNEL_HT40PLUS) 4786b21fd20SFelix Fietkau #define IS_CHAN_HT40MINUS(_c) ((_c)->channelFlags & CHANNEL_HT40MINUS) 479203c4805SLuis R. Rodriguez 480203c4805SLuis R. Rodriguez enum ath9k_power_mode { 481203c4805SLuis R. Rodriguez ATH9K_PM_AWAKE = 0, 482203c4805SLuis R. Rodriguez ATH9K_PM_FULL_SLEEP, 483203c4805SLuis R. Rodriguez ATH9K_PM_NETWORK_SLEEP, 484203c4805SLuis R. Rodriguez ATH9K_PM_UNDEFINED 485203c4805SLuis R. Rodriguez }; 486203c4805SLuis R. Rodriguez 487203c4805SLuis R. Rodriguez enum ser_reg_mode { 488203c4805SLuis R. Rodriguez SER_REG_MODE_OFF = 0, 489203c4805SLuis R. Rodriguez SER_REG_MODE_ON = 1, 490203c4805SLuis R. Rodriguez SER_REG_MODE_AUTO = 2, 491203c4805SLuis R. Rodriguez }; 492203c4805SLuis R. Rodriguez 493ad7b8060SVasanthakumar Thiagarajan enum ath9k_rx_qtype { 494ad7b8060SVasanthakumar Thiagarajan ATH9K_RX_QUEUE_HP, 495ad7b8060SVasanthakumar Thiagarajan ATH9K_RX_QUEUE_LP, 496ad7b8060SVasanthakumar Thiagarajan ATH9K_RX_QUEUE_MAX, 497ad7b8060SVasanthakumar Thiagarajan }; 498ad7b8060SVasanthakumar Thiagarajan 499203c4805SLuis R. Rodriguez struct ath9k_beacon_state { 500203c4805SLuis R. Rodriguez u32 bs_nexttbtt; 501203c4805SLuis R. Rodriguez u32 bs_nextdtim; 502203c4805SLuis R. Rodriguez u32 bs_intval; 503203c4805SLuis R. Rodriguez #define ATH9K_TSFOOR_THRESHOLD 0x00004240 /* 16k us */ 504203c4805SLuis R. Rodriguez u32 bs_dtimperiod; 505203c4805SLuis R. Rodriguez u16 bs_bmissthreshold; 506203c4805SLuis R. Rodriguez u32 bs_sleepduration; 507203c4805SLuis R. Rodriguez u32 bs_tsfoor_threshold; 508203c4805SLuis R. Rodriguez }; 509203c4805SLuis R. Rodriguez 510203c4805SLuis R. Rodriguez struct chan_centers { 511203c4805SLuis R. Rodriguez u16 synth_center; 512203c4805SLuis R. Rodriguez u16 ctl_center; 513203c4805SLuis R. Rodriguez u16 ext_center; 514203c4805SLuis R. Rodriguez }; 515203c4805SLuis R. Rodriguez 516203c4805SLuis R. Rodriguez enum { 517203c4805SLuis R. Rodriguez ATH9K_RESET_POWER_ON, 518203c4805SLuis R. Rodriguez ATH9K_RESET_WARM, 519203c4805SLuis R. Rodriguez ATH9K_RESET_COLD, 520203c4805SLuis R. Rodriguez }; 521203c4805SLuis R. Rodriguez 522203c4805SLuis R. Rodriguez struct ath9k_hw_version { 523203c4805SLuis R. Rodriguez u32 magic; 524203c4805SLuis R. Rodriguez u16 devid; 525203c4805SLuis R. Rodriguez u16 subvendorid; 526203c4805SLuis R. Rodriguez u32 macVersion; 527203c4805SLuis R. Rodriguez u16 macRev; 528203c4805SLuis R. Rodriguez u16 phyRev; 529203c4805SLuis R. Rodriguez u16 analog5GhzRev; 530203c4805SLuis R. Rodriguez u16 analog2GhzRev; 5310b5ead91SSujith Manoharan enum ath_usb_dev usbdev; 532203c4805SLuis R. Rodriguez }; 533203c4805SLuis R. Rodriguez 534ff155a45SVasanthakumar Thiagarajan /* Generic TSF timer definitions */ 535ff155a45SVasanthakumar Thiagarajan 536ff155a45SVasanthakumar Thiagarajan #define ATH_MAX_GEN_TIMER 16 537ff155a45SVasanthakumar Thiagarajan 538ff155a45SVasanthakumar Thiagarajan #define AR_GENTMR_BIT(_index) (1 << (_index)) 539ff155a45SVasanthakumar Thiagarajan 540ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer_configuration { 541ff155a45SVasanthakumar Thiagarajan u32 next_addr; 542ff155a45SVasanthakumar Thiagarajan u32 period_addr; 543ff155a45SVasanthakumar Thiagarajan u32 mode_addr; 544ff155a45SVasanthakumar Thiagarajan u32 mode_mask; 545ff155a45SVasanthakumar Thiagarajan }; 546ff155a45SVasanthakumar Thiagarajan 547ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer { 548ff155a45SVasanthakumar Thiagarajan void (*trigger)(void *arg); 549ff155a45SVasanthakumar Thiagarajan void (*overflow)(void *arg); 550ff155a45SVasanthakumar Thiagarajan void *arg; 551ff155a45SVasanthakumar Thiagarajan u8 index; 552ff155a45SVasanthakumar Thiagarajan }; 553ff155a45SVasanthakumar Thiagarajan 554ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer_table { 555ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer *timers[ATH_MAX_GEN_TIMER]; 556c67ce339SFelix Fietkau u16 timer_mask; 557f4c34af4SSujith Manoharan bool tsf2_enabled; 558ff155a45SVasanthakumar Thiagarajan }; 559ff155a45SVasanthakumar Thiagarajan 56021cc630fSVasanthakumar Thiagarajan struct ath_hw_antcomb_conf { 56121cc630fSVasanthakumar Thiagarajan u8 main_lna_conf; 56221cc630fSVasanthakumar Thiagarajan u8 alt_lna_conf; 56321cc630fSVasanthakumar Thiagarajan u8 fast_div_bias; 564c6ba9febSMohammed Shafi Shajakhan u8 main_gaintb; 565c6ba9febSMohammed Shafi Shajakhan u8 alt_gaintb; 566c6ba9febSMohammed Shafi Shajakhan int lna1_lna2_delta; 567f96bd2adSSujith Manoharan int lna1_lna2_switch_delta; 5688afbcc8bSMohammed Shafi Shajakhan u8 div_group; 56921cc630fSVasanthakumar Thiagarajan }; 57021cc630fSVasanthakumar Thiagarajan 571d70357d5SLuis R. Rodriguez /** 5724e8c14e9SFelix Fietkau * struct ath_hw_radar_conf - radar detection initialization parameters 5734e8c14e9SFelix Fietkau * 5744e8c14e9SFelix Fietkau * @pulse_inband: threshold for checking the ratio of in-band power 5754e8c14e9SFelix Fietkau * to total power for short radar pulses (half dB steps) 5764e8c14e9SFelix Fietkau * @pulse_inband_step: threshold for checking an in-band power to total 5774e8c14e9SFelix Fietkau * power ratio increase for short radar pulses (half dB steps) 5784e8c14e9SFelix Fietkau * @pulse_height: threshold for detecting the beginning of a short 5794e8c14e9SFelix Fietkau * radar pulse (dB step) 5804e8c14e9SFelix Fietkau * @pulse_rssi: threshold for detecting if a short radar pulse is 5814e8c14e9SFelix Fietkau * gone (dB step) 5824e8c14e9SFelix Fietkau * @pulse_maxlen: maximum pulse length (0.8 us steps) 5834e8c14e9SFelix Fietkau * 5844e8c14e9SFelix Fietkau * @radar_rssi: RSSI threshold for starting long radar detection (dB steps) 5854e8c14e9SFelix Fietkau * @radar_inband: threshold for checking the ratio of in-band power 5864e8c14e9SFelix Fietkau * to total power for long radar pulses (half dB steps) 5874e8c14e9SFelix Fietkau * @fir_power: threshold for detecting the end of a long radar pulse (dB) 5884e8c14e9SFelix Fietkau * 5894e8c14e9SFelix Fietkau * @ext_channel: enable extension channel radar detection 5904e8c14e9SFelix Fietkau */ 5914e8c14e9SFelix Fietkau struct ath_hw_radar_conf { 5924e8c14e9SFelix Fietkau unsigned int pulse_inband; 5934e8c14e9SFelix Fietkau unsigned int pulse_inband_step; 5944e8c14e9SFelix Fietkau unsigned int pulse_height; 5954e8c14e9SFelix Fietkau unsigned int pulse_rssi; 5964e8c14e9SFelix Fietkau unsigned int pulse_maxlen; 5974e8c14e9SFelix Fietkau 5984e8c14e9SFelix Fietkau unsigned int radar_rssi; 5994e8c14e9SFelix Fietkau unsigned int radar_inband; 6004e8c14e9SFelix Fietkau int fir_power; 6014e8c14e9SFelix Fietkau 6024e8c14e9SFelix Fietkau bool ext_channel; 6034e8c14e9SFelix Fietkau }; 6044e8c14e9SFelix Fietkau 6054e8c14e9SFelix Fietkau /** 606d70357d5SLuis R. Rodriguez * struct ath_hw_private_ops - callbacks used internally by hardware code 607d70357d5SLuis R. Rodriguez * 608d70357d5SLuis R. Rodriguez * This structure contains private callbacks designed to only be used internally 609d70357d5SLuis R. Rodriguez * by the hardware core. 610d70357d5SLuis R. Rodriguez * 611795f5e2cSLuis R. Rodriguez * @init_cal_settings: setup types of calibrations supported 612795f5e2cSLuis R. Rodriguez * @init_cal: starts actual calibration 613795f5e2cSLuis R. Rodriguez * 614991312d8SLuis R. Rodriguez * @init_mode_gain_regs: Initialize TX/RX gain registers 6158fe65368SLuis R. Rodriguez * 6168fe65368SLuis R. Rodriguez * @rf_set_freq: change frequency 6178fe65368SLuis R. Rodriguez * @spur_mitigate_freq: spur mitigation 6188fe65368SLuis R. Rodriguez * @set_rf_regs: 61964773964SLuis R. Rodriguez * @compute_pll_control: compute the PLL control value to use for 62064773964SLuis R. Rodriguez * AR_RTC_PLL_CONTROL for a given channel 621795f5e2cSLuis R. Rodriguez * @setup_calibration: set up calibration 622795f5e2cSLuis R. Rodriguez * @iscal_supported: used to query if a type of calibration is supported 623ac0bb767SLuis R. Rodriguez * 624e36b27afSLuis R. Rodriguez * @ani_cache_ini_regs: cache the values for ANI from the initial 625e36b27afSLuis R. Rodriguez * register settings through the register initialization. 626d70357d5SLuis R. Rodriguez */ 627d70357d5SLuis R. Rodriguez struct ath_hw_private_ops { 6284598702dSSujith Manoharan void (*init_hang_checks)(struct ath_hw *ah); 629990de2b2SSujith Manoharan bool (*detect_mac_hang)(struct ath_hw *ah); 630990de2b2SSujith Manoharan bool (*detect_bb_hang)(struct ath_hw *ah); 631990de2b2SSujith Manoharan 632795f5e2cSLuis R. Rodriguez /* Calibration ops */ 633d70357d5SLuis R. Rodriguez void (*init_cal_settings)(struct ath_hw *ah); 634795f5e2cSLuis R. Rodriguez bool (*init_cal)(struct ath_hw *ah, struct ath9k_channel *chan); 635795f5e2cSLuis R. Rodriguez 636991312d8SLuis R. Rodriguez void (*init_mode_gain_regs)(struct ath_hw *ah); 637795f5e2cSLuis R. Rodriguez void (*setup_calibration)(struct ath_hw *ah, 638795f5e2cSLuis R. Rodriguez struct ath9k_cal_list *currCal); 6398fe65368SLuis R. Rodriguez 6408fe65368SLuis R. Rodriguez /* PHY ops */ 6418fe65368SLuis R. Rodriguez int (*rf_set_freq)(struct ath_hw *ah, 6428fe65368SLuis R. Rodriguez struct ath9k_channel *chan); 6438fe65368SLuis R. Rodriguez void (*spur_mitigate_freq)(struct ath_hw *ah, 6448fe65368SLuis R. Rodriguez struct ath9k_channel *chan); 6458fe65368SLuis R. Rodriguez bool (*set_rf_regs)(struct ath_hw *ah, 6468fe65368SLuis R. Rodriguez struct ath9k_channel *chan, 6478fe65368SLuis R. Rodriguez u16 modesIndex); 6488fe65368SLuis R. Rodriguez void (*set_channel_regs)(struct ath_hw *ah, struct ath9k_channel *chan); 6498fe65368SLuis R. Rodriguez void (*init_bb)(struct ath_hw *ah, 6508fe65368SLuis R. Rodriguez struct ath9k_channel *chan); 6518fe65368SLuis R. Rodriguez int (*process_ini)(struct ath_hw *ah, struct ath9k_channel *chan); 6528fe65368SLuis R. Rodriguez void (*olc_init)(struct ath_hw *ah); 6538fe65368SLuis R. Rodriguez void (*set_rfmode)(struct ath_hw *ah, struct ath9k_channel *chan); 6548fe65368SLuis R. Rodriguez void (*mark_phy_inactive)(struct ath_hw *ah); 6558fe65368SLuis R. Rodriguez void (*set_delta_slope)(struct ath_hw *ah, struct ath9k_channel *chan); 6568fe65368SLuis R. Rodriguez bool (*rfbus_req)(struct ath_hw *ah); 6578fe65368SLuis R. Rodriguez void (*rfbus_done)(struct ath_hw *ah); 6588fe65368SLuis R. Rodriguez void (*restore_chainmask)(struct ath_hw *ah); 65964773964SLuis R. Rodriguez u32 (*compute_pll_control)(struct ath_hw *ah, 66064773964SLuis R. Rodriguez struct ath9k_channel *chan); 661c16fcb49SFelix Fietkau bool (*ani_control)(struct ath_hw *ah, enum ath9k_ani_cmd cmd, 662c16fcb49SFelix Fietkau int param); 663641d9921SFelix Fietkau void (*do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS]); 6644e8c14e9SFelix Fietkau void (*set_radar_params)(struct ath_hw *ah, 6654e8c14e9SFelix Fietkau struct ath_hw_radar_conf *conf); 6665f0c04eaSRajkumar Manoharan int (*fast_chan_change)(struct ath_hw *ah, struct ath9k_channel *chan, 6675f0c04eaSRajkumar Manoharan u8 *ini_reloaded); 668ac0bb767SLuis R. Rodriguez 669ac0bb767SLuis R. Rodriguez /* ANI */ 670e36b27afSLuis R. Rodriguez void (*ani_cache_ini_regs)(struct ath_hw *ah); 671637625f2SSujith Manoharan 672637625f2SSujith Manoharan #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT 673637625f2SSujith Manoharan bool (*is_aic_enabled)(struct ath_hw *ah); 674637625f2SSujith Manoharan #endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ 675d70357d5SLuis R. Rodriguez }; 676d70357d5SLuis R. Rodriguez 677d70357d5SLuis R. Rodriguez /** 678e93d083fSSimon Wunderlich * struct ath_spec_scan - parameters for Atheros spectral scan 679e93d083fSSimon Wunderlich * 680e93d083fSSimon Wunderlich * @enabled: enable/disable spectral scan 681e93d083fSSimon Wunderlich * @short_repeat: controls whether the chip is in spectral scan mode 682e93d083fSSimon Wunderlich * for 4 usec (enabled) or 204 usec (disabled) 683e93d083fSSimon Wunderlich * @count: number of scan results requested. There are special meanings 684e93d083fSSimon Wunderlich * in some chip revisions: 685e93d083fSSimon Wunderlich * AR92xx: highest bit set (>=128) for endless mode 686e93d083fSSimon Wunderlich * (spectral scan won't stopped until explicitly disabled) 687e93d083fSSimon Wunderlich * AR9300 and newer: 0 for endless mode 688e93d083fSSimon Wunderlich * @endless: true if endless mode is intended. Otherwise, count value is 689e93d083fSSimon Wunderlich * corrected to the next possible value. 690e93d083fSSimon Wunderlich * @period: time duration between successive spectral scan entry points 691e93d083fSSimon Wunderlich * (period*256*Tclk). Tclk = ath_common->clockrate 692e93d083fSSimon Wunderlich * @fft_period: PHY passes FFT frames to MAC every (fft_period+1)*4uS 693e93d083fSSimon Wunderlich * 694e93d083fSSimon Wunderlich * Note: Tclk = 40MHz or 44MHz depending upon operating mode. 695e93d083fSSimon Wunderlich * Typically it's 44MHz in 2/5GHz on later chips, but there's 696e93d083fSSimon Wunderlich * a "fast clock" check for this in 5GHz. 697e93d083fSSimon Wunderlich * 698e93d083fSSimon Wunderlich */ 699e93d083fSSimon Wunderlich struct ath_spec_scan { 700e93d083fSSimon Wunderlich bool enabled; 701e93d083fSSimon Wunderlich bool short_repeat; 702e93d083fSSimon Wunderlich bool endless; 703e93d083fSSimon Wunderlich u8 count; 704e93d083fSSimon Wunderlich u8 period; 705e93d083fSSimon Wunderlich u8 fft_period; 706e93d083fSSimon Wunderlich }; 707e93d083fSSimon Wunderlich 708e93d083fSSimon Wunderlich /** 709d70357d5SLuis R. Rodriguez * struct ath_hw_ops - callbacks used by hardware code and driver code 710d70357d5SLuis R. Rodriguez * 711d70357d5SLuis R. Rodriguez * This structure contains callbacks designed to to be used internally by 712d70357d5SLuis R. Rodriguez * hardware code and also by the lower level driver. 713d70357d5SLuis R. Rodriguez * 714d70357d5SLuis R. Rodriguez * @config_pci_powersave: 715795f5e2cSLuis R. Rodriguez * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC 716e93d083fSSimon Wunderlich * 717e93d083fSSimon Wunderlich * @spectral_scan_config: set parameters for spectral scan and enable/disable it 718e93d083fSSimon Wunderlich * @spectral_scan_trigger: trigger a spectral scan run 719e93d083fSSimon Wunderlich * @spectral_scan_wait: wait for a spectral scan run to finish 720d70357d5SLuis R. Rodriguez */ 721d70357d5SLuis R. Rodriguez struct ath_hw_ops { 722d70357d5SLuis R. Rodriguez void (*config_pci_powersave)(struct ath_hw *ah, 72384c87dc8SStanislaw Gruszka bool power_off); 724cee1f625SVasanthakumar Thiagarajan void (*rx_enable)(struct ath_hw *ah); 72587d5efbbSVasanthakumar Thiagarajan void (*set_desc_link)(void *ds, u32 link); 7267b8aaeadSFelix Fietkau int (*calibrate)(struct ath_hw *ah, struct ath9k_channel *chan, 7277b8aaeadSFelix Fietkau u8 rxchainmask, bool longcal); 7286a4d05dcSFelix Fietkau bool (*get_isr)(struct ath_hw *ah, enum ath9k_int *masked, 7296a4d05dcSFelix Fietkau u32 *sync_cause_p); 7302b63a41dSFelix Fietkau void (*set_txdesc)(struct ath_hw *ah, void *ds, 7312b63a41dSFelix Fietkau struct ath_tx_info *i); 732cc610ac0SVasanthakumar Thiagarajan int (*proc_txdesc)(struct ath_hw *ah, void *ds, 733cc610ac0SVasanthakumar Thiagarajan struct ath_tx_status *ts); 734315dd114SFelix Fietkau int (*get_duration)(struct ath_hw *ah, const void *ds, int index); 73569de3721SMohammed Shafi Shajakhan void (*antdiv_comb_conf_get)(struct ath_hw *ah, 73669de3721SMohammed Shafi Shajakhan struct ath_hw_antcomb_conf *antconf); 73769de3721SMohammed Shafi Shajakhan void (*antdiv_comb_conf_set)(struct ath_hw *ah, 73869de3721SMohammed Shafi Shajakhan struct ath_hw_antcomb_conf *antconf); 739e93d083fSSimon Wunderlich void (*spectral_scan_config)(struct ath_hw *ah, 740e93d083fSSimon Wunderlich struct ath_spec_scan *param); 741e93d083fSSimon Wunderlich void (*spectral_scan_trigger)(struct ath_hw *ah); 742e93d083fSSimon Wunderlich void (*spectral_scan_wait)(struct ath_hw *ah); 74336e8825eSSujith Manoharan 74489f927afSLuis R. Rodriguez void (*tx99_start)(struct ath_hw *ah, u32 qnum); 74589f927afSLuis R. Rodriguez void (*tx99_stop)(struct ath_hw *ah); 74689f927afSLuis R. Rodriguez void (*tx99_set_txpower)(struct ath_hw *ah, u8 power); 74789f927afSLuis R. Rodriguez 74836e8825eSSujith Manoharan #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT 74936e8825eSSujith Manoharan void (*set_bt_ant_diversity)(struct ath_hw *hw, bool enable); 75036e8825eSSujith Manoharan #endif 751d70357d5SLuis R. Rodriguez }; 752d70357d5SLuis R. Rodriguez 753f2552e28SFelix Fietkau struct ath_nf_limits { 754f2552e28SFelix Fietkau s16 max; 755f2552e28SFelix Fietkau s16 min; 756f2552e28SFelix Fietkau s16 nominal; 757f2552e28SFelix Fietkau }; 758f2552e28SFelix Fietkau 7598ad74c4dSRajkumar Manoharan enum ath_cal_list { 7608ad74c4dSRajkumar Manoharan TX_IQ_CAL = BIT(0), 7618ad74c4dSRajkumar Manoharan TX_IQ_ON_AGC_CAL = BIT(1), 7628ad74c4dSRajkumar Manoharan TX_CL_CAL = BIT(2), 7638ad74c4dSRajkumar Manoharan }; 7648ad74c4dSRajkumar Manoharan 76597dcec57SSujith Manoharan /* ah_flags */ 76697dcec57SSujith Manoharan #define AH_USE_EEPROM 0x1 76797dcec57SSujith Manoharan #define AH_UNPLUGGED 0x2 /* The card has been physically removed. */ 768a126ff51SRajkumar Manoharan #define AH_FASTCC 0x4 769a59dadbeSFelix Fietkau #define AH_NO_EEP_SWAP 0x8 /* Do not swap EEPROM data */ 77097dcec57SSujith Manoharan 771203c4805SLuis R. Rodriguez struct ath_hw { 772f9f84e96SFelix Fietkau struct ath_ops reg_ops; 773f9f84e96SFelix Fietkau 774c1b976d2SFelix Fietkau struct device *dev; 775b002a4a9SLuis R. Rodriguez struct ieee80211_hw *hw; 77627c51f1aSLuis R. Rodriguez struct ath_common common; 777203c4805SLuis R. Rodriguez struct ath9k_hw_version hw_version; 778203c4805SLuis R. Rodriguez struct ath9k_ops_config config; 779203c4805SLuis R. Rodriguez struct ath9k_hw_capabilities caps; 780cac4220bSFelix Fietkau struct ath9k_channel channels[ATH9K_NUM_CHANNELS]; 781203c4805SLuis R. Rodriguez struct ath9k_channel *curchan; 782203c4805SLuis R. Rodriguez 783203c4805SLuis R. Rodriguez union { 784203c4805SLuis R. Rodriguez struct ar5416_eeprom_def def; 785203c4805SLuis R. Rodriguez struct ar5416_eeprom_4k map4k; 786475f5989SLuis R. Rodriguez struct ar9287_eeprom map9287; 78715c9ee7aSSenthil Balasubramanian struct ar9300_eeprom ar9300_eep; 788203c4805SLuis R. Rodriguez } eeprom; 789203c4805SLuis R. Rodriguez const struct eeprom_ops *eep_ops; 790203c4805SLuis R. Rodriguez 791e6510b11SChun-Yeow Yeoh bool sw_mgmt_crypto_tx; 792e6510b11SChun-Yeow Yeoh bool sw_mgmt_crypto_rx; 793203c4805SLuis R. Rodriguez bool is_pciexpress; 794d4930086SStanislaw Gruszka bool aspm_enabled; 7955f841b41SRajkumar Manoharan bool is_monitoring; 7962eb46d9bSPavel Roskin bool need_an_top2_fixup; 797203c4805SLuis R. Rodriguez u16 tx_trig_level; 798f2552e28SFelix Fietkau 799bbacee13SFelix Fietkau u32 nf_regs[6]; 800f2552e28SFelix Fietkau struct ath_nf_limits nf_2g; 801f2552e28SFelix Fietkau struct ath_nf_limits nf_5g; 802203c4805SLuis R. Rodriguez u16 rfsilent; 803203c4805SLuis R. Rodriguez u32 rfkill_gpio; 804203c4805SLuis R. Rodriguez u32 rfkill_polarity; 805203c4805SLuis R. Rodriguez u32 ah_flags; 806203c4805SLuis R. Rodriguez 807ceb26a60SFelix Fietkau bool reset_power_on; 808d7e7d229SLuis R. Rodriguez bool htc_reset_init; 809d7e7d229SLuis R. Rodriguez 810203c4805SLuis R. Rodriguez enum nl80211_iftype opmode; 811203c4805SLuis R. Rodriguez enum ath9k_power_mode power_mode; 812203c4805SLuis R. Rodriguez 813f23fba49SFelix Fietkau s8 noise; 81420bd2a09SFelix Fietkau struct ath9k_hw_cal_data *caldata; 815a13883b0SSujith struct ath9k_pacal_info pacal_info; 816203c4805SLuis R. Rodriguez struct ar5416Stats stats; 817203c4805SLuis R. Rodriguez struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES]; 818203c4805SLuis R. Rodriguez 8193069168cSPavel Roskin enum ath9k_int imask; 82074bad5cbSPavel Roskin u32 imrs2_reg; 821203c4805SLuis R. Rodriguez u32 txok_interrupt_mask; 822203c4805SLuis R. Rodriguez u32 txerr_interrupt_mask; 823203c4805SLuis R. Rodriguez u32 txdesc_interrupt_mask; 824203c4805SLuis R. Rodriguez u32 txeol_interrupt_mask; 825203c4805SLuis R. Rodriguez u32 txurn_interrupt_mask; 826e8fe7336SRajkumar Manoharan atomic_t intr_ref_cnt; 827203c4805SLuis R. Rodriguez bool chip_fullsleep; 8285f0c04eaSRajkumar Manoharan u32 modes_index; 829203c4805SLuis R. Rodriguez 830203c4805SLuis R. Rodriguez /* Calibration */ 8316497827fSFelix Fietkau u32 supp_cals; 832cbfe9468SSujith struct ath9k_cal_list iq_caldata; 833cbfe9468SSujith struct ath9k_cal_list adcgain_caldata; 834cbfe9468SSujith struct ath9k_cal_list adcdc_caldata; 835cbfe9468SSujith struct ath9k_cal_list *cal_list; 836cbfe9468SSujith struct ath9k_cal_list *cal_list_last; 837cbfe9468SSujith struct ath9k_cal_list *cal_list_curr; 838203c4805SLuis R. Rodriguez #define totalPowerMeasI meas0.unsign 839203c4805SLuis R. Rodriguez #define totalPowerMeasQ meas1.unsign 840203c4805SLuis R. Rodriguez #define totalIqCorrMeas meas2.sign 841203c4805SLuis R. Rodriguez #define totalAdcIOddPhase meas0.unsign 842203c4805SLuis R. Rodriguez #define totalAdcIEvenPhase meas1.unsign 843203c4805SLuis R. Rodriguez #define totalAdcQOddPhase meas2.unsign 844203c4805SLuis R. Rodriguez #define totalAdcQEvenPhase meas3.unsign 845203c4805SLuis R. Rodriguez #define totalAdcDcOffsetIOddPhase meas0.sign 846203c4805SLuis R. Rodriguez #define totalAdcDcOffsetIEvenPhase meas1.sign 847203c4805SLuis R. Rodriguez #define totalAdcDcOffsetQOddPhase meas2.sign 848203c4805SLuis R. Rodriguez #define totalAdcDcOffsetQEvenPhase meas3.sign 849203c4805SLuis R. Rodriguez union { 850203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 851203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 852203c4805SLuis R. Rodriguez } meas0; 853203c4805SLuis R. Rodriguez union { 854203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 855203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 856203c4805SLuis R. Rodriguez } meas1; 857203c4805SLuis R. Rodriguez union { 858203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 859203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 860203c4805SLuis R. Rodriguez } meas2; 861203c4805SLuis R. Rodriguez union { 862203c4805SLuis R. Rodriguez u32 unsign[AR5416_MAX_CHAINS]; 863203c4805SLuis R. Rodriguez int32_t sign[AR5416_MAX_CHAINS]; 864203c4805SLuis R. Rodriguez } meas3; 865203c4805SLuis R. Rodriguez u16 cal_samples; 8668ad74c4dSRajkumar Manoharan u8 enabled_cals; 867203c4805SLuis R. Rodriguez 868203c4805SLuis R. Rodriguez u32 sta_id1_defaults; 869203c4805SLuis R. Rodriguez u32 misc_mode; 870203c4805SLuis R. Rodriguez 871d70357d5SLuis R. Rodriguez /* Private to hardware code */ 872d70357d5SLuis R. Rodriguez struct ath_hw_private_ops private_ops; 873d70357d5SLuis R. Rodriguez /* Accessed by the lower level driver */ 874d70357d5SLuis R. Rodriguez struct ath_hw_ops ops; 875d70357d5SLuis R. Rodriguez 876e68a060bSLuis R. Rodriguez /* Used to program the radio on non single-chip devices */ 877203c4805SLuis R. Rodriguez u32 *analogBank6Data; 878203c4805SLuis R. Rodriguez 879e239d859SFelix Fietkau int coverage_class; 880203c4805SLuis R. Rodriguez u32 slottime; 881203c4805SLuis R. Rodriguez u32 globaltxtimeout; 882203c4805SLuis R. Rodriguez 883203c4805SLuis R. Rodriguez /* ANI */ 884203c4805SLuis R. Rodriguez u32 aniperiod; 885203c4805SLuis R. Rodriguez enum ath9k_ani_cmd ani_function; 886424749c7SRajkumar Manoharan u32 ani_skip_count; 887c24bd362SSujith Manoharan struct ar5416AniState ani; 888203c4805SLuis R. Rodriguez 889dbccdd1dSSujith Manoharan #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT 890766ec4a9SLuis R. Rodriguez struct ath_btcoex_hw btcoex_hw; 891dbccdd1dSSujith Manoharan #endif 892af03abecSLuis R. Rodriguez 893203c4805SLuis R. Rodriguez u32 intr_txqs; 894203c4805SLuis R. Rodriguez u8 txchainmask; 895203c4805SLuis R. Rodriguez u8 rxchainmask; 896203c4805SLuis R. Rodriguez 897c5d0855aSFelix Fietkau struct ath_hw_radar_conf radar_conf; 898c5d0855aSFelix Fietkau 899203c4805SLuis R. Rodriguez u32 originalGain[22]; 900203c4805SLuis R. Rodriguez int initPDADC; 901203c4805SLuis R. Rodriguez int PDADCdelta; 9026de66dd9SFelix Fietkau int led_pin; 903691680b8SFelix Fietkau u32 gpio_mask; 904691680b8SFelix Fietkau u32 gpio_val; 905203c4805SLuis R. Rodriguez 9064a878b9fSSujith Manoharan struct ar5416IniArray ini_dfs; 907203c4805SLuis R. Rodriguez struct ar5416IniArray iniModes; 908203c4805SLuis R. Rodriguez struct ar5416IniArray iniCommon; 909203c4805SLuis R. Rodriguez struct ar5416IniArray iniBB_RfGain; 910203c4805SLuis R. Rodriguez struct ar5416IniArray iniBank6; 911203c4805SLuis R. Rodriguez struct ar5416IniArray iniAddac; 912203c4805SLuis R. Rodriguez struct ar5416IniArray iniPcieSerdes; 91313ce3e99SLuis R. Rodriguez struct ar5416IniArray iniPcieSerdesLowPower; 914c7d36f9fSFelix Fietkau struct ar5416IniArray iniModesFastClock; 915c7d36f9fSFelix Fietkau struct ar5416IniArray iniAdditional; 916203c4805SLuis R. Rodriguez struct ar5416IniArray iniModesRxGain; 9178bc45c6bSGabor Juhos struct ar5416IniArray ini_modes_rx_gain_bounds; 918203c4805SLuis R. Rodriguez struct ar5416IniArray iniModesTxGain; 919193cd458SSujith struct ar5416IniArray iniCckfirNormal; 920193cd458SSujith struct ar5416IniArray iniCckfirJapan2484; 92170807e99SSujith struct ar5416IniArray iniModes_9271_ANI_reg; 922ce407afcSSenthil Balasubramanian struct ar5416IniArray ini_radio_post_sys2ant; 923871d0051SMiaoqing Pan struct ar5416IniArray ini_modes_rxgain_xlna; 924c177fabeSSujith Manoharan struct ar5416IniArray ini_modes_rxgain_bb_core; 925c177fabeSSujith Manoharan struct ar5416IniArray ini_modes_rxgain_bb_postamble; 926ff155a45SVasanthakumar Thiagarajan 92713ce3e99SLuis R. Rodriguez struct ar5416IniArray iniMac[ATH_INI_NUM_SPLIT]; 92813ce3e99SLuis R. Rodriguez struct ar5416IniArray iniBB[ATH_INI_NUM_SPLIT]; 92913ce3e99SLuis R. Rodriguez struct ar5416IniArray iniRadio[ATH_INI_NUM_SPLIT]; 93013ce3e99SLuis R. Rodriguez struct ar5416IniArray iniSOC[ATH_INI_NUM_SPLIT]; 93113ce3e99SLuis R. Rodriguez 932ff155a45SVasanthakumar Thiagarajan u32 intr_gen_timer_trigger; 933ff155a45SVasanthakumar Thiagarajan u32 intr_gen_timer_thresh; 934ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer_table hw_gen_timers; 935744d4025SVasanthakumar Thiagarajan 936744d4025SVasanthakumar Thiagarajan struct ar9003_txs *ts_ring; 937744d4025SVasanthakumar Thiagarajan u32 ts_paddr_start; 938744d4025SVasanthakumar Thiagarajan u32 ts_paddr_end; 939744d4025SVasanthakumar Thiagarajan u16 ts_tail; 940016c2177SRajkumar Manoharan u16 ts_size; 941aea702b7SLuis R. Rodriguez 942aea702b7SLuis R. Rodriguez u32 bb_watchdog_last_status; 943aea702b7SLuis R. Rodriguez u32 bb_watchdog_timeout_ms; /* in ms, 0 to disable */ 94451ac8cbbSRajkumar Manoharan u8 bb_hang_rx_ofdm; /* true if bb hang due to rx_ofdm */ 945717f6bedSFelix Fietkau 9461bf38661SFelix Fietkau unsigned int paprd_target_power; 9471bf38661SFelix Fietkau unsigned int paprd_training_power; 9487072bf62SVasanthakumar Thiagarajan unsigned int paprd_ratemask; 949f1a8abb0SFelix Fietkau unsigned int paprd_ratemask_ht40; 95045ef6a0bSVasanthakumar Thiagarajan bool paprd_table_write_done; 951717f6bedSFelix Fietkau u32 paprd_gain_table_entries[PAPRD_GAIN_TABLE_ENTRIES]; 952717f6bedSFelix Fietkau u8 paprd_gain_table_index[PAPRD_GAIN_TABLE_ENTRIES]; 9539a658d2bSLuis R. Rodriguez /* 9549a658d2bSLuis R. Rodriguez * Store the permanent value of Reg 0x4004in WARegVal 9559a658d2bSLuis R. Rodriguez * so we dont have to R/M/W. We should not be reading 9569a658d2bSLuis R. Rodriguez * this register when in sleep states. 9579a658d2bSLuis R. Rodriguez */ 9589a658d2bSLuis R. Rodriguez u32 WARegVal; 9596ee63f55SSenthil Balasubramanian 9606ee63f55SSenthil Balasubramanian /* Enterprise mode cap */ 9616ee63f55SSenthil Balasubramanian u32 ent_mode; 962f2f5f2a1SVasanthakumar Thiagarajan 963e60001e7SSujith Manoharan #ifdef CONFIG_ATH9K_WOW 96441fe8837SSujith Manoharan struct ath9k_hw_wow wow; 96501c78533SMohammed Shafi Shajakhan #endif 966f2f5f2a1SVasanthakumar Thiagarajan bool is_clk_25mhz; 9673762561aSGabor Juhos int (*get_mac_revision)(void); 9687d95847cSGabor Juhos int (*external_reset)(void); 9693468968eSFelix Fietkau bool disable_2ghz; 9703468968eSFelix Fietkau bool disable_5ghz; 971ab5c4f71SGabor Juhos 972ab5c4f71SGabor Juhos const struct firmware *eeprom_blob; 973c774d57fSLorenzo Bianconi 974c774d57fSLorenzo Bianconi struct ath_dynack dynack; 97523f53dd3SLorenzo Bianconi 97623f53dd3SLorenzo Bianconi bool tpc_enabled; 97723f53dd3SLorenzo Bianconi u8 tx_power[Ar5416RateSize]; 97823f53dd3SLorenzo Bianconi u8 tx_power_stbc[Ar5416RateSize]; 979203c4805SLuis R. Rodriguez }; 980203c4805SLuis R. Rodriguez 9810cb9e06bSFelix Fietkau struct ath_bus_ops { 9820cb9e06bSFelix Fietkau enum ath_bus_type ath_bus_type; 9830cb9e06bSFelix Fietkau void (*read_cachesize)(struct ath_common *common, int *csz); 9840cb9e06bSFelix Fietkau bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data); 9850cb9e06bSFelix Fietkau void (*bt_coex_prep)(struct ath_common *common); 986d4930086SStanislaw Gruszka void (*aspm_init)(struct ath_common *common); 9870cb9e06bSFelix Fietkau }; 9880cb9e06bSFelix Fietkau 9899e4bffd2SLuis R. Rodriguez static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) 9909e4bffd2SLuis R. Rodriguez { 9919e4bffd2SLuis R. Rodriguez return &ah->common; 9929e4bffd2SLuis R. Rodriguez } 9939e4bffd2SLuis R. Rodriguez 9949e4bffd2SLuis R. Rodriguez static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah) 9959e4bffd2SLuis R. Rodriguez { 9969e4bffd2SLuis R. Rodriguez return &(ath9k_hw_common(ah)->regulatory); 9979e4bffd2SLuis R. Rodriguez } 9989e4bffd2SLuis R. Rodriguez 999d70357d5SLuis R. Rodriguez static inline struct ath_hw_private_ops *ath9k_hw_private_ops(struct ath_hw *ah) 1000d70357d5SLuis R. Rodriguez { 1001d70357d5SLuis R. Rodriguez return &ah->private_ops; 1002d70357d5SLuis R. Rodriguez } 1003d70357d5SLuis R. Rodriguez 1004d70357d5SLuis R. Rodriguez static inline struct ath_hw_ops *ath9k_hw_ops(struct ath_hw *ah) 1005d70357d5SLuis R. Rodriguez { 1006d70357d5SLuis R. Rodriguez return &ah->ops; 1007d70357d5SLuis R. Rodriguez } 1008d70357d5SLuis R. Rodriguez 1009895ad7ebSVasanthakumar Thiagarajan static inline u8 get_streams(int mask) 1010895ad7ebSVasanthakumar Thiagarajan { 1011895ad7ebSVasanthakumar Thiagarajan return !!(mask & BIT(0)) + !!(mask & BIT(1)) + !!(mask & BIT(2)); 1012895ad7ebSVasanthakumar Thiagarajan } 1013895ad7ebSVasanthakumar Thiagarajan 1014f637cfd6SLuis R. Rodriguez /* Initialization, Detach, Reset */ 1015285f2ddaSSujith void ath9k_hw_deinit(struct ath_hw *ah); 1016f637cfd6SLuis R. Rodriguez int ath9k_hw_init(struct ath_hw *ah); 1017203c4805SLuis R. Rodriguez int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, 1018caed6579SSujith Manoharan struct ath9k_hw_cal_data *caldata, bool fastcc); 1019a9a29ce6SGabor Juhos int ath9k_hw_fill_cap_info(struct ath_hw *ah); 10208fe65368SLuis R. Rodriguez u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan); 1021203c4805SLuis R. Rodriguez 1022203c4805SLuis R. Rodriguez /* GPIO / RFKILL / Antennae */ 1023203c4805SLuis R. Rodriguez void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio); 1024203c4805SLuis R. Rodriguez u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio); 1025203c4805SLuis R. Rodriguez void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, 1026203c4805SLuis R. Rodriguez u32 ah_signal_type); 1027203c4805SLuis R. Rodriguez void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); 102861b559deSMiaoqing Pan void ath9k_hw_request_gpio(struct ath_hw *ah, u32 gpio, const char *label); 1029203c4805SLuis R. Rodriguez void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); 1030203c4805SLuis R. Rodriguez 1031203c4805SLuis R. Rodriguez /* General Operation */ 10327c5adc8dSFelix Fietkau void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan, 10337c5adc8dSFelix Fietkau int hw_delay); 1034203c4805SLuis R. Rodriguez bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); 10350166b4beSFelix Fietkau void ath9k_hw_write_array(struct ath_hw *ah, const struct ar5416IniArray *array, 1036a9b6b256SFelix Fietkau int column, unsigned int *writecnt); 1037a57cb45aSOleksij Rempel void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size); 1038203c4805SLuis R. Rodriguez u32 ath9k_hw_reverse_bits(u32 val, u32 n); 10394f0fc7c3SLuis R. Rodriguez u16 ath9k_hw_computetxtime(struct ath_hw *ah, 1040545750d3SFelix Fietkau u8 phy, int kbps, 1041203c4805SLuis R. Rodriguez u32 frameLen, u16 rateix, bool shortPreamble); 1042203c4805SLuis R. Rodriguez void ath9k_hw_get_channel_centers(struct ath_hw *ah, 1043203c4805SLuis R. Rodriguez struct ath9k_channel *chan, 1044203c4805SLuis R. Rodriguez struct chan_centers *centers); 1045203c4805SLuis R. Rodriguez u32 ath9k_hw_getrxfilter(struct ath_hw *ah); 1046203c4805SLuis R. Rodriguez void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits); 1047203c4805SLuis R. Rodriguez bool ath9k_hw_phy_disable(struct ath_hw *ah); 1048203c4805SLuis R. Rodriguez bool ath9k_hw_disable(struct ath_hw *ah); 1049de40f316SFelix Fietkau void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test); 1050203c4805SLuis R. Rodriguez void ath9k_hw_setopmode(struct ath_hw *ah); 1051203c4805SLuis R. Rodriguez void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); 1052f2b2143eSLuis R. Rodriguez void ath9k_hw_write_associd(struct ath_hw *ah); 1053dd347f2fSFelix Fietkau u32 ath9k_hw_gettsf32(struct ath_hw *ah); 1054203c4805SLuis R. Rodriguez u64 ath9k_hw_gettsf64(struct ath_hw *ah); 1055203c4805SLuis R. Rodriguez void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); 1056203c4805SLuis R. Rodriguez void ath9k_hw_reset_tsf(struct ath_hw *ah); 10578d7e09ddSFelix Fietkau u32 ath9k_hw_get_tsf_offset(struct timespec *last, struct timespec *cur); 105860ca9f87SSujith Manoharan void ath9k_hw_set_tsfadjust(struct ath_hw *ah, bool set); 10590005baf4SFelix Fietkau void ath9k_hw_init_global_settings(struct ath_hw *ah); 1060b84628ebSSenthil Balasubramanian u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah); 1061e4744ec7SFelix Fietkau void ath9k_hw_set11nmac2040(struct ath_hw *ah, struct ath9k_channel *chan); 1062203c4805SLuis R. Rodriguez void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); 1063203c4805SLuis R. Rodriguez void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, 1064203c4805SLuis R. Rodriguez const struct ath9k_beacon_state *bs); 10651e516ca7SSujith Manoharan void ath9k_hw_check_nav(struct ath_hw *ah); 1066c9c99e5eSFelix Fietkau bool ath9k_hw_check_alive(struct ath_hw *ah); 1067a91d75aeSLuis R. Rodriguez 10689ecdef4bSLuis R. Rodriguez bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); 1069a91d75aeSLuis R. Rodriguez 1070ff155a45SVasanthakumar Thiagarajan /* Generic hw timer primitives */ 1071ff155a45SVasanthakumar Thiagarajan struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, 1072ff155a45SVasanthakumar Thiagarajan void (*trigger)(void *), 1073ff155a45SVasanthakumar Thiagarajan void (*overflow)(void *), 1074ff155a45SVasanthakumar Thiagarajan void *arg, 1075ff155a45SVasanthakumar Thiagarajan u8 timer_index); 1076cd9bf689SLuis R. Rodriguez void ath9k_hw_gen_timer_start(struct ath_hw *ah, 1077cd9bf689SLuis R. Rodriguez struct ath_gen_timer *timer, 1078cd9bf689SLuis R. Rodriguez u32 timer_next, 1079cd9bf689SLuis R. Rodriguez u32 timer_period); 1080f4c34af4SSujith Manoharan void ath9k_hw_gen_timer_start_tsf2(struct ath_hw *ah); 1081cd9bf689SLuis R. Rodriguez void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer); 1082cd9bf689SLuis R. Rodriguez 1083ff155a45SVasanthakumar Thiagarajan void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer); 1084ff155a45SVasanthakumar Thiagarajan void ath_gen_timer_isr(struct ath_hw *hw); 1085ff155a45SVasanthakumar Thiagarajan 1086f934c4d9SLuis R. Rodriguez void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len); 10872da4f01aSLuis R. Rodriguez 10888fe65368SLuis R. Rodriguez /* PHY */ 10898fe65368SLuis R. Rodriguez void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, 10908fe65368SLuis R. Rodriguez u32 *coef_mantissa, u32 *coef_exponent); 109164ea57d0SGabor Juhos void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, 109264ea57d0SGabor Juhos bool test); 10938fe65368SLuis R. Rodriguez 1094ebd5a14aSLuis R. Rodriguez /* 1095ebd5a14aSLuis R. Rodriguez * Code Specific to AR5008, AR9001 or AR9002, 1096ebd5a14aSLuis R. Rodriguez * we stuff these here to avoid callbacks for AR9003. 1097ebd5a14aSLuis R. Rodriguez */ 1098ebd5a14aSLuis R. Rodriguez int ar9002_hw_rf_claim(struct ath_hw *ah); 109978ec2677SLuis R. Rodriguez void ar9002_hw_enable_async_fifo(struct ath_hw *ah); 1100d8f492b7SLuis R. Rodriguez 1101641d9921SFelix Fietkau /* 1102aea702b7SLuis R. Rodriguez * Code specific to AR9003, we stuff these here to avoid callbacks 1103641d9921SFelix Fietkau * for older families 1104641d9921SFelix Fietkau */ 1105d88527d3SSujith Manoharan bool ar9003_hw_bb_watchdog_check(struct ath_hw *ah); 1106aea702b7SLuis R. Rodriguez void ar9003_hw_bb_watchdog_config(struct ath_hw *ah); 1107aea702b7SLuis R. Rodriguez void ar9003_hw_bb_watchdog_read(struct ath_hw *ah); 1108aea702b7SLuis R. Rodriguez void ar9003_hw_bb_watchdog_dbg_info(struct ath_hw *ah); 110951ac8cbbSRajkumar Manoharan void ar9003_hw_disable_phy_restart(struct ath_hw *ah); 1110717f6bedSFelix Fietkau void ar9003_paprd_enable(struct ath_hw *ah, bool val); 1111717f6bedSFelix Fietkau void ar9003_paprd_populate_single_table(struct ath_hw *ah, 111220bd2a09SFelix Fietkau struct ath9k_hw_cal_data *caldata, 1113717f6bedSFelix Fietkau int chain); 111420bd2a09SFelix Fietkau int ar9003_paprd_create_curve(struct ath_hw *ah, 111520bd2a09SFelix Fietkau struct ath9k_hw_cal_data *caldata, int chain); 111636d2943bSSujith Manoharan void ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain); 1117717f6bedSFelix Fietkau int ar9003_paprd_init_table(struct ath_hw *ah); 1118717f6bedSFelix Fietkau bool ar9003_paprd_is_done(struct ath_hw *ah); 11190f21ee8dSSujith Manoharan bool ar9003_is_paprd_enabled(struct ath_hw *ah); 11204a8f1995SFelix Fietkau void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx); 112123f53dd3SLorenzo Bianconi void ar9003_hw_init_rate_txpower(struct ath_hw *ah, u8 *rate_array, 112223f53dd3SLorenzo Bianconi struct ath9k_channel *chan); 1123f911085fSOleksij Rempel void ar5008_hw_cmn_spur_mitigate(struct ath_hw *ah, 1124f911085fSOleksij Rempel struct ath9k_channel *chan, int bin); 1125c08267dcSLorenzo Bianconi void ar5008_hw_init_rate_txpower(struct ath_hw *ah, int16_t *rate_array, 1126c08267dcSLorenzo Bianconi struct ath9k_channel *chan, int ht40_delta); 1127641d9921SFelix Fietkau 1128641d9921SFelix Fietkau /* Hardware family op attach helpers */ 1129c1b976d2SFelix Fietkau int ar5008_hw_attach_phy_ops(struct ath_hw *ah); 11308525f280SLuis R. Rodriguez void ar9002_hw_attach_phy_ops(struct ath_hw *ah); 11318525f280SLuis R. Rodriguez void ar9003_hw_attach_phy_ops(struct ath_hw *ah); 11328fe65368SLuis R. Rodriguez 1133795f5e2cSLuis R. Rodriguez void ar9002_hw_attach_calib_ops(struct ath_hw *ah); 1134795f5e2cSLuis R. Rodriguez void ar9003_hw_attach_calib_ops(struct ath_hw *ah); 1135795f5e2cSLuis R. Rodriguez 1136c1b976d2SFelix Fietkau int ar9002_hw_attach_ops(struct ath_hw *ah); 1137b3950e6aSLuis R. Rodriguez void ar9003_hw_attach_ops(struct ath_hw *ah); 1138b3950e6aSLuis R. Rodriguez 1139c2ba3342SRajkumar Manoharan void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan); 11406790ae7aSFelix Fietkau 11418eb4980cSFelix Fietkau void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning); 114295792178SFelix Fietkau void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan); 1143ac0bb767SLuis R. Rodriguez 11448e15e094SLorenzo Bianconi void ath9k_hw_set_ack_timeout(struct ath_hw *ah, u32 us); 11458e15e094SLorenzo Bianconi void ath9k_hw_set_cts_timeout(struct ath_hw *ah, u32 us); 11468e15e094SLorenzo Bianconi void ath9k_hw_setslottime(struct ath_hw *ah, u32 us); 11478e15e094SLorenzo Bianconi 11488a309305SFelix Fietkau #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT 114944a89c82SSujith Manoharan void ar9003_hw_attach_aic_ops(struct ath_hw *ah); 1150dbccdd1dSSujith Manoharan static inline bool ath9k_hw_btcoex_is_enabled(struct ath_hw *ah) 1151dbccdd1dSSujith Manoharan { 1152dbccdd1dSSujith Manoharan return ah->btcoex_hw.enabled; 1153dbccdd1dSSujith Manoharan } 11545955b2b0SSujith Manoharan static inline bool ath9k_hw_mci_is_enabled(struct ath_hw *ah) 11555955b2b0SSujith Manoharan { 1156e1ecad78SRajkumar Manoharan return ah->common.btcoex_enabled && 1157e1ecad78SRajkumar Manoharan (ah->caps.hw_caps & ATH9K_HW_CAP_MCI); 11585955b2b0SSujith Manoharan 11595955b2b0SSujith Manoharan } 1160dbccdd1dSSujith Manoharan void ath9k_hw_btcoex_enable(struct ath_hw *ah); 11618a309305SFelix Fietkau static inline enum ath_btcoex_scheme 11628a309305SFelix Fietkau ath9k_hw_get_btcoex_scheme(struct ath_hw *ah) 11638a309305SFelix Fietkau { 11648a309305SFelix Fietkau return ah->btcoex_hw.scheme; 11658a309305SFelix Fietkau } 11668a309305SFelix Fietkau #else 116744a89c82SSujith Manoharan static inline void ar9003_hw_attach_aic_ops(struct ath_hw *ah) 116844a89c82SSujith Manoharan { 116944a89c82SSujith Manoharan } 1170dbccdd1dSSujith Manoharan static inline bool ath9k_hw_btcoex_is_enabled(struct ath_hw *ah) 1171dbccdd1dSSujith Manoharan { 1172dbccdd1dSSujith Manoharan return false; 1173dbccdd1dSSujith Manoharan } 11745955b2b0SSujith Manoharan static inline bool ath9k_hw_mci_is_enabled(struct ath_hw *ah) 11755955b2b0SSujith Manoharan { 11765955b2b0SSujith Manoharan return false; 11775955b2b0SSujith Manoharan } 1178dbccdd1dSSujith Manoharan static inline void ath9k_hw_btcoex_enable(struct ath_hw *ah) 1179dbccdd1dSSujith Manoharan { 1180dbccdd1dSSujith Manoharan } 1181dbccdd1dSSujith Manoharan static inline enum ath_btcoex_scheme 1182dbccdd1dSSujith Manoharan ath9k_hw_get_btcoex_scheme(struct ath_hw *ah) 1183dbccdd1dSSujith Manoharan { 1184dbccdd1dSSujith Manoharan return ATH_BTCOEX_CFG_NONE; 1185dbccdd1dSSujith Manoharan } 118664ab38dfSSujith Manoharan #endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ 11878a309305SFelix Fietkau 118864875c63SMohammed Shafi Shajakhan 1189e60001e7SSujith Manoharan #ifdef CONFIG_ATH9K_WOW 11906af75e4dSSujith Manoharan int ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 *user_pattern, 119164875c63SMohammed Shafi Shajakhan u8 *user_mask, int pattern_count, 119264875c63SMohammed Shafi Shajakhan int pattern_len); 119364875c63SMohammed Shafi Shajakhan u32 ath9k_hw_wow_wakeup(struct ath_hw *ah); 119464875c63SMohammed Shafi Shajakhan void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable); 119564875c63SMohammed Shafi Shajakhan #else 11966af75e4dSSujith Manoharan static inline int ath9k_hw_wow_apply_pattern(struct ath_hw *ah, 119764875c63SMohammed Shafi Shajakhan u8 *user_pattern, 119864875c63SMohammed Shafi Shajakhan u8 *user_mask, 119964875c63SMohammed Shafi Shajakhan int pattern_count, 120064875c63SMohammed Shafi Shajakhan int pattern_len) 120164875c63SMohammed Shafi Shajakhan { 12026af75e4dSSujith Manoharan return 0; 120364875c63SMohammed Shafi Shajakhan } 120464875c63SMohammed Shafi Shajakhan static inline u32 ath9k_hw_wow_wakeup(struct ath_hw *ah) 120564875c63SMohammed Shafi Shajakhan { 120664875c63SMohammed Shafi Shajakhan return 0; 120764875c63SMohammed Shafi Shajakhan } 120864875c63SMohammed Shafi Shajakhan static inline void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable) 120964875c63SMohammed Shafi Shajakhan { 121064875c63SMohammed Shafi Shajakhan } 121164875c63SMohammed Shafi Shajakhan #endif 121264875c63SMohammed Shafi Shajakhan 121373377256SLuis R. Rodriguez #define ATH9K_CLOCK_RATE_CCK 22 121473377256SLuis R. Rodriguez #define ATH9K_CLOCK_RATE_5GHZ_OFDM 40 121573377256SLuis R. Rodriguez #define ATH9K_CLOCK_RATE_2GHZ_OFDM 44 121673377256SLuis R. Rodriguez #define ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM 44 121773377256SLuis R. Rodriguez 1218203c4805SLuis R. Rodriguez #endif 1219