17ef62cebSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
27ef62cebSEmmanuel Vadot# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
37ef62cebSEmmanuel Vadot%YAML 1.2
47ef62cebSEmmanuel Vadot---
57ef62cebSEmmanuel Vadot$id: http://devicetree.org/schemas/serial/atmel,at91-usart.yaml#
67ef62cebSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
77ef62cebSEmmanuel Vadot
87ef62cebSEmmanuel Vadottitle: Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART)
97ef62cebSEmmanuel Vadot
107ef62cebSEmmanuel Vadotmaintainers:
117ef62cebSEmmanuel Vadot  - Richard Genoud <richard.genoud@gmail.com>
127ef62cebSEmmanuel Vadot
137ef62cebSEmmanuel Vadotproperties:
147ef62cebSEmmanuel Vadot  compatible:
157ef62cebSEmmanuel Vadot    oneOf:
167ef62cebSEmmanuel Vadot      - enum:
177ef62cebSEmmanuel Vadot          - atmel,at91rm9200-usart
187ef62cebSEmmanuel Vadot          - atmel,at91sam9260-usart
197ef62cebSEmmanuel Vadot      - items:
207ef62cebSEmmanuel Vadot          - const: atmel,at91rm9200-dbgu
217ef62cebSEmmanuel Vadot          - const: atmel,at91rm9200-usart
227ef62cebSEmmanuel Vadot      - items:
237ef62cebSEmmanuel Vadot          - const: atmel,at91sam9260-dbgu
247ef62cebSEmmanuel Vadot          - const: atmel,at91sam9260-usart
257ef62cebSEmmanuel Vadot      - items:
26*f126890aSEmmanuel Vadot          - const: microchip,sam9x60-usart
27*f126890aSEmmanuel Vadot          - const: atmel,at91sam9260-usart
28*f126890aSEmmanuel Vadot      - items:
297ef62cebSEmmanuel Vadot          - const: microchip,sam9x60-dbgu
307ef62cebSEmmanuel Vadot          - const: microchip,sam9x60-usart
317ef62cebSEmmanuel Vadot          - const: atmel,at91sam9260-dbgu
327ef62cebSEmmanuel Vadot          - const: atmel,at91sam9260-usart
337ef62cebSEmmanuel Vadot
347ef62cebSEmmanuel Vadot  reg:
357ef62cebSEmmanuel Vadot    maxItems: 1
367ef62cebSEmmanuel Vadot
377ef62cebSEmmanuel Vadot  interrupts:
387ef62cebSEmmanuel Vadot    maxItems: 1
397ef62cebSEmmanuel Vadot
407ef62cebSEmmanuel Vadot  clock-names:
417ef62cebSEmmanuel Vadot    minItems: 1
427ef62cebSEmmanuel Vadot    items:
437ef62cebSEmmanuel Vadot      - const: usart
447ef62cebSEmmanuel Vadot      - const: gclk
457ef62cebSEmmanuel Vadot
467ef62cebSEmmanuel Vadot  clocks:
477ef62cebSEmmanuel Vadot    minItems: 1
487ef62cebSEmmanuel Vadot    items:
497ef62cebSEmmanuel Vadot      - description: USART Peripheral Clock
507ef62cebSEmmanuel Vadot      - description: USART Generic Clock
517ef62cebSEmmanuel Vadot
527ef62cebSEmmanuel Vadot  dmas:
537ef62cebSEmmanuel Vadot    items:
547ef62cebSEmmanuel Vadot      - description: TX DMA Channel
557ef62cebSEmmanuel Vadot      - description: RX DMA Channel
567ef62cebSEmmanuel Vadot
577ef62cebSEmmanuel Vadot  dma-names:
587ef62cebSEmmanuel Vadot    items:
597ef62cebSEmmanuel Vadot      - const: tx
607ef62cebSEmmanuel Vadot      - const: rx
617ef62cebSEmmanuel Vadot
627ef62cebSEmmanuel Vadot  atmel,usart-mode:
637ef62cebSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
647ef62cebSEmmanuel Vadot    description:
657ef62cebSEmmanuel Vadot      Must be either <AT91_USART_MODE_SPI> for SPI or
667ef62cebSEmmanuel Vadot      <AT91_USART_MODE_SERIAL> for USART (found in dt-bindings/mfd/at91-usart.h).
677ef62cebSEmmanuel Vadot    enum: [ 0, 1 ]
687ef62cebSEmmanuel Vadot
697ef62cebSEmmanuel Vadot  atmel,use-dma-rx:
707ef62cebSEmmanuel Vadot    type: boolean
717ef62cebSEmmanuel Vadot    description: use of PDC or DMA for receiving data
727ef62cebSEmmanuel Vadot
737ef62cebSEmmanuel Vadot  atmel,use-dma-tx:
747ef62cebSEmmanuel Vadot    type: boolean
757ef62cebSEmmanuel Vadot    description: use of PDC or DMA for transmitting data
767ef62cebSEmmanuel Vadot
777ef62cebSEmmanuel Vadot  atmel,fifo-size:
787ef62cebSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
797ef62cebSEmmanuel Vadot    description:
807ef62cebSEmmanuel Vadot      Maximum number of data the RX and TX FIFOs can store for FIFO
817ef62cebSEmmanuel Vadot      capable USARTS.
827ef62cebSEmmanuel Vadot    enum: [ 16, 32 ]
837ef62cebSEmmanuel Vadot
847ef62cebSEmmanuel Vadotrequired:
857ef62cebSEmmanuel Vadot  - compatible
867ef62cebSEmmanuel Vadot  - reg
877ef62cebSEmmanuel Vadot  - interrupts
887ef62cebSEmmanuel Vadot  - clock-names
897ef62cebSEmmanuel Vadot  - clocks
907ef62cebSEmmanuel Vadot  - atmel,usart-mode
917ef62cebSEmmanuel Vadot
927ef62cebSEmmanuel VadotallOf:
937ef62cebSEmmanuel Vadot  - if:
947ef62cebSEmmanuel Vadot      properties:
957ef62cebSEmmanuel Vadot        atmel,usart-mode:
967ef62cebSEmmanuel Vadot          const: 1
977ef62cebSEmmanuel Vadot    then:
987ef62cebSEmmanuel Vadot      allOf:
997ef62cebSEmmanuel Vadot        - $ref: /schemas/spi/spi-controller.yaml#
1007ef62cebSEmmanuel Vadot
1017ef62cebSEmmanuel Vadot      properties:
1027ef62cebSEmmanuel Vadot        atmel,use-dma-rx: false
1037ef62cebSEmmanuel Vadot
1047ef62cebSEmmanuel Vadot        atmel,use-dma-tx: false
1057ef62cebSEmmanuel Vadot
1067ef62cebSEmmanuel Vadot        atmel,fifo-size: false
1077ef62cebSEmmanuel Vadot
1087ef62cebSEmmanuel Vadot        "#size-cells":
1097ef62cebSEmmanuel Vadot          const: 0
1107ef62cebSEmmanuel Vadot
1117ef62cebSEmmanuel Vadot        "#address-cells":
1127ef62cebSEmmanuel Vadot          const: 1
1137ef62cebSEmmanuel Vadot
1147ef62cebSEmmanuel Vadot      required:
1157ef62cebSEmmanuel Vadot        - "#size-cells"
1167ef62cebSEmmanuel Vadot        - "#address-cells"
1177ef62cebSEmmanuel Vadot
1187ef62cebSEmmanuel Vadot    else:
1197ef62cebSEmmanuel Vadot      allOf:
1207ef62cebSEmmanuel Vadot        - $ref: /schemas/serial/serial.yaml#
1217ef62cebSEmmanuel Vadot        - $ref: /schemas/serial/rs485.yaml#
1227ef62cebSEmmanuel Vadot
1237ef62cebSEmmanuel VadotunevaluatedProperties: false
1247ef62cebSEmmanuel Vadot
1257ef62cebSEmmanuel Vadotexamples:
1267ef62cebSEmmanuel Vadot  - |
1277ef62cebSEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
1287ef62cebSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
1297ef62cebSEmmanuel Vadot    #include <dt-bindings/mfd/at91-usart.h>
1307ef62cebSEmmanuel Vadot    #include <dt-bindings/dma/at91.h>
1317ef62cebSEmmanuel Vadot
1327ef62cebSEmmanuel Vadot    /* use PDC */
1337ef62cebSEmmanuel Vadot    usart0: serial@fff8c000 {
1347ef62cebSEmmanuel Vadot        compatible = "atmel,at91sam9260-usart";
1357ef62cebSEmmanuel Vadot        reg = <0xfff8c000 0x4000>;
1367ef62cebSEmmanuel Vadot        atmel,usart-mode = <AT91_USART_MODE_SERIAL>;
1377ef62cebSEmmanuel Vadot        interrupts = <7>;
1387ef62cebSEmmanuel Vadot        clocks = <&usart0_clk>;
1397ef62cebSEmmanuel Vadot        clock-names = "usart";
1407ef62cebSEmmanuel Vadot        atmel,use-dma-rx;
1417ef62cebSEmmanuel Vadot        atmel,use-dma-tx;
1427ef62cebSEmmanuel Vadot        rts-gpios = <&pioD 15 GPIO_ACTIVE_LOW>;
1437ef62cebSEmmanuel Vadot        cts-gpios = <&pioD 16 GPIO_ACTIVE_LOW>;
1447ef62cebSEmmanuel Vadot        dtr-gpios = <&pioD 17 GPIO_ACTIVE_LOW>;
1457ef62cebSEmmanuel Vadot        dsr-gpios = <&pioD 18 GPIO_ACTIVE_LOW>;
1467ef62cebSEmmanuel Vadot        dcd-gpios = <&pioD 20 GPIO_ACTIVE_LOW>;
1477ef62cebSEmmanuel Vadot        rng-gpios = <&pioD 19 GPIO_ACTIVE_LOW>;
1487ef62cebSEmmanuel Vadot    };
1497ef62cebSEmmanuel Vadot
1507ef62cebSEmmanuel Vadot  - |
1517ef62cebSEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
1527ef62cebSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
1537ef62cebSEmmanuel Vadot    #include <dt-bindings/mfd/at91-usart.h>
1547ef62cebSEmmanuel Vadot    #include <dt-bindings/dma/at91.h>
1557ef62cebSEmmanuel Vadot
1567ef62cebSEmmanuel Vadot    /* use DMA */
1577ef62cebSEmmanuel Vadot    usart1: serial@f001c000 {
1587ef62cebSEmmanuel Vadot        compatible = "atmel,at91sam9260-usart";
1597ef62cebSEmmanuel Vadot        reg = <0xf001c000 0x100>;
1607ef62cebSEmmanuel Vadot        atmel,usart-mode = <AT91_USART_MODE_SERIAL>;
1617ef62cebSEmmanuel Vadot        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
1627ef62cebSEmmanuel Vadot        clocks = <&usart0_clk>;
1637ef62cebSEmmanuel Vadot        clock-names = "usart";
1647ef62cebSEmmanuel Vadot        atmel,use-dma-rx;
1657ef62cebSEmmanuel Vadot        atmel,use-dma-tx;
1667ef62cebSEmmanuel Vadot        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
1677ef62cebSEmmanuel Vadot               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
1687ef62cebSEmmanuel Vadot        dma-names = "tx", "rx";
1697ef62cebSEmmanuel Vadot        atmel,fifo-size = <32>;
1707ef62cebSEmmanuel Vadot    };
1717ef62cebSEmmanuel Vadot
1727ef62cebSEmmanuel Vadot  - |
1737ef62cebSEmmanuel Vadot    #include <dt-bindings/gpio/gpio.h>
1747ef62cebSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
1757ef62cebSEmmanuel Vadot    #include <dt-bindings/mfd/at91-usart.h>
1767ef62cebSEmmanuel Vadot    #include <dt-bindings/dma/at91.h>
1777ef62cebSEmmanuel Vadot
1787ef62cebSEmmanuel Vadot    /* SPI mode */
1797ef62cebSEmmanuel Vadot    spi0: spi@f001c000 {
1807ef62cebSEmmanuel Vadot        compatible = "atmel,at91sam9260-usart";
1817ef62cebSEmmanuel Vadot        reg = <0xf001c000 0x100>;
1827ef62cebSEmmanuel Vadot        #address-cells = <1>;
1837ef62cebSEmmanuel Vadot        #size-cells = <0>;
1847ef62cebSEmmanuel Vadot        atmel,usart-mode = <AT91_USART_MODE_SPI>;
1857ef62cebSEmmanuel Vadot        interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
1867ef62cebSEmmanuel Vadot        clocks = <&usart0_clk>;
1877ef62cebSEmmanuel Vadot        clock-names = "usart";
1887ef62cebSEmmanuel Vadot        dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>,
1897ef62cebSEmmanuel Vadot               <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
1907ef62cebSEmmanuel Vadot        dma-names = "tx", "rx";
1917ef62cebSEmmanuel Vadot        cs-gpios = <&pioB 3 GPIO_ACTIVE_HIGH>;
1927ef62cebSEmmanuel Vadot    };
193