Skip to content

Commit 2f9bef0

Browse files
committed
Added MMc fix
1 parent 89042df commit 2f9bef0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/mmc/core/mmc.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,13 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
279279
ext_csd[EXT_CSD_SEC_CNT + 3] << 24;
280280

281281
/* Cards with density > 2GiB are sector addressed */
282-
if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512)
282+
if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512) {
283+
unsigned boot_sectors;
284+
/* size is in 256K chunks, i.e. 512 sectors each */
285+
boot_sectors = ext_csd[EXT_CSD_BOOT_MULT] * 512;
286+
card->ext_csd.sectors -= boot_sectors;
283287
mmc_card_set_blockaddr(card);
288+
}
284289
}
285290
card->ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE];
286291
switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) {

0 commit comments

Comments
 (0)