Commit 192b5372 authored by Jerry Huang's avatar Jerry Huang Committed by Chris Ball

mmc: esdhc: Implement power management for ESDHC

For FSL ESDHC controllers, when entering sleep the controller will power off,
therefore the registers will lose their values, and the driver should save
the value of registers during suspend and write them back during resume.
Signed-off-by: default avatarJerry Huang <Chang-Ming.Huang@freescale.com>
Signed-off-by: default avatarJiang Yutang <b14898@freescale.com>
Acked-by: default avatarAnton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent a1b13b4e
...@@ -114,6 +114,20 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host) ...@@ -114,6 +114,20 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
return pltfm_host->clock / 256 / 16; return pltfm_host->clock / 256 / 16;
} }
#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 = { static struct sdhci_ops sdhci_esdhc_ops = {
.read_l = sdhci_be32bs_readl, .read_l = sdhci_be32bs_readl,
.read_w = esdhc_readw, .read_w = esdhc_readw,
...@@ -125,6 +139,10 @@ static struct sdhci_ops sdhci_esdhc_ops = { ...@@ -125,6 +139,10 @@ static struct sdhci_ops sdhci_esdhc_ops = {
.enable_dma = esdhc_of_enable_dma, .enable_dma = esdhc_of_enable_dma,
.get_max_clock = esdhc_of_get_max_clock, .get_max_clock = esdhc_of_get_max_clock,
.get_min_clock = esdhc_of_get_min_clock, .get_min_clock = esdhc_of_get_min_clock,
#ifdef CONFIG_PM
.platform_suspend = esdhc_of_suspend,
.platform_resume = esdhc_of_resume,
#endif
}; };
static struct sdhci_pltfm_data sdhci_esdhc_pdata = { static struct sdhci_pltfm_data sdhci_esdhc_pdata = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment