X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=drivers%2Fspi%2Fspi_bfin5xx.c;h=f540ed77a1021cda053c72d3e8c293606b31e099;hb=91fe7d7cdd7ebb0b6c01f201a23824ab5b466ada;hp=7d2d9ec6cac31ac3aac880027041427a9a6dbdb3;hpb=080e89270a7bfb7d01fac9a67050f8ac6d6cdd11;p=~andy%2Flinux diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 7d2d9ec6cac..f540ed77a10 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; } @@ -1082,7 +1087,7 @@ static int setup(struct spi_device *spi) */ static void cleanup(struct spi_device *spi) { - struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi); + struct chip_data *chip = spi_get_ctldata(spi); kfree(chip); } @@ -1298,8 +1303,9 @@ static int bfin5xx_spi_resume(struct platform_device *pdev) #define bfin5xx_spi_resume NULL #endif /* CONFIG_PM */ +MODULE_ALIAS("bfin-spi-master"); /* for platform bus hotplug */ static struct platform_driver bfin5xx_spi_driver = { - .driver = { + .driver = { .name = "bfin-spi-master", .owner = THIS_MODULE, },