SDMA to EIM fpga test on 6sl linux 3.0.35

cancel
Showing results for 
Search instead for 
Did you mean: 

SDMA to EIM fpga test on 6sl linux 3.0.35

1,140 Views
jayakumar2
Contributor V

Hi,

I'm using a 6sl board with linux 3.0.35. I have an FPGA connected via EIM using CS1. I'm able to talk to the FPGA using regular host memory read/writes using mmap of /dev/mem physical address 0x0C00_0000 (CS1). I see the 6sl generate the expected EIM cs1 and read/write cycles. So that part is working fine and I'm very happy with that.

 

So I would like to progress to using SDMA to improve performance. I have been experimenting using drivers/char/mxc_sdma_memcopy_test.c. In particular, I'd like to get host-to-fpga DMA (memory to device transfer) working. So I followed the example code and tried to modify it as follows:

 

init_completion(&dma_m2m_ok);

dma_cap_zero(dma_m2m_mask);
dma_cap_set(DMA_SLAVE, dma_m2m_mask);
m2m_dma_data.peripheral_type = IMX_DMATYPE_MEMORY;

 

I chose IMX_DMATYPE_MEMORY since I believe host memory to EIM memory target is memory type transaction. I have not tried other options like IMX_DMATYPE_EXT , IMX_DMATYPE_FIFO_MEMORY since I'm not sure they apply. Please let me know if I should try those.

 

m2m_dma_data.priority = DMA_PRIO_HIGH;

dma_m2m_chan = dma_request_channel(dma_m2m_mask, dma_m2m_filter, &m2m_dma_data);

 

wbuf = kzalloc(SDMA_BUF_SIZE, GFP_DMA);

 

dma_m2m_config.direction = DMA_MEM_TO_DEV;
dma_m2m_config.dst_addr = 0x0C000000;
dma_m2m_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
dmaengine_slave_config(dma_m2m_chan, &dma_m2m_config);

sg_init_table(sg, 1);

sg_set_buf(&sg[0], wbuf, SDMA_BUF_SIZE);

ret = dma_map_sg(NULL, sg, 1, dma_m2m_config.direction);

dma_m2m_desc = dma_m2m_chan->device->device_prep_slave_sg(dma_m2m_chan,sg, 1, dma_m2m_config.direction, DMA_TO_DEVICE);

dma_m2m_desc->callback = dma_m2m_callback;

dmaengine_submit(dma_m2m_desc);

wait_for_completion(&dma_m2m_ok);
dma_unmap_sg(NULL, sg, 1, dma_m2m_config.direction);

 

In above, I hardcoded dst_addr as 0x0C00_0000 because that's the physical address for the EIM CS1 target. When I try this, the sequence seems to execute as expected (completion seen as shown by debug output below) but on the EIM bus I do not see CS1 assert or any activity occur. That's the part I have not been able to figure out. I'm not able to get any activity out on the EIM bus using SDMA.

 

sdma_write:235 submitting for dma
sdma_write:238 waiting for completion
in dma_m2m_callback
sdma_write:278 count=2

 

Full source of the test is attached.

 

I am hoping to find a working example of SDMA host memory to EIM for 6sl 3.0.35 (or similar). If anyone has any debug suggestions or advice, I'd be very grateful!

 

Thanks!

Original Attachment has been moved to: mxc_sdma_memcopy_test.c.zip

Labels (2)
Tags (3)
14 Replies

191 Views
ruiguo
Contributor II

Hi Jaya

I have a similia case with yours. And I use mmap to resolve this problem.You can have a try!

Rui

0 Kudos

191 Views
jayakumar2
Contributor V

Hi Rui,

Thanks for your message. For me, yes, communication with fpga on EIM CS1 via mmap of 0x0C00_0000 works but only for individual read/writes and the speed of transfer for large data is low. That is why I would like to use SDMA to accelerate bulk transfers. Are you using SDMA to EIM and if so how do you do SDMA using mmap?

Thanks!

0 Kudos

191 Views
ruiguo
Contributor II

Hi Jaya

I have the same problem about dma,and I did some research on the internet but could not find a solution.I also have try to use exynos4412 of samsung, but I failed.I have used Cortex-A8 to do the same thing the last year. It worked well. now,I am not clear why cortex-A9 doesn't work.So I am attempting to use mmap to deal it now but I have other problem that the data transfered is incorrect. My method is mmap and memcpy.I hope that we can solve the problem together! latly, I am a chinese graduate student, please forgive me for my poor englis!

