All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Fleming <afleming@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mmc: sdhci: Fixed timeout for sdhci_send_command()
Date: Tue, 1 Jul 2014 13:11:00 -0500	[thread overview]
Message-ID: <CAKWjMd6Db46+dCQwr8fR3bU53Tyf4vXmpMe33f0+yLSmuTaoFg@mail.gmail.com> (raw)
In-Reply-To: <CED9CF65-806A-42F4-A216-0BB35392698B@gmail.com>

On Fri, Jun 27, 2014 at 4:37 AM, Pantelis Antoniou <
pantelis.antoniou@gmail.com> wrote:

> Hi Eli,
>
> On Jun 12, 2014, at 12:41 PM, Eli Billauer wrote:
>
> > The current wait loop just reads the status 10000 times, which makes the
> > actual timeout period platform-dependent. The udelay() call within the
> loop
> > makes the new timeout ~100 ms.
> >
> > Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
> > ---
> > drivers/mmc/sdhci.c |    1 +
> > 1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> > index 3125d13..80f3a91 100644
> > --- a/drivers/mmc/sdhci.c
> > +++ b/drivers/mmc/sdhci.c
> > @@ -226,6 +226,7 @@ int sdhci_send_command(struct mmc *mmc, struct
> mmc_cmd *cmd,
> >                       break;
> >               if (--retry == 0)
> >                       break;
> > +             udelay(10);
> >       } while ((stat & mask) != mask);
> >
> >       if (retry == 0) {
> > --
> > 1.7.2.3
>
> Looking at the linux sources is no good, cause linux is interrupt driven.
> This delay is used because the driver is not interrupt driven, so you have
> to wait until the interrupt indication is delivered.
>
> The only reference to interrupt latency I found is related to tuning and is
> set to 50ms which I supposed is very pessimistic.
> I think a timeout of 100ms would be fine.
>
>
I suspect the timeout of 100ms is fine (though it's always nice when we tie
such numbers to something more concrete than: "it works if I make it wait
longer"). My main point was that this actually *adds* 100ms to the
preexisting timeout, instead of making the timeout ~100ms. If we reduced
the number of checks and increased the delay, the delay would completely
dominate the timeout loop, and total time would become closer to ~100ms.

Andy

  reply	other threads:[~2014-07-01 18:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12  9:41 [U-Boot] [PATCH] Timeout for SDHCI commands Eli Billauer
2014-06-12  9:41 ` [U-Boot] [PATCH] mmc: sdhci: Fixed timeout for sdhci_send_command() Eli Billauer
2014-06-19 16:43   ` Andy Fleming
2014-06-19 16:50     ` Eli Billauer
2014-06-27  9:37   ` Pantelis Antoniou
2014-07-01 18:11     ` Andy Fleming [this message]
2014-07-04 21:02     ` Steve Rae

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=CAKWjMd6Db46+dCQwr8fR3bU53Tyf4vXmpMe33f0+yLSmuTaoFg@mail.gmail.com \
    --to=afleming@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.