cmd_nand: dump: Align data and OOB buffers
authorThierry Reding <thierry.reding@avionic-design.de>
Mon, 30 Jul 2012 20:21:55 +0000 (20:21 +0000)
committerTom Warren <twarren@nvidia.com>
Fri, 7 Sep 2012 20:54:31 +0000 (13:54 -0700)
In order for cache invalidation and flushing to work properly, the data
and OOB buffers must be aligned to full cache lines.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
common/cmd_nand.c

index a91ccf4df37f6f6bb6b69f5453d2efded777db30..4367f5a0f2ccf28cc6e52e024502984d406aa38c 100644 (file)
@@ -48,8 +48,8 @@ static int nand_dump(nand_info_t *nand, ulong off, int only_oob, int repeat)
 
        last = off;
 
-       datbuf = malloc(nand->writesize);
-       oobbuf = malloc(nand->oobsize);
+       datbuf = memalign(ARCH_DMA_MINALIGN, nand->writesize);
+       oobbuf = memalign(ARCH_DMA_MINALIGN, nand->oobsize);
        if (!datbuf || !oobbuf) {
                puts("No memory for page buffer\n");
                return 1;