]> git.sur5r.net Git - u-boot/commitdiff
mmc: fix erase_grp_size computation with high-capacity size definition
authorDiego Santa Cruz <Diego.SantaCruz@spinetix.com>
Tue, 23 Dec 2014 09:50:24 +0000 (10:50 +0100)
committerPantelis Antoniou <pantelis.antoniou@konsulko.com>
Mon, 19 Jan 2015 15:02:29 +0000 (17:02 +0200)
The erase_grp_size in struct mmc is to be a size in 512-byte sectors
but the code used to compute it for eMMC when EXT_CSD_ERASE_GROUP_DEF is
enabled computed it as bytes, leading to erase sizes and alignment
much larger than what is actually required by the mmc device.

Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
drivers/mmc/mmc.c
include/mmc.h

index f07505f556401cfd6a07c2cc83999b0edbacb57c..be211016cf5df42e95e8365ae5a8ccdde61889d2 100644 (file)
@@ -1068,8 +1068,7 @@ static int mmc_startup(struct mmc *mmc)
 
                        /* Read out group size from ext_csd */
                        mmc->erase_grp_size =
-                               ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] *
-                                       MMC_MAX_BLOCK_LEN * 1024;
+                               ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] * 1024;
                        /*
                         * if high capacity and partition setting completed
                         * SEC_COUNT is valid even if it is smaller than 2 GiB
index 18155c9d6cd5774321ddc2cf3a209276407add0f..6c8bbfc952b4184349010c29a9391cc7c204bcb8 100644 (file)
@@ -315,7 +315,7 @@ struct mmc {
        uint tran_speed;
        uint read_bl_len;
        uint write_bl_len;
-       uint erase_grp_size;
+       uint erase_grp_size;    /* in 512-byte sectors */
        u64 capacity;
        u64 capacity_user;
        u64 capacity_boot;