summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMarkus Niebel <Markus.Niebel@tq-group.com>2014-11-18 15:11:42 +0100
committerPantelis Antoniou <pantelis.antoniou@konsulko.com>2014-12-12 20:28:04 +0200
commitd7b2912991bb18db26b6c6b51cdc637142e21d3e (patch)
tree59d7c0dfd3fda275beed537fee4014ef02fc532d /drivers
parente75eaf100bdf01b94757e2b40365b46a7d380275 (diff)
downloadtalos-obmc-uboot-d7b2912991bb18db26b6c6b51cdc637142e21d3e.tar.gz
talos-obmc-uboot-d7b2912991bb18db26b6c6b51cdc637142e21d3e.zip
MMC: fix user capacity for partitioned eMMC card
if the card claims to be high capacity and the card is partitioned the capacity shall still be read from ext_csd SEC_COUNT even if the resulting capacity is smaller than 2 GiB Signed-off-by: Markus Niebel <Markus.Niebel@tq-group.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/mmc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 9dc924c412..4a8cf65f79 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1022,6 +1022,21 @@ static int mmc_startup(struct mmc *mmc)
mmc->erase_grp_size =
ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] *
MMC_MAX_BLOCK_LEN * 1024;
+ /*
+ * if high capacity and partition setting completed
+ * SEC_COUNT is valid even if it is smaller than 2 GiB
+ * JEDEC Standard JESD84-B45, 6.2.4
+ */
+ if (mmc->high_capacity &&
+ (ext_csd[EXT_CSD_PARTITION_SETTING] &
+ EXT_CSD_PARTITION_SETTING_COMPLETED)) {
+ capacity = (ext_csd[EXT_CSD_SEC_CNT]) |
+ (ext_csd[EXT_CSD_SEC_CNT + 1] << 8) |
+ (ext_csd[EXT_CSD_SEC_CNT + 2] << 16) |
+ (ext_csd[EXT_CSD_SEC_CNT + 3] << 24);
+ capacity *= MMC_MAX_BLOCK_LEN;
+ mmc->capacity_user = capacity;
+ }
} else {
/* Calculate the group size from the csd value. */
int erase_gsz, erase_gmul;
OpenPOWER on IntegriCloud