Skip to contentSkip to conversation

Document: devicetree: add OF documents for MIPS interrupt controller

PATCH In review John Crispin 2 participants 4 messages Jan 31, 2013 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Document: devicetree: add OF documents for MIPS interrupt controller

---
 Documentation/devicetree/bindings/mips/cpu_irq.txt |   47 ++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mips/cpu_irq.txt
Documentation/devicetree/bindings/mips/cpu_irq.txt new file +47 -0
new file mode 100644
index 0000000..13aa4b6
@@ -0,0 +1,47 @@
+MIPS CPU interrupt controller
+
+On MIPS the mips_cpu_intc_init() helper can be used to initialize the 8 CPU
+IRQs from a devicetree file and create a irq_domain for IRQ controller.
+
+With the irq_domain in place we can describe how the 8 IRQs are wired to the
+platforms internal interrupt controller cascade.
+
+Below is an example of a platform describing the cascade inside the devicetree
+and the code used to load it inside arch_init_irq().
+
+Required properties:
+- compatible : Should be "mti,cpu-interrupt-controller"
+
+Example devicetree:
+	cpu-irq: cpu-irq@0 {
+		#address-cells = <0>;
+
+		interrupt-controller;
+		#interrupt-cells = <1>;
+
+		compatible = "mti,cpu-interrupt-controller";
+	};
+
+	intc: intc@200 {
+		compatible = "ralink,rt2880-intc";
+		reg = <0x200 0x100>;
+
+		interrupt-controller;
+		#interrupt-cells = <1>;
+
+		interrupt-parent = <&cpu-irq>;
+		interrupts = <2>;
+	};
+
+
+Example platform irq.c:
+static struct of_device_id __initdata of_irq_ids[] = {
+	{ .compatible = "mti,cpu-interrupt-controller", .data = mips_cpu_intc_init },
+	{ .compatible = "ralink,rt2880-intc", .data = intc_of_init },
+	{},
+};
+
+void __init arch_init_irq(void)
+{
+	of_irq_init(of_irq_ids);
+}
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/3 MIPS: add irqdomain support for the CPU IRQ controller

From: Gabor Juhos <[email protected]>

Add code to load a irq_domain for the MIPS IRQ controller from a devicetree file.

---
 arch/mips/include/asm/irq_cpu.h |    6 ++++++
 arch/mips/kernel/irq_cpu.c      |   42 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
arch/mips/include/asm/irq_cpu.h +6 -0
index ef6a07c..3f11fdb 100644
@@ -17,4 +17,10 @@ extern void mips_cpu_irq_init(void);
 extern void rm7k_cpu_irq_init(void);
 extern void rm9k_cpu_irq_init(void);
 
+#ifdef CONFIG_IRQ_DOMAIN
+struct device_node;
+extern int mips_cpu_intc_init(struct device_node *of_node,
+			      struct device_node *parent);
+#endif
+
 #endif /* _ASM_IRQ_CPU_H */
arch/mips/kernel/irq_cpu.c +42 -0

51 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 3/3 MIPS: ralink: add CPU interrupt controller to of_irq_ids

In reply to John Crispin

From: Gabor Juhos <[email protected]>

Convert the ralink IRQ code to make use of the new MIPS IRQ controller OF mappings.

---
 arch/mips/ralink/dts/rt305x.dts |   10 ++++++++++
 arch/mips/ralink/irq.c          |   10 +++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)
arch/mips/ralink/dts/rt305x.dts +10 -0
index c7298f3..a9acdb2 100644
@@ -11,6 +11,13 @@
 		};
 	};
 
+	cpuintc: cpuintc@0 {
+		#address-cells = <0>;
+		#interrupt-cells = <1>;
+		interrupt-controller;
+		compatible = "mti,cpu-interrupt-controller";
+	};
+
 	memory@0 {
 		reg = <0x0 0x2000000>;
 	};
@@ -47,6 +54,9 @@
 
 			interrupt-controller;
 			#interrupt-cells = <1>;
+
+			interrupt-parent = <&cpuintc>;
+			interrupts = <2>;
 		};
 
 		memc@300 {
arch/mips/ralink/irq.c +7 -3
index e62c975..6d054c5 100644
@@ -128,8 +128,11 @@ static int __init intc_of_init(struct device_node *node,
 {
 	struct resource res;
 	struct irq_domain *domain;
+	int irq;
 
-	mips_cpu_irq_init();
+	irq = irq_of_parse_and_map(node, 0);
+	if (!irq)
+		panic("Failed to get INTC IRQ");
 
 	if (of_address_to_resource(node, 0, &res))
 		panic("Failed to get intc memory range");
@@ -156,8 +159,8 @@ static int __init intc_of_init(struct device_node *node,
 
 	rt_intc_w32(INTC_INT_GLOBAL, INTC_REG_ENABLE);
 
-	irq_set_chained_handler(RALINK_CPU_IRQ_INTC, ralink_intc_irq_handler);
-	irq_set_handler_data(RALINK_CPU_IRQ_INTC, domain);
+	irq_set_chained_handler(irq, ralink_intc_irq_handler);
+	irq_set_handler_data(irq, domain);
 
 	cp0_perfcount_irq = irq_create_mapping(domain, 9);
 
@@ -165,6 +168,7 @@ static int __init intc_of_init(struct device_node *node,
 }
 
 static struct of_device_id __initdata of_irq_ids[] = {
+	{ .compatible = "mti,cpu-interrupt-controller", .data = mips_cpu_intc_init },
 	{ .compatible = "ralink,rt2880-intc", .data = intc_of_init },
 	{},
 };
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 1359638444-8891-1-git-send-email-blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org

Acked-by
#4 lore raw
Quoted 1 line · John Crispin
Quoted 59 lines
---
  Documentation/devicetree/bindings/mips/cpu_irq.txt |   47 ++++++++++++++++++++
  1 file changed, 47 insertions(+)

create mode 100644 Documentation/devicetree/bindings/mips/cpu_irq.txt

Documentation/devicetree/bindings/mips/cpu_irq.txt new file +47 -0
new file mode 100644
index 0000000..13aa4b6
@@ -0,0 +1,47 @@
+MIPS CPU interrupt controller
+
+On MIPS the mips_cpu_intc_init() helper can be used to initialize the 8 CPU
+IRQs from a devicetree file and create a irq_domain for IRQ controller.
+
+With the irq_domain in place we can describe how the 8 IRQs are wired to the
+platforms internal interrupt controller cascade.
+
+Below is an example of a platform describing the cascade inside the devicetree
+and the code used to load it inside arch_init_irq().
+
+Required properties:
+- compatible : Should be "mti,cpu-interrupt-controller"
+
+Example devicetree:
+	cpu-irq: cpu-irq@0 {
+		#address-cells = <0>;
+
+		interrupt-controller;
+		#interrupt-cells = <1>;
+
+		compatible = "mti,cpu-interrupt-controller";
+	};
+
+	intc: intc@200 {
+		compatible = "ralink,rt2880-intc";
+		reg = <0x200 0x100>;
+
+		interrupt-controller;
+		#interrupt-cells = <1>;
+
+		interrupt-parent = <&cpu-irq>;
+		interrupts = <2>;
+	};
+
+
+Example platform irq.c:
+static struct of_device_id __initdata of_irq_ids[] = {
+	{ .compatible = "mti,cpu-interrupt-controller", .data = mips_cpu_intc_init },
+	{ .compatible = "ralink,rt2880-intc", .data = intc_of_init },
+	{},
+};
+
+void __init arch_init_irq(void)
+{
+	of_irq_init(of_irq_ids);
+}