mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 16:37:50 +00:00
mmc: core: Default to generic_cmd6_time as timeout in __mmc_switch()
commit 533a6cfe08
upstream
All callers of __mmc_switch() should now be specifying a valid timeout for
the CMD6 command. However, just to be sure, let's print a warning and
default to use the generic_cmd6_time in case the provided timeout_ms
argument is zero.
In this context, let's also simplify some of the corresponding code and
clarify some related comments.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20200122142747.5690-4-ulf.hansson@linaro.org
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d471e9e673
commit
327b668989
1 changed files with 8 additions and 10 deletions
|
@ -458,10 +458,6 @@ static int mmc_poll_for_busy(struct mmc_card *card, unsigned int timeout_ms,
|
||||||
bool expired = false;
|
bool expired = false;
|
||||||
bool busy = false;
|
bool busy = false;
|
||||||
|
|
||||||
/* We have an unspecified cmd timeout, use the fallback value. */
|
|
||||||
if (!timeout_ms)
|
|
||||||
timeout_ms = MMC_OPS_TIMEOUT_MS;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In cases when not allowed to poll by using CMD13 or because we aren't
|
* In cases when not allowed to poll by using CMD13 or because we aren't
|
||||||
* capable of polling by using ->card_busy(), then rely on waiting the
|
* capable of polling by using ->card_busy(), then rely on waiting the
|
||||||
|
@ -534,13 +530,19 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
|
||||||
|
|
||||||
mmc_retune_hold(host);
|
mmc_retune_hold(host);
|
||||||
|
|
||||||
|
if (!timeout_ms) {
|
||||||
|
pr_warn("%s: unspecified timeout for CMD6 - use generic\n",
|
||||||
|
mmc_hostname(host));
|
||||||
|
timeout_ms = card->ext_csd.generic_cmd6_time;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the cmd timeout and the max_busy_timeout of the host are both
|
* If the cmd timeout and the max_busy_timeout of the host are both
|
||||||
* specified, let's validate them. A failure means we need to prevent
|
* specified, let's validate them. A failure means we need to prevent
|
||||||
* the host from doing hw busy detection, which is done by converting
|
* the host from doing hw busy detection, which is done by converting
|
||||||
* to a R1 response instead of a R1B.
|
* to a R1 response instead of a R1B.
|
||||||
*/
|
*/
|
||||||
if (timeout_ms && host->max_busy_timeout &&
|
if (host->max_busy_timeout &&
|
||||||
(timeout_ms > host->max_busy_timeout))
|
(timeout_ms > host->max_busy_timeout))
|
||||||
use_r1b_resp = false;
|
use_r1b_resp = false;
|
||||||
|
|
||||||
|
@ -552,10 +554,6 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
|
||||||
cmd.flags = MMC_CMD_AC;
|
cmd.flags = MMC_CMD_AC;
|
||||||
if (use_r1b_resp) {
|
if (use_r1b_resp) {
|
||||||
cmd.flags |= MMC_RSP_SPI_R1B | MMC_RSP_R1B;
|
cmd.flags |= MMC_RSP_SPI_R1B | MMC_RSP_R1B;
|
||||||
/*
|
|
||||||
* A busy_timeout of zero means the host can decide to use
|
|
||||||
* whatever value it finds suitable.
|
|
||||||
*/
|
|
||||||
cmd.busy_timeout = timeout_ms;
|
cmd.busy_timeout = timeout_ms;
|
||||||
} else {
|
} else {
|
||||||
cmd.flags |= MMC_RSP_SPI_R1 | MMC_RSP_R1;
|
cmd.flags |= MMC_RSP_SPI_R1 | MMC_RSP_R1;
|
||||||
|
|
Loading…
Reference in a new issue