linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benoit PAPILLAULT <benoit.papillault@free.fr>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: jirislaby@gmail.com, mickflemm@gmail.com,
	ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] ath5k: Fix 64 bits TSF reading.
Date: Mon, 08 Mar 2010 22:44:37 +0100	[thread overview]
Message-ID: <4B956FC5.40202@free.fr> (raw)
In-Reply-To: <1268036228.3819.19.camel@jlt3.sipsolutions.net>

Johannes Berg a écrit :
> On Sun, 2010-02-28 at 23:08 +0100, Benoit Papillault wrote:
>
>   
>> -	u64 tsf = ath5k_hw_reg_read(ah, AR5K_TSF_U32);
>> +	u32 tsf_lower, tsf_upper;
>> +
>> +	/*
>> +	 * While reading TSF upper and then lower part, the clock is still
>> +	 * counting so the lower part can rollover just after reading the
>> +	 * upper part. In this case, we expect the lower part to be quite
>> +	 * small (let's say less than 100us) and we would just need to read
>> +	 * the upper part again to get the correct value.
>> +	 *
>> +	 * Tested on AR2425 (AR5001)
>> +	 */
>> +
>> +	tsf_upper = ath5k_hw_reg_read(ah, AR5K_TSF_U32);
>> +	tsf_lower = ath5k_hw_reg_read(ah, AR5K_TSF_L32);
>> +
>> +	if (tsf_lower < 100)
>> +		tsf_upper = ath5k_hw_reg_read(ah, AR5K_TSF_U32);
>>     
>
> You would typically do
>
> do {
>    read upper 1
>    read lower
>    read upper 2
> } while (upper 1 != upper 2)
>
> or so but that obviously incurs another read in most cases.
>
> johannes
>
>   
Indeed. I'll redo the patch. Derek has convinced me that accuracy is 
sometimes more important than few register reads. So forget this patch.

Regards,
Benoit


      reply	other threads:[~2010-03-08 21:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4B8AE8F1.40006@free.fr>
2010-02-28 22:08 ` [PATCH] ath5k: Fix 64 bits TSF reading Benoit Papillault
2010-03-01  2:02   ` [ath5k-devel] " Derek Smithies
2010-03-01  6:47     ` Benoit PAPILLAULT
2010-03-08  8:17   ` Johannes Berg
2010-03-08 21:44     ` Benoit PAPILLAULT [this message]

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=4B956FC5.40202@free.fr \
    --to=benoit.papillault@free.fr \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=jirislaby@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mickflemm@gmail.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).