]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/blackfin/include/asm/dma-mapping.h
Merge tag 'mac80211-for-davem-2017-02-28' of git://git.kernel.org/pub/scm/linux/kerne...
[mirror_ubuntu-artful-kernel.git] / arch / blackfin / include / asm / dma-mapping.h
CommitLineData
96f1050d
RG
1/*
2 * Copyright 2004-2009 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2 or later.
5 */
6
1394f032
BW
7#ifndef _BLACKFIN_DMA_MAPPING_H
8#define _BLACKFIN_DMA_MAPPING_H
9
dd3b0e3e 10#include <asm/cacheflush.h>
dd3b0e3e
BS
11
12extern void
13__dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir);
14static inline void
a3a6a590 15__dma_sync_inline(dma_addr_t addr, size_t size, enum dma_data_direction dir)
dd3b0e3e 16{
dd3b0e3e
BS
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;
28 }
29}
a3a6a590
SZ
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}
dd3b0e3e 38
5299709d 39extern const struct dma_map_ops bfin_dma_ops;
42b86e06 40
815dd187 41static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
42b86e06 42{
6f620975 43 return &bfin_dma_ops;
42b86e06
FT
44}
45
1394f032 46#endif /* _BLACKFIN_DMA_MAPPING_H */