mmc: core: rework mmc_mmc_erase_timeout function
authorChuanxiao Dong <chuanxiao.dong@intel.com>
Thu, 29 Mar 2012 03:47:03 +0000 (11:47 +0800)
committerbuildbot <buildbot@intel.com>
Fri, 30 Mar 2012 22:19:12 +0000 (15:19 -0700)
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>
drivers/mmc/core/core.c

index 038faad..b13b97c 100644 (file)
@@ -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;