mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 <[email protected]> Acked-by: Benjamin Herrenschmidt <[email protected]> CC: Michal Simek <[email protected]> CC: Stephen Rothwell <[email protected]>
This commit is contained in:
parent
a7c194b007
commit
6b884a8d50
8 changed files with 38 additions and 40 deletions
|
|
@ -6,6 +6,10 @@ config OF_DYNAMIC
|
|||
def_bool y
|
||||
depends on OF && PPC_OF
|
||||
|
||||
config OF_ADDRESS
|
||||
def_bool y
|
||||
depends on OF && !SPARC
|
||||
|
||||
config OF_IRQ
|
||||
def_bool y
|
||||
depends on OF && !SPARC
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
obj-y = base.o
|
||||
obj-$(CONFIG_OF_FLATTREE) += fdt.o
|
||||
obj-$(CONFIG_OF_ADDRESS) += address.o
|
||||
obj-$(CONFIG_OF_IRQ) += irq.o
|
||||
obj-$(CONFIG_OF_DEVICE) += device.o platform.o
|
||||
obj-$(CONFIG_OF_GPIO) += gpio.o
|
||||
|
|
|
|||
22
drivers/of/address.c
Normal file
22
drivers/of/address.c
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
#include <linux/io.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/of_address.h>
|
||||
|
||||
/**
|
||||
* of_iomap - Maps the memory mapped IO for a given device_node
|
||||
* @device: the device whose io range will be mapped
|
||||
* @index: index of the io range
|
||||
*
|
||||
* Returns a pointer to the mapped memory
|
||||
*/
|
||||
void __iomem *of_iomap(struct device_node *np, int index)
|
||||
{
|
||||
struct resource res;
|
||||
|
||||
if (of_address_to_resource(np, index, &res))
|
||||
return NULL;
|
||||
|
||||
return ioremap(res.start, 1 + res.end - res.start);
|
||||
}
|
||||
EXPORT_SYMBOL(of_iomap);
|
||||
Loading…
Reference in a new issue