This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

am57xx: Suggest what DMA controller I should use for McSPI interaction

Hello,

We are working under SPI master driver to control slave SPI device (AD7590 ADC chip) on SPI bus.

We plan to use McSPI controller of am57xx that should use DMA in cyclic mode to read/write data from slave chip.

Can you suggest what DMA controller (EDMA or SDMA) is more fit our needs?

Could you please describe main differences between them?

Thanks,

Alexey.

  • Hi Alexey,

    As I understand you will need a DMA transfer between peripheral device & memory. For this you can use either of the controllers.  

    Currently in am57xx linux sdk, sdma is used as dma controller for the mcspi, see arch/arm/boot/dts/dra7x.dtsi file, i.e. mcasp1 node:  

     mcspi1: spi@48098000 {

             compatible = "ti,omap4-mcspi";

             reg = <0x48098000 0x200>;

             interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;

             #address-cells = <1>;

             #size-cells = <0>;

             ti,hwmods = "mcspi1";

             ti,spi-num-cs = <4>;

             dmas = <&sdma_xbar 35>,

                          <&sdma_xbar 36>,

                           <&sdma_xbar 37>,

                          <&sdma_xbar 38>,

                          <&sdma_xbar 39>,

                          <&sdma_xbar 40>,

                          <&sdma_xbar 41>,

                           <&sdma_xbar 42>;

                          dma-names = "tx0", "rx0", "tx1", "rx1",

                                                  "tx2", "rx2", "tx3", "rx3";

                          status = "disabled";

    };

    Alexey Arbuzov said:
    Could you please describe main differences between them?

     

    You could check Sections 16.1.1 DMA_SYSTEM Module Overview & 16.2.1 EDMA Module Overview in AM572x TRM, to see what each of the two dma controllers is capable of. One of the main differences is that except transfer between memory and peripheral devices, EDMA can also perform transfers between external memories and between Device subsystems internal memories. 

    EDMA driver examples can be found in PROCESSOR-SDK-RTOS-AM57X. 

    Hope this helps. 

    Best Regards, 
    Yordan

  • Hi Yordan,

    Thank you for answer.

    Does SDMA supports 'cyclic' mode? I mean such mode when DMA controller makes write/read operations by itself in loop, without CPU commands (except first command to enable 'cyclic' mode).

    If yes then can you suggest how to enable such mode using dmaengine API ?

    I want implement my own driver using  as template.

  • Hi Alexey,

    Yes such mode is supported in linux kernel. Have a look at include/linux/dmaengine.h, you have DMA_CYCLIC defined in the dma_transaction_type structure.

    Also check the guides in Documentation/dmaengine.

    Best Regards,
    Yordan
  • You can pass DMA_CYCLIC to dma_cap_set() when requesting the dma channel in spi-omap-mcspi.c driver.

    Best Regards,
    Yordan