]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mmc: sdhci-tegra: Issue CMD and DAT resets together
authorPrathamesh Shete <pshete@nvidia.com>
Tue, 6 Dec 2022 16:59:45 +0000 (17:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:33:04 +0000 (13:33 +0100)
[ Upstream commit acc13958c2b2623c17e2450b8cd6881b698756d3 ]

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>
Link: https://lore.kernel.org/r/20221206165945.3551774-7-thierry.reding@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mmc/host/sdhci-tegra.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h

index c71000a07656eaa403643260a09081162c375aee..1adaa94c31aca6a0c4c51fcad6b110b075219ff2 100644 (file)
@@ -1526,7 +1526,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,
 };
 
index c7ad32a75b570a73c849ae7a5945c0564b67e89a..632341911b6e7807ae59edca74a77d393f87c2ae 100644 (file)
@@ -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);
index 87a3aaa0743873e9cf2a8a8e0d717d9d421f5dec..5ce7cdcc192fd24a1c3725c1fe839e74f7daa413 100644 (file)
@@ -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 */