From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mmc: bcm2835: fix delays in bug workaround
Date: Fri, 22 Mar 2013 07:41:32 +0100 [thread overview]
Message-ID: <20130322074132.11ab8cb2@lilith> (raw)
In-Reply-To: <1363924938-18322-1-git-send-email-swarren@wwwdotorg.org>
Hi Stephen,
On Thu, 21 Mar 2013 22:02:18 -0600, Stephen Warren
<swarren@wwwdotorg.org> wrote:
> The back-to-back-writes workaround in the BCM2835 MMC driver assumed
> that get_timer() returned uS. Now that it returns mS, the delay is far
> too long. Use udelay() directly to avoid this. Dispense with the
> "last_write" code since we now have no way of recording an absolute
> time in uS. The difference between two un-averaged tests loading a
> zImage is 445 mS vs the original 412 mS, so the difference doesn't
> appear too relevant.
I don't entirely get the 'we have no way of recording an absolute time
in us': doesn't get_timer_us() precisely provide this absolute us time
just like 'old' get_timer(base) did? IOW, could you not simply turn
every get_timer(X) into (get_timer_us()-X)?
> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> ---
> drivers/mmc/bcm2835_sdhci.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c
> index b0afc3c..240b5ec 100644
> --- a/drivers/mmc/bcm2835_sdhci.c
> +++ b/drivers/mmc/bcm2835_sdhci.c
> @@ -46,7 +46,6 @@
> struct bcm2835_sdhci_host {
> struct sdhci_host host;
> uint twoticks_delay;
> - ulong last_write;
> };
>
> static inline struct bcm2835_sdhci_host *to_bcm(struct sdhci_host *host)
> @@ -67,11 +66,9 @@ static inline void bcm2835_sdhci_raw_writel(struct sdhci_host *host, u32 val,
> * (Which is just as well - otherwise we'd have to nobble the DMA engine
> * too)
> */
> - while (get_timer(bcm_host->last_write) < bcm_host->twoticks_delay)
> - ;
> + udelay(bcm_host->twoticks_delay);
>
> writel(val, host->ioaddr + reg);
> - bcm_host->last_write = get_timer(0);
> }
>
> static inline u32 bcm2835_sdhci_raw_readl(struct sdhci_host *host, int reg)
> @@ -172,7 +169,6 @@ int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq)
> * +1 for hack rounding.
> */
> bcm_host->twoticks_delay = ((2 * 1000000) / MIN_FREQ) + 1;
> - bcm_host->last_write = 0;
>
> host = &bcm_host->host;
> host->name = "bcm2835_sdhci";
Amicalement,
--
Albert.
next prev parent reply other threads:[~2013-03-22 6:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 4:02 [U-Boot] [PATCH] mmc: bcm2835: fix delays in bug workaround Stephen Warren
2013-03-22 6:41 ` Albert ARIBAUD [this message]
2013-03-22 15:28 ` Stephen Warren
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=20130322074132.11ab8cb2@lilith \
--to=albert.u.boot@aribaud.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox