diff options
author | Tom Rini <trini@konsulko.com> | 2023-07-18 20:42:16 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-07-18 20:42:16 -0400 |
commit | 6f1b951500707e46f2920c0034856ada018aabcb (patch) | |
tree | 59c30ba5b1f778f763b3060edc57f1f7849fca41 /drivers/mmc/mmc.c | |
parent | 890233ca5569e5787d8407596a12b9fca80952bf (diff) | |
parent | 50dee4f3610331cc31f1f02f9d4116b716907011 (diff) |
Merge https://source.denx.de/u-boot/custodians/u-boot-mmc
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r-- | drivers/mmc/mmc.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 72c1076c56..31cfda2885 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -398,6 +398,26 @@ int mmc_send_tuning(struct mmc *mmc, u32 opcode, int *cmd_error) } #endif +int mmc_send_stop_transmission(struct mmc *mmc, bool write) +{ + struct mmc_cmd cmd; + + cmd.cmdidx = MMC_CMD_STOP_TRANSMISSION; + cmd.cmdarg = 0; + /* + * JEDEC Standard No. 84-B51 Page 126 + * CMD12 STOP_TRANSMISSION R1/R1b[3] + * NOTE 3 R1 for read cases and R1b for write cases. + * + * Physical Layer Simplified Specification Version 9.00 + * 7.3.1.3 Detailed Command Description + * CMD12 R1b + */ + cmd.resp_type = (IS_SD(mmc) || write) ? MMC_RSP_R1b : MMC_RSP_R1; + + return mmc_send_cmd(mmc, &cmd, NULL); +} + static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start, lbaint_t blkcnt) { @@ -425,10 +445,7 @@ static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start, return 0; if (blkcnt > 1) { - cmd.cmdidx = MMC_CMD_STOP_TRANSMISSION; - cmd.cmdarg = 0; - cmd.resp_type = MMC_RSP_R1b; - if (mmc_send_cmd(mmc, &cmd, NULL)) { + if (mmc_send_stop_transmission(mmc, false)) { #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) pr_err("mmc fail to send stop cmd\n"); #endif @@ -2223,6 +2240,7 @@ error: mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_1); mmc_select_mode(mmc, MMC_LEGACY); + mmc_set_clock(mmc, mmc->legacy_speed, MMC_CLK_ENABLE); mmc_set_bus_width(mmc, 1); } } |