The pxamci driver was not waiting for the BUSY line to be deasserted. This was specifically breaking the CMD12 at the end of block multiple writes, when the SD card had not time enough to commit the last write. Fix it by waiting for PRG_DONE bit (which is actually the busy signal end condition). Signed-off-by: Robert Jarzmik <robert.jarzmik@xxxxxxx> --- drivers/mci/pxamci.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mci/pxamci.c b/drivers/mci/pxamci.c index c51fb77..9665196 100644 --- a/drivers/mci/pxamci.c +++ b/drivers/mci/pxamci.c @@ -239,13 +239,17 @@ static int pxamci_cmd_response(struct pxamci_host *host, struct mci_cmd *cmd) static int pxamci_mmccmd(struct pxamci_host *host, struct mci_cmd *cmd, struct mci_data *data, unsigned int cmddat) { - int ret = 0; + int ret = 0, stat_mask; uint64_t start; pxamci_start_cmd(host, cmd, cmddat); + + stat_mask = STAT_END_CMD_RES; + if (cmd->resp_type & MMC_RSP_BUSY) + stat_mask |= STAT_PRG_DONE; for (start = get_time_ns(), ret = -ETIMEDOUT; ret && !is_timeout(start, CMD_TIMEOUT);) - if (mmc_readl(MMC_STAT) & STAT_END_CMD_RES) + if ((mmc_readl(MMC_STAT) & stat_mask) == stat_mask) ret = 0; if (!ret && data) -- 1.7.5.4 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox