Documentation / devicetree / bindings / serial / serial.yaml


Based on kernel version 6.8. Page generated on 2024-03-11 21:26 EST.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
# 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 <robh@kernel.org>
  - Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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|gnss|gps|mcu)$":
    if:
      type: object
    then:
      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.

        max-speed:
          $ref: /schemas/types.yaml#/definitions/uint32
          description:
            The maximum baud rate the device operates at.
            This should only be present if the maximum is less than the slave
            device can support.  For example, a particular board has some
            signal quality issue or the host processor can't support higher
            baud rates.

        current-speed:
          $ref: /schemas/types.yaml#/definitions/uint32
          description: |
            The current baud rate the device operates at.
            This should only be present in case a driver has no chance to know
            the baud rate of the slave device.
            Examples:
              * device supports auto-baud
              * the rate is setup by a bootloader and there is no way to reset
                the device
              * device baud rate is configured by its firmware but there is no
                way to request the actual settings

      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>;
        };
    };