diff options
author | Gary King <gking@nvidia.com> | 2011-12-13 01:22:08 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2011-12-26 16:42:08 +0800 |
commit | e5aed2a1838fcdcf068a125fd5c61fe368b77278 (patch) | |
tree | 34238336d8bde11647a6f94949b882f7017e3273 /drivers | |
parent | 7aff3e773c511fd7cfd57c9870b71b65ef768c0c (diff) |
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
(Updated by andy.green@linaro.org to use official EXT_CSD... now in mainline)
Change-Id: I601b83aa0159b7aa446409ea8c945b256dd0b5b1
Signed-off-by: Gary King <gking@nvidia.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/core/mmc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index d240427c124..99799e07b1c 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -281,8 +281,13 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) 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; + /* size is in 256K chunks, i.e. 512 sectors each */ + boot_sectors = ext_csd[EXT_CSD_BOOT_MULT] * 512; + card->ext_csd.sectors -= boot_sectors; mmc_card_set_blockaddr(card); + } } card->ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) { |