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