public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] axs101: flush DMA buffer descriptors before DMA transactons starts
@ 2014-03-21 12:57 Alexey Brodkin
  2014-03-28 21:16 ` [U-Boot] " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Brodkin @ 2014-03-21 12:57 UTC (permalink / raw)
  To: u-boot

CPU sets DMA buffer descriptors with data required for inetrnal DMA such as:
 * Ownership of BD
 * Buffer size
 * Pointer to data buffer in memory

Then we need to make sure DMA engine of NAND controller gets proper data.
For this we flush buffer rescriptor.

Then we're  ready for DMA transaction.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Tom Rini <trini@ti.com>
---
 board/synopsys/axs101/nand.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/board/synopsys/axs101/nand.c b/board/synopsys/axs101/nand.c
index 8672803..c7f90c4 100644
--- a/board/synopsys/axs101/nand.c
+++ b/board/synopsys/axs101/nand.c
@@ -107,6 +107,10 @@ static void axs101_nand_write_buf(struct mtd_info *mtd, const u_char *buf,
 	writel(bbstate.bounce_buffer, &bd->buffer_ptr0);
 	writel(0, &bd->buffer_ptr1);
 
+	/* Flush modified buffer descriptor */
+	flush_dcache_range((unsigned long)bd,
+			   (unsigned long)bd + sizeof(struct nand_bd));
+
 	/* Issue "write" command */
 	NAND_REG_WRITE(AC_FIFO, B_CT_WRITE | B_WFR | B_IWC | B_LC | (len-1));
 
@@ -137,6 +141,10 @@ static void axs101_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 	writel(bbstate.bounce_buffer, &bd->buffer_ptr0);
 	writel(0, &bd->buffer_ptr1);
 
+	/* Flush modified buffer descriptor */
+	flush_dcache_range((unsigned long)bd,
+			   (unsigned long)bd + sizeof(struct nand_bd));
+
 	/* Issue "read" command */
 	NAND_REG_WRITE(AC_FIFO, B_CT_READ | B_WFR | B_IWC | B_LC | (len - 1));
 
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] axs101: flush DMA buffer descriptors before DMA transactons starts
  2014-03-21 12:57 [U-Boot] [PATCH] axs101: flush DMA buffer descriptors before DMA transactons starts Alexey Brodkin
@ 2014-03-28 21:16 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2014-03-28 21:16 UTC (permalink / raw)
  To: u-boot

On Fri, Mar 21, 2014 at 04:57:47PM +0400, Alexey Brodkin wrote:

> CPU sets DMA buffer descriptors with data required for inetrnal DMA such as:
>  * Ownership of BD
>  * Buffer size
>  * Pointer to data buffer in memory
> 
> Then we need to make sure DMA engine of NAND controller gets proper data.
> For this we flush buffer rescriptor.
> 
> Then we're  ready for DMA transaction.
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140328/38ea8fcb/attachment.pgp>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-28 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-21 12:57 [U-Boot] [PATCH] axs101: flush DMA buffer descriptors before DMA transactons starts Alexey Brodkin
2014-03-28 21:16 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox