diff mbox

[U-Boot,3/3] mtd: nand: mxs invalidate dcache before DMA read

Message ID 1437385222-23921-3-git-send-email-Peng.Fan@freescale.com
State Superseded
Delegated to: Scott Wood
Headers show

Commit Message

Peng Fan July 20, 2015, 9:40 a.m. UTC
Follow linux dma follow:
Before DMA read, be sure to invalidate the cache over the address
range of DMA buffer to prevent cache coherency problems.
After DMA read, invalidate dcache again.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
---
 drivers/mtd/nand/mxs_nand.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Marek Vasut July 20, 2015, 7:27 p.m. UTC | #1
On Monday, July 20, 2015 at 11:40:22 AM, Peng Fan wrote:
> Follow linux dma follow:

Nit: "flow" at the end, not "follow" ;-)

> Before DMA read, be sure to invalidate the cache over the address
> range of DMA buffer to prevent cache coherency problems.
> After DMA read, invalidate dcache again.
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
Peng Fan July 21, 2015, 12:27 a.m. UTC | #2
Hi Marek,
On Mon, Jul 20, 2015 at 09:27:35PM +0200, Marek Vasut wrote:
>On Monday, July 20, 2015 at 11:40:22 AM, Peng Fan wrote:
>> Follow linux dma follow:
>
>Nit: "flow" at the end, not "follow" ;-)
Thanks.
Do you have a chance to review this patch,
https://patchwork.ozlabs.org/patch/497619/ ?

>
>> Before DMA read, be sure to invalidate the cache over the address
>> range of DMA buffer to prevent cache coherency problems.
>> After DMA read, invalidate dcache again.
>> 
>> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
>
>Acked-by: Marek Vasut <marex@denx.de>
>
>Best regards,
>Marek Vasut

Thanks,
Peng
Marek Vasut July 21, 2015, 1:56 a.m. UTC | #3
On Tuesday, July 21, 2015 at 02:27:43 AM, Peng Fan wrote:
> Hi Marek,
> 
> On Mon, Jul 20, 2015 at 09:27:35PM +0200, Marek Vasut wrote:
> >On Monday, July 20, 2015 at 11:40:22 AM, Peng Fan wrote:
> >> Follow linux dma follow:
> >Nit: "flow" at the end, not "follow" ;-)
> 
> Thanks.
> Do you have a chance to review this patch,
> https://patchwork.ozlabs.org/patch/497619/ ?

I checked them both, I had no comments for the other.

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c
index 97011b2..f15cf36 100644
--- a/drivers/mtd/nand/mxs_nand.c
+++ b/drivers/mtd/nand/mxs_nand.c
@@ -469,6 +469,9 @@  static void mxs_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int length)
 
 	mxs_dma_desc_append(channel, d);
 
+	/* Invalidate caches */
+	mxs_nand_inval_data_buf(nand_info);
+
 	/* Execute the DMA chain. */
 	ret = mxs_dma_go(channel);
 	if (ret) {
@@ -635,6 +638,9 @@  static int mxs_nand_ecc_read_page(struct mtd_info *mtd, struct nand_chip *nand,
 
 	mxs_dma_desc_append(channel, d);
 
+	/* Invalidate caches */
+	mxs_nand_inval_data_buf(nand_info);
+
 	/* Execute the DMA chain. */
 	ret = mxs_dma_go(channel);
 	if (ret) {