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.

Linux/AM5728: DMA not being triggered when using eDMA for GPMC

Part Number: AM5728

Tool/software: Linux

'm using a TI AM5728 running a 4.1.13 kernel and trying to perform DMA from the GPMC peripheral into a buffer allocated in my driver. I've been struggling to understand why nothing is happening and this is due to my lack of understanding of the "appropriate" addresses that need to be specified when setting up DMA.

I have set up my DTS such that my device is a child node of the GPMC:

&gpmc {
    pinctrl-names="default";
    pinctrl-0 = <&fpga_pins_default>; 
    ranges = <3 0 0x3000000 0x0100000>; /* fpga */

    hs_gpmc: fpga@3,0 { 
        reg = <3 0 0x100000>;

        #address-cells = <1>;
        #size-cells = <1>;
        interrupt-parent = <&gpio1>;
        interrupts = <29 IRQ_TYPE_EDGE_FALLING>;
        dmas = <&edma_xbar 4>;
        dma-names = "rxtx";
        compatible = "lgs,hs-fpga";

        bank-width = <2>;
        .
        . 
        .

I'm using a TI AM5728 running a 4.1.13 kernel and trying to perform DMA from the GPMC peripheral into a buffer allocated in my driver. I've been struggling to understand why nothing is happening and this is due to my lack of understanding of the "appropriate" addresses that need to be specified when setting up DMA.

I have set up my DTS such that my device is a child node of the GPMC:

&gpmc {
    pinctrl-names="default";
    pinctrl-0 = <&fpga_pins_default>; 
    ranges = <3 0 0x3000000 0x0100000>; /* fpga */

    hs_gpmc: fpga@3,0 { 
        reg = <3 0 0x100000>;

        #address-cells = <1>;
        #size-cells = <1>;
        interrupt-parent = <&gpio1>;
        interrupts = <29 IRQ_TYPE_EDGE_FALLING>;
        dmas = <&edma_xbar 4>;
        dma-names = "rxtx";
        compatible = "lgs,hs-fpga";

        bank-width = <2>;
        .
        . 
        .

I believe I'm doing the following correctly since I'm taking a virtual kernel address and mapping it to a DMA address:

/* Set up my buffer to store data FROM the GPMC*/
buf = devm_kzalloc(&pdev->dev, HS_GPMC_FPGA_LEN, (GFP_DMA | GFP_KERNEL));
/* Get a DMA address */
data->dma_start = dma_map_single(&pdev->dev, buf, HS_GPMC_FPGA_LEN, DMA_FROM_DEVICE);

Now, I make sure I get the eDMA controller by requesting a channel that matches the "rxtx" name used by the overall GPMC node:

data->chan = dma_request_slave_channel(&pdev->dev, "rxtx");

and here's the GPMC node in the DTS:

 
gpmc: gpmc@50000000 {
    compatible = "ti,am3352-gpmc";
    ti,hwmods = "gpmc";
    reg = <0x50000000 0x2000>;      /* device IO registers */
    interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
    dmas = <&edma_xbar 4>;
    dma-names = "rxtx";
    gpmc,num-cs = <8>;
    gpmc,num-waitpins = <2>;
    #address-cells = <2>;
    #size-cells = <1>;
    gpio-controller;
    #gpio-cells = <2>;
    interrupt-controller;
    #interrupt-cells = <2>;
    status = "disabled";
};

Finally, I configured the eDMA:

memset(&data->cfg, 0, sizeof(data->cfg));
data->cfg.direction = DMA_DEV_TO_MEM;
data->cfg.src_addr = HS_GPMC_FPGA_DMA_START_ADDRESS;
data->cfg.src_maxburst = 2;
dmaengine_slave_config(data->chan, &data->cfg);

where HS_GPMC_FPGA_DMA_START_ADDRESS is set to 0x3000000 (the start address of my device's physical memory).

However, when the interrupt triggers my driver to start the DMA transaction, I can see that the underlying functions are called in the edma driver, but the GPMC transaction is never conducted nor is the DMA callback called.

Is 0x3000000 a valid address to pass to the DMA engine?