From: Prathamesh Shete <pshete@nvidia.com>
To: <joro@8bytes.org>, <adrian.hunter@intel.com>,
<ulf.hansson@linaro.org>, <thierry.reding@gmail.com>,
<jonathanh@nvidia.com>, <p.zabel@pengutronix.de>,
<linux-mmc@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <will@kernel.org>, <iommu@lists.linux.dev>,
<robin.murphy@arm.com>, <anrao@nvidia.com>,
<smangipudi@nvidia.com>, <pshete@nvidia.com>,
<kyarlagadda@nvidia.com>
Subject: [PATCH v10 4/4] mmc: sdhci-tegra: Issue CMD and DAT resets together
Date: Thu, 3 Nov 2022 10:08:52 +0530 [thread overview]
Message-ID: <20221103043852.24718-4-pshete@nvidia.com> (raw)
In-Reply-To: <20221103043852.24718-1-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>
---
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 e44060cceb68..7cb3bf34a176 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -1531,7 +1531,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 2b5dda521b0e..8512a69f1aae 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 d750c464bd1e..6a5766774b05 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.17.1
next prev parent reply other threads:[~2022-11-03 4:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAPDyKFpG9ZjVTiK3HEqioDN8ksGpRYiXL_SLSmOfm9fjJfcrsw@mail.gmail.com>
2022-10-28 13:02 ` [PATCH v9 1/4] iommu: Add dummy dev_iommu_fwspec_get() helper Prathamesh Shete
2022-10-28 13:02 ` [PATCH v9 2/4] mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data Prathamesh Shete
2022-10-28 13:02 ` [PATCH v9 3/4] mmc: sdhci-tegra: Add support to program MC stream ID Prathamesh Shete
2022-10-28 13:02 ` [PATCH v9 4/4] mmc: sdhci-tegra: Issue CMD and DAT resets together Prathamesh Shete
2022-11-02 15:27 ` [PATCH v9 1/4] iommu: Add dummy dev_iommu_fwspec_get() helper Ulf Hansson
2022-11-03 4:38 ` [PATCH v10 1/4] iommu: Always define struct iommu_fwspec Prathamesh Shete
2022-11-03 4:38 ` [PATCH v10 2/4] mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data Prathamesh Shete
2022-11-03 4:38 ` [PATCH v10 3/4] mmc: sdhci-tegra: Add support to program MC stream ID Prathamesh Shete
2022-11-03 11:30 ` Robin Murphy
2022-11-03 4:38 ` Prathamesh Shete [this message]
2022-11-03 10:59 ` [PATCH v10 1/4] iommu: Always define struct iommu_fwspec Ulf Hansson
2022-11-03 12:23 ` Robin Murphy
2022-11-03 14:01 ` Thierry Reding
2022-11-03 14:55 ` Ulf Hansson
2022-11-03 17:35 ` Robin Murphy
2022-11-04 14:35 ` Ulf Hansson
2022-11-07 9:39 ` Thierry Reding
2022-11-04 14:38 ` Thierry Reding
2022-11-07 9:48 ` Thierry Reding
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=20221103043852.24718-4-pshete@nvidia.com \
--to=pshete@nvidia.com \
--cc=adrian.hunter@intel.com \
--cc=anrao@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=jonathanh@nvidia.com \
--cc=joro@8bytes.org \
--cc=kyarlagadda@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robin.murphy@arm.com \
--cc=smangipudi@nvidia.com \
--cc=thierry.reding@gmail.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;
as well as URLs for NNTP newsgroup(s).