aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--drivers/of/Kconfig4
-rw-r--r--drivers/of/Makefile1
-rw-r--r--drivers/of/irq.c45
-rw-r--r--drivers/of/of_mdio.c1
-rw-r--r--drivers/of/of_spi.c1
-rw-r--r--include/linux/of_irq.h41
13 files changed, 99 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}
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 7cecc8fea9bd..b87495efa16e 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_IRQ
10 def_bool y
11 depends on OF && !SPARC
12
9config OF_DEVICE 13config OF_DEVICE
10 def_bool y 14 def_bool y
11 depends on OF && (SPARC || PPC_OF || MICROBLAZE) 15 depends on OF && (SPARC || PPC_OF || MICROBLAZE)
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index f232cc98ce00..3631a5ea0b47 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_IRQ) += irq.o
3obj-$(CONFIG_OF_DEVICE) += device.o platform.o 4obj-$(CONFIG_OF_DEVICE) += device.o platform.o
4obj-$(CONFIG_OF_GPIO) += gpio.o 5obj-$(CONFIG_OF_GPIO) += gpio.o
5obj-$(CONFIG_OF_I2C) += of_i2c.o 6obj-$(CONFIG_OF_I2C) += of_i2c.o
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
new file mode 100644
index 000000000000..9b3397c27096
--- /dev/null
+++ b/drivers/of/irq.c
@@ -0,0 +1,45 @@
1/*
2 * Derived from arch/i386/kernel/irq.c
3 * Copyright (C) 1992 Linus Torvalds
4 * Adapted from arch/i386 by Gary Thomas
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * Updated and modified by Cort Dougan <cort@fsmlabs.com>
7 * Copyright (C) 1996-2001 Cort Dougan
8 * Adapted for Power Macintosh by Paul Mackerras
9 * Copyright (C) 1996 Paul Mackerras (paulus@cs.anu.edu.au)
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 *
16 * This file contains the code used to make IRQ descriptions in the
17 * device tree to actual irq numbers on an interrupt controller
18 * driver.
19 */
20
21#include <linux/errno.h>
22#include <linux/module.h>
23#include <linux/of.h>
24#include <linux/of_irq.h>
25#include <linux/string.h>
26
27/**
28 * irq_of_parse_and_map - Parse and map an interrupt into linux virq space
29 * @device: Device node of the device whose interrupt is to be mapped
30 * @index: Index of the interrupt to map
31 *
32 * This function is a wrapper that chains of_irq_map_one() and
33 * irq_create_of_mapping() to make things easier to callers
34 */
35unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
36{
37 struct of_irq oirq;
38
39 if (of_irq_map_one(dev, index, &oirq))
40 return NO_IRQ;
41
42 return irq_create_of_mapping(oirq.controller, oirq.specifier,
43 oirq.size);
44}
45EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 42a6715f8e84..1fce00eb421b 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -15,6 +15,7 @@
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/phy.h> 16#include <linux/phy.h>
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/of_irq.h>
18#include <linux/of_mdio.h> 19#include <linux/of_mdio.h>
19#include <linux/module.h> 20#include <linux/module.h>
20 21
diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
index 5fed7e3c7da3..d504f1d1324b 100644
--- a/drivers/of/of_spi.c
+++ b/drivers/of/of_spi.c
@@ -9,6 +9,7 @@
9#include <linux/of.h> 9#include <linux/of.h>
10#include <linux/device.h> 10#include <linux/device.h>
11#include <linux/spi/spi.h> 11#include <linux/spi/spi.h>
12#include <linux/of_irq.h>
12#include <linux/of_spi.h> 13#include <linux/of_spi.h>
13 14
14/** 15/**
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
new file mode 100644
index 000000000000..0e37c05b7dd8
--- /dev/null
+++ b/include/linux/of_irq.h
@@ -0,0 +1,41 @@
1#ifndef __OF_IRQ_H
2#define __OF_IRQ_H
3
4#if defined(CONFIG_OF)
5struct of_irq;
6#include <linux/types.h>
7#include <linux/of.h>
8
9/*
10 * irq_of_parse_and_map() is used ba all OF enabled platforms; but SPARC
11 * implements it differently. However, the prototype is the same for all,
12 * so declare it here regardless of the CONFIG_OF_IRQ setting.
13 */
14extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
15
16#if defined(CONFIG_OF_IRQ)
17/**
18 * of_irq - container for device_node/irq_specifier pair for an irq controller
19 * @controller: pointer to interrupt controller device tree node
20 * @size: size of interrupt specifier
21 * @specifier: array of cells @size long specifing the specific interrupt
22 *
23 * This structure is returned when an interrupt is mapped. The controller
24 * field needs to be put() after use
25 */
26#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
27struct of_irq {
28 struct device_node *controller; /* Interrupt controller node */
29 u32 size; /* Specifier size */
30 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
31};
32
33extern int of_irq_map_one(struct device_node *device, int index,
34 struct of_irq *out_irq);
35extern unsigned int irq_create_of_mapping(struct device_node *controller,
36 const u32 *intspec,
37 unsigned int intsize);
38
39#endif /* CONFIG_OF_IRQ */
40#endif /* CONFIG_OF */
41#endif /* __OF_IRQ_H */