From: Kumar Gala Date: Thu, 24 Feb 2011 02:53:34 -0600 Subject: [U-Boot] [PATCH] fsl_esdhc: Correcting esdhc timeout counter calculation Message-ID: <1298537614-20797-1-git-send-email-galak@kernel.crashing.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@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) -- 1.7.2.3