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.

TDA4VM: how to enable DMA for SPI transfer in linux kernel device tree

Part Number: TDA4VM

hi experts,

   please refer to https://e2e.ti.com/support/processors/f/791/t/947437

   this article enabled PIO mode transfer for spi in linux. but lack of dma

   please help us to enable the dma description in device tree for MCU-SPI0 / MAIN-SPI0 / MAIN-SPI1.

   thanks.

  • Hi,

    Can you elaborate on your use case? What is mandating the DMA transfer?

    Are you using SPI in slave mode or master mode?

    Best Regards,
    Keerthy

  • for one custom board, it act as  master to control a io  chip, and it works at 2mbps,  for another board, it's act as slave to communication with another SOC. and  it works at 4mbps.  we found that the driver source  has the dma enabled code, so we think it's possible to work at dma mode to save cpu resources for applications.  thanks.

  • Hi,

    I am checking internally on this. I will get back to you by early next week.

    - Keerthy

  • Hi,

    Can you try below diff:

    diff --git a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
    index c30d6db35..30f3800f8 100644
    --- a/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
    +++ b/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
    @@ -350,6 +350,18 @@
                    pinctrl-single,function-mask = <0xffffffff>;
            };
     
    +       main_spi0: spi@2100000 {
    +               compatible = "ti,am654-mcspi","ti,omap4-mcspi";
    +               reg = <0x0 0x2100000 0x0 0x400>;
    +               interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
    +               clocks = <&k3_clks 266 1>;
    +               power-domains = <&k3_pds 266 TI_SCI_PD_EXCLUSIVE>;
    +               #address-cells = <1>;
    +               #size-cells = <0>;
    +               dmas = <&main_udmap 0xc600>, <&main_udmap 0x4600>;
    +               dma-names = "tx0", "rx0";
    +       };
    +

    diff --git a/drivers/dma/ti/k3-psil-j721e.c b/drivers/dma/ti/k3-psil-j721e.c
    index 34e3fc565..ab47a97c2 100644
    --- a/drivers/dma/ti/k3-psil-j721e.c
    +++ b/drivers/dma/ti/k3-psil-j721e.c
    @@ -287,6 +287,8 @@ static struct psil_ep j721e_dst_ep_map[] = {
            /* SA2UL */
            PSIL_SA2UL(0xf500, 1),
            PSIL_SA2UL(0xf501, 1),
    +       /* PDMA8 (PDMA_MISC_G0) - SPI0-1 */
    +       PSIL_PDMA_XY_PKT(0xc600),
     };
     

    Other instances will be similar. If this helps you click on verify answer.

    Best Regards,
    Keerthy