From: Jerry Huang <chang-ming.hu...@freescale.com>

For FSL ESDHC controllor, when enter the sleep, the controller will power off,
therefore the register will lost its valuse, and driver should save value of
register during suspend and used during resume.

Signed-off-by: Jerry Huang <chang-ming.hu...@freescale.com>
Signed-off-by: Jiang Yutang <b14...@freescale.com>
CC: Chris Ball <c...@laptop.org>
---
changes for v2:
        - change the property to compatible for quirks
changes for v3:
        - fix one compile error
changes for v4:
        - use hooks to suspend/resume the special platform

 drivers/mmc/host/sdhci-of-esdhc.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c 
b/drivers/mmc/host/sdhci-of-esdhc.c
index c21be67..385a4ff 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -104,6 +104,21 @@ static int esdhc_of_get_cd(struct sdhci_host *host)
        return present;
 }
 
+#ifdef CONFIG_PM
+static u32 esdhc_proctl;
+static void esdhc_of_suspend(struct sdhci_host *host)
+{
+       esdhc_proctl = sdhci_be32bs_readl(host, SDHCI_HOST_CONTROL);
+}
+
+static void esdhc_of_resume(struct sdhci_host *host)
+{
+       esdhc_of_enable_dma(host);
+       sdhci_be32bs_writel(host, esdhc_proctl, SDHCI_HOST_CONTROL);
+
+}
+#endif
+
 static struct sdhci_ops sdhci_esdhc_ops = {
        .read_l = sdhci_be32bs_readl,
        .read_w = esdhc_readw,
@@ -116,6 +131,10 @@ static struct sdhci_ops sdhci_esdhc_ops = {
        .get_max_clock = esdhc_of_get_max_clock,
        .get_min_clock = esdhc_of_get_min_clock,
        .get_cd = esdhc_of_get_cd,
+#ifdef CONFIG_PM
+       .platform_suspend = esdhc_of_suspend,
+       .platform_resume = esdhc_of_resume,
+#endif
 };
 
 static struct sdhci_pltfm_data sdhci_esdhc_pdata = {
-- 
1.7.5.4


--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to