Skip to content

Commit

Permalink
arch/arm64/imx9/imx9_flexspi: Replace memcpy by while loop
Browse files Browse the repository at this point in the history
libc memcpy cannot access fspi memory space correctly
remove unnecessary debugassert and cache operations

Signed-off-by: Jouni Ukkonen <[email protected]>
  • Loading branch information
joukkone authored and xiaoxiang781216 committed Nov 28, 2024
1 parent 0476895 commit 1d23baa
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions arch/arm64/src/imx9/imx9_flexspi_nor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1d23baa

Please sign in to comment.