1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (c) 2018 Western Digital Corporation or its affiliates.
4  *
5  * Authors:
6  *   Anup Patel <anup.patel@wdc.com>
7  */
8 
9 #ifndef __ASM_RISCV_DMA_MAPPING_H
10 #define __ASM_RISCV_DMA_MAPPING_H
11 
12 #include <linux/types.h>
13 #include <asm/cache.h>
14 #include <cpu_func.h>
15 #include <linux/dma-direction.h>
16 #include <malloc.h>
17 
dma_alloc_coherent(size_t len,unsigned long * handle)18 static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
19 {
20 	*handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
21 	return (void *)*handle;
22 }
23 
dma_free_coherent(void * addr)24 static inline void dma_free_coherent(void *addr)
25 {
26 	free(addr);
27 }
28 
29 #endif /* __ASM_RISCV_DMA_MAPPING_H */
30