sunxi_nand_spl: Add proper cache flusing
We are using dma, so we should flush the cache before starting the dma, and invalidate it once the dma is done. Things are working without this by mostly luck, but lets not rely on that. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Ian Campbell <ijc@hellion.org.uk>
This commit is contained in:
parent
5d65c67bf1
commit
2a43973f64
1 changed files with 8 additions and 0 deletions
|
@ -266,6 +266,10 @@ static void nand_read_page(unsigned int real_addr, dma_addr_t dst,
|
||||||
writel(oob_offset, SUNXI_NFC_BASE + NFC_SPARE_AREA);
|
writel(oob_offset, SUNXI_NFC_BASE + NFC_SPARE_AREA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flush_dcache_range(dst,
|
||||||
|
ALIGN(dst + CONFIG_NAND_SUNXI_SPL_ECC_PAGE_SIZE,
|
||||||
|
ARCH_DMA_MINALIGN));
|
||||||
|
|
||||||
/* SUNXI_DMA */
|
/* SUNXI_DMA */
|
||||||
writel(0x0, SUNXI_DMA_BASE + SUNXI_DMA_CFG_REG0); /* clr dma cmd */
|
writel(0x0, SUNXI_DMA_BASE + SUNXI_DMA_CFG_REG0); /* clr dma cmd */
|
||||||
/* read from REG_IO_DATA */
|
/* read from REG_IO_DATA */
|
||||||
|
@ -311,6 +315,10 @@ static void nand_read_page(unsigned int real_addr, dma_addr_t dst,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invalidate_dcache_range(dst,
|
||||||
|
ALIGN(dst + CONFIG_NAND_SUNXI_SPL_ECC_PAGE_SIZE,
|
||||||
|
ARCH_DMA_MINALIGN));
|
||||||
|
|
||||||
if (readl(SUNXI_NFC_BASE + NFC_ECC_ST))
|
if (readl(SUNXI_NFC_BASE + NFC_ECC_ST))
|
||||||
(*ecc_errors)++;
|
(*ecc_errors)++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue