dma-mapping.h 784 B

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