Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [diff] [blame] | 1 | /* |
Sujith Manoharan | 5b68138 | 2011-05-17 13:36:18 +0530 | [diff] [blame] | 2 | * Copyright (c) 2008-2011 Atheros Communications Inc. |
Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [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 | |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 17 | #include <linux/slab.h> |
Vasanthakumar Thiagarajan | 582d006 | 2011-03-01 05:30:55 -0800 | [diff] [blame] | 18 | #include <linux/vmalloc.h> |
Paul Gortmaker | ee40fa0 | 2011-05-27 16:14:23 -0400 | [diff] [blame] | 19 | #include <linux/export.h> |
Gabor Juhos | 5210311 | 2009-03-06 09:57:39 +0100 | [diff] [blame] | 20 | #include <asm/unaligned.h> |
| 21 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 22 | #include "ath9k.h" |
Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [diff] [blame] | 23 | |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 24 | #define REG_WRITE_D(_ah, _reg, _val) \ |
| 25 | ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) |
| 26 | #define REG_READ_D(_ah, _reg) \ |
| 27 | ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) |
| 28 | |
Felix Fietkau | 6a4d05d | 2013-12-19 18:01:48 +0100 | [diff] [blame] | 29 | void ath9k_debug_sync_cause(struct ath_softc *sc, u32 sync_cause) |
| 30 | { |
| 31 | if (sync_cause) |
| 32 | sc->debug.stats.istats.sync_cause_all++; |
| 33 | if (sync_cause & AR_INTR_SYNC_RTC_IRQ) |
| 34 | sc->debug.stats.istats.sync_rtc_irq++; |
| 35 | if (sync_cause & AR_INTR_SYNC_MAC_IRQ) |
| 36 | sc->debug.stats.istats.sync_mac_irq++; |
| 37 | if (sync_cause & AR_INTR_SYNC_EEPROM_ILLEGAL_ACCESS) |
| 38 | sc->debug.stats.istats.eeprom_illegal_access++; |
| 39 | if (sync_cause & AR_INTR_SYNC_APB_TIMEOUT) |
| 40 | sc->debug.stats.istats.apb_timeout++; |
| 41 | if (sync_cause & AR_INTR_SYNC_PCI_MODE_CONFLICT) |
| 42 | sc->debug.stats.istats.pci_mode_conflict++; |
| 43 | if (sync_cause & AR_INTR_SYNC_HOST1_FATAL) |
| 44 | sc->debug.stats.istats.host1_fatal++; |
| 45 | if (sync_cause & AR_INTR_SYNC_HOST1_PERR) |
| 46 | sc->debug.stats.istats.host1_perr++; |
| 47 | if (sync_cause & AR_INTR_SYNC_TRCV_FIFO_PERR) |
| 48 | sc->debug.stats.istats.trcv_fifo_perr++; |
| 49 | if (sync_cause & AR_INTR_SYNC_RADM_CPL_EP) |
| 50 | sc->debug.stats.istats.radm_cpl_ep++; |
| 51 | if (sync_cause & AR_INTR_SYNC_RADM_CPL_DLLP_ABORT) |
| 52 | sc->debug.stats.istats.radm_cpl_dllp_abort++; |
| 53 | if (sync_cause & AR_INTR_SYNC_RADM_CPL_TLP_ABORT) |
| 54 | sc->debug.stats.istats.radm_cpl_tlp_abort++; |
| 55 | if (sync_cause & AR_INTR_SYNC_RADM_CPL_ECRC_ERR) |
| 56 | sc->debug.stats.istats.radm_cpl_ecrc_err++; |
| 57 | if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT) |
| 58 | sc->debug.stats.istats.radm_cpl_timeout++; |
| 59 | if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) |
| 60 | sc->debug.stats.istats.local_timeout++; |
| 61 | if (sync_cause & AR_INTR_SYNC_PM_ACCESS) |
| 62 | sc->debug.stats.istats.pm_access++; |
| 63 | if (sync_cause & AR_INTR_SYNC_MAC_AWAKE) |
| 64 | sc->debug.stats.istats.mac_awake++; |
| 65 | if (sync_cause & AR_INTR_SYNC_MAC_ASLEEP) |
| 66 | sc->debug.stats.istats.mac_asleep++; |
| 67 | if (sync_cause & AR_INTR_SYNC_MAC_SLEEP_ACCESS) |
| 68 | sc->debug.stats.istats.mac_sleep_access++; |
| 69 | } |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 70 | |
Vasanthakumar Thiagarajan | 582d006 | 2011-03-01 05:30:55 -0800 | [diff] [blame] | 71 | static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf, |
| 72 | size_t count, loff_t *ppos) |
| 73 | { |
| 74 | u8 *buf = file->private_data; |
| 75 | return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); |
| 76 | } |
| 77 | |
| 78 | static int ath9k_debugfs_release_buf(struct inode *inode, struct file *file) |
| 79 | { |
| 80 | vfree(file->private_data); |
| 81 | return 0; |
| 82 | } |
| 83 | |
Felix Fietkau | a830df0 | 2009-11-23 22:33:27 +0100 | [diff] [blame] | 84 | #ifdef CONFIG_ATH_DEBUG |
| 85 | |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 86 | static ssize_t read_file_debug(struct file *file, char __user *user_buf, |
| 87 | size_t count, loff_t *ppos) |
| 88 | { |
| 89 | struct ath_softc *sc = file->private_data; |
Luis R. Rodriguez | c46917b | 2009-09-13 02:42:02 -0700 | [diff] [blame] | 90 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 91 | char buf[32]; |
Vasanthakumar Thiagarajan | 581f725 | 2009-06-02 19:28:55 +0530 | [diff] [blame] | 92 | unsigned int len; |
| 93 | |
Dan Carpenter | 2b87f3a | 2010-05-14 15:24:37 +0200 | [diff] [blame] | 94 | len = sprintf(buf, "0x%08x\n", common->debug_mask); |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 95 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 96 | } |
| 97 | |
| 98 | static ssize_t write_file_debug(struct file *file, const char __user *user_buf, |
| 99 | size_t count, loff_t *ppos) |
| 100 | { |
| 101 | struct ath_softc *sc = file->private_data; |
Luis R. Rodriguez | c46917b | 2009-09-13 02:42:02 -0700 | [diff] [blame] | 102 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 103 | unsigned long mask; |
| 104 | char buf[32]; |
Vasanthakumar Thiagarajan | 581f725 | 2009-06-02 19:28:55 +0530 | [diff] [blame] | 105 | ssize_t len; |
| 106 | |
| 107 | len = min(count, sizeof(buf) - 1); |
| 108 | if (copy_from_user(buf, user_buf, len)) |
Dan Carpenter | 0423606 | 2010-05-14 15:25:39 +0200 | [diff] [blame] | 109 | return -EFAULT; |
Vasanthakumar Thiagarajan | 581f725 | 2009-06-02 19:28:55 +0530 | [diff] [blame] | 110 | |
| 111 | buf[len] = '\0'; |
Jingoo Han | 27d7f47 | 2013-05-31 21:24:06 +0000 | [diff] [blame] | 112 | if (kstrtoul(buf, 0, &mask)) |
Vasanthakumar Thiagarajan | 581f725 | 2009-06-02 19:28:55 +0530 | [diff] [blame] | 113 | return -EINVAL; |
| 114 | |
Luis R. Rodriguez | c46917b | 2009-09-13 02:42:02 -0700 | [diff] [blame] | 115 | common->debug_mask = mask; |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 116 | return count; |
| 117 | } |
| 118 | |
| 119 | static const struct file_operations fops_debug = { |
| 120 | .read = read_file_debug, |
| 121 | .write = write_file_debug, |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 122 | .open = simple_open, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 123 | .owner = THIS_MODULE, |
| 124 | .llseek = default_llseek, |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 125 | }; |
| 126 | |
Felix Fietkau | a830df0 | 2009-11-23 22:33:27 +0100 | [diff] [blame] | 127 | #endif |
| 128 | |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 129 | #define DMA_BUF_LEN 1024 |
| 130 | |
Felix Fietkau | 1534069 | 2010-05-11 17:23:01 +0200 | [diff] [blame] | 131 | |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 132 | static ssize_t read_file_ani(struct file *file, char __user *user_buf, |
Mohammed Shafi Shajakhan | 05c0be2 | 2011-05-26 10:56:15 +0530 | [diff] [blame] | 133 | size_t count, loff_t *ppos) |
| 134 | { |
| 135 | struct ath_softc *sc = file->private_data; |
| 136 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 137 | struct ath_hw *ah = sc->sc_ah; |
Joe Perches | 2120ac9 | 2014-02-21 14:46:43 -0800 | [diff] [blame] | 138 | unsigned int len = 0; |
| 139 | const unsigned int size = 1024; |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 140 | ssize_t retval = 0; |
| 141 | char *buf; |
Felix Fietkau | abee4c8 | 2014-03-09 11:27:49 +0100 | [diff] [blame] | 142 | int i; |
| 143 | struct { |
| 144 | const char *name; |
| 145 | unsigned int val; |
| 146 | } ani_info[] = { |
| 147 | { "ANI RESET", ah->stats.ast_ani_reset }, |
| 148 | { "OFDM LEVEL", ah->ani.ofdmNoiseImmunityLevel }, |
| 149 | { "CCK LEVEL", ah->ani.cckNoiseImmunityLevel }, |
| 150 | { "SPUR UP", ah->stats.ast_ani_spurup }, |
| 151 | { "SPUR DOWN", ah->stats.ast_ani_spurup }, |
| 152 | { "OFDM WS-DET ON", ah->stats.ast_ani_ofdmon }, |
| 153 | { "OFDM WS-DET OFF", ah->stats.ast_ani_ofdmoff }, |
| 154 | { "MRC-CCK ON", ah->stats.ast_ani_ccklow }, |
| 155 | { "MRC-CCK OFF", ah->stats.ast_ani_cckhigh }, |
| 156 | { "FIR-STEP UP", ah->stats.ast_ani_stepup }, |
| 157 | { "FIR-STEP DOWN", ah->stats.ast_ani_stepdown }, |
| 158 | { "INV LISTENTIME", ah->stats.ast_ani_lneg_or_lzero }, |
| 159 | { "OFDM ERRORS", ah->stats.ast_ani_ofdmerrs }, |
| 160 | { "CCK ERRORS", ah->stats.ast_ani_cckerrs }, |
| 161 | }; |
Mohammed Shafi Shajakhan | 05c0be2 | 2011-05-26 10:56:15 +0530 | [diff] [blame] | 162 | |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 163 | buf = kzalloc(size, GFP_KERNEL); |
| 164 | if (buf == NULL) |
| 165 | return -ENOMEM; |
| 166 | |
Felix Fietkau | abee4c8 | 2014-03-09 11:27:49 +0100 | [diff] [blame] | 167 | len += scnprintf(buf + len, size - len, "%15s: %s\n", "ANI", |
| 168 | common->disable_ani ? "DISABLED" : "ENABLED"); |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 169 | |
Felix Fietkau | abee4c8 | 2014-03-09 11:27:49 +0100 | [diff] [blame] | 170 | if (common->disable_ani) |
| 171 | goto exit; |
| 172 | |
| 173 | for (i = 0; i < ARRAY_SIZE(ani_info); i++) |
| 174 | len += scnprintf(buf + len, size - len, "%15s: %u\n", |
| 175 | ani_info[i].name, ani_info[i].val); |
| 176 | |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 177 | exit: |
| 178 | if (len > size) |
| 179 | len = size; |
| 180 | |
| 181 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 182 | kfree(buf); |
| 183 | |
| 184 | return retval; |
Mohammed Shafi Shajakhan | 05c0be2 | 2011-05-26 10:56:15 +0530 | [diff] [blame] | 185 | } |
| 186 | |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 187 | static ssize_t write_file_ani(struct file *file, |
| 188 | const char __user *user_buf, |
| 189 | size_t count, loff_t *ppos) |
Mohammed Shafi Shajakhan | 05c0be2 | 2011-05-26 10:56:15 +0530 | [diff] [blame] | 190 | { |
| 191 | struct ath_softc *sc = file->private_data; |
| 192 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 193 | unsigned long ani; |
Mohammed Shafi Shajakhan | 05c0be2 | 2011-05-26 10:56:15 +0530 | [diff] [blame] | 194 | char buf[32]; |
| 195 | ssize_t len; |
| 196 | |
| 197 | len = min(count, sizeof(buf) - 1); |
| 198 | if (copy_from_user(buf, user_buf, len)) |
| 199 | return -EFAULT; |
| 200 | |
| 201 | buf[len] = '\0'; |
John W. Linville | 3899ba9 | 2013-06-11 14:48:32 -0400 | [diff] [blame] | 202 | if (kstrtoul(buf, 0, &ani)) |
Mohammed Shafi Shajakhan | 05c0be2 | 2011-05-26 10:56:15 +0530 | [diff] [blame] | 203 | return -EINVAL; |
| 204 | |
Andrey Utkin | 3f55720 | 2014-07-17 16:56:37 +0300 | [diff] [blame] | 205 | if (ani > 1) |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 206 | return -EINVAL; |
Mohammed Shafi Shajakhan | 05c0be2 | 2011-05-26 10:56:15 +0530 | [diff] [blame] | 207 | |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 208 | common->disable_ani = !ani; |
| 209 | |
| 210 | if (common->disable_ani) { |
Oleksij Rempel | eefa01d | 2014-02-27 11:40:46 +0100 | [diff] [blame] | 211 | clear_bit(ATH_OP_ANI_RUN, &common->op_flags); |
Sujith Manoharan | da0d45f | 2012-07-17 17:16:29 +0530 | [diff] [blame] | 212 | ath_stop_ani(sc); |
Mohammed Shafi Shajakhan | 05c0be2 | 2011-05-26 10:56:15 +0530 | [diff] [blame] | 213 | } else { |
Sujith Manoharan | da0d45f | 2012-07-17 17:16:29 +0530 | [diff] [blame] | 214 | ath_check_ani(sc); |
Mohammed Shafi Shajakhan | 05c0be2 | 2011-05-26 10:56:15 +0530 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | return count; |
| 218 | } |
| 219 | |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 220 | static const struct file_operations fops_ani = { |
| 221 | .read = read_file_ani, |
| 222 | .write = write_file_ani, |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 223 | .open = simple_open, |
Mohammed Shafi Shajakhan | 05c0be2 | 2011-05-26 10:56:15 +0530 | [diff] [blame] | 224 | .owner = THIS_MODULE, |
| 225 | .llseek = default_llseek, |
| 226 | }; |
Felix Fietkau | 1534069 | 2010-05-11 17:23:01 +0200 | [diff] [blame] | 227 | |
Sujith Manoharan | 36e8825 | 2013-08-06 12:44:15 +0530 | [diff] [blame] | 228 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
| 229 | |
Sujith Manoharan | 6308130 | 2013-08-04 14:21:55 +0530 | [diff] [blame] | 230 | static ssize_t read_file_bt_ant_diversity(struct file *file, |
| 231 | char __user *user_buf, |
| 232 | size_t count, loff_t *ppos) |
Sujith Manoharan | 302a3c3 | 2012-09-26 07:55:18 +0530 | [diff] [blame] | 233 | { |
| 234 | struct ath_softc *sc = file->private_data; |
| 235 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
| 236 | char buf[32]; |
| 237 | unsigned int len; |
| 238 | |
Sujith Manoharan | 6308130 | 2013-08-04 14:21:55 +0530 | [diff] [blame] | 239 | len = sprintf(buf, "%d\n", common->bt_ant_diversity); |
Sujith Manoharan | 302a3c3 | 2012-09-26 07:55:18 +0530 | [diff] [blame] | 240 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 241 | } |
| 242 | |
Sujith Manoharan | 6308130 | 2013-08-04 14:21:55 +0530 | [diff] [blame] | 243 | static ssize_t write_file_bt_ant_diversity(struct file *file, |
| 244 | const char __user *user_buf, |
| 245 | size_t count, loff_t *ppos) |
Sujith Manoharan | 302a3c3 | 2012-09-26 07:55:18 +0530 | [diff] [blame] | 246 | { |
| 247 | struct ath_softc *sc = file->private_data; |
| 248 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
Sujith Manoharan | 3f2da95 | 2013-08-04 14:21:56 +0530 | [diff] [blame] | 249 | struct ath9k_hw_capabilities *pCap = &sc->sc_ah->caps; |
Sujith Manoharan | 6308130 | 2013-08-04 14:21:55 +0530 | [diff] [blame] | 250 | unsigned long bt_ant_diversity; |
Sujith Manoharan | 302a3c3 | 2012-09-26 07:55:18 +0530 | [diff] [blame] | 251 | char buf[32]; |
| 252 | ssize_t len; |
| 253 | |
| 254 | len = min(count, sizeof(buf) - 1); |
| 255 | if (copy_from_user(buf, user_buf, len)) |
| 256 | return -EFAULT; |
| 257 | |
Sujith Manoharan | 3f2da95 | 2013-08-04 14:21:56 +0530 | [diff] [blame] | 258 | if (!(pCap->hw_caps & ATH9K_HW_CAP_BT_ANT_DIV)) |
| 259 | goto exit; |
| 260 | |
Sujith Manoharan | 302a3c3 | 2012-09-26 07:55:18 +0530 | [diff] [blame] | 261 | buf[len] = '\0'; |
Sujith Manoharan | 6308130 | 2013-08-04 14:21:55 +0530 | [diff] [blame] | 262 | if (kstrtoul(buf, 0, &bt_ant_diversity)) |
Sujith Manoharan | 302a3c3 | 2012-09-26 07:55:18 +0530 | [diff] [blame] | 263 | return -EINVAL; |
| 264 | |
Sujith Manoharan | 6308130 | 2013-08-04 14:21:55 +0530 | [diff] [blame] | 265 | common->bt_ant_diversity = !!bt_ant_diversity; |
Sujith Manoharan | 302a3c3 | 2012-09-26 07:55:18 +0530 | [diff] [blame] | 266 | ath9k_ps_wakeup(sc); |
Sujith Manoharan | 047dc3a | 2013-08-05 15:08:26 +0530 | [diff] [blame] | 267 | ath9k_hw_set_bt_ant_diversity(sc->sc_ah, common->bt_ant_diversity); |
Sujith Manoharan | 6308130 | 2013-08-04 14:21:55 +0530 | [diff] [blame] | 268 | ath_dbg(common, CONFIG, "Enable WLAN/BT RX Antenna diversity: %d\n", |
| 269 | common->bt_ant_diversity); |
Sujith Manoharan | 302a3c3 | 2012-09-26 07:55:18 +0530 | [diff] [blame] | 270 | ath9k_ps_restore(sc); |
Sujith Manoharan | 3f2da95 | 2013-08-04 14:21:56 +0530 | [diff] [blame] | 271 | exit: |
Sujith Manoharan | 302a3c3 | 2012-09-26 07:55:18 +0530 | [diff] [blame] | 272 | return count; |
| 273 | } |
| 274 | |
Sujith Manoharan | 6308130 | 2013-08-04 14:21:55 +0530 | [diff] [blame] | 275 | static const struct file_operations fops_bt_ant_diversity = { |
| 276 | .read = read_file_bt_ant_diversity, |
| 277 | .write = write_file_bt_ant_diversity, |
Sujith Manoharan | 302a3c3 | 2012-09-26 07:55:18 +0530 | [diff] [blame] | 278 | .open = simple_open, |
| 279 | .owner = THIS_MODULE, |
| 280 | .llseek = default_llseek, |
| 281 | }; |
| 282 | |
Sujith Manoharan | 36e8825 | 2013-08-06 12:44:15 +0530 | [diff] [blame] | 283 | #endif |
| 284 | |
Sujith Manoharan | e3d5291 | 2013-08-01 20:57:06 +0530 | [diff] [blame] | 285 | void ath9k_debug_stat_ant(struct ath_softc *sc, |
| 286 | struct ath_hw_antcomb_conf *div_ant_conf, |
| 287 | int main_rssi_avg, int alt_rssi_avg) |
| 288 | { |
| 289 | struct ath_antenna_stats *as_main = &sc->debug.stats.ant_stats[ANT_MAIN]; |
| 290 | struct ath_antenna_stats *as_alt = &sc->debug.stats.ant_stats[ANT_ALT]; |
| 291 | |
| 292 | as_main->lna_attempt_cnt[div_ant_conf->main_lna_conf]++; |
| 293 | as_alt->lna_attempt_cnt[div_ant_conf->alt_lna_conf]++; |
| 294 | |
| 295 | as_main->rssi_avg = main_rssi_avg; |
| 296 | as_alt->rssi_avg = alt_rssi_avg; |
| 297 | } |
| 298 | |
Sujith Manoharan | 4eba10c | 2013-07-29 16:04:49 +0530 | [diff] [blame] | 299 | static ssize_t read_file_antenna_diversity(struct file *file, |
| 300 | char __user *user_buf, |
| 301 | size_t count, loff_t *ppos) |
| 302 | { |
| 303 | struct ath_softc *sc = file->private_data; |
| 304 | struct ath_hw *ah = sc->sc_ah; |
| 305 | struct ath9k_hw_capabilities *pCap = &ah->caps; |
| 306 | struct ath_antenna_stats *as_main = &sc->debug.stats.ant_stats[ANT_MAIN]; |
| 307 | struct ath_antenna_stats *as_alt = &sc->debug.stats.ant_stats[ANT_ALT]; |
Sujith Manoharan | e3d5291 | 2013-08-01 20:57:06 +0530 | [diff] [blame] | 308 | struct ath_hw_antcomb_conf div_ant_conf; |
Joe Perches | 2120ac9 | 2014-02-21 14:46:43 -0800 | [diff] [blame] | 309 | unsigned int len = 0; |
| 310 | const unsigned int size = 1024; |
Sujith Manoharan | 4eba10c | 2013-07-29 16:04:49 +0530 | [diff] [blame] | 311 | ssize_t retval = 0; |
| 312 | char *buf; |
Joe Perches | 2120ac9 | 2014-02-21 14:46:43 -0800 | [diff] [blame] | 313 | static const char *lna_conf_str[4] = { |
| 314 | "LNA1_MINUS_LNA2", "LNA2", "LNA1", "LNA1_PLUS_LNA2" |
| 315 | }; |
Sujith Manoharan | 4eba10c | 2013-07-29 16:04:49 +0530 | [diff] [blame] | 316 | |
| 317 | buf = kzalloc(size, GFP_KERNEL); |
| 318 | if (buf == NULL) |
| 319 | return -ENOMEM; |
| 320 | |
| 321 | if (!(pCap->hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)) { |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 322 | len += scnprintf(buf + len, size - len, "%s\n", |
| 323 | "Antenna Diversity Combining is disabled"); |
Sujith Manoharan | 4eba10c | 2013-07-29 16:04:49 +0530 | [diff] [blame] | 324 | goto exit; |
| 325 | } |
| 326 | |
Sujith Manoharan | e3d5291 | 2013-08-01 20:57:06 +0530 | [diff] [blame] | 327 | ath9k_ps_wakeup(sc); |
| 328 | ath9k_hw_antdiv_comb_conf_get(ah, &div_ant_conf); |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 329 | len += scnprintf(buf + len, size - len, "Current MAIN config : %s\n", |
| 330 | lna_conf_str[div_ant_conf.main_lna_conf]); |
| 331 | len += scnprintf(buf + len, size - len, "Current ALT config : %s\n", |
| 332 | lna_conf_str[div_ant_conf.alt_lna_conf]); |
| 333 | len += scnprintf(buf + len, size - len, "Average MAIN RSSI : %d\n", |
| 334 | as_main->rssi_avg); |
| 335 | len += scnprintf(buf + len, size - len, "Average ALT RSSI : %d\n\n", |
| 336 | as_alt->rssi_avg); |
Sujith Manoharan | e3d5291 | 2013-08-01 20:57:06 +0530 | [diff] [blame] | 337 | ath9k_ps_restore(sc); |
| 338 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 339 | len += scnprintf(buf + len, size - len, "Packet Receive Cnt:\n"); |
| 340 | len += scnprintf(buf + len, size - len, "-------------------\n"); |
Sujith Manoharan | e3d5291 | 2013-08-01 20:57:06 +0530 | [diff] [blame] | 341 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 342 | len += scnprintf(buf + len, size - len, "%30s%15s\n", |
| 343 | "MAIN", "ALT"); |
| 344 | len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n", |
| 345 | "TOTAL COUNT", |
| 346 | as_main->recv_cnt, |
| 347 | as_alt->recv_cnt); |
| 348 | len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n", |
| 349 | "LNA1", |
| 350 | as_main->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1], |
| 351 | as_alt->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1]); |
| 352 | len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n", |
| 353 | "LNA2", |
| 354 | as_main->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA2], |
| 355 | as_alt->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA2]); |
| 356 | len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n", |
| 357 | "LNA1 + LNA2", |
| 358 | as_main->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2], |
| 359 | as_alt->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2]); |
| 360 | len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n", |
| 361 | "LNA1 - LNA2", |
| 362 | as_main->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2], |
| 363 | as_alt->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2]); |
Sujith Manoharan | e3d5291 | 2013-08-01 20:57:06 +0530 | [diff] [blame] | 364 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 365 | len += scnprintf(buf + len, size - len, "\nLNA Config Attempts:\n"); |
| 366 | len += scnprintf(buf + len, size - len, "--------------------\n"); |
Sujith Manoharan | e3d5291 | 2013-08-01 20:57:06 +0530 | [diff] [blame] | 367 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 368 | len += scnprintf(buf + len, size - len, "%30s%15s\n", |
| 369 | "MAIN", "ALT"); |
| 370 | len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n", |
| 371 | "LNA1", |
| 372 | as_main->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1], |
| 373 | as_alt->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1]); |
| 374 | len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n", |
| 375 | "LNA2", |
| 376 | as_main->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA2], |
| 377 | as_alt->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA2]); |
| 378 | len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n", |
| 379 | "LNA1 + LNA2", |
| 380 | as_main->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2], |
| 381 | as_alt->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2]); |
| 382 | len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n", |
| 383 | "LNA1 - LNA2", |
| 384 | as_main->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2], |
| 385 | as_alt->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2]); |
Sujith Manoharan | e3d5291 | 2013-08-01 20:57:06 +0530 | [diff] [blame] | 386 | |
Sujith Manoharan | 4eba10c | 2013-07-29 16:04:49 +0530 | [diff] [blame] | 387 | exit: |
| 388 | if (len > size) |
| 389 | len = size; |
| 390 | |
| 391 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 392 | kfree(buf); |
| 393 | |
| 394 | return retval; |
| 395 | } |
| 396 | |
| 397 | static const struct file_operations fops_antenna_diversity = { |
| 398 | .read = read_file_antenna_diversity, |
| 399 | .open = simple_open, |
| 400 | .owner = THIS_MODULE, |
| 401 | .llseek = default_llseek, |
| 402 | }; |
| 403 | |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 404 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, |
| 405 | size_t count, loff_t *ppos) |
| 406 | { |
| 407 | struct ath_softc *sc = file->private_data; |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 408 | struct ath_hw *ah = sc->sc_ah; |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 409 | char *buf; |
| 410 | int retval; |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 411 | unsigned int len = 0; |
| 412 | u32 val[ATH9K_NUM_DMA_DEBUG_REGS]; |
| 413 | int i, qcuOffset = 0, dcuOffset = 0; |
| 414 | u32 *qcuBase = &val[0], *dcuBase = &val[4]; |
| 415 | |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 416 | buf = kmalloc(DMA_BUF_LEN, GFP_KERNEL); |
| 417 | if (!buf) |
Dan Carpenter | 0423606 | 2010-05-14 15:25:39 +0200 | [diff] [blame] | 418 | return -ENOMEM; |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 419 | |
Sujith | 7cf4a2e | 2009-08-26 11:11:57 +0530 | [diff] [blame] | 420 | ath9k_ps_wakeup(sc); |
| 421 | |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 422 | REG_WRITE_D(ah, AR_MACMISC, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 423 | ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) | |
| 424 | (AR_MACMISC_MISC_OBS_BUS_1 << |
| 425 | AR_MACMISC_MISC_OBS_BUS_MSB_S))); |
| 426 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 427 | len += scnprintf(buf + len, DMA_BUF_LEN - len, |
| 428 | "Raw DMA Debug values:\n"); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 429 | |
| 430 | for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) { |
| 431 | if (i % 4 == 0) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 432 | len += scnprintf(buf + len, DMA_BUF_LEN - len, "\n"); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 433 | |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 434 | val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32))); |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 435 | len += scnprintf(buf + len, DMA_BUF_LEN - len, "%d: %08x ", |
| 436 | i, val[i]); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 437 | } |
| 438 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 439 | len += scnprintf(buf + len, DMA_BUF_LEN - len, "\n\n"); |
| 440 | len += scnprintf(buf + len, DMA_BUF_LEN - len, |
| 441 | "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n"); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 442 | |
| 443 | for (i = 0; i < ATH9K_NUM_QUEUES; i++, qcuOffset += 4, dcuOffset += 5) { |
| 444 | if (i == 8) { |
| 445 | qcuOffset = 0; |
| 446 | qcuBase++; |
| 447 | } |
| 448 | |
| 449 | if (i == 6) { |
| 450 | dcuOffset = 0; |
| 451 | dcuBase++; |
| 452 | } |
| 453 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 454 | len += scnprintf(buf + len, DMA_BUF_LEN - len, |
| 455 | "%2d %2x %1x %2x %2x\n", |
| 456 | i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, |
| 457 | (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3), |
| 458 | val[2] & (0x7 << (i * 3)) >> (i * 3), |
| 459 | (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 460 | } |
| 461 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 462 | len += scnprintf(buf + len, DMA_BUF_LEN - len, "\n"); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 463 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 464 | len += scnprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 465 | "qcu_stitch state: %2x qcu_fetch state: %2x\n", |
| 466 | (val[3] & 0x003c0000) >> 18, (val[3] & 0x03c00000) >> 22); |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 467 | len += scnprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 468 | "qcu_complete state: %2x dcu_complete state: %2x\n", |
| 469 | (val[3] & 0x1c000000) >> 26, (val[6] & 0x3)); |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 470 | len += scnprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 471 | "dcu_arb state: %2x dcu_fp state: %2x\n", |
| 472 | (val[5] & 0x06000000) >> 25, (val[5] & 0x38000000) >> 27); |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 473 | len += scnprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 474 | "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n", |
| 475 | (val[6] & 0x000003fc) >> 2, (val[6] & 0x00000400) >> 10); |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 476 | len += scnprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 477 | "txfifo_valid_0: %1d txfifo_valid_1: %1d\n", |
| 478 | (val[6] & 0x00000800) >> 11, (val[6] & 0x00001000) >> 12); |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 479 | len += scnprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 480 | "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n", |
| 481 | (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17); |
| 482 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 483 | len += scnprintf(buf + len, DMA_BUF_LEN - len, "pcu observe: 0x%x\n", |
| 484 | REG_READ_D(ah, AR_OBS_BUS_1)); |
| 485 | len += scnprintf(buf + len, DMA_BUF_LEN - len, |
| 486 | "AR_CR: 0x%x\n", REG_READ_D(ah, AR_CR)); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 487 | |
Sujith | 7cf4a2e | 2009-08-26 11:11:57 +0530 | [diff] [blame] | 488 | ath9k_ps_restore(sc); |
| 489 | |
Dan Carpenter | 2b87f3a | 2010-05-14 15:24:37 +0200 | [diff] [blame] | 490 | if (len > DMA_BUF_LEN) |
| 491 | len = DMA_BUF_LEN; |
| 492 | |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 493 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 494 | kfree(buf); |
| 495 | return retval; |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 496 | } |
| 497 | |
| 498 | static const struct file_operations fops_dma = { |
| 499 | .read = read_file_dma, |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 500 | .open = simple_open, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 501 | .owner = THIS_MODULE, |
| 502 | .llseek = default_llseek, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 503 | }; |
| 504 | |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 505 | |
| 506 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status) |
| 507 | { |
| 508 | if (status) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 509 | sc->debug.stats.istats.total++; |
Luis R. Rodriguez | a9616f4 | 2010-04-15 17:39:30 -0400 | [diff] [blame] | 510 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { |
| 511 | if (status & ATH9K_INT_RXLP) |
| 512 | sc->debug.stats.istats.rxlp++; |
| 513 | if (status & ATH9K_INT_RXHP) |
| 514 | sc->debug.stats.istats.rxhp++; |
Luis R. Rodriguez | 08578b8 | 2010-05-13 13:33:44 -0400 | [diff] [blame] | 515 | if (status & ATH9K_INT_BB_WATCHDOG) |
| 516 | sc->debug.stats.istats.bb_watchdog++; |
Luis R. Rodriguez | a9616f4 | 2010-04-15 17:39:30 -0400 | [diff] [blame] | 517 | } else { |
| 518 | if (status & ATH9K_INT_RX) |
| 519 | sc->debug.stats.istats.rxok++; |
| 520 | } |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 521 | if (status & ATH9K_INT_RXEOL) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 522 | sc->debug.stats.istats.rxeol++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 523 | if (status & ATH9K_INT_RXORN) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 524 | sc->debug.stats.istats.rxorn++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 525 | if (status & ATH9K_INT_TX) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 526 | sc->debug.stats.istats.txok++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 527 | if (status & ATH9K_INT_TXURN) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 528 | sc->debug.stats.istats.txurn++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 529 | if (status & ATH9K_INT_RXPHY) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 530 | sc->debug.stats.istats.rxphyerr++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 531 | if (status & ATH9K_INT_RXKCM) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 532 | sc->debug.stats.istats.rx_keycache_miss++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 533 | if (status & ATH9K_INT_SWBA) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 534 | sc->debug.stats.istats.swba++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 535 | if (status & ATH9K_INT_BMISS) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 536 | sc->debug.stats.istats.bmiss++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 537 | if (status & ATH9K_INT_BNR) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 538 | sc->debug.stats.istats.bnr++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 539 | if (status & ATH9K_INT_CST) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 540 | sc->debug.stats.istats.cst++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 541 | if (status & ATH9K_INT_GTT) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 542 | sc->debug.stats.istats.gtt++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 543 | if (status & ATH9K_INT_TIM) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 544 | sc->debug.stats.istats.tim++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 545 | if (status & ATH9K_INT_CABEND) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 546 | sc->debug.stats.istats.cabend++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 547 | if (status & ATH9K_INT_DTIMSYNC) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 548 | sc->debug.stats.istats.dtimsync++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 549 | if (status & ATH9K_INT_DTIM) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 550 | sc->debug.stats.istats.dtim++; |
Mohammed Shafi Shajakhan | 6dde1aa | 2011-04-22 17:27:01 +0530 | [diff] [blame] | 551 | if (status & ATH9K_INT_TSFOOR) |
| 552 | sc->debug.stats.istats.tsfoor++; |
Sujith Manoharan | 97ba515 | 2012-06-04 16:27:41 +0530 | [diff] [blame] | 553 | if (status & ATH9K_INT_MCI) |
| 554 | sc->debug.stats.istats.mci++; |
Mohammed Shafi Shajakhan | c9e6e98 | 2012-09-07 15:54:13 +0530 | [diff] [blame] | 555 | if (status & ATH9K_INT_GENTIMER) |
| 556 | sc->debug.stats.istats.gen_timer++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 557 | } |
| 558 | |
| 559 | static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, |
| 560 | size_t count, loff_t *ppos) |
| 561 | { |
| 562 | struct ath_softc *sc = file->private_data; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 563 | unsigned int len = 0; |
Ben Greear | 462e58f | 2012-04-12 10:04:00 -0700 | [diff] [blame] | 564 | int rv; |
| 565 | int mxlen = 4000; |
| 566 | char *buf = kmalloc(mxlen, GFP_KERNEL); |
| 567 | if (!buf) |
| 568 | return -ENOMEM; |
| 569 | |
| 570 | #define PR_IS(a, s) \ |
| 571 | do { \ |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 572 | len += scnprintf(buf + len, mxlen - len, \ |
| 573 | "%21s: %10u\n", a, \ |
| 574 | sc->debug.stats.istats.s); \ |
Ben Greear | 462e58f | 2012-04-12 10:04:00 -0700 | [diff] [blame] | 575 | } while (0) |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 576 | |
Luis R. Rodriguez | a9616f4 | 2010-04-15 17:39:30 -0400 | [diff] [blame] | 577 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { |
Ben Greear | 462e58f | 2012-04-12 10:04:00 -0700 | [diff] [blame] | 578 | PR_IS("RXLP", rxlp); |
| 579 | PR_IS("RXHP", rxhp); |
| 580 | PR_IS("WATHDOG", bb_watchdog); |
Luis R. Rodriguez | a9616f4 | 2010-04-15 17:39:30 -0400 | [diff] [blame] | 581 | } else { |
Ben Greear | 462e58f | 2012-04-12 10:04:00 -0700 | [diff] [blame] | 582 | PR_IS("RX", rxok); |
Luis R. Rodriguez | a9616f4 | 2010-04-15 17:39:30 -0400 | [diff] [blame] | 583 | } |
Ben Greear | 462e58f | 2012-04-12 10:04:00 -0700 | [diff] [blame] | 584 | PR_IS("RXEOL", rxeol); |
| 585 | PR_IS("RXORN", rxorn); |
| 586 | PR_IS("TX", txok); |
| 587 | PR_IS("TXURN", txurn); |
| 588 | PR_IS("MIB", mib); |
| 589 | PR_IS("RXPHY", rxphyerr); |
| 590 | PR_IS("RXKCM", rx_keycache_miss); |
| 591 | PR_IS("SWBA", swba); |
| 592 | PR_IS("BMISS", bmiss); |
| 593 | PR_IS("BNR", bnr); |
| 594 | PR_IS("CST", cst); |
| 595 | PR_IS("GTT", gtt); |
| 596 | PR_IS("TIM", tim); |
| 597 | PR_IS("CABEND", cabend); |
| 598 | PR_IS("DTIMSYNC", dtimsync); |
| 599 | PR_IS("DTIM", dtim); |
| 600 | PR_IS("TSFOOR", tsfoor); |
Sujith Manoharan | 97ba515 | 2012-06-04 16:27:41 +0530 | [diff] [blame] | 601 | PR_IS("MCI", mci); |
Mohammed Shafi Shajakhan | c9e6e98 | 2012-09-07 15:54:13 +0530 | [diff] [blame] | 602 | PR_IS("GENTIMER", gen_timer); |
Ben Greear | 462e58f | 2012-04-12 10:04:00 -0700 | [diff] [blame] | 603 | PR_IS("TOTAL", total); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 604 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 605 | len += scnprintf(buf + len, mxlen - len, |
| 606 | "SYNC_CAUSE stats:\n"); |
Mohammed Shafi Shajakhan | 6dde1aa | 2011-04-22 17:27:01 +0530 | [diff] [blame] | 607 | |
Ben Greear | 462e58f | 2012-04-12 10:04:00 -0700 | [diff] [blame] | 608 | PR_IS("Sync-All", sync_cause_all); |
| 609 | PR_IS("RTC-IRQ", sync_rtc_irq); |
| 610 | PR_IS("MAC-IRQ", sync_mac_irq); |
| 611 | PR_IS("EEPROM-Illegal-Access", eeprom_illegal_access); |
| 612 | PR_IS("APB-Timeout", apb_timeout); |
| 613 | PR_IS("PCI-Mode-Conflict", pci_mode_conflict); |
| 614 | PR_IS("HOST1-Fatal", host1_fatal); |
| 615 | PR_IS("HOST1-Perr", host1_perr); |
| 616 | PR_IS("TRCV-FIFO-Perr", trcv_fifo_perr); |
| 617 | PR_IS("RADM-CPL-EP", radm_cpl_ep); |
| 618 | PR_IS("RADM-CPL-DLLP-Abort", radm_cpl_dllp_abort); |
| 619 | PR_IS("RADM-CPL-TLP-Abort", radm_cpl_tlp_abort); |
| 620 | PR_IS("RADM-CPL-ECRC-Err", radm_cpl_ecrc_err); |
| 621 | PR_IS("RADM-CPL-Timeout", radm_cpl_timeout); |
| 622 | PR_IS("Local-Bus-Timeout", local_timeout); |
| 623 | PR_IS("PM-Access", pm_access); |
| 624 | PR_IS("MAC-Awake", mac_awake); |
| 625 | PR_IS("MAC-Asleep", mac_asleep); |
| 626 | PR_IS("MAC-Sleep-Access", mac_sleep_access); |
Dan Carpenter | 2b87f3a | 2010-05-14 15:24:37 +0200 | [diff] [blame] | 627 | |
Ben Greear | 462e58f | 2012-04-12 10:04:00 -0700 | [diff] [blame] | 628 | if (len > mxlen) |
| 629 | len = mxlen; |
| 630 | |
| 631 | rv = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 632 | kfree(buf); |
| 633 | return rv; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 634 | } |
| 635 | |
| 636 | static const struct file_operations fops_interrupt = { |
| 637 | .read = read_file_interrupt, |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 638 | .open = simple_open, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 639 | .owner = THIS_MODULE, |
| 640 | .llseek = default_llseek, |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 641 | }; |
| 642 | |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 643 | static ssize_t read_file_xmit(struct file *file, char __user *user_buf, |
| 644 | size_t count, loff_t *ppos) |
| 645 | { |
| 646 | struct ath_softc *sc = file->private_data; |
| 647 | char *buf; |
Sujith Manoharan | 78ef731 | 2012-11-21 18:13:11 +0530 | [diff] [blame] | 648 | unsigned int len = 0, size = 2048; |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 649 | ssize_t retval = 0; |
| 650 | |
| 651 | buf = kzalloc(size, GFP_KERNEL); |
| 652 | if (buf == NULL) |
Dan Carpenter | 0423606 | 2010-05-14 15:25:39 +0200 | [diff] [blame] | 653 | return -ENOMEM; |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 654 | |
Sujith Manoharan | 78ef731 | 2012-11-21 18:13:11 +0530 | [diff] [blame] | 655 | len += sprintf(buf, "%30s %10s%10s%10s\n\n", |
Ben Greear | 7f010c9 | 2011-01-09 23:11:49 -0800 | [diff] [blame] | 656 | "BE", "BK", "VI", "VO"); |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 657 | |
| 658 | PR("MPDUs Queued: ", queued); |
| 659 | PR("MPDUs Completed: ", completed); |
Felix Fietkau | 5a6f78a | 2011-05-31 21:21:41 +0200 | [diff] [blame] | 660 | PR("MPDUs XRetried: ", xretries); |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 661 | PR("Aggregates: ", a_aggr); |
Ben Greear | bda8add | 2011-01-09 23:11:48 -0800 | [diff] [blame] | 662 | PR("AMPDUs Queued HW:", a_queued_hw); |
| 663 | PR("AMPDUs Queued SW:", a_queued_sw); |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 664 | PR("AMPDUs Completed:", a_completed); |
| 665 | PR("AMPDUs Retried: ", a_retries); |
| 666 | PR("AMPDUs XRetried: ", a_xretries); |
Ben Greear | 4d90038 | 2013-03-04 15:31:16 -0800 | [diff] [blame] | 667 | PR("TXERR Filtered: ", txerr_filtered); |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 668 | PR("FIFO Underrun: ", fifo_underrun); |
| 669 | PR("TXOP Exceeded: ", xtxop); |
| 670 | PR("TXTIMER Expiry: ", timer_exp); |
| 671 | PR("DESC CFG Error: ", desc_cfg_err); |
| 672 | PR("DATA Underrun: ", data_underrun); |
| 673 | PR("DELIM Underrun: ", delim_underrun); |
Ben Greear | 99c15bf | 2010-10-01 12:26:30 -0700 | [diff] [blame] | 674 | PR("TX-Pkts-All: ", tx_pkts_all); |
| 675 | PR("TX-Bytes-All: ", tx_bytes_all); |
Sujith Manoharan | 78ef731 | 2012-11-21 18:13:11 +0530 | [diff] [blame] | 676 | PR("HW-put-tx-buf: ", puttxbuf); |
| 677 | PR("HW-tx-start: ", txstart); |
| 678 | PR("HW-tx-proc-desc: ", txprocdesc); |
Ben Greear | a5a0bca | 2012-04-03 09:16:55 -0700 | [diff] [blame] | 679 | PR("TX-Failed: ", txfailed); |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 680 | |
Ben Greear | 7f010c9 | 2011-01-09 23:11:49 -0800 | [diff] [blame] | 681 | if (len > size) |
| 682 | len = size; |
| 683 | |
| 684 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 685 | kfree(buf); |
| 686 | |
| 687 | return retval; |
| 688 | } |
| 689 | |
Felix Fietkau | 18fcf1c | 2013-08-06 14:18:05 +0200 | [diff] [blame] | 690 | static ssize_t print_queue(struct ath_softc *sc, struct ath_txq *txq, |
| 691 | char *buf, ssize_t size) |
| 692 | { |
| 693 | ssize_t len = 0; |
| 694 | |
| 695 | ath_txq_lock(sc, txq); |
| 696 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 697 | len += scnprintf(buf + len, size - len, "%s: %d ", |
| 698 | "qnum", txq->axq_qnum); |
| 699 | len += scnprintf(buf + len, size - len, "%s: %2d ", |
| 700 | "qdepth", txq->axq_depth); |
| 701 | len += scnprintf(buf + len, size - len, "%s: %2d ", |
| 702 | "ampdu-depth", txq->axq_ampdu_depth); |
| 703 | len += scnprintf(buf + len, size - len, "%s: %3d ", |
| 704 | "pending", txq->pending_frames); |
| 705 | len += scnprintf(buf + len, size - len, "%s: %d\n", |
| 706 | "stopped", txq->stopped); |
Felix Fietkau | 18fcf1c | 2013-08-06 14:18:05 +0200 | [diff] [blame] | 707 | |
| 708 | ath_txq_unlock(sc, txq); |
| 709 | return len; |
| 710 | } |
| 711 | |
Sujith Manoharan | c0b7487 | 2012-11-21 18:13:12 +0530 | [diff] [blame] | 712 | static ssize_t read_file_queues(struct file *file, char __user *user_buf, |
| 713 | size_t count, loff_t *ppos) |
| 714 | { |
| 715 | struct ath_softc *sc = file->private_data; |
| 716 | struct ath_txq *txq; |
| 717 | char *buf; |
Joe Perches | 2120ac9 | 2014-02-21 14:46:43 -0800 | [diff] [blame] | 718 | unsigned int len = 0; |
| 719 | const unsigned int size = 1024; |
Sujith Manoharan | c0b7487 | 2012-11-21 18:13:12 +0530 | [diff] [blame] | 720 | ssize_t retval = 0; |
| 721 | int i; |
Joe Perches | 2120ac9 | 2014-02-21 14:46:43 -0800 | [diff] [blame] | 722 | static const char *qname[4] = { |
| 723 | "VO", "VI", "BE", "BK" |
| 724 | }; |
Sujith Manoharan | c0b7487 | 2012-11-21 18:13:12 +0530 | [diff] [blame] | 725 | |
| 726 | buf = kzalloc(size, GFP_KERNEL); |
| 727 | if (buf == NULL) |
| 728 | return -ENOMEM; |
| 729 | |
| 730 | for (i = 0; i < IEEE80211_NUM_ACS; i++) { |
| 731 | txq = sc->tx.txq_map[i]; |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 732 | len += scnprintf(buf + len, size - len, "(%s): ", qname[i]); |
Felix Fietkau | 18fcf1c | 2013-08-06 14:18:05 +0200 | [diff] [blame] | 733 | len += print_queue(sc, txq, buf + len, size - len); |
Sujith Manoharan | c0b7487 | 2012-11-21 18:13:12 +0530 | [diff] [blame] | 734 | } |
| 735 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 736 | len += scnprintf(buf + len, size - len, "(CAB): "); |
Felix Fietkau | 18fcf1c | 2013-08-06 14:18:05 +0200 | [diff] [blame] | 737 | len += print_queue(sc, sc->beacon.cabq, buf + len, size - len); |
| 738 | |
Sujith Manoharan | c0b7487 | 2012-11-21 18:13:12 +0530 | [diff] [blame] | 739 | if (len > size) |
| 740 | len = size; |
| 741 | |
| 742 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 743 | kfree(buf); |
| 744 | |
| 745 | return retval; |
| 746 | } |
| 747 | |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 748 | static ssize_t read_file_misc(struct file *file, char __user *user_buf, |
| 749 | size_t count, loff_t *ppos) |
| 750 | { |
| 751 | struct ath_softc *sc = file->private_data; |
| 752 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 753 | struct ath9k_vif_iter_data iter_data; |
Rajkumar Manoharan | 9a9c4fb | 2014-06-11 16:18:03 +0530 | [diff] [blame] | 754 | struct ath_chanctx *ctx; |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 755 | char buf[512]; |
| 756 | unsigned int len = 0; |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 757 | ssize_t retval = 0; |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 758 | unsigned int reg; |
Rajkumar Manoharan | 9a9c4fb | 2014-06-11 16:18:03 +0530 | [diff] [blame] | 759 | u32 rxfilter, i; |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 760 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 761 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 762 | "BSSID: %pM\n", common->curbssid); |
| 763 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 764 | "BSSID-MASK: %pM\n", common->bssidmask); |
| 765 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 766 | "OPMODE: %s\n", |
| 767 | ath_opmode_to_string(sc->sc_ah->opmode)); |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 768 | |
Rajkumar Manoharan | 79d2b15 | 2011-05-16 18:23:23 +0530 | [diff] [blame] | 769 | ath9k_ps_wakeup(sc); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 770 | rxfilter = ath9k_hw_getrxfilter(sc->sc_ah); |
Rajkumar Manoharan | 79d2b15 | 2011-05-16 18:23:23 +0530 | [diff] [blame] | 771 | ath9k_ps_restore(sc); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 772 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 773 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 774 | "RXFILTER: 0x%x", rxfilter); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 775 | |
| 776 | if (rxfilter & ATH9K_RX_FILTER_UCAST) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 777 | len += scnprintf(buf + len, sizeof(buf) - len, " UCAST"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 778 | if (rxfilter & ATH9K_RX_FILTER_MCAST) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 779 | len += scnprintf(buf + len, sizeof(buf) - len, " MCAST"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 780 | if (rxfilter & ATH9K_RX_FILTER_BCAST) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 781 | len += scnprintf(buf + len, sizeof(buf) - len, " BCAST"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 782 | if (rxfilter & ATH9K_RX_FILTER_CONTROL) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 783 | len += scnprintf(buf + len, sizeof(buf) - len, " CONTROL"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 784 | if (rxfilter & ATH9K_RX_FILTER_BEACON) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 785 | len += scnprintf(buf + len, sizeof(buf) - len, " BEACON"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 786 | if (rxfilter & ATH9K_RX_FILTER_PROM) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 787 | len += scnprintf(buf + len, sizeof(buf) - len, " PROM"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 788 | if (rxfilter & ATH9K_RX_FILTER_PROBEREQ) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 789 | len += scnprintf(buf + len, sizeof(buf) - len, " PROBEREQ"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 790 | if (rxfilter & ATH9K_RX_FILTER_PHYERR) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 791 | len += scnprintf(buf + len, sizeof(buf) - len, " PHYERR"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 792 | if (rxfilter & ATH9K_RX_FILTER_MYBEACON) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 793 | len += scnprintf(buf + len, sizeof(buf) - len, " MYBEACON"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 794 | if (rxfilter & ATH9K_RX_FILTER_COMP_BAR) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 795 | len += scnprintf(buf + len, sizeof(buf) - len, " COMP_BAR"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 796 | if (rxfilter & ATH9K_RX_FILTER_PSPOLL) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 797 | len += scnprintf(buf + len, sizeof(buf) - len, " PSPOLL"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 798 | if (rxfilter & ATH9K_RX_FILTER_PHYRADAR) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 799 | len += scnprintf(buf + len, sizeof(buf) - len, " PHYRADAR"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 800 | if (rxfilter & ATH9K_RX_FILTER_MCAST_BCAST_ALL) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 801 | len += scnprintf(buf + len, sizeof(buf) - len, " MCAST_BCAST_ALL"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 802 | if (rxfilter & ATH9K_RX_FILTER_CONTROL_WRAPPER) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 803 | len += scnprintf(buf + len, sizeof(buf) - len, " CONTROL_WRAPPER"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 804 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 805 | len += scnprintf(buf + len, sizeof(buf) - len, "\n"); |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 806 | |
| 807 | reg = sc->sc_ah->imask; |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 808 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 809 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 810 | "INTERRUPT-MASK: 0x%x", reg); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 811 | |
| 812 | if (reg & ATH9K_INT_SWBA) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 813 | len += scnprintf(buf + len, sizeof(buf) - len, " SWBA"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 814 | if (reg & ATH9K_INT_BMISS) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 815 | len += scnprintf(buf + len, sizeof(buf) - len, " BMISS"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 816 | if (reg & ATH9K_INT_CST) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 817 | len += scnprintf(buf + len, sizeof(buf) - len, " CST"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 818 | if (reg & ATH9K_INT_RX) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 819 | len += scnprintf(buf + len, sizeof(buf) - len, " RX"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 820 | if (reg & ATH9K_INT_RXHP) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 821 | len += scnprintf(buf + len, sizeof(buf) - len, " RXHP"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 822 | if (reg & ATH9K_INT_RXLP) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 823 | len += scnprintf(buf + len, sizeof(buf) - len, " RXLP"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 824 | if (reg & ATH9K_INT_BB_WATCHDOG) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 825 | len += scnprintf(buf + len, sizeof(buf) - len, " BB_WATCHDOG"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 826 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 827 | len += scnprintf(buf + len, sizeof(buf) - len, "\n"); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 828 | |
Rajkumar Manoharan | 9a9c4fb | 2014-06-11 16:18:03 +0530 | [diff] [blame] | 829 | i = 0; |
| 830 | ath_for_each_chanctx(sc, ctx) { |
| 831 | if (!ctx->assigned || list_empty(&ctx->vifs)) |
| 832 | continue; |
| 833 | ath9k_calculate_iter_data(sc, ctx, &iter_data); |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 834 | |
Rajkumar Manoharan | 9a9c4fb | 2014-06-11 16:18:03 +0530 | [diff] [blame] | 835 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 836 | "VIF-COUNTS: CTX %i AP: %i STA: %i MESH: %i WDS: %i", |
| 837 | i++, iter_data.naps, iter_data.nstations, |
| 838 | iter_data.nmeshes, iter_data.nwds); |
| 839 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 840 | " ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n", |
| 841 | iter_data.nadhocs, sc->nvifs, sc->nbcnvifs); |
| 842 | } |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 843 | |
Sujith Manoharan | 6bcf6f6 | 2012-02-16 11:51:02 +0530 | [diff] [blame] | 844 | if (len > sizeof(buf)) |
| 845 | len = sizeof(buf); |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 846 | |
| 847 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 848 | return retval; |
| 849 | } |
| 850 | |
Sujith Manoharan | f8b815d | 2012-02-16 11:51:11 +0530 | [diff] [blame] | 851 | static ssize_t read_file_reset(struct file *file, char __user *user_buf, |
| 852 | size_t count, loff_t *ppos) |
| 853 | { |
| 854 | struct ath_softc *sc = file->private_data; |
| 855 | char buf[512]; |
| 856 | unsigned int len = 0; |
| 857 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 858 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 859 | "%17s: %2d\n", "Baseband Hang", |
| 860 | sc->debug.stats.reset[RESET_TYPE_BB_HANG]); |
| 861 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 862 | "%17s: %2d\n", "Baseband Watchdog", |
| 863 | sc->debug.stats.reset[RESET_TYPE_BB_WATCHDOG]); |
| 864 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 865 | "%17s: %2d\n", "Fatal HW Error", |
| 866 | sc->debug.stats.reset[RESET_TYPE_FATAL_INT]); |
| 867 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 868 | "%17s: %2d\n", "TX HW error", |
| 869 | sc->debug.stats.reset[RESET_TYPE_TX_ERROR]); |
| 870 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 871 | "%17s: %2d\n", "TX Path Hang", |
| 872 | sc->debug.stats.reset[RESET_TYPE_TX_HANG]); |
| 873 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 874 | "%17s: %2d\n", "PLL RX Hang", |
| 875 | sc->debug.stats.reset[RESET_TYPE_PLL_HANG]); |
| 876 | len += scnprintf(buf + len, sizeof(buf) - len, |
Felix Fietkau | 443626e5 | 2014-02-21 11:45:36 +0100 | [diff] [blame] | 877 | "%17s: %2d\n", "MAC Hang", |
| 878 | sc->debug.stats.reset[RESET_TYPE_MAC_HANG]); |
| 879 | len += scnprintf(buf + len, sizeof(buf) - len, |
| 880 | "%17s: %2d\n", "Stuck Beacon", |
| 881 | sc->debug.stats.reset[RESET_TYPE_BEACON_STUCK]); |
| 882 | len += scnprintf(buf + len, sizeof(buf) - len, |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 883 | "%17s: %2d\n", "MCI Reset", |
| 884 | sc->debug.stats.reset[RESET_TYPE_MCI]); |
Sujith Manoharan | f8b815d | 2012-02-16 11:51:11 +0530 | [diff] [blame] | 885 | |
| 886 | if (len > sizeof(buf)) |
| 887 | len = sizeof(buf); |
| 888 | |
| 889 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 890 | } |
| 891 | |
Felix Fietkau | 066dae9 | 2010-11-07 14:59:39 +0100 | [diff] [blame] | 892 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, |
Felix Fietkau | 55797b1 | 2011-09-14 21:24:16 +0200 | [diff] [blame] | 893 | struct ath_tx_status *ts, struct ath_txq *txq, |
| 894 | unsigned int flags) |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 895 | { |
Felix Fietkau | 5bec3e5 | 2011-01-24 21:29:25 +0100 | [diff] [blame] | 896 | int qnum = txq->axq_qnum; |
Felix Fietkau | 066dae9 | 2010-11-07 14:59:39 +0100 | [diff] [blame] | 897 | |
| 898 | TX_STAT_INC(qnum, tx_pkts_all); |
| 899 | sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len; |
Ben Greear | 99c15bf | 2010-10-01 12:26:30 -0700 | [diff] [blame] | 900 | |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 901 | if (bf_isampdu(bf)) { |
Felix Fietkau | 156369f | 2011-12-14 22:08:04 +0100 | [diff] [blame] | 902 | if (flags & ATH_TX_ERROR) |
Felix Fietkau | 066dae9 | 2010-11-07 14:59:39 +0100 | [diff] [blame] | 903 | TX_STAT_INC(qnum, a_xretries); |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 904 | else |
Felix Fietkau | 066dae9 | 2010-11-07 14:59:39 +0100 | [diff] [blame] | 905 | TX_STAT_INC(qnum, a_completed); |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 906 | } else { |
Felix Fietkau | 55797b1 | 2011-09-14 21:24:16 +0200 | [diff] [blame] | 907 | if (ts->ts_status & ATH9K_TXERR_XRETRY) |
Felix Fietkau | 5a6f78a | 2011-05-31 21:21:41 +0200 | [diff] [blame] | 908 | TX_STAT_INC(qnum, xretries); |
| 909 | else |
| 910 | TX_STAT_INC(qnum, completed); |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 911 | } |
| 912 | |
Ben Greear | 4d90038 | 2013-03-04 15:31:16 -0800 | [diff] [blame] | 913 | if (ts->ts_status & ATH9K_TXERR_FILT) |
| 914 | TX_STAT_INC(qnum, txerr_filtered); |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 915 | if (ts->ts_status & ATH9K_TXERR_FIFO) |
Felix Fietkau | 066dae9 | 2010-11-07 14:59:39 +0100 | [diff] [blame] | 916 | TX_STAT_INC(qnum, fifo_underrun); |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 917 | if (ts->ts_status & ATH9K_TXERR_XTXOP) |
Felix Fietkau | 066dae9 | 2010-11-07 14:59:39 +0100 | [diff] [blame] | 918 | TX_STAT_INC(qnum, xtxop); |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 919 | if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED) |
Felix Fietkau | 066dae9 | 2010-11-07 14:59:39 +0100 | [diff] [blame] | 920 | TX_STAT_INC(qnum, timer_exp); |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 921 | if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR) |
Felix Fietkau | 066dae9 | 2010-11-07 14:59:39 +0100 | [diff] [blame] | 922 | TX_STAT_INC(qnum, desc_cfg_err); |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 923 | if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN) |
Felix Fietkau | 066dae9 | 2010-11-07 14:59:39 +0100 | [diff] [blame] | 924 | TX_STAT_INC(qnum, data_underrun); |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 925 | if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN) |
Felix Fietkau | 066dae9 | 2010-11-07 14:59:39 +0100 | [diff] [blame] | 926 | TX_STAT_INC(qnum, delim_underrun); |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 927 | } |
| 928 | |
| 929 | static const struct file_operations fops_xmit = { |
| 930 | .read = read_file_xmit, |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 931 | .open = simple_open, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 932 | .owner = THIS_MODULE, |
| 933 | .llseek = default_llseek, |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 934 | }; |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 935 | |
Sujith Manoharan | c0b7487 | 2012-11-21 18:13:12 +0530 | [diff] [blame] | 936 | static const struct file_operations fops_queues = { |
| 937 | .read = read_file_queues, |
| 938 | .open = simple_open, |
| 939 | .owner = THIS_MODULE, |
| 940 | .llseek = default_llseek, |
| 941 | }; |
| 942 | |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 943 | static const struct file_operations fops_misc = { |
| 944 | .read = read_file_misc, |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 945 | .open = simple_open, |
Ben Greear | 55f6d0f | 2011-01-17 11:54:50 -0800 | [diff] [blame] | 946 | .owner = THIS_MODULE, |
| 947 | .llseek = default_llseek, |
| 948 | }; |
| 949 | |
Sujith Manoharan | f8b815d | 2012-02-16 11:51:11 +0530 | [diff] [blame] | 950 | static const struct file_operations fops_reset = { |
| 951 | .read = read_file_reset, |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 952 | .open = simple_open, |
Sujith Manoharan | f8b815d | 2012-02-16 11:51:11 +0530 | [diff] [blame] | 953 | .owner = THIS_MODULE, |
| 954 | .llseek = default_llseek, |
| 955 | }; |
| 956 | |
Felix Fietkau | 8e6f5aa | 2010-03-29 20:09:27 -0700 | [diff] [blame] | 957 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 958 | { |
Oleksij Rempel | b5a0c86 | 2014-05-11 10:04:36 +0200 | [diff] [blame] | 959 | ath9k_cmn_debug_stat_rx(&sc->debug.stats.rxstats, rs); |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 960 | } |
| 961 | |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 962 | static ssize_t read_file_regidx(struct file *file, char __user *user_buf, |
| 963 | size_t count, loff_t *ppos) |
| 964 | { |
| 965 | struct ath_softc *sc = file->private_data; |
| 966 | char buf[32]; |
| 967 | unsigned int len; |
| 968 | |
Dan Carpenter | 2b87f3a | 2010-05-14 15:24:37 +0200 | [diff] [blame] | 969 | len = sprintf(buf, "0x%08x\n", sc->debug.regidx); |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 970 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 971 | } |
| 972 | |
| 973 | static ssize_t write_file_regidx(struct file *file, const char __user *user_buf, |
| 974 | size_t count, loff_t *ppos) |
| 975 | { |
| 976 | struct ath_softc *sc = file->private_data; |
| 977 | unsigned long regidx; |
| 978 | char buf[32]; |
| 979 | ssize_t len; |
| 980 | |
| 981 | len = min(count, sizeof(buf) - 1); |
| 982 | if (copy_from_user(buf, user_buf, len)) |
Dan Carpenter | 0423606 | 2010-05-14 15:25:39 +0200 | [diff] [blame] | 983 | return -EFAULT; |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 984 | |
| 985 | buf[len] = '\0'; |
Jingoo Han | 27d7f47 | 2013-05-31 21:24:06 +0000 | [diff] [blame] | 986 | if (kstrtoul(buf, 0, ®idx)) |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 987 | return -EINVAL; |
| 988 | |
| 989 | sc->debug.regidx = regidx; |
| 990 | return count; |
| 991 | } |
| 992 | |
| 993 | static const struct file_operations fops_regidx = { |
| 994 | .read = read_file_regidx, |
| 995 | .write = write_file_regidx, |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 996 | .open = simple_open, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 997 | .owner = THIS_MODULE, |
| 998 | .llseek = default_llseek, |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 999 | }; |
| 1000 | |
| 1001 | static ssize_t read_file_regval(struct file *file, char __user *user_buf, |
| 1002 | size_t count, loff_t *ppos) |
| 1003 | { |
| 1004 | struct ath_softc *sc = file->private_data; |
| 1005 | struct ath_hw *ah = sc->sc_ah; |
| 1006 | char buf[32]; |
| 1007 | unsigned int len; |
| 1008 | u32 regval; |
| 1009 | |
Rajkumar Manoharan | 79d2b15 | 2011-05-16 18:23:23 +0530 | [diff] [blame] | 1010 | ath9k_ps_wakeup(sc); |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 1011 | regval = REG_READ_D(ah, sc->debug.regidx); |
Rajkumar Manoharan | 79d2b15 | 2011-05-16 18:23:23 +0530 | [diff] [blame] | 1012 | ath9k_ps_restore(sc); |
Dan Carpenter | 2b87f3a | 2010-05-14 15:24:37 +0200 | [diff] [blame] | 1013 | len = sprintf(buf, "0x%08x\n", regval); |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 1014 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 1015 | } |
| 1016 | |
| 1017 | static ssize_t write_file_regval(struct file *file, const char __user *user_buf, |
| 1018 | size_t count, loff_t *ppos) |
| 1019 | { |
| 1020 | struct ath_softc *sc = file->private_data; |
| 1021 | struct ath_hw *ah = sc->sc_ah; |
| 1022 | unsigned long regval; |
| 1023 | char buf[32]; |
| 1024 | ssize_t len; |
| 1025 | |
| 1026 | len = min(count, sizeof(buf) - 1); |
| 1027 | if (copy_from_user(buf, user_buf, len)) |
Dan Carpenter | 0423606 | 2010-05-14 15:25:39 +0200 | [diff] [blame] | 1028 | return -EFAULT; |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 1029 | |
| 1030 | buf[len] = '\0'; |
Jingoo Han | 27d7f47 | 2013-05-31 21:24:06 +0000 | [diff] [blame] | 1031 | if (kstrtoul(buf, 0, ®val)) |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 1032 | return -EINVAL; |
| 1033 | |
Rajkumar Manoharan | 79d2b15 | 2011-05-16 18:23:23 +0530 | [diff] [blame] | 1034 | ath9k_ps_wakeup(sc); |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 1035 | REG_WRITE_D(ah, sc->debug.regidx, regval); |
Rajkumar Manoharan | 79d2b15 | 2011-05-16 18:23:23 +0530 | [diff] [blame] | 1036 | ath9k_ps_restore(sc); |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 1037 | return count; |
| 1038 | } |
| 1039 | |
| 1040 | static const struct file_operations fops_regval = { |
| 1041 | .read = read_file_regval, |
| 1042 | .write = write_file_regval, |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 1043 | .open = simple_open, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 1044 | .owner = THIS_MODULE, |
| 1045 | .llseek = default_llseek, |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 1046 | }; |
| 1047 | |
Vasanthakumar Thiagarajan | 582d006 | 2011-03-01 05:30:55 -0800 | [diff] [blame] | 1048 | #define REGDUMP_LINE_SIZE 20 |
| 1049 | |
| 1050 | static int open_file_regdump(struct inode *inode, struct file *file) |
| 1051 | { |
| 1052 | struct ath_softc *sc = inode->i_private; |
| 1053 | unsigned int len = 0; |
| 1054 | u8 *buf; |
| 1055 | int i; |
| 1056 | unsigned long num_regs, regdump_len, max_reg_offset; |
| 1057 | |
| 1058 | max_reg_offset = AR_SREV_9300_20_OR_LATER(sc->sc_ah) ? 0x16bd4 : 0xb500; |
| 1059 | num_regs = max_reg_offset / 4 + 1; |
| 1060 | regdump_len = num_regs * REGDUMP_LINE_SIZE + 1; |
| 1061 | buf = vmalloc(regdump_len); |
| 1062 | if (!buf) |
| 1063 | return -ENOMEM; |
| 1064 | |
| 1065 | ath9k_ps_wakeup(sc); |
| 1066 | for (i = 0; i < num_regs; i++) |
| 1067 | len += scnprintf(buf + len, regdump_len - len, |
| 1068 | "0x%06x 0x%08x\n", i << 2, REG_READ(sc->sc_ah, i << 2)); |
| 1069 | ath9k_ps_restore(sc); |
| 1070 | |
| 1071 | file->private_data = buf; |
| 1072 | |
| 1073 | return 0; |
| 1074 | } |
| 1075 | |
| 1076 | static const struct file_operations fops_regdump = { |
| 1077 | .open = open_file_regdump, |
| 1078 | .read = ath9k_debugfs_read_buf, |
| 1079 | .release = ath9k_debugfs_release_buf, |
| 1080 | .owner = THIS_MODULE, |
| 1081 | .llseek = default_llseek,/* read accesses f_pos */ |
| 1082 | }; |
| 1083 | |
Rajkumar Manoharan | d069a46 | 2011-08-13 10:28:18 +0530 | [diff] [blame] | 1084 | static ssize_t read_file_dump_nfcal(struct file *file, char __user *user_buf, |
| 1085 | size_t count, loff_t *ppos) |
| 1086 | { |
| 1087 | struct ath_softc *sc = file->private_data; |
| 1088 | struct ath_hw *ah = sc->sc_ah; |
Felix Fietkau | b01459e | 2014-06-11 16:17:59 +0530 | [diff] [blame] | 1089 | struct ath9k_nfcal_hist *h = sc->cur_chan->caldata.nfCalHist; |
Rajkumar Manoharan | d069a46 | 2011-08-13 10:28:18 +0530 | [diff] [blame] | 1090 | struct ath_common *common = ath9k_hw_common(ah); |
| 1091 | struct ieee80211_conf *conf = &common->hw->conf; |
| 1092 | u32 len = 0, size = 1500; |
| 1093 | u32 i, j; |
| 1094 | ssize_t retval = 0; |
| 1095 | char *buf; |
| 1096 | u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; |
| 1097 | u8 nread; |
| 1098 | |
| 1099 | buf = kzalloc(size, GFP_KERNEL); |
| 1100 | if (!buf) |
| 1101 | return -ENOMEM; |
| 1102 | |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 1103 | len += scnprintf(buf + len, size - len, |
| 1104 | "Channel Noise Floor : %d\n", ah->noise); |
| 1105 | len += scnprintf(buf + len, size - len, |
| 1106 | "Chain | privNF | # Readings | NF Readings\n"); |
Rajkumar Manoharan | d069a46 | 2011-08-13 10:28:18 +0530 | [diff] [blame] | 1107 | for (i = 0; i < NUM_NF_READINGS; i++) { |
| 1108 | if (!(chainmask & (1 << i)) || |
| 1109 | ((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf))) |
| 1110 | continue; |
| 1111 | |
| 1112 | nread = AR_PHY_CCA_FILTERWINDOW_LENGTH - h[i].invalidNFcount; |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 1113 | len += scnprintf(buf + len, size - len, " %d\t %d\t %d\t\t", |
| 1114 | i, h[i].privNF, nread); |
Rajkumar Manoharan | d069a46 | 2011-08-13 10:28:18 +0530 | [diff] [blame] | 1115 | for (j = 0; j < nread; j++) |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 1116 | len += scnprintf(buf + len, size - len, |
| 1117 | " %d", h[i].nfCalBuffer[j]); |
| 1118 | len += scnprintf(buf + len, size - len, "\n"); |
Rajkumar Manoharan | d069a46 | 2011-08-13 10:28:18 +0530 | [diff] [blame] | 1119 | } |
| 1120 | |
| 1121 | if (len > size) |
| 1122 | len = size; |
| 1123 | |
| 1124 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 1125 | kfree(buf); |
| 1126 | |
| 1127 | return retval; |
| 1128 | } |
| 1129 | |
| 1130 | static const struct file_operations fops_dump_nfcal = { |
| 1131 | .read = read_file_dump_nfcal, |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 1132 | .open = simple_open, |
Rajkumar Manoharan | d069a46 | 2011-08-13 10:28:18 +0530 | [diff] [blame] | 1133 | .owner = THIS_MODULE, |
| 1134 | .llseek = default_llseek, |
| 1135 | }; |
| 1136 | |
Rajkumar Manoharan | 4df50ca | 2012-10-25 17:16:54 +0530 | [diff] [blame] | 1137 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
| 1138 | static ssize_t read_file_btcoex(struct file *file, char __user *user_buf, |
| 1139 | size_t count, loff_t *ppos) |
| 1140 | { |
| 1141 | struct ath_softc *sc = file->private_data; |
| 1142 | u32 len = 0, size = 1500; |
| 1143 | char *buf; |
| 1144 | size_t retval; |
| 1145 | |
| 1146 | buf = kzalloc(size, GFP_KERNEL); |
| 1147 | if (buf == NULL) |
| 1148 | return -ENOMEM; |
| 1149 | |
Sujith Manoharan | ac46ba4 | 2012-11-19 14:24:46 +0530 | [diff] [blame] | 1150 | if (!sc->sc_ah->common.btcoex_enabled) { |
Zefir Kurtisi | 5e88ba6 | 2013-09-05 14:11:57 +0200 | [diff] [blame] | 1151 | len = scnprintf(buf, size, "%s\n", |
| 1152 | "BTCOEX is disabled"); |
Sujith Manoharan | ac46ba4 | 2012-11-19 14:24:46 +0530 | [diff] [blame] | 1153 | goto exit; |
| 1154 | } |
Rajkumar Manoharan | 4df50ca | 2012-10-25 17:16:54 +0530 | [diff] [blame] | 1155 | |
Sujith Manoharan | ac46ba4 | 2012-11-19 14:24:46 +0530 | [diff] [blame] | 1156 | len = ath9k_dump_btcoex(sc, buf, size); |
| 1157 | exit: |
Rajkumar Manoharan | 4df50ca | 2012-10-25 17:16:54 +0530 | [diff] [blame] | 1158 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 1159 | kfree(buf); |
| 1160 | |
| 1161 | return retval; |
| 1162 | } |
| 1163 | |
| 1164 | static const struct file_operations fops_btcoex = { |
| 1165 | .read = read_file_btcoex, |
| 1166 | .open = simple_open, |
| 1167 | .owner = THIS_MODULE, |
| 1168 | .llseek = default_llseek, |
| 1169 | }; |
| 1170 | #endif |
| 1171 | |
Sujith Manoharan | c175db8 | 2012-11-28 15:08:52 +0530 | [diff] [blame] | 1172 | /* Ethtool support for get-stats */ |
| 1173 | |
| 1174 | #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" |
| 1175 | static const char ath9k_gstrings_stats[][ETH_GSTRING_LEN] = { |
| 1176 | "tx_pkts_nic", |
| 1177 | "tx_bytes_nic", |
| 1178 | "rx_pkts_nic", |
| 1179 | "rx_bytes_nic", |
| 1180 | AMKSTR(d_tx_pkts), |
| 1181 | AMKSTR(d_tx_bytes), |
| 1182 | AMKSTR(d_tx_mpdus_queued), |
| 1183 | AMKSTR(d_tx_mpdus_completed), |
| 1184 | AMKSTR(d_tx_mpdu_xretries), |
| 1185 | AMKSTR(d_tx_aggregates), |
| 1186 | AMKSTR(d_tx_ampdus_queued_hw), |
| 1187 | AMKSTR(d_tx_ampdus_queued_sw), |
| 1188 | AMKSTR(d_tx_ampdus_completed), |
| 1189 | AMKSTR(d_tx_ampdu_retries), |
| 1190 | AMKSTR(d_tx_ampdu_xretries), |
| 1191 | AMKSTR(d_tx_fifo_underrun), |
| 1192 | AMKSTR(d_tx_op_exceeded), |
| 1193 | AMKSTR(d_tx_timer_expiry), |
| 1194 | AMKSTR(d_tx_desc_cfg_err), |
| 1195 | AMKSTR(d_tx_data_underrun), |
| 1196 | AMKSTR(d_tx_delim_underrun), |
Ben Greear | 18c45b1 | 2013-03-04 15:31:17 -0800 | [diff] [blame] | 1197 | "d_rx_crc_err", |
Sujith Manoharan | c175db8 | 2012-11-28 15:08:52 +0530 | [diff] [blame] | 1198 | "d_rx_decrypt_crc_err", |
| 1199 | "d_rx_phy_err", |
| 1200 | "d_rx_mic_err", |
| 1201 | "d_rx_pre_delim_crc_err", |
| 1202 | "d_rx_post_delim_crc_err", |
| 1203 | "d_rx_decrypt_busy_err", |
| 1204 | |
| 1205 | "d_rx_phyerr_radar", |
| 1206 | "d_rx_phyerr_ofdm_timing", |
| 1207 | "d_rx_phyerr_cck_timing", |
| 1208 | |
| 1209 | }; |
| 1210 | #define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats) |
| 1211 | |
| 1212 | void ath9k_get_et_strings(struct ieee80211_hw *hw, |
| 1213 | struct ieee80211_vif *vif, |
| 1214 | u32 sset, u8 *data) |
| 1215 | { |
| 1216 | if (sset == ETH_SS_STATS) |
| 1217 | memcpy(data, *ath9k_gstrings_stats, |
| 1218 | sizeof(ath9k_gstrings_stats)); |
| 1219 | } |
| 1220 | |
| 1221 | int ath9k_get_et_sset_count(struct ieee80211_hw *hw, |
| 1222 | struct ieee80211_vif *vif, int sset) |
| 1223 | { |
| 1224 | if (sset == ETH_SS_STATS) |
| 1225 | return ATH9K_SSTATS_LEN; |
| 1226 | return 0; |
| 1227 | } |
| 1228 | |
| 1229 | #define AWDATA(elem) \ |
| 1230 | do { \ |
| 1231 | data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].elem; \ |
| 1232 | data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].elem; \ |
| 1233 | data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].elem; \ |
| 1234 | data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].elem; \ |
| 1235 | } while (0) |
| 1236 | |
| 1237 | #define AWDATA_RX(elem) \ |
| 1238 | do { \ |
| 1239 | data[i++] = sc->debug.stats.rxstats.elem; \ |
| 1240 | } while (0) |
| 1241 | |
| 1242 | void ath9k_get_et_stats(struct ieee80211_hw *hw, |
| 1243 | struct ieee80211_vif *vif, |
| 1244 | struct ethtool_stats *stats, u64 *data) |
| 1245 | { |
| 1246 | struct ath_softc *sc = hw->priv; |
| 1247 | int i = 0; |
| 1248 | |
| 1249 | data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_pkts_all + |
| 1250 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_pkts_all + |
| 1251 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_pkts_all + |
| 1252 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_pkts_all); |
| 1253 | data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_bytes_all + |
| 1254 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_bytes_all + |
| 1255 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_bytes_all + |
| 1256 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_bytes_all); |
| 1257 | AWDATA_RX(rx_pkts_all); |
| 1258 | AWDATA_RX(rx_bytes_all); |
| 1259 | |
| 1260 | AWDATA(tx_pkts_all); |
| 1261 | AWDATA(tx_bytes_all); |
| 1262 | AWDATA(queued); |
| 1263 | AWDATA(completed); |
| 1264 | AWDATA(xretries); |
| 1265 | AWDATA(a_aggr); |
| 1266 | AWDATA(a_queued_hw); |
| 1267 | AWDATA(a_queued_sw); |
| 1268 | AWDATA(a_completed); |
| 1269 | AWDATA(a_retries); |
| 1270 | AWDATA(a_xretries); |
| 1271 | AWDATA(fifo_underrun); |
| 1272 | AWDATA(xtxop); |
| 1273 | AWDATA(timer_exp); |
| 1274 | AWDATA(desc_cfg_err); |
| 1275 | AWDATA(data_underrun); |
| 1276 | AWDATA(delim_underrun); |
| 1277 | |
Ben Greear | 18c45b1 | 2013-03-04 15:31:17 -0800 | [diff] [blame] | 1278 | AWDATA_RX(crc_err); |
Sujith Manoharan | c175db8 | 2012-11-28 15:08:52 +0530 | [diff] [blame] | 1279 | AWDATA_RX(decrypt_crc_err); |
| 1280 | AWDATA_RX(phy_err); |
| 1281 | AWDATA_RX(mic_err); |
| 1282 | AWDATA_RX(pre_delim_crc_err); |
| 1283 | AWDATA_RX(post_delim_crc_err); |
| 1284 | AWDATA_RX(decrypt_busy_err); |
| 1285 | |
| 1286 | AWDATA_RX(phy_err_stats[ATH9K_PHYERR_RADAR]); |
| 1287 | AWDATA_RX(phy_err_stats[ATH9K_PHYERR_OFDM_TIMING]); |
| 1288 | AWDATA_RX(phy_err_stats[ATH9K_PHYERR_CCK_TIMING]); |
| 1289 | |
| 1290 | WARN_ON(i != ATH9K_SSTATS_LEN); |
| 1291 | } |
| 1292 | |
Sujith Manoharan | af69009 | 2013-05-10 18:41:06 +0530 | [diff] [blame] | 1293 | void ath9k_deinit_debug(struct ath_softc *sc) |
| 1294 | { |
Sujith Manoharan | f65c082 | 2013-12-18 09:53:18 +0530 | [diff] [blame] | 1295 | ath9k_spectral_deinit_debug(sc); |
Sujith Manoharan | af69009 | 2013-05-10 18:41:06 +0530 | [diff] [blame] | 1296 | } |
| 1297 | |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 1298 | int ath9k_init_debug(struct ath_hw *ah) |
Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [diff] [blame] | 1299 | { |
Luis R. Rodriguez | bc974f4 | 2009-09-28 02:54:40 -0400 | [diff] [blame] | 1300 | struct ath_common *common = ath9k_hw_common(ah); |
| 1301 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 1302 | |
Ben Greear | eb27244 | 2010-11-29 14:13:22 -0800 | [diff] [blame] | 1303 | sc->debug.debugfs_phy = debugfs_create_dir("ath9k", |
| 1304 | sc->hw->wiphy->debugfsdir); |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 1305 | if (!sc->debug.debugfs_phy) |
Felix Fietkau | c8a72c0 | 2010-05-11 17:23:00 +0200 | [diff] [blame] | 1306 | return -ENOMEM; |
Sujith | 826d268 | 2008-11-28 22:20:23 +0530 | [diff] [blame] | 1307 | |
Felix Fietkau | a830df0 | 2009-11-23 22:33:27 +0100 | [diff] [blame] | 1308 | #ifdef CONFIG_ATH_DEBUG |
Felix Fietkau | c70cab1 | 2011-03-19 13:55:37 +0100 | [diff] [blame] | 1309 | debugfs_create_file("debug", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
| 1310 | sc, &fops_debug); |
Felix Fietkau | a830df0 | 2009-11-23 22:33:27 +0100 | [diff] [blame] | 1311 | #endif |
Zefir Kurtisi | 29942bc | 2011-12-14 20:16:34 -0800 | [diff] [blame] | 1312 | |
| 1313 | ath9k_dfs_init_debug(sc); |
Sujith Manoharan | ef6b19e | 2013-10-24 12:04:39 +0530 | [diff] [blame] | 1314 | ath9k_tx99_init_debug(sc); |
Sujith Manoharan | f65c082 | 2013-12-18 09:53:18 +0530 | [diff] [blame] | 1315 | ath9k_spectral_init_debug(sc); |
Zefir Kurtisi | 29942bc | 2011-12-14 20:16:34 -0800 | [diff] [blame] | 1316 | |
Felix Fietkau | c70cab1 | 2011-03-19 13:55:37 +0100 | [diff] [blame] | 1317 | debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc, |
| 1318 | &fops_dma); |
| 1319 | debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc, |
| 1320 | &fops_interrupt); |
Felix Fietkau | c70cab1 | 2011-03-19 13:55:37 +0100 | [diff] [blame] | 1321 | debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, sc, |
| 1322 | &fops_xmit); |
Sujith Manoharan | c0b7487 | 2012-11-21 18:13:12 +0530 | [diff] [blame] | 1323 | debugfs_create_file("queues", S_IRUSR, sc->debug.debugfs_phy, sc, |
| 1324 | &fops_queues); |
Felix Fietkau | 7702e78 | 2012-07-15 19:53:35 +0200 | [diff] [blame] | 1325 | debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
Sujith Manoharan | bea843c | 2012-11-21 18:13:10 +0530 | [diff] [blame] | 1326 | &sc->tx.txq_max_pending[IEEE80211_AC_BK]); |
Felix Fietkau | 7702e78 | 2012-07-15 19:53:35 +0200 | [diff] [blame] | 1327 | debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
Sujith Manoharan | bea843c | 2012-11-21 18:13:10 +0530 | [diff] [blame] | 1328 | &sc->tx.txq_max_pending[IEEE80211_AC_BE]); |
Felix Fietkau | 7702e78 | 2012-07-15 19:53:35 +0200 | [diff] [blame] | 1329 | debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
Sujith Manoharan | bea843c | 2012-11-21 18:13:10 +0530 | [diff] [blame] | 1330 | &sc->tx.txq_max_pending[IEEE80211_AC_VI]); |
Felix Fietkau | 7702e78 | 2012-07-15 19:53:35 +0200 | [diff] [blame] | 1331 | debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
Sujith Manoharan | bea843c | 2012-11-21 18:13:10 +0530 | [diff] [blame] | 1332 | &sc->tx.txq_max_pending[IEEE80211_AC_VO]); |
Felix Fietkau | c70cab1 | 2011-03-19 13:55:37 +0100 | [diff] [blame] | 1333 | debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy, sc, |
| 1334 | &fops_misc); |
Sujith Manoharan | f8b815d | 2012-02-16 11:51:11 +0530 | [diff] [blame] | 1335 | debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc, |
| 1336 | &fops_reset); |
Oleksij Rempel | 87ea9b0 | 2014-05-11 10:04:37 +0200 | [diff] [blame] | 1337 | |
| 1338 | ath9k_cmn_debug_recv(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); |
Oleksij Rempel | e02912c | 2014-05-11 10:04:39 +0200 | [diff] [blame] | 1339 | ath9k_cmn_debug_phy_err(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); |
Oleksij Rempel | 87ea9b0 | 2014-05-11 10:04:37 +0200 | [diff] [blame] | 1340 | |
Felix Fietkau | ca6d4a7 | 2013-08-13 12:33:27 +0200 | [diff] [blame] | 1341 | debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy, |
| 1342 | &ah->rxchainmask); |
| 1343 | debugfs_create_u8("tx_chainmask", S_IRUSR, sc->debug.debugfs_phy, |
| 1344 | &ah->txchainmask); |
Sujith Manoharan | 6e4d291 | 2013-06-03 09:19:28 +0530 | [diff] [blame] | 1345 | debugfs_create_file("ani", S_IRUSR | S_IWUSR, |
| 1346 | sc->debug.debugfs_phy, sc, &fops_ani); |
Felix Fietkau | 74673db | 2012-09-08 15:24:17 +0200 | [diff] [blame] | 1347 | debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
| 1348 | &sc->sc_ah->config.enable_paprd); |
Felix Fietkau | c70cab1 | 2011-03-19 13:55:37 +0100 | [diff] [blame] | 1349 | debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
| 1350 | sc, &fops_regidx); |
| 1351 | debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
| 1352 | sc, &fops_regval); |
| 1353 | debugfs_create_bool("ignore_extcca", S_IRUSR | S_IWUSR, |
| 1354 | sc->debug.debugfs_phy, |
| 1355 | &ah->config.cwm_ignore_extcca); |
| 1356 | debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy, sc, |
| 1357 | &fops_regdump); |
Rajkumar Manoharan | d069a46 | 2011-08-13 10:28:18 +0530 | [diff] [blame] | 1358 | debugfs_create_file("dump_nfcal", S_IRUSR, sc->debug.debugfs_phy, sc, |
| 1359 | &fops_dump_nfcal); |
Oleksij Rempel | f2c3c95 | 2014-05-11 10:04:31 +0200 | [diff] [blame] | 1360 | |
Oleksij Rempel | 29bf801 | 2014-05-11 10:04:33 +0200 | [diff] [blame] | 1361 | ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); |
Oleksij Rempel | f2c3c95 | 2014-05-11 10:04:31 +0200 | [diff] [blame] | 1362 | ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); |
| 1363 | |
Felix Fietkau | 691680b | 2011-03-19 13:55:38 +0100 | [diff] [blame] | 1364 | debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, |
| 1365 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); |
Felix Fietkau | 691680b | 2011-03-19 13:55:38 +0100 | [diff] [blame] | 1366 | debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, |
| 1367 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); |
Sujith Manoharan | 4eba10c | 2013-07-29 16:04:49 +0530 | [diff] [blame] | 1368 | debugfs_create_file("antenna_diversity", S_IRUSR, |
| 1369 | sc->debug.debugfs_phy, sc, &fops_antenna_diversity); |
Rajkumar Manoharan | 4df50ca | 2012-10-25 17:16:54 +0530 | [diff] [blame] | 1370 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
Sujith Manoharan | 36e8825 | 2013-08-06 12:44:15 +0530 | [diff] [blame] | 1371 | debugfs_create_file("bt_ant_diversity", S_IRUSR | S_IWUSR, |
| 1372 | sc->debug.debugfs_phy, sc, &fops_bt_ant_diversity); |
Rajkumar Manoharan | 4df50ca | 2012-10-25 17:16:54 +0530 | [diff] [blame] | 1373 | debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc, |
| 1374 | &fops_btcoex); |
| 1375 | #endif |
Luis R. Rodriguez | 89f927a | 2013-10-14 17:42:11 -0700 | [diff] [blame] | 1376 | |
Sujith | 826d268 | 2008-11-28 22:20:23 +0530 | [diff] [blame] | 1377 | return 0; |
Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [diff] [blame] | 1378 | } |