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.

Change-Id: I80c6cbf9ad3e81943aee4b844c267c8e4f360257
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>
Git-commit: 1a6fd1533dfa409e48f377db1d92ef1cc6b0c4ce
Git-repo: https://android.googlesource.com/kernel/common.git
[kaushalk@codeaurora.org: Resolved context conflicts]
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
This commit is contained in:
Ulf Hansson 2013-12-16 16:23:22 +01:00 committed by Kaushal Kumar
parent 58dd0915dd
commit 107cd6cb6c
3 changed files with 1 additions and 57 deletions

View File

@ -4014,60 +4014,6 @@ int mmc_flush_cache(struct mmc_card *card)
}
EXPORT_SYMBOL(mmc_flush_cache);
/*
* Turn the cache ON/OFF.
* Turning the cache OFF shall trigger flushing of the data
* to the non-volatile storage.
* This function should be called with host claimed
*/
int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
{
struct mmc_card *card = host->card;
unsigned int timeout;
int err = 0, rc;
BUG_ON(!card);
timeout = card->ext_csd.generic_cmd6_time;
if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) ||
mmc_card_is_removable(host) ||
(card->quirks & MMC_QUIRK_CACHE_DISABLE))
return err;
if (card && mmc_card_mmc(card) &&
(card->ext_csd.cache_size > 0)) {
enable = !!enable;
if (card->ext_csd.cache_ctrl ^ enable) {
if (!enable)
timeout = MMC_FLUSH_REQ_TIMEOUT_MS;
err = mmc_switch_ignore_timeout(card,
EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_CACHE_CTRL, enable, timeout);
if (err == -ETIMEDOUT && !enable) {
pr_err("%s:cache disable operation timeout\n",
mmc_hostname(card->host));
rc = mmc_interrupt_hpi(card);
if (rc)
pr_err("%s: mmc_interrupt_hpi() failed (%d)\n",
mmc_hostname(host), rc);
} else if (err) {
pr_err("%s: cache %s error %d\n",
mmc_hostname(card->host),
enable ? "on" : "off",
err);
} else {
card->ext_csd.cache_ctrl = enable;
}
}
}
return err;
}
EXPORT_SYMBOL(mmc_cache_ctrl);
#ifdef CONFIG_PM
/**

View File

@ -1927,7 +1927,7 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
*/
mmc_disable_clk_scaling(host);
err = mmc_cache_ctrl(host, 0);
err = mmc_flush_cache(host->card);
if (err)
goto out;

View File

@ -591,8 +591,6 @@ int mmc_power_restore_host(struct mmc_host *host);
void mmc_detect_change(struct mmc_host *, unsigned long delay);
void mmc_request_done(struct mmc_host *, struct mmc_request *);
int mmc_cache_ctrl(struct mmc_host *, u8);
static inline void mmc_signal_sdio_irq(struct mmc_host *host)
{
if (!host->sdio_irqs) {