xref: /freebsd/sys/contrib/device-tree/Bindings/pinctrl/starfive,jh7100-pinctrl.yaml (revision fac71e4e09885bb2afa3d984a0c239a52e1a7418)
1e67e8565SEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2e67e8565SEmmanuel Vadot%YAML 1.2
3e67e8565SEmmanuel Vadot---
4e67e8565SEmmanuel Vadot$id: http://devicetree.org/schemas/pinctrl/starfive,jh7100-pinctrl.yaml#
5e67e8565SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6e67e8565SEmmanuel Vadot
77ef62cebSEmmanuel Vadottitle: StarFive JH7100 Pin Controller
8e67e8565SEmmanuel Vadot
9e67e8565SEmmanuel Vadotdescription: |
10e67e8565SEmmanuel Vadot  Bindings for the JH7100 RISC-V SoC from StarFive Ltd.
11e67e8565SEmmanuel Vadot
12e67e8565SEmmanuel Vadot  Out of the SoC's many pins only the ones named PAD_GPIO[0] to PAD_GPIO[63]
13e67e8565SEmmanuel Vadot  and PAD_FUNC_SHARE[0] to PAD_FUNC_SHARE[141] can be multiplexed and have
14e67e8565SEmmanuel Vadot  configurable bias, drive strength, schmitt trigger etc. The SoC has an
15e67e8565SEmmanuel Vadot  interesting 2-layered approach to pin muxing best illustrated by the diagram
16e67e8565SEmmanuel Vadot  below.
17e67e8565SEmmanuel Vadot
18e67e8565SEmmanuel Vadot                          Signal group 0, 1, ... or 6
19e67e8565SEmmanuel Vadot                                 ___|___
20e67e8565SEmmanuel Vadot                                |       |
21e67e8565SEmmanuel Vadot    LCD output -----------------|       |
22e67e8565SEmmanuel Vadot    CMOS Camera interface ------|       |--- PAD_GPIO[0]
23e67e8565SEmmanuel Vadot    Ethernet PHY interface -----|  MUX  |--- PAD_GPIO[1]
24e67e8565SEmmanuel Vadot      ...                       |       |      ...
25e67e8565SEmmanuel Vadot                                |       |--- PAD_GPIO[63]
26e67e8565SEmmanuel Vadot     -------- GPIO0 ------------|       |
27e67e8565SEmmanuel Vadot    |  -------|-- GPIO1 --------|       |--- PAD_FUNC_SHARE[0]
28e67e8565SEmmanuel Vadot    | |       |   |             |       |--- PAD_FUNC_SHARE[1]
29e67e8565SEmmanuel Vadot    | |       |   |  ...        |       |       ...
30e67e8565SEmmanuel Vadot    | |       |   |             |       |--- PAD_FUNC_SHARE[141]
31e67e8565SEmmanuel Vadot    | |  -----|---|-- GPIO63 ---|       |
32e67e8565SEmmanuel Vadot    | | |     |   |   |          -------
33e67e8565SEmmanuel Vadot    UART0     UART1 --
34e67e8565SEmmanuel Vadot
35e67e8565SEmmanuel Vadot
36e67e8565SEmmanuel Vadot  The big MUX in the diagram only has 7 different ways of mapping peripherals
37e67e8565SEmmanuel Vadot  on the left to pins on the right. StarFive calls the 7 configurations "signal
38e67e8565SEmmanuel Vadot  groups".
39e67e8565SEmmanuel Vadot  However some peripherals have their I/O go through the 64 "GPIOs". The
40e67e8565SEmmanuel Vadot  diagram only shows UART0 and UART1, but this also includes a number of other
41e67e8565SEmmanuel Vadot  UARTs, I2Cs, SPIs, PWMs etc. All these peripherals are connected to all 64
42e67e8565SEmmanuel Vadot  GPIOs such that any GPIO can be set up to be controlled by any of the
43e67e8565SEmmanuel Vadot  peripherals.
44e67e8565SEmmanuel Vadot  Note that signal group 0 doesn't map any of the GPIOs to pins, and only
45e67e8565SEmmanuel Vadot  signal group 1 maps the GPIOs to the pins named PAD_GPIO[0] to PAD_GPIO[63].
46e67e8565SEmmanuel Vadot
47e67e8565SEmmanuel Vadotmaintainers:
48e67e8565SEmmanuel Vadot  - Emil Renner Berthing <kernel@esmil.dk>
49e67e8565SEmmanuel Vadot  - Drew Fustini <drew@beagleboard.org>
50e67e8565SEmmanuel Vadot
51e67e8565SEmmanuel Vadotproperties:
52e67e8565SEmmanuel Vadot  compatible:
53e67e8565SEmmanuel Vadot    const: starfive,jh7100-pinctrl
54e67e8565SEmmanuel Vadot
55e67e8565SEmmanuel Vadot  reg:
56e67e8565SEmmanuel Vadot    minItems: 2
57e67e8565SEmmanuel Vadot    maxItems: 2
58e67e8565SEmmanuel Vadot
59e67e8565SEmmanuel Vadot  reg-names:
60e67e8565SEmmanuel Vadot    items:
61e67e8565SEmmanuel Vadot      - const: gpio
62e67e8565SEmmanuel Vadot      - const: padctl
63e67e8565SEmmanuel Vadot
64e67e8565SEmmanuel Vadot  clocks:
65e67e8565SEmmanuel Vadot    maxItems: 1
66e67e8565SEmmanuel Vadot
67e67e8565SEmmanuel Vadot  resets:
68e67e8565SEmmanuel Vadot    maxItems: 1
69e67e8565SEmmanuel Vadot
70e67e8565SEmmanuel Vadot  gpio-controller: true
71e67e8565SEmmanuel Vadot
72e67e8565SEmmanuel Vadot  "#gpio-cells":
73e67e8565SEmmanuel Vadot    const: 2
74e67e8565SEmmanuel Vadot
75e67e8565SEmmanuel Vadot  interrupts:
76e67e8565SEmmanuel Vadot    maxItems: 1
77e67e8565SEmmanuel Vadot    description: The GPIO parent interrupt.
78e67e8565SEmmanuel Vadot
79e67e8565SEmmanuel Vadot  interrupt-controller: true
80e67e8565SEmmanuel Vadot
81e67e8565SEmmanuel Vadot  "#interrupt-cells":
82e67e8565SEmmanuel Vadot    const: 2
83e67e8565SEmmanuel Vadot
84e67e8565SEmmanuel Vadot  starfive,signal-group:
85e67e8565SEmmanuel Vadot    description: |
86e67e8565SEmmanuel Vadot      Select one of the 7 signal groups. If this property is not set it
87e67e8565SEmmanuel Vadot      defaults to the configuration already chosen by the earlier boot stages.
88e67e8565SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
89e67e8565SEmmanuel Vadot    enum: [0, 1, 2, 3, 4, 5, 6]
90e67e8565SEmmanuel Vadot
91e67e8565SEmmanuel Vadotrequired:
92e67e8565SEmmanuel Vadot  - compatible
93e67e8565SEmmanuel Vadot  - reg
94e67e8565SEmmanuel Vadot  - reg-names
95e67e8565SEmmanuel Vadot  - clocks
96e67e8565SEmmanuel Vadot  - gpio-controller
97e67e8565SEmmanuel Vadot  - "#gpio-cells"
98e67e8565SEmmanuel Vadot  - interrupts
99e67e8565SEmmanuel Vadot  - interrupt-controller
100e67e8565SEmmanuel Vadot  - "#interrupt-cells"
101e67e8565SEmmanuel Vadot
102e67e8565SEmmanuel VadotpatternProperties:
103e67e8565SEmmanuel Vadot  '-[0-9]+$':
104e67e8565SEmmanuel Vadot    type: object
105e67e8565SEmmanuel Vadot    patternProperties:
106e67e8565SEmmanuel Vadot      '-pins$':
107e67e8565SEmmanuel Vadot        type: object
108e67e8565SEmmanuel Vadot        description: |
109e67e8565SEmmanuel Vadot          A pinctrl node should contain at least one subnode representing the
110e67e8565SEmmanuel Vadot          pinctrl groups available on the machine. Each subnode will list the
111e67e8565SEmmanuel Vadot          pins it needs, and how they should be configured, with regard to
112e67e8565SEmmanuel Vadot          muxer configuration, bias, input enable/disable, input schmitt
113e67e8565SEmmanuel Vadot          trigger enable/disable, slew-rate and drive strength.
114*fac71e4eSEmmanuel Vadot        $ref: /schemas/pinctrl/pincfg-node.yaml
115e67e8565SEmmanuel Vadot
116e67e8565SEmmanuel Vadot        properties:
117e67e8565SEmmanuel Vadot          pins:
118e67e8565SEmmanuel Vadot            description: |
119e67e8565SEmmanuel Vadot              The list of pin identifiers that properties in the node apply to.
120e67e8565SEmmanuel Vadot              This should be set using either the PAD_GPIO or PAD_FUNC_SHARE
121e67e8565SEmmanuel Vadot              macros.
122e67e8565SEmmanuel Vadot              Either this or "pinmux" has to be specified, but not both.
123*fac71e4eSEmmanuel Vadot            $ref: /schemas/pinctrl/pinmux-node.yaml#/properties/pins
124e67e8565SEmmanuel Vadot
125e67e8565SEmmanuel Vadot          pinmux:
126e67e8565SEmmanuel Vadot            description: |
127e67e8565SEmmanuel Vadot              The list of GPIOs and their mux settings that properties in the
128e67e8565SEmmanuel Vadot              node apply to. This should be set using the GPIOMUX macro.
129e67e8565SEmmanuel Vadot              Either this or "pins" has to be specified, but not both.
130*fac71e4eSEmmanuel Vadot            $ref: /schemas/pinctrl/pinmux-node.yaml#/properties/pinmux
131e67e8565SEmmanuel Vadot
132e67e8565SEmmanuel Vadot          bias-disable: true
133e67e8565SEmmanuel Vadot
134e67e8565SEmmanuel Vadot          bias-pull-up:
135e67e8565SEmmanuel Vadot            type: boolean
136e67e8565SEmmanuel Vadot
137e67e8565SEmmanuel Vadot          bias-pull-down:
138e67e8565SEmmanuel Vadot            type: boolean
139e67e8565SEmmanuel Vadot
140e67e8565SEmmanuel Vadot          drive-strength:
141e67e8565SEmmanuel Vadot            enum: [ 14, 21, 28, 35, 42, 49, 56, 63 ]
142e67e8565SEmmanuel Vadot
143e67e8565SEmmanuel Vadot          input-enable: true
144e67e8565SEmmanuel Vadot
145e67e8565SEmmanuel Vadot          input-disable: true
146e67e8565SEmmanuel Vadot
147e67e8565SEmmanuel Vadot          input-schmitt-enable: true
148e67e8565SEmmanuel Vadot
149e67e8565SEmmanuel Vadot          input-schmitt-disable: true
150e67e8565SEmmanuel Vadot
151e67e8565SEmmanuel Vadot          slew-rate:
152e67e8565SEmmanuel Vadot            maximum: 7
153e67e8565SEmmanuel Vadot
154e67e8565SEmmanuel Vadot          starfive,strong-pull-up:
155e67e8565SEmmanuel Vadot            description: enable strong pull-up.
156e67e8565SEmmanuel Vadot            type: boolean
157e67e8565SEmmanuel Vadot
158e67e8565SEmmanuel Vadot        additionalProperties: false
159e67e8565SEmmanuel Vadot
160e67e8565SEmmanuel Vadot    additionalProperties: false
161e67e8565SEmmanuel Vadot
162e67e8565SEmmanuel VadotadditionalProperties: false
163e67e8565SEmmanuel Vadot
164e67e8565SEmmanuel Vadotexamples:
165e67e8565SEmmanuel Vadot  - |
166e67e8565SEmmanuel Vadot    #include <dt-bindings/clock/starfive-jh7100.h>
167e67e8565SEmmanuel Vadot    #include <dt-bindings/reset/starfive-jh7100.h>
1687ef62cebSEmmanuel Vadot    #include <dt-bindings/pinctrl/pinctrl-starfive-jh7100.h>
169e67e8565SEmmanuel Vadot
170e67e8565SEmmanuel Vadot    soc {
171e67e8565SEmmanuel Vadot        #address-cells = <2>;
172e67e8565SEmmanuel Vadot        #size-cells = <2>;
173e67e8565SEmmanuel Vadot
174e67e8565SEmmanuel Vadot        pinctrl@11910000 {
175e67e8565SEmmanuel Vadot            compatible = "starfive,jh7100-pinctrl";
176e67e8565SEmmanuel Vadot            reg = <0x0 0x11910000 0x0 0x10000>,
177e67e8565SEmmanuel Vadot                  <0x0 0x11858000 0x0 0x1000>;
178e67e8565SEmmanuel Vadot            reg-names = "gpio", "padctl";
179e67e8565SEmmanuel Vadot            clocks = <&clkgen JH7100_CLK_GPIO_APB>;
180e67e8565SEmmanuel Vadot            resets = <&clkgen JH7100_RSTN_GPIO_APB>;
181e67e8565SEmmanuel Vadot            interrupts = <32>;
182e67e8565SEmmanuel Vadot            gpio-controller;
183e67e8565SEmmanuel Vadot            #gpio-cells = <2>;
184e67e8565SEmmanuel Vadot            interrupt-controller;
185e67e8565SEmmanuel Vadot            #interrupt-cells = <2>;
186e67e8565SEmmanuel Vadot            starfive,signal-group = <6>;
187e67e8565SEmmanuel Vadot
188e67e8565SEmmanuel Vadot            gmac_pins_default: gmac-0 {
189e67e8565SEmmanuel Vadot                gtxclk-pins {
190e67e8565SEmmanuel Vadot                    pins = <PAD_FUNC_SHARE(115)>;
191e67e8565SEmmanuel Vadot                    bias-pull-up;
192e67e8565SEmmanuel Vadot                    drive-strength = <35>;
193e67e8565SEmmanuel Vadot                    input-enable;
194e67e8565SEmmanuel Vadot                    input-schmitt-enable;
195e67e8565SEmmanuel Vadot                    slew-rate = <0>;
196e67e8565SEmmanuel Vadot                };
197e67e8565SEmmanuel Vadot                miitxclk-pins {
198e67e8565SEmmanuel Vadot                    pins = <PAD_FUNC_SHARE(116)>;
199e67e8565SEmmanuel Vadot                    bias-pull-up;
200e67e8565SEmmanuel Vadot                    drive-strength = <14>;
201e67e8565SEmmanuel Vadot                    input-enable;
202e67e8565SEmmanuel Vadot                    input-schmitt-disable;
203e67e8565SEmmanuel Vadot                    slew-rate = <0>;
204e67e8565SEmmanuel Vadot                };
205e67e8565SEmmanuel Vadot                tx-pins {
206e67e8565SEmmanuel Vadot                    pins = <PAD_FUNC_SHARE(117)>,
207e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(119)>,
208e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(120)>,
209e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(121)>,
210e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(122)>,
211e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(123)>,
212e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(124)>,
213e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(125)>,
214e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(126)>;
215e67e8565SEmmanuel Vadot                    bias-disable;
216e67e8565SEmmanuel Vadot                    drive-strength = <35>;
217e67e8565SEmmanuel Vadot                    input-disable;
218e67e8565SEmmanuel Vadot                    input-schmitt-disable;
219e67e8565SEmmanuel Vadot                    slew-rate = <0>;
220e67e8565SEmmanuel Vadot                };
221e67e8565SEmmanuel Vadot                rxclk-pins {
222e67e8565SEmmanuel Vadot                    pins = <PAD_FUNC_SHARE(127)>;
223e67e8565SEmmanuel Vadot                    bias-pull-up;
224e67e8565SEmmanuel Vadot                    drive-strength = <14>;
225e67e8565SEmmanuel Vadot                    input-enable;
226e67e8565SEmmanuel Vadot                    input-schmitt-disable;
227e67e8565SEmmanuel Vadot                    slew-rate = <6>;
228e67e8565SEmmanuel Vadot                };
229e67e8565SEmmanuel Vadot                rxer-pins {
230e67e8565SEmmanuel Vadot                    pins = <PAD_FUNC_SHARE(129)>;
231e67e8565SEmmanuel Vadot                    bias-pull-up;
232e67e8565SEmmanuel Vadot                    drive-strength = <14>;
233e67e8565SEmmanuel Vadot                    input-enable;
234e67e8565SEmmanuel Vadot                    input-schmitt-disable;
235e67e8565SEmmanuel Vadot                    slew-rate = <0>;
236e67e8565SEmmanuel Vadot                };
237e67e8565SEmmanuel Vadot                rx-pins {
238e67e8565SEmmanuel Vadot                    pins = <PAD_FUNC_SHARE(128)>,
239e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(130)>,
240e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(131)>,
241e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(132)>,
242e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(133)>,
243e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(134)>,
244e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(135)>,
245e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(136)>,
246e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(137)>,
247e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(138)>,
248e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(139)>,
249e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(140)>,
250e67e8565SEmmanuel Vadot                           <PAD_FUNC_SHARE(141)>;
251e67e8565SEmmanuel Vadot                    bias-pull-up;
252e67e8565SEmmanuel Vadot                    drive-strength = <14>;
253e67e8565SEmmanuel Vadot                    input-enable;
254e67e8565SEmmanuel Vadot                    input-schmitt-enable;
255e67e8565SEmmanuel Vadot                    slew-rate = <0>;
256e67e8565SEmmanuel Vadot                };
257e67e8565SEmmanuel Vadot            };
258e67e8565SEmmanuel Vadot
259e67e8565SEmmanuel Vadot            i2c0_pins_default: i2c0-0 {
260e67e8565SEmmanuel Vadot                i2c-pins {
261e67e8565SEmmanuel Vadot                    pinmux = <GPIOMUX(62, GPO_LOW,
262e67e8565SEmmanuel Vadot                              GPO_I2C0_PAD_SCK_OEN,
263e67e8565SEmmanuel Vadot                              GPI_I2C0_PAD_SCK_IN)>,
264e67e8565SEmmanuel Vadot                             <GPIOMUX(61, GPO_LOW,
265e67e8565SEmmanuel Vadot                              GPO_I2C0_PAD_SDA_OEN,
266e67e8565SEmmanuel Vadot                              GPI_I2C0_PAD_SDA_IN)>;
267e67e8565SEmmanuel Vadot                    bias-disable; /* external pull-up */
268e67e8565SEmmanuel Vadot                    input-enable;
269e67e8565SEmmanuel Vadot                    input-schmitt-enable;
270e67e8565SEmmanuel Vadot                };
271e67e8565SEmmanuel Vadot            };
272e67e8565SEmmanuel Vadot
273e67e8565SEmmanuel Vadot            uart3_pins_default: uart3-0 {
274e67e8565SEmmanuel Vadot                rx-pins {
275e67e8565SEmmanuel Vadot                    pinmux = <GPIOMUX(13, GPO_LOW, GPO_DISABLE,
276e67e8565SEmmanuel Vadot                              GPI_UART3_PAD_SIN)>;
277e67e8565SEmmanuel Vadot                    bias-pull-up;
278e67e8565SEmmanuel Vadot                    input-enable;
279e67e8565SEmmanuel Vadot                    input-schmitt-enable;
280e67e8565SEmmanuel Vadot                };
281e67e8565SEmmanuel Vadot                tx-pins {
282e67e8565SEmmanuel Vadot                    pinmux = <GPIOMUX(14, GPO_UART3_PAD_SOUT,
283e67e8565SEmmanuel Vadot                              GPO_ENABLE, GPI_NONE)>;
284e67e8565SEmmanuel Vadot                    bias-disable;
285e67e8565SEmmanuel Vadot                    input-disable;
286e67e8565SEmmanuel Vadot                    input-schmitt-disable;
287e67e8565SEmmanuel Vadot                };
288e67e8565SEmmanuel Vadot            };
289e67e8565SEmmanuel Vadot        };
290e67e8565SEmmanuel Vadot
291e67e8565SEmmanuel Vadot        gmac {
292e67e8565SEmmanuel Vadot            pinctrl-0 = <&gmac_pins_default>;
293e67e8565SEmmanuel Vadot            pinctrl-names = "default";
294e67e8565SEmmanuel Vadot        };
295e67e8565SEmmanuel Vadot
296*fac71e4eSEmmanuel Vadot        i2c {
297e67e8565SEmmanuel Vadot            pinctrl-0 = <&i2c0_pins_default>;
298e67e8565SEmmanuel Vadot            pinctrl-names = "default";
299e67e8565SEmmanuel Vadot        };
300e67e8565SEmmanuel Vadot
301e67e8565SEmmanuel Vadot        uart3 {
302e67e8565SEmmanuel Vadot            pinctrl-0 = <&uart3_pins_default>;
303e67e8565SEmmanuel Vadot            pinctrl-names = "default";
304e67e8565SEmmanuel Vadot        };
305e67e8565SEmmanuel Vadot    };
306e67e8565SEmmanuel Vadot
307e67e8565SEmmanuel Vadot...
308