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