Direct Memory Access (DMA) Configuration for Series 2#

Direct Memory Access (DMA) support is available in most peripheral drivers for Series 2 devices and can be enabled as needed.

The DMA API of Zephyr is documented upstream. This document describes how to configure and use DMA on Series 2 devices.

DMA Transfer Configuration#

DMA configuration is performed using struct dma_config, which contains a linked list of struct dma_block_config structures that represent individual transfers.

On Series 2 devices, the DMA driver for the Linked Direct Memory Access (LDMA) peripheral creates a list of LDMA hardware descriptors (LDMA_Descriptor_t) from the list of struct dma_block_config items passed to the driver.

Each struct dma_block_config item requires at least one LDMA descriptor. If the block transfer count exceeds the maximum transfer size of a single descriptor (4096), multiple linked LDMA descriptors are created to represent the block.

The Kconfig option CONFIG_DMA_MAX_DESCRIPTOR configures the size of the memory pool used for LDMA descriptors, and is shared by all DMA users in the system.

Serial (USART)#

The Serial driver for the USART peripheral, using the silabs,usart-uart binding, uses DMA to implement the asynchronous UART API (enabled using CONFIG_UART_ASYNC_API).

Prerequisites#

  1. Enable the LDMA Devicetree node.

    &dma0 {
        status = "okay";
    };
  2. For UART instances that should use DMA, configure two dmas properties named tx and rx to connect to the appropriate LDMA peripheral request signals.

    &usart0 {
        dmas = <&dma0 DMA_REQSEL_USART0TXBL>,
               <&dma0 DMA_REQSEL_USART0RXDATAV>;
        dma-names = "tx", "rx";
    };
  3. For UART instances that should not use DMA, do not include DMA configurations in their Devicetree node.

  4. Set CONFIG_UART_ASYNC_API to y.

SPI (EUSART)#

The SPI driver for the EUSART peripheral, using the silabs,eusart-spi binding, can optionally use DMA for both blocking and asynchronous operations.

Configuration#

The Kconfig option CONFIG_SPI_SILABS_EUSART_DMA_MAX_BLOCKS configures the maximum number of struct dma_block_config used to represent the transfers in a struct spi_buf_set.

Prerequisites#

  1. Enable the LDMA node in Devicetree:

    &dma0 {
    	status = "okay";
    };
  2. . For EUSART instances that should use DMA, configure two dmas properties named tx and rx to connect to the appropriate LDMA peripheral request signals.

    &eusart1 {
        dmas = <&dma0 DMA_REQSEL_EUSART1TXFL>,
               <&dma0 DMA_REQSEL_EUSART1RXFL>;
        dma-names = "tx", "rx";
    };
  3. For EUSART instances that should not use DMA, do not include DMA configurations in their Devicetree node.

  4. Set CONFIG_SPI_SILABS_EUSART_DMA to y.

    • This is selected automatically if CONFIG_SPI_ASYNC is y.

    • Set manually if using blocking operations, and DMA support is desired.

I2C#

The driver for the I2C peripheral, using the silabs,i2c binding, can optionally use DMA for both blocking and asynchronous operations.

Prerequisites#

  1. Enable the LDMA Devicetree node.

    &dma0 {
    	status = "okay";
    };
  2. For I2C instances that should use DMA, configure two dmas properties named tx and rx to connect to the appropriate LDMA peripheral request signals.

    &i2c0 {
    	dmas = <&dma0 DMA_REQSEL_I2C0TXBL>,
    	       <&dma0 DMA_REQSEL_I2C0RXDATAV>;
    	dma-names = "tx", "rx";
    };
  3. For I2C instances that should not use DMA, do not include DMA configurations in their Devicetree node.

  4. Set CONFIG_DMA to y.

Flash#

The on-chip flash driver, defined by the silabs,series2-flash-controller binding, supports optional DMA for write and read operations.

Prerequisites#

  1. Enable the LDMA Devicetree node.

    &dma0 {
    	status = "okay";
    };
  2. The MSC must configure a dmas property that connects to the appropriate LDMA peripheral request signal.

    &msc {
    	dmas = <&dma0 DMA_REQSEL_MSCWDATA>;
    };
  3. Set CONFIG_DMA to y.

  4. To enable DMA for write operations, set CONFIG_SOC_FLASH_SILABS_S2_DMA_WRITE to y. This option is selected automatically if the Devicetree node has a dmas property.

  5. To use DMA for read operations, set CONFIG_SOC_FLASH_SILABS_S2_DMA_READ to y. This option must be selected manually.