address.c 508 B

12345678910111213141516171819202122
  1. #include <linux/io.h>
  2. #include <linux/ioport.h>
  3. #include <linux/of_address.h>
  4. /**
  5. * of_iomap - Maps the memory mapped IO for a given device_node
  6. * @device: the device whose io range will be mapped
  7. * @index: index of the io range
  8. *
  9. * Returns a pointer to the mapped memory
  10. */
  11. void __iomem *of_iomap(struct device_node *np, int index)
  12. {
  13. struct resource res;
  14. if (of_address_to_resource(np, index, &res))
  15. return NULL;
  16. return ioremap(res.start, 1 + res.end - res.start);
  17. }
  18. EXPORT_SYMBOL(of_iomap);