1 #ifndef __ASM_NIOS2_DMA_MAPPING_H 2 #define __ASM_NIOS2_DMA_MAPPING_H 3 4 #include <memalign.h> 5 #include <asm/io.h> 6 7 /* 8 * dma_alloc_coherent() return cache-line aligned allocation which is mapped 9 * to uncached io region. 10 */ dma_alloc_coherent(size_t len,unsigned long * handle)11static inline void *dma_alloc_coherent(size_t len, unsigned long *handle) 12 { 13 unsigned long addr = (unsigned long)malloc_cache_aligned(len); 14 15 if (!addr) 16 return NULL; 17 18 invalidate_dcache_range(addr, addr + len); 19 if (handle) 20 *handle = addr; 21 22 return map_physmem(addr, len, MAP_NOCACHE); 23 } 24 #endif /* __ASM_NIOS2_DMA_MAPPING_H */ 25