mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: sha@pengutronix.de
Cc: barebox@lists.infradead.org
Subject: [PATCH 4/6] blackfin, mips, openrisc, ppc, sandbox, x86: add transparent dma_alloc, dma_free inlines
Date: Tue, 19 Jun 2012 14:36:29 +0200	[thread overview]
Message-ID: <1340109391-22794-5-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1340109391-22794-1-git-send-email-mkl@pengutronix.de>

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@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@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@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@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@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@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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-06-19 12:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-19 12:36 [PATCH 0/6] fix dma memory allocations, add dma_alloc/dma_free Marc Kleine-Budde
2012-06-19 12:36 ` [PATCH 1/6] ARM mmu: don't use CONFIG_MMU to disable mmu code, there are static inline versions Marc Kleine-Budde
2012-06-19 12:36 ` [PATCH 2/6] ARM mmu: introduce dma_alloc, dma_free Marc Kleine-Budde
2012-06-19 12:36 ` [PATCH 3/6] nios: add dma_alloc, dma_free and asm/dma.h Marc Kleine-Budde
2012-06-19 12:36 ` Marc Kleine-Budde [this message]
2012-06-19 12:36 ` [PATCH 5/6] USB gadget fsl: request cacheline aligned buffer Marc Kleine-Budde
2012-06-19 12:36 ` [PATCH 6/6] USB gadget: Fix dma memory allocations Marc Kleine-Budde
2012-06-19 12:42 ` [PATCH 0/6] fix dma memory allocations, add dma_alloc/dma_free Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340109391-22794-5-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sha@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox