3 #include <linux/ioport.h>
4 #include <linux/errno.h>
7 #ifdef CONFIG_OF_ADDRESS
8 extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
9 extern bool of_can_translate_address(struct device_node *dev);
10 extern int of_address_to_resource(struct device_node *dev, int index,
12 extern struct device_node *of_find_matching_node_by_address(
13 struct device_node *from,
14 const struct of_device_id *matches,
16 extern void __iomem *of_iomap(struct device_node *device, int index);
18 /* Extract an address from a device, returns the region size and
19 * the address space flags too. The PCI version uses a BAR number
20 * instead of an absolute index
22 extern const __be32 *of_get_address(struct device_node *dev, int index,
23 u64 *size, unsigned int *flags);
25 #ifndef pci_address_to_pio
26 static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
27 #define pci_address_to_pio pci_address_to_pio
30 #else /* CONFIG_OF_ADDRESS */
31 #ifndef of_address_to_resource
32 static inline int of_address_to_resource(struct device_node *dev, int index,
38 static inline struct device_node *of_find_matching_node_by_address(
39 struct device_node *from,
40 const struct of_device_id *matches,
46 static inline void __iomem *of_iomap(struct device_node *device, int index)
51 static inline const __be32 *of_get_address(struct device_node *dev, int index,
52 u64 *size, unsigned int *flags)
56 #endif /* CONFIG_OF_ADDRESS */
59 #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
60 extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
61 u64 *size, unsigned int *flags);
62 extern int of_pci_address_to_resource(struct device_node *dev, int bar,
64 #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
65 static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
71 static inline const __be32 *of_get_pci_address(struct device_node *dev,
72 int bar_no, u64 *size, unsigned int *flags)
76 #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
78 #endif /* __OF_ADDRESS_H */