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 v2 4/6] ARM mmu: add dma_alloc
Date: Wed, 20 Jun 2012 13:57:33 +0200	[thread overview]
Message-ID: <1340193455-2229-5-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1340193455-2229-1-git-send-email-mkl@pengutronix.de>

dma_alloc() allocates memory aligned to cache lines. We have to use
cache line aligned buffers if a driver calls dma_inv_range on the
buffer.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 arch/arm/include/asm/dma.h |    8 ++++++++
 arch/arm/include/asm/mmu.h |   13 +++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/include/asm/dma.h

diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
new file mode 100644
index 0000000..cb9cd1b
--- /dev/null
+++ b/arch/arm/include/asm/dma.h
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2012 by Marc Kleine-Budde <mkl@pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#include <asm/mmu.h>
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index f5ae7a8..a66da8c 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -1,9 +1,12 @@
 #ifndef __ASM_MMU_H
 #define __ASM_MMU_H
 
-#include <asm/pgtable.h>
-#include <malloc.h>
+#include <common.h>
 #include <errno.h>
+#include <malloc.h>
+#include <xfuncs.h>
+
+#include <asm/pgtable.h>
 
 #define PMD_SECT_DEF_UNCACHED (PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | PMD_TYPE_SECT)
 #define PMD_SECT_DEF_CACHED (PMD_SECT_WB | PMD_SECT_DEF_UNCACHED)
@@ -23,6 +26,12 @@ static inline void setup_dma_coherent(unsigned long offset)
 {
 }
 
+#define dma_alloc dma_alloc
+static inline void *dma_alloc(size_t size)
+{
+	return xmemalign(64, ALIGN(size, 64));
+}
+
 #ifdef CONFIG_MMU
 void *dma_alloc_coherent(size_t size);
 void dma_free_coherent(void *mem, size_t size);
-- 
1.7.10


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

  parent reply	other threads:[~2012-06-20 11:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 11:57 [PATCH v2 0/6] fix dma memory allocations, add dma_alloc/dma_free Marc Kleine-Budde
2012-06-20 11:57 ` [PATCH v2 1/6] ARM mmu: don't use CONFIG_MMU to disable mmu code, there are static inline versions Marc Kleine-Budde
2012-06-20 11:57 ` [PATCH v2 2/6] blackfin, mips, openrisc, ppc, sandbox, x86: add generic dma_alloc, dma_free inlines Marc Kleine-Budde
2012-06-20 11:57 ` [PATCH v2 3/6] nios: add dma_alloc, asm/dma.h Marc Kleine-Budde
2012-06-20 11:57 ` Marc Kleine-Budde [this message]
2012-06-20 11:57 ` [PATCH v2 5/6] USB gadget fsl: request cacheline aligned buffer Marc Kleine-Budde
2012-06-20 11:57 ` [PATCH v2 6/6] USB gadget: Fix dma memory allocations 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=1340193455-2229-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