summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2012-06-20 13:57:31 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-06-30 12:46:25 +0200
commited2180d658b9dbc1e56ddb2e0119253a8b99b2f5 (patch)
tree5257b7f5b6d916d128ecda338f9b84deb2a861c0 /include
parent76df95bde1ec7d3f6371edcd128d4fca1cb7d2a9 (diff)
downloadbarebox-ed2180d658b9dbc1e56ddb2e0119253a8b99b2f5.tar.gz
barebox-ed2180d658b9dbc1e56ddb2e0119253a8b99b2f5.tar.xz
blackfin, mips, openrisc, ppc, sandbox, x86: add generic dma_alloc, dma_free inlines
Some drivers call dma_inv_range() on buffers, on arm these buffers must be cache line aligned. This patch introduces a generic dma_alloc, dma_free. Archs can implement in their own functions in "asm/dma.h" and add a: #define dma_alloc dma_alloc #define dma_free dma_free On all other archs the generic versions, which translate into xmalloc and free are used. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/dma.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/dma.h b/include/dma.h
new file mode 100644
index 0000000000..899f831faa
--- /dev/null
+++ b/include/dma.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2012 by Marc Kleine-Budde <mkl@pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#ifndef __DMA_H
+#define __DMA_H
+
+#include <malloc.h>
+#include <xfuncs.h>
+
+#include <asm/dma.h>
+
+#ifndef dma_alloc
+static inline void *dma_alloc(size_t size)
+{
+ return xmalloc(size);
+}
+#endif
+
+#ifndef dma_free
+static inline void dma_free(void *mem)
+{
+ free(mem);
+}
+#endif
+
+#endif /* __DMA_H */