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