aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci-spear.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/sdhci-spear.c')
-rw-r--r--drivers/mmc/host/sdhci-spear.c51
1 files changed, 40 insertions, 11 deletions
diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index 63cc8b6a1c9e..b7f8b33c5f19 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -21,6 +21,7 @@
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/pm.h>
24#include <linux/slab.h> 25#include <linux/slab.h>
25#include <linux/mmc/host.h> 26#include <linux/mmc/host.h>
26#include <linux/mmc/sdhci-spear.h> 27#include <linux/mmc/sdhci-spear.h>
@@ -271,26 +272,54 @@ static int __devexit sdhci_remove(struct platform_device *pdev)
271 return 0; 272 return 0;
272} 273}
273 274
275#ifdef CONFIG_PM
276static int sdhci_suspend(struct device *dev)
277{
278 struct sdhci_host *host = dev_get_drvdata(dev);
279 struct spear_sdhci *sdhci = dev_get_platdata(dev);
280 int ret;
281
282 ret = sdhci_suspend_host(host);
283 if (!ret)
284 clk_disable(sdhci->clk);
285
286 return ret;
287}
288
289static int sdhci_resume(struct device *dev)
290{
291 struct sdhci_host *host = dev_get_drvdata(dev);
292 struct spear_sdhci *sdhci = dev_get_platdata(dev);
293 int ret;
294
295 ret = clk_enable(sdhci->clk);
296 if (ret) {
297 dev_dbg(dev, "Resume: Error enabling clock\n");
298 return ret;
299 }
300
301 return sdhci_resume_host(host);
302}
303
304const struct dev_pm_ops sdhci_pm_ops = {
305 .suspend = sdhci_suspend,
306 .resume = sdhci_resume,
307};
308#endif
309
274static struct platform_driver sdhci_driver = { 310static struct platform_driver sdhci_driver = {
275 .driver = { 311 .driver = {
276 .name = "sdhci", 312 .name = "sdhci",
277 .owner = THIS_MODULE, 313 .owner = THIS_MODULE,
314#ifdef CONFIG_PM
315 .pm = &sdhci_pm_ops,
316#endif
278 }, 317 },
279 .probe = sdhci_probe, 318 .probe = sdhci_probe,
280 .remove = __devexit_p(sdhci_remove), 319 .remove = __devexit_p(sdhci_remove),
281}; 320};
282 321
283static int __init sdhci_init(void) 322module_platform_driver(sdhci_driver);
284{
285 return platform_driver_register(&sdhci_driver);
286}
287module_init(sdhci_init);
288
289static void __exit sdhci_exit(void)
290{
291 platform_driver_unregister(&sdhci_driver);
292}
293module_exit(sdhci_exit);
294 323
295MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver"); 324MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver");
296MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); 325MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>");