From patchwork Fri Mar 22 04:02:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 229881 X-Patchwork-Delegate: albert.aribaud@free.fr Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id AF4132C00BC for ; Fri, 22 Mar 2013 15:02:37 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6795F4A04B; Fri, 22 Mar 2013 05:02:35 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EfOBq3gT3MEu; Fri, 22 Mar 2013 05:02:35 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A32BB4A03C; Fri, 22 Mar 2013 05:02:33 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 230C84A03C for ; Fri, 22 Mar 2013 05:02:31 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1LAM38a9eEO6 for ; Fri, 22 Mar 2013 05:02:30 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from avon.wwwdotorg.org (avon.wwwdotorg.org [70.85.31.133]) by theia.denx.de (Postfix) with ESMTPS id BC7B74A03B for ; Fri, 22 Mar 2013 05:02:27 +0100 (CET) Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id A0DC664F8; Thu, 21 Mar 2013 22:02:30 -0600 (MDT) Received: from dart.wwwdotorg.org (c-24-9-124-73.hsd1.co.comcast.net [24.9.124.73]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 9747CE40FD; Thu, 21 Mar 2013 22:02:25 -0600 (MDT) From: Stephen Warren To: u-boot@lists.denx.de, Albert Aribaud , Andy Fleming Date: Thu, 21 Mar 2013 22:02:18 -0600 Message-Id: <1363924938-18322-1-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.7.10.4 X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.96.5 at avon.wwwdotorg.org X-Virus-Status: Clean Subject: [U-Boot] [PATCH] mmc: bcm2835: fix delays in bug workaround X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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. Signed-off-by: Stephen Warren --- 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";