[U-Boot] [PATCH] MMC may wrongly regconize 2GB eMMC as high capacity

Terry Lv r65388 at freescale.com
Mon Mar 21 07:03:25 CET 2011


MMC driver may wrongly regconize some 2GB eMMC as high capacity card.

This patch is based on the patch picked from community.

fc8a0985c2846292312556cba10b8a4182f55967
From: Hanumath Prasad <hanumath.prasad at stericsson.com>
Date: Tue, 10 Aug 2010 18:01:45 -0700
Subject: [PATCH] mmc: only set blockaddressed for > 2GiB cards

A non-zero value of SEC_COUNT does not indicate that the card is sector
addressed. According to the MMC specification, cards
with a densitygreater than 2GiB are sector addressed.

Signed-off-by: Terry Lv <r65388 at freescale.com>
---
 drivers/mmc/mmc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 6805b33..6f97911 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -399,7 +399,9 @@ int mmc_change_freq(struct mmc *mmc)
 	if (err)
 		return err;
 
-	if (ext_csd[212] || ext_csd[213] || ext_csd[214] || ext_csd[215])
+	/* Cards with density > 2GiB are sector addressed */
+	if ((ext_csd[212] || ext_csd[213] || ext_csd[214] || ext_csd[215]) &&
+			(mmc->capacity > (2u * 1024 * 1024 * 1024) / 512))
 		mmc->high_capacity = 1;
 
 	cardtype = ext_csd[196] & 0xf;
-- 
1.7.1




More information about the U-Boot mailing list