xref: /linux/Documentation/devicetree/bindings/gpio/sifive,gpio.yaml (revision 52a9dab6d892763b2a8334a568bd4e2c1a6fde66)
1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/gpio/sifive,gpio.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: SiFive GPIO controller
8
9maintainers:
10  - Yash Shah <yash.shah@sifive.com>
11  - Paul Walmsley <paul.walmsley@sifive.com>
12
13properties:
14  compatible:
15    items:
16      - enum:
17          - sifive,fu540-c000-gpio
18          - sifive,fu740-c000-gpio
19          - canaan,k210-gpiohs
20      - const: sifive,gpio0
21
22  reg:
23    maxItems: 1
24
25  interrupts:
26    description:
27      Interrupt mapping, one per GPIO. Maximum 32 GPIOs.
28    minItems: 1
29    maxItems: 32
30
31  interrupt-controller: true
32
33  "#interrupt-cells":
34    const: 2
35
36  clocks:
37    maxItems: 1
38
39  "#gpio-cells":
40    const: 2
41
42  ngpios:
43    description:
44      The number of GPIOs available on the controller implementation.
45      It is 16 for the SiFive SoCs and 32 for the Canaan K210.
46    minimum: 1
47    maximum: 32
48    default: 16
49
50  gpio-controller: true
51
52required:
53  - compatible
54  - reg
55  - interrupts
56  - interrupt-controller
57  - "#interrupt-cells"
58  - "#gpio-cells"
59  - gpio-controller
60
61if:
62  properties:
63    compatible:
64      contains:
65        enum:
66          - sifive,fu540-c000-gpio
67          - sifive,fu740-c000-gpio
68then:
69  required:
70    - clocks
71
72additionalProperties: false
73
74examples:
75  - |
76      #include <dt-bindings/clock/sifive-fu540-prci.h>
77      gpio@10060000 {
78        compatible = "sifive,fu540-c000-gpio", "sifive,gpio0";
79        interrupt-parent = <&plic>;
80        interrupts = <7>, <8>, <9>, <10>, <11>, <12>, <13>, <14>, <15>, <16>,
81                     <17>, <18>, <19>, <20>, <21>, <22>;
82        reg = <0x10060000 0x1000>;
83        clocks = <&tlclk PRCI_CLK_TLCLK>;
84        gpio-controller;
85        #gpio-cells = <2>;
86        interrupt-controller;
87        #interrupt-cells = <2>;
88      };
89
90...
91