aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k
diff options
context:
space:
mode:
authorAlina Friedrichsen <x-alina@gmx.net>2009-01-22 23:39:13 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 16:01:21 -0500
commit8cab7581dba90b0519e25784e08feb5dedde737f (patch)
tree6ce5687004bf964e020203b0d24c241a505678b7 /drivers/net/wireless/ath5k
parentae54c985cc7daa502da6e7eb3b223a30fbbf4cfb (diff)
ath5k: Read and write the TSF via debugfs
This patch updates the ath5k specific entry in the debugfs to read and reset the TSF value, to allowing write it, too. This makes debugging the IBSS handling of wifi drivers _much_ easier. Signed-off-by: Alina Friedrichsen <x-alina@gmx.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath5k')
-rw-r--r--drivers/net/wireless/ath5k/ath5k.h1
-rw-r--r--drivers/net/wireless/ath5k/debug.c11
-rw-r--r--drivers/net/wireless/ath5k/pcu.c17
3 files changed, 27 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h
index 183ffc8e62ca..0eda785fe62f 100644
--- a/drivers/net/wireless/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath5k/ath5k.h
@@ -1206,6 +1206,7 @@ extern void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter);
1206/* Beacon control functions */ 1206/* Beacon control functions */
1207extern u32 ath5k_hw_get_tsf32(struct ath5k_hw *ah); 1207extern u32 ath5k_hw_get_tsf32(struct ath5k_hw *ah);
1208extern u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah); 1208extern u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah);
1209extern void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64);
1209extern void ath5k_hw_reset_tsf(struct ath5k_hw *ah); 1210extern void ath5k_hw_reset_tsf(struct ath5k_hw *ah);
1210extern void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval); 1211extern void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval);
1211#if 0 1212#if 0
diff --git a/drivers/net/wireless/ath5k/debug.c b/drivers/net/wireless/ath5k/debug.c
index d281b6e38629..129b72684daf 100644
--- a/drivers/net/wireless/ath5k/debug.c
+++ b/drivers/net/wireless/ath5k/debug.c
@@ -210,15 +210,22 @@ static ssize_t write_file_tsf(struct file *file,
210 size_t count, loff_t *ppos) 210 size_t count, loff_t *ppos)
211{ 211{
212 struct ath5k_softc *sc = file->private_data; 212 struct ath5k_softc *sc = file->private_data;
213 char buf[20]; 213 char buf[21];
214 unsigned long long tsf;
214 215
215 if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) 216 if (copy_from_user(buf, userbuf, min(count, sizeof(buf) - 1)))
216 return -EFAULT; 217 return -EFAULT;
218 buf[sizeof(buf) - 1] = '\0';
217 219
218 if (strncmp(buf, "reset", 5) == 0) { 220 if (strncmp(buf, "reset", 5) == 0) {
219 ath5k_hw_reset_tsf(sc->ah); 221 ath5k_hw_reset_tsf(sc->ah);
220 printk(KERN_INFO "debugfs reset TSF\n"); 222 printk(KERN_INFO "debugfs reset TSF\n");
223 } else {
224 tsf = simple_strtoul(buf, NULL, 0);
225 ath5k_hw_set_tsf64(sc->ah, tsf);
226 printk(KERN_INFO "debugfs set TSF to %#018llx\n", tsf);
221 } 227 }
228
222 return count; 229 return count;
223} 230}
224 231
diff --git a/drivers/net/wireless/ath5k/pcu.c b/drivers/net/wireless/ath5k/pcu.c
index 86f53a55b0f7..f8a4a6960270 100644
--- a/drivers/net/wireless/ath5k/pcu.c
+++ b/drivers/net/wireless/ath5k/pcu.c
@@ -646,6 +646,23 @@ u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah)
646} 646}
647 647
648/** 648/**
649 * ath5k_hw_set_tsf64 - Set a new 64bit TSF
650 *
651 * @ah: The &struct ath5k_hw
652 * @tsf64: The new 64bit TSF
653 *
654 * Sets the new TSF
655 */
656void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64)
657{
658 ATH5K_TRACE(ah->ah_sc);
659
660 ath5k_hw_reg_write(ah, 0x00000000, AR5K_TSF_L32);
661 ath5k_hw_reg_write(ah, (tsf64 >> 32) & 0xffffffff, AR5K_TSF_U32);
662 ath5k_hw_reg_write(ah, tsf64 & 0xffffffff, AR5K_TSF_L32);
663}
664
665/**
649 * ath5k_hw_reset_tsf - Force a TSF reset 666 * ath5k_hw_reset_tsf - Force a TSF reset
650 * 667 *
651 * @ah: The &struct ath5k_hw 668 * @ah: The &struct ath5k_hw