of_address.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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>
  6. extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
  7. extern int of_address_to_resource(struct device_node *dev, int index,
  8. struct resource *r);
  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);
  13. extern void __iomem *of_iomap(struct device_node *device, int index);
  14. /* Extract an address from a device, returns the region size and
  15. * the address space flags too. The PCI version uses a BAR number
  16. * instead of an absolute index
  17. */
  18. extern const u32 *of_get_address(struct device_node *dev, int index,
  19. u64 *size, unsigned int *flags);
  20. #ifndef pci_address_to_pio
  21. static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
  22. #define pci_address_to_pio pci_address_to_pio
  23. #endif
  24. #ifdef CONFIG_PCI
  25. extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
  26. u64 *size, unsigned int *flags);
  27. extern int of_pci_address_to_resource(struct device_node *dev, int bar,
  28. struct resource *r);
  29. #else /* CONFIG_PCI */
  30. static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
  31. struct resource *r)
  32. {
  33. return -ENOSYS;
  34. }
  35. static inline const __be32 *of_get_pci_address(struct device_node *dev,
  36. int bar_no, u64 *size, unsigned int *flags)
  37. {
  38. return NULL;
  39. }
  40. #endif /* CONFIG_PCI */
  41. #endif /* __OF_ADDRESS_H */