From patchwork Wed Jan 22 14:27:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 182918 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp5149227ile; Wed, 22 Jan 2020 06:27:54 -0800 (PST) X-Received: by 2002:a19:5504:: with SMTP id n4mr1795190lfe.25.1579703274754; Wed, 22 Jan 2020 06:27:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579703274; cv=none; d=google.com; s=arc-20160816; b=DM7CwAfk/mGkjwEr4tleL0rIevOZvUq8oNm5H483y9AYVw6ccvAOqaO5NMev1A0ssL xrjvRvuC4G0cElCj2GUwbYaVx2iKGM+HwsgGqjDLwDb4vJn02N3RyT10Xeja//cdFwJ3 d60JAJcGT4o6VlUuqKiZkU2ZHyqA42dBZwZ/0CM/1NN7GI00kWtlSs8otrmhskSYOl1Z HlYMM88EN7q+7wu/hy/hwB3hBTVSWFknLW9sBtDx2mhzQ9L4UoRLpM/Gn9LmltvtAsbg NP55U+XxpcHxVpBDu/5WMLtdi1bVfuUq9Lnn1dIrhBaYoV+bivD4+RUtNcWg1+L5ZiWO tHzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u69ihC/ZR+aWt0/0qdjrRugRF6Lbl1PlbpQFAVv2gC4=; b=xEVMfZ8vWenD5s1yRBQxIv9STW2VvMHU4lMpA1oonDitC3JnuURQItswhW3BDG12MC LYmZ37pwIl11v5B4W1b3kLkNWixZXmaRMkLVv57irmUmwkahelH7YbrWYhb7w3gBleph CxivYBe1PM1ZK3j+94gkWrSa+lNNexkYkqpNx9WMK9rF+wp5uqHMdsHNT9IOvCinlhSP vws4zOcvUeenHTGQAmWLwhwySm0FGJD6UWYBVd7mqzL4I9iNutTE8PFZPLOffS5NcCfs zSjJKoAwan5YL4U2TzEHU4xX3uEAD0EUcX6X3FURvTTT+za1cuUXAilkKgPjKj9YRXol INjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rSQaUcuD; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id r4sor12288460lfn.69.2020.01.22.06.27.54 for (Google Transport Security); Wed, 22 Jan 2020 06:27:54 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rSQaUcuD; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=u69ihC/ZR+aWt0/0qdjrRugRF6Lbl1PlbpQFAVv2gC4=; b=rSQaUcuD9WYbFQDeILVt5uWXtC+pYCIbQTmp8rklMfgzJezqUvAmNBdusbpnMXhL9n EWdrbS4rvBkTSapeIsyu6TY4ZmacFWWuGPEWrpaQTwPAKX2Sqe269HU4+Jl70y+3X1hD ytum1u2/qb0DM+2gOimtRxoh77QvmIff2kDFsmq40gTjrpTP79wdEsPlgcBm7IJZ/tP/ pTUtKAygC7lkiDa7E26/4dfUeIyy5qfb9hIScBc1pTyO4yBj24yf/P1Ecre1MjRd080Q piTBfKDeS9NIHq5QsbjdBIOYJFOwdn9cZMjUNqznQZBfxOdYBh6jjTsWajrtcjUNlHm1 3SIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=u69ihC/ZR+aWt0/0qdjrRugRF6Lbl1PlbpQFAVv2gC4=; b=o2oI+mSKgwv0ON3CARr0ncZIftFa+JGs2gTRM+1a412f9MrbXjeUY7krjahuGAUElm aEplP6jlSZtSUKk1qJnCM//hCvb5ihcM5ZJh6NlYWRIkmNs1sCsxAcrzCnrEmTn0G9V3 LwrhhZfSDF86dXnvgToiTHmTN35D+LLU7Oz3QA3BcSGKmjBDT7EOkTbtwsFpVeKyUE4M efmX7k5bSwSoLa9zmVyQ/Rcb89lqPjy6Qp0FWg/hjgbnBPAlHhHrAVzyGAsmfCYahBpW 6EAspH7takO7eJ7KyBY4kVIBoEgXiRR6hHeFnJKKik8G8R1Zn852Oahii7e1WXXrDk5p m0Nw== X-Gm-Message-State: APjAAAXCqFXf3qxO7bwJ/FffVIeZqzRh0H3RamDbqrNzyp7Xt5Pv6SEv ZKf/X3u6wnay3JGEZ9QK6ka3E9fHt/jolg== X-Google-Smtp-Source: APXvYqz3doFCmwXxXT6oY4So5XrFSZ4pwNSnSrhsOXkF8afaGw1nGLZtjWtykC5JK4h3PWjzgjy1Bg== X-Received: by 2002:a19:c697:: with SMTP id w145mr1978294lff.54.1579703274214; Wed, 22 Jan 2020 06:27:54 -0800 (PST) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id u17sm20369548ljk.62.2020.01.22.06.27.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 06:27:52 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Adrian Hunter , Chaotian Jing , Shawn Lin , mirq-linux@rere.qmqm.pl Subject: [PATCH 1/3] mmc: core: Specify timeouts for BKOPS and CACHE_FLUSH for eMMC Date: Wed, 22 Jan 2020 15:27:45 +0100 Message-Id: <20200122142747.5690-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200122142747.5690-1-ulf.hansson@linaro.org> References: <20200122142747.5690-1-ulf.hansson@linaro.org> 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 --- drivers/mmc/core/mmc_ops.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 09113b9ad679..1966abcbc7c0 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -19,7 +19,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, @@ -941,7 +943,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); @@ -961,7 +963,8 @@ int mmc_flush_cache(struct mmc_card *card) (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);