6

I'm working on a Zynq-7000 running Yocto and I am trying to expose a DMA controller (the AXI DMA IP block running in the FPGA fabric) to the Linux user space.

In the simple case, the DMA controller has a memory space of 0x60 bytes and typically a starting address of 0x40400000. Within this range are registers for controlling reads and writes, where:

  • 0x40400000 -> 0x4040002F control reading from memory.
  • 0x40400030 -> 0x4040005F control writing to memory.

The DMA controller has two interrupts, one each for reads and writes.

Attempt 1:

I have managed to use uio-pdrv-genirq to expose this memory to user space but I could only include a single interrupt. Even if I add a second interrupt in the device tree, the driver just ignores it (which is also apparent from reading the driver code).

Even if I could register a second interrupt by modifying the driver, AFAICT there is no way to tell from userspace which interrupt was triggered, so the accesses would still need to be serialized.

Attempt 2:

To get around this I tried to add two devices in the device tree. One device to control the reads with its own interrupt and one device to control the writes with its own interrupt. I set them both compatible to the uio-pdrv-genirq driver. I then set the memory spaces to be:

  • Start address: 0x40400000; Size: 0x30; For the reads.
  • Start address: 0x40400030; Size: 0x30; For the writes.

As expected, two devices are created in this case.

However, in the user space application, mmap fails when I try to map a memory space which is set to be anything less than 0x1000 (the page size) in the device tree.

Basically, how can I expose a device with two interrupts (or equivalently, two devices with close addresses) to userspace, such that it is possible to infer the interrupts properly?

0 Answers0