2 * Copyright 2004-2009 Analog Devices Inc.
4 * Licensed under the GPL-2 or later.
7 #ifndef _BLACKFIN_DMA_MAPPING_H
8 #define _BLACKFIN_DMA_MAPPING_H
10 #include <asm/cacheflush.h>
13 __dma_sync(dma_addr_t addr
, size_t size
, enum dma_data_direction dir
);
15 __dma_sync_inline(dma_addr_t addr
, size_t size
, enum dma_data_direction dir
)
20 case DMA_TO_DEVICE
: /* writeback only */
21 flush_dcache_range(addr
, addr
+ size
);
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
);
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
);
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
)
46 #endif /* _BLACKFIN_DMA_MAPPING_H */