xref: /freebsd/sys/contrib/device-tree/Bindings/pinctrl/renesas,pfc-pinctrl.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel Vadot* Renesas Pin Function Controller (GPIO and Pin Mux/Config)
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel VadotThe Pin Function Controller (PFC) is a Pin Mux/Config controller. On SH73A0,
4*c66ec88fSEmmanuel VadotR8A73A4 and R8A7740 it also acts as a GPIO controller.
5*c66ec88fSEmmanuel Vadot
6*c66ec88fSEmmanuel Vadot
7*c66ec88fSEmmanuel VadotPin Control
8*c66ec88fSEmmanuel Vadot-----------
9*c66ec88fSEmmanuel Vadot
10*c66ec88fSEmmanuel VadotRequired Properties:
11*c66ec88fSEmmanuel Vadot
12*c66ec88fSEmmanuel Vadot  - compatible: should be one of the following.
13*c66ec88fSEmmanuel Vadot    - "renesas,pfc-emev2": for EMEV2 (EMMA Mobile EV2) compatible pin-controller.
14*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a73a4": for R8A73A4 (R-Mobile APE6) compatible pin-controller.
15*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7740": for R8A7740 (R-Mobile A1) compatible pin-controller.
16*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7742": for R8A7742 (RZ/G1H) compatible pin-controller.
17*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7743": for R8A7743 (RZ/G1M) compatible pin-controller.
18*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7744": for R8A7744 (RZ/G1N) compatible pin-controller.
19*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7745": for R8A7745 (RZ/G1E) compatible pin-controller.
20*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a77470": for R8A77470 (RZ/G1C) compatible pin-controller.
21*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a774a1": for R8A774A1 (RZ/G2M) compatible pin-controller.
22*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a774b1": for R8A774B1 (RZ/G2N) compatible pin-controller.
23*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a774c0": for R8A774C0 (RZ/G2E) compatible pin-controller.
24*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a774e1": for R8A774E1 (RZ/G2H) compatible pin-controller.
25*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7778": for R8A7778 (R-Car M1) compatible pin-controller.
26*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7779": for R8A7779 (R-Car H1) compatible pin-controller.
27*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7790": for R8A7790 (R-Car H2) compatible pin-controller.
28*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7791": for R8A7791 (R-Car M2-W) compatible pin-controller.
29*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7792": for R8A7792 (R-Car V2H) compatible pin-controller.
30*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7793": for R8A7793 (R-Car M2-N) compatible pin-controller.
31*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7794": for R8A7794 (R-Car E2) compatible pin-controller.
32*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7795": for R8A7795 (R-Car H3) compatible pin-controller.
33*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a7796": for R8A77960 (R-Car M3-W) compatible pin-controller.
34*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a77961": for R8A77961 (R-Car M3-W+) compatible pin-controller.
35*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a77965": for R8A77965 (R-Car M3-N) compatible pin-controller.
36*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a77970": for R8A77970 (R-Car V3M) compatible pin-controller.
37*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a77980": for R8A77980 (R-Car V3H) compatible pin-controller.
38*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a77990": for R8A77990 (R-Car E3) compatible pin-controller.
39*c66ec88fSEmmanuel Vadot    - "renesas,pfc-r8a77995": for R8A77995 (R-Car D3) compatible pin-controller.
40*c66ec88fSEmmanuel Vadot    - "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible pin-controller.
41*c66ec88fSEmmanuel Vadot
42*c66ec88fSEmmanuel Vadot  - reg: Base address and length of each memory resource used by the pin
43*c66ec88fSEmmanuel Vadot    controller hardware module.
44*c66ec88fSEmmanuel Vadot
45*c66ec88fSEmmanuel VadotOptional properties:
46*c66ec88fSEmmanuel Vadot
47*c66ec88fSEmmanuel Vadot  - #gpio-range-cells: Mandatory when the PFC doesn't handle GPIO, forbidden
48*c66ec88fSEmmanuel Vadot    otherwise. Should be 3.
49*c66ec88fSEmmanuel Vadot
50*c66ec88fSEmmanuel Vadot  - interrupts-extended: Specify the interrupts associated with external
51*c66ec88fSEmmanuel Vadot    IRQ pins. This property is mandatory when the PFC handles GPIOs and
52*c66ec88fSEmmanuel Vadot    forbidden otherwise. When specified, it must contain one interrupt per
53*c66ec88fSEmmanuel Vadot    external IRQ, sorted by external IRQ number.
54*c66ec88fSEmmanuel Vadot
55*c66ec88fSEmmanuel VadotThe PFC node also acts as a container for pin configuration nodes. Please refer
56*c66ec88fSEmmanuel Vadotto pinctrl-bindings.txt in this directory for the definition of the term "pin
57*c66ec88fSEmmanuel Vadotconfiguration node" and for the common pinctrl bindings used by client devices.
58*c66ec88fSEmmanuel Vadot
59*c66ec88fSEmmanuel VadotEach pin configuration node represents a desired configuration for a pin, a
60*c66ec88fSEmmanuel Vadotpin group, or a list of pins or pin groups. The configuration can include the
61*c66ec88fSEmmanuel Vadotfunction to select on those pin(s) and pin configuration parameters (such as
62*c66ec88fSEmmanuel Vadotpull-up and pull-down).
63*c66ec88fSEmmanuel Vadot
64*c66ec88fSEmmanuel VadotPin configuration nodes contain pin configuration properties, either directly
65*c66ec88fSEmmanuel Vadotor grouped in child subnodes. Both pin muxing and configuration parameters can
66*c66ec88fSEmmanuel Vadotbe grouped in that way and referenced as a single pin configuration node by
67*c66ec88fSEmmanuel Vadotclient devices.
68*c66ec88fSEmmanuel Vadot
69*c66ec88fSEmmanuel VadotA configuration node or subnode must reference at least one pin (through the
70*c66ec88fSEmmanuel Vadotpins or pin groups properties) and contain at least a function or one
71*c66ec88fSEmmanuel Vadotconfiguration parameter. When the function is present only pin groups can be
72*c66ec88fSEmmanuel Vadotused to reference pins.
73*c66ec88fSEmmanuel Vadot
74*c66ec88fSEmmanuel VadotAll pin configuration nodes and subnodes names are ignored. All of those nodes
75*c66ec88fSEmmanuel Vadotare parsed through phandles and processed purely based on their content.
76*c66ec88fSEmmanuel Vadot
77*c66ec88fSEmmanuel VadotPin Configuration Node Properties:
78*c66ec88fSEmmanuel Vadot
79*c66ec88fSEmmanuel Vadot- pins : An array of strings, each string containing the name of a pin.
80*c66ec88fSEmmanuel Vadot- groups : An array of strings, each string containing the name of a pin
81*c66ec88fSEmmanuel Vadot  group.
82*c66ec88fSEmmanuel Vadot
83*c66ec88fSEmmanuel Vadot- function: A string containing the name of the function to mux to the pin
84*c66ec88fSEmmanuel Vadot  group(s) specified by the groups property.
85*c66ec88fSEmmanuel Vadot
86*c66ec88fSEmmanuel Vadot  Valid values for pin, group and function names can be found in the group and
87*c66ec88fSEmmanuel Vadot  function arrays of the PFC data file corresponding to the SoC
88*c66ec88fSEmmanuel Vadot  (drivers/pinctrl/sh-pfc/pfc-*.c)
89*c66ec88fSEmmanuel Vadot
90*c66ec88fSEmmanuel VadotThe pin configuration parameters use the generic pinconf bindings defined in
91*c66ec88fSEmmanuel Vadotpinctrl-bindings.txt in this directory. The supported parameters are
92*c66ec88fSEmmanuel Vadotbias-disable, bias-pull-up, bias-pull-down, drive-strength and power-source. For
93*c66ec88fSEmmanuel Vadotpins that have a configurable I/O voltage, the power-source value should be the
94*c66ec88fSEmmanuel Vadotnominal I/O voltage in millivolts.
95*c66ec88fSEmmanuel Vadot
96*c66ec88fSEmmanuel Vadot
97*c66ec88fSEmmanuel VadotGPIO
98*c66ec88fSEmmanuel Vadot----
99*c66ec88fSEmmanuel Vadot
100*c66ec88fSEmmanuel VadotOn SH73A0, R8A73A4 and R8A7740 the PFC node is also a GPIO controller node.
101*c66ec88fSEmmanuel Vadot
102*c66ec88fSEmmanuel VadotRequired Properties:
103*c66ec88fSEmmanuel Vadot
104*c66ec88fSEmmanuel Vadot  - gpio-controller: Marks the device node as a gpio controller.
105*c66ec88fSEmmanuel Vadot
106*c66ec88fSEmmanuel Vadot  - #gpio-cells: Should be 2. The first cell is the GPIO number and the second
107*c66ec88fSEmmanuel Vadot    cell specifies GPIO flags, as defined in <dt-bindings/gpio/gpio.h>. Only the
108*c66ec88fSEmmanuel Vadot    GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW flags are supported.
109*c66ec88fSEmmanuel Vadot
110*c66ec88fSEmmanuel VadotThe syntax of the gpio specifier used by client nodes should be the following
111*c66ec88fSEmmanuel Vadotwith values derived from the SoC user manual.
112*c66ec88fSEmmanuel Vadot
113*c66ec88fSEmmanuel Vadot  <[phandle of the gpio controller node]
114*c66ec88fSEmmanuel Vadot   [pin number within the gpio controller]
115*c66ec88fSEmmanuel Vadot   [flags]>
116*c66ec88fSEmmanuel Vadot
117*c66ec88fSEmmanuel VadotOn other mach-shmobile platforms GPIO is handled by the gpio-rcar driver.
118*c66ec88fSEmmanuel VadotPlease refer to Documentation/devicetree/bindings/gpio/renesas,rcar-gpio.yaml
119*c66ec88fSEmmanuel Vadotfor documentation of the GPIO device tree bindings on those platforms.
120*c66ec88fSEmmanuel Vadot
121*c66ec88fSEmmanuel Vadot
122*c66ec88fSEmmanuel VadotExamples
123*c66ec88fSEmmanuel Vadot--------
124*c66ec88fSEmmanuel Vadot
125*c66ec88fSEmmanuel VadotExample 1: SH73A0 (SH-Mobile AG5) pin controller node
126*c66ec88fSEmmanuel Vadot
127*c66ec88fSEmmanuel Vadot	pfc: pin-controller@e6050000 {
128*c66ec88fSEmmanuel Vadot		compatible = "renesas,pfc-sh73a0";
129*c66ec88fSEmmanuel Vadot		reg = <0xe6050000 0x8000>,
130*c66ec88fSEmmanuel Vadot		      <0xe605801c 0x1c>;
131*c66ec88fSEmmanuel Vadot		gpio-controller;
132*c66ec88fSEmmanuel Vadot		#gpio-cells = <2>;
133*c66ec88fSEmmanuel Vadot		interrupts-extended =
134*c66ec88fSEmmanuel Vadot			<&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>,
135*c66ec88fSEmmanuel Vadot			<&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>,
136*c66ec88fSEmmanuel Vadot			<&irqpin1 0 0>, <&irqpin1 1 0>, <&irqpin1 2 0>, <&irqpin1 3 0>,
137*c66ec88fSEmmanuel Vadot			<&irqpin1 4 0>, <&irqpin1 5 0>, <&irqpin1 6 0>, <&irqpin1 7 0>,
138*c66ec88fSEmmanuel Vadot			<&irqpin2 0 0>, <&irqpin2 1 0>, <&irqpin2 2 0>, <&irqpin2 3 0>,
139*c66ec88fSEmmanuel Vadot			<&irqpin2 4 0>, <&irqpin2 5 0>, <&irqpin2 6 0>, <&irqpin2 7 0>,
140*c66ec88fSEmmanuel Vadot			<&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>,
141*c66ec88fSEmmanuel Vadot			<&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>;
142*c66ec88fSEmmanuel Vadot	};
143*c66ec88fSEmmanuel Vadot
144*c66ec88fSEmmanuel VadotExample 2: A GPIO LED node that references a GPIO
145*c66ec88fSEmmanuel Vadot
146*c66ec88fSEmmanuel Vadot	#include <dt-bindings/gpio/gpio.h>
147*c66ec88fSEmmanuel Vadot
148*c66ec88fSEmmanuel Vadot	leds {
149*c66ec88fSEmmanuel Vadot		compatible = "gpio-leds";
150*c66ec88fSEmmanuel Vadot		led1 {
151*c66ec88fSEmmanuel Vadot			gpios = <&pfc 20 GPIO_ACTIVE_LOW>;
152*c66ec88fSEmmanuel Vadot		};
153*c66ec88fSEmmanuel Vadot	};
154*c66ec88fSEmmanuel Vadot
155*c66ec88fSEmmanuel VadotExample 3: KZM-A9-GT (SH-Mobile AG5) default pin state hog and pin control maps
156*c66ec88fSEmmanuel Vadot           for the MMCIF and SCIFA4 devices
157*c66ec88fSEmmanuel Vadot
158*c66ec88fSEmmanuel Vadot	&pfc {
159*c66ec88fSEmmanuel Vadot		pinctrl-0 = <&scifa4_pins>;
160*c66ec88fSEmmanuel Vadot		pinctrl-names = "default";
161*c66ec88fSEmmanuel Vadot
162*c66ec88fSEmmanuel Vadot		mmcif_pins: mmcif {
163*c66ec88fSEmmanuel Vadot			mux {
164*c66ec88fSEmmanuel Vadot				groups = "mmc0_data8_0", "mmc0_ctrl_0";
165*c66ec88fSEmmanuel Vadot				function = "mmc0";
166*c66ec88fSEmmanuel Vadot			};
167*c66ec88fSEmmanuel Vadot			cfg {
168*c66ec88fSEmmanuel Vadot				groups = "mmc0_data8_0";
169*c66ec88fSEmmanuel Vadot				pins = "PORT279";
170*c66ec88fSEmmanuel Vadot				bias-pull-up;
171*c66ec88fSEmmanuel Vadot			};
172*c66ec88fSEmmanuel Vadot		};
173*c66ec88fSEmmanuel Vadot
174*c66ec88fSEmmanuel Vadot		scifa4_pins: scifa4 {
175*c66ec88fSEmmanuel Vadot			groups = "scifa4_data", "scifa4_ctrl";
176*c66ec88fSEmmanuel Vadot			function = "scifa4";
177*c66ec88fSEmmanuel Vadot		};
178*c66ec88fSEmmanuel Vadot	};
179*c66ec88fSEmmanuel Vadot
180*c66ec88fSEmmanuel VadotExample 4: KZM-A9-GT (SH-Mobile AG5) default pin state for the MMCIF device
181*c66ec88fSEmmanuel Vadot
182*c66ec88fSEmmanuel Vadot	&mmcif {
183*c66ec88fSEmmanuel Vadot		pinctrl-0 = <&mmcif_pins>;
184*c66ec88fSEmmanuel Vadot		pinctrl-names = "default";
185*c66ec88fSEmmanuel Vadot
186*c66ec88fSEmmanuel Vadot		bus-width = <8>;
187*c66ec88fSEmmanuel Vadot		vmmc-supply = <&reg_1p8v>;
188*c66ec88fSEmmanuel Vadot	};
189