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 int of_address_to_resource(struct device_node *dev, int index,
11 extern struct device_node *of_find_matching_node_by_address(
12 struct device_node *from,
13 const struct of_device_id *matches,
15 extern void __iomem *of_iomap(struct device_node *device, int index);
17 /* Extract an address from a device, returns the region size and
18 * the address space flags too. The PCI version uses a BAR number
19 * instead of an absolute index
21 extern const u32 *of_get_address(struct device_node *dev, int index,
22 u64 *size, unsigned int *flags);
24 #ifndef pci_address_to_pio
25 static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
26 #define pci_address_to_pio pci_address_to_pio
29 #else /* CONFIG_OF_ADDRESS */
30 static inline int of_address_to_resource(struct device_node *dev, int index,
35 static inline struct device_node *of_find_matching_node_by_address(
36 struct device_node *from,
37 const struct of_device_id *matches,
42 static inline void __iomem *of_iomap(struct device_node *device, int index)
46 static inline const u32 *of_get_address(struct device_node *dev, int index,
47 u64 *size, unsigned int *flags)
51 #endif /* CONFIG_OF_ADDRESS */
54 #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
55 extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
56 u64 *size, unsigned int *flags);
57 extern int of_pci_address_to_resource(struct device_node *dev, int bar,
59 #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
60 static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
66 static inline const __be32 *of_get_pci_address(struct device_node *dev,
67 int bar_no, u64 *size, unsigned int *flags)
71 #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
73 #endif /* __OF_ADDRESS_H */