Commit | Line | Data |
---|---|---|
4e0ee78f HD |
1 | #ifndef __OF_IOMMU_H |
2 | #define __OF_IOMMU_H | |
3 | ||
7eba1d51 | 4 | #include <linux/device.h> |
1cd076bf WD |
5 | #include <linux/iommu.h> |
6 | #include <linux/of.h> | |
7 | ||
4e0ee78f HD |
8 | #ifdef CONFIG_OF_IOMMU |
9 | ||
10 | extern int of_get_dma_window(struct device_node *dn, const char *prefix, | |
11 | int index, unsigned long *busno, dma_addr_t *addr, | |
12 | size_t *size); | |
13 | ||
1cd076bf | 14 | extern void of_iommu_init(void); |
ed748621 MK |
15 | extern struct iommu_ops *of_iommu_configure(struct device *dev, |
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 | ||
1cd076bf | 27 | static inline void of_iommu_init(void) { } |
ed748621 MK |
28 | static inline struct iommu_ops *of_iommu_configure(struct device *dev, |
29 | struct device_node *master_np) | |
7eba1d51 WD |
30 | { |
31 | return NULL; | |
32 | } | |
1cd076bf | 33 | |
4e0ee78f HD |
34 | #endif /* CONFIG_OF_IOMMU */ |
35 | ||
a42a7a1f RM |
36 | void of_iommu_set_ops(struct device_node *np, struct iommu_ops *ops); |
37 | struct iommu_ops *of_iommu_get_ops(struct device_node *np); | |
1cd076bf WD |
38 | |
39 | extern struct of_device_id __iommu_of_table; | |
40 | ||
41 | typedef int (*of_iommu_init_fn)(struct device_node *); | |
42 | ||
43 | #define IOMMU_OF_DECLARE(name, compat, fn) \ | |
44 | _OF_DECLARE(iommu, name, compat, fn, of_iommu_init_fn) | |
45 | ||
4e0ee78f | 46 | #endif /* __OF_IOMMU_H */ |