diff options
author | Oleksii Bidnichenko <oleksii.bidnichenko@toradex.com> | 2021-09-09 16:51:43 +0300 |
---|---|---|
committer | Oleksii Bidnichenko <oleksii.bidnichenko@toradex.com> | 2021-09-10 15:26:08 +0300 |
commit | bbb0acc44b2b90a6eaaa760c64c0ec1e5938bea0 (patch) | |
tree | 5036153dc0663187606e3f312026d4df0010fda2 | |
parent | ac9771a867e83e37dd2049c5c9075058746f6a82 (diff) |
mmc: merge upstream __mmc_switch fixes
commit 8e2b0af7216d78b60fccb46a107a4a047938aea9 upstream.
commit ef5ab0d13a7a44469f6c765c8acc8d54c23213de upstream.
Update a __mmc_switch MMC_STATUS_SWITCH_ERROR notification level from
debug to error.
Related-to: ELB-4082
Signed-off-by: Oleksii Bidnichenko <oleksii.bidnichenko@toradex.com>
(cherry picked from commit 675f0f6db0de49316f839f6e9fcbc6f2a007b7d8)
-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 */ |