[PATCH 3/6] nios: add dma_alloc, dma_free and asm/dma.h
Marc Kleine-Budde
mkl at pengutronix.de
Tue Jun 19 08:36:28 EDT 2012
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 at 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 at pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#include <asm/dma-mapping.h>
--
1.7.4.1
More information about the barebox
mailing list