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