[PATCH v2 08/27] ARM: implement streaming DMA ops
Lucas Stach
dev at lynxeye.de
Thu Mar 5 13:50:02 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 c480e07..f1ebd29 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>
@@ -434,3 +435,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 48a9c6e..d9bce3d 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -28,4 +28,14 @@ static inline void dma_free_coherent(void *mem, dma_addr_t dma_handle,
{
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