Skip to content
Snippets Groups Projects
Commit 156e96f0 authored by Ravi Babu's avatar Ravi Babu Committed by Jagan Teki
Browse files

sf: allocate cache aligned buffers to copy from flash


Use memalign() with ARCH_DMA_MINALIGN to allocate read buffers.
This is required because, flash drivers may use DMA for read operations
and may have to invalidate the buffer before read.

Signed-off-by: default avatarRavi Babu <ravibabu@ti.com>
Signed-off-by: default avatarVignesh R <vigneshr@ti.com>
Reviewed-by: default avatarTom Rini <trini@konsulko.com>
Reviewed-by: default avatarJagan Teki <jteki@openedev.com>
Tested-by: default avatarJagan Teki <jteki@openedev.com>
parent a39cfe71
No related branches found
No related tags found
No related merge requests found
...@@ -223,7 +223,7 @@ static int spi_flash_update(struct spi_flash *flash, u32 offset, ...@@ -223,7 +223,7 @@ static int spi_flash_update(struct spi_flash *flash, u32 offset,
if (end - buf >= 200) if (end - buf >= 200)
scale = (end - buf) / 100; scale = (end - buf) / 100;
cmp_buf = malloc(flash->sector_size); cmp_buf = memalign(ARCH_DMA_MINALIGN, flash->sector_size);
if (cmp_buf) { if (cmp_buf) {
ulong last_update = get_timer(0); ulong last_update = get_timer(0);
...@@ -484,12 +484,12 @@ static int do_spi_flash_test(int argc, char * const argv[]) ...@@ -484,12 +484,12 @@ static int do_spi_flash_test(int argc, char * const argv[])
if (*argv[2] == 0 || *endp != 0) if (*argv[2] == 0 || *endp != 0)
return -1; return -1;
vbuf = malloc(len); vbuf = memalign(ARCH_DMA_MINALIGN, len);
if (!vbuf) { if (!vbuf) {
printf("Cannot allocate memory (%lu bytes)\n", len); printf("Cannot allocate memory (%lu bytes)\n", len);
return 1; return 1;
} }
buf = malloc(len); buf = memalign(ARCH_DMA_MINALIGN, len);
if (!buf) { if (!buf) {
free(vbuf); free(vbuf);
printf("Cannot allocate memory (%lu bytes)\n", len); printf("Cannot allocate memory (%lu bytes)\n", len);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment