of_address.h 1.3 KB

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