]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
4e0ee78f HD |
2 | #ifndef __OF_IOMMU_H |
3 | #define __OF_IOMMU_H | |
4 | ||
7eba1d51 | 5 | #include <linux/device.h> |
1cd076bf WD |
6 | #include <linux/iommu.h> |
7 | #include <linux/of.h> | |
8 | ||
4e0ee78f HD |
9 | #ifdef CONFIG_OF_IOMMU |
10 | ||
11 | extern 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 | ||
53c92d79 | 15 | extern const struct iommu_ops *of_iommu_configure(struct device *dev, |
ed748621 | 16 | struct device_node *master_np); |
1cd076bf | 17 | |
4e0ee78f HD |
18 | #else |
19 | ||
20 | static inline int of_get_dma_window(struct device_node *dn, const char *prefix, | |
21 | int index, unsigned long *busno, dma_addr_t *addr, | |
22 | size_t *size) | |
23 | { | |
24 | return -EINVAL; | |
25 | } | |
26 | ||
53c92d79 | 27 | static inline const struct iommu_ops *of_iommu_configure(struct device *dev, |
ed748621 | 28 | struct device_node *master_np) |
7eba1d51 WD |
29 | { |
30 | return NULL; | |
31 | } | |
1cd076bf | 32 | |
4e0ee78f HD |
33 | #endif /* CONFIG_OF_IOMMU */ |
34 | ||
1cd076bf WD |
35 | extern struct of_device_id __iommu_of_table; |
36 | ||
37 | typedef int (*of_iommu_init_fn)(struct device_node *); | |
38 | ||
39 | #define IOMMU_OF_DECLARE(name, compat, fn) \ | |
40 | _OF_DECLARE(iommu, name, compat, fn, of_iommu_init_fn) | |
41 | ||
4e0ee78f | 42 | #endif /* __OF_IOMMU_H */ |