diff options
author | Peter Mamonov <pmamonov@gmail.com> | 2016-03-07 16:30:18 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-03-09 19:58:50 +0100 |
commit | 28e71b932d5063efa18a7dd1bd798122dc98b9ca (patch) | |
tree | 2593d4e172dbba2e027a82aa27f7d1c9e585e89c /arch/mips/include | |
parent | 0076383a13f5abe354bed1a6606b8e073944202c (diff) | |
download | barebox-28e71b932d5063efa18a7dd1bd798122dc98b9ca.tar.gz barebox-28e71b932d5063efa18a7dd1bd798122dc98b9ca.tar.xz |
MIPS: implement dma_sync_* functions
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/mips/include')
-rw-r--r-- | arch/mips/include/asm/dma-mapping.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h index 639511226d..c71a087038 100644 --- a/arch/mips/include/asm/dma-mapping.h +++ b/arch/mips/include/asm/dma-mapping.h @@ -1,10 +1,12 @@ #ifndef _ASM_DMA_MAPPING_H #define _ASM_DMA_MAPPING_H +#include <common.h> #include <xfuncs.h> #include <asm/addrspace.h> #include <asm/types.h> #include <malloc.h> +#include <asm/io.h> static inline void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle) { @@ -12,16 +14,23 @@ static inline void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle) ret = xmemalign(PAGE_SIZE, size); + memset(ret, 0, size); + if (dma_handle) *dma_handle = CPHYSADDR(ret); + dma_flush_range((unsigned long)ret, (unsigned long)(ret + size)); + return (void *)CKSEG1ADDR(ret); } static inline void dma_free_coherent(void *vaddr, dma_addr_t dma_handle, size_t size) { - free(vaddr); + if (IS_ENABLED(CONFIG_MMU)) + free((void *)CKSEG0ADDR(vaddr)); + else + free(vaddr); } #endif /* _ASM_DMA_MAPPING_H */ |