dma-mapping.h 652 B

123456789101112131415161718192021222324252627282930
  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. #ifndef __ASM_RISCV_DMA_MAPPING_H
  9. #define __ASM_RISCV_DMA_MAPPING_H
  10. #include <common.h>
  11. #include <linux/types.h>
  12. #include <asm/cache.h>
  13. #include <cpu_func.h>
  14. #include <linux/dma-direction.h>
  15. #include <malloc.h>
  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. static inline void dma_free_coherent(void *addr)
  22. {
  23. free(addr);
  24. }
  25. #endif /* __ASM_RISCV_DMA_MAPPING_H */