[PATCH 05/24] ARM: implement streaming DMA ops

Lucas Stach dev at lynxeye.de
Sun Mar 1 05:17:03 PST 2015


Signed-off-by: Lucas Stach <dev at lynxeye.de>
---
 arch/arm/cpu/mmu.c         | 24 ++++++++++++++++++++++++
 arch/arm/include/asm/dma.h | 10 ++++++++++
 2 files changed, 34 insertions(+)

diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
index aaf66d4..c4ec72d 100644
--- a/arch/arm/cpu/mmu.c
+++ b/arch/arm/cpu/mmu.c
@@ -18,6 +18,7 @@
 #define pr_fmt(fmt)	"mmu: " fmt
 
 #include <common.h>
+#include <dma-dir.h>
 #include <init.h>
 #include <asm/mmu.h>
 #include <errno.h>
@@ -432,3 +433,26 @@ void dma_inv_range(unsigned long start, unsigned long end)
 	__dma_inv_range(start, end);
 }
 
+void dma_sync_single_for_cpu(unsigned long address, size_t size,
+			     enum dma_data_direction dir)
+{
+	if (dir != DMA_TO_DEVICE) {
+		if (outer_cache.inv_range)
+			outer_cache.inv_range(address, address + size);
+		__dma_inv_range(address, address + size);
+	}
+}
+
+void dma_sync_single_for_device(unsigned long address, size_t size,
+				enum dma_data_direction dir)
+{
+	if (dir == DMA_FROM_DEVICE) {
+		__dma_inv_range(address, address + size);
+		if (outer_cache.inv_range)
+			outer_cache.inv_range(address, address + size);
+	} else {
+		__dma_clean_range(address, address + size);
+		if (outer_cache.clean_range)
+			outer_cache.clean_range(address, address + size);
+	}
+}
diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 47e6a91..897c2ed 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -23,4 +23,14 @@ static inline void dma_free_coherent(void *mem, size_t size)
 {
 	free(mem);
 }
+
+static inline void dma_sync_single_for_cpu(unsigned long address, size_t size,
+					   enum dma_data_direction dir)
+{
+}
+
+static inline void dma_sync_single_for_device(unsigned long address, size_t size,
+					      enum dma_data_direction dir)
+{
+}
 #endif
-- 
2.1.0




More information about the barebox mailing list