9
0
Fork 0

ARM mmu: add dma_alloc

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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Marc Kleine-Budde 2012-06-20 13:57:33 +02:00 committed by Sascha Hauer
parent 74b3f12a25
commit f98ebf91d6
2 changed files with 19 additions and 2 deletions

View File

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

View File

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