Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2111586ioo; Mon, 23 May 2022 10:17:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHEm+5RJ6RyQvZC65PLL4E77IVQZtmMB8R9ShIBOx1r5Q9zoqMdhFzlgVqEpZEx3UBLJSz X-Received: by 2002:a17:902:f708:b0:153:839f:bf2c with SMTP id h8-20020a170902f70800b00153839fbf2cmr23615013plo.113.1653326259089; Mon, 23 May 2022 10:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326259; cv=none; d=google.com; s=arc-20160816; b=Ip+sN1Z/Lx2kjR8e85zmhYII72xBEsmZ0FMN+VrpfpeqpPSdHKpYSfduyEfsuBBoAU 3NN29qA350ACc8sP82VscK6uLhx2LghOOFLiNPZoYPVPc8ffbpAeCITVvjIQm+uHaMC9 dg/EgQSxDR3aozFPN/h/8bOVeRNBis4yUlcFhtP6KSBwsWGU5pJE+Wny24cvbUpTThuz 1cLEFSh/5Q2pD/EjSTihL7Oh6+3he/MEgiaCNsxsWQrvMlzY3yFmlzYbRWUwqjEbieHB nyVoEyi/2ALgCviC+sxIymULFiPWmAJySmILPxDupHoy0B5Z9TejVlhiXW2Bj3Ex3NSC U7JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oR/iN0/p+WzNFPwPgaEBwSnGNvLlawVT5u1PtNi6SNE=; b=rDV036uwJbnnPkdFA9FkkzK5dDKARxNxWoc+BHXisAPMCV9EmGN989AEKGWFHF65Vv YO2yUNZW/NGPooTXl9K82Y0wCQgqKR96XzzcXQ/ODPMES651wt1UMHxFFtWXYUP7A5qX AXse6drNIXUVYWKbpg3FHEpxYv0WclFmjwI6cCQ6ZWEiY+pPlQNxy7THGqmPEE4B1Qjr OxYddHt6m+cYjJgIk+sMEIztvTlS6wegB506qPzugLMt7Npbphg4F9NG7ayaP2y1uhPy sSTzDnE3+KRU08IoPRCcf4v+51Aol2IJvWNj6EahtOO8OJBwzKVSy0hqvFKwULnl0EE+ z9Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L4xE2yrJ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l22-20020a056a0016d600b005182bb020a3si9876954pfc.174.2022.05.23.10.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:17:39 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L4xE2yrJ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C09C061622; Mon, 23 May 2022 10:16:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240027AbiEWRLf (ORCPT + 99 others); Mon, 23 May 2022 13:11:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239649AbiEWRKT (ORCPT ); Mon, 23 May 2022 13:10:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28E456CA83; Mon, 23 May 2022 10:09:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D17E2B811FF; Mon, 23 May 2022 17:09:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35896C385A9; Mon, 23 May 2022 17:09:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325782; bh=uaVtAjgPGgzXjaW6iUUkGMw3JPgNjOG8AApm91RvokI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L4xE2yrJVLvdm8qYkMs1gjBJTgveQXtJn1D8LdUAjnq92olGvndxh9FWMu/MNlyMd QxXiUjRn4q5sQdpO2PnmixLhms+GWc2ZANf66fLQdwK1i/RGxy2pH2HT0y3ISGavYo XVcPTKpz0ZykxdfMmkpmrjEeJemRCcgMe08ZHANE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Ulf Hansson , Florian Fainelli Subject: [PATCH 4.14 11/33] mmc: core: Specify timeouts for BKOPS and CACHE_FLUSH for eMMC Date: Mon, 23 May 2022 19:05:00 +0200 Message-Id: <20220523165749.400451941@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165746.957506211@linuxfoundation.org> References: <20220523165746.957506211@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson 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 Link: https://lore.kernel.org/r/20200122142747.5690-2-ulf.hansson@linaro.org Signed-off-by: Florian Fainelli Signed-off-by: Greg Kroah-Hartman --- 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, @@ -979,7 +981,7 @@ void mmc_start_bkops(struct mmc_card *ca mmc_claim_host(card->host); if (card->ext_csd.raw_bkops_status >= EXT_CSD_BKOPS_LEVEL_2) { - timeout = MMC_OPS_TIMEOUT_MS; + timeout = MMC_BKOPS_TIMEOUT_MS; use_busy_signal = true; } else { timeout = 0; @@ -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);