]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mmc: read the size of eMMC enhanced user data area
authorDiego Santa Cruz <Diego.SantaCruz@spinetix.com>
Tue, 23 Dec 2014 09:50:22 +0000 (10:50 +0100)
committerPantelis Antoniou <pantelis.antoniou@konsulko.com>
Mon, 19 Jan 2015 15:02:29 +0000 (17:02 +0200)
This modification reads the size of the eMMC enhanced user data area
upon initialization of an mmc device, it will be used later by
mmcinfo.

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

index 86c4db9f6f725ecff5588d651c37c72715cc729c..f07505f556401cfd6a07c2cc83999b0edbacb57c 100644 (file)
@@ -1031,6 +1031,21 @@ static int mmc_startup(struct mmc *mmc)
                                has_parts = true;
                }
 
                                has_parts = true;
                }
 
+               mmc->enh_user_size =
+                       (ext_csd[EXT_CSD_ENH_SIZE_MULT+2] << 16) +
+                       (ext_csd[EXT_CSD_ENH_SIZE_MULT+1] << 8) +
+                       ext_csd[EXT_CSD_ENH_SIZE_MULT];
+               mmc->enh_user_size *= ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE];
+               mmc->enh_user_size *= ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
+               mmc->enh_user_size <<= 19;
+               mmc->enh_user_start =
+                       (ext_csd[EXT_CSD_ENH_START_ADDR+3] << 24) +
+                       (ext_csd[EXT_CSD_ENH_START_ADDR+2] << 16) +
+                       (ext_csd[EXT_CSD_ENH_START_ADDR+1] << 8) +
+                       ext_csd[EXT_CSD_ENH_START_ADDR];
+               if (mmc->high_capacity)
+                       mmc->enh_user_start <<= 9;
+
                /*
                 * Host needs to enable ERASE_GRP_DEF bit if device is
                 * partitioned. This bit will be lost every time after a reset
                /*
                 * Host needs to enable ERASE_GRP_DEF bit if device is
                 * partitioned. This bit will be lost every time after a reset
index 69c60706df9c419e06f830b2a5e7d78b66919952..18155c9d6cd5774321ddc2cf3a209276407add0f 100644 (file)
 /*
  * EXT_CSD fields
  */
 /*
  * EXT_CSD fields
  */
+#define EXT_CSD_ENH_START_ADDR         136     /* R/W */
+#define EXT_CSD_ENH_SIZE_MULT          140     /* R/W */
 #define EXT_CSD_GP_SIZE_MULT           143     /* R/W */
 #define EXT_CSD_PARTITION_SETTING      155     /* R/W */
 #define EXT_CSD_PARTITIONS_ATTRIBUTE   156     /* R/W */
 #define EXT_CSD_GP_SIZE_MULT           143     /* R/W */
 #define EXT_CSD_PARTITION_SETTING      155     /* R/W */
 #define EXT_CSD_PARTITIONS_ATTRIBUTE   156     /* R/W */
@@ -319,6 +321,8 @@ struct mmc {
        u64 capacity_boot;
        u64 capacity_rpmb;
        u64 capacity_gp[4];
        u64 capacity_boot;
        u64 capacity_rpmb;
        u64 capacity_gp[4];
+       u64 enh_user_start;
+       u64 enh_user_size;
        block_dev_desc_t block_dev;
        char op_cond_pending;   /* 1 if we are waiting on an op_cond command */
        char init_in_progress;  /* 1 if we have done mmc_start_init() */
        block_dev_desc_t block_dev;
        char op_cond_pending;   /* 1 if we are waiting on an op_cond command */
        char init_in_progress;  /* 1 if we have done mmc_start_init() */