]> err.no Git - linux-2.6/blobdiff - drivers/memstick/host/tifm_ms.c
Merge branches 'pxa' and 'orion-fixes1'
[linux-2.6] / drivers / memstick / host / tifm_ms.c
index 2b5bf52a8302b81be8ac1464548d5490eb085a1f..8577de4ebb0efa11d9103105c87be938f3ce1160 100644 (file)
@@ -182,7 +182,7 @@ static unsigned int tifm_ms_transfer_data(struct tifm_ms *host)
        struct tifm_dev *sock = host->dev;
        unsigned int length;
        unsigned int off;
-       unsigned int t_size, p_off, p_cnt;
+       unsigned int t_size, p_cnt;
        unsigned char *buf;
        struct page *pg;
        unsigned long flags = 0;
@@ -198,6 +198,8 @@ static unsigned int tifm_ms_transfer_data(struct tifm_ms *host)
                host->block_pos);
 
        while (length) {
+               unsigned int uninitialized_var(p_off);
+
                if (host->req->long_data) {
                        pg = nth_page(sg_page(&host->req->sg),
                                      off >> PAGE_SHIFT);
@@ -340,11 +342,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 +435,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;