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