xref: /linux/arch/mips/include/asm/dma-mapping.h (revision 8e5c88bfbb8cca797e9e108abf6ef63028f678d8)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_DMA_MAPPING_H
3 #define _ASM_DMA_MAPPING_H
4 
5 extern const struct dma_map_ops jazz_dma_ops;
6 extern const struct dma_map_ops mips_swiotlb_ops;
7 
8 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
9 {
10 #if defined(CONFIG_MACH_JAZZ)
11 	return &jazz_dma_ops;
12 #elif defined(CONFIG_SWIOTLB)
13 	return &mips_swiotlb_ops;
14 #elif defined(CONFIG_DMA_NONCOHERENT_OPS)
15 	return &dma_noncoherent_ops;
16 #else
17 	return &dma_direct_ops;
18 #endif
19 }
20 
21 #define arch_setup_dma_ops arch_setup_dma_ops
22 static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
23 				      u64 size, const struct iommu_ops *iommu,
24 				      bool coherent)
25 {
26 #ifdef CONFIG_DMA_PERDEV_COHERENT
27 	dev->archdata.dma_coherent = coherent;
28 #endif
29 }
30 
31 #endif /* _ASM_DMA_MAPPING_H */
32