mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: sha@pengutronix.de
Cc: barebox@lists.infradead.org
Subject: [PATCH 3/6] nios: add dma_alloc, dma_free and asm/dma.h
Date: Tue, 19 Jun 2012 14:36:28 +0200	[thread overview]
Message-ID: <1340109391-22794-4-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1340109391-22794-1-git-send-email-mkl@pengutronix.de>

Some drivers call dma_inv_range() on buffers, on arm these buffers must
be cache line aligned.  This patch add dma_alloc, dma_free to existing
dma-mapping.h. On nios the mem is aligned to DCACHE_LINE_SIZE.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 arch/nios2/include/asm/dma-mapping.h |   10 ++++++++++
 arch/nios2/include/asm/dma.h         |    8 ++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
 create mode 100644 arch/nios2/include/asm/dma.h

diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h
index 5b70f4c..0ec9c89 100644
--- a/arch/nios2/include/asm/dma-mapping.h
+++ b/arch/nios2/include/asm/dma-mapping.h
@@ -22,4 +22,14 @@ static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
 	return (void *)(*handle | IO_REGION_BASE);
 }
 
+static inline void *dma_alloc(size_t size)
+{
+	return xmemalign(DCACHE_LINE_SIZE, size);
+}
+
+static inline void dma_free(void *mem)
+{
+	free(mem);
+}
+
 #endif /* __ASM_NIOS2_DMA_MAPPING_H */
diff --git a/arch/nios2/include/asm/dma.h b/arch/nios2/include/asm/dma.h
new file mode 100644
index 0000000..8f709d2
--- /dev/null
+++ b/arch/nios2/include/asm/dma.h
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2012 by Marc Kleine-Budde <mkl@pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#include <asm/dma-mapping.h>
-- 
1.7.4.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-06-19 12:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-19 12:36 [PATCH 0/6] fix dma memory allocations, add dma_alloc/dma_free Marc Kleine-Budde
2012-06-19 12:36 ` [PATCH 1/6] ARM mmu: don't use CONFIG_MMU to disable mmu code, there are static inline versions Marc Kleine-Budde
2012-06-19 12:36 ` [PATCH 2/6] ARM mmu: introduce dma_alloc, dma_free Marc Kleine-Budde
2012-06-19 12:36 ` Marc Kleine-Budde [this message]
2012-06-19 12:36 ` [PATCH 4/6] blackfin, mips, openrisc, ppc, sandbox, x86: add transparent dma_alloc, dma_free inlines Marc Kleine-Budde
2012-06-19 12:36 ` [PATCH 5/6] USB gadget fsl: request cacheline aligned buffer Marc Kleine-Budde
2012-06-19 12:36 ` [PATCH 6/6] USB gadget: Fix dma memory allocations Marc Kleine-Budde
2012-06-19 12:42 ` [PATCH 0/6] fix dma memory allocations, add dma_alloc/dma_free Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340109391-22794-4-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sha@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox