]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/spi/spi_bfin5xx.c
Merge branch 'linux-2.6' into merge
[linux-2.6-omap-h63xx.git] / drivers / spi / spi_bfin5xx.c
index a2d4884752efb4a46f97b2d9fb743d9ce69dee2d..2ef11bb70b2ee9c5b588a432c006efa0cee2320c 100644 (file)
@@ -39,7 +39,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/spi/spi.h>
 #include <linux/workqueue.h>
-#include <linux/errno.h>
 #include <linux/delay.h>
 
 #include <asm/io.h>
@@ -582,14 +581,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;
        }
 
@@ -1066,7 +1070,7 @@ static int setup(struct spi_device *spi)
                return -ENODEV;
        }
 
-       dev_dbg(&spi->dev, "setup spi chip %s, width is %d, dma is %d,",
+       dev_dbg(&spi->dev, "setup spi chip %s, width is %d, dma is %d\n",
                        spi->modalias, chip->width, chip->enable_dma);
        dev_dbg(&spi->dev, "ctl_reg is 0x%x, flag_reg is 0x%x\n",
                        chip->ctl_reg, chip->flag);
@@ -1102,7 +1106,7 @@ static inline int init_queue(struct driver_data *drv_data)
        /* init messages workqueue */
        INIT_WORK(&drv_data->pump_messages, pump_messages);
        drv_data->workqueue =
-           create_singlethread_workqueue(drv_data->master->cdev.dev->bus_id);
+           create_singlethread_workqueue(drv_data->master->dev.parent->bus_id);
        if (drv_data->workqueue == NULL)
                return -EBUSY;
 
@@ -1298,8 +1302,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,
        },