summaryrefslogtreecommitdiff
path: root/drivers/mmc/mmc.c
diff options
context:
space:
mode:
authorStefano Babic <sbabic@denx.de>2016-11-29 16:28:28 +0100
committerStefano Babic <sbabic@denx.de>2016-11-29 16:28:28 +0100
commit2d221489df021393654805536be7effcb9d39702 (patch)
tree1b636f10b4ccde42624ec665df13288408b59b7f /drivers/mmc/mmc.c
parent45a3ad81fafe3090f7f89b458f6bd9f547a453df (diff)
parente94793c844a40606252f2e3f6428063e057b3fd2 (diff)
downloadu-boot-imx-2d221489df021393654805536be7effcb9d39702.zip
u-boot-imx-2d221489df021393654805536be7effcb9d39702.tar.gz
u-boot-imx-2d221489df021393654805536be7effcb9d39702.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot
Signed-off-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r--drivers/mmc/mmc.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 4380c7c..d6b7e4f 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;