9
0
Fork 0

nios: add dma_alloc, asm/dma.h

This patch add dma_alloc to existing dma-mapping.h. On nios the mem is
aligned to D_ACHE_LINE_SIZE.

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:32 +02:00 committed by Sascha Hauer
parent ed2180d658
commit 74b3f12a25
2 changed files with 18 additions and 0 deletions

View File

@ -1,8 +1,12 @@
#ifndef __ASM_NIOS2_DMA_MAPPING_H
#define __ASM_NIOS2_DMA_MAPPING_H
#include <common.h>
#include <xfuncs.h>
#include <asm/cache.h>
/* dma_alloc_coherent() return cache-line aligned allocation which is mapped
* to uncached io region.
*
@ -22,4 +26,10 @@ static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
return (void *)(*handle | IO_REGION_BASE);
}
#define dma_alloc dma_alloc
static inline void *dma_alloc(size_t size)
{
return xmemalign(DCACHE_LINE_SIZE, ALIGN(size, DCACHE_LINE_SIZE));
}
#endif /* __ASM_NIOS2_DMA_MAPPING_H */

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/dma-mapping.h>