diff mbox series

spi: s3c64xx: Use DMA mode from fifo size

Message ID 20240329085840.65856-1-jaewon02.kim@samsung.com (mailing list archive)
State Accepted
Commit a3d3eab627bbbb0cb175910cf8d0f7022628a642
Headers show
Series spi: s3c64xx: Use DMA mode from fifo size | expand

Commit Message

Jaewon Kim March 29, 2024, 8:58 a.m. UTC
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: 1ee806718d5e ("spi: s3c64xx: support interrupt based pio mode")
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
---
 drivers/spi/spi-s3c64xx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Jaewon Kim March 29, 2024, 9:09 a.m. UTC | #1
On 3/29/24 17:58, Jaewon Kim wrote:
> 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: 1ee806718d5e ("spi: s3c64xx: support interrupt based pio mode")
> Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---
>   drivers/spi/spi-s3c64xx.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index 9fcbe040cb2f..f726d8670428 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -430,7 +430,7 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host,
>   	struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host);
>   
>   	if (sdd->rx_dma.ch && sdd->tx_dma.ch)
> -		return xfer->len > sdd->fifo_depth;
> +		return xfer->len >= sdd->fifo_depth;
>   
>   	return false;
>   }
> @@ -826,10 +826,9 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host,
>   			return status;
>   	}
>   
> -	if (!is_polling(sdd) && (xfer->len > fifo_len) &&
> +	if (!is_polling(sdd) && xfer->len >= fifo_len &&
>   	    sdd->rx_dma.ch && sdd->tx_dma.ch) {
>   		use_dma = 1;
> -
>   	} else if (xfer->len >= fifo_len) {
>   		tx_buf = xfer->tx_buf;
>   		rx_buf = xfer->rx_buf;


Sorry, I didn't add v2 by mistake.

This is v1 mail thread.

  - 
https://lore.kernel.org/linux-arm-kernel/CAPLW+4k4qh4ZYBufZoGbUZN0yxSE2X8bOdkEQVw1Zg9YUVpbug@mail.gmail.com/T/


Thanks

Jaewon Kim
Mark Brown March 29, 2024, 5:35 p.m. UTC | #2
On Fri, 29 Mar 2024 17:58:40 +0900, Jaewon Kim wrote:
> 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.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: s3c64xx: Use DMA mode from fifo size
      commit: a3d3eab627bbbb0cb175910cf8d0f7022628a642

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 9fcbe040cb2f..f726d8670428 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -430,7 +430,7 @@  static bool s3c64xx_spi_can_dma(struct spi_controller *host,
 	struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host);
 
 	if (sdd->rx_dma.ch && sdd->tx_dma.ch)
-		return xfer->len > sdd->fifo_depth;
+		return xfer->len >= sdd->fifo_depth;
 
 	return false;
 }
@@ -826,10 +826,9 @@  static int s3c64xx_spi_transfer_one(struct spi_controller *host,
 			return status;
 	}
 
-	if (!is_polling(sdd) && (xfer->len > fifo_len) &&
+	if (!is_polling(sdd) && xfer->len >= fifo_len &&
 	    sdd->rx_dma.ch && sdd->tx_dma.ch) {
 		use_dma = 1;
-
 	} else if (xfer->len >= fifo_len) {
 		tx_buf = xfer->tx_buf;
 		rx_buf = xfer->rx_buf;