# Copyright (c) 2024 Renesas Electronics Corporation
# SPDX-License-Identifier: Apache-2.0

description: |
    The Renesas RA pin controller is a node responsible for controlling
    pin function selection and pin properties, such as routing a SCI0 RXD
    to P610.

    The node has the 'pinctrl' node label set in your SoC's devicetree,
    so you can modify it like this:

      &pinctrl {
              /* your modifications go here */
      };

    All device pin configurations should be placed in child nodes of the
    'pinctrl' node, as shown in this example:

      /* You can put this in places like a board-pinctrl.dtsi file in
       * your board directory, or a devicetree overlay in your application.
       */

      /* include pre-defined combinations for the SoC variant used by the board */
      #include <dt-bindings/pinctrl/renesas/pinctrl-ra.h>

      &pinctrl {
        /* configuration for the sci0 "default" state */
          sci0_default: sci0_default {
          group1 {
            /* tx */
            psels = <RA_PSEL(RA_PSEL_SCI_0, 6, 9)>;
            drive-strength = "medium";
          };
          group2 {
            /* rx */
            psels = <RA_PSEL(RA_PSEL_SCI_0, 6, 10)>;
          };
        };
      };

    The 'sci0_default' child node encodes the pin configurations for a
    particular state of a device; in this case, the default (that is, active)
    state.

    As shown, pin configurations are organized in groups within each child node.
    Each group can specify a list of pin function selections in the 'psels'
    property.

    A group can also specify shared pin properties common to all the specified
    pins, such as the 'input-enable' property in group 2. Here is a list of
    supported standard pin properties:

    - bias-disable: Disable pull-up/down (default, not required).
    - bias-pull-up: Enable pull-up resistor.
    - input-enable: Enable input from the pin.
    - drive-strength: Set the drive strength of the pin. Possible
      values are: low, medium, highspeed-high, high.

    To link pin configurations with a device, use a pinctrl-N property for some
    number N, like this example you could place in your board's DTS file:

       #include "board-pinctrl.dtsi"

       &sci0 {
             pinctrl-0 = <&uart0_default>;
             pinctrl-1 = <&uart0_sleep>;
             pinctrl-names = "default", "sleep";
       };

compatible: "renesas,ra-pinctrl-pfs"

include: base.yaml

child-binding:
  description: |
    Definitions for a pinctrl state.
  child-binding:

    include:
      - name: pincfg-node.yaml
        property-allowlist:
          - bias-disable
          - bias-pull-up
          - input-enable
          - drive-open-drain

    properties:
      psels:
        required: true
        type: array
        description: |
          An array of pins sharing the same group properties. Each
          element of the array is an integer constructed from the
          pin number and the alternative function of the pin.
      drive-strength:
        type: string
        enum:
          - "low"
          - "medium"
          - "highspeed-high"
          - "high"
        default: "low"
        description: |
          The drive strength of a pin. The default value is low, as this
          is the power on reset value.
      renesas,analog-enable:
        type: boolean
        description: enable analog input
