blob: 258528d6c4fe78d4dc89090c91d7850348eabd6e [file] [log] [blame]
Grant Likely6b884a82010-06-08 07:48:09 -06001
2#include <linux/io.h>
3#include <linux/ioport.h>
4#include <linux/of_address.h>
5
6/**
7 * of_iomap - Maps the memory mapped IO for a given device_node
8 * @device: the device whose io range will be mapped
9 * @index: index of the io range
10 *
11 * Returns a pointer to the mapped memory
12 */
13void __iomem *of_iomap(struct device_node *np, int index)
14{
15 struct resource res;
16
17 if (of_address_to_resource(np, index, &res))
18 return NULL;
19
20 return ioremap(res.start, 1 + res.end - res.start);
21}
22EXPORT_SYMBOL(of_iomap);