xref: /freebsd/sys/contrib/device-tree/Bindings/pinctrl/renesas,rza2-pinctrl.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel VadotRenesas RZ/A2 combined Pin and GPIO controller
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel VadotThe Renesas SoCs of the RZ/A2 series feature a combined Pin and GPIO controller.
4*c66ec88fSEmmanuel VadotPin multiplexing and GPIO configuration is performed on a per-pin basis.
5*c66ec88fSEmmanuel VadotEach port features up to 8 pins, each of them configurable for GPIO
6*c66ec88fSEmmanuel Vadotfunction (port mode) or in alternate function mode.
7*c66ec88fSEmmanuel VadotUp to 8 different alternate function modes exist for each single pin.
8*c66ec88fSEmmanuel Vadot
9*c66ec88fSEmmanuel VadotPin controller node
10*c66ec88fSEmmanuel Vadot-------------------
11*c66ec88fSEmmanuel Vadot
12*c66ec88fSEmmanuel VadotRequired properties:
13*c66ec88fSEmmanuel Vadot  - compatible: shall be:
14*c66ec88fSEmmanuel Vadot    - "renesas,r7s9210-pinctrl": for RZ/A2M
15*c66ec88fSEmmanuel Vadot  - reg
16*c66ec88fSEmmanuel Vadot    Address base and length of the memory area where the pin controller
17*c66ec88fSEmmanuel Vadot    hardware is mapped to.
18*c66ec88fSEmmanuel Vadot  - gpio-controller
19*c66ec88fSEmmanuel Vadot    This pin controller also controls pins as GPIO
20*c66ec88fSEmmanuel Vadot  - #gpio-cells
21*c66ec88fSEmmanuel Vadot    Must be 2
22*c66ec88fSEmmanuel Vadot  - gpio-ranges
23*c66ec88fSEmmanuel Vadot    Expresses the total number of GPIO ports/pins in this SoC
24*c66ec88fSEmmanuel Vadot
25*c66ec88fSEmmanuel VadotExample: Pin controller node for RZ/A2M SoC (r7s9210)
26*c66ec88fSEmmanuel Vadot
27*c66ec88fSEmmanuel Vadot	pinctrl: pin-controller@fcffe000 {
28*c66ec88fSEmmanuel Vadot		compatible = "renesas,r7s9210-pinctrl";
29*c66ec88fSEmmanuel Vadot		reg = <0xfcffe000 0x1000>;
30*c66ec88fSEmmanuel Vadot
31*c66ec88fSEmmanuel Vadot		gpio-controller;
32*c66ec88fSEmmanuel Vadot		#gpio-cells = <2>;
33*c66ec88fSEmmanuel Vadot		gpio-ranges = <&pinctrl 0 0 176>;
34*c66ec88fSEmmanuel Vadot	};
35*c66ec88fSEmmanuel Vadot
36*c66ec88fSEmmanuel VadotSub-nodes
37*c66ec88fSEmmanuel Vadot---------
38*c66ec88fSEmmanuel Vadot
39*c66ec88fSEmmanuel VadotThe child nodes of the pin controller designate pins to be used for
40*c66ec88fSEmmanuel Vadotspecific peripheral functions or as GPIO.
41*c66ec88fSEmmanuel Vadot
42*c66ec88fSEmmanuel Vadot- Pin multiplexing sub-nodes:
43*c66ec88fSEmmanuel Vadot  A pin multiplexing sub-node describes how to configure a set of
44*c66ec88fSEmmanuel Vadot  (or a single) pin in some desired alternate function mode.
45*c66ec88fSEmmanuel Vadot  The values for the pinmux properties are a combination of port name, pin
46*c66ec88fSEmmanuel Vadot  number and the desired function index. Use the RZA2_PINMUX macro located
47*c66ec88fSEmmanuel Vadot  in include/dt-bindings/pinctrl/r7s9210-pinctrl.h to easily define these.
48*c66ec88fSEmmanuel Vadot  For assigning GPIO pins, use the macro RZA2_PIN also in r7s9210-pinctrl.h
49*c66ec88fSEmmanuel Vadot  to express the desired port pin.
50*c66ec88fSEmmanuel Vadot
51*c66ec88fSEmmanuel Vadot  Required properties:
52*c66ec88fSEmmanuel Vadot    - pinmux:
53*c66ec88fSEmmanuel Vadot      integer array representing pin number and pin multiplexing configuration.
54*c66ec88fSEmmanuel Vadot      When a pin has to be configured in alternate function mode, use this
55*c66ec88fSEmmanuel Vadot      property to identify the pin by its global index, and provide its
56*c66ec88fSEmmanuel Vadot      alternate function configuration number along with it.
57*c66ec88fSEmmanuel Vadot      When multiple pins are required to be configured as part of the same
58*c66ec88fSEmmanuel Vadot      alternate function they shall be specified as members of the same
59*c66ec88fSEmmanuel Vadot      argument list of a single "pinmux" property.
60*c66ec88fSEmmanuel Vadot      Helper macros to ease assembling the pin index from its position
61*c66ec88fSEmmanuel Vadot      (port where it sits on and pin number) and alternate function identifier
62*c66ec88fSEmmanuel Vadot      are provided by the pin controller header file at:
63*c66ec88fSEmmanuel Vadot      <dt-bindings/pinctrl/r7s9210-pinctrl.h>
64*c66ec88fSEmmanuel Vadot      Integers values in "pinmux" argument list are assembled as:
65*c66ec88fSEmmanuel Vadot      ((PORT * 8 + PIN) | MUX_FUNC << 16)
66*c66ec88fSEmmanuel Vadot
67*c66ec88fSEmmanuel Vadot  Example: Board specific pins configuration
68*c66ec88fSEmmanuel Vadot
69*c66ec88fSEmmanuel Vadot	&pinctrl {
70*c66ec88fSEmmanuel Vadot		/* Serial Console */
71*c66ec88fSEmmanuel Vadot		scif4_pins: serial4 {
72*c66ec88fSEmmanuel Vadot			pinmux = <RZA2_PINMUX(PORT9, 0, 4)>,	/* TxD4 */
73*c66ec88fSEmmanuel Vadot				 <RZA2_PINMUX(PORT9, 1, 4)>;	/* RxD4 */
74*c66ec88fSEmmanuel Vadot		};
75*c66ec88fSEmmanuel Vadot	};
76*c66ec88fSEmmanuel Vadot
77*c66ec88fSEmmanuel Vadot  Example: Assigning a GPIO:
78*c66ec88fSEmmanuel Vadot
79*c66ec88fSEmmanuel Vadot	leds {
80*c66ec88fSEmmanuel Vadot		status = "okay";
81*c66ec88fSEmmanuel Vadot		compatible = "gpio-leds";
82*c66ec88fSEmmanuel Vadot
83*c66ec88fSEmmanuel Vadot		led0 {
84*c66ec88fSEmmanuel Vadot			/* P6_0 */
85*c66ec88fSEmmanuel Vadot			gpios = <&pinctrl RZA2_PIN(PORT6, 0) GPIO_ACTIVE_HIGH>;
86*c66ec88fSEmmanuel Vadot		};
87*c66ec88fSEmmanuel Vadot	};
88