aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@stericsson.com>2011-03-03 13:08:40 +0100
committerSebastian RASMUSSEN <sebastian.rasmussen@stericsson.com>2011-03-04 18:33:35 +0100
commitad1290360d9037f6798d76444f04869b0debb394 (patch)
tree979f50794ec41209eb168e1dfe86727588e7d202 /drivers/mmc
parent925c961e05cc3335a41f91b6ea43ab9eacad6c9a (diff)
MMCI: Supend/resume is not initializing the device
Let the enable and disable function take care of the re-initialization of the MMC/SD/SDIO device. The suspend and resume function is no longer doing any initialization of the device, it is only claiming and releasing the host to prevent request handling while suspended. Change-Id: I1af634dfe5dca3f1985b77023b7fecb2150a5fe4 Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/17526 Reviewed-by: Sebastian RASMUSSEN <sebastian.rasmussen@stericsson.com> Tested-by: Sebastian RASMUSSEN <sebastian.rasmussen@stericsson.com> Reviewed-by: Par-Olof HAKANSSON <par-olof.hakansson@stericsson.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/mmci.c75
1 files changed, 22 insertions, 53 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 250ddf65a29..b83b6fb46fb 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -1725,33 +1725,26 @@ static int mmci_suspend(struct amba_device *dev, pm_message_t state)
/*
* The host must be claimed to prevent request handling etc.
- * By the same reason we must not release the host until we
- * have resumed. Claiming the host makes it also enabled.
+ * Also make sure to not sleep, since we must return with a
+ * response quite quickly.
*/
- mmc_claim_host(mmc);
+ if (mmc_try_claim_host(mmc)) {
+ if (mmc->enabled) {
- /*
- * SDIO suspend/resume support in sdio framework is not
- * fully supported. Once this is completed the workaround
- * below shall be removed.
- */
- if (!(mmc->card && mmc_card_sdio(mmc->card)))
- ret = mmc_suspend_host(mmc);
-
- if (ret) {
- dev_err(mmc_dev(mmc),
- "Failed to suspend host when doing suspend\n");
- mmc_release_host(mmc);
- return ret;
- }
-
- ret = mmc_host_disable(mmc);
- if (ret) {
- dev_err(mmc_dev(mmc),
- "Failed to disable host when doing suspend\n");
- mmc_release_host(mmc);
+ /*
+ * Do not suspend if the host has not been
+ * disabled.
+ */
+ mmc_do_release_host(mmc);
+ ret = -EBUSY;
+ }
+ } else {
+ /*
+ * We did not manage to claim the host, thus someone
+ * is still using it. Do not suspend.
+ */
+ ret = -EBUSY;
}
-
}
return ret;
@@ -1760,42 +1753,18 @@ static int mmci_suspend(struct amba_device *dev, pm_message_t state)
static int mmci_resume(struct amba_device *dev)
{
struct mmc_host *mmc = amba_get_drvdata(dev);
- int ret = 0;
if (mmc) {
-
- /* We expect the host to be claimed, thus enable it is fine. */
- ret = mmc_host_enable(mmc);
- if (ret) {
- dev_err(mmc_dev(mmc),
- "Failed to enable host when doing resume\n");
- return ret;
- }
-
/*
- * SDIO suspend/resume support in sdio framework is not
- * fully supported. Once this is completed the workaround
- * below shall be removed.
+ * We expect the host to be claimed.
+ * Release the host to provide access to it again.
*/
- if (!(mmc->card && mmc_card_sdio(mmc->card)))
- ret = mmc_resume_host(mmc);
-
- if (ret) {
- dev_err(mmc_dev(mmc),
- "Failed to resume host when doing resume\n");
- return ret;
- }
-
- /*
- * Release the host to provide request handling etc access
- * to the host again. The release operation will also put
- * a new disable work into the work queue.
- */
- mmc_release_host(mmc);
+ WARN_ON(!mmc->claimed);
+ mmc_do_release_host(mmc);
}
- return ret;
+ return 0;
}
#else
#define mmci_suspend NULL