xref: /openbmc/linux/Documentation/devicetree/bindings/serial/atmel,at91-usart.yaml (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
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:
11b9e947fbSSergiu Moga  - Richard Genoud <richard.genoud@gmail.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*92d39d01SDurai Manickam KR          - const: microchip,sam9x60-usart
27*92d39d01SDurai Manickam KR          - const: atmel,at91sam9260-usart
28*92d39d01SDurai Manickam KR      - items:
29b9e947fbSSergiu Moga          - const: microchip,sam9x60-dbgu
30b9e947fbSSergiu Moga          - const: microchip,sam9x60-usart
319e161800SSergiu Moga          - const: atmel,at91sam9260-dbgu
329e161800SSergiu Moga          - const: atmel,at91sam9260-usart
33b9e947fbSSergiu Moga
34b9e947fbSSergiu Moga  reg:
35b9e947fbSSergiu Moga    maxItems: 1
36b9e947fbSSergiu Moga
37b9e947fbSSergiu Moga  interrupts:
38b9e947fbSSergiu Moga    maxItems: 1
39b9e947fbSSergiu Moga
40b9e947fbSSergiu Moga  clock-names:
4179cb5035SSergiu Moga    minItems: 1
4279cb5035SSergiu Moga    items:
4379cb5035SSergiu Moga      - const: usart
4479cb5035SSergiu Moga      - const: gclk
45b9e947fbSSergiu Moga
46b9e947fbSSergiu Moga  clocks:
4779cb5035SSergiu Moga    minItems: 1
4879cb5035SSergiu Moga    items:
4979cb5035SSergiu Moga      - description: USART Peripheral Clock
5079cb5035SSergiu Moga      - description: USART Generic Clock
51b9e947fbSSergiu Moga
52b9e947fbSSergiu Moga  dmas:
53b9e947fbSSergiu Moga    items:
54b9e947fbSSergiu Moga      - description: TX DMA Channel
55b9e947fbSSergiu Moga      - description: RX DMA Channel
56b9e947fbSSergiu Moga
57b9e947fbSSergiu Moga  dma-names:
58b9e947fbSSergiu Moga    items:
59b9e947fbSSergiu Moga      - const: tx
60b9e947fbSSergiu Moga      - const: rx
61b9e947fbSSergiu Moga
62b9e947fbSSergiu Moga  atmel,usart-mode:
63b9e947fbSSergiu Moga    $ref: /schemas/types.yaml#/definitions/uint32
64b9e947fbSSergiu Moga    description:
65b9e947fbSSergiu Moga      Must be either <AT91_USART_MODE_SPI> for SPI or
66b9e947fbSSergiu Moga      <AT91_USART_MODE_SERIAL> for USART (found in dt-bindings/mfd/at91-usart.h).
67b9e947fbSSergiu Moga    enum: [ 0, 1 ]
68b9e947fbSSergiu Moga
69b9e947fbSSergiu Moga  atmel,use-dma-rx:
70b9e947fbSSergiu Moga    type: boolean
71b9e947fbSSergiu Moga    description: use of PDC or DMA for receiving data
72b9e947fbSSergiu Moga
73b9e947fbSSergiu Moga  atmel,use-dma-tx:
74b9e947fbSSergiu Moga    type: boolean
75b9e947fbSSergiu Moga    description: use of PDC or DMA for transmitting data
76b9e947fbSSergiu Moga
77b9e947fbSSergiu Moga  atmel,fifo-size:
78b9e947fbSSergiu Moga    $ref: /schemas/types.yaml#/definitions/uint32
79b9e947fbSSergiu Moga    description:
80b9e947fbSSergiu Moga      Maximum number of data the RX and TX FIFOs can store for FIFO
81b9e947fbSSergiu Moga      capable USARTS.
82b9e947fbSSergiu Moga    enum: [ 16, 32 ]
83b9e947fbSSergiu Moga
84b9e947fbSSergiu Mogarequired:
85b9e947fbSSergiu Moga  - compatible
86b9e947fbSSergiu Moga  - reg
87b9e947fbSSergiu Moga  - interrupts
88b9e947fbSSergiu Moga  - clock-names
89b9e947fbSSergiu Moga  - clocks
90b9e947fbSSergiu Moga  - atmel,usart-mode
91b9e947fbSSergiu Moga
92b9e947fbSSergiu MogaallOf:
93b9e947fbSSergiu Moga  - if:
94b9e947fbSSergiu Moga      properties:
95b9e947fbSSergiu Moga        atmel,usart-mode:
96b9e947fbSSergiu Moga          const: 1
97b9e947fbSSergiu Moga    then:
98b9e947fbSSergiu Moga      allOf:
99b9e947fbSSergiu Moga        - $ref: /schemas/spi/spi-controller.yaml#
100b9e947fbSSergiu Moga
101b9e947fbSSergiu Moga      properties:
102b9e947fbSSergiu Moga        atmel,use-dma-rx: false
103b9e947fbSSergiu Moga
104b9e947fbSSergiu Moga        atmel,use-dma-tx: false
105b9e947fbSSergiu Moga
106b9e947fbSSergiu Moga        atmel,fifo-size: false
107b9e947fbSSergiu Moga
108b9e947fbSSergiu Moga        "#size-cells":
109b9e947fbSSergiu Moga          const: 0
110b9e947fbSSergiu Moga
111b9e947fbSSergiu Moga        "#address-cells":
112b9e947fbSSergiu Moga          const: 1
113b9e947fbSSergiu Moga
114b9e947fbSSergiu Moga      required:
115b9e947fbSSergiu Moga        - "#size-cells"
116b9e947fbSSergiu Moga        - "#address-cells"
117b9e947fbSSergiu Moga
118b9e947fbSSergiu Moga    else:
119b9e947fbSSergiu Moga      allOf:
120b9e947fbSSergiu Moga        - $ref: /schemas/serial/serial.yaml#
121b9e947fbSSergiu Moga        - $ref: /schemas/serial/rs485.yaml#
122b9e947fbSSergiu Moga
123b9e947fbSSergiu MogaunevaluatedProperties: false
124b9e947fbSSergiu Moga
125b9e947fbSSergiu Mogaexamples:
126b9e947fbSSergiu Moga  - |
127b9e947fbSSergiu Moga    #include <dt-bindings/gpio/gpio.h>
128b9e947fbSSergiu Moga    #include <dt-bindings/interrupt-controller/irq.h>
129b9e947fbSSergiu Moga    #include <dt-bindings/mfd/at91-usart.h>
130b9e947fbSSergiu Moga    #include <dt-bindings/dma/at91.h>
131b9e947fbSSergiu Moga
132b9e947fbSSergiu Moga    /* use PDC */
133b9e947fbSSergiu Moga    usart0: serial@fff8c000 {
134b9e947fbSSergiu Moga        compatible = "atmel,at91sam9260-usart";
135b9e947fbSSergiu Moga        reg = <0xfff8c000 0x4000>;
136b9e947fbSSergiu Moga        atmel,usart-mode = <AT91_USART_MODE_SERIAL>;
137b9e947fbSSergiu Moga        interrupts = <7>;
138b9e947fbSSergiu Moga        clocks = <&usart0_clk>;
139b9e947fbSSergiu Moga        clock-names = "usart";
140b9e947fbSSergiu Moga        atmel,use-dma-rx;
141b9e947fbSSergiu Moga        atmel,use-dma-tx;
142b9e947fbSSergiu Moga        rts-gpios = <&pioD 15 GPIO_ACTIVE_LOW>;
143b9e947fbSSergiu Moga        cts-gpios = <&pioD 16 GPIO_ACTIVE_LOW>;
144b9e947fbSSergiu Moga        dtr-gpios = <&pioD 17 GPIO_ACTIVE_LOW>;
145b9e947fbSSergiu Moga        dsr-gpios = <&pioD 18 GPIO_ACTIVE_LOW>;
146b9e947fbSSergiu Moga        dcd-gpios = <&pioD 20 GPIO_ACTIVE_LOW>;
147b9e947fbSSergiu Moga        rng-gpios = <&pioD 19 GPIO_ACTIVE_LOW>;
148b9e947fbSSergiu Moga    };
149b9e947fbSSergiu Moga
150b9e947fbSSergiu Moga  - |
151b9e947fbSSergiu Moga    #include <dt-bindings/gpio/gpio.h>
152b9e947fbSSergiu Moga    #include <dt-bindings/interrupt-controller/irq.h>
153b9e947fbSSergiu Moga    #include <dt-bindings/mfd/at91-usart.h>
154b9e947fbSSergiu Moga    #include <dt-bindings/dma/at91.h>
155b9e947fbSSergiu Moga
156b9e947fbSSergiu Moga    /* use DMA */
157b9e947fbSSergiu Moga    usart1: serial@f001c000 {
158b9e947fbSSergiu Moga        compatible = "atmel,at91sam9260-usart";
159b9e947fbSSergiu Moga        reg = <0xf001c000 0x100>;
160b9e947fbSSergiu Moga        atmel,usart-mode = <AT91_USART_MODE_SERIAL>;
161b9e947fbSSergiu Moga        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
162b9e947fbSSergiu Moga        clocks = <&usart0_clk>;
163b9e947fbSSergiu Moga        clock-names = "usart";
164b9e947fbSSergiu Moga        atmel,use-dma-rx;
165b9e947fbSSergiu Moga        atmel,use-dma-tx;
166b9e947fbSSergiu Moga        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
167b9e947fbSSergiu Moga               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
168b9e947fbSSergiu Moga        dma-names = "tx", "rx";
169b9e947fbSSergiu Moga        atmel,fifo-size = <32>;
170b9e947fbSSergiu Moga    };
171b9e947fbSSergiu Moga
172b9e947fbSSergiu Moga  - |
173b9e947fbSSergiu Moga    #include <dt-bindings/gpio/gpio.h>
174b9e947fbSSergiu Moga    #include <dt-bindings/interrupt-controller/irq.h>
175b9e947fbSSergiu Moga    #include <dt-bindings/mfd/at91-usart.h>
176b9e947fbSSergiu Moga    #include <dt-bindings/dma/at91.h>
177b9e947fbSSergiu Moga
178b9e947fbSSergiu Moga    /* SPI mode */
179b9e947fbSSergiu Moga    spi0: spi@f001c000 {
180b9e947fbSSergiu Moga        compatible = "atmel,at91sam9260-usart";
181b9e947fbSSergiu Moga        reg = <0xf001c000 0x100>;
182b9e947fbSSergiu Moga        #address-cells = <1>;
183b9e947fbSSergiu Moga        #size-cells = <0>;
184b9e947fbSSergiu Moga        atmel,usart-mode = <AT91_USART_MODE_SPI>;
185b9e947fbSSergiu Moga        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
186b9e947fbSSergiu Moga        clocks = <&usart0_clk>;
187b9e947fbSSergiu Moga        clock-names = "usart";
188b9e947fbSSergiu Moga        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
189b9e947fbSSergiu Moga               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
190b9e947fbSSergiu Moga        dma-names = "tx", "rx";
191b9e947fbSSergiu Moga        cs-gpios = <&pioB 3 GPIO_ACTIVE_HIGH>;
192b9e947fbSSergiu Moga    };
193