xref: /linux/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml (revision 7fc2cd2e4b398c57c9cf961cfea05eadbf34c05c)
1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2# Copyright (C) 2020 SiFive, Inc.
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/interrupt-controller/sifive,plic-1.0.0.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: SiFive Platform-Level Interrupt Controller (PLIC)
9
10description:
11  SiFive SoCs and other RISC-V SoCs include an implementation of the
12  Platform-Level Interrupt Controller (PLIC) high-level specification in
13  the RISC-V Privileged Architecture specification. The PLIC connects all
14  external interrupts in the system to all hart contexts in the system, via
15  the external interrupt source in each hart.
16
17  A hart context is a privilege mode in a hardware execution thread. For example,
18  in an 4 core system with 2-way SMT, you have 8 harts and probably at least two
19  privilege modes per hart; machine mode and supervisor mode.
20
21  Each interrupt can be enabled on per-context basis. Any context can claim
22  a pending enabled interrupt and then release it once it has been handled.
23
24  Each interrupt has a configurable priority. Higher priority interrupts are
25  serviced first.  Each context can specify a priority threshold. Interrupts
26  with priority below this threshold will not cause the PLIC to raise its
27  interrupt line leading to the context.
28
29  The PLIC supports both edge-triggered and level-triggered interrupts. For
30  edge-triggered interrupts, the RISC-V PLIC spec allows two responses to edges
31  seen while an interrupt handler is active; the PLIC may either queue them or
32  ignore them. In the first case, handlers are oblivious to the trigger type, so
33  it is not included in the interrupt specifier. In the second case, software
34  needs to know the trigger type, so it can reorder the interrupt flow to avoid
35  missing interrupts. This special handling is needed by at least the Renesas
36  RZ/Five SoC (AX45MP AndesCore with a NCEPLIC100) and the T-HEAD C900 PLIC.
37
38  While the RISC-V ISA doesn't specify a memory layout for the PLIC, the
39  "sifive,plic-1.0.0" device is a concrete implementation of the PLIC that
40  contains a specific memory layout, which is documented in chapter 8 of the
41  SiFive U5 Coreplex Series Manual <https://static.dev.sifive.com/U54-MC-RVCoreIP.pdf>.
42
43  The thead,c900-plic is different from sifive,plic-1.0.0 in opensbi, the
44  T-HEAD PLIC implementation requires setting a delegation bit to allow access
45  from S-mode. So add thead,c900-plic to distinguish them.
46
47maintainers:
48  - Paul Walmsley  <paul.walmsley@sifive.com>
49  - Palmer Dabbelt <palmer@dabbelt.com>
50
51properties:
52  compatible:
53    oneOf:
54      - items:
55          - enum:
56              - andestech,qilai-plic
57              - renesas,r9a07g043-plic
58          - const: andestech,nceplic100
59      - items:
60          - enum:
61              - anlogic,dr1v90-plic
62              - canaan,k210-plic
63              - eswin,eic7700-plic
64              - sifive,fu540-c000-plic
65              - spacemit,k1-plic
66              - starfive,jh7100-plic
67              - starfive,jh7110-plic
68          - const: sifive,plic-1.0.0
69      - items:
70          - enum:
71              - allwinner,sun20i-d1-plic
72              - sophgo,cv1800b-plic
73              - sophgo,cv1812h-plic
74              - sophgo,sg2002-plic
75              - sophgo,sg2042-plic
76              - sophgo,sg2044-plic
77              - thead,th1520-plic
78          - const: thead,c900-plic
79      - items:
80          - const: ultrarisc,dp1000-plic
81          - const: ultrarisc,cp100-plic
82      - items:
83          - const: sifive,plic-1.0.0
84          - const: riscv,plic0
85        deprecated: true
86        description: For the QEMU virt machine only
87
88  reg:
89    maxItems: 1
90
91  '#address-cells':
92    const: 0
93
94  '#interrupt-cells': true
95
96  interrupt-controller: true
97
98  interrupts-extended:
99    minItems: 1
100    maxItems: 15872
101    description:
102      Specifies which contexts are connected to the PLIC, with "-1" specifying
103      that a context is not present. Each node pointed to should be a
104      riscv,cpu-intc node, which has a riscv node as parent.
105
106  riscv,ndev:
107    $ref: /schemas/types.yaml#/definitions/uint32
108    description:
109      Specifies how many external interrupts are supported by this controller.
110
111  clocks: true
112
113  power-domains: true
114
115  resets: true
116
117required:
118  - compatible
119  - '#address-cells'
120  - '#interrupt-cells'
121  - interrupt-controller
122  - reg
123  - interrupts-extended
124  - riscv,ndev
125
126allOf:
127  - if:
128      properties:
129        compatible:
130          contains:
131            enum:
132              - andestech,nceplic100
133              - thead,c900-plic
134
135    then:
136      properties:
137        '#interrupt-cells':
138          const: 2
139
140    else:
141      properties:
142        '#interrupt-cells':
143          const: 1
144
145  - if:
146      properties:
147        compatible:
148          contains:
149            const: renesas,r9a07g043-plic
150
151    then:
152      properties:
153        clocks:
154          maxItems: 1
155
156        power-domains:
157          maxItems: 1
158
159        resets:
160          maxItems: 1
161
162      required:
163        - clocks
164        - power-domains
165        - resets
166
167additionalProperties: false
168
169examples:
170  - |
171    plic: interrupt-controller@c000000 {
172      #address-cells = <0>;
173      #interrupt-cells = <1>;
174      compatible = "sifive,fu540-c000-plic", "sifive,plic-1.0.0";
175      interrupt-controller;
176      interrupts-extended = <&cpu0_intc 11>,
177                            <&cpu1_intc 11>, <&cpu1_intc 9>,
178                            <&cpu2_intc 11>, <&cpu2_intc 9>,
179                            <&cpu3_intc 11>, <&cpu3_intc 9>,
180                            <&cpu4_intc 11>, <&cpu4_intc 9>;
181      reg = <0xc000000 0x4000000>;
182      riscv,ndev = <10>;
183    };
184