xref: /linux/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml (revision 3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d)
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              - microchip,pic64gx-plic
65              - sifive,fu540-c000-plic
66              - spacemit,k1-plic
67              - starfive,jh7100-plic
68              - starfive,jh7110-plic
69              - starfive,jhb100-plic
70              - tenstorrent,blackhole-plic
71          - const: sifive,plic-1.0.0
72      - items:
73          - enum:
74              - allwinner,sun20i-d1-plic
75              - canaan,k230-plic
76              - sophgo,cv1800b-plic
77              - sophgo,cv1812h-plic
78              - sophgo,sg2000-plic
79              - sophgo,sg2002-plic
80              - sophgo,sg2042-plic
81              - sophgo,sg2044-plic
82              - thead,th1520-plic
83          - const: thead,c900-plic
84      - items:
85          - const: ultrarisc,dp1000-plic
86          - const: ultrarisc,cp100-plic
87      - items:
88          - const: sifive,plic-1.0.0
89          - const: riscv,plic0
90        deprecated: true
91        description: For the QEMU virt machine only
92
93  reg:
94    maxItems: 1
95
96  '#address-cells':
97    const: 0
98
99  '#interrupt-cells': true
100
101  interrupt-controller: true
102
103  interrupts-extended:
104    minItems: 1
105    maxItems: 15872
106    description:
107      Specifies which contexts are connected to the PLIC, with "-1" specifying
108      that a context is not present. Each node pointed to should be a
109      riscv,cpu-intc node, which has a riscv node as parent.
110
111  riscv,ndev:
112    $ref: /schemas/types.yaml#/definitions/uint32
113    description:
114      Specifies how many external (device) interrupts are supported by this
115      controller.  Note that source 0 is reserved in PLIC, so the valid
116      interrupt sources are 1 to riscv,ndev inclusive.
117
118  clocks: true
119
120  power-domains: true
121
122  resets: true
123
124required:
125  - compatible
126  - '#address-cells'
127  - '#interrupt-cells'
128  - interrupt-controller
129  - reg
130  - interrupts-extended
131  - riscv,ndev
132
133allOf:
134  - if:
135      properties:
136        compatible:
137          contains:
138            enum:
139              - andestech,nceplic100
140              - thead,c900-plic
141
142    then:
143      properties:
144        '#interrupt-cells':
145          const: 2
146
147    else:
148      properties:
149        '#interrupt-cells':
150          const: 1
151
152  - if:
153      properties:
154        compatible:
155          contains:
156            const: renesas,r9a07g043-plic
157
158    then:
159      properties:
160        clocks:
161          maxItems: 1
162
163        power-domains:
164          maxItems: 1
165
166        resets:
167          maxItems: 1
168
169      required:
170        - clocks
171        - power-domains
172        - resets
173
174additionalProperties: false
175
176examples:
177  - |
178    plic: interrupt-controller@c000000 {
179      #address-cells = <0>;
180      #interrupt-cells = <1>;
181      compatible = "sifive,fu540-c000-plic", "sifive,plic-1.0.0";
182      interrupt-controller;
183      interrupts-extended = <&cpu0_intc 11>,
184                            <&cpu1_intc 11>, <&cpu1_intc 9>,
185                            <&cpu2_intc 11>, <&cpu2_intc 9>,
186                            <&cpu3_intc 11>, <&cpu3_intc 9>,
187                            <&cpu4_intc 11>, <&cpu4_intc 9>;
188      reg = <0xc000000 0x4000000>;
189      riscv,ndev = <10>;
190    };
191