1
2
3
4
5
6
7#ifndef _BLACKFIN_DMA_MAPPING_H
8#define _BLACKFIN_DMA_MAPPING_H
9
10#include <asm/cacheflush.h>
11
12extern void
13__dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir);
14static inline void
15__dma_sync_inline(dma_addr_t addr, size_t size, enum dma_data_direction dir)
16{
17 switch (dir) {
18 case DMA_NONE:
19 BUG();
20 case DMA_TO_DEVICE:
21 flush_dcache_range(addr, addr + size);
22 break;
23 case DMA_FROM_DEVICE:
24 case DMA_BIDIRECTIONAL:
25
26 invalidate_dcache_range(addr, addr + size);
27 break;
28 }
29}
30static inline void
31_dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir)
32{
33 if (__builtin_constant_p(dir))
34 __dma_sync_inline(addr, size, dir);
35 else
36 __dma_sync(addr, size, dir);
37}
38
39extern const struct dma_map_ops bfin_dma_ops;
40
41static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
42{
43 return &bfin_dma_ops;
44}
45
46#endif
47