1# Copyright (c) 2019, Linaro Limited
2# SPDX-License-Identifier: Apache-2.0
3
4# Common fields for GPIO controllers
5
6properties:
7  "gpio-controller":
8    type: boolean
9    required: true
10    description: Convey's this node is a GPIO controller
11  "#gpio-cells":
12    type: int
13    required: true
14    description: Number of items to expect in a GPIO specifier
15  ngpios:
16    type: int
17    default: 32
18    description: |
19        This property indicates the number of in-use slots of available slots
20        for GPIOs. The typical example is something like this: the hardware
21        register is 32 bits wide, but only 18 of the bits have a physical
22        counterpart. The driver is generally written so that all 32 bits can
23        be used, but the IP block is reused in a lot of designs, some using
24        all 32 bits, some using 18 and some using 12. In this case, setting
25        "ngpios = <18>;" informs the driver that only the first 18 GPIOs, at
26        local offset 0 .. 17, are in use.  For cases in which there might be
27        holes in the slot range, this value should be the max slot number+1.
28  gpio-reserved-ranges:
29    type: array
30    description: |
31        If not all the GPIOs at offsets 0...N-1 are usable for ngpios = <N>, then
32        this property contains an additional set of tuples which specify which GPIOs
33        are unusable. This property indicates the start and size of the GPIOs
34        that can't be used.
35
36        For example, setting "gpio-reserved-ranges = <3 2>, <10 1>;" means that
37        GPIO offsets 3, 4, and 10 are not usable, even if ngpios = <18>.
38  gpio-line-names:
39    type: string-array
40    description: |
41        This is an array of strings defining the names of the GPIO lines
42        going out of the GPIO controller
43
44child-binding:
45  description: |
46    Optional GPIO hog configuration.
47
48    Each GPIO controller may contain GPIO hog definitions. GPIO hogging is a mechanism for
49    providing automatic GPIO configuration during driver initialization when Kconfig
50    CONFIG_GPIO_HOGS is enabled.
51
52    Each GPIO hog is represented as a child node of the GPIO controller.
53
54    Example:
55      &gpio1 {
56        mux-hog {
57          gpio-hog;
58          gpios = <10 GPIO_ACTIVE_HIGH>, <11 GPIO_ACTIVE_HIGH>;
59          output-high;
60        };
61      };
62
63      &gpio2 {
64        test-hog {
65          gpio-hog;
66          gpios = <26 GPIO_ACTIVE_HIGH>;
67          output-low;
68          line-name = "test";
69      };
70    };
71
72  properties:
73    gpio-hog:
74      type: boolean
75      required: true
76      description: |
77        Conveys this node is a GPIO hog.
78    gpios:
79      type: array
80      required: true
81      description: |
82        This is an array of GPIO specifiers (e.g. pin, flags) to be hogged. The number of array
83        entries must be an integer multiple of the number of GPIO specifier cells for the parent
84        GPIO controller.
85    input:
86      type: boolean
87      description: |
88        If this property is set, the GPIO is configured as an input. This property takes
89        precedence over the output-low and output-high properties.
90    output-low:
91      type: boolean
92      description: |
93        If this property is set, the GPIO is configured as an output set to logical low. This
94        property takes precedence over the output-high property.
95    output-high:
96      type: boolean
97      description: |
98        If this property is set, the GPIO is configured as an output set to logical high.
99    line-name:
100      type: string
101      description: |
102        Optional GPIO line name.
103