blob: d0cc5d7c775779f209d7c32012f8d61f4d9ad43e [file] [log] [blame]
Anup Patel70b85622019-02-25 08:14:17 +00001/* 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
Masahiro Yamadac22c0db2020-02-14 16:40:17 +090012#include <linux/types.h>
Vignesh Raghavendrac0a5a812020-01-16 14:23:45 +053013#include <asm/cache.h>
14#include <cpu_func.h>
Anup Patel70b85622019-02-25 08:14:17 +000015#include <linux/dma-direction.h>
Vignesh Raghavendrac0a5a812020-01-16 14:23:45 +053016#include <malloc.h>
Anup Patel70b85622019-02-25 08:14:17 +000017
Anup Patel70b85622019-02-25 08:14:17 +000018static 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
24static inline void dma_free_coherent(void *addr)
25{
26 free(addr);
27}
28
Anup Patel70b85622019-02-25 08:14:17 +000029#endif /* __ASM_RISCV_DMA_MAPPING_H */