From patchwork Tue Mar 24 18:07:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 11456153 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F6C314B4 for ; Tue, 24 Mar 2020 18:08:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 415672076E for ; Tue, 24 Mar 2020 18:08:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="npCbnLl6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728014AbgCXSII (ORCPT ); Tue, 24 Mar 2020 14:08:08 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:44489 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727382AbgCXSII (ORCPT ); Tue, 24 Mar 2020 14:08:08 -0400 Received: by mail-lf1-f65.google.com with SMTP id j188so10197694lfj.11 for ; Tue, 24 Mar 2020 11:08:06 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=5E1VJzGwtosUipNZawyOp6QQ2qvHexwnEsdNcedQu34=; b=npCbnLl6rCS6PMqC396BY+LfqiKGtkTxvbNgpTQM2IG+qbkagX3mG9unHZNiqPbtzN HjcXlqfhLcvKWtacfuTNq6h2S+W2LtoJwe6ag/2hoR2sV02g+Bg4GxOVqDgHtJDqmKeV E2YvasBMpwUUmr9HLSWkWDJNYQ2K2r0o7gHI7umykeQ476OEHHZIZK3oH8Yy+0RR16ZP b4uta55OslLMO+cSMjUzZbvpPXQjvBFDHS8IAMapTmfOY57E9Hf+EFdVzi5aJ3HIojt1 pQgI7Uth/eTjzVLMNLFs8liTp3fpdMWT07yl+50eVkGxgK7nN0nrnmu8Rx8C5TYBYoEi gYKw== 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:mime-version:content-transfer-encoding; bh=5E1VJzGwtosUipNZawyOp6QQ2qvHexwnEsdNcedQu34=; b=bREFlMZNUA3YTt2LLd4jqpPp+zr0HmeI3Eo612jjfSpwO/w0Yxa8b1BTxllAzqiRj2 2yrResLMbfrEV4jk7pDM+ia7Vk8gSH0cOq9f4Z+ki0Nzwwu22SDzW23+uY37hbJ8NQ8u WYLmKRM1XS/sMbFG4aH/YR/R3OfyyFiWHLaeQpRNQGhAgjJfaPCszatMqCJ2RDu6gct2 fR9YkoBFRfn6OCzRWFhG0/Nw5O4OXQ29Ow+gVX3lx25v1pLj7QjgS25v/KWZnPVeT4Mz dtBZswVAxd39Yc9c/UXiM7bMdCDghf9EaVT34j414BLFGX5nbjx9Whg27qagjyg/n/6c 3IjA== X-Gm-Message-State: ANhLgQ1woAcy0UTqBm6imryORY29Ra8CY8ticGhfeOWrb3tgi7wMQsgh poddSqj0wXfznBC8niK32gmcUA== X-Google-Smtp-Source: ADFU+vvylM9aHeyX1GJIvKdQNfT5GzT5Kc9oSRG5Bbq4LDbH02/g96U9VJ2wPrUj5oqiVl6v76nxrA== X-Received: by 2002:a19:4f01:: with SMTP id d1mr13123052lfb.182.1585073285302; Tue, 24 Mar 2020 11:08:05 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id s10sm11029858ljp.87.2020.03.24.11.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 11:08:04 -0700 (PDT) From: Ulf Hansson To: Greg Kroah-Hartman , Sasha Levin , stable@vger.kernel.org Cc: linux-mmc@vger.kernel.org, Ulf Hansson , Sowjanya Komatineni , Faiz Abbas , Anders Roxell , Naresh Kamboju , Peter Geis Subject: [PATCH 4.19.113 1/5] mmc: core: Allow host controllers to require R1B for CMD6 Date: Tue, 24 Mar 2020 19:07:56 +0100 Message-Id: <20200324180800.28953-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200324180800.28953-1-ulf.hansson@linaro.org> References: <20200324180800.28953-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org [ Upstream commit 1292e3efb149ee21d8d33d725eeed4e6b1ade963 ] It has turned out that some host controllers can't use R1B for CMD6 and other commands that have R1B associated with them. Therefore invent a new host cap, MMC_CAP_NEED_RSP_BUSY to let them specify this. In __mmc_switch(), let's check the flag and use it to prevent R1B responses from being converted into R1. Note that, this also means that the host are on its own, when it comes to manage the busy timeout. Suggested-by: Sowjanya Komatineni Cc: Tested-by: Anders Roxell Tested-by: Sowjanya Komatineni Tested-by: Faiz Abbas Tested-By: Peter Geis Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc_ops.c | 8 +++++--- include/linux/mmc/host.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 873b2aa0c155..693b99eff74b 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -536,10 +536,12 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, * If the cmd timeout and the max_busy_timeout of the host are both * specified, let's validate them. A failure means we need to prevent * the host from doing hw busy detection, which is done by converting - * to a R1 response instead of a R1B. + * to a R1 response instead of a R1B. Note, some hosts requires R1B, + * which also means they are on their own when it comes to deal with the + * busy timeout. */ - if (timeout_ms && host->max_busy_timeout && - (timeout_ms > host->max_busy_timeout)) + if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && timeout_ms && + host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) use_r1b_resp = false; cmd.opcode = MMC_SWITCH; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 840462ed1ec7..7e8e5b20e82b 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -332,6 +332,7 @@ struct mmc_host { MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \ MMC_CAP_UHS_DDR50) /* (1 << 21) is free for reuse */ +#define MMC_CAP_NEED_RSP_BUSY (1 << 22) /* Commands with R1B can't use R1. */ #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */ From patchwork Tue Mar 24 18:07:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 11456155 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93BC11392 for ; Tue, 24 Mar 2020 18:08:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 773962076E for ; Tue, 24 Mar 2020 18:08:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="glVXZKRQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727398AbgCXSIK (ORCPT ); Tue, 24 Mar 2020 14:08:10 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:41239 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727034AbgCXSIJ (ORCPT ); Tue, 24 Mar 2020 14:08:09 -0400 Received: by mail-lf1-f67.google.com with SMTP id z23so2339692lfh.8 for ; Tue, 24 Mar 2020 11:08:08 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=Vy0uyy35QNpejtYD8qe9CDDYciuKj7VGVF2mU0OiMZs=; b=glVXZKRQdT0CXTjE2q/fj8TR19MdtGbZbi5RntaucgoFDQPU9Nzez6Z7Eqi9XxbpnT v1w9zxF/BdGLA8zwpsJD+vqaahkmcR9rIe7CMV3WjKn0hPBrug6x8jnoCJENcsvrJHuq PB3qx9ikGrgbsGlUfTWYzXvEFJOzTvhM/uDztt4zPISUQ5FQ08188T63ppuaJUv6hsf/ IwIyjQfrtScTCktOdHkC4h5ijZjB6yPBuIJu+X9RwOp2zaBBnSJ+NG7U2w/Ly9t5bJzY urhgRaq5T4FnEPdvfzeSxvnStuBMmJOfkK29yUIm6hKhbpIgbj0P+774g2Bf/wufs19p LjbQ== 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:mime-version:content-transfer-encoding; bh=Vy0uyy35QNpejtYD8qe9CDDYciuKj7VGVF2mU0OiMZs=; b=hFVkFODJd1mXL8+RtKrS/lbAyyxFDbwlNqNFW9vbJscOwuEgJbcNnwbvwqFsObH+oe yMfm+rtn7kLD6w3pY8KhUe+zOt4qP9V6RnK27nKNBTPksmOvSh8NFVRyDqeyNBNOZx9j RiemCYh0k6vjHkTzMjyf4INJkt0hiUkRck9Ypd8CX4Vcpgxt3AAcJfx2SSnzba4ftwjs K0ylFpOWkowK57qGgotIQCGMcE9ZsRL4BMuUznaWsMoHVS65DAjR2iYarv1pr+17wd3m i6TiT2KT3xZ8MjjEFc38VK6c1/Ce42qCx0e9eFtJ25JqnvFzbHRpxGa6WRjdFzn3BjCA +CpQ== X-Gm-Message-State: ANhLgQ2UGpre4a35DblOJeevtn9hVMhpP6N0MRrFvBeDsAPkwZnx8ZqZ tKg3V2sSeeC6zJqO/Cp7lOWo8Q== X-Google-Smtp-Source: ADFU+vv5Vne+R/AEBwzTXBWCEPinvro0MlDIH4orKlxDvpFc2ATn+mnt2jhgUKdZCOPE5HWcx+n0zw== X-Received: by 2002:ac2:4a88:: with SMTP id l8mr7201139lfp.138.1585073287419; Tue, 24 Mar 2020 11:08:07 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id s10sm11029858ljp.87.2020.03.24.11.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 11:08:06 -0700 (PDT) From: Ulf Hansson To: Greg Kroah-Hartman , Sasha Levin , stable@vger.kernel.org Cc: linux-mmc@vger.kernel.org, Ulf Hansson , Sowjanya Komatineni , Faiz Abbas , Anders Roxell , Naresh Kamboju , Peter Geis Subject: [PATCH 4.19.113 2/5] mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for erase/trim/discard Date: Tue, 24 Mar 2020 19:07:57 +0100 Message-Id: <20200324180800.28953-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200324180800.28953-1-ulf.hansson@linaro.org> References: <20200324180800.28953-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org [ Upstream commit 43cc64e5221cc6741252b64bc4531dd1eefb733d ] The busy timeout that is computed for each erase/trim/discard operation, can become quite long and may thus exceed the host->max_busy_timeout. If that becomes the case, mmc_do_erase() converts from using an R1B response to an R1 response, as to prevent the host from doing HW busy detection. However, it has turned out that some hosts requires an R1B response no matter what, so let's respect that via checking MMC_CAP_NEED_RSP_BUSY. Note that, if the R1B gets enforced, the host becomes fully responsible of managing the needed busy timeout, in one way or the other. Suggested-by: Sowjanya Komatineni Cc: Tested-by: Anders Roxell Tested-by: Sowjanya Komatineni Tested-by: Faiz Abbas Tested-By: Peter Geis Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 0a74785e575b..56f7f3600469 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2043,8 +2043,11 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from, * the erase operation does not exceed the max_busy_timeout, we should * use R1B response. Or we need to prevent the host from doing hw busy * detection, which is done by converting to a R1 response instead. + * Note, some hosts requires R1B, which also means they are on their own + * when it comes to deal with the busy timeout. */ - if (card->host->max_busy_timeout && + if (!(card->host->caps & MMC_CAP_NEED_RSP_BUSY) && + card->host->max_busy_timeout && busy_timeout > card->host->max_busy_timeout) { cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; } else { From patchwork Tue Mar 24 18:07:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 11456157 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA7B014B4 for ; Tue, 24 Mar 2020 18:08:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB494208C3 for ; Tue, 24 Mar 2020 18:08:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WzIwycBA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727382AbgCXSIL (ORCPT ); Tue, 24 Mar 2020 14:08:11 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:32813 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728024AbgCXSIK (ORCPT ); Tue, 24 Mar 2020 14:08:10 -0400 Received: by mail-lj1-f196.google.com with SMTP id f20so3773353ljm.0 for ; Tue, 24 Mar 2020 11:08:10 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=W/YxNSIqnPUr4VjEbur5ld6du3CHk+yHVEsRun2OwXw=; b=WzIwycBAI/Nyo5430Z+dYSHJe3138HP7s9AT/1sbgqUv8VU+d+5X8tWuSgs7Cxdimy RynjsTaP+nifzo2kiJGn+veNYVo3jG3zwsm2FLLx9JJ+ZnueEq0V5wbwpQjenN2k1QpU eDLsxL/Bn9OZoVZRae6lh4InQwVmXMVEbg3V9gT9n2AnqtPHvnzsVvmW6/Gdv0Rmi8o3 w1JVDgL0YKsSJEif1QEzbQ7CCEFrgV35pl24DAcfKCoJOx5QZCGxDwPizzboQJGsWhu2 UZ2a9cmvtSAaUSmc3PjW7XRQ02IanguDWkT9IHTl2qOlYJ8iRF1574mK5Ch4zF1e7YJg 9sRg== 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:mime-version:content-transfer-encoding; bh=W/YxNSIqnPUr4VjEbur5ld6du3CHk+yHVEsRun2OwXw=; b=JzwYAPvCC7i6zPjOYWAmqjMVsB4ofGoIXPDH9bNw8/eRxtDY3BMUxWT3CaV5uiPHJT 1kTMP158UuwD9cTLfpGTbGJfjROO08fgVqL9tC6gHnMtxmze335FwYwbIGQhYJ+PNRa4 Oh/QGTd50M9QlLRVwkOlmGO0IOsP0UMGQNihEVI3GmehNiLS2rdjP0jp/Wzva9+yvbiS 0c/NFhsOy9TEz51YRCj+Vg2eem19wpgsxRYjQsofKqa+xCJe3pzT63tuTqzRYyCPaEWJ BUHtCMONSNZwk/CuPMNNu5o4YyIziQNumBxrLiZ0/AQpfDpmD/yvsezQC0aYvdK5IOl9 mPnQ== X-Gm-Message-State: ANhLgQ22EbXwqLsr57ZmPQERda3z2sw2euiLgC2Iy3sHtguRt3fo3/4p SyXWJ984gQWrUVbWbuBhnJT51g== X-Google-Smtp-Source: ADFU+vuKgIrcj8NzsvCDj7GQ1mhfxPF3wuWv58i9um0vFVuiWKd8MpP+JfmhjN+VWFrcHuBT1XlNQg== X-Received: by 2002:a2e:b801:: with SMTP id u1mr17057577ljo.84.1585073289261; Tue, 24 Mar 2020 11:08:09 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id s10sm11029858ljp.87.2020.03.24.11.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 11:08:08 -0700 (PDT) From: Ulf Hansson To: Greg Kroah-Hartman , Sasha Levin , stable@vger.kernel.org Cc: linux-mmc@vger.kernel.org, Ulf Hansson , Sowjanya Komatineni , Faiz Abbas , Anders Roxell , Naresh Kamboju Subject: [PATCH 4.19.113 3/5] mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for eMMC sleep command Date: Tue, 24 Mar 2020 19:07:58 +0100 Message-Id: <20200324180800.28953-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200324180800.28953-1-ulf.hansson@linaro.org> References: <20200324180800.28953-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org [ Upstream commit 18d200460cd73636d4f20674085c39e32b4e0097 ] The busy timeout for the CMD5 to put the eMMC into sleep state, is specific to the card. Potentially the timeout may exceed the host->max_busy_timeout. If that becomes the case, mmc_sleep() converts from using an R1B response to an R1 response, as to prevent the host from doing HW busy detection. However, it has turned out that some hosts requires an R1B response no matter what, so let's respect that via checking MMC_CAP_NEED_RSP_BUSY. Note that, if the R1B gets enforced, the host becomes fully responsible of managing the needed busy timeout, in one way or the other. Suggested-by: Sowjanya Komatineni Cc: Link: https://lore.kernel.org/r/20200311092036.16084-1-ulf.hansson@linaro.org Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index f1fe446eee66..5ca53e225382 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1901,9 +1901,12 @@ static int mmc_sleep(struct mmc_host *host) * If the max_busy_timeout of the host is specified, validate it against * the sleep cmd timeout. A failure means we need to prevent the host * from doing hw busy detection, which is done by converting to a R1 - * response instead of a R1B. + * response instead of a R1B. Note, some hosts requires R1B, which also + * means they are on their own when it comes to deal with the busy + * timeout. */ - if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) { + if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout && + (timeout_ms > host->max_busy_timeout)) { cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; } else { cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; From patchwork Tue Mar 24 18:07:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 11456159 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D8C714B4 for ; Tue, 24 Mar 2020 18:08:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F77A2076E for ; Tue, 24 Mar 2020 18:08:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mecw7Z1k" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728024AbgCXSIN (ORCPT ); Tue, 24 Mar 2020 14:08:13 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:40417 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728035AbgCXSIN (ORCPT ); Tue, 24 Mar 2020 14:08:13 -0400 Received: by mail-lj1-f194.google.com with SMTP id 19so19601536ljj.7 for ; Tue, 24 Mar 2020 11:08:11 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=64ZAMpUJ5rH31akevtnc9j967RGejqJSPQFQwpUtFu8=; b=mecw7Z1kjIP1pClqvR9MdTgWcQ4OaV74xHWC0Mpa+3eX/nDK6mi+qJwmLGJ39LQsrp 4fN1MCFaVMeu876vvPiEaQkHZQCGi0dnrT5ggddwnWOOtnmL16DPFVx3V27O54l7eHzy Aan2G5o2A2VOZNXuEcynlZEzGCxmmPG5Sk1c8BtH+y5B2eeFYXIld1eo2CfBY4WcLlJx UB0w6Th7Wdb5Jlj5bU+LWfkFToxGdyKvwslPt10i/9wbeluAUxc4JbWi0xhOI6QiWZqC liBkw1MCsonHMstDrYRF0lvEblTdJ9YCt7k8mXTWhi6fYuO8s7B4bvM/s+lL1yNezVD5 IGAA== 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:mime-version:content-transfer-encoding; bh=64ZAMpUJ5rH31akevtnc9j967RGejqJSPQFQwpUtFu8=; b=da47VPVKuHpuViiJFdwpzNjYJOsiiuzGfPZE882a5y4zehurbXJryuryex5EgawwmN VZK1CuUKvKWa98I6k17/HOOQ6lG6Ipb789cLQqMKLus31hP+3jQUskRry1XKYSjDfdQW NMqpFpeHRcFSHKA+/Ngfjpev3aRw++pAz5KrJroEcGjQEgV80rQixrTwPoRoCm4zFpvc akM6PSNQ/c+3fVdPk1GtHBJ6K8P/O1g3NHeTI7GpMH+Rtt7sLVNzhNRzNk0TeFjPNmDh 5YfvdxgMzBcbfI6KQCUbn1pbKRzxaw/+bbJthTOAVKppiKJVvyLBsWxvz/z0LtBY0+d9 NHfA== X-Gm-Message-State: ANhLgQ2SIBnsidiaZXdyFH+3W3p5/MI3XycoVpPd8p41WjEF0Ov+Z3Cq Gtnc+iQRSI5zgrYy0/eEtxHixg== X-Google-Smtp-Source: ADFU+vv12iDbrBNzBpnLat9A0w/VW62S5gPjD4IeUjL69XsldV1NErLUIRHTg4INORpQsC718BcKsg== X-Received: by 2002:a2e:a0d3:: with SMTP id f19mr17698199ljm.117.1585073290826; Tue, 24 Mar 2020 11:08:10 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id s10sm11029858ljp.87.2020.03.24.11.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 11:08:10 -0700 (PDT) From: Ulf Hansson To: Greg Kroah-Hartman , Sasha Levin , stable@vger.kernel.org Cc: linux-mmc@vger.kernel.org, Ulf Hansson , Sowjanya Komatineni , Faiz Abbas , Anders Roxell , Naresh Kamboju Subject: [PATCH 4.19.113 4/5] mmc: sdhci-omap: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY Date: Tue, 24 Mar 2020 19:07:59 +0100 Message-Id: <20200324180800.28953-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200324180800.28953-1-ulf.hansson@linaro.org> References: <20200324180800.28953-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org [ Upstream commit 055e04830d4544c57f2a5192a26c9e25915c29c0 ] It has turned out that the sdhci-omap controller requires the R1B response, for commands that has this response associated with them. So, converting from an R1B to an R1 response for a CMD6 for example, leads to problems with the HW busy detection support. Fix this by informing the mmc core about the requirement, via setting the host cap, MMC_CAP_NEED_RSP_BUSY. Reported-by: Naresh Kamboju Reported-by: Anders Roxell Reported-by: Faiz Abbas Cc: Tested-by: Anders Roxell Tested-by: Faiz Abbas Signed-off-by: Ulf Hansson --- drivers/mmc/host/sdhci-omap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index e9793d8e83a0..05ade7a2dd24 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -1147,6 +1147,9 @@ static int sdhci_omap_probe(struct platform_device *pdev) host->mmc_host_ops.execute_tuning = sdhci_omap_execute_tuning; host->mmc_host_ops.enable_sdio_irq = sdhci_omap_enable_sdio_irq; + /* R1B responses is required to properly manage HW busy detection. */ + mmc->caps |= MMC_CAP_NEED_RSP_BUSY; + ret = sdhci_setup_host(host); if (ret) goto err_put_sync; From patchwork Tue Mar 24 18:08:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 11456161 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C4E41392 for ; Tue, 24 Mar 2020 18:08:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FAEB2076E for ; Tue, 24 Mar 2020 18:08:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uwepUZZs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728036AbgCXSIP (ORCPT ); Tue, 24 Mar 2020 14:08:15 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:33949 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728031AbgCXSIP (ORCPT ); Tue, 24 Mar 2020 14:08:15 -0400 Received: by mail-lj1-f193.google.com with SMTP id s13so19669642ljm.1 for ; Tue, 24 Mar 2020 11:08:14 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=mGIdmSaD4bL8sXYCDOXTAHaizP73PQqueDtC+tJUTFU=; b=uwepUZZsqvuP7LQ8t4z0sM0tNjEGZJINFJ2l1Ek5eoE1GrsnIMloCHRVN4NJwFRXfU fiMV8A2Ej7nRCyCKJLwMUH4MSJ5llHRv75IjRxCr/bd++fTbC269ZKglRJHYLzUtY4z/ cMLJVvHw/YSorN9Jxtdl17Nx5khcoue8cS935EIhflOtaoTThxjZ05mB7sOLujLtpVJ7 RV2YXZ6ZC+wmdIKmw3DGGww3vGQ8Npw1rS6kXbVfZEfk5ndDgtSfipFdNJosg5rOB7Mh XCbRly2hpv4FB0FTFpLIwTfiKrTcxz6oza+hoXtDPR6DMIkzsXeSAg2aleUM6akOkZAE p7WA== 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:mime-version:content-transfer-encoding; bh=mGIdmSaD4bL8sXYCDOXTAHaizP73PQqueDtC+tJUTFU=; b=DPzwdJ3sUxXyU3bhUeUZm+WcFz8K7VZE8g+y+dAl0N4EtiZNCl8hFUM3BY08LhscdJ ikcBXktWVlKkyki7cGXACEDDVbxCg8DrzuCixj3exzedyIJQKAjgPIRm7s/CZFyfyIao wSDsiLfCkZJ7Iq0UBT+YSKUTkilFm1Rso/yza3MYOFyAkgaHIN+Tg2HCB9okCs0lZtlQ 4b2xHDy7CcLrOeLM3WI9G+aOxBhxuXSYV98lLE43dcYKYmG+0t3QBiV1cKtbSGDaySF0 iNIBIUlB/RfXTnCVSr4AhUiFcJJwX/cnL8yS9phl9xcA+vTpsolimdD//iQu+emlPXpW Eqxw== X-Gm-Message-State: ANhLgQ18Ejt7YbhkiBd25sZ+5EfSJ7ZFjBds6eyiDvOXddq+otWHfn9c 7sZLtDu/qaF0v8gitLDz6qgASQ== X-Google-Smtp-Source: ADFU+vtFbYu+jTNqgRwyr2VDn3JFGCB1OWgIZUWVTILGWVoDJQ+XouDD460jKVCLf/M09JNvHbyQAw== X-Received: by 2002:a2e:9194:: with SMTP id f20mr7293688ljg.33.1585073293744; Tue, 24 Mar 2020 11:08:13 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id s10sm11029858ljp.87.2020.03.24.11.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 11:08:12 -0700 (PDT) From: Ulf Hansson To: Greg Kroah-Hartman , Sasha Levin , stable@vger.kernel.org Cc: linux-mmc@vger.kernel.org, Ulf Hansson , Sowjanya Komatineni , Faiz Abbas , Anders Roxell , Naresh Kamboju , Bitan Biswas , Peter Geis Subject: [PATCH 4.19.113 5/5] mmc: sdhci-tegra: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY Date: Tue, 24 Mar 2020 19:08:00 +0100 Message-Id: <20200324180800.28953-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200324180800.28953-1-ulf.hansson@linaro.org> References: <20200324180800.28953-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org [ Upstream commit d2f8bfa4bff5028bc40ed56b4497c32e05b0178f ] It has turned out that the sdhci-tegra controller requires the R1B response, for commands that has this response associated with them. So, converting from an R1B to an R1 response for a CMD6 for example, leads to problems with the HW busy detection support. Fix this by informing the mmc core about the requirement, via setting the host cap, MMC_CAP_NEED_RSP_BUSY. Reported-by: Bitan Biswas Reported-by: Peter Geis Suggested-by: Sowjanya Komatineni Cc: Tested-by: Sowjanya Komatineni Tested-By: Peter Geis Signed-off-by: Ulf Hansson --- drivers/mmc/host/sdhci-tegra.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 14d749a0de95..27bdf6d499bd 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -502,6 +502,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev) if (tegra_host->soc_data->nvquirks & NVQUIRK_ENABLE_DDR50) host->mmc->caps |= MMC_CAP_1_8V_DDR; + /* R1B responses is required to properly manage HW busy detection. */ + host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY; + tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power", GPIOD_OUT_HIGH); if (IS_ERR(tegra_host->power_gpio)) {