blob: 16f4b3e87f2068627f0c57fd2d902662d10e0821 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __OF_IOMMU_H
3#define __OF_IOMMU_H
4
5#include <linux/device.h>
6#include <linux/iommu.h>
7#include <linux/of.h>
8
9#ifdef CONFIG_OF_IOMMU
10
11extern int of_get_dma_window(struct device_node *dn, const char *prefix,
12 int index, unsigned long *busno, dma_addr_t *addr,
13 size_t *size);
14
15extern const struct iommu_ops *of_iommu_configure(struct device *dev,
Olivier Deprez157378f2022-04-04 15:47:50 +020016 struct device_node *master_np,
17 const u32 *id);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000018
19#else
20
21static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
22 int index, unsigned long *busno, dma_addr_t *addr,
23 size_t *size)
24{
25 return -EINVAL;
26}
27
28static inline const struct iommu_ops *of_iommu_configure(struct device *dev,
Olivier Deprez157378f2022-04-04 15:47:50 +020029 struct device_node *master_np,
30 const u32 *id)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000031{
32 return NULL;
33}
34
35#endif /* CONFIG_OF_IOMMU */
36
37#endif /* __OF_IOMMU_H */