]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.6/spi-s3c64xx-use-dma-mode-from-fifo-size.patch
d8e5086d7da1dee0092c5b2d2a51132d81509387
[thirdparty/kernel/stable-queue.git] / queue-6.6 / spi-s3c64xx-use-dma-mode-from-fifo-size.patch
1 From 93a58640567adeddf6820d53caf13285d9f8fb7c Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Fri, 29 Mar 2024 17:58:40 +0900
4 Subject: spi: s3c64xx: Use DMA mode from fifo size
5
6 From: Jaewon Kim <jaewon02.kim@samsung.com>
7
8 [ Upstream commit a3d3eab627bbbb0cb175910cf8d0f7022628a642 ]
9
10 If the SPI data size is smaller than FIFO, it operates in PIO mode,
11 and if it is larger than FIFO size, it oerates in DMA mode.
12
13 If the SPI data size is equal to fifo, it operates in PIO mode and it is
14 separated to 2 transfers. To prevent it, it must operate in DMA mode
15 from the case where the data size and the fifo size are the same.
16
17 Fixes: 1ee806718d5e ("spi: s3c64xx: support interrupt based pio mode")
18 Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
19 Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
20 Link: https://lore.kernel.org/r/20240329085840.65856-1-jaewon02.kim@samsung.com
21 Signed-off-by: Mark Brown <broonie@kernel.org>
22 Signed-off-by: Sasha Levin <sashal@kernel.org>
23 ---
24 drivers/spi/spi-s3c64xx.c | 5 ++---
25 1 file changed, 2 insertions(+), 3 deletions(-)
26
27 diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
28 index e059fb9db1da1..652eadbefe24c 100644
29 --- a/drivers/spi/spi-s3c64xx.c
30 +++ b/drivers/spi/spi-s3c64xx.c
31 @@ -424,7 +424,7 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host,
32 struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host);
33
34 if (sdd->rx_dma.ch && sdd->tx_dma.ch)
35 - return xfer->len > sdd->fifo_depth;
36 + return xfer->len >= sdd->fifo_depth;
37
38 return false;
39 }
40 @@ -783,10 +783,9 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host,
41 return status;
42 }
43
44 - if (!is_polling(sdd) && (xfer->len > fifo_len) &&
45 + if (!is_polling(sdd) && xfer->len >= fifo_len &&
46 sdd->rx_dma.ch && sdd->tx_dma.ch) {
47 use_dma = 1;
48 -
49 } else if (xfer->len >= fifo_len) {
50 tx_buf = xfer->tx_buf;
51 rx_buf = xfer->rx_buf;
52 --
53 2.43.0
54