summaryrefslogtreecommitdiff
path: root/Documentation/devicetree/bindings/gpio/gpio-mmio.yaml
blob: b4d55bf6a28548534f35ca8af22d18a596c6d2b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/gpio/gpio-mmio.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Generic MMIO GPIO

maintainers:
  - Linus Walleij <linus.walleij@linaro.org>
  - Bartosz Golaszewski <brgl@bgdev.pl>

description:
  Some simple GPIO controllers may consist of a single data register or a pair
  of set/clear-bit registers. Such controllers are common for glue logic in
  FPGAs or ASICs. Commonly, these controllers are accessed over memory-mapped
  NAND-style parallel busses.

properties:
  compatible:
    enum:
      - brcm,bcm6345-gpio
      - ni,169445-nand-gpio
      - wd,mbl-gpio # Western Digital MyBook Live memory-mapped GPIO controller
      - intel,ixp4xx-expansion-bus-mmio-gpio

  big-endian: true

  '#gpio-cells':
    const: 2

  gpio-controller: true

  little-endian: true

  reg:
    minItems: 1
    description:
      A list of registers in the controller. The width of each register is
      determined by its size. All registers must have the same width. The number
      of GPIOs is set by the width, with bit 0 corresponding to GPIO 0, unless
      the ngpios property further restricts the number of used lines.
    items:
      - description:
          Register to READ the value of the GPIO lines. If GPIO line is high,
          the bit will be set. If the GPIO line is low, the bit will be cleared.
          This register may also be used to drive GPIOs if the SET register is
          omitted.
      - description:
          Register to SET the value of the GPIO lines. Setting a bit in this
          register will drive the GPIO line high.
      - description:
          Register to CLEAR the value of the GPIO lines. Setting a bit in this
          register will drive the GPIO line low. If this register is omitted,
          the SET register will be used to clear the GPIO lines as well, by
          actively writing the line with 0.
      - description:
          Register to set the line as OUTPUT. Setting a bit in this register
          will turn that line into an output line. Conversely, clearing a bit
          will turn that line into an input.
      - description:
          Register to set this line as INPUT. Setting a bit in this register
          will turn that line into an input line. Conversely, clearing a bit
          will turn that line into an output.

  reg-names:
    minItems: 1
    maxItems: 5
    items:
      enum:
        - dat
        - set
        - clr
        - dirout
        - dirin

  native-endian: true

  ngpios:
    minimum: 1
    maximum: 63
    description:
      If this property is present the number of usable GPIO lines are restricted
      to the first 0 .. ngpios lines. This is useful when the GPIO MMIO register
      has 32 bits for GPIO but only the first 12 are actually connected to
      real electronics, and then we set ngpios to 12.

  no-output:
    $ref: /schemas/types.yaml#/definitions/flag
    description:
      If this property is present, the controller cannot drive the GPIO lines.

if:
  properties:
    compatible:
      contains:
        const: intel,ixp4xx-expansion-bus-mmio-gpio
then:
  $ref: /schemas/memory-controllers/intel,ixp4xx-expansion-peripheral-props.yaml#

patternProperties:
  "^.+-hog(-[0-9]+)?$":
    type: object
    required:
      - gpio-hog

required:
  - compatible
  - reg
  - reg-names
  - '#gpio-cells'
  - gpio-controller

unevaluatedProperties: false

examples:
  - |
    gpio@1f300010 {
      compatible = "ni,169445-nand-gpio";
      reg = <0x1f300010 0x4>;
      reg-names = "dat";
      gpio-controller;
      #gpio-cells = <2>;
    };

    gpio@e0100000 {
      compatible = "wd,mbl-gpio";
      reg-names = "dat";
      reg = <0xe0100000 0x1>;
      #gpio-cells = <2>;
      gpio-controller;
      no-output;
    };

    gpio@fffe0406 {
      compatible = "brcm,bcm6345-gpio";
      reg-names = "dirout", "dat";
      reg = <0xfffe0406 2>, <0xfffe040a 2>;
      ngpios = <15>;
      native-endian;
      gpio-controller;
      #gpio-cells = <2>;
    };

    bus@c4000000 {
        compatible = "intel,ixp42x-expansion-bus-controller", "syscon";
        reg = <0xc4000000 0x30>;
        native-endian;
        #address-cells = <2>;
        #size-cells = <1>;
        ranges = <0 0x0 0x50000000 0x01000000>;
        dma-ranges = <0 0x0 0x50000000 0x01000000>;
        gpio@1,0 {
            compatible = "intel,ixp4xx-expansion-bus-mmio-gpio";
            gpio-controller;
            #gpio-cells = <2>;
            big-endian;
            reg = <1 0x00000000 0x2>;
            reg-names = "dat";
            intel,ixp4xx-eb-write-enable = <1>;
        };
    };