Skip to content

Commit 24ed3bd

Browse files
committed
mmc: core: Specify timeouts for BKOPS and CACHE_FLUSH for eMMC
The timeout values used while waiting for a CMD6 for BKOPS or a CACHE_FLUSH to complete, are not defined by the eMMC spec. However, a timeout of 10 minutes as is currently being used, is just silly for both of these cases. Instead, let's specify more reasonable timeouts, 120s for BKOPS and 30s for CACHE_FLUSH. Signed-off-by: Ulf Hansson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1d45a3f commit 24ed3bd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/mmc/core/mmc_ops.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#include "host.h"
2020
#include "mmc_ops.h"
2121

22-
#define MMC_OPS_TIMEOUT_MS (10 * 60 * 1000) /* 10 minute timeout */
22+
#define MMC_OPS_TIMEOUT_MS (10 * 60 * 1000) /* 10min*/
23+
#define MMC_BKOPS_TIMEOUT_MS (120 * 1000) /* 120s */
24+
#define MMC_CACHE_FLUSH_TIMEOUT_MS (30 * 1000) /* 30s */
2325

2426
static const u8 tuning_blk_pattern_4bit[] = {
2527
0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc,
@@ -941,7 +943,7 @@ void mmc_run_bkops(struct mmc_card *card)
941943
* urgent levels by using an asynchronous background task, when idle.
942944
*/
943945
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
944-
EXT_CSD_BKOPS_START, 1, MMC_OPS_TIMEOUT_MS);
946+
EXT_CSD_BKOPS_START, 1, MMC_BKOPS_TIMEOUT_MS);
945947
if (err)
946948
pr_warn("%s: Error %d starting bkops\n",
947949
mmc_hostname(card->host), err);
@@ -961,7 +963,8 @@ int mmc_flush_cache(struct mmc_card *card)
961963
(card->ext_csd.cache_size > 0) &&
962964
(card->ext_csd.cache_ctrl & 1)) {
963965
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
964-
EXT_CSD_FLUSH_CACHE, 1, 0);
966+
EXT_CSD_FLUSH_CACHE, 1,
967+
MMC_CACHE_FLUSH_TIMEOUT_MS);
965968
if (err)
966969
pr_err("%s: cache flush error %d\n",
967970
mmc_hostname(card->host), err);

0 commit comments

Comments
 (0)