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/dma-direction.h>
13 
14 #define dma_mapping_error(x, y)	0
15 
dma_alloc_coherent(size_t len,unsigned long * handle)16 static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
17 {
18 	*handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
19 	return (void *)*handle;
20 }
21 
dma_free_coherent(void * addr)22 static inline void dma_free_coherent(void *addr)
23 {
24 	free(addr);
25 }
26 
dma_map_single(volatile void * vaddr,size_t len,enum dma_data_direction dir)27 static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
28 					   enum dma_data_direction dir)
29 {
30 	return (unsigned long)vaddr;
31 }
32 
dma_unmap_single(volatile void * vaddr,size_t len,unsigned long paddr)33 static inline void dma_unmap_single(volatile void *vaddr, size_t len,
34 				    unsigned long paddr)
35 {
36 }
37 
38 #endif /* __ASM_RISCV_DMA_MAPPING_H */
39