xref: /linux/Documentation/devicetree/bindings/serial/atmel,at91-usart.yaml (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1b9e947fbSSergiu Moga# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2b9e947fbSSergiu Moga# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
3b9e947fbSSergiu Moga%YAML 1.2
4b9e947fbSSergiu Moga---
5b9e947fbSSergiu Moga$id: http://devicetree.org/schemas/serial/atmel,at91-usart.yaml#
6b9e947fbSSergiu Moga$schema: http://devicetree.org/meta-schemas/core.yaml#
7b9e947fbSSergiu Moga
8b9e947fbSSergiu Mogatitle: Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART)
9b9e947fbSSergiu Moga
10b9e947fbSSergiu Mogamaintainers:
11d325a858SRichard Genoud  - Richard Genoud <richard.genoud@bootlin.com>
12b9e947fbSSergiu Moga
13b9e947fbSSergiu Mogaproperties:
14b9e947fbSSergiu Moga  compatible:
15b9e947fbSSergiu Moga    oneOf:
16b9e947fbSSergiu Moga      - enum:
17b9e947fbSSergiu Moga          - atmel,at91rm9200-usart
18b9e947fbSSergiu Moga          - atmel,at91sam9260-usart
19b9e947fbSSergiu Moga      - items:
20b9e947fbSSergiu Moga          - const: atmel,at91rm9200-dbgu
21b9e947fbSSergiu Moga          - const: atmel,at91rm9200-usart
22b9e947fbSSergiu Moga      - items:
23b9e947fbSSergiu Moga          - const: atmel,at91sam9260-dbgu
24b9e947fbSSergiu Moga          - const: atmel,at91sam9260-usart
25b9e947fbSSergiu Moga      - items:
26*755ed2f3SVarshini Rajendran          - enum:
27*755ed2f3SVarshini Rajendran              - microchip,sam9x60-usart
28*755ed2f3SVarshini Rajendran              - microchip,sam9x7-usart
2992d39d01SDurai Manickam KR          - const: atmel,at91sam9260-usart
3092d39d01SDurai Manickam KR      - items:
31b9e947fbSSergiu Moga          - const: microchip,sam9x60-dbgu
32b9e947fbSSergiu Moga          - const: microchip,sam9x60-usart
339e161800SSergiu Moga          - const: atmel,at91sam9260-dbgu
349e161800SSergiu Moga          - const: atmel,at91sam9260-usart
35*755ed2f3SVarshini Rajendran      - items:
36*755ed2f3SVarshini Rajendran          - const: microchip,sam9x7-dbgu
37*755ed2f3SVarshini Rajendran          - const: atmel,at91sam9260-dbgu
38*755ed2f3SVarshini Rajendran          - const: microchip,sam9x7-usart
39*755ed2f3SVarshini Rajendran          - const: atmel,at91sam9260-usart
40b9e947fbSSergiu Moga
41b9e947fbSSergiu Moga  reg:
42b9e947fbSSergiu Moga    maxItems: 1
43b9e947fbSSergiu Moga
44b9e947fbSSergiu Moga  interrupts:
45b9e947fbSSergiu Moga    maxItems: 1
46b9e947fbSSergiu Moga
47b9e947fbSSergiu Moga  clock-names:
4879cb5035SSergiu Moga    minItems: 1
4979cb5035SSergiu Moga    items:
5079cb5035SSergiu Moga      - const: usart
5179cb5035SSergiu Moga      - const: gclk
52b9e947fbSSergiu Moga
53b9e947fbSSergiu Moga  clocks:
5479cb5035SSergiu Moga    minItems: 1
5579cb5035SSergiu Moga    items:
5679cb5035SSergiu Moga      - description: USART Peripheral Clock
5779cb5035SSergiu Moga      - description: USART Generic Clock
58b9e947fbSSergiu Moga
59b9e947fbSSergiu Moga  dmas:
60b9e947fbSSergiu Moga    items:
61b9e947fbSSergiu Moga      - description: TX DMA Channel
62b9e947fbSSergiu Moga      - description: RX DMA Channel
63b9e947fbSSergiu Moga
64b9e947fbSSergiu Moga  dma-names:
65b9e947fbSSergiu Moga    items:
66b9e947fbSSergiu Moga      - const: tx
67b9e947fbSSergiu Moga      - const: rx
68b9e947fbSSergiu Moga
69b9e947fbSSergiu Moga  atmel,usart-mode:
70b9e947fbSSergiu Moga    $ref: /schemas/types.yaml#/definitions/uint32
71b9e947fbSSergiu Moga    description:
72b9e947fbSSergiu Moga      Must be either <AT91_USART_MODE_SPI> for SPI or
73b9e947fbSSergiu Moga      <AT91_USART_MODE_SERIAL> for USART (found in dt-bindings/mfd/at91-usart.h).
74b9e947fbSSergiu Moga    enum: [ 0, 1 ]
75b9e947fbSSergiu Moga
76b9e947fbSSergiu Moga  atmel,use-dma-rx:
77b9e947fbSSergiu Moga    type: boolean
78b9e947fbSSergiu Moga    description: use of PDC or DMA for receiving data
79b9e947fbSSergiu Moga
80b9e947fbSSergiu Moga  atmel,use-dma-tx:
81b9e947fbSSergiu Moga    type: boolean
82b9e947fbSSergiu Moga    description: use of PDC or DMA for transmitting data
83b9e947fbSSergiu Moga
84b9e947fbSSergiu Moga  atmel,fifo-size:
85b9e947fbSSergiu Moga    $ref: /schemas/types.yaml#/definitions/uint32
86b9e947fbSSergiu Moga    description:
87b9e947fbSSergiu Moga      Maximum number of data the RX and TX FIFOs can store for FIFO
88b9e947fbSSergiu Moga      capable USARTS.
89b9e947fbSSergiu Moga    enum: [ 16, 32 ]
90b9e947fbSSergiu Moga
91b9e947fbSSergiu Mogarequired:
92b9e947fbSSergiu Moga  - compatible
93b9e947fbSSergiu Moga  - reg
94b9e947fbSSergiu Moga  - interrupts
95b9e947fbSSergiu Moga  - clock-names
96b9e947fbSSergiu Moga  - clocks
97b9e947fbSSergiu Moga  - atmel,usart-mode
98b9e947fbSSergiu Moga
99b9e947fbSSergiu MogaallOf:
100b9e947fbSSergiu Moga  - if:
101b9e947fbSSergiu Moga      properties:
102b9e947fbSSergiu Moga        atmel,usart-mode:
103b9e947fbSSergiu Moga          const: 1
104b9e947fbSSergiu Moga    then:
105b9e947fbSSergiu Moga      allOf:
106b9e947fbSSergiu Moga        - $ref: /schemas/spi/spi-controller.yaml#
107b9e947fbSSergiu Moga
108b9e947fbSSergiu Moga      properties:
109b9e947fbSSergiu Moga        atmel,use-dma-rx: false
110b9e947fbSSergiu Moga
111b9e947fbSSergiu Moga        atmel,use-dma-tx: false
112b9e947fbSSergiu Moga
113b9e947fbSSergiu Moga        atmel,fifo-size: false
114b9e947fbSSergiu Moga
115b9e947fbSSergiu Moga        "#size-cells":
116b9e947fbSSergiu Moga          const: 0
117b9e947fbSSergiu Moga
118b9e947fbSSergiu Moga        "#address-cells":
119b9e947fbSSergiu Moga          const: 1
120b9e947fbSSergiu Moga
121b9e947fbSSergiu Moga      required:
122b9e947fbSSergiu Moga        - "#size-cells"
123b9e947fbSSergiu Moga        - "#address-cells"
124b9e947fbSSergiu Moga
125b9e947fbSSergiu Moga    else:
126b9e947fbSSergiu Moga      allOf:
127b9e947fbSSergiu Moga        - $ref: /schemas/serial/serial.yaml#
128b9e947fbSSergiu Moga        - $ref: /schemas/serial/rs485.yaml#
129b9e947fbSSergiu Moga
130b9e947fbSSergiu MogaunevaluatedProperties: false
131b9e947fbSSergiu Moga
132b9e947fbSSergiu Mogaexamples:
133b9e947fbSSergiu Moga  - |
134b9e947fbSSergiu Moga    #include <dt-bindings/gpio/gpio.h>
135b9e947fbSSergiu Moga    #include <dt-bindings/interrupt-controller/irq.h>
136b9e947fbSSergiu Moga    #include <dt-bindings/mfd/at91-usart.h>
137b9e947fbSSergiu Moga    #include <dt-bindings/dma/at91.h>
138b9e947fbSSergiu Moga
139b9e947fbSSergiu Moga    /* use PDC */
140b9e947fbSSergiu Moga    usart0: serial@fff8c000 {
141b9e947fbSSergiu Moga        compatible = "atmel,at91sam9260-usart";
142b9e947fbSSergiu Moga        reg = <0xfff8c000 0x4000>;
143b9e947fbSSergiu Moga        atmel,usart-mode = <AT91_USART_MODE_SERIAL>;
144b9e947fbSSergiu Moga        interrupts = <7>;
145b9e947fbSSergiu Moga        clocks = <&usart0_clk>;
146b9e947fbSSergiu Moga        clock-names = "usart";
147b9e947fbSSergiu Moga        atmel,use-dma-rx;
148b9e947fbSSergiu Moga        atmel,use-dma-tx;
149b9e947fbSSergiu Moga        rts-gpios = <&pioD 15 GPIO_ACTIVE_LOW>;
150b9e947fbSSergiu Moga        cts-gpios = <&pioD 16 GPIO_ACTIVE_LOW>;
151b9e947fbSSergiu Moga        dtr-gpios = <&pioD 17 GPIO_ACTIVE_LOW>;
152b9e947fbSSergiu Moga        dsr-gpios = <&pioD 18 GPIO_ACTIVE_LOW>;
153b9e947fbSSergiu Moga        dcd-gpios = <&pioD 20 GPIO_ACTIVE_LOW>;
154b9e947fbSSergiu Moga        rng-gpios = <&pioD 19 GPIO_ACTIVE_LOW>;
155b9e947fbSSergiu Moga    };
156b9e947fbSSergiu Moga
157b9e947fbSSergiu Moga  - |
158b9e947fbSSergiu Moga    #include <dt-bindings/gpio/gpio.h>
159b9e947fbSSergiu Moga    #include <dt-bindings/interrupt-controller/irq.h>
160b9e947fbSSergiu Moga    #include <dt-bindings/mfd/at91-usart.h>
161b9e947fbSSergiu Moga    #include <dt-bindings/dma/at91.h>
162b9e947fbSSergiu Moga
163b9e947fbSSergiu Moga    /* use DMA */
164b9e947fbSSergiu Moga    usart1: serial@f001c000 {
165b9e947fbSSergiu Moga        compatible = "atmel,at91sam9260-usart";
166b9e947fbSSergiu Moga        reg = <0xf001c000 0x100>;
167b9e947fbSSergiu Moga        atmel,usart-mode = <AT91_USART_MODE_SERIAL>;
168b9e947fbSSergiu Moga        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
169b9e947fbSSergiu Moga        clocks = <&usart0_clk>;
170b9e947fbSSergiu Moga        clock-names = "usart";
171b9e947fbSSergiu Moga        atmel,use-dma-rx;
172b9e947fbSSergiu Moga        atmel,use-dma-tx;
173b9e947fbSSergiu Moga        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
174b9e947fbSSergiu Moga               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
175b9e947fbSSergiu Moga        dma-names = "tx", "rx";
176b9e947fbSSergiu Moga        atmel,fifo-size = <32>;
177b9e947fbSSergiu Moga    };
178b9e947fbSSergiu Moga
179b9e947fbSSergiu Moga  - |
180b9e947fbSSergiu Moga    #include <dt-bindings/gpio/gpio.h>
181b9e947fbSSergiu Moga    #include <dt-bindings/interrupt-controller/irq.h>
182b9e947fbSSergiu Moga    #include <dt-bindings/mfd/at91-usart.h>
183b9e947fbSSergiu Moga    #include <dt-bindings/dma/at91.h>
184b9e947fbSSergiu Moga
185b9e947fbSSergiu Moga    /* SPI mode */
186b9e947fbSSergiu Moga    spi0: spi@f001c000 {
187b9e947fbSSergiu Moga        compatible = "atmel,at91sam9260-usart";
188b9e947fbSSergiu Moga        reg = <0xf001c000 0x100>;
189b9e947fbSSergiu Moga        #address-cells = <1>;
190b9e947fbSSergiu Moga        #size-cells = <0>;
191b9e947fbSSergiu Moga        atmel,usart-mode = <AT91_USART_MODE_SPI>;
192b9e947fbSSergiu Moga        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
193b9e947fbSSergiu Moga        clocks = <&usart0_clk>;
194b9e947fbSSergiu Moga        clock-names = "usart";
195b9e947fbSSergiu Moga        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
196b9e947fbSSergiu Moga               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
197b9e947fbSSergiu Moga        dma-names = "tx", "rx";
198b9e947fbSSergiu Moga        cs-gpios = <&pioB 3 GPIO_ACTIVE_HIGH>;
199b9e947fbSSergiu Moga    };
200