1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: "http://devicetree.org/schemas/serial/serial.yaml#"
5$schema: "http://devicetree.org/meta-schemas/core.yaml#"
6
7title: Serial Interface Generic DT Bindings
8
9maintainers:
10  - Rob Herring <robh@kernel.org>
11  - Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12
13description:
14  This document lists a set of generic properties for describing UARTs in a
15  device tree.  Whether these properties apply to a particular device depends
16  on the DT bindings for the actual device.
17
18  Each enabled UART may have an optional "serialN" alias in the "aliases" node,
19  where N is the port number (non-negative decimal integer) as printed on the
20  label next to the physical port.
21
22properties:
23  $nodename:
24    pattern: "^serial(@.*)?$"
25
26  cts-gpios:
27    maxItems: 1
28    description:
29      Must contain a GPIO specifier, referring to the GPIO pin to be used as
30      the UART's CTS line.
31
32  dcd-gpios:
33    maxItems: 1
34    description:
35      Must contain a GPIO specifier, referring to the GPIO pin to be used as
36      the UART's DCD line.
37
38  dsr-gpios:
39    maxItems: 1
40    description:
41      Must contain a GPIO specifier, referring to the GPIO pin to be used as
42      the UART's DSR line.
43
44  dtr-gpios:
45    maxItems: 1
46    description:
47      Must contain a GPIO specifier, referring to the GPIO pin to be used as
48      the UART's DTR line.
49
50  rng-gpios:
51    maxItems: 1
52    description:
53      Must contain a GPIO specifier, referring to the GPIO pin to be used as
54      the UART's RNG line.
55
56  rts-gpios:
57    maxItems: 1
58    description:
59      Must contain a GPIO specifier, referring to the GPIO pin to be used as
60      the UART's RTS line.
61
62  uart-has-rtscts:
63    $ref: /schemas/types.yaml#/definitions/flag
64    description:
65      The presence of this property indicates that the UART has dedicated lines
66      for RTS/CTS hardware flow control, and that they are available for use
67      (wired and enabled by pinmux configuration).  This depends on both the
68      UART hardware and the board wiring.
69
70  rx-tx-swap:
71    type: boolean
72    description: RX and TX pins are swapped.
73
74  cts-rts-swap:
75    type: boolean
76    description: CTS and RTS pins are swapped.
77
78  rx-threshold:
79    $ref: /schemas/types.yaml#/definitions/uint32
80    description:
81      RX FIFO threshold configuration (in bytes).
82
83  tx-threshold:
84    $ref: /schemas/types.yaml#/definitions/uint32
85    description:
86      TX FIFO threshold configuration (in bytes).
87
88if:
89  required:
90    - uart-has-rtscts
91then:
92  properties:
93    cts-gpios: false
94    rts-gpios: false
95
96patternProperties:
97  ".*":
98    if:
99      type: object
100    then:
101      description:
102        Serial attached devices shall be a child node of the host UART device
103        the slave device is attached to. It is expected that the attached
104        device is the only child node of the UART device. The slave device node
105        name shall reflect the generic type of device for the node.
106
107      properties:
108        compatible:
109          description:
110            Compatible of the device connected to the serial port.
111
112        max-speed:
113          $ref: /schemas/types.yaml#/definitions/uint32
114          description:
115            The maximum baud rate the device operates at.
116            This should only be present if the maximum is less than the slave
117            device can support.  For example, a particular board has some
118            signal quality issue or the host processor can't support higher
119            baud rates.
120
121        current-speed:
122          $ref: /schemas/types.yaml#/definitions/uint32
123          description: |
124            The current baud rate the device operates at.
125            This should only be present in case a driver has no chance to know
126            the baud rate of the slave device.
127            Examples:
128              * device supports auto-baud
129              * the rate is setup by a bootloader and there is no way to reset
130                the device
131              * device baud rate is configured by its firmware but there is no
132                way to request the actual settings
133
134      required:
135        - compatible
136
137additionalProperties: true
138
139examples:
140  - |
141    serial@1234 {
142            compatible = "ns16550a";
143            reg = <0x1234 0x20>;
144            interrupts = <1>;
145
146            bluetooth {
147                    compatible = "brcm,bcm4330-bt";
148                    interrupt-parent = <&gpio>;
149                    interrupts = <10>;
150            };
151    };
152