Always wait 'command done' interrupt status bit before proceeding next command.

Sponsored by:	DARPA, AFRL
This commit is contained in:
Ruslan Bukin 2014-10-08 08:51:05 +00:00
parent 4799d48568
commit fdbf76c383

View File

@ -348,9 +348,10 @@ dwmmc_tasklet(struct dwmmc_softc *sc)
if (cmd == NULL) if (cmd == NULL)
return; return;
if (cmd->error != MMC_ERR_NONE) { if (!sc->cmd_done)
dwmmc_next_operation(sc); return;
} else if (!cmd->data && sc->cmd_done) {
if (cmd->error != MMC_ERR_NONE || !cmd->data) {
dwmmc_next_operation(sc); dwmmc_next_operation(sc);
} else if (cmd->data && sc->dto_rcvd) { } else if (cmd->data && sc->dto_rcvd) {
if ((cmd->opcode == MMC_WRITE_MULTIPLE_BLOCK || if ((cmd->opcode == MMC_WRITE_MULTIPLE_BLOCK ||
@ -394,11 +395,8 @@ dwmmc_intr(void *arg)
dprintf("data err 0x%08x cmd 0x%08x\n", dprintf("data err 0x%08x cmd 0x%08x\n",
reg, cmd->opcode); reg, cmd->opcode);
cmd->error = MMC_ERR_FAILED; cmd->error = MMC_ERR_FAILED;
dma_done(sc, cmd); dma_done(sc, cmd);
dma_stop(sc); dma_stop(sc);
DWMMC_UNLOCK(sc);
return;
} }
if (reg & SDMMC_INTMASK_CMD_DONE) { if (reg & SDMMC_INTMASK_CMD_DONE) {