diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-07-02 10:59:22 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-07-02 10:59:22 +0200 |
commit | dd3c898d06a55a4c6fe94dae3f732a541e983432 (patch) | |
tree | 9f8ea0b057a6a1b52c948214d27ccde9378326a9 /arch | |
parent | 649f558483f9959c0ac4123da8c7b647d9808be5 (diff) | |
parent | 40faf584cd60c1e0e083ac75eb9ef5f9e7c071d0 (diff) | |
download | barebox-dd3c898d06a55a4c6fe94dae3f732a541e983432.tar.gz barebox-dd3c898d06a55a4c6fe94dae3f732a541e983432.tar.xz |
Merge branch 'for-next/dma-cache-align'
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/cpu/mmu.c | 4 | ||||
-rw-r--r-- | arch/arm/include/asm/dma.h | 8 | ||||
-rw-r--r-- | arch/arm/include/asm/mmu.h | 13 | ||||
-rw-r--r-- | arch/blackfin/include/asm/dma.h | 13 | ||||
-rw-r--r-- | arch/mips/include/asm/dma.h | 13 | ||||
-rw-r--r-- | arch/nios2/include/asm/dma-mapping.h | 10 | ||||
-rw-r--r-- | arch/nios2/include/asm/dma.h | 8 | ||||
-rw-r--r-- | arch/openrisc/include/asm/dma.h | 13 | ||||
-rw-r--r-- | arch/ppc/include/asm/dma.h | 13 | ||||
-rw-r--r-- | arch/sandbox/include/asm/dma.h | 13 | ||||
-rw-r--r-- | arch/x86/include/asm/dma.h | 13 |
11 files changed, 115 insertions, 6 deletions
diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index c19f9311cd..55b07a46d1 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -299,11 +299,9 @@ void *dma_alloc_coherent(size_t size) size = PAGE_ALIGN(size); ret = xmemalign(4096, size); -#ifdef CONFIG_MMU dma_inv_range((unsigned long)ret, (unsigned long)ret + size); remap_range(ret, size, PTE_FLAGS_UNCACHED); -#endif return ret; } @@ -320,9 +318,7 @@ void *phys_to_virt(unsigned long phys) void dma_free_coherent(void *mem, size_t size) { -#ifdef CONFIG_MMU remap_range(mem, size, PTE_FLAGS_CACHED); -#endif free(mem); } diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h new file mode 100644 index 0000000000..cb9cd1b4ea --- /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 f5ae7a823a..a66da8c0a8 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); diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h new file mode 100644 index 0000000000..27d269f491 --- /dev/null +++ b/arch/blackfin/include/asm/dma.h @@ -0,0 +1,13 @@ +/* + * 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 + +/* empty */ + +#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 0000000000..27d269f491 --- /dev/null +++ b/arch/mips/include/asm/dma.h @@ -0,0 +1,13 @@ +/* + * 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 + +/* empty */ + +#endif /* __ASM_DMA_H */ diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h index 5b70f4cead..9819a973e7 100644 --- a/arch/nios2/include/asm/dma-mapping.h +++ b/arch/nios2/include/asm/dma-mapping.h @@ -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 */ diff --git a/arch/nios2/include/asm/dma.h b/arch/nios2/include/asm/dma.h new file mode 100644 index 0000000000..8f709d2dbf --- /dev/null +++ b/arch/nios2/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/dma-mapping.h> diff --git a/arch/openrisc/include/asm/dma.h b/arch/openrisc/include/asm/dma.h new file mode 100644 index 0000000000..27d269f491 --- /dev/null +++ b/arch/openrisc/include/asm/dma.h @@ -0,0 +1,13 @@ +/* + * 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 + +/* empty */ + +#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 0000000000..27d269f491 --- /dev/null +++ b/arch/ppc/include/asm/dma.h @@ -0,0 +1,13 @@ +/* + * 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 + +/* empty */ + +#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 0000000000..459536779e --- /dev/null +++ b/arch/sandbox/include/asm/dma.h @@ -0,0 +1,13 @@ +/* + * 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 + +/* empty*/ + +#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 0000000000..27d269f491 --- /dev/null +++ b/arch/x86/include/asm/dma.h @@ -0,0 +1,13 @@ +/* + * 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 + +/* empty */ + +#endif /* __ASM_DMA_H */ |