aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-06-18 13:09:59 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-06-28 15:41:33 -0400
commite3873444990dd6f8a095d1f72b5ad45192f8c506 (patch)
tree9e9fbc43fd4ffde3ac7d41827e0ab9c5f98363f0 /arch
parentb505ff5e7291cca6379549297e3852ce3622d550 (diff)
of/irq: Move irq_of_parse_and_map() to common code
Merge common code between PowerPC and Microblaze. SPARC implements irq_of_parse_and_map(), but the implementation is different, so it does not use this code. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Michal Simek <monstr@monstr.eu> Cc: "David S. Miller" <davem@davemloft.net> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Jeremy Kerr <jeremy.kerr@canonical.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/microblaze/include/asm/irq.h24
-rw-r--r--arch/microblaze/include/asm/prom.h26
-rw-r--r--arch/microblaze/kernel/irq.c14
-rw-r--r--arch/powerpc/include/asm/irq.h28
-rw-r--r--arch/powerpc/include/asm/prom.h27
-rw-r--r--arch/powerpc/kernel/irq.c14
-rw-r--r--arch/sparc/include/asm/prom.h1
7 files changed, 6 insertions, 128 deletions
diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h
index 31a35c33df63..ec5583d6111c 100644
--- a/arch/microblaze/include/asm/irq.h
+++ b/arch/microblaze/include/asm/irq.h
@@ -27,17 +27,6 @@ extern unsigned int nr_irq;
27struct pt_regs; 27struct pt_regs;
28extern void do_IRQ(struct pt_regs *regs); 28extern void do_IRQ(struct pt_regs *regs);
29 29
30/**
31 * irq_of_parse_and_map - Parse and Map an interrupt into linux virq space
32 * @device: Device node of the device whose interrupt is to be mapped
33 * @index: Index of the interrupt to map
34 *
35 * This function is a wrapper that chains of_irq_map_one() and
36 * irq_create_of_mapping() to make things easier to callers
37 */
38struct device_node;
39extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index);
40
41/** FIXME - not implement 30/** FIXME - not implement
42 * irq_dispose_mapping - Unmap an interrupt 31 * irq_dispose_mapping - Unmap an interrupt
43 * @virq: linux virq number of the interrupt to unmap 32 * @virq: linux virq number of the interrupt to unmap
@@ -62,17 +51,4 @@ struct irq_host;
62extern unsigned int irq_create_mapping(struct irq_host *host, 51extern unsigned int irq_create_mapping(struct irq_host *host,
63 irq_hw_number_t hwirq); 52 irq_hw_number_t hwirq);
64 53
65/**
66 * irq_create_of_mapping - Map a hardware interrupt into linux virq space
67 * @controller: Device node of the interrupt controller
68 * @inspec: Interrupt specifier from the device-tree
69 * @intsize: Size of the interrupt specifier from the device-tree
70 *
71 * This function is identical to irq_create_mapping except that it takes
72 * as input informations straight from the device-tree (typically the results
73 * of the of_irq_map_*() functions.
74 */
75extern unsigned int irq_create_of_mapping(struct device_node *controller,
76 u32 *intspec, unsigned int intsize);
77
78#endif /* _ASM_MICROBLAZE_IRQ_H */ 54#endif /* _ASM_MICROBLAZE_IRQ_H */
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index e7d67a329bd7..e9fb2eb0035d 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -20,6 +20,7 @@
20#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/of_irq.h>
23#include <linux/of_fdt.h> 24#include <linux/of_fdt.h>
24#include <linux/proc_fs.h> 25#include <linux/proc_fs.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
@@ -92,18 +93,6 @@ extern const void *of_get_mac_address(struct device_node *np);
92 * OF interrupt mapping 93 * OF interrupt mapping
93 */ 94 */
94 95
95/* This structure is returned when an interrupt is mapped. The controller
96 * field needs to be put() after use
97 */
98
99#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
100
101struct of_irq {
102 struct device_node *controller; /* Interrupt controller node */
103 u32 size; /* Specifier size */
104 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
105};
106
107/** 96/**
108 * of_irq_map_init - Initialize the irq remapper 97 * of_irq_map_init - Initialize the irq remapper
109 * @flags: flags defining workarounds to enable 98 * @flags: flags defining workarounds to enable
@@ -139,19 +128,6 @@ extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
139 struct of_irq *out_irq); 128 struct of_irq *out_irq);
140 129
141/** 130/**
142 * of_irq_map_one - Resolve an interrupt for a device
143 * @device: the device whose interrupt is to be resolved
144 * @index: index of the interrupt to resolve
145 * @out_irq: structure of_irq filled by this function
146 *
147 * This function resolves an interrupt, walking the tree, for a given
148 * device-tree node. It's the high level pendant to of_irq_map_raw().
149 * It also implements the workarounds for OldWolrd Macs.
150 */
151extern int of_irq_map_one(struct device_node *device, int index,
152 struct of_irq *out_irq);
153
154/**
155 * of_irq_map_pci - Resolve the interrupt for a PCI device 131 * of_irq_map_pci - Resolve the interrupt for a PCI device
156 * @pdev: the device whose interrupt is to be resolved 132 * @pdev: the device whose interrupt is to be resolved
157 * @out_irq: structure of_irq filled by this function 133 * @out_irq: structure of_irq filled by this function
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c
index 8f120aca123d..dd32b09b4a3c 100644
--- a/arch/microblaze/kernel/irq.c
+++ b/arch/microblaze/kernel/irq.c
@@ -17,20 +17,10 @@
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18#include <linux/kernel_stat.h> 18#include <linux/kernel_stat.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/of_irq.h>
20 21
21#include <asm/prom.h> 22#include <asm/prom.h>
22 23
23unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
24{
25 struct of_irq oirq;
26
27 if (of_irq_map_one(dev, index, &oirq))
28 return NO_IRQ;
29
30 return oirq.specifier[0];
31}
32EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
33
34static u32 concurrent_irq; 24static u32 concurrent_irq;
35 25
36void __irq_entry do_IRQ(struct pt_regs *regs) 26void __irq_entry do_IRQ(struct pt_regs *regs)
@@ -104,7 +94,7 @@ unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq)
104EXPORT_SYMBOL_GPL(irq_create_mapping); 94EXPORT_SYMBOL_GPL(irq_create_mapping);
105 95
106unsigned int irq_create_of_mapping(struct device_node *controller, 96unsigned int irq_create_of_mapping(struct device_node *controller,
107 u32 *intspec, unsigned int intsize) 97 const u32 *intspec, unsigned int intsize)
108{ 98{
109 return intspec[0]; 99 return intspec[0];
110} 100}
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index e054baef1845..4e3051595b2b 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -300,34 +300,6 @@ extern unsigned int irq_alloc_virt(struct irq_host *host,
300 */ 300 */
301extern void irq_free_virt(unsigned int virq, unsigned int count); 301extern void irq_free_virt(unsigned int virq, unsigned int count);
302 302
303
304/* -- OF helpers -- */
305
306/**
307 * irq_create_of_mapping - Map a hardware interrupt into linux virq space
308 * @controller: Device node of the interrupt controller
309 * @inspec: Interrupt specifier from the device-tree
310 * @intsize: Size of the interrupt specifier from the device-tree
311 *
312 * This function is identical to irq_create_mapping except that it takes
313 * as input informations straight from the device-tree (typically the results
314 * of the of_irq_map_*() functions.
315 */
316extern unsigned int irq_create_of_mapping(struct device_node *controller,
317 const u32 *intspec, unsigned int intsize);
318
319/**
320 * irq_of_parse_and_map - Parse and Map an interrupt into linux virq space
321 * @device: Device node of the device whose interrupt is to be mapped
322 * @index: Index of the interrupt to map
323 *
324 * This function is a wrapper that chains of_irq_map_one() and
325 * irq_create_of_mapping() to make things easier to callers
326 */
327extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index);
328
329/* -- End OF helpers -- */
330
331/** 303/**
332 * irq_early_init - Init irq remapping subsystem 304 * irq_early_init - Init irq remapping subsystem
333 */ 305 */
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index ddd408a93b5a..47d41b67c94d 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -18,6 +18,7 @@
18 */ 18 */
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/of_fdt.h> 20#include <linux/of_fdt.h>
21#include <linux/of_irq.h>
21#include <linux/proc_fs.h> 22#include <linux/proc_fs.h>
22#include <linux/platform_device.h> 23#include <linux/platform_device.h>
23#include <asm/irq.h> 24#include <asm/irq.h>
@@ -108,18 +109,6 @@ extern const void *of_get_mac_address(struct device_node *np);
108 * OF interrupt mapping 109 * OF interrupt mapping
109 */ 110 */
110 111
111/* This structure is returned when an interrupt is mapped. The controller
112 * field needs to be put() after use
113 */
114
115#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
116
117struct of_irq {
118 struct device_node *controller; /* Interrupt controller node */
119 u32 size; /* Specifier size */
120 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
121};
122
123/** 112/**
124 * of_irq_map_init - Initialize the irq remapper 113 * of_irq_map_init - Initialize the irq remapper
125 * @flags: flags defining workarounds to enable 114 * @flags: flags defining workarounds to enable
@@ -154,20 +143,6 @@ extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
154 u32 ointsize, const u32 *addr, 143 u32 ointsize, const u32 *addr,
155 struct of_irq *out_irq); 144 struct of_irq *out_irq);
156 145
157
158/**
159 * of_irq_map_one - Resolve an interrupt for a device
160 * @device: the device whose interrupt is to be resolved
161 * @index: index of the interrupt to resolve
162 * @out_irq: structure of_irq filled by this function
163 *
164 * This function resolves an interrupt, walking the tree, for a given
165 * device-tree node. It's the high level pendant to of_irq_map_raw().
166 * It also implements the workarounds for OldWolrd Macs.
167 */
168extern int of_irq_map_one(struct device_node *device, int index,
169 struct of_irq *out_irq);
170
171/** 146/**
172 * of_irq_map_pci - Resolve the interrupt for a PCI device 147 * of_irq_map_pci - Resolve the interrupt for a PCI device
173 * @pdev: the device whose interrupt is to be resolved 148 * @pdev: the device whose interrupt is to be resolved
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 30817d9b20cb..2676ef288bf5 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -53,6 +53,8 @@
53#include <linux/bootmem.h> 53#include <linux/bootmem.h>
54#include <linux/pci.h> 54#include <linux/pci.h>
55#include <linux/debugfs.h> 55#include <linux/debugfs.h>
56#include <linux/of.h>
57#include <linux/of_irq.h>
56 58
57#include <asm/uaccess.h> 59#include <asm/uaccess.h>
58#include <asm/system.h> 60#include <asm/system.h>
@@ -813,18 +815,6 @@ unsigned int irq_create_of_mapping(struct device_node *controller,
813} 815}
814EXPORT_SYMBOL_GPL(irq_create_of_mapping); 816EXPORT_SYMBOL_GPL(irq_create_of_mapping);
815 817
816unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
817{
818 struct of_irq oirq;
819
820 if (of_irq_map_one(dev, index, &oirq))
821 return NO_IRQ;
822
823 return irq_create_of_mapping(oirq.controller, oirq.specifier,
824 oirq.size);
825}
826EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
827
828void irq_dispose_mapping(unsigned int virq) 818void irq_dispose_mapping(unsigned int virq)
829{ 819{
830 struct irq_host *host; 820 struct irq_host *host;
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index f845828ca4c6..ac695742df85 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -56,7 +56,6 @@ extern void of_fill_in_cpu_data(void);
56 * register them in the of_device objects, whereas powerpc computes them 56 * register them in the of_device objects, whereas powerpc computes them
57 * on request. 57 * on request.
58 */ 58 */
59extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
60static inline void irq_dispose_mapping(unsigned int virq) 59static inline void irq_dispose_mapping(unsigned int virq)
61{ 60{
62} 61}