diff options
-rw-r--r-- | drivers/mmc/mmc.c | 9 | ||||
-rw-r--r-- | include/mmc.h | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 725a36799d..314affeb6f 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -804,8 +804,10 @@ static int __mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value, * capable of polling by using mmc_wait_dat0, then rely on waiting the * stated timeout to be sufficient. */ - if (ret == -ENOSYS && !send_status) + if (ret == -ENOSYS && !send_status) { mdelay(timeout_ms); + return 0; + } /* Finally wait until the card is ready or indicates a failure * to switch. It doesn't hurt to use CMD13 here even if send_status @@ -816,11 +818,12 @@ static int __mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value, ret = mmc_send_status(mmc, &status); if (!ret && (status & MMC_STATUS_SWITCH_ERROR)) { - pr_debug("switch failed %d/%d/0x%x !\n", set, index, + pr_err("switch failed %d/%d/0x%x !\n", set, index, value); return -EIO; } - if (!ret && (status & MMC_STATUS_RDY_FOR_DATA)) + if (!ret && (status & MMC_STATUS_RDY_FOR_DATA) && + (status & MMC_STATUS_CURR_STATE) == MMC_STATE_TRANS) return 0; udelay(100); } while (get_timer(start) < timeout_ms); diff --git a/include/mmc.h b/include/mmc.h index 82562193cc..097080a460 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -178,6 +178,7 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx) #define MMC_STATUS_ERROR (1 << 19) #define MMC_STATE_PRG (7 << 9) +#define MMC_STATE_TRANS (4 << 9) #define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ #define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */ |