summaryrefslogtreecommitdiff
path: root/arch/sparc64/kernel/of_device.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-10-03 14:52:33 +0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-10-03 14:52:33 +0400
commit56f68556d7bbb51dd158c74deb09c783345bfbbd (patch)
tree536e6e3c7063b1eee927194dda257602bd3dc66f /arch/sparc64/kernel/of_device.c
parentfd9470ce3ac6fb54d6026e4b1cdab0936e34805e (diff)
parent7c8ad9828e793573877fd60868bb5d2f1e3b64da (diff)
downloadlinux-56f68556d7bbb51dd158c74deb09c783345bfbbd.tar.xz
Merge unstable branch 'omap-rmk'
Merge branch 'omap-rmk' into omap-all
Diffstat (limited to 'arch/sparc64/kernel/of_device.c')
-rw-r--r--arch/sparc64/kernel/of_device.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index f8b50cbf4bf7..f845f150f565 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -96,7 +96,7 @@ struct of_bus {
int *addrc, int *sizec);
int (*map)(u32 *addr, const u32 *range,
int na, int ns, int pna);
- unsigned int (*get_flags)(const u32 *addr);
+ unsigned long (*get_flags)(const u32 *addr, unsigned long);
};
/*
@@ -156,8 +156,10 @@ static int of_bus_default_map(u32 *addr, const u32 *range,
return 0;
}
-static unsigned int of_bus_default_get_flags(const u32 *addr)
+static unsigned long of_bus_default_get_flags(const u32 *addr, unsigned long flags)
{
+ if (flags)
+ return flags;
return IORESOURCE_MEM;
}
@@ -249,17 +251,21 @@ static int of_bus_pci_map(u32 *addr, const u32 *range,
return 0;
}
-static unsigned int of_bus_pci_get_flags(const u32 *addr)
+static unsigned long of_bus_pci_get_flags(const u32 *addr, unsigned long flags)
{
- unsigned int flags = 0;
u32 w = addr[0];
+ /* For PCI, we override whatever child busses may have used. */
+ flags = 0;
switch((w >> 24) & 0x03) {
case 0x01:
flags |= IORESOURCE_IO;
+ break;
+
case 0x02: /* 32 bits */
case 0x03: /* 64 bits */
flags |= IORESOURCE_MEM;
+ break;
}
if (w & 0x40000000)
flags |= IORESOURCE_PREFETCH;
@@ -478,10 +484,10 @@ static void __init build_device_resources(struct of_device *op,
int pna, pns;
size = of_read_addr(reg + na, ns);
- flags = bus->get_flags(reg);
-
memcpy(addr, reg, na * 4);
+ flags = bus->get_flags(addr, 0);
+
if (use_1to1_mapping(pp)) {
result = of_read_addr(addr, na);
goto build_res;
@@ -506,6 +512,8 @@ static void __init build_device_resources(struct of_device *op,
dna, dns, pna))
break;
+ flags = pbus->get_flags(addr, flags);
+
dna = pna;
dns = pns;
dbus = pbus;