Adding UIO into ZYNQ Devicetree

November 16, 2017


I have found 2 interesting posts online introducing how to add UIO into devicetree (DTS), so users can see /dev/uioX in their systems (X can be 0, 1, ..., etc.).


This post said that you would need to trick the compiler as if the UIO device had an interrupt, even though the UIO device might not have any interrupt in fact.


The other post introduced the interrupt definitions. For example, if users set

interrupts = \<0x0 0x32 0x0\>;

it means the following: "The first value is a flag indicating if the interrupt is an SPI ... The second value is the interrupt number. The translate function adds 16 to SPIs and 32 to non-SPIs, so for interrupts generated by fabric logic in a Zynq, the number in the DTS file should be the hardware number minus 32. The third value is the type of interrupt ..."


Having learned from these posts, I changed my DTS to include:

Note that I have not added generic-uio into the compatible entry yet (I used to do that, but it failed to show UIO in my /dev). So I added the following to the end of the DTS:

The following is the final result on my board: