Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d6fe89b0630080e2bd6ece20ff7b1b5c2647ed62
Commit:     d6fe89b0630080e2bd6ece20ff7b1b5c2647ed62
Parent:     27bb9e79bcfedc1888d23c3c212c189fa8534fe7
Author:     Bryan Wu <[EMAIL PROTECTED]>
AuthorDate: Mon Jun 11 17:34:17 2007 +0800
Committer:  Bryan Wu <[EMAIL PROTECTED]>
CommitDate: Mon Jun 11 17:34:17 2007 +0800

    Blackfin SPI driver: fix bug SPI DMA incomplete transmission
    
    SPI writes intermittently drop bytes at end of DMA transfer
    
http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=3205
    
http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=2892
    
    Signed-off-by: Mike Frysinger <[EMAIL PROTECTED]>
    Signed-off-by: Bryan Wu <[EMAIL PROTECTED]>
---
 drivers/spi/spi_bfin5xx.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index a2d4884..48587c2 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -582,14 +582,19 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
        dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n");
        clear_dma_irqstat(CH_SPI);
 
+       /* Wait for DMA to complete */
+       while (get_dma_curr_irqstat(CH_SPI) & DMA_RUN)
+               continue;
+
        /*
-        * wait for the last transaction shifted out.  yes, these two
-        * while loops are supposed to be the same (see the HRM).
+        * wait for the last transaction shifted out.  HRM states:
+        * at this point there may still be data in the SPI DMA FIFO waiting
+        * to be transmitted ... software needs to poll TXS in the SPI_STAT
+        * register until it goes low for 2 successive reads
         */
        if (drv_data->tx != NULL) {
-               while (bfin_read_SPI_STAT() & TXS)
-                       continue;
-               while (bfin_read_SPI_STAT() & TXS)
+               while ((bfin_read_SPI_STAT() & TXS) ||
+                      (bfin_read_SPI_STAT() & TXS))
                        continue;
        }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to