Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | #ifndef _ASM_DMA_MAPPING_H |
| 3 | #define _ASM_DMA_MAPPING_H |
| 4 | |
Christoph Hellwig | a999933 | 2018-07-27 19:26:06 +0200 | [diff] [blame] | 5 | #include <linux/swiotlb.h> |
| 6 | |
Christoph Hellwig | c5e2bbb | 2018-06-15 13:08:50 +0200 | [diff] [blame] | 7 | extern const struct dma_map_ops jazz_dma_ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | |
Bart Van Assche | 815dd18 | 2017-01-20 13:04:04 -0800 | [diff] [blame] | 9 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
Atsushi Nemoto | 4f29c05 | 2009-01-23 00:42:11 +0900 | [diff] [blame] | 10 | { |
Christoph Hellwig | c5e2bbb | 2018-06-15 13:08:50 +0200 | [diff] [blame] | 11 | #if defined(CONFIG_MACH_JAZZ) |
| 12 | return &jazz_dma_ops; |
| 13 | #elif defined(CONFIG_SWIOTLB) |
Christoph Hellwig | a999933 | 2018-07-27 19:26:06 +0200 | [diff] [blame] | 14 | return &swiotlb_dma_ops; |
Christoph Hellwig | f8c55dc | 2018-06-15 13:08:46 +0200 | [diff] [blame] | 15 | #elif defined(CONFIG_DMA_NONCOHERENT_OPS) |
| 16 | return &dma_noncoherent_ops; |
Christoph Hellwig | 3369ddb | 2018-06-15 13:08:38 +0200 | [diff] [blame] | 17 | #else |
Christoph Hellwig | dffbfde | 2018-06-15 13:08:43 +0200 | [diff] [blame] | 18 | return &dma_direct_ops; |
Christoph Hellwig | f6d302e | 2018-06-15 13:08:36 +0200 | [diff] [blame] | 19 | #endif |
Atsushi Nemoto | 4f29c05 | 2009-01-23 00:42:11 +0900 | [diff] [blame] | 20 | } |
| 21 | |
Paul Burton | 20d3306 | 2016-10-05 18:18:16 +0100 | [diff] [blame] | 22 | #define arch_setup_dma_ops arch_setup_dma_ops |
| 23 | static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, |
| 24 | u64 size, const struct iommu_ops *iommu, |
| 25 | bool coherent) |
| 26 | { |
| 27 | #ifdef CONFIG_DMA_PERDEV_COHERENT |
| 28 | dev->archdata.dma_coherent = coherent; |
| 29 | #endif |
| 30 | } |
| 31 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #endif /* _ASM_DMA_MAPPING_H */ |