diff options
author | rrajk <rrajk@nvidia.com> | 2012-12-04 19:15:42 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-12-10 16:08:03 -0800 |
commit | f5e03e5936c9bae213fcc042c7e5d3e65a3643a6 (patch) | |
tree | 8ba3274729f95cbd5ca2e1feaae5604293f77858 /drivers/mmc | |
parent | 43d8065fb4391ea013aaeef14bc1cdf2068186d3 (diff) |
mmc: core: Ignore secure erase for eMMC4.5
Secure erase feature is deprecated in eMMC v4.5
specification. Use this feature only for v4.41 or
lower cards.
Bug 1172910
Change-Id: I8ce335b4636f521c710fe254cfa9fbdf518ddf6b
Signed-off-by: rrajk <rrajk@nvidia.com>
Reviewed-on: http://git-master/r/168363
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/core/mmc.c | 52 |
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]; |