]>
git.ipfire.org Git - people/ms/u-boot.git/blob - arch/avr32/include/asm/dma-mapping.h
2 * Copyright (C) 2006 Atmel Corporation
4 * SPDX-License-Identifier: GPL-2.0+
6 #ifndef __ASM_AVR32_DMA_MAPPING_H
7 #define __ASM_AVR32_DMA_MAPPING_H
10 #include <asm/arch/cacheflush.h>
12 enum dma_data_direction
{
13 DMA_BIDIRECTIONAL
= 0,
17 extern void *dma_alloc_coherent(size_t len
, unsigned long *handle
);
19 static inline unsigned long dma_map_single(volatile void *vaddr
, size_t len
,
20 enum dma_data_direction dir
)
22 extern void __bad_dma_data_direction(void);
25 case DMA_BIDIRECTIONAL
:
26 flush_dcache_range((unsigned long)vaddr
,
27 (unsigned long)vaddr
+ len
);
30 dcache_clean_range(vaddr
, len
);
33 invalidate_dcache_range((unsigned long)vaddr
,
34 (unsigned long)vaddr
+ len
);
37 /* This will cause a linker error */
38 __bad_dma_data_direction();
41 return virt_to_phys(vaddr
);
44 static inline void dma_unmap_single(volatile void *vaddr
, size_t len
,
50 #endif /* __ASM_AVR32_DMA_MAPPING_H */