diff options
author | Tom Rini <trini@konsulko.com> | 2016-11-17 11:46:56 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-11-17 11:46:56 -0500 |
commit | c2cbd164ea5b5f564fcf03447c7bf9ec4a9f5699 (patch) | |
tree | 87b539f2c0942f070c78f5d56cd53c5c68bcc2d2 /drivers/mmc/mmc.c | |
parent | 9e40ea04e9f1a70a184504c9e2beb051eb2d9335 (diff) | |
parent | 91f839d2d30e489c2d6bf0deafb65b01d416b715 (diff) |
Merge branch 'master' of http://git.denx.de/u-boot-mmc
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r-- | drivers/mmc/mmc.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 4380c7c195..d6b7e4f510 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -494,6 +494,7 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value) { struct mmc_cmd cmd; int timeout = 1000; + int retries = 3; int ret; cmd.cmdidx = MMC_CMD_SWITCH; @@ -502,11 +503,17 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value) (index << 16) | (value << 8); - ret = mmc_send_cmd(mmc, &cmd, NULL); + while (retries > 0) { + ret = mmc_send_cmd(mmc, &cmd, NULL); - /* Waiting for the ready status */ - if (!ret) - ret = mmc_send_status(mmc, timeout); + /* Waiting for the ready status */ + if (!ret) { + ret = mmc_send_status(mmc, timeout); + return ret; + } + + retries--; + } return ret; |