aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci-of-esdhc.c
diff options
context:
space:
mode:
authorJerry Huang <Chang-Ming.Huang@freescale.com>2012-02-04 17:13:13 -0500
committerChris Ball <cjb@laptop.org>2012-03-25 19:33:44 -0400
commit192b5372421766f62fce20d2db2deb19a58e2cfc (patch)
tree16cf121e4b223b670c0f31f1a2f71112e126ac8e /drivers/mmc/host/sdhci-of-esdhc.c
parenta1b13b4e18d62ea60aad9554f35d79c51328b8b6 (diff)
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: Jerry Huang <Chang-Ming.Huang@freescale.com> Signed-off-by: Jiang Yutang <b14898@freescale.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/sdhci-of-esdhc.c')
-rw-r--r--drivers/mmc/host/sdhci-of-esdhc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 5d876ff86f37..2ef52f47def8 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -114,6 +114,20 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
114 return pltfm_host->clock / 256 / 16; 114 return pltfm_host->clock / 256 / 16;
115} 115}
116 116
117#ifdef CONFIG_PM
118static u32 esdhc_proctl;
119static void esdhc_of_suspend(struct sdhci_host *host)
120{
121 esdhc_proctl = sdhci_be32bs_readl(host, SDHCI_HOST_CONTROL);
122}
123
124static void esdhc_of_resume(struct sdhci_host *host)
125{
126 esdhc_of_enable_dma(host);
127 sdhci_be32bs_writel(host, esdhc_proctl, SDHCI_HOST_CONTROL);
128}
129#endif
130
117static struct sdhci_ops sdhci_esdhc_ops = { 131static struct sdhci_ops sdhci_esdhc_ops = {
118 .read_l = sdhci_be32bs_readl, 132 .read_l = sdhci_be32bs_readl,
119 .read_w = esdhc_readw, 133 .read_w = esdhc_readw,
@@ -125,6 +139,10 @@ static struct sdhci_ops sdhci_esdhc_ops = {
125 .enable_dma = esdhc_of_enable_dma, 139 .enable_dma = esdhc_of_enable_dma,
126 .get_max_clock = esdhc_of_get_max_clock, 140 .get_max_clock = esdhc_of_get_max_clock,
127 .get_min_clock = esdhc_of_get_min_clock, 141 .get_min_clock = esdhc_of_get_min_clock,
142#ifdef CONFIG_PM
143 .platform_suspend = esdhc_of_suspend,
144 .platform_resume = esdhc_of_resume,
145#endif
128}; 146};
129 147
130static struct sdhci_pltfm_data sdhci_esdhc_pdata = { 148static struct sdhci_pltfm_data sdhci_esdhc_pdata = {