]> Git Repo - linux.git/commitdiff
spi: spi-fsl-dspi: Fix SPI transfer issue when using multiple SPI_IOC_MESSAGE
authorSanchayan Maity <[email protected]>
Thu, 17 Nov 2016 12:16:48 +0000 (17:46 +0530)
committerMark Brown <[email protected]>
Fri, 18 Nov 2016 12:03:32 +0000 (12:03 +0000)
Current DMA implementation had a bug where the DMA transfer would
exit the loop in dspi_transfer_one_message after the completion of
a single transfer. This results in a multi message transfer submitted
with SPI_IOC_MESSAGE to terminate incorrectly without an error.

Signed-off-by: Sanchayan Maity <[email protected]>
Reviewed-by: Stefan Agner <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
drivers/spi/spi-fsl-dspi.c

index bc64700b514dfc64472f9287a2e2d3a3c6a327d2..b1ee1f521ba04e2b00299fb3a09240ace27c9abf 100644 (file)
@@ -714,7 +714,7 @@ static int dspi_transfer_one_message(struct spi_master *master,
                                SPI_RSER_TFFFE | SPI_RSER_TFFFD |
                                SPI_RSER_RFDFE | SPI_RSER_RFDFD);
                        status = dspi_dma_xfer(dspi);
-                       goto out;
+                       break;
                default:
                        dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n",
                                trans_mode);
@@ -722,9 +722,13 @@ static int dspi_transfer_one_message(struct spi_master *master,
                        goto out;
                }
 
-               if (wait_event_interruptible(dspi->waitq, dspi->waitflags))
-                       dev_err(&dspi->pdev->dev, "wait transfer complete fail!\n");
-               dspi->waitflags = 0;
+               if (trans_mode != DSPI_DMA_MODE) {
+                       if (wait_event_interruptible(dspi->waitq,
+                                               dspi->waitflags))
+                               dev_err(&dspi->pdev->dev,
+                                       "wait transfer complete fail!\n");
+                       dspi->waitflags = 0;
+               }
 
                if (transfer->delay_usecs)
                        udelay(transfer->delay_usecs);
This page took 0.059351 seconds and 4 git commands to generate.