d03abbb11c3472ba621840c93d92a399f00586ae
[deliverable/linux.git] / include / linux / of_iommu.h
1 #ifndef __OF_IOMMU_H
2 #define __OF_IOMMU_H
3
4 #include <linux/device.h>
5 #include <linux/iommu.h>
6 #include <linux/of.h>
7
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
14 extern void of_iommu_init(void);
15 extern struct iommu_ops *of_iommu_configure(struct device *dev);
16
17 #else
18
19 static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
20 int index, unsigned long *busno, dma_addr_t *addr,
21 size_t *size)
22 {
23 return -EINVAL;
24 }
25
26 static inline void of_iommu_init(void) { }
27 static inline struct iommu_ops *of_iommu_configure(struct device *dev)
28 {
29 return NULL;
30 }
31
32 #endif /* CONFIG_OF_IOMMU */
33
34 static inline void of_iommu_set_ops(struct device_node *np,
35 const struct iommu_ops *ops)
36 {
37 np->data = (struct iommu_ops *)ops;
38 }
39
40 static inline struct iommu_ops *of_iommu_get_ops(struct device_node *np)
41 {
42 return np->data;
43 }
44
45 extern struct of_device_id __iommu_of_table;
46
47 typedef int (*of_iommu_init_fn)(struct device_node *);
48
49 #define IOMMU_OF_DECLARE(name, compat, fn) \
50 _OF_DECLARE(iommu, name, compat, fn, of_iommu_init_fn)
51
52 #endif /* __OF_IOMMU_H */
This page took 0.030886 seconds and 4 git commands to generate.