aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2012-11-19 11:29:59 -0500
committerChris Ball <cjb@laptop.org>2012-12-06 13:54:57 -0500
commita48ce884d5819d5df2cf1139ab3c43f8e9e419b3 (patch)
tree13186caeac3fd877d67a6cf164271c5315c3edb3 /drivers/mmc
parentcd587096c0e2b85a67e77721a753679bac89b394 (diff)
mmc: omap_hsmmc: Introduce omap_hsmmc_prepare/complete
prepare() is supposed to prevent new children from being registered. On the MMC subsystem, children (new cards) registration starts with the card detect IRQ. Move card detect IRQ disabling to prepare() so that no new cards will be registered while we're trying to suspend. Likewise, move card detect IRQ enabling to complete() so we only try to register new children after our MMC IP is back up. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Venkatraman S <svenkatr@ti.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/omap_hsmmc.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 18d3f19ef4e5..fad9250e4bc9 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2070,6 +2070,25 @@ static int __devexit omap_hsmmc_remove(struct platform_device *pdev)
2070} 2070}
2071 2071
2072#ifdef CONFIG_PM 2072#ifdef CONFIG_PM
2073static int omap_hsmmc_prepare(struct device *dev)
2074{
2075 struct omap_hsmmc_host *host = dev_get_drvdata(dev);
2076
2077 if (host->pdata->suspend)
2078 return host->pdata->suspend(dev, host->slot_id);
2079
2080 return 0;
2081}
2082
2083static void omap_hsmmc_complete(struct device *dev)
2084{
2085 struct omap_hsmmc_host *host = dev_get_drvdata(dev);
2086
2087 if (host->pdata->resume)
2088 host->pdata->resume(dev, host->slot_id);
2089
2090}
2091
2073static int omap_hsmmc_suspend(struct device *dev) 2092static int omap_hsmmc_suspend(struct device *dev)
2074{ 2093{
2075 int ret = 0; 2094 int ret = 0;
@@ -2083,23 +2102,10 @@ static int omap_hsmmc_suspend(struct device *dev)
2083 2102
2084 pm_runtime_get_sync(host->dev); 2103 pm_runtime_get_sync(host->dev);
2085 host->suspended = 1; 2104 host->suspended = 1;
2086 if (host->pdata->suspend) {
2087 ret = host->pdata->suspend(dev, host->slot_id);
2088 if (ret) {
2089 dev_dbg(dev, "Unable to handle MMC board"
2090 " level suspend\n");
2091 host->suspended = 0;
2092 return ret;
2093 }
2094 }
2095 ret = mmc_suspend_host(host->mmc); 2105 ret = mmc_suspend_host(host->mmc);
2096 2106
2097 if (ret) { 2107 if (ret) {
2098 host->suspended = 0; 2108 host->suspended = 0;
2099 if (host->pdata->resume) {
2100 if (host->pdata->resume(dev, host->slot_id))
2101 dev_dbg(dev, "Unmask interrupt failed\n");
2102 }
2103 goto err; 2109 goto err;
2104 } 2110 }
2105 2111
@@ -2136,12 +2142,6 @@ static int omap_hsmmc_resume(struct device *dev)
2136 if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) 2142 if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))
2137 omap_hsmmc_conf_bus_power(host); 2143 omap_hsmmc_conf_bus_power(host);
2138 2144
2139 if (host->pdata->resume) {
2140 ret = host->pdata->resume(dev, host->slot_id);
2141 if (ret)
2142 dev_dbg(dev, "Unmask interrupt failed\n");
2143 }
2144
2145 omap_hsmmc_protect_card(host); 2145 omap_hsmmc_protect_card(host);
2146 2146
2147 /* Notify the core to resume the host */ 2147 /* Notify the core to resume the host */
@@ -2157,8 +2157,10 @@ static int omap_hsmmc_resume(struct device *dev)
2157} 2157}
2158 2158
2159#else 2159#else
2160#define omap_hsmmc_prepare NULL
2161#define omap_hsmmc_complete NULL
2160#define omap_hsmmc_suspend NULL 2162#define omap_hsmmc_suspend NULL
2161#define omap_hsmmc_resume NULL 2163#define omap_hsmmc_resume NULL
2162#endif 2164#endif
2163 2165
2164static int omap_hsmmc_runtime_suspend(struct device *dev) 2166static int omap_hsmmc_runtime_suspend(struct device *dev)
@@ -2186,6 +2188,8 @@ static int omap_hsmmc_runtime_resume(struct device *dev)
2186static struct dev_pm_ops omap_hsmmc_dev_pm_ops = { 2188static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
2187 .suspend = omap_hsmmc_suspend, 2189 .suspend = omap_hsmmc_suspend,
2188 .resume = omap_hsmmc_resume, 2190 .resume = omap_hsmmc_resume,
2191 .prepare = omap_hsmmc_prepare,
2192 .complete = omap_hsmmc_complete,
2189 .runtime_suspend = omap_hsmmc_runtime_suspend, 2193 .runtime_suspend = omap_hsmmc_runtime_suspend,
2190 .runtime_resume = omap_hsmmc_runtime_resume, 2194 .runtime_resume = omap_hsmmc_runtime_resume,
2191}; 2195};