aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2012-05-30 06:18:58 -0400
committerSekhar Nori <nsekhar@ti.com>2012-07-05 04:42:35 -0400
commit961e657f5a34e3f4ce2cb74cfab11f5c666b03e5 (patch)
treecd1f4b2093aaf71bceb8b38aacbe6dc2fad25f2a
parentce9dcb8784611c50974d1c6b600c71f5c0a29308 (diff)
ARM: davinci: cp_intc: Add OF support for TI interrupt controller
Add a function to initialize the Common Platform Interrupt Controller (cp_intc) from TI used on OMAP-L1x SoCs using a device tree node. Signed-off-by: Heiko Schocher <hs@denx.de> Cc: davinci-linux-open-source@linux.davincidsp.com Cc: linux-arm-kernel@lists.infradead.org Cc: devicetree-discuss@lists.ozlabs.org Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Sekhar Nori <nsekhar@ti.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Sergei Shtylyov <sshtylyov@mvista.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
-rw-r--r--Documentation/devicetree/bindings/arm/davinci/cp-intc.txt27
-rw-r--r--arch/arm/mach-davinci/cp_intc.c16
-rw-r--r--arch/arm/mach-davinci/include/mach/cp_intc.h1
3 files changed, 41 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/arm/davinci/cp-intc.txt b/Documentation/devicetree/bindings/arm/davinci/cp-intc.txt
new file mode 100644
index 000000000000..597e8a089fe4
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/davinci/cp-intc.txt
@@ -0,0 +1,27 @@
1* TI Common Platform Interrupt Controller
2
3Common Platform Interrupt Controller (cp_intc) is used on
4OMAP-L1x SoCs and can support several configurable number
5of interrupts.
6
7Main node required properties:
8
9- compatible : should be:
10 "ti,cp-intc"
11- interrupt-controller : Identifies the node as an interrupt controller
12- #interrupt-cells : Specifies the number of cells needed to encode an
13 interrupt source. The type shall be a <u32> and the value shall be 1.
14
15 The cell contains the interrupt number in the range [0-128].
16- ti,intc-size: Number of interrupts handled by the interrupt controller.
17- reg: physical base address and size of the intc registers map.
18
19Example:
20
21 intc: interrupt-controller@1 {
22 compatible = "ti,cp-intc";
23 interrupt-controller;
24 #interrupt-cells = <1>;
25 ti,intc-size = <101>;
26 reg = <0xfffee000 0x2000>;
27 };
diff --git a/arch/arm/mach-davinci/cp_intc.c b/arch/arm/mach-davinci/cp_intc.c
index 45d52567ced7..006dae8dfe44 100644
--- a/arch/arm/mach-davinci/cp_intc.c
+++ b/arch/arm/mach-davinci/cp_intc.c
@@ -14,6 +14,9 @@
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/irqdomain.h> 15#include <linux/irqdomain.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/of.h>
18#include <linux/of_address.h>
19#include <linux/of_irq.h>
17 20
18#include <mach/common.h> 21#include <mach/common.h>
19#include <mach/cp_intc.h> 22#include <mach/cp_intc.h>
@@ -119,7 +122,7 @@ static const struct irq_domain_ops cp_intc_host_ops = {
119 .xlate = irq_domain_xlate_onetwocell, 122 .xlate = irq_domain_xlate_onetwocell,
120}; 123};
121 124
122int __init __cp_intc_init(struct device_node *node) 125int __init cp_intc_of_init(struct device_node *node, struct device_node *parent)
123{ 126{
124 u32 num_irq = davinci_soc_info.intc_irq_num; 127 u32 num_irq = davinci_soc_info.intc_irq_num;
125 u8 *irq_prio = davinci_soc_info.intc_irq_prios; 128 u8 *irq_prio = davinci_soc_info.intc_irq_prios;
@@ -128,7 +131,14 @@ int __init __cp_intc_init(struct device_node *node)
128 int i, irq_base; 131 int i, irq_base;
129 132
130 davinci_intc_type = DAVINCI_INTC_TYPE_CP_INTC; 133 davinci_intc_type = DAVINCI_INTC_TYPE_CP_INTC;
131 davinci_intc_base = ioremap(davinci_soc_info.intc_base, SZ_8K); 134 if (node) {
135 davinci_intc_base = of_iomap(node, 0);
136 if (of_property_read_u32(node, "ti,intc-size", &num_irq))
137 pr_warn("unable to get intc-size, default to %d\n",
138 num_irq);
139 } else {
140 davinci_intc_base = ioremap(davinci_soc_info.intc_base, SZ_8K);
141 }
132 if (WARN_ON(!davinci_intc_base)) 142 if (WARN_ON(!davinci_intc_base))
133 return -EINVAL; 143 return -EINVAL;
134 144
@@ -208,5 +218,5 @@ int __init __cp_intc_init(struct device_node *node)
208 218
209void __init cp_intc_init(void) 219void __init cp_intc_init(void)
210{ 220{
211 __cp_intc_init(NULL); 221 cp_intc_of_init(NULL, NULL);
212} 222}
diff --git a/arch/arm/mach-davinci/include/mach/cp_intc.h b/arch/arm/mach-davinci/include/mach/cp_intc.h
index 4e8190eed673..d13d8dfa2b0d 100644
--- a/arch/arm/mach-davinci/include/mach/cp_intc.h
+++ b/arch/arm/mach-davinci/include/mach/cp_intc.h
@@ -52,5 +52,6 @@
52#define CP_INTC_VECTOR_ADDR(n) (0x2000 + (n << 2)) 52#define CP_INTC_VECTOR_ADDR(n) (0x2000 + (n << 2))
53 53
54void __init cp_intc_init(void); 54void __init cp_intc_init(void);
55int __init cp_intc_of_init(struct device_node *, struct device_node *);
55 56
56#endif /* __ASM_HARDWARE_CP_INTC_H */ 57#endif /* __ASM_HARDWARE_CP_INTC_H */