memstick: automatically retrieve "INT" value from command response
[sfrench/cifs-2.6.git] / drivers / memstick / host / tifm_ms.c
index 2b5bf52a8302b81be8ac1464548d5490eb085a1f..eb150dfb637f150da1765e096edda10661312dc1 100644 (file)
@@ -340,11 +340,20 @@ static void tifm_ms_complete_cmd(struct tifm_ms *host)
 
        del_timer(&host->timer);
 
-       if (host->use_dma)
+       host->req->int_reg = readl(sock->addr + SOCK_MS_STATUS) & 0xff;
+       host->req->int_reg = (host->req->int_reg & 1)
+                            | ((host->req->int_reg << 4) & 0xe0);
+
+       writel(TIFM_FIFO_INT_SETALL,
+              sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
+       writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL);
+
+       if (host->use_dma) {
                tifm_unmap_sg(sock, &host->req->sg, 1,
                              host->req->data_dir == READ
                              ? PCI_DMA_FROMDEVICE
                              : PCI_DMA_TODEVICE);
+       }
 
        writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL),
               sock->addr + SOCK_CONTROL);
@@ -424,12 +433,6 @@ static void tifm_ms_card_event(struct tifm_dev *sock)
                else if (host_status & TIFM_MS_STAT_CRC)
                        host->req->error = -EILSEQ;
 
-               if (host->req->error) {
-                       writel(TIFM_FIFO_INT_SETALL,
-                              sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
-                       writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL);
-               }
-
                if (host_status & TIFM_MS_STAT_RDY)
                        host->cmd_flags |= CMD_READY;