of_iommu.h 862 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __OF_IOMMU_H
  3. #define __OF_IOMMU_H
  4. #include <linux/device.h>
  5. #include <linux/iommu.h>
  6. #include <linux/of.h>
  7. #ifdef CONFIG_OF_IOMMU
  8. extern int of_get_dma_window(struct device_node *dn, const char *prefix,
  9. int index, unsigned long *busno, dma_addr_t *addr,
  10. size_t *size);
  11. extern const struct iommu_ops *of_iommu_configure(struct device *dev,
  12. struct device_node *master_np,
  13. const u32 *id);
  14. #else
  15. static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
  16. int index, unsigned long *busno, dma_addr_t *addr,
  17. size_t *size)
  18. {
  19. return -EINVAL;
  20. }
  21. static inline const struct iommu_ops *of_iommu_configure(struct device *dev,
  22. struct device_node *master_np,
  23. const u32 *id)
  24. {
  25. return NULL;
  26. }
  27. #endif /* CONFIG_OF_IOMMU */
  28. #endif /* __OF_IOMMU_H */