6a07d8de0395e25fd81a6f3434e1aaebc48a2a72
[openwrt.git] / target / linux / ramips / patches-3.8 / 0012-Document-devicetree-add-OF-documents-for-MIPS-interr.patch
1 From dcc7310e144c3bf17a86d2f058d60fb525d4b34a Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Thu, 31 Jan 2013 13:44:10 +0100
4 Subject: [PATCH 12/14] Document: devicetree: add OF documents for MIPS
5  interrupt controller
6
7 Signed-off-by: John Crispin <blogic@openwrt.org>
8 Acked-by: David Daney <david.daney@cavium.com>
9 Patchwork: http://patchwork.linux-mips.org/patch/4901/
10 ---
11  Documentation/devicetree/bindings/mips/cpu_irq.txt |   47 ++++++++++++++++++++
12  1 file changed, 47 insertions(+)
13  create mode 100644 Documentation/devicetree/bindings/mips/cpu_irq.txt
14
15 --- /dev/null
16 +++ b/Documentation/devicetree/bindings/mips/cpu_irq.txt
17 @@ -0,0 +1,47 @@
18 +MIPS CPU interrupt controller
19 +
20 +On MIPS the mips_cpu_intc_init() helper can be used to initialize the 8 CPU
21 +IRQs from a devicetree file and create a irq_domain for IRQ controller.
22 +
23 +With the irq_domain in place we can describe how the 8 IRQs are wired to the
24 +platforms internal interrupt controller cascade.
25 +
26 +Below is an example of a platform describing the cascade inside the devicetree
27 +and the code used to load it inside arch_init_irq().
28 +
29 +Required properties:
30 +- compatible : Should be "mti,cpu-interrupt-controller"
31 +
32 +Example devicetree:
33 +       cpu-irq: cpu-irq@0 {
34 +               #address-cells = <0>;
35 +
36 +               interrupt-controller;
37 +               #interrupt-cells = <1>;
38 +
39 +               compatible = "mti,cpu-interrupt-controller";
40 +       };
41 +
42 +       intc: intc@200 {
43 +               compatible = "ralink,rt2880-intc";
44 +               reg = <0x200 0x100>;
45 +
46 +               interrupt-controller;
47 +               #interrupt-cells = <1>;
48 +
49 +               interrupt-parent = <&cpu-irq>;
50 +               interrupts = <2>;
51 +       };
52 +
53 +
54 +Example platform irq.c:
55 +static struct of_device_id __initdata of_irq_ids[] = {
56 +       { .compatible = "mti,cpu-interrupt-controller", .data = mips_cpu_intc_init },
57 +       { .compatible = "ralink,rt2880-intc", .data = intc_of_init },
58 +       {},
59 +};
60 +
61 +void __init arch_init_irq(void)
62 +{
63 +       of_irq_init(of_irq_ids);
64 +}