blob: 6ecadab41cd9cc61b129c8ee378f67aba13976f3 [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
Vignesh Raghavendrac0a5a812020-01-16 14:23:45 +053012#include <common.h>
Masahiro Yamadac22c0db2020-02-14 16:40:17 +090013#include <linux/types.h>
Vignesh Raghavendrac0a5a812020-01-16 14:23:45 +053014#include <asm/cache.h>
15#include <cpu_func.h>
Anup Patel70b85622019-02-25 08:14:17 +000016#include <linux/dma-direction.h>
Vignesh Raghavendrac0a5a812020-01-16 14:23:45 +053017#include <malloc.h>
Anup Patel70b85622019-02-25 08:14:17 +000018
Anup Patel70b85622019-02-25 08:14:17 +000019static 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
25static inline void dma_free_coherent(void *addr)
26{
27 free(addr);
28}
29
Anup Patel70b85622019-02-25 08:14:17 +000030#endif /* __ASM_RISCV_DMA_MAPPING_H */