Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASM_DMA_MAPPING_H |
| 2 | #define _ASM_DMA_MAPPING_H |
| 3 | |
Christoph Hellwig | 84be456 | 2015-05-01 12:46:15 +0200 | [diff] [blame] | 4 | #include <linux/scatterlist.h> |
Steven J. Hill | b6d92b4 | 2013-03-25 13:47:29 -0500 | [diff] [blame] | 5 | #include <asm/dma-coherence.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | #include <asm/cache.h> |
| 7 | |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 8 | #ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */ |
David Daney | 48e1fd5 | 2010-10-01 13:27:32 -0700 | [diff] [blame] | 9 | #include <dma-coherence.h> |
Ralf Baechle | a5602a3 | 2011-05-18 13:14:36 +0100 | [diff] [blame] | 10 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | |
David Daney | 48e1fd5 | 2010-10-01 13:27:32 -0700 | [diff] [blame] | 12 | extern struct dma_map_ops *mips_dma_map_ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
David Daney | 48e1fd5 | 2010-10-01 13:27:32 -0700 | [diff] [blame] | 14 | static inline struct dma_map_ops *get_dma_ops(struct device *dev) |
Atsushi Nemoto | 4f29c05 | 2009-01-23 00:42:11 +0900 | [diff] [blame] | 15 | { |
David Daney | 48e1fd5 | 2010-10-01 13:27:32 -0700 | [diff] [blame] | 16 | if (dev && dev->archdata.dma_ops) |
| 17 | return dev->archdata.dma_ops; |
| 18 | else |
| 19 | return mips_dma_map_ops; |
Atsushi Nemoto | 4f29c05 | 2009-01-23 00:42:11 +0900 | [diff] [blame] | 20 | } |
| 21 | |
David Daney | 48e1fd5 | 2010-10-01 13:27:32 -0700 | [diff] [blame] | 22 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) |
| 23 | { |
| 24 | if (!dev->dma_mask) |
Joe Perches | 3db2742 | 2015-03-30 16:46:03 -0700 | [diff] [blame] | 25 | return false; |
David Daney | 48e1fd5 | 2010-10-01 13:27:32 -0700 | [diff] [blame] | 26 | |
| 27 | return addr + size <= *dev->dma_mask; |
| 28 | } |
| 29 | |
| 30 | static inline void dma_mark_clean(void *addr, size_t size) {} |
| 31 | |
Ralf Baechle | d3fa72e | 2006-12-06 20:38:56 -0800 | [diff] [blame] | 32 | extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | enum dma_data_direction direction); |
| 34 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | #endif /* _ASM_DMA_MAPPING_H */ |