From patchwork Thu Feb 24 08:53:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Gala X-Patchwork-Id: 84370 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 65912B70B3 for ; Thu, 24 Feb 2011 19:53:50 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 675BD28265; Thu, 24 Feb 2011 09:53:48 +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 b4B7Y5fIaobZ; Thu, 24 Feb 2011 09:53:47 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 17AAC28086; Thu, 24 Feb 2011 09:53:46 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A00E028257 for ; Thu, 24 Feb 2011 09:53:43 +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 qBZUmNDH-lwz for ; Thu, 24 Feb 2011 09:53:42 +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 gate.crashing.org (gate.crashing.org [63.228.1.57]) by theia.denx.de (Postfix) with ESMTPS id 08A9128251 for ; Thu, 24 Feb 2011 09:53:40 +0100 (CET) Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id p1O8rYtt019060; Thu, 24 Feb 2011 02:53:34 -0600 From: Kumar Gala To: u-boot@lists.denx.de Date: Thu, 24 Feb 2011 02:53:34 -0600 Message-Id: <1298537614-20797-1-git-send-email-galak@kernel.crashing.org> X-Mailer: git-send-email 1.6.0.6 Cc: Priyanka Jain , Andy Fleming Subject: [U-Boot] [PATCH] fsl_esdhc: Correcting esdhc timeout counter calculation 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 From: Priyanka Jain - Timeout counter value is set as DTOCV bits in SYSCTL register For counter value set as x, Timeout period = (2^(13+x))/SD_CLOCK - As per 4.6.2.2 section of SD Card specification v2.00, host should cofigure timeout period value to minimum 250 msec. - SD_CLOCK = mmc->trans_speed - Calculating x based on 250 msec = (2^(13+x))/mmc->trans_speed Signed-off-by: Priyanka Jain Signed-off-by: Andy Fleming Signed-off-by: Kumar Gala --- drivers/mmc/fsl_esdhc.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index c6de751..6f8a09d 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -210,7 +210,10 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data) esdhc_write32(®s->blkattr, data->blocks << 16 | data->blocksize); /* Calculate the timeout period for data transactions */ - timeout = fls(mmc->tran_speed/10) - 1; + /* Timeout period = (2^(13+timeout))/mmc->trans_speed + * Timeout period should be minimum 250msec as per SD Card spec + */ + timeout = fls(mmc->tran_speed/4); timeout -= 13; if (timeout > 14)