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/lib/dma-default.c | |
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/lib/dma-default.c')
-rw-r--r-- | arch/mips/lib/dma-default.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/arch/mips/lib/dma-default.c b/arch/mips/lib/dma-default.c new file mode 100644 index 0000000000..9b2fe7d410 --- /dev/null +++ b/arch/mips/lib/dma-default.c @@ -0,0 +1,57 @@ +/* + * (C) Copyright 2015, 2016 Peter Mamonov <pmamonov@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <dma.h> +#include <asm/io.h> + +#if defined(CONFIG_CPU_MIPS32) || \ + defined(CONFIG_CPU_MIPS64) +static inline void __dma_sync_mips(unsigned long addr, size_t size, + enum dma_data_direction direction) +{ + switch (direction) { + case DMA_TO_DEVICE: + dma_flush_range(addr, addr + size); + break; + + case DMA_FROM_DEVICE: + dma_inv_range(addr, addr + size); + break; + + case DMA_BIDIRECTIONAL: + dma_flush_range(addr, addr + size); + break; + + default: + BUG(); + } +} +#else +static inline void __dma_sync_mips(void *addr, size_t size, + enum dma_data_direction direction) +{ +} +#endif + +void dma_sync_single_for_cpu(unsigned long address, size_t size, + enum dma_data_direction dir) +{ + __dma_sync_mips(address, size, dir); +} + +void dma_sync_single_for_device(unsigned long address, size_t size, + enum dma_data_direction dir) +{ + __dma_sync_mips(address, size, dir); +} |