diff options
author | Tom Rini <trini@konsulko.com> | 2025-07-24 07:54:20 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-07-24 07:54:20 -0600 |
commit | 47b4a9b1a6d92d0b53b427880226180ffc3c8fe3 (patch) | |
tree | 632bee726e3db3d1b53ff1e972bf169b892065a0 /drivers/mmc/mmc_write.c | |
parent | 3532f1f5edfc97c9dcea723cdeb732eda44bc669 (diff) | |
parent | 1080815650a00257929f645bedf4e1795bf188bf (diff) |
Merge tag 'mmc-master-2025-07-24' of https://source.denx.de/u-boot/custodians/u-boot-mmc
CI: https://source.denx.de/u-boot/custodians/u-boot-mmc/-/pipelines/27140
- Fix emmc error state after mmc write timeout
- Minor cleanup s5p_sdhci
- Support DT upstream for exynos5420 and exynos4210 mmc
Diffstat (limited to 'drivers/mmc/mmc_write.c')
-rw-r--r-- | drivers/mmc/mmc_write.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/mmc/mmc_write.c b/drivers/mmc/mmc_write.c index 90fcf2679bb..928c05872ca 100644 --- a/drivers/mmc/mmc_write.c +++ b/drivers/mmc/mmc_write.c @@ -155,6 +155,7 @@ static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t start, struct mmc_cmd cmd; struct mmc_data data; int timeout_ms = 1000; + int err; if ((start + blkcnt) > mmc_get_blk_desc(mmc)->lba) { printf("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n", @@ -181,9 +182,13 @@ static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t start, data.blocksize = mmc->write_bl_len; data.flags = MMC_DATA_WRITE; - if (mmc_send_cmd(mmc, &cmd, &data)) { + err = mmc_send_cmd(mmc, &cmd, &data); + if (err) { printf("mmc write failed\n"); - return 0; + /* + * Don't return 0 here since the emmc will still be in data + * transfer mode continue to send the STOP_TRANSMISSION command + */ } /* SPI multiblock writes terminate using a special @@ -203,6 +208,9 @@ static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t start, if (mmc_poll_for_busy(mmc, timeout_ms)) return 0; + if (err) + return 0; + return blkcnt; } |