AnsweredAssumed Answered

t2081 DMA transfer failed with 256 bytes or more through PCIe

Question asked by james kwong on Nov 17, 2016
Latest reply on Nov 17, 2016 by ufedor

Hi all,
    I got two T2081 connected with PCIe Gen2 2x in our custom board. Both of them are running linux 3.12.19 based on SDK 1.7. When PCIe RC use DMA with different DMA length to copy data from EP to the local DDR RAM, or reverse direction, DMA failed in larger DMA length. I have tried 64, 128, 256 bytes and more, but only 64 and 128 bytes are worked. In the direction from RC to EP, no any error showed up, but actually the DMA transfer failed when I check the memory of EP. And in the other direction, DMA transfer errors showed up with PCIe errors like these:

PCIe error(s) detected
fsl-elo-dma ffe100300.dma: chan4: Transfer Error!
fsl-elo-dma ffe100300.dma: chan4: irq: unhandled sr 0x00000080
PCIe ERR_DR register: 0x00800000
PCIe ERR_CAP_STAT register: 0x80000001
PCIe ERR_CAP_R0 register: 0x00000800
PCIe ERR_CAP_R1 register: 0x00000000
PCIe ERR_CAP_R2 register: 0x00000000
PCIe ERR_CAP_R3 register: 0x00000000

Here are some relative details and something I had tried:
1) EP set up BAR0, 1, 2 with size of 16 MBytes for each. Only the BAR1 is used in the DMA test.
2) RC use physical address 0xc41000000 map to PCIe address 0xe1000000 which is assigned to BAR1 of EP.
3) Use command "lspci -vv -s 00:00.0", we got "MaxPayload 256 bytes, MaxReadReq 512 bytes"
4) To check the address mappings, use some commands like "devmem 0xc41000000" and "devmem 0xc41000000 32 0x12345678" to access the memory of EP. It's worked.
5) use memcpy() instead of DMA with the length. It's worked.
6) use the same code and the same DMA length to do the DMA transfer from local DDR of RC to itself. It's worked too.
7) try some other lengths between 128 and 256 bytes, it turned out that 256 bytes is the threshold.

Any advice is appreciated.