Skip to content

Commit 2cf9bfe

Browse files
Raul E Rangelstorulf
authored andcommitted
mmc: sdhci-acpi: Clear amd_sdhci_host on reset
The commit 61d7437 ("mmc: sdhci-acpi: Fix HS400 tuning for AMDI0040") broke resume for eMMC HS400. When the system suspends the eMMC controller is powered down. So, on resume we need to reinitialize the controller. Although, amd_sdhci_host was not getting cleared, so the DLL was never re-enabled on resume. This results in HS400 being non-functional. To fix the problem, this change clears the tuned_clock flag, clears the dll_enabled flag and disables the DLL on reset. Fixes: 61d7437 ("mmc: sdhci-acpi: Fix HS400 tuning for AMDI0040") Signed-off-by: Raul E Rangel <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/20200831150517.1.I93c78bfc6575771bb653c9d3fca5eb018a08417d@changeid Signed-off-by: Ulf Hansson <[email protected]>
1 parent f4d51df commit 2cf9bfe

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

drivers/mmc/host/sdhci-acpi.c

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,18 @@ static int amd_select_drive_strength(struct mmc_card *card,
551551
return MMC_SET_DRIVER_TYPE_A;
552552
}
553553

554-
static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host)
554+
static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host, bool enable)
555555
{
556+
struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
557+
struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
558+
556559
/* AMD Platform requires dll setting */
557560
sdhci_writel(host, 0x40003210, SDHCI_AMD_RESET_DLL_REGISTER);
558561
usleep_range(10, 20);
559-
sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER);
562+
if (enable)
563+
sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER);
564+
565+
amd_host->dll_enabled = enable;
560566
}
561567

562568
/*
@@ -596,10 +602,8 @@ static void amd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
596602

597603
/* DLL is only required for HS400 */
598604
if (host->timing == MMC_TIMING_MMC_HS400 &&
599-
!amd_host->dll_enabled) {
600-
sdhci_acpi_amd_hs400_dll(host);
601-
amd_host->dll_enabled = true;
602-
}
605+
!amd_host->dll_enabled)
606+
sdhci_acpi_amd_hs400_dll(host, true);
603607
}
604608
}
605609

@@ -620,10 +624,23 @@ static int amd_sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
620624
return err;
621625
}
622626

627+
static void amd_sdhci_reset(struct sdhci_host *host, u8 mask)
628+
{
629+
struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
630+
struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
631+
632+
if (mask & SDHCI_RESET_ALL) {
633+
amd_host->tuned_clock = false;
634+
sdhci_acpi_amd_hs400_dll(host, false);
635+
}
636+
637+
sdhci_reset(host, mask);
638+
}
639+
623640
static const struct sdhci_ops sdhci_acpi_ops_amd = {
624641
.set_clock = sdhci_set_clock,
625642
.set_bus_width = sdhci_set_bus_width,
626-
.reset = sdhci_reset,
643+
.reset = amd_sdhci_reset,
627644
.set_uhs_signaling = sdhci_set_uhs_signaling,
628645
};
629646

0 commit comments

Comments
 (0)