05-24-2010 05:37 PM - edited 05-24-2010 05:39 PM
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
05-27-2010 11:48 AM
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
05-25-2010 03:53 PM
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.
05-27-2010 11:48 AM
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
07-09-2010 08:14 AM
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.
07-09-2010 10:45 AM
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
07-12-2010 01:11 AM
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!