summaryrefslogtreecommitdiff
path: root/drivers/mmc/mmc.c
diff options
context:
space:
mode:
authorDiego Santa Cruz <Diego.SantaCruz@spinetix.com>2014-12-23 10:50:25 +0100
committerPantelis Antoniou <pantelis.antoniou@konsulko.com>2015-01-19 17:02:29 +0200
commit037dc0ab5dff36984d97735987dff01a7ec73893 (patch)
tree44d5c457ea5ee33b65ca061b3a57ac515a52d938 /drivers/mmc/mmc.c
parenta4ff9f83f5f902717e87c05cf9d2d02b472d4257 (diff)
downloadu-boot-imx-037dc0ab5dff36984d97735987dff01a7ec73893.zip
u-boot-imx-037dc0ab5dff36984d97735987dff01a7ec73893.tar.gz
u-boot-imx-037dc0ab5dff36984d97735987dff01a7ec73893.tar.bz2
mmc: read the high capacity WP group size for eMMC
Read the eMMC high capacity write protect group size at mmc device initialization. This is useful to correctly partition an eMMC device, as partitions need to be aligned to this size. Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r--drivers/mmc/mmc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index be21101..16a7a90 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1065,7 +1065,9 @@ static int mmc_startup(struct mmc *mmc)
return err;
else
ext_csd[EXT_CSD_ERASE_GROUP_DEF] = 1;
+ }
+ if (ext_csd[EXT_CSD_ERASE_GROUP_DEF] & 0x01) {
/* Read out group size from ext_csd */
mmc->erase_grp_size =
ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] * 1024;
@@ -1092,6 +1094,10 @@ static int mmc_startup(struct mmc *mmc)
mmc->erase_grp_size = (erase_gsz + 1)
* (erase_gmul + 1);
}
+
+ mmc->hc_wp_grp_size = 1024
+ * ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE]
+ * ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
}
err = mmc_set_capacity(mmc, mmc->part_num);