arch/arm64/imx9/imx9_flexspi: Replace memcpy by while loop

libc memcpy cannot access fspi memory space correctly
remove unnecessary debugassert and cache operations

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
This commit is contained in:
Jouni Ukkonen 2024-11-26 13:15:38 +02:00 committed by Xiang Xiao
parent 0476895c0d
commit 1d23baaa63

View file

@ -788,16 +788,13 @@ static ssize_t imx9_flexspi_nor_read(struct mtd_dev_s *dev,
}
src = priv->ahb_base + offset;
DEBUGASSERT(((uintptr_t)src & (ARMV8A_DCACHE_LINESIZE - 1)) == 0);
up_invalidate_dcache((uintptr_t)buffer,
(uintptr_t)buffer +
ALIGN_UP(nbytes, ARMV8A_DCACHE_LINESIZE));
int n = nbytes;
memcpy(buffer, src, nbytes);
up_clean_dcache((uintptr_t)buffer, (uintptr_t)buffer +
ALIGN_UP(nbytes, ARMV8A_DCACHE_LINESIZE));
while (n-- > 0)
{
*buffer++ = *src++;
}
finfo("return nbytes: %d\n", (int)nbytes);
return (ssize_t)nbytes;