2 * Copyright (c) 2008-2011 Atheros Communications Inc.
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.
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.
17 #include <linux/slab.h>
18 #include <linux/vmalloc.h>
19 #include <linux/export.h>
20 #include <asm/unaligned.h>
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))
29 void ath9k_debug_sync_cause(struct ath_softc *sc, u32 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++;
71 static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf,
72 size_t count, loff_t *ppos)
74 u8 *buf = file->private_data;
75 return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
78 static int ath9k_debugfs_release_buf(struct inode *inode, struct file *file)
80 vfree(file->private_data);
84 #ifdef CONFIG_ATH_DEBUG
86 static ssize_t read_file_debug(struct file *file, char __user *user_buf,
87 size_t count, loff_t *ppos)
89 struct ath_softc *sc = file->private_data;
90 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
94 len = sprintf(buf, "0x%08x\n", common->debug_mask);
95 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
98 static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
99 size_t count, loff_t *ppos)
101 struct ath_softc *sc = file->private_data;
102 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
107 len = min(count, sizeof(buf) - 1);
108 if (copy_from_user(buf, user_buf, len))
112 if (kstrtoul(buf, 0, &mask))
115 common->debug_mask = mask;
119 static const struct file_operations fops_debug = {
120 .read = read_file_debug,
121 .write = write_file_debug,
123 .owner = THIS_MODULE,
124 .llseek = default_llseek,
129 #define DMA_BUF_LEN 1024
132 static ssize_t read_file_ani(struct file *file, char __user *user_buf,
133 size_t count, loff_t *ppos)
135 struct ath_softc *sc = file->private_data;
136 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
137 struct ath_hw *ah = sc->sc_ah;
138 unsigned int len = 0;
139 const unsigned int size = 1024;
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 },
163 buf = kzalloc(size, GFP_KERNEL);
167 len += scnprintf(buf + len, size - len, "%15s: %s\n", "ANI",
168 common->disable_ani ? "DISABLED" : "ENABLED");
170 if (common->disable_ani)
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);
181 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
187 static ssize_t write_file_ani(struct file *file,
188 const char __user *user_buf,
189 size_t count, loff_t *ppos)
191 struct ath_softc *sc = file->private_data;
192 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
197 len = min(count, sizeof(buf) - 1);
198 if (copy_from_user(buf, user_buf, len))
202 if (kstrtoul(buf, 0, &ani))
208 common->disable_ani = !ani;
210 if (common->disable_ani) {
211 clear_bit(ATH_OP_ANI_RUN, &common->op_flags);
220 static const struct file_operations fops_ani = {
221 .read = read_file_ani,
222 .write = write_file_ani,
224 .owner = THIS_MODULE,
225 .llseek = default_llseek,
228 #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
230 static ssize_t read_file_bt_ant_diversity(struct file *file,
231 char __user *user_buf,
232 size_t count, loff_t *ppos)
234 struct ath_softc *sc = file->private_data;
235 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
239 len = sprintf(buf, "%d\n", common->bt_ant_diversity);
240 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
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)
247 struct ath_softc *sc = file->private_data;
248 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
249 struct ath9k_hw_capabilities *pCap = &sc->sc_ah->caps;
250 unsigned long bt_ant_diversity;
254 len = min(count, sizeof(buf) - 1);
255 if (copy_from_user(buf, user_buf, len))
258 if (!(pCap->hw_caps & ATH9K_HW_CAP_BT_ANT_DIV))
262 if (kstrtoul(buf, 0, &bt_ant_diversity))
265 common->bt_ant_diversity = !!bt_ant_diversity;
267 ath9k_hw_set_bt_ant_diversity(sc->sc_ah, common->bt_ant_diversity);
268 ath_dbg(common, CONFIG, "Enable WLAN/BT RX Antenna diversity: %d\n",
269 common->bt_ant_diversity);
270 ath9k_ps_restore(sc);
275 static const struct file_operations fops_bt_ant_diversity = {
276 .read = read_file_bt_ant_diversity,
277 .write = write_file_bt_ant_diversity,
279 .owner = THIS_MODULE,
280 .llseek = default_llseek,
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)
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];
292 as_main->lna_attempt_cnt[div_ant_conf->main_lna_conf]++;
293 as_alt->lna_attempt_cnt[div_ant_conf->alt_lna_conf]++;
295 as_main->rssi_avg = main_rssi_avg;
296 as_alt->rssi_avg = alt_rssi_avg;
299 static ssize_t read_file_antenna_diversity(struct file *file,
300 char __user *user_buf,
301 size_t count, loff_t *ppos)
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];
308 struct ath_hw_antcomb_conf div_ant_conf;
309 unsigned int len = 0;
310 const unsigned int size = 1024;
313 static const char *lna_conf_str[4] = {
314 "LNA1_MINUS_LNA2", "LNA2", "LNA1", "LNA1_PLUS_LNA2"
317 buf = kzalloc(size, GFP_KERNEL);
321 if (!(pCap->hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)) {
322 len += scnprintf(buf + len, size - len, "%s\n",
323 "Antenna Diversity Combining is disabled");
328 ath9k_hw_antdiv_comb_conf_get(ah, &div_ant_conf);
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",
335 len += scnprintf(buf + len, size - len, "Average ALT RSSI : %d\n\n",
337 ath9k_ps_restore(sc);
339 len += scnprintf(buf + len, size - len, "Packet Receive Cnt:\n");
340 len += scnprintf(buf + len, size - len, "-------------------\n");
342 len += scnprintf(buf + len, size - len, "%30s%15s\n",
344 len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n",
348 len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n",
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",
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",
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",
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]);
365 len += scnprintf(buf + len, size - len, "\nLNA Config Attempts:\n");
366 len += scnprintf(buf + len, size - len, "--------------------\n");
368 len += scnprintf(buf + len, size - len, "%30s%15s\n",
370 len += scnprintf(buf + len, size - len, "%-14s:%15d%15d\n",
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",
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",
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",
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]);
391 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
397 static const struct file_operations fops_antenna_diversity = {
398 .read = read_file_antenna_diversity,
400 .owner = THIS_MODULE,
401 .llseek = default_llseek,
404 static int read_file_dma(struct seq_file *file, void *data)
406 struct ath_softc *sc = file->private;
407 struct ath_hw *ah = sc->sc_ah;
408 u32 val[ATH9K_NUM_DMA_DEBUG_REGS];
409 int i, qcuOffset = 0, dcuOffset = 0;
410 u32 *qcuBase = &val[0], *dcuBase = &val[4];
414 REG_WRITE_D(ah, AR_MACMISC,
415 ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) |
416 (AR_MACMISC_MISC_OBS_BUS_1 <<
417 AR_MACMISC_MISC_OBS_BUS_MSB_S)));
419 seq_puts(file, "Raw DMA Debug values:\n");
421 for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) {
423 seq_puts(file, "\n");
425 val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32)));
426 seq_printf(file, "%d: %08x ", i, val[i]);
429 seq_puts(file, "\n\n");
430 seq_puts(file, "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n");
432 for (i = 0; i < ATH9K_NUM_QUEUES; i++, qcuOffset += 4, dcuOffset += 5) {
443 seq_printf(file, "%2d %2x %1x %2x %2x\n",
444 i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset,
445 (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3),
446 (val[2] & (0x7 << (i * 3))) >> (i * 3),
447 (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset);
450 seq_puts(file, "\n");
452 seq_printf(file, "qcu_stitch state: %2x qcu_fetch state: %2x\n",
453 (val[3] & 0x003c0000) >> 18, (val[3] & 0x03c00000) >> 22);
454 seq_printf(file, "qcu_complete state: %2x dcu_complete state: %2x\n",
455 (val[3] & 0x1c000000) >> 26, (val[6] & 0x3));
456 seq_printf(file, "dcu_arb state: %2x dcu_fp state: %2x\n",
457 (val[5] & 0x06000000) >> 25, (val[5] & 0x38000000) >> 27);
458 seq_printf(file, "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n",
459 (val[6] & 0x000003fc) >> 2, (val[6] & 0x00000400) >> 10);
460 seq_printf(file, "txfifo_valid_0: %1d txfifo_valid_1: %1d\n",
461 (val[6] & 0x00000800) >> 11, (val[6] & 0x00001000) >> 12);
462 seq_printf(file, "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n",
463 (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17);
465 seq_printf(file, "pcu observe: 0x%x\n", REG_READ_D(ah, AR_OBS_BUS_1));
466 seq_printf(file, "AR_CR: 0x%x\n", REG_READ_D(ah, AR_CR));
468 ath9k_ps_restore(sc);
473 static int open_file_dma(struct inode *inode, struct file *f)
475 return single_open(f, read_file_dma, inode->i_private);
478 static const struct file_operations fops_dma = {
479 .open = open_file_dma,
481 .owner = THIS_MODULE,
483 .release = single_release,
487 void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status)
490 sc->debug.stats.istats.total++;
491 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
492 if (status & ATH9K_INT_RXLP)
493 sc->debug.stats.istats.rxlp++;
494 if (status & ATH9K_INT_RXHP)
495 sc->debug.stats.istats.rxhp++;
496 if (status & ATH9K_INT_BB_WATCHDOG)
497 sc->debug.stats.istats.bb_watchdog++;
499 if (status & ATH9K_INT_RX)
500 sc->debug.stats.istats.rxok++;
502 if (status & ATH9K_INT_RXEOL)
503 sc->debug.stats.istats.rxeol++;
504 if (status & ATH9K_INT_RXORN)
505 sc->debug.stats.istats.rxorn++;
506 if (status & ATH9K_INT_TX)
507 sc->debug.stats.istats.txok++;
508 if (status & ATH9K_INT_TXURN)
509 sc->debug.stats.istats.txurn++;
510 if (status & ATH9K_INT_RXPHY)
511 sc->debug.stats.istats.rxphyerr++;
512 if (status & ATH9K_INT_RXKCM)
513 sc->debug.stats.istats.rx_keycache_miss++;
514 if (status & ATH9K_INT_SWBA)
515 sc->debug.stats.istats.swba++;
516 if (status & ATH9K_INT_BMISS)
517 sc->debug.stats.istats.bmiss++;
518 if (status & ATH9K_INT_BNR)
519 sc->debug.stats.istats.bnr++;
520 if (status & ATH9K_INT_CST)
521 sc->debug.stats.istats.cst++;
522 if (status & ATH9K_INT_GTT)
523 sc->debug.stats.istats.gtt++;
524 if (status & ATH9K_INT_TIM)
525 sc->debug.stats.istats.tim++;
526 if (status & ATH9K_INT_CABEND)
527 sc->debug.stats.istats.cabend++;
528 if (status & ATH9K_INT_DTIMSYNC)
529 sc->debug.stats.istats.dtimsync++;
530 if (status & ATH9K_INT_DTIM)
531 sc->debug.stats.istats.dtim++;
532 if (status & ATH9K_INT_TSFOOR)
533 sc->debug.stats.istats.tsfoor++;
534 if (status & ATH9K_INT_MCI)
535 sc->debug.stats.istats.mci++;
536 if (status & ATH9K_INT_GENTIMER)
537 sc->debug.stats.istats.gen_timer++;
540 static int read_file_interrupt(struct seq_file *file, void *data)
542 struct ath_softc *sc = file->private;
544 #define PR_IS(a, s) \
546 seq_printf(file, "%21s: %10u\n", a, \
547 sc->debug.stats.istats.s); \
550 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
553 PR_IS("WATHDOG", bb_watchdog);
557 PR_IS("RXEOL", rxeol);
558 PR_IS("RXORN", rxorn);
560 PR_IS("TXURN", txurn);
562 PR_IS("RXPHY", rxphyerr);
563 PR_IS("RXKCM", rx_keycache_miss);
565 PR_IS("BMISS", bmiss);
570 PR_IS("CABEND", cabend);
571 PR_IS("DTIMSYNC", dtimsync);
573 PR_IS("TSFOOR", tsfoor);
575 PR_IS("GENTIMER", gen_timer);
576 PR_IS("TOTAL", total);
578 seq_puts(file, "SYNC_CAUSE stats:\n");
580 PR_IS("Sync-All", sync_cause_all);
581 PR_IS("RTC-IRQ", sync_rtc_irq);
582 PR_IS("MAC-IRQ", sync_mac_irq);
583 PR_IS("EEPROM-Illegal-Access", eeprom_illegal_access);
584 PR_IS("APB-Timeout", apb_timeout);
585 PR_IS("PCI-Mode-Conflict", pci_mode_conflict);
586 PR_IS("HOST1-Fatal", host1_fatal);
587 PR_IS("HOST1-Perr", host1_perr);
588 PR_IS("TRCV-FIFO-Perr", trcv_fifo_perr);
589 PR_IS("RADM-CPL-EP", radm_cpl_ep);
590 PR_IS("RADM-CPL-DLLP-Abort", radm_cpl_dllp_abort);
591 PR_IS("RADM-CPL-TLP-Abort", radm_cpl_tlp_abort);
592 PR_IS("RADM-CPL-ECRC-Err", radm_cpl_ecrc_err);
593 PR_IS("RADM-CPL-Timeout", radm_cpl_timeout);
594 PR_IS("Local-Bus-Timeout", local_timeout);
595 PR_IS("PM-Access", pm_access);
596 PR_IS("MAC-Awake", mac_awake);
597 PR_IS("MAC-Asleep", mac_asleep);
598 PR_IS("MAC-Sleep-Access", mac_sleep_access);
603 static int open_file_interrupt(struct inode *inode, struct file *f)
605 return single_open(f, read_file_interrupt, inode->i_private);
608 static const struct file_operations fops_interrupt = {
610 .open = open_file_interrupt,
611 .owner = THIS_MODULE,
613 .release = single_release,
616 static int read_file_xmit(struct seq_file *file, void *data)
618 struct ath_softc *sc = file->private;
620 seq_printf(file, "%30s %10s%10s%10s\n\n", "BE", "BK", "VI", "VO");
622 PR("MPDUs Queued: ", queued);
623 PR("MPDUs Completed: ", completed);
624 PR("MPDUs XRetried: ", xretries);
625 PR("Aggregates: ", a_aggr);
626 PR("AMPDUs Queued HW:", a_queued_hw);
627 PR("AMPDUs Queued SW:", a_queued_sw);
628 PR("AMPDUs Completed:", a_completed);
629 PR("AMPDUs Retried: ", a_retries);
630 PR("AMPDUs XRetried: ", a_xretries);
631 PR("TXERR Filtered: ", txerr_filtered);
632 PR("FIFO Underrun: ", fifo_underrun);
633 PR("TXOP Exceeded: ", xtxop);
634 PR("TXTIMER Expiry: ", timer_exp);
635 PR("DESC CFG Error: ", desc_cfg_err);
636 PR("DATA Underrun: ", data_underrun);
637 PR("DELIM Underrun: ", delim_underrun);
638 PR("TX-Pkts-All: ", tx_pkts_all);
639 PR("TX-Bytes-All: ", tx_bytes_all);
640 PR("HW-put-tx-buf: ", puttxbuf);
641 PR("HW-tx-start: ", txstart);
642 PR("HW-tx-proc-desc: ", txprocdesc);
643 PR("TX-Failed: ", txfailed);
648 static void print_queue(struct ath_softc *sc, struct ath_txq *txq,
649 struct seq_file *file)
651 ath_txq_lock(sc, txq);
653 seq_printf(file, "%s: %d ", "qnum", txq->axq_qnum);
654 seq_printf(file, "%s: %2d ", "qdepth", txq->axq_depth);
655 seq_printf(file, "%s: %2d ", "ampdu-depth", txq->axq_ampdu_depth);
656 seq_printf(file, "%s: %3d ", "pending", txq->pending_frames);
657 seq_printf(file, "%s: %d\n", "stopped", txq->stopped);
659 ath_txq_unlock(sc, txq);
662 static int read_file_queues(struct seq_file *file, void *data)
664 struct ath_softc *sc = file->private;
667 static const char *qname[4] = {
668 "VO", "VI", "BE", "BK"
671 for (i = 0; i < IEEE80211_NUM_ACS; i++) {
672 txq = sc->tx.txq_map[i];
673 seq_printf(file, "(%s): ", qname[i]);
674 print_queue(sc, txq, file);
677 seq_puts(file, "(CAB): ");
678 print_queue(sc, sc->beacon.cabq, file);
683 static int read_file_misc(struct seq_file *file, void *data)
685 struct ath_softc *sc = file->private;
686 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
687 struct ath9k_vif_iter_data iter_data;
688 struct ath_chanctx *ctx;
692 seq_printf(file, "BSSID: %pM\n", common->curbssid);
693 seq_printf(file, "BSSID-MASK: %pM\n", common->bssidmask);
694 seq_printf(file, "OPMODE: %s\n",
695 ath_opmode_to_string(sc->sc_ah->opmode));
698 rxfilter = ath9k_hw_getrxfilter(sc->sc_ah);
699 ath9k_ps_restore(sc);
701 seq_printf(file, "RXFILTER: 0x%x", rxfilter);
703 if (rxfilter & ATH9K_RX_FILTER_UCAST)
704 seq_puts(file, " UCAST");
705 if (rxfilter & ATH9K_RX_FILTER_MCAST)
706 seq_puts(file, " MCAST");
707 if (rxfilter & ATH9K_RX_FILTER_BCAST)
708 seq_puts(file, " BCAST");
709 if (rxfilter & ATH9K_RX_FILTER_CONTROL)
710 seq_puts(file, " CONTROL");
711 if (rxfilter & ATH9K_RX_FILTER_BEACON)
712 seq_puts(file, " BEACON");
713 if (rxfilter & ATH9K_RX_FILTER_PROM)
714 seq_puts(file, " PROM");
715 if (rxfilter & ATH9K_RX_FILTER_PROBEREQ)
716 seq_puts(file, " PROBEREQ");
717 if (rxfilter & ATH9K_RX_FILTER_PHYERR)
718 seq_puts(file, " PHYERR");
719 if (rxfilter & ATH9K_RX_FILTER_MYBEACON)
720 seq_puts(file, " MYBEACON");
721 if (rxfilter & ATH9K_RX_FILTER_COMP_BAR)
722 seq_puts(file, " COMP_BAR");
723 if (rxfilter & ATH9K_RX_FILTER_PSPOLL)
724 seq_puts(file, " PSPOLL");
725 if (rxfilter & ATH9K_RX_FILTER_PHYRADAR)
726 seq_puts(file, " PHYRADAR");
727 if (rxfilter & ATH9K_RX_FILTER_MCAST_BCAST_ALL)
728 seq_puts(file, " MCAST_BCAST_ALL");
729 if (rxfilter & ATH9K_RX_FILTER_CONTROL_WRAPPER)
730 seq_puts(file, " CONTROL_WRAPPER");
732 seq_puts(file, "\n");
734 reg = sc->sc_ah->imask;
736 seq_printf(file, "INTERRUPT-MASK: 0x%x", reg);
738 if (reg & ATH9K_INT_SWBA)
739 seq_puts(file, " SWBA");
740 if (reg & ATH9K_INT_BMISS)
741 seq_puts(file, " BMISS");
742 if (reg & ATH9K_INT_CST)
743 seq_puts(file, " CST");
744 if (reg & ATH9K_INT_RX)
745 seq_puts(file, " RX");
746 if (reg & ATH9K_INT_RXHP)
747 seq_puts(file, " RXHP");
748 if (reg & ATH9K_INT_RXLP)
749 seq_puts(file, " RXLP");
750 if (reg & ATH9K_INT_BB_WATCHDOG)
751 seq_puts(file, " BB_WATCHDOG");
753 seq_puts(file, "\n");
756 ath_for_each_chanctx(sc, ctx) {
757 if (list_empty(&ctx->vifs))
759 ath9k_calculate_iter_data(sc, ctx, &iter_data);
762 "VIFS: CTX %i(%i) AP: %i STA: %i MESH: %i WDS: %i",
763 i++, (int)(ctx->assigned), iter_data.naps,
765 iter_data.nmeshes, iter_data.nwds);
766 seq_printf(file, " ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n",
767 iter_data.nadhocs, sc->cur_chan->nvifs,
774 static int read_file_reset(struct seq_file *file, void *data)
776 struct ath_softc *sc = file->private;
777 static const char * const reset_cause[__RESET_TYPE_MAX] = {
778 [RESET_TYPE_BB_HANG] = "Baseband Hang",
779 [RESET_TYPE_BB_WATCHDOG] = "Baseband Watchdog",
780 [RESET_TYPE_FATAL_INT] = "Fatal HW Error",
781 [RESET_TYPE_TX_ERROR] = "TX HW error",
782 [RESET_TYPE_TX_GTT] = "Transmit timeout",
783 [RESET_TYPE_TX_HANG] = "TX Path Hang",
784 [RESET_TYPE_PLL_HANG] = "PLL RX Hang",
785 [RESET_TYPE_MAC_HANG] = "MAC Hang",
786 [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
787 [RESET_TYPE_MCI] = "MCI Reset",
788 [RESET_TYPE_CALIBRATION] = "Calibration error",
792 for (i = 0; i < ARRAY_SIZE(reset_cause); i++) {
796 seq_printf(file, "%17s: %2d\n", reset_cause[i],
797 sc->debug.stats.reset[i]);
803 void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
804 struct ath_tx_status *ts, struct ath_txq *txq,
807 int qnum = txq->axq_qnum;
809 TX_STAT_INC(qnum, tx_pkts_all);
810 sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len;
812 if (bf_isampdu(bf)) {
813 if (flags & ATH_TX_ERROR)
814 TX_STAT_INC(qnum, a_xretries);
816 TX_STAT_INC(qnum, a_completed);
818 if (ts->ts_status & ATH9K_TXERR_XRETRY)
819 TX_STAT_INC(qnum, xretries);
821 TX_STAT_INC(qnum, completed);
824 if (ts->ts_status & ATH9K_TXERR_FILT)
825 TX_STAT_INC(qnum, txerr_filtered);
826 if (ts->ts_status & ATH9K_TXERR_FIFO)
827 TX_STAT_INC(qnum, fifo_underrun);
828 if (ts->ts_status & ATH9K_TXERR_XTXOP)
829 TX_STAT_INC(qnum, xtxop);
830 if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED)
831 TX_STAT_INC(qnum, timer_exp);
832 if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR)
833 TX_STAT_INC(qnum, desc_cfg_err);
834 if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN)
835 TX_STAT_INC(qnum, data_underrun);
836 if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
837 TX_STAT_INC(qnum, delim_underrun);
840 static int open_file_xmit(struct inode *inode, struct file *f)
842 return single_open(f, read_file_xmit, inode->i_private);
845 static const struct file_operations fops_xmit = {
847 .open = open_file_xmit,
848 .owner = THIS_MODULE,
850 .release = single_release,
853 static int open_file_queues(struct inode *inode, struct file *f)
855 return single_open(f, read_file_queues, inode->i_private);
858 static const struct file_operations fops_queues = {
860 .open = open_file_queues,
861 .owner = THIS_MODULE,
863 .release = single_release,
866 static int open_file_misc(struct inode *inode, struct file *f)
868 return single_open(f, read_file_misc, inode->i_private);
871 static const struct file_operations fops_misc = {
873 .open = open_file_misc,
874 .owner = THIS_MODULE,
876 .release = single_release,
879 static int open_file_reset(struct inode *inode, struct file *f)
881 return single_open(f, read_file_reset, inode->i_private);
884 static const struct file_operations fops_reset = {
886 .open = open_file_reset,
887 .owner = THIS_MODULE,
889 .release = single_release,
892 void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs)
894 ath9k_cmn_debug_stat_rx(&sc->debug.stats.rxstats, rs);
897 static ssize_t read_file_regidx(struct file *file, char __user *user_buf,
898 size_t count, loff_t *ppos)
900 struct ath_softc *sc = file->private_data;
904 len = sprintf(buf, "0x%08x\n", sc->debug.regidx);
905 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
908 static ssize_t write_file_regidx(struct file *file, const char __user *user_buf,
909 size_t count, loff_t *ppos)
911 struct ath_softc *sc = file->private_data;
912 unsigned long regidx;
916 len = min(count, sizeof(buf) - 1);
917 if (copy_from_user(buf, user_buf, len))
921 if (kstrtoul(buf, 0, ®idx))
924 sc->debug.regidx = regidx;
928 static const struct file_operations fops_regidx = {
929 .read = read_file_regidx,
930 .write = write_file_regidx,
932 .owner = THIS_MODULE,
933 .llseek = default_llseek,
936 static ssize_t read_file_regval(struct file *file, char __user *user_buf,
937 size_t count, loff_t *ppos)
939 struct ath_softc *sc = file->private_data;
940 struct ath_hw *ah = sc->sc_ah;
946 regval = REG_READ_D(ah, sc->debug.regidx);
947 ath9k_ps_restore(sc);
948 len = sprintf(buf, "0x%08x\n", regval);
949 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
952 static ssize_t write_file_regval(struct file *file, const char __user *user_buf,
953 size_t count, loff_t *ppos)
955 struct ath_softc *sc = file->private_data;
956 struct ath_hw *ah = sc->sc_ah;
957 unsigned long regval;
961 len = min(count, sizeof(buf) - 1);
962 if (copy_from_user(buf, user_buf, len))
966 if (kstrtoul(buf, 0, ®val))
970 REG_WRITE_D(ah, sc->debug.regidx, regval);
971 ath9k_ps_restore(sc);
975 static const struct file_operations fops_regval = {
976 .read = read_file_regval,
977 .write = write_file_regval,
979 .owner = THIS_MODULE,
980 .llseek = default_llseek,
983 #define REGDUMP_LINE_SIZE 20
985 static int open_file_regdump(struct inode *inode, struct file *file)
987 struct ath_softc *sc = inode->i_private;
988 unsigned int len = 0;
991 unsigned long num_regs, regdump_len, max_reg_offset;
993 max_reg_offset = AR_SREV_9300_20_OR_LATER(sc->sc_ah) ? 0x16bd4 : 0xb500;
994 num_regs = max_reg_offset / 4 + 1;
995 regdump_len = num_regs * REGDUMP_LINE_SIZE + 1;
996 buf = vmalloc(regdump_len);
1000 ath9k_ps_wakeup(sc);
1001 for (i = 0; i < num_regs; i++)
1002 len += scnprintf(buf + len, regdump_len - len,
1003 "0x%06x 0x%08x\n", i << 2, REG_READ(sc->sc_ah, i << 2));
1004 ath9k_ps_restore(sc);
1006 file->private_data = buf;
1011 static const struct file_operations fops_regdump = {
1012 .open = open_file_regdump,
1013 .read = ath9k_debugfs_read_buf,
1014 .release = ath9k_debugfs_release_buf,
1015 .owner = THIS_MODULE,
1016 .llseek = default_llseek,/* read accesses f_pos */
1019 static int read_file_dump_nfcal(struct seq_file *file, void *data)
1021 struct ath_softc *sc = file->private;
1022 struct ath_hw *ah = sc->sc_ah;
1023 struct ath9k_nfcal_hist *h = sc->cur_chan->caldata.nfCalHist;
1024 struct ath_common *common = ath9k_hw_common(ah);
1025 struct ieee80211_conf *conf = &common->hw->conf;
1027 u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
1030 seq_printf(file, "Channel Noise Floor : %d\n", ah->noise);
1031 seq_puts(file, "Chain | privNF | # Readings | NF Readings\n");
1032 for (i = 0; i < NUM_NF_READINGS; i++) {
1033 if (!(chainmask & (1 << i)) ||
1034 ((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf)))
1037 nread = AR_PHY_CCA_FILTERWINDOW_LENGTH - h[i].invalidNFcount;
1038 seq_printf(file, " %d\t %d\t %d\t\t", i, h[i].privNF, nread);
1039 for (j = 0; j < nread; j++)
1040 seq_printf(file, " %d", h[i].nfCalBuffer[j]);
1041 seq_puts(file, "\n");
1047 static int open_file_dump_nfcal(struct inode *inode, struct file *f)
1049 return single_open(f, read_file_dump_nfcal, inode->i_private);
1052 static const struct file_operations fops_dump_nfcal = {
1054 .open = open_file_dump_nfcal,
1055 .owner = THIS_MODULE,
1056 .llseek = seq_lseek,
1057 .release = single_release,
1060 #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
1061 static ssize_t read_file_btcoex(struct file *file, char __user *user_buf,
1062 size_t count, loff_t *ppos)
1064 struct ath_softc *sc = file->private_data;
1065 u32 len = 0, size = 1500;
1069 buf = kzalloc(size, GFP_KERNEL);
1073 if (!sc->sc_ah->common.btcoex_enabled) {
1074 len = scnprintf(buf, size, "%s\n",
1075 "BTCOEX is disabled");
1079 len = ath9k_dump_btcoex(sc, buf, size);
1081 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
1087 static const struct file_operations fops_btcoex = {
1088 .read = read_file_btcoex,
1089 .open = simple_open,
1090 .owner = THIS_MODULE,
1091 .llseek = default_llseek,
1095 #ifdef CONFIG_ATH9K_DYNACK
1096 static ssize_t read_file_ackto(struct file *file, char __user *user_buf,
1097 size_t count, loff_t *ppos)
1099 struct ath_softc *sc = file->private_data;
1100 struct ath_hw *ah = sc->sc_ah;
1104 len = sprintf(buf, "%u %c\n", ah->dynack.ackto,
1105 (ah->dynack.enabled) ? 'A' : 'S');
1107 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1110 static const struct file_operations fops_ackto = {
1111 .read = read_file_ackto,
1112 .open = simple_open,
1113 .owner = THIS_MODULE,
1114 .llseek = default_llseek,
1118 static ssize_t read_file_tpc(struct file *file, char __user *user_buf,
1119 size_t count, loff_t *ppos)
1121 struct ath_softc *sc = file->private_data;
1122 struct ath_hw *ah = sc->sc_ah;
1123 unsigned int len = 0, size = 32;
1127 buf = kzalloc(size, GFP_KERNEL);
1131 len += scnprintf(buf + len, size - len, "%s\n",
1132 ah->tpc_enabled ? "ENABLED" : "DISABLED");
1137 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
1143 static ssize_t write_file_tpc(struct file *file, const char __user *user_buf,
1144 size_t count, loff_t *ppos)
1146 struct ath_softc *sc = file->private_data;
1147 struct ath_hw *ah = sc->sc_ah;
1153 if (!AR_SREV_9300_20_OR_LATER(ah)) {
1154 /* ar9002 does not support TPC for the moment */
1158 len = min(count, sizeof(buf) - 1);
1159 if (copy_from_user(buf, user_buf, len))
1163 if (kstrtoul(buf, 0, &val))
1166 if (val < 0 || val > 1)
1169 tpc_enabled = !!val;
1171 if (tpc_enabled != ah->tpc_enabled) {
1172 ah->tpc_enabled = tpc_enabled;
1173 ath9k_hw_set_txpowerlimit(ah, sc->cur_chan->txpower, false);
1179 static const struct file_operations fops_tpc = {
1180 .read = read_file_tpc,
1181 .write = write_file_tpc,
1182 .open = simple_open,
1183 .owner = THIS_MODULE,
1184 .llseek = default_llseek,
1187 /* Ethtool support for get-stats */
1189 #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"
1190 static const char ath9k_gstrings_stats[][ETH_GSTRING_LEN] = {
1197 AMKSTR(d_tx_mpdus_queued),
1198 AMKSTR(d_tx_mpdus_completed),
1199 AMKSTR(d_tx_mpdu_xretries),
1200 AMKSTR(d_tx_aggregates),
1201 AMKSTR(d_tx_ampdus_queued_hw),
1202 AMKSTR(d_tx_ampdus_queued_sw),
1203 AMKSTR(d_tx_ampdus_completed),
1204 AMKSTR(d_tx_ampdu_retries),
1205 AMKSTR(d_tx_ampdu_xretries),
1206 AMKSTR(d_tx_fifo_underrun),
1207 AMKSTR(d_tx_op_exceeded),
1208 AMKSTR(d_tx_timer_expiry),
1209 AMKSTR(d_tx_desc_cfg_err),
1210 AMKSTR(d_tx_data_underrun),
1211 AMKSTR(d_tx_delim_underrun),
1213 "d_rx_decrypt_crc_err",
1216 "d_rx_pre_delim_crc_err",
1217 "d_rx_post_delim_crc_err",
1218 "d_rx_decrypt_busy_err",
1220 "d_rx_phyerr_radar",
1221 "d_rx_phyerr_ofdm_timing",
1222 "d_rx_phyerr_cck_timing",
1225 #define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats)
1227 void ath9k_get_et_strings(struct ieee80211_hw *hw,
1228 struct ieee80211_vif *vif,
1231 if (sset == ETH_SS_STATS)
1232 memcpy(data, *ath9k_gstrings_stats,
1233 sizeof(ath9k_gstrings_stats));
1236 int ath9k_get_et_sset_count(struct ieee80211_hw *hw,
1237 struct ieee80211_vif *vif, int sset)
1239 if (sset == ETH_SS_STATS)
1240 return ATH9K_SSTATS_LEN;
1244 #define AWDATA(elem) \
1246 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].elem; \
1247 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].elem; \
1248 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].elem; \
1249 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].elem; \
1252 #define AWDATA_RX(elem) \
1254 data[i++] = sc->debug.stats.rxstats.elem; \
1257 void ath9k_get_et_stats(struct ieee80211_hw *hw,
1258 struct ieee80211_vif *vif,
1259 struct ethtool_stats *stats, u64 *data)
1261 struct ath_softc *sc = hw->priv;
1264 data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_pkts_all +
1265 sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_pkts_all +
1266 sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_pkts_all +
1267 sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_pkts_all);
1268 data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_bytes_all +
1269 sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_bytes_all +
1270 sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_bytes_all +
1271 sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_bytes_all);
1272 AWDATA_RX(rx_pkts_all);
1273 AWDATA_RX(rx_bytes_all);
1275 AWDATA(tx_pkts_all);
1276 AWDATA(tx_bytes_all);
1281 AWDATA(a_queued_hw);
1282 AWDATA(a_queued_sw);
1283 AWDATA(a_completed);
1286 AWDATA(fifo_underrun);
1289 AWDATA(desc_cfg_err);
1290 AWDATA(data_underrun);
1291 AWDATA(delim_underrun);
1294 AWDATA_RX(decrypt_crc_err);
1297 AWDATA_RX(pre_delim_crc_err);
1298 AWDATA_RX(post_delim_crc_err);
1299 AWDATA_RX(decrypt_busy_err);
1301 AWDATA_RX(phy_err_stats[ATH9K_PHYERR_RADAR]);
1302 AWDATA_RX(phy_err_stats[ATH9K_PHYERR_OFDM_TIMING]);
1303 AWDATA_RX(phy_err_stats[ATH9K_PHYERR_CCK_TIMING]);
1305 WARN_ON(i != ATH9K_SSTATS_LEN);
1308 void ath9k_deinit_debug(struct ath_softc *sc)
1310 ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
1313 int ath9k_init_debug(struct ath_hw *ah)
1315 struct ath_common *common = ath9k_hw_common(ah);
1316 struct ath_softc *sc = (struct ath_softc *) common->priv;
1318 sc->debug.debugfs_phy = debugfs_create_dir("ath9k",
1319 sc->hw->wiphy->debugfsdir);
1320 if (!sc->debug.debugfs_phy)
1323 #ifdef CONFIG_ATH_DEBUG
1324 debugfs_create_file("debug", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1328 ath9k_dfs_init_debug(sc);
1329 ath9k_tx99_init_debug(sc);
1330 ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
1332 debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc,
1334 debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
1336 debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, sc,
1338 debugfs_create_file("queues", S_IRUSR, sc->debug.debugfs_phy, sc,
1340 debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1341 &sc->tx.txq_max_pending[IEEE80211_AC_BK]);
1342 debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1343 &sc->tx.txq_max_pending[IEEE80211_AC_BE]);
1344 debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1345 &sc->tx.txq_max_pending[IEEE80211_AC_VI]);
1346 debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1347 &sc->tx.txq_max_pending[IEEE80211_AC_VO]);
1348 debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy, sc,
1350 debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc,
1353 ath9k_cmn_debug_recv(sc->debug.debugfs_phy, &sc->debug.stats.rxstats);
1354 ath9k_cmn_debug_phy_err(sc->debug.debugfs_phy, &sc->debug.stats.rxstats);
1356 debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy,
1358 debugfs_create_u8("tx_chainmask", S_IRUSR, sc->debug.debugfs_phy,
1360 debugfs_create_file("ani", S_IRUSR | S_IWUSR,
1361 sc->debug.debugfs_phy, sc, &fops_ani);
1362 debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1363 &sc->sc_ah->config.enable_paprd);
1364 debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1366 debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1368 debugfs_create_bool("ignore_extcca", S_IRUSR | S_IWUSR,
1369 sc->debug.debugfs_phy,
1370 &ah->config.cwm_ignore_extcca);
1371 debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy, sc,
1373 debugfs_create_file("dump_nfcal", S_IRUSR, sc->debug.debugfs_phy, sc,
1376 ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah);
1377 ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah);
1379 debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
1380 sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
1381 debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR,
1382 sc->debug.debugfs_phy, &sc->sc_ah->gpio_val);
1383 debugfs_create_file("antenna_diversity", S_IRUSR,
1384 sc->debug.debugfs_phy, sc, &fops_antenna_diversity);
1385 #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
1386 debugfs_create_file("bt_ant_diversity", S_IRUSR | S_IWUSR,
1387 sc->debug.debugfs_phy, sc, &fops_bt_ant_diversity);
1388 debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc,
1392 #ifdef CONFIG_ATH9K_DYNACK
1393 debugfs_create_file("ack_to", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
1396 debugfs_create_file("tpc", S_IRUSR | S_IWUSR,
1397 sc->debug.debugfs_phy, sc, &fops_tpc);