summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/core/mmc.c52
1 files changed, 40 insertions, 12 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 7e64a8baadc0..ddd384815f2c 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -379,14 +379,32 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
card->ext_csd.raw_hc_erase_gap_size =
ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
- card->ext_csd.raw_sec_trim_mult =
- ext_csd[EXT_CSD_SEC_TRIM_MULT];
- card->ext_csd.raw_sec_erase_mult =
- ext_csd[EXT_CSD_SEC_ERASE_MULT];
- card->ext_csd.raw_sec_feature_support =
- ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT];
+
+ /*
+ * Secure erase feature is deprecated in eMMC v4.5 specification.
+ * So, use this feature only for eMMC v4.41 or lower version cards
+ * In eMMC v4.5 secure feature support register, the Bit:0 is reserved,
+ * and Bit:6 is secure sanitize support, clearing these two bits in
+ * eMMC v4.5 cards as they set by default.
+ */
+ if (card->ext_csd.rev < 6) {
+ card->ext_csd.raw_sec_trim_mult =
+ ext_csd[EXT_CSD_SEC_TRIM_MULT];
+ card->ext_csd.raw_sec_erase_mult =
+ ext_csd[EXT_CSD_SEC_ERASE_MULT];
+ card->ext_csd.raw_sec_feature_support =
+ ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT];
+ }
+
+ else if (card->ext_csd.rev == 6) {
+ card->ext_csd.raw_sec_feature_support =
+ ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT] &
+ ~(EXT_CSD_SEC_ER_EN | EXT_CSD_SEC_SANITIZE);
+ }
+
card->ext_csd.raw_trim_mult =
ext_csd[EXT_CSD_TRIM_MULT];
+
if (card->ext_csd.rev >= 4) {
/*
* Enhanced area feature support -- check whether the eMMC
@@ -463,12 +481,22 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
MMC_BLK_DATA_AREA_GP);
}
}
- card->ext_csd.sec_trim_mult =
- ext_csd[EXT_CSD_SEC_TRIM_MULT];
- card->ext_csd.sec_erase_mult =
- ext_csd[EXT_CSD_SEC_ERASE_MULT];
- card->ext_csd.sec_feature_support =
- ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT];
+
+ if (card->ext_csd.rev < 6) {
+ card->ext_csd.sec_trim_mult =
+ ext_csd[EXT_CSD_SEC_TRIM_MULT];
+ card->ext_csd.sec_erase_mult =
+ ext_csd[EXT_CSD_SEC_ERASE_MULT];
+ card->ext_csd.sec_feature_support =
+ ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT];
+ }
+
+ if (card->ext_csd.rev == 6) {
+ card->ext_csd.sec_feature_support =
+ ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT] &
+ ~(EXT_CSD_SEC_ER_EN | EXT_CSD_SEC_SANITIZE);
+ }
+
card->ext_csd.trim_timeout = 300 *
ext_csd[EXT_CSD_TRIM_MULT];