[PATCH 4/6] blackfin, mips, openrisc, ppc, sandbox, x86: add transparent dma_alloc, dma_free inlines

Marc Kleine-Budde mkl at pengutronix.de
Tue Jun 19 08:36:29 EDT 2012


Some drivers call dma_inv_range() on buffers, on arm these buffers must
be cache line aligned. This patch introduces transparent dma_alloc,
dma_free for blackfin, mips, openrisc, ppc, sandbox, x86 architectures
which translate into xmemalign and free. The arm version uses xmemalign.

Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>
---
 arch/blackfin/include/asm/dma.h |   21 +++++++++++++++++++++
 arch/mips/include/asm/dma.h     |   21 +++++++++++++++++++++
 arch/openrisc/include/asm/dma.h |   21 +++++++++++++++++++++
 arch/ppc/include/asm/dma.h      |   21 +++++++++++++++++++++
 arch/sandbox/include/asm/dma.h  |   21 +++++++++++++++++++++
 arch/x86/include/asm/dma.h      |   21 +++++++++++++++++++++
 6 files changed, 126 insertions(+), 0 deletions(-)
 create mode 100644 arch/blackfin/include/asm/dma.h
 create mode 100644 arch/mips/include/asm/dma.h
 create mode 100644 arch/openrisc/include/asm/dma.h
 create mode 100644 arch/ppc/include/asm/dma.h
 create mode 100644 arch/sandbox/include/asm/dma.h
 create mode 100644 arch/x86/include/asm/dma.h

diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h
new file mode 100644
index 0000000..c46d320
--- /dev/null
+++ b/arch/blackfin/include/asm/dma.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 by Marc Kleine-Budde <mkl at pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#ifndef __ASM_DMA_H
+#define __ASM_DMA_H
+
+static inline void *dma_alloc(size_t size)
+{
+	return xmalloc(size);
+}
+
+static inline void dma_free(void *mem)
+{
+	free(mem);
+}
+
+#endif /* __ASM_DMA_H */
diff --git a/arch/mips/include/asm/dma.h b/arch/mips/include/asm/dma.h
new file mode 100644
index 0000000..c46d320
--- /dev/null
+++ b/arch/mips/include/asm/dma.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 by Marc Kleine-Budde <mkl at pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#ifndef __ASM_DMA_H
+#define __ASM_DMA_H
+
+static inline void *dma_alloc(size_t size)
+{
+	return xmalloc(size);
+}
+
+static inline void dma_free(void *mem)
+{
+	free(mem);
+}
+
+#endif /* __ASM_DMA_H */
diff --git a/arch/openrisc/include/asm/dma.h b/arch/openrisc/include/asm/dma.h
new file mode 100644
index 0000000..c46d320
--- /dev/null
+++ b/arch/openrisc/include/asm/dma.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 by Marc Kleine-Budde <mkl at pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#ifndef __ASM_DMA_H
+#define __ASM_DMA_H
+
+static inline void *dma_alloc(size_t size)
+{
+	return xmalloc(size);
+}
+
+static inline void dma_free(void *mem)
+{
+	free(mem);
+}
+
+#endif /* __ASM_DMA_H */
diff --git a/arch/ppc/include/asm/dma.h b/arch/ppc/include/asm/dma.h
new file mode 100644
index 0000000..c46d320
--- /dev/null
+++ b/arch/ppc/include/asm/dma.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 by Marc Kleine-Budde <mkl at pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#ifndef __ASM_DMA_H
+#define __ASM_DMA_H
+
+static inline void *dma_alloc(size_t size)
+{
+	return xmalloc(size);
+}
+
+static inline void dma_free(void *mem)
+{
+	free(mem);
+}
+
+#endif /* __ASM_DMA_H */
diff --git a/arch/sandbox/include/asm/dma.h b/arch/sandbox/include/asm/dma.h
new file mode 100644
index 0000000..c46d320
--- /dev/null
+++ b/arch/sandbox/include/asm/dma.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 by Marc Kleine-Budde <mkl at pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#ifndef __ASM_DMA_H
+#define __ASM_DMA_H
+
+static inline void *dma_alloc(size_t size)
+{
+	return xmalloc(size);
+}
+
+static inline void dma_free(void *mem)
+{
+	free(mem);
+}
+
+#endif /* __ASM_DMA_H */
diff --git a/arch/x86/include/asm/dma.h b/arch/x86/include/asm/dma.h
new file mode 100644
index 0000000..c46d320
--- /dev/null
+++ b/arch/x86/include/asm/dma.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 by Marc Kleine-Budde <mkl at pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#ifndef __ASM_DMA_H
+#define __ASM_DMA_H
+
+static inline void *dma_alloc(size_t size)
+{
+	return xmalloc(size);
+}
+
+static inline void dma_free(void *mem)
+{
+	free(mem);
+}
+
+#endif /* __ASM_DMA_H */
-- 
1.7.4.1




More information about the barebox mailing list