xref: /openbmc/linux/Documentation/devicetree/bindings/gpio/gpio-mmio.yaml (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
1*1c23553aSSean Anderson# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*1c23553aSSean Anderson%YAML 1.2
3*1c23553aSSean Anderson---
4*1c23553aSSean Anderson$id: http://devicetree.org/schemas/gpio/gpio-mmio.yaml#
5*1c23553aSSean Anderson$schema: http://devicetree.org/meta-schemas/core.yaml#
6*1c23553aSSean Anderson
7*1c23553aSSean Andersontitle: Generic MMIO GPIO
8*1c23553aSSean Anderson
9*1c23553aSSean Andersonmaintainers:
10*1c23553aSSean Anderson  - Linus Walleij <linus.walleij@linaro.org>
11*1c23553aSSean Anderson  - Bartosz Golaszewski <brgl@bgdev.pl>
12*1c23553aSSean Anderson
13*1c23553aSSean Andersondescription:
14*1c23553aSSean Anderson  Some simple GPIO controllers may consist of a single data register or a pair
15*1c23553aSSean Anderson  of set/clear-bit registers. Such controllers are common for glue logic in
16*1c23553aSSean Anderson  FPGAs or ASICs. Commonly, these controllers are accessed over memory-mapped
17*1c23553aSSean Anderson  NAND-style parallel busses.
18*1c23553aSSean Anderson
19*1c23553aSSean Andersonproperties:
20*1c23553aSSean Anderson  compatible:
21*1c23553aSSean Anderson    enum:
22*1c23553aSSean Anderson      - brcm,bcm6345-gpio
23*1c23553aSSean Anderson      - ni,169445-nand-gpio
24*1c23553aSSean Anderson      - wd,mbl-gpio # Western Digital MyBook Live memory-mapped GPIO controller
25*1c23553aSSean Anderson
26*1c23553aSSean Anderson  big-endian: true
27*1c23553aSSean Anderson
28*1c23553aSSean Anderson  '#gpio-cells':
29*1c23553aSSean Anderson    const: 2
30*1c23553aSSean Anderson
31*1c23553aSSean Anderson  gpio-controller: true
32*1c23553aSSean Anderson
33*1c23553aSSean Anderson  little-endian: true
34*1c23553aSSean Anderson
35*1c23553aSSean Anderson  reg:
36*1c23553aSSean Anderson    minItems: 1
37*1c23553aSSean Anderson    description:
38*1c23553aSSean Anderson      A list of registers in the controller. The width of each register is
39*1c23553aSSean Anderson      determined by its size. All registers must have the same width. The number
40*1c23553aSSean Anderson      of GPIOs is set by the width, with bit 0 corresponding to GPIO 0.
41*1c23553aSSean Anderson    items:
42*1c23553aSSean Anderson      - description:
43*1c23553aSSean Anderson          Register to READ the value of the GPIO lines. If GPIO line is high,
44*1c23553aSSean Anderson          the bit will be set. If the GPIO line is low, the bit will be cleared.
45*1c23553aSSean Anderson          This register may also be used to drive GPIOs if the SET register is
46*1c23553aSSean Anderson          omitted.
47*1c23553aSSean Anderson      - description:
48*1c23553aSSean Anderson          Register to SET the value of the GPIO lines. Setting a bit in this
49*1c23553aSSean Anderson          register will drive the GPIO line high.
50*1c23553aSSean Anderson      - description:
51*1c23553aSSean Anderson          Register to CLEAR the value of the GPIO lines. Setting a bit in this
52*1c23553aSSean Anderson          register will drive the GPIO line low. If this register is omitted,
53*1c23553aSSean Anderson          the SET register will be used to clear the GPIO lines as well, by
54*1c23553aSSean Anderson          actively writing the line with 0.
55*1c23553aSSean Anderson      - description:
56*1c23553aSSean Anderson          Register to set the line as OUTPUT. Setting a bit in this register
57*1c23553aSSean Anderson          will turn that line into an output line. Conversely, clearing a bit
58*1c23553aSSean Anderson          will turn that line into an input.
59*1c23553aSSean Anderson      - description:
60*1c23553aSSean Anderson          Register to set this line as INPUT. Setting a bit in this register
61*1c23553aSSean Anderson          will turn that line into an input line. Conversely, clearing a bit
62*1c23553aSSean Anderson          will turn that line into an output.
63*1c23553aSSean Anderson
64*1c23553aSSean Anderson  reg-names:
65*1c23553aSSean Anderson    minItems: 1
66*1c23553aSSean Anderson    maxItems: 5
67*1c23553aSSean Anderson    items:
68*1c23553aSSean Anderson      enum:
69*1c23553aSSean Anderson        - dat
70*1c23553aSSean Anderson        - set
71*1c23553aSSean Anderson        - clr
72*1c23553aSSean Anderson        - dirout
73*1c23553aSSean Anderson        - dirin
74*1c23553aSSean Anderson
75*1c23553aSSean Anderson  native-endian: true
76*1c23553aSSean Anderson
77*1c23553aSSean Anderson  no-output:
78*1c23553aSSean Anderson    $ref: /schemas/types.yaml#/definitions/flag
79*1c23553aSSean Anderson    description:
80*1c23553aSSean Anderson      If this property is present, the controller cannot drive the GPIO lines.
81*1c23553aSSean Anderson
82*1c23553aSSean Andersonrequired:
83*1c23553aSSean Anderson  - compatible
84*1c23553aSSean Anderson  - reg
85*1c23553aSSean Anderson  - reg-names
86*1c23553aSSean Anderson  - '#gpio-cells'
87*1c23553aSSean Anderson  - gpio-controller
88*1c23553aSSean Anderson
89*1c23553aSSean AndersonadditionalProperties: false
90*1c23553aSSean Anderson
91*1c23553aSSean Andersonexamples:
92*1c23553aSSean Anderson  - |
93*1c23553aSSean Anderson    gpio@1f300010 {
94*1c23553aSSean Anderson      compatible = "ni,169445-nand-gpio";
95*1c23553aSSean Anderson      reg = <0x1f300010 0x4>;
96*1c23553aSSean Anderson      reg-names = "dat";
97*1c23553aSSean Anderson      gpio-controller;
98*1c23553aSSean Anderson      #gpio-cells = <2>;
99*1c23553aSSean Anderson    };
100*1c23553aSSean Anderson
101*1c23553aSSean Anderson    gpio@e0100000 {
102*1c23553aSSean Anderson      compatible = "wd,mbl-gpio";
103*1c23553aSSean Anderson      reg-names = "dat";
104*1c23553aSSean Anderson      reg = <0xe0100000 0x1>;
105*1c23553aSSean Anderson      #gpio-cells = <2>;
106*1c23553aSSean Anderson      gpio-controller;
107*1c23553aSSean Anderson      no-output;
108*1c23553aSSean Anderson    };
109*1c23553aSSean Anderson
110*1c23553aSSean Anderson    gpio@fffe0406 {
111*1c23553aSSean Anderson      compatible = "brcm,bcm6345-gpio";
112*1c23553aSSean Anderson      reg-names = "dirout", "dat";
113*1c23553aSSean Anderson      reg = <0xfffe0406 2>, <0xfffe040a 2>;
114*1c23553aSSean Anderson      native-endian;
115*1c23553aSSean Anderson      gpio-controller;
116*1c23553aSSean Anderson      #gpio-cells = <2>;
117*1c23553aSSean Anderson    };
118