Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98114304 authored by Sanchayan Maity's avatar Sanchayan Maity Committed by Mark Brown
Browse files

spi: spi-fsl-dspi: Fix SPI transfer issue when using multiple SPI_IOC_MESSAGE



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: default avatarSanchayan Maity <maitysanchayan@gmail.com>
Reviewed-by: default avatarStefan Agner <stefan@agner.ch>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 90ba3703
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -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");
		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);