aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-06-08 09:48:09 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-07-05 18:14:26 -0400
commit6b884a8d50a6eea2fb3dad7befe748f67193073b (patch)
tree85756fbd09ebaebdeb9a7ab56806bcbc5e793532 /drivers
parenta7c194b007ec40a130207e9ace9cecf598fc6ac5 (diff)
of/address: merge of_iomap()
Merge common code between Microblaze and PowerPC. This patch creates new of_address.h and address.c files to containing address translation and mapping routines. First routine to be moved it of_iomap() Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: Michal Simek <monstr@monstr.eu> CC: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/of/Kconfig4
-rw-r--r--drivers/of/Makefile1
-rw-r--r--drivers/of/address.c22
3 files changed, 27 insertions, 0 deletions
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index b87495efa16e..097f42aebe90 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -6,6 +6,10 @@ config OF_DYNAMIC
6 def_bool y 6 def_bool y
7 depends on OF && PPC_OF 7 depends on OF && PPC_OF
8 8
9config OF_ADDRESS
10 def_bool y
11 depends on OF && !SPARC
12
9config OF_IRQ 13config OF_IRQ
10 def_bool y 14 def_bool y
11 depends on OF && !SPARC 15 depends on OF && !SPARC
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index 3631a5ea0b47..0052c405463a 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -1,5 +1,6 @@
1obj-y = base.o 1obj-y = base.o
2obj-$(CONFIG_OF_FLATTREE) += fdt.o 2obj-$(CONFIG_OF_FLATTREE) += fdt.o
3obj-$(CONFIG_OF_ADDRESS) += address.o
3obj-$(CONFIG_OF_IRQ) += irq.o 4obj-$(CONFIG_OF_IRQ) += irq.o
4obj-$(CONFIG_OF_DEVICE) += device.o platform.o 5obj-$(CONFIG_OF_DEVICE) += device.o platform.o
5obj-$(CONFIG_OF_GPIO) += gpio.o 6obj-$(CONFIG_OF_GPIO) += gpio.o
diff --git a/drivers/of/address.c b/drivers/of/address.c
new file mode 100644
index 000000000000..258528d6c4fe
--- /dev/null
+++ b/drivers/of/address.c
@@ -0,0 +1,22 @@
1
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);