Skip to content

Commit a3d3eab

Browse files
jwn0222broonie
authored andcommitted
spi: s3c64xx: Use DMA mode from fifo size
If the SPI data size is smaller than FIFO, it operates in PIO mode, and if it is larger than FIFO size, it oerates in DMA mode. If the SPI data size is equal to fifo, it operates in PIO mode and it is separated to 2 transfers. To prevent it, it must operate in DMA mode from the case where the data size and the fifo size are the same. Fixes: 1ee8067 ("spi: s3c64xx: support interrupt based pio mode") Signed-off-by: Jaewon Kim <[email protected]> Reviewed-by: Sam Protsenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 4cece76 commit a3d3eab

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/spi/spi-s3c64xx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host,
430430
struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host);
431431

432432
if (sdd->rx_dma.ch && sdd->tx_dma.ch)
433-
return xfer->len > sdd->fifo_depth;
433+
return xfer->len >= sdd->fifo_depth;
434434

435435
return false;
436436
}
@@ -826,10 +826,9 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host,
826826
return status;
827827
}
828828

829-
if (!is_polling(sdd) && (xfer->len > fifo_len) &&
829+
if (!is_polling(sdd) && xfer->len >= fifo_len &&
830830
sdd->rx_dma.ch && sdd->tx_dma.ch) {
831831
use_dma = 1;
832-
833832
} else if (xfer->len >= fifo_len) {
834833
tx_buf = xfer->tx_buf;
835834
rx_buf = xfer->rx_buf;

0 commit comments

Comments
 (0)