[U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc operation
Ghorai, Sukumar
s-ghorai at ti.com
Mon Sep 20 15:28:23 CEST 2010
> -----Original Message-----
> From: Lei Wen [mailto:adrian.wenl at gmail.com]
> Sent: Monday, September 20, 2010 6:29 PM
> To: Ghorai, Sukumar
> Cc: Wolfgang Denk; Lei Wen; u-boot at lists.denx.de; sshtylyov at mvista.com
> Subject: Re: [U-Boot] [PATCH 1/2 V3] mmc: add boundary check for mmc
> operation
>
> Hi Ghorai,
>
> >
> > [Ghorai] I was using the latest mmc/sd core for OMAP 4 and getting the
> following error.
> > OMAP4430 SDP # mmc rescan 1
> > MMC: block number 0x1 exceeds max(0x0)OMAP4430 SDP #
> >
> > Please let me know what I am missing.
[Ghorai] Thanks.
I found the problem. It's a eMMC size calculation is wrong and here is the fix I am sending as a patch too in my next email.
From: Sukumar Ghorai <s-ghorai at ti.com>
Date: Mon, 20 Sep 2010 18:29:29 +0530
Subject: [PATCH 1/3] fix for eMMC capacity calculation
capacity of the eMMC device available in ext-CSD register only
Signed-off-by: Sukumar Ghorai <s-ghorai at ti.com>
---
drivers/mmc/mmc.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 80cd9bf..c543d83 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -627,6 +627,7 @@ int mmc_startup(struct mmc *mmc)
uint mult, freq;
u64 cmult, csize;
struct mmc_cmd cmd;
+ char ext_csd[512];
/* Put the Card in Identify Mode */
cmd.cmdidx = MMC_CMD_ALL_SEND_CID;
@@ -742,6 +743,16 @@ int mmc_startup(struct mmc *mmc)
if (err)
return err;
+ if (!IS_SD(mmc) && (mmc->version >= MMC_VERSION_4)) {
+ /* check ext_csd version and capacity */
+ err = mmc_send_ext_csd(mmc, ext_csd);
+ if (!err & (ext_csd[192] >= 2)) {
+ mmc->capacity = ext_csd[212] << 0 | ext_csd[213] << 8 |
+ ext_csd[214] << 16 | ext_csd[215] << 24;
+ mmc->capacity *= 512;
+ }
+ }
+
if (IS_SD(mmc))
err = sd_change_freq(mmc);
else
--
1.7.0.4
> >
>
> I also test the latest code, and don't find the issue you report...
> What would happen when you type "mmcinfo 1"? Seems your mmc card is
> not init properly.
>
> Best regards,
> Lei
More information about the U-Boot
mailing list