+++ /dev/null
-Reason for not yet publishing: This code needs more testing.
-
-From a5a429dccaa271988a8125eb8ef0bf8f22ea8d38 Mon Sep 17 00:00:00 2001
-From: Vasanthakumar Thiagarajan <vasanth@atheros.com>
-Date: Fri, 16 Apr 2010 12:07:51 -0700
-Subject: [PATCH 1/3] ath9k: Add debugfs interface to dump registers
-
-Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
-Signed-off-by: Felix Fietkau <nbd@openwrt.org>
----
- drivers/net/wireless/ath/ath9k/debug.c | 53 +++++++++++++++++++++++++++++++-
- drivers/net/wireless/ath/ath9k/debug.h | 8 +++++
- 2 files changed, 60 insertions(+), 1 deletions(-)
-
---- a/drivers/net/wireless/ath/ath9k/debug.c
-+++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -15,6 +15,7 @@
- */
-
- #include <linux/slab.h>
-+#include <linux/vmalloc.h>
- #include <asm/unaligned.h>
-
- #include "ath9k.h"
-@@ -30,6 +31,19 @@ static int ath9k_debugfs_open(struct ino
- return 0;
- }
-
-+static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf,
-+ size_t count, loff_t *ppos)
-+{
-+ u8 *buf = file->private_data;
-+ return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
-+}
-+
-+static int ath9k_debugfs_release_buf (struct inode *inode, struct file *file)
-+{
-+ vfree(file->private_data);
-+ return 0;
-+}
-+
- #ifdef CONFIG_ATH_DEBUG
-
- static ssize_t read_file_debug(struct file *file, char __user *user_buf,
-@@ -871,6 +885,40 @@ static const struct file_operations fops
- .llseek = default_llseek,
- };
-
-+#define REGDUMP_LINE_SIZE 20
-+#define REGDUMP_NUM_REGS (0x16bd4 / 4 + 1)
-+#define REGDUMP_DATA_LEN (REGDUMP_NUM_REGS * REGDUMP_LINE_SIZE + 1)
-+
-+static int open_file_regdump(struct inode *inode, struct file *file)
-+{
-+ struct ath_softc *sc = inode->i_private;
-+ unsigned int len = 0;
-+ u8 *buf;
-+ int i;
-+
-+ buf = vmalloc(REGDUMP_DATA_LEN);
-+ if (!buf)
-+ return -ENOMEM;
-+
-+ ath9k_ps_wakeup(sc);
-+ for (i = 0; i < REGDUMP_NUM_REGS; i++)
-+ len += scnprintf(buf + len, REGDUMP_DATA_LEN - len,
-+ "0x%06x 0x%08x\n", i << 2, REG_READ(sc->sc_ah, i << 2));
-+ ath9k_ps_restore(sc);
-+
-+ file->private_data = buf;
-+
-+ return 0;
-+}
-+
-+static const struct file_operations fops_regdump = {
-+ .open = open_file_regdump,
-+ .read = ath9k_debugfs_read_buf,
-+ .release = ath9k_debugfs_release_buf,
-+ .owner = THIS_MODULE,
-+ .llseek = default_llseek,/* read accesses f_pos */
-+};
-+
- int ath9k_init_debug(struct ath_hw *ah)
- {
- struct ath_common *common = ath9k_hw_common(ah);
-@@ -927,6 +975,10 @@ int ath9k_init_debug(struct ath_hw *ah)
- sc->debug.debugfs_phy, &ah->config.cwm_ignore_extcca))
- goto err;
-
-+ if (!debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy,
-+ sc, &fops_regdump))
-+ goto err;
-+
- sc->debug.regidx = 0;
- return 0;
- err:
---- a/drivers/net/wireless/ath/ath9k/debug.h
-+++ b/drivers/net/wireless/ath/ath9k/debug.h
-@@ -160,6 +160,14 @@ struct ath_stats {
- struct ath9k_debug {
- struct dentry *debugfs_phy;
- u32 regidx;
-+ struct dentry *debugfs_debug;
-+ struct dentry *debugfs_dma;
-+ struct dentry *debugfs_interrupt;
-+ struct dentry *debugfs_rcstat;
-+ struct dentry *debugfs_wiphy;
-+ struct dentry *debugfs_xmit;
-+ struct dentry *debugfs_recv;
-+ struct dentry *debugfs_regdump;
- struct ath_stats stats;
- };
-