From: "Alina Friedrichsen" <x-alina@gmx.net>
To: linux-wireless@vger.kernel.org, linville@tuxdriver.com,
johannes@sipsolutions.net
Subject: [PATCH v2] ath5k: Read and write the TSF via debugfs
Date: Fri, 23 Jan 2009 05:39:13 +0100 [thread overview]
Message-ID: <20090123043913.270710@gmx.net> (raw)
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 th=
e IBSS handling of wifi drivers _much_ easier.
Signed-off-by: Alina Friedrichsen <x-alina@gmx.net>
---
diff -urN compat-wireless-2009-01-19/drivers/net/wireless/ath5k/ath5k.h=
compat-wireless-2009-01-19.orig/drivers/net/wireless/ath5k/ath5k.h
--- compat-wireless-2009-01-19.orig/drivers/net/wireless/ath5k/ath5k.h =
2009-01-19 20:07:20.000000000 +0100
+++ compat-wireless-2009-01-19/drivers/net/wireless/ath5k/ath5k.h 2009-=
01-23 01:47:11.000000000 +0100
@@ -1206,6 +1206,7 @@
/* Beacon control functions */
extern u32 ath5k_hw_get_tsf32(struct ath5k_hw *ah);
extern u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah);
+extern void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64);
extern void ath5k_hw_reset_tsf(struct ath5k_hw *ah);
extern void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon,=
u32 interval);
#if 0
diff -urN compat-wireless-2009-01-19/drivers/net/wireless/ath5k/debug.c=
compat-wireless-2009-01-19.orig/drivers/net/wireless/ath5k/debug.c
--- compat-wireless-2009-01-19.orig/drivers/net/wireless/ath5k/debug.c =
2009-01-19 20:07:20.000000000 +0100
+++ compat-wireless-2009-01-19/drivers/net/wireless/ath5k/debug.c 2009-=
01-23 00:34:25.000000000 +0100
@@ -210,15 +210,22 @@
size_t count, loff_t *ppos)
{
struct ath5k_softc *sc =3D file->private_data;
- char buf[20];
+ char buf[21];
+ unsigned long long tsf;
=20
- if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
+ if (copy_from_user(buf, userbuf, min(count, sizeof(buf) - 1)))
return -EFAULT;
+ buf[sizeof(buf) - 1] =3D '\0';
=20
if (strncmp(buf, "reset", 5) =3D=3D 0) {
ath5k_hw_reset_tsf(sc->ah);
printk(KERN_INFO "debugfs reset TSF\n");
+ } else {
+ tsf =3D simple_strtoul(buf, NULL, 0);
+ ath5k_hw_set_tsf64(sc->ah, tsf);
+ printk(KERN_INFO "debugfs set TSF to %#018llx\n", tsf);
}
+
return count;
}
=20
diff -urN compat-wireless-2009-01-19/drivers/net/wireless/ath5k/pcu.c c=
ompat-wireless-2009-01-19.orig/drivers/net/wireless/ath5k/pcu.c
--- compat-wireless-2009-01-19.orig/drivers/net/wireless/ath5k/pcu.c 20=
09-01-19 20:07:20.000000000 +0100
+++ compat-wireless-2009-01-19/drivers/net/wireless/ath5k/pcu.c 2009-01=
-23 01:04:26.000000000 +0100
@@ -646,6 +646,23 @@
}
=20
/**
+ * ath5k_hw_set_tsf64 - Set a new 64bit TSF
+ *
+ * @ah: The &struct ath5k_hw
+ * @tsf64: The new 64bit TSF
+ *
+ * Sets the new TSF
+ */
+void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64)
+{
+ ATH5K_TRACE(ah->ah_sc);
+
+ ath5k_hw_reg_write(ah, 0x00000000, AR5K_TSF_L32);
+ ath5k_hw_reg_write(ah, (tsf64 >> 32) & 0xffffffff, AR5K_TSF_U32);
+ ath5k_hw_reg_write(ah, tsf64 & 0xffffffff, AR5K_TSF_L32);
+}
+
+/**
* ath5k_hw_reset_tsf - Force a TSF reset
*
* @ah: The &struct ath5k_hw
--=20
Psssst! Schon vom neuen GMX MultiMessenger geh=F6rt? Der kann`s mit all=
en: http://www.gmx.net/de/go/multimessenger
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
reply other threads:[~2009-01-23 4:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090123043913.270710@gmx.net \
--to=x-alina@gmx.net \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).