Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f25a2fcb authored by Ulf Hansson's avatar Ulf Hansson Committed by Greg Kroah-Hartman
Browse files

mmc: core: Specify timeouts for BKOPS and CACHE_FLUSH for eMMC



commit 24ed3bd01d6a844fd5e8a75f48d0a3d10ed71bf9 upstream

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: default avatarUlf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20200122142747.5690-2-ulf.hansson@linaro.org


Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aae3dc55
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -23,7 +23,9 @@
#include "host.h"
#include "mmc_ops.h"

#define MMC_OPS_TIMEOUT_MS	(10 * 60 * 1000) /* 10 minute timeout */
#define MMC_OPS_TIMEOUT_MS		(10 * 60 * 1000) /* 10min*/
#define MMC_BKOPS_TIMEOUT_MS		(120 * 1000) /* 120s */
#define MMC_CACHE_FLUSH_TIMEOUT_MS	(30 * 1000) /* 30s */

static const u8 tuning_blk_pattern_4bit[] = {
	0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc,
@@ -947,7 +949,7 @@ void mmc_run_bkops(struct mmc_card *card)
	 * urgent levels by using an asynchronous background task, when idle.
	 */
	err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
			EXT_CSD_BKOPS_START, 1, MMC_OPS_TIMEOUT_MS);
			 EXT_CSD_BKOPS_START, 1, MMC_BKOPS_TIMEOUT_MS);
	if (err)
		pr_warn("%s: Error %d starting bkops\n",
			mmc_hostname(card->host), err);
@@ -965,7 +967,8 @@ int mmc_flush_cache(struct mmc_card *card)

	if (mmc_cache_enabled(card->host)) {
		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
				EXT_CSD_FLUSH_CACHE, 1, 0);
				 EXT_CSD_FLUSH_CACHE, 1,
				 MMC_CACHE_FLUSH_TIMEOUT_MS);
		if (err)
			pr_err("%s: cache flush error %d\n",
					mmc_hostname(card->host), err);