arch/arm64/src/imx9/imx9_lpspi.c: Small cache operation optimization

There is no need to invalidate the RX buffer before every transfer.
It is never gets dirty, so it is good to invalidate initially after allocation,
and after each transfer.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen 2024-10-23 11:15:44 +03:00 committed by Xiang Xiao
parent 6cadfc16cd
commit cdd11112fd
1 changed files with 6 additions and 8 deletions

View File

@ -1386,14 +1386,6 @@ static void imx9_lpspi_exchange(struct spi_dev_s *dev,
(uintptr_t)priv->txbuf + nbytes);
}
if (rxbuffer)
{
/* Prepare the RX buffer for DMA */
up_invalidate_dcache((uintptr_t)priv->rxbuf,
(uintptr_t)priv->rxbuf + nbytes);
}
/* Set up the DMA */
adjust = (priv->nbits > 8) ? 2 : 1;
@ -2079,6 +2071,12 @@ struct spi_dev_s *imx9_lpspibus_initialize(int bus)
priv->txbuf = imx9_dma_alloc(CONFIG_IMX9_LPSPI_DMA_BUFFER_SIZE);
priv->rxbuf = imx9_dma_alloc(CONFIG_IMX9_LPSPI_DMA_BUFFER_SIZE);
DEBUGASSERT(priv->txbuf && priv->rxbuf);
/* Invalidate the RX buffer area initially */
up_invalidate_dcache((uintptr_t)priv->rxbuf,
(uintptr_t)priv->rxbuf +
CONFIG_IMX9_LPSPI_DMA_BUFFER_SIZE);
}
}
else