diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2013-12-16 10:23:22 -0500 |
---|---|---|
committer | Chris Ball <chris@printf.net> | 2014-02-13 22:58:41 -0500 |
commit | 10e5d9652499a8bc0a99ffc2a96a3030fee576cb (patch) | |
tree | 96e06b53dd98374f23223aba1cd84ae54af36ff5 | |
parent | 469a00b017a9b2c630bff962ffd64ba626977830 (diff) |
mmc: core: Use mmc_flush_cache() during mmc suspend
Earlier we disabled the cache during suspend, which meant a flush was
internally at the eMMC performed as well.
To simplify code we can make use of the mmc_flush_cache(), during mmc
suspend, which makes the mmc_cache_ctrl() redundant so then we can
remove it.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
-rw-r--r-- | drivers/mmc/core/core.c | 38 | ||||
-rw-r--r-- | drivers/mmc/core/mmc.c | 2 | ||||
-rw-r--r-- | include/linux/mmc/host.h | 2 |
3 files changed, 1 insertions, 41 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 22427c684b36..8928f9f4cfe1 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -2582,44 +2582,6 @@ int mmc_flush_cache(struct mmc_card *card) | |||
2582 | } | 2582 | } |
2583 | EXPORT_SYMBOL(mmc_flush_cache); | 2583 | EXPORT_SYMBOL(mmc_flush_cache); |
2584 | 2584 | ||
2585 | /* | ||
2586 | * Turn the cache ON/OFF. | ||
2587 | * Turning the cache OFF shall trigger flushing of the data | ||
2588 | * to the non-volatile storage. | ||
2589 | * This function should be called with host claimed | ||
2590 | */ | ||
2591 | int mmc_cache_ctrl(struct mmc_host *host, u8 enable) | ||
2592 | { | ||
2593 | struct mmc_card *card = host->card; | ||
2594 | unsigned int timeout; | ||
2595 | int err = 0; | ||
2596 | |||
2597 | if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) || | ||
2598 | mmc_card_is_removable(host)) | ||
2599 | return err; | ||
2600 | |||
2601 | if (card && mmc_card_mmc(card) && | ||
2602 | (card->ext_csd.cache_size > 0)) { | ||
2603 | enable = !!enable; | ||
2604 | |||
2605 | if (card->ext_csd.cache_ctrl ^ enable) { | ||
2606 | timeout = enable ? card->ext_csd.generic_cmd6_time : 0; | ||
2607 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
2608 | EXT_CSD_CACHE_CTRL, enable, timeout); | ||
2609 | if (err) | ||
2610 | pr_err("%s: cache %s error %d\n", | ||
2611 | mmc_hostname(card->host), | ||
2612 | enable ? "on" : "off", | ||
2613 | err); | ||
2614 | else | ||
2615 | card->ext_csd.cache_ctrl = enable; | ||
2616 | } | ||
2617 | } | ||
2618 | |||
2619 | return err; | ||
2620 | } | ||
2621 | EXPORT_SYMBOL(mmc_cache_ctrl); | ||
2622 | |||
2623 | #ifdef CONFIG_PM | 2585 | #ifdef CONFIG_PM |
2624 | 2586 | ||
2625 | /* Do the card removal on suspend if card is assumed removeable | 2587 | /* Do the card removal on suspend if card is assumed removeable |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 5c4ee6ab2125..6d446e217f36 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -1481,7 +1481,7 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend) | |||
1481 | goto out; | 1481 | goto out; |
1482 | } | 1482 | } |
1483 | 1483 | ||
1484 | err = mmc_cache_ctrl(host, 0); | 1484 | err = mmc_flush_cache(host->card); |
1485 | if (err) | 1485 | if (err) |
1486 | goto out; | 1486 | goto out; |
1487 | 1487 | ||
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 4c0176a8e474..f69bd70b1046 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -385,8 +385,6 @@ int mmc_power_restore_host(struct mmc_host *host); | |||
385 | void mmc_detect_change(struct mmc_host *, unsigned long delay); | 385 | void mmc_detect_change(struct mmc_host *, unsigned long delay); |
386 | void mmc_request_done(struct mmc_host *, struct mmc_request *); | 386 | void mmc_request_done(struct mmc_host *, struct mmc_request *); |
387 | 387 | ||
388 | int mmc_cache_ctrl(struct mmc_host *, u8); | ||
389 | |||
390 | static inline void mmc_signal_sdio_irq(struct mmc_host *host) | 388 | static inline void mmc_signal_sdio_irq(struct mmc_host *host) |
391 | { | 389 | { |
392 | host->ops->enable_sdio_irq(host, 0); | 390 | host->ops->enable_sdio_irq(host, 0); |