Grant Likely | 6b884a8 | 2010-06-08 07:48:09 -0600 | [diff] [blame] | 1 | #ifndef __OF_ADDRESS_H |
| 2 | #define __OF_ADDRESS_H |
| 3 | #include <linux/ioport.h> |
Grant Likely | 99ce39e | 2011-07-05 23:42:37 -0600 | [diff] [blame] | 4 | #include <linux/errno.h> |
Grant Likely | 6b884a8 | 2010-06-08 07:48:09 -0600 | [diff] [blame] | 5 | #include <linux/of.h> |
| 6 | |
Sebastian Andrzej Siewior | 0131d89 | 2010-12-01 10:54:46 +0100 | [diff] [blame] | 7 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); |
Grant Likely | 1f5bef3 | 2010-06-08 07:48:09 -0600 | [diff] [blame] | 8 | extern int of_address_to_resource(struct device_node *dev, int index, |
| 9 | struct resource *r); |
Grant Likely | 90e33f6 | 2011-07-05 23:42:28 -0600 | [diff] [blame] | 10 | extern struct device_node *of_find_matching_node_by_address( |
| 11 | struct device_node *from, |
| 12 | const struct of_device_id *matches, |
| 13 | u64 base_address); |
Grant Likely | 6b884a8 | 2010-06-08 07:48:09 -0600 | [diff] [blame] | 14 | extern void __iomem *of_iomap(struct device_node *device, int index); |
| 15 | |
Grant Likely | 22ae782 | 2010-07-29 11:49:01 -0600 | [diff] [blame] | 16 | /* Extract an address from a device, returns the region size and |
| 17 | * the address space flags too. The PCI version uses a BAR number |
| 18 | * instead of an absolute index |
| 19 | */ |
| 20 | extern const u32 *of_get_address(struct device_node *dev, int index, |
| 21 | u64 *size, unsigned int *flags); |
| 22 | |
| 23 | #ifndef pci_address_to_pio |
| 24 | static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } |
| 25 | #define pci_address_to_pio pci_address_to_pio |
| 26 | #endif |
| 27 | |
| 28 | #ifdef CONFIG_PCI |
Sebastian Andrzej Siewior | 0131d89 | 2010-12-01 10:54:46 +0100 | [diff] [blame] | 29 | extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, |
Grant Likely | 22ae782 | 2010-07-29 11:49:01 -0600 | [diff] [blame] | 30 | u64 *size, unsigned int *flags); |
| 31 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, |
| 32 | struct resource *r); |
| 33 | #else /* CONFIG_PCI */ |
| 34 | static inline int of_pci_address_to_resource(struct device_node *dev, int bar, |
| 35 | struct resource *r) |
| 36 | { |
| 37 | return -ENOSYS; |
| 38 | } |
| 39 | |
Sebastian Andrzej Siewior | 0131d89 | 2010-12-01 10:54:46 +0100 | [diff] [blame] | 40 | static inline const __be32 *of_get_pci_address(struct device_node *dev, |
Grant Likely | 22ae782 | 2010-07-29 11:49:01 -0600 | [diff] [blame] | 41 | int bar_no, u64 *size, unsigned int *flags) |
| 42 | { |
| 43 | return NULL; |
| 44 | } |
| 45 | #endif /* CONFIG_PCI */ |
| 46 | |
| 47 | |
Grant Likely | 6b884a8 | 2010-06-08 07:48:09 -0600 | [diff] [blame] | 48 | #endif /* __OF_ADDRESS_H */ |
| 49 | |