From patchwork Sat Jul 31 14:45:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frans Meulenbroeks X-Patchwork-Id: 71800 Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id BCE7A152398 for ; Sat, 31 Jul 2010 16:45:57 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id A06D130CF534 for ; Sat, 31 Jul 2010 16:45:57 +0200 (CEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.17) for (single-drop); Sat, 31 Jul 2010 16:45:57 +0200 (CEST) Received: from murder ([192.168.8.180]) by backend2 (Cyrus v2.2.12) with LMTPA; Sat, 31 Jul 2010 16:45:46 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend1.mail.m-online.net (Cyrus v2.2.12) with LMTPA; Sat, 31 Jul 2010 16:45:46 +0200 Received: from scanner-1.m-online.net (scanner-1.mail.m-online.net [192.168.8.165]) by mail.m-online.net (Postfix) with ESMTP id 23BF41C0032F; Sat, 31 Jul 2010 16:45:46 +0200 (CEST) Received: from mxin-2.m-online.net ([192.168.1.21]) by scanner-1.m-online.net (scanner-1.m-online.net [192.168.8.165]) (amavisd-new, port 10026) with ESMTP id 14377-06; Sat, 31 Jul 2010 16:45:44 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-2.m-online.net (Postfix) with ESMTP id 3B481468D67; Sat, 31 Jul 2010 16:45:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3C7DA28186; Sat, 31 Jul 2010 16:45:39 +0200 (CEST) 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 GLk+7UCOPF94; Sat, 31 Jul 2010 16:45:38 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 371AC2812F; Sat, 31 Jul 2010 16:45:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1A6272814D for ; Sat, 31 Jul 2010 16:45:31 +0200 (CEST) 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 Q28usWKs76EN for ; Sat, 31 Jul 2010 16:45:29 +0200 (CEST) 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 mail-ew0-f44.google.com (mail-ew0-f44.google.com [209.85.215.44]) by theia.denx.de (Postfix) with ESMTP id 0B85D2812F for ; Sat, 31 Jul 2010 16:45:26 +0200 (CEST) Received: by ewy22 with SMTP id 22so902935ewy.3 for ; Sat, 31 Jul 2010 07:45:26 -0700 (PDT) Received: by 10.14.48.71 with SMTP id u47mr1553463eeb.22.1280587526494; Sat, 31 Jul 2010 07:45:26 -0700 (PDT) Received: from localhost.localdomain (j200125.upc-j.chello.nl [24.132.200.125]) by mx.google.com with ESMTPS id a48sm5237801eei.12.2010.07.31.07.45.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 31 Jul 2010 07:45:25 -0700 (PDT) From: Frans Meulenbroeks To: galak@kernel.crashing.org, Mingkai.hu@freescale.com, Fleming Andy-AFLEMING , u-boot@lists.denx.de, sbabic@denx.de Date: Sat, 31 Jul 2010 16:45:17 +0200 Message-Id: <1280587518-2097-1-git-send-email-fransmeulenbroeks@gmail.com> X-Mailer: git-send-email 1.6.4.2 Subject: [U-Boot] [PATCH 1/2] drivers/mmc/fsl_esdhc.c: increase timeout X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 X-Virus-Scanned: by amavisd-new at m-online.net some boards have problems reading from flash because the timeout is too strict. e.g. mpc8536ds had problems reading 2gb sandisk sd cl2 cards as well as 4gb transcend cl6 sdhc cards The odd thing was that a sector that sometimes could be read would not be read the next time. And the cards operate smoothly from within linux. Definitely an indication that the timeout is too strict. After increasing the timeout both cards worked like a charm. As a somewhat too large timeout does not hurt (as it is normally not reached anyway) I've reduced the timeout by changing the subtracted value from 13 to 11. Seems to work fine with me (but we could consider forgetting about tuning the value and always write 14 << 16 in the timeout register (the max timeout value). Rmember that this timeout is only used up in case of an error, so it does not delay the normal operation. Signed-off-by: Frans Meulenbroeks --- BTW: it might be that this patch crept in at this commit: http://git.denx.de/?p=u-boot.git;a=commitdiff;h=c67bee1460a0da89ef08cbc28375171acc9a4227 This one introduced a -1 in the calculation: - timeout = __ilog2(mmc->tran_speed/10); + timeout = fls(mmc->tran_speed/10) - 1; drivers/mmc/fsl_esdhc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index a368fe6..f982a69 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -208,7 +208,7 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data) /* Calculate the timeout period for data transactions */ timeout = fls(mmc->tran_speed/10) - 1; - timeout -= 13; + timeout -= 11; if (timeout > 14) timeout = 14;