Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Stelian Pop | fa506a9 | 2008-01-31 21:15:53 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2007 |
Stelian Pop | c9e798d | 2011-11-01 00:00:39 +0100 | [diff] [blame] | 4 | * Stelian Pop <stelian@popies.net> |
Stelian Pop | fa506a9 | 2008-01-31 21:15:53 +0000 | [diff] [blame] | 5 | * Lead Tech Design <www.leadtechdesign.com> |
Stelian Pop | fa506a9 | 2008-01-31 21:15:53 +0000 | [diff] [blame] | 6 | */ |
| 7 | #ifndef __ASM_ARM_DMA_MAPPING_H |
| 8 | #define __ASM_ARM_DMA_MAPPING_H |
| 9 | |
Vignesh Raghavendra | c0a5a81 | 2020-01-16 14:23:45 +0530 | [diff] [blame] | 10 | #include <asm/cache.h> |
| 11 | #include <cpu_func.h> |
Masahiro Yamada | b27af39 | 2017-08-26 00:50:17 +0900 | [diff] [blame] | 12 | #include <linux/dma-direction.h> |
Simon Glass | c3dc39a | 2020-05-10 11:39:55 -0600 | [diff] [blame] | 13 | #include <linux/kernel.h> |
Masahiro Yamada | c22c0db | 2020-02-14 16:40:17 +0900 | [diff] [blame] | 14 | #include <linux/types.h> |
Vignesh Raghavendra | c0a5a81 | 2020-01-16 14:23:45 +0530 | [diff] [blame] | 15 | #include <malloc.h> |
Kishon Vijay Abraham I | 2f06693 | 2015-02-23 18:39:56 +0530 | [diff] [blame] | 16 | |
Kishon Vijay Abraham I | aecbf87 | 2015-02-23 18:39:49 +0530 | [diff] [blame] | 17 | static inline void *dma_alloc_coherent(size_t len, unsigned long *handle) |
Stelian Pop | fa506a9 | 2008-01-31 21:15:53 +0000 | [diff] [blame] | 18 | { |
Ye Li | 9d47d13 | 2019-01-04 09:24:14 +0000 | [diff] [blame] | 19 | *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, ROUND(len, ARCH_DMA_MINALIGN)); |
Stelian Pop | fa506a9 | 2008-01-31 21:15:53 +0000 | [diff] [blame] | 20 | return (void *)*handle; |
| 21 | } |
| 22 | |
Kishon Vijay Abraham I | 2f06693 | 2015-02-23 18:39:56 +0530 | [diff] [blame] | 23 | static inline void dma_free_coherent(void *addr) |
| 24 | { |
| 25 | free(addr); |
| 26 | } |
| 27 | |
Stelian Pop | fa506a9 | 2008-01-31 21:15:53 +0000 | [diff] [blame] | 28 | #endif /* __ASM_ARM_DMA_MAPPING_H */ |