From 87a51f4faa6fa75568967e87598f0383cc4336a4 Mon Sep 17 00:00:00 2001 From: Peter van der Perk Date: Fri, 7 Jul 2023 09:42:54 +0200 Subject: [PATCH] imxrt: lpspi dma invalidate cache after exchange --- arch/arm/src/imxrt/imxrt_lpspi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/src/imxrt/imxrt_lpspi.c b/arch/arm/src/imxrt/imxrt_lpspi.c index 1893d8858d..0f1febae48 100644 --- a/arch/arm/src/imxrt/imxrt_lpspi.c +++ b/arch/arm/src/imxrt/imxrt_lpspi.c @@ -1361,12 +1361,6 @@ static void imxrt_lpspi_exchange(struct spi_dev_s *dev, up_clean_dcache((uintptr_t)txbuffer, (uintptr_t)txbuffer + nbytes); } - if (rxbuffer) - { - up_invalidate_dcache((uintptr_t)rxbuffer, - (uintptr_t)rxbuffer + nbytes); - } - /* Set up the DMA */ adjust = (priv->nbits > 8) ? 2 : 1; @@ -1429,6 +1423,12 @@ static void imxrt_lpspi_exchange(struct spi_dev_s *dev, /* Disable DMA */ imxrt_lpspi_putreg32(priv, IMXRT_LPSPI_DER_OFFSET, 0); + + if (rxbuffer) + { + up_invalidate_dcache((uintptr_t)rxbuffer, + (uintptr_t)rxbuffer + nbytes); + } } #endif /* CONFIG_IMXRT_SPI_DMA */