Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 1 | /* |
Sujith Manoharan | 5b68138 | 2011-05-17 13:36:18 +0530 | [diff] [blame] | 2 | * Copyright (c) 2008-2011 Atheros Communications Inc. |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for any |
| 5 | * purpose with or without fee is hereby granted, provided that the above |
| 6 | * copyright notice and this permission notice appear in all copies. |
| 7 | * |
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ |
| 16 | |
| 17 | #ifndef HW_H |
| 18 | #define HW_H |
| 19 | |
| 20 | #include <linux/if_ether.h> |
| 21 | #include <linux/delay.h> |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 22 | #include <linux/io.h> |
Gabor Juhos | ab5c4f7 | 2012-12-10 15:30:28 +0100 | [diff] [blame] | 23 | #include <linux/firmware.h> |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 24 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 25 | #include "mac.h" |
| 26 | #include "ani.h" |
| 27 | #include "eeprom.h" |
| 28 | #include "calib.h" |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 29 | #include "reg.h" |
| 30 | #include "phy.h" |
Luis R. Rodriguez | af03abe | 2009-09-09 02:33:11 -0700 | [diff] [blame] | 31 | #include "btcoex.h" |
Luis R. Rodriguez | a085ff7 | 2008-12-23 15:58:51 -0800 | [diff] [blame] | 32 | |
Luis R. Rodriguez | 203c480 | 2009-03-30 22:30:33 -0400 | [diff] [blame] | 33 | #include "../regd.h" |
Bob Copeland | 3a702e4 | 2009-03-30 22:30:29 -0400 | [diff] [blame] | 34 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 35 | #define ATHEROS_VENDOR_ID 0x168c |
Luis R. Rodriguez | 7976b42 | 2009-09-23 23:07:02 -0400 | [diff] [blame] | 36 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 37 | #define AR5416_DEVID_PCI 0x0023 |
| 38 | #define AR5416_DEVID_PCIE 0x0024 |
| 39 | #define AR9160_DEVID_PCI 0x0027 |
| 40 | #define AR9280_DEVID_PCI 0x0029 |
| 41 | #define AR9280_DEVID_PCIE 0x002a |
| 42 | #define AR9285_DEVID_PCIE 0x002b |
Luis R. Rodriguez | 5ffaf8a | 2010-02-02 11:58:33 -0500 | [diff] [blame] | 43 | #define AR2427_DEVID_PCIE 0x002c |
Senthil Balasubramanian | db3cc53 | 2010-04-15 17:38:18 -0400 | [diff] [blame] | 44 | #define AR9287_DEVID_PCI 0x002d |
| 45 | #define AR9287_DEVID_PCIE 0x002e |
| 46 | #define AR9300_DEVID_PCIE 0x0030 |
Vasanthakumar Thiagarajan | b99a7be | 2011-04-19 19:28:59 +0530 | [diff] [blame] | 47 | #define AR9300_DEVID_AR9340 0x0031 |
Vasanthakumar Thiagarajan | 3050c91 | 2010-12-06 04:27:36 -0800 | [diff] [blame] | 48 | #define AR9300_DEVID_AR9485_PCIE 0x0032 |
Luis R. Rodriguez | 5a63ef0 | 2011-08-24 15:36:08 -0700 | [diff] [blame] | 49 | #define AR9300_DEVID_AR9580 0x0033 |
Rajkumar Manoharan | 423e38e | 2011-10-13 11:00:44 +0530 | [diff] [blame] | 50 | #define AR9300_DEVID_AR9462 0x0034 |
Gabor Juhos | 0368930 | 2011-06-21 11:23:22 +0200 | [diff] [blame] | 51 | #define AR9300_DEVID_AR9330 0x0035 |
Gabor Juhos | b123377 | 2012-07-03 19:13:15 +0200 | [diff] [blame] | 52 | #define AR9300_DEVID_QCA955X 0x0038 |
Mohammed Shafi Shajakhan | d4e5979 | 2012-08-02 11:58:50 +0530 | [diff] [blame] | 53 | #define AR9485_DEVID_AR1111 0x0037 |
Sujith Manoharan | 77fac46 | 2012-09-11 20:09:18 +0530 | [diff] [blame] | 54 | #define AR9300_DEVID_AR9565 0x0036 |
Luis R. Rodriguez | 7976b42 | 2009-09-23 23:07:02 -0400 | [diff] [blame] | 55 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 56 | #define AR5416_AR9100_DEVID 0x000b |
Luis R. Rodriguez | 7976b42 | 2009-09-23 23:07:02 -0400 | [diff] [blame] | 57 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 58 | #define AR_SUBVENDOR_ID_NOG 0x0e11 |
| 59 | #define AR_SUBVENDOR_ID_NEW_A 0x7065 |
| 60 | #define AR5416_MAGIC 0x19641014 |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 61 | |
Vasanthakumar Thiagarajan | fe12946 | 2009-09-09 15:25:50 +0530 | [diff] [blame] | 62 | #define AR9280_COEX2WIRE_SUBSYSID 0x309b |
| 63 | #define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa |
| 64 | #define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab |
| 65 | |
Luis R. Rodriguez | e3d01bf | 2009-09-13 23:11:13 -0700 | [diff] [blame] | 66 | #define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1) |
| 67 | |
Luis R. Rodriguez | cfe8cba | 2009-09-13 23:39:31 -0700 | [diff] [blame] | 68 | #define ATH_DEFAULT_NOISE_FLOOR -95 |
| 69 | |
John W. Linville | 04658fb | 2009-11-13 13:12:59 -0500 | [diff] [blame] | 70 | #define ATH9K_RSSI_BAD -128 |
Luis R. Rodriguez | 990b70a | 2009-09-13 23:55:05 -0700 | [diff] [blame] | 71 | |
Felix Fietkau | cac4220 | 2010-10-09 02:39:30 +0200 | [diff] [blame] | 72 | #define ATH9K_NUM_CHANNELS 38 |
| 73 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 74 | /* Register read/write primitives */ |
Luis R. Rodriguez | 9e4bffd | 2009-09-10 16:11:21 -0700 | [diff] [blame] | 75 | #define REG_WRITE(_ah, _reg, _val) \ |
Felix Fietkau | f9f84e9 | 2011-03-23 20:57:24 +0100 | [diff] [blame] | 76 | (_ah)->reg_ops.write((_ah), (_val), (_reg)) |
Luis R. Rodriguez | 9e4bffd | 2009-09-10 16:11:21 -0700 | [diff] [blame] | 77 | |
| 78 | #define REG_READ(_ah, _reg) \ |
Felix Fietkau | f9f84e9 | 2011-03-23 20:57:24 +0100 | [diff] [blame] | 79 | (_ah)->reg_ops.read((_ah), (_reg)) |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 80 | |
Sujith Manoharan | 09a525d | 2011-01-04 13:17:18 +0530 | [diff] [blame] | 81 | #define REG_READ_MULTI(_ah, _addr, _val, _cnt) \ |
Felix Fietkau | f9f84e9 | 2011-03-23 20:57:24 +0100 | [diff] [blame] | 82 | (_ah)->reg_ops.multi_read((_ah), (_addr), (_val), (_cnt)) |
Sujith Manoharan | 09a525d | 2011-01-04 13:17:18 +0530 | [diff] [blame] | 83 | |
Felix Fietkau | 845e03c | 2011-03-23 20:57:25 +0100 | [diff] [blame] | 84 | #define REG_RMW(_ah, _reg, _set, _clr) \ |
| 85 | (_ah)->reg_ops.rmw((_ah), (_reg), (_set), (_clr)) |
| 86 | |
Sujith | 20b3efd | 2010-04-16 11:53:55 +0530 | [diff] [blame] | 87 | #define ENABLE_REGWRITE_BUFFER(_ah) \ |
| 88 | do { \ |
Felix Fietkau | f9f84e9 | 2011-03-23 20:57:24 +0100 | [diff] [blame] | 89 | if ((_ah)->reg_ops.enable_write_buffer) \ |
| 90 | (_ah)->reg_ops.enable_write_buffer((_ah)); \ |
Sujith | 20b3efd | 2010-04-16 11:53:55 +0530 | [diff] [blame] | 91 | } while (0) |
| 92 | |
Sujith | 20b3efd | 2010-04-16 11:53:55 +0530 | [diff] [blame] | 93 | #define REGWRITE_BUFFER_FLUSH(_ah) \ |
| 94 | do { \ |
Felix Fietkau | f9f84e9 | 2011-03-23 20:57:24 +0100 | [diff] [blame] | 95 | if ((_ah)->reg_ops.write_flush) \ |
| 96 | (_ah)->reg_ops.write_flush((_ah)); \ |
Sujith | 20b3efd | 2010-04-16 11:53:55 +0530 | [diff] [blame] | 97 | } while (0) |
| 98 | |
Rajkumar Manoharan | 2652620 | 2011-07-29 17:38:08 +0530 | [diff] [blame] | 99 | #define PR_EEP(_s, _val) \ |
| 100 | do { \ |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 101 | len += scnprintf(buf + len, size - len, "%20s : %10d\n",\ |
| 102 | _s, (_val)); \ |
Rajkumar Manoharan | 2652620 | 2011-07-29 17:38:08 +0530 | [diff] [blame] | 103 | } while (0) |
| 104 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 105 | #define SM(_v, _f) (((_v) << _f##_S) & _f) |
| 106 | #define MS(_v, _f) (((_v) & _f) >> _f##_S) |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 107 | #define REG_RMW_FIELD(_a, _r, _f, _v) \ |
Felix Fietkau | 845e03c | 2011-03-23 20:57:25 +0100 | [diff] [blame] | 108 | REG_RMW(_a, _r, (((_v) << _f##_S) & _f), (_f)) |
Luis R. Rodriguez | 1547da3 | 2010-04-15 17:39:15 -0400 | [diff] [blame] | 109 | #define REG_READ_FIELD(_a, _r, _f) \ |
| 110 | (((REG_READ(_a, _r) & _f) >> _f##_S)) |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 111 | #define REG_SET_BIT(_a, _r, _f) \ |
Felix Fietkau | 845e03c | 2011-03-23 20:57:25 +0100 | [diff] [blame] | 112 | REG_RMW(_a, _r, (_f), 0) |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 113 | #define REG_CLR_BIT(_a, _r, _f) \ |
Felix Fietkau | 845e03c | 2011-03-23 20:57:25 +0100 | [diff] [blame] | 114 | REG_RMW(_a, _r, 0, (_f)) |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 115 | |
Rajkumar Manoharan | e7fc633 | 2011-03-15 23:11:35 +0530 | [diff] [blame] | 116 | #define DO_DELAY(x) do { \ |
| 117 | if (((++(x) % 64) == 0) && \ |
| 118 | (ath9k_hw_common(ah)->bus_ops->ath_bus_type \ |
| 119 | != ATH_USB)) \ |
| 120 | udelay(1); \ |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 121 | } while (0) |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 122 | |
Felix Fietkau | a9b6b25 | 2011-03-23 20:57:27 +0100 | [diff] [blame] | 123 | #define REG_WRITE_ARRAY(iniarray, column, regWr) \ |
| 124 | ath9k_hw_write_array(ah, iniarray, column, &(regWr)) |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 125 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 126 | #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0 |
| 127 | #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1 |
| 128 | #define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED 2 |
| 129 | #define AR_GPIO_OUTPUT_MUX_AS_TX_FRAME 3 |
Vasanthakumar Thiagarajan | 1773912 | 2009-08-26 21:08:50 +0530 | [diff] [blame] | 130 | #define AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL 4 |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 131 | #define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED 5 |
| 132 | #define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED 6 |
Mohammed Shafi Shajakhan | 93d36e9 | 2011-11-30 10:41:14 +0530 | [diff] [blame] | 133 | #define AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_DATA 0x16 |
| 134 | #define AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_CLK 0x17 |
| 135 | #define AR_GPIO_OUTPUT_MUX_AS_MCI_BT_DATA 0x18 |
| 136 | #define AR_GPIO_OUTPUT_MUX_AS_MCI_BT_CLK 0x19 |
| 137 | #define AR_GPIO_OUTPUT_MUX_AS_WL_IN_TX 0x14 |
| 138 | #define AR_GPIO_OUTPUT_MUX_AS_WL_IN_RX 0x13 |
| 139 | #define AR_GPIO_OUTPUT_MUX_AS_BT_IN_TX 9 |
| 140 | #define AR_GPIO_OUTPUT_MUX_AS_BT_IN_RX 8 |
| 141 | #define AR_GPIO_OUTPUT_MUX_AS_RUCKUS_STROBE 0x1d |
| 142 | #define AR_GPIO_OUTPUT_MUX_AS_RUCKUS_DATA 0x1e |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 143 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 144 | #define AR_GPIOD_MASK 0x00001FFF |
| 145 | #define AR_GPIO_BIT(_gpio) (1 << (_gpio)) |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 146 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 147 | #define BASE_ACTIVATE_DELAY 100 |
Vasanthakumar Thiagarajan | 0b488ac | 2011-04-20 10:26:15 +0530 | [diff] [blame] | 148 | #define RTC_PLL_SETTLE_DELAY (AR_SREV_9340(ah) ? 1000 : 100) |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 149 | #define COEF_SCALE_S 24 |
| 150 | #define HT40_CHANNEL_CENTER_SHIFT 10 |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 151 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 152 | #define ATH9K_ANTENNA0_CHAINMASK 0x1 |
| 153 | #define ATH9K_ANTENNA1_CHAINMASK 0x2 |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 154 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 155 | #define ATH9K_NUM_DMA_DEBUG_REGS 8 |
| 156 | #define ATH9K_NUM_QUEUES 10 |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 157 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 158 | #define MAX_RATE_POWER 63 |
Sujith | 0caa7b1 | 2009-02-16 13:23:20 +0530 | [diff] [blame] | 159 | #define AH_WAIT_TIMEOUT 100000 /* (us) */ |
Gabor Juhos | f9b604f | 2009-06-21 00:02:15 +0200 | [diff] [blame] | 160 | #define AH_TSF_WRITE_TIMEOUT 100 /* (us) */ |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 161 | #define AH_TIME_QUANTUM 10 |
| 162 | #define AR_KEYTABLE_SIZE 128 |
Sujith | d8caa83 | 2009-09-17 09:25:45 +0530 | [diff] [blame] | 163 | #define POWER_UP_TIME 10000 |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 164 | #define SPUR_RSSI_THRESH 40 |
Mohammed Shafi Shajakhan | 331c5ea | 2011-07-08 13:01:32 +0530 | [diff] [blame] | 165 | #define UPPER_5G_SUB_BAND_START 5700 |
| 166 | #define MID_5G_SUB_BAND_START 5400 |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 167 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 168 | #define CAB_TIMEOUT_VAL 10 |
| 169 | #define BEACON_TIMEOUT_VAL 10 |
| 170 | #define MIN_BEACON_TIMEOUT_VAL 1 |
| 171 | #define SLEEP_SLOP 3 |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 172 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 173 | #define INIT_CONFIG_STATUS 0x00000000 |
| 174 | #define INIT_RSSI_THR 0x00000700 |
| 175 | #define INIT_BCON_CNTRL_REG 0x00000000 |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 176 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 177 | #define TU_TO_USEC(_tu) ((_tu) << 10) |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 178 | |
Vasanthakumar Thiagarajan | ceb2644 | 2010-04-15 17:38:25 -0400 | [diff] [blame] | 179 | #define ATH9K_HW_RX_HP_QDEPTH 16 |
| 180 | #define ATH9K_HW_RX_LP_QDEPTH 128 |
| 181 | |
Mohammed Shafi Shajakhan | 0e44d48 | 2011-06-17 14:08:42 +0530 | [diff] [blame] | 182 | #define PAPRD_GAIN_TABLE_ENTRIES 32 |
| 183 | #define PAPRD_TABLE_SZ 24 |
| 184 | #define PAPRD_IDEAL_AGC2_PWR_RANGE 0xe0 |
Felix Fietkau | 717f6be | 2010-06-12 00:34:00 -0400 | [diff] [blame] | 185 | |
Mohammed Shafi Shajakhan | 01c7853 | 2012-07-10 14:54:34 +0530 | [diff] [blame] | 186 | /* |
| 187 | * Wake on Wireless |
| 188 | */ |
| 189 | |
| 190 | /* Keep Alive Frame */ |
| 191 | #define KAL_FRAME_LEN 28 |
| 192 | #define KAL_FRAME_TYPE 0x2 /* data frame */ |
| 193 | #define KAL_FRAME_SUB_TYPE 0x4 /* null data frame */ |
| 194 | #define KAL_DURATION_ID 0x3d |
| 195 | #define KAL_NUM_DATA_WORDS 6 |
| 196 | #define KAL_NUM_DESC_WORDS 12 |
| 197 | #define KAL_ANTENNA_MODE 1 |
| 198 | #define KAL_TO_DS 1 |
| 199 | #define KAL_DELAY 4 /*delay of 4ms between 2 KAL frames */ |
| 200 | #define KAL_TIMEOUT 900 |
| 201 | |
| 202 | #define MAX_PATTERN_SIZE 256 |
| 203 | #define MAX_PATTERN_MASK_SIZE 32 |
| 204 | #define MAX_NUM_PATTERN 8 |
| 205 | #define MAX_NUM_USER_PATTERN 6 /* deducting the disassociate and |
| 206 | deauthenticate packets */ |
| 207 | |
| 208 | /* |
| 209 | * WoW trigger mapping to hardware code |
| 210 | */ |
| 211 | |
| 212 | #define AH_WOW_USER_PATTERN_EN BIT(0) |
| 213 | #define AH_WOW_MAGIC_PATTERN_EN BIT(1) |
| 214 | #define AH_WOW_LINK_CHANGE BIT(2) |
| 215 | #define AH_WOW_BEACON_MISS BIT(3) |
| 216 | |
Felix Fietkau | 066dae9 | 2010-11-07 14:59:39 +0100 | [diff] [blame] | 217 | enum ath_hw_txq_subtype { |
| 218 | ATH_TXQ_AC_BE = 0, |
| 219 | ATH_TXQ_AC_BK = 1, |
| 220 | ATH_TXQ_AC_VI = 2, |
| 221 | ATH_TXQ_AC_VO = 3, |
| 222 | }; |
| 223 | |
Luis R. Rodriguez | 13ce3e9 | 2010-04-15 17:38:37 -0400 | [diff] [blame] | 224 | enum ath_ini_subsys { |
| 225 | ATH_INI_PRE = 0, |
| 226 | ATH_INI_CORE, |
| 227 | ATH_INI_POST, |
| 228 | ATH_INI_NUM_SPLIT, |
| 229 | }; |
| 230 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 231 | enum ath9k_hw_caps { |
Felix Fietkau | 364734f | 2010-09-14 20:22:44 +0200 | [diff] [blame] | 232 | ATH9K_HW_CAP_HT = BIT(0), |
| 233 | ATH9K_HW_CAP_RFSILENT = BIT(1), |
Mohammed Shafi Shajakhan | 1b2538b | 2011-12-07 16:51:39 +0530 | [diff] [blame] | 234 | ATH9K_HW_CAP_AUTOSLEEP = BIT(2), |
| 235 | ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(3), |
| 236 | ATH9K_HW_CAP_EDMA = BIT(4), |
| 237 | ATH9K_HW_CAP_RAC_SUPPORTED = BIT(5), |
| 238 | ATH9K_HW_CAP_LDPC = BIT(6), |
| 239 | ATH9K_HW_CAP_FASTCLOCK = BIT(7), |
| 240 | ATH9K_HW_CAP_SGI_20 = BIT(8), |
Mohammed Shafi Shajakhan | 1b2538b | 2011-12-07 16:51:39 +0530 | [diff] [blame] | 241 | ATH9K_HW_CAP_ANT_DIV_COMB = BIT(10), |
| 242 | ATH9K_HW_CAP_2GHZ = BIT(11), |
| 243 | ATH9K_HW_CAP_5GHZ = BIT(12), |
| 244 | ATH9K_HW_CAP_APM = BIT(13), |
| 245 | ATH9K_HW_CAP_RTT = BIT(14), |
| 246 | ATH9K_HW_CAP_MCI = BIT(15), |
| 247 | ATH9K_HW_CAP_DFS = BIT(16), |
Mohammed Shafi Shajakhan | 8e98138 | 2012-07-10 14:54:53 +0530 | [diff] [blame] | 248 | ATH9K_HW_WOW_DEVICE_CAPABLE = BIT(17), |
Sujith Manoharan | 846e438 | 2013-06-03 09:19:24 +0530 | [diff] [blame] | 249 | ATH9K_HW_CAP_PAPRD = BIT(18), |
Sujith Manoharan | 81dc75b | 2013-07-16 12:03:18 +0530 | [diff] [blame] | 250 | ATH9K_HW_CAP_FCC_BAND_SWITCH = BIT(19), |
Sujith Manoharan | 3f2da95 | 2013-08-04 14:21:56 +0530 | [diff] [blame] | 251 | ATH9K_HW_CAP_BT_ANT_DIV = BIT(20), |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 252 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 253 | |
Mohammed Shafi Shajakhan | 8e98138 | 2012-07-10 14:54:53 +0530 | [diff] [blame] | 254 | /* |
| 255 | * WoW device capabilities |
| 256 | * @ATH9K_HW_WOW_DEVICE_CAPABLE: device revision is capable of WoW. |
| 257 | * @ATH9K_HW_WOW_PATTERN_MATCH_EXACT: device is capable of matching |
| 258 | * an exact user defined pattern or de-authentication/disassoc pattern. |
| 259 | * @ATH9K_HW_WOW_PATTERN_MATCH_DWORD: device requires the first four |
| 260 | * bytes of the pattern for user defined pattern, de-authentication and |
| 261 | * disassociation patterns for all types of possible frames recieved |
| 262 | * of those types. |
| 263 | */ |
| 264 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 265 | struct ath9k_hw_capabilities { |
| 266 | u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */ |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 267 | u16 rts_aggr_limit; |
| 268 | u8 tx_chainmask; |
| 269 | u8 rx_chainmask; |
Vasanthakumar Thiagarajan | 47c80de | 2010-12-06 04:27:43 -0800 | [diff] [blame] | 270 | u8 max_txchains; |
| 271 | u8 max_rxchains; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 272 | u8 num_gpio_pins; |
Vasanthakumar Thiagarajan | ceb2644 | 2010-04-15 17:38:25 -0400 | [diff] [blame] | 273 | u8 rx_hp_qdepth; |
| 274 | u8 rx_lp_qdepth; |
| 275 | u8 rx_status_len; |
Vasanthakumar Thiagarajan | 162c3be | 2010-04-15 17:38:41 -0400 | [diff] [blame] | 276 | u8 tx_desc_len; |
Vasanthakumar Thiagarajan | 5088c2f | 2010-04-15 17:39:34 -0400 | [diff] [blame] | 277 | u8 txs_len; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 278 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 279 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 280 | struct ath9k_ops_config { |
| 281 | int dma_beacon_response_time; |
| 282 | int sw_beacon_response_time; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 283 | int ack_6mb; |
Felix Fietkau | 41f3e54 | 2010-06-12 00:33:56 -0400 | [diff] [blame] | 284 | u32 cwm_ignore_extcca; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 285 | u32 pcie_waen; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 286 | u8 analog_shiftreg; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 287 | u32 ofdm_trig_low; |
| 288 | u32 ofdm_trig_high; |
| 289 | u32 cck_trig_high; |
| 290 | u32 cck_trig_low; |
Felix Fietkau | 74673db | 2012-09-08 15:24:17 +0200 | [diff] [blame] | 291 | u32 enable_paprd; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 292 | int serialize_regmode; |
Sujith | 0ce024c | 2009-12-14 14:57:00 +0530 | [diff] [blame] | 293 | bool rx_intr_mitigation; |
Vasanthakumar Thiagarajan | 55e82df | 2010-04-15 17:39:06 -0400 | [diff] [blame] | 294 | bool tx_intr_mitigation; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 295 | #define AR_NO_SPUR 0x8000 |
| 296 | #define AR_BASE_FREQ_2GHZ 2300 |
| 297 | #define AR_BASE_FREQ_5GHZ 4900 |
| 298 | #define AR_SPUR_FEEQ_BOUND_HT40 19 |
| 299 | #define AR_SPUR_FEEQ_BOUND_HT20 10 |
Luis R. Rodriguez | f4709fd | 2009-11-24 21:37:57 -0500 | [diff] [blame] | 300 | u8 max_txtrig_level; |
Luis R. Rodriguez | e36b27a | 2010-06-12 00:33:45 -0400 | [diff] [blame] | 301 | u16 ani_poll_interval; /* ANI poll interval in ms */ |
Sujith Manoharan | 9b60b64 | 2013-06-13 22:51:26 +0530 | [diff] [blame] | 302 | |
| 303 | /* Platform specific config */ |
Sujith Manoharan | b380a43b | 2013-08-25 14:43:09 +0530 | [diff] [blame] | 304 | u32 aspm_l1_fix; |
Sujith Manoharan | 9b60b64 | 2013-06-13 22:51:26 +0530 | [diff] [blame] | 305 | u32 xlna_gpio; |
Sujith Manoharan | 31fd216 | 2013-08-04 14:22:01 +0530 | [diff] [blame] | 306 | u32 ant_ctrl_comm2g_switch_enable; |
Sujith Manoharan | 9b60b64 | 2013-06-13 22:51:26 +0530 | [diff] [blame] | 307 | bool xatten_margin_cfg; |
Sujith Manoharan | e083a42 | 2013-08-19 11:04:01 +0530 | [diff] [blame] | 308 | bool alt_mingainidx; |
Sujith Manoharan | 2d22c7d | 2013-11-08 11:45:25 +0530 | [diff] [blame] | 309 | bool no_pll_pwrsave; |
Sujith Manoharan | 0f978bf | 2013-12-06 16:28:45 +0530 | [diff] [blame] | 310 | bool tx_gain_buffalo; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 311 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 312 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 313 | enum ath9k_int { |
| 314 | ATH9K_INT_RX = 0x00000001, |
| 315 | ATH9K_INT_RXDESC = 0x00000002, |
Felix Fietkau | b5c80475 | 2010-04-15 17:38:48 -0400 | [diff] [blame] | 316 | ATH9K_INT_RXHP = 0x00000001, |
| 317 | ATH9K_INT_RXLP = 0x00000002, |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 318 | ATH9K_INT_RXNOFRM = 0x00000008, |
| 319 | ATH9K_INT_RXEOL = 0x00000010, |
| 320 | ATH9K_INT_RXORN = 0x00000020, |
| 321 | ATH9K_INT_TX = 0x00000040, |
| 322 | ATH9K_INT_TXDESC = 0x00000080, |
| 323 | ATH9K_INT_TIM_TIMER = 0x00000100, |
Mohammed Shafi Shajakhan | 2ee4bd1 | 2011-11-30 10:41:13 +0530 | [diff] [blame] | 324 | ATH9K_INT_MCI = 0x00000200, |
Luis R. Rodriguez | aea702b | 2010-05-13 13:33:43 -0400 | [diff] [blame] | 325 | ATH9K_INT_BB_WATCHDOG = 0x00000400, |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 326 | ATH9K_INT_TXURN = 0x00000800, |
| 327 | ATH9K_INT_MIB = 0x00001000, |
| 328 | ATH9K_INT_RXPHY = 0x00004000, |
| 329 | ATH9K_INT_RXKCM = 0x00008000, |
| 330 | ATH9K_INT_SWBA = 0x00010000, |
| 331 | ATH9K_INT_BMISS = 0x00040000, |
| 332 | ATH9K_INT_BNR = 0x00100000, |
| 333 | ATH9K_INT_TIM = 0x00200000, |
| 334 | ATH9K_INT_DTIM = 0x00400000, |
| 335 | ATH9K_INT_DTIMSYNC = 0x00800000, |
| 336 | ATH9K_INT_GPIO = 0x01000000, |
| 337 | ATH9K_INT_CABEND = 0x02000000, |
Sujith | 4af9cf4 | 2009-02-12 10:06:47 +0530 | [diff] [blame] | 338 | ATH9K_INT_TSFOOR = 0x04000000, |
Vasanthakumar Thiagarajan | ff155a4 | 2009-08-26 21:08:49 +0530 | [diff] [blame] | 339 | ATH9K_INT_GENTIMER = 0x08000000, |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 340 | ATH9K_INT_CST = 0x10000000, |
| 341 | ATH9K_INT_GTT = 0x20000000, |
| 342 | ATH9K_INT_FATAL = 0x40000000, |
| 343 | ATH9K_INT_GLOBAL = 0x80000000, |
| 344 | ATH9K_INT_BMISC = ATH9K_INT_TIM | |
| 345 | ATH9K_INT_DTIM | |
| 346 | ATH9K_INT_DTIMSYNC | |
Sujith | 4af9cf4 | 2009-02-12 10:06:47 +0530 | [diff] [blame] | 347 | ATH9K_INT_TSFOOR | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 348 | ATH9K_INT_CABEND, |
| 349 | ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM | |
| 350 | ATH9K_INT_RXDESC | |
| 351 | ATH9K_INT_RXEOL | |
| 352 | ATH9K_INT_RXORN | |
| 353 | ATH9K_INT_TXURN | |
| 354 | ATH9K_INT_TXDESC | |
| 355 | ATH9K_INT_MIB | |
| 356 | ATH9K_INT_RXPHY | |
| 357 | ATH9K_INT_RXKCM | |
| 358 | ATH9K_INT_SWBA | |
| 359 | ATH9K_INT_BMISS | |
| 360 | ATH9K_INT_GPIO, |
| 361 | ATH9K_INT_NOCARD = 0xffffffff |
| 362 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 363 | |
Rajkumar Manoharan | 324c74a | 2011-10-13 11:00:41 +0530 | [diff] [blame] | 364 | #define MAX_RTT_TABLE_ENTRY 6 |
Rajkumar Manoharan | 5f0c04e | 2011-10-13 11:00:35 +0530 | [diff] [blame] | 365 | #define MAX_IQCAL_MEASUREMENT 8 |
Rajkumar Manoharan | 77a5a66 | 2011-10-13 11:00:37 +0530 | [diff] [blame] | 366 | #define MAX_CL_TAB_ENTRY 16 |
Sujith Manoharan | 96da6fd | 2013-01-07 14:43:33 +0530 | [diff] [blame] | 367 | #define CL_TAB_ENTRY(reg_base) (reg_base + (4 * j)) |
Rajkumar Manoharan | 5f0c04e | 2011-10-13 11:00:35 +0530 | [diff] [blame] | 368 | |
Sujith Manoharan | 4b9b42b | 2013-09-11 16:36:31 +0530 | [diff] [blame] | 369 | enum ath9k_cal_flags { |
| 370 | RTT_DONE, |
| 371 | PAPRD_PACKET_SENT, |
| 372 | PAPRD_DONE, |
| 373 | NFCAL_PENDING, |
| 374 | NFCAL_INTF, |
| 375 | TXIQCAL_DONE, |
| 376 | TXCLCAL_DONE, |
Sujith Manoharan | 3001f0d | 2013-09-11 16:36:32 +0530 | [diff] [blame] | 377 | SW_PKDET_DONE, |
Sujith Manoharan | 4b9b42b | 2013-09-11 16:36:31 +0530 | [diff] [blame] | 378 | }; |
| 379 | |
Felix Fietkau | 20bd2a0 | 2010-07-31 00:12:00 +0200 | [diff] [blame] | 380 | struct ath9k_hw_cal_data { |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 381 | u16 channel; |
Felix Fietkau | 6b21fd2 | 2013-10-11 23:30:56 +0200 | [diff] [blame] | 382 | u16 channelFlags; |
Sujith Manoharan | 4b9b42b | 2013-09-11 16:36:31 +0530 | [diff] [blame] | 383 | unsigned long cal_flags; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 384 | int32_t CalValid; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 385 | int8_t iCoff; |
| 386 | int8_t qCoff; |
Sujith Manoharan | 3001f0d | 2013-09-11 16:36:32 +0530 | [diff] [blame] | 387 | u8 caldac[2]; |
Felix Fietkau | 717f6be | 2010-06-12 00:34:00 -0400 | [diff] [blame] | 388 | u16 small_signal_gain[AR9300_MAX_CHAINS]; |
| 389 | u32 pa_table[AR9300_MAX_CHAINS][PAPRD_TABLE_SZ]; |
Rajkumar Manoharan | 5f0c04e | 2011-10-13 11:00:35 +0530 | [diff] [blame] | 390 | u32 num_measures[AR9300_MAX_CHAINS]; |
| 391 | int tx_corr_coeff[MAX_IQCAL_MEASUREMENT][AR9300_MAX_CHAINS]; |
Rajkumar Manoharan | 77a5a66 | 2011-10-13 11:00:37 +0530 | [diff] [blame] | 392 | u32 tx_clcal[AR9300_MAX_CHAINS][MAX_CL_TAB_ENTRY]; |
Sujith Manoharan | 8a90555 | 2012-05-04 13:23:59 +0530 | [diff] [blame] | 393 | u32 rtt_table[AR9300_MAX_CHAINS][MAX_RTT_TABLE_ENTRY]; |
Felix Fietkau | 20bd2a0 | 2010-07-31 00:12:00 +0200 | [diff] [blame] | 394 | struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; |
| 395 | }; |
| 396 | |
| 397 | struct ath9k_channel { |
| 398 | struct ieee80211_channel *chan; |
| 399 | u16 channel; |
Felix Fietkau | 6b21fd2 | 2013-10-11 23:30:56 +0200 | [diff] [blame] | 400 | u16 channelFlags; |
Felix Fietkau | d9891c7 | 2010-09-29 17:15:27 +0200 | [diff] [blame] | 401 | s16 noisefloor; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 402 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 403 | |
Felix Fietkau | 6b21fd2 | 2013-10-11 23:30:56 +0200 | [diff] [blame] | 404 | #define CHANNEL_5GHZ BIT(0) |
| 405 | #define CHANNEL_HALF BIT(1) |
| 406 | #define CHANNEL_QUARTER BIT(2) |
| 407 | #define CHANNEL_HT BIT(3) |
| 408 | #define CHANNEL_HT40PLUS BIT(4) |
| 409 | #define CHANNEL_HT40MINUS BIT(5) |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 410 | |
Felix Fietkau | 6b21fd2 | 2013-10-11 23:30:56 +0200 | [diff] [blame] | 411 | #define IS_CHAN_5GHZ(_c) (!!((_c)->channelFlags & CHANNEL_5GHZ)) |
| 412 | #define IS_CHAN_2GHZ(_c) (!IS_CHAN_5GHZ(_c)) |
| 413 | |
| 414 | #define IS_CHAN_HALF_RATE(_c) (!!((_c)->channelFlags & CHANNEL_HALF)) |
| 415 | #define IS_CHAN_QUARTER_RATE(_c) (!!((_c)->channelFlags & CHANNEL_QUARTER)) |
| 416 | #define IS_CHAN_A_FAST_CLOCK(_ah, _c) \ |
| 417 | (IS_CHAN_5GHZ(_c) && ((_ah)->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK)) |
| 418 | |
| 419 | #define IS_CHAN_HT(_c) ((_c)->channelFlags & CHANNEL_HT) |
| 420 | |
| 421 | #define IS_CHAN_HT20(_c) (IS_CHAN_HT(_c) && !IS_CHAN_HT40(_c)) |
| 422 | |
| 423 | #define IS_CHAN_HT40(_c) \ |
| 424 | (!!((_c)->channelFlags & (CHANNEL_HT40PLUS | CHANNEL_HT40MINUS))) |
| 425 | |
| 426 | #define IS_CHAN_HT40PLUS(_c) ((_c)->channelFlags & CHANNEL_HT40PLUS) |
| 427 | #define IS_CHAN_HT40MINUS(_c) ((_c)->channelFlags & CHANNEL_HT40MINUS) |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 428 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 429 | enum ath9k_power_mode { |
| 430 | ATH9K_PM_AWAKE = 0, |
| 431 | ATH9K_PM_FULL_SLEEP, |
| 432 | ATH9K_PM_NETWORK_SLEEP, |
| 433 | ATH9K_PM_UNDEFINED |
| 434 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 435 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 436 | enum ser_reg_mode { |
| 437 | SER_REG_MODE_OFF = 0, |
| 438 | SER_REG_MODE_ON = 1, |
| 439 | SER_REG_MODE_AUTO = 2, |
| 440 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 441 | |
Vasanthakumar Thiagarajan | ad7b806 | 2010-04-15 17:38:28 -0400 | [diff] [blame] | 442 | enum ath9k_rx_qtype { |
| 443 | ATH9K_RX_QUEUE_HP, |
| 444 | ATH9K_RX_QUEUE_LP, |
| 445 | ATH9K_RX_QUEUE_MAX, |
| 446 | }; |
| 447 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 448 | struct ath9k_beacon_state { |
| 449 | u32 bs_nexttbtt; |
| 450 | u32 bs_nextdtim; |
| 451 | u32 bs_intval; |
Sujith | 4af9cf4 | 2009-02-12 10:06:47 +0530 | [diff] [blame] | 452 | #define ATH9K_TSFOOR_THRESHOLD 0x00004240 /* 16k us */ |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 453 | u32 bs_dtimperiod; |
| 454 | u16 bs_cfpperiod; |
| 455 | u16 bs_cfpmaxduration; |
| 456 | u32 bs_cfpnext; |
| 457 | u16 bs_timoffset; |
| 458 | u16 bs_bmissthreshold; |
| 459 | u32 bs_sleepduration; |
Sujith | 4af9cf4 | 2009-02-12 10:06:47 +0530 | [diff] [blame] | 460 | u32 bs_tsfoor_threshold; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 461 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 462 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 463 | struct chan_centers { |
| 464 | u16 synth_center; |
| 465 | u16 ctl_center; |
| 466 | u16 ext_center; |
| 467 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 468 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 469 | enum { |
| 470 | ATH9K_RESET_POWER_ON, |
| 471 | ATH9K_RESET_WARM, |
| 472 | ATH9K_RESET_COLD, |
| 473 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 474 | |
Sujith | d535a42 | 2009-02-09 13:27:06 +0530 | [diff] [blame] | 475 | struct ath9k_hw_version { |
| 476 | u32 magic; |
| 477 | u16 devid; |
| 478 | u16 subvendorid; |
| 479 | u32 macVersion; |
| 480 | u16 macRev; |
| 481 | u16 phyRev; |
| 482 | u16 analog5GhzRev; |
| 483 | u16 analog2GhzRev; |
Sujith Manoharan | 0b5ead9 | 2010-12-07 16:31:38 +0530 | [diff] [blame] | 484 | enum ath_usb_dev usbdev; |
Sujith | d535a42 | 2009-02-09 13:27:06 +0530 | [diff] [blame] | 485 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 486 | |
Vasanthakumar Thiagarajan | ff155a4 | 2009-08-26 21:08:49 +0530 | [diff] [blame] | 487 | /* Generic TSF timer definitions */ |
| 488 | |
| 489 | #define ATH_MAX_GEN_TIMER 16 |
| 490 | |
| 491 | #define AR_GENTMR_BIT(_index) (1 << (_index)) |
| 492 | |
Vasanthakumar Thiagarajan | ff155a4 | 2009-08-26 21:08:49 +0530 | [diff] [blame] | 493 | struct ath_gen_timer_configuration { |
| 494 | u32 next_addr; |
| 495 | u32 period_addr; |
| 496 | u32 mode_addr; |
| 497 | u32 mode_mask; |
| 498 | }; |
| 499 | |
| 500 | struct ath_gen_timer { |
| 501 | void (*trigger)(void *arg); |
| 502 | void (*overflow)(void *arg); |
| 503 | void *arg; |
| 504 | u8 index; |
| 505 | }; |
| 506 | |
| 507 | struct ath_gen_timer_table { |
Vasanthakumar Thiagarajan | ff155a4 | 2009-08-26 21:08:49 +0530 | [diff] [blame] | 508 | struct ath_gen_timer *timers[ATH_MAX_GEN_TIMER]; |
Felix Fietkau | c67ce33 | 2013-12-14 18:03:38 +0100 | [diff] [blame] | 509 | u16 timer_mask; |
Vasanthakumar Thiagarajan | ff155a4 | 2009-08-26 21:08:49 +0530 | [diff] [blame] | 510 | }; |
| 511 | |
Vasanthakumar Thiagarajan | 21cc630 | 2010-09-02 01:34:42 -0700 | [diff] [blame] | 512 | struct ath_hw_antcomb_conf { |
| 513 | u8 main_lna_conf; |
| 514 | u8 alt_lna_conf; |
| 515 | u8 fast_div_bias; |
Mohammed Shafi Shajakhan | c6ba9fe | 2011-05-13 20:29:53 +0530 | [diff] [blame] | 516 | u8 main_gaintb; |
| 517 | u8 alt_gaintb; |
| 518 | int lna1_lna2_delta; |
Sujith Manoharan | f96bd2a | 2013-09-02 13:59:03 +0530 | [diff] [blame] | 519 | int lna1_lna2_switch_delta; |
Mohammed Shafi Shajakhan | 8afbcc8 | 2011-05-13 20:30:56 +0530 | [diff] [blame] | 520 | u8 div_group; |
Vasanthakumar Thiagarajan | 21cc630 | 2010-09-02 01:34:42 -0700 | [diff] [blame] | 521 | }; |
| 522 | |
Luis R. Rodriguez | d70357d | 2010-04-15 17:38:06 -0400 | [diff] [blame] | 523 | /** |
Felix Fietkau | 4e8c14e | 2010-11-11 03:18:38 +0100 | [diff] [blame] | 524 | * struct ath_hw_radar_conf - radar detection initialization parameters |
| 525 | * |
| 526 | * @pulse_inband: threshold for checking the ratio of in-band power |
| 527 | * to total power for short radar pulses (half dB steps) |
| 528 | * @pulse_inband_step: threshold for checking an in-band power to total |
| 529 | * power ratio increase for short radar pulses (half dB steps) |
| 530 | * @pulse_height: threshold for detecting the beginning of a short |
| 531 | * radar pulse (dB step) |
| 532 | * @pulse_rssi: threshold for detecting if a short radar pulse is |
| 533 | * gone (dB step) |
| 534 | * @pulse_maxlen: maximum pulse length (0.8 us steps) |
| 535 | * |
| 536 | * @radar_rssi: RSSI threshold for starting long radar detection (dB steps) |
| 537 | * @radar_inband: threshold for checking the ratio of in-band power |
| 538 | * to total power for long radar pulses (half dB steps) |
| 539 | * @fir_power: threshold for detecting the end of a long radar pulse (dB) |
| 540 | * |
| 541 | * @ext_channel: enable extension channel radar detection |
| 542 | */ |
| 543 | struct ath_hw_radar_conf { |
| 544 | unsigned int pulse_inband; |
| 545 | unsigned int pulse_inband_step; |
| 546 | unsigned int pulse_height; |
| 547 | unsigned int pulse_rssi; |
| 548 | unsigned int pulse_maxlen; |
| 549 | |
| 550 | unsigned int radar_rssi; |
| 551 | unsigned int radar_inband; |
| 552 | int fir_power; |
| 553 | |
| 554 | bool ext_channel; |
| 555 | }; |
| 556 | |
| 557 | /** |
Luis R. Rodriguez | d70357d | 2010-04-15 17:38:06 -0400 | [diff] [blame] | 558 | * struct ath_hw_private_ops - callbacks used internally by hardware code |
| 559 | * |
| 560 | * This structure contains private callbacks designed to only be used internally |
| 561 | * by the hardware core. |
| 562 | * |
Luis R. Rodriguez | 795f5e2 | 2010-04-15 17:39:00 -0400 | [diff] [blame] | 563 | * @init_cal_settings: setup types of calibrations supported |
| 564 | * @init_cal: starts actual calibration |
| 565 | * |
Luis R. Rodriguez | 991312d | 2010-04-15 17:39:05 -0400 | [diff] [blame] | 566 | * @init_mode_gain_regs: Initialize TX/RX gain registers |
Luis R. Rodriguez | 8fe6536 | 2010-04-15 17:38:14 -0400 | [diff] [blame] | 567 | * |
| 568 | * @rf_set_freq: change frequency |
| 569 | * @spur_mitigate_freq: spur mitigation |
Luis R. Rodriguez | 8fe6536 | 2010-04-15 17:38:14 -0400 | [diff] [blame] | 570 | * @set_rf_regs: |
Luis R. Rodriguez | 6477396 | 2010-04-15 17:38:17 -0400 | [diff] [blame] | 571 | * @compute_pll_control: compute the PLL control value to use for |
| 572 | * AR_RTC_PLL_CONTROL for a given channel |
Luis R. Rodriguez | 795f5e2 | 2010-04-15 17:39:00 -0400 | [diff] [blame] | 573 | * @setup_calibration: set up calibration |
| 574 | * @iscal_supported: used to query if a type of calibration is supported |
Luis R. Rodriguez | ac0bb76 | 2010-06-12 00:33:42 -0400 | [diff] [blame] | 575 | * |
Luis R. Rodriguez | e36b27a | 2010-06-12 00:33:45 -0400 | [diff] [blame] | 576 | * @ani_cache_ini_regs: cache the values for ANI from the initial |
| 577 | * register settings through the register initialization. |
Luis R. Rodriguez | d70357d | 2010-04-15 17:38:06 -0400 | [diff] [blame] | 578 | */ |
| 579 | struct ath_hw_private_ops { |
Luis R. Rodriguez | 795f5e2 | 2010-04-15 17:39:00 -0400 | [diff] [blame] | 580 | /* Calibration ops */ |
Luis R. Rodriguez | d70357d | 2010-04-15 17:38:06 -0400 | [diff] [blame] | 581 | void (*init_cal_settings)(struct ath_hw *ah); |
Luis R. Rodriguez | 795f5e2 | 2010-04-15 17:39:00 -0400 | [diff] [blame] | 582 | bool (*init_cal)(struct ath_hw *ah, struct ath9k_channel *chan); |
| 583 | |
Luis R. Rodriguez | 991312d | 2010-04-15 17:39:05 -0400 | [diff] [blame] | 584 | void (*init_mode_gain_regs)(struct ath_hw *ah); |
Luis R. Rodriguez | 795f5e2 | 2010-04-15 17:39:00 -0400 | [diff] [blame] | 585 | void (*setup_calibration)(struct ath_hw *ah, |
| 586 | struct ath9k_cal_list *currCal); |
Luis R. Rodriguez | 8fe6536 | 2010-04-15 17:38:14 -0400 | [diff] [blame] | 587 | |
| 588 | /* PHY ops */ |
| 589 | int (*rf_set_freq)(struct ath_hw *ah, |
| 590 | struct ath9k_channel *chan); |
| 591 | void (*spur_mitigate_freq)(struct ath_hw *ah, |
| 592 | struct ath9k_channel *chan); |
Luis R. Rodriguez | 8fe6536 | 2010-04-15 17:38:14 -0400 | [diff] [blame] | 593 | bool (*set_rf_regs)(struct ath_hw *ah, |
| 594 | struct ath9k_channel *chan, |
| 595 | u16 modesIndex); |
| 596 | void (*set_channel_regs)(struct ath_hw *ah, struct ath9k_channel *chan); |
| 597 | void (*init_bb)(struct ath_hw *ah, |
| 598 | struct ath9k_channel *chan); |
| 599 | int (*process_ini)(struct ath_hw *ah, struct ath9k_channel *chan); |
| 600 | void (*olc_init)(struct ath_hw *ah); |
| 601 | void (*set_rfmode)(struct ath_hw *ah, struct ath9k_channel *chan); |
| 602 | void (*mark_phy_inactive)(struct ath_hw *ah); |
| 603 | void (*set_delta_slope)(struct ath_hw *ah, struct ath9k_channel *chan); |
| 604 | bool (*rfbus_req)(struct ath_hw *ah); |
| 605 | void (*rfbus_done)(struct ath_hw *ah); |
Luis R. Rodriguez | 8fe6536 | 2010-04-15 17:38:14 -0400 | [diff] [blame] | 606 | void (*restore_chainmask)(struct ath_hw *ah); |
Luis R. Rodriguez | 6477396 | 2010-04-15 17:38:17 -0400 | [diff] [blame] | 607 | u32 (*compute_pll_control)(struct ath_hw *ah, |
| 608 | struct ath9k_channel *chan); |
Felix Fietkau | c16fcb4 | 2010-04-15 17:38:39 -0400 | [diff] [blame] | 609 | bool (*ani_control)(struct ath_hw *ah, enum ath9k_ani_cmd cmd, |
| 610 | int param); |
Felix Fietkau | 641d992 | 2010-04-15 17:38:49 -0400 | [diff] [blame] | 611 | void (*do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS]); |
Felix Fietkau | 4e8c14e | 2010-11-11 03:18:38 +0100 | [diff] [blame] | 612 | void (*set_radar_params)(struct ath_hw *ah, |
| 613 | struct ath_hw_radar_conf *conf); |
Rajkumar Manoharan | 5f0c04e | 2011-10-13 11:00:35 +0530 | [diff] [blame] | 614 | int (*fast_chan_change)(struct ath_hw *ah, struct ath9k_channel *chan, |
| 615 | u8 *ini_reloaded); |
Luis R. Rodriguez | ac0bb76 | 2010-06-12 00:33:42 -0400 | [diff] [blame] | 616 | |
| 617 | /* ANI */ |
Luis R. Rodriguez | e36b27a | 2010-06-12 00:33:45 -0400 | [diff] [blame] | 618 | void (*ani_cache_ini_regs)(struct ath_hw *ah); |
Luis R. Rodriguez | d70357d | 2010-04-15 17:38:06 -0400 | [diff] [blame] | 619 | }; |
| 620 | |
| 621 | /** |
Simon Wunderlich | e93d083 | 2013-01-08 14:48:58 +0100 | [diff] [blame] | 622 | * struct ath_spec_scan - parameters for Atheros spectral scan |
| 623 | * |
| 624 | * @enabled: enable/disable spectral scan |
| 625 | * @short_repeat: controls whether the chip is in spectral scan mode |
| 626 | * for 4 usec (enabled) or 204 usec (disabled) |
| 627 | * @count: number of scan results requested. There are special meanings |
| 628 | * in some chip revisions: |
| 629 | * AR92xx: highest bit set (>=128) for endless mode |
| 630 | * (spectral scan won't stopped until explicitly disabled) |
| 631 | * AR9300 and newer: 0 for endless mode |
| 632 | * @endless: true if endless mode is intended. Otherwise, count value is |
| 633 | * corrected to the next possible value. |
| 634 | * @period: time duration between successive spectral scan entry points |
| 635 | * (period*256*Tclk). Tclk = ath_common->clockrate |
| 636 | * @fft_period: PHY passes FFT frames to MAC every (fft_period+1)*4uS |
| 637 | * |
| 638 | * Note: Tclk = 40MHz or 44MHz depending upon operating mode. |
| 639 | * Typically it's 44MHz in 2/5GHz on later chips, but there's |
| 640 | * a "fast clock" check for this in 5GHz. |
| 641 | * |
| 642 | */ |
| 643 | struct ath_spec_scan { |
| 644 | bool enabled; |
| 645 | bool short_repeat; |
| 646 | bool endless; |
| 647 | u8 count; |
| 648 | u8 period; |
| 649 | u8 fft_period; |
| 650 | }; |
| 651 | |
| 652 | /** |
Luis R. Rodriguez | d70357d | 2010-04-15 17:38:06 -0400 | [diff] [blame] | 653 | * struct ath_hw_ops - callbacks used by hardware code and driver code |
| 654 | * |
| 655 | * This structure contains callbacks designed to to be used internally by |
| 656 | * hardware code and also by the lower level driver. |
| 657 | * |
| 658 | * @config_pci_powersave: |
Luis R. Rodriguez | 795f5e2 | 2010-04-15 17:39:00 -0400 | [diff] [blame] | 659 | * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC |
Simon Wunderlich | e93d083 | 2013-01-08 14:48:58 +0100 | [diff] [blame] | 660 | * |
| 661 | * @spectral_scan_config: set parameters for spectral scan and enable/disable it |
| 662 | * @spectral_scan_trigger: trigger a spectral scan run |
| 663 | * @spectral_scan_wait: wait for a spectral scan run to finish |
Luis R. Rodriguez | d70357d | 2010-04-15 17:38:06 -0400 | [diff] [blame] | 664 | */ |
| 665 | struct ath_hw_ops { |
| 666 | void (*config_pci_powersave)(struct ath_hw *ah, |
Stanislaw Gruszka | 84c87dc | 2011-08-05 13:10:32 +0200 | [diff] [blame] | 667 | bool power_off); |
Vasanthakumar Thiagarajan | cee1f62 | 2010-04-15 17:38:26 -0400 | [diff] [blame] | 668 | void (*rx_enable)(struct ath_hw *ah); |
Vasanthakumar Thiagarajan | 87d5efb | 2010-04-15 17:38:43 -0400 | [diff] [blame] | 669 | void (*set_desc_link)(void *ds, u32 link); |
Luis R. Rodriguez | 795f5e2 | 2010-04-15 17:39:00 -0400 | [diff] [blame] | 670 | bool (*calibrate)(struct ath_hw *ah, |
| 671 | struct ath9k_channel *chan, |
| 672 | u8 rxchainmask, |
| 673 | bool longcal); |
Vasanthakumar Thiagarajan | 55e82df | 2010-04-15 17:39:06 -0400 | [diff] [blame] | 674 | bool (*get_isr)(struct ath_hw *ah, enum ath9k_int *masked); |
Felix Fietkau | 2b63a41 | 2011-09-14 21:24:21 +0200 | [diff] [blame] | 675 | void (*set_txdesc)(struct ath_hw *ah, void *ds, |
| 676 | struct ath_tx_info *i); |
Vasanthakumar Thiagarajan | cc610ac0 | 2010-04-15 17:39:26 -0400 | [diff] [blame] | 677 | int (*proc_txdesc)(struct ath_hw *ah, void *ds, |
| 678 | struct ath_tx_status *ts); |
Mohammed Shafi Shajakhan | 69de372 | 2011-05-13 20:29:04 +0530 | [diff] [blame] | 679 | void (*antdiv_comb_conf_get)(struct ath_hw *ah, |
| 680 | struct ath_hw_antcomb_conf *antconf); |
| 681 | void (*antdiv_comb_conf_set)(struct ath_hw *ah, |
| 682 | struct ath_hw_antcomb_conf *antconf); |
Simon Wunderlich | e93d083 | 2013-01-08 14:48:58 +0100 | [diff] [blame] | 683 | void (*spectral_scan_config)(struct ath_hw *ah, |
| 684 | struct ath_spec_scan *param); |
| 685 | void (*spectral_scan_trigger)(struct ath_hw *ah); |
| 686 | void (*spectral_scan_wait)(struct ath_hw *ah); |
Sujith Manoharan | 36e8825 | 2013-08-06 12:44:15 +0530 | [diff] [blame] | 687 | |
Luis R. Rodriguez | 89f927a | 2013-10-14 17:42:11 -0700 | [diff] [blame] | 688 | void (*tx99_start)(struct ath_hw *ah, u32 qnum); |
| 689 | void (*tx99_stop)(struct ath_hw *ah); |
| 690 | void (*tx99_set_txpower)(struct ath_hw *ah, u8 power); |
| 691 | |
Sujith Manoharan | 36e8825 | 2013-08-06 12:44:15 +0530 | [diff] [blame] | 692 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
| 693 | void (*set_bt_ant_diversity)(struct ath_hw *hw, bool enable); |
| 694 | #endif |
Luis R. Rodriguez | d70357d | 2010-04-15 17:38:06 -0400 | [diff] [blame] | 695 | }; |
| 696 | |
Felix Fietkau | f2552e2 | 2010-07-02 00:09:50 +0200 | [diff] [blame] | 697 | struct ath_nf_limits { |
| 698 | s16 max; |
| 699 | s16 min; |
| 700 | s16 nominal; |
| 701 | }; |
| 702 | |
Rajkumar Manoharan | 8ad74c4 | 2011-10-13 11:00:38 +0530 | [diff] [blame] | 703 | enum ath_cal_list { |
| 704 | TX_IQ_CAL = BIT(0), |
| 705 | TX_IQ_ON_AGC_CAL = BIT(1), |
| 706 | TX_CL_CAL = BIT(2), |
| 707 | }; |
| 708 | |
Sujith Manoharan | 97dcec5 | 2010-12-20 08:02:42 +0530 | [diff] [blame] | 709 | /* ah_flags */ |
| 710 | #define AH_USE_EEPROM 0x1 |
| 711 | #define AH_UNPLUGGED 0x2 /* The card has been physically removed. */ |
Rajkumar Manoharan | a126ff5 | 2011-10-13 11:00:42 +0530 | [diff] [blame] | 712 | #define AH_FASTCC 0x4 |
Sujith Manoharan | 97dcec5 | 2010-12-20 08:02:42 +0530 | [diff] [blame] | 713 | |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 714 | struct ath_hw { |
Felix Fietkau | f9f84e9 | 2011-03-23 20:57:24 +0100 | [diff] [blame] | 715 | struct ath_ops reg_ops; |
| 716 | |
Felix Fietkau | c1b976d | 2012-12-12 13:14:23 +0100 | [diff] [blame] | 717 | struct device *dev; |
Luis R. Rodriguez | b002a4a | 2009-09-13 00:03:27 -0700 | [diff] [blame] | 718 | struct ieee80211_hw *hw; |
Luis R. Rodriguez | 27c51f1 | 2009-09-10 11:08:14 -0700 | [diff] [blame] | 719 | struct ath_common common; |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 720 | struct ath9k_hw_version hw_version; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 721 | struct ath9k_ops_config config; |
| 722 | struct ath9k_hw_capabilities caps; |
Felix Fietkau | cac4220 | 2010-10-09 02:39:30 +0200 | [diff] [blame] | 723 | struct ath9k_channel channels[ATH9K_NUM_CHANNELS]; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 724 | struct ath9k_channel *curchan; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 725 | |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 726 | union { |
| 727 | struct ar5416_eeprom_def def; |
| 728 | struct ar5416_eeprom_4k map4k; |
Luis R. Rodriguez | 475f598 | 2009-08-03 17:31:25 -0400 | [diff] [blame] | 729 | struct ar9287_eeprom map9287; |
Senthil Balasubramanian | 15c9ee7 | 2010-04-15 17:39:14 -0400 | [diff] [blame] | 730 | struct ar9300_eeprom ar9300_eep; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 731 | } eeprom; |
Sujith | f74df6f | 2009-02-09 13:27:24 +0530 | [diff] [blame] | 732 | const struct eeprom_ops *eep_ops; |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 733 | |
| 734 | bool sw_mgmt_crypto; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 735 | bool is_pciexpress; |
Stanislaw Gruszka | d493008 | 2011-07-29 15:59:08 +0200 | [diff] [blame] | 736 | bool aspm_enabled; |
Rajkumar Manoharan | 5f841b4 | 2010-10-27 18:31:15 +0530 | [diff] [blame] | 737 | bool is_monitoring; |
Pavel Roskin | 2eb46d9 | 2010-04-07 01:33:33 -0400 | [diff] [blame] | 738 | bool need_an_top2_fixup; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 739 | u16 tx_trig_level; |
Felix Fietkau | f2552e2 | 2010-07-02 00:09:50 +0200 | [diff] [blame] | 740 | |
Felix Fietkau | bbacee1 | 2010-07-11 15:44:42 +0200 | [diff] [blame] | 741 | u32 nf_regs[6]; |
Felix Fietkau | f2552e2 | 2010-07-02 00:09:50 +0200 | [diff] [blame] | 742 | struct ath_nf_limits nf_2g; |
| 743 | struct ath_nf_limits nf_5g; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 744 | u16 rfsilent; |
| 745 | u32 rfkill_gpio; |
| 746 | u32 rfkill_polarity; |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 747 | u32 ah_flags; |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 748 | |
Felix Fietkau | ceb26a6 | 2012-10-03 21:07:51 +0200 | [diff] [blame] | 749 | bool reset_power_on; |
Luis R. Rodriguez | d7e7d22 | 2009-08-03 23:14:12 -0400 | [diff] [blame] | 750 | bool htc_reset_init; |
| 751 | |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 752 | enum nl80211_iftype opmode; |
| 753 | enum ath9k_power_mode power_mode; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 754 | |
Felix Fietkau | f23fba49 | 2011-07-28 14:08:56 +0200 | [diff] [blame] | 755 | s8 noise; |
Felix Fietkau | 20bd2a0 | 2010-07-31 00:12:00 +0200 | [diff] [blame] | 756 | struct ath9k_hw_cal_data *caldata; |
Sujith | a13883b | 2009-08-26 08:39:40 +0530 | [diff] [blame] | 757 | struct ath9k_pacal_info pacal_info; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 758 | struct ar5416Stats stats; |
| 759 | struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES]; |
Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 760 | |
Pavel Roskin | 3069168 | 2010-03-31 18:05:31 -0400 | [diff] [blame] | 761 | enum ath9k_int imask; |
Pavel Roskin | 74bad5c | 2010-02-23 18:15:27 -0500 | [diff] [blame] | 762 | u32 imrs2_reg; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 763 | u32 txok_interrupt_mask; |
| 764 | u32 txerr_interrupt_mask; |
| 765 | u32 txdesc_interrupt_mask; |
| 766 | u32 txeol_interrupt_mask; |
| 767 | u32 txurn_interrupt_mask; |
Rajkumar Manoharan | e8fe733 | 2011-08-05 18:59:41 +0530 | [diff] [blame] | 768 | atomic_t intr_ref_cnt; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 769 | bool chip_fullsleep; |
Rajkumar Manoharan | 5f0c04e | 2011-10-13 11:00:35 +0530 | [diff] [blame] | 770 | u32 modes_index; |
Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 771 | |
| 772 | /* Calibration */ |
Felix Fietkau | 6497827 | 2010-10-03 19:07:16 +0200 | [diff] [blame] | 773 | u32 supp_cals; |
Sujith | cbfe946 | 2009-04-13 21:56:56 +0530 | [diff] [blame] | 774 | struct ath9k_cal_list iq_caldata; |
| 775 | struct ath9k_cal_list adcgain_caldata; |
Sujith | cbfe946 | 2009-04-13 21:56:56 +0530 | [diff] [blame] | 776 | struct ath9k_cal_list adcdc_caldata; |
| 777 | struct ath9k_cal_list *cal_list; |
| 778 | struct ath9k_cal_list *cal_list_last; |
| 779 | struct ath9k_cal_list *cal_list_curr; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 780 | #define totalPowerMeasI meas0.unsign |
| 781 | #define totalPowerMeasQ meas1.unsign |
| 782 | #define totalIqCorrMeas meas2.sign |
| 783 | #define totalAdcIOddPhase meas0.unsign |
| 784 | #define totalAdcIEvenPhase meas1.unsign |
| 785 | #define totalAdcQOddPhase meas2.unsign |
| 786 | #define totalAdcQEvenPhase meas3.unsign |
| 787 | #define totalAdcDcOffsetIOddPhase meas0.sign |
| 788 | #define totalAdcDcOffsetIEvenPhase meas1.sign |
| 789 | #define totalAdcDcOffsetQOddPhase meas2.sign |
| 790 | #define totalAdcDcOffsetQEvenPhase meas3.sign |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 791 | union { |
| 792 | u32 unsign[AR5416_MAX_CHAINS]; |
| 793 | int32_t sign[AR5416_MAX_CHAINS]; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 794 | } meas0; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 795 | union { |
| 796 | u32 unsign[AR5416_MAX_CHAINS]; |
| 797 | int32_t sign[AR5416_MAX_CHAINS]; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 798 | } meas1; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 799 | union { |
| 800 | u32 unsign[AR5416_MAX_CHAINS]; |
| 801 | int32_t sign[AR5416_MAX_CHAINS]; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 802 | } meas2; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 803 | union { |
| 804 | u32 unsign[AR5416_MAX_CHAINS]; |
| 805 | int32_t sign[AR5416_MAX_CHAINS]; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 806 | } meas3; |
| 807 | u16 cal_samples; |
Rajkumar Manoharan | 8ad74c4 | 2011-10-13 11:00:38 +0530 | [diff] [blame] | 808 | u8 enabled_cals; |
Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 809 | |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 810 | u32 sta_id1_defaults; |
| 811 | u32 misc_mode; |
Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 812 | |
Luis R. Rodriguez | d70357d | 2010-04-15 17:38:06 -0400 | [diff] [blame] | 813 | /* Private to hardware code */ |
| 814 | struct ath_hw_private_ops private_ops; |
| 815 | /* Accessed by the lower level driver */ |
| 816 | struct ath_hw_ops ops; |
| 817 | |
Luis R. Rodriguez | e68a060 | 2009-10-19 02:33:41 -0400 | [diff] [blame] | 818 | /* Used to program the radio on non single-chip devices */ |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 819 | u32 *analogBank6Data; |
Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 820 | |
Felix Fietkau | e239d85 | 2010-01-15 02:34:58 +0100 | [diff] [blame] | 821 | int coverage_class; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 822 | u32 slottime; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 823 | u32 globaltxtimeout; |
Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 824 | |
| 825 | /* ANI */ |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 826 | u32 aniperiod; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 827 | enum ath9k_ani_cmd ani_function; |
Rajkumar Manoharan | 424749c | 2012-10-10 23:03:02 +0530 | [diff] [blame] | 828 | u32 ani_skip_count; |
Sujith Manoharan | c24bd36 | 2013-06-03 09:19:29 +0530 | [diff] [blame] | 829 | struct ar5416AniState ani; |
Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 830 | |
Sujith Manoharan | dbccdd1 | 2012-02-22 17:55:47 +0530 | [diff] [blame] | 831 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
Luis R. Rodriguez | 766ec4a | 2009-09-09 14:52:02 -0700 | [diff] [blame] | 832 | struct ath_btcoex_hw btcoex_hw; |
Sujith Manoharan | dbccdd1 | 2012-02-22 17:55:47 +0530 | [diff] [blame] | 833 | #endif |
Luis R. Rodriguez | af03abe | 2009-09-09 02:33:11 -0700 | [diff] [blame] | 834 | |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 835 | u32 intr_txqs; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 836 | u8 txchainmask; |
| 837 | u8 rxchainmask; |
Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 838 | |
Felix Fietkau | c5d0855 | 2010-11-13 20:22:41 +0100 | [diff] [blame] | 839 | struct ath_hw_radar_conf radar_conf; |
| 840 | |
Senthil Balasubramanian | 8bd1d07 | 2009-02-12 13:57:03 +0530 | [diff] [blame] | 841 | u32 originalGain[22]; |
| 842 | int initPDADC; |
| 843 | int PDADCdelta; |
Felix Fietkau | 6de66dd | 2011-03-19 13:55:40 +0100 | [diff] [blame] | 844 | int led_pin; |
Felix Fietkau | 691680b | 2011-03-19 13:55:38 +0100 | [diff] [blame] | 845 | u32 gpio_mask; |
| 846 | u32 gpio_val; |
Senthil Balasubramanian | 8bd1d07 | 2009-02-12 13:57:03 +0530 | [diff] [blame] | 847 | |
Sujith Manoharan | 4a878b9 | 2013-12-06 16:28:40 +0530 | [diff] [blame] | 848 | struct ar5416IniArray ini_dfs; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 849 | struct ar5416IniArray iniModes; |
| 850 | struct ar5416IniArray iniCommon; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 851 | struct ar5416IniArray iniBB_RfGain; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 852 | struct ar5416IniArray iniBank6; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 853 | struct ar5416IniArray iniAddac; |
| 854 | struct ar5416IniArray iniPcieSerdes; |
Luis R. Rodriguez | 13ce3e9 | 2010-04-15 17:38:37 -0400 | [diff] [blame] | 855 | struct ar5416IniArray iniPcieSerdesLowPower; |
Felix Fietkau | c7d36f9 | 2012-03-14 16:40:31 +0100 | [diff] [blame] | 856 | struct ar5416IniArray iniModesFastClock; |
| 857 | struct ar5416IniArray iniAdditional; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 858 | struct ar5416IniArray iniModesRxGain; |
Gabor Juhos | 8bc45c6 | 2012-07-03 19:13:23 +0200 | [diff] [blame] | 859 | struct ar5416IniArray ini_modes_rx_gain_bounds; |
Sujith | 2660b81 | 2009-02-09 13:27:26 +0530 | [diff] [blame] | 860 | struct ar5416IniArray iniModesTxGain; |
Sujith | 193cd45 | 2009-09-18 15:04:07 +0530 | [diff] [blame] | 861 | struct ar5416IniArray iniCckfirNormal; |
| 862 | struct ar5416IniArray iniCckfirJapan2484; |
Sujith | 70807e9 | 2010-03-17 14:25:14 +0530 | [diff] [blame] | 863 | struct ar5416IniArray iniModes_9271_ANI_reg; |
Senthil Balasubramanian | ce407af | 2011-09-13 22:38:16 +0530 | [diff] [blame] | 864 | struct ar5416IniArray ini_radio_post_sys2ant; |
Sujith Manoharan | 51dbd0a | 2013-06-18 10:13:42 +0530 | [diff] [blame] | 865 | struct ar5416IniArray ini_modes_rxgain_5g_xlna; |
Sujith Manoharan | c177fab | 2013-06-18 15:42:38 +0530 | [diff] [blame] | 866 | struct ar5416IniArray ini_modes_rxgain_bb_core; |
| 867 | struct ar5416IniArray ini_modes_rxgain_bb_postamble; |
Vasanthakumar Thiagarajan | ff155a4 | 2009-08-26 21:08:49 +0530 | [diff] [blame] | 868 | |
Luis R. Rodriguez | 13ce3e9 | 2010-04-15 17:38:37 -0400 | [diff] [blame] | 869 | struct ar5416IniArray iniMac[ATH_INI_NUM_SPLIT]; |
| 870 | struct ar5416IniArray iniBB[ATH_INI_NUM_SPLIT]; |
| 871 | struct ar5416IniArray iniRadio[ATH_INI_NUM_SPLIT]; |
| 872 | struct ar5416IniArray iniSOC[ATH_INI_NUM_SPLIT]; |
| 873 | |
Vasanthakumar Thiagarajan | ff155a4 | 2009-08-26 21:08:49 +0530 | [diff] [blame] | 874 | u32 intr_gen_timer_trigger; |
| 875 | u32 intr_gen_timer_thresh; |
| 876 | struct ath_gen_timer_table hw_gen_timers; |
Vasanthakumar Thiagarajan | 744d402 | 2010-04-15 17:39:27 -0400 | [diff] [blame] | 877 | |
| 878 | struct ar9003_txs *ts_ring; |
Vasanthakumar Thiagarajan | 744d402 | 2010-04-15 17:39:27 -0400 | [diff] [blame] | 879 | u32 ts_paddr_start; |
| 880 | u32 ts_paddr_end; |
| 881 | u16 ts_tail; |
Rajkumar Manoharan | 016c217 | 2011-12-23 21:27:02 +0530 | [diff] [blame] | 882 | u16 ts_size; |
Luis R. Rodriguez | aea702b | 2010-05-13 13:33:43 -0400 | [diff] [blame] | 883 | |
| 884 | u32 bb_watchdog_last_status; |
| 885 | u32 bb_watchdog_timeout_ms; /* in ms, 0 to disable */ |
Rajkumar Manoharan | 51ac8cb | 2011-05-20 17:52:13 +0530 | [diff] [blame] | 886 | u8 bb_hang_rx_ofdm; /* true if bb hang due to rx_ofdm */ |
Felix Fietkau | 717f6be | 2010-06-12 00:34:00 -0400 | [diff] [blame] | 887 | |
Felix Fietkau | 1bf3866 | 2010-12-13 08:40:54 +0100 | [diff] [blame] | 888 | unsigned int paprd_target_power; |
| 889 | unsigned int paprd_training_power; |
Vasanthakumar Thiagarajan | 7072bf6 | 2010-12-15 07:30:52 -0800 | [diff] [blame] | 890 | unsigned int paprd_ratemask; |
Felix Fietkau | f1a8abb | 2010-12-19 00:31:54 +0100 | [diff] [blame] | 891 | unsigned int paprd_ratemask_ht40; |
Vasanthakumar Thiagarajan | 45ef6a0b | 2010-12-15 07:30:53 -0800 | [diff] [blame] | 892 | bool paprd_table_write_done; |
Felix Fietkau | 717f6be | 2010-06-12 00:34:00 -0400 | [diff] [blame] | 893 | u32 paprd_gain_table_entries[PAPRD_GAIN_TABLE_ENTRIES]; |
| 894 | u8 paprd_gain_table_index[PAPRD_GAIN_TABLE_ENTRIES]; |
Luis R. Rodriguez | 9a658d2 | 2010-06-21 18:38:47 -0400 | [diff] [blame] | 895 | /* |
| 896 | * Store the permanent value of Reg 0x4004in WARegVal |
| 897 | * so we dont have to R/M/W. We should not be reading |
| 898 | * this register when in sleep states. |
| 899 | */ |
| 900 | u32 WARegVal; |
Senthil Balasubramanian | 6ee63f5 | 2010-11-10 05:03:16 -0800 | [diff] [blame] | 901 | |
| 902 | /* Enterprise mode cap */ |
| 903 | u32 ent_mode; |
Vasanthakumar Thiagarajan | f2f5f2a | 2011-04-19 19:29:01 +0530 | [diff] [blame] | 904 | |
Sujith Manoharan | e60001e | 2013-10-28 12:22:04 +0530 | [diff] [blame] | 905 | #ifdef CONFIG_ATH9K_WOW |
Mohammed Shafi Shajakhan | 01c7853 | 2012-07-10 14:54:34 +0530 | [diff] [blame] | 906 | u32 wow_event_mask; |
| 907 | #endif |
Vasanthakumar Thiagarajan | f2f5f2a | 2011-04-19 19:29:01 +0530 | [diff] [blame] | 908 | bool is_clk_25mhz; |
Gabor Juhos | 3762561 | 2011-06-21 11:23:23 +0200 | [diff] [blame] | 909 | int (*get_mac_revision)(void); |
Gabor Juhos | 7d95847c | 2011-06-21 11:23:51 +0200 | [diff] [blame] | 910 | int (*external_reset)(void); |
Gabor Juhos | ab5c4f7 | 2012-12-10 15:30:28 +0100 | [diff] [blame] | 911 | |
| 912 | const struct firmware *eeprom_blob; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 913 | }; |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 914 | |
Felix Fietkau | 0cb9e06 | 2011-04-13 21:56:43 +0200 | [diff] [blame] | 915 | struct ath_bus_ops { |
| 916 | enum ath_bus_type ath_bus_type; |
| 917 | void (*read_cachesize)(struct ath_common *common, int *csz); |
| 918 | bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data); |
| 919 | void (*bt_coex_prep)(struct ath_common *common); |
Stanislaw Gruszka | d493008 | 2011-07-29 15:59:08 +0200 | [diff] [blame] | 920 | void (*aspm_init)(struct ath_common *common); |
Felix Fietkau | 0cb9e06 | 2011-04-13 21:56:43 +0200 | [diff] [blame] | 921 | }; |
| 922 | |
Luis R. Rodriguez | 9e4bffd | 2009-09-10 16:11:21 -0700 | [diff] [blame] | 923 | static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) |
| 924 | { |
| 925 | return &ah->common; |
| 926 | } |
| 927 | |
| 928 | static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah) |
| 929 | { |
| 930 | return &(ath9k_hw_common(ah)->regulatory); |
| 931 | } |
| 932 | |
Luis R. Rodriguez | d70357d | 2010-04-15 17:38:06 -0400 | [diff] [blame] | 933 | static inline struct ath_hw_private_ops *ath9k_hw_private_ops(struct ath_hw *ah) |
| 934 | { |
| 935 | return &ah->private_ops; |
| 936 | } |
| 937 | |
| 938 | static inline struct ath_hw_ops *ath9k_hw_ops(struct ath_hw *ah) |
| 939 | { |
| 940 | return &ah->ops; |
| 941 | } |
| 942 | |
Vasanthakumar Thiagarajan | 895ad7e | 2010-12-15 07:30:49 -0800 | [diff] [blame] | 943 | static inline u8 get_streams(int mask) |
| 944 | { |
| 945 | return !!(mask & BIT(0)) + !!(mask & BIT(1)) + !!(mask & BIT(2)); |
| 946 | } |
| 947 | |
Luis R. Rodriguez | f637cfd | 2009-08-03 12:24:46 -0700 | [diff] [blame] | 948 | /* Initialization, Detach, Reset */ |
Sujith | 285f2dd | 2010-01-08 10:36:07 +0530 | [diff] [blame] | 949 | void ath9k_hw_deinit(struct ath_hw *ah); |
Luis R. Rodriguez | f637cfd | 2009-08-03 12:24:46 -0700 | [diff] [blame] | 950 | int ath9k_hw_init(struct ath_hw *ah); |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 951 | int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, |
Sujith Manoharan | caed657 | 2012-03-14 14:40:46 +0530 | [diff] [blame] | 952 | struct ath9k_hw_cal_data *caldata, bool fastcc); |
Gabor Juhos | a9a29ce | 2009-11-27 12:01:35 +0100 | [diff] [blame] | 953 | int ath9k_hw_fill_cap_info(struct ath_hw *ah); |
Luis R. Rodriguez | 8fe6536 | 2010-04-15 17:38:14 -0400 | [diff] [blame] | 954 | u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan); |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 955 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 956 | /* GPIO / RFKILL / Antennae */ |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 957 | void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio); |
| 958 | u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio); |
| 959 | void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 960 | u32 ah_signal_type); |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 961 | void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 962 | void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 963 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 964 | /* General Operation */ |
Felix Fietkau | 7c5adc8 | 2012-04-19 21:18:26 +0200 | [diff] [blame] | 965 | void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan, |
| 966 | int hw_delay); |
Sujith | 0caa7b1 | 2009-02-16 13:23:20 +0530 | [diff] [blame] | 967 | bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); |
Felix Fietkau | 0166b4b | 2013-01-20 18:51:55 +0100 | [diff] [blame] | 968 | void ath9k_hw_write_array(struct ath_hw *ah, const struct ar5416IniArray *array, |
Felix Fietkau | a9b6b25 | 2011-03-23 20:57:27 +0100 | [diff] [blame] | 969 | int column, unsigned int *writecnt); |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 970 | u32 ath9k_hw_reverse_bits(u32 val, u32 n); |
Luis R. Rodriguez | 4f0fc7c | 2009-05-06 02:20:00 -0400 | [diff] [blame] | 971 | u16 ath9k_hw_computetxtime(struct ath_hw *ah, |
Felix Fietkau | 545750d | 2009-11-23 22:21:01 +0100 | [diff] [blame] | 972 | u8 phy, int kbps, |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 973 | u32 frameLen, u16 rateix, bool shortPreamble); |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 974 | void ath9k_hw_get_channel_centers(struct ath_hw *ah, |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 975 | struct ath9k_channel *chan, |
| 976 | struct chan_centers *centers); |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 977 | u32 ath9k_hw_getrxfilter(struct ath_hw *ah); |
| 978 | void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits); |
| 979 | bool ath9k_hw_phy_disable(struct ath_hw *ah); |
| 980 | bool ath9k_hw_disable(struct ath_hw *ah); |
Felix Fietkau | de40f31 | 2010-10-20 03:08:53 +0200 | [diff] [blame] | 981 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test); |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 982 | void ath9k_hw_setopmode(struct ath_hw *ah); |
| 983 | void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); |
Luis R. Rodriguez | f2b2143 | 2009-09-10 08:50:20 -0700 | [diff] [blame] | 984 | void ath9k_hw_write_associd(struct ath_hw *ah); |
Felix Fietkau | dd347f2 | 2011-03-22 21:54:17 +0100 | [diff] [blame] | 985 | u32 ath9k_hw_gettsf32(struct ath_hw *ah); |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 986 | u64 ath9k_hw_gettsf64(struct ath_hw *ah); |
| 987 | void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); |
| 988 | void ath9k_hw_reset_tsf(struct ath_hw *ah); |
Sujith Manoharan | 60ca9f8 | 2012-07-17 17:15:37 +0530 | [diff] [blame] | 989 | void ath9k_hw_set_tsfadjust(struct ath_hw *ah, bool set); |
Felix Fietkau | 0005baf | 2010-01-15 02:33:40 +0100 | [diff] [blame] | 990 | void ath9k_hw_init_global_settings(struct ath_hw *ah); |
Senthil Balasubramanian | b84628e | 2011-04-22 11:32:12 +0530 | [diff] [blame] | 991 | u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah); |
Felix Fietkau | e4744ec | 2013-10-11 23:31:01 +0200 | [diff] [blame] | 992 | void ath9k_hw_set11nmac2040(struct ath_hw *ah, struct ath9k_channel *chan); |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 993 | void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); |
| 994 | void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 995 | const struct ath9k_beacon_state *bs); |
Sujith Manoharan | 1e516ca | 2013-09-11 21:30:27 +0530 | [diff] [blame] | 996 | void ath9k_hw_check_nav(struct ath_hw *ah); |
Felix Fietkau | c9c99e5 | 2010-04-19 19:57:29 +0200 | [diff] [blame] | 997 | bool ath9k_hw_check_alive(struct ath_hw *ah); |
Luis R. Rodriguez | a91d75a | 2009-09-09 20:29:18 -0700 | [diff] [blame] | 998 | |
Luis R. Rodriguez | 9ecdef4 | 2009-09-09 21:10:09 -0700 | [diff] [blame] | 999 | bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); |
Luis R. Rodriguez | a91d75a | 2009-09-09 20:29:18 -0700 | [diff] [blame] | 1000 | |
Ben Greear | 462e58f | 2012-04-12 10:04:00 -0700 | [diff] [blame] | 1001 | #ifdef CONFIG_ATH9K_DEBUGFS |
| 1002 | void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause); |
| 1003 | #else |
Ben Greear | 990e08a | 2012-04-17 15:19:03 -0700 | [diff] [blame] | 1004 | static inline void ath9k_debug_sync_cause(struct ath_common *common, |
| 1005 | u32 sync_cause) {} |
Ben Greear | 462e58f | 2012-04-12 10:04:00 -0700 | [diff] [blame] | 1006 | #endif |
| 1007 | |
Vasanthakumar Thiagarajan | ff155a4 | 2009-08-26 21:08:49 +0530 | [diff] [blame] | 1008 | /* Generic hw timer primitives */ |
| 1009 | struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, |
| 1010 | void (*trigger)(void *), |
| 1011 | void (*overflow)(void *), |
| 1012 | void *arg, |
| 1013 | u8 timer_index); |
Luis R. Rodriguez | cd9bf68 | 2009-09-13 02:08:34 -0700 | [diff] [blame] | 1014 | void ath9k_hw_gen_timer_start(struct ath_hw *ah, |
| 1015 | struct ath_gen_timer *timer, |
| 1016 | u32 timer_next, |
| 1017 | u32 timer_period); |
| 1018 | void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer); |
| 1019 | |
Vasanthakumar Thiagarajan | ff155a4 | 2009-08-26 21:08:49 +0530 | [diff] [blame] | 1020 | void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer); |
| 1021 | void ath_gen_timer_isr(struct ath_hw *hw); |
| 1022 | |
Luis R. Rodriguez | f934c4d | 2009-10-27 12:59:34 -0400 | [diff] [blame] | 1023 | void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len); |
Luis R. Rodriguez | 2da4f01 | 2009-10-27 12:59:33 -0400 | [diff] [blame] | 1024 | |
Luis R. Rodriguez | 8fe6536 | 2010-04-15 17:38:14 -0400 | [diff] [blame] | 1025 | /* PHY */ |
| 1026 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, |
| 1027 | u32 *coef_mantissa, u32 *coef_exponent); |
Gabor Juhos | 64ea57d | 2012-04-15 20:38:05 +0200 | [diff] [blame] | 1028 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, |
| 1029 | bool test); |
Luis R. Rodriguez | 8fe6536 | 2010-04-15 17:38:14 -0400 | [diff] [blame] | 1030 | |
Luis R. Rodriguez | ebd5a14 | 2010-04-15 17:39:18 -0400 | [diff] [blame] | 1031 | /* |
| 1032 | * Code Specific to AR5008, AR9001 or AR9002, |
| 1033 | * we stuff these here to avoid callbacks for AR9003. |
| 1034 | */ |
Luis R. Rodriguez | ebd5a14 | 2010-04-15 17:39:18 -0400 | [diff] [blame] | 1035 | int ar9002_hw_rf_claim(struct ath_hw *ah); |
Luis R. Rodriguez | 78ec267 | 2010-04-15 17:39:23 -0400 | [diff] [blame] | 1036 | void ar9002_hw_enable_async_fifo(struct ath_hw *ah); |
Luis R. Rodriguez | d8f492b | 2010-04-15 17:39:04 -0400 | [diff] [blame] | 1037 | |
Felix Fietkau | 641d992 | 2010-04-15 17:38:49 -0400 | [diff] [blame] | 1038 | /* |
Luis R. Rodriguez | aea702b | 2010-05-13 13:33:43 -0400 | [diff] [blame] | 1039 | * Code specific to AR9003, we stuff these here to avoid callbacks |
Felix Fietkau | 641d992 | 2010-04-15 17:38:49 -0400 | [diff] [blame] | 1040 | * for older families |
| 1041 | */ |
Luis R. Rodriguez | aea702b | 2010-05-13 13:33:43 -0400 | [diff] [blame] | 1042 | void ar9003_hw_bb_watchdog_config(struct ath_hw *ah); |
| 1043 | void ar9003_hw_bb_watchdog_read(struct ath_hw *ah); |
| 1044 | void ar9003_hw_bb_watchdog_dbg_info(struct ath_hw *ah); |
Rajkumar Manoharan | 51ac8cb | 2011-05-20 17:52:13 +0530 | [diff] [blame] | 1045 | void ar9003_hw_disable_phy_restart(struct ath_hw *ah); |
Felix Fietkau | 717f6be | 2010-06-12 00:34:00 -0400 | [diff] [blame] | 1046 | void ar9003_paprd_enable(struct ath_hw *ah, bool val); |
| 1047 | void ar9003_paprd_populate_single_table(struct ath_hw *ah, |
Felix Fietkau | 20bd2a0 | 2010-07-31 00:12:00 +0200 | [diff] [blame] | 1048 | struct ath9k_hw_cal_data *caldata, |
| 1049 | int chain); |
| 1050 | int ar9003_paprd_create_curve(struct ath_hw *ah, |
| 1051 | struct ath9k_hw_cal_data *caldata, int chain); |
Sujith Manoharan | 36d2943 | 2012-12-10 07:22:35 +0530 | [diff] [blame] | 1052 | void ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain); |
Felix Fietkau | 717f6be | 2010-06-12 00:34:00 -0400 | [diff] [blame] | 1053 | int ar9003_paprd_init_table(struct ath_hw *ah); |
| 1054 | bool ar9003_paprd_is_done(struct ath_hw *ah); |
Sujith Manoharan | 0f21ee8 | 2012-12-10 07:22:37 +0530 | [diff] [blame] | 1055 | bool ar9003_is_paprd_enabled(struct ath_hw *ah); |
Felix Fietkau | 4a8f199 | 2013-01-20 21:55:20 +0100 | [diff] [blame] | 1056 | void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx); |
Felix Fietkau | 641d992 | 2010-04-15 17:38:49 -0400 | [diff] [blame] | 1057 | |
| 1058 | /* Hardware family op attach helpers */ |
Felix Fietkau | c1b976d | 2012-12-12 13:14:23 +0100 | [diff] [blame] | 1059 | int ar5008_hw_attach_phy_ops(struct ath_hw *ah); |
Luis R. Rodriguez | 8525f28 | 2010-04-15 17:38:19 -0400 | [diff] [blame] | 1060 | void ar9002_hw_attach_phy_ops(struct ath_hw *ah); |
| 1061 | void ar9003_hw_attach_phy_ops(struct ath_hw *ah); |
Luis R. Rodriguez | 8fe6536 | 2010-04-15 17:38:14 -0400 | [diff] [blame] | 1062 | |
Luis R. Rodriguez | 795f5e2 | 2010-04-15 17:39:00 -0400 | [diff] [blame] | 1063 | void ar9002_hw_attach_calib_ops(struct ath_hw *ah); |
| 1064 | void ar9003_hw_attach_calib_ops(struct ath_hw *ah); |
| 1065 | |
Felix Fietkau | c1b976d | 2012-12-12 13:14:23 +0100 | [diff] [blame] | 1066 | int ar9002_hw_attach_ops(struct ath_hw *ah); |
Luis R. Rodriguez | b3950e6 | 2010-04-15 17:39:03 -0400 | [diff] [blame] | 1067 | void ar9003_hw_attach_ops(struct ath_hw *ah); |
| 1068 | |
Rajkumar Manoharan | c2ba334 | 2010-09-03 16:00:00 +0530 | [diff] [blame] | 1069 | void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan); |
Felix Fietkau | 6790ae7 | 2012-06-15 15:25:23 +0200 | [diff] [blame] | 1070 | |
Felix Fietkau | 8eb4980 | 2010-10-04 20:09:49 +0200 | [diff] [blame] | 1071 | void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning); |
Felix Fietkau | 9579217 | 2010-10-04 20:09:50 +0200 | [diff] [blame] | 1072 | void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan); |
Luis R. Rodriguez | ac0bb76 | 2010-06-12 00:33:42 -0400 | [diff] [blame] | 1073 | |
Felix Fietkau | 8a30930 | 2011-12-17 16:47:56 +0100 | [diff] [blame] | 1074 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
Sujith Manoharan | dbccdd1 | 2012-02-22 17:55:47 +0530 | [diff] [blame] | 1075 | static inline bool ath9k_hw_btcoex_is_enabled(struct ath_hw *ah) |
| 1076 | { |
| 1077 | return ah->btcoex_hw.enabled; |
| 1078 | } |
Sujith Manoharan | 5955b2b | 2012-06-04 16:27:30 +0530 | [diff] [blame] | 1079 | static inline bool ath9k_hw_mci_is_enabled(struct ath_hw *ah) |
| 1080 | { |
Rajkumar Manoharan | e1ecad7 | 2012-06-18 19:02:38 +0530 | [diff] [blame] | 1081 | return ah->common.btcoex_enabled && |
| 1082 | (ah->caps.hw_caps & ATH9K_HW_CAP_MCI); |
Sujith Manoharan | 5955b2b | 2012-06-04 16:27:30 +0530 | [diff] [blame] | 1083 | |
| 1084 | } |
Sujith Manoharan | dbccdd1 | 2012-02-22 17:55:47 +0530 | [diff] [blame] | 1085 | void ath9k_hw_btcoex_enable(struct ath_hw *ah); |
Felix Fietkau | 8a30930 | 2011-12-17 16:47:56 +0100 | [diff] [blame] | 1086 | static inline enum ath_btcoex_scheme |
| 1087 | ath9k_hw_get_btcoex_scheme(struct ath_hw *ah) |
| 1088 | { |
| 1089 | return ah->btcoex_hw.scheme; |
| 1090 | } |
| 1091 | #else |
Sujith Manoharan | dbccdd1 | 2012-02-22 17:55:47 +0530 | [diff] [blame] | 1092 | static inline bool ath9k_hw_btcoex_is_enabled(struct ath_hw *ah) |
| 1093 | { |
| 1094 | return false; |
| 1095 | } |
Sujith Manoharan | 5955b2b | 2012-06-04 16:27:30 +0530 | [diff] [blame] | 1096 | static inline bool ath9k_hw_mci_is_enabled(struct ath_hw *ah) |
| 1097 | { |
| 1098 | return false; |
| 1099 | } |
Sujith Manoharan | dbccdd1 | 2012-02-22 17:55:47 +0530 | [diff] [blame] | 1100 | static inline void ath9k_hw_btcoex_enable(struct ath_hw *ah) |
| 1101 | { |
| 1102 | } |
| 1103 | static inline enum ath_btcoex_scheme |
| 1104 | ath9k_hw_get_btcoex_scheme(struct ath_hw *ah) |
| 1105 | { |
| 1106 | return ATH_BTCOEX_CFG_NONE; |
| 1107 | } |
Sujith Manoharan | 64ab38d | 2012-02-22 12:41:52 +0530 | [diff] [blame] | 1108 | #endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ |
Felix Fietkau | 8a30930 | 2011-12-17 16:47:56 +0100 | [diff] [blame] | 1109 | |
Mohammed Shafi Shajakhan | 64875c6 | 2012-07-10 14:56:15 +0530 | [diff] [blame] | 1110 | |
Sujith Manoharan | e60001e | 2013-10-28 12:22:04 +0530 | [diff] [blame] | 1111 | #ifdef CONFIG_ATH9K_WOW |
Mohammed Shafi Shajakhan | 64875c6 | 2012-07-10 14:56:15 +0530 | [diff] [blame] | 1112 | const char *ath9k_hw_wow_event_to_string(u32 wow_event); |
| 1113 | void ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 *user_pattern, |
| 1114 | u8 *user_mask, int pattern_count, |
| 1115 | int pattern_len); |
| 1116 | u32 ath9k_hw_wow_wakeup(struct ath_hw *ah); |
| 1117 | void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable); |
| 1118 | #else |
| 1119 | static inline const char *ath9k_hw_wow_event_to_string(u32 wow_event) |
| 1120 | { |
| 1121 | return NULL; |
| 1122 | } |
| 1123 | static inline void ath9k_hw_wow_apply_pattern(struct ath_hw *ah, |
| 1124 | u8 *user_pattern, |
| 1125 | u8 *user_mask, |
| 1126 | int pattern_count, |
| 1127 | int pattern_len) |
| 1128 | { |
| 1129 | } |
| 1130 | static inline u32 ath9k_hw_wow_wakeup(struct ath_hw *ah) |
| 1131 | { |
| 1132 | return 0; |
| 1133 | } |
| 1134 | static inline void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable) |
| 1135 | { |
| 1136 | } |
| 1137 | #endif |
| 1138 | |
Luis R. Rodriguez | 7337725 | 2010-06-12 00:33:39 -0400 | [diff] [blame] | 1139 | #define ATH9K_CLOCK_RATE_CCK 22 |
| 1140 | #define ATH9K_CLOCK_RATE_5GHZ_OFDM 40 |
| 1141 | #define ATH9K_CLOCK_RATE_2GHZ_OFDM 44 |
| 1142 | #define ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM 44 |
| 1143 | |
Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 1144 | #endif |