From: Thierry Reding <thierry.reding@gmail.com>
To: Joerg Roedel <joro@8bytes.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Robin Murphy <robin.murphy@arm.com>
Cc: Thierry Reding <treding@nvidia.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Prathamesh Shete <pshete@nvidia.com>,
Will Deacon <will@kernel.org>,
iommu@lists.linux-foundation.org, linux-mmc@vger.kernel.org,
linux-tegra@vger.kernel.org
Subject: [PATCH v11 6/6] mmc: sdhci-tegra: Issue CMD and DAT resets together
Date: Thu, 17 Nov 2022 19:27:20 +0100 [thread overview]
Message-ID: <20221117182720.2290761-7-thierry.reding@gmail.com> (raw)
In-Reply-To: <20221117182720.2290761-1-thierry.reding@gmail.com>
From: Prathamesh Shete <pshete@nvidia.com>
In case of error condition to avoid system crash
Tegra SDMMC controller requires CMD and DAT resets
issued together. SDHCI controller FSM goes into
bad state due to rapid SD card hot-plug event.
Issuing reset on the CMD FSM before DATA FSM results
in kernel panic, hence add support to issue CMD and
DAT resets together.
This is applicable to Tegra186 and later chips.
Signed-off-by: Aniruddha TVS Rao <anrao@nvidia.com>
Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/mmc/host/sdhci-tegra.c | 3 ++-
drivers/mmc/host/sdhci.c | 5 +++++
drivers/mmc/host/sdhci.h | 2 ++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index 1cb7fd3afa7e..3384bfd3585c 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -1533,7 +1533,8 @@ static const struct sdhci_pltfm_data sdhci_tegra186_pdata = {
SDHCI_QUIRK_NO_HISPD_BIT |
SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+ SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER,
.ops = &tegra186_sdhci_ops,
};
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index fb6e9a81f198..ed59bb3247a1 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -270,6 +270,11 @@ enum sdhci_reset_reason {
static void sdhci_reset_for_reason(struct sdhci_host *host, enum sdhci_reset_reason reason)
{
+ if (host->quirks2 &
+ SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER) {
+ sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
+ return;
+ }
switch (reason) {
case SDHCI_RESET_FOR_INIT:
sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 908da47ac5ba..ca7ede721523 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -478,6 +478,8 @@ struct sdhci_host {
* block count.
*/
#define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1<<18)
+/* Issue CMD and DATA reset together */
+#define SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER (1<<19)
int irq; /* Device IRQ */
void __iomem *ioaddr; /* Mapped address */
--
2.38.1
prev parent reply other threads:[~2022-11-17 18:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 18:27 [PATCH v11 0/6] mmc: sdhci: Add Tegra234 support Thierry Reding
2022-11-17 18:27 ` [PATCH v11 1/6] iommu: Add note about struct iommu_fwspec usage Thierry Reding
2022-11-19 9:51 ` Joerg Roedel
2022-11-17 18:27 ` [PATCH v11 2/6] iommu/tegra: Add tegra_dev_iommu_get_stream_id() helper Thierry Reding
2022-11-18 8:08 ` Ulf Hansson
2022-12-02 10:31 ` Thierry Reding
2022-11-17 18:27 ` [PATCH v11 3/6] mmc: sdhci-tegra: Sort includes alphabetically Thierry Reding
2022-11-18 7:32 ` Adrian Hunter
2022-11-18 8:01 ` Ulf Hansson
2022-11-17 18:27 ` [PATCH v11 4/6] mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data Thierry Reding
2022-11-17 18:27 ` [PATCH v11 5/6] mmc: sdhci-tegra: Add support to program MC stream ID Thierry Reding
2022-11-17 18:27 ` Thierry Reding [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221117182720.2290761-7-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=adrian.hunter@intel.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jonathanh@nvidia.com \
--cc=joro@8bytes.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=pshete@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=treding@nvidia.com \
--cc=ulf.hansson@linaro.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox