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