1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2*4882a593Smuzhiyun# Copyright (C) 2020 SiFive, Inc.
3*4882a593Smuzhiyun%YAML 1.2
4*4882a593Smuzhiyun---
5*4882a593Smuzhiyun$id: http://devicetree.org/schemas/interrupt-controller/sifive,plic-1.0.0.yaml#
6*4882a593Smuzhiyun$schema: http://devicetree.org/meta-schemas/core.yaml#
7*4882a593Smuzhiyun
8*4882a593Smuzhiyuntitle: SiFive Platform-Level Interrupt Controller (PLIC)
9*4882a593Smuzhiyun
10*4882a593Smuzhiyundescription:
11*4882a593Smuzhiyun  SiFive SOCs include an implementation of the Platform-Level Interrupt Controller
12*4882a593Smuzhiyun  (PLIC) high-level specification in the RISC-V Privileged Architecture
13*4882a593Smuzhiyun  specification. The PLIC connects all external interrupts in the system to all
14*4882a593Smuzhiyun  hart contexts in the system, via the external interrupt source in each hart.
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun  A hart context is a privilege mode in a hardware execution thread. For example,
17*4882a593Smuzhiyun  in an 4 core system with 2-way SMT, you have 8 harts and probably at least two
18*4882a593Smuzhiyun  privilege modes per hart; machine mode and supervisor mode.
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun  Each interrupt can be enabled on per-context basis. Any context can claim
21*4882a593Smuzhiyun  a pending enabled interrupt and then release it once it has been handled.
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun  Each interrupt has a configurable priority. Higher priority interrupts are
24*4882a593Smuzhiyun  serviced first.  Each context can specify a priority threshold. Interrupts
25*4882a593Smuzhiyun  with priority below this threshold will not cause the PLIC to raise its
26*4882a593Smuzhiyun  interrupt line leading to the context.
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun  While the PLIC supports both edge-triggered and level-triggered interrupts,
29*4882a593Smuzhiyun  interrupt handlers are oblivious to this distinction and therefore it is not
30*4882a593Smuzhiyun  specified in the PLIC device-tree binding.
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun  While the RISC-V ISA doesn't specify a memory layout for the PLIC, the
33*4882a593Smuzhiyun  "sifive,plic-1.0.0" device is a concrete implementation of the PLIC that
34*4882a593Smuzhiyun  contains a specific memory layout, which is documented in chapter 8 of the
35*4882a593Smuzhiyun  SiFive U5 Coreplex Series Manual <https://static.dev.sifive.com/U54-MC-RVCoreIP.pdf>.
36*4882a593Smuzhiyun
37*4882a593Smuzhiyunmaintainers:
38*4882a593Smuzhiyun  - Sagar Kadam <sagar.kadam@sifive.com>
39*4882a593Smuzhiyun  - Paul Walmsley  <paul.walmsley@sifive.com>
40*4882a593Smuzhiyun  - Palmer Dabbelt <palmer@dabbelt.com>
41*4882a593Smuzhiyun
42*4882a593Smuzhiyunproperties:
43*4882a593Smuzhiyun  compatible:
44*4882a593Smuzhiyun    items:
45*4882a593Smuzhiyun      - const: sifive,fu540-c000-plic
46*4882a593Smuzhiyun      - const: sifive,plic-1.0.0
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun  reg:
49*4882a593Smuzhiyun    maxItems: 1
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun  '#address-cells':
52*4882a593Smuzhiyun    const: 0
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun  '#interrupt-cells':
55*4882a593Smuzhiyun    const: 1
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun  interrupt-controller: true
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun  interrupts-extended:
60*4882a593Smuzhiyun    minItems: 1
61*4882a593Smuzhiyun    description:
62*4882a593Smuzhiyun      Specifies which contexts are connected to the PLIC, with "-1" specifying
63*4882a593Smuzhiyun      that a context is not present. Each node pointed to should be a
64*4882a593Smuzhiyun      riscv,cpu-intc node, which has a riscv node as parent.
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun  riscv,ndev:
67*4882a593Smuzhiyun    $ref: "/schemas/types.yaml#/definitions/uint32"
68*4882a593Smuzhiyun    description:
69*4882a593Smuzhiyun      Specifies how many external interrupts are supported by this controller.
70*4882a593Smuzhiyun
71*4882a593Smuzhiyunrequired:
72*4882a593Smuzhiyun  - compatible
73*4882a593Smuzhiyun  - '#address-cells'
74*4882a593Smuzhiyun  - '#interrupt-cells'
75*4882a593Smuzhiyun  - interrupt-controller
76*4882a593Smuzhiyun  - reg
77*4882a593Smuzhiyun  - interrupts-extended
78*4882a593Smuzhiyun  - riscv,ndev
79*4882a593Smuzhiyun
80*4882a593SmuzhiyunadditionalProperties: false
81*4882a593Smuzhiyun
82*4882a593Smuzhiyunexamples:
83*4882a593Smuzhiyun  - |
84*4882a593Smuzhiyun    plic: interrupt-controller@c000000 {
85*4882a593Smuzhiyun      #address-cells = <0>;
86*4882a593Smuzhiyun      #interrupt-cells = <1>;
87*4882a593Smuzhiyun      compatible = "sifive,fu540-c000-plic", "sifive,plic-1.0.0";
88*4882a593Smuzhiyun      interrupt-controller;
89*4882a593Smuzhiyun      interrupts-extended = <
90*4882a593Smuzhiyun        &cpu0_intc 11
91*4882a593Smuzhiyun        &cpu1_intc 11 &cpu1_intc 9
92*4882a593Smuzhiyun        &cpu2_intc 11 &cpu2_intc 9
93*4882a593Smuzhiyun        &cpu3_intc 11 &cpu3_intc 9
94*4882a593Smuzhiyun        &cpu4_intc 11 &cpu4_intc 9>;
95*4882a593Smuzhiyun      reg = <0xc000000 0x4000000>;
96*4882a593Smuzhiyun      riscv,ndev = <10>;
97*4882a593Smuzhiyun    };
98