diff options
Diffstat (limited to 'drivers/spi/spi_bfin5xx.c')
-rw-r--r-- | drivers/spi/spi_bfin5xx.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 7d2d9ec6cac3..48587c27050d 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) | |||
582 | dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n"); | 582 | dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n"); |
583 | clear_dma_irqstat(CH_SPI); | 583 | clear_dma_irqstat(CH_SPI); |
584 | 584 | ||
585 | /* Wait for DMA to complete */ | ||
586 | while (get_dma_curr_irqstat(CH_SPI) & DMA_RUN) | ||
587 | continue; | ||
588 | |||
585 | /* | 589 | /* |
586 | * wait for the last transaction shifted out. yes, these two | 590 | * wait for the last transaction shifted out. HRM states: |
587 | * while loops are supposed to be the same (see the HRM). | 591 | * at this point there may still be data in the SPI DMA FIFO waiting |
592 | * to be transmitted ... software needs to poll TXS in the SPI_STAT | ||
593 | * register until it goes low for 2 successive reads | ||
588 | */ | 594 | */ |
589 | if (drv_data->tx != NULL) { | 595 | if (drv_data->tx != NULL) { |
590 | while (bfin_read_SPI_STAT() & TXS) | 596 | while ((bfin_read_SPI_STAT() & TXS) || |
591 | continue; | 597 | (bfin_read_SPI_STAT() & TXS)) |
592 | while (bfin_read_SPI_STAT() & TXS) | ||
593 | continue; | 598 | continue; |
594 | } | 599 | } |
595 | 600 | ||
@@ -1082,7 +1087,7 @@ static int setup(struct spi_device *spi) | |||
1082 | */ | 1087 | */ |
1083 | static void cleanup(struct spi_device *spi) | 1088 | static void cleanup(struct spi_device *spi) |
1084 | { | 1089 | { |
1085 | struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi); | 1090 | struct chip_data *chip = spi_get_ctldata(spi); |
1086 | 1091 | ||
1087 | kfree(chip); | 1092 | kfree(chip); |
1088 | } | 1093 | } |