Add linux-next specific files for 20110831
[linux-2.6/next.git] / include / linux / of_address.h
blob3118623c2c1f39dc624ac5b23e13e86862300ff1
1 #ifndef __OF_ADDRESS_H
2 #define __OF_ADDRESS_H
3 #include <linux/ioport.h>
4 #include <linux/errno.h>
5 #include <linux/of.h>
7 extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
8 extern int of_address_to_resource(struct device_node *dev, int index,
9 struct resource *r);
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);
14 extern void __iomem *of_iomap(struct device_node *device, int index);
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
20 extern const u32 *of_get_address(struct device_node *dev, int index,
21 u64 *size, unsigned int *flags);
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
28 #ifdef CONFIG_PCI
29 extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
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)
37 return -ENOSYS;
40 static inline const __be32 *of_get_pci_address(struct device_node *dev,
41 int bar_no, u64 *size, unsigned int *flags)
43 return NULL;
45 #endif /* CONFIG_PCI */
48 #endif /* __OF_ADDRESS_H */