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
78if:
79  required:
80    - uart-has-rtscts
81then:
82  properties:
83    cts-gpios: false
84    rts-gpios: false
85
86patternProperties:
87  ".*":
88    if:
89      type: object
90    then:
91      description:
92        Serial attached devices shall be a child node of the host UART device
93        the slave device is attached to. It is expected that the attached
94        device is the only child node of the UART device. The slave device node
95        name shall reflect the generic type of device for the node.
96
97      properties:
98        compatible:
99          description:
100            Compatible of the device connected to the serial port.
101
102        max-speed:
103          $ref: /schemas/types.yaml#/definitions/uint32
104          description:
105            The maximum baud rate the device operates at.
106            This should only be present if the maximum is less than the slave
107            device can support.  For example, a particular board has some
108            signal quality issue or the host processor can't support higher
109            baud rates.
110
111        current-speed:
112          $ref: /schemas/types.yaml#/definitions/uint32
113          description: |
114            The current baud rate the device operates at.
115            This should only be present in case a driver has no chance to know
116            the baud rate of the slave device.
117            Examples:
118              * device supports auto-baud
119              * the rate is setup by a bootloader and there is no way to reset
120                the device
121              * device baud rate is configured by its firmware but there is no
122                way to request the actual settings
123
124      required:
125        - compatible
126
127additionalProperties: true
128
129examples:
130  - |
131    serial@1234 {
132            compatible = "ns16550a";
133            reg = <0x1234 0x20>;
134            interrupts = <1>;
135
136            bluetooth {
137                    compatible = "brcm,bcm43341-bt";
138                    interrupt-parent = <&gpio>;
139                    interrupts = <10>;
140            };
141    };
142