18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __OF_IOMMU_H
38c2ecf20Sopenharmony_ci#define __OF_IOMMU_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/device.h>
68c2ecf20Sopenharmony_ci#include <linux/iommu.h>
78c2ecf20Sopenharmony_ci#include <linux/of.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifdef CONFIG_OF_IOMMU
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciextern int of_get_dma_window(struct device_node *dn, const char *prefix,
128c2ecf20Sopenharmony_ci			     int index, unsigned long *busno, dma_addr_t *addr,
138c2ecf20Sopenharmony_ci			     size_t *size);
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciextern const struct iommu_ops *of_iommu_configure(struct device *dev,
168c2ecf20Sopenharmony_ci					struct device_node *master_np,
178c2ecf20Sopenharmony_ci					const u32 *id);
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#else
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistatic inline int of_get_dma_window(struct device_node *dn, const char *prefix,
228c2ecf20Sopenharmony_ci			    int index, unsigned long *busno, dma_addr_t *addr,
238c2ecf20Sopenharmony_ci			    size_t *size)
248c2ecf20Sopenharmony_ci{
258c2ecf20Sopenharmony_ci	return -EINVAL;
268c2ecf20Sopenharmony_ci}
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistatic inline const struct iommu_ops *of_iommu_configure(struct device *dev,
298c2ecf20Sopenharmony_ci					 struct device_node *master_np,
308c2ecf20Sopenharmony_ci					 const u32 *id)
318c2ecf20Sopenharmony_ci{
328c2ecf20Sopenharmony_ci	return NULL;
338c2ecf20Sopenharmony_ci}
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#endif	/* CONFIG_OF_IOMMU */
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#endif /* __OF_IOMMU_H */
38