linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Holger Schurig <hs4233@mail.mn-solutions.de>
To: libertas-dev@lists.infradead.org
Cc: "John W. Linville" <linville@tuxdriver.com>,
	Dan Williams <dcbw@redhat.com>,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH, take 2] libertas: fixes for slow hardware
Date: Wed, 10 Oct 2007 09:24:11 +0200	[thread overview]
Message-ID: <200710100924.11565.hs4233@mail.mn-solutions.de> (raw)
In-Reply-To: <20071009211822.GA3175@tuxdriver.com>

> > @@ -148,11 +148,11 @@ static int
> > if_cs_poll_while_fw_download( {
> >  	int i;
> >
> > -	for (i = 0; i < 500; i++) {
> > +	for (i = 0; i < 1000; i++) {
> >  		u8 val = if_cs_read8(card, addr);
> >  		if (val == reg)
> >  			return i;
> > -		udelay(100);
> > +		udelay(500);
> >  	}
> >  	return -ETIME;
> >  }
>
> 10x the maximum delay?  Is this really necessary?
>
> How did you determine this was needed?

For my hardware, it was not necessary. My CF card worked with the 
old settings.

The documentation, in 2.2.1.2 "CF Interface" says at point 3. a)

   "The host polls this for 50 ms before declaring a failure on
   the particular block of firmware being downloaded".

Some lines below, in the section about the real firmware (the 
former citation was from the section about the helper firmware), 
it just says in "8.", after polling card status register:

   "The is no definite time period that the host polls this bit
   before declaring a failure on this particular block of
   firmware".

and in "9.", after card configuration and scratch port register:

   "The host polls this 50ms before declaring a failure ..."

So, two times it's 50ms, once it's unspecified.





For me 50ms worked in all cases (my hardware actually reacts in 
way less than 50 millisends). 

However, Vitaly sent this patch, he had hardware where the 
firmware download was failing with the original approach and 
where it was necessary to make those values larger. I'm actually 
don't know in which of the three cases it failed for him. But 
this code piece isn't so time critical:

* the routine will only called during firmware download, not for 
normal operation. Especially not when sending commands, 
receiving responses or sending/receiving packets

* for my hardware, I never reach the upper ceilings, the routine 
routines always way faster.

This are my findings how often it spun loops in 
if_cs_poll_while_fw_download():

* While programming the helper firmware: 10 * 1 loop
* While programming the real firmware, 1 * 0 loop, 363 * 1 loop
* While waiting for the expected value in the scratch pad 
register: 88 loops

With the original code:

* While programming the helper firmware: 8 * 3 loops, 2 * 1 loop
* While programming the real firmware: 1 * 0 loop, 363 * 1 loop
* While waiting for the expected value in the scratch pad 
register: 434 loops



> If it really is necessary, you need to change the "The host
> polls the Card Status register for 50 ms..." comment in
> if_cs_prog_helper as well.

As this is an excerpt from the docs, I don't want to change this 
arbitrary.

My problem is that I don't have the hardware that failed with the 
original code. If I would have this hardware, I would have 
changed if_cs_poll_while_fw_download() so that I could specify 
the amount of time it should wait. Or so that I can change the 
number of loops it should wait.

      reply	other threads:[~2007-10-10  7:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08  9:18 [PATCH] libertas: fixes for slow hardware Holger Schurig
2007-10-08 13:15 ` Dan Williams
2007-10-09  8:41   ` [PATCH, take 2] " Holger Schurig
2007-10-09 11:18     ` Dan Williams
2007-10-09 21:18     ` John W. Linville
2007-10-10  7:24       ` Holger Schurig [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=200710100924.11565.hs4233@mail.mn-solutions.de \
    --to=hs4233@mail.mn-solutions.de \
    --cc=dcbw@redhat.com \
    --cc=libertas-dev@lists.infradead.org \
    --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).