From 7aed9c371f92b8e795f9c303ecbcd780debf4ac8 Mon Sep 17 00:00:00 2001 From: Jouni Ukkonen Date: Tue, 26 Nov 2024 13:15:38 +0200 Subject: [PATCH] arch/arm64/imx9: Replace memcpy by while loop libc memcpy cannot access fspi memory space correctly remove unnecessary debugassert and cache operations Signed-off-by: Jouni Ukkonen --- arch/arm64/src/imx9/imx9_flexspi_nor.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/arm64/src/imx9/imx9_flexspi_nor.c b/arch/arm64/src/imx9/imx9_flexspi_nor.c index f117207d612b2..9c1ae7bece42f 100644 --- a/arch/arm64/src/imx9/imx9_flexspi_nor.c +++ b/arch/arm64/src/imx9/imx9_flexspi_nor.c @@ -790,14 +790,13 @@ 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); - - up_clean_dcache((uintptr_t)buffer, (uintptr_t)buffer + ALIGN_UP(nbytes)); + while (n-- > 0) + { + *buffer++ = *src++; + } finfo("return nbytes: %d\n", (int)nbytes); return (ssize_t)nbytes;