From 4fbb0c0a33fe7ce1dd613e1e9222153ba2ac55d6 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Tue, 22 Oct 2024 15:09:52 +0300 Subject: [PATCH] arch/arm64/src/imx9/imx9_lpspi.c: Fix 9-16 bit transfers Signed-off-by: Jukka Laitinen --- arch/arm64/src/imx9/imx9_lpspi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/src/imx9/imx9_lpspi.c b/arch/arm64/src/imx9/imx9_lpspi.c index b373b04c8f213..5d8e788115002 100644 --- a/arch/arm64/src/imx9/imx9_lpspi.c +++ b/arch/arm64/src/imx9/imx9_lpspi.c @@ -1323,7 +1323,7 @@ static void imx9_lpspi_exchange(struct spi_dev_s *dev, /* Convert the number of word to a number of bytes */ - nbytes = (priv->nbits > 8) ? nwords << 2 : nwords; + nbytes = (priv->nbits > 8) ? nwords << 1 : nwords; /* Invalid DMA channels fall back to non-DMA method. */ @@ -1404,7 +1404,7 @@ static void imx9_lpspi_exchange(struct spi_dev_s *dev, config.daddr = (uintptr_t) (rxbuffer ? priv->rxbuf : rxdummy); config.soff = 0; config.doff = rxbuffer ? adjust : 0; - config.iter = nbytes; + config.iter = nwords; config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE; config.ssize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT; config.dsize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT; @@ -1418,7 +1418,7 @@ static void imx9_lpspi_exchange(struct spi_dev_s *dev, config.daddr = priv->spibase + IMX9_LPSPI_TDR_OFFSET; config.soff = txbuffer ? adjust : 0; config.doff = 0; - config.iter = nbytes; + config.iter = nwords; config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE; config.ssize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT; config.dsize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;