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