timeout_us += data->timeout_clks * 1000 /
(mmc_host_clk_rate(card->host) / 1000);
- if (data->flags & MMC_DATA_WRITE)
+ if (data->flags & MMC_DATA_WRITE) {
/*
* The limit is really 250 ms, but that is
* insufficient for some crappy cards.
* interrupt.
*
* Increase this value to be 3s.
+ *
+ * If host has max_discard_to, use max_discard_to as
+ * timeout value. Use max_discard_to -1 to make sure
+ * the write timeout value won't large than the max
*/
- limit_us = 3000000;
- else
+ if (card->host->max_discard_to) {
+ limit_us =
+ (card->host->max_discard_to - 1) * 1000;
+ if (limit_us > 3000000)
+ limit_us = 3000000;
+ } else
+ limit_us = 3000000;
+ } else
limit_us = 100000;
/*
}
if (count >= 0xF) {
- printk(KERN_WARNING "%s: Too large timeout requested for CMD%d!\n",
- mmc_hostname(host->mmc), cmd->opcode);
+ if (target_timeout > (host->mmc->max_discard_to * 1000))
+ pr_warn("%s: Too large timeout requested for CMD%d!\n",
+ mmc_hostname(host->mmc), cmd->opcode);
count = 0xE;
}