cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
coldwarcomms
Observer
Observer
6,768 Views
Registered: ‎01-16-2010

XAPP1129 DMA Problem

Jump to solution

Hello,

 

I am trying to get the XAPP1129 pcore running on my ML510 system. I am having trouble booting the kernel. It is failing in this function in include/asm-generic/dma-mappings-common.h:

 

static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,
                          size_t size,
                          enum dma_data_direction dir,
                          struct dma_attrs *attrs)
{
    struct dma_map_ops *ops = get_dma_ops(dev);
    dma_addr_t addr;

    kmemcheck_mark_initialized(ptr, size);
    BUG_ON(!ops);
    BUG_ON(!valid_dma_direction(dir));
    addr = ops->map_page(dev, virt_to_page(ptr),
                 (unsigned long)ptr & ~PAGE_MASK, size,
                 dir, attrs);
    debug_dma_map_page(dev, virt_to_page(ptr),
               (unsigned long)ptr & ~PAGE_MASK, size,
               dir, addr, true);
    return addr;
}

 

It is failing the BUG_ON(!ops) line. The call to dma_map_single_attrs is being made from xll_example.c as follows:

 

new_buff_physaddr = (u32) dma_map_single(NULL, rx_buff->data,
                                                 LL_EX_BUF_SIZE,
                                                 DMA_FROM_DEVICE);

 

In case you are confused about the funtion names, this is in dma-mapping-common.h:

#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL)

 

Anyways, it looks like passing in NULL as the first parameter could be causing the problem. Is there some other way this should be done?

 

By the way, I am running the newest kernel version from the xilinx tree.

 

Thank you,

 

-Nick

 

0 Kudos
1 Solution

Accepted Solutions
coldwarcomms
Observer
Observer
8,066 Views
Registered: ‎01-16-2010

Thanks John,

 

I took a look at the LLTEMAC driver. I modified all dma_map_single/dma_unmap_single calls to take a device pointer instead of NULL as the first parameter. I got the device structure in xll_example_of_probe using &ofdev->dev and stored it in a global variable for later use by the various functions. Everything seems to work correctly now.

 

-Nick

View solution in original post

0 Kudos
5 Replies
linnj
Xilinx Employee
Xilinx Employee
6,750 Views
Registered: ‎09-10-2008

I think you're seeing where the kernel has changed since that app note was written so that you have to pass a valid device to the API.

 

I had to make changes to our emac driver for that at one time also, not too long ago.

 

You should have a valid device to pass somewhere in your driver.

 

Thanks.

0 Kudos
coldwarcomms
Observer
Observer
8,067 Views
Registered: ‎01-16-2010

Thanks John,

 

I took a look at the LLTEMAC driver. I modified all dma_map_single/dma_unmap_single calls to take a device pointer instead of NULL as the first parameter. I got the device structure in xll_example_of_probe using &ofdev->dev and stored it in a global variable for later use by the various functions. Everything seems to work correctly now.

 

-Nick

View solution in original post

0 Kudos
borja_mrtnz
Contributor
Contributor
6,472 Views
Registered: ‎07-08-2008

 

Hi,

 

I'm writing a Linux driver (based on XAPP1129) for a custom peripheral which uses DMA to transfer data to DDR2. I'm facing the same problem: our kernel halts at the same point.

 

Could you post your code to try to solve the problem?

 

Thank you in advance.

0 Kudos
coldwarcomms
Observer
Observer
6,465 Views
Registered: ‎01-16-2010

Hey,

 

Sure thing. Just go here: http://fpga.ce.rit.edu/?p=linux-2.6-xlnx.git;a=summary and take a look at the latest commit (611ce1ab6280122a42c2882f2909bf05786b99a7).

 

-Nick

borja_mrtnz
Contributor
Contributor
6,437 Views
Registered: ‎07-08-2008

 

Thank you very much!

 

Finally the kernel booted with the steps you gave. Now is the time to probe if the driver works as we want.

 

One kudo for you!

 

 

 

0 Kudos