diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2019-01-17 16:38:21 -0800 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-01-21 10:34:04 +0100 |
commit | 9f7cbfaa0d0bed3bbe9f72a739141e32339ce5f8 (patch) | |
tree | b904f2077042e224113e7cbf4450423bd5195ac8 /arch/arm/cpu | |
parent | bf7bf45c1e972b693c884017f5ffdad0e1e83c60 (diff) | |
download | barebox-9f7cbfaa0d0bed3bbe9f72a739141e32339ce5f8.tar.gz barebox-9f7cbfaa0d0bed3bbe9f72a739141e32339ce5f8.tar.xz |
ARM: mmu: Share code for dma_free_coherent()
Now that AArch64 version is calling arch_remap_range() it is identical
to ARM version in mmu.c. Move the definition to mmu-common.c to avoid
duplication.
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r-- | arch/arm/cpu/mmu-common.c | 8 | ||||
-rw-r--r-- | arch/arm/cpu/mmu.c | 8 | ||||
-rw-r--r-- | arch/arm/cpu/mmu_64.c | 8 |
3 files changed, 8 insertions, 16 deletions
diff --git a/arch/arm/cpu/mmu-common.c b/arch/arm/cpu/mmu-common.c index 5d58129745..65cc786e1e 100644 --- a/arch/arm/cpu/mmu-common.c +++ b/arch/arm/cpu/mmu-common.c @@ -23,3 +23,11 @@ void dma_unmap_single(struct device_d *dev, dma_addr_t addr, size_t size, { dma_sync_single_for_cpu(addr, size, dir); } + +void dma_free_coherent(void *mem, dma_addr_t dma_handle, size_t size) +{ + size = PAGE_ALIGN(size); + arch_remap_range(mem, size, MAP_CACHED); + + free(mem); +}
\ No newline at end of file diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index f134e8bb38..70ab5ebb5b 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -527,14 +527,6 @@ void *dma_alloc_writecombine(size_t size, dma_addr_t *dma_handle) return dma_alloc_map(size, dma_handle, ARCH_MAP_WRITECOMBINE); } -void dma_free_coherent(void *mem, dma_addr_t dma_handle, size_t size) -{ - size = PAGE_ALIGN(size); - arch_remap_range(mem, size, MAP_CACHED); - - free(mem); -} - void dma_sync_single_for_cpu(dma_addr_t address, size_t size, enum dma_data_direction dir) { diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c index 4094d9a14a..a7186eda44 100644 --- a/arch/arm/cpu/mmu_64.c +++ b/arch/arm/cpu/mmu_64.c @@ -262,14 +262,6 @@ void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle) return ret; } -void dma_free_coherent(void *mem, dma_addr_t dma_handle, size_t size) -{ - size = PAGE_ALIGN(size); - arch_remap_range(mem, size, MAP_CACHED); - - free(mem); -} - void dma_sync_single_for_cpu(dma_addr_t address, size_t size, enum dma_data_direction dir) { |