xref: /freebsd/sys/contrib/device-tree/Bindings/pinctrl/renesas,rza1-ports.yaml (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
16be33864SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
26be33864SEmmanuel Vadot%YAML 1.2
36be33864SEmmanuel Vadot---
46be33864SEmmanuel Vadot$id: http://devicetree.org/schemas/pinctrl/renesas,rza1-ports.yaml#
56be33864SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
66be33864SEmmanuel Vadot
76be33864SEmmanuel Vadottitle: Renesas RZ/A1 combined Pin and GPIO controller
86be33864SEmmanuel Vadot
96be33864SEmmanuel Vadotmaintainers:
106be33864SEmmanuel Vadot  - Jacopo Mondi <jacopo+renesas@jmondi.org>
116be33864SEmmanuel Vadot  - Geert Uytterhoeven <geert+renesas@glider.be>
126be33864SEmmanuel Vadot
136be33864SEmmanuel Vadotdescription:
146be33864SEmmanuel Vadot  The Renesas SoCs of the RZ/A1 family feature a combined Pin and GPIO
156be33864SEmmanuel Vadot  controller, named "Ports" in the hardware reference manual.
166be33864SEmmanuel Vadot  Pin multiplexing and GPIO configuration is performed on a per-pin basis
176be33864SEmmanuel Vadot  writing configuration values to per-port register sets.
186be33864SEmmanuel Vadot  Each "port" features up to 16 pins, each of them configurable for GPIO
196be33864SEmmanuel Vadot  function (port mode) or in alternate function mode.
206be33864SEmmanuel Vadot  Up to 8 different alternate function modes exist for each single pin.
216be33864SEmmanuel Vadot
226be33864SEmmanuel Vadotproperties:
236be33864SEmmanuel Vadot  compatible:
246be33864SEmmanuel Vadot    oneOf:
256be33864SEmmanuel Vadot      - const: renesas,r7s72100-ports     # RZ/A1H
266be33864SEmmanuel Vadot      - items:
276be33864SEmmanuel Vadot          - const: renesas,r7s72101-ports # RZ/A1M
286be33864SEmmanuel Vadot          - const: renesas,r7s72100-ports # fallback
296be33864SEmmanuel Vadot      - const: renesas,r7s72102-ports     # RZ/A1L
306be33864SEmmanuel Vadot
316be33864SEmmanuel Vadot  reg:
326be33864SEmmanuel Vadot    maxItems: 1
336be33864SEmmanuel Vadot
34e67e8565SEmmanuel VadotallOf:
35*fac71e4eSEmmanuel Vadot  - $ref: pinctrl.yaml#
36e67e8565SEmmanuel Vadot
376be33864SEmmanuel Vadotrequired:
386be33864SEmmanuel Vadot  - compatible
396be33864SEmmanuel Vadot  - reg
406be33864SEmmanuel Vadot
416be33864SEmmanuel VadotpatternProperties:
426be33864SEmmanuel Vadot  "^gpio-[0-9]*$":
436be33864SEmmanuel Vadot    type: object
447ef62cebSEmmanuel Vadot    additionalProperties: false
456be33864SEmmanuel Vadot
466be33864SEmmanuel Vadot    description:
476be33864SEmmanuel Vadot      Each port of the r7s72100 pin controller hardware is itself a GPIO
486be33864SEmmanuel Vadot      controller.
496be33864SEmmanuel Vadot      Different SoCs have different numbers of available pins per port, but
506be33864SEmmanuel Vadot      generally speaking, each of them can be configured in GPIO ("port") mode
516be33864SEmmanuel Vadot      on this hardware.
526be33864SEmmanuel Vadot      Describe GPIO controllers using sub-nodes with the following properties.
536be33864SEmmanuel Vadot
546be33864SEmmanuel Vadot    properties:
556be33864SEmmanuel Vadot      gpio-controller: true
566be33864SEmmanuel Vadot
576be33864SEmmanuel Vadot      '#gpio-cells':
586be33864SEmmanuel Vadot        const: 2
596be33864SEmmanuel Vadot
606be33864SEmmanuel Vadot      gpio-ranges:
616be33864SEmmanuel Vadot        maxItems: 1
626be33864SEmmanuel Vadot
636be33864SEmmanuel Vadot    required:
646be33864SEmmanuel Vadot      - gpio-controller
656be33864SEmmanuel Vadot      - '#gpio-cells'
666be33864SEmmanuel Vadot      - gpio-ranges
676be33864SEmmanuel Vadot
686be33864SEmmanuel Vadot
696be33864SEmmanuel VadotadditionalProperties:
706be33864SEmmanuel Vadot  anyOf:
716be33864SEmmanuel Vadot    - type: object
726be33864SEmmanuel Vadot      allOf:
736be33864SEmmanuel Vadot        - $ref: pincfg-node.yaml#
746be33864SEmmanuel Vadot        - $ref: pinmux-node.yaml#
756be33864SEmmanuel Vadot
766be33864SEmmanuel Vadot      description:
776be33864SEmmanuel Vadot        A pin multiplexing sub-node describes how to configure a set of (or a
786be33864SEmmanuel Vadot        single) pin in some desired alternate function mode.
796be33864SEmmanuel Vadot        A single sub-node may define several pin configurations.
806be33864SEmmanuel Vadot        A few alternate function require special pin configuration flags to be
816be33864SEmmanuel Vadot        supplied along with the alternate function configuration number.
826be33864SEmmanuel Vadot        The hardware reference manual specifies when a pin function requires
836be33864SEmmanuel Vadot        "software IO driven" mode to be specified. To do so use the generic
846be33864SEmmanuel Vadot        properties from the <include/linux/pinctrl/pinconf_generic.h> header
856be33864SEmmanuel Vadot        file to instruct the pin controller to perform the desired pin
866be33864SEmmanuel Vadot        configuration operation.
876be33864SEmmanuel Vadot        The hardware reference manual specifies when a pin has to be configured
886be33864SEmmanuel Vadot        to work in bi-directional mode and when the IO direction has to be
896be33864SEmmanuel Vadot        specified by software. Bi-directional pins must be managed by the pin
906be33864SEmmanuel Vadot        controller driver internally, while software driven IO direction has to
916be33864SEmmanuel Vadot        be explicitly selected when multiple options are available.
926be33864SEmmanuel Vadot
936be33864SEmmanuel Vadot      properties:
946be33864SEmmanuel Vadot        pinmux:
956be33864SEmmanuel Vadot          description: |
966be33864SEmmanuel Vadot            Integer array representing pin number and pin multiplexing
976be33864SEmmanuel Vadot            configuration.
986be33864SEmmanuel Vadot            When a pin has to be configured in alternate function mode, use
996be33864SEmmanuel Vadot            this property to identify the pin by its global index, and provide
1006be33864SEmmanuel Vadot            its alternate function configuration number along with it.
1016be33864SEmmanuel Vadot            When multiple pins are required to be configured as part of the
1026be33864SEmmanuel Vadot            same alternate function they shall be specified as members of the
1036be33864SEmmanuel Vadot            same argument list of a single "pinmux" property.
1046be33864SEmmanuel Vadot            Helper macros to ease assembling the pin index from its position
1056be33864SEmmanuel Vadot            (port where it sits on and pin number) and alternate function
1066be33864SEmmanuel Vadot            identifier are provided by the pin controller header file at:
1076be33864SEmmanuel Vadot            <include/dt-bindings/pinctrl/r7s72100-pinctrl.h>
1086be33864SEmmanuel Vadot            Integers values in "pinmux" argument list are assembled as:
1096be33864SEmmanuel Vadot            ((PORT * 16 + PIN) | MUX_FUNC << 16)
1106be33864SEmmanuel Vadot
1116be33864SEmmanuel Vadot        input-enable: true
1126be33864SEmmanuel Vadot        output-enable: true
1136be33864SEmmanuel Vadot
1146be33864SEmmanuel Vadot      required:
1156be33864SEmmanuel Vadot        - pinmux
1166be33864SEmmanuel Vadot
1176be33864SEmmanuel Vadot      additionalProperties: false
1186be33864SEmmanuel Vadot
1196be33864SEmmanuel Vadot    - type: object
1206be33864SEmmanuel Vadot      additionalProperties:
1216be33864SEmmanuel Vadot        $ref: "#/additionalProperties/anyOf/0"
1226be33864SEmmanuel Vadot
1236be33864SEmmanuel Vadotexamples:
1246be33864SEmmanuel Vadot  - |
1256be33864SEmmanuel Vadot    #include <dt-bindings/pinctrl/r7s72100-pinctrl.h>
1266be33864SEmmanuel Vadot    pinctrl: pinctrl@fcfe3000 {
1276be33864SEmmanuel Vadot            compatible = "renesas,r7s72100-ports";
1286be33864SEmmanuel Vadot
1296be33864SEmmanuel Vadot            reg = <0xfcfe3000 0x4230>;
1306be33864SEmmanuel Vadot
1316be33864SEmmanuel Vadot            /*
1326be33864SEmmanuel Vadot             * A GPIO controller node, controlling 16 pins indexed from 0.
1336be33864SEmmanuel Vadot             * The GPIO controller base in the global pin indexing space is pin
1346be33864SEmmanuel Vadot             * 48, thus pins [0 - 15] on this controller map to pins [48 - 63]
1356be33864SEmmanuel Vadot             * in the global pin indexing space.
1366be33864SEmmanuel Vadot             */
1376be33864SEmmanuel Vadot            port3: gpio-3 {
1386be33864SEmmanuel Vadot                    gpio-controller;
1396be33864SEmmanuel Vadot                    #gpio-cells = <2>;
1406be33864SEmmanuel Vadot                    gpio-ranges = <&pinctrl 0 48 16>;
1416be33864SEmmanuel Vadot            };
1426be33864SEmmanuel Vadot
1436be33864SEmmanuel Vadot            /*
1446be33864SEmmanuel Vadot             * A serial communication interface with a TX output pin and an RX
1456be33864SEmmanuel Vadot             * input pin.
1466be33864SEmmanuel Vadot             * Pin #0 on port #3 is configured as alternate function #6.
1476be33864SEmmanuel Vadot             * Pin #2 on port #3 is configured as alternate function #4.
1486be33864SEmmanuel Vadot             */
1496be33864SEmmanuel Vadot            scif2_pins: serial2 {
1506be33864SEmmanuel Vadot                    pinmux = <RZA1_PINMUX(3, 0, 6)>, <RZA1_PINMUX(3, 2, 4)>;
1516be33864SEmmanuel Vadot            };
1526be33864SEmmanuel Vadot
1536be33864SEmmanuel Vadot
1546be33864SEmmanuel Vadot            /*
1556be33864SEmmanuel Vadot             * I2c master: both SDA and SCL pins need bi-directional operations
1566be33864SEmmanuel Vadot             * Pin #4 on port #1 is configured as alternate function #1.
1576be33864SEmmanuel Vadot             * Pin #5 on port #1 is configured as alternate function #1.
1586be33864SEmmanuel Vadot             * Both need to work in bi-directional mode, the driver must manage
1596be33864SEmmanuel Vadot             * this internally.
1606be33864SEmmanuel Vadot             */
1616be33864SEmmanuel Vadot            i2c2_pins: i2c2 {
1626be33864SEmmanuel Vadot                    pinmux = <RZA1_PINMUX(1, 4, 1)>, <RZA1_PINMUX(1, 5, 1)>;
1636be33864SEmmanuel Vadot            };
1646be33864SEmmanuel Vadot
1656be33864SEmmanuel Vadot
1666be33864SEmmanuel Vadot            /*
1676be33864SEmmanuel Vadot             * Multi-function timer input and output compare pins.
1686be33864SEmmanuel Vadot             */
1696be33864SEmmanuel Vadot            tioc0_pins: tioc0 {
1706be33864SEmmanuel Vadot                    /*
1716be33864SEmmanuel Vadot                     * Configure TIOC0A as software driven input
1726be33864SEmmanuel Vadot                     * Pin #0 on port #4 is configured as alternate function #2
1736be33864SEmmanuel Vadot                     * with IO direction specified by software as input.
1746be33864SEmmanuel Vadot                     */
1756be33864SEmmanuel Vadot                    tioc0_input_pins {
1766be33864SEmmanuel Vadot                            pinmux = <RZA1_PINMUX(4, 0, 2)>;
1776be33864SEmmanuel Vadot                            input-enable;
1786be33864SEmmanuel Vadot                    };
1796be33864SEmmanuel Vadot
1806be33864SEmmanuel Vadot                    /*
1816be33864SEmmanuel Vadot                     * Configure TIOC0B as software driven output
1826be33864SEmmanuel Vadot                     * Pin #1 on port #4 is configured as alternate function #1
1836be33864SEmmanuel Vadot                     * with IO direction specified by software as output.
1846be33864SEmmanuel Vadot                     */
1856be33864SEmmanuel Vadot                    tioc0_output_pins {
1866be33864SEmmanuel Vadot                            pinmux = <RZA1_PINMUX(4, 1, 1)>;
1876be33864SEmmanuel Vadot                            output-enable;
1886be33864SEmmanuel Vadot                    };
1896be33864SEmmanuel Vadot            };
1906be33864SEmmanuel Vadot    };
191