mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 14:41:31 +00:00
mmc: sdhci: clean up timeout detection
The current timeout detection logic is not very nice; it calls get_timer(start) in the while() loop, and then calls it again after the loop to check if a timeout error happened. Because of the time difference between the two calls of get_timer(), the timeout detected after the loop may not be true. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
This commit is contained in:
parent
e1efe43c71
commit
bae4a1fdf5
1 changed files with 9 additions and 9 deletions
|
@ -252,17 +252,17 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
|
||||||
stat = sdhci_readl(host, SDHCI_INT_STATUS);
|
stat = sdhci_readl(host, SDHCI_INT_STATUS);
|
||||||
if (stat & SDHCI_INT_ERROR)
|
if (stat & SDHCI_INT_ERROR)
|
||||||
break;
|
break;
|
||||||
} while (((stat & mask) != mask) &&
|
|
||||||
(get_timer(start) < SDHCI_READ_STATUS_TIMEOUT));
|
|
||||||
|
|
||||||
if (get_timer(start) >= SDHCI_READ_STATUS_TIMEOUT) {
|
if (get_timer(start) >= SDHCI_READ_STATUS_TIMEOUT) {
|
||||||
if (host->quirks & SDHCI_QUIRK_BROKEN_R1B)
|
if (host->quirks & SDHCI_QUIRK_BROKEN_R1B) {
|
||||||
return 0;
|
return 0;
|
||||||
else {
|
} else {
|
||||||
printf("%s: Timeout for status update!\n", __func__);
|
printf("%s: Timeout for status update!\n",
|
||||||
return TIMEOUT;
|
__func__);
|
||||||
|
return TIMEOUT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} while ((stat & mask) != mask);
|
||||||
|
|
||||||
if ((stat & (SDHCI_INT_ERROR | mask)) == mask) {
|
if ((stat & (SDHCI_INT_ERROR | mask)) == mask) {
|
||||||
sdhci_cmd_done(host, cmd);
|
sdhci_cmd_done(host, cmd);
|
||||||
|
|
Loading…
Add table
Reference in a new issue