[U-Boot] [PATCH 09/18] mmc: fix erase_grp_size computation with high-capacity size definition

Diego Santa Cruz Diego.SantaCruz at spinetix.com
Fri Nov 28 10:10:36 CET 2014


The erase_grp_size in struct mmc is to be a size in 512-byte sectors
but the code used to compute it for eMMC when EXT_CSD_ERASE_GROUP_DEF is
enabled computed it as bytes, leading to erase sizes and alignment
much larger than what is actually required by the mmc device.
---
 drivers/mmc/mmc.c |    3 +--
 include/mmc.h     |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index b0b4c8e..cfba0aa 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1064,8 +1064,7 @@ static int mmc_startup(struct mmc *mmc)
 
 			/* Read out group size from ext_csd */
 			mmc->erase_grp_size =
-				ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] *
-					MMC_MAX_BLOCK_LEN * 1024;
+				ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] * 1024;
 		} else {
 			/* Calculate the group size from the csd value. */
 			int erase_gsz, erase_gmul;
diff --git a/include/mmc.h b/include/mmc.h
index 8500949..fcfe9c9 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -313,7 +313,7 @@ struct mmc {
 	uint tran_speed;
 	uint read_bl_len;
 	uint write_bl_len;
-	uint erase_grp_size;
+	uint erase_grp_size;	/* in 512-byte sectors */
 	u64 capacity;
 	u64 capacity_user;
 	u64 capacity_boot;
-- 
1.7.1



More information about the U-Boot mailing list