| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | * Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART) |
| 2 | |
| 3 | Required properties for USART: |
| 4 | - compatible: Should be "atmel,<chip>-usart" or "atmel,<chip>-dbgu" |
| 5 | The compatible <chip> indicated will be the first SoC to support an |
| 6 | additional mode or an USART new feature. |
| 7 | For the dbgu UART, use "atmel,<chip>-dbgu", "atmel,<chip>-usart" |
| 8 | - reg: Should contain registers location and length |
| 9 | - interrupts: Should contain interrupt |
| 10 | - clock-names: tuple listing input clock names. |
| 11 | Required elements: "usart" |
| 12 | - clocks: phandles to input clocks. |
| 13 | |
| 14 | Required properties for USART in SPI mode: |
| 15 | - #size-cells : Must be <0> |
| 16 | - #address-cells : Must be <1> |
| 17 | - cs-gpios: chipselects (internal cs not supported) |
| 18 | - atmel,usart-mode : Must be <AT91_USART_MODE_SPI> (found in dt-bindings/mfd/at91-usart.h) |
| 19 | |
| 20 | Optional properties in serial and SPI mode: |
| 21 | - dma bindings for dma transfer: |
| 22 | - dmas: DMA specifier, consisting of a phandle to DMA controller node, |
| 23 | memory peripheral interface and USART DMA channel ID, FIFO configuration. |
| 24 | The order of DMA channels is fixed. The first DMA channel must be TX |
| 25 | associated channel and the second one must be RX associated channel. |
| 26 | Refer to dma.txt and atmel-dma.txt for details. |
| 27 | - dma-names: "tx" for TX channel. |
| 28 | "rx" for RX channel. |
| 29 | The order of dma-names is also fixed. The first name must be "tx" |
| 30 | and the second one must be "rx" as in the examples below. |
| 31 | |
| 32 | Optional properties in serial mode: |
| 33 | - atmel,use-dma-rx: use of PDC or DMA for receiving data |
| 34 | - atmel,use-dma-tx: use of PDC or DMA for transmitting data |
| 35 | - {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively. |
| 36 | It will use specified PIO instead of the peripheral function pin for the USART feature. |
| 37 | If unsure, don't specify this property. |
| 38 | - atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO |
| 39 | capable USARTs. |
| 40 | - rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt |
| 41 | |
| 42 | <chip> compatible description: |
| 43 | - at91rm9200: legacy USART support |
| 44 | - at91sam9260: generic USART implementation for SAM9 SoCs |
| 45 | |
| 46 | Example: |
| 47 | - use PDC: |
| 48 | usart0: serial@fff8c000 { |
| 49 | compatible = "atmel,at91sam9260-usart"; |
| 50 | reg = <0xfff8c000 0x4000>; |
| 51 | interrupts = <7>; |
| 52 | clocks = <&usart0_clk>; |
| 53 | clock-names = "usart"; |
| 54 | atmel,use-dma-rx; |
| 55 | atmel,use-dma-tx; |
| 56 | rts-gpios = <&pioD 15 GPIO_ACTIVE_LOW>; |
| 57 | cts-gpios = <&pioD 16 GPIO_ACTIVE_LOW>; |
| 58 | dtr-gpios = <&pioD 17 GPIO_ACTIVE_LOW>; |
| 59 | dsr-gpios = <&pioD 18 GPIO_ACTIVE_LOW>; |
| 60 | dcd-gpios = <&pioD 20 GPIO_ACTIVE_LOW>; |
| 61 | rng-gpios = <&pioD 19 GPIO_ACTIVE_LOW>; |
| 62 | }; |
| 63 | |
| 64 | - use DMA: |
| 65 | usart0: serial@f001c000 { |
| 66 | compatible = "atmel,at91sam9260-usart"; |
| 67 | reg = <0xf001c000 0x100>; |
| 68 | interrupts = <12 4 5>; |
| 69 | clocks = <&usart0_clk>; |
| 70 | clock-names = "usart"; |
| 71 | atmel,use-dma-rx; |
| 72 | atmel,use-dma-tx; |
| 73 | dmas = <&dma0 2 0x3>, |
| 74 | <&dma0 2 0x204>; |
| 75 | dma-names = "tx", "rx"; |
| 76 | atmel,fifo-size = <32>; |
| 77 | }; |
| 78 | |
| 79 | - SPI mode: |
| 80 | #include <dt-bindings/mfd/at91-usart.h> |
| 81 | |
| 82 | spi0: spi@f001c000 { |
| 83 | #address-cells = <1>; |
| 84 | #size-cells = <0>; |
| 85 | compatible = "atmel,at91rm9200-usart", "atmel,at91sam9260-usart"; |
| 86 | atmel,usart-mode = <AT91_USART_MODE_SPI>; |
| 87 | reg = <0xf001c000 0x100>; |
| 88 | interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>; |
| 89 | clocks = <&usart0_clk>; |
| 90 | clock-names = "usart"; |
| 91 | dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(3)>, |
| 92 | <&dma0 2 (AT91_DMA_CFG_PER_ID(4) | AT91_DMA_CFG_FIFOCFG_ASAP)>; |
| 93 | dma-names = "tx", "rx"; |
| 94 | cs-gpios = <&pioB 3 0>; |
| 95 | }; |