linux/Documentation/devicetree/bindings/serial/serial.yaml

# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/serial/serial.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Serial Interface Generic

maintainers:
  - Rob Herring <[email protected]>
  - Greg Kroah-Hartman <[email protected]>

description:
  This document lists a set of generic properties for describing UARTs in a
  device tree.  Whether these properties apply to a particular device depends
  on the DT bindings for the actual device.

  Each enabled UART may have an optional "serialN" alias in the "aliases" node,
  where N is the port number (non-negative decimal integer) as printed on the
  label next to the physical port.

properties:
  $nodename:
    pattern: "^serial(@.*)?$"

  label: true

  cts-gpios:
    maxItems: 1
    description:
      Must contain a GPIO specifier, referring to the GPIO pin to be used as
      the UART's CTS line.

  dcd-gpios:
    maxItems: 1
    description:
      Must contain a GPIO specifier, referring to the GPIO pin to be used as
      the UART's DCD line.

  dsr-gpios:
    maxItems: 1
    description:
      Must contain a GPIO specifier, referring to the GPIO pin to be used as
      the UART's DSR line.

  dtr-gpios:
    maxItems: 1
    description:
      Must contain a GPIO specifier, referring to the GPIO pin to be used as
      the UART's DTR line.

  rng-gpios:
    maxItems: 1
    description:
      Must contain a GPIO specifier, referring to the GPIO pin to be used as
      the UART's RNG line.

  rts-gpios:
    maxItems: 1
    description:
      Must contain a GPIO specifier, referring to the GPIO pin to be used as
      the UART's RTS line.

  uart-has-rtscts:
    $ref: /schemas/types.yaml#/definitions/flag
    description:
      The presence of this property indicates that the UART has dedicated lines
      for RTS/CTS hardware flow control, and that they are available for use
      (wired and enabled by pinmux configuration).  This depends on both the
      UART hardware and the board wiring.

  rx-tx-swap:
    type: boolean
    description: RX and TX pins are swapped.

  cts-rts-swap:
    type: boolean
    description: CTS and RTS pins are swapped.

  rx-threshold:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      RX FIFO threshold configuration (in bytes).

  tx-threshold:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      TX FIFO threshold configuration (in bytes).

patternProperties:
  "^(bluetooth|bluetooth-gnss|embedded-controller|gnss|gps|mcu|onewire)$":
    if:
      type: object
    then:
      additionalProperties: true
      $ref: serial-peripheral-props.yaml#
      description:
        Serial attached devices shall be a child node of the host UART device
        the slave device is attached to. It is expected that the attached
        device is the only child node of the UART device. The slave device node
        name shall reflect the generic type of device for the node.

      properties:
        compatible:
          description:
            Compatible of the device connected to the serial port.

      required:
        - compatible

if:
  required:
    - uart-has-rtscts
then:
  properties:
    cts-gpios: false
    rts-gpios: false

additionalProperties: true

examples:
  - |
    serial@1234 {
        compatible = "ns16550a";
        reg = <0x1234 0x20>;
        interrupts = <1>;

        bluetooth {
            compatible = "brcm,bcm4330-bt";
            interrupt-parent = <&gpio>;
            interrupts = <10>;
        };
    };