1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2c66ec88fSEmmanuel Vadot%YAML 1.2
3c66ec88fSEmmanuel Vadot---
4*fac71e4eSEmmanuel Vadot$id: http://devicetree.org/schemas/serial/serial.yaml#
5*fac71e4eSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6c66ec88fSEmmanuel Vadot
78bab661aSEmmanuel Vadottitle: Serial Interface Generic
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
265956d97fSEmmanuel Vadot  label: true
275956d97fSEmmanuel Vadot
28c66ec88fSEmmanuel Vadot  cts-gpios:
29c66ec88fSEmmanuel Vadot    maxItems: 1
30c66ec88fSEmmanuel Vadot    description:
31c66ec88fSEmmanuel Vadot      Must contain a GPIO specifier, referring to the GPIO pin to be used as
32c66ec88fSEmmanuel Vadot      the UART's CTS line.
33c66ec88fSEmmanuel Vadot
34c66ec88fSEmmanuel Vadot  dcd-gpios:
35c66ec88fSEmmanuel Vadot    maxItems: 1
36c66ec88fSEmmanuel Vadot    description:
37c66ec88fSEmmanuel Vadot      Must contain a GPIO specifier, referring to the GPIO pin to be used as
38c66ec88fSEmmanuel Vadot      the UART's DCD line.
39c66ec88fSEmmanuel Vadot
40c66ec88fSEmmanuel Vadot  dsr-gpios:
41c66ec88fSEmmanuel Vadot    maxItems: 1
42c66ec88fSEmmanuel Vadot    description:
43c66ec88fSEmmanuel Vadot      Must contain a GPIO specifier, referring to the GPIO pin to be used as
44c66ec88fSEmmanuel Vadot      the UART's DSR line.
45c66ec88fSEmmanuel Vadot
46c66ec88fSEmmanuel Vadot  dtr-gpios:
47c66ec88fSEmmanuel Vadot    maxItems: 1
48c66ec88fSEmmanuel Vadot    description:
49c66ec88fSEmmanuel Vadot      Must contain a GPIO specifier, referring to the GPIO pin to be used as
50c66ec88fSEmmanuel Vadot      the UART's DTR line.
51c66ec88fSEmmanuel Vadot
52c66ec88fSEmmanuel Vadot  rng-gpios:
53c66ec88fSEmmanuel Vadot    maxItems: 1
54c66ec88fSEmmanuel Vadot    description:
55c66ec88fSEmmanuel Vadot      Must contain a GPIO specifier, referring to the GPIO pin to be used as
56c66ec88fSEmmanuel Vadot      the UART's RNG line.
57c66ec88fSEmmanuel Vadot
58c66ec88fSEmmanuel Vadot  rts-gpios:
59c66ec88fSEmmanuel Vadot    maxItems: 1
60c66ec88fSEmmanuel Vadot    description:
61c66ec88fSEmmanuel Vadot      Must contain a GPIO specifier, referring to the GPIO pin to be used as
62c66ec88fSEmmanuel Vadot      the UART's RTS line.
63c66ec88fSEmmanuel Vadot
64c66ec88fSEmmanuel Vadot  uart-has-rtscts:
65c66ec88fSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/flag
66c66ec88fSEmmanuel Vadot    description:
67c66ec88fSEmmanuel Vadot      The presence of this property indicates that the UART has dedicated lines
68c66ec88fSEmmanuel Vadot      for RTS/CTS hardware flow control, and that they are available for use
69c66ec88fSEmmanuel Vadot      (wired and enabled by pinmux configuration).  This depends on both the
70c66ec88fSEmmanuel Vadot      UART hardware and the board wiring.
71c66ec88fSEmmanuel Vadot
72c66ec88fSEmmanuel Vadot  rx-tx-swap:
73c66ec88fSEmmanuel Vadot    type: boolean
74c66ec88fSEmmanuel Vadot    description: RX and TX pins are swapped.
75c66ec88fSEmmanuel Vadot
76c66ec88fSEmmanuel Vadot  cts-rts-swap:
77c66ec88fSEmmanuel Vadot    type: boolean
78c66ec88fSEmmanuel Vadot    description: CTS and RTS pins are swapped.
79c66ec88fSEmmanuel Vadot
802eb4d8dcSEmmanuel Vadot  rx-threshold:
812eb4d8dcSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
822eb4d8dcSEmmanuel Vadot    description:
832eb4d8dcSEmmanuel Vadot      RX FIFO threshold configuration (in bytes).
842eb4d8dcSEmmanuel Vadot
852eb4d8dcSEmmanuel Vadot  tx-threshold:
862eb4d8dcSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
872eb4d8dcSEmmanuel Vadot    description:
882eb4d8dcSEmmanuel Vadot      TX FIFO threshold configuration (in bytes).
892eb4d8dcSEmmanuel Vadot
90c66ec88fSEmmanuel Vadotif:
91c66ec88fSEmmanuel Vadot  required:
92c66ec88fSEmmanuel Vadot    - uart-has-rtscts
93c66ec88fSEmmanuel Vadotthen:
94c66ec88fSEmmanuel Vadot  properties:
95c66ec88fSEmmanuel Vadot    cts-gpios: false
96c66ec88fSEmmanuel Vadot    rts-gpios: false
97c66ec88fSEmmanuel Vadot
98c66ec88fSEmmanuel VadotpatternProperties:
99cb7aa33aSEmmanuel Vadot  "^bluetooth|gnss|gps|mcu$":
100c66ec88fSEmmanuel Vadot    if:
101c66ec88fSEmmanuel Vadot      type: object
102c66ec88fSEmmanuel Vadot    then:
103c66ec88fSEmmanuel Vadot      description:
104c66ec88fSEmmanuel Vadot        Serial attached devices shall be a child node of the host UART device
105c66ec88fSEmmanuel Vadot        the slave device is attached to. It is expected that the attached
106c66ec88fSEmmanuel Vadot        device is the only child node of the UART device. The slave device node
107c66ec88fSEmmanuel Vadot        name shall reflect the generic type of device for the node.
108c66ec88fSEmmanuel Vadot
109c66ec88fSEmmanuel Vadot      properties:
110c66ec88fSEmmanuel Vadot        compatible:
111c66ec88fSEmmanuel Vadot          description:
112c66ec88fSEmmanuel Vadot            Compatible of the device connected to the serial port.
113c66ec88fSEmmanuel Vadot
114c66ec88fSEmmanuel Vadot        max-speed:
115c66ec88fSEmmanuel Vadot          $ref: /schemas/types.yaml#/definitions/uint32
116c66ec88fSEmmanuel Vadot          description:
117c66ec88fSEmmanuel Vadot            The maximum baud rate the device operates at.
118c66ec88fSEmmanuel Vadot            This should only be present if the maximum is less than the slave
119c66ec88fSEmmanuel Vadot            device can support.  For example, a particular board has some
120c66ec88fSEmmanuel Vadot            signal quality issue or the host processor can't support higher
121c66ec88fSEmmanuel Vadot            baud rates.
122c66ec88fSEmmanuel Vadot
123c66ec88fSEmmanuel Vadot        current-speed:
124c66ec88fSEmmanuel Vadot          $ref: /schemas/types.yaml#/definitions/uint32
125c66ec88fSEmmanuel Vadot          description: |
126c66ec88fSEmmanuel Vadot            The current baud rate the device operates at.
127c66ec88fSEmmanuel Vadot            This should only be present in case a driver has no chance to know
128c66ec88fSEmmanuel Vadot            the baud rate of the slave device.
129c66ec88fSEmmanuel Vadot            Examples:
130c66ec88fSEmmanuel Vadot              * device supports auto-baud
131c66ec88fSEmmanuel Vadot              * the rate is setup by a bootloader and there is no way to reset
132c66ec88fSEmmanuel Vadot                the device
133c66ec88fSEmmanuel Vadot              * device baud rate is configured by its firmware but there is no
134c66ec88fSEmmanuel Vadot                way to request the actual settings
135c66ec88fSEmmanuel Vadot
136c66ec88fSEmmanuel Vadot      required:
137c66ec88fSEmmanuel Vadot        - compatible
138c66ec88fSEmmanuel Vadot
1396be33864SEmmanuel VadotadditionalProperties: true
1406be33864SEmmanuel Vadot
141c66ec88fSEmmanuel Vadotexamples:
142c66ec88fSEmmanuel Vadot  - |
143c66ec88fSEmmanuel Vadot    serial@1234 {
144c66ec88fSEmmanuel Vadot        compatible = "ns16550a";
145c66ec88fSEmmanuel Vadot        reg = <0x1234 0x20>;
146c66ec88fSEmmanuel Vadot        interrupts = <1>;
147c66ec88fSEmmanuel Vadot
148c66ec88fSEmmanuel Vadot        bluetooth {
1492eb4d8dcSEmmanuel Vadot            compatible = "brcm,bcm4330-bt";
150c66ec88fSEmmanuel Vadot            interrupt-parent = <&gpio>;
151c66ec88fSEmmanuel Vadot            interrupts = <10>;
152c66ec88fSEmmanuel Vadot        };
153c66ec88fSEmmanuel Vadot    };
154