From 2f9bef0398e767bde85be9c8714c259aa3ae8381 Mon Sep 17 00:00:00 2001 From: Jhinta Date: Tue, 22 May 2012 23:09:50 +0200 Subject: [PATCH] Added MMc fix --- drivers/mmc/core/mmc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 69fb2275845c..94c181b00f3b 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -279,8 +279,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) {