DMA Configuration

Configure Kernel Menu for DMA

  1. Under the root directory of freelight-u-sdk, run the following command to enter the kernel menu configuration GUI.
    make linux-menuconfig
  2. Enter the Device Drivers menu.

  3. Select the DMA Engine support option and enter the next level.

  4. In the DMA Engine support menu, select the DesignWare DMA Support and the DesignWare DMA Support for StarFive SoC options.

  5. Save your change and exit the kernel configuration dialog.

Configure Device Tree for DMA Requests

If a hardware device wants to use the DMA controller, the general configuration information about the used DMA channels should be included in the DTSI file.

The following code example sets up DMA data transfer for a hardware device in the device tree.
tdm: tdm@10090000 {
......
dmas = <&dma 20 1>, <&dma 21 1>; 
dma-names = "rx", "tx";
......
};
Parameter Explanations:
  • tdm: Defines a hardware device node in the device tree.

    In this code example, the TDM hardware device (at address 0x10090000) is requesting DMA service.

  • dmas: Defines DMA channels for the device. Each channel has 3 parts:
    • &dma: The reference DMA node
    • 20/21: DMA channel numbers
    • 1: Burst length (1 means transfer 4 words at a time)
  • dma-names: Names the DMA channels. These names are used by the driver to identify channels.

    rx: Receive channel; tx: transmit channel

    In this code example, <&dma 20 1> is the RX channel and <&dma 21 1> is the TX channel, both transferring 4 words at a time.