Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / blackfin / include / asm / dma-mapping.h
blob04254ac36bed1dd3897c316c07c8c924ab08faca
1 /*
2 * Copyright 2004-2009 Analog Devices Inc.
4 * Licensed under the GPL-2 or later.
5 */
7 #ifndef _BLACKFIN_DMA_MAPPING_H
8 #define _BLACKFIN_DMA_MAPPING_H
10 #include <asm/cacheflush.h>
12 extern void
13 __dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir);
14 static inline void
15 __dma_sync_inline(dma_addr_t addr, size_t size, enum dma_data_direction dir)
17 switch (dir) {
18 case DMA_NONE:
19 BUG();
20 case DMA_TO_DEVICE: /* writeback only */
21 flush_dcache_range(addr, addr + size);
22 break;
23 case DMA_FROM_DEVICE: /* invalidate only */
24 case DMA_BIDIRECTIONAL: /* flush and invalidate */
25 /* Blackfin has no dedicated invalidate (it includes a flush) */
26 invalidate_dcache_range(addr, addr + size);
27 break;
30 static inline void
31 _dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir)
33 if (__builtin_constant_p(dir))
34 __dma_sync_inline(addr, size, dir);
35 else
36 __dma_sync(addr, size, dir);
39 extern const struct dma_map_ops bfin_dma_ops;
41 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
43 return &bfin_dma_ops;
46 #endif /* _BLACKFIN_DMA_MAPPING_H */