summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuanxiao Dong <chuanxiao.dong@intel.com>2012-03-29 11:47:03 +0800
committerbuildbot <buildbot@intel.com>2012-03-30 15:19:12 -0700
commitf7d459c66106a96218e69d590f85049f3c610bd9 (patch)
treef18f70d148f9688c2baf968b13776c143484cac4
parent185d2bf35332ff65cad014a9aa14f1b5b8f142cc (diff)
downloadkernel-mfld-blackbay-f7d459c66106a96218e69d590f85049f3c610bd9.tar.gz
kernel-mfld-blackbay-f7d459c66106a96218e69d590f85049f3c610bd9.tar.bz2
kernel-mfld-blackbay-f7d459c66106a96218e69d590f85049f3c610bd9.zip
mmc: core: rework mmc_mmc_erase_timeout function
BZ: 29554 The calculation of erase/trim timeout is not excatly the same with spec. Needs a rework. This patch can fix this. Change-Id: Ieca799d2f1c181304f5dc57e896114868fe6ed99 Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com> Reviewed-on: http://android.intel.com:8080/41560 Reviewed-by: Tang, Richard <richard.tang@intel.com> Tested-by: Sun, Jianhua <jianhua.sun@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
-rw-r--r--drivers/mmc/core/core.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 038faad7068..b13b97ca807 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1595,23 +1595,13 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
{
unsigned int erase_timeout;
- /*
- * If use trim operation, the timeout value is trim_timeout
- *
- * If use high capacity erase operations, the timeout value
- * should be hc_erase_timeout.
- *
- * If use normal erase operations for erase group, the timeout
- * should be write block timeout.
- *
- * If use secure trim/erase operation, the timeout value is
- * hc_erase_timeout * SEC_TRIM/ERASE_MULT
- */
- if (arg & MMC_TRIM_ARGS)
- erase_timeout = card->ext_csd.trim_timeout;
- else if (card->ext_csd.erase_group_def & 1)
- erase_timeout = card->ext_csd.hc_erase_timeout;
- else {
+ if (card->ext_csd.erase_group_def & 1) {
+ /* High Capacity Erase Group Size uses HC timeouts */
+ if (arg == MMC_TRIM_ARG)
+ erase_timeout = card->ext_csd.trim_timeout;
+ else
+ erase_timeout = card->ext_csd.hc_erase_timeout;
+ } else {
/* CSD Erase Group Size uses write timeout */
unsigned int mult = (10 << card->csd.r2w_factor);
unsigned int timeout_clks = card->csd.tacc_clks * mult;