aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaya Erez <merez@codeaurora.org>2013-01-28 16:44:22 -0500
committerChris Ball <cjb@laptop.org>2013-02-24 14:37:00 -0500
commit881d926d9d0bd2eb50f8f90c993bc403853382ce (patch)
tree111c13cd2340a2199ebd367c83cbeb357d65da03
parentf9e37137e420a626df4f5e7c4f0869bf7a1d4929 (diff)
mmc: core: move the cache disabling operation to mmc_suspend
Cache control is an eMMC feature and in therefore should be part of MMC's bus resume operations, performed in mmc_suspend, rather than in the generic mmc_suspend_host(). Signed-off-by: Maya Erez <merez@codeaurora.org> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/core/core.c7
-rw-r--r--drivers/mmc/core/mmc.c8
2 files changed, 8 insertions, 7 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 8b3a1222e665..39f28af34cb6 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2486,6 +2486,7 @@ EXPORT_SYMBOL(mmc_flush_cache);
2486 * Turn the cache ON/OFF. 2486 * Turn the cache ON/OFF.
2487 * Turning the cache OFF shall trigger flushing of the data 2487 * Turning the cache OFF shall trigger flushing of the data
2488 * to the non-volatile storage. 2488 * to the non-volatile storage.
2489 * This function should be called with host claimed
2489 */ 2490 */
2490int mmc_cache_ctrl(struct mmc_host *host, u8 enable) 2491int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
2491{ 2492{
@@ -2497,7 +2498,6 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
2497 mmc_card_is_removable(host)) 2498 mmc_card_is_removable(host))
2498 return err; 2499 return err;
2499 2500
2500 mmc_claim_host(host);
2501 if (card && mmc_card_mmc(card) && 2501 if (card && mmc_card_mmc(card) &&
2502 (card->ext_csd.cache_size > 0)) { 2502 (card->ext_csd.cache_size > 0)) {
2503 enable = !!enable; 2503 enable = !!enable;
@@ -2515,7 +2515,6 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
2515 card->ext_csd.cache_ctrl = enable; 2515 card->ext_csd.cache_ctrl = enable;
2516 } 2516 }
2517 } 2517 }
2518 mmc_release_host(host);
2519 2518
2520 return err; 2519 return err;
2521} 2520}
@@ -2534,10 +2533,6 @@ int mmc_suspend_host(struct mmc_host *host)
2534 cancel_delayed_work(&host->detect); 2533 cancel_delayed_work(&host->detect);
2535 mmc_flush_scheduled_work(); 2534 mmc_flush_scheduled_work();
2536 2535
2537 err = mmc_cache_ctrl(host, 0);
2538 if (err)
2539 goto out;
2540
2541 mmc_bus_get(host); 2536 mmc_bus_get(host);
2542 if (host->bus_ops && !host->bus_dead) { 2537 if (host->bus_ops && !host->bus_dead) {
2543 if (host->bus_ops->suspend) { 2538 if (host->bus_ops->suspend) {
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index e6e39111e05b..dc17d4097f9a 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1379,6 +1379,11 @@ static int mmc_suspend(struct mmc_host *host)
1379 BUG_ON(!host->card); 1379 BUG_ON(!host->card);
1380 1380
1381 mmc_claim_host(host); 1381 mmc_claim_host(host);
1382
1383 err = mmc_cache_ctrl(host, 0);
1384 if (err)
1385 goto out;
1386
1382 if (mmc_can_poweroff_notify(host->card)) 1387 if (mmc_can_poweroff_notify(host->card))
1383 err = mmc_poweroff_notify(host->card, EXT_CSD_POWER_OFF_SHORT); 1388 err = mmc_poweroff_notify(host->card, EXT_CSD_POWER_OFF_SHORT);
1384 else if (mmc_card_can_sleep(host)) 1389 else if (mmc_card_can_sleep(host))
@@ -1386,8 +1391,9 @@ static int mmc_suspend(struct mmc_host *host)
1386 else if (!mmc_host_is_spi(host)) 1391 else if (!mmc_host_is_spi(host))
1387 err = mmc_deselect_cards(host); 1392 err = mmc_deselect_cards(host);
1388 host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200); 1393 host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200);
1389 mmc_release_host(host);
1390 1394
1395out:
1396 mmc_release_host(host);
1391 return err; 1397 return err;
1392} 1398}
1393 1399