xref: /freebsd/sys/contrib/device-tree/Bindings/gpio/socionext,uniphier-gpio.yaml (revision d5b0e70f7e04d971691517ce1304d86a1e367e2e)
1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2c66ec88fSEmmanuel Vadot%YAML 1.2
3c66ec88fSEmmanuel Vadot---
4c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/gpio/socionext,uniphier-gpio.yaml#
5c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6c66ec88fSEmmanuel Vadot
7c66ec88fSEmmanuel Vadottitle: UniPhier GPIO controller
8c66ec88fSEmmanuel Vadot
9c66ec88fSEmmanuel Vadotmaintainers:
10c66ec88fSEmmanuel Vadot  - Masahiro Yamada <yamada.masahiro@socionext.com>
11c66ec88fSEmmanuel Vadot
12c66ec88fSEmmanuel Vadotproperties:
13c66ec88fSEmmanuel Vadot  $nodename:
14c66ec88fSEmmanuel Vadot    pattern: "^gpio@[0-9a-f]+$"
15c66ec88fSEmmanuel Vadot
16c66ec88fSEmmanuel Vadot  compatible:
17c66ec88fSEmmanuel Vadot    const: socionext,uniphier-gpio
18c66ec88fSEmmanuel Vadot
19c66ec88fSEmmanuel Vadot  reg:
20c66ec88fSEmmanuel Vadot    maxItems: 1
21c66ec88fSEmmanuel Vadot
22c66ec88fSEmmanuel Vadot  gpio-controller: true
23c66ec88fSEmmanuel Vadot
24c66ec88fSEmmanuel Vadot  "#gpio-cells":
25c66ec88fSEmmanuel Vadot    const: 2
26c66ec88fSEmmanuel Vadot
27c66ec88fSEmmanuel Vadot  interrupt-controller: true
28c66ec88fSEmmanuel Vadot
29c66ec88fSEmmanuel Vadot  "#interrupt-cells":
30c66ec88fSEmmanuel Vadot    description: |
31c66ec88fSEmmanuel Vadot      The first cell defines the interrupt number.
32c66ec88fSEmmanuel Vadot      The second cell bits[3:0] is used to specify trigger type as follows:
33c66ec88fSEmmanuel Vadot        1 = low-to-high edge triggered
34c66ec88fSEmmanuel Vadot        2 = high-to-low edge triggered
35c66ec88fSEmmanuel Vadot        4 = active high level-sensitive
36c66ec88fSEmmanuel Vadot        8 = active low level-sensitive
37c66ec88fSEmmanuel Vadot      Valid combinations are 1, 2, 3, 4, 8.
38c66ec88fSEmmanuel Vadot    const: 2
39c66ec88fSEmmanuel Vadot
40c66ec88fSEmmanuel Vadot  ngpios:
41c66ec88fSEmmanuel Vadot    minimum: 0
42c66ec88fSEmmanuel Vadot    maximum: 512
43c66ec88fSEmmanuel Vadot
44c66ec88fSEmmanuel Vadot  gpio-ranges: true
45c66ec88fSEmmanuel Vadot
462eb4d8dcSEmmanuel Vadot  gpio-ranges-group-names: true
47c66ec88fSEmmanuel Vadot
48c66ec88fSEmmanuel Vadot  socionext,interrupt-ranges:
49c66ec88fSEmmanuel Vadot    description: |
50c66ec88fSEmmanuel Vadot      Specifies an interrupt number mapping between this GPIO controller and
51c66ec88fSEmmanuel Vadot      its interrupt parent, in the form of arbitrary number of
52c66ec88fSEmmanuel Vadot      <child-interrupt-base parent-interrupt-base length> triplets.
53c66ec88fSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32-matrix
54c66ec88fSEmmanuel Vadot
55*d5b0e70fSEmmanuel VadotpatternProperties:
56*d5b0e70fSEmmanuel Vadot  "^.+-hog(-[0-9]+)?$":
57*d5b0e70fSEmmanuel Vadot    type: object
58*d5b0e70fSEmmanuel Vadot    properties:
59*d5b0e70fSEmmanuel Vadot      gpio-hog: true
60*d5b0e70fSEmmanuel Vadot      gpios: true
61*d5b0e70fSEmmanuel Vadot      input: true
62*d5b0e70fSEmmanuel Vadot      output-high: true
63*d5b0e70fSEmmanuel Vadot      output-low: true
64*d5b0e70fSEmmanuel Vadot      line-name: true
65*d5b0e70fSEmmanuel Vadot
66*d5b0e70fSEmmanuel Vadot    required:
67*d5b0e70fSEmmanuel Vadot      - gpio-hog
68*d5b0e70fSEmmanuel Vadot      - gpios
69*d5b0e70fSEmmanuel Vadot
70*d5b0e70fSEmmanuel Vadot    additionalProperties: false
71*d5b0e70fSEmmanuel Vadot
72c66ec88fSEmmanuel Vadotrequired:
73c66ec88fSEmmanuel Vadot  - compatible
74c66ec88fSEmmanuel Vadot  - reg
75c66ec88fSEmmanuel Vadot  - gpio-controller
76c66ec88fSEmmanuel Vadot  - "#gpio-cells"
77c66ec88fSEmmanuel Vadot  - interrupt-controller
78c66ec88fSEmmanuel Vadot  - "#interrupt-cells"
79c66ec88fSEmmanuel Vadot  - ngpios
80c66ec88fSEmmanuel Vadot  - gpio-ranges
81c66ec88fSEmmanuel Vadot  - socionext,interrupt-ranges
82c66ec88fSEmmanuel Vadot
836be33864SEmmanuel VadotadditionalProperties: false
846be33864SEmmanuel Vadot
85c66ec88fSEmmanuel Vadotexamples:
86c66ec88fSEmmanuel Vadot  - |
87c66ec88fSEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
88c66ec88fSEmmanuel Vadot    #include <dt-bindings/gpio/uniphier-gpio.h>
89c66ec88fSEmmanuel Vadot
90c66ec88fSEmmanuel Vadot    gpio: gpio@55000000 {
91c66ec88fSEmmanuel Vadot        compatible = "socionext,uniphier-gpio";
92c66ec88fSEmmanuel Vadot        reg = <0x55000000 0x200>;
93c66ec88fSEmmanuel Vadot        interrupt-parent = <&aidet>;
94c66ec88fSEmmanuel Vadot        interrupt-controller;
95c66ec88fSEmmanuel Vadot        #interrupt-cells = <2>;
96c66ec88fSEmmanuel Vadot        gpio-controller;
97c66ec88fSEmmanuel Vadot        #gpio-cells = <2>;
98c66ec88fSEmmanuel Vadot        gpio-ranges = <&pinctrl 0 0 0>;
99c66ec88fSEmmanuel Vadot        gpio-ranges-group-names = "gpio_range";
100c66ec88fSEmmanuel Vadot        ngpios = <248>;
101c66ec88fSEmmanuel Vadot        socionext,interrupt-ranges = <0 48 16>, <16 154 5>, <21 217 3>;
102c66ec88fSEmmanuel Vadot    };
103c66ec88fSEmmanuel Vadot
104c66ec88fSEmmanuel Vadot    // Consumer:
105c66ec88fSEmmanuel Vadot    // Please note UNIPHIER_GPIO_PORT(29, 4) represents PORT294 in the SoC
106c66ec88fSEmmanuel Vadot    // document. Unfortunately, only the one's place is octal in the port
107c66ec88fSEmmanuel Vadot    // numbering. (That is, PORT 8, 9, 18, 19, 28, 29, ... do not exist.)
108c66ec88fSEmmanuel Vadot    // UNIPHIER_GPIO_PORT() is a helper macro to calculate 29 * 8 + 4.
109c66ec88fSEmmanuel Vadot    sdhci0_pwrseq {
110c66ec88fSEmmanuel Vadot        compatible = "mmc-pwrseq-emmc";
111c66ec88fSEmmanuel Vadot        reset-gpios = <&gpio UNIPHIER_GPIO_PORT(29, 4) GPIO_ACTIVE_LOW>;
112c66ec88fSEmmanuel Vadot    };
113