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 <common.h> 13 #include <linux/types.h> 14 #include <asm/cache.h> 15 #include <cpu_func.h> 16 #include <linux/dma-direction.h> 17 #include <malloc.h> 18 dma_alloc_coherent(size_t len,unsigned long * handle)19static inline void *dma_alloc_coherent(size_t len, unsigned long *handle) 20 { 21 *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len); 22 return (void *)*handle; 23 } 24 dma_free_coherent(void * addr)25static inline void dma_free_coherent(void *addr) 26 { 27 free(addr); 28 } 29 30 #endif /* __ASM_RISCV_DMA_MAPPING_H */ 31