linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Copeland <me@bobcopeland.com>
To: ath5k-devel@lists.ath5k.org
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH] ath5k: write beacon control register twice when resetting tsf
Date: Sun, 28 Sep 2008 12:09:43 -0400	[thread overview]
Message-ID: <20080928160943.GA30901@hash.localnet> (raw)

According to the newly-released Atheros HAL code, asserting the
TSF reset bit will toggle a hardware internal state, resulting in a
spurious reset on the next chip reset.  Whenever we force a TSF bit,
write the bit twice to clear the internal signal.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
---

This was the only major difference I found between code we're currently
using in pcu.c and its equivalents in the HAL.  See comment in 
ar5212ResetTsf.  This is only compile-tested.

(There are other differences but they are in the key setup code or
beacon setup code that we are not using right now.)  

 drivers/net/wireless/ath5k/pcu.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath5k/pcu.c b/drivers/net/wireless/ath5k/pcu.c
index c77cee2..c8f9170 100644
--- a/drivers/net/wireless/ath5k/pcu.c
+++ b/drivers/net/wireless/ath5k/pcu.c
@@ -633,8 +633,20 @@ u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah)
  */
 void ath5k_hw_reset_tsf(struct ath5k_hw *ah)
 {
+	u32 val;
+
 	ATH5K_TRACE(ah->ah_sc);
-	AR5K_REG_ENABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_RESET_TSF);
+
+	val = ath5k_hw_reg_read(ah, AR5K_BEACON) | AR5K_BEACON_RESET_TSF;
+
+	/* 
+ 	 * Each write to the RESET_TSF bit toggles a hardware internal
+ 	 * signal to reset TSF, but if left high it will cause a TSF reset
+ 	 * on the next chip reset as well.  Thus we always write the value
+ 	 * twice to clear the signal.
+ 	 */
+	ath5k_hw_reg_write(ah, val, AR5K_BEACON);
+	ath5k_hw_reg_write(ah, val, AR5K_BEACON);
 }
 
 /*
-- 
1.5.4.2.182.gb3092

-- 
Bob Copeland %% www.bobcopeland.com


             reply	other threads:[~2008-09-28 16:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-28 16:09 Bob Copeland [this message]
2008-09-29 16:30 ` [ath5k-devel] [PATCH] ath5k: write beacon control register twice when resetting tsf Nick Kossifidis

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=20080928160943.GA30901@hash.localnet \
    --to=me@bobcopeland.com \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=linux-wireless@vger.kernel.org \
    /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).