xref: /freebsd/sys/contrib/device-tree/Bindings/pinctrl/nuvoton,wpcm450-pinctrl.yaml (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1c9ccf3a3SEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2c9ccf3a3SEmmanuel Vadot%YAML 1.2
3c9ccf3a3SEmmanuel Vadot---
4c9ccf3a3SEmmanuel Vadot$id: http://devicetree.org/schemas/pinctrl/nuvoton,wpcm450-pinctrl.yaml#
5c9ccf3a3SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6c9ccf3a3SEmmanuel Vadot
7c9ccf3a3SEmmanuel Vadottitle: Nuvoton WPCM450 pin control and GPIO
8c9ccf3a3SEmmanuel Vadot
9c9ccf3a3SEmmanuel Vadotmaintainers:
10c9ccf3a3SEmmanuel Vadot  - Jonathan Neuschäfer <j.neuschaefer@gmx.net>
11c9ccf3a3SEmmanuel Vadot
12c9ccf3a3SEmmanuel Vadotproperties:
13c9ccf3a3SEmmanuel Vadot  compatible:
14c9ccf3a3SEmmanuel Vadot    const: nuvoton,wpcm450-pinctrl
15c9ccf3a3SEmmanuel Vadot
16c9ccf3a3SEmmanuel Vadot  reg:
17c9ccf3a3SEmmanuel Vadot    maxItems: 1
18c9ccf3a3SEmmanuel Vadot
19c9ccf3a3SEmmanuel Vadot  '#address-cells':
20c9ccf3a3SEmmanuel Vadot    const: 1
21c9ccf3a3SEmmanuel Vadot
22c9ccf3a3SEmmanuel Vadot  '#size-cells':
23c9ccf3a3SEmmanuel Vadot    const: 0
24c9ccf3a3SEmmanuel Vadot
25c9ccf3a3SEmmanuel VadotpatternProperties:
26c9ccf3a3SEmmanuel Vadot  # There are three kinds of subnodes:
27c9ccf3a3SEmmanuel Vadot  # 1. a GPIO controller node for each GPIO bank
28c9ccf3a3SEmmanuel Vadot  # 2. a pinmux node configures pin muxing for a group of pins (e.g. rmii2)
29c9ccf3a3SEmmanuel Vadot  # 3. a pinconf node configures properties of a single pin
30c9ccf3a3SEmmanuel Vadot
31c9ccf3a3SEmmanuel Vadot  "^gpio@[0-7]$":
32c9ccf3a3SEmmanuel Vadot    type: object
33*7ef62cebSEmmanuel Vadot    additionalProperties: false
34c9ccf3a3SEmmanuel Vadot
35c9ccf3a3SEmmanuel Vadot    description:
36c9ccf3a3SEmmanuel Vadot      Eight GPIO banks (gpio@0 to gpio@7), that each contain between 14 and 18
37c9ccf3a3SEmmanuel Vadot      GPIOs. Some GPIOs support interrupts.
38c9ccf3a3SEmmanuel Vadot
39c9ccf3a3SEmmanuel Vadot    properties:
40c9ccf3a3SEmmanuel Vadot      reg:
41c9ccf3a3SEmmanuel Vadot        minimum: 0
42c9ccf3a3SEmmanuel Vadot        maximum: 7
43c9ccf3a3SEmmanuel Vadot
44c9ccf3a3SEmmanuel Vadot      gpio-controller: true
45c9ccf3a3SEmmanuel Vadot
46c9ccf3a3SEmmanuel Vadot      "#gpio-cells":
47c9ccf3a3SEmmanuel Vadot        const: 2
48c9ccf3a3SEmmanuel Vadot
49c9ccf3a3SEmmanuel Vadot      interrupt-controller: true
50c9ccf3a3SEmmanuel Vadot
51c9ccf3a3SEmmanuel Vadot      "#interrupt-cells":
52c9ccf3a3SEmmanuel Vadot        const: 2
53c9ccf3a3SEmmanuel Vadot
54c9ccf3a3SEmmanuel Vadot      interrupts:
55c9ccf3a3SEmmanuel Vadot        maxItems: 3
56c9ccf3a3SEmmanuel Vadot        description:
57c9ccf3a3SEmmanuel Vadot          The interrupts associated with this GPIO bank
58c9ccf3a3SEmmanuel Vadot
59c9ccf3a3SEmmanuel Vadot    required:
60c9ccf3a3SEmmanuel Vadot      - reg
61c9ccf3a3SEmmanuel Vadot      - gpio-controller
62c9ccf3a3SEmmanuel Vadot      - '#gpio-cells'
63c9ccf3a3SEmmanuel Vadot
64c9ccf3a3SEmmanuel Vadot  "^mux-":
65c9ccf3a3SEmmanuel Vadot    $ref: pinmux-node.yaml#
66c9ccf3a3SEmmanuel Vadot
67c9ccf3a3SEmmanuel Vadot    properties:
68c9ccf3a3SEmmanuel Vadot      groups:
69c9ccf3a3SEmmanuel Vadot        description:
70c9ccf3a3SEmmanuel Vadot          One or more groups of pins to mux to a certain function
71c9ccf3a3SEmmanuel Vadot        items:
72c9ccf3a3SEmmanuel Vadot          enum: [ smb3, smb4, smb5, scs1, scs2, scs3, smb0, smb1, smb2, bsp,
73c9ccf3a3SEmmanuel Vadot                  hsp1, hsp2, r1err, r1md, rmii2, r2err, r2md, kbcc, dvo,
74c9ccf3a3SEmmanuel Vadot                  clko, smi, uinc, gspi, mben, xcs2, xcs1, sdio, sspi, fi0,
75c9ccf3a3SEmmanuel Vadot                  fi1, fi2, fi3, fi4, fi5, fi6, fi7, fi8, fi9, fi10, fi11,
76c9ccf3a3SEmmanuel Vadot                  fi12, fi13, fi14, fi15, pwm0, pwm1, pwm2, pwm3, pwm4, pwm5,
77c9ccf3a3SEmmanuel Vadot                  pwm6, pwm7, hg0, hg1, hg2, hg3, hg4, hg5, hg6, hg7 ]
78c9ccf3a3SEmmanuel Vadot      function:
79c9ccf3a3SEmmanuel Vadot        description:
80c9ccf3a3SEmmanuel Vadot          The function that a group of pins is muxed to
81c9ccf3a3SEmmanuel Vadot        enum: [ smb3, smb4, smb5, scs1, scs2, scs3, smb0, smb1, smb2, bsp,
82c9ccf3a3SEmmanuel Vadot                hsp1, hsp2, r1err, r1md, rmii2, r2err, r2md, kbcc, dvo0,
83c9ccf3a3SEmmanuel Vadot                dvo1, dvo2, dvo3, dvo4, dvo5, dvo6, dvo7, clko, smi, uinc,
84c9ccf3a3SEmmanuel Vadot                gspi, mben, xcs2, xcs1, sdio, sspi, fi0, fi1, fi2, fi3, fi4,
85c9ccf3a3SEmmanuel Vadot                fi5, fi6, fi7, fi8, fi9, fi10, fi11, fi12, fi13, fi14, fi15,
86c9ccf3a3SEmmanuel Vadot                pwm0, pwm1, pwm2, pwm3, pwm4, pwm5, pwm6, pwm7, hg0, hg1,
87c9ccf3a3SEmmanuel Vadot                hg2, hg3, hg4, hg5, hg6, hg7, gpio ]
88c9ccf3a3SEmmanuel Vadot
89c9ccf3a3SEmmanuel Vadot    dependencies:
90c9ccf3a3SEmmanuel Vadot      groups: [ function ]
91c9ccf3a3SEmmanuel Vadot      function: [ groups ]
92c9ccf3a3SEmmanuel Vadot
93c9ccf3a3SEmmanuel Vadot    additionalProperties: false
94c9ccf3a3SEmmanuel Vadot
95c9ccf3a3SEmmanuel Vadot  "^cfg-":
96c9ccf3a3SEmmanuel Vadot    $ref: pincfg-node.yaml#
97c9ccf3a3SEmmanuel Vadot
98c9ccf3a3SEmmanuel Vadot    properties:
99c9ccf3a3SEmmanuel Vadot      pins:
100c9ccf3a3SEmmanuel Vadot        description:
101c9ccf3a3SEmmanuel Vadot          A list of pins to configure in certain ways, such as enabling
102c9ccf3a3SEmmanuel Vadot          debouncing
103c9ccf3a3SEmmanuel Vadot        items:
104c9ccf3a3SEmmanuel Vadot          pattern: "^gpio1?[0-9]{1,2}$"
105c9ccf3a3SEmmanuel Vadot
106c9ccf3a3SEmmanuel Vadot      input-debounce: true
107c9ccf3a3SEmmanuel Vadot
108c9ccf3a3SEmmanuel Vadot    additionalProperties: false
109c9ccf3a3SEmmanuel Vadot
110c9ccf3a3SEmmanuel Vadotrequired:
111c9ccf3a3SEmmanuel Vadot  - compatible
112c9ccf3a3SEmmanuel Vadot  - reg
113c9ccf3a3SEmmanuel Vadot
114c9ccf3a3SEmmanuel VadotadditionalProperties: false
115c9ccf3a3SEmmanuel Vadot
116c9ccf3a3SEmmanuel Vadotexamples:
117c9ccf3a3SEmmanuel Vadot  - |
118c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
119c9ccf3a3SEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
120c9ccf3a3SEmmanuel Vadot    pinctrl: pinctrl@b8003000 {
121c9ccf3a3SEmmanuel Vadot      compatible = "nuvoton,wpcm450-pinctrl";
122c9ccf3a3SEmmanuel Vadot      reg = <0xb8003000 0x1000>;
123c9ccf3a3SEmmanuel Vadot      #address-cells = <1>;
124c9ccf3a3SEmmanuel Vadot      #size-cells = <0>;
125c9ccf3a3SEmmanuel Vadot
126c9ccf3a3SEmmanuel Vadot      gpio0: gpio@0 {
127c9ccf3a3SEmmanuel Vadot        reg = <0>;
128c9ccf3a3SEmmanuel Vadot        gpio-controller;
129c9ccf3a3SEmmanuel Vadot        #gpio-cells = <2>;
130c9ccf3a3SEmmanuel Vadot        interrupts = <2 IRQ_TYPE_LEVEL_HIGH>,
131c9ccf3a3SEmmanuel Vadot                     <3 IRQ_TYPE_LEVEL_HIGH>,
132c9ccf3a3SEmmanuel Vadot                     <4 IRQ_TYPE_LEVEL_HIGH>;
133c9ccf3a3SEmmanuel Vadot      };
134c9ccf3a3SEmmanuel Vadot
135c9ccf3a3SEmmanuel Vadot      mux-rmii2 {
136c9ccf3a3SEmmanuel Vadot        groups = "rmii2";
137c9ccf3a3SEmmanuel Vadot        function = "rmii2";
138c9ccf3a3SEmmanuel Vadot      };
139c9ccf3a3SEmmanuel Vadot
140c9ccf3a3SEmmanuel Vadot      pinmux_uid: mux-uid {
141c9ccf3a3SEmmanuel Vadot        groups = "gspi", "sspi";
142c9ccf3a3SEmmanuel Vadot        function = "gpio";
143c9ccf3a3SEmmanuel Vadot      };
144c9ccf3a3SEmmanuel Vadot
145c9ccf3a3SEmmanuel Vadot      pinctrl_uid: cfg-uid {
146c9ccf3a3SEmmanuel Vadot        pins = "gpio14";
147c9ccf3a3SEmmanuel Vadot        input-debounce = <1>;
148c9ccf3a3SEmmanuel Vadot      };
149c9ccf3a3SEmmanuel Vadot    };
150c9ccf3a3SEmmanuel Vadot
151c9ccf3a3SEmmanuel Vadot    gpio-keys {
152c9ccf3a3SEmmanuel Vadot      compatible = "gpio-keys";
153c9ccf3a3SEmmanuel Vadot      pinctrl-names = "default";
154c9ccf3a3SEmmanuel Vadot      pinctrl-0 = <&pinctrl_uid>, <&pinmux_uid>;
155c9ccf3a3SEmmanuel Vadot
156b97ee269SEmmanuel Vadot      button-uid {
157c9ccf3a3SEmmanuel Vadot        label = "UID";
158c9ccf3a3SEmmanuel Vadot        linux,code = <102>;
159c9ccf3a3SEmmanuel Vadot        gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
160c9ccf3a3SEmmanuel Vadot      };
161c9ccf3a3SEmmanuel Vadot    };
162