aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-20 19:34:39 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-24 23:33:55 -0400
commit44266215e3c8209613cea014721015113b7cd2d9 (patch)
treec3da273c653514b55e348b8ae928545f3ca93e7a /arch
parent2481d76615d5e15340ccfb0243fe8779766dfc6e (diff)
sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping().
This allows more OF layer code to be shared between powerpc and sparc. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/include/asm/prom.h8
-rw-r--r--arch/sparc/kernel/of_device.c11
-rw-r--r--arch/sparc64/kernel/of_device.c11
3 files changed, 30 insertions, 0 deletions
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index b5efc4d85234..58b85fa56066 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -96,6 +96,14 @@ static inline void of_node_put(struct device_node *node)
96{ 96{
97} 97}
98 98
99/* These routines are here to provide compatibility with how powerpc
100 * handles IRQ mapping for OF device nodes. We precompute and permanently
101 * register them in the of_device objects, whereas powerpc computes them
102 * on request.
103 */
104extern int irq_of_parse_and_map(struct device_node *node, int index);
105#define irq_dispose_mapping(irq) do { } while (0)
106
99/* 107/*
100 * NB: This is here while we transition from using asm/prom.h 108 * NB: This is here while we transition from using asm/prom.h
101 * to linux/of.h 109 * to linux/of.h
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index cc4c235c4f59..56e9a718ef8f 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -29,6 +29,17 @@ struct of_device *of_find_device_by_node(struct device_node *dp)
29} 29}
30EXPORT_SYMBOL(of_find_device_by_node); 30EXPORT_SYMBOL(of_find_device_by_node);
31 31
32int irq_of_parse_and_map(struct device_node *node, int index)
33{
34 struct of_device *op = of_find_device_by_node(node);
35
36 if (!op || index >= op->num_irqs)
37 return 0xffffffff;
38
39 return op->irqs[index];
40}
41EXPORT_SYMBOL(irq_of_parse_and_map);
42
32#ifdef CONFIG_PCI 43#ifdef CONFIG_PCI
33struct bus_type ebus_bus_type; 44struct bus_type ebus_bus_type;
34EXPORT_SYMBOL(ebus_bus_type); 45EXPORT_SYMBOL(ebus_bus_type);
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index f8b50cbf4bf7..8a0d82343a25 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -55,6 +55,17 @@ struct of_device *of_find_device_by_node(struct device_node *dp)
55} 55}
56EXPORT_SYMBOL(of_find_device_by_node); 56EXPORT_SYMBOL(of_find_device_by_node);
57 57
58int irq_of_parse_and_map(struct device_node *node, int index)
59{
60 struct of_device *op = of_find_device_by_node(node);
61
62 if (!op || index >= op->num_irqs)
63 return 0xffffffff;
64
65 return op->irqs[index];
66}
67EXPORT_SYMBOL(irq_of_parse_and_map);
68
58#ifdef CONFIG_PCI 69#ifdef CONFIG_PCI
59struct bus_type ebus_bus_type; 70struct bus_type ebus_bus_type;
60EXPORT_SYMBOL(ebus_bus_type); 71EXPORT_SYMBOL(ebus_bus_type);