Rui

0 Kudos

191 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Jaya

please refer to attached sdk example (mem_2_mem.c)

with description in Chapter 29 Configuring the SDMA Driver

pdf file. For linux one can check imx-test, mxc_sdma_test.c

android-imx6-kitkat/0370-ENGR00233569-Add-test-codes-for-SDMA-M2M-copy-using-.patch at master · rabe... 

Best regards
igor

0 Kudos

191 Views
jayakumar2
Contributor V

Hi Igor,

Thanks for your reply. I checked the link you gave : android-imx6-kitkat/0370-ENGR00233569-Add-test-codes-for-SDMA-M2M-copy-using-.patch at master · rabe... 

That is identical to the mxc_sdma_memcopy_test.c I used. As I mentioned, it does not perform DMA to EIM which is what I'm trying to get an example for.

I also checked the sdk_sdma.zip. I found a userspace sample for memory-to-memory copy via SDMA. I can see there are some samples that do SDMA to UART, IRAM and others but don't see a sample for EIM.

A question on this. For the mxc_sdma_memcopy_test.c, I used the following way to specify the SDMA destination address as the physical address for EIM (the same 0x0C00_0000 address that is used when doing individual memory read/write transactions that work fine) :

dma_m2m_config.dst_addr = 0x0C000000;
dma_m2m_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;

This seems logical to me but I'm wondering if there's something wrong with that approach.

Thanks!

0 Kudos

191 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Jaya

in general sdma customizations are not supported, that is recommended

just to use existing scripts and drivers using them provided by nxp in its official releases.

For porting own sdma codes may be recommended to apply to NXP Professional Services:

http://www.nxp.com/support/nxp-professional-services:PROFESSIONAL-SERVICE

Best regards
igor

0 Kudos

191 Views
jayakumar2
Contributor V

Hi Igor,

Thanks for your reply. However, I'm confused by the following statement:

"just to use existing scripts and drivers using them provided by nxp in its official releases."

I've been asking for an example of an existing script/driver that uses SDMA to transfer host memory to an EIM target, eg: EIM CS1 (0x0C00_0000 address). So far, I have not found any. Could you say clearly whether such an script/driver exists? I am happy and ready to use nxp script/driver but so far none seems to exist for EIM. Please clarify.

Thanks!

0 Kudos

191 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Jaya

SDMA transfer from memory to EIM is not supported in official NXP

BSPs, sorry.

Best regards
igor

0 Kudos

191 Views
ruiguo
Contributor II

Hi Igor

 I have a similiar case with a transfer from fpga to memory that need dma access,and I don't figure out how to work with that. I hope you can give us some help! Thanks very much!

191 Views
igorpadykov
NXP TechSupport
NXP TechSupport
0 Kudos

191 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Jaya

one can try mxc_sdma_memcopy_test patch on

i.MX6 SDMA | NXP Community 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

191 Views
jayakumar2
Contributor V

Hi Igor,

Thanks for your reply. But that patch (0003-ENGR-Add-sdma-memory-to-memory-copy-function-for-ker.patch.txt) is just to convert from 3.0.35 to 3.5/3.10.x. As I mentioned in my post, I'm already using the same mxc_sdma_memcopy_test.c. My post attached the exact version of mxc_sdma_memcopy_test.c.zip that I'm using.

Perhaps you can help me to find out if DMA_MEM_TO_DEV and IMX_DMATYPE_MEMORY is the correct setting to use for host memory to EIM cs1 target (fpga) or if I should be using DMA_MEM_TO_MEM instead?

Thanks!

0 Kudos

191 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Jaya

you are right  IMX_DMATYPE_MEMORY is correct use for host memory to EIM

Best regards
igor

0 Kudos

191 Views
jayakumar2
Contributor V

Hi Igor,

Thanks for your reply. If I understand you correctly, you are saying I should use:

m2m_dma_data.peripheral_type = IMX_DMATYPE_MEMORY;

...

dma_m2m_config.direction = DMA_MEM_TO_MEM;
dma_m2m_config.dst_addr = 0x0C000000;
dma_m2m_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
dmaengine_slave_config(dma_m2m_chan, &dma_m2m_config);

I tried that and also the dma_m2m_config.direction = DMA_MEM_TO_DEV;

Both do not appear to trigger any EIM activity on chipselect 1 or any other chipselect.

Do you have any working example for mx6 that shows working DMA to EIM? (ie: NOT sdma for plain ram memory-to-memory copy).

Thanks!

0 Kudos