aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r--drivers/mmc/core/core.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 18661554e79c..690255c7d4dc 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1256,6 +1256,7 @@ static void mmc_poweroff_notify(struct mmc_host *host)
1256 int err = 0; 1256 int err = 0;
1257 1257
1258 card = host->card; 1258 card = host->card;
1259 mmc_claim_host(host);
1259 1260
1260 /* 1261 /*
1261 * Send power notify command only if card 1262 * Send power notify command only if card
@@ -1286,6 +1287,7 @@ static void mmc_poweroff_notify(struct mmc_host *host)
1286 /* Set the card state to no notification after the poweroff */ 1287 /* Set the card state to no notification after the poweroff */
1287 card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; 1288 card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION;
1288 } 1289 }
1290 mmc_release_host(host);
1289} 1291}
1290 1292
1291/* 1293/*
@@ -1344,12 +1346,28 @@ static void mmc_power_up(struct mmc_host *host)
1344 1346
1345void mmc_power_off(struct mmc_host *host) 1347void mmc_power_off(struct mmc_host *host)
1346{ 1348{
1349 int err = 0;
1347 mmc_host_clk_hold(host); 1350 mmc_host_clk_hold(host);
1348 1351
1349 host->ios.clock = 0; 1352 host->ios.clock = 0;
1350 host->ios.vdd = 0; 1353 host->ios.vdd = 0;
1351 1354
1352 mmc_poweroff_notify(host); 1355 /*
1356 * For eMMC 4.5 device send AWAKE command before
1357 * POWER_OFF_NOTIFY command, because in sleep state
1358 * eMMC 4.5 devices respond to only RESET and AWAKE cmd
1359 */
1360 if (host->card && mmc_card_is_sleep(host->card) &&
1361 host->bus_ops->resume) {
1362 err = host->bus_ops->resume(host);
1363
1364 if (!err)
1365 mmc_poweroff_notify(host);
1366 else
1367 pr_warning("%s: error %d during resume "
1368 "(continue with poweroff sequence)\n",
1369 mmc_hostname(host), err);
1370 }
1353 1371
1354 /* 1372 /*
1355 * Reset ocr mask to be the highest possible voltage supported for 1373 * Reset ocr mask to be the highest possible voltage supported for
@@ -2403,12 +2421,6 @@ int mmc_suspend_host(struct mmc_host *host)
2403 */ 2421 */
2404 if (mmc_try_claim_host(host)) { 2422 if (mmc_try_claim_host(host)) {
2405 if (host->bus_ops->suspend) { 2423 if (host->bus_ops->suspend) {
2406 /*
2407 * For eMMC 4.5 device send notify command
2408 * before sleep, because in sleep state eMMC 4.5
2409 * devices respond to only RESET and AWAKE cmd
2410 */
2411 mmc_poweroff_notify(host);
2412 err = host->bus_ops->suspend(host); 2424 err = host->bus_ops->suspend(host);
2413 } 2425 }
2414 mmc_do_release_host(host); 2426 mmc_do_release_host(host);