Hi
I'm trying to write a device driver for a simple FIFO based peripheral which was generated using the "Create/Import Peripheral" wizard in XPS but it seg faults every time I try to read from it. Writing data seems to work without any problems (I haven't Chipscoped the interconnect yet, but that's what I'm about to do). The code in my read function is as follows:
int readData(void *address, int* data)
{
if ((int) address == A2F_OUT_BASE)
{
#ifdef DEBUG
printk(KERN_INFO "Attempting to read from phys: %p, mapped to %p
", address, out_mmio);
#endif
*data = ioread32(out_mmio); /* CRASH HERE */
}
else
return -2;
#ifdef DEBUG
printk(KERN_INFO "Reading %d from %p successful.
", *data, address);
#endif
return SUCCESS;
}
'A2F_OUT_BASE' contains the physical address (hard coded), 'address' has the same value (I've checked), and 'data' (a kernel space pointer) should contain the data I get back; however it crashes during the ioread32. I have previously used ioremap to map the physical address to out_mmio and this does not return 0. As previously mentioned, I have written to the other end of the fifo using the same technique, but with iowrite32, without a segmentation fault.
Is there something special I need to do to get the AXI to read the value, or am I doing this in entirely the wrong way?
Thanks in advance,
Matthew