[PATCH v2 05/27] dma: add streaming DMA ops

Lucas Stach dev at lynxeye.de
Thu Mar 5 13:49:58 PST 2015


This will allow us to implement cache maintenance in a platform
agnostic way.

Signed-off-by: Lucas Stach <dev at lynxeye.de>
---
 include/dma-dir.h |  6 ++++++
 include/dma.h     | 11 +++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 include/dma-dir.h

diff --git a/include/dma-dir.h b/include/dma-dir.h
new file mode 100644
index 0000000..ba107f1
--- /dev/null
+++ b/include/dma-dir.h
@@ -0,0 +1,6 @@
+enum dma_data_direction {
+	DMA_BIDIRECTIONAL = 0,
+	DMA_TO_DEVICE = 1,
+	DMA_FROM_DEVICE = 2,
+	DMA_NONE = 3,
+};
diff --git a/include/dma.h b/include/dma.h
index 899f831..fb75eec 100644
--- a/include/dma.h
+++ b/include/dma.h
@@ -11,6 +11,7 @@
 #include <malloc.h>
 #include <xfuncs.h>
 
+#include <dma-dir.h>
 #include <asm/dma.h>
 
 #ifndef dma_alloc
@@ -27,4 +28,14 @@ static inline void dma_free(void *mem)
 }
 #endif
 
+/* streaming DMA - implement the below calls to support HAS_DMA */
+void dma_sync_single_for_cpu(unsigned long address, size_t size,
+			     enum dma_data_direction dir);
+
+void dma_sync_single_for_device(unsigned long address, size_t size,
+				enum dma_data_direction dir);
+
+void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle);
+void dma_free_coherent(void *mem, dma_addr_t dma_handle, size_t size);
+
 #endif /* __DMA_H */
-- 
2.1.0




More information about the barebox mailing list