From patchwork Tue May 17 18:27:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 573601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A8C0C433EF for ; Tue, 17 May 2022 18:27:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352115AbiEQS1y (ORCPT ); Tue, 17 May 2022 14:27:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240924AbiEQS1w (ORCPT ); Tue, 17 May 2022 14:27:52 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7E573A5EC; Tue, 17 May 2022 11:27:51 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id i24so17641433pfa.7; Tue, 17 May 2022 11:27:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KYtgIznm21TVQ7ViKJW4yH+KEfcmA7jYzNlTXWmB3cQ=; b=oaHCqgLaRl6UsDy08j3qFv7XdR1YqM13Lkzsa7Kq5n9noFoiVcDQIHgOMCH2iaMbWD 8lYFSo9KVs+d6pM32pUMirYkEXl43gIgmCows5n97Sh+UY2uv2VpICA99oea8RL/EFji PhtBDbjM02wySXxinEoUp6cIKQt1dxOQ0tF0eMH3YhfeCKsBwucPakGoFBjk5Z/u7Cml ETWuwg4ekzu6M+iB2aX6yZeC4SdbMEVg4nYVBKsvJmB7+XIuvZgoP4m8leOd92WABvZu 5zOYK9buwAtTEQa15/V39nAqZ1MkwkQaPnr3/IeScu0CXz3oRV5V8+MYhlgehWq1M+pZ 7oAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KYtgIznm21TVQ7ViKJW4yH+KEfcmA7jYzNlTXWmB3cQ=; b=p/+UgPMnmnmrpDxLU7eAZaMXJ8kusG6ejSUUJ4Xbnol3Avpn9QlJSbVC+8pfWmUeXx GttvQ5ilJkpPblRNYtjBp2a5/huX6k6n7cNvcoJRCbx1FLf8+c5+uXA2bE0cImNe7J2t kzVAn8KYEXAfHQrgoZB/JzxOL9LA1XpgCX6s79L05/NSnC3fFQ6B67qj35orL128vQHE o4HLlwo2UivqbcZxBQvAlunOLc9L5RiE2Op+QOvYZhVM4wrqKtQtOwc7Q1NSeXTIrbgo KTF/snjXuHFdQfl8yssgzSFVgTAtOuogMnDVxnN9fbgj428IMj414saH/pH0eGMis+a2 KS2g== X-Gm-Message-State: AOAM531UJUt64SKZpUWrt0RQeHYvgdoL4rtnYdPufjQ75fGHhVK2uceR ts6U6Q0JGRvwjj1nE5ZMyD+GYmrTYWI= X-Google-Smtp-Source: ABdhPJyU94RpW4zoa3mqcNKTQcrGOQipEy8ypld8BEQ8/eRPMIU0sdYEFkxD2GskeHX/trVhoFWvHw== X-Received: by 2002:a05:6a00:174f:b0:4fd:aed5:b5e4 with SMTP id j15-20020a056a00174f00b004fdaed5b5e4mr23895272pfc.39.1652812070948; Tue, 17 May 2022 11:27:50 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b12-20020a170902d88c00b0015e8d4eb1fasm9538656plz.68.2022.05.17.11.27.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 11:27:50 -0700 (PDT) From: Florian Fainelli To: stable@vger.kernel.org Cc: Ulf Hansson , Florian Fainelli , Adrian Hunter , Greg Kroah-Hartman , Avri Altman , Bean Huo , Nishad Kamdar , =?utf-8?q?Christian_L=C3=B6hle?= , 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 Subject: [PATCH stable 4.14 1/3] mmc: core: Specify timeouts for BKOPS and CACHE_FLUSH for eMMC Date: Tue, 17 May 2022 11:27:44 -0700 Message-Id: <20220517182746.252893-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517182746.252893-1-f.fainelli@gmail.com> References: <20220517182746.252893-1-f.fainelli@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@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 --- drivers/mmc/core/mmc_ops.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 54686ca4bfb7..44e90062c95a 100644 --- 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 *card, bool from_exception) 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 *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); From patchwork Tue May 17 18:09:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 573606 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE32EC433F5 for ; Tue, 17 May 2022 18:09:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351953AbiEQSJc (ORCPT ); Tue, 17 May 2022 14:09:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351889AbiEQSJ3 (ORCPT ); Tue, 17 May 2022 14:09:29 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37222506E4; Tue, 17 May 2022 11:09:18 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id y199so906334pfb.9; Tue, 17 May 2022 11:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vnguAOkbA//E+7XjgS8f0KtY2EXRL/p/+5JkRjLmM2s=; b=Q9H/qdYrEvvmVeIiE7g+0luXkL01xvb7EifyKIDQHPjDaLweRJj/0L8MOhOvyfF5GW 60WIy2JFz4PUtCbxON5rdhPEhoX5HNUTcqgI8AZV+cqkCMGKeEwkQHvh1lIFKhDVvTwK HjyrxsCKho7mzkLdFTj5TPoPoRrh2x0zpE1Y8jtxej2TMWtrK2Twtd6rUi3VKI4sd9CP EAPKA4W25S7C4PR4csBq3bUvfgDWdMftibmF/fyQ3aNvgfs/qX/gER3BaxYzXCwM7/p0 WY2NjPCV9nJwbXdZq7WiUsrDFmfPf0jCG56T0XJcjehF8KunZXImuu6Nib+YwHT98sCu 6AcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vnguAOkbA//E+7XjgS8f0KtY2EXRL/p/+5JkRjLmM2s=; b=Ec3C+MFlRki0lgAISXIxrj/uBpE8z6L+28tU8PPALNCMpMe7um5pLAXujrqiOAxG3l wILmAPjkJX4y+ocU3pMhxDyS5ybrHWmPfqIwyNj8qk2/GoTThN1bQctpuyldc3hnkpEu sRkCvNuWyESA9xNtqfF8RbvgizpHRY8vWRBAS4ON7F5j816eGxJAgyyrNhk4wCGFca25 bvS02v/WW85SExX71khK23jswQVkPfho33oeFmEAmsLMr/wYYbwGGU8OB3VnItwcW3IR GANef7PIVx5ao4uiyA4mieNRNI71dZuyVlJ/P1hwjUF5xlgJm7giynay1dTlbPSpJ1Fi YN+g== X-Gm-Message-State: AOAM531+03aPGQ0LWDVkitX9VY/tzZAmTm/w/aluESPap8yAaxlfHqMm Y35HtSNWxeubO38v6dWfm1DJwv0AVIQ= X-Google-Smtp-Source: ABdhPJxdU46P9h2b6klgo0rmcwK5Zb8vnEPfpro4fP3PguPGso+ErYlZdchF37ZNyabcmzi+7gU0rg== X-Received: by 2002:a63:8543:0:b0:3ab:5afb:200c with SMTP id u64-20020a638543000000b003ab5afb200cmr20025432pgd.402.1652810957154; Tue, 17 May 2022 11:09:17 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i5-20020a056a00224500b0050dc7628160sm46854pfu.58.2022.05.17.11.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 11:09:16 -0700 (PDT) From: Florian Fainelli To: stable@vger.kernel.org Cc: Ulf Hansson , Florian Fainelli , Adrian Hunter , Greg Kroah-Hartman , Avri Altman , Bean Huo , Nishad Kamdar , =?utf-8?q?Christian_L=C3=B6hle?= , 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 Subject: [PATCH stable 5.4 2/3] mmc: block: Use generic_cmd6_time when modifying INAND_CMD38_ARG_EXT_CSD Date: Tue, 17 May 2022 11:09:10 -0700 Message-Id: <20220517180911.246016-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517180911.246016-1-f.fainelli@gmail.com> References: <20220517180911.246016-1-f.fainelli@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Ulf Hansson commit ad91619aa9d78ab1c6d4a969c3db68bc331ae76c upstream The INAND_CMD38_ARG_EXT_CSD is a vendor specific EXT_CSD register, which is used to prepare an erase/trim operation. However, it doesn't make sense to use a timeout of 10 minutes while updating the register, which becomes the case when the timeout_ms argument for mmc_switch() is set to zero. Instead, let's use the generic_cmd6_time, as that seems like a reasonable timeout to use for these cases. Signed-off-by: Ulf Hansson Link: https://lore.kernel.org/r/20200122142747.5690-3-ulf.hansson@linaro.org Signed-off-by: Florian Fainelli --- drivers/mmc/core/block.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 362ad361d586..709f117fd577 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1126,7 +1126,7 @@ static void mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req) card->erase_arg == MMC_TRIM_ARG ? INAND_CMD38_ARG_TRIM : INAND_CMD38_ARG_ERASE, - 0); + card->ext_csd.generic_cmd6_time); } if (!err) err = mmc_erase(card, from, nr, card->erase_arg); @@ -1168,7 +1168,7 @@ static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, arg == MMC_SECURE_TRIM1_ARG ? INAND_CMD38_ARG_SECTRIM1 : INAND_CMD38_ARG_SECERASE, - 0); + card->ext_csd.generic_cmd6_time); if (err) goto out_retry; } @@ -1186,7 +1186,7 @@ static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, INAND_CMD38_ARG_EXT_CSD, INAND_CMD38_ARG_SECTRIM2, - 0); + card->ext_csd.generic_cmd6_time); if (err) goto out_retry; }