diff --git a/arch/arm64/src/imx9/imx9_flexspi_nor.c b/arch/arm64/src/imx9/imx9_flexspi_nor.c index f117207d612b2..bc4ac01afe78b 100644 --- a/arch/arm64/src/imx9/imx9_flexspi_nor.c +++ b/arch/arm64/src/imx9/imx9_flexspi_nor.c @@ -790,12 +790,15 @@ static ssize_t imx9_flexspi_nor_read(struct mtd_dev_s *dev, } src = priv->ahb_base + offset; - DEBUGASSERT(((uintptr_t)src & ALIGN_MASK) == 0); up_invalidate_dcache((uintptr_t)buffer, (uintptr_t)buffer + ALIGN_UP(nbytes)); + int n = nbytes; - memcpy(buffer, src, nbytes); + while (n-- > 0) + { + *buffer++ = *src++; + } up_clean_dcache((uintptr_t)buffer, (uintptr_t)buffer + ALIGN_UP(nbytes));