mmc: subtract boot sectors from disk size for eMMC 4.3+ devices

the csd sector count reported by eMMC 4.3+ cards includes the boot
partition size; subtract this from the size reported to the disk
since the boot partition is inaccessible

Change-Id: I601b83aa0159b7aa446409ea8c945b256dd0b5b1
Signed-off-by: Gary King <gking@nvidia.com>
This commit is contained in:
Gary King
2010-07-15 17:11:32 -07:00
committed by Colin Cross
parent 52525d352a
commit 2cdc235bbe
2 changed files with 7 additions and 1 deletions

View File

@@ -253,8 +253,13 @@ static int mmc_read_ext_csd(struct mmc_card *card)
ext_csd[EXT_CSD_SEC_CNT + 3] << 24;
/* Cards with density > 2GiB are sector addressed */
if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512)
if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512) {
unsigned boot_sectors;
boot_sectors = ext_csd[EXT_CSD_BOOT_SIZE_MULTI];
boot_sectors *= SZ_256K / 512;
card->ext_csd.sectors -= boot_sectors;
mmc_card_set_blockaddr(card);
}
}
switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) {

View File

@@ -262,6 +262,7 @@ struct _mmc_csd {
#define EXT_CSD_S_A_TIMEOUT 217 /* RO */
#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */
#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */
#define EXT_CSD_BOOT_SIZE_MULTI 226
#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */
#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */