xref: /freebsd/sys/contrib/device-tree/Bindings/serial/serial.yaml (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
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  label: true
27
28  cts-gpios:
29    maxItems: 1
30    description:
31      Must contain a GPIO specifier, referring to the GPIO pin to be used as
32      the UART's CTS line.
33
34  dcd-gpios:
35    maxItems: 1
36    description:
37      Must contain a GPIO specifier, referring to the GPIO pin to be used as
38      the UART's DCD line.
39
40  dsr-gpios:
41    maxItems: 1
42    description:
43      Must contain a GPIO specifier, referring to the GPIO pin to be used as
44      the UART's DSR line.
45
46  dtr-gpios:
47    maxItems: 1
48    description:
49      Must contain a GPIO specifier, referring to the GPIO pin to be used as
50      the UART's DTR line.
51
52  rng-gpios:
53    maxItems: 1
54    description:
55      Must contain a GPIO specifier, referring to the GPIO pin to be used as
56      the UART's RNG line.
57
58  rts-gpios:
59    maxItems: 1
60    description:
61      Must contain a GPIO specifier, referring to the GPIO pin to be used as
62      the UART's RTS line.
63
64  uart-has-rtscts:
65    $ref: /schemas/types.yaml#/definitions/flag
66    description:
67      The presence of this property indicates that the UART has dedicated lines
68      for RTS/CTS hardware flow control, and that they are available for use
69      (wired and enabled by pinmux configuration).  This depends on both the
70      UART hardware and the board wiring.
71
72  rx-tx-swap:
73    type: boolean
74    description: RX and TX pins are swapped.
75
76  cts-rts-swap:
77    type: boolean
78    description: CTS and RTS pins are swapped.
79
80  rx-threshold:
81    $ref: /schemas/types.yaml#/definitions/uint32
82    description:
83      RX FIFO threshold configuration (in bytes).
84
85  tx-threshold:
86    $ref: /schemas/types.yaml#/definitions/uint32
87    description:
88      TX FIFO threshold configuration (in bytes).
89
90if:
91  required:
92    - uart-has-rtscts
93then:
94  properties:
95    cts-gpios: false
96    rts-gpios: false
97
98patternProperties:
99  ".*":
100    if:
101      type: object
102    then:
103      description:
104        Serial attached devices shall be a child node of the host UART device
105        the slave device is attached to. It is expected that the attached
106        device is the only child node of the UART device. The slave device node
107        name shall reflect the generic type of device for the node.
108
109      properties:
110        compatible:
111          description:
112            Compatible of the device connected to the serial port.
113
114        max-speed:
115          $ref: /schemas/types.yaml#/definitions/uint32
116          description:
117            The maximum baud rate the device operates at.
118            This should only be present if the maximum is less than the slave
119            device can support.  For example, a particular board has some
120            signal quality issue or the host processor can't support higher
121            baud rates.
122
123        current-speed:
124          $ref: /schemas/types.yaml#/definitions/uint32
125          description: |
126            The current baud rate the device operates at.
127            This should only be present in case a driver has no chance to know
128            the baud rate of the slave device.
129            Examples:
130              * device supports auto-baud
131              * the rate is setup by a bootloader and there is no way to reset
132                the device
133              * device baud rate is configured by its firmware but there is no
134                way to request the actual settings
135
136      required:
137        - compatible
138
139additionalProperties: true
140
141examples:
142  - |
143    serial@1234 {
144            compatible = "ns16550a";
145            reg = <0x1234 0x20>;
146            interrupts = <1>;
147
148            bluetooth {
149                    compatible = "brcm,bcm4330-bt";
150                    interrupt-parent = <&gpio>;
151                    interrupts = <10>;
152            };
153    };
154