1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
Index: linux-2.6.14/drivers/mmc/s3c2410mci.c
===================================================================
--- linux-2.6.14.orig/drivers/mmc/s3c2410mci.c
+++ linux-2.6.14/drivers/mmc/s3c2410mci.c
@@ -614,7 +614,8 @@ static int s3c2410sdi_probe(struct devic
goto probe_iounmap;
}
- s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_EINT5);
+ // This should be parametrised
+ // s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_EINT5);
set_irq_type(host->irq_cd, IRQT_BOTHEDGE);
if(request_irq(host->irq_cd, s3c2410sdi_irq_cd, 0, DRIVER_NAME, host)) {
@@ -732,12 +733,57 @@ static int s3c2410sdi_remove(struct devi
return 0;
}
+#ifdef CONFIG_PM
+static int s3c2410mci_suspend(struct device *dev, pm_message_t state)
+{
+ struct mmc_host *mmc = dev_get_drvdata(dev);
+ int ret = 0;
+
+ if (mmc) {
+ struct s3c2410sdi_host *host = mmc_priv(mmc);
+
+ ret = mmc_suspend_host(mmc, state);
+
+ clk_disable(host->clk);
+
+ disable_irq(host->irq_cd);
+ disable_irq(host->irq);
+ }
+
+ return ret;
+}
+
+static int s3c2410mci_resume(struct device *dev)
+{
+ struct mmc_host *mmc = dev_get_drvdata(dev);
+ int ret = 0;
+
+ if (mmc) {
+ struct s3c2410sdi_host *host = mmc_priv(mmc);
+
+ enable_irq(host->irq_cd);
+ enable_irq(host->irq);
+
+ clk_enable(host->clk);
+
+ ret = mmc_resume_host(mmc);
+ }
+
+ return ret;
+}
+#else
+#define s3c2410mci_suspend NULL
+#define s3c2410mci_resume NULL
+#endif
+
static struct device_driver s3c2410sdi_driver =
{
.name = "s3c2410-sdi",
.bus = &platform_bus_type,
.probe = s3c2410sdi_probe,
.remove = s3c2410sdi_remove,
+ .suspend = s3c2410mci_suspend,
+ .resume = s3c2410mci_resume,
};
static int __init s3c2410sdi_init(void)
Index: linux-2.6.14/drivers/mmc/mmc.c
===================================================================
--- linux-2.6.14.orig/drivers/mmc/mmc.c
+++ linux-2.6.14/drivers/mmc/mmc.c
@@ -1263,6 +1263,7 @@ EXPORT_SYMBOL(mmc_suspend_host);
*/
int mmc_resume_host(struct mmc_host *host)
{
+ mmc_power_up(host);
mmc_detect_change(host, 0);
return 0;
|