Author: br
Date: Wed Oct  8 08:51:05 2014
New Revision: 272736
URL: https://svnweb.freebsd.org/changeset/base/272736

Log:
  Always wait 'command done' interrupt status bit before proceeding next 
command.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/mmc/host/dwmmc.c

Modified: head/sys/dev/mmc/host/dwmmc.c
==============================================================================
--- head/sys/dev/mmc/host/dwmmc.c       Wed Oct  8 08:48:18 2014        
(r272735)
+++ head/sys/dev/mmc/host/dwmmc.c       Wed Oct  8 08:51:05 2014        
(r272736)
@@ -348,9 +348,10 @@ dwmmc_tasklet(struct dwmmc_softc *sc)
        if (cmd == NULL)
                return;
 
-       if (cmd->error != MMC_ERR_NONE) {
-               dwmmc_next_operation(sc);
-       } else if (!cmd->data && sc->cmd_done) {
+       if (!sc->cmd_done)
+               return;
+
+       if (cmd->error != MMC_ERR_NONE || !cmd->data) {
                dwmmc_next_operation(sc);
        } else if (cmd->data && sc->dto_rcvd) {
                if ((cmd->opcode == MMC_WRITE_MULTIPLE_BLOCK ||
@@ -394,11 +395,8 @@ dwmmc_intr(void *arg)
                        dprintf("data err 0x%08x cmd 0x%08x\n",
                                reg, cmd->opcode);
                        cmd->error = MMC_ERR_FAILED;
-
                        dma_done(sc, cmd);
                        dma_stop(sc);
-                       DWMMC_UNLOCK(sc);
-                       return;
                }
 
                if (reg & SDMMC_INTMASK_CMD_DONE) {
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to