summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2011-07-04 22:13:26 +0000
committerAndy Fleming <afleming@freescale.com>2011-07-15 20:29:20 -0500
commit639b7827d1caf28801775e222fe1d1dedece58f0 (patch)
treea92087d67ebd6d0bb5b415bb1662dc29cb436276 /drivers
parente75787d903e75095806f42f793328940656ea783 (diff)
downloadblackbird-obmc-uboot-639b7827d1caf28801775e222fe1d1dedece58f0.tar.gz
blackbird-obmc-uboot-639b7827d1caf28801775e222fe1d1dedece58f0.zip
mmc: fix the condition for MMC version 4
Fix the problem that if we use the chip of MMC version 4 and the capacity is smaller than 2GB or equal, the mmc->capacity is invalid. According to the JEDEC Standard, the value of ext_csd's capacity is valid if the value is more than 2GB. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Acked-by: Andy Fleming <afleming@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/mmc.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 9a1ee3d398..4e4e0fb0f3 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -853,7 +853,7 @@ int mmc_startup(struct mmc *mmc)
{
int err;
uint mult, freq;
- u64 cmult, csize;
+ u64 cmult, csize, capacity;
struct mmc_cmd cmd;
char ext_csd[512];
int timeout = 1000;
@@ -1002,9 +1002,16 @@ int mmc_startup(struct mmc *mmc)
/* 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;
+ /*
+ * According to the JEDEC Standard, the value of
+ * ext_csd's capacity is valid if the value is more
+ * than 2GB
+ */
+ capacity = ext_csd[212] << 0 | ext_csd[213] << 8 |
+ ext_csd[214] << 16 | ext_csd[215] << 24;
+ capacity *= 512;
+ if (capacity > 2 * 1024 * 1024 * 1024)
+ mmc->capacity = capacity;
}
/*
OpenPOWER on IntegriCloud