blob: e8f121ab0243c728f46b0e9f21bfa82ee55fdccb [file] [log] [blame]
From foo@baz Thu May 19 04:19:37 PM CEST 2022
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 17 May 2022 11:27:44 -0700
Subject: mmc: core: Specify timeouts for BKOPS and CACHE_FLUSH for eMMC
To: stable@vger.kernel.org
Cc: "Ulf Hansson" <ulf.hansson@linaro.org>, "Florian Fainelli" <f.fainelli@gmail.com>, "Adrian Hunter" <adrian.hunter@intel.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Avri Altman" <avri.altman@wdc.com>, "Bean Huo" <beanhuo@micron.com>, "Nishad Kamdar" <nishadkamdar@gmail.com>, "Christian Löhle" <CLoehle@hyperstone.com>, linux-mmc@vger.kernel.org (open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...), linux-kernel@vger.kernel.org (open list), alcooperx@gmail.com, kdasu.kdev@gmail.com
Message-ID: <20220517182746.252893-2-f.fainelli@gmail.com>
From: Ulf Hansson <ulf.hansson@linaro.org>
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: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20200122142747.5690-2-ulf.hansson@linaro.org
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/core/mmc_ops.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -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,
@@ -989,7 +991,7 @@ void mmc_start_bkops(struct mmc_card *ca
mmc_retune_hold(card->host);
err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
- EXT_CSD_BKOPS_START, 1, timeout, 0,
+ EXT_CSD_BKOPS_START, 1, MMC_BKOPS_TIMEOUT_MS, 0,
use_busy_signal, true, false);
if (err) {
pr_warn("%s: Error %d starting bkops\n",
@@ -1022,7 +1024,8 @@ int mmc_flush_cache(struct mmc_card *car
(card->ext_csd.cache_size > 0) &&
(card->ext_csd.cache_ctrl & 1)) {
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);