Skip to content

Commit

Permalink
arch/arm64/imx9: 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
Jouni Ukkonen committed Nov 27, 2024
1 parent 98302d0 commit 0ac2cfa
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions arch/arm64/src/imx9/imx9_flexspi_nor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0ac2cfa

Please sign in to comment.