Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Hiroshi Doyu | 4e0ee78 | 2012-06-25 14:23:54 +0300 | [diff] [blame] | 2 | #ifndef __OF_IOMMU_H |
| 3 | #define __OF_IOMMU_H |
| 4 | |
Will Deacon | 7eba1d5 | 2014-08-27 16:20:32 +0100 | [diff] [blame] | 5 | #include <linux/device.h> |
Will Deacon | 1cd076b | 2014-08-27 14:40:58 +0100 | [diff] [blame] | 6 | #include <linux/iommu.h> |
| 7 | #include <linux/of.h> |
| 8 | |
Hiroshi Doyu | 4e0ee78 | 2012-06-25 14:23:54 +0300 | [diff] [blame] | 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 | |
Robin Murphy | 53c92d7 | 2016-04-07 18:42:05 +0100 | [diff] [blame] | 15 | extern const struct iommu_ops *of_iommu_configure(struct device *dev, |
Murali Karicheri | ed74862 | 2015-03-03 12:52:08 -0500 | [diff] [blame] | 16 | struct device_node *master_np); |
Will Deacon | 1cd076b | 2014-08-27 14:40:58 +0100 | [diff] [blame] | 17 | |
Hiroshi Doyu | 4e0ee78 | 2012-06-25 14:23:54 +0300 | [diff] [blame] | 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 | |
Robin Murphy | 53c92d7 | 2016-04-07 18:42:05 +0100 | [diff] [blame] | 27 | static inline const struct iommu_ops *of_iommu_configure(struct device *dev, |
Murali Karicheri | ed74862 | 2015-03-03 12:52:08 -0500 | [diff] [blame] | 28 | struct device_node *master_np) |
Will Deacon | 7eba1d5 | 2014-08-27 16:20:32 +0100 | [diff] [blame] | 29 | { |
| 30 | return NULL; |
| 31 | } |
Will Deacon | 1cd076b | 2014-08-27 14:40:58 +0100 | [diff] [blame] | 32 | |
Hiroshi Doyu | 4e0ee78 | 2012-06-25 14:23:54 +0300 | [diff] [blame] | 33 | #endif /* CONFIG_OF_IOMMU */ |
| 34 | |
Will Deacon | 1cd076b | 2014-08-27 14:40:58 +0100 | [diff] [blame] | 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 | |
Hiroshi Doyu | 4e0ee78 | 2012-06-25 14:23:54 +0300 | [diff] [blame] | 42 | #endif /* __OF_IOMMU_H */ |