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.

passing crossbar DMA event number form AM437x.dtsi

Other Parts Discussed in Thread: AM4372

Hi ,

I want to use DMA for spi transfer .I am using spi 3. I am writing a driver for ads chip which communicates with Mcspi and spi driver .But when I refereed the TRM of Am437x for DMA event number which I should pass in am4372.dtsi file in my spi3 node , I found that it uses crossbar DMA and not generic DMA . Does crossbar DMA event initialized the same as generic DMA. I am passing the info like this : -

 dmas = <&edma 53

      &edma 54>;

dma-names = "tx","rx";

Refereed Documentation/devicetree/bindings/spi/omap-spi.txt

But when the mcspi driver loads in startup . I always get info like this    spi spi1.0: not using DMA for McSPI . 

 


Thanks

rahul

  • Hi ,

    I have mapped two crossbar event number to two Direct edma mapped events (page 1632) of Am437x TRM . Is it the correct way of initializing it in dts file ? .
    map 53(crossbar) to 40(Direct edma)
    map 54(crossbar ) to 41(Direct edma)

    &edma {
    ti,edma-xbar-event-map = < 53 40
    54 41>;
    };

    Thanks
    rahul
  • Hi Rahul,

    I will forward this to the SW team.

  • Hi Rahul,

    In that case you need to define the direct edma in the &spi device tree node. You may see the &mmc3 device tree node in am4372.dtsi as reference:
    &mmc3 {
              status = "okay";
              /* these are on the crossbar and are outlined in the
                xbar-event-map element */
              dmas = <&edma 30
                             &edma 31>;

    And later in &edma :
    &edma {
           ti,edma-xbar-event-map = /bits/ 16 <1 30
                                                                     2 31>;
    };


    So for your spi device tree node you need to have:
    &spi3 {
            dmas = <&edma 40

                           &edma 41>;

             dma-names = "tx0","rx0";
    ..............
    }
    and later
    &edma {
              ti,edma-xbar-event-map = /bits/ 16 < 53 40
                                                                         54 41>;
    };

    Best Regards,
    Yordan

  • Hi yordan,

    Thanks for the reply . I want to do DMA transfer through SPI. So for that what all should I config in my driver . After transfer my callback function is not getting called (spi_message.complete) . For DMA transfer I have seen line(1219) spi-omap2_mcspi.c that min bytes should be more than 160 . currently I am following this way :-

    spi->dev.coherent_dma_mask = ~0
    dev->tx_buff = dma_alloc_coherent

    struct spi_message msg = { };
    struct spi_transfer transfer = { };
    msg.actual_length = 1; // Is this required ?
    msg.is_dma_mapped = 1; // Is this required ?
    spi_message_init(&msg);
    dev->tx_buff[0] = data;
    transfer.tx_buf = dev->tx_buff;
    transfer.rx_buf = dev->rx_buff;
    transfer.bits_per_word = 24; // I want my message to have 24 bit transfer
    transfer.len = 1; / /IS this required ? I
    msg.complete = my_complete; // Not getting called . Why ?
    }

    What about 

    transfer.tx_dma ?

    transfer.rx_dma ? 

    Are these required ?

    Is this info sufficient for DMA transfer . or is this correct way to do DMA transfer in SPI .In this my_complete callback function is not getting called . Why is it so ? Is this much transfer length sufficient for DMA transfer ? when I define my len as 1 . I do not find any data on my MOSI lines nor I find clk ??

    Thanks
    rahul