Skip to content

Commit aa992a1

Browse files
committed
mmc: sdhci-tegra: Issue CMD and DAT resets together
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2144641 commit acc1395 Author: Prathamesh Shete <pshete@nvidia.com> Date: Tue, 6 Dec 2022 17:59:45 +0100 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: Mark Salter <msalter@redhat.com>
1 parent 27e20d6 commit aa992a1

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

drivers/mmc/host/sdhci-tegra.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,8 @@ static const struct sdhci_pltfm_data sdhci_tegra186_pdata = {
15321532
SDHCI_QUIRK_NO_HISPD_BIT |
15331533
SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
15341534
SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
1535-
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
1535+
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
1536+
SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER,
15361537
.ops = &tegra186_sdhci_ops,
15371538
};
15381539

drivers/mmc/host/sdhci.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ enum sdhci_reset_reason {
269269

270270
static void sdhci_reset_for_reason(struct sdhci_host *host, enum sdhci_reset_reason reason)
271271
{
272+
if (host->quirks2 & SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER) {
273+
sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
274+
return;
275+
}
276+
272277
switch (reason) {
273278
case SDHCI_RESET_FOR_INIT:
274279
sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);

drivers/mmc/host/sdhci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,8 @@ struct sdhci_host {
475475
* block count.
476476
*/
477477
#define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1<<18)
478+
/* Issue CMD and DATA reset together */
479+
#define SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER (1<<19)
478480

479481
int irq; /* Device IRQ */
480482
void __iomem *ioaddr; /* Mapped address */

0 commit comments

Comments
 (0)