Merge "Revert "mmc: core: handle flush requests timeout"" into cm-10.2
This commit is contained in:
commit
cd838940c4
|
@ -59,9 +59,6 @@ static void mmc_clk_scaling(struct mmc_host *host, bool from_wq);
|
|||
*/
|
||||
#define MMC_BKOPS_MAX_TIMEOUT (4 * 60 * 1000) /* max time to wait in ms */
|
||||
|
||||
/* Flushing a large amount of cached data may take a long time. */
|
||||
#define MMC_FLUSH_REQ_TIMEOUT_MS 30000 /* msec */
|
||||
|
||||
static struct workqueue_struct *workqueue;
|
||||
|
||||
/*
|
||||
|
@ -3248,7 +3245,7 @@ EXPORT_SYMBOL(mmc_card_can_sleep);
|
|||
int mmc_flush_cache(struct mmc_card *card)
|
||||
{
|
||||
struct mmc_host *host = card->host;
|
||||
int err = 0, rc;
|
||||
int err = 0;
|
||||
|
||||
if (!(host->caps2 & MMC_CAP2_CACHE_CTRL))
|
||||
return err;
|
||||
|
@ -3257,19 +3254,10 @@ int mmc_flush_cache(struct mmc_card *card)
|
|||
(card->ext_csd.cache_size > 0) &&
|
||||
(card->ext_csd.cache_ctrl & 1)) {
|
||||
err = mmc_switch_ignore_timeout(card, EXT_CSD_CMD_SET_NORMAL,
|
||||
EXT_CSD_FLUSH_CACHE, 1,
|
||||
MMC_FLUSH_REQ_TIMEOUT_MS);
|
||||
if (err == -ETIMEDOUT) {
|
||||
pr_debug("%s: cache flush 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) {
|
||||
EXT_CSD_FLUSH_CACHE, 1, 0);
|
||||
if (err)
|
||||
pr_err("%s: cache flush error %d\n",
|
||||
mmc_hostname(card->host), err);
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -3284,8 +3272,8 @@ EXPORT_SYMBOL(mmc_flush_cache);
|
|||
int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
|
||||
{
|
||||
struct mmc_card *card = host->card;
|
||||
unsigned int timeout = card->ext_csd.generic_cmd6_time;
|
||||
int err = 0, rc;
|
||||
unsigned int timeout;
|
||||
int err = 0;
|
||||
|
||||
if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) ||
|
||||
mmc_card_is_removable(host))
|
||||
|
@ -3299,28 +3287,17 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
|
|||
enable = !!enable;
|
||||
|
||||
if (card->ext_csd.cache_ctrl ^ enable) {
|
||||
if (!enable)
|
||||
timeout = MMC_FLUSH_REQ_TIMEOUT_MS;
|
||||
|
||||
timeout = enable ? card->ext_csd.generic_cmd6_time : 0;
|
||||
err = mmc_switch_ignore_timeout(card,
|
||||
EXT_CSD_CMD_SET_NORMAL,
|
||||
EXT_CSD_CACHE_CTRL, enable, timeout);
|
||||
|
||||
if (err == -ETIMEDOUT && !enable) {
|
||||
pr_debug("%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) {
|
||||
if (err)
|
||||
pr_err("%s: cache %s error %d\n",
|
||||
mmc_hostname(card->host),
|
||||
enable ? "on" : "off",
|
||||
err);
|
||||
} else {
|
||||
else
|
||||
card->ext_csd.cache_ctrl = enable;
|
||||
}
|
||||
}
|
||||
}
|
||||
mmc_release_host(host);
|
||||
|
|
Loading…
Reference in New Issue