aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/dma-mapping.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/include/asm/dma-mapping.h')
-rw-r--r--arch/arm/include/asm/dma-mapping.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 4fff837..9ce57c9 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -9,6 +9,9 @@
#include <asm-generic/dma-coherent.h>
#include <asm/memory.h>
+#ifdef CONFIG_DMA_CMA
+#include <linux/dma-contiguous.h>
+#endif
#ifdef __arch_page_to_dma
#error Please update to __arch_pfn_to_dma
@@ -172,6 +175,21 @@ static inline void dma_free_noncoherent(struct device *dev, size_t size,
{
}
+#ifdef CONFIG_DMA_CMA
+static inline int dma_prepare_alloc_coherent(struct device *dev, size_t size)
+{
+ int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
+ int align = get_order(PAGE_ALIGN(size));
+
+ return dma_prepare_alloc_from_contiguous(dev, count, align);
+}
+#else
+static inline int dma_prepare_alloc_coherent(struct device *dev, size_t size)
+{
+ return 0;
+}
+#endif
+
/**
* dma_alloc_coherent - allocate consistent memory for DMA
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices