18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 28c2ecf20Sopenharmony_ci# Copyright (C) 2020 SiFive, Inc. 38c2ecf20Sopenharmony_ci%YAML 1.2 48c2ecf20Sopenharmony_ci--- 58c2ecf20Sopenharmony_ci$id: http://devicetree.org/schemas/interrupt-controller/sifive,plic-1.0.0.yaml# 68c2ecf20Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml# 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_cititle: SiFive Platform-Level Interrupt Controller (PLIC) 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_cidescription: 118c2ecf20Sopenharmony_ci SiFive SOCs include an implementation of the Platform-Level Interrupt Controller 128c2ecf20Sopenharmony_ci (PLIC) high-level specification in the RISC-V Privileged Architecture 138c2ecf20Sopenharmony_ci specification. The PLIC connects all external interrupts in the system to all 148c2ecf20Sopenharmony_ci hart contexts in the system, via the external interrupt source in each hart. 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci A hart context is a privilege mode in a hardware execution thread. For example, 178c2ecf20Sopenharmony_ci in an 4 core system with 2-way SMT, you have 8 harts and probably at least two 188c2ecf20Sopenharmony_ci privilege modes per hart; machine mode and supervisor mode. 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci Each interrupt can be enabled on per-context basis. Any context can claim 218c2ecf20Sopenharmony_ci a pending enabled interrupt and then release it once it has been handled. 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci Each interrupt has a configurable priority. Higher priority interrupts are 248c2ecf20Sopenharmony_ci serviced first. Each context can specify a priority threshold. Interrupts 258c2ecf20Sopenharmony_ci with priority below this threshold will not cause the PLIC to raise its 268c2ecf20Sopenharmony_ci interrupt line leading to the context. 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci While the PLIC supports both edge-triggered and level-triggered interrupts, 298c2ecf20Sopenharmony_ci interrupt handlers are oblivious to this distinction and therefore it is not 308c2ecf20Sopenharmony_ci specified in the PLIC device-tree binding. 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci While the RISC-V ISA doesn't specify a memory layout for the PLIC, the 338c2ecf20Sopenharmony_ci "sifive,plic-1.0.0" device is a concrete implementation of the PLIC that 348c2ecf20Sopenharmony_ci contains a specific memory layout, which is documented in chapter 8 of the 358c2ecf20Sopenharmony_ci SiFive U5 Coreplex Series Manual <https://static.dev.sifive.com/U54-MC-RVCoreIP.pdf>. 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cimaintainers: 388c2ecf20Sopenharmony_ci - Sagar Kadam <sagar.kadam@sifive.com> 398c2ecf20Sopenharmony_ci - Paul Walmsley <paul.walmsley@sifive.com> 408c2ecf20Sopenharmony_ci - Palmer Dabbelt <palmer@dabbelt.com> 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciproperties: 438c2ecf20Sopenharmony_ci compatible: 448c2ecf20Sopenharmony_ci items: 458c2ecf20Sopenharmony_ci - const: sifive,fu540-c000-plic 468c2ecf20Sopenharmony_ci - const: sifive,plic-1.0.0 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci reg: 498c2ecf20Sopenharmony_ci maxItems: 1 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci '#address-cells': 528c2ecf20Sopenharmony_ci const: 0 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci '#interrupt-cells': 558c2ecf20Sopenharmony_ci const: 1 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci interrupt-controller: true 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci interrupts-extended: 608c2ecf20Sopenharmony_ci minItems: 1 618c2ecf20Sopenharmony_ci description: 628c2ecf20Sopenharmony_ci Specifies which contexts are connected to the PLIC, with "-1" specifying 638c2ecf20Sopenharmony_ci that a context is not present. Each node pointed to should be a 648c2ecf20Sopenharmony_ci riscv,cpu-intc node, which has a riscv node as parent. 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci riscv,ndev: 678c2ecf20Sopenharmony_ci $ref: "/schemas/types.yaml#/definitions/uint32" 688c2ecf20Sopenharmony_ci description: 698c2ecf20Sopenharmony_ci Specifies how many external interrupts are supported by this controller. 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_cirequired: 728c2ecf20Sopenharmony_ci - compatible 738c2ecf20Sopenharmony_ci - '#address-cells' 748c2ecf20Sopenharmony_ci - '#interrupt-cells' 758c2ecf20Sopenharmony_ci - interrupt-controller 768c2ecf20Sopenharmony_ci - reg 778c2ecf20Sopenharmony_ci - interrupts-extended 788c2ecf20Sopenharmony_ci - riscv,ndev 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ciadditionalProperties: false 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ciexamples: 838c2ecf20Sopenharmony_ci - | 848c2ecf20Sopenharmony_ci plic: interrupt-controller@c000000 { 858c2ecf20Sopenharmony_ci #address-cells = <0>; 868c2ecf20Sopenharmony_ci #interrupt-cells = <1>; 878c2ecf20Sopenharmony_ci compatible = "sifive,fu540-c000-plic", "sifive,plic-1.0.0"; 888c2ecf20Sopenharmony_ci interrupt-controller; 898c2ecf20Sopenharmony_ci interrupts-extended = < 908c2ecf20Sopenharmony_ci &cpu0_intc 11 918c2ecf20Sopenharmony_ci &cpu1_intc 11 &cpu1_intc 9 928c2ecf20Sopenharmony_ci &cpu2_intc 11 &cpu2_intc 9 938c2ecf20Sopenharmony_ci &cpu3_intc 11 &cpu3_intc 9 948c2ecf20Sopenharmony_ci &cpu4_intc 11 &cpu4_intc 9>; 958c2ecf20Sopenharmony_ci reg = <0xc000000 0x4000000>; 968c2ecf20Sopenharmony_ci riscv,ndev = <10>; 978c2ecf20Sopenharmony_ci }; 